Skip to content

Commit

Permalink
Merge branch 'Dev' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
xavier150 committed Feb 8, 2024
2 parents ab2a929 + ed3de36 commit fec8f46
Show file tree
Hide file tree
Showing 96 changed files with 3,923 additions and 977 deletions.
1 change: 0 additions & 1 deletion Tuto/How export assets from Blender.md

This file was deleted.

1 change: 0 additions & 1 deletion Tuto/How import assets from Blender to Unreal.md

This file was deleted.

18 changes: 14 additions & 4 deletions blender-for-unrealengine/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@
from . import bbpl
from . import bfu_propertys
from . import bfu_camera
from . import bfu_spline
from . import bfu_collision
from . import bfu_vertex_color
from . import bfu_custom_property
from . import bfu_addon_parts
from . import bfu_export_procedure
Expand All @@ -52,10 +54,10 @@
from . import bfu_utils
from . import bfu_unreal_utils
from . import bfu_naming
from . import bfu_export
from . import bfu_backward_compatibility
from . import bfu_cached_asset_list

from .export import bfu_export_asset

if "bps" in locals():
importlib.reload(bps)
Expand All @@ -65,8 +67,12 @@
importlib.reload(bfu_propertys)
if "bfu_camera" in locals():
importlib.reload(bfu_camera)
if "bfu_spline" in locals():
importlib.reload(bfu_spline)
if "bfu_collision" in locals():
importlib.reload(bfu_collision)
if "bfu_vertex_color" in locals():
importlib.reload(bfu_vertex_color)
if "bfu_custom_property" in locals():
importlib.reload(bfu_custom_property)
if "bfu_addon_parts" in locals():
Expand Down Expand Up @@ -97,8 +103,8 @@
importlib.reload(bfu_unreal_utils)
if "bfu_naming" in locals():
importlib.reload(bfu_naming)
if "bfu_export_asset" in locals():
importlib.reload(bfu_export_asset)
if "bfu_export" in locals():
importlib.reload(bfu_export)
if "bfu_backward_compatibility" in locals():
importlib.reload(bfu_backward_compatibility)
if "bfu_cached_asset_list" in locals():
Expand Down Expand Up @@ -136,7 +142,9 @@ def register():
bbpl.register()
bfu_propertys.register()
bfu_camera.register()
bfu_spline.register()
bfu_collision.register()
bfu_vertex_color.register()
bfu_custom_property.register()
bfu_addon_parts.register()
bfu_export_procedure.register()
Expand All @@ -159,8 +167,10 @@ def unregister():
bfu_addon_pref.unregister()
bfu_export_procedure.unregister()
bfu_addon_parts.unregister()
bfu_camera.unregister()
bfu_custom_property.unregister()
bfu_vertex_color.unregister()
bfu_collision.unregister()
bfu_spline.unregister()
bfu_camera.unregister()
bfu_propertys.unregister()
bbpl.unregister()
31 changes: 16 additions & 15 deletions blender-for-unrealengine/bbpl/blender_rig/rig_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,27 +135,28 @@ def no_num(name):
return name[:-4]
return name

def add_bone_to_collection(arm, bone_name, collection_name) -> bpy.types.BoneCollection:
#Add bone to collection and create if not exist

if collection_name in arm.data.collections:
col = arm.data.collections[collection_name]
else:
col = arm.data.collections.new(name=collection_name)
if bpy.app.version >= (4, 0, 0):
def add_bone_to_collection(arm, bone_name, collection_name) -> bpy.types.BoneCollection:
#Add bone to collection and create if not exist

if collection_name in arm.data.collections:
col = arm.data.collections[collection_name]
else:
col = arm.data.collections.new(name=collection_name)

bone = arm.data.edit_bones[bone_name]
col.assign(bone)
return col

def remove_bone_from_collection(arm, bone_name, collection_name) -> bpy.types.BoneCollection:
#Remove bone from collection.
if collection_name in arm.data.collections:
col = arm.data.collections[collection_name]
bone = arm.data.edit_bones[bone_name]
col.unassign(bone)
col.assign(bone)
return col

def remove_bone_from_collection(arm, bone_name, collection_name) -> bpy.types.BoneCollection:
#Remove bone from collection.
if collection_name in arm.data.collections:
col = arm.data.collections[collection_name]
bone = arm.data.edit_bones[bone_name]
col.unassign(bone)
return col

