public void InsertRange(int index, UsdPrimVector values) { UsdCsPINVOKE.UsdPrimVector_InsertRange(swigCPtr, index, UsdPrimVector.getCPtr(values)); if (UsdCsPINVOKE.SWIGPendingException.Pending) { throw UsdCsPINVOKE.SWIGPendingException.Retrieve(); } }
public void AddRange(UsdPrimVector values) { UsdCsPINVOKE.UsdPrimVector_AddRange(swigCPtr, UsdPrimVector.getCPtr(values)); if (UsdCsPINVOKE.SWIGPendingException.Pending) { throw UsdCsPINVOKE.SWIGPendingException.Retrieve(); } }
public static bool CreateMasterMaterialVariant(UsdPrim masterPrim, UsdPrimVector MaterialPrims) { bool ret = UsdCsPINVOKE.UsdShadeMaterial_CreateMasterMaterialVariant__SWIG_1(UsdPrim.getCPtr(masterPrim), UsdPrimVector.getCPtr(MaterialPrims)); if (UsdCsPINVOKE.SWIGPendingException.Pending) { throw UsdCsPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public static UsdShadeMaterialVector ComputeBoundMaterials(UsdPrimVector prims) { UsdShadeMaterialVector ret = new UsdShadeMaterialVector(UsdCsPINVOKE.UsdShadeMaterialBindingAPI_ComputeBoundMaterials__SWIG_2(UsdPrimVector.getCPtr(prims)), true); if (UsdCsPINVOKE.SWIGPendingException.Pending) { throw UsdCsPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public static UsdShadeMaterialVector ComputeBoundMaterials(UsdPrimVector prims, TfToken materialPurpose, UsdRelationshipVector bindingRels) { UsdShadeMaterialVector ret = new UsdShadeMaterialVector(UsdCsPINVOKE.UsdShadeMaterialBindingAPI_ComputeBoundMaterials__SWIG_0(UsdPrimVector.getCPtr(prims), TfToken.getCPtr(materialPurpose), UsdRelationshipVector.getCPtr(bindingRels)), true); if (UsdCsPINVOKE.SWIGPendingException.Pending) { throw UsdCsPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public static UsdPrimVector Repeat(UsdPrim value, int count) { global::System.IntPtr cPtr = UsdCsPINVOKE.UsdPrimVector_Repeat(UsdPrim.getCPtr(value), count); UsdPrimVector ret = (cPtr == global::System.IntPtr.Zero) ? null : new UsdPrimVector(cPtr, true); if (UsdCsPINVOKE.SWIGPendingException.Pending) { throw UsdCsPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public UsdPrimVector GetRange(int index, int count) { global::System.IntPtr cPtr = UsdCsPINVOKE.UsdPrimVector_GetRange(swigCPtr, index, count); UsdPrimVector ret = (cPtr == global::System.IntPtr.Zero) ? null : new UsdPrimVector(cPtr, true); if (UsdCsPINVOKE.SWIGPendingException.Pending) { throw UsdCsPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public UsdPrimVector GetInstances() { UsdPrimVector ret = new UsdPrimVector(UsdCsPINVOKE.UsdPrim_GetInstances(swigCPtr), true); return(ret); }
public UsdPrimVector GetMasters() { UsdPrimVector ret = new UsdPrimVector(UsdCsPINVOKE.UsdStageWeakPtr_GetMasters(swigCPtr), true); return(ret); }
public UsdPrimVector(UsdPrimVector other) : this(UsdCsPINVOKE.new_UsdPrimVector__SWIG_1(UsdPrimVector.getCPtr(other)), true) { if (UsdCsPINVOKE.SWIGPendingException.Pending) { throw UsdCsPINVOKE.SWIGPendingException.Retrieve(); } }
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(UsdPrimVector obj) { return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr); }
public static GameObject Import( USD.NET.Scene scene, GameObject rootObj, Dictionary <SdfPath, GameObject> objectMap, UpdateMask mask, out List <string> warnings, List <string> pathsToUpdate = null) { // TODO: generalize this to avoid having to dig down into USD for sparse reads. TfToken brushToken = new pxr.TfToken("brush"); TfToken faceVertexIndicesToken = new pxr.TfToken("faceVertexIndices"); warnings = new List <string>(); // Would be nice to find a way to kick this off automatically. // Redundant calls are ignored. if (!InitUsd.Initialize()) { return(null); } // PLAN: Process any UsdStage either constructing or updating GameObjects as needed. // This should include analysis of the time samples to see what attributes are // actually varying so they are updated minimally. UsdPrimVector prims = null; if (pathsToUpdate == null) { prims = scene.Stage.GetAllPrims(); } else { prims = new UsdPrimVector(); foreach (var path in pathsToUpdate) { prims.Add(scene.Stage.GetPrimAtPath(new pxr.SdfPath(path))); } } for (int p = 0; p < prims.Count; p++) { // TODO: prims[p] generates garbage. UsdPrim usdPrim = prims[p]; UsdGeomMesh usdMesh = new UsdGeomMesh(usdPrim); if (!usdMesh) { continue; } ExportUsd.BrushSample sample = new ExportUsd.BrushSample(); if (mask == UpdateMask.All) { scene.Read(usdPrim.GetPath(), sample); } else { // TODO: Generalize this as a reusable mechanism for sparse reads. if (mask == UpdateMask.Topology) { sample.brush = new Guid((string)usdPrim.GetCustomDataByKey(brushToken)); var fv = usdPrim.GetAttribute(faceVertexIndicesToken).Get(scene.Time); sample.faceVertexIndices = USD.NET.IntrinsicTypeConverter.FromVtArray((VtIntArray)fv); } else { throw new NotImplementedException(); } } GameObject strokeObj; Mesh unityMesh; // // Construct the GameObject if needed. // if (!objectMap.TryGetValue(usdPrim.GetPath(), out strokeObj)) { // On first import, we need to pull in all the data, regardless of what was requested. mask = UpdateMask.All; BrushDescriptor brush = BrushCatalog.m_Instance.GetBrush(sample.brush); if (brush == null) { Debug.LogWarningFormat("Invalid brush GUID at path: <{0}> guid: {1}", usdPrim.GetPath(), sample.brush); continue; } strokeObj = UnityEngine.Object.Instantiate(brush.m_BrushPrefab); // Register the Prim/Object mapping. objectMap.Add(usdPrim.GetPath(), strokeObj); // Init the game object. strokeObj.transform.parent = rootObj.transform; strokeObj.GetComponent <MeshRenderer>().material = brush.Material; strokeObj.GetComponent <MeshFilter>().sharedMesh = new Mesh(); strokeObj.AddComponent <BoxCollider>(); unityMesh = strokeObj.GetComponent <MeshFilter>().sharedMesh; } else { unityMesh = strokeObj.GetComponent <MeshFilter>().sharedMesh; } // // Points // Note that points must come first, before all other mesh data. // if ((mask & UpdateMask.Points) == UpdateMask.Points) { unityMesh.vertices = sample.points; } // // Bounds // if ((mask & UpdateMask.Bounds) == UpdateMask.Bounds) { var bc = strokeObj.GetComponent <BoxCollider>(); bc.center = sample.extent.center; bc.size = sample.extent.size; unityMesh.bounds = bc.bounds; } // // Topology // if ((mask & UpdateMask.Topology) == UpdateMask.Topology) { unityMesh.triangles = sample.faceVertexIndices; } // // Normals // if ((mask & UpdateMask.Normals) == UpdateMask.Normals) { unityMesh.normals = sample.normals; } // // Color & Opacity // if ((mask & UpdateMask.Colors) == UpdateMask.Colors && sample.colors != null) { unityMesh.colors = sample.colors; } // // Tangents // if ((mask & UpdateMask.Tangents) == UpdateMask.Tangents && sample.tangents != null) { unityMesh.tangents = sample.tangents; } // // UVs // if ((mask & UpdateMask.UVs) == UpdateMask.UVs) { SetUv(unityMesh, 0, sample.uv); SetUv(unityMesh, 1, sample.uv2); SetUv(unityMesh, 2, sample.uv3); SetUv(unityMesh, 3, sample.uv4); } } // For each prim return(rootObj); }