[Bf-extensions-cvs] [61f1c0ae] master: Collection Manager: Add discard state feature. Task: T69577
Ryan Inch
noreply at git.blender.org
Wed Mar 18 05:49:12 CET 2020
Commit: 61f1c0aef5a6dc480a77c8246cbed9a9dab3c789
Author: Ryan Inch
Date: Wed Mar 18 00:22:25 2020 -0400
Branches: master
https://developer.blender.org/rBA61f1c0aef5a6dc480a77c8246cbed9a9dab3c789
Collection Manager: Add discard state feature. Task: T69577
Adds feature to discard histories for RTOs and the expand operator,
and to discard copy/swap buffers.
===================================================================
M object_collection_manager/__init__.py
M object_collection_manager/operators.py
===================================================================
diff --git a/object_collection_manager/__init__.py b/object_collection_manager/__init__.py
index e3f47c10..a55d60fa 100644
--- a/object_collection_manager/__init__.py
+++ b/object_collection_manager/__init__.py
@@ -22,7 +22,7 @@ bl_info = {
"name": "Collection Manager",
"description": "Manage collections and their objects",
"author": "Ryan Inch",
- "version": (2,2,1),
+ "version": (2,3,2),
"blender": (2, 80, 0),
"location": "View3D - Object Mode (Shortcut - M)",
"warning": '', # used for warning icon and text in addons panel
diff --git a/object_collection_manager/operators.py b/object_collection_manager/operators.py
index 5e7f465e..bf7a77f8 100644
--- a/object_collection_manager/operators.py
+++ b/object_collection_manager/operators.py
@@ -79,7 +79,7 @@ class ExpandAllOperator(Operator):
expand_history = {"target": "", "history": []}
class ExpandSublevelOperator(Operator):
- ''' * Ctrl-Click to expand/collapse all sublevels\n * Shift-Click to isolate/restore tree'''
+ ''' * Ctrl-Click to expand/collapse all sublevels\n * Shift-Click to isolate/restore tree\n * Alt-Click to discard history'''
bl_label = "Expand Sublevel Items"
bl_idname = "view3d.expand_sublevel"
bl_options = {'REGISTER', 'UNDO'}
@@ -97,7 +97,12 @@ class ExpandSublevelOperator(Operator):
modifiers = get_modifiers(event)
- if modifiers == {"ctrl"}:
+ if modifiers == {"alt"}:
+ expand_history["target"] = ""
+ expand_history["history"].clear()
+ cls.isolated = False
+
+ elif modifiers == {"ctrl"}:
# expand/collapse all subcollections
expand = None
@@ -211,7 +216,7 @@ class CMSetCollectionOperator(Operator):
class CMExcludeOperator(Operator):
- ''' * Shift-Click to isolate/restore previous state\n * Ctrl-Click to toggle children\n * Shift-Ctrl-Click to toggle nested isolation'''
+ ''' * Shift-Click to isolate/restore previous state\n * Ctrl-Click to toggle children\n * Shift-Ctrl-Click to toggle nested isolation\n * Alt-Click to discard history'''
bl_label = "Exclude Collection from View Layer"
bl_idname = "view3d.exclude_collection"
bl_options = {'REGISTER', 'UNDO'}
@@ -235,7 +240,11 @@ class CMExcludeOperator(Operator):
target = rto_history["exclude"][view_layer]["target"]
exclude_history = rto_history["exclude"][view_layer]["history"]
- if modifiers == {"shift"}:
+ if modifiers == {"alt"}:
+ del rto_history["exclude"][view_layer]
+ cls.isolated = False
+
+ elif modifiers == {"shift"}:
# isolate/de-isolate exclusion of collections
active_layer_collections = [x["ptr"] for x in layer_collections.values()
@@ -408,13 +417,15 @@ class CMExcludeOperator(Operator):
class CMUnExcludeAllOperator(Operator):
- ''' * Click to toggle between current excluded state and all included.\n * Shift-Click to invert excluded status of all collections\n * Ctrl-Click to Copy/Paste RTOs\n * Ctrl-Alt-Click to swap RTOs'''
+ ''' * Click to toggle between current excluded state and all included.\n * Shift-Click to invert excluded status of all collections\n * Ctrl-Click to Copy/Paste RTOs\n * Ctrl-Alt-Click to swap RTOs\n * Alt-Click to discard history and copy/swap actions'''
bl_label = "Toggle Excluded Status Of All Collections"
bl_idname = "view3d.un_exclude_all_collections"
bl_options = {'REGISTER', 'UNDO'}
def invoke(self, context, event):
global rto_history
+ global copy_buffer
+ global swap_buffer
view_layer = context.view_layer.name
modifiers = get_modifiers(event)
@@ -424,9 +435,25 @@ class CMUnExcludeAllOperator(Operator):
exclude_all_history = rto_history["exclude_all"][view_layer]
- if modifiers == {"ctrl"}:
- global copy_buffer
+ if modifiers == {"alt"}:
+ # clear RTO history
+ del rto_history["exclude_all"][view_layer]
+ # clear copy buffer
+ if copy_buffer["RTO"] == "exclude":
+ copy_buffer["RTO"] = ""
+ copy_buffer["values"].clear()
+
+ # clear swap buffer
+ if swap_buffer["A"]["RTO"] == "exclude":
+ swap_buffer["A"]["RTO"] = ""
+ swap_buffer["A"]["values"].clear()
+ swap_buffer["B"]["RTO"] = ""
+ swap_buffer["B"]["values"].clear()
+
+ return {'FINISHED'}
+
+ if modifiers == {"ctrl"}:
if not copy_buffer["values"]:
# copy
copy_buffer["RTO"] = "exclude"
@@ -448,8 +475,6 @@ class CMUnExcludeAllOperator(Operator):
return {'FINISHED'}
if modifiers == {"ctrl", "alt"}:
- global swap_buffer
-
if not swap_buffer["A"]["values"]:
# get A
swap_buffer["A"]["RTO"] = "exclude"
@@ -528,7 +553,7 @@ class CMUnExcludeAllOperator(Operator):
class CMRestrictSelectOperator(Operator):
- ''' * Shift-Click to isolate/restore previous state\n * Ctrl-Click to toggle children\n * Shift-Ctrl-Click to toggle nested isolation'''
+ ''' * Shift-Click to isolate/restore previous state\n * Ctrl-Click to toggle children\n * Shift-Ctrl-Click to toggle nested isolation\n * Alt-Click to discard history'''
bl_label = "Disable Selection of Collection"
bl_idname = "view3d.restrict_select_collection"
bl_options = {'REGISTER', 'UNDO'}
@@ -552,7 +577,11 @@ class CMRestrictSelectOperator(Operator):
target = rto_history["select"][view_layer]["target"]
select_history = rto_history["select"][view_layer]["history"]
- if modifiers == {"shift"}:
+ if modifiers == {"alt"}:
+ del rto_history["select"][view_layer]
+ cls.isolated = False
+
+ elif modifiers == {"shift"}:
# isolate/de-isolate selectability of collections
laycol = layer_collections[self.name]
@@ -720,13 +749,15 @@ class CMRestrictSelectOperator(Operator):
class CMUnRestrictSelectAllOperator(Operator):
- ''' * Click to toggle between current selectable state and all selectable.\n * Shift-Click to invert selectable status of all collections\n * Ctrl-Click to Copy/Paste RTOs\n * Ctrl-Alt-Click to swap RTOs'''
+ ''' * Click to toggle between current selectable state and all selectable.\n * Shift-Click to invert selectable status of all collections\n * Ctrl-Click to Copy/Paste RTOs\n * Ctrl-Alt-Click to swap RTOs\n * Alt-Click to discard history and copy/swap actions'''
bl_label = "Toggle Selectable Status Of All Collections"
bl_idname = "view3d.un_restrict_select_all_collections"
bl_options = {'REGISTER', 'UNDO'}
def invoke(self, context, event):
global rto_history
+ global copy_buffer
+ global swap_buffer
view_layer = context.view_layer.name
modifiers = get_modifiers(event)
@@ -736,9 +767,25 @@ class CMUnRestrictSelectAllOperator(Operator):
select_all_history = rto_history["select_all"][view_layer]
- if modifiers == {"ctrl"}:
- global copy_buffer
+ if modifiers == {"alt"}:
+ # clear RTO history
+ del rto_history["select_all"][view_layer]
+
+ # clear copy buffer
+ if copy_buffer["RTO"] == "collection.hide_select":
+ copy_buffer["RTO"] = ""
+ copy_buffer["values"].clear()
+
+ # clear swap buffer
+ if swap_buffer["A"]["RTO"] == "collection.hide_select":
+ swap_buffer["A"]["RTO"] = ""
+ swap_buffer["A"]["values"].clear()
+ swap_buffer["B"]["RTO"] = ""
+ swap_buffer["B"]["values"].clear()
+
+ return {'FINISHED'}
+ if modifiers == {"ctrl"}:
if not copy_buffer["values"]:
# copy
copy_buffer["RTO"] = "collection.hide_select"
@@ -760,8 +807,6 @@ class CMUnRestrictSelectAllOperator(Operator):
return {'FINISHED'}
if modifiers == {"ctrl", "alt"}:
- global swap_buffer
-
if not swap_buffer["A"]["values"]:
# get A
swap_buffer["A"]["RTO"] = "collection.hide_select"
@@ -836,7 +881,7 @@ class CMUnRestrictSelectAllOperator(Operator):
class CMHideOperator(Operator):
- ''' * Shift-Click to isolate/restore previous state\n * Ctrl-Click to toggle children\n * Shift-Ctrl-Click to toggle nested isolation'''
+ ''' * Shift-Click to isolate/restore previous state\n * Ctrl-Click to toggle children\n * Shift-Ctrl-Click to toggle nested isolation\n * Alt-Click to discard history'''
bl_label = "Hide Collection"
bl_idname = "view3d.hide_collection"
bl_options = {'REGISTER', 'UNDO'}
@@ -860,7 +905,11 @@ class CMHideOperator(Operator):
target = rto_history["hide"][view_layer]["target"]
hide_history = rto_history["hide"][view_layer]["history"]
- if modifiers == {"shift"}:
+ if modifiers == {"alt"}:
+ del rto_history["hide"][view_layer]
+ cls.isolated = False
+
+ elif modifiers == {"shift"}:
# isolate/de-isolate view of collections
laycol = layer_collections[self.name]
@@ -1028,13 +1077,15 @@ class CMHideOperator(Operator):
class CMUnHideAllOperator(Operator):
- ''' * Click to toggle between current visibility state and all visible.\n * Shift-Click to invert visibility status of all collections\n * Ctrl-Click to Copy/Paste RTOs\n * Ctrl-Alt-Click to swap RTOs'''
+ ''' * Click to toggle between current visibility state and all visible.\n * Shift-Click to invert visibility status of all collections\n * Ctrl-Click to Copy/Paste RTOs\n * Ctrl-Alt-Click to swap RTOs\n * Alt-Click to discard history and copy/swap actions'''
bl_label = "Toggle Hidden Status Of All Collections"
bl_idname = "view3d.un_hide_all_collections"
bl_options = {'REGISTER', 'UNDO'}
def invoke(self, context, event):
global rto_history
+ gl
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list