diff options
author | Jacques Lucke <mail@jlucke.com> | 2019-04-17 11:25:47 +0300 |
---|---|---|
committer | Jacques Lucke <mail@jlucke.com> | 2019-04-17 11:25:47 +0300 |
commit | 06a966ebe715923b6a05d8f44fc3efb7cf413ede (patch) | |
tree | 130cb3875c14fc8190ca7e5d30acc724b0550c1e | |
parent | d348a273803b6a9f299c9183a042f78e60ddca06 (diff) | |
parent | b3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (diff) |
Merge 'master' into 'functions'
294 files changed, 2978 insertions, 1559 deletions
diff --git a/.clang-format b/.clang-format new file mode 100644 index 00000000000..43613eca95c --- /dev/null +++ b/.clang-format @@ -0,0 +1,227 @@ + +# Configuration of clang-format +# ============================= +# +# Tested to work with versions: 6 to 8. + +# This causes parameters on continuations to align to the opening brace. +# +# like_this_long_name(parameter_one, +# parameter_two, +# parameter_three); +# +AlignAfterOpenBracket: 'Align' + +# Disallow short functions on one line; break them up. +AllowShortBlocksOnASingleLine: false + +# These two settings trigger stacking of parameters in most cases; this is +# easier to read and also makes diffs easier to read (since an added or removed +# parameter is obvious). For example, function calls will look like this: +# +# like_this_long_name(parameter_one, +# parameter_two, +# parameter_three, +# parameter_four, +# parameter_five, +# parameter_six); +# +# Instead of: +# +# like_this_long_name(parameter_one, parameter_two, parameter_three, parameter_four, +# parameter_five, parameter_six); +# +BinPackArguments: false +BinPackParameters: false + +# Line width (don't exceed 100). +ColumnLimit: 99 + +# Cause initializer lists to have one member initialized per line, in the case +# that all initializers can't fit on a single line. +ConstructorInitializerAllOnOneLineOrOnePerLine: true + +# Indent the : after a constructor. For example: +# +# explicit foo_class () +# : member1_(5) +# { +# } +# +ConstructorInitializerIndentWidth: 4 + +# Make access modifier slightly more visible. +AccessModifierOffset: -1 + +# This will unfortunately use spaces in some cases where it's not desired (like +# function calls) but the overall result is better since it will allow +# alignment to work properly with different tab width settings. +ContinuationIndentWidth: 4 + +# This tries to match Blender's style as much as possible. One +BreakBeforeBraces: Custom +BraceWrapping: { + AfterClass: 'false' + AfterControlStatement: 'false' + AfterEnum : 'false' + AfterFunction : 'true' + AfterNamespace : 'false' + AfterStruct : 'false' + AfterUnion : 'false' + BeforeCatch : 'true' + BeforeElse : 'true' + IndentBraces : 'false' + AfterObjCDeclaration: 'true' +} + +# For switch statements, indent the cases. +IndentCaseLabels: true + +# Indent after the hash inside preprocessor directives +IndentPPDirectives: AfterHash + +BreakBeforeTernaryOperators: false + +SpaceAfterTemplateKeyword: false + +# Handy comment at the end of each C++ name space. +FixNamespaceComments: true + +# Use "if (...)" instead of "if(...)", but have function calls like foo(). +SpaceBeforeParens: ControlStatements +SpaceInEmptyParentheses: false + +# Use two spaces before trailing comments, for example +# +# foo = bar; // comment +# +# Note that this doesn't work for C-style comments. +SpacesBeforeTrailingComments: 2 + +# Don't reflow comments, let developers define line breaks. +# Enabling breaks some ascii art. +ReflowComments: false + +# Never use tabs for indentation. +# Note: TabWidth and IndentWidth must be the same, or strange things happen. +UseTab: Never +TabWidth: 2 +IndentWidth: 2 + +# Add a big penalty on breaking after the return type of functions. For example, +# +# static void foo(...) +# +# Instead of: +# +# static void +# foo(very long content here that maybe could be stacked) +# +PenaltyReturnTypeOnItsOwnLine: 10000 + +# Avoid having function calls broken onto a new line: +# +# int a = foo( +# long, list, of, many, params); +# +# Instead of: +# +# int a = +# foo(long, list, of, many, params); +# +PenaltyBreakAssignment: 100 + +AllowShortFunctionsOnASingleLine: None + +# Disable for now since it complicates initial migration tests, +# TODO: look into enabling this in the future. +SortIncludes: false + +# Don't right align escaped newlines to the right because we have a wide default +AlignEscapedNewlines: DontAlign + +# Always break: +# +# const char *foo = +# "multi" +# "line"; +# +# Instead of: +# +# const char *foo = "multi" +# "line"; +# +AlwaysBreakBeforeMultilineStrings: true + +# We don't want literal strings to break, +# however clang-format seems to ignore this (sigh). +PenaltyBreakString: 1000000 + +# There are macros in Blender for custom for loops; tell Clang to treat them +# like loops rather than an expression, and so put the { on the same line. +ForEachMacros: + - BLI_SMALLSTACK_ITER_BEGIN + - BMO_ITER + - BMW_ITER + - BM_FACES_OF_VERT_ITER_BEGIN + - BM_ITER_ELEM + - BM_ITER_MESH + - BM_ITER_MESH_INDEX + - BM_ITER_MESH_MUTABLE + - BM_LOOPS_OF_VERT_ITER_BEGIN + - BOOST_FOREACH + - CTX_DATA_BEGIN + - DEG_OBJECT_ITER_BEGIN + - DEG_OBJECT_ITER_FOR_RENDER_ENGINE_BEGIN + - DRIVER_TARGETS_LOOPER_BEGIN + - DRIVER_TARGETS_USED_LOOPER_BEGIN + - FAKE_SELECT_MODE_BEGIN + - FOREACH_BASE_IN_EDIT_MODE_BEGIN + - FOREACH_BASE_IN_MODE_BEGIN + - FOREACH_BEGIN + - FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN + - FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN + - FOREACH_EDIT_OBJECT_BEGIN + - FOREACH_NODETREE_BEGIN + - FOREACH_OBJECT_BEGIN + - FOREACH_OBJECT_FLAG_BEGIN + - FOREACH_OBJECT_IN_EDIT_MODE_BEGIN + - FOREACH_OBJECT_IN_MODE_BEGIN + - FOREACH_OBJECT_RENDERABLE_BEGIN + - FOREACH_PCHAN_SELECTED_IN_OBJECT_BEGIN + - FOREACH_PCHAN_VISIBLE_IN_OBJECT_BEGIN + - FOREACH_SCENE_COLLECTION_BEGIN + - FOREACH_SCENE_OBJECT_BEGIN + - FOREACH_SELECTED_BASE_BEGIN + - FOREACH_SELECTED_EDITABLE_OBJECT_BEGIN + - FOREACH_SELECTED_OBJECT_BEGIN + - FOREACH_VIEW_LAYER_TO_RENDER_BEGIN + - FOREACH_VISIBLE_BASE_BEGIN + - FOREACH_VISIBLE_OBJECT_BEGIN + - GHASH_FOREACH_BEGIN + - GHASH_ITER + - GSET_FOREACH_BEGIN + - GSET_ITER + - GP_EDITABLE_STROKES_BEGIN + - GSET_FOREACH_BEGIN + - ITER_BEGIN + - LISTBASE_CIRCULAR_BACKWARD_BEGIN + - LISTBASE_CIRCULAR_FORWARD_BEGIN + - LISTBASE_FOREACH + - MAN2D_ITER_AXES_BEGIN + - MAN_ITER_AXES_BEGIN + - NODE_SOCKET_TYPES_BEGIN + - NODE_TREE_TYPES_BEGIN + - NODE_TYPES_BEGIN + - PIXEL_LOOPER_BEGIN + - RNA_BEGIN + - RNA_PROP_BEGIN + - RNA_STRUCT_BEGIN + - SEQP_BEGIN + - SEQ_BEGIN + - foreach + +# Use once we bump the minimum verison to version 8. +# # Without this string literals that in-line 'STRINGIFY' behave strangely (a bug?). +# StatementMacros: +# - STRINGIFY diff --git a/.editorconfig b/.editorconfig index 34d3f1aec82..a3966328353 100644 --- a/.editorconfig +++ b/.editorconfig @@ -3,18 +3,18 @@ charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true -indent_style = tab +indent_style = space indent_size = 4 -max_line_length = 120 +max_line_length = 99 # CMake & Text [*.{cmake,txt}] charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true -indent_style = tab -indent_size = 4 -max_line_length = 120 +indent_style = space +indent_size = 2 +max_line_length = 99 # Python [*.py] @@ -30,9 +30,9 @@ max_line_length = 120 charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true -indent_style = tab -indent_size = 4 -max_line_length = 120 +indent_style = space +indent_size = 2 +max_line_length = 99 # reStructuredText [*.rst] diff --git a/GNUmakefile b/GNUmakefile index 35960733858..b85e69a2cac 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -123,6 +123,11 @@ Utilities * update: updates git and all submodules + * format + Format source code using clang (uses PATHS if passed in). For example:: + + make format PATHS="source/blender/blenlib source/blender/blenkernel" + Environment Variables * BUILD_CMAKE_ARGS: Arguments passed to CMake. @@ -510,6 +515,10 @@ update: .FORCE git submodule foreach git checkout master git submodule foreach git pull --rebase origin master +format: .FORCE + PATH="../lib/${OS_NCASE}/llvm/bin/:$(PATH)" \ + python3 source/tools/utils_maintenance/clang_format_paths.py --expand-tabs $(PATHS) + # ----------------------------------------------------------------------------- # Documentation diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake index ea29a0f5233..22e53fecf50 100644 --- a/build_files/cmake/macros.cmake +++ b/build_files/cmake/macros.cmake @@ -222,7 +222,7 @@ function(blender_add_lib__impl sources includes includes_sys - libraries + library_deps ) # message(STATUS "Configuring library ${name}") @@ -234,11 +234,8 @@ function(blender_add_lib__impl add_library(${name} ${sources}) - # Use for testing 'BLENDER_SORTED_LIBS' removal. - if(DEFINED WITHOUT_SORTED_LIBS AND WITHOUT_SORTED_LIBS) - if (NOT "${libraries}" STREQUAL "") - target_link_libraries(${name} "${libraries}") - endif() + if (NOT "${library_deps}" STREQUAL "") + target_link_libraries(${name} "${library_deps}") endif() # works fine without having the includes @@ -265,12 +262,12 @@ function(blender_add_lib_nolist sources includes includes_sys - libraries + library_deps ) add_cc_flags_custom_test(${name} PARENT_SCOPE) - blender_add_lib__impl(${name} "${sources}" "${includes}" "${includes_sys}" "${libraries}") + blender_add_lib__impl(${name} "${sources}" "${includes}" "${includes_sys}" "${library_deps}") endfunction() function(blender_add_lib @@ -278,12 +275,12 @@ function(blender_add_lib sources includes includes_sys - libraries + library_deps ) add_cc_flags_custom_test(${name} PARENT_SCOPE) - blender_add_lib__impl(${name} "${sources}" "${includes}" "${includes_sys}" "${libraries}") + blender_add_lib__impl(${name} "${sources}" "${includes}" "${includes_sys}" "${library_deps}") set_property(GLOBAL APPEND PROPERTY BLENDER_LINK_LIBS ${name}) endfunction() @@ -427,8 +424,11 @@ function(setup_liblinks if(WITH_SDL AND NOT WITH_SDL_DYNLOAD) target_link_libraries(${target} ${SDL_LIBRARY}) endif() - if(WITH_IMAGE_TIFF) - target_link_libraries(${target} ${TIFF_LIBRARY}) + if(WITH_CYCLES_OSL) + target_link_libraries(${target} ${OSL_LIBRARIES}) + endif() + if(WITH_OPENVDB) + target_link_libraries(${target} ${OPENVDB_LIBRARIES} ${TBB_LIBRARIES} ${BLOSC_LIBRARIES}) endif() if(WITH_OPENIMAGEIO) target_link_libraries(${target} ${OPENIMAGEIO_LIBRARIES}) @@ -439,12 +439,6 @@ function(setup_liblinks if(WITH_OPENSUBDIV) target_link_libraries(${target} ${OPENSUBDIV_LIBRARIES}) endif() - if(WITH_OPENVDB) - target_link_libraries(${target} ${OPENVDB_LIBRARIES} ${TBB_LIBRARIES} ${BLOSC_LIBRARIES}) - endif() - if(WITH_CYCLES_OSL) - target_link_libraries(${target} ${OSL_LIBRARIES}) - endif() if(WITH_CYCLES_EMBREE) target_link_libraries(${target} ${EMBREE_LIBRARIES}) endif() @@ -458,6 +452,9 @@ function(setup_liblinks if(WITH_ALEMBIC) target_link_libraries(${target} ${ALEMBIC_LIBRARIES} ${HDF5_LIBRARIES}) endif() + if(WITH_IMAGE_TIFF) + target_link_libraries(${target} ${TIFF_LIBRARY}) + endif() if(WITH_IMAGE_OPENEXR) target_link_libraries(${target} ${OPENEXR_LIBRARIES}) endif() @@ -542,267 +539,6 @@ function(setup_liblinks target_link_libraries(${target} ${PLATFORM_LINKLIBS}) endfunction() - -function(SETUP_BLENDER_SORTED_LIBS) - - get_property(BLENDER_LINK_LIBS GLOBAL PROPERTY BLENDER_LINK_LIBS) - - list(APPEND BLENDER_LINK_LIBS - bf_windowmanager - bf_render - ) - - if(WITH_MOD_FLUID) - list(APPEND BLENDER_LINK_LIBS bf_intern_elbeem) - endif() - - if(WITH_CYCLES) - list(APPEND BLENDER_LINK_LIBS - cycles_render - cycles_graph - cycles_bvh - cycles_device - cycles_kernel - cycles_util - cycles_subd) - if(WITH_CYCLES_OSL) - list(APPEND BLENDER_LINK_LIBS cycles_kernel_osl) - endif() - endif() - - if(WITH_AUDASPACE AND NOT WITH_SYSTEM_AUDASPACE) - list(APPEND BLENDER_LINK_LIBS - audaspace - audaspace-py) - endif() - - # Sort libraries - set(BLENDER_SORTED_LIBS - bf_windowmanager - - bf_editor_undo - - bf_editor_space_api - bf_editor_space_action - bf_editor_space_buttons - bf_editor_space_console - bf_editor_space_file - bf_editor_space_graph - bf_editor_space_image - bf_editor_space_info - bf_editor_space_logic - bf_editor_space_nla - bf_editor_space_node - bf_editor_space_outliner - bf_editor_space_script - bf_editor_space_sequencer - bf_editor_space_statusbar - bf_editor_space_text - bf_editor_space_time - bf_editor_space_topbar - bf_editor_space_userpref - bf_editor_space_view3d - bf_editor_space_clip - - bf_editor_transform - bf_editor_uvedit - bf_editor_curve - bf_editor_interface - bf_editor_gizmo_library - bf_editor_mesh - bf_editor_metaball - bf_editor_object - bf_editor_gpencil - bf_editor_lattice - bf_editor_armature - bf_editor_physics - bf_editor_render - bf_editor_scene - bf_editor_screen - bf_editor_sculpt_paint - bf_editor_sound - bf_editor_animation - bf_editor_datafiles - bf_editor_mask - bf_editor_io - bf_editor_util - - bf_render - bf_python - bf_python_ext - bf_python_mathutils - bf_python_gpu - bf_python_bmesh - bf_freestyle - bf_ikplugin - bf_modifiers - bf_functions - bf_gpencil_modifiers - bf_alembic - bf_bmesh - bf_gpu - bf_draw - bf_blenloader - bf_blenkernel - bf_shader_fx - bf_gpencil_modifiers - bf_physics - bf_nodes - bf_rna - bf_editor_gizmo_library # rna -> gizmo bad-level calls - bf_python - bf_imbuf - bf_blenlib - bf_depsgraph - bf_intern_ghost - bf_intern_string - bf_avi - bf_imbuf_cineon - bf_imbuf_openexr - bf_imbuf_openimageio - bf_imbuf_dds - bf_collada - bf_intern_elbeem - bf_intern_memutil - bf_intern_guardedalloc - bf_intern_ctr - bf_intern_utfconv - bf_intern_smoke - extern_lzma - extern_curve_fit_nd - bf_intern_moto - extern_openjpeg - bf_dna - - bf_blenfont - bf_gpu # duplicate for blenfont - bf_blentranslation - bf_intern_audaspace - audaspace - audaspace-py - bf_intern_mikktspace - bf_intern_dualcon - bf_intern_cycles - cycles_device - cycles_render - cycles_graph - cycles_bvh - cycles_kernel - cycles_util - cycles_subd - bf_intern_opencolorio - bf_intern_gawain - bf_intern_eigen - extern_rangetree - extern_wcwidth - bf_intern_libmv - extern_sdlew - - bf_intern_glew_mx - bf_intern_clog - bf_intern_opensubdiv - bf_intern_numaapi - ) - - if(NOT WITH_SYSTEM_GLOG) - list(APPEND BLENDER_SORTED_LIBS extern_glog) - endif() - - if(NOT WITH_SYSTEM_GFLAGS) - list(APPEND BLENDER_SORTED_LIBS extern_gflags) - endif() - - if(WITH_COMPOSITOR) - # added for opencl compositor - list_insert_before(BLENDER_SORTED_LIBS "bf_blenkernel" "bf_compositor") - list_insert_after(BLENDER_SORTED_LIBS "bf_compositor" "bf_intern_opencl") - endif() - - if(WITH_LIBMV) - list(APPEND BLENDER_SORTED_LIBS extern_ceres) - endif() - - if(WITH_MOD_CLOTH_ELTOPO) - list(APPEND BLENDER_SORTED_LIBS extern_eltopo) - endif() - - if(NOT WITH_SYSTEM_LZO) - list(APPEND BLENDER_SORTED_LIBS extern_minilzo) - endif() - - if(NOT WITH_SYSTEM_GLEW) - list(APPEND BLENDER_SORTED_LIBS ${BLENDER_GLEW_LIBRARIES}) - endif() - - if(WITH_BINRELOC) - list(APPEND BLENDER_SORTED_LIBS extern_binreloc) - endif() - - if(WITH_CXX_GUARDEDALLOC) - list(APPEND BLENDER_SORTED_LIBS bf_intern_guardedalloc_cpp) - endif() - - if(WITH_IK_SOLVER) - list_insert_after(BLENDER_SORTED_LIBS "bf_intern_elbeem" "bf_intern_iksolver") - endif() - - if(WITH_IK_ITASC) - list(APPEND BLENDER_SORTED_LIBS bf_intern_itasc) - endif() - - if(WITH_GHOST_XDND) - list(APPEND BLENDER_SORTED_LIBS extern_xdnd) - endif() - - if(WITH_CYCLES_OSL) - list_insert_after(BLENDER_SORTED_LIBS "cycles_kernel" "cycles_kernel_osl") - endif() - - if(WITH_INTERNATIONAL) - list(APPEND BLENDER_SORTED_LIBS bf_intern_locale) - endif() - - if(WITH_BULLET) - list_insert_after(BLENDER_SORTED_LIBS "bf_blenkernel" "bf_intern_rigidbody") - endif() - - if(WITH_BULLET AND NOT WITH_SYSTEM_BULLET) - list_insert_after(BLENDER_SORTED_LIBS "extern_openjpeg" "extern_bullet") - endif() - - if(WIN32) - list(APPEND BLENDER_SORTED_LIBS bf_intern_gpudirect) - endif() - - if(WITH_OPENVDB) - list(APPEND BLENDER_SORTED_LIBS bf_intern_openvdb) - endif() - - foreach(SORTLIB ${BLENDER_SORTED_LIBS}) - set(REMLIB ${SORTLIB}) - foreach(SEARCHLIB ${BLENDER_LINK_LIBS}) - if(${SEARCHLIB} STREQUAL ${SORTLIB}) - set(REMLIB "") - endif() - endforeach() - if(REMLIB) - # message(STATUS "Removing library ${REMLIB} from blender linking because: not configured") - list(APPEND REM_MSG ${REMLIB}) - list(REMOVE_ITEM BLENDER_SORTED_LIBS ${REMLIB}) - endif() - endforeach() - if(REM_MSG) - list(SORT REM_MSG) - message(STATUS "Blender Skipping: (${REM_MSG})") - endif() - - - set(BLENDER_SORTED_LIBS ${BLENDER_SORTED_LIBS} PARENT_SCOPE) - - # for top-level tests - set_property(GLOBAL PROPERTY BLENDER_SORTED_LIBS_PROP ${BLENDER_SORTED_LIBS}) -endfunction() - macro(TEST_SSE_SUPPORT _sse_flags _sse2_flags) diff --git a/build_files/utils/build_tgz.sh b/build_files/utils/build_tgz.sh index 203e58d5a68..63c3264b18e 100755 --- a/build_files/utils/build_tgz.sh +++ b/build_files/utils/build_tgz.sh @@ -12,11 +12,11 @@ blender_version_cycle=$(grep "BLENDER_VERSION_CYCLE\s" "$blender_srcdir/source/b blender_subversion=$(grep "BLENDER_SUBVERSION\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}') if [ "$blender_version_cycle" = "release" ] ; then - VERSION=$(expr $blender_version / 100).$(expr $blender_version % 100)$blender_version_char - SUBMODULE_EXCLUDE="^\(release/scripts/addons_contrib\)$" + VERSION=$(expr $blender_version / 100).$(expr $blender_version % 100)$blender_version_char + SUBMODULE_EXCLUDE="^\(release/scripts/addons_contrib\)$" else - VERSION=$(expr $blender_version / 100).$(expr $blender_version % 100)_$blender_subversion - SUBMODULE_EXCLUDE="^$" # dummy regex + VERSION=$(expr $blender_version / 100).$(expr $blender_version % 100)_$blender_subversion + SUBMODULE_EXCLUDE="^$" # dummy regex fi MANIFEST="blender-$VERSION-manifest.txt" @@ -42,10 +42,10 @@ git ls-files | python3 -c "$FILTER_FILES_PY" > $BASE_DIR/$MANIFEST # Enumerate submodules for lcv in $(git submodule | awk '{print $2}' | grep -v "$SUBMODULE_EXCLUDE"); do - cd "$BASE_DIR" - cd "$blender_srcdir/$lcv" - git ls-files | python3 -c "$FILTER_FILES_PY" | awk '$0="'"$lcv"/'"$0' >> $BASE_DIR/$MANIFEST - cd "$BASE_DIR" + cd "$BASE_DIR" + cd "$blender_srcdir/$lcv" + git ls-files | python3 -c "$FILTER_FILES_PY" | awk '$0="'"$lcv"/'"$0' >> $BASE_DIR/$MANIFEST + cd "$BASE_DIR" done echo "OK" @@ -54,10 +54,10 @@ echo "OK" cd "$blender_srcdir" echo -n "Creating archive: \"$BASE_DIR/$TARBALL\" ..." tar --transform "s,^,blender-$VERSION/,g" \ - --use-compress-program="gzip --best" \ - --create \ - --file="$BASE_DIR/$TARBALL" \ - --files-from="$BASE_DIR/$MANIFEST" + --use-compress-program="gzip --best" \ + --create \ + --file="$BASE_DIR/$TARBALL" \ + --files-from="$BASE_DIR/$MANIFEST" echo "OK" diff --git a/build_files/windows/format.cmd b/build_files/windows/format.cmd new file mode 100644 index 00000000000..ca5330dc37c --- /dev/null +++ b/build_files/windows/format.cmd @@ -0,0 +1,25 @@ +if EXIST %BLENDER_DIR%\..\lib\win64_vc14\llvm\bin\clang-format.exe ( + set CF_PATH=..\lib\win64_vc14\llvm\bin + goto detect_done +) +if EXIST %BLENDER_DIR%\..\lib\windows_vc14\llvm\bin\clang-format.exe ( + set CF_PATH=..\lib\windows_vc14\llvm\bin + goto detect_done +) + +echo clang-format not found +exit /b 1 + +:detect_done +echo found clang-format in %CF_PATH% + +REM TODO(sergey): Switch to Python from libraries when available. +set PYTHON="python.exe" +set FORMAT_PATHS=%BLENDER_DIR%\source\tools\utils_maintenance\clang_format_paths.py + +REM The formatting script expects clang-format to be in the current PATH. +set PATH=%CF_PATH%;%PATH% + +%PYTHON% %FORMAT_PATHS% --expand-tabs + +:EOF diff --git a/build_files/windows/parse_arguments.cmd b/build_files/windows/parse_arguments.cmd index ada78e1defb..ed54ee9d13a 100644 --- a/build_files/windows/parse_arguments.cmd +++ b/build_files/windows/parse_arguments.cmd @@ -81,6 +81,8 @@ if NOT "%1" == "" ( set MUST_CLEAN=1 ) else if "%1" == "verbose" ( set VERBOSE=1 + ) else if "%1" == "format" ( + set FORMAT=1 ) else ( echo Command "%1" unknown, aborting! exit /b 1 diff --git a/build_files/windows/reset_variables.cmd b/build_files/windows/reset_variables.cmd index ba584a7f34a..efac15785ca 100644 --- a/build_files/windows/reset_variables.cmd +++ b/build_files/windows/reset_variables.cmd @@ -27,3 +27,4 @@ set CLANG_CMAKE_ARGS= set ASAN_CMAKE_ARGS= set WITH_PYDEBUG= set PYDEBUG_CMAKE_ARGS= +set FORMAT= diff --git a/doc/python_api/sphinx_doc_gen.sh b/doc/python_api/sphinx_doc_gen.sh index 4b7569f7d54..45cd6a229e5 100755 --- a/doc/python_api/sphinx_doc_gen.sh +++ b/doc/python_api/sphinx_doc_gen.sh @@ -14,16 +14,16 @@ DO_OUT_HTML_ZIP=true DO_OUT_PDF=false if [ -z $BLENDER_BIN ] ; then - BLENDER_BIN="./blender.bin" + BLENDER_BIN="./blender.bin" fi if [ "$1" == "" ] ; then - echo "Expected a single argument for the username on blender.org, skipping upload step!" - DO_UPLOAD=false + echo "Expected a single argument for the username on blender.org, skipping upload step!" + DO_UPLOAD=false else - SSH_USER=$1 - SSH_HOST=$SSH_USER"@blender.org" - SSH_UPLOAD="/data/www/vhosts/www.blender.org/api" # blender_python_api_VERSION, added after + SSH_USER=$1 + SSH_HOST=$SSH_USER"@blender.org" + SSH_UPLOAD="/data/www/vhosts/www.blender.org/api" # blender_python_api_VERSION, added after fi @@ -42,9 +42,9 @@ blender_subversion=$(grep "BLENDER_SUBVERSION\s" "$blender_version_header" | awk unset blender_version_header if [ "$blender_version_cycle" = "release" ] ; then - BLENDER_VERSION=$(expr $blender_version / 100)_$(expr $blender_version % 100)$blender_version_char"_release" + BLENDER_VERSION=$(expr $blender_version / 100)_$(expr $blender_version % 100)$blender_version_char"_release" else - BLENDER_VERSION=$(expr $blender_version / 100)_$(expr $blender_version % 100)_$blender_subversion + BLENDER_VERSION=$(expr $blender_version / 100)_$(expr $blender_version % 100)_$blender_subversion fi SSH_UPLOAD_FULL=$SSH_UPLOAD/"blender_python_api_"$BLENDER_VERSION @@ -58,54 +58,54 @@ SPHINX_WORKDIR="$(mktemp --directory --suffix=.sphinx)" # Generate reStructuredText (blender/python only) if $DO_EXE_BLENDER ; then - # Don't delete existing docs, now partial updates are used for quick builds. - # - # Disable ASAN error halt since it results in nonzero exit code on any minor issue. - ASAN_OPTIONS=halt_on_error=0 \ - $BLENDER_BIN \ - --background \ - -noaudio \ - --factory-startup \ - --python-exit-code 1 \ - --python $SPHINXBASE/sphinx_doc_gen.py \ - -- \ - --output=$SPHINX_WORKDIR - - - if (($? != 0)) ; then - echo "Generating documentation failed, aborting" - exit 1 - fi + # Don't delete existing docs, now partial updates are used for quick builds. + # + # Disable ASAN error halt since it results in nonzero exit code on any minor issue. + ASAN_OPTIONS=halt_on_error=0 \ + $BLENDER_BIN \ + --background \ + -noaudio \ + --factory-startup \ + --python-exit-code 1 \ + --python $SPHINXBASE/sphinx_doc_gen.py \ + -- \ + --output=$SPHINX_WORKDIR + + + if (($? != 0)) ; then + echo "Generating documentation failed, aborting" + exit 1 + fi fi # ---------------------------------------------------------------------------- # Generate HTML (sphinx) if $DO_OUT_HTML ; then - # sphinx-build -n -b html $SPHINX_WORKDIR/sphinx-in $SPHINX_WORKDIR/sphinx-out + # sphinx-build -n -b html $SPHINX_WORKDIR/sphinx-in $SPHINX_WORKDIR/sphinx-out - # annoying bug in sphinx makes it very slow unless we do this. should report. - cd $SPHINX_WORKDIR - sphinx-build -b html sphinx-in sphinx-out + # annoying bug in sphinx makes it very slow unless we do this. should report. + cd $SPHINX_WORKDIR + sphinx-build -b html sphinx-in sphinx-out - # XXX, saves space on upload and zip, should move HTML outside - # and zip up there, for now this is OK - rm -rf sphinx-out/.doctrees + # XXX, saves space on upload and zip, should move HTML outside + # and zip up there, for now this is OK + rm -rf sphinx-out/.doctrees - # in case we have a zip already - rm -f blender_python_reference_$BLENDER_VERSION.zip + # in case we have a zip already + rm -f blender_python_reference_$BLENDER_VERSION.zip - # ------------------------------------------------------------------------ - # ZIP the HTML dir for upload + # ------------------------------------------------------------------------ + # ZIP the HTML dir for upload - if $DO_OUT_HTML_ZIP ; then - # lame, temp rename dir - mv sphinx-out blender_python_reference_$BLENDER_VERSION - zip -r -9 blender_python_reference_$BLENDER_VERSION.zip blender_python_reference_$BLENDER_VERSION - mv blender_python_reference_$BLENDER_VERSION sphinx-out - fi + if $DO_OUT_HTML_ZIP ; then + # lame, temp rename dir + mv sphinx-out blender_python_reference_$BLENDER_VERSION + zip -r -9 blender_python_reference_$BLENDER_VERSION.zip blender_python_reference_$BLENDER_VERSION + mv blender_python_reference_$BLENDER_VERSION sphinx-out + fi - cd - + cd - fi @@ -113,11 +113,11 @@ fi # Generate PDF (sphinx/laytex) if $DO_OUT_PDF ; then - cd $SPHINX_WORKDIR - sphinx-build -n -b latex $SPHINX_WORKDIR/sphinx-in $SPHINX_WORKDIR/sphinx-out - make -C $SPHINX_WORKDIR/sphinx-out - mv $SPHINX_WORKDIR/sphinx-out/contents.pdf \ - $SPHINX_WORKDIR/sphinx-out/blender_python_reference_$BLENDER_VERSION.pdf + cd $SPHINX_WORKDIR + sphinx-build -n -b latex $SPHINX_WORKDIR/sphinx-in $SPHINX_WORKDIR/sphinx-out + make -C $SPHINX_WORKDIR/sphinx-out + mv $SPHINX_WORKDIR/sphinx-out/contents.pdf \ + $SPHINX_WORKDIR/sphinx-out/blender_python_reference_$BLENDER_VERSION.pdf fi # ---------------------------------------------------------------------------- @@ -125,35 +125,35 @@ fi if $DO_UPLOAD ; then - ssh $SSH_USER@blender.org 'rm -rf '$SSH_UPLOAD_FULL'/*' - rsync --progress -ave "ssh -p 22" $SPHINX_WORKDIR/sphinx-out/* $SSH_HOST:$SSH_UPLOAD_FULL/ - - ## symlink the dir to a static URL - #ssh $SSH_USER@blender.org 'rm '$SSH_UPLOAD'/250PythonDoc && ln -s '$SSH_UPLOAD_FULL' '$SSH_UPLOAD'/250PythonDoc' - if [ "$blender_version_cycle" = "release" ] ; then - ssh $SSH_USER@blender.org 'rm '$SSH_UPLOAD'/blender_python_api_current && ln -s '$SSH_UPLOAD_FULL' '$SSH_UPLOAD'/blender_python_api_current' - fi - - # better redirect - ssh $SSH_USER@blender.org 'echo "<html><head><title>Redirecting...</title><meta http-equiv=\"REFRESH\" content=\"0;url=../blender_python_api_'$BLENDER_VERSION'/\"></head><body>Redirecting...</body></html>" > '$SSH_UPLOAD'/250PythonDoc/index.html' - - # redirect for release only so wiki can point here - if [ "$blender_version_cycle" = "release" ] ; then - ssh $SSH_USER@blender.org 'echo "<html><head><title>Redirecting...</title><meta http-equiv=\"REFRESH\" content=\"0;url=../blender_python_api_'$BLENDER_VERSION'/\"></head><body>Redirecting...</body></html>" > '$SSH_UPLOAD'/blender_python_api/index.html' - fi - - if $DO_OUT_PDF ; then - # rename so local PDF has matching name. - rsync --progress -ave "ssh -p 22" \ - $SPHINX_WORKDIR/sphinx-out/blender_python_reference_$BLENDER_VERSION.pdf \ - $SSH_HOST:$SSH_UPLOAD_FULL/blender_python_reference_$BLENDER_VERSION.pdf - fi - - if $DO_OUT_HTML_ZIP ; then - rsync --progress -ave "ssh -p 22" \ - $SPHINX_WORKDIR/blender_python_reference_$BLENDER_VERSION.zip \ - $SSH_HOST:$SSH_UPLOAD_FULL/blender_python_reference_$BLENDER_VERSION.zip - fi + ssh $SSH_USER@blender.org 'rm -rf '$SSH_UPLOAD_FULL'/*' + rsync --progress -ave "ssh -p 22" $SPHINX_WORKDIR/sphinx-out/* $SSH_HOST:$SSH_UPLOAD_FULL/ + + ## symlink the dir to a static URL + #ssh $SSH_USER@blender.org 'rm '$SSH_UPLOAD'/250PythonDoc && ln -s '$SSH_UPLOAD_FULL' '$SSH_UPLOAD'/250PythonDoc' + if [ "$blender_version_cycle" = "release" ] ; then + ssh $SSH_USER@blender.org 'rm '$SSH_UPLOAD'/blender_python_api_current && ln -s '$SSH_UPLOAD_FULL' '$SSH_UPLOAD'/blender_python_api_current' + fi + + # better redirect + ssh $SSH_USER@blender.org 'echo "<html><head><title>Redirecting...</title><meta http-equiv=\"REFRESH\" content=\"0;url=../blender_python_api_'$BLENDER_VERSION'/\"></head><body>Redirecting...</body></html>" > '$SSH_UPLOAD'/250PythonDoc/index.html' + + # redirect for release only so wiki can point here + if [ "$blender_version_cycle" = "release" ] ; then + ssh $SSH_USER@blender.org 'echo "<html><head><title>Redirecting...</title><meta http-equiv=\"REFRESH\" content=\"0;url=../blender_python_api_'$BLENDER_VERSION'/\"></head><body>Redirecting...</body></html>" > '$SSH_UPLOAD'/blender_python_api/index.html' + fi + + if $DO_OUT_PDF ; then + # rename so local PDF has matching name. + rsync --progress -ave "ssh -p 22" \ + $SPHINX_WORKDIR/sphinx-out/blender_python_reference_$BLENDER_VERSION.pdf \ + $SSH_HOST:$SSH_UPLOAD_FULL/blender_python_reference_$BLENDER_VERSION.pdf + fi + + if $DO_OUT_HTML_ZIP ; then + rsync --progress -ave "ssh -p 22" \ + $SPHINX_WORKDIR/blender_python_reference_$BLENDER_VERSION.zip \ + $SSH_HOST:$SSH_UPLOAD_FULL/blender_python_reference_$BLENDER_VERSION.zip + fi fi diff --git a/extern/.clang-format b/extern/.clang-format new file mode 100644 index 00000000000..9d159247d51 --- /dev/null +++ b/extern/.clang-format @@ -0,0 +1,2 @@ +DisableFormat: true +SortIncludes: false diff --git a/extern/ceres/CMakeLists.txt b/extern/ceres/CMakeLists.txt index 0531eb71ba5..d91e64b8fd0 100644 --- a/extern/ceres/CMakeLists.txt +++ b/extern/ceres/CMakeLists.txt @@ -256,6 +256,15 @@ set(SRC internal/ceres/wall_time.h ) +set(LIB +) + +if(WITH_LIBMV OR WITH_GTESTS OR (WITH_CYCLES AND WITH_CYCLES_LOGGING)) + list(APPEND LIB + extern_glog + ) +endif() + if(WITH_LIBMV_SCHUR_SPECIALIZATIONS) list(APPEND SRC internal/ceres/generated/partitioned_matrix_view_2_2_2.cc @@ -319,4 +328,4 @@ if(WITH_OPENMP) ) endif() -blender_add_lib(extern_ceres "${SRC}" "${INC}" "${INC_SYS}" "") +blender_add_lib(extern_ceres "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") diff --git a/extern/ceres/bundle.sh b/extern/ceres/bundle.sh index e8212aa1d41..561e2b404c1 100755 --- a/extern/ceres/bundle.sh +++ b/extern/ceres/bundle.sh @@ -109,10 +109,6 @@ cat > CMakeLists.txt << EOF # # The Original Code is Copyright (C) 2012, Blender Foundation # All rights reserved. -# -# Contributor(s): Blender Foundation, -# Sergey Sharybin -# # ***** END GPL LICENSE BLOCK ***** # NOTE: This file is automatically generated by bundle.sh script @@ -139,6 +135,10 @@ ${sources} ${headers} ) +set(LIB + extern_glog +) + if(WITH_LIBMV_SCHUR_SPECIALIZATIONS) list(APPEND SRC ${generated_sources} @@ -165,5 +165,5 @@ if(WITH_OPENMP) ) endif() -blender_add_lib(extern_ceres "\${SRC}" "\${INC}" "\${INC_SYS}" "") +blender_add_lib(extern_ceres "\${SRC}" "\${INC}" "\${INC_SYS}" "\${LIB}") EOF diff --git a/extern/glog/CMakeLists.txt b/extern/glog/CMakeLists.txt index 1b1abbfc735..05a6590ea81 100644 --- a/extern/glog/CMakeLists.txt +++ b/extern/glog/CMakeLists.txt @@ -56,6 +56,12 @@ set(SRC set(LIB ) +if(NOT WITH_SYSTEM_GFLAGS) + list(APPEND LIB + extern_gflags + ) +endif() + if(WIN32) list(APPEND SRC src/windows/port.cc diff --git a/intern/audaspace/CMakeLists.txt b/intern/audaspace/CMakeLists.txt index 6b828b204f1..21657d6f3c0 100644 --- a/intern/audaspace/CMakeLists.txt +++ b/intern/audaspace/CMakeLists.txt @@ -41,6 +41,12 @@ endif() set(LIB ) +if(NOT WITH_SYSTEM_AUDASPACE) + list(APPEND LIB + audaspace + ) +endif() + if(WITH_PYTHON) list(APPEND INC_SYS ${PYTHON_INCLUDE_DIRS} @@ -49,6 +55,12 @@ if(WITH_PYTHON) intern/AUD_PyInit.cpp intern/AUD_PyInit.h ) + if(NOT WITH_SYSTEM_AUDASPACE) + list(APPEND LIB + audaspace-py + ) + endif() + add_definitions(-DWITH_PYTHON) endif() diff --git a/intern/cycles/blender/CMakeLists.txt b/intern/cycles/blender/CMakeLists.txt index 3f8868d793b..fc265a47a01 100644 --- a/intern/cycles/blender/CMakeLists.txt +++ b/intern/cycles/blender/CMakeLists.txt @@ -39,8 +39,21 @@ set(SRC ) set(LIB + cycles_bvh + cycles_device + cycles_graph + cycles_kernel + cycles_render + cycles_subd + cycles_util ) +if(WITH_CYCLES_LOGGING) + list(APPEND LIB + extern_glog + ) +endif() + set(ADDON_FILES addon/__init__.py addon/engine.py diff --git a/intern/cycles/bvh/CMakeLists.txt b/intern/cycles/bvh/CMakeLists.txt index 6014624f395..ea31838d816 100644 --- a/intern/cycles/bvh/CMakeLists.txt +++ b/intern/cycles/bvh/CMakeLists.txt @@ -35,7 +35,11 @@ set(SRC_HEADERS bvh_unaligned.h ) +set(LIB + cycles_render +) + include_directories(${INC}) include_directories(SYSTEM ${INC_SYS}) -cycles_add_library(cycles_bvh ${SRC} ${SRC_HEADERS}) +cycles_add_library(cycles_bvh "${LIB}" ${SRC} ${SRC_HEADERS}) diff --git a/intern/cycles/cmake/macros.cmake b/intern/cycles/cmake/macros.cmake index f3ca06ac6b8..ab8182ba4a7 100644 --- a/intern/cycles/cmake/macros.cmake +++ b/intern/cycles/cmake/macros.cmake @@ -6,7 +6,10 @@ function(cycles_set_solution_folder target) endif() endfunction() -macro(cycles_add_library target) +macro(cycles_add_library target library_deps) add_library(${target} ${ARGN}) + if(NOT ("${library_deps}" STREQUAL "")) + target_link_libraries(${target} "${library_deps}") + endif() cycles_set_solution_folder(${target}) endmacro() diff --git a/intern/cycles/device/CMakeLists.txt b/intern/cycles/device/CMakeLists.txt index d95cd02a85e..d804a07bcab 100644 --- a/intern/cycles/device/CMakeLists.txt +++ b/intern/cycles/device/CMakeLists.txt @@ -58,6 +58,20 @@ set(SRC_HEADERS device_task.h ) +set(LIB + +) + +if(WITH_CUDA_DYNLOAD) + list(APPEND LIB + extern_cuew + ) +else() + list(APPEND LIB + ${CUDA_CUDA_LIBRARY} + ) +endif() + add_definitions(${GL_DEFINITIONS}) if(WITH_CYCLES_NETWORK) add_definitions(-DWITH_NETWORK) @@ -75,4 +89,4 @@ endif() include_directories(${INC}) include_directories(SYSTEM ${INC_SYS}) -cycles_add_library(cycles_device ${SRC} ${SRC_OPENCL} ${SRC_HEADERS}) +cycles_add_library(cycles_device "${LIB}" ${SRC} ${SRC_OPENCL} ${SRC_HEADERS}) diff --git a/intern/cycles/graph/CMakeLists.txt b/intern/cycles/graph/CMakeLists.txt index 0ce56c2b2e6..bd2b2728a29 100644 --- a/intern/cycles/graph/CMakeLists.txt +++ b/intern/cycles/graph/CMakeLists.txt @@ -16,7 +16,11 @@ set(SRC_HEADERS node_xml.h ) +set(LIB + +) + include_directories(${INC}) include_directories(SYSTEM ${INC_SYS}) -cycles_add_library(cycles_graph ${SRC} ${SRC_HEADERS}) +cycles_add_library(cycles_graph "${LIB}" ${SRC} ${SRC_HEADERS}) diff --git a/intern/cycles/kernel/CMakeLists.txt b/intern/cycles/kernel/CMakeLists.txt index 822ce68bdc8..01552dff9bb 100644 --- a/intern/cycles/kernel/CMakeLists.txt +++ b/intern/cycles/kernel/CMakeLists.txt @@ -333,6 +333,10 @@ set(SRC_SPLIT_HEADERS split/kernel_subsurface_scatter.h ) +set(LIB + +) + # CUDA module if(WITH_CYCLES_CUDA_BINARIES) @@ -470,6 +474,9 @@ endif() # OSL module if(WITH_CYCLES_OSL) + list(APPEND LIB + cycles_kernel_osl + ) add_subdirectory(osl) add_subdirectory(shaders) endif() @@ -507,7 +514,7 @@ if(CXX_HAS_AVX2) set_source_files_properties(kernels/cpu/filter_avx2.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_AVX2_KERNEL_FLAGS}") endif() -cycles_add_library(cycles_kernel +cycles_add_library(cycles_kernel "${LIB}" ${SRC_CPU_KERNELS} ${SRC_CUDA_KERNELS} ${SRC_OPENCL_KERNELS} diff --git a/intern/cycles/kernel/osl/CMakeLists.txt b/intern/cycles/kernel/osl/CMakeLists.txt index adca45c5c76..0a3d0b974cb 100644 --- a/intern/cycles/kernel/osl/CMakeLists.txt +++ b/intern/cycles/kernel/osl/CMakeLists.txt @@ -25,9 +25,13 @@ set(HEADER_SRC osl_shader.h ) +set(LIB + cycles_render +) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${RTTI_DISABLE_FLAGS}") include_directories(${INC}) include_directories(SYSTEM ${INC_SYS}) -cycles_add_library(cycles_kernel_osl ${SRC} ${HEADER_SRC}) +cycles_add_library(cycles_kernel_osl "${LIB}" ${SRC} ${HEADER_SRC}) diff --git a/intern/cycles/render/CMakeLists.txt b/intern/cycles/render/CMakeLists.txt index b7c53f17c3d..140fcb206dc 100644 --- a/intern/cycles/render/CMakeLists.txt +++ b/intern/cycles/render/CMakeLists.txt @@ -73,6 +73,16 @@ set(SRC_HEADERS tile.h ) +set(LIB + cycles_bvh +) + +if(WITH_CYCLES_OSL) + list(APPEND LIB + cycles_kernel_osl + ) +endif() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${RTTI_DISABLE_FLAGS}") include_directories(${INC}) @@ -80,4 +90,4 @@ include_directories(SYSTEM ${INC_SYS}) add_definitions(${GL_DEFINITIONS}) -cycles_add_library(cycles_render ${SRC} ${SRC_HEADERS}) +cycles_add_library(cycles_render "${LIB}" ${SRC} ${SRC_HEADERS}) diff --git a/intern/cycles/render/session.cpp b/intern/cycles/render/session.cpp index e9274fbf49e..e88d960d9d2 100644 --- a/intern/cycles/render/session.cpp +++ b/intern/cycles/render/session.cpp @@ -1131,6 +1131,12 @@ void Session::collect_statistics(RenderStats *render_stats) int Session::get_max_closure_count() { + if (scene->shader_manager->use_osl()) { + /* OSL always needs the maximum as we can't predict the + * number of closures a shader might generate. */ + return MAX_CLOSURE; + } + int max_closures = 0; for(int i = 0; i < scene->shaders.size(); i++) { int num_closures = scene->shaders[i]->graph->get_num_closures(); diff --git a/intern/cycles/render/sobol.cpp b/intern/cycles/render/sobol.cpp index b7d6b07de1c..487599476d4 100644 --- a/intern/cycles/render/sobol.cpp +++ b/intern/cycles/render/sobol.cpp @@ -58,7 +58,11 @@ typedef struct SobolDirectionNumbers { uint m[SOBOL_MAX_NUMBER]; } SobolDirectionNumbers; -static SobolDirectionNumbers SOBOL_NUMBERS[SOBOL_MAX_DIMENSIONS-1] = { +/* Note: this file is skipped by clang-format. */ + +/* Keep simple alignment. */ +/* clang-format off */ +static SobolDirectionNumbers SOBOL_NUMBERS[SOBOL_MAX_DIMENSIONS - 1] = { {2, 1, 0, {1}}, {3, 2, 1, {1, 3}}, {4, 3, 1, {1, 3, 1}}, @@ -21260,6 +21264,7 @@ static SobolDirectionNumbers SOBOL_NUMBERS[SOBOL_MAX_DIMENSIONS-1] = { {21200, 18, 131020, {1, 1, 5, 1, 19, 1, 83, 3, 425, 873, 1943, 3935, 4257, 14587, 11829, 55217, 21963, 39683}}, {21201, 18, 131059, {1, 1, 7, 11, 15, 7, 37, 239, 337, 245, 1557, 3681, 7357, 9639, 27367, 26869, 114603, 86317}} }; +/* clang-format on */ void sobol_generate_direction_vectors(uint vectors[][SOBOL_BITS], int dimensions) { diff --git a/intern/cycles/subd/CMakeLists.txt b/intern/cycles/subd/CMakeLists.txt index 7f952dd43ce..9669bdede7e 100644 --- a/intern/cycles/subd/CMakeLists.txt +++ b/intern/cycles/subd/CMakeLists.txt @@ -21,7 +21,11 @@ set(SRC_HEADERS subd_split.h ) +set(LIB + +) + include_directories(${INC}) include_directories(SYSTEM ${INC_SYS}) -cycles_add_library(cycles_subd ${SRC} ${SRC_HEADERS}) +cycles_add_library(cycles_subd "${LIB}" ${SRC} ${SRC_HEADERS}) diff --git a/intern/cycles/util/CMakeLists.txt b/intern/cycles/util/CMakeLists.txt index 16abed142b2..b8b38a531ea 100644 --- a/intern/cycles/util/CMakeLists.txt +++ b/intern/cycles/util/CMakeLists.txt @@ -27,6 +27,10 @@ set(SRC util_transform.cpp ) +set(LIB + +) + if(WITH_CYCLES_STANDALONE) if (WITH_CYCLES_STANDALONE_GUI) list(APPEND SRC @@ -146,4 +150,4 @@ include_directories(SYSTEM ${INC_SYS}) add_definitions(${GL_DEFINITIONS}) -cycles_add_library(cycles_util ${SRC} ${SRC_HEADERS}) +cycles_add_library(cycles_util "${LIB}" ${SRC} ${SRC_HEADERS}) diff --git a/intern/ghost/CMakeLists.txt b/intern/ghost/CMakeLists.txt index eeec5ab1528..a43906cea85 100644 --- a/intern/ghost/CMakeLists.txt +++ b/intern/ghost/CMakeLists.txt @@ -85,6 +85,9 @@ set(SRC ) set(LIB + bf_intern_glew_mx + bf_intern_string + ${GLEW_LIBRARY} ) if(WITH_GHOST_DEBUG) @@ -195,6 +198,10 @@ elseif(WITH_X11) if(WITH_GHOST_XDND) add_definitions(-DWITH_XDND) + list(APPEND LIB + extern_xdnd + ) + list(APPEND INC ../../extern/xdnd ) diff --git a/intern/ghost/intern/GHOST_Debug.h b/intern/ghost/intern/GHOST_Debug.h index db81a78367d..2351935f16b 100644 --- a/intern/ghost/intern/GHOST_Debug.h +++ b/intern/ghost/intern/GHOST_Debug.h @@ -27,10 +27,10 @@ #ifdef _MSC_VER # ifdef DEBUG -# pragma warning (disable:4786) // suppress stl-MSVC debug info warning - // #define GHOST_DEBUG -# endif // DEBUG -#endif // _MSC_VER + /* Suppress stl-MSVC debug info warning. */ +# pragma warning (disable:4786) +# endif +#endif #ifdef WITH_GHOST_DEBUG # define GHOST_DEBUG // spit ghost events to stdout diff --git a/intern/libmv/CMakeLists.txt b/intern/libmv/CMakeLists.txt index 5adfdbea1af..67bf0de98b0 100644 --- a/intern/libmv/CMakeLists.txt +++ b/intern/libmv/CMakeLists.txt @@ -33,6 +33,10 @@ set(SRC libmv-capi.h ) +set(LIB + +) + if(WITH_LIBMV) add_definitions(${GFLAGS_DEFINES}) add_definitions(${GLOG_DEFINES}) @@ -53,6 +57,11 @@ if(WITH_LIBMV) ${ZLIB_INCLUDE_DIRS} ) + list(APPEND LIB + extern_ceres + extern_glog + ) + add_definitions( -DWITH_LIBMV_GUARDED_ALLOC -DLIBMV_NO_FAST_DETECTOR= @@ -232,4 +241,4 @@ else() ) endif() -blender_add_lib(bf_intern_libmv "${SRC}" "${INC}" "${INC_SYS}" "") +blender_add_lib(bf_intern_libmv "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") diff --git a/intern/libmv/bundle.sh b/intern/libmv/bundle.sh index 98a1e364634..0c28a1c9773 100755 --- a/intern/libmv/bundle.sh +++ b/intern/libmv/bundle.sh @@ -95,10 +95,6 @@ cat > CMakeLists.txt << EOF # # The Original Code is Copyright (C) 2011, Blender Foundation # All rights reserved. -# -# Contributor(s): Blender Foundation, -# Sergey Sharybin -# # ***** END GPL LICENSE BLOCK ***** # NOTE: This file is automatically generated by bundle.sh script @@ -116,6 +112,10 @@ set(SRC libmv-capi.h ) +set(LIB + +) + if(WITH_LIBMV) add_definitions(\${GFLAGS_DEFINES}) add_definitions(\${GLOG_DEFINES}) @@ -136,6 +136,11 @@ if(WITH_LIBMV) \${ZLIB_INCLUDE_DIRS} ) + list(APPEND LIB + extern_ceres + extern_glog + ) + add_definitions( -DWITH_LIBMV_GUARDED_ALLOC -DLIBMV_NO_FAST_DETECTOR= @@ -184,5 +189,5 @@ else() ) endif() -blender_add_lib(bf_intern_libmv "\${SRC}" "\${INC}" "\${INC_SYS}" "") +blender_add_lib(bf_intern_libmv "\${SRC}" "\${INC}" "\${INC_SYS}" "\${LIB}") EOF @@ -31,6 +31,12 @@ if "%BUILD_UPDATE%" == "1" ( goto EOF ) + +if "%FORMAT%" == "1" ( + call "%BLENDER_DIR%\build_files\windows\format.cmd" + goto EOF +) + call "%BLENDER_DIR%\build_files\windows\detect_architecture.cmd" if "%BUILD_VS_YEAR%" == "" ( diff --git a/release/scripts/modules/rna_prop_ui.py b/release/scripts/modules/rna_prop_ui.py index 88c3f37fbaf..d01e8911040 100644 --- a/release/scripts/modules/rna_prop_ui.py +++ b/release/scripts/modules/rna_prop_ui.py @@ -39,8 +39,13 @@ def rna_idprop_ui_del(item): pass +def rna_idprop_quote_path(prop): + return "[\"%s\"]" % prop.replace("\"", "\\\"") + + def rna_idprop_ui_prop_update(item, prop): - prop_rna = item.path_resolve("[\"%s\"]" % prop.replace("\"", "\\\""), False) + prop_path = rna_idprop_quote_path(prop) + prop_rna = item.path_resolve(prop_path, False) if isinstance(prop_rna, bpy.types.bpy_prop): prop_rna.update() @@ -115,6 +120,59 @@ def rna_idprop_ui_prop_default_set(item, prop, value): del rna_ui["default"] +def rna_idprop_ui_create( + item, prop, *, default, + min=0.0, max=1.0, + soft_min=None, soft_max=None, + description=None, + overridable=False, +): + """Create and initialize a custom property with limits, defaults and other settings.""" + + proptype = type(default) + + # Sanitize limits + if proptype is bool: + min = soft_min = False + max = soft_max = True + + if soft_min is None: + soft_min = min + if soft_max is None: + soft_max = max + + # Assign the value + item[prop] = default + + rna_idprop_ui_prop_update(item, prop) + + # Clear the UI settings + rna_ui_group = rna_idprop_ui_get(item, True) + rna_ui_group[prop] = {} + rna_ui = rna_ui_group[prop] + + # Assign limits and default + if proptype in {int, float, bool}: + # The type must be exactly the same + rna_ui["min"] = proptype(min) + rna_ui["soft_min"] = proptype(soft_min) + rna_ui["max"] = proptype(max) + rna_ui["soft_max"] = proptype(soft_max) + + if default: + rna_ui["default"] = default + + # Assign other settings + if description is not None: + rna_ui["description"] = description + + prop_path = rna_idprop_quote_path(prop) + + item.property_overridable_static_set(prop_path, overridable) + + return rna_ui + + def draw(layout, context, context_member, property_type, use_edit=True): def assign_props(prop, val, key): diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py index 4094bb23e50..92ad7cc52a5 100644 --- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py +++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py @@ -817,6 +817,15 @@ def km_uv_editor(params): op_menu("IMAGE_MT_uvs_context_menu", params.context_menu_event), ]) + # Fallback for MMB emulation + if params.use_mouse_emulate_3_button and params.select_mouse == 'LEFTMOUSE': + items.extend([ + ("uv.select_loop", {"type": params.select_mouse, "value": 'DOUBLE_CLICK'}, + {"properties": [("extend", False)]}), + ("uv.select_loop", {"type": params.select_mouse, "value": 'DOUBLE_CLICK', "alt": True}, + {"properties": [("extend", True)]}), + ]) + # 3D cursor if params.cursor_tweak_event: items.extend([ diff --git a/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py b/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py index afaab08da13..4eb13b263c6 100644 --- a/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py +++ b/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py @@ -135,8 +135,9 @@ def _template_items_basic_tools(*, connected=False): op_tool("builtin.rotate", {"type": 'E', "value": 'PRESS'}), op_tool("builtin.scale", {"type": 'R', "value": 'PRESS'}), op_tool("builtin.scale_cage", {"type": 'R', "value": 'PRESS', "shift": True}), - op_tool("builtin.transform", {"type": 'T', "value": 'PRESS'}), + op_tool("builtin.annotate", {"type": 'D', "value": 'PRESS'}), op_tool("builtin.measure", {"type": 'M', "value": 'PRESS'}), + op_tool("builtin.cursor", {"type": 'C', "value": 'PRESS'}), ] def _template_items_tool_select(params, operator, cursor_operator): @@ -183,7 +184,6 @@ def km_window(params): items.extend([ - ("wm.doc_view_manual_ui_context", {"type": 'F1', "value": 'PRESS'}, None), op_panel("TOPBAR_PT_name", {"type": 'RET', "value": 'PRESS'}, [("keep_open", False)]), ("wm.search_menu", {"type": 'TAB', "value": 'PRESS'}, None), @@ -197,7 +197,6 @@ def km_window(params): # Quick menu and toolbar op_menu("SCREEN_MT_user_menu", {"type": 'TAB', "value": 'PRESS', "shift": True}), - op_menu("SCREEN_MT_user_menu", {"type": 'F3', "value": 'PRESS'}), # NDOF settings op_menu("USERPREF_MT_ndof_settings", {"type": 'NDOF_BUTTON_MENU', "value": 'PRESS'}), @@ -359,7 +358,8 @@ def km_view2d_buttons_list(params): ("view2d.scroller_activate", {"type": 'LEFTMOUSE', "value": 'PRESS'}, None), ("view2d.scroller_activate", {"type": 'MIDDLEMOUSE', "value": 'PRESS'}, None), # Pan scroll - ("view2d.pan", {"type": 'MIDDLEMOUSE', "value": 'PRESS'}, None), + ("view2d.pan", {"type": 'LEFTMOUSE', "value": 'PRESS', "alt": True}, None), + ("view2d.pan", {"type": 'MIDDLEMOUSE', "value": 'PRESS', "alt": True}, None), ("view2d.pan", {"type": 'TRACKPADPAN', "value": 'ANY'}, None), ("view2d.scroll_down", {"type": 'WHEELDOWNMOUSE', "value": 'PRESS'}, None), ("view2d.scroll_up", {"type": 'WHEELUPMOUSE', "value": 'PRESS'}, None), @@ -368,7 +368,7 @@ def km_view2d_buttons_list(params): ("view2d.scroll_up", {"type": 'PAGE_UP', "value": 'PRESS'}, {"properties": [("page", True)]}), # Zoom - ("view2d.zoom", {"type": 'MIDDLEMOUSE', "value": 'PRESS', "ctrl": True}, None), + ("view2d.zoom", {"type": 'RIGHTMOUSE', "value": 'PRESS', "alt": True}, None), ("view2d.zoom", {"type": 'TRACKPADZOOM', "value": 'ANY'}, None), ("view2d.zoom", {"type": 'TRACKPADPAN', "value": 'ANY', "ctrl": True}, None), ("view2d.zoom_out", {"type": 'NUMPAD_MINUS', "value": 'PRESS'}, None), @@ -482,7 +482,6 @@ def km_outliner(params): ("anim.keyframe_delete", {"type": 'S', "value": 'PRESS', "alt": True}, None), ("outliner.drivers_add_selected", {"type": 'D', "value": 'PRESS', "ctrl": True}, None), ("outliner.drivers_delete_selected", {"type": 'D', "value": 'PRESS', "ctrl": True, "alt": True}, None), - ("outliner.collection_new", {"type": 'C', "value": 'PRESS'}, None), ("outliner.collection_delete", {"type": 'BACK_SPACE', "value": 'PRESS'}, None), ("outliner.collection_delete", {"type": 'DEL', "value": 'PRESS'}, None), ("outliner.object_operation", {"type": 'BACK_SPACE', "value": 'PRESS'}, {"properties": [("type", 'DELETE')]}), @@ -537,7 +536,11 @@ def km_uv_editor(params): op_menu("IMAGE_MT_uvs_context_menu", {"type": 'RIGHTMOUSE', "value": 'PRESS'}), # Tools op_tool("builtin.select_box", {"type": 'Q', "value": 'PRESS'}), - op_tool("builtin.transform", {"type": 'T', "value": 'PRESS'}), + op_tool("builtin.transform", {"type": 'W', "value": 'PRESS'}), + op_tool("builtin.transform", {"type": 'E', "value": 'PRESS'}), + op_tool("builtin.transform", {"type": 'R', "value": 'PRESS'}), + op_tool("builtin.cursor", {"type": 'C', "value": 'PRESS'}), + op_tool("builtin.annotate", {"type": 'D', "value": 'PRESS'}), ]) return keymap @@ -585,6 +588,8 @@ def km_view3d_generic(_params): ) items.extend([ + ("view3d.toolshelf", {"type": 'LEFT_BRACKET', "value": 'PRESS', "ctrl": True}, None), + ("view3d.properties", {"type": 'RIGHT_BRACKET', "value": 'PRESS', "ctrl": True}, None), ]) return keymap @@ -621,10 +626,6 @@ def km_view3d(params): {"properties": [("delta", 1)]}), ("view3d.zoom", {"type": 'NUMPAD_MINUS', "value": 'PRESS'}, {"properties": [("delta", -1)]}), - ("view3d.zoom", {"type": 'EQUAL', "value": 'PRESS', "ctrl": True}, - {"properties": [("delta", 1)]}), - ("view3d.zoom", {"type": 'MINUS', "value": 'PRESS', "ctrl": True}, - {"properties": [("delta", -1)]}), ("view3d.zoom", {"type": 'WHEELINMOUSE', "value": 'PRESS'}, {"properties": [("delta", 1)]}), ("view3d.zoom", {"type": 'WHEELOUTMOUSE', "value": 'PRESS'}, @@ -633,64 +634,26 @@ def km_view3d(params): {"properties": [("delta", 1)]}), ("view3d.dolly", {"type": 'NUMPAD_MINUS', "value": 'PRESS', "shift": True}, {"properties": [("delta", -1)]}), - ("view3d.dolly", {"type": 'EQUAL', "value": 'PRESS', "shift": True, "ctrl": True}, - {"properties": [("delta", 1)]}), - ("view3d.dolly", {"type": 'MINUS', "value": 'PRESS', "shift": True, "ctrl": True}, - {"properties": [("delta", -1)]}), ("view3d.view_all", {"type": 'A', "value": 'PRESS'}, {"properties": [("center", False)]}), ("view3d.view_all", {"type": 'A', "value": 'PRESS', "shift": True}, {"properties": [("use_all_regions", True), ("center", False)]}), # Numpad views. - ("view3d.view_camera", {"type": 'NUMPAD_0', "value": 'PRESS'}, None), - ("view3d.view_axis", {"type": 'NUMPAD_1', "value": 'PRESS'}, + ("view3d.view_camera", {"type": 'F4', "value": 'PRESS'}, None), + ("view3d.view_axis", {"type": 'F1', "value": 'PRESS'}, {"properties": [("type", 'FRONT')]}), - ("view3d.view_orbit", {"type": 'NUMPAD_2', "value": 'PRESS'}, - {"properties": [("type", 'ORBITDOWN')]}), - ("view3d.view_axis", {"type": 'NUMPAD_3', "value": 'PRESS'}, + ("view3d.view_axis", {"type": 'F2', "value": 'PRESS'}, {"properties": [("type", 'RIGHT')]}), - ("view3d.view_orbit", {"type": 'NUMPAD_4', "value": 'PRESS'}, - {"properties": [("type", 'ORBITLEFT')]}), - ("view3d.view_persportho", {"type": 'NUMPAD_5', "value": 'PRESS'}, None), - ("view3d.view_orbit", {"type": 'NUMPAD_6', "value": 'PRESS'}, - {"properties": [("type", 'ORBITRIGHT')]}), - ("view3d.view_axis", {"type": 'NUMPAD_7', "value": 'PRESS'}, + ("view3d.view_axis", {"type": 'F3', "value": 'PRESS'}, {"properties": [("type", 'TOP')]}), - ("view3d.view_orbit", {"type": 'NUMPAD_8', "value": 'PRESS'}, - {"properties": [("type", 'ORBITUP')]}), - ("view3d.view_axis", {"type": 'NUMPAD_1', "value": 'PRESS', "ctrl": True}, + ("view3d.view_axis", {"type": 'F1', "value": 'PRESS', "ctrl": True}, {"properties": [("type", 'BACK')]}), - ("view3d.view_axis", {"type": 'NUMPAD_3', "value": 'PRESS', "ctrl": True}, + ("view3d.view_axis", {"type": 'F2', "value": 'PRESS', "ctrl": True}, {"properties": [("type", 'LEFT')]}), - ("view3d.view_axis", {"type": 'NUMPAD_7', "value": 'PRESS', "ctrl": True}, + ("view3d.view_axis", {"type": 'F3', "value": 'PRESS', "ctrl": True}, {"properties": [("type", 'BOTTOM')]}), - ("view3d.view_pan", {"type": 'NUMPAD_2', "value": 'PRESS', "ctrl": True}, - {"properties": [("type", 'PANDOWN')]}), - ("view3d.view_pan", {"type": 'NUMPAD_4', "value": 'PRESS', "ctrl": True}, - {"properties": [("type", 'PANLEFT')]}), - ("view3d.view_pan", {"type": 'NUMPAD_6', "value": 'PRESS', "ctrl": True}, - {"properties": [("type", 'PANRIGHT')]}), - ("view3d.view_pan", {"type": 'NUMPAD_8', "value": 'PRESS', "ctrl": True}, - {"properties": [("type", 'PANUP')]}), - ("view3d.view_roll", {"type": 'NUMPAD_4', "value": 'PRESS', "shift": True}, - {"properties": [("type", 'LEFT')]}), - ("view3d.view_roll", {"type": 'NUMPAD_6', "value": 'PRESS', "shift": True}, - {"properties": [("type", 'RIGHT')]}), - ("view3d.view_orbit", {"type": 'NUMPAD_9', "value": 'PRESS'}, + ("view3d.view_orbit", {"type": 'F5', "value": 'PRESS'}, {"properties": [("angle", 3.1415927), ("type", 'ORBITRIGHT')]}), - ("view3d.view_axis", {"type": 'NUMPAD_1', "value": 'PRESS', "shift": True}, - {"properties": [("type", 'FRONT'), ("align_active", True)]}), - ("view3d.view_axis", {"type": 'NUMPAD_3', "value": 'PRESS', "shift": True}, - {"properties": [("type", 'RIGHT'), ("align_active", True)]}), - ("view3d.view_axis", {"type": 'NUMPAD_7', "value": 'PRESS', "shift": True}, - {"properties": [("type", 'TOP'), ("align_active", True)]}), - ("view3d.view_axis", {"type": 'NUMPAD_1', "value": 'PRESS', "shift": True, "ctrl": True}, - {"properties": [("type", 'BACK'), ("align_active", True)]}), - ("view3d.view_axis", {"type": 'NUMPAD_3', "value": 'PRESS', "shift": True, "ctrl": True}, - {"properties": [("type", 'LEFT'), ("align_active", True)]}), - ("view3d.view_axis", {"type": 'NUMPAD_7', "value": 'PRESS', "shift": True, "ctrl": True}, - {"properties": [("type", 'BOTTOM'), ("align_active", True)]}), - ("view3d.view_center_pick", {"type": 'MIDDLEMOUSE', "value": 'CLICK', "alt": True}, None), # NDOF ("view3d.ndof_orbit_zoom", {"type": 'NDOF_MOTION', "value": 'ANY'}, None), ("view3d.ndof_orbit", {"type": 'NDOF_MOTION', "value": 'ANY', "ctrl": True}, None), @@ -785,8 +748,8 @@ def km_mask_editing(params): {"properties": [("mode", 'ADD')]}), ("mask.select_lasso", {"type": params.action_tweak, "value": 'ANY', "shift": True, "ctrl": True, "alt": True}, {"properties": [("mode", 'SUB')]}), - ("mask.select_more", {"type": 'NUMPAD_PLUS', "value": 'PRESS', "ctrl": True}, None), - ("mask.select_less", {"type": 'NUMPAD_MINUS', "value": 'PRESS', "ctrl": True}, None), + ("mask.select_more", {"type": 'UP_ARROW', "value": 'PRESS'}, None), + ("mask.select_less", {"type": 'DOWN_ARROW', "value": 'PRESS'}, None), ("mask.hide_view_clear", {"type": 'H', "value": 'PRESS', "alt": True}, None), ("mask.hide_view_set", {"type": 'H', "value": 'PRESS', "ctrl": True}, {"properties": [("unselected", False)]}), @@ -928,7 +891,7 @@ def km_graph_editor(params): ("graph.view_all", {"type": 'A', "value": 'PRESS'}, None), ("graph.view_all", {"type": 'NDOF_BUTTON_FIT', "value": 'PRESS'}, None), ("graph.view_selected", {"type": 'F', "value": 'PRESS'}, None), - ("graph.view_frame", {"type": 'NUMPAD_0', "value": 'PRESS'}, None), + ("graph.view_frame", {"type": 'A', "value": 'PRESS', "shift": True}, None), ("anim.channels_editable_toggle", {"type": 'TAB', "value": 'PRESS'}, None), ("transform.translate", {"type": 'W', "value": 'PRESS'}, None), ("transform.translate", {"type": 'EVT_TWEAK_L', "value": 'ANY'}, None), @@ -987,25 +950,25 @@ def km_image(params): ("image.view_zoom", {"type": 'TRACKPADZOOM', "value": 'ANY'}, None), ("image.view_zoom", {"type": 'TRACKPADPAN', "value": 'ANY', "ctrl": True}, None), ("image.view_zoom_border", {"type": 'Z', "value": 'PRESS'}, None), - ("image.view_zoom_ratio", {"type": 'NUMPAD_8', "value": 'PRESS', "ctrl": True}, + ("image.view_zoom_ratio", {"type": 'F4', "value": 'PRESS', "ctrl": True}, {"properties": [("ratio", 8.0)]}), - ("image.view_zoom_ratio", {"type": 'NUMPAD_4', "value": 'PRESS', "ctrl": True}, + ("image.view_zoom_ratio", {"type": 'F3', "value": 'PRESS', "ctrl": True}, {"properties": [("ratio", 4.0)]}), - ("image.view_zoom_ratio", {"type": 'NUMPAD_2', "value": 'PRESS', "ctrl": True}, + ("image.view_zoom_ratio", {"type": 'F2', "value": 'PRESS', "ctrl": True}, {"properties": [("ratio", 2.0)]}), - ("image.view_zoom_ratio", {"type": 'NUMPAD_8', "value": 'PRESS', "shift": True}, + ("image.view_zoom_ratio", {"type": 'F4', "value": 'PRESS', "shift": True}, {"properties": [("ratio", 8.0)]}), - ("image.view_zoom_ratio", {"type": 'NUMPAD_4', "value": 'PRESS', "shift": True}, + ("image.view_zoom_ratio", {"type": 'F3', "value": 'PRESS', "shift": True}, {"properties": [("ratio", 4.0)]}), - ("image.view_zoom_ratio", {"type": 'NUMPAD_2', "value": 'PRESS', "shift": True}, + ("image.view_zoom_ratio", {"type": 'F2', "value": 'PRESS', "shift": True}, {"properties": [("ratio", 2.0)]}), - ("image.view_zoom_ratio", {"type": 'NUMPAD_1', "value": 'PRESS'}, + ("image.view_zoom_ratio", {"type": 'F1', "value": 'PRESS'}, {"properties": [("ratio", 1.0)]}), - ("image.view_zoom_ratio", {"type": 'NUMPAD_2', "value": 'PRESS'}, + ("image.view_zoom_ratio", {"type": 'F2', "value": 'PRESS'}, {"properties": [("ratio", 0.5)]}), - ("image.view_zoom_ratio", {"type": 'NUMPAD_4', "value": 'PRESS'}, + ("image.view_zoom_ratio", {"type": 'F3', "value": 'PRESS'}, {"properties": [("ratio", 0.25)]}), - ("image.view_zoom_ratio", {"type": 'NUMPAD_8', "value": 'PRESS'}, + ("image.view_zoom_ratio", {"type": 'F4', "value": 'PRESS'}, {"properties": [("ratio", 0.125)]}), ("image.change_frame", {"type": 'LEFTMOUSE', "value": 'PRESS'}, None), ("image.sample", {"type": 'LEFTMOUSE', "value": 'PRESS'}, None), @@ -1018,6 +981,13 @@ def km_image(params): ("object.mode_set", {"type": 'ONE', "value": 'PRESS'}, {"properties": [("mode", 'OBJECT')]}), op_menu_pie("IMAGE_MT_pivot_pie", {"type": 'PERIOD', "value": 'PRESS'}), + # Tools + op_tool("builtin.select_box", {"type": 'Q', "value": 'PRESS'}), + op_tool("builtin.transform", {"type": 'W', "value": 'PRESS'}), + op_tool("builtin.transform", {"type": 'E', "value": 'PRESS'}), + op_tool("builtin.transform", {"type": 'R', "value": 'PRESS'}), + op_tool("builtin.cursor", {"type": 'C', "value": 'PRESS'}), + op_tool("builtin.annotate", {"type": 'D', "value": 'PRESS'}), ]) @@ -1360,9 +1330,9 @@ def km_dopesheet(params): {"properties": [("mode", 'MARKERS_COLUMN')]}), ("action.select_column", {"type": 'K', "value": 'PRESS', "alt": True}, {"properties": [("mode", 'MARKERS_BETWEEN')]}), - ("action.select_more", {"type": 'NUMPAD_PLUS', "value": 'PRESS', "ctrl": True}, None), - ("action.select_less", {"type": 'NUMPAD_MINUS', "value": 'PRESS', "ctrl": True}, None), - ("action.select_linked", {"type": 'L', "value": 'PRESS'}, None), + ("action.select_more", {"type": 'UP_ARROW', "value": 'PRESS', "ctrl": True}, None), + ("action.select_less", {"type": 'DOWN_ARROW', "value": 'PRESS', "ctrl": True}, None), + ("action.select_linked", {"type": 'RIGHT_BRACKET', "value": 'PRESS'}, None), ("action.frame_jump", {"type": 'G', "value": 'PRESS', "ctrl": True}, None), op_menu("DOPESHEET_MT_context_menu", {"type": 'RIGHTMOUSE', "value": 'PRESS'}), op_menu("DOPESHEET_MT_delete", {"type": 'BACK_SPACE', "value": 'PRESS'}), @@ -1768,8 +1738,6 @@ def km_sequencer(params): ("sequencer.select_linked", {"type": 'L', "value": 'PRESS', "ctrl": True}, None), ("sequencer.select_box", {"type": 'B', "value": 'PRESS'}, None), ("sequencer.select_grouped", {"type": 'G', "value": 'PRESS', "shift": True}, None), - op_menu("SEQUENCER_MT_add", {"type": 'A', "value": 'PRESS', "shift": True}), - op_menu("SEQUENCER_MT_change", {"type": 'C', "value": 'PRESS'}), ("sequencer.slip", {"type": 'S', "value": 'PRESS'}, None), ("wm.context_set_int", {"type": 'O', "value": 'PRESS'}, {"properties": [("data_path", 'scene.sequence_editor.overlay_frame'), ("value", 0)]}), @@ -2215,29 +2183,10 @@ def _grease_pencil_selection(params): return [ # Select all ("gpencil.select_box", {"type": 'A', "value": 'PRESS', "ctrl": True}, None), - # Circle select - ("gpencil.select_circle", {"type": 'C', "value": 'PRESS'}, None), - # Box select - ("gpencil.select_box", {"type": 'B', "value": 'PRESS'}, None), - # Lasso select - ("gpencil.select_lasso", {"type": params.action_tweak, "value": 'ANY', "ctrl": True}, - {"properties": [("mode", 'ADD')]}), - ("gpencil.select_lasso", {"type": params.action_tweak, "value": 'ANY', "shift": True, "ctrl": True}, - {"properties": [("mode", 'SUB')]}), - ("gpencil.select_lasso", {"type": params.action_tweak, "value": 'ANY', "ctrl": True, "alt": True}, - {"properties": [("mode", 'ADD')]}), - ("gpencil.select_lasso", {"type": params.action_tweak, "value": 'ANY', "shift": True, "ctrl": True, "alt": True}, - {"properties": [("mode", 'SUB')]}), ("gpencil.select", {"type": 'LEFTMOUSE', "value": 'PRESS', "shift": True}, {"properties": [("extend", True), ("toggle", True)]}), - # Whole stroke select - ("gpencil.select", {"type": 'LEFTMOUSE', "value": 'PRESS', "alt": True}, - {"properties": [("entire_strokes", True)]}), - ("gpencil.select", {"type": 'LEFTMOUSE', "value": 'PRESS', "shift": True, "alt": True}, - {"properties": [("extend", True), ("entire_strokes", True)]}), # Select linked ("gpencil.select_linked", {"type": 'RIGHT_BRACKET', "value": 'PRESS'}, None), - ("gpencil.select_linked", {"type": 'RIGHT_BRACKET', "value": 'PRESS', "ctrl": True}, None), # Select alternate ("gpencil.select_alternate", {"type": 'L', "value": 'PRESS', "shift": True}, None), # Select grouped @@ -2391,12 +2340,10 @@ def km_grease_pencil_stroke_paint_draw_brush(params): ("gpencil.draw", {"type": 'L', "value": 'PRESS', "alt": True}, None), ("gpencil.draw", {"type": 'L', "value": 'PRESS', "ctrl": True}, None), ("gpencil.draw", {"type": 'V', "value": 'PRESS'}, None), - # Mirror or flip - ("gpencil.draw", {"type": 'M', "value": 'PRESS'}, None), # Mode - ("gpencil.draw", {"type": 'C', "value": 'PRESS'}, None), + ("gpencil.draw", {"type": 'P', "value": 'PRESS'}, None), # Set reference point - ("gpencil.draw", {"type": 'C', "value": 'PRESS', "alt": True}, None), + ("gpencil.draw", {"type": 'P', "value": 'PRESS', "alt": True}, None), # Tablet Mappings for Drawing ------------------ */ # For now, only support direct drawing using the eraser, as most users using a tablet # may still want to use that as their primary pointing device! @@ -2833,8 +2780,7 @@ def km_image_paint(params): ("paint.image_paint", {"type": 'LEFTMOUSE', "value": 'PRESS', "ctrl": True}, {"properties": [("mode", 'INVERT')]}), ("paint.brush_colors_flip", {"type": 'X', "value": 'PRESS'}, None), - ("paint.grab_clone", {"type": 'RIGHTMOUSE', "value": 'PRESS'}, None), - ("paint.sample_color", {"type": 'C', "value": 'PRESS'}, None), + ("paint.grab_clone", {"type": 'MIDDLEMOUSE', "value": 'PRESS'}, None), ("brush.scale_size", {"type": 'LEFT_BRACKET', "value": 'PRESS'}, {"properties": [("scalar", 0.9)]}), ("brush.scale_size", {"type": 'RIGHT_BRACKET', "value": 'PRESS'}, @@ -2876,8 +2822,6 @@ def km_vertex_paint(params): items.extend([ ("paint.vertex_paint", {"type": 'LEFTMOUSE', "value": 'PRESS'}, None), ("paint.brush_colors_flip", {"type": 'X', "value": 'PRESS'}, None), - ("paint.sample_color", {"type": 'C', "value": 'PRESS'}, None), - #("paint.vertex_color_set", {"type": 'K', "value": 'PRESS', "shift": True}, None), ("brush.scale_size", {"type": 'LEFT_BRACKET', "value": 'PRESS'}, {"properties": [("scalar", 0.9)]}), ("brush.scale_size", {"type": 'RIGHT_BRACKET', "value": 'PRESS'}, @@ -3060,7 +3004,9 @@ def km_mesh(params): ("mesh.loop_select", {"type": 'LEFTMOUSE', "value": 'DOUBLE_CLICK'}, {"properties": [("extend", False), ("deselect", False), ("toggle", False)]}), ("mesh.loop_select", {"type": 'LEFTMOUSE', "value": 'DOUBLE_CLICK', "shift": True}, - {"properties": [("extend", False), ("deselect", False), ("toggle", True)]}), + {"properties": [("extend", True), ("deselect", False), ("toggle", False)]}), + ("mesh.loop_select", {"type": 'LEFTMOUSE', "value": 'DOUBLE_CLICK', "ctrl": True}, + {"properties": [("extend", False), ("deselect", True), ("toggle", False)]}), # Selection ("mesh.select_all", {"type": 'A', "value": 'PRESS', "ctrl": True}, {"properties": [("action", 'SELECT')]}), ("mesh.select_all", {"type": 'A', "value": 'PRESS', "ctrl": True, "shift": True}, {"properties": [("action", 'DESELECT')]}), @@ -3388,6 +3334,37 @@ def km_object_non_modal(params): # Modal Maps and Gizmos +def km_knife_tool_modal_map(_params): + items = [] + keymap = ( + "Knife Tool Modal Map", + {"space_type": 'EMPTY', "region_type": 'WINDOW', "modal": True}, + {"items": items}, + ) + + items.extend([ + ("CANCEL", {"type": 'ESC', "value": 'PRESS', "any": True}, None), + ("PANNING", {"type": 'LEFTMOUSE', "value": 'PRESS', "alt": True}, None), + ("ADD_CUT", {"type": 'LEFTMOUSE', "value": 'PRESS'}, None), + ("CONFIRM", {"type": 'RET', "value": 'PRESS', "any": True}, None), + ("CONFIRM", {"type": 'NUMPAD_ENTER', "value": 'PRESS', "any": True}, None), + ("CONFIRM", {"type": 'SPACE', "value": 'PRESS', "any": True}, None), + ("NEW_CUT", {"type": 'E', "value": 'PRESS'}, None), + ("SNAP_MIDPOINTS_ON", {"type": 'LEFT_CTRL', "value": 'PRESS', "any": True}, None), + ("SNAP_MIDPOINTS_OFF", {"type": 'LEFT_CTRL', "value": 'RELEASE', "any": True}, None), + ("SNAP_MIDPOINTS_ON", {"type": 'RIGHT_CTRL', "value": 'PRESS', "any": True}, None), + ("SNAP_MIDPOINTS_OFF", {"type": 'RIGHT_CTRL', "value": 'RELEASE', "any": True}, None), + ("IGNORE_SNAP_ON", {"type": 'LEFT_SHIFT', "value": 'PRESS', "any": True}, None), + ("IGNORE_SNAP_OFF", {"type": 'LEFT_SHIFT', "value": 'RELEASE', "any": True}, None), + ("IGNORE_SNAP_ON", {"type": 'RIGHT_SHIFT', "value": 'PRESS', "any": True}, None), + ("IGNORE_SNAP_OFF", {"type": 'RIGHT_SHIFT', "value": 'RELEASE', "any": True}, None), + ("ANGLE_SNAP_TOGGLE", {"type": 'C', "value": 'PRESS'}, None), + ("CUT_THROUGH_TOGGLE", {"type": 'X', "value": 'PRESS'}, None), + ]) + + return keymap + + def km_eyedropper_modal_map(_params): items = [] keymap = ( @@ -3588,6 +3565,7 @@ def generate_keymaps(params=None): km_object_non_modal(params), # Modal maps. + km_knife_tool_modal_map(params), km_eyedropper_modal_map(params), km_eyedropper_colorramp_pointsampling_map(params), km_transform_modal_map(params), diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py index de811d42e00..5976e036fab 100644 --- a/release/scripts/startup/bl_operators/wm.py +++ b/release/scripts/startup/bl_operators/wm.py @@ -1322,8 +1322,7 @@ class WM_OT_properties_add(Operator): def execute(self, context): from rna_prop_ui import ( - rna_idprop_ui_prop_get, - rna_idprop_ui_prop_update, + rna_idprop_ui_create, ) data_path = self.data_path @@ -1344,13 +1343,7 @@ class WM_OT_properties_add(Operator): *type(item).bl_rna.properties.keys(), }) - item[prop] = 1.0 - rna_idprop_ui_prop_update(item, prop) - - # not essential, but without this we get [#31661] - prop_ui = rna_idprop_ui_prop_get(item, prop) - prop_ui["soft_min"] = prop_ui["min"] = 0.0 - prop_ui["soft_max"] = prop_ui["max"] = 1.0 + rna_idprop_ui_create(item, prop, default=1.0) return {'FINISHED'} diff --git a/release/scripts/startup/bl_ui/properties_constraint.py b/release/scripts/startup/bl_ui/properties_constraint.py index bf34e767f3a..0fc67d4aed6 100644 --- a/release/scripts/startup/bl_ui/properties_constraint.py +++ b/release/scripts/startup/bl_ui/properties_constraint.py @@ -794,9 +794,9 @@ class ConstraintButtonsPanel: col = layout.column() col.label(text="Chain Scaling:") - col.prop(con, "use_y_stretch") col.prop(con, "use_curve_radius") + layout.prop(con, "y_scale_mode") layout.prop(con, "xz_scale_mode") if con.xz_scale_mode == 'VOLUME_PRESERVE': diff --git a/release/scripts/startup/bl_ui/properties_data_gpencil.py b/release/scripts/startup/bl_ui/properties_data_gpencil.py index 0348b2452da..5d11373b2e9 100644 --- a/release/scripts/startup/bl_ui/properties_data_gpencil.py +++ b/release/scripts/startup/bl_ui/properties_data_gpencil.py @@ -342,8 +342,8 @@ class GPENCIL_UL_vgroups(UIList): vgroup = item if self.layout_type in {'DEFAULT', 'COMPACT'}: layout.prop(vgroup, "name", text="", emboss=False, icon_value=icon) - # icon = 'LOCKED' if vgroup.lock_weight else 'UNLOCKED' - # layout.prop(vgroup, "lock_weight", text="", icon=icon, emboss=False) + icon = 'LOCKED' if vgroup.lock_weight else 'UNLOCKED' + layout.prop(vgroup, "lock_weight", text="", icon=icon, emboss=False) elif self.layout_type == 'GRID': layout.alignment = 'CENTER' layout.label(text="", icon_value=icon) diff --git a/release/scripts/startup/bl_ui/properties_material_gpencil.py b/release/scripts/startup/bl_ui/properties_material_gpencil.py index 24ba786f7af..e982bea9438 100644 --- a/release/scripts/startup/bl_ui/properties_material_gpencil.py +++ b/release/scripts/startup/bl_ui/properties_material_gpencil.py @@ -142,12 +142,17 @@ class MATERIAL_PT_gpencil_strokecolor(GPMaterialButtonsPanel, Panel): row.enabled = not gpcolor.lock col = row.column(align=True) col.template_ID(gpcolor, "stroke_image", open="image.open") - col.prop(gpcolor, "pixel_size", text="UV Factor") + if gpcolor.mode == 'LINE': + col.prop(gpcolor, "pixel_size", text="UV Factor") + col.prop(gpcolor, "use_stroke_pattern", text="Use As Pattern") if gpcolor.stroke_style == 'SOLID' or gpcolor.use_stroke_pattern is True: col.prop(gpcolor, "color", text="Color") + if gpcolor.mode in {'DOTS', 'BOX'}: + col.prop(gpcolor, "use_follow_path", text="Follow Drawing Path") + class MATERIAL_PT_gpencil_fillcolor(GPMaterialButtonsPanel, Panel): bl_label = "Fill" diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py index ed31a847933..71d6771c487 100644 --- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py +++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py @@ -957,7 +957,7 @@ class _defs_vertex_paint: if context is None: return True ob = context.active_object - return (ob.type == 'MESH' and + return (ob and ob.type == 'MESH' and (ob.data.use_paint_mask or ob.data.use_paint_mask_vertex)) @@ -979,7 +979,7 @@ class _defs_texture_paint: if context is None: return True ob = context.active_object - return (ob.type == 'MESH' and + return (ob and ob.type == 'MESH' and (ob.data.use_paint_mask)) @staticmethod @@ -1000,7 +1000,7 @@ class _defs_weight_paint: if context is None: return True ob = context.active_object - return (ob.type == 'MESH' and + return (ob and ob.type == 'MESH' and (ob.data.use_paint_mask or ob.data.use_paint_mask_vertex)) diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 4413e4f06eb..06626c67bc9 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -132,17 +132,6 @@ class VIEW3D_HT_header(Header): # Mode & Transform Settings scene = context.scene - # Gizmo popover. - row = layout.row(align=True) - # FIXME: place-holder icon. - row.prop(view, "show_gizmo", text="", toggle=True, icon='EMPTY_DATA') - sub = row.row(align=True) - sub.active = view.show_gizmo - sub.popover( - panel="VIEW3D_PT_gizmo_display", - text="", - ) - # Orientation if object_mode in {'OBJECT', 'EDIT', 'EDIT_GPENCIL'} or has_pose_mode: orient_slot = scene.transform_orientation_slots[0] @@ -268,13 +257,6 @@ class VIEW3D_HT_header(Header): layout.separator_spacer() - # Collection Visibility - layout.popover( - panel="VIEW3D_PT_collections", - icon='GROUP', - text="", - ) - # Viewport Settings layout.popover( panel="VIEW3D_PT_object_type_visibility", @@ -282,6 +264,18 @@ class VIEW3D_HT_header(Header): text="", ) + # Gizmo toggle & popover. + row = layout.row(align=True) + # FIXME: place-holder icon. + row.prop(view, "show_gizmo", text="", toggle=True, icon='EMPTY_DATA') + sub = row.row(align=True) + sub.active = view.show_gizmo + sub.popover( + panel="VIEW3D_PT_gizmo_display", + text="", + ) + + # Overlay toggle & popover. row = layout.row(align=True) row.prop(overlay, "show_overlays", icon='OVERLAY', text="") sub = row.row(align=True) @@ -4094,6 +4088,10 @@ class VIEW3D_MT_weight_gpencil(Menu): def draw(self, context): layout = self.layout + layout.operator("gpencil.vertex_group_normalize_all", text="Normalize All") + layout.operator("gpencil.vertex_group_normalize", text="Normalize") + + layout.separator() layout.operator("gpencil.vertex_group_invert", text="Invert") layout.operator("gpencil.vertex_group_smooth", text="Smooth") @@ -4385,9 +4383,9 @@ class VIEW3D_PT_view3d_cursor(Panel): class VIEW3D_PT_collections(Panel): bl_space_type = 'VIEW_3D' - bl_region_type = 'HEADER' + bl_region_type = 'UI' + bl_category = "View" bl_label = "Collections Visibility" - bl_ui_units_x = 10 def _draw_collection(self, layout, view_layer, collection, index): need_separator = index diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index 17dd35d9fc4..7c1fa0f9663 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -1716,9 +1716,9 @@ class VIEW3D_PT_tools_grease_pencil_brush_option(View3DPanel, Panel): layout.use_property_decorate = False brush = context.tool_settings.gpencil_paint.brush - gp_settings = brush.gpencil_settings if brush is not None: + gp_settings = brush.gpencil_settings col = layout.column(align=True) col.prop(gp_settings, "input_samples") col.separator() @@ -1728,7 +1728,20 @@ class VIEW3D_PT_tools_grease_pencil_brush_option(View3DPanel, Panel): col.prop(gp_settings, "angle", slider=True) col.prop(gp_settings, "angle_factor", text="Factor", slider=True) + + ob = context.object + if ob: + ma = ob.active_material + + if brush.gpencil_settings.material: + ma = brush.gpencil_settings.material + col.separator() + subcol = col.column(align=True) + if ma and ma.grease_pencil.mode != 'DOTS': + subcol.enabled = False + subcol.prop(gp_settings, "gradient_factor", slider=True) + subcol.prop(gp_settings, "gradient_shape") class VIEW3D_PT_tools_grease_pencil_brush_stabilizer(View3DPanel, Panel): diff --git a/source/blender/alembic/CMakeLists.txt b/source/blender/alembic/CMakeLists.txt index e6badc27110..9f94c118492 100644 --- a/source/blender/alembic/CMakeLists.txt +++ b/source/blender/alembic/CMakeLists.txt @@ -73,6 +73,8 @@ set(SRC ) set(LIB + bf_blenkernel + bf_blenlib ) if(WITH_ALEMBIC_HDF5) diff --git a/source/blender/avi/AVI_avi.h b/source/blender/avi/AVI_avi.h index ce1c2ed343b..e4bd0025e7b 100644 --- a/source/blender/avi/AVI_avi.h +++ b/source/blender/avi/AVI_avi.h @@ -156,7 +156,7 @@ typedef enum { AVI_FORMAT_RGB24, /* The most basic of forms, 3 bytes per pixel, 1 per r, g, b */ AVI_FORMAT_RGB32, /* The second most basic of forms, 4 bytes per pixel, 1 per r, g, b, alpha */ AVI_FORMAT_AVI_RGB, /* Same as above, but is in the weird AVI order (bottom to top, left to right) */ - AVI_FORMAT_MJPEG /* Motion-JPEG */ + AVI_FORMAT_MJPEG, /* Motion-JPEG */ } AviFormat; typedef struct _AviStreamRec { @@ -198,7 +198,7 @@ typedef enum { AVI_ERROR_FORMAT, AVI_ERROR_ALLOC, AVI_ERROR_FOUND, - AVI_ERROR_OPTION + AVI_ERROR_OPTION, } AviError; /* belongs to the option-setting function. */ @@ -206,7 +206,7 @@ typedef enum { AVI_OPTION_WIDTH = 0, AVI_OPTION_HEIGHT, AVI_OPTION_QUALITY, - AVI_OPTION_FRAMERATE + AVI_OPTION_FRAMERATE, } AviOption; /* The offsets that will always stay the same in AVI files we diff --git a/source/blender/blenfont/CMakeLists.txt b/source/blender/blenfont/CMakeLists.txt index 25497d1b1c2..78d805398ef 100644 --- a/source/blender/blenfont/CMakeLists.txt +++ b/source/blender/blenfont/CMakeLists.txt @@ -52,6 +52,8 @@ set(SRC ) set(LIB + bf_gpu + bf_intern_guardedalloc ) if(WIN32) diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h index 46938b13ea6..1333a4cac39 100644 --- a/source/blender/blenkernel/BKE_DerivedMesh.h +++ b/source/blender/blenkernel/BKE_DerivedMesh.h @@ -100,7 +100,7 @@ typedef struct DMFlagMat { typedef enum DerivedMeshType { DM_TYPE_CDDM, - DM_TYPE_CCGDM + DM_TYPE_CCGDM, } DerivedMeshType; typedef enum DMForeachFlag { diff --git a/source/blender/blenkernel/BKE_anim.h b/source/blender/blenkernel/BKE_anim.h index 7670d5a04a0..d5bd729cc4e 100644 --- a/source/blender/blenkernel/BKE_anim.h +++ b/source/blender/blenkernel/BKE_anim.h @@ -46,14 +46,6 @@ void animviz_free_motionpath(struct bMotionPath *mpath); struct bMotionPath *animviz_verify_motionpaths(struct ReportList *reports, struct Scene *scene, struct Object *ob, struct bPoseChannel *pchan); -void animviz_get_object_motionpaths(struct Object *ob, ListBase *targets); -void animviz_calc_motionpaths(struct Depsgraph *depsgraph, - struct Main *bmain, - struct Scene *scene, - ListBase *targets, - bool restore, - bool current_frame_only); - /* ---------------------------------------------------- */ /* Curve Paths */ diff --git a/source/blender/blenkernel/BKE_editmesh_bvh.h b/source/blender/blenkernel/BKE_editmesh_bvh.h index 10265ed2a36..420250ab25c 100644 --- a/source/blender/blenkernel/BKE_editmesh_bvh.h +++ b/source/blender/blenkernel/BKE_editmesh_bvh.h @@ -68,7 +68,7 @@ struct BVHTreeOverlap *BKE_bmbvh_overlap(const BMBVHTree *bmtree_a, const BMBVHT enum { BMBVH_RETURN_ORIG = (1 << 0), /* use with 'cos_cage', returns hits in relation to original geometry */ BMBVH_RESPECT_SELECT = (1 << 1), /* restrict to hidden geometry (overrides BMBVH_RESPECT_HIDDEN) */ - BMBVH_RESPECT_HIDDEN = (1 << 2) /* omit hidden geometry */ + BMBVH_RESPECT_HIDDEN = (1 << 2), /* omit hidden geometry */ }; #endif /* __BKE_EDITMESH_BVH_H__ */ diff --git a/source/blender/blenkernel/BKE_fcurve.h b/source/blender/blenkernel/BKE_fcurve.h index e75f3ad2977..6610dbcc91b 100644 --- a/source/blender/blenkernel/BKE_fcurve.h +++ b/source/blender/blenkernel/BKE_fcurve.h @@ -160,7 +160,7 @@ typedef enum eFMI_Action_Types { /* modifier only modifies the values of points (but times stay the same) */ FMI_TYPE_REPLACE_VALUES, /* modifier generates a curve regardless of what came before */ - FMI_TYPE_GENERATE_CURVE + FMI_TYPE_GENERATE_CURVE, } eFMI_Action_Types; /* Flags for the requirements of a FModifier Type */ @@ -273,7 +273,7 @@ typedef enum eFCU_Cycle_Type { /* The cycle repeats identically to the base range. */ FCU_CYCLE_PERFECT, /* The cycle accumulates the change between start and end keys. */ - FCU_CYCLE_OFFSET + FCU_CYCLE_OFFSET, } eFCU_Cycle_Type; eFCU_Cycle_Type BKE_fcurve_get_cycle_type(struct FCurve *fcu); diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index 80b0f9a023f..3f386782346 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -253,7 +253,7 @@ typedef enum eNodeSizePreset { NODE_SIZE_DEFAULT, NODE_SIZE_SMALL, NODE_SIZE_MIDDLE, - NODE_SIZE_LARGE + NODE_SIZE_LARGE, } eNodeSizePreset; struct bNodeTreeExec; diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h index 4a1470797ba..795e9650e58 100644 --- a/source/blender/blenkernel/BKE_object.h +++ b/source/blender/blenkernel/BKE_object.h @@ -331,7 +331,7 @@ typedef enum eObRelationTypes { typedef enum eObjectSet { OB_SET_SELECTED, /* Selected Objects */ OB_SET_VISIBLE, /* Visible Objects */ - OB_SET_ALL /* All Objects */ + OB_SET_ALL, /* All Objects */ } eObjectSet; struct LinkNode *BKE_object_relational_superset( diff --git a/source/blender/blenkernel/BKE_pbvh.h b/source/blender/blenkernel/BKE_pbvh.h index 9be2d645fde..fa779f48e79 100644 --- a/source/blender/blenkernel/BKE_pbvh.h +++ b/source/blender/blenkernel/BKE_pbvh.h @@ -132,7 +132,7 @@ void BKE_pbvh_draw_cb( typedef enum { PBVH_FACES, PBVH_GRIDS, - PBVH_BMESH + PBVH_BMESH, } PBVHType; PBVHType BKE_pbvh_type(const PBVH *bvh); diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h index 72cdaf97ec3..6a3b3cc5d03 100644 --- a/source/blender/blenkernel/BKE_sequencer.h +++ b/source/blender/blenkernel/BKE_sequencer.h @@ -258,7 +258,7 @@ typedef enum { SEQ_STRIPELEM_IBUF, SEQ_STRIPELEM_IBUF_COMP, SEQ_STRIPELEM_IBUF_STARTSTILL, - SEQ_STRIPELEM_IBUF_ENDSTILL + SEQ_STRIPELEM_IBUF_ENDSTILL, } eSeqStripElemIBuf; void BKE_sequencer_cache_destruct(void); diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index 50aa1c3825e..3fe90da7ad4 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -45,7 +45,6 @@ set(INC ../../../intern/iksolver/extern ../../../intern/memutil ../../../intern/mikktspace - ../../../intern/smoke/extern ../../../intern/atomic ../../../intern/clog ../../../intern/libmv @@ -357,12 +356,39 @@ set(SRC ) set(LIB + bf_blenfont + bf_blenlib + bf_blenloader + bf_blentranslation + bf_bmesh + bf_depsgraph + bf_draw + bf_gpencil_modifiers + bf_gpu + bf_ikplugin + bf_imbuf + bf_intern_clog + bf_intern_ghost + bf_intern_guardedalloc + bf_intern_libmv # Uses stub when disabled. + bf_intern_mikktspace + bf_intern_opensubdiv # Uses stub when disabled. + bf_modifiers + bf_nodes + bf_physics + bf_python + bf_python_bmesh + bf_rna + bf_shader_fx ) if(WITH_BINRELOC) list(APPEND INC_SYS ${BINRELOC_INCLUDE_DIRS} ) + list(APPEND LIB + extern_binreloc + ) add_definitions(-DWITH_BINRELOC) endif() @@ -389,6 +415,10 @@ if(WITH_BULLET) list(APPEND INC ../../../intern/rigidbody ) + list(APPEND LIB + bf_intern_rigidbody + extern_bullet + ) add_definitions(-DWITH_BULLET) endif() @@ -483,10 +513,19 @@ if(WITH_MOD_FLUID) list(APPEND INC ../../../intern/elbeem/extern ) + list(APPEND LIB + bf_intern_elbeem + ) add_definitions(-DWITH_MOD_FLUID) endif() if(WITH_MOD_SMOKE) + list(APPEND INC + ../../../intern/smoke/extern + ) + list(APPEND LIB + bf_intern_smoke + ) add_definitions(-DWITH_SMOKE) endif() @@ -508,6 +547,9 @@ if(WITH_LZO) list(APPEND INC_SYS ../../../extern/lzo/minilzo ) + list(APPEND LIB + extern_minilzo + ) endif() add_definitions(-DWITH_LZO) endif() @@ -516,6 +558,9 @@ if(WITH_LZMA) list(APPEND INC_SYS ../../../extern/lzma ) + list(APPEND LIB + extern_lzma + ) add_definitions(-DWITH_LZMA) endif() @@ -546,17 +591,20 @@ if(WITH_ALEMBIC) endif() if(WITH_OPENSUBDIV) - add_definitions(-DWITH_OPENSUBDIV) list(APPEND INC_SYS ${OPENSUBDIV_INCLUDE_DIRS} ) + add_definitions(-DWITH_OPENSUBDIV) endif() if(WITH_OPENVDB) - add_definitions(-DWITH_OPENVDB) list(APPEND INC ../../../intern/openvdb ) + list(APPEND LIB + bf_intern_openvdb + ) + add_definitions(-DWITH_OPENVDB) if(WITH_OPENVDB_BLOSC) add_definitions( diff --git a/source/blender/blenkernel/intern/CCGSubSurf_intern.h b/source/blender/blenkernel/intern/CCGSubSurf_intern.h index 3f3341533b9..8faf95ca508 100644 --- a/source/blender/blenkernel/intern/CCGSubSurf_intern.h +++ b/source/blender/blenkernel/intern/CCGSubSurf_intern.h @@ -99,15 +99,15 @@ struct DerivedMesh; enum { Vert_eEffected = (1 << 0), Vert_eChanged = (1 << 1), - Vert_eSeam = (1 << 2) + Vert_eSeam = (1 << 2), } /*VertFlags*/; enum { - Edge_eEffected = (1 << 0) + Edge_eEffected = (1 << 0), } /*CCGEdgeFlags*/; enum { - Face_eEffected = (1 << 0) + Face_eEffected = (1 << 0), } /*FaceFlags*/; struct CCGVert { diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 6d9be9fb639..02afdfe035b 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -1721,7 +1721,9 @@ static void editbmesh_calc_modifiers( /* set the DerivedMesh to only copy needed data */ CustomData_MeshMasks_update(&mask, &append_mask); - mask = md_datamask->mask; /* CD_MASK_ORCO may have been cleared above */ /* XXX WHAT? ovewrites mask ??? */ + /* XXX WHAT? ovewrites mask ??? */ + /* CD_MASK_ORCO may have been cleared above */ + mask = md_datamask->mask; mask.vmask |= CD_MASK_ORIGINDEX; mask.emask |= CD_MASK_ORIGINDEX; mask.pmask |= CD_MASK_ORIGINDEX; diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index a4ebfec657c..25a657c4745 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -57,11 +57,6 @@ static CLG_LogRef LOG = {"bke.anim"}; -// XXX bad level call... -extern short compare_ak_cfraPtr(void *node, void *data); -extern void agroup_to_keylist(struct AnimData *adt, struct bActionGroup *agrp, struct DLRBT_Tree *keys, int saction_flag); -extern void action_to_keylist(struct AnimData *adt, struct bAction *act, struct DLRBT_Tree *keys, int saction_flag); - /* --------------------- */ /* forward declarations */ @@ -244,293 +239,6 @@ bMotionPath *animviz_verify_motionpaths(ReportList *reports, Scene *scene, Objec return mpath; } -/* ------------------- */ - -/* Motion path needing to be baked (mpt) */ -typedef struct MPathTarget { - struct MPathTarget *next, *prev; - - bMotionPath *mpath; /* motion path in question */ - - DLRBT_Tree keys; /* temp, to know where the keyframes are */ - - /* Original (Source Objects) */ - Object *ob; /* source object */ - bPoseChannel *pchan; /* source posechannel (if applicable) */ - - /* "Evaluated" Copies (these come from the background COW copie - * that provide all the coordinates we want to save off) - */ - Object *ob_eval; /* evaluated object */ -} MPathTarget; - -/* ........ */ - -/* get list of motion paths to be baked for the given object - * - assumes the given list is ready to be used - */ -/* TODO: it would be nice in future to be able to update objects dependent on these bones too? */ -void animviz_get_object_motionpaths(Object *ob, ListBase *targets) -{ - MPathTarget *mpt; - - /* object itself first */ - if ((ob->avs.recalc & ANIMVIZ_RECALC_PATHS) && (ob->mpath)) { - /* new target for object */ - mpt = MEM_callocN(sizeof(MPathTarget), "MPathTarget Ob"); - BLI_addtail(targets, mpt); - - mpt->mpath = ob->mpath; - mpt->ob = ob; - } - - /* bones */ - if ((ob->pose) && (ob->pose->avs.recalc & ANIMVIZ_RECALC_PATHS)) { - bArmature *arm = ob->data; - bPoseChannel *pchan; - - for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) { - if ((pchan->bone) && (arm->layer & pchan->bone->layer) && (pchan->mpath)) { - /* new target for bone */ - mpt = MEM_callocN(sizeof(MPathTarget), "MPathTarget PoseBone"); - BLI_addtail(targets, mpt); - - mpt->mpath = pchan->mpath; - mpt->ob = ob; - mpt->pchan = pchan; - } - } - } -} - -/* ........ */ - -/* update scene for current frame */ -static void motionpaths_calc_update_scene(Main *bmain, - struct Depsgraph *depsgraph) -{ - /* Do all updates - * - if this is too slow, resort to using a more efficient way - * that doesn't force complete update, but for now, this is the - * most accurate way! - * - * TODO(segey): Bring back partial updates, which became impossible - * with the new depsgraph due to unsorted nature of bases. - * - * TODO(sergey): Use evaluation context dedicated to motion paths. - */ - BKE_scene_graph_update_for_newframe(depsgraph, bmain); -} - -/* ........ */ - -/* perform baking for the targets on the current frame */ -static void motionpaths_calc_bake_targets(ListBase *targets, int cframe) -{ - MPathTarget *mpt; - - /* for each target, check if it can be baked on the current frame */ - for (mpt = targets->first; mpt; mpt = mpt->next) { - bMotionPath *mpath = mpt->mpath; - - /* current frame must be within the range the cache works for - * - is inclusive of the first frame, but not the last otherwise we get buffer overruns - */ - if ((cframe < mpath->start_frame) || (cframe >= mpath->end_frame)) { - continue; - } - - /* get the relevant cache vert to write to */ - bMotionPathVert *mpv = mpath->points + (cframe - mpath->start_frame); - - Object *ob_eval = mpt->ob_eval; - - /* Lookup evaluated pose channel, here because the depsgraph - * evaluation can change them so they are not cached in mpt. */ - bPoseChannel *pchan_eval = NULL; - if (mpt->pchan) { - pchan_eval = BKE_pose_channel_find_name(ob_eval->pose, mpt->pchan->name); - } - - /* pose-channel or object path baking? */ - if (pchan_eval) { - /* heads or tails */ - if (mpath->flag & MOTIONPATH_FLAG_BHEAD) { - copy_v3_v3(mpv->co, pchan_eval->pose_head); - } - else { - copy_v3_v3(mpv->co, pchan_eval->pose_tail); - } - - /* result must be in worldspace */ - mul_m4_v3(ob_eval->obmat, mpv->co); - } - else { - /* worldspace object location */ - copy_v3_v3(mpv->co, ob_eval->obmat[3]); - } - - float mframe = (float)(cframe); - - /* Tag if it's a keyframe */ - if (BLI_dlrbTree_search_exact(&mpt->keys, compare_ak_cfraPtr, &mframe)) { - mpv->flag |= MOTIONPATH_VERT_KEY; - } - else { - mpv->flag &= ~MOTIONPATH_VERT_KEY; - } - - /* Incremental update on evaluated object if possible, for fast updating - * while dragging in transform. */ - bMotionPath *mpath_eval = NULL; - if (mpt->pchan) { - mpath_eval = (pchan_eval) ? pchan_eval->mpath : NULL; - } - else { - mpath_eval = ob_eval->mpath; - } - - if (mpath_eval && mpath_eval->length == mpath->length) { - bMotionPathVert *mpv_eval = mpath_eval->points + (cframe - mpath_eval->start_frame); - *mpv_eval = *mpv; - - GPU_VERTBUF_DISCARD_SAFE(mpath_eval->points_vbo); - GPU_BATCH_DISCARD_SAFE(mpath_eval->batch_line); - GPU_BATCH_DISCARD_SAFE(mpath_eval->batch_points); - } - } -} - -/* Perform baking of the given object's and/or its bones' transforms to motion paths - * - scene: current scene - * - ob: object whose flagged motionpaths should get calculated - * - recalc: whether we need to - */ -/* TODO: include reports pointer? */ -void animviz_calc_motionpaths(Depsgraph *depsgraph, - Main *bmain, - Scene *scene, - ListBase *targets, - bool restore, - bool current_frame_only) -{ - /* sanity check */ - if (ELEM(NULL, targets, targets->first)) - return; - - /* Compute frame range to bake within. - * TODO: this method could be improved... - * 1) max range for standard baking - * 2) minimum range for recalc baking (i.e. between keyframes, but how?) */ - int sfra = INT_MAX; - int efra = INT_MIN; - - for (MPathTarget *mpt = targets->first; mpt; mpt = mpt->next) { - /* try to increase area to do (only as much as needed) */ - sfra = MIN2(sfra, mpt->mpath->start_frame); - efra = MAX2(efra, mpt->mpath->end_frame); - } - - if (efra <= sfra) { - return; - } - - /* Limit frame range if we are updating just the current frame. */ - /* set frame values */ - int cfra = CFRA; - if (current_frame_only) { - if (cfra < sfra || cfra > efra) { - return; - } - sfra = efra = cfra; - } - - /* get copies of objects/bones to get the calculated results from - * (for copy-on-write evaluation), so that we actually get some results - */ - // TODO: Create a copy of background depsgraph that only contain these entities, and only evaluates them.. - for (MPathTarget *mpt = targets->first; mpt; mpt = mpt->next) { - mpt->ob_eval = DEG_get_evaluated_object(depsgraph, mpt->ob); - - AnimData *adt = BKE_animdata_from_id(&mpt->ob_eval->id); - - /* build list of all keyframes in active action for object or pchan */ - BLI_dlrbTree_init(&mpt->keys); - - if (adt) { - bAnimVizSettings *avs; - - /* get pointer to animviz settings for each target */ - if (mpt->pchan) - avs = &mpt->ob->pose->avs; - else - avs = &mpt->ob->avs; - - /* it is assumed that keyframes for bones are all grouped in a single group - * unless an option is set to always use the whole action - */ - if ((mpt->pchan) && (avs->path_viewflag & MOTIONPATH_VIEW_KFACT) == 0) { - bActionGroup *agrp = BKE_action_group_find_name(adt->action, mpt->pchan->name); - - if (agrp) { - agroup_to_keylist(adt, agrp, &mpt->keys, 0); - } - } - else { - action_to_keylist(adt, adt->action, &mpt->keys, 0); - } - } - } - - /* calculate path over requested range */ - CLOG_INFO(&LOG, 1, "Calculating MotionPaths between frames %d - %d (%d frames)", sfra, efra, efra - sfra + 1); - for (CFRA = sfra; CFRA <= efra; CFRA++) { - if (current_frame_only) { - /* For current frame, only update tagged. */ - BKE_scene_graph_update_tagged(depsgraph, bmain); - } - else { - /* Update relevant data for new frame. */ - motionpaths_calc_update_scene(bmain, depsgraph); - } - - /* perform baking for targets */ - motionpaths_calc_bake_targets(targets, CFRA); - } - - /* reset original environment */ - /* NOTE: We don't always need to reevaluate the main scene, as the depsgraph - * may be a temporary one that works on a subset of the data. We always have - * to resoture the current frame though. */ - CFRA = cfra; - if (!current_frame_only && restore) { - motionpaths_calc_update_scene(bmain, depsgraph); - } - - /* clear recalc flags from targets */ - for (MPathTarget *mpt = targets->first; mpt; mpt = mpt->next) { - bAnimVizSettings *avs; - bMotionPath *mpath = mpt->mpath; - - /* get pointer to animviz settings for each target */ - if (mpt->pchan) - avs = &mpt->ob->pose->avs; - else - avs = &mpt->ob->avs; - - /* clear the flag requesting recalculation of targets */ - avs->recalc &= ~ANIMVIZ_RECALC_PATHS; - - /* Clean temp data */ - BLI_dlrbTree_free(&mpt->keys); - - /* Free previous batches to force update. */ - GPU_VERTBUF_DISCARD_SAFE(mpath->points_vbo); - GPU_BATCH_DISCARD_SAFE(mpath->batch_line); - GPU_BATCH_DISCARD_SAFE(mpath->batch_points); - } -} - /* ******************************************************************** */ /* Curve Paths - for curve deforms and/or curve following */ diff --git a/source/blender/blenkernel/intern/armature_update.c b/source/blender/blenkernel/intern/armature_update.c index 6bf120b8f00..51333251b8e 100644 --- a/source/blender/blenkernel/intern/armature_update.c +++ b/source/blender/blenkernel/intern/armature_update.c @@ -230,7 +230,7 @@ static bool splineik_evaluate_init(tSplineIK_Tree *tree, tSplineIk_EvalState *st unit_m4(state->locrot_offset); /* Apply corrections for sensitivity to scaling. */ - if ((ikData->flag & CONSTRAINT_SPLINEIK_SCALE_LIMITED) && (tree->totlength != 0.0f)) { + if ((ikData->yScaleMode != CONSTRAINT_SPLINEIK_YS_FIT_CURVE) && (tree->totlength != 0.0f)) { /* get the current length of the curve */ /* NOTE: this is assumed to be correct even after the curve was resized */ float splineLen = cache->path->totdist; @@ -249,8 +249,9 @@ static bool splineik_evaluate_init(tSplineIK_Tree *tree, tSplineIk_EvalState *st static void splineik_evaluate_bone(tSplineIK_Tree *tree, Object *ob, bPoseChannel *pchan, int index, tSplineIk_EvalState *state) { bSplineIKConstraint *ikData = tree->ikData; - float origHead[3], origTail[3], poseHead[3], poseTail[3], poseMat[4][4]; + float origHead[3], origTail[3], poseHead[3], poseTail[3], basePoseMat[3][3], poseMat[3][3]; float splineVec[3], scaleFac, radius = 1.0f; + float tailBlendFac = 0.0f; mul_v3_m4v3(poseHead, state->locrot_offset, pchan->pose_head); mul_v3_m4v3(poseTail, state->locrot_offset, pchan->pose_tail); @@ -260,25 +261,29 @@ static void splineik_evaluate_bone(tSplineIK_Tree *tree, Object *ob, bPoseChanne /* first, adjust the point positions on the curve */ float curveLen = tree->points[index] - tree->points[index + 1]; float pointStart = state->curve_position; - float pointEnd = pointStart + curveLen * state->curve_scale; + float baseScale = 1.0f; + + if (ikData->yScaleMode == CONSTRAINT_SPLINEIK_YS_ORIGINAL) { + /* Carry over the bone Y scale to the curve range. */ + baseScale = len_v3v3(poseHead, poseTail) / pchan->bone->length; + } + + float pointEnd = pointStart + curveLen * baseScale * state->curve_scale; state->curve_position = pointEnd; /* step 1: determine the positions for the endpoints of the bone */ - { + if (pointStart < 1.0f) { float vec[4], dir[3], rad; - float tailBlendFac = 1.0f; /* determine if the bone should still be affected by SplineIK */ - if (pointStart >= 1.0f) { - /* spline doesn't affect the bone anymore, so done... */ - pchan->flag |= POSE_DONE; - return; - } - else if ((pointEnd >= 1.0f) && (pointStart < 1.0f)) { + if (pointEnd >= 1.0f) { /* blending factor depends on the amount of the bone still left on the chain */ tailBlendFac = (1.0f - pointStart) / (pointEnd - pointStart); } + else { + tailBlendFac = 1.0f; + } /* tail endpoint */ if (where_on_path(ikData->tar, pointEnd, vec, dir, NULL, &rad, NULL)) { @@ -290,7 +295,7 @@ static void splineik_evaluate_bone(tSplineIK_Tree *tree, Object *ob, bPoseChanne /* convert the position to pose-space, then store it */ mul_m4_v3(ob->imat, vec); - interp_v3_v3v3(poseTail, pchan->pose_tail, vec, tailBlendFac); + copy_v3_v3(poseTail, vec); /* set the new radius */ radius = rad; @@ -320,18 +325,21 @@ static void splineik_evaluate_bone(tSplineIK_Tree *tree, Object *ob, bPoseChanne sub_v3_v3v3(splineVec, poseTail, poseHead); scaleFac = len_v3(splineVec) / pchan->bone->length; + /* Adjust the scale factor towards the neutral state when rolling off the curve end. */ + scaleFac = interpf(scaleFac, baseScale, tailBlendFac); + /* step 3: compute the shortest rotation needed to map from the bone rotation to the current axis * - this uses the same method as is used for the Damped Track Constraint (see the code there for details) */ { - float dmat[3][3], rmat[3][3], tmat[3][3]; + float dmat[3][3], rmat[3][3]; float raxis[3], rangle; /* compute the raw rotation matrix from the bone's current matrix by extracting only the * orientation-relevant axes, and normalizing them */ - mul_m3_m4m4(rmat, state->locrot_offset, pchan->pose_mat); - normalize_m3(rmat); + mul_m3_m4m4(basePoseMat, state->locrot_offset, pchan->pose_mat); + normalize_m3_m3(rmat, basePoseMat); /* also, normalize the orientation imposed by the bone, now that we've extracted the scale factor */ normalize_v3(splineVec); @@ -348,7 +356,7 @@ static void splineik_evaluate_bone(tSplineIK_Tree *tree, Object *ob, bPoseChanne /* multiply the magnitude of the angle by the influence of the constraint to * control the influence of the SplineIK effect */ - rangle *= tree->con->enforce; + rangle *= tree->con->enforce * tailBlendFac; /* construct rotation matrix from the axis-angle rotation found above * - this call takes care to make sure that the axis provided is a unit vector first @@ -358,9 +366,10 @@ static void splineik_evaluate_bone(tSplineIK_Tree *tree, Object *ob, bPoseChanne /* combine these rotations so that the y-axis of the bone is now aligned as the spline dictates, * while still maintaining roll control from the existing bone animation */ - mul_m3_m3m3(tmat, dmat, rmat); /* m1, m3, m2 */ - normalize_m3(tmat); /* attempt to reduce shearing, though I doubt this'll really help too much now... */ - copy_m4_m3(poseMat, tmat); + mul_m3_m3m3(poseMat, dmat, rmat); + normalize_m3(poseMat); /* attempt to reduce shearing, though I doubt this'll really help too much now... */ + + mul_m3_m3m3(basePoseMat, dmat, basePoseMat); /* apply rotation to the accumulated parent transform */ mul_m4_m3m4(state->locrot_offset, dmat, state->locrot_offset); @@ -468,6 +477,10 @@ static void splineik_evaluate_bone(tSplineIK_Tree *tree, Object *ob, bPoseChanne } } + /* Blend the scaling of the matrix according to the influence. */ + sub_m3_m3m3(poseMat, poseMat, basePoseMat); + madd_m3_m3m3fl(poseMat, basePoseMat, poseMat, tree->con->enforce * tailBlendFac); + /* step 5: set the location of the bone in the matrix */ if (ikData->flag & CONSTRAINT_SPLINEIK_NO_ROOT) { /* when the 'no-root' option is affected, the chain can retain @@ -487,10 +500,10 @@ static void splineik_evaluate_bone(tSplineIK_Tree *tree, Object *ob, bPoseChanne interp_v3_v3v3(poseHead, origHead, poseHead, tree->con->enforce); } } - copy_v3_v3(poseMat[3], poseHead); /* finally, store the new transform */ - copy_m4_m4(pchan->pose_mat, poseMat); + copy_m4_m3(pchan->pose_mat, poseMat); + copy_v3_v3(pchan->pose_mat[3], poseHead); copy_v3_v3(pchan->pose_head, poseHead); mul_v3_mat3_m4v3(origTail, state->locrot_offset, pchan->pose_tail); diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index ea5605d8ed1..bc6c0782726 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -207,7 +207,7 @@ typedef enum eGPCurveMappingPreset { GPCURVE_PRESET_PENCIL = 0, GPCURVE_PRESET_INK = 1, GPCURVE_PRESET_INKNOISE = 2, - GPCURVE_PRESET_MARKER = 3 + GPCURVE_PRESET_MARKER = 3, } eGPCurveMappingPreset; static void brush_gpencil_curvemap_reset(CurveMap *cuma, int tot, int preset) @@ -304,6 +304,10 @@ void BKE_brush_gpencil_presets(bContext *C) brush->smooth_stroke_radius = SMOOTH_STROKE_RADIUS; brush->smooth_stroke_factor = SMOOTH_STROKE_FACTOR; + brush->gpencil_settings->gradient_f = 1.0f; + brush->gpencil_settings->gradient_s[0] = 1.0f; + brush->gpencil_settings->gradient_s[1] = 1.0f; + /* Pen brush */ brush = BKE_brush_add_gpencil(bmain, ts, "Draw Pen"); deft = brush; /* save default brush */ @@ -336,6 +340,10 @@ void BKE_brush_gpencil_presets(bContext *C) brush->smooth_stroke_radius = SMOOTH_STROKE_RADIUS; brush->smooth_stroke_factor = SMOOTH_STROKE_FACTOR; + brush->gpencil_settings->gradient_f = 1.0f; + brush->gpencil_settings->gradient_s[0] = 1.0f; + brush->gpencil_settings->gradient_s[1] = 1.0f; + /* Ink brush */ brush = BKE_brush_add_gpencil(bmain, ts, "Draw Ink"); brush->size = 60.0f; @@ -365,6 +373,10 @@ void BKE_brush_gpencil_presets(bContext *C) brush->smooth_stroke_radius = SMOOTH_STROKE_RADIUS; brush->smooth_stroke_factor = SMOOTH_STROKE_FACTOR; + brush->gpencil_settings->gradient_f = 1.0f; + brush->gpencil_settings->gradient_s[0] = 1.0f; + brush->gpencil_settings->gradient_s[1] = 1.0f; + /* Curve */ custom_curve = brush->gpencil_settings->curve_sensitivity; curvemapping_set_defaults(custom_curve, 0, 0.0f, 0.0f, 1.0f, 1.0f); @@ -408,6 +420,10 @@ void BKE_brush_gpencil_presets(bContext *C) curvemapping_initialize(custom_curve); brush_gpencil_curvemap_reset(custom_curve->cm, 3, GPCURVE_PRESET_INKNOISE); + brush->gpencil_settings->gradient_f = 1.0f; + brush->gpencil_settings->gradient_s[0] = 1.0f; + brush->gpencil_settings->gradient_s[1] = 1.0f; + /* Block Basic brush */ brush = BKE_brush_add_gpencil(bmain, ts, "Draw Block"); brush->size = 150.0f; @@ -436,6 +452,10 @@ void BKE_brush_gpencil_presets(bContext *C) brush->smooth_stroke_radius = SMOOTH_STROKE_RADIUS; brush->smooth_stroke_factor = SMOOTH_STROKE_FACTOR; + brush->gpencil_settings->gradient_f = 1.0f; + brush->gpencil_settings->gradient_s[0] = 1.0f; + brush->gpencil_settings->gradient_s[1] = 1.0f; + /* Marker brush */ brush = BKE_brush_add_gpencil(bmain, ts, "Draw Marker"); brush->size = 80.0f; @@ -472,6 +492,10 @@ void BKE_brush_gpencil_presets(bContext *C) curvemapping_initialize(custom_curve); brush_gpencil_curvemap_reset(custom_curve->cm, 4, GPCURVE_PRESET_MARKER); + brush->gpencil_settings->gradient_f = 1.0f; + brush->gpencil_settings->gradient_s[0] = 1.0f; + brush->gpencil_settings->gradient_s[1] = 1.0f; + /* Fill brush */ brush = BKE_brush_add_gpencil(bmain, ts, "Fill Area"); brush->size = 1.0f; @@ -495,6 +519,10 @@ void BKE_brush_gpencil_presets(bContext *C) brush->gpencil_settings->draw_strength = 1.0f; + brush->gpencil_settings->gradient_f = 1.0f; + brush->gpencil_settings->gradient_s[0] = 1.0f; + brush->gpencil_settings->gradient_s[1] = 1.0f; + /* Soft Eraser brush */ brush = BKE_brush_add_gpencil(bmain, ts, "Eraser Soft"); brush->size = 30.0f; diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 59a374d5e88..1ba29424def 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -663,7 +663,7 @@ static bConstraintTypeInfo CTI_CONSTRNAME = { constrname_get_tars, /* get constraint targets */ constrname_flush_tars, /* flush constraint targets */ constrname_get_tarmat, /* get target matrix */ - constrname_evaluate /* evaluate */ + constrname_evaluate, /* evaluate */ }; #endif @@ -916,7 +916,7 @@ static bConstraintTypeInfo CTI_CHILDOF = { childof_get_tars, /* get constraint targets */ childof_flush_tars, /* flush constraint targets */ default_get_tarmat, /* get a target matrix */ - childof_evaluate /* evaluate */ + childof_evaluate, /* evaluate */ }; /* -------- TrackTo Constraint ------- */ @@ -1094,7 +1094,7 @@ static bConstraintTypeInfo CTI_TRACKTO = { trackto_get_tars, /* get constraint targets */ trackto_flush_tars, /* flush constraint targets */ default_get_tarmat, /* get target matrix */ - trackto_evaluate /* evaluate */ + trackto_evaluate, /* evaluate */ }; /* --------- Inverse-Kinematics --------- */ @@ -1187,7 +1187,7 @@ static bConstraintTypeInfo CTI_KINEMATIC = { kinematic_get_tars, /* get constraint targets */ kinematic_flush_tars, /* flush constraint targets */ kinematic_get_tarmat, /* get target matrix */ - NULL /* evaluate - solved as separate loop */ + NULL, /* evaluate - solved as separate loop */ }; /* -------- Follow-Path Constraint ---------- */ @@ -1358,7 +1358,7 @@ static bConstraintTypeInfo CTI_FOLLOWPATH = { followpath_get_tars, /* get constraint targets */ followpath_flush_tars, /* flush constraint targets */ followpath_get_tarmat, /* get target matrix */ - followpath_evaluate /* evaluate */ + followpath_evaluate, /* evaluate */ }; /* --------- Limit Location --------- */ @@ -1406,7 +1406,7 @@ static bConstraintTypeInfo CTI_LOCLIMIT = { NULL, /* get constraint targets */ NULL, /* flush constraint targets */ NULL, /* get target matrix */ - loclimit_evaluate /* evaluate */ + loclimit_evaluate, /* evaluate */ }; /* -------- Limit Rotation --------- */ @@ -1463,7 +1463,7 @@ static bConstraintTypeInfo CTI_ROTLIMIT = { NULL, /* get constraint targets */ NULL, /* flush constraint targets */ NULL, /* get target matrix */ - rotlimit_evaluate /* evaluate */ + rotlimit_evaluate, /* evaluate */ }; /* --------- Limit Scale --------- */ @@ -1522,7 +1522,7 @@ static bConstraintTypeInfo CTI_SIZELIMIT = { NULL, /* get constraint targets */ NULL, /* flush constraint targets */ NULL, /* get target matrix */ - sizelimit_evaluate /* evaluate */ + sizelimit_evaluate, /* evaluate */ }; /* ----------- Copy Location ------------- */ @@ -1612,7 +1612,7 @@ static bConstraintTypeInfo CTI_LOCLIKE = { loclike_get_tars, /* get constraint targets */ loclike_flush_tars, /* flush constraint targets */ default_get_tarmat, /* get target matrix */ - loclike_evaluate /* evaluate */ + loclike_evaluate, /* evaluate */ }; /* ----------- Copy Rotation ------------- */ @@ -1724,7 +1724,7 @@ static bConstraintTypeInfo CTI_ROTLIKE = { rotlike_get_tars, /* get constraint targets */ rotlike_flush_tars, /* flush constraint targets */ default_get_tarmat, /* get target matrix */ - rotlike_evaluate /* evaluate */ + rotlike_evaluate, /* evaluate */ }; /* ---------- Copy Scale ---------- */ @@ -1819,7 +1819,7 @@ static bConstraintTypeInfo CTI_SIZELIKE = { sizelike_get_tars, /* get constraint targets */ sizelike_flush_tars, /* flush constraint targets */ default_get_tarmat, /* get target matrix */ - sizelike_evaluate /* evaluate */ + sizelike_evaluate, /* evaluate */ }; /* ----------- Copy Transforms ------------- */ @@ -1880,7 +1880,7 @@ static bConstraintTypeInfo CTI_TRANSLIKE = { translike_get_tars, /* get constraint targets */ translike_flush_tars, /* flush constraint targets */ default_get_tarmat_full_bbone, /* get target matrix */ - translike_evaluate /* evaluate */ + translike_evaluate, /* evaluate */ }; /* ---------- Maintain Volume ---------- */ @@ -1937,7 +1937,7 @@ static bConstraintTypeInfo CTI_SAMEVOL = { NULL, /* get constraint targets */ NULL, /* flush constraint targets */ NULL, /* get target matrix */ - samevolume_evaluate /* evaluate */ + samevolume_evaluate, /* evaluate */ }; /* ----------- Python Constraint -------------- */ @@ -2057,7 +2057,7 @@ static bConstraintTypeInfo CTI_PYTHON = { pycon_get_tars, /* get constraint targets */ NULL, /* flush constraint targets */ pycon_get_tarmat, /* get target matrix */ - pycon_evaluate /* evaluate */ + pycon_evaluate, /* evaluate */ }; /* ----------- Armature Constraint -------------- */ @@ -2263,7 +2263,7 @@ static bConstraintTypeInfo CTI_ARMATURE = { armdef_get_tars, /* get constraint targets */ NULL, /* flush constraint targets */ armdef_get_tarmat, /* get target matrix */ - armdef_evaluate /* evaluate */ + armdef_evaluate, /* evaluate */ }; /* -------- Action Constraint ----------- */ @@ -2427,7 +2427,7 @@ static bConstraintTypeInfo CTI_ACTION = { actcon_get_tars, /* get constraint targets */ actcon_flush_tars, /* flush constraint targets */ actcon_get_tarmat, /* get target matrix */ - actcon_evaluate /* evaluate */ + actcon_evaluate, /* evaluate */ }; /* --------- Locked Track ---------- */ @@ -2735,7 +2735,7 @@ static bConstraintTypeInfo CTI_LOCKTRACK = { locktrack_get_tars, /* get constraint targets */ locktrack_flush_tars, /* flush constraint targets */ default_get_tarmat, /* get target matrix */ - locktrack_evaluate /* evaluate */ + locktrack_evaluate, /* evaluate */ }; /* ---------- Limit Distance Constraint ----------- */ @@ -2869,7 +2869,7 @@ static bConstraintTypeInfo CTI_DISTLIMIT = { distlimit_get_tars, /* get constraint targets */ distlimit_flush_tars, /* flush constraint targets */ default_get_tarmat, /* get a target matrix */ - distlimit_evaluate /* evaluate */ + distlimit_evaluate, /* evaluate */ }; /* ---------- Stretch To ------------ */ @@ -3081,7 +3081,7 @@ static bConstraintTypeInfo CTI_STRETCHTO = { stretchto_get_tars, /* get constraint targets */ stretchto_flush_tars, /* flush constraint targets */ default_get_tarmat, /* get target matrix */ - stretchto_evaluate /* evaluate */ + stretchto_evaluate, /* evaluate */ }; /* ---------- Floor ------------ */ @@ -3225,7 +3225,7 @@ static bConstraintTypeInfo CTI_MINMAX = { minmax_get_tars, /* get constraint targets */ minmax_flush_tars, /* flush constraint targets */ default_get_tarmat, /* get target matrix */ - minmax_evaluate /* evaluate */ + minmax_evaluate, /* evaluate */ }; /* -------- Clamp To ---------- */ @@ -3391,7 +3391,7 @@ static bConstraintTypeInfo CTI_CLAMPTO = { clampto_get_tars, /* get constraint targets */ clampto_flush_tars, /* flush constraint targets */ clampto_get_tarmat, /* get target matrix */ - clampto_evaluate /* evaluate */ + clampto_evaluate, /* evaluate */ }; /* ---------- Transform Constraint ----------- */ @@ -3554,7 +3554,7 @@ static bConstraintTypeInfo CTI_TRANSFORM = { transform_get_tars, /* get constraint targets */ transform_flush_tars, /* flush constraint targets */ default_get_tarmat, /* get a target matrix */ - transform_evaluate /* evaluate */ + transform_evaluate, /* evaluate */ }; /* ---------- Shrinkwrap Constraint ----------- */ @@ -3767,7 +3767,7 @@ static bConstraintTypeInfo CTI_SHRINKWRAP = { shrinkwrap_get_tars, /* get constraint targets */ shrinkwrap_flush_tars, /* flush constraint targets */ shrinkwrap_get_tarmat, /* get a target matrix */ - shrinkwrap_evaluate /* evaluate */ + shrinkwrap_evaluate, /* evaluate */ }; /* --------- Damped Track ---------- */ @@ -3928,7 +3928,7 @@ static bConstraintTypeInfo CTI_DAMPTRACK = { damptrack_get_tars, /* get constraint targets */ damptrack_flush_tars, /* flush constraint targets */ default_get_tarmat, /* get target matrix */ - damptrack_evaluate /* evaluate */ + damptrack_evaluate, /* evaluate */ }; /* ----------- Spline IK ------------ */ @@ -3959,6 +3959,8 @@ static void splineik_new_data(void *cdata) data->bulge = 1.0; data->bulge_max = 1.0f; data->bulge_min = 1.0f; + + data->yScaleMode = CONSTRAINT_SPLINEIK_YS_FIT_CURVE; } static void splineik_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata) @@ -4018,7 +4020,7 @@ static bConstraintTypeInfo CTI_SPLINEIK = { splineik_get_tars, /* get constraint targets */ splineik_flush_tars, /* flush constraint targets */ splineik_get_tarmat, /* get target matrix */ - NULL /* evaluate - solved as separate loop */ + NULL, /* evaluate - solved as separate loop */ }; /* ----------- Pivot ------------- */ @@ -4142,7 +4144,7 @@ static bConstraintTypeInfo CTI_PIVOT = { pivotcon_get_tars, /* get constraint targets */ pivotcon_flush_tars, /* flush constraint targets */ default_get_tarmat, /* get target matrix */ - pivotcon_evaluate /* evaluate */ + pivotcon_evaluate, /* evaluate */ }; /* ----------- Follow Track ------------- */ @@ -4392,7 +4394,7 @@ static bConstraintTypeInfo CTI_FOLLOWTRACK = { NULL, /* get constraint targets */ NULL, /* flush constraint targets */ NULL, /* get target matrix */ - followtrack_evaluate /* evaluate */ + followtrack_evaluate, /* evaluate */ }; /* ----------- Camre Solver ------------- */ @@ -4449,7 +4451,7 @@ static bConstraintTypeInfo CTI_CAMERASOLVER = { NULL, /* get constraint targets */ NULL, /* flush constraint targets */ NULL, /* get target matrix */ - camerasolver_evaluate /* evaluate */ + camerasolver_evaluate, /* evaluate */ }; /* ----------- Object Solver ------------- */ @@ -4525,7 +4527,7 @@ static bConstraintTypeInfo CTI_OBJECTSOLVER = { NULL, /* get constraint targets */ NULL, /* flush constraint targets */ NULL, /* get target matrix */ - objectsolver_evaluate /* evaluate */ + objectsolver_evaluate, /* evaluate */ }; /* ----------- Transform Cache ------------- */ @@ -4616,7 +4618,7 @@ static bConstraintTypeInfo CTI_TRANSFORM_CACHE = { NULL, /* get constraint targets */ NULL, /* flush constraint targets */ NULL, /* get target matrix */ - transformcache_evaluate /* evaluate */ + transformcache_evaluate, /* evaluate */ }; /* ************************* Constraints Type-Info *************************** */ diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c index d7d68b988e3..1486455c750 100644 --- a/source/blender/blenkernel/intern/fmodifier.c +++ b/source/blender/blenkernel/intern/fmodifier.c @@ -93,7 +93,7 @@ static FModifierTypeInfo FMI_MODNAME = { fcm_modname_time, /* evaluate time */ fcm_modname_evaluate, /* evaluate */ fcm_modname_time_storage, /* evaluate time with storage */ - fcm_modname_evaluate_storage /* evaluate with storage */ + fcm_modname_evaluate_storage, /* evaluate with storage */ }; #endif @@ -246,7 +246,7 @@ static FModifierTypeInfo FMI_GENERATOR = { NULL, /* evaluate time */ fcm_generator_evaluate, /* evaluate */ NULL, /* evaluate time with storage */ - NULL /* evaluate with storage */ + NULL, /* evaluate with storage */ }; /* Built-In Function Generator F-Curve Modifier --------------------------- */ @@ -370,7 +370,7 @@ static FModifierTypeInfo FMI_FN_GENERATOR = { NULL, /* evaluate time */ fcm_fn_generator_evaluate, /* evaluate */ NULL, /* evaluate time with storage */ - NULL /* evaluate with storage */ + NULL, /* evaluate with storage */ }; /* Envelope F-Curve Modifier --------------------------- */ @@ -479,7 +479,7 @@ static FModifierTypeInfo FMI_ENVELOPE = { NULL, /* evaluate time */ fcm_envelope_evaluate, /* evaluate */ NULL, /* evaluate time with storage */ - NULL /* evaluate with storage */ + NULL, /* evaluate with storage */ }; /* exported function for finding points */ @@ -769,7 +769,7 @@ static FModifierTypeInfo FMI_CYCLES = { NULL, /* evaluate time */ NULL, /* evaluate */ fcm_cycles_time, /* evaluate time with storage */ - fcm_cycles_evaluate /* evaluate with storage */ + fcm_cycles_evaluate, /* evaluate with storage */ }; /* Noise F-Curve Modifier --------------------------- */ @@ -830,7 +830,7 @@ static FModifierTypeInfo FMI_NOISE = { NULL, /* evaluate time */ fcm_noise_evaluate, /* evaluate */ NULL, /* evaluate time with storage */ - NULL /* evaluate with storage */ + NULL, /* evaluate with storage */ }; @@ -887,7 +887,7 @@ static FModifierTypeInfo FMI_PYTHON = { NULL /*fcm_python_time*/, /* evaluate time */ fcm_python_evaluate, /* evaluate */ NULL, /* evaluate time with storage */ - NULL /* evaluate with storage */ + NULL, /* evaluate with storage */ }; @@ -932,7 +932,7 @@ static FModifierTypeInfo FMI_LIMITS = { fcm_limits_time, /* evaluate time */ fcm_limits_evaluate, /* evaluate */ NULL, /* evaluate time with storage */ - NULL /* evaluate with storage */ + NULL, /* evaluate with storage */ }; /* Stepped F-Curve Modifier --------------------------- */ @@ -987,7 +987,7 @@ static FModifierTypeInfo FMI_STEPPED = { fcm_stepped_time, /* evaluate time */ NULL, /* evaluate */ NULL, /* evaluate time with storage */ - NULL /* evaluate with storage */ + NULL, /* evaluate with storage */ }; /* F-Curve Modifier API --------------------------- */ diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c index c204a8128c1..d47b3f20a28 100644 --- a/source/blender/blenkernel/intern/gpencil.c +++ b/source/blender/blenkernel/intern/gpencil.c @@ -467,6 +467,10 @@ bGPDstroke *BKE_gpencil_add_stroke(bGPDframe *gpf, int mat_idx, int totpoints, s bGPDstroke *gps = MEM_callocN(sizeof(bGPDstroke), "gp_stroke"); gps->thickness = thickness; + gps->gradient_f = 1.0f; + gps->gradient_s[0] = 1.0f; + gps->gradient_s[1] = 1.0f; + gps->inittime = 0; /* enable recalculation flag by default */ diff --git a/source/blender/blenkernel/intern/idcode.c b/source/blender/blenkernel/intern/idcode.c index df8de1aa2cf..5e37f586a2a 100644 --- a/source/blender/blenkernel/intern/idcode.c +++ b/source/blender/blenkernel/intern/idcode.c @@ -44,8 +44,13 @@ typedef struct { #define IDTYPE_FLAGS_ISLINKABLE (1 << 0) } IDType; -/* plural need to match rna_main.c's MainCollectionDef */ -/* WARNING! Keep it in sync with i18n contexts in BLT_translation.h */ +/* Keep alignment for readability. */ +/* clang-format off */ +/** + * When editing enusre that: + * - Plural need to match rna_main.c's #MainCollectionDef. + * - Keep it in sync with i18n contexts in BLT_translation.h + */ static IDType idtypes[] = { /** ID's directly below must all be in #Main, and be kept in sync with #MAX_LIBARRAY (membership, not order) */ {ID_AC, "Action", "actions", BLT_I18NCONTEXT_ID_ACTION, IDTYPE_FLAGS_ISLINKABLE}, @@ -74,7 +79,7 @@ static IDType idtypes[] = { {ID_PA, "ParticleSettings", "particles", BLT_I18NCONTEXT_ID_PARTICLESETTINGS, IDTYPE_FLAGS_ISLINKABLE}, {ID_PAL, "Palettes", "palettes", BLT_I18NCONTEXT_ID_PALETTE, IDTYPE_FLAGS_ISLINKABLE}, {ID_PC, "PaintCurve", "paint_curves", BLT_I18NCONTEXT_ID_PAINTCURVE, IDTYPE_FLAGS_ISLINKABLE}, - {ID_LP, "LightProbe", "light_probes", BLT_I18NCONTEXT_ID_LIGHTPROBE, IDTYPE_FLAGS_ISLINKABLE}, + {ID_LP, "LightProbe", "lightprobes", BLT_I18NCONTEXT_ID_LIGHTPROBE, IDTYPE_FLAGS_ISLINKABLE}, {ID_SCE, "Scene", "scenes", BLT_I18NCONTEXT_ID_SCENE, IDTYPE_FLAGS_ISLINKABLE}, {ID_SCR, "Screen", "screens", BLT_I18NCONTEXT_ID_SCREEN, IDTYPE_FLAGS_ISLINKABLE}, {ID_SEQ, "Sequence", "sequences", BLT_I18NCONTEXT_ID_SEQUENCE, 0 }, /* not actually ID data */ @@ -90,6 +95,7 @@ static IDType idtypes[] = { /** Keep last, not an ID exactly, only include for completeness */ {ID_LINK_PLACEHOLDER, "Link Placeholder", "link_placeholders", BLT_I18NCONTEXT_ID_ID, 0}, /* plural is fake */ }; +/* clang-format on */ /* -1 for ID_LINK_PLACEHOLDER */ BLI_STATIC_ASSERT((ARRAY_SIZE(idtypes) - 1 == MAX_LIBARRAY), "Missing IDType"); diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 0205f275f59..101798a40e3 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -2115,7 +2115,7 @@ static const char *stamp_metadata_fields[] = { "RenderTime", "Memory", "Hostname", - NULL + NULL, }; /* Check whether the given metadata field name translates to a known field of diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c index 7fc1d9e14ae..95c8f9b7ee2 100644 --- a/source/blender/blenkernel/intern/layer.c +++ b/source/blender/blenkernel/intern/layer.c @@ -987,8 +987,9 @@ bool BKE_layer_collection_isolate(Scene *scene, ViewLayer *view_layer, LayerColl { bool depsgraph_need_update = false; LayerCollection *lc_master = view_layer->layer_collections.first; + bool hide_it = extend && (lc->runtime_flag & LAYER_COLLECTION_VISIBLE); - if (!ID_IS_LINKED(lc->collection)) { + if ((!ID_IS_LINKED(lc->collection) && !hide_it)) { if (lc->collection->flag & COLLECTION_RESTRICT_VIEW) { lc->collection->flag &= ~COLLECTION_RESTRICT_VIEW; depsgraph_need_update = true; @@ -1003,36 +1004,41 @@ bool BKE_layer_collection_isolate(Scene *scene, ViewLayer *view_layer, LayerColl } /* Make all the direct parents visible. */ - LayerCollection *lc_parent = lc; - for (LayerCollection *lc_iter = lc_master->layer_collections.first; lc_iter; lc_iter = lc_iter->next) { - if (BKE_layer_collection_has_layer_collection(lc_iter, lc)) { - lc_parent = lc_iter; - break; - } + if (hide_it) { + lc->flag |= LAYER_COLLECTION_RESTRICT_VIEW; } - - while (lc_parent != lc) { - if (!ID_IS_LINKED(lc_parent->collection)) { - if (lc_parent->collection->flag & COLLECTION_RESTRICT_VIEW) { - lc_parent->collection->flag &= ~COLLECTION_RESTRICT_VIEW; - depsgraph_need_update = true; + else { + LayerCollection *lc_parent = lc; + for (LayerCollection *lc_iter = lc_master->layer_collections.first; lc_iter; lc_iter = lc_iter->next) { + if (BKE_layer_collection_has_layer_collection(lc_iter, lc)) { + lc_parent = lc_iter; + break; } } - lc_parent->flag &= ~LAYER_COLLECTION_RESTRICT_VIEW; + while (lc_parent != lc) { + if (!ID_IS_LINKED(lc_parent->collection)) { + if (lc_parent->collection->flag & COLLECTION_RESTRICT_VIEW) { + lc_parent->collection->flag &= ~COLLECTION_RESTRICT_VIEW; + depsgraph_need_update = true; + } + } + + lc_parent->flag &= ~LAYER_COLLECTION_RESTRICT_VIEW; - for (LayerCollection *lc_iter = lc_parent->layer_collections.first; lc_iter; lc_iter = lc_iter->next) { - if (BKE_layer_collection_has_layer_collection(lc_iter, lc)) { - lc_parent = lc_iter; - break; + for (LayerCollection *lc_iter = lc_parent->layer_collections.first; lc_iter; lc_iter = lc_iter->next) { + if (BKE_layer_collection_has_layer_collection(lc_iter, lc)) { + lc_parent = lc_iter; + break; + } } } - } - /* Make all the children visible, but respect their disable state. */ - layer_collection_flag_unset_recursive(lc, LAYER_COLLECTION_RESTRICT_VIEW); + /* Make all the children visible, but respect their disable state. */ + layer_collection_flag_unset_recursive(lc, LAYER_COLLECTION_RESTRICT_VIEW); - BKE_layer_collection_activate(view_layer, lc); + BKE_layer_collection_activate(view_layer, lc); + } BKE_layer_collection_sync(scene, view_layer); diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 517ecd78558..efd1e35f207 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -1745,8 +1745,6 @@ void BKE_library_make_local( Main *bmain, const Library *lib, GHash *old_to_new_ids, const bool untagged_only, const bool set_fake) { ListBase *lbarray[MAX_LIBARRAY]; - ID *id; - int a; LinkNode *todo_ids = NULL; LinkNode *copied_ids = NULL; @@ -1766,8 +1764,8 @@ void BKE_library_make_local( #endif /* Step 1: Detect datablocks to make local. */ - for (a = set_listbasepointers(bmain, lbarray); a--; ) { - id = lbarray[a]->first; + for (int a = set_listbasepointers(bmain, lbarray); a--; ) { + ID *id = lbarray[a]->first; /* Do not explicitly make local non-linkable IDs (shapekeys, in fact), they are assumed to be handled * by real datablocks responsible of them. */ @@ -1841,7 +1839,7 @@ void BKE_library_make_local( * which involves more complex checks and might instead create a local copy of original linked ID. */ for (LinkNode *it = todo_ids, *it_next; it; it = it_next) { it_next = it->next; - id = it->link; + ID *id = it->link; if (id->tag & LIB_TAG_DOIT) { /* We know all users of this object are local or will be made fully local, even if currently there are @@ -1893,7 +1891,7 @@ void BKE_library_make_local( * using again main->relations mapping, but... this implies BKE_libblock_remap & co to be able to update * main->relations on the fly. Have to think about it a bit more, and see whether new code is OK first, anyway. */ for (LinkNode *it = copied_ids; it; it = it->next) { - id = it->link; + ID *id = it->link; BLI_assert(id->newid != NULL); BLI_assert(id->lib != NULL); @@ -1917,6 +1915,8 @@ void BKE_library_make_local( /* Step 5: proxy 'remapping' hack. */ for (LinkNode *it = copied_ids; it; it = it->next) { + ID *id = it->link; + /* Attempt to re-link copied proxy objects. This allows appending of an entire scene * from another blend file into this one, even when that blend file contains proxified * armatures that have local references. Since the proxified object needs to be linked @@ -1968,20 +1968,27 @@ void BKE_library_make_local( * relationship), se we tag it to be fully recomputed, but this does not seems to be enough in some cases, * and evaluation code ends up trying to evaluate a not-yet-updated armature object's deformations. * Try "make all local" in 04_01_H.lighting.blend from Agent327 without this, e.g. */ - /* Also, we use this object loop to handle rigid body resetting. */ for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) { if (ob->data != NULL && ob->type == OB_ARMATURE && ob->pose != NULL && ob->pose->flag & POSE_RECALC) { BKE_pose_rebuild(bmain, ob, ob->data, true); } + } + + /* Reset rigid body objects. */ + for (LinkNode *it = copied_ids; it; it = it->next) { + ID *id = it->link; + if (GS(id->name) == ID_OB) { + Object *ob = (Object *)id; - /* If there was ever any rigidbody settings in the object, we reset it. */ - if (ob->rigidbody_object) { - for (Scene *scene_iter = bmain->scenes.first; scene_iter; scene_iter = scene_iter->id.next) { - if (scene_iter->rigidbody_world) { - BKE_rigidbody_remove_object(bmain, scene_iter, ob); + /* If there was ever any rigidbody settings in the object, we reset it. */ + if (ob->rigidbody_object) { + for (Scene *scene_iter = bmain->scenes.first; scene_iter; scene_iter = scene_iter->id.next) { + if (scene_iter->rigidbody_world) { + BKE_rigidbody_remove_object(bmain, scene_iter, ob); + } } + BKE_rigidbody_free_object(ob, NULL); } - BKE_rigidbody_free_object(ob, NULL); } } diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c index 09fc7c64d6a..62011513096 100644 --- a/source/blender/blenkernel/intern/pbvh.c +++ b/source/blender/blenkernel/intern/pbvh.c @@ -1986,7 +1986,7 @@ bool BKE_pbvh_node_find_nearest_to_ray( typedef enum { ISECT_INSIDE, ISECT_OUTSIDE, - ISECT_INTERSECT + ISECT_INTERSECT, } PlaneAABBIsect; /* Adapted from: diff --git a/source/blender/blenkernel/intern/seqmodifier.c b/source/blender/blenkernel/intern/seqmodifier.c index 268f554ea88..ce0928f8ff1 100644 --- a/source/blender/blenkernel/intern/seqmodifier.c +++ b/source/blender/blenkernel/intern/seqmodifier.c @@ -165,7 +165,7 @@ static SequenceModifierTypeInfo seqModifier_ColorBalance = { colorBalance_init_data, /* init_data */ NULL, /* free_data */ NULL, /* copy_data */ - colorBalance_apply /* apply */ + colorBalance_apply, /* apply */ }; /* **** White Balance Modifier **** */ @@ -252,7 +252,7 @@ static SequenceModifierTypeInfo seqModifier_WhiteBalance = { whiteBalance_init_data, /* init_data */ NULL, /* free_data */ NULL, /* copy_data */ - whiteBalance_apply /* apply */ + whiteBalance_apply, /* apply */ }; /* **** Curves Modifier **** */ @@ -361,7 +361,7 @@ static SequenceModifierTypeInfo seqModifier_Curves = { curves_init_data, /* init_data */ curves_free_data, /* free_data */ curves_copy_data, /* copy_data */ - curves_apply /* apply */ + curves_apply, /* apply */ }; /* **** Hue Correct Modifier **** */ @@ -469,7 +469,7 @@ static SequenceModifierTypeInfo seqModifier_HueCorrect = { hue_correct_init_data, /* init_data */ hue_correct_free_data, /* free_data */ hue_correct_copy_data, /* copy_data */ - hue_correct_apply /* apply */ + hue_correct_apply, /* apply */ }; /* **** Bright/Contrast Modifier **** */ @@ -566,7 +566,7 @@ static SequenceModifierTypeInfo seqModifier_BrightContrast = { NULL, /* init_data */ NULL, /* free_data */ NULL, /* copy_data */ - brightcontrast_apply /* apply */ + brightcontrast_apply, /* apply */ }; /* **** Mask Modifier **** */ @@ -627,7 +627,7 @@ static SequenceModifierTypeInfo seqModifier_Mask = { NULL, /* init_data */ NULL, /* free_data */ NULL, /* copy_data */ - maskmodifier_apply /* apply */ + maskmodifier_apply, /* apply */ }; /* **** Tonemap Modifier **** */ @@ -848,7 +848,7 @@ static SequenceModifierTypeInfo seqModifier_Tonemap = { tonemapmodifier_init_data, /* init_data */ NULL, /* free_data */ NULL, /* copy_data */ - tonemapmodifier_apply /* apply */ + tonemapmodifier_apply, /* apply */ }; /*********************** Modifier functions *************************/ diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index 82acc272c6b..122bb5a19c5 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -87,10 +87,10 @@ # include "PIL_time.h" #endif -#include "smoke_API.h" - #ifdef WITH_SMOKE +#include "smoke_API.h" + #include "BLI_task.h" #include "BLI_kdtree.h" #include "BLI_voxel.h" diff --git a/source/blender/blenkernel/intern/unit.c b/source/blender/blenkernel/intern/unit.c index 2d2db5fea1e..196083fc7fa 100644 --- a/source/blender/blenkernel/intern/unit.c +++ b/source/blender/blenkernel/intern/unit.c @@ -39,6 +39,9 @@ /* no BKE or DNA includes! */ +/* Keep alignment. */ +/* clang-format off */ + #define TEMP_STR_SIZE 256 #define SEP_CHR '#' @@ -77,6 +80,8 @@ #define UN_SC_LB 0.45359237f #define UN_SC_OZ 0.028349523125f +/* clang-format on */ + /* define a single unit */ typedef struct bUnitDef { const char *name; @@ -120,6 +125,9 @@ typedef struct bUnitCollection { int length; } bUnitCollection; +/* Keep table lignment. */ +/* clang-format off */ + #define UNIT_COLLECTION_LENGTH(def) (sizeof(def) / sizeof(bUnitDef) - 1) #define NULL_UNIT {NULL, NULL, NULL, NULL, NULL, NULL, 0.0, 0.0} @@ -324,7 +332,7 @@ static const struct bUnitCollection *bUnitSystems[][B_UNIT_TYPE_TOT] = { {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, }; - +/* clang-format on */ /* internal, has some option not exposed */ static const bUnitCollection *unit_get_system(int system, int type) diff --git a/source/blender/blenlib/BLI_callbacks.h b/source/blender/blenlib/BLI_callbacks.h index 8fdc52c59bf..62381ca5f37 100644 --- a/source/blender/blenlib/BLI_callbacks.h +++ b/source/blender/blenlib/BLI_callbacks.h @@ -53,7 +53,7 @@ typedef enum { BLI_CB_EVT_DEPSGRAPH_UPDATE_POST, BLI_CB_EVT_VERSION_UPDATE, BLI_CB_EVT_LOAD_FACTORY_STARTUP_POST, - BLI_CB_EVT_TOT + BLI_CB_EVT_TOT, } eCbEvent; diff --git a/source/blender/blenlib/BLI_compiler_typecheck.h b/source/blender/blenlib/BLI_compiler_typecheck.h index 4503848d6ea..c816e422c81 100644 --- a/source/blender/blenlib/BLI_compiler_typecheck.h +++ b/source/blender/blenlib/BLI_compiler_typecheck.h @@ -85,7 +85,8 @@ * \endcode */ #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) - +/* Over wrapped args. */ +/* clang-format off */ #define _VA_CHECK_TYPE_ANY2(v, a0) \ ((void)_Generic((v), a0: 0)) #define _VA_CHECK_TYPE_ANY3(v, a0, b0) \ @@ -373,6 +374,7 @@ t1: 0, u1: 0, v1: 0, w1: 0, x1: 0, y1: 0, z1: 0, a2: 0, b2: 0, c2: 0, d2: 0, e2: 0, f2: 0, g2: 0, h2: 0, i2: 0, \ j2: 0, k2: 0)) # define CHECK_TYPE_ANY(...) VA_NARGS_CALL_OVERLOAD(_VA_CHECK_TYPE_ANY, __VA_ARGS__) +/* clang-format on */ #else # define CHECK_TYPE_ANY(...) (void)0 #endif @@ -396,6 +398,8 @@ * print(" %s: r " % (": r, ".join(args))) * \endcode */ +/* Over wrapped args. */ +/* clang-format off */ #define _VA_GENERIC_TYPE_ANY2(r, a0) \ a0: r #define _VA_GENERIC_TYPE_ANY3(r, a0, b0) \ @@ -673,6 +677,7 @@ q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \ g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r, t1: r, u1: r, v1: r, \ w1: r, x1: r, y1: r, z1: r, a2: r, b2: r, c2: r, d2: r, e2: r, f2: r, g2: r, h2: r, i2: r, j2: r, k2: r +/* clang-format on */ # define GENERIC_TYPE_ANY(...) VA_NARGS_CALL_OVERLOAD(_VA_GENERIC_TYPE_ANY, __VA_ARGS__) diff --git a/source/blender/blenlib/BLI_math_rotation.h b/source/blender/blenlib/BLI_math_rotation.h index 60adcf8c762..0c5b06b7c38 100644 --- a/source/blender/blenlib/BLI_math_rotation.h +++ b/source/blender/blenlib/BLI_math_rotation.h @@ -169,7 +169,7 @@ typedef enum eEulerRotationOrders { EULER_ORDER_YXZ, EULER_ORDER_YZX, EULER_ORDER_ZXY, - EULER_ORDER_ZYX + EULER_ORDER_ZYX, /* there are 6 more entries with dulpicate entries included */ } eEulerRotationOrders; diff --git a/source/blender/blenlib/BLI_string_cursor_utf8.h b/source/blender/blenlib/BLI_string_cursor_utf8.h index 7e8305ceacc..4037b403712 100644 --- a/source/blender/blenlib/BLI_string_cursor_utf8.h +++ b/source/blender/blenlib/BLI_string_cursor_utf8.h @@ -27,12 +27,12 @@ typedef enum eStrCursorJumpType { STRCUR_JUMP_NONE, STRCUR_JUMP_DELIM, - STRCUR_JUMP_ALL + STRCUR_JUMP_ALL, } eStrCursorJumpType; typedef enum eStrCursorJumpDirection { STRCUR_DIR_PREV, - STRCUR_DIR_NEXT + STRCUR_DIR_NEXT, } eStrCursorJumpDirection; bool BLI_str_cursor_step_next_utf8(const char *str, size_t maxlen, int *pos); diff --git a/source/blender/blenlib/BLI_task.h b/source/blender/blenlib/BLI_task.h index b5fc909d842..805a8599829 100644 --- a/source/blender/blenlib/BLI_task.h +++ b/source/blender/blenlib/BLI_task.h @@ -72,7 +72,7 @@ int BLI_task_scheduler_num_threads(TaskScheduler *scheduler); typedef enum TaskPriority { TASK_PRIORITY_LOW, - TASK_PRIORITY_HIGH + TASK_PRIORITY_HIGH, } TaskPriority; typedef struct TaskPool TaskPool; diff --git a/source/blender/blenlib/BLI_timecode.h b/source/blender/blenlib/BLI_timecode.h index 80f4a2d1927..97851a5af90 100644 --- a/source/blender/blenlib/BLI_timecode.h +++ b/source/blender/blenlib/BLI_timecode.h @@ -27,7 +27,7 @@ #include "BLI_compiler_attrs.h" size_t BLI_timecode_string_from_time( - char *str, const size_t len, const int power, const float time_seconds, + char *str, const size_t len, const int brevity_level, const float time_seconds, const double scene_fps, const short timecode_style) ATTR_NONNULL(); @@ -36,7 +36,7 @@ size_t BLI_timecode_string_from_time_simple( ATTR_NONNULL(); size_t BLI_timecode_string_from_time_seconds( - char *str, const size_t len, const int power, const float time_seconds) + char *str, const size_t len, const int brevity_level, const float time_seconds) ATTR_NONNULL(); #endif /* __BLI_TIMECODE_H__ */ diff --git a/source/blender/blenlib/BLI_utildefines_variadic.h b/source/blender/blenlib/BLI_utildefines_variadic.h index 3048b814383..658733c80dc 100644 --- a/source/blender/blenlib/BLI_utildefines_variadic.h +++ b/source/blender/blenlib/BLI_utildefines_variadic.h @@ -21,6 +21,9 @@ * \ingroup bli */ +/* Over wrapped args. */ +/* clang-format off */ + /* --- internal helpers --- */ #define _VA_NARGS_GLUE(x, y) x y #define _VA_NARGS_RETURN_COUNT(\ @@ -43,4 +46,6 @@ #define VA_NARGS_CALL_OVERLOAD(name, ...) \ _VA_NARGS_GLUE(_VA_NARGS_OVERLOAD_MACRO(name, VA_NARGS_COUNT(__VA_ARGS__)), (__VA_ARGS__)) +/* clang-format on */ + #endif /* __BLI_UTILDEFINES_VARIADIC_H__ */ diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt index 33ddf9367f4..8bcf4940538 100644 --- a/source/blender/blenlib/CMakeLists.txt +++ b/source/blender/blenlib/CMakeLists.txt @@ -251,6 +251,10 @@ set(SRC ) set(LIB + bf_intern_eigen + bf_intern_guardedalloc + bf_intern_numaapi + extern_wcwidth ) if(WITH_MEM_VALGRIND) @@ -261,6 +265,9 @@ if(WIN32) list(APPEND INC ../../../intern/utfconv ) + list(APPEND LIB + bf_intern_utfconv + ) endif() # no need to compile object files for inline headers. diff --git a/source/blender/blenlib/intern/BLI_timer.c b/source/blender/blenlib/intern/BLI_timer.c index 5fcdd85ba69..77409015aa6 100644 --- a/source/blender/blenlib/intern/BLI_timer.c +++ b/source/blender/blenlib/intern/BLI_timer.c @@ -172,7 +172,7 @@ static bCallbackFuncStore load_pre_callback = { NULL, NULL, /* next, prev */ remove_non_persistent_functions, /* func */ NULL, /* arg */ - 0 /* alloc */ + 0, /* alloc */ }; static void ensure_callback_is_registered() diff --git a/source/blender/blenlib/intern/fnmatch.c b/source/blender/blenlib/intern/fnmatch.c index 9ba2cdbf2e6..c0675e8c4d6 100644 --- a/source/blender/blenlib/intern/fnmatch.c +++ b/source/blender/blenlib/intern/fnmatch.c @@ -19,6 +19,10 @@ #ifdef WIN32 + +/* Maintained by GLIBC. */ +/* clang-format off */ + /* Enable GNU extensions in fnmatch.h. */ #ifndef _GNU_SOURCE # define _GNU_SOURCE 1 @@ -237,6 +241,8 @@ fnmatch (const char *pattern, const char *string, int flags) #endif /* _LIBC or not __GNU_LIBRARY__. */ +/* clang-format on */ + #else /* intentionally empty for UNIX */ diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index dc5ee984c25..33cd844f851 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -881,6 +881,7 @@ bool BLI_path_frame_get(char *path, int *r_frame, int *r_numdigits) void BLI_path_frame_strip(char *path, char *r_ext) { + *r_ext = '\0'; if (*path == '\0') { return; } diff --git a/source/blender/blenlib/intern/sort.c b/source/blender/blenlib/intern/sort.c index 921eec5ddc4..07c85e6ba7b 100644 --- a/source/blender/blenlib/intern/sort.c +++ b/source/blender/blenlib/intern/sort.c @@ -35,6 +35,9 @@ # undef min #endif +/* Maintained by FreeBSD. */ +/* clang-format off */ + /** * qsort, copied from FreeBSD source. * with only very minor edits, see: @@ -177,4 +180,6 @@ loop: } } +/* clang-format on */ + #endif /* __GLIBC__ */ diff --git a/source/blender/blenlib/intern/string_cursor_utf8.c b/source/blender/blenlib/intern/string_cursor_utf8.c index 8048ebe7052..8839661dea2 100644 --- a/source/blender/blenlib/intern/string_cursor_utf8.c +++ b/source/blender/blenlib/intern/string_cursor_utf8.c @@ -41,7 +41,7 @@ typedef enum eStrCursorDelimType { STRCUR_DELIM_OPERATOR, STRCUR_DELIM_QUOTE, STRCUR_DELIM_WHITESPACE, - STRCUR_DELIM_OTHER + STRCUR_DELIM_OTHER, } eStrCursorDelimType; static eStrCursorDelimType cursor_delim_type_unicode(const uint uch) diff --git a/source/blender/blenlib/intern/timecode.c b/source/blender/blenlib/intern/timecode.c index d87f1037254..53d0347d088 100644 --- a/source/blender/blenlib/intern/timecode.c +++ b/source/blender/blenlib/intern/timecode.c @@ -41,7 +41,7 @@ * * \param str: destination string * \param maxncpy: maximum number of characters to copy ``sizeof(str)`` - * \param power: special setting for #View2D grid drawing, + * \param brevity_level: special setting for #View2D grid drawing, * used to specify how detailed we need to be * \param time_seconds: time total time in seconds * \param fps: frames per second, typically from the #FPS macro @@ -50,7 +50,7 @@ */ size_t BLI_timecode_string_from_time( - char *str, const size_t maxncpy, const int power, const float time_seconds, + char *str, const size_t maxncpy, const int brevity_level, const float time_seconds, const double fps, const short timecode_style) { int hours = 0, minutes = 0, seconds = 0, frames = 0; @@ -81,7 +81,7 @@ size_t BLI_timecode_string_from_time( time = fmodf(time, 60); } - if (power <= 0) { + if (brevity_level <= 0) { /* seconds + frames * Frames are derived from 'fraction' of second. We need to perform some additional rounding * to cope with 'half' frames, etc., which should be fine in most cases @@ -103,7 +103,7 @@ size_t BLI_timecode_string_from_time( * (using separator of '+' for frames). * When showing frames, use slightly different display to avoid confusion with mm:ss format */ - if (power <= 0) { + if (brevity_level <= 0) { /* include "frames" in display */ if (hours) { rlen = BLI_snprintf_rlen(str, maxncpy, "%s%02d:%02d:%02d+%02d", neg, hours, minutes, seconds, frames); @@ -143,7 +143,7 @@ size_t BLI_timecode_string_from_time( /* reduced SMPTE. Instead of frames, milliseconds are shown */ /* precision of decimal part */ - const int ms_dp = (power <= 0) ? (1 - power) : 1; + const int ms_dp = (brevity_level <= 0) ? (1 - brevity_level) : 1; /* to get 2 digit whole-number part for seconds display * (i.e. 3 is for 2 digits + radix, on top of full length) */ @@ -163,7 +163,7 @@ size_t BLI_timecode_string_from_time( * are separated by a comma, not a dot... */ /* precision of decimal part */ - const int ms_dp = (power <= 0) ? (1 - power) : 1; + const int ms_dp = (brevity_level <= 0) ? (1 - brevity_level) : 1; const int ms = round_fl_to_int((time - (float)seconds) * 1000.0f); rlen = BLI_snprintf_rlen( @@ -173,9 +173,9 @@ size_t BLI_timecode_string_from_time( case USER_TIMECODE_SECONDS_ONLY: { /* only show the original seconds display */ - /* round to whole numbers if power is >= 1 (i.e. scale is coarse) */ - if (power <= 0) { - rlen = BLI_snprintf_rlen(str, maxncpy, "%.*f", 1 - power, time_seconds); + /* round to whole numbers if brevity_level is >= 1 (i.e. scale is coarse) */ + if (brevity_level <= 0) { + rlen = BLI_snprintf_rlen(str, maxncpy, "%.*f", 1 - brevity_level, time_seconds); } else { rlen = BLI_snprintf_rlen(str, maxncpy, "%d", round_fl_to_int(time_seconds)); @@ -228,7 +228,7 @@ size_t BLI_timecode_string_from_time_simple( * * \param str: destination string * \param maxncpy: maximum number of characters to copy ``sizeof(str)`` - * \param power: special setting for #View2D grid drawing, + * \param brevity_level: special setting for #View2D grid drawing, * used to specify how detailed we need to be * \param time_seconds: time total time in seconds * \return length of \a str @@ -236,13 +236,13 @@ size_t BLI_timecode_string_from_time_simple( * \note in some cases this is used to print non-seconds values. */ size_t BLI_timecode_string_from_time_seconds( - char *str, const size_t maxncpy, const int power, const float time_seconds) + char *str, const size_t maxncpy, const int brevity_level, const float time_seconds) { size_t rlen; - /* round to whole numbers if power is >= 1 (i.e. scale is coarse) */ - if (power <= 0) { - rlen = BLI_snprintf_rlen(str, maxncpy, "%.*f", 1 - power, time_seconds); + /* round to whole numbers if brevity_level is >= 1 (i.e. scale is coarse) */ + if (brevity_level <= 0) { + rlen = BLI_snprintf_rlen(str, maxncpy, "%.*f", 1 - brevity_level, time_seconds); } else { rlen = BLI_snprintf_rlen(str, maxncpy, "%d", round_fl_to_int(time_seconds)); diff --git a/source/blender/blenloader/CMakeLists.txt b/source/blender/blenloader/CMakeLists.txt index 26d1ee14856..ffb77a02aa1 100644 --- a/source/blender/blenloader/CMakeLists.txt +++ b/source/blender/blenloader/CMakeLists.txt @@ -68,6 +68,8 @@ set(SRC ) set(LIB + bf_blenkernel + bf_blenlib ) if(WITH_BUILDINFO) diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index ce2345b44db..528bfd2360f 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -3110,9 +3110,53 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) } } } + + /* init grease pencil brush gradients */ + if (!DNA_struct_elem_find(fd->filesdna, "BrushGpencilSettings", "float", "gradient_f")) { + for (Brush *brush = bmain->brushes.first; brush; brush = brush->id.next) { + if (brush->gpencil_settings != NULL) { + BrushGpencilSettings *gp = brush->gpencil_settings; + gp->gradient_f = 1.0f; + gp->gradient_s[0] = 1.0f; + gp->gradient_s[1] = 1.0f; + } + } + } + + /* init grease pencil stroke gradients */ + if (!DNA_struct_elem_find(fd->filesdna, "bGPDstroke", "float", "gradient_f")) { + for (bGPdata *gpd = bmain->gpencils.first; gpd; gpd = gpd->id.next) { + for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) { + for (bGPDframe *gpf = gpl->frames.first; gpf; gpf = gpf->next) { + for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) { + gps->gradient_f = 1.0f; + gps->gradient_s[0] = 1.0f; + gps->gradient_s[1] = 1.0f; + } + } + } + } + } } { + if (!DNA_struct_elem_find(fd->filesdna, "bSplineIKConstraint", "short", "yScaleMode")) { + for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) { + if (ob->pose) { + for (bPoseChannel *pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) { + for (bConstraint *con = pchan->constraints.first; con; con = con->next) { + if (con->type == CONSTRAINT_TYPE_SPLINEIK) { + bSplineIKConstraint *data = (bSplineIKConstraint *)con->data; + if ((data->flag & CONSTRAINT_SPLINEIK_SCALE_LIMITED) == 0) { + data->yScaleMode = CONSTRAINT_SPLINEIK_YS_FIT_CURVE; + } + } + } + } + } + } + } + /* Versioning code until next subversion bump goes here. */ } } diff --git a/source/blender/blentranslation/CMakeLists.txt b/source/blender/blentranslation/CMakeLists.txt index 2a397af051d..5bb35d79373 100644 --- a/source/blender/blentranslation/CMakeLists.txt +++ b/source/blender/blentranslation/CMakeLists.txt @@ -40,10 +40,15 @@ set(SRC ) set(LIB + bf_blenkernel + bf_blenlib ) if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) + list(APPEND LIB + bf_intern_locale + ) endif() if(WITH_PYTHON) diff --git a/source/blender/bmesh/CMakeLists.txt b/source/blender/bmesh/CMakeLists.txt index be6c819bc1f..04e44585a4f 100644 --- a/source/blender/bmesh/CMakeLists.txt +++ b/source/blender/bmesh/CMakeLists.txt @@ -164,6 +164,9 @@ set(SRC ) set(LIB + bf_blenkernel + bf_blenlib + extern_rangetree ) if(MSVC AND NOT MSVC_CLANG) @@ -171,10 +174,13 @@ if(MSVC AND NOT MSVC_CLANG) endif() if(WITH_BULLET) - add_definitions(-DWITH_BULLET) list(APPEND INC_SYS ${BULLET_INCLUDE_DIRS} ) + list(APPEND LIB + extern_bullet + ) + add_definitions(-DWITH_BULLET) endif() if(WITH_INTERNATIONAL) diff --git a/source/blender/bmesh/intern/bmesh_iterators.c b/source/blender/bmesh/intern/bmesh_iterators.c index 2f9eeac83e9..31e0fc00f59 100644 --- a/source/blender/bmesh/intern/bmesh_iterators.c +++ b/source/blender/bmesh/intern/bmesh_iterators.c @@ -44,7 +44,7 @@ const char bm_iter_itype_htype_map[BM_ITYPE_MAX] = { BM_EDGE, /* BM_EDGES_OF_FACE */ BM_LOOP, /* BM_LOOPS_OF_FACE */ BM_LOOP, /* BM_LOOPS_OF_LOOP */ - BM_LOOP /* BM_LOOPS_OF_EDGE */ + BM_LOOP, /* BM_LOOPS_OF_EDGE */ }; /** diff --git a/source/blender/bmesh/intern/bmesh_mods.h b/source/blender/bmesh/intern/bmesh_mods.h index ce0234ed61f..425770a8c32 100644 --- a/source/blender/bmesh/intern/bmesh_mods.h +++ b/source/blender/bmesh/intern/bmesh_mods.h @@ -78,7 +78,7 @@ enum { BM_EDGEROT_CHECK_EXISTS = (1 << 0), /* disallow to rotate when the new edge matches an existing one */ BM_EDGEROT_CHECK_SPLICE = (1 << 1), /* overrides existing check, if the edge already, rotate and merge them */ BM_EDGEROT_CHECK_DEGENERATE = (1 << 2), /* disallow creating bow-tie, concave or zero area faces */ - BM_EDGEROT_CHECK_BEAUTY = (1 << 3) /* disallow to rotate into ugly topology */ + BM_EDGEROT_CHECK_BEAUTY = (1 << 3), /* disallow to rotate into ugly topology */ }; diff --git a/source/blender/bmesh/intern/bmesh_opdefines.c b/source/blender/bmesh/intern/bmesh_opdefines.c index 0ed1338e62f..4ca8e02e94d 100644 --- a/source/blender/bmesh/intern/bmesh_opdefines.c +++ b/source/blender/bmesh/intern/bmesh_opdefines.c @@ -90,6 +90,9 @@ * note that '//' comments are ignored. */ +/* Keep struct definition from wrapping. */ +/* clang-format off */ + /* enums shared between multiple operators */ static BMO_FlagSet bmo_enum_axis_xyz[] = { @@ -2067,6 +2070,8 @@ static BMOpDefine bmo_symmetrize_def = { BMO_OPTYPE_FLAG_SELECT_VALIDATE), }; +/* clang-format on */ + const BMOpDefine *bmo_opdefines[] = { &bmo_automerge_def, &bmo_average_vert_facedata_def, diff --git a/source/blender/bmesh/intern/bmesh_operators.c b/source/blender/bmesh/intern/bmesh_operators.c index 5586db26664..fb6edbecaed 100644 --- a/source/blender/bmesh/intern/bmesh_operators.c +++ b/source/blender/bmesh/intern/bmesh_operators.c @@ -68,7 +68,7 @@ const int BMO_OPSLOT_TYPEINFO[BMO_OP_SLOT_TOTAL_TYPES] = { 0, /* 7: unused */ sizeof(float) * 3, /* 8: BMO_OP_SLOT_VEC */ sizeof(void *), /* 9: BMO_OP_SLOT_ELEMENT_BUF */ - sizeof(void *) /* 10: BMO_OP_SLOT_MAPPING */ + sizeof(void *), /* 10: BMO_OP_SLOT_MAPPING */ }; /* Dummy slot so there is something to return when slot name lookup fails */ diff --git a/source/blender/bmesh/intern/bmesh_walkers.h b/source/blender/bmesh/intern/bmesh_walkers.h index fc911957f71..3de7d6d2c90 100644 --- a/source/blender/bmesh/intern/bmesh_walkers.h +++ b/source/blender/bmesh/intern/bmesh_walkers.h @@ -27,7 +27,7 @@ typedef enum { BMW_DEPTH_FIRST, - BMW_BREADTH_FIRST + BMW_BREADTH_FIRST, } BMWOrder; typedef enum { diff --git a/source/blender/bmesh/tools/bmesh_wireframe.c b/source/blender/bmesh/tools/bmesh_wireframe.c index 10db05fad98..82fc4b2334e 100644 --- a/source/blender/bmesh/tools/bmesh_wireframe.c +++ b/source/blender/bmesh/tools/bmesh_wireframe.c @@ -329,7 +329,8 @@ void BM_mesh_wireframe( } BM_ITER_ELEM (l, &itersub, f_src, BM_LOOPS_OF_FACE) { - BM_elem_index_set(l, verts_loop_tot); /* set_dirty */ /* Because some faces might be skipped! */ + /* Because some faces might be skipped! */ + BM_elem_index_set(l, verts_loop_tot); /* set_dirty */ BM_loop_calc_face_tangent(l, tvec); diff --git a/source/blender/collada/AnimationExporter.h b/source/blender/collada/AnimationExporter.h index 7af4777331d..fa0640c73e8 100644 --- a/source/blender/collada/AnimationExporter.h +++ b/source/blender/collada/AnimationExporter.h @@ -84,7 +84,7 @@ struct Depsgraph; typedef enum BC_animation_source_type { BC_SOURCE_TYPE_VALUE, BC_SOURCE_TYPE_ANGLE, - BC_SOURCE_TYPE_TIMEFRAME + BC_SOURCE_TYPE_TIMEFRAME, } BC_animation_source_type; class AnimationExporter: COLLADASW::LibraryAnimations diff --git a/source/blender/collada/BCAnimationCurve.h b/source/blender/collada/BCAnimationCurve.h index 234fecd6833..c01b3150dba 100644 --- a/source/blender/collada/BCAnimationCurve.h +++ b/source/blender/collada/BCAnimationCurve.h @@ -47,7 +47,7 @@ typedef enum BC_animation_type { BC_ANIMATION_TYPE_BONE, BC_ANIMATION_TYPE_CAMERA, BC_ANIMATION_TYPE_MATERIAL, - BC_ANIMATION_TYPE_LIGHT + BC_ANIMATION_TYPE_LIGHT, } BC_animation_type; class BCCurveKey { diff --git a/source/blender/collada/ExportSettings.h b/source/blender/collada/ExportSettings.h index d0a7a76f6aa..43dccef658b 100644 --- a/source/blender/collada/ExportSettings.h +++ b/source/blender/collada/ExportSettings.h @@ -29,18 +29,18 @@ extern "C" { typedef enum BC_export_mesh_type { BC_MESH_TYPE_VIEW, - BC_MESH_TYPE_RENDER + BC_MESH_TYPE_RENDER, } BC_export_mesh_type; typedef enum BC_export_transformation_type { BC_TRANSFORMATION_TYPE_MATRIX, - BC_TRANSFORMATION_TYPE_TRANSROTLOC + BC_TRANSFORMATION_TYPE_TRANSROTLOC, } BC_export_transformation_type; typedef enum BC_export_animation_type { BC_ANIMATION_EXPORT_SAMPLES, - BC_ANIMATION_EXPORT_KEYS + BC_ANIMATION_EXPORT_KEYS, } BC_export_animation_type; typedef enum BC_ui_export_section { @@ -48,7 +48,7 @@ typedef enum BC_ui_export_section { BC_UI_SECTION_GEOMETRY, BC_UI_SECTION_ARMATURE, BC_UI_SECTION_ANIMATION, - BC_UI_SECTION_COLLADA + BC_UI_SECTION_COLLADA, } BC_ui_export_section; typedef struct ExportSettings { diff --git a/source/blender/collada/ImageExporter.cpp b/source/blender/collada/ImageExporter.cpp index b4814abf513..a36abc6165d 100644 --- a/source/blender/collada/ImageExporter.cpp +++ b/source/blender/collada/ImageExporter.cpp @@ -49,6 +49,7 @@ ImagesExporter::ImagesExporter(COLLADASW::StreamWriter *sw, const ExportSettings export_settings(export_settings), key_image_map(key_image_map) { + /* pass */ } void ImagesExporter::export_UV_Image(Image *image, bool use_copies) diff --git a/source/blender/collada/MeshImporter.cpp b/source/blender/collada/MeshImporter.cpp index 6f87b6613b7..07cf7448a75 100644 --- a/source/blender/collada/MeshImporter.cpp +++ b/source/blender/collada/MeshImporter.cpp @@ -205,7 +205,9 @@ MeshImporter::MeshImporter(UnitConverter *unitconv, ArmatureImporter *arm, Main m_bmain(bmain), scene(sce), view_layer(view_layer), - armature_importer(arm) { + armature_importer(arm) +{ + /* pass */ } bool MeshImporter::set_poly_indices(MPoly *mpoly, MLoop *mloop, int loop_index, unsigned int *indices, int loop_count) diff --git a/source/blender/compositor/CMakeLists.txt b/source/blender/compositor/CMakeLists.txt index 67e7afefcd3..2b03b713e3c 100644 --- a/source/blender/compositor/CMakeLists.txt +++ b/source/blender/compositor/CMakeLists.txt @@ -540,6 +540,9 @@ set(SRC ) set(LIB + bf_blenkernel + bf_blenlib + extern_clew ) list(APPEND INC diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.h b/source/blender/compositor/intern/COM_MemoryBuffer.h index 9f3928cd863..63897da0b8a 100644 --- a/source/blender/compositor/intern/COM_MemoryBuffer.h +++ b/source/blender/compositor/intern/COM_MemoryBuffer.h @@ -46,7 +46,7 @@ typedef enum MemoryBufferState { typedef enum MemoryBufferExtend { COM_MB_CLIP, COM_MB_EXTEND, - COM_MB_REPEAT + COM_MB_REPEAT, } MemoryBufferExtend; class MemoryProxy; diff --git a/source/blender/compositor/operations/COM_MovieClipAttributeOperation.h b/source/blender/compositor/operations/COM_MovieClipAttributeOperation.h index 3b720ff839a..a73167352d3 100644 --- a/source/blender/compositor/operations/COM_MovieClipAttributeOperation.h +++ b/source/blender/compositor/operations/COM_MovieClipAttributeOperation.h @@ -25,7 +25,7 @@ typedef enum MovieClipAttribute { MCA_SCALE, MCA_X, MCA_Y, - MCA_ANGLE + MCA_ANGLE, } MovieClipAttribute; /** * this program converts an input color to an output value. diff --git a/source/blender/compositor/operations/COM_QualityStepHelper.h b/source/blender/compositor/operations/COM_QualityStepHelper.h index 593124ad0d3..9cc971f1fe0 100644 --- a/source/blender/compositor/operations/COM_QualityStepHelper.h +++ b/source/blender/compositor/operations/COM_QualityStepHelper.h @@ -22,7 +22,7 @@ typedef enum QualityHelper { COM_QH_INCREASE, - COM_QH_MULTIPLY + COM_QH_MULTIPLY, } QualityHelper; class QualityStepHelper { diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc index 9fd4a8dc802..9d36e9495e3 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc @@ -578,6 +578,18 @@ void DepsgraphRelationBuilder::build_proxy_rig(Object *object) "Bone Done -> Bone Done"); } + /* Parent relation: even though the proxy bone itself doesn't need + * the parent bone, some users expect the parent to be ready if the + * bone itself is (e.g. for computing the local space matrix). + */ + if (pchan->parent != NULL) { + OperationKey parent_key(&object->id, + NodeType::BONE, + pchan->parent->name, + OperationCode::BONE_DONE); + add_relation(parent_key, bone_done_key, "Parent Bone -> Child Bone"); + } + if (pchan->prop != NULL) { OperationKey bone_parameters(&object->id, NodeType::PARAMETERS, diff --git a/source/blender/draw/CMakeLists.txt b/source/blender/draw/CMakeLists.txt index fe9b3d1f629..91ea4d79a32 100644 --- a/source/blender/draw/CMakeLists.txt +++ b/source/blender/draw/CMakeLists.txt @@ -152,6 +152,9 @@ set(SRC ) set(LIB + bf_blenkernel + bf_blenlib + bf_windowmanager ) data_to_c_simple(engines/eevee/shaders/ambient_occlusion_lib.glsl SRC) diff --git a/source/blender/draw/engines/eevee/eevee_private.h b/source/blender/draw/engines/eevee/eevee_private.h index 66e45430e18..5f073d45dfb 100644 --- a/source/blender/draw/engines/eevee/eevee_private.h +++ b/source/blender/draw/engines/eevee/eevee_private.h @@ -59,6 +59,8 @@ extern struct DrawEngineType draw_engine_eevee_type; # define SHADER_IRRADIANCE "#define IRRADIANCE_HL2\n" #endif +/* Macro causes over indentation. */ +/* clang-format off */ #define SHADER_DEFINES \ "#define EEVEE_ENGINE\n" \ "#define MAX_PROBE " STRINGIFY(MAX_PROBE) "\n" \ @@ -70,6 +72,7 @@ extern struct DrawEngineType draw_engine_eevee_type; "#define MAX_SHADOW_CASCADE " STRINGIFY(MAX_SHADOW_CASCADE) "\n" \ "#define MAX_CASCADE_NUM " STRINGIFY(MAX_CASCADE_NUM) "\n" \ SHADER_IRRADIANCE +/* clang-format on */ #define SWAP_DOUBLE_BUFFERS() { \ if (effects->swap_double_buffer) { \ diff --git a/source/blender/draw/engines/eevee/eevee_subsurface.c b/source/blender/draw/engines/eevee/eevee_subsurface.c index 8abbaa64fd2..fe8c2f1e107 100644 --- a/source/blender/draw/engines/eevee/eevee_subsurface.c +++ b/source/blender/draw/engines/eevee/eevee_subsurface.c @@ -253,11 +253,14 @@ void EEVEE_subsurface_add_pass( DRW_shgroup_uniform_texture(grp, "utilTex", EEVEE_materials_get_util_tex()); DRW_shgroup_uniform_texture_ref(grp, "depthBuffer", depth_src); DRW_shgroup_uniform_texture_ref(grp, "sssData", &effects->sss_blur); - DRW_shgroup_uniform_texture_ref(grp, "sssAlbedo", &effects->sss_albedo); DRW_shgroup_uniform_block(grp, "sssProfile", sss_profile); DRW_shgroup_uniform_block(grp, "common_block", sldata->common_ubo); DRW_shgroup_stencil_mask(grp, sss_id); DRW_shgroup_call_add(grp, quad, NULL); + + if (effects->sss_separate_albedo) { + DRW_shgroup_uniform_texture_ref(grp, "sssAlbedo", &effects->sss_albedo); + } } } diff --git a/source/blender/draw/engines/eevee/eevee_volumes.c b/source/blender/draw/engines/eevee/eevee_volumes.c index b752aae99f4..245774f5508 100644 --- a/source/blender/draw/engines/eevee/eevee_volumes.c +++ b/source/blender/draw/engines/eevee/eevee_volumes.c @@ -57,6 +57,9 @@ static struct { GPUTexture *color_src; GPUTexture *depth_src; + GPUTexture *dummy_density; + GPUTexture *dummy_flame; + /* List of all smoke domains rendered within this frame. */ ListBase smoke_domains; } e_data = {NULL}; /* Engine data */ @@ -126,6 +129,12 @@ static void eevee_create_shader_volumes(void) datatoc_common_fullscreen_vert_glsl, NULL, datatoc_volumetric_resolve_frag_glsl, e_data.volumetric_common_lib, NULL); + + float color[4] = {1.0f, 1.0f, 1.0f, 1.0f}; + e_data.dummy_density = DRW_texture_create_3d(1, 1, 1, GPU_RGBA8, DRW_TEX_WRAP, color); + + float flame = 0.0f; + e_data.dummy_flame = DRW_texture_create_3d(1, 1, 1, GPU_R8, DRW_TEX_WRAP, &flame); } void EEVEE_volumes_set_jitter(EEVEE_ViewLayerData *sldata, uint current_sample) @@ -406,6 +415,11 @@ void EEVEE_volumes_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) DRW_shgroup_uniform_block(grp, "planar_block", sldata->planar_ubo); DRW_shgroup_uniform_block(grp, "light_block", sldata->light_ubo); DRW_shgroup_uniform_block(grp, "shadow_block", sldata->shadow_ubo); + + /* Fix principle volumetric not working with world materials. */ + DRW_shgroup_uniform_texture(grp, "sampdensity", e_data.dummy_density); + DRW_shgroup_uniform_texture(grp, "sampflame", e_data.dummy_flame); + DRW_shgroup_uniform_vec2(grp, "unftemperature", (float[2]){0.0f, 1.0f}, 1); } } @@ -468,6 +482,7 @@ typedef struct EEVEE_InstanceVolumeMatrix { void EEVEE_volumes_cache_object_add(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, Scene *scene, Object *ob) { const DRWContextState *draw_ctx = DRW_context_state_get(); + static float white[3] = {1.0f, 1.0f, 1.0f}; float *texcoloc = NULL; float *texcosize = NULL; @@ -522,15 +537,12 @@ void EEVEE_volumes_cache_object_add(EEVEE_ViewLayerData *sldata, EEVEE_Data *ved /* Smoke Simulation */ if (((ob->base_flag & BASE_FROM_DUPLI) == 0) && (md = modifiers_findByType(ob, eModifierType_Smoke)) && - (modifier_isEnabled(scene, md, eModifierMode_Realtime))) + (modifier_isEnabled(scene, md, eModifierMode_Realtime)) && + ((SmokeModifierData *)md)->domain != NULL) { SmokeModifierData *smd = (SmokeModifierData *)md; SmokeDomainSettings *sds = smd->domain; - if (sds == NULL) { - return; - } - /* Don't show smoke before simulation starts, this could be made an option in the future. */ const bool show_smoke = ((int)DEG_get_ctime(draw_ctx->depsgraph) >= sds->point_cache[0]->startframe); @@ -545,15 +557,10 @@ void EEVEE_volumes_cache_object_add(EEVEE_ViewLayerData *sldata, EEVEE_Data *ved BLI_addtail(&e_data.smoke_domains, BLI_genericNodeN(smd)); } - if (sds->tex != NULL) { - DRW_shgroup_uniform_texture_ref(grp, "sampdensity", &sds->tex); - } - if (sds->tex_flame != NULL) { - DRW_shgroup_uniform_texture_ref(grp, "sampflame", &sds->tex_flame); - } + DRW_shgroup_uniform_texture_ref(grp, "sampdensity", sds->tex ? &sds->tex : &e_data.dummy_density); + DRW_shgroup_uniform_texture_ref(grp, "sampflame", sds->tex_flame ? &sds->tex_flame : &e_data.dummy_flame); /* Constant Volume color. */ - static float white[3] = {1.0f, 1.0f, 1.0f}; bool use_constant_color = ((sds->active_fields & SM_ACTIVE_COLORS) == 0 && (sds->active_fields & SM_ACTIVE_COLOR_SET) != 0); @@ -562,6 +569,12 @@ void EEVEE_volumes_cache_object_add(EEVEE_ViewLayerData *sldata, EEVEE_Data *ved /* Output is such that 0..1 maps to 0..1000K */ DRW_shgroup_uniform_vec2(grp, "unftemperature", &sds->flame_ignition, 1); } + else { + DRW_shgroup_uniform_texture(grp, "sampdensity", e_data.dummy_density); + DRW_shgroup_uniform_texture(grp, "sampflame", e_data.dummy_flame); + DRW_shgroup_uniform_vec3(grp, "volumeColor", white, 1); + DRW_shgroup_uniform_vec2(grp, "unftemperature", (float[2]){0.0f, 1.0f}, 1); + } } void EEVEE_volumes_compute(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *vedata) @@ -644,6 +657,9 @@ void EEVEE_volumes_free(void) MEM_SAFE_FREE(e_data.volumetric_common_lib); MEM_SAFE_FREE(e_data.volumetric_common_lights_lib); + DRW_TEXTURE_FREE_SAFE(e_data.dummy_density); + DRW_TEXTURE_FREE_SAFE(e_data.dummy_flame); + DRW_SHADER_FREE_SAFE(e_data.volumetric_clear_sh); DRW_SHADER_FREE_SAFE(e_data.volumetric_scatter_sh); DRW_SHADER_FREE_SAFE(e_data.volumetric_scatter_with_lights_sh); diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c index b72a6ebebbd..3bcc963c966 100644 --- a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c +++ b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c @@ -95,6 +95,7 @@ void DRW_gpencil_get_point_geom(GpencilBatchCacheElem *be, bGPDstroke *gps, shor be->color_id = GPU_vertformat_attr_add(&be->format, "color", GPU_COMP_F32, 4, GPU_FETCH_FLOAT); be->thickness_id = GPU_vertformat_attr_add(&be->format, "thickness", GPU_COMP_F32, 1, GPU_FETCH_FLOAT); be->uvdata_id = GPU_vertformat_attr_add(&be->format, "uvdata", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); + be->prev_pos_id = GPU_vertformat_attr_add(&be->format, "prev_pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); be->vbo = GPU_vertbuf_create_with_format(&be->format); GPU_vertbuf_data_alloc(be->vbo, be->tot_vertex); @@ -123,6 +124,26 @@ void DRW_gpencil_get_point_geom(GpencilBatchCacheElem *be, bGPDstroke *gps, shor GPU_vertbuf_attr_set(be->vbo, be->uvdata_id, be->vbo_len, uvdata); GPU_vertbuf_attr_set(be->vbo, be->pos_id, be->vbo_len, &pt->x); + + /* use previous point to determine stroke direction */ + bGPDspoint *pt2 = NULL; + if (i == 0) { + if (gps->totpoints > 1) { + /* extrapolate a point before first point */ + float fpt[3]; + pt2 = &gps->points[1]; + interp_v3_v3v3(fpt, &pt2->x, &pt->x, 1.5f); + GPU_vertbuf_attr_set(be->vbo, be->prev_pos_id, be->vbo_len, fpt); + } + else { + GPU_vertbuf_attr_set(be->vbo, be->prev_pos_id, be->vbo_len, &pt->x); + } + } + else { + pt2 = &gps->points[i - 1]; + GPU_vertbuf_attr_set(be->vbo, be->prev_pos_id, be->vbo_len, &pt2->x); + } + be->vbo_len++; } } diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c index 6aefd2a69c5..8ecee86d92b 100644 --- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c +++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c @@ -532,6 +532,10 @@ DRWShadingGroup *DRW_gpencil_shgroup_stroke_create( stl->shgroups[id].caps_mode[1] = gps->caps[1]; DRW_shgroup_uniform_int(grp, "caps_mode", &stl->shgroups[id].caps_mode[0], 2); + stl->shgroups[id].gradient_f = gps->gradient_f; + copy_v2_v2(stl->shgroups[id].gradient_s, gps->gradient_s); + DRW_shgroup_uniform_float(grp, "gradient_f", &stl->shgroups[id].gradient_f, 1); + /* viewport x-ray */ stl->shgroups[id].is_xray = (ob->dt == OB_WIRE) ? 1 : stl->storage->is_xray; DRW_shgroup_uniform_int(grp, "viewport_xray", (const int *)&stl->shgroups[id].is_xray, 1); @@ -565,6 +569,8 @@ DRWShadingGroup *DRW_gpencil_shgroup_stroke_create( const int zero[2] = { 0, 0 }; DRW_shgroup_uniform_int(grp, "caps_mode", &zero[0], 2); + DRW_shgroup_uniform_float(grp, "gradient_f", &stl->storage->gradient_f, 1); + /* viewport x-ray */ DRW_shgroup_uniform_int(grp, "viewport_xray", &stl->storage->is_xray, 1); DRW_shgroup_uniform_int(grp, "shading_type", (const int *)&stl->storage->shade_render, 2); @@ -611,7 +617,7 @@ DRWShadingGroup *DRW_gpencil_shgroup_stroke_create( /* create shading group for points */ static DRWShadingGroup *DRW_gpencil_shgroup_point_create( GPENCIL_e_data *e_data, GPENCIL_Data *vedata, DRWPass *pass, GPUShader *shader, Object *ob, - bGPdata *gpd, bGPDlayer *gpl, + bGPdata *gpd, bGPDlayer *gpl, bGPDstroke *gps, MaterialGPencilStyle *gp_style, int id, bool onion, const float scale, const int shading_type[2]) { @@ -651,6 +657,11 @@ static DRWShadingGroup *DRW_gpencil_shgroup_point_create( DRW_shgroup_uniform_int(grp, "mode", &stl->shgroups[id].mode, 1); DRW_shgroup_uniform_float(grp, "pixfactor", &gpd->pixfactor, 1); + stl->shgroups[id].gradient_f = gps->gradient_f; + copy_v2_v2(stl->shgroups[id].gradient_s, gps->gradient_s); + DRW_shgroup_uniform_float(grp, "gradient_f", &stl->shgroups[id].gradient_f, 1); + DRW_shgroup_uniform_vec2(grp, "gradient_s", stl->shgroups[id].gradient_s, 1); + /* viewport x-ray */ stl->shgroups[id].is_xray = (ob->dt == OB_WIRE) ? 1 : stl->storage->is_xray; DRW_shgroup_uniform_int(grp, "viewport_xray", (const int *)&stl->shgroups[id].is_xray, 1); @@ -684,6 +695,10 @@ static DRWShadingGroup *DRW_gpencil_shgroup_point_create( else { DRW_shgroup_uniform_float(grp, "pixfactor", &stl->storage->pixfactor, 1); } + + DRW_shgroup_uniform_float(grp, "gradient_f", &stl->storage->gradient_f, 1); + DRW_shgroup_uniform_vec2(grp, "gradient_s", stl->storage->gradient_s, 1); + /* viewport x-ray */ stl->shgroups[id].is_xray = ((ob) && (ob->dt == OB_WIRE)) ? 1 : stl->storage->is_xray; DRW_shgroup_uniform_int(grp, "viewport_xray", (const int *)&stl->shgroups[id].is_xray, 1); @@ -693,12 +708,21 @@ static DRWShadingGroup *DRW_gpencil_shgroup_point_create( if ((gpd) && (id > -1)) { stl->shgroups[id].xray_mode = (ob->dtx & OB_DRAWXRAY) ? GP_XRAY_FRONT : GP_XRAY_3DSPACE; DRW_shgroup_uniform_int(grp, "xraymode", (const int *)&stl->shgroups[id].xray_mode, 1); + + /* lock rotation of dots and boxes */ + stl->shgroups[id].use_follow_path = (gp_style->flag & GP_STYLE_COLOR_LOCK_DOTS) ? 0 : 1; + DRW_shgroup_uniform_int(grp, "use_follow_path", &stl->shgroups[id].use_follow_path, 1); } else { /* for drawing always on predefined z-depth */ DRW_shgroup_uniform_int(grp, "xraymode", &stl->storage->xray, 1); + + /* lock rotation of dots and boxes */ + DRW_shgroup_uniform_int(grp, "use_follow_path", &stl->storage->use_follow_path, 1); } + + /* image texture */ if ((gp_style) && (gp_style->stroke_style == GP_STYLE_STROKE_STYLE_TEXTURE) && (!onion)) { ImBuf *ibuf; @@ -1374,6 +1398,12 @@ void DRW_gpencil_populate_buffer_strokes(GPENCIL_e_data *e_data, void *vedata, T * i.e. tGPspoints NOT bGPDspoints */ short lthick = brush->size * obscale; + + /* save gradient info */ + stl->storage->gradient_f = brush->gpencil_settings->gradient_f; + copy_v2_v2(stl->storage->gradient_s, brush->gpencil_settings->gradient_s); + stl->storage->use_follow_path = (gp_style->flag & GP_STYLE_COLOR_LOCK_DOTS) ? 0 : 1; + /* if only one point, don't need to draw buffer because the user has no time to see it */ if (gpd->runtime.sbuffer_size > 1) { if ((gp_style) && (gp_style->mode == GP_STYLE_MODE_LINE)) { @@ -1385,7 +1415,7 @@ void DRW_gpencil_populate_buffer_strokes(GPENCIL_e_data *e_data, void *vedata, T else { stl->g_data->shgrps_drawing_stroke = DRW_gpencil_shgroup_point_create( e_data, vedata, psl->drawing_pass, e_data->gpencil_point_sh, NULL, - gpd, NULL, gp_style, -1, + gpd, NULL, NULL, gp_style, -1, false, 1.0f, (const int *)stl->storage->shade_render); } @@ -1582,7 +1612,7 @@ static void DRW_gpencil_shgroups_create( shgrp = DRW_gpencil_shgroup_point_create( e_data, vedata, stroke_pass, e_data->gpencil_point_sh, - ob, gpd, gpl, gp_style, stl->storage->shgroup_id, elm->onion, + ob, gpd, gpl, gps, gp_style, stl->storage->shgroup_id, elm->onion, scale, cache_ob->shading_type); DRW_shgroup_call_range_add( diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.h b/source/blender/draw/engines/gpencil/gpencil_engine.h index 8af74ec7451..5d0d2397f8d 100644 --- a/source/blender/draw/engines/gpencil/gpencil_engine.h +++ b/source/blender/draw/engines/gpencil/gpencil_engine.h @@ -119,6 +119,10 @@ typedef struct GPENCIL_shgroup { int caps_mode[2]; float obj_scale; int xray_mode; + int use_follow_path; + + float gradient_f; + float gradient_s[2]; /* color of the wireframe */ float wire_color[4]; @@ -164,6 +168,10 @@ typedef struct GPENCIL_Storage { bool simplify_fx; bool simplify_blend; + float gradient_f; + float gradient_s[2]; + int use_follow_path; + /* Render Matrices and data */ float persmat[4][4], persinv[4][4]; float viewmat[4][4], viewinv[4][4]; @@ -334,6 +342,7 @@ typedef struct GpencilBatchCacheElem { uint color_id; uint thickness_id; uint uvdata_id; + uint prev_pos_id; /* size for VBO alloc */ int tot_vertex; diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_point_frag.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_point_frag.glsl index a1285029e4c..ca8c888fe21 100644 --- a/source/blender/draw/engines/gpencil/shaders/gpencil_point_frag.glsl +++ b/source/blender/draw/engines/gpencil/shaders/gpencil_point_frag.glsl @@ -2,6 +2,9 @@ uniform int color_type; uniform int mode; uniform sampler2D myTexture; +uniform float gradient_f; +uniform vec2 gradient_s; + in vec4 mColor; in vec2 mTexCoord; out vec4 fragColor; @@ -17,15 +20,23 @@ out vec4 fragColor; #define GPENCIL_COLOR_TEXTURE 1 #define GPENCIL_COLOR_PATTERN 2 +/* Function to check the point inside ellipse */ +float checkpoint(vec2 pt, vec2 radius) +{ + float p = (pow(pt.x, 2) / pow(radius.x, 2)) + (pow(pt.y, 2) / pow(radius.y, 2)); + + return p; +} + void main() { vec2 centered = mTexCoord - vec2(0.5); - float dist_squared = dot(centered, centered); - const float rad_squared = 0.25; + float ellip = checkpoint(centered, vec2(gradient_s / 2.0)); - /* Round point with jaggy edges. */ - if ((mode != GPENCIL_MODE_BOX) && (dist_squared > rad_squared)) { - discard; + if (mode != GPENCIL_MODE_BOX) { + if (ellip > 1.0) { + discard; + } } vec4 tmp_color = texture2D(myTexture, mTexCoord); @@ -47,6 +58,15 @@ void main() /* mult both alpha factor to use strength factor with color alpha limit */ fragColor.a = min(text_color.a * mColor.a, mColor.a); } - if(fragColor.a < 0.0035) + + if ((mode == GPENCIL_MODE_DOTS) && (gradient_f < 1.0)) { + float dist = length(centered) * 2; + float decay = dist * (1.0 - gradient_f) * fragColor.a; + fragColor.a = clamp(fragColor.a - decay, 0.0, 1.0); + fragColor.a = fragColor.a * (1.0 - ellip); + } + + if(fragColor.a < 0.0035) { discard; + } } diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_point_geom.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_point_geom.glsl index 6c22633c521..32aaa057298 100644 --- a/source/blender/draw/engines/gpencil/shaders/gpencil_point_geom.glsl +++ b/source/blender/draw/engines/gpencil/shaders/gpencil_point_geom.glsl @@ -1,6 +1,7 @@ uniform mat4 ModelViewProjectionMatrix; uniform vec2 Viewport; uniform int xraymode; +uniform int use_follow_path; layout(points) in; layout(triangle_strip, max_vertices = 4) out; @@ -8,6 +9,7 @@ layout(triangle_strip, max_vertices = 4) out; in vec4 finalColor[1]; in float finalThickness[1]; in vec2 finaluvdata[1]; +in vec4 finalprev_pos[1]; out vec4 mColor; out vec2 mTexCoord; @@ -15,6 +17,10 @@ out vec2 mTexCoord; #define GP_XRAY_FRONT 0 #define GP_XRAY_3DSPACE 1 +#define M_PI 3.14159265358979323846 /* pi */ +#define M_2PI 6.28318530717958647692 /* 2*pi */ +#define FALSE 0 + /* project 3d point to 2d on screen space */ vec2 toScreenSpace(vec4 vertex) { @@ -45,33 +51,89 @@ vec2 rotateUV(vec2 uv, float angle) return rot_uv + vec2(0.5f, 0.5f); } +vec2 rotatePoint(vec2 center, vec2 point, float angle) +{ + /* translate center of rotation to the center */ + vec2 new_point = point - center; + vec2 rot_point; + rot_point.x = new_point.x * cos(angle) - new_point.y * sin(angle); + rot_point.y = new_point.y * cos(angle) + new_point.x * sin(angle); + return rot_point + center; +} + +/* Calculate angle of the stroke using previous point as reference. + * The angle is calculated using the x axis (1, 0) as 0 degrees */ +float getAngle(vec2 pt0, vec2 pt1) +{ + /* do not rotate one point only (no reference to rotate) */ + if (pt0 == pt1) { + return 0.0; + } + + if (use_follow_path == FALSE) { + return 0.0; + } + + /* default horizontal line (x-axis) in screen space */ + vec2 v0 = vec2(1.0, 0.0); + + /* vector of direction */ + vec2 vn = vec2(normalize(pt1 - pt0)); + + /* angle signed (function ported from angle_signed_v2v2) */ + float perp_dot = (v0[1] * vn[0]) - (v0[0] * vn[1]); + float angle = atan(perp_dot, dot(v0, vn)); + + /* get full circle rotation */ + if (angle > 0.0) { + angle = M_PI + (M_PI - angle); + } + else { + angle *= -1.0; + } + + return angle; +} + void main(void) { - /* receive 4 points */ + /* receive points */ vec4 P0 = gl_in[0].gl_Position; vec2 sp0 = toScreenSpace(P0); + vec4 P1 = finalprev_pos[0]; + vec2 sp1 = toScreenSpace(P1); + vec2 point; + float size = finalThickness[0]; - float aspect = 1.0; + vec2 center = vec2(sp0.x, sp0.y); + + /* get angle of stroke to rotate texture */ + float angle = getAngle(sp0, sp1); + /* generate the triangle strip */ mTexCoord = rotateUV(vec2(0, 1), finaluvdata[0].y); mColor = finalColor[0]; - gl_Position = vec4(vec2(sp0.x - size, sp0.y + size * aspect) / Viewport, getZdepth(P0), 1.0); + point = rotatePoint(center, vec2(sp0.x - size, sp0.y + size), angle); + gl_Position = vec4(point / Viewport, getZdepth(P0), 1.0); EmitVertex(); mTexCoord = rotateUV(vec2(0, 0), finaluvdata[0].y); mColor = finalColor[0]; - gl_Position = vec4(vec2(sp0.x - size, sp0.y - size * aspect) / Viewport, getZdepth(P0), 1.0); + point = rotatePoint(center, vec2(sp0.x - size, sp0.y - size), angle); + gl_Position = vec4(point / Viewport, getZdepth(P0), 1.0); EmitVertex(); mTexCoord = rotateUV(vec2(1, 1), finaluvdata[0].y); mColor = finalColor[0]; - gl_Position = vec4(vec2(sp0.x + size, sp0.y + size * aspect) / Viewport, getZdepth(P0), 1.0); + point = rotatePoint(center, vec2(sp0.x + size, sp0.y + size), angle); + gl_Position = vec4(point / Viewport, getZdepth(P0), 1.0); EmitVertex(); mTexCoord = rotateUV(vec2(1, 0), finaluvdata[0].y); mColor = finalColor[0]; - gl_Position = vec4(vec2(sp0.x + size, sp0.y - size * aspect) / Viewport, getZdepth(P0), 1.0); + point = rotatePoint(center, vec2(sp0.x + size, sp0.y - size), angle); + gl_Position = vec4(point / Viewport, getZdepth(P0), 1.0); EmitVertex(); EndPrimitive(); diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_point_vert.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_point_vert.glsl index 2606bbf878e..7deca544176 100644 --- a/source/blender/draw/engines/gpencil/shaders/gpencil_point_vert.glsl +++ b/source/blender/draw/engines/gpencil/shaders/gpencil_point_vert.glsl @@ -13,10 +13,12 @@ in vec3 pos; in vec4 color; in float thickness; in vec2 uvdata; +in vec3 prev_pos; out vec4 finalColor; out float finalThickness; out vec2 finaluvdata; +out vec4 finalprev_pos; #define TRUE 1 @@ -30,7 +32,8 @@ float defaultpixsize = pixsize * (1000.0 / pixfactor); void main() { - gl_Position = ModelViewProjectionMatrix * vec4( pos, 1.0 ); + gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0); + finalprev_pos = ModelViewProjectionMatrix * vec4(prev_pos, 1.0); finalColor = color; if (keep_size == TRUE) { diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_frag.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_frag.glsl index 80fa899b13a..a49a6e84f17 100644 --- a/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_frag.glsl +++ b/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_frag.glsl @@ -1,6 +1,8 @@ uniform int color_type; uniform sampler2D myTexture; +uniform float gradient_f; + in vec4 mColor; in vec2 mTexCoord; in vec2 uvfac; @@ -18,6 +20,7 @@ out vec4 fragColor; void main() { + vec4 tColor = vec4(mColor); /* if uvfac[1] == 1, then encap */ if (uvfac[1] == ENDCAP) { @@ -54,6 +57,16 @@ void main() fragColor.a = min(text_color.a * tColor.a, tColor.a); } + /* gradient */ + /* keep this disabled while the line glitch bug exists + if (gradient_f < 1.0) { + float d = abs(mTexCoord.y - 0.5) * (1.1 - gradient_f); + float alpha = 1.0 - clamp((fragColor.a - (d * 2.0)), 0.03, 1.0); + fragColor.a = smoothstep(fragColor.a, 0.0, alpha); + + } + */ + if(fragColor.a < 0.0035) discard; } diff --git a/source/blender/draw/engines/workbench/workbench_forward.c b/source/blender/draw/engines/workbench/workbench_forward.c index fe8a341bf3e..f86a263406a 100644 --- a/source/blender/draw/engines/workbench/workbench_forward.c +++ b/source/blender/draw/engines/workbench/workbench_forward.c @@ -318,6 +318,7 @@ void workbench_forward_engine_init(WORKBENCH_Data *vedata) workbench_fxaa_engine_init(); workbench_taa_engine_init(vedata); + workbench_forward_outline_shaders_ensure(wpd, draw_ctx->sh_cfg); workbench_forward_choose_shaders(wpd, draw_ctx->sh_cfg); const float *viewport_size = DRW_viewport_size_get(); diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h index ce75cc0f05d..98fd3712b97 100644 --- a/source/blender/draw/intern/DRW_render.h +++ b/source/blender/draw/intern/DRW_render.h @@ -99,7 +99,7 @@ typedef char DRWViewportEmptyList; DRW_VIEWPORT_LIST_SIZE(*(((ty *)NULL)->fbl)), \ DRW_VIEWPORT_LIST_SIZE(*(((ty *)NULL)->txl)), \ DRW_VIEWPORT_LIST_SIZE(*(((ty *)NULL)->psl)), \ - DRW_VIEWPORT_LIST_SIZE(*(((ty *)NULL)->stl)) \ + DRW_VIEWPORT_LIST_SIZE(*(((ty *)NULL)->stl)), \ } /* Use of multisample framebuffers. */ diff --git a/source/blender/draw/intern/draw_armature.c b/source/blender/draw/intern/draw_armature.c index 06013bad7c0..a32b4089fcf 100644 --- a/source/blender/draw/intern/draw_armature.c +++ b/source/blender/draw/intern/draw_armature.c @@ -509,7 +509,7 @@ enum { PCHAN_COLOR_SPHEREBONE_BASE, /* for the 'stick' of sphere (envelope) bones */ PCHAN_COLOR_SPHEREBONE_END, /* for the ends of sphere (envelope) bones */ - PCHAN_COLOR_LINEBONE /* for the middle of line-bones */ + PCHAN_COLOR_LINEBONE, /* for the middle of line-bones */ }; /* This function sets the color-set for coloring a certain bone */ diff --git a/source/blender/draw/intern/draw_manager.h b/source/blender/draw/intern/draw_manager.h index 03f6eef225e..a489e3dd1a8 100644 --- a/source/blender/draw/intern/draw_manager.h +++ b/source/blender/draw/intern/draw_manager.h @@ -191,7 +191,7 @@ typedef enum { DRW_UNIFORM_TEXTURE_PERSIST, DRW_UNIFORM_TEXTURE_REF, DRW_UNIFORM_BLOCK, - DRW_UNIFORM_BLOCK_PERSIST + DRW_UNIFORM_BLOCK_PERSIST, } DRWUniformType; struct DRWUniform { diff --git a/source/blender/editors/animation/CMakeLists.txt b/source/blender/editors/animation/CMakeLists.txt index 14936e5bc2a..ea37aab69ea 100644 --- a/source/blender/editors/animation/CMakeLists.txt +++ b/source/blender/editors/animation/CMakeLists.txt @@ -25,6 +25,7 @@ set(INC ../../makesdna ../../makesrna ../../windowmanager + ../../../../intern/clog ../../../../intern/guardedalloc ../../../../intern/glew-mx ) @@ -41,6 +42,7 @@ set(SRC anim_filter.c anim_ipo_utils.c anim_markers.c + anim_motion_paths.c anim_ops.c drivers.c fmodifier_ui.c @@ -54,6 +56,8 @@ set(SRC ) set(LIB + bf_blenkernel + bf_blenlib ) if(WITH_INTERNATIONAL) diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index 1bddc6268b5..daa2cda2e1b 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -226,7 +226,7 @@ static void acf_gpencil_channel_color(bAnimContext *ac, bAnimListElem *ale, floa const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale); short indent = (acf->get_indent_level) ? acf->get_indent_level(ac, ale) : 0; bool showGroupColors = acf_show_channel_colors(ac); - + if ((showGroupColors) && (ale->type == ANIMTYPE_GPLAYER)) { bGPDlayer *gpl = (bGPDlayer *)ale->data; copy_v3_v3(r_color, gpl->color); @@ -530,7 +530,7 @@ static bAnimChannelType ACF_SUMMARY = acf_summary_setting_valid, /* has setting */ acf_summary_setting_flag, /* flag for setting */ - acf_summary_setting_ptr /* pointer for setting */ + acf_summary_setting_ptr, /* pointer for setting */ }; /* Scene ------------------------------------------- */ @@ -635,7 +635,7 @@ static bAnimChannelType ACF_SCENE = acf_scene_setting_valid, /* has setting */ acf_scene_setting_flag, /* flag for setting */ - acf_scene_setting_ptr /* pointer for setting */ + acf_scene_setting_ptr, /* pointer for setting */ }; /* Object ------------------------------------------- */ @@ -800,7 +800,7 @@ static bAnimChannelType ACF_OBJECT = acf_object_setting_valid, /* has setting */ acf_object_setting_flag, /* flag for setting */ - acf_object_setting_ptr /* pointer for setting */ + acf_object_setting_ptr, /* pointer for setting */ }; /* Group ------------------------------------------- */ @@ -959,7 +959,7 @@ static bAnimChannelType ACF_GROUP = acf_group_setting_valid, /* has setting */ acf_group_setting_flag, /* flag for setting */ - acf_group_setting_ptr /* pointer for setting */ + acf_group_setting_ptr, /* pointer for setting */ }; /* F-Curve ------------------------------------------- */ @@ -1076,7 +1076,7 @@ static bAnimChannelType ACF_FCURVE = acf_fcurve_setting_valid, /* has setting */ acf_fcurve_setting_flag, /* flag for setting */ - acf_fcurve_setting_ptr /* pointer for setting */ + acf_fcurve_setting_ptr, /* pointer for setting */ }; /* NLA Control FCurves Expander ----------------------- */ @@ -1175,7 +1175,7 @@ static bAnimChannelType ACF_NLACONTROLS = acf_nla_controls_setting_valid, /* has setting */ acf_nla_controls_setting_flag, /* flag for setting */ - acf_nla_controls_setting_ptr /* pointer for setting */ + acf_nla_controls_setting_ptr, /* pointer for setting */ }; @@ -1218,7 +1218,7 @@ static bAnimChannelType ACF_NLACURVE = acf_fcurve_setting_valid, /* has setting */ acf_fcurve_setting_flag, /* flag for setting */ - acf_fcurve_setting_ptr /* pointer for setting */ + acf_fcurve_setting_ptr, /* pointer for setting */ }; /* Object Action Expander ------------------------------------------- */ @@ -1303,7 +1303,7 @@ static bAnimChannelType ACF_FILLACTD = acf_fillactd_setting_valid, /* has setting */ acf_fillactd_setting_flag, /* flag for setting */ - acf_fillactd_setting_ptr /* pointer for setting */ + acf_fillactd_setting_ptr, /* pointer for setting */ }; /* Drivers Expander ------------------------------------------- */ @@ -1383,7 +1383,7 @@ static bAnimChannelType ACF_FILLDRIVERS = acf_filldrivers_setting_valid, /* has setting */ acf_filldrivers_setting_flag, /* flag for setting */ - acf_filldrivers_setting_ptr /* pointer for setting */ + acf_filldrivers_setting_ptr, /* pointer for setting */ }; @@ -1461,7 +1461,7 @@ static bAnimChannelType ACF_DSMAT = acf_generic_dataexpand_setting_valid, /* has setting */ acf_dsmat_setting_flag, /* flag for setting */ - acf_dsmat_setting_ptr /* pointer for setting */ + acf_dsmat_setting_ptr, /* pointer for setting */ }; /* Light Expander ------------------------------------------- */ @@ -1538,7 +1538,7 @@ static bAnimChannelType ACF_DSLIGHT = acf_generic_dataexpand_setting_valid, /* has setting */ acf_dslight_setting_flag, /* flag for setting */ - acf_dslight_setting_ptr /* pointer for setting */ + acf_dslight_setting_ptr, /* pointer for setting */ }; /* Texture Expander ------------------------------------------- */ @@ -1622,7 +1622,7 @@ static bAnimChannelType ACF_DSTEX = acf_generic_dataexpand_setting_valid, /* has setting */ acf_dstex_setting_flag, /* flag for setting */ - acf_dstex_setting_ptr /* pointer for setting */ + acf_dstex_setting_ptr, /* pointer for setting */ }; /* Camera Expander ------------------------------------------- */ @@ -1704,7 +1704,7 @@ static bAnimChannelType ACF_DSCACHEFILE = acf_generic_dataexpand_setting_valid, /* has setting */ acf_dscachefile_setting_flag, /* flag for setting */ - acf_dscachefile_setting_ptr /* pointer for setting */ + acf_dscachefile_setting_ptr, /* pointer for setting */ }; /* Camera Expander ------------------------------------------- */ @@ -1785,7 +1785,7 @@ static bAnimChannelType ACF_DSCAM = acf_generic_dataexpand_setting_valid, /* has setting */ acf_dscam_setting_flag, /* flag for setting */ - acf_dscam_setting_ptr /* pointer for setting */ + acf_dscam_setting_ptr, /* pointer for setting */ }; /* Curve Expander ------------------------------------------- */ @@ -1872,7 +1872,7 @@ static bAnimChannelType ACF_DSCUR = acf_generic_dataexpand_setting_valid, /* has setting */ acf_dscur_setting_flag, /* flag for setting */ - acf_dscur_setting_ptr /* pointer for setting */ + acf_dscur_setting_ptr, /* pointer for setting */ }; /* Shape Key Expander ------------------------------------------- */ @@ -1949,7 +1949,7 @@ static bAnimChannelType ACF_DSSKEY = acf_generic_dataexpand_setting_valid, /* has setting */ acf_dsskey_setting_flag, /* flag for setting */ - acf_dsskey_setting_ptr /* pointer for setting */ + acf_dsskey_setting_ptr, /* pointer for setting */ }; /* World Expander ------------------------------------------- */ @@ -2026,7 +2026,7 @@ static bAnimChannelType ACF_DSWOR = acf_generic_dataexpand_setting_valid, /* has setting */ acf_dswor_setting_flag, /* flag for setting */ - acf_dswor_setting_ptr /* pointer for setting */ + acf_dswor_setting_ptr, /* pointer for setting */ }; /* Particle Expander ------------------------------------------- */ @@ -2103,7 +2103,7 @@ static bAnimChannelType ACF_DSPART = acf_generic_dataexpand_setting_valid, /* has setting */ acf_dspart_setting_flag, /* flag for setting */ - acf_dspart_setting_ptr /* pointer for setting */ + acf_dspart_setting_ptr, /* pointer for setting */ }; /* MetaBall Expander ------------------------------------------- */ @@ -2180,7 +2180,7 @@ static bAnimChannelType ACF_DSMBALL = acf_generic_dataexpand_setting_valid, /* has setting */ acf_dsmball_setting_flag, /* flag for setting */ - acf_dsmball_setting_ptr /* pointer for setting */ + acf_dsmball_setting_ptr, /* pointer for setting */ }; /* Armature Expander ------------------------------------------- */ @@ -2257,7 +2257,7 @@ static bAnimChannelType ACF_DSARM = acf_generic_dataexpand_setting_valid, /* has setting */ acf_dsarm_setting_flag, /* flag for setting */ - acf_dsarm_setting_ptr /* pointer for setting */ + acf_dsarm_setting_ptr, /* pointer for setting */ }; /* NodeTree Expander ------------------------------------------- */ @@ -2345,7 +2345,7 @@ static bAnimChannelType ACF_DSNTREE = acf_generic_dataexpand_setting_valid, /* has setting */ acf_dsntree_setting_flag, /* flag for setting */ - acf_dsntree_setting_ptr /* pointer for setting */ + acf_dsntree_setting_ptr, /* pointer for setting */ }; /* LineStyle Expander ------------------------------------------- */ @@ -2422,7 +2422,7 @@ static bAnimChannelType ACF_DSLINESTYLE = acf_generic_dataexpand_setting_valid, /* has setting */ acf_dslinestyle_setting_flag, /* flag for setting */ - acf_dslinestyle_setting_ptr /* pointer for setting */ + acf_dslinestyle_setting_ptr, /* pointer for setting */ }; /* Mesh Expander ------------------------------------------- */ @@ -2499,7 +2499,7 @@ static bAnimChannelType ACF_DSMESH = acf_generic_dataexpand_setting_valid, /* has setting */ acf_dsmesh_setting_flag, /* flag for setting */ - acf_dsmesh_setting_ptr /* pointer for setting */ + acf_dsmesh_setting_ptr, /* pointer for setting */ }; /* Lattice Expander ------------------------------------------- */ @@ -2576,7 +2576,7 @@ static bAnimChannelType ACF_DSLAT = acf_generic_dataexpand_setting_valid, /* has setting */ acf_dslat_setting_flag, /* flag for setting */ - acf_dslat_setting_ptr /* pointer for setting */ + acf_dslat_setting_ptr, /* pointer for setting */ }; /* Speaker Expander ------------------------------------------- */ @@ -2653,7 +2653,7 @@ static bAnimChannelType ACF_DSSPK = acf_generic_dataexpand_setting_valid, /* has setting */ acf_dsspk_setting_flag, /* flag for setting */ - acf_dsspk_setting_ptr /* pointer for setting */ + acf_dsspk_setting_ptr, /* pointer for setting */ }; /* GPencil Expander ------------------------------------------- */ @@ -2730,7 +2730,7 @@ static bAnimChannelType ACF_DSGPENCIL = acf_generic_dataexpand_setting_valid, /* has setting */ acf_dsgpencil_setting_flag, /* flag for setting */ - acf_dsgpencil_setting_ptr /* pointer for setting */ + acf_dsgpencil_setting_ptr, /* pointer for setting */ }; /* World Expander ------------------------------------------- */ @@ -2808,7 +2808,7 @@ static bAnimChannelType ACF_DSMCLIP = acf_generic_dataexpand_setting_valid, /* has setting */ acf_dsmclip_setting_flag, /* flag for setting */ - acf_dsmclip_setting_ptr /* pointer for setting */ + acf_dsmclip_setting_ptr, /* pointer for setting */ }; /* ShapeKey Entry ------------------------------------------- */ @@ -2916,7 +2916,7 @@ static bAnimChannelType ACF_SHAPEKEY = acf_shapekey_setting_valid, /* has setting */ acf_shapekey_setting_flag, /* flag for setting */ - acf_shapekey_setting_ptr /* pointer for setting */ + acf_shapekey_setting_ptr, /* pointer for setting */ }; /* GPencil Datablock ------------------------------------------- */ @@ -2993,7 +2993,7 @@ static bAnimChannelType ACF_GPD = acf_gpd_setting_valid, /* has setting */ acf_gpd_setting_flag, /* flag for setting */ - acf_gpd_setting_ptr /* pointer for setting */ + acf_gpd_setting_ptr, /* pointer for setting */ }; /* GPencil Layer ------------------------------------------- */ @@ -3086,7 +3086,7 @@ static bAnimChannelType ACF_GPL = acf_gpl_setting_valid, /* has setting */ acf_gpl_setting_flag, /* flag for setting */ - acf_gpl_setting_ptr /* pointer for setting */ + acf_gpl_setting_ptr, /* pointer for setting */ }; @@ -3164,7 +3164,7 @@ static bAnimChannelType ACF_MASKDATA = acf_mask_setting_valid, /* has setting */ acf_mask_setting_flag, /* flag for setting */ - acf_mask_setting_ptr /* pointer for setting */ + acf_mask_setting_ptr, /* pointer for setting */ }; /* Mask Layer ------------------------------------------- */ @@ -3251,7 +3251,7 @@ static bAnimChannelType ACF_MASKLAYER = acf_masklay_setting_valid, /* has setting */ acf_masklay_setting_flag, /* flag for setting */ - acf_masklay_setting_ptr /* pointer for setting */ + acf_masklay_setting_ptr, /* pointer for setting */ }; /* NLA Track ----------------------------------------------- */ @@ -3390,7 +3390,7 @@ static bAnimChannelType ACF_NLATRACK = acf_nlatrack_setting_valid, /* has setting */ acf_nlatrack_setting_flag, /* flag for setting */ - acf_nlatrack_setting_ptr /* pointer for setting */ + acf_nlatrack_setting_ptr, /* pointer for setting */ }; /* NLA Action ----------------------------------------------- */ @@ -3556,7 +3556,7 @@ static bAnimChannelType ACF_NLAACTION = acf_nlaaction_setting_valid, /* has setting */ acf_nlaaction_setting_flag, /* flag for setting */ - acf_nlaaction_setting_ptr /* pointer for setting */ + acf_nlaaction_setting_ptr, /* pointer for setting */ }; diff --git a/source/blender/editors/animation/anim_motion_paths.c b/source/blender/editors/animation/anim_motion_paths.c new file mode 100644 index 00000000000..7023a138c96 --- /dev/null +++ b/source/blender/editors/animation/anim_motion_paths.c @@ -0,0 +1,335 @@ +/* + * 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. + */ + +/** \file + * \ingroup bke + */ + +#include "MEM_guardedalloc.h" + +#include <stdlib.h> + +#include "BLI_listbase.h" +#include "BLI_math.h" +#include "BLI_dlrbTree.h" + +#include "DNA_anim_types.h" +#include "DNA_armature_types.h" +#include "DNA_scene_types.h" + +#include "BKE_animsys.h" +#include "BKE_action.h" +#include "BKE_main.h" +#include "BKE_scene.h" + +#include "DEG_depsgraph.h" +#include "DEG_depsgraph_query.h" + +#include "GPU_batch.h" +#include "GPU_vertex_buffer.h" + +#include "ED_anim_api.h" +#include "ED_keyframes_draw.h" + +#include "CLG_log.h" + +static CLG_LogRef LOG = {"ed.anim.motion_paths"}; + + +/* Motion path needing to be baked (mpt) */ +typedef struct MPathTarget { + struct MPathTarget *next, *prev; + + bMotionPath *mpath; /* motion path in question */ + + DLRBT_Tree keys; /* temp, to know where the keyframes are */ + + /* Original (Source Objects) */ + Object *ob; /* source object */ + bPoseChannel *pchan; /* source posechannel (if applicable) */ + + /* "Evaluated" Copies (these come from the background COW copie + * that provide all the coordinates we want to save off) + */ + Object *ob_eval; /* evaluated object */ +} MPathTarget; + +/* ........ */ + +/* get list of motion paths to be baked for the given object + * - assumes the given list is ready to be used + */ +/* TODO: it would be nice in future to be able to update objects dependent on these bones too? */ +void animviz_get_object_motionpaths(Object *ob, ListBase *targets) +{ + MPathTarget *mpt; + + /* object itself first */ + if ((ob->avs.recalc & ANIMVIZ_RECALC_PATHS) && (ob->mpath)) { + /* new target for object */ + mpt = MEM_callocN(sizeof(MPathTarget), "MPathTarget Ob"); + BLI_addtail(targets, mpt); + + mpt->mpath = ob->mpath; + mpt->ob = ob; + } + + /* bones */ + if ((ob->pose) && (ob->pose->avs.recalc & ANIMVIZ_RECALC_PATHS)) { + bArmature *arm = ob->data; + bPoseChannel *pchan; + + for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) { + if ((pchan->bone) && (arm->layer & pchan->bone->layer) && (pchan->mpath)) { + /* new target for bone */ + mpt = MEM_callocN(sizeof(MPathTarget), "MPathTarget PoseBone"); + BLI_addtail(targets, mpt); + + mpt->mpath = pchan->mpath; + mpt->ob = ob; + mpt->pchan = pchan; + } + } + } +} + +/* ........ */ + +/* update scene for current frame */ +static void motionpaths_calc_update_scene(Main *bmain, + struct Depsgraph *depsgraph) +{ + /* Do all updates + * - if this is too slow, resort to using a more efficient way + * that doesn't force complete update, but for now, this is the + * most accurate way! + * + * TODO(segey): Bring back partial updates, which became impossible + * with the new depsgraph due to unsorted nature of bases. + * + * TODO(sergey): Use evaluation context dedicated to motion paths. + */ + BKE_scene_graph_update_for_newframe(depsgraph, bmain); +} + +/* ........ */ + +/* perform baking for the targets on the current frame */ +static void motionpaths_calc_bake_targets(ListBase *targets, int cframe) +{ + MPathTarget *mpt; + + /* for each target, check if it can be baked on the current frame */ + for (mpt = targets->first; mpt; mpt = mpt->next) { + bMotionPath *mpath = mpt->mpath; + + /* current frame must be within the range the cache works for + * - is inclusive of the first frame, but not the last otherwise we get buffer overruns + */ + if ((cframe < mpath->start_frame) || (cframe >= mpath->end_frame)) { + continue; + } + + /* get the relevant cache vert to write to */ + bMotionPathVert *mpv = mpath->points + (cframe - mpath->start_frame); + + Object *ob_eval = mpt->ob_eval; + + /* Lookup evaluated pose channel, here because the depsgraph + * evaluation can change them so they are not cached in mpt. */ + bPoseChannel *pchan_eval = NULL; + if (mpt->pchan) { + pchan_eval = BKE_pose_channel_find_name(ob_eval->pose, mpt->pchan->name); + } + + /* pose-channel or object path baking? */ + if (pchan_eval) { + /* heads or tails */ + if (mpath->flag & MOTIONPATH_FLAG_BHEAD) { + copy_v3_v3(mpv->co, pchan_eval->pose_head); + } + else { + copy_v3_v3(mpv->co, pchan_eval->pose_tail); + } + + /* result must be in worldspace */ + mul_m4_v3(ob_eval->obmat, mpv->co); + } + else { + /* worldspace object location */ + copy_v3_v3(mpv->co, ob_eval->obmat[3]); + } + + float mframe = (float)(cframe); + + /* Tag if it's a keyframe */ + if (BLI_dlrbTree_search_exact(&mpt->keys, compare_ak_cfraPtr, &mframe)) { + mpv->flag |= MOTIONPATH_VERT_KEY; + } + else { + mpv->flag &= ~MOTIONPATH_VERT_KEY; + } + + /* Incremental update on evaluated object if possible, for fast updating + * while dragging in transform. */ + bMotionPath *mpath_eval = NULL; + if (mpt->pchan) { + mpath_eval = (pchan_eval) ? pchan_eval->mpath : NULL; + } + else { + mpath_eval = ob_eval->mpath; + } + + if (mpath_eval && mpath_eval->length == mpath->length) { + bMotionPathVert *mpv_eval = mpath_eval->points + (cframe - mpath_eval->start_frame); + *mpv_eval = *mpv; + + GPU_VERTBUF_DISCARD_SAFE(mpath_eval->points_vbo); + GPU_BATCH_DISCARD_SAFE(mpath_eval->batch_line); + GPU_BATCH_DISCARD_SAFE(mpath_eval->batch_points); + } + } +} + +/* Perform baking of the given object's and/or its bones' transforms to motion paths + * - scene: current scene + * - ob: object whose flagged motionpaths should get calculated + * - recalc: whether we need to + */ +/* TODO: include reports pointer? */ +void animviz_calc_motionpaths(Depsgraph *depsgraph, + Main *bmain, + Scene *scene, + ListBase *targets, + bool restore, + bool current_frame_only) +{ + /* sanity check */ + if (ELEM(NULL, targets, targets->first)) + return; + + /* Compute frame range to bake within. + * TODO: this method could be improved... + * 1) max range for standard baking + * 2) minimum range for recalc baking (i.e. between keyframes, but how?) */ + int sfra = INT_MAX; + int efra = INT_MIN; + + for (MPathTarget *mpt = targets->first; mpt; mpt = mpt->next) { + /* try to increase area to do (only as much as needed) */ + sfra = MIN2(sfra, mpt->mpath->start_frame); + efra = MAX2(efra, mpt->mpath->end_frame); + } + + if (efra <= sfra) { + return; + } + + /* Limit frame range if we are updating just the current frame. */ + /* set frame values */ + int cfra = CFRA; + if (current_frame_only) { + if (cfra < sfra || cfra > efra) { + return; + } + sfra = efra = cfra; + } + + /* get copies of objects/bones to get the calculated results from + * (for copy-on-write evaluation), so that we actually get some results + */ + // TODO: Create a copy of background depsgraph that only contain these entities, and only evaluates them.. + for (MPathTarget *mpt = targets->first; mpt; mpt = mpt->next) { + mpt->ob_eval = DEG_get_evaluated_object(depsgraph, mpt->ob); + + AnimData *adt = BKE_animdata_from_id(&mpt->ob_eval->id); + + /* build list of all keyframes in active action for object or pchan */ + BLI_dlrbTree_init(&mpt->keys); + + if (adt) { + bAnimVizSettings *avs; + + /* get pointer to animviz settings for each target */ + if (mpt->pchan) + avs = &mpt->ob->pose->avs; + else + avs = &mpt->ob->avs; + + /* it is assumed that keyframes for bones are all grouped in a single group + * unless an option is set to always use the whole action + */ + if ((mpt->pchan) && (avs->path_viewflag & MOTIONPATH_VIEW_KFACT) == 0) { + bActionGroup *agrp = BKE_action_group_find_name(adt->action, mpt->pchan->name); + + if (agrp) { + agroup_to_keylist(adt, agrp, &mpt->keys, 0); + } + } + else { + action_to_keylist(adt, adt->action, &mpt->keys, 0); + } + } + } + + /* calculate path over requested range */ + CLOG_INFO(&LOG, 1, "Calculating MotionPaths between frames %d - %d (%d frames)", sfra, efra, efra - sfra + 1); + for (CFRA = sfra; CFRA <= efra; CFRA++) { + if (current_frame_only) { + /* For current frame, only update tagged. */ + BKE_scene_graph_update_tagged(depsgraph, bmain); + } + else { + /* Update relevant data for new frame. */ + motionpaths_calc_update_scene(bmain, depsgraph); + } + + /* perform baking for targets */ + motionpaths_calc_bake_targets(targets, CFRA); + } + + /* reset original environment */ + /* NOTE: We don't always need to reevaluate the main scene, as the depsgraph + * may be a temporary one that works on a subset of the data. We always have + * to resoture the current frame though. */ + CFRA = cfra; + if (!current_frame_only && restore) { + motionpaths_calc_update_scene(bmain, depsgraph); + } + + /* clear recalc flags from targets */ + for (MPathTarget *mpt = targets->first; mpt; mpt = mpt->next) { + bAnimVizSettings *avs; + bMotionPath *mpath = mpt->mpath; + + /* get pointer to animviz settings for each target */ + if (mpt->pchan) + avs = &mpt->ob->pose->avs; + else + avs = &mpt->ob->avs; + + /* clear the flag requesting recalculation of targets */ + avs->recalc &= ~ANIMVIZ_RECALC_PATHS; + + /* Clean temp data */ + BLI_dlrbTree_free(&mpt->keys); + + /* Free previous batches to force update. */ + GPU_VERTBUF_DISCARD_SAFE(mpath->points_vbo); + GPU_BATCH_DISCARD_SAFE(mpath->batch_line); + GPU_BATCH_DISCARD_SAFE(mpath->batch_points); + } +} diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index bc630040fdd..793a73e6939 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -564,7 +564,7 @@ enum { KEYNEEDED_DONTADD = 0, KEYNEEDED_JUSTADD, KEYNEEDED_DELPREV, - KEYNEEDED_DELNEXT + KEYNEEDED_DELNEXT, } /*eKeyNeededStatus*/; /* This helper function determines whether a new keyframe is needed */ diff --git a/source/blender/editors/armature/CMakeLists.txt b/source/blender/editors/armature/CMakeLists.txt index d63c53a6a09..27eddd7e1dd 100644 --- a/source/blender/editors/armature/CMakeLists.txt +++ b/source/blender/editors/armature/CMakeLists.txt @@ -59,6 +59,8 @@ set(SRC ) set(LIB + bf_blenkernel + bf_blenlib ) if(WITH_INTERNATIONAL) diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c index 5920a69c60b..9323e00db65 100644 --- a/source/blender/editors/armature/pose_edit.c +++ b/source/blender/editors/armature/pose_edit.c @@ -54,6 +54,7 @@ #include "WM_api.h" #include "WM_types.h" +#include "ED_anim_api.h" #include "ED_armature.h" #include "ED_keyframing.h" #include "ED_screen.h" diff --git a/source/blender/editors/armature/pose_group.c b/source/blender/editors/armature/pose_group.c index 0d1f899ce36..596e64b54fe 100644 --- a/source/blender/editors/armature/pose_group.c +++ b/source/blender/editors/armature/pose_group.c @@ -463,6 +463,8 @@ static int pose_group_select_exec(bContext *C, wmOperator *UNUSED(op)) pose_group_select(ob, 1); /* notifiers for updates */ + bArmature *arm = ob->data; + DEG_id_tag_update(&arm->id, ID_RECALC_SELECT); WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob); return OPERATOR_FINISHED; @@ -494,6 +496,8 @@ static int pose_group_deselect_exec(bContext *C, wmOperator *UNUSED(op)) pose_group_select(ob, 0); /* notifiers for updates */ + bArmature *arm = ob->data; + DEG_id_tag_update(&arm->id, ID_RECALC_SELECT); WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob); return OPERATOR_FINISHED; diff --git a/source/blender/editors/armature/pose_slide.c b/source/blender/editors/armature/pose_slide.c index e6ed26bdf71..90de331b3e0 100644 --- a/source/blender/editors/armature/pose_slide.c +++ b/source/blender/editors/armature/pose_slide.c @@ -147,7 +147,7 @@ typedef enum ePoseSlide_Channels { PS_TFM_BBONE_SHAPE, /* Bendy Bones */ - PS_TFM_PROPS /* Custom Properties */ + PS_TFM_PROPS, /* Custom Properties */ } ePoseSlide_Channels; /* Property enum for ePoseSlide_Channels */ @@ -1344,7 +1344,7 @@ typedef enum ePosePropagate_Termination { /* only do on keyframes that are selected */ POSE_PROPAGATE_SELECTED_KEYS, /* only do on the frames where markers are selected */ - POSE_PROPAGATE_SELECTED_MARKERS + POSE_PROPAGATE_SELECTED_MARKERS, } ePosePropagate_Termination; /* termination data needed for some modes - assumes only one of these entries will be needed at a time */ diff --git a/source/blender/editors/curve/CMakeLists.txt b/source/blender/editors/curve/CMakeLists.txt index 726a744dd95..4ccf8d59e1f 100644 --- a/source/blender/editors/curve/CMakeLists.txt +++ b/source/blender/editors/curve/CMakeLists.txt @@ -49,6 +49,9 @@ set(SRC ) set(LIB + bf_blenkernel + bf_blenlib + extern_curve_fit_nd ) if(WITH_INTERNATIONAL) diff --git a/source/blender/editors/gpencil/CMakeLists.txt b/source/blender/editors/gpencil/CMakeLists.txt index 53b527dd1f7..fa91ffd1e72 100644 --- a/source/blender/editors/gpencil/CMakeLists.txt +++ b/source/blender/editors/gpencil/CMakeLists.txt @@ -62,6 +62,8 @@ set(SRC ) set(LIB + bf_blenkernel + bf_blenlib ) if(WITH_INTERNATIONAL) diff --git a/source/blender/editors/gpencil/annotate_paint.c b/source/blender/editors/gpencil/annotate_paint.c index 5152bcb0a90..bfbf319b1c6 100644 --- a/source/blender/editors/gpencil/annotate_paint.c +++ b/source/blender/editors/gpencil/annotate_paint.c @@ -93,7 +93,7 @@ typedef enum eGP_StrokeAdd_Result { GP_STROKEADD_INVALID = -2, /* error occurred - insufficient info to do so */ GP_STROKEADD_OVERFLOW = -1, /* error occurred - cannot fit any more points */ GP_STROKEADD_NORMAL, /* point was successfully added */ - GP_STROKEADD_FULL /* cannot add any more points to buffer */ + GP_STROKEADD_FULL, /* cannot add any more points to buffer */ } eGP_StrokeAdd_Result; /* Runtime flags */ @@ -681,6 +681,9 @@ static void gp_stroke_newfrombuffer(tGPsdata *p) /* copy appropriate settings for stroke */ gps->totpoints = totelem; gps->thickness = gpl->thickness; + gps->gradient_f = 1.0f; + gps->gradient_s[0] = 1.0f; + gps->gradient_s[1] = 1.0f; gps->flag = gpd->runtime.sbuffer_sflag; gps->inittime = p->inittime; diff --git a/source/blender/editors/gpencil/gpencil_brush.c b/source/blender/editors/gpencil/gpencil_brush.c index e7e6d7a5f7f..8f64ec1c868 100644 --- a/source/blender/editors/gpencil/gpencil_brush.c +++ b/source/blender/editors/gpencil/gpencil_brush.c @@ -929,6 +929,12 @@ static bool gp_brush_weight_apply( gso->vrgroup = 0; } } + else { + bDeformGroup *defgroup = BLI_findlink(&gso->object->defbase, gso->vrgroup); + if (defgroup->flag & DG_LOCK_WEIGHT) { + return false; + } + } /* get current weight */ MDeformWeight *dw = defvert_verify_index(dvert, gso->vrgroup); float curweight = dw ? dw->weight : 0.0f; diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c index 710e8a9bc1c..a49f6a0d414 100644 --- a/source/blender/editors/gpencil/gpencil_data.c +++ b/source/blender/editors/gpencil/gpencil_data.c @@ -1725,19 +1725,26 @@ void GPENCIL_OT_vertex_group_deselect(wmOperatorType *ot) } /* invert */ -static int gpencil_vertex_group_invert_exec(bContext *C, wmOperator *UNUSED(op)) +static int gpencil_vertex_group_invert_exec(bContext *C, wmOperator *op) { ToolSettings *ts = CTX_data_tool_settings(C); Object *ob = CTX_data_active_object(C); /* sanity checks */ - if (ELEM(NULL, ts, ob, ob->data)) + if (ELEM(NULL, ts, ob, ob->data)) { return OPERATOR_CANCELLED; + } MDeformVert *dvert; const int def_nr = ob->actdef - 1; - if (!BLI_findlink(&ob->defbase, def_nr)) + bDeformGroup *defgroup = BLI_findlink(&ob->defbase, def_nr); + if (defgroup == NULL) { return OPERATOR_CANCELLED; + } + if (defgroup->flag & DG_LOCK_WEIGHT) { + BKE_report(op->reports, RPT_ERROR, "Current Vertex Group is locked"); + return OPERATOR_CANCELLED; + } CTX_DATA_BEGIN(C, bGPDstroke *, gps, editable_gpencil_strokes) { @@ -1790,15 +1797,22 @@ static int gpencil_vertex_group_smooth_exec(bContext *C, wmOperator *op) Object *ob = CTX_data_active_object(C); /* sanity checks */ - if (ELEM(NULL, ts, ob, ob->data)) + if (ELEM(NULL, ts, ob, ob->data)) { return OPERATOR_CANCELLED; - - bGPDspoint *pta, *ptb, *ptc; - MDeformVert *dverta, *dvertb; + } const int def_nr = ob->actdef - 1; - if (!BLI_findlink(&ob->defbase, def_nr)) + bDeformGroup *defgroup = BLI_findlink(&ob->defbase, def_nr); + if (defgroup == NULL) { + return OPERATOR_CANCELLED; + } + if (defgroup->flag & DG_LOCK_WEIGHT) { + BKE_report(op->reports, RPT_ERROR, "Current Vertex Group is locked"); return OPERATOR_CANCELLED; + } + + bGPDspoint *pta, *ptb, *ptc; + MDeformVert *dverta, *dvertb; CTX_DATA_BEGIN(C, bGPDstroke *, gps, editable_gpencil_strokes) { @@ -1873,6 +1887,187 @@ void GPENCIL_OT_vertex_group_smooth(wmOperatorType *ot) RNA_def_int(ot->srna, "repeat", 1, 1, 10000, "Iterations", "", 1, 200); } +/* normalize */ +static int gpencil_vertex_group_normalize_exec(bContext *C, wmOperator *op) +{ + ToolSettings *ts = CTX_data_tool_settings(C); + Object *ob = CTX_data_active_object(C); + + /* sanity checks */ + if (ELEM(NULL, ts, ob, ob->data)) { + return OPERATOR_CANCELLED; + } + + MDeformVert *dvert = NULL; + MDeformWeight *dw = NULL; + const int def_nr = ob->actdef - 1; + bDeformGroup *defgroup = BLI_findlink(&ob->defbase, def_nr); + if (defgroup == NULL) { + return OPERATOR_CANCELLED; + } + if (defgroup->flag & DG_LOCK_WEIGHT) { + BKE_report(op->reports, RPT_ERROR, "Current Vertex Group is locked"); + return OPERATOR_CANCELLED; + } + + CTX_DATA_BEGIN(C, bGPDstroke *, gps, editable_gpencil_strokes) + { + /* look for max value */ + float maxvalue = 0.0f; + for (int i = 0; i < gps->totpoints; i++) { + dvert = &gps->dvert[i]; + dw = defvert_find_index(dvert, def_nr); + if ((dw != NULL) && (dw->weight > maxvalue)) { + maxvalue = dw->weight; + } + } + + /* normalize weights */ + if (maxvalue > 0.0f) { + for (int i = 0; i < gps->totpoints; i++) { + dvert = &gps->dvert[i]; + dw = defvert_find_index(dvert, def_nr); + if (dw != NULL) { + dw->weight = dw->weight / maxvalue; + } + } + } + } + CTX_DATA_END; + + /* notifiers */ + bGPdata *gpd = ob->data; + DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY); + WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED | ND_SPACE_PROPERTIES, NULL); + + return OPERATOR_FINISHED; +} + +void GPENCIL_OT_vertex_group_normalize(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Normalize Vertex Group"; + ot->idname = "GPENCIL_OT_vertex_group_normalize"; + ot->description = "Normalize weights to the active vertex group"; + + /* api callbacks */ + ot->poll = gpencil_vertex_group_weight_poll; + ot->exec = gpencil_vertex_group_normalize_exec; + + /* flags */ + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; +} + +/* normalize all */ +static int gpencil_vertex_group_normalize_all_exec(bContext *C, wmOperator *op) +{ + ToolSettings *ts = CTX_data_tool_settings(C); + Object *ob = CTX_data_active_object(C); + bool lock_active = RNA_boolean_get(op->ptr, "lock_active"); + + /* sanity checks */ + if (ELEM(NULL, ts, ob, ob->data)) { + return OPERATOR_CANCELLED; + } + + bDeformGroup *defgroup = NULL; + MDeformVert *dvert = NULL; + MDeformWeight *dw = NULL; + const int def_nr = ob->actdef - 1; + const int defbase_tot = BLI_listbase_count(&ob->defbase); + if (defbase_tot == 0) { + return OPERATOR_CANCELLED; + } + + CTX_DATA_BEGIN(C, bGPDstroke *, gps, editable_gpencil_strokes) + { + /* verify the strokes has something to change */ + if (gps->totpoints == 0) { + continue; + } + /* look for tot value */ + float *tot_values = MEM_callocN(gps->totpoints * sizeof(float), __func__); + + for (int i = 0; i < gps->totpoints; i++) { + dvert = &gps->dvert[i]; + for (int v = 0; v < defbase_tot; v++) { + defgroup = BLI_findlink(&ob->defbase, v); + /* skip NULL or locked groups */ + if ((defgroup == NULL) || (defgroup->flag & DG_LOCK_WEIGHT)) { + continue; + } + + /* skip current */ + if ((lock_active) && (v == def_nr)) { + continue; + } + + dw = defvert_find_index(dvert, v); + if (dw != NULL) { + tot_values[i] += dw->weight; + } + } + } + + /* normalize weights */ + for (int i = 0; i < gps->totpoints; i++) { + if (tot_values[i] == 0.0f) { + continue; + } + + dvert = &gps->dvert[i]; + for (int v = 0; v < defbase_tot; v++) { + defgroup = BLI_findlink(&ob->defbase, v); + /* skip NULL or locked groups */ + if ((defgroup == NULL) || (defgroup->flag & DG_LOCK_WEIGHT)) { + continue; + } + + /* skip current */ + if ((lock_active) && (v == def_nr)) { + continue; + } + + dw = defvert_find_index(dvert, v); + if (dw != NULL) { + dw->weight = dw->weight / tot_values[i]; + } + } + } + + /* free temp array */ + MEM_SAFE_FREE(tot_values); + } + CTX_DATA_END; + + /* notifiers */ + bGPdata *gpd = ob->data; + DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY); + WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED | ND_SPACE_PROPERTIES, NULL); + + return OPERATOR_FINISHED; +} + +void GPENCIL_OT_vertex_group_normalize_all(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Normalize All Vertex Group"; + ot->idname = "GPENCIL_OT_vertex_group_normalize_all"; + ot->description = "Normalize all weights of all vertex groups, " + "so that for each vertex, the sum of all weights is 1.0"; + + /* api callbacks */ + ot->poll = gpencil_vertex_group_weight_poll; + ot->exec = gpencil_vertex_group_normalize_all_exec; + + /* flags */ + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; + + /* props */ + RNA_def_boolean(ot->srna, "lock_active", true, "Lock Active", + "Keep the values of the active group while normalizing others"); +} + /****************************** Join ***********************************/ /* userdata for joined_gpencil_fix_animdata_cb() */ diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c index e13dfb38c7d..76d15557055 100644 --- a/source/blender/editors/gpencil/gpencil_fill.c +++ b/source/blender/editors/gpencil/gpencil_fill.c @@ -1011,6 +1011,8 @@ static void gpencil_stroke_from_buffer(tGPDfill *tgpf) /* create new stroke */ bGPDstroke *gps = MEM_callocN(sizeof(bGPDstroke), "bGPDstroke"); gps->thickness = brush->size; + gps->gradient_f = brush->gpencil_settings->gradient_f; + copy_v2_v2(gps->gradient_s, brush->gpencil_settings->gradient_s); gps->inittime = 0.0f; /* the polygon must be closed, so enabled cyclic */ diff --git a/source/blender/editors/gpencil/gpencil_intern.h b/source/blender/editors/gpencil/gpencil_intern.h index aa47319e3d9..3742ca92551 100644 --- a/source/blender/editors/gpencil/gpencil_intern.h +++ b/source/blender/editors/gpencil/gpencil_intern.h @@ -356,7 +356,7 @@ typedef enum eGPencil_PaintModes { GP_PAINTMODE_ERASER, GP_PAINTMODE_DRAW_STRAIGHT, GP_PAINTMODE_DRAW_POLY, - GP_PAINTMODE_SET_CP + GP_PAINTMODE_SET_CP, } eGPencil_PaintModes; /* maximum sizes of gp-session buffer */ @@ -496,6 +496,8 @@ void GPENCIL_OT_vertex_group_select(struct wmOperatorType *ot); void GPENCIL_OT_vertex_group_deselect(struct wmOperatorType *ot); void GPENCIL_OT_vertex_group_invert(struct wmOperatorType *ot); void GPENCIL_OT_vertex_group_smooth(struct wmOperatorType *ot); +void GPENCIL_OT_vertex_group_normalize(struct wmOperatorType *ot); +void GPENCIL_OT_vertex_group_normalize_all(struct wmOperatorType *ot); /* color handle */ void GPENCIL_OT_lock_layer(struct wmOperatorType *ot); @@ -546,7 +548,7 @@ typedef enum ACTFILTER_FLAGS { ACTFILTER_IPOKEYS = (1 << 4), /* only channels referencing ipo's */ ACTFILTER_ONLYICU = (1 << 5), /* only reference ipo-curves */ ACTFILTER_FORDRAWING = (1 << 6), /* make list for interface drawing */ - ACTFILTER_ACTGROUPED = (1 << 7) /* belongs to the active group */ + ACTFILTER_ACTGROUPED = (1 << 7), /* belongs to the active group */ } ACTFILTER_FLAGS; /* Action Editor - Main Data types */ @@ -554,7 +556,7 @@ typedef enum ACTCONT_TYPES { ACTCONT_NONE = 0, ACTCONT_ACTION, ACTCONT_SHAPEKEY, - ACTCONT_GPENCIL + ACTCONT_GPENCIL, } ACTCONT_TYPES; /* ****************************************************** */ diff --git a/source/blender/editors/gpencil/gpencil_merge.c b/source/blender/editors/gpencil/gpencil_merge.c index 80b26a366fe..10bf45a9e2f 100644 --- a/source/blender/editors/gpencil/gpencil_merge.c +++ b/source/blender/editors/gpencil/gpencil_merge.c @@ -127,6 +127,8 @@ static bGPDstroke *gpencil_prepare_stroke(bContext *C, wmOperator *op, int totpo gps->totpoints = totpoints; gps->inittime = 0.0f; gps->thickness = brush->size; + gps->gradient_f = brush->gpencil_settings->gradient_f; + copy_v2_v2(gps->gradient_s, brush->gpencil_settings->gradient_s); gps->flag |= GP_STROKE_SELECT; gps->flag |= GP_STROKE_3DSPACE; gps->mat_nr = ob->actcol - 1; diff --git a/source/blender/editors/gpencil/gpencil_ops.c b/source/blender/editors/gpencil/gpencil_ops.c index c01da39bcd8..779094c21ea 100644 --- a/source/blender/editors/gpencil/gpencil_ops.c +++ b/source/blender/editors/gpencil/gpencil_ops.c @@ -322,6 +322,8 @@ void ED_operatortypes_gpencil(void) WM_operatortype_append(GPENCIL_OT_vertex_group_deselect); WM_operatortype_append(GPENCIL_OT_vertex_group_invert); WM_operatortype_append(GPENCIL_OT_vertex_group_smooth); + WM_operatortype_append(GPENCIL_OT_vertex_group_normalize); + WM_operatortype_append(GPENCIL_OT_vertex_group_normalize_all); /* color handle */ WM_operatortype_append(GPENCIL_OT_lock_layer); diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index daea24ecaa3..8ac4d602736 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -93,7 +93,7 @@ typedef enum eGPencil_PaintStatus { GP_STATUS_IDLING = 0, /* stroke isn't in progress yet */ GP_STATUS_PAINTING, /* a stroke is in progress */ GP_STATUS_ERROR, /* something wasn't correctly set up */ - GP_STATUS_DONE /* painting done */ + GP_STATUS_DONE, /* painting done */ } eGPencil_PaintStatus; /* Return flags for adding points to stroke buffer */ @@ -101,7 +101,7 @@ typedef enum eGP_StrokeAdd_Result { GP_STROKEADD_INVALID = -2, /* error occurred - insufficient info to do so */ GP_STROKEADD_OVERFLOW = -1, /* error occurred - cannot fit any more points */ GP_STROKEADD_NORMAL, /* point was successfully added */ - GP_STROKEADD_FULL /* cannot add any more points to buffer */ + GP_STROKEADD_FULL, /* cannot add any more points to buffer */ } eGP_StrokeAdd_Result; /* Runtime flags */ @@ -944,6 +944,8 @@ static void gp_stroke_newfrombuffer(tGPsdata *p) /* copy appropriate settings for stroke */ gps->totpoints = totelem; gps->thickness = brush->size; + gps->gradient_f = brush->gpencil_settings->gradient_f; + copy_v2_v2(gps->gradient_s, brush->gpencil_settings->gradient_s); gps->flag = gpd->runtime.sbuffer_sflag; gps->inittime = p->inittime; diff --git a/source/blender/editors/gpencil/gpencil_primitive.c b/source/blender/editors/gpencil/gpencil_primitive.c index f92398520fa..374dbbf4d9c 100644 --- a/source/blender/editors/gpencil/gpencil_primitive.c +++ b/source/blender/editors/gpencil/gpencil_primitive.c @@ -319,6 +319,9 @@ static void gp_primitive_set_initdata(bContext *C, tGPDprimitive *tgpi) /* create new temp stroke */ bGPDstroke *gps = MEM_callocN(sizeof(bGPDstroke), "Temp bGPDstroke"); gps->thickness = 2.0f; + gps->gradient_f = 1.0f; + gps->gradient_s[0] = 1.0f; + gps->gradient_s[1] = 1.0f; gps->inittime = 0.0f; /* enable recalculation flag by default */ @@ -1199,6 +1202,7 @@ static void gpencil_primitive_interaction_end(bContext *C, wmOperator *op, wmWin bGPDstroke *gps; ToolSettings *ts = tgpi->scene->toolsettings; + Brush *brush = tgpi->brush; const int def_nr = tgpi->ob->actdef - 1; const bool have_weight = (bool)BLI_findlink(&tgpi->ob->defbase, def_nr); @@ -1221,7 +1225,10 @@ static void gpencil_primitive_interaction_end(bContext *C, wmOperator *op, wmWin /* prepare stroke to get transferred */ gps = tgpi->gpf->strokes.first; if (gps) { - gps->thickness = tgpi->brush->size; + gps->thickness = brush->size; + gps->gradient_f = brush->gpencil_settings->gradient_f; + copy_v2_v2(gps->gradient_s, brush->gpencil_settings->gradient_s); + gps->flag |= GP_STROKE_RECALC_GEOMETRY; gps->tot_triangles = 0; diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h index 6dccc55d3ff..dc5ffb4794d 100644 --- a/source/blender/editors/include/ED_anim_api.h +++ b/source/blender/editors/include/ED_anim_api.h @@ -240,7 +240,7 @@ typedef enum eAnim_ChannelType { ANIMTYPE_PALETTE, /* always as last item, the total number of channel types... */ - ANIMTYPE_NUM_TYPES + ANIMTYPE_NUM_TYPES, } eAnim_ChannelType; /* types of keyframe data in bAnimListElem */ @@ -255,7 +255,7 @@ typedef enum eAnim_KeyType { ALE_SCE, /* Scene summary */ ALE_OB, /* Object summary */ ALE_ACT, /* Action summary */ - ALE_GROUP /* Action Group summary */ + ALE_GROUP, /* Action Group summary */ } eAnim_KeyType; /* Flags for specifying the types of updates (i.e. recalculation/refreshing) that @@ -792,4 +792,13 @@ void ED_drivers_editor_init(struct bContext *C, struct ScrArea *sa); /* ************************************************ */ +void animviz_calc_motionpaths(struct Depsgraph *depsgraph, + struct Main *bmain, + struct Scene *scene, + ListBase *targets, + bool restore, + bool current_frame_only); + +void animviz_get_object_motionpaths(struct Object *ob, ListBase *targets); + #endif /* __ED_ANIM_API_H__ */ diff --git a/source/blender/editors/include/ED_fileselect.h b/source/blender/editors/include/ED_fileselect.h index 000af75a9cb..48c38396e98 100644 --- a/source/blender/editors/include/ED_fileselect.h +++ b/source/blender/editors/include/ED_fileselect.h @@ -121,7 +121,7 @@ typedef enum FSMenuCategory { FS_CATEGORY_SYSTEM, FS_CATEGORY_SYSTEM_BOOKMARKS, FS_CATEGORY_BOOKMARKS, - FS_CATEGORY_RECENT + FS_CATEGORY_RECENT, } FSMenuCategory; typedef enum FSMenuInsert { diff --git a/source/blender/editors/include/ED_keyframes_draw.h b/source/blender/editors/include/ED_keyframes_draw.h index 475484104a1..5c97dc835d1 100644 --- a/source/blender/editors/include/ED_keyframes_draw.h +++ b/source/blender/editors/include/ED_keyframes_draw.h @@ -104,7 +104,7 @@ typedef enum eKeyframeShapeDrawOpts { /* only the inside filling */ KEYFRAME_SHAPE_INSIDE, /* the whole thing */ - KEYFRAME_SHAPE_BOTH + KEYFRAME_SHAPE_BOTH, } eKeyframeShapeDrawOpts; /* Handle type. */ diff --git a/source/blender/editors/include/ED_keyframes_edit.h b/source/blender/editors/include/ED_keyframes_edit.h index 402dc3e67bc..266eb3850b3 100644 --- a/source/blender/editors/include/ED_keyframes_edit.h +++ b/source/blender/editors/include/ED_keyframes_edit.h @@ -72,7 +72,7 @@ typedef enum eEditKeyframes_Select { /* "selection map" building modes */ typedef enum eEditKeyframes_SelMap { SELMAP_MORE = 0, - SELMAP_LESS + SELMAP_LESS, } eEditKeyframes_SelMap; /* snapping tools */ @@ -199,7 +199,7 @@ typedef enum eKeyPasteOffset { /* paste keys relative to the current frame when copying */ KEYFRAME_PASTE_OFFSET_CFRA_RELATIVE, /* paste keys from original time */ - KEYFRAME_PASTE_OFFSET_NONE + KEYFRAME_PASTE_OFFSET_NONE, } eKeyPasteOffset; typedef enum eKeyMergeMode { @@ -210,7 +210,7 @@ typedef enum eKeyMergeMode { /* overwrite keys in pasted range */ KEYFRAME_PASTE_MERGE_OVER_RANGE, /* overwrite keys in pasted range (use all keyframe start & end for range) */ - KEYFRAME_PASTE_MERGE_OVER_RANGE_ALL + KEYFRAME_PASTE_MERGE_OVER_RANGE_ALL, } eKeyMergeMode; /* ---------------- Looping API --------------------- */ diff --git a/source/blender/editors/include/ED_screen_types.h b/source/blender/editors/include/ED_screen_types.h index 762fba29947..46b8a9b34de 100644 --- a/source/blender/editors/include/ED_screen_types.h +++ b/source/blender/editors/include/ED_screen_types.h @@ -81,7 +81,7 @@ typedef enum { AE_TOP_TO_BOTTOMRIGHT, /** Region located at the top, _bottom_ edge is action zone. * Region minimized to the top left */ - AE_BOTTOM_TO_TOPLEFT + AE_BOTTOM_TO_TOPLEFT, } AZEdge; typedef enum { diff --git a/source/blender/editors/include/ED_transverts.h b/source/blender/editors/include/ED_transverts.h index 95b74a2108f..d03cd0151a6 100644 --- a/source/blender/editors/include/ED_transverts.h +++ b/source/blender/editors/include/ED_transverts.h @@ -49,7 +49,7 @@ bool ED_transverts_poll(struct bContext *C); enum { TM_INDEX_ON = 1, /* tag to make trans verts */ TM_INDEX_OFF = 0, /* don't make verts */ - TM_INDEX_SKIP = -1 /* dont make verts (when the index values point to trans-verts) */ + TM_INDEX_SKIP = -1, /* dont make verts (when the index values point to trans-verts) */ }; /* mode flags: */ diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 4a3e0983989..b862f36337c 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -292,7 +292,7 @@ typedef enum { UI_BUT_POIN_INT = 96, UI_BUT_POIN_FLOAT = 128, /* UI_BUT_POIN_FUNCTION = 192, */ /*UNUSED*/ - UI_BUT_POIN_BIT = 256 /* OR'd with a bit index*/ + UI_BUT_POIN_BIT = 256, /* OR'd with a bit index*/ } eButPointerType; /* requires (but->poin != NULL) */ diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h index ae2f0269a9c..61fc09b751b 100644 --- a/source/blender/editors/include/UI_resources.h +++ b/source/blender/editors/include/UI_resources.h @@ -35,7 +35,7 @@ typedef enum { /* ui */ #include "UI_icons.h" - BIFICONID_LAST + BIFICONID_LAST, } BIFIconID; #define BIFICONID_FIRST (ICON_NONE) @@ -310,7 +310,7 @@ typedef enum ThemeColorID { TH_METADATA_TEXT, TH_EDGE_BEVEL, - TH_VERTEX_BEVEL + TH_VERTEX_BEVEL, } ThemeColorID; /* specific defines per space should have higher define values */ diff --git a/source/blender/editors/include/UI_view2d.h b/source/blender/editors/include/UI_view2d.h index 98e00eab9c9..6efbcf09e97 100644 --- a/source/blender/editors/include/UI_view2d.h +++ b/source/blender/editors/include/UI_view2d.h @@ -70,8 +70,6 @@ enum eView2D_Units { /* for drawing values */ V2D_UNIT_VALUES, - V2D_UNIT_DEGREES, - V2D_UNIT_TIME, }; /* clamping of grid values to whole numbers */ @@ -169,6 +167,12 @@ void UI_view2d_grid_draw(struct View2D *v2d, View2DGrid *grid, int flag); void UI_view2d_constant_grid_draw(struct View2D *v2d, float step); void UI_view2d_multi_grid_draw(struct View2D *v2d, int colorid, float step, int level_size, int totlevels); void UI_view2d_grid_size(View2DGrid *grid, float *r_dx, float *r_dy); +void UI_view2d_grid_draw_numbers_horizontal(const struct Scene *scene, const struct View2D *v2d, + const View2DGrid *grid, const struct rcti *rect, + int unit, bool whole_numbers_only); +void UI_view2d_grid_draw_numbers_vertical(const struct Scene *scene, const struct View2D *v2d, + const View2DGrid *grid, const struct rcti *rect, + int unit, float text_offset); void UI_view2d_grid_free(View2DGrid *grid); /* scrollbar drawing */ @@ -210,6 +214,8 @@ struct View2D *UI_view2d_fromcontext(const struct bContext *C); struct View2D *UI_view2d_fromcontext_rwin(const struct bContext *C); void UI_view2d_scale_get(struct View2D *v2d, float *r_x, float *r_y); +float UI_view2d_scale_get_x(const struct View2D *v2d); +float UI_view2d_scale_get_y(const struct View2D *v2d); void UI_view2d_scale_get_inverse(struct View2D *v2d, float *r_x, float *r_y); void UI_view2d_center_get(struct View2D *v2d, float *r_x, float *r_y); diff --git a/source/blender/editors/interface/CMakeLists.txt b/source/blender/editors/interface/CMakeLists.txt index 78b0202dc22..fd6b0e4a0c5 100644 --- a/source/blender/editors/interface/CMakeLists.txt +++ b/source/blender/editors/interface/CMakeLists.txt @@ -80,6 +80,9 @@ set(SRC ) set(LIB + bf_blenkernel + bf_blenlib + bf_editor_datafiles ) if(WITH_INTERNATIONAL) diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 098a1e7c8a2..b76be4cf4d8 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -1706,7 +1706,7 @@ int ui_but_is_pushed_ex(uiBut *but, double *value) int is_push = 0; if (but->bit) { - const bool state = ELEM(but->type, UI_BTYPE_TOGGLE_N, UI_BTYPE_ICON_TOGGLE_N, UI_BTYPE_CHECKBOX_N) ? false : true; + const bool state = !ELEM(but->type, UI_BTYPE_TOGGLE_N, UI_BTYPE_ICON_TOGGLE_N, UI_BTYPE_CHECKBOX_N); int lvalue; UI_GET_BUT_VALUE_INIT(but, *value); lvalue = (int)*value; diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 07be2253969..86a225bf3bd 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -133,7 +133,7 @@ typedef enum uiButtonActivateType { BUTTON_ACTIVATE, BUTTON_ACTIVATE_APPLY, BUTTON_ACTIVATE_TEXT_EDITING, - BUTTON_ACTIVATE_OPEN + BUTTON_ACTIVATE_OPEN, } uiButtonActivateType; typedef enum uiHandleButtonState { @@ -147,7 +147,7 @@ typedef enum uiHandleButtonState { BUTTON_STATE_TEXT_SELECTING, BUTTON_STATE_MENU_OPEN, BUTTON_STATE_WAIT_DRAG, - BUTTON_STATE_EXIT + BUTTON_STATE_EXIT, } uiHandleButtonState; diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 6c4389aabd9..fbfa2d11e45 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -118,7 +118,7 @@ typedef enum uiItemType { TEMPLATE_BOX, TEMPLATE_HEADER, - TEMPLATE_HEADER_ID + TEMPLATE_HEADER_ID, #endif } uiItemType; diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index c34992ceb9c..b44b666a050 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -90,7 +90,7 @@ typedef enum uiHandlePanelState { PANEL_STATE_DRAG_SCALE, PANEL_STATE_WAIT_UNTAB, PANEL_STATE_ANIMATION, - PANEL_STATE_EXIT + PANEL_STATE_EXIT, } uiHandlePanelState; typedef struct uiHandlePanelData { diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index 7d5a2e73113..a01088277f2 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -1714,6 +1714,129 @@ void UI_view2d_multi_grid_draw(View2D *v2d, int colorid, float step, int level_s immUnbindProgram(); } +static void get_scale_indicator_text( + const Scene *scene, + float value, + int brevity_level, + short unit, + uint max_length, + char *r_str) +{ + if (unit == V2D_UNIT_SECONDS) { + BLI_timecode_string_from_time(r_str, max_length, brevity_level, value / (float)FPS, FPS, U.timecode_style); + } + else { + BLI_timecode_string_from_time_seconds(r_str, max_length, brevity_level, value); + } +} + +void UI_view2d_grid_draw_numbers_horizontal( + const Scene *scene, + const View2D *v2d, + const View2DGrid *grid, + const rcti *rect, + int unit, + bool whole_numbers_only) +{ + BLI_assert(grid); + float xstep = grid->dx * UI_view2d_scale_get_x(v2d); + if (xstep <= 0.0f) { + return; + } + + float initial_xpos = UI_view2d_view_to_region_x(v2d, grid->startx); + float ypos = (float)rect->ymin + 2 * UI_DPI_FAC; + float initial_value = grid->startx; + float value_step = grid->dx; + int brevity_level = grid->powerx; + + /* Make sure that the value_step is >= 1 when only whole numbers are displayed. + * Otherwise the same number could be displayed more than once. */ + if (whole_numbers_only) { + while (value_step < 0.9999f) { + xstep *= 2.0f; + value_step *= 2.0f; + } + } + + /* Skip first few steps if they don't intersect + * the rectangle that will contain the numbers. */ + while (initial_xpos < rect->xmin) { + initial_xpos += xstep; + initial_value += value_step; + } + + if (unit == V2D_UNIT_FRAMES) { + brevity_level = 1; + } + + const int font_id = BLF_default(); + UI_FontThemeColor(font_id, TH_TEXT); + + BLF_batch_draw_begin(); + + for (float xpos = initial_xpos, value = initial_value; + xpos < rect->xmax; + xpos += xstep, value += value_step) + { + char text[32]; + get_scale_indicator_text(scene, value, brevity_level, unit, sizeof(text), text); + float text_width = BLF_width(font_id, text, strlen(text)); + BLF_draw_default_ascii(xpos - text_width / 2.0f, ypos, 0.0f, text, sizeof(text)); + } + + BLF_batch_draw_end(); +} + +void UI_view2d_grid_draw_numbers_vertical( + const Scene *scene, + const View2D *v2d, + const View2DGrid *grid, + const rcti *rect, + int unit, + float text_offset) +{ + BLI_assert(grid); + float ystep = grid->dy * UI_view2d_scale_get_y(v2d); + if (ystep <= 0.0f) { + return; + } + + const int font_id = BLF_default(); + UI_FontThemeColor(font_id, TH_TEXT); + + BLF_enable(font_id, BLF_ROTATION); + BLF_rotation(font_id, M_PI_2); + + float initial_value = grid->starty; + float value_step = grid->dy; + float xpos = rect->xmax - 2.0f * UI_DPI_FAC; + float initial_ypos = UI_view2d_view_to_region_y(v2d, grid->starty); + + /* Currently only used by the sequencer to display + * channel numbers in the center. */ + initial_ypos += text_offset * ystep; + + /* Skip first few steps if they don't intersect + * the rectangle that will contain the numbers. */ + while (initial_ypos < rect->ymin) { + initial_ypos += ystep; + initial_value += value_step; + } + + for (float ypos = initial_ypos, value = initial_value; + ypos < rect->ymax; + ypos += ystep, value += value_step) + { + char text[32]; + get_scale_indicator_text(scene, value, grid->powery, unit, sizeof(text), text); + float text_width = BLF_width(font_id, text, sizeof(text)); + BLF_draw_default_ascii(xpos, ypos - text_width / 2.0f, 0.0f, text, sizeof(text)); + } + + BLF_disable(font_id, BLF_ROTATION); +} + /* the price we pay for not exposting structs :( */ void UI_view2d_grid_size(View2DGrid *grid, float *r_dx, float *r_dy) { @@ -1904,61 +2027,10 @@ View2DScrollers *UI_view2d_scrollers_calc( return scrollers; } -/* Print scale marking along a time scrollbar */ -static void scroll_printstr(Scene *scene, float x, float y, float val, int power, short unit, char dir) -{ - int len; - char timecode_str[32]; - - /* adjust the scale unit to work ok */ - if (dir == 'v') { - /* here we bump up the power by factor of 10, as - * rotation values (hence 'degrees') are divided by 10 to - * be able to show the curves at the same time - */ - if (ELEM(unit, V2D_UNIT_DEGREES, V2D_UNIT_TIME)) { - power += 1; - val *= 10; - } - } - - /* get string to print */ - if (unit == V2D_UNIT_SECONDS) { - /* not neces*/ - BLI_timecode_string_from_time(timecode_str, sizeof(timecode_str), power, val, FPS, U.timecode_style); - } - else { - BLI_timecode_string_from_time_seconds(timecode_str, sizeof(timecode_str), power, val); - } - - /* get length of string, - * and adjust printing location to fit it into the horizontal scrollbar */ - len = strlen(timecode_str); - if (dir == 'h') { - /* seconds/timecode display has slightly longer strings... */ - if (unit == V2D_UNIT_SECONDS) { - x -= 3 * len; - } - else { - x -= 4 * len; - } - } - - /* Add degree sympbol to end of string for vertical scrollbar? */ - if ((dir == 'v') && (unit == V2D_UNIT_DEGREES)) { - timecode_str[len] = 186; - timecode_str[len + 1] = 0; - } - - /* draw it */ - BLF_draw_default_ascii(x, y, 0.0f, timecode_str, sizeof(timecode_str)); -} - /* Draw scrollbars in the given 2d-region */ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *vs) { bTheme *btheme = UI_GetTheme(); - Scene *scene = CTX_data_scene(C); rcti vert, hor; const int scroll = view2d_scroll_mapped(v2d->scroll); const char emboss_alpha = btheme->tui.widget_emboss[3]; @@ -2006,73 +2078,10 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v UI_draw_widget_scroll(&wcol, &hor, &slider, state); - /* scale indicators */ - if ((scroll & V2D_SCROLL_SCALE_HORIZONTAL) && (vs->grid)) { - const int font_id = BLF_default(); - View2DGrid *grid = vs->grid; - float fac, dfac, fac2, val; - - /* the numbers: convert grid->startx and -dx to scroll coordinates - * - fac is x-coordinate to draw to - * - dfac is gap between scale markings - */ - fac = (grid->startx - v2d->cur.xmin) / BLI_rctf_size_x(&v2d->cur); - fac = (float)hor.xmin + fac * BLI_rcti_size_x(&hor); - - dfac = grid->dx / BLI_rctf_size_x(&v2d->cur); - dfac = dfac * BLI_rcti_size_x(&hor); - - /* set starting value, and text color */ - UI_FontThemeColor(font_id, TH_TEXT); - val = grid->startx; - - /* if we're clamping to whole numbers only, make sure entries won't be repeated */ - if (vs->xclamp == V2D_GRID_CLAMP) { - while (grid->dx < 0.9999f) { - grid->dx *= 2.0f; - dfac *= 2.0f; - } - } - if (vs->xunits == V2D_UNIT_FRAMES) { - grid->powerx = 1; - } - - /* draw numbers in the appropriate range */ - if (dfac > 0.0f) { - float h = 0.1f * UI_UNIT_Y + (float)(hor.ymin); - - BLF_batch_draw_begin(); - - for (; fac < hor.xmax - 0.5f * U.widget_unit; fac += dfac, val += grid->dx) { - - /* make prints look nicer for scrollers */ - if (fac < hor.xmin + 0.5f * U.widget_unit) { - continue; - } - - switch (vs->xunits) { - case V2D_UNIT_FRAMES: /* frames (as whole numbers)*/ - scroll_printstr(scene, fac, h, val, grid->powerx, V2D_UNIT_FRAMES, 'h'); - break; - - case V2D_UNIT_FRAMESCALE: /* frames (not always as whole numbers) */ - scroll_printstr(scene, fac, h, val, grid->powerx, V2D_UNIT_FRAMESCALE, 'h'); - break; - - case V2D_UNIT_SECONDS: /* seconds */ - fac2 = val / (float)FPS; - scroll_printstr(scene, fac, h, fac2, grid->powerx, V2D_UNIT_SECONDS, 'h'); - break; - - case V2D_UNIT_DEGREES: /* Graph Editor for rotation Drivers */ - /* HACK: although we're drawing horizontal, - * we make this draw as 'vertical', just to get degree signs */ - scroll_printstr(scene, fac, h, val, grid->powerx, V2D_UNIT_DEGREES, 'v'); - break; - } - } - - BLF_batch_draw_end(); + { + if (scroll & V2D_SCROLL_SCALE_HORIZONTAL) { + UI_view2d_grid_draw_numbers_horizontal( + CTX_data_scene(C), v2d, vs->grid, &vs->hor, vs->xunits, vs->xclamp == V2D_GRID_CLAMP); } } } @@ -2112,51 +2121,14 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v UI_draw_widget_scroll(&wcol, &vert, &slider, state); - - /* scale indiators */ - if ((scroll & V2D_SCROLL_SCALE_VERTICAL) && (vs->grid)) { - View2DGrid *grid = vs->grid; - float fac, dfac, val; - - /* the numbers: convert grid->starty and dy to scroll coordinates - * - fac is y-coordinate to draw to - * - dfac is gap between scale markings - * - these involve a correction for horizontal scrollbar - * NOTE: it's assumed that that scrollbar is there if this is involved! - */ - fac = (grid->starty - v2d->cur.ymin) / BLI_rctf_size_y(&v2d->cur); - fac = vert.ymin + fac * BLI_rcti_size_y(&vert); - - dfac = grid->dy / BLI_rctf_size_y(&v2d->cur); - dfac = dfac * BLI_rcti_size_y(&vert); - - /* set starting value, and text color */ - const int font_id = BLF_default(); - UI_FontThemeColor(font_id, TH_TEXT); - val = grid->starty; - - /* if vertical clamping (to whole numbers) is used (i.e. in Sequencer), - * apply correction */ - if (vs->yclamp == V2D_GRID_CLAMP) { - fac += 0.5f * dfac; - } - - /* draw vertical steps */ - if (dfac > 0.0f) { - BLF_rotation(font_id, M_PI_2); - BLF_enable(font_id, BLF_ROTATION); - - for (; fac < vert.ymax - 10; fac += dfac, val += grid->dy) { - - /* make prints look nicer for scrollers */ - if (fac < vert.ymin + 10) { - continue; - } - - scroll_printstr(scene, (float)(vert.xmax) - 2.0f, fac, val, grid->powery, vs->yunits, 'v'); + { + if (scroll & V2D_SCROLL_SCALE_VERTICAL) { + float text_offset = 0.0f; + if (vs->yclamp & V2D_GRID_CLAMP) { + text_offset = 0.5f; } - - BLF_disable(font_id, BLF_ROTATION); + UI_view2d_grid_draw_numbers_vertical( + CTX_data_scene(C), v2d, vs->grid, &vs->vert, vs->yunits, text_offset); } } } @@ -2519,12 +2491,20 @@ View2D *UI_view2d_fromcontext_rwin(const bContext *C) void UI_view2d_scale_get(View2D *v2d, float *r_x, float *r_y) { if (r_x) { - *r_x = BLI_rcti_size_x(&v2d->mask) / BLI_rctf_size_x(&v2d->cur); + *r_x = UI_view2d_scale_get_x(v2d); } if (r_y) { - *r_y = BLI_rcti_size_y(&v2d->mask) / BLI_rctf_size_y(&v2d->cur); + *r_y = UI_view2d_scale_get_y(v2d); } } +float UI_view2d_scale_get_x(const View2D *v2d) +{ + return BLI_rcti_size_x(&v2d->mask) / BLI_rctf_size_x(&v2d->cur); +} +float UI_view2d_scale_get_y(const View2D *v2d) +{ + return BLI_rcti_size_y(&v2d->mask) / BLI_rctf_size_y(&v2d->cur); +} /** * Same as ``UI_view2d_scale_get() - 1.0f / x, y`` */ diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index 790b92a357e..62d434584fe 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -1698,7 +1698,7 @@ enum { SCROLLHANDLE_BAR, SCROLLHANDLE_MAX, SCROLLHANDLE_MIN_OUTSIDE, - SCROLLHANDLE_MAX_OUTSIDE + SCROLLHANDLE_MAX_OUTSIDE, } /*eV2DScrollerHandle_Zone*/; /* ------------------------ */ diff --git a/source/blender/editors/io/CMakeLists.txt b/source/blender/editors/io/CMakeLists.txt index 1aa6de534c4..6e3e111739c 100644 --- a/source/blender/editors/io/CMakeLists.txt +++ b/source/blender/editors/io/CMakeLists.txt @@ -47,13 +47,21 @@ set(SRC ) set(LIB + bf_blenkernel + bf_blenlib ) if(WITH_OPENCOLLADA) + list(APPEND LIB + bf_collada + ) add_definitions(-DWITH_COLLADA) endif() if(WITH_ALEMBIC) + list(APPEND LIB + bf_alembic + ) add_definitions(-DWITH_ALEMBIC) if(WITH_ALEMBIC_HDF5) diff --git a/source/blender/editors/mesh/CMakeLists.txt b/source/blender/editors/mesh/CMakeLists.txt index 41e247b8d77..707aeb781c6 100644 --- a/source/blender/editors/mesh/CMakeLists.txt +++ b/source/blender/editors/mesh/CMakeLists.txt @@ -73,6 +73,8 @@ set(SRC ) set(LIB + bf_blenkernel + bf_blenlib ) if(WITH_INTERNATIONAL) diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c index ef2e01e05fb..7a6144d8e0f 100644 --- a/source/blender/editors/mesh/editface.c +++ b/source/blender/editors/mesh/editface.c @@ -433,58 +433,63 @@ bool do_paintface_box_select(ViewContext *vc, const rcti *rect, int sel_op) { Object *ob = vc->obact; Mesh *me; - MPoly *mpoly; - uint *rt; - char *selar; - int a, index; me = BKE_mesh_from_object(ob); - if ((me == NULL) || (me->totpoly == 0) || BLI_rcti_is_empty(rect)) { + if ((me == NULL) || (me->totpoly == 0)) { return false; } - selar = MEM_callocN(me->totpoly + 1, "selar"); - bool changed = false; if (SEL_OP_USE_PRE_DESELECT(sel_op)) { changed |= paintface_deselect_all_visible(vc->C, vc->obact, SEL_DESELECT, false); } - uint buf_len; - uint *buf = ED_view3d_select_id_read_rect(vc, rect, &buf_len); + if (BLI_rcti_is_empty(rect)) { + /* pass */ + } + else { + MPoly *mpoly; + uint *rt; + int a, index; - rt = buf; + char *selar = MEM_callocN(me->totpoly + 1, "selar"); - a = buf_len; - while (a--) { - if (*rt) { - index = *rt; - if (index <= me->totpoly) { - selar[index] = 1; + uint buf_len; + uint *buf = ED_view3d_select_id_read_rect(vc, rect, &buf_len); + + rt = buf; + + a = buf_len; + while (a--) { + if (*rt) { + index = *rt; + if (index <= me->totpoly) { + selar[index] = 1; + } } + rt++; } - rt++; - } - mpoly = me->mpoly; - for (a = 1; a <= me->totpoly; a++, mpoly++) { - if ((mpoly->flag & ME_HIDE) == 0) { - const bool is_select = mpoly->flag & ME_FACE_SEL; - const bool is_inside = (selar[a] != 0); - const int sel_op_result = ED_select_op_action_deselected(sel_op, is_select, is_inside); - if (sel_op_result != -1) { - SET_FLAG_FROM_TEST(mpoly->flag, sel_op_result, ME_FACE_SEL); - changed = true; + mpoly = me->mpoly; + for (a = 1; a <= me->totpoly; a++, mpoly++) { + if ((mpoly->flag & ME_HIDE) == 0) { + const bool is_select = mpoly->flag & ME_FACE_SEL; + const bool is_inside = (selar[a] != 0); + const int sel_op_result = ED_select_op_action_deselected(sel_op, is_select, is_inside); + if (sel_op_result != -1) { + SET_FLAG_FROM_TEST(mpoly->flag, sel_op_result, ME_FACE_SEL); + changed = true; + } } } - } - MEM_freeN(buf); - MEM_freeN(selar); + MEM_freeN(buf); + MEM_freeN(selar); #ifdef __APPLE__ - glReadBuffer(GL_BACK); + glReadBuffer(GL_BACK); #endif + } if (changed) { paintface_flush_flags(vc->C, vc->obact, SELECT); diff --git a/source/blender/editors/object/CMakeLists.txt b/source/blender/editors/object/CMakeLists.txt index 7a5eee4bfbb..75d2fada7f3 100644 --- a/source/blender/editors/object/CMakeLists.txt +++ b/source/blender/editors/object/CMakeLists.txt @@ -69,6 +69,9 @@ set(SRC ) set(LIB + bf_blenkernel + bf_blenlib + bf_render ) add_definitions(${GL_DEFINITIONS}) diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index fe01764de1f..988d9373766 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -884,6 +884,7 @@ static void child_get_inverse_matrix(const bContext *C, Scene *scene, Object *ob /* ChildOf Constraint - set inverse callback */ static int childof_set_inverse_exec(bContext *C, wmOperator *op) { + Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); Object *ob = ED_object_active_context(C); bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_CHILDOF); @@ -899,6 +900,7 @@ static int childof_set_inverse_exec(bContext *C, wmOperator *op) child_get_inverse_matrix(C, scene, ob, con, data->invmat, owner); + ED_object_constraint_update(bmain, ob); WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, ob); return OPERATOR_FINISHED; @@ -934,6 +936,7 @@ void CONSTRAINT_OT_childof_set_inverse(wmOperatorType *ot) /* ChildOf Constraint - clear inverse callback */ static int childof_clear_inverse_exec(bContext *C, wmOperator *op) { + Main *bmain = CTX_data_main(C); Object *ob = ED_object_active_context(C); bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_CHILDOF); bChildOfConstraint *data = (con) ? (bChildOfConstraint *)con->data : NULL; @@ -946,6 +949,7 @@ static int childof_clear_inverse_exec(bContext *C, wmOperator *op) /* simply clear the matrix */ unit_m4(data->invmat); + ED_object_constraint_update(bmain, ob); WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, ob); return OPERATOR_FINISHED; @@ -1302,7 +1306,7 @@ static int constraint_delete_exec(bContext *C, wmOperator *UNUSED(op)) /* needed to set the flags on posebones correctly */ ED_object_constraint_update(bmain, ob); - /* relatiols */ + /* relations */ DEG_relations_tag_update(CTX_data_main(C)); /* notifiers */ diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 7950e79162d..ce1a7306773 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -83,6 +83,7 @@ #include "DEG_depsgraph.h" #include "DEG_depsgraph_build.h" +#include "ED_anim_api.h" #include "ED_armature.h" #include "ED_curve.h" #include "ED_mesh.h" diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index 1944d2989ac..9576cbe6fa1 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -1610,7 +1610,7 @@ void OBJECT_OT_skin_root_mark(wmOperatorType *ot) typedef enum { SKIN_LOOSE_MARK, - SKIN_LOOSE_CLEAR + SKIN_LOOSE_CLEAR, } SkinLooseAction; static int skin_loose_mark_clear_exec(bContext *C, wmOperator *op) diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 6d3cca5477e..a9b00e7bbdd 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -440,7 +440,7 @@ void OBJECT_OT_proxy_make(wmOperatorType *ot) typedef enum eObClearParentTypes { CLEAR_PARENT_ALL = 0, CLEAR_PARENT_KEEP_TRANSFORM, - CLEAR_PARENT_INVERSE + CLEAR_PARENT_INVERSE, } eObClearParentTypes; EnumPropertyItem prop_clear_parent_types[] = { @@ -948,6 +948,8 @@ static int parent_set_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent RNA_boolean_set(&opptr, "keep_transform", true); #endif + uiItemO(layout, IFACE_("Object (Without Inverse)"), ICON_NONE, "OBJECT_OT_parent_no_inverse_set"); + struct { bool mesh, gpencil; } has_children_of_type = { 0 }; diff --git a/source/blender/editors/physics/CMakeLists.txt b/source/blender/editors/physics/CMakeLists.txt index 1b42c3f2669..39a34ed7a47 100644 --- a/source/blender/editors/physics/CMakeLists.txt +++ b/source/blender/editors/physics/CMakeLists.txt @@ -25,7 +25,6 @@ set(INC ../../makesdna ../../makesrna ../../windowmanager - ../../../../intern/elbeem/extern ../../../../intern/guardedalloc ../../../../intern/glew-mx ) @@ -52,12 +51,26 @@ set(SRC ) set(LIB + bf_blenkernel + bf_blenlib ) if(WITH_MOD_FLUID) + list(APPEND INC + ../../../../intern/elbeem/extern + ) + list(APPEND LIB + bf_intern_elbeem + ) add_definitions(-DWITH_MOD_FLUID) endif() +if(WITH_MOD_SMOKE) + list(APPEND LIB + bf_intern_smoke + ) +endif() + if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) endif() diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index bd78677bdb6..f2d9871a99d 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -38,6 +38,7 @@ #include "BLI_math.h" #include "BLI_lasso_2d.h" #include "BLI_listbase.h" +#include "BLI_rect.h" #include "BLI_kdtree.h" #include "BLI_rand.h" #include "BLI_task.h" @@ -1813,7 +1814,7 @@ void PARTICLE_OT_select_roots(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ - WM_operator_properties_select_action(ot, SEL_SELECT); + WM_operator_properties_select_action(ot, SEL_SELECT, true); } /************************ select tip operator ************************/ @@ -1883,7 +1884,7 @@ void PARTICLE_OT_select_tips(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ - WM_operator_properties_select_action(ot, SEL_SELECT); + WM_operator_properties_select_action(ot, SEL_SELECT, true); } /*********************** select random operator ************************/ @@ -2066,7 +2067,14 @@ bool PE_box_select(bContext *C, const rcti *rect, const int sel_op) if (SEL_OP_USE_PRE_DESELECT(sel_op)) { data.is_changed = PE_deselect_all_visible_ex(edit); } - for_mouse_hit_keys(&data, select_key_op, PSEL_ALL_KEYS); + + if (BLI_rcti_is_empty(rect)) { + /* pass */ + } + else { + for_mouse_hit_keys(&data, select_key_op, PSEL_ALL_KEYS); + } + if (data.is_changed) { PE_update_selection(data.depsgraph, scene, ob, 1); WM_event_add_notifier(C, NC_OBJECT | ND_PARTICLE | NA_SELECTED, ob); @@ -4798,8 +4806,11 @@ void PE_create_particle_edit( edit = (psys) ? psys->edit : cache->edit; if (!edit) { - ParticleSystem *psys_eval = psys_eval_get(depsgraph, ob, psys); - psys_copy_particles(psys, psys_eval); + ParticleSystem *psys_eval = NULL; + if (psys) { + psys_eval = psys_eval_get(depsgraph, ob, psys); + psys_copy_particles(psys, psys_eval); + } totpoint = psys ? psys->totpart : (int)((PTCacheMem *)cache->mem_cache.first)->totpoint; diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c index 9192d1c2fe9..d3b57a09a9e 100644 --- a/source/blender/editors/physics/physics_fluid.c +++ b/source/blender/editors/physics/physics_fluid.c @@ -45,8 +45,6 @@ #include "DEG_depsgraph.h" -#include "LBM_fluidsim.h" - #include "ED_screen.h" #include "WM_types.h" @@ -57,6 +55,8 @@ /* enable/disable overall compilation */ #ifdef WITH_MOD_FLUID +#include "LBM_fluidsim.h" + #include "BLI_blenlib.h" #include "BLI_path_util.h" #include "BLI_math.h" diff --git a/source/blender/editors/scene/CMakeLists.txt b/source/blender/editors/scene/CMakeLists.txt index 0768e0ee571..be1cd09f965 100644 --- a/source/blender/editors/scene/CMakeLists.txt +++ b/source/blender/editors/scene/CMakeLists.txt @@ -35,6 +35,8 @@ set(SRC ) set(LIB + bf_blenkernel + bf_blenlib ) if(WITH_INTERNATIONAL) diff --git a/source/blender/editors/screen/CMakeLists.txt b/source/blender/editors/screen/CMakeLists.txt index a4a0b873c92..11516a73d1e 100644 --- a/source/blender/editors/screen/CMakeLists.txt +++ b/source/blender/editors/screen/CMakeLists.txt @@ -55,6 +55,8 @@ set(SRC ) set(LIB + bf_editor_datafiles + bf_editor_space_sequencer ) if(WITH_INTERNATIONAL) diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index f475a87df59..3e5bebc4d35 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -789,37 +789,33 @@ static AZone *area_actionzone_refresh_xy(ScrArea *sa, const int xy[2], const boo } if (redraw) { - ED_area_tag_redraw_no_rebuild(sa); + ED_region_tag_redraw_no_rebuild(ar); } /* Don't return! */ } } } else if (!test_only && !IS_EQF(az->alpha, 0.0f)) { - bool changed = false; - if (az->type == AZONE_FULLSCREEN) { az->alpha = 0.0f; - changed = true; + sa->flag &= ~AREA_FLAG_ACTIONZONES_UPDATE; + ED_area_tag_redraw_no_rebuild(sa); } else if (az->type == AZONE_REGION_SCROLL) { if (az->direction == AZ_SCROLL_VERT) { az->alpha = az->ar->v2d.alpha_vert = 0; - changed = true; + sa->flag &= ~AREA_FLAG_ACTIONZONES_UPDATE; + ED_region_tag_redraw_no_rebuild(az->ar); } else if (az->direction == AZ_SCROLL_HOR) { az->alpha = az->ar->v2d.alpha_hor = 0; - changed = true; + sa->flag &= ~AREA_FLAG_ACTIONZONES_UPDATE; + ED_region_tag_redraw_no_rebuild(az->ar); } else { BLI_assert(0); } } - - if (changed) { - sa->flag &= ~AREA_FLAG_ACTIONZONES_UPDATE; - ED_area_tag_redraw_no_rebuild(sa); - } } } diff --git a/source/blender/editors/sculpt_paint/CMakeLists.txt b/source/blender/editors/sculpt_paint/CMakeLists.txt index d772a1a0541..e7a8c704fda 100644 --- a/source/blender/editors/sculpt_paint/CMakeLists.txt +++ b/source/blender/editors/sculpt_paint/CMakeLists.txt @@ -65,6 +65,8 @@ set(SRC ) set(LIB + bf_blenkernel + bf_blenlib ) if(WITH_INTERNATIONAL) diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index 4d1dd7eb1d6..4b714e03d3b 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -798,7 +798,7 @@ static void paint_draw_alpha_overlay( { /* Color means that primary brush texture is colored and * secondary is used for alpha/mask control. */ - bool col = ELEM(mode, PAINT_MODE_TEXTURE_3D, PAINT_MODE_TEXTURE_2D, PAINT_MODE_VERTEX) ? true : false; + bool col = ELEM(mode, PAINT_MODE_TEXTURE_3D, PAINT_MODE_TEXTURE_2D, PAINT_MODE_VERTEX); eOverlayControlFlags flags = BKE_paint_get_overlay_flags(); gpuPushAttr(GPU_DEPTH_BUFFER_BIT | GPU_BLEND_BIT); diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 0fdd3043d0c..237e60cd5e0 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -315,7 +315,7 @@ static bool image_paint_2d_clone_poll(bContext *C) /************************ paint operator ************************/ typedef enum eTexPaintMode { PAINT_MODE_2D, - PAINT_MODE_3D_PROJECT + PAINT_MODE_3D_PROJECT, } eTexPaintMode; typedef struct PaintOperation { @@ -418,6 +418,8 @@ static void gradient_draw_line(bContext *UNUSED(C), int x, int y, void *customda GPUVertFormat *format = immVertexFormat(); uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); + ARegion *ar = pop->vc.ar; + immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); GPU_line_width(4.0); @@ -425,7 +427,7 @@ static void gradient_draw_line(bContext *UNUSED(C), int x, int y, void *customda immBegin(GPU_PRIM_LINES, 2); immVertex2i(pos, x, y); - immVertex2i(pos, pop->startmouse[0], pop->startmouse[1]); + immVertex2i(pos, pop->startmouse[0] + ar->winrct.xmin, pop->startmouse[1] + ar->winrct.ymin); immEnd(); GPU_line_width(2.0); @@ -433,7 +435,7 @@ static void gradient_draw_line(bContext *UNUSED(C), int x, int y, void *customda immBegin(GPU_PRIM_LINES, 2); immVertex2i(pos, x, y); - immVertex2i(pos, pop->startmouse[0], pop->startmouse[1]); + immVertex2i(pos, pop->startmouse[0] + ar->winrct.xmin, pop->startmouse[1] + ar->winrct.ymin); immEnd(); immUnbindProgram(); diff --git a/source/blender/editors/sculpt_paint/paint_intern.h b/source/blender/editors/sculpt_paint/paint_intern.h index 5b86fc02979..0e8262bd82f 100644 --- a/source/blender/editors/sculpt_paint/paint_intern.h +++ b/source/blender/editors/sculpt_paint/paint_intern.h @@ -297,21 +297,21 @@ void flip_qt_qt(float out[3], const float in[3], const char symm); typedef enum BrushStrokeMode { BRUSH_STROKE_NORMAL, BRUSH_STROKE_INVERT, - BRUSH_STROKE_SMOOTH + BRUSH_STROKE_SMOOTH, } BrushStrokeMode; /* paint_hide.c */ typedef enum { PARTIALVIS_HIDE, - PARTIALVIS_SHOW + PARTIALVIS_SHOW, } PartialVisAction; typedef enum { PARTIALVIS_INSIDE, PARTIALVIS_OUTSIDE, PARTIALVIS_ALL, - PARTIALVIS_MASKED + PARTIALVIS_MASKED, } PartialVisArea; void PAINT_OT_hide_show(struct wmOperatorType *ot); @@ -321,7 +321,7 @@ void PAINT_OT_hide_show(struct wmOperatorType *ot); typedef enum { PAINT_MASK_FLOOD_VALUE, PAINT_MASK_FLOOD_VALUE_INVERSE, - PAINT_MASK_INVERT + PAINT_MASK_INVERT, } PaintMaskFloodMode; void PAINT_OT_mask_flood_fill(struct wmOperatorType *ot); diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c index e26b30fbf45..218d3ce4273 100644 --- a/source/blender/editors/sculpt_paint/paint_ops.c +++ b/source/blender/editors/sculpt_paint/paint_ops.c @@ -550,7 +550,7 @@ static void BRUSH_OT_uv_sculpt_tool_set(wmOperatorType *ot) typedef enum { STENCIL_TRANSLATE, STENCIL_SCALE, - STENCIL_ROTATE + STENCIL_ROTATE, } StencilControlMode; typedef enum { diff --git a/source/blender/editors/sound/CMakeLists.txt b/source/blender/editors/sound/CMakeLists.txt index 41650f07101..8b1caa0f306 100644 --- a/source/blender/editors/sound/CMakeLists.txt +++ b/source/blender/editors/sound/CMakeLists.txt @@ -36,14 +36,18 @@ set(SRC ) set(LIB + bf_blenkernel + bf_blenlib ) if(WITH_AUDASPACE) - add_definitions(-DWITH_AUDASPACE) - list(APPEND INC_SYS ${AUDASPACE_C_INCLUDE_DIRS} ) + list(APPEND LIB + bf_intern_audaspace + ) + add_definitions(-DWITH_AUDASPACE) endif() if(WITH_CODEC_FFMPEG) diff --git a/source/blender/editors/space_action/CMakeLists.txt b/source/blender/editors/space_action/CMakeLists.txt index aff4e75abb7..853577180bb 100644 --- a/source/blender/editors/space_action/CMakeLists.txt +++ b/source/blender/editors/space_action/CMakeLists.txt @@ -45,6 +45,8 @@ set(SRC ) set(LIB + bf_blenkernel + bf_blenlib ) add_definitions(${GL_DEFINITIONS}) diff --git a/source/blender/editors/space_api/CMakeLists.txt b/source/blender/editors/space_api/CMakeLists.txt index 8f744269de8..6a440f38eb8 100644 --- a/source/blender/editors/space_api/CMakeLists.txt +++ b/source/blender/editors/space_api/CMakeLists.txt @@ -35,6 +35,26 @@ set(SRC ) set(LIB + bf_editor_io + bf_editor_sound + bf_editor_space_action + bf_editor_space_buttons + bf_editor_space_clip + bf_editor_space_console + bf_editor_space_file + bf_editor_space_graph + bf_editor_space_image + bf_editor_space_info + bf_editor_space_nla + bf_editor_space_node + bf_editor_space_outliner + bf_editor_space_script + bf_editor_space_sequencer + bf_editor_space_statusbar + bf_editor_space_text + bf_editor_space_topbar + bf_editor_space_userpref + bf_editor_space_view3d ) blender_add_lib(bf_editor_space_api "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") diff --git a/source/blender/editors/space_clip/CMakeLists.txt b/source/blender/editors/space_clip/CMakeLists.txt index d770a85709a..49d7efb5669 100644 --- a/source/blender/editors/space_clip/CMakeLists.txt +++ b/source/blender/editors/space_clip/CMakeLists.txt @@ -64,6 +64,8 @@ set(SRC ) set(LIB + bf_blenkernel + bf_blenlib ) add_definitions(${GL_DEFINITIONS}) diff --git a/source/blender/editors/space_console/CMakeLists.txt b/source/blender/editors/space_console/CMakeLists.txt index d68e7745bdf..d8645c3674a 100644 --- a/source/blender/editors/space_console/CMakeLists.txt +++ b/source/blender/editors/space_console/CMakeLists.txt @@ -41,6 +41,8 @@ set(SRC ) set(LIB + bf_blenkernel + bf_blenlib ) if(WITH_PYTHON) diff --git a/source/blender/editors/space_graph/CMakeLists.txt b/source/blender/editors/space_graph/CMakeLists.txt index 53c228cd9c9..e0fc7500f94 100644 --- a/source/blender/editors/space_graph/CMakeLists.txt +++ b/source/blender/editors/space_graph/CMakeLists.txt @@ -46,14 +46,18 @@ set(SRC ) set(LIB + bf_blenkernel + bf_blenlib ) if(WITH_AUDASPACE) - add_definitions(-DWITH_AUDASPACE) - list(APPEND INC_SYS ${AUDASPACE_C_INCLUDE_DIRS} ) + list(APPEND LIB + bf_intern_audaspace + ) + add_definitions(-DWITH_AUDASPACE) endif() if(WITH_INTERNATIONAL) diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c index 681e46e9daf..6c6c0d451cc 100644 --- a/source/blender/editors/space_graph/graph_select.c +++ b/source/blender/editors/space_graph/graph_select.c @@ -1094,7 +1094,7 @@ typedef struct tNearestVertInfo { typedef enum eGraphVertIndex { NEAREST_HANDLE_LEFT = -1, NEAREST_HANDLE_KEY, - NEAREST_HANDLE_RIGHT + NEAREST_HANDLE_RIGHT, } eGraphVertIndex; /* Tolerance for absolute radius (in pixels) of the vert from the cursor to use */ diff --git a/source/blender/editors/space_image/CMakeLists.txt b/source/blender/editors/space_image/CMakeLists.txt index 99ede338dee..2687849f211 100644 --- a/source/blender/editors/space_image/CMakeLists.txt +++ b/source/blender/editors/space_image/CMakeLists.txt @@ -48,6 +48,9 @@ set(SRC ) set(LIB + bf_blenkernel + bf_blenlib + bf_editor_uvedit ) if(WITH_INTERNATIONAL) diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 831be935fa4..85c7d2d8fa9 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -3437,6 +3437,11 @@ void IMAGE_OT_curves_point_set(wmOperatorType *ot) /* properties */ RNA_def_enum(ot->srna, "point", point_items, 0, "Point", "Set black point or white point for curves"); + + PropertyRNA *prop; + prop = RNA_def_int(ot->srna, "size", 1, 1, 128, "Sample Size", "", 1, 64); + RNA_def_property_subtype(prop, PROP_PIXEL); + RNA_def_property_flag(prop, PROP_SKIP_SAVE); } #if 0 /* Not ported to 2.5x yet */ diff --git a/source/blender/editors/space_info/info_report.c b/source/blender/editors/space_info/info_report.c index a8f5d9b9b76..e4202483574 100644 --- a/source/blender/editors/space_info/info_report.c +++ b/source/blender/editors/space_info/info_report.c @@ -209,7 +209,7 @@ void INFO_OT_select_all(wmOperatorType *ot) ot->exec = report_select_all_exec; /* properties */ - WM_operator_properties_select_action(ot, SEL_SELECT); + WM_operator_properties_select_action(ot, SEL_SELECT, true); } /* box_select operator */ diff --git a/source/blender/editors/space_nla/CMakeLists.txt b/source/blender/editors/space_nla/CMakeLists.txt index 35c29ad4492..f22cc378a60 100644 --- a/source/blender/editors/space_nla/CMakeLists.txt +++ b/source/blender/editors/space_nla/CMakeLists.txt @@ -46,6 +46,8 @@ set(SRC ) set(LIB + bf_blenkernel + bf_blenlib ) if(WITH_INTERNATIONAL) diff --git a/source/blender/editors/space_node/CMakeLists.txt b/source/blender/editors/space_node/CMakeLists.txt index 2c1ec0cc834..5e2437c99ca 100644 --- a/source/blender/editors/space_node/CMakeLists.txt +++ b/source/blender/editors/space_node/CMakeLists.txt @@ -58,6 +58,9 @@ set(SRC ) set(LIB + bf_blenkernel + bf_blenlib + bf_editor_screen ) if(WITH_INTERNATIONAL) diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index a6aaca88e62..27efb6c9a10 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -2234,6 +2234,9 @@ static int ntree_socket_add_exec(bContext *C, wmOperator *op) ntreeUpdateTree(CTX_data_main(C), ntree); + snode_notify(C, snode); + snode_dag_update(C, snode); + WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, NULL); return OPERATOR_FINISHED; @@ -2283,6 +2286,9 @@ static int ntree_socket_remove_exec(bContext *C, wmOperator *UNUSED(op)) ntreeUpdateTree(CTX_data_main(C), ntree); + snode_notify(C, snode); + snode_dag_update(C, snode); + WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, NULL); return OPERATOR_FINISHED; @@ -2358,6 +2364,9 @@ static int ntree_socket_move_exec(bContext *C, wmOperator *op) ntreeUpdateTree(CTX_data_main(C), ntree); + snode_notify(C, snode); + snode_dag_update(C, snode); + WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, NULL); return OPERATOR_FINISHED; diff --git a/source/blender/editors/space_node/node_group.c b/source/blender/editors/space_node/node_group.c index 3de389dca7c..e38d29454dc 100644 --- a/source/blender/editors/space_node/node_group.c +++ b/source/blender/editors/space_node/node_group.c @@ -527,7 +527,7 @@ static int node_group_separate_selected( typedef enum eNodeGroupSeparateType { NODE_GS_COPY, - NODE_GS_MOVE + NODE_GS_MOVE, } eNodeGroupSeparateType; /* Operator Property */ diff --git a/source/blender/editors/space_outliner/CMakeLists.txt b/source/blender/editors/space_outliner/CMakeLists.txt index ae2d52533fe..83832d62b9e 100644 --- a/source/blender/editors/space_outliner/CMakeLists.txt +++ b/source/blender/editors/space_outliner/CMakeLists.txt @@ -50,6 +50,9 @@ set(SRC ) set(LIB + bf_blenkernel + bf_blenlib + bf_editor_undo ) if(WITH_INTERNATIONAL) diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c index 5ace2c291e0..9866b43a6a6 100644 --- a/source/blender/editors/space_outliner/outliner_select.c +++ b/source/blender/editors/space_outliner/outliner_select.c @@ -23,6 +23,8 @@ #include <stdlib.h> +#include "MEM_guardedalloc.h" + #include "DNA_armature_types.h" #include "DNA_collection_types.h" #include "DNA_light_types.h" @@ -584,11 +586,27 @@ static eOLDrawState tree_element_active_posechannel( if (!(pchan->bone->flag & BONE_HIDDEN_P)) { if (set != OL_SETSEL_EXTEND) { - bPoseChannel *pchannel; - /* single select forces all other bones to get unselected */ - for (pchannel = ob->pose->chanbase.first; pchannel; pchannel = pchannel->next) { - pchannel->bone->flag &= ~(BONE_TIPSEL | BONE_SELECTED | BONE_ROOTSEL); + /* Single select forces all other bones to get unselected. */ + uint objects_len = 0; + Object **objects = BKE_view_layer_array_from_objects_in_mode_unique_data(view_layer, NULL, &objects_len, OB_MODE_POSE); + for (uint object_index = 0; object_index < objects_len; object_index++) { + Object *ob_iter = BKE_object_pose_armature_get(objects[object_index]); + + /* Sanity checks. */ + if (ELEM(NULL, ob_iter, ob_iter->pose, ob_iter->data)) { + continue; + } + + bPoseChannel *pchannel; + for (pchannel = ob_iter->pose->chanbase.first; pchannel; pchannel = pchannel->next) { + pchannel->bone->flag &= ~(BONE_TIPSEL | BONE_SELECTED | BONE_ROOTSEL); + } + + if (ob != ob_iter) { + DEG_id_tag_update(ob_iter->data, ID_RECALC_SELECT); + } } + MEM_freeN(objects); } if ((set == OL_SETSEL_EXTEND) && (pchan->bone->flag & BONE_SELECTED)) { @@ -668,7 +686,7 @@ static eOLDrawState tree_element_active_bone( /* ebones only draw in editmode armature */ -static void tree_element_active_ebone__sel(bContext *C, Object *obedit, bArmature *arm, EditBone *ebone, short sel) +static void tree_element_active_ebone__sel(bContext *C, bArmature *arm, EditBone *ebone, short sel) { if (sel) { ebone->flag |= BONE_SELECTED | BONE_ROOTSEL | BONE_TIPSEL; @@ -685,35 +703,36 @@ static void tree_element_active_ebone__sel(bContext *C, Object *obedit, bArmatur ebone->parent->flag &= ~BONE_TIPSEL; } } - - WM_event_add_notifier(C, NC_OBJECT | ND_BONE_ACTIVE, obedit); + WM_event_add_notifier(C, NC_OBJECT | ND_BONE_ACTIVE, CTX_data_edit_object(C)); } static eOLDrawState tree_element_active_ebone( - bContext *C, TreeElement *te, TreeStoreElem *UNUSED(tselem), const eOLSetState set, bool recursive) + bContext *C, ViewLayer *view_layer, TreeElement *te, TreeStoreElem *tselem, const eOLSetState set, bool recursive) { - Object *obedit = CTX_data_edit_object(C); - BLI_assert(obedit != NULL); - bArmature *arm = obedit->data; + bArmature *arm = (bArmature *)tselem->id; EditBone *ebone = te->directdata; eOLDrawState status = OL_DRAWSEL_NONE; if (set != OL_SETSEL_NONE) { if (set == OL_SETSEL_NORMAL) { if (!(ebone->flag & BONE_HIDDEN_A)) { - ED_armature_edit_deselect_all(obedit); - tree_element_active_ebone__sel(C, obedit, arm, ebone, true); + uint bases_len = 0; + Base **bases = BKE_view_layer_array_from_bases_in_edit_mode_unique_data(view_layer, NULL, &bases_len); + ED_armature_edit_deselect_all_multi_ex(bases, bases_len); + MEM_freeN(bases); + + tree_element_active_ebone__sel(C, arm, ebone, true); status = OL_DRAWSEL_NORMAL; } } else if (set == OL_SETSEL_EXTEND) { if (!(ebone->flag & BONE_HIDDEN_A)) { if (!(ebone->flag & BONE_SELECTED)) { - tree_element_active_ebone__sel(C, obedit, arm, ebone, true); + tree_element_active_ebone__sel(C, arm, ebone, true); status = OL_DRAWSEL_NORMAL; } else { /* entirely selected, so de-select */ - tree_element_active_ebone__sel(C, obedit, arm, ebone, false); + tree_element_active_ebone__sel(C, arm, ebone, false); status = OL_DRAWSEL_NONE; } } @@ -964,7 +983,7 @@ eOLDrawState tree_element_type_active( case TSE_BONE: return tree_element_active_bone(C, view_layer, te, tselem, set, recursive); case TSE_EBONE: - return tree_element_active_ebone(C, te, tselem, set, recursive); + return tree_element_active_ebone(C, view_layer, te, tselem, set, recursive); case TSE_MODIFIER: return tree_element_active_modifier(C, scene, view_layer, te, tselem, set); case TSE_LINKED_OB: diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c index 15d2d007ecf..083ae3a048c 100644 --- a/source/blender/editors/space_outliner/outliner_tools.c +++ b/source/blender/editors/space_outliner/outliner_tools.c @@ -651,13 +651,13 @@ typedef enum eOutliner_PropDataOps { typedef enum eOutliner_PropConstraintOps { OL_CONSTRAINTOP_ENABLE = 1, OL_CONSTRAINTOP_DISABLE, - OL_CONSTRAINTOP_DELETE + OL_CONSTRAINTOP_DELETE, } eOutliner_PropConstraintOps; typedef enum eOutliner_PropModifierOps { OL_MODIFIER_OP_TOGVIS = 1, OL_MODIFIER_OP_TOGREN, - OL_MODIFIER_OP_DELETE + OL_MODIFIER_OP_DELETE, } eOutliner_PropModifierOps; static void pchan_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem), void *UNUSED(arg)) @@ -1188,7 +1188,7 @@ typedef enum eOutlinerIdOpTypes { OUTLINER_IDOP_FAKE_CLEAR, OUTLINER_IDOP_RENAME, - OUTLINER_IDOP_SELECT_LINKED + OUTLINER_IDOP_SELECT_LINKED, } eOutlinerIdOpTypes; // TODO: implement support for changing the ID-block used diff --git a/source/blender/editors/space_sequencer/CMakeLists.txt b/source/blender/editors/space_sequencer/CMakeLists.txt index bf70473610d..5724e811e77 100644 --- a/source/blender/editors/space_sequencer/CMakeLists.txt +++ b/source/blender/editors/space_sequencer/CMakeLists.txt @@ -51,6 +51,8 @@ set(SRC ) set(LIB + bf_editor_interface + bf_editor_util ) if(WITH_AUDASPACE) diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c index 7742d74d559..6de20e3c4af 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.c +++ b/source/blender/editors/space_sequencer/sequencer_select.c @@ -209,6 +209,7 @@ static void select_neighbor_from_last(Scene *scene, int lr) } } if (changed) { + /* pass */ } } #endif diff --git a/source/blender/editors/space_statusbar/CMakeLists.txt b/source/blender/editors/space_statusbar/CMakeLists.txt index 3b1372b419e..63562621d34 100644 --- a/source/blender/editors/space_statusbar/CMakeLists.txt +++ b/source/blender/editors/space_statusbar/CMakeLists.txt @@ -38,6 +38,8 @@ set(SRC ) set(LIB + bf_blenkernel + bf_blenlib ) add_definitions(${GL_DEFINITIONS}) diff --git a/source/blender/editors/space_text/CMakeLists.txt b/source/blender/editors/space_text/CMakeLists.txt index b542732fc54..f4054a0dd0e 100644 --- a/source/blender/editors/space_text/CMakeLists.txt +++ b/source/blender/editors/space_text/CMakeLists.txt @@ -52,6 +52,8 @@ set(SRC ) set(LIB + bf_blenkernel + bf_blenlib ) add_definitions(${GL_DEFINITIONS}) diff --git a/source/blender/editors/space_text/text_format_lua.c b/source/blender/editors/space_text/text_format_lua.c index 4b25c5d39a7..30080d2395b 100644 --- a/source/blender/editors/space_text/text_format_lua.c +++ b/source/blender/editors/space_text/text_format_lua.c @@ -45,6 +45,9 @@ static int txtfmt_lua_find_keyword(const char *string) { int i, len; + /* Keep aligned args for readability. */ + /* clang-format off */ + if (STR_LITERAL_STARTSWITH(string, "and", len)) i = len; else if (STR_LITERAL_STARTSWITH(string, "break", len)) i = len; else if (STR_LITERAL_STARTSWITH(string, "do", len)) i = len; @@ -65,6 +68,8 @@ static int txtfmt_lua_find_keyword(const char *string) else if (STR_LITERAL_STARTSWITH(string, "while", len)) i = len; else i = 0; + /* clang-format on */ + /* If next source char is an identifier (eg. 'i' in "definite") no match */ if (i == 0 || text_check_identifier(string[i])) return -1; @@ -86,6 +91,9 @@ static int txtfmt_lua_find_specialvar(const char *string) { int i, len; + /* Keep aligned args for readability. */ + /* clang-format off */ + if (STR_LITERAL_STARTSWITH(string, "assert", len)) i = len; else if (STR_LITERAL_STARTSWITH(string, "collectgarbage", len)) i = len; else if (STR_LITERAL_STARTSWITH(string, "dofile", len)) i = len; @@ -116,6 +124,8 @@ static int txtfmt_lua_find_specialvar(const char *string) else if (STR_LITERAL_STARTSWITH(string, "xpcall", len)) i = len; else i = 0; + /* clang-format on */ + /* If next source char is an identifier (eg. 'i' in "definite") no match */ if (i == 0 || text_check_identifier(string[i])) return -1; @@ -131,6 +141,8 @@ static int txtfmt_lua_find_bool(const char *string) else if (STR_LITERAL_STARTSWITH(string, "false", len)) i = len; else i = 0; + /* clang-format on */ + /* If next source char is an identifier (eg. 'i' in "Nonetheless") no match */ if (i == 0 || text_check_identifier(string[i])) return -1; @@ -140,9 +152,16 @@ static int txtfmt_lua_find_bool(const char *string) static char txtfmt_lua_format_identifier(const char *str) { char fmt; + + /* Keep aligned args for readability. */ + /* clang-format off */ + if ((txtfmt_lua_find_specialvar(str)) != -1) fmt = FMT_TYPE_SPECIAL; else if ((txtfmt_lua_find_keyword(str)) != -1) fmt = FMT_TYPE_KEYWORD; else fmt = FMT_TYPE_DEFAULT; + + /* clang-format on */ + return fmt; } @@ -265,11 +284,16 @@ static void txtfmt_lua_format_line(SpaceText *st, TextLine *line, const bool do_ } /* Not ws, a digit, punct, or continuing text. Must be new, check for special words */ else { + /* Keep aligned args for readability. */ + /* clang-format off */ + /* Special vars(v) or built-in keywords(b) */ /* keep in sync with 'txtfmt_osl_format_identifier()' */ if ((i = txtfmt_lua_find_specialvar(str)) != -1) prev = FMT_TYPE_SPECIAL; else if ((i = txtfmt_lua_find_keyword(str)) != -1) prev = FMT_TYPE_KEYWORD; + /* clang-format on */ + if (i > 0) { text_format_fill_ascii(&str, &fmt, prev, i); } diff --git a/source/blender/editors/space_text/text_format_osl.c b/source/blender/editors/space_text/text_format_osl.c index 08cae0d978d..66980b30c4d 100644 --- a/source/blender/editors/space_text/text_format_osl.c +++ b/source/blender/editors/space_text/text_format_osl.c @@ -33,6 +33,10 @@ static int txtfmt_osl_find_builtinfunc(const char *string) { int i, len; + + /* Keep aligned args for readability. */ + /* clang-format off */ + /* list is from * https://github.com/imageworks/OpenShadingLanguage/raw/master/src/doc/osl-languagespec.pdf */ @@ -62,6 +66,8 @@ static int txtfmt_osl_find_builtinfunc(const char *string) else if (STR_LITERAL_STARTSWITH(string, "while", len)) i = len; else i = 0; + /* clang-format on */ + /* If next source char is an identifier (eg. 'i' in "definite") no match */ if (i == 0 || text_check_identifier(string[i])) return -1; @@ -71,6 +77,10 @@ static int txtfmt_osl_find_builtinfunc(const char *string) static int txtfmt_osl_find_reserved(const char *string) { int i, len; + + /* Keep aligned args for readability. */ + /* clang-format off */ + /* list is from... * https://github.com/imageworks/OpenShadingLanguage/raw/master/src/doc/osl-languagespec.pdf */ @@ -112,6 +122,8 @@ static int txtfmt_osl_find_reserved(const char *string) else if (STR_LITERAL_STARTSWITH(string, "volatile", len)) i = len; else i = 0; + /* clang-format on */ + /* If next source char is an identifier (eg. 'i' in "definite") no match */ if (i == 0 || text_check_identifier(string[i])) return -1; @@ -129,6 +141,9 @@ static int txtfmt_osl_find_specialvar(const char *string) { int i, len; + /* Keep aligned args for readability. */ + /* clang-format off */ + /* OSL shader types */ if (STR_LITERAL_STARTSWITH(string, "shader", len)) i = len; else if (STR_LITERAL_STARTSWITH(string, "surface", len)) i = len; @@ -136,6 +151,8 @@ static int txtfmt_osl_find_specialvar(const char *string) else if (STR_LITERAL_STARTSWITH(string, "displacement", len)) i = len; else i = 0; + /* clang-format on */ + /* If next source char is an identifier (eg. 'i' in "definite") no match */ if (i == 0 || text_check_identifier(string[i])) return -1; @@ -162,11 +179,18 @@ static int txtfmt_osl_find_preprocessor(const char *string) static char txtfmt_osl_format_identifier(const char *str) { char fmt; + + /* Keep aligned args for readability. */ + /* clang-format off */ + if ((txtfmt_osl_find_specialvar(str)) != -1) fmt = FMT_TYPE_SPECIAL; else if ((txtfmt_osl_find_builtinfunc(str)) != -1) fmt = FMT_TYPE_KEYWORD; else if ((txtfmt_osl_find_reserved(str)) != -1) fmt = FMT_TYPE_RESERVED; else if ((txtfmt_osl_find_preprocessor(str)) != -1) fmt = FMT_TYPE_DIRECTIVE; else fmt = FMT_TYPE_DEFAULT; + + /* clang-format on */ + return fmt; } @@ -276,6 +300,9 @@ static void txtfmt_osl_format_line(SpaceText *st, TextLine *line, const bool do_ } /* Not ws, a digit, punct, or continuing text. Must be new, check for special words */ else { + /* Keep aligned args for readability. */ + /* clang-format off */ + /* Special vars(v) or built-in keywords(b) */ /* keep in sync with 'txtfmt_osl_format_identifier()' */ if ((i = txtfmt_osl_find_specialvar(str)) != -1) prev = FMT_TYPE_SPECIAL; @@ -283,6 +310,8 @@ static void txtfmt_osl_format_line(SpaceText *st, TextLine *line, const bool do_ else if ((i = txtfmt_osl_find_reserved(str)) != -1) prev = FMT_TYPE_RESERVED; else if ((i = txtfmt_osl_find_preprocessor(str)) != -1) prev = FMT_TYPE_DIRECTIVE; + /* clang-format on */ + if (i > 0) { if (prev == FMT_TYPE_DIRECTIVE) { /* can contain utf8 */ text_format_fill(&str, &fmt, prev, i); diff --git a/source/blender/editors/space_text/text_format_pov.c b/source/blender/editors/space_text/text_format_pov.c index 2435d2f21da..c0f4507aa5d 100644 --- a/source/blender/editors/space_text/text_format_pov.c +++ b/source/blender/editors/space_text/text_format_pov.c @@ -43,6 +43,9 @@ */ static int txtfmt_pov_find_keyword(const char *string) { + /* Keep aligned args for readability. */ + /* clang-format off */ + int i, len; /* Language Directives */ if (STR_LITERAL_STARTSWITH(string, "deprecated", len)) i = len; @@ -79,6 +82,8 @@ static int txtfmt_pov_find_keyword(const char *string) else if (STR_LITERAL_STARTSWITH(string, "if", len)) i = len; else i = 0; + /* clang-format on */ + /* If next source char is an identifier (eg. 'i' in "definite") no match */ return (i == 0 || text_check_identifier(string[i])) ? -1 : i; } @@ -91,6 +96,9 @@ static int txtfmt_pov_find_reserved_keywords(const char *string) * http://www.povray.org/documentation/view/3.7.0/212/ */ + /* Keep aligned args for readability. */ + /* clang-format off */ + /* Float Functions */ if (STR_LITERAL_STARTSWITH(string, "conserve_energy", len)) i = len; else if (STR_LITERAL_STARTSWITH(string, "max_intersections", len)) i = len; @@ -232,6 +240,8 @@ static int txtfmt_pov_find_reserved_keywords(const char *string) else if (STR_LITERAL_STARTSWITH(string, "str", len)) i = len; else i = 0; + /* clang-format on */ + /* If next source char is an identifier (eg. 'i' in "definite") no match */ return (i == 0 || text_check_identifier(string[i])) ? -1 : i; } @@ -245,6 +255,10 @@ static int txtfmt_pov_find_reserved_builtins(const char *string) * list is from... * http://www.povray.org/documentation/view/3.7.0/212/ */ + + /* Keep aligned args for readability. */ + /* clang-format off */ + /* Language Keywords */ if (STR_LITERAL_STARTSWITH(string, "reflection_exponent", len)) i = len; else if (STR_LITERAL_STARTSWITH(string, "area_illumination", len)) i = len; @@ -462,6 +476,8 @@ static int txtfmt_pov_find_reserved_builtins(const char *string) else if (STR_LITERAL_STARTSWITH(string, "z", len)) i = len; else i = 0; + /* clang-format off */ + /* If next source char is an identifier (eg. 'i' in "definite") no match */ return (i == 0 || text_check_identifier(string[i])) ? -1 : i; } @@ -686,16 +702,20 @@ static int txtfmt_pov_find_specialvar(const char *string) static int txtfmt_pov_find_bool(const char *string) { int i, len; - /*Built-in Constants*/ - if (STR_LITERAL_STARTSWITH(string, "unofficial", len)) i = len; - else if (STR_LITERAL_STARTSWITH(string, "false", len)) i = len; - else if (STR_LITERAL_STARTSWITH(string, "no", len)) i = len; - else if (STR_LITERAL_STARTSWITH(string, "off", len)) i = len; - else if (STR_LITERAL_STARTSWITH(string, "true", len)) i = len; - else if (STR_LITERAL_STARTSWITH(string, "yes", len)) i = len; - else if (STR_LITERAL_STARTSWITH(string, "on", len)) i = len; - else if (STR_LITERAL_STARTSWITH(string, "pi", len)) i = len; - else if (STR_LITERAL_STARTSWITH(string, "tau", len)) i = len; + + /* Keep aligned args for readability. */ + /* clang-format off */ + + /* Built-in Constants */ + if (STR_LITERAL_STARTSWITH(string, "unofficial", len)) i = len; + else if (STR_LITERAL_STARTSWITH(string, "false", len)) i = len; + else if (STR_LITERAL_STARTSWITH(string, "no", len)) i = len; + else if (STR_LITERAL_STARTSWITH(string, "off", len)) i = len; + else if (STR_LITERAL_STARTSWITH(string, "true", len)) i = len; + else if (STR_LITERAL_STARTSWITH(string, "yes", len)) i = len; + else if (STR_LITERAL_STARTSWITH(string, "on", len)) i = len; + else if (STR_LITERAL_STARTSWITH(string, "pi", len)) i = len; + else if (STR_LITERAL_STARTSWITH(string, "tau", len)) i = len; /* Encodings */ else if (STR_LITERAL_STARTSWITH(string, "sint16be", len)) i = len; else if (STR_LITERAL_STARTSWITH(string, "sint16le", len)) i = len; @@ -725,6 +745,8 @@ static int txtfmt_pov_find_bool(const char *string) else if (STR_LITERAL_STARTSWITH(string, "ttf", len)) i = len; else i = 0; + /* clang-format on */ + /* If next source char is an identifier (eg. 'i' in "Nonetheless") no match */ return (i == 0 || text_check_identifier(string[i])) ? -1 : i; } @@ -732,11 +754,18 @@ static int txtfmt_pov_find_bool(const char *string) static char txtfmt_pov_format_identifier(const char *str) { char fmt; + + /* Keep aligned args for readability. */ + /* clang-format off */ + if ((txtfmt_pov_find_specialvar(str)) != -1) fmt = FMT_TYPE_SPECIAL; else if ((txtfmt_pov_find_keyword(str)) != -1) fmt = FMT_TYPE_KEYWORD; else if ((txtfmt_pov_find_reserved_keywords(str)) != -1) fmt = FMT_TYPE_RESERVED; else if ((txtfmt_pov_find_reserved_builtins(str)) != -1) fmt = FMT_TYPE_DIRECTIVE; else fmt = FMT_TYPE_DEFAULT; + + /* clang-format on */ + return fmt; } @@ -855,6 +884,9 @@ static void txtfmt_pov_format_line(SpaceText *st, TextLine *line, const bool do_ } /* Not ws, a digit, punct, or continuing text. Must be new, check for special words */ else { + /* Keep aligned args for readability. */ + /* clang-format off */ + /* Special vars(v) or built-in keywords(b) */ /* keep in sync with 'txtfmt_pov_format_identifier()' */ if ((i = txtfmt_pov_find_specialvar(str)) != -1) prev = FMT_TYPE_SPECIAL; @@ -862,6 +894,8 @@ static void txtfmt_pov_format_line(SpaceText *st, TextLine *line, const bool do_ else if ((i = txtfmt_pov_find_reserved_keywords(str)) != -1) prev = FMT_TYPE_RESERVED; else if ((i = txtfmt_pov_find_reserved_builtins(str)) != -1) prev = FMT_TYPE_DIRECTIVE; + /* clang-format on */ + if (i > 0) { text_format_fill_ascii(&str, &fmt, prev, i); } diff --git a/source/blender/editors/space_text/text_format_pov_ini.c b/source/blender/editors/space_text/text_format_pov_ini.c index da69a35f0b0..5ef5746bffb 100644 --- a/source/blender/editors/space_text/text_format_pov_ini.c +++ b/source/blender/editors/space_text/text_format_pov_ini.c @@ -44,6 +44,10 @@ static int txtfmt_ini_find_keyword(const char *string) { int i, len; + + /* Keep aligned args for readability. */ + /* clang-format off */ + /* Language Directives */ if (STR_LITERAL_STARTSWITH(string, "deprecated", len)) i = len; else if (STR_LITERAL_STARTSWITH(string, "statistics", len)) i = len; @@ -89,6 +93,8 @@ static int txtfmt_ini_find_keyword(const char *string) else i = 0; + /* clang-format on */ + /* If next source char is an identifier (eg. 'i' in "definite") no match */ return (i == 0 || text_check_identifier(string[i])) ? -1 : i; } @@ -96,11 +102,15 @@ static int txtfmt_ini_find_keyword(const char *string) static int txtfmt_ini_find_reserved(const char *string) { int i, len; + + /* Keep aligned args for readability. */ + /* clang-format off */ + /* POV-Ray Built-in INI Variables * list is from... * http://www.povray.org/documentation/view/3.7.0/212/ */ - if (STR_LITERAL_STARTSWITH(string, "RenderCompleteSoundEnabled", len)) i = len; + if (STR_LITERAL_STARTSWITH(string, "RenderCompleteSoundEnabled", len)) i = len; else if (STR_LITERAL_STARTSWITH(string, "Create_Continue_Trace_Log", len)) i = len; else if (STR_LITERAL_STARTSWITH(string, "ParseErrorSoundEnabled", len)) i = len; else if (STR_LITERAL_STARTSWITH(string, "RenderErrorSoundEnabled", len)) i = len; @@ -295,6 +305,8 @@ static int txtfmt_ini_find_reserved(const char *string) else i = 0; + /* clang-format on */ + /* If next source char is an identifier (eg. 'i' in "definite") no match */ return (i == 0 || text_check_identifier(string[i])) ? -1 : i; } @@ -305,6 +317,10 @@ static int txtfmt_ini_find_reserved(const char *string) static int txtfmt_ini_find_bool(const char *string) { int i, len; + + /* Keep aligned args for readability. */ + /* clang-format off */ + /* Built-in Constants */ if (STR_LITERAL_STARTSWITH(string, "false", len)) i = len; else if (STR_LITERAL_STARTSWITH(string, "no", len)) i = len; @@ -322,6 +338,8 @@ static int txtfmt_ini_find_bool(const char *string) else if (STR_LITERAL_STARTSWITH(string, "%w", len)) i = len; else i = 0; + /* clang-format on */ + /* If next source char is an identifier (eg. 'i' in "Nonetheless") no match */ return (i == 0 || text_check_identifier(string[i])) ? -1 : i; } @@ -445,11 +463,16 @@ static void txtfmt_pov_ini_format_line(SpaceText *st, TextLine *line, const bool } /* Not ws, a digit, punct, or continuing text. Must be new, check for special words */ else { + /* Keep aligned args for readability. */ + /* clang-format off */ + /* Special vars(v) or built-in keywords(b) */ /* keep in sync with 'txtfmt_ini_format_identifier()' */ if ((i = txtfmt_ini_find_keyword(str)) != -1) prev = FMT_TYPE_KEYWORD; else if ((i = txtfmt_ini_find_reserved(str)) != -1) prev = FMT_TYPE_RESERVED; + /* clang-format on */ + if (i > 0) { text_format_fill_ascii(&str, &fmt, prev, i); } diff --git a/source/blender/editors/space_text/text_format_py.c b/source/blender/editors/space_text/text_format_py.c index 87b3835ce1e..bb0b639f508 100644 --- a/source/blender/editors/space_text/text_format_py.c +++ b/source/blender/editors/space_text/text_format_py.c @@ -55,6 +55,9 @@ static int txtfmt_py_find_builtinfunc(const char *string) * if kw not in {"False", "None", "True", "def", "class"}])) */ + /* Keep aligned args for readability. */ + /* clang-format off */ + if (STR_LITERAL_STARTSWITH(string, "and", len)) i = len; else if (STR_LITERAL_STARTSWITH(string, "as", len)) i = len; else if (STR_LITERAL_STARTSWITH(string, "assert", len)) i = len; @@ -87,6 +90,8 @@ static int txtfmt_py_find_builtinfunc(const char *string) else if (STR_LITERAL_STARTSWITH(string, "yield", len)) i = len; else i = 0; + /* clang-format on */ + /* If next source char is an identifier (eg. 'i' in "definite") no match */ if (i == 0 || text_check_identifier(string[i])) return -1; @@ -104,10 +109,15 @@ static int txtfmt_py_find_specialvar(const char *string) { int i, len; + /* Keep aligned args for readability. */ + /* clang-format off */ + if (STR_LITERAL_STARTSWITH(string, "def", len)) i = len; else if (STR_LITERAL_STARTSWITH(string, "class", len)) i = len; else i = 0; + /* clang-format on */ + /* If next source char is an identifier (eg. 'i' in "definite") no match */ if (i == 0 || text_check_identifier(string[i])) return -1; @@ -138,11 +148,16 @@ static int txtfmt_py_find_bool(const char *string) { int i, len; + /* Keep aligned args for readability. */ + /* clang-format off */ + if (STR_LITERAL_STARTSWITH(string, "None", len)) i = len; else if (STR_LITERAL_STARTSWITH(string, "True", len)) i = len; else if (STR_LITERAL_STARTSWITH(string, "False", len)) i = len; else i = 0; + /* clang-format on */ + /* If next source char is an identifier (eg. 'i' in "Nonetheless") no match */ if (i == 0 || text_check_identifier(string[i])) return -1; @@ -152,10 +167,16 @@ static int txtfmt_py_find_bool(const char *string) static char txtfmt_py_format_identifier(const char *str) { char fmt; + + /* Keep aligned args for readability. */ + /* clang-format off */ + if ((txtfmt_py_find_specialvar(str)) != -1) fmt = FMT_TYPE_SPECIAL; else if ((txtfmt_py_find_builtinfunc(str)) != -1) fmt = FMT_TYPE_KEYWORD; else if ((txtfmt_py_find_decorator(str)) != -1) fmt = FMT_TYPE_RESERVED; else fmt = FMT_TYPE_DEFAULT; + + /* clang-format on */ return fmt; } @@ -272,12 +293,17 @@ static void txtfmt_py_format_line(SpaceText *st, TextLine *line, const bool do_n } /* Not ws, a digit, punct, or continuing text. Must be new, check for special words */ else { + /* Keep aligned args for readability. */ + /* clang-format off */ + /* Special vars(v) or built-in keywords(b) */ /* keep in sync with 'txtfmt_py_format_identifier()' */ if ((i = txtfmt_py_find_specialvar(str)) != -1) prev = FMT_TYPE_SPECIAL; else if ((i = txtfmt_py_find_builtinfunc(str)) != -1) prev = FMT_TYPE_KEYWORD; else if ((i = txtfmt_py_find_decorator(str)) != -1) prev = FMT_TYPE_DIRECTIVE; + /* clang-format on */ + if (i > 0) { if (prev == FMT_TYPE_DIRECTIVE) { /* can contain utf8 */ text_format_fill(&str, &fmt, prev, i); diff --git a/source/blender/editors/space_view3d/CMakeLists.txt b/source/blender/editors/space_view3d/CMakeLists.txt index e3f5245fc59..837671d6f94 100644 --- a/source/blender/editors/space_view3d/CMakeLists.txt +++ b/source/blender/editors/space_view3d/CMakeLists.txt @@ -73,6 +73,8 @@ set(SRC ) set(LIB + bf_editor_lattice + bf_editor_mesh ) if(WITH_PYTHON) diff --git a/source/blender/editors/space_view3d/view3d_gizmo_ruler.c b/source/blender/editors/space_view3d/view3d_gizmo_ruler.c index f8f92d8bef8..253e02ca639 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_ruler.c +++ b/source/blender/editors/space_view3d/view3d_gizmo_ruler.c @@ -437,6 +437,9 @@ static bool view3d_ruler_to_gpencil(bContext *C, wmGizmoGroup *gzgroup) } gps->flag = GP_STROKE_3DSPACE; gps->thickness = 3; + gps->gradient_f = 1.0f; + gps->gradient_s[0] = 1.0f; + gps->gradient_s[1] = 1.0f; BLI_addtail(&gpf->strokes, gps); changed = true; diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index 3ff6a7146c6..f57b31b2ed2 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -700,7 +700,7 @@ static bool do_lasso_select_mesh( if (ts->selectmode & SCE_SELECT_VERTEX) { if (bbsel) { - data.is_changed = edbm_backbuf_check_and_select_verts(vc->em, sel_op); + data.is_changed |= edbm_backbuf_check_and_select_verts(vc->em, sel_op); } else { mesh_foreachScreenVert(vc, do_lasso_select_mesh__doSelectVert, &data, V3D_PROJ_TEST_CLIP_DEFAULT); @@ -716,7 +716,7 @@ static bool do_lasso_select_mesh( if (ts->selectmode & SCE_SELECT_FACE) { if (bbsel) { - data.is_changed = edbm_backbuf_check_and_select_faces(vc->em, sel_op); + data.is_changed |= edbm_backbuf_check_and_select_faces(vc->em, sel_op); } else { mesh_foreachScreenFace(vc, do_lasso_select_mesh__doSelectFace, &data, V3D_PROJ_TEST_CLIP_DEFAULT); @@ -1065,22 +1065,22 @@ static bool view3d_lasso_select( if (vc->obedit == NULL) { /* Object Mode */ if (BKE_paint_select_face_test(ob)) { - changed_multi = do_lasso_select_paintface(vc, mcords, moves, sel_op); + changed_multi |= do_lasso_select_paintface(vc, mcords, moves, sel_op); } else if (BKE_paint_select_vert_test(ob)) { - changed_multi = do_lasso_select_paintvert(vc, mcords, moves, sel_op); + changed_multi |= do_lasso_select_paintvert(vc, mcords, moves, sel_op); } else if (ob && (ob->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT | OB_MODE_TEXTURE_PAINT))) { /* pass */ } else if (ob && (ob->mode & OB_MODE_PARTICLE_EDIT)) { - changed_multi = PE_lasso_select(C, mcords, moves, sel_op); + changed_multi |= PE_lasso_select(C, mcords, moves, sel_op); } else if (ob && (ob->mode & OB_MODE_POSE)) { - changed_multi = do_lasso_select_pose(vc, mcords, moves, sel_op); + changed_multi |= do_lasso_select_pose(vc, mcords, moves, sel_op); } else { - changed_multi = do_lasso_select_objects(vc, mcords, moves, sel_op); + changed_multi |= do_lasso_select_objects(vc, mcords, moves, sel_op); } } else { /* Edit Mode */ @@ -2248,13 +2248,9 @@ static bool do_paintvert_box_select( { const bool use_zbuf = !XRAY_ENABLED(vc->v3d); Mesh *me; - MVert *mvert; - unsigned int *rt; - int a, index; - char *selar; me = vc->obact->data; - if ((me == NULL) || (me->totvert == 0) || BLI_rcti_is_empty(rect)) { + if ((me == NULL) || (me->totvert == 0)) { return OPERATOR_CANCELLED; } @@ -2263,7 +2259,15 @@ static bool do_paintvert_box_select( changed |= paintvert_deselect_all_visible(vc->obact, SEL_DESELECT, false); } - if (use_zbuf) { + if (BLI_rcti_is_empty(rect)) { + /* pass */ + } + else if (use_zbuf) { + MVert *mvert; + unsigned int *rt; + int a, index; + char *selar; + selar = MEM_callocN(me->totvert + 1, "selar"); uint buf_len; @@ -2479,7 +2483,7 @@ static bool do_mesh_box_select( if (ts->selectmode & SCE_SELECT_VERTEX) { if (bbsel) { - data.is_changed = edbm_backbuf_check_and_select_verts(vc->em, sel_op); + data.is_changed |= edbm_backbuf_check_and_select_verts(vc->em, sel_op); } else { mesh_foreachScreenVert(vc, do_mesh_box_select__doSelectVert, &data, V3D_PROJ_TEST_CLIP_DEFAULT); @@ -2495,7 +2499,7 @@ static bool do_mesh_box_select( if (ts->selectmode & SCE_SELECT_FACE) { if (bbsel) { - data.is_changed = edbm_backbuf_check_and_select_faces(vc->em, sel_op); + data.is_changed |= edbm_backbuf_check_and_select_faces(vc->em, sel_op); } else { mesh_foreachScreenFace(vc, do_mesh_box_select__doSelectFace, &data, V3D_PROJ_TEST_CLIP_DEFAULT); diff --git a/source/blender/editors/transform/CMakeLists.txt b/source/blender/editors/transform/CMakeLists.txt index 7d3690df826..c475a9e4e3d 100644 --- a/source/blender/editors/transform/CMakeLists.txt +++ b/source/blender/editors/transform/CMakeLists.txt @@ -55,6 +55,12 @@ set(SRC ) set(LIB + bf_blenfont + bf_blenkernel + bf_blenlib + bf_bmesh + bf_editor_mask + bf_gpu ) if(WITH_INTERNATIONAL) diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 4135a1b320d..1358b526bca 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -1667,7 +1667,7 @@ typedef enum { UP, DOWN, LEFT, - RIGHT + RIGHT, } ArrowDirection; #define POS_INDEX 0 @@ -2413,6 +2413,10 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve wmKeyMapItem *kmi; for (kmi = t->keymap->items.first; kmi; kmi = kmi->next) { + if (kmi->flag & KMI_INACTIVE) { + continue; + } + if (kmi->propvalue == TFM_MODAL_SNAP_INV_ON && kmi->val == KM_PRESS) { if ((ELEM(kmi->type, LEFTCTRLKEY, RIGHTCTRLKEY) && event->ctrl) || (ELEM(kmi->type, LEFTSHIFTKEY, RIGHTSHIFTKEY) && event->shift) || diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index a3ee7dd5635..217dd194f57 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -8941,8 +8941,11 @@ void createTransData(bContext *C, TransInfo *t) has_transform_context = false; } } - else if (ob && (ob->mode == OB_MODE_PAINT_GPENCIL)) { - /* In grease pencil draw mode all transformations must be canceled. */ + else if ((ob) && + (ELEM(ob->mode, OB_MODE_PAINT_GPENCIL, + OB_MODE_SCULPT_GPENCIL, OB_MODE_WEIGHT_GPENCIL))) + { + /* In grease pencil all transformations must be canceled if not Object or Edit. */ has_transform_context = false; } else { diff --git a/source/blender/editors/undo/CMakeLists.txt b/source/blender/editors/undo/CMakeLists.txt index 3a6aded0c08..cebfa0d67f4 100644 --- a/source/blender/editors/undo/CMakeLists.txt +++ b/source/blender/editors/undo/CMakeLists.txt @@ -37,6 +37,13 @@ set(SRC ) set(LIB + bf_blenkernel + bf_blenlib + bf_editor_curve + bf_editor_lattice + bf_editor_mesh + bf_editor_metaball + bf_editor_physics ) if(WITH_INTERNATIONAL) diff --git a/source/blender/freestyle/CMakeLists.txt b/source/blender/freestyle/CMakeLists.txt index 9dfeb065902..4292eef400c 100644 --- a/source/blender/freestyle/CMakeLists.txt +++ b/source/blender/freestyle/CMakeLists.txt @@ -548,6 +548,7 @@ set(SRC ) set(LIB + bf_python_mathutils ) set(INC diff --git a/source/blender/freestyle/intern/python/BPy_MediumType.cpp b/source/blender/freestyle/intern/python/BPy_MediumType.cpp index 30a930f1839..4d73bdede67 100644 --- a/source/blender/freestyle/intern/python/BPy_MediumType.cpp +++ b/source/blender/freestyle/intern/python/BPy_MediumType.cpp @@ -85,15 +85,15 @@ PyTypeObject MediumType_Type = { PyLongObject _BPy_MediumType_DRY_MEDIUM = { PyVarObject_HEAD_INIT(&MediumType_Type, 1) - { Stroke::DRY_MEDIUM } + { Stroke::DRY_MEDIUM }, }; PyLongObject _BPy_MediumType_HUMID_MEDIUM = { PyVarObject_HEAD_INIT(&MediumType_Type, 1) - { Stroke::HUMID_MEDIUM } + { Stroke::HUMID_MEDIUM }, }; PyLongObject _BPy_MediumType_OPAQUE_MEDIUM = { PyVarObject_HEAD_INIT(&MediumType_Type, 1) - { Stroke::OPAQUE_MEDIUM } + { Stroke::OPAQUE_MEDIUM }, }; //-------------------MODULE INITIALIZATION-------------------------------- diff --git a/source/blender/freestyle/intern/view_map/Interface1D.h b/source/blender/freestyle/intern/view_map/Interface1D.h index 222d26d2009..de190f22e2d 100644 --- a/source/blender/freestyle/intern/view_map/Interface1D.h +++ b/source/blender/freestyle/intern/view_map/Interface1D.h @@ -50,7 +50,7 @@ typedef enum { MIN, /*!< The value computed for the 1D element is the minimum of the values obtained for the 0D elements.*/ MAX, /*!< The value computed for the 1D element is the maximum of the values obtained for the 0D elements.*/ FIRST, /*!< The value computed for the 1D element is the first of the values obtained for the 0D elements.*/ - LAST /*!< The value computed for the 1D element is the last of the values obtained for the 0D elements.*/ + LAST, /*!< The value computed for the 1D element is the last of the values obtained for the 0D elements.*/ } IntegrationType; /*! Returns a single value from a set of values evaluated at each 0D element of this 1D element. diff --git a/source/blender/gpu/CMakeLists.txt b/source/blender/gpu/CMakeLists.txt index 430eefe6fc7..02f31b9664e 100644 --- a/source/blender/gpu/CMakeLists.txt +++ b/source/blender/gpu/CMakeLists.txt @@ -126,6 +126,12 @@ set(SRC set(LIB ) +if(NOT WITH_SYSTEM_GLEW) + list(APPEND LIB + ${BLENDER_GLEW_LIBRARIES} + ) +endif() + data_to_c_simple(shaders/gpu_shader_depth_only_frag.glsl SRC) data_to_c_simple(shaders/gpu_shader_uniform_color_frag.glsl SRC) data_to_c_simple(shaders/gpu_shader_checker_frag.glsl SRC) diff --git a/source/blender/gpu/GPU_batch.h b/source/blender/gpu/GPU_batch.h index d789a65a3a4..9f6c9f50109 100644 --- a/source/blender/gpu/GPU_batch.h +++ b/source/blender/gpu/GPU_batch.h @@ -36,7 +36,7 @@ typedef enum { GPU_BATCH_READY_TO_FORMAT, GPU_BATCH_READY_TO_BUILD, GPU_BATCH_BUILDING, - GPU_BATCH_READY_TO_DRAW + GPU_BATCH_READY_TO_DRAW, } GPUBatchPhase; #define GPU_BATCH_VBO_MAX_LEN 4 diff --git a/source/blender/gpu/GPU_element.h b/source/blender/gpu/GPU_element.h index 96d9acc55a8..5c877c80f65 100644 --- a/source/blender/gpu/GPU_element.h +++ b/source/blender/gpu/GPU_element.h @@ -35,7 +35,7 @@ typedef enum { GPU_INDEX_U8, /* GL has this, Vulkan does not */ GPU_INDEX_U16, - GPU_INDEX_U32 + GPU_INDEX_U32, } GPUIndexBufType; typedef struct GPUIndexBuf { diff --git a/source/blender/gpu/GPU_primitive.h b/source/blender/gpu/GPU_primitive.h index 5867e589ebe..fdb6f380f3b 100644 --- a/source/blender/gpu/GPU_primitive.h +++ b/source/blender/gpu/GPU_primitive.h @@ -41,7 +41,7 @@ typedef enum { GPU_PRIM_TRIS_ADJ, GPU_PRIM_LINE_STRIP_ADJ, - GPU_PRIM_NONE + GPU_PRIM_NONE, } GPUPrimType; /* what types of primitives does each shader expect? */ diff --git a/source/blender/gpu/GPU_state.h b/source/blender/gpu/GPU_state.h index eb273608a3f..23682815e4c 100644 --- a/source/blender/gpu/GPU_state.h +++ b/source/blender/gpu/GPU_state.h @@ -33,7 +33,7 @@ typedef enum eGPUBlendFunction { /* These map directly to the GL_ filter functions, to minimize API add as needed*/ typedef enum eGPUFilterFunction { GPU_NEAREST, - GPU_LINEAR + GPU_LINEAR, } eGPUFilterFunction; void GPU_blend(bool enable); diff --git a/source/blender/gpu/GPU_vertex_buffer.h b/source/blender/gpu/GPU_vertex_buffer.h index 4c1814a9d9b..c7ef337261f 100644 --- a/source/blender/gpu/GPU_vertex_buffer.h +++ b/source/blender/gpu/GPU_vertex_buffer.h @@ -43,7 +43,7 @@ typedef enum { /* can be extended to support more types */ GPU_USAGE_STREAM, GPU_USAGE_STATIC, /* do not keep data in memory */ - GPU_USAGE_DYNAMIC + GPU_USAGE_DYNAMIC, } GPUUsageType; typedef struct GPUVertBuf { diff --git a/source/blender/gpu/GPU_vertex_format.h b/source/blender/gpu/GPU_vertex_format.h index 63ff430033b..ce70430dcca 100644 --- a/source/blender/gpu/GPU_vertex_format.h +++ b/source/blender/gpu/GPU_vertex_format.h @@ -43,14 +43,14 @@ typedef enum { GPU_COMP_F32, - GPU_COMP_I10 + GPU_COMP_I10, } GPUVertCompType; typedef enum { GPU_FETCH_FLOAT, GPU_FETCH_INT, GPU_FETCH_INT_TO_FLOAT_UNIT, /* 127 (ubyte) -> 0.5 (and so on for other int types) */ - GPU_FETCH_INT_TO_FLOAT /* 127 (any int type) -> 127.0 */ + GPU_FETCH_INT_TO_FLOAT, /* 127 (any int type) -> 127.0 */ } GPUVertFetchMode; typedef struct GPUVertAttr { diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c index 552ae8f4cd7..84164045984 100644 --- a/source/blender/gpu/intern/gpu_codegen.c +++ b/source/blender/gpu/intern/gpu_codegen.c @@ -133,7 +133,7 @@ static GPUPass *gpu_pass_cache_resolve_collision( typedef enum { FUNCTION_QUAL_IN, FUNCTION_QUAL_OUT, - FUNCTION_QUAL_INOUT + FUNCTION_QUAL_INOUT, } GPUFunctionQual; typedef struct GPUFunction { diff --git a/source/blender/gpu/intern/gpu_framebuffer.c b/source/blender/gpu/intern/gpu_framebuffer.c index 83acdf6a756..c5ed3f8e01d 100644 --- a/source/blender/gpu/intern/gpu_framebuffer.c +++ b/source/blender/gpu/intern/gpu_framebuffer.c @@ -51,7 +51,7 @@ typedef enum { * We support 5 outputs for now (usually we wouldn't need more to preserve fill rate). */ /* Keep in mind that GL max is GL_MAX_DRAW_BUFFERS and is at least 8, corresponding to * the maximum number of COLOR attachments specified by glDrawBuffers. */ - GPU_FB_MAX_ATTACHEMENT + GPU_FB_MAX_ATTACHEMENT, } GPUAttachmentType; #define GPU_FB_MAX_COLOR_ATTACHMENT (GPU_FB_MAX_ATTACHEMENT - GPU_FB_COLOR_ATTACHMENT0) diff --git a/source/blender/ikplugin/CMakeLists.txt b/source/blender/ikplugin/CMakeLists.txt index 9bbc3a62b99..654d83d71af 100644 --- a/source/blender/ikplugin/CMakeLists.txt +++ b/source/blender/ikplugin/CMakeLists.txt @@ -43,7 +43,9 @@ set(LIB ) if(WITH_IK_SOLVER) - add_definitions(-DWITH_IK_SOLVER) + list(APPEND LIB + bf_intern_iksolver + ) list(APPEND INC ../../../intern/iksolver/extern ) @@ -51,10 +53,13 @@ if(WITH_IK_SOLVER) intern/iksolver_plugin.c intern/iksolver_plugin.h ) + add_definitions(-DWITH_IK_SOLVER) endif() if(WITH_IK_ITASC) - add_definitions(-DWITH_IK_ITASC) + list(APPEND LIB + bf_intern_itasc + ) list(APPEND INC ../../../intern/itasc ) @@ -65,6 +70,7 @@ if(WITH_IK_ITASC) intern/itasc_plugin.cpp intern/itasc_plugin.h ) + add_definitions(-DWITH_IK_ITASC) endif() blender_add_lib(bf_ikplugin "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") diff --git a/source/blender/imbuf/CMakeLists.txt b/source/blender/imbuf/CMakeLists.txt index 87002e5efc0..a52c72f8ecd 100644 --- a/source/blender/imbuf/CMakeLists.txt +++ b/source/blender/imbuf/CMakeLists.txt @@ -84,9 +84,18 @@ set(SRC ) set(LIB + bf_blenkernel + bf_blenlib + bf_blenloader + bf_intern_guardedalloc + bf_intern_memutil + bf_intern_opencolorio ) if(WITH_IMAGE_OPENEXR) + list(APPEND LIB + bf_imbuf_openexr + ) add_definitions(-DWITH_OPENEXR) else() list(APPEND SRC @@ -101,12 +110,14 @@ if(WITH_IMAGE_TIFF) list(APPEND SRC intern/tiff.c ) - add_definitions(-DWITH_TIFF) endif() if(WITH_OPENIMAGEIO) + list(APPEND LIB + bf_imbuf_openimageio + ) add_definitions(-DWITH_OPENIMAGEIO) endif() @@ -125,6 +136,9 @@ if(WITH_CODEC_AVI) list(APPEND INC ../avi ) + list(APPEND LIB + bf_avi + ) add_definitions(-DWITH_AVI) endif() @@ -145,10 +159,16 @@ if(WITH_CODEC_FFMPEG) endif() if(WITH_IMAGE_DDS) + list(APPEND LIB + bf_imbuf_dds + ) add_definitions(-DWITH_DDS) endif() if(WITH_IMAGE_CINEON) + list(APPEND LIB + bf_imbuf_cineon + ) add_definitions(-DWITH_CINEON) endif() diff --git a/source/blender/imbuf/IMB_thumbs.h b/source/blender/imbuf/IMB_thumbs.h index cc00f50a209..1c64edb21da 100644 --- a/source/blender/imbuf/IMB_thumbs.h +++ b/source/blender/imbuf/IMB_thumbs.h @@ -40,7 +40,7 @@ struct ImBuf; typedef enum ThumbSize { THB_NORMAL, THB_LARGE, - THB_FAIL + THB_FAIL, } ThumbSize; typedef enum ThumbSource { diff --git a/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp b/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp index 16a7525bb80..76de84cdee5 100644 --- a/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp +++ b/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp @@ -1148,6 +1148,12 @@ void *DirectDrawSurface::readData(uint &rsize) stream.seek(header_size); mem_read(stream, data, size); + if (stream.failed) { + free(data); + data = NULL; + rsize = 0; + } + // Maybe check if size == rsize? assert() isn't in this scope... return data; diff --git a/source/blender/imbuf/intern/dds/Stream.cpp b/source/blender/imbuf/intern/dds/Stream.cpp index 92b5923e8a1..993fa7734ba 100644 --- a/source/blender/imbuf/intern/dds/Stream.cpp +++ b/source/blender/imbuf/intern/dds/Stream.cpp @@ -30,7 +30,7 @@ static const char *msg_error_read = "DDS: trying to read beyond end of stream (c unsigned int Stream::seek(unsigned int p) { if (p > size) { - puts(msg_error_seek); + set_failed(msg_error_seek); } else { pos = p; @@ -42,7 +42,7 @@ unsigned int Stream::seek(unsigned int p) unsigned int mem_read(Stream & mem, unsigned long long & i) { if (mem.pos + 8 > mem.size) { - puts(msg_error_seek); + mem.set_failed(msg_error_seek); return(0); } memcpy(&i, mem.mem + mem.pos, 8); // @@ todo: make sure little endian @@ -53,7 +53,7 @@ unsigned int mem_read(Stream & mem, unsigned long long & i) unsigned int mem_read(Stream & mem, unsigned int & i) { if (mem.pos + 4 > mem.size) { - puts(msg_error_read); + mem.set_failed(msg_error_read); return(0); } memcpy(&i, mem.mem + mem.pos, 4); // @@ todo: make sure little endian @@ -64,7 +64,7 @@ unsigned int mem_read(Stream & mem, unsigned int & i) unsigned int mem_read(Stream & mem, unsigned short & i) { if (mem.pos + 2 > mem.size) { - puts(msg_error_read); + mem.set_failed(msg_error_read); return(0); } memcpy(&i, mem.mem + mem.pos, 2); // @@ todo: make sure little endian @@ -75,7 +75,7 @@ unsigned int mem_read(Stream & mem, unsigned short & i) unsigned int mem_read(Stream & mem, unsigned char & i) { if (mem.pos + 1 > mem.size) { - puts(msg_error_read); + mem.set_failed(msg_error_read); return(0); } i = (mem.mem + mem.pos)[0]; @@ -86,10 +86,18 @@ unsigned int mem_read(Stream & mem, unsigned char & i) unsigned int mem_read(Stream & mem, unsigned char *i, unsigned int cnt) { if (mem.pos + cnt > mem.size) { - puts(msg_error_read); + mem.set_failed(msg_error_read); return(0); } memcpy(i, mem.mem + mem.pos, cnt); mem.pos += cnt; return(cnt); } + +void Stream::set_failed(const char *msg) +{ + if (!failed) { + puts(msg); + failed = true; + } +} diff --git a/source/blender/imbuf/intern/dds/Stream.h b/source/blender/imbuf/intern/dds/Stream.h index 3da0feb5aeb..b9fba2ef8b2 100644 --- a/source/blender/imbuf/intern/dds/Stream.h +++ b/source/blender/imbuf/intern/dds/Stream.h @@ -28,8 +28,10 @@ struct Stream { unsigned char *mem; // location in memory unsigned int size; // size unsigned int pos; // current position - Stream(unsigned char *m, unsigned int s) : mem(m), size(s), pos(0) {} + bool failed; // error occured when seeking + Stream(unsigned char *m, unsigned int s) : mem(m), size(s), pos(0), failed(false) {} unsigned int seek(unsigned int p); + void set_failed(const char *msg); }; unsigned int mem_read(Stream & mem, unsigned long long & i); diff --git a/source/blender/imbuf/intern/dds/dds_api.cpp b/source/blender/imbuf/intern/dds/dds_api.cpp index 37577eefc56..fa88f81b55a 100644 --- a/source/blender/imbuf/intern/dds/dds_api.cpp +++ b/source/blender/imbuf/intern/dds/dds_api.cpp @@ -165,7 +165,9 @@ struct ImBuf *imb_load_dds(const unsigned char *mem, size_t size, int flags, cha ibuf->dds_data.data = (unsigned char *)dds.readData(ibuf->dds_data.size); /* flip compressed texture */ - FlipDXTCImage(dds.width(), dds.height(), dds.mipmapCount(), dds.fourCC(), ibuf->dds_data.data); + if (ibuf->dds_data.data) { + FlipDXTCImage(dds.width(), dds.height(), dds.mipmapCount(), dds.fourCC(), ibuf->dds_data.data); + } } else { ibuf->dds_data.data = NULL; diff --git a/source/blender/imbuf/intern/thumbs.c b/source/blender/imbuf/intern/thumbs.c index c9112cc768e..6c71aa06583 100644 --- a/source/blender/imbuf/intern/thumbs.c +++ b/source/blender/imbuf/intern/thumbs.c @@ -141,7 +141,7 @@ typedef enum { UNSAFE_ALLOW_PLUS = 0x2, /* Allows '+' */ UNSAFE_PATH = 0x8, /* Allows '/', '&', '=', ':', '@', '+', '$' and ',' */ UNSAFE_HOST = 0x10, /* Allows '/' and ':' and '@' */ - UNSAFE_SLASHES = 0x20 /* Allows all characters except for '/' and '%' */ + UNSAFE_SLASHES = 0x20, /* Allows all characters except for '/' and '%' */ } UnsafeCharacterSet; static const unsigned char acceptable[96] = { diff --git a/source/blender/makesdna/DNA_anim_types.h b/source/blender/makesdna/DNA_anim_types.h index b6fed5fd941..6d3a606a33c 100644 --- a/source/blender/makesdna/DNA_anim_types.h +++ b/source/blender/makesdna/DNA_anim_types.h @@ -90,7 +90,7 @@ typedef enum eFModifier_Types { FMODIFIER_TYPE_STEPPED = 9, /* NOTE: all new modifiers must be added above this line */ - FMODIFIER_NUM_TYPES + FMODIFIER_NUM_TYPES, } eFModifier_Types; /** F-Curve Modifier Settings. */ @@ -227,7 +227,7 @@ typedef enum eFMod_Cycling_Modes { /** repeat keyframe range, but with offset based on gradient between values */ FCM_EXTRAPOLATE_CYCLIC_OFFSET, /** alternate between forward and reverse playback of keyframe range */ - FCM_EXTRAPOLATE_MIRROR + FCM_EXTRAPOLATE_MIRROR, } eFMod_Cycling_Modes; @@ -278,7 +278,7 @@ typedef enum eFMod_Noise_Modifications { /** Subtract noise from the curve. */ FCM_NOISE_MODIF_SUBTRACT, /** Multiply the curve by noise. */ - FCM_NOISE_MODIF_MULTIPLY + FCM_NOISE_MODIF_MULTIPLY, } eFMod_Noise_Modifications; @@ -366,7 +366,7 @@ typedef enum eDriverTarget_TransformChannels { DTAR_TRANSCHAN_SCALEY, DTAR_TRANSCHAN_SCALEZ, - MAX_DTAR_TRANSCHAN_TYPES + MAX_DTAR_TRANSCHAN_TYPES, } eDriverTarget_TransformChannels; /* --- */ @@ -424,7 +424,7 @@ typedef enum eDriverVar_Types { * \note This must always be th last item in this list, * so add new types above this line. */ - MAX_DVAR_TYPES + MAX_DVAR_TYPES, } eDriverVar_Types; /* Driver Variable Flags */ @@ -515,7 +515,7 @@ typedef enum eDriver_Types { /** smallest value. */ DRIVER_TYPE_MIN, /** largest value. */ - DRIVER_TYPE_MAX + DRIVER_TYPE_MAX, } eDriver_Types; /** Driver flags. */ @@ -638,7 +638,7 @@ typedef enum eFCurve_Extend { /** just extend min/max keyframe value */ FCURVE_EXTRAPOLATE_CONSTANT = 0, /** just extend gradient of segment between first segment keyframes */ - FCURVE_EXTRAPOLATE_LINEAR + FCURVE_EXTRAPOLATE_LINEAR, } eFCurve_Extend; /* curve coloring modes */ @@ -802,7 +802,7 @@ typedef enum eNlaStrip_Type { NLASTRIP_TYPE_META, /* 'emit sound' - a strip which is used for timing when speaker emits sounds */ - NLASTRIP_TYPE_SOUND + NLASTRIP_TYPE_SOUND, } eNlaStrip_Type; /* NLA Tracks ------------------------------------- */ @@ -906,7 +906,7 @@ typedef enum eKSP_Grouping { KSP_GROUP_KSNAME, /** Path should be grouped using name of inner-most context item from templates * - this is most useful for relative KeyingSets only. */ - KSP_GROUP_TEMPLATE_ITEM + KSP_GROUP_TEMPLATE_ITEM, } eKSP_Grouping; /* ---------------- */ diff --git a/source/blender/makesdna/DNA_boid_types.h b/source/blender/makesdna/DNA_boid_types.h index 6c68ca69363..b9ea97ca27f 100644 --- a/source/blender/makesdna/DNA_boid_types.h +++ b/source/blender/makesdna/DNA_boid_types.h @@ -54,7 +54,7 @@ typedef enum eBoidRuleType { /** move next to a deflector object's in direction of it's tangent */ eBoidRuleType_FollowWall = 12, #endif - NUM_BOID_RULE_TYPES + NUM_BOID_RULE_TYPES, } eBoidRuleType; /* boidrule->flag */ @@ -108,7 +108,7 @@ typedef enum eBoidMode { eBoidMode_Climbing = 2, eBoidMode_Falling = 3, eBoidMode_Liftoff = 4, - NUM_BOID_MODES + NUM_BOID_MODES, } eBoidMode; @@ -150,7 +150,7 @@ typedef enum eBoidRulesetType { eBoidRulesetType_Fuzzy = 0, eBoidRulesetType_Random = 1, eBoidRulesetType_Average = 2, - NUM_BOID_RULESET_TYPES + NUM_BOID_RULESET_TYPES, } eBoidRulesetType; #define BOIDSTATE_CURRENT 1 typedef struct BoidState { diff --git a/source/blender/makesdna/DNA_brush_types.h b/source/blender/makesdna/DNA_brush_types.h index 4bfbb3655af..63203b70f42 100644 --- a/source/blender/makesdna/DNA_brush_types.h +++ b/source/blender/makesdna/DNA_brush_types.h @@ -111,6 +111,12 @@ typedef struct BrushGpencilSettings { /** Internal grease pencil drawing flags. */ int flag; + /** gradient control along y for color */ + float gradient_f; + /** factor xy of shape for dots gradients */ + float gradient_s[2]; + char _pad_2[4]; + struct CurveMapping *curve_sensitivity; struct CurveMapping *curve_strength; struct CurveMapping *curve_jitter; @@ -347,12 +353,12 @@ typedef struct PaintCurve { typedef enum eBrushGradientSourceStroke { BRUSH_GRADIENT_PRESSURE = 0, /* gradient from pressure */ BRUSH_GRADIENT_SPACING_REPEAT = 1, /* gradient from spacing */ - BRUSH_GRADIENT_SPACING_CLAMP = 2 /* gradient from spacing */ + BRUSH_GRADIENT_SPACING_CLAMP = 2, /* gradient from spacing */ } eBrushGradientSourceStroke; typedef enum eBrushGradientSourceFill { BRUSH_GRADIENT_LINEAR = 0, /* gradient from pressure */ - BRUSH_GRADIENT_RADIAL = 1 /* gradient from spacing */ + BRUSH_GRADIENT_RADIAL = 1, /* gradient from spacing */ } eBrushGradientSourceFill; /* Brush.flag */ @@ -525,7 +531,7 @@ typedef enum { /* blur kernel types, Brush.blur_mode */ typedef enum eBlurKernelType { KERNEL_GAUSSIAN, - KERNEL_BOX + KERNEL_BOX, } eBlurKernelType; /* Brush.falloff_shape */ diff --git a/source/blender/makesdna/DNA_constraint_types.h b/source/blender/makesdna/DNA_constraint_types.h index 51ff301abf2..9dbebee5c89 100644 --- a/source/blender/makesdna/DNA_constraint_types.h +++ b/source/blender/makesdna/DNA_constraint_types.h @@ -231,6 +231,9 @@ typedef struct bSplineIKConstraint { short flag; /** Method used for determining the x & z scaling of the bones. */ short xzScaleMode; + /** Method used for determining the y scaling of the bones. */ + short yScaleMode; + short _pad[3]; /* volume preservation settings */ float bulge; @@ -662,7 +665,7 @@ typedef enum eBConstraint_Types { CONSTRAINT_TYPE_ARMATURE = 30, /* NOTE: no constraints are allowed to be added after this */ - NUM_CONSTRAINT_TYPES + NUM_CONSTRAINT_TYPES, } eBConstraint_Types; /* bConstraint->flag */ @@ -704,7 +707,7 @@ typedef enum eBConstraint_SpaceTypes { /** For posechannels - local with parent. */ CONSTRAINT_SPACE_PARLOCAL = 3, /** For files from between 2.43-2.46 (should have been parlocal). */ - CONSTRAINT_SPACE_INVALID = 4 /* do not exchange for anything! */ + CONSTRAINT_SPACE_INVALID = 4, /* do not exchange for anything! */ } eBConstraint_SpaceTypes; /* bConstraintChannel.flag */ @@ -790,7 +793,7 @@ typedef enum eTrackToAxis_Modes { TRACK_Z = 2, TRACK_nX = 3, TRACK_nY = 4, - TRACK_nZ = 5 + TRACK_nZ = 5, } eTrackToAxis_Modes; /* Shrinkwrap flags */ @@ -879,8 +882,10 @@ typedef enum eSplineIK_Flags { CONSTRAINT_SPLINEIK_BOUND = (1 << 0), /* root of chain is not influenced by the constraint */ CONSTRAINT_SPLINEIK_NO_ROOT = (1 << 1), +#ifdef DNA_DEPRECATED /* bones in the chain should not scale to fit the curve */ CONSTRAINT_SPLINEIK_SCALE_LIMITED = (1 << 2), +#endif /* evenly distribute the bones along the path regardless of length */ CONSTRAINT_SPLINEIK_EVENSPLITS = (1 << 3), /* don't adjust the x and z scaling of the bones by the curve radius */ @@ -903,6 +908,16 @@ typedef enum eSplineIK_XZScaleModes { CONSTRAINT_SPLINEIK_XZS_VOLUMETRIC = 3, } eSplineIK_XZScaleModes; +/* bSplineIKConstraint->yScaleMode */ +typedef enum eSplineIK_YScaleModes { + /* no y scaling */ + CONSTRAINT_SPLINEIK_YS_NONE = 0, + /* bones in the chain should be scaled to fit the length of the curve */ + CONSTRAINT_SPLINEIK_YS_FIT_CURVE = 1, + /* bones in the chain should take their y scales from the original scaling */ + CONSTRAINT_SPLINEIK_YS_ORIGINAL = 2, +} eSplineIK_YScaleModes; + /* bArmatureConstraint -> flag */ typedef enum eArmature_Flags { /** use dual quaternion blending */ diff --git a/source/blender/makesdna/DNA_gpencil_modifier_types.h b/source/blender/makesdna/DNA_gpencil_modifier_types.h index 9e930ddec57..cbaae451756 100644 --- a/source/blender/makesdna/DNA_gpencil_modifier_types.h +++ b/source/blender/makesdna/DNA_gpencil_modifier_types.h @@ -48,7 +48,7 @@ typedef enum GpencilModifierType { eGpencilModifierType_Mirror = 14, eGpencilModifierType_Armature = 15, eGpencilModifierType_Time = 16, - NUM_GREASEPENCIL_MODIFIER_TYPES + NUM_GREASEPENCIL_MODIFIER_TYPES, } GpencilModifierType; typedef enum GpencilModifierMode { diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h index 56e17fe9149..6ac48c72505 100644 --- a/source/blender/makesdna/DNA_gpencil_types.h +++ b/source/blender/makesdna/DNA_gpencil_types.h @@ -199,6 +199,12 @@ typedef struct bGPDstroke { /** Caps mode for each stroke extreme */ short caps[2]; + /** gradient control along y for color */ + float gradient_f; + /** factor xy of shape for dots gradients */ + float gradient_s[2]; + char _pad_3[4]; + /** Vertex weight data. */ struct MDeformVert *dvert; void *_pad3; @@ -235,7 +241,7 @@ typedef enum eGPDstroke_Caps { GP_STROKE_CAP_ROUND = 0, GP_STROKE_CAP_FLAT = 1, - GP_STROKE_CAP_MAX + GP_STROKE_CAP_MAX, } GPDstroke_Caps; /* ***************************************** */ @@ -620,7 +626,7 @@ typedef enum eGP_DepthOrdering { /* draw modes (Use 2D or 3D position) */ typedef enum eGP_DrawMode { GP_DRAWMODE_2D = 0, - GP_DRAWMODE_3D = 1 + GP_DRAWMODE_3D = 1, } eGP_DrawMode; /* ***************************************** */ diff --git a/source/blender/makesdna/DNA_material_types.h b/source/blender/makesdna/DNA_material_types.h index 3db8bf92f56..1f8e7741304 100644 --- a/source/blender/makesdna/DNA_material_types.h +++ b/source/blender/makesdna/DNA_material_types.h @@ -121,6 +121,8 @@ typedef enum eMaterialGPencilStyle_Flag { GP_STYLE_STROKE_SHOW = (1 << 8), /* Fill show main switch */ GP_STYLE_FILL_SHOW = (1 << 9), + /* Don't rotate dots/boxes */ + GP_STYLE_COLOR_LOCK_DOTS = (1 << 10), } eMaterialGPencilStyle_Flag; typedef enum eMaterialGPencilStyle_Mode { diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h index 7d80c0f4f0d..17dcfcadbd1 100644 --- a/source/blender/makesdna/DNA_modifier_types.h +++ b/source/blender/makesdna/DNA_modifier_types.h @@ -101,7 +101,7 @@ typedef enum ModifierMode { eModifierMode_Expanded = (1 << 4), eModifierMode_Virtual = (1 << 5), eModifierMode_ApplyOnSpline = (1 << 6), - eModifierMode_DisableTemporary = (1u << 31) + eModifierMode_DisableTemporary = (1u << 31), } ModifierMode; typedef struct ModifierData { diff --git a/source/blender/makesdna/DNA_object_force_types.h b/source/blender/makesdna/DNA_object_force_types.h index edd5d305683..df77bbc5744 100644 --- a/source/blender/makesdna/DNA_object_force_types.h +++ b/source/blender/makesdna/DNA_object_force_types.h @@ -62,7 +62,7 @@ typedef enum ePFieldType { /** Force based on smoke simulation air flow. */ PFIELD_SMOKEFLOW = 13, - NUM_PFIELD_TYPES + NUM_PFIELD_TYPES, } ePFieldType; typedef struct PartDeflect { diff --git a/source/blender/makesdna/DNA_particle_types.h b/source/blender/makesdna/DNA_particle_types.h index ae677a93c43..a6ad651b5d7 100644 --- a/source/blender/makesdna/DNA_particle_types.h +++ b/source/blender/makesdna/DNA_particle_types.h @@ -407,7 +407,8 @@ typedef enum eParticleDrawFlag { PART_DRAW_GLOBAL_OB = (1 << 1), PART_DRAW_SIZE = (1 << 2), #ifdef DNA_DEPRECATED - PART_DRAW_EMITTER = (1 << 3), /* render emitter also */ /* DEPRECATED */ + /** Render emitter as well. */ + PART_DRAW_EMITTER = (1 << 3), /* DEPRECATED */ #endif PART_DRAW_HEALTH = (1 << 4), PART_ABS_PATH_TIME = (1 << 5), diff --git a/source/blender/makesdna/DNA_rigidbody_types.h b/source/blender/makesdna/DNA_rigidbody_types.h index a3a2a0e0124..4859bf6eda9 100644 --- a/source/blender/makesdna/DNA_rigidbody_types.h +++ b/source/blender/makesdna/DNA_rigidbody_types.h @@ -172,7 +172,7 @@ typedef enum eRigidBodyOb_Type { /* active geometry participant in simulation. is directly controlled by sim */ RBO_TYPE_ACTIVE = 0, /* passive geometry participant in simulation. is directly controlled by animsys */ - RBO_TYPE_PASSIVE + RBO_TYPE_PASSIVE, } eRigidBodyOb_Type; /* Flags for RigidBodyOb */ @@ -223,7 +223,7 @@ typedef enum eRigidBody_MeshSource { /* only deformations */ RBO_MESH_DEFORM, /* final derived mesh */ - RBO_MESH_FINAL + RBO_MESH_FINAL, } eRigidBody_MeshSource; /* ******************************** */ diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 49ebc9b9bac..9f81eb854ea 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -1053,7 +1053,7 @@ typedef enum eGP_Lockaxis_Types { GP_LOCKAXIS_X = 1, GP_LOCKAXIS_Y = 2, GP_LOCKAXIS_Z = 3, - GP_LOCKAXIS_CURSOR = 4 + GP_LOCKAXIS_CURSOR = 4, } eGP_Lockaxis_Types; /* Settings for a GPencil Stroke Sculpting Brush */ @@ -2331,14 +2331,14 @@ typedef enum eGPencil_GuideTypes { GP_GUIDE_CIRCULAR = 0, GP_GUIDE_RADIAL, GP_GUIDE_PARALLEL, - GP_GUIDE_GRID + GP_GUIDE_GRID, } eGPencil_GuideTypes; /* ToolSettings.gpencil_guide_references */ typedef enum eGPencil_Guide_Reference { GP_GUIDE_REF_CURSOR = 0, GP_GUIDE_REF_CUSTOM, - GP_GUIDE_REF_OBJECT + GP_GUIDE_REF_OBJECT, } eGPencil_Guide_Reference; /* ToolSettings.particle flag */ diff --git a/source/blender/makesdna/DNA_shader_fx_types.h b/source/blender/makesdna/DNA_shader_fx_types.h index 54922d78fae..2b12d522245 100644 --- a/source/blender/makesdna/DNA_shader_fx_types.h +++ b/source/blender/makesdna/DNA_shader_fx_types.h @@ -42,7 +42,7 @@ typedef enum ShaderFxType { eShaderFxType_Colorize = 8, eShaderFxType_Shadow = 9, eShaderFxType_Glow = 10, - NUM_SHADER_FX_TYPES + NUM_SHADER_FX_TYPES, } ShaderFxType; typedef enum ShaderFxMode { diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index 2b1a6adb344..919afef4b32 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -198,7 +198,7 @@ typedef enum eSpaceButtons_Context { BCONTEXT_OUTPUT = 16, /* always as last... */ - BCONTEXT_TOT + BCONTEXT_TOT, } eSpaceButtons_Context; /* SpaceProperties.flag */ diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h index 49e1444d6ef..fadd6c57ef5 100644 --- a/source/blender/makesrna/RNA_types.h +++ b/source/blender/makesrna/RNA_types.h @@ -341,7 +341,7 @@ typedef enum RawPropertyType { PROP_RAW_CHAR, PROP_RAW_BOOLEAN, PROP_RAW_DOUBLE, - PROP_RAW_FLOAT + PROP_RAW_FLOAT, } RawPropertyType; typedef struct RawArray { diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index 8521e06c328..4d8907cabd7 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -373,6 +373,24 @@ set(SRC ) set(LIB + bf_dna + bf_editor_armature + bf_editor_curve + bf_editor_gizmo_library + bf_editor_gpencil + bf_editor_mesh + bf_editor_object + bf_editor_physics + bf_editor_render + bf_editor_scene + bf_editor_sculpt_paint + bf_editor_space_clip + bf_editor_space_file + bf_editor_space_image + bf_editor_space_info + bf_editor_space_node + bf_editor_space_view3d + bf_editor_transform ) add_definitions(${GL_DEFINITIONS}) diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index ce5b18331c6..23ae314f885 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -1197,6 +1197,25 @@ static void rna_def_gpencil_options(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL); + /* gradient control */ + prop = RNA_def_property(srna, "gradient_factor", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_float_sdna(prop, NULL, "gradient_f"); + RNA_def_property_range(prop, 0.001f, 1.0f); + RNA_def_property_float_default(prop, 1.0f); + RNA_def_property_ui_text( + prop, "Border Opacity Factor", + "Amount of gradient for Dot strokes (set to 1 for full solid)"); + RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0); + + /* gradient shape ratio */ + prop = RNA_def_property(srna, "gradient_shape", PROP_FLOAT, PROP_XYZ); + RNA_def_property_float_sdna(prop, NULL, "gradient_s"); + RNA_def_property_array(prop, 2); + RNA_def_property_range(prop, 0.01f, 1.0f); + RNA_def_property_float_default(prop, 1.0f); + RNA_def_property_ui_text(prop, "Aspect Ratio", ""); + RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0); + prop = RNA_def_property(srna, "input_samples", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "input_samples"); RNA_def_property_range(prop, 0, GP_MAX_INPUT_SAMPLES); diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index bd7f75f86b5..731e25b7e9a 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -2262,6 +2262,15 @@ static void rna_def_constraint_spline_ik(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}, }; + static const EnumPropertyItem splineik_y_scale_mode[] = { + {CONSTRAINT_SPLINEIK_YS_NONE, "NONE", 0, "None", "Don't scale in the Y axis"}, + {CONSTRAINT_SPLINEIK_YS_FIT_CURVE, "FIT_CURVE", 0, "Fit Curve", + "Scale the bones to fit the entire length of the curve"}, + {CONSTRAINT_SPLINEIK_YS_ORIGINAL, "BONE_ORIGINAL", 0, "Bone Original", + "Use the original Y scale of the bone"}, + {0, NULL, 0, NULL, NULL}, + }; + srna = RNA_def_struct(brna, "SplineIKConstraint", "Constraint"); RNA_def_struct_ui_text(srna, "Spline IK Constraint", "Align 'n' bones along a curve"); RNA_def_struct_sdna_from(srna, "bSplineIKConstraint", "data"); @@ -2308,11 +2317,6 @@ static void rna_def_constraint_spline_ik(BlenderRNA *brna) "Ignore the relative lengths of the bones when fitting to the curve"); RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update"); - prop = RNA_def_property(srna, "use_y_stretch", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_SPLINEIK_SCALE_LIMITED); - RNA_def_property_ui_text(prop, "Y Stretch", "Stretch the Y axis of the bones to fit the curve"); - RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update"); - prop = RNA_def_property(srna, "use_curve_radius", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_SPLINEIK_NO_CURVERAD); RNA_def_property_ui_text(prop, "Use Curve Radius", @@ -2328,6 +2332,15 @@ static void rna_def_constraint_spline_ik(BlenderRNA *brna) "Method used for determining the scaling of the X and Z axes of the bones"); RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update"); + /* y scaling mode */ + prop = RNA_def_property(srna, "y_scale_mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "yScaleMode"); + RNA_def_property_enum_items(prop, splineik_y_scale_mode); + RNA_def_property_ui_text(prop, "Y Scale Mode", + "Method used for determining the scaling of the Y axis of the bones, " + "on top of the shape and scaling of the curve itself"); + RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update"); + /* volume presevation for "volumetric" scale mode */ prop = RNA_def_property(srna, "bulge", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, 0.0, 100.f); diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c index 73203beb3e2..d154f8de4ad 100644 --- a/source/blender/makesrna/intern/rna_gpencil.c +++ b/source/blender/makesrna/intern/rna_gpencil.c @@ -998,6 +998,24 @@ static void rna_def_gpencil_stroke(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Thickness", "Thickness of stroke (in pixels)"); RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); + /* gradient control along y */ + prop = RNA_def_property(srna, "gradient_factor", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_float_sdna(prop, NULL, "gradient_f"); + RNA_def_property_range(prop, 0.001f, 1.0f); + RNA_def_property_float_default(prop, 1.0f); + RNA_def_property_ui_text(prop, "Border Opacity Factor", + "Amount of gradient along section of stroke"); + RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0); + RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); + + /* gradient shape ratio */ + prop = RNA_def_property(srna, "gradient_shape", PROP_FLOAT, PROP_XYZ); + RNA_def_property_float_sdna(prop, NULL, "gradient_s"); + RNA_def_property_array(prop, 2); + RNA_def_property_range(prop, 0.01f, 1.0f); + RNA_def_property_float_default(prop, 1.0f); + RNA_def_property_ui_text(prop, "Aspect Ratio", ""); + RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); } static void rna_def_gpencil_strokes_api(BlenderRNA *brna, PropertyRNA *cprop) diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index 8e5f486fea1..a57f47a8090 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -585,6 +585,13 @@ static void rna_def_material_greasepencil(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Show Fill", "Show stroke fills of this material"); RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update"); + /* keep Dots and Boxes aligned to screen and not to drawing path */ + prop = RNA_def_property(srna, "use_follow_path", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GP_STYLE_COLOR_LOCK_DOTS); + RNA_def_property_ui_text(prop, "Follow Path", + "Keep Dots and Boxes aligned to drawing path"); + RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_nopreview_update"); + /* pass index for future compositing and editing tools */ prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "index"); diff --git a/source/blender/modifiers/CMakeLists.txt b/source/blender/modifiers/CMakeLists.txt index 8f87388f76a..f04abb1d653 100644 --- a/source/blender/modifiers/CMakeLists.txt +++ b/source/blender/modifiers/CMakeLists.txt @@ -112,6 +112,8 @@ set(SRC ) set(LIB + bf_blenkernel + bf_blenlib ) if(WITH_ALEMBIC) @@ -119,13 +121,19 @@ if(WITH_ALEMBIC) list(APPEND INC ../alembic ) + list(APPEND LIB + bf_alembic + ) endif() if(WITH_MOD_REMESH) - add_definitions(-DWITH_MOD_REMESH) list(APPEND INC ../../../intern/dualcon ) + list(APPEND LIB + bf_intern_dualcon + ) + add_definitions(-DWITH_MOD_REMESH) endif() if(WITH_MOD_FLUID) @@ -137,6 +145,9 @@ if(WITH_MOD_OCEANSIM) endif() if(WITH_BULLET) + list(APPEND LIB + extern_bullet + ) add_definitions(-DWITH_BULLET) endif() diff --git a/source/blender/nodes/NOD_static_types.h b/source/blender/nodes/NOD_static_types.h index 1c3b792f20b..ea642303ef6 100644 --- a/source/blender/nodes/NOD_static_types.h +++ b/source/blender/nodes/NOD_static_types.h @@ -20,6 +20,9 @@ /* intentionally no include guard */ +/* Keep aligned args for readability. */ +/* clang-format off */ + /* Empty definitions for undefined macros to avoid warnings */ #ifndef DefNode #define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc) @@ -249,3 +252,5 @@ DefNode(TextureNode, TEX_NODE_PROC+TEX_DISTNOISE, 0, "TEX_DI /* undefine macros */ #undef DefNode + +/* clang-format on */ diff --git a/source/blender/nodes/composite/nodes/node_composite_cornerpin.c b/source/blender/nodes/composite/nodes/node_composite_cornerpin.c index a851e3268b0..f6320af4885 100644 --- a/source/blender/nodes/composite/nodes/node_composite_cornerpin.c +++ b/source/blender/nodes/composite/nodes/node_composite_cornerpin.c @@ -30,7 +30,7 @@ static bNodeSocketTemplate inputs[] = { { SOCK_VECTOR, 1, N_("Upper Right"), 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, { SOCK_VECTOR, 1, N_("Lower Left"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, { SOCK_VECTOR, 1, N_("Lower Right"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate outputs[] = { diff --git a/source/blender/nodes/composite/nodes/node_composite_cryptomatte.c b/source/blender/nodes/composite/nodes/node_composite_cryptomatte.c index 37573846d7e..1569d27017e 100644 --- a/source/blender/nodes/composite/nodes/node_composite_cryptomatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_cryptomatte.c @@ -197,7 +197,7 @@ static bNodeSocketTemplate outputs[] = { { SOCK_RGBA, 0, N_("Image")}, { SOCK_FLOAT, 0, N_("Matte")}, { SOCK_RGBA, 0, N_("Pick")}, - { -1, 0, "" } + { -1, 0, "" }, }; void ntreeCompositCryptomatteSyncFromAdd(bNodeTree *UNUSED(ntree), bNode *node) diff --git a/source/blender/nodes/shader/nodes/node_shader_particle_info.c b/source/blender/nodes/shader/nodes/node_shader_particle_info.c index 3a20dd1ca02..f14d46a7d1c 100644 --- a/source/blender/nodes/shader/nodes/node_shader_particle_info.c +++ b/source/blender/nodes/shader/nodes/node_shader_particle_info.c @@ -32,7 +32,7 @@ static bNodeSocketTemplate outputs[] = { { SOCK_FLOAT, 0, "Size" }, { SOCK_VECTOR, 0, "Velocity" }, { SOCK_VECTOR, 0, "Angular Velocity" }, - { -1, 0, "" } + { -1, 0, "" }, }; static void node_shader_exec_particle_info(void *UNUSED(data), int UNUSED(thread), bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), bNodeStack **UNUSED(in), bNodeStack **UNUSED(out)) { diff --git a/source/blender/nodes/texture/nodes/node_texture_at.c b/source/blender/nodes/texture/nodes/node_texture_at.c index 2e6e7e71578..82e545cfd8e 100644 --- a/source/blender/nodes/texture/nodes/node_texture_at.c +++ b/source/blender/nodes/texture/nodes/node_texture_at.c @@ -28,11 +28,11 @@ static bNodeSocketTemplate inputs[] = { { SOCK_RGBA, 1, N_("Texture"), 0.0f, 0.0f, 0.0f, 1.0f }, { SOCK_VECTOR, 1, N_("Coordinates"), 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 1.0f, PROP_NONE }, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate outputs[] = { { SOCK_RGBA, 0, N_("Texture") }, - { -1, 0, "" } + { -1, 0, "" }, }; static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) diff --git a/source/blender/nodes/texture/nodes/node_texture_bricks.c b/source/blender/nodes/texture/nodes/node_texture_bricks.c index b9cd696fb2c..0f034de99ec 100644 --- a/source/blender/nodes/texture/nodes/node_texture_bricks.c +++ b/source/blender/nodes/texture/nodes/node_texture_bricks.c @@ -35,7 +35,7 @@ static bNodeSocketTemplate inputs[] = { { SOCK_FLOAT, 1, N_("Bias"), 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 1.0f, PROP_NONE }, { SOCK_FLOAT, 1, N_("Brick Width"), 0.5f, 0.0f, 0.0f, 0.0f, 0.001f, 99.0f, PROP_UNSIGNED }, { SOCK_FLOAT, 1, N_("Row Height"), 0.25f, 0.0f, 0.0f, 0.0f, 0.001f, 99.0f, PROP_UNSIGNED }, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate outputs[] = { { SOCK_RGBA, 0, N_("Color")}, diff --git a/source/blender/nodes/texture/nodes/node_texture_checker.c b/source/blender/nodes/texture/nodes/node_texture_checker.c index 3e647ab07f7..8cc40b7d5b0 100644 --- a/source/blender/nodes/texture/nodes/node_texture_checker.c +++ b/source/blender/nodes/texture/nodes/node_texture_checker.c @@ -30,11 +30,11 @@ static bNodeSocketTemplate inputs[] = { { SOCK_RGBA, 1, N_("Color1"), 1.0f, 0.0f, 0.0f, 1.0f }, { SOCK_RGBA, 1, N_("Color2"), 1.0f, 1.0f, 1.0f, 1.0f }, { SOCK_FLOAT, 1, N_("Size"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 100.0f, PROP_UNSIGNED }, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate outputs[] = { { SOCK_RGBA, 0, N_("Color") }, - { -1, 0, "" } + { -1, 0, "" }, }; static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) diff --git a/source/blender/nodes/texture/nodes/node_texture_compose.c b/source/blender/nodes/texture/nodes/node_texture_compose.c index c86f5eee983..767e4aee03e 100644 --- a/source/blender/nodes/texture/nodes/node_texture_compose.c +++ b/source/blender/nodes/texture/nodes/node_texture_compose.c @@ -30,11 +30,11 @@ static bNodeSocketTemplate inputs[] = { { SOCK_FLOAT, 1, N_("Green"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_UNSIGNED }, { SOCK_FLOAT, 1, N_("Blue"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_UNSIGNED }, { SOCK_FLOAT, 1, N_("Alpha"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_UNSIGNED }, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate outputs[] = { { SOCK_RGBA, 0, N_("Color") }, - { -1, 0, "" } + { -1, 0, "" }, }; static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) diff --git a/source/blender/nodes/texture/nodes/node_texture_coord.c b/source/blender/nodes/texture/nodes/node_texture_coord.c index e5b732abfc9..8859e27cd6c 100644 --- a/source/blender/nodes/texture/nodes/node_texture_coord.c +++ b/source/blender/nodes/texture/nodes/node_texture_coord.c @@ -27,7 +27,7 @@ static bNodeSocketTemplate outputs[] = { { SOCK_VECTOR, 0, N_("Coordinates") }, - { -1, 0, "" } + { -1, 0, "" }, }; static void vectorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **UNUSED(in), short UNUSED(thread)) diff --git a/source/blender/nodes/texture/nodes/node_texture_decompose.c b/source/blender/nodes/texture/nodes/node_texture_decompose.c index 7b95b6cbf52..e531eb6c816 100644 --- a/source/blender/nodes/texture/nodes/node_texture_decompose.c +++ b/source/blender/nodes/texture/nodes/node_texture_decompose.c @@ -28,14 +28,14 @@ static bNodeSocketTemplate inputs[] = { { SOCK_RGBA, 1, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f }, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate outputs[] = { { SOCK_FLOAT, 0, N_("Red") }, { SOCK_FLOAT, 0, N_("Green") }, { SOCK_FLOAT, 0, N_("Blue") }, { SOCK_FLOAT, 0, N_("Alpha") }, - { -1, 0, "" } + { -1, 0, "" }, }; static void valuefn_r(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) diff --git a/source/blender/nodes/texture/nodes/node_texture_distance.c b/source/blender/nodes/texture/nodes/node_texture_distance.c index 9e75f0bf5af..fed8fe6b866 100644 --- a/source/blender/nodes/texture/nodes/node_texture_distance.c +++ b/source/blender/nodes/texture/nodes/node_texture_distance.c @@ -30,12 +30,12 @@ static bNodeSocketTemplate inputs[] = { { SOCK_VECTOR, 1, N_("Coordinate 1"), 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 1.0f, PROP_NONE }, { SOCK_VECTOR, 1, N_("Coordinate 2"), 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 1.0f, PROP_NONE }, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate outputs[] = { { SOCK_FLOAT, 0, N_("Value") }, - { -1, 0, "" } + { -1, 0, "" }, }; static void valuefn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) diff --git a/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c b/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c index 17f86ecd006..8e4959bdf06 100644 --- a/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c +++ b/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c @@ -32,11 +32,11 @@ static bNodeSocketTemplate inputs[] = { { SOCK_FLOAT, 1, N_("Value"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f, PROP_NONE }, { SOCK_FLOAT, 1, N_("Factor"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE }, { SOCK_RGBA, 1, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f }, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate outputs[] = { { SOCK_RGBA, 0, N_("Color") }, - { -1, 0, "" } + { -1, 0, "" }, }; static void do_hue_sat_fac(bNode *UNUSED(node), float *out, float hue, float sat, float val, float *in, float fac) diff --git a/source/blender/nodes/texture/nodes/node_texture_image.c b/source/blender/nodes/texture/nodes/node_texture_image.c index 9fbbb5c7941..1975a9df306 100644 --- a/source/blender/nodes/texture/nodes/node_texture_image.c +++ b/source/blender/nodes/texture/nodes/node_texture_image.c @@ -27,7 +27,7 @@ static bNodeSocketTemplate outputs[] = { { SOCK_RGBA, 0, N_("Image")}, - { -1, 0, "" } + { -1, 0, "" }, }; static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **UNUSED(in), short UNUSED(thread)) diff --git a/source/blender/nodes/texture/nodes/node_texture_invert.c b/source/blender/nodes/texture/nodes/node_texture_invert.c index 3cd5686478e..60cc135a8d4 100644 --- a/source/blender/nodes/texture/nodes/node_texture_invert.c +++ b/source/blender/nodes/texture/nodes/node_texture_invert.c @@ -28,12 +28,12 @@ /* **************** INVERT ******************** */ static bNodeSocketTemplate inputs[] = { { SOCK_RGBA, 1, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate outputs[] = { { SOCK_RGBA, 0, N_("Color")}, - { -1, 0, "" } + { -1, 0, "" }, }; static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) diff --git a/source/blender/nodes/texture/nodes/node_texture_math.c b/source/blender/nodes/texture/nodes/node_texture_math.c index afa115ed969..45205b6eac0 100644 --- a/source/blender/nodes/texture/nodes/node_texture_math.c +++ b/source/blender/nodes/texture/nodes/node_texture_math.c @@ -30,12 +30,12 @@ static bNodeSocketTemplate inputs[] = { { SOCK_FLOAT, 1, N_("Value"), 0.5f, 0.5f, 0.5f, 1.0f, -100.0f, 100.0f, PROP_NONE}, { SOCK_FLOAT, 1, N_("Value"), 0.5f, 0.5f, 0.5f, 1.0f, -100.0f, 100.0f, PROP_NONE}, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate outputs[] = { { SOCK_FLOAT, 0, N_("Value")}, - { -1, 0, "" } + { -1, 0, "" }, }; static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) diff --git a/source/blender/nodes/texture/nodes/node_texture_mixRgb.c b/source/blender/nodes/texture/nodes/node_texture_mixRgb.c index 3734c714e3a..047e427f478 100644 --- a/source/blender/nodes/texture/nodes/node_texture_mixRgb.c +++ b/source/blender/nodes/texture/nodes/node_texture_mixRgb.c @@ -30,11 +30,11 @@ static bNodeSocketTemplate inputs[] = { { SOCK_FLOAT, 1, N_("Factor"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE }, { SOCK_RGBA, 1, N_("Color1"), 0.5f, 0.5f, 0.5f, 1.0f }, { SOCK_RGBA, 1, N_("Color2"), 0.5f, 0.5f, 0.5f, 1.0f }, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate outputs[] = { { SOCK_RGBA, 0, N_("Color") }, - { -1, 0, "" } + { -1, 0, "" }, }; static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) diff --git a/source/blender/nodes/texture/nodes/node_texture_rotate.c b/source/blender/nodes/texture/nodes/node_texture_rotate.c index 2fb63d875fc..b8dfc9cb608 100644 --- a/source/blender/nodes/texture/nodes/node_texture_rotate.c +++ b/source/blender/nodes/texture/nodes/node_texture_rotate.c @@ -31,12 +31,12 @@ static bNodeSocketTemplate inputs[] = { { SOCK_RGBA, 1, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_FLOAT, 1, N_("Turns"), 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 1.0f, PROP_NONE }, { SOCK_VECTOR, 1, N_("Axis"), 0.0f, 0.0f, 1.0f, 0.0f, -1.0f, 1.0f, PROP_DIRECTION }, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate outputs[] = { { SOCK_RGBA, 0, N_("Color")}, - { -1, 0, "" } + { -1, 0, "" }, }; static void rotate(float new_co[3], float a, float ax[3], const float co[3]) diff --git a/source/blender/nodes/texture/nodes/node_texture_scale.c b/source/blender/nodes/texture/nodes/node_texture_scale.c index f9b4d5be263..e7e255ed7ef 100644 --- a/source/blender/nodes/texture/nodes/node_texture_scale.c +++ b/source/blender/nodes/texture/nodes/node_texture_scale.c @@ -28,12 +28,12 @@ static bNodeSocketTemplate inputs[] = { { SOCK_RGBA, 1, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f }, { SOCK_VECTOR, 1, N_("Scale"), 1.0f, 1.0f, 1.0f, 0.0f, -10.0f, 10.0f, PROP_XYZ }, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate outputs[] = { { SOCK_RGBA, 0, N_("Color")}, - { -1, 0, "" } + { -1, 0, "" }, }; static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) diff --git a/source/blender/nodes/texture/nodes/node_texture_texture.c b/source/blender/nodes/texture/nodes/node_texture_texture.c index 3adea5f4c0b..791e0fab1fb 100644 --- a/source/blender/nodes/texture/nodes/node_texture_texture.c +++ b/source/blender/nodes/texture/nodes/node_texture_texture.c @@ -30,12 +30,12 @@ static bNodeSocketTemplate inputs[] = { { SOCK_RGBA, 1, N_("Color1"), 1.0f, 1.0f, 1.0f, 1.0f }, { SOCK_RGBA, 1, N_("Color2"), 0.0f, 0.0f, 0.0f, 1.0f }, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate outputs[] = { { SOCK_RGBA, 0, N_("Color") }, - { -1, 0, "" } + { -1, 0, "" }, }; static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) diff --git a/source/blender/nodes/texture/nodes/node_texture_translate.c b/source/blender/nodes/texture/nodes/node_texture_translate.c index 55a1c372a4c..d4fc045a383 100644 --- a/source/blender/nodes/texture/nodes/node_texture_translate.c +++ b/source/blender/nodes/texture/nodes/node_texture_translate.c @@ -29,12 +29,12 @@ static bNodeSocketTemplate inputs[] = { { SOCK_RGBA, 1, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_VECTOR, 1, N_("Offset"), 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f, PROP_TRANSLATION }, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate outputs[] = { { SOCK_RGBA, 0, N_("Color")}, - { -1, 0, "" } + { -1, 0, "" }, }; static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) diff --git a/source/blender/nodes/texture/nodes/node_texture_valToNor.c b/source/blender/nodes/texture/nodes/node_texture_valToNor.c index 965edf8aede..ea09b9e28ae 100644 --- a/source/blender/nodes/texture/nodes/node_texture_valToNor.c +++ b/source/blender/nodes/texture/nodes/node_texture_valToNor.c @@ -28,12 +28,12 @@ static bNodeSocketTemplate inputs[] = { { SOCK_FLOAT, 1, N_("Val"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE }, { SOCK_FLOAT, 1, N_("Nabla"), 0.025f, 0.0f, 0.0f, 0.0f, 0.001f, 0.1f, PROP_UNSIGNED }, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate outputs[] = { { SOCK_VECTOR, 0, N_("Normal") }, - { -1, 0, "" } + { -1, 0, "" }, }; static void normalfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) diff --git a/source/blender/nodes/texture/nodes/node_texture_viewer.c b/source/blender/nodes/texture/nodes/node_texture_viewer.c index 311953fcf1f..f6adc256103 100644 --- a/source/blender/nodes/texture/nodes/node_texture_viewer.c +++ b/source/blender/nodes/texture/nodes/node_texture_viewer.c @@ -28,10 +28,10 @@ static bNodeSocketTemplate inputs[] = { { SOCK_RGBA, 1, N_("Color"), 1.0f, 0.0f, 0.0f, 1.0f }, - { -1, 0, "" } + { -1, 0, "" }, }; static bNodeSocketTemplate outputs[] = { - { -1, 0, "" } + { -1, 0, "" }, }; static void exec(void *data, int UNUSED(thread), bNode *UNUSED(node), bNodeExecData *execdata, bNodeStack **in, bNodeStack **UNUSED(out)) diff --git a/source/blender/python/bmesh/CMakeLists.txt b/source/blender/python/bmesh/CMakeLists.txt index 8e92b43eb46..23ecdf4aa75 100644 --- a/source/blender/python/bmesh/CMakeLists.txt +++ b/source/blender/python/bmesh/CMakeLists.txt @@ -52,6 +52,9 @@ set(SRC ) set(LIB + bf_blenkernel + bf_blenlib + bf_python_mathutils ) if(WITH_FREESTYLE) diff --git a/source/blender/python/bmesh/bmesh_py_ops.c b/source/blender/python/bmesh/bmesh_py_ops.c index f35bfb730ad..fe82f22ec8c 100644 --- a/source/blender/python/bmesh/bmesh_py_ops.c +++ b/source/blender/python/bmesh/bmesh_py_ops.c @@ -312,8 +312,8 @@ static PyTypeObject bmesh_ops_fakemod_Type = { NULL, /* inquiry tp_clear; */ /*** Assigned meaning in release 2.1 ***/ - /*** rich comparisons ***/ - NULL, /* subclassed */ /* richcmpfunc tp_richcompare; */ + /*** rich comparisons (subclassed) ***/ + NULL, /* richcmpfunc tp_richcompare; */ /*** weak reference enabler ***/ 0, diff --git a/source/blender/python/bmesh/bmesh_py_types.h b/source/blender/python/bmesh/bmesh_py_types.h index deabbef1b7b..80646b7eb16 100644 --- a/source/blender/python/bmesh/bmesh_py_types.h +++ b/source/blender/python/bmesh/bmesh_py_types.h @@ -134,8 +134,8 @@ void BPy_BM_init_types(void); PyObject *BPyInit_bmesh_types(void); enum { - BPY_BMFLAG_NOP = 0, /* do nothing */ - BPY_BMFLAG_IS_WRAPPED = 1 /* the mesh is owned by editmode */ + BPY_BMFLAG_NOP = 0, /* do nothing */ + BPY_BMFLAG_IS_WRAPPED = 1, /* the mesh is owned by editmode */ }; PyObject *BPy_BMesh_CreatePyObject(BMesh *bm, int flag); diff --git a/source/blender/python/generic/CMakeLists.txt b/source/blender/python/generic/CMakeLists.txt index 3ebd90e5b42..ea766d9f8d1 100644 --- a/source/blender/python/generic/CMakeLists.txt +++ b/source/blender/python/generic/CMakeLists.txt @@ -51,6 +51,7 @@ set(SRC ) set(LIB + ${GLEW_LIBRARY} ) add_definitions(${GL_DEFINITIONS}) diff --git a/source/blender/python/generic/bgl.c b/source/blender/python/generic/bgl.c index b52326ed7a4..c089a2d03c2 100644 --- a/source/blender/python/generic/bgl.c +++ b/source/blender/python/generic/bgl.c @@ -664,7 +664,7 @@ PyTypeObject BGL_bufferType = { NULL, /*tp_cache*/ NULL, /*tp_subclasses*/ NULL, /*tp_weaklist*/ - NULL /*tp_del*/ + NULL, /*tp_del*/ }; diff --git a/source/blender/python/intern/CMakeLists.txt b/source/blender/python/intern/CMakeLists.txt index d517d6a9529..95f3edb8045 100644 --- a/source/blender/python/intern/CMakeLists.txt +++ b/source/blender/python/intern/CMakeLists.txt @@ -33,7 +33,6 @@ set(INC ../../../../intern/clog ../../../../intern/guardedalloc ../../../../intern/opencolorio - ../../../../intern/cycles/blender ) set(INC_SYS @@ -118,6 +117,10 @@ set(SRC ) set(LIB + bf_editor_animation + bf_editor_interface + bf_editor_space_api + bf_python_gpu ) # only to check if buildinfo is available @@ -163,6 +166,12 @@ if(WITH_COMPOSITOR) endif() if(WITH_CYCLES) + list(APPEND INC + ../../../../intern/cycles/blender + ) + list(APPEND LIB + bf_intern_cycles + ) add_definitions(-DWITH_CYCLES) endif() diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index e07e39642e9..61ddf46d896 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -57,7 +57,9 @@ #include "BKE_main.h" #include "BKE_text.h" -#include "CCL_api.h" +#ifdef WITH_CYCLES +# include "CCL_api.h" +#endif #include "BPY_extern.h" diff --git a/source/blender/python/intern/bpy_library_load.c b/source/blender/python/intern/bpy_library_load.c index 77fb6bf1525..3a4c70c1873 100644 --- a/source/blender/python/intern/bpy_library_load.c +++ b/source/blender/python/intern/bpy_library_load.c @@ -131,8 +131,8 @@ static PyTypeObject bpy_lib_Type = { NULL, /* inquiry tp_clear; */ /*** Assigned meaning in release 2.1 ***/ - /*** rich comparisons ***/ - NULL, /* subclassed */ /* richcmpfunc tp_richcompare; */ + /*** rich comparisons (subclassed) ***/ + NULL, /* richcmpfunc tp_richcompare; */ /*** weak reference enabler ***/ 0, diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index d9052aafae8..71d46de1be8 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -6337,8 +6337,8 @@ PyTypeObject pyrna_prop_array_Type = { NULL, /* inquiry tp_clear; */ /*** Assigned meaning in release 2.1 ***/ - /*** rich comparisons ***/ - NULL, /* subclassed */ /* richcmpfunc tp_richcompare; */ + /*** rich comparisons (subclassed) ***/ + NULL, /* richcmpfunc tp_richcompare; */ /*** weak reference enabler ***/ #ifdef USE_WEAKREFS @@ -6420,8 +6420,8 @@ PyTypeObject pyrna_prop_collection_Type = { NULL, /* inquiry tp_clear; */ /*** Assigned meaning in release 2.1 ***/ - /*** rich comparisons ***/ - NULL, /* subclassed */ /* richcmpfunc tp_richcompare; */ + /*** rich comparisons (subclassed) ***/ + NULL, /* richcmpfunc tp_richcompare; */ /*** weak reference enabler ***/ #ifdef USE_WEAKREFS @@ -6505,8 +6505,8 @@ static PyTypeObject pyrna_prop_collection_idprop_Type = { NULL, /* inquiry tp_clear; */ /*** Assigned meaning in release 2.1 ***/ - /*** rich comparisons ***/ - NULL, /* subclassed */ /* richcmpfunc tp_richcompare; */ + /*** rich comparisons (subclassed) ***/ + NULL, /* richcmpfunc tp_richcompare; */ /*** weak reference enabler ***/ #ifdef USE_WEAKREFS @@ -6690,8 +6690,8 @@ static PyTypeObject pyrna_prop_collection_iter_Type = { NULL, /* inquiry tp_clear; */ /*** Assigned meaning in release 2.1 ***/ - /*** rich comparisons ***/ - NULL, /* subclassed */ /* richcmpfunc tp_richcompare; */ + /*** rich comparisons (subclassed) ***/ + NULL, /* richcmpfunc tp_richcompare; */ /*** weak reference enabler ***/ #ifdef USE_WEAKREFS diff --git a/source/blender/python/mathutils/CMakeLists.txt b/source/blender/python/mathutils/CMakeLists.txt index b973875977a..7b0c042d50a 100644 --- a/source/blender/python/mathutils/CMakeLists.txt +++ b/source/blender/python/mathutils/CMakeLists.txt @@ -56,6 +56,8 @@ set(SRC ) set(LIB + bf_blenlib + bf_python_ext ) diff --git a/source/blender/python/mathutils/mathutils_Color.c b/source/blender/python/mathutils/mathutils_Color.c index c97d2720720..98e85782989 100644 --- a/source/blender/python/mathutils/mathutils_Color.c +++ b/source/blender/python/mathutils/mathutils_Color.c @@ -932,7 +932,7 @@ PyTypeObject color_Type = { NULL, /* tp_cache */ NULL, /* tp_subclasses */ NULL, /* tp_weaklist */ - NULL /* tp_del */ + NULL, /* tp_del */ }; PyObject *Color_CreatePyObject( diff --git a/source/blender/python/mathutils/mathutils_Euler.c b/source/blender/python/mathutils/mathutils_Euler.c index e928049644b..4177fc489bb 100644 --- a/source/blender/python/mathutils/mathutils_Euler.c +++ b/source/blender/python/mathutils/mathutils_Euler.c @@ -784,7 +784,7 @@ PyTypeObject euler_Type = { NULL, /* tp_cache */ NULL, /* tp_subclasses */ NULL, /* tp_weaklist */ - NULL /* tp_del */ + NULL, /* tp_del */ }; diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c index 6477493d4a6..724fcd263d4 100644 --- a/source/blender/python/mathutils/mathutils_Matrix.c +++ b/source/blender/python/mathutils/mathutils_Matrix.c @@ -36,7 +36,7 @@ typedef enum eMatrixAccess_t { MAT_ACCESS_ROW, - MAT_ACCESS_COL + MAT_ACCESS_COL, } eMatrixAccess_t; static PyObject *Matrix_copy_notest(MatrixObject *self, const float *matrix); @@ -3078,7 +3078,7 @@ PyTypeObject matrix_Type = { NULL, /*tp_cache*/ NULL, /*tp_subclasses*/ NULL, /*tp_weaklist*/ - NULL /*tp_del*/ + NULL, /*tp_del*/ }; PyObject *Matrix_CreatePyObject( diff --git a/source/blender/python/mathutils/mathutils_bvhtree.c b/source/blender/python/mathutils/mathutils_bvhtree.c index b99b39ac998..b1420f316e6 100644 --- a/source/blender/python/mathutils/mathutils_bvhtree.c +++ b/source/blender/python/mathutils/mathutils_bvhtree.c @@ -1295,7 +1295,7 @@ PyTypeObject PyBVHTree_Type = { NULL, /* tp_cache */ NULL, /* tp_subclasses */ NULL, /* tp_weaklist */ - (destructor) NULL /* tp_del */ + (destructor)NULL, /* tp_del */ }; /* -------------------------------------------------------------------- */ @@ -1313,7 +1313,7 @@ static struct PyModuleDef bvhtree_moduledef = { NULL, /* m_reload */ NULL, /* m_traverse */ NULL, /* m_clear */ - NULL /* m_free */ + NULL, /* m_free */ }; PyMODINIT_FUNC PyInit_mathutils_bvhtree(void) diff --git a/source/blender/python/mathutils/mathutils_kdtree.c b/source/blender/python/mathutils/mathutils_kdtree.c index 7228ac41bd6..b1cda85f6ea 100644 --- a/source/blender/python/mathutils/mathutils_kdtree.c +++ b/source/blender/python/mathutils/mathutils_kdtree.c @@ -453,7 +453,7 @@ PyTypeObject PyKDTree_Type = { NULL, /* tp_cache */ NULL, /* tp_subclasses */ NULL, /* tp_weaklist */ - (destructor) NULL /* tp_del */ + (destructor)NULL, /* tp_del */ }; PyDoc_STRVAR(py_kdtree_doc, @@ -468,7 +468,7 @@ static struct PyModuleDef kdtree_moduledef = { NULL, /* m_reload */ NULL, /* m_traverse */ NULL, /* m_clear */ - NULL /* m_free */ + NULL, /* m_free */ }; PyMODINIT_FUNC PyInit_mathutils_kdtree(void) diff --git a/source/blender/render/CMakeLists.txt b/source/blender/render/CMakeLists.txt index 96c8b9c860b..d6bbbbd3061 100644 --- a/source/blender/render/CMakeLists.txt +++ b/source/blender/render/CMakeLists.txt @@ -80,6 +80,9 @@ if(WITH_PYTHON) endif() if(WITH_IMAGE_OPENEXR) + list(APPEND LIB + bf_imbuf_openexr + ) add_definitions(-DWITH_OPENEXR) endif() @@ -91,6 +94,9 @@ if(WITH_FREESTYLE) list(APPEND INC ../freestyle ) + list(APPEND LIB + bf_freestyle + ) add_definitions(-DWITH_FREESTYLE) endif() diff --git a/source/blender/windowmanager/CMakeLists.txt b/source/blender/windowmanager/CMakeLists.txt index 3f4f18005ef..63253c3737b 100644 --- a/source/blender/windowmanager/CMakeLists.txt +++ b/source/blender/windowmanager/CMakeLists.txt @@ -107,6 +107,7 @@ set(SRC ) set(LIB + bf_editor_screen ) if(WITH_AUDASPACE) @@ -166,6 +167,9 @@ if(WIN32) endif() if(WITH_COMPOSITOR) + list(APPEND LIB + bf_compositor + ) add_definitions(-DWITH_COMPOSITOR) endif() diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index 38fb27d2538..0ee5ffaa267 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -377,8 +377,8 @@ void WM_operator_properties_gesture_straightline(struct wmOperatorType *o void WM_operator_properties_gesture_circle(struct wmOperatorType *ot); void WM_operator_properties_mouse_select(struct wmOperatorType *ot); void WM_operator_properties_select_all(struct wmOperatorType *ot); -void WM_operator_properties_select_action(struct wmOperatorType *ot, int default_action); -void WM_operator_properties_select_action_simple(struct wmOperatorType *ot, int default_action); +void WM_operator_properties_select_action(struct wmOperatorType *ot, int default_action, bool hide_gui); +void WM_operator_properties_select_action_simple(struct wmOperatorType *ot, int default_action, bool hide_gui); void WM_operator_properties_select_random(struct wmOperatorType *ot); int WM_operator_properties_select_random_seed_increment_get(wmOperator *op); void WM_operator_properties_select_operation(struct wmOperatorType *ot); diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h index 9e18a655903..0dfa24b8cda 100644 --- a/source/blender/windowmanager/WM_types.h +++ b/source/blender/windowmanager/WM_types.h @@ -517,7 +517,7 @@ typedef enum { /* motion progress, for modal handlers */ P_STARTING, /* <-- */ P_IN_PROGRESS, /* <-- only these are sent for NDOF motion*/ P_FINISHING, /* <-- */ - P_FINISHED + P_FINISHED, } wmProgress; #ifdef WITH_INPUT_NDOF diff --git a/source/blender/windowmanager/intern/wm_operator_props.c b/source/blender/windowmanager/intern/wm_operator_props.c index 0e4d8a7bf71..55b45adbe2d 100644 --- a/source/blender/windowmanager/intern/wm_operator_props.c +++ b/source/blender/windowmanager/intern/wm_operator_props.c @@ -140,14 +140,18 @@ void WM_operator_properties_filesel( } static void wm_operator_properties_select_action_ex(wmOperatorType *ot, int default_action, - const EnumPropertyItem *select_actions) + const EnumPropertyItem *select_actions, + bool hide_gui) { PropertyRNA *prop; prop = RNA_def_enum(ot->srna, "action", select_actions, default_action, "Action", "Selection action to execute"); - RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); + + if (hide_gui) { + RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); + } } -void WM_operator_properties_select_action(wmOperatorType *ot, int default_action) +void WM_operator_properties_select_action(wmOperatorType *ot, int default_action, bool hide_gui) { static const EnumPropertyItem select_actions[] = { {SEL_TOGGLE, "TOGGLE", 0, "Toggle", "Toggle selection for all elements"}, @@ -157,13 +161,13 @@ void WM_operator_properties_select_action(wmOperatorType *ot, int default_action {0, NULL, 0, NULL, NULL}, }; - wm_operator_properties_select_action_ex(ot, default_action, select_actions); + wm_operator_properties_select_action_ex(ot, default_action, select_actions, hide_gui); } /** * only SELECT/DESELECT */ -void WM_operator_properties_select_action_simple(wmOperatorType *ot, int default_action) +void WM_operator_properties_select_action_simple(wmOperatorType *ot, int default_action, bool hide_gui) { static const EnumPropertyItem select_actions[] = { {SEL_SELECT, "SELECT", 0, "Select", "Select all elements"}, @@ -171,7 +175,7 @@ void WM_operator_properties_select_action_simple(wmOperatorType *ot, int default {0, NULL, 0, NULL, NULL}, }; - wm_operator_properties_select_action_ex(ot, default_action, select_actions); + wm_operator_properties_select_action_ex(ot, default_action, select_actions, hide_gui); } /** @@ -187,7 +191,7 @@ void WM_operator_properties_select_random(wmOperatorType *ot) ot->srna, "seed", 0, 0, INT_MAX, "Random Seed", "Seed for the random number generator", 0, 255); - WM_operator_properties_select_action_simple(ot, SEL_SELECT); + WM_operator_properties_select_action_simple(ot, SEL_SELECT, false); } int WM_operator_properties_select_random_seed_increment_get(wmOperator *op) @@ -206,7 +210,7 @@ int WM_operator_properties_select_random_seed_increment_get(wmOperator *op) void WM_operator_properties_select_all(wmOperatorType *ot) { - WM_operator_properties_select_action(ot, SEL_TOGGLE); + WM_operator_properties_select_action(ot, SEL_TOGGLE, true); } void WM_operator_properties_border(wmOperatorType *ot) diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index a1dc822dc97..7994947d943 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -1109,7 +1109,7 @@ typedef enum { SHIFT = 's', CONTROL = 'c', ALT = 'a', - OS = 'C' + OS = 'C', } modifierKeyType; /* check if specified modifier key type is pressed */ diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index 5d1dc92d1e1..0c2cc15c660 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -39,6 +39,22 @@ blender_include_dirs( ) set(LIB + bf_blenfont + bf_blenkernel + bf_blenlib + bf_blenloader + bf_depsgraph + bf_dna + bf_editor_datafiles + bf_imbuf + bf_intern_clog + bf_intern_guardedalloc + bf_intern_memutil + bf_intern_opencolorio + bf_python + bf_render + bf_rna + bf_windowmanager ) add_definitions(${GL_DEFINITIONS}) @@ -53,9 +69,14 @@ if(WITH_LIBMV) add_definitions(-DWITH_LIBMV) endif() -if(WITH_CYCLES AND WITH_CYCLES_LOGGING) - blender_include_dirs(../../intern/cycles/blender) - add_definitions(-DWITH_CYCLES_LOGGING) +if(WITH_CYCLES) + if(WITH_CYCLES_LOGGING) + blender_include_dirs(../../intern/cycles/blender) + add_definitions(-DWITH_CYCLES_LOGGING) + endif() + list(APPEND LIB + bf_intern_cycles + ) endif() if(WITH_CODEC_FFMPEG) @@ -77,20 +98,26 @@ endif() if(WITH_SDL) if(WITH_SDL_DYNLOAD) - add_definitions(-DWITH_SDL_DYNLOAD) blender_include_dirs(../../extern/sdlew/include) + add_definitions(-DWITH_SDL_DYNLOAD) endif() add_definitions(-DWITH_SDL) endif() if(WITH_BINRELOC) - add_definitions(-DWITH_BINRELOC) blender_include_dirs(${BINRELOC_INCLUDE_DIRS}) + list(APPEND LIB + extern_binreloc + ) + add_definitions(-DWITH_BINRELOC) endif() if(WITH_FREESTYLE) - add_definitions(-DWITH_FREESTYLE) blender_include_dirs(../blender/freestyle) + list(APPEND LIB + bf_freestyle + ) + add_definitions(-DWITH_FREESTYLE) endif() # Setup the exe sources and buildinfo @@ -1025,19 +1052,11 @@ install( # Setup link libs add_dependencies(blender makesdna) - -# Use for testing 'BLENDER_SORTED_LIBS' removal. -if(NOT (DEFINED WITHOUT_SORTED_LIBS AND WITHOUT_SORTED_LIBS)) - setup_blender_sorted_libs() - target_link_libraries(blender ${BLENDER_SORTED_LIBS}) -else() - target_link_libraries(blender ${LIB}) -endif() - +target_link_libraries(blender ${LIB}) +unset(LIB) setup_liblinks(blender) -unset(LIB) # ----------------------------------------------------------------------------- # Setup launcher diff --git a/tests/gtests/alembic/CMakeLists.txt b/tests/gtests/alembic/CMakeLists.txt index bf1577ff33a..d401f57eff8 100644 --- a/tests/gtests/alembic/CMakeLists.txt +++ b/tests/gtests/alembic/CMakeLists.txt @@ -32,6 +32,11 @@ set(INC ${OPENEXR_INCLUDE_DIRS} ) +set(LIB + bf_blenloader # Should not be needed but gives linking error without it. + bf_alembic +) + include_directories(${INC}) setup_libdirs() @@ -44,7 +49,7 @@ else() endif() # For motivation on doubling BLENDER_SORTED_LIBS, see ../bmesh/CMakeLists.txt -BLENDER_SRC_GTEST(alembic "abc_matrix_test.cc;abc_export_test.cc;${_buildinfo_src}" "${BLENDER_SORTED_LIBS};${BLENDER_SORTED_LIBS}") +BLENDER_SRC_GTEST(alembic "abc_matrix_test.cc;abc_export_test.cc;${_buildinfo_src}" "${LIB}") unset(_buildinfo_src) diff --git a/tests/gtests/blenlib/BLI_ressource_strings.h b/tests/gtests/blenlib/BLI_ressource_strings.h index 819cf893575..da28a05d7ea 100644 --- a/tests/gtests/blenlib/BLI_ressource_strings.h +++ b/tests/gtests/blenlib/BLI_ressource_strings.h @@ -3,6 +3,9 @@ #ifndef __BLENDER_TESTING_BLI_RESSOURCE_STRING_H__ #define __BLENDER_TESTING_BLI_RESSOURCE_STRING_H__ +/* Data file, don't format. */ +/* clang-format off */ + const char words10k[] = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam auctor ultrices purus tincidunt mollis. Vestibulum " "tincidunt imperdiet molestie. Vivamus posuere, risus ut mollis rutrum, lacus nulla mollis velit, consectetur auctor " @@ -602,4 +605,6 @@ const char words10k[] = #endif ; +/* clang-format on */ + #endif /* __BLENDER_TESTING_BLI_RESSOURCE_STRING_H__ */ diff --git a/tests/gtests/blenlib/BLI_string_utf8_test.cc b/tests/gtests/blenlib/BLI_string_utf8_test.cc index 89483d3d440..0dbe36158c5 100644 --- a/tests/gtests/blenlib/BLI_string_utf8_test.cc +++ b/tests/gtests/blenlib/BLI_string_utf8_test.cc @@ -35,6 +35,9 @@ int mk_wcswidth(const wchar_t *pwcs, size_t n) /* -------------------------------------------------------------------- */ /* tests */ +/* Breaking strings is confusing here, prefer over-long lines. */ +/* clang-format off */ + /* Each test is made of a 79 bytes (80 with NULL char) string to test, expected string result after * stripping invalid utf8 bytes, and a single-byte string encoded with expected number of errors. * @@ -283,6 +286,7 @@ const char *utf8_invalid_tests[][3] = { // 5.3.4 U+nFFFE U+nFFFF (for n = 1..10) {NULL, NULL, NULL}, }; +/* clang-format on */ /* BLI_utf8_invalid_strip (and indirectly, BLI_utf8_invalid_byte). */ TEST(string, Utf8InvalidBytes) diff --git a/tests/gtests/bmesh/CMakeLists.txt b/tests/gtests/bmesh/CMakeLists.txt index 6bd2be1ad83..10484751ca3 100644 --- a/tests/gtests/bmesh/CMakeLists.txt +++ b/tests/gtests/bmesh/CMakeLists.txt @@ -27,21 +27,21 @@ set(INC ../../../intern/guardedalloc ) +set(LIB + bf_blenloader # Should not be needed but gives linking error without it. + bf_bmesh +) + include_directories(${INC}) setup_libdirs() -get_property(BLENDER_SORTED_LIBS GLOBAL PROPERTY BLENDER_SORTED_LIBS_PROP) - -# Current BLENDER_SORTED_LIBS works with starting list of symbols in creator, but not -# for this test. Doubling the list does let all the symbols be resolved, but link time is a bit painful. -set(BLENDER_SORTED_LIBS ${BLENDER_SORTED_LIBS} ${BLENDER_SORTED_LIBS}) if(WITH_BUILDINFO) set(_buildinfo_src "$<TARGET_OBJECTS:buildinfoobj>") else() set(_buildinfo_src "") endif() -BLENDER_SRC_GTEST(bmesh_core "bmesh_core_test.cc;${_buildinfo_src}" "${BLENDER_SORTED_LIBS}") +BLENDER_SRC_GTEST(bmesh_core "bmesh_core_test.cc;${_buildinfo_src}" "${LIB}") unset(_buildinfo_src) setup_liblinks(bmesh_core_test) |