当前位置: 首页>>代码示例>>Python>>正文


Python Quaternion.to_matrix方法代码示例

本文整理汇总了Python中mathutils.Quaternion.to_matrix方法的典型用法代码示例。如果您正苦于以下问题:Python Quaternion.to_matrix方法的具体用法?Python Quaternion.to_matrix怎么用?Python Quaternion.to_matrix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mathutils.Quaternion的用法示例。


在下文中一共展示了Quaternion.to_matrix方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: loadMhpFile

# 需要导入模块: from mathutils import Quaternion [as 别名]
# 或者: from mathutils.Quaternion import to_matrix [as 别名]
def loadMhpFile(context, filepath):
    ob = context.object
    rig = ob.parent
    scn = context.scene
    if rig and rig.type == 'ARMATURE':
        (pname, ext) = os.path.splitext(filepath)
        mhppath = pname + ".mhp"
        
        fp = open(mhppath, "rU")
        for line in fp:
            words = line.split()
            if len(words) < 5:
                continue
            elif words[1] == "quat":
                q = Quaternion((float(words[2]), float(words[3]), float(words[4]), float(words[5])))
                mat = q.to_matrix().to_4x4()
                pb = rig.pose.bones[words[0]]
                pb.matrix_basis = mat
            elif words[1] == "gquat":
                q = Quaternion((float(words[2]), float(words[3]), float(words[4]), float(words[5])))
                mat = q.to_matrix().to_4x4()
                maty = mat[1].copy()
                matz = mat[2].copy()
                mat[1] = -matz
                mat[2] = maty
                pb = rig.pose.bones[words[0]]
                pb.matrix_basis = pb.bone.matrix_local.inverted() * mat
        fp.close()
        print("Mhp file %s loaded" % mhppath)
开发者ID:Iffar,项目名称:makehuman_datagen,代码行数:31,代码来源:pose.py

示例2: execute

# 需要导入模块: from mathutils import Quaternion [as 别名]
# 或者: from mathutils.Quaternion import to_matrix [as 别名]
 def execute(self, context):
     selected = bpy.context.selected_objects
     obj = selected[-1]
     surf = bpy.context.scene.objects['surface']
     
     loc = bpy.context.scene.cursor_location
     
     bvh = BVHTree.FromObject(surf, bpy.context.scene)
     
     loc = surf.matrix_world.inverted() * loc
     (loc, normal, index, dist) = bvh.find_nearest(loc)
     if self.use_smooth:
         normal = smooth_normal(surf, loc, index)
     loc = surf.matrix_world * loc
     
     bpy.ops.object.duplicate()
     new_obj = bpy.context.selected_objects[-1]
     
     (unused, surf_rot, unused) = surf.matrix_world.decompose()
     (unused, obj_rot, scale) = obj.matrix_world.decompose()
     
     normal = surf_rot * normal
     vec = obj_rot * Vector((0.0, 0.0, 1.0))
     
     q = vec.rotation_difference(normal)
     q = Quaternion().slerp(q, self.align_with_normal)
     mat_scale = Matrix()
     for i in range(3): mat_scale[i][i] = scale[i]
     new_obj.matrix_world = (Matrix.Translation(loc) *
         q.to_matrix().to_4x4() * obj_rot.to_matrix().to_4x4() *
         mat_scale)
     
     bpy.context.scene.objects.active = new_obj
     
     return {'FINISHED'}
开发者ID:sadaszewski,项目名称:blender-addons,代码行数:37,代码来源:object_place_on_surface.py

示例3: loadTPose

# 需要导入模块: from mathutils import Quaternion [as 别名]
# 或者: from mathutils.Quaternion import to_matrix [as 别名]
def loadTPose(rig, filename):
    if filename:
        filepath = os.path.join(os.path.dirname(__file__), filename)
        filepath = os.path.normpath(filepath)
        print("Loading %s" % filepath)
        struct = loadJson(filepath)
        rig.McpTPoseFile = filename
    else:
        return False

    unit = Matrix()
    for pb in rig.pose.bones:
        pb.matrix_basis = unit

    for name,value in struct:
        bname = getBoneName(rig, name)
        try:
            pb = rig.pose.bones[bname]
        except KeyError:
            continue
        quat = Quaternion(value)
        pb.matrix_basis = quat.to_matrix().to_4x4()
        setBoneTPose(pb, quat)

    rig.McpTPoseLoaded = True
    rig.McpRestTPose = False
    return True
