[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [34096] trunk/blender: ToDo: long outstanding patch to allow access to system paths in background mode

Andrea Weikert elubie at gmx.net
Wed Jan 5 15:00:14 CET 2011


Revision: 34096
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=34096
Author:   elubie
Date:     2011-01-05 15:00:14 +0100 (Wed, 05 Jan 2011)

Log Message:
-----------
ToDo: long outstanding patch to allow access to system paths in background mode
Thanks Damien Plisson for contributing the Carbon and Cocoa implementation

Modified Paths:
--------------
    trunk/blender/intern/ghost/CMakeLists.txt
    trunk/blender/intern/ghost/GHOST_C-api.h
    trunk/blender/intern/ghost/GHOST_ISystem.h
    trunk/blender/intern/ghost/GHOST_Path-api.h
    trunk/blender/intern/ghost/GHOST_Types.h
    trunk/blender/intern/ghost/SConscript
    trunk/blender/intern/ghost/intern/GHOST_Path-api.cpp
    trunk/blender/intern/ghost/intern/GHOST_System.h
    trunk/blender/intern/ghost/intern/GHOST_SystemCarbon.cpp
    trunk/blender/intern/ghost/intern/GHOST_SystemCarbon.h
    trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.h
    trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.mm
    trunk/blender/intern/ghost/intern/GHOST_SystemWin32.cpp
    trunk/blender/intern/ghost/intern/GHOST_SystemWin32.h
    trunk/blender/intern/ghost/intern/GHOST_SystemX11.cpp
    trunk/blender/intern/ghost/intern/GHOST_SystemX11.h
    trunk/blender/intern/ghost/intern/Makefile
    trunk/blender/source/blender/windowmanager/intern/wm_init_exit.c

Added Paths:
-----------
    trunk/blender/intern/ghost/GHOST_ISystemPaths.h
    trunk/blender/intern/ghost/intern/GHOST_ISystemPaths.cpp
    trunk/blender/intern/ghost/intern/GHOST_SystemPaths.h
    trunk/blender/intern/ghost/intern/GHOST_SystemPathsCarbon.cpp
    trunk/blender/intern/ghost/intern/GHOST_SystemPathsCarbon.h
    trunk/blender/intern/ghost/intern/GHOST_SystemPathsCocoa.h
    trunk/blender/intern/ghost/intern/GHOST_SystemPathsCocoa.mm
    trunk/blender/intern/ghost/intern/GHOST_SystemPathsWin32.cpp
    trunk/blender/intern/ghost/intern/GHOST_SystemPathsWin32.h
    trunk/blender/intern/ghost/intern/GHOST_SystemPathsX11.cpp
    trunk/blender/intern/ghost/intern/GHOST_SystemPathsX11.h

Modified: trunk/blender/intern/ghost/CMakeLists.txt
===================================================================
--- trunk/blender/intern/ghost/CMakeLists.txt	2011-01-05 13:15:29 UTC (rev 34095)
+++ trunk/blender/intern/ghost/CMakeLists.txt	2011-01-05 14:00:14 UTC (rev 34096)
@@ -36,10 +36,12 @@
 	intern/GHOST_Buttons.cpp
 	intern/GHOST_CallbackEventConsumer.cpp
 	intern/GHOST_C-api.cpp
+	intern/GHOST_Path-api.cpp
 	intern/GHOST_DisplayManager.cpp
 	intern/GHOST_EventManager.cpp
 	intern/GHOST_EventPrinter.cpp
 	intern/GHOST_ISystem.cpp
+	intern/GHOST_ISystemPaths.cpp
 	intern/GHOST_ModifierKeys.cpp
 	intern/GHOST_NDOFManager.cpp
 	intern/GHOST_Path-api.cpp
@@ -87,20 +89,24 @@
 		list(APPEND SRC
 			intern/GHOST_DisplayManagerCocoa.mm
 			intern/GHOST_SystemCocoa.mm
+			intern/GHOST_SystemPathsCocoa.mm
 			intern/GHOST_WindowCocoa.mm
 			
 			intern/GHOST_DisplayManagerCocoa.h
 			intern/GHOST_SystemCocoa.h
+			intern/GHOST_SystemPathsCocoa.h
 			intern/GHOST_WindowCocoa.h
 		)
 	else()
 		list(APPEND SRC
 			intern/GHOST_DisplayManagerCarbon.cpp
 			intern/GHOST_SystemCarbon.cpp
+			intern/GHOST_SystemPathsCarbon.cpp
 			intern/GHOST_WindowCarbon.cpp
 
 			intern/GHOST_DisplayManagerCarbon.h
 			intern/GHOST_SystemCarbon.h
+			intern/GHOST_SystemPathsCarbon.h
 			intern/GHOST_WindowCarbon.h
 		)
 	endif()
@@ -115,10 +121,12 @@
 	list(APPEND SRC
 		intern/GHOST_DisplayManagerX11.cpp
 		intern/GHOST_SystemX11.cpp
+		intern/GHOST_SystemPathsX11.cpp
 		intern/GHOST_WindowX11.cpp
 
 		intern/GHOST_DisplayManagerX11.h
 		intern/GHOST_SystemX11.h
+		intern/GHOST_SystemPathsX11.h
 		intern/GHOST_WindowX11.h
 	)
 
@@ -134,12 +142,14 @@
 	list(APPEND SRC
 		intern/GHOST_DisplayManagerWin32.cpp
 		intern/GHOST_SystemWin32.cpp
+		intern/GHOST_SystemPathsWin32.cpp
 		intern/GHOST_WindowWin32.cpp
 		intern/GHOST_DropTargetWin32.cpp
 
 		intern/GHOST_DisplayManagerWin32.h
 		intern/GHOST_DropTargetWin32.h
 		intern/GHOST_SystemWin32.h
+		intern/GHOST_SystemPathsWin32.h
 		intern/GHOST_WindowWin32.h
 	)
 endif()

Modified: trunk/blender/intern/ghost/GHOST_C-api.h
===================================================================
--- trunk/blender/intern/ghost/GHOST_C-api.h	2011-01-05 13:15:29 UTC (rev 34095)
+++ trunk/blender/intern/ghost/GHOST_C-api.h	2011-01-05 14:00:14 UTC (rev 34096)
@@ -46,7 +46,6 @@
  * In the API the pointer is casted to the actual C++ class.
  * @param	name	Name of the handle to create.
  */
-#define GHOST_DECLARE_HANDLE(name) typedef struct name##__ { int unused; } *name
 
 GHOST_DECLARE_HANDLE(GHOST_SystemHandle);
 GHOST_DECLARE_HANDLE(GHOST_TimerTaskHandle);

Modified: trunk/blender/intern/ghost/GHOST_ISystem.h
===================================================================
--- trunk/blender/intern/ghost/GHOST_ISystem.h	2011-01-05 13:15:29 UTC (rev 34095)
+++ trunk/blender/intern/ghost/GHOST_ISystem.h	2011-01-05 14:00:14 UTC (rev 34096)
@@ -370,25 +370,7 @@
 	 */
 	virtual void putClipboard(GHOST_TInt8 *buffer, bool selection) const = 0;
 
-		  	/**
-	 * Determine the base dir in which shared resources are located. It will first try to use
-	 * "unpack and run" path, then look for properly installed path, not including versioning.
-	 * @return Unsigned char string pointing to system dir (eg /usr/share/blender/).
-	 */
-	virtual const GHOST_TUns8* getSystemDir() const = 0;
-
-	/**
-	 * Determine the base dir in which user configuration is stored, not including versioning.
-	 * If needed, it will create the base directory.
-	 * @return Unsigned char string pointing to user dir (eg ~/.blender/).
-	 */
-	virtual const GHOST_TUns8* getUserDir() const = 0;
-
-	/**
-	  * Determine the directory of the current binary
-	  * @return Unsigned char string pointing to the binary dir
-	  */
-	 virtual const GHOST_TUns8* getBinaryDir() const = 0;
+	
 protected:
 	/**
 	 * Initialize the system.

Added: trunk/blender/intern/ghost/GHOST_ISystemPaths.h
===================================================================
--- trunk/blender/intern/ghost/GHOST_ISystemPaths.h	                        (rev 0)
+++ trunk/blender/intern/ghost/GHOST_ISystemPaths.h	2011-01-05 14:00:14 UTC (rev 34096)
@@ -0,0 +1,93 @@
+/**
+ * $Id: $
+ *
+ * ***** 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.
+ *
+ * The Original Code is Copyright (C) 2009 Blender Foundation.
+ * All rights reserved.
+ *
+ * 
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+#ifndef _GHOST_ISYSTEMPATHS_H_
+#define _GHOST_ISYSTEMPATHS_H_
+
+#include "GHOST_Types.h"
+
+class GHOST_ISystemPaths
+{
+public:
+	/**
+	 * Creates the one and only system.
+	 * @return An indication of success.
+	 */
+	static GHOST_TSuccess create();
+
+	/**
+	 * Disposes the one and only system.
+	 * @return An indication of success.
+	 */
+	static GHOST_TSuccess dispose();
+
+	/**
+	 * Returns a pointer to the one and only system (nil if it hasn't been created).
+	 * @return A pointer to the system.
+	 */
+	static GHOST_ISystemPaths* get();
+
+protected:
+	/**
+	 * Constructor.
+	 * Protected default constructor to force use of static createSystem member.
+	 */
+	GHOST_ISystemPaths() {}
+
+	/**
+	 * Destructor.
+	 * Protected default constructor to force use of static dispose member.
+	 */
+	virtual ~GHOST_ISystemPaths() {}
+
+public:
+	/**
+	 * Determine the base dir in which shared resources are located. It will first try to use
+	 * "unpack and run" path, then look for properly installed path, not including versioning.
+	 * @return Unsigned char string pointing to system dir (eg /usr/share/blender/).
+	 */
+	virtual const GHOST_TUns8* getSystemDir() const = 0;
+
+	/**
+	 * Determine the base dir in which user configuration is stored, not including versioning.
+	 * If needed, it will create the base directory.
+	 * @return Unsigned char string pointing to user dir (eg ~/.blender/).
+	 */
+	virtual const GHOST_TUns8* getUserDir() const = 0;
+
+	/**
+	  * Determine the directory of the current binary
+	  * @return Unsigned char string pointing to the binary dir
+	  */
+	 virtual const GHOST_TUns8* getBinaryDir() const = 0;
+
+private:
+	/** The one and only system paths*/
+	static GHOST_ISystemPaths* m_systemPaths;
+};
+
+#endif


