Revision: 36334
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=36334
Author:   lukastoenne
Date:     2011-04-26 10:00:11 +0000 (Tue, 26 Apr 2011)
Log Message:
-----------
Added back the MOD_nodes directory, this was messed up by git+svn conflicts.

Modified Paths:
--------------
    branches/particles-2010/source/blender/nodes/intern/MOD_nodes/MOD_common.c
    branches/particles-2010/source/blender/nodes/intern/MOD_nodes/MOD_join.c
    branches/particles-2010/source/blender/nodes/intern/MOD_nodes/MOD_mesh.c
    
branches/particles-2010/source/blender/nodes/intern/MOD_nodes/MOD_transform.c

Added Paths:
-----------
    branches/particles-2010/source/blender/nodes/intern/MOD_nodes/MOD_morph.c
    
branches/particles-2010/source/blender/nodes/intern/MOD_nodes/MOD_vertexgroup.c

Modified: 
branches/particles-2010/source/blender/nodes/intern/MOD_nodes/MOD_common.c
===================================================================
--- branches/particles-2010/source/blender/nodes/intern/MOD_nodes/MOD_common.c  
2011-04-26 09:27:43 UTC (rev 36333)
+++ branches/particles-2010/source/blender/nodes/intern/MOD_nodes/MOD_common.c  
2011-04-26 10:00:11 UTC (rev 36334)
@@ -105,7 +105,7 @@
        
        node->id = (ID*)ntemp->ngroup;
        
