[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11078] branches/soc-2007-mosani/source/ blender: This is one of two commits that will put Peter Schlaile' s new plugin api WIP in place in my branch.

Aaron Moore two.a.ron at gmail.com
Tue Jun 26 20:17:51 CEST 2007


Revision: 11078
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11078
Author:   mosani
Date:     2007-06-26 20:17:51 +0200 (Tue, 26 Jun 2007)

Log Message:
-----------
This is one of two commits that will put Peter Schlaile's new plugin api WIP in place in my branch.
This commit deletes the current system and applies the necessary patch.

Modified Paths:
--------------
    branches/soc-2007-mosani/source/blender/blenkernel/BKE_idprop.h
    branches/soc-2007-mosani/source/blender/blenkernel/intern/idprop.c
    branches/soc-2007-mosani/source/blender/blenloader/intern/readfile.c
    branches/soc-2007-mosani/source/blender/blenloader/intern/writefile.c
    branches/soc-2007-mosani/source/blender/makesdna/DNA_ID.h
    branches/soc-2007-mosani/source/blender/python/api2_2x/IDProp.c
    branches/soc-2007-mosani/source/blender/render/intern/source/pipeline.c
    branches/soc-2007-mosani/source/blender/render/render_api/include/RenderAPI.h

Removed Paths:
-------------
    branches/soc-2007-mosani/source/blender/blenpluginapi/

Modified: branches/soc-2007-mosani/source/blender/blenkernel/BKE_idprop.h
===================================================================
--- branches/soc-2007-mosani/source/blender/blenkernel/BKE_idprop.h	2007-06-26 18:15:45 UTC (rev 11077)
+++ branches/soc-2007-mosani/source/blender/blenkernel/BKE_idprop.h	2007-06-26 18:17:51 UTC (rev 11078)
@@ -68,8 +68,8 @@
 void IDP_UnlinkArray(struct IDProperty *prop);
 
 /* ---------- String Type ------------ */
-void IDP_AssignString(struct IDProperty *prop, char *st);
-void IDP_ConcatStringC(struct IDProperty *prop, char *st);
+void IDP_AssignString(struct IDProperty *prop, const char *st);
+void IDP_ConcatStringC(struct IDProperty *prop, const char *st);
 void IDP_ConcatString(struct IDProperty *str1, struct IDProperty *append);
 void IDP_FreeString(struct IDProperty *prop);
 
@@ -114,7 +114,7 @@
 */
 void IDP_RemFromGroup(struct IDProperty *group, struct IDProperty *prop);
 
-IDProperty *IDP_GetPropertyFromGroup(struct IDProperty *prop, char *name);
+IDProperty *IDP_GetPropertyFromGroup(struct IDProperty *prop, const char *name);
 
 /*Get an iterator to iterate over the members of an id property group.
  Note that this will automatically free the iterator once iteration is complete;
@@ -163,7 +163,7 @@
 IDP_AddToGroup or MEM_freeN the property, doing anything else might result in
 a memory leak.
 */
-struct IDProperty *IDP_New(int type, IDPropertyTemplate val, char *name);
+struct IDProperty *IDP_New(int type, IDPropertyTemplate val, const char *name);
 \
 /*NOTE: this will free all child properties of list arrays and groups!
   Also, note that this does NOT unlink anything!  Plus it doesn't free
@@ -173,4 +173,15 @@
 /*Unlinks any struct IDProperty<->ID linkage that might be going on.*/
 void IDP_UnlinkProperty(struct IDProperty *prop);
 
+/*Binds property to c-variable - strings are expected to be a char** pointer,
+  so that the property-system can store current address of string,
+  use target = NULL to unbind!
+*/
+void IDP_BindProperty(struct IDProperty *prop, void * target);
+
+#define IDP_Int(prop) (*(int*)prop->data.pointer)
+#define IDP_Float(prop) (*(float*)prop->data.pointer)
+#define IDP_String(prop) ((char*)prop->data.pointer)
+#define IDP_Array(prop) (prop->data.pointer)
+
 #endif /* _BKE_IDPROP_H */

Modified: branches/soc-2007-mosani/source/blender/blenkernel/intern/idprop.c
===================================================================
--- branches/soc-2007-mosani/source/blender/blenkernel/intern/idprop.c	2007-06-26 18:15:45 UTC (rev 11077)
+++ branches/soc-2007-mosani/source/blender/blenkernel/intern/idprop.c	2007-06-26 18:17:51 UTC (rev 11078)
@@ -96,6 +96,9 @@
 	prop->data.pointer = newarr;
 	prop->len = newlen;
 	prop->totallen = newsize;
+	if (prop->data.bindpointer) {
+		*prop->data.bindpointer = newarr;
+	}
 }
 
  void IDP_FreeArray(IDProperty *prop)
@@ -116,7 +119,7 @@
 
 
 /* ---------- String Type ------------ */
