Пример #1
0
        public static bool Equals(UsdPrimRange lhs, UsdPrimRange rhs)
        {
            bool ret = UsdCsPINVOKE.UsdPrimRange_Equals(UsdPrimRange.getCPtr(lhs), UsdPrimRange.getCPtr(rhs));

            if (UsdCsPINVOKE.SWIGPendingException.Pending)
            {
                throw UsdCsPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Пример #2
0
        public static UsdPrimRange Stage(UsdStageWeakPtr stage)
        {
            UsdPrimRange ret = new UsdPrimRange(UsdCsPINVOKE.UsdPrimRange_Stage__SWIG_1(UsdStageWeakPtr.getCPtr(stage)), true);

            if (UsdCsPINVOKE.SWIGPendingException.Pending)
            {
                throw UsdCsPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Пример #3
0
        public static UsdPrimRange AllPrimsPreAndPostVisit(UsdPrim start)
        {
            UsdPrimRange ret = new UsdPrimRange(UsdCsPINVOKE.UsdPrimRange_AllPrimsPreAndPostVisit(UsdPrim.getCPtr(start)), true);

            if (UsdCsPINVOKE.SWIGPendingException.Pending)
            {
                throw UsdCsPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Пример #4
0
        public static UsdPrimRange PreAndPostVisit(UsdPrim start, Usd_PrimFlagsPredicate predicate)
        {
            UsdPrimRange ret = new UsdPrimRange(UsdCsPINVOKE.UsdPrimRange_PreAndPostVisit__SWIG_1(UsdPrim.getCPtr(start), Usd_PrimFlagsPredicate.getCPtr(predicate)), true);

            if (UsdCsPINVOKE.SWIGPendingException.Pending)
            {
                throw UsdCsPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Пример #5
0
        // ------------------------------------------------------------------------------------------ //
        // Enumerator
        // ------------------------------------------------------------------------------------------ //

        public virtual void Dispose()
        {
            if (m_cur != null)
            {
                m_cur.Dispose(); m_cur = null;
            }
            if (m_range != null)
            {
                m_range.Dispose(); m_range = null;
            }
        }
Пример #6
0
        public static bool operator==(UsdPrimRange lhs, UsdPrimRange rhs)
        {
            // The Swig binding glue will re-enter this operator comparing to null, so
            // that case must be handled explicitly to avoid an infinite loop. This is still
            // not great, since it crosses the C#/C++ barrier twice. A better approache might
            // be to return a simple value from C++ that can be compared in C#.
            bool lnull = lhs as object == null;
            bool rnull = rhs as object == null;

            return((lnull == rnull) && ((lnull && rnull) || UsdPrimRange.Equals(lhs, rhs)));
        }
Пример #7
0
        public static void TraverseTest()
        {
            //
            // Setup a stage with parents and children.
            // TODO: Add tests with classes and instancing.
            //
            UsdStage s   = UsdStage.CreateInMemory();
            var      foo = s.DefinePrim(new SdfPath("/Foo"));

            s.DefinePrim(new SdfPath("/Foo/P1"));
            s.DefinePrim(new SdfPath("/Foo/P2"));
            s.DefinePrim(new SdfPath("/Foo/P3"));
            s.DefinePrim(new SdfPath("/Foo/P4"));
            s.DefinePrim(new SdfPath("/Foo/P5"));
            var bar = s.DefinePrim(new SdfPath("/Bar"));

            s.DefinePrim(new SdfPath("/Bar/B1"));
            s.DefinePrim(new SdfPath("/Bar/B2"));
            s.DefinePrim(new SdfPath("/Bar/B3"));
            s.DefinePrim(new SdfPath("/Bar/B3/C1"));
            s.DefinePrim(new SdfPath("/Bar/B3/C2"));
            s.DefinePrim(new SdfPath("/Bar/B3/C3"));
            s.DefinePrim(new SdfPath("/Bar/B4"));

            // Prim children
            Console.WriteLine("");
            Console.WriteLine("Foo children:");
            foreach (UsdPrim curPrim in foo.GetChildren())
            {
                Console.WriteLine(curPrim.GetPath());
            }

            Console.WriteLine("");
            Console.WriteLine("Bar children:");
            foreach (UsdPrim curPrim in bar.GetChildren())
            {
                Console.WriteLine(curPrim.GetPath());
            }

            // Prim Descendants
            Console.WriteLine("");
            Console.WriteLine("Bar descendants:");
            foreach (UsdPrim curPrim in bar.GetDescendants())
            {
                Console.WriteLine(curPrim.GetPath());
            }

            // Basic Stage traversal.
            Console.WriteLine("");
            Console.WriteLine("All Prims:");
            List <UsdPrim> primList = s.Traverse().ToList();
            int            i        = 0;

            foreach (UsdPrim curPrim in s.Traverse())
            {
                Console.WriteLine(curPrim.GetPath());
                AssertEqual(primList[i++], curPrim);
            }

            // Traversal with child pruning.
            Console.WriteLine("");
            Console.WriteLine("/Bar children pruned:");
            var range = new USD.NET.RangeIterator(s.Traverse());

            foreach (UsdPrim curPrim in range)
            {
                Console.WriteLine(curPrim.GetPath());
                if (curPrim.GetPath() == "/Bar/B3")
                {
                    range.PruneChildren();
                    Console.WriteLine("pruned.");
                }
            }

            // Fully general pre/post traversal.
            Console.WriteLine("");
            Console.WriteLine("Pre/Post Traversal with all children pruned:");
            var prePostRange = new USD.NET.RangeIterator(UsdPrimRange.PreAndPostVisit(s.GetPseudoRoot()));

            bool[] expected = { false, false, true, false, true, true };
            bool[] actual   = new bool[6];
            i = 0;
            foreach (UsdPrim curPrim in prePostRange)
            {
                Console.WriteLine("IsPostVisit: " + prePostRange.IsPostVisit().ToString()
                                  + ", " + curPrim.GetPath());
                if (!prePostRange.IsPostVisit() && i > 0)
                {
                    // It's only valid to prune on the pre-traversal.
                    prePostRange.PruneChildren();
                }

                actual[i++] = prePostRange.IsPostVisit();
            }
            AssertEqual(expected, actual);
        }
Пример #8
0
 override public bool Equals(object rhs)
 {
     return(UsdPrimRange.Equals(this, rhs as UsdPrimRange));
 }
Пример #9
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(UsdPrimRange obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }