Mesh: Make vertex normal calculation deterministic #111718

Merged
Hans Goudey merged 9 commits from HooglyBoogly/blender:mesh-normals-deterministic into main 2023-11-10 15:19:13 +01:00
103 changed files with 889 additions and 813 deletions
Showing only changes of commit b9a40350b9 - Show all commits

View File

@ -72,7 +72,7 @@ macro(BLENDER_SRC_GTEST_EX)
if(DEFINED PTHREADS_LIBRARIES) # Needed for GLOG.
target_link_libraries(${TARGET_NAME} PRIVATE ${PTHREADS_LIBRARIES})
endif()
if(WITH_OPENMP_STATIC)
if(WITH_OPENMP AND WITH_OPENMP_STATIC)
target_link_libraries(${TARGET_NAME} PRIVATE ${OpenMP_LIBRARIES})
endif()
if(UNIX AND NOT APPLE)

View File

@ -104,3 +104,13 @@ if(UNIX AND (NOT APPLE) AND LIBDIR AND (EXISTS ${LIBDIR}))
)
unset(_libdir_stale)
endif()
# Detect update in 4.1 to shared library OpenImageDenoise.
if(UNIX AND
DEFINED OPENIMAGEDENOISE_LIBRARY AND
OPENIMAGEDENOISE_LIBRARY MATCHES "libOpenImageDenoise.a$" AND
(EXISTS ${LIBDIR}/openimagedenoise/lib/libOpenImageDenoise.so OR
EXISTS ${LIBDIR}/openimagedenoise/lib/libOpenImageDenoise.dylib))
message(STATUS "Auto updating CMake configuration for dynamic OpenImageDenoise")
unset_cache_variables("^OPENIMAGEDENOISE")
endif()

View File

@ -65,7 +65,7 @@ HIPRTDevice::HIPRTDevice(const DeviceInfo &info, Stats &stats, Profiler &profile
functions_table(NULL),
scratch_buffer_size(0),
scratch_buffer(this, "scratch_buffer", MEM_DEVICE_ONLY),
visibility(this, "visibility", MEM_READ_ONLY),
prim_visibility(this, "prim_visibility", MEM_GLOBAL),
instance_transform_matrix(this, "instance_transform_matrix", MEM_READ_ONLY),
transform_headers(this, "transform_headers", MEM_READ_ONLY),
user_instance_id(this, "user_instance_id", MEM_GLOBAL),
@ -104,7 +104,7 @@ HIPRTDevice::~HIPRTDevice()
{
HIPContextScope scope(this);
user_instance_id.free();
visibility.free();
prim_visibility.free();
hiprt_blas_ptr.free();
blas_ptr.free();
instance_transform_matrix.free();
@ -388,54 +388,72 @@ hiprtGeometryBuildInput HIPRTDevice::prepare_triangle_blas(BVHHIPRT *bvh, Mesh *
hiprtGeometryBuildInput geom_input;
geom_input.geomType = Triangle;
if (mesh->has_motion_blur() &&
!(bvh->params.num_motion_triangle_steps == 0 || bvh->params.use_spatial_split))
{
if (mesh->has_motion_blur()) {
const Attribute *attr_mP = mesh->attributes.find(ATTR_STD_MOTION_VERTEX_POSITION);
const float3 *vert_steps = attr_mP->data_float3();
const size_t num_verts = mesh->get_verts().size();
const size_t num_steps = mesh->get_motion_steps();
const size_t num_triangles = mesh->num_triangles();
const int num_bvh_steps = bvh->params.num_motion_triangle_steps * 2 + 1;
const float num_bvh_steps_inv_1 = 1.0f / (num_bvh_steps - 1);
const float3 *verts = mesh->get_verts().data();
int num_bounds = 0;
bvh->custom_primitive_bound.alloc(num_triangles * num_bvh_steps);
for (uint j = 0; j < num_triangles; j++) {
Mesh::Triangle t = mesh->get_triangle(j);
const float3 *verts = mesh->get_verts().data();
if (bvh->params.num_motion_triangle_steps == 0 || bvh->params.use_spatial_split) {
bvh->custom_primitive_bound.alloc(num_triangles);
bvh->custom_prim_info.resize(num_triangles);
for (uint j = 0; j < num_triangles; j++) {
Mesh::Triangle t = mesh->get_triangle(j);
BoundBox bounds = BoundBox::empty;
t.bounds_grow(verts, bounds);
for (size_t step = 0; step < num_steps - 1; step++) {
t.bounds_grow(vert_steps + step * num_verts, bounds);
}
const size_t num_verts = mesh->get_verts().size();
const size_t num_steps = mesh->get_motion_steps();
const float3 *vert_steps = attr_mP->data_float3();
float3 prev_verts[3];
t.motion_verts(verts, vert_steps, num_verts, num_steps, 0.0f, prev_verts);
BoundBox prev_bounds = BoundBox::empty;
prev_bounds.grow(prev_verts[0]);
prev_bounds.grow(prev_verts[1]);
prev_bounds.grow(prev_verts[2]);
for (int bvh_step = 1; bvh_step < num_bvh_steps; ++bvh_step) {
const float curr_time = (float)(bvh_step)*num_bvh_steps_inv_1;
float3 curr_verts[3];
t.motion_verts(verts, vert_steps, num_verts, num_steps, curr_time, curr_verts);
BoundBox curr_bounds = BoundBox::empty;
curr_bounds.grow(curr_verts[0]);
curr_bounds.grow(curr_verts[1]);
curr_bounds.grow(curr_verts[2]);
BoundBox bounds = prev_bounds;
bounds.grow(curr_bounds);
if (bounds.valid()) {
const float prev_time = (float)(bvh_step - 1) * num_bvh_steps_inv_1;
bvh->custom_primitive_bound[num_bounds] = bounds;
bvh->custom_prim_info[num_bounds].x = j;
bvh->custom_prim_info[num_bounds].y = mesh->primitive_type();
bvh->prims_time[num_bounds].x = curr_time;
bvh->prims_time[num_bounds].y = prev_time;
num_bounds++;
}
prev_bounds = curr_bounds;
}
}
else {
const int num_bvh_steps = bvh->params.num_motion_triangle_steps * 2 + 1;
const float num_bvh_steps_inv_1 = 1.0f / (num_bvh_steps - 1);
bvh->custom_primitive_bound.alloc(num_triangles * num_bvh_steps);
bvh->custom_prim_info.resize(num_triangles * num_bvh_steps);
for (uint j = 0; j < num_triangles; j++) {
Mesh::Triangle t = mesh->get_triangle(j);
float3 prev_verts[3];
t.motion_verts(verts, vert_steps, num_verts, num_steps, 0.0f, prev_verts);
BoundBox prev_bounds = BoundBox::empty;
prev_bounds.grow(prev_verts[0]);
prev_bounds.grow(prev_verts[1]);
prev_bounds.grow(prev_verts[2]);
for (int bvh_step = 1; bvh_step < num_bvh_steps; ++bvh_step) {
const float curr_time = (float)(bvh_step)*num_bvh_steps_inv_1;
float3 curr_verts[3];
t.motion_verts(verts, vert_steps, num_verts, num_steps, curr_time, curr_verts);
BoundBox curr_bounds = BoundBox::empty;
curr_bounds.grow(curr_verts[0]);
curr_bounds.grow(curr_verts[1]);
curr_bounds.grow(curr_verts[2]);
BoundBox bounds = prev_bounds;
bounds.grow(curr_bounds);
if (bounds.valid()) {
const float prev_time = (float)(bvh_step - 1) * num_bvh_steps_inv_1;
bvh->custom_primitive_bound[num_bounds] = bounds;
bvh->custom_prim_info[num_bounds].x = j;
bvh->custom_prim_info[num_bounds].y = mesh->primitive_type();
bvh->prims_time[num_bounds].x = curr_time;
bvh->prims_time[num_bounds].y = prev_time;
num_bounds++;
}
prev_bounds = curr_bounds;
}
}
}
@ -449,7 +467,6 @@ hiprtGeometryBuildInput HIPRTDevice::prepare_triangle_blas(BVHHIPRT *bvh, Mesh *
geom_input.geomType = Motion_Triangle;
}
else {
size_t triangle_size = mesh->get_triangles().size();
void *triangle_data = mesh->get_triangles().data();
@ -480,6 +497,7 @@ hiprtGeometryBuildInput HIPRTDevice::prepare_triangle_blas(BVHHIPRT *bvh, Mesh *
geom_input.type = hiprtPrimitiveTypeTriangleMesh;
geom_input.triangleMesh.primitive = &(bvh->triangle_mesh);
}
return geom_input;
}
@ -800,7 +818,7 @@ hiprtScene HIPRTDevice::build_tlas(BVHHIPRT *bvh,
size_t num_object = objects.size();
user_instance_id.alloc(num_object);
visibility.alloc(num_object);
prim_visibility.alloc(num_object);
hiprt_blas_ptr.alloc(num_object);
blas_ptr.alloc(num_object);
transform_headers.alloc(num_object);
@ -913,7 +931,7 @@ hiprtScene HIPRTDevice::build_tlas(BVHHIPRT *bvh,
transform_headers[num_instances] = current_header;
user_instance_id[num_instances] = blender_instance_id;
visibility[num_instances] = mask;
prim_visibility[num_instances] = mask;
hiprt_blas_ptr[num_instances] = (uint64_t)hiprt_geom_current;
num_instances++;
}
@ -928,7 +946,7 @@ hiprtScene HIPRTDevice::build_tlas(BVHHIPRT *bvh,
scene_input_ptr.frameType = hiprtFrameTypeMatrix;
user_instance_id.copy_to_device();
visibility.copy_to_device();
prim_visibility.copy_to_device();
hiprt_blas_ptr.copy_to_device();
blas_ptr.copy_to_device();
transform_headers.copy_to_device();
@ -942,7 +960,7 @@ hiprtScene HIPRTDevice::build_tlas(BVHHIPRT *bvh,
instance_transform_matrix.host_pointer = 0;
}
scene_input_ptr.instanceMasks = (void *)visibility.device_pointer;
scene_input_ptr.instanceMasks = (void *)prim_visibility.device_pointer;
scene_input_ptr.instanceGeometries = (void *)hiprt_blas_ptr.device_pointer;
scene_input_ptr.instanceTransformHeaders = (void *)transform_headers.device_pointer;
scene_input_ptr.instanceFrames = (void *)instance_transform_matrix.device_pointer;

View File

@ -82,7 +82,11 @@ class HIPRTDevice : public HIPDevice {
* are defined on the GPU side as members of KernelParamsHIPRT struct the host memory is copied
* to GPU through const_copy_to() function. */
device_vector<uint32_t> visibility;
/* Originally, visibility was only passed to HIP RT but after a bug report it was noted it was
* required for custom primitives (i.e., motion triangles). This buffer, however, has visibility
* per object not per primitive so the same buffer as the one that is passed to HIP RT can be
* used. */
device_vector<uint32_t> prim_visibility;
/* instance_transform_matrix passes transform matrix of instances converted from Cycles Transform
* format to instanceFrames member of hiprtSceneBuildInput. */

View File

@ -976,7 +976,7 @@ bool BVHMetal::build_TLAS(Progress &progress,
storage_mode = MTLResourceStorageModeShared;
}
id<MTLBuffer> nullBuf = [device newBufferWithLength:0 options:storage_mode];
id<MTLBuffer> nullBuf = [device newBufferWithLength:sizeof(float3) options:storage_mode];
/* Create an acceleration structure. */
MTLAccelerationStructureTriangleGeometryDescriptor *geomDesc =

View File

@ -980,66 +980,96 @@ char *OneapiDevice::device_capabilities()
# endif
capabilities << std::string("\t") << name << "\n";
capabilities << "\t\tsycl::info::platform::name\t\t\t"
<< device.get_platform().get_info<sycl::info::platform::name>() << "\n";
# define WRITE_ATTR(attribute_name, attribute_variable) \
capabilities << "\t\tsycl::info::device::" #attribute_name "\t\t\t" << attribute_variable \
<< "\n";
# define GET_NUM_ATTR(attribute) \
# define GET_ATTR(attribute) \
{ \
size_t attribute = (size_t)device.get_info<sycl::info::device ::attribute>(); \
capabilities << "\t\tsycl::info::device::" #attribute "\t\t\t" << attribute << "\n"; \
capabilities << "\t\tsycl::info::device::" #attribute "\t\t\t" \
<< device.get_info<sycl::info::device ::attribute>() << "\n"; \
}
# define GET_INTEL_ATTR(attribute) \
{ \
if (device.has(sycl::aspect::ext_intel_##attribute)) { \
capabilities << "\t\tsycl::ext::intel::info::device::" #attribute "\t\t\t" \
<< device.get_info<sycl::ext::intel::info::device ::attribute>() << "\n"; \
} \
}
# define GET_ASPECT(aspect_) \
{ \
capabilities << "\t\tdevice::has(" #aspect_ ")\t\t\t" << device.has(sycl::aspect ::aspect_) \
<< "\n"; \
}
GET_NUM_ATTR(vendor_id)
GET_NUM_ATTR(max_compute_units)
GET_NUM_ATTR(max_work_item_dimensions)
GET_ATTR(vendor)
GET_ATTR(driver_version)
GET_ATTR(max_compute_units)
GET_ATTR(max_clock_frequency)
GET_ATTR(global_mem_size)
GET_INTEL_ATTR(pci_address)
GET_INTEL_ATTR(gpu_eu_simd_width)
GET_INTEL_ATTR(gpu_eu_count)
GET_INTEL_ATTR(gpu_slices)
GET_INTEL_ATTR(gpu_subslices_per_slice)
GET_INTEL_ATTR(gpu_eu_count_per_subslice)
GET_INTEL_ATTR(gpu_hw_threads_per_eu)
GET_INTEL_ATTR(max_mem_bandwidth)
GET_ATTR(max_work_group_size)
GET_ATTR(max_work_item_dimensions)
sycl::id<3> max_work_item_sizes =
device.get_info<sycl::info::device::max_work_item_sizes<3>>();
WRITE_ATTR(max_work_item_sizes_dim0, ((size_t)max_work_item_sizes.get(0)))
WRITE_ATTR(max_work_item_sizes_dim1, ((size_t)max_work_item_sizes.get(1)))
WRITE_ATTR(max_work_item_sizes_dim2, ((size_t)max_work_item_sizes.get(2)))
WRITE_ATTR(max_work_item_sizes[0], max_work_item_sizes.get(0))
WRITE_ATTR(max_work_item_sizes[1], max_work_item_sizes.get(1))
WRITE_ATTR(max_work_item_sizes[2], max_work_item_sizes.get(2))
GET_NUM_ATTR(max_work_group_size)
GET_NUM_ATTR(max_num_sub_groups)
GET_NUM_ATTR(sub_group_independent_forward_progress)
GET_ATTR(max_num_sub_groups)
for (size_t sub_group_size : device.get_info<sycl::info::device::sub_group_sizes>()) {
WRITE_ATTR(sub_group_size[], sub_group_size)
}
GET_ATTR(sub_group_independent_forward_progress)
GET_NUM_ATTR(preferred_vector_width_char)
GET_NUM_ATTR(preferred_vector_width_short)
GET_NUM_ATTR(preferred_vector_width_int)
GET_NUM_ATTR(preferred_vector_width_long)
GET_NUM_ATTR(preferred_vector_width_float)
GET_NUM_ATTR(preferred_vector_width_double)
GET_NUM_ATTR(preferred_vector_width_half)
GET_ATTR(preferred_vector_width_char)
GET_ATTR(preferred_vector_width_short)
GET_ATTR(preferred_vector_width_int)
GET_ATTR(preferred_vector_width_long)
GET_ATTR(preferred_vector_width_float)
GET_ATTR(preferred_vector_width_double)
GET_ATTR(preferred_vector_width_half)
GET_NUM_ATTR(native_vector_width_char)
GET_NUM_ATTR(native_vector_width_short)
GET_NUM_ATTR(native_vector_width_int)
GET_NUM_ATTR(native_vector_width_long)
GET_NUM_ATTR(native_vector_width_float)
GET_NUM_ATTR(native_vector_width_double)
GET_NUM_ATTR(native_vector_width_half)
GET_ATTR(address_bits)
GET_ATTR(max_mem_alloc_size)
GET_ATTR(mem_base_addr_align)
GET_ATTR(error_correction_support)
GET_ATTR(is_available)
size_t max_clock_frequency = device.get_info<sycl::info::device::max_clock_frequency>();
WRITE_ATTR(max_clock_frequency, max_clock_frequency)
GET_ASPECT(cpu)
GET_ASPECT(gpu)
GET_ASPECT(fp16)
GET_ASPECT(atomic64)
GET_ASPECT(usm_host_allocations)
GET_ASPECT(usm_device_allocations)
GET_ASPECT(usm_shared_allocations)
GET_ASPECT(usm_system_allocations)
GET_NUM_ATTR(address_bits)
GET_NUM_ATTR(max_mem_alloc_size)
# ifdef __SYCL_ANY_DEVICE_HAS_ext_oneapi_non_uniform_groups__
GET_ASPECT(ext_oneapi_non_uniform_groups)
# endif
# ifdef __SYCL_ANY_DEVICE_HAS_ext_oneapi_bindless_images__
GET_ASPECT(ext_oneapi_bindless_images)
# endif
# ifdef __SYCL_ANY_DEVICE_HAS_ext_oneapi_interop_semaphore_import__
GET_ASPECT(ext_oneapi_interop_semaphore_import)
# endif
# ifdef __SYCL_ANY_DEVICE_HAS_ext_oneapi_interop_semaphore_export__
GET_ASPECT(ext_oneapi_interop_semaphore_export)
# endif
/* NOTE(@nsirgien): Implementation doesn't use image support as bindless images aren't
* supported so we always return false, even if device supports HW texture usage acceleration.
*/
bool image_support = false;
WRITE_ATTR(image_support, (size_t)image_support)
GET_NUM_ATTR(max_parameter_size)
GET_NUM_ATTR(mem_base_addr_align)
GET_NUM_ATTR(global_mem_size)
GET_NUM_ATTR(local_mem_size)
GET_NUM_ATTR(error_correction_support)
GET_NUM_ATTR(profiling_timer_resolution)
GET_NUM_ATTR(is_available)
# undef GET_NUM_ATTR
# undef GET_INTEL_ATTR
# undef GET_ASPECT
# undef GET_ATTR
# undef WRITE_ATTR
capabilities << "\n";
}

View File

@ -177,7 +177,6 @@ ccl_device_inline bool motion_triangle_custom_intersect(const hiprtRay &ray,
void *payload,
hiprtHit &hit)
{
# ifdef MOTION_BLUR
RayPayload *local_payload = (RayPayload *)payload;
KernelGlobals kg = local_payload->kg;
int object_id = kernel_data_fetch(user_instance_id, hit.instanceID);
@ -202,7 +201,7 @@ ccl_device_inline bool motion_triangle_custom_intersect(const hiprtRay &ray,
local_payload->visibility,
object_id,
prim_id_global,
prim_id_local);
hit.instanceID);
if (b_hit) {
hit.uv.x = isect.u;
@ -212,9 +211,6 @@ ccl_device_inline bool motion_triangle_custom_intersect(const hiprtRay &ray,
local_payload->prim_type = isect.type;
}
return b_hit;
# else
return false;
# endif
}
ccl_device_inline bool motion_triangle_custom_local_intersect(const hiprtRay &ray,

View File

@ -76,7 +76,7 @@ if(WITH_OPENSUBDIV)
${OPENSUBDIV_LIBRARIES}
)
if(WITH_OPENMP_STATIC)
if(WITH_OPENMP AND WITH_OPENMP_STATIC)
list(APPEND LIB
${OpenMP_LIBRARIES}
)

View File

@ -17,6 +17,12 @@ def keyconfig_update(keyconfig_data, keyconfig_version):
# Only copy once.
has_copy = False
def get_transform_modal_map():
for km_name, _km_parms, km_items_data in keyconfig_data:
if km_name == "Transform Modal Map":
return km_items_data
print("not found")
# Default repeat to false.
if keyconfig_version <= (2, 92, 0):
if not has_copy:
@ -69,18 +75,16 @@ def keyconfig_update(keyconfig_data, keyconfig_version):
keyconfig_data = copy.deepcopy(keyconfig_data)
has_copy = True
for km_name, _km_parms, km_items_data in keyconfig_data:
if km_name == "Transform Modal Map":
km_items = km_items_data["items"]
for (item_modal, item_event, _item_prop) in km_items:
if item_modal == 'TRANSLATE':
km_items.append(('VERT_EDGE_SLIDE', item_event, None))
elif item_modal == 'ROTATE':
km_items.append(('TRACKBALL', item_event, None))
if km_items_data := get_transform_modal_map():
km_items = km_items_data["items"]
for (item_modal, item_event, _item_prop) in km_items:
if item_modal == 'TRANSLATE':
km_items.append(('VERT_EDGE_SLIDE', item_event, None))
elif item_modal == 'ROTATE':
km_items.append(('TRACKBALL', item_event, None))
# The modal key for "Rotate Normals" also didn't exist until then.
km_items.append(('ROTATE_NORMALS', {"type": 'N', "value": 'PRESS'}, None))
break
# The modal key for "Rotate Normals" also didn't exist until then.
km_items.append(('ROTATE_NORMALS', {"type": 'N', "value": 'PRESS'}, None))
if keyconfig_version <= (4, 0, 3):
if not has_copy:
@ -88,10 +92,32 @@ def keyconfig_update(keyconfig_data, keyconfig_version):
has_copy = True
# "Snap Source Toggle" did not exist until then.
for km_name, _km_parms, km_items_data in keyconfig_data:
if km_name == "Transform Modal Map":
km_items_data["items"].append(("EDIT_SNAP_SOURCE_ON", {"type": 'B', "value": 'PRESS'}, None))
km_items_data["items"].append(("EDIT_SNAP_SOURCE_OFF", {"type": 'B', "value": 'PRESS'}, None))
break
if km_items_data := get_transform_modal_map():
km_items_data["items"].append(("EDIT_SNAP_SOURCE_ON", {"type": 'B', "value": 'PRESS'}, None))
km_items_data["items"].append(("EDIT_SNAP_SOURCE_OFF", {"type": 'B', "value": 'PRESS'}, None))
if keyconfig_version <= (4, 1, 5):
if km_items_data := get_transform_modal_map():
def use_alt_navigate():
km_item = next((i for i in km_items_data["items"] if i[0] ==
"PROPORTIONAL_SIZE" and i[1]["type"] == 'TRACKPADPAN'), None)
if km_item:
return "alt" not in km_item[1] or km_item[1]["alt"] is False
# Fallback.
import bpy
return getattr(
bpy.context.window_manager.keyconfigs.active.preferences,
"use_alt_navigation",
False)
if use_alt_navigate():
if not has_copy:
keyconfig_data = copy.deepcopy(keyconfig_data)
has_copy = True
km_items_data = get_transform_modal_map()
km_items_data["items"].append(
("PASSTHROUGH_NAVIGATE", {"type": 'LEFT_ALT', "value": 'ANY', "any": True}, None))
return keyconfig_data

View File

@ -153,8 +153,6 @@ def draw(layout, context, context_member, property_type, *, use_edit=True):
if not rna_item:
return
from bpy.utils import escape_identifier
if rna_item.id_data.library is not None:
use_edit = False
is_lib_override = rna_item.id_data.override_library and rna_item.id_data.override_library.reference

View File

@ -359,16 +359,13 @@ def _template_items_transform_actions(
items = [
("transform.translate", {"type": params.select_mouse, "value": 'CLICK_DRAG'}, None),
op_tool_optional(
("transform.translate", {"type": 'G', "value": 'PRESS'},
{"properties": [("alt_navigation", params.use_alt_navigation)]}),
("transform.translate", {"type": 'G', "value": 'PRESS'}, None),
(op_tool_cycle, "builtin.move"), params),
op_tool_optional(
("transform.rotate", {"type": 'R', "value": 'PRESS'},
{"properties": [("alt_navigation", params.use_alt_navigation)]}),
("transform.rotate", {"type": 'R', "value": 'PRESS'}, None),
(op_tool_cycle, "builtin.rotate"), params),
op_tool_optional(
("transform.resize", {"type": 'S', "value": 'PRESS'},
{"properties": [("alt_navigation", params.use_alt_navigation)]}),
("transform.resize", {"type": 'S', "value": 'PRESS'}, None),
(op_tool_cycle, "builtin.scale"), params),
]
@ -3753,8 +3750,7 @@ def km_grease_pencil_stroke_edit_mode(params):
("gpencil.duplicate_move", {"type": 'D', "value": 'PRESS', "shift": True}, None),
# Extrude and move selected points
op_tool_optional(
("gpencil.extrude_move", {"type": 'E', "value": 'PRESS'},
{"properties": [("TRANSFORM_OT_translate", [("alt_navigation", params.use_alt_navigation)])]}),
("gpencil.extrude_move", {"type": 'E', "value": 'PRESS'}, None),
(op_tool_cycle, "builtin.extrude"), params),
# Delete
op_menu("VIEW3D_MT_edit_gpencil_delete", {"type": 'X', "value": 'PRESS'}),
@ -4683,10 +4679,8 @@ def km_object_mode(params):
op_menu("VIEW3D_MT_add", {"type": 'A', "value": 'PRESS', "shift": True}),
op_menu("VIEW3D_MT_object_apply", {"type": 'A', "value": 'PRESS', "ctrl": True}),
op_menu("VIEW3D_MT_make_links", {"type": 'L', "value": 'PRESS', "ctrl": True}),
("object.duplicate_move", {"type": 'D', "value": 'PRESS', "shift": True},
{"properties": [("TRANSFORM_OT_translate", [("alt_navigation", params.use_alt_navigation)])]}),
("object.duplicate_move_linked", {"type": 'D', "value": 'PRESS', "alt": True},
{"properties": [("TRANSFORM_OT_translate", [("alt_navigation", params.use_alt_navigation)])]}),
("object.duplicate_move", {"type": 'D', "value": 'PRESS', "shift": True}, None),
("object.duplicate_move_linked", {"type": 'D', "value": 'PRESS', "alt": True}, None),
("object.join", {"type": 'J', "value": 'PRESS', "ctrl": True}, None),
("wm.context_toggle", {"type": 'PERIOD', "value": 'PRESS', "ctrl": True},
{"properties": [("data_path", 'tool_settings.use_transform_data_origin')]}),
@ -4870,13 +4864,10 @@ def km_paint_curve(params):
("paintcurve.delete_point", {"type": 'DEL', "value": 'PRESS'}, None),
("paintcurve.draw", {"type": 'RET', "value": 'PRESS'}, None),
("paintcurve.draw", {"type": 'NUMPAD_ENTER', "value": 'PRESS'}, None),
("transform.translate", {"type": 'G', "value": 'PRESS'},
{"properties": [("alt_navigation", params.use_alt_navigation)]}),
("transform.translate", {"type": 'G', "value": 'PRESS'}, None),
("transform.translate", {"type": params.select_mouse, "value": 'CLICK_DRAG'}, None),
("transform.rotate", {"type": 'R', "value": 'PRESS'},
{"properties": [("alt_navigation", params.use_alt_navigation)]}),
("transform.resize", {"type": 'S', "value": 'PRESS'},
{"properties": [("alt_navigation", params.use_alt_navigation)]}),
("transform.rotate", {"type": 'R', "value": 'PRESS'}, None),
("transform.resize", {"type": 'S', "value": 'PRESS'}, None),
])
return keymap
@ -5613,8 +5604,7 @@ def km_edit_mesh(params):
("mesh.normals_make_consistent", {"type": 'N', "value": 'PRESS', "shift": True, "ctrl": True},
{"properties": [("inside", True)]}),
op_tool_optional(
("view3d.edit_mesh_extrude_move_normal", {"type": 'E', "value": 'PRESS'},
{"properties": [("alt_navigation", params.use_alt_navigation)]}),
("view3d.edit_mesh_extrude_move_normal", {"type": 'E', "value": 'PRESS'}, None),
(op_tool_cycle, "builtin.extrude_region"), params),
op_menu("VIEW3D_MT_edit_mesh_extrude", {"type": 'E', "value": 'PRESS', "alt": True}),
("transform.edge_crease", {"type": 'E', "value": 'PRESS', "shift": True}, None),
@ -5631,13 +5621,11 @@ def km_edit_mesh(params):
# No tool is available for this.
("mesh.rip_move", {"type": 'V', "value": 'PRESS', "alt": True},
{"properties": [("MESH_OT_rip", [("use_fill", True)],)]}),
("mesh.rip_edge_move", {"type": 'D', "value": 'PRESS', "alt": True},
{"properties": [("TRANSFORM_OT_translate", [("alt_navigation", params.use_alt_navigation)])]}),
("mesh.rip_edge_move", {"type": 'D', "value": 'PRESS', "alt": True}, None),
op_menu("VIEW3D_MT_edit_mesh_merge", {"type": 'M', "value": 'PRESS'}),
op_menu("VIEW3D_MT_edit_mesh_split", {"type": 'M', "value": 'PRESS', "alt": True}),
("mesh.edge_face_add", {"type": 'F', "value": 'PRESS', "repeat": True}, None),
("mesh.duplicate_move", {"type": 'D', "value": 'PRESS', "shift": True},
{"properties": [("TRANSFORM_OT_translate", [("alt_navigation", params.use_alt_navigation)])]}),
("mesh.duplicate_move", {"type": 'D', "value": 'PRESS', "shift": True}, None),
op_menu("VIEW3D_MT_mesh_add", {"type": 'A', "value": 'PRESS', "shift": True}),
("mesh.separate", {"type": 'P', "value": 'PRESS'}, None),
("mesh.split", {"type": 'Y', "value": 'PRESS'}, None),
@ -5758,8 +5746,7 @@ def km_edit_armature(params):
("armature.dissolve", {"type": 'X', "value": 'PRESS', "ctrl": True}, None),
("armature.dissolve", {"type": 'DEL', "value": 'PRESS', "ctrl": True}, None),
op_tool_optional(
("armature.extrude_move", {"type": 'E', "value": 'PRESS'},
{"properties": [("TRANSFORM_OT_translate", [("alt_navigation", params.use_alt_navigation)])]}),
("armature.extrude_move", {"type": 'E', "value": 'PRESS'}, None),
(op_tool_cycle, "builtin.extrude"), params),
("armature.extrude_forked", {"type": 'E', "value": 'PRESS', "shift": True}, None),
("armature.click_extrude", {"type": params.action_mouse, "value": 'CLICK', "ctrl": True}, None),
@ -6024,8 +6011,7 @@ def km_edit_curve_legacy(params):
("curve.separate", {"type": 'P', "value": 'PRESS'}, None),
("curve.split", {"type": 'Y', "value": 'PRESS'}, None),
op_tool_optional(
("curve.extrude_move", {"type": 'E', "value": 'PRESS'},
{"properties": [("TRANSFORM_OT_translate", [("alt_navigation", params.use_alt_navigation)])]}),
("curve.extrude_move", {"type": 'E', "value": 'PRESS'}, None),
(op_tool_cycle, "builtin.extrude"), params),
("curve.duplicate_move", {"type": 'D', "value": 'PRESS', "shift": True}, None),
("curve.make_segment", {"type": 'F', "value": 'PRESS'}, None),
@ -6196,6 +6182,9 @@ def km_transform_modal_map(params):
("PRECISION", {"type": 'RIGHT_SHIFT', "value": 'ANY', "any": True}, None),
])
if params.use_alt_navigation:
items.append(("PASSTHROUGH_NAVIGATE", {"type": 'LEFT_ALT', "value": 'ANY', "any": True}, None))
return keymap

View File

@ -4,12 +4,6 @@
from __future__ import annotations
if "bpy" in locals():
from importlib import reload
if "anim_utils" in locals():
reload(anim_utils)
del reload
import bpy
from bpy.types import Operator

View File

@ -284,7 +284,6 @@ class NewGeometryNodeTreeAssign(Operator):
return geometry_modifier_poll(context)
def execute(self, context):
space = context.space_data
modifier = get_context_modifier(context)
if not modifier:
return {'CANCELLED'}

View File

@ -166,8 +166,6 @@ class NodeAddZoneOperator(NodeAddOperator):
space = context.space_data
tree = space.edit_tree
props = self.properties
self.deselect_nodes(context)
input_node = self.create_node(context, self.input_node_type)
output_node = self.create_node(context, self.output_node_type)

View File

@ -219,7 +219,6 @@ def extend(obj, EXTEND_MODE, use_uv_selection):
def main(context, operator):
use_uv_selection = True
view = context.space_data
if context.space_data and context.space_data.type == 'VIEW_3D':
use_uv_selection = False # When called from the 3D editor, UV selection is ignored.

View File

@ -15,12 +15,6 @@ class VIEW3D_OT_edit_mesh_extrude_individual_move(Operator):
bl_label = "Extrude Individual and Move"
bl_idname = "view3d.edit_mesh_extrude_individual_move"
alt_navigation: BoolProperty(
name="alt_navigation",
default=False,
description="Transform Navigation with Alt",
)
@classmethod
def poll(cls, context):
obj = context.active_object
@ -41,7 +35,6 @@ class VIEW3D_OT_edit_mesh_extrude_individual_move(Operator):
"orient_type": 'NORMAL',
"constraint_axis": (False, False, True),
"release_confirm": False,
"alt_navigation": self.alt_navigation,
},
)
elif select_mode[2] and totface > 1:
@ -49,14 +42,12 @@ class VIEW3D_OT_edit_mesh_extrude_individual_move(Operator):
'INVOKE_REGION_WIN',
TRANSFORM_OT_shrink_fatten={
"release_confirm": False,
"alt_navigation": self.alt_navigation,
})
elif select_mode[1] and totedge >= 1:
bpy.ops.mesh.extrude_edges_move(
'INVOKE_REGION_WIN',
TRANSFORM_OT_translate={
"release_confirm": False,
"alt_navigation": self.alt_navigation,
},
)
else:
@ -64,7 +55,6 @@ class VIEW3D_OT_edit_mesh_extrude_individual_move(Operator):
'INVOKE_REGION_WIN',
TRANSFORM_OT_translate={
"release_confirm": False,
"alt_navigation": self.alt_navigation,
},
)
@ -87,19 +77,13 @@ class VIEW3D_OT_edit_mesh_extrude_move(Operator):
description="Dissolves adjacent faces and intersects new geometry",
)
alt_navigation: BoolProperty(
name="alt_navigation",
default=False,
description="Transform Navigation with Alt",
)
@classmethod
def poll(cls, context):
obj = context.active_object
return (obj is not None and obj.mode == 'EDIT')
@staticmethod
def extrude_region(context, use_vert_normals, dissolve_and_intersect, alt_navigation):
def extrude_region(context, use_vert_normals, dissolve_and_intersect):
mesh = context.object.data
totface = mesh.total_face_sel
@ -112,7 +96,6 @@ class VIEW3D_OT_edit_mesh_extrude_move(Operator):
'INVOKE_REGION_WIN',
TRANSFORM_OT_shrink_fatten={
"release_confirm": False,
"alt_navigation": alt_navigation,
},
)
elif dissolve_and_intersect:
@ -125,7 +108,6 @@ class VIEW3D_OT_edit_mesh_extrude_move(Operator):
"orient_type": 'NORMAL',
"constraint_axis": (False, False, True),
"release_confirm": False,
"alt_navigation": alt_navigation,
},
)
else:
@ -135,7 +117,6 @@ class VIEW3D_OT_edit_mesh_extrude_move(Operator):
"orient_type": 'NORMAL',
"constraint_axis": (False, False, True),
"release_confirm": False,
"alt_navigation": alt_navigation,
},
)
@ -150,14 +131,12 @@ class VIEW3D_OT_edit_mesh_extrude_move(Operator):
# "constraint_axis": (True, True, False),
"constraint_axis": (False, False, False),
"release_confirm": False,
"alt_navigation": alt_navigation,
})
else:
bpy.ops.mesh.extrude_region_move(
'INVOKE_REGION_WIN',
TRANSFORM_OT_translate={
"release_confirm": False,
"alt_navigation": alt_navigation,
},
)
@ -167,7 +146,7 @@ class VIEW3D_OT_edit_mesh_extrude_move(Operator):
def execute(self, context):
return VIEW3D_OT_edit_mesh_extrude_move.extrude_region(
context, False, self.dissolve_and_intersect, self.alt_navigation)
context, False, self.dissolve_and_intersect)
def invoke(self, context, _event):
return self.execute(context)
@ -178,19 +157,13 @@ class VIEW3D_OT_edit_mesh_extrude_shrink_fatten(Operator):
bl_label = "Extrude and Move on Individual Normals"
bl_idname = "view3d.edit_mesh_extrude_move_shrink_fatten"
alt_navigation: BoolProperty(
name="alt_navigation",
default=False,
description="Transform Navigation with Alt",
)
@classmethod
def poll(cls, context):
obj = context.active_object
return (obj is not None and obj.mode == 'EDIT')
def execute(self, context):
return VIEW3D_OT_edit_mesh_extrude_move.extrude_region(context, True, False, self.alt_navigation)
return VIEW3D_OT_edit_mesh_extrude_move.extrude_region(context, True, False)
def invoke(self, context, _event):
return self.execute(context)
@ -201,12 +174,6 @@ class VIEW3D_OT_edit_mesh_extrude_manifold_normal(Operator):
bl_label = "Extrude Manifold Along Normals"
bl_idname = "view3d.edit_mesh_extrude_manifold_normal"
alt_navigation: BoolProperty(
name="alt_navigation",
default=False,
description="Transform Navigation with Alt",
)
@classmethod
def poll(cls, context):
obj = context.active_object
@ -222,7 +189,6 @@ class VIEW3D_OT_edit_mesh_extrude_manifold_normal(Operator):
"orient_type": 'NORMAL',
"constraint_axis": (False, False, True),
"release_confirm": False,
"alt_navigation": self.alt_navigation,
},
)
return {'FINISHED'}

