Merge branch 'master' into refactor-mesh-sharp-face-generic

This commit is contained in:
Hans Goudey 2023-01-09 16:10:31 -05:00
commit b4b294693a
435 changed files with 12965 additions and 4897 deletions

View File

@ -22,6 +22,14 @@ elseif(UNIX AND NOT APPLE)
)
endif()
# Boolean crashes with Arm assembly, see T103423.
if(BLENDER_PLATFORM_ARM)
set(GMP_OPTIONS
${GMP_OPTIONS}
--disable-assembly
)
endif()
ExternalProject_Add(external_gmp
URL file://${PACKAGE_DIR}/${GMP_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}

View File

@ -49,7 +49,7 @@ update-code:
#
buildbot:
gcc:
version: '9.0.0'
version: '11.0.0'
cuda10:
version: '10.1.243'
cuda11:

View File

@ -83,7 +83,7 @@ enum_use_layer_samples = (
enum_sampling_pattern = (
('SOBOL_BURLEY', "Sobol-Burley", "Use on-the-fly computed Owen-scrambled Sobol for random sampling", 0),
('TABULATED_SOBOL', "Tabulated Sobol", "Use precomputed tables of Owen-scrambled Sobol for random sampling", 1),
('TABULATED_SOBOL', "Tabulated Sobol", "Use pre-computed tables of Owen-scrambled Sobol for random sampling", 1),
)
enum_emission_sampling = (
@ -905,7 +905,8 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
use_fast_gi: BoolProperty(
name="Fast GI Approximation",
description="Approximate diffuse indirect light with background tinted ambient occlusion. This provides fast alternative to full global illumination, for interactive viewport rendering or final renders with reduced quality",
description="Approximate diffuse indirect light with background tinted ambient occlusion. "
"This provides fast alternative to full global illumination, for interactive viewport rendering or final renders with reduced quality",
default=False,
)
@ -1539,13 +1540,16 @@ class CyclesPreferences(bpy.types.AddonPreferences):
use_metalrt: BoolProperty(
name="MetalRT (Experimental)",
description="MetalRT for ray tracing uses less memory for scenes which use curves extensively, and can give better performance in specific cases. However this support is experimental and some scenes may render incorrectly",
description="MetalRT for ray tracing uses less memory for scenes which use curves extensively, and can give better "
"performance in specific cases. However this support is experimental and some scenes may render incorrectly",
default=False,
)
kernel_optimization_level: EnumProperty(
name="Kernel Optimization",
description="Kernels can be optimized based on scene content. Optimized kernels are requested at the start of a render. If optimized kernels are not available, rendering will proceed using generic kernels until the optimized set is available in the cache. This can result in additional CPU usage for a brief time (tens of seconds).",
description="Kernels can be optimized based on scene content. Optimized kernels are requested at the start of a render. "
"If optimized kernels are not available, rendering will proceed using generic kernels until the optimized set "
"is available in the cache. This can result in additional CPU usage for a brief time (tens of seconds)",
default='FULL',
items=(
('OFF', "Off", "Disable kernel optimization. Slowest rendering, no extra background CPU usage"),

View File

@ -22,7 +22,7 @@ class MetalDevice;
thread_mutex MetalDevice::existing_devices_mutex;
std::map<int, MetalDevice *> MetalDevice::active_device_ids;
/* Thread-safe device access for async work. Calling code must pass an appropriatelty scoped lock
/* Thread-safe device access for async work. Calling code must pass an appropriately scoped lock
* to existing_devices_mutex to safeguard against destruction of the returned instance. */
MetalDevice *MetalDevice::get_device_by_ID(int ID, thread_scoped_lock &existing_devices_mutex_lock)
{
@ -377,7 +377,8 @@ bool MetalDevice::load_kernels(const uint _kernel_features)
/* Only request generic kernels if they aren't cached in memory. */
if (make_source_and_check_if_compile_needed(PSO_GENERIC)) {
/* If needed, load them asynchronously in order to responsively message progess to the user. */
/* If needed, load them asynchronously in order to responsively message progress to the user.
*/
int this_device_id = this->device_id;
auto compile_kernels_fn = ^() {
compile_and_load(this_device_id, PSO_GENERIC);
@ -401,8 +402,7 @@ bool MetalDevice::make_source_and_check_if_compile_needed(MetalPipelineType pso_
void MetalDevice::compile_and_load(int device_id, MetalPipelineType pso_type)
{
/* Thread-safe front-end compilation. Typically the MSL->AIR compilation can take a few seconds,
* so we avoid blocking device teardown if the user cancels a render immediately.
*/
* so we avoid blocking device tear-down if the user cancels a render immediately. */
id<MTLDevice> mtlDevice;
string source;

View File

@ -364,7 +364,9 @@ ccl_device_inline void film_write_emission_or_background_pass(
}
# endif /* __DENOISING_FEATURES__ */
if (lightgroup != LIGHTGROUP_NONE && kernel_data.film.pass_lightgroup != PASS_UNUSED) {
const bool is_shadowcatcher = (path_flag & PATH_RAY_SHADOW_CATCHER_HIT) != 0;
if (!is_shadowcatcher && lightgroup != LIGHTGROUP_NONE &&
kernel_data.film.pass_lightgroup != PASS_UNUSED) {
film_write_pass_spectrum(buffer + kernel_data.film.pass_lightgroup + 3 * lightgroup,
contribution);
}
@ -373,13 +375,12 @@ ccl_device_inline void film_write_emission_or_background_pass(
/* Directly visible, write to emission or background pass. */
pass_offset = pass;
}
else if (kernel_data.kernel_features & KERNEL_FEATURE_LIGHT_PASSES) {
else if (is_shadowcatcher) {
/* Don't write any light passes for shadow catcher, for easier
* compositing back together of the combined pass. */
if (path_flag & PATH_RAY_SHADOW_CATCHER_HIT) {
return;
}
return;
}
else if (kernel_data.kernel_features & KERNEL_FEATURE_LIGHT_PASSES) {
if (path_flag & PATH_RAY_SURFACE_PASS) {
/* Indirectly visible through reflection. */
const Spectrum diffuse_weight = INTEGRATOR_STATE(state, path, pass_diffuse_weight);

View File

@ -180,8 +180,7 @@ ccl_device_inline void integrate_distant_lights(KernelGlobals kg,
/* Write to render buffer. */
guiding_record_background(kg, state, light_eval, mis_weight);
film_write_surface_emission(
kg, state, light_eval, mis_weight, render_buffer, kernel_data.background.lightgroup);
film_write_surface_emission(kg, state, light_eval, mis_weight, render_buffer, ls.group);
}
}
}

View File

@ -502,8 +502,15 @@ ccl_device_forceinline void integrate_surface_ao(KernelGlobals kg,
rng_state,
ccl_global float *ccl_restrict render_buffer)
{
const uint32_t path_flag = INTEGRATOR_STATE(state, path, flag);
if (!(kernel_data.kernel_features & KERNEL_FEATURE_AO_ADDITIVE) &&
!(INTEGRATOR_STATE(state, path, flag) & PATH_RAY_CAMERA)) {
!(path_flag & PATH_RAY_CAMERA)) {
return;
}
/* Skip AO for paths that were split off for shadow catchers to avoid double-counting. */
if (path_flag & PATH_RAY_SHADOW_CATCHER_PASS) {
return;
}

View File

@ -979,8 +979,10 @@ ccl_device_forceinline bool integrate_volume_phase_scatter(
INTEGRATOR_STATE_WRITE(state, path, throughput) = throughput_phase;
if (kernel_data.kernel_features & KERNEL_FEATURE_LIGHT_PASSES) {
INTEGRATOR_STATE_WRITE(state, path, pass_diffuse_weight) = one_spectrum();
INTEGRATOR_STATE_WRITE(state, path, pass_glossy_weight) = zero_spectrum();
if (INTEGRATOR_STATE(state, path, bounce) == 0) {
INTEGRATOR_STATE_WRITE(state, path, pass_diffuse_weight) = one_spectrum();
INTEGRATOR_STATE_WRITE(state, path, pass_glossy_weight) = zero_spectrum();
}
}
/* Update path state */

View File

@ -122,6 +122,7 @@ shader node_image_texture(int use_mapping = 0,
vector Nob = transform("world", "object", N);
/* project from direction vector to barycentric coordinates in triangles */
vector signed_Nob = Nob;
Nob = vector(fabs(Nob[0]), fabs(Nob[1]), fabs(Nob[2]));
Nob /= (Nob[0] + Nob[1] + Nob[2]);
@ -184,9 +185,10 @@ shader node_image_texture(int use_mapping = 0,
float tmp_alpha;
if (weight[0] > 0.0) {
point UV = point((signed_Nob[0] < 0.0) ? 1.0 - p[1] : p[1], p[2], 0.0);
Color += weight[0] * image_texture_lookup(filename,
p[1],
p[2],
UV[0],
UV[1],
tmp_alpha,
compress_as_srgb,
ignore_alpha,
@ -198,9 +200,10 @@ shader node_image_texture(int use_mapping = 0,
Alpha += weight[0] * tmp_alpha;
}
if (weight[1] > 0.0) {
point UV = point((signed_Nob[1] > 0.0) ? 1.0 - p[0] : p[0], p[2], 0.0);
Color += weight[1] * image_texture_lookup(filename,
p[0],
p[2],
UV[0],
UV[1],
tmp_alpha,
compress_as_srgb,
ignore_alpha,
@ -212,9 +215,10 @@ shader node_image_texture(int use_mapping = 0,
Alpha += weight[1] * tmp_alpha;
}
if (weight[2] > 0.0) {
point UV = point((signed_Nob[2] > 0.0) ? 1.0 - p[1] : p[1], p[0], 0.0);
Color += weight[2] * image_texture_lookup(filename,
p[1],
p[0],
UV[0],
UV[1],
tmp_alpha,
compress_as_srgb,
ignore_alpha,

View File

@ -32,7 +32,7 @@ static float shutter_curve_eval(float x, array<float> &shutter_curve)
return 1.0f;
}
x *= shutter_curve.size();
x = saturatef(x) * shutter_curve.size() - 1;
int index = (int)x;
float frac = x - index;
if (index < shutter_curve.size() - 1) {

View File

@ -289,19 +289,24 @@ RenderWork Session::run_update_for_next_iteration()
RenderWork render_work;
thread_scoped_lock scene_lock(scene->mutex);
thread_scoped_lock reset_lock(delayed_reset_.mutex);
bool have_tiles = true;
bool switched_to_new_tile = false;
bool did_reset = false;
const bool did_reset = delayed_reset_.do_reset;
if (delayed_reset_.do_reset) {
thread_scoped_lock buffers_lock(buffers_mutex_);
do_delayed_reset();
/* Perform delayed reset if requested. */
{
thread_scoped_lock reset_lock(delayed_reset_.mutex);
if (delayed_reset_.do_reset) {
did_reset = true;
/* After reset make sure the tile manager is at the first big tile. */
have_tiles = tile_manager_.next();
switched_to_new_tile = true;
thread_scoped_lock buffers_lock(buffers_mutex_);
do_delayed_reset();
/* After reset make sure the tile manager is at the first big tile. */
have_tiles = tile_manager_.next();
switched_to_new_tile = true;
}
}
/* Update number of samples in the integrator.

View File

@ -16,6 +16,7 @@ void util_cdf_invert(const int resolution,
const bool make_symmetric,
vector<float> &inv_cdf)
{
assert(cdf[0] == 0.0f && cdf[resolution] == 1.0f);
const float inv_resolution = 1.0f / (float)resolution;
const float range = to - from;
inv_cdf.resize(resolution);
@ -39,8 +40,8 @@ void util_cdf_invert(const int resolution,
}
else {
for (int i = 0; i < resolution; i++) {
float x = from + range * (float)i * inv_resolution;
int index = upper_bound(cdf.begin(), cdf.end(), x) - cdf.begin();
float x = (i + 0.5f) * inv_resolution;
int index = upper_bound(cdf.begin(), cdf.end(), x) - cdf.begin() - 1;
float t;
if (index < cdf.size() - 1) {
t = (x - cdf[index]) / (cdf[index + 1] - cdf[index]);
@ -49,7 +50,7 @@ void util_cdf_invert(const int resolution,
t = 0.0f;
index = resolution;
}
inv_cdf[i] = (index + t) * inv_resolution;
inv_cdf[i] = from + range * (index + t) * inv_resolution;
}
}
}

View File

@ -26,9 +26,11 @@ void util_cdf_evaluate(
cdf[i + 1] = cdf[i] + fabsf(y);
}
/* Normalize the CDF. */
float fac = (cdf[resolution] == 0.0f) ? 0.0f : 1.0f / cdf[resolution];
for (int i = 0; i <= resolution; i++) {
cdf[i] /= cdf[resolution];
cdf[i] *= fac;
}
cdf[resolution] = 1.0f;
}
/* Invert pre-calculated CDF function. */

View File

@ -21,7 +21,7 @@ struct Global;
/**
* This is stored per thread. Align to cache line size to avoid false sharing.
*/
struct alignas(64) Local {
struct alignas(128) Local {
/**
* Retain shared ownership of #Global to make sure that it is not destructed.
*/
@ -81,7 +81,7 @@ struct Global {
* To solve this, the memory counts are added to these global counters when the thread
* exists. The global counters are also used when the entire process starts to exit, because the
* #Local data of the main thread is already destructed when the leak detection happens (during
* destruction of static variables which happens after destruction of threadlocals).
* destruction of static variables which happens after destruction of thread-locals).
*/
std::atomic<int64_t> mem_in_use_outside_locals = 0;
/**
@ -153,7 +153,7 @@ Local::~Local()
if (this->is_main) {
/* The main thread started shutting down. Use global counters from now on to avoid accessing
* threadlocals after they have been destructed. */
* thread-locals after they have been destructed. */
use_local_counters.store(false, std::memory_order_relaxed);
}
/* Helps to detect when thread locals are accidentally accessed after destruction. */
@ -179,7 +179,7 @@ static void update_global_peak()
void memory_usage_init()
{
/* Makes sure that the static and threadlocal variables on the main thread are initialized. */
/* Makes sure that the static and thread-local variables on the main thread are initialized. */
get_local_data();
}

View File

@ -412,6 +412,7 @@ WARN_MSGID_NOT_CAPITALIZED_ALLOWED = {
"selected",
"selected and lock unselected",
"selected and unlock unselected",
"screen",
"the lazy dog",
"this legacy pose library to pose assets",
"to the top level of the tree",

View File

@ -542,6 +542,7 @@ class SpellChecker:
"voronoi",
"voxel", "voxels",
"vsync",
"vulkan",
"wireframe",
"zmask",
"ztransp",

View File

@ -1342,7 +1342,7 @@ url_manual_mapping = (
("bpy.types.armature.layers_protected*", "animation/armatures/properties/skeleton.html#bpy-types-armature-layers-protected"),
("bpy.types.assetmetadata.description*", "editors/asset_browser.html#bpy-types-assetmetadata-description"),
("bpy.types.bakesettings.normal_space*", "render/cycles/baking.html#bpy-types-bakesettings-normal-space"),
("bpy.types.brush.crease_pinch_factor*", "sculpt_paint/sculpting/tools/snake_hook.html#bpy-types-brush-crease-pinch-factor"),
("bpy.types.brush.crease_pinch_factor*", "sculpt_paint/brush/brush_settings.html#bpy-types-brush-crease-pinch-factor"),
("bpy.types.brush.elastic_deform_type*", "sculpt_paint/sculpting/tools/elastic_deform.html#bpy-types-brush-elastic-deform-type"),
("bpy.types.brush.texture_sample_bias*", "sculpt_paint/brush/texture.html#bpy-types-brush-texture-sample-bias"),
("bpy.types.brush.use_cloth_collision*", "sculpt_paint/sculpting/tools/cloth.html#bpy-types-brush-use-cloth-collision"),
@ -1468,6 +1468,7 @@ url_manual_mapping = (
("bpy.types.bakesettings.cage_object*", "render/cycles/baking.html#bpy-types-bakesettings-cage-object"),
("bpy.types.bakesettings.margin_type*", "render/cycles/baking.html#bpy-types-bakesettings-margin-type"),
("bpy.types.bone.use_relative_parent*", "animation/armatures/bones/properties/relations.html#bpy-types-bone-use-relative-parent"),
("bpy.types.brush.area_radius_factor*", "sculpt_paint/brush/brush_settings.html#bpy-types-brush-area-radius-factor"),
("bpy.types.brush.auto_smooth_factor*", "sculpt_paint/brush/brush_settings.html#bpy-types-brush-auto-smooth-factor"),
("bpy.types.brush.smooth_deform_type*", "sculpt_paint/sculpting/tools/smooth.html#bpy-types-brush-smooth-deform-type"),
("bpy.types.brush.use_connected_only*", "sculpt_paint/sculpting/tools/pose.html#bpy-types-brush-use-connected-only"),
@ -1781,6 +1782,7 @@ url_manual_mapping = (
("bpy.types.functionnodefloattoint*", "modeling/geometry_nodes/utilities/float_to_integer.html#bpy-types-functionnodefloattoint"),
("bpy.types.functionnodeinputcolor*", "modeling/geometry_nodes/input/color.html#bpy-types-functionnodeinputcolor"),
("bpy.types.geometrynodeconvexhull*", "modeling/geometry_nodes/geometry/convex_hull.html#bpy-types-geometrynodeconvexhull"),
("bpy.types.geometrynodeimageinput*", "modeling/geometry_nodes/input/image_input.html#bpy-types-geometrynodeimageinput"),
("bpy.types.geometrynodeinputindex*", "modeling/geometry_nodes/input/input_index.html#bpy-types-geometrynodeinputindex"),
("bpy.types.geometrynodeisviewport*", "modeling/geometry_nodes/input/is_viewport.html#bpy-types-geometrynodeisviewport"),
("bpy.types.geometrynodemeshcircle*", "modeling/geometry_nodes/mesh_primitives/mesh_circle.html#bpy-types-geometrynodemeshcircle"),
@ -2172,10 +2174,11 @@ url_manual_mapping = (
("bpy.types.bakesettings.margin*", "render/cycles/baking.html#bpy-types-bakesettings-margin"),
("bpy.types.bakesettings.target*", "render/cycles/baking.html#bpy-types-bakesettings-target"),
("bpy.types.brush.cloth_damping*", "sculpt_paint/sculpting/tools/cloth.html#bpy-types-brush-cloth-damping"),
("bpy.types.brush.deform_target*", "sculpt_paint/brush/brush_settings.html#bpy-types-brush-deform-target"),
("bpy.types.brush.falloff_shape*", "sculpt_paint/brush/falloff.html#bpy-types-brush-falloff-shape"),
("bpy.types.brush.icon_filepath*", "sculpt_paint/brush/brush.html#bpy-types-brush-icon-filepath"),
("bpy.types.brush.stroke_method*", "sculpt_paint/brush/stroke.html#bpy-types-brush-stroke-method"),
("bpy.types.brush.tip_roundness*", "sculpt_paint/sculpting/tools/clay_strips.html#bpy-types-brush-tip-roundness"),
("bpy.types.brush.tip_roundness*", "sculpt_paint/brush/brush_settings.html#bpy-types-brush-tip-roundness"),
("bpy.types.camera.display_size*", "render/cameras.html#bpy-types-camera-display-size"),
("bpy.types.camera.sensor_width*", "render/cameras.html#bpy-types-camera-sensor-width"),
("bpy.types.compositornodedblur*", "compositing/types/filter/directional_blur.html#bpy-types-compositornodedblur"),
@ -2705,6 +2708,7 @@ url_manual_mapping = (
("bpy.types.armature.rigify*", "addons/rigging/rigify/basics.html#bpy-types-armature-rigify"),
("bpy.types.bone.use_deform*", "animation/armatures/bones/properties/deform.html#bpy-types-bone-use-deform"),
("bpy.types.booleanmodifier*", "modeling/modifiers/generate/booleans.html#bpy-types-booleanmodifier"),
("bpy.types.brush.direction*", "sculpt_paint/brush/brush_settings.html#bpy-types-brush-direction"),
("bpy.types.brush.mask_tool*", "sculpt_paint/sculpting/tools/mask.html#bpy-types-brush-mask-tool"),
("bpy.types.constraint.mute*", "animation/constraints/interface/header.html#bpy-types-constraint-mute"),
("bpy.types.constraint.name*", "animation/constraints/interface/header.html#bpy-types-constraint-name"),
@ -2798,6 +2802,7 @@ url_manual_mapping = (
("bpy.ops.wm.save_mainfile*", "files/blend/open_save.html#bpy-ops-wm-save-mainfile"),
("bpy.types.bone.show_wire*", "animation/armatures/bones/properties/display.html#bpy-types-bone-show-wire"),
("bpy.types.brush.hardness*", "sculpt_paint/brush/brush_settings.html#bpy-types-brush-hardness"),
("bpy.types.brush.strength*", "sculpt_paint/brush/brush_settings.html#bpy-types-brush-strength"),
("bpy.types.curves.surface*", "modeling/curves/primitives.html#bpy-types-curves-surface"),
("bpy.types.curvesmodifier*", "editors/video_sequencer/sequencer/sidebar/modifiers.html#bpy-types-curvesmodifier"),
("bpy.types.ffmpegsettings*", "render/output/properties/output.html#bpy-types-ffmpegsettings"),
@ -3111,6 +3116,7 @@ url_manual_mapping = (
("bpy.types.bonegroups*", "animation/armatures/properties/bone_groups.html#bpy-types-bonegroups"),
("bpy.types.bpy_struct*", "files/data_blocks.html#bpy-types-bpy-struct"),
("bpy.types.brush.rate*", "sculpt_paint/brush/stroke.html#bpy-types-brush-rate"),
("bpy.types.brush.size*", "sculpt_paint/brush/brush_settings.html#bpy-types-brush-size"),
("bpy.types.collection*", "scene_layout/collections/collections.html#bpy-types-collection"),
("bpy.types.compositor*", "compositing/index.html#bpy-types-compositor"),
("bpy.types.constraint*", "animation/constraints/index.html#bpy-types-constraint"),

View File

@ -81,8 +81,8 @@ class ASSET_OT_open_containing_blend_file(Operator):
@classmethod
def poll(cls, context):
asset_file_handle = getattr(context, 'asset_file_handle', None)
asset_library_ref = getattr(context, 'asset_library_ref', None)
asset_file_handle = getattr(context, "asset_file_handle", None)
asset_library_ref = getattr(context, "asset_library_ref", None)
if not asset_library_ref:
cls.poll_message_set("No asset library selected")

View File

@ -620,7 +620,7 @@ class CLIP_OT_setup_tracking_scene(Operator):
if not view_layers.get("Foreground"):
if len(view_layers) == 1:
fg = view_layers[0]
fg.name = 'Foreground'
fg.name = "Foreground"
else:
fg = view_layers.new("Foreground")

View File

@ -142,7 +142,7 @@ class SCENE_OT_freestyle_add_edge_marks_to_keying_set(Operator):
bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
for i, edge in enumerate(mesh.edges):
if not edge.hide and edge.select:
path = 'edges[%d].use_freestyle_mark' % i
path = "edges[%d].use_freestyle_mark" % i
ks.paths.add(mesh, path, index=0)
bpy.ops.object.mode_set(mode=ob_mode, toggle=False)
return {'FINISHED'}
@ -173,7 +173,7 @@ class SCENE_OT_freestyle_add_face_marks_to_keying_set(Operator):
bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
for i, polygon in enumerate(mesh.polygons):
if not polygon.hide and polygon.select:
path = 'polygons[%d].use_freestyle_mark' % i
path = "polygons[%d].use_freestyle_mark" % i
ks.paths.add(mesh, path, index=0)
bpy.ops.object.mode_set(mode=ob_mode, toggle=False)
return {'FINISHED'}

View File

@ -223,7 +223,7 @@ class SequencerFadesAdd(Operator):
if not self.is_long_enough(sequence, duration):
continue
animated_property = 'volume' if hasattr(sequence, 'volume') else 'blend_alpha'
animated_property = "volume" if hasattr(sequence, "volume") else "blend_alpha"
fade_fcurve = self.fade_find_or_create_fcurve(context, sequence, animated_property)
fades = self.calculate_fades(sequence, fade_fcurve, animated_property, duration)
self.fade_animation_clear(fade_fcurve, fades)

View File

@ -2507,7 +2507,7 @@ class WM_OT_batch_rename(Operator):
('COLLECTION', "Collections", ""),
('MATERIAL', "Materials", ""),
None,
# Enum identifiers are compared with 'object.type'.
# Enum identifiers are compared with `object.type`.
# Follow order in "Add" menu.
('MESH', "Meshes", ""),
('CURVE', "Curves", ""),

View File

@ -66,7 +66,7 @@ class MotionPathButtonsPanel:
col.operator(op_category + ".paths_calculate", text="Calculate...", icon=icon)
# Update All & Clear All.
# Note that 'col' is from inside the preceeding `if` or `else` block.
# Note that `col` is from inside the preceding `if` or `else` block.
row = col.row(align=True)
row.operator("object.paths_update_visible", text="Update All Paths", icon='WORLD')
row.operator(op_category + ".paths_clear", text="", icon='X').only_selected = False

View File

@ -87,7 +87,7 @@ class ConstraintButtonsPanel:
@staticmethod
def target_template(layout, con, subtargets=True):
col = layout.column()
col.prop(con, "target") # XXX limiting settings for only 'curves' or some type of object
col.prop(con, "target") # XXX: limiting settings for only `curves` or some type of object.
if con.target and subtargets:
if con.target.type == 'ARMATURE':

View File

@ -87,7 +87,7 @@ class BONE_PT_transform(BoneButtonsPanel, Panel):
row.use_property_decorate = False
row.prop(pchan, "lock_rotation", text="", emboss=False, icon='DECORATE_UNLOCKED')
row = layout.row(align=True)
row.prop(pchan, "rotation_mode", text='Mode')
row.prop(pchan, "rotation_mode", text="Mode")
row.label(text="", icon='BLANK1')
col = layout.column()
@ -403,9 +403,9 @@ class BONE_PT_inverse_kinematics(BoneButtonsPanel, Panel):
col.prop(pchan, "ik_rotation_weight", text="IK Rotation Weight", slider=True)
col.active = active
# not supported yet
#row = layout.row()
#row.prop(pchan, "use_ik_linear_control", text="Joint Size")
#row.prop(pchan, "ik_linear_weight", text="Weight", slider=True)
# row = layout.row()
# row.prop(pchan, "use_ik_linear_control", text="Joint Size")
# row.prop(pchan, "ik_linear_weight", text="Weight", slider=True)
class BONE_PT_deform(BoneButtonsPanel, Panel):

View File

@ -12,7 +12,7 @@ class DataButtonsPanel:
@classmethod
def poll(cls, context):
engine = context.scene.render.engine
return hasattr(context, 'curves') and context.curves and (engine in cls.COMPAT_ENGINES)
return hasattr(context, "curves") and context.curves and (engine in cls.COMPAT_ENGINES)
class DATA_PT_context_curves(DataButtonsPanel, Panel):
@ -73,8 +73,8 @@ class CURVES_MT_add_attribute(Menu):
layout = self.layout
curves = context.curves
self.add_standard_attribute(layout, curves, 'radius', 'FLOAT', 'POINT')
self.add_standard_attribute(layout, curves, 'color', 'FLOAT_COLOR', 'POINT')
self.add_standard_attribute(layout, curves, "radius", 'FLOAT', 'POINT')
self.add_standard_attribute(layout, curves, "color", 'FLOAT_COLOR', 'POINT')
layout.separator()
@ -102,8 +102,8 @@ class CURVES_UL_attributes(UIList):
return flags, indices
def draw_item(self, _context, layout, _data, attribute, _icon, _active_data, _active_propname, _index):
data_type = attribute.bl_rna.properties['data_type'].enum_items[attribute.data_type]
domain = attribute.bl_rna.properties['domain'].enum_items[attribute.domain]
data_type = attribute.bl_rna.properties["data_type"].enum_items[attribute.data_type]
domain = attribute.bl_rna.properties["domain"].enum_items[attribute.domain]
split = layout.split(factor=0.5)
split.emboss = 'NONE'

View File

@ -551,7 +551,7 @@ class MESH_UL_attributes(UIList):
return flags, indices
def draw_item(self, _context, layout, _data, attribute, _icon, _active_data, _active_propname, _index):
data_type = attribute.bl_rna.properties['data_type'].enum_items[attribute.data_type]
data_type = attribute.bl_rna.properties["data_type"].enum_items[attribute.data_type]
domain_name = self.display_domain_names.get(attribute.domain, "")
@ -658,7 +658,7 @@ class ColorAttributesListBase():
class MESH_UL_color_attributes(UIList, ColorAttributesListBase):
def draw_item(self, _context, layout, data, attribute, _icon, _active_data, _active_propname, _index):
data_type = attribute.bl_rna.properties['data_type'].enum_items[attribute.data_type]
data_type = attribute.bl_rna.properties["data_type"].enum_items[attribute.data_type]
domain_name = self.display_domain_names.get(attribute.domain, "")

View File

@ -12,7 +12,7 @@ class DataButtonsPanel:
@classmethod
def poll(cls, context):
engine = context.scene.render.engine
return hasattr(context, 'pointcloud') and context.pointcloud and (engine in cls.COMPAT_ENGINES)
return hasattr(context, "pointcloud") and context.pointcloud and (engine in cls.COMPAT_ENGINES)
class DATA_PT_context_pointcloud(DataButtonsPanel, Panel):
@ -53,10 +53,10 @@ class POINTCLOUD_MT_add_attribute(Menu):
layout = self.layout
pointcloud = context.pointcloud
self.add_standard_attribute(layout, pointcloud, 'radius', 'FLOAT', 'POINT')
self.add_standard_attribute(layout, pointcloud, 'color', 'FLOAT_COLOR', 'POINT')
self.add_standard_attribute(layout, pointcloud, 'id', 'INT', 'POINT')
self.add_standard_attribute(layout, pointcloud, 'velocity', 'FLOAT_VECTOR', 'POINT')
self.add_standard_attribute(layout, pointcloud, "radius", 'FLOAT', 'POINT')
self.add_standard_attribute(layout, pointcloud, "color", 'FLOAT_COLOR', 'POINT')
self.add_standard_attribute(layout, pointcloud, "id", 'INT', 'POINT')
self.add_standard_attribute(layout, pointcloud, "velocity", 'FLOAT_VECTOR', 'POINT')
layout.separator()
@ -84,7 +84,7 @@ class POINTCLOUD_UL_attributes(UIList):
return flags, indices
def draw_item(self, _context, layout, _data, attribute, _icon, _active_data, _active_propname, _index):
data_type = attribute.bl_rna.properties['data_type'].enum_items[attribute.data_type]
data_type = attribute.bl_rna.properties["data_type"].enum_items[attribute.data_type]
split = layout.split(factor=0.75)
split.emboss = 'NONE'

View File

@ -68,7 +68,7 @@ class DATA_PT_volume_file(DataButtonsPanel, Panel):
class VOLUME_UL_grids(UIList):
def draw_item(self, _context, layout, _data, grid, _icon, _active_data, _active_propname, _index):
name = grid.name
data_type = grid.bl_rna.properties['data_type'].enum_items[grid.data_type]
data_type = grid.bl_rna.properties["data_type"].enum_items[grid.data_type]
layout.emboss = 'NONE'
layout.label(text=name)

View File

@ -324,7 +324,7 @@ class RENDER_PT_output_color_management(RenderOutputButtonsPanel, Panel):
col = flow.column()
if image_settings.has_linear_colorspace:
if hasattr(owner, 'linear_colorspace_settings'):
if hasattr(owner, "linear_colorspace_settings"):
col.prop(owner.linear_colorspace_settings, "name", text="Color Space")
else:
col.prop(owner.display_settings, "display_device")

View File

@ -31,10 +31,10 @@ class CONSOLE_MT_view(Menu):
layout = self.layout
props = layout.operator("wm.context_cycle_int", text="Zoom In")
props.data_path = 'space_data.font_size'
props.data_path = "space_data.font_size"
props.reverse = False
props = layout.operator("wm.context_cycle_int", text="Zoom Out")
props.data_path = 'space_data.font_size'
props.data_path = "space_data.font_size"
props.reverse = True
layout.separator()
@ -62,7 +62,7 @@ class CONSOLE_MT_language(Menu):
layout = self.layout
layout.column()
# Collect modules with 'console_*.execute'
# Collect modules with `console_*.execute`.
languages = []
for modname, mod in sys.modules.items():
if modname.startswith("console_") and hasattr(mod, "execute"):

View File

@ -550,7 +550,7 @@ class DOPESHEET_PT_custom_props_action(PropertyPanel, Panel):
bl_space_type = 'DOPESHEET_EDITOR'
bl_category = "Action"
bl_region_type = 'UI'
bl_context = 'data'
bl_context = "data"
_context_path = "active_action"
_property_type = bpy.types.Action

View File

@ -742,7 +742,7 @@ class IMAGE_HT_header(Header):
# Snap.
snap_uv_element = tool_settings.snap_uv_element
act_snap_uv_element = tool_settings.bl_rna.properties['snap_uv_element'].enum_items[snap_uv_element]
act_snap_uv_element = tool_settings.bl_rna.properties["snap_uv_element"].enum_items[snap_uv_element]
row = layout.row(align=True)
row.prop(tool_settings, "use_snap_uv", text="")

View File

@ -41,7 +41,7 @@ class NODE_HT_header(Header):
layout.template_header()
# Now expanded via the 'ui_type'
# Now expanded via the `ui_type`.
# layout.prop(snode, "tree_type", text="")
if snode.tree_type == 'ShaderNodeTree':
@ -661,7 +661,7 @@ class NODE_PT_active_node_properties(Panel):
)
def show_socket_input(self, socket):
return hasattr(socket, 'draw') and socket.enabled and not socket.is_linked
return hasattr(socket, "draw") and socket.enabled and not socket.is_linked
class NODE_PT_texture_mapping(Panel):
@ -961,7 +961,7 @@ def node_panel(cls):
node_cls.bl_space_type = 'NODE_EDITOR'
node_cls.bl_region_type = 'UI'
node_cls.bl_category = "Options"
if hasattr(node_cls, 'bl_parent_id'):
if hasattr(node_cls, "bl_parent_id"):
node_cls.bl_parent_id = 'NODE_' + node_cls.bl_parent_id
return node_cls

View File

@ -51,8 +51,8 @@ ToolDef = namedtuple(
"idname",
# The name to display in the interface.
"label",
# Description (for tool-tip), when not set, use the description of 'operator',
# may be a string or a 'function(context, item, key-map) -> string'.
# Description (for tool-tip), when not set, use the description of `operator`,
# may be a string or a `function(context, item, key-map) -> string`.
"description",
# The name of the icon to use (found in `release/datafiles/icons`) or None for no icon.
"icon",
@ -88,7 +88,7 @@ ToolDef = namedtuple(
# Note that this isn't used for Blender's built in tools which use the built-in key-map.
# Keep this functionality since it's likely useful for add-on key-maps.
#
# Warning: currently 'from_dict' this is a list of one item,
# Warning: currently `from_dict` this is a list of one item,
# so internally we can swap the key-map function for the key-map itself.
# This isn't very nice and may change, tool definitions shouldn't care about this.
"keymap",
@ -256,7 +256,7 @@ class ToolSelectPanelHelper:
# tool flattening
#
# usually 'tools' is already expanded into ToolDef
# usually 'tools' is already expanded into `ToolDef`
# but when registering a tool, this can still be a function
# (_tools_flatten is usually called with cls.tools_from_context(context)
# [that already yields from the function])
@ -792,7 +792,7 @@ class ToolSelectPanelHelper:
item, tool, icon_value = cls._tool_get_active(context, space_type, mode, with_icon=True)
if item is None:
return None
# Note: we could show 'item.text' here but it makes the layout jitter when switching tools.
# NOTE: we could show `item.text` here but it makes the layout jitter when switching tools.
# Add some spacing since the icon is currently assuming regular small icon size.
if show_tool_icon_always:
layout.label(text=" " + iface_(item.label, "Operator"), icon_value=icon_value)

View File

@ -2706,7 +2706,7 @@ class IMAGE_PT_tools_active(ToolSelectPanelHelper, Panel):
)
# Private tools dictionary, store data to implement `tools_all` & `tools_from_context`.
# The keys match image spaces modes: 'context.space_data.mode'.
# The keys match image spaces modes: `context.space_data.mode`.
# The values represent the tools, see `ToolSelectPanelHelper` for details.
_tools = {
None: [
@ -2892,7 +2892,7 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel):
)
# Private tools dictionary, store data to implement `tools_all` & `tools_from_context`.
# The keys match object-modes from: 'context.mode'.
# The keys match object-modes from: `context.mode`.
# The values represent the tools, see `ToolSelectPanelHelper` for details.
_tools = {
None: [
@ -3230,7 +3230,7 @@ class SEQUENCER_PT_tools_active(ToolSelectPanelHelper, Panel):
)
# Private tools dictionary, store data to implement `tools_all` & `tools_from_context`.
# The keys match sequence editors view type: 'context.space_data.view_type'.
# The keys match sequence editors view type: `context.space_data.view_type`.
# The values represent the tools, see `ToolSelectPanelHelper` for details.
_tools = {
None: [

View File

@ -605,7 +605,7 @@ class USERPREF_PT_system_cycles_devices(SystemPanel, CenterAlignMixIn, Panel):
class USERPREF_PT_system_gpu_backend(SystemPanel, CenterAlignMixIn, Panel):
bl_label = "GPU Backend"
bl_label = "GPU Back end"
@classmethod
def poll(cls, _context):
@ -622,7 +622,7 @@ class USERPREF_PT_system_gpu_backend(SystemPanel, CenterAlignMixIn, Panel):
col.prop(system, "gpu_backend")
if system.gpu_backend != gpu.platform.backend_type_get():
layout.label(text="Requires a restart of Blender to take effect.", icon='INFO')
layout.label(text="Requires a restart of Blender to take effect", icon='INFO')
class USERPREF_PT_system_os_settings(SystemPanel, CenterAlignMixIn, Panel):
@ -1286,7 +1286,7 @@ class ThemeGenericClassGenerator:
def generate_panel_classes_from_theme_areas():
from bpy.types import Theme
for theme_area in Theme.bl_rna.properties['theme_area'].enum_items_static:
for theme_area in Theme.bl_rna.properties["theme_area"].enum_items_static:
if theme_area.identifier in {'USER_INTERFACE', 'STYLE', 'BONE_COLOR_SETS'}:
continue
@ -2324,7 +2324,6 @@ class USERPREF_PT_experimental_new_features(ExperimentalPanel, Panel):
({"property": "use_sculpt_tools_tilt"}, "T82877"),
({"property": "use_extended_asset_browser"}, ("project/view/130/", "Project Page")),
({"property": "use_override_templates"}, ("T73318", "Milestone 4")),
({"property": "use_realtime_compositor"}, "T99210"),
),
)

View File

@ -70,7 +70,7 @@ class VIEW3D_HT_tool_header(Header):
layout.popover("VIEW3D_PT_tools_brush_falloff")
layout.popover("VIEW3D_PT_tools_brush_display")
# Note: general mode options should be added to 'draw_mode_settings'.
# NOTE: general mode options should be added to `draw_mode_settings`.
if tool_mode == 'SCULPT':
if is_valid_context:
draw_3d_brush_settings(layout, tool_mode)
@ -889,7 +889,7 @@ class VIEW3D_HT_header(Header):
row = layout.row()
row.active = (object_mode == 'EDIT') or (shading.type in {'WIREFRAME', 'SOLID'})
# While exposing 'shading.show_xray(_wireframe)' is correct.
# While exposing `shading.show_xray(_wireframe)` is correct.
# this hides the key shortcut from users: T70433.
if has_pose_mode:
draw_depressed = overlay.show_xray_bone
@ -2290,9 +2290,9 @@ class VIEW3D_MT_add(Menu):
def draw(self, context):
layout = self.layout
# note, don't use 'EXEC_SCREEN' or operators won't get the 'v3d' context.
# NOTE: don't use 'EXEC_SCREEN' or operators won't get the `v3d` context.
# Note: was EXEC_AREA, but this context does not have the 'rv3d', which prevents
# NOTE: was `EXEC_AREA`, but this context does not have the `rv3d`, which prevents
# "align_view" to work on first call (see T32719).
layout.operator_context = 'EXEC_REGION_WIN'
@ -3291,23 +3291,23 @@ class VIEW3D_MT_mask(Menu):
layout.separator()
props = layout.operator("sculpt.mask_filter", text='Smooth Mask')
props = layout.operator("sculpt.mask_filter", text="Smooth Mask")
props.filter_type = 'SMOOTH'
props = layout.operator("sculpt.mask_filter", text='Sharpen Mask')
props = layout.operator("sculpt.mask_filter", text="Sharpen Mask")
props.filter_type = 'SHARPEN'
props = layout.operator("sculpt.mask_filter", text='Grow Mask')
props = layout.operator("sculpt.mask_filter", text="Grow Mask")
props.filter_type = 'GROW'
props = layout.operator("sculpt.mask_filter", text='Shrink Mask')
props = layout.operator("sculpt.mask_filter", text="Shrink Mask")
props.filter_type = 'SHRINK'
props = layout.operator("sculpt.mask_filter", text='Increase Contrast')
props = layout.operator("sculpt.mask_filter", text="Increase Contrast")
props.filter_type = 'CONTRAST_INCREASE'
props.auto_iteration_count = False
props = layout.operator("sculpt.mask_filter", text='Decrease Contrast')
props = layout.operator("sculpt.mask_filter", text="Decrease Contrast")
props.filter_type = 'CONTRAST_DECREASE'
props.auto_iteration_count = False
@ -3352,13 +3352,13 @@ class VIEW3D_MT_face_sets(Menu):
def draw(self, _context):
layout = self.layout
op = layout.operator("sculpt.face_sets_create", text='Face Set from Masked')
op = layout.operator("sculpt.face_sets_create", text="Face Set from Masked")
op.mode = 'MASKED'
op = layout.operator("sculpt.face_sets_create", text='Face Set from Visible')
op = layout.operator("sculpt.face_sets_create", text="Face Set from Visible")
op.mode = 'VISIBLE'
op = layout.operator("sculpt.face_sets_create", text='Face Set from Edit Mode Selection')
op = layout.operator("sculpt.face_sets_create", text="Face Set from Edit Mode Selection")
op.mode = 'SELECTION'
layout.separator()
@ -3367,10 +3367,10 @@ class VIEW3D_MT_face_sets(Menu):
layout.separator()
op = layout.operator("sculpt.face_set_edit", text='Grow Face Set')
op = layout.operator("sculpt.face_set_edit", text="Grow Face Set")
op.mode = 'GROW'
op = layout.operator("sculpt.face_set_edit", text='Shrink Face Set')
op = layout.operator("sculpt.face_set_edit", text="Shrink Face Set")
op.mode = 'SHRINK'
layout.separator()
@ -3389,18 +3389,18 @@ class VIEW3D_MT_face_sets(Menu):
layout.separator()
op = layout.operator("mesh.face_set_extract", text='Extract Face Set')
op = layout.operator("mesh.face_set_extract", text="Extract Face Set")
layout.separator()
op = layout.operator("sculpt.face_set_change_visibility", text='Invert Visible Face Sets')
op = layout.operator("sculpt.face_set_change_visibility", text="Invert Visible Face Sets")
op.mode = 'INVERT'
op = layout.operator("sculpt.reveal_all", text='Show All Face Sets')
op = layout.operator("sculpt.reveal_all", text="Show All Face Sets")
layout.separator()
op = layout.operator("sculpt.face_sets_randomize_colors", text='Randomize Colors')
op = layout.operator("sculpt.face_sets_randomize_colors", text="Randomize Colors")
class VIEW3D_MT_sculpt_set_pivot(Menu):
@ -3431,31 +3431,31 @@ class VIEW3D_MT_face_sets_init(Menu):
def draw(self, _context):
layout = self.layout
op = layout.operator("sculpt.face_sets_init", text='By Loose Parts')
op = layout.operator("sculpt.face_sets_init", text="By Loose Parts")
op.mode = 'LOOSE_PARTS'
op = layout.operator("sculpt.face_sets_init", text='By Face Set Boundaries')
op = layout.operator("sculpt.face_sets_init", text="By Face Set Boundaries")
op.mode = 'FACE_SET_BOUNDARIES'
op = layout.operator("sculpt.face_sets_init", text='By Materials')
op = layout.operator("sculpt.face_sets_init", text="By Materials")
op.mode = 'MATERIALS'
op = layout.operator("sculpt.face_sets_init", text='By Normals')
op = layout.operator("sculpt.face_sets_init", text="By Normals")
op.mode = 'NORMALS'
op = layout.operator("sculpt.face_sets_init", text='By UV Seams')
op = layout.operator("sculpt.face_sets_init", text="By UV Seams")
op.mode = 'UV_SEAMS'
op = layout.operator("sculpt.face_sets_init", text='By Edge Creases')
op = layout.operator("sculpt.face_sets_init", text="By Edge Creases")
op.mode = 'CREASES'
op = layout.operator("sculpt.face_sets_init", text='By Edge Bevel Weight')
op = layout.operator("sculpt.face_sets_init", text="By Edge Bevel Weight")
op.mode = 'BEVEL_WEIGHT'
op = layout.operator("sculpt.face_sets_init", text='By Sharp Edges')
op = layout.operator("sculpt.face_sets_init", text="By Sharp Edges")
op.mode = 'SHARP_EDGES'
op = layout.operator("sculpt.face_sets_init", text='By Face Maps')
op = layout.operator("sculpt.face_sets_init", text="By Face Maps")
op.mode = 'FACE_MAPS'
@ -3465,13 +3465,13 @@ class VIEW3D_MT_random_mask(Menu):
def draw(self, _context):
layout = self.layout
op = layout.operator("sculpt.mask_init", text='Per Vertex')
op = layout.operator("sculpt.mask_init", text="Per Vertex")
op.mode = 'RANDOM_PER_VERTEX'
op = layout.operator("sculpt.mask_init", text='Per Face Set')
op = layout.operator("sculpt.mask_init", text="Per Face Set")
op.mode = 'RANDOM_PER_FACE_SET'
op = layout.operator("sculpt.mask_init", text='Per Loose Part')
op = layout.operator("sculpt.mask_init", text="Per Loose Part")
op.mode = 'RANDOM_PER_LOOSE_PART'
@ -3660,10 +3660,6 @@ class VIEW3D_MT_pose_propagate(Menu):
def draw(self, _context):
layout = self.layout
layout.operator("pose.propagate").mode = 'WHILE_HELD'
layout.separator()
layout.operator("pose.propagate", text="To Next Keyframe").mode = 'NEXT_KEY'
layout.operator("pose.propagate", text="To Last Keyframe (Make Cyclic)").mode = 'LAST_KEY'
@ -5500,23 +5496,23 @@ class VIEW3D_MT_sculpt_mask_edit_pie(Menu):
layout = self.layout
pie = layout.menu_pie()
op = pie.operator("paint.mask_flood_fill", text='Invert Mask')
op = pie.operator("paint.mask_flood_fill", text="Invert Mask")
op.mode = 'INVERT'
op = pie.operator("paint.mask_flood_fill", text='Clear Mask')
op = pie.operator("paint.mask_flood_fill", text="Clear Mask")
op.mode = 'VALUE'
op.value = 0.0
op = pie.operator("sculpt.mask_filter", text='Smooth Mask')
op = pie.operator("sculpt.mask_filter", text="Smooth Mask")
op.filter_type = 'SMOOTH'
op = pie.operator("sculpt.mask_filter", text='Sharpen Mask')
op = pie.operator("sculpt.mask_filter", text="Sharpen Mask")
op.filter_type = 'SHARPEN'
op = pie.operator("sculpt.mask_filter", text='Grow Mask')
op = pie.operator("sculpt.mask_filter", text="Grow Mask")
op.filter_type = 'GROW'
op = pie.operator("sculpt.mask_filter", text='Shrink Mask')
op = pie.operator("sculpt.mask_filter", text="Shrink Mask")
op.filter_type = 'SHRINK'
op = pie.operator("sculpt.mask_filter", text='Increase Contrast')
op = pie.operator("sculpt.mask_filter", text="Increase Contrast")
op.filter_type = 'CONTRAST_INCREASE'
op.auto_iteration_count = False
op = pie.operator("sculpt.mask_filter", text='Decrease Contrast')
op = pie.operator("sculpt.mask_filter", text="Decrease Contrast")
op.filter_type = 'CONTRAST_DECREASE'
op.auto_iteration_count = False
@ -5565,16 +5561,16 @@ class VIEW3D_MT_sculpt_face_sets_edit_pie(Menu):
layout = self.layout
pie = layout.menu_pie()
op = pie.operator("sculpt.face_sets_create", text='Face Set from Masked')
op = pie.operator("sculpt.face_sets_create", text="Face Set from Masked")
op.mode = 'MASKED'
op = pie.operator("sculpt.face_sets_create", text='Face Set from Visible')
op = pie.operator("sculpt.face_sets_create", text="Face Set from Visible")
op.mode = 'VISIBLE'
op = pie.operator("sculpt.face_set_change_visibility", text='Invert Visible')
op = pie.operator("sculpt.face_set_change_visibility", text="Invert Visible")
op.mode = 'INVERT'
op = pie.operator("sculpt.reveal_all", text='Show All')
op = pie.operator("sculpt.reveal_all", text="Show All")
class VIEW3D_MT_wpaint_vgroup_lock_pie(Menu):
@ -6216,8 +6212,7 @@ class VIEW3D_PT_shading_compositor(Panel):
@classmethod
def poll(cls, context):
return (context.space_data.shading.type in {'MATERIAL', 'RENDERED'} and
context.preferences.experimental.use_realtime_compositor)
return context.space_data.shading.type in {'MATERIAL', 'RENDERED'}
def draw(self, context):
shading = context.space_data.shading
@ -6229,7 +6224,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):
@ -6974,9 +6969,9 @@ class VIEW3D_PT_snapping(Panel):
col.prop(tool_settings, "use_snap_project")
if 'FACE_NEAREST' in snap_elements:
col.prop(tool_settings, 'use_snap_to_same_target')
col.prop(tool_settings, "use_snap_to_same_target")
if object_mode == 'EDIT':
col.prop(tool_settings, 'snap_face_nearest_steps')
col.prop(tool_settings, "snap_face_nearest_steps")
if 'VOLUME' in snap_elements:
col.prop(tool_settings, "use_snap_peel_object")

View File

@ -1084,7 +1084,7 @@ class VIEW3D_PT_tools_weightpaint_symmetry(Panel, View3DPaintPanel):
wpaint = tool_settings.weight_paint
mesh = context.object.data
layout.prop(mesh, 'use_mirror_vertex_groups')
layout.prop(mesh, "use_mirror_vertex_groups")
draw_vpaint_symmetry(layout, wpaint, context.object)

View File

@ -597,7 +597,7 @@ class BUILTIN_KSI_DeltaRotation(KeyingSetInfo):
path = keyingsets_utils.path_add_property(base_path, "delta_rotation_quaternion")
elif data.rotation_mode == 'AXIS_ANGLE':
# XXX: for now, this is not available yet
#path = path_add_property(base_path, "delta_rotation_axis_angle")
# path = path_add_property(base_path, "delta_rotation_axis_angle")
return
else:
path = keyingsets_utils.path_add_property(base_path, "delta_rotation_euler")
@ -637,7 +637,7 @@ class BUILTIN_KSI_DeltaScale(KeyingSetInfo):
###############################
# Note that this controls order of options in 'insert keyframe' menu.
# Note that this controls order of options in `insert keyframe` menu.
# Better try to keep some logical order here beyond mere alphabetical one, also because of menu entries shortcut.
# See also T51867.
classes = (

View File

@ -27,7 +27,7 @@ namespace blender::bke {
* additional information for anonymous attributes on disk (like which node created it). This
* information can then be used to map stored attributes to their run-time counterpart.
*
* Once created, #AnonymousAttributeID is immutable. Also it is intrinsicly reference counted so
* Once created, #AnonymousAttributeID is immutable. Also it is intrinsically reference counted so
* that it can have shared ownership. `std::shared_ptr` can't be used for that purpose here,
* because that is not available in C code. If possible, the #AutoAnonymousAttributeID wrapper
* should be used to avoid manual reference counting in C++ code.
@ -47,6 +47,8 @@ class AnonymousAttributeID {
return name_;
}
virtual std::string user_name() const;
void user_add() const
{
users_.fetch_add(1);

View File

@ -8,7 +8,7 @@
#include "BLI_function_ref.hh"
#include "BLI_generic_span.hh"
#include "BLI_generic_virtual_array.hh"
#include "BLI_math_vec_types.hh"
#include "BLI_math_vector_types.hh"
#include "BLI_set.hh"
#include "BKE_anonymous_attribute_id.hh"
@ -17,7 +17,9 @@
struct Mesh;
struct PointCloud;
namespace blender::fn {
namespace multi_function {
class MultiFunction;
}
class GField;
} // namespace blender::fn
@ -174,7 +176,7 @@ struct AttributeValidator {
/**
* Single input, single output function that corrects attribute values if necessary.
*/
const fn::MultiFunction *function;
const fn::multi_function::MultiFunction *function;
operator bool() const
{

View File

@ -72,7 +72,7 @@ typedef struct Cloth {
unsigned char pad2;
short pad3;
struct BVHTree *bvhtree; /* collision tree for this cloth object */
struct BVHTree *bvhselftree; /* collision tree for this cloth object */
struct BVHTree *bvhselftree; /* collision tree for this cloth object (may be same as bvhtree) */
struct MVertTri *tri;
struct Implicit_Data *implicit; /* our implicit solver connects to this pointer */
struct EdgeSet *edgeset; /* used for selfcollisions */

View File

@ -55,6 +55,8 @@ typedef struct CollPair {
#else
int ap1, ap2, ap3, bp1, bp2, bp3;
#endif
/* Barycentric weights of the collision point. */
float aw1, aw2, aw3, bw1, bw2, bw3;
int pointsb[4];
} CollPair;

View File

@ -7,7 +7,7 @@
#pragma once
#include "BLI_float3x3.hh"
#include "BLI_math_vec_types.hh"
#include "BLI_math_vector_types.hh"
#include "BLI_span.hh"
struct Depsgraph;

View File

@ -2,7 +2,6 @@
#pragma once
struct CurvesGeometry;
struct Mesh;
/** \file
@ -11,6 +10,7 @@ struct Mesh;
namespace blender::bke {
class CurvesGeometry;
class AnonymousAttributePropagationInfo;
/**

View File

@ -17,7 +17,7 @@
#include "BLI_float4x4.hh"
#include "BLI_generic_virtual_array.hh"
#include "BLI_index_mask.hh"
#include "BLI_math_vec_types.hh"
#include "BLI_math_vector_types.hh"
#include "BLI_shared_cache.hh"
#include "BLI_span.hh"
#include "BLI_task.hh"

View File

@ -268,7 +268,7 @@ class AnonymousAttributeFieldInput : public GeometryFieldInput {
AnonymousAttributeFieldInput(AutoAnonymousAttributeID anonymous_id,
const CPPType &type,
std::string producer_name)
: GeometryFieldInput(type, anonymous_id->name()),
: GeometryFieldInput(type, anonymous_id->user_name()),
anonymous_id_(std::move(anonymous_id)),
producer_name_(producer_name)
{

View File

@ -14,7 +14,7 @@
#include "BLI_function_ref.hh"
#include "BLI_hash.hh"
#include "BLI_map.hh"
#include "BLI_math_vec_types.hh"
#include "BLI_math_vector_types.hh"
#include "BLI_set.hh"
#include "BLI_user_counter.hh"
#include "BLI_vector_set.hh"

View File

@ -9,7 +9,7 @@
#include "DNA_image_types.h"
#include "BLI_math_vec_types.hh"
#include "BLI_math_vector_types.hh"
namespace blender::bke::image {

View File

@ -401,7 +401,7 @@ bool BKE_lib_override_library_status_check_reference(struct Main *bmain, struct
* Compare local and reference data-blocks and create new override operations as needed,
* or reset to reference values if overriding is not allowed.
*
* \param r_report_flags #eRNAOverrideMatchResult flags giving info about the result of this call.
* \param r_report_flags: #eRNAOverrideMatchResult flags giving info about the result of this call.
*
* \note Defining override operations is only mandatory before saving a `.blend` file on disk
* (not for undo!).
@ -410,8 +410,6 @@ bool BKE_lib_override_library_status_check_reference(struct Main *bmain, struct
* \note This is by far the biggest operation (the more time-consuming) of the three so far,
* since it has to go over all properties in depth (all overridable ones at least).
* Generating differential values and applying overrides are much cheaper.
*
* \return true if any library operation was created.
*/
void BKE_lib_override_library_operations_create(struct Main *bmain,
struct ID *local,
@ -419,12 +417,35 @@ void BKE_lib_override_library_operations_create(struct Main *bmain,
/**
* Check all overrides from given \a bmain and create/update overriding operations as needed.
*
* \param r_report_flags #eRNAOverrideMatchResult flags giving info about the result of this call.
* \param r_report_flags: #eRNAOverrideMatchResult flags giving info about the result of this call.
*/
void BKE_lib_override_library_main_operations_create(struct Main *bmain,
bool force_auto,
int *r_report_flags);
/**
* Restore forbidden modified override properties to the values of their matching properties in the
* linked reference ID.
*
* \param r_report_flags: #eRNAOverrideMatchResult flags giving info about the result of this call.
*
* \note Typically used as part of BKE_lib_override_library_main_operations_create process, since
* modifying RNA properties from non-main threads is not safe.
*/
void BKE_lib_override_library_operations_restore(struct Main *bmain,
struct ID *local,
int *r_report_flags);
/**
* Restore forbidden modified override properties to the values of their matching properties in the
* linked reference ID, for all liboverride IDs tagged as needing such process in given `bmain`.
*
* \param r_report_flags: #eRNAOverrideMatchResult flags giving info about the result of this call.
*
* \note Typically used as part of BKE_lib_override_library_main_operations_create process, since
* modifying RNA properties from non-main threads is not safe.
*/
void BKE_lib_override_library_main_operations_restore(struct Main *bmain, int *r_report_flags);
/**
* Reset all overrides in given \a id_root, while preserving ID relations.
*

View File

@ -8,7 +8,7 @@
#include "BLI_function_ref.hh"
#include "BLI_generic_virtual_array.hh"
#include "BLI_math_vec_types.hh"
#include "BLI_math_vector_types.hh"
#include "DNA_meshdata_types.h"

View File

@ -16,7 +16,7 @@
# include "BLI_array.hh"
# include "BLI_bit_vector.hh"
# include "BLI_bounds_types.hh"
# include "BLI_math_vec_types.hh"
# include "BLI_math_vector_types.hh"
# include "BLI_shared_cache.hh"
# include "BLI_span.hh"

View File

@ -107,9 +107,6 @@ class GeoNodeExecParams;
class NodeDeclarationBuilder;
class GatherLinkSearchOpParams;
} // namespace nodes
namespace fn {
class MFDataType;
} // namespace fn
namespace realtime_compositor {
class Context;
class NodeOperation;

View File

@ -169,13 +169,6 @@ class bNodeSocketRuntime : NonCopyable, NonMovable {
/** #eNodeTreeChangedFlag. */
uint32_t changed_flag = 0;
/**
* The location of the sockets, in the view-space of the node editor.
* \note Only calculated when drawing.
*/
float locx = 0;
float locy = 0;
/**
* Runtime-only cache of the number of input links, for multi-input sockets,
* including dragged node links that aren't actually in the tree.

View File

@ -267,7 +267,7 @@ BLI_INLINE void psys_frand_vec(ParticleSystem *psys, unsigned int seed, float ve
}
/* ----------- functions needed outside particlesystem ---------------- */
/* particle.c */
/* particle.cc */
/* Few helpers for count-all etc. */
@ -540,7 +540,7 @@ void BKE_particlesystem_reset_all(struct Object *object);
/* ----------- functions needed only inside particlesystem ------------ */
/* particle.c */
/* particle.cc */
void psys_disable_all(struct Object *ob);
void psys_enable_all(struct Object *ob);

View File

@ -4,7 +4,7 @@
#pragma once
#include "BLI_math.h"
#include "BLI_math_vec_types.hh"
#include "BLI_math_vector_types.hh"
#include "BLI_rect.h"
#include "BLI_vector.hh"

View File

@ -11,7 +11,7 @@
# include <mutex>
# include "BLI_bounds_types.hh"
# include "BLI_math_vec_types.hh"
# include "BLI_math_vector_types.hh"
# include "BLI_shared_cache.hh"
#endif

View File

@ -8,19 +8,19 @@
namespace blender::bke {
struct ConversionFunctions {
const fn::MultiFunction *multi_function;
const mf::MultiFunction *multi_function;
void (*convert_single_to_initialized)(const void *src, void *dst);
void (*convert_single_to_uninitialized)(const void *src, void *dst);
};
class DataTypeConversions {
private:
Map<std::pair<fn::MFDataType, fn::MFDataType>, ConversionFunctions> conversions_;
Map<std::pair<mf::DataType, mf::DataType>, ConversionFunctions> conversions_;
public:
void add(fn::MFDataType from_type,
fn::MFDataType to_type,
const fn::MultiFunction &fn,
void add(mf::DataType from_type,
mf::DataType to_type,
const mf::MultiFunction &fn,
void (*convert_single_to_initialized)(const void *src, void *dst),
void (*convert_single_to_uninitialized)(const void *src, void *dst))
{
@ -28,19 +28,18 @@ class DataTypeConversions {
{&fn, convert_single_to_initialized, convert_single_to_uninitialized});
}
const ConversionFunctions *get_conversion_functions(fn::MFDataType from, fn::MFDataType to) const
const ConversionFunctions *get_conversion_functions(mf::DataType from, mf::DataType to) const
{
return conversions_.lookup_ptr({from, to});
}
const ConversionFunctions *get_conversion_functions(const CPPType &from, const CPPType &to) const
{
return this->get_conversion_functions(fn::MFDataType::ForSingle(from),
fn::MFDataType::ForSingle(to));
return this->get_conversion_functions(mf::DataType::ForSingle(from),
mf::DataType::ForSingle(to));
}
const fn::MultiFunction *get_conversion_multi_function(fn::MFDataType from,
fn::MFDataType to) const
const mf::MultiFunction *get_conversion_multi_function(mf::DataType from, mf::DataType to) const
{
const ConversionFunctions *functions = this->get_conversion_functions(from, to);
return functions ? functions->multi_function : nullptr;
@ -49,7 +48,7 @@ class DataTypeConversions {
bool is_convertible(const CPPType &from_type, const CPPType &to_type) const
{
return conversions_.contains(
{fn::MFDataType::ForSingle(from_type), fn::MFDataType::ForSingle(to_type)});
{mf::DataType::ForSingle(from_type), mf::DataType::ForSingle(to_type)});
}
void convert_to_uninitialized(const CPPType &from_type,

View File

@ -160,7 +160,7 @@ bool BKE_volume_save(const struct Volume *volume,
#ifdef __cplusplus
# include "BLI_float4x4.hh"
# include "BLI_math_vec_types.hh"
# include "BLI_math_vector_types.hh"
# include "BLI_string_ref.hh"
bool BKE_volume_min_max(const Volume *volume, blender::float3 &r_min, blender::float3 &r_max);

View File

@ -244,7 +244,7 @@ set(SRC
intern/paint.cc
intern/paint_canvas.cc
intern/paint_toolslots.c
intern/particle.c
intern/particle.cc
intern/particle_child.c
intern/particle_distribute.c
intern/particle_system.c

View File

@ -24,7 +24,7 @@
#include "BLI_blenlib.h"
#include "BLI_linklist.h"
#include "BLI_math.h"
#include "BLI_math_vec_types.hh"
#include "BLI_math_vector_types.hh"
#include "BLI_task.h"
#include "BLI_task.hh"
#include "BLI_utildefines.h"
@ -286,7 +286,7 @@ void DM_ensure_looptri_data(DerivedMesh *dm)
BLI_assert(dm->looptris.array_wip == nullptr);
SWAP(MLoopTri *, dm->looptris.array, dm->looptris.array_wip);
std::swap(dm->looptris.array, dm->looptris.array_wip);
if ((looptris_num > dm->looptris.num_alloc) || (looptris_num < dm->looptris.num_alloc * 2) ||
(totpoly == 0)) {

View File

@ -4,6 +4,11 @@
namespace blender::bke {
std::string AnonymousAttributeID::user_name() const
{
return this->name();
}
bool AnonymousAttributePropagationInfo::propagate(const AnonymousAttributeID &anonymous_id) const
{
if (this->propagate_all) {

View File

@ -612,7 +612,7 @@ static void get_domains_types(eAttrDomain domains[ATTR_DOMAIN_NUM])
}
/* Swap corner and face. */
SWAP(eAttrDomain, domains[ATTR_DOMAIN_FACE], domains[ATTR_DOMAIN_CORNER]);
std::swap(domains[ATTR_DOMAIN_FACE], domains[ATTR_DOMAIN_CORNER]);
}
int BKE_id_attribute_to_index(const ID *id,

View File

@ -16,7 +16,7 @@
#include "BLI_array_utils.hh"
#include "BLI_color.hh"
#include "BLI_math_vec_types.hh"
#include "BLI_math_vector_types.hh"
#include "BLI_span.hh"
#include "FN_field.hh"

View File

@ -407,7 +407,7 @@ static void brush_undo_preserve(BlendLibReader *reader, ID *id_new, ID *id_old)
/* NOTE: We do not swap IDProperties, as dealing with potential ID pointers in those would be
* fairly delicate. */
SWAP(IDProperty *, id_new->properties, id_old->properties);
std::swap(id_new->properties, id_old->properties);
}
IDTypeInfo IDType_ID_BR = {

View File

@ -1119,6 +1119,9 @@ float BKE_camera_multiview_shift_x(const RenderData *rd,
if (rd->views_format == SCE_VIEWS_FORMAT_MULTIVIEW) {
return data->shiftx;
}
if (data->type == CAM_PANO) {
return data->shiftx;
}
/* SCE_VIEWS_SETUP_BASIC */
return camera_stereo3d_shift_x(camera, viewname);
}

View File

@ -461,7 +461,7 @@ void cloth_free_modifier(ClothModifierData *clmd)
BLI_bvhtree_free(cloth->bvhtree);
}
if (cloth->bvhselftree) {
if (cloth->bvhselftree && cloth->bvhselftree != cloth->bvhtree) {
BLI_bvhtree_free(cloth->bvhselftree);
}
@ -538,7 +538,7 @@ void cloth_free_modifier_extern(ClothModifierData *clmd)
BLI_bvhtree_free(cloth->bvhtree);
}
if (cloth->bvhselftree) {
if (cloth->bvhselftree && cloth->bvhselftree != cloth->bvhtree) {
BLI_bvhtree_free(cloth->bvhselftree);
}
@ -820,7 +820,14 @@ static bool cloth_from_object(
}
clmd->clothObject->bvhtree = bvhtree_build_from_cloth(clmd, clmd->coll_parms->epsilon);
clmd->clothObject->bvhselftree = bvhtree_build_from_cloth(clmd, clmd->coll_parms->selfepsilon);
if (compare_ff(clmd->coll_parms->selfepsilon, clmd->coll_parms->epsilon, 1e-6f)) {
/* Share the BVH tree if the epsilon is the same. */
clmd->clothObject->bvhselftree = clmd->clothObject->bvhtree;
}
else {
clmd->clothObject->bvhselftree = bvhtree_build_from_cloth(clmd, clmd->coll_parms->selfepsilon);
}
return true;
}

View File

@ -670,7 +670,6 @@ static int cloth_collision_response_static(ClothModifierData *clmd,
const bool is_hair = (clmd->hairdata != NULL);
for (int i = 0; i < collision_count; i++, collpair++) {
float i1[3], i2[3], i3[3];
float w1, w2, w3, u1, u2, u3;
float v1[3], v2[3], relativeVelocity[3];
zero_v3(i1);
zero_v3(i2);
@ -682,23 +681,13 @@ static int cloth_collision_response_static(ClothModifierData *clmd,
}
/* Compute barycentric coordinates and relative "velocity" for both collision points. */
float w1 = collpair->aw1, w2 = collpair->aw2, w3 = collpair->aw3;
float u1 = collpair->bw1, u2 = collpair->bw2, u3 = collpair->bw3;
if (is_hair) {
w2 = line_point_factor_v3(
collpair->pa, cloth->verts[collpair->ap1].tx, cloth->verts[collpair->ap2].tx);
w1 = 1.0f - w2;
interp_v3_v3v3(v1, cloth->verts[collpair->ap1].tv, cloth->verts[collpair->ap2].tv, w2);
}
else {
collision_compute_barycentric(collpair->pa,
cloth->verts[collpair->ap1].tx,
cloth->verts[collpair->ap2].tx,
cloth->verts[collpair->ap3].tx,
&w1,
&w2,
&w3);
collision_interpolateOnTriangle(v1,
cloth->verts[collpair->ap1].tv,
cloth->verts[collpair->ap2].tv,
@ -708,14 +697,6 @@ static int cloth_collision_response_static(ClothModifierData *clmd,
w3);
}
collision_compute_barycentric(collpair->pb,
collmd->current_xnew[collpair->bp1].co,
collmd->current_xnew[collpair->bp2].co,
collmd->current_xnew[collpair->bp3].co,
&u1,
&u2,
&u3);
collision_interpolateOnTriangle(v2,
collmd->current_v[collpair->bp1].co,
collmd->current_v[collpair->bp2].co,
@ -834,7 +815,6 @@ static int cloth_selfcollision_response_static(ClothModifierData *clmd,
for (int i = 0; i < collision_count; i++, collpair++) {
float ia[3][3] = {{0.0f}};
float ib[3][3] = {{0.0f}};
float w1, w2, w3, u1, u2, u3;
float v1[3], v2[3], relativeVelocity[3];
/* Only handle static collisions here. */
@ -842,22 +822,9 @@ static int cloth_selfcollision_response_static(ClothModifierData *clmd,
continue;
}
/* Compute barycentric coordinates for both collision points. */
collision_compute_barycentric(collpair->pa,
cloth->verts[collpair->ap1].tx,
cloth->verts[collpair->ap2].tx,
cloth->verts[collpair->ap3].tx,
&w1,
&w2,
&w3);
collision_compute_barycentric(collpair->pb,
cloth->verts[collpair->bp1].tx,
cloth->verts[collpair->bp2].tx,
cloth->verts[collpair->bp3].tx,
&u1,
&u2,
&u3);
/* Retrieve barycentric coordinates for both collision points. */
float w1 = collpair->aw1, w2 = collpair->aw2, w3 = collpair->aw3;
float u1 = collpair->bw1, u2 = collpair->bw2, u3 = collpair->bw3;
/* Calculate relative "velocity". */
collision_interpolateOnTriangle(v1,
@ -1053,6 +1020,23 @@ static void cloth_collision(void *__restrict userdata,
collpair[index].flag = 0;
data->collided = true;
/* Compute barycentric coordinates for both collision points. */
collision_compute_barycentric(pa,
verts1[tri_a->tri[0]].tx,
verts1[tri_a->tri[1]].tx,
verts1[tri_a->tri[2]].tx,
&collpair[index].aw1,
&collpair[index].aw2,
&collpair[index].aw3);
collision_compute_barycentric(pb,
collmd->current_xnew[tri_b->tri[0]].co,
collmd->current_xnew[tri_b->tri[1]].co,
collmd->current_xnew[tri_b->tri[2]].co,
&collpair[index].bw1,
&collpair[index].bw2,
&collpair[index].bw3);
}
else {
collpair[index].flag = COLLISION_INACTIVE;
@ -1115,8 +1099,15 @@ static void cloth_selfcollision(void *__restrict userdata,
float epsilon = clmd->coll_parms->selfepsilon;
float pa[3], pb[3], vect[3];
tri_a = &clmd->clothObject->tri[data->overlap[index].indexA];
tri_b = &clmd->clothObject->tri[data->overlap[index].indexB];
/* Collision math is currently not symmetric, so ensure a stable order for each pair. */
int indexA = data->overlap[index].indexA, indexB = data->overlap[index].indexB;
if (indexA > indexB) {
SWAP(int, indexA, indexB);
}
tri_a = &clmd->clothObject->tri[indexA];
tri_b = &clmd->clothObject->tri[indexB];
BLI_assert(cloth_bvh_selfcollision_is_active(clmd, clmd->clothObject, tri_a, tri_b));
@ -1152,6 +1143,23 @@ static void cloth_selfcollision(void *__restrict userdata,
collpair[index].flag = 0;
data->collided = true;
/* Compute barycentric coordinates for both collision points. */
collision_compute_barycentric(pa,
verts1[tri_a->tri[0]].tx,
verts1[tri_a->tri[1]].tx,
verts1[tri_a->tri[2]].tx,
&collpair[index].aw1,
&collpair[index].aw2,
&collpair[index].aw3);
collision_compute_barycentric(pb,
verts1[tri_b->tri[0]].tx,
verts1[tri_b->tri[1]].tx,
verts1[tri_b->tri[2]].tx,
&collpair[index].bw1,
&collpair[index].bw2,
&collpair[index].bw3);
}
else {
collpair[index].flag = COLLISION_INACTIVE;
@ -1210,6 +1218,20 @@ static void hair_collision(void *__restrict userdata,
collpair[index].flag = 0;
data->collided = true;
/* Compute barycentric coordinates for the collision points. */
collpair[index].aw2 = line_point_factor_v3(
pa, verts1[edge_coll->v1].tx, verts1[edge_coll->v2].tx);
collpair[index].aw1 = 1.0f - collpair[index].aw2;
collision_compute_barycentric(pb,
collmd->current_xnew[tri_coll->tri[0]].co,
collmd->current_xnew[tri_coll->tri[1]].co,
collmd->current_xnew[tri_coll->tri[2]].co,
&collpair[index].bw1,
&collpair[index].bw2,
&collpair[index].bw3);
}
else {
collpair[index].flag = COLLISION_INACTIVE;
@ -1521,8 +1543,9 @@ static bool cloth_bvh_obj_overlap_cb(void *userdata,
static bool cloth_bvh_self_overlap_cb(void *userdata, int index_a, int index_b, int UNUSED(thread))
{
/* No need for equal combinations (eg. (0,1) & (1,0)). */
if (index_a < index_b) {
/* This shouldn't happen, but just in case. Note that equal combinations
* (eg. (0,1) & (1,0)) would be filtered out by BLI_bvhtree_overlap_self. */
if (index_a != index_b) {
ClothModifierData *clmd = (ClothModifierData *)userdata;
struct Cloth *clothObject = clmd->clothObject;
const MVertTri *tri_a, *tri_b;
@ -1551,6 +1574,7 @@ int cloth_bvh_collision(
BVHTreeOverlap **overlap_obj = NULL;
uint coll_count_self = 0;
BVHTreeOverlap *overlap_self = NULL;
bool bvh_updated = false;
if ((clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_COLLOBJ) || cloth_bvh == NULL) {
return 0;
@ -1561,6 +1585,7 @@ int cloth_bvh_collision(
if (clmd->coll_parms->flags & CLOTH_COLLSETTINGS_FLAG_ENABLED) {
bvhtree_update_from_cloth(clmd, false, false);
bvh_updated = true;
/* Enable self collision if this is a hair sim */
const bool is_hair = (clmd->hairdata != NULL);
@ -1597,10 +1622,12 @@ int cloth_bvh_collision(
}
if (clmd->coll_parms->flags & CLOTH_COLLSETTINGS_FLAG_SELF) {
bvhtree_update_from_cloth(clmd, false, true);
if (cloth->bvhselftree != cloth->bvhtree || !bvh_updated) {
bvhtree_update_from_cloth(clmd, false, true);
}
overlap_self = BLI_bvhtree_overlap(
cloth->bvhselftree, cloth->bvhselftree, &coll_count_self, cloth_bvh_self_overlap_cb, clmd);
overlap_self = BLI_bvhtree_overlap_self(
cloth->bvhselftree, &coll_count_self, cloth_bvh_self_overlap_cb, clmd);
}
do {

View File

@ -16,7 +16,7 @@
#include "BLI_ghash.h"
#include "BLI_index_range.hh"
#include "BLI_math.h"
#include "BLI_math_vec_types.hh"
#include "BLI_math_vector_types.hh"
#include "BLI_string.h"
#include "BLI_utildefines.h"
#include "BLT_translation.h"
@ -704,7 +704,7 @@ Nurb *BKE_nurb_copy(Nurb *src, int pntsu, int pntsv)
*newnu = blender::dna::shallow_copy(*src);
if (pntsu == 1) {
SWAP(int, pntsu, pntsv);
std::swap(pntsu, pntsv);
}
newnu->pntsu = pntsu;
newnu->pntsv = pntsv;
@ -3048,7 +3048,7 @@ void BKE_curve_bevelList_make(Object *ob, const ListBase *nurbs, const bool for_
bevp2 = bevp1 + (bl->nr - 1);
nr = bl->nr / 2;
while (nr--) {
SWAP(BevPoint, *bevp1, *bevp2);
std::swap( *bevp1, *bevp2);
bevp1++;
bevp2--;
}
@ -4437,7 +4437,7 @@ void BKE_nurb_direction_switch(Nurb *nu)
a /= 2;
while (a > 0) {
if (bezt1 != bezt2) {
SWAP(BezTriple, *bezt1, *bezt2);
std::swap(*bezt1, *bezt2);
}
swap_v3_v3(bezt1->vec[0], bezt1->vec[2]);
@ -4446,12 +4446,12 @@ void BKE_nurb_direction_switch(Nurb *nu)
swap_v3_v3(bezt2->vec[0], bezt2->vec[2]);
}
SWAP(uint8_t, bezt1->h1, bezt1->h2);
SWAP(uint8_t, bezt1->f1, bezt1->f3);
std::swap( bezt1->h1, bezt1->h2);
std::swap( bezt1->f1, bezt1->f3);
if (bezt1 != bezt2) {
SWAP(uint8_t, bezt2->h1, bezt2->h2);
SWAP(uint8_t, bezt2->f1, bezt2->f3);
std::swap( bezt2->h1, bezt2->h2);
std::swap( bezt2->f1, bezt2->f3);
bezt1->tilt = -bezt1->tilt;
bezt2->tilt = -bezt2->tilt;
}
@ -4469,7 +4469,7 @@ void BKE_nurb_direction_switch(Nurb *nu)
bp2 = bp1 + (a - 1);
a /= 2;
while (bp1 != bp2 && a > 0) {
SWAP(BPoint, *bp1, *bp2);
std::swap( *bp1, *bp2);
a--;
bp1->tilt = -bp1->tilt;
bp2->tilt = -bp2->tilt;
@ -4491,7 +4491,7 @@ void BKE_nurb_direction_switch(Nurb *nu)
fp2 = fp1 + (a - 1);
a /= 2;
while (fp1 != fp2 && a > 0) {
SWAP(float, *fp1, *fp2);
std::swap( *fp1, *fp2);
a--;
fp1++;
fp2--;
@ -4530,7 +4530,7 @@ void BKE_nurb_direction_switch(Nurb *nu)
a /= 2;
while (bp1 != bp2 && a > 0) {
SWAP(BPoint, *bp1, *bp2);
std::swap( *bp1, *bp2);
a--;
bp1++;
bp2--;

View File

@ -1,7 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#include "BLI_array.hh"
#include "BLI_devirtualize_parameters.hh"
#include "BLI_set.hh"
#include "BLI_task.hh"

View File

@ -1090,7 +1090,7 @@ static void calc_bevfac_mapping(const Curve *cu,
}
if (end < *r_start || (end == *r_start && *r_lastblend < 1.0f - *r_firstblend)) {
SWAP(int, *r_start, end);
std::swap(*r_start, end);
tmpf = *r_lastblend;
*r_lastblend = 1.0f - *r_firstblend;
*r_firstblend = 1.0f - tmpf;

View File

@ -440,12 +440,12 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
make_array_write_attribute<float3>,
tag_component_positions_changed);
static const fn::CustomMF_SI_SO<int8_t, int8_t> handle_type_clamp{
static auto handle_type_clamp = mf::build::SI1_SO<int8_t, int8_t>(
"Handle Type Validate",
[](int8_t value) {
return std::clamp<int8_t>(value, BEZIER_HANDLE_FREE, BEZIER_HANDLE_ALIGN);
},
fn::CustomMF_presets::AllSpanOrSingle()};
mf::build::exec_presets::AllSpanOrSingle());
static BuiltinCustomDataLayerProvider handle_type_right("handle_type_right",
ATTR_DOMAIN_POINT,
CD_PROP_INT8,
@ -484,10 +484,10 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
make_array_write_attribute<float>,
tag_component_positions_changed);
static const fn::CustomMF_SI_SO<int8_t, int8_t> nurbs_order_clamp{
static const auto nurbs_order_clamp = mf::build::SI1_SO<int8_t, int8_t>(
"NURBS Order Validate",
[](int8_t value) { return std::max<int8_t>(value, 0); },
fn::CustomMF_presets::AllSpanOrSingle()};
mf::build::exec_presets::AllSpanOrSingle());
static BuiltinCustomDataLayerProvider nurbs_order("nurbs_order",
ATTR_DOMAIN_CURVE,
CD_PROP_INT8,
@ -501,12 +501,12 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
tag_component_topology_changed,
AttributeValidator{&nurbs_order_clamp});
static const fn::CustomMF_SI_SO<int8_t, int8_t> normal_mode_clamp{
static const auto normal_mode_clamp = mf::build::SI1_SO<int8_t, int8_t>(
"Normal Mode Validate",
[](int8_t value) {
return std::clamp<int8_t>(value, NORMAL_MODE_MINIMUM_TWIST, NORMAL_MODE_Z_UP);
},
fn::CustomMF_presets::AllSpanOrSingle()};
mf::build::exec_presets::AllSpanOrSingle());
static BuiltinCustomDataLayerProvider normal_mode("normal_mode",
ATTR_DOMAIN_CURVE,
CD_PROP_INT8,
@ -520,12 +520,12 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
tag_component_normals_changed,
AttributeValidator{&normal_mode_clamp});
static const fn::CustomMF_SI_SO<int8_t, int8_t> knots_mode_clamp{
static const auto knots_mode_clamp = mf::build::SI1_SO<int8_t, int8_t>(
"Knots Mode Validate",
[](int8_t value) {
return std::clamp<int8_t>(value, NURBS_KNOT_MODE_NORMAL, NURBS_KNOT_MODE_ENDPOINT_BEZIER);
},
fn::CustomMF_presets::AllSpanOrSingle()};
mf::build::exec_presets::AllSpanOrSingle());
static BuiltinCustomDataLayerProvider nurbs_knots_mode("knots_mode",
ATTR_DOMAIN_CURVE,
CD_PROP_INT8,
@ -539,12 +539,12 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
tag_component_topology_changed,
AttributeValidator{&knots_mode_clamp});
static const fn::CustomMF_SI_SO<int8_t, int8_t> curve_type_clamp{
static const auto curve_type_clamp = mf::build::SI1_SO<int8_t, int8_t>(
"Curve Type Validate",
[](int8_t value) {
return std::clamp<int8_t>(value, CURVE_TYPE_CATMULL_ROM, CURVE_TYPES_NUM);
},
fn::CustomMF_presets::AllSpanOrSingle()};
mf::build::exec_presets::AllSpanOrSingle());
static BuiltinCustomDataLayerProvider curve_type("curve_type",
ATTR_DOMAIN_CURVE,
CD_PROP_INT8,
@ -558,10 +558,10 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
tag_component_curve_types_changed,
AttributeValidator{&curve_type_clamp});
static const fn::CustomMF_SI_SO<int, int> resolution_clamp{
static const auto resolution_clamp = mf::build::SI1_SO<int, int>(
"Resolution Validate",
[](int value) { return std::max<int>(value, 1); },
fn::CustomMF_presets::AllSpanOrSingle()};
mf::build::exec_presets::AllSpanOrSingle());
static BuiltinCustomDataLayerProvider resolution("resolution",
ATTR_DOMAIN_CURVE,
CD_PROP_INT32,

View File

@ -1254,13 +1254,13 @@ static ComponentAttributeProviders create_attribute_providers_for_mesh()
make_array_write_attribute<int>,
nullptr);
static const fn::CustomMF_SI_SO<int, int> material_index_clamp{
static const auto material_index_clamp = mf::build::SI1_SO<int, int>(
"Material Index Validate",
[](int value) {
/* Use #short for the maximum since many areas still use that type for indices. */
return std::clamp<int>(value, 0, std::numeric_limits<short>::max());
},
fn::CustomMF_presets::AllSpanOrSingle()};
mf::build::exec_presets::AllSpanOrSingle());
static BuiltinCustomDataLayerProvider material_index("material_index",
ATTR_DOMAIN_FACE,
CD_PROP_INT32,

View File

@ -433,8 +433,10 @@ bool try_capture_field_on_geometry(GeometryComponent &component,
GMutableSpan{type, buffer, domain_size});
evaluator.evaluate();
if (GAttributeWriter attribute = attributes.lookup_for_write(attribute_id)) {
if (attribute.domain == domain && attribute.varray.type() == type) {
const std::optional<AttributeMetaData> meta_data = attributes.lookup_meta_data(attribute_id);
if (meta_data && meta_data->domain == domain && meta_data->data_type == data_type) {
if (GAttributeWriter attribute = attributes.lookup_for_write(attribute_id)) {
attribute.varray.set_all(buffer);
attribute.finish();
type.destruct_n(buffer, domain_size);
@ -442,6 +444,7 @@ bool try_capture_field_on_geometry(GeometryComponent &component,
return true;
}
}
attributes.remove(attribute_id);
if (attributes.add(attribute_id, domain, data_type, bke::AttributeInitMoveArray{buffer})) {
return true;

View File

@ -20,8 +20,8 @@
#include "BLI_ghash.h"
#include "BLI_hash.h"
#include "BLI_heap.h"
#include "BLI_math_vec_types.hh"
#include "BLI_math_vector.h"
#include "BLI_math_vector_types.hh"
#include "BLI_polyfill_2d.h"
#include "BLI_span.hh"

View File

@ -2549,7 +2549,7 @@ bool BKE_keyblock_move(Object *ob, int org_index, int new_index)
BLI_listbase_swaplinks(&key->block, kb, other_kb);
/* Swap absolute positions. */
SWAP(float, kb->pos, other_kb->pos);
std::swap(kb->pos, other_kb->pos);
kb = other_kb;
}

View File

@ -3297,7 +3297,10 @@ bool BKE_lib_override_library_status_check_reference(Main *bmain, ID *local)
return true;
}
void BKE_lib_override_library_operations_create(Main *bmain, ID *local, int *r_report_flags)
static void lib_override_library_operations_create(Main *bmain,
ID *local,
const eRNAOverrideMatch override_match_flags,
eRNAOverrideMatchResult *r_report_flags)
{
BLI_assert(!ID_IS_LINKED(local));
BLI_assert(local->override_library != nullptr);
@ -3330,19 +3333,24 @@ void BKE_lib_override_library_operations_create(Main *bmain, ID *local, int *r_r
RNA_id_pointer_create(local->override_library->reference, &rnaptr_reference);
eRNAOverrideMatchResult local_report_flags = RNA_OVERRIDE_MATCH_RESULT_INIT;
RNA_struct_override_matches(
bmain,
&rnaptr_local,
&rnaptr_reference,
nullptr,
0,
local->override_library,
(eRNAOverrideMatch)(RNA_OVERRIDE_COMPARE_CREATE | RNA_OVERRIDE_COMPARE_RESTORE),
&local_report_flags);
RNA_struct_override_matches(bmain,
&rnaptr_local,
&rnaptr_reference,
nullptr,
0,
local->override_library,
override_match_flags,
&local_report_flags);
if (local_report_flags & RNA_OVERRIDE_MATCH_RESULT_RESTORED) {
CLOG_INFO(&LOG, 2, "We did restore some properties of %s from its reference", local->name);
}
if (local_report_flags & RNA_OVERRIDE_MATCH_RESULT_RESTORE_TAGGED) {
CLOG_INFO(&LOG,
2,
"We did tag some properties of %s for restoration from its reference",
local->name);
}
if (local_report_flags & RNA_OVERRIDE_MATCH_RESULT_CREATED) {
CLOG_INFO(&LOG, 2, "We did generate library override rules for %s", local->name);
}
@ -3351,10 +3359,50 @@ void BKE_lib_override_library_operations_create(Main *bmain, ID *local, int *r_r
}
if (r_report_flags != nullptr) {
*r_report_flags |= local_report_flags;
*r_report_flags = static_cast<eRNAOverrideMatchResult>(*r_report_flags | local_report_flags);
}
}
}
void BKE_lib_override_library_operations_create(Main *bmain, ID *local, int *r_report_flags)
{
lib_override_library_operations_create(
bmain,
local,
static_cast<eRNAOverrideMatch>(RNA_OVERRIDE_COMPARE_CREATE | RNA_OVERRIDE_COMPARE_RESTORE),
reinterpret_cast<eRNAOverrideMatchResult *>(r_report_flags));
}
void BKE_lib_override_library_operations_restore(Main *bmain, ID *local, int *r_report_flags)
{
if (!ID_IS_OVERRIDE_LIBRARY_REAL(local) || (local->override_library->runtime->tag &
IDOVERRIDE_LIBRARY_RUNTIME_TAG_NEEDS_RESTORE) == 0) {
return;
}
PointerRNA rnaptr_src, rnaptr_dst;
RNA_id_pointer_create(local, &rnaptr_dst);
RNA_id_pointer_create(local->override_library->reference, &rnaptr_src);
RNA_struct_override_apply(
bmain,
&rnaptr_dst,
&rnaptr_src,
nullptr,
local->override_library,
static_cast<eRNAOverrideApplyFlag>(RNA_OVERRIDE_APPLY_FLAG_SKIP_RESYNC_CHECK |
RNA_OVERRIDE_APPLY_FLAG_RESTORE_ONLY));
LISTBASE_FOREACH_MUTABLE (
IDOverrideLibraryProperty *, op, &local->override_library->properties) {
if (op->tag & IDOVERRIDE_LIBRARY_PROPERTY_TAG_NEEDS_RETORE) {
BKE_lib_override_library_property_delete(local->override_library, op);
}
}
local->override_library->runtime->tag &= ~IDOVERRIDE_LIBRARY_RUNTIME_TAG_NEEDS_RESTORE;
if (r_report_flags != nullptr) {
*r_report_flags |= RNA_OVERRIDE_MATCH_RESULT_RESTORED;
}
}
struct LibOverrideOpCreateData {
Main *bmain;
@ -3368,8 +3416,12 @@ static void lib_override_library_operations_create_cb(TaskPool *__restrict pool,
ID *id = static_cast<ID *>(taskdata);
eRNAOverrideMatchResult report_flags = RNA_OVERRIDE_MATCH_RESULT_INIT;
BKE_lib_override_library_operations_create(
create_data->bmain, id, reinterpret_cast<int *>(&report_flags));
lib_override_library_operations_create(
create_data->bmain,
id,
static_cast<eRNAOverrideMatch>(RNA_OVERRIDE_COMPARE_CREATE |
RNA_OVERRIDE_COMPARE_TAG_FOR_RESTORE),
&report_flags);
atomic_fetch_and_or_uint32(reinterpret_cast<uint32_t *>(&create_data->report_flags),
report_flags);
}
@ -3443,6 +3495,13 @@ void BKE_lib_override_library_main_operations_create(Main *bmain,
BLI_task_pool_free(task_pool);
if (create_pool_data.report_flags & RNA_OVERRIDE_MATCH_RESULT_RESTORE_TAGGED) {
BKE_lib_override_library_main_operations_restore(
bmain, reinterpret_cast<int *>(&create_pool_data.report_flags));
create_pool_data.report_flags = static_cast<eRNAOverrideMatchResult>(
(create_pool_data.report_flags & ~RNA_OVERRIDE_MATCH_RESULT_RESTORE_TAGGED));
}
if (r_report_flags != nullptr) {
*r_report_flags |= create_pool_data.report_flags;
}
@ -3456,6 +3515,28 @@ void BKE_lib_override_library_main_operations_create(Main *bmain,
#endif
}
void BKE_lib_override_library_main_operations_restore(Main *bmain, int *r_report_flags)
{
ID *id;
FOREACH_MAIN_ID_BEGIN (bmain, id) {
if (!(!ID_IS_LINKED(id) && ID_IS_OVERRIDE_LIBRARY_REAL(id) &&
(id->override_library->runtime->tag & IDOVERRIDE_LIBRARY_RUNTIME_TAG_NEEDS_RESTORE) !=
0)) {
continue;
}
/* Only restore overrides if we do have the real reference data available, and not some empty
* 'placeholder' for missing data (broken links). */
if (id->override_library->reference->tag & LIB_TAG_MISSING) {
continue;
}
BKE_lib_override_library_operations_restore(bmain, id, r_report_flags);
}
FOREACH_MAIN_ID_END;
}
static bool lib_override_library_id_reset_do(Main *bmain,
ID *id_root,
const bool do_reset_system_override)

View File

@ -181,7 +181,7 @@ static uint partition_mainb(MetaElem **mainb, uint start, uint end, uint s, floa
break;
}
SWAP(MetaElem *, mainb[i], mainb[j]);
std::swap(mainb[i], mainb[j]);
i++;
j--;
}

View File

@ -1748,7 +1748,7 @@ void BKE_mesh_mselect_active_set(Mesh *me, int index, int type)
}
else if (msel_index != me->totselect - 1) {
/* move to the end */
SWAP(MSelect, me->mselect[msel_index], me->mselect[me->totselect - 1]);
std::swap(me->mselect[msel_index], me->mselect[me->totselect - 1]);
}
BLI_assert((me->mselect[me->totselect - 1].index == index) &&

View File

@ -19,7 +19,7 @@
#include "BLI_array.hh"
#include "BLI_float4x4.hh"
#include "BLI_math.h"
#include "BLI_math_vec_types.hh"
#include "BLI_math_vector_types.hh"
#include "BLI_mesh_boolean.hh"
#include "BLI_mesh_intersect.hh"
#include "BLI_span.hh"

View File

@ -542,8 +542,8 @@ void BKE_mesh_mdisp_flip(MDisps *md, const bool use_loop_mdisp_flip)
co_b = co[x * sides + y];
swap_v3_v3(co_a, co_b);
SWAP(float, co_a[0], co_a[1]);
SWAP(float, co_b[0], co_b[1]);
std::swap(co_a[0], co_a[1]);
std::swap(co_b[0], co_b[1]);
if (use_loop_mdisp_flip) {
co_a[2] *= -1.0f;
@ -553,7 +553,7 @@ void BKE_mesh_mdisp_flip(MDisps *md, const bool use_loop_mdisp_flip)
co_a = co[x * sides + x];
SWAP(float, co_a[0], co_a[1]);
std::swap(co_a[0], co_a[1]);
if (use_loop_mdisp_flip) {
co_a[2] *= -1.0f;
@ -588,10 +588,10 @@ void BKE_mesh_polygon_flip_ex(const MPoly *mpoly,
for (loopstart++; loopend > loopstart; loopstart++, loopend--) {
mloop[loopend].e = mloop[loopend - 1].e;
SWAP(uint, mloop[loopstart].e, prev_edge_index);
std::swap(mloop[loopstart].e, prev_edge_index);
if (!loops_in_ldata) {
SWAP(MLoop, mloop[loopstart], mloop[loopend]);
std::swap(mloop[loopstart], mloop[loopend]);
}
if (lnors) {
swap_v3_v3(lnors[loopstart], lnors[loopend]);

View File

@ -158,7 +158,7 @@ static void mesh_calc_edges_mdata(const MVert * /*allvert*/,
/* order is swapped so extruding this edge as a surface won't flip face normals
* with cyclic curves */
if (ed->v1 + 1 != ed->v2) {
SWAP(uint, med->v1, med->v2);
std::swap(med->v1, med->v2);
}
med++;
}
@ -918,8 +918,8 @@ int BKE_mesh_mface_index_validate(MFace *mface, CustomData *fdata, int mfindex,
if (mface->v3 == 0) {
static int corner_indices[4] = {1, 2, 0, 3};
SWAP(uint, mface->v1, mface->v2);
SWAP(uint, mface->v2, mface->v3);
std::swap(mface->v1, mface->v2);
std::swap(mface->v2, mface->v3);
if (fdata) {
CustomData_swap_corners(fdata, mfindex, corner_indices);
@ -930,8 +930,8 @@ int BKE_mesh_mface_index_validate(MFace *mface, CustomData *fdata, int mfindex,
if (mface->v3 == 0 || mface->v4 == 0) {
static int corner_indices[4] = {2, 3, 0, 1};
SWAP(uint, mface->v1, mface->v3);
SWAP(uint, mface->v2, mface->v4);
std::swap(mface->v1, mface->v3);
std::swap(mface->v2, mface->v4);
if (fdata) {
CustomData_swap_corners(fdata, mfindex, corner_indices);

View File

@ -21,7 +21,7 @@
#include "BLI_linklist.h"
#include "BLI_linklist_stack.h"
#include "BLI_math.h"
#include "BLI_math_vec_types.hh"
#include "BLI_math_vector_types.hh"
#include "BLI_memarena.h"
#include "BLI_span.hh"
#include "BLI_stack.h"

View File

@ -16,8 +16,8 @@
#include "BLI_array.hh"
#include "BLI_index_range.hh"
#include "BLI_math_vec_types.hh"
#include "BLI_math_vector.h"
#include "BLI_math_vector_types.hh"
#include "BLI_span.hh"
#include "BLI_task.hh"

View File

@ -3561,16 +3561,16 @@ void nodeSetActive(bNodeTree *ntree, bNode *node)
void nodeSetSocketAvailability(bNodeTree *ntree, bNodeSocket *sock, bool is_available)
{
const bool was_available = (sock->flag & SOCK_UNAVAIL) == 0;
if (is_available != was_available) {
BKE_ntree_update_tag_socket_availability(ntree, sock);
if (is_available == was_available) {
return;
}
if (is_available) {
sock->flag &= ~SOCK_UNAVAIL;
}
else {
sock->flag |= SOCK_UNAVAIL;
}
BKE_ntree_update_tag_socket_availability(ntree, sock);
}
int nodeSocketLinkLimit(const bNodeSocket *sock)

View File

@ -14,6 +14,11 @@ namespace blender::bke::anonymous_attribute_inferencing {
namespace aal = nodes::aal;
using nodes::NodeDeclaration;
static bool socket_is_field(const bNodeSocket &socket)
{
return socket.display_shape == SOCK_DISPLAY_SHAPE_DIAMOND;
}
static const aal::RelationsInNode &get_relations_in_node(const bNode &node, ResourceScope &scope)
{
if (node.is_group()) {
@ -22,6 +27,25 @@ static const aal::RelationsInNode &get_relations_in_node(const bNode &node, Reso
return *group->runtime->anonymous_attribute_relations;
}
}
if (node.is_reroute()) {
const bNodeSocket &socket = node.input_socket(0);
if (socket_is_field(socket)) {
static const aal::RelationsInNode field_relations = []() {
aal::RelationsInNode relations;
relations.reference_relations.append({0, 0});
return relations;
}();
return field_relations;
}
if (socket.type == SOCK_GEOMETRY) {
static const aal::RelationsInNode geometry_relations = []() {
aal::RelationsInNode relations;
relations.propagate_relations.append({0, 0});
return relations;
}();
return geometry_relations;
}
}
if (const NodeDeclaration *node_decl = node.declaration()) {
if (const aal::RelationsInNode *relations = node_decl->anonymous_attribute_relations()) {
return *relations;
@ -41,11 +65,6 @@ Array<const aal::RelationsInNode *> get_relations_by_node(const bNodeTree &tree,
return relations_by_node;
}
static bool socket_is_field(const bNodeSocket &socket)
{
return socket.display_shape == SOCK_DISPLAY_SHAPE_DIAMOND;
}
/**
* Start at a group output socket and find all linked group inputs.
*/

View File

@ -54,7 +54,7 @@
#include "BLI_linklist.h"
#include "BLI_listbase.h"
#include "BLI_math.h"
#include "BLI_math_vec_types.hh"
#include "BLI_math_vector_types.hh"
#include "BLI_threads.h"
#include "BLI_utildefines.h"

View File

@ -17,7 +17,7 @@
#include "BLI_array.hh"
#include "BLI_float4x4.hh"
#include "BLI_math.h"
#include "BLI_math_vec_types.hh"
#include "BLI_math_vector_types.hh"
#include "BLI_rand.h"
#include "BLI_span.hh"
#include "BLI_vector.hh"

View File

@ -128,7 +128,7 @@ static void palette_undo_preserve(BlendLibReader * /*reader*/, ID *id_new, ID *i
/* NOTE: We do not swap IDProperties, as dealing with potential ID pointers in those would be
* fairly delicate. */
BKE_lib_id_swap(nullptr, id_new, id_old);
SWAP(IDProperty *, id_new->properties, id_old->properties);
std::swap(id_new->properties, id_old->properties);
}
IDTypeInfo IDType_ID_PAL = {
@ -1080,7 +1080,7 @@ bool BKE_paint_ensure(ToolSettings *ts, Paint **r_paint)
Paint paint_test = **r_paint;
BKE_paint_runtime_init(ts, *r_paint);
/* Swap so debug doesn't hide errors when release fails. */
SWAP(Paint, **r_paint, paint_test);
std::swap(**r_paint, paint_test);
BLI_assert(paint_test.runtime.ob_mode == (*r_paint)->runtime.ob_mode);
BLI_assert(paint_test.runtime.tool_offset == (*r_paint)->runtime.tool_offset);
#endif

View File

@ -27,7 +27,7 @@
#include "BLI_float3x3.hh"
#include "BLI_map.hh"
#include "BLI_math.h"
#include "BLI_math_vec_types.hh"
#include "BLI_math_vector_types.hh"
#include "BLI_rect.h"
#include "BLI_vector.hh"
#include "BLI_vector_list.hh"

View File

@ -510,12 +510,12 @@ static void scene_foreach_toolsettings_id_pointer_process(
}
/* We failed to find a new valid pointer for the previous ID, just keep the current one as
* if we had been under SCENE_FOREACH_UNDO_NO_RESTORE case. */
SWAP(ID *, *id_p, *id_old_p);
std::swap(*id_p, *id_old_p);
break;
}
case SCENE_FOREACH_UNDO_NO_RESTORE:
/* Counteract the swap of the whole ToolSettings container struct. */
SWAP(ID *, *id_p, *id_old_p);
std::swap(*id_p, *id_old_p);
break;
}
}
@ -1686,14 +1686,14 @@ static void scene_undo_preserve(BlendLibReader *reader, ID *id_new, ID *id_old)
Scene *scene_new = (Scene *)id_new;
Scene *scene_old = (Scene *)id_old;
SWAP(View3DCursor, scene_old->cursor, scene_new->cursor);
std::swap( scene_old->cursor, scene_new->cursor);
if (scene_new->toolsettings != nullptr && scene_old->toolsettings != nullptr) {
/* First try to restore ID pointers that can be and should be preserved (like brushes or
* palettes), and counteract the swap of the whole ToolSettings structs below for the others
* (like object ones). */
scene_foreach_toolsettings(
nullptr, scene_new->toolsettings, true, reader, scene_old->toolsettings);
SWAP(ToolSettings, *scene_old->toolsettings, *scene_new->toolsettings);
std::swap( *scene_old->toolsettings, *scene_new->toolsettings);
}
}

View File

@ -16,7 +16,7 @@
#include "BLI_compiler_compat.h"
#include "BLI_listbase.h"
#include "BLI_math.h"
#include "BLI_math_vec_types.hh"
#include "BLI_math_vector_types.hh"
#include "BLI_rand.h"
#include "BLI_span.hh"
#include "BLI_string.h"

View File

@ -5,8 +5,8 @@
#include "DNA_tracking_types.h"
#include "BKE_tracking.h"
#include "BLI_math_vec_types.hh"
#include "BLI_math_vector.h"
#include "BLI_math_vector_types.hh"
namespace blender {

View File

@ -11,7 +11,7 @@
namespace blender::bke {
using fn::MFDataType;
using mf::DataType;
template<typename From, typename To, To (*ConversionF)(const From &)>
static void add_implicit_conversion(DataTypeConversions &conversions)
@ -20,20 +20,20 @@ static void add_implicit_conversion(DataTypeConversions &conversions)
static const CPPType &to_type = CPPType::get<To>();
static const std::string conversion_name = from_type.name() + " to " + to_type.name();
static fn::CustomMF_SI_SO<From, To> multi_function{
static auto multi_function = mf::build::SI1_SO<From, To>(
conversion_name.c_str(),
/* Use lambda instead of passing #ConversionF directly, because otherwise the compiler won't
* inline the function. */
[](const From &a) { return ConversionF(a); },
fn::CustomMF_presets::AllSpanOrSingle()};
mf::build::exec_presets::AllSpanOrSingle());
static auto convert_single_to_initialized = [](const void *src, void *dst) {
*(To *)dst = ConversionF(*(const From *)src);
};
static auto convert_single_to_uninitialized = [](const void *src, void *dst) {
new (dst) To(ConversionF(*(const From *)src));
};
conversions.add(fn::MFDataType::ForSingle<From>(),
fn::MFDataType::ForSingle<To>(),
conversions.add(mf::DataType::ForSingle<From>(),
mf::DataType::ForSingle<To>(),
multi_function,
convert_single_to_initialized,
convert_single_to_uninitialized);
@ -361,26 +361,26 @@ void DataTypeConversions::convert_to_uninitialized(const CPPType &from_type,
}
const ConversionFunctions *functions = this->get_conversion_functions(
MFDataType::ForSingle(from_type), MFDataType::ForSingle(to_type));
DataType::ForSingle(from_type), DataType::ForSingle(to_type));
BLI_assert(functions != nullptr);
functions->convert_single_to_uninitialized(from_value, to_value);
}
static void call_convert_to_uninitialized_fn(const GVArray &from,
const fn::MultiFunction &fn,
const mf::MultiFunction &fn,
const IndexMask mask,
GMutableSpan to)
{
fn::MFParamsBuilder params{fn, mask.min_array_size()};
mf::ParamsBuilder params{fn, mask.min_array_size()};
params.add_readonly_single_input(from);
params.add_uninitialized_single_output(to);
fn::MFContextBuilder context;
mf::ContextBuilder context;
fn.call_auto(mask, params, context);
}
static void call_convert_to_uninitialized_fn(const GVArray &from,
const fn::MultiFunction &fn,
const mf::MultiFunction &fn,
GMutableSpan to)
{
call_convert_to_uninitialized_fn(from, fn, IndexMask(from.size()), to);
@ -394,8 +394,8 @@ void DataTypeConversions::convert_to_initialized_n(GSpan from_span, GMutableSpan
BLI_assert(from_span.size() == to_span.size());
BLI_assert(this->is_convertible(from_type, to_type));
const fn::MultiFunction *fn = this->get_conversion_multi_function(
MFDataType::ForSingle(from_type), MFDataType::ForSingle(to_type));
const mf::MultiFunction *fn = this->get_conversion_multi_function(DataType::ForSingle(from_type),
DataType::ForSingle(to_type));
to_type.destruct_n(to_span.data(), to_span.size());
call_convert_to_uninitialized_fn(GVArray::ForSpan(from_span), *fn, to_span);
@ -541,8 +541,8 @@ fn::GField DataTypeConversions::try_convert(fn::GField field, const CPPType &to_
if (!this->is_convertible(from_type, to_type)) {
return {};
}
const fn::MultiFunction &fn = *this->get_conversion_multi_function(
fn::MFDataType::ForSingle(from_type), fn::MFDataType::ForSingle(to_type));
const mf::MultiFunction &fn = *this->get_conversion_multi_function(
mf::DataType::ForSingle(from_type), mf::DataType::ForSingle(to_type));
return {std::make_shared<fn::FieldOperation>(fn, Vector<fn::GField>{std::move(field)})};
}

View File

@ -19,7 +19,7 @@
#include "BLI_index_range.hh"
#include "BLI_map.hh"
#include "BLI_math.h"
#include "BLI_math_vec_types.hh"
#include "BLI_math_vector_types.hh"
#include "BLI_path_util.h"
#include "BLI_string.h"
#include "BLI_string_ref.hh"

View File

@ -8,8 +8,8 @@
#include "BLI_array.hh"
#include "BLI_math_matrix.h"
#include "BLI_math_vec_types.hh"
#include "BLI_math_vector.h"
#include "BLI_math_vector_types.hh"
#include "BLI_vector.hh"
#include "DNA_volume_types.h"

View File

@ -2,7 +2,7 @@
#include <vector>
#include "BLI_math_vec_types.hh"
#include "BLI_math_vector_types.hh"
#include "BLI_span.hh"
#include "BLI_utildefines.h"

View File

@ -202,8 +202,8 @@ void BLI_delaunay_2d_cdt_free(CDT_result *result);
# include "BLI_array.hh"
# include "BLI_math_mpq.hh"
# include "BLI_math_vec_mpq_types.hh"
# include "BLI_math_vec_types.hh"
# include "BLI_math_vector_mpq_types.hh"
# include "BLI_math_vector_types.hh"
# include "BLI_vector.hh"
namespace blender::meshintersect {

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