Curves: Draw point overlay only in point selection mode #104715
|
@ -5,10 +5,14 @@
|
|||
* \ingroup draw_engine
|
||||
*/
|
||||
|
||||
#include "BKE_curves.h"
|
||||
|
||||
#include "DRW_render.h"
|
||||
|
||||
#include "ED_view3d.h"
|
||||
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
#include "draw_cache_impl.h"
|
||||
|
||||
#include "overlay_private.hh"
|
||||
|
@ -17,7 +21,10 @@ void OVERLAY_edit_curves_init(OVERLAY_Data *vedata)
|
|||
{
|
||||
OVERLAY_PrivateData *pd = vedata->stl->pd;
|
||||
const DRWContextState *draw_ctx = DRW_context_state_get();
|
||||
filedescriptor marked this conversation as resolved
|
||||
const Object *obact_orig = DEG_get_original_object(draw_ctx->obact);
|
||||
|
||||
const Curves &curves_id = *static_cast<const Curves *>(obact_orig->data);
|
||||
pd->edit_curves.do_points = curves_id.selection_domain == ATTR_DOMAIN_POINT;
|
||||
pd->edit_curves.do_zbufclip = XRAY_FLAG_ENABLED(draw_ctx->v3d);
|
||||
|
||||
/* Create view with depth offset. */
|
||||
|
@ -39,10 +46,12 @@ void OVERLAY_edit_curves_cache_init(OVERLAY_Data *vedata)
|
|||
|
||||
/* Run Twice for in-front passes. */
|
||||
for (int i = 0; i < 2; i++) {
|
||||
DRW_PASS_CREATE(psl->edit_curves_points_ps[i], (state | pd->clipping_state));
|
||||
sh = OVERLAY_shader_edit_particle_point();
|
||||
grp = pd->edit_curves_points_grp[i] = DRW_shgroup_create(sh, psl->edit_curves_points_ps[i]);
|
||||
DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
|
||||
if (pd->edit_curves.do_points) {
|
||||
DRW_PASS_CREATE(psl->edit_curves_points_ps[i], (state | pd->clipping_state));
|
||||
sh = OVERLAY_shader_edit_particle_point();
|
||||
grp = pd->edit_curves_points_grp[i] = DRW_shgroup_create(sh, psl->edit_curves_points_ps[i]);
|
||||
DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
|
||||
}
|
||||
|
||||
DRW_PASS_CREATE(psl->edit_curves_lines_ps[i], (state | pd->clipping_state));
|
||||
sh = OVERLAY_shader_edit_particle_strand();
|
||||
|
@ -56,9 +65,11 @@ static void overlay_edit_curves_add_ob_to_pass(OVERLAY_PrivateData *pd, Object *
|
|||
{
|
||||
Curves *curves = static_cast<Curves *>(ob->data);
|
||||
|
||||
DRWShadingGroup *point_shgrp = pd->edit_curves_points_grp[in_front];
|
||||
struct GPUBatch *geom_points = DRW_curves_batch_cache_get_edit_points(curves);
|
||||
DRW_shgroup_call_no_cull(point_shgrp, geom_points, ob);
|
||||
if (pd->edit_curves.do_points) {
|
||||
DRWShadingGroup *point_shgrp = pd->edit_curves_points_grp[in_front];
|
||||
struct GPUBatch *geom_points = DRW_curves_batch_cache_get_edit_points(curves);
|
||||
DRW_shgroup_call_no_cull(point_shgrp, geom_points, ob);
|
||||
}
|
||||
|
||||
DRWShadingGroup *lines_shgrp = pd->edit_curves_lines_grp[in_front];
|
||||
struct GPUBatch *geom_lines = DRW_curves_batch_cache_get_edit_lines(curves);
|
||||
|
@ -89,12 +100,16 @@ void OVERLAY_edit_curves_draw(OVERLAY_Data *vedata)
|
|||
|
||||
if (pd->edit_curves.do_zbufclip) {
|
||||
DRW_view_set_active(pd->view_edit_curves);
|
||||
DRW_draw_pass(psl->edit_curves_points_ps[NOT_IN_FRONT]);
|
||||
if (pd->edit_curves.do_points) {
|
||||
DRW_draw_pass(psl->edit_curves_points_ps[NOT_IN_FRONT]);
|
||||
}
|
||||
DRW_draw_pass(psl->edit_curves_lines_ps[NOT_IN_FRONT]);
|
||||
}
|
||||
else {
|
||||
DRW_view_set_active(pd->view_edit_curves);
|
||||
DRW_draw_pass(psl->edit_curves_points_ps[IN_FRONT]);
|
||||
if (pd->edit_curves.do_points) {
|
||||
DRW_draw_pass(psl->edit_curves_points_ps[IN_FRONT]);
|
||||
}
|
||||
DRW_draw_pass(psl->edit_curves_lines_ps[IN_FRONT]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -362,6 +362,7 @@ typedef struct OVERLAY_PrivateData {
|
|||
int flag; /** Copy of #v3d->overlay.edit_flag. */
|
||||
} edit_mesh;
|
||||
struct {
|
||||
bool do_points;
|
||||
bool do_zbufclip;
|
||||
} edit_curves;
|
||||
struct {
|
||||
|
|
Loading…
Reference in New Issue
const Curves &curves_id = *static_cast<const Curves *>(draw_ctx->obact->data);