[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [33414] branches/particles-2010/source/ blender: Basic version of a mesh sampling and a mesh data interpolation node.

Lukas Toenne lukas.toenne at googlemail.com
Wed Dec 1 15:55:55 CET 2010


Revision: 33414
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=33414
Author:   lukastoenne
Date:     2010-12-01 15:55:55 +0100 (Wed, 01 Dec 2010)

Log Message:
-----------
Basic version of a mesh sampling and a mesh data interpolation node. These can be used to create points on a mesh, which are a new data type in the node tree.

Modified Paths:
--------------
    branches/particles-2010/source/blender/blenkernel/BKE_node.h
    branches/particles-2010/source/blender/blenkernel/BKE_particleset.h
    branches/particles-2010/source/blender/blenkernel/intern/node.c
    branches/particles-2010/source/blender/blenkernel/intern/particleset.c
    branches/particles-2010/source/blender/blenloader/intern/readfile.c
    branches/particles-2010/source/blender/blenloader/intern/writefile.c
    branches/particles-2010/source/blender/editors/space_node/drawnode.c
    branches/particles-2010/source/blender/editors/space_node/node_draw.c
    branches/particles-2010/source/blender/makesdna/DNA_node_types.h
    branches/particles-2010/source/blender/makesdna/DNA_particleset_types.h
    branches/particles-2010/source/blender/makesrna/intern/rna_nodetree.c
    branches/particles-2010/source/blender/makesrna/intern/rna_nodetree_types.h
    branches/particles-2010/source/blender/nodes/CMakeLists.txt
    branches/particles-2010/source/blender/nodes/SIM_node.h
    branches/particles-2010/source/blender/nodes/intern/SIM_intern.c
    branches/particles-2010/source/blender/nodes/intern/SIM_intern.h
    branches/particles-2010/source/blender/nodes/intern/SIM_nodetree.c
    branches/particles-2010/source/blender/nodes/intern/SIM_util.c
    branches/particles-2010/source/blender/nodes/intern/SIM_util.h

Added Paths:
-----------
    branches/particles-2010/source/blender/nodes/intern/SIM_nodes/SIM_create_mesh_point.c
    branches/particles-2010/source/blender/nodes/intern/SIM_nodes/SIM_get_mesh_data.c

Modified: branches/particles-2010/source/blender/blenkernel/BKE_node.h
===================================================================
--- branches/particles-2010/source/blender/blenkernel/BKE_node.h	2010-12-01 13:18:24 UTC (rev 33413)
+++ branches/particles-2010/source/blender/blenkernel/BKE_node.h	2010-12-01 14:55:55 UTC (rev 33414)
@@ -591,6 +591,8 @@
 #define SIM_NODE_TIMESTEP			753
 #define SIM_NODE_RANDOM				754
 #define SIM_NODE_CURVE				755
+#define SIM_NODE_GETMESHDATA		756
+#define SIM_NODE_CREATEMESHPOINT	757
 #define SIM_NODE_CONSTFLOAT			770
 #define SIM_NODE_CONSTINT			771
 #define SIM_NODE_CONSTBOOL			772
@@ -631,6 +633,9 @@
 void sim_setdata_foreach_type(struct bNodeTree *ntree, struct bNode *node, void *items, const char *str, SimSearchFunction cb);
 void sim_setdata_property_types(struct bNodeSocket *sock, int **types, int *num_types);
 
+void sim_getmeshdata_add_property_socket(struct bNode *node, const char *name);
+void sim_getmeshdata_foreach_property(struct bNodeTree *ntree, struct bNode *node, void *items, const char *str, SimSearchFunction cb);
+
 void sim_fromquaternion_update_rotation_mode(struct bNodeTree *ntree, struct bNode *node);
 void sim_toquaternion_update_rotation_mode(struct bNodeTree *ntree, struct bNode *node);
 

Modified: branches/particles-2010/source/blender/blenkernel/BKE_particleset.h
===================================================================
--- branches/particles-2010/source/blender/blenkernel/BKE_particleset.h	2010-12-01 13:18:24 UTC (rev 33413)
+++ branches/particles-2010/source/blender/blenkernel/BKE_particleset.h	2010-12-01 14:55:55 UTC (rev 33414)
@@ -81,7 +81,7 @@
 void pset_read_rgba(struct NParticle *pa, struct ParticlePropertyInfo *prop, float result[4]);
 void pset_read_quat(struct NParticle *pa, struct ParticlePropertyInfo *prop, float result[4]);
 void pset_read_matrix(struct NParticle *pa, struct ParticlePropertyInfo *prop, float result[4][4]);
-void pset_read_surfacepoint(struct NParticle *pa, struct ParticlePropertyInfo *prop, SurfacePoint *result);
+void pset_read_meshpoint(struct NParticle *pa, struct ParticlePropertyInfo *prop, MeshPoint *result);
 
 void pset_write_float(struct NParticle *pa, struct ParticlePropertyInfo *prop, float value);
 void pset_write_int(struct NParticle *pa, struct ParticlePropertyInfo *prop, int value);
@@ -90,7 +90,7 @@
 void pset_write_rgba(struct NParticle *pa, struct ParticlePropertyInfo *prop, float value[4]);
 void pset_write_quat(struct NParticle *pa, struct ParticlePropertyInfo *prop, float value[4]);
 void pset_write_matrix(struct NParticle *pa, struct ParticlePropertyInfo *prop, float value[4][4]);
-void pset_write_surfacepoint(struct NParticle *pa, struct ParticlePropertyInfo *prop, const SurfacePoint *value);
+void pset_write_meshpoint(struct NParticle *pa, struct ParticlePropertyInfo *prop, const MeshPoint *value);
 
 /* object functions */
 void make_local_particleset(struct ParticleSet *pset);

Modified: branches/particles-2010/source/blender/blenkernel/intern/node.c
===================================================================
--- branches/particles-2010/source/blender/blenkernel/intern/node.c	2010-12-01 13:18:24 UTC (rev 33413)
+++ branches/particles-2010/source/blender/blenkernel/intern/node.c	2010-12-01 14:55:55 UTC (rev 33414)
@@ -99,7 +99,7 @@
 	case SOCK_QUAT:		if (identifier) *identifier = "SOCK_QUAT";		if (icon) *icon = 0;	if (name) *name = "Quaternion";		break;
 	case SOCK_MATRIX:	if (identifier) *identifier = "SOCK_MATRIX";	if (icon) *icon = 0;	if (name) *name = "Matrix";			break;
 	case SOCK_STRING:	if (identifier) *identifier = "SOCK_STRING";	if (icon) *icon = 0;	if (name) *name = "String";			break;
-	case SOCK_SURFPT:	if (identifier) *identifier = "SOCK_SURFPT";	if (icon) *icon = 0;	if (name) *name = "SurfacePoint";	break;
+	case SOCK_MESHPT:	if (identifier) *identifier = "SOCK_MESHPT";	if (icon) *icon = 0;	if (name) *name = "MeshPoint";	break;
 	default:			if (identifier) *identifier = "";				if (icon) *icon = 0;	if (name) *name = "";
 	}
 }
