[Bf-blender-cvs] [99b94d5485c] greasepencil-refactor: GPencil: Patch old files to use lights to ON

Antonio Vazquez noreply at git.blender.org
Thu Jan 9 16:32:55 CET 2020


Commit: 99b94d5485c2935f1b4346fd8aa9a617a4d65812
Author: Antonio Vazquez
Date:   Thu Jan 9 16:32:42 2020 +0100
Branches: greasepencil-refactor
https://developer.blender.org/rB99b94d5485c2935f1b4346fd8aa9a617a4d65812

GPencil: Patch old files to use lights to ON

Also, when add a new OB_GPENCIL, this option is enabled by default.

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

M	source/blender/blenkernel/intern/object.c
M	source/blender/blenloader/intern/versioning_280.c
M	source/blender/makesrna/intern/rna_object.c

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

diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 1378e862034..01530c1d933 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -870,6 +870,10 @@ void BKE_object_init(Object *ob, const short ob_type)
     ob->upflag = OB_POSZ;
   }
 
+  if (ob->type == OB_GPENCIL) {
+    ob->dtx |= OB_USE_GPENCIL_LIGHTS;
+  }
+
   /* Animation Visualization defaults */
   animviz_settings_init(&ob->avs);
 }
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index 3d38f081238..518cbdee8ed 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -4384,6 +4384,9 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
         if (ob->type != OB_GPENCIL) {
           continue;
         }
+        /* Enable lights by default. */
+        ob->dtx |= OB_USE_GPENCIL_LIGHTS;
+
         /* VFX. */
         LISTBASE_FOREACH (ShaderFxData *, fx, &ob->shader_fx) {
           switch (fx->type) {
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 2e4fa51bd7a..a863fe24fc9 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -3059,6 +3059,7 @@ static void rna_def_object(BlenderRNA *brna)
 
   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_boolean_default(prop, true);
   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");



More information about the Bf-blender-cvs mailing list