diff options
Diffstat (limited to 'source/blender/editors/space_outliner')
8 files changed, 515 insertions, 515 deletions
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index 2a6fedde065..57fa9353e68 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -105,7 +105,7 @@ static void outliner_width(SpaceOops *soops, ListBase *lb, int *w) TreeElement *te = lb->first; while (te) { // TreeStoreElem *tselem = TREESTORE(te); - + // XXX fixme... te->xend is not set yet if (!TSELEM_OPEN(tselem, soops)) { if (te->xend > *w) @@ -159,7 +159,7 @@ static void restrictbutton_recursive_ebone(bContext *C, EditBone *ebone_parent, Object *obedit = CTX_data_edit_object(C); bArmature *arm = obedit->data; EditBone *ebone; - + for (ebone = arm->edbo->first; ebone; ebone = ebone->next) { if (ED_armature_ebone_is_child_recursive(ebone_parent, ebone)) { if (set_flag) { @@ -197,7 +197,7 @@ static void restrictbutton_r_lay_cb(bContext *C, void *poin, void *UNUSED(poin2) static void restrictbutton_modifier_cb(bContext *C, void *UNUSED(poin), void *poin2) { Object *ob = (Object *)poin2; - + DEG_id_tag_update(&ob->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob); } @@ -265,9 +265,9 @@ static void restrictbutton_gp_layer_flag_cb(bContext *C, void *UNUSED(poin), voi static void restrictbutton_id_user_toggle(bContext *UNUSED(C), void *poin, void *UNUSED(poin2)) { ID *id = (ID *)poin; - + BLI_assert(id != NULL); - + if (id->flag & LIB_FAKEUSER) { id_us_plus(id); } @@ -283,13 +283,13 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname) Object *obedit = CTX_data_edit_object(C); BLI_mempool *ts = soops->treestore; TreeStoreElem *tselem = tsep; - + if (ts && tselem) { TreeElement *te = outliner_find_tree_element(&soops->tree, tselem); - + if (tselem->type == 0) { BLI_libblock_ensure_unique_name(bmain, tselem->id->name); - + switch (GS(tselem->id->name)) { case ID_MA: WM_event_add_notifier(C, NC_MATERIAL, NULL); break; @@ -353,10 +353,10 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname) bArmature *arm = (bArmature *)tselem->id; Bone *bone = te->directdata; char newname[sizeof(bone->name)]; - + /* always make current object active */ tree_element_active(C, scene, view_layer, soops, te, OL_SETSEL_NORMAL, true); - + /* restore bone name */ BLI_strncpy(newname, bone->name, sizeof(bone->name)); BLI_strncpy(bone->name, oldname, sizeof(bone->name)); @@ -371,12 +371,12 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname) Object *ob = (Object *)tselem->id; bPoseChannel *pchan = te->directdata; char newname[sizeof(pchan->name)]; - + /* always make current pose-bone active */ tree_element_active(C, scene, view_layer, soops, te, OL_SETSEL_NORMAL, true); BLI_assert(ob->type == OB_ARMATURE); - + /* restore bone name */ BLI_strncpy(newname, pchan->name, sizeof(pchan->name)); BLI_strncpy(pchan->name, oldname, sizeof(pchan->name)); @@ -388,7 +388,7 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname) { Object *ob = (Object *)tselem->id; // id = object bActionGroup *grp = te->directdata; - + BLI_uniquename(&ob->pose->agroups, grp, CTX_DATA_(BLT_I18NCONTEXT_ID_ACTION, "Group"), '.', offsetof(bActionGroup, name), sizeof(grp->name)); WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob); @@ -398,7 +398,7 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname) { bGPdata *gpd = (bGPdata *)tselem->id; // id = GP Datablock bGPDlayer *gpl = te->directdata; - + // XXX: name needs translation stuff BLI_uniquename(&gpd->layers, gpl, "GP Layer", '.', offsetof(bGPDlayer, info), sizeof(gpl->info)); @@ -433,7 +433,7 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname) } static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar, SpaceOops *soops, ListBase *lb) -{ +{ uiBut *bt; TreeElement *te; TreeStoreElem *tselem; @@ -458,19 +458,19 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar ViewLayer *view_layer = te->directdata; UI_block_emboss_set(block, UI_EMBOSS_NONE); - + bt = uiDefIconButBitS(block, UI_BTYPE_ICON_TOGGLE_N, VIEW_LAYER_RENDER, 0, ICON_RESTRICT_RENDER_OFF, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_RENDERX), te->ys, UI_UNIT_X, UI_UNIT_Y, &view_layer->flag, 0, 0, 0, 0, TIP_("Use view layer for rendering")); UI_but_func_set(bt, restrictbutton_r_lay_cb, tselem->id, NULL); UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); - + UI_block_emboss_set(block, UI_EMBOSS); } else if (tselem->type == TSE_MODIFIER) { ModifierData *md = (ModifierData *)te->directdata; ob = (Object *)tselem->id; - + UI_block_emboss_set(block, UI_EMBOSS_NONE); bt = uiDefIconButBitI(block, UI_BTYPE_ICON_TOGGLE_N, eModifierMode_Realtime, 0, ICON_RESTRICT_VIEW_OFF, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X, @@ -478,7 +478,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar TIP_("Restrict/Allow visibility in the 3D View")); UI_but_func_set(bt, restrictbutton_modifier_cb, scene, ob); UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); - + bt = uiDefIconButBitI(block, UI_BTYPE_ICON_TOGGLE_N, eModifierMode_Render, 0, ICON_RESTRICT_RENDER_OFF, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_RENDERX), te->ys, UI_UNIT_X, UI_UNIT_Y, &(md->mode), 0, 0, 0, 0, TIP_("Restrict/Allow renderability")); @@ -491,7 +491,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar bPoseChannel *pchan = (bPoseChannel *)te->directdata; Bone *bone = pchan->bone; ob = (Object *)tselem->id; - + UI_block_emboss_set(block, UI_EMBOSS_NONE); bt = uiDefIconButBitI(block, UI_BTYPE_ICON_TOGGLE, BONE_HIDDEN_P, 0, ICON_RESTRICT_VIEW_OFF, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X, @@ -499,7 +499,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar TIP_("Restrict/Allow visibility in the 3D View")); UI_but_func_set(bt, restrictbutton_bone_visibility_cb, ob->data, bone); UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); - + bt = uiDefIconButBitI(block, UI_BTYPE_ICON_TOGGLE, BONE_UNSELECTABLE, 0, ICON_RESTRICT_SELECT_OFF, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), te->ys, UI_UNIT_X, UI_UNIT_Y, &(bone->flag), 0, 0, 0, 0, @@ -511,7 +511,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar } else if (tselem->type == TSE_EBONE) { EditBone *ebone = (EditBone *)te->directdata; - + UI_block_emboss_set(block, UI_EMBOSS_NONE); bt = uiDefIconButBitI(block, UI_BTYPE_ICON_TOGGLE, BONE_HIDDEN_A, 0, ICON_RESTRICT_VIEW_OFF, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X, @@ -519,7 +519,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar TIP_("Restrict/Allow visibility in the 3D View")); UI_but_func_set(bt, restrictbutton_ebone_visibility_cb, NULL, ebone); UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); - + bt = uiDefIconButBitI(block, UI_BTYPE_ICON_TOGGLE, BONE_UNSELECTABLE, 0, ICON_RESTRICT_SELECT_OFF, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), te->ys, UI_UNIT_X, UI_UNIT_Y, &(ebone->flag), 0, 0, 0, 0, @@ -531,25 +531,25 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar } else if (tselem->type == TSE_GP_LAYER) { bGPDlayer *gpl = (bGPDlayer *)te->directdata; - + UI_block_emboss_set(block, UI_EMBOSS_NONE); - + bt = uiDefIconButBitS(block, UI_BTYPE_ICON_TOGGLE, GP_LAYER_HIDE, 0, ICON_RESTRICT_VIEW_OFF, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X, UI_UNIT_Y, &gpl->flag, 0, 0, 0, 0, TIP_("Restrict/Allow visibility in the 3D View")); UI_but_func_set(bt, restrictbutton_gp_layer_flag_cb, NULL, gpl); UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); - + bt = uiDefIconButBitS(block, UI_BTYPE_ICON_TOGGLE, GP_LAYER_LOCKED, 0, ICON_UNLOCKED, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), te->ys, UI_UNIT_X, UI_UNIT_Y, &gpl->flag, 0, 0, 0, 0, TIP_("Restrict/Allow editing of strokes and keyframes in this layer")); UI_but_func_set(bt, restrictbutton_gp_layer_flag_cb, NULL, gpl); UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); - + /* TODO: visibility in renders */ - + UI_block_emboss_set(block, UI_EMBOSS); } else if (outliner_is_collection_tree_element(te)) { @@ -583,7 +583,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar UI_block_emboss_set(block, UI_EMBOSS); } } - + if (TSELEM_OPEN(tselem, soops)) outliner_draw_restrictbuts(block, scene, ar, soops, &te->subtree); } } @@ -622,16 +622,16 @@ static void outliner_draw_userbuts(uiBlock *block, ARegion *ar, SpaceOops *soops &id->flag, 0, 0, 0, 0, tip); UI_but_func_set(bt, restrictbutton_id_user_toggle, id, NULL); UI_but_flag_enable(bt, but_flag); - - + + BLI_str_format_int_grouped(buf, id->us); - bt = uiDefBut(block, UI_BTYPE_BUT, 1, buf, - (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), te->ys, + bt = uiDefBut(block, UI_BTYPE_BUT, 1, buf, + (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), te->ys, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, TIP_("Number of users of this data-block")); UI_but_flag_enable(bt, but_flag); - - + + bt = uiDefButBitS(block, UI_BTYPE_TOGGLE, LIB_FAKEUSER, 1, (id->flag & LIB_FAKEUSER) ? "F" : " ", (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_RENDERX), te->ys, UI_UNIT_X, UI_UNIT_Y, &id->flag, 0, 0, 0, 0, @@ -639,11 +639,11 @@ static void outliner_draw_userbuts(uiBlock *block, ARegion *ar, SpaceOops *soops "even if nothing else uses it")); UI_but_func_set(bt, restrictbutton_id_user_toggle, id, NULL); UI_but_flag_enable(bt, but_flag); - + UI_block_emboss_set(block, UI_EMBOSS); } } - + if (TSELEM_OPEN(tselem, soops)) outliner_draw_userbuts(block, ar, soops, &te->subtree); } } @@ -707,12 +707,12 @@ static void outliner_draw_rnabuts(uiBlock *block, ARegion *ar, SpaceOops *soops, else if (tselem->type == TSE_RNA_ARRAY_ELEM) { ptr = &te->rnaptr; prop = te->directdata; - + uiDefAutoButR(block, ptr, prop, te->index, "", ICON_NONE, sizex, te->ys, OL_RNA_COL_SIZEX, UI_UNIT_Y - 1); } } - + if (TSELEM_OPEN(tselem, soops)) outliner_draw_rnabuts(block, ar, soops, sizex, &te->subtree); } @@ -776,7 +776,7 @@ static void tselem_draw_icon_uibut(struct DrawIconArg *arg, int icon) uiBut *but = uiDefIconBut(arg->block, UI_BTYPE_LABEL, 0, icon, arg->xb, arg->yb, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 1.0, arg->alpha, (arg->id && ID_IS_LINKED(arg->id)) ? arg->id->lib->name : ""); - + if (arg->id) UI_but_drag_set_id(but, arg->id); } @@ -800,17 +800,17 @@ static void UNUSED_FUNCTION(tselem_draw_gp_icon_uibut)(struct DrawIconArg *arg, RNA_pointer_create(id, &RNA_GPencilLayer, gpl, &ptr); UI_block_align_begin(arg->block); - + UI_block_emboss_set(arg->block, is_stroke_visible ? UI_EMBOSS : UI_EMBOSS_NONE); uiDefButR(arg->block, UI_BTYPE_COLOR, 1, "", arg->xb, arg->yb, w, h, &ptr, "color", -1, 0, 0, 0, 0, NULL); - + UI_block_emboss_set(arg->block, is_fill_visible ? UI_EMBOSS : UI_EMBOSS_NONE); uiDefButR(arg->block, UI_BTYPE_COLOR, 1, "", arg->xb + w, arg->yb, w, h, &ptr, "fill_color", -1, 0, 0, 0, 0, NULL); - + UI_block_emboss_set(arg->block, UI_EMBOSS_NONE); UI_block_align_end(arg->block); } @@ -821,7 +821,7 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto { struct DrawIconArg arg; float aspect; - + /* make function calls a bit compacter */ arg.block = block; arg.id = tselem->id; @@ -1294,16 +1294,16 @@ static void outliner_draw_iconrow( color); glEnable(GL_BLEND); /* roundbox disables */ } - + tselem_draw_icon(block, xmax, (float)*offsx, (float)ys, tselem, te, 0.5f * alpha_fac); te->xs = *offsx; te->ys = ys; te->xend = (short)*offsx + UI_UNIT_X; te->flag |= TE_ICONROW; // for click - + (*offsx) += UI_UNIT_X; } - + /* this tree element always has same amount of branches, so don't draw */ if (tselem->type != TSE_R_LAYER) { outliner_draw_iconrow( @@ -1311,7 +1311,7 @@ static void outliner_draw_iconrow( &te->subtree, level + 1, xmax, offsx, ys, alpha_fac); } } - + } /* closed tree element */ @@ -1359,7 +1359,7 @@ static void outliner_draw_tree_element( /* icons can be ui buts, we don't want it to overlap with restrict */ if ((soops->flag & SO_HIDE_RESTRICTCOLS) == 0) xmax -= OL_TOGW + UI_UNIT_X; - + glEnable(GL_BLEND); /* colors for active/selected data */ @@ -1378,16 +1378,16 @@ static void outliner_draw_tree_element( if (ob == obact || is_selected) { char col[4] = {0, 0, 0, 0}; - + /* outliner active ob: always white text, circle color now similar to view3d */ - + active = OL_DRAWSEL_ACTIVE; if (ob == obact) { if (is_selected) { UI_GetThemeColorType4ubv(TH_ACTIVE, SPACE_VIEW3D, col); col[3] = alpha; } - + active = OL_DRAWSEL_NORMAL; } else if (is_selected) { @@ -1412,7 +1412,7 @@ static void outliner_draw_tree_element( active = tree_element_type_active(C, scene, view_layer, soops, te, tselem, OL_SETSEL_NONE, false); rgba_float_args_set(color, 0.85f, 0.85f, 1.0f, alpha); } - + /* active circle */ if (active != OL_DRAWSEL_NONE) { UI_draw_roundbox_corner_set(UI_CNR_ALL); @@ -1424,10 +1424,10 @@ static void outliner_draw_tree_element( (float)*starty + UI_UNIT_Y - 1.0f * ufac, UI_UNIT_Y / 2.0f - 1.0f * ufac, color); glEnable(GL_BLEND); /* roundbox disables it */ - + te->flag |= TE_ACTIVE; // for lookup in display hierarchies } - + if (tselem->type == TSE_VIEW_COLLECTION_BASE) { /* Scene collection in view layer can't expand/collapse. */ } @@ -1444,16 +1444,16 @@ static void outliner_draw_tree_element( alpha_fac); } offsx += UI_UNIT_X; - + /* datatype icon */ - + if (!(ELEM(tselem->type, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM, TSE_ID_BASE))) { tselem_draw_icon(block, xmax, (float)startx + offsx, (float)*starty, tselem, te, alpha_fac); offsx += UI_UNIT_X + 2 * ufac; } else offsx += 2 * ufac; - + if (ELEM(tselem->type, 0, TSE_LAYER_COLLECTION) && ID_IS_LINKED(tselem->id)) { if (tselem->id->tag & LIB_TAG_MISSING) { UI_icon_draw_alpha((float)startx + offsx + 2 * ufac, (float)*starty + 2 * ufac, ICON_LIBRARY_DATA_BROKEN, @@ -1475,7 +1475,7 @@ static void outliner_draw_tree_element( offsx += UI_UNIT_X + 2 * ufac; } glDisable(GL_BLEND); - + /* name */ if ((tselem->flag & TSE_TEXTBUT) == 0) { unsigned char text_col[4]; @@ -1494,9 +1494,9 @@ static void outliner_draw_tree_element( UI_fontstyle_draw_simple(fstyle, startx + offsx, *starty + 5 * ufac, te->name, text_col); } - + offsx += (int)(UI_UNIT_X + UI_fontstyle_string_width(fstyle, te->name)); - + /* closed item, we draw the icons, not when it's a scene, or master-server list though */ if (!TSELEM_OPEN(tselem, soops)) { if (te->subtree.first) { @@ -1558,7 +1558,7 @@ static void outliner_draw_tree_element( for (TreeElement *ten = te->subtree.first; ten; ten = ten->next) { outliner_set_coord_tree_element(ten, startx, *starty); } - + *starty -= UI_UNIT_Y; } } @@ -1650,7 +1650,7 @@ static void outliner_draw_hierarchy_lines_recursive(unsigned pos, SpaceOops *soo } *starty -= UI_UNIT_Y; - + if (TSELEM_OPEN(tselem, soops)) outliner_draw_hierarchy_lines_recursive(pos, soops, &te->subtree, startx + UI_UNIT_X, col, draw_childs_grayed_out, starty); @@ -1694,7 +1694,7 @@ static void outliner_draw_struct_marks(ARegion *ar, SpaceOops *soops, ListBase * for (te = lb->first; te; te = te->next) { tselem = TREESTORE(te); - + /* selection status */ if (TSELEM_OPEN(tselem, soops)) if (tselem->type == TSE_RNA_STRUCT) { @@ -1822,7 +1822,7 @@ static void outliner_draw_tree( } // gray hierarchy lines - + starty = (int)ar->v2d.tot.ymax - UI_UNIT_Y / 2 - OL_Y_OFFSET; startx = UI_UNIT_X / 2 - 1.0f; outliner_draw_hierarchy_lines(soops, &soops->tree, startx, &starty); @@ -1850,7 +1850,7 @@ static void outliner_draw_tree( static void outliner_back(ARegion *ar) { int ystart; - + ystart = (int)ar->v2d.tot.ymax; ystart = UI_UNIT_Y * (ystart / (UI_UNIT_Y)) - OL_Y_OFFSET; @@ -1909,7 +1909,7 @@ static void outliner_draw_restrictcols(ARegion *ar) void draw_outliner(const bContext *C) { - Main *mainvar = CTX_data_main(C); + Main *mainvar = CTX_data_main(C); Scene *scene = CTX_data_scene(C); ViewLayer *view_layer = CTX_data_view_layer(C); ARegion *ar = CTX_wm_region(C); @@ -1921,7 +1921,7 @@ void draw_outliner(const bContext *C) bool has_restrict_icons; outliner_build_tree(mainvar, scene, view_layer, soops, ar); // always - + /* get extents of data */ outliner_height(soops, &soops->tree, &sizey); @@ -1933,11 +1933,11 @@ void draw_outliner(const bContext *C) * * (*) XXX max width for now is a fixed factor of (UI_UNIT_X * (max_indention + 100)) */ - + /* get actual width of column 1 */ outliner_rna_width(soops, &soops->tree, &sizex_rna, 0); sizex_rna = max_ii(OL_RNA_COLX, sizex_rna + OL_RNA_COL_SPACEX); - + /* get width of data (for setting 'tot' rect, this is column 1 + column 2 + a bit extra) */ sizex = sizex_rna + OL_RNA_COL_SIZEX + 50; has_restrict_icons = false; @@ -1947,7 +1947,7 @@ void draw_outliner(const bContext *C) //outliner_width(soops, &soops->tree, &sizex); // XXX should use outliner_width instead when te->xend will be set correctly... outliner_rna_width(soops, &soops->tree, &sizex, 0); - + /* constant offset for restriction columns */ // XXX this isn't that great yet... if ((soops->flag & SO_HIDE_RESTRICTCOLS) == 0) { @@ -1956,7 +1956,7 @@ void draw_outliner(const bContext *C) has_restrict_icons = !(soops->flag & SO_HIDE_RESTRICTCOLS); } - + /* adds vertical offset */ sizey += OL_Y_OFFSET; @@ -1998,4 +1998,4 @@ void draw_outliner(const bContext *C) UI_block_end(C, block); UI_block_draw(C, block); -} +} 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; } } diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h index 90f2e934367..8ac09648d60 100644 --- a/source/blender/editors/space_outliner/outliner_intern.h +++ b/source/blender/editors/space_outliner/outliner_intern.h @@ -143,7 +143,7 @@ typedef enum { OL_SETSEL_EXTEND = 2, /* select the item and extend (also toggles selection) */ } eOLSetState; -/* get TreeStoreElem associated with a TreeElement +/* get TreeStoreElem associated with a TreeElement * < a: (TreeElement) tree element to find stored element for */ #define TREESTORE(a) ((a)->store_elem) diff --git a/source/blender/editors/space_outliner/outliner_ops.c b/source/blender/editors/space_outliner/outliner_ops.c index b5b1077a933..ecfd12618e5 100644 --- a/source/blender/editors/space_outliner/outliner_ops.c +++ b/source/blender/editors/space_outliner/outliner_ops.c @@ -429,16 +429,16 @@ void outliner_operatortypes(void) WM_operatortype_append(OUTLINER_OT_show_active); WM_operatortype_append(OUTLINER_OT_show_hierarchy); WM_operatortype_append(OUTLINER_OT_scroll_page); - + WM_operatortype_append(OUTLINER_OT_selected_toggle); WM_operatortype_append(OUTLINER_OT_expanded_toggle); - + WM_operatortype_append(OUTLINER_OT_keyingset_add_selected); WM_operatortype_append(OUTLINER_OT_keyingset_remove_selected); - + WM_operatortype_append(OUTLINER_OT_drivers_add_selected); WM_operatortype_append(OUTLINER_OT_drivers_delete_selected); - + WM_operatortype_append(OUTLINER_OT_orphans_purge); WM_operatortype_append(OUTLINER_OT_parent_drop); @@ -516,41 +516,41 @@ void outliner_keymap(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "OUTLINER_OT_select_border", BKEY, KM_PRESS, 0, 0); - + kmi = WM_keymap_add_item(keymap, "OUTLINER_OT_item_openclose", RETKEY, KM_PRESS, 0, 0); RNA_boolean_set(kmi->ptr, "all", false); kmi = WM_keymap_add_item(keymap, "OUTLINER_OT_item_openclose", RETKEY, KM_PRESS, KM_SHIFT, 0); RNA_boolean_set(kmi->ptr, "all", true); - + WM_keymap_add_item(keymap, "OUTLINER_OT_item_rename", LEFTMOUSE, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "OUTLINER_OT_operation", RIGHTMOUSE, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "OUTLINER_OT_item_drag_drop", EVT_TWEAK_L, KM_ANY, 0, 0); WM_keymap_add_item(keymap, "OUTLINER_OT_show_hierarchy", HOMEKEY, KM_PRESS, 0, 0); - + WM_keymap_add_item(keymap, "OUTLINER_OT_show_active", PERIODKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "OUTLINER_OT_show_active", PADPERIOD, KM_PRESS, 0, 0); - + kmi = WM_keymap_add_item(keymap, "OUTLINER_OT_scroll_page", PAGEDOWNKEY, KM_PRESS, 0, 0); RNA_boolean_set(kmi->ptr, "up", false); kmi = WM_keymap_add_item(keymap, "OUTLINER_OT_scroll_page", PAGEUPKEY, KM_PRESS, 0, 0); RNA_boolean_set(kmi->ptr, "up", true); - + WM_keymap_add_item(keymap, "OUTLINER_OT_show_one_level", PADPLUSKEY, KM_PRESS, 0, 0); /* open */ kmi = WM_keymap_add_item(keymap, "OUTLINER_OT_show_one_level", PADMINUS, KM_PRESS, 0, 0); RNA_boolean_set(kmi->ptr, "open", false); /* close */ - + WM_keymap_verify_item(keymap, "OUTLINER_OT_selected_toggle", AKEY, KM_PRESS, 0, 0); WM_keymap_verify_item(keymap, "OUTLINER_OT_expanded_toggle", AKEY, KM_PRESS, KM_SHIFT, 0); - + /* keying sets - only for databrowse */ WM_keymap_verify_item(keymap, "OUTLINER_OT_keyingset_add_selected", KKEY, KM_PRESS, 0, 0); WM_keymap_verify_item(keymap, "OUTLINER_OT_keyingset_remove_selected", KKEY, KM_PRESS, KM_ALT, 0); - + WM_keymap_verify_item(keymap, "ANIM_OT_keyframe_insert", IKEY, KM_PRESS, 0, 0); WM_keymap_verify_item(keymap, "ANIM_OT_keyframe_delete", IKEY, 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); diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c index 9f08223d11b..441765528d1 100644 --- a/source/blender/editors/space_outliner/outliner_select.c +++ b/source/blender/editors/space_outliner/outliner_select.c @@ -156,12 +156,12 @@ static eOLDrawState active_viewlayer( bContext *C, Scene *UNUSED(scene), ViewLayer *UNUSED(sl), TreeElement *te, TreeStoreElem *tselem, const eOLSetState set) { Scene *sce; - + /* paranoia check */ if (te->idcode != ID_SCE) return OL_DRAWSEL_NONE; sce = (Scene *)tselem->id; - + WorkSpace *workspace = CTX_wm_workspace(C); ViewLayer *view_layer = te->directdata; @@ -225,7 +225,7 @@ static eOLDrawState tree_element_set_active_object( Scene *sce; Base *base; Object *ob = NULL; - + /* if id is not object, we search back */ if (te->idcode == ID_OB) { ob = (Object *)tselem->id; @@ -239,13 +239,13 @@ static eOLDrawState tree_element_set_active_object( if (ob == NULL) { return OL_DRAWSEL_NONE; } - + sce = (Scene *)outliner_search_back(soops, te, ID_SCE); if (sce && scene != sce) { WM_window_change_active_scene(CTX_data_main(C), C, CTX_wm_window(C), sce); scene = sce; } - + /* find associated base in current scene */ base = BKE_view_layer_base_find(view_layer, ob); @@ -271,7 +271,7 @@ static eOLDrawState tree_element_set_active_object( /* swap select */ if (base->flag & BASE_SELECTED) ED_object_base_select(base, BA_DESELECT); - else + else ED_object_base_select(base, BA_SELECT); } else { @@ -297,7 +297,7 @@ static eOLDrawState tree_element_set_active_object( ED_object_base_activate(C, base); /* adds notifier */ WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene); } - + if (ob != OBEDIT_FROM_VIEW_LAYER(view_layer)) { ED_object_editmode_exit(C, EM_FREEDATA | EM_WAITCURSOR); } @@ -311,14 +311,14 @@ static eOLDrawState tree_element_active_material( { TreeElement *tes; Object *ob; - + /* we search for the object parent */ ob = (Object *)outliner_search_back(soops, te, ID_OB); // note: ob->matbits can be NULL when a local object points to a library mesh. if (ob == NULL || ob != OBACT(view_layer) || ob->matbits == NULL) { return OL_DRAWSEL_NONE; /* just paranoia */ } - + /* searching in ob mat array? */ tes = te->parent; if (tes->idcode == ID_OB) { @@ -363,21 +363,21 @@ static eOLDrawState tree_element_active_lamp( TreeElement *te, const eOLSetState set) { Object *ob; - + /* we search for the object parent */ ob = (Object *)outliner_search_back(soops, te, ID_OB); if (ob == NULL || ob != OBACT(view_layer)) { /* just paranoia */ return OL_DRAWSEL_NONE; } - + if (set != OL_SETSEL_NONE) { // XXX extern_set_butspace(F5KEY, 0); } else { return OL_DRAWSEL_NORMAL; } - + return OL_DRAWSEL_NONE; } @@ -401,21 +401,21 @@ static eOLDrawState tree_element_active_world( TreeElement *tep; TreeStoreElem *tselem = NULL; Scene *sce = NULL; - + tep = te->parent; if (tep) { tselem = TREESTORE(tep); if (tselem->type == 0) sce = (Scene *)tselem->id; } - + if (set != OL_SETSEL_NONE) { /* make new scene active */ if (sce && scene != sce) { WM_window_change_active_scene(CTX_data_main(C), C, CTX_wm_window(C), sce); } } - + if (tep == NULL || tselem->id == (ID *)scene) { if (set != OL_SETSEL_NONE) { // XXX extern_set_butspace(F8KEY, 0); @@ -431,7 +431,7 @@ static eOLDrawState tree_element_active_defgroup( bContext *C, ViewLayer *view_layer, TreeElement *te, TreeStoreElem *tselem, const eOLSetState set) { Object *ob; - + /* id in tselem is object */ ob = (Object *)tselem->id; if (set != OL_SETSEL_NONE) { @@ -454,7 +454,7 @@ static eOLDrawState tree_element_active_posegroup( bContext *C, Scene *UNUSED(scene), ViewLayer *view_layer, TreeElement *te, TreeStoreElem *tselem, const eOLSetState set) { Object *ob = (Object *)tselem->id; - + if (set != OL_SETSEL_NONE) { if (ob->pose) { ob->pose->active_group = te->index + 1; @@ -477,10 +477,10 @@ static eOLDrawState tree_element_active_posechannel( Object *ob = (Object *)tselem->id; bArmature *arm = ob->data; bPoseChannel *pchan = te->directdata; - + if (set != OL_SETSEL_NONE) { if (!(pchan->bone->flag & BONE_HIDDEN_P)) { - + if (set != OL_SETSEL_EXTEND) { bPoseChannel *pchannel; /* single select forces all other bones to get unselected */ @@ -520,7 +520,7 @@ static eOLDrawState tree_element_active_bone( { bArmature *arm = (bArmature *)tselem->id; Bone *bone = te->directdata; - + if (set != OL_SETSEL_NONE) { if (!(bone->flag & BONE_HIDDEN_P)) { Object *ob = OBACT(view_layer); @@ -533,7 +533,7 @@ static eOLDrawState tree_element_active_bone( } } } - + if (set == OL_SETSEL_EXTEND && (bone->flag & BONE_SELECTED)) { bone->flag &= ~BONE_SELECTED; } @@ -547,13 +547,13 @@ static eOLDrawState tree_element_active_bone( do_outliner_bone_select_recursive(arm, bone, (bone->flag & BONE_SELECTED) != 0); } - + WM_event_add_notifier(C, NC_OBJECT | ND_BONE_ACTIVE, ob); } } else { Object *ob = OBACT(view_layer); - + if (ob && ob->data == arm) { if (bone->flag & BONE_SELECTED) { return OL_DRAWSEL_NORMAL; @@ -629,12 +629,12 @@ static eOLDrawState tree_element_active_modifier( { if (set != OL_SETSEL_NONE) { Object *ob = (Object *)tselem->id; - + WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob); // XXX extern_set_butspace(F9KEY, 0); } - + return OL_DRAWSEL_NONE; } @@ -643,12 +643,12 @@ static eOLDrawState tree_element_active_psys( { if (set != OL_SETSEL_NONE) { Object *ob = (Object *)tselem->id; - + WM_event_add_notifier(C, NC_OBJECT | ND_PARTICLE | NA_EDITED, ob); - + // XXX extern_set_butspace(F7KEY, 0); } - + return OL_DRAWSEL_NONE; } @@ -657,11 +657,11 @@ static int tree_element_active_constraint( { if (set != OL_SETSEL_NONE) { Object *ob = (Object *)tselem->id; - + WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, ob); // XXX extern_set_butspace(F7KEY, 0); } - + return OL_DRAWSEL_NONE; } @@ -760,7 +760,7 @@ static eOLDrawState tree_element_active_keymap_item( bContext *UNUSED(C), Scene *UNUSED(scene), ViewLayer *UNUSED(sl), TreeElement *te, TreeStoreElem *UNUSED(tselem), const eOLSetState set) { wmKeyMapItem *kmi = te->directdata; - + if (set == OL_SETSEL_NONE) { if (kmi->flag & KMI_INACTIVE) { return OL_DRAWSEL_NONE; @@ -969,7 +969,7 @@ static void do_outliner_item_activate_tree_element( } FOREACH_COLLECTION_OBJECT_RECURSIVE_END; } - + WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene); } else if (OB_DATA_SUPPORT_EDITMODE(te->idcode)) { @@ -1121,11 +1121,11 @@ void OUTLINER_OT_item_activate(wmOperatorType *ot) ot->name = "Activate Item"; ot->idname = "OUTLINER_OT_item_activate"; ot->description = "Handle mouse clicks to activate/select items"; - + ot->invoke = outliner_item_activate_invoke; - + ot->poll = ED_operator_outliner_active; - + RNA_def_boolean(ot->srna, "extend", true, "Extend", "Extend selection for activation"); RNA_def_boolean(ot->srna, "recursive", false, "Recursive", "Select Objects and their children"); } diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c index b9e5bc80a3f..8a01e5a7f2f 100644 --- a/source/blender/editors/space_outliner/outliner_tools.c +++ b/source/blender/editors/space_outliner/outliner_tools.c @@ -101,7 +101,7 @@ static void set_operation_types(SpaceOops *soops, ListBase *lb, { TreeElement *te; TreeStoreElem *tselem; - + for (te = lb->first; te; te = te->next) { tselem = TREESTORE(te); if (tselem->flag & TSE_SELECTED) { @@ -121,7 +121,7 @@ static void set_operation_types(SpaceOops *soops, ListBase *lb, case ID_OB: *objectlevel = 1; break; - + case ID_ME: case ID_CU: case ID_MB: case ID_LT: case ID_LA: case ID_AR: case ID_CA: case ID_SPK: case ID_MA: case ID_TE: case ID_IP: case ID_IM: @@ -158,7 +158,7 @@ static void unlink_material_cb( { Material **matar = NULL; int a, totcol = 0; - + if (GS(tsep->id->name) == ID_OB) { Object *ob = (Object *)tsep->id; totcol = ob->totcol; @@ -199,7 +199,7 @@ static void unlink_texture_cb( { MTex **mtex = NULL; int a; - + if (GS(tsep->id->name) == ID_LS) { FreestyleLineStyle *ls = (FreestyleLineStyle *)tsep->id; mtex = ls->mtex; @@ -252,7 +252,7 @@ static void unlink_object_cb( { Main *bmain = CTX_data_main(C); Object *ob = (Object *)tselem->id; - + if (tsep) { if (GS(tsep->id->name) == ID_GR) { Collection *parent = (Collection *)tsep->id; @@ -273,7 +273,7 @@ static void unlink_world_cb( { Scene *parscene = (Scene *)tsep->id; World *wo = (World *)tselem->id; - + /* need to use parent scene not just scene, otherwise may end up getting wrong one */ id_us_min(&wo->id); parscene->world = NULL; @@ -286,7 +286,7 @@ static void outliner_do_libdata_operation( { TreeElement *te; TreeStoreElem *tselem; - + for (te = lb->first; te; te = te->next) { tselem = TREESTORE(te); if (tselem->flag & TSE_SELECTED) { @@ -496,7 +496,7 @@ static void id_fake_user_set_cb( TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void *UNUSED(user_data)) { ID *id = tselem->id; - + id_fake_user_set(id); } @@ -505,7 +505,7 @@ static void id_fake_user_clear_cb( TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void *UNUSED(user_data)) { ID *id = tselem->id; - + id_fake_user_clear(id); } @@ -523,15 +523,15 @@ static void singleuser_action_cb( TreeStoreElem *tsep, TreeStoreElem *tselem, void *UNUSED(user_data)) { ID *id = tselem->id; - + if (id) { IdAdtTemplate *iat = (IdAdtTemplate *)tsep->id; PointerRNA ptr = {{NULL}}; PropertyRNA *prop; - + RNA_pointer_create(&iat->id, &RNA_AnimData, iat->adt, &ptr); prop = RNA_struct_find_property(&ptr, "action"); - + id_single_user(C, id, &ptr, prop); } } @@ -541,16 +541,16 @@ static void singleuser_world_cb( TreeStoreElem *tsep, TreeStoreElem *tselem, void *UNUSED(user_data)) { ID *id = tselem->id; - + /* need to use parent scene not just scene, otherwise may end up getting wrong one */ if (id) { Scene *parscene = (Scene *)tsep->id; PointerRNA ptr = {{NULL}}; PropertyRNA *prop; - + RNA_id_pointer_create(&parscene->id, &ptr); prop = RNA_struct_find_property(&ptr, "world"); - + id_single_user(C, id, &ptr, prop); } } @@ -563,7 +563,7 @@ void outliner_do_object_operation_ex( outliner_operation_cb operation_cb, bool select_recurse) { TreeElement *te; - + for (te = lb->first; te; te = te->next) { TreeStoreElem *tselem = TREESTORE(te); bool select_handled = false; @@ -617,7 +617,7 @@ static void cleardrivers_animdata_cb(int UNUSED(event), TreeElement *UNUSED(te), TreeStoreElem *tselem, void *UNUSED(arg)) { IdAdtTemplate *iat = (IdAdtTemplate *)tselem->id; - + /* just free drivers - stored as a list of F-Curves */ free_fcurves(&iat->adt->drivers); } @@ -627,11 +627,11 @@ static void refreshdrivers_animdata_cb(int UNUSED(event), TreeElement *UNUSED(te { IdAdtTemplate *iat = (IdAdtTemplate *)tselem->id; FCurve *fcu; - + /* loop over drivers, performing refresh (i.e. check graph_buttons.c and rna_fcurve.c for details) */ for (fcu = iat->adt->drivers.first; fcu; fcu = fcu->next) { fcu->flag &= ~FCURVE_DISABLED; - + if (fcu->driver) fcu->driver->flag &= ~DRIVER_FLAG_INVALID; } @@ -662,7 +662,7 @@ typedef enum eOutliner_PropModifierOps { static void pchan_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem), void *UNUSED(arg)) { bPoseChannel *pchan = (bPoseChannel *)te->directdata; - + if (event == OL_DOP_SELECT) pchan->bone->flag |= BONE_SELECTED; else if (event == OL_DOP_DESELECT) @@ -678,7 +678,7 @@ static void pchan_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem), static void bone_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem), void *UNUSED(arg)) { Bone *bone = (Bone *)te->directdata; - + if (event == OL_DOP_SELECT) bone->flag |= BONE_SELECTED; else if (event == OL_DOP_DESELECT) @@ -694,7 +694,7 @@ static void bone_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem), v static void ebone_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem), void *UNUSED(arg)) { EditBone *ebone = (EditBone *)te->directdata; - + if (event == OL_DOP_SELECT) ebone->flag |= BONE_SELECTED; else if (event == OL_DOP_DESELECT) @@ -724,7 +724,7 @@ static void sequence_cb(int event, TreeElement *te, TreeStoreElem *tselem, void static void gp_layer_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem), void *UNUSED(arg)) { bGPDlayer *gpl = (bGPDlayer *)te->directdata; - + if (event == OL_DOP_SELECT) gpl->flag |= GP_LAYER_SELECT; else if (event == OL_DOP_DESELECT) @@ -816,7 +816,7 @@ static void outliner_do_data_operation(SpaceOops *soops, int type, int event, Li { TreeElement *te; TreeStoreElem *tselem; - + for (te = lb->first; te; te = te->next) { tselem = TREESTORE(te); if (tselem->flag & TSE_SELECTED) { @@ -932,11 +932,11 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op) SpaceOops *soops = CTX_wm_space_outliner(C); int event; const char *str = NULL; - + /* check for invalid states */ if (soops == NULL) return OPERATOR_CANCELLED; - + event = RNA_enum_get(op->ptr, "type"); if (event == OL_OP_SELECT) { @@ -945,7 +945,7 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op) if (scene != sce) { WM_window_change_active_scene(bmain, C, win, sce); } - + str = "Select Objects"; WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene); } @@ -1005,7 +1005,7 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op) } ED_undo_push(C, str); - + return OPERATOR_FINISHED; } @@ -1016,12 +1016,12 @@ void OUTLINER_OT_object_operation(wmOperatorType *ot) ot->name = "Outliner Object Operation"; ot->idname = "OUTLINER_OT_object_operation"; ot->description = ""; - + /* callbacks */ ot->invoke = WM_menu_invoke; ot->exec = outliner_object_operation_exec; ot->poll = ED_operator_outliner_active; - + ot->flag = 0; ot->prop = RNA_def_enum(ot->srna, "type", prop_object_op_types, 0, "Object Operation", ""); @@ -1031,14 +1031,14 @@ void OUTLINER_OT_object_operation(wmOperatorType *ot) typedef enum eOutlinerIdOpTypes { OUTLINER_IDOP_INVALID = 0, - + OUTLINER_IDOP_UNLINK, OUTLINER_IDOP_LOCAL, OUTLINER_IDOP_STATIC_OVERRIDE, OUTLINER_IDOP_SINGLE, OUTLINER_IDOP_DELETE, OUTLINER_IDOP_REMAP, - + OUTLINER_IDOP_FAKE_ADD, OUTLINER_IDOP_FAKE_CLEAR, OUTLINER_IDOP_RENAME, @@ -1070,15 +1070,15 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op) SpaceOops *soops = CTX_wm_space_outliner(C); int scenelevel = 0, objectlevel = 0, idlevel = 0, datalevel = 0; eOutlinerIdOpTypes event; - + /* check for invalid states */ if (soops == NULL) return OPERATOR_CANCELLED; - + set_operation_types(soops, &soops->tree, &scenelevel, &objectlevel, &idlevel, &datalevel); - + event = RNA_enum_get(op->ptr, "type"); - + switch (event) { case OUTLINER_IDOP_UNLINK: { @@ -1094,25 +1094,25 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op) switch (idlevel) { case ID_AC: outliner_do_libdata_operation(C, op->reports, scene, soops, &soops->tree, unlink_action_cb, NULL); - + WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, NULL); ED_undo_push(C, "Unlink action"); break; case ID_MA: outliner_do_libdata_operation(C, op->reports, scene, soops, &soops->tree, unlink_material_cb, NULL); - + WM_event_add_notifier(C, NC_OBJECT | ND_OB_SHADING, NULL); ED_undo_push(C, "Unlink material"); break; case ID_TE: outliner_do_libdata_operation(C, op->reports, scene, soops, &soops->tree, unlink_texture_cb, NULL); - + WM_event_add_notifier(C, NC_OBJECT | ND_OB_SHADING, NULL); ED_undo_push(C, "Unlink texture"); break; case ID_WO: outliner_do_libdata_operation(C, op->reports, scene, soops, &soops->tree, unlink_world_cb, NULL); - + WM_event_add_notifier(C, NC_SCENE | ND_WORLD, NULL); ED_undo_push(C, "Unlink world"); break; @@ -1148,18 +1148,18 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op) switch (idlevel) { case ID_AC: outliner_do_libdata_operation(C, op->reports, scene, soops, &soops->tree, singleuser_action_cb, NULL); - + WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, NULL); ED_undo_push(C, "Single-User Action"); break; - + case ID_WO: outliner_do_libdata_operation(C, op->reports, scene, soops, &soops->tree, singleuser_world_cb, NULL); - + WM_event_add_notifier(C, NC_SCENE | ND_WORLD, NULL); ED_undo_push(C, "Single-User World"); break; - + default: BKE_report(op->reports, RPT_WARNING, "Not yet implemented"); break; @@ -1186,7 +1186,7 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op) { /* set fake user */ outliner_do_libdata_operation(C, op->reports, scene, soops, &soops->tree, id_fake_user_set_cb, NULL); - + WM_event_add_notifier(C, NC_ID | NA_EDITED, NULL); ED_undo_push(C, "Add Fake User"); break; @@ -1195,7 +1195,7 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op) { /* clear fake user */ outliner_do_libdata_operation(C, op->reports, scene, soops, &soops->tree, id_fake_user_clear_cb, NULL); - + WM_event_add_notifier(C, NC_ID | NA_EDITED, NULL); ED_undo_push(C, "Clear Fake User"); break; @@ -1204,7 +1204,7 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op) { /* rename */ outliner_do_libdata_operation(C, op->reports, scene, soops, &soops->tree, item_rename_cb, NULL); - + WM_event_add_notifier(C, NC_ID | NA_EDITED, NULL); ED_undo_push(C, "Rename"); break; @@ -1213,18 +1213,18 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op) outliner_do_libdata_operation(C, op->reports, scene, soops, &soops->tree, id_select_linked_cb, NULL); ED_undo_push(C, "Select"); break; - + default: // invalid - unhandled break; } - + /* wrong notifier still... */ WM_event_add_notifier(C, NC_ID | NA_EDITED, NULL); - - // XXX: this is just so that outliner is always up to date + + // XXX: this is just so that outliner is always up to date WM_event_add_notifier(C, NC_SPACE | ND_SPACE_OUTLINER, NULL); - + return OPERATOR_FINISHED; } @@ -1235,14 +1235,14 @@ void OUTLINER_OT_id_operation(wmOperatorType *ot) ot->name = "Outliner ID data Operation"; ot->idname = "OUTLINER_OT_id_operation"; ot->description = ""; - + /* callbacks */ ot->invoke = WM_menu_invoke; ot->exec = outliner_id_operation_exec; ot->poll = ED_operator_outliner_active; - + ot->flag = 0; - + ot->prop = RNA_def_enum(ot->srna, "type", prop_id_op_types, 0, "ID data Operation", ""); } @@ -1346,7 +1346,7 @@ static void outliner_do_id_set_operation(SpaceOops *soops, int type, ListBase *l { TreeElement *te; TreeStoreElem *tselem; - + for (te = lb->first; te; te = te->next) { tselem = TREESTORE(te); if (tselem->flag & TSE_SELECTED) { @@ -1366,12 +1366,12 @@ static void outliner_do_id_set_operation(SpaceOops *soops, int type, ListBase *l static void actionset_id_cb(TreeElement *UNUSED(te), TreeStoreElem *tselem, TreeStoreElem *tsep, ID *actId) { bAction *act = (bAction *)actId; - + if (tselem->type == TSE_ANIM_DATA) { /* "animation" entries - action is child of this */ BKE_animdata_set_action(NULL, tselem->id, act); } - /* TODO: if any other "expander" channels which own actions need to support this menu, + /* TODO: if any other "expander" channels which own actions need to support this menu, * add: tselem->type = ... */ else if (tsep && (tsep->type == TSE_ANIM_DATA)) { @@ -1385,17 +1385,17 @@ static int outliner_action_set_exec(bContext *C, wmOperator *op) { SpaceOops *soops = CTX_wm_space_outliner(C); int scenelevel = 0, objectlevel = 0, idlevel = 0, datalevel = 0; - + bAction *act; - + /* check for invalid states */ if (soops == NULL) return OPERATOR_CANCELLED; set_operation_types(soops, &soops->tree, &scenelevel, &objectlevel, &idlevel, &datalevel); - + /* get action to use */ act = BLI_findlink(&CTX_data_main(C)->action, RNA_enum_get(op->ptr, "action")); - + if (act == NULL) { BKE_report(op->reports, RPT_ERROR, "No valid action to add"); return OPERATOR_CANCELLED; @@ -1408,7 +1408,7 @@ static int outliner_action_set_exec(bContext *C, wmOperator *op) "for this action to avoid future problems)", act->id.name + 2); } - + /* perform action if valid channel */ if (datalevel == TSE_ANIM_DATA) outliner_do_id_set_operation(soops, datalevel, &soops->tree, (ID *)act, actionset_id_cb); @@ -1416,11 +1416,11 @@ static int outliner_action_set_exec(bContext *C, wmOperator *op) outliner_do_id_set_operation(soops, idlevel, &soops->tree, (ID *)act, actionset_id_cb); else return OPERATOR_CANCELLED; - + /* set notifier that things have changed */ WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, NULL); ED_undo_push(C, "Set action"); - + /* done */ return OPERATOR_FINISHED; } @@ -1433,15 +1433,15 @@ void OUTLINER_OT_action_set(wmOperatorType *ot) ot->name = "Outliner Set Action"; ot->idname = "OUTLINER_OT_action_set"; ot->description = "Change the active action used"; - + /* api callbacks */ ot->invoke = WM_enum_search_invoke; ot->exec = outliner_action_set_exec; ot->poll = ED_operator_outliner_active; - + /* flags */ ot->flag = 0; - + /* props */ // TODO: this would be nicer as an ID-pointer... prop = RNA_def_enum(ot->srna, "action", DummyRNA_NULL_items, 0, "Action", ""); @@ -1454,15 +1454,15 @@ void OUTLINER_OT_action_set(wmOperatorType *ot) typedef enum eOutliner_AnimDataOps { OUTLINER_ANIMOP_INVALID = 0, - + OUTLINER_ANIMOP_CLEAR_ADT, - + OUTLINER_ANIMOP_SET_ACT, OUTLINER_ANIMOP_CLEAR_ACT, - + OUTLINER_ANIMOP_REFRESH_DRV, OUTLINER_ANIMOP_CLEAR_DRV - + //OUTLINER_ANIMOP_COPY_DRIVERS, //OUTLINER_ANIMOP_PASTE_DRIVERS } eOutliner_AnimDataOps; @@ -1484,66 +1484,66 @@ static int outliner_animdata_operation_exec(bContext *C, wmOperator *op) int scenelevel = 0, objectlevel = 0, idlevel = 0, datalevel = 0; eOutliner_AnimDataOps event; short updateDeps = 0; - + /* check for invalid states */ if (soops == NULL) return OPERATOR_CANCELLED; - + event = RNA_enum_get(op->ptr, "type"); set_operation_types(soops, &soops->tree, &scenelevel, &objectlevel, &idlevel, &datalevel); - + if (datalevel != TSE_ANIM_DATA) return OPERATOR_CANCELLED; - + /* perform the core operation */ switch (event) { case OUTLINER_ANIMOP_CLEAR_ADT: /* Remove Animation Data - this may remove the active action, in some cases... */ outliner_do_data_operation(soops, datalevel, event, &soops->tree, clear_animdata_cb, NULL); - + WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, NULL); ED_undo_push(C, "Clear Animation Data"); break; - + case OUTLINER_ANIMOP_SET_ACT: /* delegate once again... */ WM_operator_name_call(C, "OUTLINER_OT_action_set", WM_OP_INVOKE_REGION_WIN, NULL); break; - + case OUTLINER_ANIMOP_CLEAR_ACT: /* clear active action - using standard rules */ outliner_do_data_operation(soops, datalevel, event, &soops->tree, unlinkact_animdata_cb, NULL); - + WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, NULL); ED_undo_push(C, "Unlink action"); break; - + case OUTLINER_ANIMOP_REFRESH_DRV: outliner_do_data_operation(soops, datalevel, event, &soops->tree, refreshdrivers_animdata_cb, NULL); - + WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN, NULL); //ED_undo_push(C, "Refresh Drivers"); /* no undo needed - shouldn't have any impact? */ updateDeps = 1; break; - + case OUTLINER_ANIMOP_CLEAR_DRV: outliner_do_data_operation(soops, datalevel, event, &soops->tree, cleardrivers_animdata_cb, NULL); - + WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN, NULL); ED_undo_push(C, "Clear Drivers"); updateDeps = 1; break; - + default: // invalid break; } - + /* update dependencies */ if (updateDeps) { /* rebuild depsgraph for the new deps */ DEG_relations_tag_update(CTX_data_main(C)); } - + return OPERATOR_FINISHED; } @@ -1554,14 +1554,14 @@ void OUTLINER_OT_animdata_operation(wmOperatorType *ot) ot->name = "Outliner Animation Data Operation"; ot->idname = "OUTLINER_OT_animdata_operation"; ot->description = ""; - + /* callbacks */ ot->invoke = WM_menu_invoke; ot->exec = outliner_animdata_operation_exec; ot->poll = ED_operator_outliner_active; - + ot->flag = 0; - + ot->prop = RNA_def_enum(ot->srna, "type", prop_animdata_op_types, 0, "Animation Operation", ""); } @@ -1674,14 +1674,14 @@ static int outliner_data_operation_exec(bContext *C, wmOperator *op) SpaceOops *soops = CTX_wm_space_outliner(C); int scenelevel = 0, objectlevel = 0, idlevel = 0, datalevel = 0; eOutliner_PropDataOps event; - + /* check for invalid states */ if (soops == NULL) return OPERATOR_CANCELLED; - + event = RNA_enum_get(op->ptr, "type"); set_operation_types(soops, &soops->tree, &scenelevel, &objectlevel, &idlevel, &datalevel); - + switch (datalevel) { case TSE_POSE_CHANNEL: { @@ -1733,7 +1733,7 @@ static int outliner_data_operation_exec(bContext *C, wmOperator *op) BKE_report(op->reports, RPT_WARNING, "Not yet implemented"); break; } - + return OPERATOR_FINISHED; } @@ -1744,14 +1744,14 @@ void OUTLINER_OT_data_operation(wmOperatorType *ot) ot->name = "Outliner Data Operation"; ot->idname = "OUTLINER_OT_data_operation"; ot->description = ""; - + /* callbacks */ ot->invoke = WM_menu_invoke; ot->exec = outliner_data_operation_exec; ot->poll = ED_operator_outliner_active; - + ot->flag = 0; - + ot->prop = RNA_def_enum(ot->srna, "type", prop_data_op_types, 0, "Data Operation", ""); } @@ -1763,24 +1763,24 @@ static int do_outliner_operation_event(bContext *C, ARegion *ar, SpaceOops *soop TreeElement *te, const float mval[2]) { ReportList *reports = CTX_wm_reports(C); // XXX... - + if (mval[1] > te->ys && mval[1] < te->ys + UI_UNIT_Y) { int scenelevel = 0, objectlevel = 0, idlevel = 0, datalevel = 0; TreeStoreElem *tselem = TREESTORE(te); - + /* select object that's clicked on and popup context menu */ if (!(tselem->flag & TSE_SELECTED)) { - + if (outliner_has_one_flag(&soops->tree, TSE_SELECTED, 1)) outliner_set_flag(&soops->tree, TSE_SELECTED, 0); - + tselem->flag |= TSE_SELECTED; /* Only redraw, don't rebuild here because TreeElement pointers will * become invalid and operations will crash. */ ED_region_tag_redraw_no_rebuild(ar); } - + set_operation_types(soops, &soops->tree, &scenelevel, &objectlevel, &idlevel, &datalevel); if (scenelevel) { @@ -1842,10 +1842,10 @@ static int do_outliner_operation_event(bContext *C, ARegion *ar, SpaceOops *soop } } } - + return 1; } - + for (te = te->subtree.first; te; te = te->next) { if (do_outliner_operation_event(C, ar, soops, te, mval)) return 1; @@ -1868,7 +1868,7 @@ static int outliner_operation(bContext *C, wmOperator *UNUSED(op), const wmEvent } 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_operation_event(C, ar, soops, te, fmval)) { found = true; @@ -1882,7 +1882,7 @@ static int outliner_operation(bContext *C, wmOperator *UNUSED(op), const wmEvent WM_menu_name_call(C, "OUTLINER_MT_collection_new", WM_OP_INVOKE_REGION_WIN); } } - + return OPERATOR_FINISHED; } @@ -1892,9 +1892,9 @@ void OUTLINER_OT_operation(wmOperatorType *ot) ot->name = "Execute Operation"; ot->idname = "OUTLINER_OT_operation"; ot->description = "Context menu for item operations"; - + ot->invoke = outliner_operation; - + ot->poll = ED_operator_outliner_active; } diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c index 7508e8b6684..d155457a208 100644 --- a/source/blender/editors/space_outliner/outliner_tree.c +++ b/source/blender/editors/space_outliner/outliner_tree.c @@ -28,7 +28,7 @@ /** \file blender/editors/space_outliner/outliner_tree.c * \ingroup spoutliner */ - + #include <math.h> #include <string.h> @@ -101,11 +101,11 @@ static void outliner_make_object_parent_hierarchy(ListBase *lb); static void outliner_storage_cleanup(SpaceOops *soops) { BLI_mempool *ts = soops->treestore; - + if (ts) { TreeStoreElem *tselem; int unused = 0; - + /* each element used once, for ID blocks with more users to have each a treestore */ BLI_mempool_iter iter; @@ -113,7 +113,7 @@ static void outliner_storage_cleanup(SpaceOops *soops) while ((tselem = BLI_mempool_iterstep(&iter))) { tselem->used = 0; } - + /* cleanup only after reading file or undo step, and always for * RNA datablocks view in order to save memory */ if (soops->storeflag & SO_TREESTORE_CLEANUP) { @@ -123,7 +123,7 @@ static void outliner_storage_cleanup(SpaceOops *soops) while ((tselem = BLI_mempool_iterstep(&iter))) { if (tselem->id == NULL) unused++; } - + if (unused) { if (BLI_mempool_len(ts) == unused) { BLI_mempool_destroy(ts); @@ -162,11 +162,11 @@ static void outliner_storage_cleanup(SpaceOops *soops) static void check_persistent(SpaceOops *soops, TreeElement *te, ID *id, short type, short nr) { TreeStoreElem *tselem; - + if (soops->treestore == NULL) { /* if treestore was not created in readfile.c, create it here */ soops->treestore = BLI_mempool_create(sizeof(TreeStoreElem), 1, 512, BLI_MEMPOOL_ALLOW_ITER); - + } if (soops->treehash == NULL) { soops->treehash = BKE_outliner_treehash_create_from_treestore(soops->treestore); @@ -232,7 +232,7 @@ void outliner_free_tree_element(TreeElement *element, ListBase *parent_subtree) /* ********************************************************* */ /* Prototype, see functions below */ -static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *idv, +static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *idv, TreeElement *parent, short type, short index); /* -------------------------------------------------------- */ @@ -242,11 +242,11 @@ static void outliner_add_bone(SpaceOops *soops, ListBase *lb, ID *id, Bone *curB TreeElement *parent, int *a) { TreeElement *te = outliner_add_element(soops, lb, id, parent, TSE_BONE, *a); - + (*a)++; te->name = curBone->name; te->directdata = curBone; - + for (curBone = curBone->childbase.first; curBone; curBone = curBone->next) { outliner_add_bone(soops, &te->subtree, id, curBone, te, a); } @@ -314,11 +314,11 @@ static void outliner_add_scene_contents(SpaceOops *soops, ListBase *lb, Scene *s } FOREACH_SCENE_OBJECT_END; outliner_make_object_parent_hierarchy(&ten->subtree); - + /* Animation Data */ if (outliner_animdata_test(sce->adt)) outliner_add_element(soops, lb, sce, te, TSE_ANIM_DATA, 0); - + /* Grease Pencil */ outliner_add_element(soops, lb, sce->gpd, te, 0, 0); } @@ -429,39 +429,39 @@ static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, Tree outliner_add_element(soops, &te->subtree, ob, te, TSE_ANIM_DATA, 0); outliner_add_element(soops, &te->subtree, ob->poselib, te, 0, 0); // XXX FIXME.. add a special type for this - + if (ob->proxy && !ID_IS_LINKED(ob)) outliner_add_element(soops, &te->subtree, ob->proxy, te, TSE_PROXY, 0); - + outliner_add_element(soops, &te->subtree, ob->gpd, te, 0, 0); - + outliner_add_element(soops, &te->subtree, ob->data, te, 0, 0); - + if (ob->pose) { bArmature *arm = ob->data; bPoseChannel *pchan; TreeElement *tenla = outliner_add_element(soops, &te->subtree, ob, te, TSE_POSE_BASE, 0); - + tenla->name = IFACE_("Pose"); - + /* channels undefined in editmode, but we want the 'tenla' pose icon itself */ if ((arm->edbo == NULL) && (ob->mode & OB_MODE_POSE)) { TreeElement *ten; int a = 0, const_index = 1000; /* ensure unique id for bone constraints */ - + for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next, a++) { ten = outliner_add_element(soops, &tenla->subtree, ob, tenla, TSE_POSE_CHANNEL, a); ten->name = pchan->name; ten->directdata = pchan; pchan->temp = (void *)ten; - + if (pchan->constraints.first) { //Object *target; bConstraint *con; TreeElement *ten1; TreeElement *tenla1 = outliner_add_element(soops, &ten->subtree, ob, ten, TSE_CONSTRAINT_BASE, 0); //char *str; - + tenla1->name = IFACE_("Constraints"); for (con = pchan->constraints.first; con; con = con->next, const_index++) { ten1 = outliner_add_element(soops, &tenla1->subtree, ob, tenla1, TSE_CONSTRAINT, const_index); @@ -494,7 +494,7 @@ static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, Tree ten = nten; } } - + /* Pose Groups */ if (ob->pose->agroups.first) { bActionGroup *agrp; @@ -510,11 +510,11 @@ static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, Tree } } } - + for (int a = 0; a < ob->totcol; a++) { outliner_add_element(soops, &te->subtree, ob->mat[a], te, 0, a); } - + if (ob->constraints.first) { //Object *target; bConstraint *con; @@ -522,7 +522,7 @@ static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, Tree TreeElement *tenla = outliner_add_element(soops, &te->subtree, ob, te, TSE_CONSTRAINT_BASE, 0); //char *str; int a; - + tenla->name = IFACE_("Constraints"); for (con = ob->constraints.first, a = 0; con; con = con->next, a++) { ten = outliner_add_element(soops, &tenla->subtree, ob, tenla, TSE_CONSTRAINT, a); @@ -537,18 +537,18 @@ static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, Tree /* possible add all other types links? */ } } - + if (ob->modifiers.first) { ModifierData *md; TreeElement *ten_mod = outliner_add_element(soops, &te->subtree, ob, te, TSE_MODIFIER_BASE, 0); int index; - + ten_mod->name = IFACE_("Modifiers"); for (index = 0, md = ob->modifiers.first; md; index++, md = md->next) { TreeElement *ten = outliner_add_element(soops, &ten_mod->subtree, ob, ten_mod, TSE_MODIFIER, index); ten->name = md->name; ten->directdata = md; - + if (md->type == eModifierType_Lattice) { outliner_add_element(soops, &ten->subtree, ((LatticeModifierData *) md)->object, ten, TSE_LINKED_OB, 0); } @@ -564,21 +564,21 @@ static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, Tree else if (md->type == eModifierType_ParticleSystem) { ParticleSystem *psys = ((ParticleSystemModifierData *) md)->psys; TreeElement *ten_psys; - + ten_psys = outliner_add_element(soops, &ten->subtree, ob, te, TSE_LINKED_PSYS, 0); ten_psys->directdata = psys; ten_psys->name = psys->part->id.name + 2; } } } - + /* vertex groups */ if (ob->defbase.first) { bDeformGroup *defgroup; TreeElement *ten; TreeElement *tenla = outliner_add_element(soops, &te->subtree, ob, te, TSE_DEFGROUP_BASE, 0); int a; - + tenla->name = IFACE_("Vertex Groups"); for (defgroup = ob->defbase.first, a = 0; defgroup; defgroup = defgroup->next, a++) { ten = outliner_add_element(soops, &tenla->subtree, ob, tenla, TSE_DEFGROUP, a); @@ -586,7 +586,7 @@ static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, Tree ten->directdata = defgroup; } } - + /* duplicated group */ if (ob->dup_group) outliner_add_element(soops, &te->subtree, ob->dup_group, te, 0, 0); @@ -598,7 +598,7 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor { /* tuck pointer back in object, to construct hierarchy */ if (GS(id->name) == ID_OB) id->newid = (ID *)te; - + /* expand specific data always */ switch (GS(id->name)) { case ID_LI: @@ -620,10 +620,10 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor { Mesh *me = (Mesh *)id; int a; - + if (outliner_animdata_test(me->adt)) outliner_add_element(soops, &te->subtree, me, te, TSE_ANIM_DATA, 0); - + outliner_add_element(soops, &te->subtree, me->key, te, 0, 0); for (a = 0; a < me->totcol; a++) outliner_add_element(soops, &te->subtree, me->mat[a], te, 0, a); @@ -635,10 +635,10 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor { Curve *cu = (Curve *)id; int a; - + if (outliner_animdata_test(cu->adt)) outliner_add_element(soops, &te->subtree, cu, te, TSE_ANIM_DATA, 0); - + for (a = 0; a < cu->totcol; a++) outliner_add_element(soops, &te->subtree, cu->mat[a], te, 0, a); break; @@ -647,10 +647,10 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor { MetaBall *mb = (MetaBall *)id; int a; - + if (outliner_animdata_test(mb->adt)) outliner_add_element(soops, &te->subtree, mb, te, TSE_ANIM_DATA, 0); - + for (a = 0; a < mb->totcol; a++) outliner_add_element(soops, &te->subtree, mb->mat[a], te, 0, a); break; @@ -658,7 +658,7 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor case ID_MA: { Material *ma = (Material *)id; - + if (outliner_animdata_test(ma->adt)) outliner_add_element(soops, &te->subtree, ma, te, TSE_ANIM_DATA, 0); break; @@ -666,17 +666,17 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor case ID_TE: { Tex *tex = (Tex *)id; - + if (outliner_animdata_test(tex->adt)) outliner_add_element(soops, &te->subtree, tex, te, TSE_ANIM_DATA, 0); - + outliner_add_element(soops, &te->subtree, tex->ima, te, 0, 0); break; } case ID_CA: { Camera *ca = (Camera *)id; - + if (outliner_animdata_test(ca->adt)) outliner_add_element(soops, &te->subtree, ca, te, TSE_ANIM_DATA, 0); break; @@ -694,7 +694,7 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor case ID_LA: { Lamp *la = (Lamp *)id; - + if (outliner_animdata_test(la->adt)) outliner_add_element(soops, &te->subtree, la, te, TSE_ANIM_DATA, 0); break; @@ -718,7 +718,7 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor case ID_WO: { World *wrld = (World *)id; - + if (outliner_animdata_test(wrld->adt)) outliner_add_element(soops, &te->subtree, wrld, te, TSE_ANIM_DATA, 0); break; @@ -726,7 +726,7 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor case ID_KE: { Key *key = (Key *)id; - + if (outliner_animdata_test(key->adt)) outliner_add_element(soops, &te->subtree, key, te, TSE_ANIM_DATA, 0); break; @@ -741,14 +741,14 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor { bArmature *arm = (bArmature *)id; int a = 0; - + if (outliner_animdata_test(arm->adt)) outliner_add_element(soops, &te->subtree, arm, te, TSE_ANIM_DATA, 0); - + if (arm->edbo) { EditBone *ebone; TreeElement *ten; - + for (ebone = arm->edbo->first; ebone; ebone = ebone->next, a++) { ten = outliner_add_element(soops, &te->subtree, id, te, TSE_EBONE, a); ten->directdata = ebone; @@ -788,7 +788,7 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor { FreestyleLineStyle *linestyle = (FreestyleLineStyle *)id; int a; - + if (outliner_animdata_test(linestyle->adt)) outliner_add_element(soops, &te->subtree, linestyle, te, TSE_ANIM_DATA, 0); @@ -803,10 +803,10 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor bGPdata *gpd = (bGPdata *)id; bGPDlayer *gpl; int a = 0; - + if (outliner_animdata_test(gpd->adt)) outliner_add_element(soops, &te->subtree, gpd, te, TSE_ANIM_DATA, 0); - + // TODO: base element for layers? for (gpl = gpd->layers.first; gpl; gpl = gpl->next) { outliner_add_element(soops, &te->subtree, gpl, te, TSE_GP_LAYER, a); @@ -835,7 +835,7 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i TreeElement *te; TreeStoreElem *tselem; ID *id = idv; - + if (ELEM(type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) { id = ((PointerRNA *)idv)->id.data; if (!id) id = ((PointerRNA *)idv)->data; @@ -864,11 +864,11 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i /* add to the storage */ check_persistent(soops, te, id, type, index); tselem = TREESTORE(te); - + /* if we are searching for something expand to see child elements */ if (SEARCHING_OUTLINER(soops)) tselem->flag |= TSE_CHILDSEARCH; - + te->parent = parent; te->index = index; // for data arays if (ELEM(type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP)) { @@ -897,10 +897,10 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i te->name = id->name + 2; // default, can be overridden by Library or non-ID data te->idcode = GS(id->name); } - + if (type == 0) { TreeStoreElem *tsepar = parent ? TREESTORE(parent) : NULL; - + /* ID datablock */ if (tsepar == NULL || tsepar->type != TSE_ID_BASE || soops->filter_id_type) { outliner_add_id_contents(soops, te, tselem, id); @@ -909,30 +909,30 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i else if (type == TSE_ANIM_DATA) { IdAdtTemplate *iat = (IdAdtTemplate *)idv; AnimData *adt = (AnimData *)iat->adt; - + /* this element's info */ te->name = IFACE_("Animation"); te->directdata = adt; - + /* Action */ outliner_add_element(soops, &te->subtree, adt->action, te, 0, 0); - + /* Drivers */ if (adt->drivers.first) { TreeElement *ted = outliner_add_element(soops, &te->subtree, adt, te, TSE_DRIVER_BASE, 0); ID *lastadded = NULL; FCurve *fcu; - + ted->name = IFACE_("Drivers"); - + for (fcu = adt->drivers.first; fcu; fcu = fcu->next) { if (fcu->driver && fcu->driver->variables.first) { ChannelDriver *driver = fcu->driver; DriverVar *dvar; - + for (dvar = driver->variables.first; dvar; dvar = dvar->next) { /* loop over all targets used here */ - DRIVER_TARGETS_USED_LOOPER(dvar) + DRIVER_TARGETS_USED_LOOPER(dvar) { if (lastadded != dtar->id) { // XXX this lastadded check is rather lame, and also fails quite badly... @@ -945,23 +945,23 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i } } } - + /* NLA Data */ if (adt->nla_tracks.first) { TreeElement *tenla = outliner_add_element(soops, &te->subtree, adt, te, TSE_NLA, 0); NlaTrack *nlt; int a = 0; - + tenla->name = IFACE_("NLA Tracks"); - + for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) { TreeElement *tenlt = outliner_add_element(soops, &tenla->subtree, nlt, tenla, TSE_NLA_TRACK, a); NlaStrip *strip; TreeElement *ten; int b = 0; - + tenlt->name = nlt->name; - + for (strip = nlt->strips.first; strip; strip = strip->next, b++) { ten = outliner_add_element(soops, &tenlt->subtree, strip->act, tenlt, TSE_NLA_ACTION, b); if (ten) ten->directdata = strip; @@ -971,7 +971,7 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i } else if (type == TSE_GP_LAYER) { bGPDlayer *gpl = (bGPDlayer *)idv; - + te->name = gpl->info; te->directdata = gpl; } @@ -1144,31 +1144,31 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i wmKeyMap *km = (wmKeyMap *)idv; wmKeyMapItem *kmi; char opname[OP_MAX_TYPENAME]; - + te->directdata = idv; te->name = km->idname; - + if (TSELEM_OPEN(tselem, soops)) { int a = 0; - + for (kmi = km->items.first; kmi; kmi = kmi->next, a++) { const char *key = WM_key_event_string(kmi->type, false); - + if (key[0]) { wmOperatorType *ot = NULL; - + if (kmi->propvalue) { /* pass */ } else { ot = WM_operatortype_find(kmi->idname, 0); } - + if (ot || kmi->propvalue) { TreeElement *ten = outliner_add_element(soops, &te->subtree, kmi, te, TSE_KEYMAP_ITEM, a); - + ten->directdata = kmi; - + if (kmi->propvalue) { ten->name = IFACE_("Modal map, not yet"); } @@ -1181,7 +1181,7 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i } } } - else + else te->flag |= TE_LAZY_CLOSED; } @@ -1289,7 +1289,7 @@ static TreeElement *outliner_add_library_contents(Main *mainvar, SpaceOops *soop ListBase *lbarray[MAX_LIBARRAY]; int a, tot; short filter_id_type = (soops->filter & SO_FILTER_ID_TYPE) ? soops->filter_id_type : 0; - + if (filter_id_type) { lbarray[0] = which_libbase(mainvar, soops->filter_id_type); tot = 1; @@ -1301,12 +1301,12 @@ static TreeElement *outliner_add_library_contents(Main *mainvar, SpaceOops *soop for (a = 0; a < tot; a++) { if (lbarray[a] && lbarray[a]->first) { ID *id = lbarray[a]->first; - + /* check if there's data in current lib */ for (; id; id = id->next) if (id->lib == lib) break; - + if (id) { if (!tenlib) { /* Create library tree element on demand, depending if there are any datablocks. */ @@ -1328,7 +1328,7 @@ static TreeElement *outliner_add_library_contents(Main *mainvar, SpaceOops *soop ten->directdata = lbarray[a]; ten->name = outliner_idcode_to_plural(GS(id->name)); } - + for (id = lbarray[a]->first; id; id = id->next) { if (outliner_library_id_show(lib, id, filter_id_type)) { outliner_add_element(soops, &ten->subtree, id, ten, 0, 0); @@ -1347,7 +1347,7 @@ static void outliner_add_orphaned_datablocks(Main *mainvar, SpaceOops *soops) ListBase *lbarray[MAX_LIBARRAY]; int a, tot; short filter_id_type = (soops->filter & SO_FILTER_ID_TYPE) ? soops->filter_id_type : 0; - + if (filter_id_type) { lbarray[0] = which_libbase(mainvar, soops->filter_id_type); tot = 1; @@ -1359,13 +1359,13 @@ static void outliner_add_orphaned_datablocks(Main *mainvar, SpaceOops *soops) for (a = 0; a < tot; a++) { if (lbarray[a] && lbarray[a]->first) { ID *id = lbarray[a]->first; - + /* check if there are any datablocks of this type which are orphans */ for (; id; id = id->next) { if (ID_REAL_USERS(id) <= 0) break; } - + if (id) { /* header for this type of datablock */ if (filter_id_type) { @@ -1376,7 +1376,7 @@ static void outliner_add_orphaned_datablocks(Main *mainvar, SpaceOops *soops) ten->directdata = lbarray[a]; ten->name = outliner_idcode_to_plural(GS(id->name)); } - + /* add the orphaned datablocks - these will not be added with any subtrees attached */ for (id = lbarray[a]->first; id; id = id->next) { if (ID_REAL_USERS(id) <= 0) @@ -1568,7 +1568,7 @@ static void outliner_make_object_parent_hierarchy(ListBase *lb) while (te) { ten = te->next; tselem = TREESTORE(te); - + if (tselem->type == 0 && te->idcode == ID_OB) { Object *ob = (Object *)tselem->id; if (ob->parent && ob->parent->id.newid) { @@ -1597,16 +1597,16 @@ static int treesort_alpha_ob(const void *v1, const void *v2) { const tTreeSort *x1 = v1, *x2 = v2; int comp; - + /* first put objects last (hierarchy) */ comp = (x1->idcode == ID_OB); if (x2->idcode == ID_OB) comp += 2; - + if (comp == 1) return 1; else if (comp == 2) return -1; else if (comp == 3) { comp = strcmp(x1->name, x2->name); - + if (comp > 0) return 1; else if (comp < 0) return -1; return 0; @@ -1619,9 +1619,9 @@ static int treesort_alpha(const void *v1, const void *v2) { const tTreeSort *x1 = v1, *x2 = v2; int comp; - + comp = strcmp(x1->name, x2->name); - + if (comp > 0) return 1; else if (comp < 0) return -1; return 0; @@ -1633,7 +1633,7 @@ static int treesort_alpha(const void *v1, const void *v2) static int treesort_obtype_alpha(const void *v1, const void *v2) { const tTreeSort *x1 = v1, *x2 = v2; - + /* first put objects last (hierarchy) */ if (x1->idcode == ID_OB && x2->idcode != ID_OB) { return 1; @@ -1650,7 +1650,7 @@ static int treesort_obtype_alpha(const void *v1, const void *v2) } else { int comp = strcmp(x1->name, x2->name); - + if (comp > 0) return 1; else if (comp < 0) return -1; return 0; @@ -1683,15 +1683,15 @@ static void outliner_sort(ListBase *lb) tp->te = te; tp->name = te->name; tp->idcode = te->idcode; - + if (tselem->type && tselem->type != TSE_DEFGROUP) tp->idcode = 0; // don't sort this if (tselem->type == TSE_ID_BASE) tp->idcode = 1; // do sort this - + tp->id = tselem->id; } - + /* just sort alphabetically */ if (tear->idcode == 1) { qsort(tear, totelem, sizeof(tTreeSort), treesort_alpha); @@ -1700,11 +1700,11 @@ static void outliner_sort(ListBase *lb) /* keep beginning of list */ for (tp = tear, skip = 0; skip < totelem; skip++, tp++) if (tp->idcode) break; - + if (skip < totelem) qsort(tear + skip, totelem - skip, sizeof(tTreeSort), treesort_alpha_ob); } - + BLI_listbase_clear(lb); tp = tear; while (totelem--) { @@ -1714,7 +1714,7 @@ static void outliner_sort(ListBase *lb) MEM_freeN(tear); } } - + for (te = lb->first; te; te = te->next) { outliner_sort(&te->subtree); } @@ -2052,7 +2052,7 @@ static int outliner_filter_subtree( /* flag as not a found item */ tselem->flag &= ~TSE_SEARCHMATCH; - + if ((!TSELEM_OPEN(tselem, soops)) || outliner_filter_subtree(soops, view_layer, &te->subtree, search_string, exclude_filter) == 0) { @@ -2130,11 +2130,11 @@ void outliner_build_tree(Main *mainvar, Scene *scene, ViewLayer *view_layer, Spa outliner_free_tree(&soops->tree); outliner_storage_cleanup(soops); - + /* options */ if (soops->outlinevis == SO_LIBRARIES) { Library *lib; - + /* current file first - mainvar provides tselem with unique pointer - not used */ ten = outliner_add_library_contents(mainvar, soops, &soops->tree, NULL); if (ten) { @@ -2142,7 +2142,7 @@ void outliner_build_tree(Main *mainvar, Scene *scene, ViewLayer *view_layer, Spa if (!tselem->used) tselem->flag &= ~TSE_CLOSED; } - + for (lib = mainvar->library.first; lib; lib = lib->id.next) { ten = outliner_add_library_contents(mainvar, soops, &soops->tree, lib); if (ten) { @@ -2178,7 +2178,7 @@ void outliner_build_tree(Main *mainvar, Scene *scene, ViewLayer *view_layer, Spa /* restore newid pointers */ for (lib = mainvar->library.first; lib; lib = lib->id.next) lib->id.newid = NULL; - + } else if (soops->outlinevis == SO_SCENES) { Scene *sce; diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c index b36b2903118..71ae7eeeb3d 100644 --- a/source/blender/editors/space_outliner/space_outliner.c +++ b/source/blender/editors/space_outliner/space_outliner.c @@ -68,7 +68,7 @@ static void outliner_main_region_init(wmWindowManager *wm, ARegion *ar) { ListBase *lb; wmKeyMap *keymap; - + /* make sure we keep the hide flags */ ar->v2d.scroll |= (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM); ar->v2d.scroll &= ~(V2D_SCROLL_LEFT | V2D_SCROLL_TOP); /* prevent any noise of past */ @@ -81,7 +81,7 @@ static void outliner_main_region_init(wmWindowManager *wm, ARegion *ar) ar->v2d.minzoom = ar->v2d.maxzoom = 1.0f; UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_LIST, ar->winx, ar->winy); - + /* own keymap */ keymap = WM_keymap_find(wm->defaultconf, "Outliner", SPACE_OUTLINER, 0); /* don't pass on view2d mask, it's always set with scrollbar space, hide fails */ @@ -286,16 +286,16 @@ static void outliner_main_region_draw(const bContext *C, ARegion *ar) { View2D *v2d = &ar->v2d; View2DScrollers *scrollers; - + /* clear */ UI_ThemeClearColor(TH_BACK); glClear(GL_COLOR_BUFFER_BIT); - + draw_outliner(C); - + /* reset view matrix */ UI_view2d_view_restore(C); - + /* scrollers */ scrollers = UI_view2d_scrollers_calc(C, v2d, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY); UI_view2d_scrollers_draw(C, v2d, scrollers); @@ -305,7 +305,7 @@ static void outliner_main_region_draw(const bContext *C, ARegion *ar) static void outliner_main_region_free(ARegion *UNUSED(ar)) { - + } static void outliner_main_region_listener( @@ -418,7 +418,7 @@ static void outliner_main_region_listener( } break; } - + } static void outliner_main_region_message_subscribe( @@ -484,20 +484,20 @@ static SpaceLink *outliner_new(const ScrArea *UNUSED(area), const Scene *UNUSED( soutliner = MEM_callocN(sizeof(SpaceOops), "initoutliner"); soutliner->spacetype = SPACE_OUTLINER; soutliner->filter_id_type = ID_GR; - + /* header */ ar = MEM_callocN(sizeof(ARegion), "header for outliner"); - + BLI_addtail(&soutliner->regionbase, ar); ar->regiontype = RGN_TYPE_HEADER; ar->alignment = RGN_ALIGN_TOP; - + /* main region */ ar = MEM_callocN(sizeof(ARegion), "main region for outliner"); - + BLI_addtail(&soutliner->regionbase, ar); ar->regiontype = RGN_TYPE_WINDOW; - + return (SpaceLink *)soutliner; } @@ -505,7 +505,7 @@ static SpaceLink *outliner_new(const ScrArea *UNUSED(area), const Scene *UNUSED( static void outliner_free(SpaceLink *sl) { SpaceOops *soutliner = (SpaceOops *)sl; - + outliner_free_tree(&soutliner->tree); if (soutliner->treestore) { BLI_mempool_destroy(soutliner->treestore); @@ -518,7 +518,7 @@ static void outliner_free(SpaceLink *sl) /* spacetype; init callback */ static void outliner_init(wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa)) { - + } static SpaceLink *outliner_duplicate(SpaceLink *sl) @@ -529,7 +529,7 @@ static SpaceLink *outliner_duplicate(SpaceLink *sl) BLI_listbase_clear(&soutlinern->tree); soutlinern->treestore = NULL; soutlinern->treehash = NULL; - + return (SpaceLink *)soutlinern; } @@ -571,10 +571,10 @@ void ED_spacetype_outliner(void) { SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype time"); ARegionType *art; - + st->spaceid = SPACE_OUTLINER; strncpy(st->name, "Outliner", BKE_ST_MAXNAME); - + st->new = outliner_new; st->free = outliner_free; st->init = outliner_init; @@ -588,26 +588,26 @@ void ED_spacetype_outliner(void) art = MEM_callocN(sizeof(ARegionType), "spacetype outliner region"); art->regionid = RGN_TYPE_WINDOW; art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES; - + art->init = outliner_main_region_init; art->draw = outliner_main_region_draw; art->free = outliner_main_region_free; art->listener = outliner_main_region_listener; art->message_subscribe = outliner_main_region_message_subscribe; BLI_addhead(&st->regiontypes, art); - + /* regions: header */ art = MEM_callocN(sizeof(ARegionType), "spacetype outliner header region"); art->regionid = RGN_TYPE_HEADER; art->prefsizey = HEADERY; art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_HEADER; - + art->init = outliner_header_region_init; art->draw = outliner_header_region_draw; art->free = outliner_header_region_free; art->listener = outliner_header_region_listener; BLI_addhead(&st->regiontypes, art); - + BKE_spacetype_register(st); } |