Skip to content

Commit

Permalink
Merge branch 'Dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
xavier150 committed Jun 29, 2021
2 parents 033155b + be78035 commit 32c420f
Show file tree
Hide file tree
Showing 19 changed files with 450 additions and 231 deletions.
7 changes: 6 additions & 1 deletion Release log.txt
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,11 @@ It is now possible to force the duration of an animation according to the scene
- New: you can now choose a specific Vertex Paint to use when you Export.
- New: You can now choose if you use scene or armature as origin for export in SkeletalMesh animations.
- New: Manage more characters cultures in path or files names.
- New: Camera export take less time + new camera options in addon preferences
- Change: The skeletal mesh are exported with scale at 1.0.
- Change: You can use "Show Asset(s)" and "Show Action(s)" buttons for force to update the action cache.
- Change: Remove root bone modified to Add root bone.
- Change: Auto fix the "multiple root bones" potential error when export.
- Fixed: Do a new preset do a script error.
- Fixed: Export filter "Only select and active action" don't work with poses.
- Fixed: The export action cache is not correctly updated.
Expand All @@ -372,7 +375,9 @@ It is now possible to force the duration of an animation according to the scene
- Fixed: With Unit Scale not at 0.01 SkeletalMesh have a wrong scale.
- Fixed: Import NLA animation with script don't work.
- Fixed: With Unit Scale not at 0.01 NLA animation will not export.
- Fixed: With Unit Scale not at 0.01 Blender 2.9.1 can crash with SkeletalMesh.
- Fixed: Apply Wrong Bool Modifier do script error.
- Fixed: Mesh with disabled Modifier do script error.
- Fixed: Additional location in advanced properties don't work for the cameras.
- Fixed: Export Instanced complex Collections can break the exported mesh.
- Fixed: Export Instanced complex Collections can break the exported mesh.
- Fixed: Camera Sequencer don't work in Unreal Engine 5.
6 changes: 4 additions & 2 deletions blender-for-unrealengine/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ def register():
bpy.types.Scene.bfu_collision_socket_expanded = bpy.props.BoolProperty()
bpy.types.Scene.bfu_lightmap_expanded = bpy.props.BoolProperty()
bpy.types.Scene.bfu_nomenclature_properties_expanded = bpy.props.BoolProperty()
bpy.types.Scene.bfu_export_properties_expanded = bpy.props.BoolProperty()
bpy.types.Scene.bfu_export_filter_properties_expanded = bpy.props.BoolProperty()
bpy.types.Scene.bfu_export_process_properties_expanded = bpy.props.BoolProperty()
bpy.types.Scene.bfu_script_tool_expanded = bpy.props.BoolProperty()

bpy.types.Scene.bfu_active_object_tab = bpy.props.EnumProperty(
Expand Down Expand Up @@ -160,7 +161,8 @@ def unregister():
del bpy.types.Scene.bfu_collision_socket_expanded
del bpy.types.Scene.bfu_lightmap_expanded
del bpy.types.Scene.bfu_nomenclature_properties_expanded
del bpy.types.Scene.bfu_export_properties_expanded
del bpy.types.Scene.bfu_export_filter_properties_expanded
del bpy.types.Scene.bfu_export_process_properties_expanded
del bpy.types.Scene.bfu_script_tool_expanded

del bpy.types.Scene.bfu_active_object_tab
Expand Down
61 changes: 40 additions & 21 deletions blender-for-unrealengine/bfu_addon_pref.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,13 @@ class BFU_AP_AddonPreferences(bpy.types.AddonPreferences):
default=False,
)

