public C4DInterface(GeListNode node, DDescriptionParams descparams) : base(false) { this.node = node; this.descparams = descparams; this.generate(); }
public override bool Init(GeListNode node) { BaseContainer data = GetDataInstance(node); data.SetReal(CIRCLEOBJECT_RAD, 200.0); data.SetLong(C4dApi.PRIM_PLANE, 0); data.SetBool(C4dApi.PRIM_REVERSE, false); data.SetLong(C4dApi.SPLINEOBJECT_INTERPOLATION, C4dApi.SPLINEOBJECT_INTERPOLATION_ADAPTIVE); data.SetLong(C4dApi.SPLINEOBJECT_SUB, 8); data.SetReal(C4dApi.SPLINEOBJECT_ANGLE, 5.0 * Math.PI / 180.0); data.SetReal(C4dApi.SPLINEOBJECT_MAXIMUMLENGTH, 5.0); return true; }
public override bool Init(GeListNode node) { bool ret = C4dApiPINVOKE.GvOperatorData_Init(swigCPtr, GeListNode.getCPtr(node)); return ret; }
public CharakterHuman(GeListNode node, DescriptionCommand desc) { this.b = GetDataInstance(node); this.button = desc.id.GetAt(0).id; this.doc = C4dApi.GetActiveDocument();//Speichern aller Elemente im Dokument in die Variable doc this.myMesh = b.GetObjectLink(SKELETT_OBJ_AUSWAHL, doc); //selektiertes Object in die Variable ObjSe speichern this.mcd = new ModelingCommandData(this.doc, this.myMesh, this.myMesh.GetDataInstance(), MODELINGCOMMANDMODE.MODELINGCOMMANDMODE_ALL, MODELINGCOMMANDFLAGS.MODELINGCOMMANDFLAGS_CREATEUNDO, null, null); /** * Bisheriges speichern und in die Szene zeichnen */ C4dApi.EventAdd(); /** * Wichtungstag definieren */ this.wtag = CAWeightTag.Alloc(); //TODO - Geaendert von DS //this.wtagBaseTag = BaseTag.Alloc(C4dApi.Tweights); /** * Wichtungstag in das BaseObject einbauen */ this.myMesh.InsertTag(this.wtag); /** * Standard BaseObject vom Typ Joint erstellen, diese sind bei Menschen immer aktiv */ BaseObject jointSpine = this.allocJoint("Spine"); BaseObject jointAbs = this.allocJoint("Abs", jointSpine, new double3(0, 100, 0)); BaseObject jointChest = this.allocJoint("Chest", jointAbs, new double3(0, 50, 0)); BaseObject jointNeck = this.allocJoint("Neck", jointChest, new double3(0, 25, 0)); BaseObject jointHead = this.allocJoint("Head", jointNeck, new double3(0, 50, 0)); BaseObject jointL_Hip = this.allocJoint("L_Hip", jointSpine, new double3(25, 0, 0)); BaseObject jointL_Shoulder = this.allocJoint("L_Shoulder", jointChest, new double3(25, 0, 0)); /** * Spiegelung */ BaseObject jointR_Hip = this.allocMirrorJoint("R_Hip", jointSpine, jointL_Hip); BaseObject jointR_Shoulder = this.allocMirrorJoint("R_Shoulder", jointChest, jointL_Shoulder); /*********** * Übergabe an den Wichtungstag ***********/ /** * Arme hinzufügen */ this.AddArms(jointL_Shoulder, jointR_Shoulder); /** * Füße hinzufügen */ this.AddFeet(jointL_Hip, jointR_Hip); /** * Standard */ this.wtag.AddJoint(jointSpine); this.wtag.AddJoint(jointAbs); this.wtag.AddJoint(jointChest); this.wtag.AddJoint(jointNeck); this.wtag.AddJoint(jointHead); // Linke seite vom Körper this.wtag.AddJoint(jointL_Hip); this.wtag.AddJoint(jointL_Shoulder); // Rechte seite vom Körper this.wtag.AddJoint(jointR_Hip); this.wtag.AddJoint(jointR_Shoulder); /** * Debug Ausgabe erstellen */ C4dApi.GePrint("Der Joint wurde angelegt"); jointSpine.GetTag(C4dApi.Tweights); /** * Skin Objekt einfügen */ BaseObject skin = BaseObject.Alloc(C4dApi.Oskin); if (skin != null) { skin.InsertUnder(this.myMesh); skin.SetEditorMode(C4dApi.MODE_ON); //BaseContainer bcc = skin.GetDataInstance(); //InExcludeData list=new InExcludeData(0); //BaseList2D b2d = bcc.GetLink(SKELETT_OBJ_AUSWAHL, doc); //list.InsertObject(b2d,0); // InExcludeData list = (InExcludeData)bcc.GetCustomDataType(ID_CA_SKIN_OBJECT_INCLUDE, C4dApi.CUSTOMDATATYPE_INEXCLUDE_LIST); // list.InsertObject(this.myMesh, 0); //bcc.SetLong(ID_CA_SKIN_OBJECT_INCEXC, 1); //bcc.GetCustomDataType(ID_CA_SKIN_OBJECT_INCEXC_INCLUDE, C4dApi.CUSTOMDATATYPE_INEXCLUDE_LIST); // InExcludeData list = (InExcludeData) //bcc.SetData(ID_CA_SKIN_OBJECT_INCEXC,true); //bcc.GetCustomDataType(ID_CA_SKIN_OBJECT_INCLUDE, C4dApi.CUSTOMDATATYPE_INEXCLUDE_LIST); //int t = bcc.GetId(); //C4dApi.GePrint("list " + t); // list.InsertObject(this.myMesh, 0); //C4dApi.GePrint("list OBJ " + list.GetObjectCount()); /*c++ Variante BaseObject *skin; // a pointer to a skin object BaseContainer *bc = skin->GetDataInstance(); InExcludeData *list = (InExcludeData*)bc->GetCustomDataType(ID_CA_SKIN_OBJECT_INCLUDE, CUSTOMDATATYPE_INEXCLUDE_LIST); BaseObject *mesh; // the object you want to insert into the list list->InsertObject(mesh, 0); */ //InExcludeData iex = autoAlloc(); // InExcludeCustomGui iex = CustomDataType //iex.InsertObject(b.GetLink(SKELETT_OBJ_AUSWAHL,this.doc),1); } /**s * Zur Szene hinzufügen */ //rem.GetName(); //rem.Remove(); C4dApi.EventAdd(); //C4dApi.GetObjectName(1000023); // gibt "Biped Plugin" aus //C4dApi.GePrint("anzal der bones: "+this.wtag.GetJointCount()); doc.SetActiveObject(this.myMesh);//Selektiert das Model im OM //BaseList2D te = this.b.GetLink(1000023, this.doc); //te.Remove(); }
/* public override bool GetDEnabling(GeListNode node, DescID id, GeData t_data,DESCFLAGS_ENABLE flags, BaseContainer itemdesc) { int inter; BaseContainer data = ((BaseObject)node).GetDataInstance(); switch (id[0].id) { case SPLINEOBJECT_SUB: inter=data.GetLong(SPLINEOBJECT_INTERPOLATION); return inter==SPLINEOBJECT_INTERPOLATION_NATURAL || inter==SPLINEOBJECT_INTERPOLATION_UNIFORM; case SPLINEOBJECT_ANGLE: inter = data.GetLong(SPLINEOBJECT_INTERPOLATION); return inter==SPLINEOBJECT_INTERPOLATION_ADAPTIVE || inter==SPLINEOBJECT_INTERPOLATION_SUBDIV; case SPLINEOBJECT_MAXIMUMLENGTH: return data.GetLong(SPLINEOBJECT_INTERPOLATION)==SPLINEOBJECT_INTERPOLATION_SUBDIV; } return true; } */ public override bool GetDDescription(GeListNode node, DDescriptionParams descparams) { // The main part of this code is taken from the "LookAtCamera.cpp" file from the original C4D API samples. // Be aware that the original LookAtCamera is not an object created from the Plugin menu but a // Tag type that can be added to existing objects from the "Objekte" context (right mouse button) menu under // the "Cinema4dsdk Tags" sub menu. // TODO: whatever this might be good for: if (!singleid || cid.IsPartOf(*singleid, NULL)) // important to check for speedup c4d! // { // This will load the main object attribute tabs ("Basis", "Koord", "Objekt") if (!descparams.Desc.LoadDescription("obase")) return false; ////////////////////////////////////////////////////////////////////////////////////// // Create a double value named radius on the "Objekt" tab's main level DescID cid = new DescID(new DescLevel(CIRCLEOBJECT_RAD, C4dApi.DTYPE_LONG, 0)); // The ID of the radius value (CIRCLEOBJECT_RAD) BaseContainer bcRadius = C4dApi.GetCustomDataTypeDefault(C4dApi.DTYPE_REAL); // The type of the radius value (REAL) bcRadius.SetString(C4dApi.DESC_NAME, "Radius"); // The user interface name (Radius) bcRadius.SetLong(C4dApi.DESC_DEFAULT, 44); // The default value (44, but overridden to 200 in the Init method) // Create the new radius value as a child of the "Objekt" Tab (ID_OBJECTPROPERTIES) if (!descparams.Desc.SetParameter(cid, bcRadius, new DescID(new DescLevel(C4dApi.ID_OBJECTPROPERTIES)))) return true; ///////////////////////////////////////////////////////////////////////////////////// // Create an entirely new Tab (called "Ein schöner Tab") cid = new DescID(new DescLevel(CIRCLEOBJECT_NEWTAB, C4dApi.DTYPE_GROUP, 0)); BaseContainer bcMaingroup = C4dApi.GetCustomDataTypeDefault(C4dApi.DTYPE_GROUP); bcMaingroup.SetString(C4dApi.DESC_NAME, "Ein schöner Tab"); // Create the new Group on the top level (DecLevel(0)) if (!descparams.Desc.SetParameter(cid, bcMaingroup, new DescID(new DescLevel(0)))) return true; ///////////////////////////////////////////////////////////////////////////////////// // Create an new sub group (called "Hübsches Grüppchen") cid = new DescID(new DescLevel(CIRCLEOBJECT_SUBGROUP, C4dApi.DTYPE_GROUP, 0)); BaseContainer bcSubgroup = C4dApi.GetCustomDataTypeDefault(C4dApi.DTYPE_GROUP); bcSubgroup.SetString(C4dApi.DESC_NAME, "Hübsches Grüppchen"); // Create the sub group on the "Ein schöner Tab" main tab (CIRCLEOBJECT_NEWTAB) if (!descparams.Desc.SetParameter(cid, bcSubgroup, new DescID(new DescLevel(CIRCLEOBJECT_NEWTAB)))) return true; ///////////////////////////////////////////////////////////////////////////////////// // Create an new boolean value (as a checkbox) called "Check mich" cid = new DescID(new DescLevel(CIRCLEOBJECT_CHECKME, C4dApi.DTYPE_BOOL, 0)); BaseContainer bcCheckMich = C4dApi.GetCustomDataTypeDefault(C4dApi.DTYPE_BOOL); bcCheckMich.SetString(C4dApi.DESC_NAME, "Check mich"); bcCheckMich.SetBool(C4dApi.DESC_DEFAULT, true); // Create the boolean check box under the previously created sub group (CIRCLEOBJECT_SUBGROUP) if (!descparams.Desc.SetParameter(cid, bcCheckMich, new DescID(new DescLevel(CIRCLEOBJECT_SUBGROUP)))) return true; descparams.Flags |= DESCFLAGS_DESC.DESCFLAGS_DESC_LOADED; return true; // base.GetDDescription(node, descparams); }
//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.GetLong(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.GetType() == 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 void InsertLast(GeListNode bn) { C4dApiPINVOKE.GeListHead_InsertLast(swigCPtr, GeListNode.getCPtr(bn)); }
public override bool SetDParameter(GeListNode node, DescID id, GeData t_data, SWIGTYPE_p_DESCFLAGS_SET flags) { bool ret = C4dApiPINVOKE.GvOperatorData_SetDParameter(swigCPtr, GeListNode.getCPtr(node), DescID.getCPtr(id), GeData.getCPtr(t_data), SWIGTYPE_p_DESCFLAGS_SET.getCPtr(flags)); if (C4dApiPINVOKE.SWIGPendingException.Pending) throw C4dApiPINVOKE.SWIGPendingException.Retrieve(); return ret; }
//GetDDescription für das erstellen des Interface public override bool GetDDescription(GeListNode node, DDescriptionParams descparams) { C4DInterface C4DInter = new C4DInterface(node, descparams); return true; }
public virtual bool Read(GeListNode node, SWIGTYPE_p_HyperFile hf, int level) { bool ret = C4dApiPINVOKE.NodeData_Read(swigCPtr, GeListNode.getCPtr(node), SWIGTYPE_p_HyperFile.getCPtr(hf), level); return ret; }
public virtual bool Write(GeListNode node, SWIGTYPE_p_HyperFile hf) { bool ret = C4dApiPINVOKE.NodeData_Write(swigCPtr, GeListNode.getCPtr(node), SWIGTYPE_p_HyperFile.getCPtr(hf)); return ret; }
public virtual bool Init(GeListNode node) { bool ret = C4dApiPINVOKE.NodeData_Init(swigCPtr, GeListNode.getCPtr(node)); return ret; }
public virtual void Free(GeListNode node) { C4dApiPINVOKE.NodeData_Free(swigCPtr, GeListNode.getCPtr(node)); }
public virtual bool IsDocumentRelated(GeListNode node, SWIGTYPE_p_Bool docrelated) { bool ret = C4dApiPINVOKE.NodeData_IsDocumentRelated(swigCPtr, GeListNode.getCPtr(node), SWIGTYPE_p_Bool.getCPtr(docrelated)); if (C4dApiPINVOKE.SWIGPendingException.Pending) throw C4dApiPINVOKE.SWIGPendingException.Retrieve(); return ret; }
public virtual bool TranslateDescID(GeListNode node, DescID id, DescID res_id, SWIGTYPE_p_p_C4DAtom res_at) { bool ret = C4dApiPINVOKE.NodeData_TranslateDescID(swigCPtr, GeListNode.getCPtr(node), DescID.getCPtr(id), DescID.getCPtr(res_id), SWIGTYPE_p_p_C4DAtom.getCPtr(res_at)); if (C4dApiPINVOKE.SWIGPendingException.Pending) throw C4dApiPINVOKE.SWIGPendingException.Retrieve(); return ret; }
public virtual bool GetDParameter(GeListNode node, DescID id, GeData t_data, SWIGTYPE_p_DESCFLAGS_GET flags) { bool ret = C4dApiPINVOKE.NodeData_GetDParameter(swigCPtr, GeListNode.getCPtr(node), DescID.getCPtr(id), GeData.getCPtr(t_data), SWIGTYPE_p_DESCFLAGS_GET.getCPtr(flags)); if (C4dApiPINVOKE.SWIGPendingException.Pending) throw C4dApiPINVOKE.SWIGPendingException.Retrieve(); return ret; }
public override bool GetDDescription(GeListNode node, Description description, SWIGTYPE_p_DESCFLAGS_DESC flags) { bool ret = C4dApiPINVOKE.GvOperatorData_GetDDescription(swigCPtr, GeListNode.getCPtr(node), Description.getCPtr(description), SWIGTYPE_p_DESCFLAGS_DESC.getCPtr(flags)); if (C4dApiPINVOKE.SWIGPendingException.Pending) throw C4dApiPINVOKE.SWIGPendingException.Retrieve(); return ret; }
public virtual bool Message(GeListNode node, int type, SWIGTYPE_p_void data) { bool ret = C4dApiPINVOKE.NodeData_Message(swigCPtr, GeListNode.getCPtr(node), type, SWIGTYPE_p_void.getCPtr(data)); return ret; }
public override bool GetDEnabling(GeListNode node, DescID id, GeData t_data, DESCFLAGS_ENABLE flags, BaseContainer itemdesc) { bool ret = C4dApiPINVOKE.GvOperatorData_GetDEnabling(swigCPtr, GeListNode.getCPtr(node), DescID.getCPtr(id), GeData.getCPtr(t_data), (int)flags, BaseContainer.getCPtr(itemdesc)); if (C4dApiPINVOKE.SWIGPendingException.Pending) throw C4dApiPINVOKE.SWIGPendingException.Retrieve(); return ret; }
public virtual bool CopyTo(NodeData dest, GeListNode snode, GeListNode dnode, COPYFLAGS flags, AliasTrans trn) { bool ret = C4dApiPINVOKE.NodeData_CopyTo(swigCPtr, NodeData.getCPtr(dest), GeListNode.getCPtr(snode), GeListNode.getCPtr(dnode), (int)flags, AliasTrans.getCPtr(trn)); return ret; }
public void Add(GeListNode node, int priority, EXECUTIONFLAGS flags) { C4dApiPINVOKE.PriorityList_Add(swigCPtr, GeListNode.getCPtr(node), priority, (int)flags); }
public virtual void GetBubbleHelp(GeListNode node, SWIGTYPE_p_String str) { C4dApiPINVOKE.NodeData_GetBubbleHelp(swigCPtr, GeListNode.getCPtr(node), SWIGTYPE_p_String.getCPtr(str)); if (C4dApiPINVOKE.SWIGPendingException.Pending) throw C4dApiPINVOKE.SWIGPendingException.Retrieve(); }
public bool makeAnimalJoints(GeListNode node, DescriptionCommand desc) { CharakterAnimal Main = new CharakterAnimal(node, desc); this.wtagGlob = Main.getwtagJoint(); return true; }
public virtual BaseDocument GetDocument(GeListNode node) { IntPtr cPtr = C4dApiPINVOKE.NodeData_GetDocument(swigCPtr, GeListNode.getCPtr(node)); BaseDocument ret = (cPtr == IntPtr.Zero) ? null : new BaseDocument(cPtr, false); return ret; }
public void SetParent(GeListNode parent) { C4dApiPINVOKE.GeListHead_SetParent(swigCPtr, GeListNode.getCPtr(parent)); }
public void InsertAfter(GeListNode bl) { C4dApiPINVOKE.GeListNode_InsertAfter(swigCPtr, GeListNode.getCPtr(bl)); }
public void Insert(GeListNode bn, GeListNode parent, GeListNode prev) { C4dApiPINVOKE.GeListHead_Insert(swigCPtr, GeListNode.getCPtr(bn), GeListNode.getCPtr(parent), GeListNode.getCPtr(prev)); }
public virtual bool IsInstanceOf(GeListNode node, int type) { bool ret = C4dApiPINVOKE.NodeData_IsInstanceOf(swigCPtr, GeListNode.getCPtr(node), type); return ret; }
public virtual int GetBranchInfo(GeListNode node, BranchInfo info, int max, GETBRANCHINFO flags) { int ret = C4dApiPINVOKE.NodeData_GetBranchInfo(swigCPtr, GeListNode.getCPtr(node), BranchInfo.getCPtr(info), max, (int)flags); return ret; }
public void InsertUnderLast(GeListNode bl) { C4dApiPINVOKE.GeListNode_InsertUnderLast(swigCPtr, GeListNode.getCPtr(bl)); }