forked from bartvdbraak/blender
Merged changes in the trunk up to revision 40299.
This commit is contained in:
commit
70821c6b24
@ -642,11 +642,7 @@ elseif(WIN32)
|
||||
set(GETTEXT ${LIBDIR}/gettext)
|
||||
set(GETTEXT_INC ${GETTEXT}/include)
|
||||
set(GETTEXT_LIBPATH ${GETTEXT}/lib)
|
||||
if(CMAKE_CL_64)
|
||||
set(GETTEXT_LIB gettext)
|
||||
else()
|
||||
set(GETTEXT_LIB gnu_gettext)
|
||||
endif()
|
||||
set(GETTEXT_LIB gnu_gettext)
|
||||
endif()
|
||||
|
||||
if(CMAKE_CL_64)
|
||||
|
19
GNUmakefile
19
GNUmakefile
@ -126,6 +126,11 @@ help:
|
||||
@echo " * test_pep8 - checks all python script are pep8 which are tagged to use the stricter formatting"
|
||||
@echo " * test_deprecated - checks for deprecation tags in our code which may need to be removed"
|
||||
@echo ""
|
||||
@echo "Static Source Code Checking (not assosiated with building blender)"
|
||||
@echo " * check_cppcheck - run blender source through cppcheck (C & C++)"
|
||||
@echo " * check_splint - run blenders source through splint (C only)"
|
||||
@echo " * check_sparse - run blenders source through sparse (C only)"
|
||||
@echo ""
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Packages
|
||||
@ -176,6 +181,20 @@ project_eclipse:
|
||||
cmake -G"Eclipse CDT4 - Unix Makefiles" -H$(BLENDER_DIR) -B$(BUILD_DIR)
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Static Checking
|
||||
#
|
||||
|
||||
check_cppcheck:
|
||||
cd $(BUILD_DIR) ; python3 $(BLENDER_DIR)/build_files/cmake/cmake_static_check_cppcheck.py
|
||||
|
||||
check_splint:
|
||||
cd $(BUILD_DIR) ; python3 $(BLENDER_DIR)/build_files/cmake/cmake_static_check_splint.py
|
||||
|
||||
check_sparse:
|
||||
cd $(BUILD_DIR) ; python3 $(BLENDER_DIR)/build_files/cmake/cmake_static_check_sparse.py
|
||||
|
||||
|
||||
clean:
|
||||
$(MAKE) -C $(BUILD_DIR) clean
|
||||
|
||||
|
@ -645,7 +645,7 @@ else:
|
||||
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-vc', 'linuxcross'):
|
||||
dllsources = []
|
||||
|
||||
if not env['OURPLATFORM'] in ('win32-mingw', 'win64-vc', 'linuxcross'):
|
||||
if not env['OURPLATFORM'] in ('win32-mingw', 'linuxcross'):
|
||||
# For MinGW and linuxcross static linking will be used
|
||||
dllsources += ['${LCGDIR}/gettext/lib/gnu_gettext.dll']
|
||||
|
||||
|
@ -119,8 +119,8 @@ FOREACH(COMPONENT ${_opencollada_FIND_STATIC_COMPONENTS})
|
||||
# Ubuntu ppa needs this.
|
||||
lib64/opencollada lib/opencollada
|
||||
)
|
||||
MARK_AS_ADVANCED(OPENCOLLADA_${UPPERCOMPONENT}_LIBRARY)
|
||||
IF(OPENCOLLADA_${UPPERCOMPONENT}_LIBRARY)
|
||||
MARK_AS_ADVANCED(OPENCOLLADA_${UPPERCOMPONENT}_LIBRARY)
|
||||
LIST(APPEND _opencollada_LIBRARIES "${OPENCOLLADA_${UPPERCOMPONENT}_LIBRARY}")
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
|
@ -1,43 +1,69 @@
|
||||
# - Try to find the PCRE regular expression library
|
||||
# Once done this will define
|
||||
# - Find PCRE library
|
||||
# Find the native PCRE includes and library
|
||||
# This module defines
|
||||
# PCRE_INCLUDE_DIRS, where to find pcre.h, Set when
|
||||
# PCRE_INCLUDE_DIR is found.
|
||||
# PCRE_LIBRARIES, libraries to link against to use PCRE.
|
||||
# PCRE_ROOT_DIR, The base directory to search for PCRE.
|
||||
# This can also be an environment variable.
|
||||
# PCRE_FOUND, If false, do not try to use PCRE.
|
||||
#
|
||||
# PCRE_FOUND - system has the PCRE library
|
||||
# PCRE_INCLUDE_DIR - the PCRE include directory
|
||||
# PCRE_LIBRARIES - The libraries needed to use PCRE
|
||||
# also defined, but not for general use are
|
||||
# PCRE_LIBRARY, where to find the PCRE library.
|
||||
|
||||
# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
|
||||
#=============================================================================
|
||||
# Copyright 2011 Blender Foundation.
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
|
||||
if (PCRE_INCLUDE_DIR AND PCRE_PCREPOSIX_LIBRARY AND PCRE_PCRE_LIBRARY)
|
||||
# Already in cache, be silent
|
||||
set(PCRE_FIND_QUIETLY TRUE)
|
||||
endif (PCRE_INCLUDE_DIR AND PCRE_PCREPOSIX_LIBRARY AND PCRE_PCRE_LIBRARY)
|
||||
|
||||
if (NOT WIN32)
|
||||
# use pkg-config to get the directories and then use these values
|
||||
# in the FIND_PATH() and FIND_LIBRARY() calls
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(PC_PCRE QUIET libpcre)
|
||||
set(PCRE_DEFINITIONS ${PC_PCRE_CFLAGS_OTHER})
|
||||
endif (NOT WIN32)
|
||||
|
||||
find_path(PCRE_INCLUDE_DIR pcre.h
|
||||
HINTS ${PC_PCRE_INCLUDEDIR} ${PC_PCRE_INCLUDE_DIRS}
|
||||
PATH_SUFFIXES pcre)
|
||||
|
||||
find_library(PCRE_PCRE_LIBRARY NAMES pcre HINTS ${PC_PCRE_LIBDIR} ${PC_PCRE_LIBRARY_DIRS})
|
||||
|
||||
find_library(PCRE_PCREPOSIX_LIBRARY NAMES pcreposix HINTS ${PC_PCRE_LIBDIR} ${PC_PCRE_LIBRARY_DIRS})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
IF(NOT WIN32)
|
||||
find_package_handle_standard_args(PCRE DEFAULT_MSG PCRE_INCLUDE_DIR PCRE_PCRE_LIBRARY PCRE_PCREPOSIX_LIBRARY )
|
||||
mark_as_advanced(PCRE_INCLUDE_DIR PCRE_LIBRARIES PCRE_PCREPOSIX_LIBRARY PCRE_PCRE_LIBRARY)
|
||||
set(PCRE_LIBRARIES ${PCRE_PCRE_LIBRARY} ${PCRE_PCREPOSIX_LIBRARY})
|
||||
ELSE()
|
||||
find_package_handle_standard_args(PCRE DEFAULT_MSG PCRE_INCLUDE_DIR PCRE_PCRE_LIBRARY )
|
||||
set(PCRE_LIBRARIES ${PCRE_PCRE_LIBRARY} )
|
||||
mark_as_advanced(PCRE_INCLUDE_DIR PCRE_LIBRARIES PCRE_PCRE_LIBRARY)
|
||||
# If PCRE_ROOT_DIR was defined in the environment, use it.
|
||||
IF(NOT PCRE_ROOT_DIR AND NOT $ENV{PCRE_ROOT_DIR} STREQUAL "")
|
||||
SET(PCRE_ROOT_DIR $ENV{PCRE_ROOT_DIR})
|
||||
ENDIF()
|
||||
|
||||
SET(_pcre_SEARCH_DIRS
|
||||
${PCRE_ROOT_DIR}
|
||||
/usr/local
|
||||
/sw # Fink
|
||||
/opt/local # DarwinPorts
|
||||
/opt/csw # Blastwave
|
||||
)
|
||||
|
||||
FIND_PATH(PCRE_INCLUDE_DIR pcre.h
|
||||
HINTS
|
||||
${_pcre_SEARCH_DIRS}
|
||||
PATH_SUFFIXES
|
||||
include
|
||||
include
|
||||
)
|
||||
|
||||
FIND_LIBRARY(PCRE_LIBRARY
|
||||
NAMES
|
||||
pcre
|
||||
HINTS
|
||||
${_pcre_SEARCH_DIRS}
|
||||
PATH_SUFFIXES
|
||||
lib64 lib
|
||||
)
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set PCRE_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PCRE DEFAULT_MSG
|
||||
PCRE_LIBRARY PCRE_INCLUDE_DIR)
|
||||
|
||||
IF(PCRE_FOUND)
|
||||
SET(PCRE_LIBRARIES ${PCRE_LIBRARY})
|
||||
SET(PCRE_INCLUDE_DIRS ${PCRE_INCLUDE_DIR})
|
||||
ENDIF(PCRE_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
PCRE_INCLUDE_DIR
|
||||
PCRE_LIBRARY
|
||||
)
|
||||
|
@ -1,88 +1,68 @@
|
||||
# - Try to find XML2
|
||||
# Once done this will define
|
||||
#
|
||||
# XML2_FOUND - system has XML2
|
||||
# XML2_INCLUDE_DIRS - the XML2 include directory
|
||||
# XML2_LIBRARIES - Link these to use XML2
|
||||
# XML2_DEFINITIONS - Compiler switches required for using XML2
|
||||
#
|
||||
# Copyright (c) 2008 Andreas Schneider <mail@cynapses.org>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the New
|
||||
# BSD license.
|
||||
# - Find XML2 library
|
||||
# Find the native XML2 includes and library
|
||||
# This module defines
|
||||
# XML2_INCLUDE_DIRS, where to find xml2.h, Set when
|
||||
# XML2_INCLUDE_DIR is found.
|
||||
# XML2_LIBRARIES, libraries to link against to use XML2.
|
||||
# XML2_ROOT_DIR, The base directory to search for XML2.
|
||||
# This can also be an environment variable.
|
||||
# XML2_FOUND, If false, do not try to use XML2.
|
||||
#
|
||||
# also defined, but not for general use are
|
||||
# XML2_LIBRARY, where to find the XML2 library.
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2011 Blender Foundation.
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
|
||||
if (XML2_LIBRARIES AND XML2_INCLUDE_DIRS)
|
||||
# in cache already
|
||||
set(XML2_FOUND TRUE)
|
||||
else (XML2_LIBRARIES AND XML2_INCLUDE_DIRS)
|
||||
# use pkg-config to get the directories and then use these values
|
||||
# in the FIND_PATH() and FIND_LIBRARY() calls
|
||||
if (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
|
||||
include(UsePkgConfig)
|
||||
pkgconfig(libxml-2.0 _XML2_INCLUDEDIR _XML2_LIBDIR _XML2_LDFLAGS _XML2_CFLAGS)
|
||||
else (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
|
||||
find_package(PkgConfig)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(_XML2 libxml-2.0)
|
||||
endif (PKG_CONFIG_FOUND)
|
||||
endif (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
|
||||
find_path(XML2_INCLUDE_DIR
|
||||
NAMES
|
||||
libxml/xpath.h
|
||||
PATHS
|
||||
${_XML2_INCLUDEDIR}
|
||||
/usr/include
|
||||
/usr/local/include
|
||||
/opt/local/include
|
||||
/sw/include
|
||||
PATH_SUFFIXES
|
||||
libxml2
|
||||
# If XML2_ROOT_DIR was defined in the environment, use it.
|
||||
IF(NOT XML2_ROOT_DIR AND NOT $ENV{XML2_ROOT_DIR} STREQUAL "")
|
||||
SET(XML2_ROOT_DIR $ENV{XML2_ROOT_DIR})
|
||||
ENDIF()
|
||||
|
||||
SET(_xml2_SEARCH_DIRS
|
||||
${XML2_ROOT_DIR}
|
||||
/usr/local
|
||||
/sw # Fink
|
||||
/opt/local # DarwinPorts
|
||||
/opt/csw # Blastwave
|
||||
)
|
||||
|
||||
FIND_PATH(XML2_INCLUDE_DIR libxml2/libxml/xpath.h
|
||||
HINTS
|
||||
${_xml2_SEARCH_DIRS}
|
||||
PATH_SUFFIXES
|
||||
include
|
||||
)
|
||||
|
||||
FIND_LIBRARY(XML2_LIBRARY
|
||||
NAMES
|
||||
xml2
|
||||
HINTS
|
||||
${_xml2_SEARCH_DIRS}
|
||||
PATH_SUFFIXES
|
||||
lib64 lib
|
||||
)
|
||||
|
||||
find_library(XML2_LIBRARY
|
||||
NAMES
|
||||
xml2
|
||||
PATHS
|
||||
${_XML2_LIBDIR}
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
/opt/local/lib
|
||||
/sw/lib
|
||||
)
|
||||
# handle the QUIETLY and REQUIRED arguments and set XML2_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(XML2 DEFAULT_MSG
|
||||
XML2_LIBRARY XML2_INCLUDE_DIR)
|
||||
|
||||
if (XML2_LIBRARY)
|
||||
set(XML2_FOUND TRUE)
|
||||
endif (XML2_LIBRARY)
|
||||
|
||||
set(XML2_INCLUDE_DIRS
|
||||
${XML2_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
if (XML2_FOUND)
|
||||
set(XML2_LIBRARIES
|
||||
${XML2_LIBRARIES}
|
||||
${XML2_LIBRARY}
|
||||
)
|
||||
endif (XML2_FOUND)
|
||||
|
||||
if (XML2_INCLUDE_DIRS AND XML2_LIBRARIES)
|
||||
set(XML2_FOUND TRUE)
|
||||
endif (XML2_INCLUDE_DIRS AND XML2_LIBRARIES)
|
||||
|
||||
if (XML2_FOUND)
|
||||
if (NOT XML2_FIND_QUIETLY)
|
||||
message(STATUS "Found XML2: ${XML2_LIBRARIES}")
|
||||
endif (NOT XML2_FIND_QUIETLY)
|
||||
else (XML2_FOUND)
|
||||
if (XML2_FIND_REQUIRED)
|
||||
message(FATAL_ERROR "Could not find XML2")
|
||||
endif (XML2_FIND_REQUIRED)
|
||||
endif (XML2_FOUND)
|
||||
|
||||
# show the XML2_INCLUDE_DIRS and XML2_LIBRARIES variables only in the advanced view
|
||||
mark_as_advanced(XML2_INCLUDE_DIRS XML2_LIBRARIES)
|
||||
|
||||
endif (XML2_LIBRARIES AND XML2_INCLUDE_DIRS)
|
||||
IF(XML2_FOUND)
|
||||
SET(XML2_LIBRARIES ${XML2_LIBRARY})
|
||||
SET(XML2_INCLUDE_DIRS ${XML2_INCLUDE_DIR})
|
||||
ENDIF(XML2_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
XML2_INCLUDE_DIR
|
||||
XML2_LIBRARY
|
||||
)
|
||||
|
76
build_files/cmake/cmake_static_check_cppcheck.py
Normal file
76
build_files/cmake/cmake_static_check_cppcheck.py
Normal file
@ -0,0 +1,76 @@
|
||||
#!/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
|
||||
#
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
|
||||
# <pep8 compliant>
|
||||
|
||||
import project_source_info
|
||||
import subprocess
|
||||
import sys
|
||||
import os
|
||||
|
||||
CHECKER_IGNORE_PREFIX = [
|
||||
"extern",
|
||||
"intern/moto",
|
||||
]
|
||||
|
||||
CHECKER_BIN = "cppcheck"
|
||||
|
||||
CHECKER_ARGS = [
|
||||
# not sure why this is needed, but it is.
|
||||
"-I" + os.path.join(project_source_info.SOURCE_DIR, "extern/glew/include"),
|
||||
|
||||
# "--check-config", # when includes are missing
|
||||
# "--enable=all", # if you want sixty hundred pedantic suggestions
|
||||
]
|
||||
|
||||
def main():
|
||||
source_info = project_source_info.build_info(ignore_prefix_list=CHECKER_IGNORE_PREFIX)
|
||||
|
||||
check_commands = []
|
||||
for c, inc_dirs, defs in source_info:
|
||||
cmd = ([CHECKER_BIN] +
|
||||
CHECKER_ARGS +
|
||||
[c] +
|
||||
[("-I%s" % i) for i in inc_dirs] +
|
||||
[("-D%s" % d) for d in defs]
|
||||
)
|
||||
|
||||
check_commands.append((c, cmd))
|
||||
|
||||
for i, (c, cmd) in enumerate(check_commands):
|
||||
percent = 100.0 * (i / (len(check_commands)-1))
|
||||
percent_str = "[" + ("%.2f]" % percent).rjust(7) + " %:"
|
||||
|
||||
# if percent < 27.9:
|
||||
# continue
|
||||
|
||||
# let cppcheck finish the line off...
|
||||
sys.stdout.write("%s " % percent_str)
|
||||
|
||||
sys.stdout.flush()
|
||||
process = subprocess.Popen(cmd)
|
||||
process.wait()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
66
build_files/cmake/cmake_static_check_sparse.py
Normal file
66
build_files/cmake/cmake_static_check_sparse.py
Normal file
@ -0,0 +1,66 @@
|
||||
#!/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
|
||||
#
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
|
||||
# <pep8 compliant>
|
||||
|
||||
CHECKER_IGNORE_PREFIX = [
|
||||
"extern",
|
||||
"intern/moto",
|
||||
]
|
||||
|
||||
CHECKER_BIN = "sparse"
|
||||
CHECKER_ARGS = [
|
||||
]
|
||||
|
||||
import project_source_info
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
||||
def main():
|
||||
source_info = project_source_info.build_info(use_cxx=False, ignore_prefix_list=CHECKER_IGNORE_PREFIX)
|
||||
|
||||
check_commands = []
|
||||
for c, inc_dirs, defs in source_info:
|
||||
|
||||
cmd = ([CHECKER_BIN] +
|
||||
CHECKER_ARGS +
|
||||
[c] +
|
||||
[("-I%s" % i) for i in inc_dirs] +
|
||||
[("-D%s" % d) for d in defs]
|
||||
)
|
||||
|
||||
check_commands.append((c, cmd))
|
||||
|
||||
for i, (c, cmd) in enumerate(check_commands):
|
||||
percent = 100.0 * (i / (len(check_commands) - 1))
|
||||
percent_str = "[" + ("%.2f]" % percent).rjust(7) + " %:"
|
||||
|
||||
sys.stdout.write("%s %s\n" % (percent_str, c))
|
||||
sys.stdout.flush()
|
||||
|
||||
process = subprocess.Popen(cmd)
|
||||
process.wait()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
94
build_files/cmake/cmake_static_check_splint.py
Normal file
94
build_files/cmake/cmake_static_check_splint.py
Normal file
@ -0,0 +1,94 @@
|
||||
#!/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
|
||||
#
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
|
||||
# <pep8 compliant>
|
||||
|
||||
CHECKER_IGNORE_PREFIX = [
|
||||
"extern",
|
||||
"intern/moto",
|
||||
]
|
||||
|
||||
CHECKER_BIN = "splint"
|
||||
|
||||
CHECKER_ARGS = [
|
||||
"-weak",
|
||||
"-posix-lib",
|
||||
"-linelen", "10000",
|
||||
"+ignorequals",
|
||||
"+relaxtypes",
|
||||
"-retvalother",
|
||||
"+matchanyintegral",
|
||||
"+longintegral",
|
||||
"+ignoresigns",
|
||||
"-nestcomment",
|
||||
"-predboolothers",
|
||||
"-ifempty",
|
||||
"-unrecogcomments",
|
||||
|
||||
# we may want to remove these later
|
||||
"-type",
|
||||
"-fixedformalarray",
|
||||
"-fullinitblock",
|
||||
"-fcnuse",
|
||||
"-initallelements",
|
||||
"-castfcnptr",
|
||||
# -forcehints,
|
||||
"-bufferoverflowhigh", # warns a lot about sprintf()
|
||||
|
||||
# re-definitions, rna causes most of these
|
||||
"-redef",
|
||||
"-syntax",
|
||||
]
|
||||
|
||||
|
||||
import project_source_info
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
||||
def main():
|
||||
source_info = project_source_info.build_info(use_cxx=False, ignore_prefix_list=CHECKER_IGNORE_PREFIX)
|
||||
|
||||
check_commands = []
|
||||
for c, inc_dirs, defs in source_info:
|
||||
cmd = ([CHECKER_BIN] +
|
||||
CHECKER_ARGS +
|
||||
[c] +
|
||||
[("-I%s" % i) for i in inc_dirs] +
|
||||
[("-D%s" % d) for d in defs]
|
||||
)
|
||||
|
||||
check_commands.append((c, cmd))
|
||||
|
||||
for i, (c, cmd) in enumerate(check_commands):
|
||||
percent = 100.0 * (i / (len(check_commands) - 1))
|
||||
percent_str = "[" + ("%.2f]" % percent).rjust(7) + " %:"
|
||||
|
||||
sys.stdout.write("%s %s\n" % (percent_str, c))
|
||||
sys.stdout.flush()
|
||||
|
||||
process = subprocess.Popen(cmd)
|
||||
process.wait()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
165
build_files/cmake/project_source_info.py
Normal file
165
build_files/cmake/project_source_info.py
Normal file
@ -0,0 +1,165 @@
|
||||
# $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
|
||||
#
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
|
||||
# <pep8 compliant>
|
||||
|
||||
__all__ = (
|
||||
"build_info",
|
||||
"SOURCE_DIR",
|
||||
)
|
||||
|
||||
import os
|
||||
import sys
|
||||
from os.path import join, dirname, normpath, abspath
|
||||
|
||||
SOURCE_DIR = join(dirname(__file__), "..", "..")
|
||||
SOURCE_DIR = normpath(SOURCE_DIR)
|
||||
SOURCE_DIR = abspath(SOURCE_DIR)
|
||||
|
||||
|
||||
def is_c_header(filename):
|
||||
ext = os.path.splitext(filename)[1]
|
||||
return (ext in (".h", ".hpp", ".hxx"))
|
||||
|
||||
|
||||
def is_c_header(filename):
|
||||
ext = os.path.splitext(filename)[1]
|
||||
return (ext in (".h", ".hpp", ".hxx"))
|
||||
|
||||
|
||||
def is_c(filename):
|
||||
ext = os.path.splitext(filename)[1]
|
||||
return (ext in (".c", ".cpp", ".cxx", ".m", ".mm", ".rc"))
|
||||
|
||||
|
||||
def is_c_any(filename):
|
||||
return os.path.s_c(filename) or is_c_header(filename)
|
||||
|
||||
|
||||
# copied from project_info.py
|
||||
CMAKE_DIR = "."
|
||||
|
||||
|
||||
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 do_ignore(filepath, ignore_prefix_list):
|
||||
if ignore_prefix_list is None:
|
||||
return False
|
||||
|
||||
relpath = os.path.relpath(filepath, SOURCE_DIR)
|
||||
return any([relpath.startswith(prefix) for prefix in ignore_prefix_list])
|
||||
|
||||
|
||||
def makefile_log():
|
||||
import subprocess
|
||||
# Check blender is not 2.5x until it supports playback again
|
||||
print("running make with --dry-run ...")
|
||||
process = subprocess.Popen(["make", "--always-make", "--dry-run", "--keep-going", "VERBOSE=1"],
|
||||
stdout=subprocess.PIPE,
|
||||
)
|
||||
|
||||
while process.poll():
|
||||
time.sleep(1)
|
||||
|
||||
out = process.stdout.read()
|
||||
process.stdout.close()
|
||||
print("done!", len(out), "bytes")
|
||||
return out.decode("ascii").split("\n")
|
||||
|
||||
|
||||
def build_info(use_c=True, use_cxx=True, ignore_prefix_list=None):
|
||||
|
||||
makelog = makefile_log()
|
||||
|
||||
source = []
|
||||
|
||||
compilers = []
|
||||
if use_c:
|
||||
compilers.append(cmake_cache_var("CMAKE_C_COMPILER"))
|
||||
if use_cxx:
|
||||
compilers.append(cmake_cache_var("CMAKE_CXX_COMPILER"))
|
||||
|
||||
print("compilers:", " ".join(compilers))
|
||||
|
||||
fake_compiler = "%COMPILER%"
|
||||
|
||||
print("parsing make log ...")
|
||||
|
||||
for line in makelog:
|
||||
|
||||
args = line.split()
|
||||
|
||||
if not any([(c in args) for c in compilers]):
|
||||
continue
|
||||
|
||||
# join args incase they are not.
|
||||
args = ' '.join(args)
|
||||
args = args.replace(" -isystem", " -I")
|
||||
args = args.replace(" -D ", " -D")
|
||||
args = args.replace(" -I ", " -I")
|
||||
|
||||
for c in compilers:
|
||||
args = args.replace(c, fake_compiler)
|
||||
args = args.split()
|
||||
# end
|
||||
|
||||
# remove compiler
|
||||
args[:args.index(fake_compiler) + 1] = []
|
||||
|
||||
c_files = [f for f in args if is_c(f)]
|
||||
inc_dirs = [f[2:].strip() for f in args if f.startswith('-I')]
|
||||
defs = [f[2:].strip() for f in args if f.startswith('-D')]
|
||||
for c in sorted(c_files):
|
||||
|
||||
if do_ignore(c, ignore_prefix_list):
|
||||
continue
|
||||
|
||||
source.append((c, inc_dirs, defs))
|
||||
|
||||
# safety check that our includes are ok
|
||||
for f in inc_dirs:
|
||||
if not os.path.exists(f):
|
||||
raise Exception("%s missing" % f)
|
||||
|
||||
print("done!")
|
||||
|
||||
return source
|
||||
|
||||
|
||||
def main():
|
||||
if not os.path.exists(join(CMAKE_DIR, "CMakeCache.txt")):
|
||||
print("This script must run from the cmake build dir")
|
||||
return
|
||||
|
||||
for s in build_info():
|
||||
print(s)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
@ -100,7 +100,7 @@ WITH_BF_INTERNATIONAL = False
|
||||
|
||||
BF_GETTEXT = LIBDIR + '/gettext'
|
||||
BF_GETTEXT_INC = '${BF_GETTEXT}/include'
|
||||
BF_GETTEXT_LIB = 'gettext'
|
||||
BF_GETTEXT_LIB = 'gnu_gettext'
|
||||
BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
|
||||
|
||||
WITH_BF_GAMEENGINE = True
|
||||
|
@ -1,6 +1,4 @@
|
||||
"""
|
||||
User Clear
|
||||
++++++++++
|
||||
This function is for advanced use only, misuse can crash blender since the user
|
||||
count is used to prevent data being removed when it is used.
|
||||
"""
|
||||
|
@ -24,6 +24,14 @@ There are 3 main uses for the terminal, these are:
|
||||
For Linux and OSX users this means starting the terminal first, then running blender from within it. On Windows the terminal can be enabled from the help menu.
|
||||
|
||||
|
||||
Show All Operators
|
||||
==================
|
||||
|
||||
While blender logs operators in the Info space, this only reports operators with the ``REGISTER`` option enabeld so as not to flood the Info view with calls to ``bpy.ops.view3d.smoothview`` and ``bpy.ops.view3d.zoom``.
|
||||
|
||||
However, for testing it can be useful to see **every** operator called in a terminal, do this by enabling the debug option either by passing the ``--debug`` argument when starting blender or by setting :mod:`bpy.app.debug` to True while blender is running.
|
||||
|
||||
|
||||
Use an External Editor
|
||||
======================
|
||||
|
||||
|
@ -76,7 +76,7 @@ else:
|
||||
"bpy.props",
|
||||
"bpy.utils",
|
||||
"bpy.context",
|
||||
"bpy.types", # supports filtering
|
||||
# "bpy.types", # supports filtering
|
||||
"bpy.ops", # supports filtering
|
||||
"bpy_extras",
|
||||
"bge",
|
||||
@ -88,7 +88,7 @@ else:
|
||||
"Freestyle",
|
||||
)
|
||||
|
||||
FILTER_BPY_TYPES = ("bpy_struct", "Panel", "ID") # allow
|
||||
FILTER_BPY_TYPES = ("bpy_struct", "Operator", "ID") # allow
|
||||
FILTER_BPY_OPS = ("import.scene", ) # allow
|
||||
|
||||
# for quick rebuilds
|
||||
@ -629,6 +629,30 @@ def pycontext2sphinx(BASEPATH):
|
||||
file.close()
|
||||
|
||||
|
||||
def pyrna_enum2sphinx(prop, use_empty_descriptions=False):
|
||||
""" write a bullet point list of enum + descrptons
|
||||
"""
|
||||
|
||||
if use_empty_descriptions:
|
||||
ok = True
|
||||
else:
|
||||
ok = False
|
||||
for identifier, name, description in prop.enum_items:
|
||||
if description:
|
||||
ok = True
|
||||
break
|
||||
|
||||
if ok:
|
||||
return "".join(["* ``%s`` %s.\n" %
|
||||
(identifier,
|
||||
", ".join(val for val in (name, description) if val),
|
||||
)
|
||||
for identifier, name, description in prop.enum_items
|
||||
])
|
||||
else:
|
||||
return ""
|
||||
|
||||
|
||||
def pyrna2sphinx(BASEPATH):
|
||||
""" bpy.types and bpy.ops
|
||||
"""
|
||||
@ -656,8 +680,22 @@ def pyrna2sphinx(BASEPATH):
|
||||
kwargs["collection_id"] = _BPY_PROP_COLLECTION_ID
|
||||
|
||||
type_descr = prop.get_type_description(**kwargs)
|
||||
if prop.name or prop.description:
|
||||
fw(ident + ":%s%s: %s\n" % (id_name, identifier, ", ".join(val for val in (prop.name, prop.description) if val)))
|
||||
|
||||
enum_text = pyrna_enum2sphinx(prop)
|
||||
|
||||
if prop.name or prop.description or enum_text:
|
||||
fw(ident + ":%s%s:\n\n" % (id_name, identifier))
|
||||
|
||||
if prop.name or prop.description:
|
||||
fw(ident + " " + ", ".join(val for val in (prop.name, prop.description) if val) + "\n\n")
|
||||
|
||||
# special exception, cant use genric code here for enums
|
||||
if enum_text:
|
||||
write_indented_lines(ident + " ", fw, enum_text)
|
||||
fw("\n")
|
||||
del enum_text
|
||||
# end enum exception
|
||||
|
||||
fw(ident + ":%s%s: %s\n" % (id_type, identifier, type_descr))
|
||||
|
||||
def write_struct(struct):
|
||||
@ -735,6 +773,16 @@ def pyrna2sphinx(BASEPATH):
|
||||
fw(" .. attribute:: %s\n\n" % prop.identifier)
|
||||
if prop.description:
|
||||
fw(" %s\n\n" % prop.description)
|
||||
|
||||
# special exception, cant use genric code here for enums
|
||||
if prop.type == "enum":
|
||||
enum_text = pyrna_enum2sphinx(prop)
|
||||
if enum_text:
|
||||
write_indented_lines(" ", fw, enum_text)
|
||||
fw("\n")
|
||||
del enum_text
|
||||
# end enum exception
|
||||
|
||||
fw(" :type: %s\n\n" % type_descr)
|
||||
|
||||
# python attributes
|
||||
@ -758,6 +806,7 @@ def pyrna2sphinx(BASEPATH):
|
||||
elif func.return_values: # multiple return values
|
||||
fw(" :return (%s):\n" % ", ".join(prop.identifier for prop in func.return_values))
|
||||
for prop in func.return_values:
|
||||
# TODO, pyrna_enum2sphinx for multiple return values... actually dont think we even use this but still!!!
|
||||
type_descr = prop.get_type_description(as_ret=True, class_fmt=":class:`%s`", collection_id=_BPY_PROP_COLLECTION_ID)
|
||||
descr = prop.description
|
||||
if not descr:
|
||||
|
@ -9,6 +9,10 @@
|
||||
|
||||
# disable for testing
|
||||
DO_UPLOAD=true
|
||||
DO_EXE_BLENDER=true
|
||||
DO_OUT_HTML=true
|
||||
DO_OUT_PDF=true
|
||||
|
||||
|
||||
BLENDER="./blender.bin"
|
||||
SSH_USER="ideasman42"
|
||||
@ -36,28 +40,39 @@ fi
|
||||
|
||||
SSH_UPLOAD_FULL=$SSH_UPLOAD/"blender_python_api_"$BLENDER_VERSION
|
||||
|
||||
SPHINXBASE=doc/python_api/
|
||||
SPHINXBASE=doc/python_api
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Generate reStructuredText (blender/python only)
|
||||
|
||||
# dont delete existing docs, now partial updates are used for quick builds.
|
||||
$BLENDER --background --factory-startup --python $SPHINXBASE/sphinx_doc_gen.py
|
||||
if $DO_EXE_BLENDER ; then
|
||||
# dont delete existing docs, now partial updates are used for quick builds.
|
||||
$BLENDER --background --factory-startup --python $SPHINXBASE/sphinx_doc_gen.py
|
||||
fi
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Generate HTML (sphinx)
|
||||
|
||||
sphinx-build -n -b html $SPHINXBASE/sphinx-in $SPHINXBASE/sphinx-out
|
||||
if $DO_OUT_HTML ; then
|
||||
# sphinx-build -n -b html $SPHINXBASE/sphinx-in $SPHINXBASE/sphinx-out
|
||||
|
||||
# annoying bug in sphinx makes it very slow unless we do this. should report.
|
||||
cd $SPHINXBASE
|
||||
sphinx-build -n -b html sphinx-in sphinx-out
|
||||
cd -
|
||||
fi
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Generate PDF (sphinx/laytex)
|
||||
|
||||
sphinx-build -n -b latex $SPHINXBASE/sphinx-in $SPHINXBASE/sphinx-out
|
||||
make -C $SPHINXBASE/sphinx-out
|
||||
mv $SPHINXBASE/sphinx-out/contents.pdf $SPHINXBASE/sphinx-out/blender_python_reference_$BLENDER_VERSION.pdf
|
||||
if $DO_OUT_PDF ; then
|
||||
sphinx-build -n -b latex $SPHINXBASE/sphinx-in $SPHINXBASE/sphinx-out
|
||||
make -C $SPHINXBASE/sphinx-out
|
||||
mv $SPHINXBASE/sphinx-out/contents.pdf $SPHINXBASE/sphinx-out/blender_python_reference_$BLENDER_VERSION.pdf
|
||||
fi
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Upload to blender servers, comment this section for testing
|
||||
@ -85,5 +100,5 @@ fi
|
||||
|
||||
echo ""
|
||||
echo "Finished! view the docs from: "
|
||||
echo " html:" $SPHINXBASE/sphinx-out/contents.html
|
||||
echo " pdf:" $SPHINXBASE/sphinx-out/blender_python_reference_$BLENDER_VERSION.pdf
|
||||
if $DO_OUT_HTML ; then echo " html:" $SPHINXBASE/sphinx-out/contents.html ; fi
|
||||
if $DO_OUT_PDF ; then echo " pdf:" $SPHINXBASE/sphinx-out/blender_python_reference_$BLENDER_VERSION.pdf ; fi
|
||||
|
@ -94,12 +94,12 @@ static int circumCircle(const float xp, const float yp,
|
||||
|
||||
return (drsqr <= rsqr) ? 1 : 0;
|
||||
}
|
||||
#ifdef FREE_WINDOWS
|
||||
static float *_mingw_verts;
|
||||
|
||||
static float *_qsort_verts;
|
||||
static int ptcmp(const void *v1, const void *v2)
|
||||
{
|
||||
const float* p1 = &_mingw_verts[(*(const int*)v1)*3];
|
||||
const float* p2 = &_mingw_verts[(*(const int*)v2)*3];
|
||||
const float* p1 = &_qsort_verts[(*(const int*)v1)*3];
|
||||
const float* p2 = &_qsort_verts[(*(const int*)v2)*3];
|
||||
if (p1[0] < p2[0])
|
||||
return -1;
|
||||
else if (p1[0] > p2[0])
|
||||
@ -107,26 +107,6 @@ static int ptcmp(const void *v1, const void *v2)
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
#if defined(_MSC_VER)
|
||||
static int ptcmp(void* up, const void *v1, const void *v2)
|
||||
#elif defined(__APPLE__) || defined(__FreeBSD__)
|
||||
static int ptcmp(void* up, const void *v1, const void *v2)
|
||||
#else
|
||||
static int ptcmp(const void *v1, const void *v2, void* up)
|
||||
#endif
|
||||
{
|
||||
const float* verts = (const float*)up;
|
||||
const float* p1 = &verts[(*(const int*)v1)*3];
|
||||
const float* p2 = &verts[(*(const int*)v2)*3];
|
||||
if (p1[0] < p2[0])
|
||||
return -1;
|
||||
else if (p1[0] > p2[0])
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Based on Paul Bourke's triangulate.c
|
||||
// http://astronomy.swin.edu.au/~pbourke/terrain/triangulate/triangulate.c
|
||||
@ -136,16 +116,8 @@ static void delaunay(const int nv, float *verts, rcIntArray& idx, rcIntArray& tr
|
||||
idx.resize(nv);
|
||||
for (int i = 0; i < nv; ++i)
|
||||
idx[i] = i;
|
||||
#if defined(_MSC_VER)
|
||||
qsort_s(&idx[0], idx.size(), sizeof(int), ptcmp, verts);
|
||||
#elif defined(__APPLE__) || defined(__FreeBSD__)
|
||||
qsort_r(&idx[0], idx.size(), sizeof(int), verts, ptcmp);
|
||||
#elif defined(FREE_WINDOWS)
|
||||
_mingw_verts = verts;
|
||||
_qsort_verts = verts;
|
||||
qsort(&idx[0], idx.size(), sizeof(int), ptcmp);
|
||||
#else
|
||||
qsort_r(&idx[0], idx.size(), sizeof(int), ptcmp, verts);
|
||||
#endif
|
||||
|
||||
// Find the maximum and minimum vertex bounds.
|
||||
// This is to allow calculation of the bounding triangle
|
||||
|
@ -207,7 +207,7 @@ class InfoPropertyRNA:
|
||||
self.fixed_type = None
|
||||
|
||||
if self.type == "enum":
|
||||
self.enum_items[:] = rna_prop.enum_items.keys()
|
||||
self.enum_items[:] = [(item.identifier, item.name, item.description) for item in rna_prop.enum_items]
|
||||
self.is_enum_flag = rna_prop.is_enum_flag
|
||||
else:
|
||||
self.is_enum_flag = False
|
||||
@ -264,9 +264,9 @@ class InfoPropertyRNA:
|
||||
type_str += " in [%s, %s]" % (range_str(self.min), range_str(self.max))
|
||||
elif self.type == "enum":
|
||||
if self.is_enum_flag:
|
||||
type_str += " set in {%s}" % ", ".join(("'%s'" % s) for s in self.enum_items)
|
||||
type_str += " set in {%s}" % ", ".join(("'%s'" % s[0]) for s in self.enum_items)
|
||||
else:
|
||||
type_str += " in [%s]" % ", ".join(("'%s'" % s) for s in self.enum_items)
|
||||
type_str += " in [%s]" % ", ".join(("'%s'" % s[0]) for s in self.enum_items)
|
||||
|
||||
if not (as_arg or as_ret):
|
||||
# write default property, ignore function args for this
|
||||
|
@ -486,6 +486,13 @@ static void blf_draw__start(FontBLF *font)
|
||||
|
||||
if (font->flags & BLF_ROTATION)
|
||||
glRotatef(font->angle, 0.0f, 0.0f, 1.0f);
|
||||
|
||||
if(font->shadow || font->blur)
|
||||
glGetFloatv(GL_CURRENT_COLOR, font->orig_col);
|
||||
|
||||
/* always bind the texture for the first glyph */
|
||||
font->tex_bind_state= -1;
|
||||
|
||||
}
|
||||
|
||||
static void blf_draw__end(void)
|
||||
|
@ -99,9 +99,10 @@ void blf_font_size(FontBLF *font, int size, int dpi)
|
||||
|
||||
static void blf_font_ensure_ascii_table(FontBLF *font)
|
||||
{
|
||||
GlyphBLF **glyph_ascii_table= font->glyph_cache->glyph_ascii_table;
|
||||
|
||||
/* build ascii on demand */
|
||||
if(font->glyph_cache->glyph_ascii_table['0']==NULL) {
|
||||
GlyphBLF **glyph_ascii_table= font->glyph_cache->glyph_ascii_table;
|
||||
if(glyph_ascii_table['0']==NULL) {
|
||||
GlyphBLF *g;
|
||||
unsigned int i;
|
||||
for(i=0; i<256; i++) {
|
||||
@ -125,7 +126,7 @@ static void blf_font_ensure_ascii_table(FontBLF *font)
|
||||
|
||||
#define BLF_UTF8_NEXT_FAST(font, g, str, i, c, glyph_ascii_table) \
|
||||
if(((c)= (str)[i]) < 0x80) { \
|
||||
g= glyph_ascii_table[c]; \
|
||||
g= (glyph_ascii_table)[c]; \
|
||||
i++; \
|
||||
} \
|
||||
else if ((c= blf_utf8_next((unsigned char *)(str), &(i)))) { \
|
||||
@ -212,7 +213,7 @@ void blf_font_draw_ascii(FontBLF *font, const char *str, unsigned int len)
|
||||
blf_font_ensure_ascii_table(font);
|
||||
|
||||
while ((c= *(str++)) && len--) {
|
||||
g= font->glyph_cache->glyph_ascii_table[c];
|
||||
g= glyph_ascii_table[c];
|
||||
|
||||
/* if we don't found a glyph, skip it. */
|
||||
if (!g)
|
||||
@ -401,7 +402,6 @@ void blf_font_boundbox(FontBLF *font, const char *str, rctf *box)
|
||||
|
||||
if (!font->glyph_cache)
|
||||
return;
|
||||
glyph_ascii_table= font->glyph_cache->glyph_ascii_table;
|
||||
|
||||
box->xmin= 32000.0f;
|
||||
box->xmax= -32000.0f;
|
||||
@ -415,6 +415,7 @@ void blf_font_boundbox(FontBLF *font, const char *str, rctf *box)
|
||||
g_prev= NULL;
|
||||
|
||||
blf_font_ensure_ascii_table(font);
|
||||
glyph_ascii_table= font->glyph_cache->glyph_ascii_table;
|
||||
|
||||
while (str[i]) {
|
||||
|
||||
|
@ -185,7 +185,7 @@ static void blf_glyph_cache_texture(FontBLF *font, GlyphCacheBLF *gc)
|
||||
memset((void *)buf, 0, tot_mem);
|
||||
|
||||
glGenTextures(1, &gc->textures[gc->cur_tex]);
|
||||
glBindTexture(GL_TEXTURE_2D, gc->textures[gc->cur_tex]);
|
||||
glBindTexture(GL_TEXTURE_2D, (font->tex_bind_state= gc->textures[gc->cur_tex]));
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
@ -326,23 +326,25 @@ static void blf_texture_draw(float uv[2][2], float dx, float y1, float dx1, floa
|
||||
|
||||
}
|
||||
|
||||
static void blf_texture5_draw(float uv[2][2], float x1, float y1, float x2, float y2)
|
||||
static void blf_texture5_draw(const float shadow_col[4], float uv[2][2], float x1, float y1, float x2, float y2)
|
||||
{
|
||||
float soft[25]= {
|
||||
1/60.0f, 1/60.0f, 2/60.0f, 1/60.0f, 1/60.0f,
|
||||
1/60.0f, 3/60.0f, 5/60.0f, 3/60.0f, 1/60.0f,
|
||||
2/60.0f, 5/60.0f, 8/60.0f, 5/60.0f, 2/60.0f,
|
||||
1/60.0f, 3/60.0f, 5/60.0f, 3/60.0f, 1/60.0f,
|
||||
1/60.0f, 1/60.0f, 2/60.0f, 1/60.0f, 1/60.0f};
|
||||
float soft[25]= {1/60.0f, 1/60.0f, 2/60.0f, 1/60.0f, 1/60.0f,
|
||||
1/60.0f, 3/60.0f, 5/60.0f, 3/60.0f, 1/60.0f,
|
||||
2/60.0f, 5/60.0f, 8/60.0f, 5/60.0f, 2/60.0f,
|
||||
1/60.0f, 3/60.0f, 5/60.0f, 3/60.0f, 1/60.0f,
|
||||
1/60.0f, 1/60.0f, 2/60.0f, 1/60.0f, 1/60.0f};
|
||||
|
||||
float color[4], *fp= soft;
|
||||
int dx, dy;
|
||||
|
||||
glGetFloatv(GL_CURRENT_COLOR, color);
|
||||
|
||||
color[0]= shadow_col[0];
|
||||
color[1]= shadow_col[1];
|
||||
color[2]= shadow_col[2];
|
||||
|
||||
for(dx=-2; dx<3; dx++) {
|
||||
for(dy=-2; dy<3; dy++, fp++) {
|
||||
glColor4f(color[0], color[1], color[2], fp[0]*color[3]);
|
||||
color[3]= *(fp) * shadow_col[3];
|
||||
glColor4fv(color);
|
||||
blf_texture_draw(uv, x1+dx, y1+dy, x2+dx, y2+dy);
|
||||
}
|
||||
}
|
||||
@ -350,17 +352,23 @@ static void blf_texture5_draw(float uv[2][2], float x1, float y1, float x2, floa
|
||||
glColor4fv(color);
|
||||
}
|
||||
|
||||
static void blf_texture3_draw(float uv[2][2], float x1, float y1, float x2, float y2)
|
||||
static void blf_texture3_draw(const float shadow_col[4], float uv[2][2], float x1, float y1, float x2, float y2)
|
||||
{
|
||||
float soft[9]= {1/16.0f, 2/16.0f, 1/16.0f, 2/16.0f, 4/16.0f, 2/16.0f, 1/16.0f, 2/16.0f, 1/16.0f};
|
||||
float soft[9]= {1/16.0f, 2/16.0f, 1/16.0f,
|
||||
2/16.0f,4/16.0f, 2/16.0f,
|
||||
1/16.0f, 2/16.0f, 1/16.0f};
|
||||
|
||||
float color[4], *fp= soft;
|
||||
int dx, dy;
|
||||
|
||||
glGetFloatv(GL_CURRENT_COLOR, color);
|
||||
|
||||
|
||||
color[0]= shadow_col[0];
|
||||
color[1]= shadow_col[1];
|
||||
color[2]= shadow_col[2];
|
||||
|
||||
for(dx=-1; dx<2; dx++) {
|
||||
for(dy=-1; dy<2; dy++, fp++) {
|
||||
glColor4f(color[0], color[1], color[2], fp[0]*color[3]);
|
||||
color[3]= *(fp) * shadow_col[3];
|
||||
glColor4fv(color);
|
||||
blf_texture_draw(uv, x1+dx, y1+dy, x2+dx, y2+dy);
|
||||
}
|
||||
}
|
||||
@ -370,18 +378,15 @@ static void blf_texture3_draw(float uv[2][2], float x1, float y1, float x2, floa
|
||||
|
||||
int blf_glyph_render(FontBLF *font, GlyphBLF *g, float x, float y)
|
||||
{
|
||||
GlyphCacheBLF *gc;
|
||||
GLint cur_tex;
|
||||
float dx, dx1;
|
||||
float y1, y2;
|
||||
float xo, yo;
|
||||
float color[4];
|
||||
|
||||
if ((!g->width) || (!g->height))
|
||||
return(1);
|
||||
|
||||
if (g->build_tex == 0) {
|
||||
gc= font->glyph_cache;
|
||||
GlyphCacheBLF *gc= font->glyph_cache;
|
||||
|
||||
if (font->max_tex_size == -1)
|
||||
glGetIntegerv(GL_MAX_TEXTURE_SIZE, (GLint *)&font->max_tex_size);
|
||||
@ -453,22 +458,27 @@ int blf_glyph_render(FontBLF *font, GlyphBLF *g, float x, float y)
|
||||
return(0);
|
||||
}
|
||||
|
||||
glGetIntegerv(GL_TEXTURE_2D_BINDING_EXT, &cur_tex);
|
||||
if (cur_tex != g->tex)
|
||||
glBindTexture(GL_TEXTURE_2D, g->tex);
|
||||
if (font->tex_bind_state != g->tex) {
|
||||
glBindTexture(GL_TEXTURE_2D, (font->tex_bind_state= g->tex));
|
||||
}
|
||||
|
||||
if (font->flags & BLF_SHADOW) {
|
||||
glGetFloatv(GL_CURRENT_COLOR, color);
|
||||
glColor4fv(font->shadow_col);
|
||||
|
||||
if (font->shadow == 3)
|
||||
blf_texture3_draw(g->uv, dx, y1, dx1, y2);
|
||||
else if (font->shadow == 5)
|
||||
blf_texture5_draw(g->uv, dx, y1, dx1, y2);
|
||||
else
|
||||
blf_texture_draw(g->uv, dx, y1, dx1, y2);
|
||||
switch(font->shadow) {
|
||||
case 3:
|
||||
blf_texture3_draw(font->shadow_col, g->uv, dx, y1, dx1, y2);
|
||||
break;
|
||||
case 5:
|
||||
blf_texture5_draw(font->shadow_col, g->uv, dx, y1, dx1, y2);
|
||||
break;
|
||||
default:
|
||||
glColor4fv(font->shadow_col);
|
||||
blf_texture_draw(g->uv, dx, y1, dx1, y2);
|
||||
break;
|
||||
}
|
||||
|
||||
glColor4fv(font->orig_col);
|
||||
|
||||
glColor4fv(color);
|
||||
x= xo;
|
||||
y= yo;
|
||||
|
||||
@ -478,12 +488,17 @@ int blf_glyph_render(FontBLF *font, GlyphBLF *g, float x, float y)
|
||||
y2= y + g->pos_y - g->height;
|
||||
}
|
||||
|
||||
if (font->blur==3)
|
||||
blf_texture3_draw(g->uv, dx, y1, dx1, y2);
|
||||
else if (font->blur==5)
|
||||
blf_texture5_draw(g->uv, dx, y1, dx1, y2);
|
||||
else
|
||||
blf_texture_draw(g->uv, dx, y1, dx1, y2);
|
||||
switch(font->blur) {
|
||||
case 3:
|
||||
blf_texture3_draw(font->orig_col, g->uv, dx, y1, dx1, y2);
|
||||
break;
|
||||
case 5:
|
||||
blf_texture5_draw(font->orig_col, g->uv, dx, y1, dx1, y2);
|
||||
break;
|
||||
default:
|
||||
blf_texture_draw(g->uv, dx, y1, dx1, y2);
|
||||
break;
|
||||
}
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
@ -161,7 +161,10 @@ typedef struct FontBLF {
|
||||
|
||||
/* shadow color. */
|
||||
float shadow_col[4];
|
||||
|
||||
|
||||
/* store color here when drawing shadow or blur. */
|
||||
float orig_col[4];
|
||||
|
||||
/* Multiplied this matrix with the current one before
|
||||
* draw the text! see blf_draw__start.
|
||||
*/
|
||||
@ -179,6 +182,9 @@ typedef struct FontBLF {
|
||||
/* max texture size. */
|
||||
int max_tex_size;
|
||||
|
||||
/* current opengl texture bind, avoids calling glGet */
|
||||
int tex_bind_state;
|
||||
|
||||
/* font options. */
|
||||
int flags;
|
||||
|
||||
|
@ -34,14 +34,16 @@
|
||||
* \since March 2001
|
||||
* \author nzc
|
||||
*/
|
||||
|
||||
struct BevList;
|
||||
struct BezTriple;
|
||||
struct Curve;
|
||||
struct EditNurb;
|
||||
struct ListBase;
|
||||
struct ListBase;
|
||||
struct Nurb;
|
||||
struct Object;
|
||||
struct Scene;
|
||||
struct Nurb;
|
||||
struct ListBase;
|
||||
struct BezTriple;
|
||||
struct BevList;
|
||||
|
||||
#define KNOTSU(nu) ( (nu)->orderu+ (nu)->pntsu+ (((nu)->flagu & CU_NURB_CYCLIC) ? ((nu)->orderu-1) : 0) )
|
||||
#define KNOTSV(nu) ( (nu)->orderv+ (nu)->pntsv+ (((nu)->flagv & CU_NURB_CYCLIC) ? ((nu)->orderv-1) : 0) )
|
||||
@ -55,11 +57,14 @@ struct BevList;
|
||||
|
||||
|
||||
void unlink_curve( struct Curve *cu);
|
||||
void free_curve_editNurb_keyIndex(struct EditNurb *editnurb);
|
||||
void free_curve_editNurb(struct Curve *cu);
|
||||
void free_curve( struct Curve *cu);
|
||||
void BKE_free_editfont(struct Curve *cu);
|
||||
struct Curve *add_curve(const char *name, int type);
|
||||
struct Curve *copy_curve( struct Curve *cu);
|
||||
void make_local_curve( struct Curve *cu);
|
||||
struct ListBase *curve_editnurbs(struct Curve *cu);
|
||||
short curve_type( struct Curve *cu);
|
||||
void test_curve_type( struct Object *ob);
|
||||
void tex_space_curve( struct Curve *cu);
|
||||
|
@ -108,6 +108,7 @@ void object_to_mat4(struct Object *ob, float mat[][4]);
|
||||
void object_apply_mat4(struct Object *ob, float mat[][4], const short use_compat, const short use_parent);
|
||||
|
||||
void set_no_parent_ipo(int val);
|
||||
struct Object *object_pose_armature_get(struct Object *ob);
|
||||
|
||||
void where_is_object_time(struct Scene *scene, struct Object *ob, float ctime);
|
||||
void where_is_object(struct Scene *scene, struct Object *ob);
|
||||
@ -128,6 +129,7 @@ void *object_tfm_backup(struct Object *ob);
|
||||
void object_tfm_restore(struct Object *ob, void *obtfm_pt);
|
||||
|
||||
void object_handle_update(struct Scene *scene, struct Object *ob);
|
||||
void object_sculpt_modifiers_changed(struct Object *ob);
|
||||
|
||||
float give_timeoffset(struct Object *ob);
|
||||
int give_obdata_texspace(struct Object *ob, short **texflag, float **loc, float **size, float **rot);
|
||||
|
@ -97,5 +97,6 @@ typedef struct SculptSession {
|
||||
} SculptSession;
|
||||
|
||||
void free_sculptsession(struct Object *ob);
|
||||
void free_sculptsession_deformMats(struct SculptSession *ss);
|
||||
|
||||
#endif
|
||||
|
@ -35,7 +35,6 @@ set(INC
|
||||
../blenfont
|
||||
../blenlib
|
||||
../blenloader
|
||||
../editors/include
|
||||
../freestyle
|
||||
../gpu
|
||||
../ikplugin
|
||||
|
@ -4,7 +4,7 @@ import os
|
||||
|
||||
sources = env.Glob('intern/*.c') + env.Glob('intern/*.cpp')
|
||||
|
||||
incs = '. #/intern/guardedalloc #/intern/memutil ../editors/include'
|
||||
incs = '. #/intern/guardedalloc #/intern/memutil'
|
||||
incs += ' ../blenlib ../blenfont ../makesdna ../windowmanager'
|
||||
incs += ' ../render/extern/include #/intern/decimation/extern ../makesrna'
|
||||
incs += ' ../imbuf ../ikplugin ../avi #/intern/elbeem/extern ../nodes ../modifiers'
|
||||
|
@ -60,18 +60,16 @@
|
||||
#include "BKE_texture.h"
|
||||
#include "BKE_multires.h"
|
||||
|
||||
|
||||
#include "BLO_sys_types.h" // for intptr_t support
|
||||
|
||||
#include "BIF_gl.h"
|
||||
#include "BIF_glutil.h"
|
||||
#include "GL/glew.h"
|
||||
|
||||
#include "GPU_buffers.h"
|
||||
#include "GPU_draw.h"
|
||||
#include "GPU_extensions.h"
|
||||
#include "GPU_material.h"
|
||||
|
||||
#include "ED_sculpt.h" /* for ED_sculpt_modifiers_changed */
|
||||
extern GLubyte stipple_quarttone[128]; /* glutil.c, bad level data */
|
||||
|
||||
///////////////////////////////////
|
||||
///////////////////////////////////
|
||||
@ -2322,7 +2320,7 @@ static void clear_mesh_caches(Object *ob)
|
||||
}
|
||||
|
||||
if(ob->sculpt) {
|
||||
ED_sculpt_modifiers_changed(ob);
|
||||
object_sculpt_modifiers_changed(ob);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -117,7 +117,7 @@ static void make_localact_apply_cb(ID *id, AnimData *adt, void *mlac_ptr)
|
||||
tMakeLocalActionContext *mlac = (tMakeLocalActionContext *)mlac_ptr;
|
||||
|
||||
if (adt->action == mlac->act) {
|
||||
if (id->lib==0) {
|
||||
if (id->lib == NULL) {
|
||||
adt->action = mlac->actn;
|
||||
|
||||
id_us_plus(&mlac->actn->id);
|
||||
@ -524,7 +524,6 @@ void copy_pose (bPose **dst, bPose *src, int copycon)
|
||||
if (copycon) {
|
||||
copy_constraints(&listb, &pchan->constraints, TRUE); // copy_constraints NULLs listb
|
||||
pchan->constraints= listb;
|
||||
pchan->path= NULL; // XXX remove this line when the new motionpaths are ready... (depreceated code)
|
||||
pchan->mpath= NULL; /* motion paths should not get copied yet... */
|
||||
}
|
||||
|
||||
@ -595,17 +594,12 @@ void free_pose_channels_hash(bPose *pose)
|
||||
|
||||
void free_pose_channel(bPoseChannel *pchan)
|
||||
{
|
||||
// XXX this case here will need to be removed when the new motionpaths are ready
|
||||
if (pchan->path) {
|
||||
MEM_freeN(pchan->path);
|
||||
pchan->path= NULL;
|
||||
}
|
||||
|
||||
|
||||
if (pchan->mpath) {
|
||||
animviz_free_motionpath(pchan->mpath);
|
||||
pchan->mpath= NULL;
|
||||
}
|
||||
|
||||
|
||||
free_constraints(&pchan->constraints);
|
||||
|
||||
if (pchan->prop) {
|
||||
|
@ -1143,11 +1143,11 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa
|
||||
w= (mv4)? 0.25f: 1.0f/3.0f;
|
||||
|
||||
if(orco) {
|
||||
VECADDFAC(dob->orco, dob->orco, orco[mv1], w);
|
||||
VECADDFAC(dob->orco, dob->orco, orco[mv2], w);
|
||||
VECADDFAC(dob->orco, dob->orco, orco[mv3], w);
|
||||
madd_v3_v3v3fl(dob->orco, dob->orco, orco[mv1], w);
|
||||
madd_v3_v3v3fl(dob->orco, dob->orco, orco[mv2], w);
|
||||
madd_v3_v3v3fl(dob->orco, dob->orco, orco[mv3], w);
|
||||
if(mv4)
|
||||
VECADDFAC(dob->orco, dob->orco, orco[mv4], w);
|
||||
madd_v3_v3v3fl(dob->orco, dob->orco, orco[mv4], w);
|
||||
}
|
||||
|
||||
if(mtface) {
|
||||
|
@ -1483,7 +1483,6 @@ static void pose_proxy_synchronize(Object *ob, Object *from, int layer_protected
|
||||
pchanw.next= pchan->next;
|
||||
pchanw.parent= pchan->parent;
|
||||
pchanw.child= pchan->child;
|
||||
pchanw.path= NULL;
|
||||
|
||||
/* this is freed so copy a copy, else undo crashes */
|
||||
if(pchanw.prop) {
|
||||
|
@ -36,10 +36,7 @@
|
||||
* \ingroup bke
|
||||
*/
|
||||
|
||||
|
||||
/* TODO maybe BIF_gl.h should include string.h? */
|
||||
#include <string.h>
|
||||
#include "BIF_gl.h"
|
||||
#include "GL/glew.h"
|
||||
|
||||
#include "BLI_blenlib.h"
|
||||
#include "BLI_edgehash.h"
|
||||
|
@ -2021,7 +2021,7 @@ static int cloth_collision_moving_edges ( ClothModifierData *clmd, CollisionModi
|
||||
{
|
||||
if(edgecollpair.p21==6 || edgecollpair.p22 == 6)
|
||||
{
|
||||
printf("dist: %f, sol[k]: %lf, sol2[k]: %lf\n", distance, solution[k], solution2[k]);
|
||||
printf("dist: %f, sol[k]: %f, sol2[k]: %f\n", distance, solution[k], solution2[k]);
|
||||
printf("a1: %f, a2: %f, b1: %f, b2: %f\n", x1[0], x2[0], x3[0], v1[0]);
|
||||
printf("b21: %d, b22: %d\n", edgecollpair.p21, edgecollpair.p22);
|
||||
}
|
||||
|
@ -2167,7 +2167,7 @@ static void actcon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraint
|
||||
if (data->type < 10) {
|
||||
/* extract rotation (is in whatever space target should be in) */
|
||||
mat4_to_eul(vec, tempmat);
|
||||
mul_v3_fl(vec, (float)(180.0/M_PI)); /* rad -> deg */
|
||||
mul_v3_fl(vec, RAD2DEGF(1.0f)); /* rad -> deg */
|
||||
axis= data->type;
|
||||
}
|
||||
else if (data->type < 20) {
|
||||
@ -3325,7 +3325,7 @@ static void transform_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *
|
||||
break;
|
||||
case 1: /* rotation (convert to degrees first) */
|
||||
mat4_to_eulO(dvec, cob->rotOrder, ct->matrix);
|
||||
mul_v3_fl(dvec, (float)(180.0/M_PI)); /* rad -> deg */
|
||||
mul_v3_fl(dvec, RAD2DEGF(1.0f)); /* rad -> deg */
|
||||
break;
|
||||
default: /* location */
|
||||
copy_v3_v3(dvec, ct->matrix[3]);
|
||||
|
@ -41,9 +41,10 @@
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "BLI_blenlib.h"
|
||||
#include "BLI_math.h"
|
||||
#include "BLI_blenlib.h"
|
||||
#include "BLI_math.h"
|
||||
#include "BLI_utildefines.h"
|
||||
#include "BLI_ghash.h"
|
||||
|
||||
#include "DNA_curve_types.h"
|
||||
#include "DNA_material_types.h"
|
||||
@ -66,9 +67,6 @@
|
||||
#include "BKE_object.h"
|
||||
#include "BKE_material.h"
|
||||
|
||||
|
||||
#include "ED_curve.h"
|
||||
|
||||
/* globals */
|
||||
|
||||
/* local */
|
||||
@ -118,6 +116,25 @@ void BKE_free_editfont(Curve *cu)
|
||||
}
|
||||
}
|
||||
|
||||
void free_curve_editNurb_keyIndex(EditNurb *editnurb)
|
||||
{
|
||||
if (!editnurb->keyindex) {
|
||||
return;
|
||||
}
|
||||
BLI_ghash_free(editnurb->keyindex, NULL, (GHashValFreeFP)MEM_freeN);
|
||||
editnurb->keyindex= NULL;
|
||||
}
|
||||
|
||||
void free_curve_editNurb (Curve *cu)
|
||||
{
|
||||
if(cu->editnurb) {
|
||||
freeNurblist(&cu->editnurb->nurbs);
|
||||
free_curve_editNurb_keyIndex(cu->editnurb);
|
||||
MEM_freeN(cu->editnurb);
|
||||
cu->editnurb= NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* don't free curve itself */
|
||||
void free_curve(Curve *cu)
|
||||
{
|
||||
@ -281,6 +298,16 @@ void make_local_curve(Curve *cu)
|
||||
}
|
||||
}
|
||||
|
||||
/* Get list of nurbs from editnurbs structure */
|
||||
ListBase *curve_editnurbs(Curve *cu)
|
||||
{
|
||||
if (cu->editnurb) {
|
||||
return &cu->editnurb->nurbs;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
short curve_type(Curve *cu)
|
||||
{
|
||||
Nurb *nu;
|
||||
@ -358,7 +385,6 @@ void tex_space_curve(Curve *cu)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int count_curveverts(ListBase *nurb)
|
||||
{
|
||||
Nurb *nu;
|
||||
@ -1898,7 +1924,7 @@ static void make_bevel_list_3D_minimum_twist(BevList *bl)
|
||||
/* flip rotation if needs be */
|
||||
cross_v3_v3v3(cross_tmp, vec_1, vec_2);
|
||||
normalize_v3(cross_tmp);
|
||||
if(angle_normalized_v3v3(bevp_first->dir, cross_tmp) < 90.0f/(float)(180.0/M_PI))
|
||||
if(angle_normalized_v3v3(bevp_first->dir, cross_tmp) < DEG2RADF(90.0f))
|
||||
angle = -angle;
|
||||
|
||||
bevp2= (BevPoint *)(bl+1);
|
||||
@ -2049,7 +2075,7 @@ void makeBevelList(Object *ob)
|
||||
|
||||
BLI_freelistN(&(cu->bev));
|
||||
if(cu->editnurb && ob->type!=OB_FONT) {
|
||||
ListBase *nurbs= ED_curve_editnurbs(cu);
|
||||
ListBase *nurbs= curve_editnurbs(cu);
|
||||
nu= nurbs->first;
|
||||
} else nu= cu->nurb.first;
|
||||
|
||||
@ -3157,7 +3183,7 @@ int clamp_nurb_order_v( struct Nurb *nu)
|
||||
ListBase *BKE_curve_nurbs(Curve *cu)
|
||||
{
|
||||
if (cu->editnurb) {
|
||||
return ED_curve_editnurbs(cu);
|
||||
return curve_editnurbs(cu);
|
||||
}
|
||||
|
||||
return &cu->nurb;
|
||||
|
@ -67,8 +67,6 @@
|
||||
|
||||
#include "BLO_sys_types.h" // for intptr_t support
|
||||
|
||||
#include "ED_curve.h" /* for BKE_curve_nurbs */
|
||||
|
||||
extern Material defmaterial; /* material.c */
|
||||
|
||||
static void boundbox_displist(Object *ob);
|
||||
@ -1102,7 +1100,7 @@ void makeDispListSurf(Scene *scene, Object *ob, ListBase *dispbase,
|
||||
float (*deformedVerts)[3];
|
||||
|
||||
if(!forRender && cu->editnurb)
|
||||
nubase= ED_curve_editnurbs(cu);
|
||||
nubase= curve_editnurbs(cu);
|
||||
else
|
||||
nubase= &cu->nurb;
|
||||
|
||||
|
@ -571,7 +571,7 @@ float effector_falloff(EffectorCache *eff, EffectorData *efd, EffectedPoint *UNU
|
||||
if(falloff == 0.0f)
|
||||
break;
|
||||
|
||||
r_fac=saacos(fac/len_v3(efd->vec_to_point))*180.0f/(float)M_PI;
|
||||
r_fac= RAD2DEGF(saacos(fac/len_v3(efd->vec_to_point)));
|
||||
falloff*= falloff_func_rad(eff->pd, r_fac);
|
||||
|
||||
break;
|
||||
|
@ -592,7 +592,7 @@ void BKE_image_print_memlist(void)
|
||||
for(ima= G.main->image.first; ima; ima= ima->id.next)
|
||||
totsize += image_mem_size(ima);
|
||||
|
||||
printf("\ntotal image memory len: %.3lf MB\n", (double)totsize/(double)(1024*1024));
|
||||
printf("\ntotal image memory len: %.3f MB\n", (double)totsize/(double)(1024*1024));
|
||||
|
||||
for(ima= G.main->image.first; ima; ima= ima->id.next) {
|
||||
size= image_mem_size(ima);
|
||||
|
@ -942,7 +942,7 @@ static char *get_rna_access (int blocktype, int adrcode, char actname[], char co
|
||||
sprintf(buf, "sequence_editor.sequences_all[\"%s\"]", seq->name+2);
|
||||
}
|
||||
else
|
||||
strcpy(buf, ""); /* empty string */
|
||||
buf[0]= '\0'; /* empty string */
|
||||
BLI_dynstr_append(path, buf);
|
||||
|
||||
/* need to add dot before property if there was anything precceding this */
|
||||
|
@ -143,7 +143,7 @@ int BKE_mesh_validate_arrays(Mesh *me, MVert *UNUSED(mverts), unsigned int totve
|
||||
|
||||
BLI_assert(!(do_fixes && me == NULL));
|
||||
|
||||
PRINT("ED_mesh_validate: verts(%u), edges(%u), faces(%u)\n", totvert, totedge, totface);
|
||||
PRINT("%s: verts(%u), edges(%u), faces(%u)\n", __func__, totvert, totedge, totface);
|
||||
|
||||
if(totedge == 0 && totface != 0) {
|
||||
PRINT(" locical error, %u faces and 0 edges\n", totface);
|
||||
|
@ -290,27 +290,15 @@ struct SortContext
|
||||
const int* trisToFacesMap;
|
||||
};
|
||||
|
||||
#ifdef FREE_WINDOWS
|
||||
static SortContext *_mingw_context;
|
||||
/* XXX: not thread-safe, but it's called only from modifiers stack
|
||||
which isn't threaded. Anyway, better to avoid this in the future */
|
||||
static SortContext *_qsort_context;
|
||||
|
||||
static int compareByData(const void * a, const void * b)
|
||||
{
|
||||
return ( _mingw_context->recastData[_mingw_context->trisToFacesMap[*(int*)a]] -
|
||||
_mingw_context->recastData[_mingw_context->trisToFacesMap[*(int*)b]] );
|
||||
return ( _qsort_context->recastData[_qsort_context->trisToFacesMap[*(int*)a]] -
|
||||
_qsort_context->recastData[_qsort_context->trisToFacesMap[*(int*)b]] );
|
||||
}
|
||||
#else
|
||||
#if defined(_MSC_VER)
|
||||
static int compareByData(void* data, const void * a, const void * b)
|
||||
#elif defined(__APPLE__) || defined(__FreeBSD__)
|
||||
static int compareByData(void* data, const void * a, const void * b)
|
||||
#else
|
||||
static int compareByData(const void * a, const void * b, void* data)
|
||||
#endif
|
||||
{
|
||||
const SortContext* context = (const SortContext*)data;
|
||||
return ( context->recastData[context->trisToFacesMap[*(int*)a]] -
|
||||
context->recastData[context->trisToFacesMap[*(int*)b]] );
|
||||
}
|
||||
#endif
|
||||
|
||||
bool buildNavMeshData(const int nverts, const float* verts,
|
||||
const int ntris, const unsigned short *tris,
|
||||
@ -333,16 +321,8 @@ bool buildNavMeshData(const int nverts, const float* verts,
|
||||
SortContext context;
|
||||
context.recastData = recastData;
|
||||
context.trisToFacesMap = trisToFacesMap;
|
||||
#if defined(_MSC_VER)
|
||||
qsort_s(trisMapping, ntris, sizeof(int), compareByData, &context);
|
||||
#elif defined(__APPLE__) || defined(__FreeBSD__)
|
||||
qsort_r(trisMapping, ntris, sizeof(int), &context, compareByData);
|
||||
#elif defined(FREE_WINDOWS)
|
||||
_mingw_context = &context;
|
||||
_qsort_context = &context;
|
||||
qsort(trisMapping, ntris, sizeof(int), compareByData);
|
||||
#else
|
||||
qsort_r(trisMapping, ntris, sizeof(int), compareByData, &context);
|
||||
#endif
|
||||
//search first valid triangle - triangle of convex polygon
|
||||
int validTriStart = -1;
|
||||
for (int i=0; i< ntris; i++)
|
||||
|
@ -1051,9 +1051,9 @@ void ntreeMakeLocal(bNodeTree *ntree)
|
||||
|
||||
if(ntree->id.lib==NULL) return;
|
||||
if(ntree->id.us==1) {
|
||||
ntree->id.lib= 0;
|
||||
ntree->id.lib= NULL;
|
||||
ntree->id.flag= LIB_LOCAL;
|
||||
new_id(0, (ID *)ntree, 0);
|
||||
new_id(NULL, (ID *)ntree, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1069,7 +1069,7 @@ void ntreeMakeLocal(bNodeTree *ntree)
|
||||
if(cd.local && cd.lib==0) {
|
||||
ntree->id.lib= NULL;
|
||||
ntree->id.flag= LIB_LOCAL;
|
||||
new_id(0, (ID *)ntree, 0);
|
||||
new_id(NULL, (ID *)ntree, NULL);
|
||||
}
|
||||
else if(cd.local && cd.lib) {
|
||||
/* this is the mixed case, we copy the tree and assign it to local users */
|
||||
@ -1438,7 +1438,7 @@ static void ntree_update_link_pointers(bNodeTree *ntree)
|
||||
}
|
||||
}
|
||||
|
||||
void ntree_validate_links(bNodeTree *ntree)
|
||||
static void ntree_validate_links(bNodeTree *ntree)
|
||||
{
|
||||
bNodeTreeType *ntreetype = ntreeGetType(ntree->type);
|
||||
bNodeLink *link;
|
||||
|
@ -237,6 +237,17 @@ void object_free_display(Object *ob)
|
||||
freedisplist(&ob->disp);
|
||||
}
|
||||
|
||||
void free_sculptsession_deformMats(SculptSession *ss)
|
||||
{
|
||||
if(ss->orig_cos) MEM_freeN(ss->orig_cos);
|
||||
if(ss->deform_cos) MEM_freeN(ss->deform_cos);
|
||||
if(ss->deform_imats) MEM_freeN(ss->deform_imats);
|
||||
|
||||
ss->orig_cos = NULL;
|
||||
ss->deform_cos = NULL;
|
||||
ss->deform_imats = NULL;
|
||||
}
|
||||
|
||||
void free_sculptsession(Object *ob)
|
||||
{
|
||||
if(ob && ob->sculpt) {
|
||||
@ -267,6 +278,7 @@ void free_sculptsession(Object *ob)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* do not free object itself */
|
||||
void free_object(Object *ob)
|
||||
{
|
||||
@ -408,7 +420,7 @@ void unlink_object(Object *ob)
|
||||
for (ct= targets.first; ct; ct= ct->next) {
|
||||
if (ct->tar == ob) {
|
||||
ct->tar = NULL;
|
||||
strcpy(ct->subtarget, "");
|
||||
ct->subtarget[0]= '\0';
|
||||
obt->recalc |= OB_RECALC_DATA;
|
||||
}
|
||||
}
|
||||
@ -438,7 +450,7 @@ void unlink_object(Object *ob)
|
||||
for (ct= targets.first; ct; ct= ct->next) {
|
||||
if (ct->tar == ob) {
|
||||
ct->tar = NULL;
|
||||
strcpy(ct->subtarget, "");
|
||||
ct->subtarget[0]= '\0';
|
||||
obt->recalc |= OB_RECALC_DATA;
|
||||
}
|
||||
}
|
||||
@ -1308,6 +1320,37 @@ static void copy_object_pose(Object *obn, Object *ob)
|
||||
}
|
||||
}
|
||||
|
||||
static int object_pose_context(Object *ob)
|
||||
{
|
||||
if( (ob) &&
|
||||
(ob->type == OB_ARMATURE) &&
|
||||
(ob->pose) &&
|
||||
(ob->mode & OB_MODE_POSE)
|
||||
) {
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
//Object *object_pose_armature_get(Object *ob)
|
||||
Object *object_pose_armature_get(struct Object *ob)
|
||||
{
|
||||
if(ob==NULL)
|
||||
return NULL;
|
||||
|
||||
if(object_pose_context(ob))
|
||||
return ob;
|
||||
|
||||
ob= modifiers_isDeformedByArmature(ob);
|
||||
|
||||
if(object_pose_context(ob))
|
||||
return ob;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void copy_object_transform(Object *ob_tar, Object *ob_src)
|
||||
{
|
||||
copy_v3_v3(ob_tar->loc, ob_src->loc);
|
||||
@ -2769,6 +2812,33 @@ void object_handle_update(Scene *scene, Object *ob)
|
||||
}
|
||||
}
|
||||
|
||||
void object_sculpt_modifiers_changed(Object *ob)
|
||||
{
|
||||
SculptSession *ss= ob->sculpt;
|
||||
|
||||
if(!ss->cache) {
|
||||
/* we free pbvh on changes, except during sculpt since it can't deal with
|
||||
changing PVBH node organization, we hope topology does not change in
|
||||
the meantime .. weak */
|
||||
if(ss->pbvh) {
|
||||
BLI_pbvh_free(ss->pbvh);
|
||||
ss->pbvh= NULL;
|
||||
}
|
||||
|
||||
free_sculptsession_deformMats(ob->sculpt);
|
||||
} else {
|
||||
PBVHNode **nodes;
|
||||
int n, totnode;
|
||||
|
||||
BLI_pbvh_search_gather(ss->pbvh, NULL, NULL, &nodes, &totnode);
|
||||
|
||||
for(n = 0; n < totnode; n++)
|
||||
BLI_pbvh_node_mark_update(nodes[n]);
|
||||
|
||||
MEM_freeN(nodes);
|
||||
}
|
||||
}
|
||||
|
||||
float give_timeoffset(Object *ob) {
|
||||
if ((ob->ipoflag & OB_OFFS_PARENTADD) && ob->parent) {
|
||||
return ob->sf + give_timeoffset(ob->parent);
|
||||
|
@ -2542,7 +2542,7 @@ static void psys_thread_create_path(ParticleThread *thread, struct ChildParticle
|
||||
normalize_v3(v1);
|
||||
normalize_v3(v2);
|
||||
|
||||
d = saacos(dot_v3v3(v1, v2)) * 180.0f/(float)M_PI;
|
||||
d = RAD2DEGF(saacos(dot_v3v3(v1, v2)));
|
||||
}
|
||||
|
||||
if(p_max > p_min)
|
||||
|
@ -277,8 +277,7 @@ void BKE_area_region_free(SpaceType *st, ARegion *ar)
|
||||
ar->v2d.tab_offset= NULL;
|
||||
}
|
||||
|
||||
if(ar)
|
||||
BLI_freelistN(&ar->panels);
|
||||
BLI_freelistN(&ar->panels);
|
||||
}
|
||||
|
||||
/* not area itself */
|
||||
|
@ -2132,7 +2132,7 @@ static void do_transform(Scene *scene, Sequence *seq, float UNUSED(facf0), int x
|
||||
}
|
||||
|
||||
// Rotate
|
||||
rotate_radians = ((float)M_PI*transform->rotIni)/180.0f;
|
||||
rotate_radians = DEG2RADF(transform->rotIni);
|
||||
|
||||
transform_image(x,y, ibuf1, out, scale_x, scale_y, translate_x, translate_y, rotate_radians, transform->interpolation);
|
||||
}
|
||||
|
@ -61,9 +61,7 @@
|
||||
#include "BKE_scene.h"
|
||||
#include "BKE_subsurf.h"
|
||||
|
||||
|
||||
#include "BIF_gl.h"
|
||||
#include "BIF_glutil.h"
|
||||
#include "GL/glew.h"
|
||||
|
||||
#include "GPU_draw.h"
|
||||
#include "GPU_extensions.h"
|
||||
@ -71,6 +69,8 @@
|
||||
|
||||
#include "CCGSubSurf.h"
|
||||
|
||||
extern GLubyte stipple_quarttone[128]; /* glutil.c, bad level data */
|
||||
|
||||
static int ccgDM_getVertMapIndex(CCGSubSurf *ss, CCGVert *v);
|
||||
static int ccgDM_getEdgeMapIndex(CCGSubSurf *ss, CCGEdge *e);
|
||||
static int ccgDM_getFaceMapIndex(CCGSubSurf *ss, CCGFace *f);
|
||||
|
@ -345,7 +345,7 @@ static int unit_as_string(char *str, int len_max, double value, int prec, bUnitC
|
||||
|
||||
/* Convert to a string */
|
||||
{
|
||||
len= BLI_snprintf(str, len_max, "%.*lf", prec, value_conv);
|
||||
len= BLI_snprintf(str, len_max, "%.*f", prec, value_conv);
|
||||
|
||||
if(len >= len_max)
|
||||
len= len_max;
|
||||
|
@ -139,12 +139,15 @@ size_t BLI_strnlen(const char *str, size_t maxlen);
|
||||
|
||||
void BLI_timestr(double _time, char *str); /* time var is global */
|
||||
|
||||
int BLI_utf8_invalid_byte(const char *str, int length);
|
||||
int BLI_utf8_invalid_strip(char *str, int length);
|
||||
|
||||
void BLI_ascii_strtolower(char *str, int len);
|
||||
void BLI_ascii_strtoupper(char *str, int len);
|
||||
|
||||
|
||||
/* string_utf8.c - may move these into their own header some day - campbell */
|
||||
char *BLI_strncpy_utf8(char *dst, const char *src, size_t maxncpy);
|
||||
int BLI_utf8_invalid_byte(const char *str, int length);
|
||||
int BLI_utf8_invalid_strip(char *str, int length);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -36,9 +36,9 @@
|
||||
#define V_I(x, y, z, res) ( (z)*(res)[1]*(res)[0] + (y)*(res)[0] + (x) )
|
||||
|
||||
/* all input coordinates must be in bounding box 0.0 - 1.0 */
|
||||
float voxel_sample_nearest(float *data, int *res, float *co);
|
||||
float voxel_sample_trilinear(float *data, int *res, float *co);
|
||||
float voxel_sample_triquadratic(float *data, int *res, float *co);
|
||||
float voxel_sample_tricubic(float *data, int *res, float *co, int bspline);
|
||||
float voxel_sample_nearest(float *data, const int res[3], const float co[3]);
|
||||
float voxel_sample_trilinear(float *data, const int res[3], const float co[3]);
|
||||
float voxel_sample_triquadratic(float *data, const int res[3], const float co[3]);
|
||||
float voxel_sample_tricubic(float *data, const int res[3], const float co[3], int bspline);
|
||||
|
||||
#endif /* BLI_VOXEL_H */
|
||||
|
@ -81,6 +81,7 @@ set(SRC
|
||||
intern/scanfill.c
|
||||
intern/storage.c
|
||||
intern/string.c
|
||||
intern/string_utf8.c
|
||||
intern/threads.c
|
||||
intern/time.c
|
||||
intern/uvproject.c
|
||||
|
@ -1,8 +1,4 @@
|
||||
/* util.c
|
||||
*
|
||||
* various string, file, list operations.
|
||||
*
|
||||
*
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
@ -399,116 +395,6 @@ size_t BLI_strnlen(const char *str, size_t maxlen)
|
||||
return end ? (size_t) (end - str) : maxlen;
|
||||
}
|
||||
|
||||
/* from libswish3, originally called u8_isvalid(),
|
||||
* modified to return the index of the bad character (byte index not utf).
|
||||
* http://svn.swish-e.org/libswish3/trunk/src/libswish3/utf8.c r3044 - campbell */
|
||||
|
||||
/* based on the valid_utf8 routine from the PCRE library by Philip Hazel
|
||||
|
||||
length is in bytes, since without knowing whether the string is valid
|
||||
it's hard to know how many characters there are! */
|
||||
|
||||
static const char trailingBytesForUTF8[256] = {
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5
|
||||
};
|
||||
|
||||
int BLI_utf8_invalid_byte(const char *str, int length)
|
||||
{
|
||||
const unsigned char *p, *pend = (unsigned char*)str + length;
|
||||
unsigned char c;
|
||||
int ab;
|
||||
|
||||
for (p = (unsigned char*)str; p < pend; p++) {
|
||||
c = *p;
|
||||
if (c < 128)
|
||||
continue;
|
||||
if ((c & 0xc0) != 0xc0)
|
||||
goto utf8_error;
|
||||
ab = trailingBytesForUTF8[c];
|
||||
if (length < ab)
|
||||
goto utf8_error;
|
||||
length -= ab;
|
||||
|
||||
p++;
|
||||
/* Check top bits in the second byte */
|
||||
if ((*p & 0xc0) != 0x80)
|
||||
goto utf8_error;
|
||||
|
||||
/* Check for overlong sequences for each different length */
|
||||
switch (ab) {
|
||||
/* Check for xx00 000x */
|
||||
case 1:
|
||||
if ((c & 0x3e) == 0) goto utf8_error;
|
||||
continue; /* We know there aren't any more bytes to check */
|
||||
|
||||
/* Check for 1110 0000, xx0x xxxx */
|
||||
case 2:
|
||||
if (c == 0xe0 && (*p & 0x20) == 0) goto utf8_error;
|
||||
break;
|
||||
|
||||
/* Check for 1111 0000, xx00 xxxx */
|
||||
case 3:
|
||||
if (c == 0xf0 && (*p & 0x30) == 0) goto utf8_error;
|
||||
break;
|
||||
|
||||
/* Check for 1111 1000, xx00 0xxx */
|
||||
case 4:
|
||||
if (c == 0xf8 && (*p & 0x38) == 0) goto utf8_error;
|
||||
break;
|
||||
|
||||
/* Check for leading 0xfe or 0xff,
|
||||
and then for 1111 1100, xx00 00xx */
|
||||
case 5:
|
||||
if (c == 0xfe || c == 0xff ||
|
||||
(c == 0xfc && (*p & 0x3c) == 0)) goto utf8_error;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Check for valid bytes after the 2nd, if any; all must start 10 */
|
||||
while (--ab > 0) {
|
||||
if ((*(p+1) & 0xc0) != 0x80) goto utf8_error;
|
||||
p++; /* do this after so we get usable offset - campbell */
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
|
||||
utf8_error:
|
||||
|
||||
return (int)((char *)p - (char *)str) - 1;
|
||||
}
|
||||
|
||||
int BLI_utf8_invalid_strip(char *str, int length)
|
||||
{
|
||||
int bad_char, tot= 0;
|
||||
|
||||
while((bad_char= BLI_utf8_invalid_byte(str, length)) != -1) {
|
||||
str += bad_char;
|
||||
length -= bad_char;
|
||||
|
||||
if(length == 0) {
|
||||
/* last character bad, strip it */
|
||||
*str= '\0';
|
||||
tot++;
|
||||
break;
|
||||
}
|
||||
else {
|
||||
/* strip, keep looking */
|
||||
memmove(str, str + 1, length);
|
||||
tot++;
|
||||
}
|
||||
}
|
||||
|
||||
return tot;
|
||||
}
|
||||
|
||||
void BLI_ascii_strtolower(char *str, int len)
|
||||
{
|
||||
int i;
|
||||
|
185
source/blender/blenlib/intern/string_utf8.c
Normal file
185
source/blender/blenlib/intern/string_utf8.c
Normal file
@ -0,0 +1,185 @@
|
||||
/*
|
||||
* $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.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2011 Blender Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Contributor(s): Campbell Barton.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*
|
||||
*/
|
||||
|
||||
/** \file blender/blenlib/intern/string_utf8.c
|
||||
* \ingroup bli
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "BLI_string.h"
|
||||
|
||||
/* from libswish3, originally called u8_isvalid(),
|
||||
* modified to return the index of the bad character (byte index not utf).
|
||||
* http://svn.swish-e.org/libswish3/trunk/src/libswish3/utf8.c r3044 - campbell */
|
||||
|
||||
/* based on the valid_utf8 routine from the PCRE library by Philip Hazel
|
||||
|
||||
length is in bytes, since without knowing whether the string is valid
|
||||
it's hard to know how many characters there are! */
|
||||
|
||||
static const char trailingBytesForUTF8[256] = {
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5
|
||||
};
|
||||
|
||||
int BLI_utf8_invalid_byte(const char *str, int length)
|
||||
{
|
||||
const unsigned char *p, *pend = (unsigned char*)str + length;
|
||||
unsigned char c;
|
||||
int ab;
|
||||
|
||||
for (p = (unsigned char*)str; p < pend; p++) {
|
||||
c = *p;
|
||||
if (c < 128)
|
||||
continue;
|
||||
if ((c & 0xc0) != 0xc0)
|
||||
goto utf8_error;
|
||||
ab = trailingBytesForUTF8[c];
|
||||
if (length < ab)
|
||||
goto utf8_error;
|
||||
length -= ab;
|
||||
|
||||
p++;
|
||||
/* Check top bits in the second byte */
|
||||
if ((*p & 0xc0) != 0x80)
|
||||
goto utf8_error;
|
||||
|
||||
/* Check for overlong sequences for each different length */
|
||||
switch (ab) {
|
||||
/* Check for xx00 000x */
|
||||
case 1:
|
||||
if ((c & 0x3e) == 0) goto utf8_error;
|
||||
continue; /* We know there aren't any more bytes to check */
|
||||
|
||||
/* Check for 1110 0000, xx0x xxxx */
|
||||
case 2:
|
||||
if (c == 0xe0 && (*p & 0x20) == 0) goto utf8_error;
|
||||
break;
|
||||
|
||||
/* Check for 1111 0000, xx00 xxxx */
|
||||
case 3:
|
||||
if (c == 0xf0 && (*p & 0x30) == 0) goto utf8_error;
|
||||
break;
|
||||
|
||||
/* Check for 1111 1000, xx00 0xxx */
|
||||
case 4:
|
||||
if (c == 0xf8 && (*p & 0x38) == 0) goto utf8_error;
|
||||
break;
|
||||
|
||||
/* Check for leading 0xfe or 0xff,
|
||||
and then for 1111 1100, xx00 00xx */
|
||||
case 5:
|
||||
if (c == 0xfe || c == 0xff ||
|
||||
(c == 0xfc && (*p & 0x3c) == 0)) goto utf8_error;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Check for valid bytes after the 2nd, if any; all must start 10 */
|
||||
while (--ab > 0) {
|
||||
if ((*(p+1) & 0xc0) != 0x80) goto utf8_error;
|
||||
p++; /* do this after so we get usable offset - campbell */
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
|
||||
utf8_error:
|
||||
|
||||
return (int)((char *)p - (char *)str) - 1;
|
||||
}
|
||||
|
||||
int BLI_utf8_invalid_strip(char *str, int length)
|
||||
{
|
||||
int bad_char, tot= 0;
|
||||
|
||||
while((bad_char= BLI_utf8_invalid_byte(str, length)) != -1) {
|
||||
str += bad_char;
|
||||
length -= bad_char;
|
||||
|
||||
if(length == 0) {
|
||||
/* last character bad, strip it */
|
||||
*str= '\0';
|
||||
tot++;
|
||||
break;
|
||||
}
|
||||
else {
|
||||
/* strip, keep looking */
|
||||
memmove(str, str + 1, length);
|
||||
tot++;
|
||||
}
|
||||
}
|
||||
|
||||
return tot;
|
||||
}
|
||||
|
||||
|
||||
/* compatible with BLI_strncpy, but esnure no partial utf8 chars */
|
||||
|
||||
/* array copied from glib's gutf8.c,
|
||||
* note: this looks to be at odd's with 'trailingBytesForUTF8',
|
||||
* need to find out what gives here! - campbell */
|
||||
static const size_t utf8_skip_data[256] = {
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
|
||||
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,6,6,1,1
|
||||
};
|
||||
|
||||
char *BLI_strncpy_utf8(char *dst, const char *src, size_t maxncpy)
|
||||
{
|
||||
char *dst_r= dst;
|
||||
size_t utf8_size;
|
||||
|
||||
/* note: currently we dont attempt to deal with invalid utf8 chars */
|
||||
|
||||
while(*src != '\0' && (utf8_size= utf8_skip_data[*src]) < maxncpy) {
|
||||
maxncpy -= utf8_size;
|
||||
switch(utf8_size) {
|
||||
case 6: *dst ++ = *src ++;
|
||||
case 5: *dst ++ = *src ++;
|
||||
case 4: *dst ++ = *src ++;
|
||||
case 3: *dst ++ = *src ++;
|
||||
case 2: *dst ++ = *src ++;
|
||||
case 1: *dst ++ = *src ++;
|
||||
}
|
||||
}
|
||||
*dst= '\0';
|
||||
return dst_r;
|
||||
}
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
|
||||
|
||||
BM_INLINE float D(float *data, int *res, int x, int y, int z)
|
||||
BM_INLINE float D(float *data, const int res[3], int x, int y, int z)
|
||||
{
|
||||
CLAMP(x, 0, res[0]-1);
|
||||
CLAMP(y, 0, res[1]-1);
|
||||
@ -46,7 +46,7 @@ BM_INLINE float D(float *data, int *res, int x, int y, int z)
|
||||
|
||||
/* *** nearest neighbour *** */
|
||||
/* input coordinates must be in bounding box 0.0 - 1.0 */
|
||||
float voxel_sample_nearest(float *data, int *res, float *co)
|
||||
float voxel_sample_nearest(float *data, const int res[3], const float co[3])
|
||||
{
|
||||
int xi, yi, zi;
|
||||
|
||||
@ -71,7 +71,7 @@ BM_INLINE int _clamp(int a, int b, int c)
|
||||
return (a < b) ? b : ((a > c) ? c : a);
|
||||
}
|
||||
|
||||
float voxel_sample_trilinear(float *data, int *res, float *co)
|
||||
float voxel_sample_trilinear(float *data, const int res[3], const float co[3])
|
||||
{
|
||||
if (data) {
|
||||
|
||||
@ -103,7 +103,7 @@ float voxel_sample_trilinear(float *data, int *res, float *co)
|
||||
}
|
||||
|
||||
|
||||
float voxel_sample_triquadratic(float *data, int *res, float *co)
|
||||
float voxel_sample_triquadratic(float *data, const int res[3], const float co[3])
|
||||
{
|
||||
if (data) {
|
||||
|
||||
@ -133,7 +133,7 @@ float voxel_sample_triquadratic(float *data, int *res, float *co)
|
||||
return 0.f;
|
||||
}
|
||||
|
||||
float voxel_sample_tricubic(float *data, int *res, float *co, int bspline)
|
||||
float voxel_sample_tricubic(float *data, const int res[3], const float co[3], int bspline)
|
||||
{
|
||||
if (data) {
|
||||
|
||||
|
@ -2143,7 +2143,7 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open))
|
||||
ntreetype->foreach_nodetree(main, NULL, lib_nodetree_init_types_cb);
|
||||
}
|
||||
for(ntree= main->nodetree.first; ntree; ntree= ntree->id.next)
|
||||
ntreeInitTypes(ntree);
|
||||
lib_nodetree_init_types_cb(NULL, NULL, ntree);
|
||||
|
||||
{
|
||||
int has_old_groups=0;
|
||||
@ -3968,7 +3968,6 @@ static void direct_link_pose(FileData *fd, bPose *pose)
|
||||
direct_link_motionpath(fd, pchan->mpath);
|
||||
|
||||
pchan->iktree.first= pchan->iktree.last= NULL;
|
||||
pchan->path= NULL;
|
||||
|
||||
/* incase this value changes in future, clamp else we get undefined behavior */
|
||||
CLAMP(pchan->rotmode, ROT_MODE_MIN, ROT_MODE_MAX);
|
||||
@ -9421,7 +9420,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
|
||||
simasel->prv_w = 96;
|
||||
simasel->flag = 7; /* ??? elubie */
|
||||
strcpy (simasel->dir, U.textudir); /* TON */
|
||||
strcpy (simasel->file, "");
|
||||
simasel->file[0]= '\0';
|
||||
|
||||
simasel->returnfunc = NULL;
|
||||
simasel->title[0] = 0;
|
||||
@ -9651,7 +9650,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
|
||||
|
||||
/* clear old targets to avoid problems */
|
||||
data->tar = NULL;
|
||||
strcpy(data->subtarget, "");
|
||||
data->subtarget[0]= '\0';
|
||||
}
|
||||
}
|
||||
else if (con->type == CONSTRAINT_TYPE_LOCLIKE) {
|
||||
@ -9681,7 +9680,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
|
||||
|
||||
/* clear old targets to avoid problems */
|
||||
data->tar = NULL;
|
||||
strcpy(data->subtarget, "");
|
||||
data->subtarget[0]= '\0';
|
||||
}
|
||||
}
|
||||
else if (con->type == CONSTRAINT_TYPE_LOCLIKE) {
|
||||
|
@ -577,7 +577,7 @@ void AnimationExporter::get_source_values(BezTriple *bezt, COLLADASW::InputSeman
|
||||
case COLLADASW::InputSemantic::OUTPUT:
|
||||
*length = 1;
|
||||
if (rotation) {
|
||||
values[0] = (bezt->vec[1][1]) * 180.0f/M_PI;
|
||||
values[0] = RAD2DEGF(bezt->vec[1][1]);
|
||||
}
|
||||
else {
|
||||
values[0] = bezt->vec[1][1];
|
||||
@ -593,7 +593,7 @@ void AnimationExporter::get_source_values(BezTriple *bezt, COLLADASW::InputSeman
|
||||
values[1] = 0;
|
||||
}
|
||||
else if (rotation) {
|
||||
values[1] = (bezt->vec[0][1]) * 180.0f/M_PI;
|
||||
values[1] = RAD2DEGF(bezt->vec[0][1]);
|
||||
} else {
|
||||
values[1] = bezt->vec[0][1];
|
||||
}
|
||||
@ -608,7 +608,7 @@ void AnimationExporter::get_source_values(BezTriple *bezt, COLLADASW::InputSeman
|
||||
values[1] = 0;
|
||||
}
|
||||
else if (rotation) {
|
||||
values[1] = (bezt->vec[2][1]) * 180.0f/M_PI;
|
||||
values[1] = RAD2DEGF(bezt->vec[2][1]);
|
||||
} else {
|
||||
values[1] = bezt->vec[2][1];
|
||||
}
|
||||
@ -688,7 +688,7 @@ std::string AnimationExporter::create_source_from_array(COLLADASW::InputSemantic
|
||||
// val = convert_time(val);
|
||||
//else
|
||||
if (is_rot)
|
||||
val *= 180.0f / M_PI;
|
||||
val = RAD2DEGF(val);
|
||||
source.appendValues(val);
|
||||
}
|
||||
|
||||
|
@ -170,9 +170,9 @@ void AnimationImporter::fcurve_deg_to_rad(FCurve *cu)
|
||||
{
|
||||
for (unsigned int i = 0; i < cu->totvert; i++) {
|
||||
// TODO convert handles too
|
||||
cu->bezt[i].vec[1][1] *= M_PI / 180.0f;
|
||||
cu->bezt[i].vec[0][1] *= M_PI / 180.0f;
|
||||
cu->bezt[i].vec[2][1] *= M_PI / 180.0f;
|
||||
cu->bezt[i].vec[1][1] *= DEG2RADF(1.0f);
|
||||
cu->bezt[i].vec[0][1] *= DEG2RADF(1.0f);
|
||||
cu->bezt[i].vec[2][1] *= DEG2RADF(1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
@ -741,7 +741,7 @@ void AnimationImporter::apply_matrix_curves( Object * ob, std::vector<FCurve*>&
|
||||
mat4_to_quat(rot, mat);
|
||||
/*for ( int i = 0 ; i < 4 ; i ++ )
|
||||
{
|
||||
rot[i] = rot[i] * (180 / M_PI);
|
||||
rot[i] = RAD2DEGF(rot[i]);
|
||||
}*/
|
||||
copy_v3_v3(loc, mat[3]);
|
||||
mat4_to_size(scale, mat);
|
||||
|
@ -73,7 +73,7 @@ void CamerasExporter::operator()(Object *ob, Scene *sce)
|
||||
|
||||
if (cam->type == CAM_PERSP) {
|
||||
COLLADASW::PerspectiveOptic persp(mSW);
|
||||
persp.setXFov(lens_to_angle(cam->lens)*(180.0f/M_PI),"xfov");
|
||||
persp.setXFov(RAD2DEGF(lens_to_angle(cam->lens)), "xfov");
|
||||
persp.setAspectRatio((float)(sce->r.xsch)/(float)(sce->r.ysch),false,"aspect_ratio");
|
||||
persp.setZFar(cam->clipend, false , "zfar");
|
||||
persp.setZNear(cam->clipsta,false , "znear");
|
||||
|
@ -816,7 +816,7 @@ bool DocumentImporter::writeCamera( const COLLADAFW::Camera* camera )
|
||||
double aspect = camera->getAspectRatio().getValue();
|
||||
double xfov = aspect*yfov;
|
||||
// xfov is in degrees, cam->lens is in millimiters
|
||||
cam->lens = angle_to_lens((float)xfov*(M_PI/180.0f));
|
||||
cam->lens = angle_to_lens(DEG2RADF(xfov));;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -837,7 +837,7 @@ bool DocumentImporter::writeCamera( const COLLADAFW::Camera* camera )
|
||||
{
|
||||
double x = camera->getXFov().getValue();
|
||||
// x is in degrees, cam->lens is in millimiters
|
||||
cam->lens = angle_to_lens((float)x*(M_PI/180.0f));
|
||||
cam->lens = angle_to_lens(DEG2RADF(x));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -854,7 +854,7 @@ bool DocumentImporter::writeCamera( const COLLADAFW::Camera* camera )
|
||||
{
|
||||
double yfov = camera->getYFov().getValue();
|
||||
// yfov is in degrees, cam->lens is in millimiters
|
||||
cam->lens = angle_to_lens((float)yfov*(M_PI/180.0f));
|
||||
cam->lens = angle_to_lens(DEG2RADF(yfov));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -82,8 +82,8 @@ void TransformReader::dae_rotate_to_mat4(COLLADAFW::Transformation *tm, float m[
|
||||
{
|
||||
COLLADAFW::Rotate *ro = (COLLADAFW::Rotate*)tm;
|
||||
COLLADABU::Math::Vector3& axis = ro->getRotationAxis();
|
||||
float angle = (float)(ro->getRotationAngle() * M_PI / 180.0f);
|
||||
float ax[] = {axis[0], axis[1], axis[2]};
|
||||
const float angle = (float)DEG2RAD(ro->getRotationAngle());
|
||||
const float ax[] = {axis[0], axis[1], axis[2]};
|
||||
// float quat[4];
|
||||
// axis_angle_to_quat(quat, axis, angle);
|
||||
// quat_to_mat4(m, quat);
|
||||
|
@ -107,9 +107,9 @@ void TransformWriter::add_transform(COLLADASW::Node& node, float loc[3], float r
|
||||
/*node.addRotateZ("rotationZ", COLLADABU::Math::Utils::radToDegF(rot[2]));
|
||||
node.addRotateY("rotationY", COLLADABU::Math::Utils::radToDegF(rot[1]));
|
||||
node.addRotateX("rotationX", COLLADABU::Math::Utils::radToDegF(rot[0]));*/
|
||||
node.addRotateZ("rotationZ", rot[2] * 180.0f/M_PI);
|
||||
node.addRotateY("rotationY", (rot[1]* 180.0f/M_PI));
|
||||
node.addRotateX("rotationX", (rot[0]* 180.0f/M_PI));
|
||||
node.addRotateZ("rotationZ", RAD2DEGF(rot[2]));
|
||||
node.addRotateY("rotationY", RAD2DEGF(rot[1]));
|
||||
node.addRotateX("rotationX", RAD2DEGF(rot[0]));
|
||||
|
||||
node.addScale("scale", scale[0], scale[1], scale[2]);
|
||||
}
|
||||
|
@ -404,9 +404,9 @@ float ANIM_unit_mapping_get_factor (Scene *scene, ID *id, FCurve *fcu, short res
|
||||
/* if the radians flag is not set, default to using degrees which need conversions */
|
||||
if ((scene) && (scene->unit.system_rotation == USER_UNIT_ROT_RADIANS) == 0) {
|
||||
if (restore)
|
||||
return M_PI / 180.0; /* degrees to radians */
|
||||
return DEG2RADF(1.0f); /* degrees to radians */
|
||||
else
|
||||
return 180.0 / M_PI; /* radians to degrees */
|
||||
return RAD2DEGF(1.0f); /* radians to degrees */
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -907,7 +907,7 @@ static size_t skip_fcurve_selected_data (bDopeSheet *ads, FCurve *fcu, ID *owner
|
||||
*/
|
||||
static short skip_fcurve_with_name (bDopeSheet *ads, FCurve *fcu, ID *owner_id)
|
||||
{
|
||||
bAnimListElem ale_dummy = {0};
|
||||
bAnimListElem ale_dummy = {NULL};
|
||||
bAnimChannelType *acf;
|
||||
|
||||
/* create a dummy wrapper for the F-Curve */
|
||||
|
@ -204,8 +204,8 @@ static short ob_keyframes_loop(KeyframeEditData *ked, bDopeSheet *ads, Object *o
|
||||
int filter;
|
||||
int ret=0;
|
||||
|
||||
bAnimListElem dummychan = {0};
|
||||
Base dummybase = {0};
|
||||
bAnimListElem dummychan = {NULL};
|
||||
Base dummybase = {NULL};
|
||||
|
||||
if (ob == NULL)
|
||||
return 0;
|
||||
@ -249,7 +249,7 @@ static short scene_keyframes_loop(KeyframeEditData *ked, bDopeSheet *ads, Scene
|
||||
int filter;
|
||||
int ret=0;
|
||||
|
||||
bAnimListElem dummychan = {0};
|
||||
bAnimListElem dummychan = {NULL};
|
||||
|
||||
if (sce == NULL)
|
||||
return 0;
|
||||
|
@ -361,7 +361,7 @@ static void fix_bonelist_roll (ListBase *bonelist, ListBase *editbonelist)
|
||||
print_m4("premat", premat);
|
||||
print_m4("postmat", postmat);
|
||||
print_m4("difmat", difmat);
|
||||
printf ("Roll = %f\n", (-atan2(difmat[2][0], difmat[2][2]) * (180.0/M_PI)));
|
||||
printf ("Roll = %f\n", RAD2DEGF(-atan2(difmat[2][0], difmat[2][2])));
|
||||
#endif
|
||||
curBone->roll = (float)-atan2(difmat[2][0], difmat[2][2]);
|
||||
|
||||
@ -643,7 +643,7 @@ static void applyarmature_fix_boneparents (Scene *scene, Object *armob)
|
||||
static int apply_armature_pose2bones_exec (bContext *C, wmOperator *op)
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); // must be active object, not edit-object
|
||||
Object *ob= object_pose_armature_get(CTX_data_active_object(C)); // must be active object, not edit-object
|
||||
bArmature *arm= get_armature(ob);
|
||||
bPose *pose;
|
||||
bPoseChannel *pchan;
|
||||
@ -745,7 +745,7 @@ void POSE_OT_armature_apply (wmOperatorType *ot)
|
||||
/* set the current pose as the restpose */
|
||||
static int pose_visual_transform_apply_exec (bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); // must be active object, not edit-object
|
||||
Object *ob= object_pose_armature_get(CTX_data_active_object(C)); // must be active object, not edit-object
|
||||
|
||||
/* don't check if editmode (should be done by caller) */
|
||||
if (ob->type!=OB_ARMATURE)
|
||||
@ -4886,7 +4886,7 @@ static int pose_clear_transform_generic_exec(bContext *C, wmOperator *op,
|
||||
void (*clear_func)(bPoseChannel*), const char default_ksName[])
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
|
||||
Object *ob= object_pose_armature_get(CTX_data_active_object(C));
|
||||
short autokey = 0;
|
||||
|
||||
/* sanity checks */
|
||||
@ -5113,7 +5113,7 @@ void POSE_OT_select_all(wmOperatorType *ot)
|
||||
|
||||
static int pose_select_parent_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
|
||||
Object *ob= object_pose_armature_get(CTX_data_active_object(C));
|
||||
bPoseChannel *pchan,*parent;
|
||||
|
||||
/* Determine if there is an active bone */
|
||||
@ -5189,7 +5189,7 @@ static int hide_unselected_pose_bone_cb(Object *ob, Bone *bone, void *UNUSED(ptr
|
||||
/* active object is armature in posemode, poll checked */
|
||||
static int pose_hide_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
|
||||
Object *ob= object_pose_armature_get(CTX_data_active_object(C));
|
||||
bArmature *arm= ob->data;
|
||||
|
||||
if(RNA_boolean_get(op->ptr, "unselected"))
|
||||
@ -5238,7 +5238,7 @@ static int show_pose_bone_cb(Object *ob, Bone *bone, void *UNUSED(ptr))
|
||||
/* active object is armature in posemode, poll checked */
|
||||
static int pose_reveal_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
|
||||
Object *ob= object_pose_armature_get(CTX_data_active_object(C));
|
||||
bArmature *arm= ob->data;
|
||||
|
||||
bone_looper(ob, arm->bonebase.first, NULL, show_pose_bone_cb);
|
||||
|
@ -51,6 +51,7 @@
|
||||
#include "BKE_fcurve.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_object.h"
|
||||
#include "BKE_report.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
@ -129,7 +130,7 @@ static int pose_slide_init (bContext *C, wmOperator *op, short mode)
|
||||
|
||||
/* get info from context */
|
||||
pso->scene= CTX_data_scene(C);
|
||||
pso->ob= ED_object_pose_armature(CTX_data_active_object(C));
|
||||
pso->ob= object_pose_armature_get(CTX_data_active_object(C));
|
||||
pso->arm= (pso->ob)? pso->ob->data : NULL;
|
||||
pso->sa= CTX_wm_area(C); /* only really needed when doing modal() */
|
||||
pso->ar= CTX_wm_region(C); /* only really needed when doing modal() */
|
||||
@ -1164,7 +1165,7 @@ static void pose_propagate_fcurve (wmOperator *op, Object *ob, FCurve *fcu,
|
||||
static int pose_propagate_exec (bContext *C, wmOperator *op)
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
|
||||
Object *ob= object_pose_armature_get(CTX_data_active_object(C));
|
||||
bAction *act= (ob && ob->adt)? ob->adt->action : NULL;
|
||||
|
||||
ListBase pflinks = {NULL, NULL};
|
||||
|
@ -54,6 +54,7 @@
|
||||
#include "BKE_depsgraph.h"
|
||||
#include "BKE_idprop.h"
|
||||
#include "BKE_library.h"
|
||||
#include "BKE_object.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_report.h"
|
||||
@ -170,7 +171,7 @@ static Object *get_poselib_object (bContext *C)
|
||||
if (sa && (sa->spacetype == SPACE_BUTS))
|
||||
return CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
|
||||
else
|
||||
return ED_object_pose_armature(CTX_data_active_object(C));
|
||||
return object_pose_armature_get(CTX_data_active_object(C));
|
||||
}
|
||||
|
||||
/* Poll callback for operators that require existing PoseLib data (with poses) to work */
|
||||
@ -632,7 +633,7 @@ static int poselib_rename_invoke (bContext *C, wmOperator *op, wmEvent *evt)
|
||||
|
||||
static int poselib_rename_exec (bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
|
||||
Object *ob= object_pose_armature_get(CTX_data_active_object(C));
|
||||
bAction *act= (ob) ? ob->poselib : NULL;
|
||||
TimeMarker *marker;
|
||||
char newname[64];
|
||||
@ -1438,9 +1439,7 @@ static void poselib_preview_init_data (bContext *C, wmOperator *op)
|
||||
pld->pose->flag &= ~POSE_DO_UNLOCK;
|
||||
|
||||
/* clear strings + search */
|
||||
strcpy(pld->headerstr, "");
|
||||
strcpy(pld->searchstr, "");
|
||||
strcpy(pld->searchold, "");
|
||||
pld->headerstr[0]= pld->searchstr[0]= pld->searchold[0]= '\0';
|
||||
pld->search_cursor= 0;
|
||||
}
|
||||
|
||||
|
@ -58,6 +58,7 @@
|
||||
#include "BKE_depsgraph.h"
|
||||
#include "BKE_fcurve.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_object.h"
|
||||
#include "BKE_report.h"
|
||||
|
||||
|
||||
@ -78,36 +79,6 @@
|
||||
|
||||
#include "armature_intern.h"
|
||||
|
||||
static int object_pose_context(Object *ob)
|
||||
{
|
||||
if( (ob) &&
|
||||
(ob->type == OB_ARMATURE) &&
|
||||
(ob->pose) &&
|
||||
(ob->mode & OB_MODE_POSE)
|
||||
) {
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
Object *ED_object_pose_armature(Object *ob)
|
||||
{
|
||||
if(ob==NULL)
|
||||
return NULL;
|
||||
|
||||
if(object_pose_context(ob))
|
||||
return ob;
|
||||
|
||||
ob= modifiers_isDeformedByArmature(ob);
|
||||
|
||||
if(object_pose_context(ob))
|
||||
return ob;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* This function is used to process the necessary updates for */
|
||||
void ED_armature_enter_posemode(bContext *C, Base *base)
|
||||
{
|
||||
@ -238,7 +209,7 @@ static int pose_calculate_paths_exec (bContext *C, wmOperator *UNUSED(op))
|
||||
if (sa->spacetype == SPACE_BUTS)
|
||||
ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
|
||||
else
|
||||
ob= ED_object_pose_armature(CTX_data_active_object(C));
|
||||
ob= object_pose_armature_get(CTX_data_active_object(C));
|
||||
|
||||
if (ELEM(NULL, ob, ob->pose))
|
||||
return OPERATOR_CANCELLED;
|
||||
@ -314,7 +285,7 @@ static int pose_clear_paths_exec (bContext *C, wmOperator *UNUSED(op))
|
||||
if (sa->spacetype == SPACE_BUTS)
|
||||
ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
|
||||
else
|
||||
ob= ED_object_pose_armature(CTX_data_active_object(C));
|
||||
ob= object_pose_armature_get(CTX_data_active_object(C));
|
||||
|
||||
/* only continue if there's an object */
|
||||
if ELEM(NULL, ob, ob->pose)
|
||||
@ -348,7 +319,7 @@ void POSE_OT_paths_clear (wmOperatorType *ot)
|
||||
|
||||
static int pose_select_constraint_target_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
|
||||
Object *ob= object_pose_armature_get(CTX_data_active_object(C));
|
||||
bConstraint *con;
|
||||
int found= 0;
|
||||
|
||||
@ -408,7 +379,7 @@ void POSE_OT_select_constraint_target(wmOperatorType *ot)
|
||||
|
||||
static int pose_select_hierarchy_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
|
||||
Object *ob= object_pose_armature_get(CTX_data_active_object(C));
|
||||
bArmature *arm= ob->data;
|
||||
Bone *curbone, *pabone, *chbone;
|
||||
int direction = RNA_enum_get(op->ptr, "direction");
|
||||
@ -646,7 +617,7 @@ static int pose_select_same_keyingset(bContext *C, Object *ob, short extend)
|
||||
|
||||
static int pose_select_grouped_exec (bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
|
||||
Object *ob= object_pose_armature_get(CTX_data_active_object(C));
|
||||
short extend= RNA_boolean_get(op->ptr, "extend");
|
||||
short changed = 0;
|
||||
|
||||
@ -713,7 +684,7 @@ void POSE_OT_select_grouped (wmOperatorType *ot)
|
||||
static int pose_bone_flip_active_exec (bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Object *ob_act= CTX_data_active_object(C);
|
||||
Object *ob= ED_object_pose_armature(ob_act);
|
||||
Object *ob= object_pose_armature_get(ob_act);
|
||||
|
||||
if(ob && (ob->mode & OB_MODE_POSE)) {
|
||||
bArmature *arm= ob->data;
|
||||
@ -1135,7 +1106,7 @@ static bPoseChannel *pose_bone_do_paste (Object *ob, bPoseChannel *chan, short s
|
||||
|
||||
static int pose_copy_exec (bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
|
||||
Object *ob= object_pose_armature_get(CTX_data_active_object(C));
|
||||
|
||||
/* sanity checking */
|
||||
if ELEM(NULL, ob, ob->pose) {
|
||||
@ -1173,7 +1144,7 @@ void POSE_OT_copy (wmOperatorType *ot)
|
||||
|
||||
static int pose_paste_exec (bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
|
||||
Object *ob= object_pose_armature_get(CTX_data_active_object(C));
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
bPoseChannel *chan;
|
||||
int flip= RNA_boolean_get(op->ptr, "flipped");
|
||||
@ -1272,7 +1243,7 @@ static int pose_group_add_exec (bContext *C, wmOperator *UNUSED(op))
|
||||
if (sa->spacetype == SPACE_BUTS)
|
||||
ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
|
||||
else
|
||||
ob= ED_object_pose_armature(CTX_data_active_object(C));
|
||||
ob= object_pose_armature_get(CTX_data_active_object(C));
|
||||
|
||||
/* only continue if there's an object */
|
||||
if (ob == NULL)
|
||||
@ -1312,7 +1283,7 @@ static int pose_group_remove_exec (bContext *C, wmOperator *UNUSED(op))
|
||||
if (sa->spacetype == SPACE_BUTS)
|
||||
ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
|
||||
else
|
||||
ob= ED_object_pose_armature(CTX_data_active_object(C));
|
||||
ob= object_pose_armature_get(CTX_data_active_object(C));
|
||||
|
||||
/* only continue if there's an object */
|
||||
if (ob == NULL)
|
||||
@ -1360,7 +1331,7 @@ static int pose_groups_menu_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED
|
||||
if (sa->spacetype == SPACE_BUTS)
|
||||
ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
|
||||
else
|
||||
ob= ED_object_pose_armature(CTX_data_active_object(C));
|
||||
ob= object_pose_armature_get(CTX_data_active_object(C));
|
||||
|
||||
/* only continue if there's an object, and a pose there too */
|
||||
if (ELEM(NULL, ob, ob->pose))
|
||||
@ -1409,7 +1380,7 @@ static int pose_group_assign_exec (bContext *C, wmOperator *op)
|
||||
if (sa->spacetype == SPACE_BUTS)
|
||||
ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
|
||||
else
|
||||
ob= ED_object_pose_armature(CTX_data_active_object(C));
|
||||
ob= object_pose_armature_get(CTX_data_active_object(C));
|
||||
|
||||
/* only continue if there's an object, and a pose there too */
|
||||
if (ELEM(NULL, ob, ob->pose))
|
||||
@ -1472,7 +1443,7 @@ static int pose_group_unassign_exec (bContext *C, wmOperator *UNUSED(op))
|
||||
if (sa->spacetype == SPACE_BUTS)
|
||||
ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
|
||||
else
|
||||
ob= ED_object_pose_armature(CTX_data_active_object(C));
|
||||
ob= object_pose_armature_get(CTX_data_active_object(C));
|
||||
|
||||
/* only continue if there's an object, and a pose there too */
|
||||
if (ELEM(NULL, ob, ob->pose))
|
||||
@ -1707,7 +1678,7 @@ static int pose_group_select_exec (bContext *C, wmOperator *UNUSED(op))
|
||||
if (sa->spacetype == SPACE_BUTS)
|
||||
ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
|
||||
else
|
||||
ob= ED_object_pose_armature(CTX_data_active_object(C));
|
||||
ob= object_pose_armature_get(CTX_data_active_object(C));
|
||||
|
||||
/* only continue if there's an object, and a pose there too */
|
||||
if (ELEM(NULL, ob, ob->pose))
|
||||
@ -1745,7 +1716,7 @@ static int pose_group_deselect_exec (bContext *C, wmOperator *UNUSED(op))
|
||||
if (sa->spacetype == SPACE_BUTS)
|
||||
ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
|
||||
else
|
||||
ob= ED_object_pose_armature(CTX_data_active_object(C));
|
||||
ob= object_pose_armature_get(CTX_data_active_object(C));
|
||||
|
||||
/* only continue if there's an object, and a pose there too */
|
||||
if (ELEM(NULL, ob, ob->pose))
|
||||
@ -1778,7 +1749,7 @@ void POSE_OT_group_deselect (wmOperatorType *ot)
|
||||
|
||||
static int pose_flip_names_exec (bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
|
||||
Object *ob= object_pose_armature_get(CTX_data_active_object(C));
|
||||
bArmature *arm;
|
||||
|
||||
/* paranoia checks */
|
||||
@ -1823,7 +1794,7 @@ void POSE_OT_flip_names (wmOperatorType *ot)
|
||||
|
||||
static int pose_autoside_names_exec (bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
|
||||
Object *ob= object_pose_armature_get(CTX_data_active_object(C));
|
||||
bArmature *arm;
|
||||
char newname[32];
|
||||
short axis= RNA_enum_get(op->ptr, "axis");
|
||||
@ -1927,7 +1898,7 @@ static int pose_armature_layers_showall_poll (bContext *C)
|
||||
|
||||
static int pose_armature_layers_showall_exec (bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
|
||||
Object *ob= object_pose_armature_get(CTX_data_active_object(C));
|
||||
bArmature *arm = (ob)? ob->data : NULL;
|
||||
PointerRNA ptr;
|
||||
int maxLayers = (RNA_boolean_get(op->ptr, "all"))? 32 : 16;
|
||||
@ -1979,7 +1950,7 @@ void ARMATURE_OT_layers_show_all (wmOperatorType *ot)
|
||||
/* Present a popup to get the layers that should be used */
|
||||
static int pose_armature_layers_invoke (bContext *C, wmOperator *op, wmEvent *evt)
|
||||
{
|
||||
Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
|
||||
Object *ob= object_pose_armature_get(CTX_data_active_object(C));
|
||||
bArmature *arm= (ob)? ob->data : NULL;
|
||||
PointerRNA ptr;
|
||||
int layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
|
||||
@ -2000,7 +1971,7 @@ static int pose_armature_layers_invoke (bContext *C, wmOperator *op, wmEvent *ev
|
||||
/* Set the visible layers for the active armature (edit and pose modes) */
|
||||
static int pose_armature_layers_exec (bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
|
||||
Object *ob= object_pose_armature_get(CTX_data_active_object(C));
|
||||
PointerRNA ptr;
|
||||
int layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
|
||||
|
||||
@ -2090,7 +2061,7 @@ static int pose_bone_layers_invoke (bContext *C, wmOperator *op, wmEvent *evt)
|
||||
/* Set the visible layers for the active armature (edit and pose modes) */
|
||||
static int pose_bone_layers_exec (bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
|
||||
Object *ob= object_pose_armature_get(CTX_data_active_object(C));
|
||||
PointerRNA ptr;
|
||||
int layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
|
||||
|
||||
@ -2213,7 +2184,7 @@ void ARMATURE_OT_bone_layers (wmOperatorType *ot)
|
||||
static int pose_flip_quats_exec (bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
|
||||
Object *ob= object_pose_armature_get(CTX_data_active_object(C));
|
||||
KeyingSet *ks = ANIM_builtin_keyingset_get_named(NULL, "LocRotScale");
|
||||
|
||||
/* loop through all selected pchans, flipping and keying (as needed) */
|
||||
|
@ -53,7 +53,6 @@
|
||||
|
||||
#include "curve_intern.h"
|
||||
|
||||
|
||||
/************************* registration ****************************/
|
||||
|
||||
void ED_operatortypes_curve(void)
|
||||
|
@ -117,7 +117,7 @@ static float nurbcircle[8][2]= {
|
||||
{0.0, 1.0}, { 1.0, 1.0}, { 1.0, 0.0}, { 1.0, -1.0}
|
||||
};
|
||||
|
||||
ListBase *curve_get_editcurve(Object *ob)
|
||||
ListBase *object_editcurve_get(Object *ob)
|
||||
{
|
||||
if(ob && ELEM(ob->type, OB_CURVE, OB_SURF)) {
|
||||
Curve *cu= ob->data;
|
||||
@ -134,7 +134,7 @@ static void set_actNurb(Object *obedit, Nurb *nu)
|
||||
if(nu==NULL)
|
||||
cu->actnu = -1;
|
||||
else {
|
||||
ListBase *nurbs= ED_curve_editnurbs(cu);
|
||||
ListBase *nurbs= curve_editnurbs(cu);
|
||||
cu->actnu = BLI_findindex(nurbs, nu);
|
||||
}
|
||||
}
|
||||
@ -142,7 +142,7 @@ static void set_actNurb(Object *obedit, Nurb *nu)
|
||||
static Nurb *get_actNurb(Object *obedit)
|
||||
{
|
||||
Curve *cu= obedit->data;
|
||||
ListBase *nurbs= ED_curve_editnurbs(cu);
|
||||
ListBase *nurbs= curve_editnurbs(cu);
|
||||
|
||||
return BLI_findlink(nurbs, cu->actnu);
|
||||
}
|
||||
@ -268,7 +268,7 @@ static int isNurbsel_count(Curve *cu, Nurb *nu)
|
||||
|
||||
void printknots(Object *obedit)
|
||||
{
|
||||
ListBase *editnurb= curve_get_editcurve(obedit);
|
||||
ListBase *editnurb= object_editcurve_get(obedit);
|
||||
Nurb *nu;
|
||||
int a, num;
|
||||
|
||||
@ -302,11 +302,6 @@ static CVKeyIndex *init_cvKeyIndex(void *cv, int key_index, int nu_index, int pt
|
||||
return cvIndex;
|
||||
}
|
||||
|
||||
static void free_cvKeyIndex(CVKeyIndex *pointIndex)
|
||||
{
|
||||
MEM_freeN(pointIndex);
|
||||
}
|
||||
|
||||
static void init_editNurb_keyIndex(EditNurb *editnurb, ListBase *origBase)
|
||||
{
|
||||
Nurb *nu= editnurb->nurbs.first;
|
||||
@ -358,15 +353,6 @@ static void init_editNurb_keyIndex(EditNurb *editnurb, ListBase *origBase)
|
||||
editnurb->keyindex= gh;
|
||||
}
|
||||
|
||||
static void free_editNurb_keyIndex(EditNurb *editnurb)
|
||||
{
|
||||
if (!editnurb->keyindex) {
|
||||
return;
|
||||
}
|
||||
BLI_ghash_free(editnurb->keyindex, NULL, (GHashValFreeFP)free_cvKeyIndex);
|
||||
editnurb->keyindex= NULL;
|
||||
}
|
||||
|
||||
static CVKeyIndex *getCVKeyIndex(EditNurb *editnurb, void *cv)
|
||||
{
|
||||
return BLI_ghash_lookup(editnurb->keyindex, cv);
|
||||
@ -411,7 +397,7 @@ static void keyIndex_delCV(EditNurb *editnurb, void *cv)
|
||||
return;
|
||||
}
|
||||
|
||||
BLI_ghash_remove(editnurb->keyindex, cv, NULL, (GHashValFreeFP)free_cvKeyIndex);
|
||||
BLI_ghash_remove(editnurb->keyindex, cv, NULL, (GHashValFreeFP)MEM_freeN);
|
||||
}
|
||||
|
||||
static void keyIndex_delBezt(EditNurb *editnurb, BezTriple *bezt)
|
||||
@ -437,7 +423,7 @@ static void keyIndex_delNurb(EditNurb *editnurb, Nurb *nu)
|
||||
a= nu->pntsu;
|
||||
|
||||
while (a--) {
|
||||
BLI_ghash_remove(editnurb->keyindex, bezt, NULL, (GHashValFreeFP)free_cvKeyIndex);
|
||||
BLI_ghash_remove(editnurb->keyindex, bezt, NULL, (GHashValFreeFP)MEM_freeN);
|
||||
++bezt;
|
||||
}
|
||||
} else {
|
||||
@ -445,7 +431,7 @@ static void keyIndex_delNurb(EditNurb *editnurb, Nurb *nu)
|
||||
a= nu->pntsu * nu->pntsv;
|
||||
|
||||
while (a--) {
|
||||
BLI_ghash_remove(editnurb->keyindex, bp, NULL, (GHashValFreeFP)free_cvKeyIndex);
|
||||
BLI_ghash_remove(editnurb->keyindex, bp, NULL, (GHashValFreeFP)MEM_freeN);
|
||||
++bp;
|
||||
}
|
||||
}
|
||||
@ -1198,7 +1184,7 @@ int ED_curve_updateAnimPaths(Object *obedit)
|
||||
/* load editNurb in object */
|
||||
void load_editNurb(Object *obedit)
|
||||
{
|
||||
ListBase *editnurb= curve_get_editcurve(obedit);
|
||||
ListBase *editnurb= object_editcurve_get(obedit);
|
||||
|
||||
if(obedit==NULL) return;
|
||||
|
||||
@ -1251,7 +1237,7 @@ void make_editNurb(Object *obedit)
|
||||
|
||||
if(editnurb) {
|
||||
freeNurblist(&editnurb->nurbs);
|
||||
free_editNurb_keyIndex(editnurb);
|
||||
free_curve_editNurb_keyIndex(editnurb);
|
||||
editnurb->keyindex= NULL;
|
||||
} else {
|
||||
editnurb= MEM_callocN(sizeof(EditNurb), "editnurb");
|
||||
@ -1283,16 +1269,6 @@ void make_editNurb(Object *obedit)
|
||||
}
|
||||
}
|
||||
|
||||
void free_curve_editNurb (Curve *cu)
|
||||
{
|
||||
if(cu->editnurb) {
|
||||
freeNurblist(&cu->editnurb->nurbs);
|
||||
free_editNurb_keyIndex(cu->editnurb);
|
||||
MEM_freeN(cu->editnurb);
|
||||
cu->editnurb= NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void free_editNurb(Object *obedit)
|
||||
{
|
||||
Curve *cu= obedit->data;
|
||||
@ -1302,7 +1278,7 @@ void free_editNurb(Object *obedit)
|
||||
|
||||
void CU_deselect_all(Object *obedit)
|
||||
{
|
||||
ListBase *editnurb= curve_get_editcurve(obedit);
|
||||
ListBase *editnurb= object_editcurve_get(obedit);
|
||||
|
||||
if (editnurb) {
|
||||
selectend_nurb(obedit, FIRST, 0, DESELECT); /* set first control points as unselected */
|
||||
@ -1312,7 +1288,7 @@ void CU_deselect_all(Object *obedit)
|
||||
|
||||
void CU_select_all(Object *obedit)
|
||||
{
|
||||
ListBase *editnurb= curve_get_editcurve(obedit);
|
||||
ListBase *editnurb= object_editcurve_get(obedit);
|
||||
|
||||
if (editnurb) {
|
||||
selectend_nurb(obedit, FIRST, 0, SELECT); /* set first control points as unselected */
|
||||
@ -1322,7 +1298,7 @@ void CU_select_all(Object *obedit)
|
||||
|
||||
void CU_select_swap(Object *obedit)
|
||||
{
|
||||
ListBase *editnurb= curve_get_editcurve(obedit);
|
||||
ListBase *editnurb= object_editcurve_get(obedit);
|
||||
|
||||
if (editnurb) {
|
||||
Curve *cu= obedit->data;
|
||||
@ -1397,7 +1373,7 @@ static int separate_exec(bContext *C, wmOperator *op)
|
||||
make_editNurb(newob);
|
||||
newedit= newcu->editnurb;
|
||||
freeNurblist(&newedit->nurbs);
|
||||
free_editNurb_keyIndex(newedit);
|
||||
free_curve_editNurb_keyIndex(newedit);
|
||||
|
||||
/* 3. move over parts from old object */
|
||||
for(nu= oldedit->nurbs.first; nu; nu=nu1) {
|
||||
@ -1588,7 +1564,7 @@ static int deleteflagNurb(bContext *C, wmOperator *UNUSED(op), int flag)
|
||||
{
|
||||
Object *obedit= CTX_data_edit_object(C);
|
||||
Curve *cu= obedit->data;
|
||||
ListBase *editnurb= curve_get_editcurve(obedit);
|
||||
ListBase *editnurb= object_editcurve_get(obedit);
|
||||
Nurb *nu, *next;
|
||||
BPoint *bp, *bpn, *newbp;
|
||||
int a, b, newu, newv, sel;
|
||||
@ -1835,7 +1811,7 @@ static short extrudeflagNurb(EditNurb *editnurb, int flag)
|
||||
|
||||
static void adduplicateflagNurb(Object *obedit, short flag)
|
||||
{
|
||||
ListBase *editnurb= curve_get_editcurve(obedit);
|
||||
ListBase *editnurb= object_editcurve_get(obedit);
|
||||
Nurb *nu, *newnu;
|
||||
BezTriple *bezt, *bezt1;
|
||||
BPoint *bp, *bp1;
|
||||
@ -2051,7 +2027,7 @@ void CURVE_OT_switch_direction(wmOperatorType *ot)
|
||||
static int set_goal_weight_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *obedit= CTX_data_edit_object(C);
|
||||
ListBase *editnurb= curve_get_editcurve(obedit);
|
||||
ListBase *editnurb= object_editcurve_get(obedit);
|
||||
Nurb *nu;
|
||||
BezTriple *bezt;
|
||||
BPoint *bp;
|
||||
@ -2103,7 +2079,7 @@ void CURVE_OT_spline_weight_set(wmOperatorType *ot)
|
||||
static int set_radius_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *obedit= CTX_data_edit_object(C);
|
||||
ListBase *editnurb= curve_get_editcurve(obedit);
|
||||
ListBase *editnurb= object_editcurve_get(obedit);
|
||||
Nurb *nu;
|
||||
BezTriple *bezt;
|
||||
BPoint *bp;
|
||||
@ -2155,7 +2131,7 @@ void CURVE_OT_radius_set(wmOperatorType *ot)
|
||||
static int smooth_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Object *obedit= CTX_data_edit_object(C);
|
||||
ListBase *editnurb= curve_get_editcurve(obedit);
|
||||
ListBase *editnurb= object_editcurve_get(obedit);
|
||||
Nurb *nu;
|
||||
BezTriple *bezt, *beztOrig;
|
||||
BPoint *bp, *bpOrig;
|
||||
@ -2228,7 +2204,7 @@ void CURVE_OT_smooth(wmOperatorType *ot)
|
||||
static int smooth_radius_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Object *obedit= CTX_data_edit_object(C);
|
||||
ListBase *editnurb= curve_get_editcurve(obedit);
|
||||
ListBase *editnurb= object_editcurve_get(obedit);
|
||||
Nurb *nu;
|
||||
BezTriple *bezt;
|
||||
BPoint *bp;
|
||||
@ -2461,7 +2437,7 @@ static void select_adjacent_cp(ListBase *editnurb, short next, short cont, short
|
||||
/* selstatus: selection status in case doswap is false */
|
||||
void selectend_nurb(Object *obedit, short selfirst, short doswap, short selstatus)
|
||||
{
|
||||
ListBase *editnurb= curve_get_editcurve(obedit);
|
||||
ListBase *editnurb= object_editcurve_get(obedit);
|
||||
Nurb *nu;
|
||||
BPoint *bp;
|
||||
BezTriple *bezt;
|
||||
@ -2603,7 +2579,7 @@ static short nurb_has_selected_cps(ListBase *editnurb)
|
||||
static int de_select_all_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *obedit= CTX_data_edit_object(C);
|
||||
ListBase *editnurb= curve_get_editcurve(obedit);
|
||||
ListBase *editnurb= object_editcurve_get(obedit);
|
||||
int action = RNA_enum_get(op->ptr, "action");
|
||||
|
||||
if (action == SEL_TOGGLE) {
|
||||
@ -2652,7 +2628,7 @@ static int hide_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *obedit= CTX_data_edit_object(C);
|
||||
Curve *cu= obedit->data;
|
||||
ListBase *editnurb= curve_get_editcurve(obedit);
|
||||
ListBase *editnurb= object_editcurve_get(obedit);
|
||||
Nurb *nu;
|
||||
BPoint *bp;
|
||||
BezTriple *bezt;
|
||||
@ -2725,7 +2701,7 @@ void CURVE_OT_hide(wmOperatorType *ot)
|
||||
static int reveal_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Object *obedit= CTX_data_edit_object(C);
|
||||
ListBase *editnurb= curve_get_editcurve(obedit);
|
||||
ListBase *editnurb= object_editcurve_get(obedit);
|
||||
Nurb *nu;
|
||||
BPoint *bp;
|
||||
BezTriple *bezt;
|
||||
@ -2783,7 +2759,7 @@ static int select_inverse_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Object *obedit= CTX_data_edit_object(C);
|
||||
Curve *cu= obedit->data;
|
||||
ListBase *editnurb= curve_get_editcurve(obedit);
|
||||
ListBase *editnurb= object_editcurve_get(obedit);
|
||||
Nurb *nu;
|
||||
BPoint *bp;
|
||||
BezTriple *bezt;
|
||||
@ -3542,7 +3518,7 @@ void ED_nurb_set_spline_type(Nurb *nu, int type)
|
||||
static int set_spline_type_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *obedit= CTX_data_edit_object(C);
|
||||
ListBase *editnurb= curve_get_editcurve(obedit);
|
||||
ListBase *editnurb= object_editcurve_get(obedit);
|
||||
Nurb *nu;
|
||||
int changed=0, type= RNA_enum_get(op->ptr, "type");
|
||||
|
||||
@ -3606,7 +3582,7 @@ void CURVE_OT_spline_type_set(wmOperatorType *ot)
|
||||
static int set_handle_type_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *obedit= CTX_data_edit_object(C);
|
||||
ListBase *editnurb= curve_get_editcurve(obedit);
|
||||
ListBase *editnurb= object_editcurve_get(obedit);
|
||||
|
||||
sethandlesNurb(editnurb, RNA_enum_get(op->ptr, "type"));
|
||||
|
||||
@ -3928,7 +3904,7 @@ static void merge_2_nurb(wmOperator *op, ListBase *editnurb, Nurb *nu1, Nurb *nu
|
||||
static int merge_nurb(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *obedit= CTX_data_edit_object(C);
|
||||
ListBase *editnurb= curve_get_editcurve(obedit);
|
||||
ListBase *editnurb= object_editcurve_get(obedit);
|
||||
NurbSort *nus1, *nus2;
|
||||
int ok= 1;
|
||||
|
||||
@ -3984,7 +3960,7 @@ static int make_segment_exec(bContext *C, wmOperator *op)
|
||||
/* joins 2 curves */
|
||||
Object *obedit= CTX_data_edit_object(C);
|
||||
Curve *cu= obedit->data;
|
||||
ListBase *nubase= curve_get_editcurve(obedit);
|
||||
ListBase *nubase= object_editcurve_get(obedit);
|
||||
Nurb *nu, *nu1=NULL, *nu2=NULL;
|
||||
BPoint *bp;
|
||||
float *fp, offset;
|
||||
@ -4180,7 +4156,7 @@ int mouse_nurb(bContext *C, const int mval[2], int extend)
|
||||
{
|
||||
Object *obedit= CTX_data_edit_object(C);
|
||||
Curve *cu= obedit->data;
|
||||
ListBase *editnurb= curve_get_editcurve(obedit);
|
||||
ListBase *editnurb= object_editcurve_get(obedit);
|
||||
ViewContext vc;
|
||||
Nurb *nu;
|
||||
BezTriple *bezt=NULL;
|
||||
@ -4264,7 +4240,7 @@ int mouse_nurb(bContext *C, const int mval[2], int extend)
|
||||
static int spin_nurb(float viewmat[][4], Object *obedit, float *axis, float *cent)
|
||||
{
|
||||
Curve *cu= (Curve*)obedit->data;
|
||||
ListBase *editnurb= curve_get_editcurve(obedit);
|
||||
ListBase *editnurb= object_editcurve_get(obedit);
|
||||
Nurb *nu;
|
||||
float si,phi,n[3],q[4],cmat[3][3],tmat[3][3],imat[3][3];
|
||||
float bmat[3][3], rotmat[3][3], scalemat1[3][3], scalemat2[3][3];
|
||||
@ -4786,7 +4762,7 @@ static int toggle_cyclic_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *obedit= CTX_data_edit_object(C);
|
||||
Curve *cu= obedit->data;
|
||||
ListBase *editnurb= curve_get_editcurve(obedit);
|
||||
ListBase *editnurb= object_editcurve_get(obedit);
|
||||
Nurb *nu;
|
||||
BezTriple *bezt;
|
||||
BPoint *bp;
|
||||
@ -4863,7 +4839,7 @@ static int toggle_cyclic_exec(bContext *C, wmOperator *op)
|
||||
static int toggle_cyclic_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
|
||||
{
|
||||
Object *obedit= CTX_data_edit_object(C);
|
||||
ListBase *editnurb= curve_get_editcurve(obedit);
|
||||
ListBase *editnurb= object_editcurve_get(obedit);
|
||||
uiPopupMenu *pup;
|
||||
uiLayout *layout;
|
||||
Nurb *nu;
|
||||
@ -5050,7 +5026,7 @@ static int select_row_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Object *obedit= CTX_data_edit_object(C);
|
||||
Curve *cu= obedit->data;
|
||||
ListBase *editnurb= curve_get_editcurve(obedit);
|
||||
ListBase *editnurb= object_editcurve_get(obedit);
|
||||
static BPoint *last= NULL;
|
||||
static int direction=0;
|
||||
Nurb *nu;
|
||||
@ -5124,7 +5100,7 @@ void CURVE_OT_select_row(wmOperatorType *ot)
|
||||
static int select_next_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Object *obedit= CTX_data_edit_object(C);
|
||||
ListBase *editnurb= curve_get_editcurve(obedit);
|
||||
ListBase *editnurb= object_editcurve_get(obedit);
|
||||
|
||||
select_adjacent_cp(editnurb, 1, 0, SELECT);
|
||||
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
|
||||
@ -5151,7 +5127,7 @@ void CURVE_OT_select_next(wmOperatorType *ot)
|
||||
static int select_previous_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Object *obedit= CTX_data_edit_object(C);
|
||||
ListBase *editnurb= curve_get_editcurve(obedit);
|
||||
ListBase *editnurb= object_editcurve_get(obedit);
|
||||
|
||||
select_adjacent_cp(editnurb, -1, 0, SELECT);
|
||||
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
|
||||
@ -5178,7 +5154,7 @@ void CURVE_OT_select_previous(wmOperatorType *ot)
|
||||
static int select_more_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Object *obedit= CTX_data_edit_object(C);
|
||||
ListBase *editnurb= curve_get_editcurve(obedit);
|
||||
ListBase *editnurb= object_editcurve_get(obedit);
|
||||
Nurb *nu;
|
||||
BPoint *bp, *tempbp;
|
||||
int a;
|
||||
@ -5266,7 +5242,7 @@ void CURVE_OT_select_more(wmOperatorType *ot)
|
||||
static int select_less_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Object *obedit= CTX_data_edit_object(C);
|
||||
ListBase *editnurb= curve_get_editcurve(obedit);
|
||||
ListBase *editnurb= object_editcurve_get(obedit);
|
||||
Nurb *nu;
|
||||
BPoint *bp;
|
||||
BezTriple *bezt;
|
||||
@ -5458,7 +5434,7 @@ static void selectrandom_curve(ListBase *editnurb, float randfac)
|
||||
static int select_random_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *obedit= CTX_data_edit_object(C);
|
||||
ListBase *editnurb= curve_get_editcurve(obedit);
|
||||
ListBase *editnurb= object_editcurve_get(obedit);
|
||||
|
||||
if(!RNA_boolean_get(op->ptr, "extend"))
|
||||
CU_deselect_all(obedit);
|
||||
@ -5550,7 +5526,7 @@ static void select_nth_bp(Nurb *nu, BPoint *bp, int nth)
|
||||
int CU_select_nth(Object *obedit, int nth)
|
||||
{
|
||||
Curve *cu= (Curve*)obedit->data;
|
||||
ListBase *nubase= ED_curve_editnurbs(cu);
|
||||
ListBase *nubase= curve_editnurbs(cu);
|
||||
Nurb *nu;
|
||||
int ok=0;
|
||||
|
||||
@ -6024,7 +6000,7 @@ void CURVE_OT_delete(wmOperatorType *ot)
|
||||
static int shade_smooth_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *obedit= CTX_data_edit_object(C);
|
||||
ListBase *editnurb= curve_get_editcurve(obedit);
|
||||
ListBase *editnurb= object_editcurve_get(obedit);
|
||||
Nurb *nu;
|
||||
int clear= (strcmp(op->idname, "CURVE_OT_shade_flat") == 0);
|
||||
|
||||
@ -6196,7 +6172,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
|
||||
{
|
||||
static int xzproj= 0; /* this function calls itself... */
|
||||
Object *obedit= CTX_data_edit_object(C);
|
||||
ListBase *editnurb= curve_get_editcurve(obedit);
|
||||
ListBase *editnurb= object_editcurve_get(obedit);
|
||||
View3D *v3d= CTX_wm_view3d(C);
|
||||
RegionView3D *rv3d= ED_view3d_context_rv3d(C);
|
||||
Nurb *nu = NULL;
|
||||
@ -6612,7 +6588,7 @@ static int curvesurf_prim_add(bContext *C, wmOperator *op, int type, int isSurf)
|
||||
ED_object_new_primitive_matrix(C, obedit, loc, rot, mat);
|
||||
|
||||
nu= add_nurbs_primitive(C, mat, type, newob);
|
||||
editnurb= curve_get_editcurve(obedit);
|
||||
editnurb= object_editcurve_get(obedit);
|
||||
BLI_addtail(editnurb, nu);
|
||||
|
||||
/* userdef */
|
||||
@ -6895,7 +6871,7 @@ static int clear_tilt_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Object *obedit= CTX_data_edit_object(C);
|
||||
Curve *cu= obedit->data;
|
||||
ListBase *editnurb= curve_get_editcurve(obedit);
|
||||
ListBase *editnurb= object_editcurve_get(obedit);
|
||||
Nurb *nu;
|
||||
BezTriple *bezt;
|
||||
BPoint *bp;
|
||||
@ -6965,7 +6941,7 @@ static void undoCurve_to_editCurve(void *ucu, void *obe)
|
||||
Curve *cu= (Curve*)obedit->data;
|
||||
UndoCurve *undoCurve= ucu;
|
||||
ListBase *undobase= &undoCurve->nubase;
|
||||
ListBase *editbase= ED_curve_editnurbs(cu);
|
||||
ListBase *editbase= curve_editnurbs(cu);
|
||||
Nurb *nu, *newnu;
|
||||
EditNurb *editnurb= cu->editnurb;
|
||||
void *lastsel= NULL;
|
||||
@ -6974,7 +6950,7 @@ static void undoCurve_to_editCurve(void *ucu, void *obe)
|
||||
freeNurblist(editbase);
|
||||
|
||||
if (undoCurve->undoIndex) {
|
||||
BLI_ghash_free(editnurb->keyindex, NULL, (GHashValFreeFP)free_cvKeyIndex);
|
||||
BLI_ghash_free(editnurb->keyindex, NULL, (GHashValFreeFP)MEM_freeN);
|
||||
editnurb->keyindex= dupli_keyIndexHash(undoCurve->undoIndex);
|
||||
}
|
||||
|
||||
@ -7013,7 +6989,7 @@ static void *editCurve_to_undoCurve(void *obe)
|
||||
{
|
||||
Object *obedit= obe;
|
||||
Curve *cu= (Curve*)obedit->data;
|
||||
ListBase *nubase= ED_curve_editnurbs(cu);
|
||||
ListBase *nubase= curve_editnurbs(cu);
|
||||
UndoCurve *undoCurve;
|
||||
EditNurb *editnurb= cu->editnurb, tmpEditnurb;
|
||||
Nurb *nu, *newnu;
|
||||
@ -7062,7 +7038,7 @@ static void free_undoCurve(void *ucv)
|
||||
freeNurblist(&undoCurve->nubase);
|
||||
|
||||
if(undoCurve->undoIndex)
|
||||
BLI_ghash_free(undoCurve->undoIndex, NULL, (GHashValFreeFP)free_cvKeyIndex);
|
||||
BLI_ghash_free(undoCurve->undoIndex, NULL, (GHashValFreeFP)MEM_freeN);
|
||||
|
||||
free_fcurves(&undoCurve->fcurves);
|
||||
free_fcurves(&undoCurve->drivers);
|
||||
@ -7082,15 +7058,6 @@ void undo_push_curve(bContext *C, const char *name)
|
||||
undo_editmode_push(C, name, get_data, free_undoCurve, undoCurve_to_editCurve, editCurve_to_undoCurve, NULL);
|
||||
}
|
||||
|
||||
/* Get list of nurbs from editnurbs structure */
|
||||
ListBase *ED_curve_editnurbs(Curve *cu)
|
||||
{
|
||||
if (cu->editnurb) {
|
||||
return &cu->editnurb->nurbs;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
void ED_curve_beztcpy(EditNurb *editnurb, BezTriple *dst, BezTriple *src, int count)
|
||||
{
|
||||
memcpy(dst, src, count*sizeof(BezTriple));
|
||||
|
@ -1878,7 +1878,7 @@ static int gpencil_draw_modal (bContext *C, wmOperator *op, wmEvent *event)
|
||||
static EnumPropertyItem prop_gpencil_drawmodes[] = {
|
||||
{GP_PAINTMODE_DRAW, "DRAW", 0, "Draw Freehand", ""},
|
||||
{GP_PAINTMODE_DRAW_STRAIGHT, "DRAW_STRAIGHT", 0, "Draw Straight Lines", ""},
|
||||
{GP_PAINTMODE_DRAW_POLY, "DRAW_POLY", 0, "Dtaw Poly Line", ""},
|
||||
{GP_PAINTMODE_DRAW_POLY, "DRAW_POLY", 0, "Draw Poly Line", ""},
|
||||
{GP_PAINTMODE_ERASER, "ERASER", 0, "Eraser", ""},
|
||||
{0, NULL, 0, NULL, NULL}
|
||||
};
|
||||
|
@ -148,7 +148,6 @@ void ED_armature_bone_rename(struct bArmature *arm, char *oldnamep, char *newnam
|
||||
void undo_push_armature(struct bContext *C, const char *name);
|
||||
|
||||
/* poseobject.c */
|
||||
struct Object *ED_object_pose_armature(struct Object *ob);
|
||||
void ED_armature_exit_posemode(struct bContext *C, struct Base *base);
|
||||
void ED_armature_enter_posemode(struct bContext *C, struct Base *base);
|
||||
int ED_pose_channel_in_IK_chain(struct Object *ob, struct bPoseChannel *pchan);
|
||||
|
@ -58,7 +58,7 @@ void CU_select_swap(struct Object *obedit);
|
||||
|
||||
|
||||
void undo_push_curve (struct bContext *C, const char *name);
|
||||
ListBase *curve_get_editcurve(struct Object *ob);
|
||||
ListBase *object_editcurve_get(struct Object *ob);
|
||||
|
||||
void load_editNurb (struct Object *obedit);
|
||||
void make_editNurb (struct Object *obedit);
|
||||
|
@ -44,7 +44,6 @@ void ED_operatortypes_sculpt(void);
|
||||
void sculpt_get_redraw_planes(float planes[4][4], struct ARegion *ar,
|
||||
struct RegionView3D *rv3d, struct Object *ob);
|
||||
void ED_sculpt_force_update(struct bContext *C);
|
||||
void ED_sculpt_modifiers_changed(struct Object *ob);
|
||||
|
||||
/* paint_ops.c */
|
||||
void ED_operatortypes_paint(void);
|
||||
|
@ -959,13 +959,13 @@ static float polar_to_y(float center, float diam, float ampli, float angle)
|
||||
return center + diam * ampli * sinf(angle);
|
||||
}
|
||||
|
||||
static void vectorscope_draw_target(float centerx, float centery, float diam, float r, float g, float b)
|
||||
static void vectorscope_draw_target(float centerx, float centery, float diam, const float colf[3])
|
||||
{
|
||||
float y,u,v;
|
||||
float tangle=0.f, tampli;
|
||||
float dangle, dampli, dangle2, dampli2;
|
||||
|
||||
rgb_to_yuv(r,g,b, &y, &u, &v);
|
||||
rgb_to_yuv(colf[0], colf[1], colf[2], &y, &u, &v);
|
||||
if (u>0 && v>=0) tangle=atanf(v/u);
|
||||
else if (u>0 && v<0) tangle= atanf(v/u) + 2.0f * (float)M_PI;
|
||||
else if (u<0) tangle=atanf(v/u) + (float)M_PI;
|
||||
@ -975,7 +975,7 @@ static void vectorscope_draw_target(float centerx, float centery, float diam, fl
|
||||
|
||||
/* small target vary by 2.5 degree and 2.5 IRE unit */
|
||||
glColor4f(1.0f, 1.0f, 1.0, 0.12f);
|
||||
dangle= 2.5f*(float)M_PI/180.0f;
|
||||
dangle= DEG2RADF(2.5f);
|
||||
dampli= 2.5f/200.0f;
|
||||
glBegin(GL_LINE_STRIP);
|
||||
glVertex2f(polar_to_x(centerx,diam,tampli+dampli,tangle+dangle), polar_to_y(centery,diam,tampli+dampli,tangle+dangle));
|
||||
@ -986,9 +986,9 @@ static void vectorscope_draw_target(float centerx, float centery, float diam, fl
|
||||
glEnd();
|
||||
/* big target vary by 10 degree and 20% amplitude */
|
||||
glColor4f(1.0f, 1.0f, 1.0, 0.12f);
|
||||
dangle= 10.0f*(float)M_PI/180.0f;
|
||||
dangle= DEG2RADF(10.0f);
|
||||
dampli= 0.2f*tampli;
|
||||
dangle2= 5.0f*(float)M_PI/180.0f;
|
||||
dangle2= DEG2RADF(5.0f);
|
||||
dampli2= 0.5f*dampli;
|
||||
glBegin(GL_LINE_STRIP);
|
||||
glVertex2f(polar_to_x(centerx,diam,tampli+dampli-dampli2,tangle+dangle), polar_to_y(centery,diam,tampli+dampli-dampli2,tangle+dangle));
|
||||
@ -1014,13 +1014,13 @@ static void vectorscope_draw_target(float centerx, float centery, float diam, fl
|
||||
|
||||
void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *recti)
|
||||
{
|
||||
const float skin_rad= DEG2RADF(123.0f); /* angle in radians of the skin tone line */
|
||||
Scopes *scopes = (Scopes *)but->poin;
|
||||
rctf rect;
|
||||
int i, j;
|
||||
int skina= 123; /* angle in degree of the skin tone line */
|
||||
float w, h, centerx, centery, diam;
|
||||
float alpha;
|
||||
float colors[6][3]={{.75,0,0},{.75,.75,0},{0,.75,0},{0,.75,.75},{0,0,.75},{.75,0,.75}};
|
||||
const float colors[6][3]={{.75,0,0},{.75,.75,0},{0,.75,0},{0,.75,.75},{0,0,.75},{.75,0,.75}};
|
||||
GLint scissor[4];
|
||||
|
||||
rect.xmin = (float)recti->xmin+1;
|
||||
@ -1056,19 +1056,19 @@ void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wco
|
||||
for(j=0; j<5; j++) {
|
||||
glBegin(GL_LINE_STRIP);
|
||||
for(i=0; i<=360; i=i+15) {
|
||||
float a= i*M_PI/180.0;
|
||||
float r= (j+1)/10.0f;
|
||||
glVertex2f( polar_to_x(centerx,diam,r,a), polar_to_y(centery,diam,r,a));
|
||||
const float a= DEG2RADF((float)i);
|
||||
const float r= (j+1)/10.0f;
|
||||
glVertex2f(polar_to_x(centerx,diam,r,a), polar_to_y(centery,diam,r,a));
|
||||
}
|
||||
glEnd();
|
||||
}
|
||||
/* skin tone line */
|
||||
glColor4f(1.f, 0.4f, 0.f, 0.2f);
|
||||
fdrawline( polar_to_x(centerx, diam, 0.5f, skina*M_PI/180.0), polar_to_y(centery,diam,0.5,skina*M_PI/180.0),
|
||||
polar_to_x(centerx, diam, 0.1f, skina*M_PI/180.0), polar_to_y(centery,diam,0.1,skina*M_PI/180.0));
|
||||
fdrawline(polar_to_x(centerx, diam, 0.5f, skin_rad), polar_to_y(centery,diam,0.5,skin_rad),
|
||||
polar_to_x(centerx, diam, 0.1f, skin_rad), polar_to_y(centery,diam,0.1,skin_rad));
|
||||
/* saturation points */
|
||||
for(i=0; i<6; i++)
|
||||
vectorscope_draw_target(centerx, centery, diam, colors[i][0], colors[i][1], colors[i][2]);
|
||||
vectorscope_draw_target(centerx, centery, diam, colors[i]);
|
||||
|
||||
if (scopes->ok && scopes->vecscope != NULL) {
|
||||
/* pixel point cloud */
|
||||
|
@ -1235,7 +1235,7 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
|
||||
ysize= block->maxy - block->miny+4;
|
||||
/*aspect/= (float)xsize;*/ /*UNUSED*/
|
||||
|
||||
if(but) {
|
||||
{
|
||||
int left=0, right=0, top=0, down=0;
|
||||
int winx, winy;
|
||||
// int offscreen;
|
||||
|
@ -588,20 +588,6 @@ static void shadecolors4(char *coltop, char *coldown, const char *color, short s
|
||||
coldown[3]= color[3];
|
||||
}
|
||||
|
||||
static void round_box_shade_col4(const char col1[4], const char col2[4], const float fac)
|
||||
{
|
||||
unsigned char col[4];
|
||||
const int faci= FTOCHAR(fac);
|
||||
const int facm= 255-faci;
|
||||
|
||||
col[0]= (faci*col1[0] + facm*col2[0])>>8;
|
||||
col[1]= (faci*col1[1] + facm*col2[1])>>8;
|
||||
col[2]= (faci*col1[2] + facm*col2[2])>>8;
|
||||
col[3]= (faci*col1[3] + facm*col2[3])>>8;
|
||||
|
||||
glColor4ubv(col);
|
||||
}
|
||||
|
||||
static void round_box_shade_col4_r(unsigned char col_r[4], const char col1[4], const char col2[4], const float fac)
|
||||
{
|
||||
const int faci= FTOCHAR(fac);
|
||||
|
@ -400,7 +400,7 @@ static Object *effector_add_type(bContext *C, wmOperator *op, int type)
|
||||
((Curve*)ob->data)->flag |= CU_PATH|CU_3D;
|
||||
ED_object_enter_editmode(C, 0);
|
||||
ED_object_new_primitive_matrix(C, ob, loc, rot, mat);
|
||||
BLI_addtail(curve_get_editcurve(ob), add_nurbs_primitive(C, mat, CU_NURBS|CU_PRIM_PATH, 1));
|
||||
BLI_addtail(object_editcurve_get(ob), add_nurbs_primitive(C, mat, CU_NURBS|CU_PRIM_PATH, 1));
|
||||
|
||||
if(!enter_editmode)
|
||||
ED_object_exit_editmode(C, EM_FREEDATA);
|
||||
|
@ -987,7 +987,7 @@ static int pose_constraints_clear_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Main *bmain= CTX_data_main(C);
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
|
||||
Object *ob= object_pose_armature_get(CTX_data_active_object(C));
|
||||
|
||||
/* free constraints for all selected bones */
|
||||
CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones)
|
||||
@ -1423,7 +1423,7 @@ static int object_constraint_add_exec(bContext *C, wmOperator *op)
|
||||
/* dummy operator callback */
|
||||
static int pose_constraint_add_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob= ED_object_pose_armature(ED_object_active_context(C));
|
||||
Object *ob= object_pose_armature_get(ED_object_active_context(C));
|
||||
int type= RNA_enum_get(op->ptr, "type");
|
||||
short with_targets= 0;
|
||||
|
||||
@ -1526,7 +1526,7 @@ void POSE_OT_constraint_add_with_targets(wmOperatorType *ot)
|
||||
/* present menu with options + validation for targets to use */
|
||||
static int pose_ik_add_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(evt))
|
||||
{
|
||||
Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
|
||||
Object *ob= object_pose_armature_get(CTX_data_active_object(C));
|
||||
bPoseChannel *pchan= get_active_posechannel(ob);
|
||||
bConstraint *con= NULL;
|
||||
|
||||
@ -1610,7 +1610,7 @@ void POSE_OT_ik_add(wmOperatorType *ot)
|
||||
/* remove IK constraints from selected bones */
|
||||
static int pose_ik_clear_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
|
||||
Object *ob= object_pose_armature_get(CTX_data_active_object(C));
|
||||
|
||||
/* only remove IK Constraints */
|
||||
CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones)
|
||||
|
@ -217,7 +217,7 @@ static void select_editlattice_hook(Object *obedit, HookModifierData *hmd)
|
||||
|
||||
static int return_editcurve_indexar(Object *obedit, int *tot, int **indexar, float *cent)
|
||||
{
|
||||
ListBase *editnurb= curve_get_editcurve(obedit);
|
||||
ListBase *editnurb= object_editcurve_get(obedit);
|
||||
Nurb *nu;
|
||||
BPoint *bp;
|
||||
BezTriple *bezt;
|
||||
@ -329,7 +329,7 @@ static int object_hook_index_array(Object *obedit, int *tot, int **indexar, char
|
||||
|
||||
static void select_editcurve_hook(Object *obedit, HookModifierData *hmd)
|
||||
{
|
||||
ListBase *editnurb= curve_get_editcurve(obedit);
|
||||
ListBase *editnurb= object_editcurve_get(obedit);
|
||||
Nurb *nu;
|
||||
BPoint *bp;
|
||||
BezTriple *bezt;
|
||||
|
@ -724,7 +724,7 @@ static int modifier_remove_exec(bContext *C, wmOperator *op)
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
Object *ob = ED_object_active_context(C);
|
||||
ModifierData *md = edit_modifier_property_get(op, ob, 0);
|
||||
int mode_orig = ob->mode;
|
||||
int mode_orig = ob ? ob->mode : 0;
|
||||
|
||||
if(!ob || !md || !ED_object_modifier_remove(op->reports, bmain, scene, ob, md))
|
||||
return OPERATOR_CANCELLED;
|
||||
|
@ -575,7 +575,7 @@ static int findFreeNavPolyIndex(EditMesh* em)
|
||||
else if (indices[i]>freeIdx)
|
||||
break;
|
||||
}
|
||||
delete indices;
|
||||
delete [] indices;
|
||||
return freeIdx;
|
||||
}
|
||||
|
||||
|
@ -140,7 +140,7 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
|
||||
BKE_mesh_end_editmesh(me, em);
|
||||
}
|
||||
else if(ELEM(obedit->type, OB_SURF, OB_CURVE)) {
|
||||
ListBase *editnurb= curve_get_editcurve(obedit);
|
||||
ListBase *editnurb= object_editcurve_get(obedit);
|
||||
|
||||
cu= obedit->data;
|
||||
|
||||
|
@ -52,6 +52,7 @@
|
||||
|
||||
#include "BKE_animsys.h"
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_curve.h"
|
||||
#include "BKE_depsgraph.h"
|
||||
#include "BKE_font.h"
|
||||
#include "BKE_global.h"
|
||||
@ -180,7 +181,7 @@ static int material_slot_assign_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
}
|
||||
else if(ELEM(ob->type, OB_CURVE, OB_SURF)) {
|
||||
Nurb *nu;
|
||||
ListBase *nurbs= ED_curve_editnurbs((Curve*)ob->data);
|
||||
ListBase *nurbs= curve_editnurbs((Curve*)ob->data);
|
||||
|
||||
if(nurbs) {
|
||||
for(nu= nurbs->first; nu; nu= nu->next)
|
||||
@ -238,7 +239,7 @@ static int material_slot_de_select(bContext *C, int select)
|
||||
}
|
||||
}
|
||||
else if ELEM(ob->type, OB_CURVE, OB_SURF) {
|
||||
ListBase *nurbs= ED_curve_editnurbs((Curve*)ob->data);
|
||||
ListBase *nurbs= curve_editnurbs((Curve*)ob->data);
|
||||
Nurb *nu;
|
||||
BPoint *bp;
|
||||
BezTriple *bezt;
|
||||
|
@ -238,7 +238,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
|
||||
}
|
||||
}
|
||||
else if(CTX_data_equals(member, "visible_pose_bones")) {
|
||||
Object *obpose= ED_object_pose_armature(obact);
|
||||
Object *obpose= object_pose_armature_get(obact);
|
||||
bArmature *arm= (obpose) ? obpose->data : NULL;
|
||||
bPoseChannel *pchan;
|
||||
|
||||
@ -254,7 +254,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
|
||||
}
|
||||
}
|
||||
else if(CTX_data_equals(member, "selected_pose_bones")) {
|
||||
Object *obpose= ED_object_pose_armature(obact);
|
||||
Object *obpose= object_pose_armature_get(obact);
|
||||
bArmature *arm= (obpose) ? obpose->data : NULL;
|
||||
bPoseChannel *pchan;
|
||||
|
||||
@ -289,7 +289,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
|
||||
}
|
||||
else if(CTX_data_equals(member, "active_pose_bone")) {
|
||||
bPoseChannel *pchan;
|
||||
Object *obpose= ED_object_pose_armature(obact);
|
||||
Object *obpose= object_pose_armature_get(obact);
|
||||
|
||||
pchan= get_active_posechannel(obpose);
|
||||
if (pchan) {
|
||||
|
@ -52,6 +52,7 @@
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_mesh.h"
|
||||
#include "BKE_object.h"
|
||||
#include "BKE_report.h"
|
||||
#include "BKE_scene.h"
|
||||
#include "BKE_screen.h"
|
||||
@ -346,7 +347,7 @@ int ED_operator_posemode(bContext *C)
|
||||
|
||||
if (obact && !(obact->mode & OB_MODE_EDIT)) {
|
||||
Object *obpose;
|
||||
if((obpose= ED_object_pose_armature(obact))) {
|
||||
if((obpose= object_pose_armature_get(obact))) {
|
||||
if((obact == obpose) || (obact->mode & OB_MODE_WEIGHT_PAINT)) {
|
||||
return 1;
|
||||
}
|
||||
|
@ -717,7 +717,7 @@ static int project_paint_PickColor(const ProjPaintState *ps, float pt[2], float
|
||||
* 1 : occluded
|
||||
2 : occluded with w[3] weights set (need to know in some cases) */
|
||||
|
||||
static int project_paint_occlude_ptv(float pt[3], float v1[3], float v2[3], float v3[3], float w[3], int is_ortho)
|
||||
static int project_paint_occlude_ptv(float pt[3], float v1[4], float v2[4], float v3[4], float w[3], int is_ortho)
|
||||
{
|
||||
/* if all are behind us, return false */
|
||||
if(v1[2] > pt[2] && v2[2] > pt[2] && v3[2] > pt[2])
|
||||
@ -749,7 +749,7 @@ static int project_paint_occlude_ptv(float pt[3], float v1[3], float v2[3], floa
|
||||
|
||||
static int project_paint_occlude_ptv_clip(
|
||||
const ProjPaintState *ps, const MFace *mf,
|
||||
float pt[3], float v1[3], float v2[3], float v3[3],
|
||||
float pt[3], float v1[4], float v2[4], float v3[4],
|
||||
const int side )
|
||||
{
|
||||
float w[3], wco[3];
|
||||
|
@ -447,9 +447,9 @@ static void paint_draw_alpha_overlay(Sculpt *sd, Brush *brush,
|
||||
if(brush->mtex.brush_map_mode == MTEX_MAP_MODE_FIXED) {
|
||||
/* brush rotation */
|
||||
glTranslatef(0.5, 0.5, 0);
|
||||
glRotatef((double)((brush->flag & BRUSH_RAKE) ?
|
||||
sd->last_angle : sd->special_rotation) * (180.0/M_PI),
|
||||
0.0, 0.0, 1.0);
|
||||
glRotatef((double)RAD2DEGF((brush->flag & BRUSH_RAKE) ?
|
||||
sd->last_angle : sd->special_rotation),
|
||||
0.0, 0.0, 1.0);
|
||||
glTranslatef(-0.5f, -0.5f, 0);
|
||||
|
||||
/* scale based on tablet pressure */
|
||||
@ -683,7 +683,7 @@ static void paint_brush_stroke_add_step(bContext *C, wmOperator *op, wmEvent *ev
|
||||
/* TODO: as sculpt and other paint modes are unified, this
|
||||
separation will go away */
|
||||
if(stroke->vc.obact->sculpt) {
|
||||
float delta[3];
|
||||
float delta[2];
|
||||
|
||||
brush_jitter_pos(brush, mouse_in, mouse);
|
||||
|
||||
@ -691,13 +691,14 @@ static void paint_brush_stroke_add_step(bContext *C, wmOperator *op, wmEvent *ev
|
||||
brush_jitter_pos isn't written in the best way to
|
||||
be reused here */
|
||||
if(brush->flag & BRUSH_JITTER_PRESSURE) {
|
||||
sub_v3_v3v3(delta, mouse, mouse_in);
|
||||
mul_v3_fl(delta, pressure);
|
||||
add_v3_v3v3(mouse, mouse_in, delta);
|
||||
sub_v2_v2v2(delta, mouse, mouse_in);
|
||||
mul_v2_fl(delta, pressure);
|
||||
add_v2_v2v2(mouse, mouse_in, delta);
|
||||
}
|
||||
}
|
||||
else
|
||||
copy_v3_v3(mouse, mouse_in);
|
||||
else {
|
||||
copy_v2_v2(mouse, mouse_in);
|
||||
}
|
||||
|
||||
/* TODO: can remove the if statement once all modes have this */
|
||||
if(stroke->get_location)
|
||||
|
@ -102,33 +102,6 @@ void ED_sculpt_force_update(bContext *C)
|
||||
multires_force_update(ob);
|
||||
}
|
||||
|
||||
void ED_sculpt_modifiers_changed(Object *ob)
|
||||
{
|
||||
SculptSession *ss= ob->sculpt;
|
||||
|
||||
if(!ss->cache) {
|
||||
/* we free pbvh on changes, except during sculpt since it can't deal with
|
||||
changing PVBH node organization, we hope topology does not change in
|
||||
the meantime .. weak */
|
||||
if(ss->pbvh) {
|
||||
BLI_pbvh_free(ss->pbvh);
|
||||
ss->pbvh= NULL;
|
||||
}
|
||||
|
||||
sculpt_free_deformMats(ob->sculpt);
|
||||
} else {
|
||||
PBVHNode **nodes;
|
||||
int n, totnode;
|
||||
|
||||
BLI_pbvh_search_gather(ss->pbvh, NULL, NULL, &nodes, &totnode);
|
||||
|
||||
for(n = 0; n < totnode; n++)
|
||||
BLI_pbvh_node_mark_update(nodes[n]);
|
||||
|
||||
MEM_freeN(nodes);
|
||||
}
|
||||
}
|
||||
|
||||
/* Sculpt mode handles multires differently from regular meshes, but only if
|
||||
it's the last modifier on the stack and it is not on the first level */
|
||||
struct MultiresModifierData *sculpt_multires_active(Scene *scene, Object *ob)
|
||||
@ -2694,17 +2667,6 @@ static void sculpt_update_tex(Sculpt *sd, SculptSession *ss)
|
||||
}
|
||||
}
|
||||
|
||||
void sculpt_free_deformMats(SculptSession *ss)
|
||||
{
|
||||
if(ss->orig_cos) MEM_freeN(ss->orig_cos);
|
||||
if(ss->deform_cos) MEM_freeN(ss->deform_cos);
|
||||
if(ss->deform_imats) MEM_freeN(ss->deform_imats);
|
||||
|
||||
ss->orig_cos = NULL;
|
||||
ss->deform_cos = NULL;
|
||||
ss->deform_imats = NULL;
|
||||
}
|
||||
|
||||
void sculpt_update_mesh_elements(Scene *scene, Sculpt *sd, Object *ob, int need_fmap)
|
||||
{
|
||||
DerivedMesh *dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH);
|
||||
@ -2741,7 +2703,7 @@ void sculpt_update_mesh_elements(Scene *scene, Sculpt *sd, Object *ob, int need_
|
||||
if(!ss->orig_cos) {
|
||||
int a;
|
||||
|
||||
sculpt_free_deformMats(ss);
|
||||
free_sculptsession_deformMats(ss);
|
||||
|
||||
if(ss->kb) ss->orig_cos = key_to_vertcos(ob, ss->kb);
|
||||
else ss->orig_cos = mesh_getVertexCos(ob->data, NULL);
|
||||
@ -2752,7 +2714,7 @@ void sculpt_update_mesh_elements(Scene *scene, Sculpt *sd, Object *ob, int need_
|
||||
for(a = 0; a < ((Mesh*)ob->data)->totvert; ++a)
|
||||
invert_m3(ss->deform_imats[a]);
|
||||
}
|
||||
} else sculpt_free_deformMats(ss);
|
||||
} else free_sculptsession_deformMats(ss);
|
||||
|
||||
/* if pbvh is deformed, key block is already applied to it */
|
||||
if (ss->kb && !BLI_pbvh_isDeformed(ss->pbvh)) {
|
||||
@ -3034,7 +2996,7 @@ static void sculpt_update_brush_delta(Sculpt *sd, Object *ob, Brush *brush)
|
||||
copy_v3_v3(cache->true_location, cache->orig_grab_location);
|
||||
|
||||
sd->draw_anchored = 1;
|
||||
copy_v3_v3(sd->anchored_initial_mouse, cache->initial_mouse);
|
||||
copy_v2_v2(sd->anchored_initial_mouse, cache->initial_mouse);
|
||||
sd->anchored_size = cache->pixel_radius;
|
||||
}
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ int sculpt_poll(struct bContext *C);
|
||||
void sculpt_update_mesh_elements(struct Scene *scene, struct Sculpt *sd, struct Object *ob, int need_fmap);
|
||||
|
||||
/* Deformed mesh sculpt */
|
||||
void sculpt_free_deformMats(struct SculptSession *ss);
|
||||
void free_sculptsession_deformMats(struct SculptSession *ss);
|
||||
|
||||
/* Stroke */
|
||||
struct SculptStroke *sculpt_stroke_new(const int max);
|
||||
|
@ -199,7 +199,7 @@ static void sculpt_undo_restore(bContext *C, ListBase *lb)
|
||||
Mesh *me= ob->data;
|
||||
mesh_calc_normals(me->mvert, me->totvert, me->mface, me->totface, NULL);
|
||||
|
||||
sculpt_free_deformMats(ss);
|
||||
free_sculptsession_deformMats(ss);
|
||||
tag_update|= 1;
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,5 @@
|
||||
|
||||
struct wmOperatorType;
|
||||
|
||||
void SOUND_OT_open(wmOperatorType *ot);
|
||||
|
||||
#endif /* ED_SOUND_INTERN_H */
|
||||
|
||||
|
@ -175,7 +175,7 @@ static int open_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
||||
return WM_operator_filesel(C, op, event);
|
||||
}
|
||||
|
||||
void SOUND_OT_open(wmOperatorType *ot)
|
||||
static void SOUND_OT_open(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Open Sound";
|
||||
@ -196,7 +196,7 @@ void SOUND_OT_open(wmOperatorType *ot)
|
||||
RNA_def_boolean(ot->srna, "mono", FALSE, "Mono", "Mixdown the sound to mono.");
|
||||
}
|
||||
|
||||
void SOUND_OT_open_mono(wmOperatorType *ot)
|
||||
static void SOUND_OT_open_mono(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Open Sound Mono";
|
||||
@ -659,7 +659,7 @@ static int update_animation_flags_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void SOUND_OT_update_animation_flags(wmOperatorType *ot)
|
||||
static void SOUND_OT_update_animation_flags(wmOperatorType *ot)
|
||||
{
|
||||
/*
|
||||
This operator is needed to set a correct state of the sound animation
|
||||
@ -703,7 +703,7 @@ static int bake_animation_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void SOUND_OT_bake_animation(wmOperatorType *ot)
|
||||
static void SOUND_OT_bake_animation(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Update animation cache";
|
||||
|
@ -535,7 +535,7 @@ void ACTION_OT_paste (wmOperatorType *ot)
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
|
||||
RNA_def_enum(ot->srna, "offset", keyframe_paste_offset_items, KEYFRAME_PASTE_OFFSET_CFRA_START, "Offset", "Paste time offset of keys");
|
||||
RNA_def_enum(ot->srna, "merge", keyframe_paste_merge_items, KEYFRAME_PASTE_MERGE_MIX, "Type", "Method of merking pasted keys and existing");
|
||||
RNA_def_enum(ot->srna, "merge", keyframe_paste_merge_items, KEYFRAME_PASTE_MERGE_MIX, "Type", "Method of merging pasted keys and existing");
|
||||
}
|
||||
|
||||
/* ******************** Insert Keyframes Operator ************************* */
|
||||
|
@ -580,7 +580,7 @@ void ACTION_OT_select_linked (wmOperatorType *ot)
|
||||
/* identifiers */
|
||||
ot->name = "Select Linked";
|
||||
ot->idname= "ACTION_OT_select_linked";
|
||||
ot->description = "Select keyframes occurring the same F-Curves as selected ones";
|
||||
ot->description = "Select keyframes occurring in the same F-Curves as selected ones";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec= actkeys_select_linked_exec;
|
||||
|
@ -604,7 +604,7 @@ void CONSOLE_OT_history_cycle(wmOperatorType *ot)
|
||||
ot->poll= ED_operator_console_active;
|
||||
|
||||
/* properties */
|
||||
RNA_def_boolean(ot->srna, "reverse", 0, "Reverse", "reverse cycle history");
|
||||
RNA_def_boolean(ot->srna, "reverse", 0, "Reverse", "Reverse cycle history");
|
||||
}
|
||||
|
||||
|
||||
|
@ -164,22 +164,26 @@ static FileSelect file_select_do(bContext* C, int selected_idx)
|
||||
SpaceFile *sfile= CTX_wm_space_file(C);
|
||||
FileSelectParams *params = ED_fileselect_get_params(sfile);
|
||||
int numfiles = filelist_numfiles(sfile->files);
|
||||
struct direntry* file;
|
||||
|
||||
/* make the selected file active */
|
||||
if ( (selected_idx >= 0) && (selected_idx < numfiles)) {
|
||||
struct direntry* file = filelist_file(sfile->files, selected_idx);
|
||||
if ( (selected_idx >= 0) &&
|
||||
(selected_idx < numfiles) &&
|
||||
(file= filelist_file(sfile->files, selected_idx)))
|
||||
{
|
||||
params->active_file = selected_idx;
|
||||
|
||||
if(file && S_ISDIR(file->type)) {
|
||||
if(S_ISDIR(file->type)) {
|
||||
/* the path is too long and we are not going up! */
|
||||
if (strcmp(file->relname, "..") && strlen(params->dir) + strlen(file->relname) >= FILE_MAX )
|
||||
{
|
||||
if (strcmp(file->relname, "..") && strlen(params->dir) + strlen(file->relname) >= FILE_MAX ) {
|
||||
// XXX error("Path too long, cannot enter this directory");
|
||||
} else {
|
||||
if (strcmp(file->relname, "..")==0) {
|
||||
/* avoids /../../ */
|
||||
BLI_parent_dir(params->dir);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if (strcmp(file->relname, "..")==0) {
|
||||
/* avoids /../../ */
|
||||
BLI_parent_dir(params->dir);
|
||||
}
|
||||
else {
|
||||
BLI_cleanup_dir(G.main->name, params->dir);
|
||||
strcat(params->dir, file->relname);
|
||||
BLI_add_slash(params->dir);
|
||||
@ -189,8 +193,7 @@ static FileSelect file_select_do(bContext* C, int selected_idx)
|
||||
retval = FILE_SELECT_DIR;
|
||||
}
|
||||
}
|
||||
else if (file)
|
||||
{
|
||||
else {
|
||||
if (file->relname) {
|
||||
BLI_strncpy(params->file, file->relname, FILE_MAXFILE);
|
||||
}
|
||||
|
@ -763,7 +763,7 @@ void GRAPH_OT_paste (wmOperatorType *ot)
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
|
||||
RNA_def_enum(ot->srna, "offset", keyframe_paste_offset_items, KEYFRAME_PASTE_OFFSET_CFRA_START, "Offset", "Paste time offset of keys");
|
||||
RNA_def_enum(ot->srna, "merge", keyframe_paste_merge_items, KEYFRAME_PASTE_MERGE_MIX, "Type", "Method of merking pasted keys and existing");
|
||||
RNA_def_enum(ot->srna, "merge", keyframe_paste_merge_items, KEYFRAME_PASTE_MERGE_MIX, "Type", "Method of merging pasted keys and existing");
|
||||
}
|
||||
|
||||
/* ******************** Duplicate Keyframes Operator ************************* */
|
||||
|
@ -585,7 +585,7 @@ void GRAPH_OT_select_linked (wmOperatorType *ot)
|
||||
/* identifiers */
|
||||
ot->name = "Select Linked";
|
||||
ot->idname= "GRAPH_OT_select_linked";
|
||||
ot->description = "Select keyframes occurring the same F-Curves as selected ones";
|
||||
ot->description = "Select keyframes occurring in the same F-Curves as selected ones";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec= graphkeys_select_linked_exec;
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BKE_anim.h"
|
||||
#include "BKE_curve.h"
|
||||
#include "BKE_displist.h"
|
||||
#include "BKE_DerivedMesh.h"
|
||||
#include "BKE_key.h"
|
||||
@ -51,7 +52,6 @@
|
||||
#include "ED_info.h"
|
||||
#include "ED_armature.h"
|
||||
#include "ED_mesh.h"
|
||||
#include "ED_curve.h" /* for ED_curve_editnurbs */
|
||||
|
||||
#include "BLI_editVert.h"
|
||||
|
||||
@ -193,7 +193,7 @@ static void stats_object_edit(Object *obedit, SceneStats *stats)
|
||||
BezTriple *bezt;
|
||||
BPoint *bp;
|
||||
int a;
|
||||
ListBase *nurbs= ED_curve_editnurbs(cu);
|
||||
ListBase *nurbs= curve_editnurbs(cu);
|
||||
|
||||
for(nu=nurbs->first; nu; nu=nu->next) {
|
||||
if(nu->type == CU_BEZIER) {
|
||||
|
@ -97,7 +97,7 @@ static void node_sync_cb(bContext *UNUSED(C), void *snode_v, void *node_v)
|
||||
}
|
||||
}
|
||||
|
||||
void node_socket_button_default(const bContext *C, uiBlock *block,
|
||||
static void node_socket_button_default(const bContext *C, uiBlock *block,
|
||||
bNodeTree *ntree, bNode *node, bNodeSocket *sock,
|
||||
const char *name, int x, int y, int width)
|
||||
{
|
||||
@ -135,7 +135,7 @@ static uiBlock *socket_component_menu(bContext *C, ARegion *ar, void *args_v)
|
||||
|
||||
return block;
|
||||
}
|
||||
void node_socket_button_components(const bContext *C, uiBlock *block,
|
||||
static void node_socket_button_components(const bContext *C, uiBlock *block,
|
||||
bNodeTree *ntree, bNode *node, bNodeSocket *sock,
|
||||
const char *name, int x, int y, int width)
|
||||
{
|
||||
@ -157,7 +157,7 @@ void node_socket_button_components(const bContext *C, uiBlock *block,
|
||||
uiDefBlockButN(block, socket_component_menu, args, name, x, y+1, width, NODE_DY-2, "");
|
||||
}
|
||||
|
||||
void node_socket_button_color(const bContext *C, uiBlock *block,
|
||||
static void node_socket_button_color(const bContext *C, uiBlock *block,
|
||||
bNodeTree *ntree, bNode *node, bNodeSocket *sock,
|
||||
const char *name, int x, int y, int width)
|
||||
{
|
||||
@ -179,7 +179,7 @@ void node_socket_button_color(const bContext *C, uiBlock *block,
|
||||
|
||||
/* ****************** BASE DRAW FUNCTIONS FOR NEW OPERATOR NODES ***************** */
|
||||
|
||||
void node_draw_socket_new(bNodeSocket *sock, float size)
|
||||
static void node_draw_socket_new(bNodeSocket *sock, float size)
|
||||
{
|
||||
float x=sock->locx, y=sock->locy;
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user