Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/object.c
| Show First 20 Lines • Show All 306 Lines • ▼ Show 20 Lines | if (md->type == eModifierType_Multires) { | ||||
| multiresModifier_sync_levels_ex(ob_dst, (MultiresModifierData *)md, (MultiresModifierData *)nmd); | multiresModifier_sync_levels_ex(ob_dst, (MultiresModifierData *)md, (MultiresModifierData *)nmd); | ||||
| } | } | ||||
| modifier_copyData(md, nmd); | modifier_copyData(md, nmd); | ||||
| BLI_addtail(&ob_dst->modifiers, nmd); | BLI_addtail(&ob_dst->modifiers, nmd); | ||||
| modifier_unique_name(&ob_dst->modifiers, nmd); | modifier_unique_name(&ob_dst->modifiers, nmd); | ||||
| } | } | ||||
| BKE_object_copy_particlesystems(ob_dst, ob_src); | BKE_object_copy_particlesystems(ob_dst, ob_src, 0); | ||||
| /* TODO: smoke?, cloth? */ | /* TODO: smoke?, cloth? */ | ||||
| } | } | ||||
| /* free data derived from mesh, called when mesh changes or is freed */ | /* free data derived from mesh, called when mesh changes or is freed */ | ||||
| void BKE_object_free_derived_caches(Object *ob) | void BKE_object_free_derived_caches(Object *ob) | ||||
| { | { | ||||
| /* Also serves as signal to remake texspace. | /* Also serves as signal to remake texspace. | ||||
| ▲ Show 20 Lines • Show All 508 Lines • ▼ Show 20 Lines | |||||
| struct Object *BKE_object_lod_matob_get(Object *ob, Scene *scene) | struct Object *BKE_object_lod_matob_get(Object *ob, Scene *scene) | ||||
| { | { | ||||
| return lod_ob_get(ob, scene, OB_LOD_USE_MAT); | return lod_ob_get(ob, scene, OB_LOD_USE_MAT); | ||||
| } | } | ||||
| #endif /* WITH_GAMEENGINE */ | #endif /* WITH_GAMEENGINE */ | ||||
| SoftBody *copy_softbody(const SoftBody *sb, bool copy_caches) | SoftBody *copy_softbody(const SoftBody *sb, const int flag) | ||||
| { | { | ||||
| SoftBody *sbn; | SoftBody *sbn; | ||||
| if (sb == NULL) return(NULL); | if (sb == NULL) return(NULL); | ||||
| sbn = MEM_dupallocN(sb); | sbn = MEM_dupallocN(sb); | ||||
| if (copy_caches == false) { | if ((flag & LIB_ID_COPY_CACHES) == 0) { | ||||
| sbn->totspring = sbn->totpoint = 0; | sbn->totspring = sbn->totpoint = 0; | ||||
| sbn->bpoint = NULL; | sbn->bpoint = NULL; | ||||
| sbn->bspring = NULL; | sbn->bspring = NULL; | ||||
| } | } | ||||
| else { | else { | ||||
| sbn->totspring = sb->totspring; | sbn->totspring = sb->totspring; | ||||
| sbn->totpoint = sb->totpoint; | sbn->totpoint = sb->totpoint; | ||||
| Show All 12 Lines | if (sb->bspring) | ||||
| sbn->bspring = MEM_dupallocN(sb->bspring); | sbn->bspring = MEM_dupallocN(sb->bspring); | ||||
| } | } | ||||
| sbn->keys = NULL; | sbn->keys = NULL; | ||||
| sbn->totkey = sbn->totpointkey = 0; | sbn->totkey = sbn->totpointkey = 0; | ||||
| sbn->scratch = NULL; | sbn->scratch = NULL; | ||||
| sbn->pointcache = BKE_ptcache_copy_list(&sbn->ptcaches, &sb->ptcaches, copy_caches); | sbn->pointcache = BKE_ptcache_copy_list(&sbn->ptcaches, &sb->ptcaches, flag); | ||||
| if (sb->effector_weights) | if (sb->effector_weights) | ||||
| sbn->effector_weights = MEM_dupallocN(sb->effector_weights); | sbn->effector_weights = MEM_dupallocN(sb->effector_weights); | ||||
| return sbn; | return sbn; | ||||
| } | } | ||||
| BulletSoftBody *copy_bulletsoftbody(const BulletSoftBody *bsb) | BulletSoftBody *copy_bulletsoftbody(const BulletSoftBody *bsb, const int UNUSED(flag)) | ||||
| { | { | ||||
| BulletSoftBody *bsbn; | BulletSoftBody *bsbn; | ||||
| if (bsb == NULL) | if (bsb == NULL) | ||||
| return NULL; | return NULL; | ||||
| bsbn = MEM_dupallocN(bsb); | bsbn = MEM_dupallocN(bsb); | ||||
| /* no pointer in this structure yet */ | /* no pointer in this structure yet */ | ||||
| return bsbn; | return bsbn; | ||||
| } | } | ||||
| ParticleSystem *BKE_object_copy_particlesystem(ParticleSystem *psys) | ParticleSystem *BKE_object_copy_particlesystem(ParticleSystem *psys, const int flag) | ||||
| { | { | ||||
| ParticleSystem *psysn; | ParticleSystem *psysn; | ||||
| ParticleData *pa; | ParticleData *pa; | ||||
| int p; | int p; | ||||
| psysn = MEM_dupallocN(psys); | psysn = MEM_dupallocN(psys); | ||||
| psysn->particles = MEM_dupallocN(psys->particles); | psysn->particles = MEM_dupallocN(psys->particles); | ||||
| psysn->child = MEM_dupallocN(psys->child); | psysn->child = MEM_dupallocN(psys->child); | ||||
| Show All 20 Lines | for (p = 0, pa = psysn->particles; p < psysn->totpart; p++, pa++) { | ||||
| pa->keys = key; | pa->keys = key; | ||||
| key += pa->totkey; | key += pa->totkey; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| if (psys->clmd) { | if (psys->clmd) { | ||||
| psysn->clmd = (ClothModifierData *)modifier_new(eModifierType_Cloth); | psysn->clmd = (ClothModifierData *)modifier_new(eModifierType_Cloth); | ||||
| modifier_copyData((ModifierData *)psys->clmd, (ModifierData *)psysn->clmd); | modifier_copyData_ex((ModifierData *)psys->clmd, (ModifierData *)psysn->clmd, flag); | ||||
| psys->hair_in_dm = psys->hair_out_dm = NULL; | psys->hair_in_dm = psys->hair_out_dm = NULL; | ||||
| } | } | ||||
| BLI_duplicatelist(&psysn->targets, &psys->targets); | BLI_duplicatelist(&psysn->targets, &psys->targets); | ||||
| psysn->pathcache = NULL; | psysn->pathcache = NULL; | ||||
| psysn->childcache = NULL; | psysn->childcache = NULL; | ||||
| psysn->edit = NULL; | psysn->edit = NULL; | ||||
| psysn->pdd = NULL; | psysn->pdd = NULL; | ||||
| psysn->effectors = NULL; | psysn->effectors = NULL; | ||||
| psysn->tree = NULL; | psysn->tree = NULL; | ||||
| psysn->bvhtree = NULL; | psysn->bvhtree = NULL; | ||||
| BLI_listbase_clear(&psysn->pathcachebufs); | BLI_listbase_clear(&psysn->pathcachebufs); | ||||
| BLI_listbase_clear(&psysn->childcachebufs); | BLI_listbase_clear(&psysn->childcachebufs); | ||||
| psysn->renderdata = NULL; | psysn->renderdata = NULL; | ||||
| psysn->pointcache = BKE_ptcache_copy_list(&psysn->ptcaches, &psys->ptcaches, false); | /* XXX Never copy caches here? */ | ||||
| psysn->pointcache = BKE_ptcache_copy_list(&psysn->ptcaches, &psys->ptcaches, flag & ~LIB_ID_COPY_CACHES); | |||||
| /* XXX - from reading existing code this seems correct but intended usage of | /* XXX - from reading existing code this seems correct but intended usage of | ||||
| * pointcache should /w cloth should be added in 'ParticleSystem' - campbell */ | * pointcache should /w cloth should be added in 'ParticleSystem' - campbell */ | ||||
| if (psysn->clmd) { | if (psysn->clmd) { | ||||
| psysn->clmd->point_cache = psysn->pointcache; | psysn->clmd->point_cache = psysn->pointcache; | ||||
| } | } | ||||
| if ((flag & LIB_ID_COPY_NO_USER_REFCOUNT) == 0) { | |||||
| id_us_plus((ID *)psysn->part); | id_us_plus((ID *)psysn->part); | ||||
| } | |||||
| return psysn; | return psysn; | ||||
| } | } | ||||
| void BKE_object_copy_particlesystems(Object *ob_dst, const Object *ob_src) | void BKE_object_copy_particlesystems(Object *ob_dst, const Object *ob_src, const int flag) | ||||
| { | { | ||||
| ParticleSystem *psys, *npsys; | ParticleSystem *psys, *npsys; | ||||
| ModifierData *md; | ModifierData *md; | ||||
| if (ob_dst->type != OB_MESH) { | if (ob_dst->type != OB_MESH) { | ||||
| /* currently only mesh objects can have soft body */ | /* currently only mesh objects can have soft body */ | ||||
| return; | return; | ||||
| } | } | ||||
| BLI_listbase_clear(&ob_dst->particlesystem); | BLI_listbase_clear(&ob_dst->particlesystem); | ||||
| for (psys = ob_src->particlesystem.first; psys; psys = psys->next) { | for (psys = ob_src->particlesystem.first; psys; psys = psys->next) { | ||||
| npsys = BKE_object_copy_particlesystem(psys); | npsys = BKE_object_copy_particlesystem(psys, flag); | ||||
| BLI_addtail(&ob_dst->particlesystem, npsys); | BLI_addtail(&ob_dst->particlesystem, npsys); | ||||
| /* need to update particle modifiers too */ | /* need to update particle modifiers too */ | ||||
| for (md = ob_dst->modifiers.first; md; md = md->next) { | for (md = ob_dst->modifiers.first; md; md = md->next) { | ||||
| if (md->type == eModifierType_ParticleSystem) { | if (md->type == eModifierType_ParticleSystem) { | ||||
| ParticleSystemModifierData *psmd = (ParticleSystemModifierData *)md; | ParticleSystemModifierData *psmd = (ParticleSystemModifierData *)md; | ||||
| if (psmd->psys == psys) | if (psmd->psys == psys) | ||||
| Show All 20 Lines | for (psys = ob_src->particlesystem.first; psys; psys = psys->next) { | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| void BKE_object_copy_softbody(Object *ob_dst, const Object *ob_src) | void BKE_object_copy_softbody(Object *ob_dst, const Object *ob_src) | ||||
| { | { | ||||
| if (ob_src->soft) { | if (ob_src->soft) { | ||||
| ob_dst->softflag = ob_src->softflag; | ob_dst->softflag = ob_src->softflag; | ||||
| ob_dst->soft = copy_softbody(ob_src->soft, false); | ob_dst->soft = copy_softbody(ob_src->soft, 0); | ||||
| } | } | ||||
| } | } | ||||
| static void copy_object_pose(Object *obn, const Object *ob) | static void copy_object_pose(Object *obn, const Object *ob, const int flag) | ||||
| { | { | ||||
| bPoseChannel *chan; | bPoseChannel *chan; | ||||
| /* note: need to clear obn->pose pointer first, so that BKE_pose_copy_data works (otherwise there's a crash) */ | /* note: need to clear obn->pose pointer first, so that BKE_pose_copy_data works (otherwise there's a crash) */ | ||||
| obn->pose = NULL; | obn->pose = NULL; | ||||
| BKE_pose_copy_data(&obn->pose, ob->pose, 1); /* 1 = copy constraints */ | BKE_pose_copy_data_ex(&obn->pose, ob->pose, flag, true); /* true = copy constraints */ | ||||
| for (chan = obn->pose->chanbase.first; chan; chan = chan->next) { | for (chan = obn->pose->chanbase.first; chan; chan = chan->next) { | ||||
| bConstraint *con; | bConstraint *con; | ||||
| chan->flag &= ~(POSE_LOC | POSE_ROT | POSE_SIZE); | chan->flag &= ~(POSE_LOC | POSE_ROT | POSE_SIZE); | ||||
| /* XXX Remapping object pointing onto itself should be handled by generic BKE_library_remap stuff, but... | |||||
| * the flush_constraint_targets callback am not sure about, so will delay that for now. */ | |||||
| for (con = chan->constraints.first; con; con = con->next) { | for (con = chan->constraints.first; con; con = con->next) { | ||||
| const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con); | const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con); | ||||
| ListBase targets = {NULL, NULL}; | ListBase targets = {NULL, NULL}; | ||||
| bConstraintTarget *ct; | bConstraintTarget *ct; | ||||
| if (cti && cti->get_constraint_targets) { | if (cti && cti->get_constraint_targets) { | ||||
| cti->get_constraint_targets(con, &targets); | cti->get_constraint_targets(con, &targets); | ||||
| for (ct = targets.first; ct; ct = ct->next) { | for (ct = targets.first; ct; ct = ct->next) { | ||||
| if (ct->tar == ob) | if (ct->tar == ob) | ||||
| ct->tar = obn; | ct->tar = obn; | ||||
| } | } | ||||
| if (cti->flush_constraint_targets) | if (cti->flush_constraint_targets) | ||||
| cti->flush_constraint_targets(con, &targets, 0); | cti->flush_constraint_targets(con, &targets, 0); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| static void copy_object_lod(Object *obn, const Object *ob) | static void copy_object_lod(Object *obn, const Object *ob, const int UNUSED(flag)) | ||||
| { | { | ||||
| BLI_duplicatelist(&obn->lodlevels, &ob->lodlevels); | BLI_duplicatelist(&obn->lodlevels, &ob->lodlevels); | ||||
| if (obn->lodlevels.first) | |||||
| ((LodLevel *)obn->lodlevels.first)->source = obn; | |||||
| obn->currentlod = (LodLevel *)obn->lodlevels.first; | obn->currentlod = (LodLevel *)obn->lodlevels.first; | ||||
| } | } | ||||
| bool BKE_object_pose_context_check(Object *ob) | bool BKE_object_pose_context_check(Object *ob) | ||||
| { | { | ||||
| if ((ob) && | if ((ob) && | ||||
| (ob->type == OB_ARMATURE) && | (ob->type == OB_ARMATURE) && | ||||
| (ob->pose) && | (ob->pose) && | ||||
| Show All 28 Lines | void BKE_object_transform_copy(Object *ob_tar, const Object *ob_src) | ||||
| copy_v3_v3(ob_tar->rot, ob_src->rot); | copy_v3_v3(ob_tar->rot, ob_src->rot); | ||||
| copy_v3_v3(ob_tar->quat, ob_src->quat); | copy_v3_v3(ob_tar->quat, ob_src->quat); | ||||
| copy_v3_v3(ob_tar->rotAxis, ob_src->rotAxis); | copy_v3_v3(ob_tar->rotAxis, ob_src->rotAxis); | ||||
| ob_tar->rotAngle = ob_src->rotAngle; | ob_tar->rotAngle = ob_src->rotAngle; | ||||
| ob_tar->rotmode = ob_src->rotmode; | ob_tar->rotmode = ob_src->rotmode; | ||||
| copy_v3_v3(ob_tar->size, ob_src->size); | copy_v3_v3(ob_tar->size, ob_src->size); | ||||
| } | } | ||||
| Object *BKE_object_copy_ex(Main *bmain, const Object *ob, bool copy_caches) | /** | ||||
| * Only copy internal data of Object ID from source to already allocated/initialized destination. | |||||
| * You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs. | |||||
| * | |||||
| * WARNING! This function will not handle ID user count! | |||||
| * | |||||
| * \param flag Copying options (see BKE_library.h's LIB_ID_COPY_... flags for more). | |||||
| */ | |||||
| void BKE_object_copy_data(Main *UNUSED(bmain), Object *ob_dst, const Object *ob_src, const int flag) | |||||
| { | { | ||||
| Object *obn; | |||||
| ModifierData *md; | ModifierData *md; | ||||
| int a; | |||||
| obn = BKE_libblock_copy(bmain, &ob->id); | /* We never handle usercount here for own data. */ | ||||
| const int flag_subdata = flag | LIB_ID_COPY_NO_USER_REFCOUNT; | |||||
| if (ob->totcol) { | if (ob_src->totcol) { | ||||
| obn->mat = MEM_dupallocN(ob->mat); | ob_dst->mat = MEM_dupallocN(ob_src->mat); | ||||
| obn->matbits = MEM_dupallocN(ob->matbits); | ob_dst->matbits = MEM_dupallocN(ob_src->matbits); | ||||
| obn->totcol = ob->totcol; | ob_dst->totcol = ob_src->totcol; | ||||
| } | } | ||||
| if (ob->iuser) obn->iuser = MEM_dupallocN(ob->iuser); | if (ob_src->iuser) ob_dst->iuser = MEM_dupallocN(ob_src->iuser); | ||||
| if (ob->bb) obn->bb = MEM_dupallocN(ob->bb); | if (ob_src->bb) ob_dst->bb = MEM_dupallocN(ob_src->bb); | ||||
| obn->flag &= ~OB_FROMGROUP; | ob_dst->flag &= ~OB_FROMGROUP; | ||||
| BLI_listbase_clear(&obn->modifiers); | BLI_listbase_clear(&ob_dst->modifiers); | ||||
| for (md = ob->modifiers.first; md; md = md->next) { | for (md = ob_src->modifiers.first; md; md = md->next) { | ||||
| ModifierData *nmd = modifier_new(md->type); | ModifierData *nmd = modifier_new(md->type); | ||||
| BLI_strncpy(nmd->name, md->name, sizeof(nmd->name)); | BLI_strncpy(nmd->name, md->name, sizeof(nmd->name)); | ||||
| modifier_copyData(md, nmd); | modifier_copyData_ex(md, nmd, flag_subdata); | ||||
| BLI_addtail(&obn->modifiers, nmd); | BLI_addtail(&ob_dst->modifiers, nmd); | ||||
| } | } | ||||
| BLI_listbase_clear(&obn->prop); | BLI_listbase_clear(&ob_dst->prop); | ||||
| BKE_bproperty_copy_list(&obn->prop, &ob->prop); | BKE_bproperty_copy_list(&ob_dst->prop, &ob_src->prop); | ||||
| BKE_sca_logic_copy(obn, ob); | BKE_sca_logic_copy(ob_dst, ob_src, flag_subdata); | ||||
| if (ob->pose) { | if (ob_src->pose) { | ||||
| copy_object_pose(obn, ob); | copy_object_pose(ob_dst, ob_src, flag_subdata); | ||||
| /* backwards compat... non-armatures can get poses in older files? */ | /* backwards compat... non-armatures can get poses in older files? */ | ||||
| if (ob->type == OB_ARMATURE) | if (ob_src->type == OB_ARMATURE) | ||||
| BKE_pose_rebuild(obn, obn->data); | BKE_pose_rebuild(ob_dst, ob_dst->data); | ||||
| } | } | ||||
| defgroup_copy_list(&obn->defbase, &ob->defbase); | defgroup_copy_list(&ob_dst->defbase, &ob_src->defbase); | ||||
| BKE_constraints_copy(&obn->constraints, &ob->constraints, true); | BKE_constraints_copy_ex(&ob_dst->constraints, &ob_src->constraints, flag_subdata, true); | ||||
| obn->mode = OB_MODE_OBJECT; | |||||
| obn->sculpt = NULL; | |||||
| /* increase user numbers */ | |||||
| id_us_plus((ID *)obn->data); | |||||
| id_us_plus((ID *)obn->poselib); | |||||
| id_us_plus((ID *)obn->gpd); | |||||
| id_us_plus((ID *)obn->dup_group); | |||||
| for (a = 0; a < obn->totcol; a++) id_us_plus((ID *)obn->mat[a]); | ob_dst->mode = OB_MODE_OBJECT; | ||||
| ob_dst->sculpt = NULL; | |||||
| if (ob->pd) { | if (ob_src->pd) { | ||||
| obn->pd = MEM_dupallocN(ob->pd); | ob_dst->pd = MEM_dupallocN(ob_src->pd); | ||||
| if (obn->pd->tex) | if (ob_dst->pd->rng) { | ||||
| id_us_plus(&(obn->pd->tex->id)); | ob_dst->pd->rng = MEM_dupallocN(ob_src->pd->rng); | ||||
| if (obn->pd->rng) | |||||
| obn->pd->rng = MEM_dupallocN(ob->pd->rng); | |||||
| } | } | ||||
| obn->soft = copy_softbody(ob->soft, copy_caches); | } | ||||
| obn->bsoft = copy_bulletsoftbody(ob->bsoft); | ob_dst->soft = copy_softbody(ob_src->soft, flag_subdata); | ||||
| obn->rigidbody_object = BKE_rigidbody_copy_object(ob); | ob_dst->bsoft = copy_bulletsoftbody(ob_src->bsoft, flag_subdata); | ||||
| obn->rigidbody_constraint = BKE_rigidbody_copy_constraint(ob); | ob_dst->rigidbody_object = BKE_rigidbody_copy_object(ob_src, flag_subdata); | ||||
| ob_dst->rigidbody_constraint = BKE_rigidbody_copy_constraint(ob_src, flag_subdata); | |||||
| BKE_object_copy_particlesystems(obn, ob); | |||||
| obn->derivedDeform = NULL; | BKE_object_copy_particlesystems(ob_dst, ob_src, flag_subdata); | ||||
| obn->derivedFinal = NULL; | |||||
| BLI_listbase_clear(&obn->gpulamp); | ob_dst->derivedDeform = NULL; | ||||
| BLI_listbase_clear(&obn->pc_ids); | ob_dst->derivedFinal = NULL; | ||||
| obn->mpath = NULL; | BLI_listbase_clear(&ob_dst->gpulamp); | ||||
| BLI_listbase_clear(&ob_dst->pc_ids); | |||||
| copy_object_lod(obn, ob); | ob_dst->mpath = NULL; | ||||
| /* Copy runtime surve data. */ | copy_object_lod(ob_dst, ob_src, flag_subdata); | ||||
| obn->curve_cache = NULL; | |||||
| BKE_id_copy_ensure_local(bmain, &ob->id, &obn->id); | /* Do not copy runtime curve data. */ | ||||
| ob_dst->curve_cache = NULL; | |||||
| /* Do not copy object's preview (mostly due to the fact renderers create temp copy of objects). */ | /* Do not copy object's preview (mostly due to the fact renderers create temp copy of objects). */ | ||||
| obn->preview = NULL; | if ((flag & LIB_ID_COPY_NO_PREVIEW) == 0 && false) { /* XXX TODO temp hack */ | ||||
| BKE_previewimg_id_copy(&ob_dst->id, &ob_src->id); | |||||
| return obn; | } | ||||
| else { | |||||
| ob_dst->preview = NULL; | |||||
| } | |||||
| } | } | ||||
| /* copy objects, will re-initialize cached simulation data */ | /* copy objects, will re-initialize cached simulation data */ | ||||
| Object *BKE_object_copy(Main *bmain, const Object *ob) | Object *BKE_object_copy(Main *bmain, const Object *ob) | ||||
| { | { | ||||
| return BKE_object_copy_ex(bmain, ob, false); | Object *ob_copy; | ||||
| BKE_id_copy_ex(bmain, &ob->id, (ID **)&ob_copy, 0, false); | |||||
| return ob_copy; | |||||
| } | } | ||||
| void BKE_object_make_local_ex(Main *bmain, Object *ob, const bool lib_local, const bool clear_proxy) | void BKE_object_make_local_ex(Main *bmain, Object *ob, const bool lib_local, const bool clear_proxy) | ||||
| { | { | ||||
| bool is_local = false, is_lib = false; | bool is_local = false, is_lib = false; | ||||
| /* - only lib users: do nothing (unless force_local is set) | /* - only lib users: do nothing (unless force_local is set) | ||||
| * - only local users: set flag | * - only local users: set flag | ||||
| ▲ Show 20 Lines • Show All 181 Lines • ▼ Show 20 Lines | if ((target->totcol) && (target->mat) && OB_TYPE_SUPPORT_MATERIAL(ob->type)) { | ||||
| for (i = 0; i < target->totcol; i++) { | for (i = 0; i < target->totcol; i++) { | ||||
| /* don't need to run test_object_materials since we know this object is new and not used elsewhere */ | /* don't need to run test_object_materials since we know this object is new and not used elsewhere */ | ||||
| id_us_plus((ID *)ob->mat[i]); | id_us_plus((ID *)ob->mat[i]); | ||||
| } | } | ||||
| } | } | ||||
| /* type conversions */ | /* type conversions */ | ||||
| if (target->type == OB_ARMATURE) { | if (target->type == OB_ARMATURE) { | ||||
| copy_object_pose(ob, target); /* data copy, object pointers in constraints */ | copy_object_pose(ob, target, 0); /* data copy, object pointers in constraints */ | ||||
| BKE_pose_rest(ob->pose); /* clear all transforms in channels */ | BKE_pose_rest(ob->pose); /* clear all transforms in channels */ | ||||
| BKE_pose_rebuild(ob, ob->data); /* set all internal links */ | BKE_pose_rebuild(ob, ob->data); /* set all internal links */ | ||||
| armature_set_id_extern(ob); | armature_set_id_extern(ob); | ||||
| } | } | ||||
| else if (target->type == OB_EMPTY) { | else if (target->type == OB_EMPTY) { | ||||
| ob->empty_drawtype = target->empty_drawtype; | ob->empty_drawtype = target->empty_drawtype; | ||||
| ob->empty_drawsize = target->empty_drawsize; | ob->empty_drawsize = target->empty_drawsize; | ||||
| ▲ Show 20 Lines • Show All 2,283 Lines • Show Last 20 Lines | |||||