GooEngine: Enable GP screenspace thickness slider for all modes.

This commit is contained in:
2023-01-18 22:44:56 +00:00
parent 054350490f
commit 7cefd01aaf
4 changed files with 4 additions and 4 deletions
@@ -365,7 +365,6 @@ class DATA_PT_gpencil_strokes(DataButtonsPanel, Panel):
col = layout.column(align=True)
col.prop(gpd, "stroke_thickness_space")
sub = col.column()
sub.active = gpd.stroke_thickness_space == 'WORLDSPACE'
sub.prop(gpd, "pixel_factor", text="Thickness Scale")
col.prop(gpd, "edit_curve_resolution")
@@ -274,7 +274,7 @@ GPENCIL_tLayer *gpencil_layer_cache_add(GPENCIL_PrivateData *pd,
pd->vertex_paint_opacity);
/* Negate thickness sign to tag that strokes are in screen space.
* Convert to world units (by default, 1 meter = 2000 pixels). */
float thickness_scale = (is_screenspace) ? -1.0f : (gpd->pixfactor / GPENCIL_PIXEL_FACTOR);
float thickness_scale = (is_screenspace) ? -gpd->pixfactor : (gpd->pixfactor / GPENCIL_PIXEL_FACTOR);
float layer_opacity = gpencil_layer_final_opacity_get(pd, ob, gpl);
float layer_tint[4];
float layer_alpha;
@@ -191,7 +191,7 @@ static void gpencil_layer_cache_populate(bGPDlayer *gpl,
float object_scale = mat4_to_scale(iter->ob->object_to_world);
/* Negate thickness sign to tag that strokes are in screen space.
* Convert to world units (by default, 1 meter = 2000 pixels). */
float thickness_scale = (is_screenspace) ? -1.0f : (gpd->pixfactor / 2000.0f);
float thickness_scale = (is_screenspace) ? -gpd->pixfactor : (gpd->pixfactor / 2000.0f);
GPUVertBuf *position_tx = DRW_cache_gpencil_position_buffer_get(iter->ob, iter->cfra);
GPUVertBuf *color_tx = DRW_cache_gpencil_color_buffer_get(iter->ob, iter->cfra);
@@ -69,7 +69,8 @@ float gpencil_stroke_thickness_modulate(float thickness, vec4 ndc_pos, vec4 view
if (gpThicknessIsScreenSpace) {
/* Multiply offset by view Z so that offset is constant in screenspace.
* (e.i: does not change with the distance to camera) */
thickness *= ndc_pos.w;
thickness *= ndc_pos.w *
-gpThicknessWorldScale; // Multiply by positive world scale (default 1.0).
}
else {
/* World space point size. */