View File

@ -8,7 +8,6 @@ import bpy
from bpy.types import (
Menu,
Operator,
bpy_prop_array,
)
from bpy.props import (
BoolProperty,
@ -35,7 +34,7 @@ def _rna_path_prop_search_for_context_impl(context, edit_text, unique_attrs):
line = context_prefix + edit_text
cursor = len(line)
namespace = {"context": context}
comp_prefix, _, comp_options = intellisense.expand(line=line, cursor=len(line), namespace=namespace, private=False)
comp_prefix, _, comp_options = intellisense.expand(line=line, cursor=cursor, namespace=namespace, private=False)
prefix = comp_prefix[len(context_prefix):] # Strip "context."
for attr in comp_options.split("\n"):
if attr.endswith((
@ -66,7 +65,6 @@ def rna_path_prop_search_for_context(self, context, edit_text):
# Users are very unlikely to be setting shortcuts in the preferences, skip this.
if area.type == 'PREFERENCES':
continue
space = area.spaces.active
# Ignore the same region type multiple times in an area.
# Prevents the 3D-viewport quad-view from attempting to expand 3 extra times for e.g.
region_type_unique = set()

View File

@ -662,7 +662,6 @@ class NODE_MT_geometry_node_add_all(Menu):
bl_label = ""
def draw(self, context):
snode = context.space_data
layout = self.layout
layout.menu("NODE_MT_geometry_node_GEO_ATTRIBUTE")
layout.menu("NODE_MT_geometry_node_GEO_INPUT")

View File

@ -47,7 +47,6 @@ class DATA_PT_grease_pencil_layers(DataButtonsPanel, Panel):
def draw(self, context):
layout = self.layout
ob = context.object
grease_pencil = context.grease_pencil
layer = grease_pencil.layers.active

View File

@ -228,7 +228,10 @@ class AddModifierMenu(Operator):
@classmethod
def poll(cls, context):
# NOTE: This operator only exists to add a poll to the add modifier shortcut in the property editor.
object = context.object
space = context.space_data
if object and object.type == 'GPENCIL':
return False
return space and space.type == 'PROPERTIES' and space.context == 'MODIFIER'
def invoke(self, context, event):

View File

@ -595,9 +595,6 @@ class EeveeRaytracingOptionsPanel(RenderButtonsPanel, Panel):
layout = self.layout
layout.use_property_split = True
scene = context.scene
eevee = scene.eevee
layout.prop(props, "resolution_scale")
layout.prop(props, "sample_clamp")

View File

@ -155,7 +155,7 @@ class VIEWLAYER_PT_eevee_layer_passes_light(ViewLayerButtonsPanel, Panel):
text="Ambient Occlusion")
class VIEWLAYER_PT_eevee_layer_passes_light(ViewLayerButtonsPanel, Panel):
class VIEWLAYER_PT_eevee_next_layer_passes_light(ViewLayerButtonsPanel, Panel):
bl_label = "Light"
bl_parent_id = "VIEWLAYER_PT_layer_passes"
COMPAT_ENGINES = {'BLENDER_EEVEE_NEXT'}
@ -335,6 +335,7 @@ classes = (
VIEWLAYER_PT_eevee_layer_passes_data,
VIEWLAYER_PT_eevee_next_layer_passes_data,
VIEWLAYER_PT_eevee_layer_passes_light,
VIEWLAYER_PT_eevee_next_layer_passes_light,
VIEWLAYER_PT_eevee_layer_passes_effects,
VIEWLAYER_PT_layer_passes_cryptomatte,
VIEWLAYER_PT_layer_passes_aov,

View File

@ -1200,14 +1200,10 @@ class VIEW3D_MT_transform_base:
# TODO: get rid of the custom text strings?
def draw(self, context):
layout = self.layout
alt_navigation = getattr(
context.window_manager.keyconfigs.active.preferences,
"use_alt_navigation",
False)
layout.operator("transform.translate").alt_navigation = alt_navigation
layout.operator("transform.rotate").alt_navigation = alt_navigation
layout.operator("transform.resize", text="Scale").alt_navigation = alt_navigation
layout.operator("transform.translate")
layout.operator("transform.rotate")
layout.operator("transform.resize", text="Scale")
layout.separator()
@ -1228,18 +1224,13 @@ class VIEW3D_MT_transform_base:
# Generic transform menu - geometry types
class VIEW3D_MT_transform(VIEW3D_MT_transform_base, Menu):
def draw(self, context):
alt_navigation = getattr(
context.window_manager.keyconfigs.active.preferences,
"use_alt_navigation",
False)
# base menu
VIEW3D_MT_transform_base.draw(self, context)
# generic...
layout = self.layout
if context.mode == 'EDIT_MESH':
layout.operator("transform.shrink_fatten", text="Shrink/Fatten").alt_navigation = alt_navigation
layout.operator("transform.shrink_fatten", text="Shrink/Fatten")
layout.operator("transform.skin_resize")
elif context.mode in ['EDIT_CURVE', 'EDIT_GREASE_PENCIL', 'EDIT_CURVES']:
layout.operator("transform.transform", text="Radius").mode = 'CURVE_SHRINKFATTEN'
@ -1248,10 +1239,8 @@ class VIEW3D_MT_transform(VIEW3D_MT_transform_base, Menu):
layout.separator()
props = layout.operator("transform.translate", text="Move Texture Space")
props.texture_space = True
props.alt_navigation = alt_navigation
props = layout.operator("transform.resize", text="Scale Texture Space")
props.texture_space = True
props.alt_navigation = alt_navigation
# Object-specific extensions to Transform menu
@ -1405,7 +1394,6 @@ class VIEW3D_MT_view(Menu):
def draw(self, context):
layout = self.layout
view = context.space_data
prefs = context.preferences
layout.prop(view, "show_region_toolbar")
layout.prop(view, "show_region_ui")
@ -4481,11 +4469,6 @@ class VIEW3D_MT_edit_mesh_context_menu(Menu):
col.operator("mesh.delete", text="Delete Edges").type = 'EDGE'
if is_face_mode:
alt_navigation = getattr(
context.window_manager.keyconfigs.active.preferences,
"use_alt_navigation",
False)
col = row.column(align=True)
col.label(text="Face", icon='FACESEL')
@ -4497,11 +4480,11 @@ class VIEW3D_MT_edit_mesh_context_menu(Menu):
col.separator()
col.operator("view3d.edit_mesh_extrude_move_normal",
text="Extrude Faces").alt_navigation = alt_navigation
text="Extrude Faces")
col.operator("view3d.edit_mesh_extrude_move_shrink_fatten",
text="Extrude Faces Along Normals").alt_navigation = alt_navigation
text="Extrude Faces Along Normals")
col.operator("mesh.extrude_faces_move",
text="Extrude Individual Faces").TRANSFORM_OT_shrink_fatten.alt_navigation = alt_navigation
text="Extrude Individual Faces")
col.operator("mesh.inset")
col.operator("mesh.poke")
@ -4553,11 +4536,6 @@ class VIEW3D_MT_edit_mesh_extrude(Menu):
def draw(self, context):
from math import pi
alt_navigation = getattr(
context.window_manager.keyconfigs.active.preferences,
"use_alt_navigation",
False)
layout = self.layout
layout.operator_context = 'INVOKE_REGION_WIN'
@ -4567,22 +4545,22 @@ class VIEW3D_MT_edit_mesh_extrude(Menu):
if mesh.total_face_sel:
layout.operator("view3d.edit_mesh_extrude_move_normal",
text="Extrude Faces").alt_navigation = alt_navigation
text="Extrude Faces")
layout.operator("view3d.edit_mesh_extrude_move_shrink_fatten",
text="Extrude Faces Along Normals").alt_navigation = alt_navigation
text="Extrude Faces Along Normals")
layout.operator(
"mesh.extrude_faces_move",
text="Extrude Individual Faces").TRANSFORM_OT_shrink_fatten.alt_navigation = alt_navigation
text="Extrude Individual Faces")
layout.operator("view3d.edit_mesh_extrude_manifold_normal",
text="Extrude Manifold").alt_navigation = alt_navigation
text="Extrude Manifold")
if mesh.total_edge_sel and (select_mode[0] or select_mode[1]):
layout.operator("mesh.extrude_edges_move",
text="Extrude Edges").TRANSFORM_OT_translate.alt_navigation = alt_navigation
text="Extrude Edges")
if mesh.total_vert_sel and select_mode[0]:
layout.operator("mesh.extrude_vertices_move",
text="Extrude Vertices").TRANSFORM_OT_translate.alt_navigation = alt_navigation
text="Extrude Vertices")
layout.separator()
@ -4741,22 +4719,15 @@ class VIEW3D_MT_edit_mesh_faces(Menu):
bl_idname = "VIEW3D_MT_edit_mesh_faces"
def draw(self, context):
alt_navigation = getattr(
context.window_manager.keyconfigs.active.preferences,
"use_alt_navigation",
False)
layout = self.layout
layout.operator_context = 'INVOKE_REGION_WIN'
layout.operator("view3d.edit_mesh_extrude_move_normal",
text="Extrude Faces").alt_navigation = alt_navigation
text="Extrude Faces")
layout.operator("view3d.edit_mesh_extrude_move_shrink_fatten",
text="Extrude Faces Along Normals").alt_navigation = alt_navigation
layout.operator(
"mesh.extrude_faces_move",
text="Extrude Individual Faces").TRANSFORM_OT_shrink_fatten.alt_navigation = alt_navigation
text="Extrude Faces Along Normals")
layout.operator("mesh.extrude_faces_move", text="Extrude Individual Faces")
layout.separator()

View File

