Commits

Shankar Giri  committed e653a6a Merge

Merge from Ogitor parent fork

  • Participants
  • Parent commits 0b9c787, 2f7ae6c

Comments (0)

Files changed (70)

File CMakeLists.txt

 message(STATUS "OGITOR_DIST is set to ${OGITOR_DIST}")
 
 # Handle install prefix
+# On Linux can't change global install prefix to anything but /usr/local
 if(WIN32)
     if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
         set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/RunPath" CACHE PATH "Ogitor install prefix" FORCE)
 else(WIN32)
     if(NOT OGITOR_DIST)
         set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/RunPath" CACHE PATH "Ogitor install prefix" FORCE)
+    else(NOT OGITOR_DIST)
+        if(NOT CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
+            set(CMAKE_INSTALL_PREFIX "/usr/local" CACHE PATH "Ogitor install prefix" FORCE)
+        endif (NOT CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
     endif(NOT OGITOR_DIST)
 endif(WIN32)
 
 endif(WIN32)
 
 if(MSVC80 OR MSVC90 OR MSVC10)
-	# Option is to enable the /MP switch for Visual Studio 2005 or later
-	option(OGITOR_MSVC_ENABLE_MP
-		"Set to ON to build Ogitor with the /MP option (Visual Studio 2005 and above)." ON)
-	mark_as_advanced(OGITOR_MSVC_ENABLE_MP)
-	if(OGITOR_MSVC_ENABLE_MP)
-		set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
-	endif(OGITOR_MSVC_ENABLE_MP)
-	message(STATUS "Setting Visual Studio 2005+ option /MP to ${OGITOR_MSVC_ENABLE_MP}")
-	add_definitions(-D_SCL_SECURE_NO_WARNINGS)
-	add_definitions(-D_CRT_SECURE_NO_WARNINGS)
-	add_definitions(-DNOMINMAX)
+        # Option is to enable the /MP switch for Visual Studio 2005 or later
+        option(OGITOR_MSVC_ENABLE_MP
+                "Set to ON to build Ogitor with the /MP option (Visual Studio 2005 and above)." ON)
+        mark_as_advanced(OGITOR_MSVC_ENABLE_MP)
+        if(OGITOR_MSVC_ENABLE_MP)
+                set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
+        endif(OGITOR_MSVC_ENABLE_MP)
+        message(STATUS "Setting Visual Studio 2005+ option /MP to ${OGITOR_MSVC_ENABLE_MP}")
+        add_definitions(-D_SCL_SECURE_NO_WARNINGS)
+        add_definitions(-D_CRT_SECURE_NO_WARNINGS)
+        add_definitions(-DNOMINMAX)
 endif(MSVC80 OR MSVC90 OR MSVC10)
 
 set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/;${CMAKE_MODULE_PATH}")
 
 # Ogitor
 set(OGITOR_INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}/Ogitor/include")
-set(OGITOR_LIBPATH	"${CMAKE_CURRENT_SOURCE_DIR}/Ogitor/lib")
+set(OGITOR_LIBPATH      "${CMAKE_CURRENT_SOURCE_DIR}/Ogitor/lib")
 
 # Dependencies
 set(DEPENDENCIES_INCLUDES
 if(UNIX)
     set(DBG_POSTFIX "")
     if(OGITOR_DIST)
-        set(OGITOR_BIN_PATH "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Ogitor bin path")
-        set(OGITOR_RUN_PATH "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Ogitor run path")
-        set(OGITOR_RESOURCE_PATH "${CMAKE_INSTALL_PREFIX}/share/ogitor" CACHE PATH "Ogitor resource path")
-        set(OGITOR_LANGUAGE_PATH "${CMAKE_INSTALL_PREFIX}/share/ogitor/languages" CACHE PATH "Ogitor languages path")
-        set(OGITOR_MEDIA_PATH "${CMAKE_INSTALL_PREFIX}/share/ogitor/Media" CACHE PATH "Ogitor media path")
-        set(OGITOR_PROJECTS_PATH "${CMAKE_INSTALL_PREFIX}/Projects" CACHE PATH "Ogitor Projects path")
-        set(OGITOR_SCRIPTS_PATH "${CMAKE_INSTALL_PREFIX}/share/ogitor/Scripts" CACHE PATH "Ogitor scripts path")
-        set(OGITOR_PLUGIN_PATH "${CMAKE_INSTALL_PREFIX}/lib/ogitor" CACHE PATH "Ogitor plugins path")
-        set(OGITOR_PLUGIN_ICON_PATH "${CMAKE_INSTALL_PREFIX}/share/ogitor/Plugins/Icons" CACHE PATH "Ogitor plugins icon path")
-        set(OGITOR_OGRE_PLUGIN_PATH "${OGRE_PLUGIN_DIR_LINUX}" CACHE PATH "Ogre plugins path")
-        set(OGITOR_LIBOGREOFSPLUGIN_PATH "${OGRE_PLUGIN_DIR_LINUX}" CACHE PATH "libOgreOfsPlugin path")
+        set(OGITOR_BIN_PATH "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Ogitor bin path" FORCE)
+        set(OGITOR_RUN_PATH "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Ogitor run path" FORCE)
+        set(OGITOR_RESOURCE_PATH "${CMAKE_INSTALL_PREFIX}/share/ogitor" CACHE PATH "Ogitor resource path" FORCE)
+        set(OGITOR_LANGUAGE_PATH "${CMAKE_INSTALL_PREFIX}/share/ogitor/languages" CACHE PATH "Ogitor languages path" FORCE)
+        set(OGITOR_MEDIA_PATH "${CMAKE_INSTALL_PREFIX}/share/ogitor/Media" CACHE PATH "Ogitor media path" FORCE)
+        set(OGITOR_PROJECTS_PATH "${CMAKE_INSTALL_PREFIX}/Projects" CACHE PATH "Ogitor Projects path" FORCE)
+        set(OGITOR_SCRIPTS_PATH "${CMAKE_INSTALL_PREFIX}/share/ogitor/Scripts" CACHE PATH "Ogitor scripts path" FORCE)
+        set(OGITOR_PLUGIN_PATH "${CMAKE_INSTALL_PREFIX}/lib/ogitor" CACHE PATH "Ogitor plugins path" FORCE)
+        set(OGITOR_PLUGIN_ICON_PATH "${CMAKE_INSTALL_PREFIX}/share/ogitor/Plugins/Icons" CACHE PATH "Ogitor plugins icon path" FORCE)
+        set(OGITOR_OGRE_PLUGIN_PATH "${OGRE_PLUGIN_DIR_LINUX}" CACHE PATH "Ogre plugins path" FORCE)
+        set(OGITOR_LIBOGREOFSPLUGIN_PATH "${OGRE_PLUGIN_DIR_LINUX}" CACHE PATH "libOgreOfsPlugin path" FORCE)
     else(OGITOR_DIST)
         # Doing local install
-        set(OGITOR_BIN_PATH "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Ogitor bin path")
-        set(OGITOR_RUN_PATH "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Ogitor run path")
-        set(OGITOR_RESOURCE_PATH "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Ogitor resource path")
-        set(OGITOR_LANGUAGE_PATH "${CMAKE_INSTALL_PREFIX}/share/ogitor/languages" CACHE PATH "Ogitor languages path")
-        set(OGITOR_MEDIA_PATH "${CMAKE_INSTALL_PREFIX}/share/ogitor/Media" CACHE PATH "Ogitor media path")
-        set(OGITOR_PROJECTS_PATH "${CMAKE_INSTALL_PREFIX}/Projects" CACHE PATH "Ogitor Projects path")
-        set(OGITOR_SCRIPTS_PATH "${CMAKE_INSTALL_PREFIX}/share/ogitor/Scripts" CACHE PATH "Ogitor scripts path")
-        set(OGITOR_PLUGIN_PATH "${CMAKE_INSTALL_PREFIX}/Plugins" CACHE PATH "Ogitor plugins path")
-        set(OGITOR_PLUGIN_ICON_PATH "${CMAKE_INSTALL_PREFIX}/share/ogitor/Plugins/Icons" CACHE PATH "Ogitor plugins icon path")
-        set(OGITOR_OGRE_PLUGIN_PATH "${OGRE_PLUGIN_DIR_LINUX}" CACHE PATH "Ogre plugins path")
-        set(OGITOR_LIBOGREOFSPLUGIN_PATH "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "libOgreOfsPlugin path")
+        set(OGITOR_BIN_PATH "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Ogitor bin path" FORCE)
+        set(OGITOR_RUN_PATH "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Ogitor run path" FORCE)
+        set(OGITOR_RESOURCE_PATH "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Ogitor resource path" FORCE)
+        set(OGITOR_LANGUAGE_PATH "${CMAKE_INSTALL_PREFIX}/share/ogitor/languages" CACHE PATH "Ogitor languages path" FORCE)
+        set(OGITOR_MEDIA_PATH "${CMAKE_INSTALL_PREFIX}/share/ogitor/Media" CACHE PATH "Ogitor media path" FORCE)
+        set(OGITOR_PROJECTS_PATH "${CMAKE_INSTALL_PREFIX}/Projects" CACHE PATH "Ogitor Projects path" FORCE)
+        set(OGITOR_SCRIPTS_PATH "${CMAKE_INSTALL_PREFIX}/share/ogitor/Scripts" CACHE PATH "Ogitor scripts path" FORCE)
+        set(OGITOR_PLUGIN_PATH "${CMAKE_INSTALL_PREFIX}/Plugins" CACHE PATH "Ogitor plugins path" FORCE)
+        set(OGITOR_PLUGIN_ICON_PATH "${CMAKE_INSTALL_PREFIX}/share/ogitor/Plugins/Icons" CACHE PATH "Ogitor plugins icon path" FORCE)
+        set(OGITOR_OGRE_PLUGIN_PATH "${OGRE_PLUGIN_DIR_LINUX}" CACHE PATH "Ogre plugins path" FORCE)
+        set(OGITOR_LIBOGREOFSPLUGIN_PATH "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "libOgreOfsPlugin path" FORCE)
     endif(OGITOR_DIST)
     configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/Templates/plugins.cfg.in ${OGITOR_WORK_DIR}/RunPath/bin/plugins.cfg)
     configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/Templates/resources.cfg.in ${OGITOR_WORK_DIR}/RunPath/bin/resources.cfg)
 else(UNIX)
     # We are on Windows
-    set(OGITOR_BIN_PATH "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Ogitor bin path")
-    set(OGITOR_RUN_PATH "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Ogitor run path")
-    set(OGITOR_RESOURCE_PATH "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Ogitor resource path")
-    set(OGITOR_LANGUAGE_PATH "${CMAKE_INSTALL_PREFIX}/languages" CACHE PATH "Ogitor languages path")
-    set(OGITOR_MEDIA_PATH "${CMAKE_INSTALL_PREFIX}/Media" CACHE PATH "Ogitor media path")
-    set(OGITOR_PROJECTS_PATH "${CMAKE_INSTALL_PREFIX}/Projects" CACHE PATH "Ogitor Projects path")
-    set(OGITOR_SCRIPTS_PATH "${CMAKE_INSTALL_PREFIX}/Scripts" CACHE PATH "Ogitor scripts path")
-    set(OGITOR_PLUGIN_PATH "${CMAKE_INSTALL_PREFIX}/Plugins" CACHE PATH "Ogitor plugins path")
-    set(OGITOR_PLUGIN_ICON_PATH "${CMAKE_INSTALL_PREFIX}/Plugins/Icons" CACHE PATH "Ogitor plugins icon path")
-    set(OGITOR_OGRE_PLUGIN_PATH "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Ogre plugins path")
-    set(OGITOR_LIBOGREOFSPLUGIN_PATH "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "libOgreOfsPlugin path")
+    set(OGITOR_BIN_PATH "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Ogitor bin path" FORCE)
+    set(OGITOR_RUN_PATH "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Ogitor run path" FORCE)
+    set(OGITOR_RESOURCE_PATH "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Ogitor resource path" FORCE)
+    set(OGITOR_LANGUAGE_PATH "${CMAKE_INSTALL_PREFIX}/languages" CACHE PATH "Ogitor languages path" FORCE)
+    set(OGITOR_MEDIA_PATH "${CMAKE_INSTALL_PREFIX}/Media" CACHE PATH "Ogitor media path" FORCE)
+    set(OGITOR_PROJECTS_PATH "${CMAKE_INSTALL_PREFIX}/Projects" CACHE PATH "Ogitor Projects path" FORCE)
+    set(OGITOR_SCRIPTS_PATH "${CMAKE_INSTALL_PREFIX}/Scripts" CACHE PATH "Ogitor scripts path" FORCE)
+    set(OGITOR_PLUGIN_PATH "${CMAKE_INSTALL_PREFIX}/Plugins" CACHE PATH "Ogitor plugins path" FORCE)
+    set(OGITOR_PLUGIN_ICON_PATH "${CMAKE_INSTALL_PREFIX}/Plugins/Icons" CACHE PATH "Ogitor plugins icon path" FORCE)
+    set(OGITOR_OGRE_PLUGIN_PATH "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Ogre plugins path" FORCE)
+    set(OGITOR_LIBOGREOFSPLUGIN_PATH "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "libOgreOfsPlugin path" FORCE)
 endif(UNIX)
 
 # hide advanced options
     OGITOR_LIBOGREOFSPLUGIN_PATH
 )
 
-# Error ouot if old Media folder is detected
+# Error out if old Media folder is detected
 if(UNIX AND NOT APPLE AND IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/RunPath/Media/EditorResources)
   message(SEND_ERROR "An old version of the Media folder was detected in: ${CMAKE_CURRENT_SOURCE_DIR}/RunPath .\nMake sure that you've downloaded the latest version of 'media.zip' from Ogitor.org and extracted it into ${CMAKE_CURRENT_SOURCE_DIR}/RunPath as 'Media'.")
 endif()
 add_subdirectory(Plugins/OgAngelScript)
 add_subdirectory(Plugins/OgScriptEditor)
 add_subdirectory(Plugins/OgAngelDialogManager)
+#add_subdirectory(Plugins/OgQtExample)
 
 add_subdirectory(OgreOfsPlugin)
 
 
 add_subdirectory(qtOfs)
 
-add_subdirectory(SceneLoader)
+# New version of OIS broke our SceneLoader..
+if(NOT UNIX)
+    add_subdirectory(SceneLoader)
+endif(NOT UNIX)
 
 add_subdirectory(RunPath)
 
 
 
 if(WIN32)
-    install(FILES ${OGRE_PLUGIN_DIR_REL}/OgreMain.dll
+	# SDK : main libs - debug
+	install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib/Debug
+		DESTINATION ${PREFIX}/sdk/lib
+		CONFIGURATIONS Debug
+	)
+	# SDK : main libs - release
+	install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib/Release
+		DESTINATION ${PREFIX}/sdk/lib
+		CONFIGURATIONS Release RelWithDebInfo MinSizeRel
+	)
+	# SDK : Ogitor includes
+	install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Ogitor/include
+		DESTINATION ${PREFIX}/sdk
+		CONFIGURATIONS Debug Release RelWithDebInfo MinSizeRel
+	)
+	# SDK : Dependencies libs
+	install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Dependencies/lib
+		DESTINATION ${PREFIX}/sdk/dependencies
+		CONFIGURATIONS Debug Release RelWithDebInfo MinSizeRel
+	)
+	# SDK: OFS headers
+	FILE(GLOB ofs_headers "${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/OFS/include/*.h")
+	install(FILES ${ofs_headers}
+		DESTINATION ${PREFIX}/sdk/dependencies/include/OFS
+		CONFIGURATIONS Debug Release RelWithDebInfo MinSizeRel
+	)
+	# SDK: GenericImageEditor headers
+	FILE(GLOB GenericImageEditor_headers "${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/GenericImageEditor/include/*.hxx")
+	install(FILES ${GenericImageEditor_headers}
+		DESTINATION ${PREFIX}/sdk/dependencies/include/GenericImageEditor
+		CONFIGURATIONS Debug Release RelWithDebInfo MinSizeRel
+	)
+	# SDK: GenericTextEditor headers
+	FILE(GLOB GenericTextEditor_headers "${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/GenericTextEditor/include/*.hxx")
+	install(FILES ${GenericTextEditor_headers}
+		DESTINATION ${PREFIX}/sdk/dependencies/include/GenericTextEditor
+		CONFIGURATIONS Debug Release RelWithDebInfo MinSizeRel
+	)
+	# SDK: Hydrax headers
+	install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/HYDRAX/Hydrax/src/Hydrax
+		DESTINATION ${PREFIX}/sdk/dependencies/include
+		CONFIGURATIONS Debug Release RelWithDebInfo MinSizeRel
+		PATTERN "*.cpp" EXCLUDE
+		PATTERN "CMakeLists.txt" EXCLUDE
+	)
+	# SDK: SkyX headers
+	install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/SkyX
+		DESTINATION ${PREFIX}/sdk/dependencies/include
+		CONFIGURATIONS Debug Release RelWithDebInfo MinSizeRel
+		PATTERN "*.cpp" EXCLUDE
+		PATTERN "CMakeLists.txt" EXCLUDE
+	)
+	# SDK: PagedGeometry headers
+	FILE(GLOB pg_headers "${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/PagedGeometry/include/*.h")
+	install(FILES ${pg_headers}
+		DESTINATION ${PREFIX}/sdk/dependencies/include/OFS
+		CONFIGURATIONS Debug Release RelWithDebInfo MinSizeRel
+	)
+	# SDK: Angelscript headers
+	FILE(GLOB angelscript_headers "${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/Angelscript/include/*.h")
+	install(FILES ${angelscript_headers}
+		DESTINATION ${PREFIX}/sdk/dependencies/include/Angelscript
+		CONFIGURATIONS Debug Release RelWithDebInfo MinSizeRel
+	)
+	install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/Angelscript/add_on
+		DESTINATION ${PREFIX}/sdk/dependencies/include/Angelscript
+		CONFIGURATIONS Debug Release RelWithDebInfo MinSizeRel
+		PATTERN "*.cpp" EXCLUDE
+		PATTERN "*.dsp" EXCLUDE
+		PATTERN "*.dsw" EXCLUDE
+		PATTERN "*.asm" EXCLUDE
+		PATTERN "*.txt" EXCLUDE
+		PATTERN "CMakeLists.txt" EXCLUDE
+	)
+	# SDK: Caelum headers
+	FILE(GLOB caelum_headers "${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/Caelum-0.5.0/main/include/*.h")
+	install(FILES ${caelum_headers}
+		DESTINATION ${PREFIX}/sdk/dependencies/include/Caelum-0.5.0
+		CONFIGURATIONS Debug Release RelWithDebInfo MinSizeRel
+	)
+	
+	# TODO: MeshMagick
+	# TODO: lua
+	# TODO: PythonQt
+	
+    # Ogre DLLs
+	install(FILES ${OGRE_PLUGIN_DIR_REL}/OgreMain.dll
         ${OGRE_PLUGIN_DIR_REL}/RenderSystem_Direct3D9.dll
         ${OGRE_PLUGIN_DIR_REL}/RenderSystem_GL.dll
         ${OGRE_PLUGIN_DIR_REL}/Plugin_OctreeSceneManager.dll
 
 endif(WIN32)
 
+if(UNIX)
+    # SDK : Ogitor includes
+    FILE(GLOB ogitor_headers
+"${CMAKE_CURRENT_SOURCE_DIR}/Ogitor/include/*.h")
+    install(FILES ${ogitor_headers}
+        DESTINATION
+${CMAKE_INSTALL_PREFIX}/include/ogitor
+        CONFIGURATIONS Debug Release RelWithDebInfo MinSizeRel
+    )
+    # SDK: OFS headers
+    FILE(GLOB ofs_headers
+"${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/OFS/include/*.h")
+    install(FILES ${ofs_headers}
+        DESTINATION
+${CMAKE_INSTALL_PREFIX}/include/ogitor/dependencies/OFS
+        CONFIGURATIONS Debug Release RelWithDebInfo MinSizeRel
+    )
+    # SDK: GenericImageEditor headers
+    FILE(GLOB GenericImageEditor_headers
+"${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/GenericImageEditor/include/*.hxx")
+    install(FILES ${GenericImageEditor_headers}
+        DESTINATION
+${CMAKE_INSTALL_PREFIX}/include/ogitor/dependencies/GenericImageEditor
+        CONFIGURATIONS Debug Release RelWithDebInfo MinSizeRel
+    )
+    # SDK: GenericTextEditor headers
+    FILE(GLOB GenericTextEditor_headers
+"${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/GenericTextEditor/include/*.hxx")
+    install(FILES ${GenericTextEditor_headers}
+        DESTINATION
+${CMAKE_INSTALL_PREFIX}/include/ogitor/dependencies/GenericTextEditor
+        CONFIGURATIONS Debug Release RelWithDebInfo MinSizeRel
+    )
+    # SDK: Hydrax headers
+    install(DIRECTORY
+${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/HYDRAX/Hydrax/src/Hydrax
+        DESTINATION ${CMAKE_INSTALL_PREFIX}/include/ogitor/dependencies
+        CONFIGURATIONS Debug Release RelWithDebInfo MinSizeRel
+        PATTERN "*.cpp" EXCLUDE
+        PATTERN "CMakeLists.txt" EXCLUDE
+    )
+    # SDK: SkyX headers
+    install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/SkyX
+        DESTINATION ${CMAKE_INSTALL_PREFIX}/include/ogitor/dependencies
+        CONFIGURATIONS Debug Release RelWithDebInfo MinSizeRel
+        PATTERN "*.cpp" EXCLUDE
+        PATTERN "CMakeLists.txt" EXCLUDE
+    )
+    # SDK: PagedGeometry headers
+    FILE(GLOB pg_headers
+"${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/PagedGeometry/include/*.h")
+    install(FILES ${pg_headers}
+        DESTINATION
+${CMAKE_INSTALL_PREFIX}/include/ogitor/dependencies/PagedGeometry
+        CONFIGURATIONS Debug Release RelWithDebInfo MinSizeRel
+    )
+    # SDK: Angelscript headers
+    FILE(GLOB angelscript_headers
+"${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/Angelscript/include/*.h")
+    install(FILES ${angelscript_headers}
+        DESTINATION
+${CMAKE_INSTALL_PREFIX}/include/ogitor/dependencies/Angelscript
+        CONFIGURATIONS Debug Release RelWithDebInfo MinSizeRel
+    )
+    install(DIRECTORY
+${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/Angelscript/add_on
+        DESTINATION
+${CMAKE_INSTALL_PREFIX}/include/ogitor/dependencies/Angelscript
+        CONFIGURATIONS Debug Release RelWithDebInfo MinSizeRel
+        PATTERN "*.cpp" EXCLUDE
+        PATTERN "*.dsp" EXCLUDE
+        PATTERN "*.dsw" EXCLUDE
+        PATTERN "*.asm" EXCLUDE
+        PATTERN "*.txt" EXCLUDE
+        PATTERN "CMakeLists.txt" EXCLUDE
+    )
+    # SDK: Caelum headers
+    FILE(GLOB caelum_headers
+"${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/Caelum-0.5.0/main/include/*.h")
+    install(FILES ${caelum_headers}
+        DESTINATION
+${CMAKE_INSTALL_PREFIX}/include/ogitor/dependencies/Caelum-0.5.0
+        CONFIGURATIONS Debug Release RelWithDebInfo MinSizeRel
+    )
+
+    # TODO: MeshMagick
+    # TODO: lua
+    # TODO: PythonQt
+
+endif(UNIX)
+
 # uninstall target
 configure_file(
     "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"

File CMakeModules/FindOGITOR.cmake

+######################################################################
+# OGITOR BUILD SYSTEM
+# Welcome to the CMake build system for OGITOR.
+# This is the main file where we prepare the general build environment
+# and provide build configuration options.
+######################################################################
+
+# - Try to find Ogitor
+# Once done, this will define
+#
+#  OGITOR_FOUND - system has Ogitor
+#  OGITOR_INCLUDE_DIRS - the Ogitor include directories
+#  OGITOR_LIBRARIES - link these to use Ogitor
+
+include(FindPkgMacros)
+include(PreprocessorUtils)
+findpkg_begin(OGITOR)
+
+# Get path, convert backslashes as ${ENV_${var}}
+getenv_path(OGITOR_HOME)
+
+# construct search paths
+set(OGITOR_PREFIX_PATH ${OGITOR_HOME} ${ENV_OGITOR_HOME} /usr/local /usr/local/include /usr/local/lib /usr/include /usr/lib /usr/local/include/ogitor /usr/include/ogitor /usr/lib/ogitor /usr/local/lib/ogitor)
+create_search_paths(OGITOR)
+# redo search if prefix path changed
+clear_if_changed(OGITOR_PREFIX_PATH
+  OGITOR_LIBRARY_REL
+  OGITOR_LIBRARY_DBG
+  OGITOR_INCLUDE_DIR
+  OGITOR_LIBRARIES
+  )
+
+set(OGITOR_LIBRARY_NAMES Ogitor)
+get_debug_names(OGITOR_LIBRARY_NAMES)
+
+use_pkgconfig(OGITOR_PKGC OGITOR)
+
+findpkg_framework(OGITOR)
+
+find_path(OGITOR_INCLUDE_DIR NAMES Ogitors.h HINTS ${OGITOR_INC_SEARCH_PATH} ${OGITOR_PKGC_INCLUDE_DIRS} PATH_SUFFIXES Ogitor)
+find_library(OGITOR_LIBRARY_REL NAMES ${OGITOR_LIBRARY_NAMES} HINTS ${OGITOR_LIB_SEARCH_PATH} ${OGITOR_PKGC_LIBRARY_DIRS} PATH_SUFFIXES "" release relwithdebinfo minsizerel)
+find_library(OGITOR_LIBRARY_DBG NAMES ${OGITOR_LIBRARY_NAMES_DBG} HINTS ${OGITOR_LIB_SEARCH_PATH} ${OGITOR_PKGC_LIBRARY_DIRS} PATH_SUFFIXES "" debug)
+make_library_set(OGITOR_LIBRARY)
+
+if(OGITOR_INCLUDE_DIR AND OGITOR_LIBRARY_REL AND OGITOR_LIBRARY_DBG)
+	set(OGITOR_FOUND TRUE)
+endif(OGITOR_INCLUDE_DIR AND OGITOR_LIBRARY_REL AND OGITOR_LIBRARY_DBG)
+set(OGITOR_LIBRARIES optimized ${OGITOR_LIBRARY_REL} debug ${OGITOR_LIBRARY_DBG})
+set(OGITOR_LIBRARIES ${OGITOR_LIBRARIES} CACHE STRING "Ogitor libraries")
+set(OGITOR_INCLUDE_DIRS ${OGITOR_INCLUDE_DIR})
+
+findpkg_finish(OGITOR)
+
+add_parent_dir(OGITOR_INCLUDE_DIRS OGITOR_INCLUDE_DIR)
+set(OGITOR_DEPENDENCY_INCLUDE_DIR "${OGITOR_INCLUDE_DIRS}/dependencies/include" CACHE STRING "Ogitor dependency include dir")
+set(OGITOR_DEPENDENCY_LIB_DIR "${OGITOR_INCLUDE_DIRS}/dependencies/lib" CACHE STRING "Ogitor dependency library dir")
+
+# Dependencies
+set(OGITOR_DEPENDENCIES_INCLUDES
+    "${OGITOR_DEPENDENCY_INCLUDE_DIR}/PagedGeometry"
+    "${OGITOR_DEPENDENCY_INCLUDE_DIR}/Caelum-0.5.0/main"
+    "${OGITOR_DEPENDENCY_INCLUDE_DIR}/HYDRAX/Hydrax/src/Hydrax"
+    "${OGITOR_DEPENDENCY_INCLUDE_DIR}/SkyX"
+    "${OGITOR_DEPENDENCY_INCLUDE_DIR}/MeshMagick"
+    "${OGITOR_DEPENDENCY_INCLUDE_DIR}/Angelscript"
+    #"${OGITOR_DEPENDENCY_INCLUDE_DIR}/lua/src"
+    "${OGITOR_DEPENDENCY_INCLUDE_DIR}/Angelscript/add_on/autowrapper"
+    "${OGITOR_DEPENDENCY_INCLUDE_DIR}/Angelscript/add_on/scriptbuilder"
+    "${OGITOR_DEPENDENCY_INCLUDE_DIR}/Angelscript/add_on/scriptstdstring"
+    "${OGITOR_DEPENDENCY_INCLUDE_DIR}/Angelscript/add_on/scriptmath"
+    "${OGITOR_DEPENDENCY_INCLUDE_DIR}/Angelscript/add_on/scriptarray"
+    "${OGITOR_DEPENDENCY_INCLUDE_DIR}/Angelscript/add_on/quaternion"
+    "${OGITOR_DEPENDENCY_INCLUDE_DIR}/Angelscript/add_on/vector3"
+    "${OGITOR_DEPENDENCY_INCLUDE_DIR}/Angelscript/add_on/debugger"
+    "${OGITOR_DEPENDENCY_INCLUDE_DIR}/OFS"
+    "${OGITOR_DEPENDENCY_INCLUDE_DIR}/GenericTextEditor"
+    "${OGITOR_DEPENDENCY_INCLUDE_DIR}/GenericImageEditor"
+    )
+	set(OGITOR_DEPENDENCIES_INCLUDES ${OGITOR_DEPENDENCIES_INCLUDES} CACHE STRING "Ogitor dependency includes")
+message(STATUS "${OGITOR_DEPENDENCIES_INCLUDES} OGITOR_DEPENDENCIES_INCLUDES.")
+message(STATUS "${OGITOR_DEPENDENCY_INCLUDE_DIR} OGITOR_DEPENDENCY_INCLUDE_DIR.")
+message(STATUS "${OGITOR_DEPENDENCY_LIB_DIR} OGITOR_DEPENDENCY_LIB_DIR.")

File Dependencies/GenericImageEditor/CMakeLists.txt

 
     if(UNIX AND NOT APPLE)
         add_custom_command(TARGET GenericImageEditor PRE_BUILD
-            COMMAND mkdir -p ../../RunPath/bin)
+            COMMAND mkdir -p ../../RunPath/lib)
         add_custom_command(TARGET GenericImageEditor POST_BUILD
-            COMMAND cp -r ../lib/libGenericImageEditor_Ogitor.* ../../RunPath/bin/)
+            COMMAND cp -r ../lib/libGenericImageEditor_Ogitor.*
+../../RunPath/lib/)
     endif(UNIX AND NOT APPLE)
 
     if(WIN32)

File Dependencies/GenericTextEditor/CMakeLists.txt

 
     if(UNIX AND NOT APPLE)
         add_custom_command(TARGET GenericTextEditor PRE_BUILD
-            COMMAND mkdir -p ../../RunPath/bin)
+            COMMAND mkdir -p ../../RunPath/lib)
         add_custom_command(TARGET GenericTextEditor POST_BUILD
-            COMMAND cp -r ../lib/libGenericTextEditor_Ogitor.* ../../RunPath/bin/)
+            COMMAND cp -r ../lib/libGenericTextEditor_Ogitor.*
+../../RunPath/lib/)
     endif(UNIX AND NOT APPLE)
 
     if(WIN32)

