public static UsdShadeMaterialBindingAPI Get(UsdStageWeakPtr stage, SdfPath path) { UsdShadeMaterialBindingAPI ret = new UsdShadeMaterialBindingAPI(UsdCsPINVOKE.UsdShadeMaterialBindingAPI_Get(UsdStageWeakPtr.getCPtr(stage), SdfPath.getCPtr(path)), true); if (UsdCsPINVOKE.SWIGPendingException.Pending) { throw UsdCsPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public static UsdShadeMaterialBindingAPI Apply(UsdPrim prim) { UsdShadeMaterialBindingAPI ret = new UsdShadeMaterialBindingAPI(UsdCsPINVOKE.UsdShadeMaterialBindingAPI_Apply(UsdPrim.getCPtr(prim)), true); if (UsdCsPINVOKE.SWIGPendingException.Pending) { throw UsdCsPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
/// <summary> /// Unbinds the prim from all materials. /// https://graphics.pixar.com/usd/docs/api/class_usd_shade_material.html#a6fc9d56d2e2e826aa3d96711c7b0e605 /// </summary> static public void Unbind(Scene scene, string primPath) { // TODO: verify all objects before use, throw exceptions var prim = scene.Stage.GetPrimAtPath(new SdfPath(primPath)); if (!prim.IsValid()) { throw new ApplicationException("Invalid prim <" + primPath + ">"); } var bindingApi = new UsdShadeMaterialBindingAPI(prim); bindingApi.UnbindAllBindings(); }
/// <summary> /// Binds the prim to the given material. /// https://graphics.pixar.com/usd/docs/api/class_usd_shade_material.html#a116ed8259600f7a48f3792364252a4e1 /// </summary> static public void Bind(Scene scene, string primPath, string materialPath) { var materialPrim = scene.Stage.GetPrimAtPath(new SdfPath(materialPath)); if (!materialPrim.IsValid()) { throw new ApplicationException("Invalid material prim <" + materialPath + ">"); } var mat = new UsdShadeMaterial(materialPrim); if (!mat.GetPrim().IsValid()) { throw new ApplicationException("Invalid material on prim <" + materialPath + ">"); } var bindingApi = new UsdShadeMaterialBindingAPI(scene.Stage.GetPrimAtPath(new SdfPath(primPath))); bindingApi.Bind(mat); }
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(UsdShadeMaterialBindingAPI obj) { return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr); }