Skip to content

Commit

Permalink
Added exclude option for armature modifier when applying modifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
QbieShay committed Apr 22, 2018
1 parent 836241a commit 6597953
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
6 changes: 6 additions & 0 deletions io_scene_dae/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 "
Expand Down
22 changes: 21 additions & 1 deletion io_scene_dae/export_dae.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,21 @@ def export_mesh(self, node, armature=None, skeyindex=-1, skel_source=None,
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"]

Expand All @@ -520,8 +535,13 @@ def export_mesh(self, node, armature=None, skeyindex=-1, skel_source=None,

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()
Expand Down

0 comments on commit 6597953

Please sign in to comment.