[Bf-blender-cvs] [75aff0a] particles_refactor: Some renaming and DNA reorganization. Particle attributes now have a descriptor as well as state data.
Lukas Tönne
noreply at git.blender.org
Tue Apr 22 12:05:33 CEST 2014
Commit: 75aff0a75eab2685eb1a2cab6bf6c97da396b208
Author: Lukas Tönne
Date: Thu Dec 12 11:44:53 2013 +0100
https://developer.blender.org/rB75aff0a75eab2685eb1a2cab6bf6c97da396b208
Some renaming and DNA reorganization. Particle attributes now have a
descriptor as well as state data.
===================================================================
M source/blender/blenkernel/BKE_nparticle.h
M source/blender/blenkernel/intern/nparticle.c
M source/blender/blenloader/intern/readfile.c
M source/blender/blenloader/intern/writefile.c
M source/blender/makesdna/DNA_modifier_types.h
M source/blender/makesdna/DNA_nparticle_types.h
M source/blender/makesrna/intern/rna_modifier.c
M source/blender/makesrna/intern/rna_nparticle.c
M source/blender/modifiers/intern/MOD_nparticle.c
===================================================================
diff --git a/source/blender/blenkernel/BKE_nparticle.h b/source/blender/blenkernel/BKE_nparticle.h
index 2d04cbf..6d5669d 100644
--- a/source/blender/blenkernel/BKE_nparticle.h
+++ b/source/blender/blenkernel/BKE_nparticle.h
@@ -29,18 +29,18 @@
* \ingroup bke
*/
-struct NParticleBuffer;
-struct NParticleBufferAttribute;
-
-struct NParticleBuffer *BKE_nparticle_buffer_new(void);
-void BKE_nparticle_buffer_free(struct NParticleBuffer *buf);
-struct NParticleBuffer *BKE_nparticle_buffer_copy(struct NParticleBuffer *buf);
-
-struct NParticleBufferAttribute *BKE_nparticle_attribute_find(struct NParticleBuffer *buf, const char *name);
-struct NParticleBufferAttribute *BKE_nparticle_attribute_new(struct NParticleBuffer *buf, const char *name, int datatype);
-void BKE_nparticle_attribute_remove(struct NParticleBuffer *buf, struct NParticleBufferAttribute *attr);
-void BKE_nparticle_attribute_remove_all(struct NParticleBuffer *buf);
-void BKE_nparticle_attribute_move(struct NParticleBuffer *buf, int from_index, int to_index);
+struct NParticleSystem;
+struct NParticleAttribute;
+
+struct NParticleSystem *BKE_nparticle_system_new(void);
+void BKE_nparticle_system_free(struct NParticleSystem *psys);
+struct NParticleSystem *BKE_nparticle_system_copy(struct NParticleSystem *psys);
+
+struct NParticleAttribute *BKE_nparticle_attribute_find(struct NParticleSystem *psys, const char *name);
+struct NParticleAttribute *BKE_nparticle_attribute_new(struct NParticleSystem *psys, const char *name, int datatype);
+void BKE_nparticle_attribute_remove(struct NParticleSystem *psys, struct NParticleAttribute *attr);
+void BKE_nparticle_attribute_remove_all(struct NParticleSystem *psys);
+void BKE_nparticle_attribute_move(struct NParticleSystem *psys, int from_index, int to_index);
#if 0 /* old code */
#include "BLI_math.h"
diff --git a/source/blender/blenkernel/intern/nparticle.c b/source/blender/blenkernel/intern/nparticle.c
index 491103f..cb27482 100644
--- a/source/blender/blenkernel/intern/nparticle.c
+++ b/source/blender/blenkernel/intern/nparticle.c
@@ -60,76 +60,76 @@ static size_t nparticle_elem_bytes(int datatype)
}
}
-NParticleBuffer *BKE_nparticle_buffer_new(void)
+NParticleSystem *BKE_nparticle_system_new(void)
{
- NParticleBuffer *buf = MEM_callocN(sizeof(NParticleBuffer), "nparticle buffer");
- return buf;
+ NParticleSystem *psys = MEM_callocN(sizeof(NParticleSystem), "nparticle system");
+ return psys;
}
-void BKE_nparticle_buffer_free(NParticleBuffer *buf)
+void BKE_nparticle_system_free(NParticleSystem *psys)
{
- MEM_freeN(buf);
+ MEM_freeN(psys);
}
-NParticleBuffer *BKE_nparticle_buffer_copy(NParticleBuffer *buf)
+NParticleSystem *BKE_nparticle_system_copy(NParticleSystem *psys)
{
- NParticleBuffer *nbuf = MEM_dupallocN(buf);
- return nbuf;
+ NParticleSystem *npsys = MEM_dupallocN(psys);
+ return npsys;
}
-NParticleBufferAttribute *BKE_nparticle_attribute_find(NParticleBuffer *buf, const char *name)
+NParticleAttribute *BKE_nparticle_attribute_find(NParticleSystem *psys, const char *name)
{
- NParticleBufferAttribute *attr;
- for (attr = buf->attributes.first; attr; attr = attr->next)
+ NParticleAttribute *attr;
+ for (attr = psys->attributes.first; attr; attr = attr->next)
if (STREQ(attr->desc.name, name))
return attr;
return NULL;
}
-NParticleBufferAttribute *BKE_nparticle_attribute_new(NParticleBuffer *buf, const char *name, int datatype)
+NParticleAttribute *BKE_nparticle_attribute_new(NParticleSystem *psys, const char *name, int datatype)
{
- NParticleBufferAttribute *attr;
+ NParticleAttribute *attr;
- attr = BKE_nparticle_attribute_find(buf, name);
+ attr = BKE_nparticle_attribute_find(psys, name);
if (attr) {
/* if attribute with the same name exists, remove it first */
- BKE_nparticle_attribute_remove(buf, attr);
+ BKE_nparticle_attribute_remove(psys, attr);
}
if (!attr) {
- attr = MEM_callocN(sizeof(NParticleBufferAttribute), "particle buffer attribute");
+ attr = MEM_callocN(sizeof(NParticleAttribute), "particle system attribute");
BLI_strncpy(attr->desc.name, name, sizeof(attr->desc.name));
attr->desc.datatype = datatype;
- BLI_pbuf_init(&attr->data, PAGE_BYTES, nparticle_elem_bytes(datatype));
+ BLI_pbuf_init(&attr->state.data, PAGE_BYTES, nparticle_elem_bytes(datatype));
- BLI_addtail(&buf->attributes, attr);
+ BLI_addtail(&psys->attributes, attr);
}
return attr;
}
-void BKE_nparticle_attribute_remove(NParticleBuffer *buf, NParticleBufferAttribute *attr)
+void BKE_nparticle_attribute_remove(NParticleSystem *psys, NParticleAttribute *attr)
{
- BLI_remlink(&buf->attributes, attr);
+ BLI_remlink(&psys->attributes, attr);
- BLI_pbuf_free(&attr->data);
+ BLI_pbuf_free(&attr->state.data);
MEM_freeN(attr);
}
-void BKE_nparticle_attribute_remove_all(NParticleBuffer *buf)
+void BKE_nparticle_attribute_remove_all(NParticleSystem *psys)
{
- NParticleBufferAttribute *attr, *attr_next;
- for (attr = buf->attributes.first; attr; attr = attr_next) {
+ NParticleAttribute *attr, *attr_next;
+ for (attr = psys->attributes.first; attr; attr = attr_next) {
attr_next = attr->next;
- BLI_pbuf_free(&attr->data);
+ BLI_pbuf_free(&attr->state.data);
MEM_freeN(attr);
}
- buf->attributes.first = buf->attributes.last = NULL;
+ psys->attributes.first = psys->attributes.last = NULL;
}
-void BKE_nparticle_attribute_move(NParticleBuffer *buf, int from_index, int to_index)
+void BKE_nparticle_attribute_move(NParticleSystem *psys, int from_index, int to_index)
{
NParticleAttribute *attr;
@@ -138,19 +138,19 @@ void BKE_nparticle_attribute_move(NParticleBuffer *buf, int from_index, int to_i
if (from_index < 0 || to_index < 0)
return;
- attr = BLI_findlink(&buf->attributes, from_index);
+ attr = BLI_findlink(&psys->attributes, from_index);
if (to_index < from_index) {
- NParticleAttribute *nextattr = BLI_findlink(&buf->attributes, to_index);
+ NParticleAttribute *nextattr = BLI_findlink(&psys->attributes, to_index);
if (nextattr) {
- BLI_remlink(&buf->attributes, attr);
- BLI_insertlinkbefore(&buf->attributes, nextattr, attr);
+ BLI_remlink(&psys->attributes, attr);
+ BLI_insertlinkbefore(&psys->attributes, nextattr, attr);
}
}
else {
- NParticleAttribute *prevattr = BLI_findlink(&buf->attributes, to_index);
+ NParticleAttribute *prevattr = BLI_findlink(&psys->attributes, to_index);
if (prevattr) {
- BLI_remlink(&buf->attributes, attr);
- BLI_insertlinkafter(&buf->attributes, prevattr, attr);
+ BLI_remlink(&psys->attributes, attr);
+ BLI_insertlinkafter(&psys->attributes, prevattr, attr);
}
}
}
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index b0fddde..4b5630f 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -4257,13 +4257,13 @@ static void direct_link_pagedbuffer(FileData *fd, bPagedBuffer *pbuf)
/* ************ READ NPARTICLE BUFFER ***************** */
-static void direct_link_nparticle_buffer(FileData *fd, NParticleBuffer *buffer)
+static void direct_link_nparticle_system(FileData *fd, NParticleSystem *psys)
{
- NParticleBufferAttribute *attr;
+ NParticleAttribute *attr;
- link_list(fd, &buffer->attributes);
- for (attr = buffer->attributes.first; attr; attr = attr->next) {
- direct_link_pagedbuffer(fd, &attr->data);
+ link_list(fd, &psys->attributes);
+ for (attr = psys->attributes.first; attr; attr = attr->next) {
+ direct_link_pagedbuffer(fd, &attr->state.data);
}
}
@@ -4835,8 +4835,8 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
else if (md->type == eModifierType_NParticleSystem) {
NParticleSystemModifierData *pmd = (NParticleSystemModifierData *)md;
- pmd->buffer = newdataadr(fd, pmd->buffer);
- direct_link_nparticle_buffer(fd, pmd->buffer);
+ pmd->psys = newdataadr(fd, pmd->psys);
+ direct_link_nparticle_system(fd, pmd->psys);
}
else if (md->type == eModifierType_LaplacianDeform) {
LaplacianDeformModifierData *lmd = (LaplacianDeformModifierData *)md;
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 5c4eb69..d8a6790 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -1373,14 +1373,14 @@ static void write_pagedbuffer(WriteData *wd, bPagedBuffer *pbuf)
}
}
-static void write_nparticle_buffer(WriteData *wd, NParticleBuffer *buffer)
+static void write_nparticle_system(WriteData *wd, NParticleSystem *psys)
{
- NParticleBufferAttribute *attr;
+ NParticleAttribute *attr;
- writestruct(wd, DATA, "NParticleBuffer", 1, buffer);
- for (attr = buffer->attributes.first; attr; attr = attr->next) {
+ writestruct(wd, DATA, "NParticleSystem", 1, psys);
+ for (attr = psys->attributes.first; attr; attr = attr->next) {
writestruct(wd, DATA, "NParticleAttribute", 1, attr);
- write_pagedbuffer(wd, &attr->data);
+ write_pagedbuffer(wd, &attr->state.data);
}
}
@@ -1503,7 +1503,7 @@ static void write_modifiers(WriteData *wd, ListBase *modbase)
}
else if (md->type==eModifierType_NParticleSystem) {
NParticleSystemModifierData *pmd = (NParticleSystemModifierData *)md;
- write_nparticle_buffer(wd, pmd->buffer);
+ write_nparticle_system(wd, pmd->psys);
}
else if (md->type==eModifierType_LaplacianDeform) {
LaplacianDeformModifierData *lmd = (LaplacianDeformModifierData*) md;
diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h
index e3874fe..297fc8c 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -1367,7 +1367,7 @@ enum {
typedef struct NParticleSystemModifierData {
ModifierData modifier;
- struct NParticleBuffer *buffer;
+ struct NParticleSystem *psys;
} NParticleSystemModifierData;
diff --git a/source/blender/makesdna/DNA_nparticle_types.h b/source/blender/makesdna/DNA_nparticle_types.h
index a592f87..37926a4 100644
--- a/source/blender/makesdna/DNA_nparticle_types.h
+++ b/source/blender/makesdna/DNA_nparticle_types.h
@@ -32,11 +32,11 @@
#include "DNA_pagedbuf
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list