[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11270] branches/soc-2007-mosani/source/ blender: I've got plugins loading.

Aaron Moore two.a.ron at gmail.com
Sat Jul 14 01:49:40 CEST 2007


Revision: 11270
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11270
Author:   mosani
Date:     2007-07-14 01:49:39 +0200 (Sat, 14 Jul 2007)

Log Message:
-----------
I've got plugins loading. They don't appear in the menu
yet, and in fact I've got to fix a memory leak, but
they load.

Details:
 - fixed a bug in the plugin cacheing system.
 - added files for blender to interact with the renderer plugins.
 - added a renderer user defined search directory.
 - setup plugin loading to happen when the renderer menu is being
   built for the first time.

Modified Paths:
--------------
    branches/soc-2007-mosani/source/blender/blenpluginapi/PLU_register.h
    branches/soc-2007-mosani/source/blender/blenpluginapi/PLU_types.h
    branches/soc-2007-mosani/source/blender/blenpluginapi/SConscript
    branches/soc-2007-mosani/source/blender/blenpluginapi/intern/pluginapi.c
    branches/soc-2007-mosani/source/blender/include/blendef.h
    branches/soc-2007-mosani/source/blender/makesdna/DNA_scene_types.h
    branches/soc-2007-mosani/source/blender/makesdna/DNA_userdef_types.h
    branches/soc-2007-mosani/source/blender/render/SConscript
    branches/soc-2007-mosani/source/blender/render/render_api/include/RND_types.h
    branches/soc-2007-mosani/source/blender/render/render_api/include/RenderAPI.h
    branches/soc-2007-mosani/source/blender/render/render_api/include/RenderAPI_helpers.h
    branches/soc-2007-mosani/source/blender/render/render_api/source/test.c
    branches/soc-2007-mosani/source/blender/src/SConscript
    branches/soc-2007-mosani/source/blender/src/buttons_scene.c
    branches/soc-2007-mosani/source/blender/src/headerbuttons.c
    branches/soc-2007-mosani/source/blender/src/space.c

Added Paths:
-----------
    branches/soc-2007-mosani/source/blender/render/render_api/include/RenderAPI_internal.h
    branches/soc-2007-mosani/source/blender/render/render_api/source/RND_internal.c

