Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/space_outliner/outliner_tools.c')
-rw-r--r--source/blender/editors/space_outliner/outliner_tools.c440
1 files changed, 220 insertions, 220 deletions
diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c
index 89eb51f73ba..a3ed2eac2d5 100644
--- a/source/blender/editors/space_outliner/outliner_tools.c
+++ b/source/blender/editors/space_outliner/outliner_tools.c
@@ -77,31 +77,31 @@
/* ************ SELECTION OPERATIONS ********* */
static void set_operation_types(SpaceOops *soops, ListBase *lb,
- int *scenelevel,
- int *objectlevel,
- int *idlevel,
- int *datalevel)
+ int *scenelevel,
+ int *objectlevel,
+ int *idlevel,
+ int *datalevel)
{
TreeElement *te;
TreeStoreElem *tselem;
- for (te= lb->first; te; te= te->next) {
- tselem= TREESTORE(te);
+ for (te = lb->first; te; te = te->next) {
+ tselem = TREESTORE(te);
if (tselem->flag & TSE_SELECTED) {
if (tselem->type) {
- if (*datalevel==0)
- *datalevel= tselem->type;
- else if (*datalevel!=tselem->type)
- *datalevel= -1;
+ if (*datalevel == 0)
+ *datalevel = tselem->type;
+ else if (*datalevel != tselem->type)
+ *datalevel = -1;
}
else {
- int idcode= GS(tselem->id->name);
+ int idcode = GS(tselem->id->name);
switch (idcode) {
case ID_SCE:
- *scenelevel= 1;
+ *scenelevel = 1;
break;
case ID_OB:
- *objectlevel= 1;
+ *objectlevel = 1;
break;
case ID_ME: case ID_CU: case ID_MB: case ID_LT:
@@ -109,9 +109,9 @@ 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;
- break;
+ if (*idlevel == 0) *idlevel = idcode;
+ else if (*idlevel != idcode) *idlevel = -1;
+ break;
}
}
}
@@ -130,62 +130,62 @@ static void unlink_action_cb(bContext *C, Scene *UNUSED(scene), TreeElement *UNU
static void unlink_material_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *UNUSED(tselem))
{
- Material **matar=NULL;
- int a, totcol=0;
+ Material **matar = NULL;
+ int a, totcol = 0;
- if ( GS(tsep->id->name)==ID_OB) {
- Object *ob= (Object *)tsep->id;
- totcol= ob->totcol;
- matar= ob->mat;
+ 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) {
- Mesh *me= (Mesh *)tsep->id;
- totcol= me->totcol;
- matar= me->mat;
+ 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) {
- Curve *cu= (Curve *)tsep->id;
- totcol= cu->totcol;
- matar= cu->mat;
+ 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) {
- MetaBall *mb= (MetaBall *)tsep->id;
- totcol= mb->totcol;
- matar= mb->mat;
+ 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;
+ matar[a] = NULL;
}
}
}
static void unlink_texture_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *UNUSED(tselem))
{
- MTex **mtex= NULL;
+ MTex **mtex = NULL;
int a;
- if ( GS(tsep->id->name)==ID_MA) {
- Material *ma= (Material *)tsep->id;
- mtex= ma->mtex;
+ if (GS(tsep->id->name) == ID_MA) {
+ Material *ma = (Material *)tsep->id;
+ mtex = ma->mtex;
}
- else if ( GS(tsep->id->name)==ID_LA) {
- Lamp *la= (Lamp *)tsep->id;
- mtex= la->mtex;
+ else if (GS(tsep->id->name) == ID_LA) {
+ Lamp *la = (Lamp *)tsep->id;
+ mtex = la->mtex;
}
- else if ( GS(tsep->id->name)==ID_WO) {
- World *wrld= (World *)tsep->id;
- mtex= wrld->mtex;
+ 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]) {
+ 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;
+ mtex[a]->tex = NULL;
}
}
}
@@ -193,16 +193,16 @@ static void unlink_texture_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeEle
static void unlink_group_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeElement *UNUSED(te), TreeStoreElem *tsep, TreeStoreElem *tselem)
{
- Group *group= (Group *)tselem->id;
+ Group *group = (Group *)tselem->id;
if (tsep) {
- if ( GS(tsep->id->name)==ID_OB) {
- Object *ob= (Object *)tsep->id;
- ob->dup_group= NULL;
+ if (GS(tsep->id->name) == ID_OB) {
+ Object *ob = (Object *)tsep->id;
+ ob->dup_group = NULL;
}
}
else {
- unlink_group(group);
+ BKE_group_unlink(group);
}
}
@@ -217,16 +217,16 @@ static void unlink_world_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeEleme
}
static void outliner_do_libdata_operation(bContext *C, Scene *scene, SpaceOops *soops, ListBase *lb,
- void (*operation_cb)(bContext *C, Scene *scene, TreeElement *, TreeStoreElem *, TreeStoreElem *))
+ void (*operation_cb)(bContext *C, Scene *scene, TreeElement *, TreeStoreElem *, TreeStoreElem *))
{
TreeElement *te;
TreeStoreElem *tselem;
- for (te=lb->first; te; te= te->next) {
- tselem= TREESTORE(te);
+ for (te = lb->first; te; te = te->next) {
+ tselem = TREESTORE(te);
if (tselem->flag & TSE_SELECTED) {
- if (tselem->type==0) {
- TreeStoreElem *tsep= TREESTORE(te->parent);
+ if (tselem->type == 0) {
+ TreeStoreElem *tsep = TREESTORE(te->parent);
operation_cb(C, scene, te, tsep, tselem);
}
}
@@ -240,10 +240,10 @@ static void outliner_do_libdata_operation(bContext *C, Scene *scene, SpaceOops *
static void object_select_cb(bContext *UNUSED(C), Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem)
{
- Base *base= (Base *)te->directdata;
+ 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 = BKE_scene_base_find(scene, (Object *)tselem->id);
+ if (base && ((base->object->restrictflag & OB_RESTRICT_VIEW) == 0)) {
base->flag |= SELECT;
base->object->flag |= SELECT;
}
@@ -251,9 +251,9 @@ static void object_select_cb(bContext *UNUSED(C), Scene *scene, TreeElement *te,
static void object_deselect_cb(bContext *UNUSED(C), Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem)
{
- Base *base= (Base *)te->directdata;
+ Base *base = (Base *)te->directdata;
- if (base==NULL) base= object_in_scene((Object *)tselem->id, scene);
+ if (base == NULL) base = BKE_scene_base_find(scene, (Object *)tselem->id);
if (base) {
base->flag &= ~SELECT;
base->object->flag &= ~SELECT;
@@ -262,18 +262,18 @@ static void object_deselect_cb(bContext *UNUSED(C), Scene *scene, TreeElement *t
static void object_delete_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem)
{
- Base *base= (Base *)te->directdata;
+ Base *base = (Base *)te->directdata;
- if (base==NULL)
- base= object_in_scene((Object *)tselem->id, scene);
+ if (base == NULL)
+ base = BKE_scene_base_find(scene, (Object *)tselem->id);
if (base) {
// check also library later
- if (scene->obedit==base->object)
- ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR|EM_DO_UNDO);
+ 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);
- te->directdata= NULL;
- tselem->id= NULL;
+ te->directdata = NULL;
+ tselem->id = NULL;
}
}
@@ -283,7 +283,7 @@ static void id_local_cb(bContext *C, Scene *UNUSED(scene), TreeElement *UNUSED(t
/* if the ID type has no special local function,
* just clear the lib */
if (id_make_local(tselem->id, FALSE) == FALSE) {
- Main *bmain= CTX_data_main(C);
+ Main *bmain = CTX_data_main(C);
id_clear_lib_data(bmain, tselem->id);
}
}
@@ -344,41 +344,41 @@ static void singleuser_world_cb(bContext *C, Scene *UNUSED(scene), TreeElement *
static void group_linkobs2scene_cb(bContext *UNUSED(C), Scene *scene, TreeElement *UNUSED(te), TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem)
{
- Group *group= (Group *)tselem->id;
+ Group *group = (Group *)tselem->id;
GroupObject *gob;
Base *base;
- for (gob=group->gobject.first; gob; gob=gob->next) {
- base= object_in_scene(gob->ob, scene);
+ for (gob = group->gobject.first; gob; gob = gob->next) {
+ base = BKE_scene_base_find(scene, gob->ob);
if (base) {
base->object->flag |= SELECT;
base->flag |= SELECT;
}
else {
/* link to scene */
- base= MEM_callocN(sizeof(Base), "add_base");
+ base = MEM_callocN(sizeof(Base), "add_base");
BLI_addhead(&scene->base, base);
- base->lay= (1<<20)-1; /*v3d->lay;*/ /* would be nice to use the 3d layer but the include's not here */
+ base->lay = (1 << 20) - 1; /*v3d->lay;*/ /* would be nice to use the 3d layer but the include's not here */
gob->ob->flag |= SELECT;
base->flag = gob->ob->flag;
- base->object= gob->ob;
+ base->object = gob->ob;
id_lib_extern((ID *)gob->ob); /* in case these are from a linked group */
}
}
}
void outliner_do_object_operation(bContext *C, Scene *scene_act, SpaceOops *soops, ListBase *lb,
- void (*operation_cb)(bContext *C, Scene *scene, TreeElement *, TreeStoreElem *, TreeStoreElem *))
+ void (*operation_cb)(bContext *C, Scene *scene, TreeElement *, TreeStoreElem *, TreeStoreElem *))
{
TreeElement *te;
TreeStoreElem *tselem;
- for (te=lb->first; te; te= te->next) {
- tselem= TREESTORE(te);
+ 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->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);
+ Scene *scene_owner = (Scene *)outliner_search_back(soops, te, ID_SCE);
if (scene_owner && scene_act != scene_owner) {
ED_screen_set_scene(C, CTX_wm_screen(C), scene_owner);
}
@@ -416,7 +416,7 @@ static void refreshdrivers_animdata_cb(int UNUSED(event), TreeElement *UNUSED(te
FCurve *fcu;
/* loop over drivers, performing refresh (i.e. check graph_buttons.c and rna_fcurve.c for details) */
- for (fcu = iat->adt->drivers.first; fcu; fcu= fcu->next) {
+ for (fcu = iat->adt->drivers.first; fcu; fcu = fcu->next) {
fcu->flag &= ~FCURVE_DISABLED;
if (fcu->driver)
@@ -428,70 +428,70 @@ static void refreshdrivers_animdata_cb(int UNUSED(event), TreeElement *UNUSED(te
static void pchan_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem))
{
- bPoseChannel *pchan= (bPoseChannel *)te->directdata;
+ 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;
}
static void bone_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem))
{
- Bone *bone= (Bone *)te->directdata;
+ 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;
}
static void ebone_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem))
{
- EditBone *ebone= (EditBone *)te->directdata;
+ 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;
+ 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);
}
}
static void outliner_do_data_operation(SpaceOops *soops, int type, int event, ListBase *lb,
- void (*operation_cb)(int, TreeElement *, TreeStoreElem *))
+ void (*operation_cb)(int, TreeElement *, TreeStoreElem *))
{
TreeElement *te;
TreeStoreElem *tselem;
- for (te=lb->first; te; te= te->next) {
- tselem= TREESTORE(te);
+ for (te = lb->first; te; te = te->next) {
+ tselem = TREESTORE(te);
if (tselem->flag & TSE_SELECTED) {
- if (tselem->type==type) {
+ if (tselem->type == type) {
operation_cb(event, te, tselem);
}
}
@@ -516,34 +516,34 @@ static EnumPropertyItem prop_object_op_types[] = {
static int outliner_object_operation_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
- SpaceOops *soops= CTX_wm_space_outliner(C);
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+ SpaceOops *soops = CTX_wm_space_outliner(C);
int event;
- const char *str= NULL;
+ const char *str = NULL;
/* check for invalid states */
if (soops == NULL)
return OPERATOR_CANCELLED;
- event= RNA_enum_get(op->ptr, "type");
+ event = RNA_enum_get(op->ptr, "type");
- if (event==1) {
- Scene *sce= scene; // to be able to delete, scenes are set...
+ 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) {
ED_screen_set_scene(C, CTX_wm_screen(C), sce);
}
- str= "Select Objects";
- WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
+ 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);
+ 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
@@ -554,31 +554,31 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op)
outliner_cleanup_tree(soops);
DAG_scene_sort(bmain, scene);
- str= "Delete Objects";
- WM_event_add_notifier(C, NC_SCENE|ND_OB_ACTIVE, scene);
+ 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";
+ 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);
+ 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);
+ 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);
+ 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";
+ str = "Rename Object";
}
ED_undo_push(C, str);
@@ -619,44 +619,44 @@ static EnumPropertyItem prop_group_op_types[] = {
static int outliner_group_operation_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
- SpaceOops *soops= CTX_wm_space_outliner(C);
+ Scene *scene = CTX_data_scene(C);
+ SpaceOops *soops = CTX_wm_space_outliner(C);
int event;
- const char *str= NULL;
+ const char *str = NULL;
/* check for invalid states */
if (soops == NULL)
return OPERATOR_CANCELLED;
- event= RNA_enum_get(op->ptr, "type");
+ 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";
+ 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";
+ 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";
+ 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";
+ 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";
+ 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";
+ 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";
+ str = "Rename";
}
@@ -711,9 +711,9 @@ static EnumPropertyItem prop_id_op_types[] = {
static int outliner_id_operation_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
- SpaceOops *soops= CTX_wm_space_outliner(C);
- int scenelevel=0, objectlevel=0, idlevel=0, datalevel=0;
+ Scene *scene = CTX_data_scene(C);
+ SpaceOops *soops = CTX_wm_space_outliner(C);
+ int scenelevel = 0, objectlevel = 0, idlevel = 0, datalevel = 0;
eOutlinerIdOpTypes event;
/* check for invalid states */
@@ -722,7 +722,7 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
set_operation_types(soops, &soops->tree, &scenelevel, &objectlevel, &idlevel, &datalevel);
- event= RNA_enum_get(op->ptr, "type");
+ event = RNA_enum_get(op->ptr, "type");
switch (event) {
case OUTLINER_IDOP_UNLINK:
@@ -732,25 +732,25 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
case ID_AC:
outliner_do_libdata_operation(C, scene, soops, &soops->tree, unlink_action_cb);
- WM_event_add_notifier(C, NC_ANIMATION|ND_NLA_ACTCHANGE, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, NULL);
ED_undo_push(C, "Unlink action");
break;
case ID_MA:
outliner_do_libdata_operation(C, scene, soops, &soops->tree, unlink_material_cb);
- WM_event_add_notifier(C, NC_OBJECT|ND_OB_SHADING, NULL);
+ WM_event_add_notifier(C, NC_OBJECT | ND_OB_SHADING, NULL);
ED_undo_push(C, "Unlink material");
break;
case ID_TE:
outliner_do_libdata_operation(C, scene, soops, &soops->tree, unlink_texture_cb);
- WM_event_add_notifier(C, NC_OBJECT|ND_OB_SHADING, NULL);
+ WM_event_add_notifier(C, NC_OBJECT | ND_OB_SHADING, NULL);
ED_undo_push(C, "Unlink texture");
break;
case ID_WO:
outliner_do_libdata_operation(C, scene, soops, &soops->tree, unlink_world_cb);
- WM_event_add_notifier(C, NC_SCENE|ND_WORLD, NULL);
+ WM_event_add_notifier(C, NC_SCENE | ND_WORLD, NULL);
ED_undo_push(C, "Unlink world");
break;
default:
@@ -758,7 +758,7 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
break;
}
}
- break;
+ break;
case OUTLINER_IDOP_LOCAL:
{
@@ -766,7 +766,7 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
outliner_do_libdata_operation(C, scene, soops, &soops->tree, id_local_cb);
ED_undo_push(C, "Localized Data");
}
- break;
+ break;
case OUTLINER_IDOP_SINGLE:
{
@@ -775,14 +775,14 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
case ID_AC:
outliner_do_libdata_operation(C, scene, soops, &soops->tree, singleuser_action_cb);
- WM_event_add_notifier(C, NC_ANIMATION|ND_NLA_ACTCHANGE, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, NULL);
ED_undo_push(C, "Single-User Action");
break;
case ID_WO:
outliner_do_libdata_operation(C, scene, soops, &soops->tree, singleuser_world_cb);
- WM_event_add_notifier(C, NC_SCENE|ND_WORLD, NULL);
+ WM_event_add_notifier(C, NC_SCENE | ND_WORLD, NULL);
ED_undo_push(C, "Single-User World");
break;
@@ -791,36 +791,36 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
break;
}
}
- break;
+ break;
case OUTLINER_IDOP_FAKE_ADD:
{
/* set fake user */
outliner_do_libdata_operation(C, scene, soops, &soops->tree, id_fake_user_set_cb);
- WM_event_add_notifier(C, NC_ID|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_ID | NA_EDITED, NULL);
ED_undo_push(C, "Add Fake User");
}
- break;
+ break;
case OUTLINER_IDOP_FAKE_CLEAR:
{
/* clear fake user */
outliner_do_libdata_operation(C, scene, soops, &soops->tree, id_fake_user_clear_cb);
- WM_event_add_notifier(C, NC_ID|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_ID | NA_EDITED, NULL);
ED_undo_push(C, "Clear Fake User");
}
- break;
+ break;
case OUTLINER_IDOP_RENAME:
{
/* rename */
outliner_do_libdata_operation(C, scene, soops, &soops->tree, item_rename_cb);
- WM_event_add_notifier(C, NC_ID|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_ID | NA_EDITED, NULL);
ED_undo_push(C, "Rename");
}
- break;
+ break;
default:
// invalid - unhandled
@@ -828,10 +828,10 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
}
/* wrong notifier still... */
- WM_event_add_notifier(C, NC_ID|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_ID | NA_EDITED, NULL);
// XXX: this is just so that outliner is always up to date
- WM_event_add_notifier(C, NC_SPACE|ND_SPACE_OUTLINER, NULL);
+ WM_event_add_notifier(C, NC_SPACE | ND_SPACE_OUTLINER, NULL);
return OPERATOR_FINISHED;
}
@@ -857,15 +857,15 @@ void OUTLINER_OT_id_operation(wmOperatorType *ot)
/* **************************************** */
static void outliner_do_id_set_operation(SpaceOops *soops, int type, ListBase *lb, ID *newid,
- void (*operation_cb)(TreeElement *, TreeStoreElem *, TreeStoreElem *, ID *))
+ void (*operation_cb)(TreeElement *, TreeStoreElem *, TreeStoreElem *, ID *))
{
TreeElement *te;
TreeStoreElem *tselem;
- for (te=lb->first; te; te= te->next) {
- tselem= TREESTORE(te);
+ 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);
}
@@ -898,8 +898,8 @@ static void actionset_id_cb(TreeElement *UNUSED(te), TreeStoreElem *tselem, Tree
static int outliner_action_set_exec(bContext *C, wmOperator *op)
{
- SpaceOops *soops= CTX_wm_space_outliner(C);
- int scenelevel=0, objectlevel=0, idlevel=0, datalevel=0;
+ SpaceOops *soops = CTX_wm_space_outliner(C);
+ int scenelevel = 0, objectlevel = 0, idlevel = 0, datalevel = 0;
bAction *act;
@@ -909,7 +909,7 @@ static int outliner_action_set_exec(bContext *C, wmOperator *op)
set_operation_types(soops, &soops->tree, &scenelevel, &objectlevel, &idlevel, &datalevel);
/* get action to use */
- act= BLI_findlink(&CTX_data_main(C)->action, RNA_enum_get(op->ptr, "action"));
+ act = BLI_findlink(&CTX_data_main(C)->action, RNA_enum_get(op->ptr, "action"));
if (act == NULL) {
BKE_report(op->reports, RPT_ERROR, "No valid Action to add");
@@ -918,20 +918,20 @@ static int outliner_action_set_exec(bContext *C, wmOperator *op)
else if (act->idroot == 0) {
/* hopefully in this case (i.e. library of userless actions), the user knows what they're doing... */
BKE_reportf(op->reports, RPT_WARNING,
- "Action '%s' does not specify what datablocks it can be used on. Try setting the 'ID Root Type' setting from the Datablocks Editor for this Action to avoid future problems",
- act->id.name+2);
+ "Action '%s' does not specify what datablocks it can be used on. Try setting the 'ID Root Type' setting from the Datablocks Editor for this Action to avoid future problems",
+ act->id.name + 2);
}
/* perform action if valid channel */
if (datalevel == TSE_ANIM_DATA)
- outliner_do_id_set_operation(soops, datalevel, &soops->tree, (ID*)act, actionset_id_cb);
+ outliner_do_id_set_operation(soops, datalevel, &soops->tree, (ID *)act, actionset_id_cb);
else if (idlevel == ID_AC)
- outliner_do_id_set_operation(soops, idlevel, &soops->tree, (ID*)act, actionset_id_cb);
+ outliner_do_id_set_operation(soops, idlevel, &soops->tree, (ID *)act, actionset_id_cb);
else
return OPERATOR_CANCELLED;
/* set notifier that things have changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_NLA_ACTCHANGE, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, NULL);
ED_undo_push(C, "Set action");
/* done */
@@ -956,8 +956,8 @@ void OUTLINER_OT_action_set(wmOperatorType *ot)
ot->flag = 0;
/* props */
- // TODO: this would be nicer as an ID-pointer...
- prop= RNA_def_enum(ot->srna, "action", DummyRNA_NULL_items, 0, "Action", "");
+ // TODO: this would be nicer as an ID-pointer...
+ prop = RNA_def_enum(ot->srna, "action", DummyRNA_NULL_items, 0, "Action", "");
RNA_def_enum_funcs(prop, RNA_action_itemf);
ot->prop = prop;
}
@@ -989,8 +989,8 @@ static EnumPropertyItem prop_animdata_op_types[] = {
static int outliner_animdata_operation_exec(bContext *C, wmOperator *op)
{
- SpaceOops *soops= CTX_wm_space_outliner(C);
- int scenelevel=0, objectlevel=0, idlevel=0, datalevel=0;
+ SpaceOops *soops = CTX_wm_space_outliner(C);
+ int scenelevel = 0, objectlevel = 0, idlevel = 0, datalevel = 0;
eOutliner_AnimDataOps event;
short updateDeps = 0;
@@ -998,7 +998,7 @@ static int outliner_animdata_operation_exec(bContext *C, wmOperator *op)
if (soops == NULL)
return OPERATOR_CANCELLED;
- event= RNA_enum_get(op->ptr, "type");
+ event = RNA_enum_get(op->ptr, "type");
set_operation_types(soops, &soops->tree, &scenelevel, &objectlevel, &idlevel, &datalevel);
if (datalevel != TSE_ANIM_DATA)
@@ -1015,14 +1015,14 @@ static int outliner_animdata_operation_exec(bContext *C, wmOperator *op)
/* clear active action - using standard rules */
outliner_do_data_operation(soops, datalevel, event, &soops->tree, unlinkact_animdata_cb);
- WM_event_add_notifier(C, NC_ANIMATION|ND_NLA_ACTCHANGE, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, NULL);
ED_undo_push(C, "Unlink action");
break;
case OUTLINER_ANIMOP_REFRESH_DRV:
outliner_do_data_operation(soops, datalevel, event, &soops->tree, refreshdrivers_animdata_cb);
- WM_event_add_notifier(C, NC_ANIMATION|ND_ANIMCHAN, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN, NULL);
//ED_undo_push(C, "Refresh Drivers"); /* no undo needed - shouldn't have any impact? */
updateDeps = 1;
break;
@@ -1030,7 +1030,7 @@ static int outliner_animdata_operation_exec(bContext *C, wmOperator *op)
case OUTLINER_ANIMOP_CLEAR_DRV:
outliner_do_data_operation(soops, datalevel, event, &soops->tree, cleardrivers_animdata_cb);
- WM_event_add_notifier(C, NC_ANIMATION|ND_ANIMCHAN, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN, NULL);
ED_undo_push(C, "Clear Drivers");
updateDeps = 1;
break;
@@ -1084,40 +1084,40 @@ static EnumPropertyItem prop_data_op_types[] = {
static int outliner_data_operation_exec(bContext *C, wmOperator *op)
{
- SpaceOops *soops= CTX_wm_space_outliner(C);
- int scenelevel=0, objectlevel=0, idlevel=0, datalevel=0;
+ SpaceOops *soops = CTX_wm_space_outliner(C);
+ int scenelevel = 0, objectlevel = 0, idlevel = 0, datalevel = 0;
int event;
/* check for invalid states */
if (soops == NULL)
return OPERATOR_CANCELLED;
- event= RNA_enum_get(op->ptr, "type");
+ 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);
+ 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);
+ 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);
+ 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);
}
}
@@ -1151,14 +1151,14 @@ 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) {
- int scenelevel=0, objectlevel=0, idlevel=0, datalevel=0;
- TreeStoreElem *tselem= TREESTORE(te);
+ if (mval[1] > te->ys && mval[1] < te->ys + UI_UNIT_Y) {
+ int scenelevel = 0, objectlevel = 0, idlevel = 0, datalevel = 0;
+ TreeStoreElem *tselem = TREESTORE(te);
/* select object that's clicked on and popup context menu */
if (!(tselem->flag & TSE_SELECTED)) {
- if ( outliner_has_one_flag(soops, &soops->tree, TSE_SELECTED, 1) )
+ if (outliner_has_one_flag(soops, &soops->tree, TSE_SELECTED, 1) )
outliner_set_flag(soops, &soops->tree, TSE_SELECTED, 0);
tselem->flag |= TSE_SELECTED;
@@ -1177,16 +1177,16 @@ static int do_outliner_operation_event(bContext *C, Scene *scene, ARegion *ar, S
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");
+ if (idlevel == -1 || datalevel) BKE_report(reports, RPT_WARNING, "Mixed selection");
else {
- if (idlevel==ID_GR)
+ if (idlevel == ID_GR)
WM_operator_name_call(C, "OUTLINER_OT_group_operation", WM_OP_INVOKE_REGION_WIN, NULL);
else
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");
+ 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);
@@ -1202,7 +1202,7 @@ static int do_outliner_operation_event(bContext *C, Scene *scene, ARegion *ar, S
return 1;
}
- for (te= te->subtree.first; te; te= te->next) {
+ for (te = te->subtree.first; te; te = te->next) {
if (do_outliner_operation_event(C, scene, ar, soops, te, event, mval))
return 1;
}
@@ -1212,15 +1212,15 @@ static int do_outliner_operation_event(bContext *C, Scene *scene, ARegion *ar, S
static int outliner_operation(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
{
- Scene *scene= CTX_data_scene(C);
- ARegion *ar= CTX_wm_region(C);
- SpaceOops *soops= CTX_wm_space_outliner(C);
+ Scene *scene = CTX_data_scene(C);
+ ARegion *ar = CTX_wm_region(C);
+ SpaceOops *soops = CTX_wm_space_outliner(C);
TreeElement *te;
float fmval[2];
- UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], fmval, fmval+1);
+ 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) {
+ for (te = soops->tree.first; te; te = te->next) {
if (do_outliner_operation_event(C, scene, ar, soops, te, event, fmval)) break;
}