[Bf-blender-cvs] [4e0cd81d250] greasepencil-object: Hide Apply and Copy button for GP

Antonio Vazquez noreply at git.blender.org
Tue Aug 8 11:19:06 CEST 2017


Commit: 4e0cd81d250454cdb741686a891a0cf569a7b394
Author: Antonio Vazquez
Date:   Sat Aug 5 17:51:40 2017 +0200
Branches: greasepencil-object
https://developer.blender.org/rB4e0cd81d250454cdb741686a891a0cf569a7b394

Hide Apply and Copy button for GP

The VFX modifiers cannot be copied or applied

===================================================================

M	source/blender/blenkernel/BKE_modifier.h
M	source/blender/editors/interface/interface_templates.c

===================================================================

diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h
index d1e239ccbec..3a95ea3be9c 100644
--- a/source/blender/blenkernel/BKE_modifier.h
+++ b/source/blender/blenkernel/BKE_modifier.h
@@ -109,6 +109,8 @@ typedef enum {
 	eModifierTypeFlag_AcceptsLattice = (1 << 10),
 	/* Grease pencil modifiers (do not change mesh, only is placeholder) */
 	eModifierTypeFlag_GpencilMod = (1 << 11),
+	/* Grease pencil VFX modifiers cannot be applied */
+	eModifierTypeFlag_GpencilVFX = (1 << 12),
 } ModifierTypeFlag;
 
 /* IMPORTANT! Keep ObjectWalkFunc and IDWalkFunc signatures compatible. */
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index e21f09fad61..62313d1c097 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -1230,14 +1230,16 @@ static uiLayout *draw_modifier(
 				}
 			}
 			else {
-				uiLayoutSetOperatorContext(row, WM_OP_INVOKE_DEFAULT);
-				uiItemEnumO(row, "OBJECT_OT_modifier_apply", CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Apply"),
-				            0, "apply_as", MODIFIER_APPLY_DATA);
-				
-				if (modifier_isSameTopology(md) && !modifier_isNonGeometrical(md)) {
-					uiItemEnumO(row, "OBJECT_OT_modifier_apply",
-					            CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Apply as Shape Key"),
-					            0, "apply_as", MODIFIER_APPLY_SHAPE);
+				if ((mti->flags & eModifierTypeFlag_GpencilVFX) == 0) {
+					uiLayoutSetOperatorContext(row, WM_OP_INVOKE_DEFAULT);
+					uiItemEnumO(row, "OBJECT_OT_modifier_apply", CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Apply"),
+						0, "apply_as", MODIFIER_APPLY_DATA);
+
+					if (modifier_isSameTopology(md) && !modifier_isNonGeometrical(md)) {
+						uiItemEnumO(row, "OBJECT_OT_modifier_apply",
+							CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Apply as Shape Key"),
+							0, "apply_as", MODIFIER_APPLY_SHAPE);
+					}
 				}
 			}
 			
@@ -1247,8 +1249,10 @@ static uiLayout *draw_modifier(
 			if (!ELEM(md->type, eModifierType_Fluidsim, eModifierType_Softbody, eModifierType_ParticleSystem,
 			           eModifierType_Cloth, eModifierType_Smoke))
 			{
-				uiItemO(row, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Copy"), ICON_NONE,
-				        "OBJECT_OT_modifier_copy");
+				if ((mti->flags & eModifierTypeFlag_GpencilVFX) == 0) {
+					uiItemO(row, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Copy"), ICON_NONE,
+						"OBJECT_OT_modifier_copy");
+				}
 			}
 		}




More information about the Bf-blender-cvs mailing list