private void setJointWeight(int tagPos, BaseObject op2, PointObject pObj) { BaseTag t = op2.GetTag(C4dApi.Tpointselection, tagPos); SelectionTag st = (SelectionTag)op2.GetTag(C4dApi.Tpolygonselection); BaseSelect SelectedPoints = st.GetBaseSelect(); if (t.GetName() == null) { } else { string selectioname = t.GetName(); for (int j = 0; j < this.wtagGlob.GetJointCount(); j++) { if (selectioname == this.wtagGlob.GetName()) { for (int i = 0; i < pObj.GetPointCount(); i++) { if (SelectedPoints.IsSelected(i)) { this.wtagGlob.SetWeight(1, i, 0.04); setJointWeight(tagPos + 1, op2, pObj); //C4dApi.GePrint("Der Punkt mit dem Index " + i + " ist selektiert"); } } } } } }
public static BaseSelect Alloc() { global::System.IntPtr cPtr = C4dApiPINVOKE.BaseSelect_Alloc(); BaseSelect ret = (cPtr == global::System.IntPtr.Zero) ? null : new BaseSelect(cPtr, false); return(ret); }
public SWIGTYPE_p_Float CalcSurfaceDistances(PolygonObject pObject, BaseSelect selected) { global::System.IntPtr cPtr = C4dApiPINVOKE.BrushBase_CalcSurfaceDistances__SWIG_4(swigCPtr, PolygonObject.getCPtr(pObject), BaseSelect.getCPtr(selected)); SWIGTYPE_p_Float ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_Float(cPtr, false); return(ret); }
public BaseSelect GetClone() { global::System.IntPtr cPtr = C4dApiPINVOKE.BaseSelect_GetClone(swigCPtr); BaseSelect ret = (cPtr == global::System.IntPtr.Zero) ? null : new BaseSelect(cPtr, false); return(ret); }
public BaseSelect GetSelectedEdges(Neighbor e, BaseSelect sel) { global::System.IntPtr cPtr = C4dApiPINVOKE.PolygonObject_GetSelectedEdges__SWIG_1(swigCPtr, Neighbor.getCPtr(e), BaseSelect.getCPtr(sel)); BaseSelect ret = (cPtr == global::System.IntPtr.Zero) ? null : new BaseSelect(cPtr, false); return(ret); }
public BaseSelect GetPhongBreak() { global::System.IntPtr cPtr = C4dApiPINVOKE.PolygonObject_GetPhongBreak(swigCPtr); BaseSelect ret = (cPtr == global::System.IntPtr.Zero) ? null : new BaseSelect(cPtr, false); return(ret); }
public SWIGTYPE_p_Float CalcSurfaceDistances(PolygonObject pObject, BaseSelect selected, Neighbor pNeighbor, ref Fusee.Math.Core.double3 /* Vector*&_cstype */ pNormals) { global::System.IntPtr cPtr = C4dApiPINVOKE.BrushBase_CalcSurfaceDistances__SWIG_2(swigCPtr, PolygonObject.getCPtr(pObject), BaseSelect.getCPtr(selected), Neighbor.getCPtr(pNeighbor), ref pNormals /* Vector*&_csin */); SWIGTYPE_p_Float ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_Float(cPtr, false); return(ret); }
public BaseSelect GetSelectedEdges(Neighbor e, EDGESELECTIONTYPE ltype) { global::System.IntPtr cPtr = C4dApiPINVOKE.PolygonObject_GetSelectedEdges__SWIG_0(swigCPtr, Neighbor.getCPtr(e), (int)ltype); BaseSelect ret = (cPtr == global::System.IntPtr.Zero) ? null : new BaseSelect(cPtr, false); return(ret); }
public bool Cross(BaseSelect src) { bool ret = C4dApiPINVOKE.BaseSelect_Cross(swigCPtr, BaseSelect.getCPtr(src)); return(ret); }
public bool Deselect(BaseSelect src) { bool ret = C4dApiPINVOKE.BaseSelect_Deselect__SWIG_1(swigCPtr, BaseSelect.getCPtr(src)); return(ret); }
public bool Merge(BaseSelect src) { bool ret = C4dApiPINVOKE.BaseSelect_Merge(swigCPtr, BaseSelect.getCPtr(src)); return(ret); }
public bool CopyTo(BaseSelect dest) { bool ret = C4dApiPINVOKE.BaseSelect_CopyTo(swigCPtr, BaseSelect.getCPtr(dest)); return(ret); }
public void GetHiddenNgons(BaseSelect sel) { C4dApiPINVOKE.PolygonObject_GetHiddenNgons(swigCPtr, BaseSelect.getCPtr(sel)); }
public async Task <List <T> > GetAllAsync() { return(await BaseSelect.ToListAsync()); }
public async Task <List <PlaylistDefinition> > GetAllByUserIdAsync(string userId) { return(await BaseSelect .Where(o => o.UserId == userId) .ToListAsync()); }
public bool GetEdgeSelection(BaseSelect sel, EDGESELECTIONTYPE type) { bool ret = C4dApiPINVOKE.PolygonObject_GetEdgeSelection(swigCPtr, BaseSelect.getCPtr(sel), (int)type); return(ret); }
public bool ValidateEdgeSelection(BaseSelect sel) { bool ret = C4dApiPINVOKE.PolygonObject_ValidateEdgeSelection__SWIG_0(swigCPtr, BaseSelect.getCPtr(sel)); return(ret); }
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(BaseSelect obj) { return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr); }
public async Task <T> GetByIdAsync(string id) { return(await BaseSelect .Where(o => o.Id == id) .FirstOrDefaultAsync()); }
public bool SetSelectedEdges(Neighbor e, BaseSelect pSel, EDGESELECTIONTYPE ltype) { bool ret = C4dApiPINVOKE.PolygonObject_SetSelectedEdges(swigCPtr, Neighbor.getCPtr(e), BaseSelect.getCPtr(pSel), (int)ltype); return(ret); }
public async Task <List <T> > GetAllByIdListAsync(IEnumerable <string> idList) { return(await BaseSelect .Where(o => idList.Contains(o.Id)) .ToListAsync()); }
//wird aufgerufen, wenn ein Event ausgeführt wurde //TODO: Override gelöscht - DS public bool OnDescriptionCommand(GeListNode node, DescriptionCommand desc) { long button = desc.id.GetAt(0).id; //BaseList2D ObjSelector = bc.GetLink(SKELETT_OBJ_AUSWAHL, doc); switch (button) { case SKELETT_BTN_CREATE: BaseContainer b = GetDataInstance(node); BaseDocument doc = C4dApi.GetActiveDocument(); BaseList2D ObjSelector = b.GetLink(SKELETT_OBJ_AUSWAHL, doc); /*Eingeforene Selektion Auswählen vom Typ Polygon ENDE*/ if (ObjSelector == null) { C4dApi.MessageDialog("Bitte wählen Sie zuerst ein Polygonobjekt aus, bevor Sie ein Biped erstellen!"); } else { long skelett = b.GetInt64(SKELETT_TYPE); if (skelett == 3) { this.makeAnimalJoints(node, desc); } else { this.makeJoints(node, desc); } } // C4dApi.GePrint("Der button Erstellen wurde gedrück "+objSe.GetNodeID()+objSe.GetName()); //ObjSe.GetName() liefert den namen des Selektierten Objekts zurück. break; case SKELETT_WICHTUNG_BTN: /*Eingefrorene Selektion Auswählen vom Typ Polygon START*/ BaseContainer b2 = GetDataInstance(node); BaseDocument doc2 = C4dApi.GetActiveDocument(); BaseObject op2 = b2.GetObjectLink(SKELETT_OBJ_AUSWAHL, doc2); BaseTag t = op2.GetTag(C4dApi.Tpolygonselection); //string selekname = t.GetName(); //BaseTag t2 = op2.GetTag(C4dApi.Tpolygonselection,1); //if (op2.GetTag(C4dApi.Tpolygonselection,2)==null) //{ } //C4dApi.GePrint(" blubb " + t2.GetName() + " der name der vorherigen Selektion lautet: " + selekname); //C4dApi.GePrint(" blubb der name der vorherigen Selektion lautet: " + selekname); //BaseObject j = this.wtagGlob.GetJoint(1, doc2); //C4dApi.GePrint("Knochenname "+j.GetName()); //string joinName = j.GetName(); //if (joinName == selekname) //{ // C4dApi.GePrint("stimmen ueberein"); //} //SelectionTag st = SelectionTag.Alloc(C4dApi.Tpolygonselection); //BaseSelect sel = st.GetBaseSelect(); //sel.Select(t.GetNodeID); BaseTag joints = op2.GetTag(C4dApi.Tweights); //this.wtagGlob = joints.Get C4dApi.GePrint("wichtung setzen bones anzahl: " + this.wtagGlob.GetJointCount()); //Punkte der PolygonSelektion abrufen //int pt = op2.GetTagDataCount(C4dApi.Tpolygonselection); //C4dApi.GePrint("Anzahl der Punkte : " + pt); //doc2.SetActiveObject(b2.GetObjectLink(SKELETT_OBJ_AUSWAHL, doc2)); SelectionTag st = SelectionTag.Alloc(C4dApi.Tpointselection); BaseSelect bs = st.GetBaseSelect(); PointObject pObj = PointObject.GetPointObject(op2); //pObj.GetPointS(); //for (int i = 0; i < pObj.GetPointCount(); i++) //{ //} C4dApi.GePrint("test" + bs.Select(0)); bs.Select(0); BaseSelect SelectedPoints = pObj.GetPointS(); //for (BaseTag pointTag = op2.GetFirstTag(); pointTag; pointTag = pointTag.GetNext()) //{ // desc.id.GetAt(0).id = 1000; // pointTag.Message(C4dApi.MSG_DESCRIPTION_COMMAND, desc); //} BaseTag btA = doc2.GetActiveTag(); C4dApi.GePrint("TypeName : " + btA.GetTypeName() + " Name " + btA.GetName()); if (btA.GetTypeC4D() == C4dApi.Tpolygonselection) { for (int j = 0; j < wtagGlob.GetJointCount(); j++) { BaseObject JointName = wtagGlob.GetJoint(j, doc2); if (btA.GetName() == JointName.GetName()) { for (int i = 0; i < pObj.GetPointCount(); i++) { if (SelectedPoints.IsSelected(i)) { this.wtagGlob.SetWeight(j, i, 0.04); C4dApi.GePrint("Der Punkt mit dem Index " + i + " ist selektiert"); } } } } } else { } //C4dApi.GePrint("anzahl der pt " + pObj.GetPointCount()); //pObj.SetPointAt(1, new Vector3D(1, 2, 3)); //XPressoTag xt = XPressoTag.Alloc(); //xt = (BaseSelect)t; // this.wtagGlob.SetWeight(1, 2, 1.0/100); //Setweeight 1.0 == 100 entspricht 0.42 == 42.0 entspricht Deshalb ist es einfacher direkt durch hundert zu teilen break; } return(true); }
public virtual bool Init(int pcnt, CPolygon vadr, int vcnt, BaseSelect bs) { bool ret = C4dApiPINVOKE.Neighbor_Init(swigCPtr, pcnt, CPolygon.getCPtr(vadr), vcnt, BaseSelect.getCPtr(bs)); return(ret); }
/// <summary> /// This method tries to make the best out of C4Ds seldom relationship between objects with /// multiple materials which can or can not be restricted to polygon selections and one or more UV sets. /// But there are unhandled cases: /// Multple UV tags are not supported. Overlapping polygon selections are probably handled differently. /// The awkward side effects when changing the tags' order in C4D are not reproduced. /// </summary> /// <param name="ob"></param> /// <param name="snc"></param> private void VisitObject(BaseObject ob, SceneNodeContainer snc) { Collection <TextureTag> textureTags = new Collection <TextureTag>(); Dictionary <string, SelectionTag> selectionTags = new Dictionary <string, SelectionTag>(); UVWTag uvwTag = null; CAWeightTag weightTag = null; // SCRATCH // var targetComponent = new TargetComponent {ExtraInfo = aStr, Radius = anInt}; // snc.AddComponent(targetComponent); // Iterate over the object's tags for (BaseTag tag = ob.GetFirstTag(); tag != null; tag = tag.GetNext()) { // GeneralTag if (1036156 == tag.GetTypeC4D()) { var di = tag.GetDataInstance(); int anInt = di.GetInt32(10000); string aStr = di.GetString(10001); Logger.Debug("Found a GeneralTag with TheInt=" + anInt + " and TheString = \"" + aStr + "\""); // var targetComponent = new TargetComponent {ExtraInfo = aStr, Radius = anInt}; // snc.AddComponent(targetComponent); } // CAWeightTag - Save data to create the weight list later CAWeightTag wTag = tag as CAWeightTag; if (wTag != null) { weightTag = wTag; continue; } // TextureTag (Material - there might be more than one) TextureTag tex = tag as TextureTag; if (tex != null) { textureTags.Add(tex); continue; } // UVWTag - the texutre coordinates. We handle only one UVWTag uvw = tag as UVWTag; if (uvw != null) { if (uvwTag == null) { uvwTag = uvw; } else { Logger.Error("Object " + ob.GetName() + " contains more than one uv-coordinates-tag. Cannot handle this. Only the first texture tag will be recognized."); } continue; } // Selection tag. Only recognize the polygon selections as they might be referenced in a TextureTag SelectionTag selection = tag as SelectionTag; string selTagName = tag.GetName(); if (selection != null && selection.GetTypeC4D() == C4dApi.Tpolygonselection && !string.IsNullOrEmpty(selTagName)) // One Type and three TypeIDs - You C4D programmer guys really suck { selectionTags[selTagName] = selection; } // XPresso Tags - TBD XPressoTag xPresso = tag as XPressoTag; if (xPresso != null) { // Handle XPresso tag continue; } } TextureTag lastUnselectedTag = null; Collection <KeyValuePair <SelectionTag, TextureTag> > texSelList = new Collection <KeyValuePair <SelectionTag, TextureTag> >(); // Abused KeyValuePair. Should have been Pair... // Now iterate over the textureTags foreach (TextureTag texture in textureTags) { string selRef = ""; using (BaseContainer texData = texture.GetData()) { selRef = texData.GetString(C4dApi.TEXTURETAG_RESTRICTION); } if (string.IsNullOrEmpty(selRef)) { // This material is not restricted to any polygon selection lastUnselectedTag = texture; } else { SelectionTag sel; if (selectionTags.TryGetValue(selRef, out sel)) { texSelList.Add(new KeyValuePair <SelectionTag, TextureTag>(sel, texture)); } } } // At this point we have the last texture tag not restricted to a seletion. This will become the Material of this FuseeObjectContainer // no matter if this object contains geometry or not if (lastUnselectedTag != null) { AddComponent(snc, GetMaterial(lastUnselectedTag)); } // Further processing only needs to take place if the object contains any geometry at all. PolygonObject polyOb = ob as PolygonObject; // Check whether the object contains an unpolygonized mesh if (polyOb == null) { polyOb = ob.GetCache(null) as PolygonObject; } if (polyOb != null) { float3[] normalOb = polyOb.CreatePhongNormals(); // Initialize the polygon index set int nPolys = polyOb.GetPolygonCount(); HashSet <int> polyInxs = new HashSet <int>(); for (int i = 0; i < nPolys; i++) { polyInxs.Add(i); } foreach (KeyValuePair <SelectionTag, TextureTag> texSelItem in texSelList) { HashSet <int> polyInxsSubset = new HashSet <int>(); BaseSelect bs = texSelItem.Key.GetBaseSelect(); int nSegments = bs.GetSegments(); for (int iSeg = 0; iSeg < nSegments; iSeg++) { int from = bs.GetRangeA(iSeg); int to = bs.GetRangeB(iSeg); for (int iSel = from; iSel <= to; iSel++) { polyInxs.Remove(iSel); polyInxsSubset.Add(iSel); } } // Now generate Polygons for this subset if (polyInxsSubset.Count > 0) { if (snc.Children == null) { snc.Children = new List <SceneNodeContainer>(); } SceneNodeContainer subSnc = new SceneNodeContainer(); AddComponent(subSnc, new TransformComponent() { Translation = new float3(0, 0, 0), Rotation = new float3(0, 0, 0), Scale = new float3(1, 1, 1) }); AddComponent(subSnc, GetMaterial(texSelItem.Value)); subSnc.Name = snc.Name + "_" + texSelItem.Key.GetName(); AddComponent(subSnc, GetMesh(polyOb, normalOb, uvwTag, polyInxsSubset)); _weightManager.AddWeightData(subSnc, polyOb, weightTag, polyInxsSubset); snc.Children.Add(subSnc); } } // The remaining polygons directly go into the original mesh AddComponent(snc, GetMesh(polyOb, normalOb, uvwTag, polyInxs)); _weightManager.AddWeightData(snc, polyOb, weightTag, polyInxs); } else if (ob.GetTypeC4D() == C4dApi.Olight) { using (BaseContainer lightData = ob.GetData()) // Just for debugging purposes for (int i = 0, id = 0; -1 != (id = lightData.GetIndexId(i)); i++) { if (lightData.GetTypeC4D(id) == C4dApi.DA_LONG) { int iii = lightData.GetInt32(id); } if (lightData.GetTypeC4D(id) == C4dApi.DA_REAL) { double d = lightData.GetFloat(id); } else if (lightData.GetTypeC4D(id) == C4dApi.DA_VECTOR) { double3 v = lightData.GetVector(id); } } ; } }