feat(Blenvy:Blender): upgreadable components: disable ui for external items

This commit is contained in:
kaosat.dev 2024-06-29 00:56:07 +02:00
parent 547315aadc
commit fb54b0c913
2 changed files with 17 additions and 15 deletions

View File

@ -174,17 +174,17 @@ Blender side:
- [x] prevent attempting to add unexisting components to targets (ie when using the component search) - [x] prevent attempting to add unexisting components to targets (ie when using the component search)
- [x] also for the bulk fix actions - [x] also for the bulk fix actions
- [x] selection of nested objects in collections IS NOT WORKING !!! AHH - [x] selection of nested objects in collections IS NOT WORKING !!! AHH
- [ ] fix/ overhaul upgreadable components - [x] fix/ overhaul upgreadable components
- [x] add listing of upgradeable components for - [x] add listing of upgradeable components for
- [x] meshes - [x] meshes
- [x] materials - [x] materials
- [x] fix display of upgradeaeble components & co - [x] fix display of upgradeaeble components & co
- [x] add clear visual distinction between internal (selectable) & non selectable ones - [x] add clear visual distinction between internal (selectable) & non selectable ones
- [x] do not make selection button available for external blueprints/collections - [x] do not make selection button available for external blueprints/collections
- [ ] perhaps do not show the other buttons & inputs either ? we cannot change the values of an external library file anyway - [x] perhaps do not show the other buttons & inputs either ? we cannot change the values of an external library file anyway
- [ ] BLENVY_OT_item_select is missing handling for the other types (outside of object & collection) - [x] BLENVY_OT_item_select is missing handling for the other types (outside of object & collection)
- [ ] fix selection logic - [x] fix selection logic
- [ ] hidden objects/collections only semi respected at export - [ ] hidden objects/collections only semi respected at export
- this is because blueprints are external ? - this is because blueprints are external ?

View File

@ -339,17 +339,15 @@ class BLENVY_PT_component_tools_panel(bpy.types.Panel):
registry = bpy.context.window_manager.components_registry registry = bpy.context.window_manager.components_registry
registry_has_type_infos = registry.has_type_infos() registry_has_type_infos = registry.has_type_infos()
selected_component = target.components_meta.component_selector selected_component = target.components_meta.component_selector
internal = target.library is None
row = layout.row() row = layout.row()
col = row.column() col = row.column()
selector_text = f"{target.name}({item_type_short})" selector_text = f"{target.name}({item_type_short})"
if target.library is None:
operator = col.operator("blenvy.select_item", text=selector_text, icon="FILE_BLEND") operator = col.operator("blenvy.select_item", text=selector_text, icon="FILE_BLEND")
operator.target_name = target.name operator.target_name = target.name
operator.item_type = item_type operator.item_type = item_type
else: col.enabled = internal
col.label(text=selector_text, icon="LIBRARY_DATA_DIRECT")
col = row.column() col = row.column()
col.label(text=status) col.label(text=status)
@ -358,9 +356,12 @@ class BLENVY_PT_component_tools_panel(bpy.types.Panel):
col.label(text=component_name) col.label(text=component_name)
col = row.column() col = row.column()
if internal:
# each components_meta has a component selector to pick components from # each components_meta has a component selector to pick components from
components_meta = target.components_meta components_meta = target.components_meta
col.prop(components_meta, "component_selector", text="") col.prop(components_meta, "component_selector", text="")
else:
col.label(text="external, cannot edit")
col = row.column() col = row.column()
@ -369,7 +370,7 @@ class BLENVY_PT_component_tools_panel(bpy.types.Panel):
operator.original_name = component_name operator.original_name = component_name
operator.target_items = json.dumps([(target.name, item_type)]) # tupple operator.target_items = json.dumps([(target.name, item_type)]) # tupple
operator.target_name = target_component_name operator.target_name = target_component_name
col.enabled = registry_has_type_infos and component_name != "" and target_component_name != "" and component_name != target_component_name col.enabled = internal and registry_has_type_infos and component_name != "" and target_component_name != "" and component_name != target_component_name
col = row.column() col = row.column()
@ -377,6 +378,7 @@ class BLENVY_PT_component_tools_panel(bpy.types.Panel):
operator.item_name = target.name operator.item_name = target.name
operator.component_name = component_name operator.component_name = component_name
operator.item_type = get_selection_type(target) operator.item_type = get_selection_type(target)
col.enabled = internal
def draw_invalid_items(self, layout, upgreadable_entries): def draw_invalid_items(self, layout, upgreadable_entries):
for entry in upgreadable_entries: for entry in upgreadable_entries: