[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11452] branches/soc-2007-mosani/source/ blender: This is the second of two commits which installs

Aaron Moore two.a.ron at gmail.com
Wed Aug 1 05:59:59 CEST 2007


Revision: 11452
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11452
Author:   mosani
Date:     2007-08-01 05:59:58 +0200 (Wed, 01 Aug 2007)

Log Message:
-----------
This is the second of two commits which installs
a new version of Peter Schlaile's plugin api WIP.

Changes:
 1. Added the new blenpluginapi folder.

Added Paths:
-----------
    branches/soc-2007-mosani/source/blender/blenpluginapi/
    branches/soc-2007-mosani/source/blender/blenpluginapi/CMakeLists.txt
    branches/soc-2007-mosani/source/blender/blenpluginapi/Makefile
    branches/soc-2007-mosani/source/blender/blenpluginapi/PLU_api.h
    branches/soc-2007-mosani/source/blender/blenpluginapi/PLU_audio.h
    branches/soc-2007-mosani/source/blender/blenpluginapi/PLU_core_api.h
    branches/soc-2007-mosani/source/blender/blenpluginapi/PLU_gui.h
    branches/soc-2007-mosani/source/blender/blenpluginapi/PLU_imbuf.h
    branches/soc-2007-mosani/source/blender/blenpluginapi/PLU_math.h
    branches/soc-2007-mosani/source/blender/blenpluginapi/PLU_obsolete.h
    branches/soc-2007-mosani/source/blender/blenpluginapi/PLU_private.h
    branches/soc-2007-mosani/source/blender/blenpluginapi/PLU_prop.h
    branches/soc-2007-mosani/source/blender/blenpluginapi/PLU_register.h
    branches/soc-2007-mosani/source/blender/blenpluginapi/PLU_renderapi.h
    branches/soc-2007-mosani/source/blender/blenpluginapi/PLU_sequencer.h
    branches/soc-2007-mosani/source/blender/blenpluginapi/PLU_types.h
    branches/soc-2007-mosani/source/blender/blenpluginapi/PLU_util.h
    branches/soc-2007-mosani/source/blender/blenpluginapi/SConscript
    branches/soc-2007-mosani/source/blender/blenpluginapi/documentation.h
    branches/soc-2007-mosani/source/blender/blenpluginapi/externdef.h
    branches/soc-2007-mosani/source/blender/blenpluginapi/floatpatch.h
    branches/soc-2007-mosani/source/blender/blenpluginapi/iff.h
    branches/soc-2007-mosani/source/blender/blenpluginapi/intern/
    branches/soc-2007-mosani/source/blender/blenpluginapi/intern/Makefile
    branches/soc-2007-mosani/source/blender/blenpluginapi/intern/pluginapi.c
    branches/soc-2007-mosani/source/blender/blenpluginapi/plugin.h
    branches/soc-2007-mosani/source/blender/blenpluginapi/util.h

