コード例 #1
0
        protected BaseObject allocBonesCurveY(string mainname, BaseObject parent, long counter = 0, double3 vec = new double3())
        {
            int bone = (int)counter;
            BaseObject myJoint = null;
            double x = vec.x;
            double y = vec.y;
            if (x < 0)
            {
                x *= -1;
            }
            while (bone > 0)
            {
                vec.y += x / bone;
                if (vec.y > x)
                {
                    vec.y = x;
                }
                myJoint = this.allocJoint(mainname, parent, vec);
                this.wtag.AddJoint(myJoint);
                vec.x += vec.y;
                if (vec.x > 0)
                {
                    vec.x = 0;
                }

                parent = myJoint;
                bone--;
            }
            return myJoint;
        }
コード例 #2
0
        protected BaseObject allocBonesCurveY(string mainname, BaseObject parent, long counter = 0, Vector3D vec = new Vector3D())
        {
            int bone = (int)counter;
            BaseObject myJoint = null;
            double x = vec.X;
            double y = vec.Y;
            if (x < 0)
            {
                x *= -1;
            }
            while (bone > 0)
            {
                vec.Y += x / bone;
                if (vec.Y > x)
                {
                    vec.Y = x;
                }
                myJoint = this.allocJoint(mainname, parent, vec);
                this.wtag.AddJoint(myJoint);
                vec.X += vec.Y;
                if (vec.X > 0)
                {
                    vec.X = 0;
                }

                parent = myJoint;
                bone--;
            }
            return myJoint;
        }
コード例 #3
0
ファイル: DoubleCircle.cs プロジェクト: KilledChicken/Fusee
        static Vector3D GetRTHandle(BaseObject op, int id)
        {
	        BaseContainer data = GetDataInstance(op);
	        double rad	  = data.GetReal(CIRCLEOBJECT_RAD);
	        int plane  = data.GetLong(C4dApi.PRIM_PLANE);
	        return SwapPoint(new Vector3D(rad,0.0,0.0),plane);
        }
コード例 #4
0
        protected bool allocBonesInBones(string mainname, string bonename, BaseObject parent, double3 vec = new double3(), double3 vecMulti = new double3(), double3 vecBone = new double3(), double3 vecBoneMulti = new double3(), long counter = 0)
        {
            int KnochenLinks;
            int bone = (int)counter;

            if (bone != 0)
            {
                while (bone != 0)
                {
                    BaseObject jointBone = this.allocJoint(mainname + "_" + bone, parent, new double3(vec.x += vecMulti.x, vec.y += vecMulti.y, vec.z += vecMulti.z));
                    //BaseObject jointBone = this.allocJoint(mainname +"_"+ bone, parent, new double3(vec.x, vec.y, vec.z + bone_z));
                    this.wtag.AddJoint(jointBone);

                    if (bone == 1)
                    {
                        KnochenLinks = 2;
                    }
                    else
                    {
                        KnochenLinks = 3;
                    }

                    while (KnochenLinks != 0)
                    {
                        jointBone = this.allocJoint(bonename + "_" + KnochenLinks, jointBone, new double3(vecBone.x += vecBoneMulti.x, vecBone.y += vecBoneMulti.y, vecBone.z += vecBoneMulti.z));
                        this.wtag.AddJoint(jointBone);
                        KnochenLinks--;
                    }
                    bone--;
                }
            }
            return true;
        }
