public override void AbcGetConfig(ref AbcAPI.aiConfig config) { if (m_aspectRatioMode != AbcAPI.aiAspectRatioModeOverride.InheritStreamSetting) { config.aspectRatio = AbcAPI.GetAspectRatio((AbcAPI.aiAspectRatioMode)m_aspectRatioMode); } }
// --- public api --- public void AbcLoad(bool createMissingNodes = false) { if (m_playbackSettings == null || m_diagSettings == null || ImportSettings == null || ImportSettings.m_pathToAbc == null) { return; } m_time = 0.0f; m_forceRefresh = true; m_abc = AbcAPI.aiCreateContext(_alembicTreeRoot.linkedGameObj.GetInstanceID()); m_loaded = AbcAPI.aiLoad(m_abc, ImportSettings.m_pathToAbc.GetFullPath()); if (m_loaded) { m_forceRefresh = true; AbcSyncConfig(); AbcAPI.UpdateAbcTree(m_abc, _alembicTreeRoot, AbcTime(m_time), createMissingNodes); } else { Debug.LogError("failed to load alembic: " + ImportSettings.m_pathToAbc); } AbcSetLastUpdateState(AbcTime(0.0f), AbcAPI.GetAspectRatio(ImportSettings.m_aspectRatioMode)); }
private void AbcUpdateBegin(float time) { if (ImportSettings == null) { return; } if (!m_loaded && ImportSettings != null && ImportSettings.m_pathToAbc != null) { // We have lost the alembic context, try to recover it m_loaded = AbcRecoverContext(); } if (m_loaded) { if (!AbcIsValid()) { // We have lost the alembic context, try to recover m_loaded = AbcRecoverContext(); if (!m_loaded) { Debug.LogWarning("AlembicStream.AbcUpdate: Lost alembic context"); return; } } m_time = time; float abcTime = AbcTime(m_time); float aspectRatio = AbcAPI.GetAspectRatio(ImportSettings.m_aspectRatioMode); if (AbcUpdateRequired(abcTime, aspectRatio)) { if (m_diagSettings.m_verbose) { Debug.Log("AlembicStream.AbcUpdate: t=" + m_time + " (t'=" + abcTime + ")"); } AbcSyncConfig(); AbcUpdateConfigElements(); if (ImportSettings.m_useThreads) { AbcAPI.aiUpdateSamplesBegin(m_abc, abcTime); m_updateBegan = true; } else { AbcAPI.aiUpdateSamples(m_abc, abcTime); AbcUpdateElements(); } AbcSetLastUpdateState(abcTime, aspectRatio); } } }
private void AbcSyncConfig() { m_config.swapHandedness = ImportSettings.m_swapHandedness; m_config.swapFaceWinding = ImportSettings.m_swapFaceWinding; m_config.normalsMode = ImportSettings.m_normalsMode; m_config.tangentsMode = ImportSettings.m_tangentsMode; m_config.cacheTangentsSplits = true; m_config.aspectRatio = AbcAPI.GetAspectRatio(ImportSettings.m_aspectRatioMode); m_config.forceUpdate = false; m_config.useThreads = ImportSettings.m_useThreads; m_config.cacheSamples = ImportSettings.m_sampleCacheSize; m_config.submeshPerUVTile = ImportSettings.m_submeshPerUVTile; if (AbcIsValid()) { AbcAPI.aiSetConfig(m_abc, ref m_config); } }
public void AbcLoad() { m_Time = 0.0f; m_Context = AbcAPI.aiCreateContext(alembicTreeRoot.linkedGameObj.GetInstanceID()); var settings = m_StreamDesc.settings; m_Config.swapHandedness = settings.swapHandedness; m_Config.shareVertices = settings.shareVertices; m_Config.swapFaceWinding = settings.swapFaceWinding; m_Config.normalsMode = settings.normalsMode; m_Config.tangentsMode = settings.tangentsMode; m_Config.cacheSamples = settings.cacheSamples; m_Config.treatVertexExtraDataAsStatics = settings.treatVertexExtraDataAsStatics; m_Config.turnQuadEdges = settings.turnQuadEdges; m_Config.aspectRatio = AbcAPI.GetAspectRatio(settings.aspectRatioMode); m_Config.cacheTangentsSplits = true; #if UNITY_2017_3_OR_NEWER m_Config.use32BitsIndexBuffer = settings.use32BitsIndexBuffer; #else m_Config.use32BitsIndexBuffer = false; #endif AbcAPI.aiSetConfig(m_Context, ref m_Config); m_Loaded = AbcAPI.aiLoad(m_Context, Application.streamingAssetsPath + m_StreamDesc.pathToAbc); if (m_Loaded) { AbcAPI.UpdateAbcTree(m_Context, alembicTreeRoot, m_Time); AlembicStream.s_Streams.Add(this); } else { Debug.LogError("failed to load alembic at " + Application.streamingAssetsPath + m_StreamDesc.pathToAbc); } }