private void ImportAsset() { if (m_CopyIntoStreamingAssets) { var newFile = Path.Combine(Application.streamingAssetsPath, "AlembicData"); newFile = Path.Combine(newFile, System.IO.Path.GetFileName(m_ImportSettings.m_pathToAbc)); try { if (!Directory.Exists(Path.GetDirectoryName(newFile))) { Directory.CreateDirectory(Path.GetDirectoryName(newFile)); } File.Copy(m_ImportSettings.m_pathToAbc, newFile, true); } catch { } m_ImportSettings.m_pathToAbc = newFile; } var rootGO = AlembicImportTasker.Import(m_ImportMode, m_ImportSettings, m_DiagSettings, FinalizeImport); if (m_GeneratePrefab) { DestroyImmediate(rootGO); } }
public override void OnImportAsset(AssetImportContext ctx) { m_ImportSettings.m_pathToAbc = new DataPath(ctx.assetPath); var mainObject = AlembicImportTasker.Import(m_importMode, m_ImportSettings, m_diagSettings, (stream, mainGO, streamDescr) => { GenerateSubAssets(ctx, mainGO, stream); if (streamDescr != null) { ctx.AddSubAsset(mainGO.name, streamDescr); } }); ctx.SetMainAsset(mainObject.name, mainObject); }
public override void OnImportAsset(ImportAssetEventArgs args) { m_ImportSettings.m_pathToAbc = args.AssetSourcePath; var mainObject = AlembicImportTasker.Import(m_importMode, m_ImportSettings, m_diagSettings, (stream, mainGO, streamDescr) => { GenerateSubAssets(args, mainGO, stream); if (streamDescr != null) { args.AddSubAsset(mainGO.name, streamDescr); } }); args.SetMainAsset(mainObject.name, mainObject); }