File Dependencies/OFS/CMakeLists.txt

 
     install(TARGETS OFS
         LIBRARY DESTINATION lib
-        CONFIGURATIONS Release RelWithDebInfo MinSizeRel)
+        CONFIGURATIONS Debug Release RelWithDebInfo MinSizeRel)
 
 ENDIF(UNIX AND NOT APPLE)
 

File Ogitor/include/OgitorsDefinitions.h

         ETYPE_SKY_MANAGER,      /** Sky manager editor type */
         ETYPE_LIGHT,            /** Light editor type */
         ETYPE_TERRAIN_MANAGER,  /** Terrain manager editor type */
-        ETYPE_WATER_MANAGER,    /** Terrain manager editor type */
+        ETYPE_WATER_MANAGER,    /** Water manager editor type */
         ETYPE_CUSTOM_MANAGER,   /** Custom manager editor type */
         ETYPE_CAMERA,           /** Camera editor type */
         ETYPE_ENTITY,           /** Entity editor type */
         ETYPE_GENERALPURPOSE,   /** General editor type */
         ETYPE_MULTISEL,         /** Multi-selection editor type */
         ETYPE_MATERIAL,         /** Material editor type */
-        ETYPE_TECHNIQUE         /** Technique editor type */
+        ETYPE_TECHNIQUE,        /** Technique editor type */
+        ETYPE_TERRAIN_PAGE      /** Terrain Page editor type */
     };
 
     /** String'ified EDITORTYPE enumeration @see EDITORTYPE */
         "ETYPE_GENERALPURPOSE", /** String'ification of EDITORTYPE::ETYPE_GENERALPURPOSE */
         "ETYPE_MULTISEL",       /** String'ification of EDITORTYPE::ETYPE_MULTISEL */
         "ETYPE_MATERIAL",       /** String'ification of EDITORTYPE::ETYPE_MATERIAL */
