예제 #1
0
        /// <summary>
        /// Returns the C# value from USD or null if there was no value or the value could not be converted.
        /// </summary>
        object GetCSharpValue(UsdAttribute attr, UsdTimeCode time)
        {
            UsdTypeBinding binding;

            if (!UsdIo.Bindings.GetReverseBinding(attr.GetTypeName(), out binding))
            {
                // No binding for this type.
                return(null);
            }

            return(binding.toCsObject(attr.Get(time)));
        }
예제 #2
0
        private void ReadInternal <T>(SdfPath path,
                                      T sample,
                                      UsdTimeCode timeCode) where T : SampleBase
        {
            var prim = GetUsdPrim(path);

            if (!prim)
            {
                return;
            }

            var  accessMap = AccessMask;
            bool?mayVary   = false;
            HashSet <System.Reflection.MemberInfo> dynamicMembers = null;

            if (accessMap != null)
            {
                lock (m_stageLock) {
                    if (!accessMap.Included.TryGetValue(path, out dynamicMembers) &&
                        IsPopulatingAccessMask)
                    {
                        dynamicMembers = new HashSet <System.Reflection.MemberInfo>();
                        accessMap.Included.Add(path, dynamicMembers);
                    }
                }

                if (!IsPopulatingAccessMask)
                {
                    mayVary        = null;
                    dynamicMembers = dynamicMembers ?? m_empty;
                }
            }

            m_usdIo.Deserialize(sample, prim, timeCode, dynamicMembers, ref mayVary);

            lock (m_stageLock) {
                if (accessMap != null && mayVary != null)
                {
                    if (!mayVary.Value)
                    {
                        if (accessMap.Included.ContainsKey(path))
                        {
                            accessMap.Included.Remove(path);
                        }
                    }
                }
            }
        }
예제 #3
0
 private void WriteInternal <T>(SdfPath path,
                                T sample,
                                UsdTimeCode timeCode) where T : SampleBase
 {
     pxr.UsdPrim prim;
     lock (m_stageLock) {
         // TODO(jcowles): there is a potential issue here if the cache gets out of sync with the
         // underlying USD scene. The correct fix is to listen for change processing events and
         // clear the cache accordingly.
         if (!m_primMap.TryGetValue(path, out prim))
         {
             prim = m_stage.DefinePrim(path, new TfToken(Reflect.GetSchema(typeof(T))));
             if (!prim)
             {
                 return;
             }
             m_primMap.Add(path, prim);
         }
     }
     m_usdIo.Serialize(sample, prim, timeCode);
 }
예제 #4
0
        public static UsdTimeCode Default()
        {
            UsdTimeCode ret = new UsdTimeCode(UsdCsPINVOKE.UsdTimeCode_Default(), true);

            return(ret);
        }
