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:
authorLukas Tönne <lukas.toenne@gmail.com>2016-07-19 12:09:26 +0300
committerLukas Tönne <lukas.toenne@gmail.com>2016-07-19 12:09:26 +0300
commitecebe940e042ec03f432e413ea422bf79705f3c6 (patch)
tree18508e6ebaa34a6e40efe51ea11484dba8436fc6 /source/blender/blenloader
parent41cc366010e1d4b7b225e7c65df5a947bd5cbf70 (diff)
parente226318e039889e35d67090a1dd602c8b501099d (diff)
Merge branch 'strand_gpu' into strand_nodes
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r--source/blender/blenloader/intern/readfile.c44
-rw-r--r--source/blender/blenloader/intern/writefile.c27
2 files changed, 69 insertions, 2 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 35903961b72..9f5741b2c57 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -96,6 +96,7 @@
#include "DNA_speaker_types.h"
#include "DNA_sound_types.h"
#include "DNA_space_types.h"
+#include "DNA_strand_types.h"
#include "DNA_vfont_types.h"
#include "DNA_world_types.h"
#include "DNA_movieclip_types.h"
@@ -4245,6 +4246,7 @@ static void direct_link_particlesystems(FileData *fd, ListBase *particles)
psys->edit = NULL;
psys->free_edit = NULL;
+ psys->hairedit = NULL;
psys->pathcache = NULL;
psys->childcache = NULL;
BLI_listbase_clear(&psys->pathcachebufs);
@@ -4281,6 +4283,21 @@ static void direct_link_particlesystems(FileData *fd, ListBase *particles)
return;
}
+/* ************ READ STRANDS ***************** */
+
+static void direct_link_strands(FileData *fd, Strands *strands)
+{
+ if (strands == NULL)
+ return;
+
+ strands->curves = newdataadr(fd, strands->curves);
+ strands->verts = newdataadr(fd, strands->verts);
+ strands->fibers = newdataadr(fd, strands->fibers);
+
+ /* runtime */
+ strands->gpu_shader = NULL;
+}
+
/* ************ READ MESH ***************** */
static void lib_link_mtface(FileData *fd, Mesh *me, MTFace *mtface, int totface)
@@ -4539,6 +4556,7 @@ static void direct_link_mesh(FileData *fd, Mesh *mesh)
mesh->bb = NULL;
mesh->edit_btmesh = NULL;
+ mesh->edit_strands = NULL;
/* happens with old files */
if (mesh->mselect == NULL) {
@@ -5243,6 +5261,19 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
csmd->delta_cache = NULL;
csmd->delta_cache_num = 0;
}
+ else if (md->type == eModifierType_Strands) {
+ StrandsModifierData *smd = (StrandsModifierData*)md;
+
+ if (smd->strands) {
+ smd->strands = newdataadr(fd, smd->strands);
+ direct_link_strands(fd, smd->strands);
+ }
+
+ smd->edit = NULL;
+ smd->gpu_buffer = NULL;
+
+ smd->debug_value = 0; /* reset */
+ }
}
}
@@ -5269,7 +5300,7 @@ static void direct_link_object(FileData *fd, Object *ob)
* See [#34776, #42780] for more information.
*/
if (fd->memfile || (ob->id.tag & (LIB_TAG_EXTERN | LIB_TAG_INDIRECT))) {
- ob->mode &= ~(OB_MODE_EDIT | OB_MODE_PARTICLE_EDIT);
+ ob->mode &= ~(OB_MODE_EDIT | OB_MODE_PARTICLE_EDIT | OB_MODE_HAIR_EDIT);
if (!fd->memfile) {
ob->mode &= ~OB_MODE_POSE;
}
@@ -5607,6 +5638,14 @@ static void lib_link_scene(FileData *fd, Main *main)
sce->toolsettings->particle.shape_object = newlibadr(fd, sce->id.lib, sce->toolsettings->particle.shape_object);
+ {
+ HairEditSettings *hair_edit = &sce->toolsettings->hair_edit;
+ if (hair_edit->brush)
+ hair_edit->brush = newlibadr(fd, sce->id.lib, hair_edit->brush);
+ if (hair_edit->shape_object)
+ hair_edit->shape_object = newlibadr(fd, sce->id.lib, hair_edit->shape_object);
+ }
+
for (base = sce->base.first; base; base = next) {
next = base->next;
@@ -5855,7 +5894,8 @@ static void direct_link_scene(FileData *fd, Scene *sce)
sce->toolsettings->particle.scene = NULL;
sce->toolsettings->particle.object = NULL;
sce->toolsettings->gp_sculpt.paintcursor = NULL;
-
+ sce->toolsettings->hair_edit.paint_cursor = NULL;
+
/* in rare cases this is needed, see [#33806] */
if (sce->toolsettings->vpaint) {
sce->toolsettings->vpaint->vpaint_prev = NULL;
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 379e52c925b..9469f790fd0 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -140,6 +140,7 @@
#include "DNA_screen_types.h"
#include "DNA_speaker_types.h"
#include "DNA_sound_types.h"
+#include "DNA_strand_types.h"
#include "DNA_text_types.h"
#include "DNA_view3d_types.h"
#include "DNA_vfont_types.h"
@@ -1386,6 +1387,24 @@ static void write_particlesystems(WriteData *wd, ListBase *particles)
}
}
+static void write_strands(WriteData *wd, Strands *strands)
+{
+ if (strands == NULL)
+ return;
+
+ writestruct(wd, DATA, Strands, 1, strands);
+
+ if (strands->curves) {
+ writestruct(wd, DATA, StrandCurve, strands->totcurves, strands->curves);
+ }
+ if (strands->verts) {
+ writestruct(wd, DATA, StrandVertex, strands->totverts, strands->verts);
+ }
+ if (strands->fibers) {
+ writestruct(wd, DATA, StrandFiber, strands->totfibers, strands->fibers);
+ }
+}
+
static void write_properties(WriteData *wd, ListBase *lb)
{
bProperty *prop;
@@ -1820,6 +1839,13 @@ static void write_modifiers(WriteData *wd, ListBase *modbase)
writedata(wd, DATA, sizeof(float[3]) * csmd->bind_coords_num, csmd->bind_coords);
}
}
+ else if (md->type == eModifierType_Strands) {
+ StrandsModifierData *smd = (StrandsModifierData *)md;
+
+ if (smd->strands) {
+ write_strands(wd, smd->strands);
+ }
+ }
}
}
@@ -2261,6 +2287,7 @@ static void write_meshes(WriteData *wd, ListBase *idbase)
CustomData_reset(&mesh->pdata);
CustomData_reset(&mesh->ldata);
mesh->edit_btmesh = NULL;
+ mesh->edit_strands = NULL;
/* now fill in polys to mfaces */
/* XXX This breaks writing design, by using temp allocated memory, which will likely generate