[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [28672] trunk/blender/source/blender: Logic UI: add notifiers for sensors and controllers ( so the ui updates if you change the value through script) + some layout adjusments.
Dalai Felinto
dfelinto at gmail.com
Sat May 8 21:52:13 CEST 2010
Revision: 28672
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=28672
Author: dfelinto
Date: 2010-05-08 21:52:13 +0200 (Sat, 08 May 2010)
Log Message:
-----------
Logic UI: add notifiers for sensors and controllers (so the ui updates if you change the value through script) + some layout adjusments.
Modified Paths:
--------------
trunk/blender/source/blender/editors/space_logic/logic_window.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-08 19:48:28 UTC (rev 28671)
+++ trunk/blender/source/blender/editors/space_logic/logic_window.c 2010-05-08 19:52:13 UTC (rev 28672)
@@ -3483,21 +3483,22 @@
static void draw_controller_expression(uiLayout *layout, PointerRNA *ptr)
{
- uiItemR(layout, ptr, "expression", 0, NULL, 0);
+ uiItemR(layout, ptr, "expression", 0, "", 0);
}
static void draw_controller_python(uiLayout *layout, PointerRNA *ptr)
{
- uiLayout *row;
+ uiLayout *row, *split, *subsplit;
- uiItemR(layout, ptr, "mode", 0, NULL, 0);
+ split = uiLayoutSplit(layout, 0.3, 1);
+ uiItemR(split, ptr, "mode", 0, "", 0);
if (RNA_enum_get(ptr, "mode") == CONT_PY_SCRIPT) {
- uiItemR(layout, ptr, "text", 0, NULL, 0);
+ uiItemR(split, ptr, "text", 0, "", 0);
}
else {
- row= uiLayoutRow(layout, 0);
- uiItemR(row, ptr, "module", 0, NULL, 0);
- uiItemR(row, ptr, "debug", 0, NULL, 0);
+ subsplit = uiLayoutSplit(split, 0.8, 0);
+ uiItemR(subsplit, ptr, "module", 0, "", 0);
+ uiItemR(subsplit, ptr, "debug", UI_ITEM_R_TOGGLE, NULL, 0);
}
}
@@ -3558,7 +3559,7 @@
uiLayout *row;
row= uiLayoutRow(layout, 0);
- uiItemR(row, ptr, "mode", 0, NULL, 0);
+ uiItemR(row, ptr, "mode", 0, "", 0);
uiItemR(row, ptr, "action", 0, NULL, 0);
uiItemR(row, ptr, "continue_last_frame", 0, NULL, 0);
@@ -3811,7 +3812,7 @@
uiLayout *row, *subrow, *col;
row= uiLayoutRow(layout, 0);
- uiItemR(row, ptr, "play_type", 0, NULL, 0);
+ uiItemR(row, ptr, "play_type", 0, "", 0);
subrow= uiLayoutRow(row, 1);
uiItemR(subrow, ptr, "force", UI_ITEM_R_TOGGLE, NULL, 0);
uiItemR(subrow, ptr, "add", UI_ITEM_R_TOGGLE, NULL, 0);
@@ -4058,7 +4059,7 @@
uiLayout *row;
row= uiLayoutRow(layout, 0);
- uiItemR(row, ptr, "mode", 0, NULL, 0);
+ uiItemR(row, ptr, "mode", 0, "", 0);
uiItemR(row, ptr, "action", 0, NULL, 0);
uiItemR(row, ptr, "continue_last_frame", 0, NULL, 0);
Modified: trunk/blender/source/blender/makesrna/intern/rna_controller.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_controller.c 2010-05-08 19:48:28 UTC (rev 28671)
+++ trunk/blender/source/blender/makesrna/intern/rna_controller.c 2010-05-08 19:52:13 UTC (rev 28672)
@@ -24,6 +24,7 @@
#include <stdlib.h>
+#include "WM_types.h"
#include "RNA_define.h"
#include "rna_internal.h"
@@ -102,22 +103,26 @@
prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
RNA_def_property_ui_text(prop, "Name", "");
RNA_def_struct_name_property(srna, prop);
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
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, "rna_Controller_type_set", NULL);
RNA_def_property_enum_items(prop, controller_type_items);
RNA_def_property_ui_text(prop, "Type", "");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "expanded", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", CONT_SHOW);
RNA_def_property_ui_text(prop, "Expanded", "Set controller expanded in the user interface");
RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1);
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "priority", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", CONT_PRIO);
RNA_def_property_ui_text(prop, "Priority", "Mark controller for execution before all non-marked controllers (good for startup scripts)");
RNA_def_property_ui_icon(prop, ICON_BOOKMARKS, 1);
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
/* Expression Controller */
srna= RNA_def_struct(brna, "ExpressionController", "Controller");
@@ -128,6 +133,7 @@
RNA_def_property_string_sdna(prop, NULL, "str");
RNA_def_property_string_maxlength(prop, 127);
RNA_def_property_ui_text(prop, "Expression", "");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
/* Python Controller */
srna= RNA_def_struct(brna, "PythonController", "Controller" );
@@ -137,19 +143,23 @@
prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, python_controller_modes);
RNA_def_property_ui_text(prop, "Execution Method", "Python script type (textblock or module - faster)");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "text", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "Text");
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Text", "Text datablock with the python script");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "module", PROP_STRING, PROP_NONE);
RNA_def_property_ui_text(prop, "Module", "Module name and function to run e.g. \"someModule.main\". Internal texts and external python files can be used");
RNA_def_struct_name_property(srna, prop);
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "debug", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", CONT_PY_DEBUG);
RNA_def_property_ui_text(prop, "D", "Continuously reload the module from disk for editing external modules without restarting");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
/* Other Controllers */
srna= RNA_def_struct(brna, "AndController", "Controller");
Modified: trunk/blender/source/blender/makesrna/intern/rna_sensor.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_sensor.c 2010-05-08 19:48:28 UTC (rev 28671)
+++ trunk/blender/source/blender/makesrna/intern/rna_sensor.c 2010-05-08 19:52:13 UTC (rev 28672)
@@ -195,40 +195,49 @@
prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
RNA_def_property_ui_text(prop, "Name", "Sensor name");
RNA_def_struct_name_property(srna, prop);
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_enum_items(prop, sensor_type_items);
RNA_def_property_enum_funcs(prop, NULL, "rna_Sensor_type_set", "rna_Sensor_type_itemf");
RNA_def_property_ui_text(prop, "Type", "");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "expanded", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SENS_SHOW);
RNA_def_property_ui_text(prop, "Expanded", "Set sensor expanded in the user interface");
RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1);
-
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
+
prop= RNA_def_property(srna, "invert", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_ui_text(prop, "Invert Output", "Invert the level(output) of this sensor");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "level", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_ui_text(prop, "Level", "Level detector, trigger controllers of new states(only applicable upon logic state transition)");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "pulse_true_level", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "pulse", SENS_PULSE_REPEAT);
RNA_def_property_ui_text(prop, "Pulse True Level", "Activate TRUE level triggering (pulse mode)");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "pulse_false_level", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "pulse", SENS_NEG_PULSE_MODE);
RNA_def_property_ui_text(prop, "Pulse False Level", "Activate FALSE level triggering (pulse mode)");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "frequency", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "freq");
RNA_def_property_ui_text(prop, "Frequency", "Delay between repeated pulses(in logic tics, 0=no delay)");
RNA_def_property_range(prop, 0, 10000);
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "tap", PROP_BOOLEAN, PROP_NONE);\
RNA_def_property_boolean_sdna(prop, NULL, "tap", 1);
RNA_def_property_ui_text(prop, "Tap", "Trigger controllers only for an instant, even while the sensor remains true");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
}
static void rna_def_always_sensor(BlenderRNA *brna)
@@ -250,16 +259,19 @@
prop= RNA_def_property(srna, "property", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "name");
RNA_def_property_ui_text(prop, "Property", "Only look for objects with this property");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "dist");
RNA_def_property_ui_text(prop, "Distance", "Trigger distance");
RNA_def_property_range(prop, 0.0f, 10000.0f);
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "reset_distance", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "resetdist");
RNA_def_property_ui_text(prop, "Reset Distance", "");
RNA_def_property_range(prop, 0.0f, 10000.0f);
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
}
static void rna_def_mouse_sensor(BlenderRNA *brna)
@@ -286,6 +298,7 @@
RNA_def_property_enum_sdna(prop, NULL, "type");
RNA_def_property_enum_items(prop, mouse_event_items);
RNA_def_property_ui_text(prop, "Mouse Event", "Specify the type of event this mouse sensor should trigger on");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
}
static void rna_def_touch_sensor(BlenderRNA *brna)
@@ -302,6 +315,7 @@
RNA_def_property_pointer_sdna(prop, NULL, "ma");
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Material", "Only look for floors with this material");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
}
static void rna_def_keyboard_sensor(BlenderRNA *brna)
@@ -318,30 +332,36 @@
RNA_def_property_enum_items(prop, event_type_items);
RNA_def_property_enum_funcs(prop, NULL, "rna_Sensor_keyboard_key_set", NULL);
RNA_def_property_ui_text(prop, "Key", "");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "modifier_key", PROP_ENUM, PROP_NONE);
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list