コード例 #5
0
ファイル: Character.cs プロジェクト: pr1m3c0d3/Fusee
        protected bool allocBonesInBones(string mainname, string bonename, BaseObject parent, Vector3D vec = new Vector3D(), Vector3D vecMulti = new Vector3D(), Vector3D vecBone = new Vector3D(), Vector3D vecBoneMulti = new Vector3D(), long counter = 0)
        {
            int KnochenLinks;
            int bone = (int)counter;

            if (bone != 0)
            {
                while (bone != 0)
                {
                    BaseObject jointBone = this.allocJoint(mainname + "_" + bone, parent, new Vector3D(vec.X += vecMulti.X, vec.Y += vecMulti.Y, vec.Z += vecMulti.Z));
                    //BaseObject jointBone = this.allocJoint(mainname +"_"+ bone, parent, new Vector3D(vec.X, vec.Y, vec.Z + bone_z));
                    this.wtag.AddJoint(jointBone);

                    if (bone == 1)
                    {
                        KnochenLinks = 2;
                    }
                    else
                    {
                        KnochenLinks = 3;
                    }

                    while (KnochenLinks != 0)
                    {
                        jointBone = this.allocJoint(bonename + "_" + KnochenLinks, jointBone, new Vector3D(vecBone.X += vecBoneMulti.X, vecBone.Y += vecBoneMulti.Y, vecBone.Z += vecBoneMulti.Z));
                        this.wtag.AddJoint(jointBone);
                        KnochenLinks--;
                    }
                    bone--;
                }
            }
            return true;
        }
コード例 #6
0
 public override int DetectHandle(BaseObject op, BaseDraw bd, int x, int y, QUALIFIER qualifier)
 {
     if (0 != (qualifier & QUALIFIER.QUALIFIER_CTRL))
         return -1;
     double4x4 mg = op.GetMg();
     if (bd.PointInRange(mg * GetRTHandle(op,0),x,y))
         return 0; // OK
     return -1; // Not OK
 }
コード例 #7
0
        private List<SceneObjectContainer> FuseefyOb(BaseObject ob)
        {
            if (ob == null)
                return null;

            List<SceneObjectContainer> ret = new List<SceneObjectContainer>();
            do
            {
                SceneObjectContainer soc = new SceneObjectContainer();

                double4x4 mtxD = ob.GetMl();
                soc.Transform = (float4x4) mtxD;
                PolygonObject polyOb = ob as PolygonObject;
                if (polyOb != null)
                {
                    /*double3  padr = ToPoly(op)->GetPointR();
                    CPolygon vadr = ToPoly(op)->GetPolygonR();*/
                    int nPolys = polyOb.GetPolygonCount();
                    ushort nNewVerts = 0;
                    List<float3> verts = new List<float3>();
                    List<ushort> tris = new List<ushort>();

                    for (int i = 0; i < nPolys; i++)
                    {
                        CPolygon poly = polyOb.GetPolygonAt(i);
                        double3 a = polyOb.GetPointAt(poly.a);
                        double3 b = polyOb.GetPointAt(poly.b);
                        double3 c = polyOb.GetPointAt(poly.c);
                        double3 d = polyOb.GetPointAt(poly.d);

                        verts.Add((float3)a);
                        verts.Add((float3)b);
                        verts.Add((float3)c);

                        tris.AddRange(new ushort[] {nNewVerts, (ushort)(nNewVerts+1), (ushort)(nNewVerts+2)});

                        if (c != d)
                        {
                            // The Polyogon is not only a triangle, but a quad. Add the second triangle.
                            verts.Add((float3)d);
                            tris.AddRange(new ushort[] { nNewVerts, (ushort)(nNewVerts + 2), (ushort)(nNewVerts + 3) });
                            nNewVerts += 1;
                        }
                        nNewVerts += 3;
                    }
                    soc.Mesh = new MeshContainer()
                    {
                        Vertices = verts.ToArray(),
                        Triangles = tris.ToArray(),
                    };
                }
                soc.Children = FuseefyOb(ob.GetDown());
                ret.Add(soc);
                ob = ob.GetNext();
            } while (ob != null);
            return ret;
        }
