diff options
Diffstat (limited to 'source/blender/blenloader/intern')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 33 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_defaults.c | 3 | ||||
-rw-r--r-- | source/blender/blenloader/intern/writefile.c | 8 |
3 files changed, 43 insertions, 1 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 7dfe476ce0a..a4f26017636 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -2380,6 +2380,7 @@ static bNodeTree *nodetree_from_id(ID *id) case ID_WO: return ((World *)id)->nodetree; case ID_LA: return ((Lamp *)id)->nodetree; case ID_TE: return ((Tex *)id)->nodetree; + case ID_LS: return ((FreestyleLineStyle *)id)->nodetree; } return NULL; } @@ -6910,6 +6911,8 @@ static void lib_link_linestyle(FileData *fd, Main *main) { FreestyleLineStyle *linestyle; LineStyleModifier *m; + MTex *mtex; + int a; linestyle = main->linestyle.first; while (linestyle) { @@ -6950,6 +6953,17 @@ static void lib_link_linestyle(FileData *fd, Main *main) break; } } + for (a=0; a < MAX_MTEX; a++) { + mtex = linestyle->mtex[a]; + if (mtex) { + mtex->tex = newlibadr_us(fd, linestyle->id.lib, mtex->tex); + mtex->object = newlibadr(fd, linestyle->id.lib, mtex->object); + } + } + if (linestyle->nodetree) { + lib_link_ntree(fd, &linestyle->id, linestyle->nodetree); + linestyle->nodetree->id.lib = linestyle->id.lib; + } } linestyle = linestyle->id.next; } @@ -7059,6 +7073,7 @@ static void direct_link_linestyle_geometry_modifier(FileData *UNUSED(fd), LineSt static void direct_link_linestyle(FileData *fd, FreestyleLineStyle *linestyle) { + int a; LineStyleModifier *modifier; linestyle->adt= newdataadr(fd, linestyle->adt); @@ -7075,6 +7090,14 @@ static void direct_link_linestyle(FileData *fd, FreestyleLineStyle *linestyle) link_list(fd, &linestyle->geometry_modifiers); for (modifier = linestyle->geometry_modifiers.first; modifier; modifier = modifier->next) direct_link_linestyle_geometry_modifier(fd, modifier); + for (a = 0; a < MAX_MTEX; a++) { + linestyle->mtex[a] = newdataadr(fd, linestyle->mtex[a]); + } + linestyle->nodetree = newdataadr(fd, linestyle->nodetree); + if (linestyle->nodetree) { + direct_link_id(fd, &linestyle->nodetree->id); + direct_link_nodetree(fd, linestyle->nodetree); + } } /* ************** GENERAL & MAIN ******************** */ @@ -8562,8 +8585,18 @@ static void expand_mask(FileData *fd, Main *mainvar, Mask *mask) static void expand_linestyle(FileData *fd, Main *mainvar, FreestyleLineStyle *linestyle) { + int a; LineStyleModifier *m; + for (a = 0; a < MAX_MTEX; a++) { + if (linestyle->mtex[a]) { + expand_doit(fd, mainvar, linestyle->mtex[a]->tex); + expand_doit(fd, mainvar, linestyle->mtex[a]->object); + } + } + if (linestyle->nodetree) + expand_nodetree(fd, mainvar, linestyle->nodetree); + if (linestyle->adt) expand_animdata(fd, mainvar, linestyle->adt); for (m = linestyle->color_modifiers.first; m; m = m->next) { diff --git a/source/blender/blenloader/intern/versioning_defaults.c b/source/blender/blenloader/intern/versioning_defaults.c index b455ef016b2..1e881eb11f9 100644 --- a/source/blender/blenloader/intern/versioning_defaults.c +++ b/source/blender/blenloader/intern/versioning_defaults.c @@ -60,9 +60,10 @@ void BLO_update_defaults_startup_blend(Main *main) } for (linestyle = main->linestyle.first; linestyle; linestyle = linestyle->id.next) { - linestyle->flag = LS_SAME_OBJECT | LS_NO_SORTING; + linestyle->flag = LS_SAME_OBJECT | LS_NO_SORTING | LS_TEXTURE; linestyle->sort_key = LS_SORT_KEY_DISTANCE_FROM_CAMERA; linestyle->integration_type = LS_INTEGRATION_MEAN; + linestyle->texstep = 1.0; } { diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 3fd6ff7673c..45139789f1e 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -3248,6 +3248,7 @@ static void write_linestyle_geometry_modifiers(WriteData *wd, ListBase *modifier static void write_linestyles(WriteData *wd, ListBase *idbase) { FreestyleLineStyle *linestyle; + int a; for (linestyle = idbase->first; linestyle; linestyle = linestyle->id.next) { if (linestyle->id.us>0 || wd->current) { @@ -3260,6 +3261,13 @@ static void write_linestyles(WriteData *wd, ListBase *idbase) write_linestyle_alpha_modifiers(wd, &linestyle->alpha_modifiers); write_linestyle_thickness_modifiers(wd, &linestyle->thickness_modifiers); write_linestyle_geometry_modifiers(wd, &linestyle->geometry_modifiers); + for (a=0; a<MAX_MTEX; a++) { + if (linestyle->mtex[a]) writestruct(wd, DATA, "MTex", 1, linestyle->mtex[a]); + } + if (linestyle->nodetree) { + writestruct(wd, DATA, "bNodeTree", 1, linestyle->nodetree); + write_nodetree(wd, linestyle->nodetree); + } } } } |