Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenloader/intern/readfile.c')
-rw-r--r--source/blender/blenloader/intern/readfile.c85
1 files changed, 85 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 4308fe0fee3..ac5673e1402 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -72,8 +72,10 @@
#include "DNA_effect_types.h"
#include "DNA_fileglobal_types.h"
#include "DNA_genfile.h"
+#include "DNA_groom_types.h"
#include "DNA_group_types.h"
#include "DNA_gpencil_types.h"
+#include "DNA_hair_types.h"
#include "DNA_ipo_types.h"
#include "DNA_key_types.h"
#include "DNA_lattice_types.h"
@@ -5214,6 +5216,25 @@ static void direct_link_pose(FileData *fd, bPose *pose)
}
}
+static void direct_link_hair(FileData *fd, HairSystem* hsys)
+{
+ if (!hsys) {
+ return;
+ }
+
+ hsys->pattern = newdataadr(fd, hsys->pattern);
+ if ( hsys->pattern )
+ {
+ hsys->pattern->follicles = newdataadr(fd, hsys->pattern->follicles);
+ }
+
+ hsys->curves = newdataadr(fd, hsys->curves);
+ hsys->verts = newdataadr(fd, hsys->verts);
+
+ hsys->draw_batch_cache = NULL;
+ hsys->draw_texture_cache = NULL;
+}
+
static void direct_link_modifiers(FileData *fd, ListBase *lb)
{
ModifierData *md;
@@ -5536,6 +5557,14 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
}
}
}
+ else if (md->type == eModifierType_Fur) {
+ FurModifierData *fmd = (FurModifierData *)md;
+
+ fmd->hair_system = newdataadr(fd, fmd->hair_system);
+ direct_link_hair(fd, fmd->hair_system);
+
+ fmd->draw_settings = newdataadr(fd, fmd->draw_settings);
+ }
}
}
@@ -8394,6 +8423,50 @@ static void direct_link_linestyle(FileData *fd, FreestyleLineStyle *linestyle)
}
}
+/* ************ READ GROOM *************** */
+
+static void lib_link_groom(FileData *fd, Main *bmain)
+{
+ for (Groom *groom = bmain->grooms.first; groom; groom = groom->id.next) {
+ ID *id = (ID *)groom;
+
+ if ((id->tag & LIB_TAG_NEED_LINK) == 0) {
+ continue;
+ }
+ IDP_LibLinkProperty(id->properties, fd);
+ id_us_ensure_real(id);
+
+ groom->scalp_object = newlibadr(fd, id->lib, groom->scalp_object);
+
+ id->tag &= ~LIB_TAG_NEED_LINK;
+ }
+}
+
+static void direct_link_groom(FileData *fd, Groom *groom)
+{
+ groom->adt= newdataadr(fd, groom->adt);
+ direct_link_animdata(fd, groom->adt);
+
+ link_list(fd, &groom->bundles);
+ for (GroomBundle *bundle = groom->bundles.first; bundle; bundle = bundle->next)
+ {
+ bundle->sections = newdataadr(fd, bundle->sections);
+ bundle->verts = newdataadr(fd, bundle->verts);
+ bundle->scalp_region = newdataadr(fd, bundle->scalp_region);
+ bundle->curvecache = NULL;
+ bundle->curvesize = 0;
+ bundle->totcurvecache = 0;
+ }
+
+ groom->hair_system = newdataadr(fd, groom->hair_system);
+ direct_link_hair(fd, groom->hair_system);
+ groom->hair_draw_settings = newdataadr(fd, groom->hair_draw_settings);
+
+ groom->bb = NULL;
+ groom->editgroom = NULL;
+ groom->batch_cache = NULL;
+}
+
/* ************** GENERAL & MAIN ******************** */
@@ -8691,6 +8764,9 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, const short
case ID_WS:
direct_link_workspace(fd, (WorkSpace *)id, main);
break;
+ case ID_GM:
+ direct_link_groom(fd, (Groom *)id);
+ break;
}
oldnewmap_free_unused(fd->datamap);
@@ -8873,6 +8949,7 @@ static void lib_link_all(FileData *fd, Main *main)
lib_link_gpencil(fd, main);
lib_link_cachefiles(fd, main);
lib_link_workspaces(fd, main);
+ lib_link_groom(fd, main);
lib_link_library(fd, main); /* only init users */
}
@@ -9502,6 +9579,11 @@ static void expand_particlesettings(FileData *fd, Main *mainvar, ParticleSetting
}
}
+static void expand_groom(FileData *fd, Main *mainvar, Groom *groom)
+{
+ expand_doit(fd, mainvar, groom->scalp_object);
+}
+
static void expand_group(FileData *fd, Main *mainvar, Group *group)
{
GroupObject *go;
@@ -10265,6 +10347,9 @@ void BLO_expand_main(void *fdhandle, Main *mainvar)
case ID_AC:
expand_action(fd, mainvar, (bAction *)id); // XXX deprecated - old animation system
break;
+ case ID_GM:
+ expand_groom(fd, mainvar, (Groom *)id);
+ break;
case ID_GR:
expand_group(fd, mainvar, (Group *)id);
break;