Revision: 34697
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=34697
Author:   dfelinto
Date:     2011-02-07 18:24:15 +0000 (Mon, 07 Feb 2011)
Log Message:
-----------
Logic UI: Armature Actuator + general Captalizing 1st letter of UI text
- Armature Actuator now only shows the "Secondary Target" option when the Bone 
Constraint supports it (IK only now).
-- that may be overkill I don't know. It shouldn't slow down the UI 
considerably, so it should be fine. Easy to revert if needed though.

- renaming things such as "Start frame" to "Start Frame"

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_logic/logic_window.c
    trunk/blender/source/blender/makesrna/intern/rna_actuator.c
    trunk/blender/source/blender/makesrna/intern/rna_sensor.c

Modified: trunk/blender/source/blender/editors/space_logic/logic_window.c
===================================================================
--- trunk/blender/source/blender/editors/space_logic/logic_window.c     
2011-02-07 18:09:27 UTC (rev 34696)
+++ trunk/blender/source/blender/editors/space_logic/logic_window.c     
2011-02-07 18:24:15 UTC (rev 34697)
@@ -1079,6 +1079,30 @@
                         "Invert the level (output) of this sensor");
 }
 
+static void get_armature_bone_constraint(Object *ob, char *posechannel, char 
*constraint_name, bConstraint **constraint)
+{
+       /* check that bone exist in the active object */
+       if (ob->type == OB_ARMATURE && ob->pose) {
+               bPoseChannel *pchan;
+               bPose *pose = ob->pose;
+               for (pchan=pose->chanbase.first; pchan; pchan=pchan->next) {
+                       if (!strcmp(pchan->name, posechannel)) {
+                               /* found it, now look for constraint channel */
+                               bConstraint *con;
+                               for (con=pchan->constraints.first; con; 
con=con->next) {
+                                       if (!strcmp(con->name, 
constraint_name)) {
+                                               /* found it, all ok */
+                                               *constraint = con;
+                                               return;                         
                
+                                       }
+                               }
+                               /* didn't find constraint, make empty */
+                               return;
+                       }
+               }
+       }
+       /* didn't find any */
+}
 static void check_armature_bone_constraint(Object *ob, char *posechannel, char 
*constraint)
 {
        /* check that bone exist in the active object */
@@ -3692,6 +3716,7 @@
        bActuator *act = (bActuator*)ptr->data;
        bArmatureActuator *aa = (bArmatureActuator *) act->data;
        Object *ob = (Object *)ptr->id.data;
+       bConstraint *constraint = NULL;
        PointerRNA pose_ptr, pchan_ptr;
        PropertyRNA *bones_prop = NULL;
 
@@ -3729,7 +3754,12 @@
                        }
 
                        uiItemR(layout, ptr, "target", 0, NULL, ICON_NULL);
