[Bf-blender-cvs] [c11c2a4b91d] master: WM: batch rename collections outside the outliner

Campbell Barton noreply at git.blender.org
Tue Jan 18 05:05:16 CET 2022


Commit: c11c2a4b91d57bed588615734da858ac3c2af5b3
Author: Campbell Barton
Date:   Tue Jan 18 10:45:14 2022 +1100
Branches: master
https://developer.blender.org/rBc11c2a4b91d57bed588615734da858ac3c2af5b3

WM: batch rename collections outside the outliner

Use selected objects collection instances to rename in the 3D view.

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

M	release/scripts/startup/bl_operators/wm.py

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

diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py
index 798e745ce95..5ee857d7ea2 100644
--- a/release/scripts/startup/bl_operators/wm.py
+++ b/release/scripts/startup/bl_operators/wm.py
@@ -2597,6 +2597,20 @@ class WM_OT_batch_rename(Operator):
                     "name",
                     "Object(s)",
                 )
+            elif data_type == 'COLLECTION':
+                data = (
+                    tuple(set(
+                        ob.instance_collection
+                        for ob in context.selected_objects
+                        if ((ob.instance_type == 'COLLECTION') and
+                            (collection := ob.instance_collection) is not None and
+                            (collection.library is None))
+                    ))
+                    if only_selected else
+                    [id for id in bpy.data.collections if id.library is None],
+                    "name",
+                    "Collection(s)",
+                )
             elif data_type == 'MATERIAL':
                 data = (
                     tuple(set(



More information about the Bf-blender-cvs mailing list