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:
Diffstat (limited to 'release/scripts/startup/bl_ui/properties_grease_pencil_common.py')
-rw-r--r--release/scripts/startup/bl_ui/properties_grease_pencil_common.py21
1 files changed, 10 insertions, 11 deletions
diff --git a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
index f186fca0849..44d82be8ab0 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -1,7 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-or-later
-# <pep8 compliant>
-
import bpy
from bpy.types import Menu, UIList, Operator
from bpy.app.translations import pgettext_iface as iface_
@@ -236,6 +234,11 @@ class GPENCIL_MT_move_to_layer(Menu):
layout = self.layout
gpd = context.gpencil_data
if gpd:
+ layout.operator_context = 'INVOKE_REGION_WIN'
+ layout.operator("gpencil.move_to_layer", text="New Layer", icon='ADD').layer = -1
+
+ layout.separator()
+
gpl_active = context.active_gpencil_layer
tot_layers = len(gpd.layers)
i = tot_layers - 1
@@ -248,10 +251,6 @@ class GPENCIL_MT_move_to_layer(Menu):
layout.operator("gpencil.move_to_layer", text=gpl.info, icon=icon, translate=False).layer = i
i -= 1
- layout.separator()
-
- layout.operator("gpencil.move_to_layer", text="New Layer", icon='ADD').layer = -1
-
class GPENCIL_MT_layer_active(Menu):
bl_label = "Change Active Layer"
@@ -262,6 +261,10 @@ class GPENCIL_MT_layer_active(Menu):
gpd = context.gpencil_data
if gpd:
+ layout.operator("gpencil.layer_add", text="New Layer", icon='ADD')
+
+ layout.separator()
+
gpl_active = context.active_gpencil_layer
tot_layers = len(gpd.layers)
i = tot_layers - 1
@@ -274,10 +277,6 @@ class GPENCIL_MT_layer_active(Menu):
layout.operator("gpencil.layer_active", text=gpl.info, icon=icon).layer = i
i -= 1
- layout.separator()
-
- layout.operator("gpencil.layer_add", text="New Layer", icon='ADD')
-
class GPENCIL_MT_material_active(Menu):
bl_label = "Change Active Material"
@@ -297,7 +296,7 @@ class GPENCIL_MT_material_active(Menu):
for slot in ob.material_slots:
mat = slot.material
- if mat:
+ if mat and mat.id_data and mat.id_data.preview:
icon = mat.id_data.preview.icon_id
layout.operator("gpencil.material_set", text=mat.name, icon_value=icon).slot = mat.name