예제 #5
0
        public SWIGTYPE_p_SdfPropertySpecHandleVector GetPropertyStack(UsdTimeCode time)
        {
            SWIGTYPE_p_SdfPropertySpecHandleVector ret = new SWIGTYPE_p_SdfPropertySpecHandleVector(UsdCsPINVOKE.UsdProperty_GetPropertyStack__SWIG_0(swigCPtr, UsdTimeCode.getCPtr(time)), true);

            if (UsdCsPINVOKE.SWIGPendingException.Pending)
            {
                throw UsdCsPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
예제 #6
0
        public static bool ComputePointsAtTime(VtVec3fArray points, UsdStageWeakPtr stage, UsdTimeCode time, VtVec3fArray positions, VtVec3fArray velocities, UsdTimeCode velocitiesSampleTime, VtVec3fArray accelerations, float velocityScale)
        {
            bool ret = UsdCsPINVOKE.UsdGeomPointBased_ComputePointsAtTime__SWIG_1(VtVec3fArray.getCPtr(points), UsdStageWeakPtr.getCPtr(stage), UsdTimeCode.getCPtr(time), VtVec3fArray.getCPtr(positions), VtVec3fArray.getCPtr(velocities), UsdTimeCode.getCPtr(velocitiesSampleTime), VtVec3fArray.getCPtr(accelerations), velocityScale);

            if (UsdCsPINVOKE.SWIGPendingException.Pending)
            {
                throw UsdCsPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
예제 #7
0
        public uint ComputeVertexDataSize(UsdTimeCode timeCode)
        {
            uint ret = UsdCsPINVOKE.UsdGeomBasisCurves_ComputeVertexDataSize(swigCPtr, UsdTimeCode.getCPtr(timeCode));

            if (UsdCsPINVOKE.SWIGPendingException.Pending)
            {
                throw UsdCsPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
예제 #8
0
        public bool GetIndices(VtIntArray indices, UsdTimeCode time)
        {
            bool ret = UsdCsPINVOKE.UsdGeomPrimvar_GetIndices__SWIG_0(swigCPtr, VtIntArray.getCPtr(indices), UsdTimeCode.getCPtr(time));

            if (UsdCsPINVOKE.SWIGPendingException.Pending)
            {
                throw UsdCsPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
예제 #9
0
        public bool ComputePointsAtTime(VtVec3fArray points, UsdTimeCode time, UsdTimeCode baseTime)
        {
            bool ret = UsdCsPINVOKE.UsdGeomPointBased_ComputePointsAtTime__SWIG_0(swigCPtr, VtVec3fArray.getCPtr(points), UsdTimeCode.getCPtr(time), UsdTimeCode.getCPtr(baseTime));

            if (UsdCsPINVOKE.SWIGPendingException.Pending)
            {
                throw UsdCsPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
예제 #10
0
        public bool ComputeVaryingJointInfluences(uint numPoints, VtIntArray indices, VtFloatArray weights, UsdTimeCode time)
        {
            bool ret = UsdCsPINVOKE.UsdSkelSkinningQuery_ComputeVaryingJointInfluences__SWIG_0(swigCPtr, numPoints, VtIntArray.getCPtr(indices), VtFloatArray.getCPtr(weights), UsdTimeCode.getCPtr(time));

            if (UsdCsPINVOKE.SWIGPendingException.Pending)
            {
                throw UsdCsPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
예제 #11
0
        public bool ComputeBlendShapeWeights(VtFloatArray weights, UsdTimeCode time)
        {
            bool ret = UsdCsPINVOKE.UsdSkelAnimQuery_ComputeBlendShapeWeights__SWIG_0(swigCPtr, VtFloatArray.getCPtr(weights), UsdTimeCode.getCPtr(time));

            if (UsdCsPINVOKE.SWIGPendingException.Pending)
            {
                throw UsdCsPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
예제 #12
0
 public UsdGeomBBoxCache(UsdTimeCode time, TfTokenVector includedPurposes, bool useExtentsHint, bool ignoreVisibility) : this(UsdCsPINVOKE.new_UsdGeomBBoxCache__SWIG_0(UsdTimeCode.getCPtr(time), TfTokenVector.getCPtr(includedPurposes), useExtentsHint, ignoreVisibility), true)
 {
     if (UsdCsPINVOKE.SWIGPendingException.Pending)
     {
         throw UsdCsPINVOKE.SWIGPendingException.Retrieve();
     }
 }
예제 #13
0
 public UsdGeomBBoxCache(UsdTimeCode time, TfTokenVector includedPurposes) : this(UsdCsPINVOKE.new_UsdGeomBBoxCache__SWIG_2(UsdTimeCode.getCPtr(time), TfTokenVector.getCPtr(includedPurposes)), true)
 {
     if (UsdCsPINVOKE.SWIGPendingException.Pending)
     {
         throw UsdCsPINVOKE.SWIGPendingException.Retrieve();
     }
 }
예제 #14
0
        public UsdTimeCode GetBaseTime()
        {
            UsdTimeCode ret = new UsdTimeCode(UsdCsPINVOKE.UsdGeomBBoxCache_GetBaseTime(swigCPtr), true);

            return(ret);
        }
예제 #15
0
        void  ReadInternal <T>(SdfPath path,
                               T sample,
                               UsdTimeCode timeCode) where T : SampleBase
        {
            var prim = GetUsdPrim(path);

            if (!prim)
            {
                return;
            }

            var accessMap = AccessMask;
            HashSet <System.Reflection.MemberInfo> dynamicMembers = null;

            // mayVary is nullable and has an accumulation semantic:
            //   null = members have already been checked for animation
            //   false = no dynamic members found
            //   true =  at least one member has been found dynamic
            bool?mayVary = false;

            // When reading animation data, the access map optimizes which prim members need to be read
            if (accessMap != null)
            {
                var populatingAccessMask = IsPopulatingAccessMask;
                lock (m_stageLock)
                {
                    // Check which attributes of the prim are dynamic
                    var primFound = accessMap.Included.TryGetValue(path, out dynamicMembers);

                    // Populating the access map happens when reading the first frame of animation
                    // so if the prim is not already in the map add it and everything will be deserialized
                    if (!primFound && populatingAccessMask)
                    {
                        dynamicMembers = new HashSet <System.Reflection.MemberInfo>();
                        accessMap.Included.Add(path, dynamicMembers);
                    }
                }

                // If we are not populating the access map it means it's been done already so only dynamic members should be deserialized
                if (!populatingAccessMask)
                {
                    // If there are no dynamic members, then no need to call deserialize
                    if (dynamicMembers == null)
                    {
                        return;
                    }

                    // Notify the deserialization service that only dynamic members should be read
                    mayVary = null;
                }
            }

            m_usdIo.Deserialize(sample, prim, timeCode, dynamicMembers, ref mayVary);

            // If no members are varying, remove the prim from the access map.
            lock (m_stageLock) {
                if (accessMap != null && mayVary != null)
                {
                    if (!mayVary.Value)
                    {
                        if (accessMap.Included.ContainsKey(path))
                        {
                            accessMap.Included.Remove(path);
                        }
                    }
                }
            }
        }
예제 #16
0
        public bool SetExtentsHint(VtVec3fArray extents, UsdTimeCode time)
        {
            bool ret = UsdCsPINVOKE.UsdGeomModelAPI_SetExtentsHint__SWIG_0(swigCPtr, VtVec3fArray.getCPtr(extents), UsdTimeCode.getCPtr(time));

            if (UsdCsPINVOKE.SWIGPendingException.Pending)
            {
                throw UsdCsPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
예제 #17
0
        public bool GetAttributeValue(TfToken attrName, VtValue valueOut, UsdTimeCode time)
        {
            bool ret = UsdCsPINVOKE.UsdPrim_GetAttributeValue(swigCPtr, TfToken.getCPtr(attrName), VtValue.getCPtr(valueOut), UsdTimeCode.getCPtr(time));

            if (UsdCsPINVOKE.SWIGPendingException.Pending)
            {
                throw UsdCsPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
예제 #18
0
        public GfMatrix4d GetGeomBindTransform(UsdTimeCode time)
        {
            GfMatrix4d ret = new GfMatrix4d(UsdCsPINVOKE.UsdSkelSkinningQuery_GetGeomBindTransform__SWIG_0(swigCPtr, UsdTimeCode.getCPtr(time)), true);

            if (UsdCsPINVOKE.SWIGPendingException.Pending)
            {
                throw UsdCsPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
예제 #19
0
        public bool ComputeJointLocalTransformComponents(VtVec3fArray translations, VtQuatfArray rotations, VtVec3hArray scales, UsdTimeCode time)
        {
            bool ret = UsdCsPINVOKE.UsdSkelAnimQuery_ComputeJointLocalTransformComponents__SWIG_0(swigCPtr, VtVec3fArray.getCPtr(translations), VtQuatfArray.getCPtr(rotations), VtVec3hArray.getCPtr(scales), UsdTimeCode.getCPtr(time));

            if (UsdCsPINVOKE.SWIGPendingException.Pending)
            {
                throw UsdCsPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
예제 #20
0
        public bool Set(VtValue value, UsdTimeCode time)
        {
            bool ret = UsdCsPINVOKE.UsdShadeInput_Set__SWIG_0(swigCPtr, VtValue.getCPtr(value), UsdTimeCode.getCPtr(time));

            if (UsdCsPINVOKE.SWIGPendingException.Pending)
            {
                throw UsdCsPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
예제 #21
0
        public bool ComputeJointLocalTransforms(VtMatrix4dArray xforms, UsdTimeCode time)
        {
            bool ret = UsdCsPINVOKE.UsdSkelSkeletonQuery_ComputeJointLocalTransforms__SWIG_3(swigCPtr, VtMatrix4dArray.getCPtr(xforms), UsdTimeCode.getCPtr(time));

            if (UsdCsPINVOKE.SWIGPendingException.Pending)
            {
                throw UsdCsPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
예제 #22
0
        public bool AppendFaceGroup(VtIntArray faceIndices, SdfPath bindingTarget, UsdTimeCode time)
        {
            bool ret = UsdCsPINVOKE.UsdGeomFaceSetAPI_AppendFaceGroup__SWIG_0(swigCPtr, VtIntArray.getCPtr(faceIndices), SdfPath.getCPtr(bindingTarget), UsdTimeCode.getCPtr(time));

            if (UsdCsPINVOKE.SWIGPendingException.Pending)
            {
                throw UsdCsPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
예제 #23
0
        public bool ComputeFlattened(VtValue value, UsdTimeCode time)
        {
            bool ret = UsdCsPINVOKE.UsdGeomPrimvar_ComputeFlattened__SWIG_2(swigCPtr, VtValue.getCPtr(value), UsdTimeCode.getCPtr(time));

            if (UsdCsPINVOKE.SWIGPendingException.Pending)
            {
                throw UsdCsPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
예제 #24
0
        public bool SetFaceCounts(VtIntArray faceCounts, UsdTimeCode time)
        {
            bool ret = UsdCsPINVOKE.UsdGeomFaceSetAPI_SetFaceCounts__SWIG_0(swigCPtr, VtIntArray.getCPtr(faceCounts), UsdTimeCode.getCPtr(time));

            if (UsdCsPINVOKE.SWIGPendingException.Pending)
            {
                throw UsdCsPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
예제 #25
0
        public bool ComputePointsAtTimes(VtVec3fArrayVector pointsArray, UsdTimeCodeVector times, UsdTimeCode baseTime)
        {
            bool ret = UsdCsPINVOKE.UsdGeomPointBased_ComputePointsAtTimes(swigCPtr, VtVec3fArrayVector.getCPtr(pointsArray), UsdTimeCodeVector.getCPtr(times), UsdTimeCode.getCPtr(baseTime));

            if (UsdCsPINVOKE.SWIGPendingException.Pending)
            {
                throw UsdCsPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
예제 #26
0
 override public bool Equals(object rhs)
 {
     return(UsdTimeCode.Equals(this, rhs as UsdTimeCode));
 }
예제 #27
0
        public TfToken ComputeInterpolationForSize(uint n, UsdTimeCode timeCode)
        {
            TfToken ret = new TfToken(UsdCsPINVOKE.UsdGeomBasisCurves_ComputeInterpolationForSize__SWIG_1(swigCPtr, n, UsdTimeCode.getCPtr(timeCode)), true);

            if (UsdCsPINVOKE.SWIGPendingException.Pending)
            {
                throw UsdCsPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
예제 #28
0
 public void SetFromCamera(GfCamera camera, UsdTimeCode time)
 {
     UsdCsPINVOKE.UsdGeomCamera_SetFromCamera(swigCPtr, GfCamera.getCPtr(camera), UsdTimeCode.getCPtr(time));
     if (UsdCsPINVOKE.SWIGPendingException.Pending)
     {
         throw UsdCsPINVOKE.SWIGPendingException.Retrieve();
     }
 }
예제 #29
0
        public GfCamera GetCamera(UsdTimeCode time)
        {
            GfCamera ret = new GfCamera(UsdCsPINVOKE.UsdGeomCamera_GetCamera(swigCPtr, UsdTimeCode.getCPtr(time)), true);

            if (UsdCsPINVOKE.SWIGPendingException.Pending)
            {
                throw UsdCsPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
예제 #30
0
        public static UsdTimeCode EarliestTime()
        {
            UsdTimeCode ret = new UsdTimeCode(UsdCsPINVOKE.UsdTimeCode_EarliestTime(), true);

            return(ret);
        }