diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-06-17 18:10:19 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-06-17 18:10:19 +0300 |
commit | 06a1a66a9b6f120867d3bbebe3928744ec8e3495 (patch) | |
tree | 42e827a3cf58eb76474e479206b02a8d97dd3bf7 /source/blender/blenkernel/intern/object.c | |
parent | 61d27db35967710421ab92748e09624db068258d (diff) | |
parent | a24b4e6090057479796e914bc603119b12f6ca06 (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/blenkernel/intern/object.c')
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 226 |
1 files changed, 113 insertions, 113 deletions
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 2db9e2f6b5e..ac47fcec6b4 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -148,7 +148,7 @@ static ThreadMutex vparent_lock = BLI_MUTEX_INITIALIZER; void BKE_object_workob_clear(Object *workob) { memset(workob, 0, sizeof(Object)); - + workob->size[0] = workob->size[1] = workob->size[2] = 1.0f; workob->dscale[0] = workob->dscale[1] = workob->dscale[2] = 1.0f; workob->rotmode = ROT_MODE_EUL; @@ -436,9 +436,9 @@ void BKE_object_free(Object *ob) animviz_free_motionpath(ob->mpath); ob->mpath = NULL; } - + BKE_constraints_free_ex(&ob->constraints, false); - + free_partdeflect(ob->pd); BKE_rigidbody_free_object(ob); BKE_rigidbody_free_constraint(ob); @@ -478,7 +478,7 @@ bool BKE_object_is_in_editmode(const Object *ob) { if (ob->data == NULL) return false; - + if (ob->type == OB_MESH) { Mesh *me = ob->data; if (me->edit_btmesh) @@ -486,25 +486,25 @@ bool BKE_object_is_in_editmode(const Object *ob) } else if (ob->type == OB_ARMATURE) { bArmature *arm = ob->data; - + if (arm->edbo) return true; } else if (ob->type == OB_FONT) { Curve *cu = ob->data; - + if (cu->editfont) return true; } else if (ob->type == OB_MBALL) { MetaBall *mb = ob->data; - + if (mb->editelems) return true; } else if (ob->type == OB_LATTICE) { Lattice *lt = ob->data; - + if (lt->editlatt) return true; } @@ -628,9 +628,9 @@ bool BKE_object_is_visible(Object *ob, const eObjectVisibilityCheck mode) bool BKE_object_exists_check(Main *bmain, const Object *obtest) { Object *ob; - + if (obtest == NULL) return false; - + ob = bmain->object.first; while (ob) { if (ob == obtest) return true; @@ -692,12 +692,12 @@ void BKE_object_init(Object *ob) ob->col[0] = ob->col[1] = ob->col[2] = 1.0; ob->col[3] = 1.0; - + ob->size[0] = ob->size[1] = ob->size[2] = 1.0; ob->dscale[0] = ob->dscale[1] = ob->dscale[2] = 1.0; - - /* objects should default to having Euler XYZ rotations, - * but rotations default to quaternions + + /* objects should default to having Euler XYZ rotations, + * but rotations default to quaternions */ ob->rotmode = ROT_MODE_EUL; @@ -709,7 +709,7 @@ void BKE_object_init(Object *ob) /* rotation locks should be 4D for 4 component rotations by default... */ ob->protectflag = OB_LOCK_ROT4D; - + unit_m4(ob->constinv); unit_m4(ob->parentinv); unit_m4(ob->obmat); @@ -725,7 +725,7 @@ void BKE_object_init(Object *ob) ob->trackflag = OB_POSY; ob->upflag = OB_POSZ; } - + ob->dupon = 1; ob->dupoff = 0; ob->dupsta = 1; ob->dupend = 100; ob->dupfacesca = 1.0; @@ -739,7 +739,7 @@ void BKE_object_init(Object *ob) ob->fluidsimSettings = NULL; BLI_listbase_clear(&ob->pc_ids); - + /* Animation Visualization defaults */ animviz_settings_init(&ob->avs); @@ -830,9 +830,9 @@ Object *BKE_object_add_from( SoftBody *copy_softbody(const SoftBody *sb, const int flag) { SoftBody *sbn; - + if (sb == NULL) return(NULL); - + sbn = MEM_dupallocN(sb); if ((flag & LIB_ID_COPY_CACHES) == 0) { @@ -858,10 +858,10 @@ SoftBody *copy_softbody(const SoftBody *sb, const int flag) if (sb->bspring) sbn->bspring = MEM_dupallocN(sb->bspring); } - + sbn->keys = NULL; sbn->totkey = sbn->totpointkey = 0; - + sbn->scratch = NULL; sbn->pointcache = BKE_ptcache_copy_list(&sbn->ptcaches, &sb->ptcaches, flag); @@ -893,10 +893,10 @@ ParticleSystem *BKE_object_copy_particlesystem(ParticleSystem *psys, const int f if (key) key = MEM_dupallocN(key); - + if (boid) boid = MEM_dupallocN(boid); - + for (p = 0, pa = psysn->particles; p < psysn->totpart; p++, pa++) { if (boid) pa->boid = boid++; @@ -923,10 +923,10 @@ ParticleSystem *BKE_object_copy_particlesystem(ParticleSystem *psys, const int f psysn->tree = NULL; psysn->bvhtree = NULL; psysn->batch_cache = NULL; - + BLI_listbase_clear(&psysn->pathcachebufs); BLI_listbase_clear(&psysn->childcachebufs); - + psysn->pointcache = BKE_ptcache_copy_list(&psysn->ptcaches, &psys->ptcaches, flag); /* XXX - from reading existing code this seems correct but intended usage of @@ -975,7 +975,7 @@ void BKE_object_copy_particlesystems(Object *ob_dst, const Object *ob_src, const } else if (md->type == eModifierType_Smoke) { SmokeModifierData *smd = (SmokeModifierData *) md; - + if (smd->type == MOD_SMOKE_TYPE_FLOW) { if (smd->flow) { if (smd->flow->psys == psys) @@ -998,31 +998,31 @@ void BKE_object_copy_softbody(Object *ob_dst, const Object *ob_src) static void copy_object_pose(Object *obn, const Object *ob, const int flag) { bPoseChannel *chan; - + /* note: need to clear obn->pose pointer first, so that BKE_pose_copy_data works (otherwise there's a crash) */ obn->pose = NULL; BKE_pose_copy_data_ex(&obn->pose, ob->pose, flag, true); /* true = copy constraints */ for (chan = obn->pose->chanbase.first; chan; chan = chan->next) { bConstraint *con; - + 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) { const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con); ListBase targets = {NULL, NULL}; bConstraintTarget *ct; - + if (cti && cti->get_constraint_targets) { cti->get_constraint_targets(con, &targets); - + for (ct = targets.first; ct; ct = ct->next) { if (ct->tar == ob) ct->tar = obn; } - + if (cti->flush_constraint_targets) cti->flush_constraint_targets(con, &targets, 0); } @@ -1191,11 +1191,11 @@ void BKE_object_copy_data(Main *UNUSED(bmain), Object *ob_dst, const Object *ob_ } if (ob_src->iuser) ob_dst->iuser = MEM_dupallocN(ob_src->iuser); - + if (ob_src->bb) ob_dst->bb = MEM_dupallocN(ob_src->bb); - + BLI_listbase_clear(&ob_dst->modifiers); - + for (md = ob_src->modifiers.first; md; md = md->next) { ModifierData *nmd = modifier_new(md->type); BLI_strncpy(nmd->name, md->name, sizeof(nmd->name)); @@ -1227,7 +1227,7 @@ void BKE_object_copy_data(Main *UNUSED(bmain), Object *ob_dst, const Object *ob_ ob_dst->rigidbody_constraint = BKE_rigidbody_copy_constraint(ob_src, flag_subdata); BKE_object_copy_particlesystems(ob_dst, ob_src, flag_subdata); - + ob_dst->derivedDeform = NULL; ob_dst->derivedFinal = NULL; @@ -1239,7 +1239,7 @@ void BKE_object_copy_data(Main *UNUSED(bmain), Object *ob_dst, const Object *ob_ ob_dst->mpath = animviz_copy_motionpath(ob_src->mpath); copy_object_lod(ob_dst, ob_src, flag_subdata); - + /* Do not copy runtime curve data. */ ob_dst->curve_cache = NULL; @@ -1335,34 +1335,34 @@ static void armature_set_id_extern(Object *ob) bArmature *arm = ob->data; bPoseChannel *pchan; unsigned int lay = arm->layer_protected; - + for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) { if (!(pchan->bone->layer & lay)) id_lib_extern((ID *)pchan->custom); } - + } void BKE_object_copy_proxy_drivers(Object *ob, Object *target) { if ((target->adt) && (target->adt->drivers.first)) { FCurve *fcu; - + /* add new animdata block */ if (!ob->adt) ob->adt = BKE_animdata_add_id(&ob->id); - + /* make a copy of all the drivers (for now), then correct any links that need fixing */ free_fcurves(&ob->adt->drivers); copy_fcurves(&ob->adt->drivers, &target->adt->drivers); - + for (fcu = ob->adt->drivers.first; fcu; fcu = fcu->next) { ChannelDriver *driver = fcu->driver; DriverVar *dvar; - + for (dvar = driver->variables.first; dvar; dvar = dvar->next) { /* all drivers */ - DRIVER_TARGETS_LOOPER(dvar) + DRIVER_TARGETS_LOOPER(dvar) { if (dtar->id) { if ((Object *)dtar->id == target) @@ -1393,14 +1393,14 @@ void BKE_object_make_proxy(Object *ob, Object *target, Object *cob) printf("cannot make proxy\n"); return; } - + ob->proxy = target; ob->proxy_group = cob; id_lib_extern(&target->id); - + DEG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); DEG_id_tag_update(&target->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); - + /* copy transform * - cob means this proxy comes from a collection, just apply the matrix * so the object wont move from its dupli-transform. @@ -1422,13 +1422,13 @@ void BKE_object_make_proxy(Object *ob, Object *target, Object *cob) ob->parent = target->parent; /* libdata */ copy_m4_m4(ob->parentinv, target->parentinv); } - + /* copy animdata stuff - drivers only for now... */ BKE_object_copy_proxy_drivers(ob, target); /* skip constraints? */ /* FIXME: this is considered by many as a bug */ - + /* set object type and link to data */ ob->type = target->type; ob->data = target->data; @@ -1445,24 +1445,24 @@ void BKE_object_make_proxy(Object *ob, Object *target, Object *cob) ob->matbits = NULL; if ((target->totcol) && (target->mat) && OB_TYPE_SUPPORT_MATERIAL(ob->type)) { int i; - + ob->actcol = target->actcol; ob->totcol = target->totcol; - + ob->mat = MEM_dupallocN(target->mat); ob->matbits = MEM_dupallocN(target->matbits); 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 */ - id_us_plus((ID *)ob->mat[i]); + id_us_plus((ID *)ob->mat[i]); } } - + /* type conversions */ if (target->type == OB_ARMATURE) { copy_object_pose(ob, target, 0); /* data copy, object pointers in constraints */ BKE_pose_rest(ob->pose); /* clear all transforms in channels */ BKE_pose_rebuild(ob, ob->data); /* set all internal links */ - + armature_set_id_extern(ob); } else if (target->type == OB_EMPTY) { @@ -1546,7 +1546,7 @@ void BKE_object_scale_to_mat3(Object *ob, float mat[3][3]) void BKE_object_rot_to_mat3(Object *ob, float mat[3][3], bool use_drot) { float rmat[3][3], dmat[3][3]; - + /* 'dmat' is the delta-rotation matrix, which will get (pre)multiplied * with the rotation matrix to yield the appropriate rotation */ @@ -1565,14 +1565,14 @@ void BKE_object_rot_to_mat3(Object *ob, float mat[3][3], bool use_drot) else { /* quats are normalized before use to eliminate scaling issues */ float tquat[4]; - + normalize_qt_qt(tquat, ob->quat); quat_to_mat3(rmat, tquat); - + normalize_qt_qt(tquat, ob->dquat); quat_to_mat3(dmat, tquat); } - + /* combine these rotations */ if (use_drot) mul_m3_m3m3(mat, dmat, rmat); @@ -1696,7 +1696,7 @@ void BKE_object_to_mat3(Object *ob, float mat[3][3]) /* no parent */ float smat[3][3]; float rmat[3][3]; /*float q1[4];*/ - + /* size */ BKE_object_scale_to_mat3(ob, smat); @@ -1708,9 +1708,9 @@ void BKE_object_to_mat3(Object *ob, float mat[3][3]) /* no parent */ void BKE_object_to_mat4(Object *ob, float mat[4][4]) { float tmat[3][3]; - + BKE_object_to_mat3(ob, tmat); - + copy_m4_m3(mat, tmat); add_v3_v3v3(mat[3], ob->loc, ob->dloc); @@ -1760,7 +1760,7 @@ static bool ob_parcurve(Depsgraph *depsgraph, Scene *UNUSED(scene), Object *ob, /* catch exceptions: curve paths used as a duplicator */ if (enable_cu_speed) { /* ctime is now a proper var setting of Curve which gets set by Animato like any other var that's animated, - * but this will only work if it actually is animated... + * but this will only work if it actually is animated... * * we divide the curvetime calculated in the previous step by the length of the path, to get a time * factor, which then gets clamped to lie within 0.0 - 1.0 range @@ -1784,10 +1784,10 @@ static bool ob_parcurve(Depsgraph *depsgraph, Scene *UNUSED(scene), Object *ob, if (cu->pathlen) { ctime /= cu->pathlen; } - + CLAMP(ctime, 0.0f, 1.0f); } - + unit_m4(mat); /* vec: 4 items! */ @@ -1797,7 +1797,7 @@ static bool ob_parcurve(Depsgraph *depsgraph, Scene *UNUSED(scene), Object *ob, #if 0 float si, q[4]; vec_to_quat(quat, dir, ob->trackflag, ob->upflag); - + /* the tilt */ normalize_v3(dir); q[0] = cosf(0.5 * vec[3]); @@ -1812,7 +1812,7 @@ static bool ob_parcurve(Depsgraph *depsgraph, Scene *UNUSED(scene), Object *ob, normalize_qt(quat); quat_to_mat4(mat, quat); } - + if (cu->flag & CU_PATH_RADIUS) { float tmat[4][4], rmat[4][4]; scale_m4_fl(tmat, radius); @@ -1821,22 +1821,22 @@ static bool ob_parcurve(Depsgraph *depsgraph, Scene *UNUSED(scene), Object *ob, } copy_v3_v3(mat[3], vec); - + } return true; } static void ob_parbone(Object *ob, Object *par, float mat[4][4]) -{ +{ bPoseChannel *pchan; float vec[3]; - + if (par->type != OB_ARMATURE) { unit_m4(mat); return; } - + /* Make sure the bone is still valid */ pchan = BKE_pose_channel_find_name(par->pose, ob->parsubstr); if (!pchan || !pchan->bone) { @@ -1864,14 +1864,14 @@ static void ob_parbone(Object *ob, Object *par, float mat[4][4]) static void give_parvert(Object *par, int nr, float vec[3]) { zero_v3(vec); - + if (par->type == OB_MESH) { Mesh *me = par->data; BMEditMesh *em = me->edit_btmesh; DerivedMesh *dm; dm = (em) ? em->derivedFinal : par->derivedFinal; - + if (dm) { int count = 0; int numVerts = dm->getNumVerts(dm); @@ -2047,16 +2047,16 @@ void BKE_object_get_parent_matrix(Depsgraph *depsgraph, Scene *scene, Object *ob ok = 1; } } - + if (ok) mul_m4_m4m4(parentmat, par->obmat, tmat); else copy_m4_m4(parentmat, par->obmat); - + break; case PARBONE: ob_parbone(ob, par, tmat); mul_m4_m4m4(parentmat, par->obmat, tmat); break; - + case PARVERT1: unit_m4(parentmat); give_parvert(par, ob->par1, vec); @@ -2064,10 +2064,10 @@ void BKE_object_get_parent_matrix(Depsgraph *depsgraph, Scene *scene, Object *ob break; case PARVERT3: ob_parvert3(ob, par, tmat); - + mul_m4_m4m4(parentmat, par->obmat, tmat); break; - + case PARSKEL: copy_m4_m4(parentmat, par->obmat); break; @@ -2085,22 +2085,22 @@ static void solve_parenting(Depsgraph *depsgraph, float totmat[4][4]; float tmat[4][4]; float locmat[4][4]; - + BKE_object_to_mat4(ob, locmat); - + if (ob->partype & PARSLOW) copy_m4_m4(slowmat, obmat); BKE_object_get_parent_matrix(depsgraph, scene, ob, par, totmat); - + /* total */ mul_m4_m4m4(tmat, totmat, ob->parentinv); mul_m4_m4m4(obmat, tmat, locmat); - + if (r_originmat) { /* usable originmat */ copy_m3_m4(r_originmat, tmat); } - + /* origin, for help line */ if (set_origin) { if ((ob->partype & PARTYPE) == PARSKEL) { @@ -2138,18 +2138,18 @@ void BKE_object_where_is_calc_time_ex( RigidBodyWorld *rbw, float r_originmat[3][3]) { if (ob == NULL) return; - + /* execute drivers only, as animation has already been done */ BKE_animsys_evaluate_animdata(depsgraph, scene, &ob->id, ob->adt, ctime, ADT_RECALC_DRIVERS); - + if (ob->parent) { Object *par = ob->parent; float slowmat[4][4]; - + /* calculate parent matrix */ solve_parenting(depsgraph, scene, ob, par, ob->obmat, slowmat, r_originmat, true); - - /* "slow parent" is definitely not threadsafe, and may also give bad results jumping around + + /* "slow parent" is definitely not threadsafe, and may also give bad results jumping around * An old-fashioned hack which probably doesn't really cut it anymore */ if (ob->partype & PARSLOW) { @@ -2165,7 +2165,7 @@ void BKE_object_where_is_calc_time_ex( rbw = rbw ? rbw : scene->rigidbody_world; /* read values pushed into RBO from sim/cache... */ BKE_rigidbody_sync_transforms(rbw, ob, ctime); - + /* solve constraints */ if (ob->constraints.first && !(ob->transflag & OB_NO_CONSTRAINTS)) { bConstraintOb *cob; @@ -2173,7 +2173,7 @@ void BKE_object_where_is_calc_time_ex( BKE_constraints_solve(depsgraph, &ob->constraints, cob, ctime); BKE_constraints_clear_evalob(cob); } - + /* set negative scale flag in object */ if (is_negative_m4(ob->obmat)) ob->transflag |= OB_NEG_SCALE; else ob->transflag &= ~OB_NEG_SCALE; @@ -2195,9 +2195,9 @@ void BKE_object_where_is_calc_mat4(Depsgraph *depsgraph, Scene *scene, Object *o float slowmat[4][4]; Object *par = ob->parent; - + solve_parenting(depsgraph, scene, ob, par, obmat, slowmat, NULL, false); - + if (ob->partype & PARSLOW) where_is_object_parslow(ob, obmat, slowmat); } @@ -2227,7 +2227,7 @@ void BKE_object_workob_calc_parent(Depsgraph *depsgraph, Scene *scene, Object *o { Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob); BKE_object_workob_clear(workob); - + unit_m4(workob->obmat); unit_m4(workob->parentinv); unit_m4(workob->constinv); @@ -2237,7 +2237,7 @@ void BKE_object_workob_calc_parent(Depsgraph *depsgraph, Scene *scene, Object *o workob->trackflag = ob_eval->trackflag; workob->upflag = ob_eval->upflag; - + workob->partype = ob_eval->partype; workob->par1 = ob_eval->par1; workob->par2 = ob_eval->par2; @@ -2303,7 +2303,7 @@ BoundBox *BKE_boundbox_alloc_unit(void) bb = MEM_callocN(sizeof(BoundBox), "OB-BoundBox"); BKE_boundbox_init_from_minmax(bb, min, max); - + return bb; } @@ -2311,7 +2311,7 @@ void BKE_boundbox_init_from_minmax(BoundBox *bb, const float min[3], const float { bb->vec[0][0] = bb->vec[1][0] = bb->vec[2][0] = bb->vec[3][0] = min[0]; bb->vec[4][0] = bb->vec[5][0] = bb->vec[6][0] = bb->vec[7][0] = max[0]; - + bb->vec[0][1] = bb->vec[1][1] = bb->vec[4][1] = bb->vec[5][1] = min[1]; bb->vec[2][1] = bb->vec[3][1] = bb->vec[6][1] = bb->vec[7][1] = max[1]; @@ -2346,7 +2346,7 @@ void BKE_boundbox_minmax(const BoundBox *bb, float obmat[4][4], float r_min[3], BoundBox *BKE_object_boundbox_get(Object *ob) { BoundBox *bb = NULL; - + if (ob->type == OB_MESH) { bb = BKE_mesh_boundbox_get(ob); } @@ -2378,13 +2378,13 @@ void BKE_object_boundbox_flag(Object *ob, int flag, const bool set) void BKE_object_dimensions_get(Object *ob, float vec[3]) { BoundBox *bb = NULL; - + bb = BKE_object_boundbox_get(ob); if (bb) { float scale[3]; - + mat4_to_size(scale, ob->obmat); - + vec[0] = fabsf(scale[0]) * (bb->vec[4][0] - bb->vec[0][0]); vec[1] = fabsf(scale[1]) * (bb->vec[2][1] - bb->vec[0][1]); vec[2] = fabsf(scale[2]) * (bb->vec[1][2] - bb->vec[0][2]); @@ -2397,17 +2397,17 @@ void BKE_object_dimensions_get(Object *ob, float vec[3]) void BKE_object_dimensions_set(Object *ob, const float value[3]) { BoundBox *bb = NULL; - + bb = BKE_object_boundbox_get(ob); if (bb) { float scale[3], len[3]; - + mat4_to_size(scale, ob->obmat); - + len[0] = bb->vec[4][0] - bb->vec[0][0]; len[1] = bb->vec[2][1] - bb->vec[0][1]; len[2] = bb->vec[1][2] - bb->vec[0][2]; - + if (len[0] > 0.f) ob->size[0] = value[0] / len[0]; if (len[1] > 0.f) ob->size[1] = value[1] / len[1]; if (len[2] > 0.f) ob->size[2] = value[2] / len[2]; @@ -2419,7 +2419,7 @@ void BKE_object_minmax(Object *ob, float min_r[3], float max_r[3], const bool us BoundBox bb; float vec[3]; bool changed = false; - + switch (ob->type) { case OB_CURVE: case OB_FONT: @@ -2767,7 +2767,7 @@ void BKE_object_handle_update_ex(Depsgraph *depsgraph, object_handle_update_proxy(depsgraph, scene, ob, do_proxy_update); } -/* WARNING: "scene" here may not be the scene object actually resides in. +/* WARNING: "scene" here may not be the scene object actually resides in. * When dealing with background-sets, "scene" is actually the active scene. * e.g. "scene" <-- set 1 <-- set 2 ("ob" lives here) <-- set 3 <-- ... <-- set n * rigid bodies depend on their world so use BKE_object_handle_update_ex() to also pass along the corrent rigid body world @@ -2812,10 +2812,10 @@ void BKE_object_sculpt_modifiers_changed(Object *ob) int BKE_object_obdata_texspace_get(Object *ob, short **r_texflag, float **r_loc, float **r_size, float **r_rot) { - + if (ob->data == NULL) return 0; - + switch (GS(((ID *)ob->data)->name)) { case ID_ME: { @@ -2919,7 +2919,7 @@ static int pc_cmp(const void *a, const void *b) else return 0; } -int BKE_object_insert_ptcache(Object *ob) +int BKE_object_insert_ptcache(Object *ob) { LinkData *link = NULL; int i = 0; @@ -2944,18 +2944,18 @@ static int pc_findindex(ListBase *listbase, int index) { LinkData *link = NULL; int number = 0; - + if (listbase == NULL) return -1; - + link = listbase->first; while (link) { if (GET_INT_FROM_POINTER(link->data) == index) return number; - + number++; link = link->next; } - + return -1; } @@ -3080,7 +3080,7 @@ static KeyBlock *insert_curvekey(Main *bmain, Object *ob, const char *name, cons } KeyBlock *BKE_object_shapekey_insert(Main *bmain, Object *ob, const char *name, const bool from_mix) -{ +{ switch (ob->type) { case OB_MESH: return insert_meshkey(bmain, ob, name, from_mix); |