6 * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version. The Blender
12 * Foundation also sells licenses for use in proprietary software under
13 * the Blender License. See http://www.blender.org/BL/ for information
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software Foundation,
23 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
26 * All rights reserved.
28 * The Original Code is: all of this file.
30 * Contributor(s): none yet.
32 * ***** END GPL/BL DUAL LICENSE BLOCK *****
43 #include "MEM_guardedalloc.h"
45 #include "DNA_action_types.h"
46 #include "DNA_armature_types.h"
47 #include "DNA_camera_types.h"
48 #include "DNA_constraint_types.h"
49 #include "DNA_curve_types.h"
50 #include "DNA_group_types.h"
51 #include "DNA_ipo_types.h"
52 #include "DNA_lamp_types.h"
53 #include "DNA_lattice_types.h"
54 #include "DNA_material_types.h"
55 #include "DNA_mesh_types.h"
56 #include "DNA_meshdata_types.h"
57 #include "DNA_modifier_types.h"
58 #include "DNA_nla_types.h"
59 #include "DNA_object_types.h"
60 #include "DNA_object_force.h"
61 #include "DNA_object_fluidsim.h"
62 #include "DNA_oops_types.h"
63 #include "DNA_scene_types.h"
64 #include "DNA_screen_types.h"
65 #include "DNA_space_types.h"
66 #include "DNA_texture_types.h"
67 #include "DNA_userdef_types.h"
68 #include "DNA_view3d_types.h"
69 #include "DNA_world_types.h"
71 #include "BKE_armature.h"
72 #include "BKE_action.h"
73 #include "BKE_colortools.h"
74 #include "BKE_deform.h"
75 #include "BKE_DerivedMesh.h"
78 #include "BLI_blenlib.h"
79 #include "BLI_arithb.h"
80 #include "BLI_editVert.h"
82 #include "BKE_utildefines.h"
83 #include "BKE_bad_level_calls.h"
86 #include "BKE_global.h"
89 #include "BKE_blender.h"
90 #include "BKE_constraint.h"
91 #include "BKE_curve.h"
92 #include "BKE_displist.h"
93 #include "BKE_effect.h"
94 #include "BKE_group.h"
95 #include "BKE_icons.h"
98 #include "BKE_lattice.h"
99 #include "BKE_library.h"
100 #include "BKE_mesh.h"
101 #include "BKE_mball.h"
102 #include "BKE_modifier.h"
103 #include "BKE_object.h"
104 #include "BKE_property.h"
106 #include "BKE_scene.h"
107 #include "BKE_screen.h"
108 #include "BKE_softbody.h"
110 #include "LBM_fluidsim.h"
112 #include "BPY_extern.h"
114 /* Local function protos */
115 static void solve_parenting (Object *ob, Object *par, float obmat[][4], float slowmat[][4], int simul);
117 float originmat[3][3]; /* after where_is_object(), can be used in other functions (bad!) */
120 void clear_workob(void)
122 memset(&workob, 0, sizeof(Object));
124 workob.size[0]= workob.size[1]= workob.size[2]= 1.0;
128 void copy_baseflags()
130 Base *base= G.scene->base.first;
133 base->object->flag= base->flag;
138 void copy_objectflags()
140 Base *base= G.scene->base.first;
143 base->flag= base->object->flag;
148 void update_base_layer(Object *ob)
150 Base *base= G.scene->base.first;
153 if (base->object == ob) base->lay= ob->lay;
158 void object_free_modifiers(Object *ob)
160 while (ob->modifiers.first) {
161 ModifierData *md = ob->modifiers.first;
163 BLI_remlink(&ob->modifiers, md);
169 /* here we will collect all local displist stuff */
170 /* also (ab)used in depsgraph */
171 void object_free_display(Object *ob)
173 if(ob->derivedDeform) {
174 ob->derivedDeform->needsFree = 1;
175 ob->derivedDeform->release(ob->derivedDeform);
176 ob->derivedDeform= NULL;
178 if(ob->derivedFinal) {
179 ob->derivedFinal->needsFree = 1;
180 ob->derivedFinal->release(ob->derivedFinal);
181 ob->derivedFinal= NULL;
184 freedisplist(&ob->disp);
187 /* do not free object itself */
188 void free_object(Object *ob)
192 object_free_display(ob);
194 /* disconnect specific data */
199 if(ob->type==OB_MESH) unlink_mesh(ob->data);
200 else if(ob->type==OB_CURVE) unlink_curve(ob->data);
201 else if(ob->type==OB_MBALL) unlink_mball(ob->data);
206 for(a=0; a<ob->totcol; a++) {
207 if(ob->mat[a]) ob->mat[a]->id.us--;
209 if(ob->mat) MEM_freeN(ob->mat);
211 if(ob->bb) MEM_freeN(ob->bb);
213 if(ob->path) free_path(ob->path);
215 if(ob->ipo) ob->ipo->id.us--;
216 if(ob->action) ob->action->id.us--;
217 if(ob->dup_group) ob->dup_group->id.us--;
218 if(ob->defbase.first)
219 BLI_freelistN(&ob->defbase);
221 free_pose_channels(ob->pose);
224 free_effects(&ob->effect);
225 free_properties(&ob->prop);
226 object_free_modifiers(ob);
228 free_sensors(&ob->sensors);
229 free_controllers(&ob->controllers);
230 free_actuators(&ob->actuators);
232 free_constraints(&ob->constraints);
233 free_constraint_channels(&ob->constraintChannels);
234 free_nlastrips(&ob->nlastrips);
236 BPY_free_scriptlink(&ob->scriptlink);
238 if(ob->pd) MEM_freeN(ob->pd);
239 if(ob->soft) sbFree(ob->soft);
240 if(ob->fluidsimSettings) fluidsimSettingsFree(ob->fluidsimSettings);
243 static void unlink_object__unlinkModifierLinks(void *userData, Object *ob, Object **obpoin)
245 Object *unlinkOb = userData;
247 if (*obpoin==unlinkOb) {
249 ob->recalc |= OB_RECALC;
252 void unlink_object(Object *ob)
268 unlink_controllers(&ob->controllers);
269 unlink_actuators(&ob->actuators);
271 /* check all objects: parents en bevels and fields, also from libraries */
272 obt= G.main->object.first;
276 if(obt->proxy_from==ob) {
277 obt->proxy_from= NULL;
278 obt->recalc |= OB_RECALC_OB;
280 if(obt->proxy_group==ob)
281 obt->proxy_group= NULL;
283 if(obt->parent==ob) {
285 obt->recalc |= OB_RECALC;
290 obt->recalc |= OB_RECALC_OB;
293 modifiers_foreachObjectLink(obt, unlink_object__unlinkModifierLinks, ob);
295 if ELEM(obt->type, OB_CURVE, OB_FONT) {
300 obt->recalc |= OB_RECALC;
302 if(cu->taperobj==ob) {
304 obt->recalc |= OB_RECALC;
306 if(cu->textoncurve==ob) {
307 cu->textoncurve= NULL;
308 obt->recalc |= OB_RECALC;
311 else if(obt->type==OB_ARMATURE && obt->pose) {
313 for(pchan= obt->pose->chanbase.first; pchan; pchan= pchan->next) {
314 for (con = pchan->constraints.first; con; con=con->next) {
315 bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
316 ListBase targets = {NULL, NULL};
317 bConstraintTarget *ct;
319 if (cti && cti->get_constraint_targets) {
320 cti->get_constraint_targets(con, &targets);
322 for (ct= targets.first; ct; ct= ct->next) {
325 strcpy(ct->subtarget, "");
326 obt->recalc |= OB_RECALC_DATA;
330 if (cti->flush_constraint_targets)
331 cti->flush_constraint_targets(con, &targets, 0);
334 if(pchan->custom==ob)
339 sca_remove_ob_poin(obt, ob);
341 for (con = obt->constraints.first; con; con=con->next) {
342 bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
343 ListBase targets = {NULL, NULL};
344 bConstraintTarget *ct;
346 if (cti && cti->get_constraint_targets) {
347 cti->get_constraint_targets(con, &targets);
349 for (ct= targets.first; ct; ct= ct->next) {
352 strcpy(ct->subtarget, "");
353 obt->recalc |= OB_RECALC_DATA;
357 if (cti->flush_constraint_targets)
358 cti->flush_constraint_targets(con, &targets, 0);
362 /* object is deflector or field */
364 if(give_parteff(obt))
365 obt->recalc |= OB_RECALC_DATA;
367 obt->recalc |= OB_RECALC_DATA;
371 for(strip= obt->nlastrips.first; strip; strip= strip->next) {
372 if(strip->object==ob)
375 if(strip->modifiers.first) {
376 bActionModifier *amod;
377 for(amod= strip->modifiers.first; amod; amod= amod->next)
387 mat= G.main->mat.first;
390 for(a=0; a<MAX_MTEX; a++) {
391 if(mat->mtex[a] && ob==mat->mtex[a]->object) {
392 /* actually, test for lib here... to do */
393 mat->mtex[a]->object= NULL;
401 tex= G.main->tex.first;
404 if(tex->env->object == ob) tex->env->object= NULL;
410 if(ob->type==OB_MBALL) {
411 obt= find_basis_mball(ob);
412 if(obt) freedisplist(&obt->disp);
416 wrld= G.main->world.first;
418 if(wrld->id.lib==NULL) {
419 for(a=0; a<MAX_MTEX; a++) {
420 if(wrld->mtex[a] && ob==wrld->mtex[a]->object)
421 wrld->mtex[a]->object= NULL;
429 sce= G.main->scene.first;
431 if(sce->id.lib==NULL) {
432 if(sce->camera==ob) sce->camera= NULL;
437 ipo= G.main->ipo.first;
439 if(ipo->id.lib==NULL) {
441 for(icu= ipo->curve.first; icu; icu= icu->next) {
442 if(icu->driver && icu->driver->ob==ob)
443 icu->driver->ob= NULL;
450 sc= G.main->screen.first;
452 ScrArea *sa= sc->areabase.first;
456 for (sl= sa->spacedata.first; sl; sl= sl->next) {
457 if(sl->spacetype==SPACE_VIEW3D) {
458 View3D *v3d= (View3D*) sl;
460 if(v3d->camera==ob) {
462 if(v3d->persp>1) v3d->persp= 1;
464 if(v3d->localvd && v3d->localvd->camera==ob ) {
465 v3d->localvd->camera= NULL;
466 if(v3d->localvd->persp>1) v3d->localvd->persp= 1;
469 else if(sl->spacetype==SPACE_IPO) {
470 SpaceIpo *sipo= (SpaceIpo *)sl;
471 if(sipo->from == (ID *)ob) sipo->from= NULL;
473 else if(sl->spacetype==SPACE_OOPS) {
474 SpaceOops *so= (SpaceOops *)sl;
477 oops= so->oops.first;
479 if(oops->id==(ID *)ob) oops->id= NULL;
483 TreeStoreElem *tselem= so->treestore->data;
485 for(a=0; a<so->treestore->usedelem; a++, tselem++) {
486 if(tselem->id==(ID *)ob) tselem->id= NULL;
499 group= G.main->group.first;
501 rem_from_group(group, ob);
502 group= group->id.next;
506 camera= G.main->camera.first;
508 if (camera->dof_ob==ob) {
509 camera->dof_ob = NULL;
511 camera= camera->id.next;
515 int exist_object(Object *obtest)
519 if(obtest==NULL) return 0;
521 ob= G.main->object.first;
523 if(ob==obtest) return 1;
529 void *add_camera(char *name)
533 cam= alloc_libblock(&G.main->camera, ID_CA, name);
538 cam->clipend= 100.0f;
540 cam->ortho_scale= 6.0;
541 cam->flag |= CAM_SHOWTITLESAFE;
542 cam->passepartalpha = 0.2f;
547 Camera *copy_camera(Camera *cam)
551 camn= copy_libblock(cam);
552 id_us_plus((ID *)camn->ipo);
554 BPY_copy_scriptlink(&camn->scriptlink);
561 void make_local_camera(Camera *cam)
567 /* - only lib users: do nothing
568 * - only local users: set flag
572 if(cam->id.lib==0) return;
575 cam->id.flag= LIB_LOCAL;
576 new_id(0, (ID *)cam, 0);
580 ob= G.main->object.first;
583 if(ob->id.lib) lib= 1;
589 if(local && lib==0) {
591 cam->id.flag= LIB_LOCAL;
592 new_id(0, (ID *)cam, 0);
594 else if(local && lib) {
595 camn= copy_camera(cam);
598 ob= G.main->object.first;
613 /* get the camera's dof value, takes the dof object into account */
614 float dof_camera(Object *ob)
616 Camera *cam = (Camera *)ob->data;
617 if (ob->type != OB_CAMERA)
620 /* too simple, better to return the distance on the view axis only
621 * return VecLenf(ob->obmat[3], cam->dof_ob->obmat[3]); */
624 Mat4Invert(ob->imat, ob->obmat);
625 Mat4MulMat4(mat, cam->dof_ob->obmat, ob->imat);
626 return fabs(mat[3][2]);
628 return cam->YF_dofdist;
631 void *add_lamp(char *name)
635 la= alloc_libblock(&G.main->lamp, ID_LA, name);
637 la->r= la->g= la->b= la->k= 1.0;
638 la->haint= la->energy= 1.0;
643 la->mode= LA_SHAD_BUF;
647 la->shadspotsize= 45.0;
651 la->ray_samp= la->ray_sampy= la->ray_sampz= 1;
652 la->area_size=la->area_sizey=la->area_sizez= 1.0;
654 la->buftype= LA_SHADBUF_HALFWAY;
655 la->ray_samp_method = LA_SAMP_HALTON;
656 la->adapt_thresh = 0.001;
658 la->falloff_type = LA_FALLOFF_INVLINEAR;
659 la->curfalloff = curvemapping_add(1, 0.0f, 1.0f, 1.0f, 0.0f);
660 curvemapping_initialize(la->curfalloff);
664 Lamp *copy_lamp(Lamp *la)
669 lan= copy_libblock(la);
671 for(a=0; a<MAX_MTEX; a++) {
673 lan->mtex[a]= MEM_mallocN(sizeof(MTex), "copylamptex");
674 memcpy(lan->mtex[a], la->mtex[a], sizeof(MTex));
675 id_us_plus((ID *)lan->mtex[a]->tex);
679 lan->curfalloff = curvemapping_copy(la->curfalloff);
681 id_us_plus((ID *)lan->ipo);
683 if (la->preview) lan->preview = BKE_previewimg_copy(la->preview);
685 BPY_copy_scriptlink(&la->scriptlink);
690 void make_local_lamp(Lamp *la)
696 /* - only lib users: do nothing
697 * - only local users: set flag
701 if(la->id.lib==0) return;
704 la->id.flag= LIB_LOCAL;
705 new_id(0, (ID *)la, 0);
709 ob= G.main->object.first;
712 if(ob->id.lib) lib= 1;
718 if(local && lib==0) {
720 la->id.flag= LIB_LOCAL;
721 new_id(0, (ID *)la, 0);
723 else if(local && lib) {
727 ob= G.main->object.first;
742 void free_camera(Camera *ca)
744 BPY_free_scriptlink(&ca->scriptlink);
747 void free_lamp(Lamp *la)
754 BPY_free_scriptlink(&la->scriptlink);
756 for(a=0; a<MAX_MTEX; a++) {
758 if(mtex && mtex->tex) mtex->tex->id.us--;
759 if(mtex) MEM_freeN(mtex);
763 curvemapping_free(la->curfalloff);
765 BKE_previewimg_free(&la->preview);
766 BKE_icon_delete(&la->id);
776 /* *************************************************** */
778 static void *add_obdata_from_type(int type)
781 case OB_MESH: G.totmesh++; return add_mesh("Mesh");
782 case OB_CURVE: G.totcurve++; return add_curve("Curve", OB_CURVE);
783 case OB_SURF: G.totcurve++; return add_curve("Surf", OB_SURF);
784 case OB_FONT: return add_curve("Text", OB_FONT);
785 case OB_MBALL: return add_mball("Meta");
786 case OB_CAMERA: return add_camera("Camera");
787 case OB_LAMP: G.totlamp++; return add_lamp("Lamp");
788 case OB_LATTICE: return add_lattice("Lattice");
789 case OB_WAVE: return add_wave();
790 case OB_ARMATURE: return add_armature("Armature");
791 case OB_EMPTY: return NULL;
793 printf("add_obdata_from_type: Internal error, bad type: %d\n", type);
798 static char *get_obdata_defname(int type)
801 case OB_MESH: return "Mesh";
802 case OB_CURVE: return "Curve";
803 case OB_SURF: return "Surf";
804 case OB_FONT: return "Font";
805 case OB_MBALL: return "Mball";
806 case OB_CAMERA: return "Camera";
807 case OB_LAMP: return "Lamp";
808 case OB_LATTICE: return "Lattice";
809 case OB_WAVE: return "Wave";
810 case OB_ARMATURE: return "Armature";
811 case OB_EMPTY: return "Empty";
813 printf("get_obdata_defname: Internal error, bad type: %d\n", type);
818 /* more general add: creates minimum required data, but without vertices etc. */
819 Object *add_only_object(int type, char *name)
823 ob= alloc_libblock(&G.main->object, ID_OB, name);
826 /* default object vars */
828 /* ob->transflag= OB_QUAT; */
833 ob->col[0]= ob->col[1]= ob->col[2]= 0.0;
836 ob->loc[0]= ob->loc[1]= ob->loc[2]= 0.0;
837 ob->rot[0]= ob->rot[1]= ob->rot[2]= 0.0;
838 ob->size[0]= ob->size[1]= ob->size[2]= 1.0;
840 Mat4One(ob->constinv);
841 Mat4One(ob->parentinv);
844 if(U.flag & USER_MAT_ON_OB) ob->colbits= -1;
845 ob->empty_drawtype= OB_ARROWS;
846 ob->empty_drawsize= 1.0;
848 if(type==OB_CAMERA || type==OB_LAMP) {
849 ob->trackflag= OB_NEGZ;
853 ob->trackflag= OB_POSY;
856 ob->ipoflag = OB_OFFS_OB+OB_OFFS_PARENT;
857 ob->ipowin= ID_OB; /* the ipowin shown */
858 ob->dupon= 1; ob->dupoff= 0;
859 ob->dupsta= 1; ob->dupend= 100;
861 /* Game engine defaults*/
862 ob->mass= ob->inertia= 1.0f;
863 ob->formfactor= 0.4f;
866 ob->anisotropicFriction[0] = 1.0f;
867 ob->anisotropicFriction[1] = 1.0f;
868 ob->anisotropicFriction[2] = 1.0f;
869 ob->gameflag= OB_PROP;
871 /* NT fluid sim defaults */
872 ob->fluidsimFlag = 0;
873 ob->fluidsimSettings = NULL;
878 /* general add: to G.scene, with layer from area and default name */
879 /* creates minimum required data, but without vertices etc. */
880 Object *add_object(int type)
886 strcpy(name, get_obdata_defname(type));
887 ob = add_only_object(type, name);
889 ob->data= add_obdata_from_type(type);
891 ob->lay= G.scene->lay;
893 base= scene_add_base(G.scene, ob);
894 scene_select_base(G.scene, base);
895 ob->recalc |= OB_RECALC;
900 void base_init_from_view3d(Base *base, View3D *v3d)
902 Object *ob= base->object;
905 /* no 3d view, this wont happen often */
907 VECCOPY(ob->loc, G.scene->cursor);
909 /* return now because v3d->viewquat isnt available */
911 } else if (v3d->localview) {
912 base->lay= ob->lay= v3d->layact + v3d->lay;
913 VECCOPY(ob->loc, v3d->cursor);
915 base->lay= ob->lay= v3d->layact;
916 VECCOPY(ob->loc, G.scene->cursor);
919 if (U.flag & USER_ADD_VIEWALIGNED) {
920 v3d->viewquat[0]= -v3d->viewquat[0];
921 if (ob->transflag & OB_QUAT) {
922 QUATCOPY(ob->quat, v3d->viewquat);
924 QuatToEul(v3d->viewquat, ob->rot);
926 v3d->viewquat[0]= -v3d->viewquat[0];
930 SoftBody *copy_softbody(SoftBody *sb)
934 if (sb==NULL) return(NULL);
936 sbn= MEM_dupallocN(sb);
937 sbn->totspring= sbn->totpoint= 0;
943 sbn->totkey= sbn->totpointkey= 0;
949 static void copy_object_pose(Object *obn, Object *ob)
953 copy_pose(&obn->pose, ob->pose, 1);
955 for (chan = obn->pose->chanbase.first; chan; chan=chan->next){
958 chan->flag &= ~(POSE_LOC|POSE_ROT|POSE_SIZE);
960 for (con= chan->constraints.first; con; con= con->next) {
961 bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
962 ListBase targets = {NULL, NULL};
963 bConstraintTarget *ct;
965 if (cti && cti->get_constraint_targets) {
966 cti->get_constraint_targets(con, &targets);
968 for (ct= targets.first; ct; ct= ct->next) {
973 if (cti->flush_constraint_targets)
974 cti->flush_constraint_targets(con, &targets, 0);
980 Object *copy_object(Object *ob)
986 obn= copy_libblock(ob);
989 obn->mat= MEM_dupallocN(ob->mat);
992 if(ob->bb) obn->bb= MEM_dupallocN(ob->bb);
994 obn->flag &= ~OB_FROMGROUP;
996 copy_effects(&obn->effect, &ob->effect);
997 obn->modifiers.first = obn->modifiers.last= NULL;
999 for (md=ob->modifiers.first; md; md=md->next) {
1000 ModifierData *nmd = modifier_new(md->type);
1001 modifier_copyData(md, nmd);
1002 BLI_addtail(&obn->modifiers, nmd);
1005 BPY_copy_scriptlink(&ob->scriptlink);
1007 copy_properties(&obn->prop, &ob->prop);
1008 copy_sensors(&obn->sensors, &ob->sensors);
1009 copy_controllers(&obn->controllers, &ob->controllers);
1010 copy_actuators(&obn->actuators, &ob->actuators);
1013 copy_object_pose(obn, ob);
1014 /* backwards compat... non-armatures can get poses in older files? */
1015 if(ob->type==OB_ARMATURE)
1016 armature_rebuild_pose(obn, obn->data);
1018 copy_defgroups(&obn->defbase, &ob->defbase);
1019 copy_nlastrips(&obn->nlastrips, &ob->nlastrips);
1020 copy_constraints (&obn->constraints, &ob->constraints);
1022 clone_constraint_channels (&obn->constraintChannels, &ob->constraintChannels);
1024 /* increase user numbers */
1025 id_us_plus((ID *)obn->data);
1026 id_us_plus((ID *)obn->ipo);
1027 id_us_plus((ID *)obn->action);
1028 id_us_plus((ID *)obn->dup_group);
1030 for(a=0; a<obn->totcol; a++) id_us_plus((ID *)obn->mat[a]);
1032 obn->disp.first= obn->disp.last= NULL;
1034 if(ob->pd) obn->pd= MEM_dupallocN(ob->pd);
1035 obn->soft= copy_softbody(ob->soft);
1037 /* NT copy fluid sim setting memory */
1038 if(obn->fluidsimSettings) {
1039 obn->fluidsimSettings = fluidsimSettingsCopy(ob->fluidsimSettings);
1040 /* copying might fail... */
1041 if(obn->fluidsimSettings) {
1042 obn->fluidsimSettings->orgMesh = (Mesh *)obn->data;
1046 obn->derivedDeform = NULL;
1047 obn->derivedFinal = NULL;
1057 void expand_local_object(Object *ob)
1059 bActionStrip *strip;
1062 id_lib_extern((ID *)ob->action);
1063 id_lib_extern((ID *)ob->ipo);
1064 id_lib_extern((ID *)ob->data);
1066 for(a=0; a<ob->totcol; a++) {
1067 id_lib_extern((ID *)ob->mat[a]);
1069 for (strip=ob->nlastrips.first; strip; strip=strip->next) {
1070 id_lib_extern((ID *)strip->act);
1075 void make_local_object(Object *ob)
1082 /* - only lib users: do nothing
1083 * - only local users: set flag
1084 * - mixed: make copy
1087 if(ob->id.lib==NULL) return;
1089 ob->proxy= ob->proxy_from= NULL;
1093 ob->id.flag= LIB_LOCAL;
1094 new_id(0, (ID *)ob, 0);
1098 sce= G.main->scene.first;
1100 base= sce->base.first;
1102 if(base->object==ob) {
1103 if(sce->id.lib) lib++;
1112 if(local && lib==0) {
1114 ob->id.flag= LIB_LOCAL;
1115 new_id(0, (ID *)ob, 0);
1117 else if(local && lib) {
1118 obn= copy_object(ob);
1121 sce= G.main->scene.first;
1123 if(sce->id.lib==0) {
1124 base= sce->base.first;
1126 if(base->object==ob) {
1139 expand_local_object(ob);
1142 /* *************** PROXY **************** */
1144 /* proxy rule: lib_object->proxy_from == the one we borrow from, set temporally while object_update */
1145 /* local_object->proxy == pointer to library object, saved in files and read */
1146 /* local_object->proxy_group == pointer to group dupli-object, saved in files and read */
1148 void object_make_proxy(Object *ob, Object *target, Object *gob)
1150 /* paranoia checks */
1151 if(ob->id.lib || target->id.lib==NULL) {
1152 printf("cannot make proxy\n");
1157 ob->proxy_group= gob;
1158 id_lib_extern(&target->id);
1160 ob->recalc= target->recalc= OB_RECALC;
1162 /* copy transform */
1164 VECCOPY(ob->loc, gob->loc);
1165 VECCOPY(ob->rot, gob->rot);
1166 VECCOPY(ob->size, gob->size);
1169 VECCOPY(ob->loc, target->loc);
1170 VECCOPY(ob->rot, target->rot);
1171 VECCOPY(ob->size, target->size);
1174 ob->parent= target->parent; /* libdata */
1175 Mat4CpyMat4(ob->parentinv, target->parentinv);
1176 ob->ipo= target->ipo; /* libdata */
1178 /* skip constraints, constraintchannels, nla? */
1180 ob->type= target->type;
1181 ob->data= target->data;
1182 id_us_plus((ID *)ob->data); /* ensures lib data becomes LIB_EXTERN */
1184 /* type conversions */
1185 if(target->type == OB_ARMATURE) {
1186 copy_object_pose(ob, target); /* data copy, object pointers in constraints */
1187 rest_pose(ob->pose); /* clear all transforms in channels */
1188 armature_rebuild_pose(ob, ob->data); /* set all internal links */
1193 /* *************** CALC ****************** */
1195 /* there is also a timing calculation in drawobject() */
1197 float bluroffs= 0.0f, fieldoffs= 0.0f;
1198 int no_speed_curve= 0;
1200 /* ugly calls from render */
1201 void set_mblur_offs(float blur)
1206 void set_field_offs(float field)
1211 void disable_speed_curve(int val)
1213 no_speed_curve= val;
1216 /* ob can be NULL */
1217 float bsystem_time(Object *ob, float cfra, float ofs)
1219 /* returns float ( see frame_to_float in ipo.c) */
1221 /* bluroffs and fieldoffs are ugly globals that are set by render */
1222 cfra+= bluroffs+fieldoffs;
1225 cfra*= G.scene->r.framelen;
1228 if (no_speed_curve==0 && ob->ipo)
1229 cfra= calc_ipo_time(ob->ipo, cfra);
1232 if ((ob->ipoflag & OB_OFFS_PARENT) && (ob->partype & PARSLOW)==0)
1241 void object_to_mat3(Object *ob, float mat[][3]) /* no parent */
1243 float smat[3][3], vec[3];
1249 vec[0]= ob->size[0]+ob->dsize[0];
1250 vec[1]= ob->size[1]+ob->dsize[1];
1251 vec[2]= ob->size[2]+ob->dsize[2];
1252 SizeToMat3(vec, smat);
1255 SizeToMat3(ob->size, smat);
1259 if(ob->transflag & OB_QUAT) {
1261 QuatMul(q1, ob->quat, ob->dquat);
1262 QuatToMat3(q1, rmat);
1265 QuatToMat3(ob->quat, rmat);
1270 vec[0]= ob->rot[0]+ob->drot[0];
1271 vec[1]= ob->rot[1]+ob->drot[1];
1272 vec[2]= ob->rot[2]+ob->drot[2];
1273 EulToMat3(vec, rmat);
1276 EulToMat3(ob->rot, rmat);
1279 Mat3MulMat3(mat, rmat, smat);
1282 void object_to_mat4(Object *ob, float mat[][4])
1286 object_to_mat3(ob, tmat);
1288 Mat4CpyMat3(mat, tmat);
1290 VECCOPY(mat[3], ob->loc);
1292 mat[3][0]+= ob->dloc[0];
1293 mat[3][1]+= ob->dloc[1];
1294 mat[3][2]+= ob->dloc[2];
1298 int enable_cu_speed= 1;
1300 static void ob_parcurve(Object *ob, Object *par, float mat[][4])
1303 float q[4], vec[4], dir[3], *quat, x1, ctime;
1304 float timeoffs= 0.0;
1309 if(cu->path==NULL || cu->path->data==NULL) /* only happens on reload file, but violates depsgraph still... fix! */
1310 makeDispListCurveTypes(par, 0);
1311 if(cu->path==NULL) return;
1313 /* exception, timeoffset is regarded as distance offset */
1314 if(cu->flag & CU_OFFS_PATHDIST) {
1315 SWAP(float, timeoffs, ob->sf);
1318 /* catch exceptions: feature for nla stride editing */
1319 if(ob->ipoflag & OB_DISABLE_PATH) {
1322 /* catch exceptions: curve paths used as a duplicator */
1323 else if(enable_cu_speed) {
1324 ctime= bsystem_time(ob, (float)G.scene->r.cfra, 0.0);
1326 if(calc_ipo_spec(cu->ipo, CU_SPEED, &ctime)==0) {
1327 ctime /= cu->pathlen;
1328 CLAMP(ctime, 0.0, 1.0);
1332 ctime= G.scene->r.cfra - ob->sf;
1333 ctime /= cu->pathlen;
1335 CLAMP(ctime, 0.0, 1.0);
1338 /* time calculus is correct, now apply distance offset */
1339 if(cu->flag & CU_OFFS_PATHDIST) {
1340 ctime += timeoffs/cu->path->totdist;
1343 SWAP(float, timeoffs, ob->sf);
1348 if( where_on_path(par, ctime, vec, dir) ) {
1350 if(cu->flag & CU_FOLLOW) {
1351 quat= vectoquat(dir, ob->trackflag, ob->upflag);
1355 q[0]= (float)cos(0.5*vec[3]);
1356 x1= (float)sin(0.5*vec[3]);
1360 QuatMul(quat, q, quat);
1362 QuatToMat4(quat, mat);
1365 VECCOPY(mat[3], vec);
1370 static void ob_parbone(Object *ob, Object *par, float mat[][4])
1372 bPoseChannel *pchan;
1376 arm=get_armature(par);
1382 /* Make sure the bone is still valid */
1383 pchan= get_pose_channel(par->pose, ob->parsubstr);
1385 printf ("Object %s with Bone parent: bone %s doesn't exist\n", ob->id.name+2, ob->parsubstr);
1390 /* get bone transform */
1391 Mat4CpyMat4(mat, pchan->pose_mat);
1393 /* but for backwards compatibility, the child has to move to the tail */
1394 VECCOPY(vec, mat[1]);
1395 VecMulf(vec, pchan->bone->length);
1396 VecAddf(mat[3], mat[3], vec);
1399 static void give_parvert(Object *par, int nr, float *vec)
1403 vec[0]=vec[1]=vec[2]= 0.0f;
1405 if(par->type==OB_MESH) {
1406 if(G.obedit && (par->data==G.obedit->data)) {
1407 EditMesh *em = G.editMesh;
1410 for(eve= em->verts.first; eve; eve= eve->next) {
1411 if(eve->keyindex==nr) {
1412 memcpy(vec, eve->co, 12);
1418 DerivedMesh *dm = par->derivedFinal;
1421 int i, count = 0, numVerts = dm->getNumVerts(dm);
1422 int *index = (int *)dm->getVertDataArray(dm, CD_ORIGINDEX);
1425 /* get the average of all verts with (original index == nr) */
1426 for(i = 0; i < numVerts; ++i, ++index) {
1428 dm->getVertCo(dm, i, co);
1429 VecAddf(vec, vec, co);
1435 VecMulf(vec, 1.0f / count);
1437 dm->getVertCo(dm, 0, vec);
1442 else if ELEM(par->type, OB_CURVE, OB_SURF) {
1450 if(par==G.obedit) nu= editNurb.first;
1454 if((nu->type & 7)==CU_BEZIER) {
1459 VECCOPY(vec, bezt->vec[1]);
1468 a= nu->pntsu*nu->pntsv;
1471 memcpy(vec, bp->vec, 12);
1482 else if(par->type==OB_LATTICE) {
1483 Lattice *latt= par->data;
1485 DispList *dl = find_displist(&par->disp, DL_VERTS);
1486 float *co = dl?dl->verts:NULL;
1488 if(par==G.obedit) latt= editLatt;
1490 a= latt->pntsu*latt->pntsv*latt->pntsw;
1496 memcpy(vec, co, 3*sizeof(float));
1498 memcpy(vec, bp->vec, 3*sizeof(float));
1508 static void ob_parvert3(Object *ob, Object *par, float mat[][4])
1510 float cmat[3][3], v1[3], v2[3], v3[3], q[4];
1512 /* in local ob space */
1515 if ELEM4(par->type, OB_MESH, OB_SURF, OB_CURVE, OB_LATTICE) {
1517 give_parvert(par, ob->par1, v1);
1518 give_parvert(par, ob->par2, v2);
1519 give_parvert(par, ob->par3, v3);
1521 triatoquat(v1, v2, v3, q);
1522 QuatToMat3(q, cmat);
1523 Mat4CpyMat3(mat, cmat);
1525 if(ob->type==OB_CURVE) {
1526 VECCOPY(mat[3], v1);
1529 VecAddf(mat[3], v1, v2);
1530 VecAddf(mat[3], mat[3], v3);
1531 VecMulf(mat[3], 0.3333333f);
1536 static int no_parent_ipo=0;
1537 void set_no_parent_ipo(int val)
1542 static int during_script_flag=0;
1543 void disable_where_script(short on)
1545 during_script_flag= on;
1548 int during_script(void) {
1549 return during_script_flag;
1552 static int during_scriptlink_flag=0;
1553 void disable_where_scriptlink(short on)
1555 during_scriptlink_flag= on;
1558 int during_scriptlink(void) {
1559 return during_scriptlink_flag;
1562 void where_is_object_time(Object *ob, float ctime)
1564 float *fp1, *fp2, slowmat[4][4] = MAT4_UNITY;
1565 float stime, fac1, fac2, vec[3];
1569 /* new version: correct parent+vertexparent and track+parent */
1570 /* this one only calculates direct attached parent and track */
1571 /* is faster, but should keep track of timeoffs */
1573 if(ob==NULL) return;
1575 /* this is needed to be able to grab objects with ipos, otherwise it always freezes them */
1576 stime= bsystem_time(ob, ctime, 0.0);
1577 if(stime != ob->ctime) {
1582 calc_ipo(ob->ipo, stime);
1583 execute_ipo((ID *)ob, ob->ipo);
1586 do_all_object_actions(ob);
1588 /* do constraint ipos ..., note it needs stime (0 = all ipos) */
1589 do_constraint_channels(&ob->constraints, &ob->constraintChannels, stime, 0);
1592 /* but, the drivers have to be done */
1593 if(ob->ipo) do_ob_ipodrivers(ob, ob->ipo, stime);
1594 /* do constraint ipos ..., note it needs stime (1 = only drivers ipos) */
1595 do_constraint_channels(&ob->constraints, &ob->constraintChannels, stime, 1);
1599 Object *par= ob->parent;
1601 if(ob->ipoflag & OB_OFFS_PARENT) ctime-= ob->sf;
1603 /* hurms, code below conflicts with depgraph... (ton) */
1604 /* and even worse, it gives bad effects for NLA stride too (try ctime != par->ctime, with MBlur) */
1606 if(no_parent_ipo==0 && stime != par->ctime) {
1608 // only for ipo systems?
1609 pushdata(par, sizeof(Object));
1612 if(par->proxy_from); // was a copied matrix, no where_is! bad...
1613 else where_is_object_time(par, ctime);
1616 solve_parenting(ob, par, ob->obmat, slowmat, 0);
1622 if(ob->partype & PARSLOW) {
1623 // include framerate
1625 fac1= (1.0f/(1.0f+ fabs(ob->sf)));
1626 if(fac1>=1.0) return;
1631 for(a=0; a<16; a++, fp1++, fp2++) {
1632 fp1[0]= fac1*fp1[0] + fac2*fp2[0];
1638 object_to_mat4(ob, ob->obmat);
1641 /* Handle tracking */
1643 if( ctime != ob->track->ctime) where_is_object_time(ob->track, ctime);
1644 solve_tracking (ob, ob->track->obmat);
1648 /* solve constraints */
1649 if (ob->constraints.first) {
1652 cob= constraints_make_evalob(ob, NULL, CONSTRAINT_OBTYPE_OBJECT);
1654 /* constraints need ctime, not stime. Some call where_is_object_time and bsystem_time */
1655 solve_constraints (&ob->constraints, cob, ctime);
1657 constraints_clear_evalob(cob);
1660 if(ob->scriptlink.totscript && !during_script()) {
1661 if (G.f & G_DOSCRIPTLINKS) BPY_do_pyscript((ID *)ob, SCRIPT_REDRAW);
1664 /* set negative scale flag in object */
1665 Crossf(vec, ob->obmat[0], ob->obmat[1]);
1666 if( Inpf(vec, ob->obmat[2]) < 0.0 ) ob->transflag |= OB_NEG_SCALE;
1667 else ob->transflag &= ~OB_NEG_SCALE;
1670 static void solve_parenting (Object *ob, Object *par, float obmat[][4], float slowmat[][4], int simul)
1678 object_to_mat4(ob, locmat);
1680 if(ob->partype & PARSLOW) Mat4CpyMat4(slowmat, obmat);
1683 switch(ob->partype & PARTYPE) {
1686 if(par->type==OB_CURVE) {
1687 if( ((Curve *)par->data)->flag & CU_PATH ) {
1688 ob_parcurve(ob, par, tmat);
1693 if(ok) Mat4MulSerie(totmat, par->obmat, tmat,
1694 NULL, NULL, NULL, NULL, NULL, NULL);
1695 else Mat4CpyMat4(totmat, par->obmat);
1699 ob_parbone(ob, par, tmat);
1700 Mat4MulSerie(totmat, par->obmat, tmat,
1701 NULL, NULL, NULL, NULL, NULL, NULL);
1707 VECCOPY(totmat[3], par->obmat[3]);
1710 give_parvert(par, ob->par1, vec);
1711 VecMat4MulVecfl(totmat[3], par->obmat, vec);
1715 ob_parvert3(ob, par, tmat);
1717 Mat4MulSerie(totmat, par->obmat, tmat,
1718 NULL, NULL, NULL, NULL, NULL, NULL);
1722 Mat4CpyMat4(totmat, par->obmat);
1727 Mat4MulSerie(tmat, totmat, ob->parentinv,
1728 NULL, NULL, NULL, NULL, NULL, NULL);
1729 Mat4MulSerie(obmat, tmat, locmat,
1730 NULL, NULL, NULL, NULL, NULL, NULL);
1736 // external usable originmat
1737 Mat3CpyMat4(originmat, tmat);
1739 // origin, voor help line
1740 if( (ob->partype & 15)==PARSKEL ) {
1741 VECCOPY(ob->orig, par->obmat[3]);
1744 VECCOPY(ob->orig, totmat[3]);
1749 void solve_tracking (Object *ob, float targetmat[][4])
1756 VecSubf(vec, ob->obmat[3], targetmat[3]);
1757 quat= vectoquat(vec, ob->trackflag, ob->upflag);
1758 QuatToMat3(quat, totmat);
1760 if(ob->parent && (ob->transflag & OB_POWERTRACK)) {
1761 /* 'temporal' : clear parent info */
1762 object_to_mat4(ob, tmat);
1763 tmat[0][3]= ob->obmat[0][3];
1764 tmat[1][3]= ob->obmat[1][3];
1765 tmat[2][3]= ob->obmat[2][3];
1766 tmat[3][0]= ob->obmat[3][0];
1767 tmat[3][1]= ob->obmat[3][1];
1768 tmat[3][2]= ob->obmat[3][2];
1769 tmat[3][3]= ob->obmat[3][3];
1771 else Mat4CpyMat4(tmat, ob->obmat);
1773 Mat4MulMat34(ob->obmat, totmat, tmat);
1777 void where_is_object(Object *ob)
1779 where_is_object_time(ob, (float)G.scene->r.cfra);
1783 void where_is_object_simul(Object *ob)
1784 /* was written for the old game engine (until 2.04) */
1785 /* It seems that this function is only called
1786 for a lamp that is the child of another object */
1791 float slowmat[4][4];
1797 /* no ipo! (because of dloc and realtime-ipos) */
1804 solve_parenting(ob, par, ob->obmat, slowmat, 1);
1806 if(ob->partype & PARSLOW) {
1808 fac1= (float)(1.0/(1.0+ fabs(ob->sf)));
1812 for(a=0; a<16; a++, fp1++, fp2++) {
1813 fp1[0]= fac1*fp1[0] + fac2*fp2[0];
1819 object_to_mat4(ob, ob->obmat);
1823 solve_tracking(ob, ob->track->obmat);
1825 /* solve constraints */
1826 if (ob->constraints.first) {
1829 cob= constraints_make_evalob(ob, NULL, CONSTRAINT_OBTYPE_OBJECT);
1830 solve_constraints (&ob->constraints, cob, G.scene->r.cfra);
1831 constraints_clear_evalob(cob);
1838 /* for calculation of the inverse parent transform, only used for editor */
1839 void what_does_parent(Object *ob)
1842 Mat4One(workob.obmat);
1843 Mat4One(workob.parentinv);
1844 Mat4One(workob.constinv);
1845 workob.parent= ob->parent;
1846 workob.track= ob->track;
1848 workob.trackflag= ob->trackflag;
1849 workob.upflag= ob->upflag;
1851 workob.partype= ob->partype;
1852 workob.par1= ob->par1;
1853 workob.par2= ob->par2;
1854 workob.par3= ob->par3;
1856 workob.constraints.first = ob->constraints.first;
1857 workob.constraints.last = ob->constraints.last;
1859 strcpy(workob.parsubstr, ob->parsubstr);
1861 where_is_object(&workob);
1864 BoundBox *unit_boundbox()
1867 float min[3] = {-1,-1,-1}, max[3] = {-1,-1,-1};
1869 bb= MEM_mallocN(sizeof(BoundBox), "bb");
1870 boundbox_set_from_min_max(bb, min, max);
1875 void boundbox_set_from_min_max(BoundBox *bb, float min[3], float max[3])
1877 bb->vec[0][0]=bb->vec[1][0]=bb->vec[2][0]=bb->vec[3][0]= min[0];
1878 bb->vec[4][0]=bb->vec[5][0]=bb->vec[6][0]=bb->vec[7][0]= max[0];
1880 bb->vec[0][1]=bb->vec[1][1]=bb->vec[4][1]=bb->vec[5][1]= min[1];
1881 bb->vec[2][1]=bb->vec[3][1]=bb->vec[6][1]=bb->vec[7][1]= max[1];
1883 bb->vec[0][2]=bb->vec[3][2]=bb->vec[4][2]=bb->vec[7][2]= min[2];
1884 bb->vec[1][2]=bb->vec[2][2]=bb->vec[5][2]=bb->vec[6][2]= max[2];
1887 BoundBox *object_get_boundbox(Object *ob)
1891 if(ob->type==OB_MESH) {
1892 bb = mesh_get_bb(ob->data);
1894 else if ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT) {
1895 bb= ( (Curve *)ob->data )->bb;
1897 else if(ob->type==OB_MBALL) {
1903 /* used to temporally disable/enable boundbox */
1904 void object_boundbox_flag(Object *ob, int flag, int set)
1906 BoundBox *bb= object_get_boundbox(ob);
1908 if(set) bb->flag |= flag;
1909 else bb->flag &= ~flag;
1913 void minmax_object(Object *ob, float *min, float *max)
1928 if(cu->bb==NULL) tex_space_curve(cu);
1931 for(a=0; a<8; a++) {
1932 Mat4MulVecfl(ob->obmat, bb.vec[a]);
1933 DO_MINMAX(bb.vec[a], min, max);
1938 bPoseChannel *pchan;
1939 for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
1940 VECCOPY(vec, pchan->pose_head);
1941 Mat4MulVecfl(ob->obmat, vec);
1942 DO_MINMAX(vec, min, max);
1943 VECCOPY(vec, pchan->pose_tail);
1944 Mat4MulVecfl(ob->obmat, vec);
1945 DO_MINMAX(vec, min, max);
1949 /* no break, get_mesh will give NULL and it passes on to default */
1954 bb = *mesh_get_bb(me);
1956 for(a=0; a<8; a++) {
1957 Mat4MulVecfl(ob->obmat, bb.vec[a]);
1958 DO_MINMAX(bb.vec[a], min, max);
1961 if(min[0] < max[0] ) break;
1963 /* else here no break!!!, mesh can be zero sized */
1966 DO_MINMAX(ob->obmat[3], min, max);
1968 VECCOPY(vec, ob->obmat[3]);
1969 VecAddf(vec, vec, ob->size);
1970 DO_MINMAX(vec, min, max);
1972 VECCOPY(vec, ob->obmat[3]);
1973 VecSubf(vec, vec, ob->size);
1974 DO_MINMAX(vec, min, max);
1979 /* TODO - use dupli objects bounding boxes */
1980 void minmax_object_duplis(Object *ob, float *min, float *max)
1982 if ((ob->transflag & OB_DUPLI)==0) {
1988 lb= object_duplilist(G.scene, ob);
1989 for(dob= lb->first; dob; dob= dob->next) {
1992 /* should really use bound box of dup object */
1993 DO_MINMAX(dob->mat[3], min, max);
1996 free_object_duplilist(lb); /* does restore */
2001 /* proxy rule: lib_object->proxy_from == the one we borrow from, only set temporal and cleared here */
2002 /* local_object->proxy == pointer to library object, saved in files and read */
2004 /* function below is polluted with proxy exceptions, cleanup will follow! */
2006 /* the main object update call, for object matrix, constraints, keys and displist (modifiers) */
2007 /* requires flags to be set! */
2008 void object_handle_update(Object *ob)
2010 if(ob->recalc & OB_RECALC) {
2012 if(ob->recalc & OB_RECALC_OB) {
2014 // printf("recalcob %s\n", ob->id.name+2);
2016 /* handle proxy copy for target */
2017 if(ob->id.lib && ob->proxy_from) {
2018 // printf("ob proxy copy, lib ob %s proxy %s\n", ob->id.name, ob->proxy_from->id.name);
2019 if(ob->proxy_from->proxy_group) {/* transform proxy into group space */
2020 Object *obg= ob->proxy_from->proxy_group;
2021 Mat4Invert(obg->imat, obg->obmat);
2022 Mat4MulMat4(ob->obmat, ob->proxy_from->obmat, obg->imat);
2025 Mat4CpyMat4(ob->obmat, ob->proxy_from->obmat);
2028 where_is_object(ob);
2031 if(ob->recalc & OB_RECALC_DATA) {
2033 // printf("recalcdata %s\n", ob->id.name+2);
2035 /* includes all keys and modifiers */
2036 if(ob->type==OB_MESH) {
2037 makeDerivedMesh(ob, get_viewedit_datamask());
2039 else if(ob->type==OB_MBALL) {
2040 makeDispListMBall(ob);
2042 else if(ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT)) {
2043 makeDispListCurveTypes(ob, 0);
2045 else if(ob->type==OB_LATTICE) {
2046 lattice_calc_modifiers(ob);
2048 else if(ob->type==OB_ARMATURE) {
2049 /* this happens for reading old files and to match library armatures with poses */
2050 if(ob->pose==NULL || (ob->pose->flag & POSE_RECALC))
2051 armature_rebuild_pose(ob, ob->data);
2053 if(ob->id.lib && ob->proxy_from) {
2054 copy_pose_result(ob->pose, ob->proxy_from->pose);
2055 // printf("pose proxy copy, lib ob %s proxy %s\n", ob->id.name, ob->proxy_from->id.name);
2058 do_all_pose_actions(ob);
2064 /* the no-group proxy case, we call update */
2065 if(ob->proxy && ob->proxy_group==NULL) {
2066 /* set pointer in library proxy target, for copying, but restore it */
2067 ob->proxy->proxy_from= ob;
2068 // printf("call update, lib ob %s proxy %s\n", ob->proxy->id.name, ob->id.name);
2069 object_handle_update(ob->proxy);
2072 ob->recalc &= ~OB_RECALC;
2075 /* the case when this is a group proxy, object_update is called in group.c */
2077 ob->proxy->proxy_from= ob;
2078 // printf("set proxy pointer for later group stuff %s\n", ob->id.name);