-       sock = nodeAddSocket(ntree, node, SOCK_IN, "Iterations", SOCK_INT, 
PROP_UNSIGNED);
+       sock = nodeAddInputInt(ntree, node, "Iterations", PROP_UNSIGNED, 1, 0, 
0);
        sock->flag |= SOCK_STATIC;
        
        /* NB: group socket input/output roles are inverted internally!
@@ -114,9 +114,9 @@
        if (ntemp->ngroup) {
                bNodeSocket *gsock;
                for (gsock=ntemp->ngroup->inputs.first; gsock; 
gsock=gsock->next)
-                       group_add_extern_socket(&node->inputs, SOCK_IN, gsock);
+                       group_add_extern_socket(ntree, &node->inputs, SOCK_IN, 
gsock);
                for (gsock=ntemp->ngroup->outputs.first; gsock; 
gsock=gsock->next)
-                       group_add_extern_socket(&node->outputs, SOCK_OUT, 
gsock);
+                       group_add_extern_socket(ntree, &node->outputs, 
SOCK_OUT, gsock);
        }
 }
 

Modified: 
branches/particles-2010/source/blender/nodes/intern/MOD_nodes/MOD_join.c
===================================================================
--- branches/particles-2010/source/blender/nodes/intern/MOD_nodes/MOD_join.c    
2011-04-26 09:27:43 UTC (rev 36333)
+++ branches/particles-2010/source/blender/nodes/intern/MOD_nodes/MOD_join.c    
2011-04-26 10:00:11 UTC (rev 36334)
@@ -30,10 +30,10 @@
 
 static void init(bNodeTree *ntree, bNode *node, bNodeTemplate *UNUSED(ntemp))
 {
-       nodeAddSocket(ntree, node, SOCK_IN, "A", SOCK_MESH, PROP_NONE);
-       nodeAddSocket(ntree, node, SOCK_IN, "B", SOCK_MESH, PROP_NONE);
+       nodeAddInputMesh(ntree, node, "A");
+       nodeAddInputMesh(ntree, node, "B");
        
-       nodeAddSocket(ntree, node, SOCK_OUT, "Mesh", SOCK_MESH, PROP_NONE);
+       nodeAddOutputMesh(ntree, node, "Mesh");
 }
 
 static void exec(ModNodeContext *UNUSED(ctx), void *UNUSED(nodedata), 
bNodeDataReader *in, bNodeDataSource *out)

Modified: 
branches/particles-2010/source/blender/nodes/intern/MOD_nodes/MOD_mesh.c
===================================================================
--- branches/particles-2010/source/blender/nodes/intern/MOD_nodes/MOD_mesh.c    
2011-04-26 09:27:43 UTC (rev 36333)
+++ branches/particles-2010/source/blender/nodes/intern/MOD_nodes/MOD_mesh.c    
2011-04-26 10:00:11 UTC (rev 36334)
@@ -32,7 +32,7 @@
 
 static void init(bNodeTree *ntree, bNode *node, bNodeTemplate *UNUSED(ntemp))
 {
-       nodeAddSocket(ntree, node, SOCK_OUT, "Mesh", SOCK_MESH, PROP_NONE);
+       nodeAddOutputMesh(ntree, node, "Mesh");
 }
 
 typedef struct ExecData {

Added: branches/particles-2010/source/blender/nodes/intern/MOD_nodes/MOD_morph.c
===================================================================
--- branches/particles-2010/source/blender/nodes/intern/MOD_nodes/MOD_morph.c   
                        (rev 0)
+++ branches/particles-2010/source/blender/nodes/intern/MOD_nodes/MOD_morph.c   
2011-04-26 10:00:11 UTC (rev 36334)
@@ -0,0 +1,105 @@
+/**
+* ***** BEGIN GPL LICENSE BLOCK *****
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version. 
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software Foundation,
+* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+* 
+* The Original Code is Copyright (C) 2006 Blender Foundation.
+* All rights reserved.
+* 
+* The Original Code is: all of this file.
+* 
+* Contributor(s): none yet.
+* 
+* ***** END GPL LICENSE BLOCK *****
+
+*/
+
+#include "DNA_meshdata_types.h"
+
+#include "BLI_math.h"
+
+#include "BKE_DerivedMesh.h"
+#include "BKE_cdderivedmesh.h"
+
+#include "../MOD_util.h"
+#include "node_socket.h"
+
+static void init(bNodeTree *ntree, bNode *node, bNodeTemplate *UNUSED(ntemp))
+{
+       nodeAddInputMesh(ntree, node, "A");
+       nodeAddInputMesh(ntree, node, "B");
+       nodeAddInputFloat(ntree, node, "Factor", PROP_FACTOR, 0.5f, 0, 0);
+       
+       nodeAddOutputMesh(ntree, node, "Mesh");
+}
+
+static void exec(ModNodeContext *UNUSED(ctx), void *UNUSED(nodedata), 
bNodeDataReader *in, bNodeDataSource *out)
+{
+       int totv_a=0;
+       int totv_b=0;
+       DerivedMesh *dm=NULL, *dm_a=NULL, *dm_b=NULL;
+       MVert *srcv_a, *srcv_b, *dstv;
+       int i;
+       int numFactor = nodeInputSizeValue(&in[2]);
+       
+       nodeSourceInitMesh(&out[0]);
+       
+       dm_a = nodeInputReadMesh(&in[0]);
+       dm_b = nodeInputReadMesh(&in[1]);
+       if (dm_a) {
+               totv_a = dm_a->getNumVerts(dm_a);
+       }
+       else
+               return;
+       if (dm_b) {
+               totv_b = dm_b->getNumVerts(dm_b);
+       }
+       else
+               return;
+       
+       if (totv_a != totv_b)
+               return;
+       
+       dm = CDDM_copy(dm_a);
+       
+       dstv = dm->getVertArray(dm);
+       srcv_a = dm_a->getVertArray(dm_a);
+       srcv_b = dm_b->getVertArray(dm_b);
+       if (numFactor > 1) {
+               for (i=0; i < totv_a; ++i, ++srcv_a, ++srcv_b, ++dstv) {
+                       interp_v3_v3v3(dstv->co, srcv_a->co, srcv_b->co, 
nodeInputReadValue(&in[2], MIN2(i, numFactor)));
+               }
+       }
+       else {
+               float factor = nodeInputReadValue(&in[2], 0);
+               for (i=0; i < totv_a; ++i, ++srcv_a, ++srcv_b, ++dstv) {
+                       interp_v3_v3v3(dstv->co, srcv_a->co, srcv_b->co, 
factor);
+               }
+       }
+       
+       nodeOutputWriteMesh(&out[0], 0, dm);
+}
+
+void register_node_type_mod_morph(ListBase *typelist)
+{
+       static ModNodeType modntype;
+       
+       mod_node_type_base(&modntype, MOD_NODE_MORPH, "Morph", 
NODE_CLASS_COMBINE, 0);
+       node_type_init(&modntype.ntype, init);
+       
+       modntype.modexecfunc = exec;
+       
+       nodeRegisterType(typelist, &modntype.ntype);
+}

Modified: 
branches/particles-2010/source/blender/nodes/intern/MOD_nodes/MOD_transform.c
===================================================================
--- 
branches/particles-2010/source/blender/nodes/intern/MOD_nodes/MOD_transform.c   
    2011-04-26 09:27:43 UTC (rev 36333)
+++ 
branches/particles-2010/source/blender/nodes/intern/MOD_nodes/MOD_transform.c   
    2011-04-26 10:00:11 UTC (rev 36334)
