mirror of
https://github.com/godotengine/collada-exporter.git
synced 2026-01-01 01:48:22 +03:00
Merge pull request #65 from QbieShay/master
Added exclude option for armature modifier when applying modifiers
This commit is contained in:
@@ -74,6 +74,12 @@ class ExportDAE(bpy.types.Operator, ExportHelper):
|
||||
description="Apply modifiers to mesh objects (on a copy!).",
|
||||
default=False,
|
||||
)
|
||||
use_exclude_armature_modifier = BoolProperty(
|
||||
name="Exclude Armature Modifier",
|
||||
description="Exclude the armature modifier when applying modifiers "
|
||||
"(otherwise animation will be applied on top of the last pose)",
|
||||
default=True,
|
||||
)
|
||||
use_tangent_arrays = BoolProperty(
|
||||
name="Tangent Arrays",
|
||||
description="Export Tangent and Binormal arrays "
|
||||
|
||||
@@ -511,6 +511,21 @@ class DaeExporter:
|
||||
self.mesh_cache[node.data] = meshdata
|
||||
return meshdata
|
||||
|
||||
|
||||
armature_modifier = None
|
||||
|
||||
armature_poses = None
|
||||
|
||||
if(self.config["use_exclude_armature_modifier"]):
|
||||
armature_modifier = node.modifiers.get("Armature")
|
||||
|
||||
if(armature_modifier):
|
||||
#doing this per object is inefficient, should be improved, maybe?
|
||||
armature_poses = [arm.pose_position for arm in bpy.data.armatures]
|
||||
for arm in bpy.data.armatures:
|
||||
arm.pose_position = "REST"
|
||||
|
||||
|
||||
apply_modifiers = len(node.modifiers) and self.config[
|
||||
"use_mesh_modifiers"]
|
||||
|
||||
@@ -520,8 +535,13 @@ class DaeExporter:
|
||||
|
||||
mesh = node.to_mesh(self.scene, apply_modifiers,
|
||||
"RENDER") # TODO: Review
|
||||
self.temp_meshes.add(mesh)
|
||||
if(armature_modifier):
|
||||
for i,arm in enumerate(bpy.data.armatures):
|
||||
arm.pose_position = armature_poses[i]
|
||||
|
||||
|
||||
|
||||
self.temp_meshes.add(mesh)
|
||||
triangulate = self.config["use_triangles"]
|
||||
if (triangulate):
|
||||
bm = bmesh.new()
|
||||
|
||||
Reference in New Issue
Block a user