This commit is contained in:
2011-08-24 09:44:08 +00:00
170 changed files with 3576 additions and 2897 deletions

View File

@@ -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)
@@ -269,9 +285,7 @@ if(WITH_PYTHON_MODULE)
set(WITH_HEADLESS ON)
endif()
TEST_SSE_SUPPORT()
# XXX hack
# auto enable openimageio and boost for cycles
if(WITH_CYCLES)
set(WITH_OPENIMAGEIO ON)
set(WITH_BOOST ON)
@@ -281,6 +295,14 @@ if(WITH_OPENIMAGEIO)
set(WITH_BOOST ON)
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
@@ -554,6 +576,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
@@ -746,11 +771,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()
@@ -899,7 +924,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()

View File

@@ -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]

View File

@@ -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 ' + \

View File

@@ -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 ' + \

View File

@@ -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 ' + \

View File

@@ -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 ' + \

View File

@@ -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)

View File

@@ -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)

View File

@@ -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

View File

@@ -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

View File

@@ -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']

View File

@@ -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'

View File

@@ -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'

View File

@@ -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'

View File

@@ -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'

View File

@@ -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':

View File

@@ -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]

View File

@@ -27,7 +27,7 @@ $Id$
filenames have the form (platform)-config.py, where platform one of:
* darwin
* linux2
* linux
* win32-mingw
* win32-vc

View File

@@ -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

View 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)

View File

@@ -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",
@@ -85,7 +85,7 @@ else:
"mathutils.geometry",
)
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
@@ -744,6 +744,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

View File

@@ -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':

View File

@@ -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')

View File

@@ -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;

View File

@@ -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

View File

@@ -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:

View File

@@ -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):

View File

@@ -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):

View File

@@ -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

View File

@@ -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",

View File

@@ -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):

View File

@@ -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(

View File

@@ -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",

View File

@@ -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):

View File

@@ -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")

View File

@@ -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
@@ -1110,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,

View File

@@ -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

View File

@@ -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):
@@ -292,7 +390,7 @@ class WM_OT_context_cycle_int(Operator):
else:
value += 1
exec("context.%s=value" % data_path)
exec("context.%s = value" % data_path)
if value != eval("context.%s" % data_path):
# relies on rna clamping int's out of the range
@@ -301,9 +399,9 @@ class WM_OT_context_cycle_int(Operator):
else:
value = -1 << 31
exec("context.%s=value" % data_path)
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):
@@ -381,9 +479,9 @@ class WM_OT_context_cycle_array(Operator):
array.append(array.pop(0))
return array
exec("context.%s=cycle(context.%s[:])" % (data_path, data_path))
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
@@ -449,16 +550,21 @@ class WM_OT_context_set_id(Operator):
if id_iter:
value_id = getattr(bpy.data, id_iter).get(value)
exec("context.%s=value_id" % data_path)
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

View File

@@ -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",

View File

@@ -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")

View File

@@ -73,7 +73,7 @@ class DATA_PT_context_mesh(MeshButtonsPanel, Panel):
ob = context.object
mesh = context.mesh
space = context.space_data
layout.prop(context.scene.tool_settings, "mesh_select_mode", index=0, text="Vertex")
if ob:
layout.template_ID(ob, "data")
elif mesh:

View File

@@ -155,7 +155,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()
@@ -165,12 +165,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")
@@ -646,7 +646,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'

View File

@@ -416,6 +416,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
@@ -1026,12 +1030,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")

View File

@@ -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

View File

@@ -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")

View File

@@ -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="")

View File

@@ -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

View File

@@ -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):

View File

@@ -2074,9 +2074,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()

View File

@@ -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")

View File

@@ -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):

View File

@@ -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)

View File

@@ -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):

View File

@@ -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

View File

@@ -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)

View File

@@ -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;

View File

@@ -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 );

View File

@@ -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 */

View File

@@ -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.
*

View File

@@ -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;

View File

@@ -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;
}
}

View File

@@ -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);
}
}

View File

@@ -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;

View File

@@ -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)

View File

@@ -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]);

View File

@@ -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"
*

View File

@@ -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}")

View File

@@ -11719,8 +11719,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);

View File

@@ -867,11 +867,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);
}
@@ -2473,7 +2475,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);

View File

@@ -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'

View File

@@ -107,7 +107,7 @@ set(SRC
)
if(WITH_BUILDINFO)
add_definitions(-DNAN_BUILDINFO)
add_definitions(-DWITH_BUILDINFO)
endif()
if(CMAKE_COMPILER_IS_GNUCXX)

