Skip to content

Commit

Permalink
- Fixed: UI Script produce scripts errors when object is not select.
Browse files Browse the repository at this point in the history
- Fixed: UI is hiddend when bfu_export_type is not "export_recursive".
  • Loading branch information
xavier150 committed Nov 14, 2024
1 parent 730ab96 commit 17dcb3f
Show file tree
Hide file tree
Showing 13 changed files with 88 additions and 82 deletions.
4 changes: 3 additions & 1 deletion ReleaseLogs/Version_4.3.9.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ Release Logs: https://github.com/xavier150/Blender-For-UnrealEngine-Addons/wiki/
- Changes: Updated fbxio for Blender 4.3.
- Fixed: Animation UI not visible on linked Armatures.
- Fixed: Generated Builds for Blender 4.1 and olders version is wrong.
- Fixed: Import scripts do not works. (wrong import call in the scripts)
- Fixed: Import scripts do not works. (wrong import call in the scripts)
- Fixed: UI Script produce scripts errors when object is not select.
- Fixed: UI is hiddend when bfu_export_type is not "export_recursive".
4 changes: 2 additions & 2 deletions blender-for-unrealengine/bfu_addon_parts/bfu_panel_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ def draw(self, context: bpy.types.Context):
bfu_collision.bfu_collision_ui.draw_ui_object(layout, obj)
bfu_uv_map.bfu_uv_map_ui.draw_obj_ui(layout, obj)
bfu_light_map.bfu_light_map_ui.draw_obj_ui(layout, obj)
bfu_material.bfu_material_ui.draw_ui_object(layout)
bfu_vertex_color.bfu_vertex_color_ui.draw_ui_object(layout)
bfu_material.bfu_material_ui.draw_ui_object(layout, obj)
bfu_vertex_color.bfu_vertex_color_ui.draw_ui_object(layout, obj)
bfu_assets_references.bfu_asset_ref_ui.draw_ui(layout, obj)

# Animations
Expand Down
3 changes: 0 additions & 3 deletions blender-for-unrealengine/bfu_adv_object/bfu_adv_obj_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@

def draw_ui(layout: bpy.types.UILayout, obj: bpy.types.Object):

if obj is None:
return

scene = bpy.context.scene
addon_prefs = bfu_basics.GetAddonPrefs()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ def draw_ui(layout: bpy.types.UILayout, obj: bpy.types.Object):

scene = bpy.context.scene
addon_prefs = bfu_basics.GetAddonPrefs()
is_skeletal_mesh = bfu_skeletal_mesh.bfu_skeletal_mesh_utils.is_skeletal_mesh(obj)
is_camera = bfu_camera.bfu_camera_utils.is_camera(obj)
is_alembic_animation = bfu_alembic_animation.bfu_alembic_animation_utils.is_alembic_animation(obj)

# Hide filters
if obj is None:
return
if obj.bfu_export_type != "export_recursive":
return
is_skeletal_mesh = bfu_skeletal_mesh.bfu_skeletal_mesh_utils.is_skeletal_mesh(obj)
is_camera = bfu_camera.bfu_camera_utils.is_camera(obj)
is_alembic_animation = bfu_alembic_animation.bfu_alembic_animation_utils.is_alembic_animation(obj)
if True not in [is_skeletal_mesh, is_camera, is_alembic_animation]:
return

Expand Down
3 changes: 2 additions & 1 deletion blender-for-unrealengine/bfu_anim_nla/bfu_anim_nla_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,14 @@ def draw_ui(layout: bpy.types.UILayout, obj: bpy.types.Object):

scene = bpy.context.scene
addon_prefs = bfu_basics.GetAddonPrefs()
is_skeletal_mesh = bfu_skeletal_mesh.bfu_skeletal_mesh_utils.is_skeletal_mesh(obj)


# Hide filters
if obj is None:
return
if obj.bfu_export_type != "export_recursive":
return
is_skeletal_mesh = bfu_skeletal_mesh.bfu_skeletal_mesh_utils.is_skeletal_mesh(obj)

if bfu_ui.bfu_ui_utils.DisplayPropertyFilter("OBJECT", "ANIM"):
scene.bfu_animation_nla_properties_expanded.draw(layout)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@


def draw_ui(layout: bpy.types.UILayout, obj: bpy.types.Object):

