Rewrite of Logic editor UI to use layout engine
authorMatt Ebb <matt@mke3.net>
Thu, 29 Apr 2010 07:01:48 +0000 (07:01 +0000)
committerMatt Ebb <matt@mke3.net>
Thu, 29 Apr 2010 07:01:48 +0000 (07:01 +0000)
This commit puts the ground work in place, swapping out the crusty old Logic Editor
UI code for the new RNA-based layout engine. It's disabled with ifdefs at the moment
because it's incomplete, but Dalai can now do the grunt work to fill it all out and get it running.

Also includes a bug fix to LINK buttons, and two new logic operators to add and delete sensors.

Dalai, just switch the #if 0 and #if 1 in logic_window.c:3412 and 3469

source/blender/editors/include/ED_logic.h [new file with mode: 0644]
source/blender/editors/interface/interface_handlers.c
source/blender/editors/space_api/spacetypes.c
source/blender/editors/space_logic/logic_intern.h
source/blender/editors/space_logic/logic_ops.c [new file with mode: 0644]
source/blender/editors/space_logic/logic_window.c
source/blender/makesrna/RNA_access.h
source/blender/makesrna/RNA_enum_types.h
source/blender/makesrna/intern/rna_sensor.c
source/blender/makesrna/intern/rna_space.c

