diff options
97 files changed, 906 insertions, 1313 deletions
diff --git a/SConstruct b/SConstruct index 738466d389e..aeaef581145 100644 --- a/SConstruct +++ b/SConstruct @@ -30,7 +30,6 @@ # Then read all SConscripts and build # # TODO: fix /FORCE:MULTIPLE on windows to get proper debug builds. -# TODO: cleanup CCFLAGS / CPPFLAGS use, often both are set when we only need one. import platform as pltfrm @@ -210,7 +209,7 @@ opts.Update(env) if sys.platform=='win32': if bitness==64: - env.Append(CFLAGS=['-DWIN64']) # -DWIN32 needed too, as it's used all over to target Windows generally + env.Append(CPPFLAGS=['-DWIN64']) # -DWIN32 needed too, as it's used all over to target Windows generally if not env['BF_FANCY']: B.bc.disable() @@ -283,22 +282,17 @@ if env['OURPLATFORM']=='darwin': if env['WITH_BF_OPENMP'] == 1: if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'): env['CCFLAGS'].append('/openmp') - env['CPPFLAGS'].append('/openmp') else: if env['CC'].endswith('icc'): # to be able to handle CC=/opt/bla/icc case env.Append(LINKFLAGS=['-openmp', '-static-intel']) env['CCFLAGS'].append('-openmp') - env['CPPFLAGS'].append('-openmp') else: env.Append(CCFLAGS=['-fopenmp']) - env.Append(CPPFLAGS=['-fopenmp']) if env['WITH_GHOST_COCOA'] == True: - env.Append(CFLAGS=['-DGHOST_COCOA']) - env.Append(CPPFLAGS=['-DGHOST_COCOA']) + env.Append(CPPFLAGS=['-DGHOST_COCOA']) if env['USE_QTKIT'] == True: - env.Append(CFLAGS=['-DUSE_QTKIT']) env.Append(CPPFLAGS=['-DUSE_QTKIT']) #check for additional debug libnames @@ -330,20 +324,15 @@ if 'blendernogame' in B.targets: # disable elbeem (fluidsim) compilation? if env['BF_NO_ELBEEM'] == 1: env['CPPFLAGS'].append('-DDISABLE_ELBEEM') - env['CCFLAGS'].append('-DDISABLE_ELBEEM') if btools.ENDIAN == "big": env['CPPFLAGS'].append('-D__BIG_ENDIAN__') - env['CCFLAGS'].append('-D__BIG_ENDIAN__') else: env['CPPFLAGS'].append('-D__LITTLE_ENDIAN__') - env['CCFLAGS'].append('-D__LITTLE_ENDIAN__') - # TODO, make optional env['CPPFLAGS'].append('-DWITH_AUDASPACE') -env['CCFLAGS'].append('-DWITH_AUDASPACE') # lastly we check for root_build_dir ( we should not do before, otherwise we might do wrong builddir B.root_build_dir = env['BF_BUILDDIR'] @@ -505,64 +494,62 @@ dottargetlist = [] scriptinstall = [] if env['OURPLATFORM']!='darwin': - for dp, dn, df in os.walk('release/bin/.blender'): - dp = os.path.normpath(dp) - - if '.svn' in dn: - dn.remove('.svn') - if '_svn' in dn: - dn.remove('_svn') - - for f in df: - # This files aren't used anymore - if f in (".bfont.ttf", ): + dotblenderinstall = [] + for targetdir,srcfile in zip(dottargetlist, dotblendlist): + td, tf = os.path.split(targetdir) + dotblenderinstall.append(env.Install(dir=td, source=srcfile)) + for targetdir,srcfile in zip(datafilestargetlist, datafileslist): + td, tf = os.path.split(targetdir) + dotblenderinstall.append(env.Install(dir=td, source=srcfile)) + + if env['WITH_BF_PYTHON']: + #-- local/VERSION/scripts + scriptpaths=['release/scripts'] + for scriptpath in scriptpaths: + for dp, dn, df in os.walk(scriptpath): + if '.svn' in dn: + dn.remove('.svn') + if '_svn' in dn: + dn.remove('_svn') + if '__pycache__' in dn: # py3.2 cache dir + dn.remove('__pycache__') + + dir = os.path.join(env['BF_INSTALLDIR'], VERSION) + dir += os.sep + os.path.basename(scriptpath) + dp[len(scriptpath):] + + source=[os.path.join(dp, f) for f in df if not f.endswith(".pyc")] + # To ensure empty dirs are created too + if len(source)==0: + env.Execute(Mkdir(dir)) + scriptinstall.append(env.Install(dir=dir,source=source)) + + if env['WITH_BF_INTERNATIONAL']: + internationalpaths=['release' + os.sep + 'datafiles'] + + def check_path(path, member): + return (member in path.split(os.sep)) + + for intpath in internationalpaths: + for dp, dn, df in os.walk(intpath): + if '.svn' in dn: + dn.remove('.svn') + if '_svn' in dn: + dn.remove('_svn') + + # we only care about release/datafiles/fonts, release/datafiles/locales + if check_path(dp, "fonts") or check_path(dp, "locale"): + pass + else: continue - - if not env['WITH_BF_INTERNATIONAL']: - if 'locale' in dp: - continue - if not env['WITH_BF_FREETYPE']: - if f.endswith('.ttf'): - continue - if 'locale' in dp or 'fonts' in dp: - datafileslist.append(os.path.join(dp,f)) - dir= os.path.join(*([env['BF_INSTALLDIR']] + [VERSION] + ['datafiles'] + dp.split(os.sep)[3:])) # skip bin - datafilestargetlist.append(dir + os.sep + f) - - else: - dotblendlist.append(os.path.join(dp, f)) - dir= os.path.join(*([env['BF_INSTALLDIR']] + [VERSION] + ['config'] + dp.split(os.sep)[3:])) # skip bin - dottargetlist.append(dir + os.sep + f) - - dotblenderinstall = [] - for targetdir,srcfile in zip(dottargetlist, dotblendlist): - td, tf = os.path.split(targetdir) - dotblenderinstall.append(env.Install(dir=td, source=srcfile)) - for targetdir,srcfile in zip(datafilestargetlist, datafileslist): - td, tf = os.path.split(targetdir) - dotblenderinstall.append(env.Install(dir=td, source=srcfile)) - - if env['WITH_BF_PYTHON']: - #-- local/VERSION/scripts - scriptpaths=['release/scripts'] - for scriptpath in scriptpaths: - for dp, dn, df in os.walk(scriptpath): - if '.svn' in dn: - dn.remove('.svn') - if '_svn' in dn: - dn.remove('_svn') - if '__pycache__' in dn: # py3.2 cache dir - dn.remove('__pycache__') - - dir = os.path.join(env['BF_INSTALLDIR'], VERSION) - dir += os.sep + os.path.basename(scriptpath) + dp[len(scriptpath):] - - source=[os.path.join(dp, f) for f in df if not f.endswith(".pyc")] - # To ensure empty dirs are created too - if len(source)==0: - env.Execute(Mkdir(dir)) - scriptinstall.append(env.Install(dir=dir,source=source)) + dir = os.path.join(env['BF_INSTALLDIR'], VERSION) + dir += os.sep + os.path.basename(intpath) + dp[len(intpath):] + + source=[os.path.join(dp, f) for f in df if not f.endswith(".pyc")] + # To ensure empty dirs are created too + if len(source)==0: + env.Execute(Mkdir(dir)) + scriptinstall.append(env.Install(dir=dir,source=source)) #-- icons if env['OURPLATFORM']=='linux': diff --git a/build_files/buildbot/config/user-config-i686.py b/build_files/buildbot/config/user-config-i686.py index f2197a05501..080fd8d6123 100644 --- a/build_files/buildbot/config/user-config-i686.py +++ b/build_files/buildbot/config/user-config-i686.py @@ -94,6 +94,7 @@ WITH_BF_JACK = True # Compilation and optimization BF_DEBUG = False -REL_CFLAGS = ['-O2'] -REL_CCFLAGS = ['-O2'] +REL_CFLAGS = [] +REL_CXXFLAGS = [] +REL_CCFLAGS = ['-O2'] # C & C++ PLATFORM_LINKFLAGS = ['-L/home/sources/staticlibs/lib32'] diff --git a/build_files/buildbot/config/user-config-player-i686.py b/build_files/buildbot/config/user-config-player-i686.py index 99671ecc072..204732376fa 100644 --- a/build_files/buildbot/config/user-config-player-i686.py +++ b/build_files/buildbot/config/user-config-player-i686.py @@ -85,6 +85,7 @@ WITH_BF_JACK = True # Compilation and optimization BF_DEBUG = False -REL_CFLAGS = ['-O2'] -REL_CCFLAGS = ['-O2'] +REL_CFLAGS = [] +REL_CXXFLAGS = [] +REL_CCFLAGS = ['-O2'] # C & C++ PLATFORM_LINKFLAGS = ['-L/home/sources/staticlibs/lib32'] diff --git a/build_files/buildbot/config/user-config-player-x86_64.py b/build_files/buildbot/config/user-config-player-x86_64.py index a1ca38880eb..cc0ba209a44 100644 --- a/build_files/buildbot/config/user-config-player-x86_64.py +++ b/build_files/buildbot/config/user-config-player-x86_64.py @@ -85,6 +85,7 @@ WITH_BF_JACK = True # Compilation and optimization BF_DEBUG = False -REL_CFLAGS = ['-O2'] -REL_CCFLAGS = ['-O2'] +REL_CFLAGS = [] +REL_CXXFLAGS = [] +REL_CCFLAGS = ['-O2'] # C & C++ PLATFORM_LINKFLAGS = ['-L/home/sources/staticlibs/lib64'] diff --git a/build_files/buildbot/config/user-config-x86_64.py b/build_files/buildbot/config/user-config-x86_64.py index 93fe3ca2e5b..4698ffdce15 100644 --- a/build_files/buildbot/config/user-config-x86_64.py +++ b/build_files/buildbot/config/user-config-x86_64.py @@ -94,6 +94,7 @@ WITH_BF_JACK = True # Compilation and optimization BF_DEBUG = False -REL_CFLAGS = ['-O2'] -REL_CCFLAGS = ['-O2'] +REL_CFLAGS = [] +REL_CXXFLAGS = [] +REL_CCFLAGS = ['-O2'] # C & C++ PLATFORM_LINKFLAGS = ['-L/home/sources/staticlibs/lib64'] diff --git a/build_files/scons/config/aix4-config.py b/build_files/scons/config/aix4-config.py deleted file mode 100644 index f8b3e750e74..00000000000 --- a/build_files/scons/config/aix4-config.py +++ /dev/null @@ -1,209 +0,0 @@ -import os - -LCGDIR = os.getcwd()+"/../lib/aix-4.3-ppc" -LIBDIR = LCGDIR -print LCGDIR - -WITH_BF_VERSE = 'false' -BF_VERSE_INCLUDE = "#extern/verse/dist" - -BF_PYTHON = LCGDIR+'/python' -BF_PYTHON_VERSION = '3.2' -WITH_BF_STATICPYTHON = 'true' -BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}' -BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}' -BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION}' #BF_PYTHON+'/lib/python'+BF_PYTHON_VERSION+'/config/libpython'+BF_PYTHON_VERSION+'.a' -BF_PYTHON_LINKFLAGS = ['-Xlinker', '-export-dynamic'] -BF_PYTHON_LIB_STATIC = '${BF_PYTHON}/lib/python${BF_PYTHON_VERSION}/config/libpython${BF_PYTHON_VERSION}.a' - -WITH_BF_OPENAL = 'false' -WITH_BF_STATICOPENAL = 'false' -BF_OPENAL = LCGDIR+'/openal' -BF_OPENAL_INC = '${BF_OPENAL}/include' -BF_OPENAL_LIB = 'openal' -BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a' -BF_OPENAL_LIBPATH = LIBDIR + '/lib' - -BF_CXX = '/usr' -WITH_BF_STATICCXX = 'false' -BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a' - -WITH_BF_SDL = 'false' -BF_SDL = LCGDIR+'/sdl' #$(shell sdl-config --prefix) -BF_SDL_INC = '${BF_SDL}/include/SDL' #$(shell $(BF_SDL)/bin/sdl-config --cflags) -BF_SDL_LIB = 'SDL audio iconv charset' #BF_SDL #$(shell $(BF_SDL)/bin/sdl-config --libs) -lSDL_mixer -BF_SDL_LIBPATH = '${BF_SDL}/lib' - -WITH_BF_OPENEXR = 'false' -WITH_BF_STATICOPENEXR = 'false' -BF_OPENEXR = '/usr' -# when compiling with your own openexr lib you might need to set... -# BF_OPENEXR_INC = '${BF_OPENEXR}/include/OpenEXR ${BF_OPENEXR}/include' - -BF_OPENEXR_INC = '${BF_OPENEXR}/include/OpenEXR' -BF_OPENEXR_LIB = 'Half IlmImf Iex Imath ' -BF_OPENEXR_LIB_STATIC = '${BF_OPENEXR}/lib/libHalf.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_OPENEXR}/lib/libIex.a ${BF_OPENEXR}/lib/libImath.a ${BF_OPENEXR}/lib/libIlmThread.a' -# BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib' - - -WITH_BF_DDS = 'false' - -WITH_BF_JPEG = 'false' -BF_JPEG = LCGDIR+'/jpeg' -BF_JPEG_INC = '${BF_JPEG}/include' -BF_JPEG_LIB = 'jpeg' -BF_JPEG_LIBPATH = '${BF_JPEG}/lib' - -WITH_BF_PNG = 'false' -BF_PNG = LCGDIR+"/png" -BF_PNG_INC = '${BF_PNG}/include' -BF_PNG_LIB = 'png' -BF_PNG_LIBPATH = '${BF_PNG}/lib' - -BF_TIFF = '/usr/nekoware' -BF_TIFF_INC = '${BF_TIFF}/include' - -WITH_BF_ZLIB = 'true' -BF_ZLIB = LCGDIR+"/zlib" -BF_ZLIB_INC = '${BF_ZLIB}/include' -BF_ZLIB_LIB = 'z' -BF_ZLIB_LIBPATH = '${BF_ZLIB}/lib' - -WITH_BF_INTERNATIONAL = 'false' - -BF_GETTEXT = LCGDIR+'/gettext' -BF_GETTEXT_INC = '${BF_GETTEXT}/include' -BF_GETTEXT_LIB = 'gettextpo intl' -BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib' - -WITH_BF_GAMEENGINE='false' - -WITH_BF_BULLET = 'true' -BF_BULLET = '#extern/bullet2/src' -BF_BULLET_INC = '${BF_BULLET}' -BF_BULLET_LIB = 'extern_bullet' - -#WITH_BF_NSPR = 'true' -#BF_NSPR = $(LIBDIR)/nspr -#BF_NSPR_INC = -I$(BF_NSPR)/include -I$(BF_NSPR)/include/nspr -#BF_NSPR_LIB = - -# Uncomment the following line to use Mozilla inplace of netscape -#CPPFLAGS += -DMOZ_NOT_NET -# Location of MOZILLA/Netscape header files... -#BF_MOZILLA = $(LIBDIR)/mozilla -#BF_MOZILLA_INC = -I$(BF_MOZILLA)/include/mozilla/nspr -I$(BF_MOZILLA)/include/mozilla -I$(BF_MOZILLA)/include/mozilla/xpcom -I$(BF_MOZILLA)/include/mozilla/idl -#BF_MOZILLA_LIB = -# Will fall back to look in BF_MOZILLA_INC/nspr and BF_MOZILLA_LIB -# if this is not set. -# -# Be paranoid regarding library creation (do not update archives) -#BF_PARANOID = 'true' - -# enable freetype2 support for text objects -BF_FREETYPE = LCGDIR+'/freetype' -BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2' -BF_FREETYPE_LIB = 'freetype' -BF_FREETYPE_LIBPATH = '${BF_FREETYPE}/lib' - -WITH_BF_QUICKTIME = 'false' # -DWITH_QUICKTIME -BF_QUICKTIME = '/usr/local' -BF_QUICKTIME_INC = '${BF_QUICKTIME}/include' - -WITH_BF_ICONV = 'false' -BF_ICONV = LIBDIR + "/iconv" -BF_ICONV_INC = '${BF_ICONV}/include' -BF_ICONV_LIB = 'iconv charset' -BF_ICONV_LIBPATH = '${BF_ICONV}/lib' - -WITH_BF_BINRELOC = 'false' - -# enable ffmpeg support -WITH_BF_FFMPEG = 'false' # -DWITH_FFMPEG -# Uncomment the following two lines to use system's ffmpeg -BF_FFMPEG = LCGDIR+'/ffmpeg' -BF_FFMPEG_LIB = 'avformat avcodec swscale avutil avdevice faad faac vorbis x264 ogg mp3lame z' -BF_FFMPEG_INC = '${BF_FFMPEG}/include' -BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib' - -# enable ogg, vorbis and theora in ffmpeg -WITH_BF_OGG = 'false' # -DWITH_OGG -BF_OGG = '/usr' -BF_OGG_INC = '${BF_OGG}/include' -BF_OGG_LIB = 'ogg vorbis theoraenc theoradec' - -WITH_BF_OPENJPEG = 'false' -BF_OPENJPEG = '#extern/libopenjpeg' -BF_OPENJPEG_LIB = '' -BF_OPENJPEG_INC = '${BF_OPENJPEG}' -BF_OPENJPEG_LIBPATH='${BF_OPENJPEG}/lib' - -WITH_BF_REDCODE = 'false' -BF_REDCODE = '#extern/libredcode' -BF_REDCODE_LIB = '' -BF_REDCODE_INC = '${BF_REDCODE}/include' -BF_REDCODE_LIBPATH='${BF_REDCODE}/lib' - -# Mesa Libs should go here if your using them as well.... -WITH_BF_STATICOPENGL = 'false' -BF_OPENGL = '/usr' -BF_OPENGL_INC = '${BF_OPENGL}/include' -BF_OPENGL_LIB = 'GL GLU X11 Xi Xext' -BF_OPENGL_LIBPATH = '/usr/X11R6/lib' -BF_OPENGL_LIB_STATIC = '${BF_OPENGL}/libGL.a ${BF_OPENGL}/libGLU.a ${BF_OPENGL}/libXxf86vm.a ${BF_OPENGL}/libX11.a ${BF_OPENGL}/libXi.a ${BF_OPENGL}/libXext.a ${BF_OPENGL}/libXxf86vm.a' - - -CC = 'gcc' -CXX = 'g++' - -CCFLAGS = [ '-pipe', '-funsigned-char', '-fno-strict-aliasing' ] - -CPPFLAGS = [ '-DXP_UNIX', '-DWIN32', '-DFREE_WINDOWS' ] -CXXFLAGS = ['-pipe', '-funsigned-char', '-fno-strict-aliasing' ] -REL_CFLAGS = ['-DNDEBUG', '-O2' ] -REL_CCFLAGS = ['-DNDEBUG', '-O2' ] -C_WARN = [ '-Wall' , '-Wno-char-subscripts', '-Wdeclaration-after-statement' ] - -CC_WARN = [ '-Wall' ] - - - -##BF_DEPEND = 'true' -## -##AR = ar -##ARFLAGS = ruv -##ARFLAGSQUIET = ru -## - -##FIX_STUBS_WARNINGS = -Wno-unused - -LLIBS = 'c m dl pthread dmedia movie' -##LOPTS = --dynamic -##DYNLDFLAGS = -shared $(LDFLAGS) - -BF_PROFILE_FLAGS = ['-pg','-g'] -BF_PROFILE = 'false' - -BF_DEBUG = 'false' -BF_DEBUG_CCFLAGS = ['-g'] - -BF_BUILDDIR = '../build/aix4' -BF_INSTALLDIR='../install/aix4' -BF_DOCDIR='../install/doc' - -#Link against pthread -LDIRS = [] -LDIRS.append(BF_FREETYPE_LIBPATH) -LDIRS.append(BF_PNG_LIBPATH) -LDIRS.append(BF_ZLIB_LIBPATH) -LDIRS.append(BF_SDL_LIBPATH) -LDIRS.append(BF_OPENAL_LIBPATH) -LDIRS.append(BF_ICONV_LIBPATH) - -PLATFORM_LINKFLAGS = [] -for x in LDIRS: - PLATFORM_LINKFLAGS.append("-L"+x) - -PLATFORM_LINKFLAGS += ['-L${LCGDIR}/jpeg/lib' , '-L/usr/lib32', '-n32', '-v', '-no_prelink'] -print PLATFORM_LINKFLAGS -LINKFLAGS= PLATFORM_LINKFLAGS diff --git a/build_files/scons/config/darwin-config.py b/build_files/scons/config/darwin-config.py index 0c132041d82..deb3d01febd 100644 --- a/build_files/scons/config/darwin-config.py +++ b/build_files/scons/config/darwin-config.py @@ -306,11 +306,11 @@ if MACOSX_ARCHITECTURE == 'x86_64' or MACOSX_ARCHITECTURE == 'ppc64': else: ARCH_FLAGS = ['-m32'] -CFLAGS = ['-pipe','-funsigned-char']+ARCH_FLAGS +CFLAGS = [] +CXXFLAGS = [] +CCFLAGS = ['-pipe','-funsigned-char'] -CPPFLAGS = []+ARCH_FLAGS -CCFLAGS = ['-pipe','-funsigned-char']+ARCH_FLAGS -CXXFLAGS = ['-pipe','-funsigned-char']+ARCH_FLAGS +CPPFLAGS = list(ARCH_FLAGS) if WITH_GHOST_COCOA: PLATFORM_LINKFLAGS = ['-fexceptions','-framework','CoreServices','-framework','Foundation','-framework','IOKit','-framework','AppKit','-framework','Cocoa','-framework','Carbon','-framework','AudioUnit','-framework','AudioToolbox','-framework','CoreAudio','-framework','OpenAL']+ARCH_FLAGS @@ -336,9 +336,8 @@ else: # some flags shuffling for different OS versions if MAC_MIN_VERS == '10.3': - CFLAGS = ['-fuse-cxa-atexit']+CFLAGS - CXXFLAGS = ['-fuse-cxa-atexit']+CXXFLAGS - PLATFORM_LINKFLAGS = ['-fuse-cxa-atexit']+PLATFORM_LINKFLAGS + CCFLAGS = ['-fuse-cxa-atexit'] + CFLAGS + PLATFORM_LINKFLAGS = ['-fuse-cxa-atexit'] + PLATFORM_LINKFLAGS LLIBS.append('crt3.o') if USE_SDK: @@ -349,19 +348,18 @@ if USE_SDK: #Intel Macs are CoreDuo and Up if MACOSX_ARCHITECTURE == 'i386' or MACOSX_ARCHITECTURE == 'x86_64': - REL_CFLAGS = ['-DNDEBUG', '-O2','-ftree-vectorize','-msse','-msse2','-msse3','-mfpmath=sse'] + REL_CFLAGS = [] + REL_CXXFLAGS = [] REL_CCFLAGS = ['-DNDEBUG', '-O2','-ftree-vectorize','-msse','-msse2','-msse3','-mfpmath=sse'] else: - CFLAGS = CFLAGS+['-fno-strict-aliasing'] - CCFLAGS = CCFLAGS+['-fno-strict-aliasing'] - CXXFLAGS = CXXFLAGS+['-fno-strict-aliasing'] - REL_CFLAGS = ['-DNDEBUG', '-O2'] + CCFLAGS += ['-fno-strict-aliasing'] + REL_CFLAGS = [] + REL_CXXFLAGS = [] REL_CCFLAGS = ['-DNDEBUG', '-O2'] # Intel 64bit Macs are Core2Duo and up if MACOSX_ARCHITECTURE == 'x86_64': - REL_CFLAGS = REL_CFLAGS+['-march=core2','-mssse3','-with-tune=core2','-enable-threads'] - REL_CCFLAGS = REL_CCFLAGS+['-march=core2','-mssse3','-with-tune=core2','-enable-threads'] + REL_CCFLAGS += ['-march=core2','-mssse3','-with-tune=core2','-enable-threads'] CC_WARN = ['-Wall'] C_WARN = ['-Wno-char-subscripts', '-Wpointer-arith', '-Wcast-align', '-Wdeclaration-after-statement', '-Wno-unknown-pragmas', '-Wstrict-prototypes'] diff --git a/build_files/scons/config/freebsd7-config.py b/build_files/scons/config/freebsd7-config.py index fec7531b3c7..eb7d7c9de57 100644 --- a/build_files/scons/config/freebsd7-config.py +++ b/build_files/scons/config/freebsd7-config.py @@ -172,11 +172,12 @@ BF_RAYOPTIMIZATION_SSE_FLAGS = ['-msse','-pthread'] CCFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing','-D_LARGEFILE_SOURCE','-D_FILE_OFFSET_BITS=64','-D_LARGEFILE64_SOURCE'] CPPFLAGS = [] -CXXFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing','-D_LARGEFILE_SOURCE','-D_FILE_OFFSET_BITS=64','-D_LARGEFILE64_SOURCE'] +CXXFLAGS = [] if WITH_BF_FFMPEG: # libavutil needs UINT64_C() CXXFLAGS += ['-D__STDC_CONSTANT_MACROS', ] -REL_CFLAGS = ['-DNDEBUG', '-O2'] +REL_CFLAGS = [] +REL_CXXFLAGS = [] REL_CCFLAGS = ['-DNDEBUG', '-O2'] ##BF_DEPEND = True ## diff --git a/build_files/scons/config/freebsd8-config.py b/build_files/scons/config/freebsd8-config.py index eea89bf24ff..451d22455e0 100644 --- a/build_files/scons/config/freebsd8-config.py +++ b/build_files/scons/config/freebsd8-config.py @@ -172,11 +172,12 @@ BF_RAYOPTIMIZATION_SSE_FLAGS = ['-msse','-pthread'] CCFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing','-D_LARGEFILE_SOURCE','-D_FILE_OFFSET_BITS=64','-D_LARGEFILE64_SOURCE'] CPPFLAGS = [] -CXXFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing','-D_LARGEFILE_SOURCE','-D_FILE_OFFSET_BITS=64','-D_LARGEFILE64_SOURCE'] +CXXFLAGS = [] if WITH_BF_FFMPEG: # libavutil needs UINT64_C() CXXFLAGS += ['-D__STDC_CONSTANT_MACROS', ] -REL_CFLAGS = ['-DNDEBUG', '-O2'] +REL_CFLAGS = [] +REL_CXXFLAGS = [] REL_CCFLAGS = ['-DNDEBUG', '-O2'] ##BF_DEPEND = True ## diff --git a/build_files/scons/config/freebsd9-config.py b/build_files/scons/config/freebsd9-config.py index a63da6e35f9..2ce6ec7ce33 100644 --- a/build_files/scons/config/freebsd9-config.py +++ b/build_files/scons/config/freebsd9-config.py @@ -170,13 +170,14 @@ WITH_BF_RAYOPTIMIZATION = True BF_RAYOPTIMIZATION_SSE_FLAGS = ['-msse','-pthread'] CCFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing','-D_LARGEFILE_SOURCE','-D_FILE_OFFSET_BITS=64','-D_LARGEFILE64_SOURCE'] +CXXFLAGS = [] CPPFLAGS = [] -CXXFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing','-D_LARGEFILE_SOURCE','-D_FILE_OFFSET_BITS=64','-D_LARGEFILE64_SOURCE'] if WITH_BF_FFMPEG: # libavutil needs UINT64_C() CXXFLAGS += ['-D__STDC_CONSTANT_MACROS', ] -REL_CFLAGS = ['-DNDEBUG', '-O2'] +REL_CFLAGS = [] +REL_CXXFLAGS = [] REL_CCFLAGS = ['-DNDEBUG', '-O2'] ##BF_DEPEND = True ## diff --git a/build_files/scons/config/irix6-config.py b/build_files/scons/config/irix6-config.py deleted file mode 100644 index e69de29bb2d..00000000000 --- a/build_files/scons/config/irix6-config.py +++ /dev/null diff --git a/build_files/scons/config/linux-config.py b/build_files/scons/config/linux-config.py index a26748cd8dc..91f86ae7e80 100644 --- a/build_files/scons/config/linux-config.py +++ b/build_files/scons/config/linux-config.py @@ -97,7 +97,6 @@ BF_BULLET_LIB = 'extern_bullet' BF_FREETYPE = '/usr' BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2' BF_FREETYPE_LIB = 'freetype' -#WITH_BF_FREETYPE_STATIC = True #BF_FREETYPE_LIB_STATIC = '${BF_FREETYPE}/lib/libfreetype.a' WITH_BF_QUICKTIME = False # -DWITH_QUICKTIME @@ -200,15 +199,16 @@ CXX = 'g++' ## CFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing -mieee CCFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing','-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64','-D_LARGEFILE64_SOURCE'] +CXXFLAGS = [] CPPFLAGS = [] -CXXFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing','-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64','-D_LARGEFILE64_SOURCE'] # g++ 4.6, only needed for bullet CXXFLAGS += ['-fpermissive'] if WITH_BF_FFMPEG: # libavutil needs UINT64_C() CXXFLAGS += ['-D__STDC_CONSTANT_MACROS', ] -REL_CFLAGS = ['-DNDEBUG', '-O2'] +REL_CFLAGS = [] +REL_CXXFLAGS = [] REL_CCFLAGS = ['-DNDEBUG', '-O2'] ##BF_DEPEND = True ## diff --git a/build_files/scons/config/linuxcross-config.py b/build_files/scons/config/linuxcross-config.py index 070e18a5af0..f6f72cd32d5 100644 --- a/build_files/scons/config/linuxcross-config.py +++ b/build_files/scons/config/linuxcross-config.py @@ -170,10 +170,11 @@ WITH_BF_RAYOPTIMIZATION = True BF_RAYOPTIMIZATION_SSE_FLAGS = ['-msse'] CCFLAGS = [ '-pipe', '-funsigned-char', '-fno-strict-aliasing' ] +CXXFLAGS = [] CPPFLAGS = ['-DWIN32', '-DFREE_WINDOWS', '-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64', '-D_LARGEFILE64_SOURCE'] -CXXFLAGS = ['-pipe', '-funsigned-char', '-fno-strict-aliasing' ] -REL_CFLAGS = ['-DNDEBUG', '-O2'] +REL_CFLAGS = [] +REL_CXXFLAGS = [] REL_CCFLAGS = ['-DNDEBUG', '-O2'] C_WARN = ['-Wall', '-Wstrict-prototypes', '-Wno-char-subscripts', '-Wdeclaration-after-statement'] diff --git a/build_files/scons/config/openbsd3-config.py b/build_files/scons/config/openbsd3-config.py deleted file mode 100644 index 83c515d52f3..00000000000 --- a/build_files/scons/config/openbsd3-config.py +++ /dev/null @@ -1,148 +0,0 @@ -LCGDIR = '../lib/openbsd3' -LIBDIR = '${LCGDIR}' - -BF_PYTHON = '/usr/local' -BF_PYTHON_VERSION = '3.2' -BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}' -BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}' -BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION}' -BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib/python${BF_PYTHON_VERSION}/config' - -WITH_BF_OPENAL = False -# WITH_BF_STATICOPENAL = False -#BF_OPENAL = LIBDIR + '/openal' -#BF_OPENAL_INC = '${BF_OPENAL}/include' -#BF_OPENAL_LIB = 'openal' -#BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib' -#BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a' - -WITH_BF_SDL = True -BF_SDL = '/usr/local' #$(shell sdl-config --prefix) -BF_SDL_INC = '${BF_SDL}/include/SDL' #$(shell $(BF_SDL)/bin/sdl-config --cflags) -BF_SDL_LIB = 'SDL' #BF_SDL #$(shell $(BF_SDL)/bin/sdl-config --libs) -lSDL_mixer -BF_SDL_LIBPATH = '${BF_SDL}/lib' - -WITH_BF_OPENEXR = False -WITH_BF_STATICOPENEXR = False -BF_OPENEXR = '/usr/local' -BF_OPENEXR_INC = '${BF_OPENEXR}/include/OpenEXR' -BF_OPENEXR_LIB = 'Half IlmImf Iex Imath ' -# Warning, this static lib configuration is untested! users of this OS please confirm. -BF_OPENEXR_LIB_STATIC = '${BF_OPENEXR}/lib/libHalf.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_OPENEXR}/lib/libIex.a ${BF_OPENEXR}/lib/libImath.a ${BF_OPENEXR}/lib/libIlmThread.a' - -WITH_BF_DDS = True - -WITH_BF_JPEG = True -BF_JPEG = '/usr/local' -BF_JPEG_INC = '${BF_JPEG}/include' -BF_JPEG_LIB = 'jpeg' -BF_JPEG_LIBPATH = '${BF_JPEG}/lib' - -WITH_BF_PNG = True -BF_PNG = '/usr/local' -BF_PNG_INC = '${BF_PNG}/include/libpng' -BF_PNG_LIB = 'png' -BF_PNG_LIBPATH = '${BF_PNG}/lib' - -BF_TIFF = '/usr/local' -BF_TIFF_INC = '${BF_TIFF}/include' - -WITH_BF_ZLIB = True -BF_ZLIB = '/usr/local' -BF_ZLIB_INC = '${BF_ZLIB}/include' -BF_ZLIB_LIB = 'z' - -WITH_BF_INTERNATIONAL = True - -BF_GETTEXT = '/usr/local' -BF_GETTEXT_INC = '${BF_GETTEXT}/include' -BF_GETTEXT_LIB = 'intl iconv' -BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib' - -WITH_BF_GAMEENGINE=False -WITH_BF_PLAYER = False - -WITH_BF_BULLET = True -BF_BULLET = '#extern/bullet2/src' -BF_BULLET_INC = '${BF_BULLET}' -BF_BULLET_LIB = 'extern_bullet' - -#WITH_BF_NSPR = True -#BF_NSPR = $(LIBDIR)/nspr -#BF_NSPR_INC = -I$(BF_NSPR)/include -I$(BF_NSPR)/include/nspr -#BF_NSPR_LIB = - -# Uncomment the following line to use Mozilla inplace of netscape -#CPPFLAGS += -DMOZ_NOT_NET -# Location of MOZILLA/Netscape header files... -#BF_MOZILLA = $(LIBDIR)/mozilla -#BF_MOZILLA_INC = -I$(BF_MOZILLA)/include/mozilla/nspr -I$(BF_MOZILLA)/include/mozilla -I$(BF_MOZILLA)/include/mozilla/xpcom -I$(BF_MOZILLA)/include/mozilla/idl -#BF_MOZILLA_LIB = -# Will fall back to look in BF_MOZILLA_INC/nspr and BF_MOZILLA_LIB -# if this is not set. -# -# Be paranoid regarding library creation (do not update archives) -#BF_PARANOID = True - -# enable freetype2 support for text objects -BF_FREETYPE = '/usr/X11R6' -BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2' -BF_FREETYPE_LIB = 'freetype' -BF_FREETYPE_LIBPATH = '${BF_FREETYPE}/lib' - -WITH_BF_QUICKTIME = False # -DWITH_QUICKTIME - -WITH_BF_ICONV = False -BF_ICONV = LIBDIR + "/iconv" -BF_ICONV_INC = '${BF_ICONV}/include' -BF_ICONV_LIB = 'iconv' -BF_ICONV_LIBPATH = '${BF_ICONV}/lib' - -# Mesa Libs should go here if your using them as well.... -WITH_BF_STATICOPENGL = True -BF_OPENGL = '/usr/X11R6' -BF_OPENGL_INC = '${BF_OPENGL}/include' -BF_OPENGL_LIB = 'GL GLU X11 Xi' -BF_OPENGL_LIBPATH = '${BF_OPENGL}/lib' -BF_OPENGL_LIB_STATIC = '${BF_OPENGL_LIBPATH}/libGL.a ${BF_OPENGL_LIBPATH}/libGLU.a ${BF_OPENGL_LIBPATH}/libXxf86vm.a ${BF_OPENGL_LIBPATH}/libX11.a ${BF_OPENGL_LIBPATH}/libXi.a ${BF_OPENGL_LIBPATH}/libXext.a ${BF_OPENGL_LIBPATH}/libXxf86vm.a' - -## -##CC = gcc -##CCC = g++ -##ifeq ($CPU),alpha) -## CFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing -mieee - -CFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing'] - -CPPFLAGS = [] -CCFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing'] -CXXFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing'] -REL_CFLAGS = ['-DNDEBUG', '-O2'] -REL_CCFLAGS = ['-DNDEBUG', '-O2'] -##BF_DEPEND = True -## -##AR = ar -##ARFLAGS = ruv -##ARFLAGSQUIET = ru -## -CC = 'gcc' -CXX = 'g++' -C_WARN = ['-Wdeclaration-after-statement', '-Wstrict-prototypes'] - -CC_WARN = ['-Wall'] - -##FIX_STUBS_WARNINGS = -Wno-unused - -LLIBS = ['m', 'stdc++', 'pthread', 'util'] -##LOPTS = --dynamic -##DYNLDFLAGS = -shared $(LDFLAGS) - -BF_PROFILE = False -BF_PROFILE_CCFLAGS = ['-pg','-g'] -BF_PROFILE_LINKFLAGS = ['-pg'] - -BF_DEBUG = False -BF_DEBUG_CCFLAGS = ['-g', '-D_DEBUG'] - -BF_BUILDDIR='../build/openbsd3' -BF_INSTALLDIR='../install/openbsd3' diff --git a/build_files/scons/config/sunos5-config.py b/build_files/scons/config/sunos5-config.py deleted file mode 100644 index 0cf78c9220f..00000000000 --- a/build_files/scons/config/sunos5-config.py +++ /dev/null @@ -1,165 +0,0 @@ -LCGDIR = '../lib/sunos5' -LIBDIR = '${LCGDIR}' - -BF_PYTHON = '/usr/local' -BF_PYTHON_VERSION = '3.2' -BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}' -BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}' -BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION}' #BF_PYTHON+'/lib/python'+BF_PYTHON_VERSION+'/config/libpython'+BF_PYTHON_VERSION+'.a' -BF_PYTHON_LINKFLAGS = ['-Xlinker', '-export-dynamic'] - -WITH_BF_OPENAL = True -WITH_BF_STATICOPENAL = False -BF_OPENAL = '/usr/local' -BF_OPENAL_INC = '${BF_OPENAL}/include' -BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib' -BF_OPENAL_LIB = 'openal' -# Warning, this static lib configuration is untested! users of this OS please confirm. -BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a' - -# Warning, this static lib configuration is untested! users of this OS please confirm. -BF_CXX = '/usr' -WITH_BF_STATICCXX = False -BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a' - -WITH_BF_SDL = True -BF_SDL = '/usr/local' #$(shell sdl-config --prefix) -BF_SDL_INC = '${BF_SDL}/include/SDL' #$(shell $(BF_SDL)/bin/sdl-config --cflags) -BF_SDL_LIBPATH = '${BF_SDL}/lib' -BF_SDL_LIB = 'SDL' #BF_SDL #$(shell $(BF_SDL)/bin/sdl-config --libs) -lSDL_mixer - -WITH_BF_OPENEXR = True -WITH_BF_STATICOPENEXR = False -BF_OPENEXR = '/usr/local' -BF_OPENEXR_INC = ['${BF_OPENEXR}/include', '${BF_OPENEXR}/include/OpenEXR' ] -BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib' -BF_OPENEXR_LIB = 'Half IlmImf Iex Imath ' -# Warning, this static lib configuration is untested! users of this OS please confirm. -BF_OPENEXR_LIB_STATIC = '${BF_OPENEXR}/lib/libHalf.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_OPENEXR}/lib/libIex.a ${BF_OPENEXR}/lib/libImath.a ${BF_OPENEXR}/lib/libIlmThread.a' - -WITH_BF_DDS = True - -WITH_BF_JPEG = True -BF_JPEG = '/usr/local' -BF_JPEG_INC = '${BF_JPEG}/include' -BF_JPEG_LIBPATH = '${BF_JPEG}/lib' -BF_JPEG_LIB = 'jpeg' - -WITH_BF_PNG = True -BF_PNG = '/usr/local' -BF_PNG_INC = '${BF_PNG}/include' -BF_PNG_LIBPATH = '${BF_PNG}/lib' -BF_PNG_LIB = 'png' - -BF_TIFF = '/usr/local' -BF_TIFF_INC = '${BF_TIFF}/include' - -WITH_BF_ZLIB = True -BF_ZLIB = '/usr' -BF_ZLIB_INC = '${BF_ZLIB}/include' -BF_ZLIB_LIBPATH = '${BF_ZLIB}/lib' -BF_ZLIB_LIB = 'z' - -WITH_BF_INTERNATIONAL = True - -BF_GETTEXT = '/usr/local' -BF_GETTEXT_INC = '${BF_GETTEXT}/include' -BF_GETTEXT_LIB = 'gettextlib' -BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib' - -WITH_BF_GAMEENGINE=False -WITH_BF_PLAYER = False - -WITH_BF_BULLET = True -BF_BULLET = '#extern/bullet2/src' -BF_BULLET_INC = '${BF_BULLET}' -BF_BULLET_LIB = 'extern_bullet' - -#WITH_BF_NSPR = True -#BF_NSPR = $(LIBDIR)/nspr -#BF_NSPR_INC = -I$(BF_NSPR)/include -I$(BF_NSPR)/include/nspr -#BF_NSPR_LIB = - -# Uncomment the following line to use Mozilla inplace of netscape -#CPPFLAGS += -DMOZ_NOT_NET -# Location of MOZILLA/Netscape header files... -#BF_MOZILLA = $(LIBDIR)/mozilla -#BF_MOZILLA_INC = -I$(BF_MOZILLA)/include/mozilla/nspr -I$(BF_MOZILLA)/include/mozilla -I$(BF_MOZILLA)/include/mozilla/xpcom -I$(BF_MOZILLA)/include/mozilla/idl -#BF_MOZILLA_LIB = -# Will fall back to look in BF_MOZILLA_INC/nspr and BF_MOZILLA_LIB -# if this is not set. -# -# Be paranoid regarding library creation (do not update archives) -#BF_PARANOID = True - -# enable freetype2 support for text objects -BF_FREETYPE = '/usr/local' -BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2' -BF_FREETYPE_LIBPATH = '${BF_FREETYPE}/lib' -BF_FREETYPE_LIB = 'freetype' - -WITH_BF_QUICKTIME = False # -DWITH_QUICKTIME -BF_QUICKTIME = '/usr/local' -BF_QUICKTIME_INC = '${BF_QUICKTIME}/include' - -WITH_BF_ICONV = True -BF_ICONV = "/usr" -BF_ICONV_INC = '${BF_ICONV}/include' -BF_ICONV_LIB = 'iconv' -BF_ICONV_LIBPATH = '${BF_ICONV}/lib' - -# enable ffmpeg support -WITH_BF_FFMPEG = True # -DWITH_FFMPEG -BF_FFMPEG = '/usr/local' -BF_FFMPEG_INC = '${BF_FFMPEG}/include' -BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib' -BF_FFMPEG_LIB = 'avformat avcodec avutil avdevice' - -# Mesa Libs should go here if your using them as well.... -WITH_BF_STATICOPENGL = False -BF_OPENGL = '/usr/openwin' -BF_OPENGL_INC = '${BF_OPENGL}/include' -BF_OPENGL_LIB = 'GL GLU X11 Xi' -BF_OPENGL_LIBPATH = '${BF_OPENGL}/lib' -BF_OPENGL_LIB_STATIC = '${BF_OPENGL_LIBPATH}/libGL.a ${BF_OPENGL_LIBPATH}/libGLU.a ${BF_OPENGL_LIBPATH}/libXxf86vm.a ${BF_OPENGL_LIBPATH}/libX11.a ${BF_OPENGL_LIBPATH}/libXi.a ${BF_OPENGL_LIBPATH}/libXext.a ${BF_OPENGL_LIBPATH}/libXxf86vm.a' - -## -CC = 'gcc' -CXX = 'g++' -##ifeq ($CPU),alpha) -## CFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing -mieee - -CCFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing'] - -CPPFLAGS = ['-DSUN_OGL_NO_VERTEX_MACROS'] -CXXFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing'] -REL_CFLAGS = ['-DNDEBUG', '-O2'] -REL_CCFLAGS = ['-DNDEBUG', '-O2'] -##BF_DEPEND = True -## -##AR = ar -##ARFLAGS = ruv -##ARFLAGSQUIET = ru -## -C_WARN = ['-Wno-char-subscripts', '-Wdeclaration-after-statement'] - -CC_WARN = ['-Wall'] - -##FIX_STUBS_WARNINGS = -Wno-unused - -LLIBS = ['c', 'm', 'dl', 'pthread', 'stdc++'] -##LOPTS = --dynamic -##DYNLDFLAGS = -shared $(LDFLAGS) - -BF_PROFILE_CCFLAGS = ['-pg', '-g '] -BF_PROFILE_LINKFLAGS = ['-pg'] -BF_PROFILE = False - -BF_DEBUG = False -BF_DEBUG_CCFLAGS = ['-D_DEBUG'] - -BF_BUILDDIR = '../build/sunos5' -BF_INSTALLDIR='../install/sunos5' - - -PLATFORM_LINKFLAGS = [] diff --git a/build_files/scons/config/win32-mingw-config.py b/build_files/scons/config/win32-mingw-config.py index 167ed502bf6..f210ab436b5 100644 --- a/build_files/scons/config/win32-mingw-config.py +++ b/build_files/scons/config/win32-mingw-config.py @@ -159,10 +159,11 @@ CC = 'gcc' CXX = 'g++' CCFLAGS = [ '-pipe', '-funsigned-char', '-fno-strict-aliasing' ] +CXXFLAGS = [] CPPFLAGS = ['-DWIN32', '-DFREE_WINDOWS', '-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64', '-D_LARGEFILE64_SOURCE'] -CXXFLAGS = ['-pipe', '-funsigned-char', '-fno-strict-aliasing' ] -REL_CFLAGS = ['-DNDEBUG', '-O2'] +REL_CFLAGS = [] +REL_CXXFLAGS = [] REL_CCFLAGS = ['-DNDEBUG', '-O2'] C_WARN = ['-Wno-char-subscripts', '-Wdeclaration-after-statement', '-Wstrict-prototypes'] diff --git a/build_files/scons/config/win32-vc-config.py b/build_files/scons/config/win32-vc-config.py index 9604eb5d320..ec37b3046c8 100644 --- a/build_files/scons/config/win32-vc-config.py +++ b/build_files/scons/config/win32-vc-config.py @@ -171,9 +171,9 @@ BGE_CXXFLAGS = ['/O2', '/EHsc', '/GR', '/fp:fast', '/arch:SSE'] BF_DEBUG_CCFLAGS = ['/Zi', '/FR${TARGET}.sbr'] CPPFLAGS = ['-DWIN32','-D_CONSOLE', '-D_LIB', '-D_CRT_SECURE_NO_DEPRECATE'] -REL_CFLAGS = ['-O2', '-DNDEBUG'] +REL_CFLAGS = [] +REL_CXXFLAGS = [] REL_CCFLAGS = ['-O2', '-DNDEBUG'] -REL_CXXFLAGS = ['-O2', '-DNDEBUG'] C_WARN = [] CC_WARN = [] diff --git a/build_files/scons/config/win64-vc-config.py b/build_files/scons/config/win64-vc-config.py index 049b7eb5d40..afa64e03e80 100644 --- a/build_files/scons/config/win64-vc-config.py +++ b/build_files/scons/config/win64-vc-config.py @@ -175,9 +175,9 @@ BGE_CXXFLAGS = ['/O2', '/EHsc', '/GR', '/fp:fast'] BF_DEBUG_CCFLAGS = ['/Zi', '/FR${TARGET}.sbr', '/Od'] CPPFLAGS = ['-DWIN32', '-D_CONSOLE', '-D_LIB', '-D_CRT_SECURE_NO_DEPRECATE'] -REL_CFLAGS = ['-O2', '-DNDEBUG'] +REL_CFLAGS = [] +REL_CXXFLAGS = [] REL_CCFLAGS = ['-O2', '-DNDEBUG'] -REL_CXXFLAGS = ['-O2', '-DNDEBUG'] C_WARN = [] CC_WARN = [] diff --git a/build_files/scons/tools/Blender.py b/build_files/scons/tools/Blender.py index c802eee4fb6..875d8f7388b 100644 --- a/build_files/scons/tools/Blender.py +++ b/build_files/scons/tools/Blender.py @@ -561,9 +561,9 @@ def AppIt(target=None, source=None, env=None): if binary == 'blender': cmd = 'mkdir %s/%s.app/Contents/MacOS/%s/datafiles'%(installdir, binary, VERSION) commands.getoutput(cmd) - cmd = 'cp -R %s/release/bin/.blender/locale %s/%s.app/Contents/MacOS/%s/datafiles/'%(bldroot,installdir,binary,VERSION) + cmd = 'cp -R %s/release/datafiles/locale %s/%s.app/Contents/MacOS/%s/datafiles/'%(bldroot,installdir,binary,VERSION) commands.getoutput(cmd) - cmd = 'cp -R %s/release/bin/.blender/fonts %s/%s.app/Contents/MacOS/%s/datafiles/'%(bldroot,installdir,binary,VERSION) + cmd = 'cp -R %s/release/datafiles/fonts %s/%s.app/Contents/MacOS/%s/datafiles/'%(bldroot,installdir,binary,VERSION) commands.getoutput(cmd) cmd = 'cp -R %s/release/scripts %s/%s.app/Contents/MacOS/%s/'%(bldroot,installdir,binary,VERSION) commands.getoutput(cmd) diff --git a/build_files/scons/tools/btools.py b/build_files/scons/tools/btools.py index fe56d40ea56..49efa598ed8 100644 --- a/build_files/scons/tools/btools.py +++ b/build_files/scons/tools/btools.py @@ -118,7 +118,7 @@ def validate_arguments(args, bc): 'WITH_BF_ICONV', 'BF_ICONV', 'BF_ICONV_INC', 'BF_ICONV_LIB', 'BF_ICONV_LIBPATH', 'WITH_BF_GAMEENGINE', 'WITH_BF_BULLET', 'WITH_BF_ELTOPO', 'BF_BULLET', 'BF_BULLET_INC', 'BF_BULLET_LIB', 'BF_WINTAB', 'BF_WINTAB_INC', - 'WITH_BF_FREETYPE', 'BF_FREETYPE', 'BF_FREETYPE_INC', 'BF_FREETYPE_LIB', 'BF_FREETYPE_LIBPATH', 'BF_FREETYPE_LIB_STATIC', 'WITH_BF_FREETYPE_STATIC', + 'BF_FREETYPE', 'BF_FREETYPE_INC', 'BF_FREETYPE_LIB', 'BF_FREETYPE_LIBPATH', 'BF_FREETYPE_LIB_STATIC', 'WITH_BF_FREETYPE_STATIC', 'WITH_BF_QUICKTIME', 'BF_QUICKTIME', 'BF_QUICKTIME_INC', 'BF_QUICKTIME_LIB', 'BF_QUICKTIME_LIBPATH', 'WITH_BF_FFTW3', 'BF_FFTW3', 'BF_FFTW3_INC', 'BF_FFTW3_LIB', 'BF_FFTW3_LIBPATH', 'WITH_BF_STATICFFTW3', 'BF_FFTW3_LIB_STATIC', 'WITH_BF_STATICOPENGL', 'BF_OPENGL', 'BF_OPENGL_INC', 'BF_OPENGL_LIB', 'BF_OPENGL_LIBPATH', 'BF_OPENGL_LIB_STATIC', @@ -385,7 +385,6 @@ def read_opts(env, cfg, args): (BoolVariable('WITH_BF_STATICCXX', 'static link to stdc++', False)), ('BF_CXX_LIB_STATIC', 'static library path for stdc++', ''), - (BoolVariable('WITH_BF_FREETYPE', 'Use FreeType2 if true', True)), ('BF_FREETYPE', 'Freetype base path', ''), ('BF_FREETYPE_INC', 'Freetype include path', ''), ('BF_FREETYPE_LIB', 'Freetype library', ''), diff --git a/intern/ghost/GHOST_Types.h b/intern/ghost/GHOST_Types.h index 78fc3f69c7a..2b5e96a1bf7 100644 --- a/intern/ghost/GHOST_Types.h +++ b/intern/ghost/GHOST_Types.h @@ -466,8 +466,19 @@ typedef struct { typedef struct { /** The key code. */ GHOST_TKey key; + + /* ascii / utf8: both should always be set when possible, + * - ascii may be '\0' however if the user presses a non ascii key + * - unicode may not be set if the system has no unicode support + * + * These values are intended to be used as follows. + * For text input use unicode when available, fallback to ascii. + * For areas where unicode is not needed, number input for example, always + * use ascii, unicode is ignored - campbell. + */ /** The ascii code for the key event ('\0' if none). */ char ascii; + /** The unicode character. if the length is 6, not NULL terminated if all 6 are set */ char utf8_buf[6]; } GHOST_TEventKeyData; diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm index 1dfb8e36422..1a6aaadb506 100644 --- a/intern/ghost/intern/GHOST_SystemCocoa.mm +++ b/intern/ghost/intern/GHOST_SystemCocoa.mm @@ -1706,7 +1706,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleKeyEvent(void *eventPtr) utf8_buf[0] = '\0'; } } - + if ((keyCode == GHOST_kKeyQ) && (m_modifierMask & NSCommandKeyMask)) break; //Cmd-Q is directly handled by Cocoa @@ -1714,8 +1714,10 @@ GHOST_TSuccess GHOST_SystemCocoa::handleKeyEvent(void *eventPtr) pushEvent( new GHOST_EventKey([event timestamp]*1000, GHOST_kEventKeyDown, window, keyCode, ascii, utf8_buf) ); //printf("Key down rawCode=0x%x charsIgnoringModifiers=%c keyCode=%u ascii=%i %c utf8=%s\n",[event keyCode],[charsIgnoringModifiers length]>0?[charsIgnoringModifiers characterAtIndex:0]:' ',keyCode,ascii,ascii, utf8_buf); } else { + // XXX Font Object bug - backspace or adding new chars are being computed twice (keydown and keyup) + utf8_buf[0] = '\0'; pushEvent( new GHOST_EventKey([event timestamp]*1000, GHOST_kEventKeyUp, window, keyCode, ascii, utf8_buf) ); - //printf("Key down rawCode=0x%x charsIgnoringModifiers=%c keyCode=%u ascii=%i %c utf8=%s\n",[event keyCode],[charsIgnoringModifiers length]>0?[charsIgnoringModifiers characterAtIndex:0]:' ',keyCode,ascii,ascii, utf8_buf); + //printf("Key up rawCode=0x%x charsIgnoringModifiers=%c keyCode=%u ascii=%i %c utf8=%s\n",[event keyCode],[charsIgnoringModifiers length]>0?[charsIgnoringModifiers characterAtIndex:0]:' ',keyCode,ascii,ascii, utf8_buf); } break; diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp index 24b6474732e..99ce81165ad 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.cpp +++ b/intern/ghost/intern/GHOST_SystemWin32.cpp @@ -712,21 +712,21 @@ GHOST_EventKey* GHOST_SystemWin32::processKeyEvent(GHOST_IWindow *window, RAWINP GHOST_SystemWin32 * system = (GHOST_SystemWin32 *)getSystem(); GHOST_TKey key = system->hardKey(window, raw, &keyDown, &vk); GHOST_EventKey* event; + if (key != GHOST_kKeyUnknown) { - char ascii = '\0'; + char utf8_char[6] = {0} ; - unsigned short utf16[2]={0}; + wchar_t utf16[2]={0}; BYTE state[256]; - GetKeyboardState((PBYTE)state); + GetKeyboardState((PBYTE)state); - if(ToAsciiEx(vk, 0, state, utf16, 0, system->m_keylayout)) - WideCharToMultiByte(CP_ACP, 0x00000400, + if(ToUnicodeEx(vk, 0, state, utf16, 2, 0, system->m_keylayout)) + WideCharToMultiByte(CP_UTF8, 0, (wchar_t*)utf16, 1, - (LPSTR) &ascii, 1, - NULL,NULL); - - /* TODO, last arg is utf8, need to pass utf8 arg */ - event = new GHOST_EventKey(system->getMilliSeconds(), keyDown ? GHOST_kEventKeyDown: GHOST_kEventKeyUp, window, key, ascii, NULL); + (LPSTR) utf8_char, 5, + NULL,NULL); else *utf8_char = 0; + + event = new GHOST_EventKey(system->getMilliSeconds(), keyDown ? GHOST_kEventKeyDown: GHOST_kEventKeyUp, window, key, (*utf8_char & 0x80)?'?':*utf8_char, utf8_char); #ifdef GHOST_DEBUG std::cout << ascii << std::endl; diff --git a/po/README.txt b/po/README.txt index cadcb7194e8..6e634ae5ee3 100644 --- a/po/README.txt +++ b/po/README.txt @@ -16,7 +16,7 @@ This means when string "some message id" is used as operator name, tooltip, menu and so it'll be displayed on the screen as "translation for this message". Pretty simple. -This source files are pre-compiled into ../release/bin/.blender/locale/<language>/LC_MESSAGES/blender.mo, +This source files are pre-compiled into ../release/datafiles/locale/<language>/LC_MESSAGES/blender.mo, so they aren't getting compiled every time Blender is compiling to save some time and prevent failure on systems which don't have needed tools for compiling .po files. diff --git a/po/update_mo.py b/po/update_mo.py index 33b7baaed69..a0173b2d059 100755 --- a/po/update_mo.py +++ b/po/update_mo.py @@ -30,7 +30,7 @@ import sys GETTEXT_MSGFMT_EXECUTABLE = "msgfmt" CURRENT_DIR = os.path.abspath(os.path.dirname(__file__)) SOURCE_DIR = os.path.normpath(os.path.abspath(os.path.join(CURRENT_DIR, ".."))) -LOCALE_DIR = os.path.join(SOURCE_DIR, "release", "bin", ".blender", "locale") +LOCALE_DIR = os.path.join(SOURCE_DIR, "release", "datafiles", "locale") DOMAIN = "blender" diff --git a/release/bin/.blender/.bfont.ttf b/release/bin/.blender/.bfont.ttf Binary files differdeleted file mode 100644 index 58cd6b5e61e..00000000000 --- a/release/bin/.blender/.bfont.ttf +++ /dev/null diff --git a/release/bin/.blender/fonts/droidsans.ttf.gz b/release/datafiles/fonts/droidsans.ttf.gz Binary files differindex a00f35f3a66..a00f35f3a66 100644 --- a/release/bin/.blender/fonts/droidsans.ttf.gz +++ b/release/datafiles/fonts/droidsans.ttf.gz diff --git a/source/blender/blenfont/BLF_translation.h b/source/blender/blenfont/BLF_translation.h index 1c36f3e1504..707cd17e0b3 100644 --- a/source/blender/blenfont/BLF_translation.h +++ b/source/blender/blenfont/BLF_translation.h @@ -60,7 +60,8 @@ void BLF_lang_encoding_name(const char *str); void BLF_lang_encoding(const char *str); -#define _(msgid) BLF_gettext(msgid) +/*#define _(msgid) BLF_gettext(msgid)*/ +/* The "translation-marker" macro. */ #define N_(msgid) msgid #endif /* BLF_TRANSLATION_H */ diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c index 5161761cf09..355182fb85f 100644 --- a/source/blender/blenfont/intern/blf_font.c +++ b/source/blender/blenfont/intern/blf_font.c @@ -129,7 +129,7 @@ static void blf_font_ensure_ascii_table(FontBLF *font) g= (glyph_ascii_table)[c]; \ i++; \ } \ - else if ((c= blf_utf8_next((unsigned char *)(str), &(i)))) { \ + else if ((c= BLI_str_utf8_as_unicode_step((str), &(i))) != BLI_UTF8_ERR) { \ if ((g= blf_glyph_search((font)->glyph_cache, c)) == NULL) { \ g= blf_glyph_add(font, FT_Get_Char_Index((font)->face, c), c); \ } \ @@ -141,15 +141,20 @@ static void blf_font_ensure_ascii_table(FontBLF *font) const FT_UInt kern_mode= (has_kerning == 0) ? 0 : \ (((_font)->flags & BLF_KERNING_DEFAULT) ? \ ft_kerning_default : FT_KERNING_UNFITTED) \ - \ #define BLF_KERNING_STEP(_font, kern_mode, g_prev, g, delta, pen_x) \ { \ if (g_prev) { \ delta.x= delta.y= 0; \ - if (FT_Get_Kerning((_font)->face, g_prev->idx, g->idx, kern_mode, &delta) == 0) \ + if (FT_Get_Kerning((_font)->face, \ + (g_prev)->idx, \ + (g)->idx, \ + kern_mode, \ + &(delta)) == 0) \ + { \ pen_x += delta.x >> 6; \ + } \ } \ } \ @@ -159,7 +164,7 @@ void blf_font_draw(FontBLF *font, const char *str, unsigned int len) GlyphBLF *g, *g_prev= NULL; FT_Vector delta; int pen_x= 0, pen_y= 0; - unsigned int i= 0; + size_t i= 0; GlyphBLF **glyph_ascii_table= font->glyph_cache->glyph_ascii_table; BLF_KERNING_VARS(font, has_kerning, kern_mode); @@ -170,9 +175,9 @@ void blf_font_draw(FontBLF *font, const char *str, unsigned int len) BLF_UTF8_NEXT_FAST(font, g, str, i, c, glyph_ascii_table); - if (c == 0) break; - if (g == NULL) continue; - if (has_kerning) BLF_KERNING_STEP(font, kern_mode, g_prev, g, delta, pen_x); + if (c == BLI_UTF8_ERR) break; + if (g == NULL) continue; + if (has_kerning) BLF_KERNING_STEP(font, kern_mode, g_prev, g, delta, pen_x); /* do not return this loop if clipped, we want every character tested */ blf_glyph_render(font, g, (float)pen_x, (float)pen_y); @@ -214,7 +219,7 @@ void blf_font_buffer(FontBLF *font, const char *str) GlyphBLF *g, *g_prev= NULL; FT_Vector delta; int pen_x= (int)font->pos[0], pen_y= 0; - unsigned int i= 0; + size_t i= 0; GlyphBLF **glyph_ascii_table= font->glyph_cache->glyph_ascii_table; /* buffer specific vars*/ @@ -235,9 +240,9 @@ void blf_font_buffer(FontBLF *font, const char *str) BLF_UTF8_NEXT_FAST(font, g, str, i, c, glyph_ascii_table); - if (c == 0) break; - if (g == NULL) continue; - if (has_kerning) BLF_KERNING_STEP(font, kern_mode, g_prev, g, delta, pen_x); + if (c == BLI_UTF8_ERR) break; + if (g == NULL) continue; + if (has_kerning) BLF_KERNING_STEP(font, kern_mode, g_prev, g, delta, pen_x); chx= pen_x + ((int)g->pos_x); chy= (int)font->pos[1] + g->height; @@ -340,7 +345,7 @@ void blf_font_boundbox(FontBLF *font, const char *str, rctf *box) GlyphBLF *g, *g_prev= NULL; FT_Vector delta; int pen_x= 0, pen_y= 0; - unsigned int i= 0; + size_t i= 0; GlyphBLF **glyph_ascii_table= font->glyph_cache->glyph_ascii_table; rctf gbox; @@ -358,9 +363,9 @@ void blf_font_boundbox(FontBLF *font, const char *str, rctf *box) BLF_UTF8_NEXT_FAST(font, g, str, i, c, glyph_ascii_table); - if (c == 0) break; - if (g == NULL) continue; - if (has_kerning) BLF_KERNING_STEP(font, kern_mode, g_prev, g, delta, pen_x); + if (c == BLI_UTF8_ERR) break; + if (g == NULL) continue; + if (has_kerning) BLF_KERNING_STEP(font, kern_mode, g_prev, g, delta, pen_x); gbox.xmin= pen_x; gbox.xmax= pen_x + g->advance; diff --git a/source/blender/blenfont/intern/blf_internal.h b/source/blender/blenfont/intern/blf_internal.h index ba0b9985dd4..df88d0c8fea 100644 --- a/source/blender/blenfont/intern/blf_internal.h +++ b/source/blender/blenfont/intern/blf_internal.h @@ -40,7 +40,6 @@ struct rctf; unsigned int blf_next_p2(unsigned int x); unsigned int blf_hash(unsigned int val); -int blf_utf8_next(unsigned char *buf, unsigned int *iindex); char *blf_dir_search(const char *file); char *blf_dir_metrics_search(const char *filename); diff --git a/source/blender/blenfont/intern/blf_lang.c b/source/blender/blenfont/intern/blf_lang.c index ec9501c06a6..87fbbc7b3e5 100644 --- a/source/blender/blenfont/intern/blf_lang.c +++ b/source/blender/blenfont/intern/blf_lang.c @@ -55,6 +55,7 @@ #include "BLI_linklist.h" /* linknode */ #include "BLI_string.h" +#include "BLI_utildefines.h" #include "BLI_path_util.h" #define DOMAIN_NAME "blender" @@ -103,10 +104,13 @@ void BLF_lang_init(void) BLI_strncpy(global_encoding_name, SYSTEM_ENCODING_DEFAULT, sizeof(global_encoding_name)); - if (messagepath) + if (messagepath) { BLI_strncpy(global_messagepath, messagepath, sizeof(global_messagepath)); - else + } + else { + printf("%s: 'locale' data path for translations not found, continuing\n", __func__); global_messagepath[0]= '\0'; + } } diff --git a/source/blender/blenfont/intern/blf_translation.c b/source/blender/blenfont/intern/blf_translation.c index 8c0a26df4c2..90d9c4a5981 100644 --- a/source/blender/blenfont/intern/blf_translation.c +++ b/source/blender/blenfont/intern/blf_translation.c @@ -38,6 +38,7 @@ #include "MEM_guardedalloc.h" +#include "BLI_utildefines.h" #include "BLI_path_util.h" #include "BLI_string.h" #include "BLI_path_util.h" @@ -54,11 +55,16 @@ unsigned char *BLF_get_unifont(int *unifont_size_r) { if(unifont_ttf==NULL) { char *fontpath = BLI_get_folder(BLENDER_DATAFILES, "fonts"); - char unifont_path[1024]; + if (fontpath) { + char unifont_path[1024]; - BLI_snprintf(unifont_path, sizeof(unifont_path), "%s/%s", fontpath, unifont_filename); + BLI_snprintf(unifont_path, sizeof(unifont_path), "%s/%s", fontpath, unifont_filename); - unifont_ttf= (unsigned char*)BLI_ungzip_to_mem(unifont_path, &unifont_size); + unifont_ttf= (unsigned char*)BLI_ungzip_to_mem(unifont_path, &unifont_size); + } + else { + printf("%s: 'fonts' data path not found for international font, continuing\n", __func__); + } } *unifont_size_r= unifont_size; diff --git a/source/blender/blenfont/intern/blf_util.c b/source/blender/blenfont/intern/blf_util.c index cfe77887674..d51f9b8af6b 100644 --- a/source/blender/blenfont/intern/blf_util.c +++ b/source/blender/blenfont/intern/blf_util.c @@ -37,6 +37,8 @@ #include "blf_internal.h" +#include "BLI_string_utf8.h" + unsigned int blf_next_p2(unsigned int x) { x -= 1; @@ -62,67 +64,3 @@ unsigned int blf_hash(unsigned int val) key ^= (key >> 17); return key % 257; } - -/* - * This function is from Imlib2 library (font_main.c), a - * library that does image file loading and saving as well - * as rendering, manipulation, arbitrary polygon support, etc. - * - * Copyright (C) 2000 Carsten Haitzler and various contributors - * The original name: imlib_font_utf8_get_next - * more info here: http://docs.enlightenment.org/api/imlib2/html/ - */ -int blf_utf8_next(unsigned char *buf, unsigned int *iindex) -{ - /* Reads UTF8 bytes from 'buf', starting at 'index' and - * returns the code point of the next valid code point. - * 'index' is updated ready for the next call. - * - * Returns 0 to indicate an error (e.g. invalid UTF8) - */ - int index= *iindex, len, r; - unsigned char d, d2, d3, d4; - - d= buf[index++]; - if (!d) - return 0; - - while (buf[index] && ((buf[index] & 0xc0) == 0x80)) - index++; - - len= index - *iindex; - if (len == 1) - r= d; - else if (len == 2) { - /* 2 byte */ - d2= buf[*iindex + 1]; - r= d & 0x1f; /* copy lower 5 */ - r <<= 6; - r |= (d2 & 0x3f); /* copy lower 6 */ - } - else if (len == 3) { - /* 3 byte */ - d2= buf[*iindex + 1]; - d3= buf[*iindex + 2]; - r= d & 0x0f; /* copy lower 4 */ - r <<= 6; - r |= (d2 & 0x3f); - r <<= 6; - r |= (d3 & 0x3f); - } - else { - /* 4 byte */ - d2= buf[*iindex + 1]; - d3= buf[*iindex + 2]; - d4= buf[*iindex + 3]; - r= d & 0x0f; /* copy lower 4 */ - r <<= 6; - r |= (d2 & 0x3f); - r <<= 6; - r |= (d3 & 0x3f); - r <<= 6; - r |= (d4 & 0x3f); - } - *iindex= index; - return r; -} diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index 5358a26e660..7a675dc64c3 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -549,7 +549,7 @@ void BKE_write_undo(bContext *C, const char *name) counter= counter % U.undosteps; BLI_snprintf(numstr, sizeof(numstr), "%d.blend", counter); - BLI_make_file_string("/", filepath, btempdir, numstr); + BLI_make_file_string("/", filepath, BLI_temporary_dir(), numstr); /* success= */ /* UNUSED */ BLO_write_file(CTX_data_main(C), filepath, fileflags, NULL, NULL); @@ -719,7 +719,7 @@ void BKE_undo_save_quit(void) /* no undo state to save */ if(undobase.first==undobase.last) return; - BLI_make_file_string("/", str, btempdir, "quit.blend"); + BLI_make_file_string("/", str, BLI_temporary_dir(), "quit.blend"); file = open(str,O_BINARY+O_WRONLY+O_CREAT+O_TRUNC, 0666); if(file == -1) { diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index 9e48e691b87..3baf8e04b90 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -1280,9 +1280,9 @@ static void do_latt_key(Scene *scene, Object *ob, Key *key, char *out, const int flag= setkeys(ctime, &key->block, k, t, 0); if(flag==0) - do_key(a, a+1, tot, (char *)out, key, actkb, k, t, KEY_MODE_DUMMY); + do_key(a, a+1, tot, out, key, actkb, k, t, KEY_MODE_DUMMY); else - cp_key(a, a+1, tot, (char *)out, key, actkb, k[2], NULL, KEY_MODE_DUMMY); + cp_key(a, a+1, tot, out, key, actkb, k[2], NULL, KEY_MODE_DUMMY); } } else { @@ -1292,7 +1292,7 @@ static void do_latt_key(Scene *scene, Object *ob, Key *key, char *out, const int for(kb= key->block.first; kb; kb= kb->next) kb->weights= get_weights_array(ob, kb->vgroup); - do_rel_key(0, tot, tot, (char *)out, key, actkb, KEY_MODE_DUMMY); + do_rel_key(0, tot, tot, out, key, actkb, KEY_MODE_DUMMY); for(kb= key->block.first; kb; kb= kb->next) { if(kb->weights) MEM_freeN(kb->weights); @@ -1386,7 +1386,7 @@ float *do_ob_key(Scene *scene, Object *ob) if(ELEM(ob->type, OB_MESH, OB_LATTICE)) { float *weights= get_weights_array(ob, kb->vgroup); - cp_key(0, tot, tot, (char*)out, key, actkb, kb, weights, 0); + cp_key(0, tot, tot, out, key, actkb, kb, weights, 0); if(weights) MEM_freeN(weights); } diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 8e5452e2704..f12e9698810 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -910,7 +910,7 @@ static int ptcache_path(PTCacheID *pid, char *filename) else if (G.relbase_valid || lib) { char file[MAX_PTCACHE_PATH]; /* we dont want the dir, only the file */ - BLI_split_dirfile(blendfilename, NULL, file, 0, sizeof(file)); + BLI_split_file_part(blendfilename, file, sizeof(file)); i = strlen(file); /* remove .blend */ @@ -923,8 +923,8 @@ static int ptcache_path(PTCacheID *pid, char *filename) } /* use the temp path. this is weak but better then not using point cache at all */ - /* btempdir is assumed to exist and ALWAYS has a trailing slash */ - BLI_snprintf(filename, MAX_PTCACHE_PATH, "%s"PTCACHE_PATH"%d", btempdir, abs(getpid())); + /* temporary directory is assumed to exist and ALWAYS has a trailing slash */ + BLI_snprintf(filename, MAX_PTCACHE_PATH, "%s"PTCACHE_PATH"%d", BLI_temporary_dir(), abs(getpid())); return BLI_add_slash(filename); /* new strlen() */ } diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index 49c8831f06c..c1833b39b8b 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -131,15 +131,15 @@ struct Scene; struct DerivedMesh; struct SmokeModifierData; -// forward declerations -static void get_cell(float *p0, int res[3], float dx, float *pos, int *cell, int correct); -void calcTriangleDivs(Object *ob, MVert *verts, int numverts, MFace *tris, int numfaces, int numtris, int **tridivs, float cell_len); -static void fill_scs_points(Object *ob, DerivedMesh *dm, SmokeCollSettings *scs); - #define TRI_UVOFFSET (1./4.) +#ifdef WITH_SMOKE +/* forward declerations */ +static void calcTriangleDivs(Object *ob, MVert *verts, int numverts, MFace *tris, int numfaces, int numtris, int **tridivs, float cell_len); +static void get_cell(float *p0, int res[3], float dx, float *pos, int *cell, int correct); +static void fill_scs_points(Object *ob, DerivedMesh *dm, SmokeCollSettings *scs); +#else /* WITH_SMOKE */ /* Stubs to use when smoke is disabled */ -#ifndef WITH_SMOKE struct WTURBULENCE *smoke_turbulence_init(int *UNUSED(res), int UNUSED(amplify), int UNUSED(noisetype)) { return NULL; } struct FLUID_3D *smoke_init(int *UNUSED(res), float *UNUSED(p0)) { return NULL; } void smoke_free(struct FLUID_3D *UNUSED(fluid)) {} @@ -148,9 +148,9 @@ void smoke_initWaveletBlenderRNA(struct WTURBULENCE *UNUSED(wt), float *UNUSED(s void smoke_initBlenderRNA(struct FLUID_3D *UNUSED(fluid), float *UNUSED(alpha), float *UNUSED(beta), float *UNUSED(dt_factor), float *UNUSED(vorticity), int *UNUSED(border_colli)) {} long long smoke_get_mem_req(int UNUSED(xres), int UNUSED(yres), int UNUSED(zres), int UNUSED(amplify)) { return 0; } void smokeModifier_do(SmokeModifierData *UNUSED(smd), Scene *UNUSED(scene), Object *UNUSED(ob), DerivedMesh *UNUSED(dm)) {} -#endif // WITH_SMOKE - +#endif /* WITH_SMOKE */ +#ifdef WITH_SMOKE static int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene, DerivedMesh *dm) { if((smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain && !smd->domain->fluid) @@ -455,7 +455,7 @@ static void fill_scs_points(Object *ob, DerivedMesh *dm, SmokeCollSettings *scs) } /*! init triangle divisions */ -void calcTriangleDivs(Object *ob, MVert *verts, int UNUSED(numverts), MFace *faces, int numfaces, int numtris, int **tridivs, float cell_len) +static void calcTriangleDivs(Object *ob, MVert *verts, int UNUSED(numverts), MFace *faces, int numfaces, int numtris, int **tridivs, float cell_len) { // mTriangleDivs1.resize( faces.size() ); // mTriangleDivs2.resize( faces.size() ); @@ -554,6 +554,8 @@ void calcTriangleDivs(Object *ob, MVert *verts, int UNUSED(numverts), MFace *fac } } +#endif /* WITH_SMOKE */ + static void smokeModifier_freeDomain(SmokeModifierData *smd) { if(smd->domain) @@ -1659,4 +1661,4 @@ static void smoke_calc_transparency(float *result, float *input, float *p0, floa } } -#endif // WITH_SMOKE +#endif /* WITH_SMOKE */ diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index 8787ec07d9c..cd147f4dbed 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -208,7 +208,7 @@ static float sb_time_scale(Object *ob) } return (1.0f); /* - this would be frames/sec independant timing assuming 25 fps is default + this would be frames/sec independent timing assuming 25 fps is default but does not work very well with NLA return (25.0f/scene->r.frs_sec) */ diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index 58a2f45e876..7b414f7746a 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -407,8 +407,7 @@ static void set_ffmpeg_properties(RenderData *rd, AVCodecContext *c, const char return; } - prop = IDP_GetPropertyFromGroup( - rd->ffcodecdata.properties, (char*) prop_name); + prop = IDP_GetPropertyFromGroup(rd->ffcodecdata.properties, prop_name); if (!prop) { return; } @@ -1025,8 +1024,7 @@ void ffmpeg_property_del(RenderData *rd, void *type, void *prop_) return; } - group = IDP_GetPropertyFromGroup( - rd->ffcodecdata.properties, (char*) type); + group = IDP_GetPropertyFromGroup(rd->ffcodecdata.properties, type); if (group && prop) { IDP_RemFromGroup(group, prop); IDP_FreeProperty(prop); @@ -1057,11 +1055,10 @@ IDProperty *ffmpeg_property_add(RenderData *rd, char * type, int opt_index, int = IDP_New(IDP_GROUP, val, "ffmpeg"); } - group = IDP_GetPropertyFromGroup( - rd->ffcodecdata.properties, (char*) type); + group = IDP_GetPropertyFromGroup(rd->ffcodecdata.properties, type); if (!group) { - group = IDP_New(IDP_GROUP, val, (char*) type); + group = IDP_New(IDP_GROUP, val, type); IDP_AddToGroup(rd->ffcodecdata.properties, group); } diff --git a/source/blender/blenlib/BLI_blenlib.h b/source/blender/blenlib/BLI_blenlib.h index cda7a51c47f..4eb4b71da12 100644 --- a/source/blender/blenlib/BLI_blenlib.h +++ b/source/blender/blenlib/BLI_blenlib.h @@ -64,8 +64,6 @@ struct ListBase; #include <stdlib.h> -extern char btempdir[]; /* creator.c temp dir used instead of U.tempdir, set with BLI_where_is_temp( btempdir, 1 ); */ - #ifdef __cplusplus extern "C" { #endif diff --git a/source/blender/blenlib/BLI_path_util.h b/source/blender/blenlib/BLI_path_util.h index 4f7f7b482b5..56ecec042f2 100644 --- a/source/blender/blenlib/BLI_path_util.h +++ b/source/blender/blenlib/BLI_path_util.h @@ -104,6 +104,8 @@ void BLI_make_file_string(const char *relabase, char *string, const char *dir, void BLI_make_exist(char *dir); void BLI_make_existing_file(const char *name); void BLI_split_dirfile(const char *string, char *dir, char *file, const size_t dirlen, const size_t filelen); +void BLI_split_dir_part(const char *string, char *dir, const size_t dirlen); +void BLI_split_file_part(const char *string, char *file, const size_t filelen); void BLI_join_dirfile(char *string, const size_t maxlen, const char *dir, const char *file); char *BLI_path_basename(char *path); int BKE_rebase_path(char *abs, size_t abs_len, char *rel, size_t rel_len, const char *base_dir, const char *src_dir, const char *dest_dir); @@ -179,29 +181,20 @@ void BLI_path_rel(char *file, const char *relfile); */ void BLI_char_switch(char *string, char from, char to); -/** - * Checks if name is a fully qualified filename to an executable. - * If not it searches $PATH for the file. On Windows it also - * adds the correct extension (.com .exe etc) from - * $PATHEXT if necessary. Also on Windows it translates - * the name to its 8.3 version to prevent problems with - * spaces and stuff. Final result is returned in fullname. - * - * @param fullname The full path and full name of the executable - * @param name The name of the executable (usually argv[0]) to be checked - */ -void BLI_where_am_i(char *fullname, const size_t maxlen, const char *name); - - /** - * Gets the temp directory when blender first runs. - * If the default path is not found, use try $TEMP - * - * Also make sure the temp dir has a trailing slash - * - * @param fullname The full path to the temp directory - */ -void BLI_where_is_temp(char *fullname, const size_t maxlen, int usertemp); - + /* Initialize path to program executable */ +void BLI_init_program_path(const char *argv0); + /* Initialize path to temporary directory. + * NOTE: On Window userdir will be set to the temporary directory! */ +void BLI_init_temporary_dir(char *userdir); + + /* Path to executable */ +const char *BLI_program_path(void); + /* Path to directory of executable */ +const char *BLI_program_dir(void); + /* Path to temporary directory (with trailing slash) */ +const char *BLI_temporary_dir(void); + /* Path to the system temporary directory (with trailing slash) */ +void BLI_system_temporary_dir(char *dir); #ifdef WITH_ICONV void BLI_string_to_utf8(char *original, char *utf_8, const char *code); diff --git a/source/blender/blenlib/BLI_string_utf8.h b/source/blender/blenlib/BLI_string_utf8.h index c3bb81dd03f..765ae93828e 100644 --- a/source/blender/blenlib/BLI_string_utf8.h +++ b/source/blender/blenlib/BLI_string_utf8.h @@ -33,20 +33,28 @@ extern "C" { #endif -char *BLI_strncpy_utf8(char *dst, const char *src, size_t maxncpy); -int BLI_utf8_invalid_byte(const char *str, int length); -int BLI_utf8_invalid_strip(char *str, int length); +char *BLI_strncpy_utf8(char *dst, const char *src, size_t maxncpy); +int BLI_utf8_invalid_byte(const char *str, int length); +int BLI_utf8_invalid_strip(char *str, int length); /* copied from glib */ -char *BLI_str_find_prev_char_utf8(const char *str, const char *p); -char *BLI_str_find_next_char_utf8(const char *p, const char *end); -char *BLI_str_prev_char_utf8(const char *p); +unsigned int BLI_str_utf8_as_unicode(const char *p); +unsigned int BLI_str_utf8_as_unicode_and_size(const char *p, size_t *index); +unsigned int BLI_str_utf8_as_unicode_step(const char *p, size_t *index); +size_t BLI_str_utf8_from_unicode(unsigned int c, char *outbuf); + +char *BLI_str_find_prev_char_utf8(const char *str, const char *p); +char *BLI_str_find_next_char_utf8(const char *p, const char *end); +char *BLI_str_prev_char_utf8(const char *p); /* wchar_t functions, copied from blenders own font.c originally */ -size_t BLI_wstrlen_utf8(const wchar_t *src); -size_t BLI_strlen_utf8(const char *strc); -size_t BLI_strncpy_wchar_as_utf8(char *dst, const wchar_t *src, const size_t maxcpy); -size_t BLI_strncpy_wchar_from_utf8(wchar_t *dst, const char *src, const size_t maxcpy); +size_t BLI_wstrlen_utf8(const wchar_t *src); +size_t BLI_strlen_utf8(const char *strc); +size_t BLI_strncpy_wchar_as_utf8(char *dst, const wchar_t *src, const size_t maxcpy); +size_t BLI_strncpy_wchar_from_utf8(wchar_t *dst, const char *src, const size_t maxcpy); + +#define BLI_UTF8_MAX 6 +#define BLI_UTF8_ERR ((unsigned int)-1) #ifdef __cplusplus } diff --git a/source/blender/blenlib/PIL_time.h b/source/blender/blenlib/PIL_time.h index 82869035d50..36ea43bef2d 100644 --- a/source/blender/blenlib/PIL_time.h +++ b/source/blender/blenlib/PIL_time.h @@ -1,7 +1,5 @@ -/* - * @file PIL_time.h - * - * Platform independant time functions. +/* + * Platform independent time functions. * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** @@ -51,7 +49,7 @@ extern double PIL_check_seconds_timer (void); /** - * Platform-independant sleep function. + * Platform-independent sleep function. * @param ms Number of milliseconds to sleep */ void PIL_sleep_ms (int ms); diff --git a/source/blender/blenlib/intern/bpath.c b/source/blender/blenlib/intern/bpath.c index 4e4f8b3cade..293f824c5fd 100644 --- a/source/blender/blenlib/intern/bpath.c +++ b/source/blender/blenlib/intern/bpath.c @@ -903,7 +903,7 @@ void findMissingFiles(Main *bmain, const char *str) //XXX waitcursor( 1 ); - BLI_split_dirfile(str, dirname, NULL, sizeof(dirname), 0); + BLI_split_dir_part(str, dirname, sizeof(dirname)); BLI_bpathIterator_init(&bpi, bmain, bmain->name, 0); diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index 21f91ce8f14..f57ac09c9b9 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -41,7 +41,7 @@ #include "MEM_guardedalloc.h" -#include "DNA_userdef_types.h" +#include "DNA_listBase.h" #include "BLI_fileops.h" #include "BLI_path_util.h" @@ -87,7 +87,9 @@ /* local */ #define UNIQUE_NAME_MAX 128 -extern char bprogname[]; +static char bprogname[FILE_MAX]; /* path to program executable */ +static char bprogdir[FILE_MAX]; /* path in which executable is located */ +static char btempdir[FILE_MAX]; /* temporary directory */ static int add_win32_extension(char *name); static char *blender_version_decimal(const int ver); @@ -875,7 +877,6 @@ static int test_env_path(char *path, const char *envvar) static int get_path_local(char *targetpath, const char *folder_name, const char *subfolder_name, const int ver) { - char bprogdir[FILE_MAX]; char relfolder[FILE_MAX]; #ifdef PATH_DEBUG2 @@ -892,10 +893,7 @@ static int get_path_local(char *targetpath, const char *folder_name, const char else { relfolder[0]= '\0'; } - - /* use argv[0] (bprogname) to get the path to the executable */ - BLI_split_dirfile(bprogname, bprogdir, NULL, sizeof(bprogdir), 0); - + /* try EXECUTABLE_DIR/2.5x/folder_name - new default directory for local blender installed files */ if(test_path(targetpath, bprogdir, blender_version_decimal(ver), relfolder)) return 1; @@ -963,10 +961,6 @@ static int get_path_system(char *targetpath, const char *folder_name, const char * these are only used when running blender from source */ char cwd[FILE_MAX]; char relfolder[FILE_MAX]; - char bprogdir[FILE_MAX]; - - /* use argv[0] (bprogname) to get the path to the executable */ - BLI_split_dirfile(bprogname, bprogdir, NULL, sizeof(bprogdir), 0); if(folder_name) { if (subfolder_name) { @@ -1430,6 +1424,16 @@ void BLI_split_dirfile(const char *string, char *dir, char *file, const size_t d } } +void BLI_split_dir_part(const char *string, char *dir, const size_t dirlen) +{ + BLI_split_dirfile(string, dir, NULL, dirlen, 0); +} + +void BLI_split_file_part(const char *string, char *file, const size_t filelen) +{ + BLI_split_dirfile(string, NULL, file, 0, filelen); +} + /* simple appending of filename to dir, does not check for valid path! */ void BLI_join_dirfile(char *dst, const size_t maxlen, const char *dir, const char *file) { @@ -1516,7 +1520,7 @@ int BKE_rebase_path(char *abs, size_t abs_len, char *rel, size_t rel_len, const if (rel) rel[0]= 0; - BLI_split_dirfile(base_dir, blend_dir, NULL, sizeof(blend_dir), 0); + BLI_split_dir_part(base_dir, blend_dir, sizeof(blend_dir)); if (src_dir[0]=='\0') return 0; @@ -1667,8 +1671,19 @@ static int add_win32_extension(char *name) return (retval); } -/* filename must be FILE_MAX length minimum */ -void BLI_where_am_i(char *fullname, const size_t maxlen, const char *name) +/* +* Checks if name is a fully qualified filename to an executable. +* If not it searches $PATH for the file. On Windows it also +* adds the correct extension (.com .exe etc) from +* $PATHEXT if necessary. Also on Windows it translates +* the name to its 8.3 version to prevent problems with +* spaces and stuff. Final result is returned in fullname. +* +* @param fullname The full path and full name of the executable +* (must be FILE_MAX minimum) +* @param name The name of the executable (usually argv[0]) to be checked +*/ +static void bli_where_am_i(char *fullname, const size_t maxlen, const char *name) { char filename[FILE_MAXDIR+FILE_MAXFILE]; const char *path = NULL, *temp; @@ -1748,12 +1763,37 @@ void BLI_where_am_i(char *fullname, const size_t maxlen, const char *name) } } -void BLI_where_is_temp(char *fullname, const size_t maxlen, int usertemp) +void BLI_init_program_path(const char *argv0) +{ + bli_where_am_i(bprogname, sizeof(bprogname), argv0); + BLI_split_dir_part(bprogname, bprogdir, sizeof(bprogdir)); +} + +const char *BLI_program_path(void) +{ + return bprogname; +} + +const char *BLI_program_dir(void) +{ + return bprogdir; +} + +/** +* Gets the temp directory when blender first runs. +* If the default path is not found, use try $TEMP +* +* Also make sure the temp dir has a trailing slash +* +* @param fullname The full path to the temp directory +* @param userdir Directory specified in user preferences +*/ +void BLI_where_is_temp(char *fullname, const size_t maxlen, char *userdir) { fullname[0] = '\0'; - if (usertemp && BLI_is_dir(U.tempdir)) { - BLI_strncpy(fullname, U.tempdir, maxlen); + if (userdir && BLI_is_dir(userdir)) { + BLI_strncpy(fullname, userdir, maxlen); } @@ -1787,13 +1827,28 @@ void BLI_where_is_temp(char *fullname, const size_t maxlen, int usertemp) /* add a trailing slash if needed */ BLI_add_slash(fullname); #ifdef WIN32 - if(U.tempdir != fullname) { - BLI_strncpy(U.tempdir, fullname, maxlen); /* also set user pref to show %TEMP%. /tmp/ is just plain confusing for Windows users. */ + if(userdir != fullname) { + BLI_strncpy(userdir, fullname, maxlen); /* also set user pref to show %TEMP%. /tmp/ is just plain confusing for Windows users. */ } #endif } } +void BLI_init_temporary_dir(char *userdir) +{ + BLI_where_is_temp(btempdir, FILE_MAX, userdir); +} + +const char *BLI_temporary_dir(void) +{ + return btempdir; +} + +void BLI_system_temporary_dir(char *dir) +{ + BLI_where_is_temp(dir, FILE_MAX, NULL); +} + #ifdef WITH_ICONV void BLI_string_to_utf8(char *original, char *utf_8, const char *code) diff --git a/source/blender/blenlib/intern/string_utf8.c b/source/blender/blenlib/intern/string_utf8.c index f331d13e580..b1ad04eb70d 100644 --- a/source/blender/blenlib/intern/string_utf8.c +++ b/source/blender/blenlib/intern/string_utf8.c @@ -18,6 +18,8 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2011 Blender Foundation. + * Code from gutf8.c Copyright (C) 1999 Tom Tromey + * Copyright (C) 2000 Red Hat, Inc. * All rights reserved. * * Contributor(s): Campbell Barton. @@ -34,7 +36,7 @@ #include <wchar.h> #include <wctype.h> -#include "BLI_string.h" +#include "BLI_string_utf8.h" /* from libswish3, originally called u8_isvalid(), * modified to return the index of the bad character (byte index not utf). @@ -189,45 +191,11 @@ char *BLI_strncpy_utf8(char *dst, const char *src, size_t maxncpy) /* --------------------------------------------------------------------------*/ /* wchar_t / utf8 functions */ -/* UTF-8 <-> wchar transformations */ -static size_t chtoutf8(const unsigned long c, char o[4]) -{ - // Variables and initialization -/* memset(o, 0, 4); */ - - // Create the utf-8 string - if (c < 0x80) { - o[0] = (char) c; - return 1; - } - else if (c < 0x800) { - o[0] = (0xC0 | (c>>6)); - o[1] = (0x80 | (c & 0x3f)); - return 2; - } - else if (c < 0x10000) { - o[0] = (0xe0 | (c >> 12)); - o[1] = (0x80 | (c >>6 & 0x3f)); - o[2] = (0x80 | (c & 0x3f)); - return 3; - } - else if (c < 0x200000) { - o[0] = (0xf0 | (c>>18)); - o[1] = (0x80 | (c >>12 & 0x3f)); - o[2] = (0x80 | (c >> 6 & 0x3f)); - o[3] = (0x80 | (c & 0x3f)); - return 4; - } - - /* should we assert here? */ - return 0; -} - size_t BLI_strncpy_wchar_as_utf8(char *dst, const wchar_t *src, const size_t maxcpy) { size_t len = 0; while(*src && len < maxcpy) { /* XXX can still run over the buffer because utf8 size isnt known :| */ - len += chtoutf8(*src++, dst+len); + len += BLI_str_utf8_from_unicode(*src++, dst+len); } dst[len]= '\0'; @@ -238,11 +206,10 @@ size_t BLI_strncpy_wchar_as_utf8(char *dst, const wchar_t *src, const size_t max /* wchar len in utf8 */ size_t BLI_wstrlen_utf8(const wchar_t *src) { - char ch_dummy[4]; size_t len = 0; while(*src) { - len += chtoutf8(*src++, ch_dummy); + len += BLI_str_utf8_from_unicode(*src++, NULL); } return len; @@ -272,26 +239,6 @@ size_t BLI_strlen_utf8(const char *strc) return len; } - -/* Converts Unicode to wchar - -According to RFC 3629 "UTF-8, a transformation format of ISO 10646" -(http://tools.ietf.org/html/rfc3629), the valid UTF-8 encoding are: - - Char. number range | UTF-8 octet sequence - (hexadecimal) | (binary) - --------------------+--------------------------------------------- - 0000 0000-0000 007F | 0xxxxxxx - 0000 0080-0000 07FF | 110xxxxx 10xxxxxx - 0000 0800-0000 FFFF | 1110xxxx 10xxxxxx 10xxxxxx - 0001 0000-0010 FFFF | 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx - -If the encoding incidated by the first character is incorrect (because the -1 to 3 following characters do not match 10xxxxxx), the output is a '?' and -only a single input character is consumed. - -*/ - size_t BLI_strncpy_wchar_from_utf8(wchar_t *dst_w, const char *src_c, const size_t maxcpy) { int len=0; @@ -299,32 +246,16 @@ size_t BLI_strncpy_wchar_from_utf8(wchar_t *dst_w, const char *src_c, const size if(dst_w==NULL || src_c==NULL) return(0); while(*src_c && len < maxcpy) { - if ((*src_c & 0xe0) == 0xc0) { - if((src_c[1] & 0x80) && (src_c[1] & 0x40) == 0x00) { - *dst_w=((src_c[0] &0x1f)<<6) | (src_c[1]&0x3f); - src_c++; - } else { - *dst_w = '?'; - } - } else if ((*src_c & 0xf0) == 0xe0) { - if((src_c[1] & src_c[2] & 0x80) && ((src_c[1] | src_c[2]) & 0x40) == 0x00) { - *dst_w=((src_c[0] & 0x0f)<<12) | ((src_c[1]&0x3f)<<6) | (src_c[2]&0x3f); - src_c += 2; - } else { - *dst_w = '?'; - } - } else if ((*src_c & 0xf8) == 0xf0) { - if((src_c[1] & src_c[2] & src_c[3] & 0x80) && ((src_c[1] | src_c[2] | src_c[3]) & 0x40) == 0x00) { - *dst_w=((src_c[0] & 0x07)<<18) | ((src_c[1]&0x1f)<<12) | ((src_c[2]&0x3f)<<6) | (src_c[3]&0x3f); - src_c += 3; - } else { - *dst_w = '?'; - } - } else { - *dst_w=(src_c[0] & 0x7f); + size_t step= 0; + unsigned int unicode= BLI_str_utf8_as_unicode_and_size(src_c, &step); + if (unicode != BLI_UTF8_ERR) { + *dst_w= (wchar_t)unicode; + src_c += step; + } + else { + *dst_w = '?'; + src_c= BLI_str_find_next_char_utf8(src_c, NULL); } - - src_c++; dst_w++; len++; } @@ -334,13 +265,198 @@ size_t BLI_strncpy_wchar_from_utf8(wchar_t *dst_w, const char *src_c, const size /* end wchar_t / utf8 functions */ /* --------------------------------------------------------------------------*/ +/* copied from glib's gutf8.c */ + +/* note, glib uses unsigned int for unicode, best we do the same, + * though we dont typedef it - campbell */ + +#define UTF8_COMPUTE(Char, Mask, Len) \ + if (Char < 128) { \ + Len = 1; \ + Mask = 0x7f; \ + } \ + else if ((Char & 0xe0) == 0xc0) { \ + Len = 2; \ + Mask = 0x1f; \ + } \ + else if ((Char & 0xf0) == 0xe0) { \ + Len = 3; \ + Mask = 0x0f; \ + } \ + else if ((Char & 0xf8) == 0xf0) { \ + Len = 4; \ + Mask = 0x07; \ + } \ + else if ((Char & 0xfc) == 0xf8) { \ + Len = 5; \ + Mask = 0x03; \ + } \ + else if ((Char & 0xfe) == 0xfc) { \ + Len = 6; \ + Mask = 0x01; \ + } \ + else { \ + Len = -1; \ + } +/* same as glib define but added an 'Err' arg */ +#define UTF8_GET(Result, Chars, Count, Mask, Len, Err) \ + (Result) = (Chars)[0] & (Mask); \ + for ((Count) = 1; (Count) < (Len); ++(Count)) { \ + if (((Chars)[(Count)] & 0xc0) != 0x80) { \ + (Result) = Err; \ + break; \ + } \ + (Result) <<= 6; \ + (Result) |= ((Chars)[(Count)] & 0x3f); \ + } +/* was g_utf8_get_char */ +/** + * BLI_str_utf8_as_unicode: + * @p: a pointer to Unicode character encoded as UTF-8 + * + * Converts a sequence of bytes encoded as UTF-8 to a Unicode character. + * If @p does not point to a valid UTF-8 encoded character, results are + * undefined. If you are not sure that the bytes are complete + * valid Unicode characters, you should use g_utf8_get_char_validated() + * instead. + * + * Return value: the resulting character + **/ +unsigned int BLI_str_utf8_as_unicode(const char *p) +{ + int i, mask = 0, len; + unsigned int result; + unsigned char c = (unsigned char) *p; + + UTF8_COMPUTE (c, mask, len); + if (len == -1) + return BLI_UTF8_ERR; + UTF8_GET (result, p, i, mask, len, BLI_UTF8_ERR); + + return result; +} + +/* varient that increments the length */ +unsigned int BLI_str_utf8_as_unicode_and_size(const char *p, size_t *index) +{ + int i, mask = 0, len; + unsigned int result; + unsigned char c = (unsigned char) *p; + + UTF8_COMPUTE (c, mask, len); + if (len == -1) + return BLI_UTF8_ERR; + UTF8_GET (result, p, i, mask, len, BLI_UTF8_ERR); + *index += len; + return result; +} + +/* another varient that steps over the index, + * note, currently this also falls back to latin1 for text drawing. */ +unsigned int BLI_str_utf8_as_unicode_step(const char *p, size_t *index) +{ + int i, mask = 0, len; + unsigned int result; + unsigned char c; + + p += *index; + c= (unsigned char) *p; + + UTF8_COMPUTE (c, mask, len); + if (len == -1) { + /* when called with NULL end, result will never be NULL, + * checks for a NULL character */ + char *p_next= BLI_str_find_next_char_utf8(p, NULL); + /* will never return the same pointer unless '\0', + * eternal loop is prevented */ + *index += (size_t)(p_next - p); + return BLI_UTF8_ERR; + } + + /* this is tricky since there are a few ways we can bail out of bad unicode + * values, 3 possible solutions. */ +#if 0 + UTF8_GET (result, p, i, mask, len, BLI_UTF8_ERR); +#elif 1 + /* WARNING: this is NOT part of glib, or supported by similar functions. + * this is added for text drawing because some filepaths can have latin1 + * characters */ + UTF8_GET (result, p, i, mask, len, BLI_UTF8_ERR); + if(result == BLI_UTF8_ERR) { + len= 1; + result= *p; + } + /* end warning! */ +#else + /* without a fallback like '?', text drawing will stop on this value */ + UTF8_GET (result, p, i, mask, len, '?'); +#endif + + *index += len; + return result; +} + +/* was g_unichar_to_utf8 */ +/** + * BLI_str_utf8_from_unicode: + * @c: a Unicode character code + * @outbuf: output buffer, must have at least 6 bytes of space. + * If %NULL, the length will be computed and returned + * and nothing will be written to @outbuf. + * + * Converts a single character to UTF-8. + * + * Return value: number of bytes written + **/ +size_t BLI_str_utf8_from_unicode(unsigned int c, char *outbuf) +{ + /* If this gets modified, also update the copy in g_string_insert_unichar() */ + unsigned int len = 0; + int first; + int i; + + if (c < 0x80) { + first = 0; + len = 1; + } + else if (c < 0x800) { + first = 0xc0; + len = 2; + } + else if (c < 0x10000) { + first = 0xe0; + len = 3; + } + else if (c < 0x200000) { + first = 0xf0; + len = 4; + } + else if (c < 0x4000000) { + first = 0xf8; + len = 5; + } + else { + first = 0xfc; + len = 6; + } + + if (outbuf) { + for (i = len - 1; i > 0; --i) { + outbuf[i] = (c & 0x3f) | 0x80; + c >>= 6; + } + outbuf[0] = c | first; + } + + return len; +} -/* copied from glib */ +/* was g_utf8_find_prev_char */ /** - * g_utf8_find_prev_char: + * BLI_str_find_prev_char_utf8: * @str: pointer to the beginning of a UTF-8 encoded string * @p: pointer to some position within @str * @@ -364,8 +480,9 @@ char * BLI_str_find_prev_char_utf8(const char *str, const char *p) return NULL; } +/* was g_utf8_find_next_char */ /** - * g_utf8_find_next_char: + * BLI_str_find_next_char_utf8: * @p: a pointer to a position within a UTF-8 encoded string * @end: a pointer to the byte following the end of the string, * or %NULL to indicate that the string is nul-terminated. @@ -395,8 +512,9 @@ char *BLI_str_find_next_char_utf8(const char *p, const char *end) return (p == end) ? NULL : (char *)p; } +/* was g_utf8_prev_char */ /** - * g_utf8_prev_char: + * BLI_str_prev_char_utf8: * @p: a pointer to a position within a UTF-8 encoded string * * Finds the previous UTF-8 character in the string before @p. diff --git a/source/blender/blenlib/intern/winstuff.c b/source/blender/blenlib/intern/winstuff.c index 9594197ef90..21ad0ff7253 100644 --- a/source/blender/blenlib/intern/winstuff.c +++ b/source/blender/blenlib/intern/winstuff.c @@ -56,7 +56,7 @@ int BLI_getInstallationDir( char * str ) { int a; GetModuleFileName(NULL,str,FILE_MAXDIR+FILE_MAXFILE); - BLI_split_dirfile(str, dir, NULL, sizeof(dir), 0); /* shouldn't be relative */ + BLI_split_dir_part(str, dir, sizeof(dir)); /* shouldn't be relative */ a = strlen(dir); if(dir[a-1] == '\\') dir[a-1]=0; diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 7a8bacf1ec6..f566ad9b52f 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -3224,7 +3224,7 @@ static void direct_link_pointcache(FileData *fd, PointCache *cache) pm->data[i] = newdataadr(fd, pm->data[i]); /* the cache saves non-struct data without DNA */ - if(pm->data[i] && strcmp(ptcache_data_struct[i], "")==0 && (fd->flags & FD_FLAGS_SWITCH_ENDIAN)) { + if(pm->data[i] && ptcache_data_struct[i][0]=='\0' && (fd->flags & FD_FLAGS_SWITCH_ENDIAN)) { int j, tot= (BKE_ptcache_data_size (i) * pm->totpoint)/4; /* data_size returns bytes */ int *poin= pm->data[i]; diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 7387b2d5d53..8f179bd240b 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -872,7 +872,7 @@ static void write_pointcaches(WriteData *wd, ListBase *ptcaches) for(i=0; i<BPHYS_TOT_DATA; i++) { if(pm->data[i] && pm->data_types & (1<<i)) { - if(strcmp(ptcache_data_struct[i], "")==0) + if(ptcache_data_struct[i][0]=='\0') writedata(wd, DATA, MEM_allocN_len(pm->data[i]), pm->data[i]); else writestruct(wd, DATA, ptcache_data_struct[i], pm->totpoint, pm->data[i]); @@ -880,7 +880,7 @@ static void write_pointcaches(WriteData *wd, ListBase *ptcaches) } for(; extra; extra=extra->next) { - if(strcmp(ptcache_extra_struct[extra->type], "")==0) + if(ptcache_extra_struct[extra->type][0]=='\0') continue; writestruct(wd, DATA, "PTCacheExtra", 1, extra); writestruct(wd, DATA, ptcache_extra_struct[extra->type], extra->totdata, extra->data); @@ -2690,8 +2690,8 @@ int BLO_write_file(Main *mainvar, const char *filepath, int write_flags, ReportL if(write_flags & G_FILE_RELATIVE_REMAP) { char dir1[FILE_MAXDIR+FILE_MAXFILE]; char dir2[FILE_MAXDIR+FILE_MAXFILE]; - BLI_split_dirfile(filepath, dir1, NULL, sizeof(dir1), 0); - BLI_split_dirfile(mainvar->name, dir2, NULL, sizeof(dir2), 0); + BLI_split_dir_part(filepath, dir1, sizeof(dir1)); + BLI_split_dir_part(mainvar->name, dir2, sizeof(dir2)); /* just incase there is some subtle difference */ BLI_cleanup_dir(mainvar->name, dir1); @@ -2711,6 +2711,7 @@ int BLO_write_file(Main *mainvar, const char *filepath, int write_flags, ReportL } } + userfilename[0]= '\0'; /* ensure its initialized */ BLI_make_file_string(G.main->name, userfilename, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_STARTUP_FILE); write_user_block= (BLI_path_cmp(filepath, userfilename) == 0); diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index 056d74aabfb..c06867ca107 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -884,7 +884,7 @@ bool DocumentImporter::writeImage( const COLLADAFW::Image* image ) char dir[FILE_MAX]; char full_path[FILE_MAX]; - BLI_split_dirfile(filename, dir, NULL, sizeof(dir), 0); + BLI_split_dir_part(filename, dir, sizeof(dir)); BLI_join_dirfile(full_path, sizeof(full_path), dir, filepath.c_str()); Image *ima = BKE_add_image_file(full_path); if (!ima) { diff --git a/source/blender/collada/ImageExporter.cpp b/source/blender/collada/ImageExporter.cpp index 53c43677c18..6c7251016c3 100644 --- a/source/blender/collada/ImageExporter.cpp +++ b/source/blender/collada/ImageExporter.cpp @@ -97,7 +97,7 @@ void ImagesExporter::operator()(Material *ma, Object *ob) char src[FILE_MAX]; char dir[FILE_MAX]; - BLI_split_dirfile(this->export_settings->filepath, dir, NULL, sizeof(dir), 0); + BLI_split_dir_part(this->export_settings->filepath, dir, sizeof(dir)); BKE_rebase_path(abs, sizeof(abs), rel, sizeof(rel), G.main->name, image->name, dir); diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c index e7c7ebf3ece..8e9f5c7543c 100644 --- a/source/blender/editors/armature/poselib.c +++ b/source/blender/editors/armature/poselib.c @@ -409,15 +409,15 @@ static int poselib_add_menu_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT); /* add new (adds to the first unoccupied frame) */ - uiItemIntO(layout, UI_translate_do_iface(N_("Add New")), ICON_NONE, "POSELIB_OT_pose_add", "frame", poselib_get_free_index(ob->poselib)); + uiItemIntO(layout, IFACE_("Add New"), ICON_NONE, "POSELIB_OT_pose_add", "frame", poselib_get_free_index(ob->poselib)); /* check if we have any choices to add a new pose in any other way */ if ((ob->poselib) && (ob->poselib->markers.first)) { /* add new (on current frame) */ - uiItemIntO(layout, UI_translate_do_iface(N_("Add New (Current Frame)")), ICON_NONE, "POSELIB_OT_pose_add", "frame", CFRA); + uiItemIntO(layout, IFACE_("Add New (Current Frame)"), ICON_NONE, "POSELIB_OT_pose_add", "frame", CFRA); /* replace existing - submenu */ - uiItemMenuF(layout, UI_translate_do_iface(N_("Replace Existing...")), 0, poselib_add_menu_invoke__replacemenu, NULL); + uiItemMenuF(layout, IFACE_("Replace Existing..."), 0, poselib_add_menu_invoke__replacemenu, NULL); } uiPupMenuEnd(C, pup); diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 0fbbb3b268e..c0fa8b7bebd 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -823,5 +823,9 @@ int UI_translate_tooltips(void); const char *UI_translate_do_iface(const char *msgid); const char *UI_translate_do_tooltip(const char *msgid); +/* Those macros should be used everywhere in UI code. */ +#define IFACE_(msgid) UI_translate_do_iface(msgid) +#define TIP_(msgid) UI_translate_do_tooltip(msgid) + #endif /* UI_INTERFACE_H */ diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 16edd0a1a9e..a12d297bbb1 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -2773,10 +2773,7 @@ static uiBut *ui_def_but_operator(uiBlock *block, int type, const char *opname, if ((!tip || tip[0]=='\0') && ot && ot->description) { tip= ot->description; -#ifdef WITH_INTERNATIONAL - if(UI_translate_tooltips()) - tip= BLF_gettext(tip); -#endif + tip = TIP_(tip); } but= ui_def_but(block, type, -1, str, x1, y1, x2, y2, NULL, 0, 0, 0, 0, tip); diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index f0700c0d79f..5059b9d66b1 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -525,6 +525,9 @@ static void init_internal_icons(void) bbuf= NULL; } } + else { + printf("%s: 'icons' data path not found, continuing\n", __func__); + } } if(bbuf==NULL) bbuf = IMB_ibImageFromMemory((unsigned char*)datatoc_blenderbuttons, datatoc_blenderbuttons_size, IB_rect); diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index ba612fc8727..2f423a361b8 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -637,11 +637,7 @@ PointerRNA uiItemFullO(uiLayout *layout, const char *opname, const char *name, i } if(!name) { - name= ot->name; - -#ifdef WITH_INTERNATIONAL - name= UI_translate_do_iface(name); -#endif + name= IFACE_(ot->name); } if(layout->root->type == UI_LAYOUT_MENU && !icon) @@ -1430,11 +1426,7 @@ void uiItemM(uiLayout *layout, bContext *UNUSED(C), const char *menuname, const } if(!name) { - name= mt->label; - -#ifdef WITH_INTERNATIONAL - name= UI_translate_do_iface(name); -#endif + name= IFACE_(mt->label); } if(layout->root->type == UI_LAYOUT_MENU && !icon) @@ -2808,7 +2800,7 @@ void uiLayoutOperatorButs(const bContext *C, uiLayout *layout, wmOperator *op,in empty= uiDefAutoButsRNA(layout, &ptr, check_prop, label_align) == 0; if(empty && (flag & UI_LAYOUT_OP_SHOW_EMPTY)) { - uiItemL(layout, UI_translate_do_iface(N_("No Properties")), ICON_NONE); + uiItemL(layout, IFACE_("No Properties"), ICON_NONE); } } diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 0823646ebc7..f4416bc56df 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -442,11 +442,7 @@ static void ui_draw_aligned_panel_header(uiStyle *style, uiBlock *block, rcti *r Panel *panel= block->panel; rcti hrect; int pnl_icons; - const char *activename= panel->drawname[0]?panel->drawname:panel->panelname; - -#ifdef WITH_INTERNATIONAL - activename= UI_translate_do_iface(activename); -#endif + const char *activename= IFACE_(panel->drawname[0] ? panel->drawname : panel->panelname); /* + 0.001f to avoid flirting with float inaccuracy */ if(panel->control & UI_PNL_CLOSE) pnl_icons=(panel->labelofs+2*PNL_ICON+5)/block->aspect + 0.001f; diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 028ab05464b..4791d2652dc 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -349,7 +349,6 @@ static void ui_tooltip_region_free_cb(ARegion *ar) ar->regiondata= NULL; } -#define TIP_(msgid) UI_translate_do_tooltip(msgid) ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) { uiStyle *style= UI_GetStyle(); @@ -410,7 +409,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) prop= (but->opptr)? but->opptr->data: NULL; if(WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, buf, sizeof(buf))) { - BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_(N_("Shortcut: %s")), buf); + BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Shortcut: %s"), buf); data->color[data->totline]= 0x888888; data->totline++; } @@ -420,7 +419,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) /* full string */ ui_get_but_string(but, buf, sizeof(buf)); if(buf[0]) { - BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_(N_("Value: %s")), buf); + BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Value: %s"), buf); data->color[data->totline]= 0x888888; data->totline++; } @@ -432,7 +431,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) if (unit_type == PROP_UNIT_ROTATION) { if (RNA_property_type(but->rnaprop) == PROP_FLOAT) { 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]), TIP_(N_("Radians: %f")), value); + BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Radians: %f"), value); data->color[data->totline]= 0x888888; data->totline++; } @@ -441,7 +440,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) if(but->flag & UI_BUT_DRIVEN) { if(ui_but_anim_expression_get(but, buf, sizeof(buf))) { /* expression */ - BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_(N_("Expression: %s")), buf); + BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Expression: %s"), buf); data->color[data->totline]= 0x888888; data->totline++; } @@ -449,7 +448,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) /* rna info */ if ((U.flag & USER_TOOLTIPS_PYTHON) == 0) { - BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_(N_("Python: %s.%s")), RNA_struct_identifier(but->rnapoin.type), RNA_property_identifier(but->rnaprop)); + BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Python: %s.%s"), RNA_struct_identifier(but->rnapoin.type), RNA_property_identifier(but->rnaprop)); data->color[data->totline]= 0x888888; data->totline++; } @@ -457,7 +456,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) if(but->rnapoin.id.data) { ID *id= but->rnapoin.id.data; if(id->lib && id->lib->name) { - BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_(N_("Library: %s")), id->lib->name); + BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Library: %s"), id->lib->name); data->color[data->totline]= 0x888888; data->totline++; } @@ -472,7 +471,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) /* operator info */ if ((U.flag & USER_TOOLTIPS_PYTHON) == 0) { - BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_(N_("Python: %s")), str); + BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Python: %s"), str); data->color[data->totline]= 0x888888; data->totline++; } @@ -486,7 +485,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) WM_operator_poll_context(C, but->optype, but->opcontext); poll_msg= CTX_wm_operator_poll_msg_get(C); if(poll_msg) { - BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_(N_("Disabled: %s")), poll_msg); + BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Disabled: %s"), poll_msg); data->color[data->totline]= 0x6666ff; /* alert */ data->totline++; } @@ -496,7 +495,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) if ((U.flag & USER_TOOLTIPS_PYTHON) == 0) { if(but->menu_create_func && WM_menutype_contains((MenuType *)but->poin)) { MenuType *mt= (MenuType *)but->poin; - BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_(N_("Python: %s")), mt->idname); + BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Python: %s"), mt->idname); data->color[data->totline]= 0x888888; data->totline++; } @@ -615,7 +614,6 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) return ar; } -#undef TIP_ void ui_tooltip_free(bContext *C, ARegion *ar) { @@ -2372,7 +2370,7 @@ uiPopupMenu *uiPupMenuBegin(bContext *C, const char *title, int icon) pup->block= uiBeginBlock(C, NULL, "uiPupMenuBegin", UI_EMBOSSP); pup->block->flag |= UI_BLOCK_POPUP_MEMORY; - pup->block->puphash= ui_popup_menu_hash((char*)title); + pup->block->puphash= ui_popup_menu_hash(title); pup->layout= uiBlockLayout(pup->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_MENU, 0, 0, 200, 0, style); uiLayoutSetOperatorContext(pup->layout, WM_OP_EXEC_REGION_WIN); diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 194dc3efb43..b97b7feb286 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -357,7 +357,7 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str if(flag & UI_ID_PREVIEWS) { but= uiDefBlockButN(block, id_search_menu, MEM_dupallocN(template), "", 0, 0, UI_UNIT_X*6, UI_UNIT_Y*6, - UI_translate_do_tooltip(template_id_browse_tip(type))); + TIP_(template_id_browse_tip(type))); if(type) { but->icon= RNA_struct_ui_icon(type); if (id) but->icon = ui_id_icon_get(C, id, 1); @@ -370,7 +370,7 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str } else if(flag & UI_ID_BROWSE) { but= uiDefBlockButN(block, id_search_menu, MEM_dupallocN(template), "", 0, 0, UI_UNIT_X*1.6, UI_UNIT_Y, - UI_translate_do_tooltip(template_id_browse_tip(type))); + TIP_(template_id_browse_tip(type))); if(type) { but->icon= RNA_struct_ui_icon(type); /* default dragging of icon for id browse buttons */ @@ -396,12 +396,12 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str if(id->lib) { if(id->flag & LIB_INDIRECT) { but= uiDefIconBut(block, BUT, 0, ICON_LIBRARY_DATA_INDIRECT, 0,0,UI_UNIT_X,UI_UNIT_Y, NULL, 0, 0, 0, 0, - UI_translate_do_tooltip(N_("Indirect library datablock, cannot change"))); + TIP_("Indirect library datablock, cannot change")); uiButSetFlag(but, UI_BUT_DISABLED); } else { but= uiDefIconBut(block, BUT, 0, ICON_LIBRARY_DATA_DIRECT, 0,0,UI_UNIT_X,UI_UNIT_Y, NULL, 0, 0, 0, 0, - UI_translate_do_tooltip(N_("Direct linked library datablock, click to make local"))); + TIP_("Direct linked library datablock, click to make local")); if(!id_make_local(id, 1 /* test */) || (idfrom && idfrom->lib)) uiButSetFlag(but, UI_BUT_DISABLED); } @@ -415,7 +415,7 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str BLI_snprintf(str, sizeof(str), "%d", id->us); but= uiDefBut(block, BUT, 0, str, 0,0,UI_UNIT_X + ((id->us < 10) ? 0:10), UI_UNIT_Y, NULL, 0, 0, 0, 0, - UI_translate_do_tooltip(_("Display number of users of this data (click to make a single-user copy)"))); + TIP_("Display number of users of this data (click to make a single-user copy)")); uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_ALONE)); if(!id_copy(id, NULL, 1 /* test only */) || (idfrom && idfrom->lib) || !editable) @@ -433,11 +433,11 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str int w= id?UI_UNIT_X: (flag & UI_ID_OPEN)? UI_UNIT_X*3: UI_UNIT_X*6; if(newop) { - but= uiDefIconTextButO(block, BUT, newop, WM_OP_INVOKE_DEFAULT, ICON_ZOOMIN, (id)? "": UI_translate_do_iface(N_("New")), 0, 0, w, UI_UNIT_Y, NULL); + but= uiDefIconTextButO(block, BUT, newop, WM_OP_INVOKE_DEFAULT, ICON_ZOOMIN, (id)? "": IFACE_("New"), 0, 0, w, UI_UNIT_Y, NULL); uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_ADD_NEW)); } else { - but= uiDefIconTextBut(block, BUT, 0, ICON_ZOOMIN, (id)? "": _("New"), 0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL); + but= uiDefIconTextBut(block, BUT, 0, ICON_ZOOMIN, (id)? "": IFACE_("New"), 0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL); uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_ADD_NEW)); } @@ -449,11 +449,11 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str int w= id?UI_UNIT_X: (flag & UI_ID_ADD_NEW)? UI_UNIT_X*3: UI_UNIT_X*6; if(openop) { - but= uiDefIconTextButO(block, BUT, openop, WM_OP_INVOKE_DEFAULT, ICON_FILESEL, (id)? "": UI_translate_do_iface(N_("Open")), 0, 0, w, UI_UNIT_Y, NULL); + but= uiDefIconTextButO(block, BUT, openop, WM_OP_INVOKE_DEFAULT, ICON_FILESEL, (id)? "": IFACE_("Open"), 0, 0, w, UI_UNIT_Y, NULL); uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_OPEN)); } else { - but= uiDefIconTextBut(block, BUT, 0, ICON_FILESEL, (id)? "": UI_translate_do_iface(N_("Open")), 0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL); + but= uiDefIconTextBut(block, BUT, 0, ICON_FILESEL, (id)? "": IFACE_("Open"), 0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL); uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_OPEN)); } @@ -470,7 +470,7 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str } else { but= uiDefIconBut(block, BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, - UI_translate_do_tooltip(N_("Unlink datablock. Shift + Click to set users to zero, data will then not be saved"))); + TIP_("Unlink datablock. Shift + Click to set users to zero, data will then not be saved")); uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_DELETE)); if(RNA_property_flag(template->prop) & PROP_NEVER_NULL) @@ -732,8 +732,8 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, Modif BLI_snprintf(str, sizeof(str), "%s parent deform", md->name); uiDefBut(block, LABEL, 0, str, 0, 0, 185, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, "Modifier name"); - but = uiDefBut(block, BUT, 0, UI_translate_do_iface(N_("Make Real")), 0, 0, 80, 16, NULL, 0.0, 0.0, 0.0, 0.0, - UI_translate_do_tooltip(N_("Convert virtual modifier to a real modifier"))); + but = uiDefBut(block, BUT, 0, IFACE_("Make Real"), 0, 0, 80, 16, NULL, 0.0, 0.0, 0.0, 0.0, + TIP_("Convert virtual modifier to a real modifier")); uiButSetFunc(but, modifiers_convertToReal, ob, md); } else { @@ -770,7 +770,7 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, Modif { /* -- convert to rna ? */ but = uiDefIconButBitI(block, TOG, eModifierMode_OnCage, 0, ICON_MESH_DATA, 0, 0, UI_UNIT_X-2, UI_UNIT_Y, &md->mode, 0.0, 0.0, 0.0, 0.0, - UI_translate_do_tooltip(N_("Apply modifier to editing cage during Editmode"))); + TIP_("Apply modifier to editing cage during Editmode")); if (index < cageIndex) uiButSetFlag(but, UI_BUT_DISABLED); uiButSetFunc(but, modifiers_setOnCage, ob, md); @@ -791,7 +791,7 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, Modif /* add disabled pre-tesselated button, so users could have message for this modifiers */ but = uiDefIconButBitI(block, TOG, eModifierMode_ApplyOnSpline, 0, ICON_SURFACE_DATA, 0, 0, UI_UNIT_X-2, UI_UNIT_Y, &md->mode, 0.0, 0.0, 0.0, 0.0, - UI_translate_do_tooltip(N_("This modifier could be applied on splines' points only"))); + TIP_("This modifier could be applied on splines' points only")); uiButSetFlag(but, UI_BUT_DISABLED); } else if (mti->type != eModifierTypeType_Constructive) { /* constructive modifiers tesselates curve before applying */ @@ -841,17 +841,17 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, Modif } else { uiLayoutSetOperatorContext(row, WM_OP_INVOKE_DEFAULT); - uiItemEnumO(row, "OBJECT_OT_modifier_apply", UI_translate_do_iface(N_("Apply")), 0, "apply_as", MODIFIER_APPLY_DATA); + uiItemEnumO(row, "OBJECT_OT_modifier_apply", IFACE_("Apply"), 0, "apply_as", MODIFIER_APPLY_DATA); if (modifier_sameTopology(md)) - uiItemEnumO(row, "OBJECT_OT_modifier_apply", UI_translate_do_iface(N_("Apply as Shape")), 0, "apply_as", MODIFIER_APPLY_SHAPE); + uiItemEnumO(row, "OBJECT_OT_modifier_apply", IFACE_("Apply as Shape"), 0, "apply_as", MODIFIER_APPLY_SHAPE); } uiBlockClearButLock(block); uiBlockSetButLock(block, ob && ob->id.lib, ERROR_LIBDATA_MESSAGE); if (!ELEM5(md->type, eModifierType_Fluidsim, eModifierType_Softbody, eModifierType_ParticleSystem, eModifierType_Cloth, eModifierType_Smoke)) - uiItemO(row, UI_translate_do_tooltip(N_("Copy")), ICON_NONE, "OBJECT_OT_modifier_copy"); + uiItemO(row, TIP_("Copy"), ICON_NONE, "OBJECT_OT_modifier_copy"); } /* result is the layout block inside the box, that we return so that modifier settings can be drawn */ @@ -1025,8 +1025,8 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con) uiBlockSetEmboss(block, UI_EMBOSSN); /* draw a ghost icon (for proxy) and also a lock beside it, to show that constraint is "proxy locked" */ - uiDefIconBut(block, BUT, B_CONSTRAINT_TEST, ICON_GHOST, xco+244, yco, 19, 19, NULL, 0.0, 0.0, 0.0, 0.0, UI_translate_do_tooltip(N_("Proxy Protected"))); - uiDefIconBut(block, BUT, B_CONSTRAINT_TEST, ICON_LOCKED, xco+262, yco, 19, 19, NULL, 0.0, 0.0, 0.0, 0.0, UI_translate_do_tooltip(N_("Proxy Protected"))); + uiDefIconBut(block, BUT, B_CONSTRAINT_TEST, ICON_GHOST, xco+244, yco, 19, 19, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Proxy Protected")); + uiDefIconBut(block, BUT, B_CONSTRAINT_TEST, ICON_LOCKED, xco+262, yco, 19, 19, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Proxy Protected")); uiBlockSetEmboss(block, UI_EMBOSS); } @@ -1212,14 +1212,14 @@ void uiTemplatePreview(uiLayout *layout, ID *id, int show_buttons, ID *parent, M RNA_pointer_create(id, &RNA_Texture, tex, &texture_ptr); uiLayoutRow(layout, 1); - uiDefButS(block, ROW, B_MATPRV, UI_translate_do_iface(N_("Texture")), 0, 0,UI_UNIT_X*10,UI_UNIT_Y, pr_texture, 10, TEX_PR_TEXTURE, 0, 0, ""); + uiDefButS(block, ROW, B_MATPRV, IFACE_("Texture"), 0, 0,UI_UNIT_X*10,UI_UNIT_Y, pr_texture, 10, TEX_PR_TEXTURE, 0, 0, ""); if(GS(parent->name) == ID_MA) - uiDefButS(block, ROW, B_MATPRV, UI_translate_do_iface(N_("Material")), 0, 0,UI_UNIT_X*10,UI_UNIT_Y, pr_texture, 10, TEX_PR_OTHER, 0, 0, ""); + uiDefButS(block, ROW, B_MATPRV, IFACE_("Material"), 0, 0,UI_UNIT_X*10,UI_UNIT_Y, pr_texture, 10, TEX_PR_OTHER, 0, 0, ""); else if(GS(parent->name) == ID_LA) - uiDefButS(block, ROW, B_MATPRV, UI_translate_do_iface(N_("Lamp")), 0, 0,UI_UNIT_X*10,UI_UNIT_Y, pr_texture, 10, TEX_PR_OTHER, 0, 0, ""); + uiDefButS(block, ROW, B_MATPRV, IFACE_("Lamp"), 0, 0,UI_UNIT_X*10,UI_UNIT_Y, pr_texture, 10, TEX_PR_OTHER, 0, 0, ""); else if(GS(parent->name) == ID_WO) - uiDefButS(block, ROW, B_MATPRV, UI_translate_do_iface(N_("World")), 0, 0,UI_UNIT_X*10,UI_UNIT_Y, pr_texture, 10, TEX_PR_OTHER, 0, 0, ""); - uiDefButS(block, ROW, B_MATPRV, UI_translate_do_iface(N_("Both")), 0, 0,UI_UNIT_X*10,UI_UNIT_Y, pr_texture, 10, TEX_PR_BOTH, 0, 0, ""); + uiDefButS(block, ROW, B_MATPRV, IFACE_("World"), 0, 0,UI_UNIT_X*10,UI_UNIT_Y, pr_texture, 10, TEX_PR_OTHER, 0, 0, ""); + uiDefButS(block, ROW, B_MATPRV, IFACE_("Both"), 0, 0,UI_UNIT_X*10,UI_UNIT_Y, pr_texture, 10, TEX_PR_BOTH, 0, 0, ""); /* Alpha buton for texture preview */ if(*pr_texture!=TEX_PR_OTHER) { @@ -1310,23 +1310,23 @@ static void colorband_buttons_large(uiLayout *layout, uiBlock *block, ColorBand if(coba==NULL) return; - bt= uiDefBut(block, BUT, 0, UI_translate_do_iface(N_("Add")), 0+xoffs,line1_y,40,UI_UNIT_Y, NULL, 0, 0, 0, 0, - UI_translate_do_tooltip(N_("Add a new color stop to the colorband"))); + bt= uiDefBut(block, BUT, 0, IFACE_("Add"), 0+xoffs,line1_y,40,UI_UNIT_Y, NULL, 0, 0, 0, 0, + TIP_("Add a new color stop to the colorband")); uiButSetNFunc(bt, colorband_add_cb, MEM_dupallocN(cb), coba); - bt= uiDefBut(block, BUT, 0, UI_translate_do_iface(N_("Delete")), 45+xoffs,line1_y,45,UI_UNIT_Y, NULL, 0, 0, 0, 0, - UI_translate_do_tooltip(N_("Delete the active position"))); + bt= uiDefBut(block, BUT, 0, IFACE_("Delete"), 45+xoffs,line1_y,45,UI_UNIT_Y, NULL, 0, 0, 0, 0, + TIP_("Delete the active position")); uiButSetNFunc(bt, colorband_del_cb, MEM_dupallocN(cb), coba); /* XXX, todo for later - convert to operator - campbell */ - bt= uiDefBut(block, BUT, 0, "F", 95+xoffs,line1_y,20,UI_UNIT_Y, NULL, 0, 0, 0, 0, UI_translate_do_tooltip(N_("Flip colorband"))); + bt= uiDefBut(block, BUT, 0, "F", 95+xoffs,line1_y,20,UI_UNIT_Y, NULL, 0, 0, 0, 0, TIP_("Flip colorband")); uiButSetNFunc(bt, colorband_flip_cb, MEM_dupallocN(cb), coba); - uiDefButS(block, NUM, 0, "", 120+xoffs,line1_y,80, UI_UNIT_Y, &coba->cur, 0.0, (float)(MAX2(0, coba->tot-1)), 0, 0, UI_translate_do_tooltip(N_("Choose active color stop"))); + uiDefButS(block, NUM, 0, "", 120+xoffs,line1_y,80, UI_UNIT_Y, &coba->cur, 0.0, (float)(MAX2(0, coba->tot-1)), 0, 0, TIP_("Choose active color stop")); - bt= uiDefButS(block, MENU, 0, UI_translate_do_iface(N_("Interpolation %t|Ease %x1|Cardinal %x3|Linear %x0|B-Spline %x2|Constant %x4")), - 210+xoffs, line1_y, 90, UI_UNIT_Y, &coba->ipotype, 0.0, 0.0, 0, 0, UI_translate_do_tooltip(N_("Set interpolation between color stops"))); + bt= uiDefButS(block, MENU, 0, IFACE_("Interpolation %t|Ease %x1|Cardinal %x3|Linear %x0|B-Spline %x2|Constant %x4"), + 210+xoffs, line1_y, 90, UI_UNIT_Y, &coba->ipotype, 0.0, 0.0, 0, 0, TIP_("Set interpolation between color stops")); uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL); uiBlockEndAlign(block); @@ -1355,13 +1355,13 @@ static void colorband_buttons_small(uiLayout *layout, uiBlock *block, ColorBand float xs= butr->xmin; uiBlockBeginAlign(block); - bt= uiDefBut(block, BUT, 0, UI_translate_do_iface(N_("Add")), xs,butr->ymin+UI_UNIT_Y,2.0f*unit,UI_UNIT_Y, NULL, 0, 0, 0, 0, - UI_translate_do_tooltip(N_("Add a new color stop to the colorband"))); + bt= uiDefBut(block, BUT, 0, IFACE_("Add"), xs,butr->ymin+UI_UNIT_Y,2.0f*unit,UI_UNIT_Y, NULL, 0, 0, 0, 0, + TIP_("Add a new color stop to the colorband")); uiButSetNFunc(bt, colorband_add_cb, MEM_dupallocN(cb), coba); - bt= uiDefBut(block, BUT, 0, UI_translate_do_iface(N_("Delete")), xs+2.0f*unit,butr->ymin+UI_UNIT_Y,1.5f*unit,UI_UNIT_Y, NULL, 0, 0, 0, 0, - UI_translate_do_tooltip(N_("Delete the active position"))); + bt= uiDefBut(block, BUT, 0, IFACE_("Delete"), xs+2.0f*unit,butr->ymin+UI_UNIT_Y,1.5f*unit,UI_UNIT_Y, NULL, 0, 0, 0, 0, + TIP_("Delete the active position")); uiButSetNFunc(bt, colorband_del_cb, MEM_dupallocN(cb), coba); - bt= uiDefBut(block, BUT, 0, "F", xs+3.5f*unit,butr->ymin+UI_UNIT_Y,0.5f*unit,UI_UNIT_Y, NULL, 0, 0, 0, 0, UI_translate_do_tooltip(N_("Flip the color ramp"))); + bt= uiDefBut(block, BUT, 0, "F", xs+3.5f*unit,butr->ymin+UI_UNIT_Y,0.5f*unit,UI_UNIT_Y, NULL, 0, 0, 0, 0, TIP_("Flip the color ramp")); uiButSetNFunc(bt, colorband_flip_cb, MEM_dupallocN(cb), coba); uiBlockEndAlign(block); @@ -1372,9 +1372,9 @@ static void colorband_buttons_small(uiLayout *layout, uiBlock *block, ColorBand uiItemR(layout, &ptr, "color", 0, "", ICON_NONE); } - bt= uiDefButS(block, MENU, 0, UI_translate_do_tooltip(N_("Interpolation %t|Ease %x1|Cardinal %x3|Linear %x0|B-Spline %x2|Constant %x4")), + bt= uiDefButS(block, MENU, 0, TIP_("Interpolation %t|Ease %x1|Cardinal %x3|Linear %x0|B-Spline %x2|Constant %x4"), xs+10.0f*unit, butr->ymin+UI_UNIT_Y, unit*4, UI_UNIT_Y, &coba->ipotype, 0.0, 0.0, 0, 0, - UI_translate_do_tooltip(N_("Set interpolation between color stops"))); + TIP_("Set interpolation between color stops")); uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL); bt= uiDefBut(block, BUT_COLORBAND, 0, "", xs,butr->ymin,butr->xmax-butr->xmin,UI_UNIT_Y, coba, 0, 0, 0, 0, ""); @@ -1625,10 +1625,10 @@ static uiBlock *curvemap_clipping_func(bContext *C, struct ARegion *ar, void *cu uiButSetFunc(bt, curvemap_buttons_setclip, cumap, NULL); uiBlockBeginAlign(block); - uiDefButF(block, NUM, 0, UI_translate_do_iface(N_("Min X ")), 0,4*UI_UNIT_Y,width,UI_UNIT_Y, &cumap->clipr.xmin, -100.0, cumap->clipr.xmax, 10, 0, ""); - uiDefButF(block, NUM, 0, UI_translate_do_iface(N_("Min Y ")), 0,3*UI_UNIT_Y,width,UI_UNIT_Y, &cumap->clipr.ymin, -100.0, cumap->clipr.ymax, 10, 0, ""); - uiDefButF(block, NUM, 0, UI_translate_do_iface(N_("Max X ")), 0,2*UI_UNIT_Y,width,UI_UNIT_Y, &cumap->clipr.xmax, cumap->clipr.xmin, 100.0, 10, 0, ""); - uiDefButF(block, NUM, 0, UI_translate_do_iface(N_("Max Y ")), 0,UI_UNIT_Y,width,UI_UNIT_Y, &cumap->clipr.ymax, cumap->clipr.ymin, 100.0, 10, 0, ""); + uiDefButF(block, NUM, 0, IFACE_("Min X "), 0,4*UI_UNIT_Y,width,UI_UNIT_Y, &cumap->clipr.xmin, -100.0, cumap->clipr.xmax, 10, 0, ""); + uiDefButF(block, NUM, 0, IFACE_("Min Y "), 0,3*UI_UNIT_Y,width,UI_UNIT_Y, &cumap->clipr.ymin, -100.0, cumap->clipr.ymax, 10, 0, ""); + uiDefButF(block, NUM, 0, IFACE_("Max X "), 0,2*UI_UNIT_Y,width,UI_UNIT_Y, &cumap->clipr.xmax, cumap->clipr.xmin, 100.0, 10, 0, ""); + uiDefButF(block, NUM, 0, IFACE_("Max Y "), 0,UI_UNIT_Y,width,UI_UNIT_Y, &cumap->clipr.ymax, cumap->clipr.ymin, 100.0, 10, 0, ""); uiBlockSetDirection(block, UI_RIGHT); @@ -1677,12 +1677,12 @@ static uiBlock *curvemap_tools_func(bContext *C, struct ARegion *ar, void *cumap block= uiBeginBlock(C, ar, "curvemap_tools_func", UI_EMBOSS); uiBlockSetButmFunc(block, curvemap_tools_dofunc, cumap_v); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, UI_translate_do_iface(N_("Reset View")), 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 1, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, UI_translate_do_iface(N_("Vector Handle")), 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 2, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, UI_translate_do_iface(N_("Auto Handle")), 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 3, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, UI_translate_do_iface(N_("Extend Horizontal")), 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 4, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, UI_translate_do_iface(N_("Extend Extrapolated")), 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 5, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, UI_translate_do_iface(N_("Reset Curve")), 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Reset View"), 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 1, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Vector Handle"), 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 2, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Auto Handle"), 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 3, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Extend Horizontal"), 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 4, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Extend Extrapolated"), 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 5, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Reset Curve"), 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); uiBlockSetDirection(block, UI_RIGHT); uiTextBoundsBlock(block, 50); @@ -1699,10 +1699,10 @@ static uiBlock *curvemap_brush_tools_func(bContext *C, struct ARegion *ar, void block= uiBeginBlock(C, ar, "curvemap_tools_func", UI_EMBOSS); uiBlockSetButmFunc(block, curvemap_tools_dofunc, cumap_v); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, UI_translate_do_iface(N_("Reset View")), 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 1, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, UI_translate_do_iface(N_("Vector Handle")), 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 2, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, UI_translate_do_iface(N_("Auto Handle")), 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 3, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, UI_translate_do_iface(N_("Reset Curve")), 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Reset View"), 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 1, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Vector Handle"), 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 2, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Auto Handle"), 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 3, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Reset Curve"), 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); uiBlockSetDirection(block, UI_RIGHT); uiTextBoundsBlock(block, 50); @@ -1819,24 +1819,24 @@ static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labe uiBlockSetEmboss(block, UI_EMBOSSN); - bt= uiDefIconBut(block, BUT, 0, ICON_ZOOMIN, 0, 0, dx, dx, NULL, 0.0, 0.0, 0.0, 0.0, UI_translate_do_tooltip(N_("Zoom in"))); + bt= uiDefIconBut(block, BUT, 0, ICON_ZOOMIN, 0, 0, dx, dx, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Zoom in")); uiButSetFunc(bt, curvemap_buttons_zoom_in, cumap, NULL); - bt= uiDefIconBut(block, BUT, 0, ICON_ZOOMOUT, 0, 0, dx, dx, NULL, 0.0, 0.0, 0.0, 0.0, UI_translate_do_tooltip(N_("Zoom out"))); + bt= uiDefIconBut(block, BUT, 0, ICON_ZOOMOUT, 0, 0, dx, dx, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Zoom out")); uiButSetFunc(bt, curvemap_buttons_zoom_out, cumap, NULL); if(brush) - bt= uiDefIconBlockBut(block, curvemap_brush_tools_func, cumap, 0, ICON_MODIFIER, 0, 0, dx, dx, UI_translate_do_tooltip(N_("Tools"))); + bt= uiDefIconBlockBut(block, curvemap_brush_tools_func, cumap, 0, ICON_MODIFIER, 0, 0, dx, dx, TIP_("Tools")); else - bt= uiDefIconBlockBut(block, curvemap_tools_func, cumap, 0, ICON_MODIFIER, 0, 0, dx, dx, UI_translate_do_tooltip(N_("Tools"))); + bt= uiDefIconBlockBut(block, curvemap_tools_func, cumap, 0, ICON_MODIFIER, 0, 0, dx, dx, TIP_("Tools")); uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL); if(cumap->flag & CUMA_DO_CLIP) icon= ICON_CLIPUV_HLT; else icon= ICON_CLIPUV_DEHLT; - bt= uiDefIconBlockBut(block, curvemap_clipping_func, cumap, 0, icon, 0, 0, dx, dx, UI_translate_do_tooltip(N_("Clipping Options"))); + bt= uiDefIconBlockBut(block, curvemap_clipping_func, cumap, 0, icon, 0, 0, dx, dx, TIP_("Clipping Options")); uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL); - bt= uiDefIconBut(block, BUT, 0, ICON_X, 0, 0, dx, dx, NULL, 0.0, 0.0, 0.0, 0.0, UI_translate_do_tooltip(N_("Delete points"))); + bt= uiDefIconBut(block, BUT, 0, ICON_X, 0, 0, dx, dx, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Delete points")); uiButSetNFunc(bt, curvemap_buttons_delete, MEM_dupallocN(cb), cumap); uiBlockSetEmboss(block, UI_EMBOSS); @@ -1855,8 +1855,8 @@ static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labe uiItemR(uiLayoutColumn(split, 0), ptr, "white_level", UI_ITEM_R_EXPAND, NULL, ICON_NONE); uiLayoutRow(layout, 0); - bt=uiDefBut(block, BUT, 0, UI_translate_do_iface(N_("Reset")), 0, 0, UI_UNIT_X*10, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, - UI_translate_do_tooltip(N_("Reset Black/White point and curves"))); + bt=uiDefBut(block, BUT, 0, IFACE_("Reset"), 0, 0, UI_UNIT_X*10, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, + TIP_("Reset Black/White point and curves")); uiButSetNFunc(bt, curvemap_buttons_reset, MEM_dupallocN(cb), cumap); } @@ -2475,18 +2475,18 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C) (void)ui_abs; // UNUSED uiDefIconBut(block, BUT, handle_event, ICON_PANEL_CLOSE, - 0, UI_UNIT_Y*0.1, UI_UNIT_X*0.8, UI_UNIT_Y*0.8, NULL, 0.0f, 0.0f, 0, 0, UI_translate_do_tooltip(N_("Stop this job"))); + 0, UI_UNIT_Y*0.1, UI_UNIT_X*0.8, UI_UNIT_Y*0.8, NULL, 0.0f, 0.0f, 0, 0, TIP_("Stop this job")); uiDefBut(block, PROGRESSBAR, 0, WM_jobs_name(wm, owner), - UI_UNIT_X, 0, 100, UI_UNIT_Y, NULL, 0.0f, 0.0f, WM_jobs_progress(wm, owner), 0, UI_translate_do_tooltip(N_("Progress"))); + UI_UNIT_X, 0, 100, UI_UNIT_Y, NULL, 0.0f, 0.0f, WM_jobs_progress(wm, owner), 0, TIP_("Progress")); uiLayoutRow(layout, 0); } if(WM_jobs_test(wm, screen)) - uiDefIconTextBut(block, BUT, B_STOPCAST, ICON_CANCEL, UI_translate_do_iface(N_("Capture")), 0,0,85,UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, - UI_translate_do_tooltip(N_("Stop screencast"))); + uiDefIconTextBut(block, BUT, B_STOPCAST, ICON_CANCEL, IFACE_("Capture"), 0,0,85,UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, + TIP_("Stop screencast")); if(screen->animtimer) - uiDefIconTextBut(block, BUT, B_STOPANIM, ICON_CANCEL, UI_translate_do_tooltip(N_("Anim Player")), 0,0,100,UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, - UI_translate_do_tooltip(N_("Stop animation playback"))); + uiDefIconTextBut(block, BUT, B_STOPANIM, ICON_CANCEL, TIP_("Anim Player"), 0,0,100,UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, + TIP_("Stop animation playback")); } /************************* Reports for Last Operator Template **************************/ @@ -2548,7 +2548,7 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C) uiBlockSetEmboss(block, UI_EMBOSSN); if (reports->list.first != reports->list.last) - uiDefIconButO(block, BUT, "UI_OT_reports_to_textblock", WM_OP_INVOKE_REGION_WIN, icon, 2, 0, UI_UNIT_X, UI_UNIT_Y, UI_translate_do_tooltip(N_("Click to see rest of reports in textblock: 'Recent Reports'"))); + uiDefIconButO(block, BUT, "UI_OT_reports_to_textblock", WM_OP_INVOKE_REGION_WIN, icon, 2, 0, UI_UNIT_X, UI_UNIT_Y, TIP_("Click to see rest of reports in textblock: 'Recent Reports'")); else uiDefIconBut(block, LABEL, 0, icon, 2, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, ""); diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c index 206ecbad1d0..23d5e77b78d 100644 --- a/source/blender/editors/interface/interface_utils.c +++ b/source/blender/editors/interface/interface_utils.c @@ -117,7 +117,7 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind } case PROP_COLLECTION: { char text[256]; - BLI_snprintf(text, sizeof(text), UI_translate_do_iface(N_("%d items")), RNA_property_collection_length(ptr, prop)); + BLI_snprintf(text, sizeof(text), IFACE_("%d items"), RNA_property_collection_length(ptr, prop)); but= uiDefBut(block, LABEL, 0, text, x1, y1, x2, y2, NULL, 0, 0, 0, 0, NULL); uiButSetFlag(but, UI_BUT_DISABLED); break; diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index fd511948bac..61936fba931 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -1127,7 +1127,7 @@ void init_userdef_do_versions(void) } if(U.mixbufsize==0) U.mixbufsize= 2048; if (strcmp(U.tempdir, "/") == 0) { - BLI_where_is_temp(U.tempdir, sizeof(U.tempdir), FALSE); + BLI_system_temporary_dir(U.tempdir); } if (U.autokey_mode == 0) { /* 'add/replace' but not on */ diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 304f167a61f..2db00ac83c1 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -1282,7 +1282,7 @@ static const char *editortype_pup(void) "|Python Console %x18" ); - return UI_translate_do_iface(types); + return IFACE_(types); } static void spacefunc(struct bContext *C, void *UNUSED(arg1), void *UNUSED(arg2)) @@ -1304,7 +1304,7 @@ int ED_area_header_switchbutton(const bContext *C, uiBlock *block, int yco) but= uiDefIconTextButC(block, ICONTEXTROW, 0, ICON_VIEW3D, editortype_pup(), xco, yco, UI_UNIT_X+10, UI_UNIT_Y, &(sa->butspacetype), 1.0, SPACEICONMAX, 0, 0, - UI_translate_do_tooltip(N_("Displays current editor type. Click for menu of available types"))); + TIP_("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 */ diff --git a/source/blender/editors/space_buttons/buttons_header.c b/source/blender/editors/space_buttons/buttons_header.c index b18b5373240..dfbb2a543cb 100644 --- a/source/blender/editors/space_buttons/buttons_header.c +++ b/source/blender/editors/space_buttons/buttons_header.c @@ -125,7 +125,7 @@ void buttons_header_buttons(const bContext *C, ARegion *ar) #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, UI_translate_do_tooltip(_tip)); \ + 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_(_tip)); \ uiButClearFlag(but, UI_BUT_UNDO); \ } \ diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index 85edcce35ca..6fbfa11d0cf 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -182,7 +182,7 @@ void file_draw_buttons(const bContext *C, ARegion *ar) but = uiDefButTextO(block, TEX, "FILE_OT_directory", 0, "", min_x, line1_y, line1_w-chan_offs, btn_h, params->dir, 0.0, (float)FILE_MAX, 0, 0, - UI_translate_do_tooltip(N_("File path"))); + TIP_("File path")); uiButSetCompleteFunc(but, autocomplete_directory, NULL); uiButSetFlag(but, UI_BUT_NO_UTF8); @@ -190,7 +190,7 @@ void file_draw_buttons(const bContext *C, ARegion *ar) but = uiDefBut(block, TEX, B_FS_FILENAME, "", min_x, line2_y, line2_w-chan_offs, btn_h, params->file, 0.0, (float)FILE_MAXFILE, 0, 0, - UI_translate_do_tooltip(overwrite_alert ?N_("File name, overwrite existing") : N_("File name"))); + TIP_(overwrite_alert ?N_("File name, overwrite existing") : N_("File name"))); uiButSetCompleteFunc(but, autocomplete_file, NULL); uiButSetFlag(but, UI_BUT_NO_UTF8); @@ -208,15 +208,15 @@ void file_draw_buttons(const bContext *C, ARegion *ar) if (fnumbuttons && (params->flag & FILE_DIRSEL_ONLY) == 0) { uiBlockBeginAlign(block); but = uiDefIconButO(block, BUT, "FILE_OT_filenum", 0, ICON_ZOOMOUT, - min_x + line2_w + separator - chan_offs, line2_y, - btn_fn_w, btn_h, - UI_translate_do_tooltip(N_("Decrement the filename number"))); + min_x + line2_w + separator - chan_offs, line2_y, + btn_fn_w, btn_h, + TIP_("Decrement the filename number")); RNA_int_set(uiButGetOperatorPtrRNA(but), "increment", -1); - but = uiDefIconButO(block, BUT, "FILE_OT_filenum", 0, ICON_ZOOMIN, - min_x + line2_w + separator + btn_fn_w - chan_offs, line2_y, - btn_fn_w, btn_h, - UI_translate_do_tooltip(N_("Increment the filename number"))); + but = uiDefIconButO(block, BUT, "FILE_OT_filenum", 0, ICON_ZOOMIN, + min_x + line2_w + separator + btn_fn_w - chan_offs, line2_y, + btn_fn_w, btn_h, + TIP_("Increment the filename number")); RNA_int_set(uiButGetOperatorPtrRNA(but), "increment", 1); uiBlockEndAlign(block); } @@ -227,9 +227,9 @@ void file_draw_buttons(const bContext *C, ARegion *ar) uiDefButO(block, BUT, "FILE_OT_execute", WM_OP_EXEC_REGION_WIN, params->title, max_x - loadbutton, line1_y, loadbutton, btn_h, params->title); - uiDefButO(block, BUT, "FILE_OT_cancel", WM_OP_EXEC_REGION_WIN, UI_translate_do_iface(N_("Cancel")), + uiDefButO(block, BUT, "FILE_OT_cancel", WM_OP_EXEC_REGION_WIN, IFACE_("Cancel"), max_x - loadbutton, line2_y, loadbutton, btn_h, - UI_translate_do_tooltip(N_("Cancel"))); + TIP_("Cancel")); } uiEndBlock(C, block); diff --git a/source/blender/editors/space_file/file_panels.c b/source/blender/editors/space_file/file_panels.c index 37dce293d77..fae10c0d84e 100644 --- a/source/blender/editors/space_file/file_panels.c +++ b/source/blender/editors/space_file/file_panels.c @@ -146,7 +146,7 @@ static void file_panel_bookmarks(const bContext *C, Panel *pa) if(sfile) { row= uiLayoutRow(pa->layout, 0); - uiItemO(row, UI_translate_do_iface(N_("Add")), ICON_ZOOMIN, "file.bookmark_add"); + uiItemO(row, IFACE_("Add"), ICON_ZOOMIN, "file.bookmark_add"); uiItemL(row, NULL, ICON_NONE); file_panel_category(C, pa, FS_CATEGORY_BOOKMARKS, &sfile->bookmarknr, ICON_BOOKMARKS, 1, 0); diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c index f36145aaba0..149d84b86cd 100644 --- a/source/blender/editors/space_file/filesel.c +++ b/source/blender/editors/space_file/filesel.c @@ -613,7 +613,7 @@ void autocomplete_directory(struct bContext *C, char *str, void *UNUSED(arg_v)) DIR *dir; struct dirent *de; - BLI_split_dirfile(str, dirname, NULL, sizeof(dirname), 0); + BLI_split_dir_part(str, dirname, sizeof(dirname)); dir = opendir(dirname); diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c index f1593105d5b..51a24044deb 100644 --- a/source/blender/editors/space_graph/graph_buttons.c +++ b/source/blender/editors/space_graph/graph_buttons.c @@ -754,8 +754,8 @@ static void graph_panel_modifiers(const bContext *C, Panel *pa) block= uiLayoutGetBlock(row); // XXX for now, this will be a operator button which calls a 'add modifier' operator - uiDefButO(block, BUT, "GRAPH_OT_fmodifier_add", WM_OP_INVOKE_REGION_WIN, UI_translate_do_iface(N_("Add Modifier")), 10, 0, 150, 20, - UI_translate_do_tooltip(N_("Adds a new F-Curve Modifier for the active F-Curve"))); + uiDefButO(block, BUT, "GRAPH_OT_fmodifier_add", WM_OP_INVOKE_REGION_WIN, IFACE_("Add Modifier"), 10, 0, 150, 20, + TIP_("Adds a new F-Curve Modifier for the active F-Curve")); /* copy/paste (as sub-row)*/ row= uiLayoutRow(row, 1); diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c index 9157df6960f..bafcf36e646 100644 --- a/source/blender/editors/space_info/space_info.c +++ b/source/blender/editors/space_info/space_info.c @@ -280,7 +280,7 @@ static void recent_files_menu_draw(const bContext *UNUSED(C), Menu *menu) uiItemStringO(layout, BLI_path_basename(recent->filepath), ICON_FILE_BLEND, "WM_OT_open_mainfile", "filepath", recent->filepath); } } else { - uiItemL(layout, UI_translate_do_iface(N_("No Recent Files")), ICON_NONE); + uiItemL(layout, IFACE_("No Recent Files"), ICON_NONE); } } @@ -290,7 +290,7 @@ static void recent_files_menu_register(void) mt= MEM_callocN(sizeof(MenuType), "spacetype info menu recent files"); strcpy(mt->idname, "INFO_MT_file_open_recent"); - strcpy(mt->label, _("Open Recent...")); + strcpy(mt->label, N_("Open Recent...")); mt->draw= recent_files_menu_draw; WM_menutype_add(mt); } diff --git a/source/blender/editors/space_nla/nla_buttons.c b/source/blender/editors/space_nla/nla_buttons.c index 5e1f2745559..7ba33e7e57e 100644 --- a/source/blender/editors/space_nla/nla_buttons.c +++ b/source/blender/editors/space_nla/nla_buttons.c @@ -448,8 +448,8 @@ static void nla_panel_modifiers(const bContext *C, Panel *pa) // XXX for now, this will be a operator button which calls a temporary 'add modifier' operator // FIXME: we need to set the only-active property so that this will only add modifiers for the active strip (not all selected) - uiDefButO(block, BUT, "NLA_OT_fmodifier_add", WM_OP_INVOKE_REGION_WIN, UI_translate_do_iface(N_("Add Modifier")), 10, 0, 150, 20, - UI_translate_do_tooltip(N_("Adds a new F-Modifier for the active NLA Strip"))); + uiDefButO(block, BUT, "NLA_OT_fmodifier_add", WM_OP_INVOKE_REGION_WIN, IFACE_("Add Modifier"), 10, 0, 150, 20, + TIP_("Adds a new F-Modifier for the active NLA Strip")); /* copy/paste (as sub-row)*/ row= uiLayoutRow(row, 1); diff --git a/source/blender/editors/space_node/node_header.c b/source/blender/editors/space_node/node_header.c index 82b78840d0f..f10730f7dcd 100644 --- a/source/blender/editors/space_node/node_header.c +++ b/source/blender/editors/space_node/node_header.c @@ -228,7 +228,6 @@ static void node_add_menu(bContext *C, uiLayout *layout, void *arg_nodeclass) } } -#define IFACE_(msgid) UI_translate_do_iface(msgid) static void node_menu_add(const bContext *C, Menu *menu) { Scene *scene= CTX_data_scene(C); @@ -239,44 +238,43 @@ static void node_menu_add(const bContext *C, Menu *menu) uiLayoutSetActive(layout, 0); if(snode->treetype==NTREE_SHADER) { - uiItemMenuF(layout, IFACE_(N_("Input")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_INPUT)); - uiItemMenuF(layout, IFACE_(N_("Output")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OUTPUT)); + uiItemMenuF(layout, IFACE_("Input"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_INPUT)); + uiItemMenuF(layout, IFACE_("Output"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OUTPUT)); if(scene_use_new_shading_nodes(scene)) { - uiItemMenuF(layout, IFACE_(N_("Shader")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_SHADER)); - uiItemMenuF(layout, IFACE_(N_("Texture")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_TEXTURE)); + uiItemMenuF(layout, IFACE_("Shader"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_SHADER)); + uiItemMenuF(layout, IFACE_("Texture"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_TEXTURE)); } - uiItemMenuF(layout, IFACE_(N_("Color")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_COLOR)); - uiItemMenuF(layout, IFACE_(N_("Vector")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_VECTOR)); - uiItemMenuF(layout, IFACE_(N_("Convertor")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_CONVERTOR)); - uiItemMenuF(layout, IFACE_(N_("Group")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_GROUP)); - //uiItemMenuF(layout, IFACE_(N_("Dynamic")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_DYNAMIC)); - uiItemMenuF(layout, IFACE_(N_("Layout")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_LAYOUT)); + uiItemMenuF(layout, IFACE_("Color"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_COLOR)); + uiItemMenuF(layout, IFACE_("Vector"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_VECTOR)); + uiItemMenuF(layout, IFACE_("Convertor"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_CONVERTOR)); + uiItemMenuF(layout, IFACE_("Group"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_GROUP)); + //uiItemMenuF(layout, IFACE_("Dynamic"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_DYNAMIC)); + uiItemMenuF(layout, IFACE_("Layout"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_LAYOUT)); } else if(snode->treetype==NTREE_COMPOSIT) { - uiItemMenuF(layout, IFACE_(N_("Input")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_INPUT)); - uiItemMenuF(layout, IFACE_(N_("Output")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OUTPUT)); - uiItemMenuF(layout, IFACE_(N_("Color")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_COLOR)); - uiItemMenuF(layout, IFACE_(N_("Vector")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_VECTOR)); - uiItemMenuF(layout, IFACE_(N_("Filter")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_FILTER)); - uiItemMenuF(layout, IFACE_(N_("Convertor")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_CONVERTOR)); - uiItemMenuF(layout, IFACE_(N_("Matte")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_MATTE)); - uiItemMenuF(layout, IFACE_(N_("Distort")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_DISTORT)); - uiItemMenuF(layout, IFACE_(N_("Group")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_GROUP)); - uiItemMenuF(layout, IFACE_(N_("Layout")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_LAYOUT)); + uiItemMenuF(layout, IFACE_("Input"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_INPUT)); + uiItemMenuF(layout, IFACE_("Output"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OUTPUT)); + uiItemMenuF(layout, IFACE_("Color"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_COLOR)); + uiItemMenuF(layout, IFACE_("Vector"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_VECTOR)); + uiItemMenuF(layout, IFACE_("Filter"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_FILTER)); + uiItemMenuF(layout, IFACE_("Convertor"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_CONVERTOR)); + uiItemMenuF(layout, IFACE_("Matte"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_MATTE)); + uiItemMenuF(layout, IFACE_("Distort"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_DISTORT)); + uiItemMenuF(layout, IFACE_("Group"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_GROUP)); + uiItemMenuF(layout, IFACE_("Layout"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_LAYOUT)); } else if(snode->treetype==NTREE_TEXTURE) { - uiItemMenuF(layout, IFACE_(N_("Input")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_INPUT)); - uiItemMenuF(layout, IFACE_(N_("Output")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OUTPUT)); - uiItemMenuF(layout, IFACE_(N_("Color")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_COLOR)); - uiItemMenuF(layout, IFACE_(N_("Patterns")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_PATTERN)); - uiItemMenuF(layout, IFACE_(N_("Textures")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_TEXTURE)); - uiItemMenuF(layout, IFACE_(N_("Convertor")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_CONVERTOR)); - uiItemMenuF(layout, IFACE_(N_("Distort")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_DISTORT)); - uiItemMenuF(layout, IFACE_(N_("Group")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_GROUP)); - uiItemMenuF(layout, IFACE_(N_("Layout")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_LAYOUT)); + uiItemMenuF(layout, IFACE_("Input"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_INPUT)); + uiItemMenuF(layout, IFACE_("Output"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OUTPUT)); + uiItemMenuF(layout, IFACE_("Color"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_COLOR)); + uiItemMenuF(layout, IFACE_("Patterns"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_PATTERN)); + uiItemMenuF(layout, IFACE_("Textures"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_TEXTURE)); + uiItemMenuF(layout, IFACE_("Convertor"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_CONVERTOR)); + uiItemMenuF(layout, IFACE_("Distort"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_DISTORT)); + uiItemMenuF(layout, IFACE_("Group"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_GROUP)); + uiItemMenuF(layout, IFACE_("Layout"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_LAYOUT)); } } -#undef IFACE_ void node_menus_register(void) { diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index 7e4d02036ef..2b78bc3c190 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -321,7 +321,7 @@ static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoad char dir_only[FILE_MAX]; char file_only[FILE_MAX]; - BLI_split_dirfile(seq_load.path, dir_only, NULL, sizeof(dir_only), 0); + BLI_split_dir_part(seq_load.path, dir_only, sizeof(dir_only)); RNA_BEGIN(op->ptr, itemptr, "files") { RNA_string_get(&itemptr, "name", file_only); diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c index fd27dc65a0e..55f49654f32 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -275,22 +275,16 @@ static int modeselect_addmode(char *str, const char *title, int id, int icon) { static char formatstr[] = "|%s %%x%d %%i%d"; - if(UI_translate_iface()) - return sprintf(str, formatstr, BLF_gettext(title), id, icon); - else - return sprintf(str, formatstr, title, id, icon); + return sprintf(str, formatstr, IFACE_(title), id, icon); } static char *view3d_modeselect_pup(Scene *scene) { Object *ob= OBACT; static char string[256]; - const char *title= N_("Mode: %t"); + const char *title= IFACE_("Mode: %t"); char *str = string; - if(U.transopts&USER_TR_IFACE) - title= BLF_gettext(title); - BLI_strncpy(str, title, sizeof(string)); str += modeselect_addmode(str, N_("Object Mode"), OB_MODE_OBJECT, ICON_OBJECT_DATA); @@ -470,7 +464,6 @@ void uiTemplateEditModeSelection(uiLayout *layout, struct bContext *C) } } -#define TIP_(msgid) UI_translate_do_tooltip(msgid) void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) { bScreen *screen= CTX_wm_screen(C); @@ -504,7 +497,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) uiBlockBeginAlign(block); uiDefIconTextButS(block, MENU, B_MODESELECT, object_mode_icon(v3d->modeselect), view3d_modeselect_pup(scene) , - 0,0,126 * dpi_fac, UI_UNIT_Y, &(v3d->modeselect), 0, 0, 0, 0, TIP_(N_("Mode"))); + 0,0,126 * dpi_fac, UI_UNIT_Y, &(v3d->modeselect), 0, 0, 0, 0, TIP_("Mode")); uiBlockEndAlign(block); /* Draw type */ @@ -543,11 +536,11 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) block= uiLayoutGetBlock(row); if(v3d->twflag & V3D_USE_MANIPULATOR) { - but= uiDefIconButBitC(block, TOG, V3D_MANIP_TRANSLATE, B_MAN_TRANS, ICON_MAN_TRANS, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, TIP_(N_("Translate manipulator mode"))); + but= uiDefIconButBitC(block, TOG, V3D_MANIP_TRANSLATE, B_MAN_TRANS, ICON_MAN_TRANS, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, TIP_("Translate manipulator mode")); uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */ - but= uiDefIconButBitC(block, TOG, V3D_MANIP_ROTATE, B_MAN_ROT, ICON_MAN_ROT, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, TIP_(N_("Rotate manipulator mode"))); + but= uiDefIconButBitC(block, TOG, V3D_MANIP_ROTATE, B_MAN_ROT, ICON_MAN_ROT, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, TIP_("Rotate manipulator mode")); uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */ - but= uiDefIconButBitC(block, TOG, V3D_MANIP_SCALE, B_MAN_SCALE, ICON_MAN_SCALE, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, TIP_(N_("Scale manipulator mode"))); + but= uiDefIconButBitC(block, TOG, V3D_MANIP_SCALE, B_MAN_SCALE, ICON_MAN_SCALE, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, TIP_("Scale manipulator mode")); uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */ } @@ -555,8 +548,8 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) v3d->twmode = 0; } - str_menu = BIF_menustringTransformOrientation(C, N_("Orientation")); - but= uiDefButC(block, MENU, B_MAN_MODE, str_menu,0,0,70 * dpi_fac, UI_UNIT_Y, &v3d->twmode, 0, 0, 0, 0, TIP_(N_("Transform Orientation"))); + str_menu = BIF_menustringTransformOrientation(C, "Orientation"); + but= uiDefButC(block, MENU, B_MAN_MODE, str_menu,0,0,70 * dpi_fac, UI_UNIT_Y, &v3d->twmode, 0, 0, 0, 0, TIP_("Transform Orientation")); uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */ MEM_freeN((void *)str_menu); } @@ -576,4 +569,3 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) uiTemplateEditModeSelection(layout, C); } -#undef TIP_ diff --git a/source/blender/editors/space_view3d/view3d_toolbar.c b/source/blender/editors/space_view3d/view3d_toolbar.c index 49131b0460c..a3b9e008fa0 100644 --- a/source/blender/editors/space_view3d/view3d_toolbar.c +++ b/source/blender/editors/space_view3d/view3d_toolbar.c @@ -82,7 +82,7 @@ static void view3d_panel_operator_redo_header(const bContext *C, Panel *pa) wmOperator *op= WM_operator_last_redo(C); if(op) BLI_strncpy(pa->drawname, op->type->name, sizeof(pa->drawname)); - else BLI_strncpy(pa->drawname, N_("Operator"), sizeof(pa->drawname)); + else BLI_strncpy(pa->drawname, IFACE_("Operator"), sizeof(pa->drawname)); } static void view3d_panel_operator_redo_operator(const bContext *C, Panel *pa, wmOperator *op) diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h index 2f177239f44..7fccbcb0097 100644 --- a/source/blender/editors/transform/transform.h +++ b/source/blender/editors/transform/transform.h @@ -152,7 +152,7 @@ typedef struct TransData2D { float loc[3]; /* Location of data used to transform (x,y,0) */ float *loc2d; /* Pointer to real 2d location of data */ - float *h1, *h2; /* Pointer to handle locations, if handles aren't being moved independantly*/ + float *h1, *h2; /* Pointer to handle locations, if handles aren't being moved independently */ float ih1[2], ih2[2]; } TransData2D; diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index cd4cbc77c49..3a7fad24d6b 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -410,18 +410,15 @@ EnumPropertyItem *BIF_enumTransformOrientation(bContext *C) } const char * BIF_menustringTransformOrientation(const bContext *C, const char *title) { - const char* menu = N_("%t|Global%x0|Local%x1|Gimbal%x4|Normal%x2|View%x3"); + const char* menu = IFACE_("%t|Global%x0|Local%x1|Gimbal%x4|Normal%x2|View%x3"); ListBase *transform_spaces = &CTX_data_scene(C)->transform_spaces; TransformOrientation *ts; int i = V3D_MANIP_CUSTOM; char *str_menu, *p; - if(UI_translate_iface()) { - title= BLF_gettext(title); - menu= BLF_gettext(menu); - } - - str_menu = MEM_callocN(strlen(menu) + strlen(title) + 1 + 40 * BIF_countTransformOrientation(C), UI_translate_do_tooltip(N_("UserTransSpace from matrix"))); + title = IFACE_(title); + + str_menu = MEM_callocN(strlen(menu) + strlen(title) + 1 + 40 * BIF_countTransformOrientation(C), TIP_("UserTransSpace from matrix")); p = str_menu; p += sprintf(str_menu, "%s", title); diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 5914809c279..42b78e3ff7e 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -544,9 +544,9 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr PointerPropertyRNA *pprop= (PointerPropertyRNA*)prop; rna_print_data_get(f, dp); if(dp->dnapointerlevel == 0) - fprintf(f, " return rna_pointer_inherit_refine(ptr, &RNA_%s, &data->%s);\n", (char*)pprop->type, dp->dnaname); + fprintf(f, " return rna_pointer_inherit_refine(ptr, &RNA_%s, &data->%s);\n", (const char*)pprop->type, dp->dnaname); else - fprintf(f, " return rna_pointer_inherit_refine(ptr, &RNA_%s, data->%s);\n", (char*)pprop->type, dp->dnaname); + fprintf(f, " return rna_pointer_inherit_refine(ptr, &RNA_%s, data->%s);\n", (const char*)pprop->type, dp->dnaname); } fprintf(f, "}\n\n"); break; @@ -560,7 +560,7 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr if(strcmp(manualfunc, "rna_iterator_listbase_get") == 0 || strcmp(manualfunc, "rna_iterator_array_get") == 0 || strcmp(manualfunc, "rna_iterator_array_dereference_get") == 0) - fprintf(f, " return rna_pointer_inherit_refine(&iter->parent, &RNA_%s, %s(iter));\n", (cprop->item_type)? (char*)cprop->item_type: "UnknownType", manualfunc); + fprintf(f, " return rna_pointer_inherit_refine(&iter->parent, &RNA_%s, %s(iter));\n", (cprop->item_type)? (const char*)cprop->item_type: "UnknownType", manualfunc); else fprintf(f, " return %s(iter);\n", manualfunc); } @@ -707,7 +707,7 @@ static void rna_clamp_value(FILE *f, PropertyRNA *prop, int array) fprintf(f, "value;\n"); } -static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, char *manualfunc) +static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc) { char *func; @@ -771,7 +771,7 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr } else { PointerPropertyRNA *pprop= (PointerPropertyRNA*)dp->prop; - StructRNA *type= rna_find_struct((char*)pprop->type); + StructRNA *type= rna_find_struct((const char*)pprop->type); if(type && (type->flag & STRUCT_ID)) { fprintf(f, " if(value.data)\n"); fprintf(f, " id_lib_extern((ID*)value.data);\n\n"); @@ -883,7 +883,7 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr return func; } -static char *rna_def_property_length_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, char *manualfunc) +static char *rna_def_property_length_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc) { char *func= NULL; @@ -941,7 +941,7 @@ static char *rna_def_property_length_func(FILE *f, StructRNA *srna, PropertyRNA return func; } -static char *rna_def_property_begin_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, char *manualfunc) +static char *rna_def_property_begin_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc) { char *func, *getfunc; @@ -999,7 +999,7 @@ static char *rna_def_property_begin_func(FILE *f, StructRNA *srna, PropertyRNA * return func; } -static char *rna_def_property_lookup_int_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, char *manualfunc, char *nextfunc) +static char *rna_def_property_lookup_int_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc, const char *nextfunc) { /* note on indices, this is for external functions and ignores skipped values. * so the the index can only be checked against the length when there is no 'skip' funcion. */ @@ -1078,7 +1078,7 @@ static char *rna_def_property_lookup_int_func(FILE *f, StructRNA *srna, Property #if 0 rna_print_data_get(f, dp); - item_type= (cprop->item_type)? (char*)cprop->item_type: "UnknownType"; + item_type= (cprop->item_type)? (const char*)cprop->item_type: "UnknownType"; if(dp->dnalengthname || dp->dnalengthfixed) { if(dp->dnalengthname) @@ -1099,7 +1099,7 @@ static char *rna_def_property_lookup_int_func(FILE *f, StructRNA *srna, Property return func; } -static char *rna_def_property_next_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, char *manualfunc) +static char *rna_def_property_next_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc) { char *func, *getfunc; @@ -1125,7 +1125,7 @@ static char *rna_def_property_next_func(FILE *f, StructRNA *srna, PropertyRNA *p return func; } -static char *rna_def_property_end_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, char *manualfunc) +static char *rna_def_property_end_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc) { char *func; @@ -1193,12 +1193,12 @@ static void rna_def_property_funcs(FILE *f, StructRNA *srna, PropertyDefRNA *dp) if(!bprop->get && !bprop->set && !dp->booleanbit) rna_set_raw_property(dp, prop); - bprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (char*)bprop->get); - bprop->set= (void*)rna_def_property_set_func(f, srna, prop, dp, (char*)bprop->set); + bprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (const char*)bprop->get); + bprop->set= (void*)rna_def_property_set_func(f, srna, prop, dp, (const char*)bprop->set); } else { - bprop->getarray= (void*)rna_def_property_get_func(f, srna, prop, dp, (char*)bprop->getarray); - bprop->setarray= (void*)rna_def_property_set_func(f, srna, prop, dp, (char*)bprop->setarray); + bprop->getarray= (void*)rna_def_property_get_func(f, srna, prop, dp, (const char*)bprop->getarray); + bprop->setarray= (void*)rna_def_property_set_func(f, srna, prop, dp, (const char*)bprop->setarray); } break; } @@ -1209,15 +1209,15 @@ static void rna_def_property_funcs(FILE *f, StructRNA *srna, PropertyDefRNA *dp) if(!iprop->get && !iprop->set) rna_set_raw_property(dp, prop); - iprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (char*)iprop->get); - iprop->set= (void*)rna_def_property_set_func(f, srna, prop, dp, (char*)iprop->set); + iprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (const char*)iprop->get); + iprop->set= (void*)rna_def_property_set_func(f, srna, prop, dp, (const char*)iprop->set); } else { if(!iprop->getarray && !iprop->setarray) rna_set_raw_property(dp, prop); - iprop->getarray= (void*)rna_def_property_get_func(f, srna, prop, dp, (char*)iprop->getarray); - iprop->setarray= (void*)rna_def_property_set_func(f, srna, prop, dp, (char*)iprop->setarray); + iprop->getarray= (void*)rna_def_property_get_func(f, srna, prop, dp, (const char*)iprop->getarray); + iprop->setarray= (void*)rna_def_property_set_func(f, srna, prop, dp, (const char*)iprop->setarray); } break; } @@ -1228,38 +1228,38 @@ static void rna_def_property_funcs(FILE *f, StructRNA *srna, PropertyDefRNA *dp) if(!fprop->get && !fprop->set) rna_set_raw_property(dp, prop); - fprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (char*)fprop->get); - fprop->set= (void*)rna_def_property_set_func(f, srna, prop, dp, (char*)fprop->set); + fprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (const char*)fprop->get); + fprop->set= (void*)rna_def_property_set_func(f, srna, prop, dp, (const char*)fprop->set); } else { if(!fprop->getarray && !fprop->setarray) rna_set_raw_property(dp, prop); - fprop->getarray= (void*)rna_def_property_get_func(f, srna, prop, dp, (char*)fprop->getarray); - fprop->setarray= (void*)rna_def_property_set_func(f, srna, prop, dp, (char*)fprop->setarray); + fprop->getarray= (void*)rna_def_property_get_func(f, srna, prop, dp, (const char*)fprop->getarray); + fprop->setarray= (void*)rna_def_property_set_func(f, srna, prop, dp, (const char*)fprop->setarray); } break; } case PROP_ENUM: { EnumPropertyRNA *eprop= (EnumPropertyRNA*)prop; - eprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (char*)eprop->get); - eprop->set= (void*)rna_def_property_set_func(f, srna, prop, dp, (char*)eprop->set); + eprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (const char*)eprop->get); + eprop->set= (void*)rna_def_property_set_func(f, srna, prop, dp, (const char*)eprop->set); break; } case PROP_STRING: { StringPropertyRNA *sprop= (StringPropertyRNA*)prop; - sprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (char*)sprop->get); - sprop->length= (void*)rna_def_property_length_func(f, srna, prop, dp, (char*)sprop->length); - sprop->set= (void*)rna_def_property_set_func(f, srna, prop, dp, (char*)sprop->set); + sprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (const char*)sprop->get); + sprop->length= (void*)rna_def_property_length_func(f, srna, prop, dp, (const char*)sprop->length); + sprop->set= (void*)rna_def_property_set_func(f, srna, prop, dp, (const char*)sprop->set); break; } case PROP_POINTER: { PointerPropertyRNA *pprop= (PointerPropertyRNA*)prop; - pprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (char*)pprop->get); - pprop->set= (void*)rna_def_property_set_func(f, srna, prop, dp, (char*)pprop->set); + pprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (const char*)pprop->get); + pprop->set= (void*)rna_def_property_set_func(f, srna, prop, dp, (const char*)pprop->set); if(!pprop->type) { fprintf(stderr, "rna_def_property_funcs: %s.%s, pointer must have a struct type.\n", srna->identifier, prop->identifier); DefRNA.error= 1; @@ -1268,24 +1268,24 @@ static void rna_def_property_funcs(FILE *f, StructRNA *srna, PropertyDefRNA *dp) } case PROP_COLLECTION: { CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop; - char *nextfunc= (char*)cprop->next; + const char *nextfunc= (const char*)cprop->next; if(dp->dnatype && strcmp(dp->dnatype, "ListBase")==0); else if(dp->dnalengthname || dp->dnalengthfixed) - cprop->length= (void*)rna_def_property_length_func(f, srna, prop, dp, (char*)cprop->length); + cprop->length= (void*)rna_def_property_length_func(f, srna, prop, dp, (const char*)cprop->length); /* test if we can allow raw array access, if it is using our standard * array get/next function, we can be sure it is an actual array */ if(cprop->next && cprop->get) - if(strcmp((char*)cprop->next, "rna_iterator_array_next") == 0 && - strcmp((char*)cprop->get, "rna_iterator_array_get") == 0) + if(strcmp((const char*)cprop->next, "rna_iterator_array_next") == 0 && + strcmp((const char*)cprop->get, "rna_iterator_array_get") == 0) prop->flag |= PROP_RAW_ARRAY; - cprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (char*)cprop->get); - cprop->begin= (void*)rna_def_property_begin_func(f, srna, prop, dp, (char*)cprop->begin); - cprop->next= (void*)rna_def_property_next_func(f, srna, prop, dp, (char*)cprop->next); - cprop->end= (void*)rna_def_property_end_func(f, srna, prop, dp, (char*)cprop->end); - cprop->lookupint= (void*)rna_def_property_lookup_int_func(f, srna, prop, dp, (char*)cprop->lookupint, nextfunc); + cprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (const char*)cprop->get); + cprop->begin= (void*)rna_def_property_begin_func(f, srna, prop, dp, (const char*)cprop->begin); + cprop->next= (void*)rna_def_property_next_func(f, srna, prop, dp, (const char*)cprop->next); + cprop->end= (void*)rna_def_property_end_func(f, srna, prop, dp, (const char*)cprop->end); + cprop->lookupint= (void*)rna_def_property_lookup_int_func(f, srna, prop, dp, (const char*)cprop->lookupint, nextfunc); if(!(prop->flag & PROP_IDPROPERTY)) { if(!cprop->begin) { @@ -1414,7 +1414,7 @@ static void rna_def_property_funcs_header_cpp(FILE *f, StructRNA *srna, Property if(prop->flag & (PROP_IDPROPERTY|PROP_BUILTIN)) return; - if(prop->name && prop->description && strcmp(prop->description, "") != 0) + if(prop->name && prop->description && prop->description[0] != '\0') fprintf(f, "\t/* %s: %s */\n", prop->name, prop->description); else if(prop->name) fprintf(f, "\t/* %s */\n", prop->name); @@ -1468,7 +1468,7 @@ static void rna_def_property_funcs_header_cpp(FILE *f, StructRNA *srna, Property PointerPropertyRNA *pprop= (PointerPropertyRNA*)dp->prop; if(pprop->type) - fprintf(f, "\tinline %s %s(void);", (char*)pprop->type, rna_safe_id(prop->identifier)); + fprintf(f, "\tinline %s %s(void);", (const char*)pprop->type, rna_safe_id(prop->identifier)); else fprintf(f, "\tinline %s %s(void);", "UnknownType", rna_safe_id(prop->identifier)); break; @@ -1477,7 +1477,7 @@ static void rna_def_property_funcs_header_cpp(FILE *f, StructRNA *srna, Property CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)dp->prop; if(cprop->item_type) - fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s)", (char*)cprop->item_type, srna->identifier, rna_safe_id(prop->identifier)); + fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s)", (const char*)cprop->item_type, srna->identifier, rna_safe_id(prop->identifier)); else fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s)", "UnknownType", srna->identifier, rna_safe_id(prop->identifier)); break; @@ -1531,7 +1531,7 @@ static void rna_def_property_funcs_impl_cpp(FILE *f, StructRNA *srna, PropertyDe PointerPropertyRNA *pprop= (PointerPropertyRNA*)dp->prop; if(pprop->type) - fprintf(f, "\tPOINTER_PROPERTY(%s, %s, %s)", (char*)pprop->type, srna->identifier, rna_safe_id(prop->identifier)); + fprintf(f, "\tPOINTER_PROPERTY(%s, %s, %s)", (const char*)pprop->type, srna->identifier, rna_safe_id(prop->identifier)); else fprintf(f, "\tPOINTER_PROPERTY(%s, %s, %s)", "UnknownType", srna->identifier, rna_safe_id(prop->identifier)); break; @@ -1540,7 +1540,7 @@ static void rna_def_property_funcs_impl_cpp(FILE *f, StructRNA *srna, PropertyDe /*CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)dp->prop; if(cprop->type) - fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s)", (char*)cprop->type, srna->identifier, prop->identifier); + fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s)", (const char*)cprop->type, srna->identifier, prop->identifier); else fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s)", "UnknownType", srna->identifier, prop->identifier);*/ break; @@ -1763,7 +1763,7 @@ static void rna_auto_types(void) pprop->type= (StructRNA*)rna_find_type(dp->dnatype); if(pprop->type) { - type= rna_find_struct((char*)pprop->type); + type= rna_find_struct((const char*)pprop->type); if(type && (type->flag & STRUCT_ID_REFCOUNT)) pprop->property.flag |= PROP_ID_REFCOUNT; } @@ -2214,7 +2214,7 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr else fprintf(f, "\t0, -1"); /* our own type - collections/arrays only */ - if(prop->srna) fprintf(f, ", &RNA_%s", (char*)prop->srna); + if(prop->srna) fprintf(f, ", &RNA_%s", (const char*)prop->srna); else fprintf(f, ", NULL"); fprintf(f, "},\n"); @@ -2273,14 +2273,14 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr case PROP_POINTER: { PointerPropertyRNA *pprop= (PointerPropertyRNA*)prop; fprintf(f, "\t%s, %s, %s, %s,", rna_function_string(pprop->get), rna_function_string(pprop->set), rna_function_string(pprop->typef), rna_function_string(pprop->poll)); - if(pprop->type) fprintf(f, "&RNA_%s\n", (char*)pprop->type); + if(pprop->type) fprintf(f, "&RNA_%s\n", (const char*)pprop->type); else fprintf(f, "NULL\n"); break; } case PROP_COLLECTION: { CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop; fprintf(f, "\t%s, %s, %s, %s, %s, %s, %s, %s, ", rna_function_string(cprop->begin), rna_function_string(cprop->next), rna_function_string(cprop->end), rna_function_string(cprop->get), rna_function_string(cprop->length), rna_function_string(cprop->lookupint), rna_function_string(cprop->lookupstring), rna_function_string(cprop->assignint)); - if(cprop->item_type) fprintf(f, "&RNA_%s\n", (char*)cprop->item_type); + if(cprop->item_type) fprintf(f, "&RNA_%s\n", (const char*)cprop->item_type); else fprintf(f, "NULL\n"); break; } diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 8047b2df226..149497c85fb 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -1614,7 +1614,7 @@ void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, int value) group= RNA_struct_idprops(ptr, 1); if(group) - IDP_AddToGroup(group, IDP_New(IDP_INT, val, (char*)prop->identifier)); + IDP_AddToGroup(group, IDP_New(IDP_INT, val, prop->identifier)); } } @@ -1693,7 +1693,7 @@ void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, const in group= RNA_struct_idprops(ptr, 1); if(group) { - idprop= IDP_New(IDP_ARRAY, val, (char*)prop->identifier); + idprop= IDP_New(IDP_ARRAY, val, prop->identifier); IDP_AddToGroup(group, idprop); memcpy(IDP_Array(idprop), values, sizeof(int)*idprop->len); } @@ -1811,7 +1811,7 @@ void RNA_property_int_set(PointerRNA *ptr, PropertyRNA *prop, int value) group= RNA_struct_idprops(ptr, 1); if(group) - IDP_AddToGroup(group, IDP_New(IDP_INT, val, (char*)prop->identifier)); + IDP_AddToGroup(group, IDP_New(IDP_INT, val, prop->identifier)); } } @@ -1927,7 +1927,7 @@ void RNA_property_int_set_array(PointerRNA *ptr, PropertyRNA *prop, const int *v group= RNA_struct_idprops(ptr, 1); if(group) { - idprop= IDP_New(IDP_ARRAY, val, (char*)prop->identifier); + idprop= IDP_New(IDP_ARRAY, val, prop->identifier); IDP_AddToGroup(group, idprop); memcpy(IDP_Array(idprop), values, sizeof(int)*idprop->len); } @@ -2047,7 +2047,7 @@ void RNA_property_float_set(PointerRNA *ptr, PropertyRNA *prop, float value) group= RNA_struct_idprops(ptr, 1); if(group) - IDP_AddToGroup(group, IDP_New(IDP_FLOAT, val, (char*)prop->identifier)); + IDP_AddToGroup(group, IDP_New(IDP_FLOAT, val, prop->identifier)); } } @@ -2181,7 +2181,7 @@ void RNA_property_float_set_array(PointerRNA *ptr, PropertyRNA *prop, const floa group= RNA_struct_idprops(ptr, 1); if(group) { - idprop= IDP_New(IDP_ARRAY, val, (char*)prop->identifier); + idprop= IDP_New(IDP_ARRAY, val, prop->identifier); IDP_AddToGroup(group, idprop); memcpy(IDP_Array(idprop), values, sizeof(float)*idprop->len); } @@ -2328,7 +2328,7 @@ void RNA_property_string_set(PointerRNA *ptr, PropertyRNA *prop, const char *val BLI_assert(RNA_property_type(prop) == PROP_STRING); if((idprop=rna_idproperty_check(&prop, ptr))) - IDP_AssignString(idprop, (char*)value, RNA_property_string_maxlength(prop) - 1); + IDP_AssignString(idprop, value, RNA_property_string_maxlength(prop) - 1); else if(sprop->set) sprop->set(ptr, value); /* set function needs to clamp its self */ else if(prop->flag & PROP_EDITABLE) { @@ -2336,7 +2336,7 @@ void RNA_property_string_set(PointerRNA *ptr, PropertyRNA *prop, const char *val group= RNA_struct_idprops(ptr, 1); if(group) - IDP_AddToGroup(group, IDP_NewString((char*)value, (char*)prop->identifier, RNA_property_string_maxlength(prop) - 1)); + IDP_AddToGroup(group, IDP_NewString(value, prop->identifier, RNA_property_string_maxlength(prop) - 1)); } } @@ -2413,7 +2413,7 @@ void RNA_property_enum_set(PointerRNA *ptr, PropertyRNA *prop, int value) group= RNA_struct_idprops(ptr, 1); if(group) - IDP_AddToGroup(group, IDP_New(IDP_INT, val, (char*)prop->identifier)); + IDP_AddToGroup(group, IDP_New(IDP_INT, val, prop->identifier)); } } @@ -2509,7 +2509,7 @@ void RNA_property_pointer_add(PointerRNA *ptr, PropertyRNA *prop) group= RNA_struct_idprops(ptr, 1); if(group) - IDP_AddToGroup(group, IDP_New(IDP_GROUP, val, (char*)prop->identifier)); + IDP_AddToGroup(group, IDP_New(IDP_GROUP, val, prop->identifier)); } else printf("%s %s.%s: only supported for id properties.\n", __func__, ptr->type->identifier, prop->identifier); @@ -2885,7 +2885,7 @@ int RNA_property_collection_type_get(PointerRNA *ptr, PropertyRNA *prop, Pointer BLI_assert(RNA_property_type(prop) == PROP_COLLECTION); *r_ptr= *ptr; - return ((r_ptr->type = prop->srna) ? 1:0); + return ((r_ptr->type = rna_ensure_property(prop)->srna) ? 1:0); } int RNA_property_collection_raw_array(PointerRNA *ptr, PropertyRNA *prop, PropertyRNA *itemprop, RawArray *array) diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 43d5f87f0d5..a1d156a2b2a 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -820,7 +820,7 @@ static void psys_vg_name_set__internal(PointerRNA *ptr, const char *value, int i psys->vgroup[index]= 0; } else { - int vgroup_num = defgroup_name_index(ob, (char*)value); + int vgroup_num = defgroup_name_index(ob, value); if(vgroup_num == -1) return; diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index 9d72eeacf3e..3c2b771ae86 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -540,7 +540,7 @@ static int rna_Sequence_input_count_get(PointerRNA *ptr) static void rna_SequenceElement_filename_set(PointerRNA *ptr, const char *value) { StripElem *elem= (StripElem*)(ptr->data); - BLI_split_dirfile(value, NULL, elem->name, 0, sizeof(elem->name)); + BLI_split_file_part(value, elem->name, sizeof(elem->name)); }*/ static void rna_Sequence_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 0c3ff108c03..c6a76cf42b9 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -295,8 +295,7 @@ static void rna_userdef_addon_remove(bAddon *bext) static void rna_userdef_temp_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr)) { - extern char btempdir[]; - BLI_where_is_temp(btempdir, FILE_MAX, 1); + BLI_init_temporary_dir(U.tempdir); } static void rna_userdef_text_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr)) @@ -2512,36 +2511,36 @@ static void rna_def_userdef_system(BlenderRNA *brna) /* if you edit here, please also edit the source/blender/blenfont/intern/blf_lang.c 's locales */ static EnumPropertyItem language_items[] = { {0, "", 0, "Nearly done", ""}, - {0, "DEFAULT", 0, N_("Default (Default)"), ""}, - {1, "ENGLISH", 0, N_("English (English)"), "en_US"}, - {8, "FRENCH", 0, N_("French (Français)"), "fr_FR"}, - {9, "SPANISH", 0, N_("Spanish (Español)"), "es_ES"}, - {13, "SIMPLIFIED_CHINESE", 0, N_("Simplified Chinese (简体中文)"), "zh_CN"}, + {0, "DEFAULT", 0, "Default (Default)", ""}, + {1, "ENGLISH", 0, "English (English)", "en_US"}, + {8, "FRENCH", 0, "French (Français)", "fr_FR"}, + {9, "SPANISH", 0, "Spanish (Español)", "es_ES"}, + {13, "SIMPLIFIED_CHINESE", 0, "Simplified Chinese (简体中文)", "zh_CN"}, {0, "", 0, "In progress", ""}, - {2, "JAPANESE", 0, N_("Japanese (日本語)"), "ja_JP"}, - {3, "DUTCH", 0, N_("Dutch (Nederlandse taal)"), "nl_NL"}, - {4, "ITALIAN", 0, N_("Italian (Italiano)"), "it_IT"}, - {5, "GERMAN", 0, N_("German (Deutsch)"), "de_DE"}, - {6, "FINNISH", 0, N_("Finnish (Suomi)"), "fi_FI"}, - {7, "SWEDISH", 0, N_("Swedish (Svenska)"), "sv_SE"}, - {10, "CATALAN", 0, N_("Catalan (Català)"), "ca_AD"}, - {11, "CZECH", 0, N_("Czech (Český)"), "cs_CZ"}, - {12, "BRAZILIAN_PORTUGUESE", 0, N_("Brazilian Portuguese (Português do Brasil)"), "pt_BR"}, - {14, "TRADITIONAL_CHINESE", 0, N_("Traditional Chinese (繁體中文)"), "zh_TW"}, - {15, "RUSSIAN", 0, N_("Russian (Русский)"), "ru_RU"}, - {16, "CROATIAN", 0, N_("Croatian (Hrvatski)"), "hr_HR"}, - {17, "SERBIAN", 0, N_("Serbian (Српском језику)"), "sr_RS"}, - {18, "UKRAINIAN", 0, N_("Ukrainian (Український)"), "uk_UA"}, - {19, "POLISH", 0, N_("Polish (Polski)"), "pl_PL"}, - {20, "ROMANIAN", 0, N_("Romanian (Român)"), "ro_RO"}, + {2, "JAPANESE", 0, "Japanese (日本語)", "ja_JP"}, + {3, "DUTCH", 0, "Dutch (Nederlandse taal)", "nl_NL"}, + {4, "ITALIAN", 0, "Italian (Italiano)", "it_IT"}, + {5, "GERMAN", 0, "German (Deutsch)", "de_DE"}, + {6, "FINNISH", 0, "Finnish (Suomi)", "fi_FI"}, + {7, "SWEDISH", 0, "Swedish (Svenska)", "sv_SE"}, + {10, "CATALAN", 0, "Catalan (Català)", "ca_AD"}, + {11, "CZECH", 0, "Czech (Český)", "cs_CZ"}, + {12, "BRAZILIAN_PORTUGUESE", 0, "Brazilian Portuguese (Português do Brasil)", "pt_BR"}, + {14, "TRADITIONAL_CHINESE", 0, "Traditional Chinese (繁體中文)", "zh_TW"}, + {15, "RUSSIAN", 0, "Russian (Русский)", "ru_RU"}, + {16, "CROATIAN", 0, "Croatian (Hrvatski)", "hr_HR"}, + {17, "SERBIAN", 0, "Serbian (Српском језику)", "sr_RS"}, + {18, "UKRAINIAN", 0, "Ukrainian (Український)", "uk_UA"}, + {19, "POLISH", 0, "Polish (Polski)", "pl_PL"}, + {20, "ROMANIAN", 0, "Romanian (Român)", "ro_RO"}, /* using the utf8 flipped form of Arabic (العربية) */ - {21, "ARABIC", 0, N_("Arabic (ﺔﻴﺑﺮﻌﻟﺍ)"), "ar_EG"}, - {22, "BULGARIAN", 0, N_("Bulgarian (Български)"), "bg_BG"}, - {23, "GREEK", 0, N_("Greek (Ελληνικά)"), "el_GR"}, - {24, "KOREAN", 0, N_("Korean (한국 언어)"), "ko_KR"}, - /*{25, "NEPALI", 0, N_("Nepali (नेपाली)"), "ne_NP"},*/ + {21, "ARABIC", 0, "Arabic (ﺔﻴﺑﺮﻌﻟﺍ)", "ar_EG"}, + {22, "BULGARIAN", 0, "Bulgarian (Български)", "bg_BG"}, + {23, "GREEK", 0, "Greek (Ελληνικά)", "el_GR"}, + {24, "KOREAN", 0, "Korean (한국 언어)", "ko_KR"}, + /*{25, "NEPALI", 0, "Nepali (नेपाली)", "ne_NP"},*/ /* using the utf8 flipped form of Persian (فارسی) */ - {26, "PERSIAN", 0, N_("Persian (ﯽﺳﺭﺎﻓ)"), "fa_PE"}, + {26, "PERSIAN", 0, "Persian (ﯽﺳﺭﺎﻓ)", "fa_PE"}, {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "UserPreferencesSystem", NULL); diff --git a/source/blender/modifiers/intern/MOD_fluidsim_util.c b/source/blender/modifiers/intern/MOD_fluidsim_util.c index 277f0852f90..a2f62d55d69 100644 --- a/source/blender/modifiers/intern/MOD_fluidsim_util.c +++ b/source/blender/modifiers/intern/MOD_fluidsim_util.c @@ -105,7 +105,7 @@ void fluidsim_init(FluidsimModifierData *fluidmd) /* elubie: changed this to default to the same dir as the render output to prevent saving to C:\ on Windows */ - BLI_strncpy(fss->surfdataPath, btempdir, FILE_MAX); + BLI_strncpy(fss->surfdataPath, BLI_temporary_dir(), FILE_MAX); // first init of bounding box // no bounding box needed diff --git a/source/blender/python/BPY_extern.h b/source/blender/python/BPY_extern.h index cd5c8e53ef7..ae82dac7f14 100644 --- a/source/blender/python/BPY_extern.h +++ b/source/blender/python/BPY_extern.h @@ -36,8 +36,6 @@ #ifndef BPY_EXTERN_H #define BPY_EXTERN_H -extern char bprogname[]; /* holds a copy of argv[0], from creator.c */ - struct Text; /* defined in DNA_text_types.h */ struct ID; /* DNA_ID.h */ struct Object; /* DNA_object_types.h */ diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c index bd7be8dd9c5..c3d60bc353d 100644 --- a/source/blender/python/intern/bpy_app.c +++ b/source/blender/python/intern/bpy_app.c @@ -93,8 +93,6 @@ static PyStructSequence_Desc app_info_desc= { static PyObject *make_app_info(void) { - extern char bprogname[]; /* argv[0] from creator.c */ - PyObject *app_info; int pos= 0; @@ -118,7 +116,7 @@ static PyObject *make_app_info(void) SetStrItem(""); #endif SetStrItem(STRINGIFY(BLENDER_VERSION_CYCLE)); - SetStrItem(bprogname); + SetStrItem(BLI_program_path()); SetObjItem(PyBool_FromLong(G.background)); /* build info */ @@ -200,8 +198,7 @@ static int bpy_app_debug_value_set(PyObject *UNUSED(self), PyObject *value, void static PyObject *bpy_app_tempdir_get(PyObject *UNUSED(self), void *UNUSED(closure)) { - extern char btempdir[]; - return PyC_UnicodeFromByte(btempdir); + return PyC_UnicodeFromByte(BLI_temporary_dir()); } static PyObject *bpy_app_driver_dict_get(PyObject *UNUSED(self), void *UNUSED(closure)) diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index 725414a6104..a937dcb1c89 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -198,9 +198,9 @@ void BPY_python_start(int argc, const char **argv) PyThreadState *py_tstate= NULL; /* not essential but nice to set our name */ - static wchar_t bprogname_wchar[FILE_MAXDIR+FILE_MAXFILE]; /* python holds a reference */ - BLI_strncpy_wchar_from_utf8(bprogname_wchar, bprogname, sizeof(bprogname_wchar) / sizeof(wchar_t)); - Py_SetProgramName(bprogname_wchar); + static wchar_t program_path_wchar[FILE_MAXDIR+FILE_MAXFILE]; /* python holds a reference */ + BLI_strncpy_wchar_from_utf8(program_path_wchar, BLI_program_path(), sizeof(program_path_wchar) / sizeof(wchar_t)); + Py_SetProgramName(program_path_wchar); /* must run before python initializes */ PyImport_ExtendInittab(bpy_internal_modules); diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index e52df8f9320..a6306909699 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -1534,7 +1534,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb param= _PyUnicode_AsString(value); #ifdef WITH_INTERNATIONAL if (subtype == PROP_TRANSLATE) { - param= UI_translate_do_iface(param); + param= IFACE_(param); } #endif // WITH_INTERNATIONAL diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index a3e4e7821fd..864707d7060 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -479,7 +479,7 @@ static void scene_unique_exr_name(Scene *scene, char *str, int sample) else BLI_snprintf(name, sizeof(name), "%s_%s%d.exr", fi, scene->id.name+2, sample); - BLI_make_file_string("/", str, btempdir, name); + BLI_make_file_string("/", str, BLI_temporary_dir(), name); } static void render_unique_exr_name(Render *re, char *str, int sample) diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index 9e19a057175..34f59ce047d 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -267,6 +267,9 @@ void WM_gestures_remove(struct bContext *C); /* fileselecting support */ void WM_event_add_fileselect(struct bContext *C, struct wmOperator *op); void WM_event_fileselect_event(struct bContext *C, void *ophandle, int eventval); +#ifndef NDEBUG +void WM_event_print(struct wmEvent *event); +#endif /* drag and drop */ struct wmDrag *WM_event_start_drag(struct bContext *C, int icon, int type, void *poin, double value); diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index c08a14307b5..ae0019a60d6 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -80,6 +80,10 @@ #include "wm_event_types.h" #include "wm_draw.h" +#ifndef NDEBUG +# include "RNA_enum_types.h" +#endif + static int wm_operator_call_internal(bContext *C, wmOperatorType *ot, PointerRNA *properties, ReportList *reports, short context, short poll_only); /* ************ event management ************** */ @@ -441,6 +445,35 @@ static void wm_operator_print(bContext *C, wmOperator *op) MEM_freeN(buf); } +/* for debugging only, getting inspecting events manually is tedious */ +#ifndef NDEBUG + +void WM_event_print(wmEvent *event) +{ + if(event) { + const char *unknown= "UNKNOWN"; + const char *type_id= unknown; + const char *val_id= unknown; + + RNA_enum_identifier(event_type_items, event->type, &type_id); + RNA_enum_identifier(event_value_items, event->val, &val_id); + + printf("wmEvent - type:%d/%s, val:%d/%s, " + "shift:%d, ctrl:%d, alt:%d, oskey:%d, keymodifier:%d, " + "mouse:(%d,%d), ascii:'%c', utf8:'%.6s', " + "keymap_idname:%s, pointer:%p\n", + event->type, type_id, event->val, val_id, + event->shift, event->ctrl, event->alt, event->oskey, event->keymodifier, + event->x, event->y, event->ascii, event->utf8_buf, + event->keymap_idname, (void *)event); + } + else { + printf("wmEvent - NULL\n"); + } +} + +#endif /* NDEBUG */ + static void wm_operator_reports(bContext *C, wmOperator *op, int retval, int popup) { if(popup) { diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index bf5b60d691f..4cd31b8d894 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -289,8 +289,9 @@ static void wm_init_userdef(bContext *C) if ((U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0) G.f |= G_SCRIPT_AUTOEXEC; else G.f &= ~G_SCRIPT_AUTOEXEC; } + /* update tempdir from user preferences */ - BLI_where_is_temp(btempdir, FILE_MAX, 1); + BLI_init_temporary_dir(U.tempdir); } @@ -437,17 +438,17 @@ void WM_read_file(bContext *C, const char *filepath, ReportList *reports) else if(retval == BKE_READ_EXOTIC_OK_OTHER) BKE_write_undo(C, "Import file"); else if(retval == BKE_READ_EXOTIC_FAIL_OPEN) { - BKE_reportf(reports, RPT_ERROR, UI_translate_do_iface(N_("Can't read file: \"%s\", %s.")), filepath, - errno ? strerror(errno) : UI_translate_do_iface(N_("Unable to open the file"))); + BKE_reportf(reports, RPT_ERROR, IFACE_("Can't read file: \"%s\", %s."), filepath, + errno ? strerror(errno) : IFACE_("Unable to open the file")); } else if(retval == BKE_READ_EXOTIC_FAIL_FORMAT) { - BKE_reportf(reports, RPT_ERROR, UI_translate_do_iface(N_("File format is not supported in file: \"%s\".")), filepath); + BKE_reportf(reports, RPT_ERROR, IFACE_("File format is not supported in file: \"%s\"."), filepath); } else if(retval == BKE_READ_EXOTIC_FAIL_PATH) { - BKE_reportf(reports, RPT_ERROR, UI_translate_do_iface(N_("File path invalid: \"%s\".")), filepath); + BKE_reportf(reports, RPT_ERROR, IFACE_("File path invalid: \"%s\"."), filepath); } else { - BKE_reportf(reports, RPT_ERROR, UI_translate_do_iface(N_("Unknown error loading: \"%s\".")), filepath); + BKE_reportf(reports, RPT_ERROR, IFACE_("Unknown error loading: \"%s\"."), filepath); BLI_assert(!"invalid 'retval'"); } @@ -856,14 +857,14 @@ void wm_autosave_location(char *filepath) * BLI_make_file_string will create string that has it most likely on C:\ * through get_default_root(). * If there is no C:\tmp autosave fails. */ - if (!BLI_exists(btempdir)) { + if (!BLI_exists(BLI_temporary_dir())) { savedir = BLI_get_folder_create(BLENDER_USER_AUTOSAVE, NULL); BLI_make_file_string("/", filepath, savedir, pidstr); return; } #endif - BLI_make_file_string("/", filepath, btempdir, pidstr); + BLI_make_file_string("/", filepath, BLI_temporary_dir(), pidstr); } void WM_autosave_init(wmWindowManager *wm) @@ -921,7 +922,7 @@ void wm_autosave_delete(void) if(BLI_exists(filename)) { char str[FILE_MAXDIR+FILE_MAXFILE]; - BLI_make_file_string("/", str, btempdir, "quit.blend"); + BLI_make_file_string("/", str, BLI_temporary_dir(), "quit.blend"); /* if global undo; remove tempsave, otherwise rename */ if(U.uiflag & USER_GLOBALUNDO) BLI_delete(filename, 0, 0); diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 1face062e7e..5fee5fb2a57 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -156,10 +156,10 @@ void WM_operatortype_append(void (*opfunc)(wmOperatorType*)) if(ot->name==NULL) { fprintf(stderr, "ERROR: Operator %s has no name property!\n", ot->idname); - ot->name= UI_translate_do_iface(N_("Dummy Name")); + ot->name= IFACE_("Dummy Name"); } - RNA_def_struct_ui_text(ot->srna, ot->name, ot->description ? ot->description:UI_translate_do_iface(N_("(undocumented operator)"))); // XXX All ops should have a description but for now allow them not to. + RNA_def_struct_ui_text(ot->srna, ot->name, ot->description ? ot->description:IFACE_("(undocumented operator)")); // XXX All ops should have a description but for now allow them not to. RNA_def_struct_identifier(ot->srna, ot->idname); BLI_ghash_insert(global_ops_hash, (void *)ot->idname, ot); @@ -172,7 +172,7 @@ void WM_operatortype_append_ptr(void (*opfunc)(wmOperatorType*, void*), void *us ot= MEM_callocN(sizeof(wmOperatorType), "operatortype"); ot->srna= RNA_def_struct(&BLENDER_RNA, "", "OperatorProperties"); opfunc(ot, userdata); - RNA_def_struct_ui_text(ot->srna, ot->name, ot->description ? ot->description:UI_translate_do_iface(N_("(undocumented operator)"))); + RNA_def_struct_ui_text(ot->srna, ot->name, ot->description ? ot->description:IFACE_("(undocumented operator)")); RNA_def_struct_identifier(ot->srna, ot->idname); BLI_ghash_insert(global_ops_hash, (void *)ot->idname, ot); @@ -366,7 +366,7 @@ wmOperatorType *WM_operatortype_append_macro(const char *idname, const char *nam ot->poll= NULL; if(!ot->description) - ot->description= UI_translate_do_iface(N_("(undocumented operator)")); + ot->description= IFACE_("(undocumented operator)"); RNA_def_struct_ui_text(ot->srna, ot->name, ot->description); // XXX All ops should have a description but for now allow them not to. RNA_def_struct_identifier(ot->srna, ot->idname); @@ -391,7 +391,7 @@ void WM_operatortype_append_macro_ptr(void (*opfunc)(wmOperatorType*, void*), vo ot->poll= NULL; if(!ot->description) - ot->description= UI_translate_do_iface(N_("(undocumented operator)")); + ot->description= IFACE_("(undocumented operator)"); opfunc(ot, userdata); @@ -678,7 +678,7 @@ int WM_menu_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) else { pup= uiPupMenuBegin(C, op->type->name, ICON_NONE); layout= uiPupMenuLayout(pup); - uiItemsFullEnumO(layout, op->type->idname, (char*)RNA_property_identifier(prop), op->ptr->data, WM_OP_EXEC_REGION_WIN, 0); + uiItemsFullEnumO(layout, op->type->idname, RNA_property_identifier(prop), op->ptr->data, WM_OP_EXEC_REGION_WIN, 0); uiPupMenuEnd(C, pup); } @@ -788,7 +788,7 @@ int WM_operator_confirm_message(bContext *C, wmOperator *op, const char *message else properties= NULL; - pup= uiPupMenuBegin(C, UI_translate_do_iface(N_("OK?")), ICON_QUESTION); + pup= uiPupMenuBegin(C, IFACE_("OK?"), ICON_QUESTION); layout= uiPupMenuLayout(pup); uiItemFullO(layout, op->type->idname, message, ICON_NONE, properties, WM_OP_EXEC_REGION_WIN, 0); uiPupMenuEnd(C, pup); @@ -870,10 +870,10 @@ void WM_operator_properties_filesel(wmOperatorType *ot, int filter, short type, void WM_operator_properties_select_all(wmOperatorType *ot) { static EnumPropertyItem select_all_actions[] = { - {SEL_TOGGLE, "TOGGLE", 0, N_("Toggle"), "Toggle selection for all elements"}, - {SEL_SELECT, "SELECT", 0, N_("Select"), "Select all elements"}, - {SEL_DESELECT, "DESELECT", 0, N_("Deselect"), "Deselect all elements"}, - {SEL_INVERT, "INVERT", 0, N_("Invert"), "Invert selection of all elements"}, + {SEL_TOGGLE, "TOGGLE", 0, "Toggle", "Toggle selection for all elements"}, + {SEL_SELECT, "SELECT", 0, "Select", "Select all elements"}, + {SEL_DESELECT, "DESELECT", 0, "Deselect", "Deselect all elements"}, + {SEL_INVERT, "INVERT", 0, "Invert", "Invert selection of all elements"}, {0, NULL, 0, NULL, NULL} }; @@ -882,25 +882,25 @@ void WM_operator_properties_select_all(wmOperatorType *ot) void WM_operator_properties_gesture_border(wmOperatorType *ot, int extend) { - RNA_def_int(ot->srna, "gesture_mode", 0, INT_MIN, INT_MAX, N_("Gesture Mode"), "", INT_MIN, INT_MAX); - RNA_def_int(ot->srna, "xmin", 0, INT_MIN, INT_MAX, N_("X Min"), "", INT_MIN, INT_MAX); - RNA_def_int(ot->srna, "xmax", 0, INT_MIN, INT_MAX, N_("X Max"), "", INT_MIN, INT_MAX); - RNA_def_int(ot->srna, "ymin", 0, INT_MIN, INT_MAX, N_("Y Min"), "", INT_MIN, INT_MAX); - RNA_def_int(ot->srna, "ymax", 0, INT_MIN, INT_MAX, N_("Y Max"), "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "gesture_mode", 0, INT_MIN, INT_MAX, "Gesture Mode", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "xmin", 0, INT_MIN, INT_MAX, "X Min", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "xmax", 0, INT_MIN, INT_MAX, "X Max", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "ymin", 0, INT_MIN, INT_MAX, "Y Min", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "ymax", 0, INT_MIN, INT_MAX, "Y Max", "", INT_MIN, INT_MAX); if(extend) - RNA_def_boolean(ot->srna, "extend", 1, _("Extend"), _("Extend selection instead of deselecting everything first")); + RNA_def_boolean(ot->srna, "extend", 1, "Extend", "Extend selection instead of deselecting everything first"); } void WM_operator_properties_gesture_straightline(wmOperatorType *ot, int cursor) { - RNA_def_int(ot->srna, "xstart", 0, INT_MIN, INT_MAX, N_("X Start"), "", INT_MIN, INT_MAX); - RNA_def_int(ot->srna, "xend", 0, INT_MIN, INT_MAX, N_("X End"), "", INT_MIN, INT_MAX); - RNA_def_int(ot->srna, "ystart", 0, INT_MIN, INT_MAX, N_("Y Start"), "", INT_MIN, INT_MAX); - RNA_def_int(ot->srna, "yend", 0, INT_MIN, INT_MAX, N_("Y End"), "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "xstart", 0, INT_MIN, INT_MAX, "X Start", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "xend", 0, INT_MIN, INT_MAX, "X End", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "ystart", 0, INT_MIN, INT_MAX, "Y Start", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "yend", 0, INT_MIN, INT_MAX, "Y End", "", INT_MIN, INT_MAX); if(cursor) - RNA_def_int(ot->srna, "cursor", cursor, 0, INT_MAX, N_("Cursor"), N_("Mouse cursor style to use during the modal operator"), 0, INT_MAX); + RNA_def_int(ot->srna, "cursor", cursor, 0, INT_MAX, "Cursor", "Mouse cursor style to use during the modal operator", 0, INT_MAX); } @@ -1031,7 +1031,7 @@ static uiBlock *wm_block_dialog_create(bContext *C, ARegion *ar, void *userData) col= uiLayoutColumn(layout, FALSE); col_block= uiLayoutGetBlock(col); /* Create OK button, the callback of which will execute op */ - btn= uiDefBut(col_block, BUT, 0, UI_translate_do_iface(N_("OK")), 0, -30, 0, UI_UNIT_Y, NULL, 0, 0, 0, 0, ""); + btn= uiDefBut(col_block, BUT, 0, IFACE_("OK"), 0, -30, 0, UI_UNIT_Y, NULL, 0, 0, 0, 0, ""); uiButSetFunc(btn, dialog_exec_cb, data, col_block); } @@ -1282,19 +1282,19 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar split = uiLayoutSplit(layout, 0, 0); col = uiLayoutColumn(split, 0); uiItemL(col, "Links", ICON_NONE); - uiItemStringO(col, UI_translate_do_iface(N_("Donations")), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/blenderorg/blender-foundation/donation-payment"); - uiItemStringO(col, UI_translate_do_iface(N_("Credits")), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/development/credits"); - uiItemStringO(col, UI_translate_do_iface(N_("Release Log")), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/development/release-logs/blender-260"); - uiItemStringO(col, UI_translate_do_iface(N_("Manual")), ICON_URL, "WM_OT_url_open", "url", "http://wiki.blender.org/index.php/Doc:2.5/Manual"); - uiItemStringO(col, UI_translate_do_iface(N_("Blender Website")), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org"); - uiItemStringO(col, UI_translate_do_iface(N_("User Community")), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/community/user-community"); + uiItemStringO(col, IFACE_("Donations"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/blenderorg/blender-foundation/donation-payment"); + uiItemStringO(col, IFACE_("Credits"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/development/credits"); + uiItemStringO(col, IFACE_("Release Log"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/development/release-logs/blender-260"); + uiItemStringO(col, IFACE_("Manual"), ICON_URL, "WM_OT_url_open", "url", "http://wiki.blender.org/index.php/Doc:2.5/Manual"); + uiItemStringO(col, IFACE_("Blender Website"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org"); + uiItemStringO(col, IFACE_("User Community"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/community/user-community"); if(strcmp(STRINGIFY(BLENDER_VERSION_CYCLE), "release")==0) { BLI_snprintf(url, sizeof(url), "http://www.blender.org/documentation/blender_python_api_%d_%d" STRINGIFY(BLENDER_VERSION_CHAR) "_release", BLENDER_VERSION/100, BLENDER_VERSION%100); } else { BLI_snprintf(url, sizeof(url), "http://www.blender.org/documentation/blender_python_api_%d_%d_%d", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION); } - uiItemStringO(col, UI_translate_do_iface(N_("Python API Reference")), ICON_URL, "WM_OT_url_open", "url", url); + uiItemStringO(col, IFACE_("Python API Reference"), ICON_URL, "WM_OT_url_open", "url", url); uiItemL(col, "", ICON_NONE); col = uiLayoutColumn(split, 0); @@ -1304,7 +1304,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar uiItemS(col); } - uiItemL(col, UI_translate_do_iface(N_("Recent")), ICON_NONE); + uiItemL(col, IFACE_("Recent"), ICON_NONE); for(recent = G.recent_files.first, i=0; (i<5) && (recent); recent = recent->next, i++) { uiItemStringO(col, BLI_path_basename(recent->filepath), ICON_FILE_BLEND, "WM_OT_open_mainfile", "filepath", recent->filepath); } @@ -1807,7 +1807,7 @@ static int wm_recover_last_session_exec(bContext *C, wmOperator *op) WM_event_add_notifier(C, NC_WINDOW, NULL); /* load file */ - BLI_make_file_string("/", filename, btempdir, "quit.blend"); + BLI_make_file_string("/", filename, BLI_temporary_dir(), "quit.blend"); WM_read_file(C, filename, op->reports); G.fileflags &= ~G_FILE_RECOVER; @@ -3319,13 +3319,13 @@ static void redraw_timer_window_swap(bContext *C) } static EnumPropertyItem redraw_timer_type_items[] = { - {0, "DRAW", 0, N_("Draw Region"), N_("Draw Region")}, - {1, "DRAW_SWAP", 0, N_("Draw Region + Swap"), N_("Draw Region and Swap")}, - {2, "DRAW_WIN", 0, N_("Draw Window"), N_("Draw Window")}, - {3, "DRAW_WIN_SWAP", 0, N_("Draw Window + Swap"), N_("Draw Window and Swap")}, - {4, "ANIM_STEP", 0, N_("Anim Step"), N_("Animation Steps")}, - {5, "ANIM_PLAY", 0, N_("Anim Play"), N_("Animation Playback")}, - {6, "UNDO", 0, N_("Undo/Redo"), N_("Undo/Redo")}, + {0, "DRAW", 0, "Draw Region", "Draw Region"}, + {1, "DRAW_SWAP", 0, "Draw Region + Swap", "Draw Region and Swap"}, + {2, "DRAW_WIN", 0, "Draw Window", "Draw Window"}, + {3, "DRAW_WIN_SWAP", 0, "Draw Window + Swap", "Draw Window and Swap"}, + {4, "ANIM_STEP", 0, "Anim Step", "Animation Steps"}, + {5, "ANIM_PLAY", 0, "Anim Play", "Animation Playback"}, + {6, "UNDO", 0, "Undo/Redo", "Undo/Redo"}, {0, NULL, 0, NULL, NULL}}; static int redraw_timer_exec(bContext *C, wmOperator *op) @@ -3635,14 +3635,14 @@ void wm_operatortype_init(void) static void gesture_circle_modal_keymap(wmKeyConfig *keyconf) { static EnumPropertyItem modal_items[] = { - {GESTURE_MODAL_CANCEL, "CANCEL", 0, N_("Cancel"), ""}, - {GESTURE_MODAL_CONFIRM, "CONFIRM", 0, N_("Confirm"), ""}, - {GESTURE_MODAL_CIRCLE_ADD, "ADD", 0, N_("Add"), ""}, - {GESTURE_MODAL_CIRCLE_SUB, "SUBTRACT", 0, N_("Subtract"), ""}, + {GESTURE_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""}, + {GESTURE_MODAL_CONFIRM, "CONFIRM", 0, "Confirm", ""}, + {GESTURE_MODAL_CIRCLE_ADD, "ADD", 0, "Add", ""}, + {GESTURE_MODAL_CIRCLE_SUB, "SUBTRACT", 0, "Subtract", ""}, - {GESTURE_MODAL_SELECT, "SELECT", 0, N_("Select"), ""}, - {GESTURE_MODAL_DESELECT,"DESELECT", 0, N_("DeSelect"), ""}, - {GESTURE_MODAL_NOP,"NOP", 0, N_("No Operation"), ""}, + {GESTURE_MODAL_SELECT, "SELECT", 0, "Select", ""}, + {GESTURE_MODAL_DESELECT,"DESELECT", 0, "DeSelect", ""}, + {GESTURE_MODAL_NOP,"NOP", 0, "No Operation", ""}, {0, NULL, 0, NULL, NULL}}; @@ -3688,9 +3688,9 @@ static void gesture_circle_modal_keymap(wmKeyConfig *keyconf) static void gesture_straightline_modal_keymap(wmKeyConfig *keyconf) { static EnumPropertyItem modal_items[] = { - {GESTURE_MODAL_CANCEL, "CANCEL", 0, N_("Cancel"), ""}, - {GESTURE_MODAL_SELECT, "SELECT", 0, N_("Select"), ""}, - {GESTURE_MODAL_BEGIN, "BEGIN", 0, N_("Begin"), ""}, + {GESTURE_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""}, + {GESTURE_MODAL_SELECT, "SELECT", 0, "Select", ""}, + {GESTURE_MODAL_BEGIN, "BEGIN", 0, "Begin", ""}, {0, NULL, 0, NULL, NULL}}; wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "Gesture Straight Line"); @@ -3716,10 +3716,10 @@ static void gesture_straightline_modal_keymap(wmKeyConfig *keyconf) static void gesture_border_modal_keymap(wmKeyConfig *keyconf) { static EnumPropertyItem modal_items[] = { - {GESTURE_MODAL_CANCEL, "CANCEL", 0, N_("Cancel"), ""}, - {GESTURE_MODAL_SELECT, "SELECT", 0, N_("Select"), ""}, - {GESTURE_MODAL_DESELECT,"DESELECT", 0, N_("DeSelect"), ""}, - {GESTURE_MODAL_BEGIN, "BEGIN", 0, N_("Begin"), ""}, + {GESTURE_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""}, + {GESTURE_MODAL_SELECT, "SELECT", 0, "Select", ""}, + {GESTURE_MODAL_DESELECT,"DESELECT", 0, "DeSelect", ""}, + {GESTURE_MODAL_BEGIN, "BEGIN", 0, "Begin", ""}, {0, NULL, 0, NULL, NULL}}; wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "Gesture Border"); @@ -3771,10 +3771,10 @@ static void gesture_border_modal_keymap(wmKeyConfig *keyconf) static void gesture_zoom_border_modal_keymap(wmKeyConfig *keyconf) { static EnumPropertyItem modal_items[] = { - {GESTURE_MODAL_CANCEL, "CANCEL", 0, N_("Cancel"), ""}, - {GESTURE_MODAL_IN, "IN", 0, N_("In"), ""}, - {GESTURE_MODAL_OUT, "OUT", 0, N_("Out"), ""}, - {GESTURE_MODAL_BEGIN, "BEGIN", 0, N_("Begin"), ""}, + {GESTURE_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""}, + {GESTURE_MODAL_IN, "IN", 0, "In", ""}, + {GESTURE_MODAL_OUT, "OUT", 0, "Out", ""}, + {GESTURE_MODAL_BEGIN, "BEGIN", 0, "Begin", ""}, {0, NULL, 0, NULL, NULL}}; wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "Gesture Zoom Border"); diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index 405960d0795..38ff02b46c5 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -506,11 +506,11 @@ void WM_window_open_temp(bContext *C, rcti *position, int type) ED_screen_set(C, win->screen); if(sa->spacetype==SPACE_IMAGE) - GHOST_SetTitle(win->ghostwin, UI_translate_do_iface(N_("Blender Render"))); + GHOST_SetTitle(win->ghostwin, IFACE_("Blender Render")); else if(ELEM(sa->spacetype, SPACE_OUTLINER, SPACE_USERPREF)) - GHOST_SetTitle(win->ghostwin, UI_translate_do_iface(N_("Blender User Preferences"))); + GHOST_SetTitle(win->ghostwin, IFACE_("Blender User Preferences")); else if(sa->spacetype==SPACE_FILE) - GHOST_SetTitle(win->ghostwin, UI_translate_do_iface(N_("Blender File View"))); + GHOST_SetTitle(win->ghostwin, IFACE_("Blender File View")); else GHOST_SetTitle(win->ghostwin, "Blender"); } diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c index 31e76d31f75..0141b1e8ab7 100644 --- a/source/blenderplayer/bad_level_call_stubs/stubs.c +++ b/source/blenderplayer/bad_level_call_stubs/stubs.c @@ -130,7 +130,6 @@ struct RenderResult *RE_GetResult(struct Render *re){return (struct RenderResult struct Render *RE_GetRender(const char *name){return (struct Render *) NULL;} /* blenkernel */ -char btempdir[] = ""; void RE_FreeRenderResult(struct RenderResult *res){} struct RenderResult *RE_MultilayerConvert(void *exrhandle, int rectx, int recty){return (struct RenderResult *) NULL;} void RE_GetResultImage(struct Render *re, struct RenderResult *rr){} diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index 51297f57e9d..6e3c486e788 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -344,16 +344,11 @@ if(UNIX AND NOT APPLE) ) endif() - install( - FILES ${CMAKE_SOURCE_DIR}/release/bin/.blender/.bfont.ttf - DESTINATION ${TARGETDIR_VER} - ) - if(WITH_INTERNATIONAL) install( DIRECTORY - ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale - ${CMAKE_SOURCE_DIR}/release/bin/.blender/fonts + ${CMAKE_SOURCE_DIR}/release/datafiles/locale + ${CMAKE_SOURCE_DIR}/release/datafiles/fonts DESTINATION ${TARGETDIR_VER}/datafiles PATTERN ".svn" EXCLUDE ) @@ -416,16 +411,11 @@ elseif(WIN32) DESTINATION ${TARGETDIR} ) - install( # same as linux!, deduplicate - FILES ${CMAKE_SOURCE_DIR}/release/bin/.blender/.bfont.ttf - DESTINATION ${TARGETDIR_VER} - ) - if(WITH_INTERNATIONAL) # same as linux!, deduplicate install( DIRECTORY - ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale - ${CMAKE_SOURCE_DIR}/release/bin/.blender/fonts + ${CMAKE_SOURCE_DIR}/release/datafiles/locale + ${CMAKE_SOURCE_DIR}/release/datafiles/fonts DESTINATION ${TARGETDIR_VER}/datafiles PATTERN ".svn" EXCLUDE ) @@ -647,17 +637,12 @@ elseif(APPLE) \${TARGETDIR}/blender.app/Contents/ ) - install( - FILES ${CMAKE_SOURCE_DIR}/release/bin/.blender/.bfont.ttf - DESTINATION ${TARGETDIR_VER} - ) - # localization if(WITH_INTERNATIONAL) install( DIRECTORY - ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale - ${CMAKE_SOURCE_DIR}/release/bin/.blender/fonts + ${CMAKE_SOURCE_DIR}/release/datafiles/locale + ${CMAKE_SOURCE_DIR}/release/datafiles/fonts DESTINATION ${TARGETDIR_VER}/datafiles PATTERN ".svn" EXCLUDE ) diff --git a/source/creator/creator.c b/source/creator/creator.c index fd752fa85e6..a062021ff7c 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -62,6 +62,7 @@ #include "DNA_ID.h" #include "DNA_scene_types.h" +#include "DNA_userdef_types.h" #include "BLI_blenlib.h" @@ -142,9 +143,6 @@ static int print_version(int argc, const char **argv, void *data); extern int pluginapi_force_ref(void); /* from blenpluginapi:pluginapi.c */ -char bprogname[FILE_MAX]; /* from blenpluginapi:pluginapi.c */ -char btempdir[FILE_MAX]; - #define BLEND_VERSION_STRING_FMT "Blender %d.%02d (sub %d)\n", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION /* Initialize callbacks for the modules that need them */ @@ -1154,10 +1152,8 @@ int main(int argc, const char **argv) fpsetmask(0); #endif - // copy path to executable in bprogname. playanim and creting runtimes - // need this. - - BLI_where_am_i(bprogname, sizeof(bprogname), argv[0]); + // initialize path to executable + BLI_init_program_path(argv[0]); BLI_threadapi_init(); @@ -1212,7 +1208,8 @@ int main(int argc, const char **argv) WM_init(C, argc, argv); /* this is properly initialized with user defs, but this is default */ - BLI_where_is_temp(btempdir, FILE_MAX, 1); /* call after loading the startup.blend so we can read U.tempdir */ + /* call after loading the startup.blend so we can read U.tempdir */ + BLI_init_temporary_dir(U.tempdir); #ifdef WITH_SDL BLI_setenv("SDL_VIDEODRIVER", "dummy"); @@ -1223,7 +1220,8 @@ int main(int argc, const char **argv) WM_init(C, argc, argv); - BLI_where_is_temp(btempdir, FILE_MAX, 0); /* call after loading the startup.blend so we can read U.tempdir */ + /* don't use user preferences temp dir */ + BLI_init_temporary_dir(NULL); } #ifdef WITH_PYTHON /** diff --git a/source/gameengine/GameLogic/SCA_KeyboardSensor.h b/source/gameengine/GameLogic/SCA_KeyboardSensor.h index ee40567fce2..6df648bf2d3 100644 --- a/source/gameengine/GameLogic/SCA_KeyboardSensor.h +++ b/source/gameengine/GameLogic/SCA_KeyboardSensor.h @@ -69,7 +69,7 @@ class SCA_KeyboardSensor : public SCA_ISensor * The property that indicates whether or not to log text when in * loggin mode. If the property equals 0, no loggin is done. For * all other values, logging is active. Logging can only become - * active if there is a property to log to. Logging is independant + * active if there is a property to log to. Logging is independent * from hotkey settings. */ STR_String m_toggleprop; diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp index ea17b9adcfd..f5439ba4f64 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp @@ -76,9 +76,6 @@ extern "C" int GHOST_HACK_getFirstFile(char buf[]); -extern char bprogname[]; /* holds a copy of argv[0], from creator.c */ -extern char btempdir[]; /* use this to store a valid temp directory */ - // For BLF #include "BLF_api.h" #include "BLF_translation.h" @@ -116,8 +113,6 @@ extern char datatoc_bfont_ttf[]; const int kMinWindowWidth = 100; const int kMinWindowHeight = 100; -char bprogname[FILE_MAX]; - static void mem_error_cb(const char *errorStr) { fprintf(stderr, "%s", errorStr); @@ -379,7 +374,8 @@ int main(int argc, char** argv) signal (SIGFPE, SIG_IGN); #endif /* __alpha__ */ #endif /* __linux__ */ - BLI_where_am_i(bprogname, sizeof(bprogname), argv[0]); + BLI_init_program_path(argv[0]); + BLI_init_temporary_dir(NULL); #ifdef __APPLE__ // Can't use Carbon right now because of double defined type ID (In Carbon.h and DNA_ID.h, sigh) /* @@ -784,7 +780,7 @@ int main(int argc, char** argv) } else { - bfd = load_game_data(bprogname, filename[0]? filename: NULL); + bfd = load_game_data(BLI_program_path(), filename[0]? filename: NULL); } //::printf("game data loaded from %s\n", filename); diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp index e86831b9323..c7da650f988 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.cpp +++ b/source/gameengine/Ketsji/KX_PythonInit.cpp @@ -502,7 +502,7 @@ static PyObject* gPyGetBlendFileList(PyObject*, PyObject* args) BLI_path_abs(cpath, gp_GamePythonPath); } else { /* Get the dir only */ - BLI_split_dirfile(gp_GamePythonPath, cpath, NULL, sizeof(cpath), 0); + BLI_split_dir_part(gp_GamePythonPath, cpath, sizeof(cpath)); } if((dp = opendir(cpath)) == NULL) { @@ -1732,7 +1732,7 @@ static void initPySysObjects__append(PyObject *sys_path, char *filename) PyObject *item; char expanded[FILE_MAXDIR + FILE_MAXFILE]; - BLI_split_dirfile(filename, expanded, NULL, sizeof(expanded), 0); /* get the dir part of filename only */ + BLI_split_dir_part(filename, expanded, sizeof(expanded)); /* get the dir part of filename only */ BLI_path_abs(expanded, gp_GamePythonPath); /* filename from lib->filename is (always?) absolute, so this may not be needed but it wont hurt */ BLI_cleanup_file(gp_GamePythonPath, expanded); /* Dont use BLI_cleanup_dir because it adds a slash - BREAKS WIN32 ONLY */ item= PyUnicode_DecodeFSDefault(expanded); |