[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [30429] branches/particles-2010: * Added a few generic programming control structure nodes (program, subprogram, if).
Lukas Toenne
lukas.toenne at googlemail.com
Sat Jul 17 13:50:01 CEST 2010
Revision: 30429
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=30429
Author: lukastoenne
Date: 2010-07-17 13:50:01 +0200 (Sat, 17 Jul 2010)
Log Message:
-----------
* Added a few generic programming control structure nodes (program, subprogram, if). Execution nodes postponed until design is done and particle properties completed.
* Implemented dynamic particle properties. These extend the particle buffer with custom data at runtime, which can be used in simulations.
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/editors/particleset/particleset_intern.h
branches/particles-2010/source/blender/editors/particleset/particleset_ops.c
branches/particles-2010/source/blender/editors/space_buttons/buttons_context.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/makesdna/intern/makesdna.c
branches/particles-2010/source/blender/makesrna/RNA_access.h
branches/particles-2010/source/blender/makesrna/RNA_enum_types.h
branches/particles-2010/source/blender/makesrna/RNA_types.h
branches/particles-2010/source/blender/makesrna/intern/rna_ID.c
branches/particles-2010/source/blender/makesrna/intern/rna_internal.h
branches/particles-2010/source/blender/makesrna/intern/rna_main.c
branches/particles-2010/source/blender/makesrna/intern/rna_main_api.c
branches/particles-2010/source/blender/makesrna/intern/rna_modifier.c
branches/particles-2010/source/blender/makesrna/intern/rna_nodetree_types.h
branches/particles-2010/source/blender/makesrna/intern/rna_particleset.c
branches/particles-2010/source/blender/nodes/SIM_node.h
branches/particles-2010/source/blender/nodes/intern/SIM_nodes/SIM_timestep.c
branches/particles-2010/source/blender/nodes/intern/SIM_util.c
branches/particles-2010/source/blender/nodes/intern/SIM_util.h
branches/particles-2010/source/blender/nodes/intern/node_tree_composite.c
branches/particles-2010/source/blender/nodes/intern/node_tree_simulation.c
branches/particles-2010/source/blender/nodes/intern/node_util.h
Added Paths:
-----------
branches/particles-2010/release/scripts/ui/properties_data_particleset.py
branches/particles-2010/source/blender/editors/particleset/particleset_edit.c
branches/particles-2010/source/blender/nodes/intern/SIM_nodes/SIM_if.c
branches/particles-2010/source/blender/nodes/intern/SIM_nodes/SIM_program.c
branches/particles-2010/source/blender/nodes/intern/SIM_nodes/SIM_subprogram.c
Removed Paths:
-------------
branches/particles-2010/source/blender/editors/particleset/editparticleset.c
Added: branches/particles-2010/release/scripts/ui/properties_data_particleset.py
===================================================================
--- branches/particles-2010/release/scripts/ui/properties_data_particleset.py (rev 0)
+++ branches/particles-2010/release/scripts/ui/properties_data_particleset.py 2010-07-17 11:50:01 UTC (rev 30429)
@@ -0,0 +1,119 @@
+# ##### 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.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+import bpy
+from rna_prop_ui import PropertyPanel
+
+narrowui = bpy.context.user_preferences.view.properties_width_check
+
+
+class DataButtonsPanel(bpy.types.Panel):
+ bl_space_type = 'PROPERTIES'
+ bl_region_type = 'WINDOW'
+ bl_context = "data"
+
+ def poll(self, context):
+ return context.particleset
+
+
+class DATA_PT_context_particleset(DataButtonsPanel):
+ bl_label = ""
+ bl_show_header = False
+
+ def draw(self, context):
+ layout = self.layout
+
+ ob = context.object
+ pset = context.particleset
+ space = context.space_data
+ wide_ui = context.region.width > narrowui
+
+ if wide_ui:
+ split = layout.split(percentage=0.65)
+ if ob:
+ split.template_ID(ob, "data")
+ split.separator()
+ elif lat:
+ split.template_ID(space, "pin_id")
+ split.separator()
+ else:
+ if ob:
+ layout.template_ID(ob, "data")
+ elif lat:
+ layout.template_ID(space, "pin_id")
+
+
+class DATA_PT_custom_props_particleset(DataButtonsPanel, PropertyPanel):
+ _context_path = "object.data"
+
+
+class DATA_PT_particleset(DataButtonsPanel):
+ bl_label = "Particle Set"
+
+ def draw(self, context):
+ layout = self.layout
+
+ pset = context.particleset
+ wide_ui = context.region.width > narrowui
+
+ row = layout.row()
+ row.prop(pset, "page_size")
+
+ layout.operator_menu_enum("particleset.property_add", "type")
+
+ for pp in pset.particle_properties:
+ box = layout.box()
+ box.set_context_pointer("parprop", pp)
+
+ row = box.row()
+ row.prop(pp, "name")
+ row.operator("particleset.property_movedown", text="", icon="TRIA_DOWN")
+ row.operator("particleset.property_moveup", text="", icon="TRIA_UP")
+ row.operator("particleset.property_remove", text="", icon="X")
+
+ row = box.row()
+ row.prop(pp, "type")
+
+ row = box.row()
+ col = row.column()
+ col.prop(pp, "size")
+ col = row.column()
+ col.prop(pp, "offset")
+
+
+classes = [
+ DATA_PT_context_particleset,
+ DATA_PT_particleset,
+
+ DATA_PT_custom_props_particleset]
+
+
+def register():
+ register = bpy.types.register
+ for cls in classes:
+ register(cls)
+
+
+def unregister():
+ unregister = bpy.types.unregister
+ for cls in classes:
+ unregister(cls)
+
+if __name__ == "__main__":
+ register()
Modified: branches/particles-2010/source/blender/blenkernel/BKE_node.h
===================================================================
--- branches/particles-2010/source/blender/blenkernel/BKE_node.h 2010-07-17 05:52:46 UTC (rev 30428)
+++ branches/particles-2010/source/blender/blenkernel/BKE_node.h 2010-07-17 11:50:01 UTC (rev 30429)
@@ -66,6 +66,10 @@
float val1, val2, val3, val4; /* default alloc value for inputs */
float min, max; /* default range for inputs */
+ short flag;
+
+ char pad[2];
+
/* after this line is used internal only */
struct ListBase verified; /* used during verify_types */
struct bNodeSocket *internsock; /* group nodes, the internal socket counterpart */
@@ -158,6 +162,7 @@
void ntreeFreeTree(struct bNodeTree *ntree);
struct bNodeTree *ntreeCopyTree(struct bNodeTree *ntree, int internal_select);
void ntreeMakeLocal(struct bNodeTree *ntree);
+int ntreeHasType(struct bNodeTree *ntree, int type);
void ntreeSocketUseFlags(struct bNodeTree *ntree);
void ntreeUpdateListSockets(struct bNodeTree *ntree);
@@ -216,8 +221,6 @@
void NodeTagChanged(struct bNodeTree *ntree, struct bNode *node);
void NodeTagIDChanged(struct bNodeTree *ntree, struct ID *id);
-int nodeIsListSocket(bNodeSocketType *stype);
-
/* ************** Groups ****************** */
struct bNode *nodeMakeGroupFromSelected(struct bNodeTree *ntree);
@@ -465,7 +468,10 @@
/* range 1 - 100 is reserved for common nodes */
/* using toolbox, we add node groups by assuming the values below don't exceed NODE_GROUP_MENU for now */
-#define SIM_NODE_TIMESTEP 601
+#define SIM_NODE_PROGRAM 601
+#define SIM_NODE_SUBPROGRAM 602
+#define SIM_NODE_IF 603
+#define SIM_NODE_TIMESTEP 604
#define SIM_NODE_DEBUGPRINT 699
Modified: branches/particles-2010/source/blender/blenkernel/BKE_particleset.h
===================================================================
--- branches/particles-2010/source/blender/blenkernel/BKE_particleset.h 2010-07-17 05:52:46 UTC (rev 30428)
+++ branches/particles-2010/source/blender/blenkernel/BKE_particleset.h 2010-07-17 11:50:01 UTC (rev 30429)
@@ -36,8 +36,16 @@
void pset_calc_modifiers(struct Scene *scene, struct Object *ob);
/* attribute management */
-int pset_get_particle_size(struct ParticleSet *pset);
+extern struct ParticlePropertyInfo pset_std_properties[];
+struct ParticlePropertyInfo *pset_stdproperty_get_info(enum eParticleStdProperty type);
+struct ParticlePropertyInfo *pset_find_particle_property(struct ParticleSet *pset, const char *name);
+
+struct ParticlePropertyInfo *pset_property_add(struct ParticleSet *pset, eParticleStdProperty type);
+int pset_property_remove(struct ParticleSet *pset, int index);
+int pset_property_moveup(struct ParticleSet *pset, int index);
+int pset_property_movedown(struct ParticleSet *pset, int index);
+
/* buffer management */
void pset_create_particles(struct ParticleSet *pset, float cfra, int emit);
void pset_kill_particle(struct ParticleSet *pset, int index);
@@ -45,16 +53,17 @@
void pset_free_dead_pages(struct ParticleSet *pset);
void pset_free_particles(struct ParticleSet *pset);
void pset_reset(struct ParticleSet *pset);
+void pset_set_page_size(ParticleSet *pset, int new_page_size);
/* particle access */
-struct Particle* pset_get_particle(struct ParticleSet *pset, int index);
+struct NParticle* pset_get_particle(struct ParticleSet *pset, int index);
struct ParticleIterator;
typedef int (*ParticleIteratorSkipFunc)(struct ParticleIterator*);
typedef struct ParticleIterator
{
ParticleSet *pset;
- Particle *pa;
+ NParticle *pa;
int index;
ParticlePage *page;
Modified: branches/particles-2010/source/blender/blenkernel/intern/node.c
===================================================================
--- branches/particles-2010/source/blender/blenkernel/intern/node.c 2010-07-17 05:52:46 UTC (rev 30428)
+++ branches/particles-2010/source/blender/blenkernel/intern/node.c 2010-07-17 11:50:01 UTC (rev 30429)
@@ -36,6 +36,7 @@
#include <string.h>
#include "DNA_anim_types.h"
+#include "DNA_node_types.h"
#include "RNA_access.h"
@@ -43,7 +44,7 @@
#include "BKE_animsys.h" /* BKE_free_animdata only */
-#include "PIL_time.h"
+//#include "PIL_time.h"
#include "MEM_guardedalloc.h"
@@ -147,12 +148,6 @@
}
}
-int nodeIsListSocket(bNodeSocketType *stype)
-{
- /* TODO needs a more generic way of allowing list sockets - phonybone */
- return (stype->type == SOCK_OP);
-}
-
/* only used internal... we depend on type definitions! */
static bNodeSocket *node_add_socket_type(ListBase *lb, bNodeSocketType *stype)
{
@@ -226,12 +221,12 @@
static void verify_socket(ListBase *lb, bNodeSocketType *stype, ListBase *r_verified)
{
- bNodeSocket *sock;
- int list_socket= nodeIsListSocket(stype);
+ bNodeSocket *sock, *socknext;
r_verified->first = r_verified->last = NULL;
- for(sock= lb->first; sock; sock= sock->next) {
+ sock= lb->first;
+ while (sock) {
/* both indices are zero for non-groups, otherwise it's a unique index */
if(sock->to_index==stype->own_index && strncmp(sock->name, stype->name, NODE_MAXSTR)==0) {
sock->type= stype->type; /* in future, read this from tydefs! */
@@ -241,31 +236,32 @@
sock->ns.max= stype->max;
sock->tosock= stype->internsock;
- BLI_remlink(lb, sock);
-
/* non-list sockets may only have one of each type */
- if (!list_socket) {
+ if ((stype->flag & SOCK_LIST) == 0) {
+ BLI_remlink(lb, sock);
/* add to verified list */
BLI_addtail(r_verified, sock);
- break;
+
+ return;
}
else {
- /* only the last socket may be without link (checked after the loop) */
- if (sock->link) {
- if (r_verified->last)
- sock->list_index = ((bNodeSocket*)r_verified->last)->list_index + 1;
- else
- sock->list_index = -1;
- /* add to verified list */
- BLI_addtail(r_verified, sock);
+ if (r_verified->last)
+ sock->list_index = ((bNodeSocket*)r_verified->last)->list_index + 1;
+ else {
+ sock->list_index = 0;
}
+
+ socknext = sock->next;
+
+ BLI_remlink(lb, sock);
+ /* add to verified list */
+ BLI_addtail(r_verified, sock);
+
+ sock = socknext;
}
-
-
- if (!list_socket) {
- break;
- }
}
+ else
+ sock= sock->next;
}
#if 0
@@ -857,7 +853,6 @@
* Ideally it should be done atomically for target node + socket, which requires storing the previous socket for the modal linking operator */
void ntreeUpdateListSockets(bNodeTree *ntree)
{
- int list_socket;
bNode *node;
bNodeSocketType *stype;
bNodeSocket *sock, *next_sock;
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list