forked from blender/blender
WIP: uv-simple-select #1
@ -5,10 +5,14 @@
|
|||||||
* \ingroup draw_engine
|
* \ingroup draw_engine
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "BKE_curves.h"
|
||||||
|
|
||||||
#include "DRW_render.h"
|
#include "DRW_render.h"
|
||||||
|
|
||||||
#include "ED_view3d.h"
|
#include "ED_view3d.h"
|
||||||
|
|
||||||
|
#include "DEG_depsgraph_query.h"
|
||||||
|
|
||||||
#include "draw_cache_impl.h"
|
#include "draw_cache_impl.h"
|
||||||
|
|
||||||
#include "overlay_private.hh"
|
#include "overlay_private.hh"
|
||||||
@ -17,7 +21,10 @@ void OVERLAY_edit_curves_init(OVERLAY_Data *vedata)
|
|||||||
{
|
{
|
||||||
OVERLAY_PrivateData *pd = vedata->stl->pd;
|
OVERLAY_PrivateData *pd = vedata->stl->pd;
|
||||||
const DRWContextState *draw_ctx = DRW_context_state_get();
|
const DRWContextState *draw_ctx = DRW_context_state_get();
|
||||||
|
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);
|
pd->edit_curves.do_zbufclip = XRAY_FLAG_ENABLED(draw_ctx->v3d);
|
||||||
|
|
||||||
/* Create view with depth offset. */
|
/* Create view with depth offset. */
|
||||||
@ -39,10 +46,12 @@ void OVERLAY_edit_curves_cache_init(OVERLAY_Data *vedata)
|
|||||||
|
|
||||||
/* 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++) {
|
||||||
|
if (pd->edit_curves.do_points) {
|
||||||
DRW_PASS_CREATE(psl->edit_curves_points_ps[i], (state | pd->clipping_state));
|
DRW_PASS_CREATE(psl->edit_curves_points_ps[i], (state | pd->clipping_state));
|
||||||
sh = OVERLAY_shader_edit_particle_point();
|
sh = OVERLAY_shader_edit_particle_point();
|
||||||
grp = pd->edit_curves_points_grp[i] = DRW_shgroup_create(sh, psl->edit_curves_points_ps[i]);
|
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_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
|
||||||
|
}
|
||||||
|
|
||||||
DRW_PASS_CREATE(psl->edit_curves_lines_ps[i], (state | pd->clipping_state));
|
DRW_PASS_CREATE(psl->edit_curves_lines_ps[i], (state | pd->clipping_state));
|
||||||
sh = OVERLAY_shader_edit_particle_strand();
|
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);
|
Curves *curves = static_cast<Curves *>(ob->data);
|
||||||
|
|
||||||
|
if (pd->edit_curves.do_points) {
|
||||||
DRWShadingGroup *point_shgrp = pd->edit_curves_points_grp[in_front];
|
DRWShadingGroup *point_shgrp = pd->edit_curves_points_grp[in_front];
|
||||||
struct GPUBatch *geom_points = DRW_curves_batch_cache_get_edit_points(curves);
|
struct GPUBatch *geom_points = DRW_curves_batch_cache_get_edit_points(curves);
|
||||||
DRW_shgroup_call_no_cull(point_shgrp, geom_points, ob);
|
DRW_shgroup_call_no_cull(point_shgrp, geom_points, ob);
|
||||||
|
}
|
||||||
|
|
||||||
DRWShadingGroup *lines_shgrp = pd->edit_curves_lines_grp[in_front];
|
DRWShadingGroup *lines_shgrp = pd->edit_curves_lines_grp[in_front];
|
||||||
struct GPUBatch *geom_lines = DRW_curves_batch_cache_get_edit_lines(curves);
|
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) {
|
if (pd->edit_curves.do_zbufclip) {
|
||||||
DRW_view_set_active(pd->view_edit_curves);
|
DRW_view_set_active(pd->view_edit_curves);
|
||||||
|
if (pd->edit_curves.do_points) {
|
||||||
DRW_draw_pass(psl->edit_curves_points_ps[NOT_IN_FRONT]);
|
DRW_draw_pass(psl->edit_curves_points_ps[NOT_IN_FRONT]);
|
||||||
|
}
|
||||||
DRW_draw_pass(psl->edit_curves_lines_ps[NOT_IN_FRONT]);
|
DRW_draw_pass(psl->edit_curves_lines_ps[NOT_IN_FRONT]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
DRW_view_set_active(pd->view_edit_curves);
|
DRW_view_set_active(pd->view_edit_curves);
|
||||||
|
if (pd->edit_curves.do_points) {
|
||||||
DRW_draw_pass(psl->edit_curves_points_ps[IN_FRONT]);
|
DRW_draw_pass(psl->edit_curves_points_ps[IN_FRONT]);
|
||||||
|
}
|
||||||
DRW_draw_pass(psl->edit_curves_lines_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. */
|
int flag; /** Copy of #v3d->overlay.edit_flag. */
|
||||||
} edit_mesh;
|
} edit_mesh;
|
||||||
struct {
|
struct {
|
||||||
|
bool do_points;
|
||||||
bool do_zbufclip;
|
bool do_zbufclip;
|
||||||
} edit_curves;
|
} edit_curves;
|
||||||
struct {
|
struct {
|
||||||
|
Loading…
Reference in New Issue
Block a user