removeSkeletonRootBone: BoolProperty(
name=(ti('remove_skeleton_root_bone_name')),
description=(tt('remove_skeleton_root_bone_desc')),
default=True,
add_skeleton_root_bone: BoolProperty(
name=(ti('add_skeleton_root_bone_name')),
description=(tt('add_skeleton_root_bone_desc')),
default=False,
)

skeletonRootBoneName: StringProperty(
skeleton_root_bone_name: StringProperty(
name=(ti('skeleton_root_bone_name_name')),
description=(tt('skeleton_root_bone_name_desc')),
default="ArmatureRoot",
Expand Down Expand Up @@ -163,6 +163,18 @@ class BFU_AP_AddonPreferences(bpy.types.AddonPreferences):
default=1,
)

exportCameraAsFBX: BoolProperty(
name=(ti('export_camera_as_fbx_name')),
description=(tt('export_camera_as_fbx_desc')),
default=False,
)

bakeOnlyKeyVisibleInCut: BoolProperty(
name=(ti('bake_only_key_visible_in_cut_name')),
description=(tt('bake_only_key_visible_in_cut_desc')),
default=True,
)

ignoreNLAForAction: BoolProperty(
name=(ti('ignore_nla_for_action_name')),
description=(tt('ignore_nla_for_action_desc')),
Expand Down Expand Up @@ -194,7 +206,7 @@ class BFU_AP_AddonPreferences(bpy.types.AddonPreferences):
)

collisionColor: FloatVectorProperty(
name='Collision color.',
name=ti('collision_color_name'),
description='Color of the collision in Blender',
subtype='COLOR',
size=4,
Expand All @@ -203,7 +215,7 @@ class BFU_AP_AddonPreferences(bpy.types.AddonPreferences):
)

notifyUnitScalePotentialError: BoolProperty(
name='Notify UnitScale (PotentialError)',
name=ti('notify_unit_scale_potential_error_name'),
description=(
'Notify as potential error' +
' if the unit scale is not equal to 0.01.'
Expand Down Expand Up @@ -263,25 +275,28 @@ def PropWithDocButton(tagetlayout, name, docOcticon):
boxColumn = layout.column().split(
factor=0.5
)
ColumnLeft = boxColumn.column()
ColumnRight = boxColumn.column()

rootBone = boxColumn.box()
rootBone = ColumnLeft.box()

LabelWithDocButton(
rootBone,
"SKELETON & ROOT BONE",
"skeleton--root-bone"
)
rootBone.prop(self, "removeSkeletonRootBone")
rootBone.prop(self, "add_skeleton_root_bone")
rootBoneName = rootBone.column()
rootBoneName.enabled = not self.removeSkeletonRootBone
rootBoneName.prop(self, "skeletonRootBoneName")
rootBoneName.enabled = self.add_skeleton_root_bone
rootBoneName.prop(self, "skeleton_root_bone_name")

rootBone.prop(self, "rescaleFullRigAtExport")
newRigScale = rootBone.column()
newRigScale.enabled = self.rescaleFullRigAtExport == "custom_rescale"
newRigScale.prop(self, "newRigScale")

socket = boxColumn.box()
ColumnLeft.label(text='')
socket = ColumnLeft.box()
socket.label(text='SOCKET')
socket.prop(self, "staticSocketsAdd90X")
socket.prop(self, "rescaleSocketsAtExport")
Expand All @@ -290,9 +305,13 @@ def PropWithDocButton(tagetlayout, name, docOcticon):
socketRescale.prop(self, "staticSocketsImportedSize")
socketRescale.prop(self, "skeletalSocketsImportedSize")

boxColumn = layout.column().split(factor=0.5)
ColumnLeft.label(text='')
camera = ColumnLeft.box()
camera.label(text='CAMERA')
camera.prop(self, "exportCameraAsFBX")
camera.prop(self, "bakeOnlyKeyVisibleInCut")

data = boxColumn.box()
data = ColumnRight.box()
data.label(text='DATA')
data.prop(self, "ignoreNLAForAction")
PropWithDocButton(data, "correctExtremUVScale", "uv")
Expand All @@ -301,17 +320,17 @@ def PropWithDocButton(tagetlayout, name, docOcticon):
data.prop(self, "exportWithMetaData")
data.prop(self, "revertExportPath")

script = boxColumn.box()
script.label(text='IMPORT SCRIPT')
script.prop(self, "useGeneratedScripts")

boxColumn = layout.column().split(factor=0.5)

other = boxColumn.box()
ColumnRight.label(text='')
other = ColumnRight.box()
other.label(text='OTHER')
other.prop(self, "collisionColor")
other.prop(self, "notifyUnitScalePotentialError")

ColumnRight.label(text='')
script = ColumnRight.box()
script.label(text='IMPORT SCRIPT')
script.prop(self, "useGeneratedScripts")

updateButton = layout.row()
updateButton.scale_y = 2.0
updateButton.operator("object.new_release_info", icon="TIME")
Expand Down
24 changes: 7 additions & 17 deletions blender-for-unrealengine/bfu_check_potential_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,31 +361,21 @@ def CheckArmatureMultipleRoots():
# Check that skeleton have multiples roots
for obj in objToCheck:
if GetAssetType(obj) == "SkeletalMesh":

rootBones = []
if not obj.exportDeformOnly:
for bone in obj.data.bones:
if bone.parent is None:
rootBones.append(bone)

if obj.exportDeformOnly:
for bone in obj.data.bones:
if bone.use_deform:
rootBone = getRootBoneParent(bone)
if rootBone not in rootBones:
rootBones.append(rootBone)
rootBones = GetArmatureRootBones(obj)

if len(rootBones) > 1:
MyError = PotentialErrors.add()
MyError.name = obj.name
MyError.type = 2
MyError.type = 1
MyError.text = (
'Object "'+obj.name +
'" have Multiple roots bones.' +
' Unreal only support single root bone.')
MyError.text += '\nRoot bones: '
' Unreal only support single root bone')
MyError.text += '\nA custom root bone will be added at the export.'
MyError.text += ' '+str(len(rootBones))+' root bones found: '
MyError.text += '\n'
for rootBone in rootBones:
MyError.text += rootBone.name+' '
MyError.text += rootBone.name+', '
MyError.object = obj

def CheckArmatureNoDeformBone():
Expand Down
46 changes: 31 additions & 15 deletions blender-for-unrealengine/bfu_export_asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,26 @@ def ExportAllAssetByList(targetobjects, targetActionName, targetcollection):

NumberAssetToExport = len(GetFinalAssetToExport())

def UpdateProgress(time=None):
update_progress(
"Export assets",
len(scene.UnrealExportedAssetsList)/NumberAssetToExport,
time
)
UpdateProgress()
def UpdateExportProgress(time=None):
exported_assets = len(scene.UnrealExportedAssetsList)
remain_assets = exported_assets/NumberAssetToExport

wm = bpy.context.window_manager

if remain_assets == NumberAssetToExport:
wm.progress_begin(0, remain_assets)

wm.progress_update(exported_assets)

if remain_assets == 0:
wm.progress_end()

UpdateProgress("Export assets", remain_assets, time)

UpdateExportProgress()

# Export collections
print("Start Export collection(s)")
if scene.static_collection_export:
for col in GetCollectionToExport(scene):
if col in targetcollection:
Expand All @@ -169,13 +180,14 @@ def UpdateProgress(time=None):
# Resets previous start/end frame
scene.frame_start = UserStartFrame
scene.frame_end = UserEndFrame
UpdateProgress()
UpdateExportProgress()

# Export assets
for obj in targetobjects:
if obj.ExportEnum == "export_recursive":

# Camera
print("Start Export camera(s)")
if GetAssetType(obj) == "Camera" and IsValidObjectForExport(scene, obj):
# Save current start/end frame
UserStartFrame = scene.frame_start
Expand All @@ -185,9 +197,10 @@ def UpdateProgress(time=None):
# Resets previous start/end frame
scene.frame_start = UserStartFrame
scene.frame_end = UserEndFrame
UpdateProgress()
UpdateExportProgress()

# StaticMesh
print("Start Export StaticMesh(s)")
if GetAssetType(obj) == "StaticMesh" and IsValidObjectForExport(scene, obj):

# Save current start/end frame
Expand All @@ -198,11 +211,11 @@ def UpdateProgress(time=None):
# Resets previous start/end frame
scene.frame_start = UserStartFrame
scene.frame_end = UserEndFrame
UpdateProgress()
UpdateExportProgress()

# SkeletalMesh
print("Start Export SkeletalMesh(s)")
if GetAssetType(obj) == "SkeletalMesh" and IsValidObjectForExport(scene, obj):

# Save current start/end frame
UserStartFrame = scene.frame_start
UserEndFrame = scene.frame_end
Expand All @@ -211,9 +224,10 @@ def UpdateProgress(time=None):
# Resets previous start/end frame
scene.frame_start = UserStartFrame
scene.frame_end = UserEndFrame
UpdateProgress()
UpdateExportProgress()

# Alembic
print("Start Export Alembic(s)")
if GetAssetType(obj) == "Alembic" and IsValidObjectForExport(scene, obj):
# Save current start/end frame
UserStartFrame = scene.frame_start
Expand All @@ -223,9 +237,10 @@ def UpdateProgress(time=None):
# Resets previous start/end frame
scene.frame_start = UserStartFrame
scene.frame_end = UserEndFrame
UpdateProgress()
UpdateExportProgress()

# Action animation
print("Start Export Action(s)")
if GetAssetType(obj) == "SkeletalMesh" and obj.visible_get():
for action in GetActionToExport(obj):
if action.name in targetActionName:
Expand All @@ -242,9 +257,10 @@ def UpdateProgress(time=None):
# Resets previous start/end frame
scene.frame_start = UserStartFrame
scene.frame_end = UserEndFrame
UpdateProgress()
UpdateExportProgress()

# NLA animation
print("Start Export NLA(s)")
if IsValidActionForExport(scene, obj, "NLA"):
if obj.ExportNLA:
# Save current start/end frame
Expand All @@ -256,7 +272,7 @@ def UpdateProgress(time=None):
scene.frame_start = UserStartFrame
scene.frame_end = UserEndFrame

UpdateProgress(counter.GetTime())
UpdateExportProgress(counter.GetTime())


def ExportForUnrealEngine():
Expand Down
46 changes: 24 additions & 22 deletions blender-for-unrealengine/bfu_export_single_camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,28 +117,30 @@ def ExportSingleFbxCamera(
VerifiDirs(absdirpath)
fullpath = os.path.join(absdirpath, filename)

bpy.ops.export_scene.fbx(
filepath=fullpath,
check_existing=False,
use_selection=True,
global_scale=GetObjExportScale(obj),
object_types={'CAMERA'},
use_custom_props=addon_prefs.exportWithCustomProps,
add_leaf_bones=False,
use_armature_deform_only=obj.exportDeformOnly,
bake_anim=True,
bake_anim_use_nla_strips=False,
bake_anim_use_all_actions=False,
bake_anim_force_startend_keying=True,
bake_anim_step=GetAnimSample(obj),
bake_anim_simplify_factor=obj.SimplifyAnimForExport,
use_metadata=addon_prefs.exportWithMetaData,
primary_bone_axis=obj.exportPrimaryBaneAxis,
secondary_bone_axis=obj.exporSecondaryBoneAxis,
axis_forward=obj.exportAxisForward,
axis_up=obj.exportAxisUp,
bake_space_transform=False
)
ExportCameraAsFBX = addon_prefs.exportCameraAsFBX
if ExportCameraAsFBX:
bpy.ops.export_scene.fbx(
filepath=fullpath,
check_existing=False,
use_selection=True,
global_scale=GetObjExportScale(obj),
object_types={'CAMERA'},
use_custom_props=addon_prefs.exportWithCustomProps,
add_leaf_bones=False,
use_armature_deform_only=obj.exportDeformOnly,
bake_anim=True,
bake_anim_use_nla_strips=False,
bake_anim_use_all_actions=False,
bake_anim_force_startend_keying=True,
bake_anim_step=GetAnimSample(obj),
bake_anim_simplify_factor=obj.SimplifyAnimForExport,
use_metadata=addon_prefs.exportWithMetaData,
primary_bone_axis=obj.exportPrimaryBaneAxis,
secondary_bone_axis=obj.exporSecondaryBoneAxis,
axis_forward=obj.exportAxisForward,
axis_up=obj.exportAxisUp,
bake_space_transform=False
)

# Reset camera scale
obj.delta_scale *= 100
Loading

0 comments on commit 32c420f

Please sign in to comment.