diff options
133 files changed, 1462 insertions, 893 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index e5cd23ab66a..ebf7aa8a6c0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -729,10 +729,14 @@ elseif(WIN32) endif() if(WITH_PYTHON) - set(PYTHON_VERSION 3.2) - set(PYTHON_INCLUDE_DIRS "${LIBDIR}/python/include/python${PYTHON_VERSION}") - # set(PYTHON_BINARY python) # not used yet - set(PYTHON_LIBRARIES ${LIBDIR}/python/lib/python32.lib) + # normally cached but not since we include them with blender + set(PYTHON_VERSION 3.2) # CACHE STRING) + set(PYTHON_INCLUDE_DIR "${LIBDIR}/python/include/python${PYTHON_VERSION}") # CACHE PATH) + set(PYTHON_LIBRARY "${LIBDIR}/python/lib/python32.lib") #CACHE FILEPATH) + + # uncached vars + set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}") + set(PYTHON_LIBRARIES "${PYTHON_LIBRARY}") endif() set(PLATFORM_LINKFLAGS "/SUBSYSTEM:CONSOLE /STACK:2097152 /INCREMENTAL:NO /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcmrt.lib /NODEFAULTLIB:msvcurt.lib /NODEFAULTLIB:msvcrtd.lib") @@ -832,12 +836,14 @@ elseif(WIN32) endif() if(WITH_PYTHON) - set(PYTHON ${LIBDIR}/python) - set(PYTHON_VERSION 3.2) - set(PYTHON_INCLUDE_DIRS "${PYTHON}/include/python${PYTHON_VERSION}") - # set(PYTHON_BINARY python) # not used yet - set(PYTHON_LIBRARIES ${PYTHON}/lib/python32mw.lib) - set(PYTHON_LIBPATH ${PYTHON}/lib) + # normally cached but not since we include them with blender + set(PYTHON_VERSION 3.2) # CACHE STRING) + set(PYTHON_INCLUDE_DIR "${LIBDIR}/python/include/python${PYTHON_VERSION}") # CACHE PATH) + set(PYTHON_LIBRARY "${LIBDIR}/python/lib/python32mw.lib") # CACHE FILEPATH) + + # uncached vars + set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}") + set(PYTHON_LIBRARIES "${PYTHON_LIBRARY}") endif() set(PLATFORM_LINKFLAGS "--stack,2097152") @@ -888,27 +894,33 @@ elseif(APPLE) set(SNDFILE_LIBPATH ${SNDFILE}/lib ${FFMPEG}/lib) # TODO, deprecate endif() - set(PYTHON_VERSION 3.2) - - if(PYTHON_VERSION MATCHES 3.2) - # we use precompiled libraries for py 3.2 and up by default - - set(PYTHON ${LIBDIR}/python) - set(PYTHON_INCLUDE_DIRS "${PYTHON}/include/python${PYTHON_VERSION}") - # set(PYTHON_BINARY "${PYTHON}/bin/python${PYTHON_VERSION}") # not used yet - set(PYTHON_LIBRARIES python${PYTHON_VERSION}) - set(PYTHON_LIBPATH "${PYTHON}/lib/python${PYTHON_VERSION}") - # set(PYTHON_LINKFLAGS "-u _PyMac_Error") # won't build with this enabled - else() - # otherwise, use custom system framework - - set(PYTHON /System/Library/Frameworks/Python.framework/Versions/) + if(WITH_PYTHON) set(PYTHON_VERSION 3.2) - set(PYTHON_INCLUDE_DIRS "${PYTHON}${PYTHON_VERSION}/include/python${PYTHON_VERSION}") - # set(PYTHON_BINARY ${PYTHON}${PYTHON_VERSION}/bin/python${PYTHON_VERSION}) # not used yet - set(PYTHON_LIBRARIES "") - set(PYTHON_LIBPATH ${PYTHON}${PYTHON_VERSION}/lib/python${PYTHON_VERSION}/config) - set(PYTHON_LINKFLAGS "-u _PyMac_Error -framework System -framework Python") + if(PYTHON_VERSION MATCHES 3.2) + # we use precompiled libraries for py 3.2 and up by default + + # normally cached but not since we include them with blender + set(PYTHON_INCLUDE_DIR "${LIBDIR}/python/include/python${PYTHON_VERSION}") + # set(PYTHON_BINARY "${LIBDIR}/python/bin/python${PYTHON_VERSION}") # not used yet + set(PYTHON_LIBRARY python${PYTHON_VERSION}) + set(PYTHON_LIBPATH "${LIBDIR}/python/lib/python${PYTHON_VERSION}") + # set(PYTHON_LINKFLAGS "-u _PyMac_Error") # won't build with this enabled + else() + # otherwise, use custom system framework + # *not used but maintained incase some dev wants to* + + set(PYTHON "/System/Library/Frameworks/Python.framework/Versions/" CACHE PATH) + set(PYTHON_INCLUDE_DIR "${PYTHON}${PYTHON_VERSION}/include/python${PYTHON_VERSION}" CACHE PATH) + # set(PYTHON_BINARY ${PYTHON}${PYTHON_VERSION}/bin/python${PYTHON_VERSION}) # not used yet + set(PYTHON_LIBRARY "" CACHE FILEPATH) + set(PYTHON_LIBPATH "${PYTHON}${PYTHON_VERSION}/lib/python${PYTHON_VERSION}/config" CACHE PATH) + set(PYTHON_LINKFLAGS "-u _PyMac_Error -framework System -framework Python" CACHE STRING) + unset(PYTHON) + endif() + + # uncached vars + set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}") + set(PYTHON_LIBRARIES "${PYTHON_LIBRARY}") endif() if(WITH_INTERNATIONAL) @@ -1203,6 +1215,20 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") endif() endif() + +# ensure python header is found since detection can fail, this could happen +# with _any_ library but since we used a fixed python version this tends to +# be most problematic. +if(WITH_PYTHON) + if(NOT EXISTS "${PYTHON_INCLUDE_DIR}/Python.h") + message(FATAL_ERROR "Missing: \"${PYTHON_INCLUDE_DIR}/Python.h\",\n" + "Set the cache entry 'PYTHON_INCLUDE_DIR' to point " + "to a valid python include path. Containing " + "Python.h for python version \"${PYTHON_VERSION}\"") + endif() +endif() + + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PLATFORM_CFLAGS} ${C_WARNINGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PLATFORM_CFLAGS} ${CXX_WARNINGS}") diff --git a/GNUmakefile b/GNUmakefile index b55890f9271..d1a60ce5e37 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -99,14 +99,18 @@ test: # run pep8 check check on scripts we distribute. test_pep8: - python source/tests/pep8.py > test_pep8.log 2>&1 + python3 source/tests/pep8.py > test_pep8.log 2>&1 @echo "written: test_pep8.log" # run some checks on our cmakefiles. test_cmake: - python build_files/cmake/cmake_consistency_check.py > test_cmake_consistency.log 2>&1 + python3 build_files/cmake/cmake_consistency_check.py > test_cmake_consistency.log 2>&1 @echo "written: test_cmake_consistency.log" +# run deprecation tests, see if we have anything to remove. +test_deprecated: + python3 source/tests/check_deprecated.py + clean: make -C $(BUILD_DIR) clean diff --git a/SConstruct b/SConstruct index 29146018704..053f414c954 100644 --- a/SConstruct +++ b/SConstruct @@ -361,6 +361,23 @@ if not quickie and do_clean: print B.bc.HEADER+'Already Clean, nothing to do.'+B.bc.ENDC Exit() + +# ensure python header is found since detection can fail, this could happen +# with _any_ library but since we used a fixed python version this tends to +# be most problematic. +if env['WITH_BF_PYTHON']: + py_h = os.path.join(Dir(env.subst('${BF_PYTHON_INC}')).abspath, "Python.h") + + if not os.path.exists(py_h): + print("\nMissing: \"" + env.subst('${BF_PYTHON_INC}') + os.sep + "Python.h\",\n" + " Set 'BF_PYTHON_INC' to point " + "to a valid python include path.\n Containing " + "Python.h for python version \"" + env.subst('${BF_PYTHON_VERSION}') + "\"") + + Exit() + del py_h + + if not os.path.isdir ( B.root_build_dir): os.makedirs ( B.root_build_dir ) os.makedirs ( B.root_build_dir + 'source' ) diff --git a/build_files/cmake/cmake_consistency_check.py b/build_files/cmake/cmake_consistency_check.py index c13da8775b3..4b35e34a5cd 100755 --- a/build_files/cmake/cmake_consistency_check.py +++ b/build_files/cmake/cmake_consistency_check.py @@ -35,6 +35,21 @@ global_c = set() global_refs = {} +def replace_line(f, i, text, keep_indent=True): + file_handle = open(f, 'r') + data = file_handle.readlines() + file_handle.close() + + l = data[i] + ws = l[:len(l) - len(l.lstrip())] + + data[i] = "%s%s\n" % (ws, text) + + file_handle = open(f, 'w') + file_handle.writelines(data) + file_handle.close() + + def source_list(path, filename_check=None): for dirpath, dirnames, filenames in os.walk(path): @@ -77,7 +92,20 @@ def cmake_get_src(f): found = False i = 0 # print(f) + + def is_definition(l, f, i, name): + if ('set(%s' % name) in l or ('set(' in l and l.endswith(name)): + if len(l.split()) > 1: + raise Exception("strict formatting not kept 'set(%s*' %s:%d" % (name, f, i)) + return True + + if ("list(APPEND %s" % name) in l or ('list(APPEND ' in l and l.endswith(name)): + if l.endswith(")"): + raise Exception("strict formatting not kept 'list(APPEND %s...)' on 1 line %s:%d" % (name, f, i)) + return True + while it is not None: + context_name = "" while it is not None: i += 1 try: @@ -87,16 +115,13 @@ def cmake_get_src(f): break l = l.strip() if not l.startswith("#"): - if 'set(SRC' in l or ('set(' in l and l.endswith("SRC")): - if len(l.split()) > 1: - raise Exception("strict formatting not kept 'set(SRC*' %s:%d" % (f, i)) - found = True + found = is_definition(l, f, i, "SRC") + if found: + context_name = "SRC" break - - if "list(APPEND SRC" in l or ('list(APPEND ' in l and l.endswith("SRC")): - if l.endswith(")"): - raise Exception("strict formatting not kept 'list(APPEND SRC...)' on 1 line %s:%d" % (f, i)) - found = True + found = is_definition(l, f, i, "INC") + if found: + context_name = "INC" break if found: @@ -125,30 +150,45 @@ def cmake_get_src(f): if not l: pass elif l.startswith("$"): - # assume if it ends with SRC we know about it - if not l.split("}")[0].endswith("SRC"): - print("Can't use var '%s' %s:%d" % (l, f, i)) + if context_name == "SRC": + # assume if it ends with context_name we know about it + if not l.split("}")[0].endswith(context_name): + print("Can't use var '%s' %s:%d" % (l, f, i)) elif len(l.split()) > 1: raise Exception("Multi-line define '%s' %s:%d" % (l, f, i)) else: new_file = normpath(join(cmake_base, l)) - if is_c_header(new_file): - sources_h.append(new_file) - global_refs.setdefault(new_file, []).append((f, i)) - elif is_c(new_file): - sources_c.append(new_file) - global_refs.setdefault(new_file, []).append((f, i)) - elif l in ("PARENT_SCOPE", ): - # cmake var, ignore - pass - elif new_file.endswith(".list"): - pass - elif new_file.endswith(".def"): - pass - else: - raise Exception("unknown file type - not c or h %s -> %s" % (f, new_file)) - + if context_name == "SRC": + if is_c_header(new_file): + sources_h.append(new_file) + global_refs.setdefault(new_file, []).append((f, i)) + elif is_c(new_file): + sources_c.append(new_file) + global_refs.setdefault(new_file, []).append((f, i)) + elif l in ("PARENT_SCOPE", ): + # cmake var, ignore + pass + elif new_file.endswith(".list"): + pass + elif new_file.endswith(".def"): + pass + else: + raise Exception("unknown file type - not c or h %s -> %s" % (f, new_file)) + + elif context_name == "INC": + if os.path.isdir(new_file): + new_path_rel = os.path.relpath(new_file, cmake_base) + + if new_path_rel != l: + print("overly relative path:\n %s:%d\n %s\n %s" % (f, i, l, new_path_rel)) + + ## Save time. just replace the line + # replace_line(f, i - 1, new_path_rel) + + else: + raise Exception("non existant include %s:%d -> %s" % (f, i, new_file)) + # print(new_file) global_h.update(set(sources_h)) @@ -166,6 +206,10 @@ def cmake_get_src(f): if ff not in sources_c: print(" missing: " + ff) ''' + + # reset + sources_h[:] = [] + sources_c[:] = [] filen.close() diff --git a/extern/binreloc/CMakeLists.txt b/extern/binreloc/CMakeLists.txt index a4f85a2fdfd..753e28091d3 100644 --- a/extern/binreloc/CMakeLists.txt +++ b/extern/binreloc/CMakeLists.txt @@ -19,7 +19,7 @@ # set(INC - ./include + include ) set(INC_SYS diff --git a/extern/glew/CMakeLists.txt b/extern/glew/CMakeLists.txt index 35beacab6a3..87f8bb6e940 100644 --- a/extern/glew/CMakeLists.txt +++ b/extern/glew/CMakeLists.txt @@ -25,7 +25,7 @@ # ***** END GPL LICENSE BLOCK ***** set(INC - ./include + include ) set(INC_SYS @@ -33,7 +33,9 @@ set(INC_SYS ) if(UNIX) - list(APPEND INC_SYS ${X11_X11_INCLUDE_PATH}) + list(APPEND INC_SYS + ${X11_X11_INCLUDE_PATH} + ) endif() set(SRC diff --git a/extern/lzo/CMakeLists.txt b/extern/lzo/CMakeLists.txt index 10ea2c58f7c..11eb18520b6 100644 --- a/extern/lzo/CMakeLists.txt +++ b/extern/lzo/CMakeLists.txt @@ -25,7 +25,7 @@ # ***** END GPL LICENSE BLOCK ***** set(INC - include + ) set(INC_SYS diff --git a/intern/audaspace/CMakeLists.txt b/intern/audaspace/CMakeLists.txt index ab88c9ecabd..7eef13b103b 100644 --- a/intern/audaspace/CMakeLists.txt +++ b/intern/audaspace/CMakeLists.txt @@ -22,9 +22,9 @@ set(INC . - intern FX SRC + intern ../ffmpeg ) @@ -159,8 +159,12 @@ set(SRC if(WITH_CODEC_FFMPEG) add_definitions(-DWITH_FFMPEG) - list(APPEND INC ffmpeg) - list(APPEND INC_SYS ${FFMPEG_INCLUDE_DIRS}) + list(APPEND INC + ffmpeg + ) + list(APPEND INC_SYS + ${FFMPEG_INCLUDE_DIRS} + ) list(APPEND SRC ffmpeg/AUD_FFMPEGFactory.cpp ffmpeg/AUD_FFMPEGReader.cpp @@ -172,8 +176,12 @@ endif() if(WITH_SDL) add_definitions(-DWITH_SDL) - list(APPEND INC SDL) - list(APPEND INC_SYS ${SDL_INCLUDE_DIR}) + list(APPEND INC + SDL + ) + list(APPEND INC_SYS + ${SDL_INCLUDE_DIR} + ) list(APPEND SRC SDL/AUD_SDLDevice.cpp @@ -183,8 +191,12 @@ endif() if(WITH_OPENAL) add_definitions(-DWITH_OPENAL) - list(APPEND INC OpenAL) - list(APPEND INC_SYS ${OPENAL_INCLUDE_DIR}) + list(APPEND INC + OpenAL + ) + list(APPEND INC_SYS + ${OPENAL_INCLUDE_DIR} + ) list(APPEND SRC OpenAL/AUD_OpenALDevice.cpp @@ -194,8 +206,12 @@ endif() if(WITH_JACK) add_definitions(-DWITH_JACK) - list(APPEND INC jack) - list(APPEND INC_SYS ${JACK_INCLUDE_DIRS}) + list(APPEND INC + jack + ) + list(APPEND INC_SYS + ${JACK_INCLUDE_DIRS} + ) list(APPEND SRC jack/AUD_JackDevice.cpp @@ -205,8 +221,12 @@ endif() if(WITH_CODEC_SNDFILE) add_definitions(-DWITH_SNDFILE) - list(APPEND INC sndfile) - list(APPEND INC_SYS ${SNDFILE_INCLUDE_DIRS}) + list(APPEND INC + sndfile + ) + list(APPEND INC_SYS + ${SNDFILE_INCLUDE_DIRS} + ) list(APPEND SRC sndfile/AUD_SndFileFactory.cpp sndfile/AUD_SndFileReader.cpp @@ -218,7 +238,9 @@ endif() if(WITH_SAMPLERATE) add_definitions(-DWITH_SAMPLERATE) - list(APPEND INC_SYS ${SAMPLERATE_INCLUDE_DIRS}) + list(APPEND INC_SYS + ${SAMPLERATE_INCLUDE_DIRS} + ) list(APPEND SRC SRC/AUD_SRCResampleFactory.cpp SRC/AUD_SRCResampleReader.cpp @@ -230,8 +252,12 @@ endif() if(WITH_FFTW3 AND FALSE) add_definitions(-DWITH_FFTW3) - list(APPEND INC fftw) - list(APPEND INC_SYS ${FFTW3_INCLUDE_DIRS}) + list(APPEND INC + fftw + ) + list(APPEND INC_SYS + ${FFTW3_INCLUDE_DIRS} + ) list(APPEND SRC fftw/AUD_BandPassFactory.cpp fftw/AUD_BandPassReader.cpp @@ -242,8 +268,12 @@ if(WITH_FFTW3 AND FALSE) endif() if(WITH_PYTHON) - list(APPEND INC Python) - list(APPEND INC_SYS ${PYTHON_INCLUDE_DIRS}) + list(APPEND INC + Python + ) + list(APPEND INC_SYS + ${PYTHON_INCLUDE_DIRS} + ) list(APPEND SRC Python/AUD_PyAPI.cpp diff --git a/intern/boolop/CMakeLists.txt b/intern/boolop/CMakeLists.txt index 7a95d556172..742c0f1d42c 100644 --- a/intern/boolop/CMakeLists.txt +++ b/intern/boolop/CMakeLists.txt @@ -26,11 +26,11 @@ set(INC . - ./intern - ./extern - ../memutil + extern + intern ../container ../guardedalloc + ../memutil ../moto/include ../../source/blender/blenlib ../../source/blender/makesdna diff --git a/intern/bsp/CMakeLists.txt b/intern/bsp/CMakeLists.txt index 792f6aa1327..a844db3257e 100644 --- a/intern/bsp/CMakeLists.txt +++ b/intern/bsp/CMakeLists.txt @@ -25,11 +25,11 @@ # ***** END GPL LICENSE BLOCK ***** set(INC - ./intern + intern ../container ../guardedalloc - ../moto/include ../memutil + ../moto/include ) set(INC_SYS diff --git a/intern/ffmpeg/ffmpeg_compat.h b/intern/ffmpeg/ffmpeg_compat.h index d8edffbfe0b..fae8590568d 100644 --- a/intern/ffmpeg/ffmpeg_compat.h +++ b/intern/ffmpeg/ffmpeg_compat.h @@ -40,7 +40,7 @@ #define FFMPEG_HAVE_AVIO 1 #endif -#if (LIBAVCODEC_VERSION_MAJOR > 53) || ((LIBAVCODEC_VERSION_MAJOR == 53) && (LIBAVCODEC_VERSION_MINOR > 1)) || ((LIBAVCODEC_VERSION_MAJOR == 53) && (LIBAVCODEC_VERSION_MINOR == 1) && (LIBAVCODEC_VERSION_MICRO >= 1)) || ((LIBAVCODEC_VERSION_MAJOR == 52) && (LIBAVCODEC_VERSION_MINOR >= 122)) +#if (LIBAVCODEC_VERSION_MAJOR > 53) || ((LIBAVCODEC_VERSION_MAJOR == 53) && (LIBAVCODEC_VERSION_MINOR > 1)) || ((LIBAVCODEC_VERSION_MAJOR == 53) && (LIBAVCODEC_VERSION_MINOR == 1) && (LIBAVCODEC_VERSION_MICRO >= 1)) || ((LIBAVCODEC_VERSION_MAJOR == 52) && (LIBAVCODEC_VERSION_MINOR >= 121)) #define FFMPEG_HAVE_DEFAULT_VAL_UNION 1 #endif diff --git a/intern/ghost/CMakeLists.txt b/intern/ghost/CMakeLists.txt index 41c70b7cd16..ccd763ef42c 100644 --- a/intern/ghost/CMakeLists.txt +++ b/intern/ghost/CMakeLists.txt @@ -37,9 +37,8 @@ set(INC_SYS set(SRC intern/GHOST_Buttons.cpp - intern/GHOST_CallbackEventConsumer.cpp intern/GHOST_C-api.cpp - intern/GHOST_Path-api.cpp + intern/GHOST_CallbackEventConsumer.cpp intern/GHOST_DisplayManager.cpp intern/GHOST_EventManager.cpp intern/GHOST_ISystem.cpp @@ -47,6 +46,7 @@ set(SRC intern/GHOST_ModifierKeys.cpp intern/GHOST_NDOFManager.cpp intern/GHOST_Path-api.cpp + intern/GHOST_Path-api.cpp intern/GHOST_Rect.cpp intern/GHOST_System.cpp intern/GHOST_TimerManager.cpp @@ -63,6 +63,7 @@ set(SRC GHOST_Path-api.h GHOST_Rect.h GHOST_Types.h + intern/GHOST_Buttons.h intern/GHOST_CallbackEventConsumer.h intern/GHOST_Debug.h @@ -146,7 +147,9 @@ if(WITH_HEADLESS OR WITH_GHOST_SDL) ) endif() - list(APPEND INC_SYS ${SDL_INCLUDE_DIR}) + list(APPEND INC_SYS + ${SDL_INCLUDE_DIR} + ) elseif(APPLE) if(WITH_COCOA) @@ -185,7 +188,9 @@ elseif(UNIX) add_definitions(-DWITH_X11_XINPUT) endif() - list(APPEND INC_SYS ${X11_X11_INCLUDE_PATH}) + list(APPEND INC_SYS + ${X11_X11_INCLUDE_PATH} + ) list(APPEND SRC intern/GHOST_DisplayManagerX11.cpp @@ -205,7 +210,9 @@ elseif(UNIX) if(X11_XF86keysym_INCLUDE_PATH) add_definitions(-DWITH_XF86KEYSYM) - list(APPEND INC_SYS ${X11_XF86keysym_INCLUDE_PATH}) + list(APPEND INC_SYS + ${X11_XF86keysym_INCLUDE_PATH} + ) endif() elseif(WIN32) @@ -213,7 +220,9 @@ elseif(WIN32) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX") endif() - list(APPEND INC_SYS ${WINTAB_INC}) + list(APPEND INC_SYS + ${WINTAB_INC} + ) list(APPEND SRC intern/GHOST_DisplayManagerWin32.cpp diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp index 3ebd24c008b..dd296fa979c 100644 --- a/intern/ghost/intern/GHOST_SystemX11.cpp +++ b/intern/ghost/intern/GHOST_SystemX11.cpp @@ -150,8 +150,9 @@ GHOST_SystemX11( if (gettimeofday(&tv,NULL) == -1) { GHOST_ASSERT(false,"Could not instantiate timer!"); } - - m_start_time = GHOST_TUns64(tv.tv_sec*1000 + tv.tv_usec/1000); + + // Taking care not to overflow the tv.tv_sec*1000 + m_start_time = GHOST_TUns64(tv.tv_sec)*1000 + tv.tv_usec/1000; /* use detectable autorepeate, mac and windows also do this */ @@ -199,7 +200,8 @@ getMilliSeconds( GHOST_ASSERT(false,"Could not compute time!"); } - return GHOST_TUns64(tv.tv_sec*1000 + tv.tv_usec/1000) - m_start_time; + // Taking care not to overflow the tv.tv_sec*1000 + return GHOST_TUns64(tv.tv_sec)*1000 + tv.tv_usec/1000 - m_start_time; } GHOST_TUns8 diff --git a/intern/mikktspace/mikktspace.c b/intern/mikktspace/mikktspace.c index c05ada84773..1bb73553012 100644 --- a/intern/mikktspace/mikktspace.c +++ b/intern/mikktspace/mikktspace.c @@ -243,7 +243,7 @@ tbool genTangSpace(const SMikkTSpaceContext * pContext, const float fAngularThre int iNrActiveGroups = 0, index = 0; const int iNrFaces = pContext->m_pInterface->m_getNumFaces(pContext); tbool bRes = TFALSE; - const float fThresCos = (const float) cos((fAngularThreshold*(float)M_PI)/180.0f); + const float fThresCos = (float) cos((fAngularThreshold*(float)M_PI)/180.0f); // verify all call-backs have been set if( pContext->m_pInterface->m_getNumFaces==NULL || @@ -1411,7 +1411,7 @@ STSpace EvalTspace(int face_indices[], const int iFaces, const int piTriListIn[] // weight contribution by the angle // between the two edge vectors fCos = vdot(v1,v2); fCos=fCos>1?1:(fCos<(-1) ? (-1) : fCos); - fAngle = (const float) acos(fCos); + fAngle = (float) acos(fCos); fMagS = pTriInfos[f].fMagS; fMagT = pTriInfos[f].fMagT; diff --git a/intern/smoke/CMakeLists.txt b/intern/smoke/CMakeLists.txt index 174ee8bc3ed..094d398a83c 100644 --- a/intern/smoke/CMakeLists.txt +++ b/intern/smoke/CMakeLists.txt @@ -89,7 +89,9 @@ endif() if(WITH_FFTW3) add_definitions(-DFFTW3=1) - list(APPEND INC ${FFTW3_INCLUDE_DIRS}) + list(APPEND INC + ${FFTW3_INCLUDE_DIRS} + ) endif() blender_add_lib(bf_intern_smoke "${SRC}" "${INC}" "${INC_SYS}") diff --git a/release/scripts/modules/addon_utils.py b/release/scripts/modules/addon_utils.py index 07f1dc618dc..cf74282d064 100644 --- a/release/scripts/modules/addon_utils.py +++ b/release/scripts/modules/addon_utils.py @@ -31,6 +31,8 @@ __all__ = ( import bpy as _bpy +error_duplicates = False + def paths(): # RELEASE SCRIPTS: official scripts distributed in Blender releases paths = _bpy.utils.script_paths("addons") @@ -47,8 +49,11 @@ def paths(): def modules(module_cache): + global error_duplicates import os + error_duplicates = False + path_list = paths() # fake module importing @@ -117,7 +122,12 @@ def modules(module_cache): modules_stale -= {mod_name} mod = module_cache.get(mod_name) if mod: - if mod.__time__ != os.path.getmtime(mod_path): + if mod.__file__ != mod_path: + print("multiple addons with the same name:\n %r\n %r" % + (mod.__file__, mod_path)) + error_duplicates = True + + elif mod.__time__ != os.path.getmtime(mod_path): print("reloading addon:", mod_name, mod.__time__, os.path.getmtime(mod_path), mod_path) del module_cache[mod_name] mod = None diff --git a/release/scripts/modules/bpy_extras/io_utils.py b/release/scripts/modules/bpy_extras/io_utils.py index cfa2233f7b6..9545e20b025 100644 --- a/release/scripts/modules/bpy_extras/io_utils.py +++ b/release/scripts/modules/bpy_extras/io_utils.py @@ -22,6 +22,7 @@ __all__ = ( "ExportHelper", "ImportHelper", "axis_conversion", + "axis_conversion_ensure", "create_derived_objects", "free_derived_objects", "unpack_list", @@ -154,12 +155,50 @@ def axis_conversion(from_forward='Y', from_up='Z', to_forward='Y', to_up='Z'): if from_forward == to_forward and from_up == to_up: return Matrix().to_3x3() + if from_forward[-1] == from_up[-1] or to_forward[-1] == to_up[-1]: + raise Exception("invalid axis arguments passed, " + "can't use up/forward on the same axis.") + value = reduce(int.__or__, (_axis_convert_num[a] << (i * 3) for i, a in enumerate((from_forward, from_up, to_forward, to_up)))) for i, axis_lut in enumerate(_axis_convert_lut): if value in axis_lut: return Matrix(_axis_convert_matrix[i]) - assert("internal error") + assert(0) + + +def axis_conversion_ensure(operator, forward_attr, up_attr): + """ + Function to ensure an operator has valid axis conversion settings, intended + to be used from :class:`Operator.check`. + + :arg operator: the operator to access axis attributes from. + :type operator: :class:`Operator` + :arg forward_attr: + :type forward_attr: string + :arg up_attr: the directory the *filepath* will be referenced from (normally the export path). + :type up_attr: string + :return: True if the value was modified. + :rtype: boolean + """ + def validate(axis_forward, axis_up): + if axis_forward[-1] == axis_up[-1]: + axis_up = axis_up[0:-1] + 'XYZ'[('XYZ'.index(axis_up[-1]) + 1) % 3] + + return axis_forward, axis_up + + change = False + + axis = getattr(operator, forward_attr), getattr(operator, up_attr) + axis_new = validate(*axis) + + if axis != axis_new: + setattr(operator, forward_attr, axis_new[0]) + setattr(operator, up_attr, axis_new[1]) + + return True + else: + return False # return a tuple (free, object list), free is True if memory should be freed later with free_derived_objects() diff --git a/release/scripts/startup/bl_operators/uvcalc_smart_project.py b/release/scripts/startup/bl_operators/uvcalc_smart_project.py index 7ea89cfa479..9c3be84b807 100644 --- a/release/scripts/startup/bl_operators/uvcalc_smart_project.py +++ b/release/scripts/startup/bl_operators/uvcalc_smart_project.py @@ -747,14 +747,8 @@ def packIslands(islandList): def VectoQuat(vec): - a3 = vec.normalized() - 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).normalized() - a2 = a3.cross(a1) - return Matrix((a1, a2, a3)).to_quaternion() + vec = vec.normalized() + return vec.to_track_quat('Z', 'X' if abs(vec.x) > 0.5 else 'Y').inverted() class thickface(object): diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py index 6a809aefb9d..139b3205835 100644 --- a/release/scripts/startup/bl_ui/space_userpref.py +++ b/release/scripts/startup/bl_ui/space_userpref.py @@ -889,6 +889,16 @@ class USERPREF_PT_addons(bpy.types.Panel): return True return False + @staticmethod + def draw_error(layout, message): + lines = message.split("\n") + box = layout.box() + rowsub = box.row() + rowsub.label(lines[0]) + rowsub.label(icon='ERROR') + for l in lines[1:]: + box.label(l) + def draw(self, context): layout = self.layout @@ -909,6 +919,14 @@ class USERPREF_PT_addons(bpy.types.Panel): col = split.column() + # set in addon_utils.modules(...) + if addon_utils.error_duplicates: + self.draw_error(col, + "Multiple addons using the same name found!\n" + "likely a problem with the script search path.\n" + "(see console for details)", + ) + filter = context.window_manager.addon_filter search = context.window_manager.addon_search.lower() support = context.window_manager.addon_support diff --git a/release/scripts/templates/batch_export.py b/release/scripts/templates/batch_export.py new file mode 100644 index 00000000000..aa0e601725b --- /dev/null +++ b/release/scripts/templates/batch_export.py @@ -0,0 +1,33 @@ +# exports each selected object into its own file + +import bpy +import os + +# export to blend file location +basedir = os.path.dirname(bpy.data.filepath) + +if not basedir: + raise Exception("Blend file is not saved") + +selection = bpy.context.selected_objects + +bpy.ops.object.select_all(action='DESELECT') + +for obj in selection: + + obj.select = True + + name = bpy.path.clean_name(obj.name) + fn = os.path.join(basedir, name) + + bpy.ops.export_scene.fbx(filepath=fn + ".fbx", use_selection=True) + + ## Can be used for multiple formats + # bpy.ops.export_scene.x3d(filepath=fn + ".x3d", use_selection=True) + + obj.select = False + + print("written:", fn) + +for obj in selection: + obj.select = True diff --git a/source/blender/avi/CMakeLists.txt b/source/blender/avi/CMakeLists.txt index bae61fd678b..0fd6435ec4e 100644 --- a/source/blender/avi/CMakeLists.txt +++ b/source/blender/avi/CMakeLists.txt @@ -26,8 +26,8 @@ set(INC . - ../../../intern/guardedalloc ../blenlib + ../../../intern/guardedalloc ) set(INC_SYS diff --git a/source/blender/blenfont/CMakeLists.txt b/source/blender/blenfont/CMakeLists.txt index b915764c1bb..82099d4f125 100644 --- a/source/blender/blenfont/CMakeLists.txt +++ b/source/blender/blenfont/CMakeLists.txt @@ -24,10 +24,10 @@ set(INC . + ../blenkernel ../blenlib - ../makesdna ../editors/include - ../blenkernel + ../makesdna ../../../intern/guardedalloc ) @@ -50,7 +50,9 @@ set(SRC ) if(WITH_INTERNATIONAL) - list(APPEND INC_SYS ${GETTEXT_INC}) + list(APPEND INC_SYS + ${GETTEXT_INC} + ) add_definitions(-DINTERNATIONAL) endif() diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index 717e5e06f7d..dc8706f151c 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -32,8 +32,10 @@ endif() set(INC . ../avi + ../blenfont ../blenlib ../blenloader + ../editors/include ../gpu ../ikplugin ../imbuf @@ -42,18 +44,19 @@ set(INC ../bmesh ../modifiers ../nodes - ../editors/include ../render/extern/include - ../../../intern/bsp/extern ../blenfont + ../../../intern/bsp/extern ../../../intern/decimation/extern ../../../intern/elbeem/extern ../../../intern/guardedalloc ../../../intern/iksolver/extern ../../../intern/memutil + ../../../intern/mikktspace ../../../intern/opennl/extern ../../../intern/smoke/extern - ../../../intern/mikktspace - ../../../source/blender/windowmanager # XXX - BAD LEVEL CALL WM_api.h + + # XXX - BAD LEVEL CALL WM_api.h + ../windowmanager ) set(INC_SYS @@ -246,12 +249,16 @@ if(WITH_AUDASPACE) endif() if(WITH_BULLET) - list(APPEND INC ../../../extern/bullet2/src) + list(APPEND INC + ../../../extern/bullet2/src + ) add_definitions(-DUSE_BULLET) endif() if(WITH_MOD_CLOTH_ELTOPO) - list(APPEND INC ../../../extern/eltopo) + list(APPEND INC + ../../../extern/eltopo + ) add_definitions(-DWITH_ELTOPO) endif() @@ -280,20 +287,32 @@ if(WITH_IMAGE_HDR) endif() if(WITH_CODEC_QUICKTIME) - list(APPEND INC ../quicktime) - list(APPEND INC_SYS ${QUICKTIME_INCLUDE_DIRS}) + list(APPEND INC + ../quicktime + ) + list(APPEND INC_SYS + ${QUICKTIME_INCLUDE_DIRS} + ) add_definitions(-DWITH_QUICKTIME) endif() if(WITH_CODEC_FFMPEG) - list(APPEND INC ../../../intern/ffmpeg) - list(APPEND INC_SYS ${FFMPEG_INCLUDE_DIRS}) + list(APPEND INC + ../../../intern/ffmpeg + ) + list(APPEND INC_SYS + ${FFMPEG_INCLUDE_DIRS} + ) add_definitions(-DWITH_FFMPEG) endif() if(WITH_PYTHON) - list(APPEND INC ../python) - list(APPEND INC_SYS ${PYTHON_INCLUDE_DIRS}) + list(APPEND INC + ../python + ) + list(APPEND INC_SYS + ${PYTHON_INCLUDE_DIRS} + ) add_definitions(-DWITH_PYTHON) if(WITH_PYTHON_SECURITY) @@ -318,12 +337,16 @@ if(WITH_JACK) endif() if(WITH_LZO) - list(APPEND INC_SYS ../../../extern/lzo/minilzo) + list(APPEND INC_SYS + ../../../extern/lzo/minilzo + ) add_definitions(-DWITH_LZO) endif() if(WITH_LZMA) - list(APPEND INC_SYS ../../../extern/lzma) + list(APPEND INC_SYS + ../../../extern/lzma + ) add_definitions(-DWITH_LZMA) endif() diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 399273ab99e..1aa58f32d94 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -3987,7 +3987,7 @@ static void system_step(ParticleSimulationData *sim, float cfra) BKE_ptcache_id_time(pid, sim->scene, 0.0f, &startframe, &endframe, NULL); /* clear everythin on start frame */ - if((int)cfra == startframe) { + if(cfra == startframe) { BKE_ptcache_id_reset(sim->scene, pid, PTCACHE_RESET_OUTDATED); BKE_ptcache_validate(cache, startframe); cache->flag &= ~PTCACHE_REDO_NEEDED; diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 265cc3eeb79..d6a152a5280 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -3232,9 +3232,10 @@ int seq_swap(Sequence *seq_a, Sequence *seq_b, const char **error_str) { char name[sizeof(seq_a->name)]; - if(seq_a->len != seq_b->len) + if(seq_a->len != seq_b->len) { *error_str= "Strips must be the same length"; return 0; + } /* type checking, could be more advanced but disalow sound vs non-sound copy */ if(seq_a->type != seq_b->type) { diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt index 13245c00993..0fde91000b4 100644 --- a/source/blender/blenlib/CMakeLists.txt +++ b/source/blender/blenlib/CMakeLists.txt @@ -26,10 +26,10 @@ set(INC . - ../makesdna ../blenkernel ../blenloader ../gpu + ../makesdna ../../../intern/ghost ../../../intern/guardedalloc ) @@ -143,7 +143,9 @@ set(SRC ) if(WITH_BINRELOC) - list(APPEND INC_SYS "${BINRELOC_INCLUDE_DIRS}") + list(APPEND INC_SYS + ${BINRELOC_INCLUDE_DIRS} + ) add_definitions(-DWITH_BINRELOC) endif() diff --git a/source/blender/blenloader/CMakeLists.txt b/source/blender/blenloader/CMakeLists.txt index 312a6546e22..be15b191c8a 100644 --- a/source/blender/blenloader/CMakeLists.txt +++ b/source/blender/blenloader/CMakeLists.txt @@ -26,8 +26,8 @@ set(INC . - ../blenlib ../blenkernel + ../blenlib ../makesdna ../makesrna ../render/extern/include diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index b9592e52103..6e043275fcb 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -75,6 +75,7 @@ #include "DNA_node_types.h" #include "DNA_object_fluidsim.h" // NT #include "DNA_packedFile_types.h" +#include "DNA_particle_types.h" #include "DNA_property_types.h" #include "DNA_text_types.h" #include "DNA_view3d_types.h" @@ -3173,9 +3174,37 @@ static void lib_link_particlesettings(FileData *fd, Main *main) if(part->effector_weights) part->effector_weights->group = newlibadr(fd, part->id.lib, part->effector_weights->group); - dw = part->dupliweights.first; - for(; dw; dw=dw->next) - dw->ob = newlibadr(fd, part->id.lib, dw->ob); + if(part->dupliweights.first) { + int index_ok = 0; + /* check for old files without indices (all indexes 0) */ + dw = part->dupliweights.first; + if(part->dupliweights.first == part->dupliweights.last) { + /* special case for only one object in the group */ + index_ok = 1; + } + else { + for(; dw; dw=dw->next) { + if(dw->index > 0) { + index_ok = 1; + break; + } + } + } + + if(index_ok) { + /* if we have indexes, let's use them */ + dw = part->dupliweights.first; + for(; dw; dw=dw->next) { + GroupObject *go = (GroupObject *)BLI_findlink(&part->dup_group->gobject, dw->index); + dw->ob = go ? go->ob : NULL; + } + } + else { + /* otherwise try to get objects from own library (won't work on library linked groups) */ + for(; dw; dw=dw->next) + dw->ob = newlibadr(fd, part->id.lib, dw->ob); + } + } if(part->boids) { BoidState *state = part->boids->states.first; diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index efa78f04360..f99c152681c 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -837,6 +837,7 @@ static void write_particlesettings(WriteData *wd, ListBase *idbase) { ParticleSettings *part; ParticleDupliWeight *dw; + GroupObject *go; int a; part= idbase->first; @@ -851,8 +852,16 @@ static void write_particlesettings(WriteData *wd, ListBase *idbase) writestruct(wd, DATA, "EffectorWeights", 1, part->effector_weights); dw = part->dupliweights.first; - for(; dw; dw=dw->next) + for(; dw; dw=dw->next) { + /* update indices */ + dw->index = 0; + go = part->dup_group->gobject.first; + while(go && go->ob != dw->ob) { + go=go->next; + dw->index++; + } writestruct(wd, DATA, "ParticleDupliWeight", 1, dw); + } if(part->boids && part->phystype == PART_PHYS_BOIDS) { BoidState *state = part->boids->states.first; diff --git a/source/blender/blenpluginapi/CMakeLists.txt b/source/blender/blenpluginapi/CMakeLists.txt index a5af15d7f55..9d398291b85 100644 --- a/source/blender/blenpluginapi/CMakeLists.txt +++ b/source/blender/blenpluginapi/CMakeLists.txt @@ -28,9 +28,9 @@ set(INC . .. ../blenlib + ../blenloader ../imbuf ../makesdna - ../blenloader ../../../intern/guardedalloc ) @@ -50,7 +50,9 @@ set(SRC ) if(WITH_CODEC_QUICKTIME) - list(APPEND INC_SYS ${QUICKTIME_INCLUDE_DIRS}) + list(APPEND INC_SYS + ${QUICKTIME_INCLUDE_DIRS} + ) add_definitions(-DWITH_QUICKTIME) endif() diff --git a/source/blender/collada/CMakeLists.txt b/source/blender/collada/CMakeLists.txt index 07da532146f..e2a68d19682 100644 --- a/source/blender/collada/CMakeLists.txt +++ b/source/blender/collada/CMakeLists.txt @@ -28,13 +28,13 @@ remove_strict_flags() set(INC . - ../blenlib ../blenkernel + ../blenlib ../blenloader - ../windowmanager + ../editors/include ../makesdna ../makesrna - ../editors/include + ../windowmanager ../../../intern/guardedalloc ) diff --git a/source/blender/editors/animation/CMakeLists.txt b/source/blender/editors/animation/CMakeLists.txt index a3c1d035d9b..83fe91d6f76 100644 --- a/source/blender/editors/animation/CMakeLists.txt +++ b/source/blender/editors/animation/CMakeLists.txt @@ -22,8 +22,8 @@ set(INC ../include ../../blenkernel - ../../blenloader ../../blenlib + ../../blenloader ../../makesdna ../../makesrna ../../windowmanager diff --git a/source/blender/editors/armature/CMakeLists.txt b/source/blender/editors/armature/CMakeLists.txt index 2db6e278460..9a44525611a 100644 --- a/source/blender/editors/armature/CMakeLists.txt +++ b/source/blender/editors/armature/CMakeLists.txt @@ -22,8 +22,8 @@ set(INC ../include ../../blenkernel - ../../blenloader ../../blenlib + ../../blenloader ../../makesdna ../../makesrna ../../windowmanager diff --git a/source/blender/editors/curve/CMakeLists.txt b/source/blender/editors/curve/CMakeLists.txt index dfc7e336e84..9bad02eca1f 100644 --- a/source/blender/editors/curve/CMakeLists.txt +++ b/source/blender/editors/curve/CMakeLists.txt @@ -22,8 +22,8 @@ set(INC ../include ../../blenkernel - ../../blenloader ../../blenlib + ../../blenloader ../../makesdna ../../makesrna ../../windowmanager diff --git a/source/blender/editors/gpencil/CMakeLists.txt b/source/blender/editors/gpencil/CMakeLists.txt index 352960d285a..7a2f196fd6d 100644 --- a/source/blender/editors/gpencil/CMakeLists.txt +++ b/source/blender/editors/gpencil/CMakeLists.txt @@ -22,8 +22,8 @@ set(INC ../include ../../blenkernel - ../../blenloader ../../blenlib + ../../blenloader ../../imbuf ../../makesdna ../../makesrna diff --git a/source/blender/editors/interface/CMakeLists.txt b/source/blender/editors/interface/CMakeLists.txt index 6dd7af70e33..cc4c1eaa21c 100644 --- a/source/blender/editors/interface/CMakeLists.txt +++ b/source/blender/editors/interface/CMakeLists.txt @@ -23,8 +23,8 @@ set(INC ../include ../../blenfont ../../blenkernel - ../../blenloader ../../blenlib + ../../blenloader ../../gpu ../../imbuf ../../makesdna diff --git a/source/blender/editors/mesh/CMakeLists.txt b/source/blender/editors/mesh/CMakeLists.txt index 6095de2c105..aff5f69e9d5 100644 --- a/source/blender/editors/mesh/CMakeLists.txt +++ b/source/blender/editors/mesh/CMakeLists.txt @@ -23,14 +23,14 @@ set(INC ../include ../uvedit ../../blenkernel - ../../blenloader ../../blenlib + ../../blenloader ../../bmesh ../../imbuf ../../makesdna ../../makesrna - ../../windowmanager ../../render/extern/include + ../../windowmanager ../../../../intern/guardedalloc ) diff --git a/source/blender/editors/metaball/CMakeLists.txt b/source/blender/editors/metaball/CMakeLists.txt index 690a8ec2fcb..76561b12183 100644 --- a/source/blender/editors/metaball/CMakeLists.txt +++ b/source/blender/editors/metaball/CMakeLists.txt @@ -22,8 +22,8 @@ set(INC ../include ../../blenkernel - ../../blenloader ../../blenlib + ../../blenloader ../../makesdna ../../makesrna ../../render/extern/include diff --git a/source/blender/editors/object/CMakeLists.txt b/source/blender/editors/object/CMakeLists.txt index d370e036229..58496a914cb 100644 --- a/source/blender/editors/object/CMakeLists.txt +++ b/source/blender/editors/object/CMakeLists.txt @@ -22,8 +22,8 @@ set(INC ../include ../../blenkernel - ../../blenloader ../../blenlib + ../../blenloader ../../bmesh ../../gpu ../../ikplugin @@ -31,8 +31,8 @@ set(INC ../../makesdna ../../makesrna ../../python - ../../windowmanager ../../render/extern/include + ../../windowmanager ../../../../intern/guardedalloc ) diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c index 0daf73bebba..b22536cc368 100644 --- a/source/blender/editors/object/object_bake.c +++ b/source/blender/editors/object/object_bake.c @@ -1010,9 +1010,10 @@ static DerivedMesh *multiresbake_create_loresdm(Scene *scene, Object *ob, int *l MultiresModifierData *mmd= get_multires_modifier(scene, ob, 0); Mesh *me= (Mesh*)ob->data; - *lvl= mmd->lvl; + if(ob->mode==OB_MODE_SCULPT) *lvl= mmd->sculptlvl; + else *lvl= mmd->lvl; - if(mmd->lvl==0) { + if(*lvl==0) { DerivedMesh *tmp_dm= CDDM_from_mesh(me, ob); dm= CDDM_copy(tmp_dm, 0); tmp_dm->release(tmp_dm); @@ -1020,7 +1021,7 @@ static DerivedMesh *multiresbake_create_loresdm(Scene *scene, Object *ob, int *l MultiresModifierData tmp_mmd= *mmd; DerivedMesh *cddm= CDDM_from_mesh(me, ob); - tmp_mmd.lvl= mmd->lvl; + tmp_mmd.lvl= *lvl; dm= multires_dm_create_from_derived(&tmp_mmd, 1, cddm, ob, 0, 0); cddm->release(cddm); } diff --git a/source/blender/editors/physics/CMakeLists.txt b/source/blender/editors/physics/CMakeLists.txt index 1badccffe3b..f32b23cd3ee 100644 --- a/source/blender/editors/physics/CMakeLists.txt +++ b/source/blender/editors/physics/CMakeLists.txt @@ -22,8 +22,8 @@ set(INC ../include ../../blenkernel - ../../blenloader ../../blenlib + ../../blenloader ../../makesdna ../../makesrna ../../windowmanager diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c index b573c77c7f3..37309f1e07c 100644 --- a/source/blender/editors/physics/physics_fluid.c +++ b/source/blender/editors/physics/physics_fluid.c @@ -722,15 +722,17 @@ typedef struct FluidBakeJob { static void fluidbake_free(void *customdata) { - FluidBakeJob *fb= customdata; + FluidBakeJob *fb= (FluidBakeJob *)customdata; MEM_freeN(fb); } /* called by fluidbake, only to check job 'stop' value */ -static int fluidbake_breakjob(void *UNUSED(customdata)) +static int fluidbake_breakjob(void *customdata) { - //FluidBakeJob *fb= (FluidBakeJob *)customdata; - //return *(fb->stop); + FluidBakeJob *fb= (FluidBakeJob *)customdata; + + if(fb->stop && *(fb->stop)) + return 1; /* this is not nice yet, need to make the jobs list template better * for identifying/acting upon various different jobs */ @@ -741,7 +743,7 @@ static int fluidbake_breakjob(void *UNUSED(customdata)) /* called by fluidbake, wmJob sends notifier */ static void fluidbake_updatejob(void *customdata, float progress) { - FluidBakeJob *fb= customdata; + FluidBakeJob *fb= (FluidBakeJob *)customdata; *(fb->do_update)= 1; *(fb->progress)= progress; @@ -749,7 +751,7 @@ static void fluidbake_updatejob(void *customdata, float progress) static void fluidbake_startjob(void *customdata, short *stop, short *do_update, float *progress) { - FluidBakeJob *fb= customdata; + FluidBakeJob *fb= (FluidBakeJob *)customdata; fb->stop= stop; fb->do_update = do_update; @@ -764,7 +766,7 @@ static void fluidbake_startjob(void *customdata, short *stop, short *do_update, static void fluidbake_endjob(void *customdata) { - FluidBakeJob *fb= customdata; + FluidBakeJob *fb= (FluidBakeJob *)customdata; if (fb->settings) { MEM_freeN(fb->settings); diff --git a/source/blender/editors/render/CMakeLists.txt b/source/blender/editors/render/CMakeLists.txt index ceada437caf..74abde1094a 100644 --- a/source/blender/editors/render/CMakeLists.txt +++ b/source/blender/editors/render/CMakeLists.txt @@ -52,8 +52,12 @@ set(SRC ) if(WITH_CODEC_QUICKTIME) - list(APPEND INC ../../quicktime) - list(APPEND INC_SYS ${QUICKTIME_INCLUDE_DIRS}) + list(APPEND INC + ../../quicktime + ) + list(APPEND INC_SYS + ${QUICKTIME_INCLUDE_DIRS} + ) add_definitions(-DWITH_QUICKTIME) endif() diff --git a/source/blender/editors/screen/CMakeLists.txt b/source/blender/editors/screen/CMakeLists.txt index a6638a7feab..aa347961dcb 100644 --- a/source/blender/editors/screen/CMakeLists.txt +++ b/source/blender/editors/screen/CMakeLists.txt @@ -23,8 +23,8 @@ set(INC ../include ../../blenfont ../../blenkernel - ../../blenloader ../../blenlib + ../../blenloader ../../bmesh ../../imbuf ../../makesdna diff --git a/source/blender/editors/sculpt_paint/CMakeLists.txt b/source/blender/editors/sculpt_paint/CMakeLists.txt index 6ecbc9c5eec..94e08a020f6 100644 --- a/source/blender/editors/sculpt_paint/CMakeLists.txt +++ b/source/blender/editors/sculpt_paint/CMakeLists.txt @@ -22,14 +22,14 @@ set(INC ../include ../../blenkernel + ../../blenlib ../../blenloader - ../../imbuf ../../gpu - ../../blenlib + ../../imbuf ../../makesdna ../../makesrna - ../../windowmanager ../../render/extern/include + ../../windowmanager ../../../../intern/guardedalloc ) diff --git a/source/blender/editors/sound/CMakeLists.txt b/source/blender/editors/sound/CMakeLists.txt index 55af283b5de..f66288812ad 100644 --- a/source/blender/editors/sound/CMakeLists.txt +++ b/source/blender/editors/sound/CMakeLists.txt @@ -22,8 +22,8 @@ set(INC ../include ../../blenkernel - ../../blenloader ../../blenlib + ../../blenloader ../../makesdna ../../makesrna ../../windowmanager diff --git a/source/blender/editors/space_action/CMakeLists.txt b/source/blender/editors/space_action/CMakeLists.txt index 6789556aa2b..edebaa8273a 100644 --- a/source/blender/editors/space_action/CMakeLists.txt +++ b/source/blender/editors/space_action/CMakeLists.txt @@ -22,8 +22,8 @@ set(INC ../include ../../blenkernel - ../../blenloader ../../blenlib + ../../blenloader ../../makesdna ../../makesrna ../../windowmanager diff --git a/source/blender/editors/space_api/CMakeLists.txt b/source/blender/editors/space_api/CMakeLists.txt index 12361e790e4..bb9b85c5f30 100644 --- a/source/blender/editors/space_api/CMakeLists.txt +++ b/source/blender/editors/space_api/CMakeLists.txt @@ -22,8 +22,8 @@ set(INC ../include ../../blenkernel - ../../blenloader ../../blenlib + ../../blenloader ../../bmesh ../../makesdna ../../makesrna diff --git a/source/blender/editors/space_buttons/CMakeLists.txt b/source/blender/editors/space_buttons/CMakeLists.txt index 0a4f251e46f..631e2adea34 100644 --- a/source/blender/editors/space_buttons/CMakeLists.txt +++ b/source/blender/editors/space_buttons/CMakeLists.txt @@ -22,8 +22,8 @@ set(INC ../include ../../blenkernel - ../../blenloader ../../blenlib + ../../blenloader ../../makesdna ../../makesrna ../../windowmanager diff --git a/source/blender/editors/space_file/CMakeLists.txt b/source/blender/editors/space_file/CMakeLists.txt index afa746ea359..4aa6cdbcf2f 100644 --- a/source/blender/editors/space_file/CMakeLists.txt +++ b/source/blender/editors/space_file/CMakeLists.txt @@ -28,8 +28,8 @@ set(INC ../../imbuf ../../makesdna ../../makesrna - ../../windowmanager ../../render/extern/include + ../../windowmanager ../../../../intern/guardedalloc ) diff --git a/source/blender/editors/space_graph/CMakeLists.txt b/source/blender/editors/space_graph/CMakeLists.txt index b7cde90546c..80205ad5564 100644 --- a/source/blender/editors/space_graph/CMakeLists.txt +++ b/source/blender/editors/space_graph/CMakeLists.txt @@ -22,8 +22,8 @@ set(INC ../include ../../blenkernel - ../../blenloader ../../blenlib + ../../blenloader ../../makesdna ../../makesrna ../../windowmanager diff --git a/source/blender/editors/space_image/CMakeLists.txt b/source/blender/editors/space_image/CMakeLists.txt index 8e2836388cb..d811f018618 100644 --- a/source/blender/editors/space_image/CMakeLists.txt +++ b/source/blender/editors/space_image/CMakeLists.txt @@ -23,14 +23,14 @@ set(INC ../include ../../blenfont ../../blenkernel - ../../blenloader ../../blenlib + ../../blenloader ../../imbuf ../../bmesh ../../makesdna ../../makesrna - ../../windowmanager ../../render/extern/include + ../../windowmanager ../../../../intern/guardedalloc ) diff --git a/source/blender/editors/space_info/CMakeLists.txt b/source/blender/editors/space_info/CMakeLists.txt index 7f4b370c371..1930fb6bcc8 100644 --- a/source/blender/editors/space_info/CMakeLists.txt +++ b/source/blender/editors/space_info/CMakeLists.txt @@ -23,8 +23,8 @@ set(INC ../include ../../blenfont ../../blenkernel - ../../blenloader ../../blenlib + ../../blenloader ../../imbuf ../../bmesh ../../makesdna diff --git a/source/blender/editors/space_logic/CMakeLists.txt b/source/blender/editors/space_logic/CMakeLists.txt index cd24cb5e5d0..44471902040 100644 --- a/source/blender/editors/space_logic/CMakeLists.txt +++ b/source/blender/editors/space_logic/CMakeLists.txt @@ -21,13 +21,13 @@ set(INC ../include + ../interface ../../blenkernel - ../../blenloader ../../blenlib + ../../blenloader ../../makesdna ../../makesrna ../../windowmanager - ../../editors/interface ../../../../intern/guardedalloc ) diff --git a/source/blender/editors/space_nla/CMakeLists.txt b/source/blender/editors/space_nla/CMakeLists.txt index 1bf04f4dc37..b05d157365d 100644 --- a/source/blender/editors/space_nla/CMakeLists.txt +++ b/source/blender/editors/space_nla/CMakeLists.txt @@ -22,8 +22,8 @@ set(INC ../include ../../blenkernel - ../../blenloader ../../blenlib + ../../blenloader ../../makesdna ../../makesrna ../../windowmanager diff --git a/source/blender/editors/space_node/CMakeLists.txt b/source/blender/editors/space_node/CMakeLists.txt index 9172bc4e9eb..dcd6bcd3403 100644 --- a/source/blender/editors/space_node/CMakeLists.txt +++ b/source/blender/editors/space_node/CMakeLists.txt @@ -23,14 +23,14 @@ set(INC ../include ../../blenfont ../../blenkernel - ../../blenloader ../../blenlib + ../../blenloader ../../imbuf ../../makesdna ../../makesrna ../../nodes - ../../windowmanager ../../render/extern/include + ../../windowmanager ../../../../intern/guardedalloc ../../../../intern/opennl/extern ) diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index e760c9021c2..abc7b273ec9 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -2000,12 +2000,13 @@ bNode *node_add_node(SpaceNode *snode, Scene *scene, int type, float locx, float /* ****************** Duplicate *********************** */ -static int node_duplicate_exec(bContext *C, wmOperator *UNUSED(op)) +static int node_duplicate_exec(bContext *C, wmOperator *op) { SpaceNode *snode= CTX_wm_space_node(C); bNodeTree *ntree= snode->edittree; bNode *node, *newnode, *lastnode; bNodeLink *link, *newlink, *lastlink; + int keep_inputs = RNA_boolean_get(op->ptr, "keep_inputs"); ED_preview_kill_jobs(C); @@ -2033,10 +2034,11 @@ static int node_duplicate_exec(bContext *C, wmOperator *UNUSED(op)) */ lastlink = ntree->links.last; for (link=ntree->links.first; link; link=link->next) { - /* this creates new links between copied nodes, - * as well as input links from unselected (when fromnode==NULL) ! + /* This creates new links between copied nodes. + * If keep_inputs is set, also copies input links from unselected (when fromnode==NULL)! */ - if (link->tonode && (link->tonode->flag & NODE_SELECT)) { + if (link->tonode && (link->tonode->flag & NODE_SELECT) + && (keep_inputs || (link->fromnode && (link->fromnode->flag & NODE_SELECT)))) { newlink = MEM_callocN(sizeof(bNodeLink), "bNodeLink"); newlink->flag = link->flag; newlink->tonode = link->tonode->new_node; @@ -2096,6 +2098,8 @@ void NODE_OT_duplicate(wmOperatorType *ot) /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + + RNA_def_boolean(ot->srna, "keep_inputs", 0, "Keep Inputs", "Keep the input links to duplicated nodes"); } /* *************************** add link op ******************** */ @@ -2114,9 +2118,9 @@ static void node_remove_extra_links(SpaceNode *snode, bNodeSocket *tsock, bNodeL if(tlink) { /* try to move the existing link to the next available socket */ if (tlink->tonode) { - /* is there a free input socket with same type? */ + /* is there a free input socket with the target type? */ for(sock= tlink->tonode->inputs.first; sock; sock= sock->next) { - if(sock->type==tlink->fromsock->type) + if(sock->type==tlink->tosock->type) if(nodeCountSocketLinks(snode->edittree, sock) < sock->limit) break; } diff --git a/source/blender/editors/space_node/node_header.c b/source/blender/editors/space_node/node_header.c index a982f4b1994..4f3991e8ff8 100644 --- a/source/blender/editors/space_node/node_header.c +++ b/source/blender/editors/space_node/node_header.c @@ -94,8 +94,6 @@ static void do_node_add(bContext *C, void *UNUSED(arg), int event) if(node->flag & NODE_TEST) node->flag |= NODE_SELECT; } - snode_autoconnect(snode, 1, 0); - /* deselect after autoconnection */ for(node= snode->edittree->nodes.first; node; node= node->next) { if(node->flag & NODE_TEST) node->flag &= ~NODE_SELECT; diff --git a/source/blender/editors/space_node/node_ops.c b/source/blender/editors/space_node/node_ops.c index 4d181a34894..4bb0283690b 100644 --- a/source/blender/editors/space_node/node_ops.c +++ b/source/blender/editors/space_node/node_ops.c @@ -101,11 +101,18 @@ void node_operatortypes(void) void ED_operatormacros_node(void) { wmOperatorType *ot; + wmOperatorTypeMacro *mot; ot= WM_operatortype_append_macro("NODE_OT_duplicate_move", "Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER); WM_operatortype_macro_define(ot, "NODE_OT_duplicate"); WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate"); + /* modified operator call for duplicating with input links */ + ot= WM_operatortype_append_macro("NODE_OT_duplicate_move_keep_inputs", "Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER); + mot = WM_operatortype_macro_define(ot, "NODE_OT_duplicate"); + RNA_boolean_set(mot->ptr, "keep_inputs", 1); + WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate"); + ot= WM_operatortype_append_macro("NODE_OT_select_link_viewer", "Link Viewer", OPTYPE_UNDO); WM_operatortype_macro_define(ot, "NODE_OT_select"); WM_operatortype_macro_define(ot, "NODE_OT_link_viewer"); @@ -155,6 +162,8 @@ void node_keymap(struct wmKeyConfig *keyconf) WM_keymap_add_menu(keymap, "NODE_MT_add", AKEY, KM_PRESS, KM_SHIFT, 0); WM_keymap_add_item(keymap, "NODE_OT_duplicate_move", DKEY, KM_PRESS, KM_SHIFT, 0); + /* modified operator call for duplicating with input links */ + WM_keymap_add_item(keymap, "NODE_OT_duplicate_move_keep_inputs", DKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0); WM_keymap_add_item(keymap, "NODE_OT_hide_toggle", HKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "NODE_OT_mute_toggle", MKEY, KM_PRESS, 0, 0); diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c index 029c55d0851..3c5f4a163a2 100644 --- a/source/blender/editors/space_node/space_node.c +++ b/source/blender/editors/space_node/space_node.c @@ -228,6 +228,13 @@ static void node_area_listener(ScrArea *sa, wmNotifier *wmn) else if (wmn->action == NA_SELECTED) ED_area_tag_redraw(sa); break; + case NC_SCREEN: + switch(wmn->data) { + case ND_ANIMPLAY: + ED_area_tag_refresh(sa); + break; + } + break; case NC_IMAGE: if (wmn->action == NA_EDITED) { diff --git a/source/blender/editors/space_outliner/CMakeLists.txt b/source/blender/editors/space_outliner/CMakeLists.txt index c05350c256f..4194d463e10 100644 --- a/source/blender/editors/space_outliner/CMakeLists.txt +++ b/source/blender/editors/space_outliner/CMakeLists.txt @@ -22,8 +22,8 @@ set(INC ../include ../../blenkernel - ../../blenloader ../../blenlib + ../../blenloader ../../imbuf ../../makesdna ../../makesrna diff --git a/source/blender/editors/space_script/CMakeLists.txt b/source/blender/editors/space_script/CMakeLists.txt index 1aed177eed1..9d3bd4a67aa 100644 --- a/source/blender/editors/space_script/CMakeLists.txt +++ b/source/blender/editors/space_script/CMakeLists.txt @@ -22,8 +22,8 @@ set(INC ../include ../../blenkernel - ../../blenloader ../../blenlib + ../../blenloader ../../makesdna ../../makesrna ../../windowmanager @@ -44,8 +44,12 @@ set(SRC ) if(WITH_PYTHON) - list(APPEND INC ../../python) - list(APPEND INC_SYS ${PYTHON_INCLUDE_DIRS}) + list(APPEND INC + ../../python + ) + list(APPEND INC_SYS + ${PYTHON_INCLUDE_DIRS} + ) add_definitions(-DWITH_PYTHON) endif() diff --git a/source/blender/editors/space_sequencer/CMakeLists.txt b/source/blender/editors/space_sequencer/CMakeLists.txt index 71a4cfca868..9ce5f8e5279 100644 --- a/source/blender/editors/space_sequencer/CMakeLists.txt +++ b/source/blender/editors/space_sequencer/CMakeLists.txt @@ -22,8 +22,8 @@ set(INC ../include ../../blenkernel - ../../blenloader ../../blenlib + ../../blenloader ../../imbuf ../../makesdna ../../makesrna diff --git a/source/blender/editors/space_sound/CMakeLists.txt b/source/blender/editors/space_sound/CMakeLists.txt index 367d07c0c0b..870065966cc 100644 --- a/source/blender/editors/space_sound/CMakeLists.txt +++ b/source/blender/editors/space_sound/CMakeLists.txt @@ -22,8 +22,8 @@ set(INC ../include ../../blenkernel - ../../blenloader ../../blenlib + ../../blenloader ../../makesdna ../../makesrna ../../windowmanager diff --git a/source/blender/editors/space_text/CMakeLists.txt b/source/blender/editors/space_text/CMakeLists.txt index 0c174225a58..acf00d205a6 100644 --- a/source/blender/editors/space_text/CMakeLists.txt +++ b/source/blender/editors/space_text/CMakeLists.txt @@ -23,8 +23,8 @@ set(INC ../include ../../blenfont ../../blenkernel - ../../blenloader ../../blenlib + ../../blenloader ../../makesdna ../../makesrna ../../windowmanager @@ -46,8 +46,12 @@ set(SRC ) if(WITH_PYTHON) - list(APPEND INC ../../python) - list(APPEND INC_SYS ${PYTHON_INCLUDE_DIRS}) + list(APPEND INC + ../../python + ) + list(APPEND INC_SYS + ${PYTHON_INCLUDE_DIRS} + ) add_definitions(-DWITH_PYTHON) endif() diff --git a/source/blender/editors/space_time/CMakeLists.txt b/source/blender/editors/space_time/CMakeLists.txt index 79081c7cfd4..758d1e629f9 100644 --- a/source/blender/editors/space_time/CMakeLists.txt +++ b/source/blender/editors/space_time/CMakeLists.txt @@ -22,8 +22,8 @@ set(INC ../include ../../blenkernel - ../../blenloader ../../blenlib + ../../blenloader ../../makesdna ../../makesrna ../../windowmanager diff --git a/source/blender/editors/space_userpref/CMakeLists.txt b/source/blender/editors/space_userpref/CMakeLists.txt index 656a5d2f0ef..43ac90dce94 100644 --- a/source/blender/editors/space_userpref/CMakeLists.txt +++ b/source/blender/editors/space_userpref/CMakeLists.txt @@ -22,8 +22,8 @@ set(INC ../include ../../blenkernel - ../../blenloader ../../blenlib + ../../blenloader ../../makesdna ../../makesrna ../../windowmanager diff --git a/source/blender/editors/space_view3d/CMakeLists.txt b/source/blender/editors/space_view3d/CMakeLists.txt index 9f9395b1284..53b23cc7c53 100644 --- a/source/blender/editors/space_view3d/CMakeLists.txt +++ b/source/blender/editors/space_view3d/CMakeLists.txt @@ -23,15 +23,15 @@ set(INC ../include ../../blenfont ../../blenkernel - ../../blenloader ../../blenlib + ../../blenloader ../../bmesh ../../gpu ../../imbuf ../../makesdna ../../makesrna - ../../windowmanager ../../render/extern/include + ../../windowmanager ../../../../intern/guardedalloc ../../../../intern/smoke/extern ) @@ -62,7 +62,9 @@ set(SRC ) if(WITH_GAMEENGINE) - list(APPEND INC ../../../../source/gameengine/BlenderRoutines) + list(APPEND INC + ../../../gameengine/BlenderRoutines + ) add_definitions(-DWITH_GAMEENGINE) endif() diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index 0f052d5d7e8..64a3e473975 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -980,7 +980,7 @@ static void v3d_editarmature_buts(uiLayout *layout, Object *ob) ebone= arm->act_edbone; if (!ebone || (ebone->layer & arm->layer)==0) { - uiItemL(col, "Nothing selected", ICON_NONE); + uiItemL(layout, "Nothing selected", ICON_NONE); return; } // row= uiLayoutRow(layout, 0); diff --git a/source/blender/editors/transform/CMakeLists.txt b/source/blender/editors/transform/CMakeLists.txt index 9de130bb99c..c0a1a6a29f4 100644 --- a/source/blender/editors/transform/CMakeLists.txt +++ b/source/blender/editors/transform/CMakeLists.txt @@ -22,8 +22,8 @@ set(INC ../include ../../blenkernel - ../../blenloader ../../blenlib + ../../blenloader ../../bmesh ../../makesdna ../../makesrna diff --git a/source/blender/editors/util/CMakeLists.txt b/source/blender/editors/util/CMakeLists.txt index f9fbd0a9c12..e39e3e87399 100644 --- a/source/blender/editors/util/CMakeLists.txt +++ b/source/blender/editors/util/CMakeLists.txt @@ -22,8 +22,8 @@ set(INC ../include ../../blenkernel - ../../blenloader ../../blenlib + ../../blenloader ../../bmesh ../../makesdna ../../makesrna diff --git a/source/blender/editors/uvedit/CMakeLists.txt b/source/blender/editors/uvedit/CMakeLists.txt index 84cdb6a0f71..1fe2e014a75 100644 --- a/source/blender/editors/uvedit/CMakeLists.txt +++ b/source/blender/editors/uvedit/CMakeLists.txt @@ -22,8 +22,8 @@ set(INC ../include ../../blenkernel - ../../blenloader ../../blenlib + ../../blenloader ../../bmesh ../../makesdna ../../makesrna diff --git a/source/blender/gpu/CMakeLists.txt b/source/blender/gpu/CMakeLists.txt index 76e347270ba..8f575dfb50b 100644 --- a/source/blender/gpu/CMakeLists.txt +++ b/source/blender/gpu/CMakeLists.txt @@ -26,8 +26,8 @@ set(INC . - ../blenlib ../blenkernel + ../blenlib ../blenloader ../imbuf ../makesdna diff --git a/source/blender/ikplugin/CMakeLists.txt b/source/blender/ikplugin/CMakeLists.txt index da5c2f69635..dc637aedd6d 100644 --- a/source/blender/ikplugin/CMakeLists.txt +++ b/source/blender/ikplugin/CMakeLists.txt @@ -25,10 +25,10 @@ # ***** END GPL LICENSE BLOCK ***** set(INC + . + ../blenkernel ../blenlib ../makesdna - ../blenkernel - ../ikplugin ../../../intern/guardedalloc ../../../intern/iksolver/extern ) diff --git a/source/blender/imbuf/CMakeLists.txt b/source/blender/imbuf/CMakeLists.txt index c9a8f62a197..18b5eff5c73 100644 --- a/source/blender/imbuf/CMakeLists.txt +++ b/source/blender/imbuf/CMakeLists.txt @@ -32,12 +32,12 @@ endif() set(INC . ../avi - ../blenlib ../blenkernel + ../blenlib ../blenloader ../makesdna - ../../../intern/memutil ../../../intern/guardedalloc + ../../../intern/memutil ) set(INC_SYS @@ -113,29 +113,43 @@ if(WITH_IMAGE_OPENEXR) endif() if(WITH_IMAGE_TIFF) - list(APPEND INC_SYS ${TIFF_INCLUDE_DIR}) + list(APPEND INC_SYS + ${TIFF_INCLUDE_DIR} + ) add_definitions(-DWITH_TIFF) endif() if(WITH_IMAGE_OPENJPEG) - list(APPEND INC_SYS ${OPENJPEG_INCLUDE_DIRS}) + list(APPEND INC_SYS + ${OPENJPEG_INCLUDE_DIRS} + ) add_definitions(-DWITH_OPENJPEG) endif() if(WITH_IMAGE_REDCODE) - list(APPEND INC_SYS ${REDCODE_INC}) + list(APPEND INC_SYS + ${REDCODE_INC} + ) add_definitions(-DWITH_REDCODE) endif() if(WITH_CODEC_QUICKTIME) - list(APPEND INC ../quicktime) - list(APPEND INC_SYS ${QUICKTIME_INCLUDE_DIRS}) + list(APPEND INC + ../quicktime + ) + list(APPEND INC_SYS + ${QUICKTIME_INCLUDE_DIRS} + ) add_definitions(-DWITH_QUICKTIME) endif() if(WITH_CODEC_FFMPEG) - list(APPEND INC ../../../intern/ffmpeg) - list(APPEND INC_SYS ${FFMPEG_INCLUDE_DIRS}) + list(APPEND INC + ../../../intern/ffmpeg + ) + list(APPEND INC_SYS + ${FFMPEG_INCLUDE_DIRS} + ) add_definitions(-DWITH_FFMPEG) endif() diff --git a/source/blender/imbuf/intern/cineon/CMakeLists.txt b/source/blender/imbuf/intern/cineon/CMakeLists.txt index 079f34af773..4f7f20beecf 100644 --- a/source/blender/imbuf/intern/cineon/CMakeLists.txt +++ b/source/blender/imbuf/intern/cineon/CMakeLists.txt @@ -29,8 +29,8 @@ set(INC .. ../.. ../../../blenkernel - ../../../blenloader ../../../blenlib + ../../../blenloader ../../../makesdna ../../../../../intern/guardedalloc ) diff --git a/source/blender/imbuf/intern/dds/CMakeLists.txt b/source/blender/imbuf/intern/dds/CMakeLists.txt index fd2b94547b4..53822b830f7 100644 --- a/source/blender/imbuf/intern/dds/CMakeLists.txt +++ b/source/blender/imbuf/intern/dds/CMakeLists.txt @@ -28,9 +28,8 @@ set(INC . .. ../.. - intern/include - ../../../blenlib ../../../blenkernel + ../../../blenlib ../../../makesdna ../../../../../intern/guardedalloc ) diff --git a/source/blender/imbuf/intern/openexr/CMakeLists.txt b/source/blender/imbuf/intern/openexr/CMakeLists.txt index 9ca4dff5bc8..3be5219ae44 100644 --- a/source/blender/imbuf/intern/openexr/CMakeLists.txt +++ b/source/blender/imbuf/intern/openexr/CMakeLists.txt @@ -30,9 +30,8 @@ set(INC ../.. ../../../blenkernel ../../../blenlib - intern/include - ../../../../../intern/guardedalloc ../../../makesdna + ../../../../../intern/guardedalloc ) set(INC_SYS @@ -44,7 +43,9 @@ set(SRC ) if(WITH_IMAGE_OPENEXR) - list(APPEND INC_SYS ${OPENEXR_INCLUDE_DIRS}) + list(APPEND INC_SYS + ${OPENEXR_INCLUDE_DIRS} + ) add_definitions(-DWITH_OPENEXR) endif() diff --git a/source/blender/makesdna/DNA_particle_types.h b/source/blender/makesdna/DNA_particle_types.h index aace8156e9d..69ee530c0b6 100644 --- a/source/blender/makesdna/DNA_particle_types.h +++ b/source/blender/makesdna/DNA_particle_types.h @@ -89,7 +89,8 @@ typedef struct ParticleDupliWeight { struct ParticleDupliWeight *next, *prev; struct Object *ob; short count; - short flag, rt[2]; + short flag; + short index, rt; /* only updated on file save and used on file load */ } ParticleDupliWeight; typedef struct ParticleData { diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index 3997f6a84e0..8cdb5a57037 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -176,12 +176,16 @@ if(WITH_AUDASPACE) endif() if(WITH_CODEC_QUICKTIME) - list(APPEND INC ../../quicktime) + list(APPEND INC + ../../quicktime + ) add_definitions(-DWITH_QUICKTIME) endif() if(WITH_CODEC_FFMPEG) - list(APPEND INC_SYS ${FFMPEG_INCLUDE_DIRS}) + list(APPEND INC_SYS + ${FFMPEG_INCLUDE_DIRS} + ) add_definitions(-DWITH_FFMPEG) endif() diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 8b85b7e1e28..77d4774acfc 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -484,7 +484,7 @@ static PointerRNA rna_Object_active_vertex_group_get(PointerRNA *ptr) static int rna_Object_active_vertex_group_index_get(PointerRNA *ptr) { Object *ob= (Object*)ptr->id.data; - return MAX2(ob->actdef-1, 0); + return ob->actdef-1; } static void rna_Object_active_vertex_group_index_set(PointerRNA *ptr, int value) diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c index 4ccd4050bc1..57cc1222c3f 100644 --- a/source/blender/makesrna/intern/rna_object_api.c +++ b/source/blender/makesrna/intern/rna_object_api.c @@ -415,6 +415,41 @@ void rna_Object_ray_cast(Object *ob, ReportList *reports, float ray_start[3], fl *index= -1; } +void rna_Object_closest_point_on_mesh(Object *ob, ReportList *reports, float point_co[3], float n_location[3], float n_normal[3], int *index) +{ + BVHTreeFromMesh treeData= {NULL}; + + if(ob->derivedFinal==NULL) { + BKE_reportf(reports, RPT_ERROR, "object \"%s\" has no mesh data to be used for finding nearest point.", ob->id.name+2); + return; + } + + /* no need to managing allocation or freeing of the BVH data. this is generated and freed as needed */ + bvhtree_from_mesh_faces(&treeData, ob->derivedFinal, 0.0f, 4, 6); + + if(treeData.tree==NULL) { + BKE_reportf(reports, RPT_ERROR, "object \"%s\" could not create internal data for finding nearest point", ob->id.name+2); + return; + } + else { + BVHTreeNearest nearest; + + nearest.index = -1; + nearest.dist = FLT_MAX; + + if(BLI_bvhtree_find_nearest(treeData.tree, point_co, &nearest, treeData.nearest_callback, &treeData) != -1) { + copy_v3_v3(n_location, nearest.co); + copy_v3_v3(n_normal, nearest.no); + *index= nearest.index; + return; + } + } + + zero_v3(n_location); + zero_v3(n_normal); + *index= -1; +} + /* ObjectBase */ void rna_ObjectBase_layers_from_view(Base *base, View3D *v3d) @@ -501,6 +536,26 @@ void RNA_api_object(StructRNA *srna) parm= RNA_def_int(func, "index", 0, 0, 0, "", "The face index, -1 when no intersection is found.", 0, 0); RNA_def_function_output(func, parm); + /* Nearest Point */ + func= RNA_def_function(srna, "closest_point_on_mesh", "rna_Object_closest_point_on_mesh"); + RNA_def_function_ui_description(func, "Find the nearest point on the object."); + RNA_def_function_flag(func, FUNC_USE_REPORTS); + + /* ray start and end */ + parm= RNA_def_float_vector(func, "point", 3, NULL, -FLT_MAX, FLT_MAX, "", "", -1e4, 1e4); + RNA_def_property_flag(parm, PROP_REQUIRED); + + /* return location and normal */ + parm= RNA_def_float_vector(func, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location", "The location on the object closest to the point", -1e4, 1e4); + RNA_def_property_flag(parm, PROP_THICK_WRAP); + RNA_def_function_output(func, parm); + parm= RNA_def_float_vector(func, "normal", 3, NULL, -FLT_MAX, FLT_MAX, "Normal", "The face normal at the closest point", -1e4, 1e4); + RNA_def_property_flag(parm, PROP_THICK_WRAP); + RNA_def_function_output(func, parm); + + parm= RNA_def_int(func, "index", 0, 0, 0, "", "The face index, -1 when no intersection is found.", 0, 0); + RNA_def_function_output(func, parm); + /* View */ func= RNA_def_function(srna, "is_visible", "rna_Object_is_visible"); RNA_def_function_ui_description(func, "Determine if object is visible in a given scene."); diff --git a/source/blender/modifiers/CMakeLists.txt b/source/blender/modifiers/CMakeLists.txt index f71fd11877f..1097b238cae 100644 --- a/source/blender/modifiers/CMakeLists.txt +++ b/source/blender/modifiers/CMakeLists.txt @@ -25,16 +25,17 @@ # ***** END GPL LICENSE BLOCK ***** set(INC - . ./intern + . + intern + ../blenkernel + ../blenkernel/intern ../blenlib ../blenloader ../makesdna - ../blenkernel - ../blenkernel/intern ../bmesh ../render/extern/include - ../../../intern/guardedalloc ../../../intern/elbeem/extern + ../../../intern/guardedalloc ) set(INC_SYS @@ -100,7 +101,9 @@ endif() if(WITH_MOD_DECIMATE) add_definitions(-DWITH_MOD_DECIMATE) - list(APPEND INC ../../../intern/decimation/extern) + list(APPEND INC + ../../../intern/decimation/extern + ) endif() if(NOT WITH_MOD_FLUID) diff --git a/source/blender/modifiers/intern/MOD_util.h b/source/blender/modifiers/intern/MOD_util.h index 07d0ed37d3d..c89043ea0c3 100644 --- a/source/blender/modifiers/intern/MOD_util.h +++ b/source/blender/modifiers/intern/MOD_util.h @@ -52,6 +52,6 @@ void modifier_vgroup_cache(struct ModifierData *md, float (*vertexCos)[3]); void validate_layer_name(const struct CustomData *data, int type, char *name, char *outname); struct DerivedMesh *get_cddm(struct Object *ob, struct BMEditMesh *em, struct DerivedMesh *dm, float (*vertexCos)[3]); struct DerivedMesh *get_dm(struct Object *ob, struct BMEditMesh *em, struct DerivedMesh *dm, float (*vertexCos)[3], int orco); -void modifier_get_vgroup(struct Object *ob, DerivedMesh *dm, const char *name, struct MDeformVert **dvert, int *defgrp_index); +void modifier_get_vgroup(struct Object *ob, struct DerivedMesh *dm, const char *name, struct MDeformVert **dvert, int *defgrp_index); #endif /* MOD_UTIL_H */ diff --git a/source/blender/nodes/CMakeLists.txt b/source/blender/nodes/CMakeLists.txt index d2b58d61112..c3bd37c18ee 100644 --- a/source/blender/nodes/CMakeLists.txt +++ b/source/blender/nodes/CMakeLists.txt @@ -152,8 +152,12 @@ set(SRC ) if(WITH_PYTHON) - list(APPEND INC ../python) - list(APPEND INC_SYS ${PYTHON_INCLUDE_DIRS}) + list(APPEND INC + ../python + ) + list(APPEND INC_SYS + ${PYTHON_INCLUDE_DIRS} + ) add_definitions(-DWITH_PYTHON) endif() diff --git a/source/blender/python/CMakeLists.txt b/source/blender/python/CMakeLists.txt index fe9e0307703..8071edb378f 100644 --- a/source/blender/python/CMakeLists.txt +++ b/source/blender/python/CMakeLists.txt @@ -18,3 +18,4 @@ add_subdirectory(intern) add_subdirectory(generic) +add_subdirectory(mathutils) diff --git a/source/blender/python/SConscript b/source/blender/python/SConscript index de6b859d259..dec0de4a6ab 100644 --- a/source/blender/python/SConscript +++ b/source/blender/python/SConscript @@ -1,6 +1,6 @@ #!/usr/bin/python -# TODO, split into 2 files. +# TODO, split into 3 files. Import ('env') @@ -18,7 +18,14 @@ if is_debug: defs.append('_DEBUG') sources = env.Glob('generic/*.c') -env.BlenderLib( libname = 'bf_python_ext', sources = Split(sources), includes = Split(incs), defines = defs, libtype = ['core','player'], priority = [362,165]) # ketsji is 360 +env.BlenderLib( libname = 'bf_python_ext', sources = Split(sources), includes = Split(incs), defines = defs, libtype = ['core','player'], priority = [363,165]) # ketsji is 360 + + +# mathutils +defs = [] + +sources = env.Glob('mathutils/*.c') +env.BlenderLib( libname = 'bf_python_mathutils', sources = Split(sources), includes = Split(incs), defines = defs, libtype = ['core','player'], priority = [362,165]) # bpy diff --git a/source/blender/python/generic/CMakeLists.txt b/source/blender/python/generic/CMakeLists.txt index 0889c77f9ad..8dfbf476995 100644 --- a/source/blender/python/generic/CMakeLists.txt +++ b/source/blender/python/generic/CMakeLists.txt @@ -20,10 +20,10 @@ set(INC . - ../../blenlib - ../../makesdna ../../blenkernel + ../../blenlib ../../blenloader + ../../makesdna ../../../../intern/guardedalloc ) @@ -37,13 +37,6 @@ set(SRC bgl.c blf_py_api.c bpy_internal_import.c - mathutils.c - mathutils_Color.c - mathutils_Euler.c - mathutils_Matrix.c - mathutils_Quaternion.c - mathutils_Vector.c - mathutils_geometry.c noise_py_api.c py_capi_utils.c @@ -51,13 +44,6 @@ set(SRC bgl.h blf_py_api.h bpy_internal_import.h - mathutils.h - mathutils_Color.h - mathutils_Euler.h - mathutils_Matrix.h - mathutils_Quaternion.h - mathutils_Vector.h - mathutils_geometry.h noise_py_api.h py_capi_utils.h ) diff --git a/source/blender/python/generic/bgl.c b/source/blender/python/generic/bgl.c index 18d01f45015..09432e0b316 100644 --- a/source/blender/python/generic/bgl.c +++ b/source/blender/python/generic/bgl.c @@ -48,12 +48,15 @@ static PyObject *Buffer_new(PyTypeObject *type, PyObject *args, PyObject *kwds); /* Buffer sequence methods */ -static int Buffer_len(PyObject *self); -static PyObject *Buffer_item(PyObject *self, int i); -static PyObject *Buffer_slice(PyObject *self, int begin, int end); -static int Buffer_ass_item(PyObject *self, int i, PyObject *v); -static int Buffer_ass_slice(PyObject *self, int begin, int end, +static int Buffer_len(Buffer *self); +static PyObject *Buffer_item(Buffer *self, int i); +static PyObject *Buffer_slice(Buffer *self, int begin, int end); +static int Buffer_ass_item(Buffer *self, int i, PyObject *v); +static int Buffer_ass_slice(Buffer *self, int begin, int end, PyObject *seq); +static PyObject *Buffer_subscript(Buffer *self, PyObject *item); +static int Buffer_ass_subscript(Buffer *self, PyObject *item, + PyObject *value); static PySequenceMethods Buffer_SeqMethods = { (lenfunc) Buffer_len, /*sq_length */ @@ -68,12 +71,19 @@ static PySequenceMethods Buffer_SeqMethods = { (ssizeargfunc) NULL, /* sq_inplace_repeat */ }; -static void Buffer_dealloc(PyObject *self); -static PyObject *Buffer_repr(PyObject *self); -static PyObject *Buffer_to_list(PyObject *self) +static PyMappingMethods Buffer_AsMapping = { + (lenfunc)Buffer_len, + (binaryfunc)Buffer_subscript, + (objobjargproc)Buffer_ass_subscript +}; + +static void Buffer_dealloc(Buffer *self); +static PyObject *Buffer_repr(Buffer *self); + +static PyObject *Buffer_to_list(Buffer *self) { - int i, len= ((Buffer *)self)->dimensions[0]; + int i, len= self->dimensions[0]; PyObject *list= PyList_New(len); for (i=0; i<len; i++) { @@ -83,26 +93,54 @@ static PyObject *Buffer_to_list(PyObject *self) return list; } -static PyObject *Buffer_dimensions(PyObject *self, void *UNUSED(arg)) +static PyObject *Buffer_to_list_recursive(Buffer *self) +{ + PyObject *list; + + if(self->ndimensions > 1) { + int i, len= self->dimensions[0]; + list= PyList_New(len); + + for (i=0; i<len; i++) { + Buffer *sub= (Buffer *)Buffer_item(self, i); + PyList_SET_ITEM(list, i, Buffer_to_list_recursive(sub)); + Py_DECREF(sub); + } + } + else { + list= Buffer_to_list(self); + } + + return list; +} + +/* *DEPRECATED* 2011/7/17 bgl.Buffer.list */ +static PyObject *Buffer_list(Buffer *self, void *UNUSED(arg)) { - Buffer *buffer= (Buffer *) self; - PyObject *list= PyList_New(buffer->ndimensions); + fprintf(stderr, "Warning: 'Buffer.list' deprecated, use '[:]' instead\n"); + return Buffer_to_list(self); +} + +static PyObject *Buffer_dimensions(Buffer *self, void *UNUSED(arg)) +{ + PyObject *list= PyList_New(self->ndimensions); int i; - for (i= 0; i<buffer->ndimensions; i++) { - PyList_SET_ITEM(list, i, PyLong_FromLong(buffer->dimensions[i])); + for (i= 0; i<self->ndimensions; i++) { + PyList_SET_ITEM(list, i, PyLong_FromLong(self->dimensions[i])); } return list; } static PyMethodDef Buffer_methods[] = { - {"to_list", (PyCFunction)Buffer_to_list, METH_NOARGS, + {"to_list", (PyCFunction)Buffer_to_list_recursive, METH_NOARGS, "return the buffer as a list"}, {NULL, NULL, 0, NULL} }; static PyGetSetDef Buffer_getseters[] = { + {(char *)"list", (getter)Buffer_list, NULL, NULL, NULL}, {(char *)"dimensions", (getter)Buffer_dimensions, NULL, NULL, NULL}, {NULL, NULL, NULL, NULL, NULL} }; @@ -121,7 +159,7 @@ PyTypeObject BGL_bufferType = { (reprfunc) Buffer_repr, /*tp_repr */ NULL, /*tp_as_number */ &Buffer_SeqMethods, /*tp_as_sequence */ - NULL, /* PyMappingMethods *tp_as_mapping; */ + &Buffer_AsMapping, /* PyMappingMethods *tp_as_mapping; */ /* More standard operations (here for binary compatibility) */ @@ -262,7 +300,8 @@ static PyObject *Buffer_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject int ndimensions = 0; if(kwds && PyDict_Size(kwds)) { - PyErr_SetString(PyExc_TypeError, "bgl.Buffer(): takes no keyword args"); + PyErr_SetString(PyExc_TypeError, + "bgl.Buffer(): takes no keyword args"); return NULL; } @@ -319,7 +358,7 @@ static PyObject *Buffer_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject buffer= BGL_MakeBuffer(type, ndimensions, dimensions, NULL); if (init && ndimensions) { - if (Buffer_ass_slice((PyObject *) buffer, 0, dimensions[0], init)) { + if (Buffer_ass_slice(buffer, 0, dimensions[0], init)) { Py_DECREF(buffer); return NULL; } @@ -330,51 +369,48 @@ static PyObject *Buffer_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject /*@ Buffer sequence methods */ -static int Buffer_len(PyObject *self) +static int Buffer_len(Buffer *self) { - Buffer *buf= (Buffer *) self; - return buf->dimensions[0]; + return self->dimensions[0]; } -static PyObject *Buffer_item(PyObject *self, int i) +static PyObject *Buffer_item(Buffer *self, int i) { - Buffer *buf= (Buffer *) self; - - if (i >= buf->dimensions[0]) { + if (i >= self->dimensions[0] || i < 0) { PyErr_SetString(PyExc_IndexError, "array index out of range"); return NULL; } - if (buf->ndimensions==1) { - switch (buf->type) { - case GL_BYTE: return Py_BuildValue("b", buf->buf.asbyte[i]); - case GL_SHORT: return Py_BuildValue("h", buf->buf.asshort[i]); - case GL_INT: return Py_BuildValue("i", buf->buf.asint[i]); - case GL_FLOAT: return PyFloat_FromDouble(buf->buf.asfloat[i]); - case GL_DOUBLE: return Py_BuildValue("d", buf->buf.asdouble[i]); + if (self->ndimensions==1) { + switch (self->type) { + case GL_BYTE: return Py_BuildValue("b", self->buf.asbyte[i]); + case GL_SHORT: return Py_BuildValue("h", self->buf.asshort[i]); + case GL_INT: return Py_BuildValue("i", self->buf.asint[i]); + case GL_FLOAT: return PyFloat_FromDouble(self->buf.asfloat[i]); + case GL_DOUBLE: return Py_BuildValue("d", self->buf.asdouble[i]); } } else { Buffer *newbuf; int j, length, size; - + length= 1; - for (j=1; j<buf->ndimensions; j++) { - length*= buf->dimensions[j]; + for (j=1; j < self->ndimensions; j++) { + length *= self->dimensions[j]; } - size= BGL_typeSize(buf->type); + size= BGL_typeSize(self->type); newbuf= (Buffer *) PyObject_NEW(Buffer, &BGL_bufferType); Py_INCREF(self); - newbuf->parent= self; + newbuf->parent= (PyObject *)self; - newbuf->ndimensions= buf->ndimensions-1; - newbuf->type= buf->type; - newbuf->buf.asvoid= buf->buf.asbyte + i*length*size; + newbuf->ndimensions= self->ndimensions - 1; + newbuf->type= self->type; + newbuf->buf.asvoid= self->buf.asbyte + i*length*size; newbuf->dimensions= MEM_mallocN(newbuf->ndimensions*sizeof(int), "Buffer dimensions"); - memcpy(newbuf->dimensions, buf->dimensions+1, + memcpy(newbuf->dimensions, self->dimensions+1, newbuf->ndimensions*sizeof(int)); return (PyObject *) newbuf; @@ -383,16 +419,14 @@ static PyObject *Buffer_item(PyObject *self, int i) return NULL; } -static PyObject *Buffer_slice(PyObject *self, int begin, int end) +static PyObject *Buffer_slice(Buffer *self, int begin, int end) { - Buffer *buf= (Buffer *) self; PyObject *list; int count; - if (begin<0) begin= 0; - if (end>buf->dimensions[0]) - end= buf->dimensions[0]; - if (begin>end) begin= end; + if (begin < 0) begin= 0; + if (end > self->dimensions[0]) end= self->dimensions[0]; + if (begin > end) begin= end; list= PyList_New(end-begin); @@ -402,21 +436,19 @@ static PyObject *Buffer_slice(PyObject *self, int begin, int end) return list; } -static int Buffer_ass_item(PyObject *self, int i, PyObject *v) +static int Buffer_ass_item(Buffer *self, int i, PyObject *v) { - Buffer *buf= (Buffer *) self; - - if (i >= buf->dimensions[0]) { + if (i >= self->dimensions[0] || i < 0) { PyErr_SetString(PyExc_IndexError, "array assignment index out of range"); return -1; } - if (buf->ndimensions!=1) { - PyObject *row= Buffer_item(self, i); + if (self->ndimensions!=1) { + Buffer *row= (Buffer *)Buffer_item(self, i); if (row) { - int ret= Buffer_ass_slice(row, 0, buf->dimensions[1], v); + int ret= Buffer_ass_slice(row, 0, self->dimensions[1], v); Py_DECREF(row); return ret; } @@ -425,31 +457,30 @@ static int Buffer_ass_item(PyObject *self, int i, PyObject *v) } } - switch(buf->type) { + switch(self->type) { case GL_BYTE: - return PyArg_Parse(v, "b:Expected ints", &buf->buf.asbyte[i]) ? 0:-1; + return PyArg_Parse(v, "b:Expected ints", &self->buf.asbyte[i]) ? 0:-1; case GL_SHORT: - return PyArg_Parse(v, "h:Expected ints", &buf->buf.asshort[i]) ? 0:-1; + return PyArg_Parse(v, "h:Expected ints", &self->buf.asshort[i]) ? 0:-1; case GL_INT: - return PyArg_Parse(v, "i:Expected ints", &buf->buf.asint[i]) ? 0:-1; + return PyArg_Parse(v, "i:Expected ints", &self->buf.asint[i]) ? 0:-1; case GL_FLOAT: - return PyArg_Parse(v, "f:Expected floats", &buf->buf.asfloat[i]) ? 0:-1; + return PyArg_Parse(v, "f:Expected floats", &self->buf.asfloat[i]) ? 0:-1; case GL_DOUBLE: - return PyArg_Parse(v, "d:Expected floats", &buf->buf.asdouble[i]) ? 0:-1; + return PyArg_Parse(v, "d:Expected floats", &self->buf.asdouble[i]) ? 0:-1; default: return 0; /* should never happen */ } } -static int Buffer_ass_slice(PyObject *self, int begin, int end, PyObject *seq) +static int Buffer_ass_slice(Buffer *self, int begin, int end, PyObject *seq) { - Buffer *buf= (Buffer *) self; PyObject *item; int count, err=0; - if (begin<0) begin= 0; - if (end>buf->dimensions[0]) end= buf->dimensions[0]; - if (begin>end) begin= end; + if (begin < 0) begin= 0; + if (end > self->dimensions[0]) end= self->dimensions[0]; + if (begin > end) begin= end; if (!PySequence_Check(seq)) { PyErr_Format(PyExc_TypeError, @@ -481,27 +512,94 @@ static int Buffer_ass_slice(PyObject *self, int begin, int end, PyObject *seq) return err; } -static void Buffer_dealloc(PyObject *self) +static PyObject *Buffer_subscript(Buffer *self, PyObject *item) { - Buffer *buf = (Buffer *)self; + if (PyIndex_Check(item)) { + Py_ssize_t i; + i = PyNumber_AsSsize_t(item, PyExc_IndexError); + if (i == -1 && PyErr_Occurred()) + return NULL; + if (i < 0) + i += self->dimensions[0]; + return Buffer_item(self, i); + } + else if (PySlice_Check(item)) { + Py_ssize_t start, stop, step, slicelength; - if (buf->parent) Py_DECREF(buf->parent); - else MEM_freeN (buf->buf.asvoid); + if (PySlice_GetIndicesEx((void *)item, self->dimensions[0], &start, &stop, &step, &slicelength) < 0) + return NULL; + + if (slicelength <= 0) { + return PyTuple_New(0); + } + else if (step == 1) { + return Buffer_slice(self, start, stop); + } + else { + PyErr_SetString(PyExc_IndexError, + "slice steps not supported with vectors"); + return NULL; + } + } + else { + PyErr_Format(PyExc_TypeError, + "buffer indices must be integers, not %.200s", + Py_TYPE(item)->tp_name); + return NULL; + } +} + +static int Buffer_ass_subscript(Buffer *self, PyObject *item, PyObject *value) +{ + if (PyIndex_Check(item)) { + Py_ssize_t i = PyNumber_AsSsize_t(item, PyExc_IndexError); + if (i == -1 && PyErr_Occurred()) + return -1; + if (i < 0) + i += self->dimensions[0]; + return Buffer_ass_item(self, i, value); + } + else if (PySlice_Check(item)) { + Py_ssize_t start, stop, step, slicelength; + + if (PySlice_GetIndicesEx((void *)item, self->dimensions[0], &start, &stop, &step, &slicelength) < 0) + return -1; + + if (step == 1) + return Buffer_ass_slice(self, start, stop, value); + else { + PyErr_SetString(PyExc_IndexError, + "slice steps not supported with vectors"); + return -1; + } + } + else { + PyErr_Format(PyExc_TypeError, + "buffer indices must be integers, not %.200s", + Py_TYPE(item)->tp_name); + return -1; + } +} + + +static void Buffer_dealloc(Buffer *self) +{ + if (self->parent) Py_DECREF(self->parent); + else MEM_freeN (self->buf.asvoid); + + MEM_freeN(self->dimensions); - MEM_freeN (buf->dimensions); - PyObject_DEL(self); } -static PyObject *Buffer_repr(PyObject *self) +static PyObject *Buffer_repr(Buffer *self) { - PyObject *list= Buffer_to_list(self); + PyObject *list= Buffer_to_list_recursive(self); PyObject *repr; const char *typestr= "UNKNOWN"; - Buffer *buffer= (Buffer *)self; - switch(buffer->type) { + switch(self->type) { case GL_BYTE: typestr= "GL_BYTE"; break; case GL_SHORT: typestr= "GL_SHORT"; break; case GL_INT: typestr= "GL_BYTE"; break; diff --git a/source/blender/python/intern/CMakeLists.txt b/source/blender/python/intern/CMakeLists.txt index 287ba45a1cf..93a4b3ec269 100644 --- a/source/blender/python/intern/CMakeLists.txt +++ b/source/blender/python/intern/CMakeLists.txt @@ -25,13 +25,13 @@ set(INC .. + ../../blenkernel ../../blenlib + ../../blenloader + ../../editors/include ../../makesdna ../../makesrna - ../../blenkernel - ../../blenloader ../../windowmanager - ../../editors/include ../../../../intern/guardedalloc ) @@ -88,9 +88,6 @@ if(WITH_PYTHON_SAFETY) endif() if(WITH_AUDASPACE) - list(APPEND INC - ../../../intern/audaspace/intern - ) add_definitions(-DWITH_AUDASPACE) endif() diff --git a/source/blender/python/intern/bpy.c b/source/blender/python/intern/bpy.c index fb4c285a458..3f637feadf7 100644 --- a/source/blender/python/intern/bpy.c +++ b/source/blender/python/intern/bpy.c @@ -55,10 +55,10 @@ #include "MEM_guardedalloc.h" /* external util modules */ -#include "../generic/mathutils.h" +#include "../generic/IDProp.h" #include "../generic/bgl.h" #include "../generic/blf_py_api.h" -#include "../generic/IDProp.h" +#include "../mathutils/mathutils.h" PyObject *bpy_package_py= NULL; diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index f091a511e93..8bd6e6c611c 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -66,10 +66,10 @@ #include "../generic/py_capi_utils.h" /* inittab initialization functions */ -#include "../generic/noise_py_api.h" -#include "../generic/mathutils.h" #include "../generic/bgl.h" #include "../generic/blf_py_api.h" +#include "../generic/noise_py_api.h" +#include "../mathutils/mathutils.h" /* for internal use, when starting and ending python scripts */ @@ -175,8 +175,8 @@ extern PyObject *AUD_initPython(void); static struct _inittab bpy_internal_modules[]= { {(char *)"noise", BPyInit_noise}, - {(char *)"mathutils", BPyInit_mathutils}, -// {(char *)"mathutils.geometry", BPyInit_mathutils_geometry}, + {(char *)"mathutils", PyInit_mathutils}, +// {(char *)"mathutils.geometry", PyInit_mathutils_geometry}, {(char *)"bgl", BPyInit_bgl}, {(char *)"blf", BPyInit_blf}, #ifdef WITH_AUDASPACE diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 4f6edb02a7c..6e1b9c807f3 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -346,7 +346,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb static int deferred_register_prop(StructRNA *srna, PyObject *key, PyObject *item); #ifdef USE_MATHUTILS -#include "../generic/mathutils.h" /* so we can have mathutils callbacks */ +#include "../mathutils/mathutils.h" /* so we can have mathutils callbacks */ static PyObject *pyrna_prop_array_subscript_slice(BPy_PropertyArrayRNA *self, PointerRNA *ptr, PropertyRNA *prop, Py_ssize_t start, Py_ssize_t stop, Py_ssize_t length); static short pyrna_rotation_euler_order_get(PointerRNA *ptr, PropertyRNA **prop_eul_order, short order_fallback); @@ -4548,7 +4548,7 @@ PyTypeObject pyrna_struct_meta_idprop_Type= { NULL, /* printfunc tp_print; */ NULL, /* getattrfunc tp_getattr; */ NULL, /* setattrfunc tp_setattr; */ - NULL, /* tp_compare */ /* DEPRECATED in python 3.0! */ + NULL, /* tp_compare */ /* deprecated in python 3.0! */ NULL, /* tp_repr */ /* Method suites for standard classes */ diff --git a/source/blender/python/mathutils/CMakeLists.txt b/source/blender/python/mathutils/CMakeLists.txt new file mode 100644 index 00000000000..b28496d612e --- /dev/null +++ b/source/blender/python/mathutils/CMakeLists.txt @@ -0,0 +1,52 @@ +# ***** BEGIN GPL LICENSE BLOCK ***** +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# Contributor(s): Campbell Barton +# +# ***** END GPL LICENSE BLOCK ***** + +set(INC + . + ../../blenlib + ../../blenkernel + ../../makesdna + ../../../../intern/guardedalloc +) + +set(INC_SYS + ${PYTHON_INCLUDE_DIRS} +) + +set(SRC + mathutils.c + mathutils_Color.c + mathutils_Euler.c + mathutils_Matrix.c + mathutils_Quaternion.c + mathutils_Vector.c + mathutils_geometry.c + + mathutils.h + mathutils_Color.h + mathutils_Euler.h + mathutils_Matrix.h + mathutils_Quaternion.h + mathutils_Vector.h + mathutils_geometry.h +) + + +blender_add_lib(bf_python_mathutils "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/python/generic/mathutils.c b/source/blender/python/mathutils/mathutils.c index 1ff33d5a6bb..4a0fa509a0d 100644 --- a/source/blender/python/generic/mathutils.c +++ b/source/blender/python/mathutils/mathutils.c @@ -1,5 +1,5 @@ /* - * $Id$ + * $Id: mathutils.c 38409 2011-07-15 04:01:47Z campbellbarton $ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -345,7 +345,7 @@ static struct PyModuleDef M_Mathutils_module_def = { NULL, /* m_free */ }; -PyMODINIT_FUNC BPyInit_mathutils(void) +PyMODINIT_FUNC PyInit_mathutils(void) { PyObject *submodule; PyObject *item; @@ -371,7 +371,7 @@ PyMODINIT_FUNC BPyInit_mathutils(void) PyModule_AddObject(submodule, "Color", (PyObject *)&color_Type); /* submodule */ - PyModule_AddObject(submodule, "geometry", (item=BPyInit_mathutils_geometry())); + PyModule_AddObject(submodule, "geometry", (item=PyInit_mathutils_geometry())); /* XXX, python doesnt do imports with this usefully yet * 'from mathutils.geometry import PolyFill' * ...fails without this. */ diff --git a/source/blender/python/generic/mathutils.h b/source/blender/python/mathutils/mathutils.h index 449708d1ac1..90ef768c3ec 100644 --- a/source/blender/python/generic/mathutils.h +++ b/source/blender/python/mathutils/mathutils.h @@ -1,5 +1,5 @@ /* - * $Id$ + * $Id: mathutils.h 38409 2011-07-15 04:01:47Z campbellbarton $ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -67,7 +67,7 @@ int BaseMathObject_traverse(BaseMathObject *self, visitproc visit, void *arg); int BaseMathObject_clear(BaseMathObject *self); void BaseMathObject_dealloc(BaseMathObject * self); -PyMODINIT_FUNC BPyInit_mathutils(void); +PyMODINIT_FUNC PyInit_mathutils(void); int EXPP_FloatsAreEqual(float A, float B, int floatSteps); int EXPP_VectorsAreEqual(float *vecA, float *vecB, int size, int floatSteps); diff --git a/source/blender/python/generic/mathutils_Color.c b/source/blender/python/mathutils/mathutils_Color.c index d0c7ec72cea..37730ba4649 100644 --- a/source/blender/python/generic/mathutils_Color.c +++ b/source/blender/python/mathutils/mathutils_Color.c @@ -1,5 +1,5 @@ /* - * $Id$ + * $Id: mathutils_Color.c 38409 2011-07-15 04:01:47Z campbellbarton $ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/python/generic/mathutils_Color.h b/source/blender/python/mathutils/mathutils_Color.h index 0fc880363f4..0afb0ee4dc1 100644 --- a/source/blender/python/generic/mathutils_Color.h +++ b/source/blender/python/mathutils/mathutils_Color.h @@ -1,5 +1,5 @@ /* - * $Id$ + * $Id: mathutils_Color.h 38409 2011-07-15 04:01:47Z campbellbarton $ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/python/generic/mathutils_Euler.c b/source/blender/python/mathutils/mathutils_Euler.c index a7d6d921d16..afff9275aa0 100644 --- a/source/blender/python/generic/mathutils_Euler.c +++ b/source/blender/python/mathutils/mathutils_Euler.c @@ -1,5 +1,5 @@ /* - * $Id$ + * $Id: mathutils_Euler.c 38409 2011-07-15 04:01:47Z campbellbarton $ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -38,10 +38,6 @@ #include "BLI_math.h" #include "BLI_utildefines.h" -#ifndef int32_t -#include "BLO_sys_types.h" -#endif - #define EULER_SIZE 3 //----------------------------------mathutils.Euler() ------------------- @@ -89,7 +85,7 @@ static const char *euler_order_str(EulerObject *self) short euler_order_from_string(const char *str, const char *error_prefix) { if((str[0] && str[1] && str[2] && str[3]=='\0')) { - switch(*((int32_t *)str)) { + switch(*((PY_INT32_T *)str)) { case 'X'|'Y'<<8|'Z'<<16: return EULER_ORDER_XYZ; case 'X'|'Z'<<8|'Y'<<16: return EULER_ORDER_XZY; case 'Y'|'X'<<8|'Z'<<16: return EULER_ORDER_YXZ; diff --git a/source/blender/python/generic/mathutils_Euler.h b/source/blender/python/mathutils/mathutils_Euler.h index 849e16c2bb7..2df3d6198b8 100644 --- a/source/blender/python/generic/mathutils_Euler.h +++ b/source/blender/python/mathutils/mathutils_Euler.h @@ -1,5 +1,5 @@ /* - * $Id$ + * $Id: mathutils_Euler.h 38409 2011-07-15 04:01:47Z campbellbarton $ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/python/generic/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c index c5ed1e32ee8..d0483fbf3df 100644 --- a/source/blender/python/generic/mathutils_Matrix.c +++ b/source/blender/python/mathutils/mathutils_Matrix.c @@ -1,5 +1,5 @@ /* - * $Id$ + * $Id: mathutils_Matrix.c 38527 2011-07-20 06:41:51Z campbellbarton $ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -35,7 +35,6 @@ #include "mathutils.h" #include "BLI_math.h" -#include "BLI_blenlib.h" #include "BLI_utildefines.h" static PyObject *Matrix_copy(MatrixObject *self); @@ -1588,31 +1587,25 @@ static PyObject *Matrix_mul(PyObject *m1, PyObject *m2) if(mat1 && mat2) { /*MATRIX * MATRIX*/ - if(mat1->row_size != mat2->col_size){ + if(mat2->row_size != mat1->col_size){ PyErr_SetString(PyExc_ValueError, "Matrix multiplication: " "matrix A rowsize must equal matrix B colsize"); return NULL; } else { - float mat[16]= {0.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f}; - double dot = 0.0f; + float mat[16]= {0.0f}; int x, y, z; for(x = 0; x < mat2->row_size; x++) { for(y = 0; y < mat1->col_size; y++) { for(z = 0; z < mat1->row_size; z++) { - dot += (mat1->matrix[z][y] * mat2->matrix[x][z]); + mat[x * mat2->col_size + y] += (mat2->matrix[x][z] * mat1->matrix[z][y]); } - mat[((x * mat1->col_size) + y)] = (float)dot; - dot = 0.0f; } } - return newMatrixObject(mat, mat2->row_size, mat1->col_size, Py_NEW, Py_TYPE(mat1)); + return newMatrixObject(mat, mat1->row_size, mat2->col_size, Py_NEW, Py_TYPE(mat1)); } } else if(mat2) { diff --git a/source/blender/python/generic/mathutils_Matrix.h b/source/blender/python/mathutils/mathutils_Matrix.h index aa736d1e959..84a92bae2be 100644 --- a/source/blender/python/generic/mathutils_Matrix.h +++ b/source/blender/python/mathutils/mathutils_Matrix.h @@ -1,5 +1,5 @@ /* - * $Id$ + * $Id: mathutils_Matrix.h 38409 2011-07-15 04:01:47Z campbellbarton $ * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/python/generic/mathutils_Quaternion.c b/source/blender/python/mathutils/mathutils_Quaternion.c index 3b05b9a250b..62e2fb48103 100644 --- a/source/blender/python/generic/mathutils_Quaternion.c +++ b/source/blender/python/mathutils/mathutils_Quaternion.c @@ -1,5 +1,5 @@ /* - * $Id$ + * $Id: mathutils_Quaternion.c 38409 2011-07-15 04:01:47Z campbellbarton $ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/python/generic/mathutils_Quaternion.h b/source/blender/python/mathutils/mathutils_Quaternion.h index d606621390a..4ba70895680 100644 --- a/source/blender/python/generic/mathutils_Quaternion.h +++ b/source/blender/python/mathutils/mathutils_Quaternion.h @@ -1,5 +1,5 @@ /* - * $Id$ + * $Id: mathutils_Quaternion.h 38409 2011-07-15 04:01:47Z campbellbarton $ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/python/generic/mathutils_Vector.c b/source/blender/python/mathutils/mathutils_Vector.c index a834e8f2ba4..e1a96f278d7 100644 --- a/source/blender/python/generic/mathutils_Vector.c +++ b/source/blender/python/mathutils/mathutils_Vector.c @@ -1,5 +1,5 @@ /* - * $Id$ + * $Id: mathutils_Vector.c 38409 2011-07-15 04:01:47Z campbellbarton $ * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -34,7 +34,6 @@ #include "mathutils.h" -#include "BLI_blenlib.h" #include "BLI_math.h" #include "BLI_utildefines.h" diff --git a/source/blender/python/generic/mathutils_Vector.h b/source/blender/python/mathutils/mathutils_Vector.h index 0ede836ce44..e430a100836 100644 --- a/source/blender/python/generic/mathutils_Vector.h +++ b/source/blender/python/mathutils/mathutils_Vector.h @@ -1,5 +1,5 @@ /* - * $Id$ + * $Id: mathutils_Vector.h 38409 2011-07-15 04:01:47Z campbellbarton $ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/python/generic/mathutils_geometry.c b/source/blender/python/mathutils/mathutils_geometry.c index d2724f6603e..acfb8a91416 100644 --- a/source/blender/python/generic/mathutils_geometry.c +++ b/source/blender/python/mathutils/mathutils_geometry.c @@ -1,5 +1,5 @@ /* - * $Id$ + * $Id: mathutils_geometry.c 38409 2011-07-15 04:01:47Z campbellbarton $ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -37,16 +37,16 @@ #include "mathutils_geometry.h" /* Used for PolyFill */ -#include "MEM_guardedalloc.h" +#ifndef MATH_STANDALONE /* define when building outside blender */ +# include "MEM_guardedalloc.h" +# include "BLI_blenlib.h" +# include "BLI_boxpack2d.h" +# include "BKE_displist.h" +# include "BKE_curve.h" +#endif -#include "BLI_blenlib.h" -#include "BLI_boxpack2d.h" #include "BLI_math.h" #include "BLI_utildefines.h" - -#include "BKE_displist.h" - -#include "BKE_curve.h" #define SWAP_FLOAT(a, b, tmp) tmp=a; a=b; b=tmp #define eps 0.000001 @@ -346,132 +346,6 @@ static PyObject *M_Geometry_area_tri(PyObject *UNUSED(self), PyObject* args) } } -/*----------------------------------geometry.PolyFill() -------------------*/ -PyDoc_STRVAR(M_Geometry_tesselate_polygon_doc, -".. function:: tesselate_polygon(veclist_list)\n" -"\n" -" Takes a list of polylines (each point a vector) and returns the point indices for a polyline filled with triangles.\n" -"\n" -" :arg veclist_list: list of polylines\n" -" :rtype: list\n" -); -/* PolyFill function, uses Blenders scanfill to fill multiple poly lines */ -static PyObject *M_Geometry_tesselate_polygon(PyObject *UNUSED(self), PyObject *polyLineSeq) -{ - PyObject *tri_list; /*return this list of tri's */ - PyObject *polyLine, *polyVec; - int i, len_polylines, len_polypoints, ls_error= 0; - - /* display listbase */ - ListBase dispbase={NULL, NULL}; - DispList *dl; - float *fp; /*pointer to the array of malloced dl->verts to set the points from the vectors */ - int index, *dl_face, totpoints=0; - - if(!PySequence_Check(polyLineSeq)) { - PyErr_SetString(PyExc_TypeError, - "expected a sequence of poly lines"); - return NULL; - } - - len_polylines= PySequence_Size(polyLineSeq); - - for(i= 0; i < len_polylines; ++i) { - polyLine= PySequence_GetItem(polyLineSeq, i); - if (!PySequence_Check(polyLine)) { - freedisplist(&dispbase); - Py_XDECREF(polyLine); /* may be null so use Py_XDECREF*/ - PyErr_SetString(PyExc_TypeError, - "One or more of the polylines is not a sequence of mathutils.Vector's"); - return NULL; - } - - len_polypoints= PySequence_Size(polyLine); - if (len_polypoints>0) { /* dont bother adding edges as polylines */ -#if 0 - if (EXPP_check_sequence_consistency(polyLine, &vector_Type) != 1) { - freedisplist(&dispbase); - Py_DECREF(polyLine); - PyErr_SetString(PyExc_TypeError, - "A point in one of the polylines is not a mathutils.Vector type"); - return NULL; - } -#endif - dl= MEM_callocN(sizeof(DispList), "poly disp"); - BLI_addtail(&dispbase, dl); - dl->type= DL_INDEX3; - dl->nr= len_polypoints; - dl->type= DL_POLY; - dl->parts= 1; /* no faces, 1 edge loop */ - dl->col= 0; /* no material */ - dl->verts= fp= MEM_callocN(sizeof(float)*3*len_polypoints, "dl verts"); - dl->index= MEM_callocN(sizeof(int)*3*len_polypoints, "dl index"); - - for(index= 0; index<len_polypoints; ++index, fp+=3) { - polyVec= PySequence_GetItem(polyLine, index); - if(VectorObject_Check(polyVec)) { - - if(BaseMath_ReadCallback((VectorObject *)polyVec) == -1) - ls_error= 1; - - fp[0]= ((VectorObject *)polyVec)->vec[0]; - fp[1]= ((VectorObject *)polyVec)->vec[1]; - if(((VectorObject *)polyVec)->size > 2) - fp[2]= ((VectorObject *)polyVec)->vec[2]; - else - fp[2]= 0.0f; /* if its a 2d vector then set the z to be zero */ - } - else { - ls_error= 1; - } - - totpoints++; - Py_DECREF(polyVec); - } - } - Py_DECREF(polyLine); - } - - if(ls_error) { - freedisplist(&dispbase); /* possible some dl was allocated */ - PyErr_SetString(PyExc_TypeError, - "A point in one of the polylines " - "is not a mathutils.Vector type"); - return NULL; - } - else if (totpoints) { - /* now make the list to return */ - filldisplist(&dispbase, &dispbase, 0); - - /* The faces are stored in a new DisplayList - thats added to the head of the listbase */ - dl= dispbase.first; - - tri_list= PyList_New(dl->parts); - if(!tri_list) { - freedisplist(&dispbase); - PyErr_SetString(PyExc_RuntimeError, - "failed to make a new list"); - return NULL; - } - - index= 0; - dl_face= dl->index; - while(index < dl->parts) { - PyList_SET_ITEM(tri_list, index, Py_BuildValue("iii", dl_face[0], dl_face[1], dl_face[2])); - dl_face+= 3; - index++; - } - freedisplist(&dispbase); - } - else { - /* no points, do this so scripts dont barf */ - freedisplist(&dispbase); /* possible some dl was allocated */ - tri_list= PyList_New(0); - } - - return tri_list; -} PyDoc_STRVAR(M_Geometry_intersect_line_line_2d_doc, ".. function:: intersect_line_line_2d(lineA_p1, lineA_p2, lineB_p1, lineB_p2)\n" @@ -844,25 +718,288 @@ static PyObject *M_Geometry_intersect_point_quad_2d(PyObject *UNUSED(self), PyOb return PyLong_FromLong(isect_point_quad_v2(pt_vec->vec, quad_p1->vec, quad_p2->vec, quad_p3->vec, quad_p4->vec)); } +PyDoc_STRVAR(M_Geometry_barycentric_transform_doc, +".. function:: barycentric_transform(point, tri_a1, tri_a2, tri_a3, tri_b1, tri_b2, tri_b3)\n" +"\n" +" Return a transformed point, the transformation is defined by 2 triangles.\n" +"\n" +" :arg point: The point to transform.\n" +" :type point: :class:`mathutils.Vector`\n" +" :arg tri_a1: source triangle vertex.\n" +" :type tri_a1: :class:`mathutils.Vector`\n" +" :arg tri_a2: source triangle vertex.\n" +" :type tri_a2: :class:`mathutils.Vector`\n" +" :arg tri_a3: source triangle vertex.\n" +" :type tri_a3: :class:`mathutils.Vector`\n" +" :arg tri_a1: target triangle vertex.\n" +" :type tri_a1: :class:`mathutils.Vector`\n" +" :arg tri_a2: target triangle vertex.\n" +" :type tri_a2: :class:`mathutils.Vector`\n" +" :arg tri_a3: target triangle vertex.\n" +" :type tri_a3: :class:`mathutils.Vector`\n" +" :return: The transformed point\n" +" :rtype: :class:`mathutils.Vector`'s\n" +); +static PyObject *M_Geometry_barycentric_transform(PyObject *UNUSED(self), PyObject *args) +{ + VectorObject *vec_pt; + VectorObject *vec_t1_tar, *vec_t2_tar, *vec_t3_tar; + VectorObject *vec_t1_src, *vec_t2_src, *vec_t3_src; + float vec[3]; + + if(!PyArg_ParseTuple(args, "O!O!O!O!O!O!O!:barycentric_transform", + &vector_Type, &vec_pt, + &vector_Type, &vec_t1_src, + &vector_Type, &vec_t2_src, + &vector_Type, &vec_t3_src, + &vector_Type, &vec_t1_tar, + &vector_Type, &vec_t2_tar, + &vector_Type, &vec_t3_tar) + ) { + return NULL; + } + + if( vec_pt->size != 3 || + vec_t1_src->size != 3 || + vec_t2_src->size != 3 || + vec_t3_src->size != 3 || + vec_t1_tar->size != 3 || + vec_t2_tar->size != 3 || + vec_t3_tar->size != 3) + { + PyErr_SetString(PyExc_ValueError, + "One of more of the vector arguments wasn't a 3D vector"); + return NULL; + } + + barycentric_transform(vec, vec_pt->vec, + vec_t1_tar->vec, vec_t2_tar->vec, vec_t3_tar->vec, + vec_t1_src->vec, vec_t2_src->vec, vec_t3_src->vec); + + return newVectorObject(vec, 3, Py_NEW, NULL); +} + +#ifndef MATH_STANDALONE + +PyDoc_STRVAR(M_Geometry_interpolate_bezier_doc, +".. function:: interpolate_bezier(knot1, handle1, handle2, knot2, resolution)\n" +"\n" +" Interpolate a bezier spline segment.\n" +"\n" +" :arg knot1: First bezier spline point.\n" +" :type knot1: :class:`mathutils.Vector`\n" +" :arg handle1: First bezier spline handle.\n" +" :type handle1: :class:`mathutils.Vector`\n" +" :arg handle2: Second bezier spline handle.\n" +" :type handle2: :class:`mathutils.Vector`\n" +" :arg knot2: Second bezier spline point.\n" +" :type knot2: :class:`mathutils.Vector`\n" +" :arg resolution: Number of points to return.\n" +" :type resolution: int\n" +" :return: The interpolated points\n" +" :rtype: list of :class:`mathutils.Vector`'s\n" +); +static PyObject *M_Geometry_interpolate_bezier(PyObject *UNUSED(self), PyObject* args) +{ + VectorObject *vec_k1, *vec_h1, *vec_k2, *vec_h2; + int resolu; + int dims; + int i; + float *coord_array, *fp; + PyObject *list; + + float k1[4]= {0.0, 0.0, 0.0, 0.0}; + float h1[4]= {0.0, 0.0, 0.0, 0.0}; + float k2[4]= {0.0, 0.0, 0.0, 0.0}; + float h2[4]= {0.0, 0.0, 0.0, 0.0}; + + + if(!PyArg_ParseTuple(args, "O!O!O!O!i:interpolate_bezier", + &vector_Type, &vec_k1, + &vector_Type, &vec_h1, + &vector_Type, &vec_h2, + &vector_Type, &vec_k2, &resolu) + ) { + return NULL; + } + + if(resolu <= 1) { + PyErr_SetString(PyExc_ValueError, + "resolution must be 2 or over"); + return NULL; + } + + if(BaseMath_ReadCallback(vec_k1) == -1 || BaseMath_ReadCallback(vec_h1) == -1 || BaseMath_ReadCallback(vec_k2) == -1 || BaseMath_ReadCallback(vec_h2) == -1) + return NULL; + + dims= MAX4(vec_k1->size, vec_h1->size, vec_h2->size, vec_k2->size); + + for(i=0; i < vec_k1->size; i++) k1[i]= vec_k1->vec[i]; + for(i=0; i < vec_h1->size; i++) h1[i]= vec_h1->vec[i]; + for(i=0; i < vec_k2->size; i++) k2[i]= vec_k2->vec[i]; + for(i=0; i < vec_h2->size; i++) h2[i]= vec_h2->vec[i]; + + coord_array= MEM_callocN(dims * (resolu) * sizeof(float), "interpolate_bezier"); + for(i=0; i<dims; i++) { + forward_diff_bezier(k1[i], h1[i], h2[i], k2[i], coord_array+i, resolu-1, sizeof(float)*dims); + } + + list= PyList_New(resolu); + fp= coord_array; + for(i=0; i<resolu; i++, fp= fp+dims) { + PyList_SET_ITEM(list, i, newVectorObject(fp, dims, Py_NEW, NULL)); + } + MEM_freeN(coord_array); + return list; +} + + +PyDoc_STRVAR(M_Geometry_tesselate_polygon_doc, +".. function:: tesselate_polygon(veclist_list)\n" +"\n" +" Takes a list of polylines (each point a vector) and returns the point indices for a polyline filled with triangles.\n" +"\n" +" :arg veclist_list: list of polylines\n" +" :rtype: list\n" +); +/* PolyFill function, uses Blenders scanfill to fill multiple poly lines */ +static PyObject *M_Geometry_tesselate_polygon(PyObject *UNUSED(self), PyObject *polyLineSeq) +{ + PyObject *tri_list; /*return this list of tri's */ + PyObject *polyLine, *polyVec; + int i, len_polylines, len_polypoints, ls_error= 0; + + /* display listbase */ + ListBase dispbase={NULL, NULL}; + DispList *dl; + float *fp; /*pointer to the array of malloced dl->verts to set the points from the vectors */ + int index, *dl_face, totpoints=0; + + if(!PySequence_Check(polyLineSeq)) { + PyErr_SetString(PyExc_TypeError, + "expected a sequence of poly lines"); + return NULL; + } + + len_polylines= PySequence_Size(polyLineSeq); + + for(i= 0; i < len_polylines; ++i) { + polyLine= PySequence_GetItem(polyLineSeq, i); + if (!PySequence_Check(polyLine)) { + freedisplist(&dispbase); + Py_XDECREF(polyLine); /* may be null so use Py_XDECREF*/ + PyErr_SetString(PyExc_TypeError, + "One or more of the polylines is not a sequence of mathutils.Vector's"); + return NULL; + } + + len_polypoints= PySequence_Size(polyLine); + if (len_polypoints>0) { /* dont bother adding edges as polylines */ +#if 0 + if (EXPP_check_sequence_consistency(polyLine, &vector_Type) != 1) { + freedisplist(&dispbase); + Py_DECREF(polyLine); + PyErr_SetString(PyExc_TypeError, + "A point in one of the polylines is not a mathutils.Vector type"); + return NULL; + } +#endif + dl= MEM_callocN(sizeof(DispList), "poly disp"); + BLI_addtail(&dispbase, dl); + dl->type= DL_INDEX3; + dl->nr= len_polypoints; + dl->type= DL_POLY; + dl->parts= 1; /* no faces, 1 edge loop */ + dl->col= 0; /* no material */ + dl->verts= fp= MEM_callocN(sizeof(float)*3*len_polypoints, "dl verts"); + dl->index= MEM_callocN(sizeof(int)*3*len_polypoints, "dl index"); + + for(index= 0; index<len_polypoints; ++index, fp+=3) { + polyVec= PySequence_GetItem(polyLine, index); + if(VectorObject_Check(polyVec)) { + + if(BaseMath_ReadCallback((VectorObject *)polyVec) == -1) + ls_error= 1; + + fp[0]= ((VectorObject *)polyVec)->vec[0]; + fp[1]= ((VectorObject *)polyVec)->vec[1]; + if(((VectorObject *)polyVec)->size > 2) + fp[2]= ((VectorObject *)polyVec)->vec[2]; + else + fp[2]= 0.0f; /* if its a 2d vector then set the z to be zero */ + } + else { + ls_error= 1; + } + + totpoints++; + Py_DECREF(polyVec); + } + } + Py_DECREF(polyLine); + } + + if(ls_error) { + freedisplist(&dispbase); /* possible some dl was allocated */ + PyErr_SetString(PyExc_TypeError, + "A point in one of the polylines " + "is not a mathutils.Vector type"); + return NULL; + } + else if (totpoints) { + /* now make the list to return */ + filldisplist(&dispbase, &dispbase, 0); + + /* The faces are stored in a new DisplayList + thats added to the head of the listbase */ + dl= dispbase.first; + + tri_list= PyList_New(dl->parts); + if(!tri_list) { + freedisplist(&dispbase); + PyErr_SetString(PyExc_RuntimeError, + "failed to make a new list"); + return NULL; + } + + index= 0; + dl_face= dl->index; + while(index < dl->parts) { + PyList_SET_ITEM(tri_list, index, Py_BuildValue("iii", dl_face[0], dl_face[1], dl_face[2])); + dl_face+= 3; + index++; + } + freedisplist(&dispbase); + } + else { + /* no points, do this so scripts dont barf */ + freedisplist(&dispbase); /* possible some dl was allocated */ + tri_list= PyList_New(0); + } + + return tri_list; +} + + static int boxPack_FromPyObject(PyObject *value, boxPack **boxarray) { int len, i; PyObject *list_item, *item_1, *item_2; boxPack *box; - - + + /* Error checking must already be done */ if(!PyList_Check(value)) { PyErr_SetString(PyExc_TypeError, "can only back a list of [x, y, w, h]"); return -1; } - + len= PyList_Size(value); - + (*boxarray)= MEM_mallocN(len*sizeof(boxPack), "boxPack box"); - - + + for(i= 0; i < len; i++) { list_item= PyList_GET_ITEM(value, i); if(!PyList_Check(list_item) || PyList_Size(list_item) < 4) { @@ -871,12 +1008,12 @@ static int boxPack_FromPyObject(PyObject *value, boxPack **boxarray) "can only pack a list of [x, y, w, h]"); return -1; } - + box= (*boxarray)+i; - + item_1= PyList_GET_ITEM(list_item, 2); item_2= PyList_GET_ITEM(list_item, 3); - + box->w= (float)PyFloat_AsDouble(item_1); box->h= (float)PyFloat_AsDouble(item_2); box->index= i; @@ -900,9 +1037,9 @@ static void boxPack_ToPyObject(PyObject *value, boxPack **boxarray) int len, i; PyObject *list_item; boxPack *box; - + len= PyList_Size(value); - + for(i= 0; i < len; i++) { box= (*boxarray)+i; list_item= PyList_GET_ITEM(value, box->index); @@ -928,7 +1065,7 @@ static PyObject *M_Geometry_box_pack_2d(PyObject *UNUSED(self), PyObject *boxlis int len; PyObject *ret; - + if(!PyList_Check(boxlist)) { PyErr_SetString(PyExc_TypeError, "expected a list of boxes [[x, y, w, h], ... ]"); @@ -954,138 +1091,8 @@ static PyObject *M_Geometry_box_pack_2d(PyObject *UNUSED(self), PyObject *boxlis return ret; } -PyDoc_STRVAR(M_Geometry_interpolate_bezier_doc, -".. function:: interpolate_bezier(knot1, handle1, handle2, knot2, resolution)\n" -"\n" -" Interpolate a bezier spline segment.\n" -"\n" -" :arg knot1: First bezier spline point.\n" -" :type knot1: :class:`mathutils.Vector`\n" -" :arg handle1: First bezier spline handle.\n" -" :type handle1: :class:`mathutils.Vector`\n" -" :arg handle2: Second bezier spline handle.\n" -" :type handle2: :class:`mathutils.Vector`\n" -" :arg knot2: Second bezier spline point.\n" -" :type knot2: :class:`mathutils.Vector`\n" -" :arg resolution: Number of points to return.\n" -" :type resolution: int\n" -" :return: The interpolated points\n" -" :rtype: list of :class:`mathutils.Vector`'s\n" -); -static PyObject *M_Geometry_interpolate_bezier(PyObject *UNUSED(self), PyObject* args) -{ - VectorObject *vec_k1, *vec_h1, *vec_k2, *vec_h2; - int resolu; - int dims; - int i; - float *coord_array, *fp; - PyObject *list; - - float k1[4]= {0.0, 0.0, 0.0, 0.0}; - float h1[4]= {0.0, 0.0, 0.0, 0.0}; - float k2[4]= {0.0, 0.0, 0.0, 0.0}; - float h2[4]= {0.0, 0.0, 0.0, 0.0}; - - - if(!PyArg_ParseTuple(args, "O!O!O!O!i:interpolate_bezier", - &vector_Type, &vec_k1, - &vector_Type, &vec_h1, - &vector_Type, &vec_h2, - &vector_Type, &vec_k2, &resolu) - ) { - return NULL; - } - - if(resolu <= 1) { - PyErr_SetString(PyExc_ValueError, - "resolution must be 2 or over"); - return NULL; - } - - if(BaseMath_ReadCallback(vec_k1) == -1 || BaseMath_ReadCallback(vec_h1) == -1 || BaseMath_ReadCallback(vec_k2) == -1 || BaseMath_ReadCallback(vec_h2) == -1) - return NULL; - - dims= MAX4(vec_k1->size, vec_h1->size, vec_h2->size, vec_k2->size); - - for(i=0; i < vec_k1->size; i++) k1[i]= vec_k1->vec[i]; - for(i=0; i < vec_h1->size; i++) h1[i]= vec_h1->vec[i]; - for(i=0; i < vec_k2->size; i++) k2[i]= vec_k2->vec[i]; - for(i=0; i < vec_h2->size; i++) h2[i]= vec_h2->vec[i]; - - coord_array= MEM_callocN(dims * (resolu) * sizeof(float), "interpolate_bezier"); - for(i=0; i<dims; i++) { - forward_diff_bezier(k1[i], h1[i], h2[i], k2[i], coord_array+i, resolu-1, sizeof(float)*dims); - } - - list= PyList_New(resolu); - fp= coord_array; - for(i=0; i<resolu; i++, fp= fp+dims) { - PyList_SET_ITEM(list, i, newVectorObject(fp, dims, Py_NEW, NULL)); - } - MEM_freeN(coord_array); - return list; -} - -PyDoc_STRVAR(M_Geometry_barycentric_transform_doc, -".. function:: barycentric_transform(point, tri_a1, tri_a2, tri_a3, tri_b1, tri_b2, tri_b3)\n" -"\n" -" Return a transformed point, the transformation is defined by 2 triangles.\n" -"\n" -" :arg point: The point to transform.\n" -" :type point: :class:`mathutils.Vector`\n" -" :arg tri_a1: source triangle vertex.\n" -" :type tri_a1: :class:`mathutils.Vector`\n" -" :arg tri_a2: source triangle vertex.\n" -" :type tri_a2: :class:`mathutils.Vector`\n" -" :arg tri_a3: source triangle vertex.\n" -" :type tri_a3: :class:`mathutils.Vector`\n" -" :arg tri_a1: target triangle vertex.\n" -" :type tri_a1: :class:`mathutils.Vector`\n" -" :arg tri_a2: target triangle vertex.\n" -" :type tri_a2: :class:`mathutils.Vector`\n" -" :arg tri_a3: target triangle vertex.\n" -" :type tri_a3: :class:`mathutils.Vector`\n" -" :return: The transformed point\n" -" :rtype: :class:`mathutils.Vector`'s\n" -); -static PyObject *M_Geometry_barycentric_transform(PyObject *UNUSED(self), PyObject *args) -{ - VectorObject *vec_pt; - VectorObject *vec_t1_tar, *vec_t2_tar, *vec_t3_tar; - VectorObject *vec_t1_src, *vec_t2_src, *vec_t3_src; - float vec[3]; +#endif /* MATH_STANDALONE */ - if(!PyArg_ParseTuple(args, "O!O!O!O!O!O!O!:barycentric_transform", - &vector_Type, &vec_pt, - &vector_Type, &vec_t1_src, - &vector_Type, &vec_t2_src, - &vector_Type, &vec_t3_src, - &vector_Type, &vec_t1_tar, - &vector_Type, &vec_t2_tar, - &vector_Type, &vec_t3_tar) - ) { - return NULL; - } - - if( vec_pt->size != 3 || - vec_t1_src->size != 3 || - vec_t2_src->size != 3 || - vec_t3_src->size != 3 || - vec_t1_tar->size != 3 || - vec_t2_tar->size != 3 || - vec_t3_tar->size != 3) - { - PyErr_SetString(PyExc_ValueError, - "One of more of the vector arguments wasn't a 3D vector"); - return NULL; - } - - barycentric_transform(vec, vec_pt->vec, - vec_t1_tar->vec, vec_t2_tar->vec, vec_t3_tar->vec, - vec_t1_src->vec, vec_t2_src->vec, vec_t3_src->vec); - - return newVectorObject(vec, 3, Py_NEW, NULL); -} static PyMethodDef M_Geometry_methods[]= { {"intersect_ray_tri", (PyCFunction) M_Geometry_intersect_ray_tri, METH_VARARGS, M_Geometry_intersect_ray_tri_doc}, @@ -1097,12 +1104,14 @@ static PyMethodDef M_Geometry_methods[]= { {"intersect_line_plane", (PyCFunction) M_Geometry_intersect_line_plane, METH_VARARGS, M_Geometry_intersect_line_plane_doc}, {"intersect_line_sphere", (PyCFunction) M_Geometry_intersect_line_sphere, METH_VARARGS, M_Geometry_intersect_line_sphere_doc}, {"intersect_line_sphere_2d", (PyCFunction) M_Geometry_intersect_line_sphere_2d, METH_VARARGS, M_Geometry_intersect_line_sphere_2d_doc}, - {"interpolate_bezier", (PyCFunction) M_Geometry_interpolate_bezier, METH_VARARGS, M_Geometry_interpolate_bezier_doc}, {"area_tri", (PyCFunction) M_Geometry_area_tri, METH_VARARGS, M_Geometry_area_tri_doc}, {"normal", (PyCFunction) M_Geometry_normal, METH_VARARGS, M_Geometry_normal_doc}, + {"barycentric_transform", (PyCFunction) M_Geometry_barycentric_transform, METH_VARARGS, M_Geometry_barycentric_transform_doc}, +#ifndef MATH_STANDALONE + {"interpolate_bezier", (PyCFunction) M_Geometry_interpolate_bezier, METH_VARARGS, M_Geometry_interpolate_bezier_doc}, {"tesselate_polygon", (PyCFunction) M_Geometry_tesselate_polygon, METH_O, M_Geometry_tesselate_polygon_doc}, {"box_pack_2d", (PyCFunction) M_Geometry_box_pack_2d, METH_O, M_Geometry_box_pack_2d_doc}, - {"barycentric_transform", (PyCFunction) M_Geometry_barycentric_transform, METH_VARARGS, M_Geometry_barycentric_transform_doc}, +#endif {NULL, NULL, 0, NULL} }; @@ -1119,7 +1128,7 @@ static struct PyModuleDef M_Geometry_module_def= { }; /*----------------------------MODULE INIT-------------------------*/ -PyMODINIT_FUNC BPyInit_mathutils_geometry(void) +PyMODINIT_FUNC PyInit_mathutils_geometry(void) { PyObject *submodule= PyModule_Create(&M_Geometry_module_def); return submodule; diff --git a/source/blender/python/generic/mathutils_geometry.h b/source/blender/python/mathutils/mathutils_geometry.h index 929b8cc8d75..0b07fc12c69 100644 --- a/source/blender/python/generic/mathutils_geometry.h +++ b/source/blender/python/mathutils/mathutils_geometry.h @@ -1,5 +1,5 @@ /* - * $Id$ + * $Id: mathutils_geometry.h 38409 2011-07-15 04:01:47Z campbellbarton $ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -38,6 +38,6 @@ #include "mathutils.h" -PyMODINIT_FUNC BPyInit_mathutils_geometry(void); +PyMODINIT_FUNC PyInit_mathutils_geometry(void); #endif /* MATHUTILS_GEOMETRY_H */ diff --git a/source/blender/quicktime/CMakeLists.txt b/source/blender/quicktime/CMakeLists.txt index 6ce4954f053..b647466d2a8 100644 --- a/source/blender/quicktime/CMakeLists.txt +++ b/source/blender/quicktime/CMakeLists.txt @@ -26,17 +26,15 @@ set(INC . - ../quicktime - ../makesdna - ../makesrna - ../blenlib - ../blenkernel ../avi + ../blenkernel + ../blenlib + ../blenloader ../imbuf ../imbuf/intern - ../blenloader + ../makesdna + ../makesrna ../render/extern/include - ../include ../windowmanager ../../../intern/guardedalloc ) diff --git a/source/blender/render/CMakeLists.txt b/source/blender/render/CMakeLists.txt index 003f0b839f8..90aef816e2c 100644 --- a/source/blender/render/CMakeLists.txt +++ b/source/blender/render/CMakeLists.txt @@ -26,17 +26,17 @@ set(INC - intern/include extern/include + intern/include + ../blenkernel ../blenlib ../blenloader + ../imbuf ../makesdna ../makesrna - ../blenkernel - ../imbuf - ../../../intern/smoke/extern - ../../../intern/mikktspace ../../../intern/guardedalloc + ../../../intern/mikktspace + ../../../intern/smoke/extern ) set(INC_SYS @@ -125,8 +125,12 @@ if(WITH_MOD_SMOKE) endif() if(WITH_CODEC_QUICKTIME) - list(APPEND INC ../quicktime) - list(APPEND INC_SYS ${QUICKTIME_INCLUDE_DIRS}) + list(APPEND INC + ../quicktime + ) + list(APPEND INC_SYS + ${QUICKTIME_INCLUDE_DIRS} + ) add_definitions(-DWITH_QUICKTIME) endif() diff --git a/source/blender/windowmanager/CMakeLists.txt b/source/blender/windowmanager/CMakeLists.txt index 6378f62e827..20ac3ba7077 100644 --- a/source/blender/windowmanager/CMakeLists.txt +++ b/source/blender/windowmanager/CMakeLists.txt @@ -26,24 +26,23 @@ set(INC . - ../nodes - ../gpu ../blenfont - ../bmesh - ../blenlib - ../makesdna - ../makesrna ../blenkernel - ../imbuf + ../blenlib ../blenloader ../editors/include + ../gpu + ../imbuf + ../makesdna + ../makesrna + ../nodes ../render/extern/include - ../../../intern/guardedalloc - ../../../intern/memutil + ../../gameengine/BlenderRoutines ../../../intern/elbeem/extern ../../../intern/ghost + ../../../intern/guardedalloc + ../../../intern/memutil ../../../intern/opennl/extern - ../../../source/gameengine/BlenderRoutines ) set(INC_SYS @@ -90,18 +89,26 @@ if(WITH_OPENCOLLADA) endif() if(WITH_CODEC_QUICKTIME) - list(APPEND INC ../quicktime) - list(APPEND INC_SYS ${QUICKTIME_INCLUDE_DIRS}) + list(APPEND INC + ../quicktime + ) + list(APPEND INC_SYS + ${QUICKTIME_INCLUDE_DIRS} + ) add_definitions(-DWITH_QUICKTIME) endif() if(WITH_CODEC_FFMPEG) - list(APPEND INC_SYS ${FFMPEG_INCLUDE_DIRS}) + list(APPEND INC_SYS + ${FFMPEG_INCLUDE_DIRS} + ) add_definitions(-DWITH_FFMPEG) endif() if(WITH_PYTHON) - list(APPEND INC ../python) + list(APPEND INC + ../python + ) add_definitions(-DWITH_PYTHON) if(WITH_PYTHON_SECURITY) diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 35afdf29b53..29afdb570ea 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -3567,10 +3567,12 @@ static void gesture_border_modal_keymap(wmKeyConfig *keyconf) /* items for modal map */ WM_modalkeymap_add_item(keymap, ESCKEY, KM_PRESS, KM_ANY, 0, GESTURE_MODAL_CANCEL); - WM_modalkeymap_add_item(keymap, RIGHTMOUSE, KM_ANY, KM_ANY, 0, GESTURE_MODAL_CANCEL); + /* Note: cancel only on press otherwise you cannot map this to RMB-gesture */ + WM_modalkeymap_add_item(keymap, RIGHTMOUSE, KM_PRESS, KM_ANY, 0, GESTURE_MODAL_CANCEL); WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_PRESS, 0, 0, GESTURE_MODAL_BEGIN); WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_RELEASE, KM_ANY, 0, GESTURE_MODAL_SELECT); + WM_modalkeymap_add_item(keymap, RIGHTMOUSE, KM_RELEASE, KM_ANY, 0, GESTURE_MODAL_SELECT); #if 0 // Durian guys like this WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_PRESS, KM_SHIFT, 0, GESTURE_MODAL_BEGIN); diff --git a/source/blenderplayer/CMakeLists.txt b/source/blenderplayer/CMakeLists.txt index 931165690e5..53a48035f26 100644 --- a/source/blenderplayer/CMakeLists.txt +++ b/source/blenderplayer/CMakeLists.txt @@ -122,6 +122,7 @@ endif() bf_intern_guardedalloc bf_intern_memutil bf_python_ext + bf_python_mathutils bf_blenlib bf_imbuf_cineon bf_imbuf_openexr diff --git a/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt b/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt index 80f3642748a..f852d061cf7 100644 --- a/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt +++ b/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt @@ -29,12 +29,12 @@ remove_strict_flags() set(INC . - .. + .. + ../../blender/blenkernel + ../../blender/blenloader + ../../blender/makesdna + ../../blender/makesrna ../../../intern/guardedalloc - ../../../source/blender/makesdna - ../../../source/blender/blenloader - ../../../source/blender/makesrna - ../../../source/blender/blenkernel ) set(INC_SYS diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index 23884b925b2..a6b136021ce 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -768,6 +768,7 @@ endif() bf_intern_opennl bf_python bf_python_ext + bf_python_mathutils bf_ikplugin bf_bmesh bf_modifiers diff --git a/source/gameengine/BlenderRoutines/CMakeLists.txt b/source/gameengine/BlenderRoutines/CMakeLists.txt index 28f567cc3cd..5a7304765e4 100644 --- a/source/gameengine/BlenderRoutines/CMakeLists.txt +++ b/source/gameengine/BlenderRoutines/CMakeLists.txt @@ -1,33 +1,33 @@ set(INC . - ../../../intern/string + ../Converter + ../Expressions + ../GameLogic + ../Ketsji + ../Network + ../Network/LoopBackNetwork + ../Physics/Bullet + ../Physics/common + ../Rasterizer + ../Rasterizer/RAS_OpenGLRasterizer + ../SceneGraph + ../../blender + ../../blender/blenfont + ../../blender/blenkernel + ../../blender/blenlib + ../../blender/blenloader + ../../blender/editors/include + ../../blender/gpu + ../../blender/imbuf + ../../blender/makesdna + ../../blender/makesrna + ../../blender/windowmanager + ../../../extern/bullet2/src ../../../intern/container ../../../intern/guardedalloc - ../../../source/gameengine/Rasterizer/RAS_OpenGLRasterizer - ../../../source/gameengine/Converter - ../../../source/blender/imbuf ../../../intern/moto/include - ../../../source/gameengine/Ketsji - ../../../source/blender/blenlib - ../../../source/blender/blenkernel - ../../../source/blender/blenfont - ../../../source/blender/editors/include - ../../../source/blender/windowmanager - ../../../source/blender - ../../../source/blender/makesdna - ../../../source/blender/makesrna - ../../../source/gameengine/Rasterizer - ../../../source/gameengine/GameLogic - ../../../source/gameengine/Expressions - ../../../source/gameengine/Network - ../../../source/gameengine/SceneGraph - ../../../source/gameengine/Physics/common - ../../../source/gameengine/Physics/Bullet - ../../../source/gameengine/Network/LoopBackNetwork - ../../../source/blender/blenloader - ../../../source/blender/gpu - ../../../extern/bullet2/src + ../../../intern/string ${GLEW_INCLUDE_PATH} ) diff --git a/source/gameengine/Converter/CMakeLists.txt b/source/gameengine/Converter/CMakeLists.txt index c905b8634a0..45a7701d404 100644 --- a/source/gameengine/Converter/CMakeLists.txt +++ b/source/gameengine/Converter/CMakeLists.txt @@ -26,36 +26,35 @@ set(INC . - ../../../intern/string - ../../../intern/guardedalloc + ../BlenderRoutines + ../Expressions + ../GameLogic + ../Ketsji + ../Ketsji/KXNetwork + ../Network + ../Network/LoopBackNetwork + ../Physics/Bullet + ../Physics/Dummy + ../Physics/common + ../Rasterizer + ../Rasterizer/RAS_OpenGLRasterizer + ../Rasterizer/RAS_OpenGLRasterizer + ../SceneGraph + ../../blender + ../../blender/blenkernel + ../../blender/blenlib + ../../blender/blenloader + ../../blender/gpu + ../../blender/ikplugin + ../../blender/imbuf + ../../blender/makesdna + ../../blender/makesrna + ../../blender/windowmanager + ../../../extern/bullet2/src ../../../intern/container - ../../../source/gameengine/Rasterizer/RAS_OpenGLRasterizer - ../../../source/gameengine/Converter - ../../../source/gameengine/BlenderRoutines - ../../../source/blender/imbuf + ../../../intern/guardedalloc ../../../intern/moto/include - ../../../source/gameengine/Ketsji - ../../../source/gameengine/Ketsji/KXNetwork - ../../../source/blender/blenlib - ../../../source/blender/blenkernel - ../../../source/blender/windowmanager - ../../../source/blender - ../../../source/blender/makesdna - ../../../source/blender/makesrna - ../../../source/gameengine/Rasterizer - ../../../source/gameengine/Rasterizer/RAS_OpenGLRasterizer - ../../../source/gameengine/GameLogic - ../../../source/gameengine/Expressions - ../../../source/gameengine/Network - ../../../source/gameengine/SceneGraph - ../../../source/gameengine/Physics/common - ../../../source/gameengine/Physics/Bullet - ../../../source/gameengine/Physics/Dummy - ../../../source/gameengine/Network/LoopBackNetwork - ../../../source/blender/blenloader - ../../../source/blender/gpu - ../../../source/blender/ikplugin - ../../../extern/bullet2/src + ../../../intern/string ) set(INC_SYS diff --git a/source/gameengine/Expressions/CMakeLists.txt b/source/gameengine/Expressions/CMakeLists.txt index 83d44e1b318..ad987091790 100644 --- a/source/gameengine/Expressions/CMakeLists.txt +++ b/source/gameengine/Expressions/CMakeLists.txt @@ -26,11 +26,11 @@ set(INC . - ../../../intern/string + ../SceneGraph + ../../blender/blenloader ../../../intern/guardedalloc ../../../intern/moto/include - ../../../source/gameengine/SceneGraph - ../../../source/blender/blenloader + ../../../intern/string ) set(INC_SYS diff --git a/source/gameengine/Expressions/PyObjectPlus.h b/source/gameengine/Expressions/PyObjectPlus.h index 157124ebc81..587f3e4ef35 100644 --- a/source/gameengine/Expressions/PyObjectPlus.h +++ b/source/gameengine/Expressions/PyObjectPlus.h @@ -54,7 +54,7 @@ #ifdef WITH_PYTHON #ifdef USE_MATHUTILS extern "C" { -#include "../../blender/python/generic/mathutils.h" /* so we can have mathutils callbacks */ +#include "../../blender/python/mathutils/mathutils.h" /* so we can have mathutils callbacks */ } #endif diff --git a/source/gameengine/GameLogic/CMakeLists.txt b/source/gameengine/GameLogic/CMakeLists.txt index b6721650bad..bd417165337 100644 --- a/source/gameengine/GameLogic/CMakeLists.txt +++ b/source/gameengine/GameLogic/CMakeLists.txt @@ -25,13 +25,13 @@ # ***** END GPL LICENSE BLOCK ***** set(INC - . - ../../../intern/string + . + ../Expressions + ../Rasterizer + ../SceneGraph ../../../intern/container - ../../../source/gameengine/Expressions - ../../../source/gameengine/SceneGraph ../../../intern/moto/include - ../../../source/gameengine/Rasterizer + ../../../intern/string ) set(INC_SYS @@ -39,8 +39,6 @@ set(INC_SYS ) set(SRC - Joystick/SCA_Joystick.cpp - Joystick/SCA_JoystickEvents.cpp SCA_2DFilterActuator.cpp SCA_ANDController.cpp SCA_ActuatorEventManager.cpp @@ -81,10 +79,9 @@ set(SRC SCA_TimeEventManager.cpp SCA_XNORController.cpp SCA_XORController.cpp + Joystick/SCA_Joystick.cpp + Joystick/SCA_JoystickEvents.cpp - Joystick/SCA_Joystick.h - Joystick/SCA_JoystickDefines.h - Joystick/SCA_JoystickPrivate.h SCA_2DFilterActuator.h SCA_ANDController.h SCA_ActuatorEventManager.h @@ -125,10 +122,15 @@ set(SRC SCA_TimeEventManager.h SCA_XNORController.h SCA_XORController.h + Joystick/SCA_Joystick.h + Joystick/SCA_JoystickDefines.h + Joystick/SCA_JoystickPrivate.h ) if(WITH_SDL) - list(APPEND INC_SYS ${SDL_INCLUDE_DIR}) + list(APPEND INC_SYS + ${SDL_INCLUDE_DIR} + ) else() add_definitions(-DDISABLE_SDL) endif() diff --git a/source/gameengine/GamePlayer/common/CMakeLists.txt b/source/gameengine/GamePlayer/common/CMakeLists.txt index d16ec6a2f22..8c5897fa48e 100644 --- a/source/gameengine/GamePlayer/common/CMakeLists.txt +++ b/source/gameengine/GamePlayer/common/CMakeLists.txt @@ -26,31 +26,31 @@ set(INC . - ../../../../intern/string + ../ghost + ../../BlenderRoutines + ../../Converter + ../../Expressions + ../../GameLogic + ../../Ketsji + ../../Network + ../../Network/LoopBackNetwork + ../../Physics/common + ../../Rasterizer + ../../Rasterizer/RAS_OpenGLRasterizer + ../../SceneGraph + ../../../blender + ../../../blender/blenfont + ../../../blender/blenkernel + ../../../blender/blenlib + ../../../blender/blenloader + ../../../blender/gpu + ../../../blender/imbuf + ../../../blender/makesdna + ../../../../intern/container ../../../../intern/ghost ../../../../intern/guardedalloc - ../../../../intern/container ../../../../intern/moto/include - ../../../../source/gameengine/Rasterizer/RAS_OpenGLRasterizer - ../../../../source/gameengine/Converter - ../../../../source/gameengine/BlenderRoutines - ../../../../source/blender/imbuf - ../../../../source/gameengine/Ketsji - ../../../../source/blender/blenlib - ../../../../source/blender/blenfont - ../../../../source/blender/blenkernel - ../../../../source/blender - ../../../../source/blender/makesdna - ../../../../source/gameengine/Rasterizer - ../../../../source/gameengine/GameLogic - ../../../../source/gameengine/Expressions - ../../../../source/gameengine/Network - ../../../../source/gameengine/SceneGraph - ../../../../source/gameengine/Physics/common - ../../../../source/gameengine/Network/LoopBackNetwork - ../../../../source/gameengine/GamePlayer/ghost - ../../../../source/blender/blenloader - ../../../../source/blender/gpu + ../../../../intern/string ) set(INC_SYS @@ -61,7 +61,6 @@ set(INC_SYS ) set(SRC - bmfont.cpp GPC_Canvas.cpp GPC_Engine.cpp GPC_KeyboardDevice.cpp @@ -71,6 +70,7 @@ set(SRC GPC_RawLogoArrays.cpp GPC_RenderTools.cpp GPC_System.cpp + bmfont.cpp GPC_Canvas.h GPC_Engine.h diff --git a/source/gameengine/GamePlayer/ghost/CMakeLists.txt b/source/gameengine/GamePlayer/ghost/CMakeLists.txt index 5ac121099c3..944ec9abd67 100644 --- a/source/gameengine/GamePlayer/ghost/CMakeLists.txt +++ b/source/gameengine/GamePlayer/ghost/CMakeLists.txt @@ -26,32 +26,32 @@ set(INC . - ../../../../intern/string + ../common + ../../BlenderRoutines + ../../Converter + ../../Expressions + ../../GameLogic + ../../Ketsji + ../../Network + ../../Network/LoopBackNetwork + ../../Physics/common + ../../Rasterizer + ../../Rasterizer/RAS_OpenGLRasterizer + ../../SceneGraph + ../../../blender + ../../../blender/blenfont + ../../../blender/blenkernel + ../../../blender/blenlib + ../../../blender/blenloader + ../../../blender/gpu + ../../../blender/imbuf + ../../../blender/makesdna + ../../../blender/makesrna + ../../../../intern/container ../../../../intern/ghost ../../../../intern/guardedalloc - ../../../../intern/container ../../../../intern/moto/include - ../../../../source/gameengine/Rasterizer/RAS_OpenGLRasterizer - ../../../../source/gameengine/BlenderRoutines - ../../../../source/gameengine/Converter - ../../../../source/blender/imbuf - ../../../../source/gameengine/Ketsji - ../../../../source/blender/blenfont - ../../../../source/blender/blenlib - ../../../../source/blender/blenkernel - ../../../../source/blender - ../../../../source/blender/makesdna - ../../../../source/blender/makesrna - ../../../../source/gameengine/Rasterizer - ../../../../source/gameengine/GameLogic - ../../../../source/gameengine/Expressions - ../../../../source/gameengine/Network - ../../../../source/gameengine/SceneGraph - ../../../../source/gameengine/Physics/common - ../../../../source/gameengine/Network/LoopBackNetwork - ../../../../source/gameengine/GamePlayer/common - ../../../../source/blender/blenloader - ../../../../source/blender/gpu + ../../../../intern/string ) set(INC_SYS @@ -62,9 +62,9 @@ set(INC_SYS set(SRC GPG_Application.cpp GPG_Canvas.cpp - GPG_ghost.cpp GPG_KeyboardDevice.cpp GPG_System.cpp + GPG_ghost.cpp GPG_Application.h GPG_Canvas.h diff --git a/source/gameengine/Ketsji/CMakeLists.txt b/source/gameengine/Ketsji/CMakeLists.txt index b5a63f44729..8222bf4b65f 100644 --- a/source/gameengine/Ketsji/CMakeLists.txt +++ b/source/gameengine/Ketsji/CMakeLists.txt @@ -26,32 +26,32 @@ set(INC . - ../../../intern/string - ../../../intern/guardedalloc + KXNetwork + ../BlenderRoutines + ../Converter + ../Expressions + ../GameLogic + ../Network + ../Network/LoopBackNetwork + ../Physics/common + ../Rasterizer + ../Rasterizer/RAS_OpenGLRasterizer + ../SceneGraph + ../../blender + ../../blender/blenfont + ../../blender/blenkernel + ../../blender/blenlib + ../../blender/blenloader + ../../blender/gpu + ../../blender/imbuf + ../../blender/makesdna + ../../blender/python + ../../blender/python/generic + ../../blender/python/mathutils ../../../intern/container - ../../../source/gameengine/Rasterizer/RAS_OpenGLRasterizer - ../../../source/gameengine/Converter - ../../../source/gameengine/BlenderRoutines - ../../../source/blender/imbuf + ../../../intern/guardedalloc ../../../intern/moto/include - ../../../source/gameengine/Ketsji - ../../../source/blender/blenlib - ../../../source/blender/blenfont - ../../../source/blender/blenkernel - ../../../source/blender/python - ../../../source/blender/python/generic - ../../../source/blender - ../../../source/blender/makesdna - ../../../source/gameengine/Rasterizer - ../../../source/gameengine/GameLogic - ../../../source/gameengine/Expressions - ../../../source/gameengine/Ketsji/KXNetwork - ../../../source/gameengine/Network - ../../../source/gameengine/SceneGraph - ../../../source/gameengine/Physics/common - ../../../source/gameengine/Network/LoopBackNetwork - ../../../source/blender/blenloader - ../../../source/blender/gpu + ../../../intern/string ) set(INC_SYS @@ -128,6 +128,10 @@ set(SRC KX_WorldInfo.cpp KX_WorldIpoController.cpp + BL_BlenderShader.h + BL_Material.h + BL_Shader.h + BL_Texture.h KX_ArmatureSensor.h KX_BlenderMaterial.h KX_BulletPhysicsController.h @@ -200,16 +204,14 @@ set(SRC KX_VisibilityActuator.h KX_WorldInfo.h KX_WorldIpoController.h - BL_BlenderShader.h - BL_Material.h - BL_Shader.h - BL_Texture.h ) add_definitions(-DGLEW_STATIC) if(WITH_SDL) - list(APPEND INC_SYS ${SDL_INCLUDE_DIR}) + list(APPEND INC_SYS + ${SDL_INCLUDE_DIR} + ) else() add_definitions(-DDISABLE_SDL) endif() @@ -228,7 +230,7 @@ endif() if(WITH_BULLET) list(APPEND INC ../../../extern/bullet2/src - ../../../source/gameengine/Physics/Bullet + ../Physics/Bullet ) add_definitions(-DUSE_BULLET) endif() diff --git a/source/gameengine/Ketsji/KXNetwork/CMakeLists.txt b/source/gameengine/Ketsji/KXNetwork/CMakeLists.txt index b8149566801..1ebf1153150 100644 --- a/source/gameengine/Ketsji/KXNetwork/CMakeLists.txt +++ b/source/gameengine/Ketsji/KXNetwork/CMakeLists.txt @@ -26,14 +26,14 @@ set(INC . - ../../../../intern/string + .. + ../../Expressions + ../../GameLogic + ../../Network + ../../SceneGraph ../../../../intern/container ../../../../intern/moto/include - ../../../../source/gameengine/Ketsji - ../../../../source/gameengine/GameLogic - ../../../../source/gameengine/Expressions - ../../../../source/gameengine/SceneGraph - ../../../../source/gameengine/Network + ../../../../intern/string ) set(INC_SYS diff --git a/source/gameengine/Ketsji/KX_PyMath.h b/source/gameengine/Ketsji/KX_PyMath.h index 9b198f85664..4864482c33b 100644 --- a/source/gameengine/Ketsji/KX_PyMath.h +++ b/source/gameengine/Ketsji/KX_PyMath.h @@ -49,7 +49,7 @@ #ifdef WITH_PYTHON #ifdef USE_MATHUTILS extern "C" { -#include "../../blender/python/generic/mathutils.h" /* so we can have mathutils callbacks */ +#include "../../blender/python/mathutils/mathutils.h" /* so we can have mathutils callbacks */ } #endif diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp index a927de60cd8..f643030e3a2 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.cpp +++ b/source/gameengine/Ketsji/KX_PythonInit.cpp @@ -54,7 +54,7 @@ extern "C" { #include "bpy_internal_import.h" /* from the blender python api, but we want to import text too! */ #include "py_capi_utils.h" - #include "mathutils.h" // Blender.Mathutils module copied here so the blenderlayer can use. + #include "mathutils.h" // 'mathutils' module copied here so the blenderlayer can use. #include "bgl.h" #include "blf_py_api.h" @@ -1749,7 +1749,7 @@ static void restorePySysObjects(void) // Copied from bpy_interface.c static struct _inittab bge_internal_modules[]= { - {(char *)"mathutils", BPyInit_mathutils}, + {(char *)"mathutils", PyInit_mathutils}, {(char *)"bgl", BPyInit_bgl}, {(char *)"blf", BPyInit_blf}, {(char *)"aud", AUD_initPython}, diff --git a/source/gameengine/Ketsji/SConscript b/source/gameengine/Ketsji/SConscript index 08642262724..62caa602c23 100644 --- a/source/gameengine/Ketsji/SConscript +++ b/source/gameengine/Ketsji/SConscript @@ -6,7 +6,8 @@ Import ('env') sources = env.Glob('*.cpp') defs = [ 'GLEW_STATIC' ] -incs = '. #source/blender/python/generic' # Only for Mathutils! and bpy_internal_import.h, be very careful +incs = '. #source/blender/python/generic' # Only for bpy_internal_import.h, be very careful +incs += ' #source/blender/python/mathutils' # Only for mathutils, be very careful incs += ' #intern/string #intern/guardedalloc #intern/container' incs += ' #source/gameengine/Rasterizer/RAS_OpenGLRasterizer' diff --git a/source/gameengine/Network/CMakeLists.txt b/source/gameengine/Network/CMakeLists.txt index e1f3bfaac77..4d6d035c63d 100644 --- a/source/gameengine/Network/CMakeLists.txt +++ b/source/gameengine/Network/CMakeLists.txt @@ -26,9 +26,9 @@ set(INC . - ../../../intern/string ../../../intern/container ../../../intern/moto/include + ../../../intern/string ) set(INC_SYS diff --git a/source/gameengine/Network/LoopBackNetwork/CMakeLists.txt b/source/gameengine/Network/LoopBackNetwork/CMakeLists.txt index 9c3936987f2..c816a30f1a8 100644 --- a/source/gameengine/Network/LoopBackNetwork/CMakeLists.txt +++ b/source/gameengine/Network/LoopBackNetwork/CMakeLists.txt @@ -26,9 +26,9 @@ set(INC . - ../../../../intern/string + .. ../../../../intern/container - ../../../../source/gameengine/Network + ../../../../intern/string ) set(INC_SYS diff --git a/source/gameengine/Physics/Bullet/CMakeLists.txt b/source/gameengine/Physics/Bullet/CMakeLists.txt index aadd11cc036..971c8f979f3 100644 --- a/source/gameengine/Physics/Bullet/CMakeLists.txt +++ b/source/gameengine/Physics/Bullet/CMakeLists.txt @@ -30,19 +30,19 @@ remove_strict_flags() set(INC . ../common - ../../../../extern/bullet2/src - ../../../../intern/moto/include - ../../../../intern/guardedalloc - ../../../../intern/container - ../../../../intern/string - ../../Rasterizer - ../../Ketsji ../../Expressions ../../GameLogic + ../../Ketsji + ../../Rasterizer ../../SceneGraph - ../../../../source/blender/makesdna - ../../../../source/blender/blenlib - ../../../../source/blender/blenkernel + ../../../blender/blenkernel + ../../../blender/blenlib + ../../../blender/makesdna + ../../../../extern/bullet2/src + ../../../../intern/container + ../../../../intern/guardedalloc + ../../../../intern/moto/include + ../../../../intern/string ) set(INC_SYS diff --git a/source/gameengine/Rasterizer/CMakeLists.txt b/source/gameengine/Rasterizer/CMakeLists.txt index b705d3151b2..23d746f88bc 100644 --- a/source/gameengine/Rasterizer/CMakeLists.txt +++ b/source/gameengine/Rasterizer/CMakeLists.txt @@ -26,14 +26,14 @@ set(INC . - ../../../source/blender/makesdna - ../../../source/gameengine/SceneGraph - ../../../source/gameengine/Ketsji - ../../../intern/string + ../Expressions + ../Ketsji + ../SceneGraph + ../../blender/makesdna ../../../intern/container - ../../../intern/moto/include ../../../intern/guardedalloc - ../Expressions + ../../../intern/moto/include + ../../../intern/string ) set(INC_SYS diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt index a005bb1108d..b0ef6fab251 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt @@ -25,18 +25,18 @@ # ***** END GPL LICENSE BLOCK ***** set(INC - ../../../../intern/string + .. + ../../BlenderRoutines + ../../Ketsji + ../../SceneGraph + ../../../blender/blenkernel + ../../../blender/blenlib + ../../../blender/blenloader + ../../../blender/gpu + ../../../blender/makesdna ../../../../intern/container ../../../../intern/moto/include - ../../../../source/gameengine/Rasterizer - ../../../../source/gameengine/Ketsji - ../../../../source/gameengine/SceneGraph - ../../../../source/gameengine/BlenderRoutines - ../../../../source/blender/gpu - ../../../../source/blender/makesdna - ../../../../source/blender/blenkernel - ../../../../source/blender/blenlib - ../../../../source/blender/blenloader + ../../../../intern/string ) set(INC_SYS diff --git a/source/gameengine/VideoTexture/CMakeLists.txt b/source/gameengine/VideoTexture/CMakeLists.txt index c412363dc3b..04683a5f99b 100644 --- a/source/gameengine/VideoTexture/CMakeLists.txt +++ b/source/gameengine/VideoTexture/CMakeLists.txt @@ -26,26 +26,26 @@ set(INC . - ../../../source/gameengine/Ketsji - ../../../source/gameengine/Expressions - ../../../source/gameengine/GameLogic - ../../../source/gameengine/SceneGraph - ../../../source/gameengine/Rasterizer - ../../../source/gameengine/Rasterizer/RAS_OpenGLRasterizer - ../../../source/gameengine/BlenderRoutines - ../../../source/blender/blenlib - ../../../source/blender/blenkernel - ../../../source/blender/makesdna - ../../../source/blender/editors/include - ../../../source/blender/imbuf - ../../../source/blender/python - ../../../source/blender/python/generic - ../../../source/blender/gpu + ../BlenderRoutines + ../Expressions + ../GameLogic + ../Ketsji + ../Rasterizer + ../Rasterizer/RAS_OpenGLRasterizer + ../SceneGraph + ../../blender/blenkernel + ../../blender/blenlib + ../../blender/editors/include + ../../blender/gpu + ../../blender/imbuf + ../../blender/makesdna + ../../blender/python + ../../blender/python/generic ../../../intern/container - ../../../intern/string - ../../../intern/moto/include - ../../../intern/guardedalloc ../../../intern/ffmpeg + ../../../intern/guardedalloc + ../../../intern/moto/include + ../../../intern/string ) set(INC_SYS |