forked from bartvdbraak/blender
Merging r37732 through r37862 from trunk into soc-2011-tomato
This commit is contained in:
commit
70eb9e85c5
@ -57,6 +57,9 @@ endif()
|
||||
# this starts out unset
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/build_files/cmake/Modules")
|
||||
|
||||
# avoid having empty buildtype
|
||||
set(CMAKE_BUILD_TYPE_INIT "Release")
|
||||
|
||||
# quiet output for Makefiles, 'make -s' helps too
|
||||
# set_property(GLOBAL PROPERTY RULE_MESSAGES OFF)
|
||||
|
||||
@ -104,6 +107,9 @@ option(WITH_BULLET "Enable Bullet (Physics Engine)" ON)
|
||||
option(WITH_GAMEENGINE "Enable Game Engine" ON)
|
||||
option(WITH_PLAYER "Build Player" OFF)
|
||||
|
||||
option(WITH_AUDASPACE "Build with blenders audio library" ON)
|
||||
mark_as_advanced(WITH_AUDASPACE)
|
||||
|
||||
option(WITH_HEADLESS "Build without graphical support (renderfarm, server mode only)" OFF)
|
||||
mark_as_advanced(WITH_HEADLESS)
|
||||
|
||||
@ -203,8 +209,8 @@ if(NOT WITH_GAMEENGINE AND WITH_PLAYER)
|
||||
message(FATAL_ERROR "WITH_PLAYER requires WITH_GAMEENGINE")
|
||||
endif()
|
||||
|
||||
if(NOT WITH_SAMPLERATE AND (WITH_OPENAL OR WITH_SDL OR WITH_JACK))
|
||||
message(FATAL_ERROR "WITH_OPENAL/WITH_SDL/WITH_JACK require WITH_SAMPLERATE")
|
||||
if(NOT WITH_AUDASPACE AND (WITH_OPENAL OR WITH_SDL OR WITH_JACK))
|
||||
message(FATAL_ERROR "WITH_OPENAL/WITH_SDL/WITH_JACK/WITH_CODEC_FFMPEG require WITH_AUDASPACE")
|
||||
endif()
|
||||
|
||||
if(NOT WITH_IMAGE_OPENJPEG AND WITH_IMAGE_REDCODE)
|
||||
@ -544,13 +550,13 @@ elseif(WIN32)
|
||||
|
||||
if(MSVC)
|
||||
if(CMAKE_CL_64)
|
||||
set(LLIBS ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32 advapi32 shfolder shell32 ole32 oleaut32 uuid )
|
||||
set(LLIBS ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32 advapi32 shfolder shell32 ole32 oleaut32 uuid)
|
||||
else()
|
||||
set(LLIBS kernel32 user32 gdi32 comdlg32 advapi32 shell32 ole32 oleaut32 uuid ws2_32 vfw32 winmm)
|
||||
set(LLIBS ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32 advapi32 shfolder shell32 ole32 oleaut32 uuid)
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_FLAGS "/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /we4013 /wd4018 /wd4800 /wd4244 /wd4305 /wd4065 /wd4267" CACHE STRING "MSVC MT C++ flags " FORCE)
|
||||
set(CMAKE_C_FLAGS "/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /we4013 /wd4018 /wd4800 /wd4244 /wd4305 /wd4065 /wd4267" CACHE STRING "MSVC MT C++ flags " FORCE)
|
||||
set(CMAKE_CXX_FLAGS "/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_CONSOLE /D_LIB /nologo /Ob1 /J /W0 /Gd /wd4018 /wd4244 /wd4305 /wd4800 /wd4065 /wd4267 /we4013" CACHE STRING "MSVC MT C++ flags " FORCE)
|
||||
set(CMAKE_C_FLAGS "/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_CONSOLE /D_LIB /nologo /Ob1 /J /W0 /Gd /wd4018 /wd4244 /wd4305 /wd4800 /wd4065 /wd4267 /we4013 /EHsc" CACHE STRING "MSVC MT C++ flags " FORCE)
|
||||
|
||||
if(CMAKE_CL_64)
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG /Od /Gm /EHsc /RTC1 /MTd /W3 /nologo /Zi /J" CACHE STRING "MSVC MT flags " FORCE)
|
||||
@ -695,9 +701,9 @@ elseif(WIN32)
|
||||
|
||||
# MSVC only, Mingw doesnt need
|
||||
if(CMAKE_CL_64)
|
||||
set(PLATFORM_LINKFLAGS "/MACHINE:X64 /NODEFAULTLIB:libc.lib /STACK:2097152 ")
|
||||
set(PLATFORM_LINKFLAGS "/SUBSYSTEM:CONSOLE /MACHINE:X64 /STACK:2097152 /OPT:NOREF /INCREMENTAL:NO /NODEFAULTLIB:\"msvcrt.lib\" /NODEFAULTLIB:\"msvcmrt.lib\" /NODEFAULTLIB:\"msvcurt.lib\" /NODEFAULTLIB:\"msvcrtd.lib\" ")
|
||||
else()
|
||||
set(PLATFORM_LINKFLAGS "/NODEFAULTLIB:libc.lib /STACK:2097152 ")
|
||||
set(PLATFORM_LINKFLAGS "/SUBSYSTEM:CONSOLE /MACHINE:IX86 /STACK:2097152 /INCREMENTAL:NO /LARGEADDRESSAWARE /NODEFAULTLIB:\"msvcrt.lib\" /NODEFAULTLIB:\"msvcmrt.lib\" /NODEFAULTLIB:\"msvcurt.lib\" /NODEFAULTLIB:\"msvcrtd.lib\" ")
|
||||
endif()
|
||||
|
||||
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:libcmt.lib;libc.lib ")
|
||||
@ -796,7 +802,7 @@ elseif(WIN32)
|
||||
set(PYTHON_VERSION 3.2)
|
||||
set(PYTHON_INCLUDE_DIRS "${PYTHON}/include/python${PYTHON_VERSION}")
|
||||
# set(PYTHON_BINARY python) # not used yet
|
||||
set(PYTHON_LIBRARIES python32mw)
|
||||
set(PYTHON_LIBRARIES ${PYTHON}/lib/python32mw.lib)
|
||||
set(PYTHON_LIBPATH ${PYTHON}/lib)
|
||||
endif()
|
||||
|
||||
@ -996,7 +1002,7 @@ endif()
|
||||
# Common.
|
||||
|
||||
if(APPLE OR WIN32)
|
||||
if(NOT IS_DIRECTORY "${LIBDIR}")
|
||||
if(NOT EXISTS "${LIBDIR}/")
|
||||
message(FATAL_ERROR "Apple and Windows require pre-compiled libs at: '${LIBDIR}'")
|
||||
endif()
|
||||
endif()
|
||||
|
@ -75,7 +75,8 @@ all:
|
||||
@echo Building Blender ...
|
||||
make -C $(BUILD_DIR) -s -j $(NPROCS) install
|
||||
@echo
|
||||
@echo run blender from "$(BUILD_DIR)/bin/blender"
|
||||
@echo edit build configuration with: "$(BUILD_DIR)/CMakeCache.txt" run make again to rebuild.
|
||||
@echo blender installed, run from: "$(BUILD_DIR)/bin/blender"
|
||||
@echo
|
||||
|
||||
debug: all
|
||||
|
@ -306,6 +306,11 @@ if env['BF_NO_ELBEEM'] == 1:
|
||||
env['CXXFLAGS'].append('-DDISABLE_ELBEEM')
|
||||
env['CCFLAGS'].append('-DDISABLE_ELBEEM')
|
||||
|
||||
# TODO, make optional
|
||||
env['CPPFLAGS'].append('-DWITH_AUDASPACE')
|
||||
env['CXXFLAGS'].append('-DWITH_AUDASPACE')
|
||||
env['CCFLAGS'].append('-DWITH_AUDASPACE')
|
||||
|
||||
# lastly we check for root_build_dir ( we should not do before, otherwise we might do wrong builddir
|
||||
B.root_build_dir = env['BF_BUILDDIR']
|
||||
B.doc_build_dir = os.path.join(env['BF_INSTALLDIR'], 'doc')
|
||||
|
@ -39,6 +39,21 @@ macro(file_list_suffix
|
||||
|
||||
endmacro()
|
||||
|
||||
|
||||
macro(target_link_libraries_optimized TARGET LIBS)
|
||||
foreach(_LIB ${LIBS})
|
||||
target_link_libraries(${TARGET} optimized "${_LIB}")
|
||||
endforeach()
|
||||
unset(_LIB)
|
||||
endmacro()
|
||||
|
||||
macro(target_link_libraries_debug TARGET LIBS)
|
||||
foreach(_LIB ${LIBS})
|
||||
target_link_libraries(${TARGET} debug "${_LIB}")
|
||||
endforeach()
|
||||
unset(_LIB)
|
||||
endmacro()
|
||||
|
||||
# Nicer makefiles with -I/1/foo/ instead of -I/1/2/3/../../foo/
|
||||
# use it instead of include_directories()
|
||||
macro(blender_include_dirs
|
||||
@ -202,9 +217,8 @@ macro(setup_liblinks
|
||||
|
||||
if(WIN32 AND NOT UNIX)
|
||||
file_list_suffix(PYTHON_LIBRARIES_DEBUG "${PYTHON_LIBRARIES}" "_d")
|
||||
target_link_libraries(${target}
|
||||
debug ${PYTHON_LIBRARIES_DEBUG}
|
||||
optimized ${PYTHON_LIBRARIES})
|
||||
target_link_libraries_debug(${target} "${PYTHON_LIBRARIES_DEBUG}")
|
||||
target_link_libraries_optimized(${target} "${PYTHON_LIBRARIES}")
|
||||
unset(PYTHON_LIBRARIES_DEBUG)
|
||||
else()
|
||||
target_link_libraries(${target} ${PYTHON_LIBRARIES})
|
||||
@ -257,9 +271,8 @@ macro(setup_liblinks
|
||||
if(WITH_IMAGE_OPENEXR)
|
||||
if(WIN32 AND NOT UNIX)
|
||||
file_list_suffix(OPENEXR_LIBRARIES_DEBUG "${OPENEXR_LIBRARIES}" "_d")
|
||||
target_link_libraries(${target}
|
||||
debug ${OPENEXR_LIBRARIES_DEBUG}
|
||||
optimized ${OPENEXR_LIBRARIES})
|
||||
target_link_libraries_debug(${target} "${OPENEXR_LIBRARIES_DEBUG}")
|
||||
target_link_libraries_optimized(${target} "${OPENEXR_LIBRARIES}")
|
||||
unset(OPENEXR_LIBRARIES_DEBUG)
|
||||
else()
|
||||
target_link_libraries(${target} ${OPENEXR_LIBRARIES})
|
||||
@ -274,22 +287,19 @@ macro(setup_liblinks
|
||||
if(WITH_OPENCOLLADA)
|
||||
if(WIN32 AND NOT UNIX)
|
||||
file_list_suffix(OPENCOLLADA_LIBRARIES_DEBUG "${OPENCOLLADA_LIBRARIES}" "_d")
|
||||
target_link_libraries(${target}
|
||||
debug ${OPENCOLLADA_LIBRARIES_DEBUG}
|
||||
optimized ${OPENCOLLADA_LIBRARIES})
|
||||
target_link_libraries_debug(${target} "${OPENCOLLADA_LIBRARIES_DEBUG}")
|
||||
target_link_libraries_optimized(${target} "${OPENCOLLADA_LIBRARIES}")
|
||||
unset(OPENCOLLADA_LIBRARIES_DEBUG)
|
||||
|
||||
file_list_suffix(PCRE_LIB_DEBUG "${PCRE_LIB}" "_d")
|
||||
target_link_libraries(${target}
|
||||
debug ${PCRE_LIB_DEBUG}
|
||||
optimized ${PCRE_LIB})
|
||||
target_link_libraries_debug(${target} "${PCRE_LIB_DEBUG}")
|
||||
target_link_libraries_optimized(${target} "${PCRE_LIB}")
|
||||
unset(PCRE_LIB_DEBUG)
|
||||
|
||||
if(EXPAT_LIB)
|
||||
file_list_suffix(EXPAT_LIB_DEBUG "${EXPAT_LIB}" "_d")
|
||||
target_link_libraries(${target}
|
||||
debug ${EXPAT_LIB_DEBUG}
|
||||
optimized ${EXPAT_LIB})
|
||||
target_link_libraries_debug(${target} "${EXPAT_LIB_DEBUG}")
|
||||
target_link_libraries_optimized(${target} "${EXPAT_LIB}")
|
||||
unset(EXPAT_LIB_DEBUG)
|
||||
endif()
|
||||
else()
|
||||
|
@ -76,11 +76,6 @@ BF_GETTEXT_INC = '${BF_GETTEXT}/include'
|
||||
BF_GETTEXT_LIB = 'gettextpo intl'
|
||||
BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
|
||||
|
||||
WITH_BF_FTGL = 'false'
|
||||
BF_FTGL = '#extern/bFTGL'
|
||||
BF_FTGL_INC = '${BF_FTGL}/include'
|
||||
BF_FTGL_LIB = 'extern_ftgl'
|
||||
|
||||
WITH_BF_GAMEENGINE='false'
|
||||
|
||||
WITH_BF_BULLET = 'true'
|
||||
|
@ -170,7 +170,7 @@ BGE_CXXFLAGS = ['/O2', '/EHsc', '/GR', '/fp:fast', '/arch:SSE']
|
||||
|
||||
BF_DEBUG_CCFLAGS = ['/Zi', '/FR${TARGET}.sbr']
|
||||
|
||||
CPPFLAGS = ['-DWIN32','-D_CONSOLE', '-D_LIB', '-DFTGL_LIBRARY_STATIC', '-D_CRT_SECURE_NO_DEPRECATE']
|
||||
CPPFLAGS = ['-DWIN32','-D_CONSOLE', '-D_LIB', '-D_CRT_SECURE_NO_DEPRECATE']
|
||||
REL_CFLAGS = ['-O2', '-DNDEBUG']
|
||||
REL_CCFLAGS = ['-O2', '-DNDEBUG']
|
||||
REL_CXXFLAGS = ['-O2', '-DNDEBUG']
|
||||
|
@ -172,7 +172,7 @@ BGE_CXXFLAGS = ['/O2', '/EHsc', '/GR', '/fp:fast']
|
||||
|
||||
BF_DEBUG_CCFLAGS = ['/Zi', '/FR${TARGET}.sbr', '/Od']
|
||||
|
||||
CPPFLAGS = ['-DWIN32', '-D_CONSOLE', '-D_LIB', '-DFTGL_LIBRARY_STATIC', '-D_CRT_SECURE_NO_DEPRECATE']
|
||||
CPPFLAGS = ['-DWIN32', '-D_CONSOLE', '-D_LIB', '-D_CRT_SECURE_NO_DEPRECATE']
|
||||
REL_CFLAGS = ['-O2', '-DNDEBUG']
|
||||
REL_CCFLAGS = ['-O2', '-DNDEBUG']
|
||||
REL_CXXFLAGS = ['-O2', '-DNDEBUG']
|
||||
|
21
doc/python_api/examples/aud.py
Normal file
21
doc/python_api/examples/aud.py
Normal file
@ -0,0 +1,21 @@
|
||||
"""
|
||||
Basic Sound Playback
|
||||
++++++++++++++++++++
|
||||
This script shows how to use the classes: :class:`Device`, :class:`Factory` and
|
||||
:class:`Handle`.
|
||||
"""
|
||||
import aud
|
||||
|
||||
device = aud.device()
|
||||
# load sound file (it can be a video file with audio)
|
||||
factory = aud.Factory('music.ogg')
|
||||
|
||||
# play the audio, this return a handle to control play/pause
|
||||
handle = device.play(sound)
|
||||
# if the audio is not too big and will be used often you can buffer it
|
||||
factory_buffered = aud.Factory.buffer(sound)
|
||||
handle_buffered = device.play(buffered)
|
||||
|
||||
# stop the sounds (otherwise they play until their ends)
|
||||
handle.stop()
|
||||
handle_buffered.stop()
|
@ -700,6 +700,23 @@ Renamed
|
||||
2.57 to 2.58
|
||||
============
|
||||
|
||||
bpy_extras
|
||||
----------
|
||||
|
||||
Added
|
||||
^^^^^
|
||||
|
||||
* :mod:`bpy_extras`
|
||||
* :mod:`bpy_extras.view3d_utils`
|
||||
|
||||
Moved
|
||||
^^^^^
|
||||
|
||||
* io_utils -> :mod:`bpy_extras.io_utils`
|
||||
* image_utils -> :mod:`bpy_extras.image_utils`
|
||||
* mesh_utils -> :mod:`bpy_extras.mesh_utils`
|
||||
* object_utils -> :mod:`bpy_extras.object_utils`
|
||||
|
||||
bpy.types.RenderSettings
|
||||
------------------------
|
||||
|
||||
|
@ -29,15 +29,15 @@ For HTML generation
|
||||
|
||||
./blender.bin --background --python doc/python_api/sphinx_doc_gen.py
|
||||
|
||||
This will generate python files in doc/python_api/sphinx-in/,
|
||||
assuming that ./blender.bin is or links to the blender executable
|
||||
This will generate python files in doc/python_api/sphinx-in/
|
||||
providing ./blender.bin is or links to the blender executable
|
||||
|
||||
- Generate html docs by running...
|
||||
|
||||
cd doc/python_api
|
||||
sphinx-build sphinx-in sphinx-out
|
||||
|
||||
assuming that you have sphinx 1.0.7 installed
|
||||
This requires sphinx 1.0.7 to be installed.
|
||||
|
||||
For PDF generation
|
||||
------------------
|
||||
@ -48,6 +48,15 @@ For PDF generation
|
||||
make
|
||||
'''
|
||||
|
||||
# Check we're running in blender
|
||||
if __import__("sys").modules.get("bpy") is None:
|
||||
print("\nError, this script must run from inside blender2.5")
|
||||
print(script_help_msg)
|
||||
|
||||
import sys
|
||||
sys.exit()
|
||||
|
||||
|
||||
# Switch for quick testing
|
||||
if 1:
|
||||
# full build
|
||||
@ -1196,72 +1205,67 @@ def rna2sphinx(BASEPATH):
|
||||
|
||||
|
||||
def main():
|
||||
import bpy
|
||||
if 'bpy' not in dir():
|
||||
print("\nError, this script must run from inside blender2.5")
|
||||
print(script_help_msg)
|
||||
import shutil
|
||||
|
||||
script_dir = os.path.dirname(__file__)
|
||||
path_in = os.path.join(script_dir, "sphinx-in")
|
||||
path_out = os.path.join(script_dir, "sphinx-out")
|
||||
path_examples = os.path.join(script_dir, "examples")
|
||||
# only for partial updates
|
||||
path_in_tmp = path_in + "-tmp"
|
||||
|
||||
if not os.path.exists(path_in):
|
||||
os.mkdir(path_in)
|
||||
|
||||
for f in os.listdir(path_examples):
|
||||
if f.endswith(".py"):
|
||||
EXAMPLE_SET.add(os.path.splitext(f)[0])
|
||||
|
||||
# only for full updates
|
||||
if _BPY_FULL_REBUILD:
|
||||
shutil.rmtree(path_in, True)
|
||||
shutil.rmtree(path_out, True)
|
||||
else:
|
||||
import shutil
|
||||
# write here, then move
|
||||
shutil.rmtree(path_in_tmp, True)
|
||||
|
||||
script_dir = os.path.dirname(__file__)
|
||||
path_in = os.path.join(script_dir, "sphinx-in")
|
||||
path_out = os.path.join(script_dir, "sphinx-out")
|
||||
path_examples = os.path.join(script_dir, "examples")
|
||||
# only for partial updates
|
||||
path_in_tmp = path_in + "-tmp"
|
||||
rna2sphinx(path_in_tmp)
|
||||
|
||||
if not os.path.exists(path_in):
|
||||
os.mkdir(path_in)
|
||||
if not _BPY_FULL_REBUILD:
|
||||
import filecmp
|
||||
|
||||
for f in os.listdir(path_examples):
|
||||
if f.endswith(".py"):
|
||||
EXAMPLE_SET.add(os.path.splitext(f)[0])
|
||||
# now move changed files from 'path_in_tmp' --> 'path_in'
|
||||
file_list_path_in = set(os.listdir(path_in))
|
||||
file_list_path_in_tmp = set(os.listdir(path_in_tmp))
|
||||
|
||||
# only for full updates
|
||||
if _BPY_FULL_REBUILD:
|
||||
shutil.rmtree(path_in, True)
|
||||
shutil.rmtree(path_out, True)
|
||||
else:
|
||||
# write here, then move
|
||||
shutil.rmtree(path_in_tmp, True)
|
||||
# remove deprecated files that have been removed.
|
||||
for f in sorted(file_list_path_in):
|
||||
if f not in file_list_path_in_tmp:
|
||||
print("\tdeprecated: %s" % f)
|
||||
os.remove(os.path.join(path_in, f))
|
||||
|
||||
rna2sphinx(path_in_tmp)
|
||||
# freshen with new files.
|
||||
for f in sorted(file_list_path_in_tmp):
|
||||
f_from = os.path.join(path_in_tmp, f)
|
||||
f_to = os.path.join(path_in, f)
|
||||
|
||||
if not _BPY_FULL_REBUILD:
|
||||
import filecmp
|
||||
do_copy = True
|
||||
if f in file_list_path_in:
|
||||
if filecmp.cmp(f_from, f_to):
|
||||
do_copy = False
|
||||
|
||||
# now move changed files from 'path_in_tmp' --> 'path_in'
|
||||
file_list_path_in = set(os.listdir(path_in))
|
||||
file_list_path_in_tmp = set(os.listdir(path_in_tmp))
|
||||
if do_copy:
|
||||
print("\tupdating: %s" % f)
|
||||
shutil.copy(f_from, f_to)
|
||||
'''else:
|
||||
print("\tkeeping: %s" % f) # eh, not that useful'''
|
||||
|
||||
# remove deprecated files that have been removed.
|
||||
for f in sorted(file_list_path_in):
|
||||
if f not in file_list_path_in_tmp:
|
||||
print("\tdeprecated: %s" % f)
|
||||
os.remove(os.path.join(path_in, f))
|
||||
|
||||
# freshen with new files.
|
||||
for f in sorted(file_list_path_in_tmp):
|
||||
f_from = os.path.join(path_in_tmp, f)
|
||||
f_to = os.path.join(path_in, f)
|
||||
|
||||
do_copy = True
|
||||
if f in file_list_path_in:
|
||||
if filecmp.cmp(f_from, f_to):
|
||||
do_copy = False
|
||||
|
||||
if do_copy:
|
||||
print("\tupdating: %s" % f)
|
||||
shutil.copy(f_from, f_to)
|
||||
'''else:
|
||||
print("\tkeeping: %s" % f) # eh, not that useful'''
|
||||
|
||||
EXAMPLE_SET_UNUSED = EXAMPLE_SET - EXAMPLE_SET_USED
|
||||
if EXAMPLE_SET_UNUSED:
|
||||
print("\nUnused examples found in '%s'..." % path_examples)
|
||||
for f in EXAMPLE_SET_UNUSED:
|
||||
print(" %s.py" % f)
|
||||
print(" %d total\n" % len(EXAMPLE_SET_UNUSED))
|
||||
EXAMPLE_SET_UNUSED = EXAMPLE_SET - EXAMPLE_SET_USED
|
||||
if EXAMPLE_SET_UNUSED:
|
||||
print("\nUnused examples found in '%s'..." % path_examples)
|
||||
for f in EXAMPLE_SET_UNUSED:
|
||||
print(" %s.py" % f)
|
||||
print(" %d total\n" % len(EXAMPLE_SET_UNUSED))
|
||||
|
||||
import sys
|
||||
sys.exit()
|
||||
|
@ -24,7 +24,6 @@
|
||||
#
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
|
||||
add_subdirectory(audaspace)
|
||||
add_subdirectory(string)
|
||||
add_subdirectory(ghost)
|
||||
add_subdirectory(guardedalloc)
|
||||
@ -35,6 +34,10 @@ add_subdirectory(opennl)
|
||||
add_subdirectory(smoke)
|
||||
add_subdirectory(mikktspace)
|
||||
|
||||
if(WITH_AUDASPACE)
|
||||
add_subdirectory(audaspace)
|
||||
endif()
|
||||
|
||||
if(WITH_MOD_FLUID)
|
||||
add_subdirectory(elbeem)
|
||||
endif()
|
||||
|
@ -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))
|
||||
#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))
|
||||
#define FFMPEG_HAVE_DEFAULT_VAL_UNION 1
|
||||
#endif
|
||||
|
||||
|
@ -164,5 +164,5 @@ GHOST_TSuccess GHOST_DisplayManagerCocoa::setCurrentDisplaySetting(GHOST_TUns8 d
|
||||
|
||||
//CGDisplayErr err = ::CGDisplaySwitchToMode(m_displayIDs[display], displayModeValues);
|
||||
|
||||
return /*err == CGDisplayNoErr ? GHOST_kSuccess :*/ GHOST_kFailure;
|
||||
return /*err == CGDisplayNoErr ?*/ GHOST_kSuccess /*: GHOST_kFailure*/;
|
||||
}
|
||||
|
@ -119,14 +119,6 @@ public:
|
||||
const GHOST_TEmbedderWindowID parentWindow = 0
|
||||
);
|
||||
|
||||
virtual GHOST_TSuccess beginFullScreen(
|
||||
const GHOST_DisplaySetting& setting,
|
||||
GHOST_IWindow** window,
|
||||
const bool stereoVisual
|
||||
);
|
||||
|
||||
virtual GHOST_TSuccess endFullScreen( void );
|
||||
|
||||
/***************************************************************************************
|
||||
** Event management functionality
|
||||
***************************************************************************************/
|
||||
|
@ -741,11 +741,13 @@ GHOST_IWindow* GHOST_SystemCocoa::createWindow(
|
||||
NSRect contentRect = [NSWindow contentRectForFrameRect:frame
|
||||
styleMask:(NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask)];
|
||||
|
||||
GHOST_TInt32 bottom = (contentRect.size.height - 1) - height - top;
|
||||
|
||||
//Ensures window top left is inside this available rect
|
||||
left = left > contentRect.origin.x ? left : contentRect.origin.x;
|
||||
top = top > contentRect.origin.y ? top : contentRect.origin.y;
|
||||
|
||||
window = new GHOST_WindowCocoa (this, title, left, top, width, height, state, type, stereoVisual, numOfAASamples);
|
||||
bottom = bottom > contentRect.origin.y ? bottom : contentRect.origin.y;
|
||||
|
||||
window = new GHOST_WindowCocoa (this, title, left, bottom, width, height, state, type, stereoVisual, numOfAASamples);
|
||||
|
||||
if (window) {
|
||||
if (window->getValid()) {
|
||||
@ -771,26 +773,6 @@ GHOST_IWindow* GHOST_SystemCocoa::createWindow(
|
||||
return window;
|
||||
}
|
||||
|
||||
GHOST_TSuccess GHOST_SystemCocoa::beginFullScreen(const GHOST_DisplaySetting& setting, GHOST_IWindow** window, const bool stereoVisual)
|
||||
{
|
||||
GHOST_IWindow* currentWindow = m_windowManager->getActiveWindow();
|
||||
*window = currentWindow;
|
||||
|
||||
if(!currentWindow) return GHOST_kFailure;
|
||||
|
||||
return currentWindow->setState(GHOST_kWindowStateFullScreen);
|
||||
}
|
||||
|
||||
GHOST_TSuccess GHOST_SystemCocoa::endFullScreen(void)
|
||||
{
|
||||
GHOST_IWindow* currentWindow = m_windowManager->getActiveWindow();
|
||||
if(!currentWindow) return GHOST_kFailure;
|
||||
|
||||
return currentWindow->setState(GHOST_kWindowStateNormal);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @note : returns coordinates in Cocoa screen coordinates
|
||||
*/
|
||||
@ -809,7 +791,6 @@ GHOST_TSuccess GHOST_SystemCocoa::getCursorPosition(GHOST_TInt32& x, GHOST_TInt3
|
||||
*/
|
||||
GHOST_TSuccess GHOST_SystemCocoa::setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y)
|
||||
{
|
||||
GHOST_TInt32 wx,wy;
|
||||
GHOST_WindowCocoa* window = (GHOST_WindowCocoa*)m_windowManager->getActiveWindow();
|
||||
if (!window) return GHOST_kFailure;
|
||||
|
||||
@ -820,8 +801,7 @@ GHOST_TSuccess GHOST_SystemCocoa::setCursorPosition(GHOST_TInt32 x, GHOST_TInt32
|
||||
CGAssociateMouseAndMouseCursorPosition(true);
|
||||
|
||||
//Force mouse move event (not pushed by Cocoa)
|
||||
window->screenToClient(x, y, wx, wy);
|
||||
pushEvent(new GHOST_EventCursor(getMilliSeconds(), GHOST_kEventCursorMove, window, wx,wy));
|
||||
pushEvent(new GHOST_EventCursor(getMilliSeconds(), GHOST_kEventCursorMove, window, x, y));
|
||||
m_outsideLoopEventProcessed = true;
|
||||
|
||||
return GHOST_kSuccess;
|
||||
@ -1433,9 +1413,9 @@ GHOST_TSuccess GHOST_SystemCocoa::handleTabletEvent(void *eventPtr, short eventT
|
||||
GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
|
||||
{
|
||||
NSEvent *event = (NSEvent *)eventPtr;
|
||||
GHOST_Window* window;
|
||||
GHOST_WindowCocoa* window;
|
||||
|
||||
window = (GHOST_Window*)m_windowManager->getWindowAssociatedWithOSWindow((void*)[event window]);
|
||||
window = (GHOST_WindowCocoa*)m_windowManager->getWindowAssociatedWithOSWindow((void*)[event window]);
|
||||
if (!window) {
|
||||
//printf("\nW failure for event 0x%x",[event type]);
|
||||
return GHOST_kFailure;
|
||||
@ -1499,7 +1479,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
|
||||
switch (window->getCursorGrabMode()) {
|
||||
case GHOST_kGrabHide: //Cursor hidden grab operation : no cursor move
|
||||
{
|
||||
GHOST_TInt32 x_warp, y_warp, x_accum, y_accum;
|
||||
GHOST_TInt32 x_warp, y_warp, x_accum, y_accum, x, y;
|
||||
|
||||
window->getCursorGrabInitPos(x_warp, y_warp);
|
||||
|
||||
@ -1508,7 +1488,8 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
|
||||
y_accum += -[event deltaY]; //Strange Apple implementation (inverted coordinates for the deltaY) ...
|
||||
window->setCursorGrabAccum(x_accum, y_accum);
|
||||
|
||||
pushEvent(new GHOST_EventCursor([event timestamp]*1000, GHOST_kEventCursorMove, window, x_warp+x_accum, y_warp+y_accum));
|
||||
window->clientToScreenIntern(x_warp+x_accum, y_warp+y_accum, x, y);
|
||||
pushEvent(new GHOST_EventCursor([event timestamp]*1000, GHOST_kEventCursorMove, window, x, y));
|
||||
}
|
||||
break;
|
||||
case GHOST_kGrabWrap: //Wrap cursor at area/window boundaries
|
||||
@ -1516,19 +1497,16 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
|
||||
NSPoint mousePos = [event locationInWindow];
|
||||
GHOST_TInt32 x_mouse= mousePos.x;
|
||||
GHOST_TInt32 y_mouse= mousePos.y;
|
||||
GHOST_TInt32 x_accum, y_accum, x_cur, y_cur;
|
||||
GHOST_Rect bounds, windowBounds, correctedBounds;
|
||||
GHOST_TInt32 x_accum, y_accum, x_cur, y_cur, x, y;
|
||||
GHOST_Rect bounds, correctedBounds;
|
||||
|
||||
/* fallback to window bounds */
|
||||
if(window->getCursorGrabBounds(bounds)==GHOST_kFailure)
|
||||
window->getClientBounds(bounds);
|
||||
|
||||
//Switch back to Cocoa coordinates orientation (y=0 at botton,the same as blender internal btw!), and to client coordinates
|
||||
window->getClientBounds(windowBounds);
|
||||
window->screenToClient(bounds.m_l,bounds.m_b, correctedBounds.m_l, correctedBounds.m_t);
|
||||
window->screenToClient(bounds.m_r, bounds.m_t, correctedBounds.m_r, correctedBounds.m_b);
|
||||
correctedBounds.m_b = (windowBounds.m_b - windowBounds.m_t) - correctedBounds.m_b;
|
||||
correctedBounds.m_t = (windowBounds.m_b - windowBounds.m_t) - correctedBounds.m_t;
|
||||
window->screenToClient(bounds.m_l, bounds.m_b, correctedBounds.m_l, correctedBounds.m_b);
|
||||
window->screenToClient(bounds.m_r, bounds.m_t, correctedBounds.m_r, correctedBounds.m_t);
|
||||
|
||||
//Update accumulation counts
|
||||
window->getCursorGrabAccum(x_accum, y_accum);
|
||||
@ -1547,19 +1525,24 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
|
||||
m_cursorDelta_y = y_mouse-mousePos.y;
|
||||
|
||||
//Set new cursor position
|
||||
window->clientToScreen(x_mouse, y_mouse, x_cur, y_cur);
|
||||
window->clientToScreenIntern(x_mouse, y_mouse, x_cur, y_cur);
|
||||
setMouseCursorPosition(x_cur, y_cur); /* wrap */
|
||||
|
||||
//Post event
|
||||
window->getCursorGrabInitPos(x_cur, y_cur);
|
||||
pushEvent(new GHOST_EventCursor([event timestamp]*1000, GHOST_kEventCursorMove, window, x_cur + x_accum, y_cur + y_accum));
|
||||
window->clientToScreenIntern(x_cur + x_accum, y_cur + y_accum, x, y);
|
||||
pushEvent(new GHOST_EventCursor([event timestamp]*1000, GHOST_kEventCursorMove, window, x, y));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
//Normal cursor operation: send mouse position in window
|
||||
NSPoint mousePos = [event locationInWindow];
|
||||
pushEvent(new GHOST_EventCursor([event timestamp]*1000, GHOST_kEventCursorMove, window, mousePos.x, mousePos.y));
|
||||
GHOST_TInt32 x, y;
|
||||
|
||||
window->clientToScreenIntern(mousePos.x, mousePos.y, x, y);
|
||||
pushEvent(new GHOST_EventCursor([event timestamp]*1000, GHOST_kEventCursorMove, window, x, y));
|
||||
|
||||
m_cursorDelta_x=0;
|
||||
m_cursorDelta_y=0; //Mouse motion occurred between two cursor warps, so we can reset the delta counter
|
||||
}
|
||||
@ -1581,6 +1564,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
|
||||
}
|
||||
else {
|
||||
NSPoint mousePos = [event locationInWindow];
|
||||
GHOST_TInt32 x, y;
|
||||
double dx = [event deltaX];
|
||||
double dy = -[event deltaY];
|
||||
|
||||
@ -1597,7 +1581,10 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
|
||||
if (dy<0.0) dy-=0.5; else dy+=0.5;
|
||||
if (dy< -deltaMax) dy= -deltaMax; else if (dy>deltaMax) dy=deltaMax;
|
||||
|
||||
pushEvent(new GHOST_EventTrackpad([event timestamp]*1000, window, GHOST_kTrackpadEventScroll, mousePos.x, mousePos.y, dx, dy));
|
||||
window->clientToScreenIntern(mousePos.x, mousePos.y, x, y);
|
||||
dy = -dy;
|
||||
|
||||
pushEvent(new GHOST_EventTrackpad([event timestamp]*1000, window, GHOST_kTrackpadEventScroll, x, y, dx, dy));
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -1605,7 +1592,9 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
|
||||
case NSEventTypeMagnify:
|
||||
{
|
||||
NSPoint mousePos = [event locationInWindow];
|
||||
pushEvent(new GHOST_EventTrackpad([event timestamp]*1000, window, GHOST_kTrackpadEventMagnify, mousePos.x, mousePos.y,
|
||||
GHOST_TInt32 x, y;
|
||||
window->clientToScreenIntern(mousePos.x, mousePos.y, x, y);
|
||||
pushEvent(new GHOST_EventTrackpad([event timestamp]*1000, window, GHOST_kTrackpadEventMagnify, x, y,
|
||||
[event magnification]*250.0 + 0.1, 0));
|
||||
}
|
||||
break;
|
||||
@ -1613,7 +1602,9 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
|
||||
case NSEventTypeRotate:
|
||||
{
|
||||
NSPoint mousePos = [event locationInWindow];
|
||||
pushEvent(new GHOST_EventTrackpad([event timestamp]*1000, window, GHOST_kTrackpadEventRotate, mousePos.x, mousePos.y,
|
||||
GHOST_TInt32 x, y;
|
||||
window->clientToScreenIntern(mousePos.x, mousePos.y, x, y);
|
||||
pushEvent(new GHOST_EventTrackpad([event timestamp]*1000, window, GHOST_kTrackpadEventRotate, x, y,
|
||||
-[event rotation] * 5.0, 0));
|
||||
}
|
||||
case NSEventTypeBeginGesture:
|
||||
|
@ -41,8 +41,7 @@
|
||||
|
||||
|
||||
GHOST_Window::GHOST_Window(
|
||||
const STR_String& /*title*/,
|
||||
GHOST_TInt32 /*left*/, GHOST_TInt32 /*top*/, GHOST_TUns32 width, GHOST_TUns32 height,
|
||||
GHOST_TUns32 width, GHOST_TUns32 height,
|
||||
GHOST_TWindowState state,
|
||||
GHOST_TDrawingContextType type,
|
||||
const bool stereoVisual,
|
||||
|
@ -76,9 +76,6 @@ public:
|
||||
* Constructor.
|
||||
* Creates a new window and opens it.
|
||||
* To check if the window was created properly, use the getValid() method.
|
||||
* @param title The text shown in the title bar of the window.
|
||||
* @param left The coordinate of the left edge of the window.
|
||||
* @param top The coordinate of the top edge of the window.
|
||||
* @param width The width the window.
|
||||
* @param heigh The height the window.
|
||||
* @param state The state the window is initially opened with.
|
||||
@ -87,9 +84,6 @@ public:
|
||||
* @param numOfAASamples Number of samples used for AA (zero if no AA)
|
||||
*/
|
||||
GHOST_Window(
|
||||
const STR_String& title,
|
||||
GHOST_TInt32 left,
|
||||
GHOST_TInt32 top,
|
||||
GHOST_TUns32 width,
|
||||
GHOST_TUns32 height,
|
||||
GHOST_TWindowState state,
|
||||
|
@ -102,7 +102,7 @@ GHOST_WindowCarbon::GHOST_WindowCarbon(
|
||||
const bool stereoVisual,
|
||||
const GHOST_TUns16 numOfAASamples
|
||||
) :
|
||||
GHOST_Window(title, left, top, width, height, state, GHOST_kDrawingContextTypeNone),
|
||||
GHOST_Window(width, height, state, GHOST_kDrawingContextTypeNone),
|
||||
m_windowRef(0),
|
||||
m_grafPtr(0),
|
||||
m_aglCtx(0),
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include "STR_String.h"
|
||||
|
||||
@class CocoaWindow;
|
||||
@class CocoaOpenGLView;
|
||||
|
||||
class GHOST_SystemCocoa;
|
||||
|
||||
@ -77,7 +78,7 @@ public:
|
||||
GHOST_SystemCocoa *systemCocoa,
|
||||
const STR_String& title,
|
||||
GHOST_TInt32 left,
|
||||
GHOST_TInt32 top,
|
||||
GHOST_TInt32 bottom,
|
||||
GHOST_TUns32 width,
|
||||
GHOST_TUns32 height,
|
||||
GHOST_TWindowState state,
|
||||
@ -180,6 +181,26 @@ public:
|
||||
*/
|
||||
virtual void clientToScreen(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const;
|
||||
|
||||
/**
|
||||
* Converts a point in screen coordinates to client rectangle coordinates
|
||||
* but without the y coordinate conversion needed for ghost compatibility.
|
||||
* @param inX The x-coordinate in the client rectangle.
|
||||
* @param inY The y-coordinate in the client rectangle.
|
||||
* @param outX The x-coordinate on the screen.
|
||||
* @param outY The y-coordinate on the screen.
|
||||
*/
|
||||
void clientToScreenIntern(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const;
|
||||
|
||||
/**
|
||||
* Converts a point in screen coordinates to client rectangle coordinates,
|
||||
* but without the y coordinate conversion needed for ghost compatibility.
|
||||
* @param inX The x-coordinate in the client rectangle.
|
||||
* @param inY The y-coordinate in the client rectangle.
|
||||
* @param outX The x-coordinate on the screen.
|
||||
* @param outY The y-coordinate on the screen.
|
||||
*/
|
||||
void screenToClientIntern(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const;
|
||||
|
||||
/**
|
||||
* Gets the screen the window is displayed in
|
||||
* @return The NSScreen object
|
||||
@ -289,7 +310,7 @@ protected:
|
||||
CocoaWindow *m_window;
|
||||
|
||||
/** The openGL view */
|
||||
NSOpenGLView *m_openGLView;
|
||||
CocoaOpenGLView *m_openGLView;
|
||||
|
||||
/** The opgnGL drawing context */
|
||||
NSOpenGLContext *m_openGLContext;
|
||||
|
@ -241,10 +241,19 @@ extern "C" {
|
||||
//We need to subclass it in order to give Cocoa the feeling key events are trapped
|
||||
@interface CocoaOpenGLView : NSOpenGLView
|
||||
{
|
||||
GHOST_SystemCocoa *systemCocoa;
|
||||
GHOST_WindowCocoa *associatedWindow;
|
||||
}
|
||||
- (void)setSystemAndWindowCocoa:(GHOST_SystemCocoa *)sysCocoa windowCocoa:(GHOST_WindowCocoa *)winCocoa;
|
||||
@end
|
||||
@implementation CocoaOpenGLView
|
||||
|
||||
- (void)setSystemAndWindowCocoa:(GHOST_SystemCocoa *)sysCocoa windowCocoa:(GHOST_WindowCocoa *)winCocoa
|
||||
{
|
||||
systemCocoa = sysCocoa;
|
||||
associatedWindow = winCocoa;
|
||||
}
|
||||
|
||||
- (BOOL)acceptsFirstResponder
|
||||
{
|
||||
return YES;
|
||||
@ -294,6 +303,7 @@ extern "C" {
|
||||
else
|
||||
{
|
||||
[super drawRect:rect];
|
||||
systemCocoa->handleWindowEvent(GHOST_kEventWindowUpdate, associatedWindow);
|
||||
}
|
||||
}
|
||||
|
||||
@ -308,14 +318,14 @@ GHOST_WindowCocoa::GHOST_WindowCocoa(
|
||||
GHOST_SystemCocoa *systemCocoa,
|
||||
const STR_String& title,
|
||||
GHOST_TInt32 left,
|
||||
GHOST_TInt32 top,
|
||||
GHOST_TInt32 bottom,
|
||||
GHOST_TUns32 width,
|
||||
GHOST_TUns32 height,
|
||||
GHOST_TWindowState state,
|
||||
GHOST_TDrawingContextType type,
|
||||
const bool stereoVisual, const GHOST_TUns16 numOfAASamples
|
||||
) :
|
||||
GHOST_Window(title, left, top, width, height, state, GHOST_kDrawingContextTypeNone, stereoVisual, numOfAASamples),
|
||||
GHOST_Window(width, height, state, GHOST_kDrawingContextTypeNone, stereoVisual, numOfAASamples),
|
||||
m_customCursor(0)
|
||||
{
|
||||
NSOpenGLPixelFormatAttribute pixelFormatAttrsWindow[40];
|
||||
@ -327,13 +337,12 @@ GHOST_WindowCocoa::GHOST_WindowCocoa(
|
||||
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
|
||||
//Creates the window
|
||||
NSRect rect;
|
||||
NSSize minSize;
|
||||
|
||||
rect.origin.x = left;
|
||||
rect.origin.y = top;
|
||||
rect.origin.y = bottom;
|
||||
rect.size.width = width;
|
||||
rect.size.height = height;
|
||||
|
||||
@ -425,6 +434,8 @@ GHOST_WindowCocoa::GHOST_WindowCocoa(
|
||||
//Creates the OpenGL View inside the window
|
||||
m_openGLView = [[CocoaOpenGLView alloc] initWithFrame:rect
|
||||
pixelFormat:pixelFormat];
|
||||
|
||||
[m_openGLView setSystemAndWindowCocoa:systemCocoa windowCocoa:this];
|
||||
|
||||
[pixelFormat release];
|
||||
|
||||
@ -692,7 +703,30 @@ GHOST_TWindowState GHOST_WindowCocoa::getState() const
|
||||
void GHOST_WindowCocoa::screenToClient(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const
|
||||
{
|
||||
GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::screenToClient(): window invalid")
|
||||
|
||||
|
||||
screenToClientIntern(inX, inY, outX, outY);
|
||||
|
||||
/* switch y to match ghost convention */
|
||||
GHOST_Rect cBnds;
|
||||
getClientBounds(cBnds);
|
||||
outY = (cBnds.getHeight() - 1) - outY;
|
||||
}
|
||||
|
||||
|
||||
void GHOST_WindowCocoa::clientToScreen(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const
|
||||
{
|
||||
GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::clientToScreen(): window invalid")
|
||||
|
||||
/* switch y to match ghost convention */
|
||||
GHOST_Rect cBnds;
|
||||
getClientBounds(cBnds);
|
||||
inY = (cBnds.getHeight() - 1) - inY;
|
||||
|
||||
clientToScreenIntern(inX, inY, outX, outY);
|
||||
}
|
||||
|
||||
void GHOST_WindowCocoa::screenToClientIntern(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const
|
||||
{
|
||||
NSPoint screenCoord;
|
||||
NSPoint baseCoord;
|
||||
|
||||
@ -705,11 +739,8 @@ void GHOST_WindowCocoa::screenToClient(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST
|
||||
outY = baseCoord.y;
|
||||
}
|
||||
|
||||
|
||||
void GHOST_WindowCocoa::clientToScreen(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const
|
||||
void GHOST_WindowCocoa::clientToScreenIntern(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const
|
||||
{
|
||||
GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::clientToScreen(): window invalid")
|
||||
|
||||
NSPoint screenCoord;
|
||||
NSPoint baseCoord;
|
||||
|
||||
@ -1211,7 +1242,7 @@ GHOST_TSuccess GHOST_WindowCocoa::setWindowCursorGrab(GHOST_TGrabCursorMode mode
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
m_systemCocoa->getCursorPosition(x_old,y_old);
|
||||
screenToClient(x_old, y_old, m_cursorGrabInitPos[0], m_cursorGrabInitPos[1]);
|
||||
screenToClientIntern(x_old, y_old, m_cursorGrabInitPos[0], m_cursorGrabInitPos[1]);
|
||||
//Warp position is stored in client (window base) coordinates
|
||||
setCursorGrabAccum(0, 0);
|
||||
|
||||
|
@ -136,7 +136,7 @@ GHOST_WindowWin32::GHOST_WindowWin32(
|
||||
GHOST_TSuccess msEnabled,
|
||||
int msPixelFormat)
|
||||
:
|
||||
GHOST_Window(title, left, top, width, height, state, GHOST_kDrawingContextTypeNone,
|
||||
GHOST_Window(width, height, state, GHOST_kDrawingContextTypeNone,
|
||||
stereoVisual,numOfAASamples),
|
||||
m_system(system),
|
||||
m_hDC(0),
|
||||
|
@ -164,7 +164,7 @@ GHOST_WindowX11(
|
||||
const bool stereoVisual,
|
||||
const GHOST_TUns16 numOfAASamples
|
||||
) :
|
||||
GHOST_Window(title,left,top,width,height,state,type,stereoVisual,numOfAASamples),
|
||||
GHOST_Window(width,height,state,type,stereoVisual,numOfAASamples),
|
||||
m_context(NULL),
|
||||
m_display(display),
|
||||
m_normal_state(GHOST_kWindowStateNormal),
|
||||
|
@ -905,9 +905,6 @@ void IK_QElbowSegment::SetLimit(int axis, MT_Scalar lmin, MT_Scalar lmax)
|
||||
lmin = MT_clamp(lmin, -MT_PI, MT_PI);
|
||||
lmax = MT_clamp(lmax, -MT_PI, MT_PI);
|
||||
|
||||
lmin = lmin;
|
||||
lmax = lmax;
|
||||
|
||||
if (axis == 1) {
|
||||
m_min_twist = lmin;
|
||||
m_max_twist = lmax;
|
||||
|
@ -134,6 +134,7 @@ bool ConstraintSet::setControlParameter(int id, ConstraintAction action, double
|
||||
break;
|
||||
default:
|
||||
assert(action==ACT_NONE);
|
||||
break;
|
||||
}
|
||||
return setControlParameters(&values, 1, timestep);
|
||||
}
|
||||
|
@ -812,21 +812,25 @@ def main(context, island_margin, projection_limit):
|
||||
global RotMatStepRotation
|
||||
main_consts()
|
||||
|
||||
#XXX objects= bpy.data.scenes.active.objects
|
||||
objects = context.selected_editable_objects
|
||||
|
||||
# TODO, all selected meshes
|
||||
'''
|
||||
# objects = context.selected_editable_objects
|
||||
objects = []
|
||||
|
||||
# we can will tag them later.
|
||||
obList = [ob for ob in objects if ob.type == 'MESH']
|
||||
|
||||
# Face select object may not be selected.
|
||||
#XXX ob = objects.active
|
||||
ob= objects[0]
|
||||
ob = context.active_object
|
||||
|
||||
if ob and (not ob.select) and ob.type == 'MESH':
|
||||
# Add to the list
|
||||
obList =[ob]
|
||||
del objects
|
||||
'''
|
||||
|
||||
# quick workaround
|
||||
obList = [ob for ob in [context.active_object] if ob and ob.type == 'MESH']
|
||||
|
||||
if not obList:
|
||||
raise('error, no selected mesh objects')
|
||||
|
@ -19,7 +19,9 @@
|
||||
# <pep8 compliant>
|
||||
|
||||
import bpy
|
||||
from bpy.props import StringProperty, BoolProperty, IntProperty, FloatProperty
|
||||
from bpy.props import StringProperty, BoolProperty, IntProperty, \
|
||||
FloatProperty, EnumProperty
|
||||
|
||||
from rna_prop_ui import rna_idprop_ui_prop_get, rna_idprop_ui_prop_clear
|
||||
|
||||
|
||||
@ -457,15 +459,76 @@ doc_id = StringProperty(name="Doc ID",
|
||||
doc_new = StringProperty(name="Edit Description",
|
||||
description="", maxlen=1024, default="")
|
||||
|
||||
data_path_iter = StringProperty(
|
||||
description="The data path relative to the context, must point to an iterable.")
|
||||
|
||||
data_path_item = StringProperty(
|
||||
description="The data path from each iterable to the value (int or float)")
|
||||
|
||||
|
||||
class WM_OT_context_collection_boolean_set(bpy.types.Operator):
|
||||
'''Set boolean values for a collection of items'''
|
||||
bl_idname = "wm.context_collection_boolean_set"
|
||||
bl_label = "Context Collection Boolean Set"
|
||||
bl_options = {'UNDO', 'REGISTER', 'INTERNAL'}
|
||||
|
||||
data_path_iter = data_path_iter
|
||||
data_path_item = data_path_item
|
||||
|
||||
type = EnumProperty(items=(
|
||||
('TOGGLE', "Toggle", ""),
|
||||
('ENABLE', "Enable", ""),
|
||||
('DISABLE', "Disable", ""),
|
||||
),
|
||||
name="Type")
|
||||
|
||||
def execute(self, context):
|
||||
data_path_iter = self.data_path_iter
|
||||
data_path_item = self.data_path_item
|
||||
|
||||
items = list(getattr(context, data_path_iter))
|
||||
items_ok = []
|
||||
is_set = False
|
||||
for item in items:
|
||||
try:
|
||||
value_orig = eval("item." + data_path_item)
|
||||
except:
|
||||
continue
|
||||
|
||||
if value_orig == True:
|
||||
is_set = True
|
||||
elif value_orig == False:
|
||||
pass
|
||||
else:
|
||||
self.report({'WARNING'}, "Non boolean value found: %s[ ].%s" %
|
||||
(data_path_iter, data_path_item))
|
||||
return {'CANCELLED'}
|
||||
|
||||
items_ok.append(item)
|
||||
|
||||
if self.type == 'ENABLE':
|
||||
is_set = True
|
||||
elif self.type == 'DISABLE':
|
||||
is_set = False
|
||||
else:
|
||||
is_set = not is_set
|
||||
|
||||
exec_str = "item.%s = %s" % (data_path_item, is_set)
|
||||
for item in items_ok:
|
||||
exec(exec_str)
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class WM_OT_context_modal_mouse(bpy.types.Operator):
|
||||
'''Adjust arbitrary values with mouse input'''
|
||||
bl_idname = "wm.context_modal_mouse"
|
||||
bl_label = "Context Modal Mouse"
|
||||
bl_options = {'INTERNAL'}
|
||||
bl_options = {'GRAB_POINTER', 'BLOCKING', 'INTERNAL'}
|
||||
|
||||
data_path_iter = data_path_iter
|
||||
data_path_item = data_path_item
|
||||
|
||||
data_path_iter = StringProperty(description="The data path relative to the context, must point to an iterable.")
|
||||
data_path_item = StringProperty(description="The data path from each iterable to the value (int or float)")
|
||||
input_scale = FloatProperty(default=0.01, description="Scale the mouse movement by this value before applying the delta")
|
||||
invert = BoolProperty(default=False, description="Invert the mouse input")
|
||||
initial_x = IntProperty(options={'HIDDEN'})
|
||||
|
@ -883,7 +883,7 @@ class MATERIAL_PT_volume_lighting(VolumeButtonsPanel, bpy.types.Panel):
|
||||
sub = col.column()
|
||||
sub.enabled = True
|
||||
sub.active = False
|
||||
sub.prop(vol, "use_light_cache")
|
||||
sub.label("Light Cache Enabled")
|
||||
col.prop(vol, "cache_resolution")
|
||||
|
||||
sub = col.column(align=True)
|
||||
|
@ -878,6 +878,15 @@ class PARTICLE_PT_render(ParticleButtonsPanel, bpy.types.Panel):
|
||||
col.prop(part, "billboard_tilt_random", text="Random", slider=True)
|
||||
col = row.column()
|
||||
col.prop(part, "billboard_offset")
|
||||
|
||||
row = layout.row()
|
||||
col = row.column()
|
||||
col.prop(part, "billboard_size", text="Scale")
|
||||
if part.billboard_align == 'VEL':
|
||||
col = row.column(align=True)
|
||||
col.label("Velocity Scale:")
|
||||
col.prop(part, "billboard_velocity_head", text="Head")
|
||||
col.prop(part, "billboard_velocity_tail", text="Tail")
|
||||
|
||||
if psys:
|
||||
col = layout.column()
|
||||
|
@ -849,7 +849,7 @@ class USERPREF_PT_input(bpy.types.Panel, InputKeyMapPanel):
|
||||
|
||||
|
||||
class USERPREF_MT_addons_dev_guides(bpy.types.Menu):
|
||||
bl_label = "Develoment Guides"
|
||||
bl_label = "Development Guides"
|
||||
|
||||
# menu to open webpages with addons development guides
|
||||
def draw(self, context):
|
||||
|
@ -774,10 +774,16 @@ class VIEW3D_MT_object_specials(bpy.types.Menu):
|
||||
if obj.type == 'CAMERA':
|
||||
layout.operator_context = 'INVOKE_REGION_WIN'
|
||||
|
||||
props = layout.operator("wm.context_modal_mouse", text="Camera Lens Angle")
|
||||
props.data_path_iter = "selected_editable_objects"
|
||||
props.data_path_item = "data.lens"
|
||||
props.input_scale = 0.1
|
||||
if obj.data.type == 'PERSP':
|
||||
props = layout.operator("wm.context_modal_mouse", text="Camera Lens Angle")
|
||||
props.data_path_iter = "selected_editable_objects"
|
||||
props.data_path_item = "data.lens"
|
||||
props.input_scale = 0.1
|
||||
else:
|
||||
props = layout.operator("wm.context_modal_mouse", text="Camera Lens Scale")
|
||||
props.data_path_iter = "selected_editable_objects"
|
||||
props.data_path_item = "data.ortho_scale"
|
||||
props.input_scale = 0.01
|
||||
|
||||
if not obj.data.dof_object:
|
||||
#layout.label(text="Test Has DOF obj");
|
||||
@ -1100,17 +1106,18 @@ class VIEW3D_MT_sculpt(bpy.types.Menu):
|
||||
layout.operator_menu_enum("brush.curve_preset", "shape")
|
||||
layout.separator()
|
||||
|
||||
sculpt_tool = brush.sculpt_tool
|
||||
if brush is not None: # unlikely but can happen
|
||||
sculpt_tool = brush.sculpt_tool
|
||||
|
||||
if sculpt_tool != 'GRAB':
|
||||
layout.prop_menu_enum(brush, "stroke_method")
|
||||
if sculpt_tool != 'GRAB':
|
||||
layout.prop_menu_enum(brush, "stroke_method")
|
||||
|
||||
if sculpt_tool in {'DRAW', 'PINCH', 'INFLATE', 'LAYER', 'CLAY'}:
|
||||
layout.prop_menu_enum(brush, "direction")
|
||||
if sculpt_tool in {'DRAW', 'PINCH', 'INFLATE', 'LAYER', 'CLAY'}:
|
||||
layout.prop_menu_enum(brush, "direction")
|
||||
|
||||
if sculpt_tool == 'LAYER':
|
||||
layout.prop(brush, "use_persistent")
|
||||
layout.operator("sculpt.set_persistent_base")
|
||||
if sculpt_tool == 'LAYER':
|
||||
layout.prop(brush, "use_persistent")
|
||||
layout.operator("sculpt.set_persistent_base")
|
||||
|
||||
layout.separator()
|
||||
layout.prop(sculpt, "use_threaded", text="Threaded Sculpt")
|
||||
@ -1245,7 +1252,7 @@ class VIEW3D_MT_pose(bpy.types.Menu):
|
||||
layout.separator()
|
||||
|
||||
layout.menu("VIEW3D_MT_pose_showhide")
|
||||
layout.operator_menu_enum("pose.flags_set", 'mode', text="Bone Settings")
|
||||
layout.menu("VIEW3D_MT_bone_options_toggle", text="Bone Settings")
|
||||
|
||||
|
||||
class VIEW3D_MT_pose_transform(bpy.types.Menu):
|
||||
@ -1366,6 +1373,49 @@ class VIEW3D_MT_pose_apply(bpy.types.Menu):
|
||||
layout.operator("pose.visual_transform_apply")
|
||||
|
||||
|
||||
class BoneOptions:
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
options = [
|
||||
"show_wire",
|
||||
"use_deform",
|
||||
"use_envelope_multiply",
|
||||
"use_inherit_rotation",
|
||||
"use_inherit_scale",
|
||||
]
|
||||
|
||||
if context.mode == 'EDIT_ARMATURE':
|
||||
bone_props = bpy.types.EditBone.bl_rna.properties
|
||||
data_path_iter = "selected_bones"
|
||||
opt_suffix = ""
|
||||
options.append("lock")
|
||||
else: # posemode
|
||||
bone_props = bpy.types.Bone.bl_rna.properties
|
||||
data_path_iter = "selected_pose_bones"
|
||||
opt_suffix = "bone."
|
||||
|
||||
for opt in options:
|
||||
props = layout.operator("wm.context_collection_boolean_set", text=bone_props[opt].name)
|
||||
props.data_path_iter = data_path_iter
|
||||
props.data_path_item = opt_suffix + opt
|
||||
props.type = self.type
|
||||
|
||||
|
||||
class VIEW3D_MT_bone_options_toggle(bpy.types.Menu, BoneOptions):
|
||||
bl_label = "Toggle Bone Options"
|
||||
type = 'TOGGLE'
|
||||
|
||||
|
||||
class VIEW3D_MT_bone_options_enable(bpy.types.Menu, BoneOptions):
|
||||
bl_label = "Enable Bone Options"
|
||||
type = 'ENABLE'
|
||||
|
||||
|
||||
class VIEW3D_MT_bone_options_disable(bpy.types.Menu, BoneOptions):
|
||||
bl_label = "Disable Bone Options"
|
||||
type = 'DISABLE'
|
||||
|
||||
# ********** Edit Menus, suffix from ob.type **********
|
||||
|
||||
|
||||
@ -1959,7 +2009,7 @@ class VIEW3D_MT_edit_armature(bpy.types.Menu):
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.operator_menu_enum("armature.flags_set", "mode", text="Bone Settings")
|
||||
layout.menu("VIEW3D_MT_bone_options_toggle", text="Bone Settings")
|
||||
|
||||
|
||||
class VIEW3D_MT_armature_specials(bpy.types.Menu):
|
||||
|
@ -997,7 +997,11 @@ class VIEW3D_PT_tools_brush_appearance(PaintPanel, bpy.types.Panel):
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return (context.sculpt_object and context.tool_settings.sculpt) or (context.vertex_paint_object and context.tool_settings.vertex_paint) or (context.weight_paint_object and context.tool_settings.weight_paint) or (context.image_paint_object and context.tool_settings.image_paint)
|
||||
ts = context.tool_settings
|
||||
return ((context.sculpt_object and ts.sculpt) or
|
||||
(context.vertex_paint_object and ts.vertex_paint) or
|
||||
(context.weight_paint_object and ts.weight_paint) or
|
||||
(context.image_paint_object and ts.image_paint))
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
@ -1005,6 +1009,10 @@ class VIEW3D_PT_tools_brush_appearance(PaintPanel, bpy.types.Panel):
|
||||
settings = __class__.paint_settings(context)
|
||||
brush = settings.brush
|
||||
|
||||
if brush is None: # unlikely but can happen
|
||||
layout.label(text="Brush Unset")
|
||||
return
|
||||
|
||||
col = layout.column()
|
||||
|
||||
if context.sculpt_object and context.tool_settings.sculpt:
|
||||
|
@ -44,7 +44,7 @@ extern "C" {
|
||||
* and keep comment above the defines.
|
||||
* Use STRINGIFY() rather than defining with quotes */
|
||||
#define BLENDER_VERSION 258
|
||||
#define BLENDER_SUBVERSION 0
|
||||
#define BLENDER_SUBVERSION 1
|
||||
|
||||
#define BLENDER_MINVERSION 250
|
||||
#define BLENDER_MINSUBVERSION 0
|
||||
|
@ -147,7 +147,8 @@ typedef struct ParticleBillboardData
|
||||
struct Object *ob;
|
||||
float vec[3], vel[3];
|
||||
float offset[2];
|
||||
float size, tilt, random, time;
|
||||
float size[2];
|
||||
float tilt, random, time;
|
||||
int uv[3];
|
||||
int lock, num;
|
||||
int totnum;
|
||||
|
@ -43,8 +43,6 @@ set(INC
|
||||
../nodes
|
||||
../editors/include
|
||||
../render/extern/include
|
||||
../../../intern/audaspace/intern
|
||||
../../../intern/ffmpeg
|
||||
../../../intern/bsp/extern ../blenfont
|
||||
../../../intern/decimation/extern
|
||||
../../../intern/elbeem/extern
|
||||
@ -243,6 +241,13 @@ set(SRC
|
||||
|
||||
add_definitions(-DGLEW_STATIC)
|
||||
|
||||
if(WITH_AUDASPACE)
|
||||
list(APPEND INC
|
||||
../../../intern/audaspace/intern
|
||||
)
|
||||
add_definitions(-DWITH_AUDASPACE)
|
||||
endif()
|
||||
|
||||
if(WITH_BULLET)
|
||||
list(APPEND INC ../../../extern/bullet2/src)
|
||||
add_definitions(-DUSE_BULLET)
|
||||
@ -284,6 +289,7 @@ if(WITH_CODEC_QUICKTIME)
|
||||
endif()
|
||||
|
||||
if(WITH_CODEC_FFMPEG)
|
||||
list(APPEND INC ../../../intern/ffmpeg)
|
||||
list(APPEND INC_SYS ${FFMPEG_INCLUDE_DIRS})
|
||||
add_definitions(-DWITH_FFMPEG)
|
||||
endif()
|
||||
|
@ -64,6 +64,7 @@
|
||||
#include "BLI_dynstr.h"
|
||||
#include "BLI_path_util.h"
|
||||
#include "BLI_utildefines.h"
|
||||
#include "BLI_callbacks.h"
|
||||
|
||||
#include "IMB_imbuf.h"
|
||||
|
||||
@ -96,7 +97,7 @@ UserDef U;
|
||||
/* ListBase = {NULL, NULL}; */
|
||||
short ENDIAN_ORDER;
|
||||
|
||||
static char versionstr[48]= "";
|
||||
char versionstr[48]= "";
|
||||
|
||||
/* ********** free ********** */
|
||||
|
||||
@ -110,6 +111,9 @@ void free_blender(void)
|
||||
BKE_spacetypes_free(); /* after free main, it uses space callbacks */
|
||||
|
||||
IMB_exit();
|
||||
|
||||
BLI_cb_finalize();
|
||||
|
||||
seq_stripelem_cache_destruct();
|
||||
|
||||
free_nodesystem();
|
||||
@ -129,9 +133,9 @@ void initglobals(void)
|
||||
ENDIAN_ORDER= (((char*)&ENDIAN_ORDER)[0])? L_ENDIAN: B_ENDIAN;
|
||||
|
||||
if(BLENDER_SUBVERSION)
|
||||
BLI_snprintf(versionstr, sizeof(versionstr), "www.blender.org %d.%d", BLENDER_VERSION, BLENDER_SUBVERSION);
|
||||
BLI_snprintf(versionstr, sizeof(versionstr), "blender.org %d.%d", BLENDER_VERSION, BLENDER_SUBVERSION);
|
||||
else
|
||||
BLI_snprintf(versionstr, sizeof(versionstr), "www.blender.org %d", BLENDER_VERSION);
|
||||
BLI_snprintf(versionstr, sizeof(versionstr), "blender.org %d", BLENDER_VERSION);
|
||||
|
||||
#ifdef _WIN32 // FULLSCREEN
|
||||
G.windowstate = G_WINDOWSTATE_USERDEF;
|
||||
|
@ -235,8 +235,6 @@ void make_local_brush(Brush *brush)
|
||||
if(paint_brush(&scene->toolsettings->imapaint.paint)==brush) {
|
||||
if(scene->id.lib==NULL) {
|
||||
paint_brush_set(&scene->toolsettings->imapaint.paint, brushn);
|
||||
brushn->id.us++;
|
||||
brush->id.us--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -719,7 +719,7 @@ void free_bvhtree_from_mesh(struct BVHTreeFromMesh *data)
|
||||
if(!data->cached)
|
||||
BLI_bvhtree_free(data->tree);
|
||||
|
||||
memset( data, 0, sizeof(data) );
|
||||
memset( data, 0, sizeof(*data) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -85,8 +85,11 @@ Brush *paint_brush(Paint *p)
|
||||
|
||||
void paint_brush_set(Paint *p, Brush *br)
|
||||
{
|
||||
if(p)
|
||||
if(p) {
|
||||
id_us_min((ID *)p->brush);
|
||||
id_us_plus((ID *)br);
|
||||
p->brush= br;
|
||||
}
|
||||
}
|
||||
|
||||
int paint_facesel_test(Object *ob)
|
||||
@ -110,12 +113,17 @@ void paint_init(Paint *p, const char col[3])
|
||||
p->flags |= PAINT_SHOW_BRUSH;
|
||||
}
|
||||
|
||||
void free_paint(Paint *UNUSED(paint))
|
||||
void free_paint(Paint *paint)
|
||||
{
|
||||
/* nothing */
|
||||
id_us_min((ID *)paint->brush);
|
||||
}
|
||||
|
||||
/* called when copying scene settings, so even if 'src' and 'tar' are the same
|
||||
* still do a id_us_plus(), rather then if we were copying betweem 2 existing
|
||||
* scenes where a matching value should decrease the existing user count as
|
||||
* with paint_brush_set() */
|
||||
void copy_paint(Paint *src, Paint *tar)
|
||||
{
|
||||
tar->brush= src->brush;
|
||||
id_us_plus((ID *)tar->brush);
|
||||
}
|
||||
|
@ -3534,6 +3534,8 @@ static void default_particle_settings(ParticleSettings *part)
|
||||
part->path_start = 0.0f;
|
||||
part->path_end = 1.0f;
|
||||
|
||||
part->bb_size[0] = part->bb_size[1] = 1.0f;
|
||||
|
||||
part->keyed_loops = 1;
|
||||
|
||||
part->color_vec_max = 1.f;
|
||||
@ -4505,8 +4507,8 @@ void psys_make_billboard(ParticleBillboardData *bb, float xvec[3], float yvec[3]
|
||||
mul_v3_fl(tvec, -sin(bb->tilt * (float)M_PI));
|
||||
VECADD(yvec, yvec, tvec);
|
||||
|
||||
mul_v3_fl(xvec, bb->size);
|
||||
mul_v3_fl(yvec, bb->size);
|
||||
mul_v3_fl(xvec, bb->size[0]);
|
||||
mul_v3_fl(yvec, bb->size[1]);
|
||||
|
||||
VECADDFAC(center, bb->vec, xvec, bb->offset[0]);
|
||||
VECADDFAC(center, center, yvec, bb->offset[1]);
|
||||
|
@ -73,7 +73,10 @@
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_sound.h"
|
||||
#include "AUD_C-API.h"
|
||||
|
||||
#ifdef WITH_AUDASPACE
|
||||
# include "AUD_C-API.h"
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#define snprintf _snprintf
|
||||
@ -697,6 +700,7 @@ void reload_sequence_new_file(Scene *scene, Sequence * seq, int lock_range)
|
||||
}
|
||||
seq->strip->len = seq->len;
|
||||
case SEQ_SOUND:
|
||||
#ifdef WITH_AUDASPACE
|
||||
if(!seq->sound)
|
||||
return;
|
||||
seq->len = ceil(AUD_getInfo(seq->sound->playback_handle).length * FPS);
|
||||
@ -706,6 +710,9 @@ void reload_sequence_new_file(Scene *scene, Sequence * seq, int lock_range)
|
||||
seq->len = 0;
|
||||
}
|
||||
seq->strip->len = seq->len;
|
||||
#else
|
||||
return;
|
||||
#endif
|
||||
break;
|
||||
case SEQ_SCENE:
|
||||
{
|
||||
@ -3493,6 +3500,7 @@ Sequence *sequencer_add_image_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo
|
||||
return seq;
|
||||
}
|
||||
|
||||
#ifdef WITH_AUDASPACE
|
||||
Sequence *sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo *seq_load)
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C); /* only for sound */
|
||||
@ -3550,6 +3558,15 @@ Sequence *sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo
|
||||
|
||||
return seq;
|
||||
}
|
||||
#else // WITH_AUDASPACE
|
||||
Sequence *sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo *seq_load)
|
||||
{
|
||||
(void)C;
|
||||
(void)seqbasep;
|
||||
(void)seq_load;
|
||||
return NULL;
|
||||
}
|
||||
#endif // WITH_AUDASPACE
|
||||
|
||||
Sequence *sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo *seq_load)
|
||||
{
|
||||
|
@ -21,7 +21,9 @@
|
||||
#include "DNA_screen_types.h"
|
||||
#include "DNA_sound_types.h"
|
||||
|
||||
#include "AUD_C-API.h"
|
||||
#ifdef WITH_AUDASPACE
|
||||
# include "AUD_C-API.h"
|
||||
#endif
|
||||
|
||||
#include "BKE_utildefines.h"
|
||||
#include "BKE_global.h"
|
||||
@ -36,6 +38,62 @@
|
||||
|
||||
static int force_device = -1;
|
||||
|
||||
|
||||
struct bSound* sound_new_file(struct Main *bmain, const char *filename)
|
||||
{
|
||||
bSound* sound = NULL;
|
||||
|
||||
char str[FILE_MAX];
|
||||
char *path;
|
||||
|
||||
int len;
|
||||
|
||||
strcpy(str, filename);
|
||||
|
||||
path = /*bmain ? bmain->name :*/ G.main->name;
|
||||
|
||||
BLI_path_abs(str, path);
|
||||
|
||||
len = strlen(filename);
|
||||
while(len > 0 && filename[len-1] != '/' && filename[len-1] != '\\')
|
||||
len--;
|
||||
|
||||
sound = alloc_libblock(&bmain->sound, ID_SO, filename+len);
|
||||
BLI_strncpy(sound->name, filename, FILE_MAX);
|
||||
// XXX unused currently sound->type = SOUND_TYPE_FILE;
|
||||
|
||||
sound_load(bmain, sound);
|
||||
|
||||
if(!sound->playback_handle)
|
||||
{
|
||||
free_libblock(&bmain->sound, sound);
|
||||
sound = NULL;
|
||||
}
|
||||
|
||||
return sound;
|
||||
}
|
||||
|
||||
void sound_free(struct bSound* sound)
|
||||
{
|
||||
if (sound->packedfile)
|
||||
{
|
||||
freePackedFile(sound->packedfile);
|
||||
sound->packedfile = NULL;
|
||||
}
|
||||
|
||||
#ifdef WITH_AUDASPACE
|
||||
if(sound->handle)
|
||||
{
|
||||
AUD_unload(sound->handle);
|
||||
sound->handle = NULL;
|
||||
sound->playback_handle = NULL;
|
||||
}
|
||||
#endif // WITH_AUDASPACE
|
||||
}
|
||||
|
||||
|
||||
#ifdef WITH_AUDASPACE
|
||||
|
||||
#ifdef WITH_JACK
|
||||
static void sound_sync_callback(void* data, int mode, float time)
|
||||
{
|
||||
@ -123,40 +181,6 @@ void sound_exit(void)
|
||||
AUD_exit();
|
||||
}
|
||||
|
||||
struct bSound* sound_new_file(struct Main *bmain, const char *filename)
|
||||
{
|
||||
bSound* sound = NULL;
|
||||
|
||||
char str[FILE_MAX];
|
||||
char *path;
|
||||
|
||||
int len;
|
||||
|
||||
strcpy(str, filename);
|
||||
|
||||
path = /*bmain ? bmain->name :*/ G.main->name;
|
||||
|
||||
BLI_path_abs(str, path);
|
||||
|
||||
len = strlen(filename);
|
||||
while(len > 0 && filename[len-1] != '/' && filename[len-1] != '\\')
|
||||
len--;
|
||||
|
||||
sound = alloc_libblock(&bmain->sound, ID_SO, filename+len);
|
||||
BLI_strncpy(sound->name, filename, FILE_MAX);
|
||||
// XXX unused currently sound->type = SOUND_TYPE_FILE;
|
||||
|
||||
sound_load(bmain, sound);
|
||||
|
||||
if(!sound->playback_handle)
|
||||
{
|
||||
free_libblock(&bmain->sound, sound);
|
||||
sound = NULL;
|
||||
}
|
||||
|
||||
return sound;
|
||||
}
|
||||
|
||||
// XXX unused currently
|
||||
#if 0
|
||||
struct bSound* sound_new_buffer(struct bContext *C, struct bSound *source)
|
||||
@ -301,22 +325,6 @@ void sound_load(struct Main *bmain, struct bSound* sound)
|
||||
}
|
||||
}
|
||||
|
||||
void sound_free(struct bSound* sound)
|
||||
{
|
||||
if (sound->packedfile)
|
||||
{
|
||||
freePackedFile(sound->packedfile);
|
||||
sound->packedfile = NULL;
|
||||
}
|
||||
|
||||
if(sound->handle)
|
||||
{
|
||||
AUD_unload(sound->handle);
|
||||
sound->handle = NULL;
|
||||
sound->playback_handle = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static float sound_get_volume(Scene* scene, Sequence* sequence, float time)
|
||||
{
|
||||
AnimData *adt= BKE_animdata_from_id(&scene->id);
|
||||
@ -490,8 +498,9 @@ int sound_scene_playing(struct Scene *scene)
|
||||
int sound_read_sound_buffer(struct bSound* sound, float* buffer, int length, float start, float end)
|
||||
{
|
||||
AUD_Sound* limiter = AUD_limitSound(sound->cache, start, end);
|
||||
return AUD_readSound(limiter, buffer, length);
|
||||
int ret= AUD_readSound(limiter, buffer, length);
|
||||
AUD_unload(limiter);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int sound_get_channels(struct bSound* sound)
|
||||
@ -502,3 +511,34 @@ int sound_get_channels(struct bSound* sound)
|
||||
|
||||
return info.specs.channels;
|
||||
}
|
||||
|
||||
#else // WITH_AUDASPACE
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
int sound_define_from_str(const char *UNUSED(str)) { return -1;}
|
||||
void sound_force_device(int UNUSED(device)) {}
|
||||
void sound_init_once(void) {}
|
||||
void sound_init(struct Main *UNUSED(bmain)) {}
|
||||
void sound_exit(void) {}
|
||||
void sound_cache(struct bSound* UNUSED(sound), int UNUSED(ignore)) { }
|
||||
void sound_delete_cache(struct bSound* UNUSED(sound)) {}
|
||||
void sound_load(struct Main *UNUSED(bmain), struct bSound* UNUSED(sound)) {}
|
||||
void sound_create_scene(struct Scene *UNUSED(scene)) {}
|
||||
void sound_destroy_scene(struct Scene *UNUSED(scene)) {}
|
||||
void sound_mute_scene(struct Scene *UNUSED(scene), int UNUSED(muted)) {}
|
||||
void* sound_scene_add_scene_sound(struct Scene *UNUSED(scene), struct Sequence* UNUSED(sequence), int UNUSED(startframe), int UNUSED(endframe), int UNUSED(frameskip)) { return NULL; }
|
||||
void* sound_add_scene_sound(struct Scene *UNUSED(scene), struct Sequence* UNUSED(sequence), int UNUSED(startframe), int UNUSED(endframe), int UNUSED(frameskip)) { return NULL; }
|
||||
void sound_remove_scene_sound(struct Scene *UNUSED(scene), void* UNUSED(handle)) {}
|
||||
void sound_mute_scene_sound(struct Scene *UNUSED(scene), void* UNUSED(handle), char UNUSED(mute)) {}
|
||||
void sound_move_scene_sound(struct Scene *UNUSED(scene), void* UNUSED(handle), int UNUSED(startframe), int UNUSED(endframe), int UNUSED(frameskip)) {}
|
||||
static void sound_start_play_scene(struct Scene *UNUSED(scene)) {}
|
||||
void sound_play_scene(struct Scene *UNUSED(scene)) {}
|
||||
void sound_stop_scene(struct Scene *UNUSED(scene)) {}
|
||||
void sound_seek_scene(struct bContext *UNUSED(C)) {}
|
||||
float sound_sync_scene(struct Scene *UNUSED(scene)) { return 0.0f; }
|
||||
int sound_scene_playing(struct Scene *UNUSED(scene)) { return 0; }
|
||||
int sound_read_sound_buffer(struct bSound* UNUSED(sound), float* UNUSED(buffer), int UNUSED(length), float UNUSED(start), float UNUSED(end)) { return 0; }
|
||||
int sound_get_channels(struct bSound* UNUSED(sound)) { return 1; }
|
||||
|
||||
#endif // WITH_AUDASPACE
|
||||
|
@ -49,7 +49,9 @@
|
||||
|
||||
#include "BLI_blenlib.h"
|
||||
|
||||
#include "AUD_C-API.h" /* must be before BKE_sound.h for define */
|
||||
#ifdef WITH_AUDASPACE
|
||||
# include "AUD_C-API.h"
|
||||
#endif
|
||||
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_idprop.h"
|
||||
@ -89,7 +91,9 @@ static uint8_t* audio_output_buffer = 0;
|
||||
static int audio_outbuf_size = 0;
|
||||
static double audio_time = 0.0f;
|
||||
|
||||
#ifdef WITH_AUDASPACE
|
||||
static AUD_Device* audio_mixdown_device = 0;
|
||||
#endif
|
||||
|
||||
#define FFMPEG_AUTOSPLIT_SIZE 2000000000
|
||||
|
||||
@ -103,6 +107,7 @@ static void delete_picture(AVFrame* f)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef WITH_AUDASPACE
|
||||
static int write_audio_frame(void)
|
||||
{
|
||||
AVCodecContext* c = NULL;
|
||||
@ -145,6 +150,7 @@ static int write_audio_frame(void)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif // #ifdef WITH_AUDASPACE
|
||||
|
||||
/* Allocate a temporary frame */
|
||||
static AVFrame* alloc_picture(int pix_fmt, int width, int height)
|
||||
@ -851,7 +857,7 @@ int start_ffmpeg(struct Scene *scene, RenderData *rd, int rectx, int recty, Repo
|
||||
ffmpeg_autosplit_count = 0;
|
||||
|
||||
success = start_ffmpeg_impl(rd, rectx, recty, reports);
|
||||
|
||||
#ifdef WITH_AUDASPACE
|
||||
if(audio_stream)
|
||||
{
|
||||
AVCodecContext* c = audio_stream->codec;
|
||||
@ -861,12 +867,13 @@ int start_ffmpeg(struct Scene *scene, RenderData *rd, int rectx, int recty, Repo
|
||||
specs.rate = rd->ffcodecdata.audio_mixrate;
|
||||
audio_mixdown_device = sound_mixdown(scene, specs, rd->sfra, rd->ffcodecdata.audio_volume);
|
||||
}
|
||||
|
||||
#endif
|
||||
return success;
|
||||
}
|
||||
|
||||
void end_ffmpeg(void);
|
||||
|
||||
#ifdef WITH_AUDASPACE
|
||||
static void write_audio_frames(double to_pts)
|
||||
{
|
||||
int finished = 0;
|
||||
@ -878,6 +885,7 @@ static void write_audio_frames(double to_pts)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
int append_ffmpeg(RenderData *rd, int frame, int *pixels, int rectx, int recty, ReportList *reports)
|
||||
{
|
||||
@ -905,8 +913,9 @@ int append_ffmpeg(RenderData *rd, int frame, int *pixels, int rectx, int recty,
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef WITH_AUDASPACE
|
||||
write_audio_frames((frame - rd->sfra) / (((double)rd->frs_sec) / rd->frs_sec_base));
|
||||
|
||||
#endif
|
||||
return success;
|
||||
}
|
||||
|
||||
@ -920,12 +929,14 @@ void end_ffmpeg(void)
|
||||
write_audio_frames();
|
||||
}*/
|
||||
|
||||
#ifdef WITH_AUDASPACE
|
||||
if(audio_mixdown_device)
|
||||
{
|
||||
AUD_closeReadDevice(audio_mixdown_device);
|
||||
audio_mixdown_device = 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
if (video_stream && video_stream->codec) {
|
||||
fprintf(stderr, "Flushing delayed frames...\n");
|
||||
flush_ffmpeg ();
|
||||
|
72
source/blender/blenlib/BLI_callbacks.h
Normal file
72
source/blender/blenlib/BLI_callbacks.h
Normal file
@ -0,0 +1,72 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): mar 2001 Nzc
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
/** \file blender/blenlib/BLI_callbacks.h
|
||||
* \ingroup bli
|
||||
*/
|
||||
|
||||
|
||||
#ifndef BLI_CALLBACKS_H
|
||||
#define BLI_CALLBACKS_H
|
||||
|
||||
struct bContext;
|
||||
struct Main;
|
||||
struct ID;
|
||||
|
||||
typedef enum {
|
||||
BLI_CB_EVT_RENDER_PRE,
|
||||
BLI_CB_EVT_RENDER_POST,
|
||||
BLI_CB_EVT_LOAD_PRE,
|
||||
BLI_CB_EVT_LOAD_POST,
|
||||
BLI_CB_EVT_SAVE_PRE,
|
||||
BLI_CB_EVT_SAVE_POST,
|
||||
BLI_CB_EVT_TOT
|
||||
} eCbEvent;
|
||||
|
||||
|
||||
typedef struct {
|
||||
struct bCallbackFuncStore *next, *prev;
|
||||
void (* func)(struct Main *, struct ID *, void *arg);
|
||||
void *arg;
|
||||
short alloc;
|
||||
} bCallbackFuncStore;
|
||||
|
||||
|
||||
void BLI_exec_cb(struct Main *main, struct ID *self, eCbEvent evt);
|
||||
void BLI_add_cb(bCallbackFuncStore *funcstore, eCbEvent evt);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
void BLI_cb_init(void);
|
||||
void BLI_cb_finalize(void);
|
||||
|
||||
|
||||
/* This is blenlib internal only, unrelated to above */
|
||||
void callLocalErrorCallBack(const char* msg);
|
@ -70,6 +70,7 @@ unsigned int rgb_to_cpack(float r, float g, float b);
|
||||
unsigned int hsv_to_cpack(float h, float s, float v);
|
||||
|
||||
float rgb_to_grayscale(float rgb[3]);
|
||||
unsigned char rgb_to_grayscale_byte(unsigned char rgb[3]);
|
||||
|
||||
/***************** Profile Transformations ********************/
|
||||
|
||||
|
@ -66,6 +66,9 @@ float closest_to_line_v3(float r[3], const float p[3], const float l1[3], const
|
||||
float closest_to_line_v2(float r[2], const float p[2], const float l1[2], const float l2[2]);
|
||||
void closest_to_line_segment_v3(float r[3], const float p[3], const float l1[3], const float l2[3]);
|
||||
|
||||
float line_point_factor_v3(const float p[3], const float l1[3], const float l2[3]);
|
||||
float line_point_factor_v2(const float p[2], const float l1[2], const float l2[2]);
|
||||
|
||||
/******************************* Intersection ********************************/
|
||||
|
||||
/* TODO int return value consistency */
|
||||
@ -78,6 +81,8 @@ void closest_to_line_segment_v3(float r[3], const float p[3], const float l1[3],
|
||||
|
||||
int isect_line_line_v2(const float a1[2], const float a2[2], const float b1[2], const float b2[2]);
|
||||
int isect_line_line_v2_int(const int a1[2], const int a2[2], const int b1[2], const int b2[2]);
|
||||
int isect_line_sphere_v3(const float l1[3], const float l2[3], const float sp[3], const float r, float r_p1[3], float r_p2[3]);
|
||||
int isect_line_sphere_v2(const float l1[2], const float l2[2], const float sp[2], const float r, float r_p1[2], float r_p2[2]);
|
||||
int isect_seg_seg_v2_point(const float v1[2], const float v2[2], const float v3[2], const float v4[2], float vi[2]);
|
||||
|
||||
/* Returns the number of point of interests
|
||||
|
@ -52,6 +52,7 @@ set(SRC
|
||||
intern/DLRB_tree.c
|
||||
intern/boxpack2d.c
|
||||
intern/bpath.c
|
||||
intern/callbacks.c
|
||||
intern/cpu.c
|
||||
intern/dynlib.c
|
||||
intern/edgehash.c
|
||||
@ -89,6 +90,7 @@ set(SRC
|
||||
BLI_blenlib.h
|
||||
BLI_boxpack2d.h
|
||||
BLI_bpath.h
|
||||
BLI_callbacks.h
|
||||
BLI_cpu.h
|
||||
BLI_dlrbTree.h
|
||||
BLI_dynlib.h
|
||||
@ -132,7 +134,6 @@ set(SRC
|
||||
BLI_voxel.h
|
||||
BLI_winstuff.h
|
||||
PIL_time.h
|
||||
intern/BLI_callbacks.h
|
||||
intern/dynamiclist.h
|
||||
)
|
||||
|
||||
|
70
source/blender/blenlib/intern/callbacks.c
Normal file
70
source/blender/blenlib/intern/callbacks.c
Normal file
@ -0,0 +1,70 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor(s): Blender Foundation (2011)
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
#include "BLI_listbase.h"
|
||||
#include "BLI_callbacks.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
static ListBase callback_slots[BLI_CB_EVT_TOT]= {{0}};
|
||||
|
||||
void BLI_exec_cb(struct Main *main, struct ID *self, eCbEvent evt)
|
||||
{
|
||||
ListBase *lb= &callback_slots[evt];
|
||||
bCallbackFuncStore *funcstore;
|
||||
|
||||
for(funcstore= (bCallbackFuncStore *)lb->first; funcstore; funcstore= (bCallbackFuncStore *)funcstore->next) {
|
||||
funcstore->func(main, self, funcstore->arg);
|
||||
}
|
||||
}
|
||||
|
||||
void BLI_add_cb(bCallbackFuncStore *funcstore, eCbEvent evt)
|
||||
{
|
||||
ListBase *lb= &callback_slots[evt];
|
||||
BLI_addtail(lb, funcstore);
|
||||
}
|
||||
|
||||
void BLI_cb_init(void)
|
||||
{
|
||||
/* do nothing */
|
||||
}
|
||||
|
||||
/* call on application exit */
|
||||
void BLI_cb_finalize(void)
|
||||
{
|
||||
eCbEvent evt;
|
||||
for(evt= 0; evt < BLI_CB_EVT_TOT; evt++) {
|
||||
ListBase *lb= &callback_slots[evt];
|
||||
bCallbackFuncStore *funcstore;
|
||||
bCallbackFuncStore *funcstore_next;
|
||||
for(funcstore= (bCallbackFuncStore *)lb->first; funcstore; funcstore= funcstore_next) {
|
||||
funcstore_next= (bCallbackFuncStore *)funcstore->next;
|
||||
BLI_remlink(lb, funcstore);
|
||||
if(funcstore->alloc) {
|
||||
MEM_freeN(funcstore);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -488,6 +488,11 @@ float rgb_to_grayscale(float rgb[3])
|
||||
return 0.3f*rgb[0] + 0.58f*rgb[1] + 0.12f*rgb[2];
|
||||
}
|
||||
|
||||
unsigned char rgb_to_grayscale_byte(unsigned char rgb[3])
|
||||
{
|
||||
return (76*(unsigned short)rgb[0] + 148*(unsigned short)rgb[1] + 31*(unsigned short)rgb[2]) / 255;
|
||||
}
|
||||
|
||||
/* ********************************* lift/gamma/gain / ASC-CDL conversion ********************************* */
|
||||
|
||||
void lift_gamma_gain_to_asc_cdl(float *lift, float *gamma, float *gain, float *offset, float *slope, float *power)
|
||||
|
@ -37,8 +37,6 @@
|
||||
#include "BLI_memarena.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
static float lambda_cp_line(const float p[3], const float l1[3], const float l2[3]);
|
||||
|
||||
/********************************** Polygons *********************************/
|
||||
|
||||
void cent_tri_v3(float cent[3], const float v1[3], const float v2[3], const float v3[3])
|
||||
@ -349,6 +347,133 @@ int isect_seg_seg_v2_point(const float v1[2], const float v2[2], const float v3[
|
||||
return -1;
|
||||
}
|
||||
|
||||
int isect_line_sphere_v3(const float l1[3], const float l2[3],
|
||||
const float sp[3], const float r,
|
||||
float r_p1[3], float r_p2[3])
|
||||
{
|
||||
/* l1: coordinates (point of line)
|
||||
* l2: coordinates (point of line)
|
||||
* sp, r: coordinates and radius (sphere)
|
||||
* r_p1, r_p2: return intersection coordinates
|
||||
*/
|
||||
|
||||
|
||||
/* adapted for use in blender by Campbell Barton - 2011
|
||||
*
|
||||
* atelier iebele abel - 2001
|
||||
* atelier@iebele.nl
|
||||
* http://www.iebele.nl
|
||||
*
|
||||
* sphere_line_intersection function adapted from:
|
||||
* http://astronomy.swin.edu.au/pbourke/geometry/sphereline
|
||||
* Paul Bourke pbourke@swin.edu.au
|
||||
*/
|
||||
|
||||
const float ldir[3]= {
|
||||
l2[0] - l1[0],
|
||||
l2[1] - l1[1],
|
||||
l2[2] - l1[2]
|
||||
};
|
||||
|
||||
const float a= dot_v3v3(ldir, ldir);
|
||||
|
||||
const float b= 2.0f *
|
||||
(ldir[0] * (l1[0] - sp[0]) +
|
||||
ldir[1] * (l1[1] - sp[1]) +
|
||||
ldir[2] * (l1[2] - sp[2]));
|
||||
|
||||
const float c=
|
||||
dot_v3v3(sp, sp) +
|
||||
dot_v3v3(l1, l1) -
|
||||
(2.0f * dot_v3v3(sp, l1)) -
|
||||
(r * r);
|
||||
|
||||
const float i = b * b - 4.0f * a * c;
|
||||
|
||||
float mu;
|
||||
|
||||
if (i < 0.0f) {
|
||||
/* no intersections */
|
||||
return 0;
|
||||
}
|
||||
else if (i == 0.0f) {
|
||||
/* one intersection */
|
||||
mu = -b / (2.0f * a);
|
||||
madd_v3_v3v3fl(r_p1, l1, ldir, mu);
|
||||
return 1;
|
||||
}
|
||||
else if (i > 0.0) {
|
||||
const float i_sqrt= sqrt(i); /* avoid calc twice */
|
||||
|
||||
/* first intersection */
|
||||
mu = (-b + i_sqrt) / (2.0f * a);
|
||||
madd_v3_v3v3fl(r_p1, l1, ldir, mu);
|
||||
|
||||
/* second intersection */
|
||||
mu = (-b - i_sqrt) / (2.0f * a);
|
||||
madd_v3_v3v3fl(r_p2, l1, ldir, mu);
|
||||
return 2;
|
||||
}
|
||||
else {
|
||||
/* math domain error - nan */
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* keep in sync with isect_line_sphere_v3 */
|
||||
int isect_line_sphere_v2(const float l1[2], const float l2[2],
|
||||
const float sp[2], const float r,
|
||||
float r_p1[2], float r_p2[2])
|
||||
{
|
||||
const float ldir[2]= {
|
||||
l2[0] - l1[0],
|
||||
l2[1] - l1[1]
|
||||
};
|
||||
|
||||
const float a= dot_v3v3(ldir, ldir);
|
||||
|
||||
const float b= 2.0f *
|
||||
(ldir[0] * (l1[0] - sp[0]) +
|
||||
ldir[1] * (l1[1] - sp[1]));
|
||||
|
||||
const float c=
|
||||
dot_v2v2(sp, sp) +
|
||||
dot_v2v2(l1, l1) -
|
||||
(2.0f * dot_v2v2(sp, l1)) -
|
||||
(r * r);
|
||||
|
||||
const float i = b * b - 4.0f * a * c;
|
||||
|
||||
float mu;
|
||||
|
||||
if (i < 0.0f) {
|
||||
/* no intersections */
|
||||
return 0;
|
||||
}
|
||||
else if (i == 0.0f) {
|
||||
/* one intersection */
|
||||
mu = -b / (2.0f * a);
|
||||
madd_v2_v2v2fl(r_p1, l1, ldir, mu);
|
||||
return 1;
|
||||
}
|
||||
else if (i > 0.0) {
|
||||
const float i_sqrt= sqrt(i); /* avoid calc twice */
|
||||
|
||||
/* first intersection */
|
||||
mu = (-b + i_sqrt) / (2.0f * a);
|
||||
madd_v2_v2v2fl(r_p1, l1, ldir, mu);
|
||||
|
||||
/* second intersection */
|
||||
mu = (-b - i_sqrt) / (2.0f * a);
|
||||
madd_v2_v2v2fl(r_p2, l1, ldir, mu);
|
||||
return 2;
|
||||
}
|
||||
else {
|
||||
/* math domain error - nan */
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
-1: colliniar
|
||||
1: intersection
|
||||
@ -668,7 +793,7 @@ int isect_line_plane_v3(float out[3], const float l1[3], const float l2[3], cons
|
||||
|
||||
add_v3_v3v3(l1_plane, l1, p_no);
|
||||
|
||||
dist = lambda_cp_line(plane_co, l1, l1_plane);
|
||||
dist = line_point_factor_v3(plane_co, l1, l1_plane);
|
||||
|
||||
/* treat line like a ray, when 'no_flip' is set */
|
||||
if(no_flip && dist < 0.0f) {
|
||||
@ -1118,7 +1243,7 @@ float closest_to_line_v2(float cp[2],const float p[2], const float l1[2], const
|
||||
}
|
||||
|
||||
/* little sister we only need to know lambda */
|
||||
static float lambda_cp_line(const float p[3], const float l1[3], const float l2[3])
|
||||
float line_point_factor_v3(const float p[3], const float l1[3], const float l2[3])
|
||||
{
|
||||
float h[3],u[3];
|
||||
sub_v3_v3v3(u, l2, l1);
|
||||
@ -1126,6 +1251,14 @@ static float lambda_cp_line(const float p[3], const float l1[3], const float l2[
|
||||
return(dot_v3v3(u,h)/dot_v3v3(u,u));
|
||||
}
|
||||
|
||||
float line_point_factor_v2(const float p[2], const float l1[2], const float l2[2])
|
||||
{
|
||||
float h[2], u[2];
|
||||
sub_v2_v2v2(u, l2, l1);
|
||||
sub_v2_v2v2(h, p, l1);
|
||||
return(dot_v2v2(u, h)/dot_v2v2(u, u));
|
||||
}
|
||||
|
||||
/* Similar to LineIntersectsTriangleUV, except it operates on a quad and in 2d, assumes point is in quad */
|
||||
void isect_point_quad_uv_v2(const float v0[2], const float v1[2], const float v2[2], const float v3[2], const float pt[2], float *uv)
|
||||
{
|
||||
|
@ -3580,6 +3580,18 @@ static void direct_link_mesh(FileData *fd, Mesh *mesh)
|
||||
mesh->mr->edge_creases= newdataadr(fd, mesh->mr->edge_creases);
|
||||
|
||||
mesh->mr->verts = newdataadr(fd, mesh->mr->verts);
|
||||
|
||||
/* If mesh has the same number of vertices as the
|
||||
highest multires level, load the current mesh verts
|
||||
into multires and discard the old data. Needed
|
||||
because some saved files either do not have a verts
|
||||
array, or the verts array contains out-of-date
|
||||
data. */
|
||||
if(mesh->totvert == ((MultiresLevel*)mesh->mr->levels.last)->totvert) {
|
||||
if(mesh->mr->verts)
|
||||
MEM_freeN(mesh->mr->verts);
|
||||
mesh->mr->verts = MEM_dupallocN(mesh->mvert);
|
||||
}
|
||||
|
||||
for(; lvl; lvl= lvl->next) {
|
||||
lvl->verts= newdataadr(fd, lvl->verts);
|
||||
@ -3589,16 +3601,11 @@ static void direct_link_mesh(FileData *fd, Mesh *mesh)
|
||||
}
|
||||
}
|
||||
|
||||
/* Gracefully handle corrupted mesh */
|
||||
/* if multires is present but has no valid vertex data,
|
||||
there's no way to recover it; silently remove multires */
|
||||
if(mesh->mr && !mesh->mr->verts) {
|
||||
/* If totals match, simply load the current mesh verts into multires */
|
||||
if(mesh->totvert == ((MultiresLevel*)mesh->mr->levels.last)->totvert)
|
||||
mesh->mr->verts = MEM_dupallocN(mesh->mvert);
|
||||
else {
|
||||
/* Otherwise, we can't recover the data, silently remove multires */
|
||||
multires_free(mesh->mr);
|
||||
mesh->mr = NULL;
|
||||
}
|
||||
multires_free(mesh->mr);
|
||||
mesh->mr = NULL;
|
||||
}
|
||||
|
||||
if((fd->flags & FD_FLAGS_SWITCH_ENDIAN) && mesh->tface) {
|
||||
@ -11706,9 +11713,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
|
||||
}
|
||||
}
|
||||
|
||||
/* put compatibility code here until next subversion bump */
|
||||
|
||||
{
|
||||
if (main->versionfile < 258 || (main->versionfile == 258 && main->subversionfile < 1)){
|
||||
/* screen view2d settings were not properly initialized [#27164]
|
||||
* v2d->scroll caused the bug but best reset other values too which are in old blend files only.
|
||||
* need to make less ugly - possibly an iterator? */
|
||||
@ -11775,6 +11780,20 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
ParticleSettings *part;
|
||||
for(part = main->particle.first; part; part = part->id.next) {
|
||||
/* Initialize particle billboard scale */
|
||||
part->bb_size[0] = part->bb_size[1] = 1.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* put compatibility code here until next subversion bump */
|
||||
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
|
||||
@ -11858,7 +11877,8 @@ static BHead *read_userdef(BlendFileData *bfd, FileData *fd, BHead *bhead)
|
||||
|
||||
// XXX
|
||||
user->uifonts.first= user->uifonts.last= NULL;
|
||||
user->uistyles.first= user->uistyles.last= NULL;
|
||||
|
||||
link_list(fd, &user->uistyles);
|
||||
|
||||
/* free fd->datamap again */
|
||||
oldnewmap_free_unused(fd->datamap);
|
||||
|
@ -724,7 +724,8 @@ static void write_userdef(WriteData *wd)
|
||||
wmKeyMap *keymap;
|
||||
wmKeyMapItem *kmi;
|
||||
bAddon *bext;
|
||||
|
||||
uiStyle *style;
|
||||
|
||||
writestruct(wd, USER, "UserDef", 1, &U);
|
||||
|
||||
for(btheme= U.themes.first; btheme; btheme=btheme->next)
|
||||
@ -743,6 +744,10 @@ static void write_userdef(WriteData *wd)
|
||||
|
||||
for(bext= U.addons.first; bext; bext=bext->next)
|
||||
writestruct(wd, DATA, "bAddon", 1, bext);
|
||||
|
||||
for(style= U.uistyles.first; style; style= style->next) {
|
||||
writestruct(wd, DATA, "uiStyle", 1, style);
|
||||
}
|
||||
}
|
||||
|
||||
static void write_boid_state(WriteData *wd, BoidState *state)
|
||||
|
@ -79,8 +79,6 @@ void ARMATURE_OT_separate(struct wmOperatorType *ot);
|
||||
void ARMATURE_OT_autoside_names(struct wmOperatorType *ot);
|
||||
void ARMATURE_OT_flip_names(struct wmOperatorType *ot);
|
||||
|
||||
void ARMATURE_OT_flags_set(struct wmOperatorType *ot);
|
||||
|
||||
void ARMATURE_OT_layers_show_all(struct wmOperatorType *ot);
|
||||
void ARMATURE_OT_armature_layers(struct wmOperatorType *ot);
|
||||
void ARMATURE_OT_bone_layers(struct wmOperatorType *ot);
|
||||
@ -125,8 +123,6 @@ void POSE_OT_flip_names(struct wmOperatorType *ot);
|
||||
|
||||
void POSE_OT_quaternions_flip(struct wmOperatorType *ot);
|
||||
|
||||
void POSE_OT_flags_set(struct wmOperatorType *ot);
|
||||
|
||||
void POSE_OT_armature_layers(struct wmOperatorType *ot);
|
||||
void POSE_OT_bone_layers(struct wmOperatorType *ot);
|
||||
|
||||
|
@ -85,8 +85,6 @@ void ED_operatortypes_armature(void)
|
||||
WM_operatortype_append(ARMATURE_OT_autoside_names);
|
||||
WM_operatortype_append(ARMATURE_OT_flip_names);
|
||||
|
||||
WM_operatortype_append(ARMATURE_OT_flags_set);
|
||||
|
||||
WM_operatortype_append(ARMATURE_OT_layers_show_all);
|
||||
WM_operatortype_append(ARMATURE_OT_armature_layers);
|
||||
WM_operatortype_append(ARMATURE_OT_bone_layers);
|
||||
@ -141,8 +139,6 @@ void ED_operatortypes_armature(void)
|
||||
|
||||
WM_operatortype_append(POSE_OT_quaternions_flip);
|
||||
|
||||
WM_operatortype_append(POSE_OT_flags_set);
|
||||
|
||||
WM_operatortype_append(POSE_OT_armature_layers);
|
||||
WM_operatortype_append(POSE_OT_bone_layers);
|
||||
|
||||
@ -268,12 +264,9 @@ void ED_keymap_armature(wmKeyConfig *keyconf)
|
||||
WM_keymap_add_item(keymap, "ARMATURE_OT_separate", PKEY, KM_PRESS, KM_CTRL|KM_ALT, 0);
|
||||
|
||||
/* set flags */
|
||||
kmi= WM_keymap_add_item(keymap, "ARMATURE_OT_flags_set", WKEY, KM_PRESS, KM_SHIFT, 0);
|
||||
RNA_enum_set(kmi->ptr, "mode", 2); // toggle
|
||||
kmi= WM_keymap_add_item(keymap, "ARMATURE_OT_flags_set", WKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
|
||||
RNA_enum_set(kmi->ptr, "mode", 1); // enable
|
||||
kmi= WM_keymap_add_item(keymap, "ARMATURE_OT_flags_set", WKEY, KM_PRESS, KM_ALT, 0);
|
||||
RNA_enum_set(kmi->ptr, "mode", 0); // clear
|
||||
WM_keymap_add_menu(keymap, "VIEW3D_MT_bone_options_toggle", WKEY, KM_PRESS, KM_SHIFT, 0);
|
||||
WM_keymap_add_menu(keymap, "VIEW3D_MT_bone_options_enable", WKEY, KM_PRESS, KM_CTRL, 0);
|
||||
WM_keymap_add_menu(keymap, "VIEW3D_MT_bone_options_disable", WKEY, KM_PRESS, KM_ALT, 0);
|
||||
|
||||
/* armature/bone layers */
|
||||
WM_keymap_add_item(keymap, "ARMATURE_OT_layers_show_all", ACCENTGRAVEKEY, KM_PRESS, KM_CTRL, 0);
|
||||
@ -349,13 +342,10 @@ void ED_keymap_armature(wmKeyConfig *keyconf)
|
||||
WM_keymap_add_menu(keymap, "VIEW3D_MT_pose_group", GKEY, KM_PRESS, KM_CTRL, 0);
|
||||
|
||||
/* set flags */
|
||||
kmi= WM_keymap_add_item(keymap, "POSE_OT_flags_set", WKEY, KM_PRESS, KM_SHIFT, 0);
|
||||
RNA_enum_set(kmi->ptr, "mode", 2); // toggle
|
||||
kmi= WM_keymap_add_item(keymap, "POSE_OT_flags_set", WKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
|
||||
RNA_enum_set(kmi->ptr, "mode", 1); // enable
|
||||
kmi= WM_keymap_add_item(keymap, "POSE_OT_flags_set", WKEY, KM_PRESS, KM_ALT, 0);
|
||||
RNA_enum_set(kmi->ptr, "mode", 0); // clear
|
||||
|
||||
WM_keymap_add_menu(keymap, "VIEW3D_MT_bone_options_toggle", WKEY, KM_PRESS, KM_SHIFT, 0);
|
||||
WM_keymap_add_menu(keymap, "VIEW3D_MT_bone_options_enable", WKEY, KM_PRESS, KM_CTRL, 0);
|
||||
WM_keymap_add_menu(keymap, "VIEW3D_MT_bone_options_disable", WKEY, KM_PRESS, KM_ALT, 0);
|
||||
|
||||
/* armature/bone layers */
|
||||
WM_keymap_add_item(keymap, "ARMATURE_OT_layers_show_all", ACCENTGRAVEKEY, KM_PRESS, KM_CTRL, 0);
|
||||
WM_keymap_add_item(keymap, "POSE_OT_armature_layers", MKEY, KM_PRESS, KM_SHIFT, 0);
|
||||
|
@ -1352,30 +1352,6 @@ static void *get_nearest_bone (bContext *C, short findunsel, int x, int y)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* helper for setflag_sel_bone() */
|
||||
static void bone_setflag (int *bone, int flag, short mode)
|
||||
{
|
||||
if (bone && flag) {
|
||||
/* exception for inverse flags */
|
||||
if (flag == BONE_NO_DEFORM) {
|
||||
if (mode == 2)
|
||||
*bone |= flag;
|
||||
else if (mode == 1)
|
||||
*bone &= ~flag;
|
||||
else
|
||||
*bone ^= flag;
|
||||
}
|
||||
else {
|
||||
if (mode == 2)
|
||||
*bone &= ~flag;
|
||||
else if (mode == 1)
|
||||
*bone |= flag;
|
||||
else
|
||||
*bone ^= flag;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Get the first available child of an editbone */
|
||||
static EditBone *editbone_get_child(bArmature *arm, EditBone *pabone, short use_visibility)
|
||||
{
|
||||
@ -1396,105 +1372,6 @@ static EditBone *editbone_get_child(bArmature *arm, EditBone *pabone, short use_
|
||||
return chbone;
|
||||
}
|
||||
|
||||
/* callback for posemode setflag */
|
||||
static int pose_setflag_exec (bContext *C, wmOperator *op)
|
||||
{
|
||||
int flag= RNA_enum_get(op->ptr, "type");
|
||||
int mode= RNA_enum_get(op->ptr, "mode");
|
||||
|
||||
/* loop over all selected pchans */
|
||||
CTX_DATA_BEGIN(C, bPoseChannel *, pchan, selected_pose_bones)
|
||||
{
|
||||
bone_setflag(&pchan->bone->flag, flag, mode);
|
||||
}
|
||||
CTX_DATA_END;
|
||||
|
||||
/* note, notifier might evolve */
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_POSE, ED_object_pose_armature(CTX_data_active_object(C)));
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
/* callback for editbones setflag */
|
||||
static int armature_bones_setflag_exec (bContext *C, wmOperator *op)
|
||||
{
|
||||
int flag= RNA_enum_get(op->ptr, "type");
|
||||
int mode= RNA_enum_get(op->ptr, "mode");
|
||||
|
||||
/* loop over all selected pchans */
|
||||
CTX_DATA_BEGIN(C, EditBone *, ebone, selected_bones)
|
||||
{
|
||||
bone_setflag(&ebone->flag, flag, mode);
|
||||
}
|
||||
CTX_DATA_END;
|
||||
|
||||
/* note, notifier might evolve */
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_POSE, CTX_data_edit_object(C));
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
/* settings that can be changed */
|
||||
static EnumPropertyItem prop_bone_setting_types[] = {
|
||||
{BONE_DRAWWIRE, "DRAWWIRE", 0, "Draw Wire", ""},
|
||||
{BONE_NO_DEFORM, "DEFORM", 0, "Deform", ""},
|
||||
{BONE_MULT_VG_ENV, "MULT_VG", 0, "Multiply Vertex Groups", ""},
|
||||
{BONE_HINGE, "HINGE", 0, "Hinge", ""},
|
||||
{BONE_NO_SCALE, "NO_SCALE", 0, "No Scale", ""},
|
||||
{BONE_EDITMODE_LOCKED, "LOCKED", 0, "Locked", "(For EditMode only)"},
|
||||
{0, NULL, 0, NULL, NULL}
|
||||
};
|
||||
|
||||
/* ways that settings can be changed */
|
||||
static EnumPropertyItem prop_bone_setting_modes[] = {
|
||||
{0, "CLEAR", 0, "Clear", ""},
|
||||
{1, "ENABLE", 0, "Enable", ""},
|
||||
{2, "TOGGLE", 0, "Toggle", ""},
|
||||
{0, NULL, 0, NULL, NULL}
|
||||
};
|
||||
|
||||
|
||||
void ARMATURE_OT_flags_set (wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Set Bone Flags";
|
||||
ot->idname= "ARMATURE_OT_flags_set";
|
||||
ot->description= "Set flags for armature bones";
|
||||
|
||||
/* callbacks */
|
||||
ot->invoke= WM_menu_invoke;
|
||||
ot->exec= armature_bones_setflag_exec;
|
||||
ot->poll= ED_operator_editarmature;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
|
||||
/* properties */
|
||||
ot->prop= RNA_def_enum(ot->srna, "type", prop_bone_setting_types, 0, "Type", "");
|
||||
RNA_def_enum(ot->srna, "mode", prop_bone_setting_modes, 0, "Mode", "");
|
||||
}
|
||||
|
||||
void POSE_OT_flags_set (wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Set Bone Flags";
|
||||
ot->idname= "POSE_OT_flags_set";
|
||||
ot->description= "Set flags for armature bones";
|
||||
|
||||
/* callbacks */
|
||||
ot->invoke= WM_menu_invoke;
|
||||
ot->exec= pose_setflag_exec;
|
||||
ot->poll= ED_operator_posemode;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
|
||||
/* properties */
|
||||
ot->prop= RNA_def_enum(ot->srna, "type", prop_bone_setting_types, 0, "Type", "");
|
||||
RNA_def_enum(ot->srna, "mode", prop_bone_setting_modes, 0, "Mode", "");
|
||||
}
|
||||
|
||||
|
||||
/* **************** END PoseMode & EditMode *************************** */
|
||||
/* **************** Posemode stuff ********************** */
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -83,7 +83,7 @@ static uiStyle *ui_style_new(ListBase *styles, const char *name)
|
||||
BLI_addtail(styles, style);
|
||||
BLI_strncpy(style->name, name, MAX_STYLE_NAME);
|
||||
|
||||
style->panelzoom= 1.0;
|
||||
style->panelzoom= 1.0; /* unused */
|
||||
|
||||
style->paneltitle.uifont_id= UIFONT_DEFAULT;
|
||||
style->paneltitle.points= 12;
|
||||
|
@ -867,7 +867,7 @@ static int similar_face_select_exec(bContext *C, wmOperator *op)
|
||||
Mesh *me= obedit->data;
|
||||
EditMesh *em= BKE_mesh_get_editmesh(me);
|
||||
|
||||
int selcount = similar_face_select__internal(em, RNA_int_get(op->ptr, "type"), RNA_float_get(op->ptr, "threshold"));
|
||||
int selcount = similar_face_select__internal(em, RNA_enum_get(op->ptr, "type"), RNA_float_get(op->ptr, "threshold"));
|
||||
|
||||
if (selcount) {
|
||||
/* here was an edge-mode only select flush case, has to be generalized */
|
||||
|
@ -852,7 +852,6 @@ static void finish_images(MultiresBakeRender *bkr)
|
||||
|
||||
for(link= bkr->image.first; link; link= link->next) {
|
||||
Image *ima= (Image*)link->data;
|
||||
int i;
|
||||
ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
|
||||
|
||||
if(ibuf->x<=0 || ibuf->y<=0)
|
||||
|
@ -220,6 +220,11 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
|
||||
if(oglrender->write_still) {
|
||||
char name[FILE_MAX];
|
||||
int ok;
|
||||
|
||||
if(scene->r.planes == 8) {
|
||||
IMB_color_to_bw(ibuf);
|
||||
}
|
||||
|
||||
BKE_makepicstring(name, scene->r.pic, scene->r.cfra, scene->r.imtype, scene->r.scemode & R_EXTENSION, FALSE);
|
||||
ok= BKE_write_ibuf(ibuf, name, scene->r.imtype, scene->r.subimtype, scene->r.quality); /* no need to stamp here */
|
||||
if(ok) printf("OpenGL Render written to '%s'\n", name);
|
||||
@ -433,6 +438,19 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op)
|
||||
ibuf= BKE_image_acquire_ibuf(oglrender->ima, &oglrender->iuser, &lock);
|
||||
|
||||
if(ibuf) {
|
||||
short ibuf_free= FALSE;
|
||||
|
||||
/* color -> greyscale */
|
||||
/* editing directly would alter the render view */
|
||||
if(scene->r.planes == 8) {
|
||||
ImBuf *ibuf_bw= IMB_dupImBuf(ibuf);
|
||||
IMB_color_to_bw(ibuf_bw);
|
||||
// IMB_freeImBuf(ibuf); /* owned by the image */
|
||||
ibuf= ibuf_bw;
|
||||
|
||||
ibuf_free= TRUE;
|
||||
}
|
||||
|
||||
if(BKE_imtype_is_movie(scene->r.imtype)) {
|
||||
ok= oglrender->mh->append_movie(&scene->r, CFRA, (int*)ibuf->rect, oglrender->sizex, oglrender->sizey, oglrender->reports);
|
||||
if(ok) {
|
||||
@ -453,6 +471,10 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op)
|
||||
BKE_reportf(op->reports, RPT_INFO, "Saved file: %s", name);
|
||||
}
|
||||
}
|
||||
|
||||
if(ibuf_free) {
|
||||
IMB_freeImBuf(ibuf);
|
||||
}
|
||||
}
|
||||
|
||||
BKE_image_release_ibuf(oglrender->ima, lock);
|
||||
|
@ -1174,25 +1174,6 @@ static void project_face_seams_init(const ProjPaintState *ps, const int face_ind
|
||||
#endif // PROJ_DEBUG_NOSEAMBLEED
|
||||
|
||||
|
||||
/* TODO - move to math_geom.c */
|
||||
|
||||
/* little sister we only need to know lambda */
|
||||
#ifndef PROJ_DEBUG_NOSEAMBLEED
|
||||
static float lambda_cp_line2(const float p[2], const float l1[2], const float l2[2])
|
||||
{
|
||||
float h[2], u[2];
|
||||
|
||||
u[0] = l2[0] - l1[0];
|
||||
u[1] = l2[1] - l1[1];
|
||||
|
||||
h[0] = p[0] - l1[0];
|
||||
h[1] = p[1] - l1[1];
|
||||
|
||||
return(dot_v2v2(u, h)/dot_v2v2(u, u));
|
||||
}
|
||||
#endif // PROJ_DEBUG_NOSEAMBLEED
|
||||
|
||||
|
||||
/* Converts a UV location to a 3D screenspace location
|
||||
* Takes a 'uv' and 3 UV coords, and sets the values of pixelScreenCo
|
||||
*
|
||||
@ -2518,9 +2499,9 @@ static void project_paint_face_init(const ProjPaintState *ps, const int thread_i
|
||||
*/
|
||||
|
||||
/* Since this is a seam we need to work out where on the line this pixel is */
|
||||
//fac = lambda_cp_line2(uv, uv_seam_quad[0], uv_seam_quad[1]);
|
||||
//fac = line_point_factor_v2(uv, uv_seam_quad[0], uv_seam_quad[1]);
|
||||
|
||||
fac = lambda_cp_line2(uv, seam_subsection[0], seam_subsection[1]);
|
||||
fac = line_point_factor_v2(uv, seam_subsection[0], seam_subsection[1]);
|
||||
if (fac < 0.0f) { VECCOPY(pixelScreenCo, edge_verts_inset_clip[0]); }
|
||||
else if (fac > 1.0f) { VECCOPY(pixelScreenCo, edge_verts_inset_clip[1]); }
|
||||
else { interp_v3_v3v3(pixelScreenCo, edge_verts_inset_clip[0], edge_verts_inset_clip[1], fac); }
|
||||
|
@ -28,7 +28,6 @@ set(INC
|
||||
../../makesrna
|
||||
../../windowmanager
|
||||
../../../../intern/guardedalloc
|
||||
../../../../intern/audaspace/intern
|
||||
)
|
||||
|
||||
set(INC_SYS
|
||||
@ -41,4 +40,11 @@ set(SRC
|
||||
sound_intern.h
|
||||
)
|
||||
|
||||
if(WITH_AUDASPACE)
|
||||
list(APPEND INC
|
||||
../../../../intern/audaspace/intern
|
||||
)
|
||||
add_definitions(-DWITH_AUDASPACE)
|
||||
endif()
|
||||
|
||||
blender_add_lib(bf_editor_sound "${SRC}" "${INC}" "${INC_SYS}")
|
||||
|
@ -64,7 +64,9 @@
|
||||
#include "WM_api.h"
|
||||
#include "WM_types.h"
|
||||
|
||||
#include "AUD_C-API.h"
|
||||
#ifdef WITH_AUDASPACE
|
||||
# include "AUD_C-API.h"
|
||||
#endif
|
||||
|
||||
#include "ED_sound.h"
|
||||
#include "ED_util.h"
|
||||
@ -81,6 +83,7 @@ static void open_init(bContext *C, wmOperator *op)
|
||||
uiIDContextProperty(C, &pprop->ptr, &pprop->prop);
|
||||
}
|
||||
|
||||
#ifdef WITH_AUDASPACE
|
||||
static int open_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
char path[FILE_MAX];
|
||||
@ -131,6 +134,17 @@ static int open_exec(bContext *C, wmOperator *op)
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
#else //WITH_AUDASPACE
|
||||
|
||||
static int open_exec(bContext *UNUSED(C), wmOperator *op)
|
||||
{
|
||||
BKE_report(op->reports, RPT_ERROR, "Compiled without sound support");
|
||||
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static int open_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
||||
{
|
||||
if(!RNA_property_is_set(op->ptr, "relative_path"))
|
||||
|
@ -1279,7 +1279,7 @@ void FILE_OT_filenum(struct wmOperatorType *ot)
|
||||
ot->poll= ED_operator_file_active; /* <- important, handler is on window level */
|
||||
|
||||
/* props */
|
||||
RNA_def_int(ot->srna, "increment", 1, 0, 100, "Increment", "", 0,100);
|
||||
RNA_def_int(ot->srna, "increment", 1, -100, 100, "Increment", "", -100,100);
|
||||
}
|
||||
|
||||
static int file_rename_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
|
@ -28,7 +28,6 @@ set(INC
|
||||
../../makesrna
|
||||
../../windowmanager
|
||||
../../../../intern/guardedalloc
|
||||
../../../../intern/audaspace/intern
|
||||
)
|
||||
|
||||
set(INC_SYS
|
||||
@ -47,4 +46,11 @@ set(SRC
|
||||
graph_intern.h
|
||||
)
|
||||
|
||||
if(WITH_AUDASPACE)
|
||||
list(APPEND INC
|
||||
../../../../intern/audaspace/intern
|
||||
)
|
||||
add_definitions(-DWITH_AUDASPACE)
|
||||
endif()
|
||||
|
||||
blender_add_lib(bf_editor_space_graph "${SRC}" "${INC}" "${INC_SYS}")
|
||||
|
@ -37,7 +37,9 @@
|
||||
#include <string.h>
|
||||
#include <float.h>
|
||||
|
||||
#include "AUD_C-API.h"
|
||||
#ifdef WITH_AUDASPACE
|
||||
# include "AUD_C-API.h"
|
||||
#endif
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
@ -1079,6 +1081,7 @@ static float fcurve_samplingcb_sound (FCurve *UNUSED(fcu), void *data, float eva
|
||||
|
||||
/* ------------------- */
|
||||
|
||||
#ifdef WITH_AUDASPACE
|
||||
static int graphkeys_sound_bake_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
bAnimContext ac;
|
||||
@ -1149,6 +1152,17 @@ static int graphkeys_sound_bake_exec(bContext *C, wmOperator *op)
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
#else //WITH_AUDASPACE
|
||||
|
||||
static int graphkeys_sound_bake_exec(bContext *UNUSED(C), wmOperator *op)
|
||||
{
|
||||
BKE_report(op->reports, RPT_ERROR, "Compiled without sound support");
|
||||
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
#endif //WITH_AUDASPACE
|
||||
|
||||
static int graphkeys_sound_bake_invoke (bContext *C, wmOperator *op, wmEvent *event)
|
||||
{
|
||||
bAnimContext ac;
|
||||
|
@ -357,13 +357,14 @@ static void stats_update(Scene *scene)
|
||||
}
|
||||
|
||||
if(!scene->stats)
|
||||
scene->stats= MEM_mallocN(sizeof(SceneStats), "SceneStats");
|
||||
scene->stats= MEM_callocN(sizeof(SceneStats), "SceneStats");
|
||||
|
||||
*(scene->stats)= stats;
|
||||
}
|
||||
|
||||
static void stats_string(Scene *scene)
|
||||
{
|
||||
extern char versionstr[]; /* from blender.c */
|
||||
SceneStats *stats= scene->stats;
|
||||
Object *ob= (scene->basact)? scene->basact->object: NULL;
|
||||
uintptr_t mem_in_use, mmap_in_use;
|
||||
@ -379,6 +380,8 @@ static void stats_string(Scene *scene)
|
||||
sprintf(s, " (%.2fM)", (double)((mmap_in_use)>>10)/1024.0);
|
||||
|
||||
s= stats->infostr;
|
||||
|
||||
s+= sprintf(s, "%s | ", versionstr);
|
||||
|
||||
if(scene->obedit) {
|
||||
if(ob_get_keyblock(scene->obedit))
|
||||
|
@ -29,7 +29,6 @@ set(INC
|
||||
../../makesrna
|
||||
../../windowmanager
|
||||
../../../../intern/guardedalloc
|
||||
../../../../intern/audaspace/intern
|
||||
)
|
||||
|
||||
set(INC_SYS
|
||||
@ -49,4 +48,11 @@ set(SRC
|
||||
sequencer_intern.h
|
||||
)
|
||||
|
||||
if(WITH_AUDASPACE)
|
||||
list(APPEND INC
|
||||
../../../../intern/audaspace/intern
|
||||
)
|
||||
add_definitions(-DWITH_AUDASPACE)
|
||||
endif()
|
||||
|
||||
blender_add_lib(bf_editor_space_sequencer "${SRC}" "${INC}" "${INC_SYS}")
|
||||
|
@ -70,7 +70,10 @@
|
||||
#include "UI_view2d.h"
|
||||
|
||||
#include "BKE_sound.h"
|
||||
#include "AUD_C-API.h"
|
||||
|
||||
#ifdef WITH_AUDASPACE
|
||||
# include "AUD_C-API.h"
|
||||
#endif
|
||||
|
||||
/* own include */
|
||||
#include "sequencer_intern.h"
|
||||
|
@ -3613,8 +3613,6 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
|
||||
bb.align = part->bb_align;
|
||||
bb.anim = part->bb_anim;
|
||||
bb.lock = part->draw & PART_DRAW_BB_LOCK;
|
||||
bb.offset[0] = part->bb_offset[0];
|
||||
bb.offset[1] = part->bb_offset[1];
|
||||
break;
|
||||
case PART_DRAW_PATH:
|
||||
break;
|
||||
@ -3784,7 +3782,20 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
|
||||
|
||||
/* create actiual particle data */
|
||||
if(draw_as == PART_DRAW_BB) {
|
||||
bb.size = pa_size;
|
||||
bb.offset[0] = part->bb_offset[0];
|
||||
bb.offset[1] = part->bb_offset[1];
|
||||
bb.size[0] = part->bb_size[0] * pa_size;
|
||||
if (part->bb_align==PART_BB_VEL) {
|
||||
float pa_vel = len_v3(state.vel);
|
||||
float head = part->bb_vel_head*pa_vel;
|
||||
float tail = part->bb_vel_tail*pa_vel;
|
||||
bb.size[1] = part->bb_size[1]*pa_size + head + tail;
|
||||
/* use offset to adjust the particle center. this is relative to size, so need to divide! */
|
||||
if (bb.size[1] > 0.0f)
|
||||
bb.offset[1] += (head-tail) / bb.size[1];
|
||||
}
|
||||
else
|
||||
bb.size[1] = part->bb_size[1] * pa_size;
|
||||
bb.tilt = part->bb_tilt * (1.0f - part->bb_rand_tilt * r_tilt);
|
||||
bb.time = ct;
|
||||
}
|
||||
@ -3804,7 +3815,20 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
|
||||
|
||||
/* create actiual particle data */
|
||||
if(draw_as == PART_DRAW_BB) {
|
||||
bb.size = pa_size;
|
||||
bb.offset[0] = part->bb_offset[0];
|
||||
bb.offset[1] = part->bb_offset[1];
|
||||
bb.size[0] = part->bb_size[0] * pa_size;
|
||||
if (part->bb_align==PART_BB_VEL) {
|
||||
float pa_vel = len_v3(state.vel);
|
||||
float head = part->bb_vel_head*pa_vel;
|
||||
float tail = part->bb_vel_tail*pa_vel;
|
||||
bb.size[1] = part->bb_size[1]*pa_size + head + tail;
|
||||
/* use offset to adjust the particle center. this is relative to size, so need to divide! */
|
||||
if (bb.size[1] > 0.0f)
|
||||
bb.offset[1] += (head-tail) / bb.size[1];
|
||||
}
|
||||
else
|
||||
bb.size[1] = part->bb_size[1] * pa_size;
|
||||
bb.tilt = part->bb_tilt * (1.0f - part->bb_rand_tilt * r_tilt);
|
||||
bb.time = pa_time;
|
||||
}
|
||||
|
@ -105,8 +105,8 @@ void constraintNumInput(TransInfo *t, float vec[3])
|
||||
if (getConstraintSpaceDimension(t) == 2) {
|
||||
int axis = mode & (CON_AXIS0|CON_AXIS1|CON_AXIS2);
|
||||
if (axis == (CON_AXIS0|CON_AXIS1)) {
|
||||
vec[0] = vec[0];
|
||||
vec[1] = vec[1];
|
||||
/* vec[0] = vec[0]; */ /* same */
|
||||
/* vec[1] = vec[1]; */ /* same */
|
||||
vec[2] = nval;
|
||||
}
|
||||
else if (axis == (CON_AXIS1|CON_AXIS2)) {
|
||||
@ -115,14 +115,14 @@ void constraintNumInput(TransInfo *t, float vec[3])
|
||||
vec[0] = nval;
|
||||
}
|
||||
else if (axis == (CON_AXIS0|CON_AXIS2)) {
|
||||
vec[0] = vec[0];
|
||||
/* vec[0] = vec[0]; */ /* same */
|
||||
vec[2] = vec[1];
|
||||
vec[1] = nval;
|
||||
}
|
||||
}
|
||||
else if (getConstraintSpaceDimension(t) == 1) {
|
||||
if (mode & CON_AXIS0) {
|
||||
vec[0] = vec[0];
|
||||
/* vec[0] = vec[0]; */ /* same */
|
||||
vec[1] = nval;
|
||||
vec[2] = nval;
|
||||
}
|
||||
|
@ -38,7 +38,6 @@ set(INC
|
||||
../makesdna
|
||||
../../../intern/memutil
|
||||
../../../intern/guardedalloc
|
||||
../../../intern/ffmpeg
|
||||
)
|
||||
|
||||
set(INC_SYS
|
||||
@ -135,6 +134,7 @@ if(WITH_CODEC_QUICKTIME)
|
||||
endif()
|
||||
|
||||
if(WITH_CODEC_FFMPEG)
|
||||
list(APPEND INC ../../../intern/ffmpeg)
|
||||
list(APPEND INC_SYS ${FFMPEG_INCLUDE_DIRS})
|
||||
add_definitions(-DWITH_FFMPEG)
|
||||
endif()
|
||||
|
@ -338,6 +338,7 @@ void IMB_float_from_rect_simple(struct ImBuf *ibuf); /* no profile conversion */
|
||||
/* note, check that the conversion exists, only some are supported */
|
||||
void IMB_convert_profile(struct ImBuf *ibuf, int profile);
|
||||
float *IMB_float_profile_ensure(struct ImBuf *ibuf, int profile, int *alloc);
|
||||
void IMB_color_to_bw(struct ImBuf *ibuf);
|
||||
|
||||
/**
|
||||
* Change the ordering of the color bytes pointed to by rect from
|
||||
|
@ -490,3 +490,23 @@ float *IMB_float_profile_ensure(struct ImBuf *ibuf, int profile, int *alloc)
|
||||
return fbuf;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* no profile conversion */
|
||||
void IMB_color_to_bw(struct ImBuf *ibuf)
|
||||
{
|
||||
float *rctf= ibuf->rect_float;
|
||||
unsigned char *rct= (unsigned char *)ibuf->rect;
|
||||
int i;
|
||||
if(rctf) {
|
||||
for (i = ibuf->x * ibuf->y; i > 0; i--, rctf+=4) {
|
||||
rctf[0]= rctf[1]= rctf[2]= rgb_to_grayscale(rctf);
|
||||
}
|
||||
}
|
||||
|
||||
if(rct) {
|
||||
for (i = ibuf->x * ibuf->y; i > 0; i--, rct+=4) {
|
||||
rct[0]= rct[1]= rct[2]= rgb_to_grayscale_byte(rct);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ typedef struct ParticleSettings {
|
||||
|
||||
/* billboards */
|
||||
short bb_align, bb_uv_split, bb_anim, bb_split_offset;
|
||||
float bb_tilt, bb_rand_tilt, bb_offset[2];
|
||||
float bb_tilt, bb_rand_tilt, bb_offset[2], bb_size[2], bb_vel_head, bb_vel_tail;
|
||||
|
||||
/* draw color */
|
||||
float color_vec_max;
|
||||
|
@ -173,6 +173,10 @@ if(WITH_IMAGE_HDR)
|
||||
add_definitions(-DWITH_HDR)
|
||||
endif()
|
||||
|
||||
if(WITH_AUDASPACE)
|
||||
add_definitions(-DWITH_AUDASPACE)
|
||||
endif()
|
||||
|
||||
if(WITH_CODEC_QUICKTIME)
|
||||
list(APPEND INC ../../quicktime)
|
||||
add_definitions(-DWITH_QUICKTIME)
|
||||
|
@ -644,6 +644,25 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr
|
||||
return func;
|
||||
}
|
||||
|
||||
/* defined min/max variables to be used by rna_clamp_value() */
|
||||
static void rna_clamp_value_range(FILE *f, PropertyRNA *prop)
|
||||
{
|
||||
if(prop->type == PROP_FLOAT) {
|
||||
FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop;
|
||||
if(fprop->range) {
|
||||
fprintf(f, " float prop_clamp_min, prop_clamp_max;\n");
|
||||
fprintf(f, " %s(ptr, &prop_clamp_min, &prop_clamp_max);\n", rna_function_string(fprop->range));
|
||||
}
|
||||
}
|
||||
else if(prop->type == PROP_INT) {
|
||||
IntPropertyRNA *iprop= (IntPropertyRNA*)prop;
|
||||
if(iprop->range) {
|
||||
fprintf(f, " int prop_clamp_min, prop_clamp_max;\n");
|
||||
fprintf(f, " %s(ptr, &prop_clamp_min, &prop_clamp_max);\n", rna_function_string(iprop->range));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void rna_clamp_value(FILE *f, PropertyRNA *prop, int array)
|
||||
{
|
||||
if(prop->type == PROP_INT) {
|
||||
@ -652,8 +671,13 @@ static void rna_clamp_value(FILE *f, PropertyRNA *prop, int array)
|
||||
if(iprop->hardmin != INT_MIN || iprop->hardmax != INT_MAX) {
|
||||
if(array) fprintf(f, "CLAMPIS(values[i], ");
|
||||
else fprintf(f, "CLAMPIS(value, ");
|
||||
rna_int_print(f, iprop->hardmin); fprintf(f, ", ");
|
||||
rna_int_print(f, iprop->hardmax); fprintf(f, ");\n");
|
||||
if(iprop->range) {
|
||||
fprintf(f, "prop_clamp_min, prop_clamp_max);");
|
||||
}
|
||||
else {
|
||||
rna_int_print(f, iprop->hardmin); fprintf(f, ", ");
|
||||
rna_int_print(f, iprop->hardmax); fprintf(f, ");\n");
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -663,8 +687,13 @@ static void rna_clamp_value(FILE *f, PropertyRNA *prop, int array)
|
||||
if(fprop->hardmin != -FLT_MAX || fprop->hardmax != FLT_MAX) {
|
||||
if(array) fprintf(f, "CLAMPIS(values[i], ");
|
||||
else fprintf(f, "CLAMPIS(value, ");
|
||||
rna_float_print(f, fprop->hardmin); fprintf(f, ", ");
|
||||
rna_float_print(f, fprop->hardmax); fprintf(f, ");\n");
|
||||
if(fprop->range) {
|
||||
fprintf(f, "prop_clamp_min, prop_clamp_max);");
|
||||
}
|
||||
else {
|
||||
rna_float_print(f, fprop->hardmin); fprintf(f, ", ");
|
||||
rna_float_print(f, fprop->hardmax); fprintf(f, ");\n");
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -767,11 +796,13 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr
|
||||
char *lenfunc= rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "set_length");
|
||||
fprintf(f, " int i, arraylen[RNA_MAX_ARRAY_DIMENSION];\n");
|
||||
fprintf(f, " int len= %s(ptr, arraylen);\n\n", lenfunc);
|
||||
rna_clamp_value_range(f, prop);
|
||||
fprintf(f, " for(i=0; i<len; i++) {\n");
|
||||
MEM_freeN(lenfunc);
|
||||
}
|
||||
else {
|
||||
fprintf(f, " int i;\n\n");
|
||||
rna_clamp_value_range(f, prop);
|
||||
fprintf(f, " for(i=0; i<%d; i++) {\n", prop->totarraylength);
|
||||
}
|
||||
|
||||
@ -833,6 +864,7 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr
|
||||
fprintf(f, " data->%s |= value;\n", dp->dnaname);
|
||||
}
|
||||
else {
|
||||
rna_clamp_value_range(f, prop);
|
||||
fprintf(f, " data->%s= %s", dp->dnaname, (dp->booleannegative)? "!": "");
|
||||
rna_clamp_value(f, prop, 0);
|
||||
}
|
||||
|
@ -412,15 +412,15 @@ static void rna_def_ID_materials(BlenderRNA *brna)
|
||||
RNA_def_struct_ui_text(srna, "ID Materials", "Collection of materials");
|
||||
|
||||
func= RNA_def_function(srna, "append", "material_append_id");
|
||||
RNA_def_function_ui_description(func, "Add a new material to Mesh.");
|
||||
RNA_def_function_ui_description(func, "Add a new material to the data block.");
|
||||
parm= RNA_def_pointer(func, "material", "Material", "", "Material to add.");
|
||||
RNA_def_property_flag(parm, PROP_REQUIRED);
|
||||
|
||||
func= RNA_def_function(srna, "pop", "material_pop_id");
|
||||
RNA_def_function_ui_description(func, "Add a new material to Mesh.");
|
||||
parm= RNA_def_int(func, "index", 0, 0, INT_MAX, "", "Frame number to set.", 0, INT_MAX);
|
||||
RNA_def_function_ui_description(func, "Remove a material from the data block.");
|
||||
parm= RNA_def_int(func, "index", 0, 0, INT_MAX, "", "Index of material to remove.", 0, INT_MAX);
|
||||
RNA_def_property_flag(parm, PROP_REQUIRED);
|
||||
parm= RNA_def_pointer(func, "material", "Material", "", "Material to add.");
|
||||
parm= RNA_def_pointer(func, "material", "Material", "", "Material to remove.");
|
||||
RNA_def_function_return(func, parm);
|
||||
}
|
||||
|
||||
|
@ -1603,6 +1603,8 @@ void RNA_property_int_set(PointerRNA *ptr, PropertyRNA *prop, int value)
|
||||
IDProperty *idprop;
|
||||
|
||||
BLI_assert(RNA_property_type(prop) == PROP_INT);
|
||||
/* useful to check on bad values but set function should clamp */
|
||||
/* BLI_assert(RNA_property_int_clamp(ptr, prop, &value) == 0); */
|
||||
|
||||
if((idprop=rna_idproperty_check(&prop, ptr)))
|
||||
IDP_Int(idprop)= value;
|
||||
@ -1825,6 +1827,8 @@ void RNA_property_float_set(PointerRNA *ptr, PropertyRNA *prop, float value)
|
||||
IDProperty *idprop;
|
||||
|
||||
BLI_assert(RNA_property_type(prop) == PROP_FLOAT);
|
||||
/* useful to check on bad values but set function should clamp */
|
||||
/* BLI_assert(RNA_property_float_clamp(ptr, prop, &value) == 0); */
|
||||
|
||||
if((idprop=rna_idproperty_check(&prop, ptr))) {
|
||||
if(idprop->type == IDP_FLOAT)
|
||||
|
@ -233,6 +233,7 @@ static void rna_Curve_material_index_range(PointerRNA *ptr, int *min, int *max)
|
||||
Curve *cu= (Curve*)ptr->id.data;
|
||||
*min= 0;
|
||||
*max= cu->totcol-1;
|
||||
*max= MAX2(0, *max);
|
||||
}
|
||||
|
||||
static void rna_Curve_active_textbox_index_range(PointerRNA *ptr, int *min, int *max)
|
||||
@ -240,6 +241,7 @@ static void rna_Curve_active_textbox_index_range(PointerRNA *ptr, int *min, int
|
||||
Curve *cu= (Curve*)ptr->id.data;
|
||||
*min= 0;
|
||||
*max= cu->totbox-1;
|
||||
*max= MAX2(0, *max);
|
||||
}
|
||||
|
||||
|
||||
|
@ -305,6 +305,7 @@ static void rna_MeshFace_material_index_range(PointerRNA *ptr, int *min, int *ma
|
||||
Mesh *me= (Mesh*)ptr->id.data;
|
||||
*min= 0;
|
||||
*max= me->totcol-1;
|
||||
*max= MAX2(0, *max);
|
||||
}
|
||||
|
||||
static CustomData *rna_mesh_fdata(Mesh *me)
|
||||
|
@ -404,7 +404,8 @@ static void rna_MultiresModifier_level_range(PointerRNA *ptr, int *min, int *max
|
||||
MultiresModifierData *mmd = (MultiresModifierData*)ptr->data;
|
||||
|
||||
*min = 0;
|
||||
*max = mmd->totlvl;
|
||||
*max = mmd->totlvl; /* intentionally _not_ -1 */
|
||||
*max= MAX2(0, *max);
|
||||
}
|
||||
|
||||
static int rna_MultiresModifier_external_get(PointerRNA *ptr)
|
||||
|
@ -1024,8 +1024,13 @@ static void rna_Object_active_shape_key_index_range(PointerRNA *ptr, int *min, i
|
||||
Key *key= ob_get_key(ob);
|
||||
|
||||
*min= 0;
|
||||
*max= (key)? BLI_countlist(&key->block)-1: 0;
|
||||
*max= MAX2(0, *max);
|
||||
if(key) {
|
||||
*max= BLI_countlist(&key->block)-1;
|
||||
if(*max < 0) *max= 0;
|
||||
}
|
||||
else {
|
||||
*max= 0;
|
||||
}
|
||||
}
|
||||
|
||||
static int rna_Object_active_shape_key_index_get(PointerRNA *ptr)
|
||||
|
@ -1757,11 +1757,6 @@ static void rna_def_particle_settings(BlenderRNA *brna)
|
||||
RNA_def_property_ui_text(prop, "Absolute Path Time", "Path timing is in absolute frames");
|
||||
RNA_def_property_update(prop, 0, "rna_Particle_abspathtime_update");
|
||||
|
||||
prop= RNA_def_property(srna, "lock_billboard", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_BB_LOCK);
|
||||
RNA_def_property_ui_text(prop, "Lock Billboard", "Lock the billboards align axis");
|
||||
RNA_def_property_update(prop, 0, "rna_Particle_redo");
|
||||
|
||||
prop= RNA_def_property(srna, "use_parent_particles", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_PARENT);
|
||||
RNA_def_property_ui_text(prop, "Parents", "Render parent particles");
|
||||
@ -1910,6 +1905,11 @@ static void rna_def_particle_settings(BlenderRNA *brna)
|
||||
RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
|
||||
|
||||
/* billboards */
|
||||
prop= RNA_def_property(srna, "lock_billboard", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_BB_LOCK);
|
||||
RNA_def_property_ui_text(prop, "Lock Billboard", "Lock the billboards align axis");
|
||||
RNA_def_property_update(prop, 0, "rna_Particle_redo");
|
||||
|
||||
prop= RNA_def_property(srna, "billboard_align", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, NULL, "bb_align");
|
||||
RNA_def_property_enum_items(prop, bb_align_items);
|
||||
@ -1958,6 +1958,25 @@ static void rna_def_particle_settings(BlenderRNA *brna)
|
||||
RNA_def_property_ui_text(prop, "Billboard Offset", "");
|
||||
RNA_def_property_update(prop, 0, "rna_Particle_redo");
|
||||
|
||||
prop= RNA_def_property(srna, "billboard_size", PROP_FLOAT, PROP_FACTOR);
|
||||
RNA_def_property_float_sdna(prop, NULL, "bb_size");
|
||||
RNA_def_property_array(prop, 2);
|
||||
RNA_def_property_range(prop, 0.001f, 10.0f);
|
||||
RNA_def_property_ui_text(prop, "Billboard Scale", "Scale billboards relative to particle size");
|
||||
RNA_def_property_update(prop, 0, "rna_Particle_redo");
|
||||
|
||||
prop= RNA_def_property(srna, "billboard_velocity_head", PROP_FLOAT, PROP_FACTOR);
|
||||
RNA_def_property_float_sdna(prop, NULL, "bb_vel_head");
|
||||
RNA_def_property_range(prop, 0.0f, 10.0f);
|
||||
RNA_def_property_ui_text(prop, "Billboard Velocity Head", "Scale billboards by velocity");
|
||||
RNA_def_property_update(prop, 0, "rna_Particle_redo");
|
||||
|
||||
prop= RNA_def_property(srna, "billboard_velocity_tail", PROP_FLOAT, PROP_FACTOR);
|
||||
RNA_def_property_float_sdna(prop, NULL, "bb_vel_tail");
|
||||
RNA_def_property_range(prop, 0.0f, 10.0f);
|
||||
RNA_def_property_ui_text(prop, "Billboard Velocity Tail", "Scale billboards by velocity");
|
||||
RNA_def_property_update(prop, 0, "rna_Particle_redo");
|
||||
|
||||
/* simplification */
|
||||
prop= RNA_def_property(srna, "use_simplify", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "simplify_flag", PART_SIMPLIFY_ENABLE);
|
||||
|
@ -1067,7 +1067,7 @@ static void rna_def_property(BlenderRNA *brna)
|
||||
prop= RNA_def_property(srna, "is_runtime", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_boolean_funcs(prop, "rna_Property_runtime_get", NULL);
|
||||
RNA_def_property_ui_text(prop, "Read Only", "Property is editable through RNA");
|
||||
RNA_def_property_ui_text(prop, "Runtime", "Property has been dynamically created at runtime");
|
||||
|
||||
prop= RNA_def_property(srna, "is_enum_flag", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
|
@ -45,7 +45,9 @@
|
||||
|
||||
#ifdef WITH_QUICKTIME
|
||||
#include "quicktime_export.h"
|
||||
#include "AUD_C-API.h"
|
||||
# ifdef WITH_AUDASPACE
|
||||
# include "AUD_C-API.h"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef WITH_FFMPEG
|
||||
|
@ -704,7 +704,7 @@ static void rna_ConsoleLine_cursor_index_range(PointerRNA *ptr, int *min, int *m
|
||||
ConsoleLine *ci= (ConsoleLine*)ptr->data;
|
||||
|
||||
*min= 0;
|
||||
*max= ci->len;
|
||||
*max= ci->len; /* intentionally _not_ -1 */
|
||||
}
|
||||
|
||||
/* Space Dopesheet */
|
||||
|
@ -361,36 +361,37 @@ static void rna_def_userdef_theme_ui_style(BlenderRNA *brna)
|
||||
RNA_def_struct_sdna(srna, "uiStyle");
|
||||
RNA_def_struct_ui_text(srna, "Style", "Theme settings for style sets");
|
||||
|
||||
/* (not used yet)
|
||||
prop= RNA_def_property(srna, "panelzoom", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_range(prop, 0.5, 2.0);
|
||||
RNA_def_property_ui_text(prop, "Panel Zoom", "Default zoom level for panel areas");
|
||||
|
||||
*/
|
||||
prop= RNA_def_property(srna, "panel_title", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_flag(prop, PROP_NEVER_NULL);
|
||||
RNA_def_property_pointer_sdna(prop, NULL, "paneltitle");
|
||||
RNA_def_property_struct_type(prop, "ThemeFontStyle");
|
||||
RNA_def_property_ui_text(prop, "Panel Font", "");
|
||||
RNA_def_property_ui_text(prop, "Panel Style", "");
|
||||
RNA_def_property_update(prop, 0, "rna_userdef_update");
|
||||
|
||||
/* (not used yet)
|
||||
prop= RNA_def_property(srna, "group_label", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_flag(prop, PROP_NEVER_NULL);
|
||||
RNA_def_property_pointer_sdna(prop, NULL, "grouplabel");
|
||||
RNA_def_property_struct_type(prop, "ThemeFontStyle");
|
||||
RNA_def_property_ui_text(prop, "Group Label Font", "");
|
||||
RNA_def_property_update(prop, 0, "rna_userdef_update");
|
||||
|
||||
*/
|
||||
prop= RNA_def_property(srna, "widget_label", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_flag(prop, PROP_NEVER_NULL);
|
||||
RNA_def_property_pointer_sdna(prop, NULL, "widgetlabel");
|
||||
RNA_def_property_struct_type(prop, "ThemeFontStyle");
|
||||
RNA_def_property_ui_text(prop, "Widget Label Font", "");
|
||||
RNA_def_property_ui_text(prop, "Widget Label Style", "");
|
||||
RNA_def_property_update(prop, 0, "rna_userdef_update");
|
||||
|
||||
prop= RNA_def_property(srna, "widget", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_flag(prop, PROP_NEVER_NULL);
|
||||
RNA_def_property_pointer_sdna(prop, NULL, "widget");
|
||||
RNA_def_property_struct_type(prop, "ThemeFontStyle");
|
||||
RNA_def_property_ui_text(prop, "Widget Font", "");
|
||||
RNA_def_property_ui_text(prop, "Widget Style", "");
|
||||
RNA_def_property_update(prop, 0, "rna_userdef_update");
|
||||
|
||||
}
|
||||
|
@ -97,6 +97,7 @@ static void do_channel_matte(bNode *node, float *out, float *in)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
|
@ -467,6 +467,7 @@ static void node_composit_exec_glare(void *UNUSED(data), bNode *node, bNodeStack
|
||||
case 2:
|
||||
default:
|
||||
streaks(ndg, new, src);
|
||||
break;
|
||||
}
|
||||
|
||||
free_compbuf(src);
|
||||
|
@ -97,6 +97,7 @@ static void node_composit_exec_rotate(void *UNUSED(data), bNode *node, bNodeStac
|
||||
break;
|
||||
case 2:
|
||||
bicubic_interpolation(ibuf, obuf, u, v, xo, yo);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -83,6 +83,8 @@ void BPY_text_free_code(struct Text *text);
|
||||
void BPY_modules_update(struct bContext *C); // XXX - annoying, need this for pointers that get out of date
|
||||
void BPY_modules_load_user(struct bContext *C);
|
||||
|
||||
void BPY_app_handlers_reset(void);
|
||||
|
||||
void BPY_driver_reset(void);
|
||||
float BPY_driver_exec(struct ChannelDriver *driver);
|
||||
|
||||
|
@ -779,7 +779,7 @@ static PyObject *Matrix_resize_4x4(MatrixObject *self)
|
||||
for(blank_columns = (4 - self->col_size); blank_columns > 0; blank_columns--){
|
||||
self->contigPtr[new_pos + blank_columns] = 0.0f;
|
||||
}
|
||||
for(curr_pos = curr_pos; curr_pos >= first_row_elem; curr_pos--){
|
||||
for( ; curr_pos >= first_row_elem; curr_pos--){
|
||||
self->contigPtr[new_pos] = self->contigPtr[curr_pos];
|
||||
new_pos--;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
@ -522,7 +522,7 @@ static PyObject *M_Geometry_intersect_line_plane(PyObject *UNUSED(self), PyObjec
|
||||
VectorObject *line_a, *line_b, *plane_co, *plane_no;
|
||||
int no_flip= 0;
|
||||
float isect[3];
|
||||
if(!PyArg_ParseTuple(args, "O!O!O!O!|i:intersect_line_line_2d",
|
||||
if(!PyArg_ParseTuple(args, "O!O!O!O!|i:intersect_line_plane",
|
||||
&vector_Type, &line_a,
|
||||
&vector_Type, &line_b,
|
||||
&vector_Type, &plane_co,
|
||||
@ -553,6 +553,157 @@ static PyObject *M_Geometry_intersect_line_plane(PyObject *UNUSED(self), PyObjec
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
PyDoc_STRVAR(M_Geometry_intersect_line_sphere_doc,
|
||||
".. function:: intersect_line_sphere(line_a, line_b, sphere_co, sphere_radius, clip=True)\n"
|
||||
"\n"
|
||||
" Takes a lines (as 2 vectors), a sphere as a point and a radius and\n"
|
||||
" returns the intersection\n"
|
||||
"\n"
|
||||
" :arg line_a: First point of the first line\n"
|
||||
" :type line_a: :class:`mathutils.Vector`\n"
|
||||
" :arg line_b: Second point of the first line\n"
|
||||
" :type line_b: :class:`mathutils.Vector`\n"
|
||||
" :arg sphere_co: The center of the sphere\n"
|
||||
" :type sphere_co: :class:`mathutils.Vector`\n"
|
||||
" :arg sphere_radius: Radius of the sphere\n"
|
||||
" :type sphere_radius: sphere_radius\n"
|
||||
" :return: The intersection points as a pair of vectors or None when there is no intersection\n"
|
||||
" :rtype: A tuple pair containing :class:`mathutils.Vector` or None\n"
|
||||
);
|
||||
static PyObject *M_Geometry_intersect_line_sphere(PyObject *UNUSED(self), PyObject* args)
|
||||
{
|
||||
VectorObject *line_a, *line_b, *sphere_co;
|
||||
float sphere_radius;
|
||||
int clip= TRUE;
|
||||
|
||||
float isect_a[3];
|
||||
float isect_b[3];
|
||||
|
||||
if(!PyArg_ParseTuple(args, "O!O!O!f|i:intersect_line_sphere",
|
||||
&vector_Type, &line_a,
|
||||
&vector_Type, &line_b,
|
||||
&vector_Type, &sphere_co,
|
||||
&sphere_radius, &clip)
|
||||
) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if( BaseMath_ReadCallback(line_a) == -1 ||
|
||||
BaseMath_ReadCallback(line_b) == -1 ||
|
||||
BaseMath_ReadCallback(sphere_co) == -1
|
||||
) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(ELEM3(2, line_a->size, line_b->size, sphere_co->size)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "geometry.intersect_line_sphere(...) can't use 2D Vectors");
|
||||
return NULL;
|
||||
}
|
||||
else {
|
||||
short use_a= TRUE;
|
||||
short use_b= TRUE;
|
||||
float lambda;
|
||||
|
||||
PyObject *ret= PyTuple_New(2);
|
||||
|
||||
switch(isect_line_sphere_v3(line_a->vec, line_b->vec, sphere_co->vec, sphere_radius, isect_a, isect_b)) {
|
||||
case 1:
|
||||
if(!(!clip || (((lambda= line_point_factor_v3(isect_a, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_a= FALSE;
|
||||
use_b= FALSE;
|
||||
break;
|
||||
case 2:
|
||||
if(!(!clip || (((lambda= line_point_factor_v3(isect_a, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_a= FALSE;
|
||||
if(!(!clip || (((lambda= line_point_factor_v3(isect_b, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_b= FALSE;
|
||||
break;
|
||||
default:
|
||||
use_a= FALSE;
|
||||
use_b= FALSE;
|
||||
}
|
||||
|
||||
if(use_a) { PyTuple_SET_ITEM(ret, 0, newVectorObject(isect_a, 3, Py_NEW, NULL)); }
|
||||
else { PyTuple_SET_ITEM(ret, 0, Py_None); Py_INCREF(Py_None); }
|
||||
|
||||
if(use_b) { PyTuple_SET_ITEM(ret, 1, newVectorObject(isect_b, 3, Py_NEW, NULL)); }
|
||||
else { PyTuple_SET_ITEM(ret, 1, Py_None); Py_INCREF(Py_None); }
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
/* keep in sync with M_Geometry_intersect_line_sphere */
|
||||
PyDoc_STRVAR(M_Geometry_intersect_line_sphere_2d_doc,
|
||||
".. function:: intersect_line_sphere_2d(line_a, line_b, sphere_co, sphere_radius, clip=True)\n"
|
||||
"\n"
|
||||
" Takes a lines (as 2 vectors), a sphere as a point and a radius and\n"
|
||||
" returns the intersection\n"
|
||||
"\n"
|
||||
" :arg line_a: First point of the first line\n"
|
||||
" :type line_a: :class:`mathutils.Vector`\n"
|
||||
" :arg line_b: Second point of the first line\n"
|
||||
" :type line_b: :class:`mathutils.Vector`\n"
|
||||
" :arg sphere_co: The center of the sphere\n"
|
||||
" :type sphere_co: :class:`mathutils.Vector`\n"
|
||||
" :arg sphere_radius: Radius of the sphere\n"
|
||||
" :type sphere_radius: sphere_radius\n"
|
||||
" :return: The intersection points as a pair of vectors or None when there is no intersection\n"
|
||||
" :rtype: A tuple pair containing :class:`mathutils.Vector` or None\n"
|
||||
);
|
||||
static PyObject *M_Geometry_intersect_line_sphere_2d(PyObject *UNUSED(self), PyObject* args)
|
||||
{
|
||||
VectorObject *line_a, *line_b, *sphere_co;
|
||||
float sphere_radius;
|
||||
int clip= TRUE;
|
||||
|
||||
float isect_a[3];
|
||||
float isect_b[3];
|
||||
|
||||
if(!PyArg_ParseTuple(args, "O!O!O!f|i:intersect_line_sphere_2d",
|
||||
&vector_Type, &line_a,
|
||||
&vector_Type, &line_b,
|
||||
&vector_Type, &sphere_co,
|
||||
&sphere_radius, &clip)
|
||||
) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if( BaseMath_ReadCallback(line_a) == -1 ||
|
||||
BaseMath_ReadCallback(line_b) == -1 ||
|
||||
BaseMath_ReadCallback(sphere_co) == -1
|
||||
) {
|
||||
return NULL;
|
||||
}
|
||||
else {
|
||||
short use_a= TRUE;
|
||||
short use_b= TRUE;
|
||||
float lambda;
|
||||
|
||||
PyObject *ret= PyTuple_New(2);
|
||||
|
||||
switch(isect_line_sphere_v3(line_a->vec, line_b->vec, sphere_co->vec, sphere_radius, isect_a, isect_b)) {
|
||||
case 1:
|
||||
if(!(!clip || (((lambda= line_point_factor_v2(isect_a, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_a= FALSE;
|
||||
use_b= FALSE;
|
||||
break;
|
||||
case 2:
|
||||
if(!(!clip || (((lambda= line_point_factor_v2(isect_a, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_a= FALSE;
|
||||
if(!(!clip || (((lambda= line_point_factor_v2(isect_b, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_b= FALSE;
|
||||
break;
|
||||
default:
|
||||
use_a= FALSE;
|
||||
use_b= FALSE;
|
||||
}
|
||||
|
||||
if(use_a) { PyTuple_SET_ITEM(ret, 0, newVectorObject(isect_a, 2, Py_NEW, NULL)); }
|
||||
else { PyTuple_SET_ITEM(ret, 0, Py_None); Py_INCREF(Py_None); }
|
||||
|
||||
if(use_b) { PyTuple_SET_ITEM(ret, 1, newVectorObject(isect_b, 2, Py_NEW, NULL)); }
|
||||
else { PyTuple_SET_ITEM(ret, 1, Py_None); Py_INCREF(Py_None); }
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_Geometry_intersect_point_line_doc,
|
||||
".. function:: intersect_point_line(pt, line_p1, line_p2)\n"
|
||||
"\n"
|
||||
@ -917,6 +1068,8 @@ static PyMethodDef M_Geometry_methods[]= {
|
||||
{"intersect_line_line", (PyCFunction) M_Geometry_intersect_line_line, METH_VARARGS, M_Geometry_intersect_line_line_doc},
|
||||
{"intersect_line_line_2d", (PyCFunction) M_Geometry_intersect_line_line_2d, METH_VARARGS, M_Geometry_intersect_line_line_2d_doc},
|
||||
{"intersect_line_plane", (PyCFunction) M_Geometry_intersect_line_plane, METH_VARARGS, M_Geometry_intersect_line_plane_doc},
|
||||
{"intersect_line_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},
|
||||
|
@ -33,7 +33,6 @@ set(INC
|
||||
../../windowmanager
|
||||
../../editors/include
|
||||
../../../../intern/guardedalloc
|
||||
../../../../intern/audaspace/intern
|
||||
)
|
||||
|
||||
set(INC_SYS
|
||||
@ -43,6 +42,7 @@ set(INC_SYS
|
||||
set(SRC
|
||||
bpy.c
|
||||
bpy_app.c
|
||||
bpy_app_handlers.c
|
||||
bpy_driver.c
|
||||
bpy_interface.c
|
||||
bpy_intern_string.c
|
||||
@ -60,6 +60,7 @@ set(SRC
|
||||
|
||||
bpy.h
|
||||
bpy_app.h
|
||||
bpy_app_handlers.h
|
||||
bpy_driver.h
|
||||
bpy_intern_string.h
|
||||
bpy_operator.h
|
||||
@ -86,4 +87,11 @@ if(WITH_PYTHON_SAFETY)
|
||||
add_definitions(-DWITH_PYTHON_SAFETY)
|
||||
endif()
|
||||
|
||||
if(WITH_AUDASPACE)
|
||||
list(APPEND INC
|
||||
../../../intern/audaspace/intern
|
||||
)
|
||||
add_definitions(-DWITH_AUDASPACE)
|
||||
endif()
|
||||
|
||||
blender_add_lib(bf_python "${SRC}" "${INC}" "${INC_SYS}")
|
||||
|
@ -60,8 +60,6 @@
|
||||
#include "../generic/blf_py_api.h"
|
||||
#include "../generic/IDProp.h"
|
||||
|
||||
#include "AUD_PyInit.h"
|
||||
|
||||
PyObject *bpy_package_py= NULL;
|
||||
|
||||
PyDoc_STRVAR(bpy_script_paths_doc,
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include <Python.h>
|
||||
|
||||
#include "bpy_app.h"
|
||||
#include "bpy_app_handlers.h"
|
||||
#include "bpy_driver.h"
|
||||
|
||||
#include "BLI_path_util.h"
|
||||
@ -74,6 +75,9 @@ static PyStructSequence_Field app_info_fields[]= {
|
||||
{(char *)"build_cxxflags", (char *)"C++ compiler flags"},
|
||||
{(char *)"build_linkflags", (char *)"Binary linking flags"},
|
||||
{(char *)"build_system", (char *)"Build system used"},
|
||||
|
||||
/* submodules */
|
||||
{(char *)"handlers", (char *)"Application handler callbacks"},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
@ -140,6 +144,8 @@ static PyObject *make_app_info(void)
|
||||
SetStrItem("Unknown");
|
||||
#endif
|
||||
|
||||
SetObjItem(BPY_app_handlers_struct());
|
||||
|
||||
#undef SetIntItem
|
||||
#undef SetStrItem
|
||||
#undef SetObjItem
|
||||
|
170
source/blender/python/intern/bpy_app_handlers.c
Normal file
170
source/blender/python/intern/bpy_app_handlers.c
Normal file
@ -0,0 +1,170 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor(s): Campbell Barton
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
/** \file blender/python/intern/bpy_app_handlers.c
|
||||
* \ingroup pythonintern
|
||||
*/
|
||||
|
||||
#include <Python.h>
|
||||
#include "BLI_utildefines.h"
|
||||
#include "BLI_callbacks.h"
|
||||
|
||||
#include "RNA_types.h"
|
||||
#include "RNA_access.h"
|
||||
#include "bpy_rna.h"
|
||||
#include "bpy_app_handlers.h"
|
||||
|
||||
void bpy_app_generic_callback(struct Main *main, struct ID *id, void *arg);
|
||||
|
||||
static PyTypeObject BlenderAppCbType;
|
||||
|
||||
static PyStructSequence_Field app_cb_info_fields[]= {
|
||||
{(char *)"render_pre", NULL},
|
||||
{(char *)"render_post", NULL},
|
||||
{(char *)"load_pre", NULL},
|
||||
{(char *)"load_post", NULL},
|
||||
{(char *)"save_pre", NULL},
|
||||
{(char *)"save_post", NULL},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
static PyStructSequence_Desc app_cb_info_desc= {
|
||||
(char *)"bpy.app.handlers", /* name */
|
||||
(char *)"This module contains callbacks", /* doc */
|
||||
app_cb_info_fields, /* fields */
|
||||
(sizeof(app_cb_info_fields)/sizeof(PyStructSequence_Field)) - 1
|
||||
};
|
||||
|
||||
/*
|
||||
#if (BLI_CB_EVT_TOT != ((sizeof(app_cb_info_fields)/sizeof(PyStructSequence_Field))))
|
||||
# error "Callbacks are out of sync"
|
||||
#endif
|
||||
*/
|
||||
|
||||
static PyObject *py_cb_array[BLI_CB_EVT_TOT]= {0};
|
||||
|
||||
static PyObject *make_app_cb_info(void)
|
||||
{
|
||||
PyObject *app_cb_info;
|
||||
int pos= 0;
|
||||
|
||||
app_cb_info= PyStructSequence_New(&BlenderAppCbType);
|
||||
if (app_cb_info == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for(pos= 0; pos < BLI_CB_EVT_TOT; pos++) {
|
||||
if(app_cb_info_fields[pos].name == NULL) {
|
||||
Py_FatalError("invalid callback slots 1");
|
||||
}
|
||||
PyStructSequence_SET_ITEM(app_cb_info, pos, (py_cb_array[pos]= PyList_New(0)));
|
||||
}
|
||||
if(app_cb_info_fields[pos].name != NULL) {
|
||||
Py_FatalError("invalid callback slots 2");
|
||||
}
|
||||
|
||||
return app_cb_info;
|
||||
}
|
||||
|
||||
PyObject *BPY_app_handlers_struct(void)
|
||||
{
|
||||
PyObject *ret;
|
||||
|
||||
PyStructSequence_InitType(&BlenderAppCbType, &app_cb_info_desc);
|
||||
|
||||
ret= make_app_cb_info();
|
||||
|
||||
/* prevent user from creating new instances */
|
||||
BlenderAppCbType.tp_init= NULL;
|
||||
BlenderAppCbType.tp_new= NULL;
|
||||
|
||||
/* assign the C callbacks */
|
||||
if(ret) {
|
||||
static bCallbackFuncStore funcstore_array[BLI_CB_EVT_TOT]= {{0}};
|
||||
bCallbackFuncStore *funcstore;
|
||||
int pos= 0;
|
||||
|
||||
for(pos= 0; pos < BLI_CB_EVT_TOT; pos++) {
|
||||
funcstore= &funcstore_array[pos];
|
||||
funcstore->func= bpy_app_generic_callback;
|
||||
funcstore->alloc= 0;
|
||||
funcstore->arg= SET_INT_IN_POINTER(pos);
|
||||
BLI_add_cb(funcstore, pos);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void BPY_app_handlers_reset(void)
|
||||
{
|
||||
int pos= 0;
|
||||
|
||||
for(pos= 0; pos < BLI_CB_EVT_TOT; pos++) {
|
||||
PyList_SetSlice(py_cb_array[pos], 0, PY_SSIZE_T_MAX, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/* the actual callback - not necessarily called from py */
|
||||
void bpy_app_generic_callback(struct Main *UNUSED(main), struct ID *id, void *arg)
|
||||
{
|
||||
PyObject *cb_list= py_cb_array[GET_INT_FROM_POINTER(arg)];
|
||||
Py_ssize_t cb_list_len;
|
||||
if((cb_list_len= PyList_GET_SIZE(cb_list)) > 0) {
|
||||
PyGILState_STATE gilstate= PyGILState_Ensure();
|
||||
|
||||
PyObject* args= PyTuple_New(1); // save python creating each call
|
||||
PyObject* func;
|
||||
PyObject* ret;
|
||||
Py_ssize_t pos;
|
||||
|
||||
/* setup arguments */
|
||||
if(id) {
|
||||
PointerRNA id_ptr;
|
||||
RNA_id_pointer_create(id, &id_ptr);
|
||||
PyTuple_SET_ITEM(args, 0, pyrna_struct_CreatePyObject(&id_ptr));
|
||||
}
|
||||
else {
|
||||
PyTuple_SET_ITEM(args, 0, Py_None);
|
||||
Py_INCREF(Py_None);
|
||||
}
|
||||
|
||||
// Iterate the list and run the callbacks
|
||||
for (pos=0; pos < cb_list_len; pos++) {
|
||||
func= PyList_GET_ITEM(cb_list, pos);
|
||||
ret= PyObject_Call(func, args, NULL);
|
||||
if (ret==NULL) {
|
||||
PyErr_Print();
|
||||
PyErr_Clear();
|
||||
}
|
||||
else {
|
||||
Py_DECREF(ret);
|
||||
}
|
||||
}
|
||||
|
||||
Py_DECREF(args);
|
||||
|
||||
PyGILState_Release(gilstate);
|
||||
}
|
||||
}
|
@ -1,8 +1,4 @@
|
||||
/*
|
||||
* blenlib/BLI_editVert.h mar 2001 Nzc
|
||||
*
|
||||
* These callbacks are needed in the lib
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
@ -21,26 +17,19 @@
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
* Contributor(s): Campbell Barton
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
/** \file blender/blenlib/intern/BLI_callbacks.h
|
||||
* \ingroup bli
|
||||
/** \file blender/python/intern/bpy_app_handlers.h
|
||||
* \ingroup pythonintern
|
||||
*/
|
||||
|
||||
#ifndef BPY_APP_HANDLERS_H
|
||||
#define BPY_APP_HANDLERS_H
|
||||
|
||||
#ifndef BLI_CALLBACKS_H
|
||||
#define BLI_CALLBACKS_H
|
||||
|
||||
// This is blenlib internal only
|
||||
void callLocalErrorCallBack(const char* msg);
|
||||
|
||||
#endif
|
||||
PyObject *BPY_app_handlers_struct(void);
|
||||
void BPY_app_handlers_clear(void);
|
||||
|
||||
#endif // BPY_APP_HANDLERS_H
|
@ -179,7 +179,9 @@ static struct _inittab bpy_internal_modules[]= {
|
||||
// {(char *)"mathutils.geometry", BPyInit_mathutils_geometry},
|
||||
{(char *)"bgl", BPyInit_bgl},
|
||||
{(char *)"blf", BPyInit_blf},
|
||||
#ifdef WITH_AUDASPACE
|
||||
{(char *)"aud", AUD_initPython},
|
||||
#endif
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
|
@ -38,7 +38,6 @@ set(INC
|
||||
../render/extern/include
|
||||
../include
|
||||
../windowmanager
|
||||
../../../intern/audaspace/intern
|
||||
../../../intern/guardedalloc
|
||||
)
|
||||
|
||||
@ -66,4 +65,11 @@ endif()
|
||||
|
||||
add_definitions(-DWITH_QUICKTIME)
|
||||
|
||||
if(WITH_AUDASPACE)
|
||||
list(APPEND INC
|
||||
../../../intern/audaspace/intern
|
||||
)
|
||||
add_definitions(-DWITH_AUDASPACE)
|
||||
endif()
|
||||
|
||||
blender_add_lib(bf_quicktime "${SRC}" "${INC}" "${INC_SYS}")
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user