コード例 #8
0
ファイル: Character.cs プロジェクト: pr1m3c0d3/Fusee
 /**
  * Anlegen eines Joint Objekts
  * @param string Name des Joint Objekts
  * @param BaseObject Parent Joint, falls dieser gekuppelt werden soll
  * @param Vector3D Vektor in die der Joint zeigen soll
  * @return BaseObject Joint Objekt zurückgeben
  */
 protected BaseObject allocJoint(string name, BaseObject parentJoint = null, Vector3D vec = new Vector3D())
 {
     BaseObject myJoint = BaseObject.Alloc(C4dApi.Ojoint); // Speicher reservieren für den Joint
     myJoint.SetName(name); // Joint mit einem Namen versehen
     if (parentJoint == null)
     {
         parentJoint = this.myMesh;
     }
     this.doc.InsertObject(myJoint, parentJoint, null); // Kuppeln der Joints
     myJoint.SetAbsPos(vec); // Richtung vorgeben
     return myJoint;
 }
コード例 #9
0
ファイル: ObjectData.cs プロジェクト: KilledChicken/Fusee
  public virtual void GetModelingAxis(BaseObject op, BaseDocument doc, ref Fusee.Math.Core.Matrix4D /* Matrix*&_cstype */ axis) {
    double[] adbl_axis;
    unsafe {adbl_axis = Fusee.Math.ArrayConversion.Convert.Matrix4DToArrayDoubleC4DLayout(axis);    fixed (double *pdbl_axis = adbl_axis) {
    /* Matrix*&_csin_pre */
    try {
      C4dApiPINVOKE.ObjectData_GetModelingAxis(swigCPtr, BaseObject.getCPtr(op), BaseDocument.getCPtr(doc), (IntPtr) pdbl_axis /* Matrix*&_csin */);
    } finally {
        axis = Fusee.Math.ArrayConversion.Convert.ArrayDoubleC4DLayoutToMatrix4D(pdbl_axis);
        /* Matrix*&_csin_post */
    }
} } /* Matrix*&_csin_terminator */
  }
コード例 #10
0
ファイル: Hierarchy.cs プロジェクト: KilledChicken/Fusee
  public virtual bool Do(SWIGTYPE_p_void data, BaseObject op, ref Fusee.Math.Core.Matrix4D /* constMatrix&_cstype */ mg, bool controlobject) {
    double[] adbl_mg;
    unsafe {adbl_mg = Fusee.Math.ArrayConversion.Convert.Matrix4DToArrayDoubleC4DLayout(mg);    fixed (double *pdbl_mg = adbl_mg) {
    /* constMatrix&_csin_pre */
    try {
      bool ret = C4dApiPINVOKE.Hierarchy_Do(swigCPtr, SWIGTYPE_p_void.getCPtr(data), BaseObject.getCPtr(op), (IntPtr) pdbl_mg /* constMatrix&_csin */, controlobject);
      return ret;
    } finally {
        // NOP mg = Fusee.Math.ArrayConversion.Convert.ArrayDoubleC4DLayoutToMatrix4D(pdbl_mg);
        /* constMatrix&_csin_post */
    }
} } /* constMatrix&_csin_terminator */
  }
コード例 #11
0
        public override DRAWRESULT Draw(BaseObject op, DRAWPASS type, BaseDraw bd, BaseDrawHelp bh)
        {
            if (type!=DRAWPASS.DRAWPASS_HANDLES)
                return DRAWRESULT.DRAWRESULT_SKIP;

            int hitid = op.GetHighlightHandle(bd);

            double4x4 m = bh.GetMg();

            if (hitid==0)
                bd.SetPen(C4dApi.GetViewColor(C4dApi.VIEWCOLOR_SELECTION_PREVIEW));
            else
                bd.SetPen(C4dApi.GetViewColor(C4dApi.VIEWCOLOR_ACTIVEPOINT));

            // double3 zeroPos = new double3(0, 0, 0);
            bd.SetMatrix_Matrix(op, ref m);
            bd.DrawHandle(GetRTHandle(op, 0), DRAWHANDLE.DRAWHANDLE_BIG,0);
            bd.DrawLine(GetRTHandle(op, 0), new double3(0, 0, 0),0);

            return DRAWRESULT.DRAWRESULT_OK;
        }