@ -3,7 +3,6 @@
# SPDX-License-Identifier: GPL-2.0-or-later
import bpy
import nodeitems_utils
from nodeitems_utils import (
NodeCategory,
NodeItem,

View File

@ -366,39 +366,29 @@ static AnimationEvalContext nla_time_remap(const AnimationEvalContext *anim_eval
return *anim_eval_context;
}
/* Insert the specified keyframe value into a single F-Curve. */
static bool insert_keyframe_value(ReportList *reports,
PointerRNA *ptr,
PropertyRNA *prop,
FCurve *fcu,
const AnimationEvalContext *anim_eval_context,
float curval,
eBezTriple_KeyframeType keytype,
eInsertKeyFlags flag)
/* Adjust frame on which to add keyframe, to make it easier to add corrective drivers. */
static float remap_driver_frame(const AnimationEvalContext *anim_eval_context,
PointerRNA *ptr,
PropertyRNA *prop,
const FCurve *fcu)
{
if (BKE_fcurve_is_keyframable(fcu) == 0) {
BKE_reportf(
reports,
RPT_ERROR,
"F-Curve with path '%s[%d]' cannot be keyframed, ensure that it is not locked or sampled, "
"and try removing F-Modifiers",
fcu->rna_path,
fcu->array_index);
return false;
}
float cfra = anim_eval_context->eval_time;
PathResolvedRNA anim_rna;
if (RNA_path_resolved_create(ptr, prop, fcu->array_index, &anim_rna)) {
cfra = evaluate_driver(&anim_rna, fcu->driver, fcu->driver, anim_eval_context);
}
else {
cfra = 0.0f;
}
return cfra;
}
/* Adjust frame on which to add keyframe, to make it easier to add corrective drivers. */
if ((flag & INSERTKEY_DRIVER) && (fcu->driver)) {
PathResolvedRNA anim_rna;
if (RNA_path_resolved_create(ptr, prop, fcu->array_index, &anim_rna)) {
cfra = evaluate_driver(&anim_rna, fcu->driver, fcu->driver, anim_eval_context);
}
else {
cfra = 0.0f;
}
/* Insert the specified keyframe value into a single F-Curve. */
static bool insert_keyframe_value(
FCurve *fcu, float cfra, float curval, eBezTriple_KeyframeType keytype, eInsertKeyFlags flag)
{
if (!BKE_fcurve_is_keyframable(fcu)) {
return false;
}
/* Adjust coordinates for cycle aware insertion. */
@ -507,8 +497,22 @@ bool insert_keyframe_direct(ReportList *reports,
return false;
}
return insert_keyframe_value(
reports, &ptr, prop, fcu, anim_eval_context, current_value, keytype, flag);
float cfra = anim_eval_context->eval_time;
if ((flag & INSERTKEY_DRIVER) && (fcu->driver)) {
cfra = remap_driver_frame(anim_eval_context, &ptr, prop, fcu);
}
const bool success = insert_keyframe_value(fcu, cfra, current_value, keytype, flag);
if (!success) {
BKE_reportf(reports,
RPT_ERROR,
"Failed to insert keys on F-Curve with path '%s[%d]', ensure that it is not "
"locked or sampled, and try removing F-Modifiers",
fcu->rna_path,
fcu->array_index);
}
return success;
}
/** Find or create the FCurve based on the given path, and insert the specified value into it. */
@ -565,8 +569,21 @@ static bool insert_keyframe_fcurve_value(Main *bmain,
/* Update F-Curve flags to ensure proper behavior for property type. */
update_autoflags_fcurve_direct(fcu, prop);
const bool success = insert_keyframe_value(
reports, ptr, prop, fcu, anim_eval_context, curval, keytype, flag);
float cfra = anim_eval_context->eval_time;
if ((flag & INSERTKEY_DRIVER) && (fcu->driver)) {
cfra = remap_driver_frame(anim_eval_context, ptr, prop, fcu);
}
const bool success = insert_keyframe_value(fcu, cfra, curval, keytype, flag);
if (!success) {
BKE_reportf(reports,
RPT_ERROR,
"Failed to insert keys on F-Curve with path '%s[%d]', ensure that it is not "
"locked or sampled, and try removing F-Modifiers",
fcu->rna_path,
fcu->array_index);
}
/* If the curve is new, make it cyclic if appropriate. */
if (is_cyclic_action && is_new_curve) {

View File

@ -29,7 +29,7 @@ extern "C" {
/* Blender file format version. */
#define BLENDER_FILE_VERSION BLENDER_VERSION
#define BLENDER_FILE_SUBVERSION 5
#define BLENDER_FILE_SUBVERSION 6
/* Minimum Blender version that supports reading file written with the current
* version. Older Blender versions will test this and cancel loading the file, showing a warning to

View File

@ -100,14 +100,8 @@ BLI_INLINE PBVHType BKE_pbvh_type(const PBVH *pbvh)
return ((const struct PBVHPublic *)pbvh)->type;
}
#ifdef __cplusplus
extern "C" {
#endif
/* Needed by eevee_materias.c. */
/* Needed for the render engines integration. */
void BKE_pbvh_is_drawing_set(PBVH *pbvh, bool val);
/* Needed by `basic_engine.cc`. */
void BKE_pbvh_draw_debug_cb(PBVH *pbvh,
void (*draw_fn)(PBVHNode *node,
void *user_data,
@ -115,7 +109,3 @@ void BKE_pbvh_draw_debug_cb(PBVH *pbvh,
const float bmax[3],
PBVHNodeFlags flag),
void *user_data);
#ifdef __cplusplus
}
#endif /* extern "C" */

View File

@ -17,6 +17,7 @@
#include "BLI_function_ref.hh"
#include "BLI_math_vector_types.hh"
#include "BLI_offset_indices.hh"
#include "BLI_span.hh"
#include "BLI_vector.hh"
#include "DNA_customdata_types.h"
@ -64,7 +65,7 @@ struct ImageUser;
*/
struct PBVHProxyNode {
float (*co)[3];
blender::Vector<blender::float3> co;
};
struct PBVHColorBufferNode {
@ -407,6 +408,7 @@ void BKE_pbvh_node_num_verts(const PBVH *pbvh,
const PBVHNode *node,
int *r_uniquevert,
int *r_totvert);
int BKE_pbvh_node_num_unique_verts(const PBVH &pbvh, const PBVHNode &node);
blender::Span<int> BKE_pbvh_node_get_vert_indices(const PBVHNode *node);
blender::Span<int> BKE_pbvh_node_get_unique_vert_indices(const PBVHNode *node);
void BKE_pbvh_node_get_loops(PBVH *pbvh,
@ -607,9 +609,9 @@ void pbvh_vertex_iter_init(PBVH *pbvh, PBVHNode *node, PBVHVertexIter *vi, int m
#define PBVH_FACE_ITER_VERTS_RESERVED 8
void BKE_pbvh_node_get_proxies(PBVHNode *node, PBVHProxyNode **proxies, int *proxy_count);
blender::MutableSpan<PBVHProxyNode> BKE_pbvh_node_get_proxies(PBVHNode *node);
void BKE_pbvh_node_free_proxies(PBVHNode *node);
PBVHProxyNode *BKE_pbvh_node_add_proxy(PBVH *pbvh, PBVHNode *node);
PBVHProxyNode &BKE_pbvh_node_add_proxy(PBVH &pbvh, PBVHNode &node);
void BKE_pbvh_node_get_bm_orco_data(PBVHNode *node,
int (**r_orco_tris)[3],
int *r_orco_tris_num,

View File

@ -1451,7 +1451,7 @@ static void object_get_datamask(const Depsgraph *depsgraph,
*r_need_mapping = (editing || (ob->mode & (OB_MODE_WEIGHT_PAINT | OB_MODE_VERTEX_PAINT)));
}
/* check if we need tfaces & mcols due to face select or texture paint */
/* Check if we need #MTFace & loop-color due to face select or texture paint. */
if ((ob->mode & OB_MODE_TEXTURE_PAINT) || editing) {
r_mask->lmask |= CD_MASK_PROP_FLOAT2 | CD_MASK_PROP_BYTE_COLOR;
r_mask->fmask |= CD_MASK_MTFACE;

View File

@ -2044,6 +2044,20 @@ void BKE_pbvh_node_num_verts(const PBVH *pbvh,
}
}
int BKE_pbvh_node_num_unique_verts(const PBVH &pbvh, const PBVHNode &node)
{
switch (pbvh.header.type) {
case PBVH_GRIDS:
return node.prim_indices.size() * pbvh.gridkey.grid_area;
case PBVH_FACES:
return node.uniq_verts;
case PBVH_BMESH:
return node.bm_unique_verts.size();
}
BLI_assert_unreachable();
return 0;
}
void BKE_pbvh_node_get_grids(PBVH *pbvh,
PBVHNode *node,
const int **r_grid_indices,
@ -2103,24 +2117,9 @@ void BKE_pbvh_node_get_original_BB(PBVHNode *node, float bb_min[3], float bb_max
copy_v3_v3(bb_max, node->orig_vb.bmax);
}
void BKE_pbvh_node_get_proxies(PBVHNode *node, PBVHProxyNode **proxies, int *proxy_count)
blender::MutableSpan<PBVHProxyNode> BKE_pbvh_node_get_proxies(PBVHNode *node)
{
if (node->proxy_count > 0) {
if (proxies) {
*proxies = node->proxies;
}
if (proxy_count) {
*proxy_count = node->proxy_count;
}
}
else {
if (proxies) {
*proxies = nullptr;
}
if (proxy_count) {
*proxy_count = 0;
}
}
return node->proxies;
}
void BKE_pbvh_node_get_bm_orco_data(PBVHNode *node,
@ -3066,40 +3065,27 @@ bool BKE_pbvh_is_deformed(PBVH *pbvh)
}
/* Proxies */
PBVHProxyNode *BKE_pbvh_node_add_proxy(PBVH *pbvh, PBVHNode *node)
PBVHProxyNode &BKE_pbvh_node_add_proxy(PBVH &pbvh, PBVHNode &node)
{
int index, totverts;
node.proxies.append_as(PBVHProxyNode{});
index = node->proxy_count;
/* It is fine to access pointer of the back element, since node is never handled from multiple
* threads, and the brush handler only requests a single proxy from the node, and never holds
* pointers to multiple proxies. */
PBVHProxyNode &proxy_node = node.proxies.last();
node->proxy_count++;
const int num_unique_verts = BKE_pbvh_node_num_unique_verts(pbvh, node);
if (node->proxies) {
node->proxies = static_cast<PBVHProxyNode *>(
MEM_reallocN(node->proxies, node->proxy_count * sizeof(PBVHProxyNode)));
}
else {
node->proxies = static_cast<PBVHProxyNode *>(MEM_mallocN(sizeof(PBVHProxyNode), __func__));
}
/* Brushes expect proxies to be zero-initialized, so that they can do additive operation to them.
*/
proxy_node.co.resize(num_unique_verts, float3(0, 0, 0));
BKE_pbvh_node_num_verts(pbvh, node, &totverts, nullptr);
node->proxies[index].co = static_cast<float(*)[3]>(
MEM_callocN(sizeof(float[3]) * totverts, __func__));
return node->proxies + index;
return proxy_node;
}
void BKE_pbvh_node_free_proxies(PBVHNode *node)
{
for (int p = 0; p < node->proxy_count; p++) {
MEM_freeN(node->proxies[p].co);
node->proxies[p].co = nullptr;
}
MEM_freeN(node->proxies);
node->proxies = nullptr;
node->proxy_count = 0;
node->proxies.clear_and_shrink();
}
PBVHColorBufferNode *BKE_pbvh_node_color_buffer_get(PBVHNode *node)
@ -3479,7 +3465,7 @@ Vector<PBVHNode *> gather_proxies(PBVH *pbvh)
Vector<PBVHNode *> array;
for (PBVHNode &node : pbvh->nodes) {
if (node.proxy_count > 0) {
if (!node.proxies.is_empty()) {
array.append(&node);
}
}

View File

@ -105,8 +105,7 @@ struct PBVHNode {
/* Scalar displacements for sculpt mode's layer brush. */
float *layer_disp = nullptr;
int proxy_count = 0;
PBVHProxyNode *proxies = nullptr;
blender::Vector<PBVHProxyNode> proxies;
/* Dyntopo */

View File

@ -192,10 +192,10 @@ template<typename T> inline T safe_acos(const T &a)
return math::acos((a));
}
/** Faster/approximate version of `acosf`. Max error 4.51803e-5 (0.00258 degrees). */
/** Faster/approximate version of #safe_acos. Max error 4.51803e-5 (0.00258 degrees). */
inline float safe_acos_approx(float x)
{
const float f = fabsf(x);
const float f = std::abs(x);
/* Clamp and crush denormals. */
const float m = (f < 1.0f) ? 1.0f - (1.0f - f) : 1.0f;
/* Based on http://www.pouet.net/topic.php?which=9132&page=2
@ -205,9 +205,9 @@ inline float safe_acos_approx(float x)
* Examined 2130706434 values of `acos`:
* 15.2007108 avg ULP diff, 4492 max ULP, 4.51803e-05 max error // with "denormal crush".
*/
const float a = sqrtf(1.0f - m) *
const float a = std::sqrt(1.0f - m) *
(1.5707963267f + m * (-0.213300989f + m * (0.077980478f + m * -0.02164095f)));
return x < 0 ? (float)M_PI - a : a;
return x < 0.0f ? float(M_PI) - a : a;
}
template<typename T> inline T asin(const T &a)

View File

@ -382,6 +382,7 @@ set(SRC
BLI_voronoi_2d.h
BLI_voxel.h
BLI_winstuff.h
BLI_winstuff_com.hh
PIL_time.h
PIL_time_utildefines.h

View File

@ -90,26 +90,6 @@ static int vergscdata(const void *a1, const void *a2)
return 0;
}
static int vergpoly(const void *a1, const void *a2)
{
const PolyFill *x1 = a1, *x2 = a2;
if (x1->min_xy[0] > x2->min_xy[0]) {
return 1;
}
if (x1->min_xy[0] < x2->min_xy[0]) {
return -1;
}
if (x1->min_xy[1] > x2->min_xy[1]) {
return 1;
}
if (x1->min_xy[1] < x2->min_xy[1]) {
return -1;
}
return 0;
}
/* **** FILL ROUTINES *************************** */
ScanFillVert *BLI_scanfill_vert_add(ScanFillContext *sf_ctx, const float vec[3])
@ -169,7 +149,7 @@ static void addfillface(ScanFillContext *sf_ctx,
sf_tri->v3 = v3;
}
static bool boundisect(PolyFill *pf2, PolyFill *pf1)
static bool boundisect(const PolyFill *pf2, const PolyFill *pf1)
{
/* has pf2 been touched (intersected) by pf1 ? with bounding box */
/* test first if polys exist */
@ -192,24 +172,30 @@ static bool boundisect(PolyFill *pf2, PolyFill *pf1)
return false;
}
/* join */
if (pf2->max_xy[0] < pf1->max_xy[0]) {
pf2->max_xy[0] = pf1->max_xy[0];
}
if (pf2->max_xy[1] < pf1->max_xy[1]) {
pf2->max_xy[1] = pf1->max_xy[1];
}
if (pf2->min_xy[0] > pf1->min_xy[0]) {
pf2->min_xy[0] = pf1->min_xy[0];
}
if (pf2->min_xy[1] > pf1->min_xy[1]) {
pf2->min_xy[1] = pf1->min_xy[1];
}
return true;
}
static void fill_target_map_recursive(const PolyFill *__restrict pf_list,
const uint pf_len,
const uint pf_target,
const uint pf_test,
uint *__restrict target_map)
{
const PolyFill *pf_a = pf_list + pf_test;
for (uint pf_b_index = pf_target + 1; pf_b_index < pf_len; pf_b_index++) {
if (target_map[pf_b_index] != pf_b_index) {
/* All intersections have already been identified for this polygon. */
continue;
}
BLI_assert(pf_b_index != pf_test);
const PolyFill *pf_b = pf_list + pf_b_index;
if (boundisect(pf_a, pf_b)) {
target_map[pf_b_index] = pf_target;
fill_target_map_recursive(pf_list, pf_len, pf_target, pf_b_index, target_map);
}
}
}
/* add pf2 to pf1 */
static void mergepolysSimp(ScanFillContext *sf_ctx, PolyFill *pf1, PolyFill *pf2)
{
@ -229,10 +215,28 @@ static void mergepolysSimp(ScanFillContext *sf_ctx, PolyFill *pf1, PolyFill *pf2
}
}
/* Join. */
pf1->verts += pf2->verts;
pf1->edges += pf2->edges;
pf2->verts = pf2->edges = 0;
if (pf1->max_xy[0] < pf2->max_xy[0]) {
pf1->max_xy[0] = pf2->max_xy[0];
}
if (pf1->max_xy[1] < pf2->max_xy[1]) {
pf1->max_xy[1] = pf2->max_xy[1];
}
if (pf1->min_xy[0] > pf2->min_xy[0]) {
pf1->min_xy[0] = pf2->min_xy[0];
}
if (pf1->min_xy[1] > pf2->min_xy[1]) {
pf1->min_xy[1] = pf2->min_xy[1];
}
pf1->f = (pf1->f | pf2->f);
/* Clear the other one. */
pf2->verts = pf2->edges = 0;
}
static bool testedgeside(const float v1[2], const float v2[2], const float v3[2])
@ -832,7 +836,7 @@ uint BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const int flag, const float n
PolyFill *pflist, *pf;
float *min_xy_p, *max_xy_p;
uint totfaces = 0; /* total faces added */
ushort a, c, poly = 0;
ushort a, poly = 0;
bool ok;
float mat_2d[3][3];
@ -1073,15 +1077,9 @@ uint BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const int flag, const float n
/* STEP 4: FIND HOLES OR BOUNDS, JOIN THEM
* ( bounds just to divide it in pieces for optimization,
* the edgefill itself has good auto-hole detection)
* WATCH IT: ONLY WORKS WITH SORTED POLYS!!! */
* the edgefill itself has good auto-hole detection). */
if ((flag & BLI_SCANFILL_CALC_HOLES) && (poly > 1)) {
ushort *polycache, *pc;
/* so, sort first */
qsort(pflist, (size_t)poly, sizeof(PolyFill), vergpoly);
#if 0
pf = pflist;
for (a = 0; a < poly; a++) {
@ -1091,29 +1089,26 @@ uint BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const int flag, const float n
}
#endif
polycache = pc = MEM_callocN(sizeof(*polycache) * (size_t)poly, "polycache");
pf = pflist;
for (a = 0; a < poly; a++, pf++) {
for (c = (ushort)(a + 1); c < poly; c++) {
uint *target_map = MEM_mallocN(sizeof(*target_map) * (size_t)poly, "polycache");
range_vn_u(target_map, poly, 0);
/* If 'a' inside 'c': join (bounding-box too)
* Careful: 'a' can also be inside another poly. */
if (boundisect(pf, pflist + c)) {
*pc = c;
pc++;
}
#if 0
else if (pf->max_xy[0] < (pflist + c)->min[cox]) { /* Only for optimize! */
break;
}
#endif
for (a = 0; a < poly; a++) {
if (target_map[a] != a) {
continue;
}
while (pc != polycache) {
pc--;
mergepolysSimp(sf_ctx, pf, pflist + *pc);
fill_target_map_recursive(pflist, poly, a, a, target_map);
}
/* Join polygons. */
for (a = 0; a < poly; a++) {
if (target_map[a] != a) {
PolyFill *pf_src = pflist + a;
PolyFill *pf_dst = pflist + target_map[a];
mergepolysSimp(sf_ctx, pf_dst, pf_src);
}
}
MEM_freeN(polycache);
MEM_freeN(target_map);
}
#if 0

View File

@ -491,15 +491,6 @@ static void version_movieclips_legacy_camera_object(Main *bmain)
}
}
static void version_geometry_nodes_add_realize_instance_nodes(bNodeTree *ntree)
{
LISTBASE_FOREACH_MUTABLE (bNode *, node, &ntree->nodes) {
if (STREQ(node->idname, "GeometryNodeMeshBoolean")) {
add_realize_instances_before_socket(ntree, node, nodeFindSocket(node, SOCK_IN, "Mesh 2"));
}
}
}
/* Version VertexWeightEdit modifier to make existing weights exclusive of the threshold. */
static void version_vertex_weight_edit_preserve_threshold_exclusivity(Main *bmain)
{
@ -1201,14 +1192,6 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain)
}
}
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 400, 3)) {
LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
if (ntree->type == NTREE_GEOMETRY) {
version_geometry_nodes_add_realize_instance_nodes(ntree);
}
}
}
/* 400 4 did not require any do_version here. */
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 400, 5)) {
@ -1842,6 +1825,8 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain)
}
}
/* 401 6 did not require any do_version here. */
/**
* Versioning code until next subversion bump goes here.
*

View File

@ -130,7 +130,7 @@ static void do_versions_theme(const UserDef *userdef, bTheme *btheme)
}
if (!USER_VERSION_ATLEAST(400, 35)) {
memcpy(btheme, &U_theme_default, sizeof(*btheme));
FROM_DEFAULT_V4_UCHAR(tui.wcol_list_item.item);
}
if (!USER_VERSION_ATLEAST(401, 4)) {

View File

@ -345,8 +345,6 @@ if(WITH_COMPOSITOR_CPU)
operations/COM_GaussianXBlurOperation.h
operations/COM_GaussianYBlurOperation.cc
operations/COM_GaussianYBlurOperation.h
operations/COM_SummedAreaTableOperation.h
operations/COM_SummedAreaTableOperation.cc
operations/COM_KuwaharaAnisotropicOperation.cc
operations/COM_KuwaharaAnisotropicOperation.h
operations/COM_KuwaharaAnisotropicStructureTensorOperation.cc
@ -361,6 +359,8 @@ if(WITH_COMPOSITOR_CPU)
operations/COM_PosterizeOperation.h
operations/COM_SMAAOperation.cc
operations/COM_SMAAOperation.h
operations/COM_SummedAreaTableOperation.cc
operations/COM_SummedAreaTableOperation.h
operations/COM_VariableSizeBokehBlurOperation.cc
operations/COM_VariableSizeBokehBlurOperation.h
@ -666,8 +666,8 @@ if(WITH_COMPOSITOR_CPU)
tests/COM_BufferArea_test.cc
tests/COM_BufferRange_test.cc
tests/COM_BuffersIterator_test.cc
tests/COM_NodeOperation_test.cc
tests/COM_ComputeSummedAreaTableOperation_test.cc
tests/COM_NodeOperation_test.cc
)
set(TEST_INC
)

View File

@ -230,9 +230,9 @@ set(SRC
DRW_engine.h
DRW_pbvh.hh
DRW_select_buffer.hh
intern/attribute_convert.hh
intern/DRW_gpu_wrapper.hh
intern/DRW_render.h
intern/attribute_convert.hh
intern/draw_attributes.hh
intern/draw_cache.h
intern/draw_cache_extract.hh

View File

@ -49,7 +49,7 @@ void main()
}
view_clipping_distances_set(gl_in[i]);
EmitVertex();
gpu_EmitVertex();
}
EndPrimitive();
}

View File

@ -31,7 +31,7 @@ void main()
geom_iface.worldPosition = x_axis[geom_iface_flat.fFace] * vert_iface[v].vPos.x +
y_axis[geom_iface_flat.fFace] * vert_iface[v].vPos.y +
maj_axes[geom_iface_flat.fFace];
EmitVertex();
gpu_EmitVertex();
}
EndPrimitive();

View File

@ -11,13 +11,13 @@ void main()
lightprobe_geom_iface.layer = float(lightprobe_vert_iface_flat[0].instance);
gl_Position = vec4(lightprobe_vert_iface[0].vPos, 0.0, 1.0);
EmitVertex();
gpu_EmitVertex();
gl_Position = vec4(lightprobe_vert_iface[1].vPos, 0.0, 1.0);
EmitVertex();
gpu_EmitVertex();
gl_Position = vec4(lightprobe_vert_iface[2].vPos, 0.0, 1.0);
EmitVertex();
gpu_EmitVertex();
EndPrimitive();
}

View File

@ -27,7 +27,7 @@ void main()
PASS_SURFACE_INTERFACE(0);
gl_Position = gl_in[0].gl_Position;
gl_ClipDistance[0] = gl_in[0].gl_ClipDistance[0];
EmitVertex();
gpu_EmitVertex();
#ifdef USE_ATTR
pass_attr(1);
@ -35,7 +35,7 @@ void main()
PASS_SURFACE_INTERFACE(1);
gl_Position = gl_in[1].gl_Position;
gl_ClipDistance[0] = gl_in[1].gl_ClipDistance[0];
EmitVertex();
gpu_EmitVertex();
#ifdef USE_ATTR
pass_attr(2);
@ -43,7 +43,7 @@ void main()
PASS_SURFACE_INTERFACE(2);
gl_Position = gl_in[2].gl_Position;
gl_ClipDistance[0] = gl_in[2].gl_ClipDistance[0];
EmitVertex();
gpu_EmitVertex();
EndPrimitive();
}

View File

@ -16,19 +16,19 @@ void main()
pass_attr(0);
# endif
gl_Position = volumetric_vert_iface[0].vPos.xyww;
EmitVertex();
gpu_EmitVertex();
# ifdef USE_ATTR
pass_attr(1);
# endif
gl_Position = volumetric_vert_iface[1].vPos.xyww;
EmitVertex();
gpu_EmitVertex();
# ifdef USE_ATTR
pass_attr(2);
# endif
gl_Position = volumetric_vert_iface[2].vPos.xyww;
EmitVertex();
gpu_EmitVertex();
EndPrimitive();
}
@ -48,19 +48,19 @@ void main()
pass_attr(0);
# endif
gl_Position = volumetric_vert_iface[0].vPos.xyww;
EmitVertex();
gpu_EmitVertex();
# ifdef USE_ATTR
pass_attr(1);
# endif
gl_Position = volumetric_vert_iface[1].vPos.xyww;
EmitVertex();
gpu_EmitVertex();
# ifdef USE_ATTR
pass_attr(2);
# endif
gl_Position = volumetric_vert_iface[2].vPos.xyww;
EmitVertex();
gpu_EmitVertex();
EndPrimitive();
}

View File

@ -64,7 +64,7 @@ void main(void)
gl_Position.z -= (is_persp) ? 1e-4 : 1e-6;
edgeStart = edgePos = ((gl_Position.xy / gl_Position.w) * 0.5 + 0.5) * sizeViewport;
view_clipping_distances_set(gl_in[1]);
EmitVertex();
gpu_EmitVertex();
gl_Position = geom_in[2].pPos;
/* Offset away from the center to avoid overlap with solid shape. */
@ -73,7 +73,7 @@ void main(void)
gl_Position.z -= (is_persp) ? 1e-4 : 1e-6;
edgeStart = edgePos = ((gl_Position.xy / gl_Position.w) * 0.5 + 0.5) * sizeViewport.xy;
view_clipping_distances_set(gl_in[2]);
EmitVertex();
gpu_EmitVertex();
EndPrimitive();
}

