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:
Diffstat (limited to 'source/blender/editors/space_outliner/outliner_edit.c')
-rw-r--r--source/blender/editors/space_outliner/outliner_edit.c314
1 files changed, 157 insertions, 157 deletions
diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c
index 2aa33875bd1..2a694e2e2e3 100644
--- a/source/blender/editors/space_outliner/outliner_edit.c
+++ b/source/blender/editors/space_outliner/outliner_edit.c
@@ -98,19 +98,19 @@ static void outliner_open_reveal(SpaceOops *soops, ListBase *lb, TreeElement *te
{
TreeElement *te;
TreeStoreElem *tselem;
-
+
for (te = lb->first; te; te = te->next) {
/* check if this tree-element was the one we're seeking */
if (te == teFind) {
*found = 1;
return;
}
-
+
/* try to see if sub-tree contains it then */
outliner_open_reveal(soops, &te->subtree, teFind, found);
if (*found) {
tselem = TREESTORE(te);
- if (tselem->flag & TSE_CLOSED)
+ if (tselem->flag & TSE_CLOSED)
tselem->flag &= ~TSE_CLOSED;
return;
}
@@ -193,10 +193,10 @@ void OUTLINER_OT_highlight_update(wmOperatorType *ot)
static int do_outliner_item_openclose(bContext *C, SpaceOops *soops, TreeElement *te, const bool all, const float mval[2])
{
-
+
if (mval[1] > te->ys && mval[1] < te->ys + UI_UNIT_Y) {
TreeStoreElem *tselem = TREESTORE(te);
-
+
/* all below close/open? */
if (all) {
tselem->flag &= ~TSE_CLOSED;
@@ -206,16 +206,16 @@ static int do_outliner_item_openclose(bContext *C, SpaceOops *soops, TreeElement
if (tselem->flag & TSE_CLOSED) tselem->flag &= ~TSE_CLOSED;
else tselem->flag |= TSE_CLOSED;
}
-
+
return 1;
}
-
+
for (te = te->subtree.first; te; te = te->next) {
- if (do_outliner_item_openclose(C, soops, te, all, mval))
+ if (do_outliner_item_openclose(C, soops, te, all, mval))
return 1;
}
return 0;
-
+
}
/* event can enterkey, then it opens/closes */
@@ -226,16 +226,16 @@ static int outliner_item_openclose(bContext *C, wmOperator *op, const wmEvent *e
TreeElement *te;
float fmval[2];
const bool all = RNA_boolean_get(op->ptr, "all");
-
+
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fmval[0], &fmval[1]);
-
+
for (te = soops->tree.first; te; te = te->next) {
- if (do_outliner_item_openclose(C, soops, te, all, fmval))
+ if (do_outliner_item_openclose(C, soops, te, all, fmval))
break;
}
ED_region_tag_redraw(ar);
-
+
return OPERATOR_FINISHED;
}
@@ -244,11 +244,11 @@ void OUTLINER_OT_item_openclose(wmOperatorType *ot)
ot->name = "Open/Close Item";
ot->idname = "OUTLINER_OT_item_openclose";
ot->description = "Toggle whether item under cursor is enabled or closed";
-
+
ot->invoke = outliner_item_openclose;
-
+
ot->poll = ED_operator_outliner_active;
-
+
RNA_def_boolean(ot->srna, "all", 1, "All", "Close or open all items");
}
@@ -311,7 +311,7 @@ static int do_outliner_item_rename(ReportList *reports, ARegion *ar, TreeElement
{
if (mval[1] > te->ys && mval[1] < te->ys + UI_UNIT_Y) {
TreeStoreElem *tselem = TREESTORE(te);
-
+
/* click on name */
if (mval[0] > te->xs + UI_UNIT_X * 2 && mval[0] < te->xend) {
do_item_rename(ar, te, tselem, reports);
@@ -319,7 +319,7 @@ static int do_outliner_item_rename(ReportList *reports, ARegion *ar, TreeElement
}
return 0;
}
-
+
for (te = te->subtree.first; te; te = te->next) {
if (do_outliner_item_rename(reports, ar, te, mval)) return 1;
}
@@ -333,16 +333,16 @@ static int outliner_item_rename(bContext *C, wmOperator *op, const wmEvent *even
TreeElement *te;
float fmval[2];
bool changed = false;
-
+
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fmval[0], &fmval[1]);
-
+
for (te = soops->tree.first; te; te = te->next) {
if (do_outliner_item_rename(op->reports, ar, te, fmval)) {
changed = true;
break;
}
}
-
+
return changed ? OPERATOR_FINISHED : OPERATOR_PASS_THROUGH;
}
@@ -352,9 +352,9 @@ void OUTLINER_OT_item_rename(wmOperatorType *ot)
ot->name = "Rename Item";
ot->idname = "OUTLINER_OT_item_rename";
ot->description = "Rename item under cursor";
-
+
ot->invoke = outliner_item_rename;
-
+
ot->poll = ED_operator_outliner_active;
}
@@ -775,9 +775,9 @@ static int outliner_count_levels(ListBase *lb, const int curlevel)
{
TreeElement *te;
int level = curlevel, lev;
-
+
for (te = lb->first; te; te = te->next) {
-
+
lev = outliner_count_levels(&te->subtree, curlevel + 1);
if (lev > level) level = lev;
}
@@ -789,11 +789,11 @@ int outliner_has_one_flag(ListBase *lb, short flag, const int curlevel)
TreeElement *te;
TreeStoreElem *tselem;
int level;
-
+
for (te = lb->first; te; te = te->next) {
tselem = TREESTORE(te);
if (tselem->flag & flag) return curlevel;
-
+
level = outliner_has_one_flag(&te->subtree, flag, curlevel + 1);
if (level) return level;
}
@@ -850,7 +850,7 @@ int common_restrict_check(bContext *C, Object *ob)
ob->restrictflag &= ~OB_RESTRICT_SELECT;
return 0;
}
-
+
return 1;
}
@@ -863,14 +863,14 @@ static int outliner_toggle_expanded_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceOops *soops = CTX_wm_space_outliner(C);
ARegion *ar = CTX_wm_region(C);
-
+
if (outliner_has_one_flag(&soops->tree, TSE_CLOSED, 1))
outliner_set_flag(&soops->tree, TSE_CLOSED, 0);
- else
+ else
outliner_set_flag(&soops->tree, TSE_CLOSED, 1);
-
+
ED_region_tag_redraw(ar);
-
+
return OPERATOR_FINISHED;
}
@@ -880,11 +880,11 @@ void OUTLINER_OT_expanded_toggle(wmOperatorType *ot)
ot->name = "Expand/Collapse All";
ot->idname = "OUTLINER_OT_expanded_toggle";
ot->description = "Expand/Collapse all items";
-
+
/* callbacks */
ot->exec = outliner_toggle_expanded_exec;
ot->poll = ED_operator_outliner_active;
-
+
/* no undo or registry, UI option */
}
@@ -895,15 +895,15 @@ static int outliner_toggle_selected_exec(bContext *C, wmOperator *UNUSED(op))
SpaceOops *soops = CTX_wm_space_outliner(C);
ARegion *ar = CTX_wm_region(C);
Scene *scene = CTX_data_scene(C);
-
+
if (outliner_has_one_flag(&soops->tree, TSE_SELECTED, 1))
outliner_set_flag(&soops->tree, TSE_SELECTED, 0);
- else
+ else
outliner_set_flag(&soops->tree, TSE_SELECTED, 1);
-
+
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
ED_region_tag_redraw_no_rebuild(ar);
-
+
return OPERATOR_FINISHED;
}
@@ -913,11 +913,11 @@ void OUTLINER_OT_selected_toggle(wmOperatorType *ot)
ot->name = "Toggle Selected";
ot->idname = "OUTLINER_OT_selected_toggle";
ot->description = "Toggle the Outliner selection of items";
-
+
/* callbacks */
ot->exec = outliner_toggle_selected_exec;
ot->poll = ED_operator_outliner_active;
-
+
/* no undo or registry, UI option */
}
@@ -976,7 +976,7 @@ static int outliner_show_active_exec(bContext *C, wmOperator *UNUSED(op))
ViewLayer *view_layer = CTX_data_view_layer(C);
ARegion *ar = CTX_wm_region(C);
View2D *v2d = &ar->v2d;
-
+
TreeElement *te;
int xdelta, ytop;
@@ -1015,18 +1015,18 @@ static int outliner_show_active_exec(bContext *C, wmOperator *UNUSED(op))
/* make te->ys center of view */
ytop = te->ys + BLI_rcti_size_y(&v2d->mask) / 2;
if (ytop > 0) ytop = 0;
-
+
v2d->cur.ymax = (float)ytop;
v2d->cur.ymin = (float)(ytop - BLI_rcti_size_y(&v2d->mask));
-
+
/* make te->xs ==> te->xend center of view */
xdelta = (int)(te->xs - v2d->cur.xmin);
v2d->cur.xmin += xdelta;
v2d->cur.xmax += xdelta;
}
-
+
ED_region_tag_redraw_no_rebuild(ar);
-
+
return OPERATOR_FINISHED;
}
@@ -1036,7 +1036,7 @@ void OUTLINER_OT_show_active(wmOperatorType *ot)
ot->name = "Show Active";
ot->idname = "OUTLINER_OT_show_active";
ot->description = "Open up the tree and adjust the view so that the active Object is shown centered";
-
+
/* callbacks */
ot->exec = outliner_show_active_exec;
ot->poll = ED_operator_outliner_active;
@@ -1049,16 +1049,16 @@ static int outliner_scroll_page_exec(bContext *C, wmOperator *op)
ARegion *ar = CTX_wm_region(C);
int dy = BLI_rcti_size_y(&ar->v2d.mask);
int up = 0;
-
+
if (RNA_boolean_get(op->ptr, "up"))
up = 1;
if (up == 0) dy = -dy;
ar->v2d.cur.ymin += dy;
ar->v2d.cur.ymax += dy;
-
+
ED_region_tag_redraw_no_rebuild(ar);
-
+
return OPERATOR_FINISHED;
}
@@ -1071,11 +1071,11 @@ void OUTLINER_OT_scroll_page(wmOperatorType *ot)
ot->name = "Scroll Page";
ot->idname = "OUTLINER_OT_scroll_page";
ot->description = "Scroll page up or down";
-
+
/* callbacks */
ot->exec = outliner_scroll_page_exec;
ot->poll = ED_operator_outliner_active;
-
+
/* properties */
prop = RNA_def_boolean(ot->srna, "up", 0, "Up", "Scroll up one page");
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
@@ -1091,14 +1091,14 @@ static TreeElement *outliner_find_name(SpaceOops *soops, ListBase *lb, char *nam
TreeElement *prev, int *prevFound)
{
TreeElement *te, *tes;
-
+
for (te = lb->first; te; te = te->next) {
int found = outliner_filter_has_name(te, name, flags);
-
+
if (found) {
/* name is right, but is element the previous one? */
if (prev) {
- if ((te != prev) && (*prevFound))
+ if ((te != prev) && (*prevFound))
return te;
if (te == prev) {
*prevFound = 1;
@@ -1107,7 +1107,7 @@ static TreeElement *outliner_find_name(SpaceOops *soops, ListBase *lb, char *nam
else
return te;
}
-
+
tes = outliner_find_name(soops, &te->subtree, name, flags, prev, prevFound);
if (tes) return tes;
}
@@ -1116,7 +1116,7 @@ static TreeElement *outliner_find_name(SpaceOops *soops, ListBase *lb, char *nam
return NULL;
}
-static void outliner_find_panel(Scene *UNUSED(scene), ARegion *ar, SpaceOops *soops, int again, int flags)
+static void outliner_find_panel(Scene *UNUSED(scene), ARegion *ar, SpaceOops *soops, int again, int flags)
{
ReportList *reports = NULL; // CTX_wm_reports(C);
TreeElement *te = NULL;
@@ -1124,16 +1124,16 @@ static void outliner_find_panel(Scene *UNUSED(scene), ARegion *ar, SpaceOops *so
TreeStoreElem *tselem;
int ytop, xdelta, prevFound = 0;
char name[sizeof(soops->search_string)];
-
+
/* get last found tree-element based on stored search_tse */
last_find = outliner_find_tse(soops, &soops->search_tse);
-
+
/* determine which type of search to do */
if (again && last_find) {
/* no popup panel - previous + user wanted to search for next after previous */
BLI_strncpy(name, soops->search_string, sizeof(name));
flags = soops->search_flags;
-
+
/* try to find matching element */
te = outliner_find_name(soops, &soops->tree, name, flags, last_find, &prevFound);
if (te == NULL) {
@@ -1158,28 +1158,28 @@ static void outliner_find_panel(Scene *UNUSED(scene), ARegion *ar, SpaceOops *so
/* expand branches so that it will be visible, we need to get correct coordinates */
if (outliner_open_back(soops, te))
outliner_set_coordinates(ar, soops);
-
+
/* deselect all visible, and select found element */
outliner_set_flag(soops, &soops->tree, TSE_SELECTED, 0);
tselem->flag |= TSE_SELECTED;
-
+
/* make te->ys center of view */
ytop = (int)(te->ys + BLI_rctf_size_y(&ar->v2d.mask) / 2);
if (ytop > 0) ytop = 0;
ar->v2d.cur.ymax = (float)ytop;
ar->v2d.cur.ymin = (float)(ytop - BLI_rctf_size_y(&ar->v2d.mask));
-
+
/* make te->xs ==> te->xend center of view */
xdelta = (int)(te->xs - ar->v2d.cur.xmin);
ar->v2d.cur.xmin += xdelta;
ar->v2d.cur.xmax += xdelta;
-
+
/* store selection */
soops->search_tse = *tselem;
-
+
BLI_strncpy(soops->search_string, name, sizeof(soops->search_string));
soops->search_flags = flags;
-
+
/* redraw */
ED_region_tag_redraw_no_rebuild(ar);
}
@@ -1198,17 +1198,17 @@ static void outliner_openclose_level(ListBase *lb, int curlevel, int level, int
{
TreeElement *te;
TreeStoreElem *tselem;
-
+
for (te = lb->first; te; te = te->next) {
tselem = TREESTORE(te);
-
+
if (open) {
if (curlevel <= level) tselem->flag &= ~TSE_CLOSED;
}
else {
if (curlevel >= level) tselem->flag |= TSE_CLOSED;
}
-
+
outliner_openclose_level(&te->subtree, curlevel + 1, level, open);
}
}
@@ -1219,7 +1219,7 @@ static int outliner_one_level_exec(bContext *C, wmOperator *op)
ARegion *ar = CTX_wm_region(C);
const bool add = RNA_boolean_get(op->ptr, "open");
int level;
-
+
level = outliner_has_one_flag(&soops->tree, TSE_CLOSED, 1);
if (add == 1) {
if (level) outliner_openclose_level(&soops->tree, 1, level, 1);
@@ -1228,9 +1228,9 @@ static int outliner_one_level_exec(bContext *C, wmOperator *op)
if (level == 0) level = outliner_count_levels(&soops->tree, 0);
if (level) outliner_openclose_level(&soops->tree, 1, level - 1, 0);
}
-
+
ED_region_tag_redraw(ar);
-
+
return OPERATOR_FINISHED;
}
@@ -1242,13 +1242,13 @@ void OUTLINER_OT_show_one_level(wmOperatorType *ot)
ot->name = "Show/Hide One Level";
ot->idname = "OUTLINER_OT_show_one_level";
ot->description = "Expand/collapse all entries by one level";
-
+
/* callbacks */
ot->exec = outliner_one_level_exec;
ot->poll = ED_operator_outliner_active;
-
+
/* no undo or registry, UI option */
-
+
/* properties */
prop = RNA_def_boolean(ot->srna, "open", 1, "Open", "Expand all entries one level deep");
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
@@ -1261,7 +1261,7 @@ static int subtree_has_objects(ListBase *lb)
{
TreeElement *te;
TreeStoreElem *tselem;
-
+
for (te = lb->first; te; te = te->next) {
tselem = TREESTORE(te);
if (tselem->type == 0 && te->idcode == ID_OB) return 1;
@@ -1279,7 +1279,7 @@ static void tree_element_show_hierarchy(Scene *scene, SpaceOops *soops, ListBase
/* open all object elems, close others */
for (te = lb->first; te; te = te->next) {
tselem = TREESTORE(te);
-
+
if (tselem->type == 0) {
if (te->idcode == ID_SCE) {
if (tselem->id != (ID *)scene) tselem->flag |= TSE_CLOSED;
@@ -1306,12 +1306,12 @@ static int outliner_show_hierarchy_exec(bContext *C, wmOperator *UNUSED(op))
SpaceOops *soops = CTX_wm_space_outliner(C);
ARegion *ar = CTX_wm_region(C);
Scene *scene = CTX_data_scene(C);
-
+
/* recursively open/close levels */
tree_element_show_hierarchy(scene, soops, &soops->tree);
-
+
ED_region_tag_redraw(ar);
-
+
return OPERATOR_FINISHED;
}
@@ -1321,11 +1321,11 @@ void OUTLINER_OT_show_hierarchy(wmOperatorType *ot)
ot->name = "Show Hierarchy";
ot->idname = "OUTLINER_OT_show_hierarchy";
ot->description = "Open all object entries and close all others";
-
+
/* callbacks */
ot->exec = outliner_show_hierarchy_exec;
ot->poll = ED_operator_outliner_active; // TODO: shouldn't be allowed in RNA views...
-
+
/* no undo or registry, UI option */
}
@@ -1345,7 +1345,7 @@ static int ed_operator_outliner_datablocks_active(bContext *C)
}
-/* Helper func to extract an RNA path from selected tree element
+/* Helper func to extract an RNA path from selected tree element
* NOTE: the caller must zero-out all values of the pointers that it passes here first, as
* this function does not do that yet
*/
@@ -1359,29 +1359,29 @@ static void tree_element_to_path(TreeElement *te, TreeStoreElem *tselem,
PointerRNA *ptr, *nextptr;
PropertyRNA *prop;
char *newpath = NULL;
-
+
/* optimize tricks:
* - Don't do anything if the selected item is a 'struct', but arrays are allowed
*/
if (tselem->type == TSE_RNA_STRUCT)
return;
-
+
/* Overview of Algorithm:
* 1. Go up the chain of parents until we find the 'root', taking note of the
* levels encountered in reverse-order (i.e. items are added to the start of the list
* for more convenient looping later)
* 2. Walk down the chain, adding from the first ID encountered
- * (which will become the 'ID' for the KeyingSet Path), and build a
+ * (which will become the 'ID' for the KeyingSet Path), and build a
* path as we step through the chain
*/
-
+
/* step 1: flatten out hierarchy of parents into a flat chain */
for (tem = te->parent; tem; tem = tem->parent) {
ld = MEM_callocN(sizeof(LinkData), "LinkData for tree_element_to_path()");
ld->data = tem;
BLI_addhead(&hierarchy, ld);
}
-
+
/* step 2: step down hierarchy building the path
* (NOTE: addhead in previous loop was needed so that we can loop like this) */
for (ld = hierarchy.first; ld; ld = ld->next) {
@@ -1390,10 +1390,10 @@ static void tree_element_to_path(TreeElement *te, TreeStoreElem *tselem,
tse = TREESTORE(tem);
ptr = &tem->rnaptr;
prop = tem->directdata;
-
+
/* check if we're looking for first ID, or appending to path */
if (*id) {
- /* just 'append' property to path
+ /* just 'append' property to path
* - to prevent memory leaks, we must write to newpath not path, then free old path + swap them
*/
if (tse->type == TSE_RNA_PROPERTY) {
@@ -1403,35 +1403,35 @@ static void tree_element_to_path(TreeElement *te, TreeStoreElem *tselem,
}
else if (RNA_property_type(prop) == PROP_COLLECTION) {
char buf[128], *name;
-
+
temnext = (TreeElement *)(ld->next->data);
/* tsenext = TREESTORE(temnext); */ /* UNUSED */
-
+
nextptr = &temnext->rnaptr;
name = RNA_struct_name_get_alloc(nextptr, buf, sizeof(buf), NULL);
-
+
if (name) {
/* if possible, use name as a key in the path */
newpath = RNA_path_append(*path, NULL, prop, 0, name);
-
+
if (name != buf)
MEM_freeN(name);
}
else {
/* otherwise use index */
int index = 0;
-
+
for (temsub = tem->subtree.first; temsub; temsub = temsub->next, index++)
if (temsub == temnext)
break;
-
+
newpath = RNA_path_append(*path, NULL, prop, index, NULL);
}
-
+
ld = ld->next;
}
}
-
+
if (newpath) {
if (*path) MEM_freeN(*path);
*path = newpath;
@@ -1445,7 +1445,7 @@ static void tree_element_to_path(TreeElement *te, TreeStoreElem *tselem,
* since ptr->data is sometimes the owner of this ID? */
if (RNA_struct_is_ID(ptr->type)) {
*id = (ID *)ptr->data;
-
+
/* clear path */
if (*path) {
MEM_freeN(*path);
@@ -1461,7 +1461,7 @@ static void tree_element_to_path(TreeElement *te, TreeStoreElem *tselem,
/* add the active property to the path */
ptr = &te->rnaptr;
prop = te->directdata;
-
+
/* array checks */
if (tselem->type == TSE_RNA_ARRAY_ELEM) {
/* item is part of an array, so must set the array_index */
@@ -1471,7 +1471,7 @@ static void tree_element_to_path(TreeElement *te, TreeStoreElem *tselem,
/* entire array was selected, so keyframe all */
*flag |= KSP_FLAG_WHOLE_ARRAY;
}
-
+
/* path */
newpath = RNA_path_append(*path, NULL, prop, 0, NULL);
if (*path) MEM_freeN(*path);
@@ -1493,17 +1493,17 @@ enum {
DRIVERS_EDITMODE_REMOVE,
} /*eDrivers_EditModes*/;
-/* Utilities ---------------------------------- */
+/* Utilities ---------------------------------- */
/* Recursively iterate over tree, finding and working on selected items */
static void do_outliner_drivers_editop(SpaceOops *soops, ListBase *tree, ReportList *reports, short mode)
{
TreeElement *te;
TreeStoreElem *tselem;
-
+
for (te = tree->first; te; te = te->next) {
tselem = TREESTORE(te);
-
+
/* if item is selected, perform operation */
if (tselem->flag & TSE_SELECTED) {
ID *id = NULL;
@@ -1511,7 +1511,7 @@ static void do_outliner_drivers_editop(SpaceOops *soops, ListBase *tree, ReportL
int array_index = 0;
short flag = 0;
short groupmode = KSP_GROUP_KSNAME;
-
+
/* check if RNA-property described by this selected element is an animatable prop */
if (ELEM(tselem->type, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM) &&
RNA_property_animateable(&te->rnaptr, te->directdata))
@@ -1520,12 +1520,12 @@ static void do_outliner_drivers_editop(SpaceOops *soops, ListBase *tree, ReportL
tree_element_to_path(te, tselem,
&id, &path, &array_index, &flag, &groupmode);
}
-
+
/* 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 */
if (flag & KSP_FLAG_WHOLE_ARRAY) {
/* entire array was selected, so add drivers for all */
@@ -1533,11 +1533,11 @@ static void do_outliner_drivers_editop(SpaceOops *soops, ListBase *tree, ReportL
}
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 */
@@ -1556,14 +1556,14 @@ static void do_outliner_drivers_editop(SpaceOops *soops, ListBase *tree, ReportL
}
}
}
-
+
/* free path, since it had to be generated */
MEM_freeN(path);
}
-
-
+
+
}
-
+
/* go over sub-tree */
if (TSELEM_OPEN(tselem, soops))
do_outliner_drivers_editop(soops, &te->subtree, reports, mode);
@@ -1575,17 +1575,17 @@ static void do_outliner_drivers_editop(SpaceOops *soops, ListBase *tree, ReportL
static int outliner_drivers_addsel_exec(bContext *C, wmOperator *op)
{
SpaceOops *soutliner = CTX_wm_space_outliner(C);
-
+
/* check for invalid states */
if (soutliner == NULL)
return OPERATOR_CANCELLED;
-
+
/* recursively go into tree, adding selected items */
do_outliner_drivers_editop(soutliner, &soutliner->tree, op->reports, DRIVERS_EDITMODE_ADD);
-
+
/* send notifiers */
WM_event_add_notifier(C, NC_ANIMATION | ND_FCURVES_ORDER, NULL); // XXX
-
+
return OPERATOR_FINISHED;
}
@@ -1595,11 +1595,11 @@ void OUTLINER_OT_drivers_add_selected(wmOperatorType *ot)
ot->idname = "OUTLINER_OT_drivers_add_selected";
ot->name = "Add Drivers for Selected";
ot->description = "Add drivers to selected items";
-
+
/* api callbacks */
ot->exec = outliner_drivers_addsel_exec;
ot->poll = ed_operator_outliner_datablocks_active;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
@@ -1610,17 +1610,17 @@ void OUTLINER_OT_drivers_add_selected(wmOperatorType *ot)
static int outliner_drivers_deletesel_exec(bContext *C, wmOperator *op)
{
SpaceOops *soutliner = CTX_wm_space_outliner(C);
-
+
/* check for invalid states */
if (soutliner == NULL)
return OPERATOR_CANCELLED;
-
+
/* recursively go into tree, adding selected items */
do_outliner_drivers_editop(soutliner, &soutliner->tree, op->reports, DRIVERS_EDITMODE_REMOVE);
-
+
/* send notifiers */
WM_event_add_notifier(C, ND_KEYS, NULL); // XXX
-
+
return OPERATOR_FINISHED;
}
@@ -1630,11 +1630,11 @@ void OUTLINER_OT_drivers_delete_selected(wmOperatorType *ot)
ot->idname = "OUTLINER_OT_drivers_delete_selected";
ot->name = "Delete Drivers for Selected";
ot->description = "Delete drivers assigned to selected items";
-
+
/* api callbacks */
ot->exec = outliner_drivers_deletesel_exec;
ot->poll = ed_operator_outliner_datablocks_active;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
@@ -1650,29 +1650,29 @@ enum {
KEYINGSET_EDITMODE_REMOVE,
} /*eKeyingSet_EditModes*/;
-/* Utilities ---------------------------------- */
-
+/* Utilities ---------------------------------- */
+
/* find the 'active' KeyingSet, and add if not found (if adding is allowed) */
// TODO: should this be an API func?
static KeyingSet *verify_active_keyingset(Scene *scene, short add)
{
KeyingSet *ks = NULL;
-
+
/* sanity check */
if (scene == NULL)
return NULL;
-
+
/* try to find one from scene */
if (scene->active_keyingset > 0)
ks = BLI_findlink(&scene->keyingsets, scene->active_keyingset - 1);
-
+
/* add if none found */
// XXX the default settings have yet to evolve
if ((add) && (ks == NULL)) {
ks = BKE_keyingset_add(&scene->keyingsets, NULL, NULL, KEYINGSET_ABSOLUTE, 0);
scene->active_keyingset = BLI_listbase_count(&scene->keyingsets);
}
-
+
return ks;
}
@@ -1681,10 +1681,10 @@ static void do_outliner_keyingset_editop(SpaceOops *soops, KeyingSet *ks, ListBa
{
TreeElement *te;
TreeStoreElem *tselem;
-
+
for (te = tree->first; te; te = te->next) {
tselem = TREESTORE(te);
-
+
/* if item is selected, perform operation */
if (tselem->flag & TSE_SELECTED) {
ID *id = NULL;
@@ -1692,7 +1692,7 @@ static void do_outliner_keyingset_editop(SpaceOops *soops, KeyingSet *ks, ListBa
int array_index = 0;
short flag = 0;
short groupmode = KSP_GROUP_KSNAME;
-
+
/* check if RNA-property described by this selected element is an animatable prop */
if (ELEM(tselem->type, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM) &&
RNA_property_animateable(&te->rnaptr, te->directdata))
@@ -1701,7 +1701,7 @@ static void do_outliner_keyingset_editop(SpaceOops *soops, KeyingSet *ks, ListBa
tree_element_to_path(te, tselem,
&id, &path, &array_index, &flag, &groupmode);
}
-
+
/* only if ID and path were set, should we perform any actions */
if (id && path) {
/* action depends on mode */
@@ -1719,7 +1719,7 @@ static void do_outliner_keyingset_editop(SpaceOops *soops, KeyingSet *ks, ListBa
{
/* find the relevant path, then remove it from the KeyingSet */
KS_Path *ksp = BKE_keyingset_find_path(ks, id, NULL, path, array_index, groupmode);
-
+
if (ksp) {
/* free path's data */
BKE_keyingset_free_path(ks, ksp);
@@ -1729,12 +1729,12 @@ static void do_outliner_keyingset_editop(SpaceOops *soops, KeyingSet *ks, ListBa
break;
}
}
-
+
/* free path, since it had to be generated */
MEM_freeN(path);
}
}
-
+
/* go over sub-tree */
if (TSELEM_OPEN(tselem, soops))
do_outliner_keyingset_editop(soops, ks, &te->subtree, mode);
@@ -1748,7 +1748,7 @@ static int outliner_keyingset_additems_exec(bContext *C, wmOperator *op)
SpaceOops *soutliner = CTX_wm_space_outliner(C);
Scene *scene = CTX_data_scene(C);
KeyingSet *ks = verify_active_keyingset(scene, 1);
-
+
/* check for invalid states */
if (ks == NULL) {
BKE_report(op->reports, RPT_ERROR, "Operation requires an active keying set");
@@ -1756,13 +1756,13 @@ static int outliner_keyingset_additems_exec(bContext *C, wmOperator *op)
}
if (soutliner == NULL)
return OPERATOR_CANCELLED;
-
+
/* recursively go into tree, adding selected items */
do_outliner_keyingset_editop(soutliner, ks, &soutliner->tree, KEYINGSET_EDITMODE_ADD);
-
+
/* send notifiers */
WM_event_add_notifier(C, NC_SCENE | ND_KEYINGSET, NULL);
-
+
return OPERATOR_FINISHED;
}
@@ -1772,11 +1772,11 @@ void OUTLINER_OT_keyingset_add_selected(wmOperatorType *ot)
ot->idname = "OUTLINER_OT_keyingset_add_selected";
ot->name = "Keying Set Add Selected";
ot->description = "Add selected items (blue-gray rows) to active Keying Set";
-
+
/* api callbacks */
ot->exec = outliner_keyingset_additems_exec;
ot->poll = ed_operator_outliner_datablocks_active;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
@@ -1789,17 +1789,17 @@ static int outliner_keyingset_removeitems_exec(bContext *C, wmOperator *UNUSED(o
SpaceOops *soutliner = CTX_wm_space_outliner(C);
Scene *scene = CTX_data_scene(C);
KeyingSet *ks = verify_active_keyingset(scene, 1);
-
+
/* check for invalid states */
if (soutliner == NULL)
return OPERATOR_CANCELLED;
-
+
/* recursively go into tree, adding selected items */
do_outliner_keyingset_editop(soutliner, ks, &soutliner->tree, KEYINGSET_EDITMODE_REMOVE);
-
+
/* send notifiers */
WM_event_add_notifier(C, NC_SCENE | ND_KEYINGSET, NULL);
-
+
return OPERATOR_FINISHED;
}
@@ -1809,11 +1809,11 @@ void OUTLINER_OT_keyingset_remove_selected(wmOperatorType *ot)
ot->idname = "OUTLINER_OT_keyingset_remove_selected";
ot->name = "Keying Set Remove Selected";
ot->description = "Remove selected items (blue-gray rows) from active Keying Set";
-
+
/* api callbacks */
ot->exec = outliner_keyingset_removeitems_exec;
ot->poll = ed_operator_outliner_datablocks_active;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
@@ -1849,7 +1849,7 @@ static int outliner_orphans_purge_exec(bContext *C, wmOperator *UNUSED(op))
* are retained...
*/
WM_operator_name_call(C, "WM_OT_save_mainfile", WM_OP_EXEC_DEFAULT, NULL);
-
+
/* Now, reload the file to get rid of the orphans... */
WM_operator_name_call(C, "WM_OT_revert_mainfile", WM_OP_EXEC_DEFAULT, NULL);
return OPERATOR_FINISHED;
@@ -1862,12 +1862,12 @@ void OUTLINER_OT_orphans_purge(wmOperatorType *ot)
ot->name = "Purge All";
ot->description = "Clear all orphaned data-blocks without any users from the file "
"(cannot be undone, saves to current .blend file)";
-
+
/* callbacks */
ot->invoke = outliner_orphans_purge_invoke;
ot->exec = outliner_orphans_purge_exec;
ot->poll = ed_operator_outliner_id_orphans_active;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
@@ -1931,7 +1931,7 @@ static int parent_drop_invoke(bContext *C, wmOperator *op, const wmEvent *event)
ob = (Object *)BKE_libblock_find_name(bmain, ID_OB, childname);
RNA_string_get(op->ptr, "parent", parname);
par = (Object *)BKE_libblock_find_name(bmain, ID_OB, parname);
-
+
if (ELEM(NULL, ob, par)) {
if (par == NULL) printf("par==NULL\n");
return OPERATOR_CANCELLED;
@@ -1943,7 +1943,7 @@ static int parent_drop_invoke(bContext *C, wmOperator *op, const wmEvent *event)
BKE_report(op->reports, RPT_INFO, "Can't edit library linked object");
return OPERATOR_CANCELLED;
}
-
+
scene = (Scene *)outliner_search_back(soops, te, ID_SCE);
if (scene == NULL) {
@@ -1968,7 +1968,7 @@ static int parent_drop_invoke(bContext *C, wmOperator *op, const wmEvent *event)
uiPopupMenu *pup = UI_popup_menu_begin(C, IFACE_("Set Parent To"), ICON_NONE);
uiLayout *layout = UI_popup_menu_layout(pup);
PointerRNA ptr;
-
+
/* Cannot use uiItemEnumO()... have multiple properties to set. */
uiItemFullO_ptr(layout, ot, IFACE_("Object"), 0, NULL, WM_OP_EXEC_DEFAULT, 0, &ptr);
RNA_string_set(&ptr, "parent", parname);
@@ -2024,9 +2024,9 @@ static int parent_drop_invoke(bContext *C, wmOperator *op, const wmEvent *event)
RNA_string_set(&ptr, "child", childname);
RNA_enum_set(&ptr, "type", PAR_LATTICE);
}
-
+
UI_popup_menu_end(C, pup);
-
+
return OPERATOR_INTERFACE;
}
}