-void IDP_AssignString(IDProperty *prop, char *st)
+void IDP_AssignString(IDProperty *prop, const char *st)
 {
 	int stlen;
 
@@ -126,7 +129,7 @@
 	strcpy(prop->data.pointer, st);
 }
 
-void IDP_ConcatStringC(IDProperty *prop, char *st)
+void IDP_ConcatStringC(IDProperty *prop, const char *st)
 {
 	int newlen;
 
@@ -224,7 +227,7 @@
 	BLI_remlink(&group->data.group, prop);
 }
 
-IDProperty *IDP_GetPropertyFromGroup(IDProperty *prop, char *name)
+IDProperty *IDP_GetPropertyFromGroup(IDProperty *prop, const char *name)
 {
 	IDProperty *loop;
 	for (loop=prop->data.group.first; loop; loop=loop->next) {
@@ -294,7 +297,7 @@
 	}
 }
 
-IDProperty *IDP_New(int type, IDPropertyTemplate val, char *name)
+IDProperty *IDP_New(int type, IDPropertyTemplate val, const char *name)
 {
 	IDProperty *prop=NULL;
 
@@ -302,10 +305,12 @@
 		case IDP_INT:
 			prop = MEM_callocN(sizeof(IDProperty), "IDProperty int");
 			prop->data.val = val.i;
+			prop->data.pointer = &prop->data.val;
 			break;
 		case IDP_FLOAT:
 			prop = MEM_callocN(sizeof(IDProperty), "IDProperty float");
 			*(float*)&prop->data.val = val.f;
+			prop->data.pointer = &prop->data.val;
 			break;
 		case IDP_ARRAY:
 		{
@@ -374,6 +379,45 @@
 	}
 }
 
