From 69d5399d2bb49f6e791c9a476fdae46b0fdff9eb Mon Sep 17 00:00:00 2001 From: Xavier Loux Date: Sat, 6 Aug 2022 05:11:29 +0200 Subject: [PATCH] Skeleton Prefix + - Fixed: Export doesn't work with animation from Proxy Since Blender 3.2.2 --- Release log.txt | 1 + blender-for-unrealengine/bfu_ui.py | 23 +++++++++++-------- blender-for-unrealengine/bfu_utils.py | 6 ++--- .../bfu_write_import_asset_script.py | 2 +- .../export/bfu_export_single_fbx_action.py | 18 +++++++++------ .../export/bfu_export_single_fbx_nla_anim.py | 21 +++++++++++------ 6 files changed, 44 insertions(+), 27 deletions(-) diff --git a/Release log.txt b/Release log.txt index bf3974fb..325467a5 100644 --- a/Release log.txt +++ b/Release log.txt @@ -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 diff --git a/blender-for-unrealengine/bfu_ui.py b/blender-for-unrealengine/bfu_ui.py index ae0599fd..22be8347 100644 --- a/blender-for-unrealengine/bfu_ui.py +++ b/blender-for-unrealengine/bfu_ui.py @@ -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 ", @@ -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', @@ -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') diff --git a/blender-for-unrealengine/bfu_utils.py b/blender-for-unrealengine/bfu_utils.py index f305f906..4970ed1b 100644 --- a/blender-for-unrealengine/bfu_utils.py +++ b/blender-for-unrealengine/bfu_utils.py @@ -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"): @@ -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: diff --git a/blender-for-unrealengine/bfu_write_import_asset_script.py b/blender-for-unrealengine/bfu_write_import_asset_script.py index 9f8218a5..b3d275c9 100644 --- a/blender-for-unrealengine/bfu_write_import_asset_script.py +++ b/blender-for-unrealengine/bfu_write_import_asset_script.py @@ -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) diff --git a/blender-for-unrealengine/export/bfu_export_single_fbx_action.py b/blender-for-unrealengine/export/bfu_export_single_fbx_action.py index 483a38a1..bf7c3941 100644 --- a/blender-for-unrealengine/export/bfu_export_single_fbx_action.py +++ b/blender-for-unrealengine/export/bfu_export_single_fbx_action.py @@ -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 @@ -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) diff --git a/blender-for-unrealengine/export/bfu_export_single_fbx_nla_anim.py b/blender-for-unrealengine/export/bfu_export_single_fbx_nla_anim.py index 77b47f8e..feb9bffb 100644 --- a/blender-for-unrealengine/export/bfu_export_single_fbx_nla_anim.py +++ b/blender-for-unrealengine/export/bfu_export_single_fbx_nla_anim.py @@ -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 @@ -103,6 +107,8 @@ def ExportSingleFbxNLAAnim( animation_data = AnimationManagment() animation_data.SaveAnimationData(obj) animation_data.SetAnimationData(active, True) + + if export_as_proxy: ApplyProxyData(active) @@ -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) \ No newline at end of file