开发者ID:jultrunb,项目名称:ass,代码行数:29,代码来源:t_pose.py

示例4: calc_pose_mats

# 需要导入模块: from mathutils import Quaternion [as 别名]
# 或者: from mathutils.Quaternion import to_matrix [as 别名]
def calc_pose_mats(iqmodel, iqpose, bone_axis):
	loc_pose_mat = [None] * len(iqmodel.bones)
	abs_pose_mat = [None] * len(iqmodel.bones)
	recalc = False

	# convert pose to local matrix and compute absolute matrix
	for n in range(len(iqmodel.bones)):
		iqbone = iqmodel.bones[n]

		pose_pos = iqpose[n].translate
		pose_rot = iqpose[n].rotate
		pose_scale = iqpose[n].scale

		local_pos = Vector(pose_pos)
		local_rot = Quaternion((pose_rot[3], pose_rot[0], pose_rot[1], pose_rot[2]))
		local_scale = Vector(pose_scale)

		mat_pos = Matrix.Translation(local_pos)
		mat_rot = local_rot.to_matrix().to_4x4()
		mat_scale = Matrix.Scale(local_scale.x, 3).to_4x4()
		loc_pose_mat[n] = mat_pos * mat_rot * mat_scale

		if iqbone.parent >= 0:
			abs_pose_mat[n] = abs_pose_mat[iqbone.parent] * loc_pose_mat[n]
		else:
			abs_pose_mat[n] = loc_pose_mat[n]

	# Remove negative scaling from bones.
	# Due to numerical instabilities in blender's matrix <-> head/tail/roll math
	# this isn't always stable when the bones are in the X axis. If the bones
	# end up rotated 90 degrees from what they should be, that's the reason.
	for n in range(len(iqmodel.bones)):
		if abs_pose_mat[n].is_negative:
			if not hasattr(iqmodel, 'abs_bind_mat'):
				print("warning: removing negative scale in bone", iqmodel.bones[n].name)
			abs_pose_mat[n] = abs_pose_mat[n] * Matrix.Scale(-1, 4)
			recalc = True

	# flip bone axis (and recompute local matrix if needed)
	if bone_axis == 'X':
		axis_flip = Matrix.Rotation(math.radians(-90), 4, 'Z')
		abs_pose_mat = [m * axis_flip for m in abs_pose_mat]
		recalc = True
	if bone_axis == 'Z':
		axis_flip = Matrix.Rotation(math.radians(-90), 4, 'X')
		abs_pose_mat = [m * axis_flip for m in abs_pose_mat]
		recalc = True

	if recalc:
		inv_pose_mat = [m.inverted() for m in abs_pose_mat]
		for n in range(len(iqmodel.bones)):
			iqbone = iqmodel.bones[n]
			if iqbone.parent >= 0:
				loc_pose_mat[n] = inv_pose_mat[iqbone.parent] * abs_pose_mat[n]
			else:
				loc_pose_mat[n] = abs_pose_mat[n]

	return loc_pose_mat, abs_pose_mat
开发者ID:uthaman22,项目名称:asstools,代码行数:60,代码来源:iqe_import.py

示例5: change_to_scs_quaternion_coordinates

# 需要导入模块: from mathutils import Quaternion [as 别名]
# 或者: from mathutils.Quaternion import to_matrix [as 别名]
def change_to_scs_quaternion_coordinates(rot):
    """Transposes quaternion rotation from Blender to SCS game engine.

    :param rot: Blender quaternion (or four floats)
    :type rot: Quaternion | list | tuple
    :return: Transposed quaternion rotation
    :rtype: Quaternion
    """
    quat = Quaternion((rot[0], rot[1], rot[2], rot[3]))
    return (scs_to_blend_matrix().inverted() * quat.to_matrix().to_4x4() * scs_to_blend_matrix()).to_quaternion()
开发者ID:P-casper1,项目名称:BlenderTools,代码行数:12,代码来源:convert.py

示例6: exportParticles

