diff options
Diffstat (limited to 'source/creator')
-rw-r--r-- | source/creator/CMakeLists.txt | 553 | ||||
-rw-r--r-- | source/creator/Makefile | 16 | ||||
-rw-r--r-- | source/creator/SConscript | 25 | ||||
-rw-r--r-- | source/creator/buildinfo.c | 10 | ||||
-rw-r--r-- | source/creator/creator.c | 383 |
5 files changed, 560 insertions, 427 deletions
diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index fe2f073e5f9..1256881182b 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -27,50 +27,56 @@ SETUP_LIBDIRS() INCLUDE_DIRECTORIES(../../intern/guardedalloc - ../blender/blenlib - ../blender/blenkernel - ../blender/nodes - ../blender/include - ../blender/blenloader - ../blender/imbuf - ../blender/renderconverter - ../blender/render/extern/include - ../blender/python - ../blender/makesdna - ../blender/gpu - ../blender/freestyle - ../kernel/gen_messaging - ../kernel/gen_system - ../../extern/glew/include + ../blender/blenlib + ../blender/blenkernel + ../blender/editors/include + ../blender/makesrna + ../blender/makesrna/intern + ../blender/nodes + ../blender/include + ../blender/blenloader + ../blender/imbuf + ../blender/renderconverter + ../blender/render/extern/include + ../blender/makesdna + ../blender/gpu + ../blender/windowmanager + ../kernel/gen_messaging + ../kernel/gen_system + ../../extern/glew/include ) IF(WITH_QUICKTIME) - ADD_DEFINITIONS(-DWITH_QUICKTIME) + ADD_DEFINITIONS(-DWITH_QUICKTIME) ENDIF(WITH_QUICKTIME) IF(WITH_OPENEXR) - ADD_DEFINITIONS(-DWITH_OPENEXR) + ADD_DEFINITIONS(-DWITH_OPENEXR) ENDIF(WITH_OPENEXR) -IF(LINUX) - ADD_DEFINITIONS(-DWITH_BINRELOC) - INCLUDE_DIRECTORIES(${BINRELOC_INC}) -endif(LINUX) +IF(WITH_PYTHON) + INCLUDE_DIRECTORIES(../blender/python) +ELSE(WITH_PYTHON) + ADD_DEFINITIONS(-DDISABLE_PYTHON) +ENDIF(WITH_PYTHON) -MESSAGE(STATUS "Configuring blender") +IF(NOT WITH_SDL) + ADD_DEFINITIONS(-DDISABLE_SDL) +ENDIF(NOT WITH_SDL) -ADD_CUSTOM_COMMAND( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/dna.c - COMMAND ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/makesdna ${CMAKE_CURRENT_BINARY_DIR}/dna.c ${CMAKE_SOURCE_DIR}/source/blender/makesdna/ - DEPENDS ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/makesdna -) +IF(CMAKE_SYSTEM_NAME MATCHES "Linux") + ADD_DEFINITIONS(-DWITH_BINRELOC) + INCLUDE_DIRECTORIES(${BINRELOC_INC}) +ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux") + +MESSAGE(STATUS "Configuring blender") IF(WIN32) - ADD_EXECUTABLE(blender ${EXETYPE} creator.c ${CMAKE_CURRENT_BINARY_DIR}/dna.c ../icons/winblender.rc) + ADD_EXECUTABLE(blender ${EXETYPE} creator.c ../icons/winblender.rc) ELSE(WIN32) - ADD_EXECUTABLE(blender ${EXETYPE} creator.c ${CMAKE_CURRENT_BINARY_DIR}/dna.c) + ADD_EXECUTABLE(blender ${EXETYPE} creator.c) ENDIF(WIN32) @@ -78,212 +84,323 @@ ENDIF(WIN32) SET(TARGETDIR ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}) +IF(WITH_INSTALL) -IF(UNIX) - ADD_CUSTOM_COMMAND(TARGET blender - POST_BUILD - MAIN_DEPENDENCY blender - #COMMAND cp -R ${CMAKE_SOURCE_DIR}/release/plugins ${TARGETDIR}/ - #COMMAND cp -R ${CMAKE_SOURCE_DIR}/release/text/* ${TARGETDIR}/ - ) -ENDIF(UNIX) + IF(UNIX) + ADD_CUSTOM_COMMAND(TARGET blender + POST_BUILD + MAIN_DEPENDENCY blender + #COMMAND cp -R ${CMAKE_SOURCE_DIR}/release/plugins ${TARGETDIR}/ + #COMMAND cp -R ${CMAKE_SOURCE_DIR}/release/text/* ${TARGETDIR}/ + ) + ENDIF(UNIX) -IF(UNIX AND NOT APPLE) - ADD_CUSTOM_COMMAND(TARGET blender - POST_BUILD - MAIN_DEPENDENCY blender - COMMAND rm -Rf ${TARGETDIR}/.blender - COMMAND mkdir ${TARGETDIR}/.blender/ - COMMAND cp ${CMAKE_SOURCE_DIR}/bin/.blender/.bfont.ttf ${TARGETDIR}/.blender/ - COMMAND cp ${CMAKE_SOURCE_DIR}/bin/.blender/.Blanguages ${TARGETDIR}/.blender/ - COMMAND cp -R ${CMAKE_SOURCE_DIR}/bin/.blender/locale ${TARGETDIR}/.blender/ - COMMAND cp -R ${CMAKE_SOURCE_DIR}/release/scripts ${TARGETDIR}/.blender/ - COMMAND find ${TARGETDIR} -name CVS -prune -exec rm -rf {} "\;" - ) -ENDIF(UNIX AND NOT APPLE) - -IF(APPLE) - SET(SOURCEDIR ${CMAKE_SOURCE_DIR}/source/darwin/blender.app) - SET(SOURCEINFO ${SOURCEDIR}/Contents/Info.plist) - SET(TARGETINFO ${TARGETDIR}/blender.app/Contents/Info.plist) - - ADD_CUSTOM_COMMAND(TARGET blender - POST_BUILD - MAIN_DEPENDENCY blender - COMMAND cp -R ${SOURCEINFO} ${TARGETDIR}/blender.app/Contents/ - COMMAND cp -R ${SOURCEDIR}/Contents/PkgInfo ${TARGETDIR}/blender.app/Contents/ - COMMAND cp -R ${SOURCEDIR}/Contents/Resources ${TARGETDIR}/blender.app/Contents/ - COMMAND cat ${SOURCEINFO} | sed s/VERSION/`cat ${CMAKE_SOURCE_DIR}/release/VERSION`/ | sed s/DATE/`date +'%Y-%b-%d'`/ > ${TARGETINFO} - COMMAND rm -Rf ${TARGETDIR}/blender.app/Contents/MacOS/.blender - COMMAND mkdir ${TARGETDIR}/blender.app/Contents/MacOS/.blender/ - COMMAND cp ${CMAKE_SOURCE_DIR}/bin/.blender/.bfont.ttf ${TARGETDIR}/blender.app/Contents/MacOS/.blender/ - COMMAND cp ${CMAKE_SOURCE_DIR}/bin/.blender/.Blanguages ${TARGETDIR}/blender.app/Contents/MacOS/.blender/ - COMMAND cp -R ${CMAKE_SOURCE_DIR}/bin/.blender/locale ${TARGETDIR}/blender.app/Contents/Resources/ - COMMAND cp -R ${CMAKE_SOURCE_DIR}/bin/.blender/locale ${TARGETDIR}/blender.app/Contents/MacOS/.blender/ - COMMAND cp ${CMAKE_SOURCE_DIR}/bin/.blender/.Blanguages ${TARGETDIR}/blender.app/Contents/Resources/ - COMMAND cp -R ${CMAKE_SOURCE_DIR}/release/scripts ${TARGETDIR}/blender.app/Contents/MacOS/.blender/ - COMMAND find ${TARGETDIR}/blender.app -name CVS -prune -exec rm -rf {} "\;" - COMMAND find ${TARGETDIR}/blender.app -name CVS.sandboxinfo -prune -exec rm -rf {} "\;" - COMMAND find ${TARGETDIR}/blender.app -name .DS_Store -prune -exec rm -rf {} "\;" - ) -ENDIF(APPLE) + IF(UNIX AND NOT APPLE) + ADD_CUSTOM_COMMAND( + TARGET blender POST_BUILD MAIN_DEPENDENCY blender + COMMAND rm -Rf ${TARGETDIR}/.blender + COMMAND mkdir ${TARGETDIR}/.blender/ + COMMAND cp ${CMAKE_SOURCE_DIR}/bin/.blender/.bfont.ttf ${TARGETDIR}/.blender/ + ) + + IF(WITH_INTERNATIONAL) + ADD_CUSTOM_COMMAND( + TARGET blender POST_BUILD MAIN_DEPENDENCY blender + COMMAND cp ${CMAKE_SOURCE_DIR}/bin/.blender/.Blanguages ${TARGETDIR}/.blender/ + COMMAND cp -R ${CMAKE_SOURCE_DIR}/bin/.blender/locale ${TARGETDIR}/.blender/ + ) + ENDIF(WITH_INTERNATIONAL) + + IF(WITH_PYTHON) + ADD_CUSTOM_COMMAND( + TARGET blender POST_BUILD MAIN_DEPENDENCY blender + COMMENT "copying blender scripts..." + COMMAND cp -R ${CMAKE_SOURCE_DIR}/release/ui ${TARGETDIR}/.blender/ + COMMAND cp -R ${CMAKE_SOURCE_DIR}/release/io ${TARGETDIR}/.blender/ + COMMAND find ${TARGETDIR} -name "*.py?" -prune -exec rm -rf {} "\;" + ) + + # Copy the systems python into the install directory + # Scons copy in tools/Blender.py + ADD_CUSTOM_COMMAND( + TARGET blender POST_BUILD MAIN_DEPENDENCY blender + COMMENT "copying a subset of the systems python..." + + COMMAND mkdir ${TARGETDIR}/.blender/python # PYTHONPATH and PYTHONHOME is set here + COMMAND mkdir ${TARGETDIR}/.blender/python/lib/ + COMMAND cp -R ${PYTHON_LIBPATH}/python${PYTHON_VERSION} ${TARGETDIR}/.blender/python/lib/ + + COMMAND rm -rf ${TARGETDIR}/.blender/python/lib/python${PYTHON_VERSION}/distutils + COMMAND rm -rf ${TARGETDIR}/.blender/python/lib/python${PYTHON_VERSION}/lib2to3 + COMMAND rm -rf ${TARGETDIR}/.blender/python/lib/python${PYTHON_VERSION}/idlelib + COMMAND rm -rf ${TARGETDIR}/.blender/python/lib/python${PYTHON_VERSION}/tkinter + COMMAND rm -rf ${TARGETDIR}/.blender/python/lib/python${PYTHON_VERSION}/config + + COMMAND rm -rf ${TARGETDIR}/.blender/python/lib/python${PYTHON_VERSION}/site-packages + COMMAND mkdir ${TARGETDIR}/.blender/python/lib/python${PYTHON_VERSION}/site-packages # python needs it. -IF(WIN32) - FILE(TO_NATIVE_PATH ${CMAKE_SOURCE_DIR} WIN_SOURCE_DIR) - - ADD_CUSTOM_COMMAND(TARGET blender - POST_BUILD - MAIN_DEPENDENCY blender - COMMAND if not exist \"${TARGETDIR}\\.blender\" mkdir \"${TARGETDIR}\\.blender\" - COMMAND if not exist \"${TARGETDIR}\\.blender\\locale\" mkdir \"${TARGETDIR}\\.blender\\locale\" - COMMAND if not exist \"${TARGETDIR}\\.blender\\scripts\" mkdir \"${TARGETDIR}\\.blender\\scripts\" - COMMAND if not exist \"${TARGETDIR}\\plugins\" mkdir \"${TARGETDIR}\\plugins\" - COMMAND copy /Y \"${WIN_SOURCE_DIR}\\bin\\.blender\\.Blanguages\" \"${TARGETDIR}\\.blender\\\" - COMMAND copy /Y \"${WIN_SOURCE_DIR}\\bin\\.blender\\.bfont.ttf\" \"${TARGETDIR}\\.blender\\\" - COMMAND xcopy /E /Y \"${WIN_SOURCE_DIR}\\bin\\.blender\\locale\\*.*\" \"${TARGETDIR}\\.blender\\locale\" - COMMAND xcopy /E /Y \"${WIN_SOURCE_DIR}\\release\\scripts\\*.*\" \"${TARGETDIR}\\.blender\\scripts\" - COMMAND xcopy /E /Y \"${WIN_SOURCE_DIR}\\release\\plugins\\*.*\" \"${TARGETDIR}\\plugins\" - COMMAND copy /Y \"${WIN_SOURCE_DIR}\\release\\text\\*.*\" \"${TARGETDIR}\" - ) - - FILE(TO_NATIVE_PATH "${LIBDIR}" WIN_LIBDIR) - - ADD_CUSTOM_COMMAND(TARGET blender - POST_BUILD - MAIN_DEPENDENCY blender - COMMAND copy /Y \"${WIN_LIBDIR}\\gettext\\lib\\gnu_gettext.dll\" \"${TARGETDIR}\\\" - COMMAND copy /Y \"${WIN_LIBDIR}\\png\\lib\\libpng.dll\" \"${TARGETDIR}\\\" - COMMAND copy /Y \"${WIN_LIBDIR}\\sdl\\lib\\SDL.dll\" \"${TARGETDIR}\\\" - COMMAND copy /Y \"${WIN_LIBDIR}\\zlib\\lib\\zlib.dll\" \"${TARGETDIR}\\\" - COMMAND copy /Y \"${WIN_LIBDIR}\\tiff\\lib\\libtiff.dll\" \"${TARGETDIR}\\\" - COMMAND copy /Y \"${WIN_LIBDIR}\\python\\lib\\python25.dll\" \"${TARGETDIR}\\\" - COMMAND copy /Y \"${WIN_LIBDIR}\\pthreads\\lib\\pthreadVC2.dll\" \"${TARGETDIR}\\\" - ) - - IF(WITH_INTERNATIONAL) - ADD_CUSTOM_COMMAND(TARGET blender - POST_BUILD - MAIN_DEPENDENCY blender - COMMAND copy /Y \"${WIN_LIBDIR}\\iconv\\lib\\iconv.dll\" \"${TARGETDIR}\\\" - ) - ENDIF(WITH_INTERNATIONAL) - - IF(WITH_FFMPEG) - ADD_CUSTOM_COMMAND(TARGET blender - POST_BUILD - MAIN_DEPENDENCY blender - COMMAND copy /Y \"${WIN_LIBDIR}\\ffmpeg\\lib\\avcodec-51.dll\" \"${TARGETDIR}\\\" - COMMAND copy /Y \"${WIN_LIBDIR}\\ffmpeg\\lib\\avformat-52.dll\" \"${TARGETDIR}\\\" - COMMAND copy /Y \"${WIN_LIBDIR}\\ffmpeg\\lib\\avdevice-52.dll\" \"${TARGETDIR}\\\" - COMMAND copy /Y \"${WIN_LIBDIR}\\ffmpeg\\lib\\avutil-49.dll\" \"${TARGETDIR}\\\" - COMMAND copy /Y \"${WIN_LIBDIR}\\ffmpeg\\lib\\libfaac-0.dll\" \"${TARGETDIR}\\\" - COMMAND copy /Y \"${WIN_LIBDIR}\\ffmpeg\\lib\\libfaad-0.dll\" \"${TARGETDIR}\\\" - COMMAND copy /Y \"${WIN_LIBDIR}\\ffmpeg\\lib\\libmp3lame-0.dll\" \"${TARGETDIR}\\\" - COMMAND copy /Y \"${WIN_LIBDIR}\\ffmpeg\\lib\\libx264-59.dll\" \"${TARGETDIR}\\\" - COMMAND copy /Y \"${WIN_LIBDIR}\\ffmpeg\\lib\\swscale-0.dll\" \"${TARGETDIR}\\\" - COMMAND copy /Y \"${WIN_LIBDIR}\\ffmpeg\\lib\\xvidcore.dll\" \"${TARGETDIR}\\\" - ) - ENDIF(WITH_FFMPEG) -ENDIF(WIN32) + COMMAND rm -f ${TARGETDIR}/.blender/python/lib/python${PYTHON_VERSION}/lib-dynload/_tkinter.so + COMMAND find ${TARGETDIR}/.blender/python/lib/python${PYTHON_VERSION} -name "test" -prune -exec rm -rf {} "\;" + COMMAND find ${TARGETDIR}/.blender/python/lib/python${PYTHON_VERSION} -name "*.py?" -exec rm -rf {} "\;" + COMMAND find ${TARGETDIR}/.blender/python/lib/python${PYTHON_VERSION} -name "*.so"-exec strip -s {} "\;" + ) + + ENDIF(WITH_PYTHON) + + ADD_CUSTOM_COMMAND( + TARGET blender POST_BUILD MAIN_DEPENDENCY blender + COMMAND find ${TARGETDIR} -name .svn -prune -exec rm -rf {} "\;" + ) + + ENDIF(UNIX AND NOT APPLE) + + IF(APPLE) + SET(SOURCEDIR ${CMAKE_SOURCE_DIR}/source/darwin/blender.app) + SET(SOURCEINFO ${SOURCEDIR}/Contents/Info.plist) + SET(TARGETINFO ${TARGETDIR}/blender.app/Contents/Info.plist) + + ADD_CUSTOM_COMMAND( + TARGET blender POST_BUILD MAIN_DEPENDENCY blender + COMMAND cp -R ${SOURCEINFO} ${TARGETDIR}/blender.app/Contents/ + COMMAND cp -R ${SOURCEDIR}/Contents/PkgInfo ${TARGETDIR}/blender.app/Contents/ + COMMAND cp -R ${SOURCEDIR}/Contents/Resources ${TARGETDIR}/blender.app/Contents/ + COMMAND cat ${SOURCEINFO} | sed s/VERSION/`cat ${CMAKE_SOURCE_DIR}/release/VERSION`/ | sed s/DATE/`date +'%Y-%b-%d'`/ > ${TARGETINFO} + COMMAND rm -Rf ${TARGETDIR}/blender.app/Contents/MacOS/.blender + COMMAND mkdir ${TARGETDIR}/blender.app/Contents/MacOS/.blender/ + COMMAND cp ${CMAKE_SOURCE_DIR}/bin/.blender/.bfont.ttf ${TARGETDIR}/blender.app/Contents/MacOS/.blender/ + ) + + IF(WITH_INTERNATIONAL) + ADD_CUSTOM_COMMAND( + TARGET blender POST_BUILD MAIN_DEPENDENCY blender + COMMAND cp ${CMAKE_SOURCE_DIR}/bin/.blender/.Blanguages ${TARGETDIR}/blender.app/Contents/MacOS/.blender/ + COMMAND cp -R ${CMAKE_SOURCE_DIR}/bin/.blender/locale ${TARGETDIR}/blender.app/Contents/Resources/ + COMMAND cp -R ${CMAKE_SOURCE_DIR}/bin/.blender/locale ${TARGETDIR}/blender.app/Contents/MacOS/.blender/ + COMMAND cp ${CMAKE_SOURCE_DIR}/bin/.blender/.Blanguages ${TARGETDIR}/blender.app/Contents/Resources/ + ) + ENDIF(WITH_INTERNATIONAL) + + IF(WITH_PYTHON) + ADD_CUSTOM_COMMAND( + TARGET blender POST_BUILD MAIN_DEPENDENCY blender + COMMAND cp -Rf ${CMAKE_SOURCE_DIR}/release/ui ${TARGETDIR}/blender.app/Contents/MacOS/.blender/ + COMMAND cp -Rf ${CMAKE_SOURCE_DIR}/release/io ${TARGETDIR}/blender.app/Contents/MacOS/.blender/ + COMMAND mkdir ${TARGETDIR}/blender.app/Contents/MacOS/.blender/python/ + COMMAND unzip -q ${LIBDIR}/release/python.zip -d ${TARGETDIR}/blender.app/Contents/MacOS/.blender/python/ + COMMAND find ${TARGETDIR}/blender.app -name "*.py?" -prune -exec rm -rf {} "\;" + ) + ENDIF(WITH_PYTHON) + + ADD_CUSTOM_COMMAND( + TARGET blender POST_BUILD MAIN_DEPENDENCY blender + COMMAND find ${TARGETDIR}/blender.app -name .DS_Store -prune -exec rm -rf {} "\;" + COMMAND find ${TARGETDIR}/blender.app -name .svn -prune -exec rm -rf {} "\;" + ) + ENDIF(APPLE) + + IF(WIN32) + FILE(TO_NATIVE_PATH ${CMAKE_SOURCE_DIR} WIN_SOURCE_DIR) + + ADD_CUSTOM_COMMAND(TARGET blender + POST_BUILD + MAIN_DEPENDENCY blender + COMMAND if not exist \"${TARGETDIR}\\.blender\" mkdir \"${TARGETDIR}\\.blender\" + COMMAND if not exist \"${TARGETDIR}\\.blender\\locale\" mkdir \"${TARGETDIR}\\.blender\\locale\" + COMMAND if not exist \"${TARGETDIR}\\.blender\\ui\" mkdir \"${TARGETDIR}\\.blender\\ui\" + COMMAND if not exist \"${TARGETDIR}\\.blender\\io\" mkdir \"${TARGETDIR}\\.blender\\io\" + COMMAND if not exist \"${TARGETDIR}\\plugins\" mkdir \"${TARGETDIR}\\plugins\" + COMMAND copy /Y \"${WIN_SOURCE_DIR}\\bin\\.blender\\.Blanguages\" \"${TARGETDIR}\\.blender\\\" + COMMAND copy /Y \"${WIN_SOURCE_DIR}\\bin\\.blender\\.bfont.ttf\" \"${TARGETDIR}\\.blender\\\" + COMMAND xcopy /E /Y \"${WIN_SOURCE_DIR}\\bin\\.blender\\locale\\*.*\" \"${TARGETDIR}\\.blender\\locale\" + COMMAND xcopy /E /Y \"${WIN_SOURCE_DIR}\\release\\scripts\\*.*\" \"${TARGETDIR}\\.blender\\scripts\" + COMMAND xcopy /E /Y \"${WIN_SOURCE_DIR}\\release\\ui\\*.*\" \"${TARGETDIR}\\.blender\\ui\" + COMMAND xcopy /E /Y \"${WIN_SOURCE_DIR}\\release\\io\\*.*\" \"${TARGETDIR}\\.blender\\io\" + COMMAND xcopy /E /Y \"${WIN_SOURCE_DIR}\\release\\plugins\\*.*\" \"${TARGETDIR}\\plugins\" + COMMAND copy /Y \"${WIN_SOURCE_DIR}\\release\\text\\*.*\" \"${TARGETDIR}\" + COMMAND copy /Y \"${WIN_SOURCE_DIR}\\release\\windows\\extra\\python26.zip\" \"${TARGETDIR}\\\" + ) + + FILE(TO_NATIVE_PATH "${LIBDIR}" WIN_LIBDIR) + + ADD_CUSTOM_COMMAND(TARGET blender + POST_BUILD + MAIN_DEPENDENCY blender + COMMAND copy /Y \"${WIN_LIBDIR}\\release\\python31.zip\" \"${TARGETDIR}\\\" + COMMAND copy /Y \"${WIN_LIBDIR}\\gettext\\lib\\gnu_gettext.dll\" \"${TARGETDIR}\\\" + COMMAND copy /Y \"${WIN_LIBDIR}\\png\\lib\\libpng.dll\" \"${TARGETDIR}\\\" + COMMAND copy /Y \"${WIN_LIBDIR}\\sdl\\lib\\SDL.dll\" \"${TARGETDIR}\\\" + COMMAND copy /Y \"${WIN_LIBDIR}\\zlib\\lib\\zlib.dll\" \"${TARGETDIR}\\\" + COMMAND copy /Y \"${WIN_LIBDIR}\\tiff\\lib\\libtiff.dll\" \"${TARGETDIR}\\\" + COMMAND copy /Y \"${WIN_LIBDIR}\\python\\lib\\python31.dll\" \"${TARGETDIR}\\\" + COMMAND copy /Y \"${WIN_LIBDIR}\\python\\lib\\python31_d.dll\" \"${TARGETDIR}\\\" + COMMAND copy /Y \"${WIN_LIBDIR}\\pthreads\\lib\\pthreadVC2.dll\" \"${TARGETDIR}\\\" + COMMAND copy /Y \"${WIN_LIBDIR}\\samplerate\\lib\\libsamplerate-0.dll\" \"${TARGETDIR}\\\" + ) + + IF(WITH_INTERNATIONAL) + ADD_CUSTOM_COMMAND(TARGET blender + POST_BUILD + MAIN_DEPENDENCY blender + COMMAND copy /Y \"${WIN_LIBDIR}\\iconv\\lib\\iconv.dll\" \"${TARGETDIR}\\\" + ) + ENDIF(WITH_INTERNATIONAL) + + IF(WITH_FFMPEG) + ADD_CUSTOM_COMMAND(TARGET blender + POST_BUILD + MAIN_DEPENDENCY blender + COMMAND copy /Y \"${WIN_LIBDIR}\\ffmpeg\\lib\\avcodec-52.dll\" \"${TARGETDIR}\\\" + COMMAND copy /Y \"${WIN_LIBDIR}\\ffmpeg\\lib\\avformat-52.dll\" \"${TARGETDIR}\\\" + COMMAND copy /Y \"${WIN_LIBDIR}\\ffmpeg\\lib\\avdevice-52.dll\" \"${TARGETDIR}\\\" + COMMAND copy /Y \"${WIN_LIBDIR}\\ffmpeg\\lib\\avutil-50.dll\" \"${TARGETDIR}\\\" + COMMAND copy /Y \"${WIN_LIBDIR}\\ffmpeg\\lib\\libfaac-0.dll\" \"${TARGETDIR}\\\" + COMMAND copy /Y \"${WIN_LIBDIR}\\ffmpeg\\lib\\libfaad-2.dll\" \"${TARGETDIR}\\\" + COMMAND copy /Y \"${WIN_LIBDIR}\\ffmpeg\\lib\\libmp3lame-0.dll\" \"${TARGETDIR}\\\" + COMMAND copy /Y \"${WIN_LIBDIR}\\ffmpeg\\lib\\libx264-67.dll\" \"${TARGETDIR}\\\" + COMMAND copy /Y \"${WIN_LIBDIR}\\ffmpeg\\lib\\swscale-0.dll\" \"${TARGETDIR}\\\" + COMMAND copy /Y \"${WIN_LIBDIR}\\ffmpeg\\lib\\xvidcore.dll\" \"${TARGETDIR}\\\" + ) + ENDIF(WITH_FFMPEG) + + IF(WITH_SNDFILE) + ADD_CUSTOM_COMMAND(TARGET blender + POST_BUILD + MAIN_DEPENDENCY blender + COMMAND copy /Y \"${WIN_LIBDIR}\\sndfile\\lib\\libsndfile-1.dll\" \"${TARGETDIR}\\\" + ) + ENDIF(WITH_SNDFILE) + + IF(WITH_JACK) + ADD_CUSTOM_COMMAND(TARGET blender + POST_BUILD + MAIN_DEPENDENCY blender + COMMAND copy /Y \"${WIN_LIBDIR}\\jack\\lib\\libjack.dll\" \"${TARGETDIR}\\\" + ) + ENDIF(WITH_JACK) + + IF(WITH_OPENAL) + ADD_CUSTOM_COMMAND(TARGET blender + POST_BUILD + MAIN_DEPENDENCY blender + COMMAND copy /Y \"${WIN_LIBDIR}\\openal\\lib\\OpenAL32.dll\" \"${TARGETDIR}\\\" + COMMAND copy /Y \"${WIN_LIBDIR}\\openal\\lib\\wrap_oal.dll\" \"${TARGETDIR}\\\" + + ) + ENDIF(WITH_OPENAL) + + + ENDIF(WIN32) +ENDIF(WITH_INSTALL) ADD_DEPENDENCIES(blender makesdna) FILE(READ ${CMAKE_BINARY_DIR}/cmake_blender_libs.txt BLENDER_LINK_LIBS) -SET(BLENDER_LINK_LIBS bf_nodes ${BLENDER_LINK_LIBS} src blender_python blender_render blender_radiosity) +SET(BLENDER_LINK_LIBS bf_nodes ${BLENDER_LINK_LIBS} bf_windowmanager bf_editors blender_render) IF(WITH_ELBEEM) - SET(BLENDER_LINK_LIBS ${BLENDER_LINK_LIBS} bf_elbeem) + SET(BLENDER_LINK_LIBS ${BLENDER_LINK_LIBS} bf_elbeem) ENDIF(WITH_ELBEEM) IF(CMAKE_SYSTEM_NAME MATCHES "Linux") - SET(BLENDER_LINK_LIBS ${BLENDER_LINK_LIBS} extern_binreloc) + SET(BLENDER_LINK_LIBS ${BLENDER_LINK_LIBS} extern_binreloc) ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux") IF(UNIX) - # Sort libraries - SET(BLENDER_SORTED_LIBS - src - bf_decimation - blender_BSP - bf_soundsystem - bf_ghost - bf_string - blender_render - blender_radiosity - blender_ONL - blender_python - bf_blenkernel - bf_nodes - bf_gpu - bf_blenloader - bf_blenpluginapi - bf_imbuf - bf_blenlib - bf_avi - bf_cineon - bf_openexr - bf_dds - bf_readblenfile - blender_bop - bf_kernel - bf_decimation - bf_elbeem - bf_yafray - bf_IK - bf_memutil - bf_guardedalloc - blender_CTR - bf_moto - bf_bmfont - verse - src - bf_ftfont - extern_ftgl - bf_blroutines - bf_converter - bf_dummy - bf_bullet - bf_common - bf_ketsji - bf_logic - bf_rasterizer - bf_oglrasterizer - bf_expressions - bf_scenegraph - bf_moto - bf_blroutines - kx_network - bf_kernel - bf_ngnetwork - extern_bullet - bf_loopbacknetwork - bf_sumo - bf_common - extern_solid - extern_qhull - bf_moto - blender_python - bf_quicktime - extern_binreloc - extern_glew - ) - - FOREACH(SORTLIB ${BLENDER_SORTED_LIBS}) - SET(REMLIB ${SORTLIB}) - FOREACH(SEARCHLIB ${BLENDER_LINK_LIBS}) - IF(${SEARCHLIB} STREQUAL ${SORTLIB}) - SET(REMLIB "") - ENDIF(${SEARCHLIB} STREQUAL ${SORTLIB}) - ENDFOREACH(SEARCHLIB) - IF(REMLIB) - MESSAGE(STATUS "Removing library ${REMLIB} from blender linking because: not configured") - LIST(REMOVE_ITEM BLENDER_SORTED_LIBS ${REMLIB}) - ENDIF(REMLIB) - ENDFOREACH(SORTLIB) - TARGET_LINK_LIBRARIES(blender ${BLENDER_SORTED_LIBS}) + # Sort libraries + SET(BLENDER_SORTED_LIBS + bf_windowmanager + bf_editors + bf_decimation + blender_BSP + bf_ghost + bf_string + blender_render + blender_ONL + bf_python + bf_gen_python + bf_blenkernel + bf_nodes + bf_gpu + bf_blenloader + bf_blenpluginapi + bf_imbuf + bf_blenlib + bf_avi + bf_cineon + bf_openexr + bf_dds + bf_readblenfile + blender_bop + bf_kernel + bf_decimation + bf_elbeem + bf_IK + bf_memutil + bf_guardedalloc + blender_CTR + bf_moto + bf_windowmanager + bf_editors + bf_blroutines + bf_converter + bf_dummy + bf_bullet + bf_smoke + bf_minilzo + bf_lzma + bf_common + bf_ketsji + bf_logic + bf_rasterizer + bf_oglrasterizer + bf_expressions + bf_scenegraph + bf_moto + bf_blroutines + kx_network + bf_kernel + bf_ngnetwork + extern_bullet + bf_loopbacknetwork + bf_common + bf_moto + bf_python + bf_gen_python + extern_binreloc + extern_glew + extern_libopenjpeg + bf_videotex + bf_rna + bf_dna + bf_blenfont + bf_audaspace + ) + + IF(WITH_CXX_GUARDEDALLOC) + SET(BLENDER_SORTED_LIBS ${BLENDER_SORTED_LIBS} bf_guardedalloc_cpp) + ENDIF(WITH_CXX_GUARDEDALLOC) + + IF(WITH_QUICKTIME) + SET(BLENDER_SORTED_LIBS ${BLENDER_SORTED_LIBS} bf_quicktime) + ENDIF(WITH_QUICKTIME) + + + FOREACH(SORTLIB ${BLENDER_SORTED_LIBS}) + SET(REMLIB ${SORTLIB}) + FOREACH(SEARCHLIB ${BLENDER_LINK_LIBS}) + IF(${SEARCHLIB} STREQUAL ${SORTLIB}) + SET(REMLIB "") + ENDIF(${SEARCHLIB} STREQUAL ${SORTLIB}) + ENDFOREACH(SEARCHLIB) + IF(REMLIB) + MESSAGE(STATUS "Removing library ${REMLIB} from blender linking because: not configured") + LIST(REMOVE_ITEM BLENDER_SORTED_LIBS ${REMLIB}) + ENDIF(REMLIB) + ENDFOREACH(SORTLIB) + TARGET_LINK_LIBRARIES(blender ${BLENDER_SORTED_LIBS}) ELSE(UNIX) - TARGET_LINK_LIBRARIES(blender ${BLENDER_LINK_LIBS}) + TARGET_LINK_LIBRARIES(blender ${BLENDER_LINK_LIBS}) ENDIF(UNIX) SETUP_LIBLINKS(blender) diff --git a/source/creator/Makefile b/source/creator/Makefile index 9273d943883..592cf913dfa 100644 --- a/source/creator/Makefile +++ b/source/creator/Makefile @@ -1,3 +1,5 @@ +# -*- mode: gnumakefile; tab-width: 8; indent-tabs-mode: t; -*- +# vim: tabstop=8 # # $Id$ # @@ -22,7 +24,7 @@ # # The Original Code is: all of this file. # -# Contributor(s): none yet. +# Contributor(s): GSR # # ***** END GPL LICENSE BLOCK ***** # @@ -38,29 +40,33 @@ include nan_compile.mk CFLAGS += $(LEVEL_1_C_WARNINGS) CPPFLAGS += -I../blender/render/extern/include -CPPFLAGS += -I../blender/radiosity/extern/include # two needed for the kernel CPPFLAGS += -I../blender/imbuf CPPFLAGS += -I../blender/makesdna +CPPFLAGS += -I../blender/makesrna CPPFLAGS += -I../blender/blenlib -CPPFLAGS += -I../blender/include +CPPFLAGS += -I../blender/editors/include CPPFLAGS += -I../blender/renderconverter CPPFLAGS += -I../blender/blenkernel CPPFLAGS += -I../blender/python CPPFLAGS += -I../blender/blenloader CPPFLAGS += -I../blender/gpu +CPPFLAGS += -I../blender/windowmanager CPPFLAGS += -I../kernel/gen_system CPPFLAGS += -I../kernel/gen_messaging CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include CPPFLAGS += -I$(NAN_GLEW)/include ifeq ($(WITH_QUICKTIME), true) - CPPFLAGS += -I$(NAN_QUICKTIME)/include -DWITH_QUICKTIME + CPPFLAGS += -I$(NAN_QUICKTIME)/include -DWITH_QUICKTIME +endif +ifeq ($(WITH_OPENJPEG), true) + CPPFLAGS += -DWITH_OPENJPEG endif ifeq ($(WITH_BINRELOC), true) - CPPFLAGS += -I$(NANBLENDERHOME)/extern/binreloc/include -DWITH_BINRELOC + CPPFLAGS += -I$(NANBLENDERHOME)/extern/binreloc/include -DWITH_BINRELOC endif CPPFLAGS += -I$(OPENGL_HEADERS) diff --git a/source/creator/SConscript b/source/creator/SConscript index 9720e350337..75e7494ebb5 100644 --- a/source/creator/SConscript +++ b/source/creator/SConscript @@ -4,29 +4,32 @@ Import ('env') sources = 'creator.c' incs = '#/intern/guardedalloc ../blender/blenlib ../blender/blenkernel' -incs += ' ../blender/include ../blender/blenloader ../blender/imbuf' -incs += ' ../blender/renderconverter ../blender/render/extern/include' -incs += ' ../blender/python ../blender/makesdna ../kernel/gen_messaging' -incs += ' ../blender/freestyle' +incs += ' ../blender/editors/include ../blender/blenloader ../blender/imbuf' +incs += ' ../blender/renderconverter ../blender/render/extern/include ../blender/windowmanager' +incs += ' ../blender/makesdna ../blender/makesrna ../kernel/gen_messaging' incs += ' ../kernel/gen_system #/extern/glew/include ../blender/gpu' incs += ' ' + env['BF_OPENGL_INC'] defs = [] if env['WITH_BF_QUICKTIME']: - incs += ' ' + env['BF_QUICKTIME_INC'] - defs.append('WITH_QUICKTIME') + incs += ' ' + env['BF_QUICKTIME_INC'] + defs.append('WITH_QUICKTIME') if env['WITH_BF_BINRELOC']: - incs += ' ../../extern/binreloc/include' - defs.append('WITH_BINRELOC') + incs += ' ../../extern/binreloc/include' + defs.append('WITH_BINRELOC') if env['WITH_BF_OPENEXR']: - defs.append('WITH_OPENEXR') + defs.append('WITH_OPENEXR') if not env['WITH_BF_SDL']: defs.append('DISABLE_SDL') -if not env['WITH_BF_PYTHON']: +if env['WITH_BF_PYTHON']: + incs += ' ../blender/python' + if env['BF_DEBUG']: + defs.append('_DEBUG') +else: defs.append('DISABLE_PYTHON') -env.BlenderLib ( libname = 'blender_creator', sources = Split(sources), includes = Split(incs), defines = defs, libtype='core', priority = 1 ) +env.BlenderLib ( libname = 'bf_creator', sources = Split(sources), includes = Split(incs), defines = defs, libtype='core', priority = 0 ) diff --git a/source/creator/buildinfo.c b/source/creator/buildinfo.c index e25caa34f46..cef98915d79 100644 --- a/source/creator/buildinfo.c +++ b/source/creator/buildinfo.c @@ -33,11 +33,11 @@ #ifdef BUILD_DATE #ifndef WIN32 -char * build_date=BUILD_DATE; -char * build_time=BUILD_TIME; -char * build_rev=BUILD_REV; -char * build_platform=BUILD_PLATFORM; -char * build_type=BUILD_TYPE; +const char * build_date=BUILD_DATE; +const char * build_time=BUILD_TIME; +const char * build_rev=BUILD_REV; +const char * build_platform=BUILD_PLATFORM; +const char * build_type=BUILD_TYPE; #else #include "winbuildinfo.h" #endif diff --git a/source/creator/creator.c b/source/creator/creator.c index b39833e4d17..41b27b1c915 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -29,6 +29,13 @@ #include <stdlib.h> #include <string.h> + +/* for setuid / getuid */ +#ifdef __sgi +#include <sys/types.h> +#include <unistd.h> +#endif + /* This little block needed for linking to Blender... */ #include "MEM_guardedalloc.h" @@ -43,11 +50,10 @@ #include "DNA_scene_types.h" #include "BLI_blenlib.h" -#include "blendef.h" /* for MAXFRAME */ - #include "BKE_utildefines.h" #include "BKE_blender.h" +#include "BKE_context.h" #include "BKE_font.h" #include "BKE_global.h" #include "BKE_main.h" @@ -55,20 +61,7 @@ #include "BKE_packedFile.h" #include "BKE_scene.h" #include "BKE_node.h" - -#include "BIF_gl.h" -#include "BIF_graphics.h" -#include "BIF_mainqueue.h" -#include "BIF_graphics.h" -#include "BIF_editsound.h" -#include "BIF_usiblender.h" -#include "BIF_drawscene.h" /* set_scene() */ -#include "BIF_screen.h" /* waitcursor and more */ -#include "BIF_usiblender.h" -#include "BIF_toolbox.h" - -#include "BLO_writefile.h" -#include "BLO_readfile.h" +#include "BKE_report.h" #include "IMB_imbuf.h" // for quicktime_init @@ -78,15 +71,16 @@ #include "RE_pipeline.h" -#include "GPU_draw.h" -#include "GPU_extensions.h" +//XXX #include "playanim_ext.h" +#include "ED_datafiles.h" +#include "UI_interface.h" -#include "FRS_freestyle.h" +#include "WM_api.h" -#include "playanim_ext.h" -#include "mydevice.h" -#include "nla.h" -#include "datatoc.h" +#include "RNA_define.h" + +#include "GPU_draw.h" +#include "GPU_extensions.h" /* for passing information between creator and gameengine */ #include "SYS_System.h" @@ -115,16 +109,6 @@ extern char * build_type; static void print_help(void); static void print_version(void); - -/* defined in ghostwinlay and winlay, we can't include carbon here, conflict with DNA */ -#ifdef __APPLE__ -extern int checkAppleVideoCard(void); -extern void getMacAvailableBounds(short *top, short *left, short *bottom, short *right); -extern void winlay_get_screensize(int *width_r, int *height_r); -extern void winlay_process_events(int wait_for_event); -#endif - - /* for the callbacks: */ extern int pluginapi_force_ref(void); /* from blenpluginapi:pluginapi.c */ @@ -162,20 +146,20 @@ static void blender_esc(int sig) static void print_version(void) { #ifdef BUILD_DATE - printf ("Blender %d.%02d (sub %d) Build\n", G.version/100, G.version%100, BLENDER_SUBVERSION); + printf ("Blender %d.%02d (sub %d) Build\n", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION); printf ("\tbuild date: %s\n", build_date); printf ("\tbuild time: %s\n", build_time); printf ("\tbuild revision: %s\n", build_rev); printf ("\tbuild platform: %s\n", build_platform); printf ("\tbuild type: %s\n", build_type); #else - printf ("Blender %d.%02d (sub %d) Build\n", G.version/100, G.version%100, BLENDER_SUBVERSION); + printf ("Blender %d.%02d (sub %d) Build\n", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION); #endif } static void print_help(void) { - printf ("Blender %d.%02d (sub %d) Build\n", G.version/100, G.version%100, BLENDER_SUBVERSION); + printf ("Blender %d.%02d (sub %d) Build\n", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION); printf ("Usage: blender [args ...] [file] [args ...]\n"); printf ("\nRender options:\n"); printf (" -b <file>\tRender <file> in background (doesn't load the user defaults .B.blend file)\n"); @@ -193,6 +177,8 @@ static void print_help(void) printf (" When the filename has no #, The suffix #### is added to the filename\n"); printf (" The frame number will be added at the end of the filename.\n"); printf (" eg: blender -b foobar.blend -o //render_ -F PNG -x 1 -a\n"); + printf (" -E <engine>\tSpecify the render engine.\n"); + printf (" use -E help to list available engines.\n"); printf ("\nFormat options:\n"); printf (" -F <format>\tSet the render format, Valid options are...\n"); printf (" \tTGA IRIS HAMX JPEG MOVIE IRIZ RAWTGA\n"); @@ -203,7 +189,7 @@ static void print_help(void) printf (" -t <threads>\tUse amount of <threads> for rendering (background mode only).\n"); printf (" [1-8], 0 for systems processor count.\n"); printf ("\nAnimation playback options:\n"); - printf (" -a <file(s)>\tPlayback <file(s)>, only operates this way when -b is not used.\n"); + printf (" -a <options> <file(s)>\tPlayback <file(s)>, only operates this way when -b is not used.\n"); printf (" -p <sx> <sy>\tOpen with lower left corner at <sx>, <sy>\n"); printf (" -m\t\tRead from disk (Don't buffer)\n"); printf (" -f <fps> <fps-base>\t\tSpecify FPS to start with\n"); @@ -217,17 +203,15 @@ static void print_help(void) printf ("\nGame Engine specific options:\n"); printf (" -g fixedtime\t\tRun on 50 hertz without dropping frames\n"); printf (" -g vertexarrays\tUse Vertex Arrays for rendering (usually faster)\n"); - printf (" -g noaudio\t\tNo audio in Game Engine\n"); printf (" -g nomipmap\t\tNo Texture Mipmapping\n"); printf (" -g linearmipmap\tLinear Texture Mipmapping instead of Nearest (default)\n"); printf ("\nMisc options:\n"); printf (" -d\t\tTurn debugging on\n"); - printf (" -noaudio\tDisable audio on systems that support audio\n"); printf (" -nojoystick\tDisable joystick support\n"); printf (" -noglsl\tDisable GLSL shading\n"); printf (" -h\t\tPrint this help text\n"); - printf (" -y\t\tDisable automatic python script execution (scriptlinks, pydrivers, pyconstraints, pynodes)\n"); + printf (" -y\t\tDisable automatic python script execution (pydrivers, pyconstraints, pynodes)\n"); printf (" -P <filename>\tRun the given Python script (filename or Blender Text)\n"); #ifdef WIN32 printf (" -R\t\tRegister .blend extension\n"); @@ -264,29 +248,25 @@ static void print_help(void) double PIL_check_seconds_timer(void); -extern void winlay_get_screensize(int *width_r, int *height_r); -static void main_init_screen( void ) +/* XXX This was here to fix a crash when running python scripts + * with -P that used the screen. + * + * static void main_init_screen( void ) { setscreen(G.curscreen); if(G.main->scene.first==0) { set_scene( add_scene("1") ); } -} +}*/ int main(int argc, char **argv) { - int a, i, stax, stay, sizx, sizy, scr_init = 0; SYS_SystemHandle syshandle; + bContext *C= CTX_create(); + int a, i, stax, stay, sizx, sizy /*XXX, scr_init = 0*/; -#if defined(WIN32) || defined (__linux__) - int audio = 1; -#else - int audio = 0; -#endif - - #ifdef WITH_BINRELOC br_init( NULL ); #endif @@ -297,27 +277,9 @@ int main(int argc, char **argv) if (argc==2 && strncmp(argv[1], "-psn_", 5)==0) { extern int GHOST_HACK_getFirstFile(char buf[]); static char firstfilebuf[512]; - int scr_x,scr_y; argc= 1; - /* first let us check if we are hardware accelerated and with VRAM > 16 Mo */ - - if (checkAppleVideoCard()) { - short top, left, bottom, right; - - winlay_get_screensize(&scr_x, &scr_y); - getMacAvailableBounds(&top, &left, &bottom, &right); - setprefsize(left +10,scr_y - bottom +10,right-left -20,bottom - 64, 0); - - } else { - winlay_get_screensize(&scr_x, &scr_y); - - /* 40 + 684 + (headers) 22 + 22 = 768, the powerbook screen height */ - setprefsize(120, 40, 850, 684, 0); - } - - winlay_process_events(0); if (GHOST_HACK_getFirstFile(firstfilebuf)) { argc= 2; argv[1]= firstfilebuf; @@ -343,11 +305,14 @@ int main(int argc, char **argv) BLI_where_am_i(bprogname, argv[0]); + RNA_init(); + RE_engines_init(); + /* Hack - force inclusion of the plugin api functions, * see blenpluginapi:pluginapi.c */ pluginapi_force_ref(); - + init_nodesystem(); initglobals(); /* blender.c */ @@ -387,7 +352,7 @@ int main(int argc, char **argv) /* exception here, see below, it probably needs happens after qt init? */ libtiff_init(); - playanim(argc-1, argv+1); +// XXX playanim(argc-1, argv+1); exit(0); break; case 'b': @@ -441,10 +406,6 @@ int main(int argc, char **argv) init_def_material(); if(G.background==0) { - winlay_get_screensize(&sizx, &sizy); - stax=0; - stay=0; - for(a=1; a<argc; a++) { if(argv[a][0] == '-') { switch(argv[a][1]) { @@ -461,12 +422,12 @@ int main(int argc, char **argv) sizx= atoi(argv[a]); a++; sizy= atoi(argv[a]); - G.windowstate = G_WINDOWSTATE_BORDER; + WM_setprefsize(stax, stay, sizx, sizy); break; case 'd': G.f |= G_DEBUG; /* std output printf's */ - printf ("Blender %d.%02d (sub %d) Build\n", G.version/100, G.version%100, BLENDER_SUBVERSION); + printf ("Blender %d.%02d (sub %d) Build\n", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION); MEM_set_memory_debug(); #ifdef NAN_BUILDINFO printf("Build: %s %s %s %s\n", build_date, build_time, build_platform, build_type); @@ -476,13 +437,15 @@ int main(int argc, char **argv) printf("argv[%d] = %s\n", i, argv[i]); } break; - + case 'E': + G.f |= G_SWAP_EXCHANGE; + break; case 'w': - G.windowstate = G_WINDOWSTATE_BORDER; + /* with borders XXX OLD CRUFT!*/ break; case 'W': + /* borderless, win + linux XXX OLD CRUFT */ /* XXX, fixme mein, borderless on OSX */ - G.windowstate = G_WINDOWSTATE_FULLSCREEN; break; case 'R': /* Registering filetypes only makes sense on windows... */ @@ -492,16 +455,6 @@ int main(int argc, char **argv) break; case 'n': case 'N': - if (BLI_strcasecmp(argv[a], "-noaudio") == 0|| BLI_strcasecmp(argv[a], "-nosound") == 0) { - /** - notify the gameengine that no audio is wanted, even if the user didn't give - the flag -g noaudio. - */ - - SYS_WriteCommandLineInt(syshandle,"noaudio",1); - audio = 0; - if (G.f & G_DEBUG) printf("setting audio to: %d\n", audio); - } if (BLI_strcasecmp(argv[a], "-nojoystick") == 0) { /** don't initialize joysticks if user doesn't want to use joysticks @@ -517,28 +470,21 @@ int main(int argc, char **argv) } } - if ( (G.windowstate == G_WINDOWSTATE_BORDER) || (G.windowstate == G_WINDOWSTATE_FULLSCREEN)) - setprefsize(stax, stay, sizx, sizy, 0); #ifndef DISABLE_PYTHON BPY_start_python(argc, argv); #endif - /** - * NOTE: sound_init_audio() *must be* after start_python, - * at least on FreeBSD. - * added note (ton): i removed it altogether - */ - BIF_init(); /* loads .B.blend */ + WM_init(C); + // XXX BRECHT SOLVE BLI_where_is_temp( btempdir, 1 ); /* call after loading the .B.blend so we can read U.tempdir */ #ifndef DISABLE_SDL + BLI_setenv("SDL_VIDEODRIVER", "dummy"); #ifdef __linux__ - /* On linux the default SDL driver dma often would not play - * use alsa if none is set */ - if ( getenv("SDL_AUDIODRIVER") == NULL) { - setenv("SDL_AUDIODRIVER", "alsa", 1); - } + /* On linux the default SDL driver dma often would not play + * use alsa if none is set */ + setenv("SDL_AUDIODRIVER", "alsa", 0); #endif #endif } @@ -547,25 +493,26 @@ int main(int argc, char **argv) BPY_start_python(argc, argv); #endif BLI_where_is_temp( btempdir, 0 ); /* call after loading the .B.blend so we can read U.tempdir */ - - // (ton) Commented out. I have no idea whats thisfor... will mail around! - // SYS_WriteCommandLineInt(syshandle,"noaudio",1); - // audio = 0; - // sound_init_audio(); - // if (G.f & G_DEBUG) printf("setting audio to: %d\n", audio); } #ifndef DISABLE_PYTHON /** - * NOTE: the U.pythondir string is NULL until BIF_init() is executed, + * NOTE: the U.pythondir string is NULL until WM_init() is executed, * so we provide the BPY_ function below to append the user defined * pythondir to Python's sys.path at this point. Simply putting - * BIF_init() before BPY_start_python() crashes Blender at startup. + * WM_init() before BPY_start_python() crashes Blender at startup. * Update: now this function also inits the bpymenus, which also depend * on U.pythondir. */ BPY_post_start_python(); + + if(!G.background) + BPY_run_ui_scripts(C, 0); /* dont need to reload the first time */ #endif + CTX_py_init_set(C, 1); + if(!G.background) + WM_keymap_init(C); /* after BPY_run_ui_scripts() */ + #ifdef WITH_QUICKTIME quicktime_init(); @@ -646,35 +593,26 @@ int main(int argc, char **argv) } case 'f': a++; - if (G.scene) { + if (CTX_data_scene(C)) { + Scene *scene= CTX_data_scene(C); + if (a < argc) { - int frame= MIN2(MAXFRAME, MAX2(1, atoi(argv[a]))); - Render *re= RE_NewRender(G.scene->id.name); -#ifndef DISABLE_PYTHON - if (G.f & G_DOSCRIPTLINKS) - BPY_do_all_scripts(SCRIPT_RENDER, 0); -#endif - RE_BlenderAnim(re, G.scene, frame, frame, G.scene->frame_step); -#ifndef DISABLE_PYTHON - BPY_do_all_scripts(SCRIPT_POSTRENDER, 0); -#endif + int frame = atoi(argv[a]); + Render *re = RE_NewRender(scene->id.name); + + frame = MIN2(MAXFRAME, MAX2(1, frame)); + + RE_BlenderAnim(re, scene, frame, frame, scene->frame_step); } } else { printf("\nError: no blend loaded. cannot use '-f'.\n"); } break; case 'a': - if (G.scene) { - Render *re= RE_NewRender(G.scene->id.name); -#ifndef DISABLE_PYTHON - if (G.f & G_DOSCRIPTLINKS) - BPY_do_all_scripts(SCRIPT_RENDER, 1); -#endif - RE_BlenderAnim(re, G.scene, G.scene->r.sfra, G.scene->r.efra, G.scene->frame_step); -#ifndef DISABLE_PYTHON - if (G.f & G_DOSCRIPTLINKS) - BPY_do_all_scripts(SCRIPT_POSTRENDER, 1); -#endif + if (CTX_data_scene(C)) { + Scene *scene= CTX_data_scene(C); + Render *re= RE_NewRender(scene->id.name); + RE_BlenderAnim(re, scene, scene->r.sfra, scene->r.efra, scene->frame_step); } else { printf("\nError: no blend loaded. cannot use '-a'.\n"); } @@ -686,33 +624,48 @@ int main(int argc, char **argv) break; case 's': a++; - if(G.scene) { - int frame= MIN2(MAXFRAME, MAX2(1, atoi(argv[a]))); - if (a < argc) (G.scene->r.sfra) = frame; + if (CTX_data_scene(C)) { + Scene *scene= CTX_data_scene(C); + if (a < argc) { + int frame = atoi(argv[a]); + (scene->r.sfra) = MIN2(MAXFRAME, MAX2(1, frame)); + } } else { printf("\nError: no blend loaded. cannot use '-s'.\n"); } break; case 'e': a++; - if(G.scene) { - int frame= MIN2(MAXFRAME, MAX2(1, atoi(argv[a]))); - if (a < argc) (G.scene->r.efra) = frame; + if (CTX_data_scene(C)) { + Scene *scene= CTX_data_scene(C); + if (a < argc) { + int frame = atoi(argv[a]); + (scene->r.efra) = MIN2(MAXFRAME, MAX2(1, frame)); + } } else { printf("\nError: no blend loaded. cannot use '-e'.\n"); } break; case 'j': a++; - if(G.scene) { - int fstep= MIN2(MAXFRAME, MAX2(1, atoi(argv[a]))); - if (a < argc) (G.scene->frame_step) = fstep; + if (CTX_data_scene(C)) { + Scene *scene= CTX_data_scene(C); + if (a < argc) { + int frame = atoi(argv[a]); + (scene->frame_step) = MIN2(MAXFRAME, MAX2(1, frame)); + } } else { printf("\nError: no blend loaded. cannot use '-j'.\n"); } break; case 'P': + #ifndef DISABLE_PYTHON + //XXX + // FOR TESTING ONLY + a++; + BPY_run_python_script(C, argv[a], NULL, NULL); // use reports? +#if 0 a++; if (a < argc) { /* If we're not running in background mode, then give python a valid screen */ @@ -720,9 +673,10 @@ int main(int argc, char **argv) main_init_screen(); scr_init = 1; } - BPY_run_python_script (argv[a]); + BPY_run_python_script(C, argv[a], NULL, NULL); // use reports? } else printf("\nError: you must specify a Python script after '-P '.\n"); +#endif #else printf("This blender was built without python support\n"); #endif /* DISABLE_PYTHON */ @@ -730,8 +684,9 @@ int main(int argc, char **argv) case 'o': a++; if (a < argc){ - if(G.scene) { - BLI_strncpy(G.scene->r.pic, argv[a], FILE_MAXDIR); + if (CTX_data_scene(C)) { + Scene *scene= CTX_data_scene(C); + BLI_strncpy(scene->r.pic, argv[a], FILE_MAXDIR); } else { printf("\nError: no blend loaded. cannot use '-o'.\n"); } @@ -739,38 +694,83 @@ int main(int argc, char **argv) printf("\nError: you must specify a path after '-o '.\n"); } break; + case 'E': + a++; + if (a < argc) + { + if (!strcmp(argv[a],"help")) + { + RenderEngineType *type = NULL; + + for( type = R_engines.first; type; type = type->next ) + { + printf("\t%s\n", type->idname); + } + exit(0); + } + else + { + if (CTX_data_scene(C)==NULL) + { + printf("\nError: no blend loaded. order the arguments so '-E ' is after the blend is loaded.\n"); + } + else + { + Scene *scene= CTX_data_scene(C); + RenderData *rd = &scene->r; + RenderEngineType *type = NULL; + + for( type = R_engines.first; type; type = type->next ) + { + if (!strcmp(argv[a],type->idname)) + { + BLI_strncpy(rd->engine, type->idname, sizeof(rd->engine)); + } + } + } + } + } + else + { + printf("\nEngine not specified.\n"); + } + break; case 'F': a++; if (a < argc){ - if(!G.scene) { + if (CTX_data_scene(C)==NULL) { printf("\nError: no blend loaded. order the arguments so '-F ' is after the blend is loaded.\n"); } else { - if (!strcmp(argv[a],"TGA")) G.scene->r.imtype = R_TARGA; - else if (!strcmp(argv[a],"IRIS")) G.scene->r.imtype = R_IRIS; - else if (!strcmp(argv[a],"HAMX")) G.scene->r.imtype = R_HAMX; + Scene *scene= CTX_data_scene(C); + if (!strcmp(argv[a],"TGA")) scene->r.imtype = R_TARGA; + else if (!strcmp(argv[a],"IRIS")) scene->r.imtype = R_IRIS; + else if (!strcmp(argv[a],"HAMX")) scene->r.imtype = R_HAMX; #ifdef WITH_DDS - else if (!strcmp(argv[a],"DDS")) G.scene->r.imtype = R_DDS; + else if (!strcmp(argv[a],"DDS")) scene->r.imtype = R_DDS; #endif - else if (!strcmp(argv[a],"JPEG")) G.scene->r.imtype = R_JPEG90; - else if (!strcmp(argv[a],"MOVIE")) G.scene->r.imtype = R_MOVIE; - else if (!strcmp(argv[a],"IRIZ")) G.scene->r.imtype = R_IRIZ; - else if (!strcmp(argv[a],"RAWTGA")) G.scene->r.imtype = R_RAWTGA; - else if (!strcmp(argv[a],"AVIRAW")) G.scene->r.imtype = R_AVIRAW; - else if (!strcmp(argv[a],"AVIJPEG")) G.scene->r.imtype = R_AVIJPEG; - else if (!strcmp(argv[a],"PNG")) G.scene->r.imtype = R_PNG; - else if (!strcmp(argv[a],"AVICODEC")) G.scene->r.imtype = R_AVICODEC; - else if (!strcmp(argv[a],"QUICKTIME")) G.scene->r.imtype = R_QUICKTIME; - else if (!strcmp(argv[a],"BMP")) G.scene->r.imtype = R_BMP; - else if (!strcmp(argv[a],"HDR")) G.scene->r.imtype = R_RADHDR; - else if (!strcmp(argv[a],"TIFF")) G.scene->r.imtype = R_TIFF; + else if (!strcmp(argv[a],"JPEG")) scene->r.imtype = R_JPEG90; + else if (!strcmp(argv[a],"MOVIE")) scene->r.imtype = R_MOVIE; + else if (!strcmp(argv[a],"IRIZ")) scene->r.imtype = R_IRIZ; + else if (!strcmp(argv[a],"RAWTGA")) scene->r.imtype = R_RAWTGA; + else if (!strcmp(argv[a],"AVIRAW")) scene->r.imtype = R_AVIRAW; + else if (!strcmp(argv[a],"AVIJPEG")) scene->r.imtype = R_AVIJPEG; + else if (!strcmp(argv[a],"PNG")) scene->r.imtype = R_PNG; + else if (!strcmp(argv[a],"AVICODEC")) scene->r.imtype = R_AVICODEC; + else if (!strcmp(argv[a],"QUICKTIME")) scene->r.imtype = R_QUICKTIME; + else if (!strcmp(argv[a],"BMP")) scene->r.imtype = R_BMP; + else if (!strcmp(argv[a],"HDR")) scene->r.imtype = R_RADHDR; + else if (!strcmp(argv[a],"TIFF")) scene->r.imtype = R_TIFF; #ifdef WITH_OPENEXR - else if (!strcmp(argv[a],"EXR")) G.scene->r.imtype = R_OPENEXR; - else if (!strcmp(argv[a],"MULTILAYER")) G.scene->r.imtype = R_MULTILAYER; + else if (!strcmp(argv[a],"EXR")) scene->r.imtype = R_OPENEXR; + else if (!strcmp(argv[a],"MULTILAYER")) scene->r.imtype = R_MULTILAYER; +#endif + else if (!strcmp(argv[a],"MPEG")) scene->r.imtype = R_FFMPEG; + else if (!strcmp(argv[a],"FRAMESERVER")) scene->r.imtype = R_FRAMESERVER; + else if (!strcmp(argv[a],"CINEON")) scene->r.imtype = R_CINEON; + else if (!strcmp(argv[a],"DPX")) scene->r.imtype = R_DPX; +#if WITH_OPENJPEG + else if (!strcmp(argv[a],"JP2")) scene->r.imtype = R_JP2; #endif - else if (!strcmp(argv[a],"MPEG")) G.scene->r.imtype = R_FFMPEG; - else if (!strcmp(argv[a],"FRAMESERVER")) G.scene->r.imtype = R_FRAMESERVER; - else if (!strcmp(argv[a],"CINEON")) G.scene->r.imtype = R_CINEON; - else if (!strcmp(argv[a],"DPX")) G.scene->r.imtype = R_DPX; else printf("\nError: Format from '-F' not known or not compiled in this release.\n"); } } else { @@ -780,20 +780,25 @@ int main(int argc, char **argv) case 't': a++; - if(G.background) { - RE_set_max_threads(atoi(argv[a])); + if (a < argc) { + if(G.background) { + RE_set_max_threads(atoi(argv[a])); + } else { + printf("Warning: threads can only be set in background mode\n"); + } } else { - printf("Warning: threads can only be set in background mode\n"); + printf("\nError: you must specify a number of threads between 0 and 8 '-t '.\n"); } break; case 'x': /* extension */ a++; if (a < argc) { - if(G.scene) { + if (CTX_data_scene(C)) { + Scene *scene= CTX_data_scene(C); if (argv[a][0] == '0') { - G.scene->r.scemode &= ~R_EXTENSION; + scene->r.scemode &= ~R_EXTENSION; } else if (argv[a][0] == '1') { - G.scene->r.scemode |= R_EXTENSION; + scene->r.scemode |= R_EXTENSION; } else { printf("\nError: Use '-x 1' or '-x 0' To set the extension option.\n"); } @@ -815,47 +820,49 @@ int main(int argc, char **argv) BLI_convertstringcwd(filename); if (G.background) { - int retval = BKE_read_file(filename, NULL); - sound_initialize_sounds(); - FRS_initialize(); + int retval = BKE_read_file(C, argv[a], NULL, NULL); /*we successfully loaded a blend file, get sure that pointcache works */ if (retval!=0) G.relbase_valid = 1; - /* happens for the UI on file reading too */ - BKE_reset_undo(); - BKE_write_undo("original"); /* save current state */ + /* happens for the UI on file reading too (huh? (ton))*/ +// XXX BKE_reset_undo(); +// BKE_write_undo("original"); /* save current state */ } else { /* we are not running in background mode here, but start blender in UI mode with a file - this should do everything a 'load file' does */ - BIF_read_file(filename); + WM_read_file(C, filename, NULL); } } } - + if(G.background) { /* actually incorrect, but works for now (ton) */ - exit_usiblender(); + WM_exit(C); } + + + WM_main(C); - if (scr_init==0) { + /*XXX if (scr_init==0) { main_init_screen(); } - screenmain(); /* main display loop */ + screenmain();*/ /* main display loop */ return 0; } /* end of int main(argc,argv) */ static void error_cb(char *err) { - error("%s", err); + + printf("%s\n", err); /* XXX do this in WM too */ } static void mem_error_cb(char *errorStr) { - fprintf(stderr, errorStr); + fputs(errorStr, stderr); fflush(stderr); } @@ -868,6 +875,6 @@ static void setCallbacks(void) /* BLI_blenlib: */ BLI_setErrorCallBack(error_cb); /* */ - BLI_setInterruptCallBack(blender_test_break); +// XXX BLI_setInterruptCallBack(blender_test_break); } |