コード例 #12
0
 protected BaseObject allocMirrorJoint(string name, BaseObject parentJoint, BaseObject mirrorJoint)
 {
     double3 vecparent = mirrorJoint.GetAbsPos();
     BaseObject myJoint = this.allocJoint(name, parentJoint, new double3(vecparent.x * -1, vecparent.y, vecparent.z));
     return myJoint;
 }
コード例 #13
0
        protected BaseObject[] allocBonesSwing(string mainname, BaseObject parent, long counter = 0, double3 vec = new double3())
        {
            int bone = (int)counter;
            bone -= 2;

            /*
             * Vor Swing joint
             */
            BaseObject myJoint = this.allocJoint(mainname, parent, new double3(vec.x, 0, 0));
            parent = myJoint;
            this.wtag.AddJoint(myJoint);

            /*
             * Swing einbauen
             */
            double temp = bone;
            bool change = false;
            while (bone > 0)
            {
                if (temp / 2 > bone && change == false)
                {
                    vec.y = 0;
                    change = true;
                }
                BaseObject jointBone = this.allocJoint(mainname + "_" + bone, parent, new double3(vec.x, vec.y, vec.z));
                this.wtag.AddJoint(jointBone);
                parent = jointBone;
                bone--;
            }

            // Nach Swing Joint
            BaseObject myJoint1 = this.allocJoint(mainname, parent, new double3(vec.x, 0, 0));
            this.wtag.AddJoint(myJoint1);
            // Array als rückgabe vorbereiten
            BaseObject[] arrJoint = { myJoint, myJoint1 };
            return arrJoint;
        }
コード例 #14
0
        private void AddFeet(BaseObject parentJoint, BaseObject mirrorJoint = null)
        {
            this.feet = this.b.GetLong(SKELETT_FUESSE);
            this.toes = this.b.GetLong(SKELETT_ZEHEN);
            this.legs = this.b.GetLong(SKELETT_BEINE);
            //this.tail = this.b.GetLong(SKELETT_SCHWANZ); (Animal Klasse)

            if (this.legs > 0)
            {
                BaseObject jointL_Leg = this.allocJoint("L_Leg", parentJoint, new double3(0, -100, 0));
                BaseObject jointL_Cnemials = this.allocJoint("L_Cnemials", jointL_Leg, new double3(0, -100, 0));
                BaseObject jointL_Foot = null;

                this.wtag.AddJoint(jointL_Leg);
                this.wtag.AddJoint(jointL_Cnemials);

                if (this.feet > 0)
                {
                    jointL_Foot = this.allocJoint("L_Foot", jointL_Cnemials, new double3(0, 0, -50));

                    if (this.toes > 0)
                    {
                        this.allocBonesInBones("L_Feet", "L_FeetBone", jointL_Foot, new double3(15, 0, -25), new double3(-5, 0, 0), new double3(0, 0, -5), new double3(0, 0, 0), this.toes);
                    }
                    this.wtag.AddJoint(jointL_Foot);
                }

                if (this.legs == 2)
                {
                    BaseObject jointR_Leg = this.allocMirrorJoint("R_Leg", mirrorJoint, jointL_Leg);
                    BaseObject jointR_Cnemials = this.allocMirrorJoint("R_Cnemials", jointR_Leg, jointL_Cnemials);
                    BaseObject jointR_Foot = null;

                    this.wtag.AddJoint(jointR_Leg);
                    this.wtag.AddJoint(jointR_Cnemials);

                    if (this.feet == 2)
                    {
                        jointR_Foot = this.allocMirrorJoint("R_Foot", jointR_Cnemials, jointL_Foot);
                        this.wtag.AddJoint(jointR_Foot);

                        if (this.toes > 0)
                        {
                            this.allocBonesInBones("R_Feet", "R_FeetBone", jointR_Foot, new double3(15, 0, -25), new double3(-5, 0, 0), new double3(0, 0, -5), new double3(0, 0, 0), this.toes);
                        }
                    }
                }
            }
        }
