feat(Blenvy): renaming/coherency & component workflow pass
* all operators, panels etc are now respecting the Blender naming convention * tweaks & improvements to some of the component operators * clearer naming for the "advanced" tools for components
This commit is contained in:
parent
9cb0c6262e
commit
b424a73a46
|
@ -55,8 +55,8 @@ Components:
|
||||||
- [x] add
|
- [x] add
|
||||||
- [x] remove
|
- [x] remove
|
||||||
- [x] copy & paste
|
- [x] copy & paste
|
||||||
- [ ] OT_rename_component
|
- [ ] BLENVY_OT_component_rename_component
|
||||||
- [ ] Fix_Component_Operator
|
- [x] BLENVY_OT_component_fix
|
||||||
- [ ] add handling for core::ops::Range<f32> & other ranges
|
- [ ] add handling for core::ops::Range<f32> & other ranges
|
||||||
- [x] fix is_component_valid that is used in gltf_auto_export
|
- [x] fix is_component_valid that is used in gltf_auto_export
|
||||||
- Hashmap Support
|
- Hashmap Support
|
||||||
|
@ -78,7 +78,7 @@ Components:
|
||||||
-> see in registry ui "for custom_property in object.keys():"
|
-> see in registry ui "for custom_property in object.keys():"
|
||||||
|
|
||||||
- [x] overhaul / improve the component selector (with built in searching, etc)
|
- [x] overhaul / improve the component selector (with built in searching, etc)
|
||||||
- [ ] remove select_component_name_to_replace
|
- [x] remove select_component_name_to_replace
|
||||||
|
|
||||||
|
|
||||||
General things to solve:
|
General things to solve:
|
||||||
|
@ -139,4 +139,16 @@ General issues:
|
||||||
- [ ] rename repo to "Blenvy"
|
- [ ] rename repo to "Blenvy"
|
||||||
|
|
||||||
|
|
||||||
|
- [ ] simplify testing example:
|
||||||
|
- [ ] remove use of rapier physics (or even the whole common boilerplate ?)
|
||||||
|
- [ ] remove/replace bevy editor pls with some native ui to display hierarchies
|
||||||
|
- [ ] switch to bevy rc2
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
- [ ] overall cleanup
|
||||||
|
- [ ] object.add_bevy_component => blenvy.component_add
|
||||||
|
|
||||||
clear && pytest -svv --blender-template ../../testing/bevy_example/art/testing_library.blend --blender-executable /home/ckaos/tools/blender/blender-4.1.0-linux-x64/blender tests/test_bevy_integration_prepare.py && pytest -svv --blender-executable /home/ckaos/tools/blender/blender-4.1.0-linux-x64/blender tests/test_bevy_integration.py
|
clear && pytest -svv --blender-template ../../testing/bevy_example/art/testing_library.blend --blender-executable /home/ckaos/tools/blender/blender-4.1.0-linux-x64/blender tests/test_bevy_integration_prepare.py && pytest -svv --blender-executable /home/ckaos/tools/blender/blender-4.1.0-linux-x64/blender tests/test_bevy_integration.py
|
|
@ -199,7 +199,7 @@ UI:
|
||||||
|
|
||||||
- [x] remove metadata when deleting components
|
- [x] remove metadata when deleting components
|
||||||
- [x] add try catch around custom_prop => propGroup
|
- [x] add try catch around custom_prop => propGroup
|
||||||
- [x] enhance the GenerateComponent_From_custom_property_Operator to use the new system to actually generate the stuff
|
- [x] enhance the BLENVY_OT_component_from_custom_property to use the new system to actually generate the stuff
|
||||||
|
|
||||||
- coherence in operators:
|
- coherence in operators:
|
||||||
- component_name vs component_type
|
- component_name vs component_type
|
||||||
|
|
|
@ -17,15 +17,16 @@ from bpy.props import (StringProperty)
|
||||||
|
|
||||||
|
|
||||||
# components management
|
# components management
|
||||||
from .add_ons.bevy_components.components.operators import CopyComponentOperator, Fix_Component_Operator, OT_rename_component, RemoveComponentFromAllItemsOperator, RemoveComponentOperator, GenerateComponent_From_custom_property_Operator, PasteComponentOperator, AddComponentOperator, RenameHelper, Toggle_ComponentVisibility
|
from .add_ons.bevy_components.components.operators import BLENVY_OT_component_copy, BLENVY_OT_component_fix, BLENVY_OT_component_rename_component, BLENVY_OT_component_remove_from_all_items, BLENVY_OT_component_remove, BLENVY_OT_component_from_custom_property, BLENVY_OT_component_paste, BLENVY_OT_component_add, RenameHelper, BLENVY_OT_component_toggle_visibility
|
||||||
from .add_ons.bevy_components.registry.registry import ComponentsRegistry,MissingBevyType
|
from .add_ons.bevy_components.registry.registry import ComponentsRegistry,MissingBevyType
|
||||||
from .add_ons.bevy_components.registry.operators import (COMPONENTS_OT_REFRESH_CUSTOM_PROPERTIES_ALL, COMPONENTS_OT_REFRESH_CUSTOM_PROPERTIES_CURRENT, COMPONENTS_OT_REFRESH_PROPGROUPS_FROM_CUSTOM_PROPERTIES_ALL, COMPONENTS_OT_REFRESH_PROPGROUPS_FROM_CUSTOM_PROPERTIES_CURRENT, OT_select_component_name_to_replace, OT_select_object, ReloadRegistryOperator, OT_OpenSchemaFileBrowser)
|
from .add_ons.bevy_components.registry.operators import (BLENVY_OT_components_refresh_custom_properties_all, BLENVY_OT_components_refresh_custom_properties_current, BLENVY_OT_components_refresh_propgroups_all, BLENVY_OT_components_refresh_propgroups_current, BLENVY_OT_components_registry_reload, BLENVY_OT_components_registry_browse_schema)
|
||||||
from .add_ons.bevy_components.registry.ui import (BEVY_COMPONENTS_PT_Configuration, BEVY_COMPONENTS_PT_AdvancedToolsPanel, BEVY_COMPONENTS_PT_MissingTypesPanel, MISSING_TYPES_UL_List)
|
from .add_ons.bevy_components.registry.ui import (BLENVY_PT_components_missing_types_panel, BLENVY_UL_components_missing_types)
|
||||||
from .add_ons.bevy_components.components.metadata import (ComponentMetadata, ComponentsMeta)
|
from .add_ons.bevy_components.components.metadata import (ComponentMetadata, ComponentsMeta)
|
||||||
from .add_ons.bevy_components.components.lists import GENERIC_LIST_OT_actions, Generic_LIST_OT_AddItem, Generic_LIST_OT_RemoveItem, Generic_LIST_OT_SelectItem
|
from .add_ons.bevy_components.components.lists import BLENVY_OT_component_list_actions, BLENVY_OT_component_list_add_item, BLENVY_OT_component_list_remove_item, BLENVY_OT_component_list_select_item
|
||||||
from .add_ons.bevy_components.components.maps import GENERIC_MAP_OT_actions
|
from .add_ons.bevy_components.components.maps import BLENVY_OT_component_map_actions
|
||||||
from .add_ons.bevy_components.components.ui import (BEVY_COMPONENTS_PT_ComponentsPanel)
|
from .add_ons.bevy_components.components.ui import BLENVY_PT_components_panel, BLENVY_PT_component_tools_panel
|
||||||
from .add_ons.bevy_components.settings import ComponentsSettings
|
from .add_ons.bevy_components.settings import ComponentsSettings
|
||||||
|
from .add_ons.bevy_components.utils import BLENVY_OT_object_select
|
||||||
|
|
||||||
# auto export
|
# auto export
|
||||||
from .add_ons.auto_export import gltf_post_export_callback
|
from .add_ons.auto_export import gltf_post_export_callback
|
||||||
|
@ -33,25 +34,25 @@ from .add_ons.auto_export.common.tracker import AutoExportTracker
|
||||||
from .add_ons.auto_export.settings import AutoExportSettings
|
from .add_ons.auto_export.settings import AutoExportSettings
|
||||||
|
|
||||||
# asset management
|
# asset management
|
||||||
from .assets.ui import Blenvy_assets
|
from .assets.ui import BLENVY_PT_assets_panel
|
||||||
from .assets.assets_registry import Asset, AssetsRegistry
|
from .assets.assets_registry import Asset, AssetsRegistry
|
||||||
from .assets.operators import OT_Add_asset_filebrowser, OT_add_bevy_asset, OT_remove_bevy_asset, OT_test_bevy_assets
|
from .assets.operators import BLENVY_OT_assets_browse, BLENVY_OT_assets_add, BLENVY_OT_assets_remove, BLENVY_OT_assets_generate_files
|
||||||
|
|
||||||
# levels management
|
# levels management
|
||||||
from .levels.ui import Blenvy_levels
|
from .levels.ui import BLENVY_PT_levels_panel
|
||||||
from .levels.operators import OT_select_level
|
from .levels.operators import BLENVY_OT_level_select
|
||||||
|
|
||||||
# blueprints management
|
# blueprints management
|
||||||
from .blueprints.ui import GLTF_PT_auto_export_blueprints_list
|
from .blueprints.ui import BLENVY_PT_blueprints_panel
|
||||||
from .blueprints.blueprints_registry import BlueprintsRegistry
|
from .blueprints.blueprints_registry import BlueprintsRegistry
|
||||||
from .blueprints.operators import OT_select_blueprint
|
from .blueprints.operators import BLENVY_OT_blueprint_select
|
||||||
|
|
||||||
# blenvy core
|
# blenvy core
|
||||||
from .core.blenvy_manager import BlenvyManager
|
from .core.blenvy_manager import BlenvyManager
|
||||||
from .core.operators import OT_switch_bevy_tooling
|
from .core.operators import BLENVY_OT_tooling_switch
|
||||||
from .core.ui.ui import (BLENVY_PT_SidePanel)
|
from .core.ui.ui import (BLENVY_PT_SidePanel)
|
||||||
from .core.ui.scenes_list import SCENES_LIST_OT_actions
|
from .core.ui.scenes_list import BLENVY_OT_scenes_list_actions
|
||||||
from .core.ui.assets_folder_browser import OT_OpenAssetsFolderBrowser
|
from .assets.assets_folder_browser import BLENVY_OT_assets_paths_browse
|
||||||
|
|
||||||
|
|
||||||
# this needs to be here, as it is how Blender's gltf exporter callbacks are defined, at the add-on root level
|
# this needs to be here, as it is how Blender's gltf exporter callbacks are defined, at the add-on root level
|
||||||
|
@ -61,55 +62,50 @@ def glTF2_post_export_callback(data):
|
||||||
|
|
||||||
classes = [
|
classes = [
|
||||||
# common/core
|
# common/core
|
||||||
SCENES_LIST_OT_actions,
|
BLENVY_OT_scenes_list_actions,
|
||||||
OT_OpenAssetsFolderBrowser,
|
BLENVY_OT_assets_paths_browse,
|
||||||
|
|
||||||
# blenvy
|
# blenvy
|
||||||
BLENVY_PT_SidePanel,
|
BLENVY_PT_SidePanel,
|
||||||
|
|
||||||
# bevy components
|
# bevy components
|
||||||
ComponentsSettings,
|
ComponentsSettings,
|
||||||
AddComponentOperator,
|
BLENVY_OT_component_add,
|
||||||
CopyComponentOperator,
|
BLENVY_OT_component_copy,
|
||||||
PasteComponentOperator,
|
BLENVY_OT_component_paste,
|
||||||
RemoveComponentOperator,
|
BLENVY_OT_component_remove,
|
||||||
RemoveComponentFromAllItemsOperator,
|
BLENVY_OT_component_remove_from_all_items,
|
||||||
Fix_Component_Operator,
|
BLENVY_OT_component_fix,
|
||||||
OT_rename_component,
|
BLENVY_OT_component_rename_component,
|
||||||
RenameHelper,
|
RenameHelper,
|
||||||
GenerateComponent_From_custom_property_Operator,
|
BLENVY_OT_component_from_custom_property,
|
||||||
Toggle_ComponentVisibility,
|
BLENVY_OT_component_toggle_visibility,
|
||||||
|
|
||||||
ComponentMetadata,
|
ComponentMetadata,
|
||||||
ComponentsMeta,
|
ComponentsMeta,
|
||||||
MissingBevyType,
|
MissingBevyType,
|
||||||
ComponentsRegistry,
|
ComponentsRegistry,
|
||||||
|
|
||||||
OT_OpenSchemaFileBrowser,
|
BLENVY_OT_components_registry_browse_schema,
|
||||||
ReloadRegistryOperator,
|
BLENVY_OT_components_registry_reload,
|
||||||
COMPONENTS_OT_REFRESH_CUSTOM_PROPERTIES_ALL,
|
BLENVY_OT_components_refresh_custom_properties_all,
|
||||||
COMPONENTS_OT_REFRESH_CUSTOM_PROPERTIES_CURRENT,
|
BLENVY_OT_components_refresh_custom_properties_current,
|
||||||
|
|
||||||
COMPONENTS_OT_REFRESH_PROPGROUPS_FROM_CUSTOM_PROPERTIES_ALL,
|
BLENVY_OT_components_refresh_propgroups_all,
|
||||||
COMPONENTS_OT_REFRESH_PROPGROUPS_FROM_CUSTOM_PROPERTIES_CURRENT,
|
BLENVY_OT_components_refresh_propgroups_current,
|
||||||
|
|
||||||
OT_select_object,
|
BLENVY_OT_object_select,
|
||||||
OT_select_component_name_to_replace,
|
|
||||||
|
|
||||||
BEVY_COMPONENTS_PT_ComponentsPanel,
|
BLENVY_PT_components_panel,
|
||||||
BEVY_COMPONENTS_PT_AdvancedToolsPanel,
|
BLENVY_PT_component_tools_panel,
|
||||||
#BEVY_COMPONENTS_PT_Configuration,
|
BLENVY_UL_components_missing_types,
|
||||||
|
BLENVY_PT_components_missing_types_panel,
|
||||||
MISSING_TYPES_UL_List,
|
|
||||||
BEVY_COMPONENTS_PT_MissingTypesPanel,
|
|
||||||
|
|
||||||
Generic_LIST_OT_SelectItem,
|
|
||||||
Generic_LIST_OT_AddItem,
|
|
||||||
Generic_LIST_OT_RemoveItem,
|
|
||||||
GENERIC_LIST_OT_actions,
|
|
||||||
|
|
||||||
GENERIC_MAP_OT_actions,
|
|
||||||
|
|
||||||
|
BLENVY_OT_component_list_select_item,
|
||||||
|
BLENVY_OT_component_list_add_item,
|
||||||
|
BLENVY_OT_component_list_remove_item,
|
||||||
|
BLENVY_OT_component_list_actions,
|
||||||
|
BLENVY_OT_component_map_actions,
|
||||||
|
|
||||||
# gltf auto export
|
# gltf auto export
|
||||||
AutoExportTracker,
|
AutoExportTracker,
|
||||||
|
@ -117,22 +113,22 @@ classes = [
|
||||||
|
|
||||||
# blenvy
|
# blenvy
|
||||||
BlenvyManager,
|
BlenvyManager,
|
||||||
OT_switch_bevy_tooling,
|
BLENVY_OT_tooling_switch,
|
||||||
|
|
||||||
Asset,
|
Asset,
|
||||||
AssetsRegistry,
|
AssetsRegistry,
|
||||||
OT_add_bevy_asset,
|
BLENVY_OT_assets_add,
|
||||||
OT_remove_bevy_asset,
|
BLENVY_OT_assets_remove,
|
||||||
OT_test_bevy_assets,
|
BLENVY_OT_assets_generate_files,
|
||||||
OT_Add_asset_filebrowser,
|
BLENVY_OT_assets_browse,
|
||||||
Blenvy_assets,
|
BLENVY_PT_assets_panel,
|
||||||
|
|
||||||
Blenvy_levels,
|
BLENVY_PT_levels_panel,
|
||||||
OT_select_level,
|
BLENVY_OT_level_select,
|
||||||
|
|
||||||
BlueprintsRegistry,
|
BlueprintsRegistry,
|
||||||
OT_select_blueprint,
|
BLENVY_OT_blueprint_select,
|
||||||
GLTF_PT_auto_export_blueprints_list,
|
BLENVY_PT_blueprints_panel,
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,9 @@ import json
|
||||||
from bpy_types import Operator, UIList
|
from bpy_types import Operator, UIList
|
||||||
from bpy.props import (StringProperty, EnumProperty, PointerProperty, FloatVectorProperty, IntProperty)
|
from bpy.props import (StringProperty, EnumProperty, PointerProperty, FloatVectorProperty, IntProperty)
|
||||||
|
|
||||||
class Generic_LIST_OT_AddItem(Operator):
|
class BLENVY_OT_component_list_add_item(Operator):
|
||||||
"""Add a new item to the list."""
|
"""Add a new item to the list."""
|
||||||
bl_idname = "generic_list.add_item"
|
bl_idname = "blenvy.component_list_add_item"
|
||||||
bl_label = "Add a new item"
|
bl_label = "Add a new item"
|
||||||
|
|
||||||
property_group_path: StringProperty(
|
property_group_path: StringProperty(
|
||||||
|
@ -39,9 +39,9 @@ class Generic_LIST_OT_AddItem(Operator):
|
||||||
return{'FINISHED'}
|
return{'FINISHED'}
|
||||||
|
|
||||||
|
|
||||||
class Generic_LIST_OT_RemoveItem(Operator):
|
class BLENVY_OT_component_list_remove_item(Operator):
|
||||||
"""Remove an item to the list."""
|
"""Remove an item to the list."""
|
||||||
bl_idname = "generic_list.remove_item"
|
bl_idname = "blenvy.component_list_remove_item"
|
||||||
bl_label = "Remove selected item"
|
bl_label = "Remove selected item"
|
||||||
|
|
||||||
property_group_path: StringProperty(
|
property_group_path: StringProperty(
|
||||||
|
@ -72,9 +72,9 @@ class Generic_LIST_OT_RemoveItem(Operator):
|
||||||
return{'FINISHED'}
|
return{'FINISHED'}
|
||||||
|
|
||||||
|
|
||||||
class Generic_LIST_OT_SelectItem(Operator):
|
class BLENVY_OT_component_list_select_item(Operator):
|
||||||
"""Remove an item to the list."""
|
"""Remove an item to the list."""
|
||||||
bl_idname = "generic_list.select_item"
|
bl_idname = "blenvy.component_list_select_item"
|
||||||
bl_label = "select an item"
|
bl_label = "select an item"
|
||||||
|
|
||||||
|
|
||||||
|
@ -109,9 +109,9 @@ class Generic_LIST_OT_SelectItem(Operator):
|
||||||
return{'FINISHED'}
|
return{'FINISHED'}
|
||||||
|
|
||||||
|
|
||||||
class GENERIC_LIST_OT_actions(Operator):
|
class BLENVY_OT_component_list_actions(Operator):
|
||||||
"""Move items up and down, add and remove"""
|
"""Move items up and down, add and remove"""
|
||||||
bl_idname = "generic_list.list_action"
|
bl_idname = "blenvy.component_list_actions"
|
||||||
bl_label = "List Actions"
|
bl_label = "List Actions"
|
||||||
bl_description = "Move items up and down, add and remove"
|
bl_description = "Move items up and down, add and remove"
|
||||||
bl_options = {'REGISTER', 'UNDO'}
|
bl_options = {'REGISTER', 'UNDO'}
|
||||||
|
|
|
@ -4,9 +4,9 @@ from bpy.props import (StringProperty, EnumProperty, PointerProperty, FloatVecto
|
||||||
|
|
||||||
from ..propGroups.conversions_from_prop_group import property_group_value_to_custom_property_value
|
from ..propGroups.conversions_from_prop_group import property_group_value_to_custom_property_value
|
||||||
|
|
||||||
class GENERIC_MAP_OT_actions(Operator):
|
class BLENVY_OT_component_map_actions(Operator):
|
||||||
"""Move items up and down, add and remove"""
|
"""Move items up and down, add and remove"""
|
||||||
bl_idname = "generic_map.map_action"
|
bl_idname = "blenvy.component_map_actions"
|
||||||
bl_label = "Map Actions"
|
bl_label = "Map Actions"
|
||||||
bl_description = "Move items up and down, add and remove"
|
bl_description = "Move items up and down, add and remove"
|
||||||
bl_options = {'REGISTER', 'UNDO'}
|
bl_options = {'REGISTER', 'UNDO'}
|
||||||
|
|
|
@ -7,9 +7,9 @@ from bpy.props import (StringProperty)
|
||||||
from .metadata import add_component_from_custom_property, add_component_to_item, apply_propertyGroup_values_to_item_customProperties_for_component, copy_propertyGroup_values_to_another_item, get_bevy_component_value_by_long_name, get_bevy_components, is_bevy_component_in_item, remove_component_from_item, rename_component, toggle_component
|
from .metadata import add_component_from_custom_property, add_component_to_item, apply_propertyGroup_values_to_item_customProperties_for_component, copy_propertyGroup_values_to_another_item, get_bevy_component_value_by_long_name, get_bevy_components, is_bevy_component_in_item, remove_component_from_item, rename_component, toggle_component
|
||||||
from ..utils import get_selected_object_or_collection
|
from ..utils import get_selected_object_or_collection
|
||||||
|
|
||||||
class AddComponentOperator(Operator):
|
class BLENVY_OT_component_add(Operator):
|
||||||
"""Add Bevy component to object/collection"""
|
"""Add Bevy component to object/collection"""
|
||||||
bl_idname = "object.add_bevy_component"
|
bl_idname = "blenvy.component_add"
|
||||||
bl_label = "Add component to object/collection Operator"
|
bl_label = "Add component to object/collection Operator"
|
||||||
bl_options = {"UNDO"}
|
bl_options = {"UNDO"}
|
||||||
|
|
||||||
|
@ -30,9 +30,9 @@ class AddComponentOperator(Operator):
|
||||||
|
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
class CopyComponentOperator(Operator):
|
class BLENVY_OT_component_copy(Operator):
|
||||||
"""Copy Bevy component from object"""
|
"""Copy Bevy component from object"""
|
||||||
bl_idname = "object.copy_bevy_component"
|
bl_idname = "blenvy.component_copy"
|
||||||
bl_label = "Copy component Operator"
|
bl_label = "Copy component Operator"
|
||||||
bl_options = {"UNDO"}
|
bl_options = {"UNDO"}
|
||||||
|
|
||||||
|
@ -75,10 +75,10 @@ class CopyComponentOperator(Operator):
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
|
||||||
class PasteComponentOperator(Operator):
|
class BLENVY_OT_component_paste(Operator):
|
||||||
"""Paste Bevy component to object"""
|
"""Paste Bevy component to object"""
|
||||||
bl_idname = "object.paste_bevy_component"
|
bl_idname = "blenvy.component_paste"
|
||||||
bl_label = "Paste component to object Operator"
|
bl_label = "Paste component to item Operator"
|
||||||
bl_options = {"UNDO"}
|
bl_options = {"UNDO"}
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
|
@ -104,9 +104,9 @@ class PasteComponentOperator(Operator):
|
||||||
|
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
class RemoveComponentOperator(Operator):
|
class BLENVY_OT_component_remove(Operator):
|
||||||
"""Remove Bevy component from object/collection"""
|
"""Remove Bevy component from object/collection"""
|
||||||
bl_idname = "object.remove_bevy_component"
|
bl_idname = "blenvy.component_remove"
|
||||||
bl_label = "Remove component from object/collection Operator"
|
bl_label = "Remove component from object/collection Operator"
|
||||||
bl_options = {"UNDO"}
|
bl_options = {"UNDO"}
|
||||||
|
|
||||||
|
@ -149,9 +149,9 @@ class RemoveComponentOperator(Operator):
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
|
||||||
class RemoveComponentFromAllItemsOperator(Operator):
|
class BLENVY_OT_component_remove_from_all_items(Operator):
|
||||||
"""Remove Bevy component from all items"""
|
"""Remove Bevy component from all items"""
|
||||||
bl_idname = "object.remove_bevy_component_all"
|
bl_idname = "blenvy.component_remove_from_all_items"
|
||||||
bl_label = "Remove component from all items Operator"
|
bl_label = "Remove component from all items Operator"
|
||||||
bl_options = {"UNDO"}
|
bl_options = {"UNDO"}
|
||||||
|
|
||||||
|
@ -210,9 +210,9 @@ class RenameHelper(bpy.types.PropertyGroup):
|
||||||
# remove handlers & co
|
# remove handlers & co
|
||||||
del bpy.types.WindowManager.bevy_component_rename_helper
|
del bpy.types.WindowManager.bevy_component_rename_helper
|
||||||
|
|
||||||
class OT_rename_component(Operator):
|
class BLENVY_OT_component_rename_component(Operator):
|
||||||
"""Rename Bevy component"""
|
"""Rename Bevy component"""
|
||||||
bl_idname = "object.rename_bevy_component"
|
bl_idname = "blenvy.component_rename"
|
||||||
bl_label = "rename component"
|
bl_label = "rename component"
|
||||||
bl_options = {"UNDO"}
|
bl_options = {"UNDO"}
|
||||||
|
|
||||||
|
@ -286,9 +286,9 @@ class OT_rename_component(Operator):
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
|
||||||
class GenerateComponent_From_custom_property_Operator(Operator):
|
class BLENVY_OT_component_from_custom_property(Operator):
|
||||||
"""Generate Bevy components from custom property"""
|
"""Generate Bevy components from custom property"""
|
||||||
bl_idname = "object.generate_bevy_component_from_custom_property"
|
bl_idname = "blenvy.component_from_custom_property"
|
||||||
bl_label = "Generate component from custom_property Operator"
|
bl_label = "Generate component from custom_property Operator"
|
||||||
bl_options = {"UNDO"}
|
bl_options = {"UNDO"}
|
||||||
|
|
||||||
|
@ -312,9 +312,9 @@ class GenerateComponent_From_custom_property_Operator(Operator):
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
|
||||||
class Fix_Component_Operator(Operator):
|
class BLENVY_OT_component_fix(Operator):
|
||||||
"""Attempt to fix Bevy component"""
|
"""Attempt to fix Bevy component"""
|
||||||
bl_idname = "object.fix_bevy_component"
|
bl_idname = "blenvy.component_fix"
|
||||||
bl_label = "Fix component (attempts to)"
|
bl_label = "Fix component (attempts to)"
|
||||||
bl_options = {"UNDO"}
|
bl_options = {"UNDO"}
|
||||||
|
|
||||||
|
@ -337,9 +337,9 @@ class Fix_Component_Operator(Operator):
|
||||||
self.report({'INFO'}, "Sucessfully fixed component (please double check component & its custom property value)")
|
self.report({'INFO'}, "Sucessfully fixed component (please double check component & its custom property value)")
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
class Toggle_ComponentVisibility(Operator):
|
class BLENVY_OT_component_toggle_visibility(Operator):
|
||||||
"""Toggle Bevy component's visibility"""
|
"""Toggle Bevy component's visibility"""
|
||||||
bl_idname = "object.toggle_bevy_component_visibility"
|
bl_idname = "blenvy.component_toggle_visibility"
|
||||||
bl_label = "Toggle component visibility"
|
bl_label = "Toggle component visibility"
|
||||||
bl_options = {"UNDO"}
|
bl_options = {"UNDO"}
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,12 @@ import json
|
||||||
import bpy
|
import bpy
|
||||||
|
|
||||||
from ..utils import get_selection_type
|
from ..utils import get_selection_type
|
||||||
from ..registry.operators import COMPONENTS_OT_REFRESH_CUSTOM_PROPERTIES_CURRENT
|
|
||||||
from .metadata import do_item_custom_properties_have_missing_metadata, get_bevy_components
|
from .metadata import do_item_custom_properties_have_missing_metadata, get_bevy_components
|
||||||
from .operators import AddComponentOperator, CopyComponentOperator, Fix_Component_Operator, RemoveComponentOperator, GenerateComponent_From_custom_property_Operator, PasteComponentOperator, Toggle_ComponentVisibility
|
from .operators import BLENVY_OT_component_add, BLENVY_OT_component_copy, BLENVY_OT_component_fix, BLENVY_OT_component_remove, BLENVY_OT_component_paste, BLENVY_OT_component_toggle_visibility
|
||||||
|
|
||||||
|
from ..utils import get_selection_type
|
||||||
|
|
||||||
|
|
||||||
def draw_propertyGroup( propertyGroup, layout, nesting =[], rootName=None):
|
def draw_propertyGroup( propertyGroup, layout, nesting =[], rootName=None):
|
||||||
is_enum = getattr(propertyGroup, "with_enum")
|
is_enum = getattr(propertyGroup, "with_enum")
|
||||||
is_list = getattr(propertyGroup, "with_list")
|
is_list = getattr(propertyGroup, "with_list")
|
||||||
|
@ -47,7 +49,7 @@ def draw_propertyGroup( propertyGroup, layout, nesting =[], rootName=None):
|
||||||
row = list_column.row()
|
row = list_column.row()
|
||||||
draw_propertyGroup(item, row, nesting, rootName)
|
draw_propertyGroup(item, row, nesting, rootName)
|
||||||
icon = 'CHECKBOX_HLT' if list_index == index else 'CHECKBOX_DEHLT'
|
icon = 'CHECKBOX_HLT' if list_index == index else 'CHECKBOX_DEHLT'
|
||||||
op = row.operator('generic_list.select_item', icon=icon, text="")
|
op = row.operator('blenvy.component_list_select_item', icon=icon, text="")
|
||||||
op.component_name = rootName
|
op.component_name = rootName
|
||||||
op.property_group_path = json.dumps(nesting)
|
op.property_group_path = json.dumps(nesting)
|
||||||
op.selection_index = index
|
op.selection_index = index
|
||||||
|
@ -55,26 +57,26 @@ def draw_propertyGroup( propertyGroup, layout, nesting =[], rootName=None):
|
||||||
#various control buttons
|
#various control buttons
|
||||||
buttons_column.separator()
|
buttons_column.separator()
|
||||||
row = buttons_column.row()
|
row = buttons_column.row()
|
||||||
op = row.operator('generic_list.list_action', icon='ADD', text="")
|
op = row.operator('blenvy.component_list_actions', icon='ADD', text="")
|
||||||
op.action = 'ADD'
|
op.action = 'ADD'
|
||||||
op.component_name = rootName
|
op.component_name = rootName
|
||||||
op.property_group_path = json.dumps(nesting)
|
op.property_group_path = json.dumps(nesting)
|
||||||
|
|
||||||
row = buttons_column.row()
|
row = buttons_column.row()
|
||||||
op = row.operator('generic_list.list_action', icon='REMOVE', text="")
|
op = row.operator('blenvy.component_list_actions', icon='REMOVE', text="")
|
||||||
op.action = 'REMOVE'
|
op.action = 'REMOVE'
|
||||||
op.component_name = rootName
|
op.component_name = rootName
|
||||||
op.property_group_path = json.dumps(nesting)
|
op.property_group_path = json.dumps(nesting)
|
||||||
|
|
||||||
buttons_column.separator()
|
buttons_column.separator()
|
||||||
row = buttons_column.row()
|
row = buttons_column.row()
|
||||||
op = row.operator('generic_list.list_action', icon='TRIA_UP', text="")
|
op = row.operator('blenvy.component_list_actions', icon='TRIA_UP', text="")
|
||||||
op.action = 'UP'
|
op.action = 'UP'
|
||||||
op.component_name = rootName
|
op.component_name = rootName
|
||||||
op.property_group_path = json.dumps(nesting)
|
op.property_group_path = json.dumps(nesting)
|
||||||
|
|
||||||
row = buttons_column.row()
|
row = buttons_column.row()
|
||||||
op = row.operator('generic_list.list_action', icon='TRIA_DOWN', text="")
|
op = row.operator('blenvy.component_list_actions', icon='TRIA_DOWN', text="")
|
||||||
op.action = 'DOWN'
|
op.action = 'DOWN'
|
||||||
op.component_name = rootName
|
op.component_name = rootName
|
||||||
op.property_group_path = json.dumps(nesting)
|
op.property_group_path = json.dumps(nesting)
|
||||||
|
@ -93,7 +95,7 @@ def draw_propertyGroup( propertyGroup, layout, nesting =[], rootName=None):
|
||||||
values_setter = getattr(propertyGroup, "values_setter")
|
values_setter = getattr(propertyGroup, "values_setter")
|
||||||
draw_propertyGroup(values_setter, row, nesting, rootName)
|
draw_propertyGroup(values_setter, row, nesting, rootName)
|
||||||
|
|
||||||
op = row.operator('generic_map.map_action', icon='ADD', text="")
|
op = row.operator('blenvy.component_map_actions', icon='ADD', text="")
|
||||||
op.action = 'ADD'
|
op.action = 'ADD'
|
||||||
op.component_name = rootName
|
op.component_name = rootName
|
||||||
op.property_group_path = json.dumps(nesting)
|
op.property_group_path = json.dumps(nesting)
|
||||||
|
@ -110,7 +112,7 @@ def draw_propertyGroup( propertyGroup, layout, nesting =[], rootName=None):
|
||||||
value = values_list[index]
|
value = values_list[index]
|
||||||
draw_propertyGroup(value, row, nesting, rootName)
|
draw_propertyGroup(value, row, nesting, rootName)
|
||||||
|
|
||||||
op = row.operator('generic_map.map_action', icon='REMOVE', text="")
|
op = row.operator('blenvy.component_map_actions', icon='REMOVE', text="")
|
||||||
op.action = 'REMOVE'
|
op.action = 'REMOVE'
|
||||||
op.component_name = rootName
|
op.component_name = rootName
|
||||||
op.property_group_path = json.dumps(nesting)
|
op.property_group_path = json.dumps(nesting)
|
||||||
|
@ -143,8 +145,8 @@ def draw_propertyGroup( propertyGroup, layout, nesting =[], rootName=None):
|
||||||
subrow.separator()
|
subrow.separator()
|
||||||
|
|
||||||
|
|
||||||
class BEVY_COMPONENTS_PT_ComponentsPanel(bpy.types.Panel):
|
class BLENVY_PT_components_panel(bpy.types.Panel):
|
||||||
bl_idname = "BEVY_COMPONENTS_PT_ComponentsPanel"
|
bl_idname = "BLENVY_PT_components_panel"
|
||||||
bl_label = ""
|
bl_label = ""
|
||||||
bl_space_type = 'VIEW_3D'
|
bl_space_type = 'VIEW_3D'
|
||||||
bl_region_type = 'UI'
|
bl_region_type = 'UI'
|
||||||
|
@ -199,7 +201,7 @@ def draw_component_ui(layout, object_or_collection, registry, selected_component
|
||||||
|
|
||||||
# add components
|
# add components
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
op = row.operator(AddComponentOperator.bl_idname, text="Add", icon="ADD")
|
op = row.operator(BLENVY_OT_component_add.bl_idname, text="Add", icon="ADD")
|
||||||
op.component_type = selected_component
|
op.component_type = selected_component
|
||||||
row.enabled = selected_component != ''
|
row.enabled = selected_component != ''
|
||||||
|
|
||||||
|
@ -207,7 +209,7 @@ def draw_component_ui(layout, object_or_collection, registry, selected_component
|
||||||
|
|
||||||
# paste components
|
# paste components
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
row.operator(PasteComponentOperator.bl_idname, text="Paste component ("+bpy.context.window_manager.copied_source_component_name+")", icon="PASTEDOWN")
|
row.operator(BLENVY_OT_component_paste.bl_idname, text="Paste component ("+bpy.context.window_manager.copied_source_component_name+")", icon="PASTEDOWN")
|
||||||
row.enabled = registry_has_type_infos and context.window_manager.copied_source_item_name != ''
|
row.enabled = registry_has_type_infos and context.window_manager.copied_source_item_name != ''
|
||||||
|
|
||||||
layout.separator()
|
layout.separator()
|
||||||
|
@ -216,7 +218,7 @@ def draw_component_ui(layout, object_or_collection, registry, selected_component
|
||||||
upgradeable_customProperties = registry.has_type_infos() and do_item_custom_properties_have_missing_metadata(object_or_collection)
|
upgradeable_customProperties = registry.has_type_infos() and do_item_custom_properties_have_missing_metadata(object_or_collection)
|
||||||
if upgradeable_customProperties:
|
if upgradeable_customProperties:
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
op = row.operator(GenerateComponent_From_custom_property_Operator.bl_idname, text="generate components from custom properties" , icon="LOOP_FORWARDS")
|
op = row.operator("blenvy.component_from_custom_property", text="generate components from custom properties" , icon="LOOP_FORWARDS")
|
||||||
layout.separator()
|
layout.separator()
|
||||||
|
|
||||||
|
|
||||||
|
@ -277,17 +279,17 @@ def draw_component_ui(layout, object_or_collection, registry, selected_component
|
||||||
if propertyGroup:
|
if propertyGroup:
|
||||||
unit_struct = len(propertyGroup.field_names) == 0
|
unit_struct = len(propertyGroup.field_names) == 0
|
||||||
if unit_struct:
|
if unit_struct:
|
||||||
op = row.operator(Fix_Component_Operator.bl_idname, text="", icon="SHADERFX")
|
op = row.operator(BLENVY_OT_component_fix.bl_idname, text="", icon="SHADERFX")
|
||||||
op.component_name = component_name
|
op.component_name = component_name
|
||||||
row.separator()
|
row.separator()
|
||||||
|
|
||||||
op = row.operator(RemoveComponentOperator.bl_idname, text="", icon="X")
|
op = row.operator(BLENVY_OT_component_remove.bl_idname, text="", icon="X")
|
||||||
op.component_name = component_name
|
op.component_name = component_name
|
||||||
op.item_name = object_or_collection.name
|
op.item_name = object_or_collection.name
|
||||||
op.item_type = get_selection_type(object_or_collection)
|
op.item_type = get_selection_type(object_or_collection)
|
||||||
row.separator()
|
row.separator()
|
||||||
|
|
||||||
op = row.operator(CopyComponentOperator.bl_idname, text="", icon="COPYDOWN")
|
op = row.operator(BLENVY_OT_component_copy.bl_idname, text="", icon="COPYDOWN")
|
||||||
op.source_component_name = component_name
|
op.source_component_name = component_name
|
||||||
op.source_item_name = object_or_collection.name
|
op.source_item_name = object_or_collection.name
|
||||||
op.source_item_type = get_selection_type(object_or_collection)
|
op.source_item_type = get_selection_type(object_or_collection)
|
||||||
|
@ -295,6 +297,233 @@ def draw_component_ui(layout, object_or_collection, registry, selected_component
|
||||||
|
|
||||||
#if not single_field:
|
#if not single_field:
|
||||||
toggle_icon = "TRIA_DOWN" if component_visible else "TRIA_RIGHT"
|
toggle_icon = "TRIA_DOWN" if component_visible else "TRIA_RIGHT"
|
||||||
op = row.operator(Toggle_ComponentVisibility.bl_idname, text="", icon=toggle_icon)
|
op = row.operator(BLENVY_OT_component_toggle_visibility.bl_idname, text="", icon=toggle_icon)
|
||||||
op.component_name = component_name
|
op.component_name = component_name
|
||||||
#row.separator()
|
#row.separator()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class BLENVY_PT_component_tools_panel(bpy.types.Panel):
|
||||||
|
"""panel listing all the missing bevy types in the schema"""
|
||||||
|
bl_idname = "BLENVY_PT_component_tools_panel"
|
||||||
|
bl_label = "Rename / Fix/ Update Components"
|
||||||
|
bl_space_type = 'VIEW_3D'
|
||||||
|
bl_region_type = 'UI'
|
||||||
|
bl_category = "Bevy Components"
|
||||||
|
bl_context = "objectmode"
|
||||||
|
bl_parent_id = "BLENVY_PT_SidePanel"
|
||||||
|
bl_options = {'DEFAULT_CLOSED'}
|
||||||
|
bl_description = "advanced tooling"
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def poll(cls, context):
|
||||||
|
return context.window_manager.blenvy.mode == 'COMPONENTS'
|
||||||
|
|
||||||
|
def draw_invalid_or_unregistered_header(self, layout, items):
|
||||||
|
row = layout.row()
|
||||||
|
|
||||||
|
for item in items:
|
||||||
|
col = row.column()
|
||||||
|
col.label(text=item)
|
||||||
|
|
||||||
|
def draw_invalid_or_unregistered(self, layout, status, component_name, target):
|
||||||
|
registry = bpy.context.window_manager.components_registry
|
||||||
|
registry_has_type_infos = registry.has_type_infos()
|
||||||
|
selected_component = target.components_meta.component_selector
|
||||||
|
|
||||||
|
row = layout.row()
|
||||||
|
|
||||||
|
col = row.column()
|
||||||
|
operator = col.operator("object.select", text=target.name)
|
||||||
|
operator.target_name = target.name
|
||||||
|
|
||||||
|
col = row.column()
|
||||||
|
col.label(text=status)
|
||||||
|
|
||||||
|
col = row.column()
|
||||||
|
col.label(text=component_name)
|
||||||
|
|
||||||
|
col = row.column()
|
||||||
|
# each components_meta has a component selector to pick components from
|
||||||
|
components_meta = target.components_meta
|
||||||
|
col.prop(components_meta, "component_selector", text="")
|
||||||
|
|
||||||
|
|
||||||
|
col = row.column()
|
||||||
|
operator = col.operator("blenvy.component_rename", text="", icon="SHADERFX") #rename
|
||||||
|
target_name = registry.type_infos[selected_component]['long_name'] if selected_component in registry.type_infos else ""
|
||||||
|
operator.original_name = component_name
|
||||||
|
operator.target_items = json.dumps([target.name])
|
||||||
|
operator.target_name = target_name
|
||||||
|
col.enabled = registry_has_type_infos and component_name != "" and component_name != target_name
|
||||||
|
|
||||||
|
|
||||||
|
col = row.column()
|
||||||
|
operator = col.operator("blenvy.component_remove", text="", icon="X")
|
||||||
|
operator.item_name = target.name
|
||||||
|
operator.component_name = component_name
|
||||||
|
operator.item_type = get_selection_type(target)
|
||||||
|
|
||||||
|
def draw_invalid_item_entry(self, layout, item, invalid_component_names, items_with_invalid_components):
|
||||||
|
if "components_meta" in item:
|
||||||
|
components_metadata = item.components_meta.components
|
||||||
|
object_component_names = []
|
||||||
|
for index, component_meta in enumerate(components_metadata):
|
||||||
|
long_name = component_meta.long_name
|
||||||
|
if component_meta.invalid:
|
||||||
|
self.draw_invalid_or_unregistered(layout, "Invalid", long_name, item)
|
||||||
|
|
||||||
|
if not item.name in items_with_invalid_components:
|
||||||
|
items_with_invalid_components.append(item.name)
|
||||||
|
|
||||||
|
if not long_name in invalid_component_names:
|
||||||
|
invalid_component_names.append(long_name)
|
||||||
|
|
||||||
|
|
||||||
|
object_component_names.append(long_name)
|
||||||
|
|
||||||
|
for custom_property in item.keys():
|
||||||
|
# Invalid (something is wrong)
|
||||||
|
# Unregistered (not in registry)
|
||||||
|
# Upgrade Needed (Old-style component)
|
||||||
|
|
||||||
|
status = None
|
||||||
|
if custom_property != 'components_meta' and custom_property != 'bevy_components' and custom_property not in object_component_names:
|
||||||
|
status = "Upgrade Needed"
|
||||||
|
|
||||||
|
if status is not None:
|
||||||
|
self.draw_invalid_or_unregistered(layout, status, custom_property, item)
|
||||||
|
|
||||||
|
if not item.name in items_with_invalid_components:
|
||||||
|
items_with_invalid_components.append(item.name)
|
||||||
|
"""if not long_name in invalid_component_names:
|
||||||
|
invalid_component_names.append(custom_property)""" # FIXME
|
||||||
|
|
||||||
|
def draw(self, context):
|
||||||
|
layout = self.layout
|
||||||
|
registry = bpy.context.window_manager.components_registry
|
||||||
|
registry_has_type_infos = registry.has_type_infos()
|
||||||
|
selected_object = context.selected_objects[0] if len(context.selected_objects) > 0 else None
|
||||||
|
selected_component = bpy.context.window_manager.blenvy.components.component_selector
|
||||||
|
|
||||||
|
row = layout.row()
|
||||||
|
box= row.box()
|
||||||
|
box.label(text="Invalid/ unregistered components")
|
||||||
|
|
||||||
|
items_with_invalid_components = []
|
||||||
|
invalid_component_names = []
|
||||||
|
|
||||||
|
self.draw_invalid_or_unregistered_header(layout, ["Item","Status", "Component", "Target"])
|
||||||
|
|
||||||
|
for object in bpy.data.objects: # TODO: very inneficent
|
||||||
|
if len(object.keys()) > 0:
|
||||||
|
self.draw_invalid_item_entry(layout, object, invalid_component_names, items_with_invalid_components)
|
||||||
|
|
||||||
|
for collection in bpy.data.collections:
|
||||||
|
if len(collection.keys()) > 0:
|
||||||
|
self.draw_invalid_item_entry(layout, collection, invalid_component_names, items_with_invalid_components)
|
||||||
|
|
||||||
|
|
||||||
|
layout.separator()
|
||||||
|
layout.separator()
|
||||||
|
layout.label(text="------------------Bulk actions: Rename/ Upgrade -------------------")
|
||||||
|
original_name = bpy.context.window_manager.blenvy.components.source_component_selector
|
||||||
|
target_name = bpy.context.window_manager.blenvy.components.target_component_selector
|
||||||
|
|
||||||
|
row = layout.row()
|
||||||
|
col = row.column()
|
||||||
|
col.label(text="Component")
|
||||||
|
col = row.column()
|
||||||
|
col.label(text="Target")
|
||||||
|
col = row.column()
|
||||||
|
col.label(text="------")
|
||||||
|
|
||||||
|
row = layout.row()
|
||||||
|
col = row.column()
|
||||||
|
col.prop(bpy.context.window_manager.blenvy.components, "source_component_selector", text="")
|
||||||
|
|
||||||
|
col = row.column()
|
||||||
|
col.prop(bpy.context.window_manager.blenvy.components, "target_component_selector", text="")
|
||||||
|
|
||||||
|
col = row.column()
|
||||||
|
components_rename_progress = context.window_manager.components_rename_progress
|
||||||
|
if components_rename_progress == -1.0:
|
||||||
|
operator = col.operator("blenvy.component_rename", text="apply", icon="SHADERFX")
|
||||||
|
operator.target_items = json.dumps(items_with_invalid_components)
|
||||||
|
operator.target_name = target_name
|
||||||
|
col.enabled = registry_has_type_infos and original_name != "" and original_name != target_name
|
||||||
|
else:
|
||||||
|
if hasattr(layout,"progress") : # only for Blender > 4.0
|
||||||
|
col.progress(factor = components_rename_progress, text=f"updating {components_rename_progress * 100.0:.2f}%")
|
||||||
|
|
||||||
|
col = row.column()
|
||||||
|
remove_components_progress = context.window_manager.components_remove_progress
|
||||||
|
if remove_components_progress == -1.0:
|
||||||
|
operator = row.operator("blenvy.component_remove_from_all_items", text="", icon="X")
|
||||||
|
operator.component_name = context.window_manager.bevy_component_rename_helper.original_name
|
||||||
|
col.enabled = registry_has_type_infos and original_name != ""
|
||||||
|
else:
|
||||||
|
if hasattr(layout,"progress") : # only for Blender > 4.0
|
||||||
|
col.progress(factor = remove_components_progress, text=f"updating {remove_components_progress * 100.0:.2f}%")
|
||||||
|
|
||||||
|
layout.separator()
|
||||||
|
"""layout.separator()
|
||||||
|
row = layout.row()
|
||||||
|
box= row.box()
|
||||||
|
box.label(text="Conversions between custom properties and components & vice-versa")
|
||||||
|
|
||||||
|
row = layout.row()
|
||||||
|
row.label(text="WARNING ! The following operations will overwrite your existing custom properties if they have matching types on the bevy side !")
|
||||||
|
row.alert = True
|
||||||
|
|
||||||
|
##
|
||||||
|
row = layout.row()
|
||||||
|
custom_properties_from_components_progress_current = context.window_manager.custom_properties_from_components_progress
|
||||||
|
|
||||||
|
if custom_properties_from_components_progress_current == -1.0:
|
||||||
|
row.operator(BLENVY_OT_components_refresh_custom_properties_current.bl_idname, text="update custom properties of current object" , icon="LOOP_FORWARDS")
|
||||||
|
row.enabled = registry_has_type_infos and selected_object is not None
|
||||||
|
else:
|
||||||
|
if hasattr(layout,"progress") : # only for Blender > 4.0
|
||||||
|
layout.progress(factor = custom_properties_from_components_progress_current, text=f"updating {custom_properties_from_components_progress_current * 100.0:.2f}%")
|
||||||
|
|
||||||
|
layout.separator()
|
||||||
|
row = layout.row()
|
||||||
|
custom_properties_from_components_progress_all = context.window_manager.custom_properties_from_components_progress_all
|
||||||
|
|
||||||
|
if custom_properties_from_components_progress_all == -1.0:
|
||||||
|
row.operator(BLENVY_OT_components_refresh_custom_properties_all.bl_idname, text="update custom properties of ALL objects" , icon="LOOP_FORWARDS")
|
||||||
|
row.enabled = registry_has_type_infos
|
||||||
|
else:
|
||||||
|
if hasattr(layout,"progress") : # only for Blender > 4.0
|
||||||
|
layout.progress(factor = custom_properties_from_components_progress_all, text=f"updating {custom_properties_from_components_progress_all * 100.0:.2f}%")
|
||||||
|
|
||||||
|
########################
|
||||||
|
|
||||||
|
row = layout.row()
|
||||||
|
row.label(text="WARNING ! The following operations will try to overwrite your existing ui values if they have matching types on the bevy side !")
|
||||||
|
row.alert = True
|
||||||
|
|
||||||
|
components_from_custom_properties_progress_current = context.window_manager.components_from_custom_properties_progress
|
||||||
|
|
||||||
|
row = layout.row()
|
||||||
|
if components_from_custom_properties_progress_current == -1.0:
|
||||||
|
row.operator(BLENVY_OT_components_refresh_propgroups_current.bl_idname, text="update UI FROM custom properties of current object" , icon="LOOP_BACK")
|
||||||
|
row.enabled = registry_has_type_infos and selected_object is not None
|
||||||
|
else:
|
||||||
|
if hasattr(layout,"progress") : # only for Blender > 4.0
|
||||||
|
layout.progress(factor = components_from_custom_properties_progress_current, text=f"updating {components_from_custom_properties_progress_current * 100.0:.2f}%")
|
||||||
|
|
||||||
|
layout.separator()
|
||||||
|
row = layout.row()
|
||||||
|
components_from_custom_properties_progress_all = context.window_manager.components_from_custom_properties_progress_all
|
||||||
|
|
||||||
|
if components_from_custom_properties_progress_all == -1.0:
|
||||||
|
row.operator(BLENVY_OT_components_refresh_propgroups_all.bl_idname, text="update UI FROM custom properties of ALL objects" , icon="LOOP_BACK")
|
||||||
|
row.enabled = registry_has_type_infos
|
||||||
|
else:
|
||||||
|
if hasattr(layout,"progress") : # only for Blender > 4.0
|
||||||
|
layout.progress(factor = components_from_custom_properties_progress_all, text=f"updating {components_from_custom_properties_progress_all * 100.0:.2f}%")
|
||||||
|
|
||||||
|
"""
|
|
@ -9,9 +9,9 @@ from blenvy.settings import upsert_settings
|
||||||
from ..components.metadata import apply_customProperty_values_to_item_propertyGroups, apply_propertyGroup_values_to_item_customProperties, ensure_metadata_for_all_items
|
from ..components.metadata import apply_customProperty_values_to_item_propertyGroups, apply_propertyGroup_values_to_item_customProperties, ensure_metadata_for_all_items
|
||||||
from ..propGroups.prop_groups import generate_propertyGroups_for_components
|
from ..propGroups.prop_groups import generate_propertyGroups_for_components
|
||||||
|
|
||||||
class ReloadRegistryOperator(Operator):
|
class BLENVY_OT_components_registry_reload(Operator):
|
||||||
"""Reloads registry (schema file) from disk, generates propertyGroups for components & ensures all objects have metadata """
|
"""Reloads registry (schema file) from disk, generates propertyGroups for components & ensures all objects have metadata """
|
||||||
bl_idname = "blenvy.reload_components_registry"
|
bl_idname = "blenvy.components_registry_reload"
|
||||||
bl_label = "Reload Registry"
|
bl_label = "Reload Registry"
|
||||||
bl_options = {"UNDO"}
|
bl_options = {"UNDO"}
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ class ReloadRegistryOperator(Operator):
|
||||||
|
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
class COMPONENTS_OT_REFRESH_CUSTOM_PROPERTIES_ALL(Operator):
|
class BLENVY_OT_components_refresh_custom_properties_all(Operator):
|
||||||
"""Apply registry to ALL objects: update the custom property values of all objects based on their definition, if any"""
|
"""Apply registry to ALL objects: update the custom property values of all objects based on their definition, if any"""
|
||||||
bl_idname = "object.refresh_custom_properties_all"
|
bl_idname = "object.refresh_custom_properties_all"
|
||||||
bl_label = "Apply Registry to all objects"
|
bl_label = "Apply Registry to all objects"
|
||||||
|
@ -66,7 +66,7 @@ class COMPONENTS_OT_REFRESH_CUSTOM_PROPERTIES_ALL(Operator):
|
||||||
|
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
class COMPONENTS_OT_REFRESH_CUSTOM_PROPERTIES_CURRENT(Operator):
|
class BLENVY_OT_components_refresh_custom_properties_current(Operator):
|
||||||
"""Apply registry to CURRENT object: update the custom property values of current object based on their definition, if any"""
|
"""Apply registry to CURRENT object: update the custom property values of current object based on their definition, if any"""
|
||||||
bl_idname = "object.refresh_custom_properties_current"
|
bl_idname = "object.refresh_custom_properties_current"
|
||||||
bl_label = "Apply Registry to current object"
|
bl_label = "Apply Registry to current object"
|
||||||
|
@ -92,7 +92,7 @@ class COMPONENTS_OT_REFRESH_CUSTOM_PROPERTIES_CURRENT(Operator):
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
|
||||||
class COMPONENTS_OT_REFRESH_PROPGROUPS_FROM_CUSTOM_PROPERTIES_CURRENT(Operator):
|
class BLENVY_OT_components_refresh_propgroups_current(Operator):
|
||||||
"""Update UI values from custom properties to CURRENT object"""
|
"""Update UI values from custom properties to CURRENT object"""
|
||||||
bl_idname = "object.refresh_ui_from_custom_properties_current"
|
bl_idname = "object.refresh_ui_from_custom_properties_current"
|
||||||
bl_label = "Apply custom_properties to current object"
|
bl_label = "Apply custom_properties to current object"
|
||||||
|
@ -130,7 +130,7 @@ class COMPONENTS_OT_REFRESH_PROPGROUPS_FROM_CUSTOM_PROPERTIES_CURRENT(Operator):
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
|
||||||
class COMPONENTS_OT_REFRESH_PROPGROUPS_FROM_CUSTOM_PROPERTIES_ALL(Operator):
|
class BLENVY_OT_components_refresh_propgroups_all(Operator):
|
||||||
"""Update UI values from custom properties to ALL object"""
|
"""Update UI values from custom properties to ALL object"""
|
||||||
bl_idname = "object.refresh_ui_from_custom_properties_all"
|
bl_idname = "object.refresh_ui_from_custom_properties_all"
|
||||||
bl_label = "Apply custom_properties to all objects"
|
bl_label = "Apply custom_properties to all objects"
|
||||||
|
@ -173,9 +173,9 @@ class COMPONENTS_OT_REFRESH_PROPGROUPS_FROM_CUSTOM_PROPERTIES_ALL(Operator):
|
||||||
context.window_manager.components_from_custom_properties_progress_all = -1.0
|
context.window_manager.components_from_custom_properties_progress_all = -1.0
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
class OT_OpenSchemaFileBrowser(Operator, ImportHelper):
|
class BLENVY_OT_components_registry_browse_schema(Operator, ImportHelper):
|
||||||
"""Browse for registry json file"""
|
"""Browse for registry json file"""
|
||||||
bl_idname = "blenvy.open_schemafilebrowser"
|
bl_idname = "blenvy.components_registry_browse_schema"
|
||||||
bl_label = "Open the file browser"
|
bl_label = "Open the file browser"
|
||||||
|
|
||||||
filter_glob: StringProperty(
|
filter_glob: StringProperty(
|
||||||
|
@ -197,41 +197,3 @@ class OT_OpenSchemaFileBrowser(Operator, ImportHelper):
|
||||||
|
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
|
||||||
class OT_select_object(Operator):
|
|
||||||
"""Select object by name"""
|
|
||||||
bl_idname = "object.select"
|
|
||||||
bl_label = "Select object"
|
|
||||||
bl_options = {"UNDO"}
|
|
||||||
|
|
||||||
target_name: StringProperty(
|
|
||||||
name="target name",
|
|
||||||
description="target to select's name ",
|
|
||||||
) # type: ignore
|
|
||||||
|
|
||||||
def execute(self, context):
|
|
||||||
if self.target_name:
|
|
||||||
object = bpy.data.objects[self.target_name]
|
|
||||||
scenes_of_object = list(object.users_scene)
|
|
||||||
if len(scenes_of_object) > 0:
|
|
||||||
bpy.ops.object.select_all(action='DESELECT')
|
|
||||||
bpy.context.window.scene = scenes_of_object[0]
|
|
||||||
object.select_set(True)
|
|
||||||
bpy.context.view_layer.objects.active = object
|
|
||||||
return {'FINISHED'}
|
|
||||||
|
|
||||||
class OT_select_component_name_to_replace(Operator):
|
|
||||||
"""Select component name to replace"""
|
|
||||||
bl_idname = "object.select_component_name_to_replace"
|
|
||||||
bl_label = "Select component name for bulk replace"
|
|
||||||
bl_options = {"UNDO"}
|
|
||||||
|
|
||||||
component_name: StringProperty(
|
|
||||||
name="component_name",
|
|
||||||
description="component name to replace",
|
|
||||||
) # type: ignore
|
|
||||||
|
|
||||||
def execute(self, context):
|
|
||||||
context.window_manager.bevy_component_rename_helper.original_name = self.component_name
|
|
||||||
return {'FINISHED'}
|
|
||||||
|
|
|
@ -1,293 +1,9 @@
|
||||||
import json
|
|
||||||
import bpy
|
import bpy
|
||||||
from bpy_types import (UIList)
|
from bpy_types import (UIList)
|
||||||
from bpy.props import (StringProperty)
|
|
||||||
|
|
||||||
from ..utils import get_selection_type
|
class BLENVY_PT_components_missing_types_panel(bpy.types.Panel):
|
||||||
|
|
||||||
from ..components.operators import OT_rename_component, RemoveComponentFromAllItemsOperator
|
|
||||||
from .operators import(
|
|
||||||
COMPONENTS_OT_REFRESH_PROPGROUPS_FROM_CUSTOM_PROPERTIES_ALL,
|
|
||||||
COMPONENTS_OT_REFRESH_PROPGROUPS_FROM_CUSTOM_PROPERTIES_CURRENT,
|
|
||||||
OT_OpenSchemaFileBrowser, ReloadRegistryOperator,
|
|
||||||
COMPONENTS_OT_REFRESH_CUSTOM_PROPERTIES_ALL,
|
|
||||||
COMPONENTS_OT_REFRESH_CUSTOM_PROPERTIES_CURRENT)
|
|
||||||
|
|
||||||
class BEVY_COMPONENTS_PT_Configuration(bpy.types.Panel):
|
|
||||||
bl_idname = "BEVY_COMPONENTS_PT_Configuration"
|
|
||||||
bl_label = "Components"
|
|
||||||
bl_space_type = 'VIEW_3D'
|
|
||||||
bl_region_type = 'UI'
|
|
||||||
bl_category = "Bevy Components"
|
|
||||||
bl_context = "objectmode"
|
|
||||||
bl_parent_id = "BLENVY_PT_SidePanel"
|
|
||||||
bl_options = {'DEFAULT_CLOSED'}
|
|
||||||
bl_description = "list of missing/unregistered type from the bevy side"
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def poll(cls, context):
|
|
||||||
return context.window_manager.blenvy.mode == 'SETTINGS'
|
|
||||||
return context.object is not None
|
|
||||||
|
|
||||||
def draw(self, context):
|
|
||||||
layout = self.layout
|
|
||||||
registry = context.window_manager.components_registry
|
|
||||||
blenvy = context.window_manager.blenvy
|
|
||||||
component_settings = blenvy.components
|
|
||||||
|
|
||||||
row = layout.row()
|
|
||||||
col = row.column()
|
|
||||||
col.enabled = False
|
|
||||||
col.prop(component_settings, "schema_path", text="Registry Schema path")
|
|
||||||
col = row.column()
|
|
||||||
col.operator("blenvy.open_schemafilebrowser", text="Browse for registry schema file (json)")
|
|
||||||
|
|
||||||
layout.separator()
|
|
||||||
layout.operator("blenvy.reload_components_registry", text="reload registry" , icon="FILE_REFRESH")
|
|
||||||
|
|
||||||
layout.separator()
|
|
||||||
row = layout.row()
|
|
||||||
|
|
||||||
row.prop(component_settings, "watcher_enabled", text="enable registry file polling")
|
|
||||||
row.prop(component_settings, "watcher_poll_frequency", text="registry file poll frequency (s)")
|
|
||||||
|
|
||||||
layout.separator()
|
|
||||||
layout.separator()
|
|
||||||
|
|
||||||
|
|
||||||
class BEVY_COMPONENTS_PT_AdvancedToolsPanel(bpy.types.Panel):
|
|
||||||
"""panel listing all the missing bevy types in the schema"""
|
"""panel listing all the missing bevy types in the schema"""
|
||||||
bl_idname = "BEVY_COMPONENTS_PT_AdvancedToolsPanel"
|
bl_idname = "BLENVY_PT_components_missing_types_panel"
|
||||||
bl_label = "Advanced tools"
|
|
||||||
bl_space_type = 'VIEW_3D'
|
|
||||||
bl_region_type = 'UI'
|
|
||||||
bl_category = "Bevy Components"
|
|
||||||
bl_context = "objectmode"
|
|
||||||
bl_parent_id = "BLENVY_PT_SidePanel"
|
|
||||||
bl_options = {'DEFAULT_CLOSED'}
|
|
||||||
bl_description = "advanced tooling"
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def poll(cls, context):
|
|
||||||
return context.window_manager.blenvy.mode == 'COMPONENTS'
|
|
||||||
|
|
||||||
def draw_invalid_or_unregistered_header(self, layout, items):
|
|
||||||
row = layout.row()
|
|
||||||
|
|
||||||
for item in items:
|
|
||||||
col = row.column()
|
|
||||||
col.label(text=item)
|
|
||||||
|
|
||||||
def draw_invalid_or_unregistered(self, layout, status, component_name, target):
|
|
||||||
registry = bpy.context.window_manager.components_registry
|
|
||||||
registry_has_type_infos = registry.has_type_infos()
|
|
||||||
selected_component = target.components_meta.component_selector
|
|
||||||
|
|
||||||
row = layout.row()
|
|
||||||
|
|
||||||
col = row.column()
|
|
||||||
operator = col.operator("object.select", text=target.name)
|
|
||||||
operator.target_name = target.name
|
|
||||||
|
|
||||||
col = row.column()
|
|
||||||
col.label(text=status)
|
|
||||||
|
|
||||||
col = row.column()
|
|
||||||
col.label(text=component_name)
|
|
||||||
|
|
||||||
col = row.column()
|
|
||||||
# each components_meta has a component selector to pick components from
|
|
||||||
components_meta = target.components_meta
|
|
||||||
col.prop(components_meta, "component_selector", text="")
|
|
||||||
|
|
||||||
|
|
||||||
col = row.column()
|
|
||||||
operator = col.operator("object.rename_bevy_component", text="", icon="SHADERFX") #rename
|
|
||||||
target_name = registry.type_infos[selected_component]['long_name'] if selected_component in registry.type_infos else ""
|
|
||||||
operator.original_name = component_name
|
|
||||||
operator.target_items = json.dumps([target.name])
|
|
||||||
operator.target_name = target_name
|
|
||||||
col.enabled = registry_has_type_infos and component_name != "" and component_name != target_name
|
|
||||||
|
|
||||||
|
|
||||||
col = row.column()
|
|
||||||
operator = col.operator("object.remove_bevy_component", text="", icon="X")
|
|
||||||
operator.item_name = target.name
|
|
||||||
operator.component_name = component_name
|
|
||||||
operator.item_type = get_selection_type(target)
|
|
||||||
|
|
||||||
|
|
||||||
"""col = row.column()
|
|
||||||
col = row.column()
|
|
||||||
operator = col.operator("object.select_component_name_to_replace", text="", icon="EYEDROPPER") #text="select for rename",
|
|
||||||
operator.component_name = component_name"""
|
|
||||||
|
|
||||||
def draw_invalid_item_entry(self, layout, item, invalid_component_names, items_with_invalid_components):
|
|
||||||
if "components_meta" in item:
|
|
||||||
components_metadata = item.components_meta.components
|
|
||||||
object_component_names = []
|
|
||||||
for index, component_meta in enumerate(components_metadata):
|
|
||||||
long_name = component_meta.long_name
|
|
||||||
if component_meta.invalid:
|
|
||||||
self.draw_invalid_or_unregistered(layout, "Invalid", long_name, item)
|
|
||||||
|
|
||||||
if not item.name in items_with_invalid_components:
|
|
||||||
items_with_invalid_components.append(item.name)
|
|
||||||
|
|
||||||
if not long_name in invalid_component_names:
|
|
||||||
invalid_component_names.append(long_name)
|
|
||||||
|
|
||||||
|
|
||||||
object_component_names.append(long_name)
|
|
||||||
|
|
||||||
for custom_property in item.keys():
|
|
||||||
# Invalid (something is wrong)
|
|
||||||
# Unregistered (not in registry)
|
|
||||||
# Upgrade Needed (Old-style component)
|
|
||||||
|
|
||||||
status = None
|
|
||||||
if custom_property != 'components_meta' and custom_property != 'bevy_components' and custom_property not in object_component_names:
|
|
||||||
status = "Upgrade Needed"
|
|
||||||
|
|
||||||
if status is not None:
|
|
||||||
self.draw_invalid_or_unregistered(layout, status, custom_property, item)
|
|
||||||
|
|
||||||
if not item.name in items_with_invalid_components:
|
|
||||||
items_with_invalid_components.append(item.name)
|
|
||||||
"""if not long_name in invalid_component_names:
|
|
||||||
invalid_component_names.append(custom_property)""" # FIXME
|
|
||||||
|
|
||||||
def draw(self, context):
|
|
||||||
layout = self.layout
|
|
||||||
registry = bpy.context.window_manager.components_registry
|
|
||||||
registry_has_type_infos = registry.has_type_infos()
|
|
||||||
selected_object = context.selected_objects[0] if len(context.selected_objects) > 0 else None
|
|
||||||
selected_component = bpy.context.window_manager.blenvy.components.component_selector
|
|
||||||
|
|
||||||
row = layout.row()
|
|
||||||
box= row.box()
|
|
||||||
box.label(text="Invalid/ unregistered components")
|
|
||||||
|
|
||||||
items_with_invalid_components = []
|
|
||||||
invalid_component_names = []
|
|
||||||
|
|
||||||
self.draw_invalid_or_unregistered_header(layout, ["Item","Status", "Component", "Target"])
|
|
||||||
|
|
||||||
for object in bpy.data.objects: # TODO: very inneficent
|
|
||||||
if len(object.keys()) > 0:
|
|
||||||
self.draw_invalid_item_entry(layout, object, invalid_component_names, items_with_invalid_components)
|
|
||||||
|
|
||||||
for collection in bpy.data.collections:
|
|
||||||
if len(collection.keys()) > 0:
|
|
||||||
self.draw_invalid_item_entry(layout, collection, invalid_component_names, items_with_invalid_components)
|
|
||||||
|
|
||||||
|
|
||||||
layout.separator()
|
|
||||||
layout.separator()
|
|
||||||
layout.label(text="------------------Bulk actions: Rename/ Upgrade -------------------")
|
|
||||||
original_name = bpy.context.window_manager.blenvy.components.source_component_selector
|
|
||||||
target_name = bpy.context.window_manager.blenvy.components.target_component_selector
|
|
||||||
|
|
||||||
row = layout.row()
|
|
||||||
col = row.column()
|
|
||||||
col.label(text="Component")
|
|
||||||
col = row.column()
|
|
||||||
col.label(text="Target")
|
|
||||||
col = row.column()
|
|
||||||
col.label(text="------")
|
|
||||||
|
|
||||||
row = layout.row()
|
|
||||||
col = row.column()
|
|
||||||
col.prop(bpy.context.window_manager.blenvy.components, "source_component_selector", text="")
|
|
||||||
|
|
||||||
col = row.column()
|
|
||||||
col.prop(bpy.context.window_manager.blenvy.components, "target_component_selector", text="")
|
|
||||||
|
|
||||||
col = row.column()
|
|
||||||
components_rename_progress = context.window_manager.components_rename_progress
|
|
||||||
print("components_rename_progress", components_rename_progress)
|
|
||||||
if components_rename_progress == -1.0:
|
|
||||||
operator = col.operator(OT_rename_component.bl_idname, text="apply", icon="SHADERFX")
|
|
||||||
operator.target_items = json.dumps(items_with_invalid_components)
|
|
||||||
operator.target_name = target_name
|
|
||||||
col.enabled = registry_has_type_infos and original_name != "" and original_name != target_name
|
|
||||||
else:
|
|
||||||
if hasattr(layout,"progress") : # only for Blender > 4.0
|
|
||||||
col.progress(factor = components_rename_progress, text=f"updating {components_rename_progress * 100.0:.2f}%")
|
|
||||||
|
|
||||||
col = row.column()
|
|
||||||
remove_components_progress = context.window_manager.components_remove_progress
|
|
||||||
if remove_components_progress == -1.0:
|
|
||||||
operator = row.operator(RemoveComponentFromAllItemsOperator.bl_idname, text="", icon="X")
|
|
||||||
operator.component_name = context.window_manager.bevy_component_rename_helper.original_name
|
|
||||||
col.enabled = registry_has_type_infos and original_name != ""
|
|
||||||
else:
|
|
||||||
if hasattr(layout,"progress") : # only for Blender > 4.0
|
|
||||||
col.progress(factor = remove_components_progress, text=f"updating {remove_components_progress * 100.0:.2f}%")
|
|
||||||
|
|
||||||
layout.separator()
|
|
||||||
"""layout.separator()
|
|
||||||
row = layout.row()
|
|
||||||
box= row.box()
|
|
||||||
box.label(text="Conversions between custom properties and components & vice-versa")
|
|
||||||
|
|
||||||
row = layout.row()
|
|
||||||
row.label(text="WARNING ! The following operations will overwrite your existing custom properties if they have matching types on the bevy side !")
|
|
||||||
row.alert = True
|
|
||||||
|
|
||||||
##
|
|
||||||
row = layout.row()
|
|
||||||
custom_properties_from_components_progress_current = context.window_manager.custom_properties_from_components_progress
|
|
||||||
|
|
||||||
if custom_properties_from_components_progress_current == -1.0:
|
|
||||||
row.operator(COMPONENTS_OT_REFRESH_CUSTOM_PROPERTIES_CURRENT.bl_idname, text="update custom properties of current object" , icon="LOOP_FORWARDS")
|
|
||||||
row.enabled = registry_has_type_infos and selected_object is not None
|
|
||||||
else:
|
|
||||||
if hasattr(layout,"progress") : # only for Blender > 4.0
|
|
||||||
layout.progress(factor = custom_properties_from_components_progress_current, text=f"updating {custom_properties_from_components_progress_current * 100.0:.2f}%")
|
|
||||||
|
|
||||||
layout.separator()
|
|
||||||
row = layout.row()
|
|
||||||
custom_properties_from_components_progress_all = context.window_manager.custom_properties_from_components_progress_all
|
|
||||||
|
|
||||||
if custom_properties_from_components_progress_all == -1.0:
|
|
||||||
row.operator(COMPONENTS_OT_REFRESH_CUSTOM_PROPERTIES_ALL.bl_idname, text="update custom properties of ALL objects" , icon="LOOP_FORWARDS")
|
|
||||||
row.enabled = registry_has_type_infos
|
|
||||||
else:
|
|
||||||
if hasattr(layout,"progress") : # only for Blender > 4.0
|
|
||||||
layout.progress(factor = custom_properties_from_components_progress_all, text=f"updating {custom_properties_from_components_progress_all * 100.0:.2f}%")
|
|
||||||
|
|
||||||
########################
|
|
||||||
|
|
||||||
row = layout.row()
|
|
||||||
row.label(text="WARNING ! The following operations will try to overwrite your existing ui values if they have matching types on the bevy side !")
|
|
||||||
row.alert = True
|
|
||||||
|
|
||||||
components_from_custom_properties_progress_current = context.window_manager.components_from_custom_properties_progress
|
|
||||||
|
|
||||||
row = layout.row()
|
|
||||||
if components_from_custom_properties_progress_current == -1.0:
|
|
||||||
row.operator(COMPONENTS_OT_REFRESH_PROPGROUPS_FROM_CUSTOM_PROPERTIES_CURRENT.bl_idname, text="update UI FROM custom properties of current object" , icon="LOOP_BACK")
|
|
||||||
row.enabled = registry_has_type_infos and selected_object is not None
|
|
||||||
else:
|
|
||||||
if hasattr(layout,"progress") : # only for Blender > 4.0
|
|
||||||
layout.progress(factor = components_from_custom_properties_progress_current, text=f"updating {components_from_custom_properties_progress_current * 100.0:.2f}%")
|
|
||||||
|
|
||||||
layout.separator()
|
|
||||||
row = layout.row()
|
|
||||||
components_from_custom_properties_progress_all = context.window_manager.components_from_custom_properties_progress_all
|
|
||||||
|
|
||||||
if components_from_custom_properties_progress_all == -1.0:
|
|
||||||
row.operator(COMPONENTS_OT_REFRESH_PROPGROUPS_FROM_CUSTOM_PROPERTIES_ALL.bl_idname, text="update UI FROM custom properties of ALL objects" , icon="LOOP_BACK")
|
|
||||||
row.enabled = registry_has_type_infos
|
|
||||||
else:
|
|
||||||
if hasattr(layout,"progress") : # only for Blender > 4.0
|
|
||||||
layout.progress(factor = components_from_custom_properties_progress_all, text=f"updating {components_from_custom_properties_progress_all * 100.0:.2f}%")
|
|
||||||
|
|
||||||
"""
|
|
||||||
class BEVY_COMPONENTS_PT_MissingTypesPanel(bpy.types.Panel):
|
|
||||||
"""panel listing all the missing bevy types in the schema"""
|
|
||||||
bl_idname = "BEVY_COMPONENTS_PT_MissingTypesPanel"
|
|
||||||
bl_label = "Missing/Unregistered Types"
|
bl_label = "Missing/Unregistered Types"
|
||||||
bl_space_type = 'VIEW_3D'
|
bl_space_type = 'VIEW_3D'
|
||||||
bl_region_type = 'UI'
|
bl_region_type = 'UI'
|
||||||
|
@ -306,10 +22,10 @@ class BEVY_COMPONENTS_PT_MissingTypesPanel(bpy.types.Panel):
|
||||||
registry = bpy.context.window_manager.components_registry
|
registry = bpy.context.window_manager.components_registry
|
||||||
|
|
||||||
layout.label(text="Missing types ")
|
layout.label(text="Missing types ")
|
||||||
layout.template_list("MISSING_TYPES_UL_List", "Missing types list", registry, "missing_types_list", registry, "missing_types_list_index")
|
layout.template_list("BLENVY_UL_components_missing_types", "Missing types list", registry, "missing_types_list", registry, "missing_types_list_index")
|
||||||
|
|
||||||
|
|
||||||
class MISSING_TYPES_UL_List(UIList):
|
class BLENVY_UL_components_missing_types(UIList):
|
||||||
"""Missing components UIList."""
|
"""Missing components UIList."""
|
||||||
|
|
||||||
use_filter_name_reverse: bpy.props.BoolProperty(
|
use_filter_name_reverse: bpy.props.BoolProperty(
|
||||||
|
|
|
@ -5,10 +5,10 @@ def draw_settings_ui(layout, component_settings):
|
||||||
col.enabled = False
|
col.enabled = False
|
||||||
col.prop(component_settings, "schema_path", text="Registry Schema path")
|
col.prop(component_settings, "schema_path", text="Registry Schema path")
|
||||||
col = row.column()
|
col = row.column()
|
||||||
col.operator(operator="blenvy.open_schemafilebrowser", text="Browse for registry schema file (json)")
|
col.operator(operator="blenvy.components_registry_browse_schema", text="Browse for registry schema file (json)")
|
||||||
|
|
||||||
layout.separator()
|
layout.separator()
|
||||||
layout.operator(operator="blenvy.reload_components_registry", text="reload registry" , icon="FILE_REFRESH")
|
layout.operator(operator="blenvy.components_registry_reload", text="reload registry" , icon="FILE_REFRESH")
|
||||||
|
|
||||||
layout.separator()
|
layout.separator()
|
||||||
row = layout.row()
|
row = layout.row()
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
import bpy
|
import bpy
|
||||||
from .constants import HIDDEN_COMPONENTS
|
from .constants import HIDDEN_COMPONENTS
|
||||||
|
from bpy.props import StringProperty
|
||||||
|
from bpy_types import Operator
|
||||||
|
|
||||||
#FIXME: does not work if object is hidden !!
|
#FIXME: does not work if object is hidden !!
|
||||||
def get_selected_object_or_collection(context):
|
def get_selected_object_or_collection(context):
|
||||||
|
@ -12,6 +14,30 @@ def get_selected_object_or_collection(context):
|
||||||
target = collection
|
target = collection
|
||||||
return target
|
return target
|
||||||
|
|
||||||
|
|
||||||
|
class BLENVY_OT_object_select(Operator):
|
||||||
|
"""Select object by name"""
|
||||||
|
bl_idname = "object.select"
|
||||||
|
bl_label = "Select object"
|
||||||
|
bl_options = {"UNDO"}
|
||||||
|
|
||||||
|
target_name: StringProperty(
|
||||||
|
name="target name",
|
||||||
|
description="target to select's name ",
|
||||||
|
) # type: ignore
|
||||||
|
|
||||||
|
def execute(self, context):
|
||||||
|
if self.target_name:
|
||||||
|
object = bpy.data.objects[self.target_name]
|
||||||
|
scenes_of_object = list(object.users_scene)
|
||||||
|
if len(scenes_of_object) > 0:
|
||||||
|
bpy.ops.object.select_all(action='DESELECT')
|
||||||
|
bpy.context.window.scene = scenes_of_object[0]
|
||||||
|
object.select_set(True)
|
||||||
|
bpy.context.view_layer.objects.active = object
|
||||||
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
|
||||||
def get_selection_type(selection):
|
def get_selection_type(selection):
|
||||||
if isinstance(selection, bpy.types.Object):
|
if isinstance(selection, bpy.types.Object):
|
||||||
return 'Object'
|
return 'Object'
|
||||||
|
|
|
@ -4,11 +4,11 @@ import os
|
||||||
from bpy_extras.io_utils import ImportHelper
|
from bpy_extras.io_utils import ImportHelper
|
||||||
from bpy.types import Operator
|
from bpy.types import Operator
|
||||||
|
|
||||||
from ..path_helpers import absolute_path_from_blend_file
|
from ..core.path_helpers import absolute_path_from_blend_file
|
||||||
|
|
||||||
class OT_OpenAssetsFolderBrowser(Operator, ImportHelper):
|
class BLENVY_OT_assets_paths_browse(Operator, ImportHelper):
|
||||||
"""Assets folder's browser"""
|
"""Assets folder's browser"""
|
||||||
bl_idname = "generic.open_folderbrowser"
|
bl_idname = "blenvy.assets_paths_browse"
|
||||||
bl_label = "Select folder"
|
bl_label = "Select folder"
|
||||||
|
|
||||||
# Define this to tell 'fileselect_add' that we want a directoy
|
# Define this to tell 'fileselect_add' that we want a directoy
|
|
@ -6,13 +6,11 @@ from bpy.props import (BoolProperty, StringProperty, EnumProperty)
|
||||||
|
|
||||||
from .asset_helpers import does_asset_exist, get_user_assets, remove_asset, upsert_asset
|
from .asset_helpers import does_asset_exist, get_user_assets, remove_asset, upsert_asset
|
||||||
from .assets_scan import get_main_scene_assets_tree
|
from .assets_scan import get_main_scene_assets_tree
|
||||||
|
|
||||||
from ..core.path_helpers import absolute_path_from_blend_file
|
from ..core.path_helpers import absolute_path_from_blend_file
|
||||||
from ..settings import load_settings
|
|
||||||
|
|
||||||
class OT_add_bevy_asset(Operator):
|
class BLENVY_OT_assets_add(Operator):
|
||||||
"""Add asset"""
|
"""Add asset"""
|
||||||
bl_idname = "bevyassets.add"
|
bl_idname = "blenvy.assets_add"
|
||||||
bl_label = "Add bevy asset"
|
bl_label = "Add bevy asset"
|
||||||
bl_options = {"UNDO"}
|
bl_options = {"UNDO"}
|
||||||
|
|
||||||
|
@ -79,9 +77,9 @@ class OT_add_bevy_asset(Operator):
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
|
||||||
class OT_remove_bevy_asset(Operator):
|
class BLENVY_OT_assets_remove(Operator):
|
||||||
"""Remove asset"""
|
"""Remove asset"""
|
||||||
bl_idname = "bevyassets.remove"
|
bl_idname = "blenvy.assets_remove"
|
||||||
bl_label = "remove bevy asset"
|
bl_label = "remove bevy asset"
|
||||||
bl_options = {"UNDO"}
|
bl_options = {"UNDO"}
|
||||||
|
|
||||||
|
@ -132,9 +130,9 @@ import os
|
||||||
from bpy_extras.io_utils import ImportHelper
|
from bpy_extras.io_utils import ImportHelper
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
class OT_Add_asset_filebrowser(Operator, ImportHelper):
|
class BLENVY_OT_assets_browse(Operator, ImportHelper):
|
||||||
"""Browse for asset files"""
|
"""Browse for asset files"""
|
||||||
bl_idname = "asset.open_filebrowser"
|
bl_idname = "blenvy.assets_open_filebrowser"
|
||||||
bl_label = "Select asset file"
|
bl_label = "Select asset file"
|
||||||
|
|
||||||
# Define this to tell 'fileselect_add' that we want a directoy
|
# Define this to tell 'fileselect_add' that we want a directoy
|
||||||
|
@ -200,9 +198,9 @@ def write_ron_assets_file(level_name, assets_hierarchy, internal_only=False, lev
|
||||||
assets_file.writelines(formated_assets)
|
assets_file.writelines(formated_assets)
|
||||||
assets_file.write("\n})")
|
assets_file.write("\n})")
|
||||||
|
|
||||||
class OT_test_bevy_assets(Operator):
|
class BLENVY_OT_assets_generate_files(Operator):
|
||||||
"""Test assets"""
|
"""Test assets"""
|
||||||
bl_idname = "bevyassets.test"
|
bl_idname = "blenvy.assets_generate_files"
|
||||||
bl_label = "test bevy assets"
|
bl_label = "test bevy assets"
|
||||||
bl_options = {"UNDO"}
|
bl_options = {"UNDO"}
|
||||||
|
|
||||||
|
|
|
@ -26,12 +26,12 @@ def draw_assets(layout, name, title, asset_registry, target_type, target_name, e
|
||||||
|
|
||||||
row.prop(asset_registry, "asset_name_selector", text="")
|
row.prop(asset_registry, "asset_name_selector", text="")
|
||||||
row.label(text=asset_registry.asset_path_selector)
|
row.label(text=asset_registry.asset_path_selector)
|
||||||
row.operator(operator="asset.open_filebrowser", text="", icon="FILE_FOLDER")
|
row.operator(operator="blenvy.assets_open_filebrowser", text="", icon="FILE_FOLDER")
|
||||||
|
|
||||||
add_asset_layout = row.column()
|
add_asset_layout = row.column()
|
||||||
add_asset_layout.enabled = not add_possible
|
add_asset_layout.enabled = not add_possible
|
||||||
|
|
||||||
add_asset = add_asset_layout.operator(operator="bevyassets.add", text="", icon="ADD")
|
add_asset = add_asset_layout.operator(operator="blenvy.assets_add", text="", icon="ADD")
|
||||||
add_asset.target_type = target_type
|
add_asset.target_type = target_type
|
||||||
add_asset.target_name = target_name
|
add_asset.target_name = target_name
|
||||||
add_asset.asset_name = asset_registry.asset_name_selector
|
add_asset.asset_name = asset_registry.asset_name_selector
|
||||||
|
@ -55,15 +55,15 @@ def draw_assets(layout, name, title, asset_registry, target_type, target_name, e
|
||||||
row.label(icon="ASSET_MANAGER")
|
row.label(icon="ASSET_MANAGER")
|
||||||
row.prop(asset, "name", text="")
|
row.prop(asset, "name", text="")
|
||||||
row.label(text=asset.path)
|
row.label(text=asset.path)
|
||||||
asset_selector = row.operator(operator="asset.open_filebrowser", text="", icon="FILE_FOLDER")
|
asset_selector = row.operator(operator="blenvy.assets_open_filebrowser", text="", icon="FILE_FOLDER")
|
||||||
|
|
||||||
remove_asset = row.operator(operator="bevyassets.remove", text="", icon="TRASH")
|
remove_asset = row.operator(operator="blenvy.assets_remove", text="", icon="TRASH")
|
||||||
remove_asset.target_type = target_type
|
remove_asset.target_type = target_type
|
||||||
remove_asset.target_name = target_name
|
remove_asset.target_name = target_name
|
||||||
remove_asset.asset_path = asset.path
|
remove_asset.asset_path = asset.path
|
||||||
return panel
|
return panel
|
||||||
|
|
||||||
class Blenvy_assets(bpy.types.Panel):
|
class BLENVY_PT_assets_panel(bpy.types.Panel):
|
||||||
bl_space_type = 'VIEW_3D'
|
bl_space_type = 'VIEW_3D'
|
||||||
bl_region_type = 'UI'
|
bl_region_type = 'UI'
|
||||||
bl_label = ""
|
bl_label = ""
|
||||||
|
@ -79,7 +79,7 @@ class Blenvy_assets(bpy.types.Panel):
|
||||||
layout.use_property_decorate = False # No animation.
|
layout.use_property_decorate = False # No animation.
|
||||||
blenvy = context.window_manager.blenvy
|
blenvy = context.window_manager.blenvy
|
||||||
|
|
||||||
layout.operator(operator="bevyassets.test")
|
layout.operator(operator="blenvy.assets_generate_files")
|
||||||
|
|
||||||
asset_registry = context.window_manager.assets_registry
|
asset_registry = context.window_manager.assets_registry
|
||||||
blueprints_registry = context.window_manager.blueprints_registry
|
blueprints_registry = context.window_manager.blueprints_registry
|
||||||
|
|
|
@ -4,9 +4,9 @@ from bpy_types import (Operator)
|
||||||
from bpy.props import (StringProperty)
|
from bpy.props import (StringProperty)
|
||||||
from blenvy.core.helpers_collections import set_active_collection
|
from blenvy.core.helpers_collections import set_active_collection
|
||||||
|
|
||||||
class OT_select_blueprint(Operator):
|
class BLENVY_OT_blueprint_select(Operator):
|
||||||
"""Select blueprint """
|
"""Select blueprint """
|
||||||
bl_idname = "blueprint.select"
|
bl_idname = "blenvy.blueprint_select"
|
||||||
bl_label = "Select blueprint"
|
bl_label = "Select blueprint"
|
||||||
bl_options = {"UNDO"}
|
bl_options = {"UNDO"}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ def draw_blueprints(layout, name, title, generated_assets):
|
||||||
if sub_panel:
|
if sub_panel:
|
||||||
sub_panel.label(text=" some stuff")
|
sub_panel.label(text=" some stuff")
|
||||||
|
|
||||||
class GLTF_PT_auto_export_blueprints_list(bpy.types.Panel):
|
class BLENVY_PT_blueprints_panel(bpy.types.Panel):
|
||||||
bl_space_type = 'VIEW_3D'
|
bl_space_type = 'VIEW_3D'
|
||||||
bl_region_type = 'UI'
|
bl_region_type = 'UI'
|
||||||
bl_label = "Blueprints"
|
bl_label = "Blueprints"
|
||||||
|
@ -54,7 +54,7 @@ class GLTF_PT_auto_export_blueprints_list(bpy.types.Panel):
|
||||||
header.prop(blueprint.collection, "always_export")
|
header.prop(blueprint.collection, "always_export")
|
||||||
|
|
||||||
if blueprint.local:
|
if blueprint.local:
|
||||||
select_blueprint = header.operator(operator="blueprint.select", text="", icon="RESTRICT_SELECT_OFF")
|
select_blueprint = header.operator(operator="blenvy.blueprint_select", text="", icon="RESTRICT_SELECT_OFF")
|
||||||
if blueprint.collection and blueprint.collection.name:
|
if blueprint.collection and blueprint.collection.name:
|
||||||
select_blueprint.blueprint_collection_name = blueprint.collection.name
|
select_blueprint.blueprint_collection_name = blueprint.collection.name
|
||||||
select_blueprint.blueprint_scene_name = blueprint.scene.name
|
select_blueprint.blueprint_scene_name = blueprint.scene.name
|
||||||
|
|
|
@ -4,7 +4,7 @@ from bpy.props import (EnumProperty)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class OT_switch_bevy_tooling(Operator):
|
class BLENVY_OT_tooling_switch(Operator):
|
||||||
"""Switch bevy tooling"""
|
"""Switch bevy tooling"""
|
||||||
bl_idname = "bevy.tooling_switch"
|
bl_idname = "bevy.tooling_switch"
|
||||||
bl_label = "Switch bevy tooling"
|
bl_label = "Switch bevy tooling"
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import bpy
|
import bpy
|
||||||
from bpy.types import Operator
|
from bpy.types import Operator
|
||||||
|
|
||||||
class SCENES_LIST_OT_actions(Operator):
|
class BLENVY_OT_scenes_list_actions(Operator):
|
||||||
"""Move items up and down, add and remove"""
|
"""Move items up and down, add and remove"""
|
||||||
bl_idname = "scene_list.list_action"
|
bl_idname = "blenvy.scenes_list_actions"
|
||||||
bl_label = "List Actions"
|
bl_label = "List Actions"
|
||||||
bl_description = "Move items up and down, add and remove"
|
bl_description = "Move items up and down, add and remove"
|
||||||
bl_options = {'REGISTER'}
|
bl_options = {'REGISTER'}
|
||||||
|
|
|
@ -17,7 +17,7 @@ def draw_folder_browser(layout, label, prop_origin, target_property):
|
||||||
col.enabled = False
|
col.enabled = False
|
||||||
col.prop(prop_origin, target_property, text="")
|
col.prop(prop_origin, target_property, text="")
|
||||||
|
|
||||||
folder_selector = row.operator("generic.open_folderbrowser", icon="FILE_FOLDER", text="")
|
folder_selector = row.operator("blenvy.assets_paths_browse", icon="FILE_FOLDER", text="")
|
||||||
folder_selector.target_property = target_property #"project_root_path"
|
folder_selector.target_property = target_property #"project_root_path"
|
||||||
|
|
||||||
# side panel
|
# side panel
|
||||||
|
@ -109,7 +109,7 @@ class BLENVY_PT_SidePanel(bpy.types.Panel):
|
||||||
row = section.row()
|
row = section.row()
|
||||||
row.label(text="main scenes")
|
row.label(text="main scenes")
|
||||||
row.prop(blenvy, "main_scene_selector", text='')
|
row.prop(blenvy, "main_scene_selector", text='')
|
||||||
add_operator = row.operator("scene_list.list_action", icon='ADD', text="")
|
add_operator = row.operator("blenvy.scenes_list_actions", icon='ADD', text="")
|
||||||
add_operator.action = 'ADD'
|
add_operator.action = 'ADD'
|
||||||
add_operator.scene_type = 'LEVEL'
|
add_operator.scene_type = 'LEVEL'
|
||||||
#sub_row.enabled = blenvy.main_scene_selector is not None
|
#sub_row.enabled = blenvy.main_scene_selector is not None
|
||||||
|
@ -119,7 +119,7 @@ class BLENVY_PT_SidePanel(bpy.types.Panel):
|
||||||
for scene in blenvy.main_scenes:
|
for scene in blenvy.main_scenes:
|
||||||
sub_row = col.box().row()
|
sub_row = col.box().row()
|
||||||
sub_row.label(text=scene.name)
|
sub_row.label(text=scene.name)
|
||||||
remove_operator = sub_row.operator("scene_list.list_action", icon='TRASH', text="")
|
remove_operator = sub_row.operator("blenvy.scenes_list_actions", icon='TRASH', text="")
|
||||||
remove_operator.action = 'REMOVE'
|
remove_operator.action = 'REMOVE'
|
||||||
remove_operator.scene_type = 'LEVEL'
|
remove_operator.scene_type = 'LEVEL'
|
||||||
remove_operator.scene_name = scene.name
|
remove_operator.scene_name = scene.name
|
||||||
|
@ -130,7 +130,7 @@ class BLENVY_PT_SidePanel(bpy.types.Panel):
|
||||||
row = section.row()
|
row = section.row()
|
||||||
row.label(text="library scenes")
|
row.label(text="library scenes")
|
||||||
row.prop(blenvy, "library_scene_selector", text='')
|
row.prop(blenvy, "library_scene_selector", text='')
|
||||||
add_operator = row.operator("scene_list.list_action", icon='ADD', text="")
|
add_operator = row.operator("blenvy.scenes_list_actions", icon='ADD', text="")
|
||||||
add_operator.action = 'ADD'
|
add_operator.action = 'ADD'
|
||||||
add_operator.scene_type = 'LIBRARY'
|
add_operator.scene_type = 'LIBRARY'
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ class BLENVY_PT_SidePanel(bpy.types.Panel):
|
||||||
for scene in blenvy.library_scenes:
|
for scene in blenvy.library_scenes:
|
||||||
sub_row = col.box().row()
|
sub_row = col.box().row()
|
||||||
sub_row.label(text=scene.name)
|
sub_row.label(text=scene.name)
|
||||||
remove_operator = sub_row.operator("scene_list.list_action", icon='TRASH', text="")
|
remove_operator = sub_row.operator("blenvy.scenes_list_actions", icon='TRASH', text="")
|
||||||
remove_operator.action = 'REMOVE'
|
remove_operator.action = 'REMOVE'
|
||||||
remove_operator.scene_type = 'LEVEL'
|
remove_operator.scene_type = 'LEVEL'
|
||||||
remove_operator.scene_name = scene.name
|
remove_operator.scene_name = scene.name
|
||||||
|
|
|
@ -3,9 +3,9 @@ import bpy
|
||||||
from bpy_types import (Operator)
|
from bpy_types import (Operator)
|
||||||
from bpy.props import (StringProperty)
|
from bpy.props import (StringProperty)
|
||||||
|
|
||||||
class OT_select_level(Operator):
|
class BLENVY_OT_level_select(Operator):
|
||||||
"""Select level """
|
"""Select level """
|
||||||
bl_idname = "level.select"
|
bl_idname = "blenvy.level_select"
|
||||||
bl_label = "Select level"
|
bl_label = "Select level"
|
||||||
bl_options = {"UNDO"}
|
bl_options = {"UNDO"}
|
||||||
|
|
||||||
|
@ -20,7 +20,6 @@ class OT_select_level(Operator):
|
||||||
if scene:
|
if scene:
|
||||||
# bpy.ops.object.select_all(action='DESELECT')
|
# bpy.ops.object.select_all(action='DESELECT')
|
||||||
bpy.context.window.scene = scene
|
bpy.context.window.scene = scene
|
||||||
|
|
||||||
|
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
|
@ -4,12 +4,13 @@ from ..assets.asset_helpers import get_generated_assets, get_user_assets
|
||||||
from ..assets.ui import draw_assets
|
from ..assets.ui import draw_assets
|
||||||
from ..blueprints.ui import draw_blueprints
|
from ..blueprints.ui import draw_blueprints
|
||||||
|
|
||||||
class Blenvy_levels(bpy.types.Panel):
|
class BLENVY_PT_levels_panel(bpy.types.Panel):
|
||||||
bl_space_type = 'VIEW_3D'
|
bl_space_type = 'VIEW_3D'
|
||||||
bl_region_type = 'UI'
|
bl_region_type = 'UI'
|
||||||
bl_label = ""
|
bl_label = ""
|
||||||
bl_parent_id = "BLENVY_PT_SidePanel"
|
bl_parent_id = "BLENVY_PT_SidePanel"
|
||||||
bl_options = {'DEFAULT_CLOSED','HIDE_HEADER'}
|
bl_options = {'DEFAULT_CLOSED','HIDE_HEADER'}
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
return context.window_manager.blenvy.mode == 'LEVELS'
|
return context.window_manager.blenvy.mode == 'LEVELS'
|
||||||
|
@ -19,7 +20,7 @@ class Blenvy_levels(bpy.types.Panel):
|
||||||
layout.use_property_split = True
|
layout.use_property_split = True
|
||||||
layout.use_property_decorate = False # No animation.
|
layout.use_property_decorate = False # No animation.
|
||||||
blenvy = context.window_manager.blenvy
|
blenvy = context.window_manager.blenvy
|
||||||
layout.operator(operator="bevyassets.test", text="Generate")
|
layout.operator(operator="blenvy.assets_generate_files", text="Generate")
|
||||||
|
|
||||||
asset_registry = context.window_manager.assets_registry
|
asset_registry = context.window_manager.assets_registry
|
||||||
blueprints_registry = context.window_manager.blueprints_registry
|
blueprints_registry = context.window_manager.blueprints_registry
|
||||||
|
@ -31,7 +32,7 @@ class Blenvy_levels(bpy.types.Panel):
|
||||||
if header:
|
if header:
|
||||||
header.label(text=scene.name)#, icon="HIDE_OFF")
|
header.label(text=scene.name)#, icon="HIDE_OFF")
|
||||||
header.prop(scene, "always_export")
|
header.prop(scene, "always_export")
|
||||||
select_level = header.operator(operator="level.select", text="", icon="RESTRICT_SELECT_OFF")
|
select_level = header.operator(operator="blenvy.level_select", text="", icon="RESTRICT_SELECT_OFF")
|
||||||
select_level.level_name = scene.name
|
select_level.level_name = scene.name
|
||||||
|
|
||||||
if panel:
|
if panel:
|
||||||
|
|
|
@ -15,7 +15,7 @@ def setup_data(request):
|
||||||
|
|
||||||
type_infos = registry.type_infos
|
type_infos = registry.type_infos
|
||||||
object = bpy.context.object
|
object = bpy.context.object
|
||||||
remove_component_operator = bpy.ops.object.remove_bevy_component
|
remove_component_operator = bpy.ops.blenvy.component_remove
|
||||||
|
|
||||||
for long_name in type_infos:
|
for long_name in type_infos:
|
||||||
definition = type_infos[long_name]
|
definition = type_infos[long_name]
|
||||||
|
|
|
@ -196,7 +196,7 @@ def test_remove_components(setup_data):
|
||||||
|
|
||||||
# now test component removal
|
# now test component removal
|
||||||
errors.clear()
|
errors.clear()
|
||||||
remove_component_operator = bpy.ops.object.remove_bevy_component
|
remove_component_operator = bpy.ops.blenvy.component_remove
|
||||||
for long_name in added_components:
|
for long_name in added_components:
|
||||||
try:
|
try:
|
||||||
remove_component_operator(component_name=long_name)
|
remove_component_operator(component_name=long_name)
|
||||||
|
@ -225,7 +225,7 @@ def test_copy_paste_components(setup_data):
|
||||||
|
|
||||||
setattr(propertyGroup, propertyGroup.field_names[0], 25.0)
|
setattr(propertyGroup, propertyGroup.field_names[0], 25.0)
|
||||||
|
|
||||||
copy_component_operator = bpy.ops.object.copy_bevy_component
|
copy_component_operator = bpy.ops.blenvy.component_copy
|
||||||
copy_component_operator(source_component_name=long_name, source_item_name=object.name)
|
copy_component_operator(source_component_name=long_name, source_item_name=object.name)
|
||||||
|
|
||||||
# ---------------------------------------
|
# ---------------------------------------
|
||||||
|
@ -240,7 +240,7 @@ def test_copy_paste_components(setup_data):
|
||||||
# first check that there is no component currently
|
# first check that there is no component currently
|
||||||
assert component_meta == None
|
assert component_meta == None
|
||||||
|
|
||||||
paste_component_operator = bpy.ops.object.paste_bevy_component
|
paste_component_operator = bpy.ops.blenvy.component_paste
|
||||||
paste_component_operator()
|
paste_component_operator()
|
||||||
|
|
||||||
target_components_metadata = new_cube.components_meta.components
|
target_components_metadata = new_cube.components_meta.components
|
||||||
|
|
|
@ -27,7 +27,7 @@ def test_rename_component_single_unit_struct(setup_data):
|
||||||
registry.schema_path = setup_data["components_schemaPath"]
|
registry.schema_path = setup_data["components_schemaPath"]
|
||||||
bpy.ops.object.reload_registry()
|
bpy.ops.object.reload_registry()
|
||||||
|
|
||||||
rename_component_operator = bpy.ops.object.rename_bevy_component
|
rename_component_operator = bpy.ops.blenvy.component_rename
|
||||||
object = bpy.context.object
|
object = bpy.context.object
|
||||||
|
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ def test_rename_component_single_complex_struct(setup_data):
|
||||||
registry.schema_path = setup_data["components_schemaPath"]
|
registry.schema_path = setup_data["components_schemaPath"]
|
||||||
bpy.ops.object.reload_registry()
|
bpy.ops.object.reload_registry()
|
||||||
|
|
||||||
rename_component_operator = bpy.ops.object.rename_bevy_component
|
rename_component_operator = bpy.ops.blenvy.component_rename
|
||||||
object = bpy.context.object
|
object = bpy.context.object
|
||||||
|
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ def test_rename_component_bulk(setup_data):
|
||||||
registry.schema_path = setup_data["components_schemaPath"]
|
registry.schema_path = setup_data["components_schemaPath"]
|
||||||
bpy.ops.object.reload_registry()
|
bpy.ops.object.reload_registry()
|
||||||
|
|
||||||
rename_component_operator = bpy.ops.object.rename_bevy_component
|
rename_component_operator = bpy.ops.blenvy.component_rename
|
||||||
|
|
||||||
source_component_name = "bevy_example::test_components::SomeOldUnitStruct"
|
source_component_name = "bevy_example::test_components::SomeOldUnitStruct"
|
||||||
target_component_name = "bevy_example::test_components::UnitTest"
|
target_component_name = "bevy_example::test_components::UnitTest"
|
||||||
|
@ -98,7 +98,7 @@ def test_rename_component_single_error_handling(setup_data):
|
||||||
registry.schema_path = setup_data["components_schemaPath"]
|
registry.schema_path = setup_data["components_schemaPath"]
|
||||||
bpy.ops.object.reload_registry()
|
bpy.ops.object.reload_registry()
|
||||||
|
|
||||||
rename_component_operator = bpy.ops.object.rename_bevy_component
|
rename_component_operator = bpy.ops.blenvy.component_rename
|
||||||
object = bpy.context.object
|
object = bpy.context.object
|
||||||
|
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ def test_rename_component_single_error_handling_clean_errors(setup_data):
|
||||||
registry.schema_path = setup_data["components_schemaPath"]
|
registry.schema_path = setup_data["components_schemaPath"]
|
||||||
bpy.ops.object.reload_registry()
|
bpy.ops.object.reload_registry()
|
||||||
|
|
||||||
rename_component_operator = bpy.ops.object.rename_bevy_component
|
rename_component_operator = bpy.ops.blenvy.component_rename
|
||||||
object = bpy.context.object
|
object = bpy.context.object
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue