[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [34329] branches/particles-2010: Added modifier_node_tree pointer to objects, so a node tree can be used instead of the stack.
Lukas Toenne
lukas.toenne at googlemail.com
Sat Jan 15 11:45:32 CET 2011
Revision: 34329
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=34329
Author: lukastoenne
Date: 2011-01-15 10:45:31 +0000 (Sat, 15 Jan 2011)
Log Message:
-----------
Added modifier_node_tree pointer to objects, so a node tree can be used instead of the stack.
Modified Paths:
--------------
branches/particles-2010/release/scripts/ui/properties_data_modifier.py
branches/particles-2010/source/blender/blenkernel/BKE_node.h
branches/particles-2010/source/blender/blenkernel/intern/node.c
branches/particles-2010/source/blender/blenloader/intern/readfile.c
branches/particles-2010/source/blender/makesdna/DNA_object_types.h
branches/particles-2010/source/blender/makesrna/intern/rna_object.c
branches/particles-2010/source/blender/makesrna/intern/rna_space.c
branches/particles-2010/source/blender/nodes/intern/MOD_nodetree.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/node_exec.h
Modified: branches/particles-2010/release/scripts/ui/properties_data_modifier.py
===================================================================
--- branches/particles-2010/release/scripts/ui/properties_data_modifier.py 2011-01-14 21:45:49 UTC (rev 34328)
+++ branches/particles-2010/release/scripts/ui/properties_data_modifier.py 2011-01-15 10:45:31 UTC (rev 34329)
@@ -34,6 +34,7 @@
ob = context.object
+ layout.template_ID(ob, "modifier_node_tree")
layout.operator_menu_enum("object.modifier_add", "type")
for md in ob.modifiers:
Modified: branches/particles-2010/source/blender/blenkernel/BKE_node.h
===================================================================
--- branches/particles-2010/source/blender/blenkernel/BKE_node.h 2011-01-14 21:45:49 UTC (rev 34328)
+++ branches/particles-2010/source/blender/blenkernel/BKE_node.h 2011-01-15 10:45:31 UTC (rev 34329)
@@ -189,12 +189,7 @@
#define NODE_CLASS_MATH_ROTATION 19
#define NODE_CLASS_PARTICLES 25
-/* Execution Data for each instance of node tree execution.
- * Tree types may extend this to include custom data.
- */
-typedef struct bNodeTreeExecData {
- struct bNodeTree *nodetree;
-} bNodeTreeExecData;
+struct bNodeTreeExecData;
typedef void (*bNodeTreeCallback)(void *calldata, struct ID *owner_id, struct bNodeTree *ntree);
typedef struct bNodeTreeType
@@ -211,8 +206,8 @@
void (*freeNodeCache)(struct bNodeTree *ntree, struct bNode *node);
void (*foreachNodeTree)(struct Main *main, void *calldata, bNodeTreeCallback func); /* iteration over all node trees */
struct bNodeTreeExecData *(*beginExec)(struct bNodeTree *ntree);
- void (*endExec)(bNodeTreeExecData *execdata);
- void (*exec)(bNodeTreeExecData *execdata, void *callerdata, int thread);
+ void (*endExec)(struct bNodeTreeExecData *execdata);
+ void (*exec)(struct bNodeTreeExecData *execdata, void *callerdata, int thread);
/* general update function */
void (*update)(struct bNodeTree *ntree);
Modified: branches/particles-2010/source/blender/blenkernel/intern/node.c
===================================================================
--- branches/particles-2010/source/blender/blenkernel/intern/node.c 2011-01-14 21:45:49 UTC (rev 34328)
+++ branches/particles-2010/source/blender/blenkernel/intern/node.c 2011-01-15 10:45:31 UTC (rev 34329)
@@ -63,6 +63,8 @@
#include "RNA_access.h"
+#include "intern/node_exec.h"
+
#include "CMP_node.h"
#include "SHD_node.h"
#include "TEX_node.h"
@@ -2240,7 +2242,6 @@
/* nodes are presorted, so exec is in order of list */
void ntreeExecTree(bNodeTreeExecData *execdata, void *callerdata, int thread)
{
-
if(execdata) {
bNodeTreeType *treetype= ntreeGetType(execdata->nodetree->type);
if (treetype->exec)
Modified: branches/particles-2010/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/particles-2010/source/blender/blenloader/intern/readfile.c 2011-01-14 21:45:49 UTC (rev 34328)
+++ branches/particles-2010/source/blender/blenloader/intern/readfile.c 2011-01-15 10:45:31 UTC (rev 34329)
@@ -3633,6 +3633,8 @@
}
}
+ ob->modifier_nodetree= newlibadr_us(fd, ob->id.lib, ob->modifier_nodetree);
+
ob->gpd= newlibadr_us(fd, ob->id.lib, ob->gpd);
ob->duplilist= NULL;
Modified: branches/particles-2010/source/blender/makesdna/DNA_object_types.h
===================================================================
--- branches/particles-2010/source/blender/makesdna/DNA_object_types.h 2011-01-14 21:45:49 UTC (rev 34328)
+++ branches/particles-2010/source/blender/makesdna/DNA_object_types.h 2011-01-15 10:45:31 UTC (rev 34329)
@@ -55,6 +55,7 @@
struct DerivedMesh;
struct SculptSession;
struct bGPdata;
+struct bNodeTree;
/* Vertex Groups - Name Info */
@@ -124,6 +125,7 @@
ListBase disp;
ListBase defbase;
ListBase modifiers; /* list of ModifierData structures */
+ struct bNodeTree *modifier_nodetree;
int mode; /* Local object mode */
int restore_mode; /* Keep track of what mode to return to after toggling a mode */
@@ -186,7 +188,7 @@
short rotmode; /* rotation mode - uses defines set out in DNA_action_types.h for PoseChannel rotations... */
char dt, dtx;
- char empty_drawtype, pad1[3];
+ char empty_drawtype, pad2[3];
float empty_drawsize;
float dupfacesca; /* dupliface scale */
@@ -247,7 +249,7 @@
unsigned int state; /* bit masks of game controllers that are active */
unsigned int init_state; /* bit masks of initial state as recorded by the users */
- int pad2;
+ int pad3;
ListBase gpulamp; /* runtime, for lamps only */
ListBase pc_ids;
Modified: branches/particles-2010/source/blender/makesrna/intern/rna_object.c
===================================================================
--- branches/particles-2010/source/blender/makesrna/intern/rna_object.c 2011-01-14 21:45:49 UTC (rev 34328)
+++ branches/particles-2010/source/blender/makesrna/intern/rna_object.c 2011-01-15 10:45:31 UTC (rev 34329)
@@ -127,6 +127,7 @@
#include "DNA_key_types.h"
#include "DNA_constraint_types.h"
#include "DNA_lattice_types.h"
+#include "DNA_node_types.h"
#include "BKE_armature.h"
#include "BKE_bullet.h"
@@ -1063,6 +1064,20 @@
return rna_pointer_inherit_refine(ptr, &RNA_CollisionSettings, ob->pd);
}
+static int rna_Object_modifier_node_tree_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
+{
+ bNodeTree *ntree= (bNodeTree*)value.data;
+
+ /* exclude group trees */
+ if (ntree->flag & NTREE_GROUP)
+ return 0;
+ /* only modifier trees */
+ if (ntree->type != NTREE_MODIFIER)
+ return 0;
+
+ return 1;
+}
+
static PointerRNA rna_Object_active_constraint_get(PointerRNA *ptr)
{
Object *ob= (Object*)ptr->id.data;
@@ -1996,18 +2011,25 @@
RNA_def_property_float_funcs(prop, "rna_Object_matrix_basis_get", "rna_Object_matrix_basis_set", NULL);
RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
- /* collections */
+ /* modifiers */
+ prop= RNA_def_property(srna, "modifiers", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Modifier");
+ RNA_def_property_ui_text(prop, "Modifiers", "Modifiers affecting the geometric data of the object");
+ rna_def_object_modifiers(brna, prop);
+
+ prop= RNA_def_property(srna, "modifier_node_tree", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "modifier_nodetree");
+ RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Object_modifier_node_tree_poll");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Modifier Node Tree", "Node tree for node based modifiers");
+
+ /* constraints */
prop= RNA_def_property(srna, "constraints", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, "Constraint");
RNA_def_property_ui_text(prop, "Constraints", "Constraints affecting the transformation of the object");
// RNA_def_property_collection_funcs(prop, 0, 0, 0, 0, 0, 0, 0, "constraints__add", "constraints__remove");
rna_def_object_constraints(brna, prop);
- prop= RNA_def_property(srna, "modifiers", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "Modifier");
- RNA_def_property_ui_text(prop, "Modifiers", "Modifiers affecting the geometric data of the object");
- rna_def_object_modifiers(brna, prop);
-
/* game engine */
prop= RNA_def_property(srna, "game", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
Modified: branches/particles-2010/source/blender/makesrna/intern/rna_space.c
===================================================================
--- branches/particles-2010/source/blender/makesrna/intern/rna_space.c 2011-01-14 21:45:49 UTC (rev 34328)
+++ branches/particles-2010/source/blender/makesrna/intern/rna_space.c 2011-01-15 10:45:31 UTC (rev 34329)
@@ -772,23 +772,6 @@
return 1;
}
-static PointerRNA rna_SpaceNodeEditor_node_tree_get(PointerRNA *ptr)
-{
- SpaceNode *snode= (SpaceNode*)ptr->data;
- PointerRNA value;
-
- RNA_pointer_create(&snode->nodetree->id, &RNA_NodeTree, snode->nodetree, &value);
- return value;
-}
-
-static void rna_SpaceNodeEditor_node_tree_set(PointerRNA *ptr, PointerRNA value)
-{
- SpaceNode *snode= (SpaceNode*)ptr->data;
- bNodeTree *ntree= (bNodeTree*)value.data;
-
- snode->nodetree = ntree;
-}
-
static void rna_SpaceNodeEditor_node_tree_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
SpaceNode *snode= (SpaceNode*)ptr->data;
@@ -2332,13 +2315,11 @@
RNA_def_property_ui_text(prop, "ID From", "Datablock from which the edited datablock is linked");
prop= RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
-// RNA_def_property_pointer_sdna(prop, NULL, "nodetree");
- RNA_def_property_struct_type(prop, "NodeTree");
- RNA_def_property_pointer_funcs(prop, "rna_SpaceNodeEditor_node_tree_get", "rna_SpaceNodeEditor_node_tree_set", NULL, "rna_SpaceNodeEditor_node_tree_poll");
+ RNA_def_property_pointer_sdna(prop, NULL, "nodetree");
+ RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_SpaceNodeEditor_node_tree_poll");
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Node Tree", "Node tree being displayed and edited");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NODE, "rna_SpaceNodeEditor_node_tree_update");
-// RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NODE, NULL);
prop= RNA_def_property(srna, "show_backdrop", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SNODE_BACKDRAW);
Modified: branches/particles-2010/source/blender/nodes/intern/MOD_nodetree.c
===================================================================
--- branches/particles-2010/source/blender/nodes/intern/MOD_nodetree.c 2011-01-14 21:45:49 UTC (rev 34328)
+++ branches/particles-2010/source/blender/nodes/intern/MOD_nodetree.c 2011-01-15 10:45:31 UTC (rev 34329)
@@ -37,9 +37,11 @@
#include "BKE_main.h"
#include "BKE_node.h"
-#include "MOD_node.h"
+#include "node_exec.h"
#include "node_util.h"
+#include "MOD_node.h"
+
#include "MEM_guardedalloc.h"
//#define DEBUGPRINT
Modified: branches/particles-2010/source/blender/nodes/intern/SIM_intern.h
===================================================================
--- branches/particles-2010/source/blender/nodes/intern/SIM_intern.h 2011-01-14 21:45:49 UTC (rev 34328)
+++ branches/particles-2010/source/blender/nodes/intern/SIM_intern.h 2011-01-15 10:45:31 UTC (rev 34329)
@@ -56,6 +56,8 @@
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list