# 需要导入模块: from mathutils import Quaternion [as 别名]
# 或者: from mathutils.Quaternion import to_matrix [as 别名]
def exportParticles(context, emitter, psys, oct_t):
	"""Exports a particle system for the specified emitter"""
	octane = context.scene.octane_render
	export_path = bpath.abspath(octane.path)
	pset = psys.settings
	infostr = "Exporting PS '%s' (%s) on emitter '%s'" % (psys.name, pset.type, emitter.name)
	particles = [p for p in psys.particles] if pset.type == 'HAIR' else [p for p in psys.particles if p.alive_state == 'ALIVE']
	
	if pset.render_type == "OBJECT":
		dupli_ob = pset.dupli_object
		if dupli_ob is not None and octane.instances_write_dupli:
			info(infostr + " with %i instances of '%s' objects" % (len(particles), dupli_ob.name))
			filepath = "".join([bpath.abspath(octane.path), dupli_ob.name])
			info("Writing dupli object to file '%s'" % (filepath + ".obj"))
			dupli_world = dupli_ob.matrix_world.copy()
			transl_inv = Matrix.Translation(-dupli_world.translation)
			dupli_ob.matrix_world = transl_inv * dupli_ob.matrix_world
			writeDupliObjects(context, [dupli_ob], filepath)
			dupli_ob.matrix_world = dupli_world
#			
#	elif pset.render_type == "GROUP":
#		duplig = pset.dupli_group
#		if duplig is not None:
#			objects = duplig.objects
#			infostr += " with %i instances from group '%s'" % (len(particles), duplig.name)
#			info(infostr + " {0}".format([o.name for o in objects]))
#			# TODO: separate group scatter per object
	else:
		warning("Invalid PS visualization type '%s'" % pset.render_type)
		return
	if not pset.use_rotation_dupli:
		warning("'Use object rotation' should be on. Rotations wont conform to Blender veiwport")
	
	try:
		fh = open(export_path + psys.name + ".csv", "w")
		for p in particles:
			#if pset.type == 'HAIR' or not p.alive_state == 'DEAD':
			if (pset.type == "HAIR"):
				loc = Matrix.Translation(p.hair_keys[0].co)
				scale = Matrix.Scale(p.size, 4) * Matrix.Scale(pset.hair_length, 4)
			else:
				loc = Matrix.Translation(p.location)
				scale = Matrix.Scale(p.size, 4)
			rot = Quaternion.to_matrix(p.rotation).to_4x4()
			t = loc * rot * scale
			t = emitter.matrix_world * t if pset.type == "HAIR" else t
			t = oct_t[0] * t * oct_t[1]
			writeTransform(t, fh)
		fh.close()
	except IOError as err:
		msg = "IOError during file handling '{0}'".format(err)
		error(msg)
		raise ExportException(msg)
开发者ID:foremancr,项目名称:blenderpython,代码行数:55,代码来源:octinstances.py

示例7: setTPose

# 需要导入模块: from mathutils import Quaternion [as 别名]
# 或者: from mathutils.Quaternion import to_matrix [as 别名]
def setTPose(context):
    rig = context.object
    scn = context.scene
    if not rig.McpHasTPose:
        print(("%s has no defined T-pose" % rig))

    quat = Quaternion((1,0,0,0))
    mat = quat.to_matrix().to_4x4()
    for pb in rig.pose.bones:
        try:
            qw = pb["McpRestW"]
        except KeyError:
            continue
        pb.matrix_basis = mat
    print("Set T-pose")
开发者ID:ihavenick,项目名称:MakeHuman,代码行数:17,代码来源:t_pose.py

示例8: clearTPose

# 需要导入模块: from mathutils import Quaternion [as 别名]
# 或者: from mathutils.Quaternion import to_matrix [as 别名]
def clearTPose(context):
    rig = context.object
    scn = context.scene
    if not rig.McpHasTPose:
        print(("%s has no defined T-pose" % rig))

    for pb in rig.pose.bones:
        try:
            qw = pb["McpRestW"]
            qx = pb["McpRestX"]
            qy = pb["McpRestY"]
            qz = pb["McpRestZ"]
        except KeyError:
            continue
        quat = Quaternion((qw,qx,qy,qz))
        pb.matrix_basis = quat.to_matrix().to_4x4()
    print("Cleared T-pose")
开发者ID:ihavenick,项目名称:MakeHuman,代码行数:19,代码来源:t_pose.py

示例9: bake_path_offsets

