Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/intern/gpencil.c1
-rw-r--r--source/blender/draw/engines/gpencil/gpencil_draw_utils.c11
-rw-r--r--source/blender/draw/engines/gpencil/gpencil_engine.c13
-rw-r--r--source/blender/draw/engines/gpencil/gpencil_engine.h5
-rw-r--r--source/blender/draw/engines/gpencil/shaders/gpencil_fill_frag.glsl4
-rw-r--r--source/blender/draw/engines/gpencil/shaders/gpencil_point_geom.glsl4
-rw-r--r--source/blender/draw/engines/gpencil/shaders/gpencil_stroke_geom.glsl4
-rw-r--r--source/blender/editors/gpencil/annotate_paint.c3
-rw-r--r--source/blender/editors/gpencil/drawgpencil.c2
-rw-r--r--source/blender/makesdna/DNA_gpencil_types.h5
-rw-r--r--source/blender/makesrna/intern/rna_gpencil.c13
11 files changed, 19 insertions, 46 deletions
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 108192c5be9..c9cb38fcc4e 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -411,7 +411,6 @@ bGPdata *BKE_gpencil_data_addnew(Main *bmain, const char name[])
/* GP object specific settings */
ARRAY_SET_ITEMS(gpd->line_color, 0.6f, 0.6f, 0.6f, 0.5f);
- gpd->xray_mode = GP_XRAY_3DSPACE;
gpd->pixfactor = GP_DEFAULT_PIX_FACTOR;
/* grid settings */
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index 1b406f298cd..e77f570b7bd 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -416,7 +416,8 @@ static DRWShadingGroup *DRW_gpencil_shgroup_fill_create(
stl->shgroups[id].texture_flip = gp_style->flag & GP_STYLE_COLOR_FLIP_FILL ? 1 : 0;
DRW_shgroup_uniform_int(grp, "texture_flip", &stl->shgroups[id].texture_flip, 1);
- DRW_shgroup_uniform_int(grp, "xraymode", (const int *) &gpd->xray_mode, 1);
+ stl->shgroups[id].xray_mode = (ob->dtx & OB_DRAWXRAY) ? GP_XRAY_FRONT : GP_XRAY_3DSPACE;
+ DRW_shgroup_uniform_int(grp, "xraymode", &stl->shgroups[id].xray_mode, 1);
DRW_shgroup_uniform_int(grp, "drawmode", (const int *) &gpd->draw_mode, 1);
/* viewport x-ray */
@@ -570,7 +571,8 @@ DRWShadingGroup *DRW_gpencil_shgroup_stroke_create(
}
if ((gpd) && (id > -1)) {
- DRW_shgroup_uniform_int(grp, "xraymode", (const int *) &gpd->xray_mode, 1);
+ stl->shgroups[id].xray_mode = (ob->dtx & OB_DRAWXRAY) ? GP_XRAY_FRONT : GP_XRAY_3DSPACE;
+ DRW_shgroup_uniform_int(grp, "xraymode", &stl->shgroups[id].xray_mode, 1);
}
else {
/* for drawing always on predefined z-depth */
@@ -689,7 +691,8 @@ static DRWShadingGroup *DRW_gpencil_shgroup_point_create(
}
if (gpd) {
- DRW_shgroup_uniform_int(grp, "xraymode", (const int *)&gpd->xray_mode, 1);
+ stl->shgroups[id].xray_mode = (ob->dtx & OB_DRAWXRAY) ? GP_XRAY_FRONT : GP_XRAY_3DSPACE;
+ DRW_shgroup_uniform_int(grp, "xraymode", (const int *)&stl->shgroups[id].xray_mode, 1);
}
else {
/* for drawing always on on predefined z-depth */
@@ -1495,7 +1498,7 @@ static void DRW_gpencil_shgroups_create(
GPENCIL_StorageList *stl = ((GPENCIL_Data *)vedata)->stl;
GPENCIL_PassList *psl = ((GPENCIL_Data *)vedata)->psl;
bGPdata *gpd = (bGPdata *)ob->data;
- DRWPass *stroke_pass = GPENCIL_3D_DRAWMODE(gpd) ? psl->stroke_pass_3d : psl->stroke_pass_2d;
+ DRWPass *stroke_pass = GPENCIL_3D_DRAWMODE(ob, gpd) ? psl->stroke_pass_3d : psl->stroke_pass_2d;
GpencilBatchGroup *elm = NULL;
DRWShadingGroup *shgrp = NULL;
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c
index 60e6de164e7..b7d03900eb1 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -740,7 +740,7 @@ static void gpencil_free_obj_runtime(GPENCIL_StorageList *stl)
static void gpencil_draw_pass_range(
GPENCIL_FramebufferList *fbl, GPENCIL_StorageList *stl,
GPENCIL_PassList *psl, GPENCIL_TextureList *txl,
- GPUFrameBuffer *fb, bGPdata *gpd,
+ GPUFrameBuffer *fb, Object *ob, bGPdata *gpd,
DRWShadingGroup *init_shgrp, DRWShadingGroup *end_shgrp, bool multi)
{
if (init_shgrp == NULL) {
@@ -753,7 +753,7 @@ static void gpencil_draw_pass_range(
}
DRW_draw_pass_subset(
- GPENCIL_3D_DRAWMODE(gpd) ? psl->stroke_pass_3d : psl->stroke_pass_2d,
+ GPENCIL_3D_DRAWMODE(ob, gpd) ? psl->stroke_pass_3d : psl->stroke_pass_2d,
init_shgrp, end_shgrp);
if ((!stl->storage->is_mat_preview) && (multi)) {
@@ -780,6 +780,7 @@ static void drw_gpencil_select_render(GPENCIL_StorageList *stl, GPENCIL_PassList
for (int i = 0; i < stl->g_data->gp_cache_used; i++) {
cache_ob = &stl->g_data->gp_object_cache[i];
if (cache_ob) {
+ Object *ob = cache_ob->ob;
bGPdata *gpd = cache_ob->gpd;
init_shgrp = NULL;
if (cache_ob->tot_layers > 0) {
@@ -792,7 +793,7 @@ static void drw_gpencil_select_render(GPENCIL_StorageList *stl, GPENCIL_PassList
}
/* draw group */
DRW_draw_pass_subset(
- GPENCIL_3D_DRAWMODE(gpd) ? psl->stroke_pass_3d : psl->stroke_pass_2d,
+ GPENCIL_3D_DRAWMODE(ob, gpd) ? psl->stroke_pass_3d : psl->stroke_pass_2d,
init_shgrp, end_shgrp);
}
/* the cache must be dirty for next loop */
@@ -911,7 +912,7 @@ void GPENCIL_draw_scene(void *ved)
/* draw pending groups */
gpencil_draw_pass_range(
fbl, stl, psl, txl, fbl->temp_fb_a,
- gpd, init_shgrp, end_shgrp, is_last);
+ ob, gpd, init_shgrp, end_shgrp, is_last);
/* draw current group in separated texture */
init_shgrp = array_elm->init_shgrp;
@@ -921,7 +922,7 @@ void GPENCIL_draw_scene(void *ved)
GPU_framebuffer_clear_color_depth(fbl->temp_fb_fx, clearcol, 1.0f);
gpencil_draw_pass_range(
fbl, stl, psl, txl, fbl->temp_fb_fx,
- gpd, init_shgrp, end_shgrp,
+ ob, gpd, init_shgrp, end_shgrp,
is_last);
/* Blend A texture and FX texture */
@@ -949,7 +950,7 @@ void GPENCIL_draw_scene(void *ved)
/* last group */
gpencil_draw_pass_range(
fbl, stl, psl, txl, fbl->temp_fb_a,
- gpd, init_shgrp, end_shgrp,
+ ob, gpd, init_shgrp, end_shgrp,
true);
}
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.h b/source/blender/draw/engines/gpencil/gpencil_engine.h
index 0c917b038a4..1ab45328377 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.h
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.h
@@ -118,6 +118,7 @@ typedef struct GPENCIL_shgroup {
int keep_size;
int caps_mode[2];
float obj_scale;
+ int xray_mode;
/* color of the wireframe */
float wire_color[4];
@@ -467,8 +468,8 @@ void GPENCIL_render_to_image(void *vedata, struct RenderEngine *engine, struct R
} \
}
-#define GPENCIL_3D_DRAWMODE(gpd) \
- ((gpd) && (gpd->draw_mode == GP_DRAWMODE_3D) && (gpd->xray_mode == GP_XRAY_3DSPACE))
+#define GPENCIL_3D_DRAWMODE(ob, gpd) \
+ ((gpd) && (gpd->draw_mode == GP_DRAWMODE_3D) && (ob->dtx & OB_DRAWXRAY))
#define GPENCIL_USE_SOLID(stl) \
((stl) && ((stl->storage->is_render) || (stl->storage->is_mat_preview)))
diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_fill_frag.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_fill_frag.glsl
index b35970780a4..f0878c8bc89 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_fill_frag.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_fill_frag.glsl
@@ -35,7 +35,6 @@ uniform vec4 wire_color;
#define GP_XRAY_FRONT 0
#define GP_XRAY_3DSPACE 1
-#define GP_XRAY_BACK 2
#define GP_DRAWMODE_2D 0
#define GP_DRAWMODE_3D 1
@@ -163,9 +162,6 @@ void main()
gl_FragDepth = gl_FragCoord.z;
}
}
- else if (xraymode == GP_XRAY_BACK) {
- gl_FragDepth = 0.999999;
- }
else {
gl_FragDepth = 0.000001;
}
diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_point_geom.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_point_geom.glsl
index 63f22e0f812..6c22633c521 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_point_geom.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_point_geom.glsl
@@ -14,7 +14,6 @@ out vec2 mTexCoord;
#define GP_XRAY_FRONT 0
#define GP_XRAY_3DSPACE 1
-#define GP_XRAY_BACK 2
/* project 3d point to 2d on screen space */
vec2 toScreenSpace(vec4 vertex)
@@ -31,9 +30,6 @@ float getZdepth(vec4 point)
if (xraymode == GP_XRAY_3DSPACE) {
return (point.z / point.w);
}
- if (xraymode == GP_XRAY_BACK) {
- return 0.999999;
- }
/* in front by default */
return 0.000001;
diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_geom.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_geom.glsl
index ad85046487b..0caeb4c9d63 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_geom.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_geom.glsl
@@ -17,7 +17,6 @@ out vec2 uvfac;
#define GP_XRAY_FRONT 0
#define GP_XRAY_3DSPACE 1
-#define GP_XRAY_BACK 2
/* keep this list synchronized with list in gpencil_engine.h */
#define GPENCIL_COLOR_SOLID 0
@@ -41,9 +40,6 @@ float getZdepth(vec4 point)
if (xraymode == GP_XRAY_3DSPACE) {
return (point.z / point.w);
}
- if (xraymode == GP_XRAY_BACK) {
- return 0.999999;
- }
/* in front by default */
return 0.000001;
diff --git a/source/blender/editors/gpencil/annotate_paint.c b/source/blender/editors/gpencil/annotate_paint.c
index 5e1e33aa9be..a9654e50822 100644
--- a/source/blender/editors/gpencil/annotate_paint.c
+++ b/source/blender/editors/gpencil/annotate_paint.c
@@ -1188,9 +1188,6 @@ static bool gp_session_initdata(bContext *C, tGPsdata *p)
/* mark datablock as being used for annotations */
gpd->flag |= GP_DATA_ANNOTATIONS;
-
- /* annotations always in front of all objects */
- gpd->xray_mode = GP_XRAY_FRONT;
}
p->gpd = *gpd_ptr;
}
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c
index b36929f66b0..8551dc6f981 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -721,7 +721,7 @@ static void gp_draw_stroke_3d(tGPDdraw *tgpw, short thickness, const float ink[4
immUniform1i("keep_size", keep_size);
immUniform1i("pixfactor", tgpw->gpd->pixfactor);
/* xray mode always to 3D space to avoid wrong zdepth calculation (T60051) */
- immUniform1i("xraymode", GP_XRAY_3DSPACE);
+ immUniform1i("xraymode", 1);
/* draw stroke curve */
GPU_line_width(max_ff(curpressure * thickness, 1.0f));
diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h
index 3080975360e..bd17d4e57dc 100644
--- a/source/blender/makesdna/DNA_gpencil_types.h
+++ b/source/blender/makesdna/DNA_gpencil_types.h
@@ -460,9 +460,7 @@ typedef struct bGPdata {
/** Settings for this datablock. */
int flag;
- /** Xray mode for strokes (eGP_DepthOrdering). */
- short xray_mode;
- char _pad1[2];
+ char _pad1[4];
/* Palettes */
/** List of bGPDpalette's - Deprecated (2.78 - 2.79 only). */
@@ -616,7 +614,6 @@ typedef enum eGP_OnionModes {
typedef enum eGP_DepthOrdering {
GP_XRAY_FRONT = 0,
GP_XRAY_3DSPACE = 1,
- GP_XRAY_BACK = 2,
} eGP_DepthOrdering;
/* draw modes (Use 2D or 3D position) */
diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c
index bc0a28ec883..6203d06c7d5 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -57,13 +57,6 @@ static EnumPropertyItem rna_enum_gpencil_stroke_depth_order_items[] = {
{0, NULL, 0, NULL, NULL},
};
-static EnumPropertyItem rna_enum_gpencil_object_depth_order_items[] = {
- {GP_XRAY_FRONT, "FRONT", 0, "Front", "Display all strokes in front"},
- {GP_XRAY_3DSPACE, "3DSPACE", 0, "3D Space", "Display strokes relative to other objects in 3D space"},
- {GP_XRAY_BACK, "BACK", 0, "Back", "Display all strokes last"},
- {0, NULL, 0, NULL, NULL},
-};
-
static EnumPropertyItem rna_enum_gpencil_onion_modes_items[] = {
{GP_ONION_MODE_ABSOLUTE, "ABSOLUTE", 0, "Frames", "Frames in absolute range of the scene frame"},
{GP_ONION_MODE_RELATIVE, "RELATIVE", 0, "Keyframes", "Frames in relative range of the Grease Pencil keyframes"},
@@ -1510,12 +1503,6 @@ static void rna_def_gpencil_data(BlenderRNA *brna)
"Defines how the strokes are ordered in 3D space");
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
- prop = RNA_def_property(srna, "object_depth_order", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "xray_mode");
- RNA_def_property_enum_items(prop, rna_enum_gpencil_object_depth_order_items);
- RNA_def_property_ui_text(prop, "Object Depth Order", "");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
/* Flags */
prop = RNA_def_property(srna, "use_stroke_edit_mode", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_STROKE_EDITMODE);