コード例 #15
0
        private void AddArms(BaseObject parentJoint, BaseObject mirrorJoint = null)
        {
            this.arms = this.b.GetLong(SKELETT_ARME);
            this.hands = this.b.GetLong(SKELETT_HAND);
            this.finger = this.b.GetLong(SKELETT_FINGER);

            if (this.arms > 0)
            {
                BaseObject jointL_Upperam = this.allocJoint("L_Upperarm", parentJoint, new double3(75, 0, 0));
                BaseObject jointL_Forearm = this.allocJoint("L_Forearm", jointL_Upperam, new double3(75, 0, 0));
                BaseObject jointL_Hand = null;

                this.wtag.AddJoint(jointL_Upperam);
                this.wtag.AddJoint(jointL_Forearm);

                if (this.hands > 0)
                {
                    jointL_Hand = this.allocJoint("L_Hand", jointL_Forearm, new double3(25, 0, 0));

                    if (this.finger > 0)
                    {
                        this.allocBonesInBones("L_Finger", "L_FingerBone", jointL_Hand, new double3(25, 0, 10), new double3(0, 0, -5), new double3(5, 0, 0), new double3(0, 0, 0), this.finger);
                    }
                    this.wtag.AddJoint(jointL_Hand);
                }

                if (this.arms == 2)
                {
                    BaseObject jointR_Upperarm = this.allocMirrorJoint("R_Upperarm", mirrorJoint, jointL_Upperam);
                    BaseObject jointR_Forearm = this.allocMirrorJoint("R_Forearm", jointR_Upperarm, jointL_Forearm);

                    this.wtag.AddJoint(jointR_Upperarm);
                    this.wtag.AddJoint(jointR_Forearm);

                    if (this.hands == 2)
                    {
                        BaseObject jointR_Hand = this.allocMirrorJoint("R_Hand", jointR_Forearm, jointL_Hand);
                        this.wtag.AddJoint(jointR_Hand);

                        if (this.finger > 0)
                        {
                            this.allocBonesInBones("R_Finger", "R_FingerBone", jointR_Hand, new double3(-25, 0, 10), new double3(0, 0, -5), new double3(-5, 0, 0), new double3(0, 0, 0), this.finger);
                        }
                    }
                }
            }
        }
コード例 #16
0
ファイル: RigPlugin.cs プロジェクト: KilledChicken/Fusee
 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");
                     }
                 }
             }
         }
     }
    
 }
コード例 #17
0
ファイル: BaseObject.cs プロジェクト: KilledChicken/Fusee
 public void SetOrigin(BaseObject origin) {
   C4dApiPINVOKE.BaseObject_SetOrigin(swigCPtr, BaseObject.getCPtr(origin));
 }
コード例 #18
0
ファイル: StickTextureTag.cs プロジェクト: pr1m3c0d3/Fusee
 public bool Record(BaseObject op, bool always) {
   bool ret = C4dApiPINVOKE.StickTextureTag_Record(swigCPtr, BaseObject.getCPtr(op), always);
   return ret;
 }
コード例 #19
0
ファイル: CAWeightTag.cs プロジェクト: KilledChicken/Fusee
 public int FindJoint(BaseObject op, BaseDocument doc) {
   int ret = C4dApiPINVOKE.CAWeightTag_FindJoint(swigCPtr, BaseObject.getCPtr(op), BaseDocument.getCPtr(doc));
   return ret;
 }
コード例 #20
0
ファイル: CAWeightTag.cs プロジェクト: KilledChicken/Fusee
 public void RemoveJoint(BaseObject op) {
   C4dApiPINVOKE.CAWeightTag_RemoveJoint(swigCPtr, BaseObject.getCPtr(op));
 }