+/*Binds property to c-variable - strings are expected to be a char** pointer,
+  so that the property-system can store current address of string,
+  (target = NULL meens unbind)
+*/
+void IDP_BindProperty(struct IDProperty *prop, void * target)
+{
+	switch (prop->type) {
+	case IDP_ARRAY:
+	case IDP_STRING:
+	case IDP_VECTOR:
+	case IDP_MATRIX:
+		prop->data.bindpointer = (void**) target;
+		if (target) {
+			*prop->data.bindpointer = prop->data.pointer;
+		}
+		break;
+	case IDP_INT: {
+		int v = IDP_Int(prop);
+		if (target) {
+			prop->data.pointer = target;
+		} else {
+			prop->data.pointer = &prop->data.val;
+		}
+		IDP_Int(prop) = v;
+		break;
+	}
+	case IDP_FLOAT: {
+		float v = IDP_Float(prop);
+		if (target) {
+			prop->data.pointer = target;
+		} else {
+			prop->data.pointer = &prop->data.val;
+		}
+		IDP_Float(prop) = v;
+		break;
+	}
+	}
+}
+
 /*Unlinks any IDProperty<->ID linkage that might be going on.*/
 void IDP_UnlinkProperty(IDProperty *prop)
 {

Modified: branches/soc-2007-mosani/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/soc-2007-mosani/source/blender/blenloader/intern/readfile.c	2007-06-26 18:15:45 UTC (rev 11077)
+++ branches/soc-2007-mosani/source/blender/blenloader/intern/readfile.c	2007-06-26 18:17:51 UTC (rev 11078)
@@ -1353,15 +1353,19 @@
 void IDP_DirectLinkProperty(IDProperty *prop, int switch_endian, void *fd)
 {
 	switch (prop->type) {
-		case IDP_GROUP:
-			IDP_DirectLinkGroup(prop, switch_endian, fd);
-			break;
-		case IDP_STRING:
-			IDP_DirectLinkString(prop, switch_endian, fd);
-			break;
-		case IDP_ARRAY:
-			IDP_DirectLinkArray(prop, switch_endian, fd);
-			break;
+	case IDP_INT:
+	case IDP_FLOAT:
+		prop->data.pointer = &prop->data.val;
+		break;
+	case IDP_GROUP:
+		IDP_DirectLinkGroup(prop, switch_endian, fd);
+		break;
+	case IDP_STRING:
+		IDP_DirectLinkString(prop, switch_endian, fd);
+		break;
+	case IDP_ARRAY:
+		IDP_DirectLinkArray(prop, switch_endian, fd);
+		break;
 	}
 }
 

Modified: branches/soc-2007-mosani/source/blender/blenloader/intern/writefile.c
===================================================================
--- branches/soc-2007-mosani/source/blender/blenloader/intern/writefile.c	2007-06-26 18:15:45 UTC (rev 11077)
+++ branches/soc-2007-mosani/source/blender/blenloader/intern/writefile.c	2007-06-26 18:17:51 UTC (rev 11078)
@@ -423,6 +423,14 @@
 
 void IDP_WriteProperty(IDProperty *prop, void *wd)
 {
+	switch (prop->type) {
+	case IDP_INT:
+		prop->data.val = IDP_Int(prop);
+		break;
+	case IDP_FLOAT:
+		*(float*) &prop->data.val = IDP_Float(prop);
+		break;
+	}
 	writestruct(wd, DATA, "IDProperty", 1, prop);
 	IDP_WriteProperty_OnlyData(prop, wd);
 }

Modified: branches/soc-2007-mosani/source/blender/makesdna/DNA_ID.h
===================================================================
--- branches/soc-2007-mosani/source/blender/makesdna/DNA_ID.h	2007-06-26 18:15:45 UTC (rev 11077)
+++ branches/soc-2007-mosani/source/blender/makesdna/DNA_ID.h	2007-06-26 18:17:51 UTC (rev 11078)
@@ -49,7 +49,9 @@
 typedef struct IDPropertyData {
 	void *pointer;
 	ListBase group;
-	int val, pad;
+	int val;
+	int pad;
+	void **bindpointer;
 } IDPropertyData;
 
 typedef struct IDProperty {

Modified: branches/soc-2007-mosani/source/blender/python/api2_2x/IDProp.c
===================================================================
--- branches/soc-2007-mosani/source/blender/python/api2_2x/IDProp.c	2007-06-26 18:15:45 UTC (rev 11077)
+++ branches/soc-2007-mosani/source/blender/python/api2_2x/IDProp.c	2007-06-26 18:17:51 UTC (rev 11078)
@@ -60,9 +60,9 @@
 		case IDP_STRING:
 			return PyString_FromString( prop->data.pointer );
 		case IDP_INT:
-			return PyInt_FromLong( (long)prop->data.val );
+			return Py_BuildValue( "i", IDP_Int(prop) );
 		case IDP_FLOAT:
-			return PyFloat_FromDouble( (double)(*(float*)(&prop->data.val)) );
+			return Py_BuildValue( "f", IDP_Float(prop) );
 		case IDP_GROUP:
 			/*blegh*/
 			{
@@ -114,7 +114,7 @@
 			if (!value)
 				return EXPP_ReturnIntError(PyExc_TypeError, "expected an int!");
 			ivalue = (int) PyInt_AsLong(value);
-			prop->data.val = ivalue;
+			IDP_Int(prop) = ivalue;
 			Py_XDECREF(value);
 			break;
 		}
@@ -127,7 +127,7 @@
 			if (!value)
 				return EXPP_ReturnIntError(PyExc_TypeError, "expected a float!");
 			fvalue = (float) PyFloat_AsDouble(value);
-			*(float*)&self->prop->data.val = fvalue;
+			IDP_Float(prop) = fvalue;
 			Py_XDECREF(value);
 			break;
 		}
@@ -335,10 +335,10 @@
 			return PyString_FromString(prop->data.pointer);
 			break;
 		case IDP_FLOAT:
-			return PyFloat_FromDouble(*((float*)&prop->data.val));
+			return Py_BuildValue("f", IDP_Float(prop));
 			break;
 		case IDP_INT:
-			return PyInt_FromLong( (long)prop->data.val );
+			return Py_BuildValue("i", IDP_Int(prop));
 			break;
 		case IDP_ARRAY:
 		{

Modified: branches/soc-2007-mosani/source/blender/render/intern/source/pipeline.c
===================================================================
--- branches/soc-2007-mosani/source/blender/render/intern/source/pipeline.c	2007-06-26 18:15:45 UTC (rev 11077)
+++ branches/soc-2007-mosani/source/blender/render/intern/source/pipeline.c	2007-06-26 18:17:51 UTC (rev 11078)
@@ -1517,7 +1517,7 @@
 
 static void do_render_3d_with_RenderAPI(Render *re)
 {
-	RenderAPI_test_method();
+	RenderAPI_explore();
 }
 
 

Modified: branches/soc-2007-mosani/source/blender/render/render_api/include/RenderAPI.h
===================================================================
--- branches/soc-2007-mosani/source/blender/render/render_api/include/RenderAPI.h	2007-06-26 18:15:45 UTC (rev 11077)
+++ branches/soc-2007-mosani/source/blender/render/render_api/include/RenderAPI.h	2007-06-26 18:17:51 UTC (rev 11078)
@@ -43,6 +43,12 @@
 
 /* Outside of the render system */
 #include "BKE_global.h"
+#include "DNA_ID.h"
+#include "DNA_listBase.h"
+#include "DNA_scene_types.h"
+#include "DNA_object_types.h"
+#include "DNA_mesh_types.h"
+#include "DNA_meshdata_types.h"
 
 /* Render API */
 #include "RenderAPI_settings.h"
@@ -69,4 +75,18 @@
 			test_renderer.version );
 }
 
+void print_point( char *label, int *optional_index, char type, void *point );
+
+void RenderAPI_explore(){
+	ListBase current_scene_bases = G.scene->base;
+	Base *current_base;
+	Object *current_object;
+	Mesh *current_mesh;

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list