From 1e0caad5da0400f02c772e25cdd8446f932276a0 Mon Sep 17 00:00:00 2001 From: Matt Ebb Date: Mon, 10 May 2010 04:49:09 +0000 Subject: [PATCH] Update Armature actuator UI to use pointer list widgets, rather than text entry fields --- .../editors/space_logic/logic_window.c | 44 +++++++++++++------ source/blender/makesrna/intern/rna_actuator.c | 6 +-- 2 files changed, 33 insertions(+), 17 deletions(-) diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c index 702d74934fd..de75f10c9c7 100644 --- a/source/blender/editors/space_logic/logic_window.c +++ b/source/blender/editors/space_logic/logic_window.c @@ -3609,34 +3609,50 @@ static void draw_actuator_action(uiLayout *layout, PointerRNA *ptr) static void draw_actuator_armature(uiLayout *layout, PointerRNA *ptr) { - uiLayout *row; + bActuator *act = (bActuator*)ptr->data; + bArmatureActuator *aa = (bArmatureActuator *) act->data; + Object *ob = (Object *)ptr->id.data; + PointerRNA pose_ptr, pchan_ptr; + PropertyRNA *bones_prop; + + if (ob->pose) { + RNA_pointer_create((ID *)ob, &RNA_Pose, ob->pose, &pose_ptr); + bones_prop = RNA_struct_find_property(&pose_ptr, "bones"); + } + uiItemR(layout, ptr, "mode", 0, NULL, 0); + switch (RNA_enum_get(ptr, "mode")) { case ACT_ARM_RUN: break; case ACT_ARM_ENABLE: - row = uiLayoutRow(layout, 1); - uiItemR(row, ptr, "bone", 0, NULL, 0); - uiItemR(row, ptr, "constraint", 0, NULL, 0); - break; case ACT_ARM_DISABLE: - row = uiLayoutRow(layout, 1); - uiItemR(row, ptr, "bone", 0, NULL, 0); - uiItemR(row, ptr, "constraint", 0, NULL, 0); + if (&pose_ptr.data) { + uiItemPointerR(layout, ptr, "bone", &pose_ptr, "bones", NULL, ICON_BONE_DATA); + + if (RNA_property_collection_lookup_string(&pose_ptr, bones_prop, aa->posechannel, &pchan_ptr)) + uiItemPointerR(layout, ptr, "constraint", &pchan_ptr, "constraints", NULL, ICON_CONSTRAINT_BONE); + } break; case ACT_ARM_SETTARGET: - row = uiLayoutRow(layout, 1); - uiItemR(row, ptr, "bone", 0, NULL, 0); - uiItemR(row, ptr, "constraint", 0, NULL, 0); + if (&pose_ptr.data) { + uiItemPointerR(layout, ptr, "bone", &pose_ptr, "bones", NULL, ICON_BONE_DATA); + + if (RNA_property_collection_lookup_string(&pose_ptr, bones_prop, aa->posechannel, &pchan_ptr)) + uiItemPointerR(layout, ptr, "constraint", &pchan_ptr, "constraints", NULL, ICON_CONSTRAINT_BONE); + } uiItemR(layout, ptr, "target", 0, NULL, 0); uiItemR(layout, ptr, "secondary_target", 0, NULL, 0); break; case ACT_ARM_SETWEIGHT: - row = uiLayoutRow(layout, 1); - uiItemR(row, ptr, "bone", 0, NULL, 0); - uiItemR(row, ptr, "constraint", 0, NULL, 0); + if (&pose_ptr.data) { + uiItemPointerR(layout, ptr, "bone", &pose_ptr, "bones", NULL, ICON_BONE_DATA); + + if (RNA_property_collection_lookup_string(&pose_ptr, bones_prop, aa->posechannel, &pchan_ptr)) + uiItemPointerR(layout, ptr, "constraint", &pchan_ptr, "constraints", NULL, ICON_CONSTRAINT_BONE); + } uiItemR(layout, ptr, "weight", 0, NULL, 0); break; diff --git a/source/blender/makesrna/intern/rna_actuator.c b/source/blender/makesrna/intern/rna_actuator.c index cb99f4dbbe7..e8429960e82 100644 --- a/source/blender/makesrna/intern/rna_actuator.c +++ b/source/blender/makesrna/intern/rna_actuator.c @@ -1755,11 +1755,11 @@ static void rna_def_armature_actuator(BlenderRNA *brna) PropertyRNA* prop; static EnumPropertyItem prop_type_items[] ={ - {ACT_ARM_RUN, "RUN", 0, "Run armature", ""}, + {ACT_ARM_RUN, "RUN", 0, "Run Armature", ""}, {ACT_ARM_ENABLE, "ENABLE", 0, "Enable", ""}, {ACT_ARM_DISABLE, "DISABLE", 0, "Disable", ""}, - {ACT_ARM_SETTARGET, "SETTARGET", 0, "Set target", ""}, - {ACT_ARM_SETWEIGHT, "SETWEIGHT", 0, "Set weight", ""}, + {ACT_ARM_SETTARGET, "SETTARGET", 0, "Set Target", ""}, + {ACT_ARM_SETWEIGHT, "SETWEIGHT", 0, "Set Weight", ""}, {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "ArmatureActuator", "Actuator");