Skip to content

Commit

Permalink
Fix # Apply export transform after rescale
Browse files Browse the repository at this point in the history
  • Loading branch information
xavier150 committed Jun 19, 2021
1 parent f303684 commit e5fb21c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion blender-for-unrealengine/bfu_export_single_fbx_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def ExportSingleFbxAction(
ResetArmaturePose(active)
RescaleRigConsraints(active, rrf)

ApplyExportTransform(active)
ApplyExportTransform(active) # Apply export transform after rescale

# animation_data.action is ReadOnly with tweakmode in 2.8
if (scene.is_nla_tweakmode):
Expand Down
2 changes: 1 addition & 1 deletion blender-for-unrealengine/bfu_export_single_fbx_nla_anim.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def ExportSingleFbxNLAAnim(
ResetArmaturePose(active)
RescaleRigConsraints(active, rrf)

ApplyExportTransform(active)
ApplyExportTransform(active) # Apply export transform after rescale

# scene.frame_start += active.StartFramesOffset
# scene.frame_end += active.EndFramesOffset
Expand Down
6 changes: 3 additions & 3 deletions blender-for-unrealengine/bfu_export_single_skeletal_mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,6 @@ def ExportSingleSkeletalMesh(
if active.ExportAsProxy:
ApplyProxyData(active)

ApplyExportTransform(active)

# This will rescale the rig and unit scale to get a root bone egal to 1
ShouldRescaleRig = GetShouldRescaleRig(active)
if ShouldRescaleRig:
Expand All @@ -117,6 +115,8 @@ def ExportSingleSkeletalMesh(
bpy.context.scene.unit_settings.scale_length *= 1/rrf
ApplySkeletalExportScale(active, rrf)

ApplyExportTransform(active) # Apply export transform after rescale

absdirpath = bpy.path.abspath(dirpath)
VerifiDirs(absdirpath)
fullpath = os.path.join(absdirpath, filename)
Expand All @@ -137,7 +137,7 @@ def ExportSingleSkeletalMesh(
bpy.context.object.data.pose_position = 'REST'

SetVertexColorForUnrealExport(active)

if (export_procedure == "normal"):
pass
bpy.ops.export_scene.fbx(
Expand Down
3 changes: 2 additions & 1 deletion blender-for-unrealengine/bfu_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -949,8 +949,9 @@ def ApplySkeletalExportScale(armature, rescale):
animation_data = AnimationManagment()
animation_data.SaveAnimationData(armature)
animation_data.ClearAnimationData(armature)

armature.scale = armature.scale*rescale

bpy.ops.object.transform_apply(
location=True,
scale=True,
Expand Down

0 comments on commit e5fb21c

Please sign in to comment.