# 需要导入模块: from mathutils import Quaternion [as 别名]
# 或者: from mathutils.Quaternion import to_matrix [as 别名]
def bake_path_offsets(context, cu_path, ob, action, specials):
    """ bake path offsets into an action """
    channels = get_bone_channels(action)
    channels = topmost_level(channels, ob, specials)
    limits = (int(action.frame_range[0]), 2  + int(action.frame_range[1]))
    values = evaluate_curves(channels, limits)
    zero_offset = get_path_offset(context, cu_path, ob, 0).copy()
    for bone, groups in channels.items():

        for data_path, curves in groups.items():
            data = [(cu.data_path, cu.array_index, cu.group.name) for cu in curves]
            while curves:
                cu = curves.pop(-1)
                action.fcurves.remove(cu)
            for datum in data:
                cu = action.fcurves.new(datum[0], datum[1], datum[2])
                curves.append(cu)
    for frame in range(limits[0], limits[1]):
        context.scene.frame_set(frame)
        current_offset = ob.matrix_world
        print(ob.name, current_offset.to_translation() , zero_offset.to_translation())
        for bone, groups in channels.items():
            for transforms in 'location', 'rotation_quaternion':
                if 'location' in groups:
                    old_loc = values[bone]['location'][frame - limits[0]]
                else:
                    old_loc = Vector((0,0,0))
                if 'rotation_quaternion' in groups:
                    old_rot = Quaternion(values[bone]['rotation_quaternion'][frame - limits[0]])
                else:
                    old_rot = Quaternion((1, 0, 0, 0))
            old_trans = Matrix.Translation(old_loc).to_4x4() * old_rot.to_matrix().to_4x4()
            rest_mat = ob.data.bones[bone].matrix_local
            old_trans_world = current_offset * rest_mat * old_trans
            new_trans =\
                rest_mat.inverted() * zero_offset.inverted() * old_trans_world
            new_loc, new_rot, sca = new_trans.decompose()
            for group, curves in groups.items():
                for array_index, curve in enumerate(curves):
                    if curve.data_path.endswith('location'):
                        insert_keyframe_curve(
                            curve, frame, new_loc[array_index], 'LINEAR')
                    else:
                        insert_keyframe_curve(
                            curve, frame, new_rot[array_index], 'LINEAR')
开发者ID:Cx-01,项目名称:myblendercontrib,代码行数:47,代码来源:depath.py

示例10: createTPose

# 需要导入模块: from mathutils import Quaternion [as 别名]
# 或者: from mathutils.Quaternion import to_matrix [as 别名]
def createTPose(context):
    rig = context.object
    scn = context.scene
    if rig.McpHasTPose:
        setTPose(context)
        return

    filepath = os.path.join(os.path.dirname(__file__), "t_pose.json")
    struct = loadJson(filepath)

    for name,value in struct:
        pb = rig.pose.bones[name]
        quat = Quaternion(value)
        pb.matrix_basis = quat.to_matrix().to_4x4()
        rest = quat.inverted()
        pb["McpRestW"] = rest.w
        pb["McpRestX"] = rest.x
        pb["McpRestY"] = rest.y
        pb["McpRestZ"] = rest.z

    children = []
    for ob in scn.objects:
        if ob.type != 'MESH':
            continue
        for mod in ob.modifiers:
            if (mod.type == 'ARMATURE' and
                mod.object == rig):
                children.append((ob, mod.name))
                scn.objects.active = ob
                bpy.ops.object.modifier_apply(apply_as='SHAPE', modifier=mod.name)
                ob.data.shape_keys.key_blocks[mod.name].value = 1

    scn.objects.active = rig
    bpy.ops.pose.armature_apply()
    for ob,name in children:
        scn.objects.active = ob
        mod = ob.modifiers.new(name, 'ARMATURE')
        mod.object = rig
        mod.use_vertex_groups = True
        bpy.ops.object.modifier_move_up(modifier=name)
        setShapeKey(ob, name, 1.0)

    scn.objects.active = rig
    rig.McpHasTPose = True
    print("Created T-pose")
开发者ID:ihavenick,项目名称:MakeHuman,代码行数:47,代码来源:t_pose.py

示例11: getmatrix

