void AbcCleanupSubTree(Transform tr, ref List <GameObject> objsToDelete) { AlembicElement elem = tr.gameObject.GetComponent <AlembicMesh>() as AlembicElement; if (elem == null) { elem = tr.gameObject.GetComponent <AlembicXForm>() as AlembicElement; if (elem == null) { elem = tr.gameObject.GetComponent <AlembicCamera>() as AlembicElement; if (elem == null) { elem = tr.gameObject.GetComponent <AlembicLight>() as AlembicElement; } } } if (elem != null && !m_elements.Contains(elem)) { if (m_verbose) { Debug.Log("Alembic.AbcCleanupSubTree: Node \"" + tr.gameObject.name + "\" no longer in alembic tree"); } objsToDelete.Add(tr.gameObject); } else { foreach (Transform childTr in tr) { AbcCleanupSubTree(childTr, ref objsToDelete); } } }
// --- public api --- public void AbcAddElement(AlembicElement e) { if (e != null) { if (m_verbose) { Debug.Log("AlembicStream.AbcAddElement: \"" + e.gameObject.name + "\""); } m_elements.Add(e); } }
public void AbcRemoveElement(AlembicElement e) { if (e != null) { if (m_verbose) { Debug.Log("AlembicStream.AbcRemoveElement: \"" + e.gameObject.name + "\""); } AbcAPI.aiDestroyObject(m_abc, e.m_abcObj); m_elements.Remove(e); } }
static void ImportEnumerator(aiObject obj, IntPtr userData) { var ic = GCHandle.FromIntPtr(userData).Target as ImportContext; Transform parent = ic.parent; string childName = aiGetName(obj); var trans = parent.FindChild(childName); if (trans == null) { if (!ic.createMissingNodes) { ic.objectsToDelete.Add(obj); return; } GameObject go = new GameObject(); go.name = childName; trans = go.GetComponent <Transform>(); trans.parent = parent; trans.localPosition = Vector3.zero; trans.localEulerAngles = Vector3.zero; trans.localScale = Vector3.one; } AlembicElement elem = null; aiSchema schema = default(aiSchema); if (aiGetXForm(obj)) { elem = GetOrAddComponent <AlembicXForm>(trans.gameObject); schema = aiGetXForm(obj); } else if (aiGetPolyMesh(obj)) { elem = GetOrAddComponent <AlembicMesh>(trans.gameObject); schema = aiGetPolyMesh(obj); } else if (aiGetCamera(obj)) { elem = GetOrAddComponent <AlembicCamera>(trans.gameObject); schema = aiGetCamera(obj); } else if (aiGetPoints(obj)) { elem = GetOrAddComponent <AlembicPoints>(trans.gameObject); schema = aiGetPoints(obj); } if (elem) { elem.AbcSetup(ic.abcStream, obj, schema); aiSchemaUpdateSample(schema, ref ic.ss); elem.AbcUpdate(); ic.abcStream.AbcAddElement(elem); } ic.parent = trans; aiEnumerateChild(obj, ImportEnumerator, userData); ic.parent = parent; }
public void AbcRemoveElement(AlembicElement e) { if (e != null) { if (m_verbose) { Debug.Log("AlembicStream.AbcRemoveElement: \"" + e.gameObject.name + "\""); } AbcAPI.aiDestroyObject(m_abc, e.m_abcObj); m_elements.Remove(e); } }
// --- public api --- public void AbcAddElement(AlembicElement e) { if (e != null) { if (m_verbose) { Debug.Log("AlembicStream.AbcAddElement: \"" + e.gameObject.name + "\""); } m_elements.Add(e); } }
public void AddElement(AlembicElement e) { m_elements.Add(e); }