diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-05-08 19:30:00 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-05-08 19:30:00 +0400 |
commit | f9d07ff3ee312a9ea7d93ef53bfebe327fa058ee (patch) | |
tree | 99487b11a3d53d3758d7d438266ebda44b34973c /source/blender/editors/space_buttons | |
parent | 817d308803dc1234e9e7b4cab782c0f52a4ebaca (diff) |
style cleanup: animation + buttons
Diffstat (limited to 'source/blender/editors/space_buttons')
-rw-r--r-- | source/blender/editors/space_buttons/buttons_context.c | 305 | ||||
-rw-r--r-- | source/blender/editors/space_buttons/buttons_header.c | 30 | ||||
-rw-r--r-- | source/blender/editors/space_buttons/buttons_intern.h | 22 | ||||
-rw-r--r-- | source/blender/editors/space_buttons/buttons_ops.c | 44 | ||||
-rw-r--r-- | source/blender/editors/space_buttons/buttons_texture.c | 132 | ||||
-rw-r--r-- | source/blender/editors/space_buttons/space_buttons.c | 118 |
6 files changed, 326 insertions, 325 deletions
diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index ff466c23953..d1c2c1e092f 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -63,15 +63,15 @@ #include "UI_interface.h" #include "UI_resources.h" -#include "buttons_intern.h" // own include +#include "buttons_intern.h" // own include static int set_pointer_type(ButsContextPath *path, bContextDataResult *result, StructRNA *type) { PointerRNA *ptr; int a; - for (a=0; a<path->len; a++) { - ptr= &path->ptr[a]; + for (a = 0; a < path->len; a++) { + ptr = &path->ptr[a]; if (RNA_struct_is_a(ptr->type, type)) { CTX_data_pointer_set(result, ptr->id.data, ptr->type, ptr->data); @@ -87,8 +87,8 @@ static PointerRNA *get_pointer_type(ButsContextPath *path, StructRNA *type) PointerRNA *ptr; int a; - for (a=0; a<path->len; a++) { - ptr= &path->ptr[a]; + for (a = 0; a < path->len; a++) { + ptr = &path->ptr[a]; if (RNA_struct_is_a(ptr->type, type)) return ptr; @@ -101,7 +101,7 @@ static PointerRNA *get_pointer_type(ButsContextPath *path, StructRNA *type) static int buttons_context_path_scene(ButsContextPath *path) { - PointerRNA *ptr= &path->ptr[path->len-1]; + PointerRNA *ptr = &path->ptr[path->len - 1]; /* this one just verifies */ return RNA_struct_is_a(ptr->type, &RNA_Scene); @@ -113,7 +113,7 @@ static int buttons_context_path_world(ButsContextPath *path) { Scene *scene; World *world; - PointerRNA *ptr= &path->ptr[path->len-1]; + 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)) { @@ -121,8 +121,8 @@ static int buttons_context_path_world(ButsContextPath *path) } /* if we have a scene, use the scene's world */ else if (buttons_context_path_scene(path)) { - scene= path->ptr[path->len-1].data; - world= scene->world; + scene = path->ptr[path->len - 1].data; + world = scene->world; if (world) { RNA_id_pointer_create(&scene->world->id, &path->ptr[path->len]); @@ -143,7 +143,7 @@ static int buttons_context_path_object(ButsContextPath *path) { Scene *scene; Object *ob; - PointerRNA *ptr= &path->ptr[path->len-1]; + 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)) { @@ -151,8 +151,8 @@ static int buttons_context_path_object(ButsContextPath *path) } /* if we have a scene, use the scene's active object */ else if (buttons_context_path_scene(path)) { - scene= path->ptr[path->len-1].data; - ob= (scene->basact)? scene->basact->object: NULL; + scene = path->ptr[path->len - 1].data; + ob = (scene->basact) ? scene->basact->object : NULL; if (ob) { RNA_id_pointer_create(&ob->id, &path->ptr[path->len]); @@ -169,7 +169,7 @@ static int buttons_context_path_object(ButsContextPath *path) static int buttons_context_path_data(ButsContextPath *path, int type) { Object *ob; - PointerRNA *ptr= &path->ptr[path->len-1]; + 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; @@ -182,7 +182,7 @@ static int buttons_context_path_data(ButsContextPath *path, int type) 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)) { - ob= path->ptr[path->len-1].data; + ob = path->ptr[path->len - 1].data; if (ob && (type == -1 || type == ob->type)) { RNA_id_pointer_create(ob->data, &path->ptr[path->len]); @@ -201,7 +201,7 @@ static int buttons_context_path_modifier(ButsContextPath *path) Object *ob; if (buttons_context_path_object(path)) { - ob= path->ptr[path->len-1].data; + ob = path->ptr[path->len - 1].data; if (ob && ELEM5(ob->type, OB_MESH, OB_CURVE, OB_FONT, OB_SURF, OB_LATTICE)) return 1; @@ -213,7 +213,7 @@ static int buttons_context_path_modifier(ButsContextPath *path) static int buttons_context_path_material(ButsContextPath *path, int for_texture) { Object *ob; - PointerRNA *ptr= &path->ptr[path->len-1]; + PointerRNA *ptr = &path->ptr[path->len - 1]; Material *ma; /* if we already have a (pinned) material, we're done */ @@ -222,17 +222,17 @@ static int buttons_context_path_material(ButsContextPath *path, int for_texture) } /* if we have an object, use the object material slot */ else if (buttons_context_path_object(path)) { - ob= path->ptr[path->len-1].data; + ob = path->ptr[path->len - 1].data; if (ob && OB_TYPE_SUPPORT_MATERIAL(ob->type)) { - ma= give_current_material(ob, ob->actcol); + 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)) return 1; - ma= give_node_material(ma); + ma = give_node_material(ma); if (ma) { RNA_id_pointer_create(&ma->id, &path->ptr[path->len]); path->len++; @@ -252,11 +252,11 @@ static int buttons_context_path_bone(ButsContextPath *path) /* if we have an armature, get the active bone */ if (buttons_context_path_data(path, OB_ARMATURE)) { - arm= path->ptr[path->len-1].data; + arm = path->ptr[path->len - 1].data; if (arm->edbo) { if (arm->act_edbone) { - edbo= arm->act_edbone; + edbo = arm->act_edbone; RNA_pointer_create(&arm->id, &RNA_EditBone, edbo, &path->ptr[path->len]); path->len++; return 1; @@ -277,7 +277,7 @@ static int buttons_context_path_bone(ButsContextPath *path) static int buttons_context_path_pose_bone(ButsContextPath *path) { - PointerRNA *ptr= &path->ptr[path->len-1]; + 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)) { @@ -286,15 +286,15 @@ static int buttons_context_path_pose_bone(ButsContextPath *path) /* if we have an armature, get the active bone */ 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 */ + 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) { return 0; } else { if (arm->act_bone) { - bPoseChannel *pchan= BKE_pose_channel_find_name(ob->pose, arm->act_bone->name); + bPoseChannel *pchan = BKE_pose_channel_find_name(ob->pose, arm->act_bone->name); if (pchan) { RNA_pointer_create(&ob->id, &RNA_PoseBone, pchan, &path->ptr[path->len]); path->len++; @@ -313,7 +313,7 @@ static int buttons_context_path_particle(ButsContextPath *path) { Object *ob; ParticleSystem *psys; - PointerRNA *ptr= &path->ptr[path->len-1]; + 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)) { @@ -321,10 +321,10 @@ static int buttons_context_path_particle(ButsContextPath *path) } /* if we have an object, get the active particle system */ if (buttons_context_path_object(path)) { - ob= path->ptr[path->len-1].data; + ob = path->ptr[path->len - 1].data; if (ob && ob->type == OB_MESH) { - psys= psys_get_current(ob); + psys = psys_get_current(ob); RNA_pointer_create(&ob->id, &RNA_ParticleSystem, psys, &path->ptr[path->len]); path->len++; @@ -339,8 +339,8 @@ static int buttons_context_path_particle(ButsContextPath *path) static int buttons_context_path_brush(ButsContextPath *path) { Scene *scene; - Brush *br= NULL; - PointerRNA *ptr= &path->ptr[path->len-1]; + Brush *br = NULL; + 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)) { @@ -348,10 +348,10 @@ static int buttons_context_path_brush(ButsContextPath *path) } /* if we have a scene, use the toolsettings brushes */ else if (buttons_context_path_scene(path)) { - scene= path->ptr[path->len-1].data; + scene = path->ptr[path->len - 1].data; if (scene) - br= paint_brush(paint_get_active(scene)); + br = paint_brush(paint_get_active(scene)); if (br) { RNA_id_pointer_create((ID *)br, &path->ptr[path->len]); @@ -369,7 +369,7 @@ static int buttons_context_path_texture(ButsContextPath *path, ButsContextTextur { if (ct) { /* new shading system */ - PointerRNA *ptr= &path->ptr[path->len-1]; + PointerRNA *ptr = &path->ptr[path->len - 1]; ID *id; /* if we already have a (pinned) texture, we're done */ @@ -379,7 +379,7 @@ static int buttons_context_path_texture(ButsContextPath *path, ButsContextTextur if (!ct->user) return 0; - id= ct->user->id; + id = ct->user->id; if (id) { if (GS(id->name) == ID_BR) @@ -411,7 +411,7 @@ static int buttons_context_path_texture(ButsContextPath *path, ButsContextTextur World *wo; ParticleSystem *psys; Tex *tex; - PointerRNA *ptr= &path->ptr[path->len-1]; + PointerRNA *ptr = &path->ptr[path->len - 1]; int orig_len = path->len; /* if we already have a (pinned) texture, we're done */ @@ -420,10 +420,10 @@ static int buttons_context_path_texture(ButsContextPath *path, ButsContextTextur } /* try brush */ if ((path->tex_ctx == SB_TEXC_BRUSH) && buttons_context_path_brush(path)) { - br= path->ptr[path->len-1].data; + br = path->ptr[path->len - 1].data; if (br) { - tex= give_current_brush_texture(br); + tex = give_current_brush_texture(br); RNA_id_pointer_create(&tex->id, &path->ptr[path->len]); path->len++; @@ -432,10 +432,10 @@ static int buttons_context_path_texture(ButsContextPath *path, ButsContextTextur } /* try world */ if ((path->tex_ctx == SB_TEXC_WORLD) && buttons_context_path_world(path)) { - wo= path->ptr[path->len-1].data; + wo = path->ptr[path->len - 1].data; - if (wo && GS(wo->id.name)==ID_WO) { - tex= give_current_world_texture(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]); path->len++; @@ -444,19 +444,19 @@ 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) { - ParticleSettings *part = path->ptr[path->len-1].data; + if (path->ptr[path->len - 1].type == &RNA_ParticleSettings) { + ParticleSettings *part = path->ptr[path->len - 1].data; - tex= give_current_particle_texture(part); + tex = give_current_particle_texture(part); RNA_id_pointer_create(&tex->id, &path->ptr[path->len]); path->len++; return 1; } else { - psys= path->ptr[path->len-1].data; + psys = path->ptr[path->len - 1].data; - if (psys && psys->part && GS(psys->part->id.name)==ID_PA) { - tex= give_current_particle_texture(psys->part); + 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]); path->len++; @@ -466,10 +466,10 @@ static int buttons_context_path_texture(ButsContextPath *path, ButsContextTextur } /* try material */ if (buttons_context_path_material(path, 1)) { - ma= path->ptr[path->len-1].data; + ma = path->ptr[path->len - 1].data; if (ma) { - tex= give_current_material_texture(ma); + tex = give_current_material_texture(ma); RNA_id_pointer_create(&tex->id, &path->ptr[path->len]); path->len++; @@ -478,10 +478,10 @@ static int buttons_context_path_texture(ButsContextPath *path, ButsContextTextur } /* try lamp */ if (buttons_context_path_data(path, OB_LAMP)) { - la= path->ptr[path->len-1].data; + la = path->ptr[path->len - 1].data; if (la) { - tex= give_current_lamp_texture(la); + tex = give_current_lamp_texture(la); RNA_id_pointer_create(&tex->id, &path->ptr[path->len]); path->len++; @@ -491,10 +491,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)) { - br= path->ptr[path->len-1].data; + br = path->ptr[path->len - 1].data; if (br) { - tex= give_current_brush_texture(br); + tex = give_current_brush_texture(br); RNA_id_pointer_create(&tex->id, &path->ptr[path->len]); path->len++; @@ -510,17 +510,17 @@ static int buttons_context_path_texture(ButsContextPath *path, ButsContextTextur static int buttons_context_path(const bContext *C, ButsContextPath *path, int mainb, int flag) { - SpaceButs *sbuts= CTX_wm_space_buts(C); + SpaceButs *sbuts = CTX_wm_space_buts(C); ID *id; int found; memset(path, 0, sizeof(*path)); - path->flag= flag; + path->flag = flag; path->tex_ctx = sbuts->texture_context; /* if some ID datablock is pinned, set the root pointer */ if (sbuts->pinid) { - id= sbuts->pinid; + id = sbuts->pinid; RNA_id_pointer_create(id, &path->ptr[0]); path->len++; @@ -528,7 +528,7 @@ static int buttons_context_path(const bContext *C, ButsContextPath *path, int ma /* no pinned root, use scene as root */ if (path->len == 0) { - id= (ID*)CTX_data_scene(C); + id = (ID *)CTX_data_scene(C); RNA_id_pointer_create(id, &path->ptr[0]); path->len++; } @@ -538,41 +538,41 @@ static int buttons_context_path(const bContext *C, ButsContextPath *path, int ma switch (mainb) { case BCONTEXT_SCENE: case BCONTEXT_RENDER: - found= buttons_context_path_scene(path); + found = buttons_context_path_scene(path); break; case BCONTEXT_WORLD: - found= buttons_context_path_world(path); + found = buttons_context_path_world(path); break; case BCONTEXT_OBJECT: case BCONTEXT_PHYSICS: case BCONTEXT_CONSTRAINT: - found= buttons_context_path_object(path); + found = buttons_context_path_object(path); break; case BCONTEXT_MODIFIER: - found= buttons_context_path_modifier(path); + found = buttons_context_path_modifier(path); break; case BCONTEXT_DATA: - found= buttons_context_path_data(path, -1); + found = buttons_context_path_data(path, -1); break; case BCONTEXT_PARTICLE: - found= buttons_context_path_particle(path); + found = buttons_context_path_particle(path); break; case BCONTEXT_MATERIAL: - found= buttons_context_path_material(path, 0); + found = buttons_context_path_material(path, 0); break; case BCONTEXT_TEXTURE: - found= buttons_context_path_texture(path, sbuts->texuser); + found = buttons_context_path_texture(path, sbuts->texuser); break; case BCONTEXT_BONE: - found= buttons_context_path_bone(path); + found = buttons_context_path_bone(path); if (!found) - found= buttons_context_path_data(path, OB_ARMATURE); + found = buttons_context_path_data(path, OB_ARMATURE); break; case BCONTEXT_BONE_CONSTRAINT: - found= buttons_context_path_pose_bone(path); + found = buttons_context_path_pose_bone(path); break; default: - found= 0; + found = 0; break; } @@ -581,7 +581,7 @@ static int buttons_context_path(const bContext *C, ButsContextPath *path, int ma static int buttons_shading_context(const bContext *C, int mainb) { - Object *ob= CTX_data_active_object(C); + Object *ob = CTX_data_active_object(C); if (ELEM3(mainb, BCONTEXT_MATERIAL, BCONTEXT_WORLD, BCONTEXT_TEXTURE)) return 1; @@ -593,7 +593,7 @@ static int buttons_shading_context(const bContext *C, int mainb) static int buttons_shading_new_context(const bContext *C, int flag) { - Object *ob= CTX_data_active_object(C); + Object *ob = CTX_data_active_object(C); if (flag & (1 << BCONTEXT_MATERIAL)) return BCONTEXT_MATERIAL; @@ -609,29 +609,29 @@ void buttons_context_compute(const bContext *C, SpaceButs *sbuts) { ButsContextPath *path; PointerRNA *ptr; - int a, pflag= 0, flag= 0; + int a, pflag = 0, flag = 0; buttons_texture_context_compute(C, sbuts); if (!sbuts->path) - sbuts->path= MEM_callocN(sizeof(ButsContextPath), "ButsContextPath"); + sbuts->path = MEM_callocN(sizeof(ButsContextPath), "ButsContextPath"); - path= sbuts->path; + 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++) { + for (a = 0; a < BCONTEXT_TOT; a++) { if (buttons_context_path(C, path, a, pflag)) { - flag |= (1<<a); + flag |= (1 << a); /* setting icon for data context */ if (a == BCONTEXT_DATA) { - ptr= &path->ptr[path->len-1]; + ptr = &path->ptr[path->len - 1]; if (ptr->type) - sbuts->dataicon= RNA_struct_ui_icon(ptr->type); + sbuts->dataicon = RNA_struct_ui_icon(ptr->type); else - sbuts->dataicon= ICON_EMPTY_DATA; + sbuts->dataicon = ICON_EMPTY_DATA; } } } @@ -639,21 +639,21 @@ void buttons_context_compute(const bContext *C, SpaceButs *sbuts) /* always try to use the tab that was explicitly * set to the user, so that once that context comes * back, the tab is activated again */ - sbuts->mainb= sbuts->mainbuser; + sbuts->mainb = sbuts->mainbuser; /* in case something becomes invalid, change */ 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); + sbuts->mainb = buttons_shading_new_context(C, flag); } else if (flag & BCONTEXT_OBJECT) { - sbuts->mainb= BCONTEXT_OBJECT; + sbuts->mainb = BCONTEXT_OBJECT; } else { - for (a=0; a<BCONTEXT_TOT; a++) { + for (a = 0; a < BCONTEXT_TOT; a++) { if (flag & (1 << a)) { - sbuts->mainb= a; + sbuts->mainb = a; break; } } @@ -664,9 +664,9 @@ void buttons_context_compute(const bContext *C, SpaceButs *sbuts) if (!(flag & (1 << sbuts->mainb))) { if (flag & (1 << BCONTEXT_OBJECT)) - sbuts->mainb= BCONTEXT_OBJECT; + sbuts->mainb = BCONTEXT_OBJECT; else - sbuts->mainb= BCONTEXT_SCENE; + sbuts->mainb = BCONTEXT_SCENE; } if (buttons_shading_context(C, sbuts->mainb)) @@ -674,7 +674,7 @@ void buttons_context_compute(const bContext *C, SpaceButs *sbuts) else sbuts->flag &= ~SB_SHADING_CONTEXT; - sbuts->pathflag= flag; + sbuts->pathflag = flag; } /************************* Context Callback ************************/ @@ -684,12 +684,13 @@ const char *buttons_context_dir[] = { "meta_ball", "lamp", "speaker", "camera", "material", "material_slot", "texture", "texture_slot", "texture_user", "bone", "edit_bone", "pose_bone", "particle_system", "particle_system_editable", - "cloth", "soft_body", "fluid", "smoke", "collision", "brush", "dynamic_paint", NULL}; + "cloth", "soft_body", "fluid", "smoke", "collision", "brush", "dynamic_paint", NULL +}; int buttons_context(const bContext *C, const char *member, bContextDataResult *result) { - SpaceButs *sbuts= CTX_wm_space_buts(C); - ButsContextPath *path= sbuts?sbuts->path:NULL; + SpaceButs *sbuts = CTX_wm_space_buts(C); + ButsContextPath *path = sbuts ? sbuts->path : NULL; if (!path) return 0; @@ -744,7 +745,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r return 1; } else if (CTX_data_equals(member, "texture")) { - ButsContextTexture *ct= sbuts->texuser; + ButsContextTexture *ct = sbuts->texuser; if (ct) { /* new shading system */ @@ -758,15 +759,15 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r return 1; } else if (CTX_data_equals(member, "material_slot")) { - PointerRNA *ptr= get_pointer_type(path, &RNA_Object); + PointerRNA *ptr = get_pointer_type(path, &RNA_Object); if (ptr) { - Object *ob= ptr->data; + Object *ob = ptr->data; 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; + int matnr = ob->actcol - 1; + if (matnr < 0) matnr = 0; CTX_data_pointer_set(result, &ob->id, &RNA_MaterialSlot, &ob->mat[matnr]); } } @@ -774,20 +775,20 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r return 1; } else if (CTX_data_equals(member, "texture_user")) { - ButsContextTexture *ct= sbuts->texuser; + ButsContextTexture *ct = sbuts->texuser; if (!ct) - return -1; /* old shading system (found but not available) */ + return -1; /* old shading system (found but not available) */ if (ct->user && ct->user->ptr.data) { - ButsTextureUser *user= ct->user; + 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")) { - ButsContextTexture *ct= sbuts->texuser; + ButsContextTexture *ct = sbuts->texuser; if (ct) { /* new shading system */ @@ -800,11 +801,11 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r /* old shading system */ PointerRNA *ptr; - if ((ptr=get_pointer_type(path, &RNA_Material))) { - Material *ma= ptr->data; + if ((ptr = get_pointer_type(path, &RNA_Material))) { + Material *ma = ptr->data; if (ma) { - bNode *node= give_current_material_texture_node(ma); + bNode *node = give_current_material_texture_node(ma); CTX_data_pointer_set(result, &ma->nodetree->id, &RNA_Node, node); } } @@ -813,14 +814,14 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r } } else if (CTX_data_equals(member, "texture_slot")) { - ButsContextTexture *ct= sbuts->texuser; + ButsContextTexture *ct = sbuts->texuser; PointerRNA *ptr; if (ct) - return 0; /* new shading system */ + return 0; /* new shading system */ - if ((ptr=get_pointer_type(path, &RNA_Material))) { - Material *ma= ptr->data; + 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) { @@ -829,7 +830,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r if (give_current_material_texture_node(ma)) return 0; - ma= give_node_material(ma); + ma = give_node_material(ma); if (ma) CTX_data_pointer_set(result, &ma->id, &RNA_MaterialTextureSlot, ma->mtex[(int)ma->texact]); else @@ -839,26 +840,26 @@ 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 if ((ptr=get_pointer_type(path, &RNA_Lamp))) { - Lamp *la= ptr->data; + else if ((ptr = get_pointer_type(path, &RNA_Lamp))) { + Lamp *la = ptr->data; 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))) { - World *wo= ptr->data; + else if ((ptr = get_pointer_type(path, &RNA_World))) { + World *wo = ptr->data; 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? */ - Brush *br= ptr->data; + else if ((ptr = get_pointer_type(path, &RNA_Brush))) { /* how to get this into context? */ + Brush *br = ptr->data; if (br) CTX_data_pointer_set(result, &br->id, &RNA_BrushTextureSlot, &br->mtex); } - else if ((ptr=get_pointer_type(path, &RNA_ParticleSystem))) { - ParticleSettings *part= ((ParticleSystem *)ptr->data)->part; + else if ((ptr = get_pointer_type(path, &RNA_ParticleSystem))) { + ParticleSettings *part = ((ParticleSystem *)ptr->data)->part; if (part) CTX_data_pointer_set(result, &part->id, &RNA_ParticleSettingsTextureSlot, part->mtex[(int)part->texact]); @@ -883,59 +884,59 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r return 1; } else if (CTX_data_equals(member, "particle_system_editable")) { - if (PE_poll((bContext*)C)) + 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")) { - PointerRNA *ptr= get_pointer_type(path, &RNA_Object); + PointerRNA *ptr = get_pointer_type(path, &RNA_Object); if (ptr && ptr->data) { - Object *ob= ptr->data; - ModifierData *md= modifiers_findByType(ob, eModifierType_Cloth); + 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")) { - PointerRNA *ptr= get_pointer_type(path, &RNA_Object); + PointerRNA *ptr = get_pointer_type(path, &RNA_Object); if (ptr && ptr->data) { - Object *ob= ptr->data; - ModifierData *md= modifiers_findByType(ob, eModifierType_Softbody); + 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")) { - PointerRNA *ptr= get_pointer_type(path, &RNA_Object); + PointerRNA *ptr = get_pointer_type(path, &RNA_Object); if (ptr && ptr->data) { - Object *ob= ptr->data; - ModifierData *md= modifiers_findByType(ob, eModifierType_Fluidsim); + Object *ob = ptr->data; + ModifierData *md = modifiers_findByType(ob, eModifierType_Fluidsim); CTX_data_pointer_set(result, &ob->id, &RNA_FluidSimulationModifier, md); return 1; } } else if (CTX_data_equals(member, "smoke")) { - PointerRNA *ptr= get_pointer_type(path, &RNA_Object); + PointerRNA *ptr = get_pointer_type(path, &RNA_Object); if (ptr && ptr->data) { - Object *ob= ptr->data; - ModifierData *md= modifiers_findByType(ob, eModifierType_Smoke); + 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")) { - PointerRNA *ptr= get_pointer_type(path, &RNA_Object); + PointerRNA *ptr = get_pointer_type(path, &RNA_Object); if (ptr && ptr->data) { - Object *ob= ptr->data; - ModifierData *md= modifiers_findByType(ob, eModifierType_Collision); + Object *ob = ptr->data; + ModifierData *md = modifiers_findByType(ob, eModifierType_Collision); CTX_data_pointer_set(result, &ob->id, &RNA_CollisionModifier, md); return 1; } @@ -945,11 +946,11 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r return 1; } else if (CTX_data_equals(member, "dynamic_paint")) { - PointerRNA *ptr= get_pointer_type(path, &RNA_Object); + PointerRNA *ptr = get_pointer_type(path, &RNA_Object); if (ptr && ptr->data) { - Object *ob= ptr->data; - ModifierData *md= modifiers_findByType(ob, eModifierType_DynamicPaint); + Object *ob = ptr->data; + ModifierData *md = modifiers_findByType(ob, eModifierType_DynamicPaint); CTX_data_pointer_set(result, &ob->id, &RNA_DynamicPaintModifier, md); return 1; } @@ -965,21 +966,21 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r static void pin_cb(bContext *C, void *UNUSED(arg1), void *UNUSED(arg2)) { - SpaceButs *sbuts= CTX_wm_space_buts(C); + SpaceButs *sbuts = CTX_wm_space_buts(C); if (sbuts->flag & SB_PIN_CONTEXT) { - sbuts->pinid= buttons_context_id_path(C); + sbuts->pinid = buttons_context_id_path(C); } else - sbuts->pinid= NULL; + sbuts->pinid = NULL; ED_area_tag_redraw(CTX_wm_area(C)); } void buttons_context_draw(const bContext *C, uiLayout *layout) { - SpaceButs *sbuts= CTX_wm_space_buts(C); - ButsContextPath *path= sbuts->path; + SpaceButs *sbuts = CTX_wm_space_buts(C); + ButsContextPath *path = sbuts->path; uiLayout *row; uiBlock *block; uiBut *but; @@ -990,28 +991,28 @@ void buttons_context_draw(const bContext *C, uiLayout *layout) if (!path) return; - row= uiLayoutRow(layout, 1); + row = uiLayoutRow(layout, 1); uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_LEFT); - block= uiLayoutGetBlock(row); + block = uiLayoutGetBlock(row); uiBlockSetEmboss(block, UI_EMBOSSN); but = uiDefIconButBitC(block, ICONTOG, SB_PIN_CONTEXT, 0, ICON_UNPINNED, 0, 0, UI_UNIT_X, UI_UNIT_Y, &sbuts->flag, 0, 0, 0, 0, "Follow context or keep fixed datablock displayed"); uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */ uiButSetFunc(but, pin_cb, NULL, NULL); - for (a=0; a<path->len; a++) { - ptr= &path->ptr[a]; + for (a = 0; a < path->len; a++) { + ptr = &path->ptr[a]; if (a != 0) uiItemL(row, "", VICO_SMALL_TRI_RIGHT_VEC); if (ptr->data) { - icon= RNA_struct_ui_icon(ptr->type); - name= RNA_struct_name_get_alloc(ptr, namebuf, sizeof(namebuf), NULL); + 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) - uiItemLDrag(row, ptr, "", icon); /* save some space */ + uiItemLDrag(row, ptr, "", icon); /* save some space */ else uiItemLDrag(row, ptr, name, icon); @@ -1033,24 +1034,24 @@ void buttons_context_register(ARegionType *art) { PanelType *pt; - pt= MEM_callocN(sizeof(PanelType), "spacetype buttons panel context"); + pt = MEM_callocN(sizeof(PanelType), "spacetype buttons panel context"); strcpy(pt->idname, "BUTTONS_PT_context"); strcpy(pt->label, "Context"); - pt->draw= buttons_panel_context; - pt->flag= PNL_NO_HEADER; + pt->draw = buttons_panel_context; + pt->flag = PNL_NO_HEADER; BLI_addtail(&art->paneltypes, pt); } ID *buttons_context_id_path(const bContext *C) { - SpaceButs *sbuts= CTX_wm_space_buts(C); - ButsContextPath *path= sbuts->path; + SpaceButs *sbuts = CTX_wm_space_buts(C); + ButsContextPath *path = sbuts->path; PointerRNA *ptr; int a; if (path->len) { - for (a=path->len-1; a>=0; a--) { - ptr= &path->ptr[a]; + 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) { diff --git a/source/blender/editors/space_buttons/buttons_header.c b/source/blender/editors/space_buttons/buttons_header.c index 2385bfd75b7..661f7ad7d0f 100644 --- a/source/blender/editors/space_buttons/buttons_header.c +++ b/source/blender/editors/space_buttons/buttons_header.c @@ -51,8 +51,8 @@ #include "buttons_intern.h" -#define B_CONTEXT_SWITCH 101 -#define B_BUTSPREVIEW 102 +#define B_CONTEXT_SWITCH 101 +#define B_BUTSPREVIEW 102 static void set_texture_context(bContext *C, SpaceButs *sbuts) { @@ -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; } @@ -78,7 +78,7 @@ static void set_texture_context(bContext *C, SpaceButs *sbuts) static void do_buttons_buttons(bContext *C, void *UNUSED(arg), int event) { - SpaceButs *sbuts= CTX_wm_space_buts(C); + SpaceButs *sbuts = CTX_wm_space_buts(C); if (!sbuts) /* editor type switch */ return; @@ -90,28 +90,28 @@ static void do_buttons_buttons(bContext *C, void *UNUSED(arg), int event) set_texture_context(C, sbuts); - sbuts->preview= 1; + sbuts->preview = 1; break; } - sbuts->mainbuser= sbuts->mainb; + sbuts->mainbuser = sbuts->mainb; } -#define BUT_UNIT_X (UI_UNIT_X+2) +#define BUT_UNIT_X (UI_UNIT_X + 2) void buttons_header_buttons(const bContext *C, ARegion *ar) { - SpaceButs *sbuts= CTX_wm_space_buts(C); + SpaceButs *sbuts = CTX_wm_space_buts(C); uiBlock *block; uiBut *but; - int xco, yco= 2; + int xco, yco = 2; buttons_context_compute(C, sbuts); - block= uiBeginBlock(C, ar, __func__, UI_EMBOSS); + block = uiBeginBlock(C, ar, __func__, UI_EMBOSS); uiBlockSetHandleFunc(block, do_buttons_buttons, NULL); - xco= ED_area_header_switchbutton(C, block, yco); + xco = ED_area_header_switchbutton(C, block, yco); uiBlockSetEmboss(block, UI_EMBOSS); @@ -122,8 +122,8 @@ void buttons_header_buttons(const bContext *C, ARegion *ar) uiBlockBeginAlign(block); #define BUTTON_HEADER_CTX(_ctx, _icon, _tip) \ - 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)); \ + 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); \ } \ @@ -143,12 +143,12 @@ void buttons_header_buttons(const bContext *C, ARegion *ar) #undef BUTTON_HEADER_CTX - xco+= BUT_UNIT_X; + xco += BUT_UNIT_X; uiBlockEndAlign(block); /* always as last */ - UI_view2d_totRect_set(&ar->v2d, xco+(UI_UNIT_X/2), ar->v2d.tot.ymax-ar->v2d.tot.ymin); + UI_view2d_totRect_set(&ar->v2d, xco + (UI_UNIT_X / 2), ar->v2d.tot.ymax - ar->v2d.tot.ymin); uiEndBlock(C, block); uiDrawBlock(C, block); diff --git a/source/blender/editors/space_buttons/buttons_intern.h b/source/blender/editors/space_buttons/buttons_intern.h index 8d0f84cf70f..5700d361e15 100644 --- a/source/blender/editors/space_buttons/buttons_intern.h +++ b/source/blender/editors/space_buttons/buttons_intern.h @@ -47,17 +47,17 @@ struct uiLayout; struct wmOperatorType; /* buts->scaflag */ -#define BUTS_SENS_SEL 1 -#define BUTS_SENS_ACT 2 -#define BUTS_SENS_LINK 4 -#define BUTS_CONT_SEL 8 -#define BUTS_CONT_ACT 16 -#define BUTS_CONT_LINK 32 -#define BUTS_ACT_SEL 64 -#define BUTS_ACT_ACT 128 -#define BUTS_ACT_LINK 256 -#define BUTS_SENS_STATE 512 -#define BUTS_ACT_STATE 1024 +#define BUTS_SENS_SEL 1 +#define BUTS_SENS_ACT 2 +#define BUTS_SENS_LINK 4 +#define BUTS_CONT_SEL 8 +#define BUTS_CONT_ACT 16 +#define BUTS_CONT_LINK 32 +#define BUTS_ACT_SEL 64 +#define BUTS_ACT_ACT 128 +#define BUTS_ACT_LINK 256 +#define BUTS_SENS_STATE 512 +#define BUTS_ACT_STATE 1024 /* context data */ diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c index ec1c74013e0..c29a8c3934e 100644 --- a/source/blender/editors/space_buttons/buttons_ops.c +++ b/source/blender/editors/space_buttons/buttons_ops.c @@ -56,22 +56,22 @@ #include "UI_interface.h" #include "UI_resources.h" -#include "buttons_intern.h" // own include +#include "buttons_intern.h" /* own include */ /********************** toolbox operator *********************/ static int toolbox_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event)) { - bScreen *sc= CTX_wm_screen(C); - SpaceButs *sbuts= CTX_wm_space_buts(C); + bScreen *sc = CTX_wm_screen(C); + SpaceButs *sbuts = CTX_wm_space_buts(C); PointerRNA ptr; uiPopupMenu *pup; uiLayout *layout; RNA_pointer_create(&sc->id, &RNA_SpaceProperties, sbuts, &ptr); - pup= uiPupMenuBegin(C, "Align", ICON_NONE); - layout= uiPupMenuLayout(pup); + pup = uiPupMenuBegin(C, "Align", ICON_NONE); + layout = uiPupMenuLayout(pup); uiItemsEnumR(layout, &ptr, "align"); uiPupMenuEnd(C, pup); @@ -99,15 +99,15 @@ typedef struct FileBrowseOp { static int file_browse_exec(bContext *C, wmOperator *op) { - FileBrowseOp *fbo= op->customdata; + FileBrowseOp *fbo = op->customdata; ID *id; char *str, path[FILE_MAX]; - const char *path_prop= RNA_struct_find_property(op->ptr, "directory") ? "directory" : "filepath"; + const char *path_prop = RNA_struct_find_property(op->ptr, "directory") ? "directory" : "filepath"; - if (RNA_struct_property_is_set(op->ptr, path_prop)==0 || fbo==NULL) + if (RNA_struct_property_is_set(op->ptr, path_prop) == 0 || fbo == NULL) return OPERATOR_CANCELLED; - str= RNA_string_get_alloc(op->ptr, path_prop, NULL, 0); + 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) { @@ -119,7 +119,7 @@ static int file_browse_exec(bContext *C, wmOperator *op) BLI_path_abs(path, id ? ID_BLEND_PATH(G.main, id) : G.main->name); if (BLI_is_dir(path)) { - str = MEM_reallocN(str, strlen(str)+2); + str = MEM_reallocN(str, strlen(str) + 2); BLI_add_slash(str); } else @@ -133,7 +133,7 @@ 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); + wmOperator *redo_op = WM_operator_last_redo(C); if (redo_op) { if (fbo->ptr.data == redo_op->ptr->data) { ED_undo_operator_repeat(C, redo_op); @@ -149,7 +149,7 @@ static int file_browse_exec(bContext *C, wmOperator *op) static int file_browse_cancel(bContext *UNUSED(C), wmOperator *op) { MEM_freeN(op->customdata); - op->customdata= NULL; + op->customdata = NULL; return OPERATOR_CANCELLED; } @@ -171,7 +171,7 @@ static int file_browse_invoke(bContext *C, wmOperator *op, wmEvent *event) if (!prop) return OPERATOR_CANCELLED; - str= RNA_property_string_get_alloc(&ptr, prop, NULL, 0, NULL); + 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 */ @@ -179,9 +179,9 @@ static int file_browse_invoke(bContext *C, wmOperator *op, wmEvent *event) PointerRNA props_ptr; if (event->alt) { - char *lslash= BLI_last_slash(str); + char *lslash = BLI_last_slash(str); if (lslash) - *lslash= '\0'; + *lslash = '\0'; } @@ -194,11 +194,11 @@ static int file_browse_invoke(bContext *C, wmOperator *op, wmEvent *event) return OPERATOR_CANCELLED; } else { - const char *path_prop= RNA_struct_find_property(op->ptr, "directory") ? "directory" : "filepath"; - fbo= MEM_callocN(sizeof(FileBrowseOp), "FileBrowseOp"); - fbo->ptr= ptr; - fbo->prop= prop; - op->customdata= fbo; + const char *path_prop = RNA_struct_find_property(op->ptr, "directory") ? "directory" : "filepath"; + fbo = MEM_callocN(sizeof(FileBrowseOp), "FileBrowseOp"); + fbo->ptr = ptr; + fbo->prop = prop; + op->customdata = fbo; RNA_string_set(op->ptr, path_prop, str); MEM_freeN(str); @@ -230,7 +230,7 @@ void BUTTONS_OT_file_browse(wmOperatorType *ot) ot->cancel = file_browse_cancel; /* properties */ - WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY); + WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY); } /* second operator, only difference from BUTTONS_OT_file_browse is WM_FILESEL_DIRECTORY */ @@ -247,5 +247,5 @@ void BUTTONS_OT_directory_browse(wmOperatorType *ot) ot->cancel = file_browse_cancel; /* properties */ - WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_DIRECTORY|WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY); + WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_DIRECTORY | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY); } diff --git a/source/blender/editors/space_buttons/buttons_texture.c b/source/blender/editors/space_buttons/buttons_texture.c index 88f66855cff..5c5c24f7bc1 100644 --- a/source/blender/editors/space_buttons/buttons_texture.c +++ b/source/blender/editors/space_buttons/buttons_texture.c @@ -68,17 +68,17 @@ #include "../interface/interface_intern.h" -#include "buttons_intern.h" // own include +#include "buttons_intern.h" // own include /************************* Texture User **************************/ static void buttons_texture_user_property_add(ListBase *users, ID *id, - PointerRNA ptr, PropertyRNA *prop, - const char *category, int icon, const char *name) + PointerRNA ptr, PropertyRNA *prop, + const char *category, int icon, const char *name) { ButsTextureUser *user = MEM_callocN(sizeof(ButsTextureUser), "ButsTextureUser"); - user->id= id; + user->id = id; user->ptr = ptr; user->prop = prop; user->category = category; @@ -90,12 +90,12 @@ static void buttons_texture_user_property_add(ListBase *users, ID *id, } static void buttons_texture_user_node_add(ListBase *users, ID *id, - bNodeTree *ntree, bNode *node, - const char *category, int icon, const char *name) + bNodeTree *ntree, bNode *node, + const char *category, int icon, const char *name) { ButsTextureUser *user = MEM_callocN(sizeof(ButsTextureUser), "ButsTextureUser"); - user->id= id; + user->id = id; user->ntree = ntree; user->node = node; user->category = category; @@ -107,12 +107,12 @@ static void buttons_texture_user_node_add(ListBase *users, ID *id, } static void buttons_texture_users_find_nodetree(ListBase *users, ID *id, - bNodeTree *ntree, const char *category) + bNodeTree *ntree, const char *category) { bNode *node; if (ntree) { - for (node=ntree->nodes.first; node; node=node->next) { + for (node = ntree->nodes.first; node; node = node->next) { if (node->typeinfo->nclass == NODE_CLASS_TEXTURE) { PointerRNA ptr; /* PropertyRNA *prop; */ /* UNUSED */ @@ -121,10 +121,10 @@ static void buttons_texture_users_find_nodetree(ListBase *users, ID *id, /* prop = RNA_struct_find_property(&ptr, "texture"); */ /* UNUSED */ buttons_texture_user_node_add(users, id, ntree, node, - category, RNA_struct_ui_icon(ptr.type), node->name); + category, RNA_struct_ui_icon(ptr.type), node->name); } else if (node->type == NODE_GROUP && node->id) { - buttons_texture_users_find_nodetree(users, id, (bNodeTree*)node->id, category); + buttons_texture_users_find_nodetree(users, id, (bNodeTree *)node->id, category); } } } @@ -140,48 +140,48 @@ static void buttons_texture_modifier_foreach(void *userData, Object *ob, Modifie prop = RNA_struct_find_property(&ptr, propname); buttons_texture_user_property_add(users, &ob->id, ptr, prop, - "Modifiers", RNA_struct_ui_icon(ptr.type), md->name); + "Modifiers", RNA_struct_ui_icon(ptr.type), md->name); } static void buttons_texture_users_from_context(ListBase *users, const bContext *C, SpaceButs *sbuts) { - Scene *scene= NULL; - Object *ob= NULL; - Material *ma= NULL; - Lamp *la= NULL; - World *wrld= NULL; - Brush *brush= NULL; + Scene *scene = NULL; + Object *ob = NULL; + Material *ma = NULL; + Lamp *la = NULL; + World *wrld = NULL; + Brush *brush = NULL; ID *pinid = sbuts->pinid; /* get data from context */ if (pinid) { if (GS(pinid->name) == ID_SCE) - scene= (Scene*)pinid; + scene = (Scene *)pinid; else if (GS(pinid->name) == ID_OB) - ob= (Object*)pinid; + ob = (Object *)pinid; else if (GS(pinid->name) == ID_LA) - la= (Lamp*)pinid; + la = (Lamp *)pinid; else if (GS(pinid->name) == ID_WO) - wrld= (World*)pinid; + wrld = (World *)pinid; else if (GS(pinid->name) == ID_MA) - ma= (Material*)pinid; + ma = (Material *)pinid; else if (GS(pinid->name) == ID_BR) - brush= (Brush*)pinid; + brush = (Brush *)pinid; } if (!scene) - scene= CTX_data_scene(C); + scene = CTX_data_scene(C); if (!(pinid || pinid == &scene->id)) { - ob= (scene->basact)? scene->basact->object: NULL; - wrld= scene->world; - brush= paint_brush(paint_get_active(scene)); + ob = (scene->basact) ? scene->basact->object : NULL; + wrld = scene->world; + brush = paint_brush(paint_get_active(scene)); } if (ob && ob->type == OB_LAMP && !la) - la= ob->data; + la = ob->data; if (ob && !ma) - ma= give_current_material(ob, ob->actcol); + ma = give_current_material(ob, ob->actcol); /* fill users */ users->first = users->last = NULL; @@ -194,7 +194,7 @@ static void buttons_texture_users_from_context(ListBase *users, const bContext * buttons_texture_users_find_nodetree(users, &wrld->id, wrld->nodetree, "World"); if (ob) { - ParticleSystem *psys= psys_get_current(ob); + ParticleSystem *psys = psys_get_current(ob); MTex *mtex; int a; @@ -204,7 +204,7 @@ static void buttons_texture_users_from_context(ListBase *users, const bContext * /* particle systems */ 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) { @@ -215,7 +215,7 @@ static void buttons_texture_users_from_context(ListBase *users, const bContext * prop = RNA_struct_find_property(&ptr, "texture"); buttons_texture_user_property_add(users, &psys->part->id, ptr, prop, - "Particles", RNA_struct_ui_icon(&RNA_ParticleSettings), psys->name); + "Particles", RNA_struct_ui_icon(&RNA_ParticleSettings), psys->name); } } } @@ -229,7 +229,7 @@ static void buttons_texture_users_from_context(ListBase *users, const bContext * prop = RNA_struct_find_property(&ptr, "texture"); buttons_texture_user_property_add(users, &ob->id, ptr, prop, - "Fields", ICON_FORCE_TEXTURE, "Texture Field"); + "Fields", ICON_FORCE_TEXTURE, "Texture Field"); } } @@ -239,10 +239,10 @@ static void buttons_texture_users_from_context(ListBase *users, const bContext * PropertyRNA *prop; RNA_pointer_create(&brush->id, &RNA_BrushTextureSlot, &brush->mtex, &ptr); - prop= RNA_struct_find_property(&ptr, "texture"); + prop = RNA_struct_find_property(&ptr, "texture"); buttons_texture_user_property_add(users, &brush->id, ptr, prop, - "Brush", ICON_BRUSH_DATA, brush->id.name+2); + "Brush", ICON_BRUSH_DATA, brush->id.name + 2); } } @@ -250,22 +250,22 @@ void buttons_texture_context_compute(const bContext *C, SpaceButs *sbuts) { /* gatheravailable texture users in context. runs on every draw of * properties editor, before the buttons are created. */ - ButsContextTexture *ct= sbuts->texuser; - Scene *scene= CTX_data_scene(C); + ButsContextTexture *ct = sbuts->texuser; + Scene *scene = CTX_data_scene(C); if (!BKE_scene_use_new_shading_nodes(scene)) { if (ct) { BLI_freelistN(&ct->users); MEM_freeN(ct); - sbuts->texuser= NULL; + sbuts->texuser = NULL; } return; } if (!ct) { - ct= MEM_callocN(sizeof(ButsContextTexture), "ButsContextTexture"); - sbuts->texuser= ct; + ct = MEM_callocN(sizeof(ButsContextTexture), "ButsContextTexture"); + sbuts->texuser = ct; } else { BLI_freelistN(&ct->users); @@ -275,7 +275,7 @@ void buttons_texture_context_compute(const bContext *C, SpaceButs *sbuts) /* set one user as active based on active index */ if (ct->index >= BLI_countlist(&ct->users)) - ct->index= 0; + ct->index = 0; ct->user = BLI_findlink(&ct->users, ct->index); ct->texture = NULL; @@ -287,7 +287,7 @@ void buttons_texture_context_compute(const bContext *C, SpaceButs *sbuts) /* get texture datablock pointer if it's a property */ texptr = RNA_property_pointer_get(&ct->user->ptr, ct->user->prop); - tex = (RNA_struct_is_a(texptr.type, &RNA_Texture))? texptr.data: NULL; + tex = (RNA_struct_is_a(texptr.type, &RNA_Texture)) ? texptr.data : NULL; ct->texture = tex; } @@ -296,7 +296,7 @@ void buttons_texture_context_compute(const bContext *C, SpaceButs *sbuts) /* 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) { + 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; @@ -313,8 +313,8 @@ static void template_texture_select(bContext *C, void *user_p, void *UNUSED(arg) { /* callback when selecting a texture user in the menu */ SpaceButs *sbuts = CTX_wm_space_buts(C); - ButsContextTexture *ct= (sbuts)? sbuts->texuser: NULL; - ButsTextureUser *user = (ButsTextureUser*)user_p; + ButsContextTexture *ct = (sbuts) ? sbuts->texuser : NULL; + ButsTextureUser *user = (ButsTextureUser *)user_p; PointerRNA texptr; Tex *tex; @@ -328,7 +328,7 @@ static void template_texture_select(bContext *C, void *user_p, void *UNUSED(arg) } else { texptr = RNA_property_pointer_get(&user->ptr, user->prop); - tex = (RNA_struct_is_a(texptr.type, &RNA_Texture))? texptr.data: NULL; + tex = (RNA_struct_is_a(texptr.type, &RNA_Texture)) ? texptr.data : NULL; ct->texture = tex; } @@ -341,27 +341,27 @@ static void template_texture_user_menu(bContext *C, uiLayout *layout, void *UNUS { /* callback when opening texture user selection menu, to create buttons. */ SpaceButs *sbuts = CTX_wm_space_buts(C); - ButsContextTexture *ct= (sbuts)? sbuts->texuser: NULL; + ButsContextTexture *ct = (sbuts) ? sbuts->texuser : NULL; ButsTextureUser *user; 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) { uiItemL(layout, user->category, ICON_NONE); - but= block->buttons.last; - but->flag= UI_TEXT_LEFT; + but = block->buttons.last; + but->flag = UI_TEXT_LEFT; } /* create button */ BLI_snprintf(name, UI_MAX_NAME_STR, " %s", user->name); - but = uiDefIconTextBut(block, BUT, 0, user->icon, name, 0, 0, UI_UNIT_X*4, UI_UNIT_Y, - NULL, 0.0, 0.0, 0.0, 0.0, ""); + but = uiDefIconTextBut(block, BUT, 0, user->icon, name, 0, 0, UI_UNIT_X * 4, UI_UNIT_Y, + NULL, 0.0, 0.0, 0.0, 0.0, ""); uiButSetNFunc(but, template_texture_select, MEM_dupallocN(user), NULL); last_category = user->category; @@ -374,7 +374,7 @@ void uiTemplateTextureUser(uiLayout *layout, bContext *C) * gathered before drawing in ButsContextTexture, we merely need to * display the current item. */ SpaceButs *sbuts = CTX_wm_space_buts(C); - ButsContextTexture *ct= (sbuts)? sbuts->texuser: NULL; + ButsContextTexture *ct = (sbuts) ? sbuts->texuser : NULL; uiBlock *block = uiLayoutGetBlock(layout); uiBut *but; ButsTextureUser *user; @@ -384,7 +384,7 @@ void uiTemplateTextureUser(uiLayout *layout, bContext *C) return; /* get current user */ - user= ct->user; + user = ct->user; if (!user) { uiItemL(layout, "No textures in context.", ICON_NONE); @@ -396,15 +396,15 @@ void uiTemplateTextureUser(uiLayout *layout, bContext *C) if (user->icon) { but = uiDefIconTextMenuBut(block, template_texture_user_menu, NULL, - user->icon, name, 0, 0, UI_UNIT_X*4, UI_UNIT_Y, ""); + user->icon, name, 0, 0, UI_UNIT_X * 4, UI_UNIT_Y, ""); } else { but = uiDefMenuBut(block, template_texture_user_menu, NULL, - name, 0, 0, UI_UNIT_X*4, UI_UNIT_Y, ""); + name, 0, 0, UI_UNIT_X * 4, UI_UNIT_Y, ""); } /* some cosmetic tweaks */ - but->type= MENU; + but->type = MENU; but->flag |= UI_TEXT_LEFT; but->flag &= ~UI_ICON_SUBMENU; } @@ -414,13 +414,13 @@ void uiTemplateTextureUser(uiLayout *layout, bContext *C) static void template_texture_show(bContext *C, void *data_p, void *prop_p) { SpaceButs *sbuts = CTX_wm_space_buts(C); - ButsContextTexture *ct= (sbuts)? sbuts->texuser: NULL; + ButsContextTexture *ct = (sbuts) ? sbuts->texuser : NULL; ButsTextureUser *user; if (!ct) return; - for (user=ct->users.first; user; user=user->next) + for (user = ct->users.first; user; user = user->next) if (user->ptr.data == data_p && user->prop == prop_p) break; @@ -429,9 +429,9 @@ static void template_texture_show(bContext *C, void *data_p, void *prop_p) template_texture_select(C, user, NULL); /* change context */ - sbuts->mainb= BCONTEXT_TEXTURE; - sbuts->mainbuser= sbuts->mainb; - sbuts->preview= 1; + sbuts->mainb = BCONTEXT_TEXTURE; + sbuts->mainbuser = sbuts->mainb; + sbuts->preview = 1; /* redraw editor */ ED_area_tag_redraw(CTX_wm_area(C)); @@ -442,7 +442,7 @@ void uiTemplateTextureShow(uiLayout *layout, bContext *C, PointerRNA *ptr, Prope { /* button to quickly show texture in texture tab */ SpaceButs *sbuts = CTX_wm_space_buts(C); - ButsContextTexture *ct= (sbuts)? sbuts->texuser: NULL; + ButsContextTexture *ct = (sbuts) ? sbuts->texuser : NULL; ButsTextureUser *user; /* only show button in other tabs in properties editor */ @@ -450,7 +450,7 @@ void uiTemplateTextureShow(uiLayout *layout, bContext *C, PointerRNA *ptr, Prope return; /* find corresponding texture user */ - for (user=ct->users.first; user; user=user->next) + for (user = ct->users.first; user; user = user->next) if (user->ptr.data == ptr->data && user->prop == prop) break; @@ -460,7 +460,7 @@ void uiTemplateTextureShow(uiLayout *layout, bContext *C, PointerRNA *ptr, Prope uiBut *but; but = uiDefIconBut(block, BUT, 0, ICON_BUTS, 0, 0, UI_UNIT_X, UI_UNIT_Y, - NULL, 0.0, 0.0, 0.0, 0.0, "Show texture in texture tab"); + NULL, 0.0, 0.0, 0.0, 0.0, "Show texture in texture tab"); uiButSetFunc(but, template_texture_show, user->ptr.data, user->prop); } } diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index b2a58041832..e102abeecf0 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -55,7 +55,7 @@ #include "ED_render.h" -#include "buttons_intern.h" // own include +#include "buttons_intern.h" /* own include */ /* ******************** default callbacks for buttons space ***************** */ @@ -64,30 +64,30 @@ static SpaceLink *buttons_new(const bContext *UNUSED(C)) ARegion *ar; SpaceButs *sbuts; - sbuts= MEM_callocN(sizeof(SpaceButs), "initbuts"); - sbuts->spacetype= SPACE_BUTS; - sbuts->align= BUT_VERTICAL; + sbuts = MEM_callocN(sizeof(SpaceButs), "initbuts"); + sbuts->spacetype = SPACE_BUTS; + sbuts->align = BUT_VERTICAL; /* header */ - ar= MEM_callocN(sizeof(ARegion), "header for buts"); + ar = MEM_callocN(sizeof(ARegion), "header for buts"); BLI_addtail(&sbuts->regionbase, ar); - ar->regiontype= RGN_TYPE_HEADER; - ar->alignment= RGN_ALIGN_TOP; + ar->regiontype = RGN_TYPE_HEADER; + ar->alignment = RGN_ALIGN_TOP; #if 0 /* context area */ - ar= MEM_callocN(sizeof(ARegion), "context area for buts"); + ar = MEM_callocN(sizeof(ARegion), "context area for buts"); BLI_addtail(&sbuts->regionbase, ar); - ar->regiontype= RGN_TYPE_CHANNELS; - ar->alignment= RGN_ALIGN_TOP; + ar->regiontype = RGN_TYPE_CHANNELS; + ar->alignment = RGN_ALIGN_TOP; #endif /* main area */ - ar= MEM_callocN(sizeof(ARegion), "main area for buts"); + ar = MEM_callocN(sizeof(ARegion), "main area for buts"); BLI_addtail(&sbuts->regionbase, ar); - ar->regiontype= RGN_TYPE_WINDOW; + ar->regiontype = RGN_TYPE_WINDOW; return (SpaceLink *)sbuts; } @@ -95,13 +95,13 @@ static SpaceLink *buttons_new(const bContext *UNUSED(C)) /* not spacelink itself */ static void buttons_free(SpaceLink *sl) { - SpaceButs *sbuts= (SpaceButs*) sl; + SpaceButs *sbuts = (SpaceButs *) sl; if (sbuts->path) MEM_freeN(sbuts->path); if (sbuts->texuser) { - ButsContextTexture *ct= sbuts->texuser; + ButsContextTexture *ct = sbuts->texuser; BLI_freelistN(&ct->users); MEM_freeN(ct); } @@ -110,24 +110,24 @@ static void buttons_free(SpaceLink *sl) /* spacetype; init callback */ static void buttons_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa) { - SpaceButs *sbuts= sa->spacedata.first; + SpaceButs *sbuts = sa->spacedata.first; /* auto-align based on size */ if (sbuts->align == BUT_AUTO || !sbuts->align) { if (sa->winx > sa->winy) - sbuts->align= BUT_HORIZONTAL; + sbuts->align = BUT_HORIZONTAL; else - sbuts->align= BUT_VERTICAL; + sbuts->align = BUT_VERTICAL; } } static SpaceLink *buttons_duplicate(SpaceLink *sl) { - SpaceButs *sbutsn= MEM_dupallocN(sl); + SpaceButs *sbutsn = MEM_dupallocN(sl); /* clear or remove stuff from old */ - sbutsn->path= NULL; - sbutsn->texuser= NULL; + sbutsn->path = NULL; + sbutsn->texuser = NULL; return (SpaceLink *)sbutsn; } @@ -146,8 +146,8 @@ static void buttons_main_area_init(wmWindowManager *wm, ARegion *ar) static void buttons_main_area_draw(const bContext *C, ARegion *ar) { /* draw entirely, view changes should be handled here */ - SpaceButs *sbuts= CTX_wm_space_buts(C); - int vertical= (sbuts->align == BUT_VERTICAL); + SpaceButs *sbuts = CTX_wm_space_buts(C); + int vertical = (sbuts->align == BUT_VERTICAL); buttons_context_compute(C, sbuts); @@ -178,8 +178,8 @@ static void buttons_main_area_draw(const bContext *C, ARegion *ar) else if (sbuts->mainb == BCONTEXT_BONE_CONSTRAINT) ED_region_panels(C, ar, vertical, "bone_constraint", sbuts->mainb); - sbuts->re_align= 0; - sbuts->mainbo= sbuts->mainb; + sbuts->re_align = 0; + sbuts->mainbo = sbuts->mainb; } static void buttons_operatortypes(void) @@ -205,7 +205,7 @@ static void buttons_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar) static void buttons_header_area_draw(const bContext *C, ARegion *ar) { /* clear */ - UI_ThemeClearColor(ED_screen_area_active(C)?TH_HEADER:TH_HEADERDESEL); + UI_ThemeClearColor(ED_screen_area_active(C) ? TH_HEADER : TH_HEADERDESEL); glClear(GL_COLOR_BUFFER_BIT); /* set view2d view matrix for scrolling (without scrollers) */ @@ -221,7 +221,7 @@ static void buttons_header_area_draw(const bContext *C, ARegion *ar) * showing that button set, to reduce unnecessary drawing. */ static void buttons_area_redraw(ScrArea *sa, short buttons) { - SpaceButs *sbuts= sa->spacedata.first; + SpaceButs *sbuts = sa->spacedata.first; /* if the area's current button set is equal to the one to redraw */ if (sbuts->mainb == buttons) @@ -231,7 +231,7 @@ static void buttons_area_redraw(ScrArea *sa, short buttons) /* reused! */ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn) { - SpaceButs *sbuts= sa->spacedata.first; + SpaceButs *sbuts = sa->spacedata.first; /* context changes */ switch (wmn->category) { @@ -243,11 +243,11 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn) case ND_FRAME: /* any buttons area can have animated properties so redraw all */ ED_area_tag_redraw(sa); - sbuts->preview= 1; + sbuts->preview = 1; break; case ND_OB_ACTIVE: ED_area_tag_redraw(sa); - sbuts->preview= 1; + sbuts->preview = 1; break; case ND_KEYINGSET: buttons_area_redraw(sa, BCONTEXT_SCENE); @@ -265,7 +265,7 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn) switch (wmn->data) { case ND_TRANSFORM: buttons_area_redraw(sa, BCONTEXT_OBJECT); - buttons_area_redraw(sa, BCONTEXT_DATA); /* autotexpace flag */ + buttons_area_redraw(sa, BCONTEXT_DATA); /* autotexpace flag */ break; case ND_POSE: buttons_area_redraw(sa, BCONTEXT_DATA); @@ -280,7 +280,7 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn) ED_area_tag_redraw(sa); else buttons_area_redraw(sa, BCONTEXT_MODIFIER); - buttons_area_redraw(sa, BCONTEXT_PHYSICS); + buttons_area_redraw(sa, BCONTEXT_PHYSICS); break; case ND_CONSTRAINT: buttons_area_redraw(sa, BCONTEXT_CONSTRAINT); @@ -289,7 +289,7 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn) case ND_PARTICLE: if (wmn->action == NA_EDITED) buttons_area_redraw(sa, BCONTEXT_PARTICLE); - sbuts->preview= 1; + sbuts->preview = 1; break; case ND_DRAW: buttons_area_redraw(sa, BCONTEXT_OBJECT); @@ -298,7 +298,7 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn) case ND_SHADING: case ND_SHADING_DRAW: /* currently works by redraws... if preview is set, it (re)starts job */ - sbuts->preview= 1; + sbuts->preview = 1; break; default: /* Not all object RNA props have a ND_ notifier (yet) */ @@ -321,17 +321,17 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn) case ND_SHADING_DRAW: case ND_NODES: /* currently works by redraws... if preview is set, it (re)starts job */ - sbuts->preview= 1; + sbuts->preview = 1; break; } break; case NC_WORLD: buttons_area_redraw(sa, BCONTEXT_WORLD); - sbuts->preview= 1; + sbuts->preview = 1; break; case NC_LAMP: buttons_area_redraw(sa, BCONTEXT_DATA); - sbuts->preview= 1; + sbuts->preview = 1; break; case NC_BRUSH: buttons_area_redraw(sa, BCONTEXT_TEXTURE); @@ -339,7 +339,7 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn) case NC_TEXTURE: case NC_IMAGE: ED_area_tag_redraw(sa); - sbuts->preview= 1; + sbuts->preview = 1; break; case NC_SPACE: if (wmn->data == ND_SPACE_PROPERTIES) @@ -358,17 +358,17 @@ 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) - sbuts->preview= 1; + sbuts->preview = 1; } break; /* Listener for preview render, when doing an global undo. */ case NC_WINDOW: ED_area_tag_redraw(sa); - sbuts->preview= 1; + sbuts->preview = 1; break; } @@ -379,39 +379,39 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn) /* only called once, from space/spacetypes.c */ void ED_spacetype_buttons(void) { - SpaceType *st= MEM_callocN(sizeof(SpaceType), "spacetype buttons"); + SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype buttons"); ARegionType *art; - st->spaceid= SPACE_BUTS; + st->spaceid = SPACE_BUTS; strncpy(st->name, "Buttons", BKE_ST_MAXNAME); - st->new= buttons_new; - st->free= buttons_free; - st->init= buttons_init; - st->duplicate= buttons_duplicate; - st->operatortypes= buttons_operatortypes; - st->keymap= buttons_keymap; - st->listener= buttons_area_listener; - st->context= buttons_context; + st->new = buttons_new; + st->free = buttons_free; + st->init = buttons_init; + st->duplicate = buttons_duplicate; + st->operatortypes = buttons_operatortypes; + st->keymap = buttons_keymap; + st->listener = buttons_area_listener; + st->context = buttons_context; /* regions: main window */ - art= MEM_callocN(sizeof(ARegionType), "spacetype buttons region"); + art = MEM_callocN(sizeof(ARegionType), "spacetype buttons region"); art->regionid = RGN_TYPE_WINDOW; - art->init= buttons_main_area_init; - art->draw= buttons_main_area_draw; - art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_FRAMES; + art->init = buttons_main_area_init; + art->draw = buttons_main_area_draw; + art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_FRAMES; BLI_addhead(&st->regiontypes, art); buttons_context_register(art); /* regions: header */ - art= MEM_callocN(sizeof(ARegionType), "spacetype buttons region"); + art = MEM_callocN(sizeof(ARegionType), "spacetype buttons region"); art->regionid = RGN_TYPE_HEADER; - art->prefsizey= HEADERY; - art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES|ED_KEYMAP_HEADER; + art->prefsizey = HEADERY; + art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_HEADER; - art->init= buttons_header_area_init; - art->draw= buttons_header_area_draw; + art->init = buttons_header_area_init; + art->draw = buttons_header_area_draw; BLI_addhead(&st->regiontypes, art); BKE_spacetype_register(st); |