GPv3: Add edit mode lines to overlay #111596
|
@ -71,25 +71,9 @@ class DATA_PT_grease_pencil_layers(DataButtonsPanel, Panel):
|
|||
col.prop(layer, "opacity", text="Opacity", slider=True)
|
||||
|
||||
|
||||
class DATA_PT_grease_pencil_display(DataButtonsPanel, Panel):
|
||||
bl_label = "Viewport Display"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
layout.use_property_split = True
|
||||
layout.use_property_decorate = False
|
||||
|
||||
ob = context.object
|
||||
grease_pencil = context.grease_pencil
|
||||
|
||||
layout.prop(grease_pencil, "edit_line_color", text="Edit Line Color")
|
||||
|
||||
|
||||
classes = (
|
||||
DATA_PT_context_grease_pencil,
|
||||
DATA_PT_grease_pencil_layers,
|
||||
DATA_PT_grease_pencil_display,
|
||||
GREASE_PENCIL_MT_grease_pencil_add_layer_extra,
|
||||
)
|
||||
|
||||
|
|
|
@ -75,8 +75,6 @@ static void grease_pencil_init_data(ID *id)
|
|||
grease_pencil->active_layer = nullptr;
|
||||
grease_pencil->flag |= GREASE_PENCIL_ANIM_CHANNEL_EXPANDED;
|
||||
|
||||
ARRAY_SET_ITEMS(grease_pencil->line_color, 0.6f, 0.6f, 0.6f, 0.5f);
|
||||
|
||||
CustomData_reset(&grease_pencil->layers_data);
|
||||
|
||||
grease_pencil->runtime = MEM_new<GreasePencilRuntime>(__func__);
|
||||
|
@ -130,8 +128,6 @@ static void grease_pencil_copy_data(Main * /*bmain*/,
|
|||
grease_pencil_dst->find_layer_by_name(grease_pencil_src->active_layer->wrap().name()));
|
||||
}
|
||||
|
||||
copy_v4_v4(grease_pencil_dst->line_color, grease_pencil_src->line_color);
|
||||
|
||||
CustomData_copy(&grease_pencil_src->layers_data,
|
||||
&grease_pencil_dst->layers_data,
|
||||
CD_MASK_ALL,
|
||||
|
|
|
@ -54,16 +54,11 @@ void OVERLAY_edit_curves_cache_init(OVERLAY_Data *vedata)
|
|||
DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
|
||||
}
|
||||
|
||||
float empty_color[4];
|
||||
zero_v4(empty_color);
|
||||
|
||||
DRW_PASS_CREATE(psl->edit_curves_lines_ps[i], (state | pd->clipping_state));
|
||||
sh = OVERLAY_shader_edit_particle_strand();
|
||||
grp = pd->edit_curves_lines_grp[i] = DRW_shgroup_create(sh, psl->edit_curves_lines_ps[i]);
|
||||
DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
|
||||
DRW_shgroup_uniform_bool_copy(grp, "useWeight", false);
|
||||
/* Set to zero so that `globalsBlock.color_wire` will be used. */
|
||||
DRW_shgroup_uniform_vec4_copy(grp, "replaceColor", empty_color);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -36,16 +36,12 @@ void OVERLAY_edit_grease_pencil_cache_init(OVERLAY_Data *vedata)
|
|||
void OVERLAY_edit_grease_pencil_cache_populate(OVERLAY_Data *vedata, Object *ob)
|
||||
{
|
||||
OVERLAY_PrivateData *pd = vedata->stl->pd;
|
||||
GreasePencil &grease_pencil = *static_cast<GreasePencil *>(ob->data);
|
||||
|
||||
DRWShadingGroup *lines_grp = pd->edit_grease_pencil_wires_grp;
|
||||
if (lines_grp) {
|
||||
DRWShadingGroup *grp = DRW_shgroup_create_sub(lines_grp);
|
||||
DRW_shgroup_uniform_vec4_copy(grp, "replaceColor", grease_pencil.line_color);
|
||||
|
||||
GPUBatch *geom_lines = DRW_cache_grease_pencil_edit_lines_get(ob, pd->cfra);
|
||||
|
||||
DRW_shgroup_call_no_cull(grp, geom_lines, ob);
|
||||
DRW_shgroup_call_no_cull(lines_grp, geom_lines, ob);
|
||||
}
|
||||
|
||||
DRWShadingGroup *points_grp = pd->edit_grease_pencil_points_grp;
|
||||
|
|
|
@ -37,16 +37,11 @@ void OVERLAY_edit_particle_cache_init(OVERLAY_Data *vedata)
|
|||
DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL;
|
||||
DRW_PASS_CREATE(psl->edit_particle_ps, state | pd->clipping_state);
|
||||
|
||||
float empty_color[4];
|
||||
zero_v4(empty_color);
|
||||
|
||||
sh = OVERLAY_shader_edit_particle_strand();
|
||||
pd->edit_particle_strand_grp = grp = DRW_shgroup_create(sh, psl->edit_particle_ps);
|
||||
DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
|
||||
DRW_shgroup_uniform_bool_copy(grp, "useWeight", pd->edit_particle.use_weight);
|
||||
DRW_shgroup_uniform_texture(grp, "weightTex", G_draw.weight_ramp);
|
||||
/* Set to zero so that `globalsBlock.color_wire` will be used. */
|
||||
DRW_shgroup_uniform_vec4_copy(grp, "replaceColor", empty_color);
|
||||
|
||||
sh = OVERLAY_shader_edit_particle_point();
|
||||
pd->edit_particle_point_grp = grp = DRW_shgroup_create(sh, psl->edit_particle_ps);
|
||||
|
|
|
@ -530,7 +530,6 @@ GPU_SHADER_CREATE_INFO(overlay_edit_particle_strand)
|
|||
.vertex_in(1, Type::FLOAT, "selection")
|
||||
.sampler(0, ImageType::FLOAT_1D, "weightTex")
|
||||
.push_constant(Type::BOOL, "useWeight")
|
||||
.push_constant(Type::VEC4, "replaceColor")
|
||||
.vertex_out(overlay_edit_smooth_color_iface)
|
||||
.fragment_out(0, Type::VEC4, "fragColor")
|
||||
.vertex_source("overlay_edit_particle_strand_vert.glsl")
|
||||
|
|
|
@ -7,13 +7,11 @@
|
|||
|
||||
#define no_active_weight 666.0
|
||||
|
||||
#define base_color (replaceColor == 0.0 ? colorWire : replaceColor)
|
||||
|
||||
vec3 weight_to_rgb(float t)
|
||||
{
|
||||
if (t == no_active_weight) {
|
||||
/* No weight. */
|
||||
return base_color.rgb;
|
||||
return colorWire.rgb;
|
||||
}
|
||||
if (t > 1.0 || t < 0.0) {
|
||||
/* Error color */
|
||||
|
@ -33,7 +31,7 @@ void main()
|
|||
finalColor = vec4(weight_to_rgb(selection), 1.0);
|
||||
}
|
||||
else {
|
||||
finalColor = mix(base_color, colorVertexSelect, selection);
|
||||
finalColor = mix(colorWire, colorVertexSelect, selection);
|
||||
}
|
||||
|
||||
view_clipping_distances(world_pos);
|
||||
|
|
|
@ -399,9 +399,6 @@ typedef struct GreasePencil {
|
|||
int drawing_array_num;
|
||||
char _pad[4];
|
||||
|
||||
/* Color for line (edit mode). */
|
||||
float line_color[4];
|
||||
|
||||
/* Root group of the layer tree. */
|
||||
GreasePencilLayerTreeGroup *root_group_ptr;
|
||||
|
||||
|
|
|
@ -292,8 +292,6 @@ static void rna_def_grease_pencil_data(BlenderRNA *brna)
|
|||
StructRNA *srna;
|
||||
PropertyRNA *prop;
|
||||
|
||||
static float default_line_color[4] = {0.6f, 0.6f, 0.6f, 0.5f};
|
||||
|
||||
srna = RNA_def_struct(brna, "GreasePencilv3", "ID");
|
||||
RNA_def_struct_sdna(srna, "GreasePencil");
|
||||
RNA_def_struct_ui_text(srna, "Grease Pencil", "Grease Pencil data-block");
|
||||
|
@ -333,15 +331,6 @@ static void rna_def_grease_pencil_data(BlenderRNA *brna)
|
|||
nullptr, /* TODO */
|
||||
nullptr);
|
||||
RNA_def_property_ui_text(prop, "Layer Groups", "Grease Pencil layer groups");
|
||||
|
||||
/* Line Color (Edit Mode) */
|
||||
prop = RNA_def_property(srna, "edit_line_color", PROP_FLOAT, PROP_COLOR_GAMMA);
|
||||
RNA_def_property_float_sdna(prop, nullptr, "line_color");
|
||||
RNA_def_property_array(prop, 4);
|
||||
RNA_def_property_range(prop, 0.0f, 1.0f);
|
||||
RNA_def_property_float_array_default(prop, default_line_color);
|
||||
RNA_def_property_ui_text(prop, "Edit Line Color", "Color for editing line");
|
||||
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
|
||||
}
|
||||
|
||||
void RNA_def_grease_pencil(BlenderRNA *brna)
|
||||
|
|
Loading…
Reference in New Issue