WM: batch rename collections
User must activate the operator from the outliner, so that the selected collections can be determined. Reviewed By: campbellbarton Ref D13821
This commit is contained in:
@@ -23,6 +23,7 @@ import bpy
|
|||||||
from bpy.types import (
|
from bpy.types import (
|
||||||
Menu,
|
Menu,
|
||||||
Operator,
|
Operator,
|
||||||
|
Collection,
|
||||||
bpy_prop_array,
|
bpy_prop_array,
|
||||||
)
|
)
|
||||||
from bpy.props import (
|
from bpy.props import (
|
||||||
@@ -2467,6 +2468,7 @@ class WM_OT_batch_rename(Operator):
|
|||||||
name="Type",
|
name="Type",
|
||||||
items=(
|
items=(
|
||||||
('OBJECT', "Objects", ""),
|
('OBJECT', "Objects", ""),
|
||||||
|
('COLLECTION', "Collections", ""),
|
||||||
('MATERIAL', "Materials", ""),
|
('MATERIAL', "Materials", ""),
|
||||||
None,
|
None,
|
||||||
# Enum identifiers are compared with 'object.type'.
|
# Enum identifiers are compared with 'object.type'.
|
||||||
@@ -2531,6 +2533,18 @@ class WM_OT_batch_rename(Operator):
|
|||||||
"name",
|
"name",
|
||||||
"Node(s)",
|
"Node(s)",
|
||||||
)
|
)
|
||||||
|
elif space_type == 'OUTLINER':
|
||||||
|
data_type_test = 'COLLECTION'
|
||||||
|
if check_context:
|
||||||
|
return data_type_test
|
||||||
|
if data_type == data_type_test:
|
||||||
|
data = (
|
||||||
|
[id for id in context.selected_ids if isinstance(id, Collection)]
|
||||||
|
if only_selected else
|
||||||
|
scene.collection.children_recursive,
|
||||||
|
"name",
|
||||||
|
"Collection(s)",
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
if mode == 'POSE' or (mode == 'WEIGHT_PAINT' and context.pose_object):
|
if mode == 'POSE' or (mode == 'WEIGHT_PAINT' and context.pose_object):
|
||||||
data_type_test = 'BONE'
|
data_type_test = 'BONE'
|
||||||
|
|||||||
Reference in New Issue
Block a user