if obj is None:
return

scene = bpy.context.scene
addon_prefs = bfu_basics.GetAddonPrefs()
Expand All @@ -42,7 +39,8 @@ def draw_ui(layout: bpy.types.UILayout, obj: bpy.types.Object):
return
if obj.bfu_export_type != "export_recursive":
return
if bfu_skeletal_mesh.bfu_skeletal_mesh_utils.is_not_skeletal_mesh(obj):
is_skeletal_mesh = bfu_skeletal_mesh.bfu_skeletal_mesh_utils.is_skeletal_mesh(obj)
if is_skeletal_mesh is False:
return

# Draw UI
Expand All @@ -51,7 +49,7 @@ def draw_ui(layout: bpy.types.UILayout, obj: bpy.types.Object):
if scene.bfu_engine_ref_properties_expanded.is_expend():

# SkeletalMesh prop
if bfu_skeletal_mesh.bfu_skeletal_mesh_utils.is_skeletal_mesh(obj):
if is_skeletal_mesh:
if not obj.bfu_export_as_lod_mesh:
unreal_engine_refs = layout.column()
draw_skeleton_prop(unreal_engine_refs, obj)
Expand Down
3 changes: 0 additions & 3 deletions blender-for-unrealengine/bfu_base_object/bfu_base_obj_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ def draw_ui(layout: bpy.types.UILayout, obj: bpy.types.Object):
return
if bfu_utils.GetExportAsProxy(obj):
return
if obj.bfu_export_type != "export_recursive":
return

if bfu_ui.bfu_ui_utils.DisplayPropertyFilter("OBJECT", "GENERAL"):
scene.bfu_object_properties_expanded.draw(layout)
if scene.bfu_object_properties_expanded.is_expend():
Expand Down
4 changes: 2 additions & 2 deletions blender-for-unrealengine/bfu_collision/bfu_collision_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@
def draw_ui_object(layout: bpy.types.UILayout, obj: bpy.types.Object):
scene = bpy.context.scene
addon_prefs = bfu_basics.GetAddonPrefs()
is_static_mesh = bfu_static_mesh.bfu_static_mesh_utils.is_static_mesh(obj)
is_skeletal_mesh = bfu_skeletal_mesh.bfu_skeletal_mesh_utils.is_skeletal_mesh(obj)

# Hide filters
if obj is None:
return
is_static_mesh = bfu_static_mesh.bfu_static_mesh_utils.is_static_mesh(obj)
is_skeletal_mesh = bfu_skeletal_mesh.bfu_skeletal_mesh_utils.is_skeletal_mesh(obj)
if addon_prefs.useGeneratedScripts is False:
return
if bfu_utils.GetExportAsProxy(obj):
Expand Down
2 changes: 1 addition & 1 deletion blender-for-unrealengine/bfu_light_map/bfu_light_map_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ def draw_obj_ui(layout: bpy.types.UILayout, obj: bpy.types.Object):

scene = bpy.context.scene
addon_prefs = bfu_basics.GetAddonPrefs()
is_static_mesh = bfu_static_mesh.bfu_static_mesh_utils.is_static_mesh(obj)

# Hide filters
if obj is None:
return
is_static_mesh = bfu_static_mesh.bfu_static_mesh_utils.is_static_mesh(obj)
if addon_prefs.useGeneratedScripts is False:
return
if bfu_utils.GetExportAsProxy(obj):
Expand Down
42 changes: 24 additions & 18 deletions blender-for-unrealengine/bfu_material/bfu_material_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,27 +27,33 @@



def draw_ui_object(layout: bpy.types.UILayout):
if bfu_ui.bfu_ui_utils.DisplayPropertyFilter("OBJECT", "MISC"):
def draw_ui_object(layout: bpy.types.UILayout, obj: bpy.types.Object):

scene = bpy.context.scene
addon_prefs = bfu_basics.GetAddonPrefs()

# Hide filters
if obj is None:
return
if addon_prefs.useGeneratedScripts is False:
return
if obj.bfu_export_type != "export_recursive":
return
if obj.bfu_export_as_lod_mesh:
return

scene = bpy.context.scene
if bfu_ui.bfu_ui_utils.DisplayPropertyFilter("OBJECT", "MISC"):
scene.bfu_object_material_properties_expanded.draw(layout)
if scene.bfu_object_material_properties_expanded.is_expend():

