public void SetJointRestState(int index, JointRestState state) { C4dApiPINVOKE.CAWeightTag_SetJointRestState(swigCPtr, index, JointRestState.getCPtr(state)); if (C4dApiPINVOKE.SWIGPendingException.Pending) { throw C4dApiPINVOKE.SWIGPendingException.Retrieve(); } }
public void AddWeightData(SceneNodeContainer snc, PolygonObject polyOb, CAWeightTag weightTag, IEnumerable <int> range) { if (weightTag == null || polyOb == null) { return; } List <VertexWeightList> weightMap = new List <VertexWeightList>(); List <float4x4> bindingMatrices = new List <float4x4>(); foreach (int j in range) { using (CPolygon poly = polyOb.GetPolygonAt(j)) { foreach (int iVert in GetPolyPointIndices(poly, polyOb)) { var vertexWeights = new List <VertexWeight>(); for (int iJoint = 0; iJoint < weightTag.GetJointCount(); iJoint++) { double weight = weightTag.GetWeight(iJoint, iVert); // Leave out zero weights. This will save space for the sparse weight table. if (Math.Abs(weight) > double.Epsilon) { vertexWeights.Add(new VertexWeight { JointIndex = iJoint, Weight = (float)weight }); } } vertexWeights.Sort((vw1, vw2) => ((int)(vw1.Weight - vw2.Weight))); weightMap.Add(new VertexWeightList { VertexWeights = vertexWeights }); } } } for (int iJoint = 0; iJoint < weightTag.GetJointCount(); iJoint++) { // Add Binding Matrix JointRestState jointRestState = weightTag.GetJointRestState(iJoint); float4x4 mat = (float4x4)(jointRestState.m_oMi * weightTag.GetGeomMg()); bindingMatrices.Add(mat); } _weightObjects.Add(new WeightObject() { SceneNodeContainer = snc, WeightTag = weightTag, WeightMap = weightMap, BindingMatrices = bindingMatrices }); }
public JointRestState GetJointRestState(int index) { JointRestState ret = new JointRestState(C4dApiPINVOKE.CAWeightTag_GetJointRestState(swigCPtr, index), true); return(ret); }
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(JointRestState obj) { return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr); }