Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build_files/build_environment/patches/cmake/modules/FindIlmBase.cmake206
-rw-r--r--build_files/build_environment/patches/cmake/modules/FindOpenEXR.cmake186
-rw-r--r--build_files/cmake/macros.cmake4
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c437
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c5
5 files changed, 514 insertions, 324 deletions
diff --git a/build_files/build_environment/patches/cmake/modules/FindIlmBase.cmake b/build_files/build_environment/patches/cmake/modules/FindIlmBase.cmake
index f1a45228128..de4c0aba48c 100644
--- a/build_files/build_environment/patches/cmake/modules/FindIlmBase.cmake
+++ b/build_files/build_environment/patches/cmake/modules/FindIlmBase.cmake
@@ -21,9 +21,9 @@
# ILMBASE_FOUND - True if IlmBase was found.
# Other standarnd issue macros
-include (FindPackageHandleStandardArgs)
-include (FindPackageMessage)
-include (SelectLibraryConfigurations)
+include(FindPackageHandleStandardArgs)
+include(FindPackageMessage)
+include(SelectLibraryConfigurations)
if( ILMBASE_USE_STATIC_LIBS )
@@ -36,42 +36,42 @@ if( ILMBASE_USE_STATIC_LIBS )
endif()
# Macro to assemble a helper state variable
-macro (SET_STATE_VAR varname)
- set (tmp_ilmbaselibs ${ILMBASE_CUSTOM_LIBRARIES})
- separate_arguments (tmp_ilmbaselibs)
- set (tmp_lst
+macro(SET_STATE_VAR varname)
+ set(tmp_ilmbaselibs ${ILMBASE_CUSTOM_LIBRARIES})
+ separate_arguments(tmp_ilmbaselibs)
+ set(tmp_lst
${ILMBASE_CUSTOM} | ${tmp_ilmbaselibs} |
${ILMBASE_HOME} | ${ILMBASE_VERSION} | ${ILMBASE_LIB_AREA}
)
- set (${varname} "${tmp_lst}")
- unset (tmp_ilmbaselibs)
- unset (tmp_lst)
-endmacro ()
+ set(${varname} "${tmp_lst}")
+ unset(tmp_ilmbaselibs)
+ unset(tmp_lst)
+endmacro()
# To enforce that find_* functions do not use inadvertently existing versions
-if (ILMBASE_CUSTOM)
- set (ILMBASE_FIND_OPTIONS "NO_DEFAULT_PATH")
-endif ()
+if(ILMBASE_CUSTOM)
+ set(ILMBASE_FIND_OPTIONS "NO_DEFAULT_PATH")
+endif()
# Macro to search for an include directory
-macro (PREFIX_FIND_INCLUDE_DIR prefix includefile libpath_var)
- string (TOUPPER ${prefix}_INCLUDE_DIR tmp_varname)
+macro(PREFIX_FIND_INCLUDE_DIR prefix includefile libpath_var)
+ string(TOUPPER ${prefix}_INCLUDE_DIR tmp_varname)
find_path(${tmp_varname} ${includefile}
HINTS ${${libpath_var}}
PATH_SUFFIXES include
${ILMBASE_FIND_OPTIONS}
)
- if (${tmp_varname})
- mark_as_advanced (${tmp_varname})
- endif ()
- unset (tmp_varname)
-endmacro ()
+ if(${tmp_varname})
+ mark_as_advanced(${tmp_varname})
+ endif()
+ unset(tmp_varname)
+endmacro()
# Macro to search for the given library and adds the cached
# variable names to the specified list
-macro (PREFIX_FIND_LIB prefix libname libpath_var liblist_var cachelist_var)
- string (TOUPPER ${prefix}_${libname} tmp_prefix)
+macro(PREFIX_FIND_LIB prefix libname libpath_var liblist_var cachelist_var)
+ string(TOUPPER ${prefix}_${libname} tmp_prefix)
# Handle new library names for OpenEXR 2.1 build via cmake
string(REPLACE "." "_" _ILMBASE_VERSION ${ILMBASE_VERSION})
string(SUBSTRING ${_ILMBASE_VERSION} 0 3 _ILMBASE_VERSION )
@@ -89,86 +89,90 @@ macro (PREFIX_FIND_LIB prefix libname libpath_var liblist_var cachelist_var)
${ILMBASE_FIND_OPTIONS}
)
# Properly define ${tmp_prefix}_LIBRARY (cached) and ${tmp_prefix}_LIBRARIES
- select_library_configurations (${tmp_prefix})
- list (APPEND ${liblist_var} ${tmp_prefix}_LIBRARIES)
+ select_library_configurations(${tmp_prefix})
+ list(APPEND ${liblist_var} ${tmp_prefix}_LIBRARIES)
# Add to the list of variables which should be reset
- list (APPEND ${cachelist_var}
+ list(APPEND ${cachelist_var}
${tmp_prefix}_LIBRARY
${tmp_prefix}_LIBRARY_RELEASE
${tmp_prefix}_LIBRARY_DEBUG)
- mark_as_advanced (
+ mark_as_advanced(
${tmp_prefix}_LIBRARY
${tmp_prefix}_LIBRARY_RELEASE
${tmp_prefix}_LIBRARY_DEBUG)
- unset (tmp_prefix)
-endmacro ()
+ unset(tmp_prefix)
+endmacro()
# Encode the current state of the external variables into a string
-SET_STATE_VAR (ILMBASE_CURRENT_STATE)
+SET_STATE_VAR(ILMBASE_CURRENT_STATE)
# If the state has changed, clear the cached variables
-if (ILMBASE_CACHED_STATE AND
+if(ILMBASE_CACHED_STATE AND
NOT ILMBASE_CACHED_STATE STREQUAL ILMBASE_CURRENT_STATE)
- foreach (libvar ${ILMBASE_CACHED_VARS})
- unset (${libvar} CACHE)
- endforeach ()
-endif ()
+ foreach(libvar ${ILMBASE_CACHED_VARS})
+ unset(${libvar} CACHE)
+ endforeach()
+endif()
# Generic search paths
-set (IlmBase_generic_include_paths
+set(IlmBase_generic_include_paths
${ILMBASE_CUSTOM_INCLUDE_DIR}
/usr/include
/usr/include/${CMAKE_LIBRARY_ARCHITECTURE}
/usr/local/include
/sw/include
- /opt/local/include)
-set (IlmBase_generic_library_paths
+ /opt/local/include
+)
+set(IlmBase_generic_library_paths
${ILMBASE_CUSTOM_LIB_DIR}
/usr/lib
/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}
/usr/local/lib
/usr/local/lib/${CMAKE_LIBRARY_ARCHITECTURE}
/sw/lib
- /opt/local/lib)
+ /opt/local/lib
+)
# Search paths for the IlmBase files
-if (ILMBASE_HOME)
- if (ILMBASE_VERSION)
- set (IlmBase_include_paths
+if(ILMBASE_HOME)
+ if(ILMBASE_VERSION)
+ set(IlmBase_include_paths
${ILMBASE_HOME}/ilmbase-${ILMBASE_VERSION}/include
- ${ILMBASE_HOME}/include/ilmbase-${ILMBASE_VERSION})
- set (IlmBase_library_paths
+ ${ILMBASE_HOME}/include/ilmbase-${ILMBASE_VERSION}
+ )
+ set(IlmBase_library_paths
${ILMBASE_HOME}/ilmbase-${ILMBASE_VERSION}/lib
- ${ILMBASE_HOME}/lib/ilmbase-${ILMBASE_VERSION})
+ ${ILMBASE_HOME}/lib/ilmbase-${ILMBASE_VERSION}
+ )
endif()
- list (APPEND IlmBase_include_paths ${ILMBASE_HOME}/include)
- set (IlmBase_library_paths
+ list(APPEND IlmBase_include_paths ${ILMBASE_HOME}/include)
+ set(IlmBase_library_paths
${ILMBASE_HOME}/lib
${ILMBASE_HOME}/lib64
${ILMBASE_LIB_AREA}
${IlmBase_library_paths})
-endif ()
-list (APPEND IlmBase_include_paths ${IlmBase_generic_include_paths})
-list (APPEND IlmBase_library_paths ${IlmBase_generic_library_paths})
+endif()
+list(APPEND IlmBase_include_paths ${IlmBase_generic_include_paths})
+list(APPEND IlmBase_library_paths ${IlmBase_generic_library_paths})
# Locate the header files
-PREFIX_FIND_INCLUDE_DIR (IlmBase
+PREFIX_FIND_INCLUDE_DIR(IlmBase
OpenEXR/IlmBaseConfig.h IlmBase_include_paths)
-if (ILMBASE_INCLUDE_DIR)
+if(ILMBASE_INCLUDE_DIR)
# Get the version from config file, if not already set.
- if (NOT ILMBASE_VERSION)
+ if(NOT ILMBASE_VERSION)
FILE(STRINGS "${ILMBASE_INCLUDE_DIR}/OpenEXR/IlmBaseConfig.h" ILMBASE_BUILD_SPECIFICATION
REGEX "^[ \t]*#define[ \t]+ILMBASE_VERSION_STRING[ \t]+\"[.0-9]+\".*$")
if(ILMBASE_BUILD_SPECIFICATION)
- if (NOT IlmBase_FIND_QUIETLY)
+ if(NOT IlmBase_FIND_QUIETLY)
message(STATUS "${ILMBASE_BUILD_SPECIFICATION}")
- endif ()
+ endif()
string(REGEX REPLACE ".*#define[ \t]+ILMBASE_VERSION_STRING[ \t]+\"([.0-9]+)\".*"
"\\1" XYZ ${ILMBASE_BUILD_SPECIFICATION})
set("ILMBASE_VERSION" ${XYZ} CACHE STRING "Version of ILMBase lib")
@@ -178,71 +182,71 @@ if (ILMBASE_INCLUDE_DIR)
set("ILMBASE_VERSION" "2.0" CACHE STRING "Version of ILMBase lib")
endif()
endif()
-endif ()
+endif()
-if (ILMBASE_CUSTOM)
- if (NOT ILMBASE_CUSTOM_LIBRARIES)
- message (FATAL_ERROR "Custom IlmBase libraries requested but ILMBASE_CUSTOM_LIBRARIES is not set.")
+if(ILMBASE_CUSTOM)
+ if(NOT ILMBASE_CUSTOM_LIBRARIES)
+ message(FATAL_ERROR "Custom IlmBase libraries requested but ILMBASE_CUSTOM_LIBRARIES is not set.")
endif()
- set (IlmBase_Libraries ${ILMBASE_CUSTOM_LIBRARIES})
+ set(IlmBase_Libraries ${ILMBASE_CUSTOM_LIBRARIES})
separate_arguments(IlmBase_Libraries)
-else ()
-#elseif (${ILMBASE_VERSION} VERSION_LESS "2.1")
- set (IlmBase_Libraries Half Iex Imath IlmThread)
-#else ()
+else()
+#elseif(${ILMBASE_VERSION} VERSION_LESS "2.1")
+ set(IlmBase_Libraries Half Iex Imath IlmThread)
+#else()
# string(REGEX REPLACE "([0-9]+)[.]([0-9]+).*" "\\1_\\2" _ilmbase_libs_ver ${ILMBASE_VERSION})
-# set (IlmBase_Libraries Half Iex-${_ilmbase_libs_ver} Imath-${_ilmbase_libs_ver} IlmThread-${_ilmbase_libs_ver})
-endif ()
+# set(IlmBase_Libraries Half Iex-${_ilmbase_libs_ver} Imath-${_ilmbase_libs_ver} IlmThread-${_ilmbase_libs_ver})
+endif()
# Locate the IlmBase libraries
-set (IlmBase_libvars "")
-set (IlmBase_cachevars "")
-foreach (ilmbase_lib ${IlmBase_Libraries})
- PREFIX_FIND_LIB (IlmBase ${ilmbase_lib}
+set(IlmBase_libvars "")
+set(IlmBase_cachevars "")
+foreach(ilmbase_lib ${IlmBase_Libraries})
+ PREFIX_FIND_LIB(IlmBase ${ilmbase_lib}
IlmBase_library_paths IlmBase_libvars IlmBase_cachevars)
-endforeach ()
+endforeach()
# Create the list of variables that might need to be cleared
-set (ILMBASE_CACHED_VARS
+set(ILMBASE_CACHED_VARS
ILMBASE_INCLUDE_DIR ${IlmBase_cachevars}
CACHE INTERNAL "Variables set by FindIlmBase.cmake" FORCE)
# Store the current state so that variables might be cleared if required
-set (ILMBASE_CACHED_STATE ${ILMBASE_CURRENT_STATE}
+set(ILMBASE_CACHED_STATE ${ILMBASE_CURRENT_STATE}
CACHE INTERNAL "State last seen by FindIlmBase.cmake" FORCE)
# Link with pthreads if required
-if (NOT WIN32 AND EXISTS ${ILMBASE_INCLUDE_DIR}/OpenEXR/IlmBaseConfig.h)
- file (STRINGS ${ILMBASE_INCLUDE_DIR}/OpenEXR/IlmBaseConfig.h
+if(NOT WIN32 AND EXISTS ${ILMBASE_INCLUDE_DIR}/OpenEXR/IlmBaseConfig.h)
+ file(STRINGS ${ILMBASE_INCLUDE_DIR}/OpenEXR/IlmBaseConfig.h
ILMBASE_HAVE_PTHREAD
REGEX "^[ \\t]*#define[ \\t]+HAVE_PTHREAD[ \\t]1[ \\t]*\$"
)
- if (ILMBASE_HAVE_PTHREAD)
- find_package (Threads)
- if (CMAKE_USE_PTHREADS_INIT)
- set (ILMBASE_PTHREADS ${CMAKE_THREAD_LIBS_INIT})
- endif ()
- endif ()
-endif ()
+ if(ILMBASE_HAVE_PTHREAD)
+ find_package(Threads)
+ if(CMAKE_USE_PTHREADS_INIT)
+ set(ILMBASE_PTHREADS ${CMAKE_THREAD_LIBS_INIT})
+ endif()
+ endif()
+endif()
# Use the standard function to handle ILMBASE_FOUND
-FIND_PACKAGE_HANDLE_STANDARD_ARGS (IlmBase DEFAULT_MSG
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(IlmBase DEFAULT_MSG
ILMBASE_INCLUDE_DIR ${IlmBase_libvars})
-if (ILMBASE_FOUND)
- set (ILMBASE_LIBRARIES "")
- foreach (tmplib ${IlmBase_libvars})
- list (APPEND ILMBASE_LIBRARIES ${${tmplib}})
- endforeach ()
- list (APPEND ILMBASE_LIBRARIES ${ILMBASE_PTHREADS})
- if (NOT IlmBase_FIND_QUIETLY)
- FIND_PACKAGE_MESSAGE (ILMBASE
+if(ILMBASE_FOUND)
+ set(ILMBASE_LIBRARIES "")
+ foreach(tmplib ${IlmBase_libvars})
+ list(APPEND ILMBASE_LIBRARIES ${${tmplib}})
+ endforeach()
+ list(APPEND ILMBASE_LIBRARIES ${ILMBASE_PTHREADS})
+ if(NOT IlmBase_FIND_QUIETLY)
+ FIND_PACKAGE_MESSAGE(ILMBASE
"Found IlmBase: ${ILMBASE_LIBRARIES}"
"[${ILMBASE_INCLUDE_DIR}][${ILMBASE_LIBRARIES}][${ILMBASE_CURRENT_STATE}]"
)
- endif ()
-endif ()
+ endif()
+endif()
# Restore the original find library ordering
if( ILMBASE_USE_STATIC_LIBS )
@@ -250,11 +254,11 @@ if( ILMBASE_USE_STATIC_LIBS )
endif()
# Unset the helper variables to avoid pollution
-unset (ILMBASE_CURRENT_STATE)
-unset (IlmBase_include_paths)
-unset (IlmBase_library_paths)
-unset (IlmBase_generic_include_paths)
-unset (IlmBase_generic_library_paths)
-unset (IlmBase_libvars)
-unset (IlmBase_cachevars)
-unset (ILMBASE_PTHREADS)
+unset(ILMBASE_CURRENT_STATE)
+unset(IlmBase_include_paths)
+unset(IlmBase_library_paths)
+unset(IlmBase_generic_include_paths)
+unset(IlmBase_generic_library_paths)
+unset(IlmBase_libvars)
+unset(IlmBase_cachevars)
+unset(ILMBASE_PTHREADS)
diff --git a/build_files/build_environment/patches/cmake/modules/FindOpenEXR.cmake b/build_files/build_environment/patches/cmake/modules/FindOpenEXR.cmake
index 08d872445d7..1eb4ea3f5e7 100644
--- a/build_files/build_environment/patches/cmake/modules/FindOpenEXR.cmake
+++ b/build_files/build_environment/patches/cmake/modules/FindOpenEXR.cmake
@@ -23,12 +23,12 @@
# OPENEXR_FOUND - True if OpenEXR was found.
# Other standarnd issue macros
-include (SelectLibraryConfigurations)
-include (FindPackageHandleStandardArgs)
-include (FindPackageMessage)
+include(SelectLibraryConfigurations)
+include(FindPackageHandleStandardArgs)
+include(FindPackageMessage)
-if( OPENEXR_USE_STATIC_LIBS )
- set( _openexr_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
+if(OPENEXR_USE_STATIC_LIBS)
+ set(_openexr_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
if(WIN32)
set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
else()
@@ -37,39 +37,39 @@ if( OPENEXR_USE_STATIC_LIBS )
endif()
# Macro to assemble a helper state variable
-macro (SET_STATE_VAR varname)
- set (tmp_lst
+macro(SET_STATE_VAR varname)
+ set(tmp_lst
${OPENEXR_CUSTOM} | ${OPENEXR_CUSTOM_LIBRARY} |
${OPENEXR_HOME} | ${OPENEXR_VERSION} | ${OPENEXR_LIB_AREA}
)
- set (${varname} "${tmp_lst}")
- unset (tmp_lst)
-endmacro ()
+ set(${varname} "${tmp_lst}")
+ unset(tmp_lst)
+endmacro()
# To enforce that find_* functions do not use inadvertently existing versions
-if (OPENEXR_CUSTOM)
- set (OPENEXR_FIND_OPTIONS "NO_DEFAULT_PATH")
-endif ()
+if(OPENEXR_CUSTOM)
+ set(OPENEXR_FIND_OPTIONS "NO_DEFAULT_PATH")
+endif()
# Macro to search for an include directory
-macro (PREFIX_FIND_INCLUDE_DIR prefix includefile libpath_var)
- string (TOUPPER ${prefix}_INCLUDE_DIR tmp_varname)
+macro(PREFIX_FIND_INCLUDE_DIR prefix includefile libpath_var)
+ string(TOUPPER ${prefix}_INCLUDE_DIR tmp_varname)
find_path(${tmp_varname} ${includefile}
HINTS ${${libpath_var}}
PATH_SUFFIXES include
${OPENEXR_FIND_OPTIONS}
)
- if (${tmp_varname})
- mark_as_advanced (${tmp_varname})
- endif ()
- unset (tmp_varname)
-endmacro ()
+ if(${tmp_varname})
+ mark_as_advanced(${tmp_varname})
+ endif()
+ unset(tmp_varname)
+endmacro()
# Macro to search for the given library and adds the cached
# variable names to the specified list
-macro (PREFIX_FIND_LIB prefix libname libpath_var liblist_var cachelist_var)
- string (TOUPPER ${prefix}_${libname} tmp_prefix)
+macro(PREFIX_FIND_LIB prefix libname libpath_var liblist_var cachelist_var)
+ string(TOUPPER ${prefix}_${libname} tmp_prefix)
# Handle new library names for OpenEXR 2.1 build via cmake
string(REPLACE "." "_" _ILMBASE_VERSION ${ILMBASE_VERSION})
string(SUBSTRING ${_ILMBASE_VERSION} 0 3 _ILMBASE_VERSION )
@@ -86,89 +86,91 @@ macro (PREFIX_FIND_LIB prefix libname libpath_var liblist_var cachelist_var)
${OPENEXR_FIND_OPTIONS}
)
# Properly define ${tmp_prefix}_LIBRARY (cached) and ${tmp_prefix}_LIBRARIES
- select_library_configurations (${tmp_prefix})
- list (APPEND ${liblist_var} ${tmp_prefix}_LIBRARIES)
+ select_library_configurations(${tmp_prefix})
+ list(APPEND ${liblist_var} ${tmp_prefix}_LIBRARIES)
# Add to the list of variables which should be reset
- list (APPEND ${cachelist_var}
+ list(APPEND ${cachelist_var}
${tmp_prefix}_LIBRARY
${tmp_prefix}_LIBRARY_RELEASE
${tmp_prefix}_LIBRARY_DEBUG)
- mark_as_advanced (
+ mark_as_advanced(
${tmp_prefix}_LIBRARY
${tmp_prefix}_LIBRARY_RELEASE
${tmp_prefix}_LIBRARY_DEBUG)
- unset (tmp_prefix)
-endmacro ()
+ unset(tmp_prefix)
+endmacro()
# Encode the current state of the external variables into a string
-SET_STATE_VAR (OPENEXR_CURRENT_STATE)
+SET_STATE_VAR(OPENEXR_CURRENT_STATE)
# If the state has changed, clear the cached variables
-if (OPENEXR_CACHED_STATE AND
+if(OPENEXR_CACHED_STATE AND
NOT OPENEXR_CACHED_STATE STREQUAL OPENEXR_CURRENT_STATE)
- foreach (libvar ${OPENEXR_CACHED_VARS})
- unset (${libvar} CACHE)
- endforeach ()
-endif ()
+ foreach(libvar ${OPENEXR_CACHED_VARS})
+ unset(${libvar} CACHE)
+ endforeach()
+endif()
# Generic search paths
-set (OpenEXR_generic_include_paths
+set(OpenEXR_generic_include_paths
${OPENEXR_CUSTOM_INCLUDE_DIR}
/usr/include
/usr/include/${CMAKE_LIBRARY_ARCHITECTURE}
/usr/local/include
/sw/include
- /opt/local/include)
-set (OpenEXR_generic_library_paths
+ /opt/local/include
+)
+set(OpenEXR_generic_library_paths
${OPENEXR_CUSTOM_LIB_DIR}
/usr/lib
/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}
/usr/local/lib
/usr/local/lib/${CMAKE_LIBRARY_ARCHITECTURE}
/sw/lib
- /opt/local/lib)
+ /opt/local/lib
+)
# Search paths for the OpenEXR files
-if (OPENEXR_HOME)
- set (OpenEXR_library_paths
+if(OPENEXR_HOME)
+ set(OpenEXR_library_paths
${OPENEXR_HOME}/lib
${OPENEXR_HOME}/lib64)
- if (OPENEXR_VERSION)
- set (OpenEXR_include_paths
+ if(OPENEXR_VERSION)
+ set(OpenEXR_include_paths
${OPENEXR_HOME}/openexr-${OPENEXR_VERSION}/include
${OPENEXR_HOME}/include/openexr-${OPENEXR_VERSION})
- list (APPEND OpenEXR_library_paths
+ list(APPEND OpenEXR_library_paths
${OPENEXR_HOME}/openexr-${OPENEXR_VERSION}/lib
${OPENEXR_HOME}/lib/openexr-${OPENEXR_VERSION})
endif()
- list (APPEND OpenEXR_include_paths ${OPENEXR_HOME}/include)
- if (OPENEXR_LIB_AREA)
- list (INSERT OpenEXR_library_paths 2 ${OPENEXR_LIB_AREA})
- endif ()
-endif ()
-if (ILMBASE_HOME AND OPENEXR_VERSION)
- list (APPEND OpenEXR_include_paths
+ list(APPEND OpenEXR_include_paths ${OPENEXR_HOME}/include)
+ if(OPENEXR_LIB_AREA)
+ list(INSERT OpenEXR_library_paths 2 ${OPENEXR_LIB_AREA})
+ endif()
+endif()
+if(ILMBASE_HOME AND OPENEXR_VERSION)
+ list(APPEND OpenEXR_include_paths
${ILMBASE_HOME}/include/openexr-${OPENEXR_VERSION})
endif()
-list (APPEND OpenEXR_include_paths ${OpenEXR_generic_include_paths})
-list (APPEND OpenEXR_library_paths ${OpenEXR_generic_library_paths})
+list(APPEND OpenEXR_include_paths ${OpenEXR_generic_include_paths})
+list(APPEND OpenEXR_library_paths ${OpenEXR_generic_library_paths})
# Locate the header files
-PREFIX_FIND_INCLUDE_DIR (OpenEXR
+PREFIX_FIND_INCLUDE_DIR(OpenEXR
OpenEXR/ImfArray.h OpenEXR_include_paths)
-if (OPENEXR_INCLUDE_DIR)
+if(OPENEXR_INCLUDE_DIR)
# Get the version from config file, if not already set.
- if (NOT OPENEXR_VERSION)
+ if(NOT OPENEXR_VERSION)
FILE(STRINGS "${OPENEXR_INCLUDE_DIR}/OpenEXR/OpenEXRConfig.h" OPENEXR_BUILD_SPECIFICATION
REGEX "^[ \t]*#define[ \t]+OPENEXR_VERSION_STRING[ \t]+\"[.0-9]+\".*$")
if(OPENEXR_BUILD_SPECIFICATION)
- if (NOT OpenEXR_FIND_QUIETLY)
+ if(NOT OpenEXR_FIND_QUIETLY)
message(STATUS "${OPENEXR_BUILD_SPECIFICATION}")
- endif ()
+ endif()
string(REGEX REPLACE ".*#define[ \t]+OPENEXR_VERSION_STRING[ \t]+\"([.0-9]+)\".*"
"\\1" XYZ ${OPENEXR_BUILD_SPECIFICATION})
set("OPENEXR_VERSION" ${XYZ} CACHE STRING "Version of OpenEXR lib")
@@ -178,56 +180,56 @@ if (OPENEXR_INCLUDE_DIR)
set("OPENEXR_VERSION" "2.0" CACHE STRING "Version of OpenEXR lib")
endif()
endif()
-endif ()
+endif()
-if (OPENEXR_CUSTOM)
- if (NOT OPENEXR_CUSTOM_LIBRARY)
- message (FATAL_ERROR "Custom OpenEXR library requested but OPENEXR_CUSTOM_LIBRARY is not set.")
+if(OPENEXR_CUSTOM)
+ if(NOT OPENEXR_CUSTOM_LIBRARY)
+ message(FATAL_ERROR "Custom OpenEXR library requested but OPENEXR_CUSTOM_LIBRARY is not set.")
endif()
- set (OpenEXR_Library ${OPENEXR_CUSTOM_LIBRARY})
-else ()
-#elseif (${OPENEXR_VERSION} VERSION_LESS "2.1")
- set (OpenEXR_Library IlmImf)
-#else ()
+ set(OpenEXR_Library ${OPENEXR_CUSTOM_LIBRARY})
+else()
+#elseif(${OPENEXR_VERSION} VERSION_LESS "2.1")
+ set(OpenEXR_Library IlmImf)
+#else()
# string(REGEX REPLACE "([0-9]+)[.]([0-9]+).*" "\\1_\\2" _openexr_libs_ver ${OPENEXR_VERSION})
-# set (OpenEXR_Library IlmImf-${_openexr_libs_ver})
-endif ()
+# set(OpenEXR_Library IlmImf-${_openexr_libs_ver})
+endif()
# Locate the OpenEXR library
-set (OpenEXR_libvars "")
-set (OpenEXR_cachevars "")
-PREFIX_FIND_LIB (OpenEXR ${OpenEXR_Library}
+set(OpenEXR_libvars "")
+set(OpenEXR_cachevars "")
+PREFIX_FIND_LIB(OpenEXR ${OpenEXR_Library}
OpenEXR_library_paths OpenEXR_libvars OpenEXR_cachevars)
# Create the list of variables that might need to be cleared
-set (OPENEXR_CACHED_VARS
+set(OPENEXR_CACHED_VARS
OPENEXR_INCLUDE_DIR ${OpenEXR_cachevars}
CACHE INTERNAL "Variables set by FindOpenEXR.cmake" FORCE)
# Store the current state so that variables might be cleared if required
-set (OPENEXR_CACHED_STATE ${OPENEXR_CURRENT_STATE}
+set(OPENEXR_CACHED_STATE ${OPENEXR_CURRENT_STATE}
CACHE INTERNAL "State last seen by FindOpenEXR.cmake" FORCE)
# Always link explicitly with zlib
-set (OPENEXR_ZLIB ${ZLIB_LIBRARIES})
+set(OPENEXR_ZLIB ${ZLIB_LIBRARIES})
# Use the standard function to handle OPENEXR_FOUND
-FIND_PACKAGE_HANDLE_STANDARD_ARGS (OpenEXR DEFAULT_MSG
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenEXR DEFAULT_MSG
OPENEXR_INCLUDE_DIR ${OpenEXR_libvars})
-if (OPENEXR_FOUND)
- set (OPENEXR_LIBRARIES "")
- foreach (tmplib ${OpenEXR_libvars})
- list (APPEND OPENEXR_LIBRARIES ${${tmplib}})
- endforeach ()
- list (APPEND OPENEXR_LIBRARIES ${ZLIB_LIBRARIES})
- if (NOT OpenEXR_FIND_QUIETLY)
- FIND_PACKAGE_MESSAGE (OPENEXR
+if(OPENEXR_FOUND)
+ set(OPENEXR_LIBRARIES "")
+ foreach(tmplib ${OpenEXR_libvars})
+ list(APPEND OPENEXR_LIBRARIES ${${tmplib}})
+ endforeach()
+ list(APPEND OPENEXR_LIBRARIES ${ZLIB_LIBRARIES})
+ if(NOT OpenEXR_FIND_QUIETLY)
+ FIND_PACKAGE_MESSAGE(OPENEXR
"Found OpenEXR: ${OPENEXR_LIBRARIES}"
"[${OPENEXR_INCLUDE_DIR}][${OPENEXR_LIBRARIES}][${OPENEXR_CURRENT_STATE}]"
)
- endif ()
-endif ()
+ endif()
+endif()
# Restore the original find library ordering
if( OPENEXR_USE_STATIC_LIBS )
@@ -235,10 +237,10 @@ if( OPENEXR_USE_STATIC_LIBS )
endif()
# Unset the helper variables to avoid pollution
-unset (OPENEXR_CURRENT_STATE)
-unset (OpenEXR_include_paths)
-unset (OpenEXR_library_paths)
-unset (OpenEXR_generic_include_paths)
-unset (OpenEXR_generic_library_paths)
-unset (OpenEXR_libvars)
-unset (OpenEXR_cachevars)
+unset(OPENEXR_CURRENT_STATE)
+unset(OpenEXR_include_paths)
+unset(OpenEXR_library_paths)
+unset(OpenEXR_generic_include_paths)
+unset(OpenEXR_generic_library_paths)
+unset(OpenEXR_libvars)
+unset(OpenEXR_cachevars)
diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index 2e16b9238b3..417c012b526 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -1569,7 +1569,7 @@ macro(openmp_delayload
endif()
endmacro()
-MACRO(WINDOWS_SIGN_TARGET target)
+macro(WINDOWS_SIGN_TARGET target)
if(WITH_WINDOWS_CODESIGN)
if(!SIGNTOOL_EXE)
error("Codesigning is enabled, but signtool is not found")
@@ -1590,4 +1590,4 @@ MACRO(WINDOWS_SIGN_TARGET target)
)
endif()
endif()
-ENDMACRO()
+endmacro()
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index d286e608de4..1d97541e813 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -26,6 +26,8 @@
/** \file blender/editors/space_view3d/view3d_edit.c
* \ingroup spview3d
+ *
+ * 3D view manipulation/operators.
*/
#include <string.h>
@@ -90,12 +92,66 @@
static bool view3d_ensure_persp(struct View3D *v3d, ARegion *ar);
+/* -------------------------------------------------------------------- */
+/** \name View Utilities
+ *
+ * Lock the camera to the view-port, allowing view manipulation to transform the camera.
+ * \{ */
+
+/**
+ * Use to store the last view, before entering camera view.
+ */
+void ED_view3d_lastview_store(RegionView3D *rv3d)
+{
+ copy_qt_qt(rv3d->lviewquat, rv3d->viewquat);
+ rv3d->lview = rv3d->view;
+ if (rv3d->persp != RV3D_CAMOB) {
+ rv3d->lpersp = rv3d->persp;
+ }
+}
+
+void ED_view3D_lock_clear(View3D *v3d)
+{
+ v3d->ob_centre = NULL;
+ v3d->ob_centre_bone[0] = '\0';
+ v3d->ob_centre_cursor = false;
+ v3d->flag2 &= ~V3D_LOCK_CAMERA;
+}
+
bool ED_view3d_offset_lock_check(const View3D *v3d, const RegionView3D *rv3d)
{
return (rv3d->persp != RV3D_CAMOB) && (v3d->ob_centre_cursor || v3d->ob_centre);
}
-/* ********************** view3d_edit: view manipulations ********************* */
+/**
+ * For viewport operators that exit camera persp.
+ *
+ * \note This differs from simply setting ``rv3d->persp = persp`` because it
+ * sets the ``ofs`` and ``dist`` values of the viewport so it matches the camera,
+ * otherwise switching out of camera view may jump to a different part of the scene.
+ */
+static void view3d_persp_switch_from_camera(View3D *v3d, RegionView3D *rv3d, const char persp)
+{
+ BLI_assert(rv3d->persp == RV3D_CAMOB);
+ BLI_assert(persp != RV3D_CAMOB);
+
+ if (v3d->camera) {
+ rv3d->dist = ED_view3d_offset_distance(v3d->camera->obmat, rv3d->ofs, VIEW3D_DIST_FALLBACK);
+ ED_view3d_from_object(v3d->camera, rv3d->ofs, rv3d->viewquat, &rv3d->dist, NULL);
+ }
+
+ if (!ED_view3d_camera_lock_check(v3d, rv3d)) {
+ rv3d->persp = persp;
+ }
+}
+
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Camera Lock API
+ *
+ * Lock the camera to the view-port, allowing view manipulation to transform the camera.
+ * \{ */
/**
* \return true when the view-port is locked to its camera.
@@ -256,29 +312,13 @@ bool ED_view3d_camera_lock_autokey(
}
}
-/**
- * For viewport operators that exit camera persp.
- *
- * \note This differs from simply setting ``rv3d->persp = persp`` because it
- * sets the ``ofs`` and ``dist`` values of the viewport so it matches the camera,
- * otherwise switching out of camera view may jump to a different part of the scene.
- */
-static void view3d_persp_switch_from_camera(View3D *v3d, RegionView3D *rv3d, const char persp)
-{
- BLI_assert(rv3d->persp == RV3D_CAMOB);
- BLI_assert(persp != RV3D_CAMOB);
-
- if (v3d->camera) {
- rv3d->dist = ED_view3d_offset_distance(v3d->camera->obmat, rv3d->ofs, VIEW3D_DIST_FALLBACK);
- ED_view3d_from_object(v3d->camera, rv3d->ofs, rv3d->viewquat, &rv3d->dist, NULL);
- }
-
- if (!ED_view3d_camera_lock_check(v3d, rv3d)) {
- rv3d->persp = persp;
- }
-}
+/** \} */
-/* ********************* box view support ***************** */
+/* -------------------------------------------------------------------- */
+/** \name Box View Support
+ *
+ * Use with quad-split so each view is clipped by the bounds of each view axis.
+ * \{ */
static void view3d_boxview_clip(ScrArea *sa)
{
@@ -521,7 +561,11 @@ void ED_view3d_quadview_update(ScrArea *sa, ARegion *ar, bool do_clip)
ED_area_tag_redraw(sa);
}
-/* ************************** init for view ops **********************************/
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Generic View Operator Custom-Data
+ * \{ */
typedef struct ViewOpsData {
/* context pointers (assigned by viewops_data_alloc) */
@@ -581,13 +625,6 @@ static void calctrackballvec(const rcti *rect, int mx, int my, float vec[3])
vec[2] = -z; /* yah yah! */
}
-
-/* -------------------------------------------------------------------- */
-/* ViewOpsData */
-
-/** \name Generic View Operator Custom-Data.
- * \{ */
-
/**
* Allocate and fill in context pointers for #ViewOpsData
*/
@@ -898,10 +935,12 @@ static void viewops_data_free(bContext *C, wmOperator *op)
#endif
ED_region_tag_redraw(ar);
}
-/** \} */
+/** \} */
-/* ************************** viewrotate **********************************/
+/* -------------------------------------------------------------------- */
+/** \name View Rotate
+ * \{ */
enum {
VIEW_PASS = 0,
@@ -910,12 +949,14 @@ enum {
};
/* NOTE: these defines are saved in keymap files, do not change values but just add new ones */
-#define VIEW_MODAL_CONFIRM 1 /* used for all view operations */
-#define VIEWROT_MODAL_AXIS_SNAP_ENABLE 2
-#define VIEWROT_MODAL_AXIS_SNAP_DISABLE 3
-#define VIEWROT_MODAL_SWITCH_ZOOM 4
-#define VIEWROT_MODAL_SWITCH_MOVE 5
-#define VIEWROT_MODAL_SWITCH_ROTATE 6
+enum {
+ VIEW_MODAL_CONFIRM = 1, /* used for all view operations */
+ VIEWROT_MODAL_AXIS_SNAP_ENABLE = 2,
+ VIEWROT_MODAL_AXIS_SNAP_DISABLE = 3,
+ VIEWROT_MODAL_SWITCH_ZOOM = 4,
+ VIEWROT_MODAL_SWITCH_MOVE = 5,
+ VIEWROT_MODAL_SWITCH_ROTATE = 6,
+};
/* called in transform_ops.c, on each regeneration of keymaps */
void viewrotate_modal_keymap(wmKeyConfig *keyconf)
@@ -1365,11 +1406,13 @@ void VIEW3D_OT_rotate(wmOperatorType *ot)
ot->flag = OPTYPE_BLOCKING | OPTYPE_GRAB_CURSOR;
}
-#ifdef WITH_INPUT_NDOF
+/** \} */
+/* -------------------------------------------------------------------- */
/** \name NDOF Utility Functions
* \{ */
+#ifdef WITH_INPUT_NDOF
#define NDOF_HAS_TRANSLATE ((!ED_view3d_offset_lock_check(v3d, rv3d)) && !is_zero_v3(ndof->tvec))
#define NDOF_HAS_ROTATE (((rv3d->viewlock & RV3D_LOCKED) == 0) && !is_zero_v3(ndof->rvec))
@@ -1419,8 +1462,9 @@ static float view3d_ndof_pan_speed_calc(RegionView3D *rv3d)
*
* \param has_zoom zoom, otherwise dolly, often `!rv3d->is_persp` since it doesnt make sense to dolly in ortho.
*/
-static void view3d_ndof_pan_zoom(const struct wmNDOFMotionData *ndof, ScrArea *sa, ARegion *ar,
- const bool has_translate, const bool has_zoom)
+static void view3d_ndof_pan_zoom(
+ const struct wmNDOFMotionData *ndof, ScrArea *sa, ARegion *ar,
+ const bool has_translate, const bool has_zoom)
{
RegionView3D *rv3d = ar->regiondata;
float view_inv[4];
@@ -1481,9 +1525,10 @@ static void view3d_ndof_pan_zoom(const struct wmNDOFMotionData *ndof, ScrArea *s
}
-static void view3d_ndof_orbit(const struct wmNDOFMotionData *ndof, ScrArea *sa, ARegion *ar,
- /* optional, can be NULL*/
- ViewOpsData *vod)
+static void view3d_ndof_orbit(
+ const struct wmNDOFMotionData *ndof, ScrArea *sa, ARegion *ar,
+ /* optional, can be NULL*/
+ ViewOpsData *vod)
{
View3D *v3d = sa->spacedata.first;
RegionView3D *rv3d = ar->regiondata;
@@ -1668,11 +1713,14 @@ void view3d_ndof_fly(
/** \} */
+/* -------------------------------------------------------------------- */
+/** \name NDOF Operators
+ *
+ * - "orbit" navigation (trackball/turntable)
+ * - zooming
+ * - panning in rotationally-locked views
+ * \{ */
-/* -- "orbit" navigation (trackball/turntable)
- * -- zooming
- * -- panning in rotationally-locked views
- */
static int ndof_orbit_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
@@ -1936,8 +1984,11 @@ void VIEW3D_OT_ndof_all(struct wmOperatorType *ot)
#endif /* WITH_INPUT_NDOF */
-/* ************************ viewmove ******************************** */
+/** \} */
+/* -------------------------------------------------------------------- */
+/** \name View Move (Pan) Operator
+ * \{ */
/* NOTE: these defines are saved in keymap files, do not change values but just add new ones */
@@ -2117,7 +2168,11 @@ void VIEW3D_OT_move(wmOperatorType *ot)
ot->flag = OPTYPE_BLOCKING | OPTYPE_GRAB_CURSOR;
}
-/* ************************ viewzoom ******************************** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name View Zoom Operator
+ * \{ */
/* viewdolly_modal_keymap has an exact copy of this, apply fixes to both */
/* called in transform_ops.c, on each regeneration of keymaps */
@@ -2512,41 +2567,6 @@ static int viewzoom_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-/* this is an exact copy of viewzoom_modal_keymap */
-/* called in transform_ops.c, on each regeneration of keymaps */
-void viewdolly_modal_keymap(wmKeyConfig *keyconf)
-{
- static const EnumPropertyItem modal_items[] = {
- {VIEW_MODAL_CONFIRM, "CONFIRM", 0, "Confirm", ""},
-
- {VIEWROT_MODAL_SWITCH_ROTATE, "SWITCH_TO_ROTATE", 0, "Switch to Rotate"},
- {VIEWROT_MODAL_SWITCH_MOVE, "SWITCH_TO_MOVE", 0, "Switch to Move"},
-
- {0, NULL, 0, NULL, NULL}
- };
-
- wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "View3D Dolly Modal");
-
- /* this function is called for each spacetype, only needs to add map once */
- if (keymap && keymap->modal_items) return;
-
- keymap = WM_modalkeymap_add(keyconf, "View3D Dolly Modal", modal_items);
-
- /* items for modal map */
- WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_RELEASE, KM_ANY, 0, VIEW_MODAL_CONFIRM);
- WM_modalkeymap_add_item(keymap, ESCKEY, KM_PRESS, KM_ANY, 0, VIEW_MODAL_CONFIRM);
-
- /* disabled mode switching for now, can re-implement better, later on */
-#if 0
- WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_RELEASE, KM_ANY, 0, VIEWROT_MODAL_SWITCH_ROTATE);
- WM_modalkeymap_add_item(keymap, LEFTCTRLKEY, KM_RELEASE, KM_ANY, 0, VIEWROT_MODAL_SWITCH_ROTATE);
- WM_modalkeymap_add_item(keymap, LEFTSHIFTKEY, KM_PRESS, KM_ANY, 0, VIEWROT_MODAL_SWITCH_MOVE);
-#endif
-
- /* assign map to operators */
- WM_modalkeymap_assign(keymap, "VIEW3D_OT_dolly");
-}
-
/* viewdolly_invoke() copied this function, changes here may apply there */
static int viewzoom_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
@@ -2634,8 +2654,50 @@ void VIEW3D_OT_zoom(wmOperatorType *ot)
RNA_def_property_flag(prop, PROP_HIDDEN);
}
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name View Dolly Operator
+ *
+ * Like zoom but translates the view offset along the view direction
+ * which avoids #RegionView3D.dist approaching zero.
+ * \{ */
+
+/* this is an exact copy of viewzoom_modal_keymap */
+/* called in transform_ops.c, on each regeneration of keymaps */
+void viewdolly_modal_keymap(wmKeyConfig *keyconf)
+{
+ static const EnumPropertyItem modal_items[] = {
+ {VIEW_MODAL_CONFIRM, "CONFIRM", 0, "Confirm", ""},
+
+ {VIEWROT_MODAL_SWITCH_ROTATE, "SWITCH_TO_ROTATE", 0, "Switch to Rotate"},
+ {VIEWROT_MODAL_SWITCH_MOVE, "SWITCH_TO_MOVE", 0, "Switch to Move"},
+
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "View3D Dolly Modal");
+
+ /* this function is called for each spacetype, only needs to add map once */
+ if (keymap && keymap->modal_items) return;
+
+ keymap = WM_modalkeymap_add(keyconf, "View3D Dolly Modal", modal_items);
+
+ /* items for modal map */
+ WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_RELEASE, KM_ANY, 0, VIEW_MODAL_CONFIRM);
+ WM_modalkeymap_add_item(keymap, ESCKEY, KM_PRESS, KM_ANY, 0, VIEW_MODAL_CONFIRM);
+
+ /* disabled mode switching for now, can re-implement better, later on */
+#if 0
+ WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_RELEASE, KM_ANY, 0, VIEWROT_MODAL_SWITCH_ROTATE);
+ WM_modalkeymap_add_item(keymap, LEFTCTRLKEY, KM_RELEASE, KM_ANY, 0, VIEWROT_MODAL_SWITCH_ROTATE);
+ WM_modalkeymap_add_item(keymap, LEFTSHIFTKEY, KM_PRESS, KM_ANY, 0, VIEWROT_MODAL_SWITCH_MOVE);
+#endif
+
+ /* assign map to operators */
+ WM_modalkeymap_assign(keymap, "VIEW3D_OT_dolly");
+}
-/* ************************ viewdolly ******************************** */
static bool viewdolly_offset_lock_check(bContext *C, wmOperator *op)
{
View3D *v3d = CTX_wm_view3d(C);
@@ -2970,9 +3032,10 @@ static void view3d_from_minmax(bContext *C, View3D *v3d, ARegion *ar,
}
/* same as view3d_from_minmax but for all regions (except cameras) */
-static void view3d_from_minmax_multi(bContext *C, View3D *v3d,
- const float min[3], const float max[3],
- const bool ok_dist, const int smooth_viewtx)
+static void view3d_from_minmax_multi(
+ bContext *C, View3D *v3d,
+ const float min[3], const float max[3],
+ const bool ok_dist, const int smooth_viewtx)
{
ScrArea *sa = CTX_wm_area(C);
ARegion *ar;
@@ -3072,6 +3135,14 @@ void VIEW3D_OT_view_all(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "center", 0, "Center", "");
}
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name View Selected Operator
+ *
+ * Move & Zoom the view to fit selected contents.
+ * \{ */
+
/* like a localview without local!, was centerview() in 2.4x */
static int viewselected_exec(bContext *C, wmOperator *op)
{
@@ -3202,6 +3273,12 @@ void VIEW3D_OT_view_selected(wmOperatorType *ot)
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name View Lock Clear Operator
+ * \{ */
+
static int view_lock_clear_exec(bContext *C, wmOperator *UNUSED(op))
{
View3D *v3d = CTX_wm_view3d(C);
@@ -3234,6 +3311,12 @@ void VIEW3D_OT_view_lock_clear(wmOperatorType *ot)
ot->flag = 0;
}
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name View Lock to Active Operator
+ * \{ */
+
static int view_lock_to_active_exec(bContext *C, wmOperator *UNUSED(op))
{
View3D *v3d = CTX_wm_view3d(C);
@@ -3285,6 +3368,12 @@ void VIEW3D_OT_view_lock_to_active(wmOperatorType *ot)
ot->flag = 0;
}
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name View Center Cursor Operator
+ * \{ */
+
static int viewcenter_cursor_exec(bContext *C, wmOperator *op)
{
View3D *v3d = CTX_wm_view3d(C);
@@ -3325,6 +3414,12 @@ void VIEW3D_OT_view_center_cursor(wmOperatorType *ot)
ot->flag = 0;
}
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name View Center Pick Operator
+ * \{ */
+
static int viewcenter_pick_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
View3D *v3d = CTX_wm_view3d(C);
@@ -3375,6 +3470,12 @@ void VIEW3D_OT_view_center_pick(wmOperatorType *ot)
ot->flag = 0;
}
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name View Camera Center Operator
+ * \{ */
+
static int view3d_center_camera_exec(bContext *C, wmOperator *UNUSED(op)) /* was view3d_home() in 2.4x */
{
const Depsgraph *depsgraph = CTX_data_depsgraph(C);
@@ -3421,6 +3522,12 @@ void VIEW3D_OT_view_center_camera(wmOperatorType *ot)
ot->flag = 0;
}
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name View Lock Center Operator
+ * \{ */
+
static int view3d_center_lock_exec(bContext *C, wmOperator *UNUSED(op)) /* was view3d_home() in 2.4x */
{
RegionView3D *rv3d = CTX_wm_region_view3d(C);
@@ -3447,7 +3554,11 @@ void VIEW3D_OT_view_center_lock(wmOperatorType *ot)
ot->flag = 0;
}
-/* ********************* Set render border operator ****************** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Set Render Border Operator
+ * \{ */
static int render_border_exec(bContext *C, wmOperator *op)
{
@@ -3549,7 +3660,11 @@ void VIEW3D_OT_render_border(wmOperatorType *ot)
RNA_def_property_flag(prop, PROP_HIDDEN);
}
-/* ********************* Clear render border operator ****************** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Clear Render Border Operator
+ * \{ */
static int clear_render_border_exec(bContext *C, wmOperator *UNUSED(op))
{
@@ -3596,7 +3711,11 @@ void VIEW3D_OT_clear_render_border(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
-/* ********************* Border Zoom operator ****************** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Border Zoom Operator
+ * \{ */
static int view3d_zoom_border_exec(bContext *C, wmOperator *op)
{
@@ -3764,7 +3883,14 @@ void VIEW3D_OT_zoom_border(wmOperatorType *ot)
WM_operator_properties_gesture_border_zoom(ot);
}
-/* sets the view to 1:1 camera/render-pixel */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Set Camera Zoom 1:1 Operator
+ *
+ * Sets the view to 1:1 camera/render-pixel.
+ * \{ */
+
static void view3d_set_1_to_1_viewborder(Scene *scene, const Depsgraph *depsgraph, ARegion *ar, View3D *v3d)
{
RegionView3D *rv3d = ar->regiondata;
@@ -3810,7 +3936,11 @@ void VIEW3D_OT_zoom_camera_1_to_1(wmOperatorType *ot)
ot->flag = 0;
}
-/* ********************* Changing view operator ****************** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name View Axis/Type Operator
+ * \{ */
static const EnumPropertyItem prop_view_items[] = {
{RV3D_VIEW_LEFT, "LEFT", ICON_TRIA_LEFT, "Left", "View From the Left"},
@@ -3826,10 +3956,11 @@ static const EnumPropertyItem prop_view_items[] = {
/* would like to make this a generic function - outside of transform */
-static void axis_set_view(bContext *C, View3D *v3d, ARegion *ar,
- const float quat_[4],
- short view, int perspo, bool align_active,
- const int smooth_viewtx)
+static void axis_set_view(
+ bContext *C, View3D *v3d, ARegion *ar,
+ const float quat_[4],
+ short view, int perspo, bool align_active,
+ const int smooth_viewtx)
{
RegionView3D *rv3d = ar->regiondata; /* no NULL check is needed, poll checks */
float quat[4];
@@ -4049,6 +4180,12 @@ void VIEW3D_OT_viewnumpad(wmOperatorType *ot)
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name View Orbit Operator
+ * \{ */
+
static const EnumPropertyItem prop_view_orbit_items[] = {
{V3D_VIEW_STEPLEFT, "ORBITLEFT", 0, "Orbit Left", "Orbit the view around to the Left"},
{V3D_VIEW_STEPRIGHT, "ORBITRIGHT", 0, "Orbit Right", "Orbit the view around to the Right"},
@@ -4169,11 +4306,13 @@ void VIEW3D_OT_view_orbit(wmOperatorType *ot)
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
ot->prop = RNA_def_enum(ot->srna, "type", prop_view_orbit_items, 0, "Orbit", "Direction of View Orbit");
-
}
+/** \} */
-/* ************************ viewroll ******************************** */
+/* -------------------------------------------------------------------- */
+/** \name View Roll Operator
+ * \{ */
static void view_roll_angle(ARegion *ar, float quat[4], const float orig_quat[4], const float dvec[3], float angle)
{
@@ -4415,6 +4554,14 @@ static const EnumPropertyItem prop_view_pan_items[] = {
{0, NULL, 0, NULL, NULL}
};
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name View Pan Operator
+ *
+ * Move (pan) in incremental steps.
+ * \{ */
+
static int viewpan_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
int x = 0, y = 0;
@@ -4455,6 +4602,12 @@ void VIEW3D_OT_view_pan(wmOperatorType *ot)
ot->prop = RNA_def_enum(ot->srna, "type", prop_view_pan_items, 0, "Pan", "Direction of View Pan");
}
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name View Toggle Perspective/Orthographic Operator
+ * \{ */
+
static int viewpersportho_exec(bContext *C, wmOperator *UNUSED(op))
{
View3D *v3d_dummy;
@@ -4491,6 +4644,14 @@ void VIEW3D_OT_view_persportho(wmOperatorType *ot)
ot->flag = 0;
}
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name View Navigate Operator
+ *
+ * Wraps walk/fly modes.
+ * \{ */
+
static int view3d_navigate_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *UNUSED(event))
{
eViewNavigation_Method mode = U.navigation_mode;
@@ -4520,8 +4681,11 @@ void VIEW3D_OT_navigate(wmOperatorType *ot)
ot->poll = ED_operator_view3d_active;
}
+/** \} */
-/* ******************** add background image operator **************** */
+/* -------------------------------------------------------------------- */
+/** \name Background Image Add Operator
+ * \{ */
static CameraBGImage *background_image_add(bContext *C)
{
@@ -4580,8 +4744,12 @@ void VIEW3D_OT_background_image_add(wmOperatorType *ot)
WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA);
}
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Background Image Remove Operator
+ * \{ */
-/* ***** remove image operator ******* */
static int background_image_remove_exec(bContext *C, wmOperator *op)
{
Camera *cam = CTX_data_pointer_get_type(C, "camera", &RNA_Camera).data;
@@ -4626,7 +4794,13 @@ void VIEW3D_OT_background_image_remove(wmOperatorType *ot)
RNA_def_int(ot->srna, "index", 0, 0, INT_MAX, "Index", "Background image index to remove", 0, INT_MAX);
}
-/* ********************* set clipping operator ****************** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name View Clipping Planes Operator
+ *
+ * Draw border or toggle off.
+ * \{ */
static void calc_local_clipping(float clip_local[6][4], BoundBox *clipbb, float mat[4][4])
{
@@ -4707,7 +4881,11 @@ void VIEW3D_OT_clip_border(wmOperatorType *ot)
WM_operator_properties_border(ot);
}
-/* ***************** 3d cursor cursor op ******************* */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Set Cursor Operator
+ * \{ */
/* cursor position in vec, result in vec, mval in region coords */
/* note: cannot use event->mval here (called by object_add() */
@@ -4819,7 +4997,11 @@ void VIEW3D_OT_cursor3d(wmOperatorType *ot)
}
-/* ***************** manipulator op ******************* */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Enable Transform Manipulator Operator
+ * \{ */
static int enable_manipulator_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
{
@@ -4861,7 +5043,11 @@ void VIEW3D_OT_enable_manipulator(wmOperatorType *ot)
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
-/* ************************* Toggle rendered shading *********************** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Toggle Render Shading Operator
+ * \{ */
static int toggle_render_exec(bContext *C, wmOperator *UNUSED(op))
{
@@ -4890,8 +5076,11 @@ void VIEW3D_OT_toggle_render(wmOperatorType *ot)
ot->poll = ED_operator_view3d_active;
}
-/* ************************* below the line! *********************** */
+/** \} */
+/* -------------------------------------------------------------------- */
+/** \name View Distance Utilities
+ * \{ */
static float view_autodist_depth_margin(ARegion *ar, const int mval[2], int margin)
{
@@ -5026,8 +5215,9 @@ static bool depth_segment_cb(int x, int y, void *userData)
}
}
-bool ED_view3d_autodist_depth_seg(ARegion *ar, const int mval_sta[2], const int mval_end[2],
- int margin, float *depth)
+bool ED_view3d_autodist_depth_seg(
+ ARegion *ar, const int mval_sta[2], const int mval_end[2],
+ int margin, float *depth)
{
struct { ARegion *ar; int margin; float depth; } data = {NULL};
int p1[2];
@@ -5096,6 +5286,12 @@ void ED_view3d_distance_set(RegionView3D *rv3d, const float dist)
rv3d->dist = dist;
}
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name View Transform Utilities
+ * \{ */
+
/**
* Set the view transformation from a 4x4 matrix.
*
@@ -5178,27 +5374,10 @@ void ED_view3d_from_object(Object *ob, float ofs[3], float quat[4], float *dist,
void ED_view3d_to_object(Object *ob, const float ofs[3], const float quat[4], const float dist)
{
float mat[4][4];
-
ED_view3d_to_m4(mat, ofs, quat, dist);
BKE_object_apply_mat4(ob, mat, true, true);
}
-/**
- * Use to store the last view, before entering camera view.
- */
-void ED_view3d_lastview_store(RegionView3D *rv3d)
-{
- copy_qt_qt(rv3d->lviewquat, rv3d->viewquat);
- rv3d->lview = rv3d->view;
- if (rv3d->persp != RV3D_CAMOB) {
- rv3d->lpersp = rv3d->persp;
- }
-}
+/** \} */
+
-void ED_view3D_lock_clear(View3D *v3d)
-{
- v3d->ob_centre = NULL;
- v3d->ob_centre_bone[0] = '\0';
- v3d->ob_centre_cursor = false;
- v3d->flag2 &= ~V3D_LOCK_CAMERA;
-}
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index c555358f4c3..3af7f5c8ae8 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -1190,6 +1190,11 @@ void view3d_viewmatrix_set(
vec[2] = 0.0f;
if (rect_scale) {
+ /* Since 'RegionView3D.winmat' has been calculated and this function doesn't take the 'ARegion'
+ * we don't know about the region size.
+ * Use 'rect_scale' when drawing a sub-region to apply 2D offset,
+ * scaled by the difference between the sub-region and the region size.
+ */
vec[0] /= rect_scale[0];
vec[1] /= rect_scale[1];
}