Merged changes in the trunk up to revision 36757.
This commit is contained in:
@@ -175,6 +175,10 @@ if(UNIX AND NOT APPLE)
|
||||
endif()
|
||||
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
|
||||
option(WITH_CXX_GUARDEDALLOC "Enable GuardedAlloc for C++ memory allocation tracking (only enable for development)" OFF)
|
||||
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)
|
||||
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)
|
||||
message(FATAL_ERROR "WITH_PLAYER requires WITH_GAMEENGINE")
|
||||
endif()
|
||||
@@ -375,13 +376,6 @@ if(UNIX AND NOT APPLE)
|
||||
|
||||
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)
|
||||
set(FFMPEG /usr CACHE FILEPATH "FFMPEG Directory")
|
||||
mark_as_advanced(FFMPEG)
|
||||
@@ -424,6 +418,15 @@ if(UNIX AND NOT APPLE)
|
||||
set(EXPAT_LIB expat)
|
||||
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_path(X11_XF86keysym_INCLUDE_PATH X11/XF86keysym.h ${X11_INC_SEARCH_PATH})
|
||||
mark_as_advanced(X11_XF86keysym_INCLUDE_PATH)
|
||||
@@ -628,13 +631,6 @@ elseif(WIN32)
|
||||
set(PCRE_LIB pcre)
|
||||
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)
|
||||
set(FFMPEG ${LIBDIR}/ffmpeg)
|
||||
set(FFMPEG_INC ${FFMPEG}/include ${FFMPEG}/include/msvc)
|
||||
@@ -897,13 +893,6 @@ elseif(APPLE)
|
||||
set(OPENEXR_LIBPATH ${OPENEXR}/lib)
|
||||
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)
|
||||
set(FFMPEG ${LIBDIR}/ffmpeg)
|
||||
set(FFMPEG_INC ${FFMPEG}/include)
|
||||
|
@@ -74,6 +74,12 @@ WITH_BF_BULLET = True
|
||||
# Blender player (would be enabled in it's own config)
|
||||
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
|
||||
BF_DEBUG = False
|
||||
REL_CFLAGS = ['-O2']
|
||||
|
@@ -59,6 +59,12 @@ WITH_BF_BULLET = True
|
||||
WITH_BF_NOBLENDER = 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
|
||||
BF_DEBUG = False
|
||||
REL_CFLAGS = ['-O2']
|
||||
|
@@ -59,6 +59,12 @@ WITH_BF_BULLET = True
|
||||
WITH_BF_NOBLENDER = 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
|
||||
BF_DEBUG = False
|
||||
REL_CFLAGS = ['-O2']
|
||||
|
@@ -74,6 +74,12 @@ WITH_BF_BULLET = True
|
||||
# Blender player (would be enabled in it's own config)
|
||||
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
|
||||
BF_DEBUG = False
|
||||
REL_CFLAGS = ['-O2']
|
||||
|
0
build_files/cmake/cmake_consistency_check.py
Normal file → Executable file
0
build_files/cmake/cmake_consistency_check.py
Normal file → Executable file
230
build_files/cmake/cmake_netbeans_project.py
Executable file
230
build_files/cmake/cmake_netbeans_project.py
Executable 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
178
build_files/cmake/cmake_qtcreator_project.py
Normal file → Executable file
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# $Id:
|
||||
# $Id$
|
||||
# ***** BEGIN GPL LICENSE BLOCK *****
|
||||
#
|
||||
# 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
|
||||
"""
|
||||
|
||||
import sys
|
||||
from project_info import *
|
||||
|
||||
import os
|
||||
from os.path import join, dirname, normpath, abspath, splitext, relpath, exists
|
||||
|
||||
base = join(os.path.dirname(__file__), "..", "..")
|
||||
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=""/opt/blender25""/>
|
||||
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
|
||||
import sys
|
||||
|
||||
|
||||
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.sort()
|
||||
|
||||
@@ -260,7 +94,7 @@ def create_qtc_project_main():
|
||||
|
||||
|
||||
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.sort()
|
||||
|
||||
|
@@ -88,9 +88,6 @@ macro(SETUP_LIBDIRS)
|
||||
if(WITH_IMAGE_OPENJPEG AND UNIX AND NOT APPLE)
|
||||
link_directories(${OPENJPEG_LIBPATH})
|
||||
endif()
|
||||
if(WITH_LCMS)
|
||||
link_directories(${LCMS_LIBPATH})
|
||||
endif()
|
||||
if(WITH_CODEC_QUICKTIME)
|
||||
link_directories(${QUICKTIME_LIBPATH})
|
||||
endif()
|
||||
@@ -114,6 +111,9 @@ macro(SETUP_LIBDIRS)
|
||||
link_directories(${PCRE_LIBPATH})
|
||||
link_directories(${EXPAT_LIBPATH})
|
||||
endif()
|
||||
if(WITH_MEM_JEMALLOC)
|
||||
link_directories(${JEMALLOC_LIBPATH})
|
||||
endif()
|
||||
|
||||
if(WIN32 AND NOT UNIX)
|
||||
link_directories(${PTHREADS_LIBPATH})
|
||||
@@ -190,9 +190,6 @@ macro(setup_liblinks
|
||||
if(WITH_IMAGE_OPENJPEG AND UNIX AND NOT APPLE)
|
||||
target_link_libraries(${target} ${OPENJPEG_LIB})
|
||||
endif()
|
||||
if(WITH_LCMS)
|
||||
target_link_libraries(${target} ${LCMS_LIBRARY})
|
||||
endif()
|
||||
if(WITH_CODEC_FFMPEG)
|
||||
target_link_libraries(${target} ${FFMPEG_LIB})
|
||||
endif()
|
||||
@@ -214,11 +211,8 @@ macro(setup_liblinks
|
||||
target_link_libraries(${target} ${EXPAT_LIB})
|
||||
endif()
|
||||
endif()
|
||||
if(WITH_LCMS)
|
||||
if(WIN32 AND NOT UNIX)
|
||||
target_link_libraries(${target} debug ${LCMS_LIB}_d)
|
||||
target_link_libraries(${target} optimized ${LCMS_LIB})
|
||||
endif()
|
||||
if(WITH_MEM_JEMALLOC)
|
||||
target_link_libraries(${target} ${JEMALLOC_LIBRARY})
|
||||
endif()
|
||||
if(WIN32 AND NOT UNIX)
|
||||
target_link_libraries(${target} ${PTHREADS_LIB})
|
||||
|
@@ -38,7 +38,7 @@ if(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
include(build_files/cmake/RpmBuild.cmake)
|
||||
if(RPMBUILD_FOUND AND NOT WIN32)
|
||||
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_PACKAGE_DESCRIPTION_SUMMARY "${PROJECT_DESCRIPTION}")
|
||||
set(CPACK_PACKAGE_RELOCATABLE "false")
|
||||
|
218
build_files/cmake/project_info.py
Executable file
218
build_files/cmake/project_info.py
Executable 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=""/opt/blender25""/>
|
||||
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
|
@@ -5,7 +5,7 @@ BuildRoot: @CPACK_RPM_DIRECTORY@/@CPACK_PACKAGE_FILE_NAME@@CPACK_RPM_PACKAG
|
||||
Summary: @CPACK_RPM_PACKAGE_SUMMARY@
|
||||
Name: @CPACK_RPM_PACKAGE_NAME@
|
||||
Version: @CPACK_RPM_PACKAGE_VERSION@
|
||||
Release: @CPACK_RPM_PACKAGE_RELEASE@
|
||||
Release: @CPACK_RPM_PACKAGE_RELEASE@%{?dist}
|
||||
License: @CPACK_RPM_PACKAGE_LICENSE@
|
||||
Group: @CPACK_RPM_PACKAGE_GROUP@
|
||||
Vendor: @CPACK_RPM_PACKAGE_VENDOR@
|
||||
|
@@ -178,6 +178,14 @@ BF_EXPAT = '/usr'
|
||||
BF_EXPAT_LIB = 'expat'
|
||||
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
|
||||
|
||||
#Ray trace optimization
|
||||
|
@@ -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_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
|
||||
WITH_BF_RAYOPTIMIZATION = True
|
||||
BF_RAYOPTIMIZATION_SSE_FLAGS = ['/arch:SSE']
|
||||
|
@@ -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_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
|
||||
WITH_BF_RAYOPTIMIZATION = True
|
||||
BF_RAYOPTIMIZATION_SSE_FLAGS = ['/arch:SSE','/arch:SSE2']
|
||||
|
@@ -148,8 +148,6 @@ def setup_staticlibs(lenv):
|
||||
libincs += Split(lenv['BF_OPENEXR_LIBPATH'])
|
||||
if lenv['WITH_BF_STATICOPENEXR']:
|
||||
statlibs += Split(lenv['BF_OPENEXR_LIB_STATIC'])
|
||||
if lenv['WITH_BF_LCMS']:
|
||||
libincs += Split(lenv['BF_LCMS_LIBPATH'])
|
||||
if lenv['WITH_BF_TIFF']:
|
||||
libincs += Split(lenv['BF_TIFF_LIBPATH'])
|
||||
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'):
|
||||
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
|
||||
|
||||
def setup_syslibs(lenv):
|
||||
@@ -253,8 +256,6 @@ def setup_syslibs(lenv):
|
||||
syslibs += Split(lenv['BF_OPENGL_LIB'])
|
||||
if lenv['OURPLATFORM'] in ('win32-vc', 'win32-mingw','linuxcross', 'win64-vc'):
|
||||
syslibs += Split(lenv['BF_PTHREADS_LIB'])
|
||||
if lenv['WITH_BF_LCMS']:
|
||||
syslibs.append(lenv['BF_LCMS_LIB'])
|
||||
if lenv['WITH_BF_COLLADA']:
|
||||
syslibs.append(lenv['BF_PCRE_LIB'])
|
||||
syslibs += Split(lenv['BF_OPENCOLLADA_LIB'])
|
||||
@@ -263,6 +264,9 @@ def setup_syslibs(lenv):
|
||||
if not lenv['WITH_BF_STATICLIBSAMPLERATE']:
|
||||
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']
|
||||
|
||||
|
@@ -125,7 +125,6 @@ def validate_arguments(args, bc):
|
||||
'BF_FANCY', 'BF_QUIET', 'BF_LINE_OVERWRITE',
|
||||
'BF_X264_CONFIG',
|
||||
'BF_XVIDCORE_CONFIG',
|
||||
'WITH_BF_LCMS', 'BF_LCMS', 'BF_LCMS_INC', 'BF_LCMS_LIB', 'BF_LCMS_LIBPATH',
|
||||
'WITH_BF_DOCS',
|
||||
'BF_NUMJOBS',
|
||||
'BF_MSVS',
|
||||
@@ -134,7 +133,8 @@ def validate_arguments(args, bc):
|
||||
'WITH_BF_RAYOPTIMIZATION',
|
||||
'BF_RAYOPTIMIZATION_SSE_FLAGS',
|
||||
'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
|
||||
@@ -333,12 +333,6 @@ def read_opts(env, cfg, args):
|
||||
('BF_TIFF_LIBPATH', 'TIFF library path', ''),
|
||||
('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_STATICZLIB', 'Staticly link to ZLib', False)),
|
||||
('BF_ZLIB', 'ZLib base path', ''),
|
||||
@@ -429,6 +423,14 @@ def read_opts(env, cfg, args):
|
||||
('BF_EXPAT_LIB', 'Expat library', ''),
|
||||
('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_NOBLENDER', 'Do not build blender if true', False)),
|
||||
|
||||
|
@@ -145,10 +145,6 @@
|
||||
* merged in docs.
|
||||
*/
|
||||
|
||||
/** \defgroup blo readblenfile
|
||||
* \ingroup blender data
|
||||
*/
|
||||
|
||||
/** \defgroup quicktime quicktime
|
||||
* \ingroup blender
|
||||
|
||||
|
@@ -42,7 +42,7 @@
|
||||
#include <iostream>
|
||||
|
||||
#ifdef FREE_WINDOWS
|
||||
# define _WIN32_WINNT 0x0500 /* GetConsoleWindow() for MinGW */
|
||||
# define WINVER 0x0501 /* GetConsoleWindow() for MinGW */
|
||||
#endif
|
||||
|
||||
#include "GHOST_SystemWin32.h"
|
||||
@@ -1178,28 +1178,32 @@ GHOST_TUns8* GHOST_SystemWin32::getClipboard(bool selection) const
|
||||
char *temp_buff;
|
||||
|
||||
if ( IsClipboardFormatAvailable(CF_TEXT) && OpenClipboard(NULL) ) {
|
||||
size_t len = 0;
|
||||
HANDLE hData = GetClipboardData( CF_TEXT );
|
||||
if (hData == NULL) {
|
||||
CloseClipboard();
|
||||
return NULL;
|
||||
}
|
||||
buffer = (char*)GlobalLock( hData );
|
||||
if (!buffer) {
|
||||
CloseClipboard();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
temp_buff = (char*) malloc(strlen(buffer)+1);
|
||||
strcpy(temp_buff, buffer);
|
||||
len = strlen(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 );
|
||||
CloseClipboard();
|
||||
|
||||
temp_buff[strlen(buffer)] = '\0';
|
||||
if (buffer) {
|
||||
return (GHOST_TUns8*)temp_buff;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void GHOST_SystemWin32::putClipboard(GHOST_TInt8 *buffer, bool selection) const
|
||||
|
@@ -52,6 +52,9 @@
|
||||
#ifndef RID_INPUT
|
||||
#define RID_INPUT 0x10000003
|
||||
#endif
|
||||
#ifndef RIM_INPUTSINK
|
||||
#define RIM_INPUTSINK 0x1
|
||||
#endif
|
||||
#ifndef RI_KEY_BREAK
|
||||
#define RI_KEY_BREAK 0x1
|
||||
#endif
|
||||
@@ -127,8 +130,6 @@ DECLARE_HANDLE(HRAWINPUT);
|
||||
#ifdef FREE_WINDOWS
|
||||
#define NEED_RAW_PROC
|
||||
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);
|
||||
#define GetRawInputData(hRawInput, uiCommand, pData, pcbSize, cbSizeHeader) ((pGetRawInputData)?pGetRawInputData(hRawInput, uiCommand, pData, pcbSize, cbSizeHeader):(UINT)-1)
|
||||
|
@@ -700,11 +700,15 @@ GHOST_SystemX11::processEvent(XEvent *xe)
|
||||
case EnterNotify:
|
||||
case LeaveNotify:
|
||||
{
|
||||
// XCrossingEvents pointer leave enter window.
|
||||
// also do cursor move here, MotionNotify only
|
||||
// happens when motion starts & ends inside window
|
||||
/* XCrossingEvents pointer leave enter window.
|
||||
also do cursor move here, MotionNotify only
|
||||
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;
|
||||
|
||||
if( xce.mode == NotifyNormal ) {
|
||||
g_event = new
|
||||
GHOST_EventCursor(
|
||||
getMilliSeconds(),
|
||||
@@ -713,6 +717,7 @@ GHOST_SystemX11::processEvent(XEvent *xe)
|
||||
xce.x_root,
|
||||
xce.y_root
|
||||
);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MapNotify:
|
||||
|
@@ -370,7 +370,7 @@ MT_Vector3 IK_QSphericalSegment::Axis(int dof) const
|
||||
|
||||
void IK_QSphericalSegment::SetLimit(int axis, MT_Scalar lmin, MT_Scalar lmax)
|
||||
{
|
||||
if (lmin >= lmax)
|
||||
if (lmin > lmax)
|
||||
return;
|
||||
|
||||
if (axis == 1) {
|
||||
@@ -613,7 +613,7 @@ void IK_QRevoluteSegment::UpdateAngleApply()
|
||||
|
||||
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;
|
||||
|
||||
// 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)
|
||||
{
|
||||
if (lmin >= lmax)
|
||||
if (lmin > lmax)
|
||||
return;
|
||||
|
||||
// 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)
|
||||
{
|
||||
if (lmin >= lmax)
|
||||
if (lmin > lmax)
|
||||
return;
|
||||
|
||||
// clamp and convert to axis angle parameters
|
||||
|
31
release/scripts/modules/bpy_extras/__init__.py
Normal file
31
release/scripts/modules/bpy_extras/__init__.py
Normal 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",
|
||||
)
|
121
release/scripts/modules/bpy_extras/view3d_utils.py
Normal file
121
release/scripts/modules/bpy_extras/view3d_utils.py
Normal 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
|
@@ -132,7 +132,7 @@ class AddTorus(bpy.types.Operator):
|
||||
mesh.faces.foreach_set("vertices_raw", faces)
|
||||
mesh.update()
|
||||
|
||||
import add_object_utils
|
||||
add_object_utils.object_data_add(context, mesh, operator=self)
|
||||
from bpy_extras import object_utils
|
||||
object_utils.object_data_add(context, mesh, operator=self)
|
||||
|
||||
return {'FINISHED'}
|
||||
|
@@ -102,7 +102,8 @@ def register():
|
||||
('Render', "Render", ""),
|
||||
('Rigging', "Rigging", ""),
|
||||
('Text Editor', "Text Editor", ""),
|
||||
('System', "System", "")
|
||||
('System', "System", ""),
|
||||
('Other', "Other", ""),
|
||||
],
|
||||
name="Category",
|
||||
description="Filter add-ons by category",
|
||||
|
@@ -127,6 +127,7 @@ class DATA_PT_camera_display(CameraButtonsPanel, bpy.types.Panel):
|
||||
col.prop(cam, "show_mist", text="Mist")
|
||||
col.prop(cam, "show_title_safe", text="Title Safe")
|
||||
col.prop(cam, "show_name", text="Name")
|
||||
col.prop_menu_enum(cam, "show_guide")
|
||||
|
||||
col = split.column()
|
||||
col.prop(cam, "draw_size", text="Size")
|
||||
|
@@ -39,6 +39,17 @@ class DATA_PT_empty(DataButtonsPanel, bpy.types.Panel):
|
||||
ob = context.object
|
||||
|
||||
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")
|
||||
|
||||
if __name__ == "__main__": # only for live edit.
|
||||
|
@@ -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.join_shapes", icon='COPY_ID') # icon is not ideal
|
||||
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():
|
||||
@@ -193,7 +195,8 @@ class DATA_PT_shape_keys(MeshButtonsPanel, bpy.types.Panel):
|
||||
col = row.column()
|
||||
|
||||
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.menu("MESH_MT_shape_key_specials", icon='DOWNARROW_HLT', text="")
|
||||
|
||||
|
@@ -219,7 +219,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, bpy.types.Panel):
|
||||
col.label(text="Texture Coordinates:")
|
||||
col.prop(md, "texture_coords", text="")
|
||||
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':
|
||||
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="")
|
||||
|
||||
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':
|
||||
layout.prop_search(md, "uv_layer", ob.data, "uv_textures")
|
||||
|
||||
|
@@ -436,7 +436,8 @@ class IMAGE_PT_game_properties(bpy.types.Panel):
|
||||
def poll(cls, context):
|
||||
rd = context.scene.render
|
||||
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):
|
||||
layout = self.layout
|
||||
|
@@ -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="Speed Control").type = 'SPEED'
|
||||
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):
|
||||
@@ -391,7 +392,7 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel, bpy.types.Panel):
|
||||
'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP',
|
||||
'PLUGIN',
|
||||
'WIPE', 'GLOW', 'TRANSFORM', 'COLOR', 'SPEED',
|
||||
'MULTICAM'}
|
||||
'MULTICAM', 'ADJUSTMENT'}
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
@@ -530,7 +531,7 @@ class SEQUENCER_PT_input(SequencerButtonsPanel, bpy.types.Panel):
|
||||
'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP',
|
||||
'PLUGIN',
|
||||
'WIPE', 'GLOW', 'TRANSFORM', 'COLOR',
|
||||
'MULTICAM', 'SPEED'}
|
||||
'MULTICAM', 'SPEED', 'ADJUSTMENT'}
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
@@ -680,7 +681,7 @@ class SEQUENCER_PT_filter(SequencerButtonsPanel, bpy.types.Panel):
|
||||
'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP',
|
||||
'PLUGIN',
|
||||
'WIPE', 'GLOW', 'TRANSFORM', 'COLOR',
|
||||
'MULTICAM', 'SPEED'}
|
||||
'MULTICAM', 'SPEED', 'ADJUSTMENT'}
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
@@ -2024,6 +2024,9 @@ class VIEW3D_PT_view3d_properties(bpy.types.Panel):
|
||||
elif not view.lock_object:
|
||||
col.prop(view, "lock_cursor", text="Lock to Cursor")
|
||||
|
||||
col = layout.column()
|
||||
col.prop(view, "lock_camera")
|
||||
|
||||
col = layout.column(align=True)
|
||||
col.label(text="Clip:")
|
||||
col.prop(view, "clip_start", text="Start")
|
||||
|
@@ -12,7 +12,7 @@ def write_some_data(context, filepath, use_some_setting):
|
||||
|
||||
# ExportHelper is a helper class, defines filename and
|
||||
# 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
|
||||
|
||||
|
||||
|
@@ -80,8 +80,8 @@ class AddBox(bpy.types.Operator):
|
||||
mesh.update()
|
||||
|
||||
# add the mesh as an object into the scene with this utility module
|
||||
import add_object_utils
|
||||
add_object_utils.object_data_add(context, mesh, operator=self)
|
||||
from bpy_extras import object_utils
|
||||
object_utils.object_data_add(context, mesh, operator=self)
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
@@ -91,7 +91,6 @@ add_subdirectory(blenlib)
|
||||
add_subdirectory(render)
|
||||
add_subdirectory(blenfont)
|
||||
add_subdirectory(blenloader)
|
||||
add_subdirectory(readblenfile)
|
||||
add_subdirectory(blenpluginapi)
|
||||
add_subdirectory(ikplugin)
|
||||
add_subdirectory(gpu)
|
||||
@@ -126,4 +125,3 @@ endif()
|
||||
if(WITH_OPENCOLLADA)
|
||||
add_subdirectory(collada)
|
||||
endif()
|
||||
|
||||
|
@@ -13,7 +13,6 @@ SConscript(['avi/SConscript',
|
||||
'imbuf/SConscript',
|
||||
'makesdna/SConscript',
|
||||
'makesrna/SConscript',
|
||||
'readblenfile/SConscript',
|
||||
'render/SConscript',
|
||||
'nodes/SConscript',
|
||||
'modifiers/SConscript',
|
||||
|
@@ -51,6 +51,7 @@
|
||||
|
||||
#include "BLF_api.h"
|
||||
#include "blf_internal_types.h"
|
||||
#include "blf_internal.h"
|
||||
|
||||
static ListBase global_font_dir= { NULL, NULL };
|
||||
|
||||
@@ -150,6 +151,7 @@ char *blf_dir_search(const char *file)
|
||||
return(s);
|
||||
}
|
||||
|
||||
#if 0 // UNUSED
|
||||
int blf_dir_split(const char *str, char *file, int *size)
|
||||
{
|
||||
int i, len;
|
||||
@@ -173,6 +175,7 @@ int blf_dir_split(const char *str, char *file, int *size)
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Some font have additional file with metrics information,
|
||||
* in general, the extension of the file is: .afm or .pfm
|
||||
|
@@ -44,7 +44,7 @@ int blf_utf8_next(unsigned char *buf, int *iindex);
|
||||
|
||||
char *blf_dir_search(const char *file);
|
||||
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);
|
||||
void blf_font_exit(void);
|
||||
|
@@ -90,8 +90,7 @@ void brush_painter_free(BrushPainter *painter);
|
||||
unsigned int *brush_gen_texture_cache(struct Brush *br, int half_side);
|
||||
|
||||
/* radial control */
|
||||
void brush_radial_control_invoke(struct wmOperator *op, struct Brush *br, float size_weight);
|
||||
int brush_radial_control_exec(struct wmOperator *op, struct Brush *br, float size_weight);
|
||||
struct ImBuf *brush_gen_radial_control_imbuf(struct Brush *br);
|
||||
|
||||
/* unified strength and size */
|
||||
|
||||
|
@@ -78,7 +78,6 @@ void curvemapping_premultiply(struct CurveMapping *cumap, int restore);
|
||||
int curvemapping_RGBA_does_something(struct CurveMapping *cumap);
|
||||
void curvemapping_initialize(struct CurveMapping *cumap);
|
||||
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_free(struct Scopes *scopes);
|
||||
|
@@ -52,6 +52,7 @@ struct Icon
|
||||
typedef struct Icon Icon;
|
||||
|
||||
struct PreviewImage;
|
||||
struct ID;
|
||||
|
||||
void BKE_icons_init(int first_dyn_id);
|
||||
|
||||
@@ -74,11 +75,14 @@ void BKE_icon_changed(int icon_id);
|
||||
/* free all icons */
|
||||
void BKE_icons_free(void);
|
||||
|
||||
/* free the preview image for use in list */
|
||||
void BKE_previewimg_freefunc(void *link);
|
||||
|
||||
/* free the preview image */
|
||||
void BKE_previewimg_free(struct PreviewImage **prv);
|
||||
|
||||
/* 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 */
|
||||
struct PreviewImage* BKE_previewimg_create(void) ;
|
||||
@@ -87,6 +91,6 @@ struct PreviewImage* BKE_previewimg_create(void) ;
|
||||
struct PreviewImage* BKE_previewimg_copy(struct PreviewImage *prv);
|
||||
|
||||
/* 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 */
|
||||
|
@@ -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);
|
||||
struct Sequence *seq_foreground_frame_get(struct Scene *scene, int frame);
|
||||
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_dupe_animdata(struct Scene *scene, char *name_from, char *name_to);
|
||||
int shuffle_seq(struct ListBase * seqbasep, struct Sequence *test, struct Scene *evil_scene);
|
||||
|
@@ -73,8 +73,8 @@ typedef struct SK_Overdraw
|
||||
|
||||
typedef struct SK_DrawData
|
||||
{
|
||||
short mval[2];
|
||||
short previous_mval[2];
|
||||
int mval[2];
|
||||
int previous_mval[2];
|
||||
SK_PType type;
|
||||
} SK_DrawData;
|
||||
|
||||
@@ -152,7 +152,7 @@ void sk_endContinuousStroke(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_selectAllSketch(SK_Sketch *sketch, int mode);
|
||||
|
@@ -279,11 +279,6 @@ if(WITH_CODEC_FFMPEG)
|
||||
add_definitions(-DWITH_FFMPEG)
|
||||
endif()
|
||||
|
||||
if(WITH_LCMS)
|
||||
list(APPEND INC ${LCMS_INCLUDE_DIR})
|
||||
add_definitions(-DWITH_LCMS)
|
||||
endif()
|
||||
|
||||
if(WITH_PYTHON)
|
||||
list(APPEND INC ../python ${PYTHON_INCLUDE_DIRS})
|
||||
add_definitions(-DWITH_PYTHON)
|
||||
|
@@ -78,10 +78,6 @@ if env['OURPLATFORM'] == 'darwin':
|
||||
if env['BF_NO_ELBEEM']:
|
||||
defs.append('DISABLE_ELBEEM')
|
||||
|
||||
if env['WITH_BF_LCMS']:
|
||||
defs.append('WITH_LCMS')
|
||||
incs += ' ' + env['BF_LCMS_INC']
|
||||
|
||||
if env['WITH_BF_LZO']:
|
||||
incs += ' #/extern/lzo/minilzo'
|
||||
defs.append('WITH_LZO')
|
||||
|
@@ -831,8 +831,11 @@ void pose_remove_group (Object *ob)
|
||||
|
||||
/* now, remove it from the pose */
|
||||
BLI_freelinkN(&pose->agroups, grp);
|
||||
pose->active_group--;
|
||||
if(pose->active_group < 0 || pose->agroups.first == NULL) {
|
||||
pose->active_group= 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ************** F-Curve Utilities for Actions ****************** */
|
||||
|
@@ -191,7 +191,7 @@ static void clean_paths(Main *main)
|
||||
/* note, this is called on Undo so any slow conversion functions here
|
||||
* 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;
|
||||
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) {
|
||||
/* 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 */
|
||||
filename= bfd->filename;
|
||||
filepath= bfd->filename;
|
||||
}
|
||||
#if 0
|
||||
else if (!G.relbase_valid) {
|
||||
/* otherwise, use an empty string as filename, rather than <memory2> */
|
||||
filename="";
|
||||
filepath="";
|
||||
}
|
||||
#endif
|
||||
|
||||
/* these are the same at times, should never copy to the same location */
|
||||
if(G.main->name != filename)
|
||||
BLI_strncpy(G.main->name, filename, FILE_MAX);
|
||||
if(G.main->name != filepath)
|
||||
BLI_strncpy(G.main->name, filepath, FILE_MAX);
|
||||
|
||||
/* baseflags, groups, make depsgraph, etc */
|
||||
set_scene_bg(G.main, CTX_data_scene(C));
|
||||
@@ -353,15 +353,15 @@ void BKE_userdef_free(void)
|
||||
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;
|
||||
int retval= BKE_READ_FILE_OK;
|
||||
|
||||
if(strstr(dir, BLENDER_STARTUP_FILE)==NULL) /* dont print user-pref loading */
|
||||
printf("read blend: %s\n", dir);
|
||||
if(strstr(filepath, BLENDER_STARTUP_FILE)==NULL) /* dont print user-pref loading */
|
||||
printf("read blend: %s\n", filepath);
|
||||
|
||||
bfd= BLO_read_from_file(dir, reports);
|
||||
bfd= BLO_read_from_file(filepath, reports);
|
||||
if (bfd) {
|
||||
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;
|
||||
}
|
||||
else
|
||||
setup_app_data(C, bfd, dir); // frees BFD
|
||||
setup_app_data(C, bfd, filepath); // frees BFD
|
||||
}
|
||||
else
|
||||
BKE_reports_prependf(reports, "Loading %s failed: ", dir);
|
||||
BKE_reports_prependf(reports, "Loading %s failed: ", filepath);
|
||||
|
||||
return (bfd?retval:BKE_READ_FILE_FAIL);
|
||||
}
|
||||
@@ -521,19 +521,19 @@ void BKE_write_undo(bContext *C, const char *name)
|
||||
/* disk save version */
|
||||
if(UNDO_DISK) {
|
||||
static int counter= 0;
|
||||
char tstr[FILE_MAXDIR+FILE_MAXFILE];
|
||||
char filepath[FILE_MAXDIR+FILE_MAXFILE];
|
||||
char numstr[32];
|
||||
|
||||
/* calculate current filename */
|
||||
/* calculate current filepath */
|
||||
counter++;
|
||||
counter= counter % U.undosteps;
|
||||
|
||||
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 {
|
||||
MemFile *prevfile=NULL;
|
||||
|
@@ -426,13 +426,6 @@ void brush_curve_preset(Brush *b, /*CurveMappingPreset*/int preset)
|
||||
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)
|
||||
{
|
||||
ID *idtest, *id=NULL;
|
||||
@@ -1185,7 +1178,7 @@ unsigned int *brush_gen_texture_cache(Brush *br, int half_side)
|
||||
}
|
||||
|
||||
/**** 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");
|
||||
unsigned int *texcache;
|
||||
@@ -1219,50 +1212,6 @@ static struct ImBuf *brush_gen_radial_control_imbuf(Brush *br)
|
||||
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 */
|
||||
|
||||
static void set_unified_settings(Brush *brush, short flag, int value)
|
||||
|
@@ -37,10 +37,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <float.h>
|
||||
|
||||
#ifdef WITH_LCMS
|
||||
#include <lcms.h>
|
||||
#endif
|
||||
|
||||
#include "MEM_guardedalloc.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 */
|
||||
void curvemapping_do_ibuf(CurveMapping *cumap, ImBuf *ibuf)
|
||||
{
|
||||
|
@@ -72,6 +72,8 @@
|
||||
|
||||
#include "ED_curve.h" /* for BKE_curve_nurbs */
|
||||
|
||||
extern Material defmaterial; /* material.c */
|
||||
|
||||
static void boundbox_displist(Object *ob);
|
||||
|
||||
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++) {
|
||||
extern Material defmaterial; /* material.c */
|
||||
MFace *mf= &mface[i];
|
||||
Material *ma= give_current_material(ob, mf->mat_nr+1);
|
||||
int j, vidx[4], nverts= mf->v4?4:3;
|
||||
@@ -664,8 +665,6 @@ void shadeDispList(Scene *scene, Base *base)
|
||||
dl= ob->disp.first;
|
||||
|
||||
while(dl) {
|
||||
extern Material defmaterial; /* material.c */
|
||||
|
||||
dlob= MEM_callocN(sizeof(DispList), "displistshade");
|
||||
BLI_addtail(&ob->disp, dlob);
|
||||
dlob->type= DL_VERTCOL;
|
||||
@@ -734,8 +733,6 @@ void shadeDispList(Scene *scene, Base *base)
|
||||
|
||||
if(dl->type==DL_INDEX4) {
|
||||
if(dl->nors) {
|
||||
extern Material defmaterial; /* material.c */
|
||||
|
||||
if(dl->col1) MEM_freeN(dl->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;
|
||||
}
|
||||
|
||||
if(totvert && 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(totvert && (tot= BLI_edgefill(0))) { // XXX (obedit && obedit->actcol)?(obedit->actcol-1):0)) {
|
||||
if(tot) {
|
||||
dlnew= MEM_callocN(sizeof(DispList), "filldisplist");
|
||||
dlnew->type= DL_INDEX3;
|
||||
@@ -1973,8 +1961,9 @@ static void boundbox_displist(Object *ob)
|
||||
}
|
||||
|
||||
if(!doit) {
|
||||
min[0] = min[1] = min[2] = -1.0f;
|
||||
max[0] = max[1] = max[2] = 1.0f;
|
||||
/* there's no geometry in displist, use zero-sized boundbox */
|
||||
zero_v3(min);
|
||||
zero_v3(max);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -125,25 +125,33 @@ struct PreviewImage* BKE_previewimg_create(void)
|
||||
|
||||
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_timestamp[i] = 0;
|
||||
}
|
||||
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)
|
||||
{
|
||||
if(prv && (*prv)) {
|
||||
int i;
|
||||
|
||||
for (i=0; i<PREVIEW_MIPMAPS;++i) {
|
||||
if ((*prv)->rect[i]) {
|
||||
MEM_freeN((*prv)->rect[i]);
|
||||
(*prv)->rect[i] = NULL;
|
||||
}
|
||||
}
|
||||
MEM_freeN((*prv));
|
||||
BKE_previewimg_freefunc(*prv);
|
||||
*prv = NULL;
|
||||
}
|
||||
}
|
||||
@@ -155,7 +163,7 @@ struct PreviewImage* BKE_previewimg_copy(PreviewImage *prv)
|
||||
|
||||
if (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]) {
|
||||
prv_img->rect[i] = MEM_dupallocN(prv->rect[i]);
|
||||
} else {
|
||||
@@ -237,7 +245,7 @@ void BKE_icon_changed(int id)
|
||||
/* all previews changed */
|
||||
if (prv) {
|
||||
int i;
|
||||
for (i=0; i<PREVIEW_MIPMAPS; ++i) {
|
||||
for (i=0; i<NUM_ICON_SIZES; ++i) {
|
||||
prv->changed[i] = 1;
|
||||
prv->changed_timestamp[i]++;
|
||||
}
|
||||
|
@@ -1680,21 +1680,20 @@ void object_rot_to_mat3(Object *ob, float mat[][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
|
||||
*/
|
||||
unit_m3(dmat);
|
||||
|
||||
/* rotations may either be quats, eulers (with various rotation orders), or axis-angle */
|
||||
if (ob->rotmode > 0) {
|
||||
/* 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( dmat,ob->drot, ob->rotmode);
|
||||
eulO_to_mat3(rmat, ob->rot, ob->rotmode);
|
||||
eulO_to_mat3(dmat, ob->drot, ob->rotmode);
|
||||
}
|
||||
else if (ob->rotmode == ROT_MODE_AXISANGLE) {
|
||||
/* axis-angle - not really that great for 3D-changing orientations */
|
||||
axis_angle_to_mat3( rmat,ob->rotAxis, ob->rotAngle);
|
||||
axis_angle_to_mat3( dmat,ob->drotAxis, ob->drotAngle);
|
||||
axis_angle_to_mat3(rmat, ob->rotAxis, ob->rotAngle);
|
||||
axis_angle_to_mat3(dmat, ob->drotAxis, ob->drotAngle);
|
||||
}
|
||||
else {
|
||||
/* 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;
|
||||
break;
|
||||
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);
|
||||
sub_v3_v3(ob->rot, ob->drot);
|
||||
{
|
||||
float quat[4];
|
||||
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) {
|
||||
MVert *mvert= dm->getVertArray(dm);
|
||||
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) */
|
||||
count= 0;
|
||||
for(i = 0; i < numVerts; i++) {
|
||||
vindex= (index)? index[i]: i;
|
||||
|
||||
|
@@ -1250,7 +1250,7 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
|
||||
double step, pos;
|
||||
|
||||
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;
|
||||
|
||||
for(p=0; p<totpart; p++, pos+=step) {
|
||||
|
@@ -2858,6 +2858,83 @@ static struct ImBuf * do_multicam(
|
||||
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
|
||||
********************************************************************** */
|
||||
@@ -3256,6 +3333,11 @@ static struct SeqEffectHandle get_sequence_effect_impl(int seq_type)
|
||||
rval.early_out = early_out_multicam;
|
||||
rval.execute = do_multicam;
|
||||
break;
|
||||
case SEQ_ADJUSTMENT:
|
||||
rval.num_inputs = num_inputs_adjustment;
|
||||
rval.early_out = early_out_adjustment;
|
||||
rval.execute = do_adjustment;
|
||||
break;
|
||||
}
|
||||
|
||||
return rval;
|
||||
|
@@ -79,9 +79,15 @@
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
|
||||
/* **** XXX ******** */
|
||||
//static void waitcursor(int val) {}
|
||||
//static int blender_test_break() {return 0;}
|
||||
|
||||
static ImBuf* seq_render_strip_stack(
|
||||
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 ******** */
|
||||
#define SELECT 1
|
||||
@@ -177,8 +183,6 @@ void seq_free_strip(Strip *strip)
|
||||
MEM_freeN(strip);
|
||||
}
|
||||
|
||||
static void seq_free_animdata(Scene *scene, Sequence *seq);
|
||||
|
||||
void seq_free_sequence(Scene *scene, Sequence *seq)
|
||||
{
|
||||
if(seq->strip) seq_free_strip(seq->strip);
|
||||
@@ -191,6 +195,10 @@ void seq_free_sequence(Scene *scene, Sequence *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 */
|
||||
if(scene) {
|
||||
Editing *ed = scene->ed;
|
||||
@@ -446,51 +454,6 @@ void seq_end(SeqIterator *iter)
|
||||
* 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,
|
||||
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_COLOR: return "Color";
|
||||
case SEQ_MULTICAM: return "Multicam";
|
||||
case SEQ_ADJUSTMENT: return "Adjustment";
|
||||
case SEQ_SPEED: return "Speed";
|
||||
default:
|
||||
return NULL;
|
||||
@@ -1013,16 +977,22 @@ static float give_stripelem_index(Sequence *seq, float cfra)
|
||||
int sta = seq->start;
|
||||
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) {
|
||||
/*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 nr= end - cfra;
|
||||
} else {
|
||||
if(cfra <= sta) nr= 0;
|
||||
else if(cfra >= end) nr= seq->len-1;
|
||||
else if(cfra >= end) nr= end - sta;
|
||||
else nr= cfra - sta;
|
||||
}
|
||||
|
||||
@@ -1039,7 +1009,11 @@ StripElem *give_stripelem(Sequence *seq, int cfra)
|
||||
{
|
||||
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);
|
||||
|
||||
if (nr == -1 || se == NULL) return NULL;
|
||||
@@ -1093,18 +1067,15 @@ static int get_shown_sequences( ListBase * seqbasep, int cfra, int chanshown, Se
|
||||
}
|
||||
|
||||
if(evaluate_seq_frame_gen(seq_arr, seqbasep, cfra)) {
|
||||
if (b > 0) {
|
||||
if (seq_arr[b] == NULL) {
|
||||
return 0;
|
||||
if (b == 0) {
|
||||
b = MAXSEQ;
|
||||
}
|
||||
} else {
|
||||
for (b = MAXSEQ; b > 0; b--) {
|
||||
for (; b > 0; b--) {
|
||||
if (video_seq_is_rendered(seq_arr[b])) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
chanshown = b;
|
||||
|
||||
@@ -2072,7 +2043,8 @@ static ImBuf * seq_render_strip(SeqRenderData context, Sequence * seq, float cfr
|
||||
}
|
||||
case SEQ_EFFECT:
|
||||
{
|
||||
ibuf = seq_render_effect_strip_impl(context, seq, cfra);
|
||||
ibuf = seq_render_effect_strip_impl(
|
||||
context, seq, seq->start + nr);
|
||||
break;
|
||||
}
|
||||
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) */
|
||||
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 */
|
||||
@@ -3214,6 +3189,24 @@ ListBase *seq_seqbase(ListBase *seqbase, Sequence *seq)
|
||||
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)
|
||||
{
|
||||
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->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);
|
||||
|
||||
@@ -3572,7 +3566,8 @@ Sequence *sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo
|
||||
strip->len = seq->len = IMB_anim_get_duration( an );
|
||||
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);
|
||||
|
||||
|
@@ -543,7 +543,7 @@ int sk_stroke_filtermval(SK_DrawData *dd)
|
||||
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[1] = mval[1];
|
||||
|
@@ -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
|
||||
|
||||
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]);
|
||||
|
||||
/* Returns the number of point of interests
|
||||
|
@@ -53,7 +53,7 @@ extern "C" {
|
||||
/* scanfill.c: used in displist only... */
|
||||
struct EditVert *BLI_addfillvert(float *vec);
|
||||
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);
|
||||
|
||||
/* These callbacks are needed to make the lib finction properly */
|
||||
|
@@ -764,6 +764,11 @@ void makeFilesRelative(Main *bmain, const char *basedir, ReportList *reports) {
|
||||
/* be sure there is low chance of the path being too short */
|
||||
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);
|
||||
while (!BLI_bpathIterator_isDone(bpi)) {
|
||||
BLI_bpathIterator_getPath(bpi, filepath);
|
||||
@@ -815,6 +820,11 @@ void makeFilesAbsolute(Main *bmain, const char *basedir, ReportList *reports)
|
||||
/* be sure there is low chance of the path being too short */
|
||||
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);
|
||||
while (!BLI_bpathIterator_isDone(bpi)) {
|
||||
BLI_bpathIterator_getPath(bpi, filepath);
|
||||
|
@@ -239,7 +239,7 @@ float dist_to_line_segment_v3(const float v1[3], const float v2[3], const float
|
||||
/******************************* Intersection ********************************/
|
||||
|
||||
/* 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;
|
||||
|
||||
|
@@ -58,6 +58,8 @@ typedef unsigned long long r_uint64;
|
||||
|
||||
#define LOWSEED 0x330E
|
||||
|
||||
extern unsigned char hash[]; // noise.c
|
||||
|
||||
/***/
|
||||
|
||||
struct RNG {
|
||||
@@ -83,8 +85,6 @@ void rng_seed(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]);
|
||||
seed= rng_getInt(rng);
|
||||
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)
|
||||
{
|
||||
extern unsigned char hash[]; // noise.c
|
||||
|
||||
if(thread >= BLENDER_MAX_THREADS)
|
||||
thread= 0;
|
||||
|
||||
|
@@ -85,7 +85,6 @@ typedef struct PolyFill {
|
||||
typedef struct ScFillVert {
|
||||
EditVert *v1;
|
||||
EditEdge *first,*last;
|
||||
short f,f1;
|
||||
} ScFillVert;
|
||||
|
||||
|
||||
@@ -95,9 +94,9 @@ typedef struct ScFillVert {
|
||||
|
||||
static ScFillVert *scdata;
|
||||
|
||||
ListBase fillvertbase = {0,0};
|
||||
ListBase filledgebase = {0,0};
|
||||
ListBase fillfacebase = {0,0};
|
||||
ListBase fillvertbase = {NULL, NULL};
|
||||
ListBase filledgebase = {NULL, NULL};
|
||||
ListBase fillfacebase = {NULL, NULL};
|
||||
|
||||
static short cox, coy;
|
||||
|
||||
@@ -219,7 +218,7 @@ EditEdge *BLI_addfilledge(EditVert *v1, EditVert *v2)
|
||||
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 */
|
||||
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;
|
||||
EditVert *eve,*v1,*v2,*v3;
|
||||
@@ -748,11 +747,13 @@ static void scanfill(PolyFill *pf, int mat_nr)
|
||||
}
|
||||
|
||||
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!)
|
||||
@@ -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
|
||||
- edge flag ->f becomes 2 when it's a new edge
|
||||
- mode: & 1 is check for crossings, then create edges (TO DO )
|
||||
- returns number of triangle faces added.
|
||||
*/
|
||||
ListBase tempve, temped;
|
||||
EditVert *eve;
|
||||
@@ -767,6 +769,7 @@ int BLI_edgefill(int mat_nr)
|
||||
PolyFill *pflist,*pf;
|
||||
float *minp, *maxp, *v1, *v2, norm[3], len;
|
||||
short a,c,poly=0,ok=0,toggle=0;
|
||||
int totfaces= 0; /* total faces added */
|
||||
|
||||
/* reset variables */
|
||||
eve= fillvertbase.first;
|
||||
@@ -1030,7 +1033,7 @@ int BLI_edgefill(int mat_nr)
|
||||
for(a=0;a<poly;a++) {
|
||||
if(pf->edges>1) {
|
||||
splitlist(&tempve,&temped,pf->nr);
|
||||
scanfill(pf, mat_nr);
|
||||
totfaces += scanfill(pf, mat_nr);
|
||||
}
|
||||
pf++;
|
||||
}
|
||||
@@ -1040,6 +1043,6 @@ int BLI_edgefill(int mat_nr)
|
||||
/* FREE */
|
||||
|
||||
MEM_freeN(pflist);
|
||||
return 1;
|
||||
|
||||
return totfaces;
|
||||
}
|
||||
|
@@ -49,6 +49,8 @@ struct SpaceFile;
|
||||
struct SpaceImaSel;
|
||||
struct UserDef;
|
||||
struct bContext;
|
||||
struct BHead;
|
||||
struct FileData;
|
||||
|
||||
typedef struct BlendHandle BlendHandle;
|
||||
|
||||
@@ -79,12 +81,12 @@ typedef struct BlendFileData {
|
||||
* returns NULL and sets a report in the list if
|
||||
* 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
|
||||
* indicating the cause of the failure.
|
||||
* @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
|
||||
@@ -209,7 +211,7 @@ int BLO_has_bfile_extension(char *str);
|
||||
*/
|
||||
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.
|
||||
@@ -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 mainl The main database to link from (not the active one).
|
||||
* @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 flag Options for linking, used for instancing.
|
||||
* @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_read_struct(struct FileData *fd, struct BHead *bh, const char *blockname);
|
||||
|
||||
/* deprecated */
|
||||
#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);
|
||||
|
@@ -25,27 +25,29 @@
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** 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
|
||||
streamGlueWrite(
|
||||
struct streamGlueControlStruct *streamGlueControl,
|
||||
struct streamGlueStruct **streamGlue,
|
||||
unsigned char *data,
|
||||
unsigned int dataIn,
|
||||
int finishUp)
|
||||
{
|
||||
printf("called with %d bytes in buffer [%s]\n", dataIn, data);
|
||||
return (0);
|
||||
/** \file BLO_runtime.h
|
||||
* \ingroup blenloader
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct BlendFileData;
|
||||
struct ReportList;
|
||||
|
||||
int BLO_is_a_runtime(char *file);
|
||||
struct BlendFileData *BLO_read_runtime(char *file, struct ReportList *reports);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
main()
|
||||
{
|
||||
int err;
|
||||
#endif /* BLO_RUNTIME_H */
|
||||
|
||||
err = BLO_readblenfile();
|
||||
}
|
@@ -39,7 +39,7 @@ struct MemFile;
|
||||
struct Main;
|
||||
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_runtime(struct Main *mainvar, const char *file, char *exename, struct ReportList *reports);
|
||||
|
||||
|
@@ -29,7 +29,6 @@ set(INC
|
||||
../blenlib
|
||||
../blenkernel
|
||||
../makesdna
|
||||
../readblenfile
|
||||
../makesrna
|
||||
../render/extern/include
|
||||
../../../intern/guardedalloc
|
||||
@@ -39,10 +38,12 @@ set(INC
|
||||
set(SRC
|
||||
intern/readblenentry.c
|
||||
intern/readfile.c
|
||||
intern/runtime.c
|
||||
intern/undofile.c
|
||||
intern/writefile.c
|
||||
|
||||
BLO_readfile.h
|
||||
BLO_runtime.h
|
||||
BLO_soundfile.h
|
||||
BLO_sys_types.h
|
||||
BLO_undofile.h
|
||||
|
@@ -4,7 +4,7 @@ Import ('env')
|
||||
sources = env.Glob('intern/*.c')
|
||||
|
||||
incs = '. #/intern/guardedalloc ../blenlib ../blenkernel'
|
||||
incs += ' ../makesdna ../readblenfile ../editors/include'
|
||||
incs += ' ../makesdna ../editors/include'
|
||||
incs += ' ../render/extern/include ../makesrna'
|
||||
|
||||
incs += ' ' + env['BF_ZLIB_INC']
|
||||
|
@@ -62,8 +62,6 @@
|
||||
|
||||
#include "readfile.h"
|
||||
|
||||
#include "BLO_readblenfile.h"
|
||||
|
||||
#include "BLO_sys_types.h" // needed for intptr_t
|
||||
|
||||
#ifdef _WIN32
|
||||
@@ -150,15 +148,14 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *to
|
||||
LinkNode *previews= NULL;
|
||||
BHead *bhead;
|
||||
int looking=0;
|
||||
int npreviews = 0;
|
||||
PreviewImage* prv = NULL;
|
||||
PreviewImage* new_prv = NULL;
|
||||
int tot= 0;
|
||||
|
||||
for (bhead= blo_firstbhead(fd); bhead; bhead= blo_nextbhead(fd, bhead)) {
|
||||
if (bhead->code==ofblocktype) {
|
||||
ID *id= (ID*) (bhead+1);
|
||||
switch(GS(id->name))
|
||||
char *idname= bhead_id_name(fd, bhead);
|
||||
switch(GS(idname))
|
||||
{
|
||||
case ID_MA: /* fall through */
|
||||
case ID_TE: /* fall through */
|
||||
@@ -176,16 +173,14 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *to
|
||||
} else if (bhead->code==DATA) {
|
||||
if (looking) {
|
||||
if (bhead->SDNAnr == DNA_struct_find_nr(fd->filesdna, "PreviewImage") ) {
|
||||
prv = (PreviewImage*) (bhead+1);
|
||||
npreviews = 0;
|
||||
prv = BLO_library_read_struct(fd, bhead, "PreviewImage");
|
||||
if (prv) {
|
||||
memcpy(new_prv, prv, sizeof(PreviewImage));
|
||||
if (prv->rect[0]) {
|
||||
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");
|
||||
bhead= blo_nextbhead(fd, bhead);
|
||||
rect = (unsigned int*)(bhead+1);
|
||||
// rectlen = new_prv->w[0]*new_prv->h[0]*sizeof(unsigned int);
|
||||
memcpy(new_prv->rect[0], rect, bhead->len);
|
||||
} else {
|
||||
new_prv->rect[0] = NULL;
|
||||
@@ -193,15 +188,15 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *to
|
||||
|
||||
if (prv->rect[1]) {
|
||||
unsigned int *rect = NULL;
|
||||
// int rectlen = 0;
|
||||
new_prv->rect[1] = MEM_callocN(new_prv->w[1]*new_prv->h[1]*sizeof(unsigned int), "prvrect");
|
||||
bhead= blo_nextbhead(fd, bhead);
|
||||
rect = (unsigned int*)(bhead+1);
|
||||
// rectlen = new_prv->w[1]*new_prv->h[1]*sizeof(unsigned int);
|
||||
memcpy(new_prv->rect[1], rect, bhead->len);
|
||||
} else {
|
||||
new_prv->rect[1] = NULL;
|
||||
}
|
||||
MEM_freeN(prv);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (bhead->code==ENDB) {
|
||||
@@ -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;
|
||||
FileData *fd;
|
||||
|
||||
fd = blo_openblenderfile(file, reports);
|
||||
fd = blo_openblenderfile(filepath, reports);
|
||||
if (fd) {
|
||||
fd->reports= reports;
|
||||
bfd= blo_read_file_internal(fd, file);
|
||||
bfd= blo_read_file_internal(fd, filepath);
|
||||
blo_freefiledata(fd);
|
||||
}
|
||||
|
||||
|
@@ -138,7 +138,6 @@
|
||||
//XXX #include "BIF_previewrender.h" // bedlelvel, for struct RenderInfo
|
||||
#include "BLO_readfile.h"
|
||||
#include "BLO_undofile.h"
|
||||
#include "BLO_readblenfile.h" // streaming read pipe, for BLO_readblenfile BLO_readblenfilememory
|
||||
|
||||
#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;
|
||||
Library *lib;
|
||||
char name1[FILE_MAXDIR+FILE_MAXFILE];
|
||||
|
||||
strncpy(name1, name, sizeof(name1)-1);
|
||||
BLI_strncpy(name1, filepath, sizeof(name1));
|
||||
cleanup_path(relabase, name1);
|
||||
// printf("blo_find_main: original in %s\n", name);
|
||||
// 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);
|
||||
|
||||
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));
|
||||
|
||||
m->curlib= lib;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -946,14 +945,14 @@ static FileData *blo_decode_and_check(FileData *fd, ReportList *reports)
|
||||
|
||||
/* cannot be called with relative paths anymore! */
|
||||
/* 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;
|
||||
errno= 0;
|
||||
gzfile= gzopen(name, "rb");
|
||||
gzfile= gzopen(filepath, "rb");
|
||||
|
||||
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;
|
||||
} else {
|
||||
FileData *fd = filedata_new();
|
||||
@@ -961,7 +960,7 @@ FileData *blo_openblenderfile(const char *name, ReportList *reports)
|
||||
fd->read = fd_read_gzip_from_file;
|
||||
|
||||
/* 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);
|
||||
}
|
||||
@@ -1585,7 +1584,7 @@ static PreviewImage *direct_link_preview_image(FileData *fd, PreviewImage *old_p
|
||||
|
||||
if (prv) {
|
||||
int i;
|
||||
for (i=0; i < PREVIEW_MIPMAPS; ++i) {
|
||||
for (i=0; i < NUM_ICON_SIZES; ++i) {
|
||||
if (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->fmd= fluidmd;
|
||||
fluidmd->fss->meshSurfNormals = NULL;
|
||||
fluidmd->fss->meshVelocities = NULL;
|
||||
}
|
||||
else if (md->type==eModifierType_Smoke) {
|
||||
SmokeModifierData *smd = (SmokeModifierData*) md;
|
||||
@@ -5526,14 +5525,24 @@ 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)
|
||||
{
|
||||
Library *lib;
|
||||
/* BLO_read_from_memory uses a blank filename */
|
||||
if (basepath==NULL || basepath[0] == '\0')
|
||||
return;
|
||||
|
||||
if (basepath==NULL || basepath[0] == '\0') {
|
||||
for(lib= main->library.first; lib; lib= lib->id.next) {
|
||||
/* when loading a linked lib into a file which has not been saved,
|
||||
* there is nothing we can be relative to, so instead we need to make
|
||||
* it absolute. This can happen when appending an object with a relative
|
||||
* link into an unsaved blend file. See [#27405].
|
||||
* The remap relative option will make it relative again on save - campbell */
|
||||
if (strncmp(lib->name, "//", 2)==0) {
|
||||
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 */
|
||||
@@ -5542,6 +5551,7 @@ static void fix_relpaths_library(const char *basepath, Main *main)
|
||||
BLI_path_rel(lib->name, basepath);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ************** READ SOUND ******************* */
|
||||
@@ -9774,7 +9784,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
|
||||
|
||||
fluidmd->fss->lastgoodframe = INT_MAX;
|
||||
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;
|
||||
}
|
||||
|
||||
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);
|
||||
BlendFileData *bfd;
|
||||
@@ -11903,7 +11913,7 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filename)
|
||||
bfd->main->versionfile= fd->fileversion;
|
||||
|
||||
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) {
|
||||
switch(bhead->code) {
|
||||
@@ -12954,7 +12964,7 @@ static void give_base_to_groups(Main *mainvar, Scene *scene)
|
||||
|
||||
/* returns true if the item was found
|
||||
* 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);
|
||||
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;
|
||||
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;
|
||||
id= is_yet_read(fd, mainl, bhead);
|
||||
if(id==NULL) {
|
||||
@@ -13023,10 +13033,10 @@ static int append_named_part(const bContext *C, Main *mainl, FileData *fd, const
|
||||
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);
|
||||
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)
|
||||
@@ -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 */
|
||||
|
||||
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 *mainl;
|
||||
@@ -13060,7 +13070,7 @@ static Main* library_append_begin(const bContext *C, FileData **fd, char *dir)
|
||||
blo_split_main(&(*fd)->mainlist, mainvar);
|
||||
|
||||
/* 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 */
|
||||
mainl->versionfile= (*fd)->fileversion;
|
||||
@@ -13069,10 +13079,10 @@ static Main* library_append_begin(const bContext *C, FileData **fd, char *dir)
|
||||
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);
|
||||
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)
|
||||
@@ -13194,30 +13204,10 @@ void BLO_library_append_end(const bContext *C, struct Main *mainl, BlendHandle**
|
||||
*bh= (BlendHandle*)fd;
|
||||
}
|
||||
|
||||
/* this is a version of BLO_library_append needed by the BPython API, so
|
||||
* 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)
|
||||
void *BLO_library_read_struct(FileData *fd, BHead *bh, const char *blockname)
|
||||
{
|
||||
FileData *fd= (FileData*)(*bh);
|
||||
|
||||
/* 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;
|
||||
return read_struct(fd, bh, blockname);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* ************* READ LIBRARY ************** */
|
||||
|
||||
|
@@ -113,9 +113,9 @@ struct Main;
|
||||
void blo_join_main(ListBase *mainlist);
|
||||
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_openblendermemfile(struct MemFile *memfile, struct ReportList *reports);
|
||||
|
||||
|
@@ -27,11 +27,13 @@
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file BLO_readblenfile.c
|
||||
* \brief This file handles the loading if .blend files
|
||||
* \ingroup blo
|
||||
* \file runtime.c
|
||||
* \brief This file handles the loading of .blend files embedded in runtimes
|
||||
* \ingroup blenloader
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -46,90 +48,56 @@
|
||||
#endif
|
||||
|
||||
#include "BLO_readfile.h"
|
||||
#include "BLO_readblenfile.h"
|
||||
#include "BLO_runtime.h"
|
||||
|
||||
#include "BKE_blender.h"
|
||||
#include "BKE_report.h"
|
||||
#include "BKE_utildefines.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 */
|
||||
|
||||
static int handle_read_msb_int(int handle) {
|
||||
static int handle_read_msb_int(int handle)
|
||||
{
|
||||
unsigned char buf[4];
|
||||
|
||||
if (read(handle, buf, 4)!=4)
|
||||
if(read(handle, buf, 4) != 4)
|
||||
return -1;
|
||||
else
|
||||
|
||||
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 datastart;
|
||||
char buf[8];
|
||||
|
||||
if (fd==-1)
|
||||
if(fd==-1)
|
||||
goto cleanup;
|
||||
|
||||
lseek(fd, -12, SEEK_END);
|
||||
|
||||
datastart= handle_read_msb_int(fd);
|
||||
if (datastart==-1)
|
||||
|
||||
if(datastart==-1)
|
||||
goto cleanup;
|
||||
else if (read(fd, buf, 8)!=8)
|
||||
else if(read(fd, buf, 8)!=8)
|
||||
goto cleanup;
|
||||
else if (memcmp(buf, "BRUNTIME", 8)!=0)
|
||||
else if(memcmp(buf, "BRUNTIME", 8)!=0)
|
||||
goto cleanup;
|
||||
else
|
||||
res= 1;
|
||||
|
||||
cleanup:
|
||||
if (fd!=-1)
|
||||
if(fd!=-1)
|
||||
close(fd);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
BlendFileData *
|
||||
blo_read_runtime(
|
||||
char *path,
|
||||
ReportList *reports)
|
||||
BlendFileData *BLO_read_runtime(char *path, ReportList *reports)
|
||||
{
|
||||
BlendFileData *bfd= NULL;
|
||||
size_t actualsize;
|
||||
@@ -137,7 +105,8 @@ blo_read_runtime(
|
||||
char buf[8];
|
||||
|
||||
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));
|
||||
goto cleanup;
|
||||
}
|
||||
@@ -147,16 +116,20 @@ blo_read_runtime(
|
||||
lseek(fd, -12, SEEK_END);
|
||||
|
||||
datastart= handle_read_msb_int(fd);
|
||||
if (datastart==-1) {
|
||||
|
||||
if(datastart==-1) {
|
||||
BKE_reportf(reports, RPT_ERROR, "Unable to read \"%s\" (problem seeking)", path);
|
||||
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);
|
||||
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);
|
||||
goto cleanup;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
//printf("starting to read runtime from %s at datastart %d\n", path, datastart);
|
||||
lseek(fd, datastart, SEEK_SET);
|
||||
bfd = blo_read_blendafterruntime(fd, path, actualsize-datastart, reports);
|
||||
@@ -164,7 +137,7 @@ blo_read_runtime(
|
||||
}
|
||||
|
||||
cleanup:
|
||||
if (fd!=-1)
|
||||
if(fd!=-1)
|
||||
close(fd);
|
||||
|
||||
return bfd;
|
@@ -2661,14 +2661,14 @@ static int write_file_handle(Main *mainvar, int handle, MemFile *compare, MemFil
|
||||
}
|
||||
|
||||
/* 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 tempname[FILE_MAXDIR+FILE_MAXFILE+1];
|
||||
int file, err, write_user_block;
|
||||
|
||||
/* 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);
|
||||
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) {
|
||||
char dir1[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);
|
||||
|
||||
/* just incase there is some subtle difference */
|
||||
BLI_cleanup_dir(mainvar->name, dir1);
|
||||
BLI_cleanup_dir(mainvar->name, dir2);
|
||||
|
||||
if(strcmp(dir1, dir2)==0)
|
||||
if(BLI_path_cmp(dir1, dir2)==0) {
|
||||
write_flags &= ~G_FILE_RELATIVE_REMAP;
|
||||
else
|
||||
}
|
||||
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);
|
||||
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)
|
||||
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 */
|
||||
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;
|
||||
|
||||
/* 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);
|
||||
|
||||
if(0==ret) {
|
||||
/* 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 @.");
|
||||
return 0;
|
||||
}
|
||||
@@ -2732,7 +2740,7 @@ int BLO_write_file(Main *mainvar, char *dir, int write_flags, ReportList *report
|
||||
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 @");
|
||||
return 0;
|
||||
}
|
||||
|
@@ -1360,6 +1360,7 @@ void ANIM_OT_keyframe_delete_v3d (wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Delete Keyframe";
|
||||
ot->description= "Remove keyframes on current frame for selected object";
|
||||
ot->idname= "ANIM_OT_keyframe_delete_v3d";
|
||||
|
||||
/* callbacks */
|
||||
|
@@ -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 */
|
||||
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;
|
||||
|
||||
/* find relevant builtin KeyingSets which use this, and remove them */
|
||||
|
@@ -206,7 +206,7 @@ void POSE_OT_propagate(struct wmOperatorType *ot);
|
||||
/* editarmature.c */
|
||||
|
||||
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 */
|
||||
void preEditBoneDuplicate(struct ListBase *editbones);
|
||||
|
@@ -1698,7 +1698,7 @@ void ARMATURE_OT_select_linked(wmOperatorType *ot)
|
||||
|
||||
/* does bones and points */
|
||||
/* 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;
|
||||
rcti rect;
|
||||
@@ -1958,7 +1958,7 @@ static int ebone_select_flag(EditBone *ebone)
|
||||
}
|
||||
|
||||
/* 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);
|
||||
bArmature *arm= obedit->data;
|
||||
@@ -2498,8 +2498,8 @@ static int armature_click_extrude_invoke(bContext *C, wmOperator *op, wmEvent *e
|
||||
ARegion *ar;
|
||||
View3D *v3d;
|
||||
RegionView3D *rv3d;
|
||||
float dx, dy, fz, *fp = NULL, dvec[3], oldcurs[3];
|
||||
short mx, my, mval[2];
|
||||
float *fp = NULL, tvec[3], oldcurs[3];
|
||||
int mx, my;
|
||||
int retv;
|
||||
|
||||
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;
|
||||
my= event->y - ar->winrct.ymin;
|
||||
project_short_noclip(ar, fp, mval);
|
||||
|
||||
initgrabz(rv3d, fp[0], fp[1], fp[2]);
|
||||
|
||||
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];
|
||||
}
|
||||
window_to_3d(ar, tvec, fp, mx, my);
|
||||
copy_v3_v3(fp, tvec);
|
||||
|
||||
/* extrude to the where new cursor is and store the operation result */
|
||||
retv= armature_click_extrude_exec(C, op);
|
||||
|
@@ -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);
|
||||
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 */
|
||||
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);
|
||||
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;
|
||||
rcti rect;
|
||||
@@ -2473,7 +2473,7 @@ static int sketch_delete(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(ev
|
||||
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);
|
||||
SK_Sketch *sketch = contextSketch(C, 0);
|
||||
|
@@ -527,7 +527,7 @@ static int poselib_remove_exec (bContext *C, wmOperator *op)
|
||||
}
|
||||
|
||||
/* 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) {
|
||||
BKE_reportf(op->reports, RPT_ERROR, "Invalid Pose specified %d", RNA_int_get(op->ptr, "pose"));
|
||||
return OPERATOR_CANCELLED;
|
||||
|
@@ -4169,7 +4169,7 @@ void CURVE_OT_make_segment(wmOperatorType *ot)
|
||||
|
||||
/***************** 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);
|
||||
Curve *cu= obedit->data;
|
||||
@@ -4666,7 +4666,7 @@ static int add_vertex_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
||||
Curve *cu;
|
||||
ViewContext vc;
|
||||
float location[3];
|
||||
short mval[2];
|
||||
int mval[2];
|
||||
|
||||
Nurb *nu;
|
||||
BezTriple *bezt;
|
||||
@@ -6118,6 +6118,7 @@ int join_curve_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
mul_m4_v3(cmat, bezt->vec[2]);
|
||||
bezt++;
|
||||
}
|
||||
calchandlesNurb(newnu);
|
||||
}
|
||||
if( (bp= newnu->bp) ) {
|
||||
a= newnu->pntsu*nu->pntsv;
|
||||
|
@@ -377,8 +377,7 @@ static void gp_strokepoint_convertcoords (bContext *C, bGPDstroke *gps, bGPDspoi
|
||||
}
|
||||
else {
|
||||
float *fp= give_cursor(scene, v3d);
|
||||
float dvec[3];
|
||||
short mval[2];
|
||||
int mval[2];
|
||||
int mx, my;
|
||||
|
||||
/* get screen coordinate */
|
||||
@@ -390,15 +389,13 @@ static void gp_strokepoint_convertcoords (bContext *C, bGPDstroke *gps, bGPDspoi
|
||||
mx= (int)(pt->x / 100 * ar->winx);
|
||||
my= (int)(pt->y / 100 * ar->winy);
|
||||
}
|
||||
mval[0]= (short)mx;
|
||||
mval[1]= (short)my;
|
||||
mval[0]= mx;
|
||||
mval[1]= my;
|
||||
|
||||
/* convert screen coordinate to 3d coordinates
|
||||
* - method taken from editview.c - mouse_cursor()
|
||||
*/
|
||||
project_short_noclip(ar, fp, mval);
|
||||
window_to_3d(ar, dvec, mval[0]-mx, mval[1]-my);
|
||||
sub_v3_v3v3(p3d, fp, dvec);
|
||||
window_to_3d(ar, p3d, fp, mval[0], mval[1]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -564,8 +561,6 @@ static int gp_convert_layer_exec (bContext *C, wmOperator *op)
|
||||
bGPdata *gpd= gpencil_data_get_active(C);
|
||||
bGPDlayer *gpl= gpencil_layer_getactive(gpd);
|
||||
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");
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
/* initialise 3d-cursor correction globals */
|
||||
initgrabz(CTX_wm_region_view3d(C), fp[0], fp[1], fp[2]);
|
||||
|
||||
/* handle conversion modes */
|
||||
switch (mode) {
|
||||
case GP_STROKECONVERT_PATH:
|
||||
|
@@ -239,7 +239,7 @@ static short gp_stroke_filtermval (tGPsdata *p, int mval[2], int pmval[2])
|
||||
|
||||
/* convert screen-coordinates to buffer-coordinates */
|
||||
// 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;
|
||||
|
||||
@@ -251,7 +251,7 @@ static void gp_stroke_convertcoords (tGPsdata *p, short mval[2], float out[3], f
|
||||
*/
|
||||
}
|
||||
else {
|
||||
const short mx=mval[0], my=mval[1];
|
||||
const int mx=mval[0], my=mval[1];
|
||||
float rvec[3], dvec[3];
|
||||
|
||||
/* 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);
|
||||
|
||||
/* 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);
|
||||
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() */
|
||||
typedef struct tGpSmoothCo {
|
||||
short x;
|
||||
short y;
|
||||
int x;
|
||||
int y;
|
||||
} tGpSmoothCo;
|
||||
|
||||
/* 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 *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->y= (short)(0.1*pa->y + 0.2*pb->y + 0.4*pc->y + 0.2*pd->y + 0.1*pe->y);
|
||||
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= (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 */
|
||||
@@ -574,7 +574,7 @@ static void gp_stroke_newfrombuffer (tGPsdata *p)
|
||||
|
||||
/* get an array of depths, far depths are blended */
|
||||
if (gpencil_project_check(p)) {
|
||||
short mval[2], mval_prev[2]= {0};
|
||||
int mval[2], mval_prev[2]= {0};
|
||||
int interp_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;
|
||||
int x0=0, y0=0, x1=0, y1=0;
|
||||
short xyval[2];
|
||||
int xyval[2];
|
||||
int i;
|
||||
|
||||
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) {
|
||||
/* get coordinates */
|
||||
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];
|
||||
y0= xyval[1];
|
||||
}
|
||||
@@ -804,11 +804,11 @@ static void gp_stroke_eraser_dostroke (tGPsdata *p, int mval[], int mvalo[], sho
|
||||
|
||||
/* get coordinates */
|
||||
if (gps->flag & GP_STROKE_3DSPACE) {
|
||||
project_short(p->ar, &pt1->x, xyval);
|
||||
project_int(p->ar, &pt1->x, xyval);
|
||||
x0= xyval[0];
|
||||
y0= xyval[1];
|
||||
|
||||
project_short(p->ar, &pt2->x, xyval);
|
||||
project_int(p->ar, &pt2->x, xyval);
|
||||
x1= xyval[0];
|
||||
y1= xyval[1];
|
||||
}
|
||||
@@ -1501,8 +1501,8 @@ static int gpencil_draw_exec (bContext *C, wmOperator *op)
|
||||
|
||||
/* get relevant data for this point from stroke */
|
||||
RNA_float_get_array(&itemptr, "mouse", mousef);
|
||||
p->mval[0] = (short)mousef[0];
|
||||
p->mval[1] = (short)mousef[1];
|
||||
p->mval[0] = (int)mousef[0];
|
||||
p->mval[1] = (int)mousef[1];
|
||||
p->pressure= RNA_float_get(&itemptr, "pressure");
|
||||
|
||||
if (RNA_boolean_get(&itemptr, "is_start")) {
|
||||
|
@@ -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,
|
||||
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);
|
||||
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);
|
||||
|
@@ -66,7 +66,7 @@ void free_editNurb (struct Object *obedit);
|
||||
|
||||
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);
|
||||
|
||||
|
@@ -56,7 +56,7 @@ struct wmKeyConfig;
|
||||
* Used as part of the 'stroke cache' used during drawing of new strokes
|
||||
*/
|
||||
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 */
|
||||
} tGPspoint;
|
||||
|
||||
|
@@ -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) */
|
||||
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 */
|
||||
|
||||
|
@@ -36,6 +36,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct Main;
|
||||
struct ListBase;
|
||||
struct ID;
|
||||
struct Scene;
|
||||
@@ -190,7 +191,7 @@ KeyingSetInfo *ANIM_keyingset_info_find_named(const char name[]);
|
||||
|
||||
/* for RNA type registrations... */
|
||||
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 */
|
||||
void ANIM_keyingset_infos_exit(void);
|
||||
|
@@ -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);
|
||||
|
||||
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 make_editMball(struct Object *obedit);
|
||||
|
@@ -169,9 +169,9 @@ void EM_project_snap_verts(struct bContext *C, struct ARegion *ar, struct Object
|
||||
extern unsigned int em_vertoffs, em_solidoffs, em_wireoffs;
|
||||
|
||||
void EM_cache_x_mirror_vert(struct Object *ob, struct EditMesh *em);
|
||||
int mouse_mesh(struct bContext *C, const short mval[2], short extend);
|
||||
int mouse_mesh(struct bContext *C, const int mval[2], short extend);
|
||||
int EM_check_backbuf(unsigned int index);
|
||||
int EM_mask_init_backbuf_border(struct ViewContext *vc, short mcords[][2], short tot, short xmin, short ymin, short xmax, short ymax);
|
||||
int EM_mask_init_backbuf_border(struct ViewContext *vc, int mcords[][2], short tot, short xmin, short ymin, short xmax, short ymax);
|
||||
void EM_free_backbuf(void);
|
||||
int EM_init_backbuf_border(struct ViewContext *vc, short xmin, short ymin, short xmax, short ymax);
|
||||
int EM_init_backbuf_circle(struct ViewContext *vc, short xs, short ys, short rads);
|
||||
@@ -187,10 +187,10 @@ void EM_automerge(struct Scene *scene, struct Object *obedit, int update);
|
||||
/* editface.c */
|
||||
void paintface_flush_flags(struct Object *ob);
|
||||
struct MTFace *EM_get_active_mtface(struct EditMesh *em, struct EditFace **act_efa, struct MCol **mcol, int sloppy);
|
||||
int paintface_mouse_select(struct bContext *C, struct Object *ob, const short mval[2], int extend);
|
||||
int paintface_mouse_select(struct bContext *C, struct Object *ob, const int mval[2], int extend);
|
||||
int do_paintface_box_select(struct ViewContext *vc, struct rcti *rect, int select, int extend);
|
||||
void paintface_deselect_all_visible(struct Object *ob, int action, short flush_flags);
|
||||
void paintface_select_linked(struct bContext *C, struct Object *ob, short mval[2], int mode);
|
||||
void paintface_select_linked(struct bContext *C, struct Object *ob, int mval[2], int mode);
|
||||
int paintface_minmax(struct Object *ob, float *min, float *max);
|
||||
|
||||
void paintface_hide(struct Object *ob, const int unselected);
|
||||
|
@@ -126,7 +126,7 @@ void ED_object_constraint_update(struct Object *ob);
|
||||
void ED_object_constraint_dependency_update(struct Main *bmain, struct Scene *scene, struct Object *ob);
|
||||
|
||||
/* object_lattice.c */
|
||||
int mouse_lattice(struct bContext *C, const short mval[2], int extend);
|
||||
int mouse_lattice(struct bContext *C, const int mval[2], int extend);
|
||||
void undo_push_lattice(struct bContext *C, const char *name);
|
||||
|
||||
/* object_lattice.c */
|
||||
|
@@ -60,10 +60,10 @@ void PE_hide_keys_time(struct Scene *scene, struct PTCacheEdit *edit, float cfra
|
||||
void PE_update_object(struct Scene *scene, struct Object *ob, int useflag);
|
||||
|
||||
/* selection tools */
|
||||
int PE_mouse_particles(struct bContext *C, const short mval[2], int extend);
|
||||
int PE_mouse_particles(struct bContext *C, const int mval[2], int extend);
|
||||
int PE_border_select(struct bContext *C, struct rcti *rect, int select, int extend);
|
||||
int PE_circle_select(struct bContext *C, int selecting, const short mval[2], float rad);
|
||||
int PE_lasso_select(struct bContext *C, short mcords[][2], short moves, short extend, short select);
|
||||
int PE_circle_select(struct bContext *C, int selecting, const int mval[2], float rad);
|
||||
int PE_lasso_select(struct bContext *C, int mcords[][2], short moves, short extend, short select);
|
||||
void PE_deselect_all_visible(struct PTCacheEdit *edit);
|
||||
|
||||
/* undo */
|
||||
|
@@ -86,7 +86,6 @@ void undo_editmode_step (struct bContext *C, int step);
|
||||
float *crazyspace_get_mapped_editverts(struct Scene *scene, struct Object *obedit);
|
||||
void crazyspace_set_quats_editmesh(struct EditMesh *em, float *origcos, float *mappedcos, float *quats);
|
||||
void crazyspace_set_quats_mesh(struct Mesh *me, float *origcos, float *mappedcos, float *quats);
|
||||
int editmesh_get_first_deform_matrices(struct Scene *scene, struct Object *ob, struct EditMesh *em, float (**deformmats)[3][3], float (**deformcos)[3]);
|
||||
int sculpt_get_first_deform_matrices(struct Scene *scene, struct Object *ob, float (**deformmats)[3][3], float (**deformcos)[3]);
|
||||
void crazyspace_build_sculpt(struct Scene *scene, struct Object *ob, float (**deformmats)[3][3], float (**deformcos)[3]);
|
||||
|
||||
|
@@ -64,7 +64,7 @@ typedef struct ViewContext {
|
||||
struct View3D *v3d;
|
||||
struct RegionView3D *rv3d;
|
||||
struct EditMesh *em;
|
||||
short mval[2];
|
||||
int mval[2];
|
||||
} ViewContext;
|
||||
|
||||
typedef struct ViewDepths {
|
||||
@@ -80,9 +80,9 @@ typedef struct ViewDepths {
|
||||
float *give_cursor(struct Scene *scene, struct View3D *v3d);
|
||||
|
||||
int initgrabz(struct RegionView3D *rv3d, float x, float y, float z);
|
||||
void window_to_3d(struct ARegion *ar, float out[3], short mx, short my);
|
||||
void window_to_3d_delta(struct ARegion *ar, float out[3], short mx, short my);
|
||||
void window_to_3d_vector(struct ARegion *ar, float out[3], short mx, short my);
|
||||
void window_to_3d(struct ARegion *ar, float out[3], const float depth_pt[3], const int mx, const int my);
|
||||
void window_to_3d_delta(struct ARegion *ar, float out[3], const int mx, const int my);
|
||||
void window_to_3d_vector(struct ARegion *ar, float out[3], const int mx, const int my);
|
||||
void view3d_unproject(struct bglMats *mats, float out[3], const short x, const short y, const float z);
|
||||
|
||||
/* Depth buffer */
|
||||
@@ -109,9 +109,9 @@ void viewvector(struct RegionView3D *rv3d, float coord[3], float vec[3]);
|
||||
void viewline(struct ARegion *ar, struct View3D *v3d, float mval[2], float ray_start[3], float ray_end[3]);
|
||||
void viewray(struct ARegion *ar, struct View3D *v3d, float mval[2], float ray_start[3], float ray_normal[3]);
|
||||
|
||||
void get_object_clip_range(struct Object *ob, float *lens, float *clipsta, float *clipend);
|
||||
int get_view3d_cliprange(struct View3D *v3d, struct RegionView3D *rv3d, float *clipsta, float *clipend);
|
||||
int get_view3d_viewplane(struct View3D *v3d, struct RegionView3D *rv3d, int winxi, int winyi, struct rctf *viewplane, float *clipsta, float *clipend, float *pixsize);
|
||||
int get_view3d_ortho(struct View3D *v3d, struct RegionView3D *rv3d);
|
||||
void view3d_get_object_project_mat(struct RegionView3D *v3d, struct Object *ob, float pmat[4][4]);
|
||||
void view3d_project_float(struct ARegion *a, const float vec[3], float adr[2], float mat[4][4]);
|
||||
void view3d_calc_camera_border(struct Scene *scene, struct ARegion *ar, struct RegionView3D *rv3d, struct View3D *v3d, struct rctf *viewborder_r, short do_shift);
|
||||
@@ -133,18 +133,18 @@ void drawcircball(int mode, const float cent[3], float rad, float tmat[][4]);
|
||||
/* backbuffer select and draw support */
|
||||
void view3d_validate_backbuf(struct ViewContext *vc);
|
||||
struct ImBuf *view3d_read_backbuf(struct ViewContext *vc, short xmin, short ymin, short xmax, short ymax);
|
||||
unsigned int view3d_sample_backbuf_rect(struct ViewContext *vc, const short mval[2], int size, unsigned int min, unsigned int max, int *dist, short strict,
|
||||
unsigned int view3d_sample_backbuf_rect(struct ViewContext *vc, const int mval[2], int size, unsigned int min, unsigned int max, int *dist, short strict,
|
||||
void *handle, unsigned int (*indextest)(void *handle, unsigned int index));
|
||||
unsigned int view3d_sample_backbuf(struct ViewContext *vc, int x, int y);
|
||||
|
||||
/* draws and does a 4x4 sample */
|
||||
int view_autodist(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, const short mval[2], float mouse_worldloc[3]);
|
||||
int view_autodist(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, const int mval[2], float mouse_worldloc[3]);
|
||||
|
||||
/* only draw so view_autodist_simple can be called many times after */
|
||||
int view_autodist_init(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, int mode);
|
||||
int view_autodist_simple(struct ARegion *ar, const short mval[2], float mouse_worldloc[3], int margin, float *force_depth);
|
||||
int view_autodist_depth(struct ARegion *ar, const short mval[2], int margin, float *depth);
|
||||
int view_autodist_depth_segment(struct ARegion *ar, const short mval_sta[2], const short mval_end[2], int margin, float *depth);
|
||||
int view_autodist_simple(struct ARegion *ar, const int mval[2], float mouse_worldloc[3], int margin, float *force_depth);
|
||||
int view_autodist_depth(struct ARegion *ar, const int mval[2], int margin, float *depth);
|
||||
int view_autodist_depth_segment(struct ARegion *ar, const int mval_sta[2], const int mval_end[2], int margin, float *depth);
|
||||
|
||||
/* select */
|
||||
#define MAXPICKBUF 10000
|
||||
@@ -153,13 +153,13 @@ short view3d_opengl_select(struct ViewContext *vc, unsigned int *buffer, unsigne
|
||||
void view3d_set_viewcontext(struct bContext *C, struct ViewContext *vc);
|
||||
void view3d_operator_needs_opengl(const struct bContext *C);
|
||||
void view3d_region_operator_needs_opengl(struct wmWindow *win, struct ARegion *ar);
|
||||
int view3d_get_view_aligned_coordinate(struct ViewContext *vc, float fp[3], const short mval[2], const short do_fallback);
|
||||
int view3d_get_view_aligned_coordinate(struct ViewContext *vc, float fp[3], const int mval[2], const short do_fallback);
|
||||
void view3d_get_transformation(struct ARegion *ar, struct RegionView3D *rv3d, struct Object *ob, struct bglMats *mats);
|
||||
|
||||
/* XXX should move to BLI_math */
|
||||
int edge_inside_circle(short centx, short centy, short rad, short x1, short y1, short x2, short y2);
|
||||
int lasso_inside(short mcords[][2], short moves, short sx, short sy);
|
||||
int lasso_inside_edge(short mcords[][2], short moves, int x0, int y0, int x1, int y1);
|
||||
int lasso_inside(int mcords[][2], short moves, int sx, int sy);
|
||||
int lasso_inside_edge(int mcords[][2], short moves, int x0, int y0, int x1, int y1);
|
||||
|
||||
/* get 3d region from context, also if mouse is in header or toolbar */
|
||||
struct RegionView3D *ED_view3d_context_rv3d(struct bContext *C);
|
||||
@@ -178,7 +178,7 @@ struct ImBuf *ED_view3d_draw_offscreen_imbuf(struct Scene *scene, struct View3D
|
||||
struct ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, struct Object *camera, int width, int height, unsigned int flag, int drawtype, char err_out[256]);
|
||||
|
||||
|
||||
Base *ED_view3d_give_base_under_cursor(struct bContext *C, const short mval[2]);
|
||||
Base *ED_view3d_give_base_under_cursor(struct bContext *C, const int mval[2]);
|
||||
void ED_view3d_quadview_update(struct ScrArea *sa, struct ARegion *ar, short do_clip);
|
||||
int ED_view3d_lock(struct RegionView3D *rv3d);
|
||||
|
||||
@@ -187,9 +187,19 @@ unsigned int ED_viewedit_datamask(struct bScreen *screen);
|
||||
|
||||
|
||||
/* assigning view matrix */
|
||||
void view3d_apply_mat4(float mat[][4], float *ofs, float *quat, float *dist);
|
||||
void view3d_apply_ob(struct Object *ob, float *ofs, float *quat, float *dist, float *lens);
|
||||
void ED_view3d_from_m4(float mat[][4], float ofs[3], float quat[4], float *dist);
|
||||
|
||||
void ED_view3d_from_object(struct Object *ob, float ofs[3], float quat[4], float *dist, float *lens);
|
||||
void ED_view3d_to_object(struct Object *ob, const float ofs[3], const float quat[4], const float dist);
|
||||
|
||||
/* camera lock functions */
|
||||
/* copy the camera to the view before starting a view transformation */
|
||||
void ED_view3d_camera_lock_init(struct View3D *v3d, struct RegionView3D *rv3d);
|
||||
/* copy the view to the camera */
|
||||
void ED_view3d_camera_lock_sync(struct View3D *v3d, struct RegionView3D *rv3d);
|
||||
|
||||
int view3d_is_ortho(struct View3D *v3d, struct RegionView3D *rv3d);
|
||||
|
||||
|
||||
#endif /* ED_VIEW3D_H */
|
||||
|
||||
|
@@ -262,14 +262,12 @@ static int ui_is_a_warp_but(uiBut *but)
|
||||
static int ui_is_utf8_but(uiBut *but)
|
||||
{
|
||||
if (but->rnaprop) {
|
||||
int subtype= RNA_property_subtype(but->rnaprop);
|
||||
|
||||
if(ELEM3(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME)) {
|
||||
return TRUE;
|
||||
const int subtype= RNA_property_subtype(but->rnaprop);
|
||||
return !(ELEM3(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME));
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
return !(but->flag & UI_BUT_NO_UTF8);
|
||||
}
|
||||
}
|
||||
|
||||
/* ********************** button apply/revert ************************/
|
||||
@@ -300,7 +298,7 @@ static void ui_apply_but_func(bContext *C, uiBut *but)
|
||||
after->func_arg3= but->func_arg3;
|
||||
|
||||
after->funcN= but->funcN;
|
||||
after->func_argN= but->func_argN;
|
||||
after->func_argN= MEM_dupallocN(but->func_argN);
|
||||
|
||||
after->rename_func= but->rename_func;
|
||||
after->rename_arg1= but->rename_arg1;
|
||||
@@ -404,6 +402,8 @@ static void ui_apply_but_funcs_after(bContext *C)
|
||||
after.func(C, after.func_arg1, after.func_arg2);
|
||||
if(after.funcN)
|
||||
after.funcN(C, after.func_argN, after.func_arg2);
|
||||
if(after.func_argN)
|
||||
MEM_freeN(after.func_argN);
|
||||
|
||||
if(after.handle_func)
|
||||
after.handle_func(C, after.handle_func_arg, after.retval);
|
||||
@@ -1679,7 +1679,7 @@ static void ui_textedit_begin(bContext *C, uiBut *but, uiHandleButtonData *data)
|
||||
static void ui_textedit_end(bContext *C, uiBut *but, uiHandleButtonData *data)
|
||||
{
|
||||
if(but) {
|
||||
if(!ui_is_utf8_but(but)) {
|
||||
if(ui_is_utf8_but(but)) {
|
||||
int strip= BLI_utf8_invalid_strip(but->editstr, strlen(but->editstr));
|
||||
/* not a file?, strip non utf-8 chars */
|
||||
if(strip) {
|
||||
|
@@ -798,36 +798,39 @@ void UI_icons_init(int first_dyn_id)
|
||||
init_brush_icons();
|
||||
}
|
||||
|
||||
/* Render size for preview images at level miplevel */
|
||||
static int preview_render_size(int miplevel)
|
||||
/* Render size for preview images and icons
|
||||
*/
|
||||
static int preview_render_size(enum eIconSizes size)
|
||||
{
|
||||
switch (miplevel) {
|
||||
case 0: return 32;
|
||||
case 1: return PREVIEW_DEFAULT_HEIGHT;
|
||||
switch (size) {
|
||||
case ICON_SIZE_ICON: return 32;
|
||||
case ICON_SIZE_PREVIEW: return PREVIEW_DEFAULT_HEIGHT;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void icon_create_mipmap(struct PreviewImage* prv_img, int miplevel)
|
||||
/* Create rect for the icon
|
||||
*/
|
||||
static void icon_create_rect(struct PreviewImage* prv_img, enum eIconSizes size)
|
||||
{
|
||||
unsigned int size = preview_render_size(miplevel);
|
||||
unsigned int render_size = preview_render_size(size);
|
||||
|
||||
if (!prv_img) {
|
||||
if (G.f & G_DEBUG)
|
||||
printf("Error: requested preview image does not exist");
|
||||
}
|
||||
if (!prv_img->rect[miplevel]) {
|
||||
prv_img->w[miplevel] = size;
|
||||
prv_img->h[miplevel] = size;
|
||||
prv_img->changed[miplevel] = 1;
|
||||
prv_img->changed_timestamp[miplevel] = 0;
|
||||
prv_img->rect[miplevel] = MEM_callocN(size*size*sizeof(unsigned int), "prv_rect");
|
||||
if (!prv_img->rect[size]) {
|
||||
prv_img->w[size] = render_size;
|
||||
prv_img->h[size] = render_size;
|
||||
prv_img->changed[size] = 1;
|
||||
prv_img->changed_timestamp[size] = 0;
|
||||
prv_img->rect[size] = MEM_callocN(render_size*render_size*sizeof(unsigned int), "prv_rect");
|
||||
}
|
||||
}
|
||||
|
||||
/* only called when icon has changed */
|
||||
/* only call with valid pointer from UI_icon_draw */
|
||||
static void icon_set_image(bContext *C, ID *id, PreviewImage* prv_img, int miplevel)
|
||||
static void icon_set_image(bContext *C, ID *id, PreviewImage* prv_img, enum eIconSizes size)
|
||||
{
|
||||
if (!prv_img) {
|
||||
if (G.f & G_DEBUG)
|
||||
@@ -835,11 +838,10 @@ static void icon_set_image(bContext *C, ID *id, PreviewImage* prv_img, int miple
|
||||
return;
|
||||
}
|
||||
|
||||
/* create the preview rect */
|
||||
icon_create_mipmap(prv_img, miplevel);
|
||||
icon_create_rect(prv_img, size);
|
||||
|
||||
ED_preview_icon_job(C, prv_img, id, prv_img->rect[miplevel],
|
||||
prv_img->w[miplevel], prv_img->h[miplevel]);
|
||||
ED_preview_icon_job(C, prv_img, id, prv_img->rect[size],
|
||||
prv_img->w[size], prv_img->h[size]);
|
||||
}
|
||||
|
||||
static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect), int rw, int rh, unsigned int *rect, float alpha, float *rgb, short is_preview)
|
||||
@@ -928,17 +930,17 @@ static void icon_draw_texture(float x, float y, float w, float h, int ix, int iy
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
/* Drawing size for preview images at level miplevel */
|
||||
static int preview_size(int miplevel)
|
||||
/* Drawing size for preview images */
|
||||
static int get_draw_size(enum eIconSizes size)
|
||||
{
|
||||
switch (miplevel) {
|
||||
case 0: return ICON_DEFAULT_HEIGHT;
|
||||
case 1: return PREVIEW_DEFAULT_HEIGHT;
|
||||
switch (size) {
|
||||
case ICON_SIZE_ICON: return ICON_DEFAULT_HEIGHT;
|
||||
case ICON_SIZE_PREVIEW: return PREVIEW_DEFAULT_HEIGHT;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void icon_draw_size(float x, float y, int icon_id, float aspect, float alpha, float *rgb, int miplevel, int draw_size, int UNUSED(nocreate), int is_preview)
|
||||
static void icon_draw_size(float x, float y, int icon_id, float aspect, float alpha, float *rgb, enum eIconSizes size, int draw_size, int UNUSED(nocreate), int is_preview)
|
||||
{
|
||||
Icon *icon = NULL;
|
||||
DrawInfo *di = NULL;
|
||||
@@ -988,11 +990,11 @@ static void icon_draw_size(float x, float y, int icon_id, float aspect, float al
|
||||
|
||||
if(pi) {
|
||||
/* no create icon on this level in code */
|
||||
if(!pi->rect[miplevel]) return; /* something has gone wrong! */
|
||||
if(!pi->rect[size]) return; /* something has gone wrong! */
|
||||
|
||||
/* preview images use premul alpha ... */
|
||||
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
||||
icon_draw_rect(x, y, w, h, aspect, pi->w[miplevel], pi->h[miplevel], pi->rect[miplevel], 1.0f, NULL, is_preview);
|
||||
icon_draw_rect(x, y, w, h, aspect, pi->w[size], pi->h[size], pi->rect[size], 1.0f, NULL, is_preview);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
}
|
||||
@@ -1024,7 +1026,7 @@ static void ui_id_brush_render(bContext *C, ID *id)
|
||||
if(!pi)
|
||||
return;
|
||||
|
||||
for(i = 0; i < PREVIEW_MIPMAPS; i++) {
|
||||
for(i = 0; i < NUM_ICON_SIZES; i++) {
|
||||
/* check if rect needs to be created; changed
|
||||
only set by dynamic icons */
|
||||
if((pi->changed[i] || !pi->rect[i])) {
|
||||
@@ -1113,21 +1115,21 @@ int ui_id_icon_get(bContext *C, ID *id, int big)
|
||||
return iconid;
|
||||
}
|
||||
|
||||
static void icon_draw_mipmap(float x, float y, int icon_id, float aspect, float alpha, int miplevel, int nocreate)
|
||||
static void icon_draw_at_size(float x, float y, int icon_id, float aspect, float alpha, enum eIconSizes size, int nocreate)
|
||||
{
|
||||
int draw_size = preview_size(miplevel);
|
||||
icon_draw_size(x, y, icon_id, aspect, alpha, NULL, miplevel, draw_size, nocreate, FALSE);
|
||||
int draw_size = get_draw_size(size);
|
||||
icon_draw_size(x, y, icon_id, aspect, alpha, NULL, size, draw_size, nocreate, FALSE);
|
||||
}
|
||||
|
||||
void UI_icon_draw_aspect(float x, float y, int icon_id, float aspect, float alpha)
|
||||
{
|
||||
icon_draw_mipmap(x, y, icon_id, aspect, alpha, PREVIEW_MIPMAP_ZERO, 0);
|
||||
icon_draw_at_size(x, y, icon_id, aspect, alpha, ICON_SIZE_ICON, 0);
|
||||
}
|
||||
|
||||
void UI_icon_draw_aspect_color(float x, float y, int icon_id, float aspect, float *rgb)
|
||||
{
|
||||
int draw_size = preview_size(PREVIEW_MIPMAP_ZERO);
|
||||
icon_draw_size(x, y, icon_id, aspect, 1.0f, rgb, PREVIEW_MIPMAP_ZERO, draw_size, FALSE, FALSE);
|
||||
int draw_size = get_draw_size(ICON_SIZE_ICON);
|
||||
icon_draw_size(x, y, icon_id, aspect, 1.0f, rgb, ICON_SIZE_ICON, draw_size, FALSE, FALSE);
|
||||
}
|
||||
|
||||
void UI_icon_draw(float x, float y, int icon_id)
|
||||
@@ -1137,21 +1139,21 @@ void UI_icon_draw(float x, float y, int icon_id)
|
||||
|
||||
void UI_icon_draw_size(float x, float y, int size, int icon_id, float alpha)
|
||||
{
|
||||
icon_draw_size(x, y, icon_id, 1.0f, alpha, NULL, PREVIEW_MIPMAP_ZERO, size, TRUE, FALSE);
|
||||
icon_draw_size(x, y, icon_id, 1.0f, alpha, NULL, ICON_SIZE_ICON, size, TRUE, FALSE);
|
||||
}
|
||||
|
||||
void UI_icon_draw_preview(float x, float y, int icon_id)
|
||||
{
|
||||
icon_draw_mipmap(x, y, icon_id, 1.0f, 1.0f, PREVIEW_MIPMAP_LARGE, 0);
|
||||
icon_draw_at_size(x, y, icon_id, 1.0f, 1.0f, ICON_SIZE_PREVIEW, 0);
|
||||
}
|
||||
|
||||
void UI_icon_draw_preview_aspect(float x, float y, int icon_id, float aspect)
|
||||
{
|
||||
icon_draw_mipmap(x, y, icon_id, aspect, 1.0f, PREVIEW_MIPMAP_LARGE, 0);
|
||||
icon_draw_at_size(x, y, icon_id, aspect, 1.0f, ICON_SIZE_PREVIEW, 0);
|
||||
}
|
||||
|
||||
void UI_icon_draw_preview_aspect_size(float x, float y, int icon_id, float aspect, int size)
|
||||
{
|
||||
icon_draw_size(x, y, icon_id, aspect, 1.0f, NULL, PREVIEW_MIPMAP_LARGE, size, FALSE, TRUE);
|
||||
icon_draw_size(x, y, icon_id, aspect, 1.0f, NULL, ICON_SIZE_PREVIEW, size, FALSE, TRUE);
|
||||
}
|
||||
|
||||
|
@@ -97,7 +97,7 @@ static int eyedropper_cancel(bContext *C, wmOperator *op)
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
static void eyedropper_sample(bContext *C, Eyedropper *eye, short mx, short my)
|
||||
static void eyedropper_sample(bContext *C, Eyedropper *eye, int mx, int my)
|
||||
{
|
||||
if(RNA_property_type(eye->prop) == PROP_FLOAT) {
|
||||
const int color_manage = CTX_data_scene(C)->r.color_mgt_flag & R_COLOR_MANAGEMENT;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user