@@ -2527,9 +2527,11 @@
 
 	nodeRegisterSimGetData(ntypelist);
 	nodeRegisterSimSetData(ntypelist);
+	nodeRegisterSimGetMeshData(ntypelist);
 	nodeRegisterSimIndex(ntypelist);
 	nodeRegisterSimTimeStep(ntypelist);
 	nodeRegisterSimRandom(ntypelist);
+	nodeRegisterSimCreateMeshPoint(ntypelist);
 	nodeRegisterSimConstants(ntypelist);
 	nodeRegisterSimDebugPrint(ntypelist);
 

Modified: branches/particles-2010/source/blender/blenkernel/intern/particleset.c
===================================================================
--- branches/particles-2010/source/blender/blenkernel/intern/particleset.c	2010-12-01 13:18:24 UTC (rev 33413)
+++ branches/particles-2010/source/blender/blenkernel/intern/particleset.c	2010-12-01 14:55:55 UTC (rev 33414)
@@ -706,15 +706,15 @@
 		unit_m4(result);
 }
 
-void pset_read_surfacepoint(struct NParticle *pa, struct ParticlePropertyInfo *prop, struct SurfacePoint *result)
+void pset_read_meshpoint(struct NParticle *pa, struct ParticlePropertyInfo *prop, struct MeshPoint *result)
 {
-	if (prop->type == PARPROP_SURFPT) {
-		SurfacePoint *pt= (SurfacePoint*)((char*)pa + prop->offset);
-		copy_v3_v3(result->co, pt->co);
+	if (prop->type == PARPROP_MESHPT) {
+		MeshPoint *pt= (MeshPoint*)((char*)pa + prop->offset);
+		copy_v3_v3(result->uvw, pt->uvw);
 		result->face = pt->face;
 	}
 	else {
-		zero_v3(result->co);
+		zero_v3(result->uvw);
 		result->face = 0;
 	}
 }
@@ -761,11 +761,11 @@
 		copy_m4_m4((float(*)[4])((char*)pa + prop->offset), (float(*)[4])value);
 }
 
-void pset_write_surfacepoint(struct NParticle *pa, struct ParticlePropertyInfo *prop, const struct SurfacePoint *value)
+void pset_write_meshpoint(struct NParticle *pa, struct ParticlePropertyInfo *prop, const struct MeshPoint *value)
 {
-	if (prop->type == PARPROP_SURFPT) {
-		SurfacePoint *pt= (SurfacePoint*)((char*)pa + prop->offset);
-		copy_v3_v3(pt->co, value->co);
+	if (prop->type == PARPROP_MESHPT) {
+		MeshPoint *pt= (MeshPoint*)((char*)pa + prop->offset);
+		copy_v3_v3(pt->uvw, value->uvw);
 		pt->face = value->face;
 	}
 }

Modified: branches/particles-2010/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/particles-2010/source/blender/blenloader/intern/readfile.c	2010-12-01 13:18:24 UTC (rev 33413)
+++ branches/particles-2010/source/blender/blenloader/intern/readfile.c	2010-12-01 14:55:55 UTC (rev 33414)
@@ -2119,7 +2119,7 @@
 				direct_link_curvemapping(fd, node->storage);
 			}
 			else if( ntree->type==NTREE_SIMULATION ) {
-				if( node->type==SIM_NODE_GETDATA || node->type==SIM_NODE_SETDATA )
+				if( ELEM3(node->type, SIM_NODE_GETDATA, SIM_NODE_SETDATA, SIM_NODE_GETMESHDATA) )
 					direct_link_sim_data_node(fd, ntree, node);
 			}
 		}