View File

@ -12,12 +12,12 @@ void output_line(vec2 offset, vec4 color)
gl_Position = gl_in[0].gl_Position;
gl_Position.xy += offset * gl_in[0].gl_Position.w;
view_clipping_distances_set(gl_in[0]);
EmitVertex();
gpu_EmitVertex();
gl_Position = gl_in[1].gl_Position;
gl_Position.xy += offset * gl_in[1].gl_Position.w;
view_clipping_distances_set(gl_in[1]);
EmitVertex();
gpu_EmitVertex();
}
void main()

View File

@ -17,7 +17,7 @@ void do_vertex(vec4 color, vec4 pos, float coord, vec2 offset)
#if 0
view_clipping_distances_set(gl_in[i]);
#endif
EmitVertex();
gpu_EmitVertex();
}
void main()

View File

@ -15,7 +15,7 @@ void do_vertex(
gl_Position = pos;
/* Multiply offset by 2 because gl_Position range is [-1..1]. */
gl_Position.xy += offset * 2.0;
EmitVertex();
gpu_EmitVertex();
}
void main()

View File

@ -24,16 +24,16 @@ void main(void)
interp_out.color = interp_in[0].color;
t = edge_dir * (line_size * (is_persp ? gl_in[0].gl_Position.w : 1.0));
gl_Position = gl_in[0].gl_Position + vec4(t, 0.0, 0.0);
EmitVertex();
gpu_EmitVertex();
gl_Position = gl_in[0].gl_Position - vec4(t, 0.0, 0.0);
EmitVertex();
gpu_EmitVertex();
view_clipping_distances_set(gl_in[1]);
interp_out.color = interp_in[1].color;
t = edge_dir * (line_size * (is_persp ? gl_in[1].gl_Position.w : 1.0));
gl_Position = gl_in[1].gl_Position + vec4(t, 0.0, 0.0);
EmitVertex();
gpu_EmitVertex();
gl_Position = gl_in[1].gl_Position - vec4(t, 0.0, 0.0);
EmitVertex();
gpu_EmitVertex();
EndPrimitive();
}

View File

@ -41,10 +41,10 @@ void main()
// return;
vert_from_gl_in(1);
EmitVertex();
gpu_EmitVertex();
vert_from_gl_in(2);
EmitVertex();
gpu_EmitVertex();
EndPrimitive();
}

View File

@ -15,19 +15,19 @@ void emit_cap(const bool front, bool reversed)
{
if (front) {
gl_Position = vData[0].frontPosition;
EmitVertex();
gpu_EmitVertex();
gl_Position = vData[reversed ? 2 : 1].frontPosition;
EmitVertex();
gpu_EmitVertex();
gl_Position = vData[reversed ? 1 : 2].frontPosition;
EmitVertex();
gpu_EmitVertex();
}
else {
gl_Position = vData[0].backPosition;
EmitVertex();
gpu_EmitVertex();
gl_Position = vData[reversed ? 1 : 2].backPosition;
EmitVertex();
gpu_EmitVertex();
gl_Position = vData[reversed ? 2 : 1].backPosition;
EmitVertex();
gpu_EmitVertex();
}
EndPrimitive();
}

View File

@ -16,13 +16,13 @@ void extrude_edge(bool invert)
/* Reverse order if back-facing the light. */
ivec2 idx = (invert) ? ivec2(1, 2) : ivec2(2, 1);
gl_Position = vData[idx.x].frontPosition;
EmitVertex();
gpu_EmitVertex();
gl_Position = vData[idx.y].frontPosition;
EmitVertex();
gpu_EmitVertex();
gl_Position = vData[idx.x].backPosition;
EmitVertex();
gpu_EmitVertex();
gl_Position = vData[idx.y].backPosition;
EmitVertex();
gpu_EmitVertex();
EndPrimitive();
}

View File

@ -63,7 +63,9 @@
* \{ */
static bool get_normalized_fcurve_bounds(FCurve *fcu,
bAnimContext *ac,
AnimData *anim_data,
SpaceLink *space_link,
Scene *scene,
bAnimListElem *ale,
const bool include_handles,
const float range[2],
@ -77,11 +79,10 @@ static bool get_normalized_fcurve_bounds(FCurve *fcu,
return false;
}
const short mapping_flag = ANIM_get_normalization_flags(ac);
const short mapping_flag = ANIM_get_normalization_flags(space_link);
float offset;
const float unit_fac = ANIM_unit_mapping_get_factor(
ac->scene, ale->id, fcu, mapping_flag, &offset);
const float unit_fac = ANIM_unit_mapping_get_factor(scene, ale->id, fcu, mapping_flag, &offset);
r_bounds->ymin = (r_bounds->ymin + offset) * unit_fac;
r_bounds->ymax = (r_bounds->ymax + offset) * unit_fac;
@ -92,9 +93,8 @@ static bool get_normalized_fcurve_bounds(FCurve *fcu,
r_bounds->ymin -= (min_height - height) / 2;
r_bounds->ymax += (min_height - height) / 2;
}
AnimData *adt = ANIM_nla_mapping_get(ac, ale);
r_bounds->xmin = BKE_nla_tweakedit_remap(adt, r_bounds->xmin, NLATIME_CONVERT_MAP);
r_bounds->xmax = BKE_nla_tweakedit_remap(adt, r_bounds->xmax, NLATIME_CONVERT_MAP);
r_bounds->xmin = BKE_nla_tweakedit_remap(anim_data, r_bounds->xmin, NLATIME_CONVERT_MAP);
r_bounds->xmax = BKE_nla_tweakedit_remap(anim_data, r_bounds->xmax, NLATIME_CONVERT_MAP);
return true;
}
@ -140,7 +140,9 @@ static bool get_channel_bounds(bAnimContext *ac,
}
case ALE_FCURVE: {
FCurve *fcu = (FCurve *)ale->key_data;
found_bounds = get_normalized_fcurve_bounds(fcu, ac, ale, include_handles, range, r_bounds);
AnimData *anim_data = ANIM_nla_mapping_get(ac, ale);
found_bounds = get_normalized_fcurve_bounds(
fcu, anim_data, ac->sl, ac->scene, ale, include_handles, range, r_bounds);
break;
}
}

View File