View File

@@ -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;

View File

@@ -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 )

View File

@@ -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'

View File

@@ -5402,8 +5402,9 @@ 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;
if(sl->spacetype == SPACE_VIEW3D) {
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) {
if (!strcmp(v3d->ob_centre_bone, oldname)) {
@@ -5415,6 +5416,7 @@ void ED_armature_bone_rename(bArmature *arm, char *oldnamep, char *newnamep)
}
}
}
}
}

View File

@@ -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;

View File

@@ -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]);
}

View File

@@ -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;
}
}
}

View File

@@ -334,6 +334,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 {

View File

@@ -1017,12 +1017,10 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
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);
}

View File

@@ -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++;
}

View File

@@ -180,7 +180,7 @@ void ui_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y
glEnable(GL_BLEND);
glGetFloatv(GL_CURRENT_COLOR, color);
color[3]*= 0.125;
color[3] *= 0.125f;
glColor4fv(color);
/* for each AA step */

View File

@@ -8,7 +8,7 @@ incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
incs += ' ../../gpu ../../blenloader'
incs += ' ../../makesrna ../../render/extern/include #/intern/elbeem/extern'
if env['OURPLATFORM'] == 'linux2':
if env['OURPLATFORM'] == 'linux':
cflags='-pthread'
incs += ' ../../../extern/binreloc/include'

View File

@@ -10,7 +10,7 @@ incs += ' ../../render/extern/include ../../gpu' # for object_bake.c
defs = []
if env['OURPLATFORM'] == 'linux2':
if env['OURPLATFORM'] == 'linux':
cflags='-pthread'
incs += ' ../../../extern/binreloc/include'

View File

@@ -183,7 +183,7 @@ void ED_object_add_generic_props(wmOperatorType *ot, int do_editmode)
}
RNA_def_float_vector_xyz(ot->srna, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location", "Location for the newly added object", -FLT_MAX, FLT_MAX);
RNA_def_float_rotation(ot->srna, "rotation", 3, NULL, -FLT_MAX, FLT_MAX, "Rotation", "Rotation for the newly added object", -M_PI * 2.0f, M_PI * 2.0f);
RNA_def_float_rotation(ot->srna, "rotation", 3, NULL, -FLT_MAX, FLT_MAX, "Rotation", "Rotation for the newly added object", (float)-M_PI * 2.0f, (float)M_PI * 2.0f);
prop = RNA_def_boolean_layer_member(ot->srna, "layers", 20, NULL, "Layer", "");
RNA_def_property_flag(prop, PROP_HIDDEN);

View File

@@ -636,14 +636,14 @@ static void apply_heights_data(void *bake_data)
if(ibuf->rect_float) {
float *rrgbf= ibuf->rect_float + i*4;
if(max-min > 1e-5) height= (heights[i]-min)/(max-min);
if(max-min > 1e-5f) height= (heights[i]-min)/(max-min);
else height= 0;
rrgbf[0]=rrgbf[1]=rrgbf[2]= height;
} else {
char *rrgb= (char*)ibuf->rect + i*4;
if(max-min > 1e-5) height= (heights[i]-min)/(max-min);
if(max-min > 1e-5f) height= (heights[i]-min)/(max-min);
else height= 0;
rrgb[0]=rrgb[1]=rrgb[2]= FTOCHAR(height);

View File

@@ -10,7 +10,7 @@ incs += ' ../../makesrna ../../render/extern/include #/intern/elbeem/extern'
defs = ''
if env['OURPLATFORM'] == 'linux2':
if env['OURPLATFORM'] == 'linux':
cflags='-pthread'
incs += ' ../../../extern/binreloc/include'

View File

@@ -9,7 +9,7 @@ incs += ' ../../gpu'
incs += ' ../../makesrna ../../render/extern/include #/intern/elbeem/extern'
incs += ' ../../blenloader'
if env['OURPLATFORM'] == 'linux2':
if env['OURPLATFORM'] == 'linux':
cflags='-pthread'
incs += ' ../../../extern/binreloc/include'

View File

@@ -799,7 +799,7 @@ void TEXTURE_OT_envmap_save(wmOperatorType *ot)
ot->poll= envmap_save_poll;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag= OPTYPE_REGISTER; /* no undo since this doesnt modify the env-map */
/* properties */
//RNA_def_enum(ot->srna, "file_type", image_file_type_items, R_PNG, "File Type", "File type to save image as.");
@@ -887,8 +887,6 @@ static int copy_material_exec(bContext *C, wmOperator *UNUSED(op))
copy_matcopybuf(ma);
WM_event_add_notifier(C, NC_MATERIAL, ma);
return OPERATOR_FINISHED;
}
@@ -903,7 +901,7 @@ void MATERIAL_OT_copy(wmOperatorType *ot)
ot->exec= copy_material_exec;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag= OPTYPE_REGISTER; /* no undo needed since no changes are made to the material */
}
static int paste_material_exec(bContext *C, wmOperator *UNUSED(op))
@@ -1027,8 +1025,6 @@ static int copy_mtex_exec(bContext *C, wmOperator *UNUSED(op))
copy_mtex_copybuf(id);
WM_event_add_notifier(C, NC_TEXTURE, NULL);
return OPERATOR_FINISHED;
}
@@ -1051,7 +1047,7 @@ void TEXTURE_OT_slot_copy(wmOperatorType *ot)
ot->poll= copy_mtex_poll;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag= OPTYPE_REGISTER; /* no undo needed since no changes are made to the mtex */
}
static int paste_mtex_exec(bContext *C, wmOperator *UNUSED(op))

