Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonioya <blendergit@gmail.com>2018-08-27 17:29:19 +0300
committerAntonioya <blendergit@gmail.com>2018-08-27 17:31:03 +0300
commit9de320d8829157116878e078eb7801f306d242b6 (patch)
tree157cf7c7016381fb6d3ae568bad5ae255d27f639 /release/scripts/startup
parent1e6a5eb0879119808fde8f002eed5ac7909944ec (diff)
GP: New operator to copy layers between objects
The operator allows to copy a complete layer with all frames or only active frame to a new object. Can be found in edit specials menu (W key) or in Layers specials menu (last button near layer list).
Diffstat (limited to 'release/scripts/startup')
-rw-r--r--release/scripts/startup/bl_ui/properties_data_gpencil.py3
-rw-r--r--release/scripts/startup/bl_ui/space_view3d.py26
2 files changed, 29 insertions, 0 deletions
diff --git a/release/scripts/startup/bl_ui/properties_data_gpencil.py b/release/scripts/startup/bl_ui/properties_data_gpencil.py
index a63a8e10c08..601c014bb48 100644
--- a/release/scripts/startup/bl_ui/properties_data_gpencil.py
+++ b/release/scripts/startup/bl_ui/properties_data_gpencil.py
@@ -124,6 +124,9 @@ class GPENCIL_MT_layer_specials(Menu):
layout.operator("gpencil.layer_merge", icon='NLA', text="Merge Down")
+ layout.separator()
+ layout.menu("VIEW3D_MT_gpencil_copy_layer")
+
class DATA_PT_gpencil_datapanel(Panel):
bl_space_type = 'PROPERTIES'
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 35fb3afb5a6..7f56e2841ae 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -3573,6 +3573,28 @@ class VIEW3D_MT_assign_material(Menu):
layout.operator("gpencil.stroke_change_color", text=mat.name).material = mat.name
+class VIEW3D_MT_gpencil_copy_layer(Menu):
+ bl_label = "Copy Layer to Object"
+
+ def draw(self, context):
+ layout = self.layout
+ 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:
+ layout.operator("gpencil.layer_duplicate_object", text=ob.name).object = ob.name
+ done = True
+
+ if done is False:
+ layout.label("No destination object", icon="ERROR")
+ else:
+ layout.label("No layer to copy", icon="ERROR")
+
+
class VIEW3D_MT_edit_gpencil(Menu):
bl_label = "Strokes"
@@ -4955,6 +4977,9 @@ class VIEW3D_MT_gpencil_edit_specials(Menu):
layout.operator_menu_enum("gpencil.stroke_arrange", "direction", text="Arrange Strokes")
layout.separator()
+ layout.menu("VIEW3D_MT_gpencil_copy_layer")
+
+ layout.separator()
layout.operator("gpencil.stroke_join", text="Join").type = 'JOIN'
layout.operator("gpencil.stroke_join", text="Join & Copy").type = 'JOINCOPY'
@@ -5105,6 +5130,7 @@ classes = (
VIEW3D_MT_weight_gpencil,
VIEW3D_MT_gpencil_animation,
VIEW3D_MT_gpencil_simplify,
+ VIEW3D_MT_gpencil_copy_layer,
VIEW3D_MT_edit_curve,
VIEW3D_MT_edit_curve_ctrlpoints,
VIEW3D_MT_edit_curve_segments,