Modified: branches/particles-2010/source/blender/blenloader/intern/writefile.c
===================================================================
--- branches/particles-2010/source/blender/blenloader/intern/writefile.c	2010-12-01 13:18:24 UTC (rev 33413)
+++ branches/particles-2010/source/blender/blenloader/intern/writefile.c	2010-12-01 14:55:55 UTC (rev 33414)
@@ -497,7 +497,7 @@
 			else if(ntree->type==NTREE_TEXTURE && (node->type==TEX_NODE_CURVE_RGB || node->type==TEX_NODE_CURVE_TIME) )
 				write_curvemapping(wd, node->storage);
 			else if(ntree->type==NTREE_SIMULATION) {
-				if(node->type==SIM_NODE_GETDATA || node->type==SIM_NODE_SETDATA)
+				if(ELEM3(node->type, SIM_NODE_GETDATA, SIM_NODE_SETDATA, SIM_NODE_GETMESHDATA))
 					write_sim_data_node(wd, node->storage);
 				else
 					writestruct(wd, DATA, node->typeinfo->storagename, 1, node->storage);

Modified: branches/particles-2010/source/blender/editors/space_node/drawnode.c
===================================================================
--- branches/particles-2010/source/blender/editors/space_node/drawnode.c	2010-12-01 13:18:24 UTC (rev 33413)
+++ branches/particles-2010/source/blender/editors/space_node/drawnode.c	2010-12-01 14:55:55 UTC (rev 33414)
@@ -1405,8 +1405,9 @@
 	
 	if (prop) {
 		switch (node->type) {
-		case SIM_NODE_GETDATA:	sim_getdata_add_property_socket(node, prop);	break;
-		case SIM_NODE_SETDATA:	sim_setdata_add_property_socket(node, prop);	break;
+		case SIM_NODE_GETDATA:		sim_getdata_add_property_socket(node, prop);	break;
+		case SIM_NODE_SETDATA:		sim_setdata_add_property_socket(node, prop);	break;
+		case SIM_NODE_GETMESHDATA:	sim_getmeshdata_add_property_socket(node, prop);	break;
 		}
 	}
 	else {
@@ -1433,8 +1434,9 @@
 	bNodeTree *ntree= ((NodeDataArgs*)arg)->ntree;
 	bNode *node= ((NodeDataArgs*)arg)->node;
 	switch (node->type) {
-	case SIM_NODE_GETDATA:	sim_getdata_foreach_property(ntree, node, items, str, node_data_add_property_foreach_cb);	break;
-	case SIM_NODE_SETDATA:	sim_setdata_foreach_property(ntree, node, items, str, node_data_add_property_foreach_cb);	break;
+	case SIM_NODE_GETDATA:		sim_getdata_foreach_property(ntree, node, items, str, node_data_add_property_foreach_cb);	break;
+	case SIM_NODE_SETDATA:		sim_setdata_foreach_property(ntree, node, items, str, node_data_add_property_foreach_cb);	break;
+	case SIM_NODE_GETMESHDATA:	sim_getmeshdata_foreach_property(ntree, node, items, str, node_data_add_property_foreach_cb);	break;
 	}
 }
 static void node_data_add_property_search(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
@@ -1455,6 +1457,7 @@
 	but= uiDefSearchBut(block, data->propsearch, 0, ICON_VIEWZOOM, sizeof(data->propsearch), 0, 0, UI_UNIT_X*25, UI_UNIT_Y, 0, 0, "Add a new property socket");
 	uiButSetSearchFunc(but, node_data_add_property_search_cb, &args, node_data_add_property_exec_cb, NULL);
 }
+
 static void node_simulation_buts_getdata(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
 {
 	uiLayout *col;
@@ -1515,7 +1518,6 @@
 
 	uiItemR(col, ptr, "path", 0, NULL, 0);
 }
-
 static void node_simulation_detailbuts_setdata(uiLayout *layout, bContext *C, PointerRNA *ptr)
 {
 	static NodeDataArgs args;
@@ -1558,6 +1560,60 @@
 	}
 }
 
+static void node_simulation_buts_getmeshdata(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+{
+	uiLayout *col;
+	
+	col= uiLayoutColumn(layout, 0);
+	uiItemR(col, ptr, "space", 0, NULL, 0);
+	uiItemR(col, ptr, "path", 0, NULL, 0);
+}
+static void node_simulation_detailbuts_getmeshdata(uiLayout *layout, bContext *C, PointerRNA *ptr)
+{
+	static NodeDataArgs args;
+	bNode *node= ptr->data;

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list