View File

@@ -10,7 +10,7 @@ incs += ' #/intern/guardedalloc #/extern/glew/include'
defs = ''
if env['OURPLATFORM'] == 'linux2':
if env['OURPLATFORM'] == 'linux':
cflags='-pthread'
incs += ' ../../../extern/binreloc/include'

View File

@@ -1300,6 +1300,7 @@ int ED_area_header_switchbutton(const bContext *C, uiBlock *block, int yco)
"Displays current editor type. "
"Click for menu of available types");
uiButSetFunc(but, spacefunc, NULL, NULL);
uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */
return xco + UI_UNIT_X + 14;
}
@@ -1308,6 +1309,7 @@ int ED_area_header_standardbuttons(const bContext *C, uiBlock *block, int yco)
{
ScrArea *sa= CTX_wm_area(C);
int xco= 8;
uiBut *but;
if (!sa->full)
xco= ED_area_header_switchbutton(C, block, yco);
@@ -1315,20 +1317,22 @@ int ED_area_header_standardbuttons(const bContext *C, uiBlock *block, int yco)
uiBlockSetEmboss(block, UI_EMBOSSN);
if (sa->flag & HEADER_NO_PULLDOWN) {
uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0,
but= uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0,
ICON_DISCLOSURE_TRI_RIGHT,
xco,yco,UI_UNIT_X,UI_UNIT_Y-2,
&(sa->flag), 0, 0, 0, 0,
"Show pulldown menus");
}
else {
uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0,
but= uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0,
ICON_DISCLOSURE_TRI_DOWN,
xco,yco,UI_UNIT_X,UI_UNIT_Y-2,
&(sa->flag), 0, 0, 0, 0,
"Hide pulldown menus");
}
uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */
uiBlockSetEmboss(block, UI_EMBOSS);
return xco + UI_UNIT_X;

View File

@@ -10,7 +10,7 @@ incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
incs += ' ../../render/extern/include'
incs += ' ../../gpu ../../makesrna ../../blenloader'
if env['OURPLATFORM'] == 'linux2':
if env['OURPLATFORM'] == 'linux':
cflags='-pthread'
incs += ' ../../../extern/binreloc/include'

View File