addon_prefs = bfu_basics.GetAddonPrefs()
obj = bpy.context.object
if addon_prefs.useGeneratedScripts and obj is not None:
if obj.bfu_export_type == "export_recursive":
if not obj.bfu_export_as_lod_mesh:
asset_class = bfu_assets_manager.bfu_asset_manager_utils.get_asset_class(obj)
if asset_class and asset_class.use_materials == True:
bfu_material_search_location = layout.column()
bbpl.blender_layout.layout_doc_button.add_doc_page_operator(bfu_material_search_location, text="About Materials", url="https://github.com/xavier150/Blender-For-UnrealEngine-Addons/wiki/Material")
bfu_material_search_location.prop(obj, 'bfu_material_search_location')
bfu_material_search_location.prop(obj, 'bfu_import_materials')
bfu_material_search_location.prop(obj, 'bfu_import_textures')
bfu_material_search_location.prop(obj, 'bfu_flip_normal_map_green_channel')
bfu_material_search_location.prop(obj, 'bfu_reorder_material_to_fbx_order')
asset_class = bfu_assets_manager.bfu_asset_manager_utils.get_asset_class(obj)
if asset_class and asset_class.use_materials == True:
bfu_material_search_location = layout.column()
bbpl.blender_layout.layout_doc_button.add_doc_page_operator(bfu_material_search_location, text="About Materials", url="https://github.com/xavier150/Blender-For-UnrealEngine-Addons/wiki/Material")
bfu_material_search_location.prop(obj, 'bfu_material_search_location')
bfu_material_search_location.prop(obj, 'bfu_import_materials')
bfu_material_search_location.prop(obj, 'bfu_import_textures')
bfu_material_search_location.prop(obj, 'bfu_flip_normal_map_green_channel')
bfu_material_search_location.prop(obj, 'bfu_reorder_material_to_fbx_order')


def draw_ui_scene_collision(layout: bpy.types.UILayout):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,12 @@ def draw_ui_object(layout: bpy.types.UILayout, obj: bpy.types.Object):

scene = bpy.context.scene
addon_prefs = bfu_basics.GetAddonPrefs()
is_skeletal_mesh = bfu_skeletal_mesh.bfu_skeletal_mesh_utils.is_skeletal_mesh(obj)


if obj is None:
return
if obj.type != "ARMATURE":
return
is_skeletal_mesh = bfu_skeletal_mesh.bfu_skeletal_mesh_utils.is_skeletal_mesh(obj)
if is_skeletal_mesh is False:
return
if obj.bfu_export_type != "export_recursive":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ def draw_ui_object(layout: bpy.types.UILayout, obj: bpy.types.Object):

scene = bpy.context.scene
addon_prefs = bfu_basics.GetAddonPrefs()
is_skeletal_mesh = bfu_skeletal_mesh_utils.is_skeletal_mesh(obj)

if obj is None:
return
is_skeletal_mesh = bfu_skeletal_mesh_utils.is_skeletal_mesh(obj)
if obj.type != "ARMATURE":
return
if is_skeletal_mesh is False:
Expand Down
86 changes: 46 additions & 40 deletions blender-for-unrealengine/bfu_vertex_color/bfu_vertex_color_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,51 +26,57 @@



def draw_ui_object(layout: bpy.types.UILayout):
def draw_ui_object(layout: bpy.types.UILayout, obj: bpy.types.Object):

scene = bpy.context.scene
addon_prefs = bfu_basics.GetAddonPrefs()

# Hide filters
if obj is None:
return
if addon_prefs.useGeneratedScripts is False:
return
if obj.bfu_export_type != "export_recursive":
return
if obj.bfu_export_as_lod_mesh:
return

if bfu_ui.bfu_ui_utils.DisplayPropertyFilter("OBJECT", "MISC"):

scene = bpy.context.scene
scene.bfu_object_vertex_color_properties_expanded.draw(layout)
if scene.bfu_object_vertex_color_properties_expanded.is_expend():
# Vertex color
bfu_vertex_color_settings = layout.column()
bbpl.blender_layout.layout_doc_button.add_doc_page_operator(bfu_vertex_color_settings, text="About Vertex Color", url="https://github.com/xavier150/Blender-For-UnrealEngine-Addons/wiki/Vertex-Color")
bfu_vertex_color_settings.prop(obj, 'bfu_vertex_color_import_option')
if obj.bfu_vertex_color_import_option == "OVERRIDE":
bfu_vertex_color_settings_color = bfu_vertex_color_settings.row()
bfu_vertex_color_settings_color.prop(obj, 'bfu_vertex_color_override_color')

