Merged changes in the trunk up to revision 36757.

This commit is contained in:
2011-05-19 01:40:37 +00:00
275 changed files with 4189 additions and 3664 deletions

View File

@@ -175,6 +175,10 @@ if(UNIX AND NOT APPLE)
endif() endif()
option(WITH_PYTHON_INSTALL "Copy system python into the blender install folder" ON) option(WITH_PYTHON_INSTALL "Copy system python into the blender install folder" ON)
# disable for now, but plan to support on all platforms eventually
option(WITH_MEM_JEMALLOC "Enable malloc replacement (http://www.canonware.com/jemalloc)" OFF)
mark_as_advanced(WITH_MEM_JEMALLOC)
# Debug # Debug
option(WITH_CXX_GUARDEDALLOC "Enable GuardedAlloc for C++ memory allocation tracking (only enable for development)" OFF) option(WITH_CXX_GUARDEDALLOC "Enable GuardedAlloc for C++ memory allocation tracking (only enable for development)" OFF)
mark_as_advanced(WITH_CXX_GUARDEDALLOC) mark_as_advanced(WITH_CXX_GUARDEDALLOC)
@@ -198,9 +202,6 @@ if(APPLE)
option(WITH_LIBS10.5 "Use 10.5 libs (needed for 64bit builds)" OFF) option(WITH_LIBS10.5 "Use 10.5 libs (needed for 64bit builds)" OFF)
endif() endif()
# only for developers who want to make this functional
# option(WITH_LCMS "Enable color correction with lcms" OFF)
if(NOT WITH_GAMEENGINE AND WITH_PLAYER) if(NOT WITH_GAMEENGINE AND WITH_PLAYER)
message(FATAL_ERROR "WITH_PLAYER requires WITH_GAMEENGINE") message(FATAL_ERROR "WITH_PLAYER requires WITH_GAMEENGINE")
endif() endif()
@@ -375,13 +376,6 @@ if(UNIX AND NOT APPLE)
find_package(ZLIB REQUIRED) find_package(ZLIB REQUIRED)
if(WITH_LCMS)
set(LCMS /usr CACHE FILEPATH "LCMS directory")
set(LCMS_INCLUDE_DIR ${LCMS}/include)
set(LCMS_LIBRARY lcms)
set(LCMS_LIBPATH ${LCMS}/lib)
endif()
if(WITH_CODEC_FFMPEG) if(WITH_CODEC_FFMPEG)
set(FFMPEG /usr CACHE FILEPATH "FFMPEG Directory") set(FFMPEG /usr CACHE FILEPATH "FFMPEG Directory")
mark_as_advanced(FFMPEG) mark_as_advanced(FFMPEG)
@@ -424,6 +418,15 @@ if(UNIX AND NOT APPLE)
set(EXPAT_LIB expat) set(EXPAT_LIB expat)
endif() endif()
if(WITH_MEM_JEMALLOC)
set(JEMALLOC /usr)
set(JEMALLOC_LIBRARY jemalloc CACHE STRING "JeMalloc library")
set(JEMALLOC_LIBPATH ${JEMALLOC}/lib CACHE FILEPATH "JeMalloc library path")
# no use for this yet.
# set(JEMALLOC_INCLUDE_DIR ${JEMALLOC}/include CACHE FILEPATH "JeMalloc include path")
unset(JEMALLOC)
endif()
find_package(X11 REQUIRED) find_package(X11 REQUIRED)
find_path(X11_XF86keysym_INCLUDE_PATH X11/XF86keysym.h ${X11_INC_SEARCH_PATH}) find_path(X11_XF86keysym_INCLUDE_PATH X11/XF86keysym.h ${X11_INC_SEARCH_PATH})
mark_as_advanced(X11_XF86keysym_INCLUDE_PATH) mark_as_advanced(X11_XF86keysym_INCLUDE_PATH)
@@ -627,14 +630,7 @@ elseif(WIN32)
set(OPENCOLLADA_LIB OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils OpenCOLLADAStreamWriter MathMLSolver GeneratedSaxParser xml2 buffer ftoa UTF) set(OPENCOLLADA_LIB OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils OpenCOLLADAStreamWriter MathMLSolver GeneratedSaxParser xml2 buffer ftoa UTF)
set(PCRE_LIB pcre) set(PCRE_LIB pcre)
endif() endif()
if(WITH_LCMS)
set(LCMS ${LIBDIR}/lcms)
set(LCMS_INCLUDE_DIR ${LCMS}/include)
set(LCMS_LIBPATH ${LCMS}/lib)
set(LCMS_LIB lcms)
endif()
if(WITH_CODEC_FFMPEG) if(WITH_CODEC_FFMPEG)
set(FFMPEG ${LIBDIR}/ffmpeg) set(FFMPEG ${LIBDIR}/ffmpeg)
set(FFMPEG_INC ${FFMPEG}/include ${FFMPEG}/include/msvc) set(FFMPEG_INC ${FFMPEG}/include ${FFMPEG}/include/msvc)
@@ -870,7 +866,7 @@ elseif(APPLE)
set(GETTEXT_LIB intl iconv) set(GETTEXT_LIB intl iconv)
set(GETTEXT_LIBPATH ${GETTEXT}/lib) set(GETTEXT_LIBPATH ${GETTEXT}/lib)
endif() endif()
if(WITH_FFTW3) if(WITH_FFTW3)
set(FFTW3 ${LIBDIR}/fftw3) set(FFTW3 ${LIBDIR}/fftw3)
set(FFTW3_INC ${FFTW3}/include) set(FFTW3_INC ${FFTW3}/include)
@@ -897,13 +893,6 @@ elseif(APPLE)
set(OPENEXR_LIBPATH ${OPENEXR}/lib) set(OPENEXR_LIBPATH ${OPENEXR}/lib)
endif() endif()
if(WITH_LCMS)
set(LCMS ${LIBDIR}/lcms)
set(LCMS_INCLUDE_DIR ${LCMS}/include)
set(LCMS_LIBRARY lcms)
set(LCMS_LIBPATH ${LCMS}/lib)
endif()
if(WITH_CODEC_FFMPEG) if(WITH_CODEC_FFMPEG)
set(FFMPEG ${LIBDIR}/ffmpeg) set(FFMPEG ${LIBDIR}/ffmpeg)
set(FFMPEG_INC ${FFMPEG}/include) set(FFMPEG_INC ${FFMPEG}/include)

View File

@@ -74,6 +74,12 @@ WITH_BF_BULLET = True
# Blender player (would be enabled in it's own config) # Blender player (would be enabled in it's own config)
WITH_BF_PLAYER = False WITH_BF_PLAYER = False
# Use jemalloc memory manager
WITH_BF_JEMALLOC = True
WITH_BF_STATICJEMALLOC = True
BF_JEMALLOC = '/home/sources/staticlibs/jemalloc'
BF_JEMALLOC_LIBPATH = '${BF_JEMALLOC}/lib32'
# Compilation and optimization # Compilation and optimization
BF_DEBUG = False BF_DEBUG = False
REL_CFLAGS = ['-O2'] REL_CFLAGS = ['-O2']

View File

@@ -59,6 +59,12 @@ WITH_BF_BULLET = True
WITH_BF_NOBLENDER = True WITH_BF_NOBLENDER = True
WITH_BF_PLAYER = True WITH_BF_PLAYER = True
# Use jemalloc memory manager
WITH_BF_JEMALLOC = True
WITH_BF_STATICJEMALLOC = True
BF_JEMALLOC = '/home/sources/staticlibs/jemalloc'
BF_JEMALLOC_LIBPATH = '${BF_JEMALLOC}/lib32'
# Compilation and optimization # Compilation and optimization
BF_DEBUG = False BF_DEBUG = False
REL_CFLAGS = ['-O2'] REL_CFLAGS = ['-O2']

View File

@@ -59,6 +59,12 @@ WITH_BF_BULLET = True
WITH_BF_NOBLENDER = True WITH_BF_NOBLENDER = True
WITH_BF_PLAYER = True WITH_BF_PLAYER = True
# Use jemalloc memory manager
WITH_BF_JEMALLOC = True
WITH_BF_STATICJEMALLOC = True
BF_JEMALLOC = '/home/sources/staticlibs/jemalloc'
BF_JEMALLOC_LIBPATH = '${BF_JEMALLOC}/lib64'
# Compilation and optimization # Compilation and optimization
BF_DEBUG = False BF_DEBUG = False
REL_CFLAGS = ['-O2'] REL_CFLAGS = ['-O2']

View File

@@ -74,6 +74,12 @@ WITH_BF_BULLET = True
# Blender player (would be enabled in it's own config) # Blender player (would be enabled in it's own config)
WITH_BF_PLAYER = False WITH_BF_PLAYER = False
# Use jemalloc memory manager
WITH_BF_JEMALLOC = True
WITH_BF_STATICJEMALLOC = True
BF_JEMALLOC = '/home/sources/staticlibs/jemalloc'
BF_JEMALLOC_LIBPATH = '${BF_JEMALLOC}/lib64'
# Compilation and optimization # Compilation and optimization
BF_DEBUG = False BF_DEBUG = False
REL_CFLAGS = ['-O2'] REL_CFLAGS = ['-O2']

0
build_files/cmake/cmake_consistency_check.py Normal file → Executable file
View File

View File

@@ -0,0 +1,230 @@
#!/usr/bin/env python
# $Id$
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# Contributor(s): Campbell Barton, M.G. Kishalmi
#
# ***** END GPL LICENSE BLOCK *****
# <pep8 compliant>
"""
Example linux usage
python .~/blenderSVN/blender/build_files/cmake/cmake_netbeans_project.py ~/blenderSVN/cmake
Windows not supported so far
"""
from project_info import *
import os
from os.path import join, dirname, normpath, abspath, splitext, relpath, exists
def create_nb_project_main():
files = list(source_list(SOURCE_DIR, filename_check=is_project_file))
files_rel = [relpath(f, start=PROJECT_DIR) for f in files]
files_rel.sort()
if SIMPLE_PROJECTFILE:
pass
else:
includes, defines = cmake_advanced_info()
# for some reason it doesnt give all internal includes
includes = list(set(includes) | set(dirname(f) for f in files if is_c_header(f)))
includes.sort()
PROJECT_NAME = "Blender"
FILE_NAME = PROJECT_NAME.lower()
# --------------- NB spesific
defines = [("%s=%s" % cdef) if cdef[1] else cdef[0] for cdef in defines]
defines += [cdef.replace("#define", "").strip() for cdef in cmake_compiler_defines()]
def file_list_to_nested(files):
# convert paths to hierarchy
paths_nested = {}
def ensure_path(filepath):
filepath_split = filepath.split(os.sep)
pn = paths_nested
for subdir in filepath_split[:-1]:
pn = pn.setdefault(subdir, {})
pn[filepath_split[-1]] = None
for path in files:
ensure_path(path)
return paths_nested
PROJECT_DIR_NB = join(PROJECT_DIR, "nbproject")
if not exists(PROJECT_DIR_NB):
os.mkdir(PROJECT_DIR_NB)
SOURCE_DIR_REL = relpath(SOURCE_DIR, PROJECT_DIR)
f = open(join(PROJECT_DIR_NB, "project.xml"), 'w')
f.write('<?xml version="1.0" encoding="UTF-8"?>\n')
f.write('<project xmlns="http://www.netbeans.org/ns/project/1">\n')
f.write(' <type>org.netbeans.modules.cnd.makeproject</type>\n')
f.write(' <configuration>\n')
f.write(' <data xmlns="http://www.netbeans.org/ns/make-project/1">\n')
f.write(' <name>%s</name>\n' % PROJECT_NAME)
f.write(' <c-extensions>c,m</c-extensions>\n')
f.write(' <cpp-extensions>cpp,mm</cpp-extensions>\n')
f.write(' <header-extensions>h,hpp,inl</header-extensions>\n')
f.write(' <sourceEncoding>UTF-8</sourceEncoding>\n')
f.write(' <make-dep-projects/>\n')
f.write(' <sourceRootList>\n')
f.write(' <sourceRootElem>%s</sourceRootElem>\n' % SOURCE_DIR) # base_root_rel
f.write(' </sourceRootList>\n')
f.write(' <confList>\n')
f.write(' <confElem>\n')
f.write(' <name>Default</name>\n')
f.write(' <type>0</type>\n')
f.write(' </confElem>\n')
f.write(' </confList>\n')
f.write(' </data>\n')
f.write(' </configuration>\n')
f.write('</project>\n')
f = open(join(PROJECT_DIR_NB, "configurations.xml"), 'w')
f.write('<?xml version="1.0" encoding="UTF-8"?>\n')
f.write('<configurationDescriptor version="79">\n')
f.write(' <logicalFolder name="root" displayName="root" projectFiles="true" kind="ROOT">\n')
f.write(' <df name="blender" root="%s">\n' % SOURCE_DIR) # base_root_rel
# write files!
files_rel_local = [normpath(relpath(join(CMAKE_DIR, path), SOURCE_DIR)) for path in files_rel]
files_rel_hierarchy = file_list_to_nested(files_rel_local)
# print(files_rel_hierarchy)
def write_df(hdir, ident):
dirs = []
files = []
for key, item in sorted(hdir.items()):
if item is None:
files.append(key)
else:
dirs.append((key, item))
for key, item in dirs:
f.write('%s <df name="%s">\n' % (ident, key))
write_df(item, ident + " ")
f.write('%s </df>\n' % ident)
for key in files:
f.write('%s<in>%s</in>\n' % (ident, key))
write_df(files_rel_hierarchy, ident=" ")
f.write(' </df>\n')
f.write(' <logicalFolder name="ExternalFiles"\n')
f.write(' displayName="Important Files"\n')
f.write(' projectFiles="false"\n')
f.write(' kind="IMPORTANT_FILES_FOLDER">\n')
# f.write(' <itemPath>../GNUmakefile</itemPath>\n')
f.write(' </logicalFolder>\n')
f.write(' </logicalFolder>\n')
# default, but this dir is infact not in blender dir so we can ignore it
# f.write(' <sourceFolderFilter>^(nbproject)$</sourceFolderFilter>\n')
f.write(' <sourceFolderFilter>^(nbproject|__pycache__|.*\.py|.*\.html|.*\.blend)$</sourceFolderFilter>\n')
f.write(' <sourceRootList>\n')
f.write(' <Elem>%s</Elem>\n' % SOURCE_DIR) # base_root_rel
f.write(' </sourceRootList>\n')
f.write(' <projectmakefile>Makefile</projectmakefile>\n')
# paths again
f.write(' <confs>\n')
f.write(' <conf name="Default" type="0">\n')
f.write(' <toolsSet>\n')
f.write(' <remote-sources-mode>LOCAL_SOURCES</remote-sources-mode>\n')
f.write(' <compilerSet>default</compilerSet>\n')
f.write(' </toolsSet>\n')
f.write(' <makefileType>\n')
f.write(' <makeTool>\n')
f.write(' <buildCommandWorkingDir>.</buildCommandWorkingDir>\n')
f.write(' <buildCommand>${MAKE} -f Makefile</buildCommand>\n')
f.write(' <cleanCommand>${MAKE} -f Makefile clean</cleanCommand>\n')
f.write(' <executablePath>./bin/blender</executablePath>\n')
def write_toolinfo():
f.write(' <incDir>\n')
for inc in includes:
f.write(' <pElem>%s</pElem>\n' % inc)
f.write(' </incDir>\n')
f.write(' <preprocessorList>\n')
for cdef in defines:
f.write(' <Elem>%s</Elem>\n' % cdef)
f.write(' </preprocessorList>\n')
f.write(' <cTool>\n')
write_toolinfo()
f.write(' </cTool>\n')
f.write(' <ccTool>\n')
write_toolinfo()
f.write(' </ccTool>\n')
f.write(' </makeTool>\n')
f.write(' </makefileType>\n')
# finishe makefle info
f.write(' \n')
for path in files_rel_local:
f.write(' <item path="%s"\n' % path)
f.write(' ex="false"\n')
f.write(' tool="1"\n')
f.write(' flavor="0">\n')
f.write(' </item>\n')
f.write(' <runprofile version="9">\n')
f.write(' <runcommandpicklist>\n')
f.write(' </runcommandpicklist>\n')
f.write(' <runcommand>%s</runcommand>\n' % os.path.join(CMAKE_DIR, "bin/blender"))
f.write(' <rundir>%s</rundir>\n' % SOURCE_DIR)
f.write(' <buildfirst>false</buildfirst>\n')
f.write(' <terminal-type>0</terminal-type>\n')
f.write(' <remove-instrumentation>0</remove-instrumentation>\n')
f.write(' <environment>\n')
f.write(' </environment>\n')
f.write(' </runprofile>\n')
f.write(' </conf>\n')
f.write(' </confs>\n')
# todo
f.write('</configurationDescriptor>\n')
def main():
create_nb_project_main()
if __name__ == "__main__":
main()

178
build_files/cmake/cmake_qtcreator_project.py Normal file → Executable file
View File

@@ -1,6 +1,6 @@
#!/usr/bin/env python #!/usr/bin/env python
# $Id: # $Id$
# ***** BEGIN GPL LICENSE BLOCK ***** # ***** BEGIN GPL LICENSE BLOCK *****
# #
# This program is free software; you can redistribute it and/or # This program is free software; you can redistribute it and/or
@@ -31,182 +31,16 @@ example linux usage
python .~/blenderSVN/blender/build_files/cmake/cmake_qtcreator_project.py ~/blenderSVN/cmake python .~/blenderSVN/blender/build_files/cmake/cmake_qtcreator_project.py ~/blenderSVN/cmake
""" """
import sys from project_info import *
import os import os
from os.path import join, dirname, normpath, abspath, splitext, relpath, exists from os.path import join, dirname, normpath, abspath, splitext, relpath, exists
base = join(os.path.dirname(__file__), "..", "..") import sys
base = normpath(base)
base = abspath(base)
SIMPLE_PROJECTFILE = False
# get cmake path
CMAKE_DIR = sys.argv[-1]
if not os.path.exists(os.path.join(CMAKE_DIR, "CMakeCache.txt")):
CMAKE_DIR = os.getcwd()
if not os.path.exists(os.path.join(CMAKE_DIR, "CMakeCache.txt")):
print("CMakeCache.txt not found in %r or %r\n Pass CMake build dir as an argument, or run from that dir, aborting" % (CMAKE_DIR, os.getcwd()))
sys.exit(1)
# could be either.
# PROJECT_DIR = base
PROJECT_DIR = CMAKE_DIR
def source_list(path, filename_check=None):
for dirpath, dirnames, filenames in os.walk(path):
# skip '.svn'
if dirpath.startswith("."):
continue
for filename in filenames:
filepath = join(dirpath, filename)
if filename_check is None or filename_check(filepath):
yield filepath
# extension checking
def is_cmake(filename):
ext = splitext(filename)[1]
return (ext == ".cmake") or (filename.endswith("CMakeLists.txt"))
def is_c_header(filename):
ext = splitext(filename)[1]
return (ext in (".h", ".hpp", ".hxx"))
def is_py(filename):
ext = splitext(filename)[1]
return (ext == ".py")
def is_glsl(filename):
ext = splitext(filename)[1]
return (ext == ".glsl")
def is_c(filename):
ext = splitext(filename)[1]
return (ext in (".c", ".cpp", ".cxx", ".m", ".mm", ".rc"))
def is_c_any(filename):
return is_c(filename) or is_c_header(filename)
def is_svn_file(filename):
dn, fn = os.path.split(filename)
filename_svn = join(dn, ".svn", "text-base", "%s.svn-base" % fn)
return exists(filename_svn)
def is_project_file(filename):
return (is_c_any(filename) or is_cmake(filename) or is_glsl(filename)) # and is_svn_file(filename)
def cmake_advanced_info():
""" Extracr includes and defines from cmake.
"""
def create_eclipse_project(CMAKE_DIR):
print("CMAKE_DIR %r" % CMAKE_DIR)
if sys.platform == "win32":
cmd = 'cmake "%s" -G"Eclipse CDT4 - MinGW Makefiles"' % CMAKE_DIR
else:
cmd = 'cmake "%s" -G"Eclipse CDT4 - Unix Makefiles"' % CMAKE_DIR
os.system(cmd)
includes = []
defines = []
create_eclipse_project(CMAKE_DIR)
from xml.dom.minidom import parse
tree = parse(os.path.join(CMAKE_DIR, ".cproject"))
'''
f = open(".cproject_pretty", 'w')
f.write(tree.toprettyxml(indent=" ", newl=""))
'''
ELEMENT_NODE = tree.ELEMENT_NODE
cproject, = tree.getElementsByTagName("cproject")
for storage in cproject.childNodes:
if storage.nodeType != ELEMENT_NODE:
continue
if storage.attributes["moduleId"].value == "org.eclipse.cdt.core.settings":
cconfig = storage.getElementsByTagName("cconfiguration")[0]
for substorage in cconfig.childNodes:
if substorage.nodeType != ELEMENT_NODE:
continue
moduleId = substorage.attributes["moduleId"].value
# org.eclipse.cdt.core.settings
# org.eclipse.cdt.core.language.mapping
# org.eclipse.cdt.core.externalSettings
# org.eclipse.cdt.core.pathentry
# org.eclipse.cdt.make.core.buildtargets
if moduleId == "org.eclipse.cdt.core.pathentry":
for path in substorage.childNodes:
if path.nodeType != ELEMENT_NODE:
continue
kind = path.attributes["kind"].value
if kind == "mac":
# <pathentry kind="mac" name="PREFIX" path="" value="&quot;/opt/blender25&quot;"/>
defines.append((path.attributes["name"].value, path.attributes["value"].value))
elif kind == "inc":
# <pathentry include="/data/src/blender/blender/source/blender/editors/include" kind="inc" path="" system="true"/>
includes.append(path.attributes["include"].value)
else:
pass
return includes, defines
def cmake_cache_var(var):
cache_file = open(os.path.join(CMAKE_DIR, "CMakeCache.txt"))
lines = [l_strip for l in cache_file for l_strip in (l.strip(),) if l_strip if not l_strip.startswith("//") if not l_strip.startswith("#")]
cache_file.close()
for l in lines:
if l.split(":")[0] == var:
return l.split("=", 1)[-1]
return None
def cmake_compiler_defines():
compiler = cmake_cache_var("CMAKE_C_COMPILER") # could do CXX too
if compiler is None:
print("Couldn't find the compiler, os defines will be omitted...")
return
import tempfile
temp_c = tempfile.mkstemp(suffix=".c")[1]
temp_def = tempfile.mkstemp(suffix=".def")[1]
os.system("%s -dM -E %s > %s" % (compiler, temp_c, temp_def))
temp_def_file = open(temp_def)
lines = [l.strip() for l in temp_def_file if l.strip()]
temp_def_file.close()
os.remove(temp_c)
os.remove(temp_def)
return lines
def create_qtc_project_main(): def create_qtc_project_main():
files = list(source_list(base, filename_check=is_project_file)) files = list(source_list(SOURCE_DIR, filename_check=is_project_file))
files_rel = [relpath(f, start=PROJECT_DIR) for f in files] files_rel = [relpath(f, start=PROJECT_DIR) for f in files]
files_rel.sort() files_rel.sort()
@@ -260,7 +94,7 @@ def create_qtc_project_main():
def create_qtc_project_python(): def create_qtc_project_python():
files = list(source_list(base, filename_check=is_py)) files = list(source_list(SOURCE_DIR, filename_check=is_py))
files_rel = [relpath(f, start=PROJECT_DIR) for f in files] files_rel = [relpath(f, start=PROJECT_DIR) for f in files]
files_rel.sort() files_rel.sort()

View File

@@ -88,9 +88,6 @@ macro(SETUP_LIBDIRS)
if(WITH_IMAGE_OPENJPEG AND UNIX AND NOT APPLE) if(WITH_IMAGE_OPENJPEG AND UNIX AND NOT APPLE)
link_directories(${OPENJPEG_LIBPATH}) link_directories(${OPENJPEG_LIBPATH})
endif() endif()
if(WITH_LCMS)
link_directories(${LCMS_LIBPATH})
endif()
if(WITH_CODEC_QUICKTIME) if(WITH_CODEC_QUICKTIME)
link_directories(${QUICKTIME_LIBPATH}) link_directories(${QUICKTIME_LIBPATH})
endif() endif()
@@ -114,6 +111,9 @@ macro(SETUP_LIBDIRS)
link_directories(${PCRE_LIBPATH}) link_directories(${PCRE_LIBPATH})
link_directories(${EXPAT_LIBPATH}) link_directories(${EXPAT_LIBPATH})
endif() endif()
if(WITH_MEM_JEMALLOC)
link_directories(${JEMALLOC_LIBPATH})
endif()
if(WIN32 AND NOT UNIX) if(WIN32 AND NOT UNIX)
link_directories(${PTHREADS_LIBPATH}) link_directories(${PTHREADS_LIBPATH})
@@ -190,9 +190,6 @@ macro(setup_liblinks
if(WITH_IMAGE_OPENJPEG AND UNIX AND NOT APPLE) if(WITH_IMAGE_OPENJPEG AND UNIX AND NOT APPLE)
target_link_libraries(${target} ${OPENJPEG_LIB}) target_link_libraries(${target} ${OPENJPEG_LIB})
endif() endif()
if(WITH_LCMS)
target_link_libraries(${target} ${LCMS_LIBRARY})
endif()
if(WITH_CODEC_FFMPEG) if(WITH_CODEC_FFMPEG)
target_link_libraries(${target} ${FFMPEG_LIB}) target_link_libraries(${target} ${FFMPEG_LIB})
endif() endif()
@@ -214,11 +211,8 @@ macro(setup_liblinks
target_link_libraries(${target} ${EXPAT_LIB}) target_link_libraries(${target} ${EXPAT_LIB})
endif() endif()
endif() endif()
if(WITH_LCMS) if(WITH_MEM_JEMALLOC)
if(WIN32 AND NOT UNIX) target_link_libraries(${target} ${JEMALLOC_LIBRARY})
target_link_libraries(${target} debug ${LCMS_LIB}_d)
target_link_libraries(${target} optimized ${LCMS_LIB})
endif()
endif() endif()
if(WIN32 AND NOT UNIX) if(WIN32 AND NOT UNIX)
target_link_libraries(${target} ${PTHREADS_LIB}) target_link_libraries(${target} ${PTHREADS_LIB})

View File

@@ -38,7 +38,7 @@ if(CMAKE_SYSTEM_NAME MATCHES "Linux")
include(build_files/cmake/RpmBuild.cmake) include(build_files/cmake/RpmBuild.cmake)
if(RPMBUILD_FOUND AND NOT WIN32) if(RPMBUILD_FOUND AND NOT WIN32)
set(CPACK_GENERATOR "RPM") set(CPACK_GENERATOR "RPM")
set(CPACK_RPM_PACKAGE_RELEASE "r${BUILD_REV}") set(CPACK_RPM_PACKAGE_RELEASE "1.r${BUILD_REV}")
set(CPACK_SET_DESTDIR "true") set(CPACK_SET_DESTDIR "true")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PROJECT_DESCRIPTION}") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PROJECT_DESCRIPTION}")
set(CPACK_PACKAGE_RELOCATABLE "false") set(CPACK_PACKAGE_RELOCATABLE "false")

