Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Inch <mythologylover75@gmail.com>2020-09-26 10:20:53 +0300
committerRyan Inch <mythologylover75@gmail.com>2020-09-26 10:20:53 +0300
commitbf176041da95d4b07d74727acb78f7cf6a46785e (patch)
tree23ac07c7a260172f8767c2f31c63404d9cf61870 /object_collection_manager/operator_utils.py
parent3d2076556a73af15779fc06630a3254fd584af02 (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/operator_utils.py')
-rw-r--r--object_collection_manager/operator_utils.py46
1 files changed, 44 insertions, 2 deletions
diff --git a/object_collection_manager/operator_utils.py b/object_collection_manager/operator_utils.py
index 20c7dee7..2544b76b 100644
--- a/object_collection_manager/operator_utils.py
+++ b/object_collection_manager/operator_utils.py
@@ -31,6 +31,29 @@ from .internals import (
get_move_selection,
)
+mode_converter = {
+ 'EDIT_MESH': 'EDIT',
+ 'EDIT_CURVE': 'EDIT',
+ 'EDIT_SURFACE': 'EDIT',
+ 'EDIT_TEXT': 'EDIT',
+ 'EDIT_ARMATURE': 'EDIT',
+ 'EDIT_METABALL': 'EDIT',
+ 'EDIT_LATTICE': 'EDIT',
+ 'POSE': 'POSE',
+ 'SCULPT': 'SCULPT',
+ 'PAINT_WEIGHT': 'WEIGHT_PAINT',
+ 'PAINT_VERTEX': 'VERTEX_PAINT',
+ 'PAINT_TEXTURE': 'TEXTURE_PAINT',
+ 'PARTICLE': 'PARTICLE_EDIT',
+ 'OBJECT': 'OBJECT',
+ 'PAINT_GPENCIL': 'PAINT_GPENCIL',
+ 'EDIT_GPENCIL': 'EDIT_GPENCIL',
+ 'SCULPT_GPENCIL': 'SCULPT_GPENCIL',
+ 'WEIGHT_GPENCIL': 'WEIGHT_GPENCIL',
+ 'VERTEX_GPENCIL': 'VERTEX_GPENCIL',
+ }
+
+
rto_path = {
"exclude": "exclude",
"select": "collection.hide_select",
@@ -469,7 +492,7 @@ def remove_collection(laycol, collection, context):
cm.cm_list_index = laycol["row_index"]
-def select_collection_objects(is_master_collection, collection_name, replace, nested):
+def select_collection_objects(is_master_collection, collection_name, replace, nested, selection_state=None):
if is_master_collection:
target_collection = bpy.context.view_layer.layer_collection.collection
@@ -480,7 +503,8 @@ def select_collection_objects(is_master_collection, collection_name, replace, ne
if replace:
bpy.ops.object.select_all(action='DESELECT')
- selection_state = get_move_selection().isdisjoint(target_collection.objects)
+ if selection_state == None:
+ selection_state = get_move_selection().isdisjoint(target_collection.objects)
def select_objects(collection):
for obj in collection.objects:
@@ -493,3 +517,21 @@ def select_collection_objects(is_master_collection, collection_name, replace, ne
if nested:
apply_to_children(target_collection, select_objects)
+
+def set_exclude_state(target_layer_collection, state):
+ # get current child exclusion state
+ child_exclusion = []
+
+ def get_child_exclusion(layer_collection):
+ child_exclusion.append([layer_collection, layer_collection.exclude])
+
+ apply_to_children(target_layer_collection, get_child_exclusion)
+
+
+ # set exclusion
+ target_layer_collection.exclude = state
+
+
+ # set correct state for all children
+ for laycol in child_exclusion:
+ laycol[0].exclude = laycol[1]