Tool System: initial support for UV-sculpt

This currently conflicts with the UV-sculpt toggle being manually set,
ideally this would work more like other paint modes in Blender.
This commit is contained in:
2018-10-05 13:07:01 +10:00
parent c15439bcdc
commit 143ece7199
3 changed files with 94 additions and 1 deletions

View File

@@ -90,7 +90,10 @@ static void rna_WorkspaceTool_refresh_from_context(
if (ob == NULL) {
/* pass */
}
else if (ob->mode & OB_MODE_PARTICLE_EDIT) {
else if ((tref->space_type == SPACE_VIEW3D) &&
(tref->mode == CTX_MODE_PARTICLE) &&
(ob->mode & OB_MODE_PARTICLE_EDIT))
{
const EnumPropertyItem *items = rna_enum_particle_edit_hair_brush_items;
const int i = RNA_enum_from_value(items, ts->particle.brushtype);
const EnumPropertyItem *item = &items[i];
@@ -99,6 +102,18 @@ static void rna_WorkspaceTool_refresh_from_context(
STRNCPY(tref->idname, item->name);
}
}
else if ((tref->space_type == SPACE_IMAGE) &&
(tref->mode == SI_MODE_VIEW) &&
(ob->mode & OB_MODE_EDIT))
{
const EnumPropertyItem *items = rna_enum_uv_sculpt_tool_items;
const int i = RNA_enum_from_value(items, ts->uv_sculpt_tool);
const EnumPropertyItem *item = &items[i];
if (!STREQ(tref_rt->data_block, item->identifier)) {
STRNCPY(tref_rt->data_block, item->identifier);
STRNCPY(tref->idname, item->name);
}
}
else {
Paint *paint = BKE_paint_get_active(scene, view_layer);
if (paint) {