-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtools_materials_ops.py
37 lines (28 loc) · 1.09 KB
/
tools_materials_ops.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Nikita Akimov
#
# GitHub
# https://github.com/Korchy/BIS
from bpy.types import Operator
from bpy.utils import register_class, unregister_class
from .tools_materials import ToolsMaterials
class BIS_OT_tools_materials_active_to_selected(Operator):
bl_idname = 'bis.materials_active_to_selected'
bl_label = 'Material: Active to Selected'
bl_description = 'Copy material from active object to selected objects'
bl_options = {'REGISTER', 'UNDO'}
def execute(self, context):
ToolsMaterials.material_from_active_object_to_selected(context=context)
return {'FINISHED'}
@classmethod
def poll(cls, context):
selected_objects = context.selected_objects[:]
if context.active_object in selected_objects:
selected_objects.remove(context.active_object)
if context.active_object and selected_objects:
return True
return False
def register():
register_class(BIS_OT_tools_materials_active_to_selected)
def unregister():
unregister_class(BIS_OT_tools_materials_active_to_selected)