diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2021-05-14 18:59:16 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2021-05-14 19:02:04 +0300 |
commit | f6cb9433d45a5504ffba17d0971e9b23b3632a54 (patch) | |
tree | 40ed676a6af83adbe4d547bf0c3b9014f5507bca /release | |
parent | 8c80267352f171269a2d1c12c780db86ab27a023 (diff) |
GPencil: Refactor Append operators
Now the operators work like other areas of Blender using the list of selected objects.
Also, the name has been changed to:
```Layers:
- Copy Layer to Selected
- Copy All Layers to Selected
Materials:
- Copy Material to Selected
- Copy All Materials to Selected```
Reviewed By: mendio, pablovazquez, pepeland
Differential Revision: https://developer.blender.org/D11216
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/startup/bl_ui/properties_data_gpencil.py | 4 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/properties_material_gpencil.py | 14 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_view3d.py | 73 |
3 files changed, 10 insertions, 81 deletions
diff --git a/release/scripts/startup/bl_ui/properties_data_gpencil.py b/release/scripts/startup/bl_ui/properties_data_gpencil.py index d88c9a3502d..e71ea2f31a4 100644 --- a/release/scripts/startup/bl_ui/properties_data_gpencil.py +++ b/release/scripts/startup/bl_ui/properties_data_gpencil.py @@ -113,8 +113,8 @@ class GPENCIL_MT_layer_context_menu(Menu): layout.operator("gpencil.layer_merge", icon='SORT_ASC', text="Merge Down") layout.separator() - layout.menu("VIEW3D_MT_gpencil_append_active_layer") - layout.menu("VIEW3D_MT_gpencil_append_all_layers") + layout.operator("gpencil.layer_duplicate_object", text="Copy Layer to Selected").only_active=True + layout.operator("gpencil.layer_duplicate_object", text="Copy All Layers to Selected").only_active=False class DATA_PT_gpencil_layers(DataButtonsPanel, Panel): diff --git a/release/scripts/startup/bl_ui/properties_material_gpencil.py b/release/scripts/startup/bl_ui/properties_material_gpencil.py index ed5863b463a..9d099ff2231 100644 --- a/release/scripts/startup/bl_ui/properties_material_gpencil.py +++ b/release/scripts/startup/bl_ui/properties_material_gpencil.py @@ -46,16 +46,18 @@ class GPENCIL_MT_material_context_menu(Menu): layout.separator() - layout.operator("object.material_slot_remove_unused") - layout.operator("gpencil.stroke_merge_material", text="Merge Similar") - - layout.separator() layout.operator("gpencil.material_to_vertex_color", text="Convert Materials to Vertex Color") layout.operator("gpencil.extract_palette_vertex", text="Extract Palette from Vertex Color") layout.separator() - layout.menu("VIEW3D_MT_gpencil_append_active_material") - layout.menu("VIEW3D_MT_gpencil_append_all_materials") + + layout.operator("gpencil.materials_copy_to_object", text="Copy Material to Selected").only_active = True + layout.operator("gpencil.materials_copy_to_object", text="Copy All Materials to Selected").only_active = False + + layout.separator() + + layout.operator("gpencil.stroke_merge_material", text="Merge Similar") + layout.operator("object.material_slot_remove_unused") class GPENCIL_UL_matslots(UIList): diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 4b06a2df3a0..df004b21077 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -4956,75 +4956,6 @@ class VIEW3D_MT_assign_material(Menu): icon='LAYER_ACTIVE' if mat == mat_active else 'BLANK1').material = mat.name -def gpencil_layer_append_menu_items(context, layout, only_active): - done = False - view_layer = context.view_layer - obact = context.active_object - gpl = context.active_gpencil_layer - - done = False - if gpl is not None: - for ob in view_layer.objects: - if ob.type == 'GPENCIL' and ob != obact: - op = layout.operator("gpencil.layer_duplicate_object", text=ob.name) - op.object = ob.name - op.only_active = only_active - done = True - - if done is False: - layout.label(text="No destination object", icon='ERROR') - else: - layout.label(text="No layer to copy", icon='ERROR') - - -class VIEW3D_MT_gpencil_append_active_layer(Menu): - bl_label = "Append Active Layer to Object" - - def draw(self, context): - layout = self.layout - gpencil_layer_append_menu_items(context, layout, True) - - -class VIEW3D_MT_gpencil_append_all_layers(Menu): - bl_label = "Append All Layers to Object" - - def draw(self, context): - layout = self.layout - gpencil_layer_append_menu_items(context, layout, False) - - -def gpencil_material_menu_items(context, layout, only_selected): - done = False - view_layer = context.view_layer - obact = context.active_object - - for ob in view_layer.objects: - if ob.type == 'GPENCIL' and ob != obact: - op = layout.operator("gpencil.materials_append_to_object", text=ob.name) - op.object = ob.name - op.only_selected = only_selected - done = True - - if done is False: - layout.label(text="No destination object", icon='ERROR') - - -class VIEW3D_MT_gpencil_append_active_material(Menu): - bl_label = "Append Active Material to Object" - - def draw(self, context): - layout = self.layout - gpencil_material_menu_items(context, layout, True) - - -class VIEW3D_MT_gpencil_append_all_materials(Menu): - bl_label = "Append All Materials to Object" - - def draw(self, context): - layout = self.layout - gpencil_material_menu_items(context, layout, False) - - class VIEW3D_MT_edit_gpencil(Menu): bl_label = "Grease Pencil" @@ -7689,10 +7620,6 @@ classes = ( VIEW3D_MT_weight_gpencil, VIEW3D_MT_gpencil_animation, VIEW3D_MT_gpencil_simplify, - VIEW3D_MT_gpencil_append_active_layer, - VIEW3D_MT_gpencil_append_all_layers, - VIEW3D_MT_gpencil_append_active_material, - VIEW3D_MT_gpencil_append_all_materials, VIEW3D_MT_gpencil_autoweights, VIEW3D_MT_gpencil_edit_context_menu, VIEW3D_MT_edit_curve, |