diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-10-05 10:10:27 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-10-05 10:10:27 +0300 |
commit | b69301d4aa1bec6de596042d48df2846723c7445 (patch) | |
tree | afab43bcc2c5118e6be9aaee1b0113c6c9a69e0f /source | |
parent | 8b05d38305c4af49848b41e307ceb3ed424f5fbc (diff) |
Context: add uv_sculpt_object
While this may be temporary, it avoids copy-pasting these
checks in Python code.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/screen/screen_context.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/source/blender/editors/screen/screen_context.c b/source/blender/editors/screen/screen_context.c index 44dfb9bb0a6..a87184120ca 100644 --- a/source/blender/editors/screen/screen_context.c +++ b/source/blender/editors/screen/screen_context.c @@ -65,6 +65,7 @@ #include "ED_armature.h" #include "ED_gpencil.h" #include "ED_anim_api.h" +#include "ED_uvedit.h" #include "WM_api.h" #include "UI_interface.h" @@ -80,7 +81,7 @@ const char *screen_context_dir[] = { "visible_pose_bones", "selected_pose_bones", "active_bone", "active_pose_bone", "active_base", "active_object", "object", "edit_object", "sculpt_object", "vertex_paint_object", "weight_paint_object", - "image_paint_object", "particle_edit_object", + "image_paint_object", "particle_edit_object", "uv_sculpt_object", "sequences", "selected_sequences", "selected_editable_sequences", /* sequencer */ "gpencil_data", "gpencil_data_owner", /* grease pencil data */ "visible_gpencil_layers", "editable_gpencil_layers", "editable_gpencil_strokes", @@ -428,6 +429,23 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult return 1; } + else if (CTX_data_equals(member, "uv_sculpt_object")) { + /* TODO(campbell): most likely we change rules for uv_sculpt. */ + if (obact && (obact->mode & OB_MODE_EDIT)) { + const ToolSettings *ts = scene->toolsettings; + if (ts->use_uv_sculpt) { + if (ED_uvedit_test(obedit)) { + WorkSpace *workspace = CTX_wm_workspace(C); + if ((workspace->tools_space_type == SPACE_IMAGE) && + (workspace->tools_mode == SI_MODE_VIEW)) + { + CTX_data_id_pointer_set(result, &obact->id); + } + } + } + } + return 1; + } else if (CTX_data_equals(member, "sequences")) { Editing *ed = BKE_sequencer_editing_get(scene, false); if (ed) { |