[Bf-extensions-cvs] [cee17513] master: Collection Manager: Add Operator. Task: T69577

Ryan Inch noreply at git.blender.org
Wed Jul 22 10:06:41 CEST 2020


Commit: cee175131c6d71a5c7043c8c3e177654d7b7ad86
Author: Ryan Inch
Date:   Wed Jul 22 04:05:26 2020 -0400
Branches: master
https://developer.blender.org/rBAcee175131c6d71a5c7043c8c3e177654d7b7ad86

Collection Manager: Add Operator. Task: T69577

Add Apply Phantom Mode operator.

===================================================================

M	object_collection_manager/__init__.py
M	object_collection_manager/operators.py
M	object_collection_manager/ui.py

===================================================================

diff --git a/object_collection_manager/__init__.py b/object_collection_manager/__init__.py
index 04422b84..fb9c0c49 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, 11, 0),
+    "version": (2, 12, 0),
     "blender": (2, 80, 0),
     "location": "View3D - Object Mode (Shortcut - M)",
     "warning": '',  # used for warning icon and text in addons panel
@@ -113,6 +113,7 @@ classes = (
     operators.CMRemoveEmptyCollectionsOperator,
     operators.CMSetCollectionOperator,
     operators.CMPhantomModeOperator,
+    operators.CMApplyPhantomModeOperator,
     preferences.CMPreferences,
     ui.CM_UL_items,
     ui.CollectionManager,
diff --git a/object_collection_manager/operators.py b/object_collection_manager/operators.py
index 642860fa..1025535e 100644
--- a/object_collection_manager/operators.py
+++ b/object_collection_manager/operators.py
@@ -1099,3 +1099,15 @@ class CMPhantomModeOperator(Operator):
 
 
         return {'FINISHED'}
+
+
+class CMApplyPhantomModeOperator(Operator):
+    '''Make all changes made in Phantom Mode permanent'''
+    bl_label = "Apply Phantom Mode"
+    bl_idname = "view3d.apply_phantom_mode"
+
+    def execute(self, context):
+        cm = context.scene.collection_manager
+        cm.in_phantom_mode = False
+
+        return {'FINISHED'}
diff --git a/object_collection_manager/ui.py b/object_collection_manager/ui.py
index fab65c67..c6403fe2 100644
--- a/object_collection_manager/ui.py
+++ b/object_collection_manager/ui.py
@@ -315,10 +315,14 @@ class CollectionManager(Operator):
                                icon='COLLECTION_NEW')
         prop.child = True
 
-        # phantom mode
+
         button_row_3 = layout.row()
+
+        # phantom mode
+        phantom_mode = button_row_3.row(align=True)
         toggle_text = "Disable " if cm.in_phantom_mode else "Enable "
-        button_row_3.operator("view3d.toggle_phantom_mode", text=toggle_text+"Phantom Mode")
+        phantom_mode.operator("view3d.toggle_phantom_mode", text=toggle_text+"Phantom Mode")
+        phantom_mode.operator("view3d.apply_phantom_mode", text="", icon='CHECKMARK')
 
         if cm.in_phantom_mode:
             view.enabled = False



More information about the Bf-extensions-cvs mailing list