# 需要导入模块: from mathutils import Quaternion [as 别名]
# 或者: from mathutils.Quaternion import to_matrix [as 别名]
	def getmatrix(self):

		# Rotating / panning / zooming 3D view is handled here.
		# Get matrix.
		if self.selobj.rotation_mode == 'AXIS_ANGLE':
			# when roataion mode is axisangle
			angle, x, y, z =  self.selobj.rotation_axis_angle
			self.matrix = Matrix.Rotation(-angle, 4, Vector((x, y, z)))
		elif self.selobj.rotation_mode == 'QUATERNION':
			# when rotation on object is quaternion
			w, x, y, z = self.selobj.rotation_quaternion
			x = -x
			y = -y
			z = -z
			quat = Quaternion([w, x, y, z])
			self.matrix = quat.to_matrix()
			self.matrix.resize_4x4()
		else:
			# when rotation of object is euler
			ax, ay, az = self.selobj.rotation_euler
			mat_rotX = Matrix.Rotation(-ax, 4, 'X')
			mat_rotY = Matrix.Rotation(-ay, 4, 'Y')
			mat_rotZ = Matrix.Rotation(-az, 4, 'Z')
		if self.selobj.rotation_mode == 'XYZ':
			self.matrix = mat_rotX * mat_rotY * mat_rotZ
		elif self.selobj.rotation_mode == 'XZY':
			self.matrix = mat_rotX * mat_rotZ * mat_rotY
		elif self.selobj.rotation_mode == 'YXZ':
			self.matrix = mat_rotY * mat_rotX * mat_rotZ
		elif self.selobj.rotation_mode == 'YZX':
			self.matrix = mat_rotY * mat_rotZ * mat_rotX
		elif self.selobj.rotation_mode == 'ZXY':
			self.matrix = mat_rotZ * mat_rotX * mat_rotY
		elif self.selobj.rotation_mode == 'ZYX':
			self.matrix = mat_rotZ * mat_rotY * mat_rotX

		# handle object scaling
		sx, sy, sz = self.selobj.scale
		mat_scX = Matrix.Scale(sx, 4, Vector([1, 0, 0]))
		mat_scY = Matrix.Scale(sy, 4, Vector([0, 1, 0]))
		mat_scZ = Matrix.Scale(sz, 4, Vector([0, 0, 1]))
		self.matrix = mat_scX * mat_scY * mat_scZ * self.matrix
开发者ID:Cx-01,项目名称:myblendercontrib,代码行数:44,代码来源:mesh_edgegrow.py

示例12: importSkeletonPiece

# 需要导入模块: from mathutils import Quaternion [as 别名]
# 或者: from mathutils.Quaternion import to_matrix [as 别名]
def importSkeletonPiece(skel, tree, piece, parentName, depth=0):
    bone = skel.edit_bones.new(piece.name)
    track = piece.trackRef.Reference
    trans = Vector(track.translation())
    rot = Quaternion(track.rotation())
    mTrans = Matrix.Translation(trans)
    mRot = rot.to_matrix()
    mRot.resize_4x4()
    if parentName:
        parent = skel.edit_bones[parentName]
        bone.parent = parent
        bone.head = parent.tail
        bone.use_connect = False
        m = parent.matrix.copy()
    else:
        bone.head = (0, 0, 0)
        m = Matrix()
    m = m * mTrans
    m = m * mRot
    bone.tail = transform(m, bone.head)
    # recursively import the children bones
    for childID in piece.children:
        importSkeletonPiece(skel, tree, tree[childID], piece.name, depth+1)
开发者ID:pixelbound,项目名称:equilibre,代码行数:25,代码来源:wld_bpy.py

示例13: drawBone2

# 需要导入模块: from mathutils import Quaternion [as 别名]
# 或者: from mathutils.Quaternion import to_matrix [as 别名]
def drawBone2(p1, p2, radiuses, material):
  length = dist(p1,p2)
  print('length :',length)
  v = Vector(diffv(p1, p2))
  up = Vector((0,0,1))
  if v!=-up:
    rot = up.rotation_difference(v)
  else:
    rot = Quaternion((1,0,0),math.pi)
  s1 = drawEllipsoid((0,0,-0.5*length),radiuses,material)
  s2 = drawEllipsoid((0,0,0.5*length),radiuses,material)
  c1 = drawCylinder(zero,radiuses,length,materials.blue)
  s1.select = True
  s2.select = True
  c1.select = True
  #bpy.ops.transform.translate(value=(0,0,length/2))
  #bpy.ops.object.editmode_toggle()
  bpy.ops.transform.rotate(value=rot.angle, axis=rot.axis)
  #bpy.ops.object.editmode_toggle()
  #bpy.ops.transform.translate(value=Vector((0,0,-0.5*length))*rot.to_matrix())
  rot.normalize();
  bpy.ops.transform.translate(value=Vector((0,0,0.5*length))*rot.to_matrix())
  bpy.ops.transform.translate(value=p1)
  return (s1,s2,c1)
