Context: add pose_object
authorCampbell Barton <ideasman42@gmail.com>
Mon, 11 Mar 2019 23:18:51 +0000 (10:18 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 11 Mar 2019 23:22:53 +0000 (10:22 +1100)
Needed for UI scripts to detect mixed weight paint + pose mode.

doc/python_api/sphinx_doc_gen.py
source/blender/editors/screen/screen_context.c

index 1eceaac..b78c366 100644 (file)
@@ -1028,6 +1028,7 @@ context_type_map = {
     "particle_system": ("ParticleSystem", False),
     "particle_system_editable": ("ParticleSystem", False),
     "pose_bone": ("PoseBone", False),
     "particle_system": ("ParticleSystem", False),
     "particle_system_editable": ("ParticleSystem", False),
     "pose_bone": ("PoseBone", False),
+    "pose_object": ("Object", False),
     "scene": ("Scene", False),
     "sculpt_object": ("Object", False),
     "selectable_bases": ("ObjectBase", True),
     "scene": ("Scene", False),
     "sculpt_object": ("Object", False),
     "selectable_bases": ("ObjectBase", True),
index 31b1be2..b16d7f6 100644 (file)
@@ -76,7 +76,7 @@ const char *screen_context_dir[] = {
        "active_bone", "active_pose_bone",
        "active_base", "active_object", "object", "edit_object",
        "sculpt_object", "vertex_paint_object", "weight_paint_object",
        "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", "uv_sculpt_object",
+       "image_paint_object", "particle_edit_object", "uv_sculpt_object", "pose_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",
        "sequences", "selected_sequences", "selected_editable_sequences", /* sequencer */
        "gpencil_data", "gpencil_data_owner", /* grease pencil data */
        "visible_gpencil_layers", "editable_gpencil_layers", "editable_gpencil_strokes",
@@ -477,6 +477,13 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
                }
                return 1;
        }
                }
                return 1;
        }
+       else if (CTX_data_equals(member, "pose_object")) {
+               Object *obpose = BKE_object_pose_armature_get(obact);
+               if (obpose) {
+                       CTX_data_id_pointer_set(result, &obpose->id);
+               }
+               return 1;
+       }
        else if (CTX_data_equals(member, "sequences")) {
                Editing *ed = BKE_sequencer_editing_get(scene, false);
                if (ed) {
        else if (CTX_data_equals(member, "sequences")) {
                Editing *ed = BKE_sequencer_editing_get(scene, false);
                if (ed) {