From f33000526679c543c1398a68a84b93dad521a5cb Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 11 Jan 2018 09:55:41 +1100 Subject: Cleanup: BKE naming conventions for datablock add/localize Conventions were already followed nearly everywhere. --- source/blender/blenkernel/BKE_action.h | 2 +- source/blender/blenkernel/BKE_lamp.h | 2 +- source/blender/blenkernel/BKE_material.h | 2 +- source/blender/blenkernel/BKE_particle.h | 2 +- source/blender/blenkernel/BKE_world.h | 4 ++-- source/blender/blenkernel/intern/action.c | 2 +- source/blender/blenkernel/intern/anim_sys.c | 4 ++-- source/blender/blenkernel/intern/ipo.c | 4 ++-- source/blender/blenkernel/intern/lamp.c | 4 ++-- source/blender/blenkernel/intern/material.c | 2 +- source/blender/blenkernel/intern/particle.c | 4 ++-- source/blender/blenkernel/intern/world.c | 6 +++--- source/blender/blenloader/intern/versioning_legacy.c | 2 +- source/blender/editors/animation/keyframing.c | 2 +- source/blender/editors/armature/pose_lib.c | 2 +- source/blender/editors/physics/particle_object.c | 2 +- source/blender/editors/render/render_preview.c | 6 +++--- source/blender/editors/render/render_shading.c | 2 +- source/blender/editors/space_action/action_data.c | 2 +- source/blender/makesrna/intern/rna_fluidsim.c | 2 +- source/blender/makesrna/intern/rna_main_api.c | 6 +++--- source/blender/render/intern/source/render_texture.c | 2 +- 22 files changed, 33 insertions(+), 33 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/BKE_action.h b/source/blender/blenkernel/BKE_action.h index 28be2b04c71..f7ebe85bcef 100644 --- a/source/blender/blenkernel/BKE_action.h +++ b/source/blender/blenkernel/BKE_action.h @@ -55,7 +55,7 @@ extern "C" { /* Action Lib Stuff ----------------- */ /* Allocate a new bAction with the given name */ -struct bAction *add_empty_action(struct Main *bmain, const char name[]); +struct bAction *BKE_action_add(struct Main *bmain, const char name[]); void BKE_action_copy_data(struct Main *bmain, struct bAction *act_dst, const struct bAction *act_src, const int flag); /* Allocate a copy of the given Action and all its data */ diff --git a/source/blender/blenkernel/BKE_lamp.h b/source/blender/blenkernel/BKE_lamp.h index b68da654520..3673e657b33 100644 --- a/source/blender/blenkernel/BKE_lamp.h +++ b/source/blender/blenkernel/BKE_lamp.h @@ -46,7 +46,7 @@ void BKE_lamp_init(struct Lamp *la); struct Lamp *BKE_lamp_add(struct Main *bmain, const char *name) ATTR_WARN_UNUSED_RESULT; void BKE_lamp_copy_data(struct Main *bmain, struct Lamp *la_dst, const struct Lamp *la_src, const int flag); struct Lamp *BKE_lamp_copy(struct Main *bmain, const struct Lamp *la) ATTR_WARN_UNUSED_RESULT; -struct Lamp *localize_lamp(struct Lamp *la) ATTR_WARN_UNUSED_RESULT; +struct Lamp *BKE_lamp_localize(struct Lamp *la) ATTR_WARN_UNUSED_RESULT; void BKE_lamp_make_local(struct Main *bmain, struct Lamp *la, const bool lib_local); void BKE_lamp_free(struct Lamp *la); diff --git a/source/blender/blenkernel/BKE_material.h b/source/blender/blenkernel/BKE_material.h index c6ebda2c399..f7850913014 100644 --- a/source/blender/blenkernel/BKE_material.h +++ b/source/blender/blenkernel/BKE_material.h @@ -56,7 +56,7 @@ void BKE_material_remap_object_calc(struct Object *ob_dst, struct Object *ob_sr struct Material *BKE_material_add(struct Main *bmain, const char *name); void BKE_material_copy_data(struct Main *bmain, struct Material *ma_dst, const struct Material *ma_src, const int flag); struct Material *BKE_material_copy(struct Main *bmain, const struct Material *ma); -struct Material *localize_material(struct Material *ma); +struct Material *BKE_material_localize(struct Material *ma); struct Material *give_node_material(struct Material *ma); /* returns node material or self */ void BKE_material_make_local(struct Main *bmain, struct Material *ma, const bool lib_local); diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h index ddb4f9c37bd..b43d000ed35 100644 --- a/source/blender/blenkernel/BKE_particle.h +++ b/source/blender/blenkernel/BKE_particle.h @@ -323,7 +323,7 @@ struct ParticleSystemModifierData *psys_get_modifier(struct Object *ob, struct P struct ModifierData *object_add_particle_system(struct Scene *scene, struct Object *ob, const char *name); void object_remove_particle_system(struct Scene *scene, struct Object *ob); -struct ParticleSettings *psys_new_settings(const char *name, struct Main *main); +struct ParticleSettings *BKE_particlesettings_add(struct Main *main, const char *name); void BKE_particlesettings_copy_data( struct Main *bmain, struct ParticleSettings *part_dst, const struct ParticleSettings *part_src, const int flag); diff --git a/source/blender/blenkernel/BKE_world.h b/source/blender/blenkernel/BKE_world.h index 2a811496bb9..dfa367afeb2 100644 --- a/source/blender/blenkernel/BKE_world.h +++ b/source/blender/blenkernel/BKE_world.h @@ -38,10 +38,10 @@ struct World; void BKE_world_free(struct World *sc); void BKE_world_init(struct World *wrld); -struct World *add_world(struct Main *bmian, const char *name); +struct World *BKE_world_add(struct Main *bmian, const char *name); void BKE_world_copy_data(struct Main *bmain, struct World *wrld_dst, const struct World *wrld_src, const int flag); struct World *BKE_world_copy(struct Main *bmain, const struct World *wrld); -struct World *localize_world(struct World *wrld); +struct World *BKE_world_localize(struct World *wrld); void BKE_world_make_local(struct Main *bmain, struct World *wrld, const bool lib_local); #endif diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index 5c2fe0bb040..034248df8d5 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -84,7 +84,7 @@ /* ***************** Library data level operations on action ************** */ -bAction *add_empty_action(Main *bmain, const char name[]) +bAction *BKE_action_add(Main *bmain, const char name[]) { bAction *act; diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index ba8f454aa47..2c6339de500 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -527,7 +527,7 @@ void BKE_animdata_separate_by_basepath(ID *srcID, ID *dstID, ListBase *basepaths if (srcAdt->action) { /* set up an action if necessary, and name it in a similar way so that it can be easily found again */ if (dstAdt->action == NULL) { - dstAdt->action = add_empty_action(G.main, srcAdt->action->id.name + 2); + dstAdt->action = BKE_action_add(G.main, srcAdt->action->id.name + 2); } else if (dstAdt->action == srcAdt->action) { printf("Argh! Source and Destination share animation! ('%s' and '%s' both use '%s') Making new empty action\n", @@ -535,7 +535,7 @@ void BKE_animdata_separate_by_basepath(ID *srcID, ID *dstID, ListBase *basepaths /* TODO: review this... */ id_us_min(&dstAdt->action->id); - dstAdt->action = add_empty_action(G.main, dstAdt->action->id.name + 2); + dstAdt->action = BKE_action_add(G.main, dstAdt->action->id.name + 2); } /* loop over base paths, trying to fix for each one... */ diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c index 90247441631..00cf40f06cd 100644 --- a/source/blender/blenkernel/intern/ipo.c +++ b/source/blender/blenkernel/intern/ipo.c @@ -1559,7 +1559,7 @@ static void ipo_to_animdata(ID *id, Ipo *ipo, char actname[], char constname[], BLI_snprintf(nameBuf, sizeof(nameBuf), "CDA:%s", ipo->id.name + 2); - adt->action = add_empty_action(G.main, nameBuf); + adt->action = BKE_action_add(G.main, nameBuf); if (G.debug & G_DEBUG) printf("\t\tadded new action - '%s'\n", nameBuf); } @@ -2107,7 +2107,7 @@ void do_versions_ipos_to_animato(Main *main) bAction *new_act; /* add a new action for this, and convert all data into that action */ - new_act = add_empty_action(main, id->name + 2); + new_act = BKE_action_add(main, id->name + 2); ipo_to_animato(NULL, ipo, NULL, NULL, NULL, NULL, &new_act->curves, &drivers); new_act->idroot = ipo->blocktype; } diff --git a/source/blender/blenkernel/intern/lamp.c b/source/blender/blenkernel/intern/lamp.c index fe481905fb2..3a4c920d8fb 100644 --- a/source/blender/blenkernel/intern/lamp.c +++ b/source/blender/blenkernel/intern/lamp.c @@ -156,7 +156,7 @@ Lamp *BKE_lamp_copy(Main *bmain, const Lamp *la) return la_copy; } -Lamp *localize_lamp(Lamp *la) +Lamp *BKE_lamp_localize(Lamp *la) { /* TODO replace with something like * Lamp *la_copy; @@ -172,7 +172,7 @@ Lamp *localize_lamp(Lamp *la) for (a = 0; a < MAX_MTEX; a++) { if (lan->mtex[a]) { - lan->mtex[a] = MEM_mallocN(sizeof(MTex), "localize_lamp"); + lan->mtex[a] = MEM_mallocN(sizeof(MTex), __func__); memcpy(lan->mtex[a], la->mtex[a], sizeof(MTex)); } } diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index 07c2ff4ba9d..0dd7047a376 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -267,7 +267,7 @@ Material *BKE_material_copy(Main *bmain, const Material *ma) } /* XXX (see above) material copy without adding to main dbase */ -Material *localize_material(Material *ma) +Material *BKE_material_localize(Material *ma) { /* TODO replace with something like * Material *ma_copy; diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index cbbb44c55cb..8b3910c1d53 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -3136,7 +3136,7 @@ ModifierData *object_add_particle_system(Scene *scene, Object *ob, const char *n psys->pointcache = BKE_ptcache_add(&psys->ptcaches); BLI_addtail(&ob->particlesystem, psys); - psys->part = psys_new_settings(DATA_("ParticleSettings"), NULL); + psys->part = BKE_particlesettings_add(NULL, DATA_("ParticleSettings")); if (BLI_listbase_count_ex(&ob->particlesystem, 2) > 1) BLI_snprintf(psys->name, sizeof(psys->name), DATA_("ParticleSystem %i"), BLI_listbase_count(&ob->particlesystem)); @@ -3294,7 +3294,7 @@ static void default_particle_settings(ParticleSettings *part) } -ParticleSettings *psys_new_settings(const char *name, Main *main) +ParticleSettings *BKE_particlesettings_add(Main *main, const char *name) { ParticleSettings *part; diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c index acab94be9c5..10fcfaa444f 100644 --- a/source/blender/blenkernel/intern/world.c +++ b/source/blender/blenkernel/intern/world.c @@ -108,7 +108,7 @@ void BKE_world_init(World *wrld) wrld->mistdist = 25.0f; } -World *add_world(Main *bmain, const char *name) +World *BKE_world_add(Main *bmain, const char *name) { World *wrld; @@ -158,7 +158,7 @@ World *BKE_world_copy(Main *bmain, const World *wrld) return wrld_copy; } -World *localize_world(World *wrld) +World *BKE_world_localize(World *wrld) { /* TODO replace with something like * World *wrld_copy; @@ -174,7 +174,7 @@ World *localize_world(World *wrld) for (a = 0; a < MAX_MTEX; a++) { if (wrld->mtex[a]) { - wrldn->mtex[a] = MEM_mallocN(sizeof(MTex), "localize_world"); + wrldn->mtex[a] = MEM_mallocN(sizeof(MTex), __func__); memcpy(wrldn->mtex[a], wrld->mtex[a], sizeof(MTex)); } } diff --git a/source/blender/blenloader/intern/versioning_legacy.c b/source/blender/blenloader/intern/versioning_legacy.c index ad37679800b..acb9ad581c4 100644 --- a/source/blender/blenloader/intern/versioning_legacy.c +++ b/source/blender/blenloader/intern/versioning_legacy.c @@ -3029,7 +3029,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *main) psys = MEM_callocN(sizeof(ParticleSystem), "particle_system"); psys->pointcache = BKE_ptcache_add(&psys->ptcaches); - part = psys->part = psys_new_settings("ParticleSettings", main); + part = psys->part = BKE_particlesettings_add(main, "ParticleSettings"); /* needed for proper libdata lookup */ blo_do_versions_oldnewmap_insert(fd->libmap, psys->part, psys->part, 0); diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index de0d19f7b05..94dc15278a1 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -145,7 +145,7 @@ bAction *verify_adt_action(ID *id, short add) BLI_snprintf(actname, sizeof(actname), "%sAction", id->name + 2); /* create action */ - adt->action = add_empty_action(G.main, actname); + adt->action = BKE_action_add(G.main, actname); /* set ID-type from ID-block that this is going to be assigned to * so that users can't accidentally break actions by assigning them diff --git a/source/blender/editors/armature/pose_lib.c b/source/blender/editors/armature/pose_lib.c index ac38500c841..587ae6991a2 100644 --- a/source/blender/editors/armature/pose_lib.c +++ b/source/blender/editors/armature/pose_lib.c @@ -200,7 +200,7 @@ static bAction *poselib_init_new(Object *ob) if (ob->poselib) id_us_min(&ob->poselib->id); - ob->poselib = add_empty_action(G.main, "PoseLib"); + ob->poselib = BKE_action_add(G.main, "PoseLib"); ob->poselib->idroot = ID_OB; return ob->poselib; diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c index aaa9afdd8c6..ce18083917f 100644 --- a/source/blender/editors/physics/particle_object.c +++ b/source/blender/editors/physics/particle_object.c @@ -197,7 +197,7 @@ static int new_particle_settings_exec(bContext *C, wmOperator *UNUSED(op)) if (psys->part) part= BKE_particlesettings_copy(bmain, psys->part); else - part= psys_new_settings("ParticleSettings", bmain); + part= BKE_particlesettings_add(bmain, "ParticleSettings"); ob= ptr.id.data; diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c index 35d772afae7..c2532ba033e 100644 --- a/source/blender/editors/render/render_preview.c +++ b/source/blender/editors/render/render_preview.c @@ -331,7 +331,7 @@ static Scene *preview_prepare_scene(Main *bmain, Scene *scene, ID *id, int id_ty if (origmat) { /* work on a copy */ - mat = localize_material(origmat); + mat = BKE_material_localize(origmat); sp->matcopy = mat; BLI_addtail(&pr_main->mat, mat); @@ -476,7 +476,7 @@ static Scene *preview_prepare_scene(Main *bmain, Scene *scene, ID *id, int id_ty /* work on a copy */ if (origla) { - la = localize_lamp(origla); + la = BKE_lamp_localize(origla); sp->lampcopy = la; BLI_addtail(&pr_main->lamp, la); } @@ -512,7 +512,7 @@ static Scene *preview_prepare_scene(Main *bmain, Scene *scene, ID *id, int id_ty World *wrld = NULL, *origwrld = (World *)id; if (origwrld) { - wrld = localize_world(origwrld); + wrld = BKE_world_localize(origwrld); sp->worldcopy = wrld; BLI_addtail(&pr_main->world, wrld); } diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index 0a7bca1f490..2a617f91e6c 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -580,7 +580,7 @@ static int new_world_exec(bContext *C, wmOperator *UNUSED(op)) wo = BKE_world_copy(bmain, wo); } else { - wo = add_world(bmain, DATA_("World")); + wo = BKE_world_add(bmain, DATA_("World")); if (BKE_scene_use_new_shading_nodes(scene)) { ED_node_shader_default(C, &wo->id); diff --git a/source/blender/editors/space_action/action_data.c b/source/blender/editors/space_action/action_data.c index fdf2dfe8371..29b3c6f2f6c 100644 --- a/source/blender/editors/space_action/action_data.c +++ b/source/blender/editors/space_action/action_data.c @@ -125,7 +125,7 @@ static bAction *action_create_new(bContext *C, bAction *oldact) } else { /* just make a new (empty) action */ - action = add_empty_action(CTX_data_main(C), "Action"); + action = BKE_action_add(CTX_data_main(C), "Action"); } /* when creating new ID blocks, there is already 1 user (as for all new datablocks), diff --git a/source/blender/makesrna/intern/rna_fluidsim.c b/source/blender/makesrna/intern/rna_fluidsim.c index 437095ffb31..29354837449 100644 --- a/source/blender/makesrna/intern/rna_fluidsim.c +++ b/source/blender/makesrna/intern/rna_fluidsim.c @@ -136,7 +136,7 @@ static void rna_FluidSettings_update_type(Main *bmain, Scene *scene, PointerRNA if (ob->type == OB_MESH && !psys) { /* add particle system */ - part = psys_new_settings("ParticleSettings", bmain); + part = BKE_particlesettings_add(bmain, "ParticleSettings"); psys = MEM_callocN(sizeof(ParticleSystem), "particle_system"); part->type = PART_FLUID; diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c index 7e2ced81a6d..4aa4eddaddb 100644 --- a/source/blender/makesrna/intern/rna_main_api.c +++ b/source/blender/makesrna/intern/rna_main_api.c @@ -430,7 +430,7 @@ static World *rna_Main_worlds_new(Main *bmain, const char *name) char safe_name[MAX_ID_NAME - 2]; rna_idname_validate(name, safe_name); - World *world = add_world(bmain, safe_name); + World *world = BKE_world_add(bmain, safe_name); id_us_min(&world->id); return world; } @@ -505,7 +505,7 @@ static bAction *rna_Main_actions_new(Main *bmain, const char *name) char safe_name[MAX_ID_NAME - 2]; rna_idname_validate(name, safe_name); - bAction *act = add_empty_action(bmain, safe_name); + bAction *act = BKE_action_add(bmain, safe_name); id_fake_user_clear(&act->id); return act; } @@ -515,7 +515,7 @@ static ParticleSettings *rna_Main_particles_new(Main *bmain, const char *name) char safe_name[MAX_ID_NAME - 2]; rna_idname_validate(name, safe_name); - ParticleSettings *part = psys_new_settings(safe_name, bmain); + ParticleSettings *part = BKE_particlesettings_add(bmain, safe_name); id_us_min(&part->id); return part; } diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c index e6138842f09..4241dff96de 100644 --- a/source/blender/render/intern/source/render_texture.c +++ b/source/blender/render/intern/source/render_texture.c @@ -3754,7 +3754,7 @@ Material *RE_sample_material_init(Material *orig_mat, Scene *scene) if (!orig_mat) return NULL; /* copy material */ - mat = localize_material(orig_mat); + mat = BKE_material_localize(orig_mat); /* update material anims */ BKE_animsys_evaluate_animdata(scene, &mat->id, mat->adt, BKE_scene_frame_get(scene), ADT_RECALC_ANIM); -- cgit v1.2.3