@ -321,10 +321,10 @@ void ANIM_nla_mapping_apply_fcurve(AnimData *adt, FCurve *fcu, bool restore, boo
/* *************************************************** */
/* UNITS CONVERSION MAPPING (required for drawing and editing keyframes) */
short ANIM_get_normalization_flags(bAnimContext *ac)
short ANIM_get_normalization_flags(SpaceLink *space_link)
{
if (ac->sl->spacetype == SPACE_GRAPH) {
SpaceGraph *sipo = (SpaceGraph *)ac->sl;
if (space_link->spacetype == SPACE_GRAPH) {
SpaceGraph *sipo = (SpaceGraph *)space_link;
bool use_normalization = (sipo->flag & SIPO_NORMALIZE) != 0;
bool freeze_normalization = (sipo->flag & SIPO_NORMALIZE_FREEZE) != 0;
return use_normalization ? (ANIM_UNITCONV_NORMALIZE |

View File

@ -334,7 +334,6 @@ static int run_node_group_exec(bContext *C, wmOperator *op)
if (STR_ELEM(input->socket_type,
"NodeSocketObject",
"NodeSocketImage",
"NodeSocketGeometry",
"NodeSocketCollection",
"NodeSocketTexture",
"NodeSocketMaterial"))

View File

@ -923,6 +923,7 @@ void ED_nla_postop_refresh(bAnimContext *ac);
/** Flags for conversion mapping. */
enum eAnimUnitConv_Flags {
ANIM_UNITCONV_NONE = 0,
/** Restore to original internal values. */
ANIM_UNITCONV_RESTORE = (1 << 0),
/** Ignore handles (i.e. only touch main keyframes). */
@ -944,7 +945,7 @@ enum eAnimUnitConv_Flags {
/**
* Get flags used for normalization in ANIM_unit_mapping_get_factor.
*/
short ANIM_get_normalization_flags(bAnimContext *ac);
short ANIM_get_normalization_flags(SpaceLink *space_link);
/**
* Get unit conversion factor for given ID + F-Curve.
*/

View File

@ -121,9 +121,8 @@ int BIF_countTransformOrientation(const bContext *C);
#define P_CURSOR_EDIT (1 << 16)
#define P_CLNOR_INVALIDATE (1 << 17)
#define P_VIEW2D_EDGE_PAN (1 << 18)
#define P_VIEW3D_ALT_NAVIGATION (1 << 19)
/* For properties performed when confirming the transformation. */
#define P_POST_TRANSFORM (1 << 20)
#define P_POST_TRANSFORM (1 << 19)
void Transform_Properties(wmOperatorType *ot, int flags);

View File

@ -50,6 +50,7 @@ struct rctf;
struct rcti;
struct wmEvent;
struct wmGizmo;
struct wmKeyMapItem;
struct wmWindow;
struct wmWindowManager;
@ -212,7 +213,7 @@ bool ED_view3d_depth_unproject_v3(const ARegion *region,
*
* \note modal map events can also be used in `ED_view3d_navigation_do`.
*/
ViewOpsData *ED_view3d_navigation_init(bContext *C, const bool use_alt_navigation);
ViewOpsData *ED_view3d_navigation_init(bContext *C, const wmKeyMapItem *kmi_merge);
bool ED_view3d_navigation_do(bContext *C,
ViewOpsData *vod,
const wmEvent *event,

View File

@ -23,6 +23,7 @@
#include "BLI_math_geom.h"
#include "BLI_math_matrix.h"
#include "BLI_set.hh"
#include "BLI_span.hh"
#include "BLI_task.h"
#include "BLI_task.hh"
#include "BLI_utildefines.h"
@ -3297,7 +3298,7 @@ static void do_gravity_task(SculptSession *ss,
PBVHNode *node)
{
PBVHVertexIter vd;
float(*proxy)[3] = BKE_pbvh_node_add_proxy(ss->pbvh, node)->co;
const MutableSpan<float3> proxy = BKE_pbvh_node_add_proxy(*ss->pbvh, *node).co;
SculptBrushTest test;
SculptBrushTestFn sculpt_brush_test_sq_fn = SCULPT_brush_test_init_with_falloff_shape(
@ -3816,9 +3817,7 @@ static void sculpt_combine_proxies_node(Object &object,
(SCULPT_undo_push_node(&object, &node, SCULPT_UNDO_COORDS)->co.data()));
}
int proxy_count;
PBVHProxyNode *proxies;
BKE_pbvh_node_get_proxies(&node, &proxies, &proxy_count);
MutableSpan<PBVHProxyNode> proxies = BKE_pbvh_node_get_proxies(&node);
Mesh &mesh = *static_cast<Mesh *>(object.data);
MutableSpan<float3> positions = mesh.vert_positions_for_write();
@ -3839,8 +3838,8 @@ static void sculpt_combine_proxies_node(Object &object,
copy_v3_v3(val, vd.co);
}
for (int p = 0; p < proxy_count; p++) {
add_v3_v3(val, proxies[p].co[vd.i]);
for (const PBVHProxyNode &proxy_node : proxies) {
add_v3_v3(val, proxy_node.co[vd.i]);
}
SCULPT_clip(&sd, ss, vd.co, val);
@ -6176,7 +6175,6 @@ void SCULPT_fake_neighbors_free(Object *ob)
}
void SCULPT_automasking_node_begin(Object *ob,
const SculptSession * /*ss*/,
AutomaskingCache *automasking,
AutomaskingNodeData *automask_data,
PBVHNode *node)
@ -6186,7 +6184,6 @@ void SCULPT_automasking_node_begin(Object *ob,
return;
}
automask_data->node = node;
automask_data->have_orig_data = automasking->settings.flags &
(BRUSH_AUTOMASKING_BRUSH_NORMAL | BRUSH_AUTOMASKING_VIEW_NORMAL);
@ -6198,9 +6195,7 @@ void SCULPT_automasking_node_begin(Object *ob,
}
}
void SCULPT_automasking_node_update(SculptSession * /*ss*/,
AutomaskingNodeData *automask_data,
PBVHVertexIter *vd)
void SCULPT_automasking_node_update(AutomaskingNodeData *automask_data, PBVHVertexIter *vd)
{
if (automask_data->have_orig_data) {
SCULPT_orig_vert_data_update(&automask_data->orig_data, vd);

View File

@ -670,14 +670,14 @@ static void do_boundary_brush_bend_task(Object *ob, const Brush *brush, PBVHNode
}
const float angle = angle_factor * M_PI;
AutomaskingNodeData automask_data;
SCULPT_automasking_node_begin(ob, ss, ss->cache->automasking, &automask_data, node);
SCULPT_automasking_node_begin(ob, ss->cache->automasking, &automask_data, node);
BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
if (boundary->edit_info[vd.index].propagation_steps_num == -1) {
continue;
}
SCULPT_automasking_node_update(ss, &automask_data, &vd);
SCULPT_automasking_node_update(&automask_data, &vd);
SCULPT_orig_vert_data_update(&orig_data, &vd);
if (!SCULPT_check_vertex_pivot_symmetry(orig_data.co, boundary->initial_vertex_position, symm))
{
@ -718,14 +718,14 @@ static void do_boundary_brush_slide_task(Object *ob, const Brush *brush, PBVHNod
const float disp = sculpt_boundary_displacement_from_grab_delta_get(ss, boundary);
AutomaskingNodeData automask_data;
SCULPT_automasking_node_begin(ob, ss, ss->cache->automasking, &automask_data, node);
SCULPT_automasking_node_begin(ob, ss->cache->automasking, &automask_data, node);
BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
if (boundary->edit_info[vd.index].propagation_steps_num == -1) {
continue;
}
SCULPT_automasking_node_update(ss, &automask_data, &vd);
SCULPT_automasking_node_update(&automask_data, &vd);
SCULPT_orig_vert_data_update(&orig_data, &vd);
if (!SCULPT_check_vertex_pivot_symmetry(orig_data.co, boundary->initial_vertex_position, symm))
{
@ -762,7 +762,7 @@ static void do_boundary_brush_inflate_task(Object *ob, const Brush *brush, PBVHN
SculptOrigVertData orig_data;
SCULPT_orig_vert_data_init(&orig_data, ob, node, SCULPT_UNDO_COORDS);
AutomaskingNodeData automask_data;
SCULPT_automasking_node_begin(ob, ss, ss->cache->automasking, &automask_data, node);
SCULPT_automasking_node_begin(ob, ss->cache->automasking, &automask_data, node);
const float disp = sculpt_boundary_displacement_from_grab_delta_get(ss, boundary);
@ -771,7 +771,7 @@ static void do_boundary_brush_inflate_task(Object *ob, const Brush *brush, PBVHN
continue;
}
SCULPT_automasking_node_update(ss, &automask_data, &vd);
SCULPT_automasking_node_update(&automask_data, &vd);
SCULPT_orig_vert_data_update(&orig_data, &vd);
if (!SCULPT_check_vertex_pivot_symmetry(orig_data.co, boundary->initial_vertex_position, symm))
{
@ -808,14 +808,14 @@ static void do_boundary_brush_grab_task(Object *ob, const Brush *brush, PBVHNode
SculptOrigVertData orig_data;
SCULPT_orig_vert_data_init(&orig_data, ob, node, SCULPT_UNDO_COORDS);
AutomaskingNodeData automask_data;
SCULPT_automasking_node_begin(ob, ss, ss->cache->automasking, &automask_data, node);
SCULPT_automasking_node_begin(ob, ss->cache->automasking, &automask_data, node);
BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
if (boundary->edit_info[vd.index].propagation_steps_num == -1) {
continue;
}
SCULPT_automasking_node_update(ss, &automask_data, &vd);
SCULPT_automasking_node_update(&automask_data, &vd);
SCULPT_orig_vert_data_update(&orig_data, &vd);
if (!SCULPT_check_vertex_pivot_symmetry(orig_data.co, boundary->initial_vertex_position, symm))
{
@ -851,7 +851,7 @@ static void do_boundary_brush_twist_task(Object *ob, const Brush *brush, PBVHNod
SculptOrigVertData orig_data;
SCULPT_orig_vert_data_init(&orig_data, ob, node, SCULPT_UNDO_COORDS);
AutomaskingNodeData automask_data;
SCULPT_automasking_node_begin(ob, ss, ss->cache->automasking, &automask_data, node);
SCULPT_automasking_node_begin(ob, ss->cache->automasking, &automask_data, node);
const float disp = strength * sculpt_boundary_displacement_from_grab_delta_get(ss, boundary);
float angle_factor = disp / ss->cache->radius;
@ -866,7 +866,7 @@ static void do_boundary_brush_twist_task(Object *ob, const Brush *brush, PBVHNod
continue;
}
SCULPT_automasking_node_update(ss, &automask_data, &vd);
SCULPT_automasking_node_update(&automask_data, &vd);
SCULPT_orig_vert_data_update(&orig_data, &vd);
if (!SCULPT_check_vertex_pivot_symmetry(orig_data.co, boundary->initial_vertex_position, symm))
{

View File

@ -44,6 +44,8 @@
#include <cstdlib>
#include <cstring>
using blender::float3;
using blender::MutableSpan;
using blender::Span;
/* -------------------------------------------------------------------- */
@ -248,9 +250,7 @@ static void do_draw_brush_task(Object *ob, const Brush *brush, const float *offs
{
SculptSession *ss = ob->sculpt;
PBVHVertexIter vd;
float(*proxy)[3];
proxy = BKE_pbvh_node_add_proxy(ss->pbvh, node)->co;
const MutableSpan<float3> proxy = BKE_pbvh_node_add_proxy(*ss->pbvh, *node).co;
SculptBrushTest test;
SculptBrushTestFn sculpt_brush_test_sq_fn = SCULPT_brush_test_init_with_falloff_shape(
@ -258,14 +258,14 @@ static void do_draw_brush_task(Object *ob, const Brush *brush, const float *offs
const int thread_id = BLI_task_parallel_thread_id(nullptr);
AutomaskingNodeData automask_data;
SCULPT_automasking_node_begin(ob, ss, ss->cache->automasking, &automask_data, node);
SCULPT_automasking_node_begin(ob, ss->cache->automasking, &automask_data, node);
BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
if (!sculpt_brush_test_sq_fn(&test, vd.co)) {
continue;
}
SCULPT_automasking_node_update(ss, &automask_data, &vd);
SCULPT_automasking_node_update(&automask_data, &vd);
/* Offset vertex. */
if (ss->cache->brush->flag2 & BRUSH_USE_COLOR_AS_DISPLACEMENT &&
@ -344,11 +344,9 @@ static void do_fill_brush_task(
SculptSession *ss = ob->sculpt;
PBVHVertexIter vd;
float(*proxy)[3];
const MutableSpan<float3> proxy = BKE_pbvh_node_add_proxy(*ss->pbvh, *node).co;
const float bstrength = ss->cache->bstrength;
proxy = BKE_pbvh_node_add_proxy(ss->pbvh, node)->co;
SculptBrushTest test;
SculptBrushTestFn sculpt_brush_test_sq_fn = SCULPT_brush_test_init_with_falloff_shape(
ss, &test, brush->falloff_shape);
@ -357,7 +355,7 @@ static void do_fill_brush_task(
plane_from_point_normal_v3(test.plane_tool, area_co, area_no);
AutomaskingNodeData automask_data;
SCULPT_automasking_node_begin(ob, ss, ss->cache->automasking, &automask_data, node);
SCULPT_automasking_node_begin(ob, ss->cache->automasking, &automask_data, node);
BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
if (!sculpt_brush_test_sq_fn(&test, vd.co)) {
@ -377,7 +375,7 @@ static void do_fill_brush_task(
continue;
}
SCULPT_automasking_node_update(ss, &automask_data, &vd);
SCULPT_automasking_node_update(&automask_data, &vd);
const float fade = bstrength * SCULPT_brush_strength_factor(ss,
brush,
@ -438,11 +436,9 @@ static void do_scrape_brush_task(
SculptSession *ss = ob->sculpt;
PBVHVertexIter vd;
float(*proxy)[3];
const MutableSpan<float3> proxy = BKE_pbvh_node_add_proxy(*ss->pbvh, *node).co;
const float bstrength = ss->cache->bstrength;
proxy = BKE_pbvh_node_add_proxy(ss->pbvh, node)->co;
SculptBrushTest test;
SculptBrushTestFn sculpt_brush_test_sq_fn = SCULPT_brush_test_init_with_falloff_shape(
ss, &test, brush->falloff_shape);
@ -450,7 +446,7 @@ static void do_scrape_brush_task(
plane_from_point_normal_v3(test.plane_tool, area_co, area_no);
AutomaskingNodeData automask_data;
SCULPT_automasking_node_begin(ob, ss, ss->cache->automasking, &automask_data, node);
SCULPT_automasking_node_begin(ob, ss->cache->automasking, &automask_data, node);
BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
if (!sculpt_brush_test_sq_fn(&test, vd.co)) {
@ -470,7 +466,7 @@ static void do_scrape_brush_task(
continue;
}
SCULPT_automasking_node_update(ss, &automask_data, &vd);
SCULPT_automasking_node_update(&automask_data, &vd);
const float fade = bstrength * SCULPT_brush_strength_factor(ss,
brush,
@ -542,9 +538,7 @@ static void do_clay_thumb_brush_task(Object *ob,
SculptSession *ss = ob->sculpt;
PBVHVertexIter vd;
float(*proxy)[3];
proxy = BKE_pbvh_node_add_proxy(ss->pbvh, node)->co;
const MutableSpan<float3> proxy = BKE_pbvh_node_add_proxy(*ss->pbvh, *node).co;
SculptBrushTest test;
SculptBrushTestFn sculpt_brush_test_sq_fn = SCULPT_brush_test_init_with_falloff_shape(
@ -564,7 +558,7 @@ static void do_clay_thumb_brush_task(Object *ob,
plane_from_point_normal_v3(plane_tilt, area_co, normal_tilt);
AutomaskingNodeData automask_data;
SCULPT_automasking_node_begin(ob, ss, ss->cache->automasking, &automask_data, node);
SCULPT_automasking_node_begin(ob, ss->cache->automasking, &automask_data, node);
BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
if (!sculpt_brush_test_sq_fn(&test, vd.co)) {
@ -586,7 +580,7 @@ static void do_clay_thumb_brush_task(Object *ob,
interp_v3_v3v3(intr, intr, intr_tilt, tilt_mix);
sub_v3_v3v3(val, intr_tilt, vd.co);
SCULPT_automasking_node_update(ss, &automask_data, &vd);
SCULPT_automasking_node_update(&automask_data, &vd);
const float fade = bstrength * SCULPT_brush_strength_factor(ss,
brush,
@ -707,11 +701,9 @@ static void do_flatten_brush_task(
SculptSession *ss = ob->sculpt;
PBVHVertexIter vd;
float(*proxy)[3];
const MutableSpan<float3> proxy = BKE_pbvh_node_add_proxy(*ss->pbvh, *node).co;
const float bstrength = ss->cache->bstrength;
proxy = BKE_pbvh_node_add_proxy(ss->pbvh, node)->co;
SculptBrushTest test;
SculptBrushTestFn sculpt_brush_test_sq_fn = SCULPT_brush_test_init_with_falloff_shape(
ss, &test, brush->falloff_shape);
@ -720,7 +712,7 @@ static void do_flatten_brush_task(
plane_from_point_normal_v3(test.plane_tool, area_co, area_no);
AutomaskingNodeData automask_data;
SCULPT_automasking_node_begin(ob, ss, ss->cache->automasking, &automask_data, node);
SCULPT_automasking_node_begin(ob, ss->cache->automasking, &automask_data, node);
BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
if (!sculpt_brush_test_sq_fn(&test, vd.co)) {
@ -734,7 +726,7 @@ static void do_flatten_brush_task(
sub_v3_v3v3(val, intr, vd.co);
if (SCULPT_plane_trim(ss->cache, brush, val)) {
SCULPT_automasking_node_update(ss, &automask_data, &vd);
SCULPT_automasking_node_update(&automask_data, &vd);
const float fade = bstrength * SCULPT_brush_strength_factor(ss,
brush,
@ -848,11 +840,9 @@ static void do_clay_brush_task(
SculptSession *ss = ob->sculpt;
PBVHVertexIter vd;
float(*proxy)[3];
const MutableSpan<float3> proxy = BKE_pbvh_node_add_proxy(*ss->pbvh, *node).co;
const float bstrength = fabsf(ss->cache->bstrength);
proxy = BKE_pbvh_node_add_proxy(ss->pbvh, node)->co;
SculptBrushTest test;
SculptBrushTestFn sculpt_brush_test_sq_fn = SCULPT_brush_test_init_with_falloff_shape(
ss, &test, brush->falloff_shape);
@ -861,7 +851,7 @@ static void do_clay_brush_task(
plane_from_point_normal_v3(test.plane_tool, area_co, area_no);
AutomaskingNodeData automask_data;
SCULPT_automasking_node_begin(ob, ss, ss->cache->automasking, &automask_data, node);
SCULPT_automasking_node_begin(ob, ss->cache->automasking, &automask_data, node);
BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
if (!sculpt_brush_test_sq_fn(&test, vd.co)) {
@ -874,7 +864,7 @@ static void do_clay_brush_task(
sub_v3_v3v3(val, intr, vd.co);
SCULPT_automasking_node_update(ss, &automask_data, &vd);
SCULPT_automasking_node_update(&automask_data, &vd);
const float fade = bstrength * SCULPT_brush_strength_factor(ss,
brush,
@ -961,18 +951,16 @@ static void do_clay_strips_brush_task(Object *ob,
PBVHVertexIter vd;
SculptBrushTest test;
float(*proxy)[3];
const MutableSpan<float3> proxy = BKE_pbvh_node_add_proxy(*ss->pbvh, *node).co;
const bool flip = (ss->cache->bstrength < 0.0f);
const float bstrength = flip ? -ss->cache->bstrength : ss->cache->bstrength;
proxy = BKE_pbvh_node_add_proxy(ss->pbvh, node)->co;
SCULPT_brush_test_init(ss, &test);
plane_from_point_normal_v3(test.plane_tool, area_co, area_no_sp);
const int thread_id = BLI_task_parallel_thread_id(nullptr);
AutomaskingNodeData automask_data;
SCULPT_automasking_node_begin(ob, ss, ss->cache->automasking, &automask_data, node);
SCULPT_automasking_node_begin(ob, ss->cache->automasking, &automask_data, node);
BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
if (!SCULPT_brush_test_cube(&test, vd.co, mat, brush->tip_roundness, brush->tip_scale_x)) {
@ -992,7 +980,7 @@ static void do_clay_strips_brush_task(Object *ob,
continue;
}
SCULPT_automasking_node_update(ss, &automask_data, &vd);
SCULPT_automasking_node_update(&automask_data, &vd);
/* The normal from the vertices is ignored, it causes glitch with planes, see: #44390. */
const float fade = bstrength * SCULPT_brush_strength_factor(ss,
@ -1106,7 +1094,7 @@ static void do_snake_hook_brush_task(Object *ob,
SculptSession *ss = ob->sculpt;
PBVHVertexIter vd;
float(*proxy)[3];
const MutableSpan<float3> proxy = BKE_pbvh_node_add_proxy(*ss->pbvh, *node).co;
const float bstrength = ss->cache->bstrength;
const bool do_rake_rotation = ss->cache->is_rake_rotation_valid;
const bool do_pinch = (brush->crease_pinch_factor != 0.5f);
@ -1116,8 +1104,6 @@ static void do_snake_hook_brush_task(Object *ob,
const bool do_elastic = brush->snake_hook_deform_type == BRUSH_SNAKE_HOOK_DEFORM_ELASTIC;
proxy = BKE_pbvh_node_add_proxy(ss->pbvh, node)->co;
SculptBrushTest test;
SculptBrushTestFn sculpt_brush_test_sq_fn = SCULPT_brush_test_init_with_falloff_shape(
ss, &test, brush->falloff_shape);
@ -1127,7 +1113,7 @@ static void do_snake_hook_brush_task(Object *ob,
BKE_kelvinlet_init_params(&params, ss->cache->radius, bstrength, 1.0f, 0.4f);
AutomaskingNodeData automask_data;
SCULPT_automasking_node_begin(ob, ss, ss->cache->automasking, &automask_data, node);
SCULPT_automasking_node_begin(ob, ss->cache->automasking, &automask_data, node);
BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
if (!do_elastic && !sculpt_brush_test_sq_fn(&test, vd.co)) {
@ -1139,7 +1125,7 @@ static void do_snake_hook_brush_task(Object *ob,
fade = 1.0f;
}
else {
SCULPT_automasking_node_update(ss, &automask_data, &vd);
SCULPT_automasking_node_update(&automask_data, &vd);
fade = bstrength * SCULPT_brush_strength_factor(ss,
brush,
@ -1246,20 +1232,18 @@ static void do_thumb_brush_task(Object *ob, const Brush *brush, const float *con
PBVHVertexIter vd;
SculptOrigVertData orig_data;
float(*proxy)[3];
const MutableSpan<float3> proxy = BKE_pbvh_node_add_proxy(*ss->pbvh, *node).co;
const float bstrength = ss->cache->bstrength;
SCULPT_orig_vert_data_init(&orig_data, ob, node, SCULPT_UNDO_COORDS);
proxy = BKE_pbvh_node_add_proxy(ss->pbvh, node)->co;
SculptBrushTest test;
SculptBrushTestFn sculpt_brush_test_sq_fn = SCULPT_brush_test_init_with_falloff_shape(
ss, &test, brush->falloff_shape);
const int thread_id = BLI_task_parallel_thread_id(nullptr);
AutomaskingNodeData automask_data;
SCULPT_automasking_node_begin(ob, ss, ss->cache->automasking, &automask_data, node);
SCULPT_automasking_node_begin(ob, ss->cache->automasking, &automask_data, node);
BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
SCULPT_orig_vert_data_update(&orig_data, &vd);
@ -1267,7 +1251,7 @@ static void do_thumb_brush_task(Object *ob, const Brush *brush, const float *con
if (!sculpt_brush_test_sq_fn(&test, orig_data.co)) {
continue;
}
SCULPT_automasking_node_update(ss, &automask_data, &vd);
SCULPT_automasking_node_update(&automask_data, &vd);
const float fade = bstrength * SCULPT_brush_strength_factor(ss,
brush,
@ -1315,20 +1299,18 @@ static void do_rotate_brush_task(Object *ob, const Brush *brush, const float ang
PBVHVertexIter vd;
SculptOrigVertData orig_data;
float(*proxy)[3];
const MutableSpan<float3> proxy = BKE_pbvh_node_add_proxy(*ss->pbvh, *node).co;
const float bstrength = ss->cache->bstrength;
SCULPT_orig_vert_data_init(&orig_data, ob, node, SCULPT_UNDO_COORDS);
proxy = BKE_pbvh_node_add_proxy(ss->pbvh, node)->co;
SculptBrushTest test;
SculptBrushTestFn sculpt_brush_test_sq_fn = SCULPT_brush_test_init_with_falloff_shape(
ss, &test, brush->falloff_shape);
const int thread_id = BLI_task_parallel_thread_id(nullptr);
AutomaskingNodeData automask_data;
SCULPT_automasking_node_begin(ob, ss, ss->cache->automasking, &automask_data, node);
SCULPT_automasking_node_begin(ob, ss->cache->automasking, &automask_data, node);
BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
SCULPT_orig_vert_data_update(&orig_data, &vd);
@ -1337,7 +1319,7 @@ static void do_rotate_brush_task(Object *ob, const Brush *brush, const float ang
continue;
}
SCULPT_automasking_node_update(ss, &automask_data, &vd);
SCULPT_automasking_node_update(&automask_data, &vd);
float vec[3], rot[3][3];
const float fade = bstrength * SCULPT_brush_strength_factor(ss,
@ -1398,7 +1380,7 @@ static void do_layer_brush_task(Object *ob, Sculpt *sd, const Brush *brush, PBVH
const int thread_id = BLI_task_parallel_thread_id(nullptr);
AutomaskingNodeData automask_data;
SCULPT_automasking_node_begin(ob, ss, ss->cache->automasking, &automask_data, node);
SCULPT_automasking_node_begin(ob, ss->cache->automasking, &automask_data, node);
BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
SCULPT_orig_vert_data_update(&orig_data, &vd);
@ -1406,7 +1388,7 @@ static void do_layer_brush_task(Object *ob, Sculpt *sd, const Brush *brush, PBVH
if (!sculpt_brush_test_sq_fn(&test, orig_data.co)) {
continue;
}
SCULPT_automasking_node_update(ss, &automask_data, &vd);
SCULPT_automasking_node_update(&automask_data, &vd);
const float fade = SCULPT_brush_strength_factor(ss,
brush,
@ -1495,24 +1477,22 @@ static void do_inflate_brush_task(Object *ob, const Brush *brush, PBVHNode *node
SculptSession *ss = ob->sculpt;
PBVHVertexIter vd;
float(*proxy)[3];
const MutableSpan<float3> proxy = BKE_pbvh_node_add_proxy(*ss->pbvh, *node).co;
const float bstrength = ss->cache->bstrength;
proxy = BKE_pbvh_node_add_proxy(ss->pbvh, node)->co;
SculptBrushTest test;
SculptBrushTestFn sculpt_brush_test_sq_fn = SCULPT_brush_test_init_with_falloff_shape(
ss, &test, brush->falloff_shape);
const int thread_id = BLI_task_parallel_thread_id(nullptr);
AutomaskingNodeData automask_data;
SCULPT_automasking_node_begin(ob, ss, ss->cache->automasking, &automask_data, node);
SCULPT_automasking_node_begin(ob, ss->cache->automasking, &automask_data, node);
BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
if (!sculpt_brush_test_sq_fn(&test, vd.co)) {
continue;
}
SCULPT_automasking_node_update(ss, &automask_data, &vd);
SCULPT_automasking_node_update(&automask_data, &vd);
const float fade = bstrength * SCULPT_brush_strength_factor(ss,
brush,
@ -1560,24 +1540,22 @@ static void do_nudge_brush_task(Object *ob, const Brush *brush, const float *con
SculptSession *ss = ob->sculpt;
PBVHVertexIter vd;
float(*proxy)[3];
const MutableSpan<float3> proxy = BKE_pbvh_node_add_proxy(*ss->pbvh, *node).co;
const float bstrength = ss->cache->bstrength;
proxy = BKE_pbvh_node_add_proxy(ss->pbvh, node)->co;
SculptBrushTest test;
SculptBrushTestFn sculpt_brush_test_sq_fn = SCULPT_brush_test_init_with_falloff_shape(
ss, &test, brush->falloff_shape);
const int thread_id = BLI_task_parallel_thread_id(nullptr);
AutomaskingNodeData automask_data;
SCULPT_automasking_node_begin(ob, ss, ss->cache->automasking, &automask_data, node);
SCULPT_automasking_node_begin(ob, ss->cache->automasking, &automask_data, node);
BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
if (!sculpt_brush_test_sq_fn(&test, vd.co)) {
continue;
}
SCULPT_automasking_node_update(ss, &automask_data, &vd);
SCULPT_automasking_node_update(&automask_data, &vd);
const float fade = bstrength * SCULPT_brush_strength_factor(ss,
brush,
@ -1638,9 +1616,7 @@ static void do_crease_brush_task(Object *ob,
SculptSession *ss = ob->sculpt;
PBVHVertexIter vd;
float(*proxy)[3];
proxy = BKE_pbvh_node_add_proxy(ss->pbvh, node)->co;
const MutableSpan<float3> proxy = BKE_pbvh_node_add_proxy(*ss->pbvh, *node).co;
SculptBrushTest test;
SculptBrushTestFn sculpt_brush_test_sq_fn = SCULPT_brush_test_init_with_falloff_shape(
@ -1648,14 +1624,14 @@ static void do_crease_brush_task(Object *ob,
const int thread_id = BLI_task_parallel_thread_id(nullptr);
AutomaskingNodeData automask_data;
SCULPT_automasking_node_begin(ob, ss, ss->cache->automasking, &automask_data, node);
SCULPT_automasking_node_begin(ob, ss->cache->automasking, &automask_data, node);
BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
if (!sculpt_brush_test_sq_fn(&test, vd.co)) {
continue;
}
/* Offset vertex. */
SCULPT_automasking_node_update(ss, &automask_data, &vd);
SCULPT_automasking_node_update(&automask_data, &vd);
const float fade = SCULPT_brush_strength_factor(ss,
brush,
@ -1745,11 +1721,9 @@ static void do_pinch_brush_task(Object *ob,
SculptSession *ss = ob->sculpt;
PBVHVertexIter vd;
float(*proxy)[3];
const MutableSpan<float3> proxy = BKE_pbvh_node_add_proxy(*ss->pbvh, *node).co;
const float bstrength = ss->cache->bstrength;
proxy = BKE_pbvh_node_add_proxy(ss->pbvh, node)->co;
SculptBrushTest test;
SculptBrushTestFn sculpt_brush_test_sq_fn = SCULPT_brush_test_init_with_falloff_shape(
ss, &test, brush->falloff_shape);
@ -1761,13 +1735,13 @@ static void do_pinch_brush_task(Object *ob,
copy_v3_v3(z_object_space, stroke_xz[1]);
AutomaskingNodeData automask_data;
SCULPT_automasking_node_begin(ob, ss, ss->cache->automasking, &automask_data, node);
SCULPT_automasking_node_begin(ob, ss->cache->automasking, &automask_data, node);
BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
if (!sculpt_brush_test_sq_fn(&test, vd.co)) {
continue;
}
SCULPT_automasking_node_update(ss, &automask_data, &vd);
SCULPT_automasking_node_update(&automask_data, &vd);
const float fade = bstrength * SCULPT_brush_strength_factor(ss,
brush,
@ -1859,13 +1833,11 @@ static void do_grab_brush_task(Object *ob,
PBVHVertexIter vd;
SculptOrigVertData orig_data;
float(*proxy)[3];
const MutableSpan<float3> proxy = BKE_pbvh_node_add_proxy(*ss->pbvh, *node).co;
const float bstrength = ss->cache->bstrength;
SCULPT_orig_vert_data_init(&orig_data, ob, node, SCULPT_UNDO_COORDS);
proxy = BKE_pbvh_node_add_proxy(ss->pbvh, node)->co;
SculptBrushTest test;
SculptBrushTestFn sculpt_brush_test_sq_fn = SCULPT_brush_test_init_with_falloff_shape(
ss, &test, brush->falloff_shape);
@ -1874,7 +1846,7 @@ static void do_grab_brush_task(Object *ob,
const bool grab_silhouette = brush->flag2 & BRUSH_GRAB_SILHOUETTE;
AutomaskingNodeData automask_data;
SCULPT_automasking_node_begin(ob, ss, ss->cache->automasking, &automask_data, node);
SCULPT_automasking_node_begin(ob, ss->cache->automasking, &automask_data, node);
BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
SCULPT_orig_vert_data_update(&orig_data, &vd);
@ -1882,7 +1854,7 @@ static void do_grab_brush_task(Object *ob,
if (!sculpt_brush_test_sq_fn(&test, orig_data.co)) {
continue;
}
SCULPT_automasking_node_update(ss, &automask_data, &vd);
SCULPT_automasking_node_update(&automask_data, &vd);
float fade = bstrength * SCULPT_brush_strength_factor(ss,
brush,
@ -1945,15 +1917,13 @@ static void do_elastic_deform_brush_task(Object *ob,
PBVHVertexIter vd;
SculptOrigVertData orig_data;
float(*proxy)[3];
const MutableSpan<float3> proxy = BKE_pbvh_node_add_proxy(*ss->pbvh, *node).co;
const float bstrength = ss->cache->bstrength;
SCULPT_orig_vert_data_init(&orig_data, ob, node, SCULPT_UNDO_COORDS);
AutomaskingNodeData automask_data;
SCULPT_automasking_node_begin(ob, ss, ss->cache->automasking, &automask_data, node);
proxy = BKE_pbvh_node_add_proxy(ss->pbvh, node)->co;
SCULPT_automasking_node_begin(ob, ss->cache->automasking, &automask_data, node);
float dir;
if (ss->cache->mouse[0] > ss->cache->initial_mouse[0]) {
@ -1977,7 +1947,7 @@ static void do_elastic_deform_brush_task(Object *ob,
BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
SCULPT_orig_vert_data_update(&orig_data, &vd);
SCULPT_automasking_node_update(ss, &automask_data, &vd);
SCULPT_automasking_node_update(&automask_data, &vd);
float final_disp[3];
switch (brush->elastic_deform_type) {
@ -2055,19 +2025,17 @@ static void do_draw_sharp_brush_task(Object *ob,
PBVHVertexIter vd;
SculptOrigVertData orig_data;
float(*proxy)[3];
const MutableSpan<float3> proxy = BKE_pbvh_node_add_proxy(*ss->pbvh, *node).co;
SCULPT_orig_vert_data_init(&orig_data, ob, node, SCULPT_UNDO_COORDS);
proxy = BKE_pbvh_node_add_proxy(ss->pbvh, node)->co;
SculptBrushTest test;
SculptBrushTestFn sculpt_brush_test_sq_fn = SCULPT_brush_test_init_with_falloff_shape(
ss, &test, brush->falloff_shape);
const int thread_id = BLI_task_parallel_thread_id(nullptr);
AutomaskingNodeData automask_data;
SCULPT_automasking_node_begin(ob, ss, ss->cache->automasking, &automask_data, node);
SCULPT_automasking_node_begin(ob, ss->cache->automasking, &automask_data, node);
BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
SCULPT_orig_vert_data_update(&orig_data, &vd);
@ -2075,7 +2043,7 @@ static void do_draw_sharp_brush_task(Object *ob,
continue;
}
/* Offset vertex. */
SCULPT_automasking_node_update(ss, &automask_data, &vd);
SCULPT_automasking_node_update(&automask_data, &vd);
const float fade = SCULPT_brush_strength_factor(ss,
brush,
@ -2135,26 +2103,24 @@ static void do_topology_slide_task(Object *ob, const Brush *brush, PBVHNode *nod
PBVHVertexIter vd;
SculptOrigVertData orig_data;
float(*proxy)[3];
const MutableSpan<float3> proxy = BKE_pbvh_node_add_proxy(*ss->pbvh, *node).co;
SCULPT_orig_vert_data_init(&orig_data, ob, node, SCULPT_UNDO_COORDS);
proxy = BKE_pbvh_node_add_proxy(ss->pbvh, node)->co;
SculptBrushTest test;
SculptBrushTestFn sculpt_brush_test_sq_fn = SCULPT_brush_test_init_with_falloff_shape(
ss, &test, brush->falloff_shape);
const int thread_id = BLI_task_parallel_thread_id(nullptr);
AutomaskingNodeData automask_data;
SCULPT_automasking_node_begin(ob, ss, ss->cache->automasking, &automask_data, node);
SCULPT_automasking_node_begin(ob, ss->cache->automasking, &automask_data, node);
BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
SCULPT_orig_vert_data_update(&orig_data, &vd);
if (!sculpt_brush_test_sq_fn(&test, orig_data.co)) {
continue;
}
SCULPT_automasking_node_update(ss, &automask_data, &vd);
SCULPT_automasking_node_update(&automask_data, &vd);
const float fade = SCULPT_brush_strength_factor(ss,
brush,
@ -2299,7 +2265,10 @@ static void do_topology_relax_task(Object *ob, const Brush *brush, PBVHNode *nod
SCULPT_orig_vert_data_init(&orig_data, ob, node, SCULPT_UNDO_COORDS);
BKE_pbvh_node_add_proxy(ss->pbvh, node);
/* TODO(@sergey): This looks very suspicious: proxy is added but is never written.
* Either this needs to be documented better why it is needed, or removed. The removal is likely
* to lead to performance improvements as well. */
BKE_pbvh_node_add_proxy(*ss->pbvh, *node);
SculptBrushTest test;
SculptBrushTestFn sculpt_brush_test_sq_fn = SCULPT_brush_test_init_with_falloff_shape(
@ -2307,14 +2276,14 @@ static void do_topology_relax_task(Object *ob, const Brush *brush, PBVHNode *nod
const int thread_id = BLI_task_parallel_thread_id(nullptr);
AutomaskingNodeData automask_data;
SCULPT_automasking_node_begin(ob, ss, ss->cache->automasking, &automask_data, node);
SCULPT_automasking_node_begin(ob, ss->cache->automasking, &automask_data, node);
BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
SCULPT_orig_vert_data_update(&orig_data, &vd);
if (!sculpt_brush_test_sq_fn(&test, orig_data.co)) {
continue;
}
SCULPT_automasking_node_update(ss, &automask_data, &vd);
SCULPT_automasking_node_update(&automask_data, &vd);
const float fade = SCULPT_brush_strength_factor(ss,
brush,
@ -2379,7 +2348,7 @@ static void do_displacement_eraser_brush_task(Object *ob, const Brush *brush, PB
SculptSession *ss = ob->sculpt;
const float bstrength = clamp_f(ss->cache->bstrength, 0.0f, 1.0f);
float(*proxy)[3] = BKE_pbvh_node_add_proxy(ss->pbvh, node)->co;
const MutableSpan<float3> proxy = BKE_pbvh_node_add_proxy(*ss->pbvh, *node).co;
SculptBrushTest test;
SculptBrushTestFn sculpt_brush_test_sq_fn = SCULPT_brush_test_init_with_falloff_shape(
@ -2387,14 +2356,14 @@ static void do_displacement_eraser_brush_task(Object *ob, const Brush *brush, PB
const int thread_id = BLI_task_parallel_thread_id(nullptr);
AutomaskingNodeData automask_data;
SCULPT_automasking_node_begin(ob, ss, ss->cache->automasking, &automask_data, node);
SCULPT_automasking_node_begin(ob, ss->cache->automasking, &automask_data, node);
PBVHVertexIter vd;
BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
if (!sculpt_brush_test_sq_fn(&test, vd.co)) {
continue;
}
SCULPT_automasking_node_update(ss, &automask_data, &vd);
SCULPT_automasking_node_update(&automask_data, &vd);
const float fade = bstrength * SCULPT_brush_strength_factor(ss,
brush,
@ -2450,14 +2419,14 @@ static void do_displacement_smear_brush_task(Object *ob, const Brush *brush, PBV
const int thread_id = BLI_task_parallel_thread_id(nullptr);
AutomaskingNodeData automask_data;
SCULPT_automasking_node_begin(ob, ss, ss->cache->automasking, &automask_data, node);
SCULPT_automasking_node_begin(ob, ss->cache->automasking, &automask_data, node);
PBVHVertexIter vd;
BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
if (!sculpt_brush_test_sq_fn(&test, vd.co)) {
continue;
}
SCULPT_automasking_node_update(ss, &automask_data, &vd);
SCULPT_automasking_node_update(&automask_data, &vd);
const float fade = bstrength * SCULPT_brush_strength_factor(ss,
brush,
@ -2609,14 +2578,14 @@ static void do_topology_rake_bmesh_task(
const int thread_id = BLI_task_parallel_thread_id(nullptr);
AutomaskingNodeData automask_data;
SCULPT_automasking_node_begin(ob, ss, ss->cache->automasking, &automask_data, node);
SCULPT_automasking_node_begin(ob, ss->cache->automasking, &automask_data, node);
PBVHVertexIter vd;
BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
if (!sculpt_brush_test_sq_fn(&test, vd.co)) {
continue;
}
SCULPT_automasking_node_update(ss, &automask_data, &vd);
SCULPT_automasking_node_update(&automask_data, &vd);
const float fade = bstrength *
SCULPT_brush_strength_factor(ss,
@ -2692,14 +2661,14 @@ static void do_mask_brush_draw_task(Object *ob,
const int thread_id = BLI_task_parallel_thread_id(nullptr);
AutomaskingNodeData automask_data;
SCULPT_automasking_node_begin(ob, ss, ss->cache->automasking, &automask_data, node);
SCULPT_automasking_node_begin(ob, ss->cache->automasking, &automask_data, node);
BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
if (!sculpt_brush_test_sq_fn(&test, vd.co)) {
continue;
}
SCULPT_automasking_node_update(ss, &automask_data, &vd);
SCULPT_automasking_node_update(&automask_data, &vd);
const float fade = SCULPT_brush_strength_factor(ss,
brush,
vd.co,

View File

@ -470,11 +470,10 @@ static void do_cloth_brush_apply_forces_task(Object *ob,
}
AutomaskingNodeData automask_data;
SCULPT_automasking_node_begin(
ob, ss, SCULPT_automasking_active_cache_get(ss), &automask_data, node);
SCULPT_automasking_node_begin(ob, SCULPT_automasking_active_cache_get(ss), &automask_data, node);
BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
SCULPT_automasking_node_update(ss, &automask_data, &vd);
SCULPT_automasking_node_update(&automask_data, &vd);
float force[3];
float sim_location[3];
@ -735,11 +734,10 @@ static void do_cloth_brush_solve_simulation_task(Object *ob,
AutomaskingCache *automasking = SCULPT_automasking_active_cache_get(ss);
AutomaskingNodeData automask_data;
SCULPT_automasking_node_begin(
ob, ss, SCULPT_automasking_active_cache_get(ss), &automask_data, node);
SCULPT_automasking_node_begin(ob, SCULPT_automasking_active_cache_get(ss), &automask_data, node);
BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
SCULPT_automasking_node_update(ss, &automask_data, &vd);
SCULPT_automasking_node_update(&automask_data, &vd);
float sim_location[3];
cloth_brush_simulation_location_get(ss, brush, sim_location);
@ -795,7 +793,7 @@ static void cloth_brush_satisfy_constraints(SculptSession *ss,
{
AutomaskingCache *automasking = SCULPT_automasking_active_cache_get(ss);
AutomaskingNodeData automask_data = {nullptr};
AutomaskingNodeData automask_data{};
automask_data.have_orig_data = true;
@ -1377,12 +1375,11 @@ static void cloth_filter_apply_forces_task(Object *ob,
}
mul_v3_fl(sculpt_gravity, sd->gravity_factor * filter_strength);
AutomaskingNodeData automask_data;
SCULPT_automasking_node_begin(
ob, ss, SCULPT_automasking_active_cache_get(ss), &automask_data, node);
SCULPT_automasking_node_begin(ob, SCULPT_automasking_active_cache_get(ss), &automask_data, node);
PBVHVertexIter vd;
BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
SCULPT_automasking_node_update(ss, &automask_data, &vd);
SCULPT_automasking_node_update(&automask_data, &vd);
float fade = vd.mask;
fade *= SCULPT_automasking_factor_get(

View File

@ -135,13 +135,13 @@ static void do_draw_face_sets_brush_faces(Object *ob, const Brush *brush, PBVHNo
SCULPT_vertex_count_get(ss));
AutomaskingNodeData automask_data;
SCULPT_automasking_node_begin(ob, ss, ss->cache->automasking, &automask_data, node);
SCULPT_automasking_node_begin(ob, ss->cache->automasking, &automask_data, node);
bool changed = false;
PBVHVertexIter vd;
BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
SCULPT_automasking_node_update(ss, &automask_data, &vd);
SCULPT_automasking_node_update(&automask_data, &vd);
for (const int face_i : ss->pmap[vd.index]) {
const blender::IndexRange face = ss->faces[face_i];
@ -196,13 +196,13 @@ static void do_draw_face_sets_brush_grids(Object *ob, const Brush *brush, PBVHNo
ss, &test, brush->falloff_shape);
AutomaskingNodeData automask_data;
SCULPT_automasking_node_begin(ob, ss, ss->cache->automasking, &automask_data, node);
SCULPT_automasking_node_begin(ob, ss->cache->automasking, &automask_data, node);
bool changed = false;
PBVHVertexIter vd;
BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
SCULPT_automasking_node_update(ss, &automask_data, &vd);
SCULPT_automasking_node_update(&automask_data, &vd);
if (!sculpt_brush_test_sq_fn(&test, vd.co)) {
continue;
@ -256,7 +256,7 @@ static void do_draw_face_sets_brush_bmesh(Object *ob, const Brush *brush, PBVHNo
* Do it locally here for the Draw Face Set brush here, to mimic the behavior of the other
* brushes but without marking the brush as supporting dynamic topology. */
AutomaskingNodeData automask_data;
SCULPT_automasking_node_begin(ob, ss, nullptr, &automask_data, node);
SCULPT_automasking_node_begin(ob, nullptr, &automask_data, node);
bool changed = false;
@ -286,7 +286,7 @@ static void do_draw_face_sets_brush_bmesh(Object *ob, const Brush *brush, PBVHNo
* typical code flow for it here for the reference, and ease of looking at what needs to be
* done for such integration.
*
* SCULPT_automasking_node_update(ss, &automask_data, &vd); */
* SCULPT_automasking_node_update(&automask_data, &vd); */
const float fade = bstrength *
SCULPT_brush_strength_factor(ss,
@ -358,10 +358,10 @@ static void do_relax_face_sets_brush_task(Object *ob,
const int thread_id = BLI_task_parallel_thread_id(nullptr);
AutomaskingNodeData automask_data;
SCULPT_automasking_node_begin(ob, ss, ss->cache->automasking, &automask_data, node);
SCULPT_automasking_node_begin(ob, ss->cache->automasking, &automask_data, node);
BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
SCULPT_automasking_node_update(ss, &automask_data, &vd);
SCULPT_automasking_node_update(&automask_data, &vd);
if (!sculpt_brush_test_sq_fn(&test, vd.co)) {
continue;

View File

@ -84,12 +84,12 @@ static void color_filter_task(Object *ob,
SCULPT_orig_vert_data_init(&orig_data, ob, node, SCULPT_UNDO_COLOR);
AutomaskingNodeData automask_data;
SCULPT_automasking_node_begin(ob, ss, ss->filter_cache->automasking, &automask_data, node);
SCULPT_automasking_node_begin(ob, ss->filter_cache->automasking, &automask_data, node);
PBVHVertexIter vd;
BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
SCULPT_orig_vert_data_update(&orig_data, &vd);
SCULPT_automasking_node_update(ss, &automask_data, &vd);
SCULPT_automasking_node_update(&automask_data, &vd);
float orig_color[3], final_color[4], hsv_color[3];
int hue;

View File

@ -363,12 +363,12 @@ static void mesh_filter_task(Object *ob,
* boundaries. */
const bool relax_face_sets = !(ss->filter_cache->iteration_count % 3 == 0);
AutomaskingNodeData automask_data;
SCULPT_automasking_node_begin(ob, ss, ss->filter_cache->automasking, &automask_data, node);
SCULPT_automasking_node_begin(ob, ss->filter_cache->automasking, &automask_data, node);
PBVHVertexIter vd;
BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
SCULPT_orig_vert_data_update(&orig_data, &vd);
SCULPT_automasking_node_update(ss, &automask_data, &vd);
SCULPT_automasking_node_update(&automask_data, &vd);
float orig_co[3], val[3], avg[3], disp[3], disp2[3], transform[3][3], final_pos[3];
float fade = vd.mask;
@ -664,10 +664,10 @@ static void mesh_filter_surface_smooth_displace_task(Object *ob,
PBVHVertexIter vd;
AutomaskingNodeData automask_data;
SCULPT_automasking_node_begin(ob, ss, ss->filter_cache->automasking, &automask_data, node);
SCULPT_automasking_node_begin(ob, ss->filter_cache->automasking, &automask_data, node);
BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
SCULPT_automasking_node_update(ss, &automask_data, &vd);
SCULPT_automasking_node_update(&automask_data, &vd);
float fade = vd.mask;
fade = 1.0f - fade;

View File

@ -1269,7 +1269,6 @@ enum eDynTopoWarnFlag SCULPT_dynamic_topology_check(Scene *scene, Object *ob);
* \{ */
struct AutomaskingNodeData {
PBVHNode *node;
SculptOrigVertData orig_data;
bool have_orig_data;
};
@ -1279,15 +1278,12 @@ struct AutomaskingNodeData {
* \param automask_data: pointer to an uninitialized #AutomaskingNodeData struct.
*/
void SCULPT_automasking_node_begin(Object *ob,
const SculptSession *ss,
AutomaskingCache *automasking,
AutomaskingNodeData *automask_data,
PBVHNode *node);
/* Call before SCULPT_automasking_factor_get and SCULPT_brush_strength_factor. */
void SCULPT_automasking_node_update(SculptSession *ss,
AutomaskingNodeData *automask_data,
PBVHVertexIter *vd);
void SCULPT_automasking_node_update(AutomaskingNodeData *automask_data, PBVHVertexIter *vd);
float SCULPT_automasking_factor_get(AutomaskingCache *automasking,
SculptSession *ss,

View File

@ -8,6 +8,8 @@
#include "BLI_math_matrix.h"
#include "BLI_math_rotation.h"
#include "BLI_math_vector_types.hh"
#include "BLI_span.hh"
#include "BLI_task.h"
#include "DNA_brush_types.h"
@ -29,6 +31,9 @@
#include <cmath>
#include <cstdlib>
using blender::float3;
using blender::MutableSpan;
struct MultiplaneScrapeSampleData {
float area_cos[2][3];
float area_nos[2][3];
@ -56,7 +61,7 @@ static void calc_multiplane_scrape_surface_task(Object *ob,
test.radius_squared = test_radius * test_radius;
AutomaskingNodeData automask_data;
SCULPT_automasking_node_begin(ob, ss, ss->cache->automasking, &automask_data, node);
SCULPT_automasking_node_begin(ob, ss->cache->automasking, &automask_data, node);
BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
@ -68,7 +73,7 @@ static void calc_multiplane_scrape_surface_task(Object *ob,
copy_v3_v3(normal, vd.no ? vd.no : vd.fno);
mul_v3_m4v3(local_co, mat, vd.co);
SCULPT_automasking_node_update(ss, &automask_data, &vd);
SCULPT_automasking_node_update(&automask_data, &vd);
/* Use the brush falloff to weight the sampled normals. */
const float fade = SCULPT_brush_strength_factor(ss,
@ -107,18 +112,16 @@ static void do_multiplane_scrape_brush_task(Object *ob,
SculptSession *ss = ob->sculpt;
PBVHVertexIter vd;
float(*proxy)[3];
const MutableSpan<float3> proxy = BKE_pbvh_node_add_proxy(*ss->pbvh, *node).co;
const float bstrength = fabsf(ss->cache->bstrength);
proxy = BKE_pbvh_node_add_proxy(ss->pbvh, node)->co;
SculptBrushTest test;
SculptBrushTestFn sculpt_brush_test_sq_fn = SCULPT_brush_test_init_with_falloff_shape(
ss, &test, brush->falloff_shape);
const int thread_id = BLI_task_parallel_thread_id(nullptr);
AutomaskingNodeData automask_data;
SCULPT_automasking_node_begin(ob, ss, ss->cache->automasking, &automask_data, node);
SCULPT_automasking_node_begin(ob, ss->cache->automasking, &automask_data, node);
BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
@ -161,7 +164,7 @@ static void do_multiplane_scrape_brush_task(Object *ob,
continue;
}
SCULPT_automasking_node_update(ss, &automask_data, &vd);
SCULPT_automasking_node_update(&automask_data, &vd);
/* Deform the local space along the Y axis to avoid artifacts on curved strokes. */
/* This produces a not round brush tip. */

View File

@ -1014,10 +1014,10 @@ static void sculpt_bake_cavity_exec_task(Object *ob,
SCULPT_undo_push_node(ob, node, SCULPT_UNDO_MASK);
AutomaskingNodeData automask_data;
SCULPT_automasking_node_begin(ob, ss, automasking, &automask_data, node);
SCULPT_automasking_node_begin(ob, automasking, &automask_data, node);
BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
SCULPT_automasking_node_update(ss, &automask_data, &vd);
SCULPT_automasking_node_update(&automask_data, &vd);
float automask = SCULPT_automasking_factor_get(automasking, ss, vd.vertex, &automask_data);
float mask;

View File

@ -48,14 +48,14 @@ static void do_color_smooth_task(Object *ob, const Brush *brush, PBVHNode *node)
const int thread_id = BLI_task_parallel_thread_id(nullptr);
AutomaskingNodeData automask_data;
SCULPT_automasking_node_begin(ob, ss, ss->cache->automasking, &automask_data, node);
SCULPT_automasking_node_begin(ob, ss->cache->automasking, &automask_data, node);
BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
if (!sculpt_brush_test_sq_fn(&test, vd.co)) {
continue;
}
SCULPT_automasking_node_update(ss, &automask_data, &vd);
SCULPT_automasking_node_update(&automask_data, &vd);
const float fade = bstrength * SCULPT_brush_strength_factor(ss,
brush,
@ -110,7 +110,7 @@ static void do_paint_brush_task(Object *ob,
IMB_colormanagement_srgb_to_scene_linear_v3(brush_color, brush_color);
AutomaskingNodeData automask_data;
SCULPT_automasking_node_begin(ob, ss, ss->cache->automasking, &automask_data, node);
SCULPT_automasking_node_begin(ob, ss->cache->automasking, &automask_data, node);
if (brush->flag & BRUSH_USE_GRADIENT) {
switch (brush->gradient_stroke_mode) {
@ -149,7 +149,7 @@ static void do_paint_brush_task(Object *ob,
continue;
}
SCULPT_automasking_node_update(ss, &automask_data, &vd);
SCULPT_automasking_node_update(&automask_data, &vd);
float fade = bstrength * SCULPT_brush_strength_factor(ss,
brush,
@ -352,14 +352,14 @@ static void do_smear_brush_task(Object *ob, const Brush *brush, PBVHNode *node)
}
AutomaskingNodeData automask_data;
SCULPT_automasking_node_begin(ob, ss, ss->cache->automasking, &automask_data, node);
SCULPT_automasking_node_begin(ob, ss->cache->automasking, &automask_data, node);
BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
if (!sculpt_brush_test_sq_fn(&test, vd.co)) {
continue;
}
SCULPT_automasking_node_update(ss, &automask_data, &vd);
SCULPT_automasking_node_update(&automask_data, &vd);
const float fade = bstrength * SCULPT_brush_strength_factor(ss,
brush,

View File

@ -368,7 +368,7 @@ static void do_paint_pixels(void *__restrict userdata,
brush_color[3] = 1.0f;
AutomaskingNodeData automask_data;
SCULPT_automasking_node_begin(ob, ss, ss->cache->automasking, &automask_data, data->nodes[n]);
SCULPT_automasking_node_begin(ob, ss->cache->automasking, &automask_data, data->nodes[n]);
ImageUser image_user = *data->image_data.image_user;
bool pixels_updated = false;

View File

@ -150,11 +150,11 @@ static void do_pose_brush_task(Object *ob, const Brush *brush, PBVHNode *node)
SculptOrigVertData orig_data;
SCULPT_orig_vert_data_init(&orig_data, ob, node, SCULPT_UNDO_COORDS);
AutomaskingNodeData automask_data;
SCULPT_automasking_node_begin(ob, ss, ss->cache->automasking, &automask_data, node);
SCULPT_automasking_node_begin(ob, ss->cache->automasking, &automask_data, node);
BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
SCULPT_orig_vert_data_update(&orig_data, &vd);
SCULPT_automasking_node_update(ss, &automask_data, &vd);
SCULPT_automasking_node_update(&automask_data, &vd);
float total_disp[3];
zero_v3(total_disp);

View File

@ -195,14 +195,14 @@ static void do_enhance_details_brush_task(Object *ob,
const int thread_id = BLI_task_parallel_thread_id(nullptr);
AutomaskingNodeData automask_data;
SCULPT_automasking_node_begin(ob, ss, ss->cache->automasking, &automask_data, node);
SCULPT_automasking_node_begin(ob, ss->cache->automasking, &automask_data, node);
BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
if (!sculpt_brush_test_sq_fn(&test, vd.co)) {
continue;
}
SCULPT_automasking_node_update(ss, &automask_data, &vd);
SCULPT_automasking_node_update(&automask_data, &vd);
const float fade = bstrength * SCULPT_brush_strength_factor(ss,
brush,
@ -276,14 +276,14 @@ static void do_smooth_brush_task(Object *ob,
const int thread_id = BLI_task_parallel_thread_id(nullptr);
AutomaskingNodeData automask_data;
SCULPT_automasking_node_begin(ob, ss, ss->cache->automasking, &automask_data, node);
SCULPT_automasking_node_begin(ob, ss->cache->automasking, &automask_data, node);
BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
if (!sculpt_brush_test_sq_fn(&test, vd.co)) {
continue;
}
SCULPT_automasking_node_update(ss, &automask_data, &vd);
SCULPT_automasking_node_update(&automask_data, &vd);
const float fade = bstrength * SCULPT_brush_strength_factor(ss,
brush,
@ -438,7 +438,7 @@ static void do_surface_smooth_brush_laplacian_task(Object *ob, const Brush *brus
SCULPT_orig_vert_data_init(&orig_data, ob, node, SCULPT_UNDO_COORDS);
AutomaskingNodeData automask_data;
SCULPT_automasking_node_begin(ob, ss, ss->cache->automasking, &automask_data, node);
SCULPT_automasking_node_begin(ob, ss->cache->automasking, &automask_data, node);
BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
SCULPT_orig_vert_data_update(&orig_data, &vd);
@ -446,7 +446,7 @@ static void do_surface_smooth_brush_laplacian_task(Object *ob, const Brush *brus
continue;
}
SCULPT_automasking_node_update(ss, &automask_data, &vd);
SCULPT_automasking_node_update(&automask_data, &vd);
const float fade = bstrength * SCULPT_brush_strength_factor(ss,
brush,
@ -483,14 +483,14 @@ static void do_surface_smooth_brush_displace_task(Object *ob, const Brush *brush
ss, &test, brush->falloff_shape);
const int thread_id = BLI_task_parallel_thread_id(nullptr);
AutomaskingNodeData automask_data;
SCULPT_automasking_node_begin(ob, ss, ss->cache->automasking, &automask_data, node);
SCULPT_automasking_node_begin(ob, ss->cache->automasking, &automask_data, node);
BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
if (!sculpt_brush_test_sq_fn(&test, vd.co)) {
continue;
}
SCULPT_automasking_node_update(ss, &automask_data, &vd);
SCULPT_automasking_node_update(&automask_data, &vd);
const float fade = bstrength * SCULPT_brush_strength_factor(ss,
brush,

View File

@ -10,6 +10,8 @@
#include "BLI_math_matrix.h"
#include "BLI_math_vector.h"
#include "BLI_math_vector_types.hh"
#include "BLI_span.hh"
#include "BLI_task.h"
#include "DNA_meshdata_types.h"
@ -39,6 +41,9 @@
#include <cmath>
#include <cstdlib>
using blender::float3;
using blender::MutableSpan;
void ED_sculpt_init_transform(bContext *C,
Object *ob,
const float mval_fl[2],
@ -207,7 +212,7 @@ static void sculpt_elastic_transform_task(Object *ob,
SculptSession *ss = ob->sculpt;
float(*proxy)[3] = BKE_pbvh_node_add_proxy(ss->pbvh, node)->co;
const MutableSpan<float3> proxy = BKE_pbvh_node_add_proxy(*ss->pbvh, *node).co;
SculptOrigVertData orig_data;
SCULPT_orig_vert_data_init(&orig_data, ob, node, SCULPT_UNDO_COORDS);

View File

@ -592,7 +592,7 @@ static void draw_fcurve_curve(bAnimContext *ac,
const bool use_nla_remap,
const bool draw_extrapolation)
{
short mapping_flag = ANIM_get_normalization_flags(ac);
short mapping_flag = ANIM_get_normalization_flags(ac->sl);
/* when opening a blend file on a different sized screen or while dragging the toolbar this can
* happen best just bail out in this case. */
@ -739,7 +739,7 @@ static void draw_fcurve_curve_samples(bAnimContext *ac,
float fac, v[2];
int b = fcu->totvert;
float unit_scale, offset;
short mapping_flag = ANIM_get_normalization_flags(ac);
short mapping_flag = ANIM_get_normalization_flags(ac->sl);
int count = fcu->totvert;
const bool extrap_left = draw_extrapolation && prevfpt->vec[0] > v2d->cur.xmin;
@ -1023,7 +1023,7 @@ static void draw_fcurve_curve_keys(
/* Apply unit mapping. */
GPU_matrix_push();
float offset;
short mapping_flag = ANIM_get_normalization_flags(ac);
short mapping_flag = ANIM_get_normalization_flags(ac->sl);
const float unit_scale = ANIM_unit_mapping_get_factor(ac->scene, id, fcu, mapping_flag, &offset);
GPU_matrix_scale_2f(1.0f, unit_scale);
GPU_matrix_translate_2f(0.0f, offset);
@ -1264,7 +1264,7 @@ static void draw_fcurve(bAnimContext *ac, SpaceGraph *sipo, ARegion *region, bAn
}
}
else if (((fcu->bezt) || (fcu->fpt)) && (fcu->totvert)) {
short mapping_flag = ANIM_get_normalization_flags(ac);
short mapping_flag = ANIM_get_normalization_flags(ac->sl);
float offset;
const float unit_scale = ANIM_unit_mapping_get_factor(
ac->scene, ale->id, fcu, mapping_flag, &offset);
@ -1319,7 +1319,7 @@ static void graph_draw_driver_debug(bAnimContext *ac, ID *id, FCurve *fcu)
{
ChannelDriver *driver = fcu->driver;
View2D *v2d = &ac->region->v2d;
short mapping_flag = ANIM_get_normalization_flags(ac);
short mapping_flag = ANIM_get_normalization_flags(ac->sl);
float offset;
float unitfac = ANIM_unit_mapping_get_factor(ac->scene, id, fcu, mapping_flag, &offset);

View File

@ -154,7 +154,7 @@ static void insert_graph_keys(bAnimContext *ac, eGraphKeys_InsertKey_Types mode)
AnimData *adt = ANIM_nla_mapping_get(ac, ale);
FCurve *fcu = (FCurve *)ale->key_data;
short mapping_flag = ANIM_get_normalization_flags(ac);
short mapping_flag = ANIM_get_normalization_flags(ac->sl);
float offset;
float unit_scale = ANIM_unit_mapping_get_factor(
ac->scene, ale->id, static_cast<FCurve *>(ale->key_data), mapping_flag, &offset);
@ -321,7 +321,7 @@ static int graphkeys_click_insert_exec(bContext *C, wmOperator *op)
ListBase anim_data;
ToolSettings *ts = ac.scene->toolsettings;
short mapping_flag = ANIM_get_normalization_flags(&ac);
short mapping_flag = ANIM_get_normalization_flags(ac.sl);
float scale, offset;
/* Preserve selection? */
@ -2119,7 +2119,7 @@ static KeyframeEditData sum_selected_keyframes(bAnimContext *ac)
LISTBASE_FOREACH (bAnimListElem *, ale, &anim_data) {
AnimData *adt = ANIM_nla_mapping_get(ac, ale);
short mapping_flag = ANIM_get_normalization_flags(ac);
short mapping_flag = ANIM_get_normalization_flags(ac->sl);
KeyframeEditData current_ked;
float offset;
float unit_scale = ANIM_unit_mapping_get_factor(ac->scene,
@ -2441,7 +2441,7 @@ static void snap_graph_keys(bAnimContext *ac, short mode)
/* Normalize cursor value (for normalized F-Curves display). */
if (mode == GRAPHKEYS_SNAP_VALUE) {
short mapping_flag = ANIM_get_normalization_flags(ac);
short mapping_flag = ANIM_get_normalization_flags(ac->sl);
float offset;
float unit_scale = ANIM_unit_mapping_get_factor(
ac->scene, ale->id, static_cast<FCurve *>(ale->key_data), mapping_flag, &offset);
@ -2754,7 +2754,7 @@ static void mirror_graph_keys(bAnimContext *ac, short mode)
/* Apply unit corrections. */
if (mode == GRAPHKEYS_MIRROR_VALUE) {
short mapping_flag = ANIM_get_normalization_flags(ac);
short mapping_flag = ANIM_get_normalization_flags(ac->sl);
float offset;
float unit_scale = ANIM_unit_mapping_get_factor(ac->scene,
ale->id,

View File

@ -181,7 +181,7 @@ static void get_nearest_fcurve_verts_list(bAnimContext *ac, const int mval[2], L
if (U.animation_flag & USER_ANIM_ONLY_SHOW_SELECTED_CURVE_KEYS) {
filter |= ANIMFILTER_SEL;
}
mapping_flag |= ANIM_get_normalization_flags(ac);
mapping_flag |= ANIM_get_normalization_flags(ac->sl);
ANIM_animdata_filter(
ac, &anim_data, eAnimFilter_Flags(filter), ac->data, eAnimCont_Types(ac->datatype));
@ -581,7 +581,7 @@ static void initialize_box_select_key_editing_data(const bool incl_handles,
*r_mapping_flag = ANIM_UNITCONV_ONLYKEYS;
}
*r_mapping_flag |= ANIM_get_normalization_flags(ac);
*r_mapping_flag |= ANIM_get_normalization_flags(ac->sl);
}
/**

View File

@ -90,7 +90,7 @@ void get_graph_keyframe_extents(bAnimContext *ac,
/* Get range. */
if (BKE_fcurve_calc_bounds(fcu, do_sel_only, include_handles, nullptr, &bounds)) {
short mapping_flag = ANIM_get_normalization_flags(ac);
short mapping_flag = ANIM_get_normalization_flags(ac->sl);
/* Apply NLA scaling. */
if (adt) {
@ -410,7 +410,7 @@ static void create_ghost_curves(bAnimContext *ac, int start, int end)
FPoint *fpt;
float unitFac, offset;
int cfra;
short mapping_flag = ANIM_get_normalization_flags(ac);
short mapping_flag = ANIM_get_normalization_flags(ac->sl);
/* Disable driver so that it don't muck up the sampling process. */
fcu->driver = nullptr;

View File

@ -404,7 +404,7 @@ struct ViewOpsData_Utility : ViewOpsData {
/* Used by #ED_view3d_navigation_do. */
bool is_modal_event;
ViewOpsData_Utility(bContext *C, const bool use_alt_navigation = false)
ViewOpsData_Utility(bContext *C, const wmKeyMapItem *kmi_merge = nullptr)
: ViewOpsData(), keymap_items(), is_modal_event(false)
{
this->init_context(C);
@ -427,9 +427,31 @@ struct ViewOpsData_Utility : ViewOpsData {
continue;
}
wmKeyMapItem *kmi_copy = WM_keymap_add_item_copy(&keymap_tmp, kmi);
if (use_alt_navigation) {
kmi_copy->alt = true;
wmKeyMapItem *kmi_cpy = WM_keymap_add_item_copy(&keymap_tmp, kmi);
if (kmi_merge) {
if (kmi_merge->shift == 1 || ELEM(kmi_merge->type, EVT_RIGHTSHIFTKEY, EVT_LEFTSHIFTKEY)) {
kmi_cpy->shift = 1;
}
if (kmi_merge->ctrl == 1 || ELEM(kmi_merge->type, EVT_LEFTCTRLKEY, EVT_RIGHTCTRLKEY)) {
kmi_cpy->ctrl = 1;
}
if (kmi_merge->alt == 1 || ELEM(kmi_merge->type, EVT_LEFTALTKEY, EVT_RIGHTALTKEY)) {
kmi_cpy->alt = 1;
}
if (kmi_merge->oskey == 1 || ELEM(kmi_merge->type, EVT_OSKEY)) {
kmi_cpy->oskey = 1;
}
if (!ELEM(kmi_merge->type,
EVT_LEFTCTRLKEY,
EVT_LEFTALTKEY,
EVT_RIGHTALTKEY,
EVT_RIGHTCTRLKEY,
EVT_RIGHTSHIFTKEY,
EVT_LEFTSHIFTKEY,
EVT_OSKEY))
{
kmi_cpy->keymodifier |= kmi_merge->type;
}
}
}
@ -1037,13 +1059,13 @@ static const ViewOpsType *view3d_navigation_type_from_idname(const char *idname)
/* Unlike `viewops_data_create`, `ED_view3d_navigation_init` creates a navigation context along
* with an array of `wmKeyMapItem`s used for navigation. */
ViewOpsData *ED_view3d_navigation_init(bContext *C, const bool use_alt_navigation)
ViewOpsData *ED_view3d_navigation_init(bContext *C, const wmKeyMapItem *kmi_merge)
{
if (!CTX_wm_region_view3d(C)) {
return nullptr;
}
return new ViewOpsData_Utility(C, use_alt_navigation);
return new ViewOpsData_Utility(C, kmi_merge);
}
bool ED_view3d_navigation_do(bContext *C,

View File

@ -185,7 +185,7 @@ void VIEW3D_OT_view_orbit(wmOperatorType *ot)
/** \} */
const ViewOpsType ViewOpsType_orbit = {
/*flag*/ (VIEWOPS_FLAG_PERSP_ENSURE | VIEWOPS_FLAG_ORBIT_SELECT),
/*flag*/ VIEWOPS_FLAG_ORBIT_SELECT,
/*idname*/ "VIEW3D_OT_view_orbit",
/*poll_fn*/ nullptr,
/*init_fn*/ nullptr,

View File

@ -709,6 +709,8 @@ static bool transform_modal_item_poll(const wmOperator *op, int value)
}
break;
}
case TFM_MODAL_PASSTHROUGH_NAVIGATE:
return t->vod != nullptr;
}
return true;
}
@ -763,6 +765,7 @@ wmKeyMap *transform_modal_keymap(wmKeyConfig *keyconf)
{TFM_MODAL_AUTOCONSTRAINT, "AUTOCONSTRAIN", 0, "Automatic Constraint", ""},
{TFM_MODAL_AUTOCONSTRAINTPLANE, "AUTOCONSTRAINPLANE", 0, "Automatic Constraint Plane", ""},
{TFM_MODAL_PRECISION, "PRECISION", 0, "Precision Mode", ""},
{TFM_MODAL_PASSTHROUGH_NAVIGATE, "PASSTHROUGH_NAVIGATE", 0, "Navigate", ""},
{0, nullptr, 0, nullptr, nullptr},
};

View File

@ -283,6 +283,8 @@ enum {
TFM_MODAL_EDIT_SNAP_SOURCE_ON = 34,
TFM_MODAL_EDIT_SNAP_SOURCE_OFF = 35,
TFM_MODAL_PASSTHROUGH_NAVIGATE = 36,
};
/** \} */

View File

@ -240,7 +240,7 @@ static void createTransGraphEditData(bContext *C, TransInfo *t)
return;
}
anim_map_flag |= ANIM_get_normalization_flags(&ac);
anim_map_flag |= ANIM_get_normalization_flags(ac.sl);
/* filter data */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVE_VISIBLE |
@ -644,18 +644,6 @@ static bool fcu_test_selected(FCurve *fcu)
return false;
}
static void invert_snap(eSnapMode &snap_mode)
{
if (snap_mode & SCE_SNAP_TO_FRAME) {
snap_mode &= ~SCE_SNAP_TO_FRAME;
snap_mode |= SCE_SNAP_TO_SECOND;
}
else if (snap_mode & SCE_SNAP_TO_SECOND) {
snap_mode &= ~SCE_SNAP_TO_SECOND;
snap_mode |= SCE_SNAP_TO_FRAME;
}
}
/* This function is called on recalc_data to apply the transforms applied
* to the transdata on to the actual keyframe data
*/
@ -668,10 +656,6 @@ static void flushTransGraphData(TransInfo *t)
eSnapMode snap_mode = t->tsnap.mode;
if (t->modifiers & MOD_SNAP_INVERT) {
invert_snap(snap_mode);
}
TransDataContainer *tc = TRANS_DATA_CONTAINER_FIRST_SINGLE(t);
/* flush to 2d vector from internally used 3d vector */
for (a = 0,

View File

@ -687,9 +687,20 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
TFM_EDGE_SLIDE,
TFM_VERT_SLIDE))
{
const bool use_alt_navigation = (prop = RNA_struct_find_property(op->ptr, "alt_navigation")) &&
RNA_property_boolean_get(op->ptr, prop);
t->vod = ED_view3d_navigation_init(C, use_alt_navigation);
wmWindowManager *wm = CTX_wm_manager(C);
wmKeyMap *keymap = WM_keymap_active(wm, op->type->modalkeymap);
const wmKeyMapItem *kmi_passthrough = nullptr;
LISTBASE_FOREACH (const wmKeyMapItem *, kmi, &keymap->items) {
if (kmi->flag & KMI_INACTIVE) {
continue;
}
if (kmi->propvalue == TFM_MODAL_PASSTHROUGH_NAVIGATE) {
kmi_passthrough = kmi;
break;
}
}
t->vod = ED_view3d_navigation_init(C, kmi_passthrough);
}
setTransformViewMatrices(t);

View File

@ -807,12 +807,6 @@ void Transform_Properties(wmOperatorType *ot, int flags)
RNA_def_property_flag(prop, PROP_HIDDEN);
}
if (flags & P_VIEW3D_ALT_NAVIGATION) {
prop = RNA_def_boolean(
ot->srna, "alt_navigation", false, "Transform Navigation with Alt", nullptr);
RNA_def_property_flag(prop, PROP_HIDDEN);
}
if (flags & P_POST_TRANSFORM) {
prop = RNA_def_boolean(ot->srna,
"use_automerge_and_split",
@ -847,7 +841,7 @@ static void TRANSFORM_OT_translate(wmOperatorType *ot)
Transform_Properties(ot,
P_ORIENT_MATRIX | P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR | P_ALIGN_SNAP |
P_OPTIONS | P_GPENCIL_EDIT | P_CURSOR_EDIT | P_VIEW2D_EDGE_PAN |
P_VIEW3D_ALT_NAVIGATION | P_POST_TRANSFORM);
P_POST_TRANSFORM);
}
static void TRANSFORM_OT_resize(wmOperatorType *ot)
@ -886,7 +880,7 @@ static void TRANSFORM_OT_resize(wmOperatorType *ot)
Transform_Properties(ot,
P_ORIENT_MATRIX | P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR | P_GEO_SNAP |
P_OPTIONS | P_GPENCIL_EDIT | P_CENTER | P_VIEW3D_ALT_NAVIGATION);
P_OPTIONS | P_GPENCIL_EDIT | P_CENTER);
}
static void TRANSFORM_OT_skin_resize(wmOperatorType *ot)
@ -963,7 +957,7 @@ static void TRANSFORM_OT_rotate(wmOperatorType *ot)
Transform_Properties(ot,
P_ORIENT_AXIS | P_ORIENT_MATRIX | P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR |
P_GEO_SNAP | P_GPENCIL_EDIT | P_CENTER | P_VIEW3D_ALT_NAVIGATION);
P_GEO_SNAP | P_GPENCIL_EDIT | P_CENTER);
}
static void TRANSFORM_OT_tilt(wmOperatorType *ot)
@ -1102,7 +1096,7 @@ static void TRANSFORM_OT_shrink_fatten(wmOperatorType *ot)
WM_operatortype_props_advanced_begin(ot);
Transform_Properties(ot, P_PROPORTIONAL | P_MIRROR | P_SNAP | P_VIEW3D_ALT_NAVIGATION);
Transform_Properties(ot, P_PROPORTIONAL | P_MIRROR | P_SNAP);
}
static void TRANSFORM_OT_tosphere(wmOperatorType *ot)
@ -1208,7 +1202,7 @@ static void TRANSFORM_OT_edge_slide(wmOperatorType *ot)
"When Even mode is active, flips between the two adjacent edge loops");
RNA_def_boolean(ot->srna, "use_clamp", true, "Clamp", "Clamp within the edge extents");
Transform_Properties(ot, P_MIRROR | P_GEO_SNAP | P_CORRECT_UV | P_VIEW3D_ALT_NAVIGATION);
Transform_Properties(ot, P_MIRROR | P_GEO_SNAP | P_CORRECT_UV);
}
static void TRANSFORM_OT_vert_slide(wmOperatorType *ot)
@ -1243,7 +1237,7 @@ static void TRANSFORM_OT_vert_slide(wmOperatorType *ot)
"When Even mode is active, flips between the two adjacent edge loops");
RNA_def_boolean(ot->srna, "use_clamp", true, "Clamp", "Clamp within the edge extents");
Transform_Properties(ot, P_MIRROR | P_GEO_SNAP | P_CORRECT_UV | P_VIEW3D_ALT_NAVIGATION);
Transform_Properties(ot, P_MIRROR | P_GEO_SNAP | P_CORRECT_UV);
}
static void TRANSFORM_OT_edge_crease(wmOperatorType *ot)
@ -1391,8 +1385,8 @@ static void TRANSFORM_OT_transform(wmOperatorType *ot)
Transform_Properties(ot,
P_ORIENT_AXIS | P_ORIENT_MATRIX | P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR |
P_ALIGN_SNAP | P_GPENCIL_EDIT | P_CENTER | P_VIEW3D_ALT_NAVIGATION |
P_POST_TRANSFORM | P_OPTIONS);
P_ALIGN_SNAP | P_GPENCIL_EDIT | P_CENTER | P_POST_TRANSFORM |
P_OPTIONS);
}
static int transform_from_gizmo_invoke(bContext *C, wmOperator * /*op*/, const wmEvent *event)

View File

@ -129,10 +129,28 @@ bool validSnap(const TransInfo *t)
void transform_snap_flag_from_modifiers_set(TransInfo *t)
{
if (ELEM(t->spacetype, SPACE_GRAPH, SPACE_ACTION, SPACE_NLA)) {
if (ELEM(t->spacetype, SPACE_ACTION, SPACE_NLA)) {
/* Those space-types define their own invert behavior instead of toggling it on/off. */
return;
}
if (t->spacetype == SPACE_GRAPH) {
/* This is to stay consistent with the behavior from 3.6. */
if (t->modifiers & MOD_SNAP_INVERT) {
t->tsnap.mode |= SCE_SNAP_TO_INCREMENT;
}
else {
t->tsnap.mode &= ~SCE_SNAP_TO_INCREMENT;
}
/* In 3.6 when snapping was disabled, pressing the invert button would turn on snapping.
* But it wouldn't turn it off when it was enabled. */
if ((t->modifiers & MOD_SNAP) || (t->modifiers & MOD_SNAP_INVERT)) {
t->tsnap.flag |= SCE_SNAP;
}
else {
t->tsnap.flag &= ~SCE_SNAP;
}
return;
}
SET_FLAG_FROM_TEST(t->tsnap.flag,
(((t->modifiers & (MOD_SNAP | MOD_SNAP_INVERT)) == MOD_SNAP) ||
((t->modifiers & (MOD_SNAP | MOD_SNAP_INVERT)) == MOD_SNAP_INVERT)),

View File

@ -102,7 +102,7 @@ static int remap_time(GpencilModifierData *md,
offset = abs(efra - sfra + offset + 1);
}
/* Avoid inverse ranges. */
if (efra <= sfra) {
if (efra < sfra) {
return cfra;
}

View File

@ -140,7 +140,7 @@ bool MTLCommandBufferManager::submit(bool wait)
MTL_LOG_WARNING(
"Maximum number of command buffers in flight. Host will wait until GPU work has "
"completed. Consider increasing GHOST_ContextCGL::max_command_buffer_count or reducing "
"work fragmentation to better utilise system hardware. Command buffers are flushed upon "
"work fragmentation to better utilize system hardware. Command buffers are flushed upon "
"GPUContext switches, this is the most common cause of excessive command buffer "
"generation.");
}

View File

@ -936,8 +936,8 @@ bool MTLFrameBuffer::add_color_attachment(gpu::MTLTexture *texture,
}
else {
MTL_LOG_ERROR(
"Passing in null texture to MTLFrameBuffer::addColourAttachment (This could be due to not "
"all texture types being supported).");
"Passing in null texture to MTLFrameBuffer::add_color_attachment (This could be due to "
"not all texture types being supported).");
}
return true;
}

View File

@ -1075,6 +1075,7 @@ static char *glsl_patch_default_get()
/* Vulkan GLSL compatibility. */
STR_CONCAT(patch, slen, "#define gpu_InstanceIndex (gl_InstanceID + gpu_BaseInstance)\n");
STR_CONCAT(patch, slen, "#define gpu_EmitVertex EmitVertex\n");
/* Array compatibility. */
STR_CONCAT(patch, slen, "#define gpu_Array(_type) _type[]\n");

View File

@ -38,12 +38,12 @@ void do_vertex(const int i, vec4 pos, vec2 ofs)
interp_noperspective_out.smoothline = (lineWidth + SMOOTH_WIDTH * float(lineSmooth)) * 0.5;
gl_Position = pos;
gl_Position.xy += ofs * pos.w;
EmitVertex();
gpu_EmitVertex();
interp_noperspective_out.smoothline = -(lineWidth + SMOOTH_WIDTH * float(lineSmooth)) * 0.5;
gl_Position = pos;
gl_Position.xy -= ofs * pos.w;
EmitVertex();
gpu_EmitVertex();
}
void main(void)

View File

@ -121,19 +121,19 @@ void main(void)
gl_Position = vec4((sp1 + geometry_in[1].finalThickness * n0) / gpencil_stroke_data.viewport,
getZdepth(P1),
1.0);
EmitVertex();
gpu_EmitVertex();
geometry_out.mTexCoord = vec2(0, 0);
geometry_out.mColor = geometry_in[1].finalColor;
gl_Position = vec4((sp1 + geometry_in[1].finalThickness * n1) / gpencil_stroke_data.viewport,
getZdepth(P1),
1.0);
EmitVertex();
gpu_EmitVertex();
geometry_out.mTexCoord = vec2(0, 0.5);
geometry_out.mColor = geometry_in[1].finalColor;
gl_Position = vec4(sp1 / gpencil_stroke_data.viewport, getZdepth(P1), 1.0);
EmitVertex();
gpu_EmitVertex();
EndPrimitive();
}
@ -143,19 +143,19 @@ void main(void)
gl_Position = vec4((sp1 - geometry_in[1].finalThickness * n1) / gpencil_stroke_data.viewport,
getZdepth(P1),
1.0);
EmitVertex();
gpu_EmitVertex();
geometry_out.mTexCoord = vec2(0, 1);
geometry_out.mColor = geometry_in[1].finalColor;
gl_Position = vec4((sp1 - geometry_in[1].finalThickness * n0) / gpencil_stroke_data.viewport,
getZdepth(P1),
1.0);
EmitVertex();
gpu_EmitVertex();
geometry_out.mTexCoord = vec2(0, 0.5);
geometry_out.mColor = geometry_in[1].finalColor;
gl_Position = vec4(sp1 / gpencil_stroke_data.viewport, getZdepth(P1), 1.0);
EmitVertex();
gpu_EmitVertex();
EndPrimitive();
}
@ -173,19 +173,19 @@ void main(void)
geometry_out.mColor = vec4(geometry_in[1].finalColor.rgb, geometry_in[1].finalColor.a * -1.0);
vec2 svn1 = normalize(sp1 - sp2) * length_a * 4.0 * extend;
gl_Position = vec4((sp1 + svn1) / gpencil_stroke_data.viewport, getZdepth(P1), 1.0);
EmitVertex();
gpu_EmitVertex();
geometry_out.mTexCoord = vec2(0, 0);
geometry_out.mColor = vec4(geometry_in[1].finalColor.rgb, geometry_in[1].finalColor.a * -1.0);
gl_Position = vec4(
(sp1 - (length_a * 2.0) * miter_a) / gpencil_stroke_data.viewport, getZdepth(P1), 1.0);
EmitVertex();
gpu_EmitVertex();
geometry_out.mTexCoord = vec2(0, 1);
geometry_out.mColor = vec4(geometry_in[1].finalColor.rgb, geometry_in[1].finalColor.a * -1.0);
gl_Position = vec4(
(sp1 + (length_a * 2.0) * miter_a) / gpencil_stroke_data.viewport, getZdepth(P1), 1.0);
EmitVertex();
gpu_EmitVertex();
}
/* generate the triangle strip */
@ -193,25 +193,25 @@ void main(void)
geometry_out.mColor = geometry_in[1].finalColor;
gl_Position = vec4(
(sp1 + length_a * miter_a) / gpencil_stroke_data.viewport, getZdepth(P1), 1.0);
EmitVertex();
gpu_EmitVertex();
geometry_out.mTexCoord = vec2(0, 1);
geometry_out.mColor = geometry_in[1].finalColor;
gl_Position = vec4(
(sp1 - length_a * miter_a) / gpencil_stroke_data.viewport, getZdepth(P1), 1.0);
EmitVertex();
gpu_EmitVertex();
geometry_out.mTexCoord = vec2(0, 0);
geometry_out.mColor = geometry_in[2].finalColor;
gl_Position = vec4(
(sp2 + length_b * miter_b) / gpencil_stroke_data.viewport, getZdepth(P2), 1.0);
EmitVertex();
gpu_EmitVertex();
geometry_out.mTexCoord = vec2(0, 1);
geometry_out.mColor = geometry_in[2].finalColor;
gl_Position = vec4(
(sp2 - length_b * miter_b) / gpencil_stroke_data.viewport, getZdepth(P2), 1.0);
EmitVertex();
gpu_EmitVertex();
/* Generate the end end-cap (alpha < 0 used as end-cap flag). */
if ((gpencil_stroke_data.caps_end != GPENCIL_FLATCAP) && is_equal(P1, P3)) {
@ -219,19 +219,19 @@ void main(void)
geometry_out.mColor = vec4(geometry_in[2].finalColor.rgb, geometry_in[2].finalColor.a * -1.0);
gl_Position = vec4(
(sp2 + (length_b * 2.0) * miter_b) / gpencil_stroke_data.viewport, getZdepth(P2), 1.0);
EmitVertex();
gpu_EmitVertex();
geometry_out.mTexCoord = vec2(0, 0);
geometry_out.mColor = vec4(geometry_in[2].finalColor.rgb, geometry_in[2].finalColor.a * -1.0);
gl_Position = vec4(
(sp2 - (length_b * 2.0) * miter_b) / gpencil_stroke_data.viewport, getZdepth(P2), 1.0);
EmitVertex();
gpu_EmitVertex();
geometry_out.mTexCoord = vec2(1, 0.5);
geometry_out.mColor = vec4(geometry_in[2].finalColor.rgb, geometry_in[2].finalColor.a * -1.0);
vec2 svn2 = normalize(sp2 - sp1) * length_b * 4.0 * extend;
gl_Position = vec4((sp2 + svn2) / gpencil_stroke_data.viewport, getZdepth(P2), 1.0);
EmitVertex();
gpu_EmitVertex();
}
EndPrimitive();

View File

@ -51,10 +51,10 @@ void VKBatch::draw(int vertex_first, int vertex_count, int instance_first, int i
VKIndexBuffer *index_buffer = index_buffer_get();
const bool draw_indexed = index_buffer != nullptr;
if (draw_indexed) {
command_buffers.draw_indexed(index_buffer->index_len_get(),
command_buffers.draw_indexed(vertex_count,
instance_count,
index_buffer->index_start_get(),
vertex_first,
index_buffer->index_start_get(),
instance_first);
}
else {

View File

@ -763,7 +763,8 @@ VkClearColorValue to_vk_clear_color_value(const eGPUDataFormat format, const voi
{
VkClearColorValue result = {{0.0f}};
switch (format) {
case GPU_DATA_FLOAT: {
case GPU_DATA_FLOAT:
case GPU_DATA_10_11_11_REV: {
const float *float_data = static_cast<const float *>(data);
copy_color<float>(result.float32, float_data);
break;
@ -784,7 +785,6 @@ VkClearColorValue to_vk_clear_color_value(const eGPUDataFormat format, const voi
case GPU_DATA_HALF_FLOAT:
case GPU_DATA_UBYTE:
case GPU_DATA_UINT_24_8:
case GPU_DATA_10_11_11_REV:
case GPU_DATA_2_10_10_10_REV: {
BLI_assert_unreachable();
break;

View File

@ -158,9 +158,17 @@ void VKFrameBuffer::clear(const eGPUFrameBufferBits buffers,
Vector<VkClearAttachment> attachments;
if (buffers & (GPU_DEPTH_BIT | GPU_STENCIL_BIT)) {
VKContext &context = *VKContext::get();
/* Clearing depth via vkCmdClearAttachments requires a render pass with write depth enabled.
* When not enabled, clearing should be done via texture directly. */
if (context.state_manager_get().state.write_mask & GPU_WRITE_DEPTH) {
eGPUWriteMask needed_mask = GPU_WRITE_NONE;
if (buffers & GPU_DEPTH_BIT) {
needed_mask |= GPU_WRITE_DEPTH;
}
if (buffers & GPU_STENCIL_BIT) {
needed_mask |= GPU_WRITE_STENCIL;
}
/* Clearing depth via vkCmdClearAttachments requires a render pass with write depth or stencil
* enabled. When not enabled, clearing should be done via texture directly. */
if ((context.state_manager_get().state.write_mask & needed_mask) == needed_mask) {
build_clear_attachments_depth_stencil(buffers, clear_depth, clear_stencil, attachments);
}
else {
@ -288,7 +296,7 @@ static void blit_aspect(VKCommandBuffers &command_buffer,
/* Prefer texture copy, as some platforms don't support using D32_SFLOAT_S8_UINT to be used as
* a blit destination. */
if (dst_offset_x == 0 && dst_offset_y == 0 &&
dst_texture.format_get() == src_texture.format_get() &&
dst_texture.device_format_get() == src_texture.device_format_get() &&
src_texture.width_get() == dst_texture.width_get() &&
src_texture.height_get() == dst_texture.height_get())
{

View File

@ -40,10 +40,10 @@ VKImageView::VKImageView(VKTexture &texture,
const VkImageAspectFlags allowed_bits = VK_IMAGE_ASPECT_COLOR_BIT |
(use_stencil ? VK_IMAGE_ASPECT_STENCIL_BIT :
VK_IMAGE_ASPECT_DEPTH_BIT);
VkImageAspectFlags image_aspect = to_vk_image_aspect_flag_bits(texture.format_get()) &
allowed_bits;
eGPUTextureFormat device_format = texture.device_format_get();
VkImageAspectFlags image_aspect = to_vk_image_aspect_flag_bits(device_format) & allowed_bits;
vk_format_ = to_vk_format(texture.format_get());
vk_format_ = to_vk_format(device_format);
if (texture.format_flag_get() & GPU_FORMAT_SRGB && !use_srgb) {
vk_format_ = to_non_srgb_format(vk_format_);
}

View File

@ -159,7 +159,9 @@ void VKPipeline::finalize(VKContext &context,
pipeline_input_assembly.sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO;
pipeline_input_assembly.topology = to_vk_primitive_topology(prim_type);
pipeline_input_assembly.primitiveRestartEnable =
ELEM(prim_type, GPU_PRIM_TRIS, GPU_PRIM_LINES, GPU_PRIM_POINTS) ? VK_FALSE : VK_TRUE;
ELEM(prim_type, GPU_PRIM_TRIS, GPU_PRIM_LINES, GPU_PRIM_POINTS, GPU_PRIM_LINES_ADJ) ?
VK_FALSE :
VK_TRUE;
pipeline_create_info.pInputAssemblyState = &pipeline_input_assembly;
/* Viewport state. */

View File

@ -262,18 +262,18 @@ void VKPipelineStateManager::set_stencil_test(const eGPUStencilTest test,
case GPU_STENCIL_OP_COUNT_DEPTH_PASS:
depth_stencil_state.front.failOp = VK_STENCIL_OP_KEEP;
depth_stencil_state.front.passOp = VK_STENCIL_OP_KEEP;
depth_stencil_state.front.depthFailOp = VK_STENCIL_OP_DECREMENT_AND_WRAP;
depth_stencil_state.front.passOp = VK_STENCIL_OP_DECREMENT_AND_WRAP;
depth_stencil_state.front.depthFailOp = VK_STENCIL_OP_KEEP;
depth_stencil_state.back = depth_stencil_state.front;
depth_stencil_state.back.depthFailOp = VK_STENCIL_OP_INCREMENT_AND_WRAP;
depth_stencil_state.back.passOp = VK_STENCIL_OP_INCREMENT_AND_WRAP;
break;
case GPU_STENCIL_OP_COUNT_DEPTH_FAIL:
depth_stencil_state.front.failOp = VK_STENCIL_OP_KEEP;
depth_stencil_state.front.passOp = VK_STENCIL_OP_INCREMENT_AND_WRAP;
depth_stencil_state.front.depthFailOp = VK_STENCIL_OP_KEEP;
depth_stencil_state.front.passOp = VK_STENCIL_OP_KEEP;
depth_stencil_state.front.depthFailOp = VK_STENCIL_OP_INCREMENT_AND_WRAP;
depth_stencil_state.back = depth_stencil_state.front;
depth_stencil_state.back.depthFailOp = VK_STENCIL_OP_DECREMENT_AND_WRAP;
depth_stencil_state.back.passOp = VK_STENCIL_OP_DECREMENT_AND_WRAP;
break;
case GPU_STENCIL_OP_NONE:
@ -319,7 +319,10 @@ void VKPipelineStateManager::set_stencil_mask(const eGPUStencilTest test,
return;
}
depth_stencil_state.back = depth_stencil_state.front;
depth_stencil_state.back.writeMask = depth_stencil_state.front.writeMask;
depth_stencil_state.back.reference = depth_stencil_state.front.reference;
depth_stencil_state.back.compareOp = depth_stencil_state.front.compareOp;
depth_stencil_state.back.compareMask = depth_stencil_state.front.compareMask;
}
void VKPipelineStateManager::set_clip_distances(const int /*new_dist_len*/,

View File

@ -1092,6 +1092,15 @@ std::string VKShader::vertex_interface_declare(const shader::ShaderCreateInfo &i
}
ss << "\n";
/* Retarget depth from -1..1 to 0..1. This will be done by geometry stage, when geometry shaders
* are used. */
const bool has_geometry_stage = bool(info.builtins_ & BuiltinBits::BARYCENTRIC_COORD) ||
!info.geometry_source_.is_empty();
const bool retarget_depth = !has_geometry_stage;
if (retarget_depth) {
post_main += "gl_Position.z = (gl_Position.z + gl_Position.w) * 0.5;\n";
}
if (post_main.empty() == false) {
std::string pre_main;
ss << main_function_wrapper(pre_main, post_main);
@ -1220,6 +1229,14 @@ static StageInterfaceInfo *find_interface_by_name(const Vector<StageInterfaceInf
return nullptr;
}
static void declare_emit_vertex(std::stringstream &ss)
{
ss << "void gpu_EmitVertex() {\n";
ss << " gl_Position.z = (gl_Position.z + gl_Position.w) * 0.5;\n";
ss << " EmitVertex();\n";
ss << "}\n";
}
std::string VKShader::geometry_layout_declare(const shader::ShaderCreateInfo &info) const
{
std::stringstream ss;
@ -1243,6 +1260,8 @@ std::string VKShader::geometry_layout_declare(const shader::ShaderCreateInfo &in
}
ss << "\n";
declare_emit_vertex(ss);
return ss.str();
}

View File

@ -39,6 +39,7 @@ void VKTexture::init(VkImage vk_image, VkImageLayout layout, eGPUTextureFormat t
vk_image_ = vk_image;
current_layout_ = layout;
format_ = texture_format;
device_format_ = texture_format;
}
void VKTexture::generate_mipmap()
@ -91,14 +92,14 @@ void VKTexture::generate_mipmap()
VkImageBlit image_blit = {};
image_blit.srcOffsets[0] = {0, 0, 0};
image_blit.srcOffsets[1] = {src_size.x, src_size.y, src_size.z};
image_blit.srcSubresource.aspectMask = to_vk_image_aspect_flag_bits(format_);
image_blit.srcSubresource.aspectMask = to_vk_image_aspect_flag_bits(device_format_);
image_blit.srcSubresource.mipLevel = src_mipmap;
image_blit.srcSubresource.baseArrayLayer = 0;
image_blit.srcSubresource.layerCount = vk_layer_count(1);
image_blit.dstOffsets[0] = {0, 0, 0};
image_blit.dstOffsets[1] = {dst_size.x, dst_size.y, dst_size.z};
image_blit.dstSubresource.aspectMask = to_vk_image_aspect_flag_bits(format_);
image_blit.dstSubresource.aspectMask = to_vk_image_aspect_flag_bits(device_format_);
image_blit.dstSubresource.mipLevel = dst_mipmap;
image_blit.dstSubresource.baseArrayLayer = 0;
image_blit.dstSubresource.layerCount = vk_layer_count(1);
@ -148,11 +149,11 @@ void VKTexture::copy_to(Texture *tex)
VKTexture *src = this;
BLI_assert(dst);
BLI_assert(src->w_ == dst->w_ && src->h_ == dst->h_ && src->d_ == dst->d_);
BLI_assert(src->format_ == dst->format_);
BLI_assert(src->device_format_ == dst->device_format_);
BLI_assert(!is_texture_view());
UNUSED_VARS_NDEBUG(src);
copy_to(*dst, to_vk_image_aspect_flag_bits(format_));
copy_to(*dst, to_vk_image_aspect_flag_bits(device_format_));
}
void VKTexture::clear(eGPUDataFormat format, const void *data)
@ -163,7 +164,7 @@ void VKTexture::clear(eGPUDataFormat format, const void *data)
VKCommandBuffers &command_buffers = context.command_buffers_get();
VkClearColorValue clear_color = to_vk_clear_color_value(format, data);
VkImageSubresourceRange range = {0};
range.aspectMask = to_vk_image_aspect_flag_bits(format_);
range.aspectMask = to_vk_image_aspect_flag_bits(device_format_);
range.levelCount = VK_REMAINING_MIP_LEVELS;
range.layerCount = VK_REMAINING_ARRAY_LAYERS;
layout_ensure(context, VK_IMAGE_LAYOUT_GENERAL);
@ -223,7 +224,7 @@ void VKTexture::read_sub(
VKBuffer staging_buffer;
size_t sample_len = (region[2] - region[0]) * (region[3] - region[1]) * layers.size();
size_t device_memory_size = sample_len * to_bytesize(format_);
size_t device_memory_size = sample_len * to_bytesize(device_format_);
staging_buffer.create(device_memory_size, GPU_USAGE_DYNAMIC, VK_BUFFER_USAGE_TRANSFER_DST_BIT);
@ -233,7 +234,7 @@ void VKTexture::read_sub(
buffer_image_copy.imageExtent.width = region[2];
buffer_image_copy.imageExtent.height = region[3];
buffer_image_copy.imageExtent.depth = 1;
buffer_image_copy.imageSubresource.aspectMask = to_vk_image_aspect_flag_bits(format_);
buffer_image_copy.imageSubresource.aspectMask = to_vk_image_aspect_flag_bits(device_format_);
buffer_image_copy.imageSubresource.mipLevel = mip;
buffer_image_copy.imageSubresource.baseArrayLayer = layers.start();
buffer_image_copy.imageSubresource.layerCount = layers.size();
@ -242,7 +243,8 @@ void VKTexture::read_sub(
command_buffers.copy(staging_buffer, *this, Span<VkBufferImageCopy>(&buffer_image_copy, 1));
context.flush();
convert_device_to_host(r_data, staging_buffer.mapped_memory_get(), sample_len, format, format_);
convert_device_to_host(
r_data, staging_buffer.mapped_memory_get(), sample_len, format, device_format_);
}
void *VKTexture::read(int mip, eGPUDataFormat format)
@ -269,7 +271,7 @@ void VKTexture::update_sub(
int layers = vk_layer_count(1);
int3 extent = int3(extent_[0], max_ii(extent_[1], 1), max_ii(extent_[2], 1));
size_t sample_len = extent.x * extent.y * extent.z;
size_t device_memory_size = sample_len * to_bytesize(format_);
size_t device_memory_size = sample_len * to_bytesize(device_format_);
if (type_ & GPU_TEXTURE_1D) {
extent.y = 1;
@ -281,7 +283,8 @@ void VKTexture::update_sub(
VKBuffer staging_buffer;
staging_buffer.create(device_memory_size, GPU_USAGE_DYNAMIC, VK_BUFFER_USAGE_TRANSFER_SRC_BIT);
convert_host_to_device(staging_buffer.mapped_memory_get(), data, sample_len, format, format_);
convert_host_to_device(
staging_buffer.mapped_memory_get(), data, sample_len, format, device_format_);
VkBufferImageCopy region = {};
region.imageExtent.width = extent.x;
@ -291,7 +294,7 @@ void VKTexture::update_sub(
region.imageOffset.x = offset[0];
region.imageOffset.y = offset[1];
region.imageOffset.z = offset[2];
region.imageSubresource.aspectMask = to_vk_image_aspect_flag_bits(format_);
region.imageSubresource.aspectMask = to_vk_image_aspect_flag_bits(device_format_);
region.imageSubresource.mipLevel = mip;
region.imageSubresource.layerCount = layers;
@ -320,11 +323,12 @@ bool VKTexture::init_internal()
{
const VKDevice &device = VKBackend::get().device_get();
const VKWorkarounds &workarounds = device.workarounds_get();
if (format_ == GPU_DEPTH_COMPONENT24 && workarounds.not_aligned_pixel_formats) {
format_ = GPU_DEPTH_COMPONENT32F;
device_format_ = format_;
if (device_format_ == GPU_DEPTH_COMPONENT24 && workarounds.not_aligned_pixel_formats) {
device_format_ = GPU_DEPTH_COMPONENT32F;
}
if (format_ == GPU_DEPTH24_STENCIL8 && workarounds.not_aligned_pixel_formats) {
format_ = GPU_DEPTH32F_STENCIL8;
if (device_format_ == GPU_DEPTH24_STENCIL8 && workarounds.not_aligned_pixel_formats) {
device_format_ = GPU_DEPTH32F_STENCIL8;
}
if (!allocate()) {
@ -346,7 +350,7 @@ bool VKTexture::init_internal(GPUVertBuf *vbo)
region.imageExtent.width = w_;
region.imageExtent.height = 1;
region.imageExtent.depth = 1;
region.imageSubresource.aspectMask = to_vk_image_aspect_flag_bits(format_);
region.imageSubresource.aspectMask = to_vk_image_aspect_flag_bits(device_format_);
region.imageSubresource.mipLevel = 0;
region.imageSubresource.layerCount = 1;
@ -366,6 +370,7 @@ bool VKTexture::init_internal(GPUTexture *src, int mip_offset, int layer_offset,
VKTexture *texture = unwrap(unwrap(src));
source_texture_ = texture;
device_format_ = texture->device_format_;
mip_min_ = mip_offset;
mip_max_ = mip_offset;
layer_offset_ = layer_offset;
@ -454,7 +459,7 @@ bool VKTexture::allocate()
image_info.extent = vk_extent_3d(0);
image_info.mipLevels = max_ii(mipmaps_, 1);
image_info.arrayLayers = vk_layer_count(1);
image_info.format = to_vk_format(format_);
image_info.format = to_vk_format(device_format_);
/* Some platforms (NVIDIA) requires that attached textures are always tiled optimal.
*
* As image data are always accessed via an staging buffer we can enable optimal tiling for all
@ -581,7 +586,7 @@ void VKTexture::layout_ensure(VKContext &context,
barrier.srcAccessMask = src_access;
barrier.dstAccessMask = dst_access;
barrier.image = vk_image_;
barrier.subresourceRange.aspectMask = to_vk_image_aspect_flag_bits(format_);
barrier.subresourceRange.aspectMask = to_vk_image_aspect_flag_bits(device_format_);
barrier.subresourceRange.baseMipLevel = uint32_t(mipmap_range.start());
barrier.subresourceRange.levelCount = uint32_t(mipmap_range.size());
barrier.subresourceRange.baseArrayLayer = 0;

View File

@ -19,6 +19,14 @@ namespace blender::gpu {
class VKSampler;
class VKTexture : public Texture, public VKBindableResource {
/**
* Texture format how the texture is stored on the device.
*
* This can be a different format then #Texture.format_ in case the texture format isn't natively
* supported by the device.
*/
eGPUTextureFormat device_format_ = (eGPUTextureFormat)-1;
/** When set the instance is considered to be a texture view from `source_texture_` */
VKTexture *source_texture_ = nullptr;
VkImage vk_image_ = VK_NULL_HANDLE;
@ -87,6 +95,14 @@ class VKTexture : public Texture, public VKBindableResource {
return vk_image_;
}
/**
* Get the texture format how the texture is stored on the device.
*/
eGPUTextureFormat device_format_get() const
{
return device_format_;
}
protected:
bool init_internal() override;
bool init_internal(GPUVertBuf *vbo) override;

View File

@ -25,17 +25,27 @@
static bool imb_is_grayscale_texture_format_compatible(const ImBuf *ibuf)
{
if (ibuf->planes > 8) {
return false;
}
if (ibuf->byte_buffer.data && !ibuf->float_buffer.data) {
/* TODO: Support grayscale byte buffers.
* The challenge is that Blender always stores byte images as RGBA. */
return false;
if (IMB_colormanagement_space_is_srgb(ibuf->byte_buffer.colorspace) ||
IMB_colormanagement_space_is_scene_linear(ibuf->byte_buffer.colorspace))
{
/* Grey-scale byte buffers with these color transforms utilize float buffers under the hood
* and can therefore be optimized. */
return true;
}
else {
/* TODO: Support gray-scale byte buffers.
* The challenge is that Blender always stores byte images as RGBA. */
return false;
}
}
if (ibuf->channels != 1) {
return false;
}
/* Only imbufs with colorspace that do not modify the chrominance of the texture data relative
/* Only #IMBuf's with color-space that do not modify the chrominance of the texture data relative
* to the scene color space can be uploaded as single channel textures. */
if (IMB_colormanagement_space_is_data(ibuf->float_buffer.colorspace) ||
IMB_colormanagement_space_is_srgb(ibuf->float_buffer.colorspace) ||
@ -49,7 +59,6 @@ static bool imb_is_grayscale_texture_format_compatible(const ImBuf *ibuf)
static void imb_gpu_get_format(const ImBuf *ibuf,
bool high_bitdepth,
bool use_grayscale,
eGPUDataFormat *r_data_format,
eGPUTextureFormat *r_texture_format)
{
const bool float_rect = (ibuf->float_buffer.data != nullptr);
@ -58,7 +67,6 @@ static void imb_gpu_get_format(const ImBuf *ibuf,
if (float_rect) {
/* Float. */
const bool use_high_bitdepth = (!(ibuf->flags & IB_halffloat) && high_bitdepth);
*r_data_format = GPU_DATA_FLOAT;
*r_texture_format = is_grayscale ? (use_high_bitdepth ? GPU_R32F : GPU_R16F) :
(use_high_bitdepth ? GPU_RGBA32F : GPU_RGBA16F);
}
@ -67,17 +75,14 @@ static void imb_gpu_get_format(const ImBuf *ibuf,
IMB_colormanagement_space_is_scene_linear(ibuf->byte_buffer.colorspace))
{
/* Non-color data or scene linear, just store buffer as is. */
*r_data_format = GPU_DATA_UBYTE;
*r_texture_format = (is_grayscale) ? GPU_R8 : GPU_RGBA8;
}
else if (IMB_colormanagement_space_is_srgb(ibuf->byte_buffer.colorspace)) {
/* sRGB, store as byte texture that the GPU can decode directly. */
*r_data_format = (is_grayscale) ? GPU_DATA_FLOAT : GPU_DATA_UBYTE;
*r_texture_format = (is_grayscale) ? GPU_R16F : GPU_SRGB8_A8;
}
else {
/* Other colorspace, store as half float texture to avoid precision loss. */
*r_data_format = GPU_DATA_FLOAT;
*r_texture_format = (is_grayscale) ? GPU_R16F : GPU_RGBA16F;
}
}
@ -119,7 +124,8 @@ static void *imb_gpu_get_data(const ImBuf *ibuf,
const bool do_rescale,
const int rescale_size[2],
const bool store_premultiplied,
bool *r_freedata)
bool *r_freedata,
eGPUDataFormat *out_data_format)
{
bool is_float_rect = (ibuf->float_buffer.data != nullptr);
const bool is_grayscale = imb_is_grayscale_texture_format_compatible(ibuf);
@ -245,6 +251,8 @@ static void *imb_gpu_get_data(const ImBuf *ibuf,
}
}
}
*out_data_format = (is_float_rect) ? GPU_DATA_FLOAT : GPU_DATA_UBYTE;
return data_rect;
}
@ -256,9 +264,8 @@ GPUTexture *IMB_touch_gpu_texture(const char *name,
bool use_high_bitdepth,
bool use_grayscale)
{
eGPUDataFormat data_format;
eGPUTextureFormat tex_format;
imb_gpu_get_format(ibuf, use_high_bitdepth, use_grayscale, &data_format, &tex_format);
imb_gpu_get_format(ibuf, use_high_bitdepth, use_grayscale, &tex_format);
GPUTexture *tex;
if (layers > 0) {
@ -301,13 +308,13 @@ void IMB_update_gpu_texture_sub(GPUTexture *tex,
const bool do_rescale = (ibuf->x != w || ibuf->y != h);
const int size[2] = {w, h};
eGPUDataFormat data_format;
eGPUTextureFormat tex_format;
imb_gpu_get_format(ibuf, use_high_bitdepth, use_grayscale, &data_format, &tex_format);
imb_gpu_get_format(ibuf, use_high_bitdepth, use_grayscale, &tex_format);
bool freebuf = false;
void *data = imb_gpu_get_data(ibuf, do_rescale, size, use_premult, &freebuf);
eGPUDataFormat data_format;
void *data = imb_gpu_get_data(ibuf, do_rescale, size, use_premult, &freebuf, &data_format);
/* Update Texture. */
GPU_texture_update_sub(tex, data_format, data, x, y, z, w, h, 1);
@ -366,9 +373,8 @@ GPUTexture *IMB_create_gpu_texture(const char *name,
fprintf(stderr, " falling back to uncompressed.\n");
}
eGPUDataFormat data_format;
eGPUTextureFormat tex_format;
imb_gpu_get_format(ibuf, use_high_bitdepth, true, &data_format, &tex_format);
imb_gpu_get_format(ibuf, use_high_bitdepth, true, &tex_format);
bool freebuf = false;
@ -391,7 +397,8 @@ GPUTexture *IMB_create_gpu_texture(const char *name,
do_rescale = true;
}
BLI_assert(tex != nullptr);
void *data = imb_gpu_get_data(ibuf, do_rescale, size, use_premult, &freebuf);
eGPUDataFormat data_format;
void *data = imb_gpu_get_data(ibuf, do_rescale, size, use_premult, &freebuf, &data_format);
GPU_texture_update(tex, data_format, data);
GPU_texture_swizzle_set(tex, imb_gpu_get_swizzle(ibuf));
@ -409,10 +416,7 @@ eGPUTextureFormat IMB_gpu_get_texture_format(const ImBuf *ibuf,
bool use_grayscale)
{
eGPUTextureFormat gpu_texture_format;
eGPUDataFormat gpu_data_format;
imb_gpu_get_format(ibuf, high_bitdepth, use_grayscale, &gpu_data_format, &gpu_texture_format);
imb_gpu_get_format(ibuf, high_bitdepth, use_grayscale, &gpu_texture_format);
return gpu_texture_format;
}

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