diff options
Diffstat (limited to 'source/blender/editors/space_buttons')
5 files changed, 247 insertions, 246 deletions
diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index 440c3c66a4b..b698ec03668 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -70,10 +70,10 @@ static int set_pointer_type(ButsContextPath *path, bContextDataResult *result, S PointerRNA *ptr; int a; - for(a=0; a<path->len; a++) { + for (a=0; a<path->len; a++) { ptr= &path->ptr[a]; - if(RNA_struct_is_a(ptr->type, type)) { + if (RNA_struct_is_a(ptr->type, type)) { CTX_data_pointer_set(result, ptr->id.data, ptr->type, ptr->data); return 1; } @@ -87,10 +87,10 @@ static PointerRNA *get_pointer_type(ButsContextPath *path, StructRNA *type) PointerRNA *ptr; int a; - for(a=0; a<path->len; a++) { + for (a=0; a<path->len; a++) { ptr= &path->ptr[a]; - if(RNA_struct_is_a(ptr->type, type)) + if (RNA_struct_is_a(ptr->type, type)) return ptr; } @@ -116,15 +116,15 @@ static int buttons_context_path_world(ButsContextPath *path) PointerRNA *ptr= &path->ptr[path->len-1]; /* if we already have a (pinned) world, we're done */ - if(RNA_struct_is_a(ptr->type, &RNA_World)) { + if (RNA_struct_is_a(ptr->type, &RNA_World)) { return 1; } /* if we have a scene, use the scene's world */ - else if(buttons_context_path_scene(path)) { + else if (buttons_context_path_scene(path)) { scene= path->ptr[path->len-1].data; world= scene->world; - if(world) { + if (world) { RNA_id_pointer_create(&scene->world->id, &path->ptr[path->len]); path->len++; return 1; @@ -146,15 +146,15 @@ static int buttons_context_path_object(ButsContextPath *path) PointerRNA *ptr= &path->ptr[path->len-1]; /* if we already have a (pinned) object, we're done */ - if(RNA_struct_is_a(ptr->type, &RNA_Object)) { + if (RNA_struct_is_a(ptr->type, &RNA_Object)) { return 1; } /* if we have a scene, use the scene's active object */ - else if(buttons_context_path_scene(path)) { + else if (buttons_context_path_scene(path)) { scene= path->ptr[path->len-1].data; ob= (scene->basact)? scene->basact->object: NULL; - if(ob) { + if (ob) { RNA_id_pointer_create(&ob->id, &path->ptr[path->len]); path->len++; @@ -172,19 +172,19 @@ static int buttons_context_path_data(ButsContextPath *path, int type) PointerRNA *ptr= &path->ptr[path->len-1]; /* if we already have a data, we're done */ - if(RNA_struct_is_a(ptr->type, &RNA_Mesh) && (type == -1 || type == OB_MESH)) return 1; - else if(RNA_struct_is_a(ptr->type, &RNA_Curve) && (type == -1 || ELEM3(type, OB_CURVE, OB_SURF, OB_FONT))) return 1; - else if(RNA_struct_is_a(ptr->type, &RNA_Armature) && (type == -1 || type == OB_ARMATURE)) return 1; - else if(RNA_struct_is_a(ptr->type, &RNA_MetaBall) && (type == -1 || type == OB_MBALL)) return 1; - else if(RNA_struct_is_a(ptr->type, &RNA_Lattice) && (type == -1 || type == OB_LATTICE)) return 1; - else if(RNA_struct_is_a(ptr->type, &RNA_Camera) && (type == -1 || type == OB_CAMERA)) return 1; - else if(RNA_struct_is_a(ptr->type, &RNA_Lamp) && (type == -1 || type == OB_LAMP)) return 1; - else if(RNA_struct_is_a(ptr->type, &RNA_Speaker) && (type == -1 || type == OB_SPEAKER)) return 1; + if (RNA_struct_is_a(ptr->type, &RNA_Mesh) && (type == -1 || type == OB_MESH)) return 1; + else if (RNA_struct_is_a(ptr->type, &RNA_Curve) && (type == -1 || ELEM3(type, OB_CURVE, OB_SURF, OB_FONT))) return 1; + else if (RNA_struct_is_a(ptr->type, &RNA_Armature) && (type == -1 || type == OB_ARMATURE)) return 1; + else if (RNA_struct_is_a(ptr->type, &RNA_MetaBall) && (type == -1 || type == OB_MBALL)) return 1; + else if (RNA_struct_is_a(ptr->type, &RNA_Lattice) && (type == -1 || type == OB_LATTICE)) return 1; + else if (RNA_struct_is_a(ptr->type, &RNA_Camera) && (type == -1 || type == OB_CAMERA)) return 1; + else if (RNA_struct_is_a(ptr->type, &RNA_Lamp) && (type == -1 || type == OB_LAMP)) return 1; + else if (RNA_struct_is_a(ptr->type, &RNA_Speaker) && (type == -1 || type == OB_SPEAKER)) return 1; /* try to get an object in the path, no pinning supported here */ - else if(buttons_context_path_object(path)) { + else if (buttons_context_path_object(path)) { ob= path->ptr[path->len-1].data; - if(ob && (type == -1 || type == ob->type)) { + if (ob && (type == -1 || type == ob->type)) { RNA_id_pointer_create(ob->data, &path->ptr[path->len]); path->len++; @@ -200,10 +200,10 @@ static int buttons_context_path_modifier(ButsContextPath *path) { Object *ob; - if(buttons_context_path_object(path)) { + if (buttons_context_path_object(path)) { ob= path->ptr[path->len-1].data; - if(ob && ELEM5(ob->type, OB_MESH, OB_CURVE, OB_FONT, OB_SURF, OB_LATTICE)) + if (ob && ELEM5(ob->type, OB_MESH, OB_CURVE, OB_FONT, OB_SURF, OB_LATTICE)) return 1; } @@ -217,23 +217,23 @@ static int buttons_context_path_material(ButsContextPath *path, int for_texture) Material *ma; /* if we already have a (pinned) material, we're done */ - if(RNA_struct_is_a(ptr->type, &RNA_Material)) { + if (RNA_struct_is_a(ptr->type, &RNA_Material)) { return 1; } /* if we have an object, use the object material slot */ - else if(buttons_context_path_object(path)) { + else if (buttons_context_path_object(path)) { ob= path->ptr[path->len-1].data; - if(ob && OB_TYPE_SUPPORT_MATERIAL(ob->type)) { + if (ob && OB_TYPE_SUPPORT_MATERIAL(ob->type)) { ma= give_current_material(ob, ob->actcol); RNA_id_pointer_create(&ma->id, &path->ptr[path->len]); path->len++; - if(for_texture && give_current_material_texture_node(ma)) + if (for_texture && give_current_material_texture_node(ma)) return 1; ma= give_node_material(ma); - if(ma) { + if (ma) { RNA_id_pointer_create(&ma->id, &path->ptr[path->len]); path->len++; } @@ -251,11 +251,11 @@ static int buttons_context_path_bone(ButsContextPath *path) EditBone *edbo; /* if we have an armature, get the active bone */ - if(buttons_context_path_data(path, OB_ARMATURE)) { + if (buttons_context_path_data(path, OB_ARMATURE)) { arm= path->ptr[path->len-1].data; - if(arm->edbo) { - if(arm->act_edbone) { + if (arm->edbo) { + if (arm->act_edbone) { edbo= arm->act_edbone; RNA_pointer_create(&arm->id, &RNA_EditBone, edbo, &path->ptr[path->len]); path->len++; @@ -263,7 +263,7 @@ static int buttons_context_path_bone(ButsContextPath *path) } } else { - if(arm->act_bone) { + if (arm->act_bone) { RNA_pointer_create(&arm->id, &RNA_Bone, arm->act_bone, &path->ptr[path->len]); path->len++; return 1; @@ -280,22 +280,22 @@ static int buttons_context_path_pose_bone(ButsContextPath *path) PointerRNA *ptr= &path->ptr[path->len-1]; /* if we already have a (pinned) PoseBone, we're done */ - if(RNA_struct_is_a(ptr->type, &RNA_PoseBone)) { + if (RNA_struct_is_a(ptr->type, &RNA_PoseBone)) { return 1; } /* if we have an armature, get the active bone */ - if(buttons_context_path_object(path)) { + if (buttons_context_path_object(path)) { Object *ob= path->ptr[path->len-1].data; bArmature *arm= ob->data; /* path->ptr[path->len-1].data - works too */ - if(ob->type != OB_ARMATURE || arm->edbo) { + if (ob->type != OB_ARMATURE || arm->edbo) { return 0; } else { - if(arm->act_bone) { + if (arm->act_bone) { bPoseChannel *pchan= get_pose_channel(ob->pose, arm->act_bone->name); - if(pchan) { + if (pchan) { RNA_pointer_create(&ob->id, &RNA_PoseBone, pchan, &path->ptr[path->len]); path->len++; return 1; @@ -316,14 +316,14 @@ static int buttons_context_path_particle(ButsContextPath *path) PointerRNA *ptr= &path->ptr[path->len-1]; /* if we already have (pinned) particle settings, we're done */ - if(RNA_struct_is_a(ptr->type, &RNA_ParticleSettings)) { + if (RNA_struct_is_a(ptr->type, &RNA_ParticleSettings)) { return 1; } /* if we have an object, get the active particle system */ - if(buttons_context_path_object(path)) { + if (buttons_context_path_object(path)) { ob= path->ptr[path->len-1].data; - if(ob && ob->type == OB_MESH) { + if (ob && ob->type == OB_MESH) { psys= psys_get_current(ob); RNA_pointer_create(&ob->id, &RNA_ParticleSystem, psys, &path->ptr[path->len]); @@ -343,17 +343,17 @@ static int buttons_context_path_brush(ButsContextPath *path) PointerRNA *ptr= &path->ptr[path->len-1]; /* if we already have a (pinned) brush, we're done */ - if(RNA_struct_is_a(ptr->type, &RNA_Brush)) { + if (RNA_struct_is_a(ptr->type, &RNA_Brush)) { return 1; } /* if we have a scene, use the toolsettings brushes */ - else if(buttons_context_path_scene(path)) { + else if (buttons_context_path_scene(path)) { scene= path->ptr[path->len-1].data; - if(scene) + if (scene) br= paint_brush(paint_get_active(scene)); - if(br) { + if (br) { RNA_id_pointer_create((ID *)br, &path->ptr[path->len]); path->len++; @@ -367,36 +367,36 @@ static int buttons_context_path_brush(ButsContextPath *path) static int buttons_context_path_texture(ButsContextPath *path, ButsContextTexture *ct) { - if(ct) { + if (ct) { /* new shading system */ PointerRNA *ptr= &path->ptr[path->len-1]; ID *id; /* if we already have a (pinned) texture, we're done */ - if(RNA_struct_is_a(ptr->type, &RNA_Texture)) + if (RNA_struct_is_a(ptr->type, &RNA_Texture)) return 1; - if(!ct->user) + if (!ct->user) return 0; id= ct->user->id; - if(id) { - if(GS(id->name) == ID_BR) + if (id) { + if (GS(id->name) == ID_BR) buttons_context_path_brush(path); - else if(GS(id->name) == ID_MA) + else if (GS(id->name) == ID_MA) buttons_context_path_material(path, 0); - else if(GS(id->name) == ID_WO) + else if (GS(id->name) == ID_WO) buttons_context_path_world(path); - else if(GS(id->name) == ID_LA) + else if (GS(id->name) == ID_LA) buttons_context_path_data(path, OB_LAMP); - else if(GS(id->name) == ID_PA) + else if (GS(id->name) == ID_PA) buttons_context_path_particle(path); - else if(GS(id->name) == ID_OB) + else if (GS(id->name) == ID_OB) buttons_context_path_object(path); } - if(ct->texture) { + if (ct->texture) { RNA_id_pointer_create(&ct->texture->id, &path->ptr[path->len]); path->len++; } @@ -415,14 +415,14 @@ static int buttons_context_path_texture(ButsContextPath *path, ButsContextTextur int orig_len = path->len; /* if we already have a (pinned) texture, we're done */ - if(RNA_struct_is_a(ptr->type, &RNA_Texture)) { + if (RNA_struct_is_a(ptr->type, &RNA_Texture)) { return 1; } /* try brush */ - if((path->tex_ctx == SB_TEXC_BRUSH) && buttons_context_path_brush(path)) { + if ((path->tex_ctx == SB_TEXC_BRUSH) && buttons_context_path_brush(path)) { br= path->ptr[path->len-1].data; - if(br) { + if (br) { tex= give_current_brush_texture(br); RNA_id_pointer_create(&tex->id, &path->ptr[path->len]); @@ -431,10 +431,10 @@ static int buttons_context_path_texture(ButsContextPath *path, ButsContextTextur } } /* try world */ - if((path->tex_ctx == SB_TEXC_WORLD) && buttons_context_path_world(path)) { + if ((path->tex_ctx == SB_TEXC_WORLD) && buttons_context_path_world(path)) { wo= path->ptr[path->len-1].data; - if(wo && GS(wo->id.name)==ID_WO) { + if (wo && GS(wo->id.name)==ID_WO) { tex= give_current_world_texture(wo); RNA_id_pointer_create(&tex->id, &path->ptr[path->len]); @@ -443,8 +443,8 @@ static int buttons_context_path_texture(ButsContextPath *path, ButsContextTextur } } /* try particles */ - if((path->tex_ctx == SB_TEXC_PARTICLES) && buttons_context_path_particle(path)) { - if(path->ptr[path->len-1].type == &RNA_ParticleSettings) { + if ((path->tex_ctx == SB_TEXC_PARTICLES) && buttons_context_path_particle(path)) { + if (path->ptr[path->len-1].type == &RNA_ParticleSettings) { ParticleSettings *part = path->ptr[path->len-1].data; tex= give_current_particle_texture(part); @@ -455,7 +455,7 @@ static int buttons_context_path_texture(ButsContextPath *path, ButsContextTextur else { psys= path->ptr[path->len-1].data; - if(psys && psys->part && GS(psys->part->id.name)==ID_PA) { + if (psys && psys->part && GS(psys->part->id.name)==ID_PA) { tex= give_current_particle_texture(psys->part); RNA_id_pointer_create(&tex->id, &path->ptr[path->len]); @@ -465,10 +465,10 @@ static int buttons_context_path_texture(ButsContextPath *path, ButsContextTextur } } /* try material */ - if(buttons_context_path_material(path, 1)) { + if (buttons_context_path_material(path, 1)) { ma= path->ptr[path->len-1].data; - if(ma) { + if (ma) { tex= give_current_material_texture(ma); RNA_id_pointer_create(&tex->id, &path->ptr[path->len]); @@ -477,10 +477,10 @@ static int buttons_context_path_texture(ButsContextPath *path, ButsContextTextur } } /* try lamp */ - if(buttons_context_path_data(path, OB_LAMP)) { + if (buttons_context_path_data(path, OB_LAMP)) { la= path->ptr[path->len-1].data; - if(la) { + if (la) { tex= give_current_lamp_texture(la); RNA_id_pointer_create(&tex->id, &path->ptr[path->len]); @@ -490,10 +490,10 @@ static int buttons_context_path_texture(ButsContextPath *path, ButsContextTextur } /* try brushes again in case of no material, lamp, etc */ path->len = orig_len; - if(buttons_context_path_brush(path)) { + if (buttons_context_path_brush(path)) { br= path->ptr[path->len-1].data; - if(br) { + if (br) { tex= give_current_brush_texture(br); RNA_id_pointer_create(&tex->id, &path->ptr[path->len]); @@ -519,7 +519,7 @@ static int buttons_context_path(const bContext *C, ButsContextPath *path, int ma path->tex_ctx = sbuts->texture_context; /* if some ID datablock is pinned, set the root pointer */ - if(sbuts->pinid) { + if (sbuts->pinid) { id= sbuts->pinid; RNA_id_pointer_create(id, &path->ptr[0]); @@ -527,7 +527,7 @@ static int buttons_context_path(const bContext *C, ButsContextPath *path, int ma } /* no pinned root, use scene as root */ - if(path->len == 0) { + if (path->len == 0) { id= (ID*)CTX_data_scene(C); RNA_id_pointer_create(id, &path->ptr[0]); path->len++; @@ -565,7 +565,7 @@ static int buttons_context_path(const bContext *C, ButsContextPath *path, int ma break; case BCONTEXT_BONE: found= buttons_context_path_bone(path); - if(!found) + if (!found) found= buttons_context_path_data(path, OB_ARMATURE); break; case BCONTEXT_BONE_CONSTRAINT: @@ -583,9 +583,9 @@ static int buttons_shading_context(const bContext *C, int mainb) { Object *ob= CTX_data_active_object(C); - if(ELEM3(mainb, BCONTEXT_MATERIAL, BCONTEXT_WORLD, BCONTEXT_TEXTURE)) + if (ELEM3(mainb, BCONTEXT_MATERIAL, BCONTEXT_WORLD, BCONTEXT_TEXTURE)) return 1; - if(mainb == BCONTEXT_DATA && ob && ELEM(ob->type, OB_LAMP, OB_CAMERA)) + if (mainb == BCONTEXT_DATA && ob && ELEM(ob->type, OB_LAMP, OB_CAMERA)) return 1; return 0; @@ -595,11 +595,11 @@ static int buttons_shading_new_context(const bContext *C, int flag) { Object *ob= CTX_data_active_object(C); - if(flag & (1 << BCONTEXT_MATERIAL)) + if (flag & (1 << BCONTEXT_MATERIAL)) return BCONTEXT_MATERIAL; - else if(ob && ELEM(ob->type, OB_LAMP, OB_CAMERA) && (flag & (1 << BCONTEXT_DATA))) + else if (ob && ELEM(ob->type, OB_LAMP, OB_CAMERA) && (flag & (1 << BCONTEXT_DATA))) return BCONTEXT_DATA; - else if(flag & (1 << BCONTEXT_WORLD)) + else if (flag & (1 << BCONTEXT_WORLD)) return BCONTEXT_WORLD; return BCONTEXT_RENDER; @@ -613,22 +613,22 @@ void buttons_context_compute(const bContext *C, SpaceButs *sbuts) buttons_texture_context_compute(C, sbuts); - if(!sbuts->path) + if (!sbuts->path) sbuts->path= MEM_callocN(sizeof(ButsContextPath), "ButsContextPath"); path= sbuts->path; /* for each context, see if we can compute a valid path to it, if * this is the case, we know we have to display the button */ - for(a=0; a<BCONTEXT_TOT; a++) { - if(buttons_context_path(C, path, a, pflag)) { + for (a=0; a<BCONTEXT_TOT; a++) { + if (buttons_context_path(C, path, a, pflag)) { flag |= (1<<a); /* setting icon for data context */ - if(a == BCONTEXT_DATA) { + if (a == BCONTEXT_DATA) { ptr= &path->ptr[path->len-1]; - if(ptr->type) + if (ptr->type) sbuts->dataicon= RNA_struct_ui_icon(ptr->type); else sbuts->dataicon= ICON_EMPTY_DATA; @@ -642,17 +642,17 @@ void buttons_context_compute(const bContext *C, SpaceButs *sbuts) sbuts->mainb= sbuts->mainbuser; /* in case something becomes invalid, change */ - if((flag & (1 << sbuts->mainb)) == 0) { - if(sbuts->flag & SB_SHADING_CONTEXT) { + if ((flag & (1 << sbuts->mainb)) == 0) { + if (sbuts->flag & SB_SHADING_CONTEXT) { /* try to keep showing shading related buttons */ sbuts->mainb= buttons_shading_new_context(C, flag); } - else if(flag & BCONTEXT_OBJECT) { + else if (flag & BCONTEXT_OBJECT) { sbuts->mainb= BCONTEXT_OBJECT; } else { - for(a=0; a<BCONTEXT_TOT; a++) { - if(flag & (1 << a)) { + for (a=0; a<BCONTEXT_TOT; a++) { + if (flag & (1 << a)) { sbuts->mainb= a; break; } @@ -662,14 +662,14 @@ void buttons_context_compute(const bContext *C, SpaceButs *sbuts) buttons_context_path(C, path, sbuts->mainb, pflag); - if(!(flag & (1 << sbuts->mainb))) { - if(flag & (1 << BCONTEXT_OBJECT)) + if (!(flag & (1 << sbuts->mainb))) { + if (flag & (1 << BCONTEXT_OBJECT)) sbuts->mainb= BCONTEXT_OBJECT; else sbuts->mainb= BCONTEXT_SCENE; } - if(buttons_shading_context(C, sbuts->mainb)) + if (buttons_shading_context(C, sbuts->mainb)) sbuts->flag |= SB_SHADING_CONTEXT; else sbuts->flag &= ~SB_SHADING_CONTEXT; @@ -691,62 +691,62 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r SpaceButs *sbuts= CTX_wm_space_buts(C); ButsContextPath *path= sbuts?sbuts->path:NULL; - if(!path) + if (!path) return 0; /* here we handle context, getting data from precomputed path */ - if(CTX_data_dir(member)) { + if (CTX_data_dir(member)) { CTX_data_dir_set(result, buttons_context_dir); return 1; } - else if(CTX_data_equals(member, "world")) { + else if (CTX_data_equals(member, "world")) { set_pointer_type(path, result, &RNA_World); return 1; } - else if(CTX_data_equals(member, "object")) { + else if (CTX_data_equals(member, "object")) { set_pointer_type(path, result, &RNA_Object); return 1; } - else if(CTX_data_equals(member, "mesh")) { + else if (CTX_data_equals(member, "mesh")) { set_pointer_type(path, result, &RNA_Mesh); return 1; } - else if(CTX_data_equals(member, "armature")) { + else if (CTX_data_equals(member, "armature")) { set_pointer_type(path, result, &RNA_Armature); return 1; } - else if(CTX_data_equals(member, "lattice")) { + else if (CTX_data_equals(member, "lattice")) { set_pointer_type(path, result, &RNA_Lattice); return 1; } - else if(CTX_data_equals(member, "curve")) { + else if (CTX_data_equals(member, "curve")) { set_pointer_type(path, result, &RNA_Curve); return 1; } - else if(CTX_data_equals(member, "meta_ball")) { + else if (CTX_data_equals(member, "meta_ball")) { set_pointer_type(path, result, &RNA_MetaBall); return 1; } - else if(CTX_data_equals(member, "lamp")) { + else if (CTX_data_equals(member, "lamp")) { set_pointer_type(path, result, &RNA_Lamp); return 1; } - else if(CTX_data_equals(member, "camera")) { + else if (CTX_data_equals(member, "camera")) { set_pointer_type(path, result, &RNA_Camera); return 1; } - else if(CTX_data_equals(member, "speaker")) { + else if (CTX_data_equals(member, "speaker")) { set_pointer_type(path, result, &RNA_Speaker); return 1; } - else if(CTX_data_equals(member, "material")) { + else if (CTX_data_equals(member, "material")) { set_pointer_type(path, result, &RNA_Material); return 1; } - else if(CTX_data_equals(member, "texture")) { + else if (CTX_data_equals(member, "texture")) { ButsContextTexture *ct= sbuts->texuser; - if(ct) { + if (ct) { /* new shading system */ CTX_data_pointer_set(result, &ct->texture->id, &RNA_Texture, ct->texture); } @@ -757,41 +757,41 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r return 1; } - else if(CTX_data_equals(member, "material_slot")) { + else if (CTX_data_equals(member, "material_slot")) { PointerRNA *ptr= get_pointer_type(path, &RNA_Object); - if(ptr) { + if (ptr) { Object *ob= ptr->data; - if(ob && OB_TYPE_SUPPORT_MATERIAL(ob->type) && ob->totcol) { + if (ob && OB_TYPE_SUPPORT_MATERIAL(ob->type) && ob->totcol) { /* a valid actcol isn't ensured [#27526] */ int matnr= ob->actcol-1; - if(matnr < 0) matnr= 0; + if (matnr < 0) matnr= 0; CTX_data_pointer_set(result, &ob->id, &RNA_MaterialSlot, &ob->mat[matnr]); } } return 1; } - else if(CTX_data_equals(member, "texture_user")) { + else if (CTX_data_equals(member, "texture_user")) { ButsContextTexture *ct= sbuts->texuser; - if(!ct) + if (!ct) return -1; /* old shading system (found but not available) */ - if(ct->user && ct->user->ptr.data) { + if (ct->user && ct->user->ptr.data) { ButsTextureUser *user= ct->user; CTX_data_pointer_set(result, user->ptr.id.data, user->ptr.type, user->ptr.data); } return 1; } - else if(CTX_data_equals(member, "texture_node")) { + else if (CTX_data_equals(member, "texture_node")) { ButsContextTexture *ct= sbuts->texuser; - if(ct) { + if (ct) { /* new shading system */ - if(ct->user && ct->user->node) + if (ct->user && ct->user->node) CTX_data_pointer_set(result, &ct->user->ntree->id, &RNA_Node, ct->user->node); return 1; @@ -800,10 +800,10 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r /* old shading system */ PointerRNA *ptr; - if((ptr=get_pointer_type(path, &RNA_Material))) { + if ((ptr=get_pointer_type(path, &RNA_Material))) { Material *ma= ptr->data; - if(ma) { + if (ma) { bNode *node= give_current_material_texture_node(ma); CTX_data_pointer_set(result, &ma->nodetree->id, &RNA_Node, node); } @@ -812,18 +812,18 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r return 1; } } - else if(CTX_data_equals(member, "texture_slot")) { + else if (CTX_data_equals(member, "texture_slot")) { ButsContextTexture *ct= sbuts->texuser; PointerRNA *ptr; - if(ct) + if (ct) return 0; /* new shading system */ - if((ptr=get_pointer_type(path, &RNA_Material))) { + if ((ptr=get_pointer_type(path, &RNA_Material))) { Material *ma= ptr->data; /* if we have a node material, get slot from material in material node */ - if(ma && ma->use_nodes && ma->nodetree) { + if (ma && ma->use_nodes && ma->nodetree) { /* if there's an active texture node in the node tree, * then that texture is in context directly, without a texture slot */ if (give_current_material_texture_node(ma)) @@ -834,84 +834,85 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r CTX_data_pointer_set(result, &ma->id, &RNA_MaterialTextureSlot, ma->mtex[(int)ma->texact]); else return 0; - } else if(ma) { + } + else if (ma) { CTX_data_pointer_set(result, &ma->id, &RNA_MaterialTextureSlot, ma->mtex[(int)ma->texact]); } } - else if((ptr=get_pointer_type(path, &RNA_Lamp))) { + else if ((ptr=get_pointer_type(path, &RNA_Lamp))) { Lamp *la= ptr->data; - if(la) + if (la) CTX_data_pointer_set(result, &la->id, &RNA_LampTextureSlot, la->mtex[(int)la->texact]); } - else if((ptr=get_pointer_type(path, &RNA_World))) { + else if ((ptr=get_pointer_type(path, &RNA_World))) { World *wo= ptr->data; - if(wo) + if (wo) CTX_data_pointer_set(result, &wo->id, &RNA_WorldTextureSlot, wo->mtex[(int)wo->texact]); } - else if((ptr=get_pointer_type(path, &RNA_Brush))) { /* how to get this into context? */ + else if ((ptr=get_pointer_type(path, &RNA_Brush))) { /* how to get this into context? */ Brush *br= ptr->data; - if(br) + if (br) CTX_data_pointer_set(result, &br->id, &RNA_BrushTextureSlot, &br->mtex); } - else if((ptr=get_pointer_type(path, &RNA_ParticleSystem))) { + else if ((ptr=get_pointer_type(path, &RNA_ParticleSystem))) { ParticleSettings *part= ((ParticleSystem *)ptr->data)->part; - if(part) + if (part) CTX_data_pointer_set(result, &part->id, &RNA_ParticleSettingsTextureSlot, part->mtex[(int)part->texact]); } return 1; } - else if(CTX_data_equals(member, "bone")) { + else if (CTX_data_equals(member, "bone")) { set_pointer_type(path, result, &RNA_Bone); return 1; } - else if(CTX_data_equals(member, "edit_bone")) { + else if (CTX_data_equals(member, "edit_bone")) { set_pointer_type(path, result, &RNA_EditBone); return 1; } - else if(CTX_data_equals(member, "pose_bone")) { + else if (CTX_data_equals(member, "pose_bone")) { set_pointer_type(path, result, &RNA_PoseBone); return 1; } - else if(CTX_data_equals(member, "particle_system")) { + else if (CTX_data_equals(member, "particle_system")) { set_pointer_type(path, result, &RNA_ParticleSystem); return 1; } - else if(CTX_data_equals(member, "particle_system_editable")) { - if(PE_poll((bContext*)C)) + else if (CTX_data_equals(member, "particle_system_editable")) { + if (PE_poll((bContext*)C)) set_pointer_type(path, result, &RNA_ParticleSystem); else CTX_data_pointer_set(result, NULL, &RNA_ParticleSystem, NULL); return 1; } - else if(CTX_data_equals(member, "cloth")) { + else if (CTX_data_equals(member, "cloth")) { PointerRNA *ptr= get_pointer_type(path, &RNA_Object); - if(ptr && ptr->data) { + if (ptr && ptr->data) { Object *ob= ptr->data; ModifierData *md= modifiers_findByType(ob, eModifierType_Cloth); CTX_data_pointer_set(result, &ob->id, &RNA_ClothModifier, md); return 1; } } - else if(CTX_data_equals(member, "soft_body")) { + else if (CTX_data_equals(member, "soft_body")) { PointerRNA *ptr= get_pointer_type(path, &RNA_Object); - if(ptr && ptr->data) { + if (ptr && ptr->data) { Object *ob= ptr->data; ModifierData *md= modifiers_findByType(ob, eModifierType_Softbody); CTX_data_pointer_set(result, &ob->id, &RNA_SoftBodyModifier, md); return 1; } } - else if(CTX_data_equals(member, "fluid")) { + else if (CTX_data_equals(member, "fluid")) { PointerRNA *ptr= get_pointer_type(path, &RNA_Object); - if(ptr && ptr->data) { + if (ptr && ptr->data) { Object *ob= ptr->data; ModifierData *md= modifiers_findByType(ob, eModifierType_Fluidsim); CTX_data_pointer_set(result, &ob->id, &RNA_FluidSimulationModifier, md); @@ -919,34 +920,34 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r } } - else if(CTX_data_equals(member, "smoke")) { + else if (CTX_data_equals(member, "smoke")) { PointerRNA *ptr= get_pointer_type(path, &RNA_Object); - if(ptr && ptr->data) { + if (ptr && ptr->data) { Object *ob= ptr->data; ModifierData *md= modifiers_findByType(ob, eModifierType_Smoke); CTX_data_pointer_set(result, &ob->id, &RNA_SmokeModifier, md); return 1; } } - else if(CTX_data_equals(member, "collision")) { + else if (CTX_data_equals(member, "collision")) { PointerRNA *ptr= get_pointer_type(path, &RNA_Object); - if(ptr && ptr->data) { + if (ptr && ptr->data) { Object *ob= ptr->data; ModifierData *md= modifiers_findByType(ob, eModifierType_Collision); CTX_data_pointer_set(result, &ob->id, &RNA_CollisionModifier, md); return 1; } } - else if(CTX_data_equals(member, "brush")) { + else if (CTX_data_equals(member, "brush")) { set_pointer_type(path, result, &RNA_Brush); return 1; } - else if(CTX_data_equals(member, "dynamic_paint")) { + else if (CTX_data_equals(member, "dynamic_paint")) { PointerRNA *ptr= get_pointer_type(path, &RNA_Object); - if(ptr && ptr->data) { + if (ptr && ptr->data) { Object *ob= ptr->data; ModifierData *md= modifiers_findByType(ob, eModifierType_DynamicPaint); CTX_data_pointer_set(result, &ob->id, &RNA_DynamicPaintModifier, md); @@ -966,7 +967,7 @@ static void pin_cb(bContext *C, void *UNUSED(arg1), void *UNUSED(arg2)) { SpaceButs *sbuts= CTX_wm_space_buts(C); - if(sbuts->flag & SB_PIN_CONTEXT) { + if (sbuts->flag & SB_PIN_CONTEXT) { sbuts->pinid= buttons_context_id_path(C); } else @@ -986,7 +987,7 @@ void buttons_context_draw(const bContext *C, uiLayout *layout) char namebuf[128], *name; int a, icon; - if(!path) + if (!path) return; row= uiLayoutRow(layout, 1); @@ -998,23 +999,23 @@ void buttons_context_draw(const bContext *C, uiLayout *layout) uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */ uiButSetFunc(but, pin_cb, NULL, NULL); - for(a=0; a<path->len; a++) { + for (a=0; a<path->len; a++) { ptr= &path->ptr[a]; - if(a != 0) + if (a != 0) uiItemL(row, "", VICO_SMALL_TRI_RIGHT_VEC); - if(ptr->data) { + if (ptr->data) { icon= RNA_struct_ui_icon(ptr->type); name= RNA_struct_name_get_alloc(ptr, namebuf, sizeof(namebuf), NULL); - if(name) { - if(!ELEM(sbuts->mainb, BCONTEXT_RENDER, BCONTEXT_SCENE) && ptr->type == &RNA_Scene) + if (name) { + if (!ELEM(sbuts->mainb, BCONTEXT_RENDER, BCONTEXT_SCENE) && ptr->type == &RNA_Scene) uiItemLDrag(row, ptr, "", icon); /* save some space */ else uiItemLDrag(row, ptr, name, icon); - if(name != namebuf) + if (name != namebuf) MEM_freeN(name); } else @@ -1047,19 +1048,19 @@ ID *buttons_context_id_path(const bContext *C) PointerRNA *ptr; int a; - if(path->len) { - for(a=path->len-1; a>=0; a--) { + if (path->len) { + for (a=path->len-1; a>=0; a--) { ptr= &path->ptr[a]; /* pin particle settings instead of system, since only settings are an idblock*/ - if(sbuts->mainb == BCONTEXT_PARTICLE && sbuts->flag & SB_PIN_CONTEXT) { - if(ptr->type == &RNA_ParticleSystem && ptr->data) { + if (sbuts->mainb == BCONTEXT_PARTICLE && sbuts->flag & SB_PIN_CONTEXT) { + if (ptr->type == &RNA_ParticleSystem && ptr->data) { ParticleSystem *psys = (ParticleSystem *)ptr->data; return &psys->part->id; } } - if(ptr->id.data) { + if (ptr->id.data) { return ptr->id.data; } } diff --git a/source/blender/editors/space_buttons/buttons_header.c b/source/blender/editors/space_buttons/buttons_header.c index 52327d3b59b..fcc5b488ca9 100644 --- a/source/blender/editors/space_buttons/buttons_header.c +++ b/source/blender/editors/space_buttons/buttons_header.c @@ -63,7 +63,7 @@ static void set_texture_context(bContext *C, SpaceButs *sbuts) case BCONTEXT_DATA: { Object *ob = CTX_data_active_object(C); - if(ob && ob->type==OB_LAMP) + if (ob && ob->type==OB_LAMP) sbuts->texture_context = SB_TEXC_MAT_OR_LAMP; break; } @@ -80,7 +80,7 @@ static void do_buttons_buttons(bContext *C, void *UNUSED(arg), int event) { SpaceButs *sbuts= CTX_wm_space_buts(C); - if(!sbuts) /* editor type switch */ + if (!sbuts) /* editor type switch */ return; switch(event) { @@ -122,7 +122,7 @@ void buttons_header_buttons(const bContext *C, ARegion *ar) uiBlockBeginAlign(block); #define BUTTON_HEADER_CTX(_ctx, _icon, _tip) \ - if(sbuts->pathflag & (1<<_ctx)) { \ + if (sbuts->pathflag & (1<<_ctx)) { \ but = uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, _icon, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)_ctx, 0, 0, TIP_(_tip)); \ uiButClearFlag(but, UI_BUT_UNDO); \ } \ diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c index ebdea00fd4f..ec1c74013e0 100644 --- a/source/blender/editors/space_buttons/buttons_ops.c +++ b/source/blender/editors/space_buttons/buttons_ops.c @@ -110,7 +110,7 @@ static int file_browse_exec(bContext *C, wmOperator *op) str= RNA_string_get_alloc(op->ptr, path_prop, NULL, 0); /* add slash for directories, important for some properties */ - if(RNA_property_subtype(fbo->prop) == PROP_DIRPATH) { + if (RNA_property_subtype(fbo->prop) == PROP_DIRPATH) { char name[FILE_MAX]; id = fbo->ptr.id.data; @@ -118,7 +118,7 @@ static int file_browse_exec(bContext *C, wmOperator *op) BLI_strncpy(path, str, FILE_MAX); BLI_path_abs(path, id ? ID_BLEND_PATH(G.main, id) : G.main->name); - if(BLI_is_dir(path)) { + if (BLI_is_dir(path)) { str = MEM_reallocN(str, strlen(str)+2); BLI_add_slash(str); } @@ -134,8 +134,8 @@ static int file_browse_exec(bContext *C, wmOperator *op) /* special, annoying exception, filesel on redo panel [#26618] */ { wmOperator *redo_op= WM_operator_last_redo(C); - if(redo_op) { - if(fbo->ptr.data == redo_op->ptr->data) { + if (redo_op) { + if (fbo->ptr.data == redo_op->ptr->data) { ED_undo_operator_repeat(C, redo_op); } } @@ -168,19 +168,19 @@ static int file_browse_invoke(bContext *C, wmOperator *op, wmEvent *event) uiFileBrowseContextProperty(C, &ptr, &prop); - if(!prop) + if (!prop) return OPERATOR_CANCELLED; str= RNA_property_string_get_alloc(&ptr, prop, NULL, 0, NULL); /* useful yet irritating feature, Shift+Click to open the file * Alt+Click to browse a folder in the OS's browser */ - if(event->shift || event->alt) { + if (event->shift || event->alt) { PointerRNA props_ptr; - if(event->alt) { + if (event->alt) { char *lslash= BLI_last_slash(str); - if(lslash) + if (lslash) *lslash= '\0'; } @@ -205,8 +205,8 @@ static int file_browse_invoke(bContext *C, wmOperator *op, wmEvent *event) /* normally ED_fileselect_get_params would handle this but we need to because of stupid * user-prefs exception - campbell */ - if(RNA_struct_find_property(op->ptr, "relative_path")) { - if(!RNA_struct_property_is_set(op->ptr, "relative_path")) { + if (RNA_struct_find_property(op->ptr, "relative_path")) { + if (!RNA_struct_property_is_set(op->ptr, "relative_path")) { /* annoying exception!, if were dealign with the user prefs, default relative to be off */ RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS && (ptr.data != &U)); } diff --git a/source/blender/editors/space_buttons/buttons_texture.c b/source/blender/editors/space_buttons/buttons_texture.c index ae1f504697e..ba37cb8a892 100644 --- a/source/blender/editors/space_buttons/buttons_texture.c +++ b/source/blender/editors/space_buttons/buttons_texture.c @@ -111,9 +111,9 @@ static void buttons_texture_users_find_nodetree(ListBase *users, ID *id, { bNode *node; - if(ntree) { - for(node=ntree->nodes.first; node; node=node->next) { - if(node->typeinfo->nclass == NODE_CLASS_TEXTURE) { + if (ntree) { + for (node=ntree->nodes.first; node; node=node->next) { + if (node->typeinfo->nclass == NODE_CLASS_TEXTURE) { PointerRNA ptr; /* PropertyRNA *prop; */ /* UNUSED */ @@ -123,7 +123,7 @@ static void buttons_texture_users_find_nodetree(ListBase *users, ID *id, buttons_texture_user_node_add(users, id, ntree, node, category, RNA_struct_ui_icon(ptr.type), node->name); } - else if(node->type == NODE_GROUP && node->id) { + else if (node->type == NODE_GROUP && node->id) { buttons_texture_users_find_nodetree(users, id, (bNodeTree*)node->id, category); } } @@ -154,46 +154,46 @@ static void buttons_texture_users_from_context(ListBase *users, const bContext * ID *pinid = sbuts->pinid; /* get data from context */ - if(pinid) { - if(GS(pinid->name) == ID_SCE) + if (pinid) { + if (GS(pinid->name) == ID_SCE) scene= (Scene*)pinid; - else if(GS(pinid->name) == ID_OB) + else if (GS(pinid->name) == ID_OB) ob= (Object*)pinid; - else if(GS(pinid->name) == ID_LA) + else if (GS(pinid->name) == ID_LA) la= (Lamp*)pinid; - else if(GS(pinid->name) == ID_WO) + else if (GS(pinid->name) == ID_WO) wrld= (World*)pinid; - else if(GS(pinid->name) == ID_MA) + else if (GS(pinid->name) == ID_MA) ma= (Material*)pinid; - else if(GS(pinid->name) == ID_BR) + else if (GS(pinid->name) == ID_BR) brush= (Brush*)pinid; } - if(!scene) + if (!scene) scene= CTX_data_scene(C); - if(!(pinid || pinid == &scene->id)) { + if (!(pinid || pinid == &scene->id)) { ob= (scene->basact)? scene->basact->object: NULL; wrld= scene->world; brush= paint_brush(paint_get_active(scene)); } - if(ob && ob->type == OB_LAMP && !la) + if (ob && ob->type == OB_LAMP && !la) la= ob->data; - if(ob && !ma) + if (ob && !ma) ma= give_current_material(ob, ob->actcol); /* fill users */ users->first = users->last = NULL; - if(ma) + if (ma) buttons_texture_users_find_nodetree(users, &ma->id, ma->nodetree, "Material"); - if(la) + if (la) buttons_texture_users_find_nodetree(users, &la->id, la->nodetree, "Lamp"); - if(wrld) + if (wrld) buttons_texture_users_find_nodetree(users, &wrld->id, wrld->nodetree, "World"); - if(ob) { + if (ob) { ParticleSystem *psys= psys_get_current(ob); MTex *mtex; int a; @@ -202,12 +202,12 @@ static void buttons_texture_users_from_context(ListBase *users, const bContext * modifiers_foreachTexLink(ob, buttons_texture_modifier_foreach, users); /* particle systems */ - if(psys) { + if (psys) { /* todo: these slots are not in the UI */ - for(a=0; a<MAX_MTEX; a++) { + for (a=0; a<MAX_MTEX; a++) { mtex = psys->part->mtex[a]; - if(mtex) { + if (mtex) { PointerRNA ptr; PropertyRNA *prop; @@ -221,7 +221,7 @@ static void buttons_texture_users_from_context(ListBase *users, const bContext * } /* field */ - if(ob->pd && ob->pd->forcefield == PFIELD_TEXTURE) { + if (ob->pd && ob->pd->forcefield == PFIELD_TEXTURE) { PointerRNA ptr; PropertyRNA *prop; @@ -234,7 +234,7 @@ static void buttons_texture_users_from_context(ListBase *users, const bContext * } /* brush */ - if(brush) { + if (brush) { PointerRNA ptr; PropertyRNA *prop; @@ -253,8 +253,8 @@ void buttons_texture_context_compute(const bContext *C, SpaceButs *sbuts) ButsContextTexture *ct= sbuts->texuser; Scene *scene= CTX_data_scene(C); - if(!scene_use_new_shading_nodes(scene)) { - if(ct) { + if (!scene_use_new_shading_nodes(scene)) { + if (ct) { BLI_freelistN(&ct->users); MEM_freeN(ct); sbuts->texuser= NULL; @@ -263,7 +263,7 @@ void buttons_texture_context_compute(const bContext *C, SpaceButs *sbuts) return; } - if(!ct) { + if (!ct) { ct= MEM_callocN(sizeof(ButsContextTexture), "ButsContextTexture"); sbuts->texuser= ct; } @@ -274,14 +274,14 @@ void buttons_texture_context_compute(const bContext *C, SpaceButs *sbuts) buttons_texture_users_from_context(&ct->users, C, sbuts); /* set one user as active based on active index */ - if(ct->index >= BLI_countlist(&ct->users)) + if (ct->index >= BLI_countlist(&ct->users)) ct->index= 0; ct->user = BLI_findlink(&ct->users, ct->index); ct->texture = NULL; - if(ct->user) { - if(ct->user->ptr.data) { + if (ct->user) { + if (ct->user->ptr.data) { PointerRNA texptr; Tex *tex; @@ -291,14 +291,14 @@ void buttons_texture_context_compute(const bContext *C, SpaceButs *sbuts) ct->texture = tex; } - else if(ct->user->node && !(ct->user->node->flag & NODE_ACTIVE_TEXTURE)) { + else if (ct->user->node && !(ct->user->node->flag & NODE_ACTIVE_TEXTURE)) { ButsTextureUser *user; /* detect change of active texture node in same node tree, in that * case we also automatically switch to the other node */ - for(user=ct->users.first; user; user=user->next) { - if(user->ntree == ct->user->ntree && user->node != ct->user->node) { - if(user->node->flag & NODE_ACTIVE_TEXTURE) { + for (user=ct->users.first; user; user=user->next) { + if (user->ntree == ct->user->ntree && user->node != ct->user->node) { + if (user->node->flag & NODE_ACTIVE_TEXTURE) { ct->user = user; ct->index = BLI_findindex(&ct->users, user); break; @@ -318,11 +318,11 @@ static void template_texture_select(bContext *C, void *user_p, void *UNUSED(arg) PointerRNA texptr; Tex *tex; - if(!ct) + if (!ct) return; /* set user as active */ - if(user->node) { + if (user->node) { ED_node_set_active(CTX_data_main(C), user->ntree, user->node); ct->texture = NULL; } @@ -346,12 +346,12 @@ static void template_texture_user_menu(bContext *C, uiLayout *layout, void *UNUS uiBlock *block = uiLayoutGetBlock(layout); const char *last_category = NULL; - for(user=ct->users.first; user; user=user->next) { + for (user=ct->users.first; user; user=user->next) { uiBut *but; char name[UI_MAX_NAME_STR]; /* add label per category */ - if(!last_category || strcmp(last_category, user->category) != 0) { + if (!last_category || strcmp(last_category, user->category) != 0) { uiItemL(layout, user->category, ICON_NONE); but= block->buttons.last; but->flag= UI_TEXT_LEFT; @@ -380,13 +380,13 @@ void uiTemplateTextureUser(uiLayout *layout, bContext *C) ButsTextureUser *user; char name[UI_MAX_NAME_STR]; - if(!ct) + if (!ct) return; /* get current user */ user= ct->user; - if(!user) { + if (!user) { uiItemL(layout, "No textures in context.", ICON_NONE); return; } @@ -394,7 +394,7 @@ void uiTemplateTextureUser(uiLayout *layout, bContext *C) /* create button */ BLI_snprintf(name, UI_MAX_NAME_STR, "%s", user->name); - if(user->icon) { + if (user->icon) { but = uiDefIconTextMenuBut(block, template_texture_user_menu, NULL, user->icon, name, 0, 0, UI_UNIT_X*4, UI_UNIT_Y, ""); } @@ -417,14 +417,14 @@ static void template_texture_show(bContext *C, void *data_p, void *prop_p) ButsContextTexture *ct= (sbuts)? sbuts->texuser: NULL; ButsTextureUser *user; - if(!ct) + if (!ct) return; - for(user=ct->users.first; user; user=user->next) - if(user->ptr.data == data_p && user->prop == prop_p) + for (user=ct->users.first; user; user=user->next) + if (user->ptr.data == data_p && user->prop == prop_p) break; - if(user) { + if (user) { /* select texture */ template_texture_select(C, user, NULL); @@ -446,16 +446,16 @@ void uiTemplateTextureShow(uiLayout *layout, bContext *C, PointerRNA *ptr, Prope ButsTextureUser *user; /* only show button in other tabs in properties editor */ - if(!ct || sbuts->mainb == BCONTEXT_TEXTURE) + if (!ct || sbuts->mainb == BCONTEXT_TEXTURE) return; /* find corresponding texture user */ - for(user=ct->users.first; user; user=user->next) - if(user->ptr.data == ptr->data && user->prop == prop) + for (user=ct->users.first; user; user=user->next) + if (user->ptr.data == ptr->data && user->prop == prop) break; /* draw button */ - if(user) { + if (user) { uiBlock *block = uiLayoutGetBlock(layout); uiBut *but; diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index de6c1c2d9b3..f1f4fb37b6e 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -97,10 +97,10 @@ static void buttons_free(SpaceLink *sl) { SpaceButs *sbuts= (SpaceButs*) sl; - if(sbuts->path) + if (sbuts->path) MEM_freeN(sbuts->path); - if(sbuts->texuser) { + if (sbuts->texuser) { ButsContextTexture *ct= sbuts->texuser; BLI_freelistN(&ct->users); MEM_freeN(ct); @@ -113,8 +113,8 @@ static void buttons_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa) SpaceButs *sbuts= sa->spacedata.first; /* auto-align based on size */ - if(sbuts->align == BUT_AUTO || !sbuts->align) { - if(sa->winx > sa->winy) + if (sbuts->align == BUT_AUTO || !sbuts->align) { + if (sa->winx > sa->winy) sbuts->align= BUT_HORIZONTAL; else sbuts->align= BUT_VERTICAL; @@ -151,31 +151,31 @@ static void buttons_main_area_draw(const bContext *C, ARegion *ar) buttons_context_compute(C, sbuts); - if(sbuts->mainb == BCONTEXT_SCENE) + if (sbuts->mainb == BCONTEXT_SCENE) ED_region_panels(C, ar, vertical, "scene", sbuts->mainb); - else if(sbuts->mainb == BCONTEXT_RENDER) + else if (sbuts->mainb == BCONTEXT_RENDER) ED_region_panels(C, ar, vertical, "render", sbuts->mainb); - else if(sbuts->mainb == BCONTEXT_WORLD) + else if (sbuts->mainb == BCONTEXT_WORLD) ED_region_panels(C, ar, vertical, "world", sbuts->mainb); - else if(sbuts->mainb == BCONTEXT_OBJECT) + else if (sbuts->mainb == BCONTEXT_OBJECT) ED_region_panels(C, ar, vertical, "object", sbuts->mainb); - else if(sbuts->mainb == BCONTEXT_DATA) + else if (sbuts->mainb == BCONTEXT_DATA) ED_region_panels(C, ar, vertical, "data", sbuts->mainb); - else if(sbuts->mainb == BCONTEXT_MATERIAL) + else if (sbuts->mainb == BCONTEXT_MATERIAL) ED_region_panels(C, ar, vertical, "material", sbuts->mainb); - else if(sbuts->mainb == BCONTEXT_TEXTURE) + else if (sbuts->mainb == BCONTEXT_TEXTURE) ED_region_panels(C, ar, vertical, "texture", sbuts->mainb); - else if(sbuts->mainb == BCONTEXT_PARTICLE) + else if (sbuts->mainb == BCONTEXT_PARTICLE) ED_region_panels(C, ar, vertical, "particle", sbuts->mainb); - else if(sbuts->mainb == BCONTEXT_PHYSICS) + else if (sbuts->mainb == BCONTEXT_PHYSICS) ED_region_panels(C, ar, vertical, "physics", sbuts->mainb); - else if(sbuts->mainb == BCONTEXT_BONE) + else if (sbuts->mainb == BCONTEXT_BONE) ED_region_panels(C, ar, vertical, "bone", sbuts->mainb); - else if(sbuts->mainb == BCONTEXT_MODIFIER) + else if (sbuts->mainb == BCONTEXT_MODIFIER) ED_region_panels(C, ar, vertical, "modifier", sbuts->mainb); else if (sbuts->mainb == BCONTEXT_CONSTRAINT) ED_region_panels(C, ar, vertical, "constraint", sbuts->mainb); - else if(sbuts->mainb == BCONTEXT_BONE_CONSTRAINT) + else if (sbuts->mainb == BCONTEXT_BONE_CONSTRAINT) ED_region_panels(C, ar, vertical, "bone_constraint", sbuts->mainb); sbuts->re_align= 0; @@ -224,7 +224,7 @@ static void buttons_area_redraw(ScrArea *sa, short buttons) SpaceButs *sbuts= sa->spacedata.first; /* if the area's current button set is equal to the one to redraw */ - if(sbuts->mainb == buttons) + if (sbuts->mainb == buttons) ED_area_tag_redraw(sa); } @@ -276,7 +276,7 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn) buttons_area_redraw(sa, BCONTEXT_DATA); break; case ND_MODIFIER: - if(wmn->action == NA_RENAME) + if (wmn->action == NA_RENAME) ED_area_tag_redraw(sa); else buttons_area_redraw(sa, BCONTEXT_MODIFIER); @@ -342,11 +342,11 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn) sbuts->preview= 1; break; case NC_SPACE: - if(wmn->data == ND_SPACE_PROPERTIES) + if (wmn->data == ND_SPACE_PROPERTIES) ED_area_tag_redraw(sa); break; case NC_ID: - if(wmn->action == NA_RENAME) + if (wmn->action == NA_RENAME) ED_area_tag_redraw(sa); break; case NC_ANIMATION: @@ -358,10 +358,10 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn) } break; case NC_NODE: - if(wmn->action==NA_SELECTED) { + if (wmn->action==NA_SELECTED) { ED_area_tag_redraw(sa); /* new active node, update texture preview */ - if(sbuts->mainb == BCONTEXT_TEXTURE) + if (sbuts->mainb == BCONTEXT_TEXTURE) sbuts->preview= 1; } break; @@ -372,7 +372,7 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn) break; } - if(wmn->data == ND_KEYS) + if (wmn->data == ND_KEYS) ED_area_tag_redraw(sa); } |