forked from bartvdbraak/blender
Merged changes in the trunk up to revision 39661.
This commit is contained in:
commit
33bb1ed53e
@ -62,6 +62,22 @@ set(CMAKE_BUILD_TYPE_INIT "Release")
|
||||
# quiet output for Makefiles, 'make -s' helps too
|
||||
# set_property(GLOBAL PROPERTY RULE_MESSAGES OFF)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Set policy
|
||||
|
||||
# see "cmake --help-policy CMP0003"
|
||||
# So library linking is more sane
|
||||
cmake_policy(SET CMP0003 NEW)
|
||||
|
||||
# So BUILDINFO and BLENDERPATH strings are automatically quoted
|
||||
cmake_policy(SET CMP0005 NEW)
|
||||
|
||||
# So syntax problems are errors
|
||||
cmake_policy(SET CMP0010 NEW)
|
||||
|
||||
# Input directories must have CMakeLists.txt
|
||||
cmake_policy(SET CMP0014 NEW)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Load some macros.
|
||||
include(build_files/cmake/macros.cmake)
|
||||
@ -258,6 +274,11 @@ endif()
|
||||
|
||||
TEST_SSE_SUPPORT()
|
||||
|
||||
# don't store paths to libs for portable distrobution
|
||||
if(WITH_INSTALL_PORTABLE)
|
||||
set(CMAKE_SKIP_BUILD_RPATH TRUE)
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Initialize un-cached vars, avoid unused warning
|
||||
|
||||
@ -499,6 +520,9 @@ if(UNIX AND NOT APPLE)
|
||||
# GNU Compiler
|
||||
if(CMAKE_COMPILER_IS_GNUCC)
|
||||
set(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing")
|
||||
# CLang is the same as GCC for now.
|
||||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
set(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing")
|
||||
# Intel C++ Compiler
|
||||
elseif(CMAKE_C_COMPILER_ID MATCHES "Intel")
|
||||
# think these next two are broken
|
||||
@ -691,11 +715,11 @@ elseif(WIN32)
|
||||
${LIBDIR}/ffmpeg/include/msvc
|
||||
)
|
||||
set(FFMPEG_LIBRARIES
|
||||
${LIBDIR}/ffmpeg/lib/avcodec-52.lib
|
||||
${LIBDIR}/ffmpeg/lib/avformat-52.lib
|
||||
${LIBDIR}/ffmpeg/lib/avdevice-52.lib
|
||||
${LIBDIR}/ffmpeg/lib/avutil-50.lib
|
||||
${LIBDIR}/ffmpeg/lib/swscale-0.lib
|
||||
${LIBDIR}/ffmpeg/lib/avcodec-53.lib
|
||||
${LIBDIR}/ffmpeg/lib/avformat-53.lib
|
||||
${LIBDIR}/ffmpeg/lib/avdevice-53.lib
|
||||
${LIBDIR}/ffmpeg/lib/avutil-51.lib
|
||||
${LIBDIR}/ffmpeg/lib/swscale-2.lib
|
||||
)
|
||||
endif()
|
||||
|
||||
@ -822,7 +846,7 @@ elseif(WIN32)
|
||||
if(WITH_CODEC_FFMPEG)
|
||||
set(FFMPEG ${LIBDIR}/ffmpeg)
|
||||
set(FFMPEG_INCLUDE_DIRS ${FFMPEG}/include ${FFMPEG}/include)
|
||||
set(FFMPEG_LIBRARIES avcodec-52 avformat-52 avdevice-52 avutil-50 swscale-0)
|
||||
set(FFMPEG_LIBRARIES avcodec-53 avformat-53 avdevice-53 avutil-51 swscale-2)
|
||||
set(FFMPEG_LIBPATH ${FFMPEG}/lib)
|
||||
endif()
|
||||
|
||||
|
79
GNUmakefile
79
GNUmakefile
@ -35,17 +35,33 @@ OS_NCASE:=$(shell uname -s | tr '[A-Z]' '[a-z]')
|
||||
# Source and Build DIR's
|
||||
BLENDER_DIR:=$(shell pwd -P)
|
||||
BUILD_DIR:=$(shell dirname $(BLENDER_DIR))/build/$(OS_NCASE)
|
||||
BUILD_TYPE:=Release
|
||||
BUILD_CMAKE_ARGS:=""
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# additional targets for the build configuration
|
||||
|
||||
# support 'make debug'
|
||||
ifneq "$(findstring debug, $(MAKECMDGOALS))" ""
|
||||
BUILD_DIR:=$(BUILD_DIR)_debug
|
||||
BUILD_TYPE:=Debug
|
||||
else
|
||||
BUILD_TYPE:=Release
|
||||
endif
|
||||
ifneq "$(findstring lite, $(MAKECMDGOALS))" ""
|
||||
BUILD_DIR:=$(BUILD_DIR)_lite
|
||||
BUILD_CMAKE_ARGS:=$(BUILD_CMAKE_ARGS) -C$(BLENDER_DIR)/build_files/cmake/config/blender_lite.cmake
|
||||
endif
|
||||
ifneq "$(findstring headless, $(MAKECMDGOALS))" ""
|
||||
BUILD_DIR:=$(BUILD_DIR)_bpy
|
||||
BUILD_CMAKE_ARGS:=$(BUILD_CMAKE_ARGS) -C$(BLENDER_DIR)/build_files/cmake/config/blender_headless.cmake
|
||||
endif
|
||||
ifneq "$(findstring bpy, $(MAKECMDGOALS))" ""
|
||||
BUILD_DIR:=$(BUILD_DIR)_bpy
|
||||
BUILD_CMAKE_ARGS:=$(BUILD_CMAKE_ARGS) -C$(BLENDER_DIR)/build_files/cmake/config/bpy_module.cmake
|
||||
endif
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Get the number of cores for threaded build
|
||||
NPROCS:=1
|
||||
ifeq ($(OS), Linux)
|
||||
@ -61,14 +77,14 @@ ifeq ($(OS), NetBSD)
|
||||
NPROCS:=$(shell sysctl -a | grep "hw.ncpu " | cut -d" " -f3 )
|
||||
endif
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Build Blender
|
||||
all:
|
||||
@echo
|
||||
@echo Configuring Blender ...
|
||||
|
||||
if test ! -f $(BUILD_DIR)/CMakeCache.txt ; then \
|
||||
cmake -H$(BLENDER_DIR) -B$(BUILD_DIR) -DCMAKE_BUILD_TYPE:STRING=$(BUILD_TYPE) ; \
|
||||
cmake $(BUILD_CMAKE_ARGS) -H$(BLENDER_DIR) -B$(BUILD_DIR) -DCMAKE_BUILD_TYPE:STRING=$(BUILD_TYPE); \
|
||||
fi
|
||||
|
||||
@echo
|
||||
@ -80,9 +96,40 @@ all:
|
||||
@echo
|
||||
|
||||
debug: all
|
||||
# pass
|
||||
lite: all
|
||||
headless: all
|
||||
bpy: all
|
||||
|
||||
# package types
|
||||
# -----------------------------------------------------------------------------
|
||||
# Helo for build targets
|
||||
help:
|
||||
@echo ""
|
||||
@echo "Convenience targets provided for building blender, (multiple at once can be used)"
|
||||
@echo " * debug - build a debug binary"
|
||||
@echo " * lite - disable non essential features for a smaller binary and faster build"
|
||||
@echo " * headless - build without an interface (renderfarm or server automation)"
|
||||
@echo " * bpy - build as a python module which can be loaded from python directly"
|
||||
@echo ""
|
||||
@echo "Project Files for IDE's"
|
||||
@echo " * project_qtcreator - QtCreator Project Files"
|
||||
@echo " * project_netbeans - NetBeans Project Files"
|
||||
@echo " * project_eclipse - Eclipse CDT4 Project Files"
|
||||
@echo ""
|
||||
@echo "Package Targets"
|
||||
@echo " * package_debian - build a debian package"
|
||||
@echo " * package_pacman - build an arch linux pacmanpackage"
|
||||
@echo " * package_archive - build an archive package"
|
||||
@echo ""
|
||||
@echo "Testing Targets (not assosiated with building blender)"
|
||||
@echo " * test - run ctest, currently tests import/export, operator execution and that python modules load"
|
||||
@echo " * test_cmake - runs our own cmake file checker which detects errors in the cmake file list definitions"
|
||||
@echo " * test_pep8 - checks all python script are pep8 which are tagged to use the stricter formatting"
|
||||
@echo " * test_deprecated - checks for deprecation tags in our code which may need to be removed"
|
||||
@echo ""
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Packages
|
||||
#
|
||||
package_debian:
|
||||
cd build_files/package_spec ; DEB_BUILD_OPTIONS="parallel=$(NPROCS)" sh ./build_debian.sh
|
||||
|
||||
@ -93,7 +140,10 @@ package_archive:
|
||||
make -C $(BUILD_DIR) -s package_archive
|
||||
@echo archive in "$(BUILD_DIR)/release"
|
||||
|
||||
# forward build targets
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Tests
|
||||
#
|
||||
test:
|
||||
cd $(BUILD_DIR) ; ctest . --output-on-failure
|
||||
|
||||
@ -111,6 +161,21 @@ test_cmake:
|
||||
test_deprecated:
|
||||
python3 source/tests/check_deprecated.py
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Project Files
|
||||
#
|
||||
|
||||
project_qtcreator:
|
||||
python3 build_files/cmake/cmake_qtcreator_project.py $(BUILD_DIR)
|
||||
|
||||
project_netbeans:
|
||||
python3 build_files/cmake/cmake_netbeans_project.py $(BUILD_DIR)
|
||||
|
||||
project_eclipse:
|
||||
cmake -G"Eclipse CDT4 - Unix Makefiles" -H$(BLENDER_DIR) -B$(BUILD_DIR)
|
||||
|
||||
|
||||
clean:
|
||||
$(MAKE) -C $(BUILD_DIR) clean
|
||||
|
||||
|
13
SConstruct
13
SConstruct
@ -166,6 +166,13 @@ if sys.platform=='win32':
|
||||
|
||||
env.SConscriptChdir(0)
|
||||
|
||||
# Remove major kernel version from linux platform.
|
||||
# After Linus switched kernel to new version model this major version
|
||||
# shouldn't take much sense for building rules.
|
||||
|
||||
if re.match('linux[0-9]+', platform):
|
||||
platform = 'linux'
|
||||
|
||||
crossbuild = B.arguments.get('BF_CROSS', None)
|
||||
if crossbuild and platform not in ('win32-vc', 'win64-vc'):
|
||||
platform = 'linuxcross'
|
||||
@ -262,7 +269,7 @@ if env['OURPLATFORM']=='darwin':
|
||||
else:
|
||||
print B.bc.OKGREEN + "Found recommended sdk :" + B.bc.ENDC + " using MacOSX10.5.sdk"
|
||||
|
||||
# for now, Mac builders must download and install the driver framework from 3Dconnexion
|
||||
# for now, Mac builders must download and install the 3DxWare 10 Beta 4 driver framework from 3Dconnexion
|
||||
# necessary header file lives here when installed:
|
||||
# /Library/Frameworks/3DconnexionClient.framework/Versions/Current/Headers/ConnexionClientAPI.h
|
||||
if env['WITH_BF_3DMOUSE'] == 1 and not os.path.exists('/Library/Frameworks/3DconnexionClient.framework'):
|
||||
@ -551,7 +558,7 @@ if env['OURPLATFORM']!='darwin':
|
||||
scriptinstall.append(env.Install(dir=dir,source=source))
|
||||
|
||||
#-- icons
|
||||
if env['OURPLATFORM']=='linux2':
|
||||
if env['OURPLATFORM']=='linux':
|
||||
iconlist = []
|
||||
icontargetlist = []
|
||||
|
||||
@ -630,7 +637,7 @@ textinstall = env.Install(dir=env['BF_INSTALLDIR'], source=textlist)
|
||||
|
||||
if env['OURPLATFORM']=='darwin':
|
||||
allinstall = [blenderinstall, plugininstall, textinstall]
|
||||
elif env['OURPLATFORM']=='linux2':
|
||||
elif env['OURPLATFORM']=='linux':
|
||||
allinstall = [blenderinstall, dotblenderinstall, scriptinstall, plugininstall, textinstall, iconinstall]
|
||||
else:
|
||||
allinstall = [blenderinstall, dotblenderinstall, scriptinstall, plugininstall, textinstall]
|
||||
|
@ -22,7 +22,7 @@ BF_EXPAT_LIB = ''
|
||||
WITH_BF_FFMPEG = True
|
||||
WITH_BF_STATICFFMPEG = True
|
||||
|
||||
BF_FFMPEG = '/home/sources/staticlibs/ffmpeg-0.8'
|
||||
BF_FFMPEG = '/home/sources/staticlibs/ffmpeg'
|
||||
BF_FFMPEG_LIBPATH = '${BF_FFMPEG}/lib32'
|
||||
BF_FFMPEG_LIB_STATIC = '${BF_FFMPEG_LIBPATH}/libavformat.a ${BF_FFMPEG_LIBPATH}/libswscale.a ' + \
|
||||
'${BF_FFMPEG_LIBPATH}/libavcodec.a ${BF_FFMPEG_LIBPATH}/libavdevice.a ${BF_FFMPEG_LIBPATH}/libavutil.a ' + \
|
||||
|
@ -16,7 +16,7 @@ WITH_BF_COLLADA = False
|
||||
WITH_BF_FFMPEG = True
|
||||
WITH_BF_STATICFFMPEG = True
|
||||
|
||||
BF_FFMPEG = '/home/sources/staticlibs/ffmpeg-0.8'
|
||||
BF_FFMPEG = '/home/sources/staticlibs/ffmpeg'
|
||||
BF_FFMPEG_LIBPATH = '${BF_FFMPEG}/lib32'
|
||||
BF_FFMPEG_LIB_STATIC = '${BF_FFMPEG_LIBPATH}/libavformat.a ${BF_FFMPEG_LIBPATH}/libswscale.a ' + \
|
||||
'${BF_FFMPEG_LIBPATH}/libavcodec.a ${BF_FFMPEG_LIBPATH}/libavdevice.a ${BF_FFMPEG_LIBPATH}/libavutil.a ' + \
|
||||
|
@ -16,7 +16,7 @@ WITH_BF_COLLADA = False
|
||||
WITH_BF_FFMPEG = True
|
||||
WITH_BF_STATICFFMPEG = True
|
||||
|
||||
BF_FFMPEG = '/home/sources/staticlibs/ffmpeg-0.8'
|
||||
BF_FFMPEG = '/home/sources/staticlibs/ffmpeg'
|
||||
BF_FFMPEG_LIBPATH = '${BF_FFMPEG}/lib64'
|
||||
BF_FFMPEG_LIB_STATIC = '${BF_FFMPEG_LIBPATH}/libavformat.a ${BF_FFMPEG_LIBPATH}/libswscale.a ' + \
|
||||
'${BF_FFMPEG_LIBPATH}/libavcodec.a ${BF_FFMPEG_LIBPATH}/libavdevice.a ${BF_FFMPEG_LIBPATH}/libavutil.a ' + \
|
||||
|
@ -22,7 +22,7 @@ BF_EXPAT_LIB = ''
|
||||
WITH_BF_FFMPEG = True
|
||||
WITH_BF_STATICFFMPEG = True
|
||||
|
||||
BF_FFMPEG = '/home/sources/staticlibs/ffmpeg-0.8'
|
||||
BF_FFMPEG = '/home/sources/staticlibs/ffmpeg'
|
||||
BF_FFMPEG_LIBPATH = '${BF_FFMPEG}/lib64'
|
||||
BF_FFMPEG_LIB_STATIC = '${BF_FFMPEG_LIBPATH}/libavformat.a ${BF_FFMPEG_LIBPATH}/libswscale.a ' + \
|
||||
'${BF_FFMPEG_LIBPATH}/libavcodec.a ${BF_FFMPEG_LIBPATH}/libavdevice.a ${BF_FFMPEG_LIBPATH}/libavutil.a ' + \
|
||||
|
@ -108,32 +108,12 @@ else:
|
||||
|
||||
sys.exit(0)
|
||||
else:
|
||||
bitness = '32'
|
||||
# Switch to new FFmpeg library
|
||||
if builder.find('win') != -1:
|
||||
if builder.find('win32') != -1:
|
||||
LCGDIR = '#../lib/windows'
|
||||
elif builder.find('win64') != -1:
|
||||
LCGDIR = '#../lib/win64'
|
||||
bitness = '32'
|
||||
|
||||
if builder.find('win64') != -1:
|
||||
bitness = '64'
|
||||
|
||||
all_ffmpeg_libs = ['avcodec-53',
|
||||
'avdevice-53',
|
||||
'avformat-53',
|
||||
'avutil-51',
|
||||
'swscale-2']
|
||||
|
||||
ffmpeg_lib = []
|
||||
ffmpeg_dll = []
|
||||
|
||||
for lib in all_ffmpeg_libs:
|
||||
ffmpeg_lib.append(lib + '.lib')
|
||||
ffmpeg_dll.append('${BF_FFMPEG_LIBPATH}/' + lib + '.dll')
|
||||
|
||||
scons_options.append('BF_FFMPEG=' + LCGDIR + '/ffmpeg-0.8')
|
||||
scons_options.append('BF_FFMPEG_LIB=' + (' '.join(ffmpeg_lib)))
|
||||
scons_options.append('BF_FFMPEG_DLL=' + (' '.join(ffmpeg_dll)))
|
||||
|
||||
scons_options.append('BF_BITNESS=' + bitness)
|
||||
|
||||
retcode = subprocess.call(['python', 'scons/scons.py'] + scons_options)
|
||||
|
@ -72,32 +72,12 @@ if builder.find('scons') != -1:
|
||||
retcode = subprocess.call(['python', 'scons/scons.py'] + scons_options)
|
||||
sys.exit(retcode)
|
||||
else:
|
||||
bitness = '32'
|
||||
# Switch to new FFmpeg library
|
||||
if builder.find('win') != -1:
|
||||
if builder.find('win32') != -1:
|
||||
LCGDIR = '#../lib/windows'
|
||||
elif builder.find('win64') != -1:
|
||||
LCGDIR = '#../lib/win64'
|
||||
bitness = '32'
|
||||
|
||||
if builder.find('win64') != -1:
|
||||
bitness = '64'
|
||||
|
||||
all_ffmpeg_libs = ['avcodec-53',
|
||||
'avdevice-53',
|
||||
'avformat-53',
|
||||
'avutil-51',
|
||||
'swscale-2']
|
||||
|
||||
ffmpeg_lib = []
|
||||
ffmpeg_dll = []
|
||||
|
||||
for lib in all_ffmpeg_libs:
|
||||
ffmpeg_lib.append(lib + '.lib')
|
||||
ffmpeg_dll.append('${BF_FFMPEG_LIBPATH}/' + lib + '.dll')
|
||||
|
||||
scons_options.append('BF_FFMPEG=' + LCGDIR + '/ffmpeg-0.8')
|
||||
scons_options.append('BF_FFMPEG_LIB=' + (' '.join(ffmpeg_lib)))
|
||||
scons_options.append('BF_FFMPEG_DLL=' + (' '.join(ffmpeg_dll)))
|
||||
|
||||
scons_options.append('BF_BITNESS=' + bitness)
|
||||
|
||||
retcode = subprocess.call(['python', 'scons/scons.py'] + scons_options)
|
||||
|
@ -27,9 +27,9 @@ endif()
|
||||
|
||||
# Write a file with the SVNVERSION define
|
||||
file(WRITE buildinfo.h.txt
|
||||
"#define BUILD_REV ${MY_WC_REVISION}\n"
|
||||
"#define BUILD_DATE ${BUILD_DATE}\n"
|
||||
"#define BUILD_TIME ${BUILD_TIME}\n"
|
||||
"#define BUILD_REV \"${MY_WC_REVISION}\"\n"
|
||||
"#define BUILD_DATE \"${BUILD_DATE}\"\n"
|
||||
"#define BUILD_TIME \"${BUILD_TIME}\"\n"
|
||||
)
|
||||
|
||||
# Copy the file to the final header only if the version changes
|
||||
|
24
build_files/cmake/config/blender_headless.cmake
Normal file
24
build_files/cmake/config/blender_headless.cmake
Normal file
@ -0,0 +1,24 @@
|
||||
# headless configuration, useful in for servers or renderfarms
|
||||
# builds without a windowing system (X11/Windows/Cocoa).
|
||||
#
|
||||
# Example usage:
|
||||
# cmake -C../blender/build_files/cmake/config/blender_headless.cmake ../blender
|
||||
#
|
||||
|
||||
set(WITH_HEADLESS ON CACHE FORCE BOOL)
|
||||
set(WITH_GAMEENGINE OFF CACHE FORCE BOOL)
|
||||
|
||||
# disable audio, its possible some devs may want this but for now disable
|
||||
# so the python module doesnt hold the audio device and loads quickly.
|
||||
set(WITH_AUDASPACE OFF CACHE FORCE BOOL)
|
||||
set(WITH_SAMPLERATE OFF CACHE FORCE BOOL)
|
||||
set(WITH_FFTW3 OFF CACHE FORCE BOOL)
|
||||
set(WITH_JACK OFF CACHE FORCE BOOL)
|
||||
set(WITH_SDL OFF CACHE FORCE BOOL)
|
||||
set(WITH_OPENAL OFF CACHE FORCE BOOL)
|
||||
set(WITH_CODEC_FFMPEG OFF CACHE FORCE BOOL)
|
||||
set(WITH_CODEC_SNDFILE OFF CACHE FORCE BOOL)
|
||||
|
||||
# other features which are not especially useful as a python module
|
||||
set(WITH_X11_XINPUT OFF CACHE FORCE BOOL)
|
||||
set(WITH_INPUT_NDOF OFF CACHE FORCE BOOL)
|
43
build_files/cmake/config/blender_lite.cmake
Normal file
43
build_files/cmake/config/blender_lite.cmake
Normal file
@ -0,0 +1,43 @@
|
||||
# turn everything OFF CACHE FORCE BOOL) except for python which defaults to ON
|
||||
# and is needed for the UI
|
||||
#
|
||||
# Example usage:
|
||||
# cmake -C../blender/build_files/cmake/config/blender_lite.cmake ../blender
|
||||
#
|
||||
|
||||
set(WITH_INSTALL_PORTABLE ON CACHE FORCE BOOL)
|
||||
|
||||
set(WITH_BUILDINFO OFF CACHE FORCE BOOL)
|
||||
set(WITH_BUILTIN_GLEW OFF CACHE FORCE BOOL)
|
||||
set(WITH_BULLET OFF CACHE FORCE BOOL)
|
||||
set(WITH_CODEC_FFMPEG OFF CACHE FORCE BOOL)
|
||||
set(WITH_CODEC_SNDFILE OFF CACHE FORCE BOOL)
|
||||
set(WITH_FFTW3 OFF CACHE FORCE BOOL)
|
||||
set(WITH_GAMEENGINE OFF CACHE FORCE BOOL)
|
||||
set(WITH_IK_ITASC OFF CACHE FORCE BOOL)
|
||||
set(WITH_IMAGE_CINEON OFF CACHE FORCE BOOL)
|
||||
set(WITH_IMAGE_DDS OFF CACHE FORCE BOOL)
|
||||
set(WITH_IMAGE_FRAMESERVER OFF CACHE FORCE BOOL)
|
||||
set(WITH_IMAGE_HDR OFF CACHE FORCE BOOL)
|
||||
set(WITH_IMAGE_OPENEXR OFF CACHE FORCE BOOL)
|
||||
set(WITH_IMAGE_OPENJPEG OFF CACHE FORCE BOOL)
|
||||
set(WITH_IMAGE_REDCODE OFF CACHE FORCE BOOL)
|
||||
set(WITH_IMAGE_TIFF OFF CACHE FORCE BOOL)
|
||||
set(WITH_INPUT_NDOF OFF CACHE FORCE BOOL)
|
||||
set(WITH_INTERNATIONAL OFF CACHE FORCE BOOL)
|
||||
set(WITH_JACK OFF CACHE FORCE BOOL)
|
||||
set(WITH_LZMA OFF CACHE FORCE BOOL)
|
||||
set(WITH_LZO OFF CACHE FORCE BOOL)
|
||||
set(WITH_MOD_BOOLEAN OFF CACHE FORCE BOOL)
|
||||
set(WITH_MOD_DECIMATE OFF CACHE FORCE BOOL)
|
||||
set(WITH_MOD_FLUID OFF CACHE FORCE BOOL)
|
||||
set(WITH_MOD_SMOKE OFF CACHE FORCE BOOL)
|
||||
set(WITH_AUDASPACE OFF CACHE FORCE BOOL)
|
||||
set(WITH_OPENAL OFF CACHE FORCE BOOL)
|
||||
set(WITH_OPENCOLLADA OFF CACHE FORCE BOOL)
|
||||
set(WITH_OPENMP OFF CACHE FORCE BOOL)
|
||||
set(WITH_PYTHON_INSTALL OFF CACHE FORCE BOOL)
|
||||
set(WITH_RAYOPTIMIZATION OFF CACHE FORCE BOOL)
|
||||
set(WITH_SAMPLERATE OFF CACHE FORCE BOOL)
|
||||
set(WITH_SDL OFF CACHE FORCE BOOL)
|
||||
set(WITH_X11_XINPUT OFF CACHE FORCE BOOL)
|
34
build_files/cmake/config/bpy_module.cmake
Normal file
34
build_files/cmake/config/bpy_module.cmake
Normal file
@ -0,0 +1,34 @@
|
||||
# defaults for building blender as a python module 'bpy'
|
||||
#
|
||||
# Example usage:
|
||||
# cmake -C../blender/build_files/cmake/config/bpy_module.cmake ../blender
|
||||
#
|
||||
|
||||
set(WITH_PYTHON_MODULE ON CACHE FORCE BOOL)
|
||||
|
||||
# install into the systems python dir
|
||||
set(WITH_INSTALL_PORTABLE OFF CACHE FORCE BOOL)
|
||||
|
||||
# no point int copying python into python
|
||||
set(WITH_PYTHON_INSTALL OFF CACHE FORCE BOOL)
|
||||
|
||||
# dont build the game engine
|
||||
set(WITH_GAMEENGINE OFF CACHE FORCE BOOL)
|
||||
|
||||
# disable audio, its possible some devs may want this but for now disable
|
||||
# so the python module doesnt hold the audio device and loads quickly.
|
||||
set(WITH_AUDASPACE OFF CACHE FORCE BOOL)
|
||||
set(WITH_SAMPLERATE OFF CACHE FORCE BOOL)
|
||||
set(WITH_FFTW3 OFF CACHE FORCE BOOL)
|
||||
set(WITH_JACK OFF CACHE FORCE BOOL)
|
||||
set(WITH_SDL OFF CACHE FORCE BOOL)
|
||||
set(WITH_OPENAL OFF CACHE FORCE BOOL)
|
||||
set(WITH_CODEC_FFMPEG OFF CACHE FORCE BOOL)
|
||||
set(WITH_CODEC_SNDFILE OFF CACHE FORCE BOOL)
|
||||
|
||||
# other features which are not especially useful as a python module
|
||||
set(WITH_X11_XINPUT OFF CACHE FORCE BOOL)
|
||||
set(WITH_INPUT_NDOF OFF CACHE FORCE BOOL)
|
||||
set(WITH_OPENCOLLADA OFF CACHE FORCE BOOL)
|
||||
set(WITH_INTERNATIONAL OFF CACHE FORCE BOOL)
|
||||
set(WITH_BULLET OFF CACHE FORCE BOOL)
|
@ -145,11 +145,6 @@ endmacro()
|
||||
|
||||
|
||||
macro(SETUP_LIBDIRS)
|
||||
# see "cmake --help-policy CMP0003"
|
||||
if(COMMAND cmake_policy)
|
||||
cmake_policy(SET CMP0003 NEW)
|
||||
endif()
|
||||
|
||||
link_directories(${JPEG_LIBPATH} ${PNG_LIBPATH} ${ZLIB_LIBPATH} ${FREETYPE_LIBPATH})
|
||||
|
||||
if(WITH_PYTHON) # AND NOT WITH_PYTHON_MODULE # WIN32 needs
|
||||
|
@ -1,4 +1,4 @@
|
||||
LCGDIR = '../lib/linux2'
|
||||
LCGDIR = '../lib/linux'
|
||||
LIBDIR = "${LCGDIR}"
|
||||
|
||||
BF_PYTHON_ABI_FLAGS = 'm' # Most common for linux distros
|
||||
@ -241,8 +241,8 @@ BF_PROFILE_LINKFLAGS = ['-pg']
|
||||
BF_DEBUG = False
|
||||
BF_DEBUG_CCFLAGS = ['-g', '-D_DEBUG']
|
||||
|
||||
BF_BUILDDIR = '../build/linux2'
|
||||
BF_INSTALLDIR='../install/linux2'
|
||||
BF_BUILDDIR = '../build/linux'
|
||||
BF_INSTALLDIR='../install/linux'
|
||||
|
||||
#Link against pthread
|
||||
PLATFORM_LINKFLAGS = ['-pthread']
|
@ -126,9 +126,10 @@ WITH_BF_BINRELOC = False
|
||||
# enable ffmpeg support
|
||||
WITH_BF_FFMPEG = True # -DWITH_FFMPEG
|
||||
BF_FFMPEG = LIBDIR + '/ffmpeg'
|
||||
BF_FFMPEG_LIB = 'avformat-52 avcodec-52 avdevice-52 avutil-50 swscale-0'
|
||||
BF_FFMPEG_LIB = 'avformat-53 avcodec-53 avdevice-53 avutil-51 swscale-2'
|
||||
BF_FFMPEG_INC = '${BF_FFMPEG}/include'
|
||||
BF_FFMPEG_LIBPATH = '${BF_FFMPEG}/lib'
|
||||
BF_FFMPEG_DLL = '${BF_FFMPEG_LIBPATH}/avformat-53.dll ${BF_FFMPEG_LIBPATH}/avcodec-53.dll ${BF_FFMPEG_LIBPATH}/avdevice-53.dll ${BF_FFMPEG_LIBPATH}/avutil-51.dll ${BF_FFMPEG_LIBPATH}/swscale-2.dll'
|
||||
|
||||
WITH_BF_OPENJPEG = True
|
||||
BF_OPENJPEG = '#extern/libopenjpeg'
|
||||
|
@ -18,9 +18,10 @@ BF_OPENAL_LIB = 'wrap_oal'
|
||||
BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
|
||||
|
||||
WITH_BF_FFMPEG = False
|
||||
BF_FFMPEG_LIB = 'avformat-52 avcodec-52 avdevice-52 avutil-50 swscale-0'
|
||||
BF_FFMPEG_LIB = 'avformat-53 avcodec-53 avdevice-53 avutil-51 swscale-2'
|
||||
BF_FFMPEG_LIBPATH = LIBDIR + '/ffmpeg/lib'
|
||||
BF_FFMPEG_INC = LIBDIR + '/ffmpeg/include'
|
||||
BF_FFMPEG_DLL = '${BF_FFMPEG_LIBPATH}/avformat-53.dll ${BF_FFMPEG_LIBPATH}/avcodec-53.dll ${BF_FFMPEG_LIBPATH}/avdevice-53.dll ${BF_FFMPEG_LIBPATH}/avutil-51.dll ${BF_FFMPEG_LIBPATH}/swscale-2.dll'
|
||||
|
||||
BF_LIBSAMPLERATE = LIBDIR + '/samplerate'
|
||||
BF_LIBSAMPLERATE_INC = '${BF_LIBSAMPLERATE}/include'
|
||||
|
@ -6,8 +6,8 @@ WITH_BF_FFMPEG = True # -DWITH_FFMPEG
|
||||
BF_FFMPEG = LIBDIR +'/ffmpeg'
|
||||
BF_FFMPEG_INC = '${BF_FFMPEG}/include ${BF_FFMPEG}/include/msvc'
|
||||
BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
|
||||
BF_FFMPEG_LIB = 'avformat-52.lib avcodec-52.lib avdevice-52.lib avutil-50.lib swscale-0.lib'
|
||||
BF_FFMPEG_DLL = '${BF_FFMPEG_LIBPATH}/avformat-52.dll ${BF_FFMPEG_LIBPATH}/avcodec-52.dll ${BF_FFMPEG_LIBPATH}/avdevice-52.dll ${BF_FFMPEG_LIBPATH}/avutil-50.dll ${BF_FFMPEG_LIBPATH}/swscale-0.dll'
|
||||
BF_FFMPEG_LIB = 'avformat-53.lib avcodec-53.lib avdevice-53.lib avutil-51.lib swscale-2.lib'
|
||||
BF_FFMPEG_DLL = '${BF_FFMPEG_LIBPATH}/avformat-53.dll ${BF_FFMPEG_LIBPATH}/avcodec-53.dll ${BF_FFMPEG_LIBPATH}/avdevice-53.dll ${BF_FFMPEG_LIBPATH}/avutil-51.dll ${BF_FFMPEG_LIBPATH}/swscale-2.dll'
|
||||
|
||||
BF_PYTHON = LIBDIR + '/python'
|
||||
BF_PYTHON_VERSION = '3.2'
|
||||
|
@ -6,8 +6,8 @@ WITH_BF_FFMPEG = True # -DWITH_FFMPEG
|
||||
BF_FFMPEG = LIBDIR +'/ffmpeg'
|
||||
BF_FFMPEG_INC = '${BF_FFMPEG}/include ${BF_FFMPEG}/include/msvc '
|
||||
BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
|
||||
BF_FFMPEG_LIB = 'avformat-52.lib avcodec-52.lib avdevice-52.lib avutil-50.lib swscale-0.lib'
|
||||
BF_FFMPEG_DLL = '${BF_FFMPEG_LIBPATH}/avformat-52.dll ${BF_FFMPEG_LIBPATH}/avcodec-52.dll ${BF_FFMPEG_LIBPATH}/avdevice-52.dll ${BF_FFMPEG_LIBPATH}/avutil-50.dll ${BF_FFMPEG_LIBPATH}/swscale-0.dll'
|
||||
BF_FFMPEG_LIB = 'avformat-53.lib avcodec-53.lib avdevice-53.lib avutil-51.lib swscale-2.lib'
|
||||
BF_FFMPEG_DLL = '${BF_FFMPEG_LIBPATH}/avformat-53.dll ${BF_FFMPEG_LIBPATH}/avcodec-53.dll ${BF_FFMPEG_LIBPATH}/avdevice-53.dll ${BF_FFMPEG_LIBPATH}/avutil-51.dll ${BF_FFMPEG_LIBPATH}/swscale-2.dll'
|
||||
|
||||
BF_PYTHON = LIBDIR + '/python'
|
||||
BF_PYTHON_VERSION = '3.2'
|
||||
|
@ -206,7 +206,7 @@ def setup_staticlibs(lenv):
|
||||
if lenv['WITH_BF_STATICJEMALLOC']:
|
||||
statlibs += Split(lenv['BF_JEMALLOC_LIB_STATIC'])
|
||||
|
||||
if lenv['OURPLATFORM']=='linux2':
|
||||
if lenv['OURPLATFORM']=='linux':
|
||||
if lenv['WITH_BF_3DMOUSE']:
|
||||
libincs += Split(lenv['BF_3DMOUSE_LIBPATH'])
|
||||
if lenv['WITH_BF_STATIC3DMOUSE']:
|
||||
@ -277,7 +277,7 @@ def setup_syslibs(lenv):
|
||||
if not lenv['WITH_BF_STATICJEMALLOC']:
|
||||
syslibs += Split(lenv['BF_JEMALLOC_LIB'])
|
||||
|
||||
if lenv['OURPLATFORM']=='linux2':
|
||||
if lenv['OURPLATFORM']=='linux':
|
||||
if lenv['WITH_BF_3DMOUSE']:
|
||||
if not lenv['WITH_BF_STATIC3DMOUSE']:
|
||||
syslibs += Split(lenv['BF_3DMOUSE_LIB'])
|
||||
@ -364,16 +364,16 @@ def buildinfo(lenv, build_type):
|
||||
|
||||
obj = []
|
||||
if lenv['BF_BUILDINFO']:
|
||||
lenv.Append (CPPDEFINES = ['BUILD_TIME="%s"'%(build_time),
|
||||
'BUILD_DATE="%s"'%(build_date),
|
||||
'BUILD_TYPE="%s"'%(build_type),
|
||||
'BUILD_REV="%s"'%(build_rev),
|
||||
'NAN_BUILDINFO',
|
||||
'BUILD_PLATFORM="%s:%s"'%(platform.system(), platform.architecture()[0]),
|
||||
lenv.Append (CPPDEFINES = ['BUILD_TIME=\\"%s\\"'%(build_time),
|
||||
'BUILD_DATE=\\"%s\\"'%(build_date),
|
||||
'BUILD_TYPE=\\"%s\\"'%(build_type),
|
||||
'BUILD_REV=\\"%s\\"'%(build_rev),
|
||||
'WITH_BUILDINFO',
|
||||
'BUILD_PLATFORM=\\"%s:%s\\"'%(platform.system(), platform.architecture()[0]),
|
||||
'BUILD_CFLAGS=\\"%s\\"'%(build_cflags),
|
||||
'BUILD_CXXFLAGS=\\"%s\\"'%(build_cxxflags),
|
||||
'BUILD_LINKFLAGS=\\"%s\\"'%(build_linkflags),
|
||||
'BUILD_SYSTEM="SCons"'
|
||||
'BUILD_SYSTEM=\\"SCons\\"'
|
||||
])
|
||||
|
||||
lenv.Append (CPPPATH = [root_build_dir+'source/blender/blenkernel'])
|
||||
@ -775,7 +775,7 @@ class BlenderEnvironment(SConsEnvironment):
|
||||
if lenv['OURPLATFORM'] in ('win32-vc', 'cygwin', 'win64-vc'):
|
||||
if lenv['BF_DEBUG']:
|
||||
lenv.Prepend(LINKFLAGS = ['/DEBUG','/PDB:'+progname+'.pdb','/NODEFAULTLIB:libcmt'])
|
||||
if lenv['OURPLATFORM']=='linux2':
|
||||
if lenv['OURPLATFORM']=='linux':
|
||||
if lenv['WITH_BF_PYTHON']:
|
||||
lenv.Append(LINKFLAGS = lenv['BF_PYTHON_LINKFLAGS'])
|
||||
if lenv['OURPLATFORM']=='sunos5':
|
||||
|
@ -568,7 +568,7 @@ def buildslave(target=None, source=None, env=None):
|
||||
extension = '.tar.bz2'
|
||||
|
||||
platform = env['OURPLATFORM'].split('-')[0]
|
||||
if platform == 'linux2':
|
||||
if platform == 'linux':
|
||||
import platform
|
||||
|
||||
bitness = platform.architecture()[0]
|
||||
|
@ -27,7 +27,7 @@ $Id$
|
||||
filenames have the form (platform)-config.py, where platform one of:
|
||||
|
||||
* darwin
|
||||
* linux2
|
||||
* linux
|
||||
* win32-mingw
|
||||
* win32-vc
|
||||
|
||||
|
@ -76,7 +76,7 @@ $Id$
|
||||
$BLENDERHOME/config. Your platform specific defaults are in
|
||||
(platform)-config.py, where platform is one of:
|
||||
|
||||
- linux2, for machines running Linux
|
||||
- linux, for machines running Linux
|
||||
- win32-vc, for Windows machines, compiling with a Microsoft compiler
|
||||
- win32-mingw, for Windows machines, compiling with the MingW compiler
|
||||
- darwin, for OS X machines
|
||||
|
19
doc/python_api/examples/bpy.types.ID.user_clear.1.py
Normal file
19
doc/python_api/examples/bpy.types.ID.user_clear.1.py
Normal file
@ -0,0 +1,19 @@
|
||||
"""
|
||||
User Clear
|
||||
++++++++++
|
||||
This function is for advanced use only, misuse can crash blender since the user
|
||||
count is used to prevent data being removed when it is used.
|
||||
"""
|
||||
|
||||
# This example shows what _not_ to do, and will crash blender.
|
||||
import bpy
|
||||
|
||||
# object which is in the scene.
|
||||
obj = bpy.data.objects["Cube"]
|
||||
|
||||
# without this, removal would raise an error.
|
||||
obj.user_clear()
|
||||
|
||||
# runs without an exception
|
||||
# but will crash on redraw.
|
||||
bpy.data.objects.remove(obj)
|
@ -74,10 +74,10 @@ else:
|
||||
"bpy.props",
|
||||
"bpy.utils",
|
||||
"bpy.context",
|
||||
"bpy.types", # supports filtering
|
||||
#"bpy.types", # supports filtering
|
||||
"bpy.ops", # supports filtering
|
||||
"bpy_extras",
|
||||
# "bge",
|
||||
"bge",
|
||||
"aud",
|
||||
"bgl",
|
||||
"blf",
|
||||
@ -86,7 +86,7 @@ else:
|
||||
"Freestyle",
|
||||
)
|
||||
|
||||
FILTER_BPY_TYPES = ("bpy_struct", "Panel", "Menu", "Operator", "RenderEngine") # allow
|
||||
FILTER_BPY_TYPES = ("bpy_struct", "Panel", "ID") # allow
|
||||
FILTER_BPY_OPS = ("import.scene", ) # allow
|
||||
|
||||
# for quick rebuilds
|
||||
@ -752,6 +752,8 @@ def pyrna2sphinx(BASEPATH):
|
||||
descr = prop.name
|
||||
fw(" `%s`, %s, %s\n\n" % (prop.identifier, descr, type_descr))
|
||||
|
||||
write_example_ref(" ", fw, "bpy.types." + struct.identifier + "." + func.identifier)
|
||||
|
||||
fw("\n")
|
||||
|
||||
# python methods
|
||||
|
4
extern/bullet2/src/SConscript
vendored
4
extern/bullet2/src/SConscript
vendored
@ -11,10 +11,10 @@ if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
|
||||
defs += ' WIN32 NDEBUG _WINDOWS'
|
||||
#cflags += ['/MT', '/W3', '/GX', '/O2', '/Op']
|
||||
cflags += ['/MT', '/W3', '/GX', '/Og', '/Ot', '/Ob1', '/Op', '/G6', '/O3', '/EHcs']
|
||||
elif env['OURPLATFORM']=='win32-mingw':
|
||||
elif env['OURPLATFORM'] in ('win32-mingw', 'linuxcross'):
|
||||
defs += ' NDEBUG'
|
||||
cflags += ['-O2']
|
||||
elif sys.platform=='linux2' or sys.platform=='linux-i386' or sys.platform=='freebsd4' or sys.platform=='freebsd5':
|
||||
elif env['OURPLATFORM'] in ('linux', 'freebsd4', 'freebsd5'):
|
||||
defs += ' NDEBUG'
|
||||
cflags += ['-O2']
|
||||
elif sys.platform=='darwin':
|
||||
|
@ -26,7 +26,7 @@ if env['WITH_GHOST_SDL']:
|
||||
pass
|
||||
incs += ' ' + env['BF_SDL_INC']
|
||||
defs += ['WITH_GHOST_SDL']
|
||||
elif window_system in ('linux2', 'openbsd3', 'sunos5', 'freebsd7', 'freebsd8', 'freebsd9', 'irix6', 'aix4', 'aix5'):
|
||||
elif window_system in ('linux', 'openbsd3', 'sunos5', 'freebsd7', 'freebsd8', 'freebsd9', 'irix6', 'aix4', 'aix5'):
|
||||
for f in pf:
|
||||
try:
|
||||
sources.remove('intern' + os.sep + f + 'Win32.cpp')
|
||||
@ -81,7 +81,7 @@ else:
|
||||
if env['WITH_BF_3DMOUSE']:
|
||||
defs.append('WITH_INPUT_NDOF')
|
||||
|
||||
if env['OURPLATFORM']=='linux2':
|
||||
if env['OURPLATFORM']=='linux':
|
||||
incs += ' ' + env['BF_3DMOUSE_INC']
|
||||
else:
|
||||
sources.remove('intern' + os.sep + 'GHOST_NDOFManager.cpp')
|
||||
|
@ -43,6 +43,7 @@ public:
|
||||
// whether multi-axis functionality is available (via the OS or driver)
|
||||
// does not imply that a device is plugged in or being used
|
||||
bool available();
|
||||
bool oldDRV();
|
||||
|
||||
private:
|
||||
unsigned short m_clientID;
|
||||
|
@ -143,7 +143,7 @@ GHOST_NDOFManagerCocoa::GHOST_NDOFManagerCocoa(GHOST_System& sys)
|
||||
|
||||
// printf("ndof: client id = %d\n", m_clientID);
|
||||
|
||||
if (SetConnexionClientButtonMask != NULL) {
|
||||
if (oldDRV()) {
|
||||
has_old_driver = false;
|
||||
SetConnexionClientButtonMask(m_clientID, kConnexionMaskAllButtons);
|
||||
}
|
||||
@ -176,5 +176,14 @@ extern "C" {
|
||||
return InstallConnexionHandlers != NULL;
|
||||
// this means that the driver is installed and dynamically linked to blender
|
||||
}
|
||||
|
||||
bool GHOST_NDOFManagerCocoa::oldDRV()
|
||||
{
|
||||
extern OSErr SetConnexionClientButtonMask() __attribute__((weak_import));
|
||||
// Make the linker happy for the framework check (see link below for more info)
|
||||
// http://developer.apple.com/documentation/MacOSX/Conceptual/BPFrameworks/Concepts/WeakLinking.html
|
||||
return SetConnexionClientButtonMask != NULL;
|
||||
// this means that the driver has this symbol
|
||||
}
|
||||
}
|
||||
#endif // WITH_INPUT_NDOF
|
||||
|
@ -385,8 +385,26 @@ GHOST_SystemSDL::processEvent(SDL_Event *sdl_event)
|
||||
|
||||
GHOST_TKey gkey= convertSDLKey(sdl_sub_evt.keysym.scancode);
|
||||
/* note, the sdl_sub_evt.keysym.sym is truncated, for unicode support ghost has to be modified */
|
||||
/* printf("%d\n", sym); */
|
||||
if(sym > 127) {
|
||||
sym= 0;
|
||||
switch(sym) {
|
||||
case SDLK_KP_DIVIDE: sym= '/'; break;
|
||||
case SDLK_KP_MULTIPLY: sym= '*'; break;
|
||||
case SDLK_KP_MINUS: sym= '-'; break;
|
||||
case SDLK_KP_PLUS: sym= '+'; break;
|
||||
case SDLK_KP_1: sym= '1'; break;
|
||||
case SDLK_KP_2: sym= '2'; break;
|
||||
case SDLK_KP_3: sym= '3'; break;
|
||||
case SDLK_KP_4: sym= '4'; break;
|
||||
case SDLK_KP_5: sym= '5'; break;
|
||||
case SDLK_KP_6: sym= '6'; break;
|
||||
case SDLK_KP_7: sym= '7'; break;
|
||||
case SDLK_KP_8: sym= '8'; break;
|
||||
case SDLK_KP_9: sym= '9'; break;
|
||||
case SDLK_KP_0: sym= '0'; break;
|
||||
case SDLK_KP_PERIOD: sym= '.'; break;
|
||||
default: sym= 0; break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(sdl_sub_evt.keysym.mod & (KMOD_LSHIFT|KMOD_RSHIFT)) {
|
||||
|
@ -612,7 +612,6 @@ GHOST_TSuccess GHOST_WindowWin32::setState(GHOST_TWindowState state)
|
||||
wp.showCmd = SW_SHOWMINIMIZED;
|
||||
break;
|
||||
case GHOST_kWindowStateMaximized:
|
||||
ShowWindow(m_hWnd, SW_HIDE);
|
||||
wp.showCmd = SW_SHOWMAXIMIZED;
|
||||
SetWindowLongPtr(m_hWnd, GWL_STYLE, WS_OVERLAPPEDWINDOW);
|
||||
break;
|
||||
@ -629,11 +628,11 @@ GHOST_TSuccess GHOST_WindowWin32::setState(GHOST_TWindowState state)
|
||||
break;
|
||||
case GHOST_kWindowStateNormal:
|
||||
default:
|
||||
ShowWindow(m_hWnd, SW_HIDE);
|
||||
wp.showCmd = SW_SHOWNORMAL;
|
||||
SetWindowLongPtr(m_hWnd, GWL_STYLE, WS_OVERLAPPEDWINDOW);
|
||||
break;
|
||||
}
|
||||
SetWindowPos(m_hWnd, 0, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED); /*Clears window cache for SetWindowLongPtr */
|
||||
return ::SetWindowPlacement(m_hWnd, &wp) == TRUE ? GHOST_kSuccess : GHOST_kFailure;
|
||||
}
|
||||
|
||||
|
@ -439,7 +439,7 @@ def path_reference_copy(copy_set, report=print):
|
||||
shutil.copy(file_src, file_dst)
|
||||
|
||||
|
||||
def unique_name(key, name, name_dict, name_max=-1, clean_func=None):
|
||||
def unique_name(key, name, name_dict, name_max=-1, clean_func=None, sep="."):
|
||||
"""
|
||||
Helper function for storing unique names which may have special characters
|
||||
stripped and restricted to a maximum length.
|
||||
@ -456,6 +456,9 @@ def unique_name(key, name, name_dict, name_max=-1, clean_func=None):
|
||||
:type name_dict: dict
|
||||
:arg clean_func: Function to call on *name* before creating a unique value.
|
||||
:type clean_func: function
|
||||
:arg sep: Separator to use when between the name and a number when a
|
||||
duplicate name is found.
|
||||
:type sep: string
|
||||
"""
|
||||
name_new = name_dict.get(key)
|
||||
if name_new is None:
|
||||
@ -466,14 +469,15 @@ def unique_name(key, name, name_dict, name_max=-1, clean_func=None):
|
||||
|
||||
if name_max == -1:
|
||||
while name_new in name_dict_values:
|
||||
name_new = "%s.%03d" % (name_new_orig, count)
|
||||
name_new = "%s%s%03d" % (name_new_orig, sep, count)
|
||||
count += 1
|
||||
else:
|
||||
name_new = name_new[:name_max]
|
||||
while name_new in name_dict_values:
|
||||
count_str = "%03d" % count
|
||||
name_new = "%.*s.%s" % (name_max - (len(count_str) + 1),
|
||||
name_new = "%.*s%s%s" % (name_max - (len(count_str) + 1),
|
||||
name_new_orig,
|
||||
sep,
|
||||
count_str,
|
||||
)
|
||||
count += 1
|
||||
|
@ -426,7 +426,7 @@ def ngon_tesselate(from_data, indices, fix_loops=True):
|
||||
# See if its flipped the wrong way.
|
||||
flip = None
|
||||
for fi in fill:
|
||||
if flip != None:
|
||||
if flip is not None:
|
||||
break
|
||||
for i, vi in enumerate(fi):
|
||||
if vi == 0 and fi[i - 1] == 1:
|
||||
|
@ -88,36 +88,62 @@ class AddTorus(Operator):
|
||||
bl_label = "Add Torus"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
major_radius = FloatProperty(name="Major Radius",
|
||||
major_radius = FloatProperty(
|
||||
name="Major Radius",
|
||||
description=("Radius from the origin to the "
|
||||
"center of the cross sections"),
|
||||
default=1.0, min=0.01, max=100.0)
|
||||
minor_radius = FloatProperty(name="Minor Radius",
|
||||
min=0.01, max=100.0,
|
||||
default=1.0,
|
||||
)
|
||||
minor_radius = FloatProperty(
|
||||
name="Minor Radius",
|
||||
description="Radius of the torus' cross section",
|
||||
default=0.25, min=0.01, max=100.0)
|
||||
major_segments = IntProperty(name="Major Segments",
|
||||
min=0.01, max=100.0,
|
||||
default=0.25,
|
||||
)
|
||||
major_segments = IntProperty(
|
||||
name="Major Segments",
|
||||
description="Number of segments for the main ring of the torus",
|
||||
default=48, min=3, max=256)
|
||||
minor_segments = IntProperty(name="Minor Segments",
|
||||
min=3, max=256,
|
||||
default=48,
|
||||
)
|
||||
minor_segments = IntProperty(
|
||||
name="Minor Segments",
|
||||
description="Number of segments for the minor ring of the torus",
|
||||
default=12, min=3, max=256)
|
||||
use_abso = BoolProperty(name="Use Int+Ext Controls",
|
||||
min=3, max=256,
|
||||
default=12,
|
||||
)
|
||||
use_abso = BoolProperty(
|
||||
name="Use Int+Ext Controls",
|
||||
description="Use the Int / Ext controls for torus dimensions",
|
||||
default=False)
|
||||
abso_major_rad = FloatProperty(name="Exterior Radius",
|
||||
default=False,
|
||||
)
|
||||
abso_major_rad = FloatProperty(
|
||||
name="Exterior Radius",
|
||||
description="Total Exterior Radius of the torus",
|
||||
default=1.0, min=0.01, max=100.0)
|
||||
abso_minor_rad = FloatProperty(name="Inside Radius",
|
||||
min=0.01, max=100.0,
|
||||
default=1.0,
|
||||
)
|
||||
abso_minor_rad = FloatProperty(
|
||||
name="Inside Radius",
|
||||
description="Total Interior Radius of the torus",
|
||||
default=0.5, min=0.01, max=100.0)
|
||||
min=0.01, max=100.0,
|
||||
default=0.5,
|
||||
)
|
||||
|
||||
# generic transform props
|
||||
view_align = BoolProperty(name="Align to View",
|
||||
default=False)
|
||||
location = FloatVectorProperty(name="Location",
|
||||
subtype='TRANSLATION')
|
||||
rotation = FloatVectorProperty(name="Rotation",
|
||||
subtype='EULER')
|
||||
view_align = BoolProperty(
|
||||
name="Align to View",
|
||||
default=False,
|
||||
)
|
||||
location = FloatVectorProperty(
|
||||
name="Location",
|
||||
subtype='TRANSLATION',
|
||||
)
|
||||
rotation = FloatVectorProperty(
|
||||
name="Rotation",
|
||||
subtype='EULER',
|
||||
)
|
||||
|
||||
def execute(self, context):
|
||||
|
||||
|
@ -74,11 +74,11 @@ class MeshMirrorUV(Operator):
|
||||
bl_label = "Copy Mirrored UV coords"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
direction = EnumProperty(items=(
|
||||
('POSITIVE', "Positive", ""),
|
||||
('NEGATIVE', "Negative", "")),
|
||||
direction = EnumProperty(
|
||||
name="Axis Direction",
|
||||
description="")
|
||||
items=(('POSITIVE', "Positive", ""),
|
||||
('NEGATIVE', "Negative", "")),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
|
@ -84,6 +84,7 @@ def bake(frame_start,
|
||||
do_pose=True,
|
||||
do_object=True,
|
||||
do_constraint_clear=False,
|
||||
action=None,
|
||||
):
|
||||
|
||||
scene = bpy.context.scene
|
||||
@ -121,6 +122,7 @@ def bake(frame_start,
|
||||
|
||||
# incase animation data hassnt been created
|
||||
atd = obj.animation_data_create()
|
||||
if action is None:
|
||||
action = bpy.data.actions.new("Action")
|
||||
atd.action = action
|
||||
|
||||
|
@ -195,8 +195,12 @@ class SubdivisionSet(Operator):
|
||||
bl_label = "Subdivision Set"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
level = IntProperty(name="Level",
|
||||
default=1, min=-100, max=100, soft_min=-6, soft_max=6)
|
||||
level = IntProperty(
|
||||
name="Level",
|
||||
min=-100, max=100,
|
||||
soft_min=-6, soft_max=6,
|
||||
default=1,
|
||||
)
|
||||
|
||||
relative = BoolProperty(
|
||||
name="Relative",
|
||||
|
@ -351,33 +351,34 @@ class AlignObjects(Operator):
|
||||
description=("Enables high quality calculation of the "
|
||||
"bounding box for perfect results on complex "
|
||||
"shape meshes with rotation/scale (Slow)"),
|
||||
default=True)
|
||||
|
||||
align_mode = EnumProperty(items=(
|
||||
('OPT_1', "Negative Sides", ""),
|
||||
('OPT_2', "Centers", ""),
|
||||
('OPT_3', "Positive Sides", "")),
|
||||
default=True,
|
||||
)
|
||||
align_mode = EnumProperty(
|
||||
name="Align Mode:",
|
||||
description="",
|
||||
default='OPT_2')
|
||||
|
||||
relative_to = EnumProperty(items=(
|
||||
('OPT_1', "Scene Origin", ""),
|
||||
items=(('OPT_1', "Negative Sides", ""),
|
||||
('OPT_2', "Centers", ""),
|
||||
('OPT_3', "Positive Sides", ""),
|
||||
),
|
||||
default='OPT_2',
|
||||
)
|
||||
relative_to = EnumProperty(
|
||||
name="Relative To:",
|
||||
items=(('OPT_1', "Scene Origin", ""),
|
||||
('OPT_2', "3D Cursor", ""),
|
||||
('OPT_3', "Selection", ""),
|
||||
('OPT_4', "Active", "")),
|
||||
name="Relative To:",
|
||||
description="",
|
||||
default='OPT_4')
|
||||
|
||||
align_axis = EnumProperty(items=(
|
||||
('X', "X", ""),
|
||||
('OPT_4', "Active", ""),
|
||||
),
|
||||
default='OPT_4',
|
||||
)
|
||||
align_axis = EnumProperty(
|
||||
name="Align",
|
||||
description="Align to axis",
|
||||
items=(('X', "X", ""),
|
||||
('Y', "Y", ""),
|
||||
('Z', "Z", ""),
|
||||
),
|
||||
name="Align",
|
||||
description="Align to axis",
|
||||
options={'ENUM_FLAG'})
|
||||
options={'ENUM_FLAG'},
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
|
@ -51,19 +51,25 @@ class QuickFur(Operator):
|
||||
bl_label = "Quick Fur"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
density = EnumProperty(items=(
|
||||
('LIGHT', "Light", ""),
|
||||
density = EnumProperty(
|
||||
name="Fur Density",
|
||||
items=(('LIGHT', "Light", ""),
|
||||
('MEDIUM', "Medium", ""),
|
||||
('HEAVY', "Heavy", "")),
|
||||
name="Fur Density",
|
||||
description="",
|
||||
default='MEDIUM')
|
||||
|
||||
view_percentage = IntProperty(name="View %",
|
||||
default=10, min=1, max=100, soft_min=1, soft_max=100)
|
||||
|
||||
length = FloatProperty(name="Length",
|
||||
default=0.1, min=0.001, max=100, soft_min=0.01, soft_max=10)
|
||||
default='MEDIUM',
|
||||
)
|
||||
view_percentage = IntProperty(
|
||||
name="View %",
|
||||
min=1, max=100,
|
||||
soft_min=1, soft_max=100,
|
||||
default=10,
|
||||
)
|
||||
length = FloatProperty(
|
||||
name="Length",
|
||||
min=0.001, max=100,
|
||||
soft_min=0.01, soft_max=10,
|
||||
default=0.1,
|
||||
)
|
||||
|
||||
def execute(self, context):
|
||||
fake_context = bpy.context.copy()
|
||||
@ -110,31 +116,50 @@ class QuickExplode(Operator):
|
||||
bl_label = "Quick Explode"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
style = EnumProperty(items=(
|
||||
('EXPLODE', "Explode", ""),
|
||||
('BLEND', "Blend", "")),
|
||||
style = EnumProperty(
|
||||
name="Explode Style",
|
||||
description="",
|
||||
default='EXPLODE')
|
||||
items=(('EXPLODE', "Explode", ""),
|
||||
('BLEND', "Blend", "")),
|
||||
default='EXPLODE',
|
||||
)
|
||||
amount = IntProperty(
|
||||
name="Amount of pieces",
|
||||
min=2, max=10000,
|
||||
soft_min=2, soft_max=10000,
|
||||
default=100,
|
||||
)
|
||||
frame_duration = IntProperty(
|
||||
name="Duration",
|
||||
min=1, max=300000,
|
||||
soft_min=1, soft_max=10000,
|
||||
default=50,
|
||||
)
|
||||
|
||||
amount = IntProperty(name="Amount of pieces",
|
||||
default=100, min=2, max=10000, soft_min=2, soft_max=10000)
|
||||
frame_start = IntProperty(
|
||||
name="Start Frame",
|
||||
min=1, max=300000,
|
||||
soft_min=1, soft_max=10000,
|
||||
default=1,
|
||||
)
|
||||
frame_end = IntProperty(
|
||||
name="End Frame",
|
||||
min=1, max=300000,
|
||||
soft_min=1, soft_max=10000,
|
||||
default=10,
|
||||
)
|
||||
|
||||
frame_duration = IntProperty(name="Duration",
|
||||
default=50, min=1, max=300000, soft_min=1, soft_max=10000)
|
||||
velocity = FloatProperty(
|
||||
name="Outwards Velocity",
|
||||
min=0, max=300000,
|
||||
soft_min=0, soft_max=10,
|
||||
default=1,
|
||||
)
|
||||
|
||||
frame_start = IntProperty(name="Start Frame",
|
||||
default=1, min=1, max=300000, soft_min=1, soft_max=10000)
|
||||
|
||||
frame_end = IntProperty(name="End Frame",
|
||||
default=10, min=1, max=300000, soft_min=1, soft_max=10000)
|
||||
|
||||
velocity = FloatProperty(name="Outwards Velocity",
|
||||
default=1, min=0, max=300000, soft_min=0, soft_max=10)
|
||||
|
||||
fade = BoolProperty(name="Fade",
|
||||
fade = BoolProperty(
|
||||
name="Fade",
|
||||
description="Fade the pieces over time.",
|
||||
default=True)
|
||||
default=True,
|
||||
)
|
||||
|
||||
def execute(self, context):
|
||||
fake_context = bpy.context.copy()
|
||||
@ -272,12 +297,11 @@ class QuickSmoke(Operator):
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
style = EnumProperty(
|
||||
name="Smoke Style",
|
||||
items=(('STREAM', "Stream", ""),
|
||||
('PUFF', "Puff", ""),
|
||||
('FIRE', "Fire", ""),
|
||||
),
|
||||
name="Smoke Style",
|
||||
description="",
|
||||
default='STREAM',
|
||||
)
|
||||
|
||||
@ -390,19 +414,16 @@ class QuickFluid(Operator):
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
style = EnumProperty(
|
||||
items=(('INFLOW', "Inflow", ""),
|
||||
('BASIC', "Basic", ""),
|
||||
),
|
||||
name="Fluid Style",
|
||||
description="",
|
||||
items=(('INFLOW', "Inflow", ""),
|
||||
('BASIC', "Basic", "")),
|
||||
default='BASIC',
|
||||
)
|
||||
initial_velocity = FloatVectorProperty(
|
||||
name="Initial Velocity",
|
||||
description="Initial velocity of the fluid",
|
||||
min=-100.0, max=100.0,
|
||||
default=(0.0, 0.0, 0.0),
|
||||
min=-100.0,
|
||||
max=100.0,
|
||||
subtype='VELOCITY',
|
||||
)
|
||||
show_flows = BoolProperty(
|
||||
|
@ -145,9 +145,12 @@ class RandomizeLocRotSize(Operator):
|
||||
default=False,
|
||||
)
|
||||
|
||||
'''scale_min = FloatProperty(name="Minimun Scale Factor",
|
||||
'''scale_min = FloatProperty(
|
||||
name="Minimun Scale Factor",
|
||||
description="Lowest scale percentage possible",
|
||||
default=0.15, min=-1.0, max=1.0, precision=3)'''
|
||||
min=-1.0, max=1.0, precision=3,
|
||||
default=0.15,
|
||||
)'''
|
||||
|
||||
scale = FloatVectorProperty(
|
||||
name="Scale",
|
||||
|
@ -82,8 +82,12 @@ class SequencerCutMulticam(Operator):
|
||||
bl_label = "Cut multicam"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
camera = IntProperty(name="Camera",
|
||||
default=1, min=1, max=32, soft_min=1, soft_max=32)
|
||||
camera = IntProperty(
|
||||
name="Camera",
|
||||
min=1, max=32,
|
||||
soft_min=1, soft_max=32,
|
||||
default=1,
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
|
@ -552,7 +552,6 @@ class LightMapPack(Operator):
|
||||
|
||||
PREF_CONTEXT = bpy.props.EnumProperty(
|
||||
name="Selection",
|
||||
description="",
|
||||
items=(("SEL_FACES", "Selected Faces", "Space all UVs evently"),
|
||||
("ALL_FACES", "All Faces", "Average space UVs edge length of each loop"),
|
||||
("ALL_OBJECTS", "Selected Mesh Object", "Average space UVs edge length of each loop")
|
||||
|
@ -178,7 +178,7 @@ def pointInEdges(pt, edges):
|
||||
intersectCount = 0
|
||||
for ed in edges:
|
||||
xi, yi = lineIntersection2D(x1,y1, x2,y2, ed[0][0], ed[0][1], ed[1][0], ed[1][1])
|
||||
if xi != None: # Is there an intersection.
|
||||
if xi is not None: # Is there an intersection.
|
||||
intersectCount+=1
|
||||
|
||||
return intersectCount % 2
|
||||
@ -813,39 +813,26 @@ def main(context,
|
||||
global RotMatStepRotation
|
||||
main_consts()
|
||||
|
||||
# TODO, all selected meshes
|
||||
'''
|
||||
# objects = context.selected_editable_objects
|
||||
objects = []
|
||||
# Create the variables.
|
||||
USER_PROJECTION_LIMIT = projection_limit
|
||||
USER_ONLY_SELECTED_FACES = True
|
||||
USER_SHARE_SPACE = 1 # Only for hole filling.
|
||||
USER_STRETCH_ASPECT = 1 # Only for hole filling.
|
||||
USER_ISLAND_MARGIN = island_margin # Only for hole filling.
|
||||
USER_FILL_HOLES = 0
|
||||
USER_FILL_HOLES_QUALITY = 50 # Only for hole filling.
|
||||
USER_VIEW_INIT = 0 # Only for hole filling.
|
||||
|
||||
# we can will tag them later.
|
||||
obList = [ob for ob in objects if ob.type == 'MESH']
|
||||
|
||||
# Face select object may not be selected.
|
||||
ob = context.active_object
|
||||
|
||||
if ob and (not ob.select) and ob.type == 'MESH':
|
||||
# Add to the list
|
||||
obList =[ob]
|
||||
del objects
|
||||
'''
|
||||
|
||||
# quick workaround
|
||||
is_editmode = (context.active_object.mode == 'EDIT')
|
||||
if is_editmode:
|
||||
obList = [ob for ob in [context.active_object] if ob and ob.type == 'MESH']
|
||||
else:
|
||||
obList = [ob for ob in context.selected_editable_objects if ob and ob.type == 'MESH']
|
||||
USER_ONLY_SELECTED_FACES = False
|
||||
|
||||
if not obList:
|
||||
raise('error, no selected mesh objects')
|
||||
|
||||
# Create the variables.
|
||||
USER_PROJECTION_LIMIT = projection_limit
|
||||
USER_ONLY_SELECTED_FACES = (1)
|
||||
USER_SHARE_SPACE = (1) # Only for hole filling.
|
||||
USER_STRETCH_ASPECT = (1) # Only for hole filling.
|
||||
USER_ISLAND_MARGIN = island_margin # Only for hole filling.
|
||||
USER_FILL_HOLES = (0)
|
||||
USER_FILL_HOLES_QUALITY = (50) # Only for hole filling.
|
||||
USER_VIEW_INIT = (0) # Only for hole filling.
|
||||
|
||||
# Reuse variable
|
||||
if len(obList) == 1:
|
||||
ob = "Unwrap %i Selected Mesh"
|
||||
@ -906,8 +893,8 @@ def main(context,
|
||||
|
||||
if USER_ONLY_SELECTED_FACES:
|
||||
meshFaces = [thickface(f, uv_layer[i], me_verts) for i, f in enumerate(me.faces) if f.select]
|
||||
#else:
|
||||
# meshFaces = map(thickface, me.faces)
|
||||
else:
|
||||
meshFaces = [thickface(f, uv_layer[i], me_verts) for i, f in enumerate(me.faces)]
|
||||
|
||||
if not meshFaces:
|
||||
continue
|
||||
@ -1123,21 +1110,28 @@ class SmartProject(Operator):
|
||||
bl_label = "Smart UV Project"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
angle_limit = FloatProperty(name="Angle Limit",
|
||||
angle_limit = FloatProperty(
|
||||
name="Angle Limit",
|
||||
description="lower for more projection groups, higher for less distortion",
|
||||
default=66.0, min=1.0, max=89.0)
|
||||
|
||||
island_margin = FloatProperty(name="Island Margin",
|
||||
min=1.0, max=89.0,
|
||||
default=66.0,
|
||||
)
|
||||
island_margin = FloatProperty(
|
||||
name="Island Margin",
|
||||
description="Margin to reduce bleed from adjacent islands",
|
||||
default=0.0, min=0.0, max=1.0)
|
||||
|
||||
user_area_weight = FloatProperty(name="Area Weight",
|
||||
min=0.0, max=1.0,
|
||||
default=0.0,
|
||||
)
|
||||
user_area_weight = FloatProperty(
|
||||
name="Area Weight",
|
||||
description="Weight projections vector by faces with larger areas",
|
||||
default=0.0, min=0.0, max=1.0)
|
||||
min=0.0, max=1.0,
|
||||
default=0.0,
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return context.active_object != None
|
||||
return context.active_object is not None
|
||||
|
||||
def execute(self, context):
|
||||
main(context,
|
||||
|
@ -151,11 +151,35 @@ class VertexPaintDirt(Operator):
|
||||
bl_label = "Dirty Vertex Colors"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
blur_strength = FloatProperty(name="Blur Strength", description="Blur strength per iteration", default=1.0, min=0.01, max=1.0)
|
||||
blur_iterations = IntProperty(name="Blur Iterations", description="Number times to blur the colors. (higher blurs more)", default=1, min=0, max=40)
|
||||
clean_angle = FloatProperty(name="Highlight Angle", description="Less then 90 limits the angle used in the tonal range", default=180.0, min=0.0, max=180.0)
|
||||
dirt_angle = FloatProperty(name="Dirt Angle", description="Less then 90 limits the angle used in the tonal range", default=0.0, min=0.0, max=180.0)
|
||||
dirt_only = BoolProperty(name="Dirt Only", description="Dont calculate cleans for convex areas", default=False)
|
||||
blur_strength = FloatProperty(
|
||||
name="Blur Strength",
|
||||
description="Blur strength per iteration",
|
||||
min=0.01, max=1.0,
|
||||
default=1.0,
|
||||
)
|
||||
blur_iterations = IntProperty(
|
||||
name="Blur Iterations",
|
||||
description="Number times to blur the colors. (higher blurs more)",
|
||||
min=0, max=40,
|
||||
default=1,
|
||||
)
|
||||
clean_angle = FloatProperty(
|
||||
name="Highlight Angle",
|
||||
description="Less then 90 limits the angle used in the tonal range",
|
||||
min=0.0, max=180.0,
|
||||
default=180.0,
|
||||
)
|
||||
dirt_angle = FloatProperty(
|
||||
name="Dirt Angle",
|
||||
description="Less then 90 limits the angle used in the tonal range",
|
||||
min=0.0, max=180.0,
|
||||
default=0.0,
|
||||
)
|
||||
dirt_only = BoolProperty(
|
||||
name="Dirt Only",
|
||||
description="Dont calculate cleans for convex areas",
|
||||
default=False,
|
||||
)
|
||||
|
||||
def execute(self, context):
|
||||
import time
|
||||
|
@ -20,8 +20,12 @@
|
||||
|
||||
import bpy
|
||||
from bpy.types import Menu, Operator
|
||||
from bpy.props import StringProperty, BoolProperty, IntProperty, \
|
||||
FloatProperty, EnumProperty
|
||||
from bpy.props import (StringProperty,
|
||||
BoolProperty,
|
||||
IntProperty,
|
||||
FloatProperty,
|
||||
EnumProperty,
|
||||
)
|
||||
|
||||
from rna_prop_ui import rna_idprop_ui_prop_get, rna_idprop_ui_prop_clear
|
||||
|
||||
@ -39,23 +43,30 @@ class MESH_OT_delete_edgeloop(Operator):
|
||||
|
||||
return {'CANCELLED'}
|
||||
|
||||
rna_path_prop = StringProperty(name="Context Attributes",
|
||||
description="rna context string", maxlen=1024, default="")
|
||||
rna_path_prop = StringProperty(
|
||||
name="Context Attributes",
|
||||
description="rna context string",
|
||||
maxlen=1024,
|
||||
)
|
||||
|
||||
rna_reverse_prop = BoolProperty(name="Reverse",
|
||||
description="Cycle backwards", default=False)
|
||||
rna_reverse_prop = BoolProperty(
|
||||
name="Reverse",
|
||||
description="Cycle backwards",
|
||||
default=False,
|
||||
)
|
||||
|
||||
rna_relative_prop = BoolProperty(name="Relative",
|
||||
rna_relative_prop = BoolProperty(
|
||||
name="Relative",
|
||||
description="Apply relative to the current value (delta)",
|
||||
default=False)
|
||||
default=False,
|
||||
)
|
||||
|
||||
|
||||
def context_path_validate(context, data_path):
|
||||
import sys
|
||||
try:
|
||||
value = eval("context.%s" % data_path) if data_path else Ellipsis
|
||||
except AttributeError:
|
||||
if "'NoneType'" in str(sys.exc_info()[1]):
|
||||
except AttributeError as e:
|
||||
if str(e).startswith("'NoneType'"):
|
||||
# One of the items in the rna path is None, just ignore this
|
||||
value = Ellipsis
|
||||
else:
|
||||
@ -65,16 +76,65 @@ def context_path_validate(context, data_path):
|
||||
return value
|
||||
|
||||
|
||||
def operator_value_is_undo(value):
|
||||
if value in {None, Ellipsis}:
|
||||
return False
|
||||
|
||||
# typical properties or objects
|
||||
id_data = getattr(value, "id_data", Ellipsis)
|
||||
|
||||
if id_data is None:
|
||||
return False
|
||||
elif id_data is Ellipsis:
|
||||
# handle mathutils types
|
||||
id_data = getattr(getattr(value, "owner", None), "id_data", None)
|
||||
|
||||
if id_data is None:
|
||||
return False
|
||||
|
||||
# return True if its a non window ID type
|
||||
return (isinstance(id_data, bpy.types.ID) and
|
||||
(not isinstance(id_data, (bpy.types.WindowManager,
|
||||
bpy.types.Screen,
|
||||
bpy.types.Scene,
|
||||
bpy.types.Brush,
|
||||
))))
|
||||
|
||||
|
||||
def operator_path_is_undo(context, data_path):
|
||||
# note that if we have data paths that use strings this could fail
|
||||
# luckily we dont do this!
|
||||
#
|
||||
# When we cant find the data owner assume no undo is needed.
|
||||
data_path_head, data_path_sep, data_path_tail = data_path.rpartition(".")
|
||||
|
||||
if not data_path_head:
|
||||
return False
|
||||
|
||||
value = context_path_validate(context, data_path_head)
|
||||
|
||||
return operator_value_is_undo(value)
|
||||
|
||||
|
||||
def operator_path_undo_return(context, data_path):
|
||||
return {'FINISHED'} if operator_path_is_undo(context, data_path) else {'CANCELLED'}
|
||||
|
||||
|
||||
def operator_value_undo_return(value):
|
||||
return {'FINISHED'} if operator_value_is_undo(value) else {'CANCELLED'}
|
||||
|
||||
|
||||
def execute_context_assign(self, context):
|
||||
if context_path_validate(context, self.data_path) is Ellipsis:
|
||||
data_path = self.data_path
|
||||
if context_path_validate(context, data_path) is Ellipsis:
|
||||
return {'PASS_THROUGH'}
|
||||
|
||||
if getattr(self, "relative", False):
|
||||
exec("context.%s+=self.value" % self.data_path)
|
||||
exec("context.%s += self.value" % data_path)
|
||||
else:
|
||||
exec("context.%s=self.value" % self.data_path)
|
||||
exec("context.%s = self.value" % data_path)
|
||||
|
||||
return {'FINISHED'}
|
||||
return operator_path_undo_return(context, data_path)
|
||||
|
||||
|
||||
class BRUSH_OT_active_index_set(Operator):
|
||||
@ -82,15 +142,21 @@ class BRUSH_OT_active_index_set(Operator):
|
||||
bl_idname = "brush.active_index_set"
|
||||
bl_label = "Set Brush Number"
|
||||
|
||||
mode = StringProperty(name="mode",
|
||||
description="Paint mode to set brush for", maxlen=1024)
|
||||
index = IntProperty(name="number",
|
||||
description="Brush number")
|
||||
mode = StringProperty(
|
||||
name="mode",
|
||||
description="Paint mode to set brush for",
|
||||
maxlen=1024,
|
||||
)
|
||||
index = IntProperty(
|
||||
name="number",
|
||||
description="Brush number",
|
||||
)
|
||||
|
||||
_attr_dict = {"sculpt": "use_paint_sculpt",
|
||||
"vertex_paint": "use_paint_vertex",
|
||||
"weight_paint": "use_paint_weight",
|
||||
"image_paint": "use_paint_image"}
|
||||
"image_paint": "use_paint_image",
|
||||
}
|
||||
|
||||
def execute(self, context):
|
||||
attr = self._attr_dict.get(self.mode)
|
||||
@ -112,8 +178,11 @@ class WM_OT_context_set_boolean(Operator):
|
||||
bl_options = {'UNDO', 'INTERNAL'}
|
||||
|
||||
data_path = rna_path_prop
|
||||
value = BoolProperty(name="Value",
|
||||
description="Assignment value", default=True)
|
||||
value = BoolProperty(
|
||||
name="Value",
|
||||
description="Assignment value",
|
||||
default=True,
|
||||
)
|
||||
|
||||
execute = execute_context_assign
|
||||
|
||||
@ -125,7 +194,11 @@ class WM_OT_context_set_int(Operator): # same as enum
|
||||
bl_options = {'UNDO', 'INTERNAL'}
|
||||
|
||||
data_path = rna_path_prop
|
||||
value = IntProperty(name="Value", description="Assign value", default=0)
|
||||
value = IntProperty(
|
||||
name="Value",
|
||||
description="Assign value",
|
||||
default=0,
|
||||
)
|
||||
relative = rna_relative_prop
|
||||
|
||||
execute = execute_context_assign
|
||||
@ -138,17 +211,23 @@ class WM_OT_context_scale_int(Operator):
|
||||
bl_options = {'UNDO', 'INTERNAL'}
|
||||
|
||||
data_path = rna_path_prop
|
||||
value = FloatProperty(name="Value", description="Assign value", default=1.0)
|
||||
always_step = BoolProperty(name="Always Step",
|
||||
value = FloatProperty(
|
||||
name="Value",
|
||||
description="Assign value",
|
||||
default=1.0,
|
||||
)
|
||||
always_step = BoolProperty(
|
||||
name="Always Step",
|
||||
description="Always adjust the value by a minimum of 1 when 'value' is not 1.0.",
|
||||
default=True)
|
||||
default=True,
|
||||
)
|
||||
|
||||
def execute(self, context):
|
||||
if context_path_validate(context, self.data_path) is Ellipsis:
|
||||
data_path = self.data_path
|
||||
if context_path_validate(context, data_path) is Ellipsis:
|
||||
return {'PASS_THROUGH'}
|
||||
|
||||
value = self.value
|
||||
data_path = self.data_path
|
||||
|
||||
if value == 1.0: # nothing to do
|
||||
return {'CANCELLED'}
|
||||
@ -160,11 +239,12 @@ class WM_OT_context_scale_int(Operator):
|
||||
else:
|
||||
add = "-1"
|
||||
func = "min"
|
||||
exec("context.%s = %s(round(context.%s * value), context.%s + %s)" % (data_path, func, data_path, data_path, add))
|
||||
exec("context.%s = %s(round(context.%s * value), context.%s + %s)" %
|
||||
(data_path, func, data_path, data_path, add))
|
||||
else:
|
||||
exec("context.%s *= value" % self.data_path)
|
||||
exec("context.%s *= value" % data_path)
|
||||
|
||||
return {'FINISHED'}
|
||||
return operator_path_undo_return(context, data_path)
|
||||
|
||||
|
||||
class WM_OT_context_set_float(Operator): # same as enum
|
||||
@ -174,8 +254,11 @@ class WM_OT_context_set_float(Operator): # same as enum
|
||||
bl_options = {'UNDO', 'INTERNAL'}
|
||||
|
||||
data_path = rna_path_prop
|
||||
value = FloatProperty(name="Value",
|
||||
description="Assignment value", default=0.0)
|
||||
value = FloatProperty(
|
||||
name="Value",
|
||||
description="Assignment value",
|
||||
default=0.0,
|
||||
)
|
||||
relative = rna_relative_prop
|
||||
|
||||
execute = execute_context_assign
|
||||
@ -188,8 +271,11 @@ class WM_OT_context_set_string(Operator): # same as enum
|
||||
bl_options = {'UNDO', 'INTERNAL'}
|
||||
|
||||
data_path = rna_path_prop
|
||||
value = StringProperty(name="Value",
|
||||
description="Assign value", maxlen=1024, default="")
|
||||
value = StringProperty(
|
||||
name="Value",
|
||||
description="Assign value",
|
||||
maxlen=1024,
|
||||
)
|
||||
|
||||
execute = execute_context_assign
|
||||
|
||||
@ -201,9 +287,11 @@ class WM_OT_context_set_enum(Operator):
|
||||
bl_options = {'UNDO', 'INTERNAL'}
|
||||
|
||||
data_path = rna_path_prop
|
||||
value = StringProperty(name="Value",
|
||||
value = StringProperty(
|
||||
name="Value",
|
||||
description="Assignment value (as a string)",
|
||||
maxlen=1024, default="")
|
||||
maxlen=1024,
|
||||
)
|
||||
|
||||
execute = execute_context_assign
|
||||
|
||||
@ -215,15 +303,18 @@ class WM_OT_context_set_value(Operator):
|
||||
bl_options = {'UNDO', 'INTERNAL'}
|
||||
|
||||
data_path = rna_path_prop
|
||||
value = StringProperty(name="Value",
|
||||
value = StringProperty(
|
||||
name="Value",
|
||||
description="Assignment value (as a string)",
|
||||
maxlen=1024, default="")
|
||||
maxlen=1024,
|
||||
)
|
||||
|
||||
def execute(self, context):
|
||||
if context_path_validate(context, self.data_path) is Ellipsis:
|
||||
data_path = self.data_path
|
||||
if context_path_validate(context, data_path) is Ellipsis:
|
||||
return {'PASS_THROUGH'}
|
||||
exec("context.%s=%s" % (self.data_path, self.value))
|
||||
return {'FINISHED'}
|
||||
exec("context.%s = %s" % (data_path, self.value))
|
||||
return operator_path_undo_return(context, data_path)
|
||||
|
||||
|
||||
class WM_OT_context_toggle(Operator):
|
||||
@ -235,14 +326,14 @@ class WM_OT_context_toggle(Operator):
|
||||
data_path = rna_path_prop
|
||||
|
||||
def execute(self, context):
|
||||
data_path = self.data_path
|
||||
|
||||
if context_path_validate(context, self.data_path) is Ellipsis:
|
||||
if context_path_validate(context, data_path) is Ellipsis:
|
||||
return {'PASS_THROUGH'}
|
||||
|
||||
exec("context.%s=not (context.%s)" %
|
||||
(self.data_path, self.data_path))
|
||||
exec("context.%s = not (context.%s)" % (data_path, data_path))
|
||||
|
||||
return {'FINISHED'}
|
||||
return operator_path_undo_return(context, data_path)
|
||||
|
||||
|
||||
class WM_OT_context_toggle_enum(Operator):
|
||||
@ -252,23 +343,30 @@ class WM_OT_context_toggle_enum(Operator):
|
||||
bl_options = {'UNDO', 'INTERNAL'}
|
||||
|
||||
data_path = rna_path_prop
|
||||
value_1 = StringProperty(name="Value", \
|
||||
description="Toggle enum", maxlen=1024, default="")
|
||||
|
||||
value_2 = StringProperty(name="Value", \
|
||||
description="Toggle enum", maxlen=1024, default="")
|
||||
value_1 = StringProperty(
|
||||
name="Value",
|
||||
description="Toggle enum",
|
||||
maxlen=1024,
|
||||
)
|
||||
value_2 = StringProperty(
|
||||
name="Value",
|
||||
description="Toggle enum",
|
||||
maxlen=1024,
|
||||
)
|
||||
|
||||
def execute(self, context):
|
||||
data_path = self.data_path
|
||||
|
||||
if context_path_validate(context, self.data_path) is Ellipsis:
|
||||
if context_path_validate(context, data_path) is Ellipsis:
|
||||
return {'PASS_THROUGH'}
|
||||
|
||||
exec("context.%s = ['%s', '%s'][context.%s!='%s']" % \
|
||||
(self.data_path, self.value_1,\
|
||||
self.value_2, self.data_path,
|
||||
self.value_2))
|
||||
exec("context.%s = ('%s', '%s')[context.%s != '%s']" %
|
||||
(data_path, self.value_1,
|
||||
self.value_2, data_path,
|
||||
self.value_2,
|
||||
))
|
||||
|
||||
return {'FINISHED'}
|
||||
return operator_path_undo_return(context, data_path)
|
||||
|
||||
|
||||
class WM_OT_context_cycle_int(Operator):
|
||||
@ -303,7 +401,7 @@ class WM_OT_context_cycle_int(Operator):
|
||||
|
||||
exec("context.%s = value" % data_path)
|
||||
|
||||
return {'FINISHED'}
|
||||
return operator_path_undo_return(context, data_path)
|
||||
|
||||
|
||||
class WM_OT_context_cycle_enum(Operator):
|
||||
@ -316,15 +414,15 @@ class WM_OT_context_cycle_enum(Operator):
|
||||
reverse = rna_reverse_prop
|
||||
|
||||
def execute(self, context):
|
||||
|
||||
value = context_path_validate(context, self.data_path)
|
||||
data_path = self.data_path
|
||||
value = context_path_validate(context, data_path)
|
||||
if value is Ellipsis:
|
||||
return {'PASS_THROUGH'}
|
||||
|
||||
orig_value = value
|
||||
|
||||
# Have to get rna enum values
|
||||
rna_struct_str, rna_prop_str = self.data_path.rsplit('.', 1)
|
||||
rna_struct_str, rna_prop_str = data_path.rsplit('.', 1)
|
||||
i = rna_prop_str.find('[')
|
||||
|
||||
# just incse we get "context.foo.bar[0]"
|
||||
@ -354,8 +452,8 @@ class WM_OT_context_cycle_enum(Operator):
|
||||
advance_enum = enums[orig_index + 1]
|
||||
|
||||
# set the new value
|
||||
exec("context.%s=advance_enum" % self.data_path)
|
||||
return {'FINISHED'}
|
||||
exec("context.%s = advance_enum" % data_path)
|
||||
return operator_path_undo_return(context, data_path)
|
||||
|
||||
|
||||
class WM_OT_context_cycle_array(Operator):
|
||||
@ -383,7 +481,7 @@ class WM_OT_context_cycle_array(Operator):
|
||||
|
||||
exec("context.%s = cycle(context.%s[:])" % (data_path, data_path))
|
||||
|
||||
return {'FINISHED'}
|
||||
return operator_path_undo_return(context, data_path)
|
||||
|
||||
|
||||
class WM_MT_context_menu_enum(Menu):
|
||||
@ -426,8 +524,11 @@ class WM_OT_context_set_id(Operator):
|
||||
bl_options = {'UNDO', 'INTERNAL'}
|
||||
|
||||
data_path = rna_path_prop
|
||||
value = StringProperty(name="Value",
|
||||
description="Assign value", maxlen=1024, default="")
|
||||
value = StringProperty(
|
||||
name="Value",
|
||||
description="Assign value",
|
||||
maxlen=1024,
|
||||
)
|
||||
|
||||
def execute(self, context):
|
||||
value = self.value
|
||||
@ -451,14 +552,19 @@ class WM_OT_context_set_id(Operator):
|
||||
value_id = getattr(bpy.data, id_iter).get(value)
|
||||
exec("context.%s = value_id" % data_path)
|
||||
|
||||
return {'FINISHED'}
|
||||
return operator_path_undo_return(context, data_path)
|
||||
|
||||
|
||||
doc_id = StringProperty(name="Doc ID",
|
||||
description="", maxlen=1024, default="", options={'HIDDEN'})
|
||||
doc_id = StringProperty(
|
||||
name="Doc ID",
|
||||
maxlen=1024,
|
||||
options={'HIDDEN'},
|
||||
)
|
||||
|
||||
doc_new = StringProperty(name="Edit Description",
|
||||
description="", maxlen=1024, default="")
|
||||
doc_new = StringProperty(
|
||||
name="Edit Description",
|
||||
maxlen=1024,
|
||||
)
|
||||
|
||||
data_path_iter = StringProperty(
|
||||
description="The data path relative to the context, must point to an iterable.")
|
||||
@ -476,12 +582,13 @@ class WM_OT_context_collection_boolean_set(Operator):
|
||||
data_path_iter = data_path_iter
|
||||
data_path_item = data_path_item
|
||||
|
||||
type = EnumProperty(items=(
|
||||
('TOGGLE', "Toggle", ""),
|
||||
type = EnumProperty(
|
||||
name="Type",
|
||||
items=(('TOGGLE', "Toggle", ""),
|
||||
('ENABLE', "Enable", ""),
|
||||
('DISABLE', "Disable", ""),
|
||||
),
|
||||
name="Type")
|
||||
)
|
||||
|
||||
def execute(self, context):
|
||||
data_path_iter = self.data_path_iter
|
||||
@ -507,6 +614,10 @@ class WM_OT_context_collection_boolean_set(Operator):
|
||||
|
||||
items_ok.append(item)
|
||||
|
||||
# avoid undo push when nothing to do
|
||||
if not items_ok:
|
||||
return {'CANCELLED'}
|
||||
|
||||
if self.type == 'ENABLE':
|
||||
is_set = True
|
||||
elif self.type == 'DISABLE':
|
||||
@ -518,20 +629,26 @@ class WM_OT_context_collection_boolean_set(Operator):
|
||||
for item in items_ok:
|
||||
exec(exec_str)
|
||||
|
||||
return {'FINISHED'}
|
||||
return operator_value_undo_return(item)
|
||||
|
||||
|
||||
class WM_OT_context_modal_mouse(Operator):
|
||||
'''Adjust arbitrary values with mouse input'''
|
||||
bl_idname = "wm.context_modal_mouse"
|
||||
bl_label = "Context Modal Mouse"
|
||||
bl_options = {'GRAB_POINTER', 'BLOCKING', 'INTERNAL'}
|
||||
bl_options = {'GRAB_POINTER', 'BLOCKING', 'UNDO', 'INTERNAL'}
|
||||
|
||||
data_path_iter = data_path_iter
|
||||
data_path_item = data_path_item
|
||||
|
||||
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")
|
||||
input_scale = FloatProperty(
|
||||
description="Scale the mouse movement by this value before applying the delta",
|
||||
default=0.01,
|
||||
)
|
||||
invert = BoolProperty(
|
||||
description="Invert the mouse input",
|
||||
default=False,
|
||||
)
|
||||
initial_x = IntProperty(options={'HIDDEN'})
|
||||
|
||||
def _values_store(self, context):
|
||||
@ -584,12 +701,13 @@ class WM_OT_context_modal_mouse(Operator):
|
||||
self._values_delta(delta)
|
||||
|
||||
elif 'LEFTMOUSE' == event_type:
|
||||
item = next(iter(self._values.keys()))
|
||||
self._values_clear()
|
||||
return {'FINISHED'}
|
||||
return operator_value_undo_return(item)
|
||||
|
||||
elif event_type in {'RIGHTMOUSE', 'ESC'}:
|
||||
self._values_restore()
|
||||
return {'FINISHED'}
|
||||
return {'CANCELLED'}
|
||||
|
||||
return {'RUNNING_MODAL'}
|
||||
|
||||
@ -613,11 +731,13 @@ class WM_OT_url_open(Operator):
|
||||
bl_idname = "wm.url_open"
|
||||
bl_label = ""
|
||||
|
||||
url = StringProperty(name="URL", description="URL to open")
|
||||
url = StringProperty(
|
||||
name="URL",
|
||||
description="URL to open",
|
||||
)
|
||||
|
||||
def execute(self, context):
|
||||
import webbrowser
|
||||
_webbrowser_bug_fix()
|
||||
webbrowser.open(self.url)
|
||||
return {'FINISHED'}
|
||||
|
||||
@ -627,7 +747,11 @@ class WM_OT_path_open(Operator):
|
||||
bl_idname = "wm.path_open"
|
||||
bl_label = ""
|
||||
|
||||
filepath = StringProperty(name="File Path", maxlen=1024, subtype='FILE_PATH')
|
||||
filepath = StringProperty(
|
||||
name="File Path",
|
||||
maxlen=1024,
|
||||
subtype='FILE_PATH',
|
||||
)
|
||||
|
||||
def execute(self, context):
|
||||
import sys
|
||||
@ -662,9 +786,11 @@ class WM_OT_doc_view(Operator):
|
||||
|
||||
doc_id = doc_id
|
||||
if bpy.app.version_cycle == "release":
|
||||
_prefix = "http://www.blender.org/documentation/blender_python_api_%s%s_release" % ("_".join(str(v) for v in bpy.app.version[:2]), bpy.app.version_char)
|
||||
_prefix = ("http://www.blender.org/documentation/blender_python_api_%s%s_release" %
|
||||
("_".join(str(v) for v in bpy.app.version[:2]), bpy.app.version_char))
|
||||
else:
|
||||
_prefix = "http://www.blender.org/documentation/blender_python_api_%s" % "_".join(str(v) for v in bpy.app.version)
|
||||
_prefix = ("http://www.blender.org/documentation/blender_python_api_%s" %
|
||||
"_".join(str(v) for v in bpy.app.version))
|
||||
|
||||
def _nested_class_string(self, class_string):
|
||||
ls = []
|
||||
@ -682,8 +808,8 @@ class WM_OT_doc_view(Operator):
|
||||
class_name, class_prop = id_split
|
||||
|
||||
if hasattr(bpy.types, class_name.upper() + '_OT_' + class_prop):
|
||||
url = '%s/bpy.ops.%s.html#bpy.ops.%s.%s' % \
|
||||
(self._prefix, class_name, class_name, class_prop)
|
||||
url = ("%s/bpy.ops.%s.html#bpy.ops.%s.%s" %
|
||||
(self._prefix, class_name, class_name, class_prop))
|
||||
else:
|
||||
|
||||
# detect if this is a inherited member and use that name instead
|
||||
@ -696,14 +822,13 @@ class WM_OT_doc_view(Operator):
|
||||
|
||||
# It so happens that epydoc nests these, not sphinx
|
||||
# class_name_full = self._nested_class_string(class_name)
|
||||
url = '%s/bpy.types.%s.html#bpy.types.%s.%s' % \
|
||||
(self._prefix, class_name, class_name, class_prop)
|
||||
url = ("%s/bpy.types.%s.html#bpy.types.%s.%s" %
|
||||
(self._prefix, class_name, class_name, class_prop))
|
||||
|
||||
else:
|
||||
return {'PASS_THROUGH'}
|
||||
|
||||
import webbrowser
|
||||
_webbrowser_bug_fix()
|
||||
webbrowser.open(url)
|
||||
|
||||
return {'FINISHED'}
|
||||
@ -780,17 +905,36 @@ class WM_OT_doc_edit(Operator):
|
||||
return wm.invoke_props_dialog(self, width=600)
|
||||
|
||||
|
||||
rna_path = StringProperty(name="Property Edit",
|
||||
description="Property data_path edit", maxlen=1024, default="", options={'HIDDEN'})
|
||||
rna_path = StringProperty(
|
||||
name="Property Edit",
|
||||
description="Property data_path edit",
|
||||
maxlen=1024,
|
||||
options={'HIDDEN'},
|
||||
)
|
||||
|
||||
rna_value = StringProperty(name="Property Value",
|
||||
description="Property value edit", maxlen=1024, default="")
|
||||
rna_value = StringProperty(
|
||||
name="Property Value",
|
||||
description="Property value edit",
|
||||
maxlen=1024,
|
||||
)
|
||||
|
||||
rna_property = StringProperty(name="Property Name",
|
||||
description="Property name edit", maxlen=1024, default="")
|
||||
rna_property = StringProperty(
|
||||
name="Property Name",
|
||||
description="Property name edit",
|
||||
maxlen=1024,
|
||||
)
|
||||
|
||||
rna_min = FloatProperty(name="Min", default=0.0, precision=3)
|
||||
rna_max = FloatProperty(name="Max", default=1.0, precision=3)
|
||||
rna_min = FloatProperty(
|
||||
name="Min",
|
||||
default=0.0,
|
||||
precision=3,
|
||||
)
|
||||
|
||||
rna_max = FloatProperty(
|
||||
name="Max",
|
||||
default=1.0,
|
||||
precision=3,
|
||||
)
|
||||
|
||||
|
||||
class WM_OT_properties_edit(Operator):
|
||||
@ -804,7 +948,9 @@ class WM_OT_properties_edit(Operator):
|
||||
value = rna_value
|
||||
min = rna_min
|
||||
max = rna_max
|
||||
description = StringProperty(name="Tip", default="")
|
||||
description = StringProperty(
|
||||
name="Tip",
|
||||
)
|
||||
|
||||
def execute(self, context):
|
||||
data_path = self.data_path
|
||||
@ -857,14 +1003,15 @@ class WM_OT_properties_edit(Operator):
|
||||
return {'FINISHED'}
|
||||
|
||||
def invoke(self, context, event):
|
||||
data_path = self.data_path
|
||||
|
||||
if not self.data_path:
|
||||
if not data_path:
|
||||
self.report({'ERROR'}, "Data path not set")
|
||||
return {'CANCELLED'}
|
||||
|
||||
self._last_prop = [self.property]
|
||||
|
||||
item = eval("context.%s" % self.data_path)
|
||||
item = eval("context.%s" % data_path)
|
||||
|
||||
# setup defaults
|
||||
prop_ui = rna_idprop_ui_prop_get(item, self.property, False) # dont create
|
||||
@ -885,7 +1032,8 @@ class WM_OT_properties_add(Operator):
|
||||
data_path = rna_path
|
||||
|
||||
def execute(self, context):
|
||||
item = eval("context.%s" % self.data_path)
|
||||
data_path = self.data_path
|
||||
item = eval("context.%s" % data_path)
|
||||
|
||||
def unique_name(names):
|
||||
prop = 'prop'
|
||||
@ -908,10 +1056,13 @@ class WM_OT_properties_context_change(Operator):
|
||||
bl_idname = "wm.properties_context_change"
|
||||
bl_label = ""
|
||||
|
||||
context = StringProperty(name="Context", maxlen=32)
|
||||
context = StringProperty(
|
||||
name="Context",
|
||||
maxlen=32,
|
||||
)
|
||||
|
||||
def execute(self, context):
|
||||
context.space_data.context = (self.context)
|
||||
context.space_data.context = self.context
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
@ -924,7 +1075,8 @@ class WM_OT_properties_remove(Operator):
|
||||
property = rna_property
|
||||
|
||||
def execute(self, context):
|
||||
item = eval("context.%s" % self.data_path)
|
||||
data_path = self.data_path
|
||||
item = eval("context.%s" % data_path)
|
||||
del item[self.property]
|
||||
return {'FINISHED'}
|
||||
|
||||
@ -933,7 +1085,10 @@ class WM_OT_keyconfig_activate(Operator):
|
||||
bl_idname = "wm.keyconfig_activate"
|
||||
bl_label = "Activate Keyconfig"
|
||||
|
||||
filepath = StringProperty(name="File Path", maxlen=1024)
|
||||
filepath = StringProperty(
|
||||
name="File Path",
|
||||
maxlen=1024,
|
||||
)
|
||||
|
||||
def execute(self, context):
|
||||
bpy.utils.keyconfig_set(self.filepath)
|
||||
@ -961,7 +1116,10 @@ class WM_OT_appconfig_activate(Operator):
|
||||
bl_idname = "wm.appconfig_activate"
|
||||
bl_label = "Activate Application Configuration"
|
||||
|
||||
filepath = StringProperty(name="File Path", maxlen=1024)
|
||||
filepath = StringProperty(
|
||||
name="File Path",
|
||||
maxlen=1024,
|
||||
)
|
||||
|
||||
def execute(self, context):
|
||||
import os
|
||||
@ -1021,65 +1179,3 @@ class WM_OT_copy_prev_settings(Operator):
|
||||
return {'FINISHED'}
|
||||
|
||||
return {'CANCELLED'}
|
||||
|
||||
|
||||
def _webbrowser_bug_fix():
|
||||
# test for X11
|
||||
import os
|
||||
|
||||
if os.environ.get("DISPLAY"):
|
||||
|
||||
# BSD licenced code copied from python, temp fix for bug
|
||||
# http://bugs.python.org/issue11432, XXX == added code
|
||||
def _invoke(self, args, remote, autoraise):
|
||||
# XXX, added imports
|
||||
import io
|
||||
import subprocess
|
||||
import time
|
||||
|
||||
raise_opt = []
|
||||
if remote and self.raise_opts:
|
||||
# use autoraise argument only for remote invocation
|
||||
autoraise = int(autoraise)
|
||||
opt = self.raise_opts[autoraise]
|
||||
if opt:
|
||||
raise_opt = [opt]
|
||||
|
||||
cmdline = [self.name] + raise_opt + args
|
||||
|
||||
if remote or self.background:
|
||||
inout = io.open(os.devnull, "r+")
|
||||
else:
|
||||
# for TTY browsers, we need stdin/out
|
||||
inout = None
|
||||
# if possible, put browser in separate process group, so
|
||||
# keyboard interrupts don't affect browser as well as Python
|
||||
setsid = getattr(os, 'setsid', None)
|
||||
if not setsid:
|
||||
setsid = getattr(os, 'setpgrp', None)
|
||||
|
||||
p = subprocess.Popen(cmdline, close_fds=True, # XXX, stdin=inout,
|
||||
stdout=(self.redirect_stdout and inout or None),
|
||||
stderr=inout, preexec_fn=setsid)
|
||||
if remote:
|
||||
# wait five secons. If the subprocess is not finished, the
|
||||
# remote invocation has (hopefully) started a new instance.
|
||||
time.sleep(1)
|
||||
rc = p.poll()
|
||||
if rc is None:
|
||||
time.sleep(4)
|
||||
rc = p.poll()
|
||||
if rc is None:
|
||||
return True
|
||||
# if remote call failed, open() will try direct invocation
|
||||
return not rc
|
||||
elif self.background:
|
||||
if p.poll() is None:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
else:
|
||||
return not p.wait()
|
||||
|
||||
import webbrowser
|
||||
webbrowser.UnixBrowser._invoke = _invoke
|
||||
|
@ -102,7 +102,10 @@ def register():
|
||||
items.extend([(cat, cat, "") for cat in sorted(items_unique)])
|
||||
return items
|
||||
|
||||
WindowManager.addon_search = StringProperty(name="Search", description="Search within the selected filter")
|
||||
WindowManager.addon_search = StringProperty(
|
||||
name="Search",
|
||||
description="Search within the selected filter",
|
||||
)
|
||||
WindowManager.addon_filter = EnumProperty(
|
||||
items=addon_filter_items,
|
||||
name="Category",
|
||||
|
@ -107,7 +107,7 @@ class DATA_PT_camera(CameraButtonsPanel, Panel):
|
||||
|
||||
col = split.column()
|
||||
|
||||
if cam.dof_object != None:
|
||||
if cam.dof_object is not None:
|
||||
col.enabled = False
|
||||
col.prop(cam, "dof_distance", text="Distance")
|
||||
|
||||
|
@ -109,7 +109,7 @@ class DATA_PT_shape_curve(CurveButtonsPanel, Panel):
|
||||
if (is_curve or is_text):
|
||||
col.label(text="Fill:")
|
||||
sub = col.column()
|
||||
sub.active = (curve.bevel_object is None)
|
||||
sub.active = (curve.dimensions == '2D' or (curve.bevel_object is None and curve.dimensions == '3D'))
|
||||
sub.prop(curve, "use_fill_front")
|
||||
sub.prop(curve, "use_fill_back")
|
||||
col.prop(curve, "use_fill_deform", text="Fill Deformed")
|
||||
|
@ -577,13 +577,13 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
|
||||
sub = col.column()
|
||||
sub.active = bool(md.vertex_group)
|
||||
sub.prop(md, "invert_vertex_group", text="Invert")
|
||||
sub.prop(md, "thickness_vertex_group", text="Factor")
|
||||
|
||||
col.prop(md, "use_even_offset")
|
||||
col.prop(md, "use_quality_normals")
|
||||
col.prop(md, "use_rim")
|
||||
|
||||
sub = col.column()
|
||||
sub.label()
|
||||
row = sub.split(align=True, percentage=0.4)
|
||||
row.prop(md, "material_offset", text="")
|
||||
row = row.row()
|
||||
|
@ -156,7 +156,7 @@ class PARTICLE_PT_context_particles(ParticleButtonsPanel, Panel):
|
||||
if part:
|
||||
split = layout.split(percentage=0.65)
|
||||
if part.type == 'HAIR':
|
||||
if psys != None and psys.is_edited:
|
||||
if psys is not None and psys.is_edited:
|
||||
split.operator("particle.edited_clear", text="Free Edit")
|
||||
else:
|
||||
row = split.row()
|
||||
@ -166,12 +166,12 @@ class PARTICLE_PT_context_particles(ParticleButtonsPanel, Panel):
|
||||
row = split.row()
|
||||
row.enabled = particle_panel_enabled(context, psys)
|
||||
row.prop(part, "hair_step")
|
||||
if psys != None and psys.is_edited:
|
||||
if psys is not None and psys.is_edited:
|
||||
if psys.is_global_hair:
|
||||
layout.operator("particle.connect_hair")
|
||||
else:
|
||||
layout.operator("particle.disconnect_hair")
|
||||
elif psys != None and part.type == 'REACTOR':
|
||||
elif psys is not None and part.type == 'REACTOR':
|
||||
split.enabled = particle_panel_enabled(context, psys)
|
||||
split.prop(psys, "reactor_target_object")
|
||||
split.prop(psys, "reactor_target_particle_system", text="Particle System")
|
||||
@ -654,7 +654,7 @@ class PARTICLE_PT_boidbrain(ParticleButtonsPanel, Panel):
|
||||
|
||||
if settings is None:
|
||||
return False
|
||||
if psys != None and psys.point_cache.use_external:
|
||||
if psys is not None and psys.point_cache.use_external:
|
||||
return False
|
||||
return settings.physics_type == 'BOIDS' and engine in cls.COMPAT_ENGINES
|
||||
|
||||
|
@ -415,6 +415,10 @@ class TEXTURE_PT_image_sampling(TextureTypePanel, Panel):
|
||||
row.active = tex.use_normal_map
|
||||
row.prop(slot, "normal_map_space", text="")
|
||||
|
||||
row = col.row()
|
||||
row.active = not tex.use_normal_map
|
||||
row.prop(tex, "use_derivative_map")
|
||||
|
||||
col.prop(tex, "use_mipmap")
|
||||
row = col.row()
|
||||
row.active = tex.use_mipmap
|
||||
@ -1025,12 +1029,14 @@ class TEXTURE_PT_influence(TextureSlotPanel, Panel):
|
||||
|
||||
# only show bump settings if activated but not for normalmap images
|
||||
row = layout.row()
|
||||
row.active = (tex.use_map_normal or tex.use_map_warp) and not (tex.texture.type == 'IMAGE' and tex.texture.use_normal_map)
|
||||
|
||||
row.prop(tex, "bump_method", text="Method")
|
||||
|
||||
sub = row.row()
|
||||
sub.active = tex.bump_method in {'BUMP_DEFAULT', 'BUMP_BEST_QUALITY'}
|
||||
sub.active = (tex.use_map_normal or tex.use_map_warp) and not (tex.texture.type == 'IMAGE' and (tex.texture.use_normal_map or tex.texture.use_derivative_map))
|
||||
sub.prop(tex, "bump_method", text="Method")
|
||||
|
||||
# the space setting is supported for: derivmaps + bumpmaps (DEFAULT,BEST_QUALITY), not for normalmaps
|
||||
sub = row.row()
|
||||
sub.active = (tex.use_map_normal or tex.use_map_warp) and not (tex.texture.type == 'IMAGE' and tex.texture.use_normal_map) and ((tex.bump_method in {'BUMP_DEFAULT', 'BUMP_BEST_QUALITY'}) or (tex.texture.type == 'IMAGE' and tex.texture.use_derivative_map))
|
||||
sub.prop(tex, "bump_objectspace", text="Space")
|
||||
|
||||
|
||||
|
@ -141,7 +141,11 @@ class ConsoleLanguage(Operator):
|
||||
'''Set the current language for this console'''
|
||||
bl_idname = "console.language"
|
||||
bl_label = "Console Language"
|
||||
language = StringProperty(name="Language", maxlen=32, default="")
|
||||
|
||||
language = StringProperty(
|
||||
name="Language",
|
||||
maxlen=32,
|
||||
)
|
||||
|
||||
def execute(self, context):
|
||||
sc = context.space_data
|
||||
|
@ -101,7 +101,7 @@ class DOPESHEET_HT_header(Header):
|
||||
row.menu("DOPESHEET_MT_select")
|
||||
row.menu("DOPESHEET_MT_marker")
|
||||
|
||||
if st.mode == 'DOPESHEET' or (st.mode == 'ACTION' and st.action != None):
|
||||
if st.mode == 'DOPESHEET' or (st.mode == 'ACTION' and st.action is not None):
|
||||
row.menu("DOPESHEET_MT_channel")
|
||||
elif st.mode == 'GPENCIL':
|
||||
row.menu("DOPESHEET_MT_gpencil_channel")
|
||||
|
@ -387,7 +387,7 @@ class IMAGE_HT_header(Header):
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.prop(toolsettings, "use_snap", text="")
|
||||
row.prop(toolsettings, "snap_element", text="", icon_only=True)
|
||||
row.prop(toolsettings, "snap_target", text="")
|
||||
|
||||
mesh = context.edit_object.data
|
||||
layout.prop_search(mesh.uv_textures, "active", mesh, "uv_textures", text="")
|
||||
|
@ -239,6 +239,7 @@ class SEQUENCER_MT_strip(Menu):
|
||||
layout.operator("sequencer.cut", text="Cut (hard) at frame").type = 'HARD'
|
||||
layout.operator("sequencer.cut", text="Cut (soft) at frame").type = 'SOFT'
|
||||
layout.operator("sequencer.images_separate")
|
||||
layout.operator("sequencer.offset_clear")
|
||||
layout.operator("sequencer.deinterlace_selected_movies")
|
||||
layout.separator()
|
||||
|
||||
@ -381,6 +382,8 @@ class SEQUENCER_PT_edit(SequencerButtonsPanel, Panel):
|
||||
|
||||
if elem and elem.orig_width > 0 and elem.orig_height > 0:
|
||||
col.label(text="Orig Dim: %dx%d" % (elem.orig_width, elem.orig_height))
|
||||
else:
|
||||
col.label(text="Orig Dim: None")
|
||||
|
||||
|
||||
class SEQUENCER_PT_effect(SequencerButtonsPanel, Panel):
|
||||
@ -565,6 +568,9 @@ class SEQUENCER_PT_input(SequencerButtonsPanel, Panel):
|
||||
col = split.column()
|
||||
col.prop(elem, "filename", text="") # strip.elements[0] could be a fallback
|
||||
|
||||
# also accessible from the menu
|
||||
layout.operator("sequencer.change_path")
|
||||
|
||||
elif seq_type == 'MOVIE':
|
||||
split = layout.split(percentage=0.2)
|
||||
col = split.column()
|
||||
|
@ -1106,7 +1106,10 @@ class WM_OT_addon_disable(Operator):
|
||||
bl_idname = "wm.addon_disable"
|
||||
bl_label = "Disable Add-On"
|
||||
|
||||
module = StringProperty(name="Module", description="Module name of the addon to disable")
|
||||
module = StringProperty(
|
||||
name="Module",
|
||||
description="Module name of the addon to disable",
|
||||
)
|
||||
|
||||
def execute(self, context):
|
||||
addon_utils.disable(self.module)
|
||||
@ -1118,16 +1121,35 @@ class WM_OT_addon_install(Operator):
|
||||
bl_idname = "wm.addon_install"
|
||||
bl_label = "Install Add-On..."
|
||||
|
||||
overwrite = BoolProperty(name="Overwrite", description="Remove existing addons with the same ID", default=True)
|
||||
overwrite = BoolProperty(
|
||||
name="Overwrite",
|
||||
description="Remove existing addons with the same ID",
|
||||
default=True,
|
||||
)
|
||||
target = EnumProperty(
|
||||
name="Target Path",
|
||||
items=(('DEFAULT', "Default", ""),
|
||||
('PREFS', "User Prefs", "")))
|
||||
('PREFS', "User Prefs", "")),
|
||||
)
|
||||
|
||||
filepath = StringProperty(name="File Path", description="File path to write file to")
|
||||
filter_folder = BoolProperty(name="Filter folders", description="", default=True, options={'HIDDEN'})
|
||||
filter_python = BoolProperty(name="Filter python", description="", default=True, options={'HIDDEN'})
|
||||
filter_glob = StringProperty(default="*.py;*.zip", options={'HIDDEN'})
|
||||
filepath = StringProperty(
|
||||
name="File Path",
|
||||
description="File path to write file to",
|
||||
)
|
||||
filter_folder = BoolProperty(
|
||||
name="Filter folders",
|
||||
default=True,
|
||||
options={'HIDDEN'},
|
||||
)
|
||||
filter_python = BoolProperty(
|
||||
name="Filter python",
|
||||
default=True,
|
||||
options={'HIDDEN'},
|
||||
)
|
||||
filter_glob = StringProperty(
|
||||
default="*.py;*.zip",
|
||||
options={'HIDDEN'},
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def _module_remove(path_addons, module):
|
||||
@ -1264,7 +1286,10 @@ class WM_OT_addon_remove(Operator):
|
||||
bl_idname = "wm.addon_remove"
|
||||
bl_label = "Remove Add-On"
|
||||
|
||||
module = StringProperty(name="Module", description="Module name of the addon to remove")
|
||||
module = StringProperty(
|
||||
name="Module",
|
||||
description="Module name of the addon to remove",
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def path_from_addon(module):
|
||||
@ -1312,7 +1337,10 @@ class WM_OT_addon_expand(Operator):
|
||||
bl_idname = "wm.addon_expand"
|
||||
bl_label = ""
|
||||
|
||||
module = StringProperty(name="Module", description="Module name of the addon to expand")
|
||||
module = StringProperty(
|
||||
name="Module",
|
||||
description="Module name of the addon to expand",
|
||||
)
|
||||
|
||||
def execute(self, context):
|
||||
module_name = self.module
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
# <pep8 compliant>
|
||||
import bpy
|
||||
from bpy.types import Menu, Operator
|
||||
from bpy.types import Menu, Operator, OperatorProperties
|
||||
import os
|
||||
|
||||
|
||||
@ -533,12 +533,31 @@ class WM_OT_keyconfig_import(Operator):
|
||||
bl_idname = "wm.keyconfig_import"
|
||||
bl_label = "Import Key Configuration..."
|
||||
|
||||
filepath = StringProperty(name="File Path", description="Filepath to write file to", default="keymap.py")
|
||||
filter_folder = BoolProperty(name="Filter folders", description="", default=True, options={'HIDDEN'})
|
||||
filter_text = BoolProperty(name="Filter text", description="", default=True, options={'HIDDEN'})
|
||||
filter_python = BoolProperty(name="Filter python", description="", default=True, options={'HIDDEN'})
|
||||
|
||||
keep_original = BoolProperty(name="Keep original", description="Keep original file after copying to configuration folder", default=True)
|
||||
filepath = StringProperty(
|
||||
name="File Path",
|
||||
description="Filepath to write file to",
|
||||
default="keymap.py",
|
||||
)
|
||||
filter_folder = BoolProperty(
|
||||
name="Filter folders",
|
||||
default=True,
|
||||
options={'HIDDEN'},
|
||||
)
|
||||
filter_text = BoolProperty(
|
||||
name="Filter text",
|
||||
default=True,
|
||||
options={'HIDDEN'},
|
||||
)
|
||||
filter_python = BoolProperty(
|
||||
name="Filter python",
|
||||
default=True,
|
||||
options={'HIDDEN'},
|
||||
)
|
||||
keep_original = BoolProperty(
|
||||
name="Keep original",
|
||||
description="Keep original file after copying to configuration folder",
|
||||
default=True,
|
||||
)
|
||||
|
||||
def execute(self, context):
|
||||
from os.path import basename
|
||||
@ -580,10 +599,26 @@ class WM_OT_keyconfig_export(Operator):
|
||||
bl_idname = "wm.keyconfig_export"
|
||||
bl_label = "Export Key Configuration..."
|
||||
|
||||
filepath = StringProperty(name="File Path", description="Filepath to write file to", default="keymap.py")
|
||||
filter_folder = BoolProperty(name="Filter folders", description="", default=True, options={'HIDDEN'})
|
||||
filter_text = BoolProperty(name="Filter text", description="", default=True, options={'HIDDEN'})
|
||||
filter_python = BoolProperty(name="Filter python", description="", default=True, options={'HIDDEN'})
|
||||
filepath = StringProperty(
|
||||
name="File Path",
|
||||
description="Filepath to write file to",
|
||||
default="keymap.py",
|
||||
)
|
||||
filter_folder = BoolProperty(
|
||||
name="Filter folders",
|
||||
default=True,
|
||||
options={'HIDDEN'},
|
||||
)
|
||||
filter_text = BoolProperty(
|
||||
name="Filter text",
|
||||
default=True,
|
||||
options={'HIDDEN'},
|
||||
)
|
||||
filter_python = BoolProperty(
|
||||
name="Filter python",
|
||||
default=True,
|
||||
options={'HIDDEN'},
|
||||
)
|
||||
|
||||
def execute(self, context):
|
||||
if not self.filepath:
|
||||
@ -673,7 +708,10 @@ class WM_OT_keymap_restore(Operator):
|
||||
bl_idname = "wm.keymap_restore"
|
||||
bl_label = "Restore Key Map(s)"
|
||||
|
||||
all = BoolProperty(name="All Keymaps", description="Restore all keymaps to default")
|
||||
all = BoolProperty(
|
||||
name="All Keymaps",
|
||||
description="Restore all keymaps to default",
|
||||
)
|
||||
|
||||
def execute(self, context):
|
||||
wm = context.window_manager
|
||||
@ -693,7 +731,10 @@ class WM_OT_keyitem_restore(Operator):
|
||||
bl_idname = "wm.keyitem_restore"
|
||||
bl_label = "Restore Key Map Item"
|
||||
|
||||
item_id = IntProperty(name="Item Identifier", description="Identifier of the item to remove")
|
||||
item_id = IntProperty(
|
||||
name="Item Identifier",
|
||||
description="Identifier of the item to remove",
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
@ -737,7 +778,10 @@ class WM_OT_keyitem_remove(Operator):
|
||||
bl_idname = "wm.keyitem_remove"
|
||||
bl_label = "Remove Key Map Item"
|
||||
|
||||
item_id = IntProperty(name="Item Identifier", description="Identifier of the item to remove")
|
||||
item_id = IntProperty(
|
||||
name="Item Identifier",
|
||||
description="Identifier of the item to remove",
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
|
@ -2073,9 +2073,11 @@ class VIEW3D_PT_view3d_properties(Panel):
|
||||
col.prop(view, "lens")
|
||||
col.label(text="Lock to Object:")
|
||||
col.prop(view, "lock_object", text="")
|
||||
if view.lock_object and view.lock_object.type == 'ARMATURE':
|
||||
col.prop_search(view, "lock_bone", view.lock_object.data, "bones", text="")
|
||||
elif not view.lock_object:
|
||||
lock_object = view.lock_object
|
||||
if lock_object:
|
||||
if lock_object.type == 'ARMATURE':
|
||||
col.prop_search(view, "lock_bone", lock_object.data, "edit_bones" if lock_object.mode == 'EDIT' else "bones", text="")
|
||||
else:
|
||||
col.prop(view, "lock_cursor", text="Lock to Cursor")
|
||||
|
||||
col = layout.column()
|
||||
|
@ -1049,7 +1049,7 @@ class VIEW3D_PT_tools_weightpaint(View3DPanel, Panel):
|
||||
ob = context.active_object
|
||||
|
||||
col = layout.column()
|
||||
col.active = ob.vertex_groups.active != None
|
||||
col.active = ob.vertex_groups.active is not None
|
||||
col.operator("object.vertex_group_normalize_all", text="Normalize All")
|
||||
col.operator("object.vertex_group_normalize", text="Normalize")
|
||||
col.operator("object.vertex_group_invert", text="Invert")
|
||||
|
@ -45,10 +45,12 @@ class OBJECT_OT_add_object(bpy.types.Operator, AddObjectHelper):
|
||||
bl_description = "Create a new Mesh Object"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
scale = FloatVectorProperty(name='scale',
|
||||
scale = FloatVectorProperty(
|
||||
name='scale',
|
||||
default=(1.0, 1.0, 1.0),
|
||||
subtype='TRANSLATION',
|
||||
description='scaling')
|
||||
description='scaling',
|
||||
)
|
||||
|
||||
def execute(self, context):
|
||||
|
||||
|
@ -24,22 +24,30 @@ class ExportSomeData(bpy.types.Operator, ExportHelper):
|
||||
# ExportHelper mixin class uses this
|
||||
filename_ext = ".txt"
|
||||
|
||||
filter_glob = StringProperty(default="*.txt", options={'HIDDEN'})
|
||||
filter_glob = StringProperty(
|
||||
default="*.txt",
|
||||
options={'HIDDEN'},
|
||||
)
|
||||
|
||||
# List of operator properties, the attributes will be assigned
|
||||
# to the class instance from the operator settings before calling.
|
||||
use_setting = BoolProperty(name="Example Boolean", description="Example Tooltip", default=True)
|
||||
use_setting = BoolProperty(
|
||||
name="Example Boolean",
|
||||
description="Example Tooltip",
|
||||
default=True,
|
||||
)
|
||||
|
||||
type = EnumProperty(items=(('OPT_A', "First Option", "Description one"),
|
||||
('OPT_B', "Second Option", "Description two."),
|
||||
),
|
||||
type = EnumProperty(
|
||||
name="Example Enum",
|
||||
description="Choose between two items",
|
||||
default='OPT_A')
|
||||
items=(('OPT_A', "First Option", "Description one"),
|
||||
('OPT_B', "Second Option", "Description two.")),
|
||||
default='OPT_A',
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return context.active_object != None
|
||||
return context.active_object is not None
|
||||
|
||||
def execute(self, context):
|
||||
return write_some_data(context, self.filepath, self.use_setting)
|
||||
|
@ -43,25 +43,38 @@ class AddBox(bpy.types.Operator):
|
||||
bl_label = "Add Box"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
width = FloatProperty(name="Width",
|
||||
width = FloatProperty(
|
||||
name="Width",
|
||||
description="Box Width",
|
||||
default=1.0, min=0.01, max=100.0)
|
||||
|
||||
height = FloatProperty(name="Height",
|
||||
min=0.01, max=100.0,
|
||||
default=1.0,
|
||||
)
|
||||
height = FloatProperty(
|
||||
name="Height",
|
||||
description="Box Height",
|
||||
default=1.0, min=0.01, max=100.0)
|
||||
|
||||
depth = FloatProperty(name="Depth",
|
||||
min=0.01, max=100.0,
|
||||
default=1.0,
|
||||
)
|
||||
depth = FloatProperty(
|
||||
name="Depth",
|
||||
description="Box Depth",
|
||||
default=1.0, min=0.01, max=100.0)
|
||||
min=0.01, max=100.0,
|
||||
default=1.0,
|
||||
)
|
||||
|
||||
# generic transform props
|
||||
view_align = BoolProperty(name="Align to View",
|
||||
default=False)
|
||||
location = FloatVectorProperty(name="Location",
|
||||
subtype='TRANSLATION')
|
||||
rotation = FloatVectorProperty(name="Rotation",
|
||||
subtype='EULER')
|
||||
view_align = BoolProperty(
|
||||
name="Align to View",
|
||||
default=False,
|
||||
)
|
||||
location = FloatVectorProperty(
|
||||
name="Location",
|
||||
subtype='TRANSLATION',
|
||||
)
|
||||
rotation = FloatVectorProperty(
|
||||
name="Rotation",
|
||||
subtype='EULER',
|
||||
)
|
||||
|
||||
def execute(self, context):
|
||||
|
||||
|
@ -8,7 +8,10 @@ class ViewOperator(bpy.types.Operator):
|
||||
bl_idname = "view3d.modal_operator"
|
||||
bl_label = "Simple View Operator"
|
||||
|
||||
offset = FloatVectorProperty(name="Offset", size=3)
|
||||
offset = FloatVectorProperty(
|
||||
name="Offset",
|
||||
size=3,
|
||||
)
|
||||
|
||||
def execute(self, context):
|
||||
v3d = context.space_data
|
||||
|
@ -13,7 +13,7 @@ class SimpleOperator(bpy.types.Operator):
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return context.active_object != None
|
||||
return context.active_object is not None
|
||||
|
||||
def execute(self, context):
|
||||
main(context)
|
||||
|
@ -1245,6 +1245,8 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
|
||||
sim.ob= par;
|
||||
sim.psys= psys;
|
||||
sim.psmd= psys_get_modifier(par, psys);
|
||||
/* make sure emitter imat is in global coordinates instead of render view coordinates */
|
||||
invert_m4_m4(par->imat, par->obmat);
|
||||
|
||||
/* first check for loops (particle system object used as dupli object) */
|
||||
if(part->ren_as == PART_DRAW_OB) {
|
||||
@ -1349,6 +1351,10 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
|
||||
continue;
|
||||
|
||||
if(part->ren_as==PART_DRAW_GR) {
|
||||
/* prevent divide by zero below [#28336] */
|
||||
if(totgroup == 0)
|
||||
continue;
|
||||
|
||||
/* for groups, pick the object based on settings */
|
||||
if(part->draw&PART_DRAW_RAND_GR)
|
||||
b= BLI_rand() % totgroup;
|
||||
|
@ -923,7 +923,7 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d
|
||||
|
||||
for(i = 0; i < dm->getNumVerts(dm); i++)
|
||||
{
|
||||
maxdist = MAX2(maxdist, clmd->coll_parms->selfepsilon* ( cloth->verts[i].avg_spring_len*2.0));
|
||||
maxdist = MAX2(maxdist, clmd->coll_parms->selfepsilon* ( cloth->verts[i].avg_spring_len*2.0f));
|
||||
}
|
||||
|
||||
clmd->clothObject->bvhselftree = bvhselftree_build_from_cloth ( clmd, maxdist );
|
||||
|
@ -301,6 +301,7 @@ static void dag_add_driver_relation(AnimData *adt, DagForest *dag, DagNode *node
|
||||
for (fcu= adt->drivers.first; fcu; fcu= fcu->next) {
|
||||
ChannelDriver *driver= fcu->driver;
|
||||
DriverVar *dvar;
|
||||
int isdata_fcu = isdata || (fcu->rna_path && strstr(fcu->rna_path, "modifiers["));
|
||||
|
||||
/* loop over variables to get the target relationships */
|
||||
for (dvar= driver->variables.first; dvar; dvar= dvar->next) {
|
||||
@ -320,14 +321,14 @@ static void dag_add_driver_relation(AnimData *adt, DagForest *dag, DagNode *node
|
||||
( ((dtar->rna_path) && strstr(dtar->rna_path, "pose.bones[")) ||
|
||||
((dtar->flag & DTAR_FLAG_STRUCT_REF) && (dtar->pchan_name[0])) ))
|
||||
{
|
||||
dag_add_relation(dag, node1, node, isdata?DAG_RL_DATA_DATA:DAG_RL_DATA_OB, "Driver");
|
||||
dag_add_relation(dag, node1, node, isdata_fcu?DAG_RL_DATA_DATA:DAG_RL_DATA_OB, "Driver");
|
||||
}
|
||||
/* check if ob data */
|
||||
else if (dtar->rna_path && strstr(dtar->rna_path, "data."))
|
||||
dag_add_relation(dag, node1, node, isdata?DAG_RL_DATA_DATA:DAG_RL_DATA_OB, "Driver");
|
||||
dag_add_relation(dag, node1, node, isdata_fcu?DAG_RL_DATA_DATA:DAG_RL_DATA_OB, "Driver");
|
||||
/* normal */
|
||||
else
|
||||
dag_add_relation(dag, node1, node, isdata?DAG_RL_OB_DATA:DAG_RL_OB_OB, "Driver");
|
||||
dag_add_relation(dag, node1, node, isdata_fcu?DAG_RL_OB_DATA:DAG_RL_OB_OB, "Driver");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1369,6 +1369,11 @@ void makeDispListCurveTypes(Scene *scene, Object *ob, int forOrco)
|
||||
Curve *cu= ob->data;
|
||||
ListBase *dispbase;
|
||||
|
||||
/* The same check for duplis as in do_makeDispListCurveTypes.
|
||||
Happens when curve used for constraint/bevel was converted to mesh.
|
||||
check there is still needed for render displist and orco displists. */
|
||||
if(!ELEM3(ob->type, OB_SURF, OB_CURVE, OB_FONT)) return;
|
||||
|
||||
freedisplist(&(ob->disp));
|
||||
dispbase= &(ob->disp);
|
||||
freedisplist(dispbase);
|
||||
|
@ -1002,7 +1002,7 @@ static float dtar_get_prop_val (ChannelDriver *driver, DriverTarget *dtar)
|
||||
|
||||
/* get property to read from, and get value as appropriate */
|
||||
if (RNA_path_resolve_full(&id_ptr, dtar->rna_path, &ptr, &prop, &index)) {
|
||||
if(RNA_property_array_check(&ptr, prop)) {
|
||||
if(RNA_property_array_check(prop)) {
|
||||
/* array */
|
||||
if (index < RNA_property_array_length(&ptr, prop)) {
|
||||
switch (RNA_property_type(prop)) {
|
||||
|
@ -1537,6 +1537,7 @@ void multires_load_old(Object *ob, Mesh *me)
|
||||
me->mface[i].v2 = lvl->faces[i].v[1];
|
||||
me->mface[i].v3 = lvl->faces[i].v[2];
|
||||
me->mface[i].v4 = lvl->faces[i].v[3];
|
||||
me->mface[i].mat_nr = lvl->faces[i].mat_nr;
|
||||
}
|
||||
|
||||
/* Add a multires modifier to the object */
|
||||
|
@ -1582,7 +1582,7 @@ void BKE_nla_tweakmode_exit (AnimData *adt)
|
||||
|
||||
/* Baking Tools ------------------------------------------- */
|
||||
|
||||
static void BKE_nla_bake (Scene *scene, ID *UNUSED(id), AnimData *adt, int UNUSED(flag))
|
||||
static void UNUSED_FUNCTION(BKE_nla_bake) (Scene *scene, ID *UNUSED(id), AnimData *adt, int UNUSED(flag))
|
||||
{
|
||||
|
||||
/* verify that data is valid
|
||||
|
@ -3243,7 +3243,7 @@ static int node_animation_properties(bNodeTree *ntree, bNode *node)
|
||||
int driven, len=1, index;
|
||||
prop = (PropertyRNA *)link;
|
||||
|
||||
if (RNA_property_array_check(&ptr, prop))
|
||||
if (RNA_property_array_check(prop))
|
||||
len = RNA_property_array_length(&ptr, prop);
|
||||
|
||||
for (index=0; index<len; index++) {
|
||||
@ -3261,7 +3261,7 @@ static int node_animation_properties(bNodeTree *ntree, bNode *node)
|
||||
RNA_pointer_create((ID *)ntree, &RNA_NodeSocket, sock, &ptr);
|
||||
prop = RNA_struct_find_property(&ptr, "default_value");
|
||||
|
||||
if (RNA_property_array_check(&ptr, prop))
|
||||
if (RNA_property_array_check(prop))
|
||||
len = RNA_property_array_length(&ptr, prop);
|
||||
|
||||
for (index=0; index<len; index++) {
|
||||
|
@ -699,6 +699,7 @@ void reload_sequence_new_file(Scene *scene, Sequence * seq, int lock_range)
|
||||
seq->len = 0;
|
||||
}
|
||||
seq->strip->len = seq->len;
|
||||
break;
|
||||
case SEQ_SOUND:
|
||||
#ifdef WITH_AUDASPACE
|
||||
if(!seq->sound)
|
||||
|
@ -1005,7 +1005,7 @@ void autotexname(Tex *tex)
|
||||
|
||||
Tex *give_current_object_texture(Object *ob)
|
||||
{
|
||||
Material *ma;
|
||||
Material *ma, *node_ma;
|
||||
Tex *tex= NULL;
|
||||
|
||||
if(ob==NULL) return NULL;
|
||||
@ -1015,6 +1015,10 @@ Tex *give_current_object_texture(Object *ob)
|
||||
tex= give_current_lamp_texture(ob->data);
|
||||
} else {
|
||||
ma= give_current_material(ob, ob->actcol);
|
||||
|
||||
if((node_ma=give_node_material(ma)))
|
||||
ma= node_ma;
|
||||
|
||||
tex= give_current_material_texture(ma);
|
||||
}
|
||||
|
||||
@ -1080,17 +1084,6 @@ Tex *give_current_material_texture(Material *ma)
|
||||
tex= (Tex *)node->id;
|
||||
ma= NULL;
|
||||
}
|
||||
else {
|
||||
node= nodeGetActiveID(ma->nodetree, ID_MA);
|
||||
if(node) {
|
||||
ma= (Material*)node->id;
|
||||
if(ma) {
|
||||
mtex= ma->mtex[(int)(ma->texact)];
|
||||
if(mtex) tex= mtex->tex;
|
||||
}
|
||||
}
|
||||
}
|
||||
return tex;
|
||||
}
|
||||
|
||||
if(ma) {
|
||||
@ -1165,11 +1158,6 @@ void set_current_material_texture(Material *ma, Tex *newtex)
|
||||
id_us_plus(&newtex->id);
|
||||
ma= NULL;
|
||||
}
|
||||
else {
|
||||
node= nodeGetActiveID(ma->nodetree, ID_MA);
|
||||
if(node)
|
||||
ma= (Material*)node->id;
|
||||
}
|
||||
}
|
||||
if(ma) {
|
||||
int act= (int)ma->texact;
|
||||
@ -1198,16 +1186,8 @@ int has_current_material_texture(Material *ma)
|
||||
if(ma && ma->use_nodes && ma->nodetree) {
|
||||
node= nodeGetActiveID(ma->nodetree, ID_TE);
|
||||
|
||||
if(node) {
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
node= nodeGetActiveID(ma->nodetree, ID_MA);
|
||||
if(node)
|
||||
ma= (Material*)node->id;
|
||||
else
|
||||
ma= NULL;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
return (ma != NULL);
|
||||
|
@ -122,6 +122,8 @@ __attribute__ ((format (printf, 1, 2)))
|
||||
#endif
|
||||
;
|
||||
|
||||
size_t BLI_strescape(char *dst, const char *src, const size_t maxlen);
|
||||
|
||||
/**
|
||||
* Compare two strings without regard to case.
|
||||
*
|
||||
|
@ -183,6 +183,12 @@
|
||||
# define UNUSED(x) UNUSED_ ## x
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
# define UNUSED_FUNCTION(x) __attribute__((__unused__)) UNUSED_ ## x
|
||||
#else
|
||||
# define UNUSED_FUNCTION(x) UNUSED_ ## x
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
# define WARN_UNUSED __attribute__((warn_unused_result))
|
||||
#else
|
||||
|
@ -128,8 +128,8 @@ int BLI_ghash_remove (GHash *gh, void *key, GHashKeyFreeFP keyfreefp, GHashValFr
|
||||
if (valfreefp) valfreefp(e->val);
|
||||
BLI_mempool_free(gh->entrypool, e);
|
||||
|
||||
|
||||
e= n;
|
||||
/* correct but 'e' isnt used before return */
|
||||
/* e= n; */ /*UNUSED*/
|
||||
if (p)
|
||||
p->next = n;
|
||||
else
|
||||
|
@ -70,7 +70,9 @@ int BLI_gzip(const char *from, const char *to) {
|
||||
int rval= 0, err;
|
||||
gzFile gzfile;
|
||||
|
||||
gzfile = gzopen(to, "wb");
|
||||
/* level 1 is very close to 3 (the default) in terms of file size,
|
||||
* but about twice as fast, best use for speedy saving - campbell */
|
||||
gzfile = gzopen(to, "wb1");
|
||||
if(gzfile == NULL)
|
||||
return -1;
|
||||
|
||||
|
@ -53,10 +53,10 @@ void BLI_jitterate1(float *jit1, float *jit2, int num, float rad1)
|
||||
y = jit1[i+1];
|
||||
for (j = 2*num-2; j>=0 ; j-=2) {
|
||||
if (i != j){
|
||||
vecx = jit1[j] - x - 1.0;
|
||||
vecy = jit1[j+1] - y - 1.0;
|
||||
vecx = jit1[j] - x - 1.0f;
|
||||
vecy = jit1[j+1] - y - 1.0f;
|
||||
for (k = 3; k>0 ; k--){
|
||||
if( fabs(vecx)<rad1 && fabs(vecy)<rad1) {
|
||||
if( fabsf(vecx)<rad1 && fabsf(vecy)<rad1) {
|
||||
len= sqrt(vecx*vecx + vecy*vecy);
|
||||
if(len>0 && len<rad1) {
|
||||
len= len/rad1;
|
||||
@ -64,9 +64,9 @@ void BLI_jitterate1(float *jit1, float *jit2, int num, float rad1)
|
||||
dvecy += vecy/len;
|
||||
}
|
||||
}
|
||||
vecx += 1.0;
|
||||
vecx += 1.0f;
|
||||
|
||||
if( fabs(vecx)<rad1 && fabs(vecy)<rad1) {
|
||||
if( fabsf(vecx)<rad1 && fabsf(vecy)<rad1) {
|
||||
len= sqrt(vecx*vecx + vecy*vecy);
|
||||
if(len>0 && len<rad1) {
|
||||
len= len/rad1;
|
||||
@ -74,9 +74,9 @@ void BLI_jitterate1(float *jit1, float *jit2, int num, float rad1)
|
||||
dvecy += vecy/len;
|
||||
}
|
||||
}
|
||||
vecx += 1.0;
|
||||
vecx += 1.0f;
|
||||
|
||||
if( fabs(vecx)<rad1 && fabs(vecy)<rad1) {
|
||||
if( fabsf(vecx)<rad1 && fabsf(vecy)<rad1) {
|
||||
len= sqrt(vecx*vecx + vecy*vecy);
|
||||
if(len>0 && len<rad1) {
|
||||
len= len/rad1;
|
||||
@ -84,16 +84,16 @@ void BLI_jitterate1(float *jit1, float *jit2, int num, float rad1)
|
||||
dvecy += vecy/len;
|
||||
}
|
||||
}
|
||||
vecx -= 2.0;
|
||||
vecy += 1.0;
|
||||
vecx -= 2.0f;
|
||||
vecy += 1.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
x -= dvecx/18.0 ;
|
||||
y -= dvecy/18.0;
|
||||
x -= floor(x) ;
|
||||
y -= floor(y);
|
||||
x -= dvecx/18.0f;
|
||||
y -= dvecy/18.0f;
|
||||
x -= floorf(x) ;
|
||||
y -= floorf(y);
|
||||
jit2[i] = x;
|
||||
jit2[i+1] = y;
|
||||
}
|
||||
@ -111,28 +111,28 @@ void BLI_jitterate2(float *jit1, float *jit2, int num, float rad2)
|
||||
y = jit1[i+1];
|
||||
for (j =2*num -2; j>= 0 ; j-=2){
|
||||
if (i != j){
|
||||
vecx = jit1[j] - x - 1.0;
|
||||
vecy = jit1[j+1] - y - 1.0;
|
||||
vecx = jit1[j] - x - 1.0f;
|
||||
vecy = jit1[j+1] - y - 1.0f;
|
||||
|
||||
if( fabs(vecx)<rad2) dvecx+= vecx*rad2;
|
||||
vecx += 1.0;
|
||||
if( fabs(vecx)<rad2) dvecx+= vecx*rad2;
|
||||
vecx += 1.0;
|
||||
if( fabs(vecx)<rad2) dvecx+= vecx*rad2;
|
||||
if( fabsf(vecx)<rad2) dvecx+= vecx*rad2;
|
||||
vecx += 1.0f;
|
||||
if( fabsf(vecx)<rad2) dvecx+= vecx*rad2;
|
||||
vecx += 1.0f;
|
||||
if( fabsf(vecx)<rad2) dvecx+= vecx*rad2;
|
||||
|
||||
if( fabs(vecy)<rad2) dvecy+= vecy*rad2;
|
||||
vecy += 1.0;
|
||||
if( fabs(vecy)<rad2) dvecy+= vecy*rad2;
|
||||
vecy += 1.0;
|
||||
if( fabs(vecy)<rad2) dvecy+= vecy*rad2;
|
||||
if( fabsf(vecy)<rad2) dvecy+= vecy*rad2;
|
||||
vecy += 1.0f;
|
||||
if( fabsf(vecy)<rad2) dvecy+= vecy*rad2;
|
||||
vecy += 1.0f;
|
||||
if( fabsf(vecy)<rad2) dvecy+= vecy*rad2;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
x -= dvecx/2 ;
|
||||
y -= dvecy/2;
|
||||
x -= floor(x) ;
|
||||
y -= floor(y);
|
||||
x -= dvecx/2.0f;
|
||||
y -= dvecy/2.0f;
|
||||
x -= floorf(x) ;
|
||||
y -= floorf(y);
|
||||
jit2[i] = x;
|
||||
jit2[i+1] = y;
|
||||
}
|
||||
@ -148,17 +148,17 @@ void BLI_initjit(float *jitarr, int num)
|
||||
if(num==0) return;
|
||||
|
||||
jit2= MEM_mallocN(12 + 2*sizeof(float)*num, "initjit");
|
||||
rad1= 1.0/sqrt((float)num);
|
||||
rad2= 1.0/((float)num);
|
||||
rad3= sqrt((float)num)/((float)num);
|
||||
rad1= 1.0f/sqrtf((float)num);
|
||||
rad2= 1.0f/((float)num);
|
||||
rad3= sqrtf((float)num)/((float)num);
|
||||
|
||||
BLI_srand(31415926 + num);
|
||||
x= 0;
|
||||
for(i=0; i<2*num; i+=2) {
|
||||
jitarr[i]= x+ rad1*(0.5-BLI_drand());
|
||||
jitarr[i+1]= ((float)i/2)/num +rad1*(0.5-BLI_drand());
|
||||
jitarr[i]= x+ rad1*(float)(0.5-BLI_drand());
|
||||
jitarr[i+1]= ((float)i/2)/num +rad1*(float)(0.5-BLI_drand());
|
||||
x+= rad3;
|
||||
x -= floor(x);
|
||||
x -= floorf(x);
|
||||
}
|
||||
|
||||
for (i=0 ; i<24 ; i++) {
|
||||
@ -171,8 +171,8 @@ void BLI_initjit(float *jitarr, int num)
|
||||
|
||||
/* finally, move jittertab to be centered around (0,0) */
|
||||
for(i=0; i<2*num; i+=2) {
|
||||
jitarr[i] -= 0.5;
|
||||
jitarr[i+1] -= 0.5;
|
||||
jitarr[i] -= 0.5f;
|
||||
jitarr[i+1] -= 0.5f;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -402,7 +402,7 @@ int isect_line_sphere_v3(const float l1[3], const float l2[3],
|
||||
madd_v3_v3v3fl(r_p1, l1, ldir, mu);
|
||||
return 1;
|
||||
}
|
||||
else if (i > 0.0) {
|
||||
else if (i > 0.0f) {
|
||||
const float i_sqrt= sqrt(i); /* avoid calc twice */
|
||||
|
||||
/* first intersection */
|
||||
@ -456,7 +456,7 @@ int isect_line_sphere_v2(const float l1[2], const float l2[2],
|
||||
madd_v2_v2v2fl(r_p1, l1, ldir, mu);
|
||||
return 1;
|
||||
}
|
||||
else if (i > 0.0) {
|
||||
else if (i > 0.0f) {
|
||||
const float i_sqrt= sqrt(i); /* avoid calc twice */
|
||||
|
||||
/* first intersection */
|
||||
@ -2010,7 +2010,7 @@ void resolve_quad_uv(float uv[2], const float st[2], const float st0[2], const f
|
||||
}
|
||||
|
||||
if(IS_ZERO(denom)==0)
|
||||
uv[1]= (float) (( (1-uv[0])*(st0[i]-st[i]) + uv[0]*(st1[i]-st[i]) ) / denom);
|
||||
uv[1]= (float) (( (1.0f-uv[0])*(st0[i]-st[i]) + uv[0]*(st1[i]-st[i]) ) / denom);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -213,7 +213,7 @@ void quat_to_mat4(float m[][4], const float q[4])
|
||||
double q0, q1, q2, q3, qda,qdb,qdc,qaa,qab,qac,qbb,qbc,qcc;
|
||||
|
||||
#ifdef DEBUG
|
||||
if(!((q0=dot_qtqt(q, q))==0.0f || (fabsf(q0-1.0f) < (float)QUAT_EPSILON))) {
|
||||
if(!((q0=dot_qtqt(q, q))==0.0f || (fabs(q0-1.0) < QUAT_EPSILON))) {
|
||||
fprintf(stderr, "Warning! quat_to_mat4() called with non-normalized: size %.8f *** report a bug ***\n", (float)q0);
|
||||
}
|
||||
#endif
|
||||
@ -492,8 +492,8 @@ void vec_to_quat(float q[4], const float vec[3], short axis, const short upflag)
|
||||
else angle= (float)(-0.5*atan2(-fp[0], -fp[1]));
|
||||
}
|
||||
|
||||
co= (float)cos(angle);
|
||||
si= (float)(sin(angle)/len1);
|
||||
co= cosf(angle);
|
||||
si= sinf(angle)/len1;
|
||||
q2[0]= co;
|
||||
q2[1]= x2*si;
|
||||
q2[2]= y2*si;
|
||||
|
@ -233,10 +233,10 @@ int BLI_isect_rcti(rcti *src1, rcti *src2, rcti *dest)
|
||||
|
||||
void BLI_copy_rcti_rctf(rcti *tar, const rctf *src)
|
||||
{
|
||||
tar->xmin= floor(src->xmin + 0.5);
|
||||
tar->xmax= floor((src->xmax - src->xmin) + 0.5);
|
||||
tar->ymin= floor(src->ymin + 0.5);
|
||||
tar->ymax= floor((src->ymax - src->ymin) + 0.5);
|
||||
tar->xmin= floor(src->xmin + 0.5f);
|
||||
tar->xmax= floor((src->xmax - src->xmin) + 0.5f);
|
||||
tar->ymin= floor(src->ymin + 0.5f);
|
||||
tar->ymax= floor((src->ymax - src->ymin) + 0.5f);
|
||||
}
|
||||
|
||||
void print_rctf(const char *str, rctf *rect)
|
||||
|
@ -288,7 +288,7 @@ static short testedgeside(float *v1, float *v2, float *v3)
|
||||
inp= (v2[cox]-v1[cox])*(v1[coy]-v3[coy])
|
||||
+(v1[coy]-v2[coy])*(v1[cox]-v3[cox]);
|
||||
|
||||
if(inp<0.0) return 0;
|
||||
if(inp < 0.0f) return 0;
|
||||
else if(inp==0) {
|
||||
if(v1[cox]==v3[cox] && v1[coy]==v3[coy]) return 0;
|
||||
if(v2[cox]==v3[cox] && v2[coy]==v3[coy]) return 0;
|
||||
@ -312,8 +312,8 @@ static short addedgetoscanvert(ScFillVert *sc, EditEdge *eed)
|
||||
y= eed->v1->co[coy];
|
||||
|
||||
fac1= eed->v2->co[coy]-y;
|
||||
if(fac1==0.0) {
|
||||
fac1= 1.0e10*(eed->v2->co[cox]-x);
|
||||
if(fac1==0.0f) {
|
||||
fac1= 1.0e10f*(eed->v2->co[cox]-x);
|
||||
|
||||
}
|
||||
else fac1= (x-eed->v2->co[cox])/fac1;
|
||||
@ -324,8 +324,8 @@ static short addedgetoscanvert(ScFillVert *sc, EditEdge *eed)
|
||||
if(ed->v2==eed->v2) return 0;
|
||||
|
||||
fac= ed->v2->co[coy]-y;
|
||||
if(fac==0.0) {
|
||||
fac= 1.0e10*(ed->v2->co[cox]-x);
|
||||
if(fac==0.0f) {
|
||||
fac= 1.0e10f*(ed->v2->co[cox]-x);
|
||||
|
||||
}
|
||||
else fac= (x-ed->v2->co[cox])/fac;
|
||||
@ -443,7 +443,7 @@ static void testvertexnearedge(void)
|
||||
vec2[1]= eed->v2->co[coy];
|
||||
if(boundinsideEV(eed,eve)) {
|
||||
dist= dist_to_line_v2(vec1,vec2,vec3);
|
||||
if(dist<COMPLIMIT) {
|
||||
if(dist<(float)COMPLIMIT) {
|
||||
/* new edge */
|
||||
ed1= BLI_addfilledge(eed->v1, eve);
|
||||
|
||||
@ -816,7 +816,7 @@ int BLI_edgefill(short mat_nr)
|
||||
if(v2) {
|
||||
if( compare_v3v3(v2, eve->co, COMPLIMIT)==0) {
|
||||
len= normal_tri_v3( norm,v1, v2, eve->co);
|
||||
if(len != 0.0) break;
|
||||
if(len != 0.0f) break;
|
||||
}
|
||||
}
|
||||
else if(compare_v3v3(v1, eve->co, COMPLIMIT)==0) {
|
||||
@ -825,7 +825,7 @@ int BLI_edgefill(short mat_nr)
|
||||
eve= eve->next;
|
||||
}
|
||||
|
||||
if(len==0.0) return 0; /* no fill possible */
|
||||
if(len==0.0f) return 0; /* no fill possible */
|
||||
|
||||
norm[0]= fabs(norm[0]);
|
||||
norm[1]= fabs(norm[1]);
|
||||
|
@ -117,6 +117,49 @@ char *BLI_sprintfN(const char *format, ...)
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
/* match pythons string escaping, assume double quotes - (")
|
||||
* TODO: should be used to create RNA animation paths.
|
||||
* TODO: support more fancy string escaping. current code is primitive
|
||||
* this basically is an ascii version of PyUnicode_EncodeUnicodeEscape()
|
||||
* which is a useful reference. */
|
||||
size_t BLI_strescape(char *dst, const char *src, const size_t maxlen)
|
||||
{
|
||||
size_t len= 0;
|
||||
while(len < maxlen) {
|
||||
switch(*src) {
|
||||
case '\0':
|
||||
*dst= '\0';
|
||||
break;
|
||||
case '\\':
|
||||
case '"':
|
||||
|
||||
/* less common but should also be support */
|
||||
case '\t':
|
||||
case '\n':
|
||||
case '\r':
|
||||
if(len + 1 < maxlen) {
|
||||
*dst++ = '\\';
|
||||
len++;
|
||||
}
|
||||
else {
|
||||
/* not enough space to escape */
|
||||
*dst= '\0';
|
||||
break;
|
||||
}
|
||||
/* intentionally pass through */
|
||||
default:
|
||||
*dst = *src;
|
||||
}
|
||||
dst++;
|
||||
src++;
|
||||
len++;
|
||||
}
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
|
||||
/* Makes a copy of the text within the "" that appear after some text 'blahblah'
|
||||
* i.e. for string 'pose["apples"]' with prefix 'pose[', it should grab "apples"
|
||||
*
|
||||
|
@ -55,7 +55,7 @@ set(SRC
|
||||
)
|
||||
|
||||
if(WITH_BUILDINFO)
|
||||
add_definitions(-DNAN_BUILDINFO)
|
||||
add_definitions(-DWITH_BUILDINFO)
|
||||
endif()
|
||||
|
||||
blender_add_lib(bf_blenloader "${SRC}" "${INC}" "${INC_SYS}")
|
||||
|
@ -11859,8 +11859,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
|
||||
Tex *tex;
|
||||
for(tex= main->tex.first; tex; tex= tex->id.next) {
|
||||
if(tex->pd) {
|
||||
if (tex->pd->falloff_speed_scale == 0.0)
|
||||
tex->pd->falloff_speed_scale = 100.0;
|
||||
if (tex->pd->falloff_speed_scale == 0.0f)
|
||||
tex->pd->falloff_speed_scale = 100.0f;
|
||||
|
||||
if (!tex->pd->falloff_curve) {
|
||||
tex->pd->falloff_curve = curvemapping_add(1, 0, 0, 1, 1);
|
||||
|
@ -868,11 +868,13 @@ static void write_particlesettings(WriteData *wd, ListBase *idbase)
|
||||
for(; dw; dw=dw->next) {
|
||||
/* update indices */
|
||||
dw->index = 0;
|
||||
if(part->dup_group) { /* can be NULL if lining fails or set to None */
|
||||
go = part->dup_group->gobject.first;
|
||||
while(go && go->ob != dw->ob) {
|
||||
go=go->next;
|
||||
dw->index++;
|
||||
}
|
||||
}
|
||||
writestruct(wd, DATA, "ParticleDupliWeight", 1, dw);
|
||||
}
|
||||
|
||||
@ -2657,7 +2659,7 @@ static void write_global(WriteData *wd, int fileflags, Main *mainvar)
|
||||
fg.subversion= BLENDER_SUBVERSION;
|
||||
fg.minversion= BLENDER_MINVERSION;
|
||||
fg.minsubversion= BLENDER_MINSUBVERSION;
|
||||
#ifdef NAN_BUILDINFO
|
||||
#ifdef WITH_BUILDINFO
|
||||
{
|
||||
extern char build_rev[];
|
||||
fg.revision= atoi(build_rev);
|
||||
|
@ -11,7 +11,7 @@ if env['WITH_BF_QUICKTIME']:
|
||||
defs.append('WITH_QUICKTIME')
|
||||
incs += ' ' + env['BF_QUICKTIME_INC']
|
||||
|
||||
if env['OURPLATFORM'] == 'linux2':
|
||||
if env['OURPLATFORM'] == 'linux':
|
||||
cflags='-pthread'
|
||||
incs += ' ../../../extern/binreloc/include'
|
||||
|
||||
|
@ -107,7 +107,7 @@ set(SRC
|
||||
)
|
||||
|
||||
if(WITH_BUILDINFO)
|
||||
add_definitions(-DNAN_BUILDINFO)
|
||||
add_definitions(-DWITH_BUILDINFO)
|
||||
endif()
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
|
@ -52,7 +52,7 @@ extern "C"
|
||||
#include "BLI_path_util.h"
|
||||
#include "BLI_fileops.h"
|
||||
#include "ED_keyframing.h"
|
||||
#ifdef NAN_BUILDINFO
|
||||
#ifdef WITH_BUILDINFO
|
||||
extern char build_rev[];
|
||||
#endif
|
||||
}
|
||||
@ -1002,7 +1002,7 @@ void DocumentExporter::exportCurrentScene(Scene *sce, const char* filename, bool
|
||||
else {
|
||||
asset.getContributor().mAuthor = "Blender User";
|
||||
}
|
||||
#ifdef NAN_BUILDINFO
|
||||
#ifdef WITH_BUILDINFO
|
||||
char version_buf[128];
|
||||
sprintf(version_buf, "Blender %d.%02d.%d r%s", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION, build_rev);
|
||||
asset.getContributor().mAuthoringTool = version_buf;
|
||||
|
@ -38,6 +38,6 @@ else:
|
||||
incs = '../blenlib ../blenkernel ../windowmanager ../makesdna ../blenloader ../makesrna ../editors/include ../../../intern/guardedalloc [OPENCOLLADA]/COLLADAStreamWriter/include [OPENCOLLADA]/COLLADABaseUtils/include [OPENCOLLADA]/COLLADAFramework/include [OPENCOLLADA]/COLLADASaxFrameworkLoader/include [OPENCOLLADA]/GeneratedSaxParser/include '.replace('[OPENCOLLADA]', env['BF_OPENCOLLADA_INC'])
|
||||
|
||||
if env['BF_BUILDINFO']:
|
||||
defs.append('NAN_BUILDINFO')
|
||||
defs.append('WITH_BUILDINFO')
|
||||
|
||||
env.BlenderLib ('bf_collada', sources, Split(incs), defs, libtype='core', priority=200 )
|
||||
|
@ -7,7 +7,7 @@ incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf ../
|
||||
incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
|
||||
incs += ' ../../gpu ../../makesrna #/intern/opennl/extern'
|
||||
|
||||
if env['OURPLATFORM'] == 'linux2':
|
||||
if env['OURPLATFORM'] == 'linux':
|
||||
cflags='-pthread'
|
||||
incs += ' ../../../extern/binreloc/include'
|
||||
|
||||
|
@ -5402,7 +5402,8 @@ void ED_armature_bone_rename(bArmature *arm, char *oldnamep, char *newnamep)
|
||||
ScrArea *sa;
|
||||
/* add regions */
|
||||
for(sa= screen->areabase.first; sa; sa= sa->next) {
|
||||
SpaceLink *sl= sa->spacedata.first;
|
||||
SpaceLink *sl;
|
||||
for (sl= sa->spacedata.first; sl; sl= sl->next) {
|
||||
if(sl->spacetype==SPACE_VIEW3D) {
|
||||
View3D *v3d= (View3D *)sl;
|
||||
if(v3d->ob_centre && v3d->ob_centre->data == arm) {
|
||||
@ -5416,6 +5417,7 @@ void ED_armature_bone_rename(bArmature *arm, char *oldnamep, char *newnamep)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int armature_flip_names_exec (bContext *C, wmOperator *UNUSED(op))
|
||||
|
@ -1000,7 +1000,7 @@ static short pose_propagate_get_refVal (Object *ob, FCurve *fcu, float *value)
|
||||
|
||||
/* resolve the property... */
|
||||
if (RNA_path_resolve(&id_ptr, fcu->rna_path, &ptr, &prop)) {
|
||||
if (RNA_property_array_check(&ptr, prop)) {
|
||||
if (RNA_property_array_check(prop)) {
|
||||
/* array */
|
||||
if (fcu->array_index < RNA_property_array_length(&ptr, prop)) {
|
||||
found= TRUE;
|
||||
|
@ -710,6 +710,27 @@ int uiButActiveOnly(const bContext *C, uiBlock *block, uiBut *but)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* use to check if we need to disable undo, but dont make any changes
|
||||
* returns FALSE if undo needs to be disabled. */
|
||||
static int ui_but_is_rna_undo(uiBut *but)
|
||||
{
|
||||
if(but->rnapoin.id.data) {
|
||||
/* avoid undo push for buttons who's ID are screen or wm level
|
||||
* we could disable undo for buttons with no ID too but may have
|
||||
* unforseen conciquences, so best check for ID's we _know_ are not
|
||||
* handled by undo - campbell */
|
||||
ID *id= but->rnapoin.id.data;
|
||||
if(ELEM(GS(id->name), ID_SCR, ID_WM)) {
|
||||
return FALSE;
|
||||
}
|
||||
else {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* assigns automatic keybindings to menu items for fast access
|
||||
* (underline key in menu) */
|
||||
static void ui_menu_block_set_keyaccels(uiBlock *block)
|
||||
@ -1245,14 +1266,14 @@ int ui_is_but_float(uiBut *but)
|
||||
|
||||
int ui_is_but_unit(uiBut *but)
|
||||
{
|
||||
Scene *scene= CTX_data_scene((bContext *)but->block->evil_C);
|
||||
int unit_type= uiButGetUnitType(but);
|
||||
UnitSettings *unit= but->block->unit;
|
||||
const int unit_type= uiButGetUnitType(but);
|
||||
|
||||
if(unit_type == PROP_UNIT_NONE)
|
||||
return 0;
|
||||
|
||||
#if 1 // removed so angle buttons get correct snapping
|
||||
if (scene->unit.system_rotation == USER_UNIT_ROT_RADIANS && unit_type == PROP_UNIT_ROTATION)
|
||||
if (unit->system_rotation == USER_UNIT_ROT_RADIANS && unit_type == PROP_UNIT_ROTATION)
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
@ -1260,7 +1281,7 @@ int ui_is_but_unit(uiBut *but)
|
||||
if (unit_type == PROP_UNIT_TIME)
|
||||
return 0;
|
||||
|
||||
if (scene->unit.system == USER_UNIT_NONE) {
|
||||
if (unit->system == USER_UNIT_NONE) {
|
||||
if (unit_type != PROP_UNIT_ROTATION) {
|
||||
return 0;
|
||||
}
|
||||
@ -1293,19 +1314,19 @@ double ui_get_but_val(uiBut *but)
|
||||
|
||||
switch(RNA_property_type(prop)) {
|
||||
case PROP_BOOLEAN:
|
||||
if(RNA_property_array_length(&but->rnapoin, prop))
|
||||
if(RNA_property_array_check(prop))
|
||||
value= RNA_property_boolean_get_index(&but->rnapoin, prop, but->rnaindex);
|
||||
else
|
||||
value= RNA_property_boolean_get(&but->rnapoin, prop);
|
||||
break;
|
||||
case PROP_INT:
|
||||
if(RNA_property_array_length(&but->rnapoin, prop))
|
||||
if(RNA_property_array_check(prop))
|
||||
value= RNA_property_int_get_index(&but->rnapoin, prop, but->rnaindex);
|
||||
else
|
||||
value= RNA_property_int_get(&but->rnapoin, prop);
|
||||
break;
|
||||
case PROP_FLOAT:
|
||||
if(RNA_property_array_length(&but->rnapoin, prop))
|
||||
if(RNA_property_array_check(prop))
|
||||
value= RNA_property_float_get_index(&but->rnapoin, prop, but->rnaindex);
|
||||
else
|
||||
value= RNA_property_float_get(&but->rnapoin, prop);
|
||||
@ -1459,19 +1480,20 @@ int ui_get_but_string_max_length(uiBut *but)
|
||||
|
||||
static double ui_get_but_scale_unit(uiBut *but, double value)
|
||||
{
|
||||
Scene *scene= CTX_data_scene((bContext *)but->block->evil_C);
|
||||
UnitSettings *unit= but->block->unit;
|
||||
int unit_type= uiButGetUnitType(but);
|
||||
|
||||
if(unit_type == PROP_UNIT_LENGTH) {
|
||||
return value * (double)scene->unit.scale_length;
|
||||
return value * (double)unit->scale_length;
|
||||
}
|
||||
else if(unit_type == PROP_UNIT_AREA) {
|
||||
return value * pow(scene->unit.scale_length, 2);
|
||||
return value * pow(unit->scale_length, 2);
|
||||
}
|
||||
else if(unit_type == PROP_UNIT_VOLUME) {
|
||||
return value * pow(scene->unit.scale_length, 3);
|
||||
return value * pow(unit->scale_length, 3);
|
||||
}
|
||||
else if(unit_type == PROP_UNIT_TIME) { /* WARNING - using evil_C :| */
|
||||
Scene *scene= CTX_data_scene(but->block->evil_C);
|
||||
return FRA2TIME(value);
|
||||
}
|
||||
else {
|
||||
@ -1483,14 +1505,14 @@ static double ui_get_but_scale_unit(uiBut *but, double value)
|
||||
void ui_convert_to_unit_alt_name(uiBut *but, char *str, int maxlen)
|
||||
{
|
||||
if(ui_is_but_unit(but)) {
|
||||
UnitSettings *unit= but->block->unit;
|
||||
int unit_type= uiButGetUnitType(but);
|
||||
char *orig_str;
|
||||
Scene *scene= CTX_data_scene((bContext *)but->block->evil_C);
|
||||
|
||||
orig_str= MEM_callocN(sizeof(char)*maxlen + 1, "textedit sub str");
|
||||
memcpy(orig_str, str, maxlen);
|
||||
|
||||
bUnit_ToUnitAltName(str, maxlen, orig_str, scene->unit.system, unit_type>>16);
|
||||
bUnit_ToUnitAltName(str, maxlen, orig_str, unit->system, unit_type>>16);
|
||||
|
||||
MEM_freeN(orig_str);
|
||||
}
|
||||
@ -1498,27 +1520,26 @@ void ui_convert_to_unit_alt_name(uiBut *but, char *str, int maxlen)
|
||||
|
||||
static void ui_get_but_string_unit(uiBut *but, char *str, int len_max, double value, int pad)
|
||||
{
|
||||
Scene *scene= CTX_data_scene((bContext *)but->block->evil_C);
|
||||
int do_split= scene->unit.flag & USER_UNIT_OPT_SPLIT;
|
||||
UnitSettings *unit= but->block->unit;
|
||||
int do_split= unit->flag & USER_UNIT_OPT_SPLIT;
|
||||
int unit_type= uiButGetUnitType(but);
|
||||
int precision= but->a2;
|
||||
|
||||
if(scene->unit.scale_length<0.0001f) scene->unit.scale_length= 1.0f; // XXX do_versions
|
||||
if(unit->scale_length<0.0001f) unit->scale_length= 1.0f; // XXX do_versions
|
||||
|
||||
/* Sanity checks */
|
||||
if(precision > PRECISION_FLOAT_MAX) precision= PRECISION_FLOAT_MAX;
|
||||
else if(precision==0) precision= 2;
|
||||
|
||||
bUnit_AsString(str, len_max, ui_get_but_scale_unit(but, value), precision, scene->unit.system, unit_type>>16, do_split, pad);
|
||||
bUnit_AsString(str, len_max, ui_get_but_scale_unit(but, value), precision, unit->system, unit_type>>16, do_split, pad);
|
||||
}
|
||||
|
||||
static float ui_get_but_step_unit(uiBut *but, float step_default)
|
||||
{
|
||||
Scene *scene= CTX_data_scene((bContext *)but->block->evil_C);
|
||||
int unit_type= uiButGetUnitType(but)>>16;
|
||||
float step;
|
||||
|
||||
step = bUnit_ClosestScalar(ui_get_but_scale_unit(but, step_default), scene->unit.system, unit_type);
|
||||
step = bUnit_ClosestScalar(ui_get_but_scale_unit(but, step_default), but->block->unit->system, unit_type);
|
||||
|
||||
if(step > 0.0f) { /* -1 is an error value */
|
||||
return (float)((double)step/ui_get_but_scale_unit(but, 1.0))*100.0f;
|
||||
@ -1606,12 +1627,11 @@ static int ui_set_but_string_eval_num_unit(bContext *C, uiBut *but, const char *
|
||||
{
|
||||
char str_unit_convert[256];
|
||||
const int unit_type= uiButGetUnitType(but);
|
||||
Scene *scene= CTX_data_scene((bContext *)but->block->evil_C);
|
||||
|
||||
BLI_strncpy(str_unit_convert, str, sizeof(str_unit_convert));
|
||||
|
||||
/* ugly, use the draw string to get the value, this could cause problems if it includes some text which resolves to a unit */
|
||||
bUnit_ReplaceString(str_unit_convert, sizeof(str_unit_convert), but->drawstr, ui_get_but_scale_unit(but, 1.0), scene->unit.system, unit_type>>16);
|
||||
bUnit_ReplaceString(str_unit_convert, sizeof(str_unit_convert), but->drawstr, ui_get_but_scale_unit(but, 1.0), but->block->unit->system, unit_type>>16);
|
||||
|
||||
return (BPY_button_exec(C, str_unit_convert, value, TRUE) != -1);
|
||||
}
|
||||
@ -1958,7 +1978,10 @@ uiBlock *uiBeginBlock(const bContext *C, ARegion *region, const char *name, shor
|
||||
block->active= 1;
|
||||
block->dt= dt;
|
||||
block->evil_C= (void*)C; // XXX
|
||||
if (scn) block->color_profile= (scn->r.color_mgt_flag & R_COLOR_MANAGEMENT);
|
||||
if (scn) {
|
||||
block->color_profile= (scn->r.color_mgt_flag & R_COLOR_MANAGEMENT);
|
||||
block->unit= &scn->unit;
|
||||
}
|
||||
BLI_strncpy(block->name, name, sizeof(block->name));
|
||||
|
||||
if(region)
|
||||
@ -2506,12 +2529,10 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str,
|
||||
|
||||
static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *str, int x1, int y1, short x2, short y2, PointerRNA *ptr, PropertyRNA *prop, int index, float min, float max, float a1, float a2, const char *tip)
|
||||
{
|
||||
const PropertyType proptype= RNA_property_type(prop);
|
||||
uiBut *but;
|
||||
PropertyType proptype;
|
||||
int freestr= 0, icon= 0;
|
||||
|
||||
proptype= RNA_property_type(prop);
|
||||
|
||||
/* use rna values if parameters are not specified */
|
||||
if(!str) {
|
||||
if(type == MENU && proptype == PROP_ENUM) {
|
||||
@ -2636,9 +2657,14 @@ static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *s
|
||||
UI_DEF_BUT_RNA_DISABLE(but);
|
||||
}
|
||||
|
||||
if (but->flag & UI_BUT_UNDO && (ui_but_is_rna_undo(but) == FALSE)) {
|
||||
but->flag &= ~UI_BUT_UNDO;
|
||||
}
|
||||
|
||||
/* If this button uses units, calculate the step from this */
|
||||
if(ui_is_but_unit(but))
|
||||
if((proptype == PROP_FLOAT) && ui_is_but_unit(but)) {
|
||||
but->a1= ui_get_but_step_unit(but, but->a1);
|
||||
}
|
||||
|
||||
if(freestr)
|
||||
MEM_freeN((void *)str);
|
||||
@ -2682,6 +2708,7 @@ static uiBut *ui_def_but_operator(uiBlock *block, int type, const char *opname,
|
||||
but= ui_def_but(block, type, -1, str, x1, y1, x2, y2, NULL, 0, 0, 0, 0, tip);
|
||||
but->optype= ot;
|
||||
but->opcontext= opcontext;
|
||||
but->flag &= ~UI_BUT_UNDO; /* no need for ui_but_is_undo(), we never need undo here */
|
||||
|
||||
if(!ot) {
|
||||
but->flag |= UI_BUT_DISABLED;
|
||||
@ -2711,6 +2738,7 @@ static uiBut *ui_def_but_operator_text(uiBlock *block, int type, const char *opn
|
||||
but= ui_def_but(block, type, -1, str, x1, y1, x2, y2, poin, min, max, a1, a2, tip);
|
||||
but->optype= ot;
|
||||
but->opcontext= opcontext;
|
||||
but->flag &= ~UI_BUT_UNDO; /* no need for ui_but_is_undo(), we never need undo here */
|
||||
|
||||
if(!ot) {
|
||||
but->flag |= UI_BUT_DISABLED;
|
||||
|
@ -140,26 +140,25 @@ void uiDrawBox(int mode, float minx, float miny, float maxx, float maxy, float r
|
||||
glEnd();
|
||||
}
|
||||
|
||||
static void round_box_shade_col(float *col1, float *col2, float fac)
|
||||
static void round_box_shade_col(const float col1[3], float const col2[3], const float fac)
|
||||
{
|
||||
float col[4];
|
||||
float col[3];
|
||||
|
||||
col[0]= (fac*col1[0] + (1.0f-fac)*col2[0]);
|
||||
col[1]= (fac*col1[1] + (1.0f-fac)*col2[1]);
|
||||
col[2]= (fac*col1[2] + (1.0f-fac)*col2[2]);
|
||||
col[3]= (fac*col1[3] + (1.0f-fac)*col2[3]);
|
||||
glColor4fv(col);
|
||||
glColor3fv(col);
|
||||
}
|
||||
|
||||
|
||||
/* linear horizontal shade within button or in outline */
|
||||
/* view2d scrollers use it */
|
||||
void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, float rad, float shadetop, float shadedown)
|
||||
{
|
||||
float vec[7][2]= {{0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169}, {0.707, 0.293},
|
||||
{0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}};
|
||||
float div= maxy-miny;
|
||||
float coltop[4], coldown[4], color[4];
|
||||
const float div= maxy - miny;
|
||||
const float idiv= 1.0f / div;
|
||||
float coltop[3], coldown[3], color[4];
|
||||
int a;
|
||||
|
||||
/* mult */
|
||||
@ -173,11 +172,9 @@ void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, fl
|
||||
coltop[0]= color[0]+shadetop; if(coltop[0]>1.0f) coltop[0]= 1.0f;
|
||||
coltop[1]= color[1]+shadetop; if(coltop[1]>1.0f) coltop[1]= 1.0f;
|
||||
coltop[2]= color[2]+shadetop; if(coltop[2]>1.0f) coltop[2]= 1.0f;
|
||||
coltop[3]= color[3];
|
||||
coldown[0]= color[0]+shadedown; if(coldown[0]<0.0f) coldown[0]= 0.0f;
|
||||
coldown[1]= color[1]+shadedown; if(coldown[1]<0.0f) coldown[1]= 0.0f;
|
||||
coldown[2]= color[2]+shadedown; if(coldown[2]<0.0f) coldown[2]= 0.0f;
|
||||
coldown[3]= color[3];
|
||||
|
||||
glShadeModel(GL_SMOOTH);
|
||||
glBegin(mode);
|
||||
@ -189,11 +186,11 @@ void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, fl
|
||||
glVertex2f(maxx-rad, miny);
|
||||
|
||||
for(a=0; a<7; a++) {
|
||||
round_box_shade_col(coltop, coldown, vec[a][1]/div);
|
||||
round_box_shade_col(coltop, coldown, vec[a][1]*idiv);
|
||||
glVertex2f(maxx-rad+vec[a][0], miny+vec[a][1]);
|
||||
}
|
||||
|
||||
round_box_shade_col(coltop, coldown, rad/div);
|
||||
round_box_shade_col(coltop, coldown, rad*idiv);
|
||||
glVertex2f(maxx, miny+rad);
|
||||
}
|
||||
else {
|
||||
@ -204,11 +201,11 @@ void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, fl
|
||||
/* corner right-top */
|
||||
if(roundboxtype & 2) {
|
||||
|
||||
round_box_shade_col(coltop, coldown, (div-rad)/div);
|
||||
round_box_shade_col(coltop, coldown, (div-rad)*idiv);
|
||||
glVertex2f(maxx, maxy-rad);
|
||||
|
||||
for(a=0; a<7; a++) {
|
||||
round_box_shade_col(coltop, coldown, (div-rad+vec[a][1])/div);
|
||||
round_box_shade_col(coltop, coldown, (div-rad+vec[a][1])*idiv);
|
||||
glVertex2f(maxx-vec[a][1], maxy-rad+vec[a][0]);
|
||||
}
|
||||
round_box_shade_col(coltop, coldown, 1.0);
|
||||
@ -226,11 +223,11 @@ void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, fl
|
||||
glVertex2f(minx+rad, maxy);
|
||||
|
||||
for(a=0; a<7; a++) {
|
||||
round_box_shade_col(coltop, coldown, (div-vec[a][1])/div);
|
||||
round_box_shade_col(coltop, coldown, (div-vec[a][1])*idiv);
|
||||
glVertex2f(minx+rad-vec[a][0], maxy-vec[a][1]);
|
||||
}
|
||||
|
||||
round_box_shade_col(coltop, coldown, (div-rad)/div);
|
||||
round_box_shade_col(coltop, coldown, (div-rad)*idiv);
|
||||
glVertex2f(minx, maxy-rad);
|
||||
}
|
||||
else {
|
||||
@ -241,11 +238,11 @@ void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, fl
|
||||
/* corner left-bottom */
|
||||
if(roundboxtype & 8) {
|
||||
|
||||
round_box_shade_col(coltop, coldown, rad/div);
|
||||
round_box_shade_col(coltop, coldown, rad*idiv);
|
||||
glVertex2f(minx, miny+rad);
|
||||
|
||||
for(a=0; a<7; a++) {
|
||||
round_box_shade_col(coltop, coldown, (rad-vec[a][1])/div);
|
||||
round_box_shade_col(coltop, coldown, (rad-vec[a][1])*idiv);
|
||||
glVertex2f(minx+vec[a][1], miny+rad-vec[a][0]);
|
||||
}
|
||||
|
||||
@ -267,7 +264,8 @@ void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float
|
||||
{
|
||||
float vec[7][2]= {{0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169}, {0.707, 0.293},
|
||||
{0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}};
|
||||
float div= maxx-minx;
|
||||
const float div= maxx - minx;
|
||||
const float idiv= 1.0f / div;
|
||||
float colLeft[3], colRight[3], color[4];
|
||||
int a;
|
||||
|
||||
@ -295,11 +293,11 @@ void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float
|
||||
glVertex2f(maxx-rad, miny);
|
||||
|
||||
for(a=0; a<7; a++) {
|
||||
round_box_shade_col(colLeft, colRight, vec[a][0]/div);
|
||||
round_box_shade_col(colLeft, colRight, vec[a][0]*idiv);
|
||||
glVertex2f(maxx-rad+vec[a][0], miny+vec[a][1]);
|
||||
}
|
||||
|
||||
round_box_shade_col(colLeft, colRight, rad/div);
|
||||
round_box_shade_col(colLeft, colRight, rad*idiv);
|
||||
glVertex2f(maxx, miny+rad);
|
||||
}
|
||||
else {
|
||||
@ -314,10 +312,10 @@ void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float
|
||||
|
||||
for(a=0; a<7; a++) {
|
||||
|
||||
round_box_shade_col(colLeft, colRight, (div-rad-vec[a][0])/div);
|
||||
round_box_shade_col(colLeft, colRight, (div-rad-vec[a][0])*idiv);
|
||||
glVertex2f(maxx-vec[a][1], maxy-rad+vec[a][0]);
|
||||
}
|
||||
round_box_shade_col(colLeft, colRight, (div-rad)/div);
|
||||
round_box_shade_col(colLeft, colRight, (div-rad)*idiv);
|
||||
glVertex2f(maxx-rad, maxy);
|
||||
}
|
||||
else {
|
||||
@ -327,11 +325,11 @@ void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float
|
||||
|
||||
/* corner left-top */
|
||||
if(roundboxtype & 1) {
|
||||
round_box_shade_col(colLeft, colRight, (div-rad)/div);
|
||||
round_box_shade_col(colLeft, colRight, (div-rad)*idiv);
|
||||
glVertex2f(minx+rad, maxy);
|
||||
|
||||
for(a=0; a<7; a++) {
|
||||
round_box_shade_col(colLeft, colRight, (div-rad+vec[a][0])/div);
|
||||
round_box_shade_col(colLeft, colRight, (div-rad+vec[a][0])*idiv);
|
||||
glVertex2f(minx+rad-vec[a][0], maxy-vec[a][1]);
|
||||
}
|
||||
|
||||
@ -349,7 +347,7 @@ void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float
|
||||
glVertex2f(minx, miny+rad);
|
||||
|
||||
for(a=0; a<7; a++) {
|
||||
round_box_shade_col(colLeft, colRight, (vec[a][0])/div);
|
||||
round_box_shade_col(colLeft, colRight, (vec[a][0])*idiv);
|
||||
glVertex2f(minx+vec[a][1], miny+rad-vec[a][0]);
|
||||
}
|
||||
|
||||
|
@ -2310,13 +2310,13 @@ static float ui_numedit_apply_snapf(uiBut *but, float tempf, float softmin, floa
|
||||
float fac= 1.0f;
|
||||
|
||||
if(ui_is_but_unit(but)) {
|
||||
Scene *scene= CTX_data_scene((bContext *)but->block->evil_C);
|
||||
UnitSettings *unit= but->block->unit;
|
||||
int unit_type= uiButGetUnitType(but)>>16;
|
||||
|
||||
if(bUnit_IsValid(scene->unit.system, unit_type)) {
|
||||
fac= (float)bUnit_BaseScalar(scene->unit.system, unit_type);
|
||||
if(bUnit_IsValid(unit->system, unit_type)) {
|
||||
fac= (float)bUnit_BaseScalar(unit->system, unit_type);
|
||||
if(ELEM3(unit_type, B_UNIT_LENGTH, B_UNIT_AREA, B_UNIT_VOLUME)) {
|
||||
fac /= scene->unit.scale_length;
|
||||
fac /= unit->scale_length;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -213,7 +213,7 @@ struct uiBut {
|
||||
|
||||
BIFIconID icon;
|
||||
char lock;
|
||||
char dt;
|
||||
char dt; /* drawtype: UI_EMBOSS, UI_EMBOSSN ... etc, copied from the block */
|
||||
char changed; /* could be made into a single flag */
|
||||
unsigned char unit_type; /* so buttons can support unit systems which are not RNA */
|
||||
short modifier_key;
|
||||
@ -306,7 +306,8 @@ struct uiBlock {
|
||||
void *drawextra_arg2;
|
||||
|
||||
int flag;
|
||||
char direction, dt;
|
||||
char direction;
|
||||
char dt; /* drawtype: UI_EMBOSS, UI_EMBOSSN ... etc, copied to buttons */
|
||||
short auto_open;
|
||||
double auto_open_last;
|
||||
|
||||
@ -332,6 +333,8 @@ struct uiBlock {
|
||||
|
||||
float _hsv[3]; // XXX, only access via ui_block_hsv_get()
|
||||
char color_profile; // color profile for correcting linear colors for display
|
||||
struct UnitSettings *unit; // unit system, used a lot for numeric buttons so include here rather then fetching through the scene every time.
|
||||
|
||||
};
|
||||
|
||||
typedef struct uiSafetyRct {
|
||||
|
@ -422,35 +422,46 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in
|
||||
uiDefButR_prop(block, BUT_NORMAL, 0, name, x, y, UI_UNIT_X*3, UI_UNIT_Y*3, ptr, prop, 0, 0, 0, -1, -1, NULL);
|
||||
}
|
||||
else {
|
||||
if(ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA) && !expand)
|
||||
/* note, this block of code is a bit arbitrary and has just been made
|
||||
* to work with common cases, but may need to be re-worked */
|
||||
|
||||
/* special case, boolean array in a menu, this could be used in a more generic way too */
|
||||
if(ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA) && !expand) {
|
||||
uiDefAutoButR(block, ptr, prop, -1, "", ICON_NONE, 0, 0, w, UI_UNIT_Y);
|
||||
|
||||
if(!ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA) || expand) {
|
||||
/* layout for known array subtypes */
|
||||
char str[3];
|
||||
|
||||
for(a=0; a<len; a++) {
|
||||
str[0]= RNA_property_array_item_char(prop, a);
|
||||
|
||||
if(str[0]) {
|
||||
if (icon_only) {
|
||||
str[0] = '\0';
|
||||
}
|
||||
else if(type == PROP_BOOLEAN) {
|
||||
str[1]= '\0';
|
||||
}
|
||||
else {
|
||||
int *boolarr= NULL;
|
||||
|
||||
/* even if 'expand' is fale, expanding anyway */
|
||||
|
||||
/* layout for known array subtypes */
|
||||
char str[3]= {'\0'};
|
||||
|
||||
if(!icon_only) {
|
||||
if(type != PROP_BOOLEAN) {
|
||||
str[1]= ':';
|
||||
str[2]= '\0';
|
||||
}
|
||||
}
|
||||
|
||||
/* show checkboxes for rna on a non-emboss block (menu for eg) */
|
||||
if(type == PROP_BOOLEAN && ELEM(layout->root->block->dt, UI_EMBOSSN, UI_EMBOSSP)) {
|
||||
boolarr= MEM_callocN(sizeof(int)*len, "ui_item_array");
|
||||
RNA_property_boolean_get_array(ptr, prop, boolarr);
|
||||
}
|
||||
|
||||
for(a=0; a<len; a++) {
|
||||
if(!icon_only) str[0]= RNA_property_array_item_char(prop, a);
|
||||
if(boolarr) icon= boolarr[a] ? ICON_CHECKBOX_HLT: ICON_CHECKBOX_DEHLT;
|
||||
but= uiDefAutoButR(block, ptr, prop, a, str, icon, 0, 0, w, UI_UNIT_Y);
|
||||
if(slider && but->type==NUM)
|
||||
but->type= NUMSLI;
|
||||
if(toggle && but->type==OPTION)
|
||||
but->type= TOG;
|
||||
}
|
||||
|
||||
if(boolarr) {
|
||||
MEM_freeN(boolarr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -951,13 +962,14 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
|
||||
uiBut *but;
|
||||
PropertyType type;
|
||||
char namestr[UI_MAX_NAME_STR];
|
||||
int len, w, h, slider, toggle, expand, icon_only, no_bg;
|
||||
int len, is_array, w, h, slider, toggle, expand, icon_only, no_bg;
|
||||
|
||||
uiBlockSetCurLayout(block, layout);
|
||||
|
||||
/* retrieve info */
|
||||
type= RNA_property_type(prop);
|
||||
len= RNA_property_array_length(ptr, prop);
|
||||
is_array= RNA_property_array_check(prop);
|
||||
len= (is_array) ? RNA_property_array_length(ptr, prop) : 0;
|
||||
|
||||
/* set name and icon */
|
||||
if(!name)
|
||||
@ -967,14 +979,16 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
|
||||
|
||||
if(ELEM4(type, PROP_INT, PROP_FLOAT, PROP_STRING, PROP_POINTER))
|
||||
name= ui_item_name_add_colon(name, namestr);
|
||||
else if(type == PROP_BOOLEAN && len && index == RNA_NO_INDEX)
|
||||
else if(type == PROP_BOOLEAN && is_array && index == RNA_NO_INDEX)
|
||||
name= ui_item_name_add_colon(name, namestr);
|
||||
else if(type == PROP_ENUM && index != RNA_ENUM_VALUE)
|
||||
name= ui_item_name_add_colon(name, namestr);
|
||||
|
||||
if(layout->root->type == UI_LAYOUT_MENU) {
|
||||
if(type == PROP_BOOLEAN)
|
||||
icon= (RNA_property_boolean_get(ptr, prop))? ICON_CHECKBOX_HLT: ICON_CHECKBOX_DEHLT;
|
||||
if(type == PROP_BOOLEAN && ((is_array == FALSE) || (index != RNA_NO_INDEX))) {
|
||||
if(is_array) icon= (RNA_property_boolean_get_index(ptr, prop, index)) ? ICON_CHECKBOX_HLT: ICON_CHECKBOX_DEHLT;
|
||||
else icon= (RNA_property_boolean_get(ptr, prop)) ? ICON_CHECKBOX_HLT: ICON_CHECKBOX_DEHLT;
|
||||
}
|
||||
else if(type == PROP_ENUM && index == RNA_ENUM_VALUE) {
|
||||
int enum_value= RNA_property_enum_get(ptr, prop);
|
||||
if(RNA_property_flag(prop) & PROP_ENUM_FLAG) {
|
||||
@ -999,16 +1013,14 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
|
||||
uiBlockSetEmboss(block, UI_EMBOSSN);
|
||||
|
||||
/* array property */
|
||||
if(index == RNA_NO_INDEX && len > 0)
|
||||
if(index == RNA_NO_INDEX && is_array)
|
||||
ui_item_array(layout, block, name, icon, ptr, prop, len, 0, 0, w, h, expand, slider, toggle, icon_only);
|
||||
/* enum item */
|
||||
else if(type == PROP_ENUM && index == RNA_ENUM_VALUE) {
|
||||
const char *identifier= RNA_property_identifier(prop);
|
||||
|
||||
if(icon && name[0] && !icon_only)
|
||||
uiDefIconTextButR_prop(block, ROW, 0, icon, name, 0, 0, w, h, ptr, prop, -1, 0, value, -1, -1, NULL);
|
||||
else if(icon)
|
||||
uiDefIconButR(block, ROW, 0, icon, 0, 0, w, h, ptr, identifier, -1, 0, value, -1, -1, NULL);
|
||||
uiDefIconButR_prop(block, ROW, 0, icon, 0, 0, w, h, ptr, prop, -1, 0, value, -1, -1, NULL);
|
||||
else
|
||||
uiDefButR_prop(block, ROW, 0, name, 0, 0, w, h, ptr, prop, -1, 0, value, -1, -1, NULL);
|
||||
}
|
||||
|
@ -424,7 +424,8 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
|
||||
|
||||
if (unit_type == PROP_UNIT_ROTATION) {
|
||||
if (RNA_property_type(but->rnaprop) == PROP_FLOAT) {
|
||||
BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Radians: %f", RNA_property_float_get_index(&but->rnapoin, but->rnaprop, but->rnaindex));
|
||||
float value= RNA_property_array_check(but->rnaprop) ? RNA_property_float_get_index(&but->rnapoin, but->rnaprop, but->rnaindex) : RNA_property_float_get(&but->rnapoin, but->rnaprop);
|
||||
BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Radians: %f", value);
|
||||
data->color[data->totline]= 0x888888;
|
||||
data->totline++;
|
||||
}
|
||||
@ -1188,7 +1189,7 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
|
||||
uiBut *bt;
|
||||
uiSafetyRct *saferct;
|
||||
rctf butrct;
|
||||
float aspect;
|
||||
/*float aspect;*/ /*UNUSED*/
|
||||
int xsize, ysize, xof=0, yof=0, center;
|
||||
short dir1= 0, dir2=0;
|
||||
|
||||
@ -1223,7 +1224,7 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
|
||||
}
|
||||
}
|
||||
|
||||
aspect= (float)(block->maxx - block->minx + 4);
|
||||
/*aspect= (float)(block->maxx - block->minx + 4);*/ /*UNUSED*/
|
||||
ui_block_to_window_fl(butregion, but->block, &block->minx, &block->miny);
|
||||
ui_block_to_window_fl(butregion, but->block, &block->maxx, &block->maxy);
|
||||
|
||||
@ -1232,7 +1233,7 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
|
||||
|
||||
xsize= block->maxx - block->minx+4; // 4 for shadow
|
||||
ysize= block->maxy - block->miny+4;
|
||||
aspect/= (float)xsize;
|
||||
/*aspect/= (float)xsize;*/ /*UNUSED*/
|
||||
|
||||
if(but) {
|
||||
int left=0, right=0, top=0, down=0;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user