Exemplo n.º 1
0
        void CreateCapturers_Flat()
        {
            m_root = new RootCapturer(AbcAPI.aeGetTopObject(m_ctx));

            // Camera
            if (m_captureCamera)
            {
                foreach (var target in GetTargets <Camera>())
                {
                    if (ShouldBeIgnored(target))
                    {
                        continue;
                    }
                    var trans = CreateComponentCapturer(m_root, target.GetComponent <Transform>());
                    trans.inherits      = false;
                    trans.invertForward = true;
                    CreateComponentCapturer(trans, target);
                }
            }

            // MeshRenderer
            if (m_captureMeshRenderer)
            {
                foreach (var target in GetTargets <MeshRenderer>())
                {
                    if (ShouldBeIgnored(target))
                    {
                        continue;
                    }
                    var trans = CreateComponentCapturer(m_root, target.GetComponent <Transform>());
                    trans.inherits = false;
                    CreateComponentCapturer(trans, target);
                }
            }

            // SkinnedMeshRenderer
            if (m_captureSkinnedMeshRenderer)
            {
                foreach (var target in GetTargets <SkinnedMeshRenderer>())
                {
                    if (ShouldBeIgnored(target))
                    {
                        continue;
                    }
                    var trans = CreateComponentCapturer(m_root, target.GetComponent <Transform>());
                    trans.inherits = false;
                    CreateComponentCapturer(trans, target);
                }
            }

            // ParticleSystem
            if (m_captureParticleSystem)
            {
                foreach (var target in GetTargets <ParticleSystem>())
                {
                    if (ShouldBeIgnored(target))
                    {
                        continue;
                    }
                    var trans = CreateComponentCapturer(m_root, target.GetComponent <Transform>());
                    trans.inherits = false;
                    CreateComponentCapturer(trans, target);
                }
            }

            // handle custom capturers (AlembicCustomComponentCapturer)
            if (m_customCapturer)
            {
                foreach (var target in GetTargets <AlembicCustomComponentCapturer>())
                {
                    if (ShouldBeIgnored(target))
                    {
                        continue;
                    }
                    var trans = CreateComponentCapturer(m_root, target.GetComponent <Transform>());
                    trans.inherits = false;
                    CreateComponentCapturer(trans, target);
                }
            }
        }
Exemplo n.º 2
0
        void CreateCapturers_Tree()
        {
            m_root         = new RootCapturer(AbcAPI.aeGetTopObject(m_ctx));
            m_capture_node = new Dictionary <Transform, CaptureNode>();
            m_top_nodes    = new List <CaptureNode>();

            // construct tree
            // (bottom-up)
            if (m_captureCamera)
            {
                foreach (var t in GetTargets <Camera>())
                {
                    if (ShouldBeIgnored(t))
                    {
                        continue;
                    }
                    var node = ConstructTree(t.GetComponent <Transform>());
                    node.componentType = t.GetType();
                }
            }
            if (m_captureMeshRenderer)
            {
                foreach (var t in GetTargets <MeshRenderer>())
                {
                    if (ShouldBeIgnored(t))
                    {
                        continue;
                    }
                    var node = ConstructTree(t.GetComponent <Transform>());
                    node.componentType = t.GetType();
                }
            }
            if (m_captureSkinnedMeshRenderer)
            {
                foreach (var t in GetTargets <SkinnedMeshRenderer>())
                {
                    if (ShouldBeIgnored(t))
                    {
                        continue;
                    }
                    var node = ConstructTree(t.GetComponent <Transform>());
                    node.componentType = t.GetType();
                }
            }
            if (m_captureParticleSystem)
            {
                foreach (var t in GetTargets <ParticleSystem>())
                {
                    if (ShouldBeIgnored(t))
                    {
                        continue;
                    }
                    var node = ConstructTree(t.GetComponent <Transform>());
                    node.componentType = t.GetType();
                }
            }
            if (m_customCapturer)
            {
                foreach (var t in GetTargets <AlembicCustomComponentCapturer>())
                {
                    if (ShouldBeIgnored(t))
                    {
                        continue;
                    }
                    var node = ConstructTree(t.GetComponent <Transform>());
                    node.componentType = typeof(AlembicCustomComponentCapturer);
                }
            }

            // make component capturers (top-down)
            foreach (var c in m_top_nodes)
            {
                SetupComponentCapturer(null, c);
            }


            m_top_nodes    = null;
            m_capture_node = null;
        }