LEFT | RIGHT |
1 /* | 1 /* |
2 * ***** BEGIN GPL LICENSE BLOCK ***** | 2 * ***** BEGIN GPL LICENSE BLOCK ***** |
3 * | 3 * |
4 * This program is free software; you can redistribute it and/or | 4 * This program is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU General Public License | 5 * modify it under the terms of the GNU General Public License |
6 * as published by the Free Software Foundation; either version 2 | 6 * as published by the Free Software Foundation; either version 2 |
7 * of the License, or (at your option) any later version. | 7 * of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 4451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4462 bActionActuator *aa = act->data; | 4462 bActionActuator *aa = act->data; |
4463 aa->act= newlibadr(fd, ob->id.lib, aa->a
ct); | 4463 aa->act= newlibadr(fd, ob->id.lib, aa->a
ct); |
4464 } | 4464 } |
4465 else if (act->type == ACT_PROPERTY) { | 4465 else if (act->type == ACT_PROPERTY) { |
4466 bPropertyActuator *pa = act->data; | 4466 bPropertyActuator *pa = act->data; |
4467 pa->ob= newlibadr(fd, ob->id.lib, pa->ob
); | 4467 pa->ob= newlibadr(fd, ob->id.lib, pa->ob
); |
4468 } | 4468 } |
4469 else if (act->type == ACT_MESSAGE) { | 4469 else if (act->type == ACT_MESSAGE) { |
4470 bMessageActuator *ma = act->data; | 4470 bMessageActuator *ma = act->data; |
4471 ma->toObject= newlibadr(fd, ob->id.lib,
ma->toObject); | 4471 ma->toObject= newlibadr(fd, ob->id.lib,
ma->toObject); |
| 4472 } |
| 4473 else if (act->type == ACT_2DFILTER) { |
| 4474 bTwoDFilterActuator *_2dfa = act->data;· |
| 4475 _2dfa->text= newlibadr(fd, ob->id.lib, _
2dfa->text); |
| 4476 } |
| 4477 else if (act->type == ACT_PARENT) { |
| 4478 bParentActuator *parenta = act->data;· |
| 4479 parenta->ob = newlibadr(fd, ob->id.lib,
parenta->ob); |
| 4480 } |
| 4481 else if (act->type == ACT_STATE) { |
| 4482 /* bStateActuator *statea = act->data; *
/ |
| 4483 } |
| 4484 else if (act->type == ACT_ARMATURE) { |
| 4485 bArmatureActuator *arma= act->data; |
| 4486 arma->target= newlibadr(fd, ob->id.lib,
arma->target); |
| 4487 arma->subtarget= newlibadr(fd, ob->id.li
b, arma->subtarget); |
| 4488 } |
| 4489 else if (act->type == ACT_STEERING) { |
| 4490 bSteeringActuator *steeringa = act->data
;· |
| 4491 steeringa->target = newlibadr(fd, ob->id
.lib, steeringa->target); |
| 4492 steeringa->navmesh = newlibadr(fd, ob->i
d.lib, steeringa->navmesh); |
| 4493 } |
| 4494 } |
| 4495 ························ |
| 4496 { |
| 4497 FluidsimModifierData *fluidmd = (FluidsimModifie
rData *)modifiers_findByType(ob, eModifierType_Fluidsim); |
| 4498 ································ |
| 4499 if (fluidmd && fluidmd->fss) |
| 4500 fluidmd->fss->ipo = newlibadr_us(fd, ob-
>id.lib, fluidmd->fss->ipo); |
| 4501 } |
| 4502 ························ |
| 4503 { |
| 4504 SmokeModifierData *smd = (SmokeModifierData *)mo
difiers_findByType(ob, eModifierType_Smoke); |
| 4505 ································ |
| 4506 if (smd && (smd->type == MOD_SMOKE_TYPE_DOMAIN)
&& smd->domain) { |
| 4507 smd->domain->flags |= MOD_SMOKE_FILE_LOA
D; /* flag for refreshing the simulation after loading */ |
| 4508 } |
| 4509 } |
| 4510 ························ |
| 4511 /* texture field */ |
| 4512 if (ob->pd) |
| 4513 lib_link_partdeflect(fd, &ob->id, ob->pd); |
| 4514 ························ |
| 4515 if (ob->soft) |
| 4516 ob->soft->effector_weights->group = newlibadr(fd
, ob->id.lib, ob->soft->effector_weights->group); |
| 4517 ························ |
| 4518 lib_link_particlesystems(fd, ob, &ob->id, &ob->particles
ystem); |
| 4519 lib_link_modifiers(fd, ob); |
| 4520 |
| 4521 if (ob->rigidbody_constraint) { |
| 4522 ob->rigidbody_constraint->ob1 = newlibadr(fd, ob
->id.lib, ob->rigidbody_constraint->ob1); |
| 4523 ob->rigidbody_constraint->ob2 = newlibadr(fd, ob
->id.lib, ob->rigidbody_constraint->ob2); |
| 4524 } |
| 4525 } |
| 4526 } |
| 4527 ········ |
| 4528 if (warn) { |
| 4529 BKE_report(fd->reports, RPT_WARNING, "Warning in console"); |
| 4530 } |
| 4531 } |
| 4532 |
| 4533 |
| 4534 static void direct_link_pose(FileData *fd, bPose *pose) |
| 4535 { |
| 4536 bPoseChannel *pchan; |
| 4537 |
| 4538 if (!pose) |
| 4539 return; |
| 4540 |
| 4541 link_list(fd, &pose->chanbase); |
| 4542 link_list(fd, &pose->agroups); |
| 4543 |
| 4544 pose->chanhash = NULL; |
| 4545 |
| 4546 for (pchan = pose->chanbase.first; pchan; pchan=pchan->next) { |
| 4547 pchan->bone = NULL; |
| 4548 pchan->parent = newdataadr(fd, pchan->parent); |
| 4549 pchan->child = newdataadr(fd, pchan->child); |
| 4550 pchan->custom_tx = newdataadr(fd, pchan->custom_tx); |
| 4551 ················ |
| 4552 direct_link_constraints(fd, &pchan->constraints); |
| 4553 ················ |
| 4554 pchan->prop = newdataadr(fd, pchan->prop); |
| 4555 IDP_DirectLinkGroup_OrFree(&pchan->prop, (fd->flags & FD_FLAGS_S
WITCH_ENDIAN), fd); |
| 4556 ················ |
| 4557 pchan->mpath = newdataadr(fd, pchan->mpath); |
| 4558 if (pchan->mpath) |
| 4559 direct_link_motionpath(fd, pchan->mpath); |
| 4560 ················ |
| 4561 pchan->iktree.first = pchan->iktree.last = NULL; |
| 4562 pchan->siktree.first = pchan->siktree.last = NULL; |
| 4563 ················ |
| 4564 /* in case this value changes in future, clamp else we get undef
ined behavior */ |
| 4565 CLAMP(pchan->rotmode, ROT_MODE_MIN, ROT_MODE_MAX); |
| 4566 } |
| 4567 pose->ikdata = NULL; |
| 4568 if (pose->ikparam != NULL) { |
| 4569 pose->ikparam = newdataadr(fd, pose->ikparam); |
| 4570 } |
| 4571 } |
| 4572 |
| 4573 static void direct_link_modifiers(FileData *fd, ListBase *lb) |
| 4574 { |
| 4575 ModifierData *md; |
| 4576 ········ |
| 4577 link_list(fd, lb); |
| 4578 ········ |
| 4579 for (md=lb->first; md; md=md->next) { |
| 4580 md->error = NULL; |
| 4581 md->scene = NULL; |
| 4582 ················ |
| 4583 /* if modifiers disappear, or for upward compatibility */ |
| 4584 if (NULL == modifierType_getInfo(md->type)) |
| 4585 md->type = eModifierType_None; |
| 4586 ························ |
| 4587 if (md->type == eModifierType_Subsurf) { |
| 4588 SubsurfModifierData *smd = (SubsurfModifierData *)md; |
| 4589 ························ |
| 4590 smd->emCache = smd->mCache = NULL; |
| 4591 } |
| 4592 else if (md->type == eModifierType_Armature) { |
| 4593 ArmatureModifierData *amd = (ArmatureModifierData *)md; |
| 4594 ························ |
| 4595 amd->prevCos = NULL; |
| 4596 } |
| 4597 else if (md->type == eModifierType_Cloth) { |
| 4598 ClothModifierData *clmd = (ClothModifierData *)md; |
| 4599 ························ |
| 4600 clmd->clothObject = NULL; |
| 4601 ························ |
| 4602 clmd->sim_parms= newdataadr(fd, clmd->sim_parms); |
| 4603 clmd->coll_parms= newdataadr(fd, clmd->coll_parms); |
| 4604 ························ |
| 4605 direct_link_pointcache_list(fd, &clmd->ptcaches, &clmd->
point_cache, 0); |
| 4606 ························ |
| 4607 if (clmd->sim_parms) { |
| 4608 if (clmd->sim_parms->presets > 10) |
| 4609 clmd->sim_parms->presets = 0; |
| 4610 ································ |
| 4611 clmd->sim_parms->reset = 0; |
| 4612 ································ |
| 4613 clmd->sim_parms->effector_weights = newdataadr(f
d, clmd->sim_parms->effector_weights); |
| 4614 ································ |
| 4615 if (!clmd->sim_parms->effector_weights) { |
| 4616 clmd->sim_parms->effector_weights = BKE_
add_effector_weights(NULL); |
| 4617 } |
| 4618 } |
| 4619 } |
| 4620 else if (md->type == eModifierType_Fluidsim) { |
| 4621 FluidsimModifierData *fluidmd = (FluidsimModifierData *)
md; |
| 4622 ························ |
| 4623 fluidmd->fss = newdataadr(fd, fluidmd->fss); |
| 4624 if (fluidmd->fss) { |
| 4625 fluidmd->fss->fmd = fluidmd; |
| 4626 fluidmd->fss->meshVelocities = NULL; |
| 4627 } |
| 4628 } |
| 4629 else if (md->type == eModifierType_Smoke) { |
| 4630 SmokeModifierData *smd = (SmokeModifierData *)md; |
| 4631 ························ |
| 4632 if (smd->type == MOD_SMOKE_TYPE_DOMAIN) { |
| 4633 smd->flow = NULL; |
| 4634 smd->coll = NULL; |
| 4635 smd->domain = newdataadr(fd, smd->domain); |
| 4636 smd->domain->smd = smd; |
| 4637 ································ |
| 4638 smd->domain->fluid = NULL; |
| 4639 smd->domain->fluid_mutex = BLI_rw_mutex_alloc(); |
| 4640 smd->domain->wt = NULL; |
| 4641 smd->domain->shadow = NULL; |
| 4642 smd->domain->tex = NULL; |
| 4643 smd->domain->tex_shadow = NULL; |
| 4644 smd->domain->tex_wt = NULL; |
| 4645 ································ |
| 4646 smd->domain->effector_weights = newdataadr(fd, s
md->domain->effector_weights); |
| 4647 if (!smd->domain->effector_weights) |
| 4648 smd->domain->effector_weights = BKE_add_
effector_weights(NULL); |
| 4649 ································ |
| 4650 direct_link_pointcache_list(fd, &(smd->domain->p
tcaches[0]), &(smd->domain->point_cache[0]), 1); |
| 4651 ································ |
| 4652 /* Smoke uses only one cache from now on, so sto
re pointer convert */ |
| 4653 if (smd->domain->ptcaches[1].first || smd->domai
n->point_cache[1]) { |
| 4654 if (smd->domain->point_cache[1]) { |
| 4655 PointCache *cache = newdataadr(f
d, smd->domain->point_cache[1]); |
| 4656 if (cache->flag & PTCACHE_FAKE_S
MOKE) { |
| 4657 /* Smoke was already sav
ed in "new format" and this cache is a fake one. */ |
| 4658 } |
| 4659 else { |
| 4660 printf("High resolution
smoke cache not available due to pointcache update. Please reset the simulation.
\n"); |
| 4661 } |
| 4662 BKE_ptcache_free(cache); |
| 4663 } |
| 4664 smd->domain->ptcaches[1].first = NULL; |
| 4665 smd->domain->ptcaches[1].last = NULL; |
| 4666 smd->domain->point_cache[1] = NULL; |
| 4667 } |
| 4668 } |
| 4669 else if (smd->type == MOD_SMOKE_TYPE_FLOW) { |
| 4670 smd->domain = NULL; |
| 4671 smd->coll = NULL; |
| 4672 smd->flow = newdataadr(fd, smd->flow); |
| 4673 smd->flow->smd = smd; |
| 4674 smd->flow->dm = NULL; |
| 4675 smd->flow->verts_old = NULL; |
| 4676 smd->flow->numverts = 0; |
| 4677 smd->flow->psys = newdataadr(fd, smd->flow->psys
); |
| 4678 } |
| 4679 else if (smd->type == MOD_SMOKE_TYPE_COLL) { |
| 4680 smd->flow = NULL; |
| 4681 smd->domain = NULL; |
| 4682 smd->coll = newdataadr(fd, smd->coll); |
| 4683 if (smd->coll) { |
| 4684 smd->coll->smd = smd; |
| 4685 smd->coll->verts_old = NULL; |
| 4686 smd->coll->numverts = 0; |
| 4687 smd->coll->dm = NULL; |
| 4688 } |
| 4689 else { |
| 4690 smd->type = 0; |
| 4691 smd->flow = NULL; |
| 4692 smd->domain = NULL; |
| 4693 smd->coll = NULL; |
| 4694 } |
| 4695 } |
| 4696 } |
| 4697 else if (md->type == eModifierType_DynamicPaint) { |
| 4698 DynamicPaintModifierData *pmd = (DynamicPaintModifierDat
a *)md; |
| 4699 ························ |
| 4700 if (pmd->canvas) { |
| 4701 pmd->canvas = newdataadr(fd, pmd->canvas); |
| 4702 pmd->canvas->pmd = pmd; |
| 4703 pmd->canvas->dm = NULL; |
| 4704 pmd->canvas->flags &= ~MOD_DPAINT_BAKING; /* jus
t in case */ |
| 4705 ································ |
| 4706 if (pmd->canvas->surfaces.first) { |
| 4707 DynamicPaintSurface *surface; |
| 4708 link_list(fd, &pmd->canvas->surfaces); |
| 4709 ········································ |
| 4710 for (surface=pmd->canvas->surfaces.first
; surface; surface=surface->next) { |
| 4711 surface->canvas = pmd->canvas; |
| 4712 surface->data = NULL; |
| 4713 direct_link_pointcache_list(fd,
&(surface->ptcaches), &(surface->pointcache), 1); |
4472 link_paint(fd, sce, &sce->toolsettings->vpaint->paint); | 4714 link_paint(fd, sce, &sce->toolsettings->vpaint->paint); |
4473 link_paint(fd, sce, &sce->toolsettings->wpaint->paint); | 4715 link_paint(fd, sce, &sce->toolsettings->wpaint->paint); |
4474 link_paint(fd, sce, &sce->toolsettings->imapaint.paint); | 4716 link_paint(fd, sce, &sce->toolsettings->imapaint.paint); |
4475 | 4717 |
4476 sce->toolsettings->skgen_template = newlibadr(fd, sce->i
d.lib, sce->toolsettings->skgen_template); | 4718 sce->toolsettings->skgen_template = newlibadr(fd, sce->i
d.lib, sce->toolsettings->skgen_template); |
4477 | 4719 |
4478 for(base= sce->base.first; base; base= next) { | 4720 for(base= sce->base.first; base; base= next) { |
LEFT | RIGHT |