-        "ETYPE_TECHNIQUE"       /** String'ification of EDITORTYPE::ETYPE_TECHNIQUE */
+        "ETYPE_TECHNIQUE",      /** String'ification of EDITORTYPE::ETYPE_TECHNIQUE */
+        "ETYPE_TERRAIN_PAGE"    /** String'ification of EDITORTYPE::ETYPE_TERRAIN_PAGE */
     };
     /** Last unique ID for an editor */
-    const unsigned int LAST_EDITOR = ETYPE_MULTISEL + 1;
+    const unsigned int LAST_EDITOR = ETYPE_TERRAIN_PAGE + 1;
 
     typedef Ogre::vector<Ogre::UTFString>::type UTFStringVector;
 

File Ogitor/include/OgitorsProperty.h

 
     /** A simple structure designed just as a holder of property values between
     the instances of objects they might target. There is just enough information
-    here to be able to interpret the results accurately but no more.
+    here to be able to interpret the results accurately and store the original
+    for potential later use, but no more.
     */
     struct OgitorsPropertyValue : public Ogre::GeneralAllocatedObject
     {
         OgitorsPropertyType propType;
         Ogre::Any val;
+        Ogre::String origVal;
 
         OgitorsPropertyValue() : propType(PROP_UNKNOWN)
         {
         {
             OgitorsPropertyValue propVal;
             propVal.propType = type;
+            propVal.origVal = value;
 
             switch(type)
             {
             case PROP_SHORT:
-                propVal.val = Ogre::Any((short)Ogre::StringConverter::parseInt(value));break;
+                propVal.val =  Ogre::Any((short)Ogre::StringConverter::parseInt(value));break;
             case PROP_UNSIGNED_SHORT:
                 propVal.val =  Ogre::Any((unsigned short)Ogre::StringConverter::parseUnsignedInt(value));break;
             case PROP_INT:
         */
         void setValueMap(const OgitorsPropertyValueMap& values);
 
-        /** Inits the current state from a given value map.
+        /** Init the current state from a given value map.
         */
-        void initValueMap(const OgitorsPropertyValueMap& values);
+        void initValueMap(OgitorsPropertyValueMap& values);
 
         /** Get a named property value. 
         */
         */
         void removeListener(OgitorsPropertySetListener* listener);
 
+        /** Convert an property value to another type, e.g. needed if between
+        *   Ogitor runs, the property types of an editor have been changed
+        */
+        void changePropertyType(OgitorsPropertyValue* currentValue, OgitorsPropertyType targetType);
+
         void _addRef() { ++mRefCount; }
 
         void _release() { --mRefCount; }

File Ogitor/include/OgitorsUtils.h

         */
         static void ParseUTFStringVector(Ogre::UTFString &str, UTFStringVector &list);
         /**
-        * Cleans a path of un-needed characters/symbols
+        * Cleans a path of unneeded characters/symbols
         * @param path to be cleaned
         */
         static void CleanPath(Ogre::String &path);
         static void GetMeshDataEx(const Ogre::Entity *entity, size_t &vertex_count, size_t &index_count,
                                 const Ogre::Vector3 &position, const Ogre::Quaternion &orient, const Ogre::Vector3 &scale);
         /**
-        * Makes a sphere query at object's origin with a given raidus
+        * Makes a sphere query at object's origin with a given radius
         * @param object the object around which to make sphere query
-        * @param radius raidus of the query
+        * @param radius radius of the query
         * @param results the list of objects returned by query
         */
         static void SphereQuery(CBaseEditor *object, Ogre::Real radius, ObjectVector &results);
         */
         static Ogre::String GetValueString(OgitorsPropertyValue& value);
         /**
-        * Returns a string containing xml structure ofa custom property set
-        * @param set the set that will be used to create xml structure
+        * Returns a string containing XML structure of a custom property set
+        * @param set the set that will be used to create XML structure
         * @param indentation space to be left at the beginning of each line
         */
         static Ogre::String GetCustomPropertySaveString(OgitorsCustomPropertySet *set, int indentation);
         /**
-        * Returns a string containing xml structure ofa custom property set
-        * @param set the set that will be used to create xml structure
+        * Returns a string containing XML structure of a custom property set
+        * @param set the set that will be used to create XML structure
         * @param indentation space to be left at the beginning of each line
         */
         static void ReadCustomPropertySet(TiXmlElement *element, OgitorsCustomPropertySet *set);
         /**
-        * Returns a string containing xml structure of an object
-        * @param object the object that will be used to create xml structure
+        * Returns a string containing XML structure of an object
+        * @param object the object that will be used to create XML structure
         * @param useobjid will there be a object_id parameter?
-        * @param addparent will there be a parentnode parameter?
-        * @return returns a string containing xml syntax created from the object
+        * @param addparent will there be a parent node parameter?
+        * @return returns a string containing XML syntax created from the object
         */
         static Ogre::String GetObjectSaveStringV2(CBaseEditor *object, int indentation, bool useobjid, bool addparent);
         /**
-        * Returns a string containing xml structure ofa custom property set for DotScene Format
-        * @param set the set that will be used to create xml structure
+        * Returns a string containing XML structure of a custom property set for DotScene Format
+        * @param set the set that will be used to create XML structure
         * @param indentation space to be left at the beginning of each line
         */
         static Ogre::String GetUserDataSaveString(OgitorsCustomPropertySet *set, int indentation);
-
         /**
         * Saves given image to OFS
         * @param image the image file to be saved
         * @param filename the filename to be saved as
         */
         static bool SaveImageOfs(Ogre::Image& image, Ogre::String filename);
-
         /**
         * Saves given stream to OFS
         * @param stream the stream to be saved
         * @param filename the filename to be saved as
         */
         static bool SaveStreamOfs(std::stringstream& stream, Ogre::String filename);
-
         /**
         * Copies a file system directory contents into OFS file system
         * @param dirpath path of the file system directory
         * @param ofs_path path of the OFS directory to copy files into
         */
         static bool CopyDirOfs(Ogre::String dirpath, Ogre::String ofs_path);
-
+        
     protected:
         static Ogre::String   mExePath;
         static unsigned int   mVertexBufferSize;

File Ogitor/include/TerrainGroupEditor.h

         inline Ogre::Real            getWorldSize() { return mWorldSize->get(); }
         Ogre::Real                   getHeightAt(Ogre::Real x, Ogre::Real z);
         inline Ogre::String          getPageNamePrefix() { return mPageNamePrefix->get(); }
-        Ogre::Vector3                getPagePosition(int x, int y);
+        Ogre::Vector3                getPagePosition(const int x, const int y);
+        bool                         addPage(const int x, const int y, const Ogre::String diffuse, const Ogre::String normal);
         /**
         * Fetches terrain editor handle
         * @return terrain editor handle
         */
         virtual void loadResource(Ogre::Resource* resource);
         
-        void OnShadowsChange(const OgitorsPropertyBase* property, Ogre::Any value);
-        void OnShadowsTechniqueChange(const OgitorsPropertyBase* property, Ogre::Any value);
-
+        void onShadowsChange(const OgitorsPropertyBase* property, Ogre::Any value);
+        void onShadowsTechniqueChange(const OgitorsPropertyBase* property, Ogre::Any value);
 
         /**
-        * Modifies the heightfields of all pages
+        * Modifies the height fields of all pages
         * @param scale the scale to multiply current heights with
         * @param offset value to offset current heights with (after scale)
         */
         static PropertyOptionsVector *GetMapSizeOptions() { return &mMapSizeOptions; }
         /**
         * Fetches colour map size options property(ies)
-        * @return colourmap size options property(ies)
+        * @return colour map size options property(ies)
         */
         static PropertyOptionsVector *GetColourMapSizeOptions() { return &mColourMapSizeOptions; }
 

File Ogitor/src/OFSSceneSerializer.cpp

 
     if(!testpassed)
     {
-        mSystem->DisplayMessageDialog("The path is Read-Only. Ogitor can not work with Read-Only Project Paths!", DLGTYPE_OK);
+        mSystem->DisplayMessageDialog("The path is read-only. Ogitor can not work with read-only project paths!", DLGTYPE_OK);
         return SCF_CANCEL;
     }
 

File Ogitor/src/OgitorsProperty.cpp

 //This File is modified version of the Original Implementation by OGITOR TEAM
 /////////////////////////////////////////////////////////////////////////////
 
+#include "OgitorsPrerequisites.h"
+#include "OgitorsRoot.h"
+#include "OgitorsSystem.h"
 #include <Ogre.h>
 #include <istream>
 #include "OgitorsExports.h"
 #include "OgitorsProperty.h"
 #include "OgitorsUndoManager.h"
 
+using namespace Ogitors;
+
 namespace Ogitors
 {
     //---------------------------------------------------------------------
         {
             OgitorsPropertyValue val;
             val.propType = i->second->getType();
+
             switch(val.propType)
             {
             case PROP_SHORT:
             case PROP_MATRIX4:
                 val.val = Ogre::Any(static_cast<OgitorsProperty<Ogre::Matrix4>*>(i->second)->get());
                 break;
-
             };
             ret[i->second->getName()] = val;
         }
 
         return ret;
-
-
     }
     //---------------------------------------------------------------------
     void OgitorsPropertySet::setValueMap(const OgitorsPropertyValueMap& values)
                     break;
                 case PROP_MATRIX4:
                     static_cast<OgitorsProperty<Ogre::Matrix4>*>(j->second)->set(Ogre::any_cast<Ogre::Matrix4>(i->second.val));
-                    break;
-
+                    break; 
                 };
             }
         }
     }