diff --git a/source/blender/editors/include/ED_logic.h b/source/blender/editors/include/ED_logic.h
new file mode 100644 (file)
index 0000000..eff9422
--- /dev/null
@@ -0,0 +1,36 @@
+/**
+ * $Id: ED_armature.h 28425 2010-04-26 06:35:25Z aligorith $
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+#ifndef ED_LOGIC_H
+#define ED_LOGIC_H
+
+/* logic_ops.c */
+void ED_operatortypes_logic(void);
+
+#endif /* ED_LOGIC_H */
+
+
+
index 7aace1197b64c463427837f2e213355b92dfd230..ff56b14c653c26b69543b992367598cda66981ac 100644 (file)
@@ -777,6 +777,8 @@ static void ui_apply_but_LINK(bContext *C, uiBut *but, uiHandleButtonData *data)
                        break;
        }
        if(bt && bt!=but) {
+               if (!ELEM(bt->type, LINK, INLINK) || !ELEM(but->type, LINK, INLINK))
+                       return;
                
                if(but->type==LINK) ui_add_link(but, bt);
                else ui_add_link(bt, but);
index ba7172b0da8edc3d6f0e5fa482d33eeddf3c5fe7..3def3f962dcd7b91a26cc0f2fbe7df56faccdd39 100644 (file)
@@ -100,6 +100,7 @@ void ED_spacetypes_init(void)
        ED_operatortypes_metaball();
        ED_operatortypes_sound();
        ED_operatortypes_render();
+       ED_operatortypes_logic();
        
        UI_view2d_operatortypes();
        UI_buttons_operatortypes();
index 4d19a16ee9c12164982b1da562443602a309b5d0..3b2b6497cdc60b6e76246b8a5346604d9bbe7f39 100644 (file)
@@ -54,6 +54,7 @@ void LOGIC_OT_links_cut(struct wmOperatorType *ot);
 
 /* logic_window.c */
 void logic_buttons(struct bContext *C, struct ARegion *ar);
+void make_unique_prop_names(struct bContext *C, char *str);
 
 #endif /* ED_LOGIC_INTERN_H */
 
diff --git a/source/blender/editors/space_logic/logic_ops.c b/source/blender/editors/space_logic/logic_ops.c
new file mode 100644 (file)
index 0000000..c627f41
--- /dev/null
@@ -0,0 +1,196 @@
+/**
+ * $Id: logic_header.c 27676 2010-03-23 14:09:09Z campbellbarton $
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. 
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2009 Blender Foundation.
+ * All rights reserved.
+ *
+ * 
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+#include <stddef.h>
+
+#include "DNA_object_types.h"
+#include "DNA_scene_types.h"
+#include "DNA_sensor_types.h"
+
+#include "BLI_blenlib.h"
+
+#include "BKE_context.h"
+#include "BKE_main.h"
+#include "BKE_sca.h"
+
+#include "ED_object.h"
+#include "ED_screen.h"
+
+#include "RNA_access.h"
+#include "RNA_define.h"
+#include "RNA_enum_types.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+
+#include "logic_intern.h"
+
+/* ************* Generic Operator Helpers ************* */
+
+static int edit_sensor_poll(bContext *C)
+{
+       PointerRNA ptr= CTX_data_pointer_get_type(C, "sensor", &RNA_Sensor);
+
+       if (ptr.data && ((ID*)ptr.id.data)->lib) return 0;
+       return 1;
+}
+
+/* this is the nice py-api-compatible way to do it, like modifiers, 
+   but not entirely working yet..
+static void edit_sensor_properties(wmOperatorType *ot)
+{
+       RNA_def_string(ot->srna, "sensor", "", 32, "Sensor", "Name of the sensor to edit");
+       RNA_def_string(ot->srna, "object", "", 32, "Object", "Name of the object the sensor belongs to");
+}
+
+static int edit_sensor_invoke_properties(bContext *C, wmOperator *op)
+{
+       PointerRNA ptr= CTX_data_pointer_get_type(C, "sensor", &RNA_Sensor);
+       
+       if (RNA_property_is_set(op->ptr, "sensor") && RNA_property_is_set(op->ptr, "object") )
+               return 1;
+       
+       if (ptr.data) {
+               bSensor *sens = ptr.data;
+               Object *ob = ptr.id.data;
+               
+               RNA_string_set(op->ptr, "sensor", sens->name);
+               RNA_string_set(op->ptr, "object", ob->id.name+2);
+               return 1;
+       }
+       
+       return 0;
+}
+
+static bSensor *edit_sensor_property_get(bContext *C, wmOperator *op, Object *ob)
+{
+       char sensor_name[32];
+       char ob_name[32];
+       bSensor *sens;
+       
+       RNA_string_get(op->ptr, "sensor", sensor_name);
+       RNA_string_get(op->ptr, "object", ob_name);
+       
+       ob = BLI_findstring(&(CTX_data_main(C)->object), ob_name, offsetof(ID, name) + 2);
+       if (!ob)
+               return NULL;
+       
+       sens = BLI_findstring(&(ob->sensors), sensor_name, offsetof(bSensor, name));    
+       return sens;
+}
+ */
+
+/* ************* Remove Sensor Operator ************* */
+
+static int sensor_remove_exec(bContext *C, wmOperator *op)
+{
+       /*      Object *ob;
+       bSensor *sens = edit_sensor_property_get(C, op, ob);    */
+       PointerRNA ptr = CTX_data_pointer_get_type(C, "sensor", &RNA_Sensor);
+       Object *ob= ptr.id.data;
+       bSensor *sens= ptr.data;
+       
+       if (!sens)
+               return OPERATOR_CANCELLED;
+       
+       BLI_remlink(&(ob->sensors), sens);
+       free_sensor(sens);
+       
+       WM_event_add_notifier(C, NC_LOGIC, NULL);
+       
+       return OPERATOR_FINISHED;
+}
+
+
+/* commented along with above stuff
+ static int sensor_remove_invoke(bContext *C, wmOperator *op, wmEvent *event)
+{
+       if (edit_sensor_invoke_properties(C, op))
+               return sensor_remove_exec(C, op);
+       else
+               return OPERATOR_CANCELLED;
+}
+ */
+
+void LOGIC_OT_sensor_remove(wmOperatorType *ot)
+{
+       ot->name= "Remove Sensor";
+       ot->description= "Remove a sensor from the active object";
+       ot->idname= "LOGIC_OT_sensor_remove";
+       
+       //ot->invoke= sensor_remove_invoke;
+       ot->exec= sensor_remove_exec;
+       ot->poll= edit_sensor_poll;
+       
+       /* flags */
+       ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+       //edit_sensor_properties(ot);
+}
+
+static int sensor_add_exec(bContext *C, wmOperator *op)
+{
+       Object *ob = ED_object_active_context(C);
+       bSensor *sens;
+       int type= RNA_enum_get(op->ptr, "type");
+
+       sens= new_sensor(type);
+       BLI_addtail(&(ob->sensors), sens);
+       make_unique_prop_names(C, sens->name);
+       ob->scaflag |= OB_SHOWSENS;
+
+       WM_event_add_notifier(C, NC_LOGIC, NULL);
+       
+       return OPERATOR_FINISHED;
+}
+
+void LOGIC_OT_sensor_add(wmOperatorType *ot)
+{
+       PropertyRNA *prop;
+       
+       /* identifiers */
+       ot->name= "Add Sensor";
+       ot->description = "Add a sensor to the active object";
+       ot->idname= "LOGIC_OT_sensor_add";
+       
+       /* api callbacks */
+       ot->invoke= WM_menu_invoke;
+       ot->exec= sensor_add_exec;
+       ot->poll= ED_operator_object_active_editable;
+       
+       /* flags */
+       ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+       
+       /* properties */
+       prop= RNA_def_enum(ot->srna, "type", sensor_type_items, SENS_ALWAYS, "Type", "Type of sensor to add");
+}
+
+void ED_operatortypes_logic(void)
+{
+       WM_operatortype_append(LOGIC_OT_sensor_remove);
+       WM_operatortype_append(LOGIC_OT_sensor_add);
+}
index 39d3feafc19b68b51a615156e22f0777d48eb986..de8c5ae6ba2534c252eb8dfffa65e5d200f4b280 100644 (file)
@@ -63,6 +63,8 @@
 
 #include "UI_interface.h"
 
+#include "RNA_access.h"
+
 /* XXX BAD BAD */
 #include "../interface/interface_intern.h"
 
@@ -3168,6 +3170,52 @@ static int is_sensor_linked(uiBlock *block, bSensor *sens)
 /* never used, see CVS 1.120 for the code */
 /*  static uiBlock *freecamera_menu(void) */
 
+static void draw_sensor_header(uiLayout *layout, PointerRNA *ptr)
+{
+       uiLayout *box, *row;
+       
+       box= uiLayoutBox(layout);
+       row= uiLayoutRow(box, 0);
+       
+       uiItemR(row, ptr, "expanded", UI_ITEM_R_NO_BG, "", 0);
+       uiItemR(row, ptr, "type", 0, "", 0);
+       uiItemR(row, ptr, "name", 0, "", 0);
+       uiItemO(row, "", ICON_X, "LOGIC_OT_sensor_remove");
+}
+
+
+static void draw_sensor_touch(uiLayout *layout, PointerRNA *ptr)
+{
+       uiItemR(layout, ptr, "material", 0, NULL, 0);
+}
+
+static void draw_sensor_delay(uiLayout *layout, PointerRNA *ptr)
+{
+       uiItemR(layout, ptr, "delay", 0, NULL, 0);
+       uiItemR(layout, ptr, "duration", 0, NULL, 0);
+       uiItemR(layout, ptr, "repeat", 0, NULL, 0);
+}
+
+void draw_brick_sensor(uiLayout *layout, PointerRNA *ptr)
+{
+       uiLayout *box;
+       
+       if (!RNA_boolean_get(ptr, "expanded"))
+               return;
+       
+       box = uiLayoutBox(layout);
+       
+       switch (RNA_enum_get(ptr, "type")) {
+               case SENS_ALWAYS:
+                       break;
+               case SENS_TOUCH:
+                       draw_sensor_touch(box, ptr);
+                       break;
+               case SENS_DELAY:
+                       draw_sensor_delay(box, ptr);
+                       break;
+       }
+}
 
 void logic_buttons(bContext *C, ARegion *ar)
 {
@@ -3179,8 +3227,11 @@ void logic_buttons(bContext *C, ARegion *ar)
        bActuator *act;
        uiBlock *block;
        uiBut *but;
+       uiLayout *layout, *row;
+       PointerRNA logic_ptr;
        int a, iact, stbit, offset;
-       short xco, yco, count, width, ycoo;
+       int xco, yco, width, ycoo;
+       short count;
        char name[32];
        /* pin is a bool used for actuator and sensor drawing with states
         * pin so changing states dosnt hide the logic brick */
@@ -3193,6 +3244,8 @@ void logic_buttons(bContext *C, ARegion *ar)
        block= uiBeginBlock(C, ar, name, UI_EMBOSS);
        uiBlockSetHandleFunc(block, do_logic_buts, NULL);
 
+       RNA_pointer_create(NULL, &RNA_SpaceLogicEditor, slogic, &logic_ptr);
+       
        idar= get_selected_and_linked_obs(C, &count, slogic->scaflag);
 
        /* clean ACT_LINKED and ACT_VISIBLE of all potentially visible actuators so that 
@@ -3354,8 +3407,66 @@ void logic_buttons(bContext *C, ARegion *ar)
        }
        
        /* ******************************* */
-       xco= 10; yco= 170; width= 300;
+       xco= 10; yco= 205; width= 320;
+
+#if 0
+       
+       layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, xco, yco, width, 20, U.uistyles.first);
+       row = uiLayoutRow(layout, 1);
+       
+       uiDefBlockBut(block, sensor_menu, NULL, "Sensors", xco-10, yco, 70, UI_UNIT_Y, "");             /* replace this with uiLayout stuff later */
+       
+       uiItemR(row, &logic_ptr, "sensors_show_selected_objects", 0, "Sel", 0);
+       uiItemR(row, &logic_ptr, "sensors_show_active_objects", 0, "Act", 0);
+       uiItemR(row, &logic_ptr, "sensors_show_linked_controller", 0, "Link", 0);
+       uiItemR(row, &logic_ptr, "sensors_show_active_states", 0, "State", 0);
+       
+       row = uiLayoutRow(layout, 1);
+       uiDefButBitS(block, TOG, OB_SHOWSENS, B_REDR, ob->id.name+2,(short)(xco-10), yco, (short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, "Object name, click to show/hide sensors");
+       uiItemMenuEnumO(row, "LOGIC_OT_sensor_add", "type", "Add Sensor", 0);
+       
+       for(a=0; a<count; a++) {
+               PointerRNA ptr;
+
+               ob= (Object *)idar[a];
+               
+               if (!(ob->scavisflag & OB_VIS_SENS) || !(ob->scaflag & OB_SHOWSENS)) continue;
+               
+               uiItemS(layout);
+               
+               for(sens= ob->sensors.first; sens; sens=sens->next) {
+                       RNA_pointer_create(&ob->id, &RNA_Sensor, sens, &ptr);
+                       
+                       if ((slogic->scaflag & BUTS_SENS_STATE) ||
+                                (sens->totlinks == 0) ||                                                                                       /* always display sensor without links so that is can be edited */
+                                (sens->flag & SENS_PIN && slogic->scaflag & BUTS_SENS_STATE) ||        /* states can hide some sensors, pinned sensors ignore the visible state */
+                                (is_sensor_linked(block, sens))
+                               )
+                       {       
+                               uiLayout *split, *col;
+                               
+                               split = uiLayoutSplit(layout, 0.95, 0);
+                               col = uiLayoutColumn(split, 1);
+                               uiLayoutSetContextPointer(col, "sensor", &ptr);
+                               
+                               /* should make UI template for sensor header.. function will do for now */
+                               draw_sensor_header(col, &ptr);
+                               
+                               /* draw the brick contents */
+                               draw_brick_sensor(col, &ptr);
+                               
+                               /* put link button to the right */
+                               col = uiLayoutColumn(split, 0);
+                               /* use oldskool uiButtons for links for now */
+                               but= uiDefIconBut(block, LINK, 0, ICON_LINK,    (short)(xco+width+UI_UNIT_X), yco, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
+                               uiSetButLink(but, NULL, (void ***)&(sens->links), &sens->totlinks, LINK_SENSOR, LINK_CONTROLLER);
+                       }
+               }
+       }
+       uiBlockLayoutResolve(block, NULL, &yco);        /* stores final height in yco */
+#endif 
 
+#if 1
        uiDefBlockBut(block, sensor_menu, NULL, "Sensors", xco-10, yco+35, 70, UI_UNIT_Y, "");
        
        uiBlockBeginAlign(block);
@@ -3437,6 +3548,8 @@ void logic_buttons(bContext *C, ARegion *ar)
                        yco-= 6;
                }
        }
+#endif
+
 
        /* ******************************* */
        xco= 800; yco= 170; width= 300;
index c37c3bc65d709c6f4b65fee0bf146063c8dd6dc9..5c24b05a822fceaf45990b61d2039f40522c2124 100644 (file)
@@ -445,6 +445,7 @@ extern StructRNA RNA_SpaceGraphEditor;
 extern StructRNA RNA_SpaceImageEditor;
 extern StructRNA RNA_SpaceInfo;
 extern StructRNA RNA_SpaceLogicEditor;
+extern StructRNA RNA_SpaceLogicEditorSensorSettings;
 extern StructRNA RNA_SpaceNLA;
 extern StructRNA RNA_SpaceNodeEditor;
 extern StructRNA RNA_SpaceOutliner;
index 6adad6aa92cb1d13d912ab92cc5c56886da3b8ef..13a743201a86920c5a86dba34f494add3c27562f 100644 (file)
@@ -75,6 +75,8 @@ extern EnumPropertyItem object_type_items[];
 
 extern EnumPropertyItem object_type_curve_items[];
 
+extern EnumPropertyItem sensor_type_items[];
+
 extern EnumPropertyItem space_type_items[];
 
 extern EnumPropertyItem keymap_propvalue_items[];
index 533aab1a3171ee7460bf2bbe88f8f8cf6f066ecb..3159591625a457b063c35ef7f53ddf28bb018e32 100644 (file)
 
 #include "DNA_sensor_types.h"
 
+EnumPropertyItem sensor_type_items[] ={
+       {SENS_ALWAYS, "ALWAYS", 0, "Always", ""},
+       {SENS_TOUCH, "TOUCH", 0, "Touch", ""},
+       {SENS_NEAR, "NEAR", 0, "Near", ""},
+       {SENS_KEYBOARD, "KEYBOARD", 0, "Keyboard", ""},
+       {SENS_PROPERTY, "PROPERTY", 0, "Property", ""},
+       {SENS_MOUSE, "MOUSE", 0, "Mouse", ""},
+       {SENS_COLLISION, "COLLISION", 0, "Collision", ""},
+       {SENS_RADAR, "RADAR", 0, "Radar", ""},
+       {SENS_RANDOM, "RANDOM", 0, "Random", ""},
+       {SENS_RAY, "RAY", 0, "Ray", ""},
+       {SENS_MESSAGE, "MESSAGE", 0, "Message", ""},
+       {SENS_JOYSTICK, "JOYSTICK", 0, "joystick", ""},
+       {SENS_ACTUATOR, "ACTUATOR", 0, "Actuator", ""},
+       {SENS_DELAY, "DELAY", 0, "Delay", ""},
+       {SENS_ARMATURE, "ARMATURE", 0, "Armature", ""},
+       {0, NULL, 0, NULL, NULL}};
+
 #ifdef RNA_RUNTIME
 
+#include "BKE_sca.h"
+
 static StructRNA* rna_Sensor_refine(struct PointerRNA *ptr)
 {
        bSensor *sensor= (bSensor*)ptr->data;
@@ -72,29 +92,19 @@ static StructRNA* rna_Sensor_refine(struct PointerRNA *ptr)
        }
 }
 