218
build_files/cmake/project_info.py Executable file
View File

@@ -0,0 +1,218 @@
#!/usr/bin/env python
# $Id$
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# Contributor(s): Campbell Barton, M.G. Kishalmi
#
# ***** END GPL LICENSE BLOCK *****
# <pep8 compliant>
"""
Example Win32 usage:
c:\Python32\python.exe c:\blender_dev\blender\build_files\cmake\cmake_qtcreator_project.py c:\blender_dev\cmake_build
example linux usage
python .~/blenderSVN/blender/build_files/cmake/cmake_qtcreator_project.py ~/blenderSVN/cmake
"""
__all__ = (
"SIMPLE_PROJECTFILE",
"SOURCE_DIR",
"CMAKE_DIR",
"PROJECT_DIR",
"source_list",
"is_project_file",
"is_c_header",
"is_py",
"cmake_advanced_info",
"cmake_compiler_defines",
)
import sys
import os
from os.path import join, dirname, normpath, abspath, splitext, relpath, exists
SOURCE_DIR = join(dirname(__file__), "..", "..")
SOURCE_DIR = normpath(SOURCE_DIR)
SOURCE_DIR = abspath(SOURCE_DIR)
SIMPLE_PROJECTFILE = False
# get cmake path
CMAKE_DIR = sys.argv[-1]
if not exists(join(CMAKE_DIR, "CMakeCache.txt")):
CMAKE_DIR = os.getcwd()
if not exists(join(CMAKE_DIR, "CMakeCache.txt")):
print("CMakeCache.txt not found in %r or %r\n Pass CMake build dir as an argument, or run from that dir, aborting" % (CMAKE_DIR, os.getcwd()))
sys.exit(1)
# could be either.
# PROJECT_DIR = SOURCE_DIR
PROJECT_DIR = CMAKE_DIR
def source_list(path, filename_check=None):
for dirpath, dirnames, filenames in os.walk(path):
# skip '.svn'
if dirpath.startswith("."):
continue
for filename in filenames:
filepath = join(dirpath, filename)
if filename_check is None or filename_check(filepath):
yield filepath
# extension checking
def is_cmake(filename):
ext = splitext(filename)[1]
return (ext == ".cmake") or (filename.endswith("CMakeLists.txt"))
def is_c_header(filename):
ext = splitext(filename)[1]
return (ext in (".h", ".hpp", ".hxx"))
def is_py(filename):
ext = splitext(filename)[1]
return (ext == ".py")
def is_glsl(filename):
ext = splitext(filename)[1]
return (ext == ".glsl")
def is_c(filename):
ext = splitext(filename)[1]
return (ext in (".c", ".cpp", ".cxx", ".m", ".mm", ".rc"))
def is_c_any(filename):
return is_c(filename) or is_c_header(filename)
def is_svn_file(filename):
dn, fn = os.path.split(filename)
filename_svn = join(dn, ".svn", "text-base", "%s.svn-base" % fn)
return exists(filename_svn)
def is_project_file(filename):
return (is_c_any(filename) or is_cmake(filename) or is_glsl(filename)) # and is_svn_file(filename)
def cmake_advanced_info():
""" Extracr includes and defines from cmake.
"""
def create_eclipse_project(CMAKE_DIR):
print("CMAKE_DIR %r" % CMAKE_DIR)
if sys.platform == "win32":
cmd = 'cmake "%s" -G"Eclipse CDT4 - MinGW Makefiles"' % CMAKE_DIR
else:
cmd = 'cmake "%s" -G"Eclipse CDT4 - Unix Makefiles"' % CMAKE_DIR
os.system(cmd)
includes = []
defines = []
create_eclipse_project(CMAKE_DIR)
from xml.dom.minidom import parse
tree = parse(join(CMAKE_DIR, ".cproject"))
'''
f = open(".cproject_pretty", 'w')
f.write(tree.toprettyxml(indent=" ", newl=""))
'''
ELEMENT_NODE = tree.ELEMENT_NODE
cproject, = tree.getElementsByTagName("cproject")
for storage in cproject.childNodes:
if storage.nodeType != ELEMENT_NODE:
continue
if storage.attributes["moduleId"].value == "org.eclipse.cdt.core.settings":
cconfig = storage.getElementsByTagName("cconfiguration")[0]
for substorage in cconfig.childNodes:
if substorage.nodeType != ELEMENT_NODE:
continue
moduleId = substorage.attributes["moduleId"].value
# org.eclipse.cdt.core.settings
# org.eclipse.cdt.core.language.mapping
# org.eclipse.cdt.core.externalSettings
# org.eclipse.cdt.core.pathentry
# org.eclipse.cdt.make.core.buildtargets
if moduleId == "org.eclipse.cdt.core.pathentry":
for path in substorage.childNodes:
if path.nodeType != ELEMENT_NODE:
continue
kind = path.attributes["kind"].value
if kind == "mac":
# <pathentry kind="mac" name="PREFIX" path="" value="&quot;/opt/blender25&quot;"/>
defines.append((path.attributes["name"].value, path.attributes["value"].value))
elif kind == "inc":
# <pathentry include="/data/src/blender/blender/source/blender/editors/include" kind="inc" path="" system="true"/>
includes.append(path.attributes["include"].value)
else:
pass
return includes, defines
def cmake_cache_var(var):
cache_file = open(join(CMAKE_DIR, "CMakeCache.txt"))
lines = [l_strip for l in cache_file for l_strip in (l.strip(),) if l_strip if not l_strip.startswith("//") if not l_strip.startswith("#")]
cache_file.close()
for l in lines:
if l.split(":")[0] == var:
return l.split("=", 1)[-1]
return None
def cmake_compiler_defines():
compiler = cmake_cache_var("CMAKE_C_COMPILER") # could do CXX too
if compiler is None:
print("Couldn't find the compiler, os defines will be omitted...")
return
import tempfile
temp_c = tempfile.mkstemp(suffix=".c")[1]
temp_def = tempfile.mkstemp(suffix=".def")[1]
os.system("%s -dM -E %s > %s" % (compiler, temp_c, temp_def))
temp_def_file = open(temp_def)
lines = [l.strip() for l in temp_def_file if l.strip()]
temp_def_file.close()
os.remove(temp_c)
os.remove(temp_def)
return lines

View File

@@ -5,7 +5,7 @@ BuildRoot: @CPACK_RPM_DIRECTORY@/@CPACK_PACKAGE_FILE_NAME@@CPACK_RPM_PACKAG
Summary: @CPACK_RPM_PACKAGE_SUMMARY@ Summary: @CPACK_RPM_PACKAGE_SUMMARY@
Name: @CPACK_RPM_PACKAGE_NAME@ Name: @CPACK_RPM_PACKAGE_NAME@
Version: @CPACK_RPM_PACKAGE_VERSION@ Version: @CPACK_RPM_PACKAGE_VERSION@
Release: @CPACK_RPM_PACKAGE_RELEASE@ Release: @CPACK_RPM_PACKAGE_RELEASE@%{?dist}
License: @CPACK_RPM_PACKAGE_LICENSE@ License: @CPACK_RPM_PACKAGE_LICENSE@
Group: @CPACK_RPM_PACKAGE_GROUP@ Group: @CPACK_RPM_PACKAGE_GROUP@
Vendor: @CPACK_RPM_PACKAGE_VENDOR@ Vendor: @CPACK_RPM_PACKAGE_VENDOR@

View File

@@ -178,6 +178,14 @@ BF_EXPAT = '/usr'
BF_EXPAT_LIB = 'expat' BF_EXPAT_LIB = 'expat'
BF_EXPAT_LIBPATH = '/usr/lib' BF_EXPAT_LIBPATH = '/usr/lib'
WITH_BF_JEMALLOC = False
WITH_BF_STATICJEMALLOC = False
BF_JEMALLOC = '/usr'
BF_JEMALLOC_INC = '${BF_JEMALLOC}/include'
BF_JEMALLOC_LIBPATH = '${BF_JEMALLOC}/lib'
BF_JEMALLOC_LIB = 'jemalloc'
BF_JEMALLOC_LIB_STATIC = '${BF_JEMALLOC_LIBPATH}/libjemalloc.a'
WITH_BF_OPENMP = True WITH_BF_OPENMP = True
#Ray trace optimization #Ray trace optimization

View File

@@ -149,12 +149,6 @@ BF_OPENCOLLADA_INC = '${BF_OPENCOLLADA}/include'
BF_OPENCOLLADA_LIB = 'OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser MathMLSolver xml2 pcre buffer ftoa UTF' BF_OPENCOLLADA_LIB = 'OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser MathMLSolver xml2 pcre buffer ftoa UTF'
BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib' BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib'
WITH_BF_LCMS = False
BF_LCMS = LIBDIR + '/lcms'
BF_LCMS_INC = '${BF_LCMS}/include'
BF_LCMS_LIB = 'lcms'
BF_LCMS_LIBPATH = '${BF_LCMS}/lib'
#Ray trace optimization #Ray trace optimization
WITH_BF_RAYOPTIMIZATION = True WITH_BF_RAYOPTIMIZATION = True
BF_RAYOPTIMIZATION_SSE_FLAGS = ['/arch:SSE'] BF_RAYOPTIMIZATION_SSE_FLAGS = ['/arch:SSE']

View File

@@ -151,12 +151,6 @@ BF_OPENCOLLADA_INC = '${BF_OPENCOLLADA}/include'
BF_OPENCOLLADA_LIB = 'OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser MathMLSolver xml2 pcre buffer ftoa UTF' BF_OPENCOLLADA_LIB = 'OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser MathMLSolver xml2 pcre buffer ftoa UTF'
BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib' BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib'
WITH_BF_LCMS = False
BF_LCMS = LIBDIR + '/lcms'
BF_LCMS_INC = '${BF_LCMS}/include'
BF_LCMS_LIB = 'lcms'
BF_LCMS_LIBPATH = '${BF_LCMS}/lib'
#Ray trace optimization #Ray trace optimization
WITH_BF_RAYOPTIMIZATION = True WITH_BF_RAYOPTIMIZATION = True
BF_RAYOPTIMIZATION_SSE_FLAGS = ['/arch:SSE','/arch:SSE2'] BF_RAYOPTIMIZATION_SSE_FLAGS = ['/arch:SSE','/arch:SSE2']

View File

@@ -148,8 +148,6 @@ def setup_staticlibs(lenv):
libincs += Split(lenv['BF_OPENEXR_LIBPATH']) libincs += Split(lenv['BF_OPENEXR_LIBPATH'])
if lenv['WITH_BF_STATICOPENEXR']: if lenv['WITH_BF_STATICOPENEXR']:
statlibs += Split(lenv['BF_OPENEXR_LIB_STATIC']) statlibs += Split(lenv['BF_OPENEXR_LIB_STATIC'])
if lenv['WITH_BF_LCMS']:
libincs += Split(lenv['BF_LCMS_LIBPATH'])
if lenv['WITH_BF_TIFF']: if lenv['WITH_BF_TIFF']:
libincs += Split(lenv['BF_TIFF_LIBPATH']) libincs += Split(lenv['BF_TIFF_LIBPATH'])
if lenv['WITH_BF_STATICTIFF']: if lenv['WITH_BF_STATICTIFF']:
@@ -203,6 +201,11 @@ def setup_staticlibs(lenv):
if lenv['OURPLATFORM'] not in ('win32-vc', 'win32-mingw', 'win64-vc', 'linuxcross'): if lenv['OURPLATFORM'] not in ('win32-vc', 'win32-mingw', 'win64-vc', 'linuxcross'):
libincs.append('/usr/lib') libincs.append('/usr/lib')
if lenv['WITH_BF_JEMALLOC']:
libincs += Split(lenv['BF_JEMALLOC_LIBPATH'])
if lenv['WITH_BF_STATICJEMALLOC']:
statlibs += Split(lenv['BF_JEMALLOC_LIB_STATIC'])
return statlibs, libincs return statlibs, libincs
def setup_syslibs(lenv): def setup_syslibs(lenv):
@@ -253,8 +256,6 @@ def setup_syslibs(lenv):
syslibs += Split(lenv['BF_OPENGL_LIB']) syslibs += Split(lenv['BF_OPENGL_LIB'])
if lenv['OURPLATFORM'] in ('win32-vc', 'win32-mingw','linuxcross', 'win64-vc'): if lenv['OURPLATFORM'] in ('win32-vc', 'win32-mingw','linuxcross', 'win64-vc'):
syslibs += Split(lenv['BF_PTHREADS_LIB']) syslibs += Split(lenv['BF_PTHREADS_LIB'])
if lenv['WITH_BF_LCMS']:
syslibs.append(lenv['BF_LCMS_LIB'])
if lenv['WITH_BF_COLLADA']: if lenv['WITH_BF_COLLADA']:
syslibs.append(lenv['BF_PCRE_LIB']) syslibs.append(lenv['BF_PCRE_LIB'])
syslibs += Split(lenv['BF_OPENCOLLADA_LIB']) syslibs += Split(lenv['BF_OPENCOLLADA_LIB'])
@@ -263,6 +264,9 @@ def setup_syslibs(lenv):
if not lenv['WITH_BF_STATICLIBSAMPLERATE']: if not lenv['WITH_BF_STATICLIBSAMPLERATE']:
syslibs += Split(lenv['BF_LIBSAMPLERATE_LIB']) syslibs += Split(lenv['BF_LIBSAMPLERATE_LIB'])
if lenv['WITH_BF_JEMALLOC']:
if not lenv['WITH_BF_STATICJEMALLOC']:
syslibs += Split(lenv['BF_JEMALLOC_LIB'])
syslibs += lenv['LLIBS'] syslibs += lenv['LLIBS']

View File

@@ -125,7 +125,6 @@ def validate_arguments(args, bc):
'BF_FANCY', 'BF_QUIET', 'BF_LINE_OVERWRITE', 'BF_FANCY', 'BF_QUIET', 'BF_LINE_OVERWRITE',
'BF_X264_CONFIG', 'BF_X264_CONFIG',
'BF_XVIDCORE_CONFIG', 'BF_XVIDCORE_CONFIG',
'WITH_BF_LCMS', 'BF_LCMS', 'BF_LCMS_INC', 'BF_LCMS_LIB', 'BF_LCMS_LIBPATH',
'WITH_BF_DOCS', 'WITH_BF_DOCS',
'BF_NUMJOBS', 'BF_NUMJOBS',
'BF_MSVS', 'BF_MSVS',
@@ -134,7 +133,8 @@ def validate_arguments(args, bc):
'WITH_BF_RAYOPTIMIZATION', 'WITH_BF_RAYOPTIMIZATION',
'BF_RAYOPTIMIZATION_SSE_FLAGS', 'BF_RAYOPTIMIZATION_SSE_FLAGS',
'BF_NO_ELBEEM', 'BF_NO_ELBEEM',
'WITH_BF_CXX_GUARDEDALLOC' 'WITH_BF_CXX_GUARDEDALLOC',
'WITH_BF_JEMALLOC', 'WITH_BF_STATICJEMALLOC', 'BF_JEMALLOC', 'BF_JEMALLOC_INC', 'BF_JEMALLOC_LIBPATH', 'BF_JEMALLOC_LIB', 'BF_JEMALLOC_LIB_STATIC'
] ]
# Have options here that scons expects to be lists # Have options here that scons expects to be lists
@@ -333,12 +333,6 @@ def read_opts(env, cfg, args):
('BF_TIFF_LIBPATH', 'TIFF library path', ''), ('BF_TIFF_LIBPATH', 'TIFF library path', ''),
('BF_TIFF_LIB_STATIC', 'TIFF static library', ''), ('BF_TIFF_LIB_STATIC', 'TIFF static library', ''),
(BoolVariable('WITH_BF_LCMS', 'Enable color correction with lcms', False)),
('BF_LCMS', 'LCMS base path', ''),
('BF_LCMS_INC', 'LCMS include path', ''),
('BF_LCMS_LIB', 'LCMS library', ''),
('BF_LCMS_LIBPATH', 'LCMS library path', ''),
(BoolVariable('WITH_BF_ZLIB', 'Use ZLib if true', True)), (BoolVariable('WITH_BF_ZLIB', 'Use ZLib if true', True)),
(BoolVariable('WITH_BF_STATICZLIB', 'Staticly link to ZLib', False)), (BoolVariable('WITH_BF_STATICZLIB', 'Staticly link to ZLib', False)),
('BF_ZLIB', 'ZLib base path', ''), ('BF_ZLIB', 'ZLib base path', ''),
@@ -429,6 +423,14 @@ def read_opts(env, cfg, args):
('BF_EXPAT_LIB', 'Expat library', ''), ('BF_EXPAT_LIB', 'Expat library', ''),
('BF_EXPAT_LIBPATH', 'Expat library path', ''), ('BF_EXPAT_LIBPATH', 'Expat library path', ''),
(BoolVariable('WITH_BF_JEMALLOC', 'Use jemalloc if true', False)),
(BoolVariable('WITH_BF_STATICJEMALLOC', 'Staticly link to jemalloc', False)),
('BF_JEMALLOC', 'jemalloc base path', ''),
('BF_JEMALLOC_INC', 'jemalloc include path', ''),
('BF_JEMALLOC_LIB', 'jemalloc library', ''),
('BF_JEMALLOC_LIBPATH', 'jemalloc library path', ''),
('BF_JEMALLOC_LIB_STATIC', 'jemalloc static library', ''),
(BoolVariable('WITH_BF_PLAYER', 'Build blenderplayer if true', False)), (BoolVariable('WITH_BF_PLAYER', 'Build blenderplayer if true', False)),
(BoolVariable('WITH_BF_NOBLENDER', 'Do not build blender if true', False)), (BoolVariable('WITH_BF_NOBLENDER', 'Do not build blender if true', False)),

View File

@@ -145,10 +145,6 @@
* merged in docs. * merged in docs.
*/ */
/** \defgroup blo readblenfile
* \ingroup blender data
*/
/** \defgroup quicktime quicktime /** \defgroup quicktime quicktime
* \ingroup blender * \ingroup blender

View File

@@ -29,7 +29,7 @@ set(INC
../string ../string
../../source/blender/imbuf ../../source/blender/imbuf
../../source/blender/makesdna ../../source/blender/makesdna
${GLEW_INCLUDE_PATH} ${GLEW_INCLUDE_PATH}
) )
set(SRC set(SRC

View File

@@ -42,7 +42,7 @@
#include <iostream> #include <iostream>
#ifdef FREE_WINDOWS #ifdef FREE_WINDOWS
# define _WIN32_WINNT 0x0500 /* GetConsoleWindow() for MinGW */ # define WINVER 0x0501 /* GetConsoleWindow() for MinGW */
#endif #endif
#include "GHOST_SystemWin32.h" #include "GHOST_SystemWin32.h"
@@ -1178,25 +1178,29 @@ GHOST_TUns8* GHOST_SystemWin32::getClipboard(bool selection) const
char *temp_buff; char *temp_buff;
if ( IsClipboardFormatAvailable(CF_TEXT) && OpenClipboard(NULL) ) { if ( IsClipboardFormatAvailable(CF_TEXT) && OpenClipboard(NULL) ) {
size_t len = 0;
HANDLE hData = GetClipboardData( CF_TEXT ); HANDLE hData = GetClipboardData( CF_TEXT );
if (hData == NULL) { if (hData == NULL) {
CloseClipboard(); CloseClipboard();
return NULL; return NULL;
} }
buffer = (char*)GlobalLock( hData ); buffer = (char*)GlobalLock( hData );
if (!buffer) {
CloseClipboard();
return NULL;
}
temp_buff = (char*) malloc(strlen(buffer)+1); len = strlen(buffer);
strcpy(temp_buff, buffer); temp_buff = (char*) malloc(len+1);
strncpy(temp_buff, buffer, len);
temp_buff[len] = '\0';
/* Buffer mustn't be accessed after CloseClipboard
it would like accessing free-d memory */
GlobalUnlock( hData ); GlobalUnlock( hData );
CloseClipboard(); CloseClipboard();
temp_buff[strlen(buffer)] = '\0'; return (GHOST_TUns8*)temp_buff;
if (buffer) {
return (GHOST_TUns8*)temp_buff;
} else {
return NULL;
}
} else { } else {
return NULL; return NULL;
} }

View File

@@ -52,6 +52,9 @@
#ifndef RID_INPUT #ifndef RID_INPUT
#define RID_INPUT 0x10000003 #define RID_INPUT 0x10000003
#endif #endif
#ifndef RIM_INPUTSINK
#define RIM_INPUTSINK 0x1
#endif
#ifndef RI_KEY_BREAK #ifndef RI_KEY_BREAK
#define RI_KEY_BREAK 0x1 #define RI_KEY_BREAK 0x1
#endif #endif
@@ -127,8 +130,6 @@ DECLARE_HANDLE(HRAWINPUT);
#ifdef FREE_WINDOWS #ifdef FREE_WINDOWS
#define NEED_RAW_PROC #define NEED_RAW_PROC
typedef BOOL (WINAPI * LPFNDLLRRID)(RAWINPUTDEVICE*,UINT, UINT); typedef BOOL (WINAPI * LPFNDLLRRID)(RAWINPUTDEVICE*,UINT, UINT);
#define RegisterRawInputDevices(pRawInputDevices, uiNumDevices, cbSize) ((pRegisterRawInputDevices)?pRegisterRawInputDevices(pRawInputDevices, uiNumDevices, cbSize):0)
typedef UINT (WINAPI * LPFNDLLGRID)(HRAWINPUT, UINT, LPVOID, PUINT, UINT); typedef UINT (WINAPI * LPFNDLLGRID)(HRAWINPUT, UINT, LPVOID, PUINT, UINT);
#define GetRawInputData(hRawInput, uiCommand, pData, pcbSize, cbSizeHeader) ((pGetRawInputData)?pGetRawInputData(hRawInput, uiCommand, pData, pcbSize, cbSizeHeader):(UINT)-1) #define GetRawInputData(hRawInput, uiCommand, pData, pcbSize, cbSizeHeader) ((pGetRawInputData)?pGetRawInputData(hRawInput, uiCommand, pData, pcbSize, cbSizeHeader):(UINT)-1)

View File

@@ -700,19 +700,24 @@ GHOST_SystemX11::processEvent(XEvent *xe)
case EnterNotify: case EnterNotify:
case LeaveNotify: case LeaveNotify:
{ {
// XCrossingEvents pointer leave enter window. /* XCrossingEvents pointer leave enter window.
// also do cursor move here, MotionNotify only also do cursor move here, MotionNotify only
// happens when motion starts & ends inside window happens when motion starts & ends inside window.
we only do moves when the crossing mode is 'normal'
(really crossing between windows) since some windowmanagers
also send grab/ungrab crossings for mousewheel events.
*/
XCrossingEvent &xce = xe->xcrossing; XCrossingEvent &xce = xe->xcrossing;
if( xce.mode == NotifyNormal ) {
g_event = new g_event = new
GHOST_EventCursor( GHOST_EventCursor(
getMilliSeconds(), getMilliSeconds(),
GHOST_kEventCursorMove, GHOST_kEventCursorMove,
window, window,
xce.x_root, xce.x_root,
xce.y_root xce.y_root
); );
}
break; break;
} }
case MapNotify: case MapNotify:

View File

