Skip to content

Commit

Permalink
Skeleton Prefix +
Browse files Browse the repository at this point in the history
- Fixed: Export doesn't work with animation from Proxy Since Blender 3.2.2
  • Loading branch information
xavier150 committed Aug 6, 2022
1 parent 94e017c commit 69d5399
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 27 deletions.
1 change: 1 addition & 0 deletions Release log.txt
Original file line number Diff line number Diff line change
Expand Up @@ -419,3 +419,4 @@ It is now possible to force the duration of an animation according to the scene
- Fixed: NLA export fail when use inter frame.
- Fixed: NLA export ignore animated influence on actions.
- Fixed: Import script doesn't work with Unreal Engine 5.
- Fixed: Export doesn't work with animation from Proxy Since Blender 3.2.2
23 changes: 14 additions & 9 deletions blender-for-unrealengine/bfu_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -2187,17 +2187,23 @@ class BFU_PT_Export(bpy.types.Panel):
bl_category = "Unreal Engine"

# Prefix
bpy.types.Scene.static_prefix_export_name = bpy.props.StringProperty(
bpy.types.Scene.static_mesh_prefix_export_name = bpy.props.StringProperty(
name="StaticMesh Prefix",
description="Prefix of staticMesh",
maxlen=32,
default="SM_")

bpy.types.Scene.skeletal_prefix_export_name = bpy.props.StringProperty(
bpy.types.Scene.skeletal_mesh_prefix_export_name = bpy.props.StringProperty(
name="SkeletalMesh Prefix ",
description="Prefix of SkeletalMesh",
maxlen=32,
default="SKM_")

bpy.types.Scene.skeleton_prefix_export_name = bpy.props.StringProperty(
name="skeleton Prefix ",
description="Prefix of skeleton",
maxlen=32,
default="SK_")

bpy.types.Scene.alembic_prefix_export_name = bpy.props.StringProperty(
name="Alembic Prefix ",
Expand Down Expand Up @@ -2315,8 +2321,9 @@ class BFU_OT_AddNomenclaturePreset(AddPresetBase, Operator):

# Properties to store in the preset
preset_values = [
'scene.static_prefix_export_name',
'scene.skeletal_prefix_export_name',
'scene.static_mesh_prefix_export_name',
'scene.skeletal_mesh_prefix_export_name',
'scene.skeleton_prefix_export_name',
'scene.alembic_prefix_export_name',
'scene.anim_prefix_export_name',
'scene.pose_prefix_export_name',
Expand Down Expand Up @@ -2774,11 +2781,9 @@ def draw(self, context):
# Prefix
propsPrefix = self.layout.row()
propsPrefix = propsPrefix.column()
propsPrefix.prop(scene, 'static_prefix_export_name', icon='OBJECT_DATA')
propsPrefix.prop(
scene,
'skeletal_prefix_export_name',
icon='OBJECT_DATA')
propsPrefix.prop(scene, 'static_mesh_prefix_export_name', icon='OBJECT_DATA')
propsPrefix.prop(scene, 'skeletal_mesh_prefix_export_name', icon='OBJECT_DATA')
propsPrefix.prop(scene, 'skeleton_prefix_export_name', icon='OBJECT_DATA')
propsPrefix.prop(scene, 'alembic_prefix_export_name', icon='OBJECT_DATA')
propsPrefix.prop(scene, 'anim_prefix_export_name', icon='OBJECT_DATA')
propsPrefix.prop(scene, 'pose_prefix_export_name', icon='OBJECT_DATA')
Expand Down
6 changes: 3 additions & 3 deletions blender-for-unrealengine/bfu_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1692,7 +1692,7 @@ def GetCollectionExportFileName(collection, fileType=".fbx"):
# Generate assset file name

scene = bpy.context.scene
return scene.static_prefix_export_name+collection+fileType
return scene.static_mesh_prefix_export_name+collection+fileType


def GetObjExportFileName(obj, fileType=".fbx"):
Expand All @@ -1705,9 +1705,9 @@ def GetObjExportFileName(obj, fileType=".fbx"):
if assetType == "Camera":
return ValidFilename(scene.camera_prefix_export_name+obj.name+fileType)
elif assetType == "StaticMesh":
return ValidFilename(scene.static_prefix_export_name+obj.name+fileType)
return ValidFilename(scene.static_mesh_prefix_export_name+obj.name+fileType)
elif assetType == "SkeletalMesh":
return ValidFilename(scene.skeletal_prefix_export_name+obj.name+fileType)
return ValidFilename(scene.skeletal_mesh_prefix_export_name+obj.name+fileType)
elif assetType == "Alembic":
return ValidFilename(scene.alembic_prefix_export_name+obj.name+fileType)
else:
Expand Down
2 changes: 1 addition & 1 deletion blender-for-unrealengine/bfu_write_import_asset_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def WriteImportAssetScript():

if GetIsAnimation(asset.asset_type):
if(asset.object.bfu_skeleton_search_mode) == "auto":
customName = scene.skeletal_prefix_export_name+ValidUnrealAssetsName(asset.skeleton_name)+"_Skeleton"
customName = scene.skeletal_mesh_prefix_export_name+ValidUnrealAssetsName(asset.skeleton_name)+"_Skeleton"
SkeletonName = customName+"."+customName
SkeletonLoc = os.path.join(asset.folder_name, SkeletonName)

Expand Down
18 changes: 11 additions & 7 deletions blender-for-unrealengine/export/bfu_export_single_fbx_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,12 @@ def ExportSingleFbxAction(

SelectParentAndDesiredChilds(obj)
asset_name = PrepareExportName(obj, True)
duplicate_data = DuplicateSelectForExport()
SetDuplicateNameForExport(duplicate_data)
MakeSelectVisualReal()
if export_as_proxy is False:
duplicate_data = DuplicateSelectForExport()
SetDuplicateNameForExport(duplicate_data)

if export_as_proxy is False:
MakeSelectVisualReal()

BaseTransform = obj.matrix_world.copy()
active = bpy.context.view_layer.objects.active
Expand Down Expand Up @@ -214,11 +217,12 @@ def ExportSingleFbxAction(
bpy.context.scene.unit_settings.scale_length = savedUnitLength
RescaleAllActionCurve(1/(rrf*oldScale), 0.01/savedUnitLength)

CleanDeleteObjects(bpy.context.selected_objects)
for data in duplicate_data.data_to_remove:
data.RemoveData()
if export_as_proxy is False:
CleanDeleteObjects(bpy.context.selected_objects)
for data in duplicate_data.data_to_remove:
data.RemoveData()

ResetDuplicateNameAfterExport(duplicate_data)
ResetDuplicateNameAfterExport(duplicate_data)

for obj in scene.objects:
ClearAllBFUTempVars(obj)
21 changes: 14 additions & 7 deletions blender-for-unrealengine/export/bfu_export_single_fbx_nla_anim.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,17 @@ def ExportSingleFbxNLAAnim(
export_as_proxy = GetExportAsProxy(obj)
export_proxy_child = GetExportProxyChild(obj)


SafeModeSet('OBJECT')

SelectParentAndDesiredChilds(obj)
asset_name = PrepareExportName(obj, True)
duplicate_data = DuplicateSelectForExport()
SetDuplicateNameForExport(duplicate_data)
MakeSelectVisualReal()
if export_as_proxy is False:
duplicate_data = DuplicateSelectForExport()
SetDuplicateNameForExport(duplicate_data)

if export_as_proxy is False:
MakeSelectVisualReal()

BaseTransform = obj.matrix_world.copy()
active = bpy.context.view_layer.objects.active
Expand All @@ -103,6 +107,8 @@ def ExportSingleFbxNLAAnim(
animation_data = AnimationManagment()
animation_data.SaveAnimationData(obj)
animation_data.SetAnimationData(active, True)



if export_as_proxy:
ApplyProxyData(active)
Expand Down Expand Up @@ -191,11 +197,12 @@ def ExportSingleFbxNLAAnim(
bpy.context.scene.unit_settings.scale_length = savedUnitLength
RescaleAllActionCurve(1/(rrf*oldScale), 0.01/savedUnitLength)

CleanDeleteObjects(bpy.context.selected_objects)
for data in duplicate_data.data_to_remove:
data.RemoveData()
if export_as_proxy is False:
CleanDeleteObjects(bpy.context.selected_objects)
for data in duplicate_data.data_to_remove:
data.RemoveData()

ResetDuplicateNameAfterExport(duplicate_data)
ResetDuplicateNameAfterExport(duplicate_data)

for obj in scene.objects:
ClearAllBFUTempVars(obj)

0 comments on commit 69d5399

Please sign in to comment.