forked from bartvdbraak/blender
Merged changes in the trunk up to revision 33348.
This commit is contained in:
commit
a04603d2a0
@ -96,9 +96,9 @@ OPTION(WITH_IMAGE_HDR "Enable HDR Image Support" ON)
|
||||
# Audio format support
|
||||
OPTION(WITH_FFMPEG "Enable FFMPeg Support (http://ffmpeg.mplayerhq.hu/)" OFF)
|
||||
OPTION(WITH_SNDFILE "Enable libsndfile Support (http://www.mega-nerd.com/libsndfile)" OFF)
|
||||
IF(APPLE OR WIN32)
|
||||
IF(APPLE OR (WIN32 AND NOT UNIX))
|
||||
OPTION(WITH_QUICKTIME "Enable Quicktime Support" OFF)
|
||||
ENDIF(APPLE OR WIN32)
|
||||
ENDIF(APPLE OR (WIN32 AND NOT UNIX))
|
||||
|
||||
# 3D format support
|
||||
# disable opencollada on non-apple unix because opencollada has no package for debian
|
||||
@ -112,6 +112,7 @@ ENDIF()
|
||||
OPTION(WITH_SDL "Enable SDL for sound and joystick support" ON)
|
||||
OPTION(WITH_OPENAL "Enable OpenAL Support (http://www.openal.org)" ON)
|
||||
OPTION(WITH_JACK "Enable Jack Support (http://www.jackaudio.org)" OFF)
|
||||
OPTION(WITH_SAMPLERATE "Enable samplerate conversion" ON)
|
||||
|
||||
# Compression
|
||||
OPTION(WITH_LZO "Enable fast LZO compression (used for pointcache)" ON)
|
||||
@ -140,6 +141,10 @@ IF(NOT WITH_INSTALL AND WITH_PYTHON_INSTALL)
|
||||
MESSAGE("WARNING: WITH_PYTHON_INSTALL needs WITH_INSTALL")
|
||||
ENDIF(NOT WITH_INSTALL AND WITH_PYTHON_INSTALL)
|
||||
|
||||
IF(NOT WITH_SAMPLERATE AND (WITH_OPENAL OR WITH_SDL OR WITH_JACK))
|
||||
MESSAGE(FATAL_ERROR "WITH_OPENAL/WITH_SDL/WITH_JACK need WITH_SAMPLERATE")
|
||||
ENDIF(NOT WITH_SAMPLERATE AND (WITH_OPENAL OR WITH_SDL OR WITH_JACK))
|
||||
|
||||
TEST_SSE_SUPPORT()
|
||||
|
||||
# disabled for now, not supported
|
||||
@ -279,10 +284,12 @@ IF(UNIX AND NOT APPLE)
|
||||
SET(FFTW3_LIBPATH ${FFTW3}/lib)
|
||||
ENDIF(WITH_FFTW3)
|
||||
|
||||
SET(LIBSAMPLERATE /usr)
|
||||
SET(LIBSAMPLERATE_INC ${LIBSAMPLERATE}/include)
|
||||
SET(LIBSAMPLERATE_LIB samplerate)
|
||||
SET(LIBSAMPLERATE_LIBPATH ${LIBSAMPLERATE}/lib)
|
||||
IF(WITH_SAMPLERATE)
|
||||
SET(LIBSAMPLERATE /usr)
|
||||
SET(LIBSAMPLERATE_INC ${LIBSAMPLERATE}/include)
|
||||
SET(LIBSAMPLERATE_LIB samplerate)
|
||||
SET(LIBSAMPLERATE_LIBPATH ${LIBSAMPLERATE}/lib)
|
||||
ENDIF(WITH_SAMPLERATE)
|
||||
|
||||
IF (WITH_OPENCOLLADA)
|
||||
SET(OPENCOLLADA /usr/local/opencollada CACHE FILEPATH "OpenCollada Directory")
|
||||
@ -318,12 +325,6 @@ IF(UNIX AND NOT APPLE)
|
||||
|
||||
# GNU Compiler
|
||||
IF(CMAKE_COMPILER_IS_GNUCC)
|
||||
IF(WITH_OPENMP)
|
||||
LIST(APPEND LLIBS -lgomp)
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
|
||||
ENDIF(WITH_OPENMP)
|
||||
|
||||
SET(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing")
|
||||
|
||||
# Better warnings
|
||||
@ -333,12 +334,6 @@ IF(UNIX AND NOT APPLE)
|
||||
|
||||
# Intel C++ Compiler
|
||||
ELSEIF(CMAKE_C_COMPILER_ID MATCHES "Intel")
|
||||
IF(WITH_OPENMP)
|
||||
LIST(APPEND LLIBS -lgomp)
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -openmp")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -openmp")
|
||||
ENDIF(WITH_OPENMP)
|
||||
|
||||
# think these next two are broken
|
||||
FIND_PROGRAM(XIAR xiar)
|
||||
IF(XIAR)
|
||||
@ -364,10 +359,8 @@ IF(UNIX AND NOT APPLE)
|
||||
|
||||
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -static-intel")
|
||||
ENDIF(CMAKE_COMPILER_IS_GNUCC)
|
||||
ENDIF(UNIX AND NOT APPLE)
|
||||
|
||||
|
||||
IF(WIN32)
|
||||
ELSEIF(WIN32)
|
||||
|
||||
# this file is included anyway when building under Windows with cl.exe
|
||||
# INCLUDE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake)
|
||||
@ -389,10 +382,12 @@ IF(WIN32)
|
||||
SET(ICONV_LIBPATH ${ICONV}/lib)
|
||||
ENDIF(WITH_INTERNATIONAL)
|
||||
|
||||
SET(LIBSAMPLERATE ${LIBDIR}/samplerate)
|
||||
SET(LIBSAMPLERATE_INC ${LIBSAMPLERATE}/include)
|
||||
SET(LIBSAMPLERATE_LIB libsamplerate)
|
||||
SET(LIBSAMPLERATE_LIBPATH ${LIBSAMPLERATE}/lib)
|
||||
IF(WITH_SAMPLERATE)
|
||||
SET(LIBSAMPLERATE ${LIBDIR}/samplerate)
|
||||
SET(LIBSAMPLERATE_INC ${LIBSAMPLERATE}/include)
|
||||
SET(LIBSAMPLERATE_LIB libsamplerate)
|
||||
SET(LIBSAMPLERATE_LIBPATH ${LIBSAMPLERATE}/lib)
|
||||
ENDIF(WITH_SAMPLERATE)
|
||||
|
||||
SET(PNG "${LIBDIR}/png")
|
||||
SET(PNG_INC "${PNG}/include")
|
||||
@ -462,12 +457,7 @@ IF(WIN32)
|
||||
SET(CMAKE_C_FLAGS_RELEASE "/O2 /Ob2 /DNDEBUG /EHsc /MT /W3 /nologo /J" CACHE STRING "MSVC MT flags " FORCE)
|
||||
SET(CMAKE_C_FLAGS_MINSIZEREL "/O1 /Ob1 /DNDEBUG /EHsc /MT /W3 /nologo /J" CACHE STRING "MSVC MT flags " FORCE)
|
||||
SET(CMAKE_C_FLAGS_RELWITHDEBINFO "/O2 /Ob1 /DNDEBUG /EHsc /MT /W3 /nologo /Zi /J" CACHE STRING "MSVC MT flags " FORCE)
|
||||
|
||||
IF(WITH_OPENMP)
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /openmp ")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /openmp ")
|
||||
ENDIF(WITH_OPENMP)
|
||||
|
||||
|
||||
IF(WITH_INTERNATIONAL)
|
||||
SET(GETTEXT ${LIBDIR}/gettext)
|
||||
SET(GETTEXT_INC ${GETTEXT}/include)
|
||||
@ -573,7 +563,7 @@ IF(WIN32)
|
||||
|
||||
# MSVC only, Mingw doesnt need
|
||||
IF(CMAKE_CL_64)
|
||||
SET(PLATFORM_LINKFLAGS "/MACHINE:X64 /NODEFAULTLIB:libc.lib;MSVCRT.lib ")
|
||||
SET(PLATFORM_LINKFLAGS "/MACHINE:X64 /NODEFAULTLIB:libc.lib ")
|
||||
ELSE(CMAKE_CL_64)
|
||||
SET(PLATFORM_LINKFLAGS "/NODEFAULTLIB:libc.lib ")
|
||||
ENDIF(CMAKE_CL_64)
|
||||
@ -589,12 +579,6 @@ IF(WIN32)
|
||||
# Better warnings
|
||||
SET(C_WARNINGS "-Wall -Wno-char-subscripts -Wpointer-arith -Wcast-align -Wdeclaration-after-statement -Wno-unknown-pragmas")
|
||||
SET(CXX_WARNINGS "-Wall -Wno-invalid-offsetof -Wno-sign-compare")
|
||||
|
||||
IF(WITH_OPENMP)
|
||||
SET(LLIBS "${LLIBS} -lgomp")
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
|
||||
ENDIF(WITH_OPENMP)
|
||||
|
||||
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")
|
||||
@ -690,10 +674,11 @@ IF(WIN32)
|
||||
|
||||
ENDIF(MSVC)
|
||||
|
||||
ENDIF(WIN32)
|
||||
# used in many places so include globally, like OpenGL
|
||||
INCLUDE_DIRECTORIES(${PTHREADS_INC})
|
||||
|
||||
ELSEIF(APPLE)
|
||||
|
||||
IF(APPLE)
|
||||
IF(WITH_LIBS10.5)
|
||||
SET(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin-9.x.universal)
|
||||
ELSE(WITH_LIBS10.5)
|
||||
@ -800,10 +785,12 @@ IF(APPLE)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__STDC_CONSTANT_MACROS")
|
||||
ENDIF(WITH_FFMPEG)
|
||||
|
||||
SET(LIBSAMPLERATE ${LIBDIR}/samplerate)
|
||||
SET(LIBSAMPLERATE_INC ${LIBSAMPLERATE}/include)
|
||||
SET(LIBSAMPLERATE_LIB samplerate)
|
||||
SET(LIBSAMPLERATE_LIBPATH ${LIBSAMPLERATE}/lib)
|
||||
IF(WITH_SAMPLERATE)
|
||||
SET(LIBSAMPLERATE ${LIBDIR}/samplerate)
|
||||
SET(LIBSAMPLERATE_INC ${LIBSAMPLERATE}/include)
|
||||
SET(LIBSAMPLERATE_LIB samplerate)
|
||||
SET(LIBSAMPLERATE_LIBPATH ${LIBSAMPLERATE}/lib)
|
||||
ENDIF(WITH_SAMPLERATE)
|
||||
|
||||
SET(LLIBS stdc++ SystemStubs)
|
||||
|
||||
@ -825,12 +812,6 @@ IF(APPLE)
|
||||
SET(PLATFORM_LINKFLAGS "-fexceptions -framework CoreServices -framework Foundation -framework IOKit -framework AppKit -framework Carbon -framework AGL -framework AudioUnit -framework AudioToolbox -framework CoreAudio -framework QuickTime")
|
||||
ENDIF (WITH_COCOA)
|
||||
|
||||
IF(WITH_OPENMP)
|
||||
SET(LLIBS "${LLIBS} -lgomp")
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
|
||||
ENDIF(WITH_OPENMP)
|
||||
|
||||
IF (WITH_OPENCOLLADA)
|
||||
SET(OPENCOLLADA ${LIBDIR}/opencollada)
|
||||
SET(OPENCOLLADA_INC ${OPENCOLLADA}/include)
|
||||
@ -887,7 +868,7 @@ IF(APPLE)
|
||||
SET(C_WARNINGS "-Wall -Wno-char-subscripts -Wpointer-arith -Wcast-align -Wdeclaration-after-statement -Wno-unknown-pragmas")
|
||||
SET(CXX_WARNINGS "-Wall -Wno-invalid-offsetof -Wno-sign-compare")
|
||||
|
||||
ENDIF(APPLE)
|
||||
ENDIF(UNIX AND NOT APPLE)
|
||||
|
||||
|
||||
# buildinfo
|
||||
@ -954,6 +935,22 @@ INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})
|
||||
# UNSET(OPENGL_LIBRARIES CACHE) # not compat with older cmake
|
||||
# UNSET(OPENGL_xmesa_INCLUDE_DIR CACHE) # not compat with older cmake
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Configure OpenMP.
|
||||
IF(WITH_OPENMP)
|
||||
FIND_PACKAGE(OpenMP)
|
||||
IF(OPENMP_FOUND)
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
|
||||
|
||||
IF(APPLE AND ${CMAKE_GENERATOR} MATCHES "Xcode")
|
||||
SET(CMAKE_XCODE_ATTRIBUTE_ENABLE_OPENMP_SUPPORT "YES")
|
||||
ENDIF(APPLE AND ${CMAKE_GENERATOR} MATCHES "Xcode")
|
||||
ELSE(OPENMP_FOUND)
|
||||
SET(WITH_OPENMP OFF)
|
||||
ENDIF(OPENMP_FOUND)
|
||||
ENDIF(WITH_OPENMP)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Extra compile flags
|
||||
|
||||
|
@ -55,8 +55,8 @@ MACRO(SETUP_LIBDIRS)
|
||||
CMAKE_POLICY(SET CMP0003 NEW)
|
||||
endif(COMMAND cmake_policy)
|
||||
|
||||
LINK_DIRECTORIES(${JPEG_LIBPATH} ${PNG_LIBPATH} ${ZLIB_LIBPATH} ${FREETYPE_LIBPATH} ${LIBSAMPLERATE_LIBPATH})
|
||||
|
||||
LINK_DIRECTORIES(${JPEG_LIBPATH} ${PNG_LIBPATH} ${ZLIB_LIBPATH} ${FREETYPE_LIBPATH})
|
||||
|
||||
IF(WITH_PYTHON)
|
||||
LINK_DIRECTORIES(${PYTHON_LIBPATH})
|
||||
ENDIF(WITH_PYTHON)
|
||||
@ -91,6 +91,9 @@ MACRO(SETUP_LIBDIRS)
|
||||
IF(WITH_SNDFILE)
|
||||
LINK_DIRECTORIES(${SNDFILE_LIBPATH})
|
||||
ENDIF(WITH_SNDFILE)
|
||||
IF(WITH_SAMPLERATE)
|
||||
LINK_DIRECTORIES(${LIBSAMPLERATE_LIBPATH})
|
||||
ENDIF(WITH_SAMPLERATE)
|
||||
IF(WITH_FFTW3)
|
||||
LINK_DIRECTORIES(${FFTW3_LIBPATH})
|
||||
ENDIF(WITH_FFTW3)
|
||||
@ -100,9 +103,9 @@ MACRO(SETUP_LIBDIRS)
|
||||
LINK_DIRECTORIES(${EXPAT_LIBPATH})
|
||||
ENDIF(WITH_OPENCOLLADA)
|
||||
|
||||
IF(WIN32)
|
||||
IF(WIN32 AND NOT UNIX)
|
||||
LINK_DIRECTORIES(${PTHREADS_LIBPATH})
|
||||
ENDIF(WIN32)
|
||||
ENDIF(WIN32 AND NOT UNIX)
|
||||
ENDMACRO(SETUP_LIBDIRS)
|
||||
|
||||
MACRO(SETUP_LIBLINKS
|
||||
@ -115,23 +118,23 @@ MACRO(SETUP_LIBLINKS
|
||||
IF(WITH_PYTHON)
|
||||
TARGET_LINK_LIBRARIES(${target} ${PYTHON_LINKFLAGS})
|
||||
|
||||
IF(WIN32)
|
||||
IF(WIN32 AND NOT UNIX)
|
||||
TARGET_LINK_LIBRARIES(${target} debug ${PYTHON_LIB}_d)
|
||||
TARGET_LINK_LIBRARIES(${target} optimized ${PYTHON_LIB})
|
||||
ELSE(WIN32)
|
||||
ELSE(WIN32 AND NOT UNIX)
|
||||
TARGET_LINK_LIBRARIES(${target} ${PYTHON_LIB})
|
||||
ENDIF(WIN32)
|
||||
ENDIF(WIN32 AND NOT UNIX)
|
||||
ENDIF(WITH_PYTHON)
|
||||
|
||||
TARGET_LINK_LIBRARIES(${target} ${OPENGL_glu_LIBRARY} ${JPEG_LIB} ${PNG_LIB} ${ZLIB_LIB})
|
||||
TARGET_LINK_LIBRARIES(${target} ${FREETYPE_LIBRARY} ${LIBSAMPLERATE_LIB})
|
||||
TARGET_LINK_LIBRARIES(${target} ${FREETYPE_LIBRARY})
|
||||
|
||||
IF(WITH_INTERNATIONAL)
|
||||
TARGET_LINK_LIBRARIES(${target} ${GETTEXT_LIB})
|
||||
|
||||
IF(WIN32)
|
||||
IF(WIN32 AND NOT UNIX)
|
||||
TARGET_LINK_LIBRARIES(${target} ${ICONV_LIB})
|
||||
ENDIF(WIN32)
|
||||
ENDIF(WIN32 AND NOT UNIX)
|
||||
ENDIF(WITH_INTERNATIONAL)
|
||||
|
||||
IF(WITH_OPENAL)
|
||||
@ -146,6 +149,9 @@ MACRO(SETUP_LIBLINKS
|
||||
IF(WITH_SNDFILE)
|
||||
TARGET_LINK_LIBRARIES(${target} ${SNDFILE_LIB})
|
||||
ENDIF(WITH_SNDFILE)
|
||||
IF(WITH_SAMPLERATE)
|
||||
TARGET_LINK_LIBRARIES(${target} ${LIBSAMPLERATE_LIB})
|
||||
ENDIF(WITH_SAMPLERATE)
|
||||
IF(WITH_SDL)
|
||||
TARGET_LINK_LIBRARIES(${target} ${SDL_LIBRARY})
|
||||
ENDIF(WITH_SDL)
|
||||
@ -156,14 +162,14 @@ MACRO(SETUP_LIBLINKS
|
||||
TARGET_LINK_LIBRARIES(${target} ${TIFF_LIBRARY})
|
||||
ENDIF(WITH_IMAGE_TIFF)
|
||||
IF(WITH_IMAGE_OPENEXR)
|
||||
IF(WIN32)
|
||||
IF(WIN32 AND NOT UNIX)
|
||||
FOREACH(loop_var ${OPENEXR_LIB})
|
||||
TARGET_LINK_LIBRARIES(${target} debug ${loop_var}_d)
|
||||
TARGET_LINK_LIBRARIES(${target} optimized ${loop_var})
|
||||
ENDFOREACH(loop_var)
|
||||
ELSE(WIN32)
|
||||
ELSE(WIN32 AND NOT UNIX)
|
||||
TARGET_LINK_LIBRARIES(${target} ${OPENEXR_LIB})
|
||||
ENDIF(WIN32)
|
||||
ENDIF(WIN32 AND NOT UNIX)
|
||||
ENDIF(WITH_IMAGE_OPENEXR)
|
||||
IF(WITH_LCMS)
|
||||
TARGET_LINK_LIBRARIES(${target} ${LCMS_LIBRARY})
|
||||
@ -172,7 +178,7 @@ MACRO(SETUP_LIBLINKS
|
||||
TARGET_LINK_LIBRARIES(${target} ${FFMPEG_LIB})
|
||||
ENDIF(WITH_FFMPEG)
|
||||
IF(WITH_OPENCOLLADA)
|
||||
IF(WIN32)
|
||||
IF(WIN32 AND NOT UNIX)
|
||||
FOREACH(loop_var ${OPENCOLLADA_LIB})
|
||||
TARGET_LINK_LIBRARIES(${target} debug ${loop_var}_d)
|
||||
TARGET_LINK_LIBRARIES(${target} optimized ${loop_var})
|
||||
@ -183,21 +189,21 @@ MACRO(SETUP_LIBLINKS
|
||||
TARGET_LINK_LIBRARIES(${target} debug ${EXPAT_LIB}_d)
|
||||
TARGET_LINK_LIBRARIES(${target} optimized ${EXPAT_LIB})
|
||||
ENDIF(EXPAT_LIB)
|
||||
ELSE(WIN32)
|
||||
ELSE(WIN32 AND NOT UNIX)
|
||||
TARGET_LINK_LIBRARIES(${target} ${OPENCOLLADA_LIB})
|
||||
TARGET_LINK_LIBRARIES(${target} ${PCRE_LIB})
|
||||
TARGET_LINK_LIBRARIES(${target} ${EXPAT_LIB})
|
||||
ENDIF(WIN32)
|
||||
ENDIF(WIN32 AND NOT UNIX)
|
||||
ENDIF(WITH_OPENCOLLADA)
|
||||
IF(WITH_LCMS)
|
||||
IF(WIN32)
|
||||
IF(WIN32 AND NOT UNIX)
|
||||
TARGET_LINK_LIBRARIES(${target} debug ${LCMS_LIB}_d)
|
||||
TARGET_LINK_LIBRARIES(${target} optimized ${LCMS_LIB})
|
||||
ENDIF(WIN32)
|
||||
ENDIF(WIN32 AND NOT UNIX)
|
||||
ENDIF(WITH_LCMS)
|
||||
IF(WIN32)
|
||||
IF(WIN32 AND NOT UNIX)
|
||||
TARGET_LINK_LIBRARIES(${target} ${PTHREADS_LIB})
|
||||
ENDIF(WIN32)
|
||||
ENDIF(WIN32 AND NOT UNIX)
|
||||
ENDMACRO(SETUP_LIBLINKS)
|
||||
|
||||
MACRO(TEST_SSE_SUPPORT)
|
||||
@ -242,17 +248,17 @@ ENDMACRO(TEST_SSE_SUPPORT)
|
||||
MACRO(_REMOVE_STRICT_FLAGS
|
||||
flag)
|
||||
|
||||
STRING(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
|
||||
STRING(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
|
||||
STRING(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE})
|
||||
STRING(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS_MINSIZEREL ${CMAKE_C_FLAGS_MINSIZEREL})
|
||||
STRING(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS_RELWITHDEBINFO ${CMAKE_C_FLAGS_RELWITHDEBINFO})
|
||||
STRING(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
||||
STRING(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
|
||||
STRING(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
|
||||
STRING(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL}")
|
||||
STRING(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
|
||||
|
||||
STRING(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
||||
STRING(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
|
||||
STRING(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE})
|
||||
STRING(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS_MINSIZEREL ${CMAKE_CXX_FLAGS_MINSIZEREL})
|
||||
STRING(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS_RELWITHDEBINFO ${CMAKE_CXX_FLAGS_RELWITHDEBINFO})
|
||||
STRING(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
STRING(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
|
||||
STRING(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
|
||||
STRING(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL}")
|
||||
STRING(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
|
||||
|
||||
ENDMACRO(_REMOVE_STRICT_FLAGS)
|
||||
|
||||
|
@ -454,13 +454,13 @@ def rna2sphinx(BASEPATH):
|
||||
fw("\n")
|
||||
fw("This module is used for all blender/python access.\n")
|
||||
fw("\n")
|
||||
fw(".. literalinclude:: ../examples/bpy.data.py\n")
|
||||
fw("\n")
|
||||
fw(".. data:: data\n")
|
||||
fw("\n")
|
||||
fw(" Access to blenders internal data\n")
|
||||
fw("\n")
|
||||
fw(" :type: :class:`bpy.types.BlendData`\n")
|
||||
fw("\n")
|
||||
fw(".. literalinclude:: ../examples/bpy.data.py\n")
|
||||
file.close()
|
||||
|
||||
EXAMPLE_SET_USED.add("bpy.data")
|
||||
|
@ -61,8 +61,6 @@ SET(SRC
|
||||
FX/AUD_SuperposeFactory.cpp
|
||||
FX/AUD_SuperposeReader.cpp
|
||||
FX/AUD_VolumeFactory.cpp
|
||||
SRC/AUD_SRCResampleFactory.cpp
|
||||
SRC/AUD_SRCResampleReader.cpp
|
||||
intern/AUD_3DMath.h
|
||||
intern/AUD_Buffer.cpp
|
||||
intern/AUD_Buffer.h
|
||||
@ -164,6 +162,14 @@ IF(WITH_SNDFILE)
|
||||
)
|
||||
ENDIF(WITH_SNDFILE)
|
||||
|
||||
IF(WITH_SAMPLERATE)
|
||||
ADD_DEFINITIONS(-DWITH_SAMPLERATE)
|
||||
SET(SRCFILESRC
|
||||
SRC/AUD_SRCResampleFactory.cpp
|
||||
SRC/AUD_SRCResampleReader.cpp
|
||||
)
|
||||
ENDIF(WITH_SAMPLERATE)
|
||||
|
||||
#IF(WITH_FFTW3)
|
||||
# ADD_DEFINITIONS(-DWITH_FFTW3)
|
||||
# LIST(APPEND INC fftw ${FFTW3_INC})
|
||||
@ -181,6 +187,6 @@ IF(WITH_PYTHON)
|
||||
ADD_DEFINITIONS(-DWITH_PYTHON)
|
||||
ENDIF(WITH_PYTHON)
|
||||
|
||||
SET(SRC ${SRC} ${FFMPEGSRC} ${SNDFILESRC} ${FFTW3SRC} ${SDLSRC} ${OPENALSRC} ${JACKSRC} ${PYTHONSRC})
|
||||
SET(SRC ${SRC} ${FFMPEGSRC} ${SNDFILESRC} ${SRCFILESRC} ${FFTW3SRC} ${SDLSRC} ${OPENALSRC} ${JACKSRC} ${PYTHONSRC})
|
||||
|
||||
BLENDERLIB(bf_intern_audaspace "${SRC}" "${INC}")
|
||||
|
@ -44,4 +44,7 @@ if env['WITH_BF_PYTHON']:
|
||||
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
|
||||
incs += ' ' + env['BF_PTHREADS_INC']
|
||||
|
||||
# not optional with scons yet
|
||||
defs.append('WITH_SAMPLERATE')
|
||||
|
||||
env.BlenderLib ('bf_intern_audaspace', sources, Split(incs), defs, libtype=['intern','player'], priority = [25,215] )
|
||||
|
@ -24,7 +24,9 @@
|
||||
*/
|
||||
|
||||
#include "AUD_DefaultMixer.h"
|
||||
#ifdef WITH_SAMPLERATE
|
||||
#include "AUD_SRCResampleReader.h"
|
||||
#endif
|
||||
#include "AUD_ChannelMapperReader.h"
|
||||
#include "AUD_ChannelMapperFactory.h"
|
||||
|
||||
@ -50,10 +52,12 @@ AUD_IReader* AUD_DefaultMixer::prepare(AUD_IReader* reader)
|
||||
specs.channels = m_specs.channels;
|
||||
}
|
||||
|
||||
#ifdef WITH_SAMPLERATE
|
||||
// resample
|
||||
if(specs.rate != m_specs.rate)
|
||||
reader = new AUD_SRCResampleReader(reader, m_specs.specs);
|
||||
|
||||
#endif
|
||||
|
||||
// rechannel
|
||||
if(specs.channels != m_specs.channels)
|
||||
reader = new AUD_ChannelMapperReader(reader,
|
||||
|
@ -59,7 +59,7 @@ BOP_BSPNode::~BOP_BSPNode()
|
||||
* @param plane face plane.
|
||||
*/
|
||||
|
||||
unsigned int BOP_BSPNode::addFace(BOP_BSPPoints pts,
|
||||
unsigned int BOP_BSPNode::addFace(const BOP_BSPPoints& pts,
|
||||
const MT_Plane3& plane )
|
||||
{
|
||||
unsigned int newDeep = 0;
|
||||
|
@ -33,7 +33,7 @@
|
||||
#include "BOP_Face.h"
|
||||
|
||||
typedef vector<MT_Point3> BOP_BSPPoints;
|
||||
typedef vector<MT_Point3>::iterator BOP_IT_BSPPoints;
|
||||
typedef vector<MT_Point3>::const_iterator BOP_IT_BSPPoints;
|
||||
|
||||
class BOP_BSPNode
|
||||
{
|
||||
@ -47,7 +47,7 @@ public:
|
||||
// Construction methods
|
||||
BOP_BSPNode(const MT_Plane3& plane);
|
||||
~BOP_BSPNode();
|
||||
unsigned int addFace(BOP_BSPPoints pts,
|
||||
unsigned int addFace(const BOP_BSPPoints& pts,
|
||||
const MT_Plane3& plane);
|
||||
BOP_TAG classifyFace(const MT_Point3& p1,
|
||||
const MT_Point3& p2,
|
||||
|
@ -68,16 +68,7 @@ IF(APPLE)
|
||||
IF(WITH_QUICKTIME)
|
||||
ADD_DEFINITIONS(-DWITH_QUICKTIME)
|
||||
ENDIF(WITH_QUICKTIME)
|
||||
ELSEIF(WIN32)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX")
|
||||
LIST(APPEND INC ${WINTAB_INC})
|
||||
|
||||
LIST(APPEND SRC
|
||||
./intern/GHOST_DisplayManagerWin32.cpp
|
||||
./intern/GHOST_SystemWin32.cpp
|
||||
./intern/GHOST_WindowWin32.cpp
|
||||
./intern/GHOST_DropTargetWin32.cpp
|
||||
)
|
||||
ELSEIF(UNIX)
|
||||
LIST(APPEND INC ${X11_X11_INCLUDE_PATH})
|
||||
|
||||
@ -89,6 +80,19 @@ ELSEIF(UNIX)
|
||||
|
||||
ADD_DEFINITIONS(-DPREFIX="${CMAKE_INSTALL_PREFIX}")
|
||||
|
||||
ELSEIF(WIN32)
|
||||
IF(MSVC)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX")
|
||||
ENDIF(MSVC)
|
||||
|
||||
LIST(APPEND INC ${WINTAB_INC})
|
||||
|
||||
LIST(APPEND SRC
|
||||
./intern/GHOST_DisplayManagerWin32.cpp
|
||||
./intern/GHOST_SystemWin32.cpp
|
||||
./intern/GHOST_WindowWin32.cpp
|
||||
./intern/GHOST_DropTargetWin32.cpp
|
||||
)
|
||||
ENDIF(APPLE)
|
||||
|
||||
BLENDERLIB(bf_intern_ghost "${SRC}" "${INC}")
|
||||
|
@ -30,9 +30,9 @@ SET(SRC
|
||||
./intern/mallocn.c
|
||||
)
|
||||
|
||||
IF(WIN32)
|
||||
IF(WIN32 AND NOT UNIX)
|
||||
LIST(APPEND SRC ./intern/mmap_win.c)
|
||||
ENDIF(WIN32)
|
||||
ENDIF(WIN32 AND NOT UNIX)
|
||||
|
||||
BLENDERLIB(bf_intern_guardedalloc "${SRC}" "${INC}")
|
||||
|
||||
|
@ -42,6 +42,13 @@
|
||||
#define FILE_MAP_EXECUTE 0x0020
|
||||
#endif
|
||||
|
||||
/* copied from BKE_utildefines.h ugh */
|
||||
#ifdef __GNUC__
|
||||
# define UNUSED(x) UNUSED_ ## x __attribute__((__unused__))
|
||||
#else
|
||||
# define UNUSED(x) x
|
||||
#endif
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
/* local storage definitions */
|
||||
/* --------------------------------------------------------------------- */
|
||||
@ -86,7 +93,7 @@ volatile static struct mmapListBase *mmapbase = &_mmapbase;
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
/* mmap for windows */
|
||||
void *mmap(void *start, size_t len, int prot, int flags, int fd, off_t offset)
|
||||
void *mmap(void *UNUSED(start), size_t len, int prot, int flags, int fd, off_t offset)
|
||||
{
|
||||
HANDLE fhandle = INVALID_HANDLE_VALUE;
|
||||
HANDLE maphandle;
|
||||
@ -151,7 +158,7 @@ void *mmap(void *start, size_t len, int prot, int flags, int fd, off_t offset)
|
||||
}
|
||||
|
||||
/* munmap for windows */
|
||||
intptr_t munmap(void *ptr, intptr_t size)
|
||||
intptr_t munmap(void *ptr, intptr_t UNUSED(size))
|
||||
{
|
||||
MemMap *mm = mmap_findlink(mmapbase, ptr);
|
||||
if (!mm) {
|
||||
|
@ -243,6 +243,7 @@ static bool loadTile(float* const noiseTileData, std::string filename)
|
||||
|| (headerbuffer[headerlen-1] != (char)((char)sizeof(long)+'0')))
|
||||
{
|
||||
printf("loadTile : Noise tile '%s' was generated on an incompatible platform.\n",filename.c_str());
|
||||
fclose(file);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -958,8 +958,8 @@ void WTURBULENCE::stepTurbulenceFull(float dtOrg, float* xvel, float* yvel, floa
|
||||
for (int i = 1; i < threadval; i++)
|
||||
if (maxVelMag < maxVelMagThreads[i])
|
||||
maxVelMag = maxVelMagThreads[i];
|
||||
delete [] maxVelMagThreads;
|
||||
#endif
|
||||
delete [] maxVelMagThreads;
|
||||
|
||||
|
||||
// prepare density for an advection
|
||||
|
@ -84,13 +84,15 @@ def verify_address(netsettings):
|
||||
conn.close()
|
||||
else:
|
||||
netrender.valid_address = False
|
||||
|
||||
return netrender.valid_address
|
||||
|
||||
class NeedValidAddress():
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return netrender.valid_address and super(NeedValidAddress, cls).poll(context)
|
||||
return super().poll(context) and verify_address(context.scene.network_render)
|
||||
|
||||
class RenderButtonsPanel():
|
||||
class NetRenderButtonsPanel():
|
||||
bl_space_type = "PROPERTIES"
|
||||
bl_region_type = "WINDOW"
|
||||
bl_context = "render"
|
||||
@ -99,10 +101,10 @@ class RenderButtonsPanel():
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
rd = context.scene.render
|
||||
return rd.use_game_engine == False and rd.engine in cls.COMPAT_ENGINES and super().poll(context)
|
||||
return rd.engine == 'NET_RENDER' and rd.use_game_engine == False
|
||||
|
||||
# Setting panel, use in the scene for now.
|
||||
class RENDER_PT_network_settings(RenderButtonsPanel, bpy.types.Panel):
|
||||
class RENDER_PT_network_settings(NetRenderButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Network Settings"
|
||||
COMPAT_ENGINES = {'NET_RENDER'}
|
||||
|
||||
@ -143,7 +145,7 @@ class RENDER_PT_network_settings(RenderButtonsPanel, bpy.types.Panel):
|
||||
|
||||
layout.operator("render.netclientweb", icon='QUESTION')
|
||||
|
||||
class RENDER_PT_network_slave_settings(RenderButtonsPanel, bpy.types.Panel):
|
||||
class RENDER_PT_network_slave_settings(NetRenderButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Slave Settings"
|
||||
COMPAT_ENGINES = {'NET_RENDER'}
|
||||
|
||||
@ -168,7 +170,7 @@ class RENDER_PT_network_slave_settings(RenderButtonsPanel, bpy.types.Panel):
|
||||
sub.enabled = rd.threads_mode == 'FIXED'
|
||||
sub.prop(rd, "threads")
|
||||
|
||||
class RENDER_PT_network_master_settings(RenderButtonsPanel, bpy.types.Panel):
|
||||
class RENDER_PT_network_master_settings(NetRenderButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Master Settings"
|
||||
COMPAT_ENGINES = {'NET_RENDER'}
|
||||
|
||||
@ -186,7 +188,7 @@ class RENDER_PT_network_master_settings(RenderButtonsPanel, bpy.types.Panel):
|
||||
layout.prop(netsettings, "use_master_broadcast")
|
||||
layout.prop(netsettings, "use_master_clear")
|
||||
|
||||
class RENDER_PT_network_job(RenderButtonsPanel, bpy.types.Panel):
|
||||
class RENDER_PT_network_job(NetRenderButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Job Settings"
|
||||
COMPAT_ENGINES = {'NET_RENDER'}
|
||||
|
||||
@ -228,7 +230,7 @@ class RENDER_PT_network_job(RenderButtonsPanel, bpy.types.Panel):
|
||||
row.prop(netsettings, "priority")
|
||||
row.prop(netsettings, "chunks")
|
||||
|
||||
class RENDER_PT_network_job_vcs(RenderButtonsPanel, bpy.types.Panel):
|
||||
class RENDER_PT_network_job_vcs(NetRenderButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "VCS Job Settings"
|
||||
COMPAT_ENGINES = {'NET_RENDER'}
|
||||
|
||||
@ -252,18 +254,14 @@ class RENDER_PT_network_job_vcs(RenderButtonsPanel, bpy.types.Panel):
|
||||
layout.prop(netsettings, "vcs_rpath")
|
||||
layout.prop(netsettings, "vcs_wpath")
|
||||
|
||||
class RENDER_PT_network_slaves(RenderButtonsPanel, NeedValidAddress, bpy.types.Panel):
|
||||
class RENDER_PT_network_slaves(NeedValidAddress, NetRenderButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Slaves Status"
|
||||
COMPAT_ENGINES = {'NET_RENDER'}
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
scene = context.scene
|
||||
netsettings = scene.network_render
|
||||
if netsettings.mode != "RENDER_CLIENT":
|
||||
return False
|
||||
verify_address(netsettings)
|
||||
return super().poll(context)
|
||||
netsettings = context.scene.network_render
|
||||
return super().poll(context) and netsettings.mode == "RENDER_CLIENT"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
@ -290,18 +288,14 @@ class RENDER_PT_network_slaves(RenderButtonsPanel, NeedValidAddress, bpy.types.P
|
||||
layout.label(text="Seen: " + time.ctime(slave.last_seen))
|
||||
layout.label(text="Stats: " + slave.stats)
|
||||
|
||||
class RENDER_PT_network_slaves_blacklist(RenderButtonsPanel, NeedValidAddress, bpy.types.Panel):
|
||||
class RENDER_PT_network_slaves_blacklist(NeedValidAddress, NetRenderButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Slaves Blacklist"
|
||||
COMPAT_ENGINES = {'NET_RENDER'}
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
scene = context.scene
|
||||
netsettings = scene.network_render
|
||||
if netsettings.mode != "RENDER_CLIENT":
|
||||
return False
|
||||
verify_address(netsettings)
|
||||
return super().poll(context)
|
||||
netsettings = context.scene.network_render
|
||||
return super().poll(context) and netsettings.mode == "RENDER_CLIENT"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
@ -327,18 +321,14 @@ class RENDER_PT_network_slaves_blacklist(RenderButtonsPanel, NeedValidAddress, b
|
||||
layout.label(text="Seen: " + time.ctime(slave.last_seen))
|
||||
layout.label(text="Stats: " + slave.stats)
|
||||
|
||||
class RENDER_PT_network_jobs(RenderButtonsPanel, NeedValidAddress, bpy.types.Panel):
|
||||
class RENDER_PT_network_jobs(NeedValidAddress, NetRenderButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Jobs"
|
||||
COMPAT_ENGINES = {'NET_RENDER'}
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
scene = context.scene
|
||||
netsettings = scene.network_render
|
||||
if netsettings.mode != "RENDER_CLIENT":
|
||||
return False
|
||||
verify_address(netsettings)
|
||||
return super().poll(context)
|
||||
netsettings = context.scene.network_render
|
||||
return super().poll(context) and netsettings.mode == "RENDER_CLIENT"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
@ -26,9 +26,8 @@ data = _bpy.data
|
||||
context = _bpy.context
|
||||
|
||||
# python modules
|
||||
from bpy import utils, path
|
||||
|
||||
from bpy import ops as _ops_module
|
||||
from . import utils, path
|
||||
from . import ops as _ops_module
|
||||
|
||||
# fake operator module
|
||||
ops = _ops_module.ops_fake_module
|
||||
|
@ -134,6 +134,17 @@ class bpy_ops_submodule_op(object):
|
||||
|
||||
return C_dict, C_exec
|
||||
|
||||
@staticmethod
|
||||
def _scene_update(context):
|
||||
scene = context.scene
|
||||
if scene: # None in backgroud mode
|
||||
scene.update()
|
||||
else:
|
||||
import bpy
|
||||
for scene in bpy.data.scenes:
|
||||
scene.update()
|
||||
|
||||
|
||||
__doc__ = property(_get_doc)
|
||||
|
||||
def __init__(self, module, func):
|
||||
@ -153,22 +164,23 @@ class bpy_ops_submodule_op(object):
|
||||
return self.module + "." + self.func
|
||||
|
||||
def __call__(self, *args, **kw):
|
||||
import bpy
|
||||
context = bpy.context
|
||||
|
||||
# Get the operator from blender
|
||||
wm = context.window_manager
|
||||
|
||||
# run to account for any rna values the user changes.
|
||||
__class__._scene_update(context)
|
||||
|
||||
if args:
|
||||
C_dict, C_exec = __class__._parse_args(args)
|
||||
ret = op_call(self.idname_py(), C_dict, kw, C_exec)
|
||||
else:
|
||||
ret = op_call(self.idname_py(), None, kw)
|
||||
|
||||
if 'FINISHED' in ret:
|
||||
import bpy
|
||||
scene = bpy.context.scene
|
||||
if scene: # None in backgroud mode
|
||||
scene.update()
|
||||
else:
|
||||
for scene in bpy.data.scenes:
|
||||
scene.update()
|
||||
if 'FINISHED' in ret and context.window_manager == wm:
|
||||
__class__._scene_update(context)
|
||||
|
||||
return ret
|
||||
|
||||
|
@ -23,13 +23,12 @@ This module contains utility functions specific to blender but
|
||||
not assosiated with blenders internal data.
|
||||
"""
|
||||
|
||||
import bpy as _bpy
|
||||
import os as _os
|
||||
import sys as _sys
|
||||
|
||||
from _bpy import blend_paths, user_resource
|
||||
from _bpy import script_paths as _bpy_script_paths
|
||||
|
||||
import bpy as _bpy
|
||||
import os as _os
|
||||
import sys as _sys
|
||||
|
||||
def _test_import(module_name, loaded_modules):
|
||||
import traceback
|
||||
@ -200,7 +199,7 @@ def load_scripts(reload_scripts=False, refresh_scripts=False):
|
||||
_bpy_types._register_immediate = True
|
||||
|
||||
# deal with addons seperately
|
||||
addon_reset_all()
|
||||
addon_reset_all(reload_scripts)
|
||||
|
||||
|
||||
# run the active integration preset
|
||||
@ -473,7 +472,7 @@ def addon_disable(module_name, default_set=True):
|
||||
print("\tbpy.utils.addon_disable", module_name)
|
||||
|
||||
|
||||
def addon_reset_all():
|
||||
def addon_reset_all(reload_scripts=False):
|
||||
"""
|
||||
Sets the addon state based on the user preferences.
|
||||
"""
|
||||
@ -491,6 +490,13 @@ def addon_reset_all():
|
||||
_sys_path_ensure(path)
|
||||
for mod_name, mod_path in _bpy.path.module_names(path):
|
||||
is_enabled, is_loaded = addon_check(mod_name)
|
||||
|
||||
# first check if reload is needed before changing state.
|
||||
if reload_scripts:
|
||||
mod = _sys.modules.get(mod_name)
|
||||
if mod:
|
||||
reload(mod)
|
||||
|
||||
if is_enabled == is_loaded:
|
||||
pass
|
||||
elif is_enabled:
|
||||
@ -499,6 +505,7 @@ def addon_reset_all():
|
||||
print("\taddon_reset_all unloading", mod_name)
|
||||
addon_disable(mod_name)
|
||||
|
||||
|
||||
def preset_find(name, preset_path, display_name=False):
|
||||
if not name:
|
||||
return None
|
||||
|
@ -24,131 +24,170 @@
|
||||
#
|
||||
# ***** END GPL LICENCE BLOCK *****
|
||||
#
|
||||
import time
|
||||
|
||||
import os, time
|
||||
import bpy
|
||||
|
||||
#----------------------------------------------------------------------------------------------------------------------
|
||||
from extensions_framework.ui import EF_OT_msg
|
||||
|
||||
bpy.types.register(EF_OT_msg)
|
||||
del EF_OT_msg
|
||||
|
||||
|
||||
def log(str, popup=False, module_name='EF'):
|
||||
print("[%s %s] %s" % (module_name, time.strftime('%Y-%b-%d %H:%M:%S'), str))
|
||||
"""Print a message to the console, prefixed with the module_name
|
||||
and the current time. If the popup flag is True, the message will
|
||||
be raised in the UI as a warning using the operator bpy.ops.ef.msg.
|
||||
|
||||
"""
|
||||
print("[%s %s] %s" %
|
||||
(module_name, time.strftime('%Y-%b-%d %H:%M:%S'), str))
|
||||
if popup:
|
||||
bpy.ops.ef.msg(
|
||||
msg_type='WARNING',
|
||||
msg_text=str
|
||||
)
|
||||
|
||||
#----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
from .ui import EF_OT_msg
|
||||
|
||||
bpy.types.register(EF_OT_msg)
|
||||
ef_path = os.path.realpath( os.path.dirname(__file__) )
|
||||
# log('Extensions_Framework detected and loaded from %s'%ef_path)
|
||||
|
||||
del EF_OT_msg, os
|
||||
|
||||
#----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
class ef(object):
|
||||
'''
|
||||
Extensions Framework base class
|
||||
'''
|
||||
|
||||
added_property_cache = {}
|
||||
|
||||
added_property_cache = {}
|
||||
|
||||
def init_properties(obj, props, cache=True):
|
||||
if not obj in ef.added_property_cache.keys():
|
||||
ef.added_property_cache[obj] = []
|
||||
"""Initialise custom properties in the given object or type.
|
||||
The props list is described in the declarative_property_group
|
||||
class definition. If the cache flag is False, this function
|
||||
will attempt to redefine properties even if they have already been
|
||||
added.
|
||||
|
||||
"""
|
||||
|
||||
if not obj in added_property_cache.keys():
|
||||
added_property_cache[obj] = []
|
||||
|
||||
for prop in props:
|
||||
if cache and prop['attr'] in ef.added_property_cache[obj]:
|
||||
continue
|
||||
try:
|
||||
if cache and prop['attr'] in added_property_cache[obj]:
|
||||
continue
|
||||
|
||||
if prop['type'] == 'bool':
|
||||
t = bpy.props.BoolProperty
|
||||
a = {k: v for k,v in prop.items() if k in ['name','description','default']}
|
||||
a = {k: v for k,v in prop.items() if k in ['name',
|
||||
'description','default']}
|
||||
elif prop['type'] == 'collection':
|
||||
t = bpy.props.CollectionProperty
|
||||
a = {k: v for k,v in prop.items() if k in ["ptype", "name", "description"]}
|
||||
a = {k: v for k,v in prop.items() if k in ["ptype", "name",
|
||||
"description"]}
|
||||
a['type'] = a['ptype']
|
||||
del a['ptype']
|
||||
elif prop['type'] == 'enum':
|
||||
t = bpy.props.EnumProperty
|
||||
a = {k: v for k,v in prop.items() if k in ["items", "name", "description", "default"]}
|
||||
a = {k: v for k,v in prop.items() if k in ["items", "name",
|
||||
"description", "default"]}
|
||||
elif prop['type'] == 'float':
|
||||
t = bpy.props.FloatProperty
|
||||
a = {k: v for k,v in prop.items() if k in ["name", "description", "min", "max", "soft_min", "soft_max", "default", "precision"]}
|
||||
a = {k: v for k,v in prop.items() if k in ["name",
|
||||
"description", "min", "max", "soft_min", "soft_max",
|
||||
"default", "precision"]}
|
||||
elif prop['type'] == 'float_vector':
|
||||
t = bpy.props.FloatVectorProperty
|
||||
a = {k: v for k,v in prop.items() if k in ["name", "description", "min", "max", "soft_min", "soft_max", "default", "precision", "size", "subtype"]}
|
||||
a = {k: v for k,v in prop.items() if k in ["name",
|
||||
"description", "min", "max", "soft_min", "soft_max",
|
||||
"default", "precision", "size", "subtype"]}
|
||||
elif prop['type'] == 'int':
|
||||
t = bpy.props.IntProperty
|
||||
a = {k: v for k,v in prop.items() if k in ["name", "description", "min", "max", "soft_min", "soft_max", "default"]}
|
||||
a = {k: v for k,v in prop.items() if k in ["name",
|
||||
"description", "min", "max", "soft_min", "soft_max",
|
||||
"default"]}
|
||||
elif prop['type'] == 'pointer':
|
||||
t = bpy.props.PointerProperty
|
||||
a = {k: v for k,v in prop.items() if k in ["ptype", "name", "description"]}
|
||||
a = {k: v for k,v in prop.items() if k in ["ptype", "name",
|
||||
"description"]}
|
||||
a['type'] = a['ptype']
|
||||
del a['ptype']
|
||||
elif prop['type'] == 'string':
|
||||
t = bpy.props.StringProperty
|
||||
a = {k: v for k,v in prop.items() if k in ["name", "description", "maxlen", "default", "subtype"]}
|
||||
a = {k: v for k,v in prop.items() if k in ["name",
|
||||
"description", "maxlen", "default", "subtype"]}
|
||||
else:
|
||||
#ef.log('Property type not recognised: %s' % prop['type'])
|
||||
continue
|
||||
|
||||
setattr(obj, prop['attr'], t(**a))
|
||||
|
||||
ef.added_property_cache[obj].append(prop['attr'])
|
||||
#log('Created property %s.%s' % (obj, prop['attr']))
|
||||
added_property_cache[obj].append(prop['attr'])
|
||||
except KeyError:
|
||||
# Silently skip invalid entries in props
|
||||
continue
|
||||
|
||||
|
||||
class declarative_property_group(bpy.types.IDPropertyGroup):
|
||||
"""A declarative_property_group describes a set of logically
|
||||
related properties, using a declarative style to list each
|
||||
property type, name, values, and other relevant information.
|
||||
The information provided for each property depends on the
|
||||
property's type.
|
||||
|
||||
controls = [
|
||||
# this list controls the order of property
|
||||
# layout when rendered by a property_group_renderer.
|
||||
# This can be a nested list, where each list
|
||||
# becomes a row in the panel layout.
|
||||
# nesting may be to any depth
|
||||
]
|
||||
The properties list attribute in this class describes the
|
||||
properties present in this group.
|
||||
|
||||
# Include some properties in display based on values of others
|
||||
visibility = {
|
||||
# See ef.validate for test syntax
|
||||
Some additional information about the properties in this group
|
||||
can be specified, so that a UI can be generated to display them.
|
||||
To that end, the controls list attribute and the visibility dict
|
||||
attribute are present here, to be read and interpreted by a
|
||||
property_group_renderer object.
|
||||
See extensions_framework.ui.property_group_renderer.
|
||||
|
||||
"""
|
||||
|
||||
"""This list controls the order of property layout when rendered
|
||||
by a property_group_renderer. This can be a nested list, where each
|
||||
list becomes a row in the panel layout. Nesting may be to any depth.
|
||||
|
||||
"""
|
||||
controls = []
|
||||
|
||||
"""The visibility dict controls the display of properties based on
|
||||
the value of other properties. See extensions_framework.validate
|
||||
for test syntax.
|
||||
|
||||
"""
|
||||
visibility = {}
|
||||
|
||||
"""The properties list describes each property to be created. Each
|
||||
item should be a dict of args to pass to a
|
||||
bpy.props.<?>Property function, with the exception of 'type'
|
||||
which is used and stripped by extensions_framework in order to
|
||||
determine which Property creation function to call.
|
||||
|
||||
Example item:
|
||||
{
|
||||
'type': 'int', # bpy.props.IntProperty
|
||||
'attr': 'threads', # bpy.types.<type>.threads
|
||||
'name': 'Render Threads', # Rendered next to the UI
|
||||
'description': 'Number of threads to use', # Tooltip text in the UI
|
||||
'default': 1,
|
||||
'min': 1,
|
||||
'soft_min': 1,
|
||||
'max': 64,
|
||||
'soft_max': 64
|
||||
}
|
||||
|
||||
# engine-specific properties to create in the scene.
|
||||
# Each item should be a dict of args to pass to a
|
||||
# bpy.types.Scene.<?>Property function, with the exception
|
||||
# of 'type' which is used and stripped by ef
|
||||
properties = [
|
||||
# example:
|
||||
#{
|
||||
# 'type': 'int',
|
||||
# 'attr': 'threads',
|
||||
# 'name': 'Render Threads',
|
||||
# 'description': 'Number of threads to use',
|
||||
# 'default': 1,
|
||||
# 'min': 1,
|
||||
# 'soft_min': 1,
|
||||
# 'max': 64,
|
||||
# 'soft_max': 64
|
||||
#},
|
||||
]
|
||||
"""
|
||||
properties = []
|
||||
|
||||
def draw_callback(self, context):
|
||||
'''
|
||||
Sub-classes can override this to get a callback
|
||||
when rendered by a property_group_renderer class
|
||||
'''
|
||||
"""Sub-classes can override this to get a callback when
|
||||
rendering is completed by a property_group_renderer sub-class.
|
||||
|
||||
"""
|
||||
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def get_exportable_properties(cls):
|
||||
"""Return a list of properties which have the 'save_in_preset' key
|
||||
set to True, and hence should be saved into preset files.
|
||||
|
||||
"""
|
||||
|
||||
out = []
|
||||
for prop in cls.properties:
|
||||
if 'save_in_preset' in prop.keys() and prop['save_in_preset']:
|
||||
|
@ -24,12 +24,14 @@
|
||||
#
|
||||
# ***** END GPL LICENCE BLOCK *****
|
||||
#
|
||||
from .plugin import plugin
|
||||
from extensions_framework.plugin import plugin
|
||||
|
||||
class engine_base(plugin):
|
||||
'''
|
||||
Render Engine plugin base class
|
||||
'''
|
||||
"""Render Engine plugin base class
|
||||
|
||||
TODO: Remove, this class hasn't grown to be useful
|
||||
|
||||
"""
|
||||
|
||||
bl_label = 'Abstract Render Engine Base Class'
|
||||
|
||||
|
@ -28,36 +28,49 @@ import xml.etree.cElementTree as ET
|
||||
import xml.dom.minidom as MD
|
||||
|
||||
class xml_output(object):
|
||||
"""This class serves to describe an XML output, it uses
|
||||
cElementTree and minidom to construct and format the XML
|
||||
data.
|
||||
|
||||
"""
|
||||
|
||||
"""The format dict describes the XML structure that this class
|
||||
should generate, and which properties should be used to fill
|
||||
the XML data structure
|
||||
|
||||
"""
|
||||
format = {}
|
||||
|
||||
def __str__(self):
|
||||
return ET.tostring(self.root)
|
||||
|
||||
def write_pretty(self, file):
|
||||
"""Write a formatted XML string to file"""
|
||||
xml_dom = MD.parseString(ET.tostring(self.root, encoding='utf-8'))
|
||||
xml_dom.writexml(file, addindent=' ', newl='\n', encoding='utf-8')
|
||||
|
||||
def pretty(self):
|
||||
"""Return a formatted XML string"""
|
||||
xml_str = MD.parseString(ET.tostring(self.root))
|
||||
return xml_str.toprettyxml()
|
||||
|
||||
# This should be overridden in classes that produce XML conditionally
|
||||
def get_format(self):
|
||||
"""This should be overridden in classes that produce XML
|
||||
conditionally
|
||||
|
||||
"""
|
||||
return self.format
|
||||
|
||||
def compute(self, context):
|
||||
"""Compute the XML output from the input format"""
|
||||
self.context = context
|
||||
|
||||
self.root = ET.Element(self.root_element)
|
||||
self.parse_dict(self.get_format(), self.root)
|
||||
#ET.dump(root)
|
||||
|
||||
return self.root
|
||||
|
||||
def make_subelement(self, elem, name):
|
||||
return ET.SubElement(elem, name)
|
||||
|
||||
|
||||
"""Formatting functions for various data types"""
|
||||
format_types = {
|
||||
'bool': lambda c,x: str(x).lower(),
|
||||
'collection': lambda c,x: x,
|
||||
@ -67,8 +80,12 @@ class xml_output(object):
|
||||
'pointer': lambda c,x: x,
|
||||
'string': lambda c,x: x,
|
||||
}
|
||||
|
||||
|
||||
def parse_dict(self, d, elem):
|
||||
"""Parse the values in the format dict and collect the
|
||||
formatted data into XML structure starting at self.root
|
||||
|
||||
"""
|
||||
for key in d.keys():
|
||||
# tuple provides multiple child elements
|
||||
if type(d[key]) is tuple:
|
||||
@ -93,4 +110,7 @@ class xml_output(object):
|
||||
if 'compute' in p.keys():
|
||||
x.text = str(p['compute'](self.context, self))
|
||||
else:
|
||||
x.text = str(self.format_types[p['type']](self.context, getattr(self, d[key])))
|
||||
x.text = str(
|
||||
self.format_types[p['type']](self.context,
|
||||
getattr(self, d[key]))
|
||||
)
|
||||
|
@ -24,21 +24,45 @@
|
||||
#
|
||||
# ***** END GPL LICENCE BLOCK *****
|
||||
#
|
||||
from . import init_properties
|
||||
from . import log
|
||||
|
||||
import bpy
|
||||
|
||||
from extensions_framework import init_properties
|
||||
from extensions_framework import log
|
||||
|
||||
class plugin(object):
|
||||
"""Base class for plugins which wish to make use of utilities
|
||||
provided in extensions_framework. Using the property_groups
|
||||
attribute and the install() and uninstall() methods, a large number
|
||||
of custom scene properties can be easily defined, displayed and
|
||||
managed.
|
||||
|
||||
# List of IDPropertyGroup types to create in the scene
|
||||
property_groups = [
|
||||
# ('bpy.type prototype to attach to. eg. Scene', <declarative_property_group type>)
|
||||
]
|
||||
TODO: Rename, 'extension' would be more appropriate than 'plugin'
|
||||
|
||||
"""
|
||||
|
||||
"""The property_groups defines a list of declarative_property_group
|
||||
types to create in specified types during the initialisation of the
|
||||
plugin.
|
||||
Item format:
|
||||
('bpy.type prototype to attach to', <declarative_property_group>)
|
||||
|
||||
Example item:
|
||||
('Scene', myaddon_property_group)
|
||||
In this example, a new property group will be attached to
|
||||
bpy.types.Scene and all of the properties described in that group
|
||||
will be added to it.
|
||||
See extensions_framework.declarative_property_group.
|
||||
|
||||
"""
|
||||
property_groups = []
|
||||
|
||||
@classmethod
|
||||
def install(r_class):
|
||||
# create custom property groups
|
||||
"""Initialise this plugin. So far, all this does is to create
|
||||
custom property groups specified in the property_groups
|
||||
attribute.
|
||||
|
||||
"""
|
||||
for property_group_parent, property_group in r_class.property_groups:
|
||||
call_init = False
|
||||
if property_group_parent is not None:
|
||||
@ -52,19 +76,17 @@ class plugin(object):
|
||||
'description': property_group.__name__
|
||||
}])
|
||||
call_init = True
|
||||
#print('Created IDPropertyGroup %s.%s' % (prototype, property_group.__name__))
|
||||
else:
|
||||
call_init = True
|
||||
|
||||
if call_init:
|
||||
init_properties(property_group, property_group.properties)
|
||||
#print('Initialised IDPropertyGroup %s' % property_group.__name__)
|
||||
|
||||
log('Extension "%s" initialised' % r_class.bl_label)
|
||||
|
||||
@classmethod
|
||||
def uninstall(r_class):
|
||||
# unregister property groups in reverse order
|
||||
"""Unregister property groups in reverse order"""
|
||||
reverse_property_groups = [p for p in r_class.property_groups]
|
||||
reverse_property_groups.reverse()
|
||||
for property_group_parent, property_group in reverse_property_groups:
|
||||
|
@ -26,9 +26,10 @@
|
||||
#
|
||||
import bpy
|
||||
|
||||
from .validate import Visibility
|
||||
from extensions_framework.validate import Visibility
|
||||
|
||||
class EF_OT_msg(bpy.types.Operator):
|
||||
"""An operator to show simple messages in the UI"""
|
||||
bl_idname = 'ef.msg'
|
||||
bl_label = 'Show UI Message'
|
||||
msg_type = bpy.props.StringProperty(default='INFO')
|
||||
@ -38,138 +39,200 @@ class EF_OT_msg(bpy.types.Operator):
|
||||
return {'FINISHED'}
|
||||
|
||||
def _get_item_from_context(context, path):
|
||||
"""Utility to get an object when the path to it is known:
|
||||
_get_item_from_context(context, ['a','b','c']) returns
|
||||
context.a.b.c
|
||||
No error checking is performed other than checking that context
|
||||
is not None. Exceptions caused by invalid path should be caught in
|
||||
the calling code.
|
||||
|
||||
"""
|
||||
|
||||
if context is not None:
|
||||
for p in path:
|
||||
context = getattr(context, p)
|
||||
return context
|
||||
|
||||
class property_group_renderer(object):
|
||||
"""Mix-in class for sub-classes of bpy.types.Panel. This class
|
||||
will provide the draw() method which implements drawing one or
|
||||
more property groups derived from
|
||||
extensions_framework.declarative_propery_group.
|
||||
The display_property_groups list attribute describes which
|
||||
declarative_property_groups should be drawn in the Panel, and
|
||||
how to extract those groups from the context passed to draw().
|
||||
|
||||
# Choose which custom property groups this panel should draw, and
|
||||
# where to find that property group in the active context
|
||||
display_property_groups = [
|
||||
# ( ('scene',), 'declarative_property_group name')
|
||||
]
|
||||
"""
|
||||
|
||||
"""The display_property_groups list attribute specifies which
|
||||
custom declarative_property_groups this panel should draw, and
|
||||
where to find that property group in the active context.
|
||||
Example item:
|
||||
( ('scene',), 'myaddon_property_group')
|
||||
In this case, this renderer will look for properties in
|
||||
context.scene.myaddon_property_group to draw in the Panel.
|
||||
|
||||
"""
|
||||
display_property_groups = []
|
||||
|
||||
def draw(self, context):
|
||||
'''
|
||||
Sub-classes should override this if they need to display
|
||||
other (object-related) property groups
|
||||
'''
|
||||
for property_group_path, property_group_name in self.display_property_groups:
|
||||
"""Sub-classes should override this if they need to display
|
||||
other (object-related) property groups. super().draw(context)
|
||||
can be a useful call in those cases.
|
||||
|
||||
"""
|
||||
for property_group_path, property_group_name in \
|
||||
self.display_property_groups:
|
||||
ctx = _get_item_from_context(context, property_group_path)
|
||||
property_group = getattr(ctx, property_group_name)
|
||||
for p in property_group.controls:
|
||||
self.draw_column(p, self.layout, ctx, context, property_group=property_group)
|
||||
self.draw_column(p, self.layout, ctx, context,
|
||||
property_group=property_group)
|
||||
property_group.draw_callback(context)
|
||||
|
||||
@staticmethod
|
||||
def property_reload():
|
||||
'''
|
||||
override this in sub classes to force data refresh upon scene reload
|
||||
'''
|
||||
"""Override this in sub classes to force data refresh upon scene reload
|
||||
|
||||
TODO: Remove, this is not used anywhere
|
||||
"""
|
||||
pass
|
||||
|
||||
def check_visibility(self, lookup_property, context, property_group):
|
||||
def check_visibility(self, lookup_property, property_group):
|
||||
"""Determine if the lookup_property should be drawn in the Panel"""
|
||||
vt = Visibility(property_group)
|
||||
if lookup_property in property_group.visibility.keys():
|
||||
if hasattr(property_group, lookup_property):
|
||||
member = getattr(property_group, lookup_property)
|
||||
else:
|
||||
member = None
|
||||
return vt.test_logic(member, property_group.visibility[lookup_property])
|
||||
return vt.test_logic(member,
|
||||
property_group.visibility[lookup_property])
|
||||
else:
|
||||
return True
|
||||
|
||||
def draw_column(self, control_list_item, layout, context, supercontext=None, property_group=None):
|
||||
def draw_column(self, control_list_item, layout, context,
|
||||
supercontext=None, property_group=None):
|
||||
"""Draw a column's worth of UI controls in this Panel"""
|
||||
if type(control_list_item) is list:
|
||||
do_split = False
|
||||
draw_row = False
|
||||
|
||||
found_percent = None
|
||||
for sp in control_list_item:
|
||||
if type(sp) is float:
|
||||
found_percent = sp
|
||||
elif type(sp) is list:
|
||||
for ssp in control_list_item:
|
||||
do_split = do_split and self.check_visibility(ssp, context, property_group)
|
||||
for ssp in sp:
|
||||
draw_row = draw_row or self.check_visibility(ssp,
|
||||
property_group)
|
||||
else:
|
||||
do_split = do_split or self.check_visibility(sp, context, property_group)
|
||||
draw_row = draw_row or self.check_visibility(sp,
|
||||
property_group)
|
||||
|
||||
if do_split:
|
||||
# print('split %s'%p)
|
||||
if draw_row:
|
||||
if found_percent is not None:
|
||||
fp = { 'percentage': found_percent }
|
||||
splt = layout.split(**fp)
|
||||
splt = layout.split(percentage=found_percent)
|
||||
else:
|
||||
splt = layout.row(True)
|
||||
for sp in [s for s in control_list_item if type(s) in [str, list] ]:
|
||||
for sp in [s for s in control_list_item if type(s) in \
|
||||
[str, list]]:
|
||||
col2 = splt.column()
|
||||
self.draw_column(sp, col2, context, supercontext, property_group)
|
||||
#else:
|
||||
# print('dont split %s'%p)
|
||||
self.draw_column(sp, col2, context, supercontext,
|
||||
property_group)
|
||||
else:
|
||||
if self.check_visibility(control_list_item, context, property_group):
|
||||
if self.check_visibility(control_list_item, property_group):
|
||||
|
||||
for current_property in property_group.properties:
|
||||
if current_property['attr'] == control_list_item:
|
||||
current_property_keys = current_property.keys()
|
||||
if 'type' in current_property_keys:
|
||||
|
||||
if current_property['type'] in ['int', 'float', 'float_vector', 'enum', 'string']:
|
||||
if current_property['type'] in ['int', 'float',
|
||||
'float_vector', 'enum', 'string']:
|
||||
layout.prop(
|
||||
property_group,
|
||||
control_list_item,
|
||||
text = current_property['name'],
|
||||
expand = current_property['expand'] if 'expand' in current_property_keys else False,
|
||||
slider = current_property['slider'] if 'slider' in current_property_keys else False,
|
||||
toggle = current_property['toggle'] if 'toggle' in current_property_keys else False,
|
||||
icon_only = current_property['icon_only'] if 'icon_only' in current_property_keys else False,
|
||||
event = current_property['event'] if 'event' in current_property_keys else False,
|
||||
full_event = current_property['full_event'] if 'full_event' in current_property_keys else False,
|
||||
emboss = current_property['emboss'] if 'emboss' in current_property_keys else True,
|
||||
text = current_property['name'],
|
||||
expand = current_property['expand'] \
|
||||
if 'expand' in current_property_keys \
|
||||
else False,
|
||||
slider = current_property['slider'] \
|
||||
if 'slider' in current_property_keys \
|
||||
else False,
|
||||
toggle = current_property['toggle'] \
|
||||
if 'toggle' in current_property_keys \
|
||||
else False,
|
||||
icon_only = current_property['icon_only'] \
|
||||
if 'icon_only' in current_property_keys \
|
||||
else False,
|
||||
event = current_property['event'] \
|
||||
if 'event' in current_property_keys \
|
||||
else False,
|
||||
full_event = current_property['full_event'] \
|
||||
if 'full_event' in current_property_keys \
|
||||
else False,
|
||||
emboss = current_property['emboss'] \
|
||||
if 'emboss' in current_property_keys \
|
||||
else True,
|
||||
)
|
||||
if current_property['type'] in ['bool']:
|
||||
layout.prop(
|
||||
property_group,
|
||||
control_list_item,
|
||||
text = current_property['name'],
|
||||
toggle = current_property['toggle'] if 'toggle' in current_property_keys else False,
|
||||
icon_only = current_property['icon_only'] if 'icon_only' in current_property_keys else False,
|
||||
event = current_property['event'] if 'event' in current_property_keys else False,
|
||||
full_event = current_property['full_event'] if 'full_event' in current_property_keys else False,
|
||||
emboss = current_property['emboss'] if 'emboss' in current_property_keys else True,
|
||||
text = current_property['name'],
|
||||
toggle = current_property['toggle'] \
|
||||
if 'toggle' in current_property_keys \
|
||||
else False,
|
||||
icon_only = current_property['icon_only'] \
|
||||
if 'icon_only' in current_property_keys \
|
||||
else False,
|
||||
event = current_property['event'] \
|
||||
if 'event' in current_property_keys \
|
||||
else False,
|
||||
full_event = current_property['full_event'] \
|
||||
if 'full_event' in current_property_keys \
|
||||
else False,
|
||||
emboss = current_property['emboss'] \
|
||||
if 'emboss' in current_property_keys \
|
||||
else True,
|
||||
)
|
||||
elif current_property['type'] in ['operator']:
|
||||
layout.operator(current_property['operator'],
|
||||
text = current_property['text'],
|
||||
icon = current_property['icon']
|
||||
text = current_property['text'],
|
||||
icon = current_property['icon']
|
||||
)
|
||||
|
||||
elif current_property['type'] in ['text']:
|
||||
layout.label(
|
||||
text = current_property['name']
|
||||
text = current_property['name']
|
||||
)
|
||||
|
||||
elif current_property['type'] in ['template_list']:
|
||||
# row.template_list(idblock, "texture_slots", idblock, "active_texture_index", rows=2)
|
||||
layout.template_list(
|
||||
current_property['src'](supercontext, context),
|
||||
current_property['src_attr'],
|
||||
current_property['trg'](supercontext, context),
|
||||
current_property['trg_attr'],
|
||||
rows = 4 if not 'rows' in current_property_keys else current_property['rows'],
|
||||
maxrows = 4 if not 'rows' in current_property_keys else current_property['rows'],
|
||||
type = 'DEFAULT' if not 'list_type' in current_property_keys else current_property['list_type']
|
||||
rows = 4 \
|
||||
if not 'rows' in current_property_keys \
|
||||
else current_property['rows'],
|
||||
maxrows = 4 \
|
||||
if not 'rows' in current_property_keys \
|
||||
else current_property['rows'],
|
||||
type = 'DEFAULT' \
|
||||
if not 'list_type' in current_property_keys \
|
||||
else current_property['list_type']
|
||||
)
|
||||
|
||||
elif current_property['type'] in ['prop_search']:
|
||||
# split.prop_search(tex, "uv_layer", ob.data, "uv_textures", text="")
|
||||
layout.prop_search(
|
||||
current_property['trg'](supercontext, context),
|
||||
current_property['trg'](supercontext,
|
||||
context),
|
||||
current_property['trg_attr'],
|
||||
current_property['src'](supercontext, context),
|
||||
current_property['src'](supercontext,
|
||||
context),
|
||||
current_property['src_attr'],
|
||||
text = current_property['name'],
|
||||
text = current_property['name'],
|
||||
)
|
||||
else:
|
||||
layout.prop(property_group, control_list_item)
|
||||
|
@ -25,23 +25,24 @@
|
||||
#
|
||||
# ***** END GPL LICENCE BLOCK *****
|
||||
#
|
||||
import datetime, os, configparser, threading, tempfile
|
||||
import configparser
|
||||
import datetime
|
||||
import os
|
||||
import tempfile
|
||||
import threading
|
||||
|
||||
import bpy
|
||||
|
||||
config_paths = bpy.utils.script_paths()
|
||||
|
||||
'''
|
||||
This path is set at the start of export, so that
|
||||
calls to path_relative_to_export() can make all
|
||||
exported paths relative to this one
|
||||
'''
|
||||
"""This path is set at the start of export, so that calls to
|
||||
path_relative_to_export() can make all exported paths relative to
|
||||
this one.
|
||||
"""
|
||||
export_path = '';
|
||||
|
||||
def path_relative_to_export(p):
|
||||
'''
|
||||
Return a path that is relative to the export path
|
||||
'''
|
||||
"""Return a path that is relative to the export path"""
|
||||
global export_path
|
||||
p = filesystem_path(p)
|
||||
try:
|
||||
@ -49,26 +50,25 @@ def path_relative_to_export(p):
|
||||
except ValueError: # path on different drive on windows
|
||||
relp = p
|
||||
|
||||
#print('Resolving rel path %s -> %s' % (p, relp))
|
||||
|
||||
return relp.replace('\\', '/')
|
||||
|
||||
def filesystem_path(p):
|
||||
'''
|
||||
Resolve a relative Blender path to a real filesystem path
|
||||
'''
|
||||
"""Resolve a relative Blender path to a real filesystem path"""
|
||||
if p.startswith('//'):
|
||||
pout = bpy.path.abspath(p)
|
||||
else:
|
||||
pout = os.path.realpath(p)
|
||||
|
||||
#print('Resolving FS path %s -> %s' % (p,pout))
|
||||
|
||||
return pout.replace('\\', '/')
|
||||
|
||||
# TODO: - somehow specify TYPES to get/set from config
|
||||
|
||||
def find_config_value(module, section, key, default):
|
||||
"""Attempt to find the configuration value specified by string key
|
||||
in the specified section of module's configuration file. If it is
|
||||
not found, return default.
|
||||
|
||||
"""
|
||||
global config_paths
|
||||
fc = []
|
||||
for p in config_paths:
|
||||
@ -97,6 +97,10 @@ def find_config_value(module, section, key, default):
|
||||
return default
|
||||
|
||||
def write_config_value(module, section, key, value):
|
||||
"""Attempt to write the configuration value specified by string key
|
||||
in the specified section of module's configuration file.
|
||||
|
||||
"""
|
||||
global config_paths
|
||||
fc = []
|
||||
for p in config_paths:
|
||||
@ -104,7 +108,8 @@ def write_config_value(module, section, key, value):
|
||||
fc.append( '/'.join([p, '%s.cfg' % module]))
|
||||
|
||||
if len(fc) < 1:
|
||||
raise Exception('Cannot find a writable path to store %s config file' % module)
|
||||
raise Exception('Cannot find a writable path to store %s config file' %
|
||||
module)
|
||||
|
||||
cp = configparser.SafeConfigParser()
|
||||
|
||||
@ -130,32 +135,35 @@ def write_config_value(module, section, key, value):
|
||||
return True
|
||||
|
||||
def scene_filename():
|
||||
'''
|
||||
Construct a safe scene filename
|
||||
'''
|
||||
"""Construct a safe scene filename, using 'untitled' instead of ''"""
|
||||
filename = os.path.splitext(os.path.basename(bpy.data.filepath))[0]
|
||||
if filename == '':
|
||||
filename = 'untitled'
|
||||
return bpy.path.clean_name(filename)
|
||||
|
||||
def temp_directory():
|
||||
'''
|
||||
Return the system temp directory
|
||||
'''
|
||||
"""Return the system temp directory"""
|
||||
return tempfile.gettempdir()
|
||||
|
||||
def temp_file(ext='tmp'):
|
||||
'''
|
||||
Get a temporary filename with the given extension
|
||||
'''
|
||||
"""Get a temporary filename with the given extension. This function
|
||||
will actually attempt to create the file."""
|
||||
tf, fn = tempfile.mkstemp(suffix='.%s'%ext)
|
||||
os.close(tf)
|
||||
return fn
|
||||
|
||||
class TimerThread(threading.Thread):
|
||||
'''
|
||||
Periodically call self.kick()
|
||||
'''
|
||||
"""Periodically call self.kick(). The period of time in seconds
|
||||
between calling is given by self.KICK_PERIOD, and the first call
|
||||
may be delayed by setting self.STARTUP_DELAY, also in seconds.
|
||||
self.kick() will continue to be called at regular intervals until
|
||||
self.stop() is called. Since this is a thread, calling self.join()
|
||||
may be wise after calling self.stop() if self.kick() is performing
|
||||
a task necessary for the continuation of the program.
|
||||
The object that creates this TimerThread may pass into it data
|
||||
needed during self.kick() as a dict LocalStorage in __init__().
|
||||
|
||||
"""
|
||||
STARTUP_DELAY = 0
|
||||
KICK_PERIOD = 8
|
||||
|
||||
@ -169,24 +177,27 @@ class TimerThread(threading.Thread):
|
||||
self.LocalStorage = LocalStorage
|
||||
|
||||
def set_kick_period(self, period):
|
||||
"""Adjust the KICK_PERIOD between __init__() and start()"""
|
||||
self.KICK_PERIOD = period + self.STARTUP_DELAY
|
||||
|
||||
def stop(self):
|
||||
"""Stop this timer. This method does not join()"""
|
||||
self.active = False
|
||||
if self.timer is not None:
|
||||
self.timer.cancel()
|
||||
|
||||
def run(self):
|
||||
'''
|
||||
Timed Thread loop
|
||||
'''
|
||||
|
||||
"""Timed Thread loop"""
|
||||
while self.active:
|
||||
self.timer = threading.Timer(self.KICK_PERIOD, self.kick_caller)
|
||||
self.timer.start()
|
||||
if self.timer.isAlive(): self.timer.join()
|
||||
|
||||
def kick_caller(self):
|
||||
"""Intermediary between the kick-wait-loop and kick to allow
|
||||
adjustment of the first KICK_PERIOD by STARTUP_DELAY
|
||||
|
||||
"""
|
||||
if self.STARTUP_DELAY > 0:
|
||||
self.KICK_PERIOD -= self.STARTUP_DELAY
|
||||
self.STARTUP_DELAY = 0
|
||||
@ -194,15 +205,11 @@ class TimerThread(threading.Thread):
|
||||
self.kick()
|
||||
|
||||
def kick(self):
|
||||
'''
|
||||
sub-classes do their work here
|
||||
'''
|
||||
"""Sub-classes do their work here"""
|
||||
pass
|
||||
|
||||
def format_elapsed_time(t):
|
||||
'''
|
||||
Format a duration in seconds as an HH:MM:SS format time
|
||||
'''
|
||||
"""Format a duration in seconds as an HH:MM:SS format time"""
|
||||
|
||||
td = datetime.timedelta(seconds=t)
|
||||
min = td.days*1440 + td.seconds/60.0
|
||||
|
@ -24,7 +24,7 @@
|
||||
#
|
||||
# ***** END GPL LICENCE BLOCK *****
|
||||
#
|
||||
'''
|
||||
"""
|
||||
Pure logic and validation class.
|
||||
|
||||
By using a Subject object, and a dict of described logic tests, it
|
||||
@ -45,10 +45,11 @@ class Subject(object):
|
||||
|
||||
Tests are described thus:
|
||||
|
||||
Use the special list types Logic_AND and Logic_OR to describe combinations
|
||||
of values and other members. Use Logic_Operator for numerical comparison.
|
||||
Use the special list types Logic_AND and Logic_OR to describe
|
||||
combinations of values and other members. Use Logic_Operator for
|
||||
numerical comparison.
|
||||
|
||||
# With regards to Subject, each of these evaluate to True:
|
||||
With regards to Subject, each of these evaluate to True:
|
||||
TESTA = {
|
||||
'a': 0,
|
||||
'c': Logic_OR([ 'foo', 'bar' ]),
|
||||
@ -58,7 +59,7 @@ TESTA = {
|
||||
'g': Logic_OR([ 'baz', Logic_AND([{'b': 1}, {'f': 8}]) ])
|
||||
}
|
||||
|
||||
# With regards to Subject, each of these evaluate to False:
|
||||
With regards to Subject, each of these evaluate to False:
|
||||
TESTB = {
|
||||
'a': 'foo',
|
||||
'c': Logic_OR([ 'bar', 'baz' ]),
|
||||
@ -68,17 +69,17 @@ TESTB = {
|
||||
'g': Logic_OR([ 'baz', Logic_AND([{'b':0}, {'f': 8}]) ])
|
||||
}
|
||||
|
||||
# With regards to Subject, this test is invalid
|
||||
With regards to Subject, this test is invalid
|
||||
TESTC = {
|
||||
'n': 0
|
||||
}
|
||||
|
||||
# Tests are executed thus:
|
||||
Tests are executed thus:
|
||||
S = Subject()
|
||||
L = Logician(S)
|
||||
L.execute(TESTA)
|
||||
|
||||
'''
|
||||
"""
|
||||
|
||||
class Logic_AND(list):
|
||||
pass
|
||||
@ -88,31 +89,28 @@ class Logic_Operator(dict):
|
||||
pass
|
||||
|
||||
class Logician(object):
|
||||
'''
|
||||
Given a subject and a dict that describes tests to perform on its members,
|
||||
this class will evaluate True or False results for each member/test pair.
|
||||
|
||||
See the examples below for test syntax.
|
||||
'''
|
||||
"""Given a subject and a dict that describes tests to perform on
|
||||
its members, this class will evaluate True or False results for
|
||||
each member/test pair. See the examples below for test syntax.
|
||||
|
||||
"""
|
||||
|
||||
subject = None
|
||||
def __init__(self, subject):
|
||||
self.subject = subject
|
||||
|
||||
def get_member(self, member_name):
|
||||
'''
|
||||
Get a member value from the subject object.
|
||||
Raise exception is subject is None or member not found.
|
||||
'''
|
||||
"""Get a member value from the subject object. Raise exception
|
||||
if subject is None or member not found.
|
||||
|
||||
"""
|
||||
if self.subject is None:
|
||||
raise Exception('Cannot run tests on a subject which is None')
|
||||
|
||||
return getattr(self.subject, member_name)
|
||||
|
||||
def test_logic(self, member, logic, operator='eq'):
|
||||
'''
|
||||
Find the type of test to run on member, and perform that test
|
||||
'''
|
||||
"""Find the type of test to run on member, and perform that test"""
|
||||
|
||||
if type(logic) is dict:
|
||||
return self.test_dict(member, logic)
|
||||
@ -123,17 +121,21 @@ class Logician(object):
|
||||
elif type(logic) is Logic_Operator:
|
||||
return self.test_operator(member, logic)
|
||||
else:
|
||||
# compare the value, I think using Logic_Operator() here allows completeness in test_operator(),
|
||||
# but I can't put my finger on why for the minute
|
||||
return self.test_operator(member, Logic_Operator({operator: logic}))
|
||||
# compare the value, I think using Logic_Operator() here
|
||||
# allows completeness in test_operator(), but I can't put
|
||||
# my finger on why for the minute
|
||||
return self.test_operator(member,
|
||||
Logic_Operator({operator: logic}))
|
||||
|
||||
def test_operator(self, member, value):
|
||||
'''
|
||||
execute the operators contained within value and expect that ALL operators are True
|
||||
'''
|
||||
"""Execute the operators contained within value and expect that
|
||||
ALL operators are True
|
||||
|
||||
# something in this method is incomplete, what if operand is a dict, Logic_AND, Logic_OR or another Logic_Operator ?
|
||||
# do those constructs even make any sense ?
|
||||
"""
|
||||
|
||||
# something in this method is incomplete, what if operand is
|
||||
# a dict, Logic_AND, Logic_OR or another Logic_Operator ?
|
||||
# Do those constructs even make any sense ?
|
||||
|
||||
result = True
|
||||
for operator, operand in value.items():
|
||||
@ -161,9 +163,10 @@ class Logician(object):
|
||||
return result
|
||||
|
||||
def test_or(self, member, logic):
|
||||
'''
|
||||
member is a value, logic is a set of values, ANY of which can be True
|
||||
'''
|
||||
"""Member is a value, logic is a set of values, ANY of which
|
||||
can be True
|
||||
|
||||
"""
|
||||
result = False
|
||||
for test in logic:
|
||||
result |= self.test_logic(member, test)
|
||||
@ -171,9 +174,10 @@ class Logician(object):
|
||||
return result
|
||||
|
||||
def test_and(self, member, logic):
|
||||
'''
|
||||
member is a value, logic is a list of values, ALL of which must be True
|
||||
'''
|
||||
"""Member is a value, logic is a list of values, ALL of which
|
||||
must be True
|
||||
|
||||
"""
|
||||
result = True
|
||||
for test in logic:
|
||||
result &= self.test_logic(member, test)
|
||||
@ -181,9 +185,10 @@ class Logician(object):
|
||||
return result
|
||||
|
||||
def test_dict(self, member, logic):
|
||||
'''
|
||||
member is a value, logic is a dict of other members to compare to. All other member tests must be True
|
||||
'''
|
||||
"""Member is a value, logic is a dict of other members to
|
||||
compare to. All other member tests must be True
|
||||
|
||||
"""
|
||||
result = True
|
||||
for other_member, test in logic.items():
|
||||
result &= self.test_logic(self.get_member(other_member), test)
|
||||
@ -191,11 +196,11 @@ class Logician(object):
|
||||
return result
|
||||
|
||||
def execute(self, test):
|
||||
'''
|
||||
subject is an object,
|
||||
test is a dict of {member: test} pairs to perform on subject's members.
|
||||
each key in test is a member of subject.
|
||||
'''
|
||||
"""Subject is an object, test is a dict of {member: test} pairs
|
||||
to perform on subject's members. Wach key in test is a member
|
||||
of subject.
|
||||
|
||||
"""
|
||||
|
||||
for member_name, logic in test.items():
|
||||
result = self.test_logic(self.get_member(member_name), logic)
|
||||
|
@ -82,6 +82,9 @@ def get_console(console_id):
|
||||
namespace["__builtins__"] = sys.modules["builtins"]
|
||||
namespace["bpy"] = bpy
|
||||
namespace["C"] = bpy.context
|
||||
|
||||
namespace.update(__import__("mathutils").__dict__) # from mathutils import *
|
||||
namespace.update(__import__("math").__dict__) # from math import *
|
||||
|
||||
console = InteractiveConsole(locals=namespace, filename="<blender_console>")
|
||||
|
||||
@ -183,9 +186,15 @@ def execute(context):
|
||||
|
||||
# restore the stdin
|
||||
sys.stdin = stdin_backup
|
||||
|
||||
# execute any hooks
|
||||
for func, args in execute.hooks:
|
||||
func(*args)
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
execute.hooks = []
|
||||
|
||||
|
||||
def autocomplete(context):
|
||||
from console import intellisense
|
||||
@ -256,13 +265,14 @@ def banner(context):
|
||||
version_string = sys.version.strip().replace('\n', ' ')
|
||||
|
||||
add_scrollback(" * Python Interactive Console %s *" % version_string, 'OUTPUT')
|
||||
add_scrollback("Command History: Up/Down Arrow", 'OUTPUT')
|
||||
add_scrollback("Cursor: Left/Right Home/End", 'OUTPUT')
|
||||
add_scrollback("Remove: Backspace/Delete", 'OUTPUT')
|
||||
add_scrollback("Execute: Enter", 'OUTPUT')
|
||||
add_scrollback("Autocomplete: Ctrl+Space", 'OUTPUT')
|
||||
add_scrollback("Ctrl +/- Wheel: Zoom", 'OUTPUT')
|
||||
add_scrollback("Builtin Modules: bpy, bpy.data, bpy.ops, bpy.props, bpy.types, bpy.context, bgl, blf, mathutils", 'OUTPUT')
|
||||
add_scrollback("Command History: Up/Down Arrow", 'OUTPUT')
|
||||
add_scrollback("Cursor: Left/Right Home/End", 'OUTPUT')
|
||||
add_scrollback("Remove: Backspace/Delete", 'OUTPUT')
|
||||
add_scrollback("Execute: Enter", 'OUTPUT')
|
||||
add_scrollback("Autocomplete: Ctrl+Space", 'OUTPUT')
|
||||
add_scrollback("Ctrl +/- Wheel: Zoom", 'OUTPUT')
|
||||
add_scrollback("Builtin Modules: bpy, bpy.data, bpy.ops, bpy.props, bpy.types, bpy.context, bgl, blf, mathutils", 'OUTPUT')
|
||||
add_scrollback("Convenience Imports: from mathutils import *; from math import *", 'OUTPUT')
|
||||
add_scrollback("", 'OUTPUT')
|
||||
add_scrollback(" WARNING!!! Blender 2.5 API is subject to change, see API reference for more info.", 'ERROR')
|
||||
add_scrollback("", 'OUTPUT')
|
||||
|
@ -20,9 +20,9 @@
|
||||
|
||||
# To support reload properly, try to access a package var, if it's there, reload everything
|
||||
if "bpy" in locals():
|
||||
# only reload if we alredy loaded, highly annoying
|
||||
import sys
|
||||
reload(sys.modules.get("io_anim_bvh.import_bvh", sys))
|
||||
from imp import reload
|
||||
if "import_bvh" in locals():
|
||||
reload(import_bvh)
|
||||
|
||||
|
||||
import bpy
|
||||
@ -56,8 +56,8 @@ class BvhImporter(bpy.types.Operator, ImportHelper):
|
||||
default='NATIVE')
|
||||
|
||||
def execute(self, context):
|
||||
import io_anim_bvh.import_bvh
|
||||
return io_anim_bvh.import_bvh.load(self, context, **self.as_keywords(ignore=("filter_glob",)))
|
||||
from . import import_bvh
|
||||
return import_bvh.load(self, context, **self.as_keywords(ignore=("filter_glob",)))
|
||||
|
||||
|
||||
def menu_func(self, context):
|
||||
|
@ -18,8 +18,9 @@
|
||||
|
||||
# To support reload properly, try to access a package var, if it's there, reload everything
|
||||
if "bpy" in locals():
|
||||
import sys
|
||||
reload(sys.modules.get("io_mesh_ply.export_ply", sys))
|
||||
from imp import reload
|
||||
if "export_ply" in locals():
|
||||
reload(export_ply)
|
||||
|
||||
|
||||
import bpy
|
||||
@ -33,6 +34,7 @@ class ExportPLY(bpy.types.Operator, ExportHelper):
|
||||
bl_label = "Export PLY"
|
||||
|
||||
filename_ext = ".ply"
|
||||
filter_glob = StringProperty(default="*.ply", options={'HIDDEN'})
|
||||
|
||||
use_modifiers = BoolProperty(name="Apply Modifiers", description="Apply Modifiers to the exported mesh", default=True)
|
||||
use_normals = BoolProperty(name="Normals", description="Export Normals for smooth and hard shaded faces", default=True)
|
||||
@ -46,8 +48,8 @@ class ExportPLY(bpy.types.Operator, ExportHelper):
|
||||
def execute(self, context):
|
||||
filepath = self.filepath
|
||||
filepath = bpy.path.ensure_ext(filepath, self.filename_ext)
|
||||
import io_mesh_ply.export_ply
|
||||
return io_mesh_ply.export_ply.save(self, context, **self.as_keywords(ignore=("check_existing",)))
|
||||
from . import export_ply
|
||||
return export_ply.save(self, context, **self.as_keywords(ignore=("check_existing", "filter_glob")))
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
@ -20,9 +20,11 @@
|
||||
|
||||
# To support reload properly, try to access a package var, if it's there, reload everything
|
||||
if "bpy" in locals():
|
||||
import sys
|
||||
reload(sys.modules.get("io_scene_3ds.import_3ds", sys))
|
||||
reload(sys.modules.get("io_scene_3ds.export_3ds", sys))
|
||||
from imp import reload
|
||||
if "import_3ds" in locals():
|
||||
reload(import_3ds)
|
||||
if "export_3ds" in locals():
|
||||
reload(export_3ds)
|
||||
|
||||
|
||||
import bpy
|
||||
@ -43,8 +45,8 @@ class Import3DS(bpy.types.Operator, ImportHelper):
|
||||
use_apply_transform = BoolProperty(name="Apply Transform", description="Workaround for object transformations importing incorrectly", default=True)
|
||||
|
||||
def execute(self, context):
|
||||
import io_scene_3ds.import_3ds
|
||||
return io_scene_3ds.import_3ds.load(self, context, **self.as_keywords(ignore=("filter_glob",)))
|
||||
from . import import_3ds
|
||||
return import_3ds.load(self, context, **self.as_keywords(ignore=("filter_glob",)))
|
||||
|
||||
|
||||
class Export3DS(bpy.types.Operator, ExportHelper):
|
||||
@ -53,10 +55,11 @@ class Export3DS(bpy.types.Operator, ExportHelper):
|
||||
bl_label = 'Export 3DS'
|
||||
|
||||
filename_ext = ".3ds"
|
||||
filter_glob = StringProperty(default="*.3ds", options={'HIDDEN'})
|
||||
|
||||
def execute(self, context):
|
||||
import io_scene_3ds.export_3ds
|
||||
return io_scene_3ds.export_3ds.save(self, context, **self.as_keywords(ignore=("check_existing",)))
|
||||
from . import export_3ds
|
||||
return export_3ds.save(self, context, **self.as_keywords(ignore=("check_existing", "filter_glob")))
|
||||
|
||||
|
||||
# Add to a menu
|
||||
|
@ -19,7 +19,7 @@
|
||||
# <pep8 compliant>
|
||||
|
||||
# Script copyright (C) Bob Holcomb
|
||||
# Contributors: Bob Holcomb, Richard L?rk?ng, Damien McGinnes, Campbell Barton, Mario Lapin
|
||||
# Contributors: Bob Holcomb, Richard L?rk?ng, Damien McGinnes, Campbell Barton, Mario Lapin, Dominique Lorre
|
||||
|
||||
import os
|
||||
import time
|
||||
@ -109,8 +109,43 @@ OBJECT_MATERIAL = 0x4130 # This is found if the object has a material, ei
|
||||
OBJECT_UV = 0x4140 # The UV texture coordinates
|
||||
OBJECT_TRANS_MATRIX = 0x4160 # The Object Matrix
|
||||
|
||||
#>------ sub defines of EDITKEYFRAME
|
||||
# ED_KEY_AMBIENT_NODE = 0xB001
|
||||
ED_KEY_OBJECT_NODE = 0xB002
|
||||
# ED_KEY_CAMERA_NODE = 0xB003
|
||||
# ED_KEY_TARGET_NODE = 0xB004
|
||||
# ED_KEY_LIGHT_NODE = 0xB005
|
||||
# ED_KEY_L_TARGET_NODE = 0xB006
|
||||
# ED_KEY_SPOTLIGHT_NODE = 0xB007
|
||||
#>------ sub defines of ED_KEY_OBJECT_NODE
|
||||
# EK_OB_KEYFRAME_SEG = 0xB008
|
||||
# EK_OB_KEYFRAME_CURTIME = 0xB009
|
||||
# EK_OB_KEYFRAME_HEADER = 0xB00A
|
||||
EK_OB_NODE_HEADER = 0xB010
|
||||
EK_OB_INSTANCE_NAME = 0xB011
|
||||
# EK_OB_PRESCALE = 0xB012
|
||||
# EK_OB_PIVOT = 0xB013
|
||||
# EK_OB_BOUNDBOX = 0xB014
|
||||
# EK_OB_MORPH_SMOOTH = 0xB015
|
||||
EK_OB_POSITION_TRACK = 0xB020
|
||||
EK_OB_ROTATION_TRACK = 0xB021
|
||||
EK_OB_SCALE_TRACK = 0xB022
|
||||
# EK_OB_CAMERA_FOV_TRACK = 0xB023
|
||||
# EK_OB_CAMERA_ROLL_TRACK = 0xB024
|
||||
# EK_OB_COLOR_TRACK = 0xB025
|
||||
# EK_OB_MORPH_TRACK = 0xB026
|
||||
# EK_OB_HOTSPOT_TRACK = 0xB027
|
||||
# EK_OB_FALLOF_TRACK = 0xB028
|
||||
# EK_OB_HIDE_TRACK = 0xB029
|
||||
# EK_OB_NODE_ID = 0xB030
|
||||
|
||||
ROOT_OBJECT = 0xFFFF
|
||||
|
||||
global scn
|
||||
scn = None
|
||||
global object_dictionary # dictionary for object hierarchy
|
||||
object_dictionary = {}
|
||||
|
||||
|
||||
#the chunk class
|
||||
class chunk:
|
||||
@ -220,13 +255,17 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
|
||||
STRUCT_SIZE_1CHAR = struct.calcsize('c')
|
||||
STRUCT_SIZE_2FLOAT = struct.calcsize('2f')
|
||||
STRUCT_SIZE_3FLOAT = struct.calcsize('3f')
|
||||
STRUCT_SIZE_4FLOAT = struct.calcsize('4f')
|
||||
STRUCT_SIZE_UNSIGNED_SHORT = struct.calcsize('H')
|
||||
STRUCT_SIZE_4UNSIGNED_SHORT = struct.calcsize('4H')
|
||||
STRUCT_SIZE_4x3MAT = struct.calcsize('ffffffffffff')
|
||||
_STRUCT_SIZE_4x3MAT = struct.calcsize('fffffffffffff')
|
||||
# STRUCT_SIZE_4x3MAT = calcsize('ffffffffffff')
|
||||
# print STRUCT_SIZE_4x3MAT, ' STRUCT_SIZE_4x3MAT'
|
||||
|
||||
# only init once
|
||||
object_list = [] # for hierarchy
|
||||
object_parent = [] # index of parent in hierarchy, 0xFFFF = no parent
|
||||
|
||||
def putContextMesh(myContextMesh_vertls, myContextMesh_facels, myContextMeshMaterials):
|
||||
bmesh = bpy.data.meshes.new(contextObName)
|
||||
|
||||
@ -283,7 +322,8 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
|
||||
uf.uv3 = contextMeshUV[v3 * 2:(v3 * 2) + 2]
|
||||
# always a tri
|
||||
|
||||
ob = bpy.data.objects.new(tempName, bmesh)
|
||||
ob = bpy.data.objects.new(contextObName, bmesh)
|
||||
object_dictionary[contextObName] = ob
|
||||
SCN.objects.link(ob)
|
||||
|
||||
'''
|
||||
@ -292,7 +332,7 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
|
||||
'''
|
||||
|
||||
if contextMatrix_rot:
|
||||
ob.matrix_world = contextMatrix_rot
|
||||
ob.matrix_local = contextMatrix_rot
|
||||
|
||||
importedObjects.append(ob)
|
||||
bmesh.update()
|
||||
@ -382,8 +422,7 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
|
||||
#contextMatrix_tx = None
|
||||
|
||||
CreateBlenderObject = True
|
||||
tempName, read_str_len = read_string(file)
|
||||
contextObName = tempName
|
||||
contextObName, read_str_len = read_string(file)
|
||||
new_chunk.bytes_read += read_str_len
|
||||
|
||||
#is it a material chunk?
|
||||
@ -489,6 +528,7 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
|
||||
x,y,z = struct.unpack('<3f', temp_data)
|
||||
new_chunk.bytes_read += STRUCT_SIZE_3FLOAT
|
||||
|
||||
# no lamp in dict that would be confusing
|
||||
ob = bpy.data.objects.new("Lamp", bpy.data.lamps.new("Lamp"))
|
||||
SCN.objects.link(ob)
|
||||
|
||||
@ -588,9 +628,96 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
|
||||
# img = TEXTURE_DICT[contextMaterial.name]= BPyImage.comprehensiveImageLoad(texture_name, FILEPATH, PLACE_HOLDER=False, RECURSIVE=IMAGE_SEARCH)
|
||||
|
||||
new_chunk.bytes_read += read_str_len #plus one for the null character that gets removed
|
||||
elif new_chunk.ID == EDITKEYFRAME:
|
||||
pass
|
||||
|
||||
elif new_chunk.ID == ED_KEY_OBJECT_NODE: #another object is being processed
|
||||
child = None
|
||||
|
||||
elif new_chunk.ID == EK_OB_NODE_HEADER:
|
||||
object_name, read_str_len = read_string(file)
|
||||
new_chunk.bytes_read += read_str_len
|
||||
temp_data = file.read(STRUCT_SIZE_UNSIGNED_SHORT * 2)
|
||||
new_chunk.bytes_read += 4
|
||||
temp_data = file.read(STRUCT_SIZE_UNSIGNED_SHORT)
|
||||
hierarchy = struct.unpack('<H', temp_data)[0]
|
||||
new_chunk.bytes_read += 2
|
||||
|
||||
child = object_dictionary.get(object_name)
|
||||
|
||||
if child is None:
|
||||
child = bpy.data.objects.new(object_name, None) # create an empty object
|
||||
SCN.objects.link(child)
|
||||
|
||||
object_list.append(child)
|
||||
object_parent.append(hierarchy)
|
||||
|
||||
elif new_chunk.ID == EK_OB_INSTANCE_NAME:
|
||||
object_name, read_str_len = read_string(file)
|
||||
child.name = object_name
|
||||
object_dictionary[object_name] = child
|
||||
new_chunk.bytes_read += read_str_len
|
||||
|
||||
elif new_chunk.ID == EK_OB_POSITION_TRACK: # translation
|
||||
new_chunk.bytes_read += STRUCT_SIZE_UNSIGNED_SHORT * 5
|
||||
temp_data = file.read(STRUCT_SIZE_UNSIGNED_SHORT * 5)
|
||||
temp_data = file.read(STRUCT_SIZE_UNSIGNED_SHORT)
|
||||
nkeys = struct.unpack('<H', temp_data)[0]
|
||||
temp_data = file.read(STRUCT_SIZE_UNSIGNED_SHORT)
|
||||
new_chunk.bytes_read += STRUCT_SIZE_UNSIGNED_SHORT * 2
|
||||
for i in range(nkeys):
|
||||
temp_data = file.read(STRUCT_SIZE_UNSIGNED_SHORT)
|
||||
nframe = struct.unpack('<H', temp_data)[0]
|
||||
new_chunk.bytes_read += STRUCT_SIZE_UNSIGNED_SHORT
|
||||
temp_data = file.read(STRUCT_SIZE_UNSIGNED_SHORT * 2)
|
||||
new_chunk.bytes_read += STRUCT_SIZE_UNSIGNED_SHORT * 2
|
||||
temp_data = file.read(STRUCT_SIZE_3FLOAT)
|
||||
loc = struct.unpack('<3f', temp_data)
|
||||
new_chunk.bytes_read += STRUCT_SIZE_3FLOAT
|
||||
if nframe == 0:
|
||||
child.location = loc
|
||||
|
||||
elif new_chunk.ID == EK_OB_ROTATION_TRACK: # rotation
|
||||
new_chunk.bytes_read += STRUCT_SIZE_UNSIGNED_SHORT * 5
|
||||
temp_data = file.read(STRUCT_SIZE_UNSIGNED_SHORT * 5)
|
||||
temp_data = file.read(STRUCT_SIZE_UNSIGNED_SHORT)
|
||||
nkeys = struct.unpack('<H', temp_data)[0]
|
||||
temp_data = file.read(STRUCT_SIZE_UNSIGNED_SHORT)
|
||||
new_chunk.bytes_read += STRUCT_SIZE_UNSIGNED_SHORT * 2
|
||||
for i in range(nkeys):
|
||||
temp_data = file.read(STRUCT_SIZE_UNSIGNED_SHORT)
|
||||
nframe = struct.unpack('<H', temp_data)[0]
|
||||
new_chunk.bytes_read += STRUCT_SIZE_UNSIGNED_SHORT
|
||||
temp_data = file.read(STRUCT_SIZE_UNSIGNED_SHORT * 2)
|
||||
new_chunk.bytes_read += STRUCT_SIZE_UNSIGNED_SHORT * 2
|
||||
temp_data = file.read(STRUCT_SIZE_4FLOAT)
|
||||
rad,axis_x,axis_y,axis_z = struct.unpack('<4f', temp_data)
|
||||
new_chunk.bytes_read += STRUCT_SIZE_4FLOAT
|
||||
if nframe == 0:
|
||||
child.rotation_euler = mathutils.Quaternion((axis_x, axis_y, axis_z), -rad).to_euler() # why negative?
|
||||
|
||||
elif new_chunk.ID == EK_OB_SCALE_TRACK: # translation
|
||||
new_chunk.bytes_read += STRUCT_SIZE_UNSIGNED_SHORT * 5
|
||||
temp_data = file.read(STRUCT_SIZE_UNSIGNED_SHORT * 5)
|
||||
temp_data = file.read(STRUCT_SIZE_UNSIGNED_SHORT)
|
||||
nkeys = struct.unpack('<H', temp_data)[0]
|
||||
temp_data = file.read(STRUCT_SIZE_UNSIGNED_SHORT)
|
||||
new_chunk.bytes_read += STRUCT_SIZE_UNSIGNED_SHORT * 2
|
||||
for i in range(nkeys):
|
||||
temp_data = file.read(STRUCT_SIZE_UNSIGNED_SHORT)
|
||||
nframe = struct.unpack('<H', temp_data)[0]
|
||||
new_chunk.bytes_read += STRUCT_SIZE_UNSIGNED_SHORT
|
||||
temp_data = file.read(STRUCT_SIZE_UNSIGNED_SHORT * 2)
|
||||
new_chunk.bytes_read += STRUCT_SIZE_UNSIGNED_SHORT * 2
|
||||
temp_data = file.read(STRUCT_SIZE_3FLOAT)
|
||||
sca = struct.unpack('<3f', temp_data)
|
||||
new_chunk.bytes_read += STRUCT_SIZE_3FLOAT
|
||||
if nframe == 0:
|
||||
child.scale = sca
|
||||
|
||||
else: #(new_chunk.ID!=VERSION or new_chunk.ID!=OBJECTINFO or new_chunk.ID!=OBJECT or new_chunk.ID!=MATERIAL):
|
||||
# print 'skipping to end of this chunk'
|
||||
#print("unknown chunk: "+hex(new_chunk.ID))
|
||||
buffer_size = new_chunk.length - new_chunk.bytes_read
|
||||
binary_format='%ic' % buffer_size
|
||||
temp_data = file.read(struct.calcsize(binary_format))
|
||||
@ -608,6 +735,16 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
|
||||
if CreateBlenderObject:
|
||||
putContextMesh(contextMesh_vertls, contextMesh_facels, contextMeshMaterials)
|
||||
|
||||
|
||||
# Assign parents to objects
|
||||
for ind, ob in enumerate(object_list):
|
||||
parent = object_parent[ind]
|
||||
if parent == ROOT_OBJECT:
|
||||
ob.parent = None
|
||||
else:
|
||||
ob.parent = object_list[parent]
|
||||
|
||||
|
||||
def load_3ds(filepath, context, IMPORT_CONSTRAIN_BOUNDS=10.0, IMAGE_SEARCH=True, APPLY_MATRIX=True):
|
||||
global SCN
|
||||
|
||||
@ -664,6 +801,9 @@ def load_3ds(filepath, context, IMPORT_CONSTRAIN_BOUNDS=10.0, IMAGE_SEARCH=True,
|
||||
|
||||
##IMAGE_SEARCH
|
||||
|
||||
# fixme, make unglobal, clear incase
|
||||
object_dictionary.clear()
|
||||
|
||||
scn = context.scene
|
||||
# scn = bpy.data.scenes.active
|
||||
SCN = scn
|
||||
@ -673,6 +813,8 @@ def load_3ds(filepath, context, IMPORT_CONSTRAIN_BOUNDS=10.0, IMAGE_SEARCH=True,
|
||||
importedObjects = [] # Fill this list with objects
|
||||
process_next_chunk(file, current_chunk, importedObjects, IMAGE_SEARCH)
|
||||
|
||||
# fixme, make unglobal
|
||||
object_dictionary.clear()
|
||||
|
||||
# Link the objects into this scene.
|
||||
# Layers = scn.Layers
|
||||
@ -683,7 +825,7 @@ def load_3ds(filepath, context, IMPORT_CONSTRAIN_BOUNDS=10.0, IMAGE_SEARCH=True,
|
||||
for ob in importedObjects:
|
||||
if ob.type == 'MESH':
|
||||
me = ob.data
|
||||
me.transform(ob.matrix_world.copy().invert())
|
||||
me.transform(ob.matrix_local.copy().invert())
|
||||
|
||||
# Done DUMMYVERT
|
||||
"""
|
||||
@ -740,7 +882,8 @@ def load_3ds(filepath, context, IMPORT_CONSTRAIN_BOUNDS=10.0, IMAGE_SEARCH=True,
|
||||
SCALE_MAT = mathutils.Matrix.Scale(SCALE, 4)
|
||||
|
||||
for ob in importedObjects:
|
||||
ob.matrix_world = ob.matrix_world * SCALE_MAT
|
||||
if ob.parent is None:
|
||||
ob.matrix_world = ob.matrix_world * SCALE_MAT
|
||||
|
||||
# Done constraining to bounds.
|
||||
|
||||
|
@ -20,9 +20,9 @@
|
||||
|
||||
# To support reload properly, try to access a package var, if it's there, reload everything
|
||||
if "bpy" in locals():
|
||||
# only reload if we alredy loaded, highly annoying
|
||||
import sys
|
||||
reload(sys.modules.get("io_scene_fbx.export_fbx", sys))
|
||||
from imp import reload
|
||||
if "export_fbx" in locals():
|
||||
reload(export_fbx)
|
||||
|
||||
|
||||
import bpy
|
||||
@ -36,6 +36,7 @@ class ExportFBX(bpy.types.Operator, ExportHelper):
|
||||
bl_label = "Export FBX"
|
||||
|
||||
filename_ext = ".fbx"
|
||||
filter_glob = StringProperty(default="*.fbx", options={'HIDDEN'})
|
||||
|
||||
# List of operator properties, the attributes will be assigned
|
||||
# to the class instance from the operator settings before calling.
|
||||
@ -86,7 +87,7 @@ class ExportFBX(bpy.types.Operator, ExportHelper):
|
||||
GLOBAL_MATRIX = mtx4_z90n * GLOBAL_MATRIX
|
||||
|
||||
import io_scene_fbx.export_fbx
|
||||
return io_scene_fbx.export_fbx.save(self, context, **self.as_keywords(ignore=("TX_XROT90", "TX_YROT90", "TX_ZROT90", "TX_SCALE", "check_existing")))
|
||||
return io_scene_fbx.export_fbx.save(self, context, **self.as_keywords(ignore=("TX_XROT90", "TX_YROT90", "TX_ZROT90", "TX_SCALE", "check_existing", "filter_glob")))
|
||||
|
||||
|
||||
def menu_func(self, context):
|
||||
|
@ -1207,8 +1207,10 @@ def save(operator, context, filepath="",
|
||||
fn_abs_dest = os.path.join(basepath, fn_strip)
|
||||
if not os.path.exists(fn_abs_dest):
|
||||
shutil.copy(fn, fn_abs_dest)
|
||||
else:
|
||||
elif bpy.path.is_subdir(fn, basepath):
|
||||
rel = os.path.relpath(fn, basepath)
|
||||
else:
|
||||
rel = fn
|
||||
|
||||
return (rel, fn_strip)
|
||||
|
||||
@ -2887,6 +2889,8 @@ Takes: {''')
|
||||
# # copy_images( basepath, [ tex[1] for tex in textures if tex[1] != None ])
|
||||
# bpy.util.copy_images( [ tex[1] for tex in textures if tex[1] != None ], basepath)
|
||||
|
||||
file.close()
|
||||
|
||||
print('export finished in %.4f sec.' % (time.clock() - start_time))
|
||||
return {'FINISHED'}
|
||||
|
||||
|
@ -20,10 +20,11 @@
|
||||
|
||||
# To support reload properly, try to access a package var, if it's there, reload everything
|
||||
if "bpy" in locals():
|
||||
# only reload if we alredy loaded, highly annoying
|
||||
import sys
|
||||
reload(sys.modules.get("io_scene_obj.import_obj", sys))
|
||||
reload(sys.modules.get("io_scene_obj.export_obj", sys))
|
||||
from imp import reload
|
||||
if "import_obj" in locals():
|
||||
reload(import_obj)
|
||||
if "export_obj" in locals():
|
||||
reload(export_obj)
|
||||
|
||||
|
||||
import bpy
|
||||
@ -55,8 +56,8 @@ class ImportOBJ(bpy.types.Operator, ImportHelper):
|
||||
|
||||
def execute(self, context):
|
||||
# print("Selected: " + context.active_object.name)
|
||||
import io_scene_obj.import_obj
|
||||
return io_scene_obj.import_obj.load(self, context, **self.as_keywords(ignore=("filter_glob",)))
|
||||
from . import import_obj
|
||||
return import_obj.load(self, context, **self.as_keywords(ignore=("filter_glob",)))
|
||||
|
||||
|
||||
class ExportOBJ(bpy.types.Operator, ExportHelper):
|
||||
@ -64,8 +65,9 @@ class ExportOBJ(bpy.types.Operator, ExportHelper):
|
||||
|
||||
bl_idname = "export_scene.obj"
|
||||
bl_label = 'Export OBJ'
|
||||
|
||||
|
||||
filename_ext = ".obj"
|
||||
filter_glob = StringProperty(default="*.obj;*.mtl", options={'HIDDEN'})
|
||||
|
||||
# List of operator properties, the attributes will be assigned
|
||||
# to the class instance from the operator settings before calling.
|
||||
@ -98,8 +100,8 @@ class ExportOBJ(bpy.types.Operator, ExportHelper):
|
||||
|
||||
|
||||
def execute(self, context):
|
||||
import io_scene_obj.export_obj
|
||||
return io_scene_obj.export_obj.save(self, context, **self.as_keywords(ignore=("check_existing",)))
|
||||
from . import export_obj
|
||||
return export_obj.save(self, context, **self.as_keywords(ignore=("check_existing", "filter_glob")))
|
||||
|
||||
|
||||
def menu_func_import(self, context):
|
||||
|
@ -611,7 +611,7 @@ def write_file(filepath, objects, scene,
|
||||
file.write('s off\n')
|
||||
contextSmooth = f_smooth
|
||||
|
||||
f_v_orig = [me_verts[v_idx] for v_idx in f.vertices]
|
||||
f_v_orig = [(vi, me_verts[v_idx]) for vi, v_idx in enumerate(f.vertices)]
|
||||
|
||||
if not EXPORT_TRI or len(f_v_orig) == 3:
|
||||
f_v_iter = (f_v_orig, )
|
||||
@ -625,7 +625,7 @@ def write_file(filepath, objects, scene,
|
||||
if faceuv:
|
||||
if EXPORT_NORMALS:
|
||||
if f_smooth: # Smoothed, use vertex normals
|
||||
for vi, v in enumerate(f_v):
|
||||
for vi, v in f_v:
|
||||
file.write( ' %d/%d/%d' % \
|
||||
(v.index + totverts,
|
||||
totuvco + uv_face_mapping[f_index][vi],
|
||||
@ -633,13 +633,13 @@ def write_file(filepath, objects, scene,
|
||||
|
||||
else: # No smoothing, face normals
|
||||
no = globalNormals[ veckey3d(f.normal) ]
|
||||
for vi, v in enumerate(f_v):
|
||||
for vi, v in f_v:
|
||||
file.write( ' %d/%d/%d' % \
|
||||
(v.index + totverts,
|
||||
totuvco + uv_face_mapping[f_index][vi],
|
||||
no) ) # vert, uv, normal
|
||||
else: # No Normals
|
||||
for vi, v in enumerate(f_v):
|
||||
for vi, v in f_v:
|
||||
file.write( ' %d/%d' % (\
|
||||
v.index + totverts,\
|
||||
totuvco + uv_face_mapping[f_index][vi])) # vert, uv
|
||||
@ -649,15 +649,15 @@ def write_file(filepath, objects, scene,
|
||||
else: # No UV's
|
||||
if EXPORT_NORMALS:
|
||||
if f_smooth: # Smoothed, use vertex normals
|
||||
for v in f_v:
|
||||
for vi, v in f_v:
|
||||
file.write( ' %d//%d' %
|
||||
(v.index + totverts, globalNormals[ veckey3d(v.normal) ]) )
|
||||
else: # No smoothing, face normals
|
||||
no = globalNormals[ veckey3d(f.normal) ]
|
||||
for v in f_v:
|
||||
for vi, v in f_v:
|
||||
file.write( ' %d//%d' % (v.index + totverts, no) )
|
||||
else: # No Normals
|
||||
for v in f_v:
|
||||
for vi, v in f_v:
|
||||
file.write( ' %d' % (v.index + totverts) )
|
||||
|
||||
file.write('\n')
|
||||
|
@ -18,9 +18,9 @@
|
||||
|
||||
# To support reload properly, try to access a package var, if it's there, reload everything
|
||||
if "bpy" in locals():
|
||||
# only reload if we alredy loaded, highly annoying
|
||||
import sys
|
||||
reload(sys.modules.get("io_scene_x3d.export_x3d", sys))
|
||||
from imp import reload
|
||||
if "export_x3d" in locals():
|
||||
reload(export_x3d)
|
||||
|
||||
|
||||
import bpy
|
||||
@ -34,14 +34,15 @@ class ExportX3D(bpy.types.Operator, ExportHelper):
|
||||
bl_label = 'Export X3D'
|
||||
|
||||
filename_ext = ".x3d"
|
||||
filter_glob = StringProperty(default="*.x3d", options={'HIDDEN'})
|
||||
|
||||
use_apply_modifiers = BoolProperty(name="Apply Modifiers", description="Use transformed mesh data from each object", default=True)
|
||||
use_triangulate = BoolProperty(name="Triangulate", description="Triangulate quads.", default=False)
|
||||
use_compress = BoolProperty(name="Compress", description="GZip the resulting file, requires a full python install", default=False)
|
||||
|
||||
def execute(self, context):
|
||||
import io_scene_x3d.export_x3d
|
||||
return io_scene_x3d.export_x3d.save(self, context, **self.as_keywords(ignore=("check_existing",)))
|
||||
from . import export_x3d
|
||||
return export_x3d.save(self, context, **self.as_keywords(ignore=("check_existing", "filter_glob")))
|
||||
|
||||
|
||||
def menu_func(self, context):
|
||||
|
@ -20,10 +20,11 @@
|
||||
|
||||
# To support reload properly, try to access a package var, if it's there, reload everything
|
||||
if "bpy" in locals():
|
||||
# only reload if we alredy loaded, highly annoying
|
||||
import sys
|
||||
reload(sys.modules.get("io_shape_mdd.import_mdd", sys))
|
||||
reload(sys.modules.get("io_shape_mdd.export_mdd", sys))
|
||||
from imp import reload
|
||||
if "import_mdd" in locals():
|
||||
reload(import_mdd)
|
||||
if "export_mdd" in locals():
|
||||
reload(export_mdd)
|
||||
|
||||
|
||||
import bpy
|
||||
@ -53,9 +54,9 @@ class ImportMDD(bpy.types.Operator, ImportHelper):
|
||||
scene = context.scene
|
||||
if not self.frame_start:
|
||||
self.frame_start = scene.frame_current
|
||||
|
||||
import io_shape_mdd.import_mdd
|
||||
return io_shape_mdd.import_mdd.load(self, context, **self.as_keywords(ignore=("filter_glob",)))
|
||||
|
||||
from . import import_mdd
|
||||
return import_mdd.load(self, context, **self.as_keywords(ignore=("filter_glob",)))
|
||||
|
||||
class ExportMDD(bpy.types.Operator, ExportHelper):
|
||||
'''Animated mesh to MDD vertex keyframe file'''
|
||||
@ -63,6 +64,7 @@ class ExportMDD(bpy.types.Operator, ExportHelper):
|
||||
bl_label = "Export MDD"
|
||||
|
||||
filename_ext = ".mdd"
|
||||
filter_glob = StringProperty(default="*.mdd", options={'HIDDEN'})
|
||||
|
||||
# get first scene to get min and max properties for frames, fps
|
||||
|
||||
@ -92,8 +94,8 @@ class ExportMDD(bpy.types.Operator, ExportHelper):
|
||||
if not self.fps:
|
||||
self.fps = scene.render.fps
|
||||
|
||||
import io_shape_mdd.export_mdd
|
||||
return io_shape_mdd.export_mdd.save(self, context, **self.as_keywords(ignore=("check_existing",)))
|
||||
from . import export_mdd
|
||||
return export_mdd.save(self, context, **self.as_keywords(ignore=("check_existing", "filter_glob")))
|
||||
|
||||
|
||||
def menu_func_import(self, context):
|
||||
|
@ -34,7 +34,7 @@ def align_objects(align_x, align_y, align_z, align_mode, relative_to):
|
||||
for obj in bpy.context.selected_objects:
|
||||
if obj.type == 'MESH':
|
||||
|
||||
bb_world = [obj.matrix_world * Vector(v[:]) for v in obj.bound_box]
|
||||
bb_world = [Vector(v[:]) * obj.matrix_world for v in obj.bound_box]
|
||||
|
||||
Left_Up_Front = bb_world[1]
|
||||
Right_Down_Back = bb_world[7]
|
||||
|
@ -776,16 +776,12 @@ def packIslands(islandList):
|
||||
|
||||
|
||||
|
||||
def VectoMat(vec):
|
||||
a3 = vec.__copy__().normalize()
|
||||
|
||||
up = Vector((0.0, 0.0, 1.0))
|
||||
if abs(a3.dot(up)) == 1.0:
|
||||
up = Vector((0.0, 1.0, 0.0))
|
||||
|
||||
a1 = a3.cross(up).normalize()
|
||||
a2 = a3.cross(a1)
|
||||
return Matrix([a1[0], a1[1], a1[2]], [a2[0], a2[1], a2[2]], [a3[0], a3[1], a3[2]])
|
||||
def VectoQuat(vec):
|
||||
vec = vec.copy().normalize()
|
||||
if abs(vec.x) > 0.5:
|
||||
return vec.to_track_quat('Z', 'X')
|
||||
else:
|
||||
return vec.to_track_quat('Z', 'Y')
|
||||
|
||||
|
||||
class thickface(object):
|
||||
@ -1048,14 +1044,14 @@ def main(context, island_margin, projection_limit):
|
||||
continue
|
||||
|
||||
# Make a projection matrix from a unit length vector.
|
||||
MatProj = VectoMat(projectVecs[i])
|
||||
MatQuat = VectoQuat(projectVecs[i])
|
||||
|
||||
# Get the faces UV's from the projected vertex.
|
||||
for f in faceProjectionGroupList[i]:
|
||||
f_uv = f.uv
|
||||
for j, v in enumerate(f.v):
|
||||
# XXX - note, between mathutils in 2.4 and 2.5 the order changed.
|
||||
f_uv[j][:] = (v.co * MatProj)[:2]
|
||||
f_uv[j][:] = (v.co * MatQuat)[:2]
|
||||
|
||||
|
||||
if USER_SHARE_SPACE:
|
||||
|
@ -268,8 +268,8 @@ class WM_OT_context_toggle_enum(bpy.types.Operator):
|
||||
|
||||
|
||||
class WM_OT_context_cycle_int(bpy.types.Operator):
|
||||
'''Set a context value. Useful for cycling active material,
|
||||
vertex keys, groups' etc.'''
|
||||
'''Set a context value. Useful for cycling active material, '''
|
||||
'''vertex keys, groups' etc.'''
|
||||
bl_idname = "wm.context_cycle_int"
|
||||
bl_label = "Context Int Cycle"
|
||||
bl_options = {'UNDO'}
|
||||
|
@ -1,63 +0,0 @@
|
||||
import bpy
|
||||
|
||||
def write_some_data(context, filepath, use_some_setting):
|
||||
print("running write_some_data...")
|
||||
pass
|
||||
|
||||
from bpy.props import *
|
||||
|
||||
class ExportSomeData(bpy.types.Operator):
|
||||
'''This appiers in the tooltip of the operator and in the generated docs.'''
|
||||
bl_idname = "export.some_data" # this is important since its how bpy.ops.export.some_data is constructed
|
||||
bl_label = "Export Some Data"
|
||||
|
||||
# List of operator properties, the attributes will be assigned
|
||||
# to the class instance from the operator settings before calling.
|
||||
|
||||
# TODO, add better example props
|
||||
filepath = StringProperty(name="File Path", description="File path used for exporting the PLY file", maxlen= 1024, default= "")
|
||||
use_setting = BoolProperty(name="Example Boolean", description="Example Tooltip", default= True)
|
||||
|
||||
type = bpy.props.EnumProperty(items=(('OPT_A', "First Option", "Description one"), ('OPT_B', "Second Option", "Description two.")),
|
||||
name="Example Enum",
|
||||
description="Choose between two items",
|
||||
default='OPT_A')
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return context.active_object != None
|
||||
|
||||
def execute(self, context):
|
||||
|
||||
# # Bug, currently isnt working
|
||||
#if not self.is_property_set("filepath"):
|
||||
# raise Exception("filename not set")
|
||||
|
||||
write_some_data(self.filepath, context, self.use_setting)
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
def invoke(self, context, event):
|
||||
wm = context.window_manager
|
||||
|
||||
if True:
|
||||
# File selector
|
||||
wm.add_fileselect(self) # will run self.execute()
|
||||
return {'RUNNING_MODAL'}
|
||||
elif True:
|
||||
# search the enum
|
||||
wm.invoke_search_popup(self)
|
||||
return {'RUNNING_MODAL'}
|
||||
elif False:
|
||||
# Redo popup
|
||||
return wm.invoke_props_popup(self, event) #
|
||||
elif False:
|
||||
return self.execute(context)
|
||||
|
||||
|
||||
# Only needed if you want to add into a dynamic menu
|
||||
menu_func = lambda self, context: self.layout.operator("export.some_data", text="Example Exporter...")
|
||||
bpy.types.INFO_MT_file_export.append(menu_func)
|
||||
|
||||
if __name__ == "__main__":
|
||||
bpy.ops.export.some_data('INVOKE_DEFAULT', filepath="/tmp/test.ply")
|
53
release/scripts/templates/operator_export.py
Normal file
53
release/scripts/templates/operator_export.py
Normal file
@ -0,0 +1,53 @@
|
||||
import bpy
|
||||
|
||||
def write_some_data(context, filepath, use_some_setting):
|
||||
print("running write_some_data...")
|
||||
f = open(filepath, 'w')
|
||||
f.write("Hello World %s" % use_some_setting)
|
||||
f.close()
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
# ExportHelper is a helper class, defines filename and
|
||||
# invoke() function which calls the file selector.
|
||||
from io_utils import ExportHelper
|
||||
|
||||
from bpy.props import *
|
||||
|
||||
|
||||
class ExportSomeData(bpy.types.Operator, ExportHelper):
|
||||
'''This appiers in the tooltip of the operator and in the generated docs.'''
|
||||
bl_idname = "export.some_data" # this is important since its how bpy.ops.export.some_data is constructed
|
||||
bl_label = "Export Some Data"
|
||||
|
||||
# ExportHelper mixin class uses this
|
||||
filename_ext = ".txt"
|
||||
|
||||
filter_glob = StringProperty(default="*.txt", options={'HIDDEN'})
|
||||
|
||||
# List of operator properties, the attributes will be assigned
|
||||
# to the class instance from the operator settings before calling.
|
||||
use_setting = BoolProperty(name="Example Boolean", description="Example Tooltip", default= True)
|
||||
|
||||
type = bpy.props.EnumProperty(items=(('OPT_A', "First Option", "Description one"), ('OPT_B', "Second Option", "Description two.")),
|
||||
name="Example Enum",
|
||||
description="Choose between two items",
|
||||
default='OPT_A')
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return context.active_object != None
|
||||
|
||||
def execute(self, context):
|
||||
return write_some_data(context, self.filepath, self.use_setting)
|
||||
|
||||
|
||||
# Only needed if you want to add into a dynamic menu
|
||||
def menu_func_export(self, context):
|
||||
self.layout.operator(ExportSomeData.bl_idname, text="Text Export Operator")
|
||||
|
||||
bpy.types.INFO_MT_file_export.append(menu_func_export)
|
||||
|
||||
if __name__ == "__main__":
|
||||
bpy.ops.export.some_data('INVOKE_DEFAULT')
|
@ -11,6 +11,8 @@ def main(context):
|
||||
|
||||
if not mesh.uv_textures:
|
||||
uvtex = bpy.ops.mesh.uv_texture_add()
|
||||
else:
|
||||
uvtex = mesh.uv_textures.active
|
||||
|
||||
# adjust UVs
|
||||
for i, uv in enumerate(uvtex.data):
|
||||
|
@ -52,25 +52,23 @@ class DATA_PT_modifiers(ModifierButtonsPanel, bpy.types.Panel):
|
||||
col = split.column()
|
||||
col.label(text="Object:")
|
||||
col.prop(md, "object", text="")
|
||||
|
||||
col = split.column()
|
||||
col.label(text="Vertex Group::")
|
||||
col.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
|
||||
sub = col.column()
|
||||
sub.active = bool(md.vertex_group)
|
||||
sub.prop(md, "invert_vertex_group")
|
||||
|
||||
split = layout.split()
|
||||
col.prop(md, "use_deform_preserve_volume")
|
||||
|
||||
col = split.column()
|
||||
col.label(text="Bind To:")
|
||||
col.prop(md, "use_vertex_groups", text="Vertex Groups")
|
||||
col.prop(md, "use_bone_envelopes", text="Bone Envelopes")
|
||||
|
||||
split = layout.split()
|
||||
|
||||
col = split.column()
|
||||
col.label(text="Deformation:")
|
||||
col.prop(md, "use_deform_preserve_volume")
|
||||
col.prop(md, "use_multi_modifier")
|
||||
col = col.split()
|
||||
col.active = md.use_multi_modifier
|
||||
col.prop_search(md, "vertex_group_multi_modifier", ob, "vertex_groups", text="")
|
||||
sub = col.column()
|
||||
sub.active = bool(md.vertex_group_multi_modifier)
|
||||
sub.prop(md, "invert_vertex_group_multi_modifier")
|
||||
|
||||
def ARRAY(self, layout, ob, md):
|
||||
layout.prop(md, "fit_type")
|
||||
|
@ -622,9 +622,8 @@ class MATERIAL_PT_strand(MaterialButtonsPanel, bpy.types.Panel):
|
||||
col.separator()
|
||||
sub = col.column()
|
||||
sub.active = (not mat.use_shadeless)
|
||||
sub.prop(tan, "use_surface_diffuse")
|
||||
sub.label("Surface diffuse:")
|
||||
sub = col.column()
|
||||
sub.active = tan.use_surface_diffuse
|
||||
sub.prop(tan, "blend_distance", text="Distance")
|
||||
|
||||
|
||||
|
@ -550,9 +550,39 @@ class ConstraintButtonsPanel():
|
||||
col.prop(con, "axis_x", text="X")
|
||||
col.prop(con, "axis_y", text="Y")
|
||||
col.prop(con, "axis_z", text="Z")
|
||||
|
||||
|
||||
#Missing: Limit arrays (not wrapped in RNA yet)
|
||||
if con.pivot_type == 'CONE_TWIST':
|
||||
layout.label(text="Limits:")
|
||||
split = layout.split()
|
||||
|
||||
col = split.column(align=True)
|
||||
col.prop(con, "use_angular_limit_x", text="Angular X")
|
||||
col.prop(con, "use_angular_limit_y", text="Angular Y")
|
||||
col.prop(con, "use_angular_limit_z", text="Angular Z")
|
||||
|
||||
col = split.column()
|
||||
col.prop(con, "limit_cone_min", text="")
|
||||
col = split.column()
|
||||
col.prop(con, "limit_cone_max", text="")
|
||||
|
||||
elif con.pivot_type == 'GENERIC_6_DOF':
|
||||
layout.label(text="Limits:")
|
||||
split = layout.split()
|
||||
|
||||
col = split.column(align=True)
|
||||
col.prop(con, "use_limit_x", text="X")
|
||||
col.prop(con, "use_limit_y", text="Y")
|
||||
col.prop(con, "use_limit_z", text="Z")
|
||||
col.prop(con, "use_angular_limit_x", text="Angular X")
|
||||
col.prop(con, "use_angular_limit_y", text="Angular Y")
|
||||
col.prop(con, "use_angular_limit_z", text="Angular Z")
|
||||
|
||||
col = split.column()
|
||||
col.prop(con, "limit_generic_min", text="")
|
||||
col = split.column()
|
||||
col.prop(con, "limit_generic_max", text="")
|
||||
|
||||
def CLAMP_TO(self, context, layout, con):
|
||||
self.target_template(layout, con)
|
||||
|
||||
|
@ -102,7 +102,9 @@ class PARTICLE_PT_context_particles(ParticleButtonsPanel, bpy.types.Panel):
|
||||
col = split.column()
|
||||
col.prop(psys, "name", text="")
|
||||
if part.type in ('EMITTER', 'REACTOR', 'HAIR'):
|
||||
col.template_ID(psys, "settings", new="particle.new")
|
||||
row = col.row()
|
||||
row.enabled = particle_panel_enabled(context, psys)
|
||||
row.template_ID(psys, "settings", new="particle.new")
|
||||
|
||||
#row = layout.row()
|
||||
#row.label(text="Viewport")
|
||||
|
@ -80,7 +80,7 @@ class PHYSICS_PT_smoke(PhysicButtonsPanel, bpy.types.Panel):
|
||||
col = split.column()
|
||||
col.label(text="Behavior:")
|
||||
col.prop(domain, "alpha")
|
||||
col.prop(domain, "beta")
|
||||
col.prop(domain, "beta", text="Temp. Diff.")
|
||||
col.prop(domain, "vorticity")
|
||||
col.prop(domain, "use_dissolve_smoke", text="Dissolve")
|
||||
sub = col.column()
|
||||
@ -109,10 +109,10 @@ class PHYSICS_PT_smoke(PhysicButtonsPanel, bpy.types.Panel):
|
||||
|
||||
sub = split.column()
|
||||
sub.active = not md.flow_settings.use_outflow
|
||||
sub.label(text="Behavior:")
|
||||
sub.prop(flow, "temperature")
|
||||
sub.prop(flow, "density")
|
||||
sub.label(text="Initial Values:")
|
||||
sub.prop(flow, "use_absolute")
|
||||
sub.prop(flow, "density")
|
||||
sub.prop(flow, "temperature")
|
||||
|
||||
#elif md.smoke_type == 'COLLISION':
|
||||
# layout.separator()
|
||||
|
@ -53,6 +53,7 @@ class SCENE_PT_unit(SceneButtonsPanel, bpy.types.Panel):
|
||||
|
||||
col = layout.column()
|
||||
col.row().prop(unit, "system", expand=True)
|
||||
col.row().prop(unit, "system_rotation", expand=True)
|
||||
|
||||
split = layout.split()
|
||||
split.active = (unit.system != 'NONE')
|
||||
@ -63,8 +64,6 @@ class SCENE_PT_unit(SceneButtonsPanel, bpy.types.Panel):
|
||||
col = split.column()
|
||||
col.prop(unit, "use_separate")
|
||||
|
||||
layout.column().prop(unit, "rotation_units")
|
||||
|
||||
|
||||
class SCENE_PT_keying_sets(SceneButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Keying Sets"
|
||||
|
@ -384,6 +384,8 @@ class SEQUENCER_PT_edit(SequencerButtonsPanel, bpy.types.Panel):
|
||||
|
||||
col.label(text="Frame Offset %d:%d" % (strip.frame_offset_start, strip.frame_offset_end))
|
||||
col.label(text="Frame Still %d:%d" % (strip.frame_still_start, strip.frame_still_end))
|
||||
if strip.type in ('MOVIE', 'IMAGE'):
|
||||
col.label(text="Orig Dim: %dx%d" % (strip.orig_width, strip.orig_height))
|
||||
|
||||
|
||||
class SEQUENCER_PT_effect(SequencerButtonsPanel, bpy.types.Panel):
|
||||
@ -443,12 +445,14 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel, bpy.types.Panel):
|
||||
row.prop(strip, "use_only_boost")
|
||||
|
||||
elif strip.type == 'SPEED':
|
||||
layout.prop(strip, "use_as_speed")
|
||||
if strip.use_as_speed:
|
||||
layout.prop(strip, "speed_factor")
|
||||
else:
|
||||
layout.prop(strip, "speed_factor", text="Frame number")
|
||||
layout.prop(strip, "scale_to_length")
|
||||
layout.prop(strip, "use_default_fade", "Stretch to input strip length")
|
||||
if not strip.use_default_fade:
|
||||
layout.prop(strip, "use_as_speed")
|
||||
if strip.use_as_speed:
|
||||
layout.prop(strip, "speed_factor")
|
||||
else:
|
||||
layout.prop(strip, "speed_factor", text="Frame number")
|
||||
layout.prop(strip, "scale_to_length")
|
||||
|
||||
#doesn't work currently
|
||||
#layout.prop(strip, "use_frame_blend")
|
||||
@ -573,6 +577,7 @@ class SEQUENCER_PT_input(SequencerButtonsPanel, bpy.types.Panel):
|
||||
col = split.column()
|
||||
col.prop(strip, "filepath", text="")
|
||||
col.prop(strip, "mpeg_preseek", text="MPEG Preseek")
|
||||
|
||||
# TODO, sound???
|
||||
# end drawing filename
|
||||
|
||||
|
@ -156,6 +156,7 @@ class USERPREF_PT_interface(bpy.types.Panel):
|
||||
col = row.column()
|
||||
col.label(text="Display:")
|
||||
col.prop(view, "show_tooltips")
|
||||
col.prop(view, "show_tooltips_python")
|
||||
col.prop(view, "show_object_info", text="Object Info")
|
||||
col.prop(view, "show_large_cursors")
|
||||
col.prop(view, "show_view_name", text="View Name")
|
||||
@ -435,6 +436,8 @@ class USERPREF_PT_system(bpy.types.Panel):
|
||||
#col.prop(system, "use_antialiasing")
|
||||
col.label(text="Window Draw Method:")
|
||||
col.prop(system, "window_draw_method", text="")
|
||||
col.label(text="Text Draw Options:")
|
||||
col.prop(system, "use_text_antialiasing")
|
||||
col.label(text="Textures:")
|
||||
col.prop(system, "gl_texture_limit", text="Limit Size")
|
||||
col.prop(system, "texture_time_out", text="Time Out")
|
||||
@ -861,9 +864,10 @@ class USERPREF_PT_addons(bpy.types.Panel):
|
||||
print("fake_module", mod_name, mod_path)
|
||||
import ast
|
||||
ModuleType = type(ast)
|
||||
file_mod = open(mod_path, "r", encoding='UTF-8')
|
||||
if speedy:
|
||||
lines = []
|
||||
line_iter = iter(open(mod_path, "r", encoding='UTF-8'))
|
||||
line_iter = iter(file_mod)
|
||||
l = ""
|
||||
while not l.startswith("bl_addon_info"):
|
||||
l = line_iter.readline()
|
||||
@ -872,11 +876,12 @@ class USERPREF_PT_addons(bpy.types.Panel):
|
||||
while l.rstrip():
|
||||
lines.append(l)
|
||||
l = line_iter.readline()
|
||||
del line_iter
|
||||
data = "".join(lines)
|
||||
|
||||
else:
|
||||
data = open(mod_path, "r").read()
|
||||
data = file_mod.read()
|
||||
|
||||
file_mod.close()
|
||||
|
||||
ast_data = ast.parse(data, filename=mod_path)
|
||||
body_info = None
|
||||
|
@ -1439,13 +1439,16 @@ class VIEW3D_OT_edit_mesh_extrude_individual_move(bpy.types.Operator):
|
||||
totvert = mesh.total_vert_sel
|
||||
|
||||
if select_mode[2] and totface == 1:
|
||||
return bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', TRANSFORM_OT_translate={"constraint_orientation": "NORMAL", "constraint_axis": [False, False, True]})
|
||||
bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', TRANSFORM_OT_translate={"constraint_orientation": 'NORMAL', "constraint_axis": (False, False, True)})
|
||||
elif select_mode[2] and totface > 1:
|
||||
return bpy.ops.mesh.extrude_faces_move('INVOKE_REGION_WIN')
|
||||
bpy.ops.mesh.extrude_faces_move('INVOKE_REGION_WIN')
|
||||
elif select_mode[1] and totedge >= 1:
|
||||
return bpy.ops.mesh.extrude_edges_move('INVOKE_REGION_WIN')
|
||||
bpy.ops.mesh.extrude_edges_move('INVOKE_REGION_WIN')
|
||||
else:
|
||||
return bpy.ops.mesh.extrude_vertices_move('INVOKE_REGION_WIN')
|
||||
bpy.ops.mesh.extrude_vertices_move('INVOKE_REGION_WIN')
|
||||
|
||||
# ignore return from operators above because they are 'RUNNING_MODAL', and cause this one not to be freed. [#24671]
|
||||
return {'FINISHED'}
|
||||
|
||||
def invoke(self, context, event):
|
||||
return self.execute(context)
|
||||
@ -1464,11 +1467,14 @@ class VIEW3D_OT_edit_mesh_extrude_move(bpy.types.Operator):
|
||||
totvert = mesh.total_vert_sel
|
||||
|
||||
if totface >= 1:
|
||||
return bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', TRANSFORM_OT_translate={"constraint_orientation": "NORMAL", "constraint_axis": [False, False, True]})
|
||||
bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', TRANSFORM_OT_translate={"constraint_orientation": 'NORMAL', "constraint_axis": (False, False, True)})
|
||||
elif totedge == 1:
|
||||
return bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', TRANSFORM_OT_translate={"constraint_orientation": "NORMAL", "constraint_axis": [True, True, False]})
|
||||
bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', TRANSFORM_OT_translate={"constraint_orientation": 'NORMAL', "constraint_axis": (True, True, False)})
|
||||
else:
|
||||
return bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN')
|
||||
bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN')
|
||||
|
||||
# ignore return from operators above because they are 'RUNNING_MODAL', and cause this one not to be freed. [#24671]
|
||||
return {'FINISHED'}
|
||||
|
||||
def invoke(self, context, event):
|
||||
return self.execute(context)
|
||||
@ -1708,7 +1714,7 @@ class VIEW3D_MT_edit_surface(bpy.types.Menu):
|
||||
draw = draw_curve
|
||||
|
||||
|
||||
class VIEW3D_MT_edit_text(bpy.types.Menu):
|
||||
class VIEW3D_MT_edit_font(bpy.types.Menu):
|
||||
bl_label = "Text"
|
||||
|
||||
def draw(self, context):
|
||||
@ -2007,7 +2013,8 @@ class VIEW3D_PT_view3d_display(bpy.types.Panel):
|
||||
layout = self.layout
|
||||
|
||||
view = context.space_data
|
||||
gs = context.scene.game_settings
|
||||
scene = context.scene
|
||||
gs = scene.game_settings
|
||||
ob = context.object
|
||||
|
||||
col = layout.column()
|
||||
@ -2036,8 +2043,10 @@ class VIEW3D_PT_view3d_display(bpy.types.Panel):
|
||||
sub = col.column(align=True)
|
||||
sub.active = (display_all and view.show_floor)
|
||||
sub.prop(view, "grid_lines", text="Lines")
|
||||
sub.prop(view, "grid_spacing", text="Spacing")
|
||||
sub.prop(view, "grid_subdivisions", text="Subdivisions")
|
||||
sub.prop(view, "grid_scale", text="Scale")
|
||||
subsub = sub.column(align=True)
|
||||
subsub.active = scene.unit_settings.system == 'NONE'
|
||||
subsub.prop(view, "grid_subdivisions", text="Subdivisions")
|
||||
|
||||
col = layout.column()
|
||||
col.label(text="Shading:")
|
||||
|
@ -1159,7 +1159,7 @@ class VIEW3D_PT_tools_projectpaint(View3DPanel, bpy.types.Panel):
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
brush = context.tool_settings.image_paint.brush
|
||||
return (brush and brush.imagepaint_tool != 'SMEAR')
|
||||
return (brush and brush.imagepaint_tool != 'SOFTEN')
|
||||
|
||||
def draw_header(self, context):
|
||||
ipaint = context.tool_settings.image_paint
|
||||
|
@ -232,7 +232,7 @@ typedef enum {
|
||||
/**
|
||||
* Test whether this is an avi-format.
|
||||
*/
|
||||
int AVI_is_avi (char *name);
|
||||
int AVI_is_avi (const char *name);
|
||||
|
||||
|
||||
/**
|
||||
@ -277,7 +277,7 @@ int AVI_get_stream (AviMovie *movie, int avist_type, int stream_num);
|
||||
/**
|
||||
* Open a movie stream from file.
|
||||
*/
|
||||
AviError AVI_open_movie (char *name, AviMovie *movie);
|
||||
AviError AVI_open_movie (const char *name, AviMovie *movie);
|
||||
|
||||
/**
|
||||
* Read a frame from a movie stream.
|
||||
|
@ -211,17 +211,15 @@ int AVI_is_avi (char *name) {
|
||||
}
|
||||
*/
|
||||
|
||||
int AVI_is_avi (char *name) {
|
||||
int AVI_is_avi (const char *name) {
|
||||
int temp, fcca, j;
|
||||
AviMovie movie;
|
||||
AviMovie movie= {0};
|
||||
AviMainHeader header;
|
||||
AviBitmapInfoHeader bheader;
|
||||
int movie_tracks = 0;
|
||||
|
||||
DEBUG_PRINT("opening movie\n");
|
||||
|
||||
memset(&movie, 0, sizeof(AviMovie));
|
||||
|
||||
movie.type = AVI_MOVIE_READ;
|
||||
movie.fp = fopen (name, "rb");
|
||||
movie.offset_table = NULL;
|
||||
@ -404,7 +402,7 @@ int AVI_is_avi (char *name) {
|
||||
|
||||
}
|
||||
|
||||
AviError AVI_open_movie (char *name, AviMovie *movie) {
|
||||
AviError AVI_open_movie (const char *name, AviMovie *movie) {
|
||||
int temp, fcca, size, j;
|
||||
|
||||
DEBUG_PRINT("opening movie\n");
|
||||
|
@ -34,6 +34,8 @@ struct rctf;
|
||||
int BLF_init(int points, int dpi);
|
||||
void BLF_exit(void);
|
||||
|
||||
void BLF_cache_clear(void);
|
||||
|
||||
int BLF_load(const char *name);
|
||||
int BLF_load_mem(const char *name, unsigned char *mem, int mem_size);
|
||||
|
||||
@ -179,4 +181,8 @@ void BLF_dir_free(char **dirs, int count);
|
||||
#define BLF_SHADOW (1<<2)
|
||||
#define BLF_KERNING_DEFAULT (1<<3)
|
||||
|
||||
// XXX, bad design
|
||||
extern int blf_mono_font;
|
||||
extern int blf_mono_font_render; // dont mess drawing with render threads.
|
||||
|
||||
#endif /* BLF_API_H */
|
||||
|
@ -47,9 +47,9 @@ IF(WITH_INTERNATIONAL)
|
||||
ADD_DEFINITIONS(-DINTERNATIONAL)
|
||||
ENDIF(WITH_INTERNATIONAL)
|
||||
|
||||
IF(WIN32)
|
||||
ADD_DEFINITIONS(-D_WIN32 -DUSE_GETTEXT_DLL)
|
||||
ENDIF(WIN32)
|
||||
IF(WIN32 AND NOT UNIX)
|
||||
ADD_DEFINITIONS(-DUSE_GETTEXT_DLL)
|
||||
ENDIF(WIN32 AND NOT UNIX)
|
||||
|
||||
BLENDERLIB(bf_blenfont "${SRC}" "${INC}")
|
||||
|
||||
|
@ -66,6 +66,10 @@ int global_font_default= -1;
|
||||
int global_font_points= 11;
|
||||
int global_font_dpi= 72;
|
||||
|
||||
// XXX, should these be made into global_font_'s too?
|
||||
int blf_mono_font= -1;
|
||||
int blf_mono_font_render= -1;
|
||||
|
||||
static FontBLF *BLF_get(int fontid)
|
||||
{
|
||||
if (fontid >= 0 && fontid < BLF_MAX_FONT)
|
||||
@ -99,6 +103,18 @@ void BLF_exit(void)
|
||||
blf_font_exit();
|
||||
}
|
||||
|
||||
void BLF_cache_clear(void)
|
||||
{
|
||||
FontBLF *font;
|
||||
int i;
|
||||
|
||||
for (i= 0; i < global_font_num; i++) {
|
||||
font= global_font[i];
|
||||
if (font)
|
||||
blf_glyph_cache_clear(font);
|
||||
}
|
||||
}
|
||||
|
||||
static int blf_search(const char *name)
|
||||
{
|
||||
FontBLF *font;
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "DNA_vec_types.h"
|
||||
#include "DNA_userdef_types.h"
|
||||
|
||||
#include "BLI_blenlib.h"
|
||||
|
||||
@ -115,6 +116,23 @@ GlyphCacheBLF *blf_glyph_cache_new(FontBLF *font)
|
||||
return(gc);
|
||||
}
|
||||
|
||||
void blf_glyph_cache_clear(FontBLF *font)
|
||||
{
|
||||
GlyphCacheBLF *gc;
|
||||
GlyphBLF *g;
|
||||
int i;
|
||||
|
||||
for(gc=font->cache.first; gc; gc=gc->next) {
|
||||
for (i= 0; i < 257; i++) {
|
||||
while (gc->bucket[i].first) {
|
||||
g= gc->bucket[i].first;
|
||||
BLI_remlink(&(gc->bucket[i]), g);
|
||||
blf_glyph_free(g);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void blf_glyph_cache_free(GlyphCacheBLF *gc)
|
||||
{
|
||||
GlyphBLF *g;
|
||||
@ -193,12 +211,10 @@ GlyphBLF *blf_glyph_add(FontBLF *font, FT_UInt index, unsigned int c)
|
||||
GlyphBLF *g;
|
||||
FT_Error err;
|
||||
FT_Bitmap bitmap, tempbitmap;
|
||||
int sharp;
|
||||
int sharp = (U.text_render & USER_TEXT_DISABLE_AA);
|
||||
FT_BBox bbox;
|
||||
unsigned int key;
|
||||
|
||||
sharp = 0; /* TODO make the value be configurable somehow */
|
||||
|
||||
g= blf_glyph_search(font->glyph_cache, c);
|
||||
if (g)
|
||||
return(g);
|
||||
|
@ -56,6 +56,7 @@ void blf_font_free(FontBLF *font);
|
||||
|
||||
GlyphCacheBLF *blf_glyph_cache_find(FontBLF *font, int size, int dpi);
|
||||
GlyphCacheBLF *blf_glyph_cache_new(FontBLF *font);
|
||||
void blf_glyph_cache_clear(FontBLF *font);
|
||||
void blf_glyph_cache_free(GlyphCacheBLF *gc);
|
||||
|
||||
GlyphBLF *blf_glyph_search(GlyphCacheBLF *gc, unsigned int c);
|
||||
|
@ -73,7 +73,7 @@ typedef struct PoseTree
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct bArmature *add_armature(char *name);
|
||||
struct bArmature *add_armature(const char *name);
|
||||
struct bArmature *get_armature(struct Object *ob);
|
||||
void free_bonelist (struct ListBase *lb);
|
||||
void free_armature(struct bArmature *arm);
|
||||
|
@ -50,7 +50,7 @@ struct Main;
|
||||
#define BLENDER_MINVERSION 250
|
||||
#define BLENDER_MINSUBVERSION 0
|
||||
|
||||
int BKE_read_file(struct bContext *C, char *dir, struct ReportList *reports);
|
||||
int BKE_read_file(struct bContext *C, const char *filepath, struct ReportList *reports);
|
||||
int BKE_read_file_from_memory(struct bContext *C, char* filebuf, int filelength, struct ReportList *reports);
|
||||
int BKE_read_file_from_memfile(struct bContext *C, struct MemFile *memfile, struct ReportList *reports);
|
||||
|
||||
@ -65,7 +65,7 @@ void set_blender_test_break_cb(void (*func)(void) );
|
||||
int blender_test_break(void);
|
||||
|
||||
/* global undo */
|
||||
extern void BKE_write_undo(struct bContext *C, char *name);
|
||||
extern void BKE_write_undo(struct bContext *C, const char *name);
|
||||
extern void BKE_undo_step(struct bContext *C, int step);
|
||||
extern void BKE_undo_name(struct bContext *C, const char *name);
|
||||
extern void BKE_reset_undo(void);
|
||||
|
@ -65,6 +65,7 @@ typedef struct BVHTreeFromMesh
|
||||
|
||||
/* Private data */
|
||||
int cached;
|
||||
void *em_evil; /* var only for snapping */
|
||||
|
||||
} BVHTreeFromMesh;
|
||||
|
||||
|
@ -114,7 +114,7 @@ bContext *CTX_copy(const bContext *C);
|
||||
|
||||
/* Stored Context */
|
||||
|
||||
bContextStore *CTX_store_add(ListBase *contexts, char *name, PointerRNA *ptr);
|
||||
bContextStore *CTX_store_add(ListBase *contexts, const char *name, PointerRNA *ptr);
|
||||
void CTX_store_set(bContext *C, bContextStore *store);
|
||||
bContextStore *CTX_store_copy(bContextStore *store);
|
||||
void CTX_store_free(bContextStore *store);
|
||||
|
@ -54,7 +54,7 @@ struct BevList;
|
||||
void unlink_curve( struct Curve *cu);
|
||||
void free_curve( struct Curve *cu);
|
||||
void BKE_free_editfont(struct Curve *cu);
|
||||
struct Curve *add_curve(char *name, int type);
|
||||
struct Curve *add_curve(const char *name, int type);
|
||||
struct Curve *copy_curve( struct Curve *cu);
|
||||
void make_local_curve( struct Curve *cu);
|
||||
short curve_type( struct Curve *cu);
|
||||
|
@ -121,7 +121,7 @@ int CustomData_number_of_layers(const struct CustomData *data, int type);
|
||||
* returns the layer data */
|
||||
void *CustomData_duplicate_referenced_layer(struct CustomData *data, int type);
|
||||
void *CustomData_duplicate_referenced_layer_named(struct CustomData *data,
|
||||
int type, char *name);
|
||||
int type, const char *name);
|
||||
|
||||
/* set the CD_FLAG_NOCOPY flag in custom data layers where the mask is
|
||||
* zero for the layer type, so only layer types specified by the mask
|
||||
@ -195,10 +195,10 @@ void *CustomData_bmesh_get_n(const struct CustomData *data, void *block, int typ
|
||||
void *CustomData_get_layer(const struct CustomData *data, int type);
|
||||
void *CustomData_get_layer_n(const struct CustomData *data, int type, int n);
|
||||
void *CustomData_get_layer_named(const struct CustomData *data, int type,
|
||||
char *name);
|
||||
const char *name);
|
||||
|
||||
int CustomData_get_layer_index(const struct CustomData *data, int type);
|
||||
int CustomData_get_named_layer_index(const struct CustomData *data, int type, char *name);
|
||||
int CustomData_get_named_layer_index(const struct CustomData *data, int type, const char *name);
|
||||
int CustomData_get_active_layer_index(const struct CustomData *data, int type);
|
||||
int CustomData_get_render_layer_index(const struct CustomData *data, int type);
|
||||
int CustomData_get_clone_layer_index(const struct CustomData *data, int type);
|
||||
|
@ -40,7 +40,7 @@ struct Scene;
|
||||
* @retval 1 The file was read succesfully.
|
||||
* @attention Used in filesel.c
|
||||
*/
|
||||
int BKE_read_exotic(struct Scene *scene, char *name);
|
||||
int BKE_read_exotic(struct Scene *scene, const char *name);
|
||||
|
||||
void write_dxf(struct Scene *scene, char *str);
|
||||
void write_stl(struct Scene *scene, char *str);
|
||||
|
@ -214,6 +214,14 @@ void calc_fcurve_range(struct FCurve *fcu, float *min, float *max);
|
||||
/* get the bounding-box extents for F-Curve */
|
||||
void calc_fcurve_bounds(struct FCurve *fcu, float *xmin, float *xmax, float *ymin, float *ymax);
|
||||
|
||||
/* .............. */
|
||||
|
||||
/* Are keyframes on F-Curve of any use (to final result, and to show in editors)? */
|
||||
short fcurve_are_keyframes_usable(struct FCurve *fcu);
|
||||
|
||||
/* Can keyframes be added to F-Curve? */
|
||||
short fcurve_is_keyframable(struct FCurve *fcu);
|
||||
|
||||
/* -------- Curve Sanity -------- */
|
||||
|
||||
void calchandles_fcurve(struct FCurve *fcu);
|
||||
|
@ -75,7 +75,7 @@ void BKE_font_register_builtin(void *mem, int size);
|
||||
void free_vfont(struct VFont *sc);
|
||||
void free_ttfont(void);
|
||||
struct VFont *get_builtin_font(void);
|
||||
struct VFont *load_vfont(char *name);
|
||||
struct VFont *load_vfont(const char *name);
|
||||
struct TmpFont *vfont_find_tmpfont(struct VFont *vfont);
|
||||
|
||||
struct chartrans *BKE_text_to_curve(struct Scene *scene, struct Object *ob, int mode);
|
||||
|
@ -40,7 +40,7 @@ struct Scene;
|
||||
|
||||
void free_group_objects(struct Group *group);
|
||||
void unlink_group(struct Group *group);
|
||||
struct Group *add_group(char *name);
|
||||
struct Group *add_group(const char *name);
|
||||
struct Group *copy_group(struct Group *group);
|
||||
int add_to_group(struct Group *group, struct Object *ob, struct Scene *scene, struct Base *base);
|
||||
int rem_from_group(struct Group *group, struct Object *ob, struct Scene *scene, struct Base *base);
|
||||
|
@ -72,8 +72,8 @@ void IDP_UnlinkArray(struct IDProperty *prop);
|
||||
|
||||
/* ---------- String Type ------------ */
|
||||
IDProperty *IDP_NewString(const char *st, const char *name, int maxlen);/* maxlen excludes '\0' */
|
||||
void IDP_AssignString(struct IDProperty *prop, char *st, int maxlen); /* maxlen excludes '\0' */
|
||||
void IDP_ConcatStringC(struct IDProperty *prop, char *st);
|
||||
void IDP_AssignString(struct IDProperty *prop, const char *st, int maxlen); /* maxlen excludes '\0' */
|
||||
void IDP_ConcatStringC(struct IDProperty *prop, const char *st);
|
||||
void IDP_ConcatString(struct IDProperty *str1, struct IDProperty *append);
|
||||
void IDP_FreeString(struct IDProperty *prop);
|
||||
|
||||
|
@ -46,7 +46,7 @@ void free_image(struct Image *me);
|
||||
|
||||
void BKE_stamp_info(struct Scene *scene, struct ImBuf *ibuf);
|
||||
void BKE_stamp_buf(struct Scene *scene, unsigned char *rect, float *rectf, int width, int height, int channels);
|
||||
int BKE_write_ibuf(struct Scene *scene, struct ImBuf *ibuf, char *name, int imtype, int subimtype, int quality);
|
||||
int BKE_write_ibuf(struct Scene *scene, struct ImBuf *ibuf, const char *name, int imtype, int subimtype, int quality);
|
||||
void BKE_makepicstring(char *string, const char *base, int frame, int imtype, const short use_ext, const short use_frames);
|
||||
int BKE_add_image_extension(char *string, int imtype);
|
||||
int BKE_ftype_to_imtype(int ftype);
|
||||
@ -115,7 +115,7 @@ void BKE_image_release_ibuf(struct Image *ima, void *lock);
|
||||
struct Image *BKE_add_image_file(const char *name);
|
||||
|
||||
/* adds image, adds ibuf, generates color or pattern */
|
||||
struct Image *BKE_add_image_size(unsigned int width, unsigned int height, char *name, int depth, int floatbuf, short uvtestgrid, float color[4]);
|
||||
struct Image *BKE_add_image_size(unsigned int width, unsigned int height, const char *name, int depth, int floatbuf, short uvtestgrid, float color[4]);
|
||||
/* adds image from imbuf, owns imbuf */
|
||||
struct Image *BKE_add_image_imbuf(struct ImBuf *ibuf);
|
||||
|
||||
|
@ -59,7 +59,7 @@ void key_curve_normal_weights(float t, float *data, int type);
|
||||
float *do_ob_key(struct Scene *scene, struct Object *ob);
|
||||
|
||||
struct Key *ob_get_key(struct Object *ob);
|
||||
struct KeyBlock *add_keyblock(struct Key *key, char *name);
|
||||
struct KeyBlock *add_keyblock(struct Key *key, const char *name);
|
||||
struct KeyBlock *ob_get_keyblock(struct Object *ob);
|
||||
struct KeyBlock *ob_get_reference_keyblock(struct Object *ob);
|
||||
struct KeyBlock *key_get_keyblock(struct Key *key, int index);
|
||||
|
@ -39,7 +39,7 @@ struct BPoint;
|
||||
struct MDeformVert;
|
||||
|
||||
void resizelattice(struct Lattice *lt, int u, int v, int w, struct Object *ltOb);
|
||||
struct Lattice *add_lattice(char *name);
|
||||
struct Lattice *add_lattice(const char *name);
|
||||
struct Lattice *copy_lattice(struct Lattice *lt);
|
||||
void free_lattice(struct Lattice *lt);
|
||||
void make_local_lattice(struct Lattice *lt);
|
||||
|
@ -72,7 +72,7 @@ void name_uiprefix_id(char *name, struct ID *id);
|
||||
void test_idbutton(char *name);
|
||||
void text_idbutton(struct ID *id, char *text);
|
||||
void all_local(struct Library *lib, int untagged_only);
|
||||
struct ID *find_id(char *type, char *name);
|
||||
struct ID *find_id(char *type, const char *name);
|
||||
void clear_id_newpoins(void);
|
||||
|
||||
void IDnames_to_pupstring(char **str, char *title, char *extraops, struct ListBase *lb,struct ID* link, short *nr);
|
||||
|
@ -46,7 +46,7 @@ void init_def_material(void);
|
||||
void free_material(struct Material *sc);
|
||||
void test_object_materials(struct ID *id);
|
||||
void init_material(struct Material *ma);
|
||||
struct Material *add_material(char *name);
|
||||
struct Material *add_material(const char *name);
|
||||
struct Material *copy_material(struct Material *ma);
|
||||
struct Material *give_node_material(struct Material *ma); /* returns node material or self */
|
||||
void make_local_material(struct Material *ma);
|
||||
|
@ -159,7 +159,7 @@ float init_meta(struct Scene *scene, struct Object *ob);
|
||||
|
||||
void unlink_mball(struct MetaBall *mb);
|
||||
void free_mball(struct MetaBall *mb);
|
||||
struct MetaBall *add_mball(char *name);
|
||||
struct MetaBall *add_mball(const char *name);
|
||||
struct MetaBall *copy_mball(struct MetaBall *mb);
|
||||
void make_local_mball(struct MetaBall *mb);
|
||||
struct MetaElem *add_metaball_element(struct MetaBall *mb, const int type);
|
||||
|
@ -57,7 +57,7 @@ void BKE_mesh_end_editmesh(struct Mesh *me, struct EditMesh *em);
|
||||
|
||||
void unlink_mesh(struct Mesh *me);
|
||||
void free_mesh(struct Mesh *me);
|
||||
struct Mesh *add_mesh(char *name);
|
||||
struct Mesh *add_mesh(const char *name);
|
||||
struct Mesh *copy_mesh(struct Mesh *me);
|
||||
void mesh_update_customdata_pointers(struct Mesh *me);
|
||||
void make_local_tface(struct Mesh *me);
|
||||
|
@ -73,18 +73,18 @@ void object_copy_proxy_drivers(struct Object *ob, struct Object *target);
|
||||
|
||||
void unlink_object(struct Object *ob);
|
||||
int exist_object(struct Object *obtest);
|
||||
void *add_camera(char *name);
|
||||
void *add_camera(const char *name);
|
||||
struct Camera *copy_camera(struct Camera *cam);
|
||||
void make_local_camera(struct Camera *cam);
|
||||
float dof_camera(struct Object *ob);
|
||||
|
||||
void *add_lamp(char *name);
|
||||
void *add_lamp(const char *name);
|
||||
struct Lamp *copy_lamp(struct Lamp *la);
|
||||
void make_local_lamp(struct Lamp *la);
|
||||
void free_camera(struct Camera *ca);
|
||||
void free_lamp(struct Lamp *la);
|
||||
|
||||
struct Object *add_only_object(int type, char *name);
|
||||
struct Object *add_only_object(int type, const char *name);
|
||||
struct Object *add_object(struct Scene *scene, int type);
|
||||
|
||||
struct Object *copy_object(struct Object *ob);
|
||||
@ -130,7 +130,7 @@ int give_obdata_texspace(struct Object *ob, short **texflag, float **loc, float
|
||||
|
||||
int object_insert_ptcache(struct Object *ob);
|
||||
// void object_delete_ptcache(struct Object *ob, int index);
|
||||
struct KeyBlock *object_insert_shape_key(struct Scene *scene, struct Object *ob, char *name, int from_mix);
|
||||
struct KeyBlock *object_insert_shape_key(struct Scene *scene, struct Object *ob, const char *name, int from_mix);
|
||||
|
||||
void object_camera_matrix(
|
||||
struct RenderData *rd, struct Object *camera, int winx, int winy, short field_second,
|
||||
|
@ -42,7 +42,7 @@ struct ReportList;
|
||||
struct VFont;
|
||||
|
||||
/* pack */
|
||||
struct PackedFile *newPackedFile(struct ReportList *reports, char *filename);
|
||||
struct PackedFile *newPackedFile(struct ReportList *reports, const char *filename);
|
||||
struct PackedFile *newPackedFileMemory(void *mem, int memlen);
|
||||
|
||||
void packAll(struct Main *bmain, struct ReportList *reports);
|
||||
@ -54,14 +54,14 @@ int unpackSound(struct Main *bmain, struct ReportList *reports, struct bSound *s
|
||||
int unpackImage(struct ReportList *reports, struct Image *ima, int how);
|
||||
void unpackAll(struct Main *bmain, struct ReportList *reports, int how);
|
||||
|
||||
int writePackedFile(struct ReportList *reports, char *filename, struct PackedFile *pf, int guimode);
|
||||
int writePackedFile(struct ReportList *reports, const char *filename, struct PackedFile *pf, int guimode);
|
||||
|
||||
/* free */
|
||||
void freePackedFile(struct PackedFile *pf);
|
||||
|
||||
/* info */
|
||||
int countPackedFiles(struct Main *bmain);
|
||||
int checkPackedFile(char *filename, struct PackedFile *pf);
|
||||
int checkPackedFile(const char *filename, struct PackedFile *pf);
|
||||
|
||||
/* read */
|
||||
int seekPackedFile(struct PackedFile *pf, int offset, int whence);
|
||||
|
@ -63,6 +63,7 @@ struct BVHTreeRayHit;
|
||||
#define LOOP_PARTICLES for(p=0, pa=psys->particles; p<psys->totpart; p++, pa++)
|
||||
#define LOOP_EXISTING_PARTICLES for(p=0, pa=psys->particles; p<psys->totpart; p++, pa++) if(!(pa->flag & PARS_UNEXIST))
|
||||
#define LOOP_SHOWN_PARTICLES for(p=0, pa=psys->particles; p<psys->totpart; p++, pa++) if(!(pa->flag & (PARS_UNEXIST|PARS_NO_DISP)))
|
||||
#define LOOP_DYNAMIC_PARTICLES for(p=0, pa=psys->particles; p<psys->totpart; p++, pa++) if(pa->state.time > 0.f)
|
||||
|
||||
#define PSYS_FRAND_COUNT 1024
|
||||
#define PSYS_FRAND(seed) psys->frand[(seed) % PSYS_FRAND_COUNT]
|
||||
@ -226,9 +227,9 @@ void copy_particle_key(struct ParticleKey *to, struct ParticleKey *from, int tim
|
||||
void psys_particle_on_emitter(struct ParticleSystemModifierData *psmd, int distr, int index, int index_dmcache, float *fuv, float foffset, float *vec, float *nor, float *utan, float *vtan, float *orco, float *ornor);
|
||||
struct ParticleSystemModifierData *psys_get_modifier(struct Object *ob, struct ParticleSystem *psys);
|
||||
|
||||
struct ModifierData *object_add_particle_system(struct Scene *scene, struct Object *ob, char *name);
|
||||
struct ModifierData *object_add_particle_system(struct Scene *scene, struct Object *ob, const char *name);
|
||||
void object_remove_particle_system(struct Scene *scene, struct Object *ob);
|
||||
struct ParticleSettings *psys_new_settings(char *name, struct Main *main);
|
||||
struct ParticleSettings *psys_new_settings(const char *name, struct Main *main);
|
||||
struct ParticleSettings *psys_copy_settings(struct ParticleSettings *part);
|
||||
void make_local_particlesettings(struct ParticleSettings *part);
|
||||
|
||||
|
@ -58,7 +58,7 @@ void free_avicodecdata(struct AviCodecData *acd);
|
||||
void free_qtcodecdata(struct QuicktimeCodecData *acd);
|
||||
|
||||
void free_scene(struct Scene *sce);
|
||||
struct Scene *add_scene(char *name);
|
||||
struct Scene *add_scene(const char *name);
|
||||
struct Base *object_in_scene(struct Object *ob, struct Scene *sce);
|
||||
|
||||
void set_scene_bg(struct Main *bmain, struct Scene *sce);
|
||||
@ -76,6 +76,7 @@ char *scene_find_marker_name(struct Scene *scene, int frame);
|
||||
char *scene_find_last_marker_name(struct Scene *scene, int frame);
|
||||
int scene_marker_tfm_translate(struct Scene *scene, int delta, int flag);
|
||||
int scene_marker_tfm_extend(struct Scene *scene, int delta, int flag, int frame, char side);
|
||||
int scene_marker_tfm_scale(struct Scene *scene, float value, int flag);
|
||||
|
||||
struct Base *scene_add_base(struct Scene *sce, struct Object *ob);
|
||||
void scene_deselect_all(struct Scene *sce);
|
||||
|
@ -83,6 +83,22 @@ void seq_array(struct Editing *ed, struct Sequence ***seqarray, int *tot, int us
|
||||
seq_end(&iter); \
|
||||
}
|
||||
|
||||
typedef struct SeqRenderData {
|
||||
struct Main *bmain;
|
||||
struct Scene *scene;
|
||||
int rectx;
|
||||
int recty;
|
||||
int preview_render_size;
|
||||
int motion_blur_samples;
|
||||
float motion_blur_shutter;
|
||||
} SeqRenderData;
|
||||
|
||||
SeqRenderData seq_new_render_data(
|
||||
struct Main * bmain, struct Scene * scene,
|
||||
int rectx, int recty, int preview_render_size);
|
||||
|
||||
int seq_cmp_render_data(SeqRenderData * a, SeqRenderData * b);
|
||||
unsigned int seq_hash_render_data(SeqRenderData * a);
|
||||
|
||||
/* Wipe effect */
|
||||
enum {DO_SINGLE_WIPE, DO_DOUBLE_WIPE, DO_BOX_WIPE, DO_CROSS_WIPE,
|
||||
@ -129,35 +145,39 @@ struct SeqEffectHandle {
|
||||
(mixed cases are handled one layer up...) */
|
||||
|
||||
struct ImBuf* (*execute)(
|
||||
struct Main *bmain,
|
||||
struct Scene *scene, struct Sequence *seq, float cfra,
|
||||
SeqRenderData context,
|
||||
struct Sequence *seq, float cfra,
|
||||
float facf0, float facf1,
|
||||
int x, int y, int preview_render_size,
|
||||
struct ImBuf *ibuf1, struct ImBuf *ibuf2,
|
||||
struct ImBuf *ibuf3);
|
||||
};
|
||||
|
||||
/* ********************* prototypes *************** */
|
||||
|
||||
/* sequence.c */
|
||||
void printf_strip(struct Sequence *seq);
|
||||
/* **********************************************************************
|
||||
* sequence.c
|
||||
|
||||
* sequencer render functions
|
||||
********************************************************************** */
|
||||
|
||||
struct ImBuf *give_ibuf_seq(SeqRenderData context, float cfra, int chanshown);
|
||||
struct ImBuf *give_ibuf_seq_threaded(SeqRenderData context, float cfra, int chanshown);
|
||||
struct ImBuf *give_ibuf_seq_direct(SeqRenderData context, float cfra, struct Sequence *seq);
|
||||
struct ImBuf *give_ibuf_seqbase(SeqRenderData context, float cfra, int chan_shown, struct ListBase *seqbasep);
|
||||
void give_ibuf_prefetch_request(SeqRenderData context, float cfra, int chan_shown);
|
||||
|
||||
/* apply functions recursively */
|
||||
int seqbase_recursive_apply(struct ListBase *seqbase, int (*apply_func)(struct Sequence *seq, void *), void *arg);
|
||||
int seq_recursive_apply(struct Sequence *seq, int (*apply_func)(struct Sequence *, void *), void *arg);
|
||||
|
||||
// extern
|
||||
/* maintainance functions, mostly for RNA */
|
||||
// extern
|
||||
void seq_free_sequence(struct Scene *scene, struct Sequence *seq);
|
||||
void seq_free_strip(struct Strip *strip);
|
||||
void seq_free_editing(struct Scene *scene);
|
||||
void seq_free_clipboard(void);
|
||||
struct Editing *seq_give_editing(struct Scene *scene, int alloc);
|
||||
char *give_seqname(struct Sequence *seq);
|
||||
struct ImBuf *give_ibuf_seq(struct Main *bmain, struct Scene *scene, int rectx, int recty, int cfra, int chanshown, int preview_render_size);
|
||||
struct ImBuf *give_ibuf_seq_threaded(struct Main *bmain, struct Scene *scene, int rectx, int recty, int cfra, int chanshown, int preview_render_size);
|
||||
struct ImBuf *give_ibuf_seq_direct(struct Main *bmain, struct Scene *scene, int rectx, int recty, int cfra, int preview_render_size, struct Sequence *seq);
|
||||
struct ImBuf *give_ibuf_seqbase(struct Main *bmain, struct Scene *scene, int rectx, int recty, int cfra, int chan_shown, int preview_render_size, struct ListBase *seqbasep);
|
||||
void give_ibuf_prefetch_request(int rectx, int recty, int cfra, int chanshown, int render_size);
|
||||
void calc_sequence(struct Scene *scene, struct Sequence *seq);
|
||||
void calc_sequence_disp(struct Scene *scene, struct Sequence *seq);
|
||||
void new_tstripdata(struct Sequence *seq);
|
||||
@ -168,14 +188,18 @@ void build_seqar_cb(struct ListBase *seqbase, struct Sequence ***seqar, int *to
|
||||
int evaluate_seq_frame(struct Scene *scene, int cfra);
|
||||
struct StripElem *give_stripelem(struct Sequence *seq, int cfra);
|
||||
|
||||
// intern?
|
||||
// intern
|
||||
void printf_strip(struct Sequence *seq); // debugging function (unused)
|
||||
void update_changed_seq_and_deps(struct Scene *scene, struct Sequence *changed_seq, int len_change, int ibuf_change);
|
||||
|
||||
int input_have_to_preprocess(
|
||||
struct Scene *scene, struct Sequence * seq,
|
||||
float cfra, int seqrectx, int seqrecty);
|
||||
SeqRenderData context, struct Sequence * seq, float cfra);
|
||||
|
||||
/* seqcache.c */
|
||||
/* **********************************************************************
|
||||
seqcache.c
|
||||
|
||||
Sequencer memory cache management functions
|
||||
********************************************************************** */
|
||||
|
||||
typedef enum {
|
||||
SEQ_STRIPELEM_IBUF,
|
||||
@ -190,22 +214,33 @@ void seq_stripelem_cache_destruct();
|
||||
void seq_stripelem_cache_cleanup();
|
||||
|
||||
struct ImBuf * seq_stripelem_cache_get(
|
||||
struct Sequence * seq, int rectx, int recty,
|
||||
SeqRenderData context, struct Sequence * seq,
|
||||
float cfra, seq_stripelem_ibuf_t type);
|
||||
void seq_stripelem_cache_put(
|
||||
struct Sequence * seq, int rectx, int recty,
|
||||
SeqRenderData context, struct Sequence * seq,
|
||||
float cfra, seq_stripelem_ibuf_t type, struct ImBuf * nval);
|
||||
|
||||
/* **********************************************************************
|
||||
seqeffects.c
|
||||
|
||||
/* seqeffects.c */
|
||||
// intern?
|
||||
Sequencer effect strip managment functions
|
||||
**********************************************************************
|
||||
*/
|
||||
|
||||
/* intern */
|
||||
struct SeqEffectHandle get_sequence_blend(struct Sequence *seq);
|
||||
void sequence_effect_speed_rebuild_map(struct Scene *scene, struct Sequence *seq, int force);
|
||||
|
||||
// extern
|
||||
/* extern */
|
||||
struct SeqEffectHandle get_sequence_effect(struct Sequence *seq);
|
||||
int get_sequence_effect_num_inputs(int seq_type);
|
||||
|
||||
|
||||
/* **********************************************************************
|
||||
Sequencer editing functions
|
||||
**********************************************************************
|
||||
*/
|
||||
|
||||
/* for transform but also could use elsewhere */
|
||||
int seq_tx_get_start(struct Sequence *seq);
|
||||
int seq_tx_get_end(struct Sequence *seq);
|
||||
|
@ -47,7 +47,7 @@ void sound_exit();
|
||||
void sound_force_device(int device);
|
||||
int sound_define_from_str(char *str);
|
||||
|
||||
struct bSound* sound_new_file(struct Main *main, char* filename);
|
||||
struct bSound* sound_new_file(struct Main *main, const char *filename);
|
||||
|
||||
// XXX unused currently
|
||||
#if 0
|
||||
|
@ -43,13 +43,13 @@ struct SpaceText;
|
||||
void free_text (struct Text *text);
|
||||
void txt_set_undostate (int u);
|
||||
int txt_get_undostate (void);
|
||||
struct Text* add_empty_text (char *name);
|
||||
struct Text* add_empty_text (const char *name);
|
||||
int reopen_text (struct Text *text);
|
||||
struct Text* add_text (char *file, const char *relpath);
|
||||
struct Text* add_text (const char *file, const char *relpath);
|
||||
struct Text* copy_text (struct Text *ta);
|
||||
void unlink_text (struct Main *bmain, struct Text *text);
|
||||
void clear_text(struct Text *text);
|
||||
void write_text(struct Text *text, char *str);
|
||||
void write_text(struct Text *text, const char *str);
|
||||
|
||||
char* txt_to_buf (struct Text *text);
|
||||
void txt_clean_text (struct Text *text);
|
||||
|
@ -51,10 +51,11 @@ int bUnit_IsValid(int system, int type);
|
||||
/* loop over scales, coudl add names later */
|
||||
//double bUnit_Iter(void **unit, char **name, int system, int type);
|
||||
|
||||
void bUnit_GetSystem(void **usys_pt, int *len, int system, int type);
|
||||
char* bUnit_GetName(void *usys_pt, int index);
|
||||
char* bUnit_GetNameDisplay(void *usys_pt, int index);
|
||||
double bUnit_GetScaler(void *usys_pt, int index);
|
||||
void bUnit_GetSystem(void **usys_pt, int *len, int system, int type);
|
||||
int bUnit_GetBaseUnit(void *usys_pt);
|
||||
const char* bUnit_GetName(void *usys_pt, int index);
|
||||
const char* bUnit_GetNameDisplay(void *usys_pt, int index);
|
||||
double bUnit_GetScaler(void *usys_pt, int index);
|
||||
|
||||
/* aligned with PropertyUnit */
|
||||
#define B_UNIT_NONE 0
|
||||
|
@ -34,7 +34,7 @@
|
||||
struct World;
|
||||
|
||||
void free_world(struct World *sc);
|
||||
struct World *add_world(char *name);
|
||||
struct World *add_world(const char *name);
|
||||
struct World *copy_world(struct World *wrld);
|
||||
void make_local_world(struct World *wrld);
|
||||
|
||||
|
@ -215,9 +215,8 @@ IF(WITH_LZMA)
|
||||
ADD_DEFINITIONS(-DWITH_LZMA)
|
||||
ENDIF(WITH_LZMA)
|
||||
|
||||
IF(WIN32)
|
||||
IF(MSVC)
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX")
|
||||
LIST(APPEND INC ${PTHREADS_INC})
|
||||
ENDIF(WIN32)
|
||||
ENDIF(MSVC)
|
||||
|
||||
BLENDERLIB(bf_blenkernel "${SRC}" "${INC}")
|
||||
|
@ -1441,7 +1441,7 @@ static Object *find_family_object(Object **obar, char *family, char ch)
|
||||
|
||||
static void font_duplilist(ListBase *lb, Scene *scene, Object *par, int level, int animated)
|
||||
{
|
||||
Object *ob, *obar[256];
|
||||
Object *ob, *obar[256]= {0};
|
||||
Curve *cu;
|
||||
struct chartrans *ct, *chartransdata;
|
||||
float vec[3], obmat[4][4], pmat[4][4], fsize, xof, yof;
|
||||
@ -1456,9 +1456,7 @@ static void font_duplilist(ListBase *lb, Scene *scene, Object *par, int level, i
|
||||
|
||||
chartransdata= BKE_text_to_curve(scene, par, FO_DUPLI);
|
||||
if(chartransdata==0) return;
|
||||
|
||||
memset(obar, 0, 256*sizeof(void *));
|
||||
|
||||
|
||||
cu= par->data;
|
||||
slen= strlen(cu->str);
|
||||
fsize= cu->fsize;
|
||||
|
@ -39,9 +39,10 @@
|
||||
#include "BKE_library.h"
|
||||
#include "BLI_dynstr.h"
|
||||
|
||||
|
||||
#include "DNA_anim_types.h"
|
||||
#include "DNA_material_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_texture_types.h"
|
||||
|
||||
#include "BKE_animsys.h"
|
||||
#include "BKE_action.h"
|
||||
@ -1614,9 +1615,6 @@ void nladata_flush_channels (ListBase *channels)
|
||||
*/
|
||||
static void animsys_evaluate_nla (PointerRNA *ptr, AnimData *adt, float ctime)
|
||||
{
|
||||
ListBase dummy_trackslist = {NULL, NULL};
|
||||
NlaStrip dummy_strip;
|
||||
|
||||
NlaTrack *nlt;
|
||||
short track_index=0;
|
||||
short has_strips = 0;
|
||||
@ -1659,7 +1657,9 @@ static void animsys_evaluate_nla (PointerRNA *ptr, AnimData *adt, float ctime)
|
||||
/* if there are strips, evaluate action as per NLA rules */
|
||||
if ((has_strips) || (adt->actstrip)) {
|
||||
/* make dummy NLA strip, and add that to the stack */
|
||||
memset(&dummy_strip, 0, sizeof(NlaStrip));
|
||||
NlaStrip dummy_strip= {0};
|
||||
ListBase dummy_trackslist;
|
||||
|
||||
dummy_trackslist.first= dummy_trackslist.last= &dummy_strip;
|
||||
|
||||
if ((nlt) && !(adt->flag & ADT_NLA_EDIT_NOMAP)) {
|
||||
@ -1844,7 +1844,7 @@ void BKE_animsys_evaluate_all_animation (Main *main, float ctime)
|
||||
if (G.f & G_DEBUG)
|
||||
printf("Evaluate all animation - %f \n", ctime);
|
||||
|
||||
/* macro for less typing
|
||||
/* macros for less typing
|
||||
* - only evaluate animation data for id if it has users (and not just fake ones)
|
||||
* - whether animdata exists is checked for by the evaluation function, though taking
|
||||
* this outside of the function may make things slightly faster?
|
||||
@ -1856,6 +1856,24 @@ void BKE_animsys_evaluate_all_animation (Main *main, float ctime)
|
||||
BKE_animsys_evaluate_animdata(id, adt, ctime, aflag); \
|
||||
} \
|
||||
}
|
||||
/* another macro for the "embedded" nodetree cases
|
||||
* - this is like EVAL_ANIM_IDS, but this handles the case "embedded nodetrees"
|
||||
* (i.e. scene/material/texture->nodetree) which we need a special exception
|
||||
* for, otherwise they'd get skipped
|
||||
* - ntp = "node tree parent" = datablock where node tree stuff resides
|
||||
*/
|
||||
#define EVAL_ANIM_NODETREE_IDS(first, NtId_Type, aflag) \
|
||||
for (id= first; id; id= id->next) { \
|
||||
if (ID_REAL_USERS(id) > 0) { \
|
||||
AnimData *adt= BKE_animdata_from_id(id); \
|
||||
NtId_Type *ntp= (NtId_Type *)id; \
|
||||
if (ntp->nodetree) { \
|
||||
AnimData *adt2= BKE_animdata_from_id((ID *)ntp->nodetree); \
|
||||
BKE_animsys_evaluate_animdata((ID *)ntp->nodetree, adt2, ctime, ADT_RECALC_ANIM); \
|
||||
} \
|
||||
BKE_animsys_evaluate_animdata(id, adt, ctime, aflag); \
|
||||
} \
|
||||
}
|
||||
|
||||
/* optimisation:
|
||||
* when there are no actions, don't go over database and loop over heaps of datablocks,
|
||||
@ -1876,13 +1894,13 @@ void BKE_animsys_evaluate_all_animation (Main *main, float ctime)
|
||||
EVAL_ANIM_IDS(main->nodetree.first, ADT_RECALC_ANIM);
|
||||
|
||||
/* textures */
|
||||
EVAL_ANIM_IDS(main->tex.first, ADT_RECALC_ANIM);
|
||||
EVAL_ANIM_NODETREE_IDS(main->tex.first, Tex, ADT_RECALC_ANIM);
|
||||
|
||||
/* lamps */
|
||||
EVAL_ANIM_IDS(main->lamp.first, ADT_RECALC_ANIM);
|
||||
|
||||
/* materials */
|
||||
EVAL_ANIM_IDS(main->mat.first, ADT_RECALC_ANIM);
|
||||
EVAL_ANIM_NODETREE_IDS(main->mat.first, Material, ADT_RECALC_ANIM);
|
||||
|
||||
/* cameras */
|
||||
EVAL_ANIM_IDS(main->camera.first, ADT_RECALC_ANIM);
|
||||
@ -1920,19 +1938,7 @@ void BKE_animsys_evaluate_all_animation (Main *main, float ctime)
|
||||
EVAL_ANIM_IDS(main->world.first, ADT_RECALC_ANIM);
|
||||
|
||||
/* scenes */
|
||||
for (id= main->scene.first; id; id= id->next) {
|
||||
AnimData *adt= BKE_animdata_from_id(id);
|
||||
Scene *scene= (Scene *)id;
|
||||
|
||||
/* do compositing nodes first (since these aren't included in main tree) */
|
||||
if (scene->nodetree) {
|
||||
AnimData *adt2= BKE_animdata_from_id((ID *)scene->nodetree);
|
||||
BKE_animsys_evaluate_animdata((ID *)scene->nodetree, adt2, ctime, ADT_RECALC_ANIM);
|
||||
}
|
||||
|
||||
/* now execute scene animation data as per normal */
|
||||
BKE_animsys_evaluate_animdata(id, adt, ctime, ADT_RECALC_ANIM);
|
||||
}
|
||||
EVAL_ANIM_NODETREE_IDS(main->scene.first, Scene, ADT_RECALC_ANIM);
|
||||
}
|
||||
|
||||
/* ***************************************** */
|
||||
|
@ -69,7 +69,7 @@
|
||||
|
||||
/* **************** Generic Functions, data level *************** */
|
||||
|
||||
bArmature *add_armature(char *name)
|
||||
bArmature *add_armature(const char *name)
|
||||
{
|
||||
bArmature *arm;
|
||||
|
||||
@ -813,9 +813,9 @@ void armature_deform_verts(Object *armOb, Object *target, DerivedMesh *dm,
|
||||
bDeformGroup *dg;
|
||||
DualQuat *dualquats= NULL;
|
||||
float obinv[4][4], premat[4][4], postmat[4][4];
|
||||
int use_envelope = deformflag & ARM_DEF_ENVELOPE;
|
||||
int use_quaternion = deformflag & ARM_DEF_QUATERNION;
|
||||
int invert_vgroup= deformflag & ARM_DEF_INVERT_VGROUP;
|
||||
const short use_envelope = deformflag & ARM_DEF_ENVELOPE;
|
||||
const short use_quaternion = deformflag & ARM_DEF_QUATERNION;
|
||||
const short invert_vgroup= deformflag & ARM_DEF_INVERT_VGROUP;
|
||||
int numGroups = 0; /* safety for vertexgroup index overflow */
|
||||
int i, target_totvert = 0; /* safety for vertexgroup overflow */
|
||||
int use_dverts = 0;
|
||||
@ -1456,10 +1456,6 @@ static void pose_proxy_synchronize(Object *ob, Object *from, int layer_protected
|
||||
if(error)
|
||||
return;
|
||||
|
||||
/* exception, armature local layer should be proxied too */
|
||||
if (pose->proxy_layer)
|
||||
((bArmature *)ob->data)->layer= pose->proxy_layer;
|
||||
|
||||
/* clear all transformation values from library */
|
||||
rest_pose(frompose);
|
||||
|
||||
@ -1734,28 +1730,25 @@ static void splineik_init_tree_from_pchan(Scene *scene, Object *UNUSED(ob), bPos
|
||||
ikData->numpoints= ikData->chainlen+1;
|
||||
ikData->points= MEM_callocN(sizeof(float)*ikData->numpoints, "Spline IK Binding");
|
||||
|
||||
/* bind 'tip' of chain (i.e. first joint = tip of bone with the Spline IK Constraint) */
|
||||
ikData->points[0] = 1.0f;
|
||||
|
||||
/* perform binding of the joints to parametric positions along the curve based
|
||||
* proportion of the total length that each bone occupies
|
||||
*/
|
||||
for (i = 0; i < segcount; i++) {
|
||||
if (i != 0) {
|
||||
/* 'head' joints
|
||||
* - 2 methods; the one chosen depends on whether we've got usable lengths
|
||||
*/
|
||||
if ((ikData->flag & CONSTRAINT_SPLINEIK_EVENSPLITS) || (totLength == 0.0f)) {
|
||||
/* 1) equi-spaced joints */
|
||||
ikData->points[i]= ikData->points[i-1] - segmentLen;
|
||||
}
|
||||
else {
|
||||
/* 2) to find this point on the curve, we take a step from the previous joint
|
||||
* a distance given by the proportion that this bone takes
|
||||
*/
|
||||
ikData->points[i]= ikData->points[i-1] - (boneLengths[i] / totLength);
|
||||
}
|
||||
/* 'head' joints, travelling towards the root of the chain
|
||||
* - 2 methods; the one chosen depends on whether we've got usable lengths
|
||||
*/
|
||||
if ((ikData->flag & CONSTRAINT_SPLINEIK_EVENSPLITS) || (totLength == 0.0f)) {
|
||||
/* 1) equi-spaced joints */
|
||||
ikData->points[i+1]= ikData->points[i] - segmentLen;
|
||||
}
|
||||
else {
|
||||
/* 'tip' of chain, special exception for the first joint */
|
||||
ikData->points[0]= 1.0f;
|
||||
/* 2) to find this point on the curve, we take a step from the previous joint
|
||||
* a distance given by the proportion that this bone takes
|
||||
*/
|
||||
ikData->points[i+1]= ikData->points[i] - (boneLengths[i] / totLength);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2410,7 +2403,7 @@ void where_is_pose (Scene *scene, Object *ob)
|
||||
|
||||
if(ELEM(NULL, arm, scene)) return;
|
||||
if((ob->pose==NULL) || (ob->pose->flag & POSE_RECALC))
|
||||
armature_rebuild_pose(ob, arm);
|
||||
armature_rebuild_pose(ob, arm);
|
||||
|
||||
ctime= bsystem_time(scene, ob, (float)scene->r.cfra, 0.0); /* not accurate... */
|
||||
|
||||
|
@ -197,7 +197,7 @@ static void clean_paths(Main *main)
|
||||
/* context matching */
|
||||
/* handle no-ui case */
|
||||
|
||||
static void setup_app_data(bContext *C, BlendFileData *bfd, char *filename)
|
||||
static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filename)
|
||||
{
|
||||
bScreen *curscreen= NULL;
|
||||
Scene *curscene= NULL;
|
||||
@ -237,6 +237,7 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, char *filename)
|
||||
}
|
||||
|
||||
/* free G.main Main database */
|
||||
// CTX_wm_manager_set(C, NULL);
|
||||
clear_global();
|
||||
|
||||
G.main= bfd->main;
|
||||
@ -261,7 +262,7 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, char *filename)
|
||||
G.winpos= bfd->winpos;
|
||||
G.displaymode= bfd->displaymode;
|
||||
G.fileflags= bfd->fileflags;
|
||||
|
||||
CTX_wm_manager_set(C, bfd->main->wm.first);
|
||||
CTX_wm_screen_set(C, bfd->curscreen);
|
||||
CTX_data_scene_set(C, bfd->curscreen->scene);
|
||||
CTX_wm_area_set(C, NULL);
|
||||
@ -364,7 +365,7 @@ void BKE_userdef_free(void)
|
||||
2: OK, and with new user settings
|
||||
*/
|
||||
|
||||
int BKE_read_file(bContext *C, char *dir, ReportList *reports)
|
||||
int BKE_read_file(bContext *C, const char *dir, ReportList *reports)
|
||||
{
|
||||
BlendFileData *bfd;
|
||||
int retval= 1;
|
||||
@ -486,7 +487,7 @@ static int read_undosave(bContext *C, UndoElem *uel)
|
||||
}
|
||||
|
||||
/* name can be a dynamic string */
|
||||
void BKE_write_undo(bContext *C, char *name)
|
||||
void BKE_write_undo(bContext *C, const char *name)
|
||||
{
|
||||
uintptr_t maxmem, totmem, memused;
|
||||
int nr, success;
|
||||
|
@ -36,6 +36,7 @@
|
||||
|
||||
#include "BKE_DerivedMesh.h"
|
||||
#include "BKE_utildefines.h"
|
||||
#include "BLI_editVert.h"
|
||||
|
||||
#include "BLI_math.h"
|
||||
#include "MEM_guardedalloc.h"
|
||||
@ -577,16 +578,34 @@ BVHTree* bvhtree_from_mesh_faces(BVHTreeFromMesh *data, DerivedMesh *mesh, float
|
||||
tree = BLI_bvhtree_new(numFaces, epsilon, tree_type, axis);
|
||||
if(tree != NULL)
|
||||
{
|
||||
for(i = 0; i < numFaces; i++)
|
||||
{
|
||||
float co[4][3];
|
||||
VECCOPY(co[0], vert[ face[i].v1 ].co);
|
||||
VECCOPY(co[1], vert[ face[i].v2 ].co);
|
||||
VECCOPY(co[2], vert[ face[i].v3 ].co);
|
||||
if(face[i].v4)
|
||||
VECCOPY(co[3], vert[ face[i].v4 ].co);
|
||||
|
||||
BLI_bvhtree_insert(tree, i, co[0], face[i].v4 ? 4 : 3);
|
||||
/* XXX, for snap only, em & dm are assumed to be aligned, since dm is the em's cage */
|
||||
EditMesh *em= data->em_evil;
|
||||
if(em) {
|
||||
EditFace *efa= em->faces.first;
|
||||
for(i = 0; i < numFaces; i++, efa= efa->next) {
|
||||
if(!(efa->f & 1) && efa->h==0 && !((efa->v1->f&1)+(efa->v2->f&1)+(efa->v3->f&1)+(efa->v4?efa->v4->f&1:0))) {
|
||||
float co[4][3];
|
||||
VECCOPY(co[0], vert[ face[i].v1 ].co);
|
||||
VECCOPY(co[1], vert[ face[i].v2 ].co);
|
||||
VECCOPY(co[2], vert[ face[i].v3 ].co);
|
||||
if(face[i].v4)
|
||||
VECCOPY(co[3], vert[ face[i].v4 ].co);
|
||||
|
||||
BLI_bvhtree_insert(tree, i, co[0], face[i].v4 ? 4 : 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
for(i = 0; i < numFaces; i++) {
|
||||
float co[4][3];
|
||||
VECCOPY(co[0], vert[ face[i].v1 ].co);
|
||||
VECCOPY(co[1], vert[ face[i].v2 ].co);
|
||||
VECCOPY(co[2], vert[ face[i].v3 ].co);
|
||||
if(face[i].v4)
|
||||
VECCOPY(co[3], vert[ face[i].v4 ].co);
|
||||
|
||||
BLI_bvhtree_insert(tree, i, co[0], face[i].v4 ? 4 : 3);
|
||||
}
|
||||
}
|
||||
BLI_bvhtree_balance(tree);
|
||||
|
||||
|
@ -3814,7 +3814,6 @@ static void pivotcon_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *t
|
||||
|
||||
/* pivot correction */
|
||||
float axis[3], angle;
|
||||
float dvec[3];
|
||||
|
||||
/* firstly, check if pivoting should take place based on the current rotation */
|
||||
if (data->rotAxis != PIVOTCON_AXIS_NONE) {
|
||||
@ -3861,14 +3860,16 @@ static void pivotcon_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *t
|
||||
|
||||
/* correct the pivot by the rotation axis otherwise the pivot translates when it shouldnt */
|
||||
mat3_to_axis_angle(axis, &angle, rotMat);
|
||||
sub_v3_v3v3(vec, pivot, cob->matrix[3]);
|
||||
project_v3_v3v3(dvec, vec, axis);
|
||||
sub_v3_v3(pivot, dvec);
|
||||
|
||||
if(angle) {
|
||||
float dvec[3];
|
||||
sub_v3_v3v3(vec, pivot, cob->matrix[3]);
|
||||
project_v3_v3v3(dvec, vec, axis);
|
||||
sub_v3_v3(pivot, dvec);
|
||||
}
|
||||
|
||||
/* perform the pivoting... */
|
||||
/* 1. take the vector from owner to the pivot */
|
||||
sub_v3_v3v3(vec, pivot, cob->matrix[3]);
|
||||
sub_v3_v3v3(vec, cob->matrix[3], pivot);
|
||||
/* 2. rotate this vector by the rotation of the object... */
|
||||
mul_m3_v3(rotMat, vec);
|
||||
/* 3. make the rotation in terms of the pivot now */
|
||||
|
@ -108,7 +108,7 @@ void CTX_free(bContext *C)
|
||||
|
||||
/* store */
|
||||
|
||||
bContextStore *CTX_store_add(ListBase *contexts, char *name, PointerRNA *ptr)
|
||||
bContextStore *CTX_store_add(ListBase *contexts, const char *name, PointerRNA *ptr)
|
||||
{
|
||||
bContextStoreEntry *entry;
|
||||
bContextStore *ctx, *lastctx;
|
||||
|
@ -130,7 +130,7 @@ void free_curve(Curve *cu)
|
||||
if(cu->tb) MEM_freeN(cu->tb);
|
||||
}
|
||||
|
||||
Curve *add_curve(char *name, int type)
|
||||
Curve *add_curve(const char *name, int type)
|
||||
{
|
||||
Curve *cu;
|
||||
|
||||
|
@ -984,7 +984,7 @@ int CustomData_get_layer_index(const CustomData *data, int type)
|
||||
return -1;
|
||||
}
|
||||
|
||||
int CustomData_get_named_layer_index(const CustomData *data, int type, char *name)
|
||||
int CustomData_get_named_layer_index(const CustomData *data, int type, const char *name)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -1371,7 +1371,7 @@ void *CustomData_duplicate_referenced_layer(struct CustomData *data, int type)
|
||||
}
|
||||
|
||||
void *CustomData_duplicate_referenced_layer_named(struct CustomData *data,
|
||||
int type, char *name)
|
||||
int type, const char *name)
|
||||
{
|
||||
CustomDataLayer *layer;
|
||||
int layer_index;
|
||||
@ -1603,7 +1603,7 @@ void *CustomData_get_layer_n(const CustomData *data, int type, int n)
|
||||
}
|
||||
|
||||
void *CustomData_get_layer_named(const struct CustomData *data, int type,
|
||||
char *name)
|
||||
const char *name)
|
||||
{
|
||||
int layer_index = CustomData_get_named_layer_index(data, type, name);
|
||||
if(layer_index < 0) return NULL;
|
||||
|
@ -85,11 +85,11 @@
|
||||
|
||||
#include "zlib.h"
|
||||
|
||||
static int is_dxf(char *str);
|
||||
static void dxf_read(Scene *scene, char *filename);
|
||||
static int is_stl(char *str);
|
||||
static int is_dxf(const char *str);
|
||||
static void dxf_read(Scene *scene, const char *filename);
|
||||
static int is_stl(const char *str);
|
||||
|
||||
static int is_stl_ascii(char *str)
|
||||
static int is_stl_ascii(const char *str)
|
||||
{
|
||||
FILE *fpSTL;
|
||||
char buffer[1000];
|
||||
@ -114,7 +114,7 @@ static int is_stl_ascii(char *str)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int is_stl(char *str)
|
||||
static int is_stl(const char *str)
|
||||
{
|
||||
int i;
|
||||
i = strlen(str) - 3;
|
||||
@ -190,7 +190,7 @@ static void mesh_add_normals_flags(Mesh *me)
|
||||
}
|
||||
}
|
||||
|
||||
static void read_stl_mesh_binary(Scene *scene, char *str)
|
||||
static void read_stl_mesh_binary(Scene *scene, const char *str)
|
||||
{
|
||||
FILE *fpSTL;
|
||||
Object *ob;
|
||||
@ -314,7 +314,7 @@ static void read_stl_mesh_binary(Scene *scene, char *str)
|
||||
STLBAILOUT("Bad vertex!"); \
|
||||
++totvert; \
|
||||
}
|
||||
static void read_stl_mesh_ascii(Scene *scene, char *str)
|
||||
static void read_stl_mesh_ascii(Scene *scene, const char *str)
|
||||
{
|
||||
FILE *fpSTL;
|
||||
char buffer[2048], *cp;
|
||||
@ -454,7 +454,7 @@ static void read_stl_mesh_ascii(Scene *scene, char *str)
|
||||
|
||||
/* ************************************************************ */
|
||||
|
||||
int BKE_read_exotic(Scene *scene, char *name)
|
||||
int BKE_read_exotic(Scene *scene, const char *name)
|
||||
{
|
||||
int len;
|
||||
gzFile gzfile;
|
||||
@ -1069,7 +1069,7 @@ static char val[256];
|
||||
static short error_exit=0;
|
||||
static short hasbumped=0;
|
||||
|
||||
static int is_dxf(char *str)
|
||||
static int is_dxf(const char *str)
|
||||
{
|
||||
dxf_line=0;
|
||||
|
||||
@ -2207,7 +2207,7 @@ static void dxf_read_3dface(Scene *scene, int noob)
|
||||
hasbumped=1;
|
||||
}
|
||||
|
||||
static void dxf_read(Scene *scene, char *filename)
|
||||
static void dxf_read(Scene *scene, const char *filename)
|
||||
{
|
||||
Mesh *lastMe = G.main->mesh.last;
|
||||
|
||||
|
@ -163,7 +163,7 @@ void copy_fcurves (ListBase *dst, ListBase *src)
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------------- Finding -------------------------- */
|
||||
/* ----------------- Finding F-Curves -------------------------- */
|
||||
|
||||
/* high level function to get an fcurve from C without having the rna */
|
||||
FCurve *id_data_find_fcurve(ID *id, void *data, StructRNA *type, char *prop_name, int index)
|
||||
@ -298,36 +298,36 @@ int list_find_data_fcurves (ListBase *dst, ListBase *src, const char *dataPrefix
|
||||
return matches;
|
||||
}
|
||||
|
||||
FCurve *rna_get_fcurve(PointerRNA *ptr, PropertyRNA *prop, int rnaindex, bAction **action, int *driven)
|
||||
FCurve *rna_get_fcurve (PointerRNA *ptr, PropertyRNA *prop, int rnaindex, bAction **action, int *driven)
|
||||
{
|
||||
FCurve *fcu= NULL;
|
||||
|
||||
*driven= 0;
|
||||
|
||||
/* there must be some RNA-pointer + property combon */
|
||||
if(prop && ptr->id.data && RNA_property_animateable(ptr, prop)) {
|
||||
if (prop && ptr->id.data && RNA_property_animateable(ptr, prop)) {
|
||||
AnimData *adt= BKE_animdata_from_id(ptr->id.data);
|
||||
char *path;
|
||||
|
||||
if(adt) {
|
||||
if((adt->action && adt->action->curves.first) || (adt->drivers.first)) {
|
||||
if (adt) {
|
||||
if ((adt->action && adt->action->curves.first) || (adt->drivers.first)) {
|
||||
/* XXX this function call can become a performance bottleneck */
|
||||
path= RNA_path_from_ID_to_property(ptr, prop);
|
||||
|
||||
if(path) {
|
||||
if (path) {
|
||||
/* animation takes priority over drivers */
|
||||
if(adt->action && adt->action->curves.first)
|
||||
if (adt->action && adt->action->curves.first)
|
||||
fcu= list_find_fcurve(&adt->action->curves, path, rnaindex);
|
||||
|
||||
/* if not animated, check if driven */
|
||||
if(!fcu && (adt->drivers.first)) {
|
||||
if (!fcu && (adt->drivers.first)) {
|
||||
fcu= list_find_fcurve(&adt->drivers, path, rnaindex);
|
||||
|
||||
if(fcu)
|
||||
if (fcu)
|
||||
*driven= 1;
|
||||
}
|
||||
|
||||
if(fcu && action)
|
||||
if (fcu && action)
|
||||
*action= adt->action;
|
||||
|
||||
MEM_freeN(path);
|
||||
@ -339,6 +339,8 @@ FCurve *rna_get_fcurve(PointerRNA *ptr, PropertyRNA *prop, int rnaindex, bAction
|
||||
return fcu;
|
||||
}
|
||||
|
||||
/* ----------------- Finding Keyframes/Extents -------------------------- */
|
||||
|
||||
/* threshold for binary-searching keyframes - threshold here should be good enough for now, but should become userpref */
|
||||
#define BEZT_BINARYSEARCH_THRESH 0.01f /* was 0.00001, but giving errors */
|
||||
|
||||
@ -520,6 +522,87 @@ void calc_fcurve_range (FCurve *fcu, float *start, float *end)
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------- Status Checks -------------------------- */
|
||||
|
||||
/* Are keyframes on F-Curve of any use?
|
||||
* Usability of keyframes refers to whether they should be displayed,
|
||||
* and also whether they will have any influence on the final result.
|
||||
*/
|
||||
short fcurve_are_keyframes_usable (FCurve *fcu)
|
||||
{
|
||||
/* F-Curve must exist */
|
||||
if (fcu == NULL)
|
||||
return 0;
|
||||
|
||||
/* F-Curve must not have samples - samples are mutually exclusive of keyframes */
|
||||
if (fcu->fpt)
|
||||
return 0;
|
||||
|
||||
/* if it has modifiers, none of these should "drastically" alter the curve */
|
||||
if (fcu->modifiers.first) {
|
||||
FModifier *fcm;
|
||||
|
||||
/* check modifiers from last to first, as last will be more influential */
|
||||
// TODO: optionally, only check modifier if it is the active one...
|
||||
for (fcm = fcu->modifiers.last; fcm; fcm = fcm->prev) {
|
||||
/* ignore if muted/disabled */
|
||||
if (fcm->flag & (FMODIFIER_FLAG_DISABLED|FMODIFIER_FLAG_MUTED))
|
||||
continue;
|
||||
|
||||
/* type checks */
|
||||
switch (fcm->type) {
|
||||
/* clearly harmless - do nothing */
|
||||
case FMODIFIER_TYPE_CYCLES:
|
||||
case FMODIFIER_TYPE_STEPPED:
|
||||
case FMODIFIER_TYPE_NOISE:
|
||||
break;
|
||||
|
||||
/* sometimes harmful - depending on whether they're "additive" or not */
|
||||
case FMODIFIER_TYPE_GENERATOR:
|
||||
{
|
||||
FMod_Generator *data = (FMod_Generator *)fcm->data;
|
||||
|
||||
if ((data->flag & FCM_GENERATOR_ADDITIVE) == 0)
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case FMODIFIER_TYPE_FN_GENERATOR:
|
||||
{
|
||||
FMod_FunctionGenerator *data = (FMod_FunctionGenerator *)fcm->data;
|
||||
|
||||
if ((data->flag & FCM_GENERATOR_ADDITIVE) == 0)
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
||||
/* always harmful - cannot allow */
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* keyframes are usable */
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Can keyframes be added to F-Curve?
|
||||
* Keyframes can only be added if they are already visible
|
||||
*/
|
||||
short fcurve_is_keyframable (FCurve *fcu)
|
||||
{
|
||||
/* F-Curve's keyframes must be "usable" (i.e. visible + have an effect on final result) */
|
||||
if (fcurve_are_keyframes_usable(fcu) == 0)
|
||||
return 0;
|
||||
|
||||
/* F-Curve must currently be editable too */
|
||||
if ( (fcu->flag & FCURVE_PROTECTED) || ((fcu->grp) && (fcu->grp->flag & AGRP_PROTECTED)) )
|
||||
return 0;
|
||||
|
||||
/* F-Curve is keyframable */
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* ***************************** Keyframe Column Tools ********************************* */
|
||||
|
||||
/* add a BezTriple to a column */
|
||||
@ -851,31 +934,44 @@ static float dtar_get_prop_val (ChannelDriver *driver, DriverTarget *dtar)
|
||||
|
||||
/* get property to read from, and get value as appropriate */
|
||||
if (RNA_path_resolve_full(&id_ptr, dtar->rna_path, &ptr, &prop, &index)) {
|
||||
switch (RNA_property_type(prop)) {
|
||||
case PROP_BOOLEAN:
|
||||
if (RNA_property_array_length(&ptr, prop))
|
||||
if(RNA_property_array_check(&ptr, prop)) {
|
||||
/* array */
|
||||
if (index < RNA_property_array_length(&ptr, prop)) {
|
||||
switch (RNA_property_type(prop)) {
|
||||
case PROP_BOOLEAN:
|
||||
value= (float)RNA_property_boolean_get_index(&ptr, prop, index);
|
||||
else
|
||||
value= (float)RNA_property_boolean_get(&ptr, prop);
|
||||
break;
|
||||
case PROP_INT:
|
||||
value= (float)RNA_property_int_get_index(&ptr, prop, index);
|
||||
break;
|
||||
case PROP_FLOAT:
|
||||
value= RNA_property_float_get_index(&ptr, prop, index);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* not an array */
|
||||
switch (RNA_property_type(prop)) {
|
||||
case PROP_BOOLEAN:
|
||||
value= (float)RNA_property_boolean_get(&ptr, prop);
|
||||
break;
|
||||
case PROP_INT:
|
||||
if (RNA_property_array_length(&ptr, prop))
|
||||
value= (float)RNA_property_int_get_index(&ptr, prop, index);
|
||||
else
|
||||
value= (float)RNA_property_int_get(&ptr, prop);
|
||||
value= (float)RNA_property_int_get(&ptr, prop);
|
||||
break;
|
||||
case PROP_FLOAT:
|
||||
if (RNA_property_array_length(&ptr, prop))
|
||||
value= RNA_property_float_get_index(&ptr, prop, index);
|
||||
else
|
||||
value= RNA_property_float_get(&ptr, prop);
|
||||
value= RNA_property_float_get(&ptr, prop);
|
||||
break;
|
||||
case PROP_ENUM:
|
||||
value= (float)RNA_property_enum_get(&ptr, prop);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
if (G.f & G_DEBUG)
|
||||
|
@ -124,31 +124,27 @@ wcsleninu8(wchar_t *src)
|
||||
}
|
||||
|
||||
static int
|
||||
utf8slen(char *src)
|
||||
utf8slen(const char *strc)
|
||||
{
|
||||
int size = 0, index = 0;
|
||||
unsigned char c;
|
||||
|
||||
c = src[index++];
|
||||
while(c)
|
||||
{
|
||||
if((c & 0x80) == 0)
|
||||
{
|
||||
index += 0;
|
||||
int len=0;
|
||||
|
||||
while(*strc) {
|
||||
if ((*strc & 0xe0) == 0xc0) {
|
||||
if((strc[1] & 0x80) && (strc[1] & 0x40) == 0x00)
|
||||
strc++;
|
||||
} else if ((*strc & 0xf0) == 0xe0) {
|
||||
if((strc[1] & strc[2] & 0x80) && ((strc[1] | strc[2]) & 0x40) == 0x00)
|
||||
strc += 2;
|
||||
} else if ((*strc & 0xf8) == 0xf0) {
|
||||
if((strc[1] & strc[2] & strc[3] & 0x80) && ((strc[1] | strc[2] | strc[3]) & 0x40) == 0x00)
|
||||
strc += 3;
|
||||
}
|
||||
else if((c & 0xe0) == 0xe0)
|
||||
{
|
||||
index += 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
index += 1;
|
||||
}
|
||||
size += 1;
|
||||
c = src[index++];
|
||||
|
||||
strc++;
|
||||
len++;
|
||||
}
|
||||
|
||||
return size;
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
|
||||
@ -358,7 +354,7 @@ static VFontData *vfont_get_data(VFont *vfont)
|
||||
return vfont->data;
|
||||
}
|
||||
|
||||
VFont *load_vfont(char *name)
|
||||
VFont *load_vfont(const char *name)
|
||||
{
|
||||
char filename[FILE_MAXFILE];
|
||||
VFont *vfont= NULL;
|
||||
|
@ -128,7 +128,7 @@ void unlink_group(Group *group)
|
||||
group->id.us= 0;
|
||||
}
|
||||
|
||||
Group *add_group(char *name)
|
||||
Group *add_group(const char *name)
|
||||
{
|
||||
Group *group;
|
||||
|
||||
|
@ -341,7 +341,7 @@ IDProperty *IDP_CopyString(IDProperty *prop)
|
||||
}
|
||||
|
||||
|
||||
void IDP_AssignString(IDProperty *prop, char *st, int maxlen)
|
||||
void IDP_AssignString(IDProperty *prop, const char *st, int maxlen)
|
||||
{
|
||||
int stlen;
|
||||
|
||||
@ -356,7 +356,7 @@ void IDP_AssignString(IDProperty *prop, char *st, int maxlen)
|
||||
BLI_strncpy(prop->data.pointer, st, stlen);
|
||||
}
|
||||
|
||||
void IDP_ConcatStringC(IDProperty *prop, char *st)
|
||||
void IDP_ConcatStringC(IDProperty *prop, const char *st)
|
||||
{
|
||||
int newlen;
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user