@@ -370,7 +370,7 @@ MT_Vector3 IK_QSphericalSegment::Axis(int dof) const
void IK_QSphericalSegment::SetLimit(int axis, MT_Scalar lmin, MT_Scalar lmax) void IK_QSphericalSegment::SetLimit(int axis, MT_Scalar lmin, MT_Scalar lmax)
{ {
if (lmin >= lmax) if (lmin > lmax)
return; return;
if (axis == 1) { if (axis == 1) {
@@ -613,7 +613,7 @@ void IK_QRevoluteSegment::UpdateAngleApply()
void IK_QRevoluteSegment::SetLimit(int axis, MT_Scalar lmin, MT_Scalar lmax) void IK_QRevoluteSegment::SetLimit(int axis, MT_Scalar lmin, MT_Scalar lmax)
{ {
if (lmin >= lmax || m_axis != axis) if (lmin > lmax || m_axis != axis)
return; return;
// clamp and convert to axis angle parameters // clamp and convert to axis angle parameters
@@ -752,7 +752,7 @@ void IK_QSwingSegment::UpdateAngleApply()
void IK_QSwingSegment::SetLimit(int axis, MT_Scalar lmin, MT_Scalar lmax) void IK_QSwingSegment::SetLimit(int axis, MT_Scalar lmin, MT_Scalar lmax)
{ {
if (lmin >= lmax) if (lmin > lmax)
return; return;
// clamp and convert to axis angle parameters // clamp and convert to axis angle parameters
@@ -898,7 +898,7 @@ void IK_QElbowSegment::UpdateAngleApply()
void IK_QElbowSegment::SetLimit(int axis, MT_Scalar lmin, MT_Scalar lmax) void IK_QElbowSegment::SetLimit(int axis, MT_Scalar lmin, MT_Scalar lmax)
{ {
if (lmin >= lmax) if (lmin > lmax)
return; return;
// clamp and convert to axis angle parameters // clamp and convert to axis angle parameters

View File

@@ -1,22 +1,22 @@
# common stuff # common stuff
LDFLAGS_COMMON = -lfftw3 #-lglut -lglu32 -lopengl32 -lz -lpng LDFLAGS_COMMON = -lfftw3 #-lglut -lglu32 -lopengl32 -lz -lpng
CFLAGS_COMMON = -c -Wall -I./ #-I/cygdrive/c/lib/glvu/include -D_WIN32 CFLAGS_COMMON = -c -Wall -I./ #-I/cygdrive/c/lib/glvu/include -D_WIN32
CC = g++ CC = g++
CFLAGS = ${CFLAGS_COMMON} -O3 -Wno-unused CFLAGS = ${CFLAGS_COMMON} -O3 -Wno-unused
LDFLAGS = ${LDFLAGS_COMMON} LDFLAGS = ${LDFLAGS_COMMON}
EXECUTABLE = noiseFFT EXECUTABLE = noiseFFT
SOURCES = noiseFFT.cpp SOURCES = noiseFFT.cpp
OBJECTS = $(SOURCES:.cpp=.o) OBJECTS = $(SOURCES:.cpp=.o)
all: $(SOURCES) $(EXECUTABLE) all: $(SOURCES) $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS) $(EXECUTABLE): $(OBJECTS)
$(CC) $(OBJECTS) $(LDFLAGS) -o $@ $(CC) $(OBJECTS) $(LDFLAGS) -o $@
.cpp.o: .cpp.o:
$(CC) $(CFLAGS) $< -o $@ $(CC) $(CFLAGS) $< -o $@
clean: clean:
rm -f *.o $(EXECUTABLE_LOADER) $(EXECUTABLE) rm -f *.o $(EXECUTABLE_LOADER) $(EXECUTABLE)

View File

@@ -1,23 +1,23 @@
CC = g++ CC = g++
LDFLAGS = -lz -lpng LDFLAGS = -lz -lpng
CFLAGS = -O3 -Wno-unused -c -Wall -I./ -D_WIN32 CFLAGS = -O3 -Wno-unused -c -Wall -I./ -D_WIN32
EXECUTABLE = FLUID_3D EXECUTABLE = FLUID_3D
SOURCES = main.cpp FLUID_3D.cpp FLUID_3D_SOLVERS.cpp FLUID_3D_STATIC.cpp SPHERE.cpp WTURBULENCE.cpp SOURCES = main.cpp FLUID_3D.cpp FLUID_3D_SOLVERS.cpp FLUID_3D_STATIC.cpp SPHERE.cpp WTURBULENCE.cpp
OBJECTS = $(SOURCES:.cpp=.o) OBJECTS = $(SOURCES:.cpp=.o)
all: $(SOURCES) $(EXECUTABLE) all: $(SOURCES) $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS) $(EXECUTABLE): $(OBJECTS)
$(CC) $(OBJECTS) $(LDFLAGS) -o $@ $(CC) $(OBJECTS) $(LDFLAGS) -o $@
.cpp.o: .cpp.o:
$(CC) $(CFLAGS) $< -o $@ $(CC) $(CFLAGS) $< -o $@
SPHERE.o: SPHERE.h SPHERE.o: SPHERE.h
FLUID_3D.o: FLUID_3D.h FLUID_3D.cpp FLUID_3D.o: FLUID_3D.h FLUID_3D.cpp
FLUID_3D_SOLVERS.o: FLUID_3D.h FLUID_3D_SOLVERS.cpp FLUID_3D_SOLVERS.o: FLUID_3D.h FLUID_3D_SOLVERS.cpp
main.o: FLUID_3D.h FLUID_3D.cpp FLUID_3D_SOLVERS.cpp main.o: FLUID_3D.h FLUID_3D.cpp FLUID_3D_SOLVERS.cpp
clean: clean:
rm -f *.o $(EXECUTABLE_LOADER) $(EXECUTABLE) rm -f *.o $(EXECUTABLE_LOADER) $(EXECUTABLE)

View File

@@ -1,23 +1,23 @@
CC = g++ CC = g++
LDFLAGS = -lz -lpng -fopenmp -lgomp LDFLAGS = -lz -lpng -fopenmp -lgomp
CFLAGS = -c -Wall -I./ -fopenmp -DPARALLEL=1 -O3 -Wno-unused CFLAGS = -c -Wall -I./ -fopenmp -DPARALLEL=1 -O3 -Wno-unused
EXECUTABLE = FLUID_3D EXECUTABLE = FLUID_3D
SOURCES = main.cpp FLUID_3D.cpp FLUID_3D_SOLVERS.cpp FLUID_3D_STATIC.cpp SPHERE.cpp WTURBULENCE.cpp SOURCES = main.cpp FLUID_3D.cpp FLUID_3D_SOLVERS.cpp FLUID_3D_STATIC.cpp SPHERE.cpp WTURBULENCE.cpp
OBJECTS = $(SOURCES:.cpp=.o) OBJECTS = $(SOURCES:.cpp=.o)
all: $(SOURCES) $(EXECUTABLE) all: $(SOURCES) $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS) $(EXECUTABLE): $(OBJECTS)
$(CC) $(OBJECTS) $(LDFLAGS) -o $@ $(CC) $(OBJECTS) $(LDFLAGS) -o $@
.cpp.o: .cpp.o:
$(CC) $(CFLAGS) $< -o $@ $(CC) $(CFLAGS) $< -o $@
SPHERE.o: SPHERE.h SPHERE.o: SPHERE.h
FLUID_3D.o: FLUID_3D.h FLUID_3D.cpp FLUID_3D.o: FLUID_3D.h FLUID_3D.cpp
FLUID_3D_SOLVERS.o: FLUID_3D.h FLUID_3D_SOLVERS.cpp FLUID_3D_SOLVERS.o: FLUID_3D.h FLUID_3D_SOLVERS.cpp
main.o: FLUID_3D.h FLUID_3D.cpp FLUID_3D_SOLVERS.cpp main.o: FLUID_3D.h FLUID_3D.cpp FLUID_3D_SOLVERS.cpp
clean: clean:
rm -f *.o $(EXECUTABLE_LOADER) $(EXECUTABLE) rm -f *.o $(EXECUTABLE_LOADER) $(EXECUTABLE)

View File

@@ -1,35 +1,35 @@
CC = g++ CC = g++
# uncomment the other two OPENMP_... lines, if your gcc supports OpenMP # uncomment the other two OPENMP_... lines, if your gcc supports OpenMP
#OPENMP_FLAGS = -fopenmp -DPARALLEL=1 -I/opt/gcc-4.3/usr/local/include #OPENMP_FLAGS = -fopenmp -DPARALLEL=1 -I/opt/gcc-4.3/usr/local/include
#OPENMPLD_FLAGS = -fopenmp -lgomp -I/opt/gcc-4.3/usr/local/lib #OPENMPLD_FLAGS = -fopenmp -lgomp -I/opt/gcc-4.3/usr/local/lib
OPENMP_FLAGS = OPENMP_FLAGS =
OPENMPLD_FLAGS = OPENMPLD_FLAGS =
# assumes MacPorts libpng installation # assumes MacPorts libpng installation
PNG_INCLUDE = -I/opt/local/include PNG_INCLUDE = -I/opt/local/include
PNG_LIBS = -I/opt/local/lib PNG_LIBS = -I/opt/local/lib
LDFLAGS = $(PNG_LIBS)-lz -lpng $(OPENMPLD_FLAGS) LDFLAGS = $(PNG_LIBS)-lz -lpng $(OPENMPLD_FLAGS)
CFLAGS = -c -Wall -I./ $(PNG_INCLUDE) $(OPENMP_FLAGS) -O3 -Wno-unused CFLAGS = -c -Wall -I./ $(PNG_INCLUDE) $(OPENMP_FLAGS) -O3 -Wno-unused
EXECUTABLE = FLUID_3D EXECUTABLE = FLUID_3D
SOURCES = main.cpp FLUID_3D.cpp FLUID_3D_SOLVERS.cpp FLUID_3D_STATIC.cpp SPHERE.cpp WTURBULENCE.cpp SOURCES = main.cpp FLUID_3D.cpp FLUID_3D_SOLVERS.cpp FLUID_3D_STATIC.cpp SPHERE.cpp WTURBULENCE.cpp
OBJECTS = $(SOURCES:.cpp=.o) OBJECTS = $(SOURCES:.cpp=.o)
all: $(SOURCES) $(EXECUTABLE) all: $(SOURCES) $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS) $(EXECUTABLE): $(OBJECTS)
$(CC) $(OBJECTS) $(LDFLAGS) -o $@ $(CC) $(OBJECTS) $(LDFLAGS) -o $@
.cpp.o: .cpp.o:
$(CC) $(CFLAGS) $< -o $@ $(CC) $(CFLAGS) $< -o $@
SPHERE.o: SPHERE.h SPHERE.o: SPHERE.h
FLUID_3D.o: FLUID_3D.h FLUID_3D.cpp FLUID_3D.o: FLUID_3D.h FLUID_3D.cpp
FLUID_3D_SOLVERS.o: FLUID_3D.h FLUID_3D_SOLVERS.cpp FLUID_3D_SOLVERS.o: FLUID_3D.h FLUID_3D_SOLVERS.cpp
main.o: FLUID_3D.h FLUID_3D.cpp FLUID_3D_SOLVERS.cpp main.o: FLUID_3D.h FLUID_3D.cpp FLUID_3D_SOLVERS.cpp
clean: clean:
rm -f *.o $(EXECUTABLE_LOADER) $(EXECUTABLE) rm -f *.o $(EXECUTABLE_LOADER) $(EXECUTABLE)

View File

@@ -1,18 +1,18 @@
# This is a Blender Environment Variable config file. # This is a Blender Environment Variable config file.
# #
# Comment lines start with "#", other lines will be split at the "=" # Comment lines start with "#", other lines will be split at the "="
# and the part before will be used as env var name and the part after # and the part before will be used as env var name and the part after
# as env var value. The value can make reference to previous or # as env var value. The value can make reference to previous or
# prelaunch variables with "%%" and the content will be replaced. # prelaunch variables with "%%" and the content will be replaced.
# Once set, values of variables will not be overwritten. # Once set, values of variables will not be overwritten.
# #
# BLENDER_SHARE should be COMMON_APPDATA\\Blender Foundation\\Blender for typical installs. # BLENDER_SHARE should be COMMON_APPDATA\\Blender Foundation\\Blender for typical installs.
# BLENDER_VERSION will be set by the program before processing this file. # BLENDER_VERSION will be set by the program before processing this file.
BLENDER_USER_BASE=%USERPROFILE%\\Blender Foundation\\Blender\\%BLENDER_VERSION% BLENDER_USER_BASE=%USERPROFILE%\\Blender Foundation\\Blender\\%BLENDER_VERSION%
BLENDER_SYSTEM_BASE=%BLENDER_SHARE%\\%BLENDER_VERSION% BLENDER_SYSTEM_BASE=%BLENDER_SHARE%\\%BLENDER_VERSION%
BLENDER_USER_DATAFILES=%USERPROFILE%\\Blender Foundation\\%BLENDER_VERSION%\\datafiles BLENDER_USER_DATAFILES=%USERPROFILE%\\Blender Foundation\\%BLENDER_VERSION%\\datafiles
BLENDER_SYSTEM_DATAFILES=%BLENDER_SHARE%\\%BLENDER_VERSION%\\datafiles BLENDER_SYSTEM_DATAFILES=%BLENDER_SHARE%\\%BLENDER_VERSION%\\datafiles
BLENDER_USER_PY=%USERPROFILE%\\Blender Foundation\\%BLENDER_VERSION%\\py BLENDER_USER_PY=%USERPROFILE%\\Blender Foundation\\%BLENDER_VERSION%\\py
BLENDER_SYSTEM_PY=%BLENDER_SHARE%\\%BLENDER_VERSION%\\py BLENDER_SYSTEM_PY=%BLENDER_SHARE%\\%BLENDER_VERSION%\\py
BLENDER_USER_PLUGINS=%USERPROFILE%\\Blender Foundation\\%BLENDER_VERSION%\\plugins BLENDER_USER_PLUGINS=%USERPROFILE%\\Blender Foundation\\%BLENDER_VERSION%\\plugins
BLENDER_SYSTEM_PLUGINS=%BLENDER_SHARE%\\%BLENDER_VERSION%\\plugins BLENDER_SYSTEM_PLUGINS=%BLENDER_SHARE%\\%BLENDER_VERSION%\\plugins

View File

@@ -0,0 +1,31 @@
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
"""
Utility modules assosiated with the bpy module.
"""
__all__ = (
"object_utils",
"io_utils",
"image_utils",
"mesh_utils",
"view3d_utils",
)

View File

@@ -0,0 +1,121 @@
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
def _is_persp_matrix(persmat, eps=0.00001):
"""
crummy way to check if its a perspective matrix
"""
return not (
abs(persmat[0][3]) < eps and \
abs(persmat[1][3]) < eps and \
abs(persmat[2][3]) < eps and \
abs(persmat[3][3] - 1.0) < eps)
def region_2d_to_vector_3d(region, rv3d, coord):
"""
Return a direction vector from the viewport at the spesific 2d region
coordinate.
:arg region: region of the 3D viewport, typically bpy.context.region.
:type region: :class:`Region`
:arg rv3d: 3D region data, typically bpy.context.space_data.region_3d.
:type rv3d: :class:`RegionView3D`
:arg coord: 2d coordinates relative to the region;
(event.mouse_region_x, event.mouse_region_y) for example.
:type coord: 2d vector
:return: normalized 3d vector.
:rtype: :class:`Vector`
"""
from mathutils import Vector
persmat = rv3d.perspective_matrix.copy()
viewvec = rv3d.view_matrix.inverted()[2].xyz.normalized()
if _is_persp_matrix(persmat):
dx = (2.0 * coord[0] / region.width) - 1.0
dy = (2.0 * coord[1] / region.height) - 1.0
perspinv_x, perspinv_y = persmat.inverted().to_3x3()[0:2]
return ((perspinv_x * dx + perspinv_y * dy) - viewvec).normalized()
else:
return viewvec
def region_2d_to_location_3d(region, rv3d, coord, depth_location):
"""
Return a 3d location from the region relative 2d coords, aligned with
*depth_location*.
:arg region: region of the 3D viewport, typically bpy.context.region.
:type region: :class:`Region`
:arg rv3d: 3D region data, typically bpy.context.space_data.region_3d.
:type rv3d: :class:`RegionView3D`
:arg coord: 2d coordinates relative to the region;
(event.mouse_region_x, event.mouse_region_y) for example.
:type coord: 2d vector
:arg depth_location: the returned vectors depth is aligned with this since
there is no defined depth with a 2d region input.
:type depth_location: 3d vector
:return: normalized 3d vector.
:rtype: :class:`Vector`
"""
from mathutils.geometry import intersect_point_line
persmat = rv3d.perspective_matrix.copy()
if _is_persp_matrix(persmat):
origin_start = rv3d.view_matrix.inverted()[3].to_3d()
else:
dx = (2.0 * coord[0] / region.width) - 1.0
dy = (2.0 * coord[1] / region.height) - 1.0
persinv = persmat.inverted()
viewinv = rv3d.view_matrix.inverted()
origin_start = (persinv[0].xyz * dx) + (persinv[1].xyz * dy) + viewinv[3].xyz
origin_end = origin_start + region_2d_to_vector_3d(region, rv3d, coord)
return intersect_point_line(depth_location, origin_start, origin_end)[0]
def location_3d_to_region_2d(region, rv3d, coord):
"""
Return the *region* relative 2d location of a 3d position.
:arg region: region of the 3D viewport, typically bpy.context.region.
:type region: :class:`Region`
:arg rv3d: 3D region data, typically bpy.context.space_data.region_3d.
:type rv3d: :class:`RegionView3D`
:arg coord: 3d worldspace location.
:type coord: 3d vector
:return: 2d location
:rtype: :class:`Vector`
"""
prj = Vector((coord[0], coord[1], coord[2], 1.0)) * rv3d.perspective_matrix
if prj.w > 0.0:
width_half = region.width / 2.0
height_half = region.height / 2.0
return Vector((width_half + width_half * (prj.x / prj.w),
height_half + height_half * (prj.y / prj.w),
))
else:
return None

View File

@@ -132,7 +132,7 @@ class AddTorus(bpy.types.Operator):
mesh.faces.foreach_set("vertices_raw", faces) mesh.faces.foreach_set("vertices_raw", faces)
mesh.update() mesh.update()
import add_object_utils from bpy_extras import object_utils
add_object_utils.object_data_add(context, mesh, operator=self) object_utils.object_data_add(context, mesh, operator=self)
return {'FINISHED'} return {'FINISHED'}

View File

@@ -102,7 +102,8 @@ def register():
('Render', "Render", ""), ('Render', "Render", ""),
('Rigging', "Rigging", ""), ('Rigging', "Rigging", ""),
('Text Editor', "Text Editor", ""), ('Text Editor', "Text Editor", ""),
('System', "System", "") ('System', "System", ""),
('Other', "Other", ""),
], ],
name="Category", name="Category",
description="Filter add-ons by category", description="Filter add-ons by category",

View File

@@ -127,6 +127,7 @@ class DATA_PT_camera_display(CameraButtonsPanel, bpy.types.Panel):
col.prop(cam, "show_mist", text="Mist") col.prop(cam, "show_mist", text="Mist")
col.prop(cam, "show_title_safe", text="Title Safe") col.prop(cam, "show_title_safe", text="Title Safe")
col.prop(cam, "show_name", text="Name") col.prop(cam, "show_name", text="Name")
col.prop_menu_enum(cam, "show_guide")
col = split.column() col = split.column()
col.prop(cam, "draw_size", text="Size") col.prop(cam, "draw_size", text="Size")

View File

@@ -39,6 +39,17 @@ class DATA_PT_empty(DataButtonsPanel, bpy.types.Panel):
ob = context.object ob = context.object
layout.prop(ob, "empty_draw_type", text="Display") layout.prop(ob, "empty_draw_type", text="Display")
if ob.empty_draw_type == 'IMAGE':
# layout.template_image(ob, "data", None)
layout.template_ID(ob, "data", open="image.open", unlink="image.unlink")
row = layout.row(align = True)
row.prop(ob, "color", text="Transparency", index=3, slider=True)
row = layout.row(align = True)
row.prop(ob, "empty_image_offset", text="Offset X", index=0)
row.prop(ob, "empty_image_offset", text="Offset Y", index=1)
layout.prop(ob, "empty_draw_size", text="Size") layout.prop(ob, "empty_draw_size", text="Size")
if __name__ == "__main__": # only for live edit. if __name__ == "__main__": # only for live edit.

View File

@@ -46,6 +46,8 @@ class MESH_MT_shape_key_specials(bpy.types.Menu):
layout.operator("object.shape_key_transfer", icon='COPY_ID') # icon is not ideal layout.operator("object.shape_key_transfer", icon='COPY_ID') # icon is not ideal
layout.operator("object.join_shapes", icon='COPY_ID') # icon is not ideal layout.operator("object.join_shapes", icon='COPY_ID') # icon is not ideal
layout.operator("object.shape_key_mirror", icon='ARROW_LEFTRIGHT') layout.operator("object.shape_key_mirror", icon='ARROW_LEFTRIGHT')
op = layout.operator("object.shape_key_add", icon='ZOOMIN', text="New Shape From Mix")
op.from_mix = True
class MeshButtonsPanel(): class MeshButtonsPanel():
@@ -193,7 +195,8 @@ class DATA_PT_shape_keys(MeshButtonsPanel, bpy.types.Panel):
col = row.column() col = row.column()
sub = col.column(align=True) sub = col.column(align=True)
sub.operator("object.shape_key_add", icon='ZOOMIN', text="") op = sub.operator("object.shape_key_add", icon='ZOOMIN', text="")
op.from_mix = False
sub.operator("object.shape_key_remove", icon='ZOOMOUT', text="") sub.operator("object.shape_key_remove", icon='ZOOMOUT', text="")
sub.menu("MESH_MT_shape_key_specials", icon='DOWNARROW_HLT', text="") sub.menu("MESH_MT_shape_key_specials", icon='DOWNARROW_HLT', text="")

View File

@@ -219,7 +219,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, bpy.types.Panel):
col.label(text="Texture Coordinates:") col.label(text="Texture Coordinates:")
col.prop(md, "texture_coords", text="") col.prop(md, "texture_coords", text="")
if md.texture_coords == 'OBJECT': if md.texture_coords == 'OBJECT':
layout.prop(md, "texture_coordinate_object", text="Object") layout.prop(md, "texture_coords_object", text="Object")
elif md.texture_coords == 'UV' and ob.type == 'MESH': elif md.texture_coords == 'UV' and ob.type == 'MESH':
layout.prop_search(md, "uv_layer", ob.data, "uv_textures") layout.prop_search(md, "uv_layer", ob.data, "uv_textures")
@@ -673,7 +673,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, bpy.types.Panel):
col.prop(md, "texture_coords", text="") col.prop(md, "texture_coords", text="")
if md.texture_coords == 'OBJECT': if md.texture_coords == 'OBJECT':
layout.prop(md, "texture_coordinate_object", text="Object") layout.prop(md, "texture_coords_object", text="Object")
elif md.texture_coords == 'UV' and ob.type == 'MESH': elif md.texture_coords == 'UV' and ob.type == 'MESH':
layout.prop_search(md, "uv_layer", ob.data, "uv_textures") layout.prop_search(md, "uv_layer", ob.data, "uv_textures")

View File

@@ -436,7 +436,8 @@ class IMAGE_PT_game_properties(bpy.types.Panel):
def poll(cls, context): def poll(cls, context):
rd = context.scene.render rd = context.scene.render
sima = context.space_data sima = context.space_data
return (sima and sima.image) and (rd.engine == 'BLENDER_GAME') # display even when not in game mode because these settings effect the 3d view
return (sima and sima.image) # and (rd.engine == 'BLENDER_GAME')
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout

View File

@@ -213,6 +213,7 @@ class SEQUENCER_MT_add_effect(bpy.types.Menu):
layout.operator("sequencer.effect_strip_add", text="Color").type = 'COLOR' layout.operator("sequencer.effect_strip_add", text="Color").type = 'COLOR'
layout.operator("sequencer.effect_strip_add", text="Speed Control").type = 'SPEED' layout.operator("sequencer.effect_strip_add", text="Speed Control").type = 'SPEED'
layout.operator("sequencer.effect_strip_add", text="Multicam Selector").type = 'MULTICAM' layout.operator("sequencer.effect_strip_add", text="Multicam Selector").type = 'MULTICAM'
layout.operator("sequencer.effect_strip_add", text="Adjustment Layer").type = 'ADJUSTMENT'
class SEQUENCER_MT_strip(bpy.types.Menu): class SEQUENCER_MT_strip(bpy.types.Menu):
@@ -391,7 +392,7 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel, bpy.types.Panel):
'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP', 'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP',
'PLUGIN', 'PLUGIN',
'WIPE', 'GLOW', 'TRANSFORM', 'COLOR', 'SPEED', 'WIPE', 'GLOW', 'TRANSFORM', 'COLOR', 'SPEED',
'MULTICAM'} 'MULTICAM', 'ADJUSTMENT'}
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
@@ -530,7 +531,7 @@ class SEQUENCER_PT_input(SequencerButtonsPanel, bpy.types.Panel):
'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP', 'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP',
'PLUGIN', 'PLUGIN',
'WIPE', 'GLOW', 'TRANSFORM', 'COLOR', 'WIPE', 'GLOW', 'TRANSFORM', 'COLOR',
'MULTICAM', 'SPEED'} 'MULTICAM', 'SPEED', 'ADJUSTMENT'}
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
@@ -680,7 +681,7 @@ class SEQUENCER_PT_filter(SequencerButtonsPanel, bpy.types.Panel):
'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP', 'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP',
'PLUGIN', 'PLUGIN',
'WIPE', 'GLOW', 'TRANSFORM', 'COLOR', 'WIPE', 'GLOW', 'TRANSFORM', 'COLOR',
'MULTICAM', 'SPEED'} 'MULTICAM', 'SPEED', 'ADJUSTMENT'}
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout

View File

@@ -2024,6 +2024,9 @@ class VIEW3D_PT_view3d_properties(bpy.types.Panel):
elif not view.lock_object: elif not view.lock_object:
col.prop(view, "lock_cursor", text="Lock to Cursor") col.prop(view, "lock_cursor", text="Lock to Cursor")
col = layout.column()
col.prop(view, "lock_camera")
col = layout.column(align=True) col = layout.column(align=True)
col.label(text="Clip:") col.label(text="Clip:")
col.prop(view, "clip_start", text="Start") col.prop(view, "clip_start", text="Start")

View File

@@ -12,7 +12,7 @@ def write_some_data(context, filepath, use_some_setting):
# ExportHelper is a helper class, defines filename and # ExportHelper is a helper class, defines filename and
# invoke() function which calls the file selector. # invoke() function which calls the file selector.
from io_utils import ExportHelper from bpy_extras.io_utils import ExportHelper
from bpy.props import StringProperty, BoolProperty, EnumProperty from bpy.props import StringProperty, BoolProperty, EnumProperty

View File

@@ -80,8 +80,8 @@ class AddBox(bpy.types.Operator):
mesh.update() mesh.update()
# add the mesh as an object into the scene with this utility module # add the mesh as an object into the scene with this utility module
import add_object_utils from bpy_extras import object_utils
add_object_utils.object_data_add(context, mesh, operator=self) object_utils.object_data_add(context, mesh, operator=self)
return {'FINISHED'} return {'FINISHED'}

View File