+static void rna_Sensor_type_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+{
+       bSensor *sens= (bSensor *)ptr->data;
+       
+       init_sensor(sens);
+}
+
 #else
 
 static void rna_def_sensor(BlenderRNA *brna)
 {
        StructRNA *srna;
        PropertyRNA *prop;
-       static EnumPropertyItem sensor_type_items[] ={
-               {SENS_ALWAYS, "ALWAYS", 0, "Always", ""},
-               {SENS_TOUCH, "TOUCH", 0, "Touch", ""},
-               {SENS_NEAR, "NEAR", 0, "Near", ""},
-               {SENS_KEYBOARD, "KEYBOARD", 0, "Keyboard", ""},
-               {SENS_PROPERTY, "PROPERTY", 0, "Property", ""},
-               {SENS_MOUSE, "MOUSE", 0, "Mouse", ""},
-               {SENS_COLLISION, "COLLISION", 0, "Collision", ""},
-               {SENS_RADAR, "RADAR", 0, "Radar", ""},
-               {SENS_RANDOM, "RANDOM", 0, "Random", ""},
-               {SENS_RAY, "RAY", 0, "Ray", ""},
-               {SENS_MESSAGE, "MESSAGE", 0, "Message", ""},
-               {SENS_JOYSTICK, "JOYSTICK", 0, "joystick", ""},
-               {SENS_ACTUATOR, "ACTUATOR", 0, "Actuator", ""},
-               {SENS_DELAY, "DELAY", 0, "Delay", ""},
-               {SENS_ARMATURE, "ARMATURE", 0, "Armature", ""},
-               {0, NULL, 0, NULL, NULL}};
 
        srna= RNA_def_struct(brna, "Sensor", NULL);
        RNA_def_struct_ui_text(srna, "Sensor", "Game engine logic brick to detect events");
@@ -105,12 +115,17 @@ static void rna_def_sensor(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Name", "Sensor 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, sensor_type_items);
        RNA_def_property_ui_text(prop, "Type", "");
-
+       RNA_def_property_update(prop, 0, "rna_Sensor_type_update");
+       
+       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);
+       
        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");
 
