diff options
author | Ryan Inch <mythologylover75@gmail.com> | 2020-09-26 10:20:53 +0300 |
---|---|---|
committer | Ryan Inch <mythologylover75@gmail.com> | 2020-09-26 10:20:53 +0300 |
commit | bf176041da95d4b07d74727acb78f7cf6a46785e (patch) | |
tree | 23ac07c7a260172f8767c2f31c63404d9cf61870 /object_collection_manager/ui.py | |
parent | 3d2076556a73af15779fc06630a3254fd584af02 (diff) |
Collection Manager: Add QVT. Task: T69577
Add Quick View Toggles for influencing QCD setup,
e.g. enable all slots.
Fix bugs with QCD slot switching.
Fix the active object sometimes getting lost when toggling slots.
Diffstat (limited to 'object_collection_manager/ui.py')
-rw-r--r-- | object_collection_manager/ui.py | 64 |
1 files changed, 61 insertions, 3 deletions
diff --git a/object_collection_manager/ui.py b/object_collection_manager/ui.py index 4c1eb077..8d7acc30 100644 --- a/object_collection_manager/ui.py +++ b/object_collection_manager/ui.py @@ -35,10 +35,12 @@ from bpy.props import ( from .internals import ( collection_tree, collection_state, + qcd_collection_state, expanded, get_max_lvl, layer_collections, rto_history, + qcd_history, expand_history, phantom_history, copy_buffer, @@ -52,6 +54,10 @@ from .internals import ( update_qcd_header, ) +from .qcd_operators import ( + QCDAllBase, +) + preview_collections = {} last_icon_theme_text = None @@ -842,18 +848,70 @@ class SpecialsMenu(Menu): prop.without_objects = True +class EnableAllQCDSlotsMenu(Menu): + bl_label = "Global QCD Slot Actions" + bl_idname = "VIEW3D_MT_CM_qcd_enable_all_menu" + + def draw(self, context): + layout = self.layout + + layout.operator("view3d.enable_all_qcd_slots") + layout.operator("view3d.enable_all_qcd_slots_isolated") + + layout.separator() + + layout.operator("view3d.disable_all_non_qcd_slots") + layout.operator("view3d.disable_all_collections") + + if context.mode == 'OBJECT': + layout.separator() + layout.operator("view3d.select_all_qcd_objects") + + layout.separator() + + layout.operator("view3d.discard_qcd_history") + + def view3d_header_qcd_slots(self, context): + global qcd_collection_state + + update_collection_tree(context) + + view_layer = context.view_layer + layout = self.layout idx = 1 - split = layout.split() + if qcd_collection_state: + view_layer = context.view_layer + new_state = generate_state(qcd=True) + + if (new_state["name"] != qcd_collection_state["name"] + or new_state["exclude"] != qcd_collection_state["exclude"] + or new_state["exclude"] != qcd_collection_state["exclude"] + or new_state["qcd"] != qcd_collection_state["qcd"]): + if view_layer.name in qcd_history: + del qcd_history[view_layer.name] + qcd_collection_state.clear() + QCDAllBase.clear() + + + main_row = layout.row(align=True) + current_qcd_history = qcd_history.get(context.view_layer.name, []) + + main_row.operator_menu_hold("view3d.enable_all_qcd_slots_meta", + text="", + icon='HIDE_OFF', + depress=bool(current_qcd_history), + menu="VIEW3D_MT_CM_qcd_enable_all_menu") + + + split = main_row.split() col = split.column(align=True) row = col.row(align=True) row.scale_y = 0.5 - update_collection_tree(context) - selected_objects = get_move_selection() active_object = get_move_active() |