Update Armature actuator UI to use pointer list widgets, rather than text entry fields

This commit is contained in:
Matt Ebb 2010-05-10 04:49:09 +00:00
parent bd4fe1b71d
commit 1e0caad5da
2 changed files with 33 additions and 17 deletions

@ -3609,34 +3609,50 @@ static void draw_actuator_action(uiLayout *layout, PointerRNA *ptr)
static void draw_actuator_armature(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); uiItemR(layout, ptr, "mode", 0, NULL, 0);
switch (RNA_enum_get(ptr, "mode")) switch (RNA_enum_get(ptr, "mode"))
{ {
case ACT_ARM_RUN: case ACT_ARM_RUN:
break; break;
case ACT_ARM_ENABLE: 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: case ACT_ARM_DISABLE:
row = uiLayoutRow(layout, 1); if (&pose_ptr.data) {
uiItemR(row, ptr, "bone", 0, NULL, 0); uiItemPointerR(layout, ptr, "bone", &pose_ptr, "bones", NULL, ICON_BONE_DATA);
uiItemR(row, ptr, "constraint", 0, NULL, 0);
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; break;
case ACT_ARM_SETTARGET: case ACT_ARM_SETTARGET:
row = uiLayoutRow(layout, 1); if (&pose_ptr.data) {
uiItemR(row, ptr, "bone", 0, NULL, 0); uiItemPointerR(layout, ptr, "bone", &pose_ptr, "bones", NULL, ICON_BONE_DATA);
uiItemR(row, ptr, "constraint", 0, NULL, 0);
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, "target", 0, NULL, 0);
uiItemR(layout, ptr, "secondary_target", 0, NULL, 0); uiItemR(layout, ptr, "secondary_target", 0, NULL, 0);
break; break;
case ACT_ARM_SETWEIGHT: case ACT_ARM_SETWEIGHT:
row = uiLayoutRow(layout, 1); if (&pose_ptr.data) {
uiItemR(row, ptr, "bone", 0, NULL, 0); uiItemPointerR(layout, ptr, "bone", &pose_ptr, "bones", NULL, ICON_BONE_DATA);
uiItemR(row, ptr, "constraint", 0, NULL, 0);
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); uiItemR(layout, ptr, "weight", 0, NULL, 0);
break; break;

@ -1755,11 +1755,11 @@ static void rna_def_armature_actuator(BlenderRNA *brna)
PropertyRNA* prop; PropertyRNA* prop;
static EnumPropertyItem prop_type_items[] ={ 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_ENABLE, "ENABLE", 0, "Enable", ""},
{ACT_ARM_DISABLE, "DISABLE", 0, "Disable", ""}, {ACT_ARM_DISABLE, "DISABLE", 0, "Disable", ""},
{ACT_ARM_SETTARGET, "SETTARGET", 0, "Set target", ""}, {ACT_ARM_SETTARGET, "SETTARGET", 0, "Set Target", ""},
{ACT_ARM_SETWEIGHT, "SETWEIGHT", 0, "Set weight", ""}, {ACT_ARM_SETWEIGHT, "SETWEIGHT", 0, "Set Weight", ""},
{0, NULL, 0, NULL, NULL}}; {0, NULL, 0, NULL, NULL}};
srna= RNA_def_struct(brna, "ArmatureActuator", "Actuator"); srna= RNA_def_struct(brna, "ArmatureActuator", "Actuator");