开发者ID:willcode4fun,项目名称:scriptools,代码行数:26,代码来源:character.py

示例14: getStoredBonePose

# 需要导入模块: from mathutils import Quaternion [as 别名]
# 或者: from mathutils.Quaternion import to_matrix [as 别名]
def getStoredBonePose(pb):
    try:
        quat = Quaternion((pb.McpQuatW, pb.McpQuatX, pb.McpQuatY, pb.McpQuatZ))
    except KeyError:
        quat = Quaternion()
    return quat.to_matrix().to_4x4()
开发者ID:jultrunb,项目名称:ass,代码行数:8,代码来源:t_pose.py

示例15: SelProject

# 需要导入模块: from mathutils import Quaternion [as 别名]
# 或者: from mathutils.Quaternion import to_matrix [as 别名]

#.........这里部分代码省略.........
			self.obT.location = self.originobT
			self.bmF.free()
			self.bmT.free()
			for obj in self.oldobjlist:
				obj.select = True
			self.scn.objects.active = self.oldobj
			bpy.types.SpaceView3D.draw_handler_remove(self._handle, 'WINDOW')
			if self.oldmode == 'EDIT':
				bpy.ops.object.editmode_toggle()
			return {'CANCELLED'}

		elif event.type in {'LEFTMOUSE', 'MIDDLEMOUSE', 'RIGHTMOUSE', 'WHEELDOWNMOUSE', 'WHEELUPMOUSE', 'G', 'S', 'R', 'X', 'Y', 'Z', 'MOUSEMOVE'}:
			context.region.tag_redraw()
			return {'PASS_THROUGH'}

		return {'RUNNING_MODAL'}


	def getmatrix(self, selobj):

		# Rotating / panning / zooming 3D view is handled here.
		# Creates a matrix.
		if selobj.rotation_mode == 'AXIS_ANGLE':
			# object rotation_quaternionmode axisangle
			ang, x, y, z =  selobj.rotation_axis_angle
			matrix = Matrix.Rotation(-ang, 4, Vector((x, y, z)))
		elif selobj.rotation_mode == 'QUATERNION':
			# object rotation_quaternionmode euler
			w, x, y, z = selobj.rotation_quaternion
			x = -x
			y = -y
			z = -z
			self.quat = Quaternion([w, x, y, z])
			matrix = self.quat.to_matrix()
			matrix.resize_4x4()
		else:
			# object rotation_quaternionmode euler
			ax, ay, az = selobj.rotation_euler
			mat_rotX = Matrix.Rotation(-ax, 4, 'X')
			mat_rotY = Matrix.Rotation(-ay, 4, 'Y')
			mat_rotZ = Matrix.Rotation(-az, 4, 'Z')
		if selobj.rotation_mode == 'XYZ':
			matrix = mat_rotX * mat_rotY * mat_rotZ
		elif selobj.rotation_mode == 'XZY':
			matrix = mat_rotX * mat_rotZ * mat_rotY
		elif selobj.rotation_mode == 'YXZ':
			matrix = mat_rotY * mat_rotX * mat_rotZ
		elif selobj.rotation_mode == 'YZX':
			matrix = mat_rotY * mat_rotZ * mat_rotX
		elif selobj.rotation_mode == 'ZXY':
			matrix = mat_rotZ * mat_rotX * mat_rotY
		elif selobj.rotation_mode == 'ZYX':
			matrix = mat_rotZ * mat_rotY * mat_rotX

		# handle object scaling
		sx, sy, sz = selobj.scale
		mat_scX = Matrix.Scale(sx, 4, Vector([1, 0, 0]))
		mat_scY = Matrix.Scale(sy, 4, Vector([0, 1, 0]))
		mat_scZ = Matrix.Scale(sz, 4, Vector([0, 0, 1]))
		matrix = mat_scX * mat_scY * mat_scZ * matrix

		return matrix


	def getscreencoords(self, vector):
		# calculate screencoords of given Vector
开发者ID:Cx-01,项目名称:myblendercontrib,代码行数:70,代码来源:mesh_selproject.py


注:本文中的mathutils.Quaternion.to_matrix方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。