Added: branches/soc-2007-mosani/source/blender/blenpluginapi/CMakeLists.txt
===================================================================
--- branches/soc-2007-mosani/source/blender/blenpluginapi/CMakeLists.txt	                        (rev 0)
+++ branches/soc-2007-mosani/source/blender/blenpluginapi/CMakeLists.txt	2007-08-01 03:59:58 UTC (rev 11452)
@@ -0,0 +1,42 @@
+# $Id: CMakeLists.txt,v 1.2 2006/11/17 13:07:44 jbinto Exp $
+# ***** BEGIN GPL/BL DUAL 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. The Blender
+# Foundation also sells licenses for use in proprietary software under
+# the Blender License.  See http://www.blender.org/BL/ for information
+# about this.
+#
+# 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+# The Original Code is Copyright (C) 2006, Blender Foundation
+# All rights reserved.
+#
+# The Original Code is: all of this file.
+#
+# Contributor(s): Jacques Beaurain.
+#
+# ***** END GPL/BL DUAL LICENSE BLOCK *****
+
+FILE(GLOB SRC intern/*.c)
+
+SET(INC 
+  . .. ../../../intern/guardedalloc ../blenlib ../imbuf ../makesdna ../blenkernel ../blenloader
+)
+
+IF(WITH_QUICKTIME)
+  SET(INC ${INC} ${QUICKTIME_INC})
+  ADD_DEFINITIONS(-DWITH_QUICKTIME)
+ENDIF(WITH_QUICKTIME)
+
+BLENDERLIB(bf_blenpluginapi "${SRC}" "${INC}")
+#env.BlenderLib ( libname = 'bf_blenpluginapi', sources = sources, includes = Split(incs), defines = defs, libtype=['core', 'player'], priority = [75, 35] )

Added: branches/soc-2007-mosani/source/blender/blenpluginapi/Makefile
===================================================================
--- branches/soc-2007-mosani/source/blender/blenpluginapi/Makefile	                        (rev 0)
+++ branches/soc-2007-mosani/source/blender/blenpluginapi/Makefile	2007-08-01 03:59:58 UTC (rev 11452)
@@ -0,0 +1,37 @@
+#
+# $Id: Makefile,v 1.4 2004/01/05 00:06:06 larstiq Exp $
+#
+# ***** BEGIN GPL/BL DUAL 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. The Blender
+# Foundation also sells licenses for use in proprietary software under
+# the Blender License.  See http://www.blender.org/BL/ for information
+# about this.
+#
+# 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+# All rights reserved.
+#
+# The Original Code is: all of this file.
+#
+# Contributor(s): none yet.
+#
+# ***** END GPL/BL DUAL LICENSE BLOCK *****
+#
+# Bounces make to subdirectories.
+
+SOURCEDIR = source/blender/blenpluginapi
+DIRS = intern
+
+include nan_subdirs.mk

Added: branches/soc-2007-mosani/source/blender/blenpluginapi/PLU_api.h
===================================================================
--- branches/soc-2007-mosani/source/blender/blenpluginapi/PLU_api.h	                        (rev 0)
+++ branches/soc-2007-mosani/source/blender/blenpluginapi/PLU_api.h	2007-08-01 03:59:58 UTC (rev 11452)
@@ -0,0 +1,333 @@
+#ifndef plugin_api_h
+#define plugin_api_h
+
+#include "PLU_types.h"
+
+#include "PLU_util.h"
+#include "PLU_prop.h"
+#include "PLU_gui.h"
+#include "PLU_register.h"
+#include "PLU_sequencer.h"
+#include "PLU_audio.h"
+#include "PLU_imbuf.h"
+#include "PLU_renderapi.h"
+
+/* 
+   use like this in global scope:
+
+   PLU_IMPORT_API(foo)
+
+   and then in an arbitrary function
+
+   PLU_foo->api_function(blurb);
+
+   or
+
+   PLU_IMPORT_API_VERSION(foo,VERSION)
+
+   to nail a specific API version
+
+   struct plugin_api_foo_v_VERSION * myvar = NULL;
+   PLU_IMPORT_API_ADVANCED(foo,VERSION,myvar)
+
+   to make it store a certain version.
+   Both macros expand to something semantically equivalent to this 
+   (which can be done by hand):
+   
+   ---------   
+   struct plugin_api_foo_v_VERSION * PLU_foo = NULL;
+
+   #if defined(c_plusplus) || defined(__cplusplus)
+   extern "C" {
+   #endif
+
+   int plugin_store_api_foo(
+         struct plugin_api_foo_v_VERSION * (*get_api)(int)) {
+
+	 struct plugin_api_foo_v_VERSION * p = get_api(VERSION);
+
+	 if (!p) {
+	         return FALSE;
+         } else {
+	         PLU_foo = p;
+		 return TRUE;
+         }
+   }
+
+   #if defined(c_plusplus) || defined(__cplusplus)
+   }
+   #endif
+   ---------
+
+   Before the plugin_query() function is called, all plugin_store_api_ 
+   functions are called, to initialize the used APIs.
+
+   If they return FALSE, a fatal problem is assumed, and the plugin is 
+   _not_ loaded!
+   By default, not finding an API of the correct version in the core is 
+   considered fatal, but you are free to write different plugin_store_api-
+   functions, that are a little bit more clever and try several versions 
+   before they fail.
+*/
+
+/*****************************************\
+ *                                       *
+ *       I M P O R T   M A C R O S       *
+ *                                       *
+\*****************************************/
+
+#if defined(c_plusplus) || defined(__cplusplus)
+
+#define PLU_IMPORT_API_ADVANCED(api,version,apivar) \
+struct plugin_api_ ## api ## _v_ ## version * apivar = 0 ; \
+\
+extern "C" { \
+int plugin_store_api_ ## api ( \
+     struct plugin_api_ ## api ## _v_ ## version * (*f)(int)){\
+     return ((apivar = f( version )) != 0); \
+} \
+}
+
+#else
+
+#define PLU_IMPORT_API_ADVANCED(api,version,apivar) \
+struct plugin_api_ ## api ## _v_ ## version * apivar = NULL ; \
+\
+int plugin_store_api_ ## api ( \
+     struct plugin_api_ ## api ## _v_ ## version * (*f)(int)){\
+     return ((apivar = f( version )) != 0); \
+} 
+
+#endif
+
+#define PLU_IMPORT_API_HELPER(api,version,apivar) \
+     PLU_IMPORT_API_ADVANCED(api,version,apivar)
+
+#define PLU_IMPORT_API(api) \
+     PLU_IMPORT_API_HELPER(api, B_PLUGIN_API_VERSION_ ## api,PLU_ ## api)
+
+#define PLU_IMPORT_API_VERSION(api,version) \
+     PLU_IMPORT_API_HELPER(api,version,PLU_ ## api)
+
+/*
+ * Render API Import Macros
+ */
+
+#define RND_IMPORT_API(api) \
+	PLU_IMPORT_API_HELPER(rnd_ ## api, \
+	                      B_PLUGIN_API_VERSION_RND_ ## api, RND_ ## api)
+
+#define RND_IMPORT_API_VERSION(api,version) \
+	PLU_IMPORT_API_HELPER(rnd_ ## api, version, RND_ ## api)
+
+#define RND_IMPORT_CORE_API \
+	PLU_IMPORT_API_HELPER(rnd_core, B_PLUGIN_API_VERSION_RND_core, RND)
+
+#define RND_IMPORT_CORE_API_VERSION(version) \
+	PLU_IMPORT_API_HELPER(rnd_core, version, RND)
+	
+
+#define RND_IMPORT_FULL_API \
+	RND_IMPORT_CORE_API \
+	RND_IMPORT_API(object) \
+	RND_IMPORT_API(light) \
+	RND_IMPORT_API(geometry) \
+	RND_IMPORT_API(vertex) \
+	RND_IMPORT_API(edge) \
+	RND_IMPORT_API(face) \
+	RND_IMPORT_API(index) \
+	RND_IMPORT_API(pass)
+
+#define RND_IMPORT_FULL_API_VERSION(version) \
+	RND_IMPORT_CORE_API(version) \
+	RND_IMPORT_API_VERSION(object,version) \
+	RND_IMPORT_API_VERSION(light,version) \
+	RND_IMPORT_API_VERSION(geometry,version) \
+	RND_IMPORT_API_VERSION(vertex,version) \
+	RND_IMPORT_API_VERSION(edge,version) \
+	RND_IMPORT_API_VERSION(face,version) \
+	RND_IMPORT_API_VERSION(index,version) \
+	RND_IMPORT_API_VERSION(pass,version)
+
+/*****************************************\
+ *                                       *
+ *       E X T E R N   M A C R O S       *
+ *                                       *
+\*****************************************/
+
+#define PLU_EXTERN_API_ADVANCED(api,version,apivar) \
+extern struct plugin_api_ ## api ## _v_ ## version * apivar ;
+
+#define PLU_EXTERN_API_HELPER(api,version,apivar) \
+	PLU_EXTERN_API_ADVANCED(api,version,apivar)
+
+#define PLU_EXTERN_API(api) \
+     PLU_EXTERN_API_HELPER(api, B_PLUGIN_API_VERSION_ ## api,PLU_ ## api)
+
+#define PLU_EXTERN_API_VERSION(api,version) \
+     PLU_EXTERN_API_HELPER(api,version,PLU_ ## api)
+
+/* Render API Extern Macros */
+
+
+#define RND_EXTERN_API(api) \
+	PLU_EXTERN_API_HELPER(rnd_ ## api, \
+	                      B_PLUGIN_API_VERSION_RND_ ## api, RND_ ## api)
+
+#define RND_EXTERN_API_VERSION(api,version) \
+	PLU_EXTERN_API_HELPER(rnd_ ## api, version, RND_ ## api)
+
+#define RND_EXTERN_CORE_API \
+	PLU_EXTERN_API_HELPER(rnd_core, B_PLUGIN_API_VERSION_RND_core, RND)
+
+#define RND_EXTERN_CORE_API_VERSION(version) \
+	PLU_EXTERN_API_HELPER(rnd_core, version, RND)
+	
+
+#define RND_EXTERN_FULL_API \
+	RND_EXTERN_CORE_API \
+	RND_EXTERN_API(object) \
+	RND_EXTERN_API(light) \
+	RND_EXTERN_API(geometry) \
+	RND_EXTERN_API(vertex) \
+	RND_EXTERN_API(edge) \
+	RND_EXTERN_API(face) \
+	RND_EXTERN_API(index) \
+	RND_EXTERN_API(pass)
+
+#define RND_EXTERN_FULL_API_VERSION(version) \
+	RND_EXTERN_CORE_API(version) \
+	RND_EXTERN_API_VERSION(object,version) \
+	RND_EXTERN_API_VERSION(light,version) \
+	RND_EXTERN_API_VERSION(geometry,version) \
+	RND_EXTERN_API_VERSION(vertex,version) \
+	RND_EXTERN_API_VERSION(edge,version) \
+	RND_EXTERN_API_VERSION(face,version) \
+	RND_EXTERN_API_VERSION(index,version) \
+	RND_EXTERN_API_VERSION(pass,version)
+
+
+
+
+#if defined(c_plusplus) || defined(__cplusplus)
+extern "C" {
+#endif
+	extern void plugin_query();
+#if defined(c_plusplus) || defined(__cplusplus)
+}
+#endif
+
+
+/*
+  File open using this interface might look like this:
+
+  --------------
+  plugin_control_t * open_video_file(const char * filename) {
+        plugin_control_t * rv;
+
+	plugin_descriptor_t * p = plugin_enumerate(PLUGIN_TYPE_VIDEO_INPUT);
+  
+	while (p) {
+	     if (file_matches_pattern(filename, p->file_pattern)) {

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list