[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [31769] branches/particles-2010: Fixed important bug in ParticleSet rna definition, wasn' t derived from ID struct.

Lukas Toenne lukas.toenne at googlemail.com
Sun Sep 5 18:04:13 CEST 2010


Revision: 31769
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=31769
Author:   lukastoenne
Date:     2010-09-05 18:04:12 +0200 (Sun, 05 Sep 2010)

Log Message:
-----------
Fixed important bug in ParticleSet rna definition, wasn't derived from ID struct. Some code cleanup too (more to follow).

Modified Paths:
--------------
    branches/particles-2010/release/scripts/ui/properties_data_particleset.py
    branches/particles-2010/source/blender/makesrna/intern/rna_particleset.c
    branches/particles-2010/source/blender/nodes/intern/SIM_nodes/SIM_math.c
    branches/particles-2010/source/blender/nodes/intern/SIM_nodes/SIM_set_data.c
    branches/particles-2010/source/blender/nodes/intern/SIM_util.h
    branches/particles-2010/source/blender/nodes/intern/node_tree_simulation.c

Modified: branches/particles-2010/release/scripts/ui/properties_data_particleset.py
===================================================================
--- branches/particles-2010/release/scripts/ui/properties_data_particleset.py	2010-09-05 15:18:45 UTC (rev 31768)
+++ branches/particles-2010/release/scripts/ui/properties_data_particleset.py	2010-09-05 16:04:12 UTC (rev 31769)
@@ -33,7 +33,7 @@
 
 class DATA_PT_context_particleset(DataButtonsPanel, bpy.types.Panel):
     bl_label = ""
-    bl_show_header = False
+    bl_options = {'HIDE_HEADER'}
 
     def draw(self, context):
         layout = self.layout
@@ -42,10 +42,13 @@
         pset = context.particleset
         space = context.space_data
 
+        split = layout.split(percentage=0.65)
         if ob:
-            layout.template_ID(ob, "data")
-        elif lat:
-            layout.template_ID(space, "pin_id")
+            split.template_ID(ob, "data")
+            split.separator()
+        elif pset:
+            split.template_ID(space, "pin_id")
+            split.separator()
 
 
 class DATA_PT_custom_props_particleset(DataButtonsPanel, PropertyPanel, bpy.types.Panel):
@@ -68,7 +71,7 @@
         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")

Modified: branches/particles-2010/source/blender/makesrna/intern/rna_particleset.c
===================================================================
--- branches/particles-2010/source/blender/makesrna/intern/rna_particleset.c	2010-09-05 15:18:45 UTC (rev 31768)
+++ branches/particles-2010/source/blender/makesrna/intern/rna_particleset.c	2010-09-05 16:04:12 UTC (rev 31769)
@@ -212,7 +212,7 @@
 	PropertyRNA *prop, *parm;
 	FunctionRNA *func;
 
-	srna = RNA_def_struct(brna, "ParticleSet", NULL);
+	srna = RNA_def_struct(brna, "ParticleSet", "ID");
 	RNA_def_struct_sdna(srna, "ParticleSet");
 	RNA_def_struct_ui_text(srna, "Particle Set", "");
 	RNA_def_struct_ui_icon(srna, ICON_PARTICLES);

Modified: branches/particles-2010/source/blender/nodes/intern/SIM_nodes/SIM_math.c
===================================================================
--- branches/particles-2010/source/blender/nodes/intern/SIM_nodes/SIM_math.c	2010-09-05 15:18:45 UTC (rev 31768)
+++ branches/particles-2010/source/blender/nodes/intern/SIM_nodes/SIM_math.c	2010-09-05 16:04:12 UTC (rev 31769)
@@ -90,8 +90,9 @@
 
 );
 
-static void cl_enqueue_add(bNode *node, cl_context *context, cl_command_queue *queue, int *r_opsock)
+static void cl_enqueue_add(SimExecData *execdata, SimNodeStack *node, SimDataContext *self)
 {
+//	cl_int res;
 	
 }
 

