void OnEnable() { #if UNITY_STANDALONE_WIN AlembicImporter.AddLibraryPath(); #endif m_abc = AlembicImporter.aiCreateContext(); m_loaded = AlembicImporter.aiLoad(m_abc, m_path_to_abc); }
static void ImportImpl(string path, bool reverse_x, bool reverse_faces) { if (path == "") { return; } #if UNITY_STANDALONE_WIN AlembicImporter.AddLibraryPath(); #endif aiContext ctx = aiCreateContext(); if (!aiLoad(ctx, Application.streamingAssetsPath + "/" + path)) { Debug.Log("aiLoad(\"" + path + "\") failed"); } else { GameObject root = new GameObject(); root.name = System.IO.Path.GetFileNameWithoutExtension(path); var abcstream = root.AddComponent <AlembicStream>(); abcstream.m_path_to_abc = path; abcstream.m_start_time = aiGetStartTime(ctx); abcstream.m_end_time = aiGetEndTime(ctx); abcstream.m_time_offset = -abcstream.m_start_time; abcstream.m_time_scale = 1.0f; abcstream.m_preserve_start_time = true; abcstream.m_reverse_x = reverse_x; abcstream.m_reverse_faces = reverse_faces; var ic = new ImportContext(); ic.parent = root.GetComponent <Transform>(); ic.reverse_x = reverse_x; ic.reverse_faces = reverse_faces; GCHandle gch = GCHandle.Alloc(ic); aiEnumerateChild(aiGetTopObject(ctx), ImportEnumerator, GCHandle.ToIntPtr(gch)); } aiDestroyContext(ctx); }