Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenloader/intern/readfile.c
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
| Show First 20 Lines • Show All 67 Lines • ▼ Show 20 Lines | |||||
| #include "DNA_constraint_types.h" | #include "DNA_constraint_types.h" | ||||
| #include "DNA_dynamicpaint_types.h" | #include "DNA_dynamicpaint_types.h" | ||||
| #include "DNA_effect_types.h" | #include "DNA_effect_types.h" | ||||
| #include "DNA_fileglobal_types.h" | #include "DNA_fileglobal_types.h" | ||||
| #include "DNA_genfile.h" | #include "DNA_genfile.h" | ||||
| #include "DNA_group_types.h" | #include "DNA_group_types.h" | ||||
| #include "DNA_gpencil_types.h" | #include "DNA_gpencil_types.h" | ||||
| #include "DNA_gpencil_modifier_types.h" | #include "DNA_gpencil_modifier_types.h" | ||||
| #include "DNA_shader_fx_types.h" | |||||
| #include "DNA_ipo_types.h" | #include "DNA_ipo_types.h" | ||||
| #include "DNA_key_types.h" | #include "DNA_key_types.h" | ||||
| #include "DNA_lattice_types.h" | #include "DNA_lattice_types.h" | ||||
| #include "DNA_layer_types.h" | #include "DNA_layer_types.h" | ||||
| #include "DNA_lamp_types.h" | #include "DNA_lamp_types.h" | ||||
| #include "DNA_linestyle_types.h" | #include "DNA_linestyle_types.h" | ||||
| #include "DNA_meta_types.h" | #include "DNA_meta_types.h" | ||||
| #include "DNA_material_types.h" | #include "DNA_material_types.h" | ||||
| ▲ Show 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | |||||
| #include "BKE_object.h" | #include "BKE_object.h" | ||||
| #include "BKE_paint.h" | #include "BKE_paint.h" | ||||
| #include "BKE_particle.h" | #include "BKE_particle.h" | ||||
| #include "BKE_pointcache.h" | #include "BKE_pointcache.h" | ||||
| #include "BKE_report.h" | #include "BKE_report.h" | ||||
| #include "BKE_scene.h" | #include "BKE_scene.h" | ||||
| #include "BKE_screen.h" | #include "BKE_screen.h" | ||||
| #include "BKE_sequencer.h" | #include "BKE_sequencer.h" | ||||
| #include "BKE_shader_fx.h" | |||||
| #include "BKE_outliner_treehash.h" | #include "BKE_outliner_treehash.h" | ||||
| #include "BKE_sound.h" | #include "BKE_sound.h" | ||||
| #include "BKE_colortools.h" | #include "BKE_colortools.h" | ||||
| #include "BKE_workspace.h" | #include "BKE_workspace.h" | ||||
| #include "DEG_depsgraph.h" | #include "DEG_depsgraph.h" | ||||
| #include "NOD_common.h" | #include "NOD_common.h" | ||||
| ▲ Show 20 Lines • Show All 4,707 Lines • ▼ Show 20 Lines | static void lib_link_gpencil_modifiers(FileData *fd, Object *ob) | ||||
| /* If linking from a library, clear 'local' static override flag. */ | /* If linking from a library, clear 'local' static override flag. */ | ||||
| if (ob->id.lib != NULL) { | if (ob->id.lib != NULL) { | ||||
| for (GpencilModifierData *mod = ob->greasepencil_modifiers.first; mod != NULL; mod = mod->next) { | for (GpencilModifierData *mod = ob->greasepencil_modifiers.first; mod != NULL; mod = mod->next) { | ||||
| mod->flag &= ~eGpencilModifierFlag_StaticOverride_Local; | mod->flag &= ~eGpencilModifierFlag_StaticOverride_Local; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| static void lib_link_shaderfxs(FileData *fd, Object *ob) | |||||
| { | |||||
| BKE_shaderfx_foreachIDLink(ob, lib_link_modifiers_common, fd); | |||||
| /* If linking from a library, clear 'local' static override flag. */ | |||||
| if (ob->id.lib != NULL) { | |||||
| for (ShaderFxData *fx = ob->shader_fx.first; fx != NULL; fx = fx->next) { | |||||
| fx->flag &= ~eShaderFxFlag_StaticOverride_Local; | |||||
| } | |||||
| } | |||||
| } | |||||
| static void lib_link_object(FileData *fd, Main *main) | static void lib_link_object(FileData *fd, Main *main) | ||||
| { | { | ||||
| bool warn = false; | bool warn = false; | ||||
| for (Object *ob = main->object.first; ob; ob = ob->id.next) { | for (Object *ob = main->object.first; ob; ob = ob->id.next) { | ||||
| if (ob->id.tag & LIB_TAG_NEED_LINK) { | if (ob->id.tag & LIB_TAG_NEED_LINK) { | ||||
| int a; | int a; | ||||
| ▲ Show 20 Lines • Show All 121 Lines • ▼ Show 20 Lines | // >>> XXX deprecated - old animation system | ||||
| ob->soft->collision_group = newlibadr(fd, ob->id.lib, ob->soft->collision_group); | ob->soft->collision_group = newlibadr(fd, ob->id.lib, ob->soft->collision_group); | ||||
| ob->soft->effector_weights->group = newlibadr(fd, ob->id.lib, ob->soft->effector_weights->group); | ob->soft->effector_weights->group = newlibadr(fd, ob->id.lib, ob->soft->effector_weights->group); | ||||
| } | } | ||||
| lib_link_particlesystems(fd, ob, &ob->id, &ob->particlesystem); | lib_link_particlesystems(fd, ob, &ob->id, &ob->particlesystem); | ||||
| lib_link_modifiers(fd, ob); | lib_link_modifiers(fd, ob); | ||||
| lib_link_gpencil_modifiers(fd, ob); | lib_link_gpencil_modifiers(fd, ob); | ||||
| lib_link_shaderfxs(fd, ob); | |||||
| if (ob->rigidbody_constraint) { | if (ob->rigidbody_constraint) { | ||||
| ob->rigidbody_constraint->ob1 = newlibadr(fd, ob->id.lib, ob->rigidbody_constraint->ob1); | ob->rigidbody_constraint->ob1 = newlibadr(fd, ob->id.lib, ob->rigidbody_constraint->ob1); | ||||
| ob->rigidbody_constraint->ob2 = newlibadr(fd, ob->id.lib, ob->rigidbody_constraint->ob2); | ob->rigidbody_constraint->ob2 = newlibadr(fd, ob->id.lib, ob->rigidbody_constraint->ob2); | ||||
| } | } | ||||
| { | { | ||||
| LodLevel *level; | LodLevel *level; | ||||
| ▲ Show 20 Lines • Show All 387 Lines • ▼ Show 20 Lines | static void direct_link_gpencil_modifiers(FileData *fd, ListBase *lb) | ||||
| GpencilModifierData *md; | GpencilModifierData *md; | ||||
| link_list(fd, lb); | link_list(fd, lb); | ||||
| for (md = lb->first; md; md = md->next) { | for (md = lb->first; md; md = md->next) { | ||||
| md->error = NULL; | md->error = NULL; | ||||
| /* if modifiers disappear, or for upward compatibility */ | /* if modifiers disappear, or for upward compatibility */ | ||||
| if (NULL == modifierType_getInfo(md->type)) | if (NULL == BKE_gpencil_modifierType_getInfo(md->type)) | ||||
| md->type = eModifierType_None; | md->type = eModifierType_None; | ||||
| if (md->type == eGpencilModifierType_Lattice) { | if (md->type == eGpencilModifierType_Lattice) { | ||||
| LatticeGpencilModifierData *gpmd = (LatticeGpencilModifierData*)md; | LatticeGpencilModifierData *gpmd = (LatticeGpencilModifierData*)md; | ||||
| gpmd->cache_data = NULL; | gpmd->cache_data = NULL; | ||||
| } | } | ||||
| else if (md->type == eGpencilModifierType_Hook) { | else if (md->type == eGpencilModifierType_Hook) { | ||||
| HookGpencilModifierData *hmd = (HookGpencilModifierData *)md; | HookGpencilModifierData *hmd = (HookGpencilModifierData *)md; | ||||
| Show All 12 Lines | else if (md->type == eGpencilModifierType_Thick) { | ||||
| /* initialize the curve. Maybe this could be moved to modififer logic */ | /* initialize the curve. Maybe this could be moved to modififer logic */ | ||||
| curvemapping_initialize(gpmd->curve_thickness); | curvemapping_initialize(gpmd->curve_thickness); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| static void direct_link_shaderfxs(FileData *fd, ListBase *lb) | |||||
| { | |||||
| ShaderFxData *fx; | |||||
| link_list(fd, lb); | |||||
| for (fx = lb->first; fx; fx = fx->next) { | |||||
| fx->error = NULL; | |||||
| /* if shader disappear, or for upward compatibility */ | |||||
| if (NULL == BKE_shaderfxType_getInfo(fx->type)) | |||||
| fx->type = eShaderFxType_None; | |||||
| } | |||||
| } | |||||
| static void direct_link_object(FileData *fd, Object *ob) | static void direct_link_object(FileData *fd, Object *ob) | ||||
| { | { | ||||
| PartEff *paf; | PartEff *paf; | ||||
| /* XXX This should not be needed - but seems like it can happen in some cases, so for now play safe... */ | /* XXX This should not be needed - but seems like it can happen in some cases, so for now play safe... */ | ||||
| ob->proxy_from = NULL; | ob->proxy_from = NULL; | ||||
| /* loading saved files with editmode enabled works, but for undo we like | /* loading saved files with editmode enabled works, but for undo we like | ||||
| Show All 28 Lines | // >>> XXX deprecated - old animation system | ||||
| ob->mat= newdataadr(fd, ob->mat); | ob->mat= newdataadr(fd, ob->mat); | ||||
| test_pointer_array(fd, (void **)&ob->mat); | test_pointer_array(fd, (void **)&ob->mat); | ||||
| ob->matbits= newdataadr(fd, ob->matbits); | ob->matbits= newdataadr(fd, ob->matbits); | ||||
| /* do it here, below old data gets converted */ | /* do it here, below old data gets converted */ | ||||
| direct_link_modifiers(fd, &ob->modifiers); | direct_link_modifiers(fd, &ob->modifiers); | ||||
| direct_link_gpencil_modifiers(fd, &ob->greasepencil_modifiers); | direct_link_gpencil_modifiers(fd, &ob->greasepencil_modifiers); | ||||
| direct_link_shaderfxs(fd, &ob->shader_fx); | |||||
| link_list(fd, &ob->effect); | link_list(fd, &ob->effect); | ||||
| paf= ob->effect.first; | paf= ob->effect.first; | ||||
| while (paf) { | while (paf) { | ||||
| if (paf->type == EFF_PARTICLE) { | if (paf->type == EFF_PARTICLE) { | ||||
| paf->keys = NULL; | paf->keys = NULL; | ||||
| } | } | ||||
| if (paf->type == EFF_WAVE) { | if (paf->type == EFF_WAVE) { | ||||
| ▲ Show 20 Lines • Show All 4,190 Lines • ▼ Show 20 Lines | static void expand_object(FileData *fd, Main *mainvar, Object *ob) | ||||
| if (ob->greasepencil_modifiers.first) { | if (ob->greasepencil_modifiers.first) { | ||||
| struct { FileData *fd; Main *mainvar; } data; | struct { FileData *fd; Main *mainvar; } data; | ||||
| data.fd = fd; | data.fd = fd; | ||||
| data.mainvar = mainvar; | data.mainvar = mainvar; | ||||
| BKE_gpencil_modifiers_foreachIDLink(ob, expand_object_expandModifiers, (void *)&data); | BKE_gpencil_modifiers_foreachIDLink(ob, expand_object_expandModifiers, (void *)&data); | ||||
| } | } | ||||
| /* expand_object_expandShaderFx() */ | |||||
| if (ob->shader_fx.first) { | |||||
| struct { FileData *fd; Main *mainvar; } data; | |||||
| data.fd = fd; | |||||
| data.mainvar = mainvar; | |||||
| BKE_shaderfx_foreachIDLink(ob, expand_object_expandModifiers, (void *)&data); | |||||
| } | |||||
| expand_pose(fd, mainvar, ob->pose); | expand_pose(fd, mainvar, ob->pose); | ||||
| expand_doit(fd, mainvar, ob->poselib); | expand_doit(fd, mainvar, ob->poselib); | ||||
| expand_constraints(fd, mainvar, &ob->constraints); | expand_constraints(fd, mainvar, &ob->constraints); | ||||
| expand_doit(fd, mainvar, ob->gpd); | expand_doit(fd, mainvar, ob->gpd); | ||||
| // XXX deprecated - old animation system (for version patching only) | // XXX deprecated - old animation system (for version patching only) | ||||
| expand_doit(fd, mainvar, ob->ipo); | expand_doit(fd, mainvar, ob->ipo); | ||||
| ▲ Show 20 Lines • Show All 1,195 Lines • Show Last 20 Lines | |||||