Property changes on: trunk/blender/intern/ghost/GHOST_ISystemPaths.h
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: trunk/blender/intern/ghost/GHOST_Path-api.h
===================================================================
--- trunk/blender/intern/ghost/GHOST_Path-api.h	2011-01-05 13:15:29 UTC (rev 34095)
+++ trunk/blender/intern/ghost/GHOST_Path-api.h	2011-01-05 14:00:14 UTC (rev 34096)
@@ -36,7 +36,21 @@
 extern "C" { 
 #endif
 
+GHOST_DECLARE_HANDLE(GHOST_SystemPathsHandle);
+
 /**
+ * Creates the one and only instance of the system path access.
+ * @return An indication of success.
+ */
+extern GHOST_TSuccess GHOST_CreateSystemPaths(void);
+
+/**
+ * Disposes the one and only system.
+ * @return An indication of success.
+ */
+extern GHOST_TSuccess GHOST_DisposeSystemPaths(void);
+
+/**
  * Determine the base dir in which shared resources are located. It will first try to use
  * "unpack and run" path, then look for properly installed path, not including versioning.
  * @return Unsigned char string pointing to system dir (eg /usr/share/blender/).

Modified: trunk/blender/intern/ghost/GHOST_Types.h
===================================================================
--- trunk/blender/intern/ghost/GHOST_Types.h	2011-01-05 13:15:29 UTC (rev 34095)
+++ trunk/blender/intern/ghost/GHOST_Types.h	2011-01-05 14:00:14 UTC (rev 34096)
@@ -33,6 +33,8 @@
 #include "MEM_guardedalloc.h"
 #endif
 
+#define GHOST_DECLARE_HANDLE(name) typedef struct name##__ { int unused; } *name
+
 typedef	char				GHOST_TInt8;
 typedef	unsigned char		GHOST_TUns8;
 typedef short				GHOST_TInt16;

Modified: trunk/blender/intern/ghost/SConscript
===================================================================
--- trunk/blender/intern/ghost/SConscript	2011-01-05 13:15:29 UTC (rev 34095)
+++ trunk/blender/intern/ghost/SConscript	2011-01-05 14:00:14 UTC (rev 34096)
@@ -11,7 +11,7 @@
     sources += env.Glob('intern/*.mm')
 
 
-pf = ['GHOST_DisplayManager', 'GHOST_System', 'GHOST_Window', 'GHOST_DropTarget']
+pf = ['GHOST_DisplayManager', 'GHOST_System', 'GHOST_SystemPaths', 'GHOST_Window', 'GHOST_DropTarget']
 defs=['_USE_MATH_DEFINES']
 
 if window_system in ('linux2', 'openbsd3', 'sunos5', 'freebsd7', 'freebsd8', 'freebsd9', 'irix6', 'aix4', 'aix5'):

Added: trunk/blender/intern/ghost/intern/GHOST_ISystemPaths.cpp
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_ISystemPaths.cpp	                        (rev 0)
+++ trunk/blender/intern/ghost/intern/GHOST_ISystemPaths.cpp	2011-01-05 14:00:14 UTC (rev 34096)
@@ -0,0 +1,104 @@
+/**
+ * $Id: GHOST_ISystem.cpp 28254 2010-04-18 10:28:37Z campbellbarton $
+ * ***** 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.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list