@@ -1,261 +1,261 @@
; ;
; $Id$ ; $Id$
; ;
; Blender Self-Installer for Windows (NSIS - http://nsis.sourceforge.net) ; Blender Self-Installer for Windows (NSIS - http://nsis.sourceforge.net)
; ;
SetCompressor /SOLID lzma SetCompressor /SOLID lzma
Name "Blender [VERSION]" Name "Blender [VERSION]"
RequestExecutionLevel admin RequestExecutionLevel admin
!include "MUI.nsh" !include "MUI.nsh"
!include "WinVer.nsh" !include "WinVer.nsh"
!include "FileFunc.nsh" !include "FileFunc.nsh"
!include "WordFunc.nsh" !include "WordFunc.nsh"
!include "nsDialogs.nsh" !include "nsDialogs.nsh"
!include "x64.nsh" !include "x64.nsh"
!define MUI_ABORTWARNING !define MUI_ABORTWARNING
!define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of Blender. It is recommended that you close all other applications before starting Setup." !define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of Blender. It is recommended that you close all other applications before starting Setup."
!define MUI_WELCOMEFINISHPAGE_BITMAP "[RELDIR]\01.installer.bmp" !define MUI_WELCOMEFINISHPAGE_BITMAP "[RELDIR]\01.installer.bmp"
!define MUI_HEADERIMAGE !define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "[RELDIR]\00.header.bmp" !define MUI_HEADERIMAGE_BITMAP "[RELDIR]\00.header.bmp"
!define MUI_COMPONENTSPAGE_SMALLDESC !define MUI_COMPONENTSPAGE_SMALLDESC
!define MUI_FINISHPAGE_RUN "$INSTDIR\blender.exe" !define MUI_FINISHPAGE_RUN "$INSTDIR\blender.exe"
!define MUI_CHECKBITMAP "[RELDIR]\00.checked.bmp" !define MUI_CHECKBITMAP "[RELDIR]\00.checked.bmp"
!define MUI_UNWELCOMEFINISHPAGE_BITMAP "[RELDIR]\01.installer.bmp" !define MUI_UNWELCOMEFINISHPAGE_BITMAP "[RELDIR]\01.installer.bmp"
!insertmacro MUI_PAGE_WELCOME !insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "[DISTDIR]\Copyright.txt" !insertmacro MUI_PAGE_LICENSE "[DISTDIR]\Copyright.txt"
!insertmacro MUI_PAGE_COMPONENTS !insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_DIRECTORY
Page custom DataLocation DataLocationOnLeave Page custom DataLocation DataLocationOnLeave
!insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH !insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_WELCOME !insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM !insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES !insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH !insertmacro MUI_UNPAGE_FINISH
!insertmacro Locate !insertmacro Locate
!insertmacro VersionCompare !insertmacro VersionCompare
Icon "[RELDIR]\00.installer.ico" Icon "[RELDIR]\00.installer.ico"
UninstallIcon "[RELDIR]\00.installer.ico" UninstallIcon "[RELDIR]\00.installer.ico"
;-------------------------------- ;--------------------------------
;Languages ;Languages
!insertmacro MUI_LANGUAGE "English" !insertmacro MUI_LANGUAGE "English"
;-------------------------------- ;--------------------------------
;Language Strings ;Language Strings
;Description ;Description
LangString DESC_InstallFiles ${LANG_ENGLISH} "Copy all required files to the application folder." LangString DESC_InstallFiles ${LANG_ENGLISH} "Copy all required files to the application folder."
LangString DESC_StartMenu ${LANG_ENGLISH} "Add shortcut items to the Start Menu. (Recommended)" LangString DESC_StartMenu ${LANG_ENGLISH} "Add shortcut items to the Start Menu. (Recommended)"
LangString DESC_DesktopShortcut ${LANG_ENGLISH} "Add a shortcut to Blender on your desktop." LangString DESC_DesktopShortcut ${LANG_ENGLISH} "Add a shortcut to Blender on your desktop."
LangString DESC_BlendRegister ${LANG_ENGLISH} "Blender can register itself with .blend files to allow double-clicking from Windows Explorer, etc." LangString DESC_BlendRegister ${LANG_ENGLISH} "Blender can register itself with .blend files to allow double-clicking from Windows Explorer, etc."
LangString TEXT_IO_TITLE ${LANG_ENGLISH} "Specify User Data Location" LangString TEXT_IO_TITLE ${LANG_ENGLISH} "Specify User Data Location"
;-------------------------------- ;--------------------------------
;Data ;Data
Caption "Blender [VERSION] Installer" Caption "Blender [VERSION] Installer"
OutFile "[DISTDIR]\..\blender-[VERSION]-windows[BITNESS].exe" OutFile "[DISTDIR]\..\blender-[VERSION]-windows[BITNESS].exe"
InstallDir $INSTDIR ; $INSTDIR is set inside .onInit InstallDir $INSTDIR ; $INSTDIR is set inside .onInit
BrandingText "Blender Foundation | http://www.blender.org" BrandingText "Blender Foundation | http://www.blender.org"
ComponentText "This will install Blender [VERSION] on your computer." ComponentText "This will install Blender [VERSION] on your computer."
DirText "Use the field below to specify the folder where you want Blender to be copied to. To specify a different folder, type a new name or use the Browse button to select an existing folder." DirText "Use the field below to specify the folder where you want Blender to be copied to. To specify a different folder, type a new name or use the Browse button to select an existing folder."
SilentUnInstall normal SilentUnInstall normal
Var BLENDERHOME Var BLENDERHOME
Var SHORTVERSION ; This is blender_version_decimal() from path_util.c Var SHORTVERSION ; This is blender_version_decimal() from path_util.c
; Custom controls ; Custom controls
Var HWND Var HWND
Var HWND_APPDATA Var HWND_APPDATA
Var HWND_INSTDIR Var HWND_INSTDIR
Var HWND_HOMEDIR Var HWND_HOMEDIR
Function .onInit Function .onInit
ClearErrors ClearErrors
StrCpy $SHORTVERSION "[SHORTVERSION]" StrCpy $SHORTVERSION "[SHORTVERSION]"
${If} ${RunningX64} ${If} ${RunningX64}
${If} "[BITNESS]" == "32" ${If} "[BITNESS]" == "32"
${OrIf} "[BITNESS]" == "-mingw" ${OrIf} "[BITNESS]" == "-mingw"
StrCpy $INSTDIR "$PROGRAMFILES32\Blender Foundation\Blender" ; Can't use InstallDir inside Section StrCpy $INSTDIR "$PROGRAMFILES32\Blender Foundation\Blender" ; Can't use InstallDir inside Section
${ElseIf} "[BITNESS]" == "64" ${ElseIf} "[BITNESS]" == "64"
StrCpy $INSTDIR "$PROGRAMFILES64\Blender Foundation\Blender" StrCpy $INSTDIR "$PROGRAMFILES64\Blender Foundation\Blender"
${EndIf} ${EndIf}
${Else} ${Else}
StrCpy $INSTDIR "$PROGRAMFILES\Blender Foundation\Blender" StrCpy $INSTDIR "$PROGRAMFILES\Blender Foundation\Blender"
${EndIf} ${EndIf}
FunctionEnd FunctionEnd
Function un.onInit Function un.onInit
FunctionEnd FunctionEnd
Function DataLocation Function DataLocation
nsDialogs::Create /NOUNLOAD 1018 nsDialogs::Create /NOUNLOAD 1018
Pop $HWND Pop $HWND
${If} $HWND == error ${If} $HWND == error
Abort Abort
${EndIf} ${EndIf}
${NSD_CreateLabel} 0 0 100% 24u "Please specify where you wish to install Blender's user data files. Be aware that if you choose to use your Application Data directory, your preferences and scripts will only be accessible by the current user account." ${NSD_CreateLabel} 0 0 100% 24u "Please specify where you wish to install Blender's user data files. Be aware that if you choose to use your Application Data directory, your preferences and scripts will only be accessible by the current user account."
${NSD_CreateRadioButton} 0 50 100% 12u "Use Application Data directory (recommended)" ${NSD_CreateRadioButton} 0 50 100% 12u "Use Application Data directory (recommended)"
Pop $HWND_APPDATA Pop $HWND_APPDATA
${NSD_CreateRadioButton} 0 80 100% 12u "Use installation directory" ${NSD_CreateRadioButton} 0 80 100% 12u "Use installation directory"
Pop $HWND_INSTDIR Pop $HWND_INSTDIR
${NSD_CreateRadioButton} 0 110 100% 12u "I have defined a %HOME% variable, please install files there" ${NSD_CreateRadioButton} 0 110 100% 12u "I have defined a %HOME% variable, please install files there"
Pop $HWND_HOMEDIR Pop $HWND_HOMEDIR
${If} ${AtMostWinME} ${If} ${AtMostWinME}
GetDlgItem $0 $HWND $HWND_APPDATA GetDlgItem $0 $HWND $HWND_APPDATA
EnableWindow $0 0 EnableWindow $0 0
SendMessage $HWND_INSTDIR ${BM_SETCHECK} 1 0 SendMessage $HWND_INSTDIR ${BM_SETCHECK} 1 0
${Else} ${Else}
SendMessage $HWND_APPDATA ${BM_SETCHECK} 1 0 SendMessage $HWND_APPDATA ${BM_SETCHECK} 1 0
${EndIf} ${EndIf}
nsDialogs::Show nsDialogs::Show
FunctionEnd FunctionEnd
Function DataLocationOnLeave Function DataLocationOnLeave
${NSD_GetState} $HWND_APPDATA $R0 ${NSD_GetState} $HWND_APPDATA $R0
${If} $R0 == "1" ${If} $R0 == "1"
SetShellVarContext current SetShellVarContext current
StrCpy $BLENDERHOME "$APPDATA\Blender Foundation\Blender" StrCpy $BLENDERHOME "$APPDATA\Blender Foundation\Blender"
SetShellVarContext all SetShellVarContext all
${Else} ${Else}
${NSD_GetState} $HWND_INSTDIR $R0 ${NSD_GetState} $HWND_INSTDIR $R0
${If} $R0 == "1" ${If} $R0 == "1"
StrCpy $BLENDERHOME $INSTDIR StrCpy $BLENDERHOME $INSTDIR
${Else} ${Else}
${NSD_GetState} $HWND_HOMEDIR $R0 ${NSD_GetState} $HWND_HOMEDIR $R0
${If} $R0 == "1" ${If} $R0 == "1"
ReadEnvStr $BLENDERHOME "HOME" ReadEnvStr $BLENDERHOME "HOME"
${EndIf} ${EndIf}
${EndIf} ${EndIf}
${EndIf} ${EndIf}
FunctionEnd FunctionEnd
Section "Blender [VERSION] (required)" InstallFiles Section "Blender [VERSION] (required)" InstallFiles
SectionIn RO SectionIn RO
; Set output path to the installation directory. ; Set output path to the installation directory.
SetOutPath $INSTDIR SetOutPath $INSTDIR
; The contents of Blender installation root dir ; The contents of Blender installation root dir
[ROOTDIRCONTS] [ROOTDIRCONTS]
; All datafiles (python, scripts, config) ; All datafiles (python, scripts, config)
[DODATAFILES] [DODATAFILES]
SetOutPath $INSTDIR SetOutPath $INSTDIR
${If} ${RunningX64} ${If} ${RunningX64}
SetRegView 64 SetRegView 64
${EndIf} ${EndIf}
; Write the installation path into the registry ; Write the installation path into the registry
WriteRegStr HKLM "SOFTWARE\BlenderFoundation" "Install_Dir" "$INSTDIR" WriteRegStr HKLM "SOFTWARE\BlenderFoundation" "Install_Dir" "$INSTDIR"
WriteRegStr HKLM "SOFTWARE\BlenderFoundation" "ConfigData_Dir" "$BLENDERHOME" WriteRegStr HKLM "SOFTWARE\BlenderFoundation" "ConfigData_Dir" "$BLENDERHOME"
WriteRegStr HKLM "SOFTWARE\BlenderFoundation" "ShortVersion" "[SHORTVERSION]" WriteRegStr HKLM "SOFTWARE\BlenderFoundation" "ShortVersion" "[SHORTVERSION]"
; Write the uninstall keys for Windows ; Write the uninstall keys for Windows
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Blender" "DisplayName" "Blender" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Blender" "DisplayName" "Blender"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Blender" "Publisher" "Blender Foundation" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Blender" "Publisher" "Blender Foundation"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Blender" "URLInfoAbout" "http://www.blender.org/" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Blender" "URLInfoAbout" "http://www.blender.org/"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Blender" "DisplayVersion" "[VERSION]" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Blender" "DisplayVersion" "[VERSION]"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Blender" "DisplayIcon" "$INSTDIR\blender.exe" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Blender" "DisplayIcon" "$INSTDIR\blender.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Blender" "UninstallString" '"$INSTDIR\uninstall.exe"' WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Blender" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Blender" "NoModify" 1 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Blender" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Blender" "NoRepair " 1 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Blender" "NoRepair " 1
WriteUninstaller "uninstall.exe" WriteUninstaller "uninstall.exe"
SectionEnd SectionEnd
Section "Add Start Menu Shortcuts" StartMenu Section "Add Start Menu Shortcuts" StartMenu
SetShellVarContext all SetShellVarContext all
CreateDirectory "$SMPROGRAMS\Blender Foundation\Blender\" CreateDirectory "$SMPROGRAMS\Blender Foundation\Blender\"
CreateShortCut "$SMPROGRAMS\Blender Foundation\Blender\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0 CreateShortCut "$SMPROGRAMS\Blender Foundation\Blender\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
CreateShortCut "$SMPROGRAMS\Blender Foundation\Blender\Blender.lnk" "$INSTDIR\Blender.exe" "" "$INSTDIR\blender.exe" 0 CreateShortCut "$SMPROGRAMS\Blender Foundation\Blender\Blender.lnk" "$INSTDIR\Blender.exe" "" "$INSTDIR\blender.exe" 0
CreateShortCut "$SMPROGRAMS\Blender Foundation\Blender\Readme.lnk" "$INSTDIR\readme.html" "" "" 0 CreateShortCut "$SMPROGRAMS\Blender Foundation\Blender\Readme.lnk" "$INSTDIR\readme.html" "" "" 0
CreateShortCut "$SMPROGRAMS\Blender Foundation\Blender\Copyright.lnk" "$INSTDIR\Copyright.txt" "" "$INSTDIR\copyright.txt" 0 CreateShortCut "$SMPROGRAMS\Blender Foundation\Blender\Copyright.lnk" "$INSTDIR\Copyright.txt" "" "$INSTDIR\copyright.txt" 0
CreateShortCut "$SMPROGRAMS\Blender Foundation\Blender\GPL-license.lnk" "$INSTDIR\GPL-license.txt" "" "$INSTDIR\GPL-license.txt" 0 CreateShortCut "$SMPROGRAMS\Blender Foundation\Blender\GPL-license.lnk" "$INSTDIR\GPL-license.txt" "" "$INSTDIR\GPL-license.txt" 0
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)' ; refresh icons System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)' ; refresh icons
SectionEnd SectionEnd
Section "Add Desktop Shortcut" DesktopShortcut Section "Add Desktop Shortcut" DesktopShortcut
CreateShortCut "$DESKTOP\Blender.lnk" "$INSTDIR\blender.exe" "" "$INSTDIR\blender.exe" 0 CreateShortCut "$DESKTOP\Blender.lnk" "$INSTDIR\blender.exe" "" "$INSTDIR\blender.exe" 0
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)' ; refresh icons System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)' ; refresh icons
SectionEnd SectionEnd
Section "Open .blend files with Blender" BlendRegister Section "Open .blend files with Blender" BlendRegister
ExecWait '"$INSTDIR\blender.exe" -r' ExecWait '"$INSTDIR\blender.exe" -r'
SectionEnd SectionEnd
UninstallText "This will uninstall Blender [VERSION], and all installed files. Before continuing make sure you have created backup of all the files you may want to keep: startup.blend, bookmarks.txt, recent-files.txt. Hit 'Uninstall' to continue." UninstallText "This will uninstall Blender [VERSION], and all installed files. Before continuing make sure you have created backup of all the files you may want to keep: startup.blend, bookmarks.txt, recent-files.txt. Hit 'Uninstall' to continue."
Section "Uninstall" Section "Uninstall"
; Remove registry keys ; Remove registry keys
${If} ${RunningX64} ${If} ${RunningX64}
SetRegView 64 SetRegView 64
${EndIf} ${EndIf}
ReadRegStr $BLENDERHOME HKLM "SOFTWARE\BlenderFoundation" "ConfigData_Dir" ReadRegStr $BLENDERHOME HKLM "SOFTWARE\BlenderFoundation" "ConfigData_Dir"
ReadRegStr $SHORTVERSION HKLM "SOFTWARE\BlenderFoundation" "ShortVersion" ReadRegStr $SHORTVERSION HKLM "SOFTWARE\BlenderFoundation" "ShortVersion"
DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Blender" DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Blender"
DeleteRegKey HKLM "SOFTWARE\BlenderFoundation" DeleteRegKey HKLM "SOFTWARE\BlenderFoundation"
DeleteRegKey HKCR ".blend" DeleteRegKey HKCR ".blend"
DeleteRegKey HKCR "blendfile" DeleteRegKey HKCR "blendfile"
DeleteRegKey HKCR "CLSID\{D45F043D-F17F-4e8a-8435-70971D9FA46D}" DeleteRegKey HKCR "CLSID\{D45F043D-F17F-4e8a-8435-70971D9FA46D}"
SetShellVarContext all SetShellVarContext all
; Remove files ; Remove files
[DELROOTDIRCONTS] [DELROOTDIRCONTS]
Delete "$INSTDIR\uninstall.exe" Delete "$INSTDIR\uninstall.exe"
MessageBox MB_YESNO "Recursively erase contents of $BLENDERHOME\$SHORTVERSION\scripts? NOTE: This includes all installed scripts and *any* file and directory you have manually created, installed later or copied. This also including .blend files." IDNO NextNoScriptRemove MessageBox MB_YESNO "Recursively erase contents of $BLENDERHOME\$SHORTVERSION\scripts? NOTE: This includes all installed scripts and *any* file and directory you have manually created, installed later or copied. This also including .blend files." IDNO NextNoScriptRemove
RMDir /r "$BLENDERHOME\$SHORTVERSION\scripts" RMDir /r "$BLENDERHOME\$SHORTVERSION\scripts"
NextNoScriptRemove: NextNoScriptRemove:
MessageBox MB_YESNO "Recursively erase contents from $BLENDERHOME\$SHORTVERSION\config? NOTE: This includes your startup.blend, bookmarks and any other file and directory you may have created in that directory" IDNO NextNoConfigRemove MessageBox MB_YESNO "Recursively erase contents from $BLENDERHOME\$SHORTVERSION\config? NOTE: This includes your startup.blend, bookmarks and any other file and directory you may have created in that directory" IDNO NextNoConfigRemove
RMDir /r "$BLENDERHOME\$SHORTVERSION\config" RMDir /r "$BLENDERHOME\$SHORTVERSION\config"
NextNoConfigRemove: NextNoConfigRemove:
MessageBox MB_YESNO "Recursively erase contents from $BLENDERHOME\$SHORTVERSION\plugins? NOTE: This includes files and subdirectories in this directory" IDNO NextNoPluginRemove MessageBox MB_YESNO "Recursively erase contents from $BLENDERHOME\$SHORTVERSION\plugins? NOTE: This includes files and subdirectories in this directory" IDNO NextNoPluginRemove
RMDir /r "$BLENDERHOME\$SHORTVERSION\plugins" RMDir /r "$BLENDERHOME\$SHORTVERSION\plugins"
NextNoPluginRemove: NextNoPluginRemove:
; Try to remove dirs, but leave them if they contain anything ; Try to remove dirs, but leave them if they contain anything
RMDir "$BLENDERHOME\$SHORTVERSION\plugins" RMDir "$BLENDERHOME\$SHORTVERSION\plugins"
RMDir "$BLENDERHOME\$SHORTVERSION\config" RMDir "$BLENDERHOME\$SHORTVERSION\config"
RMDir "$BLENDERHOME\$SHORTVERSION\scripts" RMDir "$BLENDERHOME\$SHORTVERSION\scripts"
RMDir "$BLENDERHOME\$SHORTVERSION" RMDir "$BLENDERHOME\$SHORTVERSION"
RMDir "$BLENDERHOME" RMDir "$BLENDERHOME"
; Remove shortcuts ; Remove shortcuts
Delete "$SMPROGRAMS\Blender Foundation\Blender\*.*" Delete "$SMPROGRAMS\Blender Foundation\Blender\*.*"
Delete "$DESKTOP\Blender.lnk" Delete "$DESKTOP\Blender.lnk"
; Remove all link related directories and files ; Remove all link related directories and files
RMDir /r "$SMPROGRAMS\Blender Foundation" RMDir /r "$SMPROGRAMS\Blender Foundation"
; Clear out installation dir ; Clear out installation dir
RMDir /r "$INSTDIR" RMDir /r "$INSTDIR"
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)' ; Refresh icons System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)' ; Refresh icons
SectionEnd SectionEnd
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${InstallFiles} $(DESC_InstallFiles) !insertmacro MUI_DESCRIPTION_TEXT ${InstallFiles} $(DESC_InstallFiles)
!insertmacro MUI_DESCRIPTION_TEXT ${StartMenu} $(DESC_StartMenu) !insertmacro MUI_DESCRIPTION_TEXT ${StartMenu} $(DESC_StartMenu)
!insertmacro MUI_DESCRIPTION_TEXT ${DesktopShortcut} $(DESC_DesktopShortcut) !insertmacro MUI_DESCRIPTION_TEXT ${DesktopShortcut} $(DESC_DesktopShortcut)
!insertmacro MUI_DESCRIPTION_TEXT ${BlendRegister} $(DESC_BlendRegister) !insertmacro MUI_DESCRIPTION_TEXT ${BlendRegister} $(DESC_BlendRegister)
!insertmacro MUI_FUNCTION_DESCRIPTION_END !insertmacro MUI_FUNCTION_DESCRIPTION_END

View File

@@ -91,7 +91,6 @@ add_subdirectory(blenlib)
add_subdirectory(render) add_subdirectory(render)
add_subdirectory(blenfont) add_subdirectory(blenfont)
add_subdirectory(blenloader) add_subdirectory(blenloader)
add_subdirectory(readblenfile)
add_subdirectory(blenpluginapi) add_subdirectory(blenpluginapi)
add_subdirectory(ikplugin) add_subdirectory(ikplugin)
add_subdirectory(gpu) add_subdirectory(gpu)
@@ -124,6 +123,5 @@ if(WITH_PYTHON)
endif() endif()
if(WITH_OPENCOLLADA) if(WITH_OPENCOLLADA)
add_subdirectory(collada) add_subdirectory(collada)
endif() endif()

View File

@@ -13,7 +13,6 @@ SConscript(['avi/SConscript',
'imbuf/SConscript', 'imbuf/SConscript',
'makesdna/SConscript', 'makesdna/SConscript',
'makesrna/SConscript', 'makesrna/SConscript',
'readblenfile/SConscript',
'render/SConscript', 'render/SConscript',
'nodes/SConscript', 'nodes/SConscript',
'modifiers/SConscript', 'modifiers/SConscript',

View File

@@ -29,7 +29,7 @@ set(INC
../editors/include ../editors/include
../blenkernel ../blenkernel
../../../intern/guardedalloc ../../../intern/guardedalloc
${GLEW_INCLUDE_PATH} ${GLEW_INCLUDE_PATH}
${FREETYPE_INCLUDE_DIRS} ${FREETYPE_INCLUDE_DIRS}
) )

View File

@@ -51,6 +51,7 @@
#include "BLF_api.h" #include "BLF_api.h"
#include "blf_internal_types.h" #include "blf_internal_types.h"
#include "blf_internal.h"
static ListBase global_font_dir= { NULL, NULL }; static ListBase global_font_dir= { NULL, NULL };
@@ -150,6 +151,7 @@ char *blf_dir_search(const char *file)
return(s); return(s);
} }
#if 0 // UNUSED
int blf_dir_split(const char *str, char *file, int *size) int blf_dir_split(const char *str, char *file, int *size)
{ {
int i, len; int i, len;
@@ -173,6 +175,7 @@ int blf_dir_split(const char *str, char *file, int *size)
} }
return(0); return(0);
} }
#endif
/* Some font have additional file with metrics information, /* Some font have additional file with metrics information,
* in general, the extension of the file is: .afm or .pfm * in general, the extension of the file is: .afm or .pfm

View File

@@ -44,7 +44,7 @@ int blf_utf8_next(unsigned char *buf, int *iindex);
char *blf_dir_search(const char *file); char *blf_dir_search(const char *file);
char *blf_dir_metrics_search(const char *filename); char *blf_dir_metrics_search(const char *filename);
int blf_dir_split(const char *str, char *file, int *size); // int blf_dir_split(const char *str, char *file, int *size); // UNUSED
int blf_font_init(void); int blf_font_init(void);
void blf_font_exit(void); void blf_font_exit(void);

View File

@@ -90,8 +90,7 @@ void brush_painter_free(BrushPainter *painter);
unsigned int *brush_gen_texture_cache(struct Brush *br, int half_side); unsigned int *brush_gen_texture_cache(struct Brush *br, int half_side);
/* radial control */ /* radial control */
void brush_radial_control_invoke(struct wmOperator *op, struct Brush *br, float size_weight); struct ImBuf *brush_gen_radial_control_imbuf(struct Brush *br);
int brush_radial_control_exec(struct wmOperator *op, struct Brush *br, float size_weight);
/* unified strength and size */ /* unified strength and size */

View File

@@ -78,7 +78,6 @@ void curvemapping_premultiply(struct CurveMapping *cumap, int restore);
int curvemapping_RGBA_does_something(struct CurveMapping *cumap); int curvemapping_RGBA_does_something(struct CurveMapping *cumap);
void curvemapping_initialize(struct CurveMapping *cumap); void curvemapping_initialize(struct CurveMapping *cumap);
void curvemapping_table_RGBA(struct CurveMapping *cumap, float **array, int *size); void curvemapping_table_RGBA(struct CurveMapping *cumap, float **array, int *size);
void colorcorrection_do_ibuf(struct ImBuf *ibuf, const char *profile);
void scopes_update(struct Scopes *scopes, struct ImBuf *ibuf, int use_color_management); void scopes_update(struct Scopes *scopes, struct ImBuf *ibuf, int use_color_management);
void scopes_free(struct Scopes *scopes); void scopes_free(struct Scopes *scopes);

View File

@@ -52,6 +52,7 @@ struct Icon
typedef struct Icon Icon; typedef struct Icon Icon;
struct PreviewImage; struct PreviewImage;
struct ID;
void BKE_icons_init(int first_dyn_id); void BKE_icons_init(int first_dyn_id);
@@ -74,11 +75,14 @@ void BKE_icon_changed(int icon_id);
/* free all icons */ /* free all icons */
void BKE_icons_free(void); void BKE_icons_free(void);
/* free the preview image for use in list */
void BKE_previewimg_freefunc(void *link);
/* free the preview image */ /* free the preview image */
void BKE_previewimg_free(struct PreviewImage **prv); void BKE_previewimg_free(struct PreviewImage **prv);
/* free the preview image belonging to the id */ /* free the preview image belonging to the id */
void BKE_previewimg_free_id(ID *id); void BKE_previewimg_free_id(struct ID *id);
/* create a new preview image */ /* create a new preview image */
struct PreviewImage* BKE_previewimg_create(void) ; struct PreviewImage* BKE_previewimg_create(void) ;
@@ -87,6 +91,6 @@ struct PreviewImage* BKE_previewimg_create(void) ;
struct PreviewImage* BKE_previewimg_copy(struct PreviewImage *prv); struct PreviewImage* BKE_previewimg_copy(struct PreviewImage *prv);
/* retrieve existing or create new preview image */ /* retrieve existing or create new preview image */
PreviewImage* BKE_previewimg_get(ID *id); struct PreviewImage* BKE_previewimg_get(struct ID *id);
#endif /* BKE_ICONS_H */ #endif /* BKE_ICONS_H */