index f2c25e3e1fb17730b1777da7ca19a12d94117eaf..fe6298b3006ede51d2892e9204dd7e1cfb4eb3b6 100644 (file)
@@ -2106,10 +2106,32 @@ static void rna_def_space_node(BlenderRNA *brna)
 static void rna_def_space_logic(BlenderRNA *brna)
 {
        StructRNA *srna;
+       PropertyRNA *prop;
 
        srna= RNA_def_struct(brna, "SpaceLogicEditor", "Space");
        RNA_def_struct_sdna(srna, "SpaceLogic");
        RNA_def_struct_ui_text(srna, "Space Logic Editor", "Logic editor space data");
+       
+       prop= RNA_def_property(srna, "sensors_show_selected_objects", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "scaflag", BUTS_SENS_SEL);
+       RNA_def_property_ui_text(prop, "Show Selected Object", "Show sensors of all selected objects");
+       RNA_def_property_update(prop, NC_LOGIC, NULL);
+       
+       prop= RNA_def_property(srna, "sensors_show_active_objects", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "scaflag", BUTS_SENS_ACT);
+       RNA_def_property_ui_text(prop, "Show Active Object", "Show sensors of active object");
+       RNA_def_property_update(prop, NC_LOGIC, NULL);
+       
+       prop= RNA_def_property(srna, "sensors_show_linked_controller", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "scaflag", BUTS_SENS_LINK);
+       RNA_def_property_ui_text(prop, "Show Linked to Controller", "Show linked objects to the controller");
+       RNA_def_property_update(prop, NC_LOGIC, NULL);
+       
+       prop= RNA_def_property(srna, "sensors_show_active_states", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "scaflag", BUTS_SENS_STATE);
+       RNA_def_property_ui_text(prop, "Show Active States", "Show only sensors connected to active states");
+       RNA_def_property_update(prop, NC_LOGIC, NULL);
+       
 }
 
 void RNA_def_space(BlenderRNA *brna)