Modified: branches/particles-2010/source/blender/nodes/intern/SIM_nodes/SIM_set_data.c
===================================================================
--- branches/particles-2010/source/blender/nodes/intern/SIM_nodes/SIM_set_data.c	2010-09-05 15:18:45 UTC (rev 31768)
+++ branches/particles-2010/source/blender/nodes/intern/SIM_nodes/SIM_set_data.c	2010-09-05 16:04:12 UTC (rev 31769)
@@ -160,7 +160,7 @@
 {
 	cl_int res;
 	int datasize = sim_get_data_size(in->type);
-
+	
 	/* set the context
 	 * Note: the context for GetData node sockets is set by the path explicitely
 	 */

Modified: branches/particles-2010/source/blender/nodes/intern/SIM_util.h
===================================================================
--- branches/particles-2010/source/blender/nodes/intern/SIM_util.h	2010-09-05 15:18:45 UTC (rev 31768)
+++ branches/particles-2010/source/blender/nodes/intern/SIM_util.h	2010-09-05 16:04:12 UTC (rev 31769)
@@ -148,222 +148,4 @@
 
 size_t sim_get_data_size(int datatype);
 
-#if 0
-int nodeHasOperatorInput(struct bNode *node);
-int nodeHasOperatorOutput(struct bNode *node);
-
-typedef struct SimNodeBatch {
-	struct SimNodeBatch *next, *prev;
-	void *data;					/* data elements */
-	char *filter;				/* filter mask */
-	short flag;					/* flags */
-	int start, fill, totdata;	/* starting/current/maximum number of elements in the batch */
-	int branches_done;			/* how many branches have handled this batch (to know when to discard) */
-} SimNodeBatch;
-
-/* SimNodeBatch flags */
-#define NODE_DATA_EXTERNAL		1	/* batch uses external data pointer, no freeing needed */
-
-/* equivalent of bNodeStack for simulation nodes */
-typedef struct SimNodeSocketInstance {
-	int branches;				/* number of inputs using this socket */
-	short datatype;				/* type of socket this data comes from (for conversions) */
-	PointerRNA context;			/* current data context */
-} SimNodeSocketInstance;
-
-/* temporary data while executing. one of these for every instance of a node */
-typedef struct SimNodeInstance {
-	struct bNode *basenode;
-	SimNodeSocketInstance **inputs;				/* pointers to the either the linked output instances or default socket data */
-	SimNodeSocketInstance *outputs;				/* output instances */
-	int totinputs, totoutputs, totbranches;		/* instance array lengths and sum of active branches */
-	PointerRNA inputcontext;					/* current context of input elements */
-} SimNodeInstance;
-
-typedef struct SimNodeThreadContext {
-	SimulationContext *sim;
-	int totthread;
-	
-	/* shared variables */
-	SimExecData *execdata;
-	int active;				/* number of working threads */
-	pthread_mutex_t mutex;	/* NOTE: not using blenlib ThreadMutex because we need a custom condition here */
-	pthread_cond_t cond;
-} SimNodeThreadContext;
-
-typedef struct SimNodeThread {
-	SimNodeThreadContext *ctx;
-	int num;
-} SimNodeThread;
-
-typedef struct SimNodeJob {
-	struct SimNodeJob *next, *prev;
-	struct SimNodeInstance *node;
-	struct SimNodeBatch *input[MAX_SOCKET];	/* arbitrary... watch this */
-	int input_start, input_totdata;			/* starting index and total number of input elements */
-	
-	/* storage variables to keep data while suspended */
-	int current;
-	int storage1, storage2;
-	float storage3, storage4;
-	void *custom;			/* custom, must be allocated/freed in init_job node callbacks! */
-	
-	/* shared variables, lock the thread mutex before access! */
-	short state;			/* current working state of the job */
-	int execlevel;			/* current execution level */
-} SimNodeJob;
-
-/* SimNodeJob state */
-#define SIM_JOB_PREPARING	1	/* waiting for further input */
-#define SIM_JOB_READY		2	/* all inputs ready, waiting for idle thread */
-#define SIM_JOB_RUNNING		3	/* in progress */
-#define SIM_JOB_SUSPENDED	4	/* job has been suspended */
-#define SIM_JOB_CANCEL		5	/* cancel */
-#define SIM_JOB_DONE		6	/* completed */
-
-void sim_init_singleton_batch(struct SimNodeBatch *batch, int datatype);
-void sim_init_collection_batch(struct SimNodeBatch *batch, int datatype, int start, int totdata, int filter);
-void sim_init_default_socket_batch(struct SimNodeBatch *batch, struct bNodeSocket *sock);
-void sim_init_operator_socket_batch(struct SimNodeBatch *batch, struct SimNodeInstance *node);
-void sim_free_batch(struct SimNodeBatch *batch);
-int sim_insert_output_batch(struct SimNodeThreadContext *ctx, struct SimNodeInstance *node, struct SimNodeSocketInstance *sock, struct SimNodeBatch *batch);
-
-typedef struct SimNodeDataStream {
-	int total;								/* total number of streams in the array */
-	struct SimNodeSocketInstance *sock;		/* socket used */
-	struct SimNodeBatch *batch;				/* data batch used */
-	int datasize;							/* size of data element */
-	int current;							/* current element index */
-	void *data;								/* element pointer */
-	char *filter;							/* filter pointer */
-	char valid;								/* stream validity */
-} SimNodeDataStream;
-
-int sim_istream_init(struct SimNodeDataStream *stream, struct SimNodeThreadContext *ctx, struct SimNodeJob *job);
-void sim_istream_close(struct SimNodeDataStream *stream, struct SimNodeThreadContext *ctx);
-int sim_istream_next(struct SimNodeDataStream *stream);
-int sim_istream_isvalid(struct SimNodeDataStream *stream);
-int sim_istream_isfiltered(struct SimNodeDataStream *stream);
-float sim_istream_read_float(struct SimNodeDataStream *stream, int sock);
-int sim_istream_read_int(struct SimNodeDataStream *stream, int sock);
-char sim_istream_read_bool(struct SimNodeDataStream *stream, int sock);
-/* TODO should vector/rgba reads make a full copy? */
-float *sim_istream_read_vector(struct SimNodeDataStream *stream, int sock);
-float *sim_istream_read_rgba(struct SimNodeDataStream *stream, int sock);
-
-int sim_ostream_init(struct SimNodeDataStream *stream, struct SimNodeThreadContext *ctx, struct SimNodeJob *job, int start);
-void sim_ostream_close(struct SimNodeDataStream *stream, struct SimNodeThreadContext *ctx, struct SimNodeJob *job);
-int sim_ostream_next(struct SimNodeDataStream *stream);
-int sim_ostream_isvalid(struct SimNodeDataStream *stream);
-void sim_ostream_filter(struct SimNodeDataStream *stream, int sock);
-void sim_ostream_filter_all(struct SimNodeDataStream *stream);
-void sim_ostream_write_float(struct SimNodeDataStream *stream, int sock, float value);
-void sim_ostream_write_int(struct SimNodeDataStream *stream, int sock, int value);
-void sim_ostream_write_bool(struct SimNodeDataStream *stream, int sock, char value);
-void sim_ostream_write_vector(struct SimNodeDataStream *stream, int sock, float *value);
-void sim_ostream_write_rgba(struct SimNodeDataStream *stream, int sock, float *value);
-
-
-#if 0
-#define SIM_JOBEXEC_DEBUGPRINT_BEGIN \
-	printf("-> Node %s: ", job->node->node->name);
-#define SIM_JOBEXEC_DEBUGPRINT \
-	printf(", %d", job->current);
-#define SIM_JOBEXEC_DEBUGPRINT_FILTER \
-	if (sim_istream_isfiltered(istream)) \
-		printf(", (%d)", job->current); \
-	else \
-		printf(", %d", job->current);
-#define SIM_JOBEXEC_DEBUGPRINT_END \
-	printf(" %d\n", job->current);
-#elif 0
-#define SIM_JOBEXEC_DEBUGPRINT_BEGIN \
-	printf("-> Node %s (level=%d, start=%d, tot=%d, cur=%d): ", job->node->node->name, job->execlevel, job->input_start, job->input_totdata, job->current);
-#define SIM_JOBEXEC_DEBUGPRINT \
-	if (i == 0) printf("%d", job->current); \
-	else if (i < 5) printf(", %d", job->current); \
-	else if (i == 5) printf(" ... ");
-#define SIM_JOBEXEC_DEBUGPRINT_FILTER \
-	if (sim_istream_isfiltered(istream)) { \
-		if (i == 0) printf("(%d)", job->current); \
-		else if (i < 5) printf(", (%d)", job->current); \
-		else if (i == 5) printf(" ... "); \
-	} \
-	else { \

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list