Eevee-Next: World Reflective Light #108149

Merged
Jeroen Bakker merged 33 commits from Jeroen-Bakker/blender:eevee-next-world-shader into main 2023-06-29 15:25:04 +02:00
180 changed files with 1963 additions and 1293 deletions
Showing only changes of commit da74608a1b - Show all commits

View File

@ -47,17 +47,17 @@ macro(BLENDER_SRC_GTEST_EX)
target_compile_definitions(${TARGET_NAME} PRIVATE ${GLOG_DEFINES})
target_include_directories(${TARGET_NAME} PUBLIC "${TEST_INC}")
target_include_directories(${TARGET_NAME} SYSTEM PUBLIC "${TEST_INC_SYS}")
target_link_libraries(${TARGET_NAME} ${ARG_EXTRA_LIBS} ${PLATFORM_LINKLIBS})
blender_link_libraries(${TARGET_NAME} "${ARG_EXTRA_LIBS};${PLATFORM_LINKLIBS}")
if(WITH_TBB)
# Force TBB libraries to be in front of MKL (part of OpenImageDenoise), so
# that it is initialized before MKL and static library initialization order
# issues are avoided.
target_link_libraries(${TARGET_NAME} ${TBB_LIBRARIES})
target_link_libraries(${TARGET_NAME} PRIVATE ${TBB_LIBRARIES})
if(WITH_OPENIMAGEDENOISE)
target_link_libraries(${TARGET_NAME} ${OPENIMAGEDENOISE_LIBRARIES})
target_link_libraries(${TARGET_NAME} PRIVATE ${OPENIMAGEDENOISE_LIBRARIES})
endif()
endif()
target_link_libraries(${TARGET_NAME}
target_link_libraries(${TARGET_NAME} PRIVATE
bf_testing_main
bf_intern_eigen
bf_intern_guardedalloc
@ -68,16 +68,16 @@ macro(BLENDER_SRC_GTEST_EX)
${GLOG_LIBRARIES}
${GFLAGS_LIBRARIES})
if(WITH_OPENMP_STATIC)
target_link_libraries(${TARGET_NAME} ${OpenMP_LIBRARIES})
target_link_libraries(${TARGET_NAME} PRIVATE ${OpenMP_LIBRARIES})
endif()
if(UNIX AND NOT APPLE)
target_link_libraries(${TARGET_NAME} bf_intern_libc_compat)
target_link_libraries(${TARGET_NAME} PRIVATE bf_intern_libc_compat)
endif()
if(WITH_TBB)
target_link_libraries(${TARGET_NAME} ${TBB_LIBRARIES})
target_link_libraries(${TARGET_NAME} PRIVATE ${TBB_LIBRARIES})
endif()
if(WITH_GMP)
target_link_libraries(${TARGET_NAME} ${GMP_LIBRARIES})
target_link_libraries(${TARGET_NAME} PRIVATE ${GMP_LIBRARIES})
endif()
GET_BLENDER_TEST_INSTALL_DIR(TEST_INSTALL_DIR)
@ -109,25 +109,3 @@ macro(BLENDER_SRC_GTEST_EX)
unset(TARGET_NAME)
endif()
endmacro()
macro(BLENDER_SRC_GTEST NAME SRC EXTRA_LIBS)
BLENDER_SRC_GTEST_EX(
NAME "${NAME}"
SRC "${SRC}"
EXTRA_LIBS "${EXTRA_LIBS}")
endmacro()
macro(BLENDER_TEST NAME EXTRA_LIBS)
BLENDER_SRC_GTEST_EX(
NAME "${NAME}"
SRC "${NAME}_test.cc"
EXTRA_LIBS "${EXTRA_LIBS}")
endmacro()
macro(BLENDER_TEST_PERFORMANCE NAME EXTRA_LIBS)
BLENDER_SRC_GTEST_EX(
NAME "${NAME}"
SRC "${NAME}_test.cc"
EXTRA_LIBS "${EXTRA_LIBS}"
SKIP_ADD_TEST)
endmacro()

View File

@ -25,11 +25,9 @@ CHECKER_IGNORE_PREFIX = [
"extern",
]
# To add files use a relative path.
CHECKER_EXCLUDE_SOURCE_FILES = set(os.path.join(*f.split("/")) for f in (
# These files hang (taking longer than 5min with v2.8.2 at time of writing).
# All other files process in under around 10seconds.
"source/blender/editors/space_text/text_format_pov.c",
"source/blender/editors/space_text/text_format_pov_ini.c",
# "source/blender/example.c",
))
CHECKER_ARGS = [

View File

@ -159,31 +159,60 @@ function(absolute_include_dirs
set(_ALL_INCS "")
foreach(_INC ${ARGN})
get_filename_component(_ABS_INC ${_INC} ABSOLUTE)
list(APPEND _ALL_INCS ${_ABS_INC})
# for checking for invalid includes, disable for regular use
# if(NOT EXISTS "${_ABS_INC}/")
# message(FATAL_ERROR "Include not found: ${_ABS_INC}/")
# endif()
# Pass any scoping keywords as is
if(("${_INC}" STREQUAL "PUBLIC") OR
("${_INC}" STREQUAL "PRIVATE") OR
("${_INC}" STREQUAL "INTERFACE"))
list(APPEND _ALL_INCS ${_INC})
else()
get_filename_component(_ABS_INC ${_INC} ABSOLUTE)
list(APPEND _ALL_INCS ${_ABS_INC})
# for checking for invalid includes, disable for regular use
# if(NOT EXISTS "${_ABS_INC}/")
# message(FATAL_ERROR "Include not found: ${_ABS_INC}/")
# endif()
endif()
endforeach()
set(${includes_absolute} ${_ALL_INCS} PARENT_SCOPE)
endfunction()
function(blender_target_include_dirs
name
function(blender_target_include_dirs_impl
target
system
includes
)
set(next_interface_mode "PRIVATE")
foreach(_INC ${includes})
if(("${_INC}" STREQUAL "PUBLIC") OR
("${_INC}" STREQUAL "PRIVATE") OR
("${_INC}" STREQUAL "INTERFACE"))
set(next_interface_mode "${_INC}")
else()
if(system)
target_include_directories(${target} SYSTEM ${next_interface_mode} ${_INC})
else()
target_include_directories(${target} ${next_interface_mode} ${_INC})
endif()
set(next_interface_mode "PRIVATE")
endif()
endforeach()
endfunction()
# Nicer makefiles with -I/1/foo/ instead of -I/1/2/3/../../foo/
# use it instead of target_include_directories()
function(blender_target_include_dirs
target
)
absolute_include_dirs(_ALL_INCS ${ARGN})
target_include_directories(${name} PRIVATE ${_ALL_INCS})
blender_target_include_dirs_impl(${target} FALSE "${_ALL_INCS}")
endfunction()
function(blender_target_include_dirs_sys
name
target
)
absolute_include_dirs(_ALL_INCS ${ARGN})
target_include_directories(${name} SYSTEM PRIVATE ${_ALL_INCS})
blender_target_include_dirs_impl(${target} TRUE "${_ALL_INCS}")
endfunction()
# Set include paths for header files included with "*.h" syntax.
@ -277,23 +306,11 @@ macro(add_cc_flags_custom_test
endmacro()
# only MSVC uses SOURCE_GROUP
function(blender_add_lib__impl
name
sources
includes
includes_sys
function(blender_link_libraries
target
library_deps
)
# message(STATUS "Configuring library ${name}")
add_library(${name} ${sources})
blender_target_include_dirs(${name} ${includes})
blender_target_include_dirs_sys(${name} ${includes_sys})
# On Windows certain libraries have two sets of binaries: one for debug builds and one for
# release builds. The root of this requirement goes into ABI, I believe, but that's outside
# of a scope of this comment.
@ -331,23 +348,49 @@ function(blender_add_lib__impl
# NOT: "optimized libfoo libbar debug libfoo_d libbar_d"
if(NOT "${library_deps}" STREQUAL "")
set(next_library_mode "")
set(next_interface_mode "PRIVATE")
foreach(library ${library_deps})
string(TOLOWER "${library}" library_lower)
if(("${library_lower}" STREQUAL "optimized") OR
("${library_lower}" STREQUAL "debug"))
set(next_library_mode "${library_lower}")
elseif(("${library}" STREQUAL "PUBLIC") OR
("${library}" STREQUAL "PRIVATE") OR
("${library}" STREQUAL "INTERFACE"))
set(next_interface_mode "${library}")
else()
if("${next_library_mode}" STREQUAL "optimized")
target_link_libraries(${name} INTERFACE optimized ${library})
target_link_libraries(${target} ${next_interface_mode} optimized ${library})
elseif("${next_library_mode}" STREQUAL "debug")
target_link_libraries(${name} INTERFACE debug ${library})
target_link_libraries(${target} ${next_interface_mode} debug ${library})
else()
target_link_libraries(${name} INTERFACE ${library})
target_link_libraries(${target} ${next_interface_mode} ${library})
endif()
set(next_library_mode "")
endif()
endforeach()
endif()
endfunction()
# only MSVC uses SOURCE_GROUP
function(blender_add_lib__impl
name
sources
includes
includes_sys
library_deps
)
# message(STATUS "Configuring library ${name}")
add_library(${name} ${sources})
blender_target_include_dirs(${name} ${includes})
blender_target_include_dirs_sys(${name} ${includes_sys})
if(library_deps)
blender_link_libraries(${name} "${library_deps}")
endif()
# works fine without having the includes
# listed is helpful for IDE's (QtCreator/MSVC)
@ -477,8 +520,9 @@ endfunction()
# To be used for smaller isolated libraries, that do not have many dependencies.
# For libraries that do drag in many other Blender libraries and would create a
# very large executable, blender_add_test_lib() should be used instead.
function(blender_add_test_executable
function(blender_add_test_executable_impl
name
add_test_suite
sources
includes
includes_sys
@ -496,14 +540,48 @@ function(blender_add_test_executable
EXTRA_LIBS "${library_deps}"
SKIP_ADD_TEST
)
if(add_test_suite)
blender_add_test_suite(
TARGET ${name}_test
SUITE_NAME ${name}
SOURCES "${sources}"
)
endif()
blender_target_include_dirs(${name}_test ${includes})
blender_target_include_dirs_sys(${name}_test ${includes_sys})
endfunction()
blender_add_test_suite(
TARGET ${name}_test
SUITE_NAME ${name}
SOURCES "${sources}"
function(blender_add_test_executable
name
sources
includes
includes_sys
library_deps
)
blender_add_test_executable_impl(
"${name}"
TRUE
"${sources}"
"${includes}"
"${includes_sys}"
"${library_deps}"
)
endfunction()
function(blender_add_performancetest_executable
name
sources
includes
includes_sys
library_deps
)
blender_add_test_executable_impl(
"${name}"
FALSE
"${sources}"
"${includes}"
"${includes_sys}"
"${library_deps}"
)
endfunction()
@ -547,17 +625,17 @@ function(setup_platform_linker_libs
)
# jemalloc must be early in the list, to be before pthread (see #57998).
if(WITH_MEM_JEMALLOC)
target_link_libraries(${target} ${JEMALLOC_LIBRARIES})
target_link_libraries(${target} PRIVATE ${JEMALLOC_LIBRARIES})
endif()
if(WIN32 AND NOT UNIX)
if(DEFINED PTHREADS_LIBRARIES)
target_link_libraries(${target} ${PTHREADS_LIBRARIES})
target_link_libraries(${target} PRIVATE ${PTHREADS_LIBRARIES})
endif()
endif()
# target_link_libraries(${target} ${PLATFORM_LINKLIBS} ${CMAKE_DL_LIBS})
target_link_libraries(${target} ${PLATFORM_LINKLIBS})
target_link_libraries(${target} PRIVATE ${PLATFORM_LINKLIBS})
endfunction()
macro(TEST_SSE_SUPPORT

View File

@ -9,6 +9,25 @@ set(INC
set(INC_SYS
)
add_library(bf_intern_atomic INTERFACE)
target_include_directories(bf_intern_atomic INTERFACE .)
# CMake 3.19+ allows one to populate the interface library with
# source files to show in the IDE, for people on older CMake versions
# these headers will be visible in the bf_intern_guardedalloc project
# where they historically have been.
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.19")
set(SRC
atomic_ops.h
intern/atomic_ops_ext.h
intern/atomic_ops_msvc.h
intern/atomic_ops_unix.h
intern/atomic_ops_utils.h
)
target_sources(bf_intern_atomic PRIVATE ${SRC})
blender_source_group(bf_intern_atomic ${SRC})
endif()
if(WITH_GTESTS)
set(TEST_SRC
tests/atomic_test.cc
@ -16,6 +35,7 @@ if(WITH_GTESTS)
set(TEST_INC
)
set(TEST_LIB
PRIVATE bf_intern_atomic
)
include(GTestTesting)
blender_add_test_executable(atomic "${TEST_SRC}" "${INC};${TEST_INC}" "${INC_SYS}" "${LIB};${TEST_LIB}")

View File

@ -55,5 +55,6 @@ if(NOT APPLE)
endif()
if(WITH_GTESTS AND WITH_CYCLES_LOGGING)
blender_src_gtest(cycles "${SRC}" "${LIB}")
set(INC_SYS )
blender_add_test_executable(cycles "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
endif()

View File

@ -238,7 +238,7 @@ extern bool GHOST_ValidWindow(GHOST_SystemHandle systemhandle, GHOST_WindowHandl
* This window is invalid after full screen has been ended.
*/
extern GHOST_WindowHandle GHOST_BeginFullScreen(GHOST_SystemHandle systemhandle,
GHOST_DisplaySetting *setting,
const GHOST_DisplaySetting *setting,
const bool stereoVisual);
/**
@ -429,7 +429,7 @@ void GHOST_GetCursorGrabState(GHOST_WindowHandle windowhandle,
extern GHOST_TSuccess GHOST_SetCursorGrab(GHOST_WindowHandle windowhandle,
GHOST_TGrabCursorMode mode,
GHOST_TAxisFlag wrap_axis,
int bounds[4],
const int bounds[4],
const int mouse_ungrab_xy[2]);
/***************************************************************************************

View File

@ -216,7 +216,7 @@ bool GHOST_ValidWindow(GHOST_SystemHandle systemhandle, GHOST_WindowHandle windo
}
GHOST_WindowHandle GHOST_BeginFullScreen(GHOST_SystemHandle systemhandle,
GHOST_DisplaySetting *setting,
const GHOST_DisplaySetting *setting,
const bool stereoVisual)
{
GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
@ -409,7 +409,7 @@ GHOST_TSuccess GHOST_SetCursorPosition(GHOST_SystemHandle systemhandle,
GHOST_TSuccess GHOST_SetCursorGrab(GHOST_WindowHandle windowhandle,
GHOST_TGrabCursorMode mode,
GHOST_TAxisFlag wrap_axis,
int bounds[4],
const int bounds[4],
const int mouse_ungrab_xy[2])
{
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
@ -781,7 +781,7 @@ int32_t GHOST_GetHeightRectangle(GHOST_RectangleHandle rectanglehandle)
void GHOST_GetRectangle(
GHOST_RectangleHandle rectanglehandle, int32_t *l, int32_t *t, int32_t *r, int32_t *b)
{
GHOST_Rect *rect = (GHOST_Rect *)rectanglehandle;
const GHOST_Rect *rect = (GHOST_Rect *)rectanglehandle;
*l = rect->m_l;
*t = rect->m_t;

View File

@ -351,7 +351,7 @@ struct DummyContextWGL {
0,
0,
0,
0, /* accum bits (ignored) */
0, /* Accumulation bits (ignored). */
0, /* depth buffer */
0, /* stencil buffer */
0, /* no auxiliary buffers */

View File

@ -67,7 +67,7 @@ GHOST_TSuccess GHOST_DisplayManagerX11::getNumDisplaySettings(uint8_t display,
/* from SDL2 */
#ifdef WITH_X11_XF86VMODE
static int calculate_rate(XF86VidModeModeInfo *info)
static int calculate_rate(const XF86VidModeModeInfo *info)
{
return (info->htotal && info->vtotal) ? (1000 * info->dotclock / (info->htotal * info->vtotal)) :
0;

View File

@ -527,14 +527,14 @@ void GHOST_NDOFManager::setDeadZone(float dz)
CLOG_INFO(LOG, 2, "dead zone set to %.2f%s", dz, (dz > 0.5f) ? " (unexpectedly high)" : "");
}
static bool atHomePosition(GHOST_TEventNDOFMotionData *ndof)
static bool atHomePosition(const GHOST_TEventNDOFMotionData *ndof)
{
#define HOME(foo) (ndof->foo == 0.0f)
return HOME(tx) && HOME(ty) && HOME(tz) && HOME(rx) && HOME(ry) && HOME(rz);
#undef HOME
}
static bool nearHomePosition(GHOST_TEventNDOFMotionData *ndof, float threshold)
static bool nearHomePosition(const GHOST_TEventNDOFMotionData *ndof, float threshold)
{
if (threshold == 0.0f) {
return atHomePosition(ndof);

View File

@ -2432,16 +2432,21 @@ static void data_device_handle_drop(void *data, wl_data_device * /*wl_data_devic
std::vector<std::string> uris;
size_t pos = 0;
while (true) {
while (pos != std::string::npos) {
pos = data.find(file_proto, pos);
const size_t start = pos + sizeof(file_proto) - 1;
pos = data.find(lf, pos);
if (pos == std::string::npos) {
break;
}
/* Account for 'CRLF' case. */
const size_t start = pos + sizeof(file_proto) - 1;
pos = data.find(lf, pos);
size_t end = pos;
if (UNLIKELY(end == std::string::npos)) {
/* Note that most well behaved file managers will add a trailing newline,
* Gnome's web browser (44.3) doesn't, so support reading up until the last byte. */
end = data.size();
}
/* Account for 'CRLF' case. */
if (data[end - 1] == '\r') {
end -= 1;
}

View File

@ -9,7 +9,6 @@ endif()
set(INC
.
..
../atomic
)
set(INC_SYS
@ -36,6 +35,7 @@ set(SRC
)
set(LIB
PRIVATE bf_intern_atomic
)
if(WIN32 AND NOT UNIX)

View File

@ -87,9 +87,21 @@ def keyconfig_update(keyconfig_data, keyconfig_version):
keyconfig_data = copy.deepcopy(keyconfig_data)
has_copy = True
# "Snap Source Toggle" did not exist until then.
for km_name, _km_parms, km_items_data in keyconfig_data:
if km_name == "Transform Modal Map":
# Navigation during transform is now not optional and conflicts need to be resolved.
for (item_modal, item_event, _item_prop) in km_items_data["items"]:
if item_modal in {
"PROPORTIONAL_SIZE_UP",
"PROPORTIONAL_SIZE_DOWN",
"PROPORTIONAL_SIZE",
"AUTOIK_CHAIN_LEN_UP",
"AUTOIK_CHAIN_LEN_DOWN",
"AUTOCONSTRAIN",
"AUTOCONSTRAINPLANE"}:
item_event["alt"] = True
# "Snap Source Toggle" did not exist until then.
km_items_data["items"].extend(("EDIT_SNAP_SOURCE_ON", {"type": 'B', "value": 'PRESS'}, None))
km_items_data["items"].append(("EDIT_SNAP_SOURCE_OFF", {"type": 'B', "value": 'PRESS'}, None))
break

View File

@ -252,15 +252,6 @@ class Prefs(bpy.types.KeyConfigPreferences):
update=update_fn,
)
use_transform_navigation: BoolProperty(
name="Navigate during Transform",
description=(
"Enable view navigation while using transform operators. "
"Proportional Influence, Automatic Constraints and Auto IK Chain Length shortcuts will require holding Alt key"),
default=False,
update=update_fn,
)
def draw(self, layout):
from bpy import context
@ -324,7 +315,6 @@ class Prefs(bpy.types.KeyConfigPreferences):
sub.prop(self, "use_v3d_tab_menu")
sub.prop(self, "use_pie_click_drag")
sub.prop(self, "use_v3d_shade_ex_pie")
sub.prop(self, "use_transform_navigation")
# File Browser settings.
col = layout.column()
@ -385,7 +375,6 @@ def load():
use_pie_click_drag=kc_prefs.use_pie_click_drag,
use_file_single_click=kc_prefs.use_file_single_click,
experimental=prefs.experimental,
use_transform_navigation=kc_prefs.use_transform_navigation,
),
)

View File

@ -99,8 +99,6 @@ class Params:
"tool_maybe_tweak_event",
# Access to bpy.context.preferences.experimental
"experimental",
# Changes some transformers modal key-map items to avoid conflicts with navigation operations
"use_transform_navigation",
)
def __init__(
@ -129,7 +127,6 @@ class Params:
v3d_tilde_action='VIEW',
v3d_alt_mmb_drag_action='RELATIVE',
experimental=None,
use_transform_navigation=False,
):
from sys import platform
self.apple = (platform == 'darwin')
@ -228,7 +225,6 @@ class Params:
self.pie_value = 'CLICK_DRAG' if use_pie_click_drag else 'PRESS'
self.tool_tweak_event = {"type": self.tool_mouse, "value": 'CLICK_DRAG'}
self.tool_maybe_tweak_event = {"type": self.tool_mouse, "value": self.tool_maybe_tweak_value}
self.use_transform_navigation = use_transform_navigation
self.experimental = experimental
@ -1608,16 +1604,13 @@ def km_view3d(params):
# Transform.
("transform.translate", {"type": params.select_mouse, "value": 'CLICK_DRAG'}, None),
op_tool_optional(
("transform.translate", {"type": 'G', "value": 'PRESS'},
{"properties": [("allow_navigation", params.use_transform_navigation)]}),
("transform.translate", {"type": 'G', "value": 'PRESS'}, None),
(op_tool_cycle, "builtin.move"), params),
op_tool_optional(
("transform.rotate", {"type": 'R', "value": 'PRESS'},
{"properties": [("allow_navigation", params.use_transform_navigation)]}),
("transform.rotate", {"type": 'R', "value": 'PRESS'}, None),
(op_tool_cycle, "builtin.rotate"), params),
op_tool_optional(
("transform.resize", {"type": 'S', "value": 'PRESS'},
{"properties": [("allow_navigation", params.use_transform_navigation)]}),
("transform.resize", {"type": 'S', "value": 'PRESS'}, None),
(op_tool_cycle, "builtin.scale"), params),
op_tool_optional(
("transform.tosphere", {"type": 'S', "value": 'PRESS', "shift": True, "alt": True}, None),
@ -3675,8 +3668,7 @@ def km_grease_pencil_stroke_edit_mode(params):
("gpencil.duplicate_move", {"type": 'D', "value": 'PRESS', "shift": True}, None),
# Extrude and move selected points
op_tool_optional(
("gpencil.extrude_move", {"type": 'E', "value": 'PRESS'},
{"properties": [("TRANSFORM_OT_translate", [("allow_navigation", params.use_transform_navigation)])]}),
("gpencil.extrude_move", {"type": 'E', "value": 'PRESS'}, None),
(op_tool_cycle, "builtin.extrude"), params),
# Delete
op_menu("VIEW3D_MT_edit_gpencil_delete", {"type": 'X', "value": 'PRESS'}),
@ -4685,10 +4677,8 @@ def km_object_mode(params):
op_menu("VIEW3D_MT_add", {"type": 'A', "value": 'PRESS', "shift": True}),
op_menu("VIEW3D_MT_object_apply", {"type": 'A', "value": 'PRESS', "ctrl": True}),
op_menu("VIEW3D_MT_make_links", {"type": 'L', "value": 'PRESS', "ctrl": True}),
("object.duplicate_move", {"type": 'D', "value": 'PRESS', "shift": True},
{"properties": [("TRANSFORM_OT_translate", [("allow_navigation", params.use_transform_navigation)])]}),
("object.duplicate_move_linked", {"type": 'D', "value": 'PRESS', "alt": True},
{"properties": [("TRANSFORM_OT_translate", [("allow_navigation", params.use_transform_navigation)])]}),
("object.duplicate_move", {"type": 'D', "value": 'PRESS', "shift": True}, None),
("object.duplicate_move_linked", {"type": 'D', "value": 'PRESS', "alt": True}, None),
("object.join", {"type": 'J', "value": 'PRESS', "ctrl": True}, None),
("wm.context_toggle", {"type": 'PERIOD', "value": 'PRESS', "ctrl": True},
{"properties": [("data_path", 'tool_settings.use_transform_data_origin')]}),
@ -4754,13 +4744,10 @@ def km_paint_curve(params):
("paintcurve.delete_point", {"type": 'DEL', "value": 'PRESS'}, None),
("paintcurve.draw", {"type": 'RET', "value": 'PRESS'}, None),
("paintcurve.draw", {"type": 'NUMPAD_ENTER', "value": 'PRESS'}, None),
("transform.translate", {"type": 'G', "value": 'PRESS'},
{"properties": [("allow_navigation", params.use_transform_navigation)]}),
("transform.translate", {"type": 'G', "value": 'PRESS'}, None),
("transform.translate", {"type": params.select_mouse, "value": 'CLICK_DRAG'}, None),
("transform.rotate", {"type": 'R', "value": 'PRESS'},
{"properties": [("allow_navigation", params.use_transform_navigation)]}),
("transform.resize", {"type": 'S', "value": 'PRESS'},
{"properties": [("allow_navigation", params.use_transform_navigation)]}),
("transform.rotate", {"type": 'R', "value": 'PRESS'}, None),
("transform.resize", {"type": 'S', "value": 'PRESS'}, None),
])
return keymap
@ -4793,8 +4780,7 @@ def km_curve(params):
("curve.separate", {"type": 'P', "value": 'PRESS'}, None),
("curve.split", {"type": 'Y', "value": 'PRESS'}, None),
op_tool_optional(
("curve.extrude_move", {"type": 'E', "value": 'PRESS'},
{"properties": [("TRANSFORM_OT_translate", [("allow_navigation", params.use_transform_navigation)])]}),
("curve.extrude_move", {"type": 'E', "value": 'PRESS'}, None),
(op_tool_cycle, "builtin.extrude"), params),
("curve.duplicate_move", {"type": 'D', "value": 'PRESS', "shift": True}, None),
("curve.make_segment", {"type": 'F', "value": 'PRESS'}, None),
@ -5403,8 +5389,7 @@ def km_mesh(params):
("mesh.normals_make_consistent", {"type": 'N', "value": 'PRESS', "shift": True, "ctrl": True},
{"properties": [("inside", True)]}),
op_tool_optional(
("view3d.edit_mesh_extrude_move_normal", {"type": 'E', "value": 'PRESS'},
{"properties": [("allow_navigation", params.use_transform_navigation)]}),
("view3d.edit_mesh_extrude_move_normal", {"type": 'E', "value": 'PRESS'}, None),
(op_tool_cycle, "builtin.extrude_region"), params),
op_menu("VIEW3D_MT_edit_mesh_extrude", {"type": 'E', "value": 'PRESS', "alt": True}),
("transform.edge_crease", {"type": 'E', "value": 'PRESS', "shift": True}, None),
@ -5421,13 +5406,11 @@ def km_mesh(params):
# No tool is available for this.
("mesh.rip_move", {"type": 'V', "value": 'PRESS', "alt": True},
{"properties": [("MESH_OT_rip", [("use_fill", True)],)]}),
("mesh.rip_edge_move", {"type": 'D', "value": 'PRESS', "alt": True},
{"properties": [("TRANSFORM_OT_translate", [("allow_navigation", params.use_transform_navigation)])]}),
("mesh.rip_edge_move", {"type": 'D', "value": 'PRESS', "alt": True}, None),
op_menu("VIEW3D_MT_edit_mesh_merge", {"type": 'M', "value": 'PRESS'}),
op_menu("VIEW3D_MT_edit_mesh_split", {"type": 'M', "value": 'PRESS', "alt": True}),
("mesh.edge_face_add", {"type": 'F', "value": 'PRESS', "repeat": True}, None),
("mesh.duplicate_move", {"type": 'D', "value": 'PRESS', "shift": True},
{"properties": [("TRANSFORM_OT_translate", [("allow_navigation", params.use_transform_navigation)])]}),
("mesh.duplicate_move", {"type": 'D', "value": 'PRESS', "shift": True}, None),
op_menu("VIEW3D_MT_mesh_add", {"type": 'A', "value": 'PRESS', "shift": True}),
("mesh.separate", {"type": 'P', "value": 'PRESS'}, None),
("mesh.split", {"type": 'Y', "value": 'PRESS'}, None),
@ -5545,8 +5528,7 @@ def km_armature(params):
("armature.dissolve", {"type": 'X', "value": 'PRESS', "ctrl": True}, None),
("armature.dissolve", {"type": 'DEL', "value": 'PRESS', "ctrl": True}, None),
op_tool_optional(
("armature.extrude_move", {"type": 'E', "value": 'PRESS'},
{"properties": [("TRANSFORM_OT_translate", [("allow_navigation", params.use_transform_navigation)])]}),
("armature.extrude_move", {"type": 'E', "value": 'PRESS'}, None),
(op_tool_cycle, "builtin.extrude"), params),
("armature.extrude_forked", {"type": 'E', "value": 'PRESS', "shift": True}, None),
("armature.click_extrude", {"type": params.action_mouse, "value": 'CLICK', "ctrl": True}, None),
@ -5965,24 +5947,24 @@ def km_transform_modal_map(params):
("PROPORTIONAL_SIZE_DOWN", {"type": 'PAGE_DOWN', "value": 'PRESS', "repeat": True}, None),
("PROPORTIONAL_SIZE_UP", {"type": 'PAGE_UP', "value": 'PRESS', "shift": True, "repeat": True}, None),
("PROPORTIONAL_SIZE_DOWN", {"type": 'PAGE_DOWN', "value": 'PRESS', "shift": True, "repeat": True}, None),
("PROPORTIONAL_SIZE_UP", {"type": 'WHEELDOWNMOUSE', "value": 'PRESS', "alt": params.use_transform_navigation}, None),
("PROPORTIONAL_SIZE_DOWN", {"type": 'WHEELUPMOUSE', "value": 'PRESS', "alt": params.use_transform_navigation}, None),
("PROPORTIONAL_SIZE_UP", {"type": 'WHEELDOWNMOUSE', "value": 'PRESS', "alt": True}, None),
("PROPORTIONAL_SIZE_DOWN", {"type": 'WHEELUPMOUSE', "value": 'PRESS', "alt": True}, None),
("PROPORTIONAL_SIZE_UP", {"type": 'WHEELDOWNMOUSE', "value": 'PRESS', "shift": True}, None),
("PROPORTIONAL_SIZE_DOWN", {"type": 'WHEELUPMOUSE', "value": 'PRESS', "shift": True}, None),
("PROPORTIONAL_SIZE", {"type": 'TRACKPADPAN', "value": 'ANY', "alt": params.use_transform_navigation}, None),
("PROPORTIONAL_SIZE", {"type": 'TRACKPADPAN', "value": 'ANY', "alt": True}, None),
("AUTOIK_CHAIN_LEN_UP", {"type": 'PAGE_UP', "value": 'PRESS', "repeat": True}, None),
("AUTOIK_CHAIN_LEN_DOWN", {"type": 'PAGE_DOWN', "value": 'PRESS', "repeat": True}, None),
("AUTOIK_CHAIN_LEN_UP", {"type": 'PAGE_UP', "value": 'PRESS', "shift": True, "repeat": True}, None),
("AUTOIK_CHAIN_LEN_DOWN", {"type": 'PAGE_DOWN', "value": 'PRESS', "shift": True, "repeat": True}, None),
("AUTOIK_CHAIN_LEN_UP", {"type": 'WHEELDOWNMOUSE', "value": 'PRESS', "alt": params.use_transform_navigation}, None),
("AUTOIK_CHAIN_LEN_DOWN", {"type": 'WHEELUPMOUSE', "value": 'PRESS', "alt": params.use_transform_navigation}, None),
("AUTOIK_CHAIN_LEN_UP", {"type": 'WHEELDOWNMOUSE', "value": 'PRESS', "alt": True}, None),
("AUTOIK_CHAIN_LEN_DOWN", {"type": 'WHEELUPMOUSE', "value": 'PRESS', "alt": True}, None),
("AUTOIK_CHAIN_LEN_UP", {"type": 'WHEELDOWNMOUSE', "value": 'PRESS', "shift": True}, None),
("AUTOIK_CHAIN_LEN_DOWN", {"type": 'WHEELUPMOUSE', "value": 'PRESS', "shift": True}, None),
("INSERTOFS_TOGGLE_DIR", {"type": 'T', "value": 'PRESS'}, None),
("NODE_ATTACH_ON", {"type": 'LEFT_ALT', "value": 'RELEASE', "any": True}, None),
("NODE_ATTACH_OFF", {"type": 'LEFT_ALT', "value": 'PRESS', "any": True}, None),
("AUTOCONSTRAIN", {"type": 'MIDDLEMOUSE', "value": 'ANY', "alt": params.use_transform_navigation}, None),
("AUTOCONSTRAINPLANE", {"type": 'MIDDLEMOUSE', "value": 'ANY', "shift": True, "alt": params.use_transform_navigation}, None),
("AUTOCONSTRAIN", {"type": 'MIDDLEMOUSE', "value": 'ANY', "alt": True}, None),
("AUTOCONSTRAINPLANE", {"type": 'MIDDLEMOUSE', "value": 'ANY', "shift": True, "alt": True}, None),
("PRECISION", {"type": 'LEFT_SHIFT', "value": 'ANY', "any": True}, None),
("PRECISION", {"type": 'RIGHT_SHIFT', "value": 'ANY', "any": True}, None),
])

View File

@ -15,12 +15,6 @@ class VIEW3D_OT_edit_mesh_extrude_individual_move(Operator):
bl_label = "Extrude Individual and Move"
bl_idname = "view3d.edit_mesh_extrude_individual_move"
allow_navigation: BoolProperty(
name="allow_navigation",
default=False,
description="Allow navigation",
)
@classmethod
def poll(cls, context):
obj = context.active_object
@ -40,27 +34,27 @@ class VIEW3D_OT_edit_mesh_extrude_individual_move(Operator):
TRANSFORM_OT_translate={
"orient_type": 'NORMAL',
"constraint_axis": (False, False, True),
"allow_navigation": self.allow_navigation,
"release_confirm": False,
},
)
elif select_mode[2] and totface > 1:
bpy.ops.mesh.extrude_faces_move(
'INVOKE_REGION_WIN',
TRANSFORM_OT_shrink_fatten={
"allow_navigation": self.allow_navigation,
"release_confirm": False,
})
elif select_mode[1] and totedge >= 1:
bpy.ops.mesh.extrude_edges_move(
'INVOKE_REGION_WIN',
TRANSFORM_OT_translate={
"allow_navigation": self.allow_navigation,
"release_confirm": False,
},
)
else:
bpy.ops.mesh.extrude_vertices_move(
'INVOKE_REGION_WIN',
TRANSFORM_OT_translate={
"allow_navigation": self.allow_navigation,
"release_confirm": False,
},
)
@ -83,19 +77,13 @@ class VIEW3D_OT_edit_mesh_extrude_move(Operator):
description="Dissolves adjacent faces and intersects new geometry",
)
allow_navigation: BoolProperty(
name="allow_navigation",
default=False,
description="Allow navigation",
)
@classmethod
def poll(cls, context):
obj = context.active_object
return (obj is not None and obj.mode == 'EDIT')
@staticmethod
def extrude_region(context, use_vert_normals, dissolve_and_intersect, allow_navigation):
def extrude_region(context, use_vert_normals, dissolve_and_intersect):
mesh = context.object.data
totface = mesh.total_face_sel
@ -107,7 +95,7 @@ class VIEW3D_OT_edit_mesh_extrude_move(Operator):
bpy.ops.mesh.extrude_region_shrink_fatten(
'INVOKE_REGION_WIN',
TRANSFORM_OT_shrink_fatten={
"allow_navigation": allow_navigation,
"release_confirm": False,
},
)
elif dissolve_and_intersect:
@ -119,7 +107,7 @@ class VIEW3D_OT_edit_mesh_extrude_move(Operator):
TRANSFORM_OT_translate={
"orient_type": 'NORMAL',
"constraint_axis": (False, False, True),
"allow_navigation": allow_navigation,
"release_confirm": False,
},
)
else:
@ -128,7 +116,7 @@ class VIEW3D_OT_edit_mesh_extrude_move(Operator):
TRANSFORM_OT_translate={
"orient_type": 'NORMAL',
"constraint_axis": (False, False, True),
"allow_navigation": allow_navigation,
"release_confirm": False,
},
)
@ -142,13 +130,13 @@ class VIEW3D_OT_edit_mesh_extrude_move(Operator):
# Not a popular choice, too restrictive for retopo.
# "constraint_axis": (True, True, False)})
"constraint_axis": (False, False, False),
"allow_navigation": allow_navigation,
"release_confirm": False,
})
else:
bpy.ops.mesh.extrude_region_move(
'INVOKE_REGION_WIN',
TRANSFORM_OT_translate={
"allow_navigation": allow_navigation,
"release_confirm": False,
},
)
@ -157,8 +145,7 @@ class VIEW3D_OT_edit_mesh_extrude_move(Operator):
return {'FINISHED'}
def execute(self, context):
return VIEW3D_OT_edit_mesh_extrude_move.extrude_region(
context, False, self.dissolve_and_intersect, self.allow_navigation)
return VIEW3D_OT_edit_mesh_extrude_move.extrude_region(context, False, self.dissolve_and_intersect)
def invoke(self, context, _event):
return self.execute(context)
@ -169,19 +156,13 @@ class VIEW3D_OT_edit_mesh_extrude_shrink_fatten(Operator):
bl_label = "Extrude and Move on Individual Normals"
bl_idname = "view3d.edit_mesh_extrude_move_shrink_fatten"
allow_navigation: BoolProperty(
name="allow_navigation",
default=False,
description="Allow navigation",
)
@classmethod
def poll(cls, context):
obj = context.active_object
return (obj is not None and obj.mode == 'EDIT')
def execute(self, context):
return VIEW3D_OT_edit_mesh_extrude_move.extrude_region(context, True, False, self.allow_navigation)
return VIEW3D_OT_edit_mesh_extrude_move.extrude_region(context, True, False)
def invoke(self, context, _event):
return self.execute(context)
@ -192,12 +173,6 @@ class VIEW3D_OT_edit_mesh_extrude_manifold_normal(Operator):
bl_label = "Extrude Manifold Along Normals"
bl_idname = "view3d.edit_mesh_extrude_manifold_normal"
allow_navigation: BoolProperty(
name="allow_navigation",
default=False,
description="Allow navigation",
)
@classmethod
def poll(cls, context):
obj = context.active_object
@ -212,7 +187,7 @@ class VIEW3D_OT_edit_mesh_extrude_manifold_normal(Operator):
TRANSFORM_OT_translate={
"orient_type": 'NORMAL',
"constraint_axis": (False, False, True),
"allow_navigation": self.allow_navigation,
"release_confirm": False,
},
)
return {'FINISHED'}

View File

@ -110,7 +110,7 @@ class SPREADSHEET_HT_header(bpy.types.Header):
return obj.mode == 'EDIT'
if obj.type == 'CURVES':
return obj.mode in {'SCULPT_CURVES', 'EDIT'}
return True
return False
classes = (

View File

@ -1518,12 +1518,16 @@ class USERPREF_PT_file_paths_asset_libraries(FilePathsPanel, Panel):
props = col.operator("preferences.asset_library_remove", text="", icon='REMOVE')
props.index = active_library_index
if active_library_index < 0:
try:
active_library = None if active_library_index < 0 else paths.asset_libraries[active_library_index]
except IndexError:
active_library = None
if active_library is None:
return
layout.separator()
active_library = paths.asset_libraries[active_library_index]
layout.prop(active_library, "path")
layout.prop(active_library, "import_method", text="Import Method")
layout.prop(active_library, "use_relative_path")

View File

@ -1049,14 +1049,10 @@ class VIEW3D_MT_transform_base:
# TODO: get rid of the custom text strings?
def draw(self, context):
layout = self.layout
allow_navigation = getattr(
context.window_manager.keyconfigs.active.preferences,
"use_transform_navigation",
False)
layout.operator("transform.translate").allow_navigation = allow_navigation
layout.operator("transform.rotate").allow_navigation = allow_navigation
layout.operator("transform.resize", text="Scale").allow_navigation = allow_navigation
layout.operator("transform.translate").release_confirm = False
layout.operator("transform.rotate").release_confirm = False
layout.operator("transform.resize", text="Scale").release_confirm = False
layout.separator()
@ -1076,18 +1072,13 @@ class VIEW3D_MT_transform_base:
# Generic transform menu - geometry types
class VIEW3D_MT_transform(VIEW3D_MT_transform_base, Menu):
def draw(self, context):
allow_navigation = getattr(
context.window_manager.keyconfigs.active.preferences,
"use_transform_navigation",
False)
# base menu
VIEW3D_MT_transform_base.draw(self, context)
# generic...
layout = self.layout
if context.mode == 'EDIT_MESH':
layout.operator("transform.shrink_fatten", text="Shrink/Fatten").allow_navigation = allow_navigation
layout.operator("transform.shrink_fatten", text="Shrink/Fatten").release_confirm = False
layout.operator("transform.skin_resize")
elif context.mode == 'EDIT_CURVE':
layout.operator("transform.transform", text="Radius").mode = 'CURVE_SHRINKFATTEN'
@ -1096,10 +1087,11 @@ class VIEW3D_MT_transform(VIEW3D_MT_transform_base, Menu):
layout.separator()
props = layout.operator("transform.translate", text="Move Texture Space")
props.texture_space = True
props.allow_navigation = allow_navigation
props.release_confirm = False
props = layout.operator("transform.resize", text="Scale Texture Space")
props.texture_space = True
props.allow_navigation = allow_navigation
props.release_confirm = False
# Object-specific extensions to Transform menu
@ -2110,6 +2102,13 @@ class VIEW3D_MT_select_paint_mask_vertex(Menu):
layout.operator("paint.vert_select_linked", text="Select Linked")
class VIEW3D_MT_select_edit_point_cloud(Menu):
bl_label = "Select"
def draw(_self, _context):
pass
class VIEW3D_MT_edit_curves_select_more_less(Menu):
bl_label = "Select More/Less"
@ -4209,11 +4208,6 @@ class VIEW3D_MT_edit_mesh_context_menu(Menu):
col.operator("mesh.delete", text="Delete Edges").type = 'EDGE'
if is_face_mode:
allow_navigation = getattr(
context.window_manager.keyconfigs.active.preferences,
"use_transform_navigation",
False)
col = row.column(align=True)
col.label(text="Face Context Menu", icon='FACESEL')
@ -4225,11 +4219,11 @@ class VIEW3D_MT_edit_mesh_context_menu(Menu):
col.separator()
col.operator("view3d.edit_mesh_extrude_move_normal",
text="Extrude Faces").allow_navigation = allow_navigation
text="Extrude Faces").release_confirm = False
col.operator("view3d.edit_mesh_extrude_move_shrink_fatten",
text="Extrude Faces Along Normals").allow_navigation = allow_navigation
text="Extrude Faces Along Normals").release_confirm = False
col.operator("mesh.extrude_faces_move",
text="Extrude Individual Faces").TRANSFORM_OT_shrink_fatten.allow_navigation = allow_navigation
text="Extrude Individual Faces").TRANSFORM_OT_shrink_fatten.release_confirm = False
col.operator("mesh.inset")
col.operator("mesh.poke")
@ -4281,11 +4275,6 @@ class VIEW3D_MT_edit_mesh_extrude(Menu):
def draw(self, context):
from math import pi
allow_navigation = getattr(
context.window_manager.keyconfigs.active.preferences,
"use_transform_navigation",
False)
layout = self.layout
layout.operator_context = 'INVOKE_REGION_WIN'
@ -4295,22 +4284,22 @@ class VIEW3D_MT_edit_mesh_extrude(Menu):
if mesh.total_face_sel:
layout.operator("view3d.edit_mesh_extrude_move_normal",
text="Extrude Faces").allow_navigation = allow_navigation
text="Extrude Faces").release_confirm = False
layout.operator("view3d.edit_mesh_extrude_move_shrink_fatten",
text="Extrude Faces Along Normals").allow_navigation = allow_navigation
text="Extrude Faces Along Normals").release_confirm = False
layout.operator(
"mesh.extrude_faces_move",
text="Extrude Individual Faces").TRANSFORM_OT_shrink_fatten.allow_navigation = allow_navigation
text="Extrude Individual Faces").TRANSFORM_OT_shrink_fatten.release_confirm = False
layout.operator("view3d.edit_mesh_extrude_manifold_normal",
text="Extrude Manifold").allow_navigation = allow_navigation
text="Extrude Manifold").release_confirm = False
if mesh.total_edge_sel and (select_mode[0] or select_mode[1]):
layout.operator("mesh.extrude_edges_move",
text="Extrude Edges").TRANSFORM_OT_translate.allow_navigation = allow_navigation
text="Extrude Edges").TRANSFORM_OT_translate.release_confirm = False
if mesh.total_vert_sel and select_mode[0]:
layout.operator("mesh.extrude_vertices_move",
text="Extrude Vertices").TRANSFORM_OT_translate.allow_navigation = allow_navigation
text="Extrude Vertices").TRANSFORM_OT_translate.release_confirm = False
layout.separator()
@ -4463,22 +4452,17 @@ class VIEW3D_MT_edit_mesh_faces(Menu):
bl_idname = "VIEW3D_MT_edit_mesh_faces"
def draw(self, context):
allow_navigation = getattr(
context.window_manager.keyconfigs.active.preferences,
"use_transform_navigation",
False)
layout = self.layout
layout.operator_context = 'INVOKE_REGION_WIN'
layout.operator("view3d.edit_mesh_extrude_move_normal",
text="Extrude Faces").allow_navigation = allow_navigation
text="Extrude Faces").release_confirm = False
layout.operator("view3d.edit_mesh_extrude_move_shrink_fatten",
text="Extrude Faces Along Normals").allow_navigation = allow_navigation
text="Extrude Faces Along Normals").release_confirm = False
layout.operator(
"mesh.extrude_faces_move",
text="Extrude Individual Faces").TRANSFORM_OT_shrink_fatten.allow_navigation = allow_navigation
text="Extrude Individual Faces").TRANSFORM_OT_shrink_fatten.release_confirm = False
layout.separator()
@ -5501,6 +5485,13 @@ class VIEW3D_MT_edit_curves(Menu):
layout.operator("curves.delete")
class VIEW3D_MT_edit_pointcloud(Menu):
bl_label = "Point Cloud"
def draw(_self, _context):
pass
class VIEW3D_MT_object_mode_pie(Menu):
bl_label = "Mode"
@ -8243,6 +8234,7 @@ classes = (
VIEW3D_MT_select_edit_gpencil,
VIEW3D_MT_select_paint_mask,
VIEW3D_MT_select_paint_mask_vertex,
VIEW3D_MT_select_edit_point_cloud,
VIEW3D_MT_edit_curves_select_more_less,
VIEW3D_MT_select_edit_curves,
VIEW3D_MT_select_sculpt_curves,
@ -8370,6 +8362,7 @@ classes = (
VIEW3D_MT_edit_armature_delete,
VIEW3D_MT_edit_gpencil_transform,
VIEW3D_MT_edit_curves,
VIEW3D_MT_edit_pointcloud,
VIEW3D_MT_object_mode_pie,
VIEW3D_MT_view_pie,
VIEW3D_MT_transform_gizmo_pie,

View File

@ -119,6 +119,7 @@ typedef enum eContextObjectMode {
CTX_MODE_EDIT_LATTICE,
CTX_MODE_EDIT_CURVES,
CTX_MODE_EDIT_GREASE_PENCIL,
CTX_MODE_EDIT_POINT_CLOUD,
CTX_MODE_POSE,
CTX_MODE_SCULPT,
CTX_MODE_PAINT_WEIGHT,

View File

@ -461,7 +461,7 @@ void BKE_gpencil_layer_mask_cleanup_all_layers(struct bGPdata *gpd);
void BKE_gpencil_layer_frames_sort(struct bGPDlayer *gpl, bool *r_has_duplicate_frames);
struct bGPDlayer *BKE_gpencil_layer_get_by_name(struct bGPdata *gpd,
char *name,
const char *name,
int first_if_not_found);
/* Brush */

View File

@ -269,6 +269,10 @@ class LayerGroupRuntime {
* Caches all the layers in this group in a single pre-ordered vector.
*/
mutable Vector<Layer *> layer_cache_;
/**
* Caches all the layer groups in this group in a single pre-ordered vector.
*/
mutable Vector<LayerGroup *> layer_group_cache_;
};
/**
@ -282,10 +286,11 @@ class LayerGroup : public ::GreasePencilLayerTreeGroup {
~LayerGroup();
public:
StringRefNull name() const
{
return this->base.name;
}
StringRefNull name() const;
void set_name(StringRefNull new_name);
bool is_visible() const;
bool is_locked() const;
/**
* Adds a group at the end of this group.
@ -345,12 +350,24 @@ class LayerGroup : public ::GreasePencilLayerTreeGroup {
Span<const Layer *> layers() const;
Span<Layer *> layers_for_write();
/**
* Returns a `Span` of pointers to all the `LayerGroups`s in this group.
*/
Span<const LayerGroup *> groups() const;
Span<LayerGroup *> groups_for_write();
/**
* Returns a pointer to the layer with \a name. If no such layer was found, returns nullptr.
*/
const Layer *find_layer_by_name(StringRefNull name) const;
Layer *find_layer_by_name(StringRefNull name);
/**
* Returns a pointer to the group with \a name. If no such group was found, returns nullptr.
*/
const LayerGroup *find_group_by_name(StringRefNull name) const;
LayerGroup *find_group_by_name(StringRefNull name);
/**
* Print the nodes. For debugging purposes.
*/
@ -361,6 +378,15 @@ class LayerGroup : public ::GreasePencilLayerTreeGroup {
void tag_nodes_cache_dirty() const;
};
inline const TreeNode &Layer::as_node() const
{
return *reinterpret_cast<const TreeNode *>(this);
}
inline TreeNode &Layer::as_node()
{
return *reinterpret_cast<TreeNode *>(this);
}
inline StringRefNull Layer::name() const
{
return this->base.name;
@ -371,13 +397,9 @@ inline LayerGroup &Layer::parent_group() const
return this->base.parent->wrap();
}
inline const TreeNode &Layer::as_node() const
inline StringRefNull LayerGroup::name() const
{
return *reinterpret_cast<const TreeNode *>(this);
}
inline TreeNode &Layer::as_node()
{
return *reinterpret_cast<TreeNode *>(this);
return this->base.name;
}
namespace convert {

View File

@ -378,6 +378,9 @@ enum {
/** Clear asset data (in case the ID can actually be made local, in copy case asset data is never
* copied over). */
LIB_ID_MAKELOCAL_ASSET_DATA_CLEAR = 1 << 3,
/** Clear any liboverride data as part of making this linked data local. */
LIB_ID_MAKELOCAL_LIBOVERRIDE_CLEAR = 1 << 4,
};
/**

View File

@ -193,11 +193,11 @@ typedef struct LibraryForeachIDData LibraryForeachIDData;
* Check whether current iteration over ID usages should be stopped or not.
* \return true if the iteration should be stopped, false otherwise.
*/
bool BKE_lib_query_foreachid_iter_stop(struct LibraryForeachIDData *data);
bool BKE_lib_query_foreachid_iter_stop(const struct LibraryForeachIDData *data);
void BKE_lib_query_foreachid_process(struct LibraryForeachIDData *data,
struct ID **id_pp,
int cb_flag);
int BKE_lib_query_foreachid_process_flags_get(struct LibraryForeachIDData *data);
int BKE_lib_query_foreachid_process_flags_get(const struct LibraryForeachIDData *data);
int BKE_lib_query_foreachid_process_callback_flag_override(struct LibraryForeachIDData *data,
int cb_flag,
bool do_replace);

View File

@ -29,7 +29,6 @@ set(INC
../../../intern/ghost
../../../intern/guardedalloc
../../../intern/iksolver/extern
../../../intern/atomic
../../../intern/clog
../../../intern/libmv
../../../intern/mantaflow/extern
@ -556,7 +555,7 @@ set(LIB
bf_shader_fx
bf_simulation
extern_fmtlib
PRIVATE bf_intern_atomic
# For `vfontdata_freetype.c`.
${FREETYPE_LIBRARIES} ${BROTLI_LIBRARIES}
)

View File

@ -125,9 +125,21 @@ typedef struct BlendfileLinkAppendContextCallBack {
BlendfileLinkAppendContextItem *item;
ReportList *reports;
/** Whether the currently evaluated usage is within some liboverride dependency context. Note
* that this include liboverride reference itself, but also e.g. if a linked Mesh is used by the
* reference of an overridden object.
*
* Mutually exclusive with #is_liboverride_dependency_only. */
bool is_liboverride_dependency;
/** Whether the currently evaluated usage is exclusively within some liboverride dependency
* context, i.e. the full all usages of this data so far have only been a part of liboverride
* references and their dependencies.
*
* Mutually exclusive with #is_liboverride_dependency. */
bool is_liboverride_dependency_only;
} BlendfileLinkAppendContextCallBack;
/* Actions to apply to an item (i.e. linked ID). */
/** Actions to apply to an item (i.e. linked ID). */
enum {
LINK_APPEND_ACT_UNSET = 0,
LINK_APPEND_ACT_KEEP_LINKED,
@ -136,10 +148,23 @@ enum {
LINK_APPEND_ACT_COPY_LOCAL,
};
/* Various status info about an item (i.e. linked ID). */
/** Various status info about an item (i.e. linked ID). */
enum {
/* An indirectly linked ID. */
/** An indirectly linked ID. */
LINK_APPEND_TAG_INDIRECT = 1 << 0,
/** An ID also used as liboverride dependency (either directly, as a liboverride reference, or
* indirectly, as data used by a liboverride reference). It should never be directly made local.
*
* Mutually exclusive with #LINK_APPEND_TAG_LIBOVERRIDE_DEPENDENCY_ONLY.
*/
LINK_APPEND_TAG_LIBOVERRIDE_DEPENDENCY = 1 << 1,
/** An ID only used as liboverride dependency (either directly or indirectly, see
* #LINK_APPEND_TAG_LIBOVERRIDE_DEPENDENCY for precisions). It should not be considered during
* the 'make local' process, and remain purely linked data.
*
* Mutually exclusive with #LINK_APPEND_TAG_LIBOVERRIDE_DEPENDENCY.
*/
LINK_APPEND_TAG_LIBOVERRIDE_DEPENDENCY_ONLY = 1 << 2,
};
static BlendHandle *link_append_context_library_blohandle_ensure(
@ -929,7 +954,7 @@ static int foreach_libblock_link_append_callback(LibraryIDLinkCallbackData *cb_d
/* NOTE: It is important to also skip liboverride references here, as those should never be made
* local. */
if (cb_data->cb_flag & (IDWALK_CB_EMBEDDED | IDWALK_CB_EMBEDDED_NOT_OWNING | IDWALK_CB_INTERNAL |
IDWALK_CB_LOOPBACK | IDWALK_CB_OVERRIDE_LIBRARY_REFERENCE))
IDWALK_CB_LOOPBACK))
{
return IDWALK_RET_NOP;
}
@ -983,7 +1008,7 @@ static int foreach_libblock_link_append_callback(LibraryIDLinkCallbackData *cb_d
data->lapp_context, id->name, GS(id->name), NULL);
item->new_id = id;
item->source_library = id->lib;
/* Since we did not have an item for that ID yet, we know user did not selected it explicitly,
/* Since we did not have an item for that ID yet, we know user did not select it explicitly,
* it was rather linked indirectly. This info is important for instantiation of collections. */
item->tag |= LINK_APPEND_TAG_INDIRECT;
/* In linking case we already know what we want to do with those items. */
@ -991,6 +1016,54 @@ static int foreach_libblock_link_append_callback(LibraryIDLinkCallbackData *cb_d
item->action = LINK_APPEND_ACT_KEEP_LINKED;
}
new_id_to_item_mapping_add(data->lapp_context, id, item);
if ((cb_data->cb_flag & IDWALK_CB_OVERRIDE_LIBRARY_REFERENCE) != 0 ||
data->is_liboverride_dependency_only)
{
/* New item, (currently) detected as only used as a liboverride linked dependency. */
item->tag |= LINK_APPEND_TAG_LIBOVERRIDE_DEPENDENCY_ONLY;
}
else if (data->is_liboverride_dependency) {
/* New item, (currently) detected as used as a liboverride linked dependency, among
* others. */
item->tag |= LINK_APPEND_TAG_LIBOVERRIDE_DEPENDENCY;
}
}
else {
if ((cb_data->cb_flag & IDWALK_CB_OVERRIDE_LIBRARY_REFERENCE) != 0 ||
data->is_liboverride_dependency_only)
{
/* Existing item, here only used as a liboverride reference dependency. If it was not tagged
* as such before, it is also used by non-liboverride reference data. */
if ((item->tag & LINK_APPEND_TAG_LIBOVERRIDE_DEPENDENCY_ONLY) == 0) {
item->tag |= LINK_APPEND_TAG_LIBOVERRIDE_DEPENDENCY;
/* In case that item was already processed, and marked to be directly made local, its
* action needs to be changed to copying instead, since no liboverride reference (or their
* dependencies) should ever be made local. */
if (item->action == LINK_APPEND_ACT_MAKE_LOCAL) {
CLOG_INFO(
&LOG,
3,
"Appended ID '%s' is also used as a liboverride linked dependency, duplicating it.",
id->name);
item->action = LINK_APPEND_ACT_COPY_LOCAL;
}
}
}
else if ((item->tag & LINK_APPEND_TAG_LIBOVERRIDE_DEPENDENCY_ONLY) != 0) {
/* Existing item, here used in a non-liboverride dependency context. If it was
* tagged as a liboverride dependency only, its tag and action need to be updated. */
item->tag |= LINK_APPEND_TAG_LIBOVERRIDE_DEPENDENCY;
item->tag &= ~LINK_APPEND_TAG_LIBOVERRIDE_DEPENDENCY_ONLY;
if (item->action == LINK_APPEND_ACT_KEEP_LINKED) {
CLOG_INFO(
&LOG,
3,
"Appended ID '%s' is also used as a liboverride linked dependency, duplicating it.",
id->name);
item->action = LINK_APPEND_ACT_COPY_LOCAL;
}
}
}
/* NOTE: currently there is no need to do anything else here, but in the future this would be
@ -1044,11 +1117,16 @@ void BKE_blendfile_append(BlendfileLinkAppendContext *lapp_context, ReportList *
const bool do_reuse_local_id = (lapp_context->params->flag &
BLO_LIBLINK_APPEND_LOCAL_ID_REUSE) != 0;
const int make_local_common_flags = LIB_ID_MAKELOCAL_FULL_LIBRARY |
((lapp_context->params->flag &
BLO_LIBLINK_APPEND_ASSET_DATA_CLEAR) != 0 ?
LIB_ID_MAKELOCAL_ASSET_DATA_CLEAR :
0);
const int make_local_common_flags =
LIB_ID_MAKELOCAL_FULL_LIBRARY |
((lapp_context->params->flag & BLO_LIBLINK_APPEND_ASSET_DATA_CLEAR) != 0 ?
LIB_ID_MAKELOCAL_ASSET_DATA_CLEAR :
0) |
/* In recursive case (i.e. everything becomes local), clear liboverrides. Otherwise (i.e.
* only data from immediately linked libraries is made local), preserve liboverrides. */
((lapp_context->params->flag & BLO_LIBLINK_APPEND_RECURSIVE) != 0 ?
LIB_ID_MAKELOCAL_LIBOVERRIDE_CLEAR :
0);
LinkNode *itemlink;
@ -1072,29 +1150,61 @@ void BKE_blendfile_append(BlendfileLinkAppendContext *lapp_context, ReportList *
id->lib->filepath,
id->name) :
NULL;
const bool is_liboverride_dependency = (item->tag & LINK_APPEND_TAG_LIBOVERRIDE_DEPENDENCY) !=
0;
const bool is_liboverride_dependency_only = (item->tag &
LINK_APPEND_TAG_LIBOVERRIDE_DEPENDENCY_ONLY) != 0;
/* These two flags are mutually exclusive. */
BLI_assert(!(is_liboverride_dependency && is_liboverride_dependency_only));
if (item->action != LINK_APPEND_ACT_UNSET) {
/* Already set, pass. */
}
else if (item->tag & LINK_APPEND_TAG_LIBOVERRIDE_DEPENDENCY_ONLY) {
CLOG_INFO(
&LOG,
3,
"Appended ID '%s' is only used as a liboverride linked dependency, keeping it linked.",
id->name);
item->action = LINK_APPEND_ACT_KEEP_LINKED;
}
else if (do_reuse_local_id && existing_local_id != NULL) {
CLOG_INFO(&LOG, 3, "Appended ID '%s' as a matching local one, re-using it...", id->name);
CLOG_INFO(&LOG, 3, "Appended ID '%s' as a matching local one, re-using it.", id->name);
item->action = LINK_APPEND_ACT_REUSE_LOCAL;
item->userdata = existing_local_id;
}
else if (id->tag & LIB_TAG_PRE_EXISTING) {
CLOG_INFO(&LOG, 3, "Appended ID '%s' was already linked, need to copy it...", id->name);
CLOG_INFO(&LOG, 3, "Appended ID '%s' was already linked, duplicating it.", id->name);
item->action = LINK_APPEND_ACT_COPY_LOCAL;
}
else if (item->tag & LINK_APPEND_TAG_LIBOVERRIDE_DEPENDENCY) {
CLOG_INFO(
&LOG,
3,
"Appended ID '%s' is also used as a liboverride linked dependency, duplicating it.",
id->name);
item->action = LINK_APPEND_ACT_COPY_LOCAL;
}
else {
CLOG_INFO(&LOG, 3, "Appended ID '%s' will be made local...", id->name);
CLOG_INFO(&LOG, 3, "Appended ID '%s' will be made local.", id->name);
item->action = LINK_APPEND_ACT_MAKE_LOCAL;
}
/* Only check dependencies if we are not keeping linked data, nor re-using existing local data.
/* Only check dependencies if linked data are not kept, nor existing local data are re-used,
* and if the item is not used for liboverride dependencies.
*
* NOTE: liboverride dependencies require complete check of all usages of the ID, as this may
* change the status and action of its item (see #foreach_libblock_link_append_callback code).
*/
if (!ELEM(item->action, LINK_APPEND_ACT_KEEP_LINKED, LINK_APPEND_ACT_REUSE_LOCAL)) {
if (!ELEM(item->action, LINK_APPEND_ACT_KEEP_LINKED, LINK_APPEND_ACT_REUSE_LOCAL) ||
is_liboverride_dependency || is_liboverride_dependency_only)
{
BlendfileLinkAppendContextCallBack cb_data = {
.lapp_context = lapp_context, .item = item, .reports = reports};
.lapp_context = lapp_context,
.item = item,
.reports = reports,
.is_liboverride_dependency = is_liboverride_dependency,
.is_liboverride_dependency_only = is_liboverride_dependency_only};
BKE_library_foreach_ID_link(
bmain, id, foreach_libblock_link_append_callback, &cb_data, IDWALK_NOP);
}
@ -1219,6 +1329,12 @@ void BKE_blendfile_append(BlendfileLinkAppendContext *lapp_context, ReportList *
if (id->tag & LIB_TAG_PRE_EXISTING) {
continue;
}
/* Do NOT delete a linked data that is (also) used a liboverride dependency. */
if (item->tag &
(LINK_APPEND_TAG_LIBOVERRIDE_DEPENDENCY | LINK_APPEND_TAG_LIBOVERRIDE_DEPENDENCY_ONLY))
{
continue;
}
id->tag |= LIB_TAG_DOIT;
}

View File

@ -1188,6 +1188,8 @@ enum eContextObjectMode CTX_data_mode_enum_ex(const Object *obedit,
return CTX_MODE_EDIT_CURVES;
case OB_GREASE_PENCIL:
return CTX_MODE_EDIT_GREASE_PENCIL;
case OB_POINTCLOUD:
return CTX_MODE_EDIT_POINT_CLOUD;
}
}
else {
@ -1248,29 +1250,12 @@ enum eContextObjectMode CTX_data_mode_enum(const bContext *C)
* \note Must be aligned with above enum.
*/
static const char *data_mode_strings[] = {
"mesh_edit",
"curve_edit",
"surface_edit",
"text_edit",
"armature_edit",
"mball_edit",
"lattice_edit",
"curves_edit",
"grease_pencil_edit",
"posemode",
"sculpt_mode",
"weightpaint",
"vertexpaint",
"imagepaint",
"particlemode",
"objectmode",
"greasepencil_paint",
"greasepencil_edit",
"greasepencil_sculpt",
"greasepencil_weight",
"greasepencil_vertex",
"curves_sculpt",
nullptr,
"mesh_edit", "curve_edit", "surface_edit", "text_edit",
"armature_edit", "mball_edit", "lattice_edit", "curves_edit",
"grease_pencil_edit", "point_cloud_edit", "posemode", "sculpt_mode",
"weightpaint", "vertexpaint", "imagepaint", "particlemode",
"objectmode", "greasepencil_paint", "greasepencil_edit", "greasepencil_sculpt",
"greasepencil_weight", "greasepencil_vertex", "curves_sculpt", nullptr,
};
BLI_STATIC_ASSERT(ARRAY_SIZE(data_mode_strings) == CTX_MODE_NUM + 1,
"Must have a string for each context mode")

View File

@ -89,7 +89,7 @@ static bool calc_curve_deform(
}
}
else {
CurveCache *cc = ob_curve->runtime.curve_cache;
const CurveCache *cc = ob_curve->runtime.curve_cache;
float totdist = BKE_anim_path_get_length(cc);
if (LIKELY(totdist > FLT_EPSILON)) {
fac = -(co[index] - cd->dmax[index]) / totdist;
@ -111,7 +111,7 @@ static bool calc_curve_deform(
}
}
else {
CurveCache *cc = ob_curve->runtime.curve_cache;
const CurveCache *cc = ob_curve->runtime.curve_cache;
float totdist = BKE_anim_path_get_length(cc);
if (LIKELY(totdist > FLT_EPSILON)) {
fac = +(co[index] - cd->dmin[index]) / totdist;

View File

@ -1946,7 +1946,7 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
nullptr,
nullptr,
nullptr},
/* 51: CD_HAIRLENGTH */
/* 51: CD_HAIRLENGTH */ /* DEPRECATED */ /* UNUSED */
{sizeof(float), "float", 1, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr},
/* 52: CD_PROP_QUATERNION */
{sizeof(float[4]),

View File

@ -486,7 +486,6 @@ bool try_capture_field_on_geometry(GeometryComponent &component,
}
const bke::GeometryFieldContext field_context{component, domain};
const IndexMask mask{IndexMask(domain_size)};
const bke::AttributeValidator validator = attributes.lookup_validator(attribute_id);
const std::optional<AttributeMetaData> meta_data = attributes.lookup_meta_data(attribute_id);
@ -496,10 +495,8 @@ bool try_capture_field_on_geometry(GeometryComponent &component,
/* We are writing to an attribute that exists already with the correct domain and type. */
if (attribute_matches) {
if (GSpanAttributeWriter dst_attribute = attributes.lookup_for_write_span(attribute_id)) {
const IndexMask mask{IndexMask(domain_size)};
const bke::GeometryFieldContext field_context{component, domain};
fn::FieldEvaluator evaluator{field_context, &mask};
fn::FieldEvaluator evaluator{field_context, domain_size};
evaluator.add(validator.validate_field_if_necessary(field));
evaluator.set_selection(selection);
evaluator.evaluate();
@ -528,7 +525,7 @@ bool try_capture_field_on_geometry(GeometryComponent &component,
if (!selection_is_full) {
type.value_initialize_n(buffer, domain_size);
}
fn::FieldEvaluator evaluator{field_context, &mask};
fn::FieldEvaluator evaluator{field_context, domain_size};
evaluator.add_with_destination(validator.validate_field_if_necessary(field),
GMutableSpan{type, buffer, domain_size});
evaluator.set_selection(selection);

View File

@ -1573,7 +1573,7 @@ bGPDlayer *BKE_gpencil_layer_active_get(bGPdata *gpd)
return NULL;
}
bGPDlayer *BKE_gpencil_layer_get_by_name(bGPdata *gpd, char *name, int first_if_not_found)
bGPDlayer *BKE_gpencil_layer_get_by_name(bGPdata *gpd, const char *name, int first_if_not_found)
{
bGPDlayer *gpl;

View File

@ -490,12 +490,12 @@ Map<int, GreasePencilFrame> &Layer::frames_for_write()
bool Layer::is_visible() const
{
return (this->base.flag & GP_LAYER_TREE_NODE_HIDE) == 0;
return this->parent_group().is_visible() && (this->base.flag & GP_LAYER_TREE_NODE_HIDE) == 0;
}
bool Layer::is_locked() const
{
return (this->base.flag & GP_LAYER_TREE_NODE_LOCKED) != 0;
return this->parent_group().is_locked() || (this->base.flag & GP_LAYER_TREE_NODE_LOCKED) != 0;
}
bool Layer::insert_frame(int frame_number, const GreasePencilFrame &frame)
@ -616,6 +616,29 @@ LayerGroup::~LayerGroup()
this->runtime = nullptr;
}
void LayerGroup::set_name(StringRefNull new_name)
{
this->base.name = BLI_strdup(new_name.c_str());
}
bool LayerGroup::is_visible() const
{
if (this->base.parent) {
return this->base.parent->wrap().is_visible() &&
(this->base.flag & GP_LAYER_TREE_NODE_HIDE) == 0;
}
return (this->base.flag & GP_LAYER_TREE_NODE_HIDE) == 0;
}
bool LayerGroup::is_locked() const
{
if (this->base.parent) {
return this->base.parent->wrap().is_locked() ||
(this->base.flag & GP_LAYER_TREE_NODE_LOCKED) != 0;
}
return (this->base.flag & GP_LAYER_TREE_NODE_LOCKED) != 0;
}
LayerGroup &LayerGroup::add_group(LayerGroup *group)
{
BLI_assert(group != nullptr);
@ -742,6 +765,18 @@ Span<Layer *> LayerGroup::layers_for_write()
return this->runtime->layer_cache_.as_span();
}
Span<const LayerGroup *> LayerGroup::groups() const
{
this->ensure_nodes_cache();
return this->runtime->layer_group_cache_.as_span();
}
Span<LayerGroup *> LayerGroup::groups_for_write()
{
this->ensure_nodes_cache();
return this->runtime->layer_group_cache_.as_span();
}
const Layer *LayerGroup::find_layer_by_name(const StringRefNull name) const
{
for (const Layer *layer : this->layers()) {
@ -762,6 +797,26 @@ Layer *LayerGroup::find_layer_by_name(const StringRefNull name)
return nullptr;
}
const LayerGroup *LayerGroup::find_group_by_name(StringRefNull name) const
{
for (const LayerGroup *group : this->groups()) {
if (StringRef(group->name()) == StringRef(name)) {
return group;
}
}
return nullptr;
}
LayerGroup *LayerGroup::find_group_by_name(StringRefNull name)
{
for (LayerGroup *group : this->groups_for_write()) {
if (StringRef(group->name()) == StringRef(name)) {
return group;
}
}
return nullptr;
}
void LayerGroup::print_nodes(StringRefNull header) const
{
std::cout << header << std::endl;
@ -795,6 +850,7 @@ void LayerGroup::ensure_nodes_cache() const
this->runtime->nodes_cache_mutex_.ensure([&]() {
this->runtime->nodes_cache_.clear_and_shrink();
this->runtime->layer_cache_.clear_and_shrink();
this->runtime->layer_group_cache_.clear_and_shrink();
LISTBASE_FOREACH (GreasePencilLayerTreeNode *, child_, &this->children) {
TreeNode *node = reinterpret_cast<TreeNode *>(child_);
@ -805,11 +861,15 @@ void LayerGroup::ensure_nodes_cache() const
break;
}
case GP_LAYER_TREE_GROUP: {
this->runtime->layer_group_cache_.append(&node->as_group_for_write());
for (TreeNode *child : node->as_group_for_write().nodes_for_write()) {
this->runtime->nodes_cache_.append(child);
if (child->is_layer()) {
this->runtime->layer_cache_.append(&child->as_layer_for_write());
}
else if (child->is_group()) {
this->runtime->layer_group_cache_.append(&child->as_group_for_write());
}
}
break;
}
@ -1212,6 +1272,12 @@ std::optional<blender::Bounds<blender::float3>> GreasePencil::bounds_min_max() c
return bounds;
}
blender::Span<const blender::bke::greasepencil::TreeNode *> GreasePencil::nodes() const
{
BLI_assert(this->runtime != nullptr);
return this->root_group.wrap().nodes();
}
blender::Span<const blender::bke::greasepencil::Layer *> GreasePencil::layers() const
{
BLI_assert(this->runtime != nullptr);
@ -1224,10 +1290,16 @@ blender::Span<blender::bke::greasepencil::Layer *> GreasePencil::layers_for_writ
return this->root_group.wrap().layers_for_write();
}
blender::Span<const blender::bke::greasepencil::TreeNode *> GreasePencil::nodes() const
blender::Span<const blender::bke::greasepencil::LayerGroup *> GreasePencil::groups() const
{
BLI_assert(this->runtime != nullptr);
return this->root_group.wrap().nodes();
return this->root_group.wrap().groups();
}
blender::Span<blender::bke::greasepencil::LayerGroup *> GreasePencil::groups_for_write()
{
BLI_assert(this->runtime != nullptr);
return this->root_group.wrap().groups_for_write();
}
const blender::bke::greasepencil::Layer *GreasePencil::get_active_layer() const
@ -1346,6 +1418,18 @@ blender::bke::greasepencil::Layer *GreasePencil::find_layer_by_name(
return this->root_group.wrap().find_layer_by_name(name);
}
const blender::bke::greasepencil::LayerGroup *GreasePencil::find_group_by_name(
blender::StringRefNull name) const
{
return this->root_group.wrap().find_group_by_name(name);
}
blender::bke::greasepencil::LayerGroup *GreasePencil::find_group_by_name(
blender::StringRefNull name)
{
return this->root_group.wrap().find_group_by_name(name);
}
void GreasePencil::rename_layer(blender::bke::greasepencil::Layer &layer,
blender::StringRefNull new_name)
{
@ -1359,6 +1443,19 @@ void GreasePencil::rename_layer(blender::bke::greasepencil::Layer &layer,
layer.set_name(unique_name);
}
void GreasePencil::rename_group(blender::bke::greasepencil::LayerGroup &group,
blender::StringRefNull new_name)
{
using namespace blender;
if (group.name() == new_name) {
return;
}
VectorSet<StringRefNull> names = get_node_names(*this);
std::string unique_name(new_name.c_str());
unique_layer_group_name(names, unique_name.data());
group.set_name(unique_name);
}
void GreasePencil::remove_layer(blender::bke::greasepencil::Layer &layer)
{
using namespace blender::bke::greasepencil;

View File

@ -506,10 +506,16 @@ void BKE_lib_id_make_local_generic(Main *bmain, ID *id, const int flags)
if (force_local) {
BKE_lib_id_clear_library_data(bmain, id, flags);
if ((flags & LIB_ID_MAKELOCAL_LIBOVERRIDE_CLEAR) != 0) {
BKE_lib_override_library_make_local(id);
}
BKE_lib_id_expand_local(bmain, id, flags);
}
else if (force_copy) {
ID *id_new = BKE_id_copy(bmain, id);
const int copy_flags =
(LIB_ID_COPY_DEFAULT |
((flags & LIB_ID_MAKELOCAL_LIBOVERRIDE_CLEAR) != 0 ? LIB_ID_COPY_NO_LIB_OVERRIDE : 0));
ID *id_new = BKE_id_copy_ex(bmain, id, NULL, copy_flags);
/* Should not fail in expected use cases,
* but a few ID types cannot be copied (LIB, WM, SCR...). */

View File

@ -61,7 +61,7 @@ typedef struct LibraryForeachIDData {
BLI_LINKSTACK_DECLARE(ids_todo, ID *);
} LibraryForeachIDData;
bool BKE_lib_query_foreachid_iter_stop(LibraryForeachIDData *data)
bool BKE_lib_query_foreachid_iter_stop(const LibraryForeachIDData *data)
{
return (data->status & IDWALK_STOP) != 0;
}
@ -107,7 +107,7 @@ void BKE_lib_query_foreachid_process(LibraryForeachIDData *data, ID **id_pp, int
}
}
int BKE_lib_query_foreachid_process_flags_get(LibraryForeachIDData *data)
int BKE_lib_query_foreachid_process_flags_get(const LibraryForeachIDData *data)
{
return data->flag;
}

View File

@ -1963,8 +1963,7 @@ bool BKE_object_is_in_editmode(const Object *ob)
/* Grease Pencil object has no edit mode data. */
return GPENCIL_EDIT_MODE((bGPdata *)ob->data);
case OB_CURVES:
/* Curves object has no edit mode data. */
return ob->mode == OB_MODE_EDIT;
case OB_POINTCLOUD:
case OB_GREASE_PENCIL:
return ob->mode == OB_MODE_EDIT;
default:
@ -1994,6 +1993,7 @@ bool BKE_object_data_is_in_editmode(const Object *ob, const ID *id)
case ID_AR:
return ((const bArmature *)id)->edbo != nullptr;
case ID_CV:
case ID_PT:
case ID_GP:
if (ob) {
return BKE_object_is_in_editmode(ob);
@ -2046,14 +2046,10 @@ char *BKE_object_data_editmode_flush_ptr_get(ID *id)
bArmature *arm = (bArmature *)id;
return &arm->needs_flush_to_id;
}
case ID_CV: {
/* Curves have no edit mode data. */
case ID_GP:
case ID_PT:
case ID_CV:
return nullptr;
}
case ID_GP: {
/* Grease Pencil has no edit mode data. */
return nullptr;
}
default:
BLI_assert_unreachable();
return nullptr;

View File

@ -568,7 +568,7 @@ static float do_clump_level(float result[3],
float clumpfac,
float clumppow,
float pa_clump,
CurveMapping *clumpcurve)
const CurveMapping *clumpcurve)
{
float clump = 0.0f;
@ -610,7 +610,7 @@ float do_clump(ParticleKey *state,
float pa_clump,
bool use_clump_noise,
float clump_noise_size,
CurveMapping *clumpcurve)
const CurveMapping *clumpcurve)
{
float clump;
@ -726,7 +726,7 @@ static void twist_get_axis(const ParticleChildModifierContext *modifier_ctx,
}
}
static float BKE_curvemapping_integrate_clamped(CurveMapping *curve,
static float BKE_curvemapping_integrate_clamped(const CurveMapping *curve,
float start,
float end,
float step)

View File

@ -1790,7 +1790,7 @@ static void rigidbody_update_simulation(Depsgraph *depsgraph,
rigidbody_validate_sim_shape(rbw, ob, true);
/* now tell RB sim about it */
/* XXX: we assume that this can only get applied for active/passive shapes
* that will be included as rigidbodies. */
* that will be included as rigid-bodies. */
if (rbo->shared->physics_object != NULL && rbo->shared->physics_shape != NULL) {
RB_body_set_collision_shape(rbo->shared->physics_object, rbo->shared->physics_shape);
}

View File

@ -549,7 +549,7 @@ static void sound_load_audio(Main *bmain, bSound *sound, bool free_waveform)
/* load sound */
PackedFile *pf = sound->packedfile;
/* don't modify soundact->sound->filepath, only change a copy */
/* Don't modify `sound->filepath`, only change a copy. */
STRNCPY(fullpath, sound->filepath);
BLI_path_abs(fullpath, ID_BLEND_PATH(bmain, &sound->id));

View File

@ -673,7 +673,7 @@ static ImBuf *accessor_get_ibuf(TrackingImageAccessor *accessor,
{
/* First try to get fully processed image from the cache. */
CACHE_PRINTF("Calculate new buffer for frame %d\n", frame);
/* And now we do postprocessing of the original frame. */
/* And now we do post-processing of the original frame. */
ImBuf *orig_ibuf = accessor_get_preprocessed_ibuf(accessor, clip_index, frame);
if (orig_ibuf == nullptr) {
return nullptr;

View File

@ -212,7 +212,7 @@ static VChar *freetypechar_to_vchar(FT_Face face, FT_ULong charcode, const VFont
return NULL;
}
VChar *che = (VChar *)MEM_callocN(sizeof(struct VChar), "objfnt_char");
VChar *che = (VChar *)MEM_callocN(sizeof(VChar), "objfnt_char");
freetype_outline_to_curves(face->glyph->outline, &che->nurbsbase, vfd->scale);
che->index = charcode;
che->width = face->glyph->advance.x * vfd->scale;

View File

@ -49,7 +49,7 @@ float do_clump(ParticleKey *state,
float pa_clump,
bool use_clump_noise,
float clump_noise_size,
struct CurveMapping *clumpcurve);
const struct CurveMapping *clumpcurve);
void do_child_modifiers(const ParticleChildModifierContext *modifier_ctx,
float mat[4][4],
ParticleKey *state,

View File

@ -26,7 +26,7 @@ void *BLI_hash_md5_buffer(const char *buffer, size_t len, void *resblock);
*/
int BLI_hash_md5_stream(FILE *stream, void *resblock);
char *BLI_hash_md5_to_hexdigest(void *resblock, char r_hex_digest[33]);
char *BLI_hash_md5_to_hexdigest(const void *resblock, char r_hex_digest[33]);
#ifdef __cplusplus
}

View File

@ -168,7 +168,7 @@ size_t BLI_strncpy_wchar_as_utf8(char *__restrict dst,
size_t dst_maxncpy) ATTR_NONNULL(1, 2);
size_t BLI_strncpy_wchar_from_utf8(wchar_t *__restrict dst_w,
const char *__restrict src_c,
size_t dst_maxncpy) ATTR_NONNULL(1, 2);
size_t dst_w_maxncpy) ATTR_NONNULL(1, 2);
/**
* Count columns that character/string occupies (based on `wcwidth.co`).

View File

@ -6,38 +6,67 @@
/** \file
* \ingroup bli
*
* Unicode characters as UTF-8 strings.
*/
#ifdef __cplusplus
extern "C" {
#endif
/* Unicode characters as UTF-8 strings. Last portion should include the official assigned name.
* Please do not add defines here that are not actually in use. */
/* Notes:
* - Last portion should include the official assigned name.
* - Please do not add defines here that are not actually in use.
* - Use literal UTF-8 encoding as this `u8` prefixes cause both
* `-Wc++20-compat` & `-Wc99-compat` warnings under CLANG.
*/
#define BLI_STR_UTF8_MULTIPLICATION_SIGN u8"\u00D7" /* × */
#define BLI_STR_UTF8_EM_DASH u8"\u2014" /* — */
#define BLI_STR_UTF8_BULLET u8"\u2022" /* • */
#define BLI_STR_UTF8_HORIZONTAL_ELLIPSIS u8"\u2026" /* … */
#define BLI_STR_UTF8_LEFTWARDS_ARROW u8"\u2190" /* ← */
#define BLI_STR_UTF8_UPWARDS_ARROW u8"\u2191" /* ↑ */
#define BLI_STR_UTF8_RIGHTWARDS_ARROW u8"\u2192" /* → */
#define BLI_STR_UTF8_DOWNWARDS_ARROW u8"\u2193" /* ↓ */
#define BLI_STR_UTF8_UPWARDS_WHITE_ARROW u8"\u21E7" /* ⇧ */
#define BLI_STR_UTF8_UP_ARROWHEAD u8"\u2303" /* ⌃ */
#define BLI_STR_UTF8_PLACE_OF_INTEREST_SIGN u8"\u2318" /* ⌘ */
#define BLI_STR_UTF8_OPTION_KEY u8"\u2325" /* ⌥ */
#define BLI_STR_UTF8_ERASE_TO_THE_LEFT u8"\u232B" /* ⌫ */
#define BLI_STR_UTF8_BROKEN_CIRCLE_WITH_NORTHWEST_ARROW u8"\u238B" /* ⎋ */
#define BLI_STR_UTF8_RETURN_SYMBOL u8"\u23CE" /* ⏎ */
#define BLI_STR_UTF8_BLACK_RIGHT_POINTING_DOUBLE_TRIANGLE_WITH_VERTICAL_BAR u8"\u23ED" /* ⏭ */
#define BLI_STR_UTF8_BLACK_LEFT_POINTING_DOUBLE_TRIANGLE_WITH_VERTICAL_BAR u8"\u23EE" /* ⏮ */
#define BLI_STR_UTF8_BLACK_RIGHT_POINTING_TRIANGLE_WITH_DOUBLE_VERTICAL_BAR u8"\u23EF" /* ⏯ */
#define BLI_STR_UTF8_BLACK_SQUARE_FOR_STOP u8"\u23F9" /* ⏹ */
#define BLI_STR_UTF8_OPEN_BOX u8"\u2423" /* ␣ */
#define BLI_STR_UTF8_BLACK_RIGHT_POINTING_SMALL_TRIANGLE u8"\u25B8" /* ▸ */
#define BLI_STR_UTF8_HORIZONTAL_TAB_KEY u8"\u2B7E" /* ⭾ */
#define BLI_STR_UTF8_BLACK_DIAMOND_MINUS_WHITE_X u8"\u2756" /* ❖ */
/** u00D7: `×`. */
#define BLI_STR_UTF8_MULTIPLICATION_SIGN "\xc3\x97"
/** u2014: `—` */
#define BLI_STR_UTF8_EM_DASH "\xe2\x80\x94"
/** u2022: `•` */
#define BLI_STR_UTF8_BULLET "\xe2\x80\xa2"
/** u2026: `…` */
#define BLI_STR_UTF8_HORIZONTAL_ELLIPSIS "\xe2\x80\xa6"
/** u2190: `←` */
#define BLI_STR_UTF8_LEFTWARDS_ARROW "\xe2\x86\x90"
/** u2191: `↑` */
#define BLI_STR_UTF8_UPWARDS_ARROW "\xe2\x86\x91"
/** u2192: `→` */
#define BLI_STR_UTF8_RIGHTWARDS_ARROW "\xe2\x86\x92"
/** u2193: `↓` */
#define BLI_STR_UTF8_DOWNWARDS_ARROW "\xe2\x86\x93"
/** u21E7: `⇧` */
#define BLI_STR_UTF8_UPWARDS_WHITE_ARROW "\xe2\x87\xa7"
/** u2303: `⌃` */
#define BLI_STR_UTF8_UP_ARROWHEAD "\xe2\x8c\x83"
/** u2318: `⌘` */
#define BLI_STR_UTF8_PLACE_OF_INTEREST_SIGN "\xe2\x8c\x98"
/** u2325: `⌥` */
#define BLI_STR_UTF8_OPTION_KEY "\xe2\x8c\xa5"
/** u232B: `⌫` */
#define BLI_STR_UTF8_ERASE_TO_THE_LEFT "\xe2\x8c\xab"
/** u238B: `⎋` */
#define BLI_STR_UTF8_BROKEN_CIRCLE_WITH_NORTHWEST_ARROW "\xe2\x8e\x8b"
/** u23CE: `⏎` */
#define BLI_STR_UTF8_RETURN_SYMBOL "\xe2\x8f\x8e"
/** u23ED: `⏭` */
#define BLI_STR_UTF8_BLACK_RIGHT_POINTING_DOUBLE_TRIANGLE_WITH_VERTICAL_BAR "\xe2\x8f\xad"
/** u23EE: `⏮` */
#define BLI_STR_UTF8_BLACK_LEFT_POINTING_DOUBLE_TRIANGLE_WITH_VERTICAL_BAR "\xe2\x8f\xae"
/** u23EF: `⏯` */
#define BLI_STR_UTF8_BLACK_RIGHT_POINTING_TRIANGLE_WITH_DOUBLE_VERTICAL_BAR "\xe2\x8f\xaf"
/** u23F9: `⏹` */
#define BLI_STR_UTF8_BLACK_SQUARE_FOR_STOP "\xe2\x8f\xb9"
/** u2423: `␣` */
#define BLI_STR_UTF8_OPEN_BOX "\xe2\x90\xa3"
/** u25B8: `▸` */
#define BLI_STR_UTF8_BLACK_RIGHT_POINTING_SMALL_TRIANGLE "\xe2\x96\xb8"
/** u2B7E: `⭾` */
#define BLI_STR_UTF8_HORIZONTAL_TAB_KEY "\xe2\xad\xbe"
/** u2756: `❖` */
#define BLI_STR_UTF8_BLACK_DIAMOND_MINUS_WHITE_X "\xe2\x9d\x96"
#ifdef __cplusplus
}

View File

@ -11,7 +11,6 @@ set(INC
..
# ../blenkernel # don't add this back!
../makesdna
../../../intern/atomic
../../../intern/eigen
../../../intern/guardedalloc
)
@ -394,7 +393,7 @@ set(LIB
bf_intern_eigen
bf_intern_guardedalloc
extern_wcwidth
PRIVATE bf_intern_atomic
${ZLIB_LIBRARIES}
${ZSTD_LIBRARIES}
)

View File

@ -379,7 +379,7 @@ void *BLI_hash_md5_buffer(const char *buffer, size_t len, void *resblock)
return md5_read_ctx(&ctx, resblock);
}
char *BLI_hash_md5_to_hexdigest(void *resblock, char r_hex_digest[33])
char *BLI_hash_md5_to_hexdigest(const void *resblock, char r_hex_digest[33])
{
static const char hex_map[17] = "0123456789abcdef";
const unsigned char *p;

View File

@ -144,7 +144,7 @@ typedef struct PolyIndex {
/* based on libgdx 2013-11-28, apache 2.0 licensed */
static void pf_coord_sign_calc(PolyFill *pf, PolyIndex *pi);
static void pf_coord_sign_calc(const PolyFill *pf, PolyIndex *pi);
static PolyIndex *pf_ear_tip_find(PolyFill *pf
#ifdef USE_CLIP_EVEN
@ -576,7 +576,7 @@ static void pf_triangulate(PolyFill *pf)
/**
* \return CONCAVE, TANGENTIAL or CONVEX
*/
static void pf_coord_sign_calc(PolyFill *pf, PolyIndex *pi)
static void pf_coord_sign_calc(const PolyFill *pf, PolyIndex *pi)
{
/* localize */
const float(*coords)[2] = pf->coords;

View File

@ -7,11 +7,17 @@ set(INC
..
../..
../../../makesdna
../../../../../intern/atomic
../../../../../intern/guardedalloc
)
include_directories(${INC})
set(INC_SYS
)
blender_test_performance(BLI_ghash_performance "bf_blenlib")
blender_test_performance(BLI_task_performance "bf_blenlib")
set(LIB
PRIVATE bf_blenlib
PRIVATE bf_intern_guardedalloc
PRIVATE bf_intern_atomic
)
blender_add_performancetest_executable(BLI_ghash_performance "BLI_ghash_performance_test.cc" "${INC}" "${INC_SYS}" "${LIB}")
blender_add_performancetest_executable(BLI_task_performance "BLI_task_performance_test.cc" "${INC}" "${INC_SYS}" "${LIB}")

View File

@ -1195,7 +1195,7 @@ static void displacement_node_insert(bNodeTree *ntree)
nodeRemLink(ntree, link);
/* Add displacement node. */
bNode *node = nodeAddStaticNode(NULL, ntree, SH_NODE_DISPLACEMENT);
bNode *node = nodeAddStaticNode(nullptr, ntree, SH_NODE_DISPLACEMENT);
node->locx = 0.5f * (fromnode->locx + tonode->locx);
node->locy = 0.5f * (fromnode->locy + tonode->locy);
@ -1272,7 +1272,7 @@ static void square_roughness_node_insert(bNodeTree *ntree)
nodeRemLink(ntree, link);
/* Add sqrt node. */
bNode *node = nodeAddStaticNode(NULL, ntree, SH_NODE_MATH);
bNode *node = nodeAddStaticNode(nullptr, ntree, SH_NODE_MATH);
node->custom1 = NODE_MATH_POWER;
node->locx = 0.5f * (fromnode->locx + tonode->locx);
node->locy = 0.5f * (fromnode->locy + tonode->locy);
@ -1364,7 +1364,7 @@ static void ambient_occlusion_node_relink(bNodeTree *ntree)
static void image_node_colorspace(bNode *node)
{
if (node->id == NULL) {
if (node->id == nullptr) {
return;
}
@ -1402,11 +1402,11 @@ static void light_emission_node_to_energy(Light *light, float *energy, float col
/* Find emission node */
bNode *output_node = ntreeShaderOutputNode(ntree, SHD_OUTPUT_CYCLES);
if (output_node == NULL) {
if (output_node == nullptr) {
return;
}
bNode *emission_node = NULL;
bNode *emission_node = nullptr;
LISTBASE_FOREACH (bNodeLink *, link, &ntree->links) {
if (link->tonode == output_node && link->fromnode->type == SH_NODE_EMISSION) {
emission_node = link->fromnode;
@ -1414,7 +1414,7 @@ static void light_emission_node_to_energy(Light *light, float *energy, float col
}
}
if (emission_node == NULL) {
if (emission_node == nullptr) {
return;
}
@ -1536,12 +1536,12 @@ static void update_vector_math_node_add_and_subtract_operators(bNodeTree *ntree)
ELEM(node->custom1, NODE_VECTOR_MATH_ADD, NODE_VECTOR_MATH_SUBTRACT))
{
bNode *absNode = nodeAddStaticNode(NULL, ntree, SH_NODE_VECTOR_MATH);
bNode *absNode = nodeAddStaticNode(nullptr, ntree, SH_NODE_VECTOR_MATH);
absNode->custom1 = NODE_VECTOR_MATH_ABSOLUTE;
absNode->locx = node->locx + node->width + 20.0f;
absNode->locy = node->locy;
bNode *dotNode = nodeAddStaticNode(NULL, ntree, SH_NODE_VECTOR_MATH);
bNode *dotNode = nodeAddStaticNode(nullptr, ntree, SH_NODE_VECTOR_MATH);
dotNode->custom1 = NODE_VECTOR_MATH_DOT_PRODUCT;
dotNode->locx = absNode->locx + absNode->width + 20.0f;
dotNode->locy = absNode->locy;
@ -1627,7 +1627,7 @@ static void update_vector_math_node_cross_product_operator(bNodeTree *ntree)
if (node->custom1 == NODE_VECTOR_MATH_CROSS_PRODUCT) {
bNodeSocket *sockOutVector = nodeFindSocket(node, SOCK_OUT, "Vector");
if (version_node_socket_is_used(sockOutVector)) {
bNode *normalizeNode = nodeAddStaticNode(NULL, ntree, SH_NODE_VECTOR_MATH);
bNode *normalizeNode = nodeAddStaticNode(nullptr, ntree, SH_NODE_VECTOR_MATH);
normalizeNode->custom1 = NODE_VECTOR_MATH_NORMALIZE;
normalizeNode->locx = node->locx + node->width + 20.0f;
normalizeNode->locy = node->locy;
@ -1648,7 +1648,7 @@ static void update_vector_math_node_cross_product_operator(bNodeTree *ntree)
bNodeSocket *sockOutValue = nodeFindSocket(node, SOCK_OUT, "Value");
if (version_node_socket_is_used(sockOutValue)) {
bNode *lengthNode = nodeAddStaticNode(NULL, ntree, SH_NODE_VECTOR_MATH);
bNode *lengthNode = nodeAddStaticNode(nullptr, ntree, SH_NODE_VECTOR_MATH);
lengthNode->custom1 = NODE_VECTOR_MATH_LENGTH;
lengthNode->locx = node->locx + node->width + 20.0f;
if (version_node_socket_is_used(sockOutVector)) {
@ -1697,7 +1697,7 @@ static void update_vector_math_node_normalize_operator(bNodeTree *ntree)
{
bNodeSocket *sockOutVector = nodeFindSocket(node, SOCK_OUT, "Vector");
if (version_node_socket_is_used(sockOutVector)) {
bNode *lengthNode = nodeAddStaticNode(NULL, ntree, SH_NODE_VECTOR_MATH);
bNode *lengthNode = nodeAddStaticNode(nullptr, ntree, SH_NODE_VECTOR_MATH);
lengthNode->custom1 = NODE_VECTOR_MATH_LENGTH;
lengthNode->locx = node->locx + node->width + 20.0f;
lengthNode->locy = node->locy;
@ -1784,7 +1784,7 @@ static void update_vector_math_node_average_operator(bNodeTree *ntree)
node->custom1 = NODE_VECTOR_MATH_ADD;
bNodeSocket *sockOutVector = nodeFindSocket(node, SOCK_OUT, "Vector");
if (version_node_socket_is_used(sockOutVector)) {
bNode *normalizeNode = nodeAddStaticNode(NULL, ntree, SH_NODE_VECTOR_MATH);
bNode *normalizeNode = nodeAddStaticNode(nullptr, ntree, SH_NODE_VECTOR_MATH);
normalizeNode->custom1 = NODE_VECTOR_MATH_NORMALIZE;
normalizeNode->locx = node->locx + node->width + 20.0f;
normalizeNode->locy = node->locy;
@ -1805,7 +1805,7 @@ static void update_vector_math_node_average_operator(bNodeTree *ntree)
bNodeSocket *sockOutValue = nodeFindSocket(node, SOCK_OUT, "Value");
if (version_node_socket_is_used(sockOutValue)) {
bNode *lengthNode = nodeAddStaticNode(NULL, ntree, SH_NODE_VECTOR_MATH);
bNode *lengthNode = nodeAddStaticNode(nullptr, ntree, SH_NODE_VECTOR_MATH);
lengthNode->custom1 = NODE_VECTOR_MATH_LENGTH;
lengthNode->locx = node->locx + node->width + 20.0f;
if (version_node_socket_is_used(sockOutVector)) {
@ -1948,9 +1948,9 @@ static void update_mapping_node_inputs_and_properties(bNodeTree *ntree)
bNodeSocket *sockScale = nodeFindSocket(node, SOCK_IN, "Scale");
copy_v3_v3(version_cycles_node_socket_vector_value(sockScale), mapping->size);
bNode *maximumNode = NULL;
bNode *maximumNode = nullptr;
if (mapping->flag & TEXMAP_CLIP_MIN) {
maximumNode = nodeAddStaticNode(NULL, ntree, SH_NODE_VECTOR_MATH);
maximumNode = nodeAddStaticNode(nullptr, ntree, SH_NODE_VECTOR_MATH);
maximumNode->custom1 = NODE_VECTOR_MATH_MAXIMUM;
if (mapping->flag & TEXMAP_CLIP_MAX) {
maximumNode->locx = node->locx + (node->width + 20.0f) * 2.0f;
@ -1980,9 +1980,9 @@ static void update_mapping_node_inputs_and_properties(bNodeTree *ntree)
need_update = true;
}
bNode *minimumNode = NULL;
bNode *minimumNode = nullptr;
if (mapping->flag & TEXMAP_CLIP_MAX) {
minimumNode = nodeAddStaticNode(NULL, ntree, SH_NODE_VECTOR_MATH);
minimumNode = nodeAddStaticNode(nullptr, ntree, SH_NODE_VECTOR_MATH);
minimumNode->custom1 = NODE_VECTOR_MATH_MINIMUM;
minimumNode->locx = node->locx + node->width + 20.0f;
minimumNode->locy = node->locy;
@ -2014,7 +2014,7 @@ static void update_mapping_node_inputs_and_properties(bNodeTree *ntree)
}
MEM_freeN(node->storage);
node->storage = NULL;
node->storage = nullptr;
char node_name_esc[sizeof(node->name) * 2];
BLI_str_escape(node_name_esc, node->name, sizeof(node_name_esc));
@ -2136,7 +2136,7 @@ static void update_voronoi_node_crackle(bNodeTree *ntree)
{
tex->feature = SHD_VORONOI_F1;
bNode *voronoiNode = nodeAddStaticNode(NULL, ntree, SH_NODE_TEX_VORONOI);
bNode *voronoiNode = nodeAddStaticNode(nullptr, ntree, SH_NODE_TEX_VORONOI);
NodeTexVoronoi *texVoronoi = (NodeTexVoronoi *)voronoiNode->storage;
texVoronoi->feature = SHD_VORONOI_F2;
texVoronoi->distance = tex->distance;
@ -2176,7 +2176,7 @@ static void update_voronoi_node_crackle(bNodeTree *ntree)
sockVoronoiExponent);
}
bNode *subtractNode = nodeAddStaticNode(NULL, ntree, SH_NODE_MATH);
bNode *subtractNode = nodeAddStaticNode(nullptr, ntree, SH_NODE_MATH);
subtractNode->custom1 = NODE_MATH_SUBTRACT;
subtractNode->locx = voronoiNode->locx + voronoiNode->width + 20.0f;
subtractNode->locy = voronoiNode->locy;
@ -2267,7 +2267,7 @@ static void update_voronoi_node_square_distance(bNodeTree *ntree)
ELEM(tex->feature, SHD_VORONOI_F1, SHD_VORONOI_F2) &&
version_node_socket_is_used(sockDistance))
{
bNode *multiplyNode = nodeAddStaticNode(NULL, ntree, SH_NODE_MATH);
bNode *multiplyNode = nodeAddStaticNode(nullptr, ntree, SH_NODE_MATH);
multiplyNode->custom1 = NODE_MATH_MULTIPLY;
multiplyNode->locx = node->locx + node->width + 20.0f;
multiplyNode->locy = node->locy;
@ -2313,11 +2313,11 @@ static void update_noise_and_wave_distortion(bNodeTree *ntree)
bNodeSocket *sockDistortion = nodeFindSocket(node, SOCK_IN, "Distortion");
float *distortion = version_cycles_node_socket_float_value(sockDistortion);
if (version_node_socket_is_used(sockDistortion) && sockDistortion->link != NULL) {
if (version_node_socket_is_used(sockDistortion) && sockDistortion->link != nullptr) {
bNode *distortionInputNode = sockDistortion->link->fromnode;
bNodeSocket *distortionInputSock = sockDistortion->link->fromsock;
bNode *mulNode = nodeAddStaticNode(NULL, ntree, SH_NODE_MATH);
bNode *mulNode = nodeAddStaticNode(nullptr, ntree, SH_NODE_MATH);
mulNode->custom1 = NODE_MATH_MULTIPLY;
mulNode->locx = node->locx;
mulNode->locy = node->locy - 240.0f;

View File

@ -354,13 +354,13 @@ float *version_cycles_node_socket_vector_value(bNodeSocket *socket)
IDProperty *version_cycles_properties_from_ID(ID *id)
{
IDProperty *idprop = IDP_GetProperties(id, false);
return (idprop) ? IDP_GetPropertyTypeFromGroup(idprop, "cycles", IDP_GROUP) : NULL;
return (idprop) ? IDP_GetPropertyTypeFromGroup(idprop, "cycles", IDP_GROUP) : nullptr;
}
IDProperty *version_cycles_properties_from_view_layer(ViewLayer *view_layer)
{
IDProperty *idprop = view_layer->id_properties;
return (idprop) ? IDP_GetPropertyTypeFromGroup(idprop, "cycles", IDP_GROUP) : NULL;
return (idprop) ? IDP_GetPropertyTypeFromGroup(idprop, "cycles", IDP_GROUP) : nullptr;
}
float version_cycles_property_float(IDProperty *idprop, const char *name, float default_value)
@ -401,5 +401,5 @@ void version_cycles_property_boolean_set(IDProperty *idprop, const char *name, b
IDProperty *version_cycles_visibility_properties_from_ID(ID *id)
{
IDProperty *idprop = IDP_GetProperties(id, false);
return (idprop) ? IDP_GetPropertyTypeFromGroup(idprop, "cycles_visibility", IDP_GROUP) : NULL;
return (idprop) ? IDP_GetPropertyTypeFromGroup(idprop, "cycles_visibility", IDP_GROUP) : nullptr;
}

View File

@ -1512,7 +1512,6 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
}
}
/* updating stepsize for ghost drawing */
for (arm = bmain->armatures.first; arm; arm = arm->id.next) {
bone_version_239(&arm->bonebase);
if (arm->layer == 0) {

View File

@ -9,7 +9,6 @@ set(INC
../blentranslation
../depsgraph
../makesdna
../../../intern/atomic
../../../intern/clog
../../../intern/eigen
../../../intern/guardedalloc
@ -173,6 +172,7 @@ set(LIB
bf_blenkernel
bf_blenlib
extern_rangetree
PRIVATE bf_intern_atomic
)
if(WITH_BULLET)

View File

@ -24,7 +24,6 @@ if(WITH_COMPOSITOR_CPU)
../render
../render/intern
../../../extern/clew/include
../../../intern/atomic
../../../intern/clog
../../../intern/guardedalloc
@ -603,6 +602,7 @@ if(WITH_COMPOSITOR_CPU)
bf_blenkernel
bf_blenlib
extern_clew
PRIVATE bf_intern_atomic
)
list(APPEND INC

View File

@ -62,7 +62,7 @@ void ImageNode::convert_to_operations(NodeConverter &converter,
int framenumber = context.get_framenumber();
bool output_straight_alpha = (editor_node->custom1 & CMP_NODE_IMAGE_USE_STRAIGHT_OUTPUT) != 0;
BKE_image_user_frame_calc(image, imageuser, context.get_framenumber());
/* force a load, we assume iuser index will be set OK anyway */
/* Force a load, we assume #ImageUser index will be set OK anyway. */
if (image && image->type == IMA_TYPE_MULTILAYER) {
bool is_multilayer_ok = false;
ImBuf *ibuf = BKE_image_acquire_ibuf(image, imageuser, nullptr);

View File

@ -289,7 +289,7 @@ void ShaderOperation::populate_results_for_node(DNode node, GPUMaterial *materia
doutput, [&](DNode node) { return !compile_unit_.contains(node); });
/* If the output is used as the node preview, then an output result needs to be populated for
* it, and we additionally keep track of that output to later compute the previes from. */
* it, and we additionally keep track of that output to later compute the previews from. */
const bool is_preview_output = doutput == preview_output;
if (is_preview_output) {
preview_outputs_.add(doutput);

View File

@ -14,7 +14,6 @@ set(INC
../modifiers
../sequencer
../windowmanager
../../../intern/atomic
../../../intern/guardedalloc
# RNA_prototypes.h
${CMAKE_BINARY_DIR}/source/blender/makesrna
@ -156,6 +155,7 @@ set(SRC
set(LIB
bf_blenkernel
PRIVATE bf_intern_atomic
)
if(WITH_PYTHON)

View File

@ -29,7 +29,6 @@ set(INC
../compositor/realtime_compositor/cached_resources
../windowmanager
../../../intern/atomic
../../../intern/clog
../../../intern/guardedalloc
../../../intern/opensubdiv
@ -357,6 +356,7 @@ set(LIB
bf_blenlib
bf_realtime_compositor
bf_windowmanager
PRIVATE bf_intern_atomic
)
set(GLSL_SRC

View File

@ -651,8 +651,10 @@ void EEVEE_render_draw(EEVEE_Data *vedata, RenderEngine *engine, RenderLayer *rl
/* Post Process */
EEVEE_draw_effects(sldata, vedata);
/* XXX Seems to fix TDR issue with NVidia drivers on linux. */
GPU_finish();
/* NOTE(@fclem): Seems to fix TDR issue with NVidia drivers. */
if (GPU_type_matches_ex(GPU_DEVICE_NVIDIA, GPU_OS_ANY, GPU_DRIVER_ANY, GPU_BACKEND_OPENGL)) {
GPU_finish();
}
/* Perform render step between samples to allow
* flushing of freed GPUBackend resources. */

View File

@ -642,7 +642,7 @@ void EEVEE_volumes_output_accumulate(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_
EEVEE_EffectsInfo *effects = vedata->stl->effects;
if (fbl->volumetric_accum_fb != NULL) {
/* Accum pass */
/* Accumulation pass. */
GPU_framebuffer_bind(fbl->volumetric_accum_fb);
/* Clear texture. */

View File

@ -43,7 +43,7 @@ class IrradianceBake {
Framebuffer empty_raster_fb_ = {"empty_raster_fb_"};
/** Evaluate light object contribution and store result to surfel. */
PassSimple surfel_light_eval_ps_ = {"LightEval"};
/** Create linked list of surfel to emulated raycast. */
/** Create linked list of surfel to emulated ray-cast. */
PassSimple surfel_ray_build_ps_ = {"RayBuild"};
/** Propagate light from surfel to surfel. */
PassSimple surfel_light_propagate_ps_ = {"LightPropagate"};

View File

@ -63,7 +63,7 @@ class LightBake {
/** Manager used for command submission. Created and freed in the worker thread. */
draw::Manager *manager_ = nullptr;
/** Lightprobe original objects to bake. */
/** Light-probe original objects to bake. */
Vector<Object *> original_probes_;
/** Frame to copy to original objects during update. This is needed to avoid race conditions. */
Vector<LightProbeGridCacheFrame *> bake_result_;
@ -245,7 +245,7 @@ class LightBake {
/* Bind context without GPU_render_begin(). */
context_enable(false);
/* Free GPU data (Textures, Framebuffers, etc...). */
/* Free GPU data (Textures, Frame-buffers, etc...). */
delete instance_;
delete manager_;

View File

@ -122,7 +122,7 @@ void LightProbeModule::end_sync()
if (grid_update_) {
light_cache->flag |= LIGHTCACHE_UPDATE_GRID;
}
/* TODO(fclem): Reflection Cubemap should capture albedo + normal and be
/* TODO(fclem): Reflection Cube-map should capture albedo + normal and be
* relit at runtime. So no dependency like in the old system. */
if (cube_update_) {
light_cache->flag |= LIGHTCACHE_UPDATE_CUBE;

View File

@ -328,7 +328,7 @@ struct AOVsInfoData {
uint value_len;
/** Id of the AOV to be displayed (from the start of the AOV array). -1 for combined. */
int display_id;
/** True if the AOV to be displayed is from the value accum buffer. */
/** True if the AOV to be displayed is from the value accumulation buffer. */
bool1 display_is_value;
};
BLI_STATIC_ASSERT_ALIGN(AOVsInfoData, 16)
@ -884,7 +884,7 @@ struct CaptureInfoData {
float sample_count;
/** 0 based sample index. */
float sample_index;
/** Transform of the lightprobe object. */
/** Transform of the light-probe object. */
float4x4 irradiance_grid_local_to_world;
/** Transform vectors from world space to local space. Does not have location component. */
/** TODO(fclem): This could be a float3x4 or a float3x3 if padded correctly. */

View File

@ -211,6 +211,7 @@ static void OVERLAY_cache_init(void *vedata)
case CTX_MODE_SCULPT_CURVES:
OVERLAY_sculpt_curves_cache_init(data);
break;
case CTX_MODE_EDIT_POINT_CLOUD:
case CTX_MODE_OBJECT:
break;
default:

View File

@ -247,6 +247,7 @@ bool Instance::object_is_edit_mode(const Object *ob)
case OB_CURVES:
return state.ctx_mode == CTX_MODE_EDIT_CURVES;
case OB_POINTCLOUD:
return state.ctx_mode == CTX_MODE_EDIT_POINT_CLOUD;
case OB_VOLUME:
/* No edit mode yet. */
return false;

View File

@ -31,8 +31,10 @@ enum SculptBatchFeature {
};
ENUM_OPERATORS(SculptBatchFeature, SCULPT_BATCH_UV);
/** Used by engines that don't use GPUMaterials, like the Workbench and Overlay engines. */
Vector<SculptBatch> sculpt_batches_get(Object *ob, SculptBatchFeature features);
/** Used by EEVEE. */
Vector<SculptBatch> sculpt_batches_per_material_get(Object *ob,
MutableSpan<GPUMaterial *> materials);

View File

@ -1160,22 +1160,22 @@ static void test_eevee_surfel_list()
Surfel surfel;
/* NOTE: Expected link assumes linear increasing processing order [0->5]. But this is
* multithreaded and we can't know the execution order in advance. */
/* 0: Project to (1, 0) = list 1. Unsorted Next = -1; Next = -1; Prev = 3. */
/* 0: Project to (1, 0) = list 1. Unsorted Next = -1; Next = -1; Previous = 3. */
surfel.position = {1.1f, 0.1f, 0.1f};
surfel_buf.append(surfel);
/* 1: Project to (1, 0) = list 1. Unsorted Next = 0; Next = 2; Prev = -1. */
/* 1: Project to (1, 0) = list 1. Unsorted Next = 0; Next = 2; Previous = -1. */
surfel.position = {1.1f, 0.2f, 0.5f};
surfel_buf.append(surfel);
/* 2: Project to (1, 0) = list 1. Unsorted Next = 1; Next = 3; Prev = 1. */
/* 2: Project to (1, 0) = list 1. Unsorted Next = 1; Next = 3; Previous = 1. */
surfel.position = {1.1f, 0.3f, 0.3f};
surfel_buf.append(surfel);
/* 3: Project to (1, 0) = list 1. Unsorted Next = 2; Next = 0; Prev = 2. */
/* 3: Project to (1, 0) = list 1. Unsorted Next = 2; Next = 0; Previous = 2. */
surfel.position = {1.2f, 0.4f, 0.2f};
surfel_buf.append(surfel);
/* 4: Project to (1, 1) = list 3. Unsorted Next = -1; Next = -1; Prev = -1. */
/* 4: Project to (1, 1) = list 3. Unsorted Next = -1; Next = -1; Previous = -1. */
surfel.position = {1.0f, 1.0f, 0.5f};
surfel_buf.append(surfel);
/* 5: Project to (0, 1) = list 2. Unsorted Next = -1; Next = -1; Prev = -1. */
/* 5: Project to (0, 1) = list 2. Unsorted Next = -1; Next = -1; Previous = -1. */
surfel.position = {0.1f, 1.1f, 0.5f};
surfel_buf.append(surfel);
@ -1225,7 +1225,7 @@ static void test_eevee_surfel_list()
list_start_buf.read();
surfel_buf.read();
/* NOTE: All of these are unstable by definition (atomic + multithread).
/* NOTE: All of these are unstable by definition (atomic + multi-thread).
* But should be consistent since we only dispatch one thread-group. */
/* Expect last added surfel index. It is the list start index before sorting. */
Vector<int> expect_list_start = {-1, 3, 5, 4};

File diff suppressed because it is too large Load Diff

View File

@ -119,7 +119,7 @@ short ANIM_fcurve_keyframes_loop(KeyframeEditData *ked,
}
}
/* unset the F-Curve from the editdata now that it's done */
/* Unset the F-Curve from the edit-data now that it's done. */
if (ked) {
ked->fcu = nullptr;
ked->curIndex = 0;

View File

@ -111,7 +111,7 @@ static void GREASE_PENCIL_OT_layer_remove(wmOperatorType *ot)
static const EnumPropertyItem prop_layer_reorder_location[] = {
{LAYER_REORDER_ABOVE, "ABOVE", 0, "Above", ""},
{LAYER_REORDER_BELOW, "BELOW", 0, "Below", ""},
{0, NULL, 0, NULL, NULL},
{0, nullptr, 0, nullptr, nullptr},
};
static int grease_pencil_layer_reorder_exec(bContext *C, wmOperator *op)
@ -120,17 +120,18 @@ static int grease_pencil_layer_reorder_exec(bContext *C, wmOperator *op)
Object *object = CTX_data_active_object(C);
GreasePencil &grease_pencil = *static_cast<GreasePencil *>(object->data);
if (!grease_pencil.has_active_layer()) {
return OPERATOR_CANCELLED;
}
int target_layer_name_length;
char *target_layer_name = RNA_string_get_alloc(
op->ptr, "target_layer_name", nullptr, 0, &target_layer_name_length);
const int reorder_location = RNA_enum_get(op->ptr, "location");
if (!grease_pencil.has_active_layer()) {
return OPERATOR_CANCELLED;
}
Layer *target_layer = grease_pencil.find_layer_by_name(target_layer_name);
if (!target_layer) {
MEM_SAFE_FREE(target_layer_name);
return OPERATOR_CANCELLED;
}

View File

@ -574,7 +574,7 @@ typedef struct bAnimChannelType {
/** Get name (for channel lists). */
void (*name)(bAnimListElem *ale, char *name);
/** Get RNA property+pointer for editing the name. */
bool (*name_prop)(bAnimListElem *ale, struct PointerRNA *ptr, struct PropertyRNA **prop);
bool (*name_prop)(bAnimListElem *ale, struct PointerRNA *r_ptr, struct PropertyRNA **r_prop);
/** Get icon (for channel lists). */
int (*icon)(bAnimListElem *ale);
@ -582,13 +582,13 @@ typedef struct bAnimChannelType {
/** Check if the given setting is valid in the current context. */
bool (*has_setting)(bAnimContext *ac, bAnimListElem *ale, eAnimChannel_Settings setting);
/** Get the flag used for this setting. */
int (*setting_flag)(bAnimContext *ac, eAnimChannel_Settings setting, bool *neg);
int (*setting_flag)(bAnimContext *ac, eAnimChannel_Settings setting, bool *r_neg);
/**
* Get the pointer to int/short where data is stored,
* with type being `sizeof(ptr_data)` which should be fine for runtime use.
* - assume that setting has been checked to be valid for current context.
*/
void *(*setting_ptr)(bAnimListElem *ale, eAnimChannel_Settings setting, short *type);
void *(*setting_ptr)(bAnimListElem *ale, eAnimChannel_Settings setting, short *r_type);
} bAnimChannelType;
/** \} */

View File

@ -126,7 +126,6 @@ int BIF_countTransformOrientation(const struct bContext *C);
#define P_CURSOR_EDIT (1 << 16)
#define P_CLNOR_INVALIDATE (1 << 17)
#define P_VIEW2D_EDGE_PAN (1 << 18)
#define P_VIEW3D_NAVIGATION (1 << 19)
/* For properties performed when confirming the transformation. */
#define P_POST_TRANSFORM (1 << 20)

View File

@ -223,7 +223,7 @@ static int eyedropper_colorband_modal(bContext *C, wmOperator *op, const wmEvent
return is_undo ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
}
case EYE_MODAL_SAMPLE_BEGIN:
/* enable accum and make first sample */
/* Enable accumulate and make first sample. */
eye->sample_start = true;
eyedropper_colorband_sample_point(C, eye, event->xy);
eyedropper_colorband_apply(C, op);

View File

@ -82,8 +82,8 @@ class LayerViewItem : public AbstractTreeViewItem {
{
uiBut *but = uiItemL_ex(
&row, IFACE_(layer_.name().c_str()), ICON_OUTLINER_DATA_GP_LAYER, false, false);
if (layer_.is_locked()) {
UI_but_disable(but, "Layer is locked");
if (layer_.is_locked() || !layer_.parent_group().is_visible()) {
UI_but_disable(but, "Layer is locked or not visible");
}
}
@ -99,21 +99,65 @@ class LayerViewItem : public AbstractTreeViewItem {
class LayerGroupViewItem : public AbstractTreeViewItem {
public:
LayerGroupViewItem(/*GreasePencil &grease_pencil, */ LayerGroup &group)
: /*grease_pencil_(grease_pencil),*/ group_(group)
LayerGroupViewItem(GreasePencil &grease_pencil, LayerGroup &group)
: grease_pencil_(grease_pencil), group_(group)
{
this->disable_activatable();
this->label_ = group_.name();
}
void build_row(uiLayout &row) override
{
build_layer_group_name(row);
uiLayout *sub = uiLayoutRow(&row, true);
uiItemL(sub, IFACE_(group_.name().c_str()), ICON_FILE_FOLDER);
uiLayoutSetPropDecorate(sub, false);
build_layer_group_buttons(*sub);
}
bool supports_collapsing() const override
{
return true;
}
bool supports_renaming() const override
{
return true;
}
bool rename(StringRefNull new_name) override
{
grease_pencil_.rename_group(group_, new_name);
return true;
}
StringRef get_rename_string() const override
{
return group_.name();
}
private:
/* GreasePencil &grease_pencil_; */
GreasePencil &grease_pencil_;
LayerGroup &group_;
void build_layer_group_name(uiLayout &row)
{
uiItemS_ex(&row, 0.8f);
uiBut *but = uiItemL_ex(&row, IFACE_(group_.name().c_str()), ICON_FILE_FOLDER, false, false);
if (group_.is_locked()) {
UI_but_disable(but, "Layer Group is locked");
}
}
void build_layer_group_buttons(uiLayout &row)
{
PointerRNA group_ptr;
RNA_pointer_create(&grease_pencil_.id, &RNA_GreasePencilLayerGroup, &group_, &group_ptr);
uiItemR(&row, &group_ptr, "hide", UI_ITEM_R_ICON_ONLY, nullptr, 0);
uiItemR(&row, &group_ptr, "lock", UI_ITEM_R_ICON_ONLY, nullptr, 0);
}
};
class LayerTreeView : public AbstractTreeView {
@ -123,20 +167,24 @@ class LayerTreeView : public AbstractTreeView {
void build_tree() override;
private:
void build_tree_node_recursive(TreeNode &node);
void build_tree_node_recursive(TreeViewOrItem &parent, TreeNode &node);
GreasePencil &grease_pencil_;
};
void LayerTreeView::build_tree_node_recursive(TreeNode &node)
void LayerTreeView::build_tree_node_recursive(TreeViewOrItem &parent, TreeNode &node)
{
using namespace blender::bke::greasepencil;
if (node.is_layer()) {
add_tree_item<LayerViewItem>(this->grease_pencil_, node.as_layer_for_write());
LayerViewItem &item = parent.add_tree_item<LayerViewItem>(this->grease_pencil_,
node.as_layer_for_write());
item.set_collapsed(false);
}
else if (node.is_group()) {
add_tree_item<LayerGroupViewItem>(/*this->grease_pencil_, */ node.as_group_for_write());
LayerGroupViewItem &group_item = parent.add_tree_item<LayerGroupViewItem>(
this->grease_pencil_, node.as_group_for_write());
group_item.set_collapsed(false);
LISTBASE_FOREACH_BACKWARD (GreasePencilLayerTreeNode *, node_, &node.as_group().children) {
build_tree_node_recursive(node_->wrap());
build_tree_node_recursive(group_item, node_->wrap());
}
}
}
@ -147,7 +195,7 @@ void LayerTreeView::build_tree()
LISTBASE_FOREACH_BACKWARD (
GreasePencilLayerTreeNode *, node, &this->grease_pencil_.root_group.children)
{
this->build_tree_node_recursive(node->wrap());
this->build_tree_node_recursive(*this, node->wrap());
}
}

View File

@ -687,7 +687,7 @@ static bool ED_object_editmode_load_free_ex(Main *bmain,
ED_mball_editmball_free(obedit);
}
}
else if (ELEM(obedit->type, OB_CURVES, OB_GREASE_PENCIL)) {
else if (ELEM(obedit->type, OB_CURVES, OB_GREASE_PENCIL, OB_POINTCLOUD)) {
/* Object doesn't have specific edit mode data, so pass. */
}
else {
@ -883,6 +883,10 @@ bool ED_object_editmode_enter_ex(Main *bmain, Scene *scene, Object *ob, int flag
ok = true;
WM_main_add_notifier(NC_SCENE | ND_MODE | NS_EDITMODE_GREASE_PENCIL, scene);
}
else if (ob->type == OB_POINTCLOUD) {
ok = true;
WM_main_add_notifier(NC_SCENE | ND_MODE | NS_EDITMODE_POINT_CLOUD, scene);
}
if (ok) {
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);

View File

@ -130,6 +130,7 @@ bool ED_object_mode_compat_test(const Object *ob, eObjectMode mode)
case OB_SURF:
case OB_FONT:
case OB_MBALL:
case OB_POINTCLOUD:
if (mode & OB_MODE_EDIT) {
return true;
}

View File

@ -480,7 +480,7 @@ static int rigidbody_objects_calc_mass_exec(bContext *C, wmOperator *op)
density = RNA_float_get(op->ptr, "density");
}
/* apply this to all selected objects (with rigidbodies)... */
/* Apply this to all selected objects (with rigid-bodies). */
CTX_DATA_BEGIN (C, Object *, ob, selected_objects) {
if (ob->rigidbody_object) {
PointerRNA ptr;

View File

@ -822,7 +822,7 @@ static bool azone_clipped_rect_calc(const AZone *az, rcti *r_rect_clip)
static void area_actionzone_get_rect(AZone *az, rcti *rect)
{
if (az->type == AZONE_REGION_SCROLL) {
/* For scroll azones use the area around the region's scrollbar location. */
/* For scroll azones use the area around the region's scroll-bar location. */
rcti scroller_vert = (az->direction == AZ_SCROLL_HOR) ? az->region->v2d.hor :
az->region->v2d.vert;
BLI_rcti_translate(&scroller_vert, az->region->winrct.xmin, az->region->winrct.ymin);

View File

@ -20,7 +20,6 @@ set(INC
../../nodes
../../render
../../windowmanager
../../../../intern/atomic
../../../../intern/clog
../../../../intern/eigen
../../../../intern/guardedalloc
@ -98,6 +97,7 @@ set(SRC
set(LIB
bf_blenkernel
bf_blenlib
PRIVATE bf_intern_atomic
)
if(WITH_TBB)

View File

@ -52,11 +52,6 @@ struct PaintOperationExecutor {
* original object.
*/
GreasePencil &grease_pencil = *static_cast<GreasePencil *>(ob_eval->data);
if (!grease_pencil.has_active_layer()) {
/* TODO: create a new layer. */
BLI_assert_unreachable();
// grease_pencil.runtime->set_active_layer_index(0);
}
float4 plane{0.0f, -1.0f, 0.0f, 0.0f};
float3 proj_pos;
@ -87,12 +82,9 @@ void PaintOperation::on_stroke_done(const bContext &C)
GreasePencil &grease_pencil_orig = *static_cast<GreasePencil *>(obact->data);
GreasePencil &grease_pencil_eval = *static_cast<GreasePencil *>(ob_eval->data);
BLI_assert(grease_pencil_orig.has_active_layer() && grease_pencil_eval.has_active_layer());
BLI_assert(grease_pencil_orig.has_active_layer());
const bke::greasepencil::Layer &active_layer_orig = *grease_pencil_orig.get_active_layer();
const bke::greasepencil::Layer &active_layer_eval = *grease_pencil_eval.get_active_layer();
int index_orig = active_layer_orig.drawing_index_at(scene->r.cfra);
int index_eval = active_layer_eval.drawing_index_at(scene->r.cfra);
BLI_assert(index_orig != -1 && index_eval != -1);
bke::greasepencil::Drawing &drawing_orig =
reinterpret_cast<GreasePencilDrawing *>(grease_pencil_orig.drawings()[index_orig])->wrap();

View File

@ -1051,6 +1051,11 @@ bool paint_space_stroke_enabled(Brush *br, ePaintMode mode)
return false;
}
if (mode == PAINT_MODE_GPENCIL) {
/* No spacing needed for now. */
return false;
}
return paint_supports_dynamic_size(br, mode);
}

View File

@ -17,7 +17,6 @@ set(INC
../../makesrna
../../render
../../windowmanager
../../../../intern/atomic
../../../../intern/guardedalloc
../../../../extern/fmtlib/include
@ -52,6 +51,7 @@ set(SRC
set(LIB
bf_blenkernel
extern_fmtlib
PRIVATE bf_intern_atomic
)
if(WIN32)

View File

@ -1049,6 +1049,9 @@ void fsmenu_read_system(FSMenu *fsmenu, int read_bookmarks)
FS_UDIR_PATH(U.fontdir, ICON_FILE_FONT)
FS_UDIR_PATH(U.textudir, ICON_FILE_IMAGE)
LISTBASE_FOREACH (bUserScriptDirectory *, script_dir, &U.script_directories) {
if (UNLIKELY(script_dir->dir_path[0] == '\0')) {
continue;
}
fsmenu_insert_entry(fsmenu,
FS_CATEGORY_OTHER,
script_dir->dir_path,

View File

@ -1202,7 +1202,7 @@ void uiTemplateImageInfo(uiLayout *layout, bContext *C, Image *ima, ImageUser *i
const int len = MAX_IMAGE_INFO_LEN;
int ofs = 0;
ofs += BLI_snprintf_rlen(str + ofs, len - ofs, TIP_("%d x %d, "), ibuf->x, ibuf->y);
ofs += BLI_snprintf_rlen(str + ofs, len - ofs, TIP_("%d \u00D7 %d, "), ibuf->x, ibuf->y);
if (ibuf->float_buffer.data) {
if (ibuf->channels != 4) {

View File

@ -1441,54 +1441,97 @@ static void id_override_library_reset_fn(bContext *C,
}
}
static void id_override_library_clear_single_fn(bContext *C,
static void id_override_library_clear_single_process(bContext *C,
ReportList * /*reports*/,
OutlinerLibOverrideData &data)
{
Main *bmain = CTX_data_main(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
Scene *scene = CTX_data_scene(C);
/* TODO: At some point this likely needs to be re-written as a BKE function instead, with better
* handling of hierarchies among other things. */
/* Try to process all potential leaves first (deleting some liboverride leaves will turn other
* liboverrides into leaves as well). */
bool do_process_leaves = true;
while (!data.id_hierarchy_roots.is_empty()) {
bool has_found_leaves = false;
for (auto &&id : data.id_hierarchy_roots.keys()) {
if (do_process_leaves) {
if (BKE_lib_override_library_is_hierarchy_leaf(bmain, id)) {
/* If given ID is not using any other override (it's a 'leaf' in the override hierarchy),
* delete it and remap its usages to its linked reference. Otherwise, keep it as a reset
* system override. */
bool do_remap_active = false;
BKE_view_layer_synced_ensure(scene, view_layer);
if (BKE_view_layer_active_object_get(view_layer) == reinterpret_cast<Object *>(id)) {
BLI_assert(GS(id->name) == ID_OB);
do_remap_active = true;
}
BKE_libblock_remap(
bmain, id, id->override_library->reference, ID_REMAP_SKIP_INDIRECT_USAGE);
if (do_remap_active) {
Object *ref_object = reinterpret_cast<Object *>(id->override_library->reference);
Base *basact = BKE_view_layer_base_find(view_layer, ref_object);
if (basact != nullptr) {
view_layer->basact = basact;
}
DEG_id_tag_update(&scene->id, ID_RECALC_SELECT);
}
BKE_id_delete(bmain, id);
data.id_hierarchy_roots.remove(id);
has_found_leaves = true;
}
}
else {
BLI_assert(!BKE_lib_override_library_is_hierarchy_leaf(bmain, id));
BKE_lib_override_library_id_reset(bmain, id, true);
data.id_hierarchy_roots.remove(id);
}
}
do_process_leaves = has_found_leaves;
}
DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS | ID_RECALC_COPY_ON_WRITE);
}
static void id_override_library_clear_single_fn(bContext * /*C*/,
ReportList *reports,
Scene *scene,
Scene * /*scene*/,
TreeElement * /*te*/,
TreeStoreElem * /*tsep*/,
TreeStoreElem *tselem,
void * /*user_data*/)
void *user_data)
{
OutlinerLibOverrideData *data = reinterpret_cast<OutlinerLibOverrideData *>(user_data);
BLI_assert(TSE_IS_REAL_ID(tselem));
Main *bmain = CTX_data_main(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
ID *id = tselem->id;
if (!ID_IS_OVERRIDE_LIBRARY_REAL(id) || ID_IS_LINKED(id)) {
if (!ID_IS_OVERRIDE_LIBRARY(id)) {
return;
}
if (!ID_IS_OVERRIDE_LIBRARY_REAL(id)) {
BKE_reportf(reports,
RPT_WARNING,
"Cannot clear embedded library override id '%s', only overrides of real "
"data-blocks can be directly deleted",
"Cannot clear embedded library override '%s', only overrides of real data-blocks "
"can be directly cleared",
id->name);
return;
}
/* If given ID is not using any other override (it's a 'leaf' in the override hierarchy),
* delete it and remap its usages to its linked reference. Otherwise, keep it as a reset system
* override. */
if (BKE_lib_override_library_is_hierarchy_leaf(bmain, id)) {
bool do_remap_active = false;
BKE_view_layer_synced_ensure(CTX_data_scene(C), view_layer);
if (BKE_view_layer_active_object_get(view_layer) == reinterpret_cast<Object *>(id)) {
BLI_assert(GS(id->name) == ID_OB);
do_remap_active = true;
}
BKE_libblock_remap(bmain, id, id->override_library->reference, ID_REMAP_SKIP_INDIRECT_USAGE);
if (do_remap_active) {
Object *ref_object = reinterpret_cast<Object *>(id->override_library->reference);
Base *basact = BKE_view_layer_base_find(view_layer, ref_object);
if (basact != nullptr) {
view_layer->basact = basact;
}
DEG_id_tag_update(&scene->id, ID_RECALC_SELECT);
}
BKE_id_delete(bmain, id);
}
else {
BKE_lib_override_library_id_reset(bmain, id, true);
if (ID_IS_LINKED(id)) {
BKE_reportf(
reports,
RPT_WARNING,
"Cannot clear linked library override '%s', only local overrides can be directly cleared",
id->name);
return;
}
DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS | ID_RECALC_COPY_ON_WRITE);
data->id_root_set(id);
}
static void id_override_library_resync_fn(bContext * /*C*/,
@ -1895,14 +1938,21 @@ static int outliner_liboverride_operation_exec(bContext *C, wmOperator *op)
break;
}
case OUTLINER_LIBOVERRIDE_OP_CLEAR_SINGLE: {
OutlinerLibOverrideData override_data{};
override_data.do_hierarchy = false;
override_data.do_fully_editable = false;
outliner_do_libdata_operation_selection_set(C,
op->reports,
scene,
space_outliner,
id_override_library_clear_single_fn,
selection_set,
nullptr,
&override_data,
false);
id_override_library_clear_single_process(C, op->reports, override_data);
ED_undo_push(C, "Clear Overridden Data");
break;
}

View File

@ -32,7 +32,7 @@ void TreeElementIDArmature::expand(SpaceOutliner &space_outliner) const
expand_animation_data(space_outliner, arm_.adt);
if (arm_.edbo) {
expandEditBones(space_outliner);
expand_edit_bones(space_outliner);
}
else {
/* do not extend Armature when we have posemode */
@ -43,12 +43,12 @@ void TreeElementIDArmature::expand(SpaceOutliner &space_outliner) const
/* pass */
}
else {
expandBones(space_outliner);
expand_bones(space_outliner);
}
}
}
void TreeElementIDArmature::expandEditBones(SpaceOutliner &space_outiner) const
void TreeElementIDArmature::expand_edit_bones(SpaceOutliner &space_outiner) const
{
int a = 0;
LISTBASE_FOREACH_INDEX (EditBone *, ebone, arm_.edbo, a) {
@ -94,7 +94,7 @@ static void outliner_add_bone(SpaceOutliner *space_outliner,
}
}
void TreeElementIDArmature::expandBones(SpaceOutliner &space_outliner) const
void TreeElementIDArmature::expand_bones(SpaceOutliner &space_outliner) const
{
int a = 0;
LISTBASE_FOREACH (Bone *, bone, &arm_.bonebase) {

View File

@ -25,8 +25,8 @@ class TreeElementIDArmature final : public TreeElementID {
void expand(SpaceOutliner &) const override;
private:
void expandEditBones(SpaceOutliner &) const;
void expandBones(SpaceOutliner &) const;
void expand_edit_bones(SpaceOutliner &) const;
void expand_bones(SpaceOutliner &) const;
};
} // namespace blender::ed::outliner

View File

@ -25,10 +25,10 @@ void TreeElementIDCurve::expand(SpaceOutliner &space_outliner) const
{
expand_animation_data(space_outliner, curve_.adt);
expandMaterials(space_outliner);
expand_materials(space_outliner);
}
void TreeElementIDCurve::expandMaterials(SpaceOutliner &space_outliner) const
void TreeElementIDCurve::expand_materials(SpaceOutliner &space_outliner) const
{
for (int a = 0; a < curve_.totcol; a++) {
outliner_add_element(

View File

@ -21,7 +21,7 @@ class TreeElementIDCurve final : public TreeElementID {
void expand(SpaceOutliner &) const override;
private:
void expandMaterials(SpaceOutliner &) const;
void expand_materials(SpaceOutliner &) const;
};
} // namespace blender::ed::outliner

View File

@ -28,10 +28,10 @@ void TreeElementIDGPLegacy::expand(SpaceOutliner &space_outliner) const
{
expand_animation_data(space_outliner, gpd_.adt);
expandLayers(space_outliner);
expand_layers(space_outliner);
}
void TreeElementIDGPLegacy::expandLayers(SpaceOutliner &space_outliner) const
void TreeElementIDGPLegacy::expand_layers(SpaceOutliner &space_outliner) const
{
int index = 0;
LISTBASE_FOREACH_BACKWARD (bGPDlayer *, gpl, &gpd_.layers) {

View File

@ -21,7 +21,7 @@ class TreeElementIDGPLegacy final : public TreeElementID {
void expand(SpaceOutliner &) const override;
private:
void expandLayers(SpaceOutliner &) const;
void expand_layers(SpaceOutliner &) const;
};
} // namespace blender::ed::outliner

View File

@ -28,10 +28,10 @@ void TreeElementIDLineStyle::expand(SpaceOutliner &space_outliner) const
{
expand_animation_data(space_outliner, linestyle_.adt);
expandTextures(space_outliner);
expand_textures(space_outliner);
}
void TreeElementIDLineStyle::expandTextures(SpaceOutliner &space_outliner) const
void TreeElementIDLineStyle::expand_textures(SpaceOutliner &space_outliner) const
{
for (int a = 0; a < MAX_MTEX; a++) {
if (linestyle_.mtex[a]) {

View File

@ -23,7 +23,7 @@ class TreeElementIDLineStyle final : public TreeElementID {
void expand(SpaceOutliner &) const override;
private:
void expandTextures(SpaceOutliner &) const;
void expand_textures(SpaceOutliner &) const;
};
} // namespace blender::ed::outliner

View File

@ -25,17 +25,17 @@ void TreeElementIDMesh::expand(SpaceOutliner &space_outliner) const
{
expand_animation_data(space_outliner, mesh_.adt);
expandKey(space_outliner);
expandMaterials(space_outliner);
expand_key(space_outliner);
expand_materials(space_outliner);
}
void TreeElementIDMesh::expandKey(SpaceOutliner &space_outliner) const
void TreeElementIDMesh::expand_key(SpaceOutliner &space_outliner) const
{
outliner_add_element(
&space_outliner, &legacy_te_.subtree, mesh_.key, &legacy_te_, TSE_SOME_ID, 0);
}
void TreeElementIDMesh::expandMaterials(SpaceOutliner &space_outliner) const
void TreeElementIDMesh::expand_materials(SpaceOutliner &space_outliner) const
{
for (int a = 0; a < mesh_.totcol; a++) {
outliner_add_element(

View File

@ -21,8 +21,8 @@ class TreeElementIDMesh final : public TreeElementID {
void expand(SpaceOutliner &) const override;
private:
void expandKey(SpaceOutliner &) const;
void expandMaterials(SpaceOutliner &) const;
void expand_key(SpaceOutliner &) const;
void expand_materials(SpaceOutliner &) const;
};
} // namespace blender::ed::outliner

View File

@ -25,10 +25,10 @@ void TreeElementIDMetaBall::expand(SpaceOutliner &space_outliner) const
{
expand_animation_data(space_outliner, metaball_.adt);
expandMaterials(space_outliner);
expand_materials(space_outliner);
}
void TreeElementIDMetaBall::expandMaterials(SpaceOutliner &space_outliner) const
void TreeElementIDMetaBall::expand_materials(SpaceOutliner &space_outliner) const
{
for (int a = 0; a < metaball_.totcol; a++) {
outliner_add_element(

View File

@ -23,7 +23,7 @@ class TreeElementIDMetaBall final : public TreeElementID {
void expand(SpaceOutliner &) const override;
private:
void expandMaterials(SpaceOutliner &) const;
void expand_materials(SpaceOutliner &) const;
};
} // namespace blender::ed::outliner

View File

@ -40,24 +40,24 @@ void TreeElementIDObject::expand(SpaceOutliner &space_outliner) const
expand_animation_data(space_outliner, object_.adt);
expandData(space_outliner);
expandPose(space_outliner);
expandMaterials(space_outliner);
expandConstraints(space_outliner);
expandModifiers(space_outliner);
expandGPencilModifiers(space_outliner);
expandGPencilEffects(space_outliner);
expandVertexGroups(space_outliner);
expandDuplicatedGroup(space_outliner);
expand_data(space_outliner);
expand_pose(space_outliner);
expand_materials(space_outliner);
expand_constraints(space_outliner);
expand_modifiers(space_outliner);
expand_gpencil_modifiers(space_outliner);
expand_gpencil_effects(space_outliner);
expand_vertex_groups(space_outliner);
expand_duplicated_group(space_outliner);
}
void TreeElementIDObject::expandData(SpaceOutliner &space_outliner) const
void TreeElementIDObject::expand_data(SpaceOutliner &space_outliner) const
{
outliner_add_element(
&space_outliner, &legacy_te_.subtree, object_.data, &legacy_te_, TSE_SOME_ID, 0);
}
void TreeElementIDObject::expandPose(SpaceOutliner &space_outliner) const
void TreeElementIDObject::expand_pose(SpaceOutliner &space_outliner) const
{
if (!object_.pose) {
return;
@ -129,7 +129,7 @@ void TreeElementIDObject::expandPose(SpaceOutliner &space_outliner) const
}
}
void TreeElementIDObject::expandMaterials(SpaceOutliner &space_outliner) const
void TreeElementIDObject::expand_materials(SpaceOutliner &space_outliner) const
{
for (int a = 0; a < object_.totcol; a++) {
outliner_add_element(
@ -137,7 +137,7 @@ void TreeElementIDObject::expandMaterials(SpaceOutliner &space_outliner) const
}
}
void TreeElementIDObject::expandConstraints(SpaceOutliner &space_outliner) const
void TreeElementIDObject::expand_constraints(SpaceOutliner &space_outliner) const
{
if (BLI_listbase_is_empty(&object_.constraints)) {
return;
@ -156,7 +156,7 @@ void TreeElementIDObject::expandConstraints(SpaceOutliner &space_outliner) const
}
}
void TreeElementIDObject::expandModifiers(SpaceOutliner &space_outliner) const
void TreeElementIDObject::expand_modifiers(SpaceOutliner &space_outliner) const
{
if (BLI_listbase_is_empty(&object_.modifiers)) {
return;
@ -212,7 +212,7 @@ void TreeElementIDObject::expandModifiers(SpaceOutliner &space_outliner) const
}
}
void TreeElementIDObject::expandGPencilModifiers(SpaceOutliner &space_outliner) const
void TreeElementIDObject::expand_gpencil_modifiers(SpaceOutliner &space_outliner) const
{
if (BLI_listbase_is_empty(&object_.greasepencil_modifiers)) {
return;
@ -255,7 +255,7 @@ void TreeElementIDObject::expandGPencilModifiers(SpaceOutliner &space_outliner)
}
}
void TreeElementIDObject::expandGPencilEffects(SpaceOutliner &space_outliner) const
void TreeElementIDObject::expand_gpencil_effects(SpaceOutliner &space_outliner) const
{
if (BLI_listbase_is_empty(&object_.shader_fx)) {
return;
@ -282,7 +282,7 @@ void TreeElementIDObject::expandGPencilEffects(SpaceOutliner &space_outliner) co
}
}
void TreeElementIDObject::expandVertexGroups(SpaceOutliner &space_outliner) const
void TreeElementIDObject::expand_vertex_groups(SpaceOutliner &space_outliner) const
{
if (!ELEM(object_.type, OB_MESH, OB_GPENCIL_LEGACY, OB_LATTICE)) {
return;
@ -304,7 +304,7 @@ void TreeElementIDObject::expandVertexGroups(SpaceOutliner &space_outliner) cons
}
}
void TreeElementIDObject::expandDuplicatedGroup(SpaceOutliner &space_outliner) const
void TreeElementIDObject::expand_duplicated_group(SpaceOutliner &space_outliner) const
{
if (object_.instance_collection && (object_.transflag & OB_DUPLICOLLECTION)) {
outliner_add_element(&space_outliner,

View File

@ -21,15 +21,15 @@ class TreeElementIDObject final : public TreeElementID {
void expand(SpaceOutliner &) const override;
private:
void expandData(SpaceOutliner &) const;
void expandPose(SpaceOutliner &) const;
void expandMaterials(SpaceOutliner &) const;
void expandConstraints(SpaceOutliner &) const;
void expandModifiers(SpaceOutliner &) const;
void expandGPencilModifiers(SpaceOutliner &) const;
void expandGPencilEffects(SpaceOutliner &) const;
void expandVertexGroups(SpaceOutliner &) const;
void expandDuplicatedGroup(SpaceOutliner &) const;
void expand_data(SpaceOutliner &) const;
void expand_pose(SpaceOutliner &) const;
void expand_materials(SpaceOutliner &) const;
void expand_constraints(SpaceOutliner &) const;
void expand_modifiers(SpaceOutliner &) const;
void expand_gpencil_modifiers(SpaceOutliner &) const;
void expand_gpencil_effects(SpaceOutliner &) const;
void expand_vertex_groups(SpaceOutliner &) const;
void expand_duplicated_group(SpaceOutliner &) const;
};
} // namespace blender::ed::outliner

View File

@ -23,33 +23,33 @@ TreeElementIDScene::TreeElementIDScene(TreeElement &legacy_te, Scene &scene)
void TreeElementIDScene::expand(SpaceOutliner &space_outliner) const
{
expandViewLayers(space_outliner);
expandWorld(space_outliner);
expandCollections(space_outliner);
expandObjects(space_outliner);
expand_view_layers(space_outliner);
expand_world(space_outliner);
expand_collections(space_outliner);
expand_objects(space_outliner);
expand_animation_data(space_outliner, scene_.adt);
}
void TreeElementIDScene::expandViewLayers(SpaceOutliner &space_outliner) const
void TreeElementIDScene::expand_view_layers(SpaceOutliner &space_outliner) const
{
outliner_add_element(
&space_outliner, &legacy_te_.subtree, &scene_, &legacy_te_, TSE_R_LAYER_BASE, 0);
}
void TreeElementIDScene::expandWorld(SpaceOutliner &space_outliner) const
void TreeElementIDScene::expand_world(SpaceOutliner &space_outliner) const
{
outliner_add_element(
&space_outliner, &legacy_te_.subtree, scene_.world, &legacy_te_, TSE_SOME_ID, 0);
}
void TreeElementIDScene::expandCollections(SpaceOutliner &space_outliner) const
void TreeElementIDScene::expand_collections(SpaceOutliner &space_outliner) const
{
outliner_add_element(
&space_outliner, &legacy_te_.subtree, &scene_, &legacy_te_, TSE_SCENE_COLLECTION_BASE, 0);
}
void TreeElementIDScene::expandObjects(SpaceOutliner &space_outliner) const
void TreeElementIDScene::expand_objects(SpaceOutliner &space_outliner) const
{
outliner_add_element(
&space_outliner, &legacy_te_.subtree, &scene_, &legacy_te_, TSE_SCENE_OBJECTS_BASE, 0);

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