Modified: branches/soc-2007-mosani/source/blender/blenpluginapi/PLU_register.h
===================================================================
--- branches/soc-2007-mosani/source/blender/blenpluginapi/PLU_register.h	2007-07-13 18:30:32 UTC (rev 11269)
+++ branches/soc-2007-mosani/source/blender/blenpluginapi/PLU_register.h	2007-07-13 23:49:39 UTC (rev 11270)
@@ -93,7 +93,7 @@
 	) {
 	
 	plugin_descriptor_t * rv = plugin_register_private(
-		B_PLUGIN_VERSION, PLUGIN_TYPE_MATERIAL,
+		B_PLUGIN_VERSION, PLUGIN_TYPE_RENDER_OUTPUT,
 		capabilities, name, 
 		menu_entry,
 		author,	copyright, help, date, 
@@ -105,4 +105,77 @@
 	return rv;
 }
 
+
+
+
+/* External Renderer Plugin Registration */
+/*
+typedef struct RendererRegistration{
+	
+	/ standard registration /
+	char* name;
+	char* menu_entry;
+	char* author;
+	char* copyright;
+	char* help;
+	char* date;
+	unsigned long long capabilities;
+	plugin_instance_t* (*init)(plugin_control_t * c);
+	plugin_instance_t* (*load)(plugin_control_t * c);
+	void (*free)(plugin_instance_t* This);
+	
+	/ renderer registration /
+	void (*setup)( RNDScene scene );
+	void (*render_frame)( RNDScene scene, RNDResult result );
+	void (*finish)();
+	void (*abort)();
+	
+}RendererRegistration; */
+
+static PLU_INLINE plugin_descriptor_t * plugin_register_render_output(
+	const char* name, 
+
+	const char* menu_entry,
+
+	const char* author,
+	const char* copyright,
+	const char* help,
+	const char* date,
+
+	unsigned long long capabilities,
+	
+	plugin_instance_t* (*init)(plugin_control_t * c),
+	plugin_instance_t* (*load)(plugin_control_t * c),
+	void (*free)(plugin_instance_t* This),
+	
+	void (*setup)( RNDScene scene ),
+	void (*render_frame)( RNDScene scene, RNDResult result ),
+	void (*finish)(),
+	void (*abort)()
+	){
+	
+	plugin_descriptor_t * rv = plugin_register_private(
+		B_PLUGIN_VERSION, PLUGIN_TYPE_RENDER_OUTPUT,
+		capabilities, name, 
+		menu_entry,
+		
+		author,
+		copyright, 
+		help, 
+		date,
+		
+		0, 
+		init, 
+		load, 
+		free );
+	
+	rv->i.render_out.setup = setup;
+	rv->i.render_out.render_frame = render_frame;
+	rv->i.render_out.finish = finish;
+	rv->i.render_out.abort = abort;
+	
+	return rv;
+}
+	
+	
 #endif

Modified: branches/soc-2007-mosani/source/blender/blenpluginapi/PLU_types.h
===================================================================
--- branches/soc-2007-mosani/source/blender/blenpluginapi/PLU_types.h	2007-07-13 18:30:32 UTC (rev 11269)
+++ branches/soc-2007-mosani/source/blender/blenpluginapi/PLU_types.h	2007-07-13 23:49:39 UTC (rev 11270)
@@ -1,6 +1,8 @@
 #ifndef plugin_types_h
 #define plugin_types_h
 
+#include "RenderAPI.h"
+
 /*
   PLUGIN_TYPE: the different plugin types, that can register itself.
   SUB_TYPEs aren't real types, but are used instead as a convenience for
@@ -38,6 +40,8 @@
 
 	PLUGIN_SUB_TYPE_VIDEO_POINT_FILTER,
 	
+	PLUGIN_TYPE_RENDER_OUTPUT,
+	
 	PLUGIN_SIZEOF_TYPE /* _always_ the last element */
 } plugin_type_t;
 
@@ -393,6 +397,26 @@
 			   int stype, float *texvec, float *dxt, float *dyt );
 } plugin_interface_material_t;
 
+
+
+
+
+
+
+/* External Renderer Plugins: */
+
+typedef struct plugin_interface_render_output_t {
+	void (*setup)( RNDScene scene );
+	void (*render_frame)( RNDScene scene, RNDResult result );
+	void (*finish)();
+	void (*abort)();
+}plugin_interface_render_output_t;
+
+
+
+
+
+
 /*
   plugin descriptor: read from a seperate plugin registry and / or by file
   scan. Describes the plugin and offers the interface to create an instance.
@@ -465,6 +489,8 @@
 		*/
 
 		plugin_interface_video_point_filter_t point_filter;
+		
+		plugin_interface_render_output_t render_out;
 
 		/* add more as need arises ... ;-) */
 	} i;

Modified: branches/soc-2007-mosani/source/blender/blenpluginapi/SConscript
===================================================================
--- branches/soc-2007-mosani/source/blender/blenpluginapi/SConscript	2007-07-13 18:30:32 UTC (rev 11269)
+++ branches/soc-2007-mosani/source/blender/blenpluginapi/SConscript	2007-07-13 23:49:39 UTC (rev 11270)
@@ -4,6 +4,7 @@
 sources = env.Glob('intern/*.c')
 
 incs = '. .. #/intern/guardedalloc ../blenlib ../imbuf ../makesdna ../blenkernel ../blenloader'
+incs += ' ../render/render_api/include'
 
 defs = []
 

Modified: branches/soc-2007-mosani/source/blender/blenpluginapi/intern/pluginapi.c
===================================================================
--- branches/soc-2007-mosani/source/blender/blenpluginapi/intern/pluginapi.c	2007-07-13 18:30:32 UTC (rev 11269)
+++ branches/soc-2007-mosani/source/blender/blenpluginapi/intern/pluginapi.c	2007-07-13 23:49:39 UTC (rev 11270)
@@ -807,19 +807,22 @@
 {
 	fprintf(fp, "%s ", key);
 
-	while (*str) {
-		switch (*str) {
-		case '\\':
-			fputc('\\', fp);
-			fputc('\\', fp);
-			break;
-		case '\n':
-			fputc('\\', fp);
-			fputc('n', fp);
-			break;
-		default:
-			fputc(*str, fp);
-			break;
+	if(str){ /* error check, allows for str == NULL */
+		while (*str) {
+			switch (*str) {
+			case '\\':
+				fputc('\\', fp);
+				fputc('\\', fp);
+				break;
+			case '\n':
+				fputc('\\', fp);
+				fputc('n', fp);
+				break;
+			default:
+				fputc(*str, fp);
+				break;
+			}
+			str++;
 		}
 	}
 	fputc('\n', fp);
@@ -1081,6 +1084,11 @@
 	if (strcmp(U.plugtexdir, U.plugseqdir) != 0) {
 		plugin_parsedir(U.plugseqdir, 0);
 	}
+	if(strcmp(U.plugtexdir, U.plugrendir) != 0 &&
+			strcmp(U.plugseqdir, U.plugrendir) != 0 ) {
+		plugin_parsedir(U.plugrendir, 0);
+	}
+		
 }
 
 static void plugin_scan_all(int force_refresh)

Modified: branches/soc-2007-mosani/source/blender/include/blendef.h
===================================================================
--- branches/soc-2007-mosani/source/blender/include/blendef.h	2007-07-13 18:30:32 UTC (rev 11269)
+++ branches/soc-2007-mosani/source/blender/include/blendef.h	2007-07-13 23:49:39 UTC (rev 11270)
@@ -295,6 +295,7 @@
 /* yafray: for exportdir select */
 #define B_YAFRAYDIRFILESEL	338
 #define B_PYMENUEVAL		339 /* re-eval scripts registration in menus */
+#define B_PLUGRENDIRFILESEL 340
 /* END Definitions for the fileselect buttons in user prefs */
 
 /* IMAGE: 350 */

Modified: branches/soc-2007-mosani/source/blender/makesdna/DNA_scene_types.h
===================================================================
--- branches/soc-2007-mosani/source/blender/makesdna/DNA_scene_types.h	2007-07-13 18:30:32 UTC (rev 11269)
+++ branches/soc-2007-mosani/source/blender/makesdna/DNA_scene_types.h	2007-07-13 23:49:39 UTC (rev 11270)
@@ -49,6 +49,7 @@
 struct Image;
 struct Group;
 struct bNodeTree;
+struct plugin_control_t;
 
 typedef struct Base {
 	struct Base *next, *prev;
@@ -229,6 +230,8 @@
 
 	/* render engine, octree resolution */
 	short renderer, ocres, rpad[2];
+	char *plugin_renderer_name;
+	struct plugin_control_t *plugin_renderer;
 
 	/**
 	 * What to do with the sky/background. Picks sky/premul/key

Modified: branches/soc-2007-mosani/source/blender/makesdna/DNA_userdef_types.h
===================================================================
--- branches/soc-2007-mosani/source/blender/makesdna/DNA_userdef_types.h	2007-07-13 18:30:32 UTC (rev 11269)
+++ branches/soc-2007-mosani/source/blender/makesdna/DNA_userdef_types.h	2007-07-13 23:49:39 UTC (rev 11270)
@@ -146,6 +146,7 @@
 	char textudir[160];
 	char plugtexdir[160];
 	char plugseqdir[160];
+	char plugrendir[160];
 	char pythondir[160];
 	char sounddir[160];
 	/* yafray: temporary xml export directory */

Modified: branches/soc-2007-mosani/source/blender/render/SConscript
===================================================================
--- branches/soc-2007-mosani/source/blender/render/SConscript	2007-07-13 18:30:32 UTC (rev 11269)
+++ branches/soc-2007-mosani/source/blender/render/SConscript	2007-07-13 23:49:39 UTC (rev 11270)
@@ -9,6 +9,7 @@
 incs += ' extern/include ../blenkernel ../radiosity/extern/include ../imbuf'
 incs += ' ../quicktime ../include ../../kernel/gen_messaging'
 incs += ' render_api/include'
+incs += ' ../blenpluginapi'
 
 defs = []
 

Modified: branches/soc-2007-mosani/source/blender/render/render_api/include/RND_types.h
===================================================================
--- branches/soc-2007-mosani/source/blender/render/render_api/include/RND_types.h	2007-07-13 18:30:32 UTC (rev 11269)
+++ branches/soc-2007-mosani/source/blender/render/render_api/include/RND_types.h	2007-07-13 23:49:39 UTC (rev 11270)
@@ -27,8 +27,21 @@
 #ifndef RENDER_API_TYPES_H
 #define RENDER_API_TYPES_H
 
-#include "RenderAPI.h"
+#include "DNA_listBase.h"
 
+/* FORWARD DECLARATIONS */
+
+/* exteranl */
+
+struct Scene;
+struct ListBase;
+struct Object;
+struct Lamp;
+struct DerivedMesh;
+struct ListBase;
+
+/* internal */
+
 struct RenderAPIScene;
 struct RenderAPIObject;
 struct RenderAPIObjectHolder;
@@ -44,44 +57,44 @@
  */
 
 typedef struct RenderAPIScene{
-	Scene *source;
+	struct Scene *source;
 
 	/* All object used in this render job, list of RenderAPIObjectHolders */
-	ListBase objects;
+	struct ListBase objects;
 
 	/* Indexes of various kinds, lists of RenderAPIObjectPointers */
 	/* indexes by type */
-	ListBase light_point;
-	ListBase light_spot;
-	ListBase light_sun;
-	ListBase light_hemi;
-	ListBase light_area;
-	ListBase geometry_polygon_mesh;
-	ListBase geometry_subdivision_surface;
-	ListBase geometry_nurb_surface;
-	ListBase geometry_metaball;
-	ListBase geometry_curve;
-	ListBase geometry_particle_system;
+	struct ListBase light_point;
+	struct ListBase light_spot;
+	struct ListBase light_sun;
+	struct ListBase light_hemi;
+	struct ListBase light_area;
+	struct ListBase geometry_polygon_mesh;
+	struct ListBase geometry_subdivision_surface;
+	struct ListBase geometry_nurb_surface;
+	struct ListBase geometry_metaball;
+	struct ListBase geometry_curve;
+	struct ListBase geometry_particle_system;
 	/* other indexes */
-	ListBase originals;
+	struct ListBase originals;
 
 	/* RNDObjects that have been generated */
-	ListBase object_handlers;
+	struct ListBase object_handlers;
 }RenderAPIScene;
 
 typedef struct RenderAPIObject{
 	struct RenderAPIObject *next, *prev;
-	ListBase list;
+	struct ListBase list;
 	struct RenderAPIObjectPointer *current;
 
 	/* RNDLight and RNDGeometry handlers that have been generated */
-	ListBase lights;
-	ListBase geometry;
+	struct ListBase lights;
+	struct ListBase geometry;
 }RenderAPIObject;
 
 typedef struct RenderAPIObjectHolder{
 	struct RenderAPIObjectHolder *next, *prev; /* for listing */
-	Object *source; /* object in blender's database */
+	struct Object *source; /* object in blender's database */

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list