[Bf-blender-cvs] [78d7dbbad97] xr-actions-D9124: Merge branch 'master' into xr-actions-D9124
Peter Kim
noreply at git.blender.org
Sun Nov 8 14:56:03 CET 2020
Commit: 78d7dbbad9758d21ece297aceda6562658b71869
Author: Peter Kim
Date: Sun Nov 8 22:55:44 2020 +0900
Branches: xr-actions-D9124
https://developer.blender.org/rB78d7dbbad9758d21ece297aceda6562658b71869
Merge branch 'master' into xr-actions-D9124
===================================================================
===================================================================
diff --cc source/blender/blenloader/intern/readfile.c
index a710693f0e2,2c10dd446f1..315b86ffeb6
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@@ -2719,1269 -2607,35 +2607,44 @@@ static int lib_link_main_data_restore_c
}
}
- if (rebuild) {
- DEG_id_tag_update_ex(
- reader->main, &ob->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_ANIMATION);
- BKE_pose_tag_recalc(reader->main, pose);
- }
- }
+ struct IDNameLib_Map *id_map = cb_data->user_data;
- /** \} */
+ /* Note: Handling of usercount here is really bad, defining its own system...
+ * Will have to be refactored at some point, but that is not top priority task for now.
+ * And all user-counts are properly recomputed at the end of the undo management code anyway. */
+ *id_pointer = restore_pointer_by_name(
+ id_map, *id_pointer, (cb_flag & IDWALK_CB_USER_ONE) ? USER_REAL : USER_IGNORE);
- /* -------------------------------------------------------------------- */
- /** \name Read ID: Shape Keys
- * \{ */
+ return IDWALK_RET_NOP;
+ }
- void blo_do_versions_key_uidgen(Key *key)
+ static void lib_link_main_data_restore(struct IDNameLib_Map *id_map, Main *newmain)
{
- key->uidgen = 1;
- LISTBASE_FOREACH (KeyBlock *, block, &key->block) {
- block->uid = key->uidgen++;
+ ID *id;
+ FOREACH_MAIN_ID_BEGIN (newmain, id) {
+ BKE_library_foreach_ID_link(newmain, id, lib_link_main_data_restore_cb, id_map, IDWALK_NOP);
}
+ FOREACH_MAIN_ID_END;
}
- /** \} */
-
- /* -------------------------------------------------------------------- */
- /** \name Read ID: Particle Settings
- * \{ */
-
- static void lib_link_particlesystems(BlendLibReader *reader,
- Object *ob,
- ID *id,
- ListBase *particles)
+ static void lib_link_wm_xr_data_restore(struct IDNameLib_Map *id_map, wmXrData *xr_data)
{
- LISTBASE_FOREACH_MUTABLE (ParticleSystem *, psys, particles) {
-
- BLO_read_id_address(reader, id->lib, &psys->part);
- if (psys->part) {
- LISTBASE_FOREACH (ParticleTarget *, pt, &psys->targets) {
- BLO_read_id_address(reader, id->lib, &pt->ob);
- }
+ xr_data->session_settings.base_pose_object = restore_pointer_by_name(
+ id_map, (ID *)xr_data->session_settings.base_pose_object, USER_REAL);
+
- BLO_read_id_address(reader, id->lib, &psys->parent);
- BLO_read_id_address(reader, id->lib, &psys->target_ob);
++ xr_data->session_settings.headset_object = restore_pointer_by_name(
++ id_map, (ID *)xr_data->session_settings.headset_object, USER_REAL);
+
- if (psys->clmd) {
- /* XXX - from reading existing code this seems correct but intended usage of
- * pointcache /w cloth should be added in 'ParticleSystem' - campbell */
- psys->clmd->point_cache = psys->pointcache;
- psys->clmd->ptcaches.first = psys->clmd->ptcaches.last = NULL;
- BLO_read_id_address(reader, id->lib, &psys->clmd->coll_parms->group);
- psys->clmd->modifier.error = NULL;
- }
- }
- else {
- /* particle modifier must be removed before particle system */
- ParticleSystemModifierData *psmd = psys_get_modifier(ob, psys);
- BLI_remlink(&ob->modifiers, psmd);
- BKE_modifier_free((ModifierData *)psmd);
++ xr_data->session_settings.controller0_object = restore_pointer_by_name(
++ id_map, (ID *)xr_data->session_settings.controller0_object, USER_REAL);
+
- BLI_remlink(particles, psys);
- MEM_freeN(psys);
- }
- }
++ xr_data->session_settings.controller1_object = restore_pointer_by_name(
++ id_map, (ID *)xr_data->session_settings.controller1_object, USER_REAL);
}
- static void direct_link_particlesystems(BlendDataReader *reader, ListBase *particles)
- {
- ParticleData *pa;
- int a;
- LISTBASE_FOREACH (ParticleSystem *, psys, particles) {
- BLO_read_data_address(reader, &psys->particles);
-
- if (psys->particles && psys->particles->hair) {
- for (a = 0, pa = psys->particles; a < psys->totpart; a++, pa++) {
- BLO_read_data_address(reader, &pa->hair);
- }
- }
-
- if (psys->particles && psys->particles->keys) {
- for (a = 0, pa = psys->particles; a < psys->totpart; a++, pa++) {
- pa->keys = NULL;
- pa->totkey = 0;
- }
-
- psys->flag &= ~PSYS_KEYED;
- }
-
- if (psys->particles && psys->particles->boid) {
- pa = psys->particles;
- BLO_read_data_address(reader, &pa->boid);
-
- /* This is purely runtime data, but still can be an issue if left dangling. */
- pa->boid->ground = NULL;
-
- for (a = 1, pa++; a < psys->totpart; a++, pa++) {
- pa->boid = (pa - 1)->boid + 1;
- pa->boid->ground = NULL;
- }
- }
- else if (psys->particles) {
- for (a = 0, pa = psys->particles; a < psys->totpart; a++, pa++) {
- pa->boid = NULL;
- }
- }
-
- BLO_read_data_address(reader, &psys->fluid_springs);
-
- BLO_read_data_address(reader, &psys->child);
- psys->effectors = NULL;
-
- BLO_read_list(reader, &psys->targets);
-
- psys->edit = NULL;
- psys->free_edit = NULL;
- psys->pathcache = NULL;
- psys->childcache = NULL;
- BLI_listbase_clear(&psys->pathcachebufs);
- BLI_listbase_clear(&psys->childcachebufs);
- psys->pdd = NULL;
-
- if (psys->clmd) {
- BLO_read_data_address(reader, &psys->clmd);
- psys->clmd->clothObject = NULL;
- psys->clmd->hairdata = NULL;
-
- BLO_read_data_address(reader, &psys->clmd->sim_parms);
- BLO_read_data_address(reader, &psys->clmd->coll_parms);
-
- if (psys->clmd->sim_parms) {
- psys->clmd->sim_parms->effector_weights = NULL;
- if (psys->clmd->sim_parms->presets > 10) {
- psys->clmd->sim_parms->presets = 0;
- }
- }
-
- psys->hair_in_mesh = psys->hair_out_mesh = NULL;
- psys->clmd->solver_result = NULL;
- }
-
- BKE_ptcache_blend_read_data(reader, &psys->ptcaches, &psys->pointcache, 0);
- if (psys->clmd) {
- psys->clmd->point_cache = psys->pointcache;
- }
-
- psys->tree = NULL;
- psys->bvhtree = NULL;
-
- psys->orig_psys = NULL;
- psys->batch_cache = NULL;
- }
- }
-
- /** \} */
-
- /* -------------------------------------------------------------------- */
- /** \name Read ID: Mesh
- * \{ */
-
- /** \} */
-
- /* -------------------------------------------------------------------- */
- /** \name Read ID: Object
- * \{ */
-
- static void lib_link_modifiers_common(void *userData, Object *ob, ID **idpoin, int cb_flag)
- {
- BlendLibReader *reader = userData;
-
- BLO_read_id_address(reader, ob->id.lib, idpoin);
- if (*idpoin != NULL && (cb_flag & IDWALK_CB_USER) != 0) {
- id_us_plus_no_lib(*idpoin);
- }
- }
-
- static void lib_link_modifiers(BlendLibReader *reader, Object *ob)
- {
- BKE_modifiers_foreach_ID_link(ob, lib_link_modifiers_common, reader);
-
- /* If linking from a library, clear 'local' library override flag. */
- if (ob->id.lib != NULL) {
- LISTBASE_FOREACH (ModifierData *, mod, &ob->modifiers) {
- mod->flag &= ~eModifierFlag_OverrideLibrary_Local;
- }
- }
- }
-
- static void lib_link_gpencil_modifiers(BlendLibReader *reader, Object *ob)
- {
- BKE_gpencil_modifiers_foreach_ID_link(ob, lib_link_modifiers_common, reader);
-
- /* If linking from a library, clear 'local' library override flag. */
- if (ob->id.lib != NULL) {
- LISTBASE_FOREACH (GpencilModifierData *, mod, &ob->greasepencil_modifiers) {
- mod->flag &= ~eGpencilModifierFlag_OverrideLibrary_Local;
- }
- }
- }
-
- static void lib_link_shaderfxs(BlendLibReader *reader, Object *ob)
- {
- BKE_shaderfx_foreach_ID_link(ob, lib_link_modifiers_common, reader);
-
- /* If linking from a library, clear 'local' library override flag. */
- if (ob->id.lib != NULL) {
- LISTBASE_FOREACH (ShaderFxData *, fx, &ob->shader_fx) {
- fx->flag &= ~eShaderFxFlag_OverrideLibrary_Local;
- }
- }
- }
-
- static void lib_link_object(BlendLibReader *reader, Object *ob)
- {
- bool warn = false;
-
- /* XXX deprecated - old animation system <<< */
- BLO_read_id_address(reader, ob->id.lib, &ob->ipo);
- BLO_read_id_address(reader, ob->id.lib, &ob->action);
- /* >>> XXX deprecated - old animation system */
-
- BLO_read_id_address(reader, ob->id.lib, &ob->parent);
- BLO_read_id_address(reader, ob->id.lib, &ob->track);
- BLO_read_id_address(reader, ob->id.lib, &ob->poselib);
-
- /* 2.8x drops support for non-empty dupli instances. */
- if (ob->type == OB_EMPTY) {
- BLO_read_id_address(reader, ob->id.lib, &ob->instance_collection);
- }
- else {
- if (ob->instance_collection != NULL) {
- ID *id = BLO_read_get_new_id_address(reader, ob->id.lib, &ob->instance_collection->id);
- BLO_reportf_wrap(BLO_read_lib_reports(reader),
- RPT_WARNING,
- TIP_("Non-Empty object '%s' cannot duplicate collection '%s' "
- "anymore in Blender 2.80, removed instancing"),
- ob->id.name + 2,
- id->name + 2);
- }
- ob->instance_collection = NULL;
- ob->transflag &= ~OB_DUPLICOLLECTION;
- }
-
- BLO_read_id_address(reader, ob->id.lib, &ob->proxy);
- if (ob->proxy) {
- /* paranoia check, actually a proxy_from pointer should never be written... */
- if (ob->proxy->id.lib == NULL) {
- ob->proxy->proxy_from = NULL;
- ob->proxy = NULL;
-
- if (ob->id.lib) {
- printf("Proxy lost from object %s lib %s\n", ob->id.name + 2, ob->id.lib->filepath);
- }
- else {
- printf("Proxy lost from object %s lib <NONE>\n", ob->id.name + 2);
- }
- }
- else {
- /* this triggers object_update to always use a copy */
- ob->proxy->proxy_from = ob;
- }
- }
- BLO_read_id_address(reader, ob->id.lib, &ob->proxy_group);
-
- void *poin = ob->data;
-
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list