Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDalai Felinto <dfelinto@gmail.com>2010-05-04 04:06:13 +0400
committerDalai Felinto <dfelinto@gmail.com>2010-05-04 04:06:13 +0400
commit44c0f38e6ceb6d7b2a07aa23b2c0811a609d17d5 (patch)
tree586192ad47d9191ef26aabbf9d7af2c4232af193 /source/blender/makesrna/intern/rna_controller.c
parente09c47a0daeee84f6c17498620c3b8e9dca8ba9b (diff)
BGE Logics UI: commit to receive some feedback from Matt
To test use debug mode > 0 (Ctrl+Alt+D) * primarly the goal is to put all the bricks there, and then to worry about the proper layout * sensor header added (need to be more compressed). Also checkbox will not work that well here in my opinion. we need to see what can be used instead (icons?) * sensors, and actuators in alphabetical order * a lot of sensors using the rna (//XXXSENSOR in the ones not using it) * the logic_window.c code for controller and actuator is there only to display the draw functions for controller and actuators. But the code it's a really bad copy of the sensor code, so it will be fixed later (Matt? :) * I would love if the non-expanded mode were more compact, more like in 2.49 (the name non-editable). but this is the kind of think we can worry in the end. Also instead of "move up/move down" it would be nice to drag/drop the sensors/controllers/actuators * to do: rna_actuators: to rename type to mode for the enum
Diffstat (limited to 'source/blender/makesrna/intern/rna_controller.c')
-rw-r--r--source/blender/makesrna/intern/rna_controller.c52
1 files changed, 41 insertions, 11 deletions
diff --git a/source/blender/makesrna/intern/rna_controller.c b/source/blender/makesrna/intern/rna_controller.c
index 67c7bd0f2d8..fe68fbc6b7c 100644
--- a/source/blender/makesrna/intern/rna_controller.c
+++ b/source/blender/makesrna/intern/rna_controller.c
@@ -30,8 +30,21 @@
#include "DNA_controller_types.h"
+EnumPropertyItem controller_type_items[] ={
+ {CONT_LOGIC_AND, "LOGIC_AND", 0, "And", "Logic And"},
+ {CONT_LOGIC_OR, "LOGIC_OR", 0, "Or", "Logic Or"},
+ {CONT_LOGIC_NAND, "LOGIC_NAND", 0, "Nand", "Logic Nand"},
+ {CONT_LOGIC_NOR, "LOGIC_NOR", 0, "Nor", "Logic Nor"},
+ {CONT_LOGIC_XOR, "LOGIC_XOR", 0, "Xor", "Logic Xor"},
+ {CONT_LOGIC_XNOR, "LOGIC_XNOR", 0, "Xnor", "Logic Xnor"},
+ {CONT_EXPRESSION, "EXPRESSION", 0, "Expression", ""},
+ {CONT_PYTHON, "PYTHON", 0, "Python Script", ""},
+ {0, NULL, 0, NULL, NULL}};
+
#ifdef RNA_RUNTIME
+#include "BKE_sca.h"
+
static struct StructRNA* rna_Controller_refine(struct PointerRNA *ptr)
{
bController *controller= (bController*)ptr->data;
@@ -58,21 +71,23 @@ static struct StructRNA* rna_Controller_refine(struct PointerRNA *ptr)
}
}
+static void rna_Controller_type_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+{
+ bController *cont= (bController *)ptr->data;
+
+ init_controller(cont);
+}
+
#else
void RNA_def_controller(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
- static EnumPropertyItem controller_type_items[] ={
- {CONT_LOGIC_AND, "LOGIC_AND", 0, "Logic And", ""},
- {CONT_LOGIC_OR, "LOGIC_OR", 0, "Logic Or", ""},
- {CONT_LOGIC_NAND, "LOGIC_NAND", 0, "Logic Nand", ""},
- {CONT_LOGIC_NOR, "LOGIC_NOR", 0, "Logic Nor", ""},
- {CONT_LOGIC_XOR, "LOGIC_XOR", 0, "Logic Xor", ""},
- {CONT_LOGIC_XNOR, "LOGIC_XNOR", 0, "Logic Xnor", ""},
- {CONT_EXPRESSION, "EXPRESSION", 0, "Expression", ""},
- {CONT_PYTHON, "PYTHON", 0, "Python Script", ""},
+
+ static EnumPropertyItem python_controller_modes[] ={
+ {CONT_PY_SCRIPT, "SCRIPT", 0, "Script", ""},
+ {CONT_PY_MODULE, "MODULE", 0, "Module", ""},
{0, NULL, 0, NULL, NULL}};
/* Controller */
@@ -85,12 +100,23 @@ void RNA_def_controller(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Name", "");
RNA_def_struct_name_property(srna, prop);
- /* type is not editable, would need to do proper data free/alloc */
prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_enum_items(prop, controller_type_items);
RNA_def_property_ui_text(prop, "Type", "");
+ RNA_def_property_update(prop, 0, "rna_Controller_type_update");
+
+ 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);
+
+ 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);
+
/* Expression Controller */
srna= RNA_def_struct(brna, "ExpressionController", "Controller");
RNA_def_struct_sdna_from(srna, "bExpressionCont", "data");
@@ -106,6 +132,10 @@ void RNA_def_controller(BlenderRNA *brna)
RNA_def_struct_sdna_from(srna, "bPythonCont", "data");
RNA_def_struct_ui_text(srna, "Python Controller", "Controller executing a python script");
+ 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)");
+
prop= RNA_def_property(srna, "text", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "Text");
RNA_def_property_flag(prop, PROP_EDITABLE);