Merge branch 'master' into geometry-nodes-simulation

This commit is contained in:
Jacques Lucke 2022-12-15 13:29:14 +01:00
commit 5e384860a6
76 changed files with 981 additions and 705 deletions

View File

@ -5,7 +5,12 @@ if(WIN32)
set(HARFBUZZ_PKG_ENV FREETYPE_DIR=${LIBDIR}/freetype)
else()
set(HARFBUZZ_CONFIGURE_ENV ${CONFIGURE_ENV})
set(HARFBUZZ_PKG_ENV PKG_CONFIG_PATH=${LIBDIR}/freetype/lib/pkgconfig:${LIBDIR}/brotli/lib/pkgconfig:${LIBDIR}/lib/python3.10/pkgconfig:$PKG_CONFIG_PATH)
set(HARFBUZZ_PKG_ENV "PKG_CONFIG_PATH=\
${LIBDIR}/freetype/lib/pkgconfig:\
${LIBDIR}/brotli/lib/pkgconfig:\
${LIBDIR}/lib/python3.10/pkgconfig:\
$PKG_CONFIG_PATH"
)
endif()
set(HARFBUZZ_EXTRA_OPTIONS
@ -23,8 +28,16 @@ ExternalProject_Add(external_harfbuzz
URL_HASH ${HARFBUZZ_HASH_TYPE}=${HARFBUZZ_HASH}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
PREFIX ${BUILD_DIR}/harfbuzz
CONFIGURE_COMMAND ${HARFBUZZ_CONFIGURE_ENV} &&
${CMAKE_COMMAND} -E env ${HARFBUZZ_PKG_ENV} ${MESON} setup --prefix ${LIBDIR}/harfbuzz ${HARFBUZZ_EXTRA_OPTIONS} --default-library static --libdir lib ${BUILD_DIR}/harfbuzz/src/external_harfbuzz-build ${BUILD_DIR}/harfbuzz/src/external_harfbuzz
${CMAKE_COMMAND} -E env ${HARFBUZZ_PKG_ENV}
${MESON} setup
--prefix ${LIBDIR}/harfbuzz ${HARFBUZZ_EXTRA_OPTIONS}
--default-library static
--libdir lib
${BUILD_DIR}/harfbuzz/src/external_harfbuzz-build
${BUILD_DIR}/harfbuzz/src/external_harfbuzz
BUILD_COMMAND ninja
INSTALL_COMMAND ninja install
INSTALL_DIR ${LIBDIR}/harfbuzz
@ -46,4 +59,3 @@ if(BUILD_MODE STREQUAL Release AND WIN32)
DEPENDEES install
)
endif()

View File

@ -4,7 +4,12 @@ set(SNDFILE_EXTRA_ARGS)
set(SNDFILE_ENV)
if(WIN32)
set(SNDFILE_ENV PKG_CONFIG_PATH=${mingw_LIBDIR}/ogg/lib/pkgconfig:${mingw_LIBDIR}/vorbis/lib/pkgconfig:${mingw_LIBDIR}/flac/lib/pkgconfig:${mingw_LIBDIR}/opus/lib/pkgconfig:${mingw_LIBDIR})
set(SNDFILE_ENV "PKG_CONFIG_PATH=\
${mingw_LIBDIR}/ogg/lib/pkgconfig:\
${mingw_LIBDIR}/vorbis/lib/pkgconfig:\
${mingw_LIBDIR}/flac/lib/pkgconfig:\
${mingw_LIBDIR}/opus/lib/pkgconfig"
)
set(SNDFILE_ENV set ${SNDFILE_ENV} &&)
# Shared for windows because static libs will drag in a libgcc dependency.
set(SNDFILE_OPTIONS --disable-static --enable-shared )
@ -19,7 +24,10 @@ if(UNIX AND NOT APPLE)
#
# Replace: Cflags: -I${includedir}/opus
# With: Cflags: -I${includedir}
set(SNDFILE_ENV sed -i s/{includedir}\\/opus/{includedir}/g ${LIBDIR}/opus/lib/pkgconfig/opus.pc && ${SNDFILE_ENV})
set(SNDFILE_ENV
sed -i s/{includedir}\\/opus/{includedir}/g ${LIBDIR}/opus/lib/pkgconfig/opus.pc &&
${SNDFILE_ENV}
)
endif()
ExternalProject_Add(external_sndfile

View File

@ -6,6 +6,7 @@ import re
import subprocess
import sys
# Strip version numbers from dependenciesm macOS notarizatiom fails
# with version symlinks.
def strip_lib_version(name):
@ -14,6 +15,7 @@ def strip_lib_version(name):
name = re.sub(r'(\.[0-9]+)+.cpython', '.cpython', name)
return name
rpath = sys.argv[1]
file = sys.argv[2]

View File

@ -11,11 +11,17 @@ if [ `id -u` -ne 0 ]; then
exit 1
fi
# Required by: config manager command below to enable powertools.
dnf install 'dnf-command(config-manager)'
# Packages `ninja-build` and `meson` are not available unless CBR or PowerTools repositories are enabled.
# See: https://wiki.rockylinux.org/rocky/repo/#notes-on-unlisted-repositories
dnf config-manager --set-enabled powertools
# yum-config-manager does not come in the default minimal install,
# Required by: epel-release has the patchelf and rubygem-asciidoctor packages
dnf install epel-release
# `yum-config-manager` does not come in the default minimal install,
# so make sure it is installed and available.
yum -y update
yum -y install yum-utils
@ -82,8 +88,10 @@ PACKAGES_FOR_LIBS=(
# This is used for the `python3-mako` package for e.g.
# So use the "default" system Python since it means it's most compatible with other packages.
python3
# Required by: `external_mesa`.
python3-mako
# Required by: `mesa`.
# Required by: `external_mesa`.
expat-devel
# Required by: `external_igc` & `external_osl` as a build-time dependency.
@ -114,7 +122,7 @@ PACKAGES_FOR_BLENDER=(
yum -y install -y ${PACKAGES_FOR_LIBS[@]} ${PACKAGES_FOR_BLENDER[@]}
# Dependencies for pip (needed for buildbot-worker), uses Python3.6.
# Dependencies for pip (needed for `buildbot-worker`), uses Python3.6.
yum -y install python3 python3-pip python3-devel
# Dependencies for asound.

View File

@ -370,7 +370,7 @@ def main():
args_in_wash = get_args_wash(args_in, args_in_index, False)
fw(".. function:: %s(bm, %s)\n\n" % (b[0], ", ".join([print_arg_in(arg) for arg in args_in_wash])))
fw(".. function:: %s(bm, %s)\n\n" % (b[0], ", ".join([arg_name_with_default(arg) for arg in args_in_wash])))
# -- wash the comment
comment_washed = []
@ -423,8 +423,8 @@ def main():
print(OUT_RST)
def print_arg_in(arg):
(name, default_value, _, _) = arg
def arg_name_with_default(arg):
name, default_value, _, _ = arg
if default_value is None:
return name
return name + '=' + default_value

View File

@ -92,7 +92,7 @@ class AddPresetPerformance(AddPresetBase, Operator):
preset_defines = [
"render = bpy.context.scene.render",
"cycles = bpy.context.scene.cycles"
"cycles = bpy.context.scene.cycles",
]
preset_values = [

View File

@ -370,7 +370,7 @@ class CYCLES_RENDER_PT_sampling_advanced(CyclesButtonsPanel, Panel):
layout.separator()
heading = layout.column(align=True, heading="Scrambling Distance")
heading.active = cscene.sampling_pattern != 'TABULATED_SOBOL'
heading.active = cscene.sampling_pattern == 'TABULATED_SOBOL'
heading.prop(cscene, "auto_scrambling_distance", text="Automatic")
heading.prop(cscene, "preview_scrambling_distance", text="Viewport")
heading.prop(cscene, "scrambling_distance", text="Multiplier")
@ -395,9 +395,13 @@ class CYCLES_RENDER_PT_sampling_lights(CyclesButtonsPanel, Panel):
def draw(self, context):
layout = self.layout
layout.use_property_split = True
layout.use_property_decorate = False
scene = context.scene
cscene = scene.cycles
col = layout.column(align=True)
col.prop(cscene, "use_light_tree")
sub = col.row()
sub.prop(cscene, "light_sampling_threshold", text="Light Threshold")

View File

@ -274,7 +274,7 @@ class GHOST_IWindow {
*/
virtual GHOST_TSuccess setCursorShape(GHOST_TStandardCursor cursorShape) = 0;
virtual GHOST_TSuccess getCursorGrabBounds(GHOST_Rect &bounds) = 0;
virtual GHOST_TSuccess getCursorGrabBounds(GHOST_Rect &bounds) const = 0;
virtual void getCursorGrabState(GHOST_TGrabCursorMode &mode,
GHOST_TAxisFlag &axis_flag,

View File

@ -5830,8 +5830,36 @@ static GHOST_TSuccess getCursorPositionClientRelative_impl(
int32_t &y)
{
const wl_fixed_t scale = win->scale();
x = wl_fixed_to_int(scale * seat_state_pointer->xy[0]);
y = wl_fixed_to_int(scale * seat_state_pointer->xy[1]);
if (win->getCursorGrabModeIsWarp()) {
/* As the cursor is restored at the warped location,
* apply warping when requesting the cursor location. */
GHOST_Rect wrap_bounds{};
if (win->getCursorGrabModeIsWarp()) {
if (win->getCursorGrabBounds(wrap_bounds) == GHOST_kFailure) {
win->getClientBounds(wrap_bounds);
}
}
int xy_wrap[2] = {
seat_state_pointer->xy[0],
seat_state_pointer->xy[1],
};
GHOST_Rect wrap_bounds_scale;
wrap_bounds_scale.m_l = wl_fixed_from_int(wrap_bounds.m_l) / scale;
wrap_bounds_scale.m_t = wl_fixed_from_int(wrap_bounds.m_t) / scale;
wrap_bounds_scale.m_r = wl_fixed_from_int(wrap_bounds.m_r) / scale;
wrap_bounds_scale.m_b = wl_fixed_from_int(wrap_bounds.m_b) / scale;
wrap_bounds_scale.wrapPoint(UNPACK2(xy_wrap), 0, win->getCursorGrabAxis());
x = wl_fixed_to_int(scale * xy_wrap[0]);
y = wl_fixed_to_int(scale * xy_wrap[1]);
}
else {
x = wl_fixed_to_int(scale * seat_state_pointer->xy[0]);
y = wl_fixed_to_int(scale * seat_state_pointer->xy[1]);
}
return GHOST_kSuccess;
}

View File

@ -1075,46 +1075,17 @@ GHOST_EventCursor *GHOST_SystemWin32::processCursorEvent(GHOST_WindowWin32 *wind
int32_t x_new = x_screen;
int32_t y_new = y_screen;
int32_t x_accum, y_accum;
GHOST_Rect bounds;
/* Warp within bounds. */
{
GHOST_Rect bounds;
int32_t bounds_margin = 0;
GHOST_TAxisFlag bounds_axis = GHOST_kAxisNone;
if (window->getCursorGrabMode() == GHOST_kGrabHide) {
window->getClientBounds(bounds);
/* WARNING(@campbellbarton): The current warping logic fails to warp on every event,
* so the box needs to small enough not to let the cursor escape the window but large
* enough that the cursor isn't being warped every time.
* If this was not the case it would be less trouble to simply warp the cursor to the
* center of the screen on every motion, see: D16558 (alternative fix for T102346). */
const int32_t subregion_div = 4; /* One quarter of the region. */
const int32_t size[2] = {bounds.getWidth(), bounds.getHeight()};
const int32_t center[2] = {(bounds.m_l + bounds.m_r) / 2, (bounds.m_t + bounds.m_b) / 2};
/* Shrink the box to prevent the cursor escaping. */
bounds.m_l = center[0] - (size[0] / (subregion_div * 2));
bounds.m_r = center[0] + (size[0] / (subregion_div * 2));
bounds.m_t = center[1] - (size[1] / (subregion_div * 2));
bounds.m_b = center[1] + (size[1] / (subregion_div * 2));
bounds_margin = 0;
bounds_axis = GHOST_TAxisFlag(GHOST_kAxisX | GHOST_kAxisY);
}
else {
/* Fallback to window bounds. */
if (window->getCursorGrabBounds(bounds) == GHOST_kFailure) {
window->getClientBounds(bounds);
}
bounds_margin = 2;
bounds_axis = window->getCursorGrabAxis();
}
/* Could also clamp to screen bounds wrap with a window outside the view will
* fail at the moment. Use inset in case the window is at screen bounds. */
bounds.wrapPoint(x_new, y_new, bounds_margin, bounds_axis);
/* Fallback to window bounds. */
if (window->getCursorGrabBounds(bounds) == GHOST_kFailure) {
window->getClientBounds(bounds);
}
/* Could also clamp to screen bounds wrap with a window outside the view will
* fail at the moment. Use inset in case the window is at screen bounds. */
bounds.wrapPoint(x_new, y_new, 2, window->getCursorGrabAxis());
window->getCursorGrabAccum(x_accum, y_accum);
if (x_new != x_screen || y_new != y_screen) {
/* WORKAROUND: Store the current time so that we ignore outdated mousemove events. */

View File

@ -275,10 +275,6 @@ uint8_t GHOST_SystemX11::getNumDisplays() const
return uint8_t(1);
}
/**
* Returns the dimensions of the main display on this system.
* \return The dimension of the main display.
*/
void GHOST_SystemX11::getMainDisplayDimensions(uint32_t &width, uint32_t &height) const
{
if (m_display) {
@ -289,10 +285,6 @@ void GHOST_SystemX11::getMainDisplayDimensions(uint32_t &width, uint32_t &height
}
}
/**
* Returns the dimensions of the main display on this system.
* \return The dimension of the main display.
*/
void GHOST_SystemX11::getAllDisplayDimensions(uint32_t &width, uint32_t &height) const
{
if (m_display) {
@ -301,22 +293,6 @@ void GHOST_SystemX11::getAllDisplayDimensions(uint32_t &width, uint32_t &height)
}
}
/**
* Create a new window.
* The new window is added to the list of windows managed.
* Never explicitly delete the window, use #disposeWindow() instead.
* \param title: The name of the window
* (displayed in the title bar of the window if the OS supports it).
* \param left: The coordinate of the left edge of the window.
* \param top: The coordinate of the top edge of the window.
* \param width: The width the window.
* \param height: The height the window.
* \param state: The state of the window when opened.
* \param glSettings: Misc OpenGL settings.
* \param exclusive: Use to show the window on top and ignore others (used full-screen).
* \param parentWindow: Parent window.
* \return The new window (or 0 if creation failed).
*/
GHOST_IWindow *GHOST_SystemX11::createWindow(const char *title,
int32_t left,
int32_t top,
@ -417,11 +393,7 @@ static GHOST_Context *create_glx_context(Display *display,
return nullptr;
}
/**
* Create a new off-screen context.
* Never explicitly delete the context, use #disposeContext() instead.
* \return The new context (or 0 if creation failed).
*/
GHOST_IContext *GHOST_SystemX11::createOffscreenContext(GHOST_GLSettings glSettings)
{
/* During development:
@ -479,11 +451,6 @@ GHOST_IContext *GHOST_SystemX11::createOffscreenContext(GHOST_GLSettings glSetti
return nullptr;
}
/**
* Dispose of a context.
* \param context: Pointer to the context to be disposed.
* \return Indication of success.
*/
GHOST_TSuccess GHOST_SystemX11::disposeContext(GHOST_IContext *context)
{
delete context;
@ -950,48 +917,17 @@ void GHOST_SystemX11::processEvent(XEvent *xe)
int32_t x_new = xme.x_root;
int32_t y_new = xme.y_root;
int32_t x_accum, y_accum;
GHOST_Rect bounds;
/* Warp within bounds. */
{
GHOST_Rect bounds;
int32_t bounds_margin = 0;
GHOST_TAxisFlag bounds_axis = GHOST_kAxisNone;
if (window->getCursorGrabMode() == GHOST_kGrabHide) {
window->getClientBounds(bounds);
/* TODO(@campbellbarton): warp the cursor to `window->getCursorGrabInitPos`,
* on every motion event, see: D16557 (alternative fix for T102346). */
const int32_t subregion_div = 4; /* One quarter of the region. */
const int32_t size[2] = {bounds.getWidth(), bounds.getHeight()};
const int32_t center[2] = {
(bounds.m_l + bounds.m_r) / 2,
(bounds.m_t + bounds.m_b) / 2,
};
/* Shrink the box to prevent the cursor escaping. */
bounds.m_l = center[0] - (size[0] / (subregion_div * 2));
bounds.m_r = center[0] + (size[0] / (subregion_div * 2));
bounds.m_t = center[1] - (size[1] / (subregion_div * 2));
bounds.m_b = center[1] + (size[1] / (subregion_div * 2));
bounds_margin = 0;
bounds_axis = GHOST_TAxisFlag(GHOST_kAxisX | GHOST_kAxisY);
}
else {
/* Fallback to window bounds. */
if (window->getCursorGrabBounds(bounds) == GHOST_kFailure) {
window->getClientBounds(bounds);
}
/* Could also clamp to screen bounds wrap with a window outside the view will
* fail at the moment. Use offset of 8 in case the window is at screen bounds. */
bounds_margin = 8;
bounds_axis = window->getCursorGrabAxis();
}
/* Could also clamp to screen bounds wrap with a window outside the view will
* fail at the moment. Use inset in case the window is at screen bounds. */
bounds.wrapPoint(x_new, y_new, bounds_margin, bounds_axis);
/* fallback to window bounds */
if (window->getCursorGrabBounds(bounds) == GHOST_kFailure) {
window->getClientBounds(bounds);
}
/* Could also clamp to screen bounds wrap with a window outside the view will
* fail at the moment. Use offset of 8 in case the window is at screen bounds. */
bounds.wrapPoint(x_new, y_new, 8, window->getCursorGrabAxis());
window->getCursorGrabAccum(x_accum, y_accum);
if (x_new != xme.x_root || y_new != xme.y_root) {

View File

@ -175,7 +175,7 @@ GHOST_TSuccess GHOST_Window::setCursorGrab(GHOST_TGrabCursorMode mode,
return GHOST_kFailure;
}
GHOST_TSuccess GHOST_Window::getCursorGrabBounds(GHOST_Rect &bounds)
GHOST_TSuccess GHOST_Window::getCursorGrabBounds(GHOST_Rect &bounds) const
{
if (m_cursorGrab != GHOST_kGrabWrap) {
return GHOST_kFailure;

View File

@ -152,7 +152,7 @@ class GHOST_Window : public GHOST_IWindow {
* Gets the cursor grab region, if unset the window is used.
* reset when grab is disabled.
*/
GHOST_TSuccess getCursorGrabBounds(GHOST_Rect &bounds) override;
GHOST_TSuccess getCursorGrabBounds(GHOST_Rect &bounds) const override;
void getCursorGrabState(GHOST_TGrabCursorMode &mode,
GHOST_TAxisFlag &axis_flag,

View File

@ -1203,10 +1203,6 @@ void GHOST_WindowWayland::setOpaque() const
}
#endif
/**
* \param type: The type of rendering context create.
* \return Indication of success.
*/
GHOST_Context *GHOST_WindowWayland::newDrawingContext(GHOST_TDrawingContextType type)
{
GHOST_Context *context;

View File

@ -1112,11 +1112,6 @@ void GHOST_WindowX11::validate()
m_invalid_window = false;
}
/**
* Destructor.
* Closes the window and disposes resources allocated.
*/
GHOST_WindowX11::~GHOST_WindowX11()
{
std::map<uint, Cursor>::iterator it = m_standard_cursors.begin();

View File

@ -9,13 +9,24 @@ __all__ = (
)
import bpy
from typing import Mapping, List, Tuple, Sequence
from bpy.types import Action
# (fcurve.data_path, fcurve.array_index)
FCurveKey = Tuple[str, int]
# [frame0, value0, frame1, value1, ...]
from typing import (
List,
Mapping,
Sequence,
Tuple,
)
FCurveKey = Tuple[
# `fcurve.data_path`.
str,
# `fcurve.array_index`.
int,
]
# List of `[frame0, value0, frame1, value1, ...]` pairs.
ListKeyframes = List[float]
Action = bpy.types.Action
def bake_action(
@ -144,11 +155,11 @@ def bake_action_iter(
# Note: BBONE_PROPS is a list so we can preserve the ordering
BBONE_PROPS = [
'bbone_curveinx', 'bbone_curveoutx',
'bbone_curveinz', 'bbone_curveoutz',
'bbone_rollin', 'bbone_rollout',
'bbone_scalein', 'bbone_scaleout',
'bbone_easein', 'bbone_easeout'
"bbone_curveinx", "bbone_curveoutx",
"bbone_curveinz", "bbone_curveoutz",
"bbone_rollin", "bbone_rollout",
"bbone_scalein", "bbone_scaleout",
"bbone_easein", "bbone_easeout",
]
BBONE_PROPS_LENGTHS = {
"bbone_curveinx": 1,
@ -433,14 +444,18 @@ def bake_action_iter(
class KeyframesCo:
"""A buffer for keyframe Co unpacked values per FCurveKey. FCurveKeys are added using
add_paths(), Co values stored using extend_co_values(), then finally use
insert_keyframes_into_*_action() for efficiently inserting keys into the fcurves.
"""
A buffer for keyframe Co unpacked values per ``FCurveKey``. ``FCurveKeys`` are added using
``add_paths()``, Co values stored using extend_co_values(), then finally use
``insert_keyframes_into_*_action()`` for efficiently inserting keys into the F-curves.
Users are limited to one Action Group per instance.
"""
__slots__ = (
"keyframes_from_fcurve",
)
# keyframes[(rna_path, array_index)] = list(time0,value0, time1,value1,...)
# `keyframes[(rna_path, array_index)] = list(time0,value0, time1,value1,...)`.
keyframes_from_fcurve: Mapping[FCurveKey, ListKeyframes]
def __init__(self):
@ -480,11 +495,12 @@ class KeyframesCo:
action: Action,
action_group_name: str,
) -> None:
"""Assumes the action is new, that it has no fcurves. Otherwise, the only difference between versions is
"""
Assumes the action is new, that it has no F-curves. Otherwise, the only difference between versions is
performance and implementation simplicity.
Args:
action_group_name (str): Name of Action Group that fcurves are added to.
:arg action_group_name: Name of Action Group that F-curves are added to.
:type action_group_name: str
"""
linear_enum_values = [
bpy.types.Keyframe.bl_rna.properties["interpolation"].enum_items["LINEAR"].value
@ -513,14 +529,15 @@ class KeyframesCo:
action: Action,
action_group_name: str,
) -> None:
"""Assumes the action already exists, that it might already have fcurves. Otherwise, the
"""
Assumes the action already exists, that it might already have F-curves. Otherwise, the
only difference between versions is performance and implementation simplicity.
Args:
lookup_fcurves (Mapping[FCurveKey, bpy.types.FCurve]): This is only used for efficiency.
It's a substitute for action.fcurves.find() which is a potentially expensive linear
search.
action_group_name (str): Name of Action Group that fcurves are added to.
:arg lookup_fcurves: : This is only used for efficiency.
It's a substitute for ``action.fcurves.find()`` which is a potentially expensive linear search.
:type lookup_fcurves: ``Mapping[FCurveKey, bpy.types.FCurve]``
:arg action_group_name: Name of Action Group that F-curves are added to.
:type action_group_name: str
"""
linear_enum_values = [
bpy.types.Keyframe.bl_rna.properties["interpolation"].enum_items["LINEAR"].value
@ -539,7 +556,7 @@ class KeyframesCo:
keyframe_points = fcurve.keyframe_points
co_buffer = [0] * 2 * len(keyframe_points)
co_buffer = [0] * (2 * len(keyframe_points))
keyframe_points.foreach_get("co", co_buffer)
co_buffer.extend(key_values)

View File

@ -12,7 +12,7 @@ __all__ = (
"path_reference",
"path_reference_copy",
"path_reference_mode",
"unique_name"
"unique_name",
)
import bpy

View File

@ -1028,7 +1028,7 @@ class CLIP_OT_track_settings_to_track(Operator):
"use_red_channel",
"use_green_channel",
"use_blue_channel",
"weight"
"weight",
)
_attrs_marker = (

View File

@ -776,7 +776,7 @@ class TransformsToDeltasAnim(Operator):
"rotation_euler": "delta_rotation_euler",
"rotation_quaternion": "delta_rotation_quaternion",
# "rotation_axis_angle" : "delta_rotation_axis_angle",
"scale": "delta_scale"
"scale": "delta_scale",
}
DELTA_PATHS = STANDARD_TO_DELTA_PATHS.values()

View File

@ -46,7 +46,7 @@ class QuickFur(ObjectModeOperator, Operator):
items=(
('LIGHT', "Light", ""),
('MEDIUM', "Medium", ""),
('HEAVY', "Heavy", "")
('HEAVY', "Heavy", ""),
),
default='MEDIUM',
)

View File

@ -20,7 +20,7 @@ from bpy.app.translations import (
WindowManager.preset_name = StringProperty(
name="Preset Name",
description="Name for new preset",
default=data_("New Preset")
default=data_("New Preset"),
)
@ -309,7 +309,7 @@ class AddPresetCamera(AddPresetBase, Operator):
preset_values = [
"cam.sensor_width",
"cam.sensor_height",
"cam.sensor_fit"
"cam.sensor_fit",
]
if self.use_focal_length:
preset_values.append("cam.lens")
@ -439,7 +439,7 @@ class AddPresetTrackingCamera(AddPresetBase, Operator):
"camera.pixel_aspect",
"camera.k1",
"camera.k2",
"camera.k3"
"camera.k3",
]
if self.use_focal_length:
preset_values.append("camera.units")
@ -459,7 +459,7 @@ class AddPresetTrackingTrackColor(AddPresetBase, Operator):
preset_values = [
"track.color",
"track.use_custom_color"
"track.use_custom_color",
]
preset_subdir = "tracking_track_color"
@ -489,7 +489,7 @@ class AddPresetTrackingSettings(AddPresetBase, Operator):
"settings.use_default_red_channel",
"settings.use_default_green_channel",
"settings.use_default_blue_channel",
"settings.default_weight"
"settings.default_weight",
]
preset_subdir = "tracking_settings"
@ -507,7 +507,7 @@ class AddPresetNodeColor(AddPresetBase, Operator):
preset_values = [
"node.color",
"node.use_custom_color"
"node.use_custom_color",
]
preset_subdir = "node_color"
@ -616,7 +616,7 @@ class AddPresetGpencilBrush(AddPresetBase, Operator):
preset_defines = [
"brush = bpy.context.tool_settings.gpencil_paint.brush",
"settings = brush.gpencil_settings"
"settings = brush.gpencil_settings",
]
preset_values = [
@ -650,7 +650,7 @@ class AddPresetGpencilMaterial(AddPresetBase, Operator):
preset_defines = [
"material = bpy.context.object.active_material",
"gpcolor = material.grease_pencil"
"gpcolor = material.grease_pencil",
]
preset_values = [

View File

@ -133,7 +133,7 @@ class PlayRenderedAnim(Operator):
"-speed", str(fps_final),
"-in_out", str(frame_start), str(frame_end),
"-frame", str(scene.frame_current),
"-time_units", "Frames"
"-time_units", "Frames",
]
cmd.extend(opts)
elif preset == 'FRAMECYCLER':

View File

@ -3,7 +3,7 @@
import bpy
from bpy.types import (
Operator,
OperatorFileListElement
OperatorFileListElement,
)
from bpy.props import (
BoolProperty,
@ -981,7 +981,7 @@ class PREFERENCES_OT_studiolight_install(Operator):
('MATCAP', "MatCap", "Install custom MatCaps"),
('WORLD', "World", "Install custom HDRIs"),
('STUDIO', "Studio", "Install custom Studio Lights"),
)
),
)
def execute(self, context):

View File

@ -32,7 +32,7 @@ class VIEW3D_OT_edit_mesh_extrude_individual_move(Operator):
TRANSFORM_OT_translate={
"orient_type": 'NORMAL',
"constraint_axis": (False, False, True),
}
},
)
elif select_mode[2] and totface > 1:
bpy.ops.mesh.extrude_faces_move('INVOKE_REGION_WIN')
@ -57,7 +57,7 @@ class VIEW3D_OT_edit_mesh_extrude_move(Operator):
dissolve_and_intersect: BoolProperty(
name="dissolve_and_intersect",
default=False,
description="Dissolves adjacent faces and intersects new geometry"
description="Dissolves adjacent faces and intersects new geometry",
)
@classmethod

View File

@ -1377,7 +1377,8 @@ class WM_OT_properties_edit(Operator):
name="Array Length",
default=3,
min=1,
max=32, # 32 is the maximum size for RNA array properties.
# 32 is the maximum size for RNA array properties.
max=32,
)
# Integer properties.
@ -1458,7 +1459,7 @@ class WM_OT_properties_edit(Operator):
# Store the value converted to a string as a fallback for otherwise unsupported types.
eval_string: StringProperty(
name="Value",
description="Python value for unsupported custom property types"
description="Python value for unsupported custom property types",
)
type_items = rna_custom_property_type_items
@ -1904,7 +1905,7 @@ class WM_OT_properties_edit_value(Operator):
# Store the value converted to a string as a fallback for otherwise unsupported types.
eval_string: StringProperty(
name="Value",
description="Value for custom property types that can only be edited as a Python expression"
description="Value for custom property types that can only be edited as a Python expression",
)
def execute(self, context):
@ -2470,11 +2471,11 @@ class BatchRenameAction(bpy.types.PropertyGroup):
replace_match_case: BoolProperty(name="Case Sensitive")
use_replace_regex_src: BoolProperty(
name="Regular Expression Find",
description="Use regular expressions to match text in the 'Find' field"
description="Use regular expressions to match text in the 'Find' field",
)
use_replace_regex_dst: BoolProperty(
name="Regular Expression Replace",
description="Use regular expression for the replacement text (supporting groups)"
description="Use regular expression for the replacement text (supporting groups)",
)
# type: 'CASE'.

View File

@ -94,16 +94,6 @@ _namespace = globals()
_modules_loaded = [_namespace[name] for name in _modules]
del _namespace
def _addon_support_items():
"""Return the addon support levels suitable for this Blender build."""
items = [
('OFFICIAL', "Official", "Officially supported"),
('COMMUNITY', "Community", "Maintained by community developers"),
]
if bpy.app.version_cycle == 'alpha':
items.append(('TESTING', "Testing", "Newly contributed scripts (excluded from release builds)"))
return items
def register():
from bpy.utils import register_class
@ -150,13 +140,23 @@ def register():
description="Filter add-ons by category",
)
# These items are static but depend on the version cycle.
items = [
('OFFICIAL', "Official", "Officially supported"),
('COMMUNITY', "Community", "Maintained by community developers"),
]
if bpy.app.version_cycle == "alpha":
items.append(('TESTING', "Testing", "Newly contributed scripts (excluded from release builds)"))
WindowManager.addon_support = EnumProperty(
items=_addon_support_items(),
items=items,
name="Support",
description="Display support level",
default={'OFFICIAL', 'COMMUNITY'},
options={'ENUM_FLAG'},
)
del items
# done...

View File

@ -210,12 +210,12 @@ class GPENCIL_MT_snap_pie(Menu):
pie.operator(
"gpencil.snap_to_cursor",
text="Selection to Cursor",
icon='RESTRICT_SELECT_OFF'
icon='RESTRICT_SELECT_OFF',
).use_offset = False
pie.operator(
"gpencil.snap_to_cursor",
text="Selection to Cursor (Keep Offset)",
icon='RESTRICT_SELECT_OFF'
icon='RESTRICT_SELECT_OFF',
).use_offset = True
pie.separator()
pie.operator("view3d.snap_cursor_to_center", text="Cursor to World Origin", icon='CURSOR')

View File

@ -386,7 +386,7 @@ class RENDER_PT_encoding_video(RenderOutputButtonsPanel, Panel):
'MKV',
'OGG',
'MPEG4',
'WEBM'
'WEBM',
}
if needs_codec:
layout.prop(ffmpeg, "codec")
@ -402,7 +402,7 @@ class RENDER_PT_encoding_video(RenderOutputButtonsPanel, Panel):
'H264',
'MPEG4',
'WEBM',
'AV1'
'AV1',
}
if use_crf:
layout.prop(ffmpeg, "constant_rate_factor")

View File

@ -1196,7 +1196,7 @@ def brush_basic_texpaint_settings(layout, context, brush, *, compact=False):
unified_name="use_unified_size",
slider=True,
text="Radius",
header=True
header=True,
)
UnifiedPaintPanel.prop_unified(
layout,
@ -1205,7 +1205,7 @@ def brush_basic_texpaint_settings(layout, context, brush, *, compact=False):
"strength",
pressure_name="use_pressure_strength",
unified_name="use_unified_strength",
header=True
header=True,
)
@ -1345,7 +1345,7 @@ def brush_basic_gpencil_paint_settings(layout, context, brush, *, compact=False)
"builtin.line",
"builtin.box",
"builtin.circle",
"builtin.polyline"
"builtin.polyline",
}:
settings = context.tool_settings.gpencil_sculpt
if compact:

View File

@ -422,7 +422,7 @@ class PHYSICS_PT_cloth_property_weights(PhysicButtonsPanel, Panel):
col = flow.column()
col.prop_search(
cloth, "vertex_group_bending", ob, "vertex_groups",
text="Bending Group"
text="Bending Group",
)
col.prop(cloth, "bending_stiffness_max", text="Max Bending")
@ -431,7 +431,7 @@ class PHYSICS_PT_cloth_property_weights(PhysicButtonsPanel, Panel):
col = flow.column()
col.prop_search(
cloth, "vertex_group_shrink", ob, "vertex_groups",
text="Shrinking Group"
text="Shrinking Group",
)
col.prop(cloth, "shrink_max", text="Max Shrinking")

View File

@ -86,7 +86,7 @@ class PHYSICS_PT_add(PhysicButtonsPanel, Panel):
col, obj.rigid_body, "Rigid Body",
"rigidbody.object_add",
"rigidbody.object_remove",
'RIGID_BODY'
'RIGID_BODY',
)
# all types of objects can have rigid body constraint.
@ -94,7 +94,7 @@ class PHYSICS_PT_add(PhysicButtonsPanel, Panel):
col, obj.rigid_body_constraint, "Rigid Body Constraint",
"rigidbody.constraint_add",
"rigidbody.constraint_remove",
'RIGID_BODY_CONSTRAINT'
'RIGID_BODY_CONSTRAINT',
)

View File

@ -1166,7 +1166,7 @@ from bl_ui.properties_mask_common import (
MASK_PT_point,
MASK_PT_display,
MASK_PT_transforms,
MASK_PT_tools
MASK_PT_tools,
)

View File

@ -41,14 +41,14 @@ class FILEBROWSER_HT_header(Header):
layout.popover(
panel="ASSETBROWSER_PT_filter",
text="",
icon='FILTER'
icon='FILTER',
)
layout.operator(
"screen.region_toggle",
text="",
icon='PREFERENCES',
depress=is_option_region_visible(context, space_data)
depress=is_option_region_visible(context, space_data),
).region_type = 'TOOL_PROPS'
def draw(self, context):
@ -464,7 +464,7 @@ class FILEBROWSER_PT_directory_path(Panel):
"screen.region_toggle",
text="",
icon='PREFERENCES',
depress=is_option_region_visible(context, space)
depress=is_option_region_visible(context, space),
).region_type = 'TOOL_PROPS'

View File

@ -697,7 +697,7 @@ class _draw_tool_settings_context_mode:
pressure_name="use_pressure_size",
unified_name="use_unified_size",
slider=True,
header=True
header=True,
)
UnifiedPaintPanel.prop_unified(
layout,
@ -707,7 +707,7 @@ class _draw_tool_settings_context_mode:
pressure_name="use_pressure_strength",
unified_name="use_unified_strength",
slider=True,
header=True
header=True,
)
@staticmethod

View File

@ -14,7 +14,7 @@ from bl_ui.space_toolsystem_common import (
)
from bl_ui.properties_material import (
EEVEE_MATERIAL_PT_settings,
MATERIAL_PT_viewport
MATERIAL_PT_viewport,
)
from bl_ui.properties_world import (
WORLD_PT_viewport_display
@ -496,18 +496,18 @@ class NODE_MT_context_menu(Menu):
# If no nodes are selected.
if selected_nodes_len == 0:
layout.operator_context = 'INVOKE_DEFAULT'
layout.menu("NODE_MT_add", icon="ADD")
layout.operator("node.clipboard_paste", text="Paste", icon="PASTEDOWN")
layout.menu("NODE_MT_add", icon='ADD')
layout.operator("node.clipboard_paste", text="Paste", icon='PASTEDOWN')
layout.separator()
layout.operator("node.find_node", text="Find...", icon="VIEWZOOM")
layout.operator("node.find_node", text="Find...", icon='VIEWZOOM')
layout.separator()
if is_geometrynodes:
layout.operator_context = 'INVOKE_DEFAULT'
layout.operator("node.select", text="Clear Viewer", icon="HIDE_ON").clear_viewer = True
layout.operator("node.select", text="Clear Viewer", icon='HIDE_ON').clear_viewer = True
layout.operator("node.links_cut")
layout.operator("node.links_mute")
@ -521,19 +521,19 @@ class NODE_MT_context_menu(Menu):
if is_geometrynodes:
layout.operator_context = 'INVOKE_DEFAULT'
layout.operator("node.link_viewer", text="Link to Viewer", icon="HIDE_OFF")
layout.operator("node.link_viewer", text="Link to Viewer", icon='HIDE_OFF')
layout.separator()
layout.operator("node.clipboard_copy", text="Copy", icon="COPYDOWN")
layout.operator("node.clipboard_paste", text="Paste", icon="PASTEDOWN")
layout.operator("node.clipboard_copy", text="Copy", icon='COPYDOWN')
layout.operator("node.clipboard_paste", text="Paste", icon='PASTEDOWN')
layout.operator_context = 'INVOKE_DEFAULT'
layout.operator("node.duplicate_move", icon="DUPLICATE")
layout.operator("node.duplicate_move", icon='DUPLICATE')
layout.separator()
layout.operator("node.delete", icon="X")
layout.operator("node.delete", icon='X')
layout.operator_context = 'EXEC_REGION_WIN'
layout.operator("node.delete_reconnect", text="Dissolve")
@ -546,7 +546,7 @@ class NODE_MT_context_menu(Menu):
layout.separator()
layout.operator("node.group_make", text="Make Group", icon="NODETREE")
layout.operator("node.group_make", text="Make Group", icon='NODETREE')
layout.operator("node.group_insert", text="Insert Into Group")
if active_node and active_node.type == 'GROUP':
@ -878,7 +878,7 @@ class NodeTreeInterfacePanel(Panel):
props = property_row.operator_menu_enum(
"node.tree_socket_change_type",
"socket_type",
text=active_socket.bl_label if active_socket.bl_label else active_socket.bl_idname
text=active_socket.bl_label if active_socket.bl_label else active_socket.bl_idname,
)
props.in_out = in_out

View File

@ -732,7 +732,7 @@ class SEQUENCER_MT_add_scene(Menu):
layout = self.layout
layout.operator_context = 'INVOKE_REGION_WIN'
layout.operator("sequencer.scene_strip_add_new", text="New Scene", icon="ADD").type = 'NEW'
layout.operator("sequencer.scene_strip_add_new", text="New Scene", icon='ADD').type = 'NEW'
bpy_data_scenes_len = len(bpy.data.scenes)
if bpy_data_scenes_len > 10:
@ -1378,7 +1378,7 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel, Panel):
'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER',
'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP',
'WIPE', 'GLOW', 'TRANSFORM', 'COLOR', 'SPEED',
'MULTICAM', 'GAUSSIAN_BLUR', 'TEXT', 'COLORMIX'
'MULTICAM', 'GAUSSIAN_BLUR', 'TEXT', 'COLORMIX',
}
def draw(self, context):
@ -2112,7 +2112,7 @@ class SEQUENCER_PT_adjust_video(SequencerButtonsPanel, Panel):
'META', 'ADD', 'SUBTRACT', 'ALPHA_OVER',
'ALPHA_UNDER', 'CROSS', 'GAMMA_CROSS', 'MULTIPLY',
'OVER_DROP', 'WIPE', 'GLOW', 'TRANSFORM', 'COLOR',
'MULTICAM', 'SPEED', 'ADJUSTMENT', 'COLORMIX'
'MULTICAM', 'SPEED', 'ADJUSTMENT', 'COLORMIX',
}
def draw(self, context):
@ -2160,7 +2160,7 @@ class SEQUENCER_PT_adjust_color(SequencerButtonsPanel, Panel):
'META', 'ADD', 'SUBTRACT', 'ALPHA_OVER',
'ALPHA_UNDER', 'CROSS', 'GAMMA_CROSS', 'MULTIPLY',
'OVER_DROP', 'WIPE', 'GLOW', 'TRANSFORM', 'COLOR',
'MULTICAM', 'SPEED', 'ADJUSTMENT', 'COLORMIX'
'MULTICAM', 'SPEED', 'ADJUSTMENT', 'COLORMIX',
}
def draw(self, context):

View File

@ -272,7 +272,7 @@ class TEXT_MT_templates_py(Menu):
bpy.utils.script_paths(subdir="templates_py"),
"text.open",
props_default={"internal": True},
filter_ext=lambda ext: (ext.lower() == ".py")
filter_ext=lambda ext: (ext.lower() == ".py"),
)
@ -284,7 +284,7 @@ class TEXT_MT_templates_osl(Menu):
bpy.utils.script_paths(subdir="templates_osl"),
"text.open",
props_default={"internal": True},
filter_ext=lambda ext: (ext.lower() == ".osl")
filter_ext=lambda ext: (ext.lower() == ".osl"),
)

View File

@ -225,7 +225,7 @@ class ToolSelectPanelHelper:
return next(
(cls for cls in ToolSelectPanelHelper.__subclasses__()
if cls.bl_space_type == space_type),
None
None,
)
@staticmethod
@ -904,7 +904,8 @@ class ToolSelectPanelHelper:
"workspace_tool_type",
value='DEFAULT',
text="Active Tool",
icon='TOOL_SETTINGS', # Could use a less generic icon.
# Could use a less generic icon.
icon='TOOL_SETTINGS',
)
is_active_tool = (tool_settings.workspace_tool_type == 'DEFAULT')

View File

@ -32,7 +32,7 @@ def generate_from_enum_ex(
attr,
cursor='DEFAULT',
tooldef_keywords={},
exclude_filter={}
exclude_filter={},
):
tool_defs = []
for enum in type.bl_rna.properties[attr].enum_items_static:
@ -49,8 +49,8 @@ def generate_from_enum_ex(
cursor=cursor,
data_block=idname,
**tooldef_keywords,
)
)
),
),
)
return tuple(tool_defs)
@ -1633,7 +1633,7 @@ class _defs_weight_paint:
cursor='EYEDROPPER',
widget=None,
keymap=(),
draw_settings=draw_settings
draw_settings=draw_settings,
)
@ToolDef.from_fn
@ -1660,7 +1660,7 @@ class _defs_weight_paint:
"weight",
unified_name="use_unified_weight",
slider=True,
header=True
header=True,
)
UnifiedPaintPanel.prop_unified(
layout,
@ -1668,7 +1668,7 @@ class _defs_weight_paint:
brush,
"strength",
unified_name="use_unified_strength",
header=True
header=True,
)
props = tool.operator_properties("paint.weight_gradient")
@ -2323,7 +2323,7 @@ class _defs_curves_sculpt:
idname="builtin_brush.selection_paint",
label="Selection Paint",
icon="ops.generic.select_paint",
data_block="SELECTION_PAINT"
data_block="SELECTION_PAINT",
)
@ToolDef.from_fn
@ -2332,7 +2332,7 @@ class _defs_curves_sculpt:
idname="builtin_brush.comb",
label="Comb",
icon="ops.curves.sculpt_comb",
data_block='COMB'
data_block='COMB',
)
@ToolDef.from_fn
@ -2341,7 +2341,7 @@ class _defs_curves_sculpt:
idname="builtin_brush.add",
label="Add",
icon="ops.curves.sculpt_add",
data_block='ADD'
data_block='ADD',
)
@ToolDef.from_fn
@ -2350,7 +2350,7 @@ class _defs_curves_sculpt:
idname="builtin_brush.delete",
label="Delete",
icon="ops.curves.sculpt_delete",
data_block='DELETE'
data_block='DELETE',
)
@ToolDef.from_fn
@ -2359,7 +2359,7 @@ class _defs_curves_sculpt:
idname="builtin_brush.snake_hook",
label="Snake Hook",
icon="ops.curves.sculpt_snake_hook",
data_block='SNAKE_HOOK'
data_block='SNAKE_HOOK',
)
@ToolDef.from_fn
@ -2368,7 +2368,7 @@ class _defs_curves_sculpt:
idname="builtin_brush.grow_shrink",
label="Grow/Shrink",
icon="ops.curves.sculpt_grow_shrink",
data_block='GROW_SHRINK'
data_block='GROW_SHRINK',
)
@ToolDef.from_fn
@ -2377,7 +2377,7 @@ class _defs_curves_sculpt:
idname="builtin_brush.pinch",
label="Pinch",
icon="ops.curves.sculpt_pinch",
data_block='PINCH'
data_block='PINCH',
)
@ToolDef.from_fn
@ -2386,7 +2386,7 @@ class _defs_curves_sculpt:
idname="builtin_brush.smooth",
label="Smooth",
icon="ops.curves.sculpt_smooth",
data_block='SMOOTH'
data_block='SMOOTH',
)
@ToolDef.from_fn
@ -2395,7 +2395,7 @@ class _defs_curves_sculpt:
idname="builtin_brush.puff",
label="Puff",
icon="ops.curves.sculpt_puff",
data_block='PUFF'
data_block='PUFF',
)
@ToolDef.from_fn
@ -2404,7 +2404,7 @@ class _defs_curves_sculpt:
idname="builtin_brush.density",
label="Density",
icon="ops.curves.sculpt_density",
data_block="DENSITY"
data_block="DENSITY",
)
@ToolDef.from_fn
@ -2413,7 +2413,7 @@ class _defs_curves_sculpt:
idname="builtin_brush.slide",
label="Slide",
icon="ops.curves.sculpt_slide",
data_block="SLIDE"
data_block="SLIDE",
)

View File

@ -1131,7 +1131,7 @@ class PreferenceThemeSpacePanel:
},
'CLIP_EDITOR': {
"handle_vertex_select",
}
},
}
# TODO theme_area should be deprecated
@ -2289,7 +2289,7 @@ class USERPREF_PT_experimental_virtual_reality(ExperimentalPanel, Panel):
context, (
({"property": "use_virtual_reality_scene_inspection"}, "T71347"),
({"property": "use_virtual_reality_immersive_drawing"}, "T71348"),
)
),
)
"""

View File

@ -845,13 +845,13 @@ class VIEW3D_HT_header(Header):
layout.popover(
panel="VIEW3D_PT_gpencil_sculpt_automasking",
text="",
icon="MOD_MASK"
icon='MOD_MASK',
)
elif object_mode == 'SCULPT':
layout.popover(
panel="VIEW3D_PT_sculpt_automasking",
text="",
icon="MOD_MASK"
icon='MOD_MASK',
)
else:
# Transform settings depending on tool header visibility
@ -1254,12 +1254,21 @@ class VIEW3D_MT_view(Menu):
layout.separator()
layout.operator("render.opengl", text="Viewport Render Image", icon='RENDER_STILL')
layout.operator("render.opengl", text="Viewport Render Animation", icon='RENDER_ANIMATION').animation = True
props = layout.operator("render.opengl",
text="Viewport Render Keyframes",
icon='RENDER_ANIMATION',
)
layout.operator(
"render.opengl",
text="Viewport Render Image",
icon='RENDER_STILL',
)
layout.operator(
"render.opengl",
text="Viewport Render Animation",
icon='RENDER_ANIMATION',
).animation = True
props = layout.operator(
"render.opengl",
text="Viewport Render Keyframes",
icon='RENDER_ANIMATION',
)
props.animation = True
props.render_keyed_only = True
@ -6218,7 +6227,7 @@ class VIEW3D_PT_shading_compositor(Panel):
row.active = not is_macos
row.prop(shading, "use_compositor", expand=True)
if is_macos and shading.use_compositor != "DISABLED":
self.layout.label(text="Compositor not supported on MacOS.", icon="ERROR")
self.layout.label(text="Compositor not supported on MacOS.", icon='ERROR')
class VIEW3D_PT_gizmo_display(Panel):

View File

@ -213,7 +213,7 @@ shader_node_categories = [
NodeItem("ShaderNodeVolumeScatter", poll=eevee_cycles_shader_nodes_poll),
NodeItem("ShaderNodeVolumePrincipled"),
NodeItem("ShaderNodeEeveeSpecular", poll=object_eevee_shader_nodes_poll),
NodeItem("ShaderNodeBsdfHairPrincipled", poll=object_cycles_shader_nodes_poll)
NodeItem("ShaderNodeBsdfHairPrincipled", poll=object_cycles_shader_nodes_poll),
]),
ShaderNodeCategory("SH_NEW_TEXTURE", "Texture", items=[
NodeItem("ShaderNodeTexImage"),

View File

@ -520,7 +520,7 @@ typedef struct SculptAttribute {
* This will be true if simple_array is requested in
* SculptAttributeParams, or the PBVH type is PBVH_GRIDS or PBVH_BMESH.
*/
bool simple_array;
bool simple_array;
/* Data stored per BMesh element. */
int bmesh_cd_offset;

View File

@ -996,14 +996,13 @@ static void blendfile_link_append_proxies_convert(Main *bmain, ReportList *repor
if (bf_reports.count.proxies_to_lib_overrides_success != 0 ||
bf_reports.count.proxies_to_lib_overrides_failures != 0) {
BKE_reportf(
bf_reports.reports,
RPT_WARNING,
"Proxies have been removed from Blender (%d proxies were automatically converted "
"to library overrides, %d proxies could not be converted and were cleared). "
"Consider re-saving any library .blend file with the newest Blender version",
bf_reports.count.proxies_to_lib_overrides_success,
bf_reports.count.proxies_to_lib_overrides_failures);
BKE_reportf(bf_reports.reports,
RPT_WARNING,
"Proxies have been removed from Blender (%d proxies were automatically converted "
"to library overrides, %d proxies could not be converted and were cleared). "
"Consider re-saving any library .blend file with the newest Blender version",
bf_reports.count.proxies_to_lib_overrides_success,
bf_reports.count.proxies_to_lib_overrides_failures);
}
}

View File

@ -34,7 +34,6 @@ struct IMAGE_Data {
IMAGE_InstanceData *instance_data;
};
/**
* Abstract class for a drawing mode of the image engine.
*

View File

@ -22,12 +22,11 @@ void OVERLAY_edit_curves_init(OVERLAY_Data *vedata)
/* Create view with depth offset. */
DRWView *default_view = (DRWView *)DRW_view_default_get();
pd->view_edit_curves_points = default_view;
pd->view_edit_curves = DRW_view_create_with_zoffset(default_view, draw_ctx->rv3d, 1.0f);
}
void OVERLAY_edit_curves_cache_init(OVERLAY_Data *vedata)
{
OVERLAY_TextureList *txl = vedata->txl;
OVERLAY_PassList *psl = vedata->psl;
OVERLAY_PrivateData *pd = vedata->stl->pd;
@ -35,33 +34,35 @@ void OVERLAY_edit_curves_cache_init(OVERLAY_Data *vedata)
DRWState state = (DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_BLEND_ALPHA |
DRW_STATE_WRITE_DEPTH);
/* Common boilerplate for shading groups. */
DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
const DRWContextState *draw_ctx = DRW_context_state_get();
const View3D *v3d = draw_ctx->v3d;
GPUTexture **depth_tex = (pd->edit_curves.do_zbufclip) ? &dtxl->depth : &txl->dummy_depth_tx;
const float backwire_opacity = (pd->edit_curves.do_zbufclip) ? v3d->overlay.backwire_opacity :
1.0f;
GPUShader *sh;
DRWShadingGroup *grp;
/* Run Twice for in-front passes. */
for (int i = 0; i < 2; i++) {
DRW_PASS_CREATE(psl->edit_curves_points_ps[i], (state | pd->clipping_state));
GPUShader *sh = OVERLAY_shader_edit_curve_point();
DRWShadingGroup *grp = pd->edit_curves_points_grp[i] = DRW_shgroup_create(
sh, psl->edit_curves_points_ps[i]);
sh = OVERLAY_shader_edit_particle_point();
grp = pd->edit_curves_points_grp[i] = DRW_shgroup_create(sh, psl->edit_curves_points_ps[i]);
DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
DRW_shgroup_uniform_float_copy(grp, "alpha", backwire_opacity);
DRW_shgroup_uniform_texture_ref(grp, "depthTex", depth_tex);
DRW_PASS_CREATE(psl->edit_curves_lines_ps[i], (state | pd->clipping_state));
sh = OVERLAY_shader_edit_particle_strand();
grp = pd->edit_curves_lines_grp[i] = DRW_shgroup_create(sh, psl->edit_curves_lines_ps[i]);
DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
DRW_shgroup_uniform_bool_copy(grp, "useWeight", false);
}
}
static void overlay_edit_curves_add_ob_to_pass(OVERLAY_PrivateData *pd, Object *ob, bool in_front)
{
Curves *curves = static_cast<Curves *>(ob->data);
DRWShadingGroup *point_shgrp = pd->edit_curves_points_grp[in_front];
struct GPUBatch *geom_points = DRW_curves_batch_cache_get_edit_points(curves);
DRW_shgroup_call_no_cull(point_shgrp, geom_points, ob);
DRWShadingGroup *lines_shgrp = pd->edit_curves_lines_grp[in_front];
struct GPUBatch *geom_lines = DRW_curves_batch_cache_get_edit_lines(curves);
DRW_shgroup_call_no_cull(lines_shgrp, geom_lines, ob);
}
void OVERLAY_edit_curves_cache_populate(OVERLAY_Data *vedata, Object *ob)
@ -80,13 +81,20 @@ void OVERLAY_edit_curves_draw(OVERLAY_Data *vedata)
{
OVERLAY_PassList *psl = vedata->psl;
OVERLAY_PrivateData *pd = vedata->stl->pd;
OVERLAY_FramebufferList *fbl = vedata->fbl;
if (DRW_state_is_fbo()) {
GPU_framebuffer_bind(fbl->overlay_default_fb);
}
if (pd->edit_curves.do_zbufclip) {
DRW_view_set_active(pd->view_edit_curves_points);
DRW_view_set_active(pd->view_edit_curves);
DRW_draw_pass(psl->edit_curves_points_ps[NOT_IN_FRONT]);
DRW_draw_pass(psl->edit_curves_lines_ps[NOT_IN_FRONT]);
}
else {
DRW_view_set_active(pd->view_edit_curves_points);
DRW_view_set_active(pd->view_edit_curves);
DRW_draw_pass(psl->edit_curves_points_ps[IN_FRONT]);
DRW_draw_pass(psl->edit_curves_lines_ps[IN_FRONT]);
}
}

View File

@ -76,6 +76,7 @@ typedef struct OVERLAY_PassList {
DRWPass *edit_mesh_faces_ps[2];
DRWPass *edit_mesh_faces_cage_ps[2];
DRWPass *edit_curves_points_ps[2];
DRWPass *edit_curves_lines_ps[2];
DRWPass *edit_mesh_analysis_ps;
DRWPass *edit_mesh_normals_ps;
DRWPass *edit_particle_ps;
@ -264,6 +265,7 @@ typedef struct OVERLAY_PrivateData {
DRWShadingGroup *edit_uv_face_dots_grp;
DRWShadingGroup *edit_uv_stretching_grp;
DRWShadingGroup *edit_curves_points_grp[2];
DRWShadingGroup *edit_curves_lines_grp[2];
DRWShadingGroup *extra_grid_grp;
DRWShadingGroup *facing_grp[2];
DRWShadingGroup *fade_grp[2];
@ -305,7 +307,7 @@ typedef struct OVERLAY_PrivateData {
DRWView *view_edit_verts;
DRWView *view_edit_text;
DRWView *view_reference_images;
DRWView *view_edit_curves_points;
DRWView *view_edit_curves;
/** TODO: get rid of this. */
ListBase bg_movie_clips;

View File

@ -97,9 +97,10 @@ void main()
#endif
if (!is_manifold || !backface) {
bool do_front = (output_triangle_id==0)?true:false;
emit_cap(do_front, invert, output_vertex_id%3);
} else {
bool do_front = (output_triangle_id == 0) ? true : false;
emit_cap(do_front, invert, output_vertex_id % 3);
}
else {
DISCARD_VERTEX
}
}

View File

@ -137,6 +137,7 @@ struct GPUVertBuf **DRW_curves_texture_for_evaluated_attribute(struct Curves *cu
bool *r_is_point_domain);
struct GPUBatch *DRW_curves_batch_cache_get_edit_points(struct Curves *curves);
struct GPUBatch *DRW_curves_batch_cache_get_edit_lines(struct Curves *curves);
void DRW_curves_batch_cache_create_requested(struct Object *ob);

View File

@ -23,6 +23,8 @@
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DEG_depsgraph_query.h"
#include "BKE_curves.hh"
#include "BKE_geometry_set.hh"
@ -51,6 +53,15 @@ struct CurvesBatchCache {
CurvesEvalCache curves_cache;
GPUBatch *edit_points;
GPUBatch *edit_lines;
/* Editmode (original) point positions. */
GPUVertBuf *edit_points_pos;
/* Editmode data (such as selection). */
GPUVertBuf *edit_points_data;
GPUIndexBuf *edit_lines_ibo;
/* Whether the cache is invalid. */
bool is_dirty;
@ -99,13 +110,22 @@ static void curves_discard_attributes(CurvesEvalCache &curves_cache)
}
}
static void curves_batch_cache_clear_data(CurvesEvalCache &curves_cache)
static void curves_batch_cache_clear_edit_data(CurvesBatchCache *cache)
{
/* TODO: more granular update tagging. */
GPU_VERTBUF_DISCARD_SAFE(cache->edit_points_pos);
GPU_VERTBUF_DISCARD_SAFE(cache->edit_points_data);
GPU_INDEXBUF_DISCARD_SAFE(cache->edit_lines_ibo);
GPU_BATCH_DISCARD_SAFE(cache->edit_points);
GPU_BATCH_DISCARD_SAFE(cache->edit_lines);
}
static void curves_batch_cache_clear_eval_data(CurvesEvalCache &curves_cache)
{
/* TODO: more granular update tagging. */
GPU_VERTBUF_DISCARD_SAFE(curves_cache.proc_point_buf);
GPU_VERTBUF_DISCARD_SAFE(curves_cache.proc_length_buf);
GPU_VERTBUF_DISCARD_SAFE(curves_cache.data_edit_points);
GPU_VERTBUF_DISCARD_SAFE(curves_cache.proc_strand_buf);
GPU_VERTBUF_DISCARD_SAFE(curves_cache.proc_strand_seg_buf);
@ -126,9 +146,8 @@ static void curves_batch_cache_clear(Curves &curves)
return;
}
curves_batch_cache_clear_data(cache->curves_cache);
GPU_BATCH_DISCARD_SAFE(cache->edit_points);
curves_batch_cache_clear_eval_data(cache->curves_cache);
curves_batch_cache_clear_edit_data(cache);
}
void DRW_curves_batch_cache_validate(Curves *curves)
@ -258,7 +277,6 @@ static void curves_batch_cache_ensure_procedural_pos(const Curves &curves,
/* Initialize vertex format. */
GPUVertFormat format = {0};
GPU_vertformat_attr_add(&format, "posTime", GPU_COMP_F32, 4, GPU_FETCH_FLOAT);
GPU_vertformat_alias_add(&format, "pos");
cache.proc_point_buf = GPU_vertbuf_create_with_format_ex(
&format, GPU_USAGE_STATIC | GPU_USAGE_FLAG_BUFFER_TEXTURE_ONLY);
@ -282,47 +300,85 @@ static void curves_batch_cache_ensure_procedural_pos(const Curves &curves,
}
}
static void curves_batch_cache_ensure_data_edit_points(const Curves &curves_id,
CurvesEvalCache &cache)
static void curves_batch_cache_ensure_edit_points_pos(const Curves &curves_id,
CurvesBatchCache &cache)
{
using namespace blender;
const bke::CurvesGeometry &curves = bke::CurvesGeometry::wrap(curves_id.geometry);
static GPUVertFormat format_pos = {0};
static uint pos;
if (format_pos.attr_len == 0) {
pos = GPU_vertformat_attr_add(&format_pos, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
}
GPU_vertbuf_init_with_format(cache.edit_points_pos, &format_pos);
GPU_vertbuf_data_alloc(cache.edit_points_pos, curves.points_num());
Span<float3> positions = curves.positions();
GPU_vertbuf_attr_fill(cache.edit_points_pos, pos, positions.data());
}
static void curves_batch_cache_ensure_edit_points_data(const Curves &curves_id,
CurvesBatchCache &cache)
{
using namespace blender;
const bke::CurvesGeometry &curves = bke::CurvesGeometry::wrap(curves_id.geometry);
static GPUVertFormat format_data = {0};
static uint data;
static uint color;
if (format_data.attr_len == 0) {
data = GPU_vertformat_attr_add(&format_data, "data", GPU_COMP_U8, 1, GPU_FETCH_INT);
color = GPU_vertformat_attr_add(&format_data, "color", GPU_COMP_F32, 1, GPU_FETCH_FLOAT);
}
GPU_vertbuf_init_with_format(cache.data_edit_points, &format_data);
GPU_vertbuf_data_alloc(cache.data_edit_points, curves.points_num());
GPU_vertbuf_init_with_format(cache.edit_points_data, &format_data);
GPU_vertbuf_data_alloc(cache.edit_points_data, curves.points_num());
VArray<float> selection;
switch (curves_id.selection_domain) {
case ATTR_DOMAIN_POINT:
selection = curves.selection_point_float();
for (const int point_i : selection.index_range()) {
uint8_t vflag = 0;
const float point_selection = selection[point_i];
SET_FLAG_FROM_TEST(vflag, (point_selection > 0.0f), VFLAG_VERT_SELECTED);
GPU_vertbuf_attr_set(cache.data_edit_points, data, point_i, &vflag);
const float point_selection = (selection[point_i] > 0.0f) ? 1.0f : 0.0f;
GPU_vertbuf_attr_set(cache.edit_points_data, color, point_i, &point_selection);
}
break;
case ATTR_DOMAIN_CURVE:
selection = curves.selection_curve_float();
for (const int curve_i : curves.curves_range()) {
uint8_t vflag = 0;
const float curve_selection = selection[curve_i];
SET_FLAG_FROM_TEST(vflag, (curve_selection > 0.0f), VFLAG_VERT_SELECTED);
const float curve_selection = (selection[curve_i] > 0.0f) ? 1.0f : 0.0f;
const IndexRange points = curves.points_for_curve(curve_i);
for (const int point_i : points) {
GPU_vertbuf_attr_set(cache.data_edit_points, data, point_i, &vflag);
GPU_vertbuf_attr_set(cache.edit_points_data, color, point_i, &curve_selection);
}
}
break;
}
}
static void curves_batch_cache_ensure_edit_lines(const Curves &curves_id, CurvesBatchCache &cache)
{
using namespace blender;
const bke::CurvesGeometry &curves = bke::CurvesGeometry::wrap(curves_id.geometry);
const int vert_len = curves.points_num();
const int curve_len = curves.curves_num();
const int index_len = vert_len + curve_len;
GPUIndexBufBuilder elb;
GPU_indexbuf_init_ex(&elb, GPU_PRIM_LINE_STRIP, index_len, vert_len);
for (const int i : curves.curves_range()) {
const IndexRange points = curves.points_for_curve(i);
for (const int i_point : points) {
GPU_indexbuf_add_generic_vert(&elb, i_point);
}
GPU_indexbuf_add_primitive_restart(&elb);
}
GPU_indexbuf_build_in_place(&elb, cache.edit_lines_ibo);
}
void drw_curves_get_attribute_sampler_name(const char *layer_name, char r_sampler_name[32])
{
char attr_safe_name[GPU_MAX_SAFE_ATTR_NAME];
@ -617,6 +673,12 @@ GPUBatch *DRW_curves_batch_cache_get_edit_points(Curves *curves)
return DRW_batch_request(&cache.edit_points);
}
GPUBatch *DRW_curves_batch_cache_get_edit_lines(Curves *curves)
{
CurvesBatchCache &cache = curves_batch_cache_get(*curves);
return DRW_batch_request(&cache.edit_lines);
}
static void request_attribute(Curves &curves, const char *name)
{
CurvesBatchCache &cache = curves_batch_cache_get(curves);
@ -684,18 +746,27 @@ GPUVertBuf **DRW_curves_texture_for_evaluated_attribute(Curves *curves,
void DRW_curves_batch_cache_create_requested(Object *ob)
{
Curves *curves = static_cast<Curves *>(ob->data);
Object *orig = DEG_get_original_object(ob);
Curves *curves_orig = static_cast<Curves *>(orig->data);
CurvesBatchCache &cache = curves_batch_cache_get(*curves);
if (DRW_batch_requested(cache.edit_points, GPU_PRIM_POINTS)) {
DRW_vbo_request(cache.edit_points, &cache.curves_cache.proc_point_buf);
DRW_vbo_request(cache.edit_points, &cache.curves_cache.data_edit_points);
DRW_vbo_request(cache.edit_points, &cache.edit_points_pos);
DRW_vbo_request(cache.edit_points, &cache.edit_points_data);
}
if (DRW_vbo_requested(cache.curves_cache.proc_point_buf)) {
curves_batch_cache_ensure_procedural_pos(*curves, cache.curves_cache, nullptr);
if (DRW_batch_requested(cache.edit_lines, GPU_PRIM_LINE_STRIP)) {
DRW_ibo_request(cache.edit_lines, &cache.edit_lines_ibo);
DRW_vbo_request(cache.edit_lines, &cache.edit_points_pos);
DRW_vbo_request(cache.edit_lines, &cache.edit_points_data);
}
if (DRW_vbo_requested(cache.curves_cache.data_edit_points)) {
curves_batch_cache_ensure_data_edit_points(*curves, cache.curves_cache);
if (DRW_vbo_requested(cache.edit_points_pos)) {
curves_batch_cache_ensure_edit_points_pos(*curves_orig, cache);
}
if (DRW_vbo_requested(cache.edit_points_data)) {
curves_batch_cache_ensure_edit_points_data(*curves_orig, cache);
}
if (DRW_ibo_requested(cache.edit_lines_ibo)) {
curves_batch_cache_ensure_edit_lines(*curves_orig, cache);
}
}

View File

@ -64,12 +64,9 @@ typedef struct CurvesEvalFinalCache {
/* Curves procedural display: Evaluation is done on the GPU. */
typedef struct CurvesEvalCache {
/* Input control point positions combined with parameter data. */
/* Control point positions on evaluated data-block combined with parameter data. */
GPUVertBuf *proc_point_buf;
/* Editmode data (such as selection flags) used by overlay_edit_curve_point.glsl */
GPUVertBuf *data_edit_points;
/** Info of control points strands (segment count and base index) */
GPUVertBuf *proc_strand_buf;

View File

@ -572,11 +572,11 @@ static int geometry_attribute_convert_invoke(bContext *C,
PropertyRNA *prop = RNA_struct_find_property(op->ptr, "domain");
if (!RNA_property_is_set(op->ptr, prop)) {
RNA_enum_set(op->ptr, "domain", meta_data.domain);
RNA_property_enum_set(op->ptr, prop, meta_data.domain);
}
prop = RNA_struct_find_property(op->ptr, "data_type");
if (!RNA_property_is_set(op->ptr, prop)) {
RNA_enum_set(op->ptr, "data_type", meta_data.data_type);
RNA_property_enum_set(op->ptr, prop, meta_data.data_type);
}
return WM_operator_props_dialog_popup(C, op, 300);
@ -642,11 +642,11 @@ static int geometry_color_attribute_convert_invoke(bContext *C,
PropertyRNA *prop = RNA_struct_find_property(op->ptr, "domain");
if (!RNA_property_is_set(op->ptr, prop)) {
RNA_enum_set(op->ptr, "domain", meta_data.domain);
RNA_property_enum_set(op->ptr, prop, meta_data.domain);
}
prop = RNA_struct_find_property(op->ptr, "data_type");
if (!RNA_property_is_set(op->ptr, prop)) {
RNA_enum_set(op->ptr, "data_type", meta_data.data_type);
RNA_property_enum_set(op->ptr, prop, meta_data.data_type);
}
return WM_operator_props_dialog_popup(C, op, 300);

View File

@ -486,21 +486,20 @@ static void gpencil_interpolate_set_points(bContext *C, tGPDinterpolate *tgpi)
continue;
}
/* create temp data for each layer */
bGPDframe *gpf_prv = gpencil_get_previous_keyframe(gpl, scene->r.cfra, exclude_breakdowns);
if (gpf_prv == NULL) {
continue;
}
bGPDframe *gpf_next = gpencil_get_next_keyframe(gpl, scene->r.cfra, exclude_breakdowns);
if (gpf_next == NULL) {
continue;
}
/* Create temp data for each layer. */
tgpil = MEM_callocN(sizeof(tGPDinterpolate_layer), "GPencil Interpolate Layer");
tgpil->gpl = gpl;
bGPDframe *gpf = gpencil_get_previous_keyframe(gpl, scene->r.cfra, exclude_breakdowns);
if (gpf == NULL) {
continue;
}
tgpil->prevFrame = BKE_gpencil_frame_duplicate(gpf, true);
gpf = gpencil_get_next_keyframe(gpl, scene->r.cfra, exclude_breakdowns);
if (gpf == NULL) {
continue;
}
tgpil->nextFrame = BKE_gpencil_frame_duplicate(gpf, true);
tgpil->prevFrame = BKE_gpencil_frame_duplicate(gpf_prv, true);
tgpil->nextFrame = BKE_gpencil_frame_duplicate(gpf_next, true);
BLI_addtail(&tgpi->ilayers, tgpil);

View File

@ -8306,7 +8306,7 @@ static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState s
/* number editing */
if (state == BUTTON_STATE_NUM_EDITING) {
if (ui_but_is_cursor_warp(but)) {
WM_cursor_grab_enable(CTX_wm_window(C), WM_CURSOR_WRAP_XY, true, nullptr);
WM_cursor_grab_enable(CTX_wm_window(C), WM_CURSOR_WRAP_XY, nullptr, true);
}
ui_numedit_begin(but, data);
}

View File

@ -174,19 +174,7 @@ bool view3d_orbit_calc_center(bContext *C, float r_dyn_ofs[3])
if (ob_act && (ob_act->mode & OB_MODE_ALL_PAINT) &&
/* with weight-paint + pose-mode, fall through to using calculateTransformCenter */
((ob_act->mode & OB_MODE_WEIGHT_PAINT) && BKE_object_pose_armature_get(ob_act)) == 0) {
/* in case of sculpting use last average stroke position as a rotation
* center, in other cases it's not clear what rotation center shall be
* so just rotate around object origin
*/
if (ob_act->mode &
(OB_MODE_SCULPT | OB_MODE_TEXTURE_PAINT | OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT)) {
float stroke[3];
BKE_paint_stroke_get_average(scene, ob_act_eval, stroke);
copy_v3_v3(lastofs, stroke);
}
else {
copy_v3_v3(lastofs, ob_act_eval->object_to_world[3]);
}
BKE_paint_stroke_get_average(scene, ob_act_eval, lastofs);
is_set = true;
}
else if (ob_act && (ob_act->mode & OB_MODE_EDIT) && (ob_act->type == OB_FONT)) {

View File

@ -55,6 +55,14 @@
#define USE_TABLET_SUPPORT
/**
* Use alternative behavior when cursor warp is supported
* to prevent the cursor escaping the window bounds, see: T102346.
*
* \note this is not needed if cursor positioning is not supported.
*/
#define USE_CURSOR_WARP_HACK
/* -------------------------------------------------------------------- */
/** \name Modal Key-map
* \{ */
@ -221,6 +229,10 @@ typedef struct WalkInfo {
bool need_rotation_keyframe;
bool need_translation_keyframe;
#ifdef USE_CURSOR_WARP_HACK
bool need_modal_cursor_warp_hack;
#endif
/** Previous 2D mouse values. */
int prev_mval[2];
/** Initial mouse location. */
@ -579,6 +591,10 @@ static bool initWalkInfo(bContext *C, WalkInfo *walk, wmOperator *op, const int
walk->need_rotation_keyframe = false;
walk->need_translation_keyframe = false;
#ifdef USE_CURSOR_WARP_HACK
walk->need_modal_cursor_warp_hack = false;
#endif
walk->time_lastdraw = PIL_check_seconds_timer();
walk->draw_handle_pixel = ED_region_draw_cb_activate(
@ -594,7 +610,32 @@ static bool initWalkInfo(bContext *C, WalkInfo *walk, wmOperator *op, const int
copy_v2_v2_int(walk->init_mval, mval);
copy_v2_v2_int(walk->prev_mval, mval);
WM_cursor_grab_enable(win, 0, true, NULL);
#ifdef USE_CURSOR_WARP_HACK
if (WM_capabilities_flag() & WM_CAPABILITY_CURSOR_WARP) {
const rcti *winrct = &walk->region->winrct;
const int center[2] = {BLI_rcti_cent_x(winrct), BLI_rcti_cent_y(winrct)};
const int size[2] = {BLI_rcti_size_x(winrct), BLI_rcti_size_y(winrct)};
const int div = 4; /* Where 2 is the region size. */
const rcti wrap_region = {
.xmin = center[0] - (size[0] / div),
.xmax = center[0] + (size[0] / div),
.ymin = center[1] - (size[1] / div),
.ymax = center[1] + (size[1] / div),
};
WM_cursor_grab_enable(win, WM_CURSOR_WRAP_XY, &wrap_region, false);
/* Important to hide afterwards (not part of grabbing),
* since enabling cursor and hiding at the same time ignores bounds. */
WM_cursor_modal_set(win, WM_CURSOR_NONE);
walk->need_modal_cursor_warp_hack = true;
}
else
#endif /* USE_CURSOR_WARP_HACK */
{
WM_cursor_grab_enable(win, WM_CURSOR_WRAP_NONE, NULL, true);
}
return 1;
}
@ -643,7 +684,16 @@ static int walkEnd(bContext *C, WalkInfo *walk)
}
#endif
WM_cursor_grab_enable(win, 0, true, NULL);
WM_cursor_grab_disable(win, NULL);
#ifdef USE_CURSOR_WARP_HACK
if (walk->need_modal_cursor_warp_hack) {
WM_cursor_warp(win,
walk->region->winrct.xmin + walk->init_mval[0],
walk->region->winrct.ymin + walk->init_mval[1]);
WM_cursor_modal_restore(win);
}
#endif
if (walk->state == WALK_CONFIRM) {
MEM_freeN(walk);

View File

@ -23,7 +23,6 @@
extern "C" {
#endif
/* -------------------------------------------------------------------- */
/** \name Types/
* \{ */

View File

@ -118,14 +118,12 @@ static void bakeModifier(Main *UNUSED(bmain),
GpencilModifierData *md,
Object *ob)
{
Object *object_eval = DEG_get_evaluated_object(depsgraph, ob);
ArmatureGpencilModifierData *mmd = (ArmatureGpencilModifierData *)md;
GpencilModifierData *md_eval = BKE_gpencil_modifiers_findby_name(object_eval, md->name);
if (mmd->object == NULL) {
return;
}
generic_bake_deform_stroke(depsgraph, md_eval, object_eval, true, deformStroke);
generic_bake_deform_stroke(depsgraph, md, ob, true, deformStroke);
}
static bool isDisabled(GpencilModifierData *md, int UNUSED(userRenderParams))

View File

@ -2109,11 +2109,11 @@ static void lineart_geometry_object_load(LineartObjectInfo *ob_info,
loose_data.loose_array = static_cast<int *>(
MEM_malloc_arrayN(loose_edges.count, sizeof(int), __func__));
if (loose_edges.count > 0) {
int loose_i = 0;
loose_data.loose_count = 0;
for (const int64_t edge_i : IndexRange(me->totedge)) {
if (loose_edges.is_loose_bits[edge_i]) {
loose_data.loose_array[loose_i] = int(edge_i);
loose_i++;
loose_data.loose_array[loose_data.loose_count] = int(edge_i);
loose_data.loose_count++;
}
}
}

View File

@ -1596,17 +1596,14 @@ id<MTLSamplerState> MTLContext::generate_sampler_from_state(MTLSamplerState samp
MTLSamplerAddressModeClampToBorderColor :
MTLSamplerAddressModeClampToEdge;
MTLSamplerAddressMode repeat_type = (sampler_state.state & GPU_SAMPLER_MIRROR_REPEAT) ?
MTLSamplerAddressModeMirrorRepeat :
MTLSamplerAddressModeRepeat;
descriptor.rAddressMode = (sampler_state.state & GPU_SAMPLER_REPEAT_R) ?
repeat_type :
clamp_type;
descriptor.sAddressMode = (sampler_state.state & GPU_SAMPLER_REPEAT_S) ?
repeat_type :
clamp_type;
descriptor.tAddressMode = (sampler_state.state & GPU_SAMPLER_REPEAT_T) ?
repeat_type :
clamp_type;
MTLSamplerAddressModeMirrorRepeat :
MTLSamplerAddressModeRepeat;
descriptor.rAddressMode = (sampler_state.state & GPU_SAMPLER_REPEAT_R) ? repeat_type :
clamp_type;
descriptor.sAddressMode = (sampler_state.state & GPU_SAMPLER_REPEAT_S) ? repeat_type :
clamp_type;
descriptor.tAddressMode = (sampler_state.state & GPU_SAMPLER_REPEAT_T) ? repeat_type :
clamp_type;
descriptor.borderColor = MTLSamplerBorderColorTransparentBlack;
descriptor.minFilter = (sampler_state.state & GPU_SAMPLER_FILTER) ?
MTLSamplerMinMagFilterLinear :

File diff suppressed because it is too large Load Diff

View File

@ -277,7 +277,7 @@ typedef struct wmWindow {
short lastcursor;
/** The current modal cursor. */
short modalcursor;
/** Cursor grab mode. */
/** Cursor grab mode #GHOST_TGrabCursorMode (run-time only) */
short grabcursor;
/** Internal: tag this for extra mouse-move event,
* makes cursors/buttons active on UI switching. */

View File

@ -3509,10 +3509,9 @@ static void rna_def_modifier_gpencillineart(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_object_instances", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "calculation_flags", LRT_ALLOW_DUPLI_OBJECTS);
RNA_def_property_ui_text(
prop,
"Instanced Objects",
"Allow particle objects and face/vertex instances to show in line art");
RNA_def_property_ui_text(prop,
"Instanced Objects",
"Allow particle objects and face/vertex instances to show in line art");
RNA_def_property_update(prop, NC_SCENE, "rna_GpencilModifier_update");
prop = RNA_def_property(srna, "use_edge_overlap", PROP_BOOLEAN, PROP_NONE);
@ -3893,11 +3892,12 @@ static void rna_def_modifier_gpencillineart(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
prop = RNA_def_property(srna, "shadow_camera_size", PROP_FLOAT, PROP_NONE);
RNA_def_property_ui_text(prop,
"Shadow Camera Size",
"Represents the \"Orthographic Scale\" of an orthographic camera. "
"If the camera is positioned at the light's location with this scale, it will "
"represent the coverage of the shadow \"camera\"");
RNA_def_property_ui_text(
prop,
"Shadow Camera Size",
"Represents the \"Orthographic Scale\" of an orthographic camera. "
"If the camera is positioned at the light's location with this scale, it will "
"represent the coverage of the shadow \"camera\"");
RNA_def_property_ui_range(prop, 0.0f, 500.0f, 0.1f, 2);
RNA_def_property_range(prop, 0.0f, 10000.0f);

View File

@ -435,7 +435,8 @@ static void rna_def_layer_collection(BlenderRNA *brna)
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "collection->id.name");
RNA_def_property_clear_flag(prop, PROP_EDITABLE | PROP_ANIMATABLE);
RNA_def_property_ui_text(prop, "Name", "Name of this layer collection (same as its collection one)");
RNA_def_property_ui_text(
prop, "Name", "Name of this layer collection (same as its collection one)");
RNA_def_property_string_funcs(
prop, "rna_LayerCollection_name_get", "rna_LayerCollection_name_length", NULL);
RNA_def_struct_name_property(srna, prop);

View File

@ -782,10 +782,11 @@ static void rna_Object_dup_collection_set(PointerRNA *ptr,
}
}
else {
BKE_report(NULL,
RPT_ERROR,
"Cannot set instance-collection as object belongs in collection being instanced, thus "
"causing a cycle");
BKE_report(
NULL,
RPT_ERROR,
"Cannot set instance-collection as object belongs in collection being instanced, thus "
"causing a cycle");
}
}

View File

@ -7821,7 +7821,11 @@ void RNA_def_scene(BlenderRNA *brna)
{3, "LINEAR", 0, "Linear", "Linear distance model"},
{4, "LINEAR_CLAMPED", 0, "Linear Clamped", "Linear distance model with clamping"},
{5, "EXPONENT", 0, "Exponential", "Exponential distance model"},
{6, "EXPONENT_CLAMPED", 0, "Exponential Clamped", "Exponential distance model with clamping"},
{6,
"EXPONENT_CLAMPED",
0,
"Exponential Clamped",
"Exponential distance model with clamping"},
{0, NULL, 0, NULL, NULL},
};

View File

@ -28,9 +28,9 @@ static void node_declare(NodeDeclarationBuilder &b)
"instancing the entire geometry"));
b.add_input<decl::Int>(N_("Instance Index"))
.implicit_field(implicit_field_inputs::id_or_index)
.description(N_(
"Index of the instance used for each point. This is only used when Pick Instances "
"is on. By default the point index is used"));
.description(
N_("Index of the instance used for each point. This is only used when Pick Instances "
"is on. By default the point index is used"));
b.add_input<decl::Vector>(N_("Rotation"))
.subtype(PROP_EULER)
.supports_field()

View File

@ -126,6 +126,15 @@ void WM_init_opengl(void);
*/
const char *WM_ghost_backend(void);
typedef enum eWM_CapabilitiesFlag {
/** Ability to warp the cursor (set it's location). */
WM_CAPABILITY_CURSOR_WARP = (1 << 0),
/** Ability to access window positions & move them. */
WM_CAPABILITY_WINDOW_POSITION = (1 << 1),
} eWM_CapabilitiesFlag;
eWM_CapabilitiesFlag WM_capabilities_flag(void);
void WM_check(struct bContext *C);
void WM_reinit_gizmomap_all(struct Main *bmain);
@ -312,9 +321,22 @@ void WM_cursor_modal_restore(struct wmWindow *win);
*/
void WM_cursor_wait(bool val);
/**
* \param bounds: can be NULL
* Enable cursor grabbing, optionally hiding the cursor and wrapping cursor-motion
* within a sub-region of the window.
*
* \param wrap: an enum (#WM_CURSOR_WRAP_NONE, #WM_CURSOR_WRAP_XY... etc).
* \param wrap_region: Window-relative region for cursor wrapping (when `wrap` is
* #WM_CURSOR_WRAP_XY). When NULL, the window bounds are used for wrapping.
*
* \note The current grab state can be accessed by #wmWindowManager.grabcursor although.
*/
void WM_cursor_grab_enable(struct wmWindow *win,
eWM_CursorWrapAxis wrap,
const struct rcti *wrap_region,
bool hide);
/**
*
*/
void WM_cursor_grab_enable(struct wmWindow *win, int wrap, bool hide, int bounds[4]);
void WM_cursor_grab_disable(struct wmWindow *win, const int mouse_ungrab_xy[2]);
/**
* After this you can call restore too.
@ -335,7 +357,10 @@ void WM_paint_cursor_remove_by_type(struct wmWindowManager *wm,
void WM_paint_cursor_tag_redraw(struct wmWindow *win, struct ARegion *region);
/**
* This function requires access to the GHOST_SystemHandle (g_system).
* Set the cursor location in window coordinates (compatible with #wmEvent.xy).
*
* \note Some platforms don't support this, check: #WM_CAPABILITY_WINDOW_POSITION
* before relying on this functionality.
*/
void WM_cursor_warp(struct wmWindow *win, int x, int y);

View File

@ -185,12 +185,12 @@ enum {
};
/** For #WM_cursor_grab_enable wrap axis. */
enum {
typedef enum eWM_CursorWrapAxis {
WM_CURSOR_WRAP_NONE = 0,
WM_CURSOR_WRAP_X,
WM_CURSOR_WRAP_Y,
WM_CURSOR_WRAP_XY,
};
} eWM_CursorWrapAxis;
/**
* Context to call operator in for #WM_operator_name_call.

View File

@ -1062,7 +1062,7 @@ void wm_gizmomap_modal_set(
gzmap->gzmap_context.modal = gz;
if ((gz->flag & WM_GIZMO_MOVE_CURSOR) && (event->tablet.is_motion_absolute == false)) {
WM_cursor_grab_enable(win, WM_CURSOR_WRAP_XY, true, NULL);
WM_cursor_grab_enable(win, WM_CURSOR_WRAP_XY, NULL, true);
copy_v2_v2_int(gzmap->gzmap_context.event_xy, event->xy);
gzmap->gzmap_context.event_grabcursor = win->grabcursor;
}

View File

@ -223,22 +223,33 @@ void WM_cursor_wait(bool val)
}
}
void WM_cursor_grab_enable(wmWindow *win, int wrap, bool hide, int bounds[4])
void WM_cursor_grab_enable(wmWindow *win,
const eWM_CursorWrapAxis wrap,
const rcti *wrap_region,
const bool hide)
{
int _wrap_region_buf[4];
int *wrap_region_screen = NULL;
/* Only grab cursor when not running debug.
* It helps not to get a stuck WM when hitting a break-point. */
GHOST_TGrabCursorMode mode = GHOST_kGrabNormal;
GHOST_TAxisFlag mode_axis = GHOST_kAxisX | GHOST_kAxisY;
if (bounds) {
wm_cursor_position_to_ghost_screen_coords(win, &bounds[0], &bounds[1]);
wm_cursor_position_to_ghost_screen_coords(win, &bounds[2], &bounds[3]);
if (wrap_region) {
wrap_region_screen = _wrap_region_buf;
wrap_region_screen[0] = wrap_region->xmin;
wrap_region_screen[1] = wrap_region->ymax;
wrap_region_screen[2] = wrap_region->xmax;
wrap_region_screen[3] = wrap_region->ymin;
wm_cursor_position_to_ghost_screen_coords(win, &wrap_region_screen[0], &wrap_region_screen[1]);
wm_cursor_position_to_ghost_screen_coords(win, &wrap_region_screen[2], &wrap_region_screen[3]);
}
if (hide) {
mode = GHOST_kGrabHide;
}
else if (wrap) {
else if (wrap != WM_CURSOR_WRAP_NONE) {
mode = GHOST_kGrabWrap;
if (wrap == WM_CURSOR_WRAP_X) {
@ -252,7 +263,7 @@ void WM_cursor_grab_enable(wmWindow *win, int wrap, bool hide, int bounds[4])
if ((G.debug & G_DEBUG) == 0) {
if (win->ghostwin) {
if (win->eventstate->tablet.is_motion_absolute == false) {
GHOST_SetCursorGrab(win->ghostwin, mode, mode_axis, bounds, NULL);
GHOST_SetCursorGrab(win->ghostwin, mode, mode_axis, wrap_region_screen, NULL);
}
win->grabcursor = mode;

View File

@ -1517,8 +1517,8 @@ static int wm_operator_invoke(bContext *C,
/* Grab cursor during blocking modal operators (X11)
* Also check for macro. */
if (ot->flag & OPTYPE_BLOCKING || (op->opm && op->opm->type->flag & OPTYPE_BLOCKING)) {
int bounds[4] = {-1, -1, -1, -1};
int wrap = WM_CURSOR_WRAP_NONE;
eWM_CursorWrapAxis wrap = WM_CURSOR_WRAP_NONE;
const rcti *wrap_region = nullptr;
if (event && (U.uiflag & USER_CONTINUOUS_MOUSE)) {
const wmOperator *op_test = op->opm ? op->opm : op;
@ -1536,7 +1536,6 @@ static int wm_operator_invoke(bContext *C,
}
if (wrap) {
const rcti *winrect = nullptr;
ARegion *region = CTX_wm_region(C);
ScrArea *area = CTX_wm_area(C);
@ -1547,21 +1546,14 @@ static int wm_operator_invoke(bContext *C,
if (region && region->regiontype == RGN_TYPE_WINDOW &&
BLI_rcti_isect_pt_v(&region->winrct, event->xy)) {
winrect = &region->winrct;
wrap_region = &region->winrct;
}
else if (area && BLI_rcti_isect_pt_v(&area->totrct, event->xy)) {
winrect = &area->totrct;
}
if (winrect) {
bounds[0] = winrect->xmin;
bounds[1] = winrect->ymax;
bounds[2] = winrect->xmax;
bounds[3] = winrect->ymin;
wrap_region = &area->totrct;
}
}
WM_cursor_grab_enable(CTX_wm_window(C), wrap, false, bounds);
WM_cursor_grab_enable(CTX_wm_window(C), wrap, wrap_region, false);
}
/* Cancel UI handlers, typically tool-tips that can hang around

View File

@ -891,14 +891,13 @@ static void file_read_reports_finalize(BlendFileReadReport *bf_reports)
if (bf_reports->count.proxies_to_lib_overrides_success != 0 ||
bf_reports->count.proxies_to_lib_overrides_failures != 0) {
BKE_reportf(
bf_reports->reports,
RPT_WARNING,
"Proxies have been removed from Blender (%d proxies were automatically converted "
"to library overrides, %d proxies could not be converted and were cleared). "
"Consider re-saving any library .blend file with the newest Blender version",
bf_reports->count.proxies_to_lib_overrides_success,
bf_reports->count.proxies_to_lib_overrides_failures);
BKE_reportf(bf_reports->reports,
RPT_WARNING,
"Proxies have been removed from Blender (%d proxies were automatically converted "
"to library overrides, %d proxies could not be converted and were cleared). "
"Consider re-saving any library .blend file with the newest Blender version",
bf_reports->count.proxies_to_lib_overrides_success,
bf_reports->count.proxies_to_lib_overrides_failures);
}
if (bf_reports->count.sequence_strips_skipped != 0) {

View File

@ -411,8 +411,8 @@ static int wm_macro_modal(bContext *C, wmOperator *op, const wmEvent *event)
/* If operator is blocking, grab cursor.
* This may end up grabbing twice, but we don't care. */
if (op->opm->type->flag & OPTYPE_BLOCKING) {
int bounds[4] = {-1, -1, -1, -1};
int wrap = WM_CURSOR_WRAP_NONE;
const rcti *wrap_region = NULL;
if ((op->opm->flag & OP_IS_MODAL_GRAB_CURSOR) ||
(op->opm->type->flag & OPTYPE_GRAB_CURSOR_XY)) {
@ -428,14 +428,11 @@ static int wm_macro_modal(bContext *C, wmOperator *op, const wmEvent *event)
if (wrap) {
ARegion *region = CTX_wm_region(C);
if (region) {
bounds[0] = region->winrct.xmin;
bounds[1] = region->winrct.ymax;
bounds[2] = region->winrct.xmax;
bounds[3] = region->winrct.ymin;
wrap_region = &region->winrct;
}
}
WM_cursor_grab_enable(win, wrap, false, bounds);
WM_cursor_grab_enable(win, wrap, wrap_region, false);
}
}
}

View File

@ -1646,6 +1646,23 @@ GHOST_TDrawingContextType wm_ghost_drawing_context_type(const eGPUBackendType gp
return GHOST_kDrawingContextTypeNone;
}
eWM_CapabilitiesFlag WM_capabilities_flag(void)
{
static eWM_CapabilitiesFlag flag = -1;
if (flag != -1) {
return flag;
}
flag = 0;
if (GHOST_SupportsCursorWarp()) {
flag |= WM_CAPABILITY_CURSOR_WARP;
}
if (GHOST_SupportsWindowPosition()) {
flag |= WM_CAPABILITY_WINDOW_POSITION;
}
return flag;
}
/** \} */
/* -------------------------------------------------------------------- */
@ -2086,6 +2103,8 @@ void WM_init_input_devices(void)
void WM_cursor_warp(wmWindow *win, int x, int y)
{
/* This function requires access to the GHOST_SystemHandle (`g_system`). */
if (!(win && win->ghostwin)) {
return;
}

View File

@ -218,7 +218,7 @@ class TestBufferProtocol(TestHelper, unittest.TestCase):
def assertEqualMemviews(self, view1, view2):
props_to_compare = (
"contiguous", "format", "itemsize", "nbytes", "ndim",
"readonly", "shape", "strides", "suboffsets"
"readonly", "shape", "strides", "suboffsets",
)
for attr in props_to_compare:
self.assertEqual(getattr(view1, attr), getattr(view2, attr))