Merge branch 'master' into blender2.8

This commit is contained in:
Campbell Barton 2018-01-11 10:14:34 +11:00
commit 6112cde3f9
23 changed files with 49 additions and 50 deletions

View File

@ -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 */

View File

@ -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);

View File

@ -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);

View File

@ -326,7 +326,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);

View File

@ -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);
/* Evaluation. */

View File

@ -85,7 +85,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;

View File

@ -529,7 +529,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",
@ -537,7 +537,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... */

View File

@ -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;
}

View File

@ -165,7 +165,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;
@ -181,7 +181,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));
}
}

View File

@ -272,7 +272,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;

View File

@ -3146,7 +3146,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));
@ -3305,7 +3305,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;

View File

@ -1484,8 +1484,7 @@ static void ccgDM_copyFinalLoopArray(DerivedMesh *dm, MLoop *mloop)
int totface;
int gridSize = ccgSubSurf_getGridSize(ss);
int edgeSize = ccgSubSurf_getEdgeSize(ss);
int i = 0;
MLoop *mv;
MLoop *ml;
/* DMFlagMat *faceFlags = ccgdm->faceFlags; */ /* UNUSED */
if (!ccgdm->ehash) {
@ -1497,7 +1496,7 @@ static void ccgDM_copyFinalLoopArray(DerivedMesh *dm, MLoop *mloop)
ehash = BLI_edgehash_new_ex(__func__, ccgdm->dm.numEdgeData);
medge = ccgdm->dm.getEdgeArray((DerivedMesh *)ccgdm);
for (i = 0; i < ccgdm->dm.numEdgeData; i++) {
for (int i = 0; i < ccgdm->dm.numEdgeData; i++) {
BLI_edgehash_insert(ehash, medge[i].v1, medge[i].v2, SET_INT_IN_POINTER(i));
}
@ -1508,7 +1507,7 @@ static void ccgDM_copyFinalLoopArray(DerivedMesh *dm, MLoop *mloop)
BLI_rw_mutex_lock(&ccgdm->loops_cache_rwlock, THREAD_LOCK_READ);
totface = ccgSubSurf_getNumFaces(ss);
mv = mloop;
ml = mloop;
for (index = 0; index < totface; index++) {
CCGFace *f = ccgdm->faceMap[index].face;
int x, y, S, numVerts = ccgSubSurf_getFaceNumVerts(f);
@ -1530,21 +1529,21 @@ static void ccgDM_copyFinalLoopArray(DerivedMesh *dm, MLoop *mloop)
v4 = getFaceIndex(ss, f, S, x + 1, y + 0,
edgeSize, gridSize);
mv->v = v1;
mv->e = GET_UINT_FROM_POINTER(BLI_edgehash_lookup(ccgdm->ehash, v1, v2));
mv++; i++;
ml->v = v1;
ml->e = GET_UINT_FROM_POINTER(BLI_edgehash_lookup(ccgdm->ehash, v1, v2));
ml++;
mv->v = v2;
mv->e = GET_UINT_FROM_POINTER(BLI_edgehash_lookup(ccgdm->ehash, v2, v3));
mv++; i++;
ml->v = v2;
ml->e = GET_UINT_FROM_POINTER(BLI_edgehash_lookup(ccgdm->ehash, v2, v3));
ml++;
mv->v = v3;
mv->e = GET_UINT_FROM_POINTER(BLI_edgehash_lookup(ccgdm->ehash, v3, v4));
mv++; i++;
ml->v = v3;
ml->e = GET_UINT_FROM_POINTER(BLI_edgehash_lookup(ccgdm->ehash, v3, v4));
ml++;
mv->v = v4;
mv->e = GET_UINT_FROM_POINTER(BLI_edgehash_lookup(ccgdm->ehash, v4, v1));
mv++; i++;
ml->v = v4;
ml->e = GET_UINT_FROM_POINTER(BLI_edgehash_lookup(ccgdm->ehash, v4, v1));
ml++;
}
}
}

View File

@ -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));
}
}

View File

@ -2949,7 +2949,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);

View File

@ -147,7 +147,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

View File

@ -201,7 +201,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;

View File

@ -200,7 +200,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;

View File

@ -329,7 +329,7 @@ static World *preview_get_localized_world(ShaderPreview *sp, World *world)
if (sp->worldcopy != NULL) {
return sp->worldcopy;
}
sp->worldcopy = localize_world(world);
sp->worldcopy = BKE_world_localize(world);
BLI_addtail(&sp->pr_main->world, sp->worldcopy);
return sp->worldcopy;
}
@ -395,7 +395,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);
@ -550,7 +550,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);
}
@ -588,7 +588,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);
}

View File

@ -582,7 +582,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);

View File

@ -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),

View File

@ -137,7 +137,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;

View File

@ -454,7 +454,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;
}
@ -529,7 +529,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;
}
@ -539,7 +539,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;
}

View File

@ -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);