-
     //---------------------------------------------------------------------
-    void OgitorsPropertySet::initValueMap(const OgitorsPropertyValueMap& values)
+    void OgitorsPropertySet::initValueMap(OgitorsPropertyValueMap& values)
     {
-        for (OgitorsPropertyValueMap::const_iterator i = values.begin(); i != values.end(); ++i)
+        for (OgitorsPropertyValueMap::iterator i = values.begin(); i != values.end(); ++i)
         {
             OgitorsPropertyMap::iterator j = mPropertyMap.find(i->first);
             if (j != mPropertyMap.end())
             {
-                // matching properties
-                // check type
-                assert (j->second->getType() == i->second.propType);
+                // Check for property type mismatch and try to correct it
+                Ogitors::OgitorsSystem* mSystem = Ogitors::OgitorsSystem::getSingletonPtr();
+                if(j->second->getType() != i->second.propType)
+                {
+                    Ogre::String msg = Ogre::String("The type of the property ");
+                    msg += i->first;
+                    msg += " seems to have changed.\n\nOgitor will attempt to automatically correct the situation, but please check the values of the property afterwards.";
+                    mSystem->DisplayMessageDialog(OTR(msg), Ogitors::DLGTYPE_OK);
+                    changePropertyType(&i->second, j->second->getType());
+                }
 
                 switch(i->second.propType)
                 {
                 case PROP_MATRIX4:
                     static_cast<OgitorsProperty<Ogre::Matrix4>*>(j->second)->init(Ogre::any_cast<Ogre::Matrix4>(i->second.val));
                     break;
-
                 };
             }
         }
     }
     //---------------------------------------------------------------------
+    void OgitorsPropertySet::changePropertyType(OgitorsPropertyValue* currentValue, OgitorsPropertyType targetType)
+    {
+        *currentValue = OgitorsPropertyValue::createFromString(targetType, currentValue->origVal);
+    }
+    //---------------------------------------------------------------------
     OgitorsCustomPropertySet::OgitorsCustomPropertySet()
     {
         mType = PROPSET_CUSTOM;

File Ogitor/src/OgitorsRoot.cpp

         return 0;
 }
 //-----------------------------------------------------------------------------------------
