#70267 Retopology Overlay #104599
|
@ -329,6 +329,7 @@ const bTheme U_theme_default = {
|
||||||
.edge_bevel = RGBA(0x00a5ffff),
|
.edge_bevel = RGBA(0x00a5ffff),
|
||||||
.face = RGBA(0xffffff02),
|
.face = RGBA(0xffffff02),
|
||||||
.face_select = RGBA(0xffa5522e),
|
.face_select = RGBA(0xffa5522e),
|
||||||
|
.face_retopology = RGBA(0x50c8ff0f),
|
||||||
.face_back = RGBA(0xff0000b3),
|
.face_back = RGBA(0xff0000b3),
|
||||||
.face_front = RGBA(0x0000ffb3),
|
.face_front = RGBA(0x0000ffb3),
|
||||||
.face_dot = RGBA(0xff8a00ff),
|
.face_dot = RGBA(0xff8a00ff),
|
||||||
|
|
|
@ -6549,7 +6549,11 @@ class VIEW3D_PT_overlay_edit_mesh_shading(Panel):
|
||||||
col = layout.column()
|
col = layout.column()
|
||||||
col.active = display_all
|
col.active = display_all
|
||||||
|
|
||||||
col.prop(overlay, "show_occlude_wire")
|
row = col.row(align=True)
|
||||||
|
row.prop(overlay, "show_retopology", text="")
|
||||||
|
sub = row.row()
|
||||||
|
sub.active = overlay.show_retopology
|
||||||
|
sub.prop(overlay, "retopology_offset", text="Retopology")
|
||||||
|
|
||||||
col.prop(overlay, "show_weight", text="Vertex Group Weights")
|
col.prop(overlay, "show_weight", text="Vertex Group Weights")
|
||||||
if overlay.show_weight:
|
if overlay.show_weight:
|
||||||
|
|
|
@ -2987,7 +2987,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
||||||
enum { V3D_OCCLUDE_WIRE = (1 << 14) };
|
enum { V3D_OCCLUDE_WIRE = (1 << 14) };
|
||||||
View3D *v3d = (View3D *)sl;
|
View3D *v3d = (View3D *)sl;
|
||||||
if (v3d->flag2 & V3D_OCCLUDE_WIRE) {
|
if (v3d->flag2 & V3D_OCCLUDE_WIRE) {
|
||||||
v3d->overlay.edit_flag |= V3D_OVERLAY_EDIT_OCCLUDE_WIRE;
|
v3d->overlay.edit_flag |= V3D_OVERLAY_EDIT_RETOPOLOGY;
|
||||||
v3d->flag2 &= ~V3D_OCCLUDE_WIRE;
|
v3d->flag2 &= ~V3D_OCCLUDE_WIRE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4013,6 +4013,20 @@ void blo_do_versions_300(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||||
* \note Keep this message at the bottom of the function.
|
* \note Keep this message at the bottom of the function.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
|
/* Z bias for retopology overlay. */
|
||||||
|
if (!DNA_struct_elem_find(fd->filesdna, "View3DOverlay", "float", "retopology_offset")) {
|
||||||
|
LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
|
||||||
|
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
||||||
|
LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
|
||||||
|
if (sl->spacetype == SPACE_VIEW3D) {
|
||||||
|
View3D *v3d = (View3D *)sl;
|
||||||
|
v3d->overlay.retopology_offset = 0.2f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Keep this block, even when empty. */
|
/* Keep this block, even when empty. */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -638,6 +638,7 @@ set(GLSL_SRC
|
||||||
engines/overlay/shaders/overlay_edit_mesh_analysis_frag.glsl
|
engines/overlay/shaders/overlay_edit_mesh_analysis_frag.glsl
|
||||||
engines/overlay/shaders/overlay_edit_mesh_analysis_vert.glsl
|
engines/overlay/shaders/overlay_edit_mesh_analysis_vert.glsl
|
||||||
engines/overlay/shaders/overlay_edit_mesh_common_lib.glsl
|
engines/overlay/shaders/overlay_edit_mesh_common_lib.glsl
|
||||||
|
engines/overlay/shaders/overlay_edit_mesh_depth_vert.glsl
|
||||||
engines/overlay/shaders/overlay_edit_mesh_frag.glsl
|
engines/overlay/shaders/overlay_edit_mesh_frag.glsl
|
||||||
engines/overlay/shaders/overlay_edit_mesh_geom.glsl
|
engines/overlay/shaders/overlay_edit_mesh_geom.glsl
|
||||||
engines/overlay/shaders/overlay_edit_mesh_normal_vert.glsl
|
engines/overlay/shaders/overlay_edit_mesh_normal_vert.glsl
|
||||||
|
|
|
@ -58,10 +58,14 @@ void OVERLAY_edit_mesh_cache_init(OVERLAY_Data *vedata)
|
||||||
bool select_face = pd->edit_mesh.select_face = (tsettings->selectmode & SCE_SELECT_FACE) != 0;
|
bool select_face = pd->edit_mesh.select_face = (tsettings->selectmode & SCE_SELECT_FACE) != 0;
|
||||||
bool select_edge = pd->edit_mesh.select_edge = (tsettings->selectmode & SCE_SELECT_EDGE) != 0;
|
bool select_edge = pd->edit_mesh.select_edge = (tsettings->selectmode & SCE_SELECT_EDGE) != 0;
|
||||||
|
|
||||||
bool do_occlude_wire = (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_OCCLUDE_WIRE) != 0;
|
|
||||||
bool show_face_dots = (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_FACE_DOT) != 0 ||
|
bool show_face_dots = (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_FACE_DOT) != 0 ||
|
||||||
pd->edit_mesh.do_zbufclip;
|
pd->edit_mesh.do_zbufclip;
|
||||||
|
|
||||||
|
bool show_retopology = (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_RETOPOLOGY) != 0;
|
||||||
|
float retopology_offset = (show_retopology) ?
|
||||||
|
max_ff(v3d->overlay.retopology_offset, FLT_EPSILON) :
|
||||||
|
0.0f;
|
||||||
bonj marked this conversation as resolved
|
|||||||
|
|
||||||
pd->edit_mesh.do_faces = true;
|
pd->edit_mesh.do_faces = true;
|
||||||
pd->edit_mesh.do_edges = true;
|
pd->edit_mesh.do_edges = true;
|
||||||
|
|
||||||
|
@ -94,17 +98,24 @@ void OVERLAY_edit_mesh_cache_init(OVERLAY_Data *vedata)
|
||||||
}
|
}
|
||||||
|
|
||||||
float backwire_opacity = (pd->edit_mesh.do_zbufclip) ? v3d->overlay.backwire_opacity : 1.0f;
|
float backwire_opacity = (pd->edit_mesh.do_zbufclip) ? v3d->overlay.backwire_opacity : 1.0f;
|
||||||
float face_alpha = (do_occlude_wire || !pd->edit_mesh.do_faces) ? 0.0f : 1.0f;
|
float face_alpha = (!pd->edit_mesh.do_faces) ? 0.0f : 1.0f;
|
||||||
GPUTexture **depth_tex = (pd->edit_mesh.do_zbufclip) ? &dtxl->depth : &txl->dummy_depth_tx;
|
GPUTexture **depth_tex = (pd->edit_mesh.do_zbufclip) ? &dtxl->depth : &txl->dummy_depth_tx;
|
||||||
|
|
||||||
/* Run Twice for in-front passes. */
|
/* Run Twice for in-front passes. */
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
/* Complementary Depth Pass */
|
/* Complementary Depth Pass */
|
||||||
state = DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_CULL_BACK;
|
state = DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_CULL_BACK;
|
||||||
|
if (show_retopology) {
|
||||||
bonj marked this conversation as resolved
Clément Foucault
commented
Style: Prefer:
Style: Prefer:
```
if (show_retopology) {
/* Do not cull backfaces for retopology. This is because [insert explanation here] */
state &= ~DRW_STATE_CULL_BACK;
}
Jorijn de Graaf
commented
Added an if block and explanation, as discussed in DMs. Added an if block and explanation, as discussed in DMs.
|
|||||||
|
/* Do not cull backfaces for retopology depth pass.
|
||||||
|
* This prevents edit overlays from appearing behind any faces.
|
||||||
|
* Doing so reduces visual clutter. */
|
||||||
|
state &= ~DRW_STATE_CULL_BACK;
|
||||||
|
}
|
||||||
DRW_PASS_CREATE(psl->edit_mesh_depth_ps[i], state | pd->clipping_state);
|
DRW_PASS_CREATE(psl->edit_mesh_depth_ps[i], state | pd->clipping_state);
|
||||||
|
|
||||||
sh = OVERLAY_shader_depth_only();
|
sh = OVERLAY_shader_edit_mesh_depth();
|
||||||
pd->edit_mesh_depth_grp[i] = DRW_shgroup_create(sh, psl->edit_mesh_depth_ps[i]);
|
grp = pd->edit_mesh_depth_grp[i] = DRW_shgroup_create(sh, psl->edit_mesh_depth_ps[i]);
|
||||||
|
DRW_shgroup_uniform_float_copy(grp, "retopologyOffset", retopology_offset);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
/* Normals */
|
/* Normals */
|
||||||
|
@ -123,6 +134,7 @@ void OVERLAY_edit_mesh_cache_init(OVERLAY_Data *vedata)
|
||||||
(flag & V3D_OVERLAY_EDIT_CONSTANT_SCREEN_SIZE_NORMALS) != 0);
|
(flag & V3D_OVERLAY_EDIT_CONSTANT_SCREEN_SIZE_NORMALS) != 0);
|
||||||
DRW_shgroup_uniform_float_copy(
|
DRW_shgroup_uniform_float_copy(
|
||||||
grp, "normalScreenSize", v3d->overlay.normals_constant_screen_size);
|
grp, "normalScreenSize", v3d->overlay.normals_constant_screen_size);
|
||||||
|
DRW_shgroup_uniform_float_copy(grp, "retopologyOffset", retopology_offset);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
/* Mesh Analysis Pass */
|
/* Mesh Analysis Pass */
|
||||||
|
@ -149,6 +161,12 @@ void OVERLAY_edit_mesh_cache_init(OVERLAY_Data *vedata)
|
||||||
DRWShadingGroup **shgrp = (j == 0) ? &pd->edit_mesh_faces_grp[i] :
|
DRWShadingGroup **shgrp = (j == 0) ? &pd->edit_mesh_faces_grp[i] :
|
||||||
&pd->edit_mesh_faces_cage_grp[i];
|
&pd->edit_mesh_faces_cage_grp[i];
|
||||||
state = state_common;
|
state = state_common;
|
||||||
|
if (show_retopology) {
|
||||||
|
/* Cull backfaces for retopology face pass.
|
||||||
|
* This makes it so backfaces are not drawn.
|
||||||
|
* Doing so lets us distinguish backfaces from frontfaces. */
|
||||||
|
state |= DRW_STATE_CULL_BACK;
|
||||||
|
}
|
||||||
DRW_PASS_CREATE(*edit_face_ps, state | pd->clipping_state);
|
DRW_PASS_CREATE(*edit_face_ps, state | pd->clipping_state);
|
||||||
|
|
||||||
grp = *shgrp = DRW_shgroup_create(face_sh, *edit_face_ps);
|
grp = *shgrp = DRW_shgroup_create(face_sh, *edit_face_ps);
|
||||||
|
@ -156,6 +174,7 @@ void OVERLAY_edit_mesh_cache_init(OVERLAY_Data *vedata)
|
||||||
DRW_shgroup_uniform_ivec4(grp, "dataMask", mask, 1);
|
DRW_shgroup_uniform_ivec4(grp, "dataMask", mask, 1);
|
||||||
DRW_shgroup_uniform_float_copy(grp, "alpha", face_alpha);
|
DRW_shgroup_uniform_float_copy(grp, "alpha", face_alpha);
|
||||||
DRW_shgroup_uniform_bool_copy(grp, "selectFaces", select_face);
|
DRW_shgroup_uniform_bool_copy(grp, "selectFaces", select_face);
|
||||||
|
DRW_shgroup_uniform_float_copy(grp, "retopologyOffset", retopology_offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (do_zbufclip) {
|
if (do_zbufclip) {
|
||||||
|
@ -175,6 +194,7 @@ void OVERLAY_edit_mesh_cache_init(OVERLAY_Data *vedata)
|
||||||
DRW_shgroup_uniform_texture_ref(grp, "depthTex", depth_tex);
|
DRW_shgroup_uniform_texture_ref(grp, "depthTex", depth_tex);
|
||||||
DRW_shgroup_uniform_bool_copy(grp, "selectEdges", pd->edit_mesh.do_edges || select_edge);
|
DRW_shgroup_uniform_bool_copy(grp, "selectEdges", pd->edit_mesh.do_edges || select_edge);
|
||||||
DRW_shgroup_uniform_bool_copy(grp, "do_smooth_wire", do_smooth_wire);
|
DRW_shgroup_uniform_bool_copy(grp, "do_smooth_wire", do_smooth_wire);
|
||||||
|
DRW_shgroup_uniform_float_copy(grp, "retopologyOffset", retopology_offset);
|
||||||
|
|
||||||
/* Verts */
|
/* Verts */
|
||||||
state |= DRW_STATE_WRITE_DEPTH;
|
state |= DRW_STATE_WRITE_DEPTH;
|
||||||
|
@ -188,10 +208,12 @@ void OVERLAY_edit_mesh_cache_init(OVERLAY_Data *vedata)
|
||||||
DRW_shgroup_uniform_float_copy(grp, "alpha", backwire_opacity);
|
DRW_shgroup_uniform_float_copy(grp, "alpha", backwire_opacity);
|
||||||
DRW_shgroup_uniform_texture_ref(grp, "depthTex", depth_tex);
|
DRW_shgroup_uniform_texture_ref(grp, "depthTex", depth_tex);
|
||||||
DRW_shgroup_uniform_ivec4_copy(grp, "dataMask", vert_mask);
|
DRW_shgroup_uniform_ivec4_copy(grp, "dataMask", vert_mask);
|
||||||
|
DRW_shgroup_uniform_float_copy(grp, "retopologyOffset", retopology_offset);
|
||||||
|
|
||||||
sh = OVERLAY_shader_edit_mesh_skin_root();
|
sh = OVERLAY_shader_edit_mesh_skin_root();
|
||||||
grp = pd->edit_mesh_skin_roots_grp[i] = DRW_shgroup_create(sh, psl->edit_mesh_verts_ps[i]);
|
grp = pd->edit_mesh_skin_roots_grp[i] = DRW_shgroup_create(sh, psl->edit_mesh_verts_ps[i]);
|
||||||
DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
|
DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
|
||||||
|
DRW_shgroup_uniform_float_copy(grp, "retopologyOffset", retopology_offset);
|
||||||
}
|
}
|
||||||
/* Face-dots */
|
/* Face-dots */
|
||||||
if (select_face && show_face_dots) {
|
if (select_face && show_face_dots) {
|
||||||
|
@ -201,6 +223,7 @@ void OVERLAY_edit_mesh_cache_init(OVERLAY_Data *vedata)
|
||||||
DRW_shgroup_uniform_float_copy(grp, "alpha", backwire_opacity);
|
DRW_shgroup_uniform_float_copy(grp, "alpha", backwire_opacity);
|
||||||
DRW_shgroup_uniform_texture_ref(grp, "depthTex", depth_tex);
|
DRW_shgroup_uniform_texture_ref(grp, "depthTex", depth_tex);
|
||||||
DRW_shgroup_uniform_ivec4_copy(grp, "dataMask", vert_mask);
|
DRW_shgroup_uniform_ivec4_copy(grp, "dataMask", vert_mask);
|
||||||
|
DRW_shgroup_uniform_float_copy(grp, "retopologyOffset", retopology_offset);
|
||||||
DRW_shgroup_state_enable(grp, DRW_STATE_WRITE_DEPTH);
|
DRW_shgroup_state_enable(grp, DRW_STATE_WRITE_DEPTH);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -263,7 +286,7 @@ void OVERLAY_edit_mesh_cache_populate(OVERLAY_Data *vedata, Object *ob)
|
||||||
|
|
||||||
bool draw_as_solid = (ob->dt > OB_WIRE);
|
bool draw_as_solid = (ob->dt > OB_WIRE);
|
||||||
bool do_in_front = (ob->dtx & OB_DRAW_IN_FRONT) != 0;
|
bool do_in_front = (ob->dtx & OB_DRAW_IN_FRONT) != 0;
|
||||||
bool do_occlude_wire = (pd->edit_mesh.flag & V3D_OVERLAY_EDIT_OCCLUDE_WIRE) != 0;
|
bool show_retopology = (pd->edit_mesh.flag & V3D_OVERLAY_EDIT_RETOPOLOGY) != 0;
|
||||||
bool do_show_mesh_analysis = (pd->edit_mesh.flag & V3D_OVERLAY_EDIT_STATVIS) != 0;
|
bool do_show_mesh_analysis = (pd->edit_mesh.flag & V3D_OVERLAY_EDIT_STATVIS) != 0;
|
||||||
bool fnormals_do = (pd->edit_mesh.flag & V3D_OVERLAY_EDIT_FACE_NORMALS) != 0;
|
bool fnormals_do = (pd->edit_mesh.flag & V3D_OVERLAY_EDIT_FACE_NORMALS) != 0;
|
||||||
bool vnormals_do = (pd->edit_mesh.flag & V3D_OVERLAY_EDIT_VERT_NORMALS) != 0;
|
bool vnormals_do = (pd->edit_mesh.flag & V3D_OVERLAY_EDIT_VERT_NORMALS) != 0;
|
||||||
|
@ -276,7 +299,12 @@ void OVERLAY_edit_mesh_cache_populate(OVERLAY_Data *vedata, Object *ob)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (do_occlude_wire || (do_in_front && draw_as_solid)) {
|
if (show_retopology) {
|
||||||
|
Mesh *me = (Mesh *)ob->data;
|
||||||
|
geom = DRW_mesh_batch_cache_get_edit_triangles(me);
|
||||||
|
DRW_shgroup_call_no_cull(pd->edit_mesh_depth_grp[do_in_front], geom, ob);
|
||||||
|
}
|
||||||
|
else if (do_in_front && draw_as_solid) {
|
||||||
geom = DRW_cache_mesh_surface_get(ob);
|
geom = DRW_cache_mesh_surface_get(ob);
|
||||||
DRW_shgroup_call_no_cull(pd->edit_mesh_depth_grp[do_in_front], geom, ob);
|
DRW_shgroup_call_no_cull(pd->edit_mesh_depth_grp[do_in_front], geom, ob);
|
||||||
}
|
}
|
||||||
|
|
|
@ -730,6 +730,7 @@ GPUShader *OVERLAY_shader_edit_gpencil_wire(void);
|
||||||
GPUShader *OVERLAY_shader_edit_lattice_point(void);
|
GPUShader *OVERLAY_shader_edit_lattice_point(void);
|
||||||
GPUShader *OVERLAY_shader_edit_lattice_wire(void);
|
GPUShader *OVERLAY_shader_edit_lattice_wire(void);
|
||||||
GPUShader *OVERLAY_shader_edit_mesh_analysis(void);
|
GPUShader *OVERLAY_shader_edit_mesh_analysis(void);
|
||||||
|
GPUShader *OVERLAY_shader_edit_mesh_depth(void);
|
||||||
GPUShader *OVERLAY_shader_edit_mesh_edge(bool use_flat_interp);
|
GPUShader *OVERLAY_shader_edit_mesh_edge(bool use_flat_interp);
|
||||||
GPUShader *OVERLAY_shader_edit_mesh_face(void);
|
GPUShader *OVERLAY_shader_edit_mesh_face(void);
|
||||||
GPUShader *OVERLAY_shader_edit_mesh_facedot(void);
|
GPUShader *OVERLAY_shader_edit_mesh_facedot(void);
|
||||||
|
|
|
@ -40,6 +40,7 @@ struct OVERLAY_Shaders {
|
||||||
GPUShader *edit_mesh_vert;
|
GPUShader *edit_mesh_vert;
|
||||||
GPUShader *edit_mesh_edge;
|
GPUShader *edit_mesh_edge;
|
||||||
GPUShader *edit_mesh_edge_flat;
|
GPUShader *edit_mesh_edge_flat;
|
||||||
|
GPUShader *edit_mesh_depth;
|
||||||
GPUShader *edit_mesh_face;
|
GPUShader *edit_mesh_face;
|
||||||
GPUShader *edit_mesh_facedot;
|
GPUShader *edit_mesh_facedot;
|
||||||
GPUShader *edit_mesh_skin_root;
|
GPUShader *edit_mesh_skin_root;
|
||||||
|
@ -153,6 +154,18 @@ GPUShader *OVERLAY_shader_depth_only(void)
|
||||||
return sh_data->depth_only;
|
return sh_data->depth_only;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GPUShader *OVERLAY_shader_edit_mesh_depth(void)
|
||||||
|
{
|
||||||
|
const DRWContextState *draw_ctx = DRW_context_state_get();
|
||||||
|
OVERLAY_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg];
|
||||||
|
if (!sh_data->edit_mesh_depth) {
|
||||||
|
sh_data->edit_mesh_depth = GPU_shader_create_from_info_name(
|
||||||
|
(draw_ctx->sh_cfg == GPU_SHADER_CFG_CLIPPED) ? "overlay_edit_mesh_depth_clipped" :
|
||||||
|
"overlay_edit_mesh_depth");
|
||||||
|
}
|
||||||
|
return sh_data->edit_mesh_depth;
|
||||||
|
}
|
||||||
|
|
||||||
GPUShader *OVERLAY_shader_edit_mesh_vert(void)
|
GPUShader *OVERLAY_shader_edit_mesh_vert(void)
|
||||||
{
|
{
|
||||||
const DRWContextState *draw_ctx = DRW_context_state_get();
|
const DRWContextState *draw_ctx = DRW_context_state_get();
|
||||||
|
|
|
@ -18,6 +18,7 @@ GPU_SHADER_CREATE_INFO(overlay_edit_mesh_common)
|
||||||
.push_constant(Type::BOOL, "selectFaces")
|
.push_constant(Type::BOOL, "selectFaces")
|
||||||
.push_constant(Type::BOOL, "selectEdges")
|
.push_constant(Type::BOOL, "selectEdges")
|
||||||
.push_constant(Type::FLOAT, "alpha")
|
.push_constant(Type::FLOAT, "alpha")
|
||||||
|
.push_constant(Type::FLOAT, "retopologyOffset")
|
||||||
.push_constant(Type::IVEC4, "dataMask")
|
.push_constant(Type::IVEC4, "dataMask")
|
||||||
.vertex_source("overlay_edit_mesh_vert.glsl")
|
.vertex_source("overlay_edit_mesh_vert.glsl")
|
||||||
.additional_info("draw_modelmat", "draw_globals");
|
.additional_info("draw_modelmat", "draw_globals");
|
||||||
|
@ -31,11 +32,24 @@ GPU_SHADER_CREATE_INFO(overlay_edit_mesh_common_no_geom)
|
||||||
.push_constant(Type::BOOL, "selectFaces")
|
.push_constant(Type::BOOL, "selectFaces")
|
||||||
.push_constant(Type::BOOL, "selectEdges")
|
.push_constant(Type::BOOL, "selectEdges")
|
||||||
.push_constant(Type::FLOAT, "alpha")
|
.push_constant(Type::FLOAT, "alpha")
|
||||||
|
.push_constant(Type::FLOAT, "retopologyOffset")
|
||||||
.push_constant(Type::IVEC4, "dataMask")
|
.push_constant(Type::IVEC4, "dataMask")
|
||||||
.vertex_source("overlay_edit_mesh_vert_no_geom.glsl")
|
.vertex_source("overlay_edit_mesh_vert_no_geom.glsl")
|
||||||
.additional_info("draw_modelmat", "draw_globals");
|
.additional_info("draw_modelmat", "draw_globals");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
GPU_SHADER_CREATE_INFO(overlay_edit_mesh_depth)
|
||||||
|
.do_static_compilation(true)
|
||||||
|
.vertex_in(0, Type::VEC3, "pos")
|
||||||
|
.push_constant(Type::FLOAT, "retopologyOffset")
|
||||||
|
.vertex_source("overlay_edit_mesh_depth_vert.glsl")
|
||||||
|
.fragment_source("overlay_depth_only_frag.glsl")
|
||||||
|
.additional_info("draw_mesh");
|
||||||
|
|
||||||
|
GPU_SHADER_CREATE_INFO(overlay_edit_mesh_depth_clipped)
|
||||||
|
.do_static_compilation(true)
|
||||||
|
.additional_info("overlay_edit_mesh_depth", "drw_clipped");
|
||||||
|
|
||||||
GPU_SHADER_INTERFACE_INFO(overlay_edit_mesh_vert_iface, "")
|
GPU_SHADER_INTERFACE_INFO(overlay_edit_mesh_vert_iface, "")
|
||||||
.smooth(Type::VEC4, "finalColor")
|
.smooth(Type::VEC4, "finalColor")
|
||||||
.smooth(Type::FLOAT, "vertexCrease");
|
.smooth(Type::FLOAT, "vertexCrease");
|
||||||
|
|
|
@ -54,6 +54,7 @@ vec4 EDIT_MESH_face_color(uint face_flag)
|
||||||
{
|
{
|
||||||
vec4 color = colorFace;
|
vec4 color = colorFace;
|
||||||
vec4 color_active = mix(colorFaceSelect, colorEditMeshActive, 0.5);
|
vec4 color_active = mix(colorFaceSelect, colorEditMeshActive, 0.5);
|
||||||
|
color = (retopologyOffset > 0.0) ? colorFaceRetopology : color;
|
||||||
color = ((face_flag & FACE_FREESTYLE) != 0u) ? colorFaceFreestyle : color;
|
color = ((face_flag & FACE_FREESTYLE) != 0u) ? colorFaceFreestyle : color;
|
||||||
color = ((face_flag & FACE_SELECTED) != 0u) ? colorFaceSelect : color;
|
color = ((face_flag & FACE_SELECTED) != 0u) ? colorFaceSelect : color;
|
||||||
color = ((face_flag & FACE_ACTIVE) != 0u) ? color_active : color;
|
color = ((face_flag & FACE_ACTIVE) != 0u) ? color_active : color;
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
|
||||||
|
#pragma BLENDER_REQUIRE(common_view_clipping_lib.glsl)
|
||||||
|
#pragma BLENDER_REQUIRE(common_view_lib.glsl)
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
GPU_INTEL_VERTEX_SHADER_WORKAROUND
|
||||||
|
|
||||||
|
vec3 world_pos = point_object_to_world(pos);
|
||||||
|
vec3 view_pos = point_world_to_view(world_pos);
|
||||||
|
gl_Position = point_view_to_ndc(view_pos);
|
||||||
|
|
||||||
|
/* Offset Z position for retopology overlay. */
|
||||||
|
gl_Position.z += get_homogenous_z_offset(view_pos.z, gl_Position.w, retopologyOffset);
|
||||||
|
|
||||||
|
view_clipping_distances(world_pos);
|
||||||
|
}
|
|
@ -29,7 +29,11 @@ void main()
|
||||||
GPU_INTEL_VERTEX_SHADER_WORKAROUND
|
GPU_INTEL_VERTEX_SHADER_WORKAROUND
|
||||||
|
|
||||||
vec3 world_pos = point_object_to_world(pos);
|
vec3 world_pos = point_object_to_world(pos);
|
||||||
gl_Position = point_world_to_ndc(world_pos);
|
vec3 view_pos = point_world_to_view(world_pos);
|
||||||
|
gl_Position = point_view_to_ndc(view_pos);
|
||||||
|
|
||||||
|
/* Offset Z position for retopology overlay. */
|
||||||
|
gl_Position.z += get_homogenous_z_offset(view_pos.z, gl_Position.w, retopologyOffset);
|
||||||
|
|
||||||
uvec4 m_data = data & uvec4(dataMask);
|
uvec4 m_data = data & uvec4(dataMask);
|
||||||
|
|
||||||
|
@ -85,9 +89,8 @@ void main()
|
||||||
|
|
||||||
#if !defined(FACE)
|
#if !defined(FACE)
|
||||||
/* Facing based color blend */
|
/* Facing based color blend */
|
||||||
vec3 vpos = point_world_to_view(world_pos);
|
|
||||||
vec3 view_normal = normalize(normal_object_to_view(vnor) + 1e-4);
|
vec3 view_normal = normalize(normal_object_to_view(vnor) + 1e-4);
|
||||||
vec3 view_vec = (drw_view.winmat[3][3] == 0.0) ? normalize(vpos) : vec3(0.0, 0.0, 1.0);
|
vec3 view_vec = (drw_view.winmat[3][3] == 0.0) ? normalize(view_pos) : vec3(0.0, 0.0, 1.0);
|
||||||
float facing = dot(view_vec, view_normal);
|
float facing = dot(view_vec, view_normal);
|
||||||
facing = 1.0 - abs(facing) * 0.2;
|
facing = 1.0 - abs(facing) * 0.2;
|
||||||
|
|
||||||
|
|
|
@ -82,8 +82,15 @@ void main()
|
||||||
|
|
||||||
vec3 world_pos0 = point_object_to_world(in_pos0);
|
vec3 world_pos0 = point_object_to_world(in_pos0);
|
||||||
vec3 world_pos1 = point_object_to_world(in_pos1);
|
vec3 world_pos1 = point_object_to_world(in_pos1);
|
||||||
vec4 out_pos0 = point_world_to_ndc(world_pos0);
|
vec3 view_pos0 = point_world_to_view(world_pos0);
|
||||||
vec4 out_pos1 = point_world_to_ndc(world_pos1);
|
vec3 view_pos1 = point_world_to_view(world_pos1);
|
||||||
|
vec4 out_pos0 = point_view_to_ndc(view_pos0);
|
||||||
|
vec4 out_pos1 = point_view_to_ndc(view_pos1);
|
||||||
|
|
||||||
|
/* Offset Z position for retopology overlay. */
|
||||||
|
out_pos0.z += get_homogenous_z_offset(view_pos0.z, out_pos0.w, retopologyOffset);
|
||||||
|
out_pos1.z += get_homogenous_z_offset(view_pos1.z, out_pos1.w, retopologyOffset);
|
||||||
|
|
||||||
uvec4 m_data0 = uvec4(in_data0) & uvec4(dataMask);
|
uvec4 m_data0 = uvec4(in_data0) & uvec4(dataMask);
|
||||||
uvec4 m_data1 = uvec4(in_data1) & uvec4(dataMask);
|
uvec4 m_data1 = uvec4(in_data1) & uvec4(dataMask);
|
||||||
|
|
||||||
|
@ -124,15 +131,13 @@ void main()
|
||||||
|
|
||||||
#if !defined(FACE)
|
#if !defined(FACE)
|
||||||
/* Facing based color blend */
|
/* Facing based color blend */
|
||||||
vec3 vpos0 = point_world_to_view(world_pos0);
|
|
||||||
vec3 view_normal0 = normalize(normal_object_to_view(in_vnor0) + 1e-4);
|
vec3 view_normal0 = normalize(normal_object_to_view(in_vnor0) + 1e-4);
|
||||||
vec3 view_vec0 = (ProjectionMatrix[3][3] == 0.0) ? normalize(vpos0) : vec3(0.0, 0.0, 1.0);
|
vec3 view_vec0 = (ProjectionMatrix[3][3] == 0.0) ? normalize(view_pos0) : vec3(0.0, 0.0, 1.0);
|
||||||
float facing0 = dot(view_vec0, view_normal0);
|
float facing0 = dot(view_vec0, view_normal0);
|
||||||
facing0 = 1.0 - abs(facing0) * 0.2;
|
facing0 = 1.0 - abs(facing0) * 0.2;
|
||||||
|
|
||||||
vec3 vpos1 = point_world_to_view(world_pos1);
|
|
||||||
vec3 view_normal1 = normalize(normal_object_to_view(in_vnor1) + 1e-4);
|
vec3 view_normal1 = normalize(normal_object_to_view(in_vnor1) + 1e-4);
|
||||||
vec3 view_vec1 = (ProjectionMatrix[3][3] == 0.0) ? normalize(vpos1) : vec3(0.0, 0.0, 1.0);
|
vec3 view_vec1 = (ProjectionMatrix[3][3] == 0.0) ? normalize(view_pos1) : vec3(0.0, 0.0, 1.0);
|
||||||
float facing1 = dot(view_vec1, view_normal1);
|
float facing1 = dot(view_vec1, view_normal1);
|
||||||
facing1 = 1.0 - abs(facing1) * 0.2;
|
facing1 = 1.0 - abs(facing1) * 0.2;
|
||||||
|
|
||||||
|
|
|
@ -68,6 +68,7 @@ void DRW_globals_update(void)
|
||||||
UI_GetThemeColor4fv(TH_EDGE_FACESEL, gb->color_edge_face_select);
|
UI_GetThemeColor4fv(TH_EDGE_FACESEL, gb->color_edge_face_select);
|
||||||
UI_GetThemeColor4fv(TH_FACE, gb->color_face);
|
UI_GetThemeColor4fv(TH_FACE, gb->color_face);
|
||||||
UI_GetThemeColor4fv(TH_FACE_SELECT, gb->color_face_select);
|
UI_GetThemeColor4fv(TH_FACE_SELECT, gb->color_face_select);
|
||||||
|
UI_GetThemeColor4fv(TH_FACE_RETOPOLOGY, gb->color_face_retopology);
|
||||||
UI_GetThemeColor4fv(TH_FACE_BACK, gb->color_face_back);
|
UI_GetThemeColor4fv(TH_FACE_BACK, gb->color_face_back);
|
||||||
UI_GetThemeColor4fv(TH_FACE_FRONT, gb->color_face_front);
|
UI_GetThemeColor4fv(TH_FACE_FRONT, gb->color_face_front);
|
||||||
UI_GetThemeColor4fv(TH_NORMAL, gb->color_normal);
|
UI_GetThemeColor4fv(TH_NORMAL, gb->color_normal);
|
||||||
|
|
|
@ -48,6 +48,7 @@ struct GlobalsUboStorage {
|
||||||
float4 color_edge_freestyle;
|
float4 color_edge_freestyle;
|
||||||
float4 color_face;
|
float4 color_face;
|
||||||
float4 color_face_select;
|
float4 color_face_select;
|
||||||
|
float4 color_face_retopology;
|
||||||
float4 color_face_freestyle;
|
float4 color_face_freestyle;
|
||||||
float4 color_gpencil_vertex;
|
float4 color_gpencil_vertex;
|
||||||
float4 color_gpencil_vertex_select;
|
float4 color_gpencil_vertex_select;
|
||||||
|
@ -164,6 +165,7 @@ BLI_STATIC_ASSERT_ALIGN(GlobalsUboStorage, 16)
|
||||||
# define colorEdgeFreestyle globalsBlock.color_edge_freestyle
|
# define colorEdgeFreestyle globalsBlock.color_edge_freestyle
|
||||||
# define colorFace globalsBlock.color_face
|
# define colorFace globalsBlock.color_face
|
||||||
# define colorFaceSelect globalsBlock.color_face_select
|
# define colorFaceSelect globalsBlock.color_face_select
|
||||||
|
# define colorFaceRetopology globalsBlock.color_face_retopology
|
||||||
# define colorFaceFreestyle globalsBlock.color_face_freestyle
|
# define colorFaceFreestyle globalsBlock.color_face_freestyle
|
||||||
# define colorGpencilVertex globalsBlock.color_gpencil_vertex
|
# define colorGpencilVertex globalsBlock.color_gpencil_vertex
|
||||||
# define colorGpencilVertexSelect globalsBlock.color_gpencil_vertex_select
|
# define colorGpencilVertexSelect globalsBlock.color_gpencil_vertex_select
|
||||||
|
|
|
@ -188,7 +188,7 @@ bool DRW_object_is_renderable(const Object *ob)
|
||||||
if (ob->type == OB_MESH) {
|
if (ob->type == OB_MESH) {
|
||||||
if ((ob == DST.draw_ctx.object_edit) || DRW_object_is_in_edit_mode(ob)) {
|
if ((ob == DST.draw_ctx.object_edit) || DRW_object_is_in_edit_mode(ob)) {
|
||||||
View3D *v3d = DST.draw_ctx.v3d;
|
View3D *v3d = DST.draw_ctx.v3d;
|
||||||
if (v3d && v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_OCCLUDE_WIRE) {
|
if (v3d && v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_RETOPOLOGY) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -257,6 +257,23 @@ vec3 point_world_to_view(vec3 p)
|
||||||
return (ViewMatrix * vec4(p, 1.0)).xyz;
|
return (ViewMatrix * vec4(p, 1.0)).xyz;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Viewspace Z is used to adjust for perspective projection.
|
||||||
|
* Homogenous W is used to convert from NDC to homogenous space.
|
||||||
bonj marked this conversation as resolved
Clément Foucault
commented
My bad. The equation is actually comming from page 24. My bad. The equation is actually comming from page 24.
Jorijn de Graaf
commented
I thought you picked 18 because it's the start of the section about depth modification. I think it makes sense to point to the whole range of pages (18-26). I thought you picked 18 because it's the start of the section about depth modification. I think it makes sense to point to the whole range of pages (18-26).
Clément Foucault
commented
Yes, but here it is the reference to a specific formula. I also think this reference should be inside the function. Comment on top of function is only for documentation of the function usage. Yes, but here it is the reference to a specific formula. I also think this reference should be inside the function. Comment on top of function is only for documentation of the function usage.
Jorijn de Graaf
commented
Done. Done.
|
|||||||
|
* Offset is in viewspace, so positive values are closer to the camera. */
|
||||||
|
float get_homogenous_z_offset(float vs_z, float hs_w, float vs_offset)
|
||||||
|
{
|
||||||
|
if (ProjectionMatrix[3][3] == 0.0) {
|
||||||
bonj marked this conversation as resolved
Clément Foucault
commented
Maybe also add a note that offset is in viewspace. So positive values are closer to camera. Maybe also add a note that offset is in viewspace. So positive values are closer to camera.
Jorijn de Graaf
commented
Done, now each parameter has an explanation. Done, now each parameter has an explanation.
|
|||||||
|
/* Clamp offset to half of Z to avoid floating point precision errors. */
|
||||||
|
vs_offset = min(vs_offset, vs_z * -0.5);
|
||||||
|
/* From "Projection Matrix Tricks" by Eric Lengyel:
|
||||||
bonj marked this conversation as resolved
Clément Foucault
commented
Remove the negative sign here and everywhere Remove the negative sign here and everywhere `get_homogenous_z_offset` is called.
The negative sign in the equation from the slide is inside `ProjectionMatrix[3][2]`.
Jorijn de Graaf
commented
Done and done. Done and done.
I negated it because then you can subtract from the Z, which is what other offsets in the shader do, but yeah it was unnecessary so now they just use += for this.
|
|||||||
|
* http://www.terathon.com/gdc07_lengyel.pdf (p. 24 Depth Modification) */
|
||||||
|
return ProjectionMatrix[3][2] * (vs_offset / (vs_z * (vs_z + vs_offset))) * hs_w;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return ProjectionMatrix[2][2] * vs_offset * hs_w;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Due to some shader compiler bug, we somewhat need to access gl_VertexID
|
/* Due to some shader compiler bug, we somewhat need to access gl_VertexID
|
||||||
* to make vertex shaders work. even if it's actually dead code. */
|
* to make vertex shaders work. even if it's actually dead code. */
|
||||||
#if defined(GPU_INTEL) && defined(GPU_OPENGL)
|
#if defined(GPU_INTEL) && defined(GPU_OPENGL)
|
||||||
|
|
|
@ -219,6 +219,7 @@ static void test_overlay_glsl_shaders()
|
||||||
EXPECT_NE(OVERLAY_shader_edit_lattice_point(), nullptr);
|
EXPECT_NE(OVERLAY_shader_edit_lattice_point(), nullptr);
|
||||||
EXPECT_NE(OVERLAY_shader_edit_lattice_wire(), nullptr);
|
EXPECT_NE(OVERLAY_shader_edit_lattice_wire(), nullptr);
|
||||||
EXPECT_NE(OVERLAY_shader_edit_mesh_analysis(), nullptr);
|
EXPECT_NE(OVERLAY_shader_edit_mesh_analysis(), nullptr);
|
||||||
|
EXPECT_NE(OVERLAY_shader_edit_mesh_depth(), nullptr);
|
||||||
EXPECT_NE(OVERLAY_shader_edit_mesh_edge(false), nullptr);
|
EXPECT_NE(OVERLAY_shader_edit_mesh_edge(false), nullptr);
|
||||||
EXPECT_NE(OVERLAY_shader_edit_mesh_edge(true), nullptr);
|
EXPECT_NE(OVERLAY_shader_edit_mesh_edge(true), nullptr);
|
||||||
EXPECT_NE(OVERLAY_shader_edit_mesh_face(), nullptr);
|
EXPECT_NE(OVERLAY_shader_edit_mesh_face(), nullptr);
|
||||||
|
|
|
@ -88,6 +88,7 @@ typedef enum ThemeColorID {
|
||||||
TH_EDGE_FACESEL,
|
TH_EDGE_FACESEL,
|
||||||
TH_FACE,
|
TH_FACE,
|
||||||
TH_FACE_SELECT,
|
TH_FACE_SELECT,
|
||||||
|
TH_FACE_RETOPOLOGY,
|
||||||
TH_FACE_BACK,
|
TH_FACE_BACK,
|
||||||
TH_FACE_FRONT,
|
TH_FACE_FRONT,
|
||||||
TH_NORMAL,
|
TH_NORMAL,
|
||||||
|
|
|
@ -396,6 +396,9 @@ const uchar *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
|
||||||
case TH_FACE_SELECT:
|
case TH_FACE_SELECT:
|
||||||
cp = ts->face_select;
|
cp = ts->face_select;
|
||||||
break;
|
break;
|
||||||
|
case TH_FACE_RETOPOLOGY:
|
||||||
|
cp = ts->face_retopology;
|
||||||
|
break;
|
||||||
case TH_FACE_BACK:
|
case TH_FACE_BACK:
|
||||||
cp = ts->face_back;
|
cp = ts->face_back;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -272,7 +272,7 @@ typedef struct ThemeSpace {
|
||||||
unsigned char edge[4], edge_select[4];
|
unsigned char edge[4], edge_select[4];
|
||||||
unsigned char edge_seam[4], edge_sharp[4], edge_facesel[4], edge_crease[4], edge_bevel[4];
|
unsigned char edge_seam[4], edge_sharp[4], edge_facesel[4], edge_crease[4], edge_bevel[4];
|
||||||
/** Solid faces. */
|
/** Solid faces. */
|
||||||
unsigned char face[4], face_select[4], face_back[4], face_front[4];
|
unsigned char face[4], face_select[4], face_retopology[4], face_back[4], face_front[4];
|
||||||
/** Selected color. */
|
/** Selected color. */
|
||||||
unsigned char face_dot[4];
|
unsigned char face_dot[4];
|
||||||
unsigned char extra_edge_len[4], extra_edge_angle[4], extra_face_angle[4], extra_face_area[4];
|
unsigned char extra_edge_len[4], extra_edge_angle[4], extra_face_angle[4], extra_face_area[4];
|
||||||
|
@ -355,7 +355,7 @@ typedef struct ThemeSpace {
|
||||||
unsigned char path_keyframe_before[4], path_keyframe_after[4];
|
unsigned char path_keyframe_before[4], path_keyframe_after[4];
|
||||||
unsigned char camera_path[4];
|
unsigned char camera_path[4];
|
||||||
unsigned char camera_passepartout[4];
|
unsigned char camera_passepartout[4];
|
||||||
unsigned char _pad1[2];
|
unsigned char _pad1[6];
|
||||||
|
|
||||||
unsigned char gp_vertex_size;
|
unsigned char gp_vertex_size;
|
||||||
unsigned char gp_vertex[4], gp_vertex_select[4];
|
unsigned char gp_vertex[4], gp_vertex_select[4];
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
.flag = V3D_OVERLAY_VIEWER_ATTRIBUTE | V3D_OVERLAY_SCULPT_SHOW_MASK | V3D_OVERLAY_SCULPT_SHOW_FACE_SETS, \
|
.flag = V3D_OVERLAY_VIEWER_ATTRIBUTE | V3D_OVERLAY_SCULPT_SHOW_MASK | V3D_OVERLAY_SCULPT_SHOW_FACE_SETS, \
|
||||||
.wireframe_threshold = 1.0f, \
|
.wireframe_threshold = 1.0f, \
|
||||||
.wireframe_opacity = 1.0f, \
|
.wireframe_opacity = 1.0f, \
|
||||||
|
.retopology_offset = 0.2f, \
|
||||||
.viewer_attribute_opacity = 1.0f, \
|
.viewer_attribute_opacity = 1.0f, \
|
||||||
.xray_alpha_bone = 0.5f, \
|
.xray_alpha_bone = 0.5f, \
|
||||||
.bone_wire_alpha = 1.0f, \
|
.bone_wire_alpha = 1.0f, \
|
||||||
|
|
|
@ -214,7 +214,6 @@ typedef struct View3DOverlay {
|
||||||
/** Armature edit/pose mode settings. */
|
/** Armature edit/pose mode settings. */
|
||||||
float xray_alpha_bone;
|
float xray_alpha_bone;
|
||||||
float bone_wire_alpha;
|
float bone_wire_alpha;
|
||||||
char _pad1[4];
|
|
||||||
|
|
||||||
/** Darken Inactive. */
|
/** Darken Inactive. */
|
||||||
float fade_alpha;
|
float fade_alpha;
|
||||||
|
@ -222,6 +221,7 @@ typedef struct View3DOverlay {
|
||||||
/** Other settings. */
|
/** Other settings. */
|
||||||
float wireframe_threshold;
|
float wireframe_threshold;
|
||||||
float wireframe_opacity;
|
float wireframe_opacity;
|
||||||
|
float retopology_offset;
|
||||||
|
|
||||||
/** Grease pencil settings. */
|
/** Grease pencil settings. */
|
||||||
float gpencil_paper_opacity;
|
float gpencil_paper_opacity;
|
||||||
|
@ -560,7 +560,7 @@ enum {
|
||||||
V3D_OVERLAY_EDIT_LOOP_NORMALS = (1 << 1),
|
V3D_OVERLAY_EDIT_LOOP_NORMALS = (1 << 1),
|
||||||
V3D_OVERLAY_EDIT_FACE_NORMALS = (1 << 2),
|
V3D_OVERLAY_EDIT_FACE_NORMALS = (1 << 2),
|
||||||
|
|
||||||
V3D_OVERLAY_EDIT_OCCLUDE_WIRE = (1 << 3),
|
V3D_OVERLAY_EDIT_RETOPOLOGY = (1 << 3),
|
||||||
|
|
||||||
V3D_OVERLAY_EDIT_WEIGHT = (1 << 4),
|
V3D_OVERLAY_EDIT_WEIGHT = (1 << 4),
|
||||||
|
|
||||||
|
|
|
@ -4532,11 +4532,20 @@ static void rna_def_space_view3d_overlay(BlenderRNA *brna)
|
||||||
RNA_def_property_ui_text(prop, "Show Weights", "Display weights in editmode");
|
RNA_def_property_ui_text(prop, "Show Weights", "Display weights in editmode");
|
||||||
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
|
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
|
||||||
|
|
||||||
prop = RNA_def_property(srna, "show_occlude_wire", PROP_BOOLEAN, PROP_NONE);
|
prop = RNA_def_property(srna, "show_retopology", PROP_BOOLEAN, PROP_NONE);
|
||||||
bonj marked this conversation as resolved
Clément Foucault
commented
Now that we fixed the bias equation, the property types should be You will loose the ability to see the blue fill bar but it will be much explicit that this value is in distance unit. You might have to adjust the sensitivity to have kind of the same drag feeling as when it was a factor. Now that we fixed the bias equation, the property types should be `PROP_DISTANCE`.
You will loose the ability to see the blue fill bar but it will be much explicit that this value is in distance unit.
You might have to adjust the sensitivity to have kind of the same drag feeling as when it was a factor.
And bump the soft max to 2 or 10 (seems nicer to discover that this isn't clamped).
This is what control those `RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1f, 3);`.
Jorijn de Graaf
commented
Made it PROP_DISTANCE and upped the soft max to 10. Made it PROP_DISTANCE and upped the soft max to 10.
I think 0.1 step and 3 digits still feels good so I'll leave those the same.
|
|||||||
RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_OCCLUDE_WIRE);
|
RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_RETOPOLOGY);
|
||||||
RNA_def_property_ui_text(prop, "Hidden Wire", "Use hidden wireframe display");
|
RNA_def_property_ui_text(prop, "Retopology", "Use retopology display");
|
||||||
bonj marked this conversation as resolved
Clément Foucault
commented
Replace description by Maybe @JulienKaspar can agree this is clearer? Replace description by `Offset used to draw the edit mesh in front of other geometry`.
Maybe @JulienKaspar can agree this is clearer? `Z Bias` is too technical in my opinion.
Jorijn de Graaf
commented
I agree. I'll rename it to retopology offset everywhere. I agree. I'll rename it to retopology offset everywhere.
|
|||||||
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D | NS_VIEW3D_SHADING, NULL);
|
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D | NS_VIEW3D_SHADING, NULL);
|
||||||
bonj marked this conversation as resolved
Clément Foucault
commented
Max should be FLT_MAX. Arbitrary limits like these are not good. Max should be FLT_MAX. Arbitrary limits like these are not good.
Jorijn de Graaf
commented
Done. Done.
|
|||||||
|
|
||||||
|
prop = RNA_def_property(srna, "retopology_offset", PROP_FLOAT, PROP_DISTANCE);
|
||||||
|
RNA_def_property_float_sdna(prop, NULL, "overlay.retopology_offset");
|
||||||
|
RNA_def_property_ui_text(
|
||||||
|
prop, "Retopology Offset", "Offset used to draw edit mesh in front of other geometry");
|
||||||
|
RNA_def_property_range(prop, 0.0f, FLT_MAX);
|
||||||
|
RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1f, 3);
|
||||||
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
||||||
|
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
|
||||||
|
|
||||||
prop = RNA_def_property(srna, "show_face_normals", PROP_BOOLEAN, PROP_NONE);
|
prop = RNA_def_property(srna, "show_face_normals", PROP_BOOLEAN, PROP_NONE);
|
||||||
RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_FACE_NORMALS);
|
RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_FACE_NORMALS);
|
||||||
RNA_def_property_ui_text(prop, "Display Normals", "Display face normals as lines");
|
RNA_def_property_ui_text(prop, "Display Normals", "Display face normals as lines");
|
||||||
|
|
|
@ -2003,6 +2003,11 @@ static void rna_def_userdef_theme_spaces_face(StructRNA *srna)
|
||||||
RNA_def_property_ui_text(prop, "Freestyle Face Mark", "");
|
RNA_def_property_ui_text(prop, "Freestyle Face Mark", "");
|
||||||
RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
|
RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
|
||||||
|
|
||||||
|
prop = RNA_def_property(srna, "face_retopology", PROP_FLOAT, PROP_COLOR_GAMMA);
|
||||||
|
RNA_def_property_array(prop, 4);
|
||||||
|
RNA_def_property_ui_text(prop, "Face Retopology", "");
|
||||||
|
RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
|
||||||
|
|
||||||
prop = RNA_def_property(srna, "face_back", PROP_FLOAT, PROP_COLOR_GAMMA);
|
prop = RNA_def_property(srna, "face_back", PROP_FLOAT, PROP_COLOR_GAMMA);
|
||||||
RNA_def_property_array(prop, 4);
|
RNA_def_property_array(prop, 4);
|
||||||
RNA_def_property_ui_text(prop, "Face Orientation Back", "");
|
RNA_def_property_ui_text(prop, "Face Orientation Back", "");
|
||||||
|
|
Just a small tweak.
Use
max_ff(v3d->overlay.retopology_offset, FLT_EPSILON)
and remove comment as this is then cleaner in the code.Makes sense, I'll do that.