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();
        }
Beispiel #2
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
        }
Beispiel #3
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();
        }