diff options
author | Joshua Leung <aligorith@gmail.com> | 2010-12-28 08:45:15 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2010-12-28 08:45:15 +0300 |
commit | 71da1e96d174fe23da58af3119ccc7c653357585 (patch) | |
tree | 77b398687fdc61a72867bfcf1884934ec047f284 /source/blender/editors/space_outliner | |
parent | 24ae6f8c91f598581b6f0cd7cc49182e7dcf3959 (diff) |
Drivers Code Cleanups and UI Tweaks:
- Adding drivers from the UI (not from py-scripts though) will now
automatically add a "Transform Channel" driver variable to the newly
created drivers. This makes setting up drivers a bit more convenient
for the most commonly used case.
- Drivers now report their errors using the Reports system instead of
writing these directly to the console.
- Clarified some comments to be more insightful about the "why's" of
some design decisions, and related formatting/cleanup tweaks
- Reduced scope of "path" vars to just the scope they're required in
- Removed some unused defines from a failed experiment in the original
Keying Sets code ("templates" and "template flags") which was
superseeded by the more flexible + nicer "Builtin KeyingSets"
Diffstat (limited to 'source/blender/editors/space_outliner')
-rw-r--r-- | source/blender/editors/space_outliner/outliner.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c index 22304ceeea6..b611322d7e9 100644 --- a/source/blender/editors/space_outliner/outliner.c +++ b/source/blender/editors/space_outliner/outliner.c @@ -3924,7 +3924,7 @@ enum { /* Utilities ---------------------------------- */ /* Recursively iterate over tree, finding and working on selected items */ -static void do_outliner_drivers_editop(SpaceOops *soops, ListBase *tree, short mode) +static void do_outliner_drivers_editop(SpaceOops *soops, ListBase *tree, ReportList *reports, short mode) { TreeElement *te; TreeStoreElem *tselem; @@ -3949,6 +3949,7 @@ static void do_outliner_drivers_editop(SpaceOops *soops, ListBase *tree, short m /* only if ID and path were set, should we perform any actions */ if (id && path) { + short dflags = CREATEDRIVER_WITH_DEFAULT_DVAR; int arraylen = 1; /* array checks */ @@ -3970,13 +3971,13 @@ static void do_outliner_drivers_editop(SpaceOops *soops, ListBase *tree, short m 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); + ANIM_add_driver(reports, id, path, array_index, dflags, 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); + ANIM_remove_driver(reports, id, path, array_index, dflags); } break; } @@ -3991,13 +3992,13 @@ static void do_outliner_drivers_editop(SpaceOops *soops, ListBase *tree, short m /* go over sub-tree */ if ((tselem->flag & TSE_CLOSED)==0) - do_outliner_drivers_editop(soops, &te->subtree, mode); + do_outliner_drivers_editop(soops, &te->subtree, reports, mode); } } /* Add Operator ---------------------------------- */ -static int outliner_drivers_addsel_exec(bContext *C, wmOperator *UNUSED(op)) +static int outliner_drivers_addsel_exec(bContext *C, wmOperator *op) { SpaceOops *soutliner= CTX_wm_space_outliner(C); @@ -4006,10 +4007,10 @@ static int outliner_drivers_addsel_exec(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_CANCELLED; /* recursively go into tree, adding selected items */ - do_outliner_drivers_editop(soutliner, &soutliner->tree, DRIVERS_EDITMODE_ADD); + do_outliner_drivers_editop(soutliner, &soutliner->tree, op->reports, DRIVERS_EDITMODE_ADD); /* send notifiers */ - WM_event_add_notifier(C, ND_KEYS, NULL); // XXX + WM_event_add_notifier(C, NC_ANIMATION|ND_FCURVES_ORDER, NULL); // XXX return OPERATOR_FINISHED; } @@ -4032,7 +4033,7 @@ void OUTLINER_OT_drivers_add_selected(wmOperatorType *ot) /* Remove Operator ---------------------------------- */ -static int outliner_drivers_deletesel_exec(bContext *C, wmOperator *UNUSED(op)) +static int outliner_drivers_deletesel_exec(bContext *C, wmOperator *op) { SpaceOops *soutliner= CTX_wm_space_outliner(C); @@ -4041,7 +4042,7 @@ static int outliner_drivers_deletesel_exec(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_CANCELLED; /* recursively go into tree, adding selected items */ - do_outliner_drivers_editop(soutliner, &soutliner->tree, DRIVERS_EDITMODE_REMOVE); + do_outliner_drivers_editop(soutliner, &soutliner->tree, op->reports, DRIVERS_EDITMODE_REMOVE); /* send notifiers */ WM_event_add_notifier(C, ND_KEYS, NULL); // XXX |