[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [28626] trunk/blender/source/blender: Logic UI: constraint actuator+rna 100% (finally !!!) + other fixes/ improvements:
Dalai Felinto
dfelinto at gmail.com
Thu May 6 21:12:09 CEST 2010
Revision: 28626
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=28626
Author: dfelinto
Date: 2010-05-06 21:12:08 +0200 (Thu, 06 May 2010)
Log Message:
-----------
Logic UI: constraint actuator+rna 100% (finally !!!) + other fixes/improvements:
- s/c/a type enum update function replaced by set function
- rna_Sensor_type_itemf and rna_Actuators_type_itemf implemented (but not working ... it was working yesterday before I updated the set func, so need further investigation). Matt, if you have any clue on that ...
Roadmap:
i) I definitively gotta unify the maxloc, minloc rna properties.
the way it's right now (based on 2.49 makes the layout code really clunky
ii) - actuator missing - State Actuator (I'll probably need help on that).
iii) - sensor missing - collision and ray (they are partly implemented, but the enums are a mess there).
iv) - get/set funcs missing (not many) and default values (not many)
v) - have more lookup functions for properties and material (I'll definitively need help on that).
Eventually will fix (iii, iv and v) changing bge and dna code and doing a subversion/do_version.
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_controller.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 2010-05-06 18:25:56 UTC (rev 28625)
+++ trunk/blender/source/blender/editors/space_logic/logic_window.c 2010-05-06 19:12:08 UTC (rev 28626)
@@ -3213,10 +3213,14 @@
static void draw_sensor_armature(uiLayout *layout, PointerRNA *ptr)
{
- uiItemR(layout, ptr, "armature_type", 0, NULL, 0);
- uiItemR(layout, ptr, "channel_name", 0, NULL, 0);
- uiItemR(layout, ptr, "constraint_name", 0, NULL, 0);
- uiItemR(layout, ptr, "value", 0, NULL, 0);
+ uiLayout *row;
+ row = uiLayoutRow(layout, 1);
+ uiItemR(row, ptr, "channel_name", 0, NULL, 0);
+ uiItemR(row, ptr, "constraint_name", 0, NULL, 0);
+
+ row = uiLayoutRow(layout, 1);
+ uiItemR(row, ptr, "test_type", 0, NULL, 0);
+ uiItemR(row, ptr, "value", 0, NULL, 0);
}
static void draw_sensor_collision(uiLayout *layout, PointerRNA *ptr)
@@ -3688,27 +3692,94 @@
break;
}
uiItemR(layout, ptr, "damping", UI_ITEM_R_SLIDER , NULL, 0);
+
split = uiLayoutSplit(layout, 0.15, 0);
uiItemR(split, ptr, "detect_material", UI_ITEM_R_TOGGLE, NULL, 0);
-
if (RNA_boolean_get(ptr, "detect_material"))
uiItemR(split, ptr, "material", 0, NULL, 0);
else
uiItemR(split, ptr, "property", 0, NULL, 0);
- uiItemR(layout, ptr, "damping_rotation", UI_ITEM_R_SLIDER, NULL, 0);
+ split = uiLayoutSplit(layout, 0.15, 0);
+ uiItemR(split, ptr, "persistent", UI_ITEM_R_TOGGLE, NULL, 0);
+
+ row = uiLayoutRow(split, 1);
+ uiItemR(row, ptr, "time", 0, NULL, 0);
+ uiItemR(row, ptr, "damping_rotation", UI_ITEM_R_SLIDER, NULL, 0);
break;
case ACT_CONST_TYPE_ORI:
- uiItemL(layout, "to be done", 0);
+ uiItemR(layout, ptr, "direction_axis", 0, NULL, 0);
+
+ row=uiLayoutRow(layout, 1);
+ uiItemR(row, ptr, "damping", UI_ITEM_R_SLIDER , NULL, 0);
+ uiItemR(row, ptr, "time", 0, NULL, 0);
+
+ row=uiLayoutRow(layout, 0);
+ uiItemR(row, ptr, "max_rotation", 0, NULL, 0);
+
+ row=uiLayoutRow(layout, 1);
+ uiItemR(row, ptr, "min_angle", 0, NULL, 0);
+ uiItemR(row, ptr, "max_angle", 0, NULL, 0);
break;
case ACT_CONST_TYPE_FH:
- uiItemL(layout, "to be done", 0);
+ split=uiLayoutSplit(layout, 0.75, 0);
+ row= uiLayoutRow(split, 0);
+ uiItemR(row, ptr, "fh_damping", UI_ITEM_R_SLIDER , NULL, 0);
+ switch(RNA_enum_get(ptr, "direction_axis")){
+ case ACT_CONST_DIRPX:
+ case ACT_CONST_DIRNX:
+ uiItemR(row, ptr, "fh_height_x", 0, NULL, 0);
+ uiItemR(split, ptr, "fh_paralel_axis", UI_ITEM_R_TOGGLE , NULL, 0);
+
+ row = uiLayoutRow(layout, 0);
+ uiItemR(row, ptr, "direction_axis", 0, NULL, 0);
+ split = uiLayoutSplit(row, 0.9, 0);
+ uiItemR(split, ptr, "spring_x", 0, NULL, 0);
+ uiItemR(split, ptr, "fh_normal", UI_ITEM_R_TOGGLE , NULL, 0);
+ break;
+
+ case ACT_CONST_DIRPY:
+ case ACT_CONST_DIRNY:
+ uiItemR(row, ptr, "fh_height_y", 0, NULL, 0);
+ uiItemR(split, ptr, "fh_paralel_axis", UI_ITEM_R_TOGGLE , NULL, 0);
+
+ row = uiLayoutRow(layout, 0);
+ uiItemR(row, ptr, "direction_axis", 0, NULL, 0);
+ split = uiLayoutSplit(row, 0.9, 0);
+ uiItemR(split, ptr, "spring_y", 0, NULL, 0);
+ uiItemR(split, ptr, "fh_normal", UI_ITEM_R_TOGGLE , NULL, 0);
+
+ default: //ACT_CONST_DIRPZ|ACT_CONST_DIRPZ|ACT_CONST_NONE
+ uiItemR(row, ptr, "fh_height_z", 0, NULL, 0);
+ uiItemR(split, ptr, "fh_paralel_axis", UI_ITEM_R_TOGGLE , NULL, 0);
+
+ row = uiLayoutRow(layout, 0);
+ uiItemR(row, ptr, "direction_axis", 0, NULL, 0);
+ split = uiLayoutSplit(row, 0.9, 0);
+ uiItemR(split, ptr, "spring_z", 0, NULL, 0);
+ uiItemR(split, ptr, "fh_normal", UI_ITEM_R_TOGGLE , NULL, 0);
+ break;
+ }
+
+ split = uiLayoutSplit(layout, 0.15, 0);
+ uiItemR(split, ptr, "detect_material", UI_ITEM_R_TOGGLE, NULL, 0);
+ if (RNA_boolean_get(ptr, "detect_material"))
+ uiItemR(split, ptr, "material", 0, NULL, 0);
+ else
+ uiItemR(split, ptr, "property", 0, NULL, 0);
+
+ split = uiLayoutSplit(layout, 0.15, 0);
+ uiItemR(split, ptr, "persistent", UI_ITEM_R_TOGGLE, NULL, 0);
+
+ row = uiLayoutRow(split, 0);
+ uiItemR(row, ptr, "time", 0, NULL, 0);
+ uiItemR(row, ptr, "damping_rotation", UI_ITEM_R_SLIDER, NULL, 0);
break;
}
-
- //XXXACTUATOR STILL HAVE TO DO THE RNA
+ //XXXACTUATOR to do: to replace all maxloc and minloc by a single one with get/set funcs
+ //i.e. remove the switch direction, mode and axis_direction
}
static void draw_actuator_edit_object(uiLayout *layout, PointerRNA *ptr)
Modified: trunk/blender/source/blender/makesrna/intern/rna_actuator.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_actuator.c 2010-05-06 18:25:56 UTC (rev 28625)
+++ trunk/blender/source/blender/makesrna/intern/rna_actuator.c 2010-05-06 19:12:08 UTC (rev 28626)
@@ -111,24 +111,15 @@
return &RNA_Actuator;
}
}
-//
-//static StructRNA* rna_ActionActuator_refine(struct PointerRNA *ptr)
-//{
-// bActuator *actuator= (bActuator*)ptr->data;
-//
-// switch(actuator->type) {
-// case ACT_ACTION:
-// return &RNA_ActionActuator;
-// case ACT_SHAPEACTION:
-// return &RNA_ShapeActionActuator;
-// }
-//}
-static void rna_Actuator_type_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Actuator_type_set(struct PointerRNA *ptr, int value)
{
bActuator *act= (bActuator *)ptr->data;
-
- init_actuator(act);
+ if (value != act->type)
+ {
+ act->type = value;
+ init_actuator(act);
+ }
}
static void rna_ObjectActuator_integralcoefficient_set(struct PointerRNA *ptr, float value)
@@ -186,7 +177,6 @@
RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_OBJECT);
RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_PARENT);
RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_PROPERTY);
-
RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_RANDOM);
RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_SCENE);
RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_SOUND);
@@ -216,17 +206,14 @@
prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Actuator_type_itemf");
RNA_def_property_enum_items(prop, actuator_type_items);
+ RNA_def_property_enum_funcs(prop, NULL, "rna_Actuator_type_set", "rna_Actuator_type_itemf");
RNA_def_property_ui_text(prop, "Type", "");
- RNA_def_property_update(prop, 0, "rna_Actuator_type_update");
-
prop= RNA_def_property(srna, "expanded", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_SHOW);
RNA_def_property_ui_text(prop, "Expanded", "Set actuator expanded in the user interface");
RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1);
-
}
static void rna_def_action_actuator(BlenderRNA *brna)
@@ -248,8 +235,6 @@
srna= RNA_def_struct(brna, "ActionActuator", "Actuator");
RNA_def_struct_ui_text(srna, "Action Actuator", "Actuator to control the object movement");
RNA_def_struct_sdna_from(srna, "bActionActuator", "data");
-// RNA_def_struct_sdna(srna, "bActionActuator");
-// RNA_def_struct_refine_func(srna, "rna_ActionActuator_refine");
prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "type");
@@ -372,7 +357,7 @@
prop= RNA_def_property(srna, "force_min_x", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "drot[0]");
RNA_def_property_ui_range(prop, -100.0, 100.0, 1.0, 0.1);
- RNA_def_property_ui_text(prop, "Max", "Set the lower limit for force");
+ RNA_def_property_ui_text(prop, "Min", "Set the lower limit for force");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "force_max_y", PROP_FLOAT, PROP_NONE);
@@ -384,7 +369,7 @@
prop= RNA_def_property(srna, "force_min_y", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "drot[1]");
RNA_def_property_ui_range(prop, -100.0, 100.0, 1.0, 0.1);
- RNA_def_property_ui_text(prop, "Max", "Set the lower limit for force");
+ RNA_def_property_ui_text(prop, "Min", "Set the lower limit for force");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "force_max_z", PROP_FLOAT, PROP_NONE);
@@ -396,7 +381,7 @@
prop= RNA_def_property(srna, "force_min_z", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "drot[2]");
RNA_def_property_ui_range(prop, -100.0, 100.0, 1.0, 0.1);
- RNA_def_property_ui_text(prop, "Max", "Set the lower limit for force");
+ RNA_def_property_ui_text(prop, "Min", "Set the lower limit for force");
RNA_def_property_update(prop, NC_LOGIC, NULL);
/* floats 3 Arrays*/
@@ -814,6 +799,12 @@
RNA_def_property_ui_text(prop, "Direction", "Set the direction of the ray");
RNA_def_property_update(prop, NC_LOGIC, NULL);
+ prop= RNA_def_property(srna, "direction_axis", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "mode");
+ RNA_def_property_enum_items(prop, prop_direction_items);
+ RNA_def_property_ui_text(prop, "Direction", "Select the axis to be aligned along the reference direction");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
+
/* ACT_CONST_TYPE_LOC */
prop= RNA_def_property(srna, "limit_loc_min_x", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "minloc[0]");
@@ -918,6 +909,69 @@
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 */
+ prop= RNA_def_property(srna, "max_rotation", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_float_sdna(prop, NULL, "maxrot");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_range(prop, -2000.0, 2000.0, 0.1, 0.001);
+ RNA_def_property_ui_text(prop, "Reference Direction", "Reference Direction");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
+
+ prop= RNA_def_property(srna, "min_angle", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "minloc[0]");
+ RNA_def_property_ui_range(prop, 0.0, 180.0, 0.1, 0.01);
+ RNA_def_property_ui_text(prop, "Min Angle", "Minimum angle (in degree) to maintain with target direction. No correction is done if angle with target direction is between min and max");
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list