// --- 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)); }
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); } }
private bool AbcRecoverContext() { if (!AbcIsValid()) { if (m_diagSettings.m_verbose) { Debug.Log("AlembicStream.AbcRecoverContext: Try to recover alembic context"); } m_abc = AbcAPI.aiCreateContext(_alembicTreeRoot.linkedGameObj.GetInstanceID()); if (AbcIsValid()) { m_forceRefresh = true; _alembicTreeRoot.ResetTree(); AbcSyncConfig(); AbcAPI.UpdateAbcTree(m_abc, _alembicTreeRoot, AbcTime(m_time), false); if (m_diagSettings.m_verbose) { Debug.Log("AlembicStream.AbcRecoverContext: Succeeded."); } return(true); } else { return(false); } } else { return(true); } }