Make it easy to re-collapse packages after expanding many at once
This commit is contained in:
@@ -649,7 +649,7 @@ class ViewPackage:
|
|||||||
class WM_OT_package_toggle_expand(bpy.types.Operator):
|
class WM_OT_package_toggle_expand(bpy.types.Operator):
|
||||||
bl_idname = "wm.package_toggle_expand"
|
bl_idname = "wm.package_toggle_expand"
|
||||||
bl_label = ""
|
bl_label = ""
|
||||||
bl_description = "Toggle display of extended information for given package"
|
bl_description = "Toggle display of extended information for given package (hold shift to collapse all other packages)"
|
||||||
bl_options = {'INTERNAL'}
|
bl_options = {'INTERNAL'}
|
||||||
|
|
||||||
log = logging.getLogger(__name__ + ".WM_OT_package_toggle_expand")
|
log = logging.getLogger(__name__ + ".WM_OT_package_toggle_expand")
|
||||||
@@ -659,7 +659,7 @@ class WM_OT_package_toggle_expand(bpy.types.Operator):
|
|||||||
description="Name of package to expand/collapse",
|
description="Name of package to expand/collapse",
|
||||||
)
|
)
|
||||||
|
|
||||||
def execute(self, context):
|
def invoke(self, context, event):
|
||||||
try:
|
try:
|
||||||
pkg = USERPREF_PT_packages.all_packages[self.package_name]
|
pkg = USERPREF_PT_packages.all_packages[self.package_name]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
@@ -667,6 +667,10 @@ class WM_OT_package_toggle_expand(bpy.types.Operator):
|
|||||||
return {'CANCELLED'}
|
return {'CANCELLED'}
|
||||||
|
|
||||||
pkg.expanded = not pkg.expanded
|
pkg.expanded = not pkg.expanded
|
||||||
|
if event.shift:
|
||||||
|
for pkgname in USERPREF_PT_packages.displayed_packages:
|
||||||
|
if not pkgname == self.package_name:
|
||||||
|
USERPREF_PT_packages.all_packages[pkgname].expanded = False
|
||||||
|
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user