[Bf-blender-cvs] [dfbd3e4d9ef] soc-2019-npr: Grease pencil composition depth option added.

YimingWu noreply at git.blender.org
Mon Jun 3 10:31:47 CEST 2019


Commit: dfbd3e4d9efa9536d8e241746b3a816d6b86b028
Author: YimingWu
Date:   Mon Jun 3 13:57:52 2019 +0800
Branches: soc-2019-npr
https://developer.blender.org/rBdfbd3e4d9efa9536d8e241746b3a816d6b86b028

Grease pencil composition depth option added.

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

M	release/scripts/startup/bl_ui/properties_data_gpencil.py
M	source/blender/draw/engines/gpencil/gpencil_engine.c
M	source/blender/makesdna/DNA_gpencil_types.h
M	source/blender/makesrna/intern/rna_gpencil.c

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

diff --git a/release/scripts/startup/bl_ui/properties_data_gpencil.py b/release/scripts/startup/bl_ui/properties_data_gpencil.py
index 44a7990d570..cf3a780a146 100644
--- a/release/scripts/startup/bl_ui/properties_data_gpencil.py
+++ b/release/scripts/startup/bl_ui/properties_data_gpencil.py
@@ -396,6 +396,9 @@ class DATA_PT_gpencil_strokes(DataButtonsPanel, Panel):
         ob = context.object
         gpd = context.gpencil
 
+        col = layout.column(align=True)
+        col.prop(gpd, "disable_depth_composition", expand=True, icon='IMAGE_ZDEPTH')
+
         col = layout.column(align=True)
         col.prop(gpd, "stroke_depth_order")
 
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c
index 62b893867f3..a97a4a27833 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -1036,6 +1036,10 @@ void GPENCIL_draw_scene(void *ved)
         }
 
         /* draw mix pass */
+        if(gpd->no_depth){
+              DRW_pass_state_remove(psl->mix_pass,        DRW_STATE_WRITE_DEPTH|DRW_STATE_DEPTH_LESS);
+              //DRW_pass_state_remove(psl->mix_pass_noblend,DRW_STATE_WRITE_DEPTH|DRW_STATE_DEPTH_LESS);
+            }
         DRW_draw_pass(psl->mix_pass);
 
         /* disable select flag */
diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h
index 5a32f9bc23c..10cc8ec833f 100644
--- a/source/blender/makesdna/DNA_gpencil_types.h
+++ b/source/blender/makesdna/DNA_gpencil_types.h
@@ -468,7 +468,10 @@ typedef struct bGPdata {
   /** Settings for this datablock. */
   int flag;
 
-  char _pad1[4];
+  /** Not composite depth when drawing the layer*/
+  int no_depth;
+  
+  //char _pad1[4];
 
   /* Palettes */
   /** List of bGPDpalette's   - Deprecated (2.78 - 2.79 only). */
diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c
index 276b685e93f..2b49f82f8d4 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -1659,6 +1659,13 @@ static void rna_def_gpencil_data(BlenderRNA *brna)
   RNA_def_property_collection_funcs(
       prop, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "rna_IDMaterials_assign_int");
 
+  /* composition Depth */
+  prop = RNA_def_property(srna, "disable_depth_composition", PROP_BOOLEAN, PROP_NONE);
+  RNA_def_property_boolean_sdna(prop, NULL, "no_depth",0);
+  RNA_def_property_ui_text(
+      prop, "Disable Depth Composition", "Do not use depth when rendering GPencil to 3D scene.");
+  RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
   /* Depth */
   prop = RNA_def_property(srna, "stroke_depth_order", PROP_ENUM, PROP_NONE);
   RNA_def_property_enum_sdna(prop, NULL, "draw_mode");



More information about the Bf-blender-cvs mailing list