def change_current_layer(layer, source):
"""
Change the current active layer to the specified layer.
Expand Down
86 changes: 43 additions & 43 deletions blender-for-unrealengine/bbpl/rig_bone_visual.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,54 +245,54 @@ def add_bmesh_line(bm):

return new_shape

if bpy.app.version <= (3, 6, 0):
def create_bone_group(armature, name, theme="DEFAULT"):
"""
Deprecated in Blender 4.0
Creates a bone group in the armature with the specified name and color theme.
Args:
armature (bpy.types.Object): The armature object.
name (str): The name of the bone group.
theme (str, optional): The color theme of the bone group. Defaults to "DEFAULT".
Returns:
bpy.types.PoseBoneGroup: The created bone group.
"""
if name in armature.pose.bone_groups:
group = armature.pose.bone_groups[name]
else:
group = armature.pose.bone_groups.new(name=name)

def create_bone_group(armature, name, theme="DEFAULT"):
"""
Deprecated in Blender 4.0
Creates a bone group in the armature with the specified name and color theme.
Args:
armature (bpy.types.Object): The armature object.
name (str): The name of the bone group.
theme (str, optional): The color theme of the bone group. Defaults to "DEFAULT".
Returns:
bpy.types.PoseBoneGroup: The created bone group.
"""
if name in armature.pose.bone_groups:
group = armature.pose.bone_groups[name]
else:
group = armature.pose.bone_groups.new(name=name)

if theme == "DEFAULT":
group.color_set = "DEFAULT"
else:
colors = get_theme_colors(theme)
group.color_set = 'CUSTOM'
group.colors.normal = colors[0]
group.colors.select = colors[1]
group.colors.active = colors[2]
if theme == "DEFAULT":
group.color_set = "DEFAULT"
else:
colors = get_theme_colors(theme)
group.color_set = 'CUSTOM'
group.colors.normal = colors[0]
group.colors.select = colors[1]
group.colors.active = colors[2]

return group
return group


def direct_add_to_bone_group(armature, bones, group_name):
"""
Deprecated in Blender 4.0
Adds the specified bones to a bone group in the armature.
def direct_add_to_bone_group(armature, bones, group_name):
"""
Deprecated in Blender 4.0
Adds the specified bones to a bone group in the armature.
Args:
armature (bpy.types.Object): The armature object.
bones (str or list): The name(s) of the bone(s) to add to the bone group.
group_name (str): The name of the bone group.
Args:
armature (bpy.types.Object): The armature object.
bones (str or list): The name(s) of the bone(s) to add to the bone group.
group_name (str): The name of the bone group.
Returns:
None
"""
Returns:
None
"""

if isinstance(bones, list):
for bone_name in bones:
if isinstance(bones, list):
for bone_name in bones:
armature.pose.bones[bone_name].bone_group = armature.pose.bone_groups[group_name]
else:
bone_name = bones
armature.pose.bones[bone_name].bone_group = armature.pose.bone_groups[group_name]
else:
bone_name = bones
armature.pose.bones[bone_name].bone_group = armature.pose.bone_groups[group_name]
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os
import bpy
from ..export import bfu_export_asset
from .. import bfu_export
from .. import bfu_write_text
from .. import bfu_basics
from .. import bfu_utils
Expand Down Expand Up @@ -63,6 +63,12 @@ class BFU_PT_Export(bpy.types.Panel):
description="Prefix of camera animations",
maxlen=32,
default="Cam_")

bpy.types.Scene.bfu_spline_prefix_export_name = bpy.props.StringProperty(
name="Spline anim Prefix",
description="Prefix of spline animations",
maxlen=32,
default="Spline_")

# Sub folder
bpy.types.Scene.bfu_anim_subfolder_name = bpy.props.StringProperty(
Expand Down Expand Up @@ -101,6 +107,13 @@ class BFU_PT_Export(bpy.types.Panel):
maxlen=512,
default=os.path.join("//", "ExportedFbx", "Sequencer"),
subtype='DIR_PATH')

bpy.types.Scene.bfu_export_spline_file_path = bpy.props.StringProperty(
name="Spline export file path",
description="Choose a directory to export Spline(s)",
maxlen=512,
default=os.path.join("//", "ExportedFbx", "Spline"),
subtype='DIR_PATH')

bpy.types.Scene.bfu_export_other_file_path = bpy.props.StringProperty(
name="Other export file path",
Expand Down Expand Up @@ -169,11 +182,13 @@ class BFU_OT_AddNomenclaturePreset(AddPresetBase, bpy.types.Operator):
'scene.bfu_anim_prefix_export_name',
'scene.bfu_pose_prefix_export_name',
'scene.bfu_camera_prefix_export_name',
'scene.bfu_spline_prefix_export_name',
'scene.bfu_anim_subfolder_name',
'scene.bfu_export_static_file_path',
'scene.bfu_export_skeletal_file_path',
'scene.bfu_export_alembic_file_path',
'scene.bfu_export_camera_file_path',
'scene.bfu_export_spline_file_path',
'scene.bfu_export_other_file_path',
'scene.bfu_file_export_log_name',
'scene.bfu_file_import_asset_script_name',
Expand Down Expand Up @@ -423,7 +438,8 @@ def GetIfOneTypeCheck():
or scene.skeletal_export
or scene.anin_export
or scene.alembic_export
or scene.camera_export):
or scene.camera_export
or scene.spline_export):
return True
else:
return False
Expand Down Expand Up @@ -474,7 +490,7 @@ def GetIfOneTypeCheck():
scene.UnrealExportedAssetsList.clear()
counter = bps.utils.CounterTimer()
bfu_check_potential_error.UpdateNameHierarchy()
bfu_export_asset.process_export(self)
bfu_export.bfu_export_asset.process_export(self)
bfu_write_text.WriteAllTextFiles()

self.report(
Expand Down Expand Up @@ -560,6 +576,12 @@ def execute(self, context):
description="Check mark to export Camera(s)",
default=True
)

bpy.types.Scene.spline_export = bpy.props.BoolProperty(
name="Spline(s)",
description="Check mark to export Spline(s)",
default=True
)

# Additional file
bpy.types.Scene.text_ExportLog = bpy.props.BoolProperty(
Expand Down Expand Up @@ -632,6 +654,7 @@ def draw(self, context):
propsPrefix.prop(scene, 'bfu_anim_prefix_export_name', icon='OBJECT_DATA')
propsPrefix.prop(scene, 'bfu_pose_prefix_export_name', icon='OBJECT_DATA')
propsPrefix.prop(scene, 'bfu_camera_prefix_export_name', icon='OBJECT_DATA')
propsPrefix.prop(scene, 'bfu_spline_prefix_export_name', icon='OBJECT_DATA')

# Sub folder
propsSub = self.layout.row()
Expand All @@ -657,6 +680,7 @@ def draw(self, context):
filePath.prop(scene, 'bfu_export_skeletal_file_path')
filePath.prop(scene, 'bfu_export_alembic_file_path')
filePath.prop(scene, 'bfu_export_camera_file_path')
filePath.prop(scene, 'bfu_export_spline_file_path')
filePath.prop(scene, 'bfu_export_other_file_path')

# File name
Expand Down Expand Up @@ -686,6 +710,7 @@ def draw(self, context):
AssetsCol.prop(scene, 'anin_export')
AssetsCol.prop(scene, 'alembic_export')
AssetsCol.prop(scene, 'camera_export')
AssetsCol.prop(scene, 'spline_export')
layout.separator()

# Additional file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@
from .. import bfu_basics
from .. import bfu_utils
from .. import bfu_cached_asset_list
from ..export import bfu_export_get_info
from .. import bfu_export
from .. import bfu_ui
from .. import languages
from .. import bfu_custom_property
from .. import bfu_camera
from .. import bfu_spline
from .. import bfu_vertex_color


class BFU_PT_BlenderForUnrealObject(bpy.types.Panel):
Expand Down Expand Up @@ -1126,6 +1128,7 @@ def get_object_global_preset_propertys():
preset_values += bfu_unreal_engine_refs_props.get_preset_values()
preset_values += bfu_custom_property.bfu_custom_property_props.get_preset_values()
preset_values += bfu_camera.bfu_camera_ui_and_props.get_preset_values()
preset_values += bfu_spline.bfu_spline_ui_and_props.get_preset_values()
return preset_values

# Common variable used for all preset values
Expand Down Expand Up @@ -1290,7 +1293,9 @@ def draw(self, context):
icon='FILE_FOLDER'
)

if obj.type == "CAMERA":
if bfu_utils.GetAssetType(obj) == "Caùera":
bfu_export_procedure.bfu_export_procedure_ui.draw_object_export_procedure(layout, obj)
if bfu_utils.GetAssetType(obj) == "Spline":
bfu_export_procedure.bfu_export_procedure_ui.draw_object_export_procedure(layout, obj)

else:
Expand Down Expand Up @@ -1345,6 +1350,8 @@ def draw(self, context):
exportCustomNameText.enabled = useCustomName

bfu_camera.bfu_camera_ui_and_props.draw_ui_object_camera(layout, obj)
bfu_spline.bfu_spline_ui_and_props.draw_ui_object_spline(layout, obj)

scene.bfu_object_advanced_properties_expanded.draw(layout)
if scene.bfu_object_advanced_properties_expanded.is_expend():
if obj is not None:
Expand Down Expand Up @@ -1672,7 +1679,7 @@ def draw(self, context):

StaticMeshVertexColorFeedback = StaticMeshVertexColorImportOption.row()
if obj.type == "MESH":
vced = bfu_export_get_info.VertexColorExportData(obj)
vced = bfu_vertex_color.bfu_vertex_color_utils.VertexColorExportData(obj)
if vced.export_type == "REPLACE":
my_text = 'Vertex color nammed "' + vced.name + '" will be used.'
StaticMeshVertexColorFeedback.label(text=my_text, icon='INFO')
Expand Down
Loading

0 comments on commit fec8f46

Please sign in to comment.