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
path: root/source
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2009-10-21 09:59:51 +0400
committerJoshua Leung <aligorith@gmail.com>2009-10-21 09:59:51 +0400
commitddb1f64fff1c4ea9c0f93e71d89996d1144af671 (patch)
tree2fc387410aa72fa44f4af3532035710feb830deb /source
parent908061378c9dd56bd2f1408ac0d3072c5464c72d (diff)
Outliner: Tweaks for Driver Operators
* Driver adding/removing operators in the Outliner now work properly for arrays * Renamed these operators so that their names are more indicative of how they work (i.e. based on the data in the Outliner that is selected) * Added a menu labelled 'Edit' in the Datablocks view which gives access to (and includes the hotkeys for) these tools.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/space_outliner/outliner.c60
-rw-r--r--source/blender/editors/space_outliner/outliner_intern.h4
-rw-r--r--source/blender/editors/space_outliner/outliner_ops.c8
3 files changed, 45 insertions, 27 deletions
diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c
index 2612f8a024c..5e67e9372fc 100644
--- a/source/blender/editors/space_outliner/outliner.c
+++ b/source/blender/editors/space_outliner/outliner.c
@@ -3771,21 +3771,39 @@ static void do_outliner_drivers_editop(SpaceOops *soops, ListBase *tree, short m
}
/* only if ID and path were set, should we perform any actions */
+ // FIXME: if whole array flag is set, mus add the entire array
if (id && path) {
- /* action depends on mode */
- switch (mode) {
- case DRIVERS_EDITMODE_ADD:
- {
- /* add a new driver with the information obtained (only if valid) */
- ANIM_add_driver(id, path, array_index, flag, DRIVER_TYPE_AVERAGE);
- }
- break;
- case DRIVERS_EDITMODE_REMOVE:
- {
- /* remove driver matching the information obtained (only if valid) */
- ANIM_remove_driver(id, path, array_index, flag);
+ int arraylen, i;
+
+ /* array checks */
+ if (flag & KSP_FLAG_WHOLE_ARRAY) {
+ /* entire array was selected, so add drivers for all */
+ arraylen= RNA_property_array_length(&te->rnaptr, te->directdata);
+ }
+ else
+ arraylen= array_index;
+
+ /* we should do at least one step */
+ if (arraylen == array_index)
+ arraylen++;
+
+ /* for each array element we should affect, add driver */
+ for (; array_index < arraylen; array_index++) {
+ /* action depends on mode */
+ switch (mode) {
+ case DRIVERS_EDITMODE_ADD:
+ {
+ /* add a new driver with the information obtained (only if valid) */
+ ANIM_add_driver(id, path, array_index, flag, DRIVER_TYPE_PYTHON);
+ }
+ break;
+ case DRIVERS_EDITMODE_REMOVE:
+ {
+ /* remove driver matching the information obtained (only if valid) */
+ ANIM_remove_driver(id, path, array_index, flag);
+ }
+ break;
}
- break;
}
/* free path, since it had to be generated */
@@ -3815,16 +3833,16 @@ static int outliner_drivers_addsel_exec(bContext *C, wmOperator *op)
do_outliner_drivers_editop(soutliner, &soutliner->tree, DRIVERS_EDITMODE_ADD);
/* send notifiers */
- WM_event_add_notifier(C, NC_SCENE|ND_KEYINGSET, NULL);
+ WM_event_add_notifier(C, ND_KEYS, NULL); // XXX
return OPERATOR_FINISHED;
}
-void OUTLINER_OT_drivers_add(wmOperatorType *ot)
+void OUTLINER_OT_drivers_add_selected(wmOperatorType *ot)
{
/* api callbacks */
- ot->idname= "OUTLINER_OT_drivers_add";
- ot->name= "Add Drivers";
+ ot->idname= "OUTLINER_OT_drivers_add_selected";
+ ot->name= "Add Drivers for Selected";
ot->description= "Add drivers to selected items.";
/* api callbacks */
@@ -3850,16 +3868,16 @@ static int outliner_drivers_deletesel_exec(bContext *C, wmOperator *op)
do_outliner_drivers_editop(soutliner, &soutliner->tree, DRIVERS_EDITMODE_REMOVE);
/* send notifiers */
- WM_event_add_notifier(C, NC_SCENE|ND_KEYINGSET, NULL);
+ WM_event_add_notifier(C, ND_KEYS, NULL); // XXX
return OPERATOR_FINISHED;
}
-void OUTLINER_OT_drivers_delete(wmOperatorType *ot)
+void OUTLINER_OT_drivers_delete_selected(wmOperatorType *ot)
{
/* identifiers */
- ot->idname= "OUTLINER_OT_drivers_delete";
- ot->name= "Delete Drivers";
+ ot->idname= "OUTLINER_OT_drivers_delete_selected";
+ ot->name= "Delete Drivers for Selected";
ot->description= "Delete drivers assigned to selected items.";
/* api callbacks */
diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h
index c71b5181d16..a1fc2f11bc4 100644
--- a/source/blender/editors/space_outliner/outliner_intern.h
+++ b/source/blender/editors/space_outliner/outliner_intern.h
@@ -143,8 +143,8 @@ void OUTLINER_OT_visibility_toggle(struct wmOperatorType *ot);
void OUTLINER_OT_keyingset_add_selected(struct wmOperatorType *ot);
void OUTLINER_OT_keyingset_remove_selected(struct wmOperatorType *ot);
-void OUTLINER_OT_drivers_add(struct wmOperatorType *ot);
-void OUTLINER_OT_drivers_delete(struct wmOperatorType *ot);
+void OUTLINER_OT_drivers_add_selected(struct wmOperatorType *ot);
+void OUTLINER_OT_drivers_delete_selected(struct wmOperatorType *ot);
#if 0
extern void outliner_mouse_event(Scene *scene, ARegion *ar, SpaceOops *soops, short event);
diff --git a/source/blender/editors/space_outliner/outliner_ops.c b/source/blender/editors/space_outliner/outliner_ops.c
index 3cdd054fe0e..431801d50f2 100644
--- a/source/blender/editors/space_outliner/outliner_ops.c
+++ b/source/blender/editors/space_outliner/outliner_ops.c
@@ -70,8 +70,8 @@ void outliner_operatortypes(void)
WM_operatortype_append(OUTLINER_OT_keyingset_add_selected);
WM_operatortype_append(OUTLINER_OT_keyingset_remove_selected);
- WM_operatortype_append(OUTLINER_OT_drivers_add);
- WM_operatortype_append(OUTLINER_OT_drivers_delete);
+ WM_operatortype_append(OUTLINER_OT_drivers_add_selected);
+ WM_operatortype_append(OUTLINER_OT_drivers_delete_selected);
}
void outliner_keymap(wmKeyConfig *keyconf)
@@ -110,7 +110,7 @@ void outliner_keymap(wmKeyConfig *keyconf)
WM_keymap_verify_item(keymap, "ANIM_OT_insert_keyframe", IKEY, KM_PRESS, 0, 0);
WM_keymap_verify_item(keymap, "ANIM_OT_delete_keyframe", IKEY, KM_PRESS, KM_ALT, 0);
- WM_keymap_verify_item(keymap, "OUTLINER_OT_drivers_add", DKEY, KM_PRESS, 0, 0);
- WM_keymap_verify_item(keymap, "OUTLINER_OT_drivers_delete", DKEY, KM_PRESS, KM_ALT, 0);
+ WM_keymap_verify_item(keymap, "OUTLINER_OT_drivers_add_selected", DKEY, KM_PRESS, 0, 0);
+ WM_keymap_verify_item(keymap, "OUTLINER_OT_drivers_delete_selected", DKEY, KM_PRESS, KM_ALT, 0);
}