[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [29484] trunk/blender/source/blender/ editors/space_logic/logic_window.c: Partial fix for [#22574] Logic Panel missing buttons (when selecting multiple objects)
Dalai Felinto
dfelinto at gmail.com
Wed Jun 16 08:20:56 CEST 2010
Revision: 29484
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29484
Author: dfelinto
Date: 2010-06-16 08:20:56 +0200 (Wed, 16 Jun 2010)
Log Message:
-----------
Partial fix for [#22574] Logic Panel missing buttons (when selecting multiple objects)
This commit allows you to see the Logic Bricks for multiple objects at once. It still will only add s/c/a for the active object.
@Matt,
currently "LOGIC_OT_controller_add" uses the active object. That's good for the operator to work in scripts, however for the UI we need something different.
Ideally I would like to pass the object as an (optional) parameter to the operator. Not sure if it's possible.
The solution in 2.49 looks too "2.50 incompatible". In there ob->scaflag is set to be retrieve later by "do_logic_buts". Smart but too hacky imho.
Modified Paths:
--------------
trunk/blender/source/blender/editors/space_logic/logic_window.c
Modified: trunk/blender/source/blender/editors/space_logic/logic_window.c
===================================================================
--- trunk/blender/source/blender/editors/space_logic/logic_window.c 2010-06-16 04:55:06 UTC (rev 29483)
+++ trunk/blender/source/blender/editors/space_logic/logic_window.c 2010-06-16 06:20:56 UTC (rev 29484)
@@ -4393,48 +4393,52 @@
uiItemR(row, &logic_ptr, "controllers_show_active_objects", 0, "Act", 0);
uiItemR(row, &logic_ptr, "controllers_show_linked_controller", 0, "Link", 0);
- RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr);
+ for(a=0; a<count; a++) {
+ bController *cont;
+ PointerRNA ptr;
+ uiLayout *split, *subsplit, *col;
+ int iact;
+
+ ob= (Object *)idar[a];
+
+ /* Drawing the Controller Header common to all Selected Objects */
- split= uiLayoutSplit(layout, 0.05, 0);
- uiItemR(split, &settings_ptr, "show_state_panel", UI_ITEM_R_NO_BG, "", ICON_DISCLOSURE_TRI_RIGHT);
+ RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr);
- row = uiLayoutRow(split, 1);
- uiDefButBitS(block, TOG, OB_SHOWCONT, 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 controllers");
- uiItemMenuEnumO(row, "LOGIC_OT_controller_add", "type", "Add Controller", 0);
+ split= uiLayoutSplit(layout, 0.05, 0);
+ uiItemR(split, &settings_ptr, "show_state_panel", UI_ITEM_R_NO_BG, "", ICON_DISCLOSURE_TRI_RIGHT);
- if (RNA_boolean_get(&settings_ptr, "show_state_panel")) {
+ row = uiLayoutRow(split, 1);
+ uiDefButBitS(block, TOG, OB_SHOWCONT, 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 controllers");
+ uiItemMenuEnumO(row, "LOGIC_OT_controller_add", "type", "Add Controller", 0);
- box= uiLayoutBox(layout);
- uiLayoutSetAlignment(box, UI_LAYOUT_ALIGN_CENTER); //XXX doesn't seem to work
- split= uiLayoutSplit(box, 0.2, 0);
+ if (RNA_boolean_get(&settings_ptr, "show_state_panel")) {
- col= uiLayoutColumn(split, 0);
- uiItemL(col, "Visible", 0);
- uiItemL(col, "Initial", 0);
+ box= uiLayoutBox(layout);
+ split= uiLayoutSplit(box, 0.2, 0);
- subsplit= uiLayoutSplit(split, 0.85, 0);
- col= uiLayoutColumn(subsplit, 0);
- row= uiLayoutRow(col, 0);
- uiLayoutSetActive(row, RNA_boolean_get(&settings_ptr, "all_states")==0);
- uiTemplateLayers(row, &settings_ptr, "state", &settings_ptr, "used_state", 0);
- row= uiLayoutRow(col, 0);
- uiTemplateLayers(row, &settings_ptr, "initial_state", &settings_ptr, "used_state", 0);
+ col= uiLayoutColumn(split, 0);
+ uiItemL(col, "Visible", 0);
+ uiItemL(col, "Initial", 0);
- col= uiLayoutColumn(subsplit, 0);
- uiItemR(col, &settings_ptr, "all_states", UI_ITEM_R_TOGGLE, NULL, 0);
- uiItemR(col, &settings_ptr, "debug_state", 0, "", 0);
- }
+ subsplit= uiLayoutSplit(split, 0.85, 0);
+ col= uiLayoutColumn(subsplit, 0);
+ row= uiLayoutRow(col, 0);
+ uiLayoutSetActive(row, RNA_boolean_get(&settings_ptr, "all_states")==0);
+ uiTemplateLayers(row, &settings_ptr, "state", &settings_ptr, "used_state", 0);
+ row= uiLayoutRow(col, 0);
+ uiTemplateLayers(row, &settings_ptr, "initial_state", &settings_ptr, "used_state", 0);
- for(a=0; a<count; a++) {
- bController *cont;
- PointerRNA ptr;
- uiLayout *split, *subsplit, *col;
- int iact;
-
- ob= (Object *)idar[a];
-
+ col= uiLayoutColumn(subsplit, 0);
+ uiItemR(col, &settings_ptr, "all_states", UI_ITEM_R_TOGGLE, NULL, 0);
+ uiItemR(col, &settings_ptr, "debug_state", 0, "", 0);
+ }
+
+ /* End of Drawing the Controller Header common to all Selected Objects */
+
if (!(ob->scavisflag & OB_VIS_CONT) || !(ob->scaflag & OB_SHOWCONT)) continue;
+
uiItemS(layout);
for(cont= ob->controllers.first; cont; cont=cont->next) {
@@ -4498,15 +4502,15 @@
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++) {
bSensor *sens;
PointerRNA ptr;
ob= (Object *)idar[a];
+
+ 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);
if (!(ob->scavisflag & OB_VIS_SENS) || !(ob->scaflag & OB_SHOWSENS)) continue;
@@ -4557,16 +4561,16 @@
uiItemR(row, &logic_ptr, "actuators_show_linked_controller", 0, "Link", 0);
uiItemR(row, &logic_ptr, "actuators_show_active_states", 0, "State", 0);
- row = uiLayoutRow(layout, 1);
- uiDefButBitS(block, TOG, OB_SHOWACT, 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 actuators");
- uiItemMenuEnumO(row, "LOGIC_OT_actuator_add", "type", "Add Actuator", 0);
-
for(a=0; a<count; a++) {
bActuator *act;
PointerRNA ptr;
ob= (Object *)idar[a];
-
+
+ row = uiLayoutRow(layout, 1);
+ uiDefButBitS(block, TOG, OB_SHOWACT, 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 actuators");
+ uiItemMenuEnumO(row, "LOGIC_OT_actuator_add", "type", "Add Actuator", 0);
+
if (!(ob->scavisflag & OB_VIS_ACT) || !(ob->scaflag & OB_SHOWACT)) continue;
uiItemS(layout);
More information about the Bf-blender-cvs
mailing list