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-07-09 04:14:46 +0400
committerDalai Felinto <dfelinto@gmail.com>2010-07-09 04:14:46 +0400
commit1f019c23fd11aefc363bb1694b94d0aee34501a1 (patch)
treec5df226127b7cb6d9ce36fd5cc4ed9ea85d2d743 /source/blender/blenkernel/intern/sca.c
parent7ef6b5cdfdaa1c6f0e80e80f8ca6e2c75eed76f7 (diff)
Logic Editor UI: move s/c/a operators and interface buttons
Tchatcharantcharan ... Three new operators: bpy.ops.logic.sensor_move bpy.ops.logic.controller_move bpy.ops.logic.actuator_move direction is a parameter (UP,DOWN) Moved some interface code to sca.c instead of logic_window.c. (and changed accordingly). One note: as in 2.49, the move up/down button is only available in non-expanded mode. However instead of one button with two options we have 2 buttons (as we had originally in 2.50). That also means the s/c/a header is getting more clunky. Design, thoughts, ideas are appreciated. For the time been functionality back is still the priority (mine at least ;)
Diffstat (limited to 'source/blender/blenkernel/intern/sca.c')
-rw-r--r--source/blender/blenkernel/intern/sca.c124
1 files changed, 124 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/sca.c b/source/blender/blenkernel/intern/sca.c
index 3102d4b054b..02b66dd9b32 100644
--- a/source/blender/blenkernel/intern/sca.c
+++ b/source/blender/blenkernel/intern/sca.c
@@ -683,3 +683,127 @@ void sca_remove_ob_poin(Object *obt, Object *ob)
act= act->next;
}
}
+
+/* ******************** INTERFACE ******************* */
+void sca_move_sensor(bSensor *sens_to_move, Object *ob, int *move_up)
+{
+ bSensor *sens, *tmp;
+
+ int val;
+ val = move_up ? 1:2;
+
+ /* make sure this sensor belongs to this object */
+ sens= ob->sensors.first;
+ while(sens) {
+ if(sens == sens_to_move) break;
+ sens= sens->next;
+ }
+ if(!sens) return;
+
+ /* move up */
+ if( val==1 && sens->prev) {
+ for (tmp=sens->prev; tmp; tmp=tmp->prev) {
+ if (tmp->flag & SENS_VISIBLE)
+ break;
+ }
+ if (tmp) {
+ BLI_remlink(&ob->sensors, sens);
+ BLI_insertlinkbefore(&ob->sensors, tmp, sens);
+ }
+ }
+ /* move down */
+ else if( val==2 && sens->next) {
+ for (tmp=sens->next; tmp; tmp=tmp->next) {
+ if (tmp->flag & SENS_VISIBLE)
+ break;
+ }
+ if (tmp) {
+ BLI_remlink(&ob->sensors, sens);
+ BLI_insertlink(&ob->sensors, tmp, sens);
+ }
+ }
+}
+
+void sca_move_controller(bController *cont_to_move, Object *ob, int move_up)
+{
+ bController *cont, *tmp;
+
+ int val;
+ val = move_up ? 1:2;
+
+ /* make sure this controller belongs to this object */
+ cont= ob->controllers.first;
+ while(cont) {
+ if(cont == cont_to_move) break;
+ cont= cont->next;
+ }
+ if(!cont) return;
+
+ /* move up */
+ if( val==1 && cont->prev) {
+ /* locate the controller that has the same state mask but is earlier in the list */
+ tmp = cont->prev;
+ while(tmp) {
+ if(tmp->state_mask & cont->state_mask)
+ break;
+ tmp = tmp->prev;
+ }
+ if (tmp) {
+ BLI_remlink(&ob->controllers, cont);
+ BLI_insertlinkbefore(&ob->controllers, tmp, cont);
+ }
+ }
+
+ /* move down */
+ else if( val==2 && cont->next) {
+ tmp = cont->next;
+ while(tmp) {
+ if(tmp->state_mask & cont->state_mask)
+ break;
+ tmp = tmp->next;
+ }
+ BLI_remlink(&ob->controllers, cont);
+ BLI_insertlink(&ob->controllers, tmp, cont);
+ }
+}
+
+void sca_move_actuator(bActuator *act_to_move, Object *ob, int move_up)
+{
+ bActuator *act, *tmp;
+ int val;
+
+ val = move_up ? 1:2;
+
+ /* make sure this actuator belongs to this object */
+ act= ob->actuators.first;
+ while(act) {
+ if(act == act_to_move) break;
+ act= act->next;
+ }
+ if(!act) return;
+
+ /* move up */
+ if( val==1 && act->prev) {
+ /* locate the first visible actuators before this one */
+ for (tmp = act->prev; tmp; tmp=tmp->prev) {
+ if (tmp->flag & ACT_VISIBLE)
+ break;
+ }
+ if (tmp) {
+ BLI_remlink(&ob->actuators, act);
+ BLI_insertlinkbefore(&ob->actuators, tmp, act);
+ }
+ }
+ /* move down */
+ else if( val==2 && act->next) {
+ /* locate the first visible actuators after this one */
+ for (tmp=act->next; tmp; tmp=tmp->next) {
+ if (tmp->flag & ACT_VISIBLE)
+ break;
+ }
+ if (tmp) {
+ BLI_remlink(&ob->actuators, act);
+ BLI_insertlink(&ob->actuators, tmp, act);
+ }
+ }
+}