DNA: rename dup_* struct members to instance_*
This commit is contained in:
parent
19a703b0db
commit
319b9d6501
Notes:
blender-bot
2023-02-14 03:41:13 +01:00
Referenced by issue #64482, Crush on UV Editing layout after pressing A Referenced by issue #61960, Grid vanishes when entering ortho view Referenced by issue #61639, Horrible fireflies in Eevee making rendering impossible bug Referenced by issue #61646, Grid not showing in orthographic views
|
@ -401,8 +401,8 @@ Collection *BKE_collection_master(const Scene *scene)
|
|||
|
||||
static bool collection_object_cyclic_check_internal(Object *object, Collection *collection)
|
||||
{
|
||||
if (object->dup_group) {
|
||||
Collection *dup_collection = object->dup_group;
|
||||
if (object->instance_collection) {
|
||||
Collection *dup_collection = object->instance_collection;
|
||||
if ((dup_collection->id.tag & LIB_TAG_DOIT) == 0) {
|
||||
/* Cycle already exists in collections, let's prevent further crappyness */
|
||||
return true;
|
||||
|
@ -483,9 +483,9 @@ bool BKE_collection_is_empty(Collection *collection)
|
|||
|
||||
static bool collection_object_add(Main *bmain, Collection *collection, Object *ob, int flag, const bool add_us)
|
||||
{
|
||||
if (ob->dup_group) {
|
||||
if (ob->instance_collection) {
|
||||
/* Cyclic dependency check. */
|
||||
if (collection_find_child_recursive(ob->dup_group, collection)) {
|
||||
if (collection_find_child_recursive(ob->instance_collection, collection)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -921,8 +921,8 @@ static void add_collision_object(ListBase *relations, Object *ob, int level, uns
|
|||
/* objects in dupli groups, one level only for now */
|
||||
/* TODO: this doesn't really work, we are not taking into account the
|
||||
* dupli transforms and can get objects in the list multiple times. */
|
||||
if (ob->dup_group && level == 0) {
|
||||
Collection *collection= ob->dup_group;
|
||||
if (ob->instance_collection && level == 0) {
|
||||
Collection *collection= ob->instance_collection;
|
||||
|
||||
/* add objects */
|
||||
FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(collection, object)
|
||||
|
|
|
@ -560,7 +560,7 @@ void BKE_library_foreach_ID_link(Main *bmain, ID *id, LibraryIDLinkCallback call
|
|||
data.cb_flag = data_cb_flag;
|
||||
|
||||
CALLBACK_INVOKE(object->gpd, IDWALK_CB_USER);
|
||||
CALLBACK_INVOKE(object->dup_group, IDWALK_CB_USER);
|
||||
CALLBACK_INVOKE(object->instance_collection, IDWALK_CB_USER);
|
||||
|
||||
if (object->pd) {
|
||||
CALLBACK_INVOKE(object->pd->tex, IDWALK_CB_USER);
|
||||
|
@ -812,8 +812,8 @@ void BKE_library_foreach_ID_link(Main *bmain, ID *id, LibraryIDLinkCallback call
|
|||
case ID_PA:
|
||||
{
|
||||
ParticleSettings *psett = (ParticleSettings *) id;
|
||||
CALLBACK_INVOKE(psett->dup_group, IDWALK_CB_USER);
|
||||
CALLBACK_INVOKE(psett->dup_ob, IDWALK_CB_NOP);
|
||||
CALLBACK_INVOKE(psett->instance_collection, IDWALK_CB_USER);
|
||||
CALLBACK_INVOKE(psett->instance_object, IDWALK_CB_NOP);
|
||||
CALLBACK_INVOKE(psett->bb_ob, IDWALK_CB_NOP);
|
||||
CALLBACK_INVOKE(psett->collision_group, IDWALK_CB_NOP);
|
||||
|
||||
|
@ -854,7 +854,7 @@ void BKE_library_foreach_ID_link(Main *bmain, ID *id, LibraryIDLinkCallback call
|
|||
}
|
||||
}
|
||||
|
||||
for (ParticleDupliWeight *dw = psett->dupliweights.first; dw; dw = dw->next) {
|
||||
for (ParticleDupliWeight *dw = psett->instance_weights.first; dw; dw = dw->next) {
|
||||
CALLBACK_INVOKE(dw->ob, IDWALK_CB_NOP);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -852,7 +852,7 @@ void BKE_object_init(Object *ob)
|
|||
ob->upflag = OB_POSZ;
|
||||
}
|
||||
|
||||
ob->dupfacesca = 1.0;
|
||||
ob->instance_faces_scale = 1.0;
|
||||
|
||||
ob->col_group = 0x01;
|
||||
ob->col_mask = 0xffff;
|
||||
|
@ -1576,9 +1576,9 @@ void BKE_object_make_proxy(Main *bmain, Object *ob, Object *target, Object *cob)
|
|||
if (cob) {
|
||||
ob->rotmode = target->rotmode;
|
||||
mul_m4_m4m4(ob->obmat, cob->obmat, target->obmat);
|
||||
if (cob->dup_group) { /* should always be true */
|
||||
if (cob->instance_collection) { /* should always be true */
|
||||
float tvec[3];
|
||||
mul_v3_mat3_m4v3(tvec, ob->obmat, cob->dup_group->dupli_ofs);
|
||||
mul_v3_mat3_m4v3(tvec, ob->obmat, cob->instance_collection->dupli_ofs);
|
||||
sub_v3_v3(ob->obmat[3], tvec);
|
||||
}
|
||||
BKE_object_apply_mat4(ob, ob->obmat, false, true);
|
||||
|
|
|
@ -119,7 +119,7 @@ static void copy_dupli_context(DupliContext *r_ctx, const DupliContext *ctx, Obj
|
|||
|
||||
/* XXX annoying, previously was done by passing an ID* argument, this at least is more explicit */
|
||||
if (ctx->gen->type == OB_DUPLICOLLECTION)
|
||||
r_ctx->collection = ctx->object->dup_group;
|
||||
r_ctx->collection = ctx->object->instance_collection;
|
||||
|
||||
r_ctx->object = ob;
|
||||
if (mat)
|
||||
|
@ -270,8 +270,8 @@ static void make_duplis_collection(const DupliContext *ctx)
|
|||
Collection *collection;
|
||||
float collection_mat[4][4];
|
||||
|
||||
if (ob->dup_group == NULL) return;
|
||||
collection = ob->dup_group;
|
||||
if (ob->instance_collection == NULL) return;
|
||||
collection = ob->instance_collection;
|
||||
|
||||
/* combine collection offset and obmat */
|
||||
unit_m4(collection_mat);
|
||||
|
@ -614,7 +614,7 @@ static void make_child_duplis_faces(const DupliContext *ctx, void *userdata, Obj
|
|||
continue;
|
||||
|
||||
/* obmat is transform to face */
|
||||
get_dupliface_transform(mp, loopstart, mvert, fdd->use_scale, ctx->object->dupfacesca, obmat);
|
||||
get_dupliface_transform(mp, loopstart, mvert, fdd->use_scale, ctx->object->instance_faces_scale, obmat);
|
||||
/* make offset relative to inst_ob using relative child transform */
|
||||
mul_mat3_m4_v3(child_imat, obmat[3]);
|
||||
|
||||
|
@ -767,14 +767,14 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem
|
|||
|
||||
/* first check for loops (particle system object used as dupli object) */
|
||||
if (part->ren_as == PART_DRAW_OB) {
|
||||
if (ELEM(part->dup_ob, NULL, par))
|
||||
if (ELEM(part->instance_object, NULL, par))
|
||||
return;
|
||||
}
|
||||
else { /*PART_DRAW_GR */
|
||||
if (part->dup_group == NULL)
|
||||
if (part->instance_collection == NULL)
|
||||
return;
|
||||
|
||||
const ListBase dup_collection_objects = BKE_collection_object_cache_get(part->dup_group);
|
||||
const ListBase dup_collection_objects = BKE_collection_object_cache_get(part->instance_collection);
|
||||
if (BLI_listbase_is_empty(&dup_collection_objects))
|
||||
return;
|
||||
|
||||
|
@ -806,8 +806,8 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem
|
|||
if (part->draw & PART_DRAW_COUNT_GR) {
|
||||
psys_find_group_weights(part);
|
||||
|
||||
for (dw = part->dupliweights.first; dw; dw = dw->next) {
|
||||
FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN(part->dup_group, object, mode)
|
||||
for (dw = part->instance_weights.first; dw; dw = dw->next) {
|
||||
FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN(part->instance_collection, object, mode)
|
||||
{
|
||||
if (dw->ob == object) {
|
||||
totcollection += dw->count;
|
||||
|
@ -818,7 +818,7 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem
|
|||
}
|
||||
}
|
||||
else {
|
||||
FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN(part->dup_group, object, mode)
|
||||
FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN(part->instance_collection, object, mode)
|
||||
{
|
||||
(void) object;
|
||||
totcollection++;
|
||||
|
@ -830,8 +830,8 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem
|
|||
|
||||
if (part->draw & PART_DRAW_COUNT_GR) {
|
||||
a = 0;
|
||||
for (dw = part->dupliweights.first; dw; dw = dw->next) {
|
||||
FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN(part->dup_group, object, mode)
|
||||
for (dw = part->instance_weights.first; dw; dw = dw->next) {
|
||||
FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN(part->instance_collection, object, mode)
|
||||
{
|
||||
if (dw->ob == object) {
|
||||
for (b = 0; b < dw->count; b++, a++) {
|
||||
|
@ -845,7 +845,7 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem
|
|||
}
|
||||
else {
|
||||
a = 0;
|
||||
FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN(part->dup_group, object, mode)
|
||||
FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN(part->instance_collection, object, mode)
|
||||
{
|
||||
oblist[a] = object;
|
||||
a++;
|
||||
|
@ -854,7 +854,7 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem
|
|||
}
|
||||
}
|
||||
else {
|
||||
ob = part->dup_ob;
|
||||
ob = part->instance_object;
|
||||
}
|
||||
|
||||
if (totchild == 0 || part->draw & PART_DRAW_PARENT)
|
||||
|
@ -933,7 +933,7 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem
|
|||
|
||||
if (part->ren_as == PART_DRAW_GR && psys->part->draw & PART_DRAW_WHOLE_GR) {
|
||||
b = 0;
|
||||
FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN(part->dup_group, object, mode)
|
||||
FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN(part->instance_collection, object, mode)
|
||||
{
|
||||
copy_m4_m4(tmat, oblist[b]->obmat);
|
||||
|
||||
|
@ -942,8 +942,8 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem
|
|||
mul_v3_fl(tmat[3], size * scale);
|
||||
|
||||
/* collection dupli offset, should apply after everything else */
|
||||
if (!is_zero_v3(part->dup_group->dupli_ofs)) {
|
||||
sub_v3_v3(tmat[3], part->dup_group->dupli_ofs);
|
||||
if (!is_zero_v3(part->instance_collection->dupli_ofs)) {
|
||||
sub_v3_v3(tmat[3], part->instance_collection->dupli_ofs);
|
||||
}
|
||||
|
||||
/* individual particle transform */
|
||||
|
|
|
@ -226,8 +226,8 @@ void BKE_object_handle_data_update(
|
|||
if (psys_check_enabled(ob, psys, use_render_params)) {
|
||||
/* check use of dupli objects here */
|
||||
if (psys->part && (psys->part->draw_as == PART_DRAW_REND || use_render_params) &&
|
||||
((psys->part->ren_as == PART_DRAW_OB && psys->part->dup_ob) ||
|
||||
(psys->part->ren_as == PART_DRAW_GR && psys->part->dup_group)))
|
||||
((psys->part->ren_as == PART_DRAW_OB && psys->part->instance_object) ||
|
||||
(psys->part->ren_as == PART_DRAW_GR && psys->part->instance_collection)))
|
||||
{
|
||||
ob->transflag |= OB_DUPLIPARTS;
|
||||
}
|
||||
|
@ -306,8 +306,8 @@ bool BKE_object_eval_proxy_copy(Depsgraph *depsgraph,
|
|||
invert_m4_m4(imat, obg->obmat);
|
||||
mul_m4_m4m4(object->obmat, imat, object->proxy_from->obmat);
|
||||
/* Should always be true. */
|
||||
if (obg->dup_group) {
|
||||
add_v3_v3(object->obmat[3], obg->dup_group->dupli_ofs);
|
||||
if (obg->instance_collection) {
|
||||
add_v3_v3(object->obmat[3], obg->instance_collection->dupli_ofs);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -343,11 +343,11 @@ void psys_find_group_weights(ParticleSettings *part)
|
|||
/* Find object pointers based on index. If the collection is linked from
|
||||
* another library linking may not have the object pointers available on
|
||||
* file load, so we have to retrieve them later. See T49273. */
|
||||
const ListBase dup_group_objects = BKE_collection_object_cache_get(part->dup_group);
|
||||
const ListBase instance_collection_objects = BKE_collection_object_cache_get(part->instance_collection);
|
||||
|
||||
for (ParticleDupliWeight *dw = part->dupliweights.first; dw; dw = dw->next) {
|
||||
for (ParticleDupliWeight *dw = part->instance_weights.first; dw; dw = dw->next) {
|
||||
if (dw->ob == NULL) {
|
||||
Base *base = BLI_findlink(&dup_group_objects, dw->index);
|
||||
Base *base = BLI_findlink(&instance_collection_objects, dw->index);
|
||||
if (base != NULL) {
|
||||
dw->ob = base->object;
|
||||
}
|
||||
|
@ -359,8 +359,8 @@ void psys_check_group_weights(ParticleSettings *part)
|
|||
{
|
||||
ParticleDupliWeight *dw, *tdw;
|
||||
|
||||
if (part->ren_as != PART_DRAW_GR || !part->dup_group) {
|
||||
BLI_freelistN(&part->dupliweights);
|
||||
if (part->ren_as != PART_DRAW_GR || !part->instance_collection) {
|
||||
BLI_freelistN(&part->instance_weights);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -368,11 +368,11 @@ void psys_check_group_weights(ParticleSettings *part)
|
|||
psys_find_group_weights(part);
|
||||
|
||||
/* Remove NULL objects, that were removed from the collection. */
|
||||
dw = part->dupliweights.first;
|
||||
dw = part->instance_weights.first;
|
||||
while (dw) {
|
||||
if (dw->ob == NULL || !BKE_collection_has_object_recursive(part->dup_group, dw->ob)) {
|
||||
if (dw->ob == NULL || !BKE_collection_has_object_recursive(part->instance_collection, dw->ob)) {
|
||||
tdw = dw->next;
|
||||
BLI_freelinkN(&part->dupliweights, dw);
|
||||
BLI_freelinkN(&part->instance_weights, dw);
|
||||
dw = tdw;
|
||||
}
|
||||
else {
|
||||
|
@ -382,9 +382,9 @@ void psys_check_group_weights(ParticleSettings *part)
|
|||
|
||||
/* Add new objects in the collection. */
|
||||
int index = 0;
|
||||
FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(part->dup_group, object)
|
||||
FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(part->instance_collection, object)
|
||||
{
|
||||
dw = part->dupliweights.first;
|
||||
dw = part->instance_weights.first;
|
||||
while (dw && dw->ob != object) {
|
||||
dw = dw->next;
|
||||
}
|
||||
|
@ -393,7 +393,7 @@ void psys_check_group_weights(ParticleSettings *part)
|
|||
dw = MEM_callocN(sizeof(ParticleDupliWeight), "ParticleDupliWeight");
|
||||
dw->ob = object;
|
||||
dw->count = 1;
|
||||
BLI_addtail(&part->dupliweights, dw);
|
||||
BLI_addtail(&part->instance_weights, dw);
|
||||
}
|
||||
|
||||
dw->index = index++;
|
||||
|
@ -402,7 +402,7 @@ void psys_check_group_weights(ParticleSettings *part)
|
|||
|
||||
/* Ensure there is an element marked as current. */
|
||||
int current = 0;
|
||||
for (dw = part->dupliweights.first; dw; dw = dw->next) {
|
||||
for (dw = part->instance_weights.first; dw; dw = dw->next) {
|
||||
if (dw->flag & PART_DUPLIW_CURRENT) {
|
||||
current = 1;
|
||||
break;
|
||||
|
@ -410,7 +410,7 @@ void psys_check_group_weights(ParticleSettings *part)
|
|||
}
|
||||
|
||||
if (!current) {
|
||||
dw = part->dupliweights.first;
|
||||
dw = part->instance_weights.first;
|
||||
if (dw)
|
||||
dw->flag |= PART_DUPLIW_CURRENT;
|
||||
}
|
||||
|
@ -452,7 +452,7 @@ void BKE_particlesettings_free(ParticleSettings *part)
|
|||
|
||||
MEM_SAFE_FREE(part->effector_weights);
|
||||
|
||||
BLI_freelistN(&part->dupliweights);
|
||||
BLI_freelistN(&part->instance_weights);
|
||||
|
||||
boid_free_settings(part->boids);
|
||||
fluid_free_settings(part->fluid);
|
||||
|
@ -3319,7 +3319,7 @@ void BKE_particlesettings_copy_data(
|
|||
}
|
||||
}
|
||||
|
||||
BLI_duplicatelist(&part_dst->dupliweights, &part_src->dupliweights);
|
||||
BLI_duplicatelist(&part_dst->instance_weights, &part_src->instance_weights);
|
||||
}
|
||||
|
||||
ParticleSettings *BKE_particlesettings_copy(Main *bmain, const ParticleSettings *part)
|
||||
|
|
|
@ -1786,8 +1786,8 @@ static bool foreach_object_ptcache(Scene *scene,
|
|||
/* Consider all object in dupli groups to be part of the same object,
|
||||
* for baking with linking dupligroups. Once we have better overrides
|
||||
* this can be revisited so users select the local objects directly. */
|
||||
if (scene != NULL && (duplis-- > 0) && (object->dup_group != NULL)) {
|
||||
FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(object->dup_group,
|
||||
if (scene != NULL && (duplis-- > 0) && (object->instance_collection != NULL)) {
|
||||
FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(object->instance_collection,
|
||||
current_object)
|
||||
{
|
||||
if (current_object == object) {
|
||||
|
|
|
@ -1099,7 +1099,7 @@ int BKE_scene_base_iter_next(Depsgraph *depsgraph, SceneBaseIter *iter,
|
|||
/* collections cannot be duplicated for mballs yet,
|
||||
* this enters eternal loop because of
|
||||
* makeDispListMBall getting called inside of collection_duplilist */
|
||||
if ((*base)->object->dup_group == NULL) {
|
||||
if ((*base)->object->instance_collection == NULL) {
|
||||
iter->duplilist = object_duplilist(depsgraph, (*scene), (*base)->object);
|
||||
|
||||
iter->dupob = iter->duplilist->first;
|
||||
|
|
|
@ -4276,8 +4276,8 @@ static void lib_link_particlesettings(FileData *fd, Main *main)
|
|||
|
||||
part->ipo = newlibadr_us(fd, part->id.lib, part->ipo); // XXX deprecated - old animation system
|
||||
|
||||
part->dup_ob = newlibadr(fd, part->id.lib, part->dup_ob);
|
||||
part->dup_group = newlibadr_us(fd, part->id.lib, part->dup_group);
|
||||
part->instance_object = newlibadr(fd, part->id.lib, part->instance_object);
|
||||
part->instance_collection = newlibadr_us(fd, part->id.lib, part->instance_collection);
|
||||
part->eff_group = newlibadr(fd, part->id.lib, part->eff_group);
|
||||
part->bb_ob = newlibadr(fd, part->id.lib, part->bb_ob);
|
||||
part->collision_group = newlibadr(fd, part->id.lib, part->collision_group);
|
||||
|
@ -4292,13 +4292,13 @@ static void lib_link_particlesettings(FileData *fd, Main *main)
|
|||
part->effector_weights = BKE_effector_add_weights(part->eff_group);
|
||||
}
|
||||
|
||||
if (part->dupliweights.first && part->dup_group) {
|
||||
for (ParticleDupliWeight *dw = part->dupliweights.first; dw; dw = dw->next) {
|
||||
if (part->instance_weights.first && part->instance_collection) {
|
||||
for (ParticleDupliWeight *dw = part->instance_weights.first; dw; dw = dw->next) {
|
||||
dw->ob = newlibadr(fd, part->id.lib, dw->ob);
|
||||
}
|
||||
}
|
||||
else {
|
||||
BLI_listbase_clear(&part->dupliweights);
|
||||
BLI_listbase_clear(&part->instance_weights);
|
||||
}
|
||||
|
||||
if (part->boids) {
|
||||
|
@ -4370,7 +4370,7 @@ static void direct_link_particlesettings(FileData *fd, ParticleSettings *part)
|
|||
if (!part->effector_weights)
|
||||
part->effector_weights = BKE_effector_add_weights(part->eff_group);
|
||||
|
||||
link_list(fd, &part->dupliweights);
|
||||
link_list(fd, &part->instance_weights);
|
||||
|
||||
part->boids = newdataadr(fd, part->boids);
|
||||
part->fluid = newdataadr(fd, part->fluid);
|
||||
|
@ -4883,10 +4883,10 @@ static void lib_link_object(FileData *fd, Main *main)
|
|||
|
||||
/* 2.8x drops support for non-empty dupli instances. */
|
||||
if (ob->type == OB_EMPTY) {
|
||||
ob->dup_group = newlibadr_us(fd, ob->id.lib, ob->dup_group);
|
||||
ob->instance_collection = newlibadr_us(fd, ob->id.lib, ob->instance_collection);
|
||||
}
|
||||
else {
|
||||
ob->dup_group = NULL;
|
||||
ob->instance_collection = NULL;
|
||||
ob->transflag &= ~OB_DUPLICOLLECTION;
|
||||
}
|
||||
|
||||
|
@ -9499,8 +9499,8 @@ static void expand_particlesettings(FileData *fd, Main *mainvar, ParticleSetting
|
|||
{
|
||||
int a;
|
||||
|
||||
expand_doit(fd, mainvar, part->dup_ob);
|
||||
expand_doit(fd, mainvar, part->dup_group);
|
||||
expand_doit(fd, mainvar, part->instance_object);
|
||||
expand_doit(fd, mainvar, part->instance_collection);
|
||||
expand_doit(fd, mainvar, part->eff_group);
|
||||
expand_doit(fd, mainvar, part->bb_ob);
|
||||
expand_doit(fd, mainvar, part->collision_group);
|
||||
|
@ -9546,7 +9546,7 @@ static void expand_particlesettings(FileData *fd, Main *mainvar, ParticleSetting
|
|||
}
|
||||
}
|
||||
|
||||
for (ParticleDupliWeight *dw = part->dupliweights.first; dw; dw = dw->next) {
|
||||
for (ParticleDupliWeight *dw = part->instance_weights.first; dw; dw = dw->next) {
|
||||
expand_doit(fd, mainvar, dw->ob);
|
||||
}
|
||||
}
|
||||
|
@ -9868,8 +9868,8 @@ static void expand_object(FileData *fd, Main *mainvar, Object *ob)
|
|||
if (paf && paf->group)
|
||||
expand_doit(fd, mainvar, paf->group);
|
||||
|
||||
if (ob->dup_group)
|
||||
expand_doit(fd, mainvar, ob->dup_group);
|
||||
if (ob->instance_collection)
|
||||
expand_doit(fd, mainvar, ob->instance_collection);
|
||||
|
||||
if (ob->proxy)
|
||||
expand_doit(fd, mainvar, ob->proxy);
|
||||
|
@ -10396,7 +10396,7 @@ static void add_collections_to_scene(
|
|||
view_layer->basact = base;
|
||||
|
||||
/* Assign the collection. */
|
||||
ob->dup_group = collection;
|
||||
ob->instance_collection = collection;
|
||||
id_us_plus(&collection->id);
|
||||
ob->transflag |= OB_DUPLICOLLECTION;
|
||||
copy_v3_v3(ob->loc, scene->cursor.location);
|
||||
|
|
|
@ -2293,7 +2293,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
|
|||
|
||||
for (; dup; dup = dup->id.next) {
|
||||
if (ob == blo_do_versions_newlibadr(fd, lib, dup->parent)) {
|
||||
part->dup_ob = dup;
|
||||
part->instance_object = dup;
|
||||
ob->transflag |= OB_DUPLIPARTS;
|
||||
ob->transflag &= ~OB_DUPLIVERTS;
|
||||
|
||||
|
@ -2344,7 +2344,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
|
|||
|
||||
/* dupliface scale */
|
||||
for (ob = bmain->object.first; ob; ob = ob->id.next)
|
||||
ob->dupfacesca = 1.0f;
|
||||
ob->instance_faces_scale = 1.0f;
|
||||
}
|
||||
|
||||
if ((bmain->versionfile < 245) || (bmain->versionfile == 245 && bmain->subversionfile < 11)) {
|
||||
|
|
|
@ -1400,12 +1400,12 @@ static void write_particlesettings(WriteData *wd, ParticleSettings *part)
|
|||
write_curvemapping(wd, part->twistcurve);
|
||||
}
|
||||
|
||||
for (ParticleDupliWeight *dw = part->dupliweights.first; dw; dw = dw->next) {
|
||||
for (ParticleDupliWeight *dw = part->instance_weights.first; dw; dw = dw->next) {
|
||||
/* update indices, but only if dw->ob is set (can be NULL after loading e.g.) */
|
||||
if (dw->ob != NULL) {
|
||||
dw->index = 0;
|
||||
if (part->dup_group) { /* can be NULL if lining fails or set to None */
|
||||
FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(part->dup_group, object)
|
||||
if (part->instance_collection) { /* can be NULL if lining fails or set to None */
|
||||
FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(part->instance_collection, object)
|
||||
{
|
||||
if (object != dw->ob) {
|
||||
dw->index++;
|
||||
|
|
|
@ -173,8 +173,8 @@ void SceneExporter::writeNodes(Object *ob)
|
|||
|
||||
// empty object
|
||||
else if (ob->type == OB_EMPTY) { // TODO: handle groups (OB_DUPLICOLLECTION
|
||||
if ((ob->transflag & OB_DUPLICOLLECTION) == OB_DUPLICOLLECTION && ob->dup_group) {
|
||||
Collection *collection = ob->dup_group;
|
||||
if ((ob->transflag & OB_DUPLICOLLECTION) == OB_DUPLICOLLECTION && ob->instance_collection) {
|
||||
Collection *collection = ob->instance_collection;
|
||||
/* printf("group detected '%s'\n", group->id.name + 2); */
|
||||
FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(collection, object)
|
||||
{
|
||||
|
|
|
@ -622,11 +622,11 @@ void DepsgraphNodeBuilder::build_object(int base_index,
|
|||
-1, object->proxy_group, DEG_ID_LINKED_INDIRECTLY, is_visible);
|
||||
}
|
||||
/* Object dupligroup. */
|
||||
if (object->dup_group != NULL) {
|
||||
if (object->instance_collection != NULL) {
|
||||
const bool is_current_parent_collection_visible =
|
||||
is_parent_collection_visible_;
|
||||
is_parent_collection_visible_ = is_visible;
|
||||
build_collection(NULL, object->dup_group);
|
||||
build_collection(NULL, object->instance_collection);
|
||||
is_parent_collection_visible_ = is_current_parent_collection_visible;
|
||||
add_operation_node(
|
||||
&object->id, NodeType::DUPLI, OperationCode::DUPLI);
|
||||
|
@ -1123,16 +1123,16 @@ void DepsgraphNodeBuilder::build_particle_systems(Object *object,
|
|||
/* Visualization of particle system. */
|
||||
switch (part->ren_as) {
|
||||
case PART_DRAW_OB:
|
||||
if (part->dup_ob != NULL) {
|
||||
if (part->instance_object != NULL) {
|
||||
build_object(-1,
|
||||
part->dup_ob,
|
||||
part->instance_object,
|
||||
DEG_ID_LINKED_INDIRECTLY,
|
||||
is_object_visible);
|
||||
}
|
||||
break;
|
||||
case PART_DRAW_GR:
|
||||
if (part->dup_group != NULL) {
|
||||
build_collection(NULL, part->dup_group);
|
||||
if (part->instance_collection != NULL) {
|
||||
build_collection(NULL, part->instance_collection);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -697,8 +697,8 @@ void DepsgraphRelationBuilder::build_object(Base *base, Object *object)
|
|||
"Proxy Group Transform");
|
||||
}
|
||||
/* Object dupligroup. */
|
||||
if (object->dup_group != NULL) {
|
||||
build_collection(NULL, object, object->dup_group);
|
||||
if (object->instance_collection != NULL) {
|
||||
build_collection(NULL, object, object->instance_collection);
|
||||
}
|
||||
/* Point caches. */
|
||||
build_object_pointcache(object);
|
||||
|
@ -1850,18 +1850,18 @@ void DepsgraphRelationBuilder::build_particle_systems(Object *object)
|
|||
/* Visualization. */
|
||||
switch (part->ren_as) {
|
||||
case PART_DRAW_OB:
|
||||
if (part->dup_ob != NULL) {
|
||||
if (part->instance_object != NULL) {
|
||||
/* Make sure object's relations are all built. */
|
||||
build_object(NULL, part->dup_ob);
|
||||
build_object(NULL, part->instance_object);
|
||||
/* Build relation for the particle visualization. */
|
||||
build_particle_system_visualization_object(
|
||||
object, psys, part->dup_ob);
|
||||
object, psys, part->instance_object);
|
||||
}
|
||||
break;
|
||||
case PART_DRAW_GR:
|
||||
if (part->dup_group != NULL) {
|
||||
build_collection(NULL, NULL, part->dup_group);
|
||||
LISTBASE_FOREACH (CollectionObject *, go, &part->dup_group->gobject) {
|
||||
if (part->instance_collection != NULL) {
|
||||
build_collection(NULL, NULL, part->instance_collection);
|
||||
LISTBASE_FOREACH (CollectionObject *, go, &part->instance_collection->gobject) {
|
||||
build_particle_system_visualization_object(
|
||||
object, psys, go->ob);
|
||||
}
|
||||
|
|
|
@ -1216,7 +1216,7 @@ static int collection_instance_add_exec(bContext *C, wmOperator *op)
|
|||
}
|
||||
|
||||
Object *ob = ED_object_add_type(C, OB_EMPTY, collection->id.name + 2, loc, rot, false, local_view_bits);
|
||||
ob->dup_group = collection;
|
||||
ob->instance_collection = collection;
|
||||
ob->transflag |= OB_DUPLICOLLECTION;
|
||||
id_us_plus(&collection->id);
|
||||
|
||||
|
@ -1685,7 +1685,7 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base,
|
|||
}
|
||||
}
|
||||
|
||||
if (base->object->transflag & OB_DUPLICOLLECTION && base->object->dup_group) {
|
||||
if (base->object->transflag & OB_DUPLICOLLECTION && base->object->instance_collection) {
|
||||
for (Object *ob = bmain->object.first; ob; ob = ob->id.next) {
|
||||
if (ob->proxy_group == base->object) {
|
||||
ob->proxy = NULL;
|
||||
|
|
|
@ -297,9 +297,9 @@ static int make_proxy_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
|||
return OPERATOR_CANCELLED;
|
||||
|
||||
/* Get object to work on - use a menu if we need to... */
|
||||
if (ob->dup_group && ID_IS_LINKED(ob->dup_group)) {
|
||||
if (ob->instance_collection && ID_IS_LINKED(ob->instance_collection)) {
|
||||
/* gives menu with list of objects in group */
|
||||
/* proxy_group_objects_menu(C, op, ob, ob->dup_group); */
|
||||
/* proxy_group_objects_menu(C, op, ob, ob->instance_collection); */
|
||||
WM_enum_search_invoke(C, op, event);
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
@ -333,9 +333,9 @@ static int make_proxy_exec(bContext *C, wmOperator *op)
|
|||
Scene *scene = CTX_data_scene(C);
|
||||
ViewLayer *view_layer = CTX_data_view_layer(C);
|
||||
|
||||
if (gob->dup_group != NULL) {
|
||||
const ListBase dup_group_objects = BKE_collection_object_cache_get(gob->dup_group);
|
||||
Base *base = BLI_findlink(&dup_group_objects, RNA_enum_get(op->ptr, "object"));
|
||||
if (gob->instance_collection != NULL) {
|
||||
const ListBase instance_collection_objects = BKE_collection_object_cache_get(gob->instance_collection);
|
||||
Base *base = BLI_findlink(&instance_collection_objects, RNA_enum_get(op->ptr, "object"));
|
||||
ob = base->object;
|
||||
}
|
||||
else {
|
||||
|
@ -386,11 +386,11 @@ static const EnumPropertyItem *proxy_collection_object_itemf(
|
|||
int i = 0;
|
||||
Object *ob = ED_object_active_context(C);
|
||||
|
||||
if (!ob || !ob->dup_group)
|
||||
if (!ob || !ob->instance_collection)
|
||||
return DummyRNA_DEFAULT_items;
|
||||
|
||||
/* find the object to affect */
|
||||
FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(ob->dup_group, object)
|
||||
FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(ob->instance_collection, object)
|
||||
{
|
||||
item_tmp.identifier = item_tmp.name = object->id.name + 2;
|
||||
item_tmp.value = i++;
|
||||
|
@ -1433,7 +1433,7 @@ static int make_links_data_exec(bContext *C, wmOperator *op)
|
|||
|
||||
/* now add in the collections from the link nodes */
|
||||
for (collection_node = ob_collections; collection_node; collection_node = collection_node->next) {
|
||||
if (ob_dst->dup_group != collection_node->link) {
|
||||
if (ob_dst->instance_collection != collection_node->link) {
|
||||
BKE_collection_object_add(bmain, collection_node->link, ob_dst);
|
||||
}
|
||||
else {
|
||||
|
@ -1443,9 +1443,9 @@ static int make_links_data_exec(bContext *C, wmOperator *op)
|
|||
break;
|
||||
}
|
||||
case MAKE_LINKS_DUPLICOLLECTION:
|
||||
ob_dst->dup_group = ob_src->dup_group;
|
||||
if (ob_dst->dup_group) {
|
||||
id_us_plus(&ob_dst->dup_group->id);
|
||||
ob_dst->instance_collection = ob_src->instance_collection;
|
||||
if (ob_dst->instance_collection) {
|
||||
id_us_plus(&ob_dst->instance_collection->id);
|
||||
ob_dst->transflag |= OB_DUPLICOLLECTION;
|
||||
}
|
||||
break;
|
||||
|
@ -2200,7 +2200,7 @@ static int make_override_static_invoke(bContext *C, wmOperator *op, const wmEven
|
|||
}
|
||||
|
||||
/* Get object to work on - use a menu if we need to... */
|
||||
if (!ID_IS_LINKED(obact) && obact->dup_group != NULL && ID_IS_LINKED(obact->dup_group)) {
|
||||
if (!ID_IS_LINKED(obact) && obact->instance_collection != NULL && ID_IS_LINKED(obact->instance_collection)) {
|
||||
/* Gives menu with list of objects in group. */
|
||||
WM_enum_search_invoke(C, op, event);
|
||||
return OPERATOR_CANCELLED;
|
||||
|
@ -2235,9 +2235,9 @@ static int make_override_static_exec(bContext *C, wmOperator *op)
|
|||
|
||||
bool success = false;
|
||||
|
||||
if (!ID_IS_LINKED(obact) && obact->dup_group != NULL && ID_IS_LINKED(obact->dup_group)) {
|
||||
if (!ID_IS_LINKED(obact) && obact->instance_collection != NULL && ID_IS_LINKED(obact->instance_collection)) {
|
||||
Object *obcollection = obact;
|
||||
Collection *collection = obcollection->dup_group;
|
||||
Collection *collection = obcollection->instance_collection;
|
||||
|
||||
const ListBase dup_collection_objects = BKE_collection_object_cache_get(collection);
|
||||
Base *base = BLI_findlink(&dup_collection_objects, RNA_enum_get(op->ptr, "object"));
|
||||
|
@ -2302,7 +2302,7 @@ static int make_override_static_exec(bContext *C, wmOperator *op)
|
|||
|
||||
/* obcollection is no more duplicollection-ing,
|
||||
* it merely parents whole collection of overriding instantiated objects. */
|
||||
obcollection->dup_group = NULL;
|
||||
obcollection->instance_collection = NULL;
|
||||
|
||||
/* Also, we'd likely want to lock by default things like
|
||||
* transformations of implicitly overridden objects? */
|
||||
|
@ -2350,7 +2350,7 @@ static bool make_override_static_poll(bContext *C)
|
|||
return (BKE_override_static_is_enabled() &&
|
||||
ED_operator_objectmode(C) && obact != NULL &&
|
||||
((ID_IS_LINKED(obact) && obact->id.tag & LIB_TAG_EXTERN) ||
|
||||
(!ID_IS_LINKED(obact) && obact->dup_group != NULL && ID_IS_LINKED(obact->dup_group))));
|
||||
(!ID_IS_LINKED(obact) && obact->instance_collection != NULL && ID_IS_LINKED(obact->instance_collection))));
|
||||
}
|
||||
|
||||
void OBJECT_OT_make_override_static(wmOperatorType *ot)
|
||||
|
|
|
@ -500,16 +500,16 @@ static bool object_select_all_by_material(bContext *C, Material *mat)
|
|||
return changed;
|
||||
}
|
||||
|
||||
static bool object_select_all_by_dup_group(bContext *C, Object *ob)
|
||||
static bool object_select_all_by_instance_collection(bContext *C, Object *ob)
|
||||
{
|
||||
bool changed = false;
|
||||
Collection *dup_group = (ob->transflag & OB_DUPLICOLLECTION) ? ob->dup_group : NULL;
|
||||
Collection *instance_collection = (ob->transflag & OB_DUPLICOLLECTION) ? ob->instance_collection : NULL;
|
||||
|
||||
CTX_DATA_BEGIN (C, Base *, base, visible_bases)
|
||||
{
|
||||
if (((base->flag & BASE_SELECTED) == 0) && ((base->flag & BASE_SELECTABLE) != 0)) {
|
||||
Collection *dup_group_other = (base->object->transflag & OB_DUPLICOLLECTION) ? base->object->dup_group : NULL;
|
||||
if (dup_group == dup_group_other) {
|
||||
Collection *instance_collection_other = (base->object->transflag & OB_DUPLICOLLECTION) ? base->object->instance_collection : NULL;
|
||||
if (instance_collection == instance_collection_other) {
|
||||
ED_object_base_select(base, BA_SELECT);
|
||||
changed = true;
|
||||
}
|
||||
|
@ -649,10 +649,10 @@ static int object_select_linked_exec(bContext *C, wmOperator *op)
|
|||
changed = object_select_all_by_material(C, mat);
|
||||
}
|
||||
else if (nr == OBJECT_SELECT_LINKED_DUPGROUP) {
|
||||
if (ob->dup_group == NULL)
|
||||
if (ob->instance_collection == NULL)
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
changed = object_select_all_by_dup_group(C, ob);
|
||||
changed = object_select_all_by_instance_collection(C, ob);
|
||||
}
|
||||
else if (nr == OBJECT_SELECT_LINKED_PARTICLE) {
|
||||
if (BLI_listbase_is_empty(&ob->particlesystem))
|
||||
|
|
|
@ -903,8 +903,8 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
|
|||
for (tob = bmain->object.first; tob; tob = tob->id.next) {
|
||||
if (tob->data)
|
||||
((ID *)tob->data)->tag &= ~LIB_TAG_DOIT;
|
||||
if (tob->dup_group)
|
||||
((ID *)tob->dup_group)->tag &= ~LIB_TAG_DOIT;
|
||||
if (tob->instance_collection)
|
||||
((ID *)tob->instance_collection)->tag &= ~LIB_TAG_DOIT;
|
||||
}
|
||||
|
||||
for (ctx_ob = ctx_data_list.first;
|
||||
|
@ -925,8 +925,8 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
|
|||
|
||||
if (ob->data == NULL) {
|
||||
/* special support for dupligroups */
|
||||
if ((ob->transflag & OB_DUPLICOLLECTION) && ob->dup_group && (ob->dup_group->id.tag & LIB_TAG_DOIT) == 0) {
|
||||
if (ID_IS_LINKED(ob->dup_group)) {
|
||||
if ((ob->transflag & OB_DUPLICOLLECTION) && ob->instance_collection && (ob->instance_collection->id.tag & LIB_TAG_DOIT) == 0) {
|
||||
if (ID_IS_LINKED(ob->instance_collection)) {
|
||||
tot_lib_error++;
|
||||
}
|
||||
else {
|
||||
|
@ -943,10 +943,10 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
|
|||
mul_m4_v3(ob->imat, cent);
|
||||
}
|
||||
|
||||
add_v3_v3(ob->dup_group->dupli_ofs, cent);
|
||||
add_v3_v3(ob->instance_collection->dupli_ofs, cent);
|
||||
|
||||
tot_change++;
|
||||
ob->dup_group->id.tag |= LIB_TAG_DOIT;
|
||||
ob->instance_collection->id.tag |= LIB_TAG_DOIT;
|
||||
do_inverse_offset = true;
|
||||
}
|
||||
}
|
||||
|
@ -1197,7 +1197,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
|
|||
|
||||
if ((ob_other->flag & OB_DONE) == 0 &&
|
||||
((ob->data && (ob->data == ob_other->data)) ||
|
||||
(ob->dup_group == ob_other->dup_group &&
|
||||
(ob->instance_collection == ob_other->instance_collection &&
|
||||
(ob->transflag | ob_other->transflag) & OB_DUPLICOLLECTION)))
|
||||
{
|
||||
ob_other->flag |= OB_DONE;
|
||||
|
|
|
@ -422,10 +422,10 @@ static int dupliob_move_up_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
return OPERATOR_CANCELLED;
|
||||
|
||||
part = psys->part;
|
||||
for (dw = part->dupliweights.first; dw; dw = dw->next) {
|
||||
for (dw = part->instance_weights.first; dw; dw = dw->next) {
|
||||
if (dw->flag & PART_DUPLIW_CURRENT && dw->prev) {
|
||||
BLI_remlink(&part->dupliweights, dw);
|
||||
BLI_insertlinkbefore(&part->dupliweights, dw->prev, dw);
|
||||
BLI_remlink(&part->instance_weights, dw);
|
||||
BLI_insertlinkbefore(&part->instance_weights, dw->prev, dw);
|
||||
|
||||
DEG_id_tag_update(&part->id, ID_RECALC_GEOMETRY | ID_RECALC_PSYS_REDO);
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_PARTICLE, NULL);
|
||||
|
@ -460,12 +460,12 @@ static int copy_particle_dupliob_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
if (!psys)
|
||||
return OPERATOR_CANCELLED;
|
||||
part = psys->part;
|
||||
for (dw = part->dupliweights.first; dw; dw = dw->next) {
|
||||
for (dw = part->instance_weights.first; dw; dw = dw->next) {
|
||||
if (dw->flag & PART_DUPLIW_CURRENT) {
|
||||
dw->flag &= ~PART_DUPLIW_CURRENT;
|
||||
dw = MEM_dupallocN(dw);
|
||||
dw->flag |= PART_DUPLIW_CURRENT;
|
||||
BLI_addhead(&part->dupliweights, dw);
|
||||
BLI_addhead(&part->instance_weights, dw);
|
||||
|
||||
DEG_id_tag_update(&part->id, ID_RECALC_GEOMETRY | ID_RECALC_PSYS_REDO);
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_PARTICLE, NULL);
|
||||
|
@ -501,15 +501,15 @@ static int remove_particle_dupliob_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
return OPERATOR_CANCELLED;
|
||||
|
||||
part = psys->part;
|
||||
for (dw = part->dupliweights.first; dw; dw = dw->next) {
|
||||
for (dw = part->instance_weights.first; dw; dw = dw->next) {
|
||||
if (dw->flag & PART_DUPLIW_CURRENT) {
|
||||
BLI_remlink(&part->dupliweights, dw);
|
||||
BLI_remlink(&part->instance_weights, dw);
|
||||
MEM_freeN(dw);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
dw = part->dupliweights.last;
|
||||
dw = part->instance_weights.last;
|
||||
|
||||
if (dw)
|
||||
dw->flag |= PART_DUPLIW_CURRENT;
|
||||
|
@ -547,10 +547,10 @@ static int dupliob_move_down_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
return OPERATOR_CANCELLED;
|
||||
|
||||
part = psys->part;
|
||||
for (dw = part->dupliweights.first; dw; dw = dw->next) {
|
||||
for (dw = part->instance_weights.first; dw; dw = dw->next) {
|
||||
if (dw->flag & PART_DUPLIW_CURRENT && dw->next) {
|
||||
BLI_remlink(&part->dupliweights, dw);
|
||||
BLI_insertlinkafter(&part->dupliweights, dw->next, dw);
|
||||
BLI_remlink(&part->instance_weights, dw);
|
||||
BLI_insertlinkafter(&part->instance_weights, dw->next, dw);
|
||||
|
||||
DEG_id_tag_update(&part->id, ID_RECALC_GEOMETRY | ID_RECALC_PSYS_REDO);
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_PARTICLE, NULL);
|
||||
|
|
|
@ -562,7 +562,7 @@ static int collection_instance_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
GSET_ITER(collections_to_edit_iter, data.collections_to_edit) {
|
||||
Collection *collection = BLI_gsetIterator_getKey(&collections_to_edit_iter);
|
||||
Object *ob = ED_object_add_type(C, OB_EMPTY, collection->id.name + 2, scene->cursor.location, NULL, false, 0);
|
||||
ob->dup_group = collection;
|
||||
ob->instance_collection = collection;
|
||||
ob->transflag |= OB_DUPLICOLLECTION;
|
||||
id_lib_extern(&collection->id);
|
||||
}
|
||||
|
|
|
@ -1304,7 +1304,7 @@ TreeElementIcon tree_element_get_icon(TreeStoreElem *tselem, TreeElement *te)
|
|||
case OB_LIGHTPROBE:
|
||||
data.icon = ICON_OUTLINER_OB_LIGHTPROBE; break;
|
||||
case OB_EMPTY:
|
||||
if (ob->dup_group) {
|
||||
if (ob->instance_collection) {
|
||||
data.icon = ICON_OUTLINER_OB_GROUP_INSTANCE;
|
||||
}
|
||||
else if (ob->empty_drawtype == OB_EMPTY_IMAGE) {
|
||||
|
|
|
@ -220,7 +220,7 @@ static void unlink_collection_cb(
|
|||
if (tsep) {
|
||||
if (GS(tsep->id->name) == ID_OB) {
|
||||
Object *ob = (Object *)tsep->id;
|
||||
ob->dup_group = NULL;
|
||||
ob->instance_collection = NULL;
|
||||
DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM);
|
||||
DEG_relations_tag_update(bmain);
|
||||
}
|
||||
|
|
|
@ -478,8 +478,8 @@ static void outliner_add_object_contents(SpaceOutliner *soops, TreeElement *te,
|
|||
}
|
||||
|
||||
/* duplicated group */
|
||||
if (ob->dup_group)
|
||||
outliner_add_element(soops, &te->subtree, ob->dup_group, te, 0, 0);
|
||||
if (ob->instance_collection)
|
||||
outliner_add_element(soops, &te->subtree, ob->instance_collection, te, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -304,7 +304,7 @@ typedef struct Object {
|
|||
char empty_drawtype;
|
||||
float empty_drawsize;
|
||||
/** Dupliface scale. */
|
||||
float dupfacesca;
|
||||
float instance_faces_scale;
|
||||
|
||||
/** Custom index, for renderpasses. */
|
||||
short index;
|
||||
|
@ -335,7 +335,7 @@ typedef struct Object {
|
|||
/** If exists, saved in file. */
|
||||
struct SoftBody *soft;
|
||||
/** Object duplicator for group. */
|
||||
struct Collection *dup_group;
|
||||
struct Collection *instance_collection;
|
||||
void *pad10;
|
||||
|
||||
char pad4;
|
||||
|
|
|
@ -267,10 +267,10 @@ typedef struct ParticleSettings {
|
|||
/** MAX_MTEX. */
|
||||
struct MTex *mtex[18];
|
||||
|
||||
struct Collection *dup_group;
|
||||
struct ListBase dupliweights;
|
||||
struct Collection *instance_collection;
|
||||
struct ListBase instance_weights;
|
||||
struct Collection *eff_group DNA_DEPRECATED; // deprecated
|
||||
struct Object *dup_ob;
|
||||
struct Object *instance_object;
|
||||
struct Object *bb_ob;
|
||||
/** Old animation system, deprecated for 2.5. */
|
||||
struct Ipo *ipo DNA_DEPRECATED;
|
||||
|
@ -343,7 +343,7 @@ typedef struct ParticleSystem {
|
|||
/** Particle system name, MAX_NAME. */
|
||||
char name[64];
|
||||
|
||||
/** Used for duplicators. */
|
||||
/** Used for instancing. */
|
||||
float imat[4][4];
|
||||
float cfra, tree_frame, bvhtree_frame;
|
||||
int seed, child_seed;
|
||||
|
@ -409,7 +409,7 @@ typedef enum eParticleDrawFlag {
|
|||
PART_ABS_PATH_TIME = (1 << 5),
|
||||
PART_DRAW_COUNT_GR = (1 << 6),
|
||||
PART_DRAW_BB_LOCK = (1 << 7), /* used with billboards */
|
||||
PART_DRAW_ROTATE_OB = (1 << 7), /* used with dupliobjects/groups */
|
||||
PART_DRAW_ROTATE_OB = (1 << 7), /* used with instance object/collection */
|
||||
PART_DRAW_PARENT = (1 << 8),
|
||||
PART_DRAW_NUM = (1 << 9),
|
||||
PART_DRAW_RAND_GR = (1 << 10),
|
||||
|
@ -418,7 +418,7 @@ typedef enum eParticleDrawFlag {
|
|||
PART_DRAW_MAT_COL = (1 << 13), /* deprecated, but used in do_versions */
|
||||
PART_DRAW_WHOLE_GR = (1 << 14),
|
||||
PART_DRAW_REN_STRAND = (1 << 15),
|
||||
PART_DRAW_NO_SCALE_OB = (1 << 16), /* used with dupliobjects/groups */
|
||||
PART_DRAW_NO_SCALE_OB = (1 << 16), /* used with instance object/collection */
|
||||
PART_DRAW_GUIDE_HAIRS = (1 << 17),
|
||||
PART_DRAW_HAIR_GRID = (1 << 18),
|
||||
} eParticleDrawFlag;
|
||||
|
|
|
@ -49,6 +49,11 @@ DNA_STRUCT_RENAME(SpaceOops, SpaceOutliner)
|
|||
DNA_STRUCT_RENAME_ELEM(Camera, YF_dofdist, dof_distance)
|
||||
DNA_STRUCT_RENAME_ELEM(Camera, clipend, clip_end)
|
||||
DNA_STRUCT_RENAME_ELEM(Camera, clipsta, clip_start)
|
||||
DNA_STRUCT_RENAME_ELEM(Object, dup_group, instance_collection)
|
||||
DNA_STRUCT_RENAME_ELEM(Object, dupfacesca, instance_faces_scale)
|
||||
DNA_STRUCT_RENAME_ELEM(ParticleSettings, dup_group, instance_collection)
|
||||
DNA_STRUCT_RENAME_ELEM(ParticleSettings, dup_ob, instance_object)
|
||||
DNA_STRUCT_RENAME_ELEM(ParticleSettings, dupliweights, instance_weights)
|
||||
DNA_STRUCT_RENAME_ELEM(View3D, far, clip_end)
|
||||
DNA_STRUCT_RENAME_ELEM(View3D, near, clip_start)
|
||||
DNA_STRUCT_RENAME_ELEM(bTheme, tact, space_action)
|
||||
|
@ -71,5 +76,4 @@ DNA_STRUCT_RENAME_ELEM(bTheme, tv3d, space_view3d)
|
|||
|
||||
#if 0
|
||||
DNA_STRUCT_RENAME(Lamp, Light)
|
||||
DNA_STRUCT_RENAME_ELEM(Object, dup_group, instance_collection)
|
||||
#endif
|
||||
|
|
|
@ -553,9 +553,9 @@ static void rna_Object_dup_collection_set(PointerRNA *ptr, PointerRNA value)
|
|||
*/
|
||||
if (BKE_collection_has_object_recursive(grp, ob) == 0) {
|
||||
if (ob->type == OB_EMPTY) {
|
||||
id_us_min(&ob->dup_group->id);
|
||||
ob->dup_group = grp;
|
||||
id_us_plus(&ob->dup_group->id);
|
||||
id_us_min(&ob->instance_collection->id);
|
||||
ob->instance_collection = grp;
|
||||
id_us_plus(&ob->instance_collection->id);
|
||||
}
|
||||
else {
|
||||
BKE_report(NULL, RPT_ERROR,
|
||||
|
@ -2620,14 +2620,14 @@ static void rna_def_object(BlenderRNA *brna)
|
|||
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
|
||||
|
||||
prop = RNA_def_property(srna, "instance_faces_scale", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "dupfacesca");
|
||||
RNA_def_property_float_sdna(prop, NULL, "instance_faces_scale");
|
||||
RNA_def_property_range(prop, 0.001f, 10000.0f);
|
||||
RNA_def_property_ui_text(prop, "Instance Faces Scale", "Scale the face instance objects");
|
||||
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
|
||||
|
||||
prop = RNA_def_property(srna, "instance_collection", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_struct_type(prop, "Collection");
|
||||
RNA_def_property_pointer_sdna(prop, NULL, "dup_group");
|
||||
RNA_def_property_pointer_sdna(prop, NULL, "instance_collection");
|
||||
RNA_def_property_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_pointer_funcs(prop, NULL, "rna_Object_dup_collection_set", NULL, NULL);
|
||||
RNA_def_property_ui_text(prop, "Instance Collection", "Instance an existing collection");
|
||||
|
|
|
@ -1082,7 +1082,7 @@ static bool rna_ParticleSystem_edited_get(PointerRNA *ptr)
|
|||
static PointerRNA rna_ParticleDupliWeight_active_get(PointerRNA *ptr)
|
||||
{
|
||||
ParticleSettings *part = (ParticleSettings *)ptr->id.data;
|
||||
ParticleDupliWeight *dw = part->dupliweights.first;
|
||||
ParticleDupliWeight *dw = part->instance_weights.first;
|
||||
|
||||
for (; dw; dw = dw->next) {
|
||||
if (dw->flag & PART_DUPLIW_CURRENT)
|
||||
|
@ -1095,13 +1095,13 @@ static void rna_ParticleDupliWeight_active_index_range(PointerRNA *ptr, int *min
|
|||
{
|
||||
ParticleSettings *part = (ParticleSettings *)ptr->id.data;
|
||||
*min = 0;
|
||||
*max = max_ii(0, BLI_listbase_count(&part->dupliweights) - 1);
|
||||
*max = max_ii(0, BLI_listbase_count(&part->instance_weights) - 1);
|
||||
}
|
||||
|
||||
static int rna_ParticleDupliWeight_active_index_get(PointerRNA *ptr)
|
||||
{
|
||||
ParticleSettings *part = (ParticleSettings *)ptr->id.data;
|
||||
ParticleDupliWeight *dw = part->dupliweights.first;
|
||||
ParticleDupliWeight *dw = part->instance_weights.first;
|
||||
int i = 0;
|
||||
|
||||
for (; dw; dw = dw->next, i++)
|
||||
|
@ -1114,7 +1114,7 @@ static int rna_ParticleDupliWeight_active_index_get(PointerRNA *ptr)
|
|||
static void rna_ParticleDupliWeight_active_index_set(struct PointerRNA *ptr, int value)
|
||||
{
|
||||
ParticleSettings *part = (ParticleSettings *)ptr->id.data;
|
||||
ParticleDupliWeight *dw = part->dupliweights.first;
|
||||
ParticleDupliWeight *dw = part->instance_weights.first;
|
||||
int i = 0;
|
||||
|
||||
for (; dw; dw = dw->next, i++) {
|
||||
|
@ -3094,14 +3094,14 @@ static void rna_def_particle_settings(BlenderRNA *brna)
|
|||
|
||||
/* draw objects & collections */
|
||||
prop = RNA_def_property(srna, "instance_collection", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_pointer_sdna(prop, NULL, "dup_group");
|
||||
RNA_def_property_pointer_sdna(prop, NULL, "instance_collection");
|
||||
RNA_def_property_struct_type(prop, "Collection");
|
||||
RNA_def_property_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_ui_text(prop, "Dupli Collection", "Show Objects in this collection in place of particles");
|
||||
RNA_def_property_update(prop, 0, "rna_Particle_redo_count");
|
||||
|
||||
prop = RNA_def_property(srna, "instance_weights", PROP_COLLECTION, PROP_NONE);
|
||||
RNA_def_property_collection_sdna(prop, NULL, "dupliweights", NULL);
|
||||
RNA_def_property_collection_sdna(prop, NULL, "instance_weights", NULL);
|
||||
RNA_def_property_struct_type(prop, "ParticleDupliWeight");
|
||||
RNA_def_property_ui_text(prop, "Dupli Collection Weights", "Weights for all of the objects in the dupli collection");
|
||||
|
||||
|
@ -3117,7 +3117,6 @@ static void rna_def_particle_settings(BlenderRNA *brna)
|
|||
RNA_def_property_ui_text(prop, "Active Dupli Object Index", "");
|
||||
|
||||
prop = RNA_def_property(srna, "instance_object", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_pointer_sdna(prop, NULL, "dup_ob");
|
||||
RNA_def_property_struct_type(prop, "Object");
|
||||
RNA_def_property_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_ui_text(prop, "Instance Object", "Show this Object in place of particles");
|
||||
|
|
|
@ -1530,10 +1530,10 @@ static void object_simplify_update(Object *ob)
|
|||
for (psys = ob->particlesystem.first; psys; psys = psys->next)
|
||||
psys->recalc |= ID_RECALC_PSYS_CHILD;
|
||||
|
||||
if (ob->dup_group) {
|
||||
if (ob->instance_collection) {
|
||||
CollectionObject *cob;
|
||||
|
||||
for (cob = ob->dup_group->gobject.first; cob; cob = cob->next)
|
||||
for (cob = ob->instance_collection->gobject.first; cob; cob = cob->next)
|
||||
object_simplify_update(cob->ob);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue