[Bf-extensions-cvs] [6e651fab] master: Collection Manager: Remove from contrib. Task: T69577

Ryan Inch noreply at git.blender.org
Mon Dec 9 06:53:30 CET 2019


Commit: 6e651fabf38a3f8c0cbab46e02651158e16acf64
Author: Ryan Inch
Date:   Mon Dec 9 00:48:55 2019 -0500
Branches: master
https://developer.blender.org/rBAC6e651fabf38a3f8c0cbab46e02651158e16acf64

Collection Manager: Remove from contrib. Task: T69577

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

D	collection_manager/__init__.py
D	collection_manager/internals.py
D	collection_manager/operators.py
D	collection_manager/ui.py

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

diff --git a/collection_manager/__init__.py b/collection_manager/__init__.py
deleted file mode 100644
index 75142a35..00000000
--- a/collection_manager/__init__.py
+++ /dev/null
@@ -1,121 +0,0 @@
-# ##### BEGIN GPL LICENSE BLOCK #####
-#
-#  This program is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU General Public License
-#  as published by the Free Software Foundation; either version 2
-#  of the License, or (at your option) any later version.
-#
-#  This program is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#  GNU General Public License for more details.
-#
-#  You should have received a copy of the GNU General Public License
-#  along with this program; if not, write to the Free Software Foundation,
-#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# ##### END GPL LICENSE BLOCK #####
-
-
-""" Copyright 2011 GPL licence applies"""
-
-bl_info = {
-    "name": "Collection Manager",
-    "description": "Manage collections and their objects",
-    "author": "Ryan Inch",
-    "version": (1,8,0),
-    "blender": (2, 80, 0),
-    "location": "View3D - Object Mode (Shortcut - M)",
-    "warning": '',  # used for warning icon and text in addons panel
-    "wiki_url": "",
-    "category": "User Interface"}
-
-
-if "bpy" in locals():
-    import importlib
-    
-    importlib.reload(internals)
-    importlib.reload(operators)
-    importlib.reload(ui)
-
-else:
-    from . import internals
-    from . import operators
-    from . import ui
-
-import bpy
-from bpy.props import (
-    CollectionProperty,
-    IntProperty,
-    BoolProperty,
-    )
-
-addon_keymaps = []
-
-classes = (
-    internals.CMListCollection,
-    operators.ExpandAllOperator,
-    operators.ExpandSublevelOperator,
-    operators.CMExcludeOperator,
-    operators.CMUnExcludeAllOperator,
-    operators.CMRestrictSelectOperator,
-    operators.CMUnRestrictSelectAllOperator,
-    operators.CMHideOperator,
-    operators.CMUnHideAllOperator,
-    operators.CMDisableViewportOperator,
-    operators.CMUnDisableViewportAllOperator,
-    operators.CMDisableRenderOperator,
-    operators.CMUnDisableRenderAllOperator,
-    operators.CMNewCollectionOperator,
-    operators.CMRemoveCollectionOperator,
-    operators.CMSetCollectionOperator,
-    operators.CMPhantomModeOperator,
-    ui.CM_UL_items,
-    ui.CollectionManager,
-    ui.CMRestrictionTogglesPanel,
-    )
-
-def register():
-    for cls in classes:
-        bpy.utils.register_class(cls)
-    
-    bpy.types.Scene.CMListCollection = CollectionProperty(type=internals.CMListCollection)
-    bpy.types.Scene.CMListIndex = IntProperty(update=ui.update_selection)
-    
-    bpy.types.Scene.show_exclude = BoolProperty(default=True, name="Exclude from View Layer")
-    bpy.types.Scene.show_selectable = BoolProperty(default=True, name="Selectable")
-    bpy.types.Scene.show_hideviewport = BoolProperty(default=True, name="Hide in Viewport")
-    bpy.types.Scene.show_disableviewport = BoolProperty(default=False, name="Disable in Viewports")
-    bpy.types.Scene.show_render = BoolProperty(default=False, name="Disable in Renders")
-    
-    bpy.types.Scene.CM_Phantom_Mode = BoolProperty(default=False)
-
-
-    # create the global menu hotkey
-    wm = bpy.context.window_manager
-    km = wm.keyconfigs.addon.keymaps.new(name='Object Mode')
-    kmi = km.keymap_items.new('view3d.collection_manager', 'M', 'PRESS')
-    addon_keymaps.append((km, kmi))
- 
-def unregister():
-    for cls in classes:
-        bpy.utils.unregister_class(cls)
-    
-    del bpy.types.Scene.CMListCollection
-    del bpy.types.Scene.CMListIndex
-    
-    del bpy.types.Scene.show_exclude
-    del bpy.types.Scene.show_selectable
-    del bpy.types.Scene.show_hideviewport
-    del bpy.types.Scene.show_disableviewport
-    del bpy.types.Scene.show_render
-    
-    del bpy.types.Scene.CM_Phantom_Mode
-    
-    # remove keymaps when add-on is deactivated
-    for km, kmi in addon_keymaps:
-        km.keymap_items.remove(kmi)
-    addon_keymaps.clear()
-    
-if __name__ == "__main__":
-    register()
diff --git a/collection_manager/internals.py b/collection_manager/internals.py
deleted file mode 100644
index e898de1c..00000000
--- a/collection_manager/internals.py
+++ /dev/null
@@ -1,107 +0,0 @@
-from bpy.types import PropertyGroup
-from bpy.props import StringProperty
-
-layer_collections = {}
-
-collection_tree = []
-
-expanded = []
-
-max_lvl = 0
-row_index = 0
-
-def get_max_lvl():
-    return max_lvl
-
-def update_col_name(self, context):
-    if self.name != self.last_name:
-        if self.name == '':
-            self.name = self.last_name
-            return
-        
-        if self.last_name != '':
-            layer_collections[self.last_name]["ptr"].collection.name = self.name
-            
-            update_property_group(context)
-        
-        self.last_name = self.name
-
-class CMListCollection(PropertyGroup):
-    name: StringProperty(update=update_col_name)
-    last_name: StringProperty()
-
-
-def update_collection_tree(context):
-    global max_lvl
-    global row_index
-    collection_tree.clear()
-    layer_collections.clear()
-    max_lvl = 0
-    row_index = 0
-    
-    init_laycol_list = context.view_layer.layer_collection.children
-    
-    master_laycol = {"id": 0,
-                     "name": context.view_layer.layer_collection.name,
-                     "lvl": -1,
-                     "row_index": -1,
-                     "visible": True,
-                     "has_children": True,
-                     "expanded": True,
-                     "parent": None,
-                     "children": [],
-                     "ptr": context.view_layer.layer_collection
-                     }
-    
-    get_all_collections(context, init_laycol_list, master_laycol, collection_tree, visible=True)
-
-
-def get_all_collections(context, collections, parent, tree, level=0, visible=False):
-    global row_index
-    
-    for item in collections:
-        laycol = {"id": len(layer_collections) +1,
-                  "name": item.name,
-                  "lvl": level,
-                  "row_index": row_index,
-                  "visible":  visible,
-                  "has_children": False,
-                  "expanded": False,
-                  "parent": parent,
-                  "children": [],
-                  "ptr": item
-                  }
-        
-        row_index += 1
-        
-        layer_collections[item.name] = laycol
-        tree.append(laycol)
-        
-        if len(item.children) > 0:
-            global max_lvl
-            max_lvl += 1
-            laycol["has_children"] = True
-            
-            if item.name in expanded and laycol["visible"]:
-                laycol["expanded"] = True
-                get_all_collections(context, item.children, laycol, laycol["children"], level+1,  visible=True)
-                
-            else:
-                get_all_collections(context, item.children, laycol, laycol["children"], level+1)
-
-
-def update_property_group(context):
-    update_collection_tree(context)
-    context.scene.CMListCollection.clear()
-    create_property_group(context, collection_tree)
-
-
-def create_property_group(context, tree):
-    global in_filter
-    
-    for laycol in tree:
-        new_cm_listitem = context.scene.CMListCollection.add()
-        new_cm_listitem.name = laycol["name"]
-    
-        if laycol["has_children"]:
-            create_property_group(context, laycol["children"])
diff --git a/collection_manager/operators.py b/collection_manager/operators.py
deleted file mode 100644
index 84396e7e..00000000
--- a/collection_manager/operators.py
+++ /dev/null
@@ -1,1210 +0,0 @@
-import bpy
-from bpy.types import Operator
-from bpy.props import (
-    BoolProperty,
-    StringProperty,
-    IntProperty
-    )
-
-from .internals import *
-
-rto_history = {"exclude": {},
-               "exclude_all": {},
-               "select": {},
-               "select_all": {},
-               "hide": {},
-               "hide_all": {},
-               "disable": {},
-               "disable_all": {},
-               "render": {},
-               "render_all": {}
-               }
-
-class ExpandAllOperator(bpy.types.Operator):
-    '''Expand/Collapse all collections'''
-    bl_label = "Expand All Items"
-    bl_idname = "view3d.expand_all_items"
-    bl_options = {'REGISTER', 'UNDO'}
-    
-    def execute(self, context):
-        if len(expanded) > 0:
-            expanded.clear()
-        else:
-            for laycol in layer_collections.values():
-                if laycol["ptr"].children:
-                    expanded.append(laycol["name"])
-        
-        # update tree view
-        update_property_group(context)
-        
-        return {'FINISHED'}
-
-
-class ExpandSublevelOperator(bpy.types.Operator):
-    '''  * Shift-Click to expand/collapse all sublevels'''
-    bl_label = "Expand Sublevel Items"
-    bl_idname = "view3d.expand_sublevel"
-    bl_options = {'REGISTER', 'UNDO'}
-    
-    expand: BoolProperty()
-    name: StringProperty()
-    index: IntProperty()
-    
-    def invoke(self, context, event):
-        if event.shift:
-            # expand/collapse all subcollections
-            expand = None
-            
-            # check whether to expand or collapse
-            if self.name in expanded:
-                expanded.remove(self.name)
-                expand = False
-            else:
-                expanded.append(self.name)
-                expand = True
-            
-            # do expanding/collapsing
-            def loop(laycol):
-                for item in laycol.children:
-                    if expand:
-                        if not item.name in expanded:
-                            expanded.append(item.name)
-                    else:
-                        if item.name in expanded:
-                            expanded.remove(item.name)
-                        
-                    if len(item.children) > 0:
-                        loop(i

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list