本文整理汇总了Python中bpy_extras.io_utils.axis_conversion方法的典型用法代码示例。如果您正苦于以下问题:Python io_utils.axis_conversion方法的具体用法?Python io_utils.axis_conversion怎么用?Python io_utils.axis_conversion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bpy_extras.io_utils
的用法示例。
在下文中一共展示了io_utils.axis_conversion方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: execute
# 需要导入模块: from bpy_extras import io_utils [as 别名]
# 或者: from bpy_extras.io_utils import axis_conversion [as 别名]
def execute(self, context):
keywords = self.as_keywords(ignore=('filter_glob',))
mesh = load(self, context, **keywords)
if not mesh:
return {'CANCELLED'}
scene = bpy.context.scene
obj = bpy.data.objects.new(mesh.name, mesh)
scene.objects.link(obj)
scene.objects.active = obj
obj.select = True
obj.matrix_world = axis_conversion(from_forward='-Z', from_up='Y').to_4x4()
scene.update()
return {'FINISHED'}
示例2: savecob
# 需要导入模块: from bpy_extras import io_utils [as 别名]
# 或者: from bpy_extras.io_utils import axis_conversion [as 别名]
def savecob(operator, context, filepath, triangulate, check_existing):
print("exporting", filepath)
global_matrix = axis_conversion(to_forward='-Z', to_up='Y').to_4x4()
scene = context.scene
obj = scene.objects.active
mesh = obj.to_mesh(scene, True, 'PREVIEW')
mesh.transform(global_matrix * obj.matrix_world) # inverse transformation
if triangulate or any([len(face.vertices) != 3 for face in mesh.tessfaces]):
print("triangulating...")
with to_bmesh(mesh, save=True) as bm:
bmesh.ops.triangulate(bm, faces=bm.faces)
mesh.update(calc_edges=True, calc_tessface=True)
with open(os.fsencode(filepath), 'wb') as file:
def writestruct(s, *args):
file.write(struct.pack(s, *args))
writestruct('I', COB_FILE_ID)
writestruct('I', len(mesh.vertices))
writestruct('I', len(mesh.tessfaces))
for i, vert in enumerate(mesh.vertices):
writestruct('fff', *vert.co)
for face in mesh.tessfaces:
assert len(face.vertices) == 3
for vertid in face.vertices:
writestruct('I', vertid)
for face in mesh.tessfaces:
writestruct('fff', *face.normal)
return {'FINISHED'}
示例3: execute
# 需要导入模块: from bpy_extras import io_utils [as 别名]
# 或者: from bpy_extras.io_utils import axis_conversion [as 别名]
def execute(self, context):
keywords = self.as_keywords(ignore=("axis_forward",
"axis_up",
"filter_glob"))
global_matrix = axis_conversion(from_forward=self.axis_forward,
from_up=self.axis_up,
).to_4x4()
keywords["global_matrix"] = global_matrix
print(keywords)
importCSV(**keywords)
return {'FINISHED'}
示例4: __getitem__
# 需要导入模块: from bpy_extras import io_utils [as 别名]
# 或者: from bpy_extras.io_utils import axis_conversion [as 别名]
def __getitem__(self, key): # makes all attributes available for parameter substitution
if not type(key) is str or key.startswith('_'):
raise KeyError(key)
try:
value = getattr(self, key)
if value is None or type(value) is _FUNCTION_TYPE:
raise KeyError(key)
return value
except AttributeError:
raise KeyError(key)
# FWD = 'Z'
# UP = 'Y'
# MATRIX_NORMAL = axis_conversion(to_forward=FWD, to_up=UP).to_4x4()
# MATRIX_SCALE_DOWN = Matrix.Scale(0.2, 4) * MATRIX_NORMAL