Image Space: make 'UV Edit' a separate mode
This is needed for splitting UV into its own editor, see: T54744
This commit is contained in:
parent
3c30d3bcbd
commit
16882ca535
|
@ -585,7 +585,8 @@ class IMAGE_HT_header(Header):
|
|||
sub.active = toolsettings.proportional_edit != 'DISABLED'
|
||||
sub.prop(toolsettings, "proportional_edit_falloff", icon_only=True)
|
||||
|
||||
layout.prop(sima, "pivot_point", icon_only=True)
|
||||
if show_uvedit or show_maskedit:
|
||||
layout.prop(sima, "pivot_point", icon_only=True)
|
||||
|
||||
row = layout.row()
|
||||
row.popover(
|
||||
|
|
|
@ -1810,6 +1810,8 @@ class IMAGE_PT_tools_active(ToolSelectPanelHelper, Panel):
|
|||
# for all modes
|
||||
],
|
||||
'VIEW': [
|
||||
],
|
||||
'UV': [
|
||||
_defs_image_generic.cursor,
|
||||
*_tools_select,
|
||||
None,
|
||||
|
|
|
@ -102,6 +102,21 @@ void BLO_update_defaults_startup_blend(Main *bmain, const char *app_template)
|
|||
BKE_workspace_tool_remove(workspace, workspace->tools.first);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
/* 'UV Editing' should use UV mode. */
|
||||
bScreen *screen = BLI_findstring(&bmain->screen, "Default.005", offsetof(ID, name) + 2);
|
||||
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
|
||||
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
|
||||
if (sl->spacetype == SPACE_IMAGE) {
|
||||
SpaceImage *sima = (SpaceImage *)sl;
|
||||
if (sima->mode == SI_MODE_VIEW) {
|
||||
sima->mode = SI_MODE_UV;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* For 2D animation template. */
|
||||
|
|
|
@ -437,7 +437,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
|
|||
if (ED_uvedit_test(obedit)) {
|
||||
WorkSpace *workspace = CTX_wm_workspace(C);
|
||||
if ((workspace->tools_space_type == SPACE_IMAGE) &&
|
||||
(workspace->tools_mode == SI_MODE_VIEW))
|
||||
(workspace->tools_mode == SI_MODE_UV))
|
||||
{
|
||||
CTX_data_id_pointer_set(result, &obact->id);
|
||||
}
|
||||
|
|
|
@ -361,8 +361,14 @@ bool ED_space_image_show_paint(SpaceImage *sima)
|
|||
|
||||
bool ED_space_image_show_uvedit(SpaceImage *sima, Object *obedit)
|
||||
{
|
||||
if (sima && (ED_space_image_show_render(sima) || ED_space_image_show_paint(sima)))
|
||||
return false;
|
||||
if (sima) {
|
||||
if (ED_space_image_show_render(sima)) {
|
||||
return false;
|
||||
}
|
||||
if (sima->mode != SI_MODE_UV) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (obedit && obedit->type == OB_MESH) {
|
||||
struct BMEditMesh *em = BKE_editmesh_from_object(obedit);
|
||||
|
|
|
@ -210,6 +210,10 @@ static void do_uvedit_vertex(bContext *C, void *UNUSED(arg), int event)
|
|||
|
||||
static bool image_panel_uv_poll(const bContext *C, PanelType *UNUSED(pt))
|
||||
{
|
||||
SpaceImage *sima = CTX_wm_space_image(C);
|
||||
if (sima->mode != SI_MODE_UV) {
|
||||
return false;
|
||||
}
|
||||
Object *obedit = CTX_data_edit_object(C);
|
||||
return ED_uvedit_test(obedit);
|
||||
}
|
||||
|
|
|
@ -943,7 +943,8 @@ typedef enum eSpaceImage_UVDT_Stretch {
|
|||
typedef enum eSpaceImage_Mode {
|
||||
SI_MODE_VIEW = 0,
|
||||
SI_MODE_PAINT = 1,
|
||||
SI_MODE_MASK = 2 /* note: mesh edit mode overrides mask */
|
||||
SI_MODE_MASK = 2,
|
||||
SI_MODE_UV = 3,
|
||||
} eSpaceImage_Mode;
|
||||
|
||||
/* SpaceImage.sticky
|
||||
|
|
|
@ -168,7 +168,8 @@ const EnumPropertyItem rna_enum_space_action_mode_items[] = {
|
|||
#undef SACT_ITEM_CACHEFILE
|
||||
|
||||
const EnumPropertyItem rna_enum_space_image_mode_items[] = {
|
||||
{SI_MODE_VIEW, "VIEW", ICON_FILE_IMAGE, "View", "View the image and UV edit in mesh editmode"},
|
||||
{SI_MODE_VIEW, "VIEW", ICON_FILE_IMAGE, "View", "View the image"},
|
||||
{SI_MODE_UV, "UV", ICON_GROUP_UVS, "UV Edit", "UV edit in mesh editmode"},
|
||||
{SI_MODE_PAINT, "PAINT", ICON_TPAINT_HLT, "Paint", "2D image painting mode"},
|
||||
{SI_MODE_MASK, "MASK", ICON_MOD_MASK, "Mask", "Mask editing"},
|
||||
{0, NULL, 0, NULL, NULL}
|
||||
|
|
|
@ -103,8 +103,9 @@ static void rna_WorkspaceTool_refresh_from_context(
|
|||
}
|
||||
}
|
||||
else if ((tref->space_type == SPACE_IMAGE) &&
|
||||
(tref->mode == SI_MODE_VIEW) &&
|
||||
(ob->mode & OB_MODE_EDIT))
|
||||
(tref->mode == SI_MODE_UV) &&
|
||||
(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);
|
||||
|
|
|
@ -214,7 +214,7 @@ static void toolsystem_ref_link(bContext *C, WorkSpace *workspace, bToolRef *tre
|
|||
}
|
||||
}
|
||||
if ((tref->space_type == SPACE_IMAGE) &&
|
||||
(tref->mode == SI_MODE_VIEW))
|
||||
(tref->mode == SI_MODE_UV))
|
||||
{
|
||||
/* Note that switching uv-sculpt boolean is a hack at the moment.
|
||||
* It would be best to make this either an operator or a higher level mode (like mesh-object sculpt mode). */
|
||||
|
@ -259,7 +259,7 @@ static void toolsystem_ref_link(bContext *C, WorkSpace *workspace, bToolRef *tre
|
|||
else {
|
||||
/* XXX, this part is weak, disables uv_sculpt when non uv-tool set. */
|
||||
if ((tref->space_type == SPACE_IMAGE) &&
|
||||
(tref->mode == SI_MODE_VIEW))
|
||||
(tref->mode == SI_MODE_UV))
|
||||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
wmWindowManager *wm = bmain->wm.first;
|
||||
|
|
Loading…
Reference in New Issue