コード例 #21
0
ファイル: CAWeightTag.cs プロジェクト: KilledChicken/Fusee
 public int AddJoint(BaseObject op) {
   int ret = C4dApiPINVOKE.CAWeightTag_AddJoint(swigCPtr, BaseObject.getCPtr(op));
   return ret;
 }
コード例 #22
0
ファイル: BaseObject.cs プロジェクト: KilledChicken/Fusee
 internal static HandleRef getCPtr(BaseObject obj) {
   return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }
コード例 #23
0
ファイル: BaseObject.cs プロジェクト: KilledChicken/Fusee
 public void AddDependence(HierarchyHelp hh, BaseObject op) {
   C4dApiPINVOKE.BaseObject_AddDependence(swigCPtr, HierarchyHelp.getCPtr(hh), BaseObject.getCPtr(op));
 }
コード例 #24
0
ファイル: BaseObject.cs プロジェクト: KilledChicken/Fusee
 public BaseObject GetHierarchyClone(HierarchyHelp hh, BaseObject op, HIERARCHYCLONEFLAGS flags, SWIGTYPE_p_Bool dirty, AliasTrans trans) {
   IntPtr cPtr = C4dApiPINVOKE.BaseObject_GetHierarchyClone(swigCPtr, HierarchyHelp.getCPtr(hh), BaseObject.getCPtr(op), (int)flags, SWIGTYPE_p_Bool.getCPtr(dirty), AliasTrans.getCPtr(trans));
   BaseObject ret = (cPtr == IntPtr.Zero) ? null : new BaseObject(cPtr, false);
   return ret;
 }
コード例 #25
0
ファイル: BaseObject.cs プロジェクト: KilledChicken/Fusee
 public bool CopyTagsTo(BaseObject dest, int visible, int variable, int hierarchical, AliasTrans trans) {
   bool ret = C4dApiPINVOKE.BaseObject_CopyTagsTo(swigCPtr, BaseObject.getCPtr(dest), visible, variable, hierarchical, AliasTrans.getCPtr(trans));
   return ret;
 }
コード例 #26
0
ファイル: BaseDraw.cs プロジェクト: pr1m3c0d3/Fusee
 public void SetSceneCamera(BaseObject op, bool animate) {
   C4dApiPINVOKE.BaseDraw_SetSceneCamera__SWIG_0(swigCPtr, BaseObject.getCPtr(op), animate);
 }
コード例 #27
0
 protected BaseObject allocMirrorJoint(string name, BaseObject parentJoint, BaseObject mirrorJoint)
 {
     Vector3D vecparent = mirrorJoint.GetAbsPos();
     BaseObject myJoint = this.allocJoint(name, parentJoint, new Vector3D(vecparent.X * -1, vecparent.Y, vecparent.Z));
     return myJoint;
 }
コード例 #28
0
ファイル: BaseDraw.cs プロジェクト: pr1m3c0d3/Fusee
 public void SetSceneCamera(BaseObject op) {
   C4dApiPINVOKE.BaseDraw_SetSceneCamera__SWIG_1(swigCPtr, BaseObject.getCPtr(op));
 }
コード例 #29
0
ファイル: BaseObject.cs プロジェクト: KilledChicken/Fusee
 public bool SearchHierarchy(BaseObject op) {
   bool ret = C4dApiPINVOKE.BaseObject_SearchHierarchy(swigCPtr, BaseObject.getCPtr(op));
   return ret;
 }
コード例 #30
0
ファイル: BaseObject.cs プロジェクト: KilledChicken/Fusee
   } /* </Matrix_csout> */ 

  public void CopyMatrixTo(BaseObject dst) {
    C4dApiPINVOKE.BaseObject_CopyMatrixTo(swigCPtr, BaseObject.getCPtr(dst));
  }