-CBaseEditor *OgitorsRoot::CreateEditorObject(CBaseEditor *parent, const Ogre::String objecttypestring, OgitorsPropertyValueMap &params,bool addtotreelist, bool display)
+CBaseEditor *OgitorsRoot::CreateEditorObject(CBaseEditor *parent, const Ogre::String objecttypestring, OgitorsPropertyValueMap &params, bool addtotreelist, bool display)
 {
     if(parent == 0)
     {
     mymap.clear();
     for (i = children.begin(); i != iend; ++i)
     {
-        mymap.insert(std::map<Ogre::String,CBaseEditor*>::value_type(i->first,i->second));
+        mymap.insert(std::map<Ogre::String,CBaseEditor*>::value_type(i->first, i->second));
     }
 
     std::map<Ogre::String,CBaseEditor*>::const_iterator i2, i2end;
     i2end = mymap.end();
 
-    for(unsigned int z = 0;z < mObjectDisplayOrder.size();z++)
+    for(unsigned int z = 0; z < mObjectDisplayOrder.size(); z++)
     {
       for (i2 = mymap.begin(); i2 != i2end; ++i2)
       {
           if(i2->second->getEditorType() == mObjectDisplayOrder[z])
           {
-              mSystem->InsertTreeItem(pEditor,i2->second,i2->second->getTypeID(),i2->second->getTextColourInt());
+              mSystem->InsertTreeItem(pEditor, i2->second, i2->second->getTypeID(), i2->second->getTextColourInt());
               RecurseFillTreeView(i2->second);
           }
       }
         {
             /* Since we're saving as a new project, refresh the menu
             controls because we change the names of certain items
-            for example the ogscene file name to match the OFS file  */
+            for example the *.OGSCENE file name to match the OFS file  */
             SetEditorTool(TOOL_SELECT);
             setLoadState(LS_UNLOADED);
             mSystem->ClearTreeItems();

File Ogitor/src/OgitorsRootUtilityFunctions.cpp

     AxisGizmo::createMesh(GetSceneManager(), "OgitorAxisGizmoMesh");
     AxisGizmo::createPlaneMesh(GetSceneManager(), "OgitorAxisPlaneMesh");
 
-    mGizmoNode = GetSceneManager()->getRootSceneNode()->createChildSceneNode("scbWidgetNode",Vector3(0,0,0),Quaternion::IDENTITY);
+    mGizmoNode = GetSceneManager()->getRootSceneNode()->createChildSceneNode("scbWidgetNode", Vector3(0,0,0), Quaternion::IDENTITY);
 
-    mGizmoX = mGizmoNode->createChildSceneNode("scbnwx",Vector3(0,0,0),Quaternion::IDENTITY);
-    mGizmoY = mGizmoNode->createChildSceneNode("scbnwy",Vector3(0,0,0),Quaternion::IDENTITY);
-    mGizmoZ = mGizmoNode->createChildSceneNode("scbnwz",Vector3(0,0,0),Quaternion::IDENTITY);
+    mGizmoX = mGizmoNode->createChildSceneNode("scbnwx", Vector3(0,0,0), Quaternion::IDENTITY);
+    mGizmoY = mGizmoNode->createChildSceneNode("scbnwy", Vector3(0,0,0), Quaternion::IDENTITY);
+    mGizmoZ = mGizmoNode->createChildSceneNode("scbnwz", Vector3(0,0,0), Quaternion::IDENTITY);
 
     Quaternion q1;
     Quaternion q2;
     mGizmoEntities[5]->setQueryFlags(QUERYFLAG_WIDGET);
     mGizmoZ->attachObject(mGizmoEntities[5]);
 
+    // Call once to derive bounding boxes 
+    mGizmoEntities[0]->getWorldBoundingBox(true);
+    mGizmoEntities[1]->getWorldBoundingBox(true);
+    mGizmoEntities[2]->getWorldBoundingBox(true);
+
     mGizmoNode->setVisible(false);
 }
 //-----------------------------------------------------------------------------------------
             orders[0] = orders[1] = orders[2] = 95;
         }
 
-
         if(dist1 > dist2) 
             orders[0] += increment;
         else

File Ogitor/src/OgitorsUtils.cpp

 #if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
 	  return QualifyPath(GetMacBundlePath() + "/Contents/Resources/Media/editorResources");
 #else
-	  return QualifyPath("../Media/editorResources");
+	  return QualifyPath(Ogitors::Globals::MEDIA_PATH + "/editorResources");
 #endif
 }
 //-----------------------------------------------------------------------------------------
 //-----------------------------------------------------------------------------------------
 void OgitorsUtils::ParseUTFStringVector(Ogre::UTFString &str, UTFStringVector &list)
 {
+    int oldPos = 0;
+    
     list.clear();
     if(str == "") 
         return;
     int pos = str.find(";");
     while(pos != -1)
     {
-        list.push_back(str.substr(0,pos));
-        str.erase(0,pos + 1);
-        pos = str.find(";");
+        list.push_back(str.substr(oldPos, pos));
+        oldPos = pos + 1;
+        pos = str.find(";", oldPos);        
     }
   
     if(str != "") 
-        list.push_back(str);
+        list.push_back(str.substr(oldPos, str.size()));
 }
 //-----------------------------------------------------------------------------------------
 void OgitorsUtils::CleanPath(Ogre::String &path)
     Ogre::String path = dirname;
     if(path.substr(0,1) == ".") path = mExePath + "/" + path;
 
-    std::replace(path.begin(),path.end(),'\\','/');
+    std::replace(path.begin(), path.end(), '\\', '/');
     
     // Remember if there is a leading '/'
     bool leadingSlash = false;
     while(pos != -1)
     {
         if(pos > 0 && path.substr(0,pos) != ".")  // Ignore zero strings and same directory pointers
-            list.push_back(path.substr(0,pos));
-        path.erase(0,pos + 1);
+            list.push_back(path.substr(0, pos));
+        path.erase(0, pos + 1);
         pos = path.find("/");
     }
 
     {
         if(list[pos2] == "..")
         {
-              list.erase(list.begin() + pos2 - 1,list.begin() + pos2 + 1);
+              list.erase(list.begin() + pos2 - 1, list.begin() + pos2 + 1);
             pos2--;
         }
         else
     return path;
 }
 //-----------------------------------------------------------------------------------------
-Ogre::String OgitorsUtils::GetRelativePath(const Ogre::String pathFrom,const Ogre::String pathTo)
+Ogre::String OgitorsUtils::GetRelativePath(const Ogre::String pathFrom, const Ogre::String pathTo)
 {
     Ogre::String sFrom = QualifyPath(pathFrom);
     Ogre::String sTo = QualifyPath(pathTo);
     int pos = sFrom.find("/");
     while(pos != -1)
     {
-        listfrom.push_back(sFrom.substr(0,pos));
-        sFrom.erase(0,pos + 1);
+        listfrom.push_back(sFrom.substr(0, pos));
+        sFrom.erase(0, pos + 1);
         pos = sFrom.find("/");
     }
     
     pos = sTo.find("/");
     while(pos != -1)
     {
-        listto.push_back(sTo.substr(0,pos));
-        sTo.erase(0,pos + 1);
+        listto.push_back(sTo.substr(0, pos));
+        sTo.erase(0, pos + 1);
         pos = sTo.find("/");
     }
     
             break;
     }
 
-    listfrom.erase(listfrom.begin(),listfrom.begin() + i);
-    listto.erase(listto.begin(),listto.begin() + i);
+    listfrom.erase(listfrom.begin(), listfrom.begin() + i);
+    listto.erase(listto.begin(), listto.begin() + i);
 
     if(listfrom.size() == 0 && listto.size() == 0) 
         return "./";
     // Calculate how many vertices and indices we're going to need
     for (unsigned short i = 0; i < mesh->getNumSubMeshes(); ++i)
     {
-        Ogre::SubMesh* submesh = mesh->getSubMesh( i );
+        Ogre::SubMesh* submesh = mesh->getSubMesh(i);
 
         // We only need to add the shared vertices once
         if(submesh->useSharedVertices)
         {
-            if( !added_shared )
+            if(!added_shared)
             {
                 vertex_count += mesh->sharedVertexData->vertexCount;
                 added_shared = true;
     if(vertex_count > mVertexBufferSize)
     {
         OGRE_FREE(mVertexBuffer, Ogre::MEMCATEGORY_GEOMETRY);
-        mVertexBuffer = OGRE_ALLOC_T(Ogre::Vector3,vertex_count, Ogre::MEMCATEGORY_GEOMETRY);
+        mVertexBuffer = OGRE_ALLOC_T(Ogre::Vector3, vertex_count, Ogre::MEMCATEGORY_GEOMETRY);
         mVertexBufferSize = vertex_count;
     }
 
     if(index_count > mIndexBufferSize)
     {
         OGRE_FREE(mIndexBuffer, Ogre::MEMCATEGORY_GEOMETRY);
-        mIndexBuffer = OGRE_ALLOC_T(unsigned long,index_count, Ogre::MEMCATEGORY_GEOMETRY);
+        mIndexBuffer = OGRE_ALLOC_T(unsigned long, index_count, Ogre::MEMCATEGORY_GEOMETRY);
         mIndexBufferSize = index_count;
     }
 
     added_shared = false;
 
     // Run through the submeshes again, adding the data into the arrays
-    for ( unsigned short i = 0; i < mesh->getNumSubMeshes(); ++i)
+    for (unsigned short i = 0; i < mesh->getNumSubMeshes(); ++i)
     {
         Ogre::SubMesh* submesh = mesh->getSubMesh(i);
 
 
             // There is _no_ baseVertexPointerToElement() which takes an Ogre::Real or a double
             //  as second argument. So make it float, to avoid trouble when Ogre::Real will
-            //  be comiled/typedefed as double:
+            //  be compiled/typedef-ed as double:
             //      Ogre::Real* pReal;
             float* pReal;
 
-            for( size_t j = 0; j < vertex_data->vertexCount; ++j, vertex += vbuf->getVertexSize())
+            for(size_t j = 0; j < vertex_data->vertexCount; ++j, vertex += vbuf->getVertexSize())
             {
                 posElem->baseVertexPointerToElement(vertex, &pReal);
 
 
         size_t offset = (submesh->useSharedVertices)? shared_offset : current_offset;
 
-        if ( use32bitindexes )
+        if (use32bitindexes)
         {
-            for ( size_t k = 0; k < numTris*3; ++k)
+            for (size_t k = 0; k < numTris*3; ++k)
             {
                 mIndexBuffer[index_offset++] = pLong[k] + static_cast<unsigned long>(offset);
             }
         }
         else
         {
-            for ( size_t k = 0; k < numTris*3; ++k)
+            for (size_t k = 0; k < numTris*3; ++k)
             {
                 mIndexBuffer[index_offset++] = static_cast<unsigned long>(pShort[k]) + static_cast<unsigned long>(offset);
             }
 }
 //-----------------------------------------------------------------------------------------
 void OgitorsUtils::GetMeshDataEx(const Ogre::Entity *entity, size_t &vertex_count, size_t &index_count,
-                               const Ogre::Vector3 &position, const Ogre::Quaternion &orient, const Ogre::Vector3 &scale)
+                                 const Ogre::Vector3 &position, const Ogre::Quaternion &orient, const Ogre::Vector3 &scale)
 {
     bool added_shared = false;
     size_t current_offset = 0;
         // We only need to add the shared vertices once
         if(submesh->useSharedVertices)
         {
-            if( !added_shared )
+            if(!added_shared)
             {
                 vertex_count += mesh->sharedVertexData->vertexCount;
                 added_shared = true;
     if(vertex_count > mVertexBufferSize)
     {
         OGRE_FREE(mVertexBuffer, Ogre::MEMCATEGORY_GEOMETRY);
-        mVertexBuffer = OGRE_ALLOC_T(Ogre::Vector3,vertex_count, Ogre::MEMCATEGORY_GEOMETRY);
+        mVertexBuffer = OGRE_ALLOC_T(Ogre::Vector3, vertex_count, Ogre::MEMCATEGORY_GEOMETRY);
         mVertexBufferSize = vertex_count;
     }
 
     if(index_count > mIndexBufferSize)
     {
         OGRE_FREE(mIndexBuffer, Ogre::MEMCATEGORY_GEOMETRY);
-        mIndexBuffer = OGRE_ALLOC_T(unsigned long,index_count, Ogre::MEMCATEGORY_GEOMETRY);
+        mIndexBuffer = OGRE_ALLOC_T(unsigned long, index_count, Ogre::MEMCATEGORY_GEOMETRY);
         mIndexBufferSize = index_count;
     }
 
 
             // There is _no_ baseVertexPointerToElement() which takes an Ogre::Real or a double
             //  as second argument. So make it float, to avoid trouble when Ogre::Real will
-            //  be comiled/typedefed as double:
+            //  be compiled/typedef-ed as double:
             //      Ogre::Real* pReal;
             float* pReal;
 
 
         size_t offset = (submesh->useSharedVertices)? shared_offset : current_offset;
 
-        if ( use32bitindexes )
+        if (use32bitindexes)
         {
-            for ( size_t k = 0; k < numTris*3; ++k)
+            for (size_t k = 0; k < numTris * 3; ++k)
             {
                 mIndexBuffer[index_offset++] = pLong[k] + static_cast<unsigned long>(offset);
             }
         }
         else
         {
-            for ( size_t k = 0; k < numTris*3; ++k)
+            for (size_t k = 0; k < numTris * 3; ++k)
             {
                 mIndexBuffer[index_offset++] = static_cast<unsigned long>(pShort[k]) + static_cast<unsigned long>(offset);
             }
         int index_pos = 0;
         for (unsigned short sm = 0; sm < pEntity->getMesh()->getNumSubMeshes(); ++sm)
         {
-            index_pos += pEntity->getMesh()->getSubMesh( sm )->indexData->indexCount;
+            index_pos += pEntity->getMesh()->getSubMesh(sm)->indexData->indexCount;
             if(closest_index < index_pos)
                 return sm;
         }
 
     Ogre::String indentStr = "";
 
-    for(int k = 0; k < indentation;k++)
+    for(int k = 0; k < indentation; k++)
         indentStr += " ";
     
     buffer += indentStr + "<CUSTOMPROPERTIES>\n";
     OgitorsPropertyVector vec = set->getPropertyVector();
 
-    for(unsigned int i = 0;i < vec.size();i++)
+    for(unsigned int i = 0; i < vec.size(); i++)
     {
         OgitorsPropertyBase *property = vec[i];
         const OgitorsPropertyDef *def = property->getDefinition();
         OgitorsUtils::ParseStringVector(attFields, svec);
 
         def = set->addProperty(attID, OgitorsPropertyValue::createFromString((OgitorsPropertyType)attType, attValue));
-        for(unsigned int i = 0;i < svec.size();i++)
+        for(unsigned int i = 0; i < svec.size(); i++)
             def->setFieldName(i, svec[i]);
 
         def->setAutoOptionType(attAutoOptionType);
             if(svec.size() > 1)
             {
                 PropertyOptionsVector *options = new PropertyOptionsVector();
-                for(unsigned int o = 0;o < (svec.size() - 1);o += 2)
+                for(unsigned int o = 0; o < (svec.size() - 1); o += 2)
                 {
                     OgitorsPropertyValue propVal = OgitorsPropertyValue::createFromString(def->getType(), svec[o + 1]);
                     options->push_back(PropertyOption(svec[o], propVal.val));
     if(vec.size() < 1)
         return "";
 
-    for(int k = 0; k < indentation;k++)
+    for(int k = 0; k < indentation; k++)
         indentStr += " ";
     
     buffer += indentStr + "<userData>\n";
 
-    for(unsigned int i = 0;i < vec.size();i++)
+    for(unsigned int i = 0; i < vec.size(); i++)
     {
         OgitorsPropertyBase *property = vec[i];
         const OgitorsPropertyDef *def = property->getDefinition();
     Ogre::String outStr;
     Ogre::String indentStr = "";
 
-    for(int k = 0; k < indentation;k++)
+    for(int k = 0; k < indentation; k++)
         indentStr += " ";
     
     outStr = indentStr + "<OBJECT";
 
     char *tmp_buffer = new char[MAX_BUFFER_SIZE];
 
-    for(unsigned int i = 0;i < filelist.size();i++)
+    for(unsigned int i = 0; i < filelist.size(); i++)
     {
         Ogre::String path = filelist[i];
         Ogre::String file_ofs_path = ofs_path + ExtractFileName(filelist[i]);
 
     OgitorsSystem::getSingletonPtr()->GetDirList(dirpath + "/", filelist);
 
-    for(unsigned int i = 0;i < filelist.size();i++)
+    for(unsigned int i = 0; i < filelist.size(); i++)
     {
         Ogre::String dir_name = ofs_path + filelist[i] + "/"; 
         mFile->createDirectory(dir_name.c_str());

File Ogitor/src/TerrainGroupEditor.cpp

 //-----------------------------------------------------------------------------------------
 bool CTerrainGroupEditor::getObjectContextMenu(UTFStringVector &menuitems)
 {
+    bool hasPages = false;
+    if(mHandle->getTerrainIterator().begin() != mHandle->getTerrainIterator().end())
+        hasPages = true;
+    
     menuitems.clear();
-    menuitems.push_back(OTR("Add Page") + ";:/icons/additional.svg");
-    menuitems.push_back(OTR("Scale/Offset Height Values"));
-    menuitems.push_back(OTR("Import Terrain From Heightmap"));
-    menuitems.push_back(OTR("Export Heightmaps"));
-    menuitems.push_back(OTR("Export Compositemaps"));
+    menuitems.push_back(OTR("Manage Terrain Pages") + ";:/icons/additional.svg");
+    if(hasPages)
+        menuitems.push_back(OTR("Scale/Offset Height Values") + ";:/icons/scale.svg");
+    
+    menuitems.push_back("---");
+    menuitems.push_back(OTR("Import Terrain From Heightmap")+ ";:/icons/import.svg");
+    menuitems.push_back("---");
+    if(hasPages)
+    {
+        menuitems.push_back(OTR("Export Heightmaps") + ";:/icons/export.svg");
+        menuitems.push_back(OTR("Export Compositemaps") + ";:/icons/export.svg");
+    }    
 
     return true;
 }
         {
             int x = Ogre::StringConverter::parseInt(params["pagex"]);
             int y = Ogre::StringConverter::parseInt(params["pagey"]);
-
-            OgitorsPropertyValueMap creationparams;
-            OgitorsPropertyValue pvalue;
-
-            Ogre::String pagename = mPageNamePrefix->get();
-            pagename += Ogre::StringConverter::toString(x);
-            pagename += "x";
-            pagename += Ogre::StringConverter::toString(y);
-
-            creationparams["init"] = EMPTY_PROPERTY_VALUE;
-            pvalue.propType = PROP_STRING;
-            pvalue.val = Ogre::Any(pagename);
-            creationparams["name"] = pvalue;
-
-            Ogre::Vector3 position;
-            mHandle->convertTerrainSlotToWorldPosition(x, y, &position);
-
-            pvalue.propType = PROP_VECTOR3;
-            pvalue.val = Ogre::Any(position);
-            creationparams["position"] = pvalue;
-            pvalue.propType = PROP_INT;
-            pvalue.val = Ogre::Any(x);
-            creationparams["pagex"] = pvalue;
-            pvalue.propType = PROP_INT;
-            pvalue.val = Ogre::Any(y);
-            creationparams["pagey"] = pvalue;
-            pvalue.propType = PROP_STRING;
-            pvalue.val = Ogre::Any(params["diffuse"]);
-            creationparams["layer0::diffusespecular"] = pvalue;
-            pvalue.propType = PROP_STRING;
-            pvalue.val = Ogre::Any(params["normal"]);
-            creationparams["layer0::normalheight"] = pvalue;
-            pvalue.propType = PROP_REAL;
-            pvalue.val = Ogre::Any((Ogre::Real)10.0f);
-            creationparams["layer0::worldsize"] = pvalue;
-
-            CTerrainPageEditor* page = (CTerrainPageEditor*)mOgitorsRoot->CreateEditorObject(this,"Terrain Page Object", creationparams, true, true);
+            addPage(x, y, params["diffuse"], params["normal"]);
         }
     }
     else if(menuresult == 1)
     }
 }
 //-----------------------------------------------------------------------------------------
-Ogre::Vector3 CTerrainGroupEditor::getPagePosition(int x, int y)
+bool CTerrainGroupEditor::addPage(const int x, const int y, const Ogre::String diffuse, const Ogre::String normal)
+{
+    if (diffuse.empty() || normal.empty())
+        return false;
+
+    OgitorsPropertyValueMap creationparams;
+    OgitorsPropertyValue pvalue;
+
+    Ogre::String pagename = mPageNamePrefix->get();
+    pagename += Ogre::StringConverter::toString(x);
+    pagename += "x";
+    pagename += Ogre::StringConverter::toString(y);
+
+    creationparams["init"] = EMPTY_PROPERTY_VALUE;
+    pvalue.propType = PROP_STRING;
+    pvalue.val = Ogre::Any(pagename);
+    creationparams["name"] = pvalue;
+
+    Ogre::Vector3 position;
+    mHandle->convertTerrainSlotToWorldPosition(x, y, &position);
+
+    pvalue.propType = PROP_VECTOR3;
+    pvalue.val = Ogre::Any(position);
+    creationparams["position"] = pvalue;
+    pvalue.propType = PROP_INT;
+    pvalue.val = Ogre::Any(x);
+    creationparams["pagex"] = pvalue;
+    pvalue.propType = PROP_INT;
+    pvalue.val = Ogre::Any(y);
+    creationparams["pagey"] = pvalue;
+    pvalue.propType = PROP_STRING;
+    pvalue.val = Ogre::Any(diffuse);
+    creationparams["layer0::diffusespecular"] = pvalue;
+    pvalue.propType = PROP_STRING;
+    pvalue.val = Ogre::Any(normal);
+    creationparams["layer0::normalheight"] = pvalue;
+    pvalue.propType = PROP_REAL;
+    pvalue.val = Ogre::Any((Ogre::Real)10.0f);
+    creationparams["layer0::worldsize"] = pvalue;
+
+    CTerrainPageEditor* page = (CTerrainPageEditor*)mOgitorsRoot->CreateEditorObject(this, "Terrain Page Object", creationparams, true, true);
+}
+//-----------------------------------------------------------------------------------------
+Ogre::Vector3 CTerrainGroupEditor::getPagePosition(const int x, const int y)
 {
     Ogre::Vector3 pos;
     mHandle->convertTerrainSlotToWorldPosition(x, y, &pos);
         }
     }
 
-    CONNECT_PROPERTY_MEMFN(mSceneMgr, "shadows::enabled", CTerrainGroupEditor, OnShadowsChange, mShadowsConnection[0]);
-    CONNECT_PROPERTY_MEMFN(mSceneMgr, "shadows::technique", CTerrainGroupEditor, OnShadowsTechniqueChange, mShadowsConnection[1]);
+    CONNECT_PROPERTY_MEMFN(mSceneMgr, "shadows::enabled", CTerrainGroupEditor, onShadowsChange, mShadowsConnection[0]);
+    CONNECT_PROPERTY_MEMFN(mSceneMgr, "shadows::technique", CTerrainGroupEditor, onShadowsTechniqueChange, mShadowsConnection[1]);
 
     mHandle = OGRE_NEW Ogre::TerrainGroup(mOgitorsRoot->GetSceneManager() ,Ogre::Terrain::ALIGN_X_Z, mMapSize->get(), mWorldSize->get());
     mHandle->setOrigin(Ogre::Vector3::ZERO);
     return pTerrain;
 }
 //-----------------------------------------------------------------------------------------
-void CTerrainGroupEditor::OnShadowsChange(const OgitorsPropertyBase* property, Ogre::Any value)
+void CTerrainGroupEditor::onShadowsChange(const OgitorsPropertyBase* property, Ogre::Any value)
 {
     bool newstate = Ogre::any_cast<bool>(value);
 
     }
 }
 //-----------------------------------------------------------------------------------------
-void CTerrainGroupEditor::OnShadowsTechniqueChange(const OgitorsPropertyBase* property, Ogre::Any value)
+void CTerrainGroupEditor::onShadowsTechniqueChange(const OgitorsPropertyBase* property, Ogre::Any value)
 {
 
     CSceneManagerEditor *mSceneMgr = static_cast<CSceneManagerEditor*>(mOgitorsRoot->GetSceneManagerEditor());

File Ogitor/src/TerrainGroupEditorEditing.cpp

     {
         Ogre::Image img;
         img.load(brush,"Brushes");
-        
-        unsigned char *dataptr = OGRE_ALLOC_T(unsigned char, img.getWidth() * img.getHeight() * 3, Ogre::MEMCATEGORY_GEOMETRY);
-        Ogre::PixelBox resultbox(img.getWidth(),img.getHeight(),1,Ogre::PF_B8G8R8,dataptr);
-        Ogre::PixelUtil::bulkPixelConversion(img.getPixelBox(), resultbox);
+
+        size_t width  = 256,
+               height = 256;
+
+        unsigned char *dataptr = OGRE_ALLOC_T(unsigned char, width * height * 4, Ogre::MEMCATEGORY_GEOMETRY);
+        Ogre::PixelBox resultbox(width,height,1,Ogre::PF_A8R8G8B8,dataptr);
+        Ogre::Image::scale(img.getPixelBox(), resultbox);
 
         resultbox.setConsecutive();
         int pos = 0;
         Ogre::ColourValue colval;
-        for(unsigned int x = 0;x < img.getHeight() * img.getWidth();x++)
+        for(unsigned int x = 0;x < width * height;x++)
         {
-                dataptr[pos] = 0;
+                dataptr[pos] *= 0.8f;
                 dataptr[pos + 1] = 0;
-                dataptr[pos + 2] *= 0.8f;
-                pos += 3;
+                dataptr[pos + 2] = 0;
+                pos += 4;
         }
 
-        mDecalTexture->setHeight(img.getHeight());
-        mDecalTexture->setWidth(img.getWidth());
+        /* Width, Height and Format must match when copying into mDecalTexture
+           or the decal texture won't show on linux and possibly other platforms. */
         Ogre::HardwarePixelBufferSharedPtr ptr = mDecalTexture->getBuffer();
         ptr->blitFromMemory(resultbox);
         OGRE_FREE(dataptr, Ogre::MEMCATEGORY_GEOMETRY);
         mDecalFrustum->setNearClipDistance(ratio);
         mDecalFrustum->setOrthoWindow(ratio, ratio);
         
-        setBrushName(mBrushName);
+        //setBrushName(mBrushName);
     }
 }
 //-----------------------------------------------------------------------------------------

File Ogitor/src/TerrainGroupEditorImportExport.cpp

             pvalue.val = Ogre::Any((unsigned long)dataptr);
             creationparams["externaldatahandle"] = pvalue;
 
-            CTerrainPageEditor* page = (CTerrainPageEditor*)mOgitorsRoot->CreateEditorObject(this,"Terrain Page Object", creationparams, true, true);
+            CTerrainPageEditor* page = (CTerrainPageEditor*)mOgitorsRoot->CreateEditorObject(this, "Terrain Page Object", creationparams, true, true);
         }
     }
 

File Ogitor/src/TerrainGroupEditorUpdate.cpp

 
     mLayer = handle->_getLayerID(mTextureDiffuse, mTextureNormal, mEditDirection);
 
-    if(mLayer < 1)
+    if(mLayer == -1)
     {
-        Ogre::String msg = handle->getName() + " already has maximum number of supported layers...";
+        Ogre::String msg = handle->getName() + " already has the maximum number of supported texture layers.";
+        mSystem->DisplayMessageDialog(OTR(msg), DLGTYPE_OK);
+        return;
+    }
+    else if(mLayer == 0)
+    {
+        Ogre::String msg = "You cannot use that texture pn " + handle->getName() + " since that is already the texture of the base layer.";
         mSystem->DisplayMessageDialog(OTR(msg), DLGTYPE_OK);
         return;
     }

File Ogitor/src/TerrainPageEditor.cpp

 bool CTerrainPageEditor::getObjectContextMenu(UTFStringVector &menuitems)
 {
     menuitems.clear();
-    menuitems.push_back(OTR("Remove Page"));
     if(mLoaded->get())
     {
-        menuitems.push_back(OTR("Re-Light"));
-        menuitems.push_back(OTR("Calculate Blendmap"));
-        menuitems.push_back(OTR("Scale/Offset Height Values"));
-        menuitems.push_back("-");
-        menuitems.push_back(OTR("Import Heightmap"));
-        menuitems.push_back(OTR("Export Heightmap"));
-        menuitems.push_back(OTR("Export Compositemap"));
-        menuitems.push_back("-");
-        menuitems.push_back(OTR("Import Blendmaps") +  Ogre::UTFString(" (RGB+A)"));
+        menuitems.push_back(OTR("Remove page") + ";:icons/trash.svg");
+        menuitems.push_back(OTR("Re-Light") + ";:icons/relight.svg");
+        menuitems.push_back(OTR("Calculate Blendmap") + ";:icons/toolbar.svg");
+        menuitems.push_back(OTR("Scale/Offset Height Values") + ";:icons/scale.svg");
+        menuitems.push_back("---");
+        menuitems.push_back(OTR("Import Heightmap") + ";:icons/import.svg");
+        
+        menuitems.push_back("---");
+        menuitems.push_back(OTR(">Import Blendmaps") +  Ogre::UTFString(" (RGB+A)")  + ";:icons/import.svg");
 
-        for(int i = 1; i < mLayerCount->get();i++)
+        for(int i = 1; i < mLayerCount->get(); i++)
         {
-            Ogre::UTFString prefix = "Layer ";
+            Ogre::UTFString prefix = "#Layer ";
             prefix = prefix + Ogre::StringConverter::toString(i);
             prefix = prefix + ": ";
             menuitems.push_back(prefix  + OTR("Import Blendmap") +  Ogre::UTFString(" (R)"));
         }
+
+        if(mLayerCount->get() > 0)
+            menuitems.push_back(OTR("#Base layer (not possible);;0"));
+
+        menuitems.push_back("---");
+        menuitems.push_back(OTR("Export Heightmap") + ";:icons/export.svg");
+        menuitems.push_back(OTR("Export Compositemap") + ";:icons/export.svg");
     }
 
     return true;
 //-------------------------------------------------------------------------------
 void CTerrainPageEditor::onObjectContextMenu(int menuresult)
 {
+    int layerCount = mLayerCount->get();
+    
     if(menuresult == 0)
     {
         Ogre::UTFString msgStr = OTR("Do you want to remove %s?");
 
         if(mSystem->DisplayMessageDialog(msgStr, DLGTYPE_YESNO) == DLGRET_YES)
         {
-            mOgitorsRoot->DestroyEditorObject(this,true,true);
+            mOgitorsRoot->DestroyEditorObject(this, true, true);
         }
     }
     else if(menuresult == 1)
     {
         importHeightMap();
     }
-    else if(menuresult == 5)
+    else if(menuresult > 5 && menuresult <= (5 + layerCount))
+    {
+        int lyID = menuresult - 5;
+        importBlendMap(lyID);
+    }
+    else if(menuresult == (5 + layerCount + 1))
     {
         exportHeightMap();
     }
-    else if(menuresult == 6)
+    else if(menuresult == (5 + layerCount + 2))
     {
         exportCompositeMap();
     }
-    else if(menuresult == 7)
-    {
-        importBlendMap();
-    }
-    else if(menuresult > 7)
-    {
-        int lyID = menuresult - 7;
-        importBlendMap(lyID);
-    }
 }
 //-----------------------------------------------------------------------------------------
 void CTerrainPageEditor::setSelectedImpl(bool bSelected)
     }
 }
 //-----------------------------------------------------------------------------------------
-
-
-//-----------------------------------------------------------------------------------------
 //------CTERRAINPAGEEDITORFACTORY-----------------------------------------------------------------
 //-----------------------------------------------------------------------------------------
 CTerrainPageEditorFactory::CTerrainPageEditorFactory(OgitorsView *view) : CBaseEditorFactory(view)
 {
     mTypeName = "Terrain Page Object";
-    mEditorType = ETYPE_MOVABLE;
+    mEditorType = ETYPE_TERRAIN_PAGE;
     mIcon = "pagedterrain.svg";
-    mCapabilities = CAN_PAGE | CAN_DELETE | CAN_UNDO;
+    mCapabilities = CAN_PAGE | CAN_DELETE | CAN_UNDO | CAN_FOCUS;
     mDefaultWorldSection = SECT_TERRAIN;
 
     OgitorsPropertyDef *definition;

File Ogitor/src/TerrainPageEditorImportExport.cpp

     _notifyModification(layerID, rect);
     _notifyEndModification();
 
-
     Ogre::TerrainLayerBlendMap *mBlendMap;
     float *mBlendData;
 

File Ogitor/src/ViewportEditor.cpp

     mTypeName = "Viewport Object";
     mEditorType = ETYPE_VIEWPORT;
     mIcon = "viewport.svg";
-    mCapabilities = CAN_DELETE  | CAN_UNDO;
+    mCapabilities = CAN_UNDO;
     mLastZOrder = 0;
 
     OgitorsPropertyDef *definition;

File Ogitor/src/ViewportEditorEvents.cpp

 
             float dist = std::max(std::max(vSize.x,vSize.y),vSize.z) * 2.0f;
 
-            Ogre::Vector3 lookat = (mActiveCamera->getCamera()->getDerivedDirection() * dist);
-            mNewCamPosition = vCenter - lookat;
+            if(mOgitorsRoot->GetSelection()->getFirstObject()->getEditorType() == ETYPE_TERRAIN_PAGE)
+            {
+                mNewCamPosition = vCenter;
+                mNewCamPosition.y += vSize.y;
+                
+                if(mActiveCamera)
+                    mActiveCamera->lookAt(vCenter);
+            }
+            else
+            {
+                Ogre::Vector3 lookat = (mActiveCamera->getCamera()->getDerivedDirection() * dist);
+                mNewCamPosition = vCenter - lookat;
+            }            
         }
     }
     //-------------------------------------------------------------------------------

File OgreOfsPlugin/CMakeLists.txt

     if(OGITOR_DIST)
         install(TARGETS OgreOfsPlugin
             LIBRARY DESTINATION ${OGRE_PLUGIN_DIR_LINUX}
-            CONFIGURATIONS Release RelWithDebInfo MinSizeRel)
+            CONFIGURATIONS Debug Release RelWithDebInfo MinSizeRel)
     else(OGITOR_DIST)
         install(TARGETS OgreOfsPlugin
             LIBRARY DESTINATION lib
-            CONFIGURATIONS Release RelWithDebInfo MinSizeRel)
+            CONFIGURATIONS Debug Release RelWithDebInfo MinSizeRel)
     endif(OGITOR_DIST)
 
 ENDIF(UNIX AND NOT APPLE)

File Plugins/OgAngelScript/Bindings_Enum.h

         REG_ENUM_VALUE("EditorType", ETYPE_MOVABLE);
         REG_ENUM_VALUE("EditorType", ETYPE_GENERALPURPOSE);
         REG_ENUM_VALUE("EditorType", ETYPE_MULTISEL);
+        REG_ENUM_VALUE("EditorType", ETYPE_MATERIAL);
+        REG_ENUM_VALUE("EditorType", ETYPE_TECHNIQUE);
+        REG_ENUM_VALUE("EditorType", ETYPE_TERRAIN_PAGE);
 
         r = engine->RegisterEnum("LoadState");assert(r >= 0);
         REG_ENUM_VALUE("LoadState", LS_UNLOADED);

File Plugins/OgHydrax/HydraxWaterEditor.cpp

 bool CHydraxEditor::getObjectContextMenu(UTFStringVector &menuitems)
 {
     menuitems.clear();
-    menuitems.push_back(OTR("Load Hydrax config file"));
+    menuitems.push_back(OTR("Load Hydrax config file") + ";:/icons/import.svg");
 
     return true;
 }
 //-----------------------------------------------------------------------------------------
 void CHydraxEditor::onObjectContextMenu(int menuresult)
 {
-    switch ( menuresult )
+    switch(menuresult)
     {
-        // Load landscape definitions from xml
+        // Load landscape definitions from XML
         case 0:
             UTFStringVector extlist;
             extlist.push_back(OTR("Hydrax Config File"));

File Plugins/OgQtExample/CMakeLists.txt

+cmake_minimum_required(VERSION 2.6)
+set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE)
+cmake_policy(SET CMP0003 NEW)
+
+project(ogQtExample)
+
+set(QT_MIN_VERSION "4.5.0")
+find_package(Qt4 COMPONENTS QtSvg REQUIRED)
+
+find_package(OGITOR REQUIRED)
+
+if(NOT QT4_FOUND)
+	MESSAGE(SEND_ERROR "Failed to find Qt 4.5 or greater.")
+else(NOT QT4_FOUND)
+	include(${QT_USE_FILE})
+	set(CMAKE_PACKAGE_QTGUI TRUE)
+
+	file(GLOB UI_FILES *.ui)
+
+	set(HEADER_FILES
+		qtExample.h
+	)
+
+	set(SOURCE_FILES
+		qtExample.cpp
+	)
+
+	SET(MOC_SRCS2
+		qtExample.h
+	)
+
+	qt4_wrap_cpp(MOC_SRCS ${MOC_SRCS2})
+	qt4_wrap_ui(UI_SRCS ${UI_FILES})
+
+	source_group("Moc Files" FILES ${MOC_SRCS})
+	source_group("Ui Files" FILES ${UI_FILES})
+
+	# if we don't include this CMake will not include ui headers properly:
+	include_directories(${CMAKE_CURRENT_BINARY_DIR})
+
+	#qt4_add_resources(RESOURCE_SRCS ./res/qtOgitor.qrc)
+	#SOURCE_GROUP("Qrc Files" FILES ${RESOURCE_SRCS})
+
+	set(SRCS ${HEADER_FILES} ${SOURCE_FILES} ${MOC_SRCS} ${UI_FILES})
+
+	set(ogQtExample_VERSION 0)
+	set(ogQtExample_VERSION_MAJOR 1)
+
+	include_directories(include)
+	include_directories(${DEPENDENCIES_INCLUDES})
+	include_directories(${OGITOR_INCLUDES})
+	message(STATUS "${OGITOR_INCLUDES}")
+
+	include_directories(.)
+	link_directories(${OGITOR_LIBPATH})
+	link_directories(${DEPENDENCIES_LIBPATH})
+
+	link_libraries(${QT_QTMAIN_LIBRARY} ${QT_LIBRARIES} ${OGRE_LIBRARIES} Ogitor)
+	add_library(ogQtExample SHARED ${SRCS})
+	set(LIBRARY_OUTPUT_PATH ../lib)
+
+    if(NOT OGITOR_DIST)
+        set_target_properties(ogQtExample PROPERTIES INSTALL_RPATH ${OGRE_INSTALL_DIR}/lib/OGRE)
+    endif(NOT OGITOR_DIST)
+	
+	set_target_properties(ogQtExample PROPERTIES VERSION ${ogQtExample_VERSION} SOVERSION ${ogQtExample_VERSION_MAJOR})
+	set_target_properties(ogQtExample PROPERTIES COMPILE_DEFINITIONS PLUGIN_EXPORT)
+	set_target_properties(ogQtExample PROPERTIES SOLUTION_FOLDER Plugins)
+
+	if(UNIX AND NOT APPLE)
+		add_custom_command(TARGET ogQtExample PRE_BUILD
+			COMMAND mkdir -p ../../RunPath/Plugins)
+		add_custom_command(TARGET ogQtExample POST_BUILD
+			COMMAND cp -r ../lib/ogQtExample.* ../../RunPath/Plugins/)
+	endif(UNIX AND NOT APPLE)
+
+	if(WIN32)
+		add_custom_command(TARGET ogQtExample PRE_BUILD
+			COMMAND if not exist ..\\..\\RunPath\\Plugins mkdir ..\\..\\RunPath\\Plugins)
+		add_custom_command(TARGET ogQtExample POST_BUILD
+			COMMAND copy \"$(TargetPath)\" ..\\..\\RunPath\\Plugins)
+		add_custom_command(TARGET ogQtExample POST_BUILD
+			COMMAND if exist ..\\..\\RunPath\\Plugins\\ogQtExample_d.dll move ..\\..\\RunPath\\Plugins\\ogQtExample_d.dll ..\\..\\RunPath\\Plugins\\debug)
+
+		install(TARGETS ogQtExample
+			RUNTIME DESTINATION Plugins
+			CONFIGURATIONS Release RelWithDebInfo MinSizeRel)
+	endif(WIN32)
+
+    IF(UNIX AND NOT APPLE)
+        if(OGITOR_DIST)
+            install(TARGETS ogQtExample
+                LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/ogitor
+                CONFIGURATIONS Release RelWithDebInfo MinSizeRel)
+        endif(OGITOR_DIST)
+    ENDIF(UNIX AND NOT APPLE)
+
+endif(NOT QT4_FOUND)
+
+# vim: set sw=2 ts=2 noet:

File Plugins/OgQtExample/qtExample.cpp

+///////////////////////////////////////////////////////////////////////////////////
+/// An
+///    ___   ____ ___ _____ ___  ____
+///   / _ \ / ___|_ _|_   _/ _ \|  _ \
+///  | | | | |  _ | |  | || | | | |_) |
+///  | |_| | |_| || |  | || |_| |  _ <
+///   \___/ \____|___| |_| \___/|_| \_\
+///                              File
+///
+/// Copyright (c) 2008-2012 Ismail TARIM <ismail@royalspor.com> and the Ogitor Team
+//
+/// The MIT License
+///
+/// Permission is hereby granted, free of charge, to any person obtaining a copy
+/// of this software and associated documentation files (the "Software"), to deal
+/// in the Software without restriction, including without limitation the rights
+/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+/// copies of the Software, and to permit persons to whom the Software is
+/// furnished to do so, subject to the following conditions:
+///
+/// The above copyright notice and this permission notice shall be included in
+/// all copies or substantial portions of the Software.
+///
+/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+/// THE SOFTWARE.
+//////////////////////////////////////////////////////////////////////////////////
+
+#include "qtExample.h"
+
+using namespace Ogitors;
+
+//----------------------------------------------------------------------------
+CQtExample::CQtExample()
+{
+}
+//----------------------------------------------------------------------------
+CQtExample *qtExample = 0;
+
+bool dllStartPlugin(void *identifier, Ogre::String& name)
+{
+    name = "Ogitor Qt Example Plugin";
+    qtExample = OGRE_NEW CQtExample();
+    OgitorsRoot::getSingletonPtr()->RegisterSerializer(identifier, qtExample);
+    return true;
+}
+//----------------------------------------------------------------------------
+bool dllStopPlugin(void)
+{
+    OGRE_DELETE qtExample;
+    qtExample = 0;
+    return true;
+}
+//----------------------------------------------------------------------------
+
+

File Plugins/OgQtExample/qtExample.h

+///////////////////////////////////////////////////////////////////////////////////
+/// An
+///    ___   ____ ___ _____ ___  ____
+///   / _ \ / ___|_ _|_   _/ _ \|  _ \
+///  | | | | |  _ | |  | || | | | |_) |
+///  | |_| | |_| || |  | || |_| |  _ <
+///   \___/ \____|___| |_| \___/|_| \_\
+///                              File
+///
+/// Copyright (c) 2008-2012 Ismail TARIM <ismail@royalspor.com> and the Ogitor Team
+//
+/// The MIT License
+///
+/// Permission is hereby granted, free of charge, to any person obtaining a copy
+/// of this software and associated documentation files (the "Software"), to deal
+/// in the Software without restriction, including without limitation the rights
+/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+/// copies of the Software, and to permit persons to whom the Software is
+/// furnished to do so, subject to the following conditions:
+///
+/// The above copyright notice and this permission notice shall be included in
+/// all copies or substantial portions of the Software.
+///
+/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+/// THE SOFTWARE.
+//////////////////////////////////////////////////////////////////////////////////
+
+#pragma once
+
+#include "Ogitors.h"
+
+#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
+   #ifdef PLUGIN_EXPORT
+     #define PluginExport __declspec (dllexport)
+   #else
+     #define PluginExport __declspec (dllimport)
+   #endif
+#else
+   #define PluginExport
+#endif
+
+namespace Ogitors
+{
+
+class PluginExport CQtExample
+{
+public:
+    CQtExample();
+    virtual ~CQtExample() {};