[Bf-blender-cvs] [e84f405e4c7] greasepencil-refactor: GPencil: New Use Lights flag at object level

Antonio Vazquez noreply at git.blender.org
Mon Jan 6 20:11:23 CET 2020


Commit: e84f405e4c707e622185edcc1585728840ad400f
Author: Antonio Vazquez
Date:   Mon Jan 6 20:07:46 2020 +0100
Branches: greasepencil-refactor
https://developer.blender.org/rBe84f405e4c707e622185edcc1585728840ad400f

GPencil: New Use Lights flag at object level

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

M	release/scripts/startup/bl_ui/properties_object.py
M	source/blender/makesdna/DNA_object_types.h
M	source/blender/makesrna/intern/rna_object.c

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

diff --git a/release/scripts/startup/bl_ui/properties_object.py b/release/scripts/startup/bl_ui/properties_object.py
index bb020084b03..9167fe93d3a 100644
--- a/release/scripts/startup/bl_ui/properties_object.py
+++ b/release/scripts/startup/bl_ui/properties_object.py
@@ -396,6 +396,10 @@ class OBJECT_PT_visibility(ObjectButtonsPanel, Panel):
         col = flow.column()
         col.prop(ob, "hide_select", text="Selectable", toggle=False, invert_checkbox=True)
 
+        if ob.type == 'GPENCIL':
+            col = flow.column()
+            col.prop(ob, "use_grease_pencil_lights", toggle=False)
+
 
 class OBJECT_PT_custom_props(ObjectButtonsPanel, PropertyPanel, Panel):
     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h
index fbed0754046..81ab3212f3a 100644
--- a/source/blender/makesdna/DNA_object_types.h
+++ b/source/blender/makesdna/DNA_object_types.h
@@ -554,6 +554,8 @@ enum {
   OB_DRAWTRANSP = 1 << 7,
   OB_DRAW_ALL_EDGES = 1 << 8, /* only for meshes currently */
   OB_DRAW_NO_SHADOW_CAST = 1 << 9,
+  /* Enable lights for grease pencil. */
+  OB_USE_GPENCIL_LIGHTS = 1 << 10,
 };
 
 /* empty_drawtype: no flags */
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 186ccd20f33..2e4fa51bd7a 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -345,6 +345,16 @@ static void rna_MaterialIndex_update(Main *UNUSED(bmain), Scene *UNUSED(scene),
   }
 }
 
+static void rna_GPencil_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+{
+  Object *ob = (Object *)ptr->owner_id;
+  if (ob && ob->type == OB_GPENCIL) {
+    bGPdata *gpd = (bGPdata *)ob->data;
+    DEG_id_tag_update(&gpd->id, ID_RECALC_GEOMETRY);
+    WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL);
+  }
+}
+
 static void rna_Object_matrix_local_get(PointerRNA *ptr, float values[16])
 {
   Object *ob = (Object *)ptr->owner_id;
@@ -3047,6 +3057,12 @@ static void rna_def_object(BlenderRNA *brna)
   RNA_def_property_ui_text(prop, "Display All Edges", "Display all edges for mesh objects");
   RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
 
+  prop = RNA_def_property(srna, "use_grease_pencil_lights", PROP_BOOLEAN, PROP_NONE);
+  RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_USE_GPENCIL_LIGHTS);
+  RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+  RNA_def_property_ui_text(prop, "Use Lights", "Lights affect to grease pencil object");
+  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_GPencil_update");
+
   prop = RNA_def_property(srna, "show_transparent", PROP_BOOLEAN, PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWTRANSP);
   RNA_def_property_ui_text(



More information about the Bf-blender-cvs mailing list