diff options
Diffstat (limited to 'source/blender/editors/space_outliner')
-rw-r--r-- | source/blender/editors/space_outliner/outliner_draw.c | 269 | ||||
-rw-r--r-- | source/blender/editors/space_outliner/outliner_edit.c | 140 | ||||
-rw-r--r-- | source/blender/editors/space_outliner/outliner_select.c | 229 | ||||
-rw-r--r-- | source/blender/editors/space_outliner/outliner_tools.c | 187 | ||||
-rw-r--r-- | source/blender/editors/space_outliner/outliner_tree.c | 398 | ||||
-rw-r--r-- | source/blender/editors/space_outliner/space_outliner.c | 36 |
6 files changed, 632 insertions, 627 deletions
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index 5cc09bf7d97..1c58c4152f0 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -97,7 +97,7 @@ static void outliner_height(SpaceOops *soops, ListBase *lb, int *h) TreeElement *te= lb->first; while(te) { TreeStoreElem *tselem= TREESTORE(te); - if(TSELEM_OPEN(tselem,soops)) + if (TSELEM_OPEN(tselem,soops)) outliner_height(soops, &te->subtree, h); (*h) += UI_UNIT_Y; te= te->next; @@ -112,7 +112,7 @@ static void outliner_width(SpaceOops *soops, ListBase *lb, int *w) // TreeStoreElem *tselem= TREESTORE(te); // XXX fixme... te->xend is not set yet - if(!TSELEM_OPEN(tselem,soops)) { + if (!TSELEM_OPEN(tselem,soops)) { if (te->xend > *w) *w = te->xend; } @@ -129,15 +129,15 @@ static void outliner_rna_width(SpaceOops *soops, ListBase *lb, int *w, int start TreeStoreElem *tselem= TREESTORE(te); // XXX fixme... (currently, we're using a fixed length of 100)! #if 0 - if(te->xend) { - if(te->xend > *w) + if (te->xend) { + if (te->xend > *w) *w = te->xend; } #endif - if(startx+100 > *w) + if (startx+100 > *w) *w = startx+100; - if(TSELEM_OPEN(tselem,soops)) + if (TSELEM_OPEN(tselem,soops)) outliner_rna_width(soops, &te->subtree, w, startx+UI_UNIT_X); te= te->next; } @@ -150,7 +150,7 @@ static void restrictbutton_view_cb(bContext *C, void *poin, void *poin2) Scene *scene = (Scene *)poin; Object *ob = (Object *)poin2; - if(!common_restrict_check(C, ob)) return; + if (!common_restrict_check(C, ob)) return; /* deselect objects that are invisible */ if (ob->restrictflag & OB_RESTRICT_VIEW) { @@ -167,7 +167,7 @@ static void restrictbutton_sel_cb(bContext *C, void *poin, void *poin2) Scene *scene = (Scene *)poin; Object *ob = (Object *)poin2; - if(!common_restrict_check(C, ob)) return; + if (!common_restrict_check(C, ob)) return; /* if select restriction has just been turned on */ if (ob->restrictflag & OB_RESTRICT_SELECT) { @@ -201,7 +201,7 @@ static void restrictbutton_modifier_cb(bContext *C, void *UNUSED(poin), void *po static void restrictbutton_bone_cb(bContext *C, void *UNUSED(poin), void *poin2) { Bone *bone= (Bone *)poin2; - if(bone && (bone->flag & BONE_HIDDEN_P)) + if (bone && (bone->flag & BONE_HIDDEN_P)) bone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL); WM_event_add_notifier(C, NC_OBJECT|ND_POSE, NULL); } @@ -209,7 +209,7 @@ static void restrictbutton_bone_cb(bContext *C, void *UNUSED(poin), void *poin2) static void restrictbutton_ebone_cb(bContext *C, void *UNUSED(poin), void *poin2) { EditBone *ebone= (EditBone *)poin2; - if(ebone && (ebone->flag & BONE_HIDDEN_A)) + if (ebone && (ebone->flag & BONE_HIDDEN_A)) ebone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL); WM_event_add_notifier(C, NC_OBJECT|ND_POSE, NULL); @@ -219,8 +219,8 @@ static int group_restrict_flag(Group *gr, int flag) { GroupObject *gob; - for(gob= gr->gobject.first; gob; gob= gob->next) { - if((gob->ob->restrictflag & flag) == 0) + for (gob= gr->gobject.first; gob; gob= gob->next) { + if ((gob->ob->restrictflag & flag) == 0) return 0; } @@ -231,8 +231,8 @@ static int group_select_flag(Group *gr) { GroupObject *gob; - for(gob= gr->gobject.first; gob; gob= gob->next) - if((gob->ob->flag & SELECT)) + for (gob= gr->gobject.first; gob; gob= gob->next) + if ((gob->ob->flag & SELECT)) return 1; return 0; @@ -244,23 +244,23 @@ void restrictbutton_gr_restrict_flag(void *poin, void *poin2, int flag) GroupObject *gob; Group *gr = (Group *)poin2; - if(group_restrict_flag(gr, flag)) { - for(gob= gr->gobject.first; gob; gob= gob->next) { + if (group_restrict_flag(gr, flag)) { + for (gob= gr->gobject.first; gob; gob= gob->next) { gob->ob->restrictflag &= ~flag; - if(flag==OB_RESTRICT_VIEW) - if(gob->ob->flag & SELECT) + if (flag==OB_RESTRICT_VIEW) + if (gob->ob->flag & SELECT) ED_base_object_select(object_in_scene(gob->ob, scene), BA_DESELECT); } } else { - for(gob= gr->gobject.first; gob; gob= gob->next) { + for (gob= gr->gobject.first; gob; gob= gob->next) { /* not in editmode */ - if(scene->obedit!=gob->ob) { + if (scene->obedit!=gob->ob) { gob->ob->restrictflag |= flag; - if(flag==OB_RESTRICT_VIEW) - if((gob->ob->flag & SELECT) == 0) + if (flag==OB_RESTRICT_VIEW) + if ((gob->ob->flag & SELECT) == 0) ED_base_object_select(object_in_scene(gob->ob, scene), BA_SELECT); } } @@ -292,10 +292,10 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname) TreeStore *ts= soops->treestore; TreeStoreElem *tselem= tsep; - if(ts && tselem) { + if (ts && tselem) { TreeElement *te= outliner_find_tse(soops, tselem); - if(tselem->type==0) { + if (tselem->type==0) { test_idbutton(tselem->id->name+2); // library.c, unique name and alpha sort switch(GS(tselem->id->name)) { @@ -335,7 +335,7 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname) case TSE_EBONE: { bArmature *arm= (bArmature *)tselem->id; - if(arm->edbo) { + if (arm->edbo) { EditBone *ebone= te->directdata; char newname[sizeof(ebone->name)]; @@ -407,11 +407,11 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar Object *ob = NULL; Group *gr = NULL; - for(te= lb->first; te; te= te->next) { + for (te= lb->first; te; te= te->next) { tselem= TREESTORE(te); - if(te->ys+2*UI_UNIT_Y >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) { + if (te->ys+2*UI_UNIT_Y >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) { /* objects have toggle-able restriction flags */ - if(tselem->type==0 && te->idcode==ID_OB) { + if (tselem->type==0 && te->idcode==ID_OB) { PointerRNA ptr; ob = (Object *)tselem->id; @@ -436,7 +436,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar uiBlockSetEmboss(block, UI_EMBOSS); } - if(tselem->type==0 && te->idcode==ID_GR){ + if (tselem->type==0 && te->idcode==ID_GR) { int restrict_bool; gr = (Group *)tselem->id; @@ -457,7 +457,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar uiBlockSetEmboss(block, UI_EMBOSS); } /* scene render layers and passes have toggle-able flags too! */ - else if(tselem->type==TSE_R_LAYER) { + else if (tselem->type==TSE_R_LAYER) { uiBlockSetEmboss(block, UI_EMBOSSN); bt= uiDefIconButBitI(block, ICONTOGN, SCE_LAY_DISABLE, 0, ICON_CHECKBOX_HLT-1, @@ -466,7 +466,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar uiBlockSetEmboss(block, UI_EMBOSS); } - else if(tselem->type==TSE_R_PASS) { + else if (tselem->type==TSE_R_PASS) { int *layflag= te->directdata; int passflag= 1<<tselem->nr; @@ -478,14 +478,14 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar uiButSetFunc(bt, restrictbutton_r_lay_cb, tselem->id, NULL); layflag++; /* is lay_xor */ - if(ELEM8(passflag, SCE_PASS_SPEC, SCE_PASS_SHADOW, SCE_PASS_AO, SCE_PASS_REFLECT, SCE_PASS_REFRACT, SCE_PASS_INDIRECT, SCE_PASS_EMIT, SCE_PASS_ENVIRONMENT)) + if (ELEM8(passflag, SCE_PASS_SPEC, SCE_PASS_SHADOW, SCE_PASS_AO, SCE_PASS_REFLECT, SCE_PASS_REFRACT, SCE_PASS_INDIRECT, SCE_PASS_EMIT, SCE_PASS_ENVIRONMENT)) bt= uiDefIconButBitI(block, TOG, passflag, 0, (*layflag & passflag)?ICON_DOT:ICON_BLANK1, (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX, (int)te->ys, UI_UNIT_X-1, UI_UNIT_Y-1, layflag, 0, 0, 0, 0, "Exclude this Pass from Combined"); uiButSetFunc(bt, restrictbutton_r_lay_cb, tselem->id, NULL); uiBlockSetEmboss(block, UI_EMBOSS); } - else if(tselem->type==TSE_MODIFIER) { + else if (tselem->type==TSE_MODIFIER) { ModifierData *md= (ModifierData *)te->directdata; ob = (Object *)tselem->id; @@ -498,7 +498,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_RENDERX, (int)te->ys, UI_UNIT_X-1, UI_UNIT_Y-1, &(md->mode), 0, 0, 0, 0, "Restrict/Allow renderability"); uiButSetFunc(bt, restrictbutton_modifier_cb, scene, ob); } - else if(tselem->type==TSE_POSE_CHANNEL) { + else if (tselem->type==TSE_POSE_CHANNEL) { bPoseChannel *pchan= (bPoseChannel *)te->directdata; Bone *bone = pchan->bone; @@ -511,7 +511,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX, (int)te->ys, UI_UNIT_X-1, UI_UNIT_Y-1, &(bone->flag), 0, 0, 0, 0, "Restrict/Allow selection in the 3D View"); uiButSetFunc(bt, restrictbutton_bone_cb, NULL, NULL); } - else if(tselem->type==TSE_EBONE) { + else if (tselem->type==TSE_EBONE) { EditBone *ebone= (EditBone *)te->directdata; uiBlockSetEmboss(block, UI_EMBOSSN); @@ -525,7 +525,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar } } - if(TSELEM_OPEN(tselem,soops)) outliner_draw_restrictbuts(block, scene, ar, soops, &te->subtree); + if (TSELEM_OPEN(tselem,soops)) outliner_draw_restrictbuts(block, scene, ar, soops, &te->subtree); } } @@ -534,7 +534,7 @@ static void outliner_draw_rnacols(ARegion *ar, int sizex) View2D *v2d= &ar->v2d; float miny = v2d->cur.ymin-V2D_SCROLL_HEIGHT; - if(miny<v2d->tot.ymin) miny = v2d->tot.ymin; + if (miny<v2d->tot.ymin) miny = v2d->tot.ymin; UI_ThemeColorShadeAlpha(TH_BACK, -15, -200); @@ -559,17 +559,17 @@ static void outliner_draw_rnabuts(uiBlock *block, Scene *scene, ARegion *ar, Spa uiBlockSetEmboss(block, UI_EMBOSST); - for(te= lb->first; te; te= te->next) { + for (te= lb->first; te; te= te->next) { tselem= TREESTORE(te); - if(te->ys+2*UI_UNIT_Y >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) { - if(tselem->type == TSE_RNA_PROPERTY) { + if (te->ys+2*UI_UNIT_Y >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) { + if (tselem->type == TSE_RNA_PROPERTY) { ptr= &te->rnaptr; prop= te->directdata; - if(!(RNA_property_type(prop) == PROP_POINTER && (TSELEM_OPEN(tselem,soops))) ) + if (!(RNA_property_type(prop) == PROP_POINTER && (TSELEM_OPEN(tselem,soops))) ) uiDefAutoButR(block, ptr, prop, -1, "", ICON_NONE, sizex, (int)te->ys, OL_RNA_COL_SIZEX, UI_UNIT_Y-1); } - else if(tselem->type == TSE_RNA_ARRAY_ELEM) { + else if (tselem->type == TSE_RNA_ARRAY_ELEM) { ptr= &te->rnaptr; prop= te->directdata; @@ -577,7 +577,7 @@ static void outliner_draw_rnabuts(uiBlock *block, Scene *scene, ARegion *ar, Spa } } - if(TSELEM_OPEN(tselem,soops)) outliner_draw_rnabuts(block, scene, ar, soops, sizex, &te->subtree); + if (TSELEM_OPEN(tselem,soops)) outliner_draw_rnabuts(block, scene, ar, soops, sizex, &te->subtree); } } @@ -586,7 +586,7 @@ static void operator_call_cb(struct bContext *UNUSED(C), void *arg_kmi, void *ar wmOperatorType *ot= arg2; wmKeyMapItem *kmi = arg_kmi; - if(ot) + if (ot) BLI_strncpy(kmi->idname, ot->idname, OP_MAX_TYPENAME); } @@ -594,16 +594,16 @@ static void operator_search_cb(const struct bContext *UNUSED(C), void *UNUSED(ar { GHashIterator *iter= WM_operatortype_iter(); - for( ; !BLI_ghashIterator_isDone(iter); BLI_ghashIterator_step(iter)) { + for ( ; !BLI_ghashIterator_isDone(iter); BLI_ghashIterator_step(iter)) { wmOperatorType *ot= BLI_ghashIterator_getValue(iter); - if(BLI_strcasestr(ot->idname, str)) { + if (BLI_strcasestr(ot->idname, str)) { char name[OP_MAX_TYPENAME]; /* display name for menu */ WM_operator_py_idname(name, ot->idname); - if(0==uiSearchItemAdd(items, name, ot, 0)) + if (0==uiSearchItemAdd(items, name, ot, 0)) break; } } @@ -654,9 +654,9 @@ static uiBlock *operator_search_menu(bContext *C, ARegion *ar, void *arg_kmi) static short keymap_menu_type(short type) { - if(ISKEYBOARD(type)) return OL_KM_KEYBOARD; - if(ISTWEAK(type)) return OL_KM_TWEAK; - if(ISMOUSE(type)) return OL_KM_MOUSE; + if (ISKEYBOARD(type)) return OL_KM_KEYBOARD; + if (ISTWEAK(type)) return OL_KM_TWEAK; + if (ISMOUSE(type)) return OL_KM_MOUSE; // return OL_KM_SPECIALS; return 0; } @@ -738,7 +738,7 @@ static void keymap_type_cb(bContext *C, void *kmi_v, void *UNUSED(arg_v)) wmKeyMapItem *kmi = kmi_v; short maptype= keymap_menu_type(kmi->type); - if(maptype!=kmi->maptype) { + if (maptype!=kmi->maptype) { switch(kmi->maptype) { case OL_KM_KEYBOARD: kmi->type= AKEY; @@ -767,9 +767,9 @@ static void outliner_draw_keymapbuts(uiBlock *block, ARegion *ar, SpaceOops *soo uiBlockSetEmboss(block, UI_EMBOSST); - for(te= lb->first; te; te= te->next) { + for (te= lb->first; te; te= te->next) { tselem= TREESTORE(te); - if(te->ys+2*UI_UNIT_Y >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) { + if (te->ys+2*UI_UNIT_Y >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) { uiBut *but; const char *str; int xstart= 240; @@ -777,11 +777,11 @@ static void outliner_draw_keymapbuts(uiBlock *block, ARegion *ar, SpaceOops *soo int butw2= 90; /* event type, menus */ int butw3= 43; /* modifiers */ - if(tselem->type == TSE_KEYMAP_ITEM) { + if (tselem->type == TSE_KEYMAP_ITEM) { wmKeyMapItem *kmi = te->directdata; /* modal map? */ - if(kmi->propvalue); + if (kmi->propvalue); else { uiDefBlockBut(block, operator_search_menu, kmi, "", xstart, (int)te->ys+1, butw1, UI_UNIT_Y-1, "Assign new Operator"); } @@ -826,7 +826,7 @@ static void outliner_draw_keymapbuts(uiBlock *block, ARegion *ar, SpaceOops *soo xstart+= butw3+5; /* rna property */ - if(kmi->ptr && kmi->ptr->data) { + if (kmi->ptr && kmi->ptr->data) { uiDefBut(block, LABEL, 0, "(RNA property)", xstart, (int)te->ys+1, butw2, UI_UNIT_Y-1, &kmi->oskey, 0, 0, 0, 0, ""); xstart+= butw2; } @@ -834,7 +834,7 @@ static void outliner_draw_keymapbuts(uiBlock *block, ARegion *ar, SpaceOops *soo } } - if(TSELEM_OPEN(tselem,soops)) outliner_draw_keymapbuts(block, ar, soops, &te->subtree); + if (TSELEM_OPEN(tselem,soops)) outliner_draw_keymapbuts(block, ar, soops, &te->subtree); } } @@ -846,38 +846,38 @@ static void outliner_buttons(const bContext *C, uiBlock *block, ARegion *ar, Spa TreeStoreElem *tselem; int spx, dx, len; - for(te= lb->first; te; te= te->next) { + for (te= lb->first; te; te= te->next) { tselem= TREESTORE(te); - if(te->ys+2*UI_UNIT_Y >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) { + if (te->ys+2*UI_UNIT_Y >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) { - if(tselem->flag & TSE_TEXTBUT) { + if (tselem->flag & TSE_TEXTBUT) { /* If we add support to rename Sequence. * need change this. */ - if(tselem->type == TSE_POSE_BASE) continue; // prevent crash when trying to rename 'pose' entry of armature + if (tselem->type == TSE_POSE_BASE) continue; // prevent crash when trying to rename 'pose' entry of armature - if(tselem->type==TSE_EBONE) len = sizeof(((EditBone*) 0)->name); + if (tselem->type==TSE_EBONE) len = sizeof(((EditBone*) 0)->name); else if (tselem->type==TSE_MODIFIER) len = sizeof(((ModifierData*) 0)->name); - else if(tselem->id && GS(tselem->id->name)==ID_LI) len = sizeof(((Library*) 0)->name); + else if (tselem->id && GS(tselem->id->name)==ID_LI) len = sizeof(((Library*) 0)->name); else len= MAX_ID_NAME-2; dx= (int)UI_GetStringWidth(te->name); - if(dx<100) dx= 100; + if (dx<100) dx= 100; spx=te->xs+2*UI_UNIT_X-4; - if(spx+dx+10>ar->v2d.cur.xmax) dx = ar->v2d.cur.xmax-spx-10; + if (spx+dx+10>ar->v2d.cur.xmax) dx = ar->v2d.cur.xmax-spx-10; bt= uiDefBut(block, TEX, OL_NAMEBUTTON, "", spx, (int)te->ys, dx+10, UI_UNIT_Y-1, (void *)te->name, 1.0, (float)len, 0, 0, ""); uiButSetRenameFunc(bt, namebutton_cb, tselem); /* returns false if button got removed */ - if( 0 == uiButActiveOnly(C, block, bt) ) + if ( 0 == uiButActiveOnly(C, block, bt) ) tselem->flag &= ~TSE_TEXTBUT; } } - if(TSELEM_OPEN(tselem,soops)) outliner_buttons(C, block, ar, soops, &te->subtree); + if (TSELEM_OPEN(tselem,soops)) outliner_buttons(C, block, ar, soops, &te->subtree); } } @@ -895,16 +895,17 @@ struct DrawIconArg { static void tselem_draw_icon_uibut(struct DrawIconArg *arg, int icon) { /* restrict column clip... it has been coded by simply overdrawing, doesnt work for buttons */ - if(arg->x >= arg->xmax) { + if (arg->x >= arg->xmax) { glEnable(GL_BLEND); UI_icon_draw_aspect(arg->x, arg->y, icon, 1.0f, arg->alpha); glDisable(GL_BLEND); - } else { + } + else { /* XXX investigate: button placement of icons is way different than UI_icon_draw? */ float ufac= UI_UNIT_X/20.0f; uiBut *but = uiDefIconBut(arg->block, LABEL, 0, icon, arg->x-3.0f*ufac, arg->y, UI_UNIT_X-4.0f*ufac, UI_UNIT_Y-4.0f*ufac, NULL, 0.0, 0.0, 1.0, arg->alpha, (arg->id && arg->id->lib) ? arg->id->lib->name : ""); - if(arg->id) + if (arg->id) uiButSetDragID(but, arg->id); } @@ -922,7 +923,7 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto arg.y= y; arg.alpha= alpha; - if(tselem->type) { + if (tselem->type) { switch( tselem->type) { case TSE_ANIM_DATA: UI_icon_draw(x, y, ICON_ANIM_DATA); break; // xxx @@ -1052,15 +1053,15 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto case TSE_POSEGRP_BASE: UI_icon_draw(x, y, ICON_VERTEXSEL); break; case TSE_SEQUENCE: - if(te->idcode==SEQ_MOVIE) + if (te->idcode==SEQ_MOVIE) UI_icon_draw(x, y, ICON_SEQUENCE); - else if(te->idcode==SEQ_META) + else if (te->idcode==SEQ_META) UI_icon_draw(x, y, ICON_DOT); - else if(te->idcode==SEQ_SCENE) + else if (te->idcode==SEQ_SCENE) UI_icon_draw(x, y, ICON_SCENE); - else if(te->idcode==SEQ_SOUND) + else if (te->idcode==SEQ_SOUND) UI_icon_draw(x, y, ICON_SOUND); - else if(te->idcode==SEQ_IMAGE) + else if (te->idcode==SEQ_IMAGE) UI_icon_draw(x, y, ICON_IMAGE_COL); else UI_icon_draw(x, y, ICON_PARTICLES); @@ -1072,7 +1073,7 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto UI_icon_draw(x, y, ICON_OBJECT_DATA); break; case TSE_RNA_STRUCT: - if(RNA_struct_is_ID(te->rnaptr.type)) { + if (RNA_struct_is_ID(te->rnaptr.type)) { arg.id= (ID *)te->rnaptr.data; tselem_draw_icon_uibut(&arg, RNA_struct_ui_icon(te->rnaptr.type)); } @@ -1180,26 +1181,26 @@ static void outliner_draw_iconrow(bContext *C, uiBlock *block, Scene *scene, Spa TreeStoreElem *tselem; int active; - for(te= lb->first; te; te= te->next) { + for (te= lb->first; te; te= te->next) { /* exit drawing early */ - if((*offsx) - UI_UNIT_X > xmax) + if ((*offsx) - UI_UNIT_X > xmax) break; tselem= TREESTORE(te); /* object hierarchy always, further constrained on level */ - if(level<1 || (tselem->type==0 && te->idcode==ID_OB)) { + if (level<1 || (tselem->type==0 && te->idcode==ID_OB)) { /* active blocks get white circle */ - if(tselem->type==0) { - if(te->idcode==ID_OB) active= (OBACT==(Object *)tselem->id); - else if(scene->obedit && scene->obedit->data==tselem->id) active= 1; // XXX use context? + if (tselem->type==0) { + if (te->idcode==ID_OB) active= (OBACT==(Object *)tselem->id); + else if (scene->obedit && scene->obedit->data==tselem->id) active= 1; // XXX use context? else active= tree_element_active(C, scene, soops, te, 0); } else active= tree_element_type_active(NULL, scene, soops, te, tselem, 0); - if(active) { + if (active) { float ufac= UI_UNIT_X/20.0f; uiSetRoundBox(UI_CNR_ALL); @@ -1218,7 +1219,7 @@ static void outliner_draw_iconrow(bContext *C, uiBlock *block, Scene *scene, Spa } /* this tree element always has same amount of branches, so don't draw */ - if(tselem->type!=TSE_R_LAYER) + if (tselem->type!=TSE_R_LAYER) outliner_draw_iconrow(C, block, scene, soops, &te->subtree, level+1, xmax, offsx, ys); } @@ -1233,7 +1234,7 @@ static void outliner_set_coord_tree_element(SpaceOops *soops, TreeElement *te, i te->xs= (float)startx; te->ys= (float)(*starty); - for(ten= te->subtree.first; ten; ten= ten->next) { + for (ten= te->subtree.first; ten; ten= ten->next) { outliner_set_coord_tree_element(soops, ten, startx+UI_UNIT_X, starty); } } @@ -1248,11 +1249,11 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene tselem= TREESTORE(te); - if(*starty+2*UI_UNIT_Y >= ar->v2d.cur.ymin && *starty<= ar->v2d.cur.ymax) { + if (*starty+2*UI_UNIT_Y >= ar->v2d.cur.ymin && *starty<= ar->v2d.cur.ymax) { int xmax= ar->v2d.cur.xmax; /* icons can be ui buts, we don't want it to overlap with restrict */ - if((soops->flag & SO_HIDE_RESTRICTCOLS)==0) + if ((soops->flag & SO_HIDE_RESTRICTCOLS)==0) xmax-= OL_TOGW+UI_UNIT_X; glEnable(GL_BLEND); @@ -1272,17 +1273,17 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene } /* colors for active/selected data */ - if(tselem->type==0) { - if(te->idcode==ID_SCE) { - if(tselem->id == (ID *)scene) { + if (tselem->type==0) { + if (te->idcode==ID_SCE) { + if (tselem->id == (ID *)scene) { glColor4ub(255, 255, 255, 100); active= 2; } } - else if(te->idcode==ID_GR) { + else if (te->idcode==ID_GR) { Group *gr = (Group *)tselem->id; - if(group_select_flag(gr)) { + if (group_select_flag(gr)) { char col[4]; UI_GetThemeColorType4ubv(TH_SELECT, SPACE_VIEW3D, col); col[3]= 100; @@ -1291,24 +1292,24 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene active= 2; } } - else if(te->idcode==ID_OB) { + else if (te->idcode==ID_OB) { Object *ob= (Object *)tselem->id; - if(ob==OBACT || (ob->flag & SELECT)) { + if (ob==OBACT || (ob->flag & SELECT)) { char col[4]= {0, 0, 0, 0}; /* outliner active ob: always white text, circle color now similar to view3d */ active= 2; /* means it draws a color circle */ - if(ob==OBACT) { - if(ob->flag & SELECT) { + if (ob==OBACT) { + if (ob->flag & SELECT) { UI_GetThemeColorType4ubv(TH_ACTIVE, SPACE_VIEW3D, col); col[3]= 100; } active= 1; /* means it draws white text */ } - else if(ob->flag & SELECT) { + else if (ob->flag & SELECT) { UI_GetThemeColorType4ubv(TH_SELECT, SPACE_VIEW3D, col); col[3]= 100; } @@ -1317,24 +1318,24 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene } } - else if(scene->obedit && scene->obedit->data==tselem->id) { + else if (scene->obedit && scene->obedit->data==tselem->id) { glColor4ub(255, 255, 255, 100); active= 2; } else { - if(tree_element_active(C, scene, soops, te, 0)) { + if (tree_element_active(C, scene, soops, te, 0)) { glColor4ub(220, 220, 255, 100); active= 2; } } } else { - if( tree_element_type_active(NULL, scene, soops, te, tselem, 0) ) active= 2; + if ( tree_element_type_active(NULL, scene, soops, te, tselem, 0) ) active= 2; glColor4ub(220, 220, 255, 100); } /* active circle */ - if(active) { + if (active) { uiSetRoundBox(UI_CNR_ALL); uiRoundBox( (float)startx+UI_UNIT_Y-1.5f*ufac, (float)*starty+2.0f*ufac, (float)startx+2.0f*UI_UNIT_Y-4.0f*ufac, (float)*starty+UI_UNIT_Y-1.0f*ufac, UI_UNIT_Y/2.0f-2.0f*ufac); glEnable(GL_BLEND); /* roundbox disables it */ @@ -1343,15 +1344,15 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene } /* open/close icon, only when sublevels, except for scene */ - if(te->subtree.first || (tselem->type==0 && te->idcode==ID_SCE) || (te->flag & TE_LAZY_CLOSED)) { + if (te->subtree.first || (tselem->type==0 && te->idcode==ID_SCE) || (te->flag & TE_LAZY_CLOSED)) { int icon_x; - if(tselem->type==0 && ELEM(te->idcode, ID_OB, ID_SCE)) + if (tselem->type==0 && ELEM(te->idcode, ID_OB, ID_SCE)) icon_x = startx; else icon_x = startx+5*ufac; // icons a bit higher - if(TSELEM_OPEN(tselem,soops)) + if (TSELEM_OPEN(tselem,soops)) UI_icon_draw((float)icon_x, (float)*starty+2*ufac, ICON_DISCLOSURE_TRI_DOWN); else UI_icon_draw((float)icon_x, (float)*starty+2*ufac, ICON_DISCLOSURE_TRI_RIGHT); @@ -1360,7 +1361,7 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene /* datatype icon */ - if(!(ELEM(tselem->type, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM))) { + if (!(ELEM(tselem->type, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM))) { // icons a bit higher tselem_draw_icon(block, xmax, (float)startx+offsx - 0.5f*ufac, (float)*starty+2.0f*ufac, tselem, te, 1.0f); @@ -1369,9 +1370,9 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene else offsx+= 2*ufac; - if(tselem->type==0 && tselem->id->lib) { + if (tselem->type==0 && tselem->id->lib) { glPixelTransferf(GL_ALPHA_SCALE, 0.5f); - if(tselem->id->flag & LIB_INDIRECT) + if (tselem->id->flag & LIB_INDIRECT) UI_icon_draw((float)startx+offsx, (float)*starty+2*ufac, ICON_LIBRARY_DATA_INDIRECT); else UI_icon_draw((float)startx+offsx, (float)*starty+2*ufac, ICON_LIBRARY_DATA_DIRECT); @@ -1381,8 +1382,8 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene glDisable(GL_BLEND); /* name */ - if(active==1) UI_ThemeColor(TH_TEXT_HI); - else if(ELEM(tselem->type, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) UI_ThemeColorBlend(TH_BACK, TH_TEXT, 0.75f); + if (active==1) UI_ThemeColor(TH_TEXT_HI); + else if (ELEM(tselem->type, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) UI_ThemeColorBlend(TH_BACK, TH_TEXT, 0.75f); else UI_ThemeColor(TH_TEXT); UI_DrawString(startx+offsx, *starty+5*ufac, te->name); @@ -1390,10 +1391,10 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene offsx+= (int)(UI_UNIT_X + UI_GetStringWidth(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) { - if(tselem->type==0 && te->idcode==ID_SCE); - else if(tselem->type!=TSE_R_LAYER) { /* this tree element always has same amount of branches, so don't draw */ + if (!TSELEM_OPEN(tselem,soops)) { + if (te->subtree.first) { + if (tselem->type==0 && te->idcode==ID_SCE); + else if (tselem->type!=TSE_R_LAYER) { /* this tree element always has same amount of branches, so don't draw */ int tempx= startx+offsx; // divider @@ -1416,14 +1417,14 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene te->ys= (float)*starty; te->xend= startx+offsx; - if(TSELEM_OPEN(tselem,soops)) { + if (TSELEM_OPEN(tselem,soops)) { *starty-= UI_UNIT_Y; - for(ten= te->subtree.first; ten; ten= ten->next) + for (ten= te->subtree.first; ten; ten= ten->next) outliner_draw_tree_element(C, block, scene, ar, soops, ten, startx+UI_UNIT_X, starty); } else { - for(ten= te->subtree.first; ten; ten= ten->next) + for (ten= te->subtree.first; ten; ten= ten->next) outliner_set_coord_tree_element(soops, te, startx, starty); *starty-= UI_UNIT_Y; @@ -1436,28 +1437,28 @@ static void outliner_draw_hierarchy(SpaceOops *soops, ListBase *lb, int startx, TreeStoreElem *tselem; int y1, y2; - if(lb->first==NULL) return; + if (lb->first==NULL) return; y1=y2= *starty; /* for vertical lines between objects */ - for(te=lb->first; te; te= te->next) { + for (te=lb->first; te; te= te->next) { y2= *starty; tselem= TREESTORE(te); /* horizontal line? */ - if(tselem->type==0 && (te->idcode==ID_OB || te->idcode==ID_SCE)) + if (tselem->type==0 && (te->idcode==ID_OB || te->idcode==ID_SCE)) glRecti(startx, *starty, startx+UI_UNIT_X, *starty-1); *starty-= UI_UNIT_Y; - if(TSELEM_OPEN(tselem,soops)) + if (TSELEM_OPEN(tselem,soops)) outliner_draw_hierarchy(soops, &te->subtree, startx+UI_UNIT_X, starty); } /* vertical line */ te= lb->last; - if(te->parent || lb->first!=lb->last) { + if (te->parent || lb->first!=lb->last) { tselem= TREESTORE(te); - if(tselem->type==0 && te->idcode==ID_OB) { + if (tselem->type==0 && te->idcode==ID_OB) { glRecti(startx, y1+UI_UNIT_Y, startx+1, y2); } @@ -1469,18 +1470,18 @@ static void outliner_draw_struct_marks(ARegion *ar, SpaceOops *soops, ListBase * TreeElement *te; TreeStoreElem *tselem; - for(te= lb->first; te; te= te->next) { + for (te= lb->first; te; te= te->next) { tselem= TREESTORE(te); /* selection status */ - if(TSELEM_OPEN(tselem,soops)) - if(tselem->type == TSE_RNA_STRUCT) + if (TSELEM_OPEN(tselem,soops)) + if (tselem->type == TSE_RNA_STRUCT) glRecti(0, *starty+1, (int)ar->v2d.cur.xmax+V2D_SCROLL_WIDTH, *starty+UI_UNIT_Y-1); *starty-= UI_UNIT_Y; - if(TSELEM_OPEN(tselem,soops)) { + if (TSELEM_OPEN(tselem,soops)) { outliner_draw_struct_marks(ar, soops, &te->subtree, starty); - if(tselem->type == TSE_RNA_STRUCT) + if (tselem->type == TSE_RNA_STRUCT) fdrawline(0, (float)*starty+UI_UNIT_Y, ar->v2d.cur.xmax+V2D_SCROLL_WIDTH, (float)*starty+UI_UNIT_Y); } } @@ -1491,15 +1492,15 @@ static void outliner_draw_selection(ARegion *ar, SpaceOops *soops, ListBase *lb, TreeElement *te; TreeStoreElem *tselem; - for(te= lb->first; te; te= te->next) { + for (te= lb->first; te; te= te->next) { tselem= TREESTORE(te); /* selection status */ - if(tselem->flag & TSE_SELECTED) { + if (tselem->flag & TSE_SELECTED) { glRecti(0, *starty+1, (int)ar->v2d.cur.xmax, *starty+UI_UNIT_Y-1); } *starty-= UI_UNIT_Y; - if(TSELEM_OPEN(tselem,soops)) outliner_draw_selection(ar, soops, &te->subtree, starty); + if (TSELEM_OPEN(tselem,soops)) outliner_draw_selection(ar, soops, &te->subtree, starty); } } @@ -1535,7 +1536,7 @@ static void outliner_draw_tree(bContext *C, uiBlock *block, Scene *scene, ARegio // items themselves starty= (int)ar->v2d.tot.ymax-UI_UNIT_Y-OL_Y_OFFSET; startx= 0; - for(te= soops->tree.first; te; te= te->next) { + for (te= soops->tree.first; te; te= te->next) { outliner_draw_tree_element(C, block, scene, ar, soops, te, startx, &starty); } } @@ -1660,12 +1661,12 @@ void draw_outliner(const bContext *C) block= uiBeginBlock(C, ar, __func__, UI_EMBOSS); outliner_draw_tree((bContext *)C, block, scene, ar, soops); - if(ELEM(soops->outlinevis, SO_DATABLOCKS, SO_USERDEF)) { + if (ELEM(soops->outlinevis, SO_DATABLOCKS, SO_USERDEF)) { /* draw rna buttons */ outliner_draw_rnacols(ar, sizex_rna); outliner_draw_rnabuts(block, scene, ar, soops, sizex_rna, &soops->tree); } - else if(soops->outlinevis == SO_KEYMAP) { + else if (soops->outlinevis == SO_KEYMAP) { outliner_draw_keymapbuts(block, ar, soops, &soops->tree); } else if (!(soops->flag & SO_HIDE_RESTRICTCOLS)) { diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c index cdd566f6da9..c59cd626a93 100644 --- a/source/blender/editors/space_outliner/outliner_edit.c +++ b/source/blender/editors/space_outliner/outliner_edit.c @@ -158,24 +158,24 @@ static void outliner_open_reveal(SpaceOops *soops, ListBase *lb, TreeElement *te static int do_outliner_item_openclose(bContext *C, SpaceOops *soops, TreeElement *te, int all, const float mval[2]) { - if(mval[1]>te->ys && mval[1]<te->ys+UI_UNIT_Y) { + if (mval[1]>te->ys && mval[1]<te->ys+UI_UNIT_Y) { TreeStoreElem *tselem= TREESTORE(te); /* all below close/open? */ - if(all) { + if (all) { tselem->flag &= ~TSE_CLOSED; outliner_set_flag(soops, &te->subtree, TSE_CLOSED, !outliner_has_one_flag(soops, &te->subtree, TSE_CLOSED, 1)); } else { - if(tselem->flag & TSE_CLOSED) tselem->flag &= ~TSE_CLOSED; + 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)) + for (te= te->subtree.first; te; te= te->next) { + if (do_outliner_item_openclose(C, soops, te, all, mval)) return 1; } return 0; @@ -193,8 +193,8 @@ static int outliner_item_openclose(bContext *C, wmOperator *op, wmEvent *event) UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], fmval, fmval+1); - for(te= soops->tree.first; te; te= te->next) { - if(do_outliner_item_openclose(C, soops, te, all, fmval)) + for (te= soops->tree.first; te; te= te->next) { + if (do_outliner_item_openclose(C, soops, te, all, fmval)) break; } @@ -221,21 +221,21 @@ void OUTLINER_OT_item_openclose(wmOperatorType *ot) static void do_item_rename(ARegion *ar, TreeElement *te, TreeStoreElem *tselem, ReportList *reports) { /* can't rename rna datablocks entries */ - if(ELEM3(tselem->type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) { + if (ELEM3(tselem->type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) { /* do nothing */; } - else if(ELEM10(tselem->type, TSE_ANIM_DATA, TSE_NLA, TSE_DEFGROUP_BASE, TSE_CONSTRAINT_BASE, TSE_MODIFIER_BASE, + else if (ELEM10(tselem->type, TSE_ANIM_DATA, TSE_NLA, TSE_DEFGROUP_BASE, TSE_CONSTRAINT_BASE, TSE_MODIFIER_BASE, TSE_SCRIPT_BASE, TSE_POSE_BASE, TSE_POSEGRP_BASE, TSE_R_LAYER_BASE, TSE_R_PASS)) { BKE_report(reports, RPT_WARNING, "Cannot edit builtin name"); } - else if(ELEM3(tselem->type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP)) { + else if (ELEM3(tselem->type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP)) { BKE_report(reports, RPT_WARNING, "Cannot edit sequence name"); } - else if(tselem->id->lib) { + else if (tselem->id->lib) { // XXX error_libdata(); } - else if(te->idcode == ID_LI && te->parent) { + else if (te->idcode == ID_LI && te->parent) { BKE_report(reports, RPT_WARNING, "Cannot edit the path of an indirectly linked library"); } else { @@ -255,19 +255,19 @@ static int do_outliner_item_rename(bContext *C, ARegion *ar, SpaceOops *soops, T { ReportList *reports= CTX_wm_reports(C); // XXX - if(mval[1]>te->ys && mval[1]<te->ys+UI_UNIT_Y) { + if (mval[1]>te->ys && mval[1]<te->ys+UI_UNIT_Y) { TreeStoreElem *tselem= TREESTORE(te); /* name and first icon */ - if(mval[0]>te->xs+UI_UNIT_X && mval[0]<te->xend) { + if (mval[0]>te->xs+UI_UNIT_X && mval[0]<te->xend) { do_item_rename(ar, te, tselem, reports); } return 1; } - for(te= te->subtree.first; te; te= te->next) { - if(do_outliner_item_rename(C, ar, soops, te, mval)) return 1; + for (te= te->subtree.first; te; te= te->next) { + if (do_outliner_item_rename(C, ar, soops, te, mval)) return 1; } return 0; } @@ -281,8 +281,8 @@ static int outliner_item_rename(bContext *C, wmOperator *UNUSED(op), wmEvent *ev UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], fmval, fmval+1); - for(te= soops->tree.first; te; te= te->next) { - if(do_outliner_item_rename(C, ar, soops, te, fmval)) break; + for (te= soops->tree.first; te; te= te->next) { + if (do_outliner_item_rename(C, ar, soops, te, fmval)) break; } return OPERATOR_FINISHED; @@ -313,10 +313,10 @@ static int outliner_count_levels(SpaceOops *soops, ListBase *lb, int curlevel) TreeElement *te; int level=curlevel, lev; - for(te= lb->first; te; te= te->next) { + for (te= lb->first; te; te= te->next) { lev= outliner_count_levels(soops, &te->subtree, curlevel+1); - if(lev>level) level= lev; + if (lev>level) level= lev; } return level; } @@ -327,12 +327,12 @@ int outliner_has_one_flag(SpaceOops *soops, ListBase *lb, short flag, short curl TreeStoreElem *tselem; int level; - for(te= lb->first; te; te= te->next) { + for (te= lb->first; te; te= te->next) { tselem= TREESTORE(te); - if(tselem->flag & flag) return curlevel; + if (tselem->flag & flag) return curlevel; level= outliner_has_one_flag(soops, &te->subtree, flag, curlevel+1); - if(level) return level; + if (level) return level; } return 0; } @@ -342,9 +342,9 @@ void outliner_set_flag(SpaceOops *soops, ListBase *lb, short flag, short set) TreeElement *te; TreeStoreElem *tselem; - for(te= lb->first; te; te= te->next) { + for (te= lb->first; te; te= te->next) { tselem= TREESTORE(te); - if(set==0) tselem->flag &= ~flag; + if (set==0) tselem->flag &= ~flag; else tselem->flag |= flag; outliner_set_flag(soops, &te->subtree, flag, set); } @@ -385,10 +385,10 @@ void object_toggle_visibility_cb(bContext *C, Scene *scene, TreeElement *te, Tre Object *ob = (Object *)tselem->id; /* add check for edit mode */ - if(!common_restrict_check(C, ob)) return; + if (!common_restrict_check(C, ob)) return; - if(base || (base= object_in_scene(ob, scene))) { - if((base->object->restrictflag ^= OB_RESTRICT_VIEW)) { + if (base || (base= object_in_scene(ob, scene))) { + if ((base->object->restrictflag ^= OB_RESTRICT_VIEW)) { ED_base_object_select(base, BA_DESELECT); } } @@ -434,8 +434,8 @@ void object_toggle_selectability_cb(bContext *UNUSED(C), Scene *scene, TreeEleme { Base *base= (Base *)te->directdata; - if(base==NULL) base= object_in_scene((Object *)tselem->id, scene); - if(base) { + if (base==NULL) base= object_in_scene((Object *)tselem->id, scene); + if (base) { base->object->restrictflag^=OB_RESTRICT_SELECT; } } @@ -480,8 +480,8 @@ void object_toggle_renderability_cb(bContext *UNUSED(C), Scene *scene, TreeEleme { Base *base= (Base *)te->directdata; - if(base==NULL) base= object_in_scene((Object *)tselem->id, scene); - if(base) { + if (base==NULL) base= object_in_scene((Object *)tselem->id, scene); + if (base) { base->object->restrictflag^=OB_RESTRICT_RENDER; } } @@ -648,10 +648,10 @@ static int outliner_scroll_page_exec(bContext *C, wmOperator *op) int dy= ar->v2d.mask.ymax - ar->v2d.mask.ymin; int up= 0; - if(RNA_boolean_get(op->ptr, "up")) + if (RNA_boolean_get(op->ptr, "up")) up= 1; - if(up == 0) dy= -dy; + if (up == 0) dy= -dy; ar->v2d.cur.ymin+= dy; ar->v2d.cur.ymax+= dy; @@ -691,9 +691,9 @@ static void outliner_set_coordinates_element(SpaceOops *soops, TreeElement *te, te->ys= (float)(*starty); *starty-= UI_UNIT_Y; - if(TSELEM_OPEN(tselem,soops)) { + if (TSELEM_OPEN(tselem,soops)) { TreeElement *ten; - for(ten= te->subtree.first; ten; ten= ten->next) { + for (ten= te->subtree.first; ten; ten= ten->next) { outliner_set_coordinates_element(soops, ten, startx+UI_UNIT_X, starty); } } @@ -707,7 +707,7 @@ static void outliner_set_coordinates(ARegion *ar, SpaceOops *soops) int starty= (int)(ar->v2d.tot.ymax)-UI_UNIT_Y; int startx= 0; - for(te= soops->tree.first; te; te= te->next) { + for (te= soops->tree.first; te; te= te->next) { outliner_set_coordinates_element(soops, te, startx, &starty); } } @@ -720,7 +720,7 @@ static TreeElement *outliner_find_named(SpaceOops *soops, ListBase *lb, char *na for (te= lb->first; te; te= te->next) { int found = outliner_filter_has_name(te, name, flags); - if(found) { + if (found) { /* name is right, but is element the previous one? */ if (prev) { if ((te != prev) && (*prevFound)) @@ -734,7 +734,7 @@ static TreeElement *outliner_find_named(SpaceOops *soops, ListBase *lb, char *na } tes= outliner_find_named(soops, &te->subtree, name, flags, prev, prevFound); - if(tes) return tes; + if (tes) return tes; } /* nothing valid found */ @@ -781,7 +781,7 @@ static void outliner_find_panel(Scene *UNUSED(scene), ARegion *ar, SpaceOops *so tselem= TREESTORE(te); if (tselem) { /* expand branches so that it will be visible, we need to get correct coordinates */ - if( outliner_open_back(soops, te)) + if ( outliner_open_back(soops, te)) outliner_set_coordinates(ar, soops); /* deselect all visible, and select found element */ @@ -790,7 +790,7 @@ static void outliner_find_panel(Scene *UNUSED(scene), ARegion *ar, SpaceOops *so /* make te->ys center of view */ ytop= (int)(te->ys + (ar->v2d.mask.ymax-ar->v2d.mask.ymin)/2); - if(ytop>0) ytop= 0; + if (ytop>0) ytop= 0; ar->v2d.cur.ymax = (float)ytop; ar->v2d.cur.ymin = (float)(ytop-(ar->v2d.mask.ymax-ar->v2d.mask.ymin)); @@ -824,14 +824,14 @@ static void outliner_openclose_level(SpaceOops *soops, ListBase *lb, int curleve TreeElement *te; TreeStoreElem *tselem; - for(te= lb->first; te; te= te->next) { + for (te= lb->first; te; te= te->next) { tselem= TREESTORE(te); - if(open) { - if(curlevel<=level) tselem->flag &= ~TSE_CLOSED; + if (open) { + if (curlevel<=level) tselem->flag &= ~TSE_CLOSED; } else { - if(curlevel>=level) tselem->flag |= TSE_CLOSED; + if (curlevel>=level) tselem->flag |= TSE_CLOSED; } outliner_openclose_level(soops, &te->subtree, curlevel+1, level, open); @@ -846,12 +846,12 @@ static int outliner_one_level_exec(bContext *C, wmOperator *op) int level; level= outliner_has_one_flag(soops, &soops->tree, TSE_CLOSED, 1); - if(add==1) { - if(level) outliner_openclose_level(soops, &soops->tree, 1, level, 1); + if (add==1) { + if (level) outliner_openclose_level(soops, &soops->tree, 1, level, 1); } else { - if(level==0) level= outliner_count_levels(soops, &soops->tree, 0); - if(level) outliner_openclose_level(soops, &soops->tree, 1, level-1, 0); + if (level==0) level= outliner_count_levels(soops, &soops->tree, 0); + if (level) outliner_openclose_level(soops, &soops->tree, 1, level-1, 0); } ED_region_tag_redraw(ar); @@ -884,10 +884,10 @@ static int subtree_has_objects(SpaceOops *soops, ListBase *lb) TreeElement *te; TreeStoreElem *tselem; - for(te= lb->first; te; te= te->next) { + for (te= lb->first; te; te= te->next) { tselem= TREESTORE(te); - if(tselem->type==0 && te->idcode==ID_OB) return 1; - if( subtree_has_objects(soops, &te->subtree)) return 1; + if (tselem->type==0 && te->idcode==ID_OB) return 1; + if ( subtree_has_objects(soops, &te->subtree)) return 1; } return 0; } @@ -899,22 +899,22 @@ static void tree_element_show_hierarchy(Scene *scene, SpaceOops *soops, ListBase TreeStoreElem *tselem; /* open all object elems, close others */ - for(te= lb->first; te; te= te->next) { + 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; + if (tselem->type==0) { + if (te->idcode==ID_SCE) { + if (tselem->id!=(ID *)scene) tselem->flag |= TSE_CLOSED; else tselem->flag &= ~TSE_CLOSED; } - else if(te->idcode==ID_OB) { - if(subtree_has_objects(soops, &te->subtree)) tselem->flag &= ~TSE_CLOSED; + else if (te->idcode==ID_OB) { + if (subtree_has_objects(soops, &te->subtree)) tselem->flag &= ~TSE_CLOSED; else tselem->flag |= TSE_CLOSED; } } else tselem->flag |= TSE_CLOSED; - if(TSELEM_OPEN(tselem,soops)) tree_element_show_hierarchy(scene, soops, &te->subtree); + if (TSELEM_OPEN(tselem,soops)) tree_element_show_hierarchy(scene, soops, &te->subtree); } } @@ -1013,12 +1013,12 @@ static void tree_element_to_path(SpaceOops *soops, TreeElement *te, TreeStoreEle /* 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) { - if(RNA_property_type(prop) == PROP_POINTER) { + if (tse->type == TSE_RNA_PROPERTY) { + if (RNA_property_type(prop) == PROP_POINTER) { /* for pointer we just append property name */ newpath= RNA_path_append(*path, ptr, prop, 0, NULL); } - else if(RNA_property_type(prop) == PROP_COLLECTION) { + else if (RNA_property_type(prop) == PROP_COLLECTION) { char buf[128], *name; temnext= (TreeElement*)(ld->next->data); @@ -1027,19 +1027,19 @@ static void tree_element_to_path(SpaceOops *soops, TreeElement *te, TreeStoreEle nextptr= &temnext->rnaptr; name= RNA_struct_name_get_alloc(nextptr, buf, sizeof(buf), NULL); - if(name) { + if (name) { /* if possible, use name as a key in the path */ newpath= RNA_path_append(*path, NULL, prop, 0, name); - if(name != buf) + 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) + for (temsub=tem->subtree.first; temsub; temsub=temsub->next, index++) + if (temsub == temnext) break; newpath= RNA_path_append(*path, NULL, prop, index, NULL); @@ -1049,7 +1049,7 @@ static void tree_element_to_path(SpaceOops *soops, TreeElement *te, TreeStoreEle } } - if(newpath) { + if (newpath) { if (*path) MEM_freeN(*path); *path= newpath; newpath= NULL; @@ -1059,11 +1059,11 @@ static void tree_element_to_path(SpaceOops *soops, TreeElement *te, TreeStoreEle /* no ID, so check if entry is RNA-struct, and if that RNA-struct is an ID datablock to extract info from */ if (tse->type == TSE_RNA_STRUCT) { /* ptr->data not ptr->id.data seems to be the one we want, since ptr->data is sometimes the owner of this ID? */ - if(RNA_struct_is_ID(ptr->type)) { + if (RNA_struct_is_ID(ptr->type)) { *id= (ID *)ptr->data; /* clear path */ - if(*path) { + if (*path) { MEM_freeN(*path); path= NULL; } @@ -1508,7 +1508,7 @@ static int parent_drop_invoke(bContext *C, wmOperator *op, wmEvent *event) if (te_found) break; } - if(te_found) { + if (te_found) { RNA_string_set(op->ptr, "parent", te_found->name); /* Identify parent and child */ RNA_string_get(op->ptr, "child", childname); diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c index 8270d26d974..e64804b6090 100644 --- a/source/blender/editors/space_outliner/outliner_select.c +++ b/source/blender/editors/space_outliner/outliner_select.c @@ -159,11 +159,11 @@ static int tree_element_active_renderlayer(bContext *C, TreeElement *te, TreeSto Scene *sce; /* paranoia check */ - if(te->idcode!=ID_SCE) + if (te->idcode!=ID_SCE) return 0; sce= (Scene *)tselem->id; - if(set) { + if (set) { sce->r.actlay= tselem->nr; WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, sce); } @@ -181,25 +181,25 @@ static int tree_element_set_active_object(bContext *C, Scene *scene, SpaceOops Object *ob= NULL; /* if id is not object, we search back */ - if(te->idcode==ID_OB) ob= (Object *)tselem->id; + if (te->idcode==ID_OB) ob= (Object *)tselem->id; else { ob= (Object *)outliner_search_back(soops, te, ID_OB); - if(ob==OBACT) return 0; + if (ob==OBACT) return 0; } - if(ob==NULL) return 0; + if (ob==NULL) return 0; sce= (Scene *)outliner_search_back(soops, te, ID_SCE); - if(sce && scene != sce) { + if (sce && scene != sce) { ED_screen_set_scene(C, CTX_wm_screen(C), sce); } /* find associated base in current scene */ base= object_in_scene(ob, scene); - if(base) { - if(set==2) { + if (base) { + if (set==2) { /* swap select */ - if(base->flag & SELECT) + if (base->flag & SELECT) ED_base_object_select(base, BA_DESELECT); else ED_base_object_select(base, BA_SELECT); @@ -209,13 +209,13 @@ static int tree_element_set_active_object(bContext *C, Scene *scene, SpaceOops scene_deselect_all(scene); ED_base_object_select(base, BA_SELECT); } - if(C) { + if (C) { ED_base_object_activate(C, base); /* adds notifier */ WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene); } } - if(ob!=scene->obedit) + if (ob!=scene->obedit) ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR|EM_DO_UNDO); return 1; @@ -229,32 +229,32 @@ static int tree_element_active_material(bContext *C, Scene *scene, SpaceOops *so /* 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 || ob->matbits==NULL) return 0; // just paranoia + if (ob==NULL || ob!=OBACT || ob->matbits==NULL) return 0; // just paranoia /* searching in ob mat array? */ tes= te->parent; - if(tes->idcode==ID_OB) { - if(set) { + if (tes->idcode==ID_OB) { + if (set) { ob->actcol= te->index+1; ob->matbits[te->index]= 1; // make ob material active too } else { - if(ob->actcol == te->index+1) - if(ob->matbits[te->index]) return 1; + if (ob->actcol == te->index+1) + if (ob->matbits[te->index]) return 1; } } /* or we search for obdata material */ else { - if(set) { + if (set) { ob->actcol= te->index+1; ob->matbits[te->index]= 0; // make obdata material active too } else { - if(ob->actcol == te->index+1) - if(ob->matbits[te->index]==0) return 1; + if (ob->actcol == te->index+1) + if (ob->matbits[te->index]==0) return 1; } } - if(set) { + if (set) { WM_event_add_notifier(C, NC_MATERIAL|ND_SHADING, NULL); } return 0; @@ -267,7 +267,7 @@ static int tree_element_active_texture(bContext *C, Scene *scene, SpaceOops *soo Object *ob=OBACT; SpaceButs *sbuts=NULL; - if(ob==NULL) return 0; // no active object + if (ob==NULL) return 0; // no active object /*tselem= TREESTORE(te);*/ /*UNUSED*/ @@ -278,25 +278,25 @@ static int tree_element_active_texture(bContext *C, Scene *scene, SpaceOops *soo tep= te->parent; tselemp= TREESTORE(tep); - if(tep->idcode==ID_WO) { + if (tep->idcode==ID_WO) { World *wrld= (World *)tselemp->id; - if(set) { - if(sbuts) { + if (set) { + if (sbuts) { // XXX sbuts->tabo= TAB_SHADING_TEX; // hack from header_buttonswin.c // XXX sbuts->texfrom= 1; } // XXX extern_set_butspace(F6KEY, 0); // force shading buttons texture wrld->texact= te->index; } - else if(tselemp->id == (ID *)(scene->world)) { - if(wrld->texact==te->index) return 1; + else if (tselemp->id == (ID *)(scene->world)) { + if (wrld->texact==te->index) return 1; } } - else if(tep->idcode==ID_LA) { + else if (tep->idcode==ID_LA) { Lamp *la= (Lamp *)tselemp->id; - if(set) { - if(sbuts) { + if (set) { + if (sbuts) { // XXX sbuts->tabo= TAB_SHADING_TEX; // hack from header_buttonswin.c // XXX sbuts->texfrom= 2; } @@ -304,15 +304,15 @@ static int tree_element_active_texture(bContext *C, Scene *scene, SpaceOops *soo la->texact= te->index; } else { - if(tselemp->id == ob->data) { - if(la->texact==te->index) return 1; + if (tselemp->id == ob->data) { + if (la->texact==te->index) return 1; } } } - else if(tep->idcode==ID_MA) { + else if (tep->idcode==ID_MA) { Material *ma= (Material *)tselemp->id; - if(set) { - if(sbuts) { + if (set) { + if (sbuts) { //sbuts->tabo= TAB_SHADING_TEX; // hack from header_buttonswin.c // XXX sbuts->texfrom= 0; } @@ -322,12 +322,12 @@ static int tree_element_active_texture(bContext *C, Scene *scene, SpaceOops *soo /* also set active material */ ob->actcol= tep->index+1; } - else if(tep->flag & TE_ACTIVE) { // this is active material - if(ma->texact==te->index) return 1; + else if (tep->flag & TE_ACTIVE) { // this is active material + if (ma->texact==te->index) return 1; } } - if(set) + if (set) WM_event_add_notifier(C, NC_TEXTURE, NULL); return 0; @@ -340,9 +340,9 @@ static int tree_element_active_lamp(bContext *UNUSED(C), Scene *scene, SpaceOops /* we search for the object parent */ ob= (Object *)outliner_search_back(soops, te, ID_OB); - if(ob==NULL || ob!=OBACT) return 0; // just paranoia + if (ob==NULL || ob!=OBACT) return 0; // just paranoia - if(set) { + if (set) { // XXX extern_set_butspace(F5KEY, 0); } else return 1; @@ -354,7 +354,7 @@ static int tree_element_active_camera(bContext *UNUSED(C), Scene *scene, SpaceOo { Object *ob= (Object *)outliner_search_back(soops, te, ID_OB); - if(set) + if (set) return 0; return scene->camera == ob; @@ -367,19 +367,19 @@ static int tree_element_active_world(bContext *C, Scene *scene, SpaceOops *soops Scene *sce=NULL; tep= te->parent; - if(tep) { + if (tep) { tselem= TREESTORE(tep); sce= (Scene *)tselem->id; } - if(set) { // make new scene active - if(sce && scene != sce) { + if (set) { // make new scene active + if (sce && scene != sce) { ED_screen_set_scene(C, CTX_wm_screen(C), sce); } } - if(tep==NULL || tselem->id == (ID *)scene) { - if(set) { + if (tep==NULL || tselem->id == (ID *)scene) { + if (set) { // XXX extern_set_butspace(F8KEY, 0); } else { @@ -395,7 +395,7 @@ static int tree_element_active_defgroup(bContext *C, Scene *scene, TreeElement * /* id in tselem is object */ ob= (Object *)tselem->id; - if(set) { + if (set) { BLI_assert(te->index+1 >= 0); ob->actdef= te->index+1; @@ -403,8 +403,8 @@ static int tree_element_active_defgroup(bContext *C, Scene *scene, TreeElement * WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, ob); } else { - if(ob==OBACT) - if(ob->actdef== te->index+1) return 1; + if (ob==OBACT) + if (ob->actdef== te->index+1) return 1; } return 0; } @@ -413,14 +413,14 @@ static int tree_element_active_posegroup(bContext *C, Scene *scene, TreeElement { Object *ob= (Object *)tselem->id; - if(set) { + if (set) { if (ob->pose) { ob->pose->active_group= te->index+1; WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob); } } else { - if(ob==OBACT && ob->pose) { + if (ob==OBACT && ob->pose) { if (ob->pose->active_group== te->index+1) return 1; } } @@ -433,15 +433,16 @@ static int tree_element_active_posechannel(bContext *C, Scene *scene, TreeElemen bArmature *arm= ob->data; bPoseChannel *pchan= te->directdata; - if(set) { - if(!(pchan->bone->flag & BONE_HIDDEN_P)) { + if (set) { + if (!(pchan->bone->flag & BONE_HIDDEN_P)) { - if(set==2) ED_pose_deselectall(ob, 2); // 2 = clear active tag + if (set==2) ED_pose_deselectall(ob, 2); // 2 = clear active tag else ED_pose_deselectall(ob, 0); // 0 = deselect - if(set==2 && (pchan->bone->flag & BONE_SELECTED)) { + if (set==2 && (pchan->bone->flag & BONE_SELECTED)) { pchan->bone->flag &= ~BONE_SELECTED; - } else { + } + else { pchan->bone->flag |= BONE_SELECTED; arm->act_bone= pchan->bone; } @@ -451,7 +452,7 @@ static int tree_element_active_posechannel(bContext *C, Scene *scene, TreeElemen } } else { - if(ob==OBACT && ob->pose) { + if (ob==OBACT && ob->pose) { if (pchan->bone->flag & BONE_SELECTED) return 1; } } @@ -463,14 +464,15 @@ static int tree_element_active_bone(bContext *C, Scene *scene, TreeElement *te, bArmature *arm= (bArmature *)tselem->id; Bone *bone= te->directdata; - if(set) { - if(!(bone->flag & BONE_HIDDEN_P)) { - if(set==2) ED_pose_deselectall(OBACT, 2); // 2 is clear active tag + if (set) { + if (!(bone->flag & BONE_HIDDEN_P)) { + if (set==2) ED_pose_deselectall(OBACT, 2); // 2 is clear active tag else ED_pose_deselectall(OBACT, 0); - if(set==2 && (bone->flag & BONE_SELECTED)) { + if (set==2 && (bone->flag & BONE_SELECTED)) { bone->flag &= ~BONE_SELECTED; - } else { + } + else { bone->flag |= BONE_SELECTED; arm->act_bone= bone; } @@ -481,7 +483,7 @@ static int tree_element_active_bone(bContext *C, Scene *scene, TreeElement *te, else { Object *ob= OBACT; - if(ob && ob->data==arm) { + if (ob && ob->data==arm) { if (bone->flag & BONE_SELECTED) return 1; } } @@ -492,16 +494,16 @@ static int tree_element_active_bone(bContext *C, Scene *scene, TreeElement *te, /* ebones only draw in editmode armature */ static void tree_element_active_ebone__sel(bContext *C, Scene *scene, bArmature *arm, EditBone *ebone, short sel) { - if(sel) { + if (sel) { ebone->flag |= BONE_SELECTED|BONE_ROOTSEL|BONE_TIPSEL; arm->act_edbone= ebone; // flush to parent? - if(ebone->parent && (ebone->flag & BONE_CONNECTED)) ebone->parent->flag |= BONE_TIPSEL; + if (ebone->parent && (ebone->flag & BONE_CONNECTED)) ebone->parent->flag |= BONE_TIPSEL; } else { ebone->flag &= ~(BONE_SELECTED|BONE_ROOTSEL|BONE_TIPSEL); // flush to parent? - if(ebone->parent && (ebone->flag & BONE_CONNECTED)) ebone->parent->flag &= ~BONE_TIPSEL; + if (ebone->parent && (ebone->flag & BONE_CONNECTED)) ebone->parent->flag &= ~BONE_TIPSEL; } WM_event_add_notifier(C, NC_OBJECT|ND_BONE_ACTIVE, scene->obedit); @@ -511,16 +513,16 @@ static int tree_element_active_ebone(bContext *C, Scene *scene, TreeElement *te, bArmature *arm= scene->obedit->data; EditBone *ebone= te->directdata; - if(set==1) { - if(!(ebone->flag & BONE_HIDDEN_A)) { + if (set==1) { + if (!(ebone->flag & BONE_HIDDEN_A)) { ED_armature_deselect_all(scene->obedit, 0); // deselect tree_element_active_ebone__sel(C, scene, arm, ebone, TRUE); return 1; } } else if (set==2) { - if(!(ebone->flag & BONE_HIDDEN_A)) { - if(!(ebone->flag & BONE_SELECTED)) { + if (!(ebone->flag & BONE_HIDDEN_A)) { + if (!(ebone->flag & BONE_SELECTED)) { tree_element_active_ebone__sel(C, scene, arm, ebone, TRUE); return 1; } @@ -539,7 +541,7 @@ static int tree_element_active_ebone(bContext *C, Scene *scene, TreeElement *te, static int tree_element_active_modifier(bContext *C, TreeElement *UNUSED(te), TreeStoreElem *tselem, int set) { - if(set) { + if (set) { Object *ob= (Object *)tselem->id; WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob); @@ -552,7 +554,7 @@ static int tree_element_active_modifier(bContext *C, TreeElement *UNUSED(te), Tr static int tree_element_active_psys(bContext *C, Scene *UNUSED(scene), TreeElement *UNUSED(te), TreeStoreElem *tselem, int set) { - if(set) { + if (set) { Object *ob= (Object *)tselem->id; WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE|NA_EDITED, ob); @@ -565,7 +567,7 @@ static int tree_element_active_psys(bContext *C, Scene *UNUSED(scene), TreeEleme static int tree_element_active_constraint(bContext *C, TreeElement *UNUSED(te), TreeStoreElem *tselem, int set) { - if(set) { + if (set) { Object *ob= (Object *)tselem->id; WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, ob); @@ -586,17 +588,17 @@ static int tree_element_active_pose(bContext *C, Scene *scene, TreeElement *UNUS Object *ob= (Object *)tselem->id; Base *base= object_in_scene(ob, scene); - if(set) { - if(scene->obedit) + if (set) { + if (scene->obedit) ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR|EM_DO_UNDO); - if(ob->mode & OB_MODE_POSE) + if (ob->mode & OB_MODE_POSE) ED_armature_exit_posemode(C, base); else ED_armature_enter_posemode(C, base); } else { - if(ob->mode & OB_MODE_POSE) return 1; + if (ob->mode & OB_MODE_POSE) return 1; } return 0; } @@ -605,11 +607,11 @@ static int tree_element_active_sequence(TreeElement *te, TreeStoreElem *UNUSED(t { Sequence *seq= (Sequence*) te->directdata; - if(set) { + if (set) { // XXX select_single_seq(seq, 1); } else { - if(seq->flag & SELECT) + if (seq->flag & SELECT) return(1); } return(0); @@ -621,8 +623,8 @@ static int tree_element_active_sequence_dup(Scene *scene, TreeElement *te, TreeS Editing *ed= seq_give_editing(scene, FALSE); seq= (Sequence*)te->directdata; - if(set==0) { - if(seq->flag & SELECT) + if (set==0) { + if (seq->flag & SELECT) return(1); return(0); } @@ -630,12 +632,12 @@ static int tree_element_active_sequence_dup(Scene *scene, TreeElement *te, TreeS // XXX select_single_seq(seq, 1); p= ed->seqbasep->first; while(p) { - if((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) { + if ((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) { p= p->next; continue; } -// if(!strcmp(p->strip->stripdata->name, seq->strip->stripdata->name)) +// if (!strcmp(p->strip->stripdata->name, seq->strip->stripdata->name)) // XXX select_single_seq(p, 0); p= p->next; } @@ -646,8 +648,8 @@ static int tree_element_active_keymap_item(bContext *UNUSED(C), TreeElement *te, { wmKeyMapItem *kmi = te->directdata; - if(set==0) { - if(kmi->flag & KMI_INACTIVE) return 0; + if (set==0) { + if (kmi->flag & KMI_INACTIVE) return 0; return 1; } else { @@ -695,8 +697,8 @@ int tree_element_type_active(bContext *C, Scene *scene, SpaceOops *soops, TreeEl case TSE_MODIFIER: return tree_element_active_modifier(C, te, tselem, set); case TSE_LINKED_OB: - if(set) tree_element_set_active_object(C, scene, soops, te, set); - else if(tselem->id==(ID *)OBACT) return 1; + if (set) tree_element_set_active_object(C, scene, soops, te, set); + else if (tselem->id==(ID *)OBACT) return 1; break; case TSE_LINKED_PSYS: return tree_element_active_psys(C, scene, te, tselem, set); @@ -726,24 +728,24 @@ int tree_element_type_active(bContext *C, Scene *scene, SpaceOops *soops, TreeEl static int do_outliner_item_activate(bContext *C, Scene *scene, ARegion *ar, SpaceOops *soops, TreeElement *te, int extend, const float mval[2]) { - if(mval[1]>te->ys && mval[1]<te->ys+UI_UNIT_Y) { + if (mval[1]>te->ys && mval[1]<te->ys+UI_UNIT_Y) { TreeStoreElem *tselem= TREESTORE(te); int openclose= 0; /* open close icon */ - if((te->flag & TE_ICONROW)==0) { // hidden icon, no open/close - if( mval[0]>te->xs && mval[0]<te->xs+UI_UNIT_X) + if ((te->flag & TE_ICONROW)==0) { // hidden icon, no open/close + if ( mval[0]>te->xs && mval[0]<te->xs+UI_UNIT_X) openclose= 1; } - if(openclose) { + if (openclose) { /* all below close/open? */ - if(extend) { + if (extend) { tselem->flag &= ~TSE_CLOSED; outliner_set_flag(soops, &te->subtree, TSE_CLOSED, !outliner_has_one_flag(soops, &te->subtree, TSE_CLOSED, 1)); } else { - if(tselem->flag & TSE_CLOSED) tselem->flag &= ~TSE_CLOSED; + if (tselem->flag & TSE_CLOSED) tselem->flag &= ~TSE_CLOSED; else tselem->flag |= TSE_CLOSED; } @@ -751,50 +753,51 @@ static int do_outliner_item_activate(bContext *C, Scene *scene, ARegion *ar, Spa return 1; } /* name and first icon */ - else if(mval[0]>te->xs+UI_UNIT_X && mval[0]<te->xend) { + else if (mval[0]>te->xs+UI_UNIT_X && mval[0]<te->xend) { /* always makes active object */ - if(tselem->type!=TSE_SEQUENCE && tselem->type!=TSE_SEQ_STRIP && tselem->type!=TSE_SEQUENCE_DUP) + if (tselem->type!=TSE_SEQUENCE && tselem->type!=TSE_SEQ_STRIP && tselem->type!=TSE_SEQUENCE_DUP) tree_element_set_active_object(C, scene, soops, te, 1 + (extend!=0 && tselem->type==0)); - if(tselem->type==0) { // the lib blocks + if (tselem->type==0) { // the lib blocks /* editmode? */ - if(te->idcode==ID_SCE) { - if(scene!=(Scene *)tselem->id) { + if (te->idcode==ID_SCE) { + if (scene!=(Scene *)tselem->id) { ED_screen_set_scene(C, CTX_wm_screen(C), (Scene *)tselem->id); } } - else if(te->idcode==ID_GR) { + else if (te->idcode==ID_GR) { Group *gr= (Group *)tselem->id; GroupObject *gob; - if(extend) { + if (extend) { int sel= BA_SELECT; - for(gob= gr->gobject.first; gob; gob= gob->next) { - if(gob->ob->flag & SELECT) { + for (gob= gr->gobject.first; gob; gob= gob->next) { + if (gob->ob->flag & SELECT) { sel= BA_DESELECT; break; } } - for(gob= gr->gobject.first; gob; gob= gob->next) { + for (gob= gr->gobject.first; gob; gob= gob->next) { ED_base_object_select(object_in_scene(gob->ob, scene), sel); } } else { scene_deselect_all(scene); - for(gob= gr->gobject.first; gob; gob= gob->next) { - if((gob->ob->flag & SELECT) == 0) + for (gob= gr->gobject.first; gob; gob= gob->next) { + if ((gob->ob->flag & SELECT) == 0) ED_base_object_select(object_in_scene(gob->ob, scene), BA_SELECT); } } WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene); } - else if(ELEM5(te->idcode, ID_ME, ID_CU, ID_MB, ID_LT, ID_AR)) { + else if (ELEM5(te->idcode, ID_ME, ID_CU, ID_MB, ID_LT, ID_AR)) { WM_operator_name_call(C, "OBJECT_OT_editmode_toggle", WM_OP_INVOKE_REGION_WIN, NULL); - } else { // rest of types + } + else { // rest of types tree_element_active(C, scene, soops, te, 1); } @@ -805,8 +808,8 @@ static int do_outliner_item_activate(bContext *C, Scene *scene, ARegion *ar, Spa } } - for(te= te->subtree.first; te; te= te->next) { - if(do_outliner_item_activate(C, scene, ar, soops, te, extend, mval)) return 1; + for (te= te->subtree.first; te; te= te->next) { + if (do_outliner_item_activate(C, scene, ar, soops, te, extend, mval)) return 1; } return 0; } @@ -830,11 +833,11 @@ static int outliner_item_activate(bContext *C, wmOperator *op, wmEvent *event) return OPERATOR_CANCELLED; } - for(te= soops->tree.first; te; te= te->next) { - if(do_outliner_item_activate(C, scene, ar, soops, te, extend, fmval)) break; + for (te= soops->tree.first; te; te= te->next) { + if (do_outliner_item_activate(C, scene, ar, soops, te, extend, fmval)) break; } - if(te) { + if (te) { ED_undo_push(C, "Outliner click event"); } else { @@ -846,7 +849,7 @@ static int outliner_item_activate(bContext *C, wmOperator *op, wmEvent *event) fmval[0], fmval[1], NULL, &row); /* select relevant row */ - if(outliner_select(soops, &soops->tree, &row, &selecting)) { + if (outliner_select(soops, &soops->tree, &row, &selecting)) { soops->storeflag |= SO_TREESTORE_REDRAW; @@ -917,7 +920,7 @@ static int outliner_border_select_exec(bContext *C, wmOperator *op) rect.ymax = RNA_int_get(op->ptr, "ymax"); UI_view2d_region_to_view(&ar->v2d, rect.xmax, rect.ymax, &rectf.xmax, &rectf.ymax); - for(te= soops->tree.first; te; te= te->next) { + for (te= soops->tree.first; te; te= te->next) { outliner_item_border_select(scene, soops, &rectf, te, gesture_mode); } diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c index b53d8ebc4a0..45830eed223 100644 --- a/source/blender/editors/space_outliner/outliner_tools.c +++ b/source/blender/editors/space_outliner/outliner_tools.c @@ -115,13 +115,13 @@ static void set_operation_types(SpaceOops *soops, ListBase *lb, TreeElement *te; TreeStoreElem *tselem; - for(te= lb->first; te; te= te->next) { + for (te= lb->first; te; te= te->next) { tselem= TREESTORE(te); - if(tselem->flag & TSE_SELECTED) { - if(tselem->type) { - if(*datalevel==0) + if (tselem->flag & TSE_SELECTED) { + if (tselem->type) { + if (*datalevel==0) *datalevel= tselem->type; - else if(*datalevel!=tselem->type) + else if (*datalevel!=tselem->type) *datalevel= -1; } else { @@ -139,13 +139,13 @@ static void set_operation_types(SpaceOops *soops, ListBase *lb, case ID_MA: case ID_TE: case ID_IP: case ID_IM: case ID_SO: case ID_KE: case ID_WO: case ID_AC: case ID_NLA: case ID_TXT: case ID_GR: - if(*idlevel==0) *idlevel= idcode; - else if(*idlevel!=idcode) *idlevel= -1; + if (*idlevel==0) *idlevel= idcode; + else if (*idlevel!=idcode) *idlevel= -1; break; } } } - if(TSELEM_OPEN(tselem,soops)) { + if (TSELEM_OPEN(tselem,soops)) { set_operation_types(soops, &te->subtree, scenelevel, objectlevel, idlevel, datalevel); } @@ -163,29 +163,29 @@ static void unlink_material_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeEl Material **matar=NULL; int a, totcol=0; - if( GS(tsep->id->name)==ID_OB) { + if ( GS(tsep->id->name)==ID_OB) { Object *ob= (Object *)tsep->id; totcol= ob->totcol; matar= ob->mat; } - else if( GS(tsep->id->name)==ID_ME) { + else if ( GS(tsep->id->name)==ID_ME) { Mesh *me= (Mesh *)tsep->id; totcol= me->totcol; matar= me->mat; } - else if( GS(tsep->id->name)==ID_CU) { + else if ( GS(tsep->id->name)==ID_CU) { Curve *cu= (Curve *)tsep->id; totcol= cu->totcol; matar= cu->mat; } - else if( GS(tsep->id->name)==ID_MB) { + else if ( GS(tsep->id->name)==ID_MB) { MetaBall *mb= (MetaBall *)tsep->id; totcol= mb->totcol; matar= mb->mat; } - for(a=0; a<totcol; a++) { - if(a==te->index && matar[a]) { + for (a=0; a<totcol; a++) { + if (a==te->index && matar[a]) { matar[a]->id.us--; matar[a]= NULL; } @@ -197,23 +197,23 @@ static void unlink_texture_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeEle MTex **mtex= NULL; int a; - if( GS(tsep->id->name)==ID_MA) { + if ( GS(tsep->id->name)==ID_MA) { Material *ma= (Material *)tsep->id; mtex= ma->mtex; } - else if( GS(tsep->id->name)==ID_LA) { + else if ( GS(tsep->id->name)==ID_LA) { Lamp *la= (Lamp *)tsep->id; mtex= la->mtex; } - else if( GS(tsep->id->name)==ID_WO) { + else if ( GS(tsep->id->name)==ID_WO) { World *wrld= (World *)tsep->id; mtex= wrld->mtex; } else return; - for(a=0; a<MAX_MTEX; a++) { - if(a==te->index && mtex[a]) { - if(mtex[a]->tex) { + for (a=0; a<MAX_MTEX; a++) { + if (a==te->index && mtex[a]) { + if (mtex[a]->tex) { mtex[a]->tex->id.us--; mtex[a]->tex= NULL; } @@ -225,8 +225,8 @@ static void unlink_group_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeEleme { Group *group= (Group *)tselem->id; - if(tsep) { - if( GS(tsep->id->name)==ID_OB) { + if (tsep) { + if ( GS(tsep->id->name)==ID_OB) { Object *ob= (Object *)tsep->id; ob->dup_group= NULL; } @@ -252,15 +252,15 @@ static void outliner_do_libdata_operation(bContext *C, Scene *scene, SpaceOops * TreeElement *te; TreeStoreElem *tselem; - for(te=lb->first; te; te= te->next) { + for (te=lb->first; te; te= te->next) { tselem= TREESTORE(te); - if(tselem->flag & TSE_SELECTED) { - if(tselem->type==0) { + if (tselem->flag & TSE_SELECTED) { + if (tselem->type==0) { TreeStoreElem *tsep= TREESTORE(te->parent); operation_cb(C, scene, te, tsep, tselem); } } - if(TSELEM_OPEN(tselem,soops)) { + if (TSELEM_OPEN(tselem,soops)) { outliner_do_libdata_operation(C, scene, soops, &te->subtree, operation_cb); } } @@ -272,8 +272,8 @@ static void object_select_cb(bContext *UNUSED(C), Scene *scene, TreeElement *te, { Base *base= (Base *)te->directdata; - if(base==NULL) base= object_in_scene((Object *)tselem->id, scene); - if(base && ((base->object->restrictflag & OB_RESTRICT_VIEW)==0)) { + if (base==NULL) base= object_in_scene((Object *)tselem->id, scene); + if (base && ((base->object->restrictflag & OB_RESTRICT_VIEW)==0)) { base->flag |= SELECT; base->object->flag |= SELECT; } @@ -283,8 +283,8 @@ static void object_deselect_cb(bContext *UNUSED(C), Scene *scene, TreeElement *t { Base *base= (Base *)te->directdata; - if(base==NULL) base= object_in_scene((Object *)tselem->id, scene); - if(base) { + if (base==NULL) base= object_in_scene((Object *)tselem->id, scene); + if (base) { base->flag &= ~SELECT; base->object->flag &= ~SELECT; } @@ -294,11 +294,11 @@ static void object_delete_cb(bContext *C, Scene *scene, TreeElement *te, TreeSto { Base *base= (Base *)te->directdata; - if(base==NULL) + if (base==NULL) base= object_in_scene((Object *)tselem->id, scene); - if(base) { + if (base) { // check also library later - if(scene->obedit==base->object) + if (scene->obedit==base->object) ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR|EM_DO_UNDO); ED_base_object_free_and_unlink(CTX_data_main(C), scene, base); @@ -378,12 +378,13 @@ static void group_linkobs2scene_cb(bContext *UNUSED(C), Scene *scene, TreeElemen GroupObject *gob; Base *base; - for(gob=group->gobject.first; gob; gob=gob->next) { + for (gob=group->gobject.first; gob; gob=gob->next) { base= object_in_scene(gob->ob, scene); if (base) { base->object->flag |= SELECT; base->flag |= SELECT; - } else { + } + else { /* link to scene */ base= MEM_callocN( sizeof(Base), "add_base"); BLI_addhead(&scene->base, base); @@ -402,13 +403,13 @@ void outliner_do_object_operation(bContext *C, Scene *scene_act, SpaceOops *soop TreeElement *te; TreeStoreElem *tselem; - for(te=lb->first; te; te= te->next) { + for (te=lb->first; te; te= te->next) { tselem= TREESTORE(te); - if(tselem->flag & TSE_SELECTED) { - if(tselem->type==0 && te->idcode==ID_OB) { + if (tselem->flag & TSE_SELECTED) { + if (tselem->type==0 && te->idcode==ID_OB) { // when objects selected in other scenes... dunno if that should be allowed Scene *scene_owner= (Scene *)outliner_search_back(soops, te, ID_SCE); - if(scene_owner && scene_act != scene_owner) { + if (scene_owner && scene_act != scene_owner) { ED_screen_set_scene(C, CTX_wm_screen(C), scene_owner); } /* important to use 'scene_owner' not scene_act else deleting objects can crash. @@ -417,7 +418,7 @@ void outliner_do_object_operation(bContext *C, Scene *scene_act, SpaceOops *soop operation_cb(C, scene_owner ? scene_owner : scene_act, te, NULL, tselem); } } - if(TSELEM_OPEN(tselem,soops)) { + if (TSELEM_OPEN(tselem,soops)) { outliner_do_object_operation(C, scene_act, soops, &te->subtree, operation_cb); } } @@ -459,15 +460,15 @@ static void pchan_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem)) { bPoseChannel *pchan= (bPoseChannel *)te->directdata; - if(event==1) + if (event==1) pchan->bone->flag |= BONE_SELECTED; - else if(event==2) + else if (event==2) pchan->bone->flag &= ~BONE_SELECTED; - else if(event==3) { + else if (event==3) { pchan->bone->flag |= BONE_HIDDEN_P; pchan->bone->flag &= ~BONE_SELECTED; } - else if(event==4) + else if (event==4) pchan->bone->flag &= ~BONE_HIDDEN_P; } @@ -475,15 +476,15 @@ static void bone_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem)) { Bone *bone= (Bone *)te->directdata; - if(event==1) + if (event==1) bone->flag |= BONE_SELECTED; - else if(event==2) + else if (event==2) bone->flag &= ~BONE_SELECTED; - else if(event==3) { + else if (event==3) { bone->flag |= BONE_HIDDEN_P; bone->flag &= ~BONE_SELECTED; } - else if(event==4) + else if (event==4) bone->flag &= ~BONE_HIDDEN_P; } @@ -491,22 +492,22 @@ static void ebone_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem)) { EditBone *ebone= (EditBone *)te->directdata; - if(event==1) + if (event==1) ebone->flag |= BONE_SELECTED; - else if(event==2) + else if (event==2) ebone->flag &= ~BONE_SELECTED; - else if(event==3) { + else if (event==3) { ebone->flag |= BONE_HIDDEN_A; ebone->flag &= ~BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL; } - else if(event==4) + else if (event==4) ebone->flag &= ~BONE_HIDDEN_A; } static void sequence_cb(int event, TreeElement *UNUSED(te), TreeStoreElem *UNUSED(tselem)) { // Sequence *seq= (Sequence*) te->directdata; - if(event==1) { + if (event==1) { // XXX select_single_seq(seq, 1); } } @@ -517,14 +518,14 @@ 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) { + for (te=lb->first; te; te= te->next) { tselem= TREESTORE(te); - if(tselem->flag & TSE_SELECTED) { - if(tselem->type==type) { + if (tselem->flag & TSE_SELECTED) { + if (tselem->type==type) { operation_cb(event, te, tselem); } } - if(TSELEM_OPEN(tselem,soops)) { + if (TSELEM_OPEN(tselem,soops)) { outliner_do_data_operation(soops, type, event, &te->subtree, operation_cb); } } @@ -557,22 +558,22 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op) event= RNA_enum_get(op->ptr, "type"); - if(event==1) { + if (event==1) { Scene *sce= scene; // to be able to delete, scenes are set... outliner_do_object_operation(C, scene, soops, &soops->tree, object_select_cb); - if(scene != sce) { + if (scene != sce) { ED_screen_set_scene(C, CTX_wm_screen(C), sce); } str= "Select Objects"; WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene); } - else if(event==2) { + else if (event==2) { outliner_do_object_operation(C, scene, soops, &soops->tree, object_deselect_cb); str= "Deselect Objects"; WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene); } - else if(event==4) { + else if (event==4) { outliner_do_object_operation(C, scene, soops, &soops->tree, object_delete_cb); /* XXX: tree management normally happens from draw_outliner(), but when @@ -586,26 +587,26 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op) str= "Delete Objects"; WM_event_add_notifier(C, NC_SCENE|ND_OB_ACTIVE, scene); } - else if(event==5) { /* disabled, see above enum (ton) */ + else if (event==5) { /* disabled, see above enum (ton) */ outliner_do_object_operation(C, scene, soops, &soops->tree, id_local_cb); str= "Localized Objects"; } - else if(event==6) { + else if (event==6) { outliner_do_object_operation(C, scene, soops, &soops->tree, object_toggle_visibility_cb); str= "Toggle Visibility"; WM_event_add_notifier(C, NC_SCENE|ND_OB_VISIBLE, scene); } - else if(event==7) { + else if (event==7) { outliner_do_object_operation(C, scene, soops, &soops->tree, object_toggle_selectability_cb); str= "Toggle Selectability"; WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene); } - else if(event==8) { + else if (event==8) { outliner_do_object_operation(C, scene, soops, &soops->tree, object_toggle_renderability_cb); str= "Toggle Renderability"; WM_event_add_notifier(C, NC_SCENE|ND_OB_RENDER, scene); } - else if(event==9) { + else if (event==9) { outliner_do_object_operation(C, scene, soops, &soops->tree, item_rename_cb); str= "Rename Object"; } @@ -659,31 +660,31 @@ static int outliner_group_operation_exec(bContext *C, wmOperator *op) event= RNA_enum_get(op->ptr, "type"); - if(event==1) { + if (event==1) { outliner_do_libdata_operation(C, scene, soops, &soops->tree, unlink_group_cb); str= "Unlink group"; } - else if(event==2) { + else if (event==2) { outliner_do_libdata_operation(C, scene, soops, &soops->tree, id_local_cb); str= "Localized Data"; } - else if(event==3) { + else if (event==3) { outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_linkobs2scene_cb); str= "Link Group Objects to Scene"; } - else if(event==4) { + else if (event==4) { outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_toggle_visibility_cb); str= "Toggle Visibility"; } - else if(event==5) { + else if (event==5) { outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_toggle_selectability_cb); str= "Toggle Selectability"; } - else if(event==6) { + else if (event==6) { outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_toggle_renderability_cb); str= "Toggle Renderability"; } - else if(event==7) { + else if (event==7) { outliner_do_libdata_operation(C, scene, soops, &soops->tree, item_rename_cb); str= "Rename"; } @@ -894,7 +895,7 @@ static void outliner_do_id_set_operation(SpaceOops *soops, int type, ListBase *l for (te=lb->first; te; te= te->next) { tselem= TREESTORE(te); if (tselem->flag & TSE_SELECTED) { - if(tselem->type==type) { + if (tselem->type==type) { TreeStoreElem *tsep = TREESTORE(te->parent); operation_cb(te, tselem, tsep, newid); } @@ -1124,29 +1125,29 @@ static int outliner_data_operation_exec(bContext *C, wmOperator *op) event= RNA_enum_get(op->ptr, "type"); set_operation_types(soops, &soops->tree, &scenelevel, &objectlevel, &idlevel, &datalevel); - if(datalevel==TSE_POSE_CHANNEL) { - if(event>0) { + if (datalevel==TSE_POSE_CHANNEL) { + if (event>0) { outliner_do_data_operation(soops, datalevel, event, &soops->tree, pchan_cb); WM_event_add_notifier(C, NC_OBJECT|ND_POSE, NULL); ED_undo_push(C, "PoseChannel operation"); } } - else if(datalevel==TSE_BONE) { - if(event>0) { + else if (datalevel==TSE_BONE) { + if (event>0) { outliner_do_data_operation(soops, datalevel, event, &soops->tree, bone_cb); WM_event_add_notifier(C, NC_OBJECT|ND_POSE, NULL); ED_undo_push(C, "Bone operation"); } } - else if(datalevel==TSE_EBONE) { - if(event>0) { + else if (datalevel==TSE_EBONE) { + if (event>0) { outliner_do_data_operation(soops, datalevel, event, &soops->tree, ebone_cb); WM_event_add_notifier(C, NC_OBJECT|ND_POSE, NULL); ED_undo_push(C, "EditBone operation"); } } - else if(datalevel==TSE_SEQUENCE) { - if(event>0) { + else if (datalevel==TSE_SEQUENCE) { + if (event>0) { outliner_do_data_operation(soops, datalevel, event, &soops->tree, sequence_cb); } } @@ -1180,7 +1181,7 @@ static int do_outliner_operation_event(bContext *C, Scene *scene, ARegion *ar, S { ReportList *reports = CTX_wm_reports(C); // XXX... - if(mval[1]>te->ys && mval[1]<te->ys+UI_UNIT_Y) { + 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); @@ -1198,15 +1199,15 @@ static int do_outliner_operation_event(bContext *C, Scene *scene, ARegion *ar, S set_operation_types(soops, &soops->tree, &scenelevel, &objectlevel, &idlevel, &datalevel); - if(scenelevel) { + if (scenelevel) { //if(objectlevel || datalevel || idlevel) error("Mixed selection"); //else pupmenu("Scene Operations%t|Delete"); } - else if(objectlevel) { + else if (objectlevel) { WM_operator_name_call(C, "OUTLINER_OT_object_operation", WM_OP_INVOKE_REGION_WIN, NULL); } - else if(idlevel) { - if(idlevel==-1 || datalevel) BKE_report(reports, RPT_WARNING, "Mixed selection"); + else if (idlevel) { + if (idlevel==-1 || datalevel) BKE_report(reports, RPT_WARNING, "Mixed selection"); else { if (idlevel==ID_GR) WM_operator_name_call(C, "OUTLINER_OT_group_operation", WM_OP_INVOKE_REGION_WIN, NULL); @@ -1214,8 +1215,8 @@ static int do_outliner_operation_event(bContext *C, Scene *scene, ARegion *ar, S WM_operator_name_call(C, "OUTLINER_OT_id_operation", WM_OP_INVOKE_REGION_WIN, NULL); } } - else if(datalevel) { - if(datalevel==-1) BKE_report(reports, RPT_WARNING, "Mixed selection"); + else if (datalevel) { + if (datalevel==-1) BKE_report(reports, RPT_WARNING, "Mixed selection"); else { if (datalevel == TSE_ANIM_DATA) WM_operator_name_call(C, "OUTLINER_OT_animdata_operation", WM_OP_INVOKE_REGION_WIN, NULL); @@ -1231,8 +1232,8 @@ static int do_outliner_operation_event(bContext *C, Scene *scene, ARegion *ar, S return 1; } - for(te= te->subtree.first; te; te= te->next) { - if(do_outliner_operation_event(C, scene, ar, soops, te, event, mval)) + for (te= te->subtree.first; te; te= te->next) { + if (do_outliner_operation_event(C, scene, ar, soops, te, event, mval)) return 1; } return 0; @@ -1249,8 +1250,8 @@ static int outliner_operation(bContext *C, wmOperator *UNUSED(op), wmEvent *even UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], fmval, fmval+1); - for(te= soops->tree.first; te; te= te->next) { - if(do_outliner_operation_event(C, scene, ar, soops, te, event, fmval)) break; + for (te= soops->tree.first; te; te= te->next) { + if (do_outliner_operation_event(C, scene, ar, soops, te, event, fmval)) break; } return OPERATOR_FINISHED; diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c index b702bea5168..e83fce0cf05 100644 --- a/source/blender/editors/space_outliner/outliner_tree.c +++ b/source/blender/editors/space_outliner/outliner_tree.c @@ -115,23 +115,23 @@ static void outliner_storage_cleanup(SpaceOops *soops) { TreeStore *ts= soops->treestore; - if(ts) { + if (ts) { TreeStoreElem *tselem; int a, unused= 0; /* each element used once, for ID blocks with more users to have each a treestore */ - for(a=0, tselem= ts->data; a<ts->usedelem; a++, tselem++) tselem->used= 0; + for (a=0, tselem= ts->data; a<ts->usedelem; a++, tselem++) 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) { + if (soops->storeflag & SO_TREESTORE_CLEANUP) { - for(a=0, tselem= ts->data; a<ts->usedelem; a++, tselem++) { - if(tselem->id==NULL) unused++; + for (a=0, tselem= ts->data; a<ts->usedelem; a++, tselem++) { + if (tselem->id==NULL) unused++; } - if(unused) { - if(ts->usedelem == unused) { + if (unused) { + if (ts->usedelem == unused) { MEM_freeN(ts->data); ts->data= NULL; ts->usedelem= ts->totelem= 0; @@ -140,8 +140,8 @@ static void outliner_storage_cleanup(SpaceOops *soops) TreeStoreElem *tsnewar, *tsnew; tsnew=tsnewar= MEM_mallocN((ts->usedelem-unused)*sizeof(TreeStoreElem), "new tselem"); - for(a=0, tselem= ts->data; a<ts->usedelem; a++, tselem++) { - if(tselem->id) { + for (a=0, tselem= ts->data; a<ts->usedelem; a++, tselem++) { + if (tselem->id) { *tsnew= *tselem; tsnew++; } @@ -163,16 +163,16 @@ static void check_persistent(SpaceOops *soops, TreeElement *te, ID *id, short ty int a; /* case 1; no TreeStore */ - if(soops->treestore==NULL) { + if (soops->treestore==NULL) { soops->treestore= MEM_callocN(sizeof(TreeStore), "treestore"); } ts= soops->treestore; /* check if 'te' is in treestore */ tselem= ts->data; - for(a=0; a<ts->usedelem; a++, tselem++) { - if(tselem->id==id && tselem->used==0) { - if((type==0 && tselem->type==0) ||(tselem->type==type && tselem->nr==nr)) { + for (a=0; a<ts->usedelem; a++, tselem++) { + if (tselem->id==id && tselem->used==0) { + if ((type==0 && tselem->type==0) ||(tselem->type==type && tselem->nr==nr)) { te->store_index= a; tselem->used= 1; return; @@ -181,11 +181,11 @@ static void check_persistent(SpaceOops *soops, TreeElement *te, ID *id, short ty } /* add 1 element to treestore */ - if(ts->usedelem==ts->totelem) { + if (ts->usedelem==ts->totelem) { TreeStoreElem *tsnew; tsnew= MEM_mallocN((ts->totelem+TS_CHUNK)*sizeof(TreeStoreElem), "treestore data"); - if(ts->data) { + if (ts->data) { memcpy(tsnew, ts->data, ts->totelem*sizeof(TreeStoreElem)); MEM_freeN(ts->data); } @@ -196,7 +196,7 @@ static void check_persistent(SpaceOops *soops, TreeElement *te, ID *id, short ty tselem= ts->data+ts->usedelem; tselem->type= type; - if(type) tselem->nr= nr; // we're picky! :) + if (type) tselem->nr= nr; // we're picky! :) else tselem->nr= 0; tselem->id= id; tselem->used = 0; @@ -211,13 +211,13 @@ static void check_persistent(SpaceOops *soops, TreeElement *te, ID *id, short ty void outliner_free_tree(ListBase *lb) { - while(lb->first) { + while (lb->first) { TreeElement *te= lb->first; outliner_free_tree(&te->subtree); BLI_remlink(lb, te); - if(te->flag & TE_FREE_NAME) MEM_freeN((void *)te->name); + if (te->flag & TE_FREE_NAME) MEM_freeN((void *)te->name); MEM_freeN(te); } } @@ -232,10 +232,10 @@ void outliner_cleanup_tree(SpaceOops *soops) static TreeElement *outliner_find_tree_element(ListBase *lb, int store_index) { TreeElement *te= lb->first, *tes; - while(te) { - if(te->store_index==store_index) return te; + while (te) { + if (te->store_index==store_index) return te; tes= outliner_find_tree_element(&te->subtree, store_index); - if(tes) return tes; + if (tes) return tes; te= te->next; } return NULL; @@ -248,18 +248,18 @@ TreeElement *outliner_find_tse(SpaceOops *soops, TreeStoreElem *tse) TreeStoreElem *tselem; int a; - if(tse->id==NULL) return NULL; + if (tse->id==NULL) return NULL; /* check if 'tse' is in treestore */ tselem= ts->data; - for(a=0; a<ts->usedelem; a++, tselem++) { - if((tse->type==0 && tselem->type==0) || (tselem->type==tse->type && tselem->nr==tse->nr)) { - if(tselem->id==tse->id) { + for (a=0; a<ts->usedelem; a++, tselem++) { + if ((tse->type==0 && tselem->type==0) || (tselem->type==tse->type && tselem->nr==tse->nr)) { + if (tselem->id==tse->id) { break; } } } - if(tselem) + if (tselem) return outliner_find_tree_element(&soops->tree, a); return NULL; @@ -271,14 +271,14 @@ TreeElement *outliner_find_id(SpaceOops *soops, ListBase *lb, ID *id) TreeElement *te, *tes; TreeStoreElem *tselem; - for(te= lb->first; te; te= te->next) { + for (te= lb->first; te; te= te->next) { tselem= TREESTORE(te); - if(tselem->type==0) { - if(tselem->id==id) return te; + if (tselem->type==0) { + if (tselem->id==id) return te; /* only deeper on scene or object */ - if( te->idcode==ID_OB || te->idcode==ID_SCE || (soops->outlinevis == SO_GROUPS && te->idcode==ID_GR)) { + if ( te->idcode==ID_OB || te->idcode==ID_SCE || (soops->outlinevis == SO_GROUPS && te->idcode==ID_GR)) { tes= outliner_find_id(soops, &te->subtree, id); - if(tes) return tes; + if (tes) return tes; } } } @@ -291,9 +291,9 @@ ID *outliner_search_back(SpaceOops *soops, TreeElement *te, short idcode) TreeStoreElem *tselem; te= te->parent; - while(te) { + while (te) { tselem= TREESTORE(te); - if(tselem->type==0 && te->idcode==idcode) return tselem->id; + if (tselem->type==0 && te->idcode==idcode) return tselem->id; te= te->parent; } return NULL; @@ -318,7 +318,7 @@ static void outliner_add_bone(SpaceOops *soops, ListBase *lb, ID *id, Bone *curB te->name= curBone->name; te->directdata= curBone; - for(curBone= curBone->childbase.first; curBone; curBone=curBone->next) { + for (curBone= curBone->childbase.first; curBone; curBone=curBone->next) { outliner_add_bone(soops, &te->subtree, id, curBone, te, a); } } @@ -341,7 +341,7 @@ static void outliner_add_passes(SpaceOops *soops, TreeElement *tenla, ID *id, Sc /* save cpu cycles, but we add the first to invoke an open/close triangle */ tselem = TREESTORE(tenla); - if(tselem->flag & TSE_CLOSED) + if (tselem->flag & TSE_CLOSED) return; te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_Z)); @@ -422,14 +422,14 @@ static void outliner_add_scene_contents(SpaceOops *soops, ListBase *lb, Scene *s int a; tenla->name= "RenderLayers"; - for(a=0, srl= sce->r.layers.first; srl; srl= srl->next, a++) { + for (a=0, srl= sce->r.layers.first; srl; srl= srl->next, a++) { TreeElement *tenlay= outliner_add_element(soops, &tenla->subtree, sce, te, TSE_R_LAYER, a); tenlay->name= srl->name; tenlay->directdata= &srl->passflag; - if(srl->light_override) + if (srl->light_override) outliner_add_element(soops, &tenlay->subtree, srl->light_override, tenlay, TSE_LINKED_LAMP, 0); - if(srl->mat_override) + if (srl->mat_override) outliner_add_element(soops, &tenlay->subtree, srl->mat_override, tenlay, TSE_LINKED_MAT, 0); outliner_add_passes(soops, tenlay, &sce->id, srl); @@ -469,13 +469,13 @@ static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, Tree if ((arm->edbo == NULL) && (ob->mode & OB_MODE_POSE)) { int a= 0, const_index= 1000; /* ensure unique id for bone constraints */ - for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next, a++) { + 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) { + if (pchan->constraints.first) { //Object *target; bConstraint *con; TreeElement *ten1; @@ -483,12 +483,12 @@ static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, Tree //char *str; tenla1->name= "Constraints"; - for(con= pchan->constraints.first; con; con= con->next, const_index++) { + for (con= pchan->constraints.first; con; con= con->next, const_index++) { ten1= outliner_add_element(soops, &tenla1->subtree, ob, tenla1, TSE_CONSTRAINT, const_index); #if 0 /* disabled as it needs to be reworked for recoded constraints system */ target= get_constraint_target(con, &str); - if(str && str[0]) ten1->name= str; - else if(target) ten1->name= target->id.name+2; + if (str && str[0]) ten1->name= str; + else if (target) ten1->name= target->id.name+2; else ten1->name= con->name; #endif ten1->name= con->name; @@ -499,12 +499,12 @@ static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, Tree } /* make hierarchy */ ten= tenla->subtree.first; - while(ten) { + while (ten) { TreeElement *nten= ten->next, *par; tselem= TREESTORE(ten); - if(tselem->type==TSE_POSE_CHANNEL) { + if (tselem->type==TSE_POSE_CHANNEL) { pchan= (bPoseChannel *)ten->directdata; - if(pchan->parent) { + if (pchan->parent) { BLI_remlink(&tenla->subtree, ten); par= (TreeElement *)pchan->parent->temp; BLI_addtail(&par->subtree, ten); @@ -516,7 +516,7 @@ static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, Tree } /* Pose Groups */ - if(ob->pose->agroups.first) { + if (ob->pose->agroups.first) { bActionGroup *agrp; TreeElement *ten; TreeElement *tenla= outliner_add_element(soops, &te->subtree, ob, te, TSE_POSEGRP_BASE, 0); @@ -531,10 +531,10 @@ static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, Tree } } - for(a=0; a<ob->totcol; a++) + for (a=0; a<ob->totcol; a++) outliner_add_element(soops, &te->subtree, ob->mat[a], te, 0, a); - if(ob->constraints.first) { + if (ob->constraints.first) { //Object *target; bConstraint *con; TreeElement *ten; @@ -546,8 +546,8 @@ static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, Tree ten= outliner_add_element(soops, &tenla->subtree, ob, tenla, TSE_CONSTRAINT, a); #if 0 /* disabled due to constraints system targets recode... code here needs review */ target= get_constraint_target(con, &str); - if(str && str[0]) ten->name= str; - else if(target) ten->name= target->id.name+2; + if (str && str[0]) ten->name= str; + else if (target) ten->name= target->id.name+2; else ten->name= con->name; #endif ten->name= con->name; @@ -641,7 +641,7 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor 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++) + for (a=0; a<me->totcol; a++) outliner_add_element(soops, &te->subtree, me->mat[a], te, 0, a); /* could do tfaces with image links, but the images are not grouped nicely. * would require going over all tfaces, sort images in use. etc... */ @@ -655,7 +655,7 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor if (cu->adt) outliner_add_element(soops, &te->subtree, cu, te, TSE_ANIM_DATA, 0); - for(a=0; a<cu->totcol; a++) + for (a=0; a<cu->totcol; a++) outliner_add_element(soops, &te->subtree, cu->mat[a], te, 0, a); } break; @@ -667,7 +667,7 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor if (mb->adt) outliner_add_element(soops, &te->subtree, mb, te, TSE_ANIM_DATA, 0); - for(a=0; a<mb->totcol; a++) + for (a=0; a<mb->totcol; a++) outliner_add_element(soops, &te->subtree, mb->mat[a], te, 0, a); } break; @@ -679,8 +679,8 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor if (ma->adt) outliner_add_element(soops, &te->subtree, ma, te, TSE_ANIM_DATA, 0); - for(a=0; a<MAX_MTEX; a++) { - if(ma->mtex[a]) outliner_add_element(soops, &te->subtree, ma->mtex[a]->tex, te, 0, a); + for (a=0; a<MAX_MTEX; a++) { + if (ma->mtex[a]) outliner_add_element(soops, &te->subtree, ma->mtex[a]->tex, te, 0, a); } } break; @@ -710,8 +710,8 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor if (la->adt) outliner_add_element(soops, &te->subtree, la, te, TSE_ANIM_DATA, 0); - for(a=0; a<MAX_MTEX; a++) { - if(la->mtex[a]) outliner_add_element(soops, &te->subtree, la->mtex[a]->tex, te, 0, a); + for (a=0; a<MAX_MTEX; a++) { + if (la->mtex[a]) outliner_add_element(soops, &te->subtree, la->mtex[a]->tex, te, 0, a); } } break; @@ -719,7 +719,7 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor { Speaker *spk= (Speaker *)id; - if(spk->adt) + if (spk->adt) outliner_add_element(soops, &te->subtree, spk, te, TSE_ANIM_DATA, 0); } break; @@ -731,8 +731,8 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor if (wrld->adt) outliner_add_element(soops, &te->subtree, wrld, te, TSE_ANIM_DATA, 0); - for(a=0; a<MAX_MTEX; a++) { - if(wrld->mtex[a]) outliner_add_element(soops, &te->subtree, wrld->mtex[a]->tex, te, 0, a); + for (a=0; a<MAX_MTEX; a++) { + if (wrld->mtex[a]) outliner_add_element(soops, &te->subtree, wrld->mtex[a]->tex, te, 0, a); } } break; @@ -758,7 +758,7 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor if (arm->adt) outliner_add_element(soops, &te->subtree, arm, te, TSE_ANIM_DATA, 0); - if(arm->edbo) { + if (arm->edbo) { EditBone *ebone; TreeElement *ten; @@ -770,10 +770,10 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor } /* make hierarchy */ ten= arm->edbo->first ? ((EditBone *)arm->edbo->first)->temp : NULL; - while(ten) { + while (ten) { TreeElement *nten= ten->next, *par; ebone= (EditBone *)ten->directdata; - if(ebone->parent) { + if (ebone->parent) { BLI_remlink(&te->subtree, ten); par= ebone->parent->temp; BLI_addtail(&par->subtree, ten); @@ -785,10 +785,10 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor else { /* do not extend Armature when we have posemode */ tselem= TREESTORE(te->parent); - if( GS(tselem->id->name)==ID_OB && ((Object *)tselem->id)->mode & OB_MODE_POSE); + if ( GS(tselem->id->name)==ID_OB && ((Object *)tselem->id)->mode & OB_MODE_POSE); else { Bone *curBone; - for (curBone=arm->bonebase.first; curBone; curBone=curBone->next){ + for (curBone=arm->bonebase.first; curBone; curBone=curBone->next) { outliner_add_bone(soops, &te->subtree, id, curBone, te, &a); } } @@ -807,12 +807,12 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i ID *id= idv; int a = 0; - if(ELEM3(type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) { + if (ELEM3(type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) { id= ((PointerRNA*)idv)->id.data; - if(!id) id= ((PointerRNA*)idv)->data; + if (!id) id= ((PointerRNA*)idv)->data; } - if(id==NULL) return NULL; + if (id==NULL) return NULL; te= MEM_callocN(sizeof(TreeElement), "tree elem"); /* add to the visual tree */ @@ -822,24 +822,24 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i tselem= TREESTORE(te); /* if we are searching for something expand to see child elements */ - if(SEARCHING_OUTLINER(soops)) + if (SEARCHING_OUTLINER(soops)) tselem->flag |= TSE_CHILDSEARCH; te->parent= parent; te->index= index; // for data arays - if(ELEM3(type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP)); - else if(ELEM3(type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)); - else if(type==TSE_ANIM_DATA); + if (ELEM3(type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP)); + else if (ELEM3(type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)); + else if (type==TSE_ANIM_DATA); else { te->name= id->name+2; // default, can be overridden by Library or non-ID data te->idcode= GS(id->name); } - if(type==0) { + if (type==0) { /* ID datablock */ outliner_add_id_contents(soops, te, tselem, id); } - else if(type==TSE_ANIM_DATA) { + else if (type==TSE_ANIM_DATA) { IdAdtTemplate *iat = (IdAdtTemplate *)idv; AnimData *adt= (AnimData *)iat->adt; @@ -897,12 +897,12 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i 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; + if (ten) ten->directdata= strip; } } } } - else if(type==TSE_SEQUENCE) { + else if (type==TSE_SEQUENCE) { Sequence *seq= (Sequence*) idv; Sequence *p; @@ -914,25 +914,25 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i te->idcode= seq->type; te->directdata= seq; - if(seq->type<7) { + if (seq->type<7) { /* * This work like the sequence. * If the sequence have a name (not default name) * show it, in other case put the filename. */ - if(strcmp(seq->name, "SQ")) + if (strcmp(seq->name, "SQ")) te->name= seq->name; else { - if((seq->strip) && (seq->strip->stripdata)) + if ((seq->strip) && (seq->strip->stripdata)) te->name= seq->strip->stripdata->name; else te->name= "SQ None"; } - if(seq->type==SEQ_META) { + if (seq->type==SEQ_META) { te->name= "Meta Strip"; p= seq->seqbase.first; - while(p) { + while (p) { outliner_add_element(soops, &te->subtree, (void*)p, te, TSE_SEQUENCE, index); p= p->next; } @@ -943,23 +943,23 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i else te->name= "Effect"; } - else if(type==TSE_SEQ_STRIP) { + else if (type==TSE_SEQ_STRIP) { Strip *strip= (Strip *)idv; - if(strip->dir) + if (strip->dir) te->name= strip->dir; else te->name= "Strip None"; te->directdata= strip; } - else if(type==TSE_SEQUENCE_DUP) { + else if (type==TSE_SEQUENCE_DUP) { Sequence *seq= (Sequence*)idv; te->idcode= seq->type; te->directdata= seq; te->name= seq->strip->stripdata->name; } - else if(ELEM3(type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) { + else if (ELEM3(type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) { PointerRNA pptr, propptr, *ptr= (PointerRNA*)idv; PropertyRNA *prop, *iterprop; PropertyType proptype; @@ -967,39 +967,39 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i /* we do lazy build, for speed and to avoid infinite recusion */ - if(ptr->data == NULL) { + if (ptr->data == NULL) { te->name= "(empty)"; } - else if(type == TSE_RNA_STRUCT) { + else if (type == TSE_RNA_STRUCT) { /* struct */ te->name= RNA_struct_name_get_alloc(ptr, NULL, 0, NULL); - if(te->name) + if (te->name) te->flag |= TE_FREE_NAME; else te->name= RNA_struct_ui_name(ptr->type); /* If searching don't expand RNA entries */ - if(SEARCHING_OUTLINER(soops) && BLI_strcasecmp("RNA",te->name)==0) tselem->flag &= ~TSE_CHILDSEARCH; + if (SEARCHING_OUTLINER(soops) && BLI_strcasecmp("RNA",te->name)==0) tselem->flag &= ~TSE_CHILDSEARCH; iterprop= RNA_struct_iterator_property(ptr->type); tot= RNA_property_collection_length(ptr, iterprop); /* auto open these cases */ - if(!parent || (RNA_property_type(parent->directdata)) == PROP_POINTER) - if(!tselem->used) + if (!parent || (RNA_property_type(parent->directdata)) == PROP_POINTER) + if (!tselem->used) tselem->flag &= ~TSE_CLOSED; - if(TSELEM_OPEN(tselem,soops)) { - for(a=0; a<tot; a++) + if (TSELEM_OPEN(tselem,soops)) { + for (a=0; a<tot; a++) outliner_add_element(soops, &te->subtree, (void*)ptr, te, TSE_RNA_PROPERTY, a); } - else if(tot) + else if (tot) te->flag |= TE_LAZY_CLOSED; te->rnaptr= *ptr; } - else if(type == TSE_RNA_PROPERTY) { + else if (type == TSE_RNA_PROPERTY) { /* property */ iterprop= RNA_struct_iterator_property(ptr->type); RNA_property_collection_lookup_int(ptr, iterprop, index, &propptr); @@ -1012,42 +1012,42 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i te->rnaptr= *ptr; /* If searching don't expand RNA entries */ - if(SEARCHING_OUTLINER(soops) && BLI_strcasecmp("RNA",te->name)==0) tselem->flag &= ~TSE_CHILDSEARCH; + if (SEARCHING_OUTLINER(soops) && BLI_strcasecmp("RNA",te->name)==0) tselem->flag &= ~TSE_CHILDSEARCH; - if(proptype == PROP_POINTER) { + if (proptype == PROP_POINTER) { pptr= RNA_property_pointer_get(ptr, prop); - if(pptr.data) { - if(TSELEM_OPEN(tselem,soops)) + if (pptr.data) { + if (TSELEM_OPEN(tselem,soops)) outliner_add_element(soops, &te->subtree, (void*)&pptr, te, TSE_RNA_STRUCT, -1); else te->flag |= TE_LAZY_CLOSED; } } - else if(proptype == PROP_COLLECTION) { + else if (proptype == PROP_COLLECTION) { tot= RNA_property_collection_length(ptr, prop); - if(TSELEM_OPEN(tselem,soops)) { - for(a=0; a<tot; a++) { + if (TSELEM_OPEN(tselem,soops)) { + for (a=0; a<tot; a++) { RNA_property_collection_lookup_int(ptr, prop, a, &pptr); outliner_add_element(soops, &te->subtree, (void*)&pptr, te, TSE_RNA_STRUCT, a); } } - else if(tot) + else if (tot) te->flag |= TE_LAZY_CLOSED; } - else if(ELEM3(proptype, PROP_BOOLEAN, PROP_INT, PROP_FLOAT)) { + else if (ELEM3(proptype, PROP_BOOLEAN, PROP_INT, PROP_FLOAT)) { tot= RNA_property_array_length(ptr, prop); - if(TSELEM_OPEN(tselem,soops)) { - for(a=0; a<tot; a++) + if (TSELEM_OPEN(tselem,soops)) { + for (a=0; a<tot; a++) outliner_add_element(soops, &te->subtree, (void*)ptr, te, TSE_RNA_ARRAY_ELEM, a); } - else if(tot) + else if (tot) te->flag |= TE_LAZY_CLOSED; } } - else if(type == TSE_RNA_ARRAY_ELEM) { + else if (type == TSE_RNA_ARRAY_ELEM) { char c; prop= parent->directdata; @@ -1059,12 +1059,12 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i c= RNA_property_array_item_char(prop, index); te->name= MEM_callocN(sizeof(char)*20, "OutlinerRNAArrayName"); - if(c) sprintf((char *)te->name, " %c", c); + if (c) sprintf((char *)te->name, " %c", c); else sprintf((char *)te->name, " %d", index+1); te->flag |= TE_FREE_NAME; } } - else if(type == TSE_KEYMAP) { + else if (type == TSE_KEYMAP) { wmKeyMap *km= (wmKeyMap *)idv; wmKeyMapItem *kmi; char opname[OP_MAX_TYPENAME]; @@ -1072,24 +1072,24 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i te->directdata= idv; te->name= km->idname; - if(TSELEM_OPEN(tselem,soops)) { + if (TSELEM_OPEN(tselem,soops)) { a= 0; for (kmi = km->items.first; kmi; kmi = kmi->next, a++) { const char *key= WM_key_event_string(kmi->type); - if(key[0]) { + if (key[0]) { wmOperatorType *ot= NULL; - if(kmi->propvalue); + if (kmi->propvalue); else ot= WM_operatortype_find(kmi->idname, 0); - if(ot || kmi->propvalue) { + if (ot || kmi->propvalue) { TreeElement *ten= outliner_add_element(soops, &te->subtree, kmi, te, TSE_KEYMAP_ITEM, a); ten->directdata= kmi; - if(kmi->propvalue) { + if (kmi->propvalue) { ten->name= "Modal map, not yet"; } else { @@ -1116,7 +1116,7 @@ static int need_add_seq_dup(Sequence *seq) { Sequence *p; - if((!seq->strip) || (!seq->strip->stripdata) || (!seq->strip->stripdata->name)) + if ((!seq->strip) || (!seq->strip->stripdata) || (!seq->strip->stripdata->name)) return(1); /* @@ -1124,25 +1124,25 @@ static int need_add_seq_dup(Sequence *seq) * sequence before this, don't need it, just return. */ p= seq->prev; - while(p) { - if((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) { + while (p) { + if ((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) { p= p->prev; continue; } - if(!strcmp(p->strip->stripdata->name, seq->strip->stripdata->name)) + if (!strcmp(p->strip->stripdata->name, seq->strip->stripdata->name)) return(2); p= p->prev; } p= seq->next; - while(p) { - if((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) { + while (p) { + if ((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) { p= p->next; continue; } - if(!strcmp(p->strip->stripdata->name, seq->strip->stripdata->name)) + if (!strcmp(p->strip->stripdata->name, seq->strip->stripdata->name)) return(0); p= p->next; } @@ -1155,13 +1155,13 @@ static void outliner_add_seq_dup(SpaceOops *soops, Sequence *seq, TreeElement *t Sequence *p; p= seq; - while(p) { - if((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) { + while (p) { + if ((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) { p= p->next; continue; } - if(!strcmp(p->strip->stripdata->name, seq->strip->stripdata->name)) + if (!strcmp(p->strip->stripdata->name, seq->strip->stripdata->name)) /* ch= */ /* UNUSED */ outliner_add_element(soops, &te->subtree, (void*)p, te, TSE_SEQUENCE, index); p= p->next; } @@ -1181,18 +1181,18 @@ static void outliner_make_hierarchy(SpaceOops *soops, ListBase *lb) /* build hierarchy */ // XXX also, set extents here... te= lb->first; - while(te) { + while (te) { ten= te->next; tselem= TREESTORE(te); - if(tselem->type==0 && te->idcode==ID_OB) { + if (tselem->type==0 && te->idcode==ID_OB) { Object *ob= (Object *)tselem->id; - if(ob->parent && ob->parent->id.newid) { + if (ob->parent && ob->parent->id.newid) { BLI_remlink(lb, te); tep= (TreeElement *)ob->parent->id.newid; BLI_addtail(&tep->subtree, te); // set correct parent pointers - for(te=tep->subtree.first; te; te= te->next) te->parent= tep; + for (te=tep->subtree.first; te; te= te->next) te->parent= tep; } } te= ten; @@ -1216,15 +1216,15 @@ static int treesort_alpha(const void *v1, const void *v2) /* first put objects last (hierarchy) */ comp= (x1->idcode==ID_OB); - if(x2->idcode==ID_OB) comp+=2; + if (x2->idcode==ID_OB) comp+=2; - if(comp==1) return 1; - else if(comp==2) return -1; - else if(comp==3) { + 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; + if ( comp>0 ) return 1; + else if ( comp<0) return -1; return 0; } return 0; @@ -1237,20 +1237,20 @@ 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; - else if(x2->idcode==ID_OB && x1->idcode!=ID_OB) return -1; + if (x1->idcode==ID_OB && x2->idcode!=ID_OB) return 1; + else if (x2->idcode==ID_OB && x1->idcode!=ID_OB) return -1; else { /* 2nd we check ob type */ - if(x1->idcode==ID_OB && x2->idcode==ID_OB) { - if( ((Object *)x1->id)->type > ((Object *)x2->id)->type) return 1; - else if( ((Object *)x1->id)->type > ((Object *)x2->id)->type) return -1; + if (x1->idcode==ID_OB && x2->idcode==ID_OB) { + if ( ((Object *)x1->id)->type > ((Object *)x2->id)->type) return 1; + else if ( ((Object *)x1->id)->type > ((Object *)x2->id)->type) return -1; else return 0; } else { int comp= strcmp(x1->name, x2->name); - if( comp>0 ) return 1; - else if( comp<0) return -1; + if ( comp>0 ) return 1; + else if ( comp<0) return -1; return 0; } } @@ -1265,38 +1265,38 @@ static void outliner_sort(SpaceOops *soops, ListBase *lb) int totelem=0; te= lb->last; - if(te==NULL) return; + if (te==NULL) return; tselem= TREESTORE(te); /* sorting rules; only object lists or deformgroups */ - if( (tselem->type==TSE_DEFGROUP) || (tselem->type==0 && te->idcode==ID_OB)) { + if ( (tselem->type==TSE_DEFGROUP) || (tselem->type==0 && te->idcode==ID_OB)) { /* count first */ - for(te= lb->first; te; te= te->next) totelem++; + for (te= lb->first; te; te= te->next) totelem++; - if(totelem>1) { + if (totelem>1) { tTreeSort *tear= MEM_mallocN(totelem*sizeof(tTreeSort), "tree sort array"); tTreeSort *tp=tear; int skip= 0; - for(te= lb->first; te; te= te->next, tp++) { + for (te= lb->first; te; te= te->next, tp++) { tselem= TREESTORE(te); 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 && tselem->type!=TSE_DEFGROUP) tp->idcode= 0; // don't sort this tp->id= tselem->id; } /* keep beginning of list */ - for(tp= tear, skip=0; skip<totelem; skip++, tp++) - if(tp->idcode) break; + for (tp= tear, skip=0; skip<totelem; skip++, tp++) + if (tp->idcode) break; - if(skip<totelem) + if (skip<totelem) qsort(tear+skip, totelem-skip, sizeof(tTreeSort), treesort_alpha); lb->first=lb->last= NULL; tp= tear; - while(totelem--) { + while (totelem--) { BLI_addtail(lb, tp->te); tp++; } @@ -1304,7 +1304,7 @@ static void outliner_sort(SpaceOops *soops, ListBase *lb) } } - for(te= lb->first; te; te= te->next) { + for (te= lb->first; te; te= te->next) { outliner_sort(soops, &te->subtree); } } @@ -1379,7 +1379,7 @@ static int outliner_filter_tree(SpaceOops *soops, ListBase *lb) outliner_free_tree(&te->subtree); BLI_remlink(lb, te); - if(te->flag & TE_FREE_NAME) MEM_freeN((void *)te->name); + if (te->flag & TE_FREE_NAME) MEM_freeN((void *)te->name); MEM_freeN(te); } } @@ -1414,35 +1414,35 @@ void outliner_build_tree(Main *mainvar, Scene *scene, SpaceOops *soops) /* Are we looking for something - we want to tag parents to filter child matches * - NOT in datablocks view - searching all datablocks takes way too long to be useful * - this variable is only set once per tree build */ - if(soops->search_string[0]!=0 && soops->outlinevis!=SO_DATABLOCKS) + if (soops->search_string[0]!=0 && soops->outlinevis!=SO_DATABLOCKS) soops->search_flags |= SO_SEARCH_RECURSIVE; else soops->search_flags &= ~SO_SEARCH_RECURSIVE; - if(soops->tree.first && (soops->storeflag & SO_TREESTORE_REDRAW)) + if (soops->tree.first && (soops->storeflag & SO_TREESTORE_REDRAW)) return; outliner_free_tree(&soops->tree); outliner_storage_cleanup(soops); /* clear ob id.new flags */ - for(ob= mainvar->object.first; ob; ob= ob->id.next) ob->id.newid= NULL; + for (ob= mainvar->object.first; ob; ob= ob->id.next) ob->id.newid= NULL; /* options */ - if(soops->outlinevis == SO_LIBRARIES) { + if (soops->outlinevis == SO_LIBRARIES) { Library *lib; - for(lib= mainvar->library.first; lib; lib= lib->id.next) { + for (lib= mainvar->library.first; lib; lib= lib->id.next) { ten= outliner_add_element(soops, &soops->tree, lib, NULL, 0, 0); lib->id.newid= (ID *)ten; } /* make hierarchy */ ten= soops->tree.first; - while(ten) { + while (ten) { TreeElement *nten= ten->next, *par; tselem= TREESTORE(ten); lib= (Library *)tselem->id; - if(lib->parent) { + if (lib->parent) { BLI_remlink(&soops->tree, ten); par= (TreeElement *)lib->parent->id.newid; BLI_addtail(&par->subtree, ten); @@ -1451,67 +1451,67 @@ void outliner_build_tree(Main *mainvar, Scene *scene, SpaceOops *soops) ten= nten; } /* restore newid pointers */ - for(lib= mainvar->library.first; lib; lib= lib->id.next) + for (lib= mainvar->library.first; lib; lib= lib->id.next) lib->id.newid= NULL; } - else if(soops->outlinevis == SO_ALL_SCENES) { + else if (soops->outlinevis == SO_ALL_SCENES) { Scene *sce; - for(sce= mainvar->scene.first; sce; sce= sce->id.next) { + for (sce= mainvar->scene.first; sce; sce= sce->id.next) { te= outliner_add_element(soops, &soops->tree, sce, NULL, 0, 0); tselem= TREESTORE(te); - if(sce==scene && show_opened) + if (sce==scene && show_opened) tselem->flag &= ~TSE_CLOSED; - for(base= sce->base.first; base; base= base->next) { + for (base= sce->base.first; base; base= base->next) { ten= outliner_add_element(soops, &te->subtree, base->object, te, 0, 0); ten->directdata= base; } outliner_make_hierarchy(soops, &te->subtree); /* clear id.newid, to prevent objects be inserted in wrong scenes (parent in other scene) */ - for(base= sce->base.first; base; base= base->next) base->object->id.newid= NULL; + for (base= sce->base.first; base; base= base->next) base->object->id.newid= NULL; } } - else if(soops->outlinevis == SO_CUR_SCENE) { + else if (soops->outlinevis == SO_CUR_SCENE) { outliner_add_scene_contents(soops, &soops->tree, scene, NULL); - for(base= scene->base.first; base; base= base->next) { + for (base= scene->base.first; base; base= base->next) { ten= outliner_add_element(soops, &soops->tree, base->object, NULL, 0, 0); ten->directdata= base; } outliner_make_hierarchy(soops, &soops->tree); } - else if(soops->outlinevis == SO_VISIBLE) { - for(base= scene->base.first; base; base= base->next) { - if(base->lay & scene->lay) + else if (soops->outlinevis == SO_VISIBLE) { + for (base= scene->base.first; base; base= base->next) { + if (base->lay & scene->lay) outliner_add_element(soops, &soops->tree, base->object, NULL, 0, 0); } outliner_make_hierarchy(soops, &soops->tree); } - else if(soops->outlinevis == SO_GROUPS) { + else if (soops->outlinevis == SO_GROUPS) { Group *group; GroupObject *go; - for(group= mainvar->group.first; group; group= group->id.next) { - if(group->gobject.first) { + for (group= mainvar->group.first; group; group= group->id.next) { + if (group->gobject.first) { te= outliner_add_element(soops, &soops->tree, group, NULL, 0, 0); - for(go= group->gobject.first; go; go= go->next) { + for (go= group->gobject.first; go; go= go->next) { ten= outliner_add_element(soops, &te->subtree, go->ob, te, 0, 0); ten->directdata= NULL; /* eh, why? */ } outliner_make_hierarchy(soops, &te->subtree); /* clear id.newid, to prevent objects be inserted in wrong scenes (parent in other scene) */ - for(go= group->gobject.first; go; go= go->next) go->ob->id.newid= NULL; + for (go= group->gobject.first; go; go= go->next) go->ob->id.newid= NULL; } } } - else if(soops->outlinevis == SO_SAME_TYPE) { + else if (soops->outlinevis == SO_SAME_TYPE) { Object *ob= OBACT; - if(ob) { - for(base= scene->base.first; base; base= base->next) { - if(base->object->type==ob->type) { + if (ob) { + for (base= scene->base.first; base; base= base->next) { + if (base->object->type==ob->type) { ten= outliner_add_element(soops, &soops->tree, base->object, NULL, 0, 0); ten->directdata= base; } @@ -1519,10 +1519,10 @@ void outliner_build_tree(Main *mainvar, Scene *scene, SpaceOops *soops) outliner_make_hierarchy(soops, &soops->tree); } } - else if(soops->outlinevis == SO_SELECTED) { - for(base= scene->base.first; base; base= base->next) { - if(base->lay & scene->lay) { - if(base==BASACT || (base->flag & SELECT)) { + else if (soops->outlinevis == SO_SELECTED) { + for (base= scene->base.first; base; base= base->next) { + if (base->lay & scene->lay) { + if (base==BASACT || (base->flag & SELECT)) { ten= outliner_add_element(soops, &soops->tree, base->object, NULL, 0, 0); ten->directdata= base; } @@ -1530,65 +1530,65 @@ void outliner_build_tree(Main *mainvar, Scene *scene, SpaceOops *soops) } outliner_make_hierarchy(soops, &soops->tree); } - else if(soops->outlinevis==SO_SEQUENCE) { + else if (soops->outlinevis==SO_SEQUENCE) { Sequence *seq; Editing *ed= seq_give_editing(scene, FALSE); int op; - if(ed==NULL) + if (ed==NULL) return; seq= ed->seqbasep->first; - if(!seq) + if (!seq) return; - while(seq) { + while (seq) { op= need_add_seq_dup(seq); - if(op==1) { + if (op==1) { /* ten= */ outliner_add_element(soops, &soops->tree, (void*)seq, NULL, TSE_SEQUENCE, 0); } - else if(op==0) { + else if (op==0) { ten= outliner_add_element(soops, &soops->tree, (void*)seq, NULL, TSE_SEQUENCE_DUP, 0); outliner_add_seq_dup(soops, seq, ten, 0); } seq= seq->next; } } - else if(soops->outlinevis==SO_DATABLOCKS) { + else if (soops->outlinevis==SO_DATABLOCKS) { PointerRNA mainptr; RNA_main_pointer_create(mainvar, &mainptr); ten= outliner_add_element(soops, &soops->tree, (void*)&mainptr, NULL, TSE_RNA_STRUCT, -1); - if(show_opened) { + if (show_opened) { tselem= TREESTORE(ten); tselem->flag &= ~TSE_CLOSED; } } - else if(soops->outlinevis==SO_USERDEF) { + else if (soops->outlinevis==SO_USERDEF) { PointerRNA userdefptr; RNA_pointer_create(NULL, &RNA_UserPreferences, &U, &userdefptr); ten= outliner_add_element(soops, &soops->tree, (void*)&userdefptr, NULL, TSE_RNA_STRUCT, -1); - if(show_opened) { + if (show_opened) { tselem= TREESTORE(ten); tselem->flag &= ~TSE_CLOSED; } } - else if(soops->outlinevis==SO_KEYMAP) { + else if (soops->outlinevis==SO_KEYMAP) { wmWindowManager *wm= mainvar->wm.first; wmKeyMap *km; - for(km= wm->defaultconf->keymaps.first; km; km= km->next) { + for (km= wm->defaultconf->keymaps.first; km; km= km->next) { /* ten= */ outliner_add_element(soops, &soops->tree, (void*)km, NULL, TSE_KEYMAP, 0); } } else { ten= outliner_add_element(soops, &soops->tree, OBACT, NULL, 0, 0); - if(ten) ten->directdata= BASACT; + if (ten) ten->directdata= BASACT; } outliner_sort(soops, &soops->tree); diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c index d55fe40653e..ed050b7f93d 100644 --- a/source/blender/editors/space_outliner/space_outliner.c +++ b/source/blender/editors/space_outliner/space_outliner.c @@ -83,15 +83,15 @@ static int outliner_parent_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) float fmval[2]; UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fmval[0], &fmval[1]); - if(drag->type == WM_DRAG_ID) { + if (drag->type == WM_DRAG_ID) { ID *id = (ID *)drag->poin; - if( GS(id->name) == ID_OB ) { + if ( GS(id->name) == ID_OB ) { /* Ensure item under cursor is valid drop target */ /* Find object hovered over */ - for(te= soops->tree.first; te; te= te->next) { + for (te= soops->tree.first; te; te= te->next) { TreeElement *te_valid; te_valid= outliner_dropzone_parent(C, event, te, fmval); - if(te_valid) return 1; + if (te_valid) return 1; } } } @@ -114,20 +114,20 @@ static int outliner_parent_clear_poll(bContext *C, wmDrag *drag, wmEvent *event) UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fmval[0], &fmval[1]); - if(drag->type == WM_DRAG_ID) { + if (drag->type == WM_DRAG_ID) { ID *id = (ID *)drag->poin; - if( GS(id->name) == ID_OB ) { + if ( GS(id->name) == ID_OB ) { //TODO: Check if no parent? /* Ensure location under cursor is valid dropzone */ - for(te= soops->tree.first; te; te= te->next) { - if(outliner_dropzone_parent_clear(C, event, te, fmval)) return 1; + for (te= soops->tree.first; te; te= te->next) { + if (outliner_dropzone_parent_clear(C, event, te, fmval)) return 1; } /* Check if mouse cursor is below the tree */ te= soops->tree.last; - while(((te->flag & TE_LAZY_CLOSED)==0) && (te->subtree.last)) { + while (((te->flag & TE_LAZY_CLOSED)==0) && (te->subtree.last)) { te= te->subtree.last; } - if(fmval[1] < te->ys) return 1; + if (fmval[1] < te->ys) return 1; } } return 0; @@ -232,15 +232,15 @@ static void outliner_main_area_listener(ARegion *ar, wmNotifier *wmn) break; case NC_LAMP: /* For updating lamp icons, when changing lamp type */ - if(wmn->data == ND_LIGHTING_DRAW) + if (wmn->data == ND_LIGHTING_DRAW) ED_region_tag_redraw(ar); break; case NC_SPACE: - if(wmn->data == ND_SPACE_OUTLINER) + if (wmn->data == ND_SPACE_OUTLINER) ED_region_tag_redraw(ar); break; case NC_ID: - if(wmn->action == NA_RENAME) + if (wmn->action == NA_RENAME) ED_region_tag_redraw(ar); break; case NC_MATERIAL: @@ -269,7 +269,7 @@ static void outliner_main_area_listener(ARegion *ar, wmNotifier *wmn) ED_region_tag_redraw(ar); break; case ND_ANIMCHAN: - if(wmn->action==NA_SELECTED) + if (wmn->action==NA_SELECTED) ED_region_tag_redraw(ar); break; } @@ -301,11 +301,11 @@ static void outliner_header_area_listener(ARegion *ar, wmNotifier *wmn) /* context changes */ switch(wmn->category) { case NC_SCENE: - if(wmn->data == ND_KEYINGSET) + if (wmn->data == ND_KEYINGSET) ED_region_tag_redraw(ar); break; case NC_SPACE: - if(wmn->data == ND_SPACE_OUTLINER) + if (wmn->data == ND_SPACE_OUTLINER) ED_region_tag_redraw(ar); break; } @@ -349,8 +349,8 @@ static void outliner_free(SpaceLink *sl) SpaceOops *soutliner= (SpaceOops*)sl; outliner_free_tree(&soutliner->tree); - if(soutliner->treestore) { - if(soutliner->treestore->data) MEM_freeN(soutliner->treestore->data); + if (soutliner->treestore) { + if (soutliner->treestore->data) MEM_freeN(soutliner->treestore->data); MEM_freeN(soutliner->treestore); } |