@@ -32,13 +32,13 @@
 
 static void init(bNodeTree *ntree, bNode *node, bNodeTemplate *UNUSED(ntemp))
 {
-       nodeAddSocket(ntree, node, SOCK_IN, "Mesh", SOCK_MESH, PROP_NONE);
-       nodeAddSocket(ntree, node, SOCK_IN, "Factor", SOCK_FLOAT, PROP_FACTOR);
-       nodeAddSocket(ntree, node, SOCK_IN, "Translate", SOCK_VECTOR, 
PROP_TRANSLATION);
-       nodeAddSocket(ntree, node, SOCK_IN, "Rotate", SOCK_VECTOR, PROP_EULER);
-       nodeAddSocket(ntree, node, SOCK_IN, "Scale", SOCK_VECTOR, PROP_XYZ);
+       nodeAddInputMesh(ntree, node, "Mesh");
+       nodeAddInputFloat(ntree, node, "Factor", PROP_FACTOR, 1.0f, 0, 0);
+       nodeAddInputVector(ntree, node, "Translate", PROP_TRANSLATION, 0.0f, 
0.0f, 0.0f, 0, 0);
+       nodeAddInputVector(ntree, node, "Rotate", PROP_EULER, 0.0f, 0.0f, 0.0f, 
0, 0);
+       nodeAddInputVector(ntree, node, "Scale", PROP_XYZ, 1.0f, 1.0f, 1.0f, 0, 
0);
        
-       nodeAddSocket(ntree, node, SOCK_OUT, "Mesh", SOCK_MESH, PROP_NONE);
+       nodeAddOutputMesh(ntree, node, "Mesh");
 }
 
 static void exec(ModNodeContext *UNUSED(ctx), void *UNUSED(nodedata), 
bNodeDataReader *in, bNodeDataSource *out)

Added: 
branches/particles-2010/source/blender/nodes/intern/MOD_nodes/MOD_vertexgroup.c
===================================================================
--- 
branches/particles-2010/source/blender/nodes/intern/MOD_nodes/MOD_vertexgroup.c 
                            (rev 0)
+++ 
branches/particles-2010/source/blender/nodes/intern/MOD_nodes/MOD_vertexgroup.c 
    2011-04-26 10:00:11 UTC (rev 36334)
@@ -0,0 +1,111 @@
+/**
+* ***** BEGIN GPL LICENSE BLOCK *****
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version. 
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software Foundation,
+* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+* 
+* The Original Code is Copyright (C) 2006 Blender Foundation.
+* All rights reserved.
+* 
+* The Original Code is: all of this file.
+* 
+* Contributor(s): none yet.
+* 
+* ***** END GPL LICENSE BLOCK *****
+
+*/
+
+#include "DNA_node_types.h"
+
+#include "BKE_node.h"
+#include "BKE_deform.h"
+
+#include "node_socket.h"
+#include "MOD_exec.h"
+#include "MOD_util.h"
+
+static void init(bNodeTree *ntree, bNode *node, bNodeTemplate *UNUSED(ntemp))
+{
+       node->storage = MEM_callocN(sizeof(ModNodeVertexGroup), 
"ModNodeVertexGroup");
+       
+       nodeAddInputMesh(ntree, node, "Mesh");
+       
+       nodeAddOutputFloat(ntree, node, "Weight");
+}
+
+static void initexec(bNodeExec *nodeexec)
+{
+       nodeexec->data = MEM_dupallocN(nodeexec->node->storage);
+}
+
+static void freeexec(bNodeExec *nodeexec)
+{
+       MEM_freeN(nodeexec->data);
+}
+
+static void exec(ModNodeContext *ctx, void *nodedata, bNodeDataReader *in, 
bNodeDataSource *out)
+{
+       ModNodeVertexGroup *data= (ModNodeVertexGroup*)nodedata;
+       DerivedMesh *dm= nodeInputReadMesh(&in[0]);
+       int defgroup_index;
+       MDeformVert *dvert = NULL;
+       int v, numVert, g;
+       float weight;
+       
+       defgroup_index = defgroup_name_index(ctx->ob, data->defgroup_name);
+       
+       if (!dm || defgroup_index < 0) {
+               nodeSourceInitValue(&out[0], 1);
+               nodeOutputWriteValue(&out[0], 0, 0.0f);
+               return;
+       }
+       
+       dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT);
+       numVert = dm->getNumVerts(dm);
+       
+       if (!dvert || numVert==0) {
+               nodeSourceInitValue(&out[0], 1);
+               nodeOutputWriteValue(&out[0], 0, 0.0f);
+               return;
+       }
+       
+       nodeSourceInitValue(&out[0], numVert);
+       
+       for (v=0; v < numVert; ++v) {
+               weight = 0.0f;
+               for(g=0; g < dvert[v].totweight; ++g) {
+                       if(dvert[v].dw[g].def_nr == defgroup_index) {
+                               weight = dvert[v].dw[g].weight;
+                               break;
+                       }
+               }
+               
+               nodeOutputWriteValue(&out[0], v, weight);
+       }
+}
+

@@ Diff output truncated at 10240 characters. @@
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to