OSDN Git Service

implement vertex attributes
[meshio/pymeshio.git] / blender26-meshio / bl.py
index c7353ec..c668fa0 100644 (file)
@@ -242,6 +242,8 @@ class object:
 
     @staticmethod
     def assignVertexGroup(o, name, index, weight):
+        if name not in o.vertex_groups:
+            o.vertex_groups.new(name)
         o.vertex_groups[name].add([index], weight, 'ADD')
 
     @staticmethod
@@ -255,6 +257,7 @@ class object:
         g=pose.bone_groups.active
         g.name=name
         g.color_set=color_set
+        return g
 
     @staticmethod
     def boneGroups(o):
@@ -595,15 +598,17 @@ class armature:
         bpy.ops.object.mode_set(mode='EDIT', toggle=False)
 
     @staticmethod
-    def createIkConstraint(armature_object, p_bone, effector_name, ik):
+    def createIkConstraint(armature_object, p_bone, effector_name, 
+            chain, weight, iterations):
         constraint = p_bone.constraints.new('IK')
-        constraint.chain_count=len(ik.children)
+        constraint.chain_count=len(chain)
         constraint.target=armature_object
         constraint.subtarget=effector_name
         constraint.use_tail=False
+        # ToDo
         # not used. place folder when export.
-        constraint.weight=ik.weight
-        constraint.iterations=ik.iterations * 10
+        #constraint.weight=weight
+        #constraint.iterations=iterations * 10
         return constraint
 
     @staticmethod