1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- import bpy, numpy
- class MessageBox(bpy.types.Operator):
- bl_idname = "message.messagebox"
- bl_label = "INFORMATION:"
- message = bpy.props.StringProperty(
- name = "message",
- description = "message",
- default = ''
- )
-
- def execute(self, context):
- return {'FINISHED'}
- def invoke(self, context, event):
- return context.window_manager.invoke_props_dialog(self, width = 400)
- def draw(self, context):
- self.layout.label("")
- self.layout.label(self.message)
- self.layout.label("")
-
- bpy.utils.register_class(MessageBox)
- def disp_msg(string):
- print(string)
- bpy.ops.message.messagebox('INVOKE_DEFAULT', message = string)
- def select_obj(scene, obj, recursive):
-
-
- bpy.ops.object.select_all(action='DESELECT')
- scene.objects.active = None
- obj.select = True
- scene.objects.active = obj
-
-
- if (recursive == True):
- bpy.ops.object.select_grouped(type = 'CHILDREN_RECURSIVE')
- obj.select = True
- def transf_apply_recurse(scene, obj, loc, rot, sca):
-
-
- select_obj(scene, obj, False)
- bpy.ops.object.transform_apply(location = loc, rotation = rot, scale = sca)
-
-
- if (len(obj.children) != 0):
- for child in obj.children:
-
- select_obj(scene, child, False)
- bpy.ops.object.transform_apply(location = loc, rotation = rot, scale = sca)
-
-
- select_obj(scene, obj, False)
- def set_bone_bind_mat(bone, mat):
-
-
- temp_array = [mat[0][0], mat[1][0], mat[2][0], mat[3][0],
- mat[0][1], mat[1][1], mat[2][1], mat[3][1],
- mat[0][2], mat[1][2], mat[2][2], mat[3][2],
- mat[0][3], mat[1][3], mat[2][3], mat[3][3]]
-
- temp_array = numpy.array(temp_array, dtype = 'f')
- bone["bind_mat"] = temp_array
-
-
- return
- def set_bone_rest_mat(bone, mat):
-
-
- temp_array = [mat[0][0], mat[1][0], mat[2][0], mat[3][0],
- mat[0][1], mat[1][1], mat[2][1], mat[3][1],
- mat[0][2], mat[1][2], mat[2][2], mat[3][2],
- mat[0][3], mat[1][3], mat[2][3], mat[3][3]]
-
- temp_array = numpy.array(temp_array, dtype = 'f')
- bone["rest_mat"] = temp_array
-
-
- return
|