View File

@@ -268,6 +268,10 @@ void seq_translate(struct Scene *scene, struct Sequence *seq, int delta);
void seq_sound_init(struct Scene *scene, struct Sequence *seq); void seq_sound_init(struct Scene *scene, struct Sequence *seq);
struct Sequence *seq_foreground_frame_get(struct Scene *scene, int frame); struct Sequence *seq_foreground_frame_get(struct Scene *scene, int frame);
struct ListBase *seq_seqbase(struct ListBase *seqbase, struct Sequence *seq); struct ListBase *seq_seqbase(struct ListBase *seqbase, struct Sequence *seq);
struct Sequence *seq_metastrip(
ListBase * seqbase /* = ed->seqbase */,
struct Sequence * meta /* = NULL */, struct Sequence *seq);
void seq_offset_animdata(struct Scene *scene, struct Sequence *seq, int ofs); void seq_offset_animdata(struct Scene *scene, struct Sequence *seq, int ofs);
void seq_dupe_animdata(struct Scene *scene, char *name_from, char *name_to); void seq_dupe_animdata(struct Scene *scene, char *name_from, char *name_to);
int shuffle_seq(struct ListBase * seqbasep, struct Sequence *test, struct Scene *evil_scene); int shuffle_seq(struct ListBase * seqbasep, struct Sequence *test, struct Scene *evil_scene);

View File

@@ -73,8 +73,8 @@ typedef struct SK_Overdraw
typedef struct SK_DrawData typedef struct SK_DrawData
{ {
short mval[2]; int mval[2];
short previous_mval[2]; int previous_mval[2];
SK_PType type; SK_PType type;
} SK_DrawData; } SK_DrawData;
@@ -152,7 +152,7 @@ void sk_endContinuousStroke(SK_Stroke *stk);
void sk_updateNextPoint(SK_Sketch *sketch, SK_Stroke *stk); void sk_updateNextPoint(SK_Sketch *sketch, SK_Stroke *stk);
void sk_initDrawData(SK_DrawData *dd, const short mval[2]); void sk_initDrawData(SK_DrawData *dd, const int mval[2]);
void sk_deleteSelectedStrokes(SK_Sketch *sketch); void sk_deleteSelectedStrokes(SK_Sketch *sketch);
void sk_selectAllSketch(SK_Sketch *sketch, int mode); void sk_selectAllSketch(SK_Sketch *sketch, int mode);

View File

@@ -54,7 +54,7 @@ set(INC
../../../intern/opennl/extern ../../../intern/opennl/extern
../../../intern/smoke/extern ../../../intern/smoke/extern
../../../intern/mikktspace ../../../intern/mikktspace
../../../source/blender/windowmanager # XXX - BAD LEVEL CALL WM_api.h ../../../source/blender/windowmanager # XXX - BAD LEVEL CALL WM_api.h
${GLEW_INCLUDE_PATH} ${GLEW_INCLUDE_PATH}
${ZLIB_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS}
) )
@@ -279,11 +279,6 @@ if(WITH_CODEC_FFMPEG)
add_definitions(-DWITH_FFMPEG) add_definitions(-DWITH_FFMPEG)
endif() endif()
if(WITH_LCMS)
list(APPEND INC ${LCMS_INCLUDE_DIR})
add_definitions(-DWITH_LCMS)
endif()
if(WITH_PYTHON) if(WITH_PYTHON)
list(APPEND INC ../python ${PYTHON_INCLUDE_DIRS}) list(APPEND INC ../python ${PYTHON_INCLUDE_DIRS})
add_definitions(-DWITH_PYTHON) add_definitions(-DWITH_PYTHON)
@@ -316,7 +311,7 @@ if(WITH_LZMA)
endif() endif()
if(MSVC) if(MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX")
endif() endif()
blender_add_lib(bf_blenkernel "${SRC}" "${INC}") blender_add_lib(bf_blenkernel "${SRC}" "${INC}")

View File

@@ -78,10 +78,6 @@ if env['OURPLATFORM'] == 'darwin':
if env['BF_NO_ELBEEM']: if env['BF_NO_ELBEEM']:
defs.append('DISABLE_ELBEEM') defs.append('DISABLE_ELBEEM')
if env['WITH_BF_LCMS']:
defs.append('WITH_LCMS')
incs += ' ' + env['BF_LCMS_INC']
if env['WITH_BF_LZO']: if env['WITH_BF_LZO']:
incs += ' #/extern/lzo/minilzo' incs += ' #/extern/lzo/minilzo'
defs.append('WITH_LZO') defs.append('WITH_LZO')

View File

@@ -831,7 +831,10 @@ void pose_remove_group (Object *ob)
/* now, remove it from the pose */ /* now, remove it from the pose */
BLI_freelinkN(&pose->agroups, grp); BLI_freelinkN(&pose->agroups, grp);
pose->active_group= 0; pose->active_group--;
if(pose->active_group < 0 || pose->agroups.first == NULL) {
pose->active_group= 0;
}
} }
} }

View File

@@ -191,7 +191,7 @@ static void clean_paths(Main *main)
/* note, this is called on Undo so any slow conversion functions here /* note, this is called on Undo so any slow conversion functions here
* should be avoided or check (mode!='u') */ * should be avoided or check (mode!='u') */
static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filename) static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filepath)
{ {
bScreen *curscreen= NULL; bScreen *curscreen= NULL;
Scene *curscene= NULL; Scene *curscene= NULL;
@@ -295,18 +295,18 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filename
if(recover && bfd->filename[0] && G.relbase_valid) { if(recover && bfd->filename[0] && G.relbase_valid) {
/* in case of autosave or quit.blend, use original filename instead /* in case of autosave or quit.blend, use original filename instead
* use relbase_valid to make sure the file is saved, else we get <memory2> in the filename */ * use relbase_valid to make sure the file is saved, else we get <memory2> in the filename */
filename= bfd->filename; filepath= bfd->filename;
} }
#if 0 #if 0
else if (!G.relbase_valid) { else if (!G.relbase_valid) {
/* otherwise, use an empty string as filename, rather than <memory2> */ /* otherwise, use an empty string as filename, rather than <memory2> */
filename=""; filepath="";
} }
#endif #endif
/* these are the same at times, should never copy to the same location */ /* these are the same at times, should never copy to the same location */
if(G.main->name != filename) if(G.main->name != filepath)
BLI_strncpy(G.main->name, filename, FILE_MAX); BLI_strncpy(G.main->name, filepath, FILE_MAX);
/* baseflags, groups, make depsgraph, etc */ /* baseflags, groups, make depsgraph, etc */
set_scene_bg(G.main, CTX_data_scene(C)); set_scene_bg(G.main, CTX_data_scene(C));
@@ -353,15 +353,15 @@ void BKE_userdef_free(void)
BLI_freelistN(&U.addons); BLI_freelistN(&U.addons);
} }
int BKE_read_file(bContext *C, const char *dir, ReportList *reports) int BKE_read_file(bContext *C, const char *filepath, ReportList *reports)
{ {
BlendFileData *bfd; BlendFileData *bfd;
int retval= BKE_READ_FILE_OK; int retval= BKE_READ_FILE_OK;
if(strstr(dir, BLENDER_STARTUP_FILE)==NULL) /* dont print user-pref loading */ if(strstr(filepath, BLENDER_STARTUP_FILE)==NULL) /* dont print user-pref loading */
printf("read blend: %s\n", dir); printf("read blend: %s\n", filepath);
bfd= BLO_read_from_file(dir, reports); bfd= BLO_read_from_file(filepath, reports);
if (bfd) { if (bfd) {
if(bfd->user) retval= BKE_READ_FILE_OK_USERPREFS; if(bfd->user) retval= BKE_READ_FILE_OK_USERPREFS;
@@ -372,10 +372,10 @@ int BKE_read_file(bContext *C, const char *dir, ReportList *reports)
retval= BKE_READ_FILE_FAIL; retval= BKE_READ_FILE_FAIL;
} }
else else
setup_app_data(C, bfd, dir); // frees BFD setup_app_data(C, bfd, filepath); // frees BFD
} }
else else
BKE_reports_prependf(reports, "Loading %s failed: ", dir); BKE_reports_prependf(reports, "Loading %s failed: ", filepath);
return (bfd?retval:BKE_READ_FILE_FAIL); return (bfd?retval:BKE_READ_FILE_FAIL);
} }
@@ -521,19 +521,19 @@ void BKE_write_undo(bContext *C, const char *name)
/* disk save version */ /* disk save version */
if(UNDO_DISK) { if(UNDO_DISK) {
static int counter= 0; static int counter= 0;
char tstr[FILE_MAXDIR+FILE_MAXFILE]; char filepath[FILE_MAXDIR+FILE_MAXFILE];
char numstr[32]; char numstr[32];
/* calculate current filename */ /* calculate current filepath */
counter++; counter++;
counter= counter % U.undosteps; counter= counter % U.undosteps;
BLI_snprintf(numstr, sizeof(numstr), "%d.blend", counter); BLI_snprintf(numstr, sizeof(numstr), "%d.blend", counter);
BLI_make_file_string("/", tstr, btempdir, numstr); BLI_make_file_string("/", filepath, btempdir, numstr);
success= BLO_write_file(CTX_data_main(C), tstr, G.fileflags, NULL, NULL); success= BLO_write_file(CTX_data_main(C), filepath, G.fileflags, NULL, NULL);
BLI_strncpy(curundo->str, tstr, sizeof(curundo->str)); BLI_strncpy(curundo->str, filepath, sizeof(curundo->str));
} }
else { else {
MemFile *prevfile=NULL; MemFile *prevfile=NULL;

View File

@@ -426,13 +426,6 @@ void brush_curve_preset(Brush *b, /*CurveMappingPreset*/int preset)
curvemapping_changed(b->curve, 0); curvemapping_changed(b->curve, 0);
} }
static MTex *brush_active_texture(Brush *brush)
{
if(brush)
return &brush->mtex;
return NULL;
}
int brush_texture_set_nr(Brush *brush, int nr) int brush_texture_set_nr(Brush *brush, int nr)
{ {
ID *idtest, *id=NULL; ID *idtest, *id=NULL;
@@ -1185,7 +1178,7 @@ unsigned int *brush_gen_texture_cache(Brush *br, int half_side)
} }
/**** Radial Control ****/ /**** Radial Control ****/
static struct ImBuf *brush_gen_radial_control_imbuf(Brush *br) struct ImBuf *brush_gen_radial_control_imbuf(Brush *br)
{ {
ImBuf *im = MEM_callocN(sizeof(ImBuf), "radial control texture"); ImBuf *im = MEM_callocN(sizeof(ImBuf), "radial control texture");
unsigned int *texcache; unsigned int *texcache;
@@ -1219,50 +1212,6 @@ static struct ImBuf *brush_gen_radial_control_imbuf(Brush *br)
return im; return im;
} }
void brush_radial_control_invoke(wmOperator *op, Brush *br, float size_weight)
{
int mode = RNA_enum_get(op->ptr, "mode");
float original_value= 0;
if(mode == WM_RADIALCONTROL_SIZE)
original_value = brush_size(br) * size_weight;
else if(mode == WM_RADIALCONTROL_STRENGTH)
original_value = brush_alpha(br);
else if(mode == WM_RADIALCONTROL_ANGLE) {
MTex *mtex = brush_active_texture(br);
if(mtex)
original_value = mtex->rot;
}
RNA_float_set(op->ptr, "initial_value", original_value);
op->customdata = brush_gen_radial_control_imbuf(br);
}
int brush_radial_control_exec(wmOperator *op, Brush *br, float size_weight)
{
int mode = RNA_enum_get(op->ptr, "mode");
float new_value = RNA_float_get(op->ptr, "new_value");
const float conv = 0.017453293;
if(mode == WM_RADIALCONTROL_SIZE)
if (brush_use_locked_size(br)) {
float initial_value = RNA_float_get(op->ptr, "initial_value");
const float unprojected_radius = brush_unprojected_radius(br);
brush_set_unprojected_radius(br, unprojected_radius * new_value/initial_value * size_weight);
}
else
brush_set_size(br, new_value * size_weight);
else if(mode == WM_RADIALCONTROL_STRENGTH)
brush_set_alpha(br, new_value);
else if(mode == WM_RADIALCONTROL_ANGLE) {
MTex *mtex = brush_active_texture(br);
if(mtex)
mtex->rot = new_value * conv;
}
return OPERATOR_FINISHED;
}
/* Unified Size and Strength */ /* Unified Size and Strength */
static void set_unified_settings(Brush *brush, short flag, int value) static void set_unified_settings(Brush *brush, short flag, int value)

View File

