Esempio n. 1
0
        public CharakterAnimal(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();
            //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
             */
            //Rückenknochen
            BaseObject[] jointSpineArr = this.allocBonesSwing("Spine", this.myMesh, this.b.GetInt64(SKELETT_RUECKENWIRBEL), new double3(50, -2, 0));
            //Nackenknochen
            BaseObject jointNeck = this.allocBonesCurveY("Neck", jointSpineArr[0], this.b.GetInt64(SKELETT_HALSWIRBEL), new double3(-100, 0, 0));
            //Kopf
            BaseObject jointHead = this.allocJoint("Head", jointNeck, new double3(-100, 0, 0));

            this.wtag.AddJoint(jointHead);


            if (this.b.GetInt64(SKELETT_BEINE) > 0)
            {
                this.addLegsFront(jointSpineArr[0]);
                if (this.b.GetInt64(SKELETT_BEINE) >= 3)
                {
                    this.addLegsBack(jointSpineArr[1]);
                }
            }

            //Schwanz
            if (this.b.GetInt64(SKELETT_RUECKENWIRBEL) > 0 && this.b.GetInt64(SKELETT_SCHWANZ) > 0)
            {
                BaseObject parent = jointSpineArr[1];
                for (int i = 0; i < this.b.GetInt64(SKELETT_SCHWANZ); i++)
                {
                    BaseObject jointTail = this.allocJoint("Tail_" + i, parent, new double3(100, -50, 0));
                    this.wtag.AddJoint(jointTail);
                    parent = jointTail;
                }
            }

            /**
             * Debug Ausgabe erstellen
             */
            C4dApi.GePrint("Der Joint wurde angelegt");
            jointSpineArr[0].GetTag(C4dApi.Tweights);

            /**
             * Skin Objekt einfügen
             */

            BaseObject skin = BaseObject.Alloc(C4dApi.Oskin);

            if (skin != null)
            {
                skin.InsertUnder(this.myMesh);
            }

            /**
             * Zur Szene hinzufügen
             */
            C4dApi.EventAdd();
            C4dApi.GePrint("anzal der bones: " + this.wtag.GetJointCount());
            doc.SetActiveObject(this.myMesh);//Selektiert das Model im OM
        }
Esempio n. 2
0
        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();
        }
Esempio n. 3
0
        private bool generate()
        {
            // Diese Abfrage lädt die den Reiter Objekt
            if (!descparams.Desc.LoadDescription("obase"))
            {
                return(false);
            }

            //Erstellen der ComboBox zur auswahl des Skelettes
            if (this.getComboBoxCharakter() == true)
            {
                return(false);
            }

            //Erstellen der Trennlinie
            if (this.getSeperator() == true)
            {
                return(false);
            }

            BaseContainer dataKoerper = GetDataInstance(node); //Speichert alle elemente von der Liste in den Container

            if (dataKoerper.GetInt64(SKELETT_TYPE) != 3)       //Ist die ID 3 so wurde ein 4 Beiner ausgewählt, da diese keine Arme haben wird der Komplette Block für die Arme im Intrface ausgeblendet
            {
                if (this.getTorso() == true)
                {
                    return(false);
                }
            }
            //Abfragen ob ein Oberkörper erstellt werden soll

            //DescID singleid = descparams.Desc.GetSingleDescID();
            //data = ((BaseList2D)node).GetDataInstance();

            // Arme erstellen
            if (this.getArms(dataKoerper) == true)
            {
                return(false);
            }

            // Hände erstellen
            if (this.getHands(dataKoerper) == true)
            {
                return(false);
            }

            // Finger erstellen
            if (this.getFingers(dataKoerper) == true)
            {
                return(false);
            }

            if (this.getSeperatorTorso() == true)
            {
                return(false);
            }

            if (this.getLegs(dataKoerper) == true)
            {
                return(false);
            }

            if (this.getFeets(dataKoerper) == true)
            {
                return(false);
            }

            if (this.getToes(dataKoerper) == true)
            {
                return(false);
            }

            if (this.getSeperatorFeetSpine() == true)
            {
                return(false);
            }

            if (this.getSpineLink() == true)
            {
                return(false);
            }

            if (this.getNeckLink() == true)
            {
                return(false);
            }

            if (this.getSeperatorSpineTail() == true)
            {
                return(false);
            }

            if (this.getTail() == true)
            {
                return(false);
            }

            if (this.getSeperatorTailSelector() == true)
            {
                return(false);
            }


            //Objektauswahlfeld erstellen
            DescID        cid    = new DescID(new DescLevel(SKELETT_OBJ_AUSWAHL, C4dApi.DTYPE_BASELISTLINK, 0));
            BaseDocument  doc    = C4dApi.GetActiveDocument();                                 // alle vorhandenen Objekte im Dokument in die Variable doc Speicerhn
            BaseContainer objSel = C4dApi.GetCustomDataTypeDefault(C4dApi.DTYPE_BASELISTLINK); // Basecontainer vom Typ BaseLink da wird Objekte verlinken , referenzieren

            objSel.SetLink(SKELETT_OBJ_AUSWAHL, doc);                                          //SelectFeld erstellen in dem ein Objekct gebunden werden kann, ist nötig damit später knochen dem Modell zugewiesen werden können!
            objSel.SetString(C4dApi.DESC_NAME, "Polygonobjekt Wählen");
            if (!descparams.Desc.SetParameter(cid, objSel, new DescID(new DescLevel(C4dApi.ID_OBJECTPROPERTIES))))
            {
                return(true);
            }
            //Erstellt eine Schaltfläsche
            cid = new DescID(new DescLevel(SKELETT_BTN_CREATE, C4dApi.DTYPE_BUTTON, 0));
            BaseContainer bcButton = C4dApi.GetCustomDataTypeDefault(C4dApi.DTYPE_BUTTON);

            //Erstellt einen GUI (Button)
            bcButton.SetInt64(C4dApi.DESC_CUSTOMGUI, C4dApi.DTYPE_BUTTON);

            //Erstellt das Label für den Button
            bcButton.SetString(C4dApi.DESC_NAME, "Erstellen");
            if (!descparams.Desc.SetParameter(cid, bcButton, new DescID(new DescLevel(C4dApi.ID_OBJECTPROPERTIES))))
            {
                return(false);
            }

            if (this.getWeightBtn() == true)
            {
                return(false);
            }

            descparams.Flags |= DESCFLAGS_DESC.DESCFLAGS_DESC_LOADED;

            return(true);
        }
Esempio n. 4
0
        public Human(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();

            /**
             * 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 Vector3D(0, 200, 0));
            BaseObject jointChest      = this.allocJoint("Chest", jointAbs, new Vector3D(0, 50, 0));
            BaseObject jointNeck       = this.allocJoint("Neck", jointChest, new Vector3D(0, 25, 0));
            BaseObject jointHead       = this.allocJoint("Head", jointNeck, new Vector3D(0, 50, 0));
            BaseObject jointL_Hip      = this.allocJoint("L_Hip", jointSpine, new Vector3D(25, 0, 0));
            BaseObject jointL_Shoulder = this.allocJoint("L_Shoulder", jointChest, new Vector3D(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);

            /**
             * Zur Szene hinzufügen
             */
            C4dApi.EventAdd();
        }