@@ -962,6 +962,7 @@ void buttons_context_draw(const bContext *C, uiLayout *layout)
block= uiLayoutGetBlock(row);
uiBlockSetEmboss(block, UI_EMBOSSN);
but= uiDefIconButBitC(block, ICONTOG, SB_PIN_CONTEXT, 0, ICON_UNPINNED, 0, 0, UI_UNIT_X, UI_UNIT_Y, &sbuts->flag, 0, 0, 0, 0, "Follow context or keep fixed datablock displayed");
uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */
uiButSetFunc(but, pin_cb, NULL, NULL);
for(a=0; a<path->len; a++) {

View File

@@ -104,6 +104,7 @@ void buttons_header_buttons(const bContext *C, ARegion *ar)
{
SpaceButs *sbuts= CTX_wm_space_buts(C);
uiBlock *block;
uiBut *but;
int xco, yco= 2;
buttons_context_compute(C, sbuts);
@@ -118,33 +119,32 @@ void buttons_header_buttons(const bContext *C, ARegion *ar)
xco -= UI_UNIT_X;
// Default panels
uiBlockBeginAlign(block);
if(sbuts->pathflag & (1<<BCONTEXT_RENDER))
uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_SCENE, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)BCONTEXT_RENDER, 0, 0, "Render");
if(sbuts->pathflag & (1<<BCONTEXT_SCENE))
uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_SCENE_DATA, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)BCONTEXT_SCENE, 0, 0, "Scene");
if(sbuts->pathflag & (1<<BCONTEXT_WORLD))
uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_WORLD, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)BCONTEXT_WORLD, 0, 0, "World");
if(sbuts->pathflag & (1<<BCONTEXT_OBJECT))
uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_OBJECT_DATA, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)BCONTEXT_OBJECT, 0, 0, "Object");
if(sbuts->pathflag & (1<<BCONTEXT_CONSTRAINT))
uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_CONSTRAINT, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)BCONTEXT_CONSTRAINT, 0, 0, "Object Constraints");
if(sbuts->pathflag & (1<<BCONTEXT_MODIFIER))
uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_MODIFIER, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)BCONTEXT_MODIFIER, 0, 0, "Modifiers");
if(sbuts->pathflag & (1<<BCONTEXT_DATA))
uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, sbuts->dataicon, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)BCONTEXT_DATA, 0, 0, "Object Data");
if(sbuts->pathflag & (1<<BCONTEXT_BONE))
uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_BONE_DATA, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)BCONTEXT_BONE, 0, 0, "Bone");
if(sbuts->pathflag & (1<<BCONTEXT_BONE_CONSTRAINT))
uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_CONSTRAINT_BONE, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)BCONTEXT_BONE_CONSTRAINT, 0, 0, "Bone Constraints");
if(sbuts->pathflag & (1<<BCONTEXT_MATERIAL))
uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_MATERIAL, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)BCONTEXT_MATERIAL, 0, 0, "Material");
if(sbuts->pathflag & (1<<BCONTEXT_TEXTURE))
uiDefIconButS(block, ROW, B_BUTSPREVIEW, ICON_TEXTURE, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)BCONTEXT_TEXTURE, 0, 0, "Texture");
if(sbuts->pathflag & (1<<BCONTEXT_PARTICLE))
uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_PARTICLES, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)BCONTEXT_PARTICLE, 0, 0, "Particles");
if(sbuts->pathflag & (1<<BCONTEXT_PHYSICS))
uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_PHYSICS, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)BCONTEXT_PHYSICS, 0, 0, "Physics");
#define BUTTON_HEADER_CTX(_ctx, _icon, _tip) \
if(sbuts->pathflag & (1<<_ctx)) { \
but= uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, _icon, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)_ctx, 0, 0, _tip); \
uiButClearFlag(but, UI_BUT_UNDO); \
} \
BUTTON_HEADER_CTX(BCONTEXT_RENDER, ICON_SCENE, "Render")
BUTTON_HEADER_CTX(BCONTEXT_SCENE, ICON_SCENE_DATA, "Scene");
BUTTON_HEADER_CTX(BCONTEXT_WORLD, ICON_WORLD, "World");
BUTTON_HEADER_CTX(BCONTEXT_OBJECT, ICON_OBJECT_DATA, "Object");
BUTTON_HEADER_CTX(BCONTEXT_CONSTRAINT, ICON_CONSTRAINT, "Object Constraints");
BUTTON_HEADER_CTX(BCONTEXT_MODIFIER, ICON_MODIFIER, "Object Modifiers");
BUTTON_HEADER_CTX(BCONTEXT_DATA, sbuts->dataicon, "Object Data");
BUTTON_HEADER_CTX(BCONTEXT_BONE, ICON_BONE_DATA, "Bone");
BUTTON_HEADER_CTX(BCONTEXT_BONE_CONSTRAINT, ICON_CONSTRAINT_BONE, "Bone Constraints");
BUTTON_HEADER_CTX(BCONTEXT_MATERIAL, ICON_MATERIAL, "Material");
BUTTON_HEADER_CTX(BCONTEXT_TEXTURE, ICON_TEXTURE, "Textures");
BUTTON_HEADER_CTX(BCONTEXT_PARTICLE, ICON_PARTICLES, "Particles");
BUTTON_HEADER_CTX(BCONTEXT_PHYSICS, ICON_PHYSICS, "Physics");
#undef BUTTON_HEADER_CTX
xco+= BUT_UNIT_X;
uiBlockEndAlign(block);

