[Bf-blender-cvs] [cad11f3098c] blender-v3.4-release: GPencil: Add warning to Outline modifer when no Camera

Antonio Vazquez noreply at git.blender.org
Thu Nov 10 19:59:27 CET 2022


Commit: cad11f3098c0a2165a80f168a5ce0034f4bbdffc
Author: Antonio Vazquez
Date:   Thu Nov 10 19:59:07 2022 +0100
Branches: blender-v3.4-release
https://developer.blender.org/rBcad11f3098c0a2165a80f168a5ce0034f4bbdffc

GPencil: Add warning to Outline modifer when no Camera

The modifier needs a scene camera to work. Now
if the camera is not defined, there is a warning.

The optimal solution would be to use the `isDisabled` callback
but the callback function hasn't the scene parameter and to pass
this parameter is necessary to change a lot of things and now
we are focus in the next version of GPencil 3.0 and this change 
not worth the work now.

The optimal solution will be implemented in the 3.0 refactor.

Related to T102375

Reviewed by: Pablo Vazquez, Matias Mendiola

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

M	source/blender/gpencil_modifiers/intern/MOD_gpenciloutline.c

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

diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpenciloutline.c b/source/blender/gpencil_modifiers/intern/MOD_gpenciloutline.c
index 455d8b0b528..dff8d14564a 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpenciloutline.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpenciloutline.c
@@ -287,7 +287,7 @@ static void updateDepsgraph(GpencilModifierData *md,
   DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "Outline Modifier");
 }
 
-static void panel_draw(const bContext *UNUSED(C), Panel *panel)
+static void panel_draw(const bContext *C, Panel *panel)
 {
   uiLayout *layout = panel->layout;
 
@@ -302,6 +302,11 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel)
   uiItemR(layout, ptr, "outline_material", 0, NULL, ICON_NONE);
   uiItemR(layout, ptr, "object", 0, NULL, ICON_NONE);
 
+  Scene *scene = CTX_data_scene(C);
+  if (scene->camera == NULL) {
+    uiItemL(layout, IFACE_("Outline requires an active camera"), ICON_ERROR);
+  }
+
   gpencil_modifier_panel_end(layout, ptr);
 }



More information about the Bf-blender-cvs mailing list