forked from bartvdbraak/blender
svn merge -r37793:37865 https://svn.blender.org/svnroot/bf-blender/trunk/blender
Merge info was /trunk/blender:36835-37793,37865-38157 so this should merge in missing files.
This commit is contained in:
commit
b8fc3030b5
136
CMakeLists.txt
136
CMakeLists.txt
@ -53,9 +53,13 @@ if(NOT EXECUTABLE_OUTPUT_PATH)
|
|||||||
set(FIRST_RUN "TRUE")
|
set(FIRST_RUN "TRUE")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
# this starts out unset
|
# this starts out unset
|
||||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/build_files/cmake/Modules")
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/build_files/cmake/Modules")
|
||||||
|
|
||||||
|
# avoid having empty buildtype
|
||||||
|
set(CMAKE_BUILD_TYPE_INIT "Release")
|
||||||
|
|
||||||
# quiet output for Makefiles, 'make -s' helps too
|
# quiet output for Makefiles, 'make -s' helps too
|
||||||
# set_property(GLOBAL PROPERTY RULE_MESSAGES OFF)
|
# set_property(GLOBAL PROPERTY RULE_MESSAGES OFF)
|
||||||
|
|
||||||
@ -141,7 +145,7 @@ option(WITH_IMAGE_HDR "Enable HDR Image Support" ON)
|
|||||||
option(WITH_IMAGE_REDCODE "Enable RedCode Image Support" OFF)
|
option(WITH_IMAGE_REDCODE "Enable RedCode Image Support" OFF)
|
||||||
|
|
||||||
# Audio/Video format support
|
# Audio/Video format support
|
||||||
option(WITH_CODEC_FFMPEG "Enable FFMPeg Support (http://ffmpeg.org)" OFF)
|
option(WITH_CODEC_FFMPEG "Enable FFMPeg Support (http://ffmpeg.mplayerhq.hu)" OFF)
|
||||||
option(WITH_CODEC_SNDFILE "Enable libsndfile Support (http://www.mega-nerd.com/libsndfile)" OFF)
|
option(WITH_CODEC_SNDFILE "Enable libsndfile Support (http://www.mega-nerd.com/libsndfile)" OFF)
|
||||||
if(APPLE OR (WIN32 AND NOT UNIX))
|
if(APPLE OR (WIN32 AND NOT UNIX))
|
||||||
option(WITH_CODEC_QUICKTIME "Enable Quicktime Support" OFF)
|
option(WITH_CODEC_QUICKTIME "Enable Quicktime Support" OFF)
|
||||||
@ -239,24 +243,11 @@ TEST_SSE_SUPPORT()
|
|||||||
set(WITH_BINRELOC OFF)
|
set(WITH_BINRELOC OFF)
|
||||||
|
|
||||||
# MAXOSX only, set to avoid uninitialized
|
# MAXOSX only, set to avoid uninitialized
|
||||||
set(EXETYPE)
|
set(EXETYPE "")
|
||||||
|
|
||||||
# C/C++ flags
|
|
||||||
set(PLATFORM_CFLAGS)
|
|
||||||
|
|
||||||
# these are added to later on.
|
# these are added to later on.
|
||||||
set(C_WARNINGS)
|
set(C_WARNINGS "")
|
||||||
set(CXX_WARNINGS)
|
set(CXX_WARNINGS "")
|
||||||
|
|
||||||
# libraries to link the binary with passed to target_link_libraries()
|
|
||||||
# known as LLIBS to scons
|
|
||||||
set(PLATFORM_LINKLIBS)
|
|
||||||
|
|
||||||
# Added to linker flags in setup_liblinks
|
|
||||||
# - CMAKE_EXE_LINKER_FLAGS
|
|
||||||
# - CMAKE_EXE_LINKER_FLAGS_DEBUG
|
|
||||||
set(PLATFORM_LINKFLAGS)
|
|
||||||
set(PLATFORM_LINKFLAGS_DEBUG)
|
|
||||||
|
|
||||||
|
|
||||||
# disabled for now, not supported
|
# disabled for now, not supported
|
||||||
@ -359,7 +350,7 @@ if(UNIX AND NOT APPLE)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_CODEC_FFMPEG)
|
if(WITH_CODEC_FFMPEG)
|
||||||
set(FFMPEG /usr CACHE PATH "FFMPEG Directory")
|
set(FFMPEG /usr CACHE FILEPATH "FFMPEG Directory")
|
||||||
mark_as_advanced(FFMPEG)
|
mark_as_advanced(FFMPEG)
|
||||||
set(FFMPEG_INCLUDE_DIRS ${FFMPEG}/include)
|
set(FFMPEG_INCLUDE_DIRS ${FFMPEG}/include)
|
||||||
set(FFMPEG_LIBRARIES avformat avcodec avutil avdevice swscale CACHE STRING "FFMPEG Libraries")
|
set(FFMPEG_LIBRARIES avformat avcodec avutil avdevice swscale CACHE STRING "FFMPEG Libraries")
|
||||||
@ -403,18 +394,18 @@ if(UNIX AND NOT APPLE)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_OPENCOLLADA)
|
if(WITH_OPENCOLLADA)
|
||||||
set(OPENCOLLADA /usr/local/opencollada CACHE PATH "OpenCollada Directory")
|
set(OPENCOLLADA /usr/local/opencollada CACHE FILEPATH "OpenCollada Directory")
|
||||||
mark_as_advanced(OPENCOLLADA)
|
mark_as_advanced(OPENCOLLADA)
|
||||||
set(OPENCOLLADA_LIBPATH ${OPENCOLLADA}/lib)
|
set(OPENCOLLADA_LIBPATH ${OPENCOLLADA}/lib)
|
||||||
set(OPENCOLLADA_LIBRARIES OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser UTF MathMLSolver pcre ftoa buffer xml2)
|
set(OPENCOLLADA_LIBRARIES OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser UTF MathMLSolver pcre ftoa buffer xml2)
|
||||||
set(OPENCOLLADA_INCLUDE_DIR ${OPENCOLLADA})
|
set(OPENCOLLADA_INCLUDE_DIR ${OPENCOLLADA})
|
||||||
|
|
||||||
set(PCRE /usr CACHE PATH "PCRE Directory")
|
set(PCRE /usr CACHE FILEPATH "PCRE Directory")
|
||||||
mark_as_advanced(PCRE)
|
mark_as_advanced(PCRE)
|
||||||
set(PCRE_LIBPATH ${PCRE}/lib)
|
set(PCRE_LIBPATH ${PCRE}/lib)
|
||||||
set(PCRE_LIB pcre)
|
set(PCRE_LIB pcre)
|
||||||
|
|
||||||
set(EXPAT /usr CACHE PATH "Expat Directory")
|
set(EXPAT /usr CACHE FILEPATH "Expat Directory")
|
||||||
mark_as_advanced(EXPAT)
|
mark_as_advanced(EXPAT)
|
||||||
set(EXPAT_LIBPATH ${EXPAT}/lib)
|
set(EXPAT_LIBPATH ${EXPAT}/lib)
|
||||||
set(EXPAT_LIB expat)
|
set(EXPAT_LIB expat)
|
||||||
@ -428,24 +419,24 @@ if(UNIX AND NOT APPLE)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# OpenSuse needs lutil, ArchLinux not, for now keep, can avoid by using --as-needed
|
# OpenSuse needs lutil, ArchLinux not, for now keep, can avoid by using --as-needed
|
||||||
set(PLATFORM_LINKLIBS "-lutil -lc -lm -lpthread -lstdc++")
|
set(LLIBS "-lutil -lc -lm -lpthread -lstdc++")
|
||||||
|
|
||||||
if(NOT WITH_HEADLESS)
|
if(NOT WITH_HEADLESS)
|
||||||
find_package(X11 REQUIRED)
|
find_package(X11 REQUIRED)
|
||||||
find_path(X11_XF86keysym_INCLUDE_PATH X11/XF86keysym.h ${X11_INC_SEARCH_PATH})
|
find_path(X11_XF86keysym_INCLUDE_PATH X11/XF86keysym.h ${X11_INC_SEARCH_PATH})
|
||||||
mark_as_advanced(X11_XF86keysym_INCLUDE_PATH)
|
mark_as_advanced(X11_XF86keysym_INCLUDE_PATH)
|
||||||
|
|
||||||
list(APPEND PLATFORM_LINKLIBS ${X11_X11_LIB})
|
list(APPEND LLIBS ${X11_X11_LIB})
|
||||||
|
|
||||||
if(WITH_X11_XINPUT)
|
if(WITH_X11_XINPUT)
|
||||||
list(APPEND PLATFORM_LINKLIBS ${X11_Xinput_LIB})
|
list(APPEND LLIBS ${X11_Xinput_LIB})
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||||
if(NOT WITH_PYTHON_MODULE)
|
if(NOT WITH_PYTHON_MODULE)
|
||||||
# BSD's dont use libdl.so
|
# BSD's dont use libdl.so
|
||||||
list(APPEND PLATFORM_LINKLIBS -ldl)
|
list(APPEND LLIBS -ldl)
|
||||||
# binreloc is linux only
|
# binreloc is linux only
|
||||||
set(BINRELOC_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extern/binreloc/include)
|
set(BINRELOC_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extern/binreloc/include)
|
||||||
set(WITH_BINRELOC ON)
|
set(WITH_BINRELOC ON)
|
||||||
@ -556,15 +547,13 @@ elseif(WIN32)
|
|||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
if(CMAKE_CL_64)
|
if(CMAKE_CL_64)
|
||||||
set(PLATFORM_LINKLIBS ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32 advapi32 shfolder shell32 ole32 oleaut32 uuid)
|
set(LLIBS ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32 advapi32 shfolder shell32 ole32 oleaut32 uuid)
|
||||||
else()
|
else()
|
||||||
set(PLATFORM_LINKLIBS ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32 advapi32 shfolder shell32 ole32 oleaut32 uuid)
|
set(LLIBS ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32 advapi32 shfolder shell32 ole32 oleaut32 uuid)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_definitions(/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_CONSOLE /D_LIB)
|
set(CMAKE_CXX_FLAGS "/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_CONSOLE /D_LIB /nologo /Ob1 /J /W0 /Gd /wd4018 /wd4244 /wd4305 /wd4800 /wd4065 /wd4267 /we4013" CACHE STRING "MSVC MT C++ flags " FORCE)
|
||||||
|
set(CMAKE_C_FLAGS "/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_CONSOLE /D_LIB /nologo /Ob1 /J /W0 /Gd /wd4018 /wd4244 /wd4305 /wd4800 /wd4065 /wd4267 /we4013 /EHsc" CACHE STRING "MSVC MT C++ flags " FORCE)
|
||||||
set(CMAKE_CXX_FLAGS "/nologo /J /W0 /Gd /wd4018 /wd4244 /wd4305 /wd4800 /wd4065 /wd4267 /we4013" CACHE STRING "MSVC MT C++ flags " FORCE)
|
|
||||||
set(CMAKE_C_FLAGS "/nologo /J /W0 /Gd /wd4018 /wd4244 /wd4305 /wd4800 /wd4065 /wd4267 /we4013 /EHsc" CACHE STRING "MSVC MT C++ flags " FORCE)
|
|
||||||
|
|
||||||
if(CMAKE_CL_64)
|
if(CMAKE_CL_64)
|
||||||
set(CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG /Od /Gm /EHsc /RTC1 /MTd /W3 /nologo /Zi /J" CACHE STRING "MSVC MT flags " FORCE)
|
set(CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG /Od /Gm /EHsc /RTC1 /MTd /W3 /nologo /Zi /J" CACHE STRING "MSVC MT flags " FORCE)
|
||||||
@ -601,22 +590,24 @@ elseif(WIN32)
|
|||||||
endif()
|
endif()
|
||||||
set(JPEG_LIBRARIES libjpeg)
|
set(JPEG_LIBRARIES libjpeg)
|
||||||
|
|
||||||
set(ZLIB_INCLUDE_DIRS ${LIBDIR}/zlib/include)
|
set(ZLIB ${LIBDIR}/zlib)
|
||||||
|
set(ZLIB_INCLUDE_DIRS ${ZLIB}/include)
|
||||||
|
set(ZLIB_LIBPATH ${ZLIB}/lib)
|
||||||
if(CMAKE_CL_64)
|
if(CMAKE_CL_64)
|
||||||
set(ZLIB_LIBRARIES ${LIBDIR}/zlib/lib/libz.lib)
|
set(ZLIB_LIBRARIES libz)
|
||||||
else()
|
else()
|
||||||
set(ZLIB_LIBRARIES ${LIBDIR}/zlib/lib/zlib.lib)
|
set(ZLIB_LIBRARIES zlib)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(PTHREADS_INCLUDE_DIRS ${LIBDIR}/pthreads/include)
|
set(PTHREADS ${LIBDIR}/pthreads)
|
||||||
set(PTHREADS_LIBRARIES ${LIBDIR}/pthreads/lib/pthreadVC2.lib)
|
set(PTHREADS_INCLUDE_DIRS ${PTHREADS}/include)
|
||||||
|
set(PTHREADS_LIBPATH ${PTHREADS}/lib)
|
||||||
|
set(PTHREADS_LIBRARIES pthreadVC2)
|
||||||
|
|
||||||
set(FREETYPE ${LIBDIR}/freetype)
|
set(FREETYPE ${LIBDIR}/freetype)
|
||||||
set(FREETYPE_INCLUDE_DIRS
|
set(FREETYPE_INCLUDE_DIRS ${FREETYPE}/include ${FREETYPE}/include/freetype2)
|
||||||
${LIBDIR}/freetype/include
|
set(FREETYPE_LIBPATH ${FREETYPE}/lib)
|
||||||
${LIBDIR}/freetype/include/freetype2
|
set(FREETYPE_LIBRARY freetype2ST)
|
||||||
)
|
|
||||||
set(FREETYPE_LIBRARY ${LIBDIR}/freetype/lib/freetype2ST.lib)
|
|
||||||
|
|
||||||
if(WITH_FFTW3)
|
if(WITH_FFTW3)
|
||||||
set(FFTW3 ${LIBDIR}/fftw3)
|
set(FFTW3 ${LIBDIR}/fftw3)
|
||||||
@ -647,17 +638,10 @@ elseif(WIN32)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_CODEC_FFMPEG)
|
if(WITH_CODEC_FFMPEG)
|
||||||
set(FFMPEG_INCLUDE_DIRS
|
set(FFMPEG ${LIBDIR}/ffmpeg)
|
||||||
${LIBDIR}/ffmpeg/include
|
set(FFMPEG_INCLUDE_DIRS ${FFMPEG}/include ${FFMPEG}/include/msvc)
|
||||||
${LIBDIR}/ffmpeg/include/msvc
|
set(FFMPEG_LIBRARIES avcodec-52 avformat-52 avdevice-52 avutil-50 swscale-0)
|
||||||
)
|
set(FFMPEG_LIBPATH ${FFMPEG}/lib)
|
||||||
set(FFMPEG_LIBRARIES
|
|
||||||
${LIBDIR}/ffmpeg/lib/avcodec-52.lib
|
|
||||||
${LIBDIR}/ffmpeg/lib/avformat-52.lib
|
|
||||||
${LIBDIR}/ffmpeg/lib/avdevice-52.lib
|
|
||||||
${LIBDIR}/ffmpeg/lib/avutil-50.lib
|
|
||||||
${LIBDIR}/ffmpeg/lib/swscale-0.lib
|
|
||||||
)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_IMAGE_OPENEXR)
|
if(WITH_IMAGE_OPENEXR)
|
||||||
@ -692,16 +676,17 @@ elseif(WIN32)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_IMAGE_TIFF)
|
if(WITH_IMAGE_TIFF)
|
||||||
set(TIFF_LIBRARY ${LIBDIR}/tiff/lib/libtiff.lib)
|
set(TIFF ${LIBDIR}/tiff)
|
||||||
set(TIFF_INCLUDE_DIR ${LIBDIR}/tiff/include)
|
set(TIFF_LIBRARY libtiff)
|
||||||
|
set(TIFF_INCLUDE_DIR ${TIFF}/include)
|
||||||
|
set(TIFF_LIBPATH ${TIFF}/lib)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_JACK)
|
if(WITH_JACK)
|
||||||
set(JACK_INCLUDE_DIRS
|
set(JACK ${LIBDIR}/jack)
|
||||||
${LIBDIR}/jack/include/jack
|
set(JACK_INCLUDE_DIRS ${JACK}/include/jack ${JACK}/include)
|
||||||
${LIBDIR}/jack/include
|
set(JACK_LIBRARIES libjack)
|
||||||
)
|
set(JACK_LIBPATH ${JACK}/lib)
|
||||||
set(JACK_LIBRARIES ${LIBDIR}/jack/lib/libjack.lib)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_PYTHON)
|
if(WITH_PYTHON)
|
||||||
@ -711,24 +696,23 @@ elseif(WIN32)
|
|||||||
set(PYTHON_LIBRARIES ${LIBDIR}/python/lib/python32.lib)
|
set(PYTHON_LIBRARIES ${LIBDIR}/python/lib/python32.lib)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(PLATFORM_LINKFLAGS "/SUBSYSTEM:CONSOLE /STACK:2097152 /INCREMENTAL:NO /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcmrt.lib /NODEFAULTLIB:msvcurt.lib /NODEFAULTLIB:msvcrtd.lib")
|
|
||||||
|
|
||||||
# MSVC only, Mingw doesnt need
|
# MSVC only, Mingw doesnt need
|
||||||
if(CMAKE_CL_64)
|
if(CMAKE_CL_64)
|
||||||
set(PLATFORM_LINKFLAGS "/MACHINE:X64 /OPT:NOREF ${PLATFORM_LINKFLAGS}")
|
set(PLATFORM_LINKFLAGS "/SUBSYSTEM:CONSOLE /MACHINE:X64 /STACK:2097152 /OPT:NOREF /INCREMENTAL:NO /NODEFAULTLIB:\"msvcrt.lib\" /NODEFAULTLIB:\"msvcmrt.lib\" /NODEFAULTLIB:\"msvcurt.lib\" /NODEFAULTLIB:\"msvcrtd.lib\" ")
|
||||||
else()
|
else()
|
||||||
set(PLATFORM_LINKFLAGS "/MACHINE:IX86 /LARGEADDRESSAWARE ${PLATFORM_LINKFLAGS}")
|
set(PLATFORM_LINKFLAGS "/SUBSYSTEM:CONSOLE /MACHINE:IX86 /STACK:2097152 /INCREMENTAL:NO /LARGEADDRESSAWARE /NODEFAULTLIB:\"msvcrt.lib\" /NODEFAULTLIB:\"msvcmrt.lib\" /NODEFAULTLIB:\"msvcurt.lib\" /NODEFAULTLIB:\"msvcrtd.lib\" ")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(PLATFORM_LINKFLAGS_DEBUG "/NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libc.lib")
|
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:libcmt.lib;libc.lib ")
|
||||||
|
|
||||||
else()
|
else()
|
||||||
# keep GCC spesific stuff here
|
# keep GCC spesific stuff here
|
||||||
if(CMAKE_COMPILER_IS_GNUCC)
|
if(CMAKE_COMPILER_IS_GNUCC)
|
||||||
set(PLATFORM_LINKLIBS "-lshell32 -lshfolder -lgdi32 -lmsvcrt -lwinmm -lmingw32 -lm -lws2_32 -lz -lstdc++ -lole32 -luuid")
|
set(LLIBS "-lshell32 -lshfolder -lgdi32 -lmsvcrt -lwinmm -lmingw32 -lm -lws2_32 -lz -lstdc++ -lole32 -luuid")
|
||||||
set(PLATFORM_CFLAGS "-pipe -funsigned-char -fno-strict-aliasing")
|
set(PLATFORM_CFLAGS "-pipe -funsigned-char -fno-strict-aliasing")
|
||||||
|
|
||||||
add_definitions(-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE)
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_definitions(-DFREE_WINDOWS)
|
add_definitions(-DFREE_WINDOWS)
|
||||||
@ -938,7 +922,7 @@ elseif(APPLE)
|
|||||||
set(SAMPLERATE_LIBPATH ${SAMPLERATE}/lib)
|
set(SAMPLERATE_LIBPATH ${SAMPLERATE}/lib)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(PLATFORM_LINKLIBS stdc++ SystemStubs)
|
set(LLIBS stdc++ SystemStubs)
|
||||||
|
|
||||||
if(WITH_COCOA)
|
if(WITH_COCOA)
|
||||||
set(PLATFORM_CFLAGS "-pipe -funsigned-char -DGHOST_COCOA")
|
set(PLATFORM_CFLAGS "-pipe -funsigned-char -DGHOST_COCOA")
|
||||||
@ -1015,7 +999,7 @@ endif()
|
|||||||
# Common.
|
# Common.
|
||||||
|
|
||||||
if(APPLE OR WIN32)
|
if(APPLE OR WIN32)
|
||||||
if(NOT IS_DIRECTORY "${LIBDIR}")
|
if(NOT EXISTS "${LIBDIR}/")
|
||||||
message(FATAL_ERROR "Apple and Windows require pre-compiled libs at: '${LIBDIR}'")
|
message(FATAL_ERROR "Apple and Windows require pre-compiled libs at: '${LIBDIR}'")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
@ -1162,18 +1146,6 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "Intel")
|
|||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# MSVC2010 fails to links C++ libs right
|
|
||||||
if(MSVC10)
|
|
||||||
if(WITH_IMAGE_OPENEXR)
|
|
||||||
message(WARNING "MSVC 2010 does not support OpenEXR, disabling WITH_IMAGE_OPENEXR. To enable support use Use MSVC 2008")
|
|
||||||
set(WITH_IMAGE_OPENEXR OFF)
|
|
||||||
endif()
|
|
||||||
if(WITH_OPENCOLLADA)
|
|
||||||
message(WARNING "MSVC 2010 does not support OpenCollada, disabling WITH_OPENCOLLADA. To enable support use Use MSVC 2008")
|
|
||||||
set(WITH_OPENCOLLADA OFF)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||||
if(WITH_IK_ITASC OR WITH_MOD_FLUID)
|
if(WITH_IK_ITASC OR WITH_MOD_FLUID)
|
||||||
message(WARNING "Using Clang as CXX compiler: disabling WITH_IK_ITASC and WITH_MOD_FLUID, these features will be missing.")
|
message(WARNING "Using Clang as CXX compiler: disabling WITH_IK_ITASC and WITH_MOD_FLUID, these features will be missing.")
|
||||||
|
@ -75,7 +75,8 @@ all:
|
|||||||
@echo Building Blender ...
|
@echo Building Blender ...
|
||||||
make -C $(BUILD_DIR) -s -j $(NPROCS) install
|
make -C $(BUILD_DIR) -s -j $(NPROCS) install
|
||||||
@echo
|
@echo
|
||||||
@echo run blender from "$(BUILD_DIR)/bin/blender"
|
@echo edit build configuration with: "$(BUILD_DIR)/CMakeCache.txt" run make again to rebuild.
|
||||||
|
@echo blender installed, run from: "$(BUILD_DIR)/bin/blender"
|
||||||
@echo
|
@echo
|
||||||
|
|
||||||
debug: all
|
debug: all
|
||||||
|
@ -39,6 +39,21 @@ macro(file_list_suffix
|
|||||||
|
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
|
||||||
|
macro(target_link_libraries_optimized TARGET LIBS)
|
||||||
|
foreach(_LIB ${LIBS})
|
||||||
|
target_link_libraries(${TARGET} optimized "${_LIB}")
|
||||||
|
endforeach()
|
||||||
|
unset(_LIB)
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
macro(target_link_libraries_debug TARGET LIBS)
|
||||||
|
foreach(_LIB ${LIBS})
|
||||||
|
target_link_libraries(${TARGET} debug "${_LIB}")
|
||||||
|
endforeach()
|
||||||
|
unset(_LIB)
|
||||||
|
endmacro()
|
||||||
|
|
||||||
# Nicer makefiles with -I/1/foo/ instead of -I/1/2/3/../../foo/
|
# Nicer makefiles with -I/1/foo/ instead of -I/1/2/3/../../foo/
|
||||||
# use it instead of include_directories()
|
# use it instead of include_directories()
|
||||||
macro(blender_include_dirs
|
macro(blender_include_dirs
|
||||||
@ -204,9 +219,8 @@ macro(setup_liblinks
|
|||||||
|
|
||||||
if(WIN32 AND NOT UNIX)
|
if(WIN32 AND NOT UNIX)
|
||||||
file_list_suffix(PYTHON_LIBRARIES_DEBUG "${PYTHON_LIBRARIES}" "_d")
|
file_list_suffix(PYTHON_LIBRARIES_DEBUG "${PYTHON_LIBRARIES}" "_d")
|
||||||
target_link_libraries(${target}
|
target_link_libraries_debug(${target} "${PYTHON_LIBRARIES_DEBUG}")
|
||||||
debug ${PYTHON_LIBRARIES_DEBUG}
|
target_link_libraries_optimized(${target} "${PYTHON_LIBRARIES}")
|
||||||
optimized ${PYTHON_LIBRARIES})
|
|
||||||
unset(PYTHON_LIBRARIES_DEBUG)
|
unset(PYTHON_LIBRARIES_DEBUG)
|
||||||
else()
|
else()
|
||||||
target_link_libraries(${target} ${PYTHON_LIBRARIES})
|
target_link_libraries(${target} ${PYTHON_LIBRARIES})
|
||||||
@ -259,9 +273,8 @@ macro(setup_liblinks
|
|||||||
if(WITH_IMAGE_OPENEXR)
|
if(WITH_IMAGE_OPENEXR)
|
||||||
if(WIN32 AND NOT UNIX)
|
if(WIN32 AND NOT UNIX)
|
||||||
file_list_suffix(OPENEXR_LIBRARIES_DEBUG "${OPENEXR_LIBRARIES}" "_d")
|
file_list_suffix(OPENEXR_LIBRARIES_DEBUG "${OPENEXR_LIBRARIES}" "_d")
|
||||||
target_link_libraries(${target}
|
target_link_libraries_debug(${target} "${OPENEXR_LIBRARIES_DEBUG}")
|
||||||
debug ${OPENEXR_LIBRARIES_DEBUG}
|
target_link_libraries_optimized(${target} "${OPENEXR_LIBRARIES}")
|
||||||
optimized ${OPENEXR_LIBRARIES})
|
|
||||||
unset(OPENEXR_LIBRARIES_DEBUG)
|
unset(OPENEXR_LIBRARIES_DEBUG)
|
||||||
else()
|
else()
|
||||||
target_link_libraries(${target} ${OPENEXR_LIBRARIES})
|
target_link_libraries(${target} ${OPENEXR_LIBRARIES})
|
||||||
@ -276,22 +289,19 @@ macro(setup_liblinks
|
|||||||
if(WITH_OPENCOLLADA)
|
if(WITH_OPENCOLLADA)
|
||||||
if(WIN32 AND NOT UNIX)
|
if(WIN32 AND NOT UNIX)
|
||||||
file_list_suffix(OPENCOLLADA_LIBRARIES_DEBUG "${OPENCOLLADA_LIBRARIES}" "_d")
|
file_list_suffix(OPENCOLLADA_LIBRARIES_DEBUG "${OPENCOLLADA_LIBRARIES}" "_d")
|
||||||
target_link_libraries(${target}
|
target_link_libraries_debug(${target} "${OPENCOLLADA_LIBRARIES_DEBUG}")
|
||||||
debug ${OPENCOLLADA_LIBRARIES_DEBUG}
|
target_link_libraries_optimized(${target} "${OPENCOLLADA_LIBRARIES}")
|
||||||
optimized ${OPENCOLLADA_LIBRARIES})
|
|
||||||
unset(OPENCOLLADA_LIBRARIES_DEBUG)
|
unset(OPENCOLLADA_LIBRARIES_DEBUG)
|
||||||
|
|
||||||
file_list_suffix(PCRE_LIB_DEBUG "${PCRE_LIB}" "_d")
|
file_list_suffix(PCRE_LIB_DEBUG "${PCRE_LIB}" "_d")
|
||||||
target_link_libraries(${target}
|
target_link_libraries_debug(${target} "${PCRE_LIB_DEBUG}")
|
||||||
debug ${PCRE_LIB_DEBUG}
|
target_link_libraries_optimized(${target} "${PCRE_LIB}")
|
||||||
optimized ${PCRE_LIB})
|
|
||||||
unset(PCRE_LIB_DEBUG)
|
unset(PCRE_LIB_DEBUG)
|
||||||
|
|
||||||
if(EXPAT_LIB)
|
if(EXPAT_LIB)
|
||||||
file_list_suffix(EXPAT_LIB_DEBUG "${EXPAT_LIB}" "_d")
|
file_list_suffix(EXPAT_LIB_DEBUG "${EXPAT_LIB}" "_d")
|
||||||
target_link_libraries(${target}
|
target_link_libraries_debug(${target} "${EXPAT_LIB_DEBUG}")
|
||||||
debug ${EXPAT_LIB_DEBUG}
|
target_link_libraries_optimized(${target} "${EXPAT_LIB}")
|
||||||
optimized ${EXPAT_LIB})
|
|
||||||
unset(EXPAT_LIB_DEBUG)
|
unset(EXPAT_LIB_DEBUG)
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
|
@ -76,11 +76,6 @@ BF_GETTEXT_INC = '${BF_GETTEXT}/include'
|
|||||||
BF_GETTEXT_LIB = 'gettextpo intl'
|
BF_GETTEXT_LIB = 'gettextpo intl'
|
||||||
BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
|
BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
|
||||||
|
|
||||||
WITH_BF_FTGL = 'false'
|
|
||||||
BF_FTGL = '#extern/bFTGL'
|
|
||||||
BF_FTGL_INC = '${BF_FTGL}/include'
|
|
||||||
BF_FTGL_LIB = 'extern_ftgl'
|
|
||||||
|
|
||||||
WITH_BF_GAMEENGINE='false'
|
WITH_BF_GAMEENGINE='false'
|
||||||
|
|
||||||
WITH_BF_BULLET = 'true'
|
WITH_BF_BULLET = 'true'
|
||||||
|
@ -170,7 +170,7 @@ BGE_CXXFLAGS = ['/O2', '/EHsc', '/GR', '/fp:fast', '/arch:SSE']
|
|||||||
|
|
||||||
BF_DEBUG_CCFLAGS = ['/Zi', '/FR${TARGET}.sbr']
|
BF_DEBUG_CCFLAGS = ['/Zi', '/FR${TARGET}.sbr']
|
||||||
|
|
||||||
CPPFLAGS = ['-DWIN32','-D_CONSOLE', '-D_LIB', '-DFTGL_LIBRARY_STATIC', '-D_CRT_SECURE_NO_DEPRECATE']
|
CPPFLAGS = ['-DWIN32','-D_CONSOLE', '-D_LIB', '-D_CRT_SECURE_NO_DEPRECATE']
|
||||||
REL_CFLAGS = ['-O2', '-DNDEBUG']
|
REL_CFLAGS = ['-O2', '-DNDEBUG']
|
||||||
REL_CCFLAGS = ['-O2', '-DNDEBUG']
|
REL_CCFLAGS = ['-O2', '-DNDEBUG']
|
||||||
REL_CXXFLAGS = ['-O2', '-DNDEBUG']
|
REL_CXXFLAGS = ['-O2', '-DNDEBUG']
|
||||||
|
@ -174,7 +174,7 @@ BGE_CXXFLAGS = ['/O2', '/EHsc', '/GR', '/fp:fast']
|
|||||||
|
|
||||||
BF_DEBUG_CCFLAGS = ['/Zi', '/FR${TARGET}.sbr', '/Od']
|
BF_DEBUG_CCFLAGS = ['/Zi', '/FR${TARGET}.sbr', '/Od']
|
||||||
|
|
||||||
CPPFLAGS = ['-DWIN32', '-D_CONSOLE', '-D_LIB', '-DFTGL_LIBRARY_STATIC', '-D_CRT_SECURE_NO_DEPRECATE']
|
CPPFLAGS = ['-DWIN32', '-D_CONSOLE', '-D_LIB', '-D_CRT_SECURE_NO_DEPRECATE']
|
||||||
REL_CFLAGS = ['-O2', '-DNDEBUG']
|
REL_CFLAGS = ['-O2', '-DNDEBUG']
|
||||||
REL_CCFLAGS = ['-O2', '-DNDEBUG']
|
REL_CCFLAGS = ['-O2', '-DNDEBUG']
|
||||||
REL_CXXFLAGS = ['-O2', '-DNDEBUG']
|
REL_CXXFLAGS = ['-O2', '-DNDEBUG']
|
||||||
|
21
doc/python_api/examples/aud.py
Normal file
21
doc/python_api/examples/aud.py
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
"""
|
||||||
|
Basic Sound Playback
|
||||||
|
++++++++++++++++++++
|
||||||
|
This script shows how to use the classes: :class:`Device`, :class:`Factory` and
|
||||||
|
:class:`Handle`.
|
||||||
|
"""
|
||||||
|
import aud
|
||||||
|
|
||||||
|
device = aud.device()
|
||||||
|
# load sound file (it can be a video file with audio)
|
||||||
|
factory = aud.Factory('music.ogg')
|
||||||
|
|
||||||
|
# play the audio, this return a handle to control play/pause
|
||||||
|
handle = device.play(sound)
|
||||||
|
# if the audio is not too big and will be used often you can buffer it
|
||||||
|
factory_buffered = aud.Factory.buffer(sound)
|
||||||
|
handle_buffered = device.play(buffered)
|
||||||
|
|
||||||
|
# stop the sounds (otherwise they play until their ends)
|
||||||
|
handle.stop()
|
||||||
|
handle_buffered.stop()
|
@ -700,6 +700,23 @@ Renamed
|
|||||||
2.57 to 2.58
|
2.57 to 2.58
|
||||||
============
|
============
|
||||||
|
|
||||||
|
bpy_extras
|
||||||
|
----------
|
||||||
|
|
||||||
|
Added
|
||||||
|
^^^^^
|
||||||
|
|
||||||
|
* :mod:`bpy_extras`
|
||||||
|
* :mod:`bpy_extras.view3d_utils`
|
||||||
|
|
||||||
|
Moved
|
||||||
|
^^^^^
|
||||||
|
|
||||||
|
* io_utils -> :mod:`bpy_extras.io_utils`
|
||||||
|
* image_utils -> :mod:`bpy_extras.image_utils`
|
||||||
|
* mesh_utils -> :mod:`bpy_extras.mesh_utils`
|
||||||
|
* object_utils -> :mod:`bpy_extras.object_utils`
|
||||||
|
|
||||||
bpy.types.RenderSettings
|
bpy.types.RenderSettings
|
||||||
------------------------
|
------------------------
|
||||||
|
|
||||||
|
@ -29,15 +29,15 @@ For HTML generation
|
|||||||
|
|
||||||
./blender.bin --background --python doc/python_api/sphinx_doc_gen.py
|
./blender.bin --background --python doc/python_api/sphinx_doc_gen.py
|
||||||
|
|
||||||
This will generate python files in doc/python_api/sphinx-in/,
|
This will generate python files in doc/python_api/sphinx-in/
|
||||||
assuming that ./blender.bin is or links to the blender executable
|
providing ./blender.bin is or links to the blender executable
|
||||||
|
|
||||||
- Generate html docs by running...
|
- Generate html docs by running...
|
||||||
|
|
||||||
cd doc/python_api
|
cd doc/python_api
|
||||||
sphinx-build sphinx-in sphinx-out
|
sphinx-build sphinx-in sphinx-out
|
||||||
|
|
||||||
assuming that you have sphinx 1.0.7 installed
|
This requires sphinx 1.0.7 to be installed.
|
||||||
|
|
||||||
For PDF generation
|
For PDF generation
|
||||||
------------------
|
------------------
|
||||||
@ -48,6 +48,15 @@ For PDF generation
|
|||||||
make
|
make
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
# Check we're running in blender
|
||||||
|
if __import__("sys").modules.get("bpy") is None:
|
||||||
|
print("\nError, this script must run from inside blender2.5")
|
||||||
|
print(script_help_msg)
|
||||||
|
|
||||||
|
import sys
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
|
||||||
# Switch for quick testing
|
# Switch for quick testing
|
||||||
if 1:
|
if 1:
|
||||||
# full build
|
# full build
|
||||||
@ -1198,72 +1207,67 @@ def rna2sphinx(BASEPATH):
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
import bpy
|
import shutil
|
||||||
if 'bpy' not in dir():
|
|
||||||
print("\nError, this script must run from inside blender2.5")
|
script_dir = os.path.dirname(__file__)
|
||||||
print(script_help_msg)
|
path_in = os.path.join(script_dir, "sphinx-in")
|
||||||
|
path_out = os.path.join(script_dir, "sphinx-out")
|
||||||
|
path_examples = os.path.join(script_dir, "examples")
|
||||||
|
# only for partial updates
|
||||||
|
path_in_tmp = path_in + "-tmp"
|
||||||
|
|
||||||
|
if not os.path.exists(path_in):
|
||||||
|
os.mkdir(path_in)
|
||||||
|
|
||||||
|
for f in os.listdir(path_examples):
|
||||||
|
if f.endswith(".py"):
|
||||||
|
EXAMPLE_SET.add(os.path.splitext(f)[0])
|
||||||
|
|
||||||
|
# only for full updates
|
||||||
|
if _BPY_FULL_REBUILD:
|
||||||
|
shutil.rmtree(path_in, True)
|
||||||
|
shutil.rmtree(path_out, True)
|
||||||
else:
|
else:
|
||||||
import shutil
|
# write here, then move
|
||||||
|
shutil.rmtree(path_in_tmp, True)
|
||||||
|
|
||||||
script_dir = os.path.dirname(__file__)
|
rna2sphinx(path_in_tmp)
|
||||||
path_in = os.path.join(script_dir, "sphinx-in")
|
|
||||||
path_out = os.path.join(script_dir, "sphinx-out")
|
|
||||||
path_examples = os.path.join(script_dir, "examples")
|
|
||||||
# only for partial updates
|
|
||||||
path_in_tmp = path_in + "-tmp"
|
|
||||||
|
|
||||||
if not os.path.exists(path_in):
|
if not _BPY_FULL_REBUILD:
|
||||||
os.mkdir(path_in)
|
import filecmp
|
||||||
|
|
||||||
for f in os.listdir(path_examples):
|
# now move changed files from 'path_in_tmp' --> 'path_in'
|
||||||
if f.endswith(".py"):
|
file_list_path_in = set(os.listdir(path_in))
|
||||||
EXAMPLE_SET.add(os.path.splitext(f)[0])
|
file_list_path_in_tmp = set(os.listdir(path_in_tmp))
|
||||||
|
|
||||||
# only for full updates
|
# remove deprecated files that have been removed.
|
||||||
if _BPY_FULL_REBUILD:
|
for f in sorted(file_list_path_in):
|
||||||
shutil.rmtree(path_in, True)
|
if f not in file_list_path_in_tmp:
|
||||||
shutil.rmtree(path_out, True)
|
print("\tdeprecated: %s" % f)
|
||||||
else:
|
os.remove(os.path.join(path_in, f))
|
||||||
# write here, then move
|
|
||||||
shutil.rmtree(path_in_tmp, True)
|
|
||||||
|
|
||||||
rna2sphinx(path_in_tmp)
|
# freshen with new files.
|
||||||
|
for f in sorted(file_list_path_in_tmp):
|
||||||
|
f_from = os.path.join(path_in_tmp, f)
|
||||||
|
f_to = os.path.join(path_in, f)
|
||||||
|
|
||||||
if not _BPY_FULL_REBUILD:
|
do_copy = True
|
||||||
import filecmp
|
if f in file_list_path_in:
|
||||||
|
if filecmp.cmp(f_from, f_to):
|
||||||
|
do_copy = False
|
||||||
|
|
||||||
# now move changed files from 'path_in_tmp' --> 'path_in'
|
if do_copy:
|
||||||
file_list_path_in = set(os.listdir(path_in))
|
print("\tupdating: %s" % f)
|
||||||
file_list_path_in_tmp = set(os.listdir(path_in_tmp))
|
shutil.copy(f_from, f_to)
|
||||||
|
'''else:
|
||||||
|
print("\tkeeping: %s" % f) # eh, not that useful'''
|
||||||
|
|
||||||
# remove deprecated files that have been removed.
|
EXAMPLE_SET_UNUSED = EXAMPLE_SET - EXAMPLE_SET_USED
|
||||||
for f in sorted(file_list_path_in):
|
if EXAMPLE_SET_UNUSED:
|
||||||
if f not in file_list_path_in_tmp:
|
print("\nUnused examples found in '%s'..." % path_examples)
|
||||||
print("\tdeprecated: %s" % f)
|
for f in EXAMPLE_SET_UNUSED:
|
||||||
os.remove(os.path.join(path_in, f))
|
print(" %s.py" % f)
|
||||||
|
print(" %d total\n" % len(EXAMPLE_SET_UNUSED))
|
||||||
# freshen with new files.
|
|
||||||
for f in sorted(file_list_path_in_tmp):
|
|
||||||
f_from = os.path.join(path_in_tmp, f)
|
|
||||||
f_to = os.path.join(path_in, f)
|
|
||||||
|
|
||||||
do_copy = True
|
|
||||||
if f in file_list_path_in:
|
|
||||||
if filecmp.cmp(f_from, f_to):
|
|
||||||
do_copy = False
|
|
||||||
|
|
||||||
if do_copy:
|
|
||||||
print("\tupdating: %s" % f)
|
|
||||||
shutil.copy(f_from, f_to)
|
|
||||||
'''else:
|
|
||||||
print("\tkeeping: %s" % f) # eh, not that useful'''
|
|
||||||
|
|
||||||
EXAMPLE_SET_UNUSED = EXAMPLE_SET - EXAMPLE_SET_USED
|
|
||||||
if EXAMPLE_SET_UNUSED:
|
|
||||||
print("\nUnused examples found in '%s'..." % path_examples)
|
|
||||||
for f in EXAMPLE_SET_UNUSED:
|
|
||||||
print(" %s.py" % f)
|
|
||||||
print(" %d total\n" % len(EXAMPLE_SET_UNUSED))
|
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
@ -164,5 +164,5 @@ GHOST_TSuccess GHOST_DisplayManagerCocoa::setCurrentDisplaySetting(GHOST_TUns8 d
|
|||||||
|
|
||||||
//CGDisplayErr err = ::CGDisplaySwitchToMode(m_displayIDs[display], displayModeValues);
|
//CGDisplayErr err = ::CGDisplaySwitchToMode(m_displayIDs[display], displayModeValues);
|
||||||
|
|
||||||
return /*err == CGDisplayNoErr ? GHOST_kSuccess :*/ GHOST_kFailure;
|
return /*err == CGDisplayNoErr ?*/ GHOST_kSuccess /*: GHOST_kFailure*/;
|
||||||
}
|
}
|
||||||
|
@ -119,14 +119,6 @@ public:
|
|||||||
const GHOST_TEmbedderWindowID parentWindow = 0
|
const GHOST_TEmbedderWindowID parentWindow = 0
|
||||||
);
|
);
|
||||||
|
|
||||||
virtual GHOST_TSuccess beginFullScreen(
|
|
||||||
const GHOST_DisplaySetting& setting,
|
|
||||||
GHOST_IWindow** window,
|
|
||||||
const bool stereoVisual
|
|
||||||
);
|
|
||||||
|
|
||||||
virtual GHOST_TSuccess endFullScreen( void );
|
|
||||||
|
|
||||||
/***************************************************************************************
|
/***************************************************************************************
|
||||||
** Event management functionality
|
** Event management functionality
|
||||||
***************************************************************************************/
|
***************************************************************************************/
|
||||||
@ -272,17 +264,6 @@ protected:
|
|||||||
*/
|
*/
|
||||||
GHOST_TSuccess setMouseCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y);
|
GHOST_TSuccess setMouseCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y);
|
||||||
|
|
||||||
/**
|
|
||||||
* Push cursor event, with coordinate conversion to follow GHOST convention.
|
|
||||||
*/
|
|
||||||
void pushEventCursor(GHOST_TUns64 msec, GHOST_TEventType type, GHOST_IWindow* window, GHOST_TInt32 x, GHOST_TInt32 y);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Push trackpad event, with coordinate conversion to follow GHOST convention.
|
|
||||||
*/
|
|
||||||
void pushEventTrackpad(GHOST_TUns64 msec, GHOST_IWindow* window, GHOST_TTrackpadEventSubTypes subtype,
|
|
||||||
GHOST_TInt32 x, GHOST_TInt32 y, GHOST_TInt32 deltaX, GHOST_TInt32 deltaY);
|
|
||||||
|
|
||||||
/** Start time at initialization. */
|
/** Start time at initialization. */
|
||||||
GHOST_TUns64 m_start_time;
|
GHOST_TUns64 m_start_time;
|
||||||
|
|
||||||
|
@ -773,26 +773,6 @@ GHOST_IWindow* GHOST_SystemCocoa::createWindow(
|
|||||||
return window;
|
return window;
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_SystemCocoa::beginFullScreen(const GHOST_DisplaySetting& setting, GHOST_IWindow** window, const bool stereoVisual)
|
|
||||||
{
|
|
||||||
GHOST_IWindow* currentWindow = m_windowManager->getActiveWindow();
|
|
||||||
*window = currentWindow;
|
|
||||||
|
|
||||||
if(!currentWindow) return GHOST_kFailure;
|
|
||||||
|
|
||||||
return currentWindow->setState(GHOST_kWindowStateFullScreen);
|
|
||||||
}
|
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_SystemCocoa::endFullScreen(void)
|
|
||||||
{
|
|
||||||
GHOST_IWindow* currentWindow = m_windowManager->getActiveWindow();
|
|
||||||
if(!currentWindow) return GHOST_kFailure;
|
|
||||||
|
|
||||||
return currentWindow->setState(GHOST_kWindowStateNormal);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @note : returns coordinates in Cocoa screen coordinates
|
* @note : returns coordinates in Cocoa screen coordinates
|
||||||
*/
|
*/
|
||||||
@ -806,37 +786,11 @@ GHOST_TSuccess GHOST_SystemCocoa::getCursorPosition(GHOST_TInt32& x, GHOST_TInt3
|
|||||||
return GHOST_kSuccess;
|
return GHOST_kSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GHOST_SystemCocoa::pushEventCursor(GHOST_TUns64 msec, GHOST_TEventType type, GHOST_IWindow* window, GHOST_TInt32 x, GHOST_TInt32 y)
|
|
||||||
{
|
|
||||||
GHOST_Rect cBnds;
|
|
||||||
window->getClientBounds(cBnds);
|
|
||||||
y = (cBnds.getHeight() - 1) - y;
|
|
||||||
|
|
||||||
GHOST_TInt32 screen_x, screen_y;
|
|
||||||
window->clientToScreen(x, y, screen_x, screen_y);
|
|
||||||
|
|
||||||
pushEvent(new GHOST_EventCursor(msec, type, window, screen_x, screen_y));
|
|
||||||
}
|
|
||||||
|
|
||||||
void GHOST_SystemCocoa::pushEventTrackpad(GHOST_TUns64 msec, GHOST_IWindow* window, GHOST_TTrackpadEventSubTypes subtype, GHOST_TInt32 x, GHOST_TInt32 y, GHOST_TInt32 deltaX, GHOST_TInt32 deltaY)
|
|
||||||
{
|
|
||||||
GHOST_Rect cBnds;
|
|
||||||
window->getClientBounds(cBnds);
|
|
||||||
y = (cBnds.getHeight() - 1) - y;
|
|
||||||
deltaY = -deltaY;
|
|
||||||
|
|
||||||
GHOST_TInt32 screen_x, screen_y;
|
|
||||||
window->clientToScreen(x, y, screen_x, screen_y);
|
|
||||||
|
|
||||||
pushEvent(new GHOST_EventTrackpad(msec, window, subtype, screen_x, screen_y, deltaX, deltaY));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @note : expect Cocoa screen coordinates
|
* @note : expect Cocoa screen coordinates
|
||||||
*/
|
*/
|
||||||
GHOST_TSuccess GHOST_SystemCocoa::setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y)
|
GHOST_TSuccess GHOST_SystemCocoa::setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y)
|
||||||
{
|
{
|
||||||
GHOST_TInt32 wx,wy;
|
|
||||||
GHOST_WindowCocoa* window = (GHOST_WindowCocoa*)m_windowManager->getActiveWindow();
|
GHOST_WindowCocoa* window = (GHOST_WindowCocoa*)m_windowManager->getActiveWindow();
|
||||||
if (!window) return GHOST_kFailure;
|
if (!window) return GHOST_kFailure;
|
||||||
|
|
||||||
@ -847,8 +801,7 @@ GHOST_TSuccess GHOST_SystemCocoa::setCursorPosition(GHOST_TInt32 x, GHOST_TInt32
|
|||||||
CGAssociateMouseAndMouseCursorPosition(true);
|
CGAssociateMouseAndMouseCursorPosition(true);
|
||||||
|
|
||||||
//Force mouse move event (not pushed by Cocoa)
|
//Force mouse move event (not pushed by Cocoa)
|
||||||
window->screenToClient(x, y, wx, wy);
|
pushEvent(new GHOST_EventCursor(getMilliSeconds(), GHOST_kEventCursorMove, window, x, y));
|
||||||
pushEventCursor(getMilliSeconds(), GHOST_kEventCursorMove, window, wx,wy);
|
|
||||||
m_outsideLoopEventProcessed = true;
|
m_outsideLoopEventProcessed = true;
|
||||||
|
|
||||||
return GHOST_kSuccess;
|
return GHOST_kSuccess;
|
||||||
@ -1460,9 +1413,9 @@ GHOST_TSuccess GHOST_SystemCocoa::handleTabletEvent(void *eventPtr, short eventT
|
|||||||
GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
|
GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
|
||||||
{
|
{
|
||||||
NSEvent *event = (NSEvent *)eventPtr;
|
NSEvent *event = (NSEvent *)eventPtr;
|
||||||
GHOST_Window* window;
|
GHOST_WindowCocoa* window;
|
||||||
|
|
||||||
window = (GHOST_Window*)m_windowManager->getWindowAssociatedWithOSWindow((void*)[event window]);
|
window = (GHOST_WindowCocoa*)m_windowManager->getWindowAssociatedWithOSWindow((void*)[event window]);
|
||||||
if (!window) {
|
if (!window) {
|
||||||
//printf("\nW failure for event 0x%x",[event type]);
|
//printf("\nW failure for event 0x%x",[event type]);
|
||||||
return GHOST_kFailure;
|
return GHOST_kFailure;
|
||||||
@ -1526,7 +1479,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
|
|||||||
switch (window->getCursorGrabMode()) {
|
switch (window->getCursorGrabMode()) {
|
||||||
case GHOST_kGrabHide: //Cursor hidden grab operation : no cursor move
|
case GHOST_kGrabHide: //Cursor hidden grab operation : no cursor move
|
||||||
{
|
{
|
||||||
GHOST_TInt32 x_warp, y_warp, x_accum, y_accum;
|
GHOST_TInt32 x_warp, y_warp, x_accum, y_accum, x, y;
|
||||||
|
|
||||||
window->getCursorGrabInitPos(x_warp, y_warp);
|
window->getCursorGrabInitPos(x_warp, y_warp);
|
||||||
|
|
||||||
@ -1535,7 +1488,8 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
|
|||||||
y_accum += -[event deltaY]; //Strange Apple implementation (inverted coordinates for the deltaY) ...
|
y_accum += -[event deltaY]; //Strange Apple implementation (inverted coordinates for the deltaY) ...
|
||||||
window->setCursorGrabAccum(x_accum, y_accum);
|
window->setCursorGrabAccum(x_accum, y_accum);
|
||||||
|
|
||||||
pushEventCursor([event timestamp]*1000, GHOST_kEventCursorMove, window, x_warp+x_accum, y_warp+y_accum);
|
window->clientToScreenIntern(x_warp+x_accum, y_warp+y_accum, x, y);
|
||||||
|
pushEvent(new GHOST_EventCursor([event timestamp]*1000, GHOST_kEventCursorMove, window, x, y));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GHOST_kGrabWrap: //Wrap cursor at area/window boundaries
|
case GHOST_kGrabWrap: //Wrap cursor at area/window boundaries
|
||||||
@ -1544,18 +1498,15 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
|
|||||||
GHOST_TInt32 x_mouse= mousePos.x;
|
GHOST_TInt32 x_mouse= mousePos.x;
|
||||||
GHOST_TInt32 y_mouse= mousePos.y;
|
GHOST_TInt32 y_mouse= mousePos.y;
|
||||||
GHOST_TInt32 x_accum, y_accum, x_cur, y_cur, x, y;
|
GHOST_TInt32 x_accum, y_accum, x_cur, y_cur, x, y;
|
||||||
GHOST_Rect bounds, windowBounds, correctedBounds;
|
GHOST_Rect bounds, correctedBounds;
|
||||||
|
|
||||||
/* fallback to window bounds */
|
/* fallback to window bounds */
|
||||||
if(window->getCursorGrabBounds(bounds)==GHOST_kFailure)
|
if(window->getCursorGrabBounds(bounds)==GHOST_kFailure)
|
||||||
window->getClientBounds(bounds);
|
window->getClientBounds(bounds);
|
||||||
|
|
||||||
//Switch back to Cocoa coordinates orientation (y=0 at botton,the same as blender internal btw!), and to client coordinates
|
//Switch back to Cocoa coordinates orientation (y=0 at botton,the same as blender internal btw!), and to client coordinates
|
||||||
window->getClientBounds(windowBounds);
|
window->screenToClient(bounds.m_l, bounds.m_b, correctedBounds.m_l, correctedBounds.m_b);
|
||||||
window->screenToClient(bounds.m_l, bounds.m_b, correctedBounds.m_l, correctedBounds.m_t);
|
window->screenToClient(bounds.m_r, bounds.m_t, correctedBounds.m_r, correctedBounds.m_t);
|
||||||
window->screenToClient(bounds.m_r, bounds.m_t, correctedBounds.m_r, correctedBounds.m_b);
|
|
||||||
correctedBounds.m_b = (windowBounds.m_b - windowBounds.m_t) - correctedBounds.m_b;
|
|
||||||
correctedBounds.m_t = (windowBounds.m_b - windowBounds.m_t) - correctedBounds.m_t;
|
|
||||||
|
|
||||||
//Update accumulation counts
|
//Update accumulation counts
|
||||||
window->getCursorGrabAccum(x_accum, y_accum);
|
window->getCursorGrabAccum(x_accum, y_accum);
|
||||||
@ -1574,19 +1525,24 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
|
|||||||
m_cursorDelta_y = y_mouse-mousePos.y;
|
m_cursorDelta_y = y_mouse-mousePos.y;
|
||||||
|
|
||||||
//Set new cursor position
|
//Set new cursor position
|
||||||
window->clientToScreen(x_mouse, y_mouse, x_cur, y_cur);
|
window->clientToScreenIntern(x_mouse, y_mouse, x_cur, y_cur);
|
||||||
setMouseCursorPosition(x_cur, y_cur); /* wrap */
|
setMouseCursorPosition(x_cur, y_cur); /* wrap */
|
||||||
|
|
||||||
//Post event
|
//Post event
|
||||||
window->getCursorGrabInitPos(x_cur, y_cur);
|
window->getCursorGrabInitPos(x_cur, y_cur);
|
||||||
pushEventCursor([event timestamp]*1000, GHOST_kEventCursorMove, window, x_cur + x_accum, y_cur + y_accum);
|
window->clientToScreenIntern(x_cur + x_accum, y_cur + y_accum, x, y);
|
||||||
|
pushEvent(new GHOST_EventCursor([event timestamp]*1000, GHOST_kEventCursorMove, window, x, y));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
//Normal cursor operation: send mouse position in window
|
//Normal cursor operation: send mouse position in window
|
||||||
NSPoint mousePos = [event locationInWindow];
|
NSPoint mousePos = [event locationInWindow];
|
||||||
pushEventCursor([event timestamp]*1000, GHOST_kEventCursorMove, window, mousePos.x, mousePos.y);
|
GHOST_TInt32 x, y;
|
||||||
|
|
||||||
|
window->clientToScreenIntern(mousePos.x, mousePos.y, x, y);
|
||||||
|
pushEvent(new GHOST_EventCursor([event timestamp]*1000, GHOST_kEventCursorMove, window, x, y));
|
||||||
|
|
||||||
m_cursorDelta_x=0;
|
m_cursorDelta_x=0;
|
||||||
m_cursorDelta_y=0; //Mouse motion occurred between two cursor warps, so we can reset the delta counter
|
m_cursorDelta_y=0; //Mouse motion occurred between two cursor warps, so we can reset the delta counter
|
||||||
}
|
}
|
||||||
@ -1608,6 +1564,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
NSPoint mousePos = [event locationInWindow];
|
NSPoint mousePos = [event locationInWindow];
|
||||||
|
GHOST_TInt32 x, y;
|
||||||
double dx = [event deltaX];
|
double dx = [event deltaX];
|
||||||
double dy = -[event deltaY];
|
double dy = -[event deltaY];
|
||||||
|
|
||||||
@ -1624,7 +1581,10 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
|
|||||||
if (dy<0.0) dy-=0.5; else dy+=0.5;
|
if (dy<0.0) dy-=0.5; else dy+=0.5;
|
||||||
if (dy< -deltaMax) dy= -deltaMax; else if (dy>deltaMax) dy=deltaMax;
|
if (dy< -deltaMax) dy= -deltaMax; else if (dy>deltaMax) dy=deltaMax;
|
||||||
|
|
||||||
pushEventTrackpad([event timestamp]*1000, window, GHOST_kTrackpadEventScroll, mousePos.x, mousePos.y, dx, dy);
|
window->clientToScreenIntern(mousePos.x, mousePos.y, x, y);
|
||||||
|
dy = -dy;
|
||||||
|
|
||||||
|
pushEvent(new GHOST_EventTrackpad([event timestamp]*1000, window, GHOST_kTrackpadEventScroll, x, y, dx, dy));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1632,16 +1592,20 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
|
|||||||
case NSEventTypeMagnify:
|
case NSEventTypeMagnify:
|
||||||
{
|
{
|
||||||
NSPoint mousePos = [event locationInWindow];
|
NSPoint mousePos = [event locationInWindow];
|
||||||
pushEventTrackpad([event timestamp]*1000, window, GHOST_kTrackpadEventMagnify, mousePos.x, mousePos.y,
|
GHOST_TInt32 x, y;
|
||||||
[event magnification]*250.0 + 0.1, 0);
|
window->clientToScreenIntern(mousePos.x, mousePos.y, x, y);
|
||||||
|
pushEvent(new GHOST_EventTrackpad([event timestamp]*1000, window, GHOST_kTrackpadEventMagnify, x, y,
|
||||||
|
[event magnification]*250.0 + 0.1, 0));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSEventTypeRotate:
|
case NSEventTypeRotate:
|
||||||
{
|
{
|
||||||
NSPoint mousePos = [event locationInWindow];
|
NSPoint mousePos = [event locationInWindow];
|
||||||
pushEventTrackpad([event timestamp]*1000, window, GHOST_kTrackpadEventRotate, mousePos.x, mousePos.y,
|
GHOST_TInt32 x, y;
|
||||||
-[event rotation] * 5.0, 0);
|
window->clientToScreenIntern(mousePos.x, mousePos.y, x, y);
|
||||||
|
pushEvent(new GHOST_EventTrackpad([event timestamp]*1000, window, GHOST_kTrackpadEventRotate, x, y,
|
||||||
|
-[event rotation] * 5.0, 0));
|
||||||
}
|
}
|
||||||
case NSEventTypeBeginGesture:
|
case NSEventTypeBeginGesture:
|
||||||
m_isGestureInProgress = true;
|
m_isGestureInProgress = true;
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
#include "STR_String.h"
|
#include "STR_String.h"
|
||||||
|
|
||||||
@class CocoaWindow;
|
@class CocoaWindow;
|
||||||
|
@class CocoaOpenGLView;
|
||||||
|
|
||||||
class GHOST_SystemCocoa;
|
class GHOST_SystemCocoa;
|
||||||
|
|
||||||
@ -180,6 +181,26 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual void clientToScreen(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const;
|
virtual void clientToScreen(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a point in screen coordinates to client rectangle coordinates
|
||||||
|
* but without the y coordinate conversion needed for ghost compatibility.
|
||||||
|
* @param inX The x-coordinate in the client rectangle.
|
||||||
|
* @param inY The y-coordinate in the client rectangle.
|
||||||
|
* @param outX The x-coordinate on the screen.
|
||||||
|
* @param outY The y-coordinate on the screen.
|
||||||
|
*/
|
||||||
|
void clientToScreenIntern(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a point in screen coordinates to client rectangle coordinates,
|
||||||
|
* but without the y coordinate conversion needed for ghost compatibility.
|
||||||
|
* @param inX The x-coordinate in the client rectangle.
|
||||||
|
* @param inY The y-coordinate in the client rectangle.
|
||||||
|
* @param outX The x-coordinate on the screen.
|
||||||
|
* @param outY The y-coordinate on the screen.
|
||||||
|
*/
|
||||||
|
void screenToClientIntern(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the screen the window is displayed in
|
* Gets the screen the window is displayed in
|
||||||
* @return The NSScreen object
|
* @return The NSScreen object
|
||||||
@ -289,7 +310,7 @@ protected:
|
|||||||
CocoaWindow *m_window;
|
CocoaWindow *m_window;
|
||||||
|
|
||||||
/** The openGL view */
|
/** The openGL view */
|
||||||
NSOpenGLView *m_openGLView;
|
CocoaOpenGLView *m_openGLView;
|
||||||
|
|
||||||
/** The opgnGL drawing context */
|
/** The opgnGL drawing context */
|
||||||
NSOpenGLContext *m_openGLContext;
|
NSOpenGLContext *m_openGLContext;
|
||||||
|
@ -241,10 +241,19 @@ extern "C" {
|
|||||||
//We need to subclass it in order to give Cocoa the feeling key events are trapped
|
//We need to subclass it in order to give Cocoa the feeling key events are trapped
|
||||||
@interface CocoaOpenGLView : NSOpenGLView
|
@interface CocoaOpenGLView : NSOpenGLView
|
||||||
{
|
{
|
||||||
|
GHOST_SystemCocoa *systemCocoa;
|
||||||
|
GHOST_WindowCocoa *associatedWindow;
|
||||||
}
|
}
|
||||||
|
- (void)setSystemAndWindowCocoa:(GHOST_SystemCocoa *)sysCocoa windowCocoa:(GHOST_WindowCocoa *)winCocoa;
|
||||||
@end
|
@end
|
||||||
@implementation CocoaOpenGLView
|
@implementation CocoaOpenGLView
|
||||||
|
|
||||||
|
- (void)setSystemAndWindowCocoa:(GHOST_SystemCocoa *)sysCocoa windowCocoa:(GHOST_WindowCocoa *)winCocoa
|
||||||
|
{
|
||||||
|
systemCocoa = sysCocoa;
|
||||||
|
associatedWindow = winCocoa;
|
||||||
|
}
|
||||||
|
|
||||||
- (BOOL)acceptsFirstResponder
|
- (BOOL)acceptsFirstResponder
|
||||||
{
|
{
|
||||||
return YES;
|
return YES;
|
||||||
@ -294,6 +303,7 @@ extern "C" {
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
[super drawRect:rect];
|
[super drawRect:rect];
|
||||||
|
systemCocoa->handleWindowEvent(GHOST_kEventWindowUpdate, associatedWindow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -424,6 +434,8 @@ GHOST_WindowCocoa::GHOST_WindowCocoa(
|
|||||||
//Creates the OpenGL View inside the window
|
//Creates the OpenGL View inside the window
|
||||||
m_openGLView = [[CocoaOpenGLView alloc] initWithFrame:rect
|
m_openGLView = [[CocoaOpenGLView alloc] initWithFrame:rect
|
||||||
pixelFormat:pixelFormat];
|
pixelFormat:pixelFormat];
|
||||||
|
|
||||||
|
[m_openGLView setSystemAndWindowCocoa:systemCocoa windowCocoa:this];
|
||||||
|
|
||||||
[pixelFormat release];
|
[pixelFormat release];
|
||||||
|
|
||||||
@ -691,17 +703,8 @@ GHOST_TWindowState GHOST_WindowCocoa::getState() const
|
|||||||
void GHOST_WindowCocoa::screenToClient(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const
|
void GHOST_WindowCocoa::screenToClient(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const
|
||||||
{
|
{
|
||||||
GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::screenToClient(): window invalid")
|
GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::screenToClient(): window invalid")
|
||||||
|
|
||||||
NSPoint screenCoord;
|
screenToClientIntern(inX, inY, outX, outY);
|
||||||
NSPoint baseCoord;
|
|
||||||
|
|
||||||
screenCoord.x = inX;
|
|
||||||
screenCoord.y = inY;
|
|
||||||
|
|
||||||
baseCoord = [m_window convertScreenToBase:screenCoord];
|
|
||||||
|
|
||||||
outX = baseCoord.x;
|
|
||||||
outY = baseCoord.y;
|
|
||||||
|
|
||||||
/* switch y to match ghost convention */
|
/* switch y to match ghost convention */
|
||||||
GHOST_Rect cBnds;
|
GHOST_Rect cBnds;
|
||||||
@ -718,7 +721,26 @@ void GHOST_WindowCocoa::clientToScreen(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST
|
|||||||
GHOST_Rect cBnds;
|
GHOST_Rect cBnds;
|
||||||
getClientBounds(cBnds);
|
getClientBounds(cBnds);
|
||||||
inY = (cBnds.getHeight() - 1) - inY;
|
inY = (cBnds.getHeight() - 1) - inY;
|
||||||
|
|
||||||
|
clientToScreenIntern(inX, inY, outX, outY);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GHOST_WindowCocoa::screenToClientIntern(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const
|
||||||
|
{
|
||||||
|
NSPoint screenCoord;
|
||||||
|
NSPoint baseCoord;
|
||||||
|
|
||||||
|
screenCoord.x = inX;
|
||||||
|
screenCoord.y = inY;
|
||||||
|
|
||||||
|
baseCoord = [m_window convertScreenToBase:screenCoord];
|
||||||
|
|
||||||
|
outX = baseCoord.x;
|
||||||
|
outY = baseCoord.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GHOST_WindowCocoa::clientToScreenIntern(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const
|
||||||
|
{
|
||||||
NSPoint screenCoord;
|
NSPoint screenCoord;
|
||||||
NSPoint baseCoord;
|
NSPoint baseCoord;
|
||||||
|
|
||||||
@ -1220,7 +1242,7 @@ GHOST_TSuccess GHOST_WindowCocoa::setWindowCursorGrab(GHOST_TGrabCursorMode mode
|
|||||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||||
|
|
||||||
m_systemCocoa->getCursorPosition(x_old,y_old);
|
m_systemCocoa->getCursorPosition(x_old,y_old);
|
||||||
screenToClient(x_old, y_old, m_cursorGrabInitPos[0], m_cursorGrabInitPos[1]);
|
screenToClientIntern(x_old, y_old, m_cursorGrabInitPos[0], m_cursorGrabInitPos[1]);
|
||||||
//Warp position is stored in client (window base) coordinates
|
//Warp position is stored in client (window base) coordinates
|
||||||
setCursorGrabAccum(0, 0);
|
setCursorGrabAccum(0, 0);
|
||||||
|
|
||||||
|
@ -905,9 +905,6 @@ void IK_QElbowSegment::SetLimit(int axis, MT_Scalar lmin, MT_Scalar lmax)
|
|||||||
lmin = MT_clamp(lmin, -MT_PI, MT_PI);
|
lmin = MT_clamp(lmin, -MT_PI, MT_PI);
|
||||||
lmax = MT_clamp(lmax, -MT_PI, MT_PI);
|
lmax = MT_clamp(lmax, -MT_PI, MT_PI);
|
||||||
|
|
||||||
lmin = lmin;
|
|
||||||
lmax = lmax;
|
|
||||||
|
|
||||||
if (axis == 1) {
|
if (axis == 1) {
|
||||||
m_min_twist = lmin;
|
m_min_twist = lmin;
|
||||||
m_max_twist = lmax;
|
m_max_twist = lmax;
|
||||||
|
@ -134,6 +134,7 @@ bool ConstraintSet::setControlParameter(int id, ConstraintAction action, double
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
assert(action==ACT_NONE);
|
assert(action==ACT_NONE);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return setControlParameters(&values, 1, timestep);
|
return setControlParameters(&values, 1, timestep);
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,9 @@
|
|||||||
# <pep8 compliant>
|
# <pep8 compliant>
|
||||||
|
|
||||||
import bpy
|
import bpy
|
||||||
from bpy.props import StringProperty, BoolProperty, IntProperty, FloatProperty
|
from bpy.props import StringProperty, BoolProperty, IntProperty, \
|
||||||
|
FloatProperty, EnumProperty
|
||||||
|
|
||||||
from rna_prop_ui import rna_idprop_ui_prop_get, rna_idprop_ui_prop_clear
|
from rna_prop_ui import rna_idprop_ui_prop_get, rna_idprop_ui_prop_clear
|
||||||
|
|
||||||
|
|
||||||
@ -457,6 +459,66 @@ doc_id = StringProperty(name="Doc ID",
|
|||||||
doc_new = StringProperty(name="Edit Description",
|
doc_new = StringProperty(name="Edit Description",
|
||||||
description="", maxlen=1024, default="")
|
description="", maxlen=1024, default="")
|
||||||
|
|
||||||
|
data_path_iter = StringProperty(
|
||||||
|
description="The data path relative to the context, must point to an iterable.")
|
||||||
|
|
||||||
|
data_path_item = StringProperty(
|
||||||
|
description="The data path from each iterable to the value (int or float)")
|
||||||
|
|
||||||
|
|
||||||
|
class WM_OT_context_collection_boolean_set(bpy.types.Operator):
|
||||||
|
'''Set boolean values for a collection of items'''
|
||||||
|
bl_idname = "wm.context_collection_boolean_set"
|
||||||
|
bl_label = "Context Collection Boolean Set"
|
||||||
|
bl_options = {'UNDO', 'REGISTER', 'INTERNAL'}
|
||||||
|
|
||||||
|
data_path_iter = data_path_iter
|
||||||
|
data_path_item = data_path_item
|
||||||
|
|
||||||
|
type = EnumProperty(items=(
|
||||||
|
('TOGGLE', "Toggle", ""),
|
||||||
|
('ENABLE', "Enable", ""),
|
||||||
|
('DISABLE', "Disable", ""),
|
||||||
|
),
|
||||||
|
name="Type")
|
||||||
|
|
||||||
|
def execute(self, context):
|
||||||
|
data_path_iter = self.data_path_iter
|
||||||
|
data_path_item = self.data_path_item
|
||||||
|
|
||||||
|
items = list(getattr(context, data_path_iter))
|
||||||
|
items_ok = []
|
||||||
|
is_set = False
|
||||||
|
for item in items:
|
||||||
|
try:
|
||||||
|
value_orig = eval("item." + data_path_item)
|
||||||
|
except:
|
||||||
|
continue
|
||||||
|
|
||||||
|
if value_orig == True:
|
||||||
|
is_set = True
|
||||||
|
elif value_orig == False:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
self.report({'WARNING'}, "Non boolean value found: %s[ ].%s" %
|
||||||
|
(data_path_iter, data_path_item))
|
||||||
|
return {'CANCELLED'}
|
||||||
|
|
||||||
|
items_ok.append(item)
|
||||||
|
|
||||||
|
if self.type == 'ENABLE':
|
||||||
|
is_set = True
|
||||||
|
elif self.type == 'DISABLE':
|
||||||
|
is_set = False
|
||||||
|
else:
|
||||||
|
is_set = not is_set
|
||||||
|
|
||||||
|
exec_str = "item.%s = %s" % (data_path_item, is_set)
|
||||||
|
for item in items_ok:
|
||||||
|
exec(exec_str)
|
||||||
|
|
||||||
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
|
||||||
class WM_OT_context_modal_mouse(bpy.types.Operator):
|
class WM_OT_context_modal_mouse(bpy.types.Operator):
|
||||||
'''Adjust arbitrary values with mouse input'''
|
'''Adjust arbitrary values with mouse input'''
|
||||||
@ -464,8 +526,9 @@ class WM_OT_context_modal_mouse(bpy.types.Operator):
|
|||||||
bl_label = "Context Modal Mouse"
|
bl_label = "Context Modal Mouse"
|
||||||
bl_options = {'GRAB_POINTER', 'BLOCKING', 'INTERNAL'}
|
bl_options = {'GRAB_POINTER', 'BLOCKING', 'INTERNAL'}
|
||||||
|
|
||||||
data_path_iter = StringProperty(description="The data path relative to the context, must point to an iterable.")
|
data_path_iter = data_path_iter
|
||||||
data_path_item = StringProperty(description="The data path from each iterable to the value (int or float)")
|
data_path_item = data_path_item
|
||||||
|
|
||||||
input_scale = FloatProperty(default=0.01, description="Scale the mouse movement by this value before applying the delta")
|
input_scale = FloatProperty(default=0.01, description="Scale the mouse movement by this value before applying the delta")
|
||||||
invert = BoolProperty(default=False, description="Invert the mouse input")
|
invert = BoolProperty(default=False, description="Invert the mouse input")
|
||||||
initial_x = IntProperty(options={'HIDDEN'})
|
initial_x = IntProperty(options={'HIDDEN'})
|
||||||
|
@ -884,7 +884,7 @@ class MATERIAL_PT_volume_lighting(VolumeButtonsPanel, bpy.types.Panel):
|
|||||||
sub = col.column()
|
sub = col.column()
|
||||||
sub.enabled = True
|
sub.enabled = True
|
||||||
sub.active = False
|
sub.active = False
|
||||||
sub.prop(vol, "use_light_cache")
|
sub.label("Light Cache Enabled")
|
||||||
col.prop(vol, "cache_resolution")
|
col.prop(vol, "cache_resolution")
|
||||||
|
|
||||||
sub = col.column(align=True)
|
sub = col.column(align=True)
|
||||||
|
@ -1106,17 +1106,18 @@ class VIEW3D_MT_sculpt(bpy.types.Menu):
|
|||||||
layout.operator_menu_enum("brush.curve_preset", "shape")
|
layout.operator_menu_enum("brush.curve_preset", "shape")
|
||||||
layout.separator()
|
layout.separator()
|
||||||
|
|
||||||
sculpt_tool = brush.sculpt_tool
|
if brush is not None: # unlikely but can happen
|
||||||
|
sculpt_tool = brush.sculpt_tool
|
||||||
|
|
||||||
if sculpt_tool != 'GRAB':
|
if sculpt_tool != 'GRAB':
|
||||||
layout.prop_menu_enum(brush, "stroke_method")
|
layout.prop_menu_enum(brush, "stroke_method")
|
||||||
|
|
||||||
if sculpt_tool in {'DRAW', 'PINCH', 'INFLATE', 'LAYER', 'CLAY'}:
|
if sculpt_tool in {'DRAW', 'PINCH', 'INFLATE', 'LAYER', 'CLAY'}:
|
||||||
layout.prop_menu_enum(brush, "direction")
|
layout.prop_menu_enum(brush, "direction")
|
||||||
|
|
||||||
if sculpt_tool == 'LAYER':
|
if sculpt_tool == 'LAYER':
|
||||||
layout.prop(brush, "use_persistent")
|
layout.prop(brush, "use_persistent")
|
||||||
layout.operator("sculpt.set_persistent_base")
|
layout.operator("sculpt.set_persistent_base")
|
||||||
|
|
||||||
layout.separator()
|
layout.separator()
|
||||||
layout.prop(sculpt, "use_threaded", text="Threaded Sculpt")
|
layout.prop(sculpt, "use_threaded", text="Threaded Sculpt")
|
||||||
@ -1251,7 +1252,7 @@ class VIEW3D_MT_pose(bpy.types.Menu):
|
|||||||
layout.separator()
|
layout.separator()
|
||||||
|
|
||||||
layout.menu("VIEW3D_MT_pose_showhide")
|
layout.menu("VIEW3D_MT_pose_showhide")
|
||||||
layout.operator_menu_enum("pose.flags_set", 'mode', text="Bone Settings")
|
layout.menu("VIEW3D_MT_bone_options_toggle", text="Bone Settings")
|
||||||
|
|
||||||
|
|
||||||
class VIEW3D_MT_pose_transform(bpy.types.Menu):
|
class VIEW3D_MT_pose_transform(bpy.types.Menu):
|
||||||
@ -1372,6 +1373,49 @@ class VIEW3D_MT_pose_apply(bpy.types.Menu):
|
|||||||
layout.operator("pose.visual_transform_apply")
|
layout.operator("pose.visual_transform_apply")
|
||||||
|
|
||||||
|
|
||||||
|
class BoneOptions:
|
||||||
|
def draw(self, context):
|
||||||
|
layout = self.layout
|
||||||
|
|
||||||
|
options = [
|
||||||
|
"show_wire",
|
||||||
|
"use_deform",
|
||||||
|
"use_envelope_multiply",
|
||||||
|
"use_inherit_rotation",
|
||||||
|
"use_inherit_scale",
|
||||||
|
]
|
||||||
|
|
||||||
|
if context.mode == 'EDIT_ARMATURE':
|
||||||
|
bone_props = bpy.types.EditBone.bl_rna.properties
|
||||||
|
data_path_iter = "selected_bones"
|
||||||
|
opt_suffix = ""
|
||||||
|
options.append("lock")
|
||||||
|
else: # posemode
|
||||||
|
bone_props = bpy.types.Bone.bl_rna.properties
|
||||||
|
data_path_iter = "selected_pose_bones"
|
||||||
|
opt_suffix = "bone."
|
||||||
|
|
||||||
|
for opt in options:
|
||||||
|
props = layout.operator("wm.context_collection_boolean_set", text=bone_props[opt].name)
|
||||||
|
props.data_path_iter = data_path_iter
|
||||||
|
props.data_path_item = opt_suffix + opt
|
||||||
|
props.type = self.type
|
||||||
|
|
||||||
|
|
||||||
|
class VIEW3D_MT_bone_options_toggle(bpy.types.Menu, BoneOptions):
|
||||||
|
bl_label = "Toggle Bone Options"
|
||||||
|
type = 'TOGGLE'
|
||||||
|
|
||||||
|
|
||||||
|
class VIEW3D_MT_bone_options_enable(bpy.types.Menu, BoneOptions):
|
||||||
|
bl_label = "Enable Bone Options"
|
||||||
|
type = 'ENABLE'
|
||||||
|
|
||||||
|
|
||||||
|
class VIEW3D_MT_bone_options_disable(bpy.types.Menu, BoneOptions):
|
||||||
|
bl_label = "Disable Bone Options"
|
||||||
|
type = 'DISABLE'
|
||||||
|
|
||||||
# ********** Edit Menus, suffix from ob.type **********
|
# ********** Edit Menus, suffix from ob.type **********
|
||||||
|
|
||||||
|
|
||||||
@ -1965,7 +2009,7 @@ class VIEW3D_MT_edit_armature(bpy.types.Menu):
|
|||||||
|
|
||||||
layout.separator()
|
layout.separator()
|
||||||
|
|
||||||
layout.operator_menu_enum("armature.flags_set", "mode", text="Bone Settings")
|
layout.menu("VIEW3D_MT_bone_options_toggle", text="Bone Settings")
|
||||||
|
|
||||||
|
|
||||||
class VIEW3D_MT_armature_specials(bpy.types.Menu):
|
class VIEW3D_MT_armature_specials(bpy.types.Menu):
|
||||||
|
@ -999,7 +999,11 @@ class VIEW3D_PT_tools_brush_appearance(PaintPanel, bpy.types.Panel):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
return (context.sculpt_object and context.tool_settings.sculpt) or (context.vertex_paint_object and context.tool_settings.vertex_paint) or (context.weight_paint_object and context.tool_settings.weight_paint) or (context.image_paint_object and context.tool_settings.image_paint)
|
ts = context.tool_settings
|
||||||
|
return ((context.sculpt_object and ts.sculpt) or
|
||||||
|
(context.vertex_paint_object and ts.vertex_paint) or
|
||||||
|
(context.weight_paint_object and ts.weight_paint) or
|
||||||
|
(context.image_paint_object and ts.image_paint))
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
layout = self.layout
|
layout = self.layout
|
||||||
@ -1007,6 +1011,10 @@ class VIEW3D_PT_tools_brush_appearance(PaintPanel, bpy.types.Panel):
|
|||||||
settings = __class__.paint_settings(context)
|
settings = __class__.paint_settings(context)
|
||||||
brush = settings.brush
|
brush = settings.brush
|
||||||
|
|
||||||
|
if brush is None: # unlikely but can happen
|
||||||
|
layout.label(text="Brush Unset")
|
||||||
|
return
|
||||||
|
|
||||||
col = layout.column()
|
col = layout.column()
|
||||||
|
|
||||||
if context.sculpt_object and context.tool_settings.sculpt:
|
if context.sculpt_object and context.tool_settings.sculpt:
|
||||||
|
@ -64,6 +64,7 @@
|
|||||||
#include "BLI_dynstr.h"
|
#include "BLI_dynstr.h"
|
||||||
#include "BLI_path_util.h"
|
#include "BLI_path_util.h"
|
||||||
#include "BLI_utildefines.h"
|
#include "BLI_utildefines.h"
|
||||||
|
#include "BLI_callbacks.h"
|
||||||
|
|
||||||
#include "IMB_imbuf.h"
|
#include "IMB_imbuf.h"
|
||||||
|
|
||||||
@ -96,7 +97,7 @@ UserDef U;
|
|||||||
/* ListBase = {NULL, NULL}; */
|
/* ListBase = {NULL, NULL}; */
|
||||||
short ENDIAN_ORDER;
|
short ENDIAN_ORDER;
|
||||||
|
|
||||||
static char versionstr[48]= "";
|
char versionstr[48]= "";
|
||||||
|
|
||||||
/* ********** free ********** */
|
/* ********** free ********** */
|
||||||
|
|
||||||
@ -110,6 +111,9 @@ void free_blender(void)
|
|||||||
BKE_spacetypes_free(); /* after free main, it uses space callbacks */
|
BKE_spacetypes_free(); /* after free main, it uses space callbacks */
|
||||||
|
|
||||||
IMB_exit();
|
IMB_exit();
|
||||||
|
|
||||||
|
BLI_cb_finalize();
|
||||||
|
|
||||||
seq_stripelem_cache_destruct();
|
seq_stripelem_cache_destruct();
|
||||||
|
|
||||||
free_nodesystem();
|
free_nodesystem();
|
||||||
@ -129,9 +133,9 @@ void initglobals(void)
|
|||||||
ENDIAN_ORDER= (((char*)&ENDIAN_ORDER)[0])? L_ENDIAN: B_ENDIAN;
|
ENDIAN_ORDER= (((char*)&ENDIAN_ORDER)[0])? L_ENDIAN: B_ENDIAN;
|
||||||
|
|
||||||
if(BLENDER_SUBVERSION)
|
if(BLENDER_SUBVERSION)
|
||||||
BLI_snprintf(versionstr, sizeof(versionstr), "www.blender.org %d.%d", BLENDER_VERSION, BLENDER_SUBVERSION);
|
BLI_snprintf(versionstr, sizeof(versionstr), "blender.org %d.%d", BLENDER_VERSION, BLENDER_SUBVERSION);
|
||||||
else
|
else
|
||||||
BLI_snprintf(versionstr, sizeof(versionstr), "www.blender.org %d", BLENDER_VERSION);
|
BLI_snprintf(versionstr, sizeof(versionstr), "blender.org %d", BLENDER_VERSION);
|
||||||
|
|
||||||
#ifdef _WIN32 // FULLSCREEN
|
#ifdef _WIN32 // FULLSCREEN
|
||||||
G.windowstate = G_WINDOWSTATE_USERDEF;
|
G.windowstate = G_WINDOWSTATE_USERDEF;
|
||||||
|
@ -235,8 +235,6 @@ void make_local_brush(Brush *brush)
|
|||||||
if(paint_brush(&scene->toolsettings->imapaint.paint)==brush) {
|
if(paint_brush(&scene->toolsettings->imapaint.paint)==brush) {
|
||||||
if(scene->id.lib==NULL) {
|
if(scene->id.lib==NULL) {
|
||||||
paint_brush_set(&scene->toolsettings->imapaint.paint, brushn);
|
paint_brush_set(&scene->toolsettings->imapaint.paint, brushn);
|
||||||
brushn->id.us++;
|
|
||||||
brush->id.us--;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -85,8 +85,11 @@ Brush *paint_brush(Paint *p)
|
|||||||
|
|
||||||
void paint_brush_set(Paint *p, Brush *br)
|
void paint_brush_set(Paint *p, Brush *br)
|
||||||
{
|
{
|
||||||
if(p)
|
if(p) {
|
||||||
|
id_us_min((ID *)p->brush);
|
||||||
|
id_us_plus((ID *)br);
|
||||||
p->brush= br;
|
p->brush= br;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int paint_facesel_test(Object *ob)
|
int paint_facesel_test(Object *ob)
|
||||||
@ -114,12 +117,17 @@ void paint_init(Paint *p, const char col[3])
|
|||||||
p->flags |= PAINT_SHOW_BRUSH;
|
p->flags |= PAINT_SHOW_BRUSH;
|
||||||
}
|
}
|
||||||
|
|
||||||
void free_paint(Paint *UNUSED(paint))
|
void free_paint(Paint *paint)
|
||||||
{
|
{
|
||||||
/* nothing */
|
id_us_min((ID *)paint->brush);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* called when copying scene settings, so even if 'src' and 'tar' are the same
|
||||||
|
* still do a id_us_plus(), rather then if we were copying betweem 2 existing
|
||||||
|
* scenes where a matching value should decrease the existing user count as
|
||||||
|
* with paint_brush_set() */
|
||||||
void copy_paint(Paint *src, Paint *tar)
|
void copy_paint(Paint *src, Paint *tar)
|
||||||
{
|
{
|
||||||
tar->brush= src->brush;
|
tar->brush= src->brush;
|
||||||
|
id_us_plus((ID *)tar->brush);
|
||||||
}
|
}
|
||||||
|
@ -498,8 +498,9 @@ int sound_scene_playing(struct Scene *scene)
|
|||||||
int sound_read_sound_buffer(struct bSound* sound, float* buffer, int length, float start, float end)
|
int sound_read_sound_buffer(struct bSound* sound, float* buffer, int length, float start, float end)
|
||||||
{
|
{
|
||||||
AUD_Sound* limiter = AUD_limitSound(sound->cache, start, end);
|
AUD_Sound* limiter = AUD_limitSound(sound->cache, start, end);
|
||||||
return AUD_readSound(limiter, buffer, length);
|
int ret= AUD_readSound(limiter, buffer, length);
|
||||||
AUD_unload(limiter);
|
AUD_unload(limiter);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sound_get_channels(struct bSound* sound)
|
int sound_get_channels(struct bSound* sound)
|
||||||
|
72
source/blender/blenlib/BLI_callbacks.h
Normal file
72
source/blender/blenlib/BLI_callbacks.h
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* The Original Code is: all of this file.
|
||||||
|
*
|
||||||
|
* Contributor(s): mar 2001 Nzc
|
||||||
|
*
|
||||||
|
* ***** END GPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** \file blender/blenlib/BLI_callbacks.h
|
||||||
|
* \ingroup bli
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef BLI_CALLBACKS_H
|
||||||
|
#define BLI_CALLBACKS_H
|
||||||
|
|
||||||
|
struct bContext;
|
||||||
|
struct Main;
|
||||||
|
struct ID;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
BLI_CB_EVT_RENDER_PRE,
|
||||||
|
BLI_CB_EVT_RENDER_POST,
|
||||||
|
BLI_CB_EVT_LOAD_PRE,
|
||||||
|
BLI_CB_EVT_LOAD_POST,
|
||||||
|
BLI_CB_EVT_SAVE_PRE,
|
||||||
|
BLI_CB_EVT_SAVE_POST,
|
||||||
|
BLI_CB_EVT_TOT
|
||||||
|
} eCbEvent;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
struct bCallbackFuncStore *next, *prev;
|
||||||
|
void (* func)(struct Main *, struct ID *, void *arg);
|
||||||
|
void *arg;
|
||||||
|
short alloc;
|
||||||
|
} bCallbackFuncStore;
|
||||||
|
|
||||||
|
|
||||||
|
void BLI_exec_cb(struct Main *main, struct ID *self, eCbEvent evt);
|
||||||
|
void BLI_add_cb(bCallbackFuncStore *funcstore, eCbEvent evt);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
void BLI_cb_init(void);
|
||||||
|
void BLI_cb_finalize(void);
|
||||||
|
|
||||||
|
|
||||||
|
/* This is blenlib internal only, unrelated to above */
|
||||||
|
void callLocalErrorCallBack(const char* msg);
|
@ -68,6 +68,7 @@ void closest_to_line_segment_v3(float r[3], const float p[3], const float l1[3],
|
|||||||
|
|
||||||
float line_point_factor_v3(const float p[3], const float l1[3], const float l2[3]);
|
float line_point_factor_v3(const float p[3], const float l1[3], const float l2[3]);
|
||||||
float line_point_factor_v2(const float p[2], const float l1[2], const float l2[2]);
|
float line_point_factor_v2(const float p[2], const float l1[2], const float l2[2]);
|
||||||
|
|
||||||
/******************************* Intersection ********************************/
|
/******************************* Intersection ********************************/
|
||||||
|
|
||||||
/* TODO int return value consistency */
|
/* TODO int return value consistency */
|
||||||
|
@ -52,6 +52,7 @@ set(SRC
|
|||||||
intern/DLRB_tree.c
|
intern/DLRB_tree.c
|
||||||
intern/boxpack2d.c
|
intern/boxpack2d.c
|
||||||
intern/bpath.c
|
intern/bpath.c
|
||||||
|
intern/callbacks.c
|
||||||
intern/cpu.c
|
intern/cpu.c
|
||||||
intern/dynlib.c
|
intern/dynlib.c
|
||||||
intern/edgehash.c
|
intern/edgehash.c
|
||||||
@ -89,6 +90,7 @@ set(SRC
|
|||||||
BLI_blenlib.h
|
BLI_blenlib.h
|
||||||
BLI_boxpack2d.h
|
BLI_boxpack2d.h
|
||||||
BLI_bpath.h
|
BLI_bpath.h
|
||||||
|
BLI_callbacks.h
|
||||||
BLI_cpu.h
|
BLI_cpu.h
|
||||||
BLI_dlrbTree.h
|
BLI_dlrbTree.h
|
||||||
BLI_dynlib.h
|
BLI_dynlib.h
|
||||||
@ -132,7 +134,6 @@ set(SRC
|
|||||||
BLI_voxel.h
|
BLI_voxel.h
|
||||||
BLI_winstuff.h
|
BLI_winstuff.h
|
||||||
PIL_time.h
|
PIL_time.h
|
||||||
intern/BLI_callbacks.h
|
|
||||||
intern/dynamiclist.h
|
intern/dynamiclist.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
70
source/blender/blenlib/intern/callbacks.c
Normal file
70
source/blender/blenlib/intern/callbacks.c
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
* Contributor(s): Blender Foundation (2011)
|
||||||
|
*
|
||||||
|
* ***** END GPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "BLI_utildefines.h"
|
||||||
|
#include "BLI_listbase.h"
|
||||||
|
#include "BLI_callbacks.h"
|
||||||
|
|
||||||
|
#include "MEM_guardedalloc.h"
|
||||||
|
|
||||||
|
static ListBase callback_slots[BLI_CB_EVT_TOT]= {{0}};
|
||||||
|
|
||||||
|
void BLI_exec_cb(struct Main *main, struct ID *self, eCbEvent evt)
|
||||||
|
{
|
||||||
|
ListBase *lb= &callback_slots[evt];
|
||||||
|
bCallbackFuncStore *funcstore;
|
||||||
|
|
||||||
|
for(funcstore= (bCallbackFuncStore *)lb->first; funcstore; funcstore= (bCallbackFuncStore *)funcstore->next) {
|
||||||
|
funcstore->func(main, self, funcstore->arg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void BLI_add_cb(bCallbackFuncStore *funcstore, eCbEvent evt)
|
||||||
|
{
|
||||||
|
ListBase *lb= &callback_slots[evt];
|
||||||
|
BLI_addtail(lb, funcstore);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BLI_cb_init(void)
|
||||||
|
{
|
||||||
|
/* do nothing */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* call on application exit */
|
||||||
|
void BLI_cb_finalize(void)
|
||||||
|
{
|
||||||
|
eCbEvent evt;
|
||||||
|
for(evt= 0; evt < BLI_CB_EVT_TOT; evt++) {
|
||||||
|
ListBase *lb= &callback_slots[evt];
|
||||||
|
bCallbackFuncStore *funcstore;
|
||||||
|
bCallbackFuncStore *funcstore_next;
|
||||||
|
for(funcstore= (bCallbackFuncStore *)lb->first; funcstore; funcstore= funcstore_next) {
|
||||||
|
funcstore_next= (bCallbackFuncStore *)funcstore->next;
|
||||||
|
BLI_remlink(lb, funcstore);
|
||||||
|
if(funcstore->alloc) {
|
||||||
|
MEM_freeN(funcstore);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -37,8 +37,6 @@
|
|||||||
#include "BLI_memarena.h"
|
#include "BLI_memarena.h"
|
||||||
#include "BLI_utildefines.h"
|
#include "BLI_utildefines.h"
|
||||||
|
|
||||||
static float lambda_cp_line(const float p[3], const float l1[3], const float l2[3]);
|
|
||||||
|
|
||||||
/********************************** Polygons *********************************/
|
/********************************** Polygons *********************************/
|
||||||
|
|
||||||
void cent_tri_v3(float cent[3], const float v1[3], const float v2[3], const float v3[3])
|
void cent_tri_v3(float cent[3], const float v1[3], const float v2[3], const float v3[3])
|
||||||
@ -432,7 +430,7 @@ int isect_line_sphere_v2(const float l1[2], const float l2[2],
|
|||||||
l2[1] - l1[1]
|
l2[1] - l1[1]
|
||||||
};
|
};
|
||||||
|
|
||||||
const float a= dot_v2v2(ldir, ldir);
|
const float a= dot_v3v3(ldir, ldir);
|
||||||
|
|
||||||
const float b= 2.0f *
|
const float b= 2.0f *
|
||||||
(ldir[0] * (l1[0] - sp[0]) +
|
(ldir[0] * (l1[0] - sp[0]) +
|
||||||
@ -795,7 +793,7 @@ int isect_line_plane_v3(float out[3], const float l1[3], const float l2[3], cons
|
|||||||
|
|
||||||
add_v3_v3v3(l1_plane, l1, p_no);
|
add_v3_v3v3(l1_plane, l1, p_no);
|
||||||
|
|
||||||
dist = lambda_cp_line(plane_co, l1, l1_plane);
|
dist = line_point_factor_v3(plane_co, l1, l1_plane);
|
||||||
|
|
||||||
/* treat line like a ray, when 'no_flip' is set */
|
/* treat line like a ray, when 'no_flip' is set */
|
||||||
if(no_flip && dist < 0.0f) {
|
if(no_flip && dist < 0.0f) {
|
||||||
@ -1245,7 +1243,7 @@ float closest_to_line_v2(float cp[2],const float p[2], const float l1[2], const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* little sister we only need to know lambda */
|
/* little sister we only need to know lambda */
|
||||||
static float lambda_cp_line(const float p[3], const float l1[3], const float l2[3])
|
float line_point_factor_v3(const float p[3], const float l1[3], const float l2[3])
|
||||||
{
|
{
|
||||||
float h[3],u[3];
|
float h[3],u[3];
|
||||||
sub_v3_v3v3(u, l2, l1);
|
sub_v3_v3v3(u, l2, l1);
|
||||||
@ -1253,6 +1251,14 @@ static float lambda_cp_line(const float p[3], const float l1[3], const float l2[
|
|||||||
return(dot_v3v3(u,h)/dot_v3v3(u,u));
|
return(dot_v3v3(u,h)/dot_v3v3(u,u));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float line_point_factor_v2(const float p[2], const float l1[2], const float l2[2])
|
||||||
|
{
|
||||||
|
float h[2], u[2];
|
||||||
|
sub_v2_v2v2(u, l2, l1);
|
||||||
|
sub_v2_v2v2(h, p, l1);
|
||||||
|
return(dot_v2v2(u, h)/dot_v2v2(u, u));
|
||||||
|
}
|
||||||
|
|
||||||
/* Similar to LineIntersectsTriangleUV, except it operates on a quad and in 2d, assumes point is in quad */
|
/* Similar to LineIntersectsTriangleUV, except it operates on a quad and in 2d, assumes point is in quad */
|
||||||
void isect_point_quad_uv_v2(const float v0[2], const float v1[2], const float v2[2], const float v3[2], const float pt[2], float *uv)
|
void isect_point_quad_uv_v2(const float v0[2], const float v1[2], const float v2[2], const float v3[2], const float pt[2], float *uv)
|
||||||
{
|
{
|
||||||
|
@ -3538,6 +3538,18 @@ static void direct_link_mesh(FileData *fd, Mesh *mesh)
|
|||||||
mesh->mr->edge_creases= newdataadr(fd, mesh->mr->edge_creases);
|
mesh->mr->edge_creases= newdataadr(fd, mesh->mr->edge_creases);
|
||||||
|
|
||||||
mesh->mr->verts = newdataadr(fd, mesh->mr->verts);
|
mesh->mr->verts = newdataadr(fd, mesh->mr->verts);
|
||||||
|
|
||||||
|
/* If mesh has the same number of vertices as the
|
||||||
|
highest multires level, load the current mesh verts
|
||||||
|
into multires and discard the old data. Needed
|
||||||
|
because some saved files either do not have a verts
|
||||||
|
array, or the verts array contains out-of-date
|
||||||
|
data. */
|
||||||
|
if(mesh->totvert == ((MultiresLevel*)mesh->mr->levels.last)->totvert) {
|
||||||
|
if(mesh->mr->verts)
|
||||||
|
MEM_freeN(mesh->mr->verts);
|
||||||
|
mesh->mr->verts = MEM_dupallocN(mesh->mvert);
|
||||||
|
}
|
||||||
|
|
||||||
for(; lvl; lvl= lvl->next) {
|
for(; lvl; lvl= lvl->next) {
|
||||||
lvl->verts= newdataadr(fd, lvl->verts);
|
lvl->verts= newdataadr(fd, lvl->verts);
|
||||||
@ -3547,16 +3559,11 @@ static void direct_link_mesh(FileData *fd, Mesh *mesh)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Gracefully handle corrupted mesh */
|
/* if multires is present but has no valid vertex data,
|
||||||
|
there's no way to recover it; silently remove multires */
|
||||||
if(mesh->mr && !mesh->mr->verts) {
|
if(mesh->mr && !mesh->mr->verts) {
|
||||||
/* If totals match, simply load the current mesh verts into multires */
|
multires_free(mesh->mr);
|
||||||
if(mesh->totvert == ((MultiresLevel*)mesh->mr->levels.last)->totvert)
|
mesh->mr = NULL;
|
||||||
mesh->mr->verts = MEM_dupallocN(mesh->mvert);
|
|
||||||
else {
|
|
||||||
/* Otherwise, we can't recover the data, silently remove multires */
|
|
||||||
multires_free(mesh->mr);
|
|
||||||
mesh->mr = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if((fd->flags & FD_FLAGS_SWITCH_ENDIAN) && mesh->tface) {
|
if((fd->flags & FD_FLAGS_SWITCH_ENDIAN) && mesh->tface) {
|
||||||
|
@ -79,8 +79,6 @@ void ARMATURE_OT_separate(struct wmOperatorType *ot);
|
|||||||
void ARMATURE_OT_autoside_names(struct wmOperatorType *ot);
|
void ARMATURE_OT_autoside_names(struct wmOperatorType *ot);
|
||||||
void ARMATURE_OT_flip_names(struct wmOperatorType *ot);
|
void ARMATURE_OT_flip_names(struct wmOperatorType *ot);
|
||||||
|
|
||||||
void ARMATURE_OT_flags_set(struct wmOperatorType *ot);
|
|
||||||
|
|
||||||
void ARMATURE_OT_layers_show_all(struct wmOperatorType *ot);
|
void ARMATURE_OT_layers_show_all(struct wmOperatorType *ot);
|
||||||
void ARMATURE_OT_armature_layers(struct wmOperatorType *ot);
|
void ARMATURE_OT_armature_layers(struct wmOperatorType *ot);
|
||||||
void ARMATURE_OT_bone_layers(struct wmOperatorType *ot);
|
void ARMATURE_OT_bone_layers(struct wmOperatorType *ot);
|
||||||
@ -125,8 +123,6 @@ void POSE_OT_flip_names(struct wmOperatorType *ot);
|
|||||||
|
|
||||||
void POSE_OT_quaternions_flip(struct wmOperatorType *ot);
|
void POSE_OT_quaternions_flip(struct wmOperatorType *ot);
|
||||||
|
|
||||||
void POSE_OT_flags_set(struct wmOperatorType *ot);
|
|
||||||
|
|
||||||
void POSE_OT_armature_layers(struct wmOperatorType *ot);
|
void POSE_OT_armature_layers(struct wmOperatorType *ot);
|
||||||
void POSE_OT_bone_layers(struct wmOperatorType *ot);
|
void POSE_OT_bone_layers(struct wmOperatorType *ot);
|
||||||
|
|
||||||
|
@ -85,8 +85,6 @@ void ED_operatortypes_armature(void)
|
|||||||
WM_operatortype_append(ARMATURE_OT_autoside_names);
|
WM_operatortype_append(ARMATURE_OT_autoside_names);
|
||||||
WM_operatortype_append(ARMATURE_OT_flip_names);
|
WM_operatortype_append(ARMATURE_OT_flip_names);
|
||||||
|
|
||||||
WM_operatortype_append(ARMATURE_OT_flags_set);
|
|
||||||
|
|
||||||
WM_operatortype_append(ARMATURE_OT_layers_show_all);
|
WM_operatortype_append(ARMATURE_OT_layers_show_all);
|
||||||
WM_operatortype_append(ARMATURE_OT_armature_layers);
|
WM_operatortype_append(ARMATURE_OT_armature_layers);
|
||||||
WM_operatortype_append(ARMATURE_OT_bone_layers);
|
WM_operatortype_append(ARMATURE_OT_bone_layers);
|
||||||
@ -141,8 +139,6 @@ void ED_operatortypes_armature(void)
|
|||||||
|
|
||||||
WM_operatortype_append(POSE_OT_quaternions_flip);
|
WM_operatortype_append(POSE_OT_quaternions_flip);
|
||||||
|
|
||||||
WM_operatortype_append(POSE_OT_flags_set);
|
|
||||||
|
|
||||||
WM_operatortype_append(POSE_OT_armature_layers);
|
WM_operatortype_append(POSE_OT_armature_layers);
|
||||||
WM_operatortype_append(POSE_OT_bone_layers);
|
WM_operatortype_append(POSE_OT_bone_layers);
|
||||||
|
|
||||||
@ -269,7 +265,7 @@ void ED_keymap_armature(wmKeyConfig *keyconf)
|
|||||||
|
|
||||||
/* set flags */
|
/* set flags */
|
||||||
WM_keymap_add_menu(keymap, "VIEW3D_MT_bone_options_toggle", WKEY, KM_PRESS, KM_SHIFT, 0);
|
WM_keymap_add_menu(keymap, "VIEW3D_MT_bone_options_toggle", WKEY, KM_PRESS, KM_SHIFT, 0);
|
||||||
WM_keymap_add_menu(keymap, "VIEW3D_MT_bone_options_enable", WKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
|
WM_keymap_add_menu(keymap, "VIEW3D_MT_bone_options_enable", WKEY, KM_PRESS, KM_CTRL, 0);
|
||||||
WM_keymap_add_menu(keymap, "VIEW3D_MT_bone_options_disable", WKEY, KM_PRESS, KM_ALT, 0);
|
WM_keymap_add_menu(keymap, "VIEW3D_MT_bone_options_disable", WKEY, KM_PRESS, KM_ALT, 0);
|
||||||
|
|
||||||
/* armature/bone layers */
|
/* armature/bone layers */
|
||||||
@ -347,7 +343,7 @@ void ED_keymap_armature(wmKeyConfig *keyconf)
|
|||||||
|
|
||||||
/* set flags */
|
/* set flags */
|
||||||
WM_keymap_add_menu(keymap, "VIEW3D_MT_bone_options_toggle", WKEY, KM_PRESS, KM_SHIFT, 0);
|
WM_keymap_add_menu(keymap, "VIEW3D_MT_bone_options_toggle", WKEY, KM_PRESS, KM_SHIFT, 0);
|
||||||
WM_keymap_add_menu(keymap, "VIEW3D_MT_bone_options_enable", WKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
|
WM_keymap_add_menu(keymap, "VIEW3D_MT_bone_options_enable", WKEY, KM_PRESS, KM_CTRL, 0);
|
||||||
WM_keymap_add_menu(keymap, "VIEW3D_MT_bone_options_disable", WKEY, KM_PRESS, KM_ALT, 0);
|
WM_keymap_add_menu(keymap, "VIEW3D_MT_bone_options_disable", WKEY, KM_PRESS, KM_ALT, 0);
|
||||||
|
|
||||||
/* armature/bone layers */
|
/* armature/bone layers */
|
||||||
|
@ -1352,30 +1352,6 @@ static void *get_nearest_bone (bContext *C, short findunsel, int x, int y)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* helper for setflag_sel_bone() */
|
|
||||||
static void bone_setflag (int *bone, int flag, short mode)
|
|
||||||
{
|
|
||||||
if (bone && flag) {
|
|
||||||
/* exception for inverse flags */
|
|
||||||
if (flag == BONE_NO_DEFORM) {
|
|
||||||
if (mode == 2)
|
|
||||||
*bone |= flag;
|
|
||||||
else if (mode == 1)
|
|
||||||
*bone &= ~flag;
|
|
||||||
else
|
|
||||||
*bone ^= flag;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (mode == 2)
|
|
||||||
*bone &= ~flag;
|
|
||||||
else if (mode == 1)
|
|
||||||
*bone |= flag;
|
|
||||||
else
|
|
||||||
*bone ^= flag;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Get the first available child of an editbone */
|
/* Get the first available child of an editbone */
|
||||||
static EditBone *editbone_get_child(bArmature *arm, EditBone *pabone, short use_visibility)
|
static EditBone *editbone_get_child(bArmature *arm, EditBone *pabone, short use_visibility)
|
||||||
{
|
{
|
||||||
@ -1396,105 +1372,6 @@ static EditBone *editbone_get_child(bArmature *arm, EditBone *pabone, short use_
|
|||||||
return chbone;
|
return chbone;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* callback for posemode setflag */
|
|
||||||
static int pose_setflag_exec (bContext *C, wmOperator *op)
|
|
||||||
{
|
|
||||||
int flag= RNA_enum_get(op->ptr, "type");
|
|
||||||
int mode= RNA_enum_get(op->ptr, "mode");
|
|
||||||
|
|
||||||
/* loop over all selected pchans */
|
|
||||||
CTX_DATA_BEGIN(C, bPoseChannel *, pchan, selected_pose_bones)
|
|
||||||
{
|
|
||||||
bone_setflag(&pchan->bone->flag, flag, mode);
|
|
||||||
}
|
|
||||||
CTX_DATA_END;
|
|
||||||
|
|
||||||
/* note, notifier might evolve */
|
|
||||||
WM_event_add_notifier(C, NC_OBJECT|ND_POSE, ED_object_pose_armature(CTX_data_active_object(C)));
|
|
||||||
|
|
||||||
return OPERATOR_FINISHED;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* callback for editbones setflag */
|
|
||||||
static int armature_bones_setflag_exec (bContext *C, wmOperator *op)
|
|
||||||
{
|
|
||||||
int flag= RNA_enum_get(op->ptr, "type");
|
|
||||||
int mode= RNA_enum_get(op->ptr, "mode");
|
|
||||||
|
|
||||||
/* loop over all selected pchans */
|
|
||||||
CTX_DATA_BEGIN(C, EditBone *, ebone, selected_bones)
|
|
||||||
{
|
|
||||||
bone_setflag(&ebone->flag, flag, mode);
|
|
||||||
}
|
|
||||||
CTX_DATA_END;
|
|
||||||
|
|
||||||
/* note, notifier might evolve */
|
|
||||||
WM_event_add_notifier(C, NC_OBJECT|ND_POSE, CTX_data_edit_object(C));
|
|
||||||
|
|
||||||
return OPERATOR_FINISHED;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* settings that can be changed */
|
|
||||||
static EnumPropertyItem prop_bone_setting_types[] = {
|
|
||||||
{BONE_DRAWWIRE, "DRAWWIRE", 0, "Draw Wire", ""},
|
|
||||||
{BONE_NO_DEFORM, "DEFORM", 0, "Deform", ""},
|
|
||||||
{BONE_MULT_VG_ENV, "MULT_VG", 0, "Multiply Vertex Groups", ""},
|
|
||||||
{BONE_HINGE, "HINGE", 0, "Hinge", ""},
|
|
||||||
{BONE_NO_SCALE, "NO_SCALE", 0, "No Scale", ""},
|
|
||||||
{BONE_EDITMODE_LOCKED, "LOCKED", 0, "Locked", "(For EditMode only)"},
|
|
||||||
{0, NULL, 0, NULL, NULL}
|
|
||||||
};
|
|
||||||
|
|
||||||
/* ways that settings can be changed */
|
|
||||||
static EnumPropertyItem prop_bone_setting_modes[] = {
|
|
||||||
{0, "CLEAR", 0, "Clear", ""},
|
|
||||||
{1, "ENABLE", 0, "Enable", ""},
|
|
||||||
{2, "TOGGLE", 0, "Toggle", ""},
|
|
||||||
{0, NULL, 0, NULL, NULL}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
void ARMATURE_OT_flags_set (wmOperatorType *ot)
|
|
||||||
{
|
|
||||||
/* identifiers */
|
|
||||||
ot->name= "Set Bone Flags";
|
|
||||||
ot->idname= "ARMATURE_OT_flags_set";
|
|
||||||
ot->description= "Set flags for armature bones";
|
|
||||||
|
|
||||||
/* callbacks */
|
|
||||||
ot->invoke= WM_menu_invoke;
|
|
||||||
ot->exec= armature_bones_setflag_exec;
|
|
||||||
ot->poll= ED_operator_editarmature;
|
|
||||||
|
|
||||||
/* flags */
|
|
||||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
|
||||||
|
|
||||||
/* properties */
|
|
||||||
ot->prop= RNA_def_enum(ot->srna, "type", prop_bone_setting_types, 0, "Type", "");
|
|
||||||
RNA_def_enum(ot->srna, "mode", prop_bone_setting_modes, 0, "Mode", "");
|
|
||||||
}
|
|
||||||
|
|
||||||
void POSE_OT_flags_set (wmOperatorType *ot)
|
|
||||||
{
|
|
||||||
/* identifiers */
|
|
||||||
ot->name= "Set Bone Flags";
|
|
||||||
ot->idname= "POSE_OT_flags_set";
|
|
||||||
ot->description= "Set flags for armature bones";
|
|
||||||
|
|
||||||
/* callbacks */
|
|
||||||
ot->invoke= WM_menu_invoke;
|
|
||||||
ot->exec= pose_setflag_exec;
|
|
||||||
ot->poll= ED_operator_posemode;
|
|
||||||
|
|
||||||
/* flags */
|
|
||||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
|
||||||
|
|
||||||
/* properties */
|
|
||||||
ot->prop= RNA_def_enum(ot->srna, "type", prop_bone_setting_types, 0, "Type", "");
|
|
||||||
RNA_def_enum(ot->srna, "mode", prop_bone_setting_modes, 0, "Mode", "");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* **************** END PoseMode & EditMode *************************** */
|
/* **************** END PoseMode & EditMode *************************** */
|
||||||
/* **************** Posemode stuff ********************** */
|
/* **************** Posemode stuff ********************** */
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -868,7 +868,7 @@ static int similar_face_select_exec(bContext *C, wmOperator *op)
|
|||||||
Mesh *me= obedit->data;
|
Mesh *me= obedit->data;
|
||||||
EditMesh *em= BKE_mesh_get_editmesh(me);
|
EditMesh *em= BKE_mesh_get_editmesh(me);
|
||||||
|
|
||||||
int selcount = similar_face_select__internal(em, RNA_int_get(op->ptr, "type"), RNA_float_get(op->ptr, "threshold"));
|
int selcount = similar_face_select__internal(em, RNA_enum_get(op->ptr, "type"), RNA_float_get(op->ptr, "threshold"));
|
||||||
|
|
||||||
if (selcount) {
|
if (selcount) {
|
||||||
/* here was an edge-mode only select flush case, has to be generalized */
|
/* here was an edge-mode only select flush case, has to be generalized */
|
||||||
|
@ -852,7 +852,6 @@ static void finish_images(MultiresBakeRender *bkr)
|
|||||||
|
|
||||||
for(link= bkr->image.first; link; link= link->next) {
|
for(link= bkr->image.first; link; link= link->next) {
|
||||||
Image *ima= (Image*)link->data;
|
Image *ima= (Image*)link->data;
|
||||||
int i;
|
|
||||||
ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
|
ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
|
||||||
|
|
||||||
if(ibuf->x<=0 || ibuf->y<=0)
|
if(ibuf->x<=0 || ibuf->y<=0)
|
||||||
|
@ -1174,25 +1174,6 @@ static void project_face_seams_init(const ProjPaintState *ps, const int face_ind
|
|||||||
#endif // PROJ_DEBUG_NOSEAMBLEED
|
#endif // PROJ_DEBUG_NOSEAMBLEED
|
||||||
|
|
||||||
|
|
||||||
/* TODO - move to math_geom.c */
|
|
||||||
|
|
||||||
/* little sister we only need to know lambda */
|
|
||||||
#ifndef PROJ_DEBUG_NOSEAMBLEED
|
|
||||||
static float lambda_cp_line2(const float p[2], const float l1[2], const float l2[2])
|
|
||||||
{
|
|
||||||
float h[2], u[2];
|
|
||||||
|
|
||||||
u[0] = l2[0] - l1[0];
|
|
||||||
u[1] = l2[1] - l1[1];
|
|
||||||
|
|
||||||
h[0] = p[0] - l1[0];
|
|
||||||
h[1] = p[1] - l1[1];
|
|
||||||
|
|
||||||
return(dot_v2v2(u, h)/dot_v2v2(u, u));
|
|
||||||
}
|
|
||||||
#endif // PROJ_DEBUG_NOSEAMBLEED
|
|
||||||
|
|
||||||
|
|
||||||
/* Converts a UV location to a 3D screenspace location
|
/* Converts a UV location to a 3D screenspace location
|
||||||
* Takes a 'uv' and 3 UV coords, and sets the values of pixelScreenCo
|
* Takes a 'uv' and 3 UV coords, and sets the values of pixelScreenCo
|
||||||
*
|
*
|
||||||
@ -2518,9 +2499,9 @@ static void project_paint_face_init(const ProjPaintState *ps, const int thread_i
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* Since this is a seam we need to work out where on the line this pixel is */
|
/* Since this is a seam we need to work out where on the line this pixel is */
|
||||||
//fac = lambda_cp_line2(uv, uv_seam_quad[0], uv_seam_quad[1]);
|
//fac = line_point_factor_v2(uv, uv_seam_quad[0], uv_seam_quad[1]);
|
||||||
|
|
||||||
fac = lambda_cp_line2(uv, seam_subsection[0], seam_subsection[1]);
|
fac = line_point_factor_v2(uv, seam_subsection[0], seam_subsection[1]);
|
||||||
if (fac < 0.0f) { VECCOPY(pixelScreenCo, edge_verts_inset_clip[0]); }
|
if (fac < 0.0f) { VECCOPY(pixelScreenCo, edge_verts_inset_clip[0]); }
|
||||||
else if (fac > 1.0f) { VECCOPY(pixelScreenCo, edge_verts_inset_clip[1]); }
|
else if (fac > 1.0f) { VECCOPY(pixelScreenCo, edge_verts_inset_clip[1]); }
|
||||||
else { interp_v3_v3v3(pixelScreenCo, edge_verts_inset_clip[0], edge_verts_inset_clip[1], fac); }
|
else { interp_v3_v3v3(pixelScreenCo, edge_verts_inset_clip[0], edge_verts_inset_clip[1], fac); }
|
||||||
|
@ -357,13 +357,14 @@ static void stats_update(Scene *scene)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(!scene->stats)
|
if(!scene->stats)
|
||||||
scene->stats= MEM_mallocN(sizeof(SceneStats), "SceneStats");
|
scene->stats= MEM_callocN(sizeof(SceneStats), "SceneStats");
|
||||||
|
|
||||||
*(scene->stats)= stats;
|
*(scene->stats)= stats;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void stats_string(Scene *scene)
|
static void stats_string(Scene *scene)
|
||||||
{
|
{
|
||||||
|
extern char versionstr[]; /* from blender.c */
|
||||||
SceneStats *stats= scene->stats;
|
SceneStats *stats= scene->stats;
|
||||||
Object *ob= (scene->basact)? scene->basact->object: NULL;
|
Object *ob= (scene->basact)? scene->basact->object: NULL;
|
||||||
uintptr_t mem_in_use, mmap_in_use;
|
uintptr_t mem_in_use, mmap_in_use;
|
||||||
@ -379,6 +380,8 @@ static void stats_string(Scene *scene)
|
|||||||
sprintf(s, " (%.2fM)", (double)((mmap_in_use)>>10)/1024.0);
|
sprintf(s, " (%.2fM)", (double)((mmap_in_use)>>10)/1024.0);
|
||||||
|
|
||||||
s= stats->infostr;
|
s= stats->infostr;
|
||||||
|
|
||||||
|
s+= sprintf(s, "%s | ", versionstr);
|
||||||
|
|
||||||
if(scene->obedit) {
|
if(scene->obedit) {
|
||||||
if(ob_get_keyblock(scene->obedit))
|
if(ob_get_keyblock(scene->obedit))
|
||||||
|
@ -105,8 +105,8 @@ void constraintNumInput(TransInfo *t, float vec[3])
|
|||||||
if (getConstraintSpaceDimension(t) == 2) {
|
if (getConstraintSpaceDimension(t) == 2) {
|
||||||
int axis = mode & (CON_AXIS0|CON_AXIS1|CON_AXIS2);
|
int axis = mode & (CON_AXIS0|CON_AXIS1|CON_AXIS2);
|
||||||
if (axis == (CON_AXIS0|CON_AXIS1)) {
|
if (axis == (CON_AXIS0|CON_AXIS1)) {
|
||||||
vec[0] = vec[0];
|
/* vec[0] = vec[0]; */ /* same */
|
||||||
vec[1] = vec[1];
|
/* vec[1] = vec[1]; */ /* same */
|
||||||
vec[2] = nval;
|
vec[2] = nval;
|
||||||
}
|
}
|
||||||
else if (axis == (CON_AXIS1|CON_AXIS2)) {
|
else if (axis == (CON_AXIS1|CON_AXIS2)) {
|
||||||
@ -115,14 +115,14 @@ void constraintNumInput(TransInfo *t, float vec[3])
|
|||||||
vec[0] = nval;
|
vec[0] = nval;
|
||||||
}
|
}
|
||||||
else if (axis == (CON_AXIS0|CON_AXIS2)) {
|
else if (axis == (CON_AXIS0|CON_AXIS2)) {
|
||||||
vec[0] = vec[0];
|
/* vec[0] = vec[0]; */ /* same */
|
||||||
vec[2] = vec[1];
|
vec[2] = vec[1];
|
||||||
vec[1] = nval;
|
vec[1] = nval;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (getConstraintSpaceDimension(t) == 1) {
|
else if (getConstraintSpaceDimension(t) == 1) {
|
||||||
if (mode & CON_AXIS0) {
|
if (mode & CON_AXIS0) {
|
||||||
vec[0] = vec[0];
|
/* vec[0] = vec[0]; */ /* same */
|
||||||
vec[1] = nval;
|
vec[1] = nval;
|
||||||
vec[2] = nval;
|
vec[2] = nval;
|
||||||
}
|
}
|
||||||
|
@ -410,15 +410,15 @@ static void rna_def_ID_materials(BlenderRNA *brna)
|
|||||||
RNA_def_struct_ui_text(srna, "ID Materials", "Collection of materials");
|
RNA_def_struct_ui_text(srna, "ID Materials", "Collection of materials");
|
||||||
|
|
||||||
func= RNA_def_function(srna, "append", "material_append_id");
|
func= RNA_def_function(srna, "append", "material_append_id");
|
||||||
RNA_def_function_ui_description(func, "Add a new material to Mesh.");
|
RNA_def_function_ui_description(func, "Add a new material to the data block.");
|
||||||
parm= RNA_def_pointer(func, "material", "Material", "", "Material to add.");
|
parm= RNA_def_pointer(func, "material", "Material", "", "Material to add.");
|
||||||
RNA_def_property_flag(parm, PROP_REQUIRED);
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
||||||
|
|
||||||
func= RNA_def_function(srna, "pop", "material_pop_id");
|
func= RNA_def_function(srna, "pop", "material_pop_id");
|
||||||
RNA_def_function_ui_description(func, "Add a new material to Mesh.");
|
RNA_def_function_ui_description(func, "Remove a material from the data block.");
|
||||||
parm= RNA_def_int(func, "index", 0, 0, INT_MAX, "", "Frame number to set.", 0, INT_MAX);
|
parm= RNA_def_int(func, "index", 0, 0, INT_MAX, "", "Index of material to remove.", 0, INT_MAX);
|
||||||
RNA_def_property_flag(parm, PROP_REQUIRED);
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
||||||
parm= RNA_def_pointer(func, "material", "Material", "", "Material to add.");
|
parm= RNA_def_pointer(func, "material", "Material", "", "Material to remove.");
|
||||||
RNA_def_function_return(func, parm);
|
RNA_def_function_return(func, parm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1067,7 +1067,7 @@ static void rna_def_property(BlenderRNA *brna)
|
|||||||
prop= RNA_def_property(srna, "is_runtime", PROP_BOOLEAN, PROP_NONE);
|
prop= RNA_def_property(srna, "is_runtime", PROP_BOOLEAN, PROP_NONE);
|
||||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||||
RNA_def_property_boolean_funcs(prop, "rna_Property_runtime_get", NULL);
|
RNA_def_property_boolean_funcs(prop, "rna_Property_runtime_get", NULL);
|
||||||
RNA_def_property_ui_text(prop, "Read Only", "Property is editable through RNA");
|
RNA_def_property_ui_text(prop, "Runtime", "Property has been dynamically created at runtime");
|
||||||
|
|
||||||
prop= RNA_def_property(srna, "is_enum_flag", PROP_BOOLEAN, PROP_NONE);
|
prop= RNA_def_property(srna, "is_enum_flag", PROP_BOOLEAN, PROP_NONE);
|
||||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||||
|
@ -97,6 +97,7 @@ static void do_channel_matte(bNode *node, float *out, float *in)
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -467,6 +467,7 @@ static void node_composit_exec_glare(void *UNUSED(data), bNode *node, bNodeStack
|
|||||||
case 2:
|
case 2:
|
||||||
default:
|
default:
|
||||||
streaks(ndg, new, src);
|
streaks(ndg, new, src);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
free_compbuf(src);
|
free_compbuf(src);
|
||||||
|
@ -97,6 +97,7 @@ static void node_composit_exec_rotate(void *UNUSED(data), bNode *node, bNodeStac
|
|||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
bicubic_interpolation(ibuf, obuf, u, v, xo, yo);
|
bicubic_interpolation(ibuf, obuf, u, v, xo, yo);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -83,6 +83,8 @@ void BPY_text_free_code(struct Text *text);
|
|||||||
void BPY_modules_update(struct bContext *C); // XXX - annoying, need this for pointers that get out of date
|
void BPY_modules_update(struct bContext *C); // XXX - annoying, need this for pointers that get out of date
|
||||||
void BPY_modules_load_user(struct bContext *C);
|
void BPY_modules_load_user(struct bContext *C);
|
||||||
|
|
||||||
|
void BPY_app_handlers_reset(void);
|
||||||
|
|
||||||
void BPY_driver_reset(void);
|
void BPY_driver_reset(void);
|
||||||
float BPY_driver_exec(struct ChannelDriver *driver);
|
float BPY_driver_exec(struct ChannelDriver *driver);
|
||||||
|
|
||||||
|
@ -779,7 +779,7 @@ static PyObject *Matrix_resize_4x4(MatrixObject *self)
|
|||||||
for(blank_columns = (4 - self->col_size); blank_columns > 0; blank_columns--){
|
for(blank_columns = (4 - self->col_size); blank_columns > 0; blank_columns--){
|
||||||
self->contigPtr[new_pos + blank_columns] = 0.0f;
|
self->contigPtr[new_pos + blank_columns] = 0.0f;
|
||||||
}
|
}
|
||||||
for(curr_pos = curr_pos; curr_pos >= first_row_elem; curr_pos--){
|
for( ; curr_pos >= first_row_elem; curr_pos--){
|
||||||
self->contigPtr[new_pos] = self->contigPtr[curr_pos];
|
self->contigPtr[new_pos] = self->contigPtr[curr_pos];
|
||||||
new_pos--;
|
new_pos--;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
* $Id$
|
* $Id$
|
||||||
*
|
*
|
||||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||||
@ -522,7 +522,7 @@ static PyObject *M_Geometry_intersect_line_plane(PyObject *UNUSED(self), PyObjec
|
|||||||
VectorObject *line_a, *line_b, *plane_co, *plane_no;
|
VectorObject *line_a, *line_b, *plane_co, *plane_no;
|
||||||
int no_flip= 0;
|
int no_flip= 0;
|
||||||
float isect[3];
|
float isect[3];
|
||||||
if(!PyArg_ParseTuple(args, "O!O!O!O!|i:intersect_line_line_2d",
|
if(!PyArg_ParseTuple(args, "O!O!O!O!|i:intersect_line_plane",
|
||||||
&vector_Type, &line_a,
|
&vector_Type, &line_a,
|
||||||
&vector_Type, &line_b,
|
&vector_Type, &line_b,
|
||||||
&vector_Type, &plane_co,
|
&vector_Type, &plane_co,
|
||||||
@ -680,7 +680,7 @@ static PyObject *M_Geometry_intersect_line_sphere_2d(PyObject *UNUSED(self), PyO
|
|||||||
|
|
||||||
PyObject *ret= PyTuple_New(2);
|
PyObject *ret= PyTuple_New(2);
|
||||||
|
|
||||||
switch(isect_line_sphere_v2(line_a->vec, line_b->vec, sphere_co->vec, sphere_radius, isect_a, isect_b)) {
|
switch(isect_line_sphere_v3(line_a->vec, line_b->vec, sphere_co->vec, sphere_radius, isect_a, isect_b)) {
|
||||||
case 1:
|
case 1:
|
||||||
if(!(!clip || (((lambda= line_point_factor_v2(isect_a, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_a= FALSE;
|
if(!(!clip || (((lambda= line_point_factor_v2(isect_a, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_a= FALSE;
|
||||||
use_b= FALSE;
|
use_b= FALSE;
|
||||||
@ -1068,6 +1068,8 @@ static PyMethodDef M_Geometry_methods[]= {
|
|||||||
{"intersect_line_line", (PyCFunction) M_Geometry_intersect_line_line, METH_VARARGS, M_Geometry_intersect_line_line_doc},
|
{"intersect_line_line", (PyCFunction) M_Geometry_intersect_line_line, METH_VARARGS, M_Geometry_intersect_line_line_doc},
|
||||||
{"intersect_line_line_2d", (PyCFunction) M_Geometry_intersect_line_line_2d, METH_VARARGS, M_Geometry_intersect_line_line_2d_doc},
|
{"intersect_line_line_2d", (PyCFunction) M_Geometry_intersect_line_line_2d, METH_VARARGS, M_Geometry_intersect_line_line_2d_doc},
|
||||||
{"intersect_line_plane", (PyCFunction) M_Geometry_intersect_line_plane, METH_VARARGS, M_Geometry_intersect_line_plane_doc},
|
{"intersect_line_plane", (PyCFunction) M_Geometry_intersect_line_plane, METH_VARARGS, M_Geometry_intersect_line_plane_doc},
|
||||||
|
{"intersect_line_sphere", (PyCFunction) M_Geometry_intersect_line_sphere, METH_VARARGS, M_Geometry_intersect_line_sphere_doc},
|
||||||
|
{"intersect_line_sphere_2d", (PyCFunction) M_Geometry_intersect_line_sphere_2d, METH_VARARGS, M_Geometry_intersect_line_sphere_2d_doc},
|
||||||
{"interpolate_bezier", (PyCFunction) M_Geometry_interpolate_bezier, METH_VARARGS, M_Geometry_interpolate_bezier_doc},
|
{"interpolate_bezier", (PyCFunction) M_Geometry_interpolate_bezier, METH_VARARGS, M_Geometry_interpolate_bezier_doc},
|
||||||
{"area_tri", (PyCFunction) M_Geometry_area_tri, METH_VARARGS, M_Geometry_area_tri_doc},
|
{"area_tri", (PyCFunction) M_Geometry_area_tri, METH_VARARGS, M_Geometry_area_tri_doc},
|
||||||
{"normal", (PyCFunction) M_Geometry_normal, METH_VARARGS, M_Geometry_normal_doc},
|
{"normal", (PyCFunction) M_Geometry_normal, METH_VARARGS, M_Geometry_normal_doc},
|
||||||
|
@ -42,6 +42,7 @@ set(INC_SYS
|
|||||||
set(SRC
|
set(SRC
|
||||||
bpy.c
|
bpy.c
|
||||||
bpy_app.c
|
bpy_app.c
|
||||||
|
bpy_app_handlers.c
|
||||||
bpy_driver.c
|
bpy_driver.c
|
||||||
bpy_interface.c
|
bpy_interface.c
|
||||||
bpy_intern_string.c
|
bpy_intern_string.c
|
||||||
@ -59,6 +60,7 @@ set(SRC
|
|||||||
|
|
||||||
bpy.h
|
bpy.h
|
||||||
bpy_app.h
|
bpy_app.h
|
||||||
|
bpy_app_handlers.h
|
||||||
bpy_driver.h
|
bpy_driver.h
|
||||||
bpy_intern_string.h
|
bpy_intern_string.h
|
||||||
bpy_operator.h
|
bpy_operator.h
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include <Python.h>
|
#include <Python.h>
|
||||||
|
|
||||||
#include "bpy_app.h"
|
#include "bpy_app.h"
|
||||||
|
#include "bpy_app_handlers.h"
|
||||||
#include "bpy_driver.h"
|
#include "bpy_driver.h"
|
||||||
|
|
||||||
#include "BLI_path_util.h"
|
#include "BLI_path_util.h"
|
||||||
@ -74,6 +75,9 @@ static PyStructSequence_Field app_info_fields[]= {
|
|||||||
{(char *)"build_cxxflags", (char *)"C++ compiler flags"},
|
{(char *)"build_cxxflags", (char *)"C++ compiler flags"},
|
||||||
{(char *)"build_linkflags", (char *)"Binary linking flags"},
|
{(char *)"build_linkflags", (char *)"Binary linking flags"},
|
||||||
{(char *)"build_system", (char *)"Build system used"},
|
{(char *)"build_system", (char *)"Build system used"},
|
||||||
|
|
||||||
|
/* submodules */
|
||||||
|
{(char *)"handlers", (char *)"Application handler callbacks"},
|
||||||
{NULL}
|
{NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -140,6 +144,8 @@ static PyObject *make_app_info(void)
|
|||||||
SetStrItem("Unknown");
|
SetStrItem("Unknown");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
SetObjItem(BPY_app_handlers_struct());
|
||||||
|
|
||||||
#undef SetIntItem
|
#undef SetIntItem
|
||||||
#undef SetStrItem
|
#undef SetStrItem
|
||||||
#undef SetObjItem
|
#undef SetObjItem
|
||||||
|
170
source/blender/python/intern/bpy_app_handlers.c
Normal file
170
source/blender/python/intern/bpy_app_handlers.c
Normal file
@ -0,0 +1,170 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
* Contributor(s): Campbell Barton
|
||||||
|
*
|
||||||
|
* ***** END GPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** \file blender/python/intern/bpy_app_handlers.c
|
||||||
|
* \ingroup pythonintern
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <Python.h>
|
||||||
|
#include "BLI_utildefines.h"
|
||||||
|
#include "BLI_callbacks.h"
|
||||||
|
|
||||||
|
#include "RNA_types.h"
|
||||||
|
#include "RNA_access.h"
|
||||||
|
#include "bpy_rna.h"
|
||||||
|
#include "bpy_app_handlers.h"
|
||||||
|
|
||||||
|
void bpy_app_generic_callback(struct Main *main, struct ID *id, void *arg);
|
||||||
|
|
||||||
|
static PyTypeObject BlenderAppCbType;
|
||||||
|
|
||||||
|
static PyStructSequence_Field app_cb_info_fields[]= {
|
||||||
|
{(char *)"render_pre", NULL},
|
||||||
|
{(char *)"render_post", NULL},
|
||||||
|
{(char *)"load_pre", NULL},
|
||||||
|
{(char *)"load_post", NULL},
|
||||||
|
{(char *)"save_pre", NULL},
|
||||||
|
{(char *)"save_post", NULL},
|
||||||
|
{NULL}
|
||||||
|
};
|
||||||
|
|
||||||
|
static PyStructSequence_Desc app_cb_info_desc= {
|
||||||
|
(char *)"bpy.app.handlers", /* name */
|
||||||
|
(char *)"This module contains callbacks", /* doc */
|
||||||
|
app_cb_info_fields, /* fields */
|
||||||
|
(sizeof(app_cb_info_fields)/sizeof(PyStructSequence_Field)) - 1
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
#if (BLI_CB_EVT_TOT != ((sizeof(app_cb_info_fields)/sizeof(PyStructSequence_Field))))
|
||||||
|
# error "Callbacks are out of sync"
|
||||||
|
#endif
|
||||||
|
*/
|
||||||
|
|
||||||
|
static PyObject *py_cb_array[BLI_CB_EVT_TOT]= {0};
|
||||||
|
|
||||||
|
static PyObject *make_app_cb_info(void)
|
||||||
|
{
|
||||||
|
PyObject *app_cb_info;
|
||||||
|
int pos= 0;
|
||||||
|
|
||||||
|
app_cb_info= PyStructSequence_New(&BlenderAppCbType);
|
||||||
|
if (app_cb_info == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(pos= 0; pos < BLI_CB_EVT_TOT; pos++) {
|
||||||
|
if(app_cb_info_fields[pos].name == NULL) {
|
||||||
|
Py_FatalError("invalid callback slots 1");
|
||||||
|
}
|
||||||
|
PyStructSequence_SET_ITEM(app_cb_info, pos, (py_cb_array[pos]= PyList_New(0)));
|
||||||
|
}
|
||||||
|
if(app_cb_info_fields[pos].name != NULL) {
|
||||||
|
Py_FatalError("invalid callback slots 2");
|
||||||
|
}
|
||||||
|
|
||||||
|
return app_cb_info;
|
||||||
|
}
|
||||||
|
|
||||||
|
PyObject *BPY_app_handlers_struct(void)
|
||||||
|
{
|
||||||
|
PyObject *ret;
|
||||||
|
|
||||||
|
PyStructSequence_InitType(&BlenderAppCbType, &app_cb_info_desc);
|
||||||
|
|
||||||
|
ret= make_app_cb_info();
|
||||||
|
|
||||||
|
/* prevent user from creating new instances */
|
||||||
|
BlenderAppCbType.tp_init= NULL;
|
||||||
|
BlenderAppCbType.tp_new= NULL;
|
||||||
|
|
||||||
|
/* assign the C callbacks */
|
||||||
|
if(ret) {
|
||||||
|
static bCallbackFuncStore funcstore_array[BLI_CB_EVT_TOT]= {{0}};
|
||||||
|
bCallbackFuncStore *funcstore;
|
||||||
|
int pos= 0;
|
||||||
|
|
||||||
|
for(pos= 0; pos < BLI_CB_EVT_TOT; pos++) {
|
||||||
|
funcstore= &funcstore_array[pos];
|
||||||
|
funcstore->func= bpy_app_generic_callback;
|
||||||
|
funcstore->alloc= 0;
|
||||||
|
funcstore->arg= SET_INT_IN_POINTER(pos);
|
||||||
|
BLI_add_cb(funcstore, pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BPY_app_handlers_reset(void)
|
||||||
|
{
|
||||||
|
int pos= 0;
|
||||||
|
|
||||||
|
for(pos= 0; pos < BLI_CB_EVT_TOT; pos++) {
|
||||||
|
PyList_SetSlice(py_cb_array[pos], 0, PY_SSIZE_T_MAX, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* the actual callback - not necessarily called from py */
|
||||||
|
void bpy_app_generic_callback(struct Main *UNUSED(main), struct ID *id, void *arg)
|
||||||
|
{
|
||||||
|
PyObject *cb_list= py_cb_array[GET_INT_FROM_POINTER(arg)];
|
||||||
|
Py_ssize_t cb_list_len;
|
||||||
|
if((cb_list_len= PyList_GET_SIZE(cb_list)) > 0) {
|
||||||
|
PyGILState_STATE gilstate= PyGILState_Ensure();
|
||||||
|
|
||||||
|
PyObject* args= PyTuple_New(1); // save python creating each call
|
||||||
|
PyObject* func;
|
||||||
|
PyObject* ret;
|
||||||
|
Py_ssize_t pos;
|
||||||
|
|
||||||
|
/* setup arguments */
|
||||||
|
if(id) {
|
||||||
|
PointerRNA id_ptr;
|
||||||
|
RNA_id_pointer_create(id, &id_ptr);
|
||||||
|
PyTuple_SET_ITEM(args, 0, pyrna_struct_CreatePyObject(&id_ptr));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
PyTuple_SET_ITEM(args, 0, Py_None);
|
||||||
|
Py_INCREF(Py_None);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Iterate the list and run the callbacks
|
||||||
|
for (pos=0; pos < cb_list_len; pos++) {
|
||||||
|
func= PyList_GET_ITEM(cb_list, pos);
|
||||||
|
ret= PyObject_Call(func, args, NULL);
|
||||||
|
if (ret==NULL) {
|
||||||
|
PyErr_Print();
|
||||||
|
PyErr_Clear();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Py_DECREF(ret);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Py_DECREF(args);
|
||||||
|
|
||||||
|
PyGILState_Release(gilstate);
|
||||||
|
}
|
||||||
|
}
|
@ -1,8 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
* blenlib/BLI_editVert.h mar 2001 Nzc
|
|
||||||
*
|
|
||||||
* These callbacks are needed in the lib
|
|
||||||
*
|
|
||||||
* $Id$
|
* $Id$
|
||||||
*
|
*
|
||||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||||
@ -21,26 +17,19 @@
|
|||||||
* along with this program; if not, write to the Free Software Foundation,
|
* along with this program; if not, write to the Free Software Foundation,
|
||||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*
|
*
|
||||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
* Contributor(s): Campbell Barton
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* The Original Code is: all of this file.
|
|
||||||
*
|
|
||||||
* Contributor(s): none yet.
|
|
||||||
*
|
*
|
||||||
* ***** END GPL LICENSE BLOCK *****
|
* ***** END GPL LICENSE BLOCK *****
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** \file blender/blenlib/intern/BLI_callbacks.h
|
/** \file blender/python/intern/bpy_app_handlers.h
|
||||||
* \ingroup bli
|
* \ingroup pythonintern
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef BPY_APP_HANDLERS_H
|
||||||
|
#define BPY_APP_HANDLERS_H
|
||||||
|
|
||||||
#ifndef BLI_CALLBACKS_H
|
PyObject *BPY_app_handlers_struct(void);
|
||||||
#define BLI_CALLBACKS_H
|
void BPY_app_handlers_clear(void);
|
||||||
|
|
||||||
// This is blenlib internal only
|
|
||||||
void callLocalErrorCallBack(const char* msg);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
#endif // BPY_APP_HANDLERS_H
|
@ -64,6 +64,7 @@
|
|||||||
#include "BLI_blenlib.h"
|
#include "BLI_blenlib.h"
|
||||||
#include "BLI_rand.h"
|
#include "BLI_rand.h"
|
||||||
#include "BLI_threads.h"
|
#include "BLI_threads.h"
|
||||||
|
#include "BLI_callbacks.h"
|
||||||
#include "BLI_utildefines.h"
|
#include "BLI_utildefines.h"
|
||||||
|
|
||||||
#include "PIL_time.h"
|
#include "PIL_time.h"
|
||||||
@ -2922,6 +2923,9 @@ void RE_BlenderFrame(Render *re, Main *bmain, Scene *scene, SceneRenderLayer *sr
|
|||||||
|
|
||||||
if(render_initialize_from_main(re, bmain, scene, srl, camera_override, lay, 0, 0)) {
|
if(render_initialize_from_main(re, bmain, scene, srl, camera_override, lay, 0, 0)) {
|
||||||
MEM_reset_peak_memory();
|
MEM_reset_peak_memory();
|
||||||
|
|
||||||
|
BLI_exec_cb(re->main, (ID *)scene, BLI_CB_EVT_RENDER_PRE);
|
||||||
|
|
||||||
do_render_all_options(re);
|
do_render_all_options(re);
|
||||||
|
|
||||||
if(write_still && !G.afbreek) {
|
if(write_still && !G.afbreek) {
|
||||||
@ -2937,6 +2941,8 @@ void RE_BlenderFrame(Render *re, Main *bmain, Scene *scene, SceneRenderLayer *sr
|
|||||||
do_write_image_or_movie(re, scene, NULL, name);
|
do_write_image_or_movie(re, scene, NULL, name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BLI_exec_cb(re->main, (ID *)scene, BLI_CB_EVT_RENDER_POST); /* keep after file save */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* UGLY WARNING */
|
/* UGLY WARNING */
|
||||||
@ -3066,14 +3072,21 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri
|
|||||||
int nf = mh->get_next_frame(&re->r, re->reports);
|
int nf = mh->get_next_frame(&re->r, re->reports);
|
||||||
if (nf >= 0 && nf >= scene->r.sfra && nf <= scene->r.efra) {
|
if (nf >= 0 && nf >= scene->r.sfra && nf <= scene->r.efra) {
|
||||||
scene->r.cfra = re->r.cfra = nf;
|
scene->r.cfra = re->r.cfra = nf;
|
||||||
|
|
||||||
|
BLI_exec_cb(re->main, (ID *)scene, BLI_CB_EVT_RENDER_PRE);
|
||||||
|
|
||||||
do_render_all_options(re);
|
do_render_all_options(re);
|
||||||
|
|
||||||
if(re->test_break(re->tbh) == 0) {
|
if(re->test_break(re->tbh) == 0) {
|
||||||
if(!do_write_image_or_movie(re, scene, mh, NULL))
|
if(!do_write_image_or_movie(re, scene, mh, NULL))
|
||||||
G.afbreek= 1;
|
G.afbreek= 1;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
|
if(G.afbreek == 0) {
|
||||||
|
BLI_exec_cb(re->main, (ID *)scene, BLI_CB_EVT_RENDER_POST); /* keep after file save */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
if(re->test_break(re->tbh))
|
if(re->test_break(re->tbh))
|
||||||
G.afbreek= 1;
|
G.afbreek= 1;
|
||||||
}
|
}
|
||||||
@ -3120,6 +3133,10 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri
|
|||||||
}
|
}
|
||||||
|
|
||||||
re->r.cfra= scene->r.cfra; /* weak.... */
|
re->r.cfra= scene->r.cfra; /* weak.... */
|
||||||
|
|
||||||
|
/* run callbacs before rendering, before the scene is updated */
|
||||||
|
BLI_exec_cb(re->main, (ID *)scene, BLI_CB_EVT_RENDER_PRE);
|
||||||
|
|
||||||
|
|
||||||
do_render_all_options(re);
|
do_render_all_options(re);
|
||||||
|
|
||||||
@ -3141,6 +3158,10 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(G.afbreek==0) {
|
||||||
|
BLI_exec_cb(re->main, (ID *)scene, BLI_CB_EVT_RENDER_POST); /* keep after file save */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -523,7 +523,6 @@ static void *vol_precache_part(void *data)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* this view coordinate is very wrong! */
|
|
||||||
copy_v3_v3(shi->view, cco);
|
copy_v3_v3(shi->view, cco);
|
||||||
normalize_v3(shi->view);
|
normalize_v3(shi->view);
|
||||||
vol_get_scattering(shi, scatter_col, cco);
|
vol_get_scattering(shi, scatter_col, cco);
|
||||||
|
@ -534,6 +534,7 @@ static void vol_shade_one_lamp(struct ShadeInput *shi, float *co, LampRen *lar,
|
|||||||
|
|
||||||
if (luminance(lacol) < 0.001f) return;
|
if (luminance(lacol) < 0.001f) return;
|
||||||
|
|
||||||
|
normalize_v3(lv);
|
||||||
p = vol_get_phasefunc(shi, shi->mat->vol.asymmetry, shi->view, lv);
|
p = vol_get_phasefunc(shi, shi->mat->vol.asymmetry, shi->view, lv);
|
||||||
|
|
||||||
/* physically based scattering with non-physically based RGB gain */
|
/* physically based scattering with non-physically based RGB gain */
|
||||||
|
@ -2449,6 +2449,16 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
|
|||||||
else
|
else
|
||||||
event.type= MIDDLEMOUSE;
|
event.type= MIDDLEMOUSE;
|
||||||
|
|
||||||
|
if(win->active==0) {
|
||||||
|
int cx, cy;
|
||||||
|
|
||||||
|
/* entering window, update mouse pos. (ghost sends win-activate *after* the mouseclick in window!) */
|
||||||
|
wm_get_cursor_position(win, &cx, &cy);
|
||||||
|
|
||||||
|
event.x= evt->x= cx;
|
||||||
|
event.y= evt->y= cy;
|
||||||
|
}
|
||||||
|
|
||||||
/* add to other window if event is there (not to both!) */
|
/* add to other window if event is there (not to both!) */
|
||||||
owin= wm_event_cursor_other_windows(wm, win, &event);
|
owin= wm_event_cursor_other_windows(wm, win, &event);
|
||||||
if(owin) {
|
if(owin) {
|
||||||
|
@ -57,6 +57,7 @@
|
|||||||
#include "BLI_blenlib.h"
|
#include "BLI_blenlib.h"
|
||||||
#include "BLI_linklist.h"
|
#include "BLI_linklist.h"
|
||||||
#include "BLI_utildefines.h"
|
#include "BLI_utildefines.h"
|
||||||
|
#include "BLI_callbacks.h"
|
||||||
|
|
||||||
#include "DNA_anim_types.h"
|
#include "DNA_anim_types.h"
|
||||||
#include "DNA_ipo_types.h" // XXX old animation system
|
#include "DNA_ipo_types.h" // XXX old animation system
|
||||||
@ -342,6 +343,8 @@ void WM_read_file(bContext *C, const char *filepath, ReportList *reports)
|
|||||||
|
|
||||||
WM_cursor_wait(1);
|
WM_cursor_wait(1);
|
||||||
|
|
||||||
|
BLI_exec_cb(CTX_data_main(C), NULL, BLI_CB_EVT_LOAD_PRE);
|
||||||
|
|
||||||
/* first try to append data from exotic file formats... */
|
/* first try to append data from exotic file formats... */
|
||||||
/* it throws error box when file doesnt exist and returns -1 */
|
/* it throws error box when file doesnt exist and returns -1 */
|
||||||
/* note; it should set some error message somewhere... (ton) */
|
/* note; it should set some error message somewhere... (ton) */
|
||||||
@ -392,6 +395,7 @@ void WM_read_file(bContext *C, const char *filepath, ReportList *reports)
|
|||||||
#ifdef WITH_PYTHON
|
#ifdef WITH_PYTHON
|
||||||
/* run any texts that were loaded in and flagged as modules */
|
/* run any texts that were loaded in and flagged as modules */
|
||||||
BPY_driver_reset();
|
BPY_driver_reset();
|
||||||
|
BPY_app_handlers_reset();
|
||||||
BPY_modules_load_user(C);
|
BPY_modules_load_user(C);
|
||||||
#endif
|
#endif
|
||||||
CTX_wm_window_set(C, NULL); /* exits queues */
|
CTX_wm_window_set(C, NULL); /* exits queues */
|
||||||
@ -411,7 +415,8 @@ void WM_read_file(bContext *C, const char *filepath, ReportList *reports)
|
|||||||
// XXX undo_editmode_clear();
|
// XXX undo_editmode_clear();
|
||||||
BKE_reset_undo();
|
BKE_reset_undo();
|
||||||
BKE_write_undo(C, "original"); /* save current state */
|
BKE_write_undo(C, "original"); /* save current state */
|
||||||
|
|
||||||
|
BLI_exec_cb(CTX_data_main(C), NULL, BLI_CB_EVT_LOAD_POST);
|
||||||
}
|
}
|
||||||
else if(retval == BKE_READ_EXOTIC_OK_OTHER)
|
else if(retval == BKE_READ_EXOTIC_OK_OTHER)
|
||||||
BKE_write_undo(C, "Import file");
|
BKE_write_undo(C, "Import file");
|
||||||
@ -518,6 +523,7 @@ int WM_read_homefile(bContext *C, ReportList *reports, short from_memory)
|
|||||||
BPY_string_exec(C, "__import__('addon_utils').reset_all()");
|
BPY_string_exec(C, "__import__('addon_utils').reset_all()");
|
||||||
|
|
||||||
BPY_driver_reset();
|
BPY_driver_reset();
|
||||||
|
BPY_app_handlers_reset();
|
||||||
BPY_modules_load_user(C);
|
BPY_modules_load_user(C);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -717,6 +723,12 @@ int WM_write_file(bContext *C, const char *target, int fileflags, ReportList *re
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* blend file thumbnail */
|
||||||
|
/* save before exit_editmode, otherwise derivedmeshes for shared data corrupt #27765) */
|
||||||
|
ibuf_thumb= blend_file_thumb(CTX_data_scene(C), &thumb);
|
||||||
|
|
||||||
|
BLI_exec_cb(G.main, NULL, BLI_CB_EVT_SAVE_PRE);
|
||||||
|
|
||||||
/* operator now handles overwrite checks */
|
/* operator now handles overwrite checks */
|
||||||
|
|
||||||
if (G.fileflags & G_AUTOPACK) {
|
if (G.fileflags & G_AUTOPACK) {
|
||||||
@ -729,9 +741,6 @@ int WM_write_file(bContext *C, const char *target, int fileflags, ReportList *re
|
|||||||
/* don't forget not to return without! */
|
/* don't forget not to return without! */
|
||||||
WM_cursor_wait(1);
|
WM_cursor_wait(1);
|
||||||
|
|
||||||
/* blend file thumbnail */
|
|
||||||
ibuf_thumb= blend_file_thumb(CTX_data_scene(C), &thumb);
|
|
||||||
|
|
||||||
fileflags |= G_FILE_HISTORY; /* write file history */
|
fileflags |= G_FILE_HISTORY; /* write file history */
|
||||||
|
|
||||||
if (BLO_write_file(CTX_data_main(C), filepath, fileflags, reports, thumb)) {
|
if (BLO_write_file(CTX_data_main(C), filepath, fileflags, reports, thumb)) {
|
||||||
@ -753,6 +762,8 @@ int WM_write_file(bContext *C, const char *target, int fileflags, ReportList *re
|
|||||||
write_history();
|
write_history();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BLI_exec_cb(G.main, NULL, BLI_CB_EVT_SAVE_POST);
|
||||||
|
|
||||||
/* run this function after because the file cant be written before the blend is */
|
/* run this function after because the file cant be written before the blend is */
|
||||||
if (ibuf_thumb) {
|
if (ibuf_thumb) {
|
||||||
ibuf_thumb= IMB_thumb_create(filepath, THB_NORMAL, THB_SOURCE_BLEND, ibuf_thumb);
|
ibuf_thumb= IMB_thumb_create(filepath, THB_NORMAL, THB_SOURCE_BLEND, ibuf_thumb);
|
||||||
|
@ -155,6 +155,7 @@ void WM_init(bContext *C, int argc, const char **argv)
|
|||||||
BPY_python_start(argc, argv);
|
BPY_python_start(argc, argv);
|
||||||
|
|
||||||
BPY_driver_reset();
|
BPY_driver_reset();
|
||||||
|
BPY_app_handlers_reset();
|
||||||
BPY_modules_load_user(C);
|
BPY_modules_load_user(C);
|
||||||
#else
|
#else
|
||||||
(void)argc; /* unused */
|
(void)argc; /* unused */
|
||||||
|
@ -64,6 +64,7 @@
|
|||||||
#include "BLI_threads.h"
|
#include "BLI_threads.h"
|
||||||
#include "BLI_scanfill.h" // for BLI_setErrorCallBack, TODO, move elsewhere
|
#include "BLI_scanfill.h" // for BLI_setErrorCallBack, TODO, move elsewhere
|
||||||
#include "BLI_utildefines.h"
|
#include "BLI_utildefines.h"
|
||||||
|
#include "BLI_callbacks.h"
|
||||||
|
|
||||||
#include "DNA_ID.h"
|
#include "DNA_ID.h"
|
||||||
#include "DNA_scene_types.h"
|
#include "DNA_scene_types.h"
|
||||||
@ -994,6 +995,7 @@ static int load_file(int UNUSED(argc), const char **argv, void *data)
|
|||||||
#ifdef WITH_PYTHON
|
#ifdef WITH_PYTHON
|
||||||
/* run any texts that were loaded in and flagged as modules */
|
/* run any texts that were loaded in and flagged as modules */
|
||||||
BPY_driver_reset();
|
BPY_driver_reset();
|
||||||
|
BPY_app_handlers_reset();
|
||||||
BPY_modules_load_user(C);
|
BPY_modules_load_user(C);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1203,6 +1205,8 @@ int main(int argc, const char **argv)
|
|||||||
|
|
||||||
IMB_init();
|
IMB_init();
|
||||||
|
|
||||||
|
BLI_cb_init();
|
||||||
|
|
||||||
#ifdef WITH_GAMEENGINE
|
#ifdef WITH_GAMEENGINE
|
||||||
syshandle = SYS_GetSystem();
|
syshandle = SYS_GetSystem();
|
||||||
#else
|
#else
|
||||||
|
@ -89,7 +89,7 @@ SCA_Joystick *SCA_Joystick::GetInstance( short int joyindex )
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
// do this once only
|
// do this once only
|
||||||
if(SDL_InitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_VIDEO ) == -1 ){
|
if(SDL_InitSubSystem(SDL_INIT_JOYSTICK) == -1 ){
|
||||||
echo("Error-Initializing-SDL: " << SDL_GetError());
|
echo("Error-Initializing-SDL: " << SDL_GetError());
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -124,7 +124,7 @@ void SCA_Joystick::ReleaseInstance()
|
|||||||
m_instance[i]= NULL;
|
m_instance[i]= NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_QuitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_VIDEO );
|
SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2142,6 +2142,7 @@ btCollisionShape* CcdShapeConstructionInfo::CreateBulletShape(btScalar margin, b
|
|||||||
}
|
}
|
||||||
collisionShape = compoundShape;
|
collisionShape = compoundShape;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return collisionShape;
|
return collisionShape;
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,7 @@ protected:
|
|||||||
virtual void setFixedTimeStep(bool useFixedTimeStep,float fixedTimeStep)
|
virtual void setFixedTimeStep(bool useFixedTimeStep,float fixedTimeStep)
|
||||||
{
|
{
|
||||||
//based on DEFAULT_PHYSICS_TIC_RATE of 60 hertz
|
//based on DEFAULT_PHYSICS_TIC_RATE of 60 hertz
|
||||||
setNumTimeSubSteps(fixedTimeStep/60.f);
|
setNumTimeSubSteps((int)(fixedTimeStep / 60.f));
|
||||||
}
|
}
|
||||||
//returns 0.f if no fixed timestep is used
|
//returns 0.f if no fixed timestep is used
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user