@@ -37,10 +37,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <float.h> #include <float.h>
#ifdef WITH_LCMS
#include <lcms.h>
#endif
#include "MEM_guardedalloc.h" #include "MEM_guardedalloc.h"
#include "DNA_color_types.h" #include "DNA_color_types.h"
@@ -789,60 +785,6 @@ void curvemapping_evaluate_premulRGBF(CurveMapping *cumap, float *vecout, const
} }
#ifdef WITH_LCMS
/* basic error handler, if we dont do this blender will exit */
static int ErrorReportingFunction(int ErrorCode, const char *ErrorText)
{
fprintf(stderr, "%s:%d\n", ErrorText, ErrorCode);
return 1;
}
#endif
void colorcorrection_do_ibuf(ImBuf *ibuf, const char *profile)
{
#ifdef WITH_LCMS
if (ibuf->crect == NULL)
{
cmsHPROFILE proofingProfile;
/* TODO, move to initialization area of code */
//cmsSetLogErrorHandler(ErrorReportingFunction);
cmsSetErrorHandler(ErrorReportingFunction);
/* will return NULL if the file isn't fount */
proofingProfile = cmsOpenProfileFromFile(profile, "r");
cmsErrorAction(LCMS_ERROR_SHOW);
if(proofingProfile) {
cmsHPROFILE imageProfile;
cmsHTRANSFORM hTransform;
ibuf->crect = MEM_mallocN(ibuf->x*ibuf->y*sizeof(int), "imbuf crect");
imageProfile = cmsCreate_sRGBProfile();
hTransform = cmsCreateProofingTransform(imageProfile, TYPE_RGBA_8, imageProfile, TYPE_RGBA_8,
proofingProfile,
INTENT_ABSOLUTE_COLORIMETRIC,
INTENT_ABSOLUTE_COLORIMETRIC,
cmsFLAGS_SOFTPROOFING);
cmsDoTransform(hTransform, ibuf->rect, ibuf->crect, ibuf->x * ibuf->y);
cmsDeleteTransform(hTransform);
cmsCloseProfile(imageProfile);
cmsCloseProfile(proofingProfile);
}
}
#else
/* unused */
(void)ibuf;
(void)profile;
#endif
}
/* only used for image editor curves */ /* only used for image editor curves */
void curvemapping_do_ibuf(CurveMapping *cumap, ImBuf *ibuf) void curvemapping_do_ibuf(CurveMapping *cumap, ImBuf *ibuf)
{ {

View File

@@ -72,6 +72,8 @@
#include "ED_curve.h" /* for BKE_curve_nurbs */ #include "ED_curve.h" /* for BKE_curve_nurbs */
extern Material defmaterial; /* material.c */
static void boundbox_displist(Object *ob); static void boundbox_displist(Object *ob);
void free_disp_elem(DispList *dl) void free_disp_elem(DispList *dl)
@@ -552,7 +554,6 @@ static void mesh_create_shadedColors(Render *re, Object *ob, int onlyForMesh, un
} }
for (i=0; i<totface; i++) { for (i=0; i<totface; i++) {
extern Material defmaterial; /* material.c */
MFace *mf= &mface[i]; MFace *mf= &mface[i];
Material *ma= give_current_material(ob, mf->mat_nr+1); Material *ma= give_current_material(ob, mf->mat_nr+1);
int j, vidx[4], nverts= mf->v4?4:3; int j, vidx[4], nverts= mf->v4?4:3;
@@ -664,8 +665,6 @@ void shadeDispList(Scene *scene, Base *base)
dl= ob->disp.first; dl= ob->disp.first;
while(dl) { while(dl) {
extern Material defmaterial; /* material.c */
dlob= MEM_callocN(sizeof(DispList), "displistshade"); dlob= MEM_callocN(sizeof(DispList), "displistshade");
BLI_addtail(&ob->disp, dlob); BLI_addtail(&ob->disp, dlob);
dlob->type= DL_VERTCOL; dlob->type= DL_VERTCOL;
@@ -734,8 +733,6 @@ void shadeDispList(Scene *scene, Base *base)
if(dl->type==DL_INDEX4) { if(dl->type==DL_INDEX4) {
if(dl->nors) { if(dl->nors) {
extern Material defmaterial; /* material.c */
if(dl->col1) MEM_freeN(dl->col1); if(dl->col1) MEM_freeN(dl->col1);
col1= dl->col1= MEM_mallocN(sizeof(int)*dl->nr, "col1"); col1= dl->col1= MEM_mallocN(sizeof(int)*dl->nr, "col1");
@@ -984,16 +981,7 @@ void filldisplist(ListBase *dispbase, ListBase *to, int flipnormal)
dl= dl->next; dl= dl->next;
} }
if(totvert && BLI_edgefill(0)) { // XXX (obedit && obedit->actcol)?(obedit->actcol-1):0)) { if(totvert && (tot= BLI_edgefill(0))) { // XXX (obedit && obedit->actcol)?(obedit->actcol-1):0)) {
/* count faces */
tot= 0;
efa= fillfacebase.first;
while(efa) {
tot++;
efa= efa->next;
}
if(tot) { if(tot) {
dlnew= MEM_callocN(sizeof(DispList), "filldisplist"); dlnew= MEM_callocN(sizeof(DispList), "filldisplist");
dlnew->type= DL_INDEX3; dlnew->type= DL_INDEX3;
@@ -1973,8 +1961,9 @@ static void boundbox_displist(Object *ob)
} }
if(!doit) { if(!doit) {
min[0] = min[1] = min[2] = -1.0f; /* there's no geometry in displist, use zero-sized boundbox */
max[0] = max[1] = max[2] = 1.0f; zero_v3(min);
zero_v3(max);
} }
} }

View File

@@ -125,25 +125,33 @@ struct PreviewImage* BKE_previewimg_create(void)
prv_img = MEM_callocN(sizeof(PreviewImage), "img_prv"); prv_img = MEM_callocN(sizeof(PreviewImage), "img_prv");
for (i=0; i<PREVIEW_MIPMAPS; ++i) { for (i=0; i<NUM_ICON_SIZES; ++i) {
prv_img->changed[i] = 1; prv_img->changed[i] = 1;
prv_img->changed_timestamp[i] = 0; prv_img->changed_timestamp[i] = 0;
} }
return prv_img; return prv_img;
} }
void BKE_previewimg_freefunc(void *link)
{
PreviewImage *prv = (PreviewImage *)link;
if (prv) {
int i;
for (i=0; i<NUM_ICON_SIZES;++i) {
if (prv->rect[i]) {
MEM_freeN(prv->rect[i]);
prv->rect[i] = NULL;
}
}
MEM_freeN(prv);
}
}
void BKE_previewimg_free(PreviewImage **prv) void BKE_previewimg_free(PreviewImage **prv)
{ {
if(prv && (*prv)) { if(prv && (*prv)) {
int i; BKE_previewimg_freefunc(*prv);
for (i=0; i<PREVIEW_MIPMAPS;++i) {
if ((*prv)->rect[i]) {
MEM_freeN((*prv)->rect[i]);
(*prv)->rect[i] = NULL;
}
}
MEM_freeN((*prv));
*prv = NULL; *prv = NULL;
} }
} }
@@ -155,7 +163,7 @@ struct PreviewImage* BKE_previewimg_copy(PreviewImage *prv)
if (prv) { if (prv) {
prv_img = MEM_dupallocN(prv); prv_img = MEM_dupallocN(prv);
for (i=0; i < PREVIEW_MIPMAPS; ++i) { for (i=0; i < NUM_ICON_SIZES; ++i) {
if (prv->rect[i]) { if (prv->rect[i]) {
prv_img->rect[i] = MEM_dupallocN(prv->rect[i]); prv_img->rect[i] = MEM_dupallocN(prv->rect[i]);
} else { } else {
@@ -237,7 +245,7 @@ void BKE_icon_changed(int id)
/* all previews changed */ /* all previews changed */
if (prv) { if (prv) {
int i; int i;
for (i=0; i<PREVIEW_MIPMAPS; ++i) { for (i=0; i<NUM_ICON_SIZES; ++i) {
prv->changed[i] = 1; prv->changed[i] = 1;
prv->changed_timestamp[i]++; prv->changed_timestamp[i]++;
} }

View File

@@ -1680,21 +1680,20 @@ void object_rot_to_mat3(Object *ob, float mat[][3])
{ {
float rmat[3][3], dmat[3][3]; float rmat[3][3], dmat[3][3];
/* initialise the delta-rotation matrix, which will get (pre)multiplied /* 'dmat' is the delta-rotation matrix, which will get (pre)multiplied
* with the rotation matrix to yield the appropriate rotation * with the rotation matrix to yield the appropriate rotation
*/ */
unit_m3(dmat);
/* rotations may either be quats, eulers (with various rotation orders), or axis-angle */ /* rotations may either be quats, eulers (with various rotation orders), or axis-angle */
if (ob->rotmode > 0) { if (ob->rotmode > 0) {
/* euler rotations (will cause gimble lock, but this can be alleviated a bit with rotation orders) */ /* euler rotations (will cause gimble lock, but this can be alleviated a bit with rotation orders) */
eulO_to_mat3( rmat,ob->rot, ob->rotmode); eulO_to_mat3(rmat, ob->rot, ob->rotmode);
eulO_to_mat3( dmat,ob->drot, ob->rotmode); eulO_to_mat3(dmat, ob->drot, ob->rotmode);
} }
else if (ob->rotmode == ROT_MODE_AXISANGLE) { else if (ob->rotmode == ROT_MODE_AXISANGLE) {
/* axis-angle - not really that great for 3D-changing orientations */ /* axis-angle - not really that great for 3D-changing orientations */
axis_angle_to_mat3( rmat,ob->rotAxis, ob->rotAngle); axis_angle_to_mat3(rmat, ob->rotAxis, ob->rotAngle);
axis_angle_to_mat3( dmat,ob->drotAxis, ob->drotAngle); axis_angle_to_mat3(dmat, ob->drotAxis, ob->drotAngle);
} }
else { else {
/* quats are normalised before use to eliminate scaling issues */ /* quats are normalised before use to eliminate scaling issues */
@@ -1729,9 +1728,22 @@ void object_mat3_to_rot(Object *ob, float mat[][3], short use_compat)
ob->rotAngle -= ob->drotAngle; ob->rotAngle -= ob->drotAngle;
break; break;
default: /* euler */ default: /* euler */
if(use_compat) mat3_to_compatible_eulO(ob->rot, ob->rot, ob->rotmode, mat); {
else mat3_to_eulO(ob->rot, ob->rotmode, mat); float quat[4];
sub_v3_v3(ob->rot, ob->drot); float dquat[4];
float tmat[3][3];
/* without drot we could apply 'mat' directly */
mat3_to_quat(quat, mat);
eulO_to_quat(dquat, ob->drot, ob->rotmode);
invert_qt(dquat);
mul_qt_qtqt(quat, dquat, quat);
quat_to_mat3(tmat, quat);
/* end drot correction */
if(use_compat) mat3_to_compatible_eulO(ob->rot, ob->rot, ob->rotmode, tmat);
else mat3_to_eulO(ob->rot, ob->rotmode, tmat);
}
} }
} }
@@ -1923,9 +1935,10 @@ static void give_parvert(Object *par, int nr, float *vec)
if(dm) { if(dm) {
MVert *mvert= dm->getVertArray(dm); MVert *mvert= dm->getVertArray(dm);
int *index = (int *)dm->getVertDataArray(dm, CD_ORIGINDEX); int *index = (int *)dm->getVertDataArray(dm, CD_ORIGINDEX);
int i, count = 0, vindex, numVerts = dm->getNumVerts(dm); int i, vindex, numVerts = dm->getNumVerts(dm);
/* get the average of all verts with (original index == nr) */ /* get the average of all verts with (original index == nr) */
count= 0;
for(i = 0; i < numVerts; i++) { for(i = 0; i < numVerts; i++) {
vindex= (index)? index[i]: i; vindex= (index)? index[i]: i;

View File

@@ -1250,7 +1250,7 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
double step, pos; double step, pos;
step= (totpart < 2) ? 0.5 : 1.0/(double)totpart; step= (totpart < 2) ? 0.5 : 1.0/(double)totpart;
pos= 1e-16; /* tiny offset to avoid zero weight face */ pos= 1e-6; /* tiny offset to avoid zero weight face */
i= 0; i= 0;
for(p=0; p<totpart; p++, pos+=step) { for(p=0; p<totpart; p++, pos+=step) {

View File

@@ -2858,6 +2858,83 @@ static struct ImBuf * do_multicam(
return out; return out;
} }
/* **********************************************************************
ADJUSTMENT
********************************************************************** */
/* no effect inputs for adjustment, we use give_ibuf_seq */
static int num_inputs_adjustment(void)
{
return 0;
}
static int early_out_adjustment(struct Sequence *UNUSED(seq), float UNUSED(facf0), float UNUSED(facf1))
{
return -1;
}
static struct ImBuf * do_adjustment_impl(SeqRenderData context, Sequence * seq,
float cfra)
{
Editing * ed;
ListBase * seqbasep;
struct ImBuf * i = 0;
ed = context.scene->ed;
seqbasep = seq_seqbase(&ed->seqbase, seq);
if (seq->machine > 0) {
i = give_ibuf_seqbase(context, cfra,
seq->machine - 1, seqbasep);
}
/* found nothing? so let's work the way up the metastrip stack, so
that it is possible to group a bunch of adjustment strips into
a metastrip and have that work on everything below the metastrip
*/
if (!i) {
Sequence * meta;
meta = seq_metastrip(&ed->seqbase, NULL, seq);
if (meta) {
i = do_adjustment_impl(context, meta, cfra);
}
}
return i;
}
static struct ImBuf * do_adjustment(
SeqRenderData context, Sequence *seq, float cfra,
float UNUSED(facf0), float UNUSED(facf1),
struct ImBuf *UNUSED(ibuf1), struct ImBuf *UNUSED(ibuf2),
struct ImBuf *UNUSED(ibuf3))
{
struct ImBuf * i = 0;
struct ImBuf * out;
Editing * ed;
ed = context.scene->ed;
if (!ed) {
return NULL;
}
i = do_adjustment_impl(context, seq, cfra);
if (input_have_to_preprocess(context, seq, cfra)) {
out = IMB_dupImBuf(i);
IMB_freeImBuf(i);
} else {
out = i;
}
return out;
}
/* ********************************************************************** /* **********************************************************************
SPEED SPEED
********************************************************************** */ ********************************************************************** */
@@ -3256,6 +3333,11 @@ static struct SeqEffectHandle get_sequence_effect_impl(int seq_type)
rval.early_out = early_out_multicam; rval.early_out = early_out_multicam;
rval.execute = do_multicam; rval.execute = do_multicam;
break; break;
case SEQ_ADJUSTMENT:
rval.num_inputs = num_inputs_adjustment;
rval.early_out = early_out_adjustment;
rval.execute = do_adjustment;
break;
} }
return rval; return rval;

View File

@@ -79,9 +79,15 @@
#define snprintf _snprintf #define snprintf _snprintf
#endif #endif
/* **** XXX ******** */
//static void waitcursor(int val) {} static ImBuf* seq_render_strip_stack(
//static int blender_test_break() {return 0;} SeqRenderData context, ListBase *seqbasep, float cfra, int chanshown);
static ImBuf * seq_render_strip(
SeqRenderData context, Sequence * seq, float cfra);
static void seq_free_animdata(Scene *scene, Sequence *seq);
/* **** XXX ******** */ /* **** XXX ******** */
#define SELECT 1 #define SELECT 1
@@ -177,8 +183,6 @@ void seq_free_strip(Strip *strip)
MEM_freeN(strip); MEM_freeN(strip);
} }
static void seq_free_animdata(Scene *scene, Sequence *seq);
void seq_free_sequence(Scene *scene, Sequence *seq) void seq_free_sequence(Scene *scene, Sequence *seq)
{ {
if(seq->strip) seq_free_strip(seq->strip); if(seq->strip) seq_free_strip(seq->strip);
@@ -191,6 +195,10 @@ void seq_free_sequence(Scene *scene, Sequence *seq)
sh.free(seq); sh.free(seq);
} }
if(seq->sound) {
((ID *)seq->sound)->us--;
}
/* clipboard has no scene and will never have a sound handle or be active */ /* clipboard has no scene and will never have a sound handle or be active */
if(scene) { if(scene) {
Editing *ed = scene->ed; Editing *ed = scene->ed;
@@ -446,51 +454,6 @@ void seq_end(SeqIterator *iter)
* in metastrips!) * in metastrips!)
********************************************************************** **********************************************************************
*/ */
#if 0 /* UNUSED */
static void do_seq_count(ListBase *seqbase, int *totseq)
{
Sequence *seq;
seq= seqbase->first;
while(seq) {
(*totseq)++;
if(seq->seqbase.first) do_seq_count(&seq->seqbase, totseq);
seq= seq->next;
}
}
static void do_build_seqar(ListBase *seqbase, Sequence ***seqar, int depth)
{
Sequence *seq;
seq= seqbase->first;
while(seq) {
seq->depth= depth;
if(seq->seqbase.first) do_build_seqar(&seq->seqbase, seqar, depth+1);
**seqar= seq;
(*seqar)++;
seq= seq->next;
}
}
static void build_seqar(ListBase *seqbase, Sequence ***seqar, int *totseq)
{
Sequence **tseqar;
*totseq= 0;
do_seq_count(seqbase, totseq);
if(*totseq==0) {
*seqar= NULL;
return;
}
*seqar= MEM_mallocN(sizeof(void *)* *totseq, "seqar");
tseqar= *seqar;
do_build_seqar(seqbase, seqar, 0);
*seqar= tseqar;
}
#endif /* UNUSED */
static void do_seq_count_cb(ListBase *seqbase, int *totseq, static void do_seq_count_cb(ListBase *seqbase, int *totseq,
int (*test_func)(Sequence * seq)) int (*test_func)(Sequence * seq))
@@ -916,6 +879,7 @@ static const char *give_seqname_by_type(int type)
case SEQ_TRANSFORM: return "Transform"; case SEQ_TRANSFORM: return "Transform";
case SEQ_COLOR: return "Color"; case SEQ_COLOR: return "Color";
case SEQ_MULTICAM: return "Multicam"; case SEQ_MULTICAM: return "Multicam";
case SEQ_ADJUSTMENT: return "Adjustment";
case SEQ_SPEED: return "Speed"; case SEQ_SPEED: return "Speed";
default: default:
return NULL; return NULL;
@@ -1013,16 +977,22 @@ static float give_stripelem_index(Sequence *seq, float cfra)
int sta = seq->start; int sta = seq->start;
int end = seq->start+seq->len-1; int end = seq->start+seq->len-1;
if(seq->len == 0) return -1; if (seq->type & SEQ_EFFECT) {
end = seq->enddisp;
}
if(end < sta) {
return -1;
}
if(seq->flag&SEQ_REVERSE_FRAMES) { if(seq->flag&SEQ_REVERSE_FRAMES) {
/*reverse frame in this sequence */ /*reverse frame in this sequence */
if(cfra <= sta) nr= seq->len-1; if(cfra <= sta) nr= end - sta;
else if(cfra >= end) nr= 0; else if(cfra >= end) nr= 0;
else nr= end - cfra; else nr= end - cfra;
} else { } else {
if(cfra <= sta) nr= 0; if(cfra <= sta) nr= 0;
else if(cfra >= end) nr= seq->len-1; else if(cfra >= end) nr= end - sta;
else nr= cfra - sta; else nr= cfra - sta;
} }
@@ -1039,7 +1009,11 @@ StripElem *give_stripelem(Sequence *seq, int cfra)
{ {
StripElem *se= seq->strip->stripdata; StripElem *se= seq->strip->stripdata;
if(seq->type != SEQ_MOVIE) { /* movie use the first */ if(seq->type == SEQ_IMAGE) { /* only
IMAGE strips use the whole array,
MOVIE strips use only
the first element, all other strips
don't use this... */
int nr = (int) give_stripelem_index(seq, cfra); int nr = (int) give_stripelem_index(seq, cfra);
if (nr == -1 || se == NULL) return NULL; if (nr == -1 || se == NULL) return NULL;
@@ -1093,15 +1067,12 @@ static int get_shown_sequences( ListBase * seqbasep, int cfra, int chanshown, Se
} }
if(evaluate_seq_frame_gen(seq_arr, seqbasep, cfra)) { if(evaluate_seq_frame_gen(seq_arr, seqbasep, cfra)) {
if (b > 0) { if (b == 0) {
if (seq_arr[b] == NULL) { b = MAXSEQ;
return 0; }
} for (; b > 0; b--) {
} else { if (video_seq_is_rendered(seq_arr[b])) {
for (b = MAXSEQ; b > 0; b--) { break;
if (video_seq_is_rendered(seq_arr[b])) {
break;
}
} }
} }
} }
@@ -2071,8 +2042,9 @@ static ImBuf * seq_render_strip(SeqRenderData context, Sequence * seq, float cfr
break; break;
} }
case SEQ_EFFECT: case SEQ_EFFECT:
{ {
ibuf = seq_render_effect_strip_impl(context, seq, cfra); ibuf = seq_render_effect_strip_impl(
context, seq, seq->start + nr);
break; break;
} }
case SEQ_IMAGE: case SEQ_IMAGE:
@@ -2855,7 +2827,10 @@ void seq_tx_set_final_right(Sequence *seq, int val)
since they work a bit differently to normal image seq's (during transform) */ since they work a bit differently to normal image seq's (during transform) */
int seq_single_check(Sequence *seq) int seq_single_check(Sequence *seq)
{ {
return (seq->len==1 && ELEM3(seq->type, SEQ_IMAGE, SEQ_COLOR, SEQ_MULTICAM)); return (seq->len==1 && (
seq->type == SEQ_IMAGE
|| ((seq->type & SEQ_EFFECT) &&
get_sequence_effect_num_inputs(seq->type) == 0)));
} }
/* check if the selected seq's reference unselected seq's */ /* check if the selected seq's reference unselected seq's */
@@ -3214,6 +3189,24 @@ ListBase *seq_seqbase(ListBase *seqbase, Sequence *seq)
return NULL; return NULL;
} }
Sequence *seq_metastrip(ListBase * seqbase, Sequence * meta, Sequence *seq)
{
Sequence * iseq;
for(iseq = seqbase->first; iseq; iseq = iseq->next) {
Sequence * rval;
if (seq == iseq) {
return meta;
} else if(iseq->seqbase.first &&
(rval = seq_metastrip(&iseq->seqbase, iseq, seq))) {
return rval;
}
}
return NULL;
}
int seq_swap(Sequence *seq_a, Sequence *seq_b) int seq_swap(Sequence *seq_a, Sequence *seq_b)
{ {
char name[sizeof(seq_a->name)]; char name[sizeof(seq_a->name)];
@@ -3523,7 +3516,8 @@ Sequence *sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo
strip->len = seq->len = ceil(info.length * FPS); strip->len = seq->len = ceil(info.length * FPS);
strip->us= 1; strip->us= 1;
strip->stripdata= se= MEM_callocN(seq->len*sizeof(StripElem), "stripelem"); /* we only need 1 element to store the filename */
strip->stripdata= se= MEM_callocN(sizeof(StripElem), "stripelem");
BLI_split_dirfile(seq_load->path, strip->dir, se->name); BLI_split_dirfile(seq_load->path, strip->dir, se->name);
@@ -3572,7 +3566,8 @@ Sequence *sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo
strip->len = seq->len = IMB_anim_get_duration( an ); strip->len = seq->len = IMB_anim_get_duration( an );
strip->us= 1; strip->us= 1;
strip->stripdata= se= MEM_callocN(seq->len*sizeof(StripElem), "stripelem"); /* we only need 1 element for MOVIE strips */
strip->stripdata= se= MEM_callocN(sizeof(StripElem), "stripelem");
BLI_split_dirfile(seq_load->path, strip->dir, se->name); BLI_split_dirfile(seq_load->path, strip->dir, se->name);

View File

@@ -543,7 +543,7 @@ int sk_stroke_filtermval(SK_DrawData *dd)
return retval; return retval;
} }
void sk_initDrawData(SK_DrawData *dd, const short mval[2]) void sk_initDrawData(SK_DrawData *dd, const int mval[2])
{ {
dd->mval[0] = mval[0]; dd->mval[0] = mval[0];
dd->mval[1] = mval[1]; dd->mval[1] = mval[1];

View File

@@ -77,7 +77,7 @@ void closest_to_line_segment_v3(float r[3], const float p[3], const float l1[3],
#define ISECT_LINE_LINE_CROSS 2 #define ISECT_LINE_LINE_CROSS 2
int isect_line_line_v2(const float a1[2], const float a2[2], const float b1[2], const float b2[2]); int isect_line_line_v2(const float a1[2], const float a2[2], const float b1[2], const float b2[2]);
int isect_line_line_v2_short(const short a1[2], const short a2[2], const short b1[2], const short b2[2]); int isect_line_line_v2_int(const int a1[2], const int a2[2], const int b1[2], const int b2[2]);
int isect_seg_seg_v2_point(const float v1[2], const float v2[2], const float v3[2], const float v4[2], float vi[2]); int isect_seg_seg_v2_point(const float v1[2], const float v2[2], const float v3[2], const float v4[2], float vi[2]);
/* Returns the number of point of interests /* Returns the number of point of interests

View File

@@ -53,7 +53,7 @@ extern "C" {
/* scanfill.c: used in displist only... */ /* scanfill.c: used in displist only... */
struct EditVert *BLI_addfillvert(float *vec); struct EditVert *BLI_addfillvert(float *vec);
struct EditEdge *BLI_addfilledge(struct EditVert *v1, struct EditVert *v2); struct EditEdge *BLI_addfilledge(struct EditVert *v1, struct EditVert *v2);
int BLI_edgefill(int mat_nr); int BLI_edgefill(short mat_nr);
void BLI_end_edgefill(void); void BLI_end_edgefill(void);
/* These callbacks are needed to make the lib finction properly */ /* These callbacks are needed to make the lib finction properly */

View File

@@ -763,7 +763,12 @@ void makeFilesRelative(Main *bmain, const char *basedir, ReportList *reports) {
/* be sure there is low chance of the path being too short */ /* be sure there is low chance of the path being too short */
char filepath_relative[(FILE_MAXDIR * 2) + FILE_MAXFILE]; char filepath_relative[(FILE_MAXDIR * 2) + FILE_MAXFILE];
if(basedir[0] == '\0') {
printf("makeFilesRelative: basedir='', this is a bug\n");
return;
}
BLI_bpathIterator_init(&bpi, bmain, basedir, 0); BLI_bpathIterator_init(&bpi, bmain, basedir, 0);
while (!BLI_bpathIterator_isDone(bpi)) { while (!BLI_bpathIterator_isDone(bpi)) {
BLI_bpathIterator_getPath(bpi, filepath); BLI_bpathIterator_getPath(bpi, filepath);
@@ -814,7 +819,12 @@ void makeFilesAbsolute(Main *bmain, const char *basedir, ReportList *reports)
/* be sure there is low chance of the path being too short */ /* be sure there is low chance of the path being too short */
char filepath_absolute[(FILE_MAXDIR * 2) + FILE_MAXFILE]; char filepath_absolute[(FILE_MAXDIR * 2) + FILE_MAXFILE];
if(basedir[0] == '\0') {
printf("makeFilesAbsolute: basedir='', this is a bug\n");
return;
}
BLI_bpathIterator_init(&bpi, bmain, basedir, 0); BLI_bpathIterator_init(&bpi, bmain, basedir, 0);
while (!BLI_bpathIterator_isDone(bpi)) { while (!BLI_bpathIterator_isDone(bpi)) {
BLI_bpathIterator_getPath(bpi, filepath); BLI_bpathIterator_getPath(bpi, filepath);

View File

@@ -239,7 +239,7 @@ float dist_to_line_segment_v3(const float v1[3], const float v2[3], const float
/******************************* Intersection ********************************/ /******************************* Intersection ********************************/
/* intersect Line-Line, shorts */ /* intersect Line-Line, shorts */
int isect_line_line_v2_short(const short v1[2], const short v2[2], const short v3[2], const short v4[2]) int isect_line_line_v2_int(const int v1[2], const int v2[2], const int v3[2], const int v4[2])
{ {
float div, labda, mu; float div, labda, mu;

View File

@@ -58,6 +58,8 @@ typedef unsigned long long r_uint64;
#define LOWSEED 0x330E #define LOWSEED 0x330E
extern unsigned char hash[]; // noise.c
/***/ /***/
struct RNG { struct RNG {
@@ -83,8 +85,6 @@ void rng_seed(RNG *rng, unsigned int seed) {
} }
void rng_srandom(RNG *rng, unsigned int seed) { void rng_srandom(RNG *rng, unsigned int seed) {
extern unsigned char hash[]; // noise.c
rng_seed(rng, seed + hash[seed & 255]); rng_seed(rng, seed + hash[seed & 255]);
seed= rng_getInt(rng); seed= rng_getInt(rng);
rng_seed(rng, seed + hash[seed & 255]); rng_seed(rng, seed + hash[seed & 255]);
@@ -180,8 +180,6 @@ static RNG rng_tab[BLENDER_MAX_THREADS];
void BLI_thread_srandom(int thread, unsigned int seed) void BLI_thread_srandom(int thread, unsigned int seed)
{ {
extern unsigned char hash[]; // noise.c
if(thread >= BLENDER_MAX_THREADS) if(thread >= BLENDER_MAX_THREADS)
thread= 0; thread= 0;

View File

@@ -85,7 +85,6 @@ typedef struct PolyFill {
typedef struct ScFillVert { typedef struct ScFillVert {
EditVert *v1; EditVert *v1;
EditEdge *first,*last; EditEdge *first,*last;
short f,f1;
} ScFillVert; } ScFillVert;
@@ -95,9 +94,9 @@ typedef struct ScFillVert {
static ScFillVert *scdata; static ScFillVert *scdata;
ListBase fillvertbase = {0,0}; ListBase fillvertbase = {NULL, NULL};
ListBase filledgebase = {0,0}; ListBase filledgebase = {NULL, NULL};
ListBase fillfacebase = {0,0}; ListBase fillfacebase = {NULL, NULL};
static short cox, coy; static short cox, coy;
@@ -219,7 +218,7 @@ EditEdge *BLI_addfilledge(EditVert *v1, EditVert *v2)
return newed; return newed;
} }
static void addfillface(EditVert *v1, EditVert *v2, EditVert *v3, int mat_nr) static void addfillface(EditVert *v1, EditVert *v2, EditVert *v3, short mat_nr)
{ {
/* does not make edges */ /* does not make edges */
EditFace *evl; EditFace *evl;
@@ -495,7 +494,7 @@ static void splitlist(ListBase *tempve, ListBase *temped, short nr)
} }
static void scanfill(PolyFill *pf, int mat_nr) static int scanfill(PolyFill *pf, short mat_nr)
{ {
ScFillVert *sc = NULL, *sc1; ScFillVert *sc = NULL, *sc1;
EditVert *eve,*v1,*v2,*v3; EditVert *eve,*v1,*v2,*v3;
@@ -748,11 +747,13 @@ static void scanfill(PolyFill *pf, int mat_nr)
} }
MEM_freeN(scdata); MEM_freeN(scdata);
return totface;
} }
int BLI_edgefill(int mat_nr) int BLI_edgefill(short mat_nr)
{ {
/* /*
- fill works with its own lists, so create that first (no faces!) - fill works with its own lists, so create that first (no faces!)
@@ -760,6 +761,7 @@ int BLI_edgefill(int mat_nr)
- struct elements xs en ys are not used here: don't hide stuff in it - struct elements xs en ys are not used here: don't hide stuff in it
- edge flag ->f becomes 2 when it's a new edge - edge flag ->f becomes 2 when it's a new edge
- mode: & 1 is check for crossings, then create edges (TO DO ) - mode: & 1 is check for crossings, then create edges (TO DO )
- returns number of triangle faces added.
*/ */
ListBase tempve, temped; ListBase tempve, temped;
EditVert *eve; EditVert *eve;
@@ -767,6 +769,7 @@ int BLI_edgefill(int mat_nr)
PolyFill *pflist,*pf; PolyFill *pflist,*pf;
float *minp, *maxp, *v1, *v2, norm[3], len; float *minp, *maxp, *v1, *v2, norm[3], len;
short a,c,poly=0,ok=0,toggle=0; short a,c,poly=0,ok=0,toggle=0;
int totfaces= 0; /* total faces added */
/* reset variables */ /* reset variables */
eve= fillvertbase.first; eve= fillvertbase.first;
@@ -1030,7 +1033,7 @@ int BLI_edgefill(int mat_nr)
for(a=0;a<poly;a++) { for(a=0;a<poly;a++) {
if(pf->edges>1) { if(pf->edges>1) {
splitlist(&tempve,&temped,pf->nr); splitlist(&tempve,&temped,pf->nr);
scanfill(pf, mat_nr); totfaces += scanfill(pf, mat_nr);
} }
pf++; pf++;
} }
@@ -1040,6 +1043,6 @@ int BLI_edgefill(int mat_nr)
/* FREE */ /* FREE */
MEM_freeN(pflist); MEM_freeN(pflist);
return 1;
return totfaces;
} }

View File

@@ -49,6 +49,8 @@ struct SpaceFile;
struct SpaceImaSel; struct SpaceImaSel;
struct UserDef; struct UserDef;
struct bContext; struct bContext;
struct BHead;
struct FileData;
typedef struct BlendHandle BlendHandle; typedef struct BlendHandle BlendHandle;
@@ -79,12 +81,12 @@ typedef struct BlendFileData {
* returns NULL and sets a report in the list if * returns NULL and sets a report in the list if
* it cannot open the file. * it cannot open the file.
* *
* @param file The path of the file to open. * @param filepath The path of the file to open.
* @param reports If the return value is NULL, errors * @param reports If the return value is NULL, errors
* indicating the cause of the failure. * indicating the cause of the failure.
* @return The data of the file. * @return The data of the file.
*/ */
BlendFileData* BLO_read_from_file(const char *file, struct ReportList *reports); BlendFileData* BLO_read_from_file(const char *filepath, struct ReportList *reports);
/** /**
* Open a blender file from memory. The function * Open a blender file from memory. The function
@@ -209,7 +211,7 @@ int BLO_has_bfile_extension(char *str);
*/ */
int BLO_is_a_library(const char *path, char *dir, char *group); int BLO_is_a_library(const char *path, char *dir, char *group);
struct Main* BLO_library_append_begin(const struct bContext *C, BlendHandle** bh, char *dir); struct Main* BLO_library_append_begin(const struct bContext *C, BlendHandle** bh, const char *filepath);
/** /**
* Link/Append a named datablock from an external blend file. * Link/Append a named datablock from an external blend file.
@@ -217,14 +219,16 @@ struct Main* BLO_library_append_begin(const struct bContext *C, BlendHandle** bh
* @param C The context, when NULL instancing object in the scene isnt done. * @param C The context, when NULL instancing object in the scene isnt done.
* @param mainl The main database to link from (not the active one). * @param mainl The main database to link from (not the active one).
* @param bh The blender file handle. * @param bh The blender file handle.
* @param name The name of the datablock (without the 2 char ID prefix) * @param idname The name of the datablock (without the 2 char ID prefix)
* @param idcode The kind of datablock to link. * @param idcode The kind of datablock to link.
* @param flag Options for linking, used for instancing. * @param flag Options for linking, used for instancing.
* @return Boolean, 0 when the datablock could not be found. * @return Boolean, 0 when the datablock could not be found.
*/ */
int BLO_library_append_named_part(const struct bContext *C, struct Main *mainl, BlendHandle** bh, const char *name, int idcode, short flag); int BLO_library_append_named_part(const struct bContext *C, struct Main *mainl, BlendHandle** bh, const char *idname, int idcode, short flag);
void BLO_library_append_end(const struct bContext *C, struct Main *mainl, BlendHandle** bh, int idcode, short flag); void BLO_library_append_end(const struct bContext *C, struct Main *mainl, BlendHandle** bh, int idcode, short flag);
void *BLO_library_read_struct(struct FileData *fd, struct BHead *bh, const char *blockname);
/* deprecated */ /* deprecated */
#if 1 #if 1
void BLO_script_library_append(BlendHandle **bh, char *dir, char *name, int idcode, short flag, struct Main *mainvar, struct Scene *scene, struct ReportList *reports); void BLO_script_library_append(BlendHandle **bh, char *dir, char *name, int idcode, short flag, struct Main *mainvar, struct Scene *scene, struct ReportList *reports);

View File

@@ -25,27 +25,29 @@
* Contributor(s): none yet. * Contributor(s): none yet.
* *
* ***** END GPL LICENSE BLOCK ***** * ***** END GPL LICENSE BLOCK *****
*
*/ */
#include <string.h> // strlen
#include "BLO_readblenfile.h"
struct streamGlueControlStruct *Global_streamGlueControl; #ifndef BLO_RUNTIME_H
#define BLO_RUNTIME_H
int /** \file BLO_runtime.h
streamGlueWrite( * \ingroup blenloader
struct streamGlueControlStruct *streamGlueControl, */
struct streamGlueStruct **streamGlue,
unsigned char *data, #ifdef __cplusplus
unsigned int dataIn, extern "C" {
int finishUp) #endif
{
printf("called with %d bytes in buffer [%s]\n", dataIn, data); struct BlendFileData;
return (0); struct ReportList;
int BLO_is_a_runtime(char *file);
struct BlendFileData *BLO_read_runtime(char *file, struct ReportList *reports);
#ifdef __cplusplus
} }
#endif
main() #endif /* BLO_RUNTIME_H */
{
int err;
err = BLO_readblenfile();
}

View File

@@ -39,7 +39,7 @@ struct MemFile;
struct Main; struct Main;
struct ReportList; struct ReportList;
extern int BLO_write_file(struct Main *mainvar, char *dir, int write_flags, struct ReportList *reports, int *thumb); extern int BLO_write_file(struct Main *mainvar, const char *filepath, int write_flags, struct ReportList *reports, int *thumb);
extern int BLO_write_file_mem(struct Main *mainvar, struct MemFile *compare, struct MemFile *current, int write_flags); extern int BLO_write_file_mem(struct Main *mainvar, struct MemFile *compare, struct MemFile *current, int write_flags);
extern int BLO_write_runtime(struct Main *mainvar, const char *file, char *exename, struct ReportList *reports); extern int BLO_write_runtime(struct Main *mainvar, const char *file, char *exename, struct ReportList *reports);

View File

@@ -29,7 +29,6 @@ set(INC
../blenlib ../blenlib
../blenkernel ../blenkernel
../makesdna ../makesdna
../readblenfile
../makesrna ../makesrna
../render/extern/include ../render/extern/include
../../../intern/guardedalloc ../../../intern/guardedalloc
@@ -39,10 +38,12 @@ set(INC
set(SRC set(SRC
intern/readblenentry.c intern/readblenentry.c
intern/readfile.c intern/readfile.c
intern/runtime.c
intern/undofile.c intern/undofile.c
intern/writefile.c intern/writefile.c
BLO_readfile.h BLO_readfile.h
BLO_runtime.h
BLO_soundfile.h BLO_soundfile.h
BLO_sys_types.h BLO_sys_types.h
BLO_undofile.h BLO_undofile.h

View File

@@ -4,7 +4,7 @@ Import ('env')
sources = env.Glob('intern/*.c') sources = env.Glob('intern/*.c')
incs = '. #/intern/guardedalloc ../blenlib ../blenkernel' incs = '. #/intern/guardedalloc ../blenlib ../blenkernel'
incs += ' ../makesdna ../readblenfile ../editors/include' incs += ' ../makesdna ../editors/include'
incs += ' ../render/extern/include ../makesrna' incs += ' ../render/extern/include ../makesrna'
incs += ' ' + env['BF_ZLIB_INC'] incs += ' ' + env['BF_ZLIB_INC']

View File

@@ -62,8 +62,6 @@
#include "readfile.h" #include "readfile.h"
#include "BLO_readblenfile.h"
#include "BLO_sys_types.h" // needed for intptr_t #include "BLO_sys_types.h" // needed for intptr_t
#ifdef _WIN32 #ifdef _WIN32
@@ -150,15 +148,14 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *to
LinkNode *previews= NULL; LinkNode *previews= NULL;
BHead *bhead; BHead *bhead;
int looking=0; int looking=0;
int npreviews = 0;
PreviewImage* prv = NULL; PreviewImage* prv = NULL;
PreviewImage* new_prv = NULL; PreviewImage* new_prv = NULL;
int tot= 0; int tot= 0;
for (bhead= blo_firstbhead(fd); bhead; bhead= blo_nextbhead(fd, bhead)) { for (bhead= blo_firstbhead(fd); bhead; bhead= blo_nextbhead(fd, bhead)) {
if (bhead->code==ofblocktype) { if (bhead->code==ofblocktype) {
ID *id= (ID*) (bhead+1); char *idname= bhead_id_name(fd, bhead);
switch(GS(id->name)) switch(GS(idname))
{ {
case ID_MA: /* fall through */ case ID_MA: /* fall through */
case ID_TE: /* fall through */ case ID_TE: /* fall through */
@@ -176,31 +173,29 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *to
} else if (bhead->code==DATA) { } else if (bhead->code==DATA) {
if (looking) { if (looking) {
if (bhead->SDNAnr == DNA_struct_find_nr(fd->filesdna, "PreviewImage") ) { if (bhead->SDNAnr == DNA_struct_find_nr(fd->filesdna, "PreviewImage") ) {
prv = (PreviewImage*) (bhead+1); prv = BLO_library_read_struct(fd, bhead, "PreviewImage");
npreviews = 0; if (prv) {
memcpy(new_prv, prv, sizeof(PreviewImage)); memcpy(new_prv, prv, sizeof(PreviewImage));
if (prv->rect[0]) { if (prv->rect[0]) {
unsigned int *rect = NULL; unsigned int *rect = NULL;
// int rectlen = 0; new_prv->rect[0] = MEM_callocN(new_prv->w[0]*new_prv->h[0]*sizeof(unsigned int), "prvrect");
new_prv->rect[0] = MEM_callocN(new_prv->w[0]*new_prv->h[0]*sizeof(unsigned int), "prvrect"); bhead= blo_nextbhead(fd, bhead);
bhead= blo_nextbhead(fd, bhead); rect = (unsigned int*)(bhead+1);
rect = (unsigned int*)(bhead+1); memcpy(new_prv->rect[0], rect, bhead->len);
// rectlen = new_prv->w[0]*new_prv->h[0]*sizeof(unsigned int); } else {
memcpy(new_prv->rect[0], rect, bhead->len); new_prv->rect[0] = NULL;
} else { }
new_prv->rect[0] = NULL;
} if (prv->rect[1]) {
unsigned int *rect = NULL;
if (prv->rect[1]) { new_prv->rect[1] = MEM_callocN(new_prv->w[1]*new_prv->h[1]*sizeof(unsigned int), "prvrect");
unsigned int *rect = NULL; bhead= blo_nextbhead(fd, bhead);
// int rectlen = 0; rect = (unsigned int*)(bhead+1);
new_prv->rect[1] = MEM_callocN(new_prv->w[1]*new_prv->h[1]*sizeof(unsigned int), "prvrect"); memcpy(new_prv->rect[1], rect, bhead->len);
bhead= blo_nextbhead(fd, bhead); } else {
rect = (unsigned int*)(bhead+1); new_prv->rect[1] = NULL;
// rectlen = new_prv->w[1]*new_prv->h[1]*sizeof(unsigned int); }
memcpy(new_prv->rect[1], rect, bhead->len); MEM_freeN(prv);
} else {
new_prv->rect[1] = NULL;
} }
} }
} }
@@ -253,15 +248,15 @@ void BLO_blendhandle_close(BlendHandle *bh) {
/**********/ /**********/
BlendFileData *BLO_read_from_file(const char *file, ReportList *reports) BlendFileData *BLO_read_from_file(const char *filepath, ReportList *reports)
{ {
BlendFileData *bfd = NULL; BlendFileData *bfd = NULL;
FileData *fd; FileData *fd;
fd = blo_openblenderfile(file, reports); fd = blo_openblenderfile(filepath, reports);
if (fd) { if (fd) {
fd->reports= reports; fd->reports= reports;
bfd= blo_read_file_internal(fd, file); bfd= blo_read_file_internal(fd, filepath);
blo_freefiledata(fd); blo_freefiledata(fd);
} }

View File

@@ -138,7 +138,6 @@
//XXX #include "BIF_previewrender.h" // bedlelvel, for struct RenderInfo //XXX #include "BIF_previewrender.h" // bedlelvel, for struct RenderInfo
#include "BLO_readfile.h" #include "BLO_readfile.h"
#include "BLO_undofile.h" #include "BLO_undofile.h"
#include "BLO_readblenfile.h" // streaming read pipe, for BLO_readblenfile BLO_readblenfilememory
#include "readfile.h" #include "readfile.h"
@@ -489,13 +488,13 @@ static void read_file_version(FileData *fd, Main *main)
} }
static Main *blo_find_main(FileData *fd, ListBase *mainlist, const char *name, const char *relabase) static Main *blo_find_main(FileData *fd, ListBase *mainlist, const char *filepath, const char *relabase)
{ {
Main *m; Main *m;
Library *lib; Library *lib;
char name1[FILE_MAXDIR+FILE_MAXFILE]; char name1[FILE_MAXDIR+FILE_MAXFILE];
strncpy(name1, name, sizeof(name1)-1); BLI_strncpy(name1, filepath, sizeof(name1));
cleanup_path(relabase, name1); cleanup_path(relabase, name1);
// printf("blo_find_main: original in %s\n", name); // printf("blo_find_main: original in %s\n", name);
// printf("blo_find_main: converted to %s\n", name1); // printf("blo_find_main: converted to %s\n", name1);
@@ -513,14 +512,14 @@ static Main *blo_find_main(FileData *fd, ListBase *mainlist, const char *name, c
BLI_addtail(mainlist, m); BLI_addtail(mainlist, m);
lib= alloc_libblock(&m->library, ID_LI, "lib"); lib= alloc_libblock(&m->library, ID_LI, "lib");
strncpy(lib->name, name, sizeof(lib->name)-1); strncpy(lib->name, filepath, sizeof(lib->name)-1);
BLI_strncpy(lib->filepath, name1, sizeof(lib->filepath)); BLI_strncpy(lib->filepath, name1, sizeof(lib->filepath));
m->curlib= lib; m->curlib= lib;
read_file_version(fd, m); read_file_version(fd, m);
if(G.f & G_DEBUG) printf("blo_find_main: added new lib %s\n", name); if(G.f & G_DEBUG) printf("blo_find_main: added new lib %s\n", filepath);
return m; return m;
} }
@@ -946,14 +945,14 @@ static FileData *blo_decode_and_check(FileData *fd, ReportList *reports)
/* cannot be called with relative paths anymore! */ /* cannot be called with relative paths anymore! */
/* on each new library added, it now checks for the current FileData and expands relativeness */ /* on each new library added, it now checks for the current FileData and expands relativeness */
FileData *blo_openblenderfile(const char *name, ReportList *reports) FileData *blo_openblenderfile(const char *filepath, ReportList *reports)
{ {
gzFile gzfile; gzFile gzfile;
errno= 0; errno= 0;
gzfile= gzopen(name, "rb"); gzfile= gzopen(filepath, "rb");
if (gzfile == (gzFile)Z_NULL) { if (gzfile == (gzFile)Z_NULL) {
BKE_reportf(reports, RPT_ERROR, "Unable to open \"%s\": %s.", name, errno ? strerror(errno) : "Unknown error reading file"); BKE_reportf(reports, RPT_ERROR, "Unable to open \"%s\": %s.", filepath, errno ? strerror(errno) : "Unknown error reading file");
return NULL; return NULL;
} else { } else {
FileData *fd = filedata_new(); FileData *fd = filedata_new();
@@ -961,7 +960,7 @@ FileData *blo_openblenderfile(const char *name, ReportList *reports)
fd->read = fd_read_gzip_from_file; fd->read = fd_read_gzip_from_file;
/* needed for library_append and read_libraries */ /* needed for library_append and read_libraries */
BLI_strncpy(fd->relabase, name, sizeof(fd->relabase)); BLI_strncpy(fd->relabase, filepath, sizeof(fd->relabase));
return blo_decode_and_check(fd, reports); return blo_decode_and_check(fd, reports);
} }
@@ -1585,7 +1584,7 @@ static PreviewImage *direct_link_preview_image(FileData *fd, PreviewImage *old_p
if (prv) { if (prv) {
int i; int i;
for (i=0; i < PREVIEW_MIPMAPS; ++i) { for (i=0; i < NUM_ICON_SIZES; ++i) {
if (prv->rect[i]) { if (prv->rect[i]) {
prv->rect[i] = newdataadr(fd, prv->rect[i]); prv->rect[i] = newdataadr(fd, prv->rect[i]);
} }
@@ -3969,7 +3968,7 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
fluidmd->fss= newdataadr(fd, fluidmd->fss); fluidmd->fss= newdataadr(fd, fluidmd->fss);
fluidmd->fss->fmd= fluidmd; fluidmd->fss->fmd= fluidmd;
fluidmd->fss->meshSurfNormals = NULL; fluidmd->fss->meshVelocities = NULL;
} }
else if (md->type==eModifierType_Smoke) { else if (md->type==eModifierType_Smoke) {
SmokeModifierData *smd = (SmokeModifierData*) md; SmokeModifierData *smd = (SmokeModifierData*) md;
@@ -5526,20 +5525,31 @@ static void lib_link_library(FileData *UNUSED(fd), Main *main)
} }
} }
/* Always call this once you havbe loaded new library data to set the relative paths correctly in relation to the blend file */ /* Always call this once you have loaded new library data to set the relative paths correctly in relation to the blend file */
static void fix_relpaths_library(const char *basepath, Main *main) static void fix_relpaths_library(const char *basepath, Main *main)
{ {
Library *lib; Library *lib;
/* BLO_read_from_memory uses a blank filename */ /* BLO_read_from_memory uses a blank filename */
if (basepath==NULL || basepath[0] == '\0') if (basepath==NULL || basepath[0] == '\0') {
return; for(lib= main->library.first; lib; lib= lib->id.next) {
/* when loading a linked lib into a file which has not been saved,
for(lib= main->library.first; lib; lib= lib->id.next) { * there is nothing we can be relative to, so instead we need to make
/* Libraries store both relative and abs paths, recreate relative paths, * it absolute. This can happen when appending an object with a relative
* relative to the blend file since indirectly linked libs will be relative to their direct linked library */ * link into an unsaved blend file. See [#27405].
if (strncmp(lib->name, "//", 2)==0) { /* if this is relative to begin with? */ * The remap relative option will make it relative again on save - campbell */
strncpy(lib->name, lib->filepath, sizeof(lib->name)); if (strncmp(lib->name, "//", 2)==0) {
BLI_path_rel(lib->name, basepath); strncpy(lib->name, lib->filepath, sizeof(lib->name));
}
}
}
else {
for(lib= main->library.first; lib; lib= lib->id.next) {
/* Libraries store both relative and abs paths, recreate relative paths,
* relative to the blend file since indirectly linked libs will be relative to their direct linked library */
if (strncmp(lib->name, "//", 2)==0) { /* if this is relative to begin with? */
strncpy(lib->name, lib->filepath, sizeof(lib->name));
BLI_path_rel(lib->name, basepath);
}
} }
} }
} }
@@ -9774,7 +9784,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
fluidmd->fss->lastgoodframe = INT_MAX; fluidmd->fss->lastgoodframe = INT_MAX;
fluidmd->fss->flag = 0; fluidmd->fss->flag = 0;
fluidmd->fss->meshSurfNormals = NULL; fluidmd->fss->meshVelocities = NULL;
} }
} }
} }
@@ -11891,7 +11901,7 @@ static BHead *read_userdef(BlendFileData *bfd, FileData *fd, BHead *bhead)
return bhead; return bhead;
} }
BlendFileData *blo_read_file_internal(FileData *fd, const char *filename) BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath)
{ {
BHead *bhead= blo_firstbhead(fd); BHead *bhead= blo_firstbhead(fd);
BlendFileData *bfd; BlendFileData *bfd;
@@ -11903,7 +11913,7 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filename)
bfd->main->versionfile= fd->fileversion; bfd->main->versionfile= fd->fileversion;
bfd->type= BLENFILETYPE_BLEND; bfd->type= BLENFILETYPE_BLEND;
strncpy(bfd->main->name, filename, sizeof(bfd->main->name)-1); strncpy(bfd->main->name, filepath, sizeof(bfd->main->name)-1);
while(bhead) { while(bhead) {
switch(bhead->code) { switch(bhead->code) {
@@ -12954,7 +12964,7 @@ static void give_base_to_groups(Main *mainvar, Scene *scene)
/* returns true if the item was found /* returns true if the item was found
* but it may already have already been appended/linked */ * but it may already have already been appended/linked */
static int append_named_part(const bContext *C, Main *mainl, FileData *fd, const char *name, int idcode, short flag) static int append_named_part(const bContext *C, Main *mainl, FileData *fd, const char *idname, int idcode, short flag)
{ {
Scene *scene= CTX_data_scene(C); Scene *scene= CTX_data_scene(C);
Object *ob; Object *ob;
@@ -12969,9 +12979,9 @@ static int append_named_part(const bContext *C, Main *mainl, FileData *fd, const
if(bhead->code==ENDB) endloop= 1; if(bhead->code==ENDB) endloop= 1;
else if(bhead->code==idcode) { else if(bhead->code==idcode) {
char *idname= bhead_id_name(fd, bhead); const char *idname_test= bhead_id_name(fd, bhead);
if(strcmp(idname+2, name)==0) { if(strcmp(idname_test + 2, idname)==0) {
found= 1; found= 1;
id= is_yet_read(fd, mainl, bhead); id= is_yet_read(fd, mainl, bhead);
if(id==NULL) { if(id==NULL) {
@@ -13023,10 +13033,10 @@ static int append_named_part(const bContext *C, Main *mainl, FileData *fd, const
return found; return found;
} }
int BLO_library_append_named_part(const bContext *C, Main *mainl, BlendHandle** bh, const char *name, int idcode, short flag) int BLO_library_append_named_part(const bContext *C, Main *mainl, BlendHandle** bh, const char *idname, int idcode, short flag)
{ {
FileData *fd= (FileData*)(*bh); FileData *fd= (FileData*)(*bh);
return append_named_part(C, mainl, fd, name, idcode, flag); return append_named_part(C, mainl, fd, idname, idcode, flag);
} }
static void append_id_part(FileData *fd, Main *mainvar, ID *id, ID **id_r) static void append_id_part(FileData *fd, Main *mainvar, ID *id, ID **id_r)
@@ -13051,7 +13061,7 @@ static void append_id_part(FileData *fd, Main *mainvar, ID *id, ID **id_r)
/* common routine to append/link something from a library */ /* common routine to append/link something from a library */
static Main* library_append_begin(const bContext *C, FileData **fd, char *dir) static Main* library_append_begin(const bContext *C, FileData **fd, const char *filepath)
{ {
Main *mainvar= CTX_data_main(C); Main *mainvar= CTX_data_main(C);
Main *mainl; Main *mainl;
@@ -13060,7 +13070,7 @@ static Main* library_append_begin(const bContext *C, FileData **fd, char *dir)
blo_split_main(&(*fd)->mainlist, mainvar); blo_split_main(&(*fd)->mainlist, mainvar);
/* which one do we need? */ /* which one do we need? */
mainl = blo_find_main(*fd, &(*fd)->mainlist, dir, G.main->name); mainl = blo_find_main(*fd, &(*fd)->mainlist, filepath, G.main->name);
/* needed for do_version */ /* needed for do_version */
mainl->versionfile= (*fd)->fileversion; mainl->versionfile= (*fd)->fileversion;
@@ -13069,10 +13079,10 @@ static Main* library_append_begin(const bContext *C, FileData **fd, char *dir)
return mainl; return mainl;
} }
Main* BLO_library_append_begin(const bContext *C, BlendHandle** bh, char *dir) Main* BLO_library_append_begin(const bContext *C, BlendHandle** bh, const char *filepath)
{ {
FileData *fd= (FileData*)(*bh); FileData *fd= (FileData*)(*bh);
return library_append_begin(C, &fd, dir); return library_append_begin(C, &fd, filepath);
} }
static void append_do_cursor(Scene *scene, Library *curlib, short flag) static void append_do_cursor(Scene *scene, Library *curlib, short flag)
@@ -13194,30 +13204,10 @@ void BLO_library_append_end(const bContext *C, struct Main *mainl, BlendHandle**
*bh= (BlendHandle*)fd; *bh= (BlendHandle*)fd;
} }
/* this is a version of BLO_library_append needed by the BPython API, so void *BLO_library_read_struct(FileData *fd, BHead *bh, const char *blockname)
* scripts can load data from .blend files -- see Blender.Library module.*/
/* append to scene */
/* this should probably be moved into the Python code anyway */
/* tentatively removed, Python should be able to use the split functions too: */
/* BLO_library_append_begin, BLO_library_append_end, BLO_library_append_named_part */
#if 0
void BLO_script_library_append(BlendHandle **bh, char *dir, const char *name,
int idcode, short flag, Main *mainvar, Scene *scene, ReportList *reports)
{ {
FileData *fd= (FileData*)(*bh); return read_struct(fd, bh, blockname);
/* try to append the requested object */
fd->reports= reports;
library_append(mainvar, scene, name, dir, idcode, 0, &fd, NULL, 0, flag );
if(fd) fd->reports= NULL;
/* do we need to do this? */
if(scene)
DAG_scene_sort(bmain, scene);
*bh= (BlendHandle*)fd;
} }
#endif
/* ************* READ LIBRARY ************** */ /* ************* READ LIBRARY ************** */

View File

@@ -113,9 +113,9 @@ struct Main;
void blo_join_main(ListBase *mainlist); void blo_join_main(ListBase *mainlist);
void blo_split_main(ListBase *mainlist, struct Main *main); void blo_split_main(ListBase *mainlist, struct Main *main);
BlendFileData *blo_read_file_internal(FileData *fd, const char *filename); BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath);
FileData *blo_openblenderfile(const char *name, struct ReportList *reports); FileData *blo_openblenderfile(const char *filepath, struct ReportList *reports);
FileData *blo_openblendermemory(void *buffer, int buffersize, struct ReportList *reports); FileData *blo_openblendermemory(void *buffer, int buffersize, struct ReportList *reports);
FileData *blo_openblendermemfile(struct MemFile *memfile, struct ReportList *reports); FileData *blo_openblendermemfile(struct MemFile *memfile, struct ReportList *reports);

View File

@@ -27,11 +27,13 @@
* ***** END GPL LICENSE BLOCK ***** * ***** END GPL LICENSE BLOCK *****
* *
*/ */
/** /**
* \file BLO_readblenfile.c * \file runtime.c
* \brief This file handles the loading if .blend files * \brief This file handles the loading of .blend files embedded in runtimes
* \ingroup blo * \ingroup blenloader
*/ */
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@@ -46,90 +48,56 @@
#endif #endif
#include "BLO_readfile.h" #include "BLO_readfile.h"
#include "BLO_readblenfile.h" #include "BLO_runtime.h"
#include "BKE_blender.h" #include "BKE_blender.h"
#include "BKE_report.h" #include "BKE_report.h"
#include "BKE_utildefines.h"
#include "BLI_blenlib.h" #include "BLI_blenlib.h"
/** Magic number for the file header */
const char *headerMagic = "BLENDFI";
/**
* \brief Set the version number into the array.
*
* version contains the integer number of the version
* i.e. 227
* array[1] gets set to the div of the number by 100 i.e. 2
* array[2] gets the remainder i.e. 27
*/
void BLO_setversionnumber(char array[4], int version)
{
memset(array, 0, sizeof(char)*4);
array[1] = version / 100;
array[2] = version % 100;
}
/**
* Sets version number using BLENDER_VERSION
* Function that calls the setversionnumber(char[],int) with
* the BLENDER_VERSION constant and sets the resultant array
* with the version parts.
* see BLO_setversionnumber(char[],int).
*/
void BLO_setcurrentversionnumber(char array[4])
{
BLO_setversionnumber(array, BLENDER_VERSION);
}
#ifndef O_BINARY
#define O_BINARY 0
#endif
/* Runtime reading */ /* Runtime reading */
static int handle_read_msb_int(int handle) { static int handle_read_msb_int(int handle)
{
unsigned char buf[4]; unsigned char buf[4];
if (read(handle, buf, 4)!=4) if(read(handle, buf, 4) != 4)
return -1; return -1;
else
return (buf[0]<<24) + (buf[1]<<16) + (buf[2]<<8) + (buf[3]<<0); return (buf[0]<<24) + (buf[1]<<16) + (buf[2]<<8) + (buf[3]<<0);
} }
int blo_is_a_runtime(char *path) { int BLO_is_a_runtime(char *path)
{
int res= 0, fd= open(path, O_BINARY|O_RDONLY, 0); int res= 0, fd= open(path, O_BINARY|O_RDONLY, 0);
int datastart; int datastart;
char buf[8]; char buf[8];
if (fd==-1) if(fd==-1)
goto cleanup; goto cleanup;
lseek(fd, -12, SEEK_END); lseek(fd, -12, SEEK_END);
datastart= handle_read_msb_int(fd); datastart= handle_read_msb_int(fd);
if (datastart==-1)
if(datastart==-1)
goto cleanup; goto cleanup;
else if (read(fd, buf, 8)!=8) else if(read(fd, buf, 8)!=8)
goto cleanup; goto cleanup;
else if (memcmp(buf, "BRUNTIME", 8)!=0) else if(memcmp(buf, "BRUNTIME", 8)!=0)
goto cleanup; goto cleanup;
else else
res= 1; res= 1;
cleanup: cleanup:
if (fd!=-1) if(fd!=-1)
close(fd); close(fd);
return res; return res;
} }
BlendFileData * BlendFileData *BLO_read_runtime(char *path, ReportList *reports)
blo_read_runtime(
char *path,
ReportList *reports)
{ {
BlendFileData *bfd= NULL; BlendFileData *bfd= NULL;
size_t actualsize; size_t actualsize;
@@ -137,7 +105,8 @@ blo_read_runtime(
char buf[8]; char buf[8];
fd= open(path, O_BINARY|O_RDONLY, 0); fd= open(path, O_BINARY|O_RDONLY, 0);
if (fd==-1) {
if(fd==-1) {
BKE_reportf(reports, RPT_ERROR, "Unable to open \"%s\": %s.", path, strerror(errno)); BKE_reportf(reports, RPT_ERROR, "Unable to open \"%s\": %s.", path, strerror(errno));
goto cleanup; goto cleanup;
} }
@@ -147,16 +116,20 @@ blo_read_runtime(
lseek(fd, -12, SEEK_END); lseek(fd, -12, SEEK_END);
datastart= handle_read_msb_int(fd); datastart= handle_read_msb_int(fd);
if (datastart==-1) {
if(datastart==-1) {
BKE_reportf(reports, RPT_ERROR, "Unable to read \"%s\" (problem seeking)", path); BKE_reportf(reports, RPT_ERROR, "Unable to read \"%s\" (problem seeking)", path);
goto cleanup; goto cleanup;
} else if (read(fd, buf, 8)!=8) { }
else if(read(fd, buf, 8)!=8) {
BKE_reportf(reports, RPT_ERROR, "Unable to read \"%s\" (truncated header)", path); BKE_reportf(reports, RPT_ERROR, "Unable to read \"%s\" (truncated header)", path);
goto cleanup; goto cleanup;
} else if (memcmp(buf, "BRUNTIME", 8)!=0) { }
else if(memcmp(buf, "BRUNTIME", 8)!=0) {
BKE_reportf(reports, RPT_ERROR, "Unable to read \"%s\" (not a blend file)", path); BKE_reportf(reports, RPT_ERROR, "Unable to read \"%s\" (not a blend file)", path);
goto cleanup; goto cleanup;
} else { }
else {
//printf("starting to read runtime from %s at datastart %d\n", path, datastart); //printf("starting to read runtime from %s at datastart %d\n", path, datastart);
lseek(fd, datastart, SEEK_SET); lseek(fd, datastart, SEEK_SET);
bfd = blo_read_blendafterruntime(fd, path, actualsize-datastart, reports); bfd = blo_read_blendafterruntime(fd, path, actualsize-datastart, reports);
@@ -164,7 +137,7 @@ blo_read_runtime(
} }
cleanup: cleanup:
if (fd!=-1) if(fd!=-1)
close(fd); close(fd);
return bfd; return bfd;

View File

@@ -2661,14 +2661,14 @@ static int write_file_handle(Main *mainvar, int handle, MemFile *compare, MemFil
} }
/* return: success (1) */ /* return: success (1) */
int BLO_write_file(Main *mainvar, char *dir, int write_flags, ReportList *reports, int *thumb) int BLO_write_file(Main *mainvar, const char *filepath, int write_flags, ReportList *reports, int *thumb)
{ {
char userfilename[FILE_MAXDIR+FILE_MAXFILE]; char userfilename[FILE_MAXDIR+FILE_MAXFILE];
char tempname[FILE_MAXDIR+FILE_MAXFILE+1]; char tempname[FILE_MAXDIR+FILE_MAXFILE+1];
int file, err, write_user_block; int file, err, write_user_block;
/* open temporary file, so we preserve the original in case we crash */ /* open temporary file, so we preserve the original in case we crash */
BLI_snprintf(tempname, sizeof(tempname), "%s@", dir); BLI_snprintf(tempname, sizeof(tempname), "%s@", filepath);
file = open(tempname,O_BINARY+O_WRONLY+O_CREAT+O_TRUNC, 0666); file = open(tempname,O_BINARY+O_WRONLY+O_CREAT+O_TRUNC, 0666);
if(file == -1) { if(file == -1) {
@@ -2680,24 +2680,32 @@ int BLO_write_file(Main *mainvar, char *dir, int write_flags, ReportList *report
if(write_flags & G_FILE_RELATIVE_REMAP) { if(write_flags & G_FILE_RELATIVE_REMAP) {
char dir1[FILE_MAXDIR+FILE_MAXFILE]; char dir1[FILE_MAXDIR+FILE_MAXFILE];
char dir2[FILE_MAXDIR+FILE_MAXFILE]; char dir2[FILE_MAXDIR+FILE_MAXFILE];
BLI_split_dirfile(dir, dir1, NULL); BLI_split_dirfile(filepath, dir1, NULL);
BLI_split_dirfile(mainvar->name, dir2, NULL); BLI_split_dirfile(mainvar->name, dir2, NULL);
/* just incase there is some subtle difference */ /* just incase there is some subtle difference */
BLI_cleanup_dir(mainvar->name, dir1); BLI_cleanup_dir(mainvar->name, dir1);
BLI_cleanup_dir(mainvar->name, dir2); BLI_cleanup_dir(mainvar->name, dir2);
if(strcmp(dir1, dir2)==0) if(BLI_path_cmp(dir1, dir2)==0) {
write_flags &= ~G_FILE_RELATIVE_REMAP; write_flags &= ~G_FILE_RELATIVE_REMAP;
else }
makeFilesAbsolute(mainvar, G.main->name, NULL); else {
if(G.relbase_valid) {
/* blend may not have been saved before. Tn this case
* we should not have any relative paths, but if there
* is somehow, an invalid or empty G.main->name it will
* print an error, dont try make the absolute in this case. */
makeFilesAbsolute(mainvar, G.main->name, NULL);
}
}
} }
BLI_make_file_string(G.main->name, userfilename, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_STARTUP_FILE); 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(dir, userfilename) == 0); write_user_block= (BLI_path_cmp(filepath, userfilename) == 0);
if(write_flags & G_FILE_RELATIVE_REMAP) if(write_flags & G_FILE_RELATIVE_REMAP)
makeFilesRelative(mainvar, dir, NULL); /* note, making relative to something OTHER then G.main->name */ makeFilesRelative(mainvar, filepath, NULL); /* note, making relative to something OTHER then G.main->name */
/* actual file writing */ /* actual file writing */
err= write_file_handle(mainvar, file, NULL,NULL, write_user_block, write_flags, thumb); err= write_file_handle(mainvar, file, NULL,NULL, write_user_block, write_flags, thumb);
@@ -2711,12 +2719,12 @@ int BLO_write_file(Main *mainvar, char *dir, int write_flags, ReportList *report
int ret; int ret;
/* first write compressed to separate @.gz */ /* first write compressed to separate @.gz */
BLI_snprintf(gzname, sizeof(gzname), "%s@.gz", dir); BLI_snprintf(gzname, sizeof(gzname), "%s@.gz", filepath);
ret = BLI_gzip(tempname, gzname); ret = BLI_gzip(tempname, gzname);
if(0==ret) { if(0==ret) {
/* now rename to real file name, and delete temp @ file too */ /* now rename to real file name, and delete temp @ file too */
if(BLI_rename(gzname, dir) != 0) { if(BLI_rename(gzname, filepath) != 0) {
BKE_report(reports, RPT_ERROR, "Can't change old file. File saved with @."); BKE_report(reports, RPT_ERROR, "Can't change old file. File saved with @.");
return 0; return 0;
} }
@@ -2732,7 +2740,7 @@ int BLO_write_file(Main *mainvar, char *dir, int write_flags, ReportList *report
return 0; return 0;
} }
} }
else if(BLI_rename(tempname, dir) != 0) { else if(BLI_rename(tempname, filepath) != 0) {
BKE_report(reports, RPT_ERROR, "Can't change old file. File saved with @"); BKE_report(reports, RPT_ERROR, "Can't change old file. File saved with @");
return 0; return 0;
} }

View File

@@ -1360,6 +1360,7 @@ void ANIM_OT_keyframe_delete_v3d (wmOperatorType *ot)
{ {
/* identifiers */ /* identifiers */
ot->name= "Delete Keyframe"; ot->name= "Delete Keyframe";
ot->description= "Remove keyframes on current frame for selected object";
ot->idname= "ANIM_OT_keyframe_delete_v3d"; ot->idname= "ANIM_OT_keyframe_delete_v3d";
/* callbacks */ /* callbacks */

View File

@@ -578,9 +578,8 @@ void ANIM_keyingset_info_register (KeyingSetInfo *ksi)
} }
/* Remove the given KeyingSetInfo from the list of type infos, and also remove the builtin set if appropriate */ /* Remove the given KeyingSetInfo from the list of type infos, and also remove the builtin set if appropriate */
void ANIM_keyingset_info_unregister (const bContext *C, KeyingSetInfo *ksi) void ANIM_keyingset_info_unregister (Main *bmain, KeyingSetInfo *ksi)
{ {
Main *bmain= CTX_data_main(C);
KeyingSet *ks, *ksn; KeyingSet *ks, *ksn;
/* find relevant builtin KeyingSets which use this, and remove them */ /* find relevant builtin KeyingSets which use this, and remove them */

View File

@@ -206,7 +206,7 @@ void POSE_OT_propagate(struct wmOperatorType *ot);
/* editarmature.c */ /* editarmature.c */
EditBone *make_boneList(struct ListBase *edbo, struct ListBase *bones, struct EditBone *parent, struct Bone *actBone); EditBone *make_boneList(struct ListBase *edbo, struct ListBase *bones, struct EditBone *parent, struct Bone *actBone);
void BIF_sk_selectStroke(struct bContext *C, const short mval[2], short extend); void BIF_sk_selectStroke(struct bContext *C, const int mval[2], short extend);
/* duplicate method */ /* duplicate method */
void preEditBoneDuplicate(struct ListBase *editbones); void preEditBoneDuplicate(struct ListBase *editbones);

View File

@@ -1698,7 +1698,7 @@ void ARMATURE_OT_select_linked(wmOperatorType *ot)
/* does bones and points */ /* does bones and points */
/* note that BONE ROOT only gets drawn for root bones (or without IK) */ /* note that BONE ROOT only gets drawn for root bones (or without IK) */
static EditBone *get_nearest_editbonepoint (ViewContext *vc, const short mval[2], ListBase *edbo, int findunsel, int *selmask) static EditBone *get_nearest_editbonepoint (ViewContext *vc, const int mval[2], ListBase *edbo, int findunsel, int *selmask)
{ {
EditBone *ebone; EditBone *ebone;
rcti rect; rcti rect;
@@ -1958,7 +1958,7 @@ static int ebone_select_flag(EditBone *ebone)
} }
/* context: editmode armature in view3d */ /* context: editmode armature in view3d */
int mouse_armature(bContext *C, const short mval[2], int extend) int mouse_armature(bContext *C, const int mval[2], int extend)
{ {
Object *obedit= CTX_data_edit_object(C); Object *obedit= CTX_data_edit_object(C);
bArmature *arm= obedit->data; bArmature *arm= obedit->data;
@@ -2498,8 +2498,8 @@ static int armature_click_extrude_invoke(bContext *C, wmOperator *op, wmEvent *e
ARegion *ar; ARegion *ar;
View3D *v3d; View3D *v3d;
RegionView3D *rv3d; RegionView3D *rv3d;
float dx, dy, fz, *fp = NULL, dvec[3], oldcurs[3]; float *fp = NULL, tvec[3], oldcurs[3];
short mx, my, mval[2]; int mx, my;
int retv; int retv;
scene= CTX_data_scene(C); scene= CTX_data_scene(C);
@@ -2513,27 +2513,9 @@ static int armature_click_extrude_invoke(bContext *C, wmOperator *op, wmEvent *e
mx= event->x - ar->winrct.xmin; mx= event->x - ar->winrct.xmin;
my= event->y - ar->winrct.ymin; my= event->y - ar->winrct.ymin;
project_short_noclip(ar, fp, mval);
window_to_3d(ar, tvec, fp, mx, my);
initgrabz(rv3d, fp[0], fp[1], fp[2]); copy_v3_v3(fp, tvec);
if(mval[0]!=IS_CLIPPED) {
window_to_3d_delta(ar, dvec, mval[0]-mx, mval[1]-my);
sub_v3_v3v3(fp, fp, dvec);
}
else {
dx= ((float)(mx-(ar->winx/2)))*rv3d->zfac/(ar->winx/2);
dy= ((float)(my-(ar->winy/2)))*rv3d->zfac/(ar->winy/2);
fz= rv3d->persmat[0][3]*fp[0]+ rv3d->persmat[1][3]*fp[1]+ rv3d->persmat[2][3]*fp[2]+ rv3d->persmat[3][3];
fz= fz/rv3d->zfac;
fp[0]= (rv3d->persinv[0][0]*dx + rv3d->persinv[1][0]*dy+ rv3d->persinv[2][0]*fz)-rv3d->ofs[0];
fp[1]= (rv3d->persinv[0][1]*dx + rv3d->persinv[1][1]*dy+ rv3d->persinv[2][1]*fz)-rv3d->ofs[1];
fp[2]= (rv3d->persinv[0][2]*dx + rv3d->persinv[1][2]*dy+ rv3d->persinv[2][2]*fz)-rv3d->ofs[2];
}
/* extrude to the where new cursor is and store the operation result */ /* extrude to the where new cursor is and store the operation result */
retv= armature_click_extrude_exec(C, op); retv= armature_click_extrude_exec(C, op);

View File

@@ -702,7 +702,7 @@ static void sk_drawStrokeSubdivision(ToolSettings *toolsettings, SK_Stroke *stk)
} }
} }
static SK_Point *sk_snapPointStroke(bContext *C, SK_Stroke *stk, short mval[2], int *dist, int *index, int all_pts) static SK_Point *sk_snapPointStroke(bContext *C, SK_Stroke *stk, int mval[2], int *dist, int *index, int all_pts)
{ {
ARegion *ar = CTX_wm_region(C); ARegion *ar = CTX_wm_region(C);
SK_Point *pt = NULL; SK_Point *pt = NULL;
@@ -736,7 +736,7 @@ static SK_Point *sk_snapPointStroke(bContext *C, SK_Stroke *stk, short mval[2],
} }
#if 0 /* UNUSED 2.5 */ #if 0 /* UNUSED 2.5 */
static SK_Point *sk_snapPointArmature(bContext *C, Object *ob, ListBase *ebones, short mval[2], int *dist) static SK_Point *sk_snapPointArmature(bContext *C, Object *ob, ListBase *ebones, int mval[2], int *dist)
{ {
ARegion *ar = CTX_wm_region(C); ARegion *ar = CTX_wm_region(C);
SK_Point *pt = NULL; SK_Point *pt = NULL;
@@ -2157,7 +2157,7 @@ static void sk_applyGesture(bContext *C, SK_Sketch *sketch)
/********************************************/ /********************************************/
static int sk_selectStroke(bContext *C, SK_Sketch *sketch, const short mval[2], int extend) static int sk_selectStroke(bContext *C, SK_Sketch *sketch, const int mval[2], int extend)
{ {
ViewContext vc; ViewContext vc;
rcti rect; rcti rect;
@@ -2473,7 +2473,7 @@ static int sketch_delete(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(ev
return OPERATOR_FINISHED; return OPERATOR_FINISHED;
} }
void BIF_sk_selectStroke(bContext *C, const short mval[2], short extend) void BIF_sk_selectStroke(bContext *C, const int mval[2], short extend)
{ {
ToolSettings *ts = CTX_data_tool_settings(C); ToolSettings *ts = CTX_data_tool_settings(C);
SK_Sketch *sketch = contextSketch(C, 0); SK_Sketch *sketch = contextSketch(C, 0);

View File

@@ -527,7 +527,7 @@ static int poselib_remove_exec (bContext *C, wmOperator *op)
} }
/* get index (and pointer) of pose to remove */ /* get index (and pointer) of pose to remove */
marker= BLI_findlink(&act->markers, RNA_int_get(op->ptr, "pose")); marker= BLI_findlink(&act->markers, RNA_enum_get(op->ptr, "pose"));
if (marker == NULL) { if (marker == NULL) {
BKE_reportf(op->reports, RPT_ERROR, "Invalid Pose specified %d", RNA_int_get(op->ptr, "pose")); BKE_reportf(op->reports, RPT_ERROR, "Invalid Pose specified %d", RNA_int_get(op->ptr, "pose"));
return OPERATOR_CANCELLED; return OPERATOR_CANCELLED;

View File

@@ -4169,7 +4169,7 @@ void CURVE_OT_make_segment(wmOperatorType *ot)
/***************** pick select from 3d view **********************/ /***************** pick select from 3d view **********************/
int mouse_nurb(bContext *C, const short mval[2], int extend) int mouse_nurb(bContext *C, const int mval[2], int extend)
{ {
Object *obedit= CTX_data_edit_object(C); Object *obedit= CTX_data_edit_object(C);
Curve *cu= obedit->data; Curve *cu= obedit->data;
@@ -4666,7 +4666,7 @@ static int add_vertex_invoke(bContext *C, wmOperator *op, wmEvent *event)
Curve *cu; Curve *cu;
ViewContext vc; ViewContext vc;
float location[3]; float location[3];
short mval[2]; int mval[2];
Nurb *nu; Nurb *nu;
BezTriple *bezt; BezTriple *bezt;
@@ -6118,6 +6118,7 @@ int join_curve_exec(bContext *C, wmOperator *UNUSED(op))
mul_m4_v3(cmat, bezt->vec[2]); mul_m4_v3(cmat, bezt->vec[2]);
bezt++; bezt++;
} }
calchandlesNurb(newnu);
} }
if( (bp= newnu->bp) ) { if( (bp= newnu->bp) ) {
a= newnu->pntsu*nu->pntsv; a= newnu->pntsu*nu->pntsv;

View File

@@ -377,8 +377,7 @@ static void gp_strokepoint_convertcoords (bContext *C, bGPDstroke *gps, bGPDspoi
} }
else { else {
float *fp= give_cursor(scene, v3d); float *fp= give_cursor(scene, v3d);
float dvec[3]; int mval[2];
short mval[2];
int mx, my; int mx, my;
/* get screen coordinate */ /* get screen coordinate */
@@ -390,15 +389,13 @@ static void gp_strokepoint_convertcoords (bContext *C, bGPDstroke *gps, bGPDspoi
mx= (int)(pt->x / 100 * ar->winx); mx= (int)(pt->x / 100 * ar->winx);
my= (int)(pt->y / 100 * ar->winy); my= (int)(pt->y / 100 * ar->winy);
} }
mval[0]= (short)mx; mval[0]= mx;
mval[1]= (short)my; mval[1]= my;
/* convert screen coordinate to 3d coordinates /* convert screen coordinate to 3d coordinates
* - method taken from editview.c - mouse_cursor() * - method taken from editview.c - mouse_cursor()
*/ */
project_short_noclip(ar, fp, mval); window_to_3d(ar, p3d, fp, mval[0], mval[1]);
window_to_3d(ar, dvec, mval[0]-mx, mval[1]-my);
sub_v3_v3v3(p3d, fp, dvec);
} }
} }
@@ -564,8 +561,6 @@ static int gp_convert_layer_exec (bContext *C, wmOperator *op)
bGPdata *gpd= gpencil_data_get_active(C); bGPdata *gpd= gpencil_data_get_active(C);
bGPDlayer *gpl= gpencil_layer_getactive(gpd); bGPDlayer *gpl= gpencil_layer_getactive(gpd);
Scene *scene= CTX_data_scene(C); Scene *scene= CTX_data_scene(C);
View3D *v3d= CTX_wm_view3d(C);
float *fp= give_cursor(scene, v3d);
int mode= RNA_enum_get(op->ptr, "type"); int mode= RNA_enum_get(op->ptr, "type");
/* check if there's data to work with */ /* check if there's data to work with */
@@ -574,9 +569,6 @@ static int gp_convert_layer_exec (bContext *C, wmOperator *op)
return OPERATOR_CANCELLED; return OPERATOR_CANCELLED;
} }
/* initialise 3d-cursor correction globals */
initgrabz(CTX_wm_region_view3d(C), fp[0], fp[1], fp[2]);
/* handle conversion modes */ /* handle conversion modes */
switch (mode) { switch (mode) {
case GP_STROKECONVERT_PATH: case GP_STROKECONVERT_PATH:

View File

@@ -239,7 +239,7 @@ static short gp_stroke_filtermval (tGPsdata *p, int mval[2], int pmval[2])
/* convert screen-coordinates to buffer-coordinates */ /* convert screen-coordinates to buffer-coordinates */
// XXX this method needs a total overhaul! // XXX this method needs a total overhaul!
static void gp_stroke_convertcoords (tGPsdata *p, short mval[2], float out[3], float *depth) static void gp_stroke_convertcoords (tGPsdata *p, int mval[2], float out[3], float *depth)
{ {
bGPdata *gpd= p->gpd; bGPdata *gpd= p->gpd;
@@ -251,7 +251,7 @@ static void gp_stroke_convertcoords (tGPsdata *p, short mval[2], float out[3], f
*/ */
} }
else { else {
const short mx=mval[0], my=mval[1]; const int mx=mval[0], my=mval[1];
float rvec[3], dvec[3]; float rvec[3], dvec[3];
/* Current method just converts each point in screen-coordinates to /* Current method just converts each point in screen-coordinates to
@@ -266,7 +266,7 @@ static void gp_stroke_convertcoords (tGPsdata *p, short mval[2], float out[3], f
gp_get_3d_reference(p, rvec); gp_get_3d_reference(p, rvec);
/* method taken from editview.c - mouse_cursor() */ /* method taken from editview.c - mouse_cursor() */
project_short_noclip(p->ar, rvec, mval); project_int_noclip(p->ar, rvec, mval);
window_to_3d_delta(p->ar, dvec, mval[0]-mx, mval[1]-my); window_to_3d_delta(p->ar, dvec, mval[0]-mx, mval[1]-my);
sub_v3_v3v3(out, rvec, dvec); sub_v3_v3v3(out, rvec, dvec);
} }
@@ -387,8 +387,8 @@ static short gp_stroke_addpoint (tGPsdata *p, int mval[2], float pressure)
/* temp struct for gp_stroke_smooth() */ /* temp struct for gp_stroke_smooth() */
typedef struct tGpSmoothCo { typedef struct tGpSmoothCo {
short x; int x;
short y; int y;
} tGpSmoothCo; } tGpSmoothCo;
/* smooth a stroke (in buffer) before storing it */ /* smooth a stroke (in buffer) before storing it */
@@ -417,8 +417,8 @@ static void gp_stroke_smooth (tGPsdata *p)
const tGPspoint *pd= (i+1 < cmx)?(pc+1):(pc); const tGPspoint *pd= (i+1 < cmx)?(pc+1):(pc);
const tGPspoint *pe= (i+2 < cmx)?(pc+2):(pd); const tGPspoint *pe= (i+2 < cmx)?(pc+2):(pd);
spc->x= (short)(0.1*pa->x + 0.2*pb->x + 0.4*pc->x + 0.2*pd->x + 0.1*pe->x); spc->x= (int)(0.1*pa->x + 0.2*pb->x + 0.4*pc->x + 0.2*pd->x + 0.1*pe->x);
spc->y= (short)(0.1*pa->y + 0.2*pb->y + 0.4*pc->y + 0.2*pd->y + 0.1*pe->y); spc->y= (int)(0.1*pa->y + 0.2*pb->y + 0.4*pc->y + 0.2*pd->y + 0.1*pe->y);
} }
/* second pass: apply smoothed coordinates */ /* second pass: apply smoothed coordinates */
@@ -574,7 +574,7 @@ static void gp_stroke_newfrombuffer (tGPsdata *p)
/* get an array of depths, far depths are blended */ /* get an array of depths, far depths are blended */
if (gpencil_project_check(p)) { if (gpencil_project_check(p)) {
short mval[2], mval_prev[2]= {0}; int mval[2], mval_prev[2]= {0};
int interp_depth = 0; int interp_depth = 0;
int found_depth = 0; int found_depth = 0;
@@ -738,7 +738,7 @@ static void gp_stroke_eraser_dostroke (tGPsdata *p, int mval[], int mvalo[], sho
{ {
bGPDspoint *pt1, *pt2; bGPDspoint *pt1, *pt2;
int x0=0, y0=0, x1=0, y1=0; int x0=0, y0=0, x1=0, y1=0;
short xyval[2]; int xyval[2];
int i; int i;
if (gps->totpoints == 0) { if (gps->totpoints == 0) {
@@ -750,7 +750,7 @@ static void gp_stroke_eraser_dostroke (tGPsdata *p, int mval[], int mvalo[], sho
else if (gps->totpoints == 1) { else if (gps->totpoints == 1) {
/* get coordinates */ /* get coordinates */
if (gps->flag & GP_STROKE_3DSPACE) { if (gps->flag & GP_STROKE_3DSPACE) {
project_short(p->ar, &gps->points->x, xyval); project_int(p->ar, &gps->points->x, xyval);
x0= xyval[0]; x0= xyval[0];
y0= xyval[1]; y0= xyval[1];
} }
@@ -804,11 +804,11 @@ static void gp_stroke_eraser_dostroke (tGPsdata *p, int mval[], int mvalo[], sho
/* get coordinates */ /* get coordinates */
if (gps->flag & GP_STROKE_3DSPACE) { if (gps->flag & GP_STROKE_3DSPACE) {
project_short(p->ar, &pt1->x, xyval); project_int(p->ar, &pt1->x, xyval);
x0= xyval[0]; x0= xyval[0];
y0= xyval[1]; y0= xyval[1];
project_short(p->ar, &pt2->x, xyval); project_int(p->ar, &pt2->x, xyval);
x1= xyval[0]; x1= xyval[0];
y1= xyval[1]; y1= xyval[1];
} }
@@ -1501,8 +1501,8 @@ static int gpencil_draw_exec (bContext *C, wmOperator *op)
/* get relevant data for this point from stroke */ /* get relevant data for this point from stroke */
RNA_float_get_array(&itemptr, "mouse", mousef); RNA_float_get_array(&itemptr, "mouse", mousef);
p->mval[0] = (short)mousef[0]; p->mval[0] = (int)mousef[0];
p->mval[1] = (short)mousef[1]; p->mval[1] = (int)mousef[1];
p->pressure= RNA_float_get(&itemptr, "pressure"); p->pressure= RNA_float_get(&itemptr, "pressure");
if (RNA_boolean_get(&itemptr, "is_start")) { if (RNA_boolean_get(&itemptr, "is_start")) {

View File

@@ -117,7 +117,7 @@ void ED_armature_deselect_all_visible(struct Object *obedit);
int ED_do_pose_selectbuffer(struct Scene *scene, struct Base *base, unsigned int *buffer, int ED_do_pose_selectbuffer(struct Scene *scene, struct Base *base, unsigned int *buffer,
short hits, short extend); short hits, short extend);
int mouse_armature(struct bContext *C, const short mval[2], int extend); int mouse_armature(struct bContext *C, const int mval[2], int extend);
int join_armature_exec(struct bContext *C, struct wmOperator *op); int join_armature_exec(struct bContext *C, struct wmOperator *op);
struct Bone *get_indexed_bone (struct Object *ob, int index); struct Bone *get_indexed_bone (struct Object *ob, int index);
float ED_rollBoneToVector(EditBone *bone, const float new_up_axis[3], const short axis_only); float ED_rollBoneToVector(EditBone *bone, const float new_up_axis[3], const short axis_only);

View File

@@ -66,7 +66,7 @@ void free_editNurb (struct Object *obedit);
void free_curve_editNurb (struct Curve *cu); void free_curve_editNurb (struct Curve *cu);
int mouse_nurb (struct bContext *C, const short mval[2], int extend); int mouse_nurb (struct bContext *C, const int mval[2], int extend);
struct Nurb *add_nurbs_primitive(struct bContext *C, float mat[4][4], int type, int newob); struct Nurb *add_nurbs_primitive(struct bContext *C, float mat[4][4], int type, int newob);

View File

@@ -56,7 +56,7 @@ struct wmKeyConfig;
* Used as part of the 'stroke cache' used during drawing of new strokes * Used as part of the 'stroke cache' used during drawing of new strokes
*/ */
typedef struct tGPspoint { typedef struct tGPspoint {
short x, y; /* x and y coordinates of cursor (in relative to area) */ int x, y; /* x and y coordinates of cursor (in relative to area) */
float pressure; /* pressure of tablet at this point */ float pressure; /* pressure of tablet at this point */
} tGPspoint; } tGPspoint;

View File

@@ -68,8 +68,5 @@ int ED_space_image_show_uvshadow(struct SpaceImage *sima, struct Object *obedit)
/* UI level image (texture) updating... render calls own stuff (too) */ /* UI level image (texture) updating... render calls own stuff (too) */
void ED_image_update_frame(const struct Main *mainp, int cfra); void ED_image_update_frame(const struct Main *mainp, int cfra);
/* image_render.c, export for screen_ops.c, render operator */
void ED_space_image_output(struct bContext *C);
#endif /* ED_IMAGE_H */ #endif /* ED_IMAGE_H */

View File

@@ -36,6 +36,7 @@
extern "C" { extern "C" {
#endif #endif
struct Main;
struct ListBase; struct ListBase;
struct ID; struct ID;
struct Scene; struct Scene;
@@ -190,7 +191,7 @@ KeyingSetInfo *ANIM_keyingset_info_find_named(const char name[]);
/* for RNA type registrations... */ /* for RNA type registrations... */
void ANIM_keyingset_info_register(KeyingSetInfo *ksi); void ANIM_keyingset_info_register(KeyingSetInfo *ksi);
void ANIM_keyingset_info_unregister(const struct bContext *C, KeyingSetInfo *ksi); void ANIM_keyingset_info_unregister(struct Main *bmain, KeyingSetInfo *ksi);
/* cleanup on exit */ /* cleanup on exit */
void ANIM_keyingset_infos_exit(void); void ANIM_keyingset_infos_exit(void);

View File

@@ -42,7 +42,7 @@ void ED_keymap_metaball(struct wmKeyConfig *keyconf);
struct MetaElem *add_metaball_primitive(struct bContext *C, float mat[4][4], int type, int newname); struct MetaElem *add_metaball_primitive(struct bContext *C, float mat[4][4], int type, int newname);
int mouse_mball(struct bContext *C, const short mval[2], int extend); int mouse_mball(struct bContext *C, const int mval[2], int extend);
void free_editMball(struct Object *obedit); void free_editMball(struct Object *obedit);
void make_editMball(struct Object *obedit); void make_editMball(struct Object *obedit);

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