View File

@@ -165,8 +165,11 @@ static void id_drop_copy(wmDrag *drag, wmDropBox *drop)
{
char text[64];
ID *id= drag->poin;
char id_esc[(sizeof(id->name) - 2) * 2];
snprintf(text, sizeof(text), "bpy.data.%s['%s']", BKE_idcode_to_name_plural(GS(id->name)), id->name+2);
BLI_strescape(id_esc, id->name+2, sizeof(id_esc));
snprintf(text, sizeof(text), "bpy.data.%s[\"%s\"]", BKE_idcode_to_name_plural(GS(id->name)), id_esc);
/* copy drag path to properties */
RNA_string_set(drop->ptr, "text", text);

View File

@@ -19,7 +19,7 @@ if env['WITH_BF_OPENEXR']:
if env['WITH_BF_TIFF']:
defs.append('WITH_TIFF')
if env['OURPLATFORM'] == 'linux2':
if env['OURPLATFORM'] == 'linux':
cflags='-pthread'
incs += ' ../../../extern/binreloc/include'

View File

@@ -938,9 +938,100 @@ void IMAGE_OT_replace(wmOperatorType *ot)
/******************** save image as operator ********************/
typedef struct {
/* matching scene->r settings */
short planes, imtype, subimtype, quality;
char filepath[FILE_MAX]; /* keep absolute */
} SaveImageOptions;
static void save_image_options_defaults(SaveImageOptions *simopts)
{
simopts->planes= R_PLANES24;
simopts->imtype= R_PNG;
simopts->subimtype= 0;
simopts->quality= 90;
simopts->filepath[0]= '\0';
}
static int save_image_options_init(SaveImageOptions *simopts, SpaceImage *sima, Scene *scene, const short guess_path)
{
void *lock;
ImBuf *ibuf= ED_space_image_acquire_buffer(sima, &lock);
if(ibuf) {
Image *ima= sima->image;
RenderResult *rr= BKE_image_acquire_renderresult(scene, ima);
simopts->planes= ibuf->depth;
/* cant save multilayer sequence, ima->rr isn't valid for a specific frame */
if(rr && !(ima->source==IMA_SRC_SEQUENCE && ima->type==IMA_TYPE_MULTILAYER))
simopts->imtype= R_MULTILAYER;
else if(ima->type==IMA_TYPE_R_RESULT)
simopts->imtype= scene->r.imtype;
else if (ima->source == IMA_SRC_GENERATED)
simopts->imtype= R_PNG;
else
simopts->imtype= BKE_ftype_to_imtype(ibuf->ftype);
simopts->subimtype= scene->r.subimtype; /* XXX - this is lame, we need to make these available too! */
simopts->quality= ibuf->ftype & 0xff;
BLI_strncpy(simopts->filepath, ibuf->name, sizeof(simopts->filepath));
/* sanitize all settings */
/* unlikely but just incase */
if (ELEM3(simopts->planes, R_PLANESBW, R_PLANES24, R_PLANES32) == 0) {
simopts->planes= 32;
}
/* some formats dont use quality so fallback to scenes quality */
if (simopts->quality == 0) {
simopts->quality= scene->r.quality;
}
/* check for empty path */
if(guess_path && simopts->filepath[0]==0) {
if ( (G.ima[0] == '/') && (G.ima[1] == '/') && (G.ima[2] == '\0') ) {
BLI_strncpy(simopts->filepath, "//untitled", FILE_MAX);
} else {
BLI_strncpy(simopts->filepath, G.ima, FILE_MAX);
}
BLI_path_abs(simopts->filepath, G.main->name);
}
/* cleanup */
BKE_image_release_renderresult(scene, ima);
}
ED_space_image_release_buffer(sima, lock);
return (ibuf != NULL);
}
static void save_image_options_from_op(SaveImageOptions *simopts, wmOperator *op)
{
if (RNA_property_is_set(op->ptr, "color_mode")) simopts->planes= RNA_enum_get(op->ptr, "color_mode");
if (RNA_property_is_set(op->ptr, "file_format")) simopts->imtype= RNA_enum_get(op->ptr, "file_format");
// if (RNA_property_is_set(op->ptr, "subimtype")) simopts->subimtype= RNA_enum_get(op->ptr, "subimtype"); // XXX
if (RNA_property_is_set(op->ptr, "file_quality")) simopts->quality= RNA_int_get(op->ptr, "file_quality");
if (RNA_property_is_set(op->ptr, "filepath")) RNA_string_get(op->ptr, "filepath", simopts->filepath);
}
static void save_image_options_to_op(SaveImageOptions *simopts, wmOperator *op)
{
RNA_enum_set(op->ptr, "color_mode", simopts->planes);
RNA_enum_set(op->ptr, "file_format", simopts->imtype);
// RNA_enum_set(op->ptr, "subimtype", simopts->subimtype);
RNA_int_set(op->ptr, "file_quality", simopts->quality);
RNA_string_set(op->ptr, "filepath", simopts->filepath);
}
/* assumes name is FILE_MAX */
/* ima->name and ibuf->name should end up the same */
static void save_image_doit(bContext *C, SpaceImage *sima, Scene *scene, wmOperator *op, char *path, int do_newpath)
static void save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveImageOptions *simopts, int do_newpath)
{
Image *ima= ED_space_image(sima);
void *lock;
@@ -952,18 +1043,17 @@ static void save_image_doit(bContext *C, SpaceImage *sima, Scene *scene, wmOpera
const short save_copy= (RNA_struct_find_property(op->ptr, "copy") && RNA_boolean_get(op->ptr, "copy"));
short ok= FALSE;
BLI_path_abs(path, bmain->name);
/* old global to ensure a 2nd save goes to same dir */
BLI_strncpy(G.ima, path, sizeof(G.ima));
BLI_strncpy(G.ima, simopts->filepath, sizeof(G.ima));
WM_cursor_wait(1);
if(ima->type == IMA_TYPE_R_RESULT) {
/* enforce user setting for RGB or RGBA, but skip BW */
if(scene->r.planes==32) {
if(simopts->planes==32) {
ibuf->depth= 32;
}
else if(scene->r.planes==24) {
else if(simopts->planes==24) {
ibuf->depth= 24;
}
}
@@ -975,14 +1065,11 @@ static void save_image_doit(bContext *C, SpaceImage *sima, Scene *scene, wmOpera
}
}
if(scene->r.scemode & R_EXTENSION) {
BKE_add_image_extension(path, sima->imtypenr);
}
if(sima->imtypenr==R_MULTILAYER) {
if(simopts->imtype==R_MULTILAYER) {
Scene *scene= CTX_data_scene(C);
RenderResult *rr= BKE_image_acquire_renderresult(scene, ima);
if(rr) {
RE_WriteRenderResult(rr, path, scene->r.quality);
RE_WriteRenderResult(rr, simopts->filepath, simopts->quality);
ok= TRUE;
}
else {
@@ -990,23 +1077,23 @@ static void save_image_doit(bContext *C, SpaceImage *sima, Scene *scene, wmOpera
}
BKE_image_release_renderresult(scene, ima);
}
else if (BKE_write_ibuf(ibuf, path, sima->imtypenr, scene->r.subimtype, scene->r.quality)) {
else if (BKE_write_ibuf(ibuf, simopts->filepath, simopts->imtype, simopts->subimtype, simopts->quality)) {
ok= TRUE;
}
if(ok) {
if(relative)
BLI_path_rel(path, bmain->name); /* only after saving */
BLI_path_rel(simopts->filepath, bmain->name); /* only after saving */
if(ibuf->name[0]==0) {
BLI_strncpy(ibuf->name, path, sizeof(ibuf->name));
BLI_strncpy(ima->name, path, sizeof(ima->name));
BLI_strncpy(ibuf->name, simopts->filepath, sizeof(ibuf->name));
BLI_strncpy(ima->name, simopts->filepath, sizeof(ima->name));
}
if(!save_copy) {
if(do_newpath) {
BLI_strncpy(ima->name, path, sizeof(ima->name));
BLI_strncpy(ibuf->name, path, sizeof(ibuf->name));
BLI_strncpy(ima->name, simopts->filepath, sizeof(ima->name));
BLI_strncpy(ibuf->name, simopts->filepath, sizeof(ibuf->name));
}
ibuf->userflags &= ~IB_BITMAPDIRTY;
@@ -1034,7 +1121,7 @@ static void save_image_doit(bContext *C, SpaceImage *sima, Scene *scene, wmOpera
}
}
else {
BKE_reportf(op->reports, RPT_ERROR, "Couldn't write image: %s", path);
BKE_reportf(op->reports, RPT_ERROR, "Couldn't write image: %s", simopts->filepath);
}
@@ -1049,17 +1136,14 @@ static void save_image_doit(bContext *C, SpaceImage *sima, Scene *scene, wmOpera
static int save_as_exec(bContext *C, wmOperator *op)
{
SpaceImage *sima= CTX_wm_space_image(C);
Scene *scene= CTX_data_scene(C);
Image *ima = ED_space_image(sima);
char str[FILE_MAX];
SaveImageOptions simopts;
if(!ima)
return OPERATOR_CANCELLED;
/* just incase to initialize values,
* these should be set on invoke or by the caller. */
save_image_options_defaults(&simopts);
save_image_options_from_op(&simopts, op);
sima->imtypenr= RNA_enum_get(op->ptr, "file_type");
RNA_string_get(op->ptr, "filepath", str);
save_image_doit(C, sima, scene, op, str, TRUE);
save_image_doit(C, sima, op, &simopts, TRUE);
return OPERATOR_FINISHED;
}
@@ -1069,7 +1153,7 @@ static int save_as_check(bContext *UNUSED(C), wmOperator *op)
{
char filepath[FILE_MAX];
RNA_string_get(op->ptr, "filepath", filepath);
if(BKE_add_image_extension(filepath, RNA_enum_get(op->ptr, "file_type"))) {
if(BKE_add_image_extension(filepath, RNA_enum_get(op->ptr, "file_format"))) {
RNA_string_set(op->ptr, "filepath", filepath);
return TRUE;
}
@@ -1081,10 +1165,7 @@ static int save_as_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
SpaceImage *sima= CTX_wm_space_image(C);
Image *ima = ED_space_image(sima);
Scene *scene= CTX_data_scene(C);
ImBuf *ibuf;
char filename[FILE_MAX];
void *lock;
SaveImageOptions simopts;
if(!RNA_property_is_set(op->ptr, "relative_path"))
RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS);
@@ -1092,33 +1173,9 @@ static int save_as_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
if(RNA_property_is_set(op->ptr, "filepath"))
return save_as_exec(C, op);
if(!ima)
if (save_image_options_init(&simopts, sima, scene, TRUE) == 0)
return OPERATOR_CANCELLED;
/* always opens fileselect */
ibuf= ED_space_image_acquire_buffer(sima, &lock);
if(ibuf) {
/* cant save multilayer sequence, ima->rr isn't valid for a specific frame */
if(ima->rr && !(ima->source==IMA_SRC_SEQUENCE && ima->type==IMA_TYPE_MULTILAYER))
sima->imtypenr= R_MULTILAYER;
else if(ima->type==IMA_TYPE_R_RESULT)
sima->imtypenr= scene->r.imtype;
else if (ima->source == IMA_SRC_GENERATED)
sima->imtypenr= R_PNG;
else
sima->imtypenr= BKE_ftype_to_imtype(ibuf->ftype);
RNA_enum_set(op->ptr, "file_type", sima->imtypenr);
if(ibuf->name[0]==0)
if ( (G.ima[0] == '/') && (G.ima[1] == '/') && (G.ima[2] == '\0') ) {
BLI_strncpy(filename, "//untitled", FILE_MAX);
} else {
BLI_strncpy(filename, G.ima, FILE_MAX);
}
else
BLI_strncpy(filename, ibuf->name, FILE_MAX);
save_image_options_to_op(&simopts, op);
/* enable save_copy by default for render results */
if(ELEM(ima->type, IMA_TYPE_R_RESULT, IMA_TYPE_COMPOSITE) && !RNA_property_is_set(op->ptr, "copy")) {
@@ -1126,20 +1183,15 @@ static int save_as_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
}
// XXX note: we can give default menu enums to operator for this
image_filesel(C, op, filename);
ED_space_image_release_buffer(sima, lock);
image_filesel(C, op, simopts.filepath);
return OPERATOR_RUNNING_MODAL;
}
ED_space_image_release_buffer(sima, lock);
return OPERATOR_CANCELLED;
}
void IMAGE_OT_save_as(wmOperatorType *ot)
{
PropertyRNA *prop;
/* identifiers */
ot->name= "Save As Image";
ot->idname= "IMAGE_OT_save_as";
@@ -1154,7 +1206,13 @@ void IMAGE_OT_save_as(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_enum(ot->srna, "file_type", image_file_type_items, R_PNG, "File Type", "File type to save image as.");
/* format options */
RNA_def_enum(ot->srna, "file_format", image_file_type_items, R_PNG, "File Type", "File type to save image as.");
RNA_def_enum(ot->srna, "color_mode", image_color_mode_items, R_PLANES24, "Channels", "Image channels to save");
prop= RNA_def_int(ot->srna, "file_quality", 90, 0, 100, "Quality", "", 0, 100);
RNA_def_property_subtype(prop, PROP_PERCENTAGE);
WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH);
RNA_def_boolean(ot->srna, "copy", 0, "Copy", "Create a new image file without modifying the current image in blender");
@@ -1164,45 +1222,19 @@ void IMAGE_OT_save_as(wmOperatorType *ot)
static int save_exec(bContext *C, wmOperator *op)
{
Main *bmain= CTX_data_main(C);
SpaceImage *sima= CTX_wm_space_image(C);
Image *ima = ED_space_image(sima);
void *lock;
ImBuf *ibuf= ED_space_image_acquire_buffer(sima, &lock);
Scene *scene= CTX_data_scene(C);
RenderResult *rr;
char name[FILE_MAX];
SaveImageOptions simopts;
if(!ima || !ibuf) {
ED_space_image_release_buffer(sima, lock);
if (save_image_options_init(&simopts, sima, scene, FALSE) == 0)
return OPERATOR_CANCELLED;
}
save_image_options_from_op(&simopts, op);
/* if exists, saves over without fileselect */
BLI_strncpy(name, ima->name, FILE_MAX);
if(name[0]==0)
BLI_strncpy(name, G.ima, FILE_MAX);
else
BLI_path_abs(name, bmain->name);
if(BLI_exists(name) && BLI_is_writable(name)) {
rr= BKE_image_acquire_renderresult(scene, ima);
if(rr)
sima->imtypenr= R_MULTILAYER;
else
sima->imtypenr= BKE_ftype_to_imtype(ibuf->ftype);
BKE_image_release_renderresult(scene, ima);
ED_space_image_release_buffer(sima, lock);
save_image_doit(C, sima, scene, op, name, FALSE);
if (BLI_exists(simopts.filepath) && BLI_is_writable(simopts.filepath)) {
save_image_doit(C, sima, op, &simopts, FALSE);
}
else {
ED_space_image_release_buffer(sima, lock);
BKE_report(op->reports, RPT_ERROR, "Can not save image.");
BKE_reportf(op->reports, RPT_ERROR, "Can not save image, path '%s' is not writable.", simopts.filepath);
return OPERATOR_CANCELLED;
}
@@ -1331,7 +1363,7 @@ void IMAGE_OT_reload(wmOperatorType *ot)
ot->exec= reload_exec;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag= OPTYPE_REGISTER; /* no undo, image buffer is not handled by undo */
}
/********************** new image operator *********************/
@@ -1989,7 +2021,7 @@ void IMAGE_OT_sample_line(wmOperatorType *ot)
ot->cancel= WM_gesture_straightline_cancel;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag= 0; /* no undo/register since this operates on the space */
WM_operator_properties_gesture_straightline(ot, CURSOR_EDIT);
}

View File

@@ -273,7 +273,7 @@ void FILE_OT_report_missing_files(wmOperatorType *ot)
ot->exec= report_missing_files_exec;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag= 0; /* only reports so no need to undo/register */
}
/********************* find missing files operator *********************/

View File

@@ -15,7 +15,7 @@ if env['CC'] == 'gcc':
#cf.append('-Werror')
pass
if env['OURPLATFORM'] == 'linux2':
if env['OURPLATFORM'] == 'linux':
cflags='-pthread'
incs += ' ../../../extern/binreloc/include'

View File

@@ -612,6 +612,7 @@ void ED_node_set_active(Main *bmain, bNodeTree *ntree, bNode *node)
}
}
else if(node->type==CMP_NODE_COMPOSITE) {
if (was_output==0) {
bNode *tnode;
for(tnode= ntree->nodes.first; tnode; tnode= tnode->next)
@@ -622,6 +623,7 @@ void ED_node_set_active(Main *bmain, bNodeTree *ntree, bNode *node)
ED_node_generic_update(bmain, ntree, node);
}
}
}
else if(ntree->type==NTREE_TEXTURE) {
// XXX
#if 0

Some files were not shown because too many files have changed in this diff Show More