-                       uiItemR(layout, ptr, "secondary_target", 0, NULL, 
ICON_NULL);
+
+                       /* show second target only if the constraint supports 
it */
+                       get_armature_bone_constraint(ob, aa->posechannel, 
aa->constraint, &constraint);
+                       if (constraint && constraint->type == 
CONSTRAINT_TYPE_KINEMATIC) {
+                               uiItemR(layout, ptr, "secondary_target", 0, 
NULL, ICON_NULL);
+                       }
                        break;
                case ACT_ARM_SETWEIGHT:
                        if (ob->pose) {

Modified: trunk/blender/source/blender/makesrna/intern/rna_actuator.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_actuator.c 2011-02-07 
18:09:27 UTC (rev 34696)
+++ trunk/blender/source/blender/makesrna/intern/rna_actuator.c 2011-02-07 
18:24:15 UTC (rev 34697)
@@ -565,7 +565,7 @@
        prop= RNA_def_property(srna, "play_mode", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_sdna(prop, NULL, "type");
        RNA_def_property_enum_items(prop, prop_type_items);
-       RNA_def_property_ui_text(prop, "Action type", "Action playback type");
+       RNA_def_property_ui_text(prop, "Action Type", "Action playback type");
        RNA_def_property_update(prop, NC_LOGIC, NULL);
 
        prop= RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE);
@@ -590,13 +590,13 @@
        prop= RNA_def_property(srna, "frame_start", PROP_INT, PROP_NONE);
        RNA_def_property_int_sdna(prop, NULL, "sta");
        RNA_def_property_range(prop, 0, MAXFRAME);
-       RNA_def_property_ui_text(prop, "Start frame", "");
+       RNA_def_property_ui_text(prop, "Start Frame", "");
        RNA_def_property_update(prop, NC_LOGIC, NULL);
 
        prop= RNA_def_property(srna, "frame_end", PROP_INT, PROP_NONE);
        RNA_def_property_int_sdna(prop, NULL, "end");
        RNA_def_property_range(prop, 0, MAXFRAME);
-       RNA_def_property_ui_text(prop, "End frame", "");
+       RNA_def_property_ui_text(prop, "End Frame", "");
        RNA_def_property_update(prop, NC_LOGIC, NULL);
 
        prop= RNA_def_property(srna, "frame_blend_in", PROP_INT, PROP_NONE);
@@ -1191,7 +1191,7 @@
        prop= RNA_def_property(srna, "damping_rotation", PROP_INT, PROP_NONE);
        RNA_def_property_int_sdna(prop, NULL, "rotdamp");
        RNA_def_property_ui_range(prop, 0, 100, 1, 1);
-       RNA_def_property_ui_text(prop, "rotDamp", "Use a different damping for 
orientation");
+       RNA_def_property_ui_text(prop, "RotDamp", "Use a different damping for 
orientation");
        RNA_def_property_update(prop, NC_LOGIC, NULL);
 
        /* ACT_CONST_TYPE_ORI */
@@ -1399,8 +1399,8 @@
                {ACT_SCENE_RESTART, "RESTART", 0, "Restart", ""},
                {ACT_SCENE_SET, "SET", 0, "Set Scene", ""},
                {ACT_SCENE_CAMERA, "CAMERA", 0, "Set Camera", ""},
-               {ACT_SCENE_ADD_FRONT, "ADDFRONT", 0, "Add OverlayScene", ""},
-               {ACT_SCENE_ADD_BACK, "ADDBACK", 0, "Add BackgroundScene", ""},
+               {ACT_SCENE_ADD_FRONT, "ADDFRONT", 0, "Add Overlay Scene", ""},
+               {ACT_SCENE_ADD_BACK, "ADDBACK", 0, "Add Background Scene", ""},
                {ACT_SCENE_REMOVE, "REMOVE", 0, "Remove Scene", ""},
                {ACT_SCENE_SUSPEND, "SUSPEND", 0, "Suspend Scene", ""},
                {ACT_SCENE_RESUME, "RESUME", 0, "Resume Scene", ""},
@@ -1490,7 +1490,7 @@
        /* ACT_RANDOM_BOOL_CONST */
        prop= RNA_def_property(srna, "use_always_true", PROP_BOOLEAN, 
PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "int_arg_1", 1);
-       RNA_def_property_ui_text(prop, "Always true", "Always false or always 
true");
+       RNA_def_property_ui_text(prop, "Always True", "Always false or always 
true");
        RNA_def_property_update(prop, NC_LOGIC, NULL);
 
        /* ACT_RANDOM_BOOL_UNIFORM */
@@ -1567,7 +1567,7 @@
        prop= RNA_def_property(srna, "half_life_time", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "float_arg_1");
        RNA_def_property_range(prop, -1000.0, 1000.0);
-       RNA_def_property_ui_text(prop, "Half-life time", "Negative exponential 
dropoff");
+       RNA_def_property_ui_text(prop, "Half-Life Time", "Negative exponential 
dropoff");
        RNA_def_property_update(prop, NC_LOGIC, NULL);
 }
 
@@ -1608,7 +1608,7 @@
        /* ACT_MESG_PROP */
        prop= RNA_def_property(srna, "body_property", PROP_STRING, PROP_NONE);
        RNA_def_property_string_sdna(prop, NULL, "body");
-       RNA_def_property_ui_text(prop, "Propname", "The message body will be 
set by the Property Value");
+       RNA_def_property_ui_text(prop, "Prop Name", "The message body will be 
set by the Property Value");
        RNA_def_property_update(prop, NC_LOGIC, NULL);
 }
 
@@ -1618,14 +1618,14 @@
        PropertyRNA *prop;
 
        static EnumPropertyItem prop_type_items[] ={
-//             {ACT_GAME_LOAD, "LOAD", 0, "Load game", ""},
-//             {ACT_GAME_START, "START", 0, "Start loaded game", ""},  
+//             {ACT_GAME_LOAD, "LOAD", 0, "Load Game", ""},
+//             {ACT_GAME_START, "START", 0, "Start Loaded Game", ""},  
 //             keeping the load/start hacky for compatibility with 2.49
 //             ideally we could use ACT_GAME_START again and do a do_version()
 
-               {ACT_GAME_LOAD, "START", 0, "Start new game", ""},
-               {ACT_GAME_RESTART, "RESTART", 0, "Restart this game", ""},
-               {ACT_GAME_QUIT, "QUIT", 0, "Quit this game", ""},
+               {ACT_GAME_LOAD, "START", 0, "Start New Game", ""},
+               {ACT_GAME_RESTART, "RESTART", 0, "Restart This Game", ""},
+               {ACT_GAME_QUIT, "QUIT", 0, "Quit This Game", ""},
                {ACT_GAME_SAVECFG, "SAVECFG", 0, "Save bge.logic.globalDict", 
""},
                {ACT_GAME_LOADCFG, "LOADCFG", 0, "Load bge.logic.globalDict", 
""},
                {0, NULL, 0, NULL, NULL}};
@@ -1697,13 +1697,13 @@
                {0, NULL, 0, NULL, NULL}};
 
        srna= RNA_def_struct(brna, "Filter2DActuator", "Actuator");
-       RNA_def_struct_ui_text(srna, "2D Filter Actuator", "Actuator to ..");
+       RNA_def_struct_ui_text(srna, "Filter 2D Actuator", "Actuator to apply 
screen graphic effects");
        RNA_def_struct_sdna_from(srna, "bTwoDFilterActuator", "data");
 
        prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_sdna(prop, NULL, "type");
        RNA_def_property_enum_items(prop, prop_type_items);
-       RNA_def_property_ui_text(prop, "2D Filter Type", "");
+       RNA_def_property_ui_text(prop, "Filter 2D Type", "");
        RNA_def_property_update(prop, NC_LOGIC, NULL);
 
        prop= RNA_def_property(srna, "glsl_shader", PROP_POINTER, PROP_NONE);
@@ -1794,7 +1794,7 @@
        prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_sdna(prop, NULL, "type");
        RNA_def_property_enum_items(prop, prop_type_items);
-       RNA_def_property_ui_text(prop, "Action type", "Action playback type");
+       RNA_def_property_ui_text(prop, "Action Type", "Action playback type");
        RNA_def_property_update(prop, NC_LOGIC, NULL);
 
        prop= RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE);
@@ -1819,13 +1819,13 @@
        prop= RNA_def_property(srna, "frame_start", PROP_INT, PROP_NONE);
        RNA_def_property_int_sdna(prop, NULL, "sta");
        RNA_def_property_range(prop, 0, MAXFRAME);
-       RNA_def_property_ui_text(prop, "Start frame", "");
+       RNA_def_property_ui_text(prop, "Start Frame", "");
        RNA_def_property_update(prop, NC_LOGIC, NULL);
 
        prop= RNA_def_property(srna, "frame_end", PROP_INT, PROP_NONE);
        RNA_def_property_int_sdna(prop, NULL, "end");
        RNA_def_property_range(prop, 0, MAXFRAME);
-       RNA_def_property_ui_text(prop, "End frame", "");
+       RNA_def_property_ui_text(prop, "End Frame", "");
        RNA_def_property_update(prop, NC_LOGIC, NULL);
 
        prop= RNA_def_property(srna, "frame_blend_in", PROP_INT, PROP_NONE);
@@ -1925,7 +1925,7 @@
        RNA_def_property_pointer_sdna(prop, NULL, "subtarget");
        RNA_def_property_struct_type(prop, "Object");
        RNA_def_property_flag(prop, PROP_EDITABLE);
-       RNA_def_property_ui_text(prop, "Secondary Target", "Set weight of this 
constraint");
+       RNA_def_property_ui_text(prop, "Secondary Target", "Set this object as 
the secondary target of the constraint (only IK polar target at the moment)");
        RNA_def_property_update(prop, NC_LOGIC, NULL);
 
        prop= RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE);

Modified: trunk/blender/source/blender/makesrna/intern/rna_sensor.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_sensor.c   2011-02-07 
18:09:27 UTC (rev 34696)
+++ trunk/blender/source/blender/makesrna/intern/rna_sensor.c   2011-02-07 
18:24:15 UTC (rev 34697)
@@ -507,12 +507,12 @@
 
        prop= RNA_def_property(srna, "bone", PROP_STRING, PROP_NONE);
        RNA_def_property_string_sdna(prop, NULL, "posechannel");
-       RNA_def_property_ui_text(prop, "Bone name", "Identify the bone to check 
value from");
+       RNA_def_property_ui_text(prop, "Bone Name", "Identify the bone to check 
value from");
        RNA_def_property_update(prop, NC_LOGIC, "rna_Sensor_Armature_update");
 
        prop= RNA_def_property(srna, "constraint", PROP_STRING, PROP_NONE);
        RNA_def_property_string_sdna(prop, NULL, "constraint");
-       RNA_def_property_ui_text(prop, "Constraint name", "Identify the bone 
constraint to check value from");
+       RNA_def_property_ui_text(prop, "Constraint Name", "Identify the bone 
constraint to check value from");

@@ Diff output truncated at 10240 characters. @@
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to