[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [30256] trunk/blender/source/blender/ editors/space_logic/logic_window.c: Logic Editor UI: Make the Active object always the first one of the list, and have the ADD button only for it.

Dalai Felinto dfelinto at gmail.com
Tue Jul 13 11:29:02 CEST 2010


Revision: 30256
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=30256
Author:   dfelinto
Date:     2010-07-13 11:29:02 +0200 (Tue, 13 Jul 2010)

Log Message:
-----------
Logic Editor UI: Make the Active object always the first one of the list, and have the ADD button only for it.

The reason for that is because I can't find a way to change the active object for a particular context (it may be even a bug in the rna/UI base code). So for the time being (a.k.a. for Beta) this will make it.

I actually like this solution, maybe the bug is for the good afterall.

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-07-13 09:28:01 UTC (rev 30255)
+++ trunk/blender/source/blender/editors/space_logic/logic_window.c	2010-07-13 09:29:02 UTC (rev 30256)
@@ -912,8 +912,15 @@
 	
 	ob= G.main->object.first;
 	nr= 0;
+
+	/* make the active object always the first one of the list */
+	if (obact) {
+		idar[0]= (ID *)obact;
+		nr++;
+	}
+
 	while(ob) {
-		if( ob->scavisflag ) {
+		if( (ob->scavisflag) && (ob != obact)) {
 			idar[nr]= (ID *)ob;
 			nr++;
 		}
@@ -4377,6 +4384,7 @@
 {
 	SpaceLogic *slogic= CTX_wm_space_logic(C);
 	Object *ob= CTX_data_active_object(C);
+	Object *act_ob= ob;
 	ID **idar;
 	
 	PointerRNA logic_ptr, settings_ptr;
@@ -4470,7 +4478,8 @@
 
 		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);
+		if (ob == act_ob)
+			uiItemMenuEnumO(row, "LOGIC_OT_controller_add", "type", "Add Controller", 0);
 
 		if (RNA_boolean_get(&settings_ptr, "show_state_panel")) {
 
@@ -4563,7 +4572,8 @@
 
 		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 == act_ob)
+			uiItemMenuEnumO(row, "LOGIC_OT_sensor_add", "type", "Add Sensor", 0);
 		
 		if ((ob->scaflag & OB_SHOWSENS) == 0) continue;
 		
@@ -4628,7 +4638,8 @@
 
 		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 == act_ob)
+			uiItemMenuEnumO(row, "LOGIC_OT_actuator_add", "type", "Add Actuator", 0);
 
 		if ((ob->scaflag & OB_SHOWACT) == 0) continue;
 		





More information about the Bf-blender-cvs mailing list