if obj.bfu_vertex_color_import_option == "REPLACE":
StaticMeshVertexColorImportOptionIndex = bfu_vertex_color_settings.row()
StaticMeshVertexColorImportOptionIndex.prop(obj, 'bfu_vertex_color_to_use')
if obj.bfu_vertex_color_to_use == "CustomIndex":
StaticMeshVertexColorImportOptionIndexCustom = bfu_vertex_color_settings.row()
StaticMeshVertexColorImportOptionIndexCustom.prop(obj, 'bfu_vertex_color_index_to_use')

addon_prefs = bfu_basics.GetAddonPrefs()
obj = bpy.context.object
if addon_prefs.useGeneratedScripts and obj is not None:
if obj.bfu_export_type == "export_recursive":
if not obj.bfu_export_as_lod_mesh:

# Vertex color
bfu_vertex_color_settings = layout.column()
bbpl.blender_layout.layout_doc_button.add_doc_page_operator(bfu_vertex_color_settings, text="About Vertex Color", url="https://github.com/xavier150/Blender-For-UnrealEngine-Addons/wiki/Vertex-Color")
bfu_vertex_color_settings.prop(obj, 'bfu_vertex_color_import_option')
if obj.bfu_vertex_color_import_option == "OVERRIDE":
bfu_vertex_color_settings_color = bfu_vertex_color_settings.row()
bfu_vertex_color_settings_color.prop(obj, 'bfu_vertex_color_override_color')

if obj.bfu_vertex_color_import_option == "REPLACE":
StaticMeshVertexColorImportOptionIndex = bfu_vertex_color_settings.row()
StaticMeshVertexColorImportOptionIndex.prop(obj, 'bfu_vertex_color_to_use')
if obj.bfu_vertex_color_to_use == "CustomIndex":
StaticMeshVertexColorImportOptionIndexCustom = bfu_vertex_color_settings.row()
StaticMeshVertexColorImportOptionIndexCustom.prop(obj, 'bfu_vertex_color_index_to_use')

StaticMeshVertexColorFeedback = bfu_vertex_color_settings.row()
if obj.type == "MESH":
vced = bfu_vertex_color_utils.VertexColorExportData(obj)
if vced.export_type == "REPLACE":
my_text = f'Vertex color named {vced.name} will be used.'
StaticMeshVertexColorFeedback.label(text=my_text, icon='INFO')
else:
my_text = 'No vertex color found at this index.'
StaticMeshVertexColorFeedback.label(text=my_text, icon='ERROR')
else:
my_text = 'Vertex color property will be applied on the children.'
StaticMeshVertexColorFeedback.label(text=my_text, icon='INFO')

# Add 'colors_type' parameter if Blender version is 3.4 or above
blender_version = bpy.app.version
if blender_version >= (3, 4, 0):
bfu_vertex_color_settings.prop(obj, 'bfu_vertex_color_type')
StaticMeshVertexColorFeedback = bfu_vertex_color_settings.row()
if obj.type == "MESH":
vced = bfu_vertex_color_utils.VertexColorExportData(obj)
if vced.export_type == "REPLACE":
my_text = f'Vertex color named {vced.name} will be used.'
StaticMeshVertexColorFeedback.label(text=my_text, icon='INFO')
else:
my_text = 'No vertex color found at this index.'
StaticMeshVertexColorFeedback.label(text=my_text, icon='ERROR')
else:
my_text = 'Vertex color property will be applied on the children.'
StaticMeshVertexColorFeedback.label(text=my_text, icon='INFO')

# Add 'colors_type' parameter if Blender version is 3.4 or above
blender_version = bpy.app.version
if blender_version >= (3, 4, 0):
bfu_vertex_color_settings.prop(obj, 'bfu_vertex_color_type')


def draw_ui_scene_collision(layout: bpy.types.UILayout):
Expand Down

0 comments on commit 17dcb3f

Please sign in to comment.