Mesh: Replace auto smooth with node group #108014

Merged
Hans Goudey merged 149 commits from HooglyBoogly/blender:refactor-mesh-corner-normals-lazy into main 2023-10-20 16:54:20 +02:00
114 changed files with 824 additions and 986 deletions
Showing only changes of commit dc6d2e9a5e - Show all commits

View File

@ -523,27 +523,6 @@ static ShaderNode *add_node(Scene *scene,
else if (b_node.is_a(&RNA_ShaderNodeHoldout)) {
node = graph->create_node<HoldoutNode>();
}
else if (b_node.is_a(&RNA_ShaderNodeBsdfAnisotropic)) {
BL::ShaderNodeBsdfAnisotropic b_aniso_node(b_node);
AnisotropicBsdfNode *aniso = graph->create_node<AnisotropicBsdfNode>();
switch (b_aniso_node.distribution()) {
case BL::ShaderNodeBsdfAnisotropic::distribution_BECKMANN:
aniso->set_distribution(CLOSURE_BSDF_MICROFACET_BECKMANN_ID);
break;
case BL::ShaderNodeBsdfAnisotropic::distribution_GGX:
aniso->set_distribution(CLOSURE_BSDF_MICROFACET_GGX_ID);
break;
case BL::ShaderNodeBsdfAnisotropic::distribution_MULTI_GGX:
aniso->set_distribution(CLOSURE_BSDF_MICROFACET_MULTI_GGX_ID);
break;
case BL::ShaderNodeBsdfAnisotropic::distribution_ASHIKHMIN_SHIRLEY:
aniso->set_distribution(CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ID);
break;
}
node = aniso;
}
else if (b_node.is_a(&RNA_ShaderNodeBsdfDiffuse)) {
node = graph->create_node<DiffuseBsdfNode>();
}
@ -566,24 +545,21 @@ static ShaderNode *add_node(Scene *scene,
node = subsurface;
}
else if (b_node.is_a(&RNA_ShaderNodeBsdfGlossy)) {
BL::ShaderNodeBsdfGlossy b_glossy_node(b_node);
else if (b_node.is_a(&RNA_ShaderNodeBsdfAnisotropic)) {
BL::ShaderNodeBsdfAnisotropic b_glossy_node(b_node);
GlossyBsdfNode *glossy = graph->create_node<GlossyBsdfNode>();
switch (b_glossy_node.distribution()) {
case BL::ShaderNodeBsdfGlossy::distribution_SHARP:
glossy->set_distribution(CLOSURE_BSDF_REFLECTION_ID);
break;
case BL::ShaderNodeBsdfGlossy::distribution_BECKMANN:
case BL::ShaderNodeBsdfAnisotropic::distribution_BECKMANN:
glossy->set_distribution(CLOSURE_BSDF_MICROFACET_BECKMANN_ID);
break;
case BL::ShaderNodeBsdfGlossy::distribution_GGX:
case BL::ShaderNodeBsdfAnisotropic::distribution_GGX:
glossy->set_distribution(CLOSURE_BSDF_MICROFACET_GGX_ID);
break;
case BL::ShaderNodeBsdfGlossy::distribution_ASHIKHMIN_SHIRLEY:
case BL::ShaderNodeBsdfAnisotropic::distribution_ASHIKHMIN_SHIRLEY:
glossy->set_distribution(CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ID);
break;
case BL::ShaderNodeBsdfGlossy::distribution_MULTI_GGX:
case BL::ShaderNodeBsdfAnisotropic::distribution_MULTI_GGX:
glossy->set_distribution(CLOSURE_BSDF_MICROFACET_MULTI_GGX_ID);
break;
}
@ -593,9 +569,6 @@ static ShaderNode *add_node(Scene *scene,
BL::ShaderNodeBsdfGlass b_glass_node(b_node);
GlassBsdfNode *glass = graph->create_node<GlassBsdfNode>();
switch (b_glass_node.distribution()) {
case BL::ShaderNodeBsdfGlass::distribution_SHARP:
glass->set_distribution(CLOSURE_BSDF_SHARP_GLASS_ID);
break;
case BL::ShaderNodeBsdfGlass::distribution_BECKMANN:
glass->set_distribution(CLOSURE_BSDF_MICROFACET_BECKMANN_GLASS_ID);
break;
@ -612,9 +585,6 @@ static ShaderNode *add_node(Scene *scene,
BL::ShaderNodeBsdfRefraction b_refraction_node(b_node);
RefractionBsdfNode *refraction = graph->create_node<RefractionBsdfNode>();
switch (b_refraction_node.distribution()) {
case BL::ShaderNodeBsdfRefraction::distribution_SHARP:
refraction->set_distribution(CLOSURE_BSDF_REFRACTION_ID);
break;
case BL::ShaderNodeBsdfRefraction::distribution_BECKMANN:
refraction->set_distribution(CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID);
break;

View File

@ -6,7 +6,6 @@
set(SRC_OSL
node_add_closure.osl
node_ambient_occlusion.osl
node_anisotropic_bsdf.osl
node_attribute.osl
node_background.osl
node_bevel.osl

View File

@ -1,45 +0,0 @@
/* SPDX-License-Identifier: Apache-2.0
* Copyright 2011-2022 Blender Foundation */
#include "stdcycles.h"
shader node_anisotropic_bsdf(color Color = 0.0,
string distribution = "GGX",
float Roughness = 0.0,
float Anisotropy = 0.0,
float Rotation = 0.0,
normal Normal = N,
normal Tangent = normalize(dPdu),
output closure color BSDF = 0)
{
/* rotate tangent around normal */
vector T = Tangent;
if (Rotation != 0.0)
T = rotate(T, Rotation * M_2PI, point(0.0, 0.0, 0.0), Normal);
/* compute roughness */
float roughness = Roughness * Roughness;
float roughness_u, roughness_v;
float aniso = clamp(Anisotropy, -0.99, 0.99);
if (aniso < 0.0) {
roughness_u = roughness / (1.0 + aniso);
roughness_v = roughness * (1.0 + aniso);
}
else {
roughness_u = roughness * (1.0 - aniso);
roughness_v = roughness / (1.0 - aniso);
}
if (distribution == "sharp")
BSDF = Color * reflection(Normal);
else if (distribution == "beckmann")
BSDF = Color * microfacet_beckmann_aniso(Normal, T, roughness_u, roughness_v);
else if (distribution == "GGX")
BSDF = Color * microfacet_ggx_aniso(Normal, T, roughness_u, roughness_v);
else if (distribution == "Multiscatter GGX")
BSDF = Color * microfacet_multi_ggx_aniso(Normal, T, roughness_u, roughness_v, Color);
else
BSDF = Color * ashikhmin_shirley(Normal, T, roughness_u, roughness_v);
}

View File

@ -7,13 +7,40 @@
shader node_glossy_bsdf(color Color = 0.8,
string distribution = "ggx",
float Roughness = 0.2,
float Anisotropy = 0.0,
float Rotation = 0.0,
normal Normal = N,
normal Tangent = 0.0,
output closure color BSDF = 0)
{
/* compute roughness */
float roughness = Roughness * Roughness;
float roughness_u, roughness_v;
float aniso = clamp(Anisotropy, -0.99, 0.99);
/* rotate tangent around normal */
vector T = Tangent;
if (abs(aniso) <= 1e-4) {
roughness_u = roughness;
roughness_v = roughness;
}
else {
if (Rotation != 0.0)
T = rotate(T, Rotation * M_2PI, point(0.0, 0.0, 0.0), Normal);
if (aniso < 0.0) {
roughness_u = roughness / (1.0 + aniso);
roughness_v = roughness * (1.0 + aniso);
}
else {
roughness_u = roughness * (1.0 - aniso);
roughness_v = roughness / (1.0 - aniso);
}
}
if (distribution == "Multiscatter GGX")
BSDF = Color * microfacet_multi_ggx(Normal, roughness, Color);
else
BSDF = Color * microfacet(distribution, Normal, roughness, 0.0, 0);
BSDF = Color * microfacet(distribution, Normal, T, roughness_u, roughness_v, 0.0, 0);
}

View File

@ -494,7 +494,10 @@ ccl_device_noinline int svm_node_closure_bsdf(KernelGlobals kg,
bsdf->ior = 1.0f;
bsdf->fresnel = NULL;
if (data_node.y == SVM_STACK_INVALID) {
/* compute roughness */
float anisotropy = clamp(param2, -0.99f, 0.99f);
if (data_node.y == SVM_STACK_INVALID || fabsf(anisotropy) <= 1e-4f) {
/* Isotropic case. */
bsdf->T = zero_float3();
bsdf->alpha_x = roughness;
bsdf->alpha_y = roughness;
@ -507,8 +510,6 @@ ccl_device_noinline int svm_node_closure_bsdf(KernelGlobals kg,
if (rotation != 0.0f)
bsdf->T = rotate_around_axis(bsdf->T, bsdf->N, rotation * M_2PI_F);
/* compute roughness */
float anisotropy = clamp(param2, -0.99f, 0.99f);
if (anisotropy < 0.0f) {
bsdf->alpha_x = roughness / (1.0f + anisotropy);
bsdf->alpha_y = roughness * (1.0f + anisotropy);

View File

@ -2335,68 +2335,6 @@ void BsdfNode::compile(OSLCompiler & /*compiler*/)
assert(0);
}
/* Anisotropic BSDF Closure */
NODE_DEFINE(AnisotropicBsdfNode)
{
NodeType *type = NodeType::add("anisotropic_bsdf", create, NodeType::SHADER);
SOCKET_IN_COLOR(color, "Color", make_float3(0.8f, 0.8f, 0.8f));
SOCKET_IN_NORMAL(normal, "Normal", zero_float3(), SocketType::LINK_NORMAL);
SOCKET_IN_FLOAT(surface_mix_weight, "SurfaceMixWeight", 0.0f, SocketType::SVM_INTERNAL);
static NodeEnum distribution_enum;
distribution_enum.insert("beckmann", CLOSURE_BSDF_MICROFACET_BECKMANN_ID);
distribution_enum.insert("GGX", CLOSURE_BSDF_MICROFACET_GGX_ID);
distribution_enum.insert("Multiscatter GGX", CLOSURE_BSDF_MICROFACET_MULTI_GGX_ID);
distribution_enum.insert("ashikhmin_shirley", CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ID);
SOCKET_ENUM(distribution, "Distribution", distribution_enum, CLOSURE_BSDF_MICROFACET_GGX_ID);
SOCKET_IN_VECTOR(tangent, "Tangent", zero_float3(), SocketType::LINK_TANGENT);
SOCKET_IN_FLOAT(roughness, "Roughness", 0.5f);
SOCKET_IN_FLOAT(anisotropy, "Anisotropy", 0.5f);
SOCKET_IN_FLOAT(rotation, "Rotation", 0.0f);
SOCKET_OUT_CLOSURE(BSDF, "BSDF");
return type;
}
AnisotropicBsdfNode::AnisotropicBsdfNode() : BsdfNode(get_node_type())
{
closure = CLOSURE_BSDF_MICROFACET_GGX_ID;
}
void AnisotropicBsdfNode::attributes(Shader *shader, AttributeRequestSet *attributes)
{
if (shader->has_surface_link()) {
ShaderInput *tangent_in = input("Tangent");
if (!tangent_in->link)
attributes->add(ATTR_STD_GENERATED);
}
ShaderNode::attributes(shader, attributes);
}
void AnisotropicBsdfNode::compile(SVMCompiler &compiler)
{
closure = distribution;
if (closure == CLOSURE_BSDF_MICROFACET_MULTI_GGX_ID)
BsdfNode::compile(
compiler, input("Roughness"), input("Anisotropy"), input("Rotation"), input("Color"));
else
BsdfNode::compile(compiler, input("Roughness"), input("Anisotropy"), input("Rotation"));
}
void AnisotropicBsdfNode::compile(OSLCompiler &compiler)
{
compiler.parameter(this, "distribution");
compiler.add(this, "node_anisotropic_bsdf");
}
/* Glossy BSDF Closure */
NODE_DEFINE(GlossyBsdfNode)
@ -2414,7 +2352,12 @@ NODE_DEFINE(GlossyBsdfNode)
distribution_enum.insert("ashikhmin_shirley", CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ID);
distribution_enum.insert("Multiscatter GGX", CLOSURE_BSDF_MICROFACET_MULTI_GGX_ID);
SOCKET_ENUM(distribution, "Distribution", distribution_enum, CLOSURE_BSDF_MICROFACET_GGX_ID);
SOCKET_IN_VECTOR(tangent, "Tangent", zero_float3(), SocketType::LINK_TANGENT);
SOCKET_IN_FLOAT(roughness, "Roughness", 0.5f);
SOCKET_IN_FLOAT(anisotropy, "Anisotropy", 0.0f);
SOCKET_IN_FLOAT(rotation, "Rotation", 0.0f);
SOCKET_OUT_CLOSURE(BSDF, "BSDF");
@ -2427,8 +2370,32 @@ GlossyBsdfNode::GlossyBsdfNode() : BsdfNode(get_node_type())
distribution_orig = NBUILTIN_CLOSURES;
}
bool GlossyBsdfNode::is_isotropic()
{
ShaderInput *anisotropy_input = input("Anisotropy");
/* Keep in sync with the thresholds in OSL's node_glossy_bsdf and SVM's svm_node_closure_bsdf. */
return (!anisotropy_input->link && fabsf(anisotropy) <= 1e-4f);
}
void GlossyBsdfNode::attributes(Shader *shader, AttributeRequestSet *attributes)
{
if (shader->has_surface_link()) {
ShaderInput *tangent_in = input("Tangent");
if (!tangent_in->link && !is_isotropic())
attributes->add(ATTR_STD_GENERATED);
}
ShaderNode::attributes(shader, attributes);
}
void GlossyBsdfNode::simplify_settings(Scene *scene)
{
/* If the anisotropy is close enough to zero, fall back to the isotropic case. */
ShaderInput *tangent_input = input("Tangent");
if (tangent_input->link && is_isotropic()) {
tangent_input->disconnect();
}
if (distribution_orig == NBUILTIN_CLOSURES) {
roughness_orig = roughness;
distribution_orig = distribution;
@ -2478,9 +2445,10 @@ void GlossyBsdfNode::compile(SVMCompiler &compiler)
if (closure == CLOSURE_BSDF_REFLECTION_ID)
BsdfNode::compile(compiler, NULL, NULL);
else if (closure == CLOSURE_BSDF_MICROFACET_MULTI_GGX_ID)
BsdfNode::compile(compiler, input("Roughness"), NULL, NULL, input("Color"));
BsdfNode::compile(
compiler, input("Roughness"), input("Anisotropy"), input("Rotation"), input("Color"));
else
BsdfNode::compile(compiler, input("Roughness"), NULL);
BsdfNode::compile(compiler, input("Roughness"), input("Anisotropy"), input("Rotation"));
}
void GlossyBsdfNode::compile(OSLCompiler &compiler)

View File

@ -495,27 +495,6 @@ class BsdfNode : public BsdfBaseNode {
NODE_SOCKET_API(float, surface_mix_weight)
};
class AnisotropicBsdfNode : public BsdfNode {
public:
SHADER_NODE_CLASS(AnisotropicBsdfNode)
NODE_SOCKET_API(float3, tangent)
NODE_SOCKET_API(float, roughness)
NODE_SOCKET_API(float, anisotropy)
NODE_SOCKET_API(float, rotation)
NODE_SOCKET_API(ClosureType, distribution)
ClosureType get_closure_type()
{
return distribution;
}
void attributes(Shader *shader, AttributeRequestSet *attributes);
bool has_attribute_dependency()
{
return true;
}
};
class DiffuseBsdfNode : public BsdfNode {
public:
SHADER_NODE_CLASS(DiffuseBsdfNode)
@ -624,12 +603,23 @@ class GlossyBsdfNode : public BsdfNode {
return distribution;
}
NODE_SOCKET_API(float3, tangent)
NODE_SOCKET_API(float, roughness)
NODE_SOCKET_API(float, anisotropy)
NODE_SOCKET_API(float, rotation)
NODE_SOCKET_API(ClosureType, distribution)
void attributes(Shader *shader, AttributeRequestSet *attributes);
bool has_attribute_dependency()
{
return true;
}
private:
float roughness_orig;
ClosureType distribution_orig;
bool is_isotropic();
};
class GlassBsdfNode : public BsdfNode {

View File

@ -567,29 +567,15 @@ ccl_device_inline float triangle_area(ccl_private const float3 &v1,
/* Orthonormal vectors */
ccl_device_inline void make_orthonormals(const float3 N,
ccl_private float3 *a,
ccl_private float3 *b)
ccl_private float3 *T,
ccl_private float3 *B)
{
#if 0
if (fabsf(N.y) >= 0.999f) {
*a = make_float3(1, 0, 0);
*b = make_float3(0, 0, 1);
return;
}
if (fabsf(N.z) >= 0.999f) {
*a = make_float3(1, 0, 0);
*b = make_float3(0, 1, 0);
return;
}
#endif
if (N.x != N.y || N.x != N.z)
*a = make_float3(N.z - N.y, N.x - N.z, N.y - N.x); //(1,1,1)x N
else
*a = make_float3(N.z - N.y, N.x + N.z, -N.y - N.x); //(-1,1,1)x N
*a = normalize(*a);
*b = cross(N, *a);
/* Duff, Tom, et al. "Building an orthonormal basis, revisited." JCGT 6.1 (2017). */
float sign = signf(N.z);
float a = -1.0f / (sign + N.z);
float b = N.x * N.y * a;
*T = make_float3(1.0f + sign * N.x * N.x * a, sign * b, -sign * N.x);
*B = make_float3(b, sign + N.y * N.y * a, -N.y);
}
/* Color division */

View File

@ -1002,6 +1002,10 @@ static void gwl_display_destroy(GWL_Display *display)
delete display->ghost_timer_manager;
display->ghost_timer_manager = nullptr;
}
/* Pending events may be left unhandled. */
for (GHOST_IEvent *event : display->events_pending) {
delete event;
}
#endif /* USE_EVENT_BACKGROUND_THREAD */
@ -2304,7 +2308,7 @@ static void data_device_handle_enter(void *data,
const wl_fixed_t y,
struct wl_data_offer *id)
{
if (!ghost_wl_surface_own(wl_surface)) {
if (!ghost_wl_surface_own_with_null_check(wl_surface)) {
CLOG_INFO(LOG, 2, "enter (skipped)");
return;
}
@ -2639,7 +2643,8 @@ static void pointer_handle_enter(void *data,
const wl_fixed_t surface_x,
const wl_fixed_t surface_y)
{
if (!ghost_wl_surface_own(wl_surface)) {
/* Null when just destroyed. */
if (!ghost_wl_surface_own_with_null_check(wl_surface)) {
CLOG_INFO(LOG, 2, "enter (skipped)");
return;
}
@ -2678,12 +2683,11 @@ static void pointer_handle_leave(void *data,
{
/* First clear the `pointer.wl_surface`, since the window won't exist when closing the window. */
static_cast<GWL_Seat *>(data)->pointer.wl_surface_window = nullptr;
if (wl_surface && ghost_wl_surface_own(wl_surface)) {
CLOG_INFO(LOG, 2, "leave");
}
else {
if (!ghost_wl_surface_own_with_null_check(wl_surface)) {
CLOG_INFO(LOG, 2, "leave (skipped)");
return;
}
CLOG_INFO(LOG, 2, "leave");
}
static void pointer_handle_motion(void *data,
@ -3320,7 +3324,7 @@ static void tablet_tool_handle_proximity_in(void *data,
struct zwp_tablet_v2 * /*tablet*/,
struct wl_surface *wl_surface)
{
if (!ghost_wl_surface_own(wl_surface)) {
if (!ghost_wl_surface_own_with_null_check(wl_surface)) {
CLOG_INFO(LOG, 2, "proximity_in (skipped)");
return;
}
@ -3739,7 +3743,8 @@ static void keyboard_handle_enter(void *data,
struct wl_surface *wl_surface,
struct wl_array *keys)
{
if (!ghost_wl_surface_own(wl_surface)) {
/* Null when just destroyed. */
if (!ghost_wl_surface_own_with_null_check(wl_surface)) {
CLOG_INFO(LOG, 2, "enter (skipped)");
return;
}
@ -3781,7 +3786,7 @@ static void keyboard_handle_leave(void *data,
const uint32_t /*serial*/,
struct wl_surface *wl_surface)
{
if (!(wl_surface && ghost_wl_surface_own(wl_surface))) {
if (!ghost_wl_surface_own_with_null_check(wl_surface)) {
CLOG_INFO(LOG, 2, "leave (skipped)");
return;
}
@ -5465,6 +5470,13 @@ static void *gwl_display_event_thread_fn(void *display_voidp)
break;
}
}
/* Wait until the main thread cancels this thread, otherwise this thread may exit
* before cancel is called, causing a crash on exit. */
while (true) {
pause();
}
return nullptr;
}
@ -6858,6 +6870,11 @@ bool ghost_wl_surface_own(const struct wl_surface *wl_surface)
return wl_proxy_get_tag((struct wl_proxy *)wl_surface) == &ghost_wl_surface_tag_id;
}
bool ghost_wl_surface_own_with_null_check(const struct wl_surface *wl_surface)
{
return wl_surface && ghost_wl_surface_own(wl_surface);
}
bool ghost_wl_surface_own_cursor_pointer(const struct wl_surface *wl_surface)
{
return wl_proxy_get_tag((struct wl_proxy *)wl_surface) ==

View File

@ -37,6 +37,14 @@ bool ghost_wl_output_own(const struct wl_output *wl_output);
void ghost_wl_output_tag(struct wl_output *wl_output);
struct GWL_Output *ghost_wl_output_user_data(struct wl_output *wl_output);
/**
* Enter/exit handlers may be called with a null window surface (when the window just closed),
* so add a version of the function that checks this.
*
* All of the functions could in fact however paranoid null checks make the expected
* state difficult to reason about, so only use this in cases the surface may be null.
*/
bool ghost_wl_surface_own_with_null_check(const struct wl_surface *wl_surface);
bool ghost_wl_surface_own(const struct wl_surface *wl_surface);
void ghost_wl_surface_tag(struct wl_surface *wl_surface);
GHOST_WindowWayland *ghost_wl_surface_user_data(struct wl_surface *wl_surface);

View File

@ -486,16 +486,6 @@ class DATA_PT_customdata(MeshButtonsPanel, Panel):
col.operator("mesh.customdata_mask_clear", icon='X')
col.operator("mesh.customdata_skin_clear", icon='X')
if me.has_bevel_weight_edge:
col.operator("mesh.customdata_bevel_weight_edge_clear", icon='X')
else:
col.operator("mesh.customdata_bevel_weight_edge_add", icon='ADD')
if me.has_bevel_weight_vertex:
col.operator("mesh.customdata_bevel_weight_vertex_clear", icon='X')
else:
col.operator("mesh.customdata_bevel_weight_vertex_add", icon='ADD')
if me.has_crease_edge:
col.operator("mesh.customdata_crease_edge_clear", icon='X')
else:

View File

@ -434,6 +434,7 @@ class SEQUENCER_MT_view(Menu):
if is_sequencer_view:
layout.operator_context = 'INVOKE_REGION_WIN'
layout.operator("sequencer.view_all")
layout.operator("sequencer.view_frame")
layout.operator("view2d.zoom_border", text="Zoom")
layout.prop(st, "use_clamp_view")

View File

@ -155,6 +155,17 @@ class VIEW3D_PT_tools_meshedit_options(View3DPanel, Panel):
bl_options = {'DEFAULT_CLOSED'}
bl_ui_units_x = 12
def draw(self, _context):
# layout = self.layout
pass
class VIEW3D_PT_tools_meshedit_options_transform(View3DPanel, Panel):
bl_category = "Tool"
bl_context = ".mesh_edit" # dot on purpose (access from topbar)
bl_label = "Transform"
bl_parent_id = "VIEW3D_PT_tools_meshedit_options"
@classmethod
def poll(cls, context):
return context.active_object
@ -169,56 +180,47 @@ class VIEW3D_PT_tools_meshedit_options(View3DPanel, Panel):
ob = context.active_object
mesh = ob.data
row = layout.row(align=True, heading="Transform")
row.prop(tool_settings, "use_transform_correct_face_attributes")
col = layout.column(align=True)
col.prop(tool_settings, "use_transform_correct_face_attributes")
sub = col.column(align=True)
sub.active = tool_settings.use_transform_correct_face_attributes
sub.prop(tool_settings, "use_transform_correct_keep_connected")
col.separator()
row = layout.row(align=True)
row.active = tool_settings.use_transform_correct_face_attributes
row.prop(tool_settings, "use_transform_correct_keep_connected")
row = layout.row(align=True, heading="UVs")
row.prop(tool_settings, "use_edge_path_live_unwrap")
row = layout.row(heading="Mirror")
sub = row.row(align=True)
col = layout.column(heading="Mirror")
sub = col.row(align=True)
sub.prop(mesh, "use_mirror_x", text="X", toggle=True)
sub.prop(mesh, "use_mirror_y", text="Y", toggle=True)
sub.prop(mesh, "use_mirror_z", text="Z", toggle=True)
row = layout.row(align=True)
row.active = ob.data.use_mirror_x or ob.data.use_mirror_y or ob.data.use_mirror_z
row.prop(mesh, "use_mirror_topology")
col = layout.column(align=True)
col.active = mesh.use_mirror_x or mesh.use_mirror_y or mesh.use_mirror_z
col.prop(mesh, "use_mirror_topology")
col.separator()
col = layout.column(align=True)
col.prop(tool_settings, "use_mesh_automerge", text="Auto Merge", toggle=False)
sub = col.column(align=True)
sub.active = tool_settings.use_mesh_automerge
sub.prop(tool_settings, "use_mesh_automerge_and_split", toggle=False)
sub.prop(tool_settings, "double_threshold", text="Threshold")
class VIEW3D_PT_tools_meshedit_options_automerge(View3DPanel, Panel):
class VIEW3D_PT_tools_meshedit_options_uvs(View3DPanel, Panel):
bl_category = "Tool"
bl_context = ".mesh_edit" # dot on purpose (access from topbar)
bl_label = "Auto Merge"
bl_label = "UVs"
bl_parent_id = "VIEW3D_PT_tools_meshedit_options"
bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
return context.active_object
def draw_header(self, context):
tool_settings = context.tool_settings
self.layout.use_property_split = False
self.layout.prop(tool_settings, "use_mesh_automerge",
text=self.bl_label if self.is_popover else "", toggle=False)
def draw(self, context):
layout = self.layout
layout.use_property_decorate = False
layout.use_property_split = True
tool_settings = context.tool_settings
layout.use_property_split = True
layout.use_property_decorate = False
col = layout.column(align=True)
col.active = tool_settings.use_mesh_automerge
col.prop(tool_settings, "use_mesh_automerge_and_split", toggle=False)
col.prop(tool_settings, "double_threshold", text="Threshold")
layout.prop(tool_settings, "use_edge_path_live_unwrap")
# ********** default tools for editmode_armature ****************
@ -2368,7 +2370,8 @@ classes = (
VIEW3D_PT_tools_object_options,
VIEW3D_PT_tools_object_options_transform,
VIEW3D_PT_tools_meshedit_options,
VIEW3D_PT_tools_meshedit_options_automerge,
VIEW3D_PT_tools_meshedit_options_transform,
VIEW3D_PT_tools_meshedit_options_uvs,
VIEW3D_PT_tools_armatureedit_options,
VIEW3D_PT_tools_posemode_options,

View File

@ -191,7 +191,6 @@ shader_node_categories = [
NodeItem("ShaderNodeBsdfRefraction", poll=object_eevee_cycles_shader_nodes_poll),
NodeItem("ShaderNodeBsdfGlass", poll=object_eevee_cycles_shader_nodes_poll),
NodeItem("ShaderNodeBsdfTranslucent", poll=object_eevee_cycles_shader_nodes_poll),
NodeItem("ShaderNodeBsdfAnisotropic", poll=object_cycles_shader_nodes_poll),
NodeItem("ShaderNodeBsdfVelvet", poll=object_cycles_shader_nodes_poll),
NodeItem("ShaderNodeBsdfToon", poll=object_cycles_shader_nodes_poll),
NodeItem("ShaderNodeSubsurfaceScattering", poll=object_eevee_cycles_shader_nodes_poll),

View File

@ -25,13 +25,13 @@ extern "C" {
/* Blender file format version. */
#define BLENDER_FILE_VERSION BLENDER_VERSION
#define BLENDER_FILE_SUBVERSION 1
#define BLENDER_FILE_SUBVERSION 2
/* Minimum Blender version that supports reading file written with the current
* version. Older Blender versions will test this and show a warning if the file
* was written with too new a version. */
#define BLENDER_FILE_MIN_VERSION 306
#define BLENDER_FILE_MIN_SUBVERSION 9
#define BLENDER_FILE_MIN_VERSION 400
#define BLENDER_FILE_MIN_SUBVERSION 2
/** User readable version string. */
const char *BKE_blender_version_string(void);

View File

@ -703,6 +703,8 @@ enum {
CD_CUSTOMLOOPNORMAL, /* Because we play with clnor and temp lnor layers here. */
CD_FAKE_SHARP = CD_FAKE | 200, /* Sharp flag for edges, smooth flag for faces. */
CD_FAKE_BWEIGHT = CD_FAKE | 300, /* UV seam flag for edges. */
};
enum {

View File

@ -44,6 +44,10 @@ void BKE_mesh_legacy_edge_crease_to_layers(struct Mesh *mesh);
* Copy bevel weights from vertices and edges to separate layers.
*/
void BKE_mesh_legacy_bevel_weight_to_layers(struct Mesh *mesh);
/**
* Move bevel weight to generic float attribute type.
*/
void BKE_mesh_legacy_bevel_weight_to_generic(struct Mesh *mesh);
/**
* Convert the old hide flags (#ME_HIDE) to the hidden element attribute for reading.

View File

@ -554,8 +554,10 @@ struct bNodeSocket *ntreeAddSocketInterface(struct bNodeTree *ntree,
* \{ */
struct bNodeType *nodeTypeFind(const char *idname);
const char *nodeTypeFindAlias(const char *idname);
void nodeRegisterType(struct bNodeType *ntype);
void nodeUnregisterType(struct bNodeType *ntype);
void nodeRegisterAlias(struct bNodeType *nt, const char *alias);
struct GHashIterator *nodeTypeGetIterator(void);
/* Helper macros for iterating over node types. */
@ -893,9 +895,9 @@ void BKE_nodetree_remove_layer_n(struct bNodeTree *ntree, struct Scene *scene, i
#define SH_NODE_MIX_SHADER 128
#define SH_NODE_ATTRIBUTE 129
#define SH_NODE_BACKGROUND 130
#define SH_NODE_BSDF_ANISOTROPIC 131
#define SH_NODE_BSDF_GLOSSY 131
#define SH_NODE_BSDF_DIFFUSE 132
#define SH_NODE_BSDF_GLOSSY 133
#define SH_NODE_BSDF_GLOSSY_LEGACY 133
#define SH_NODE_BSDF_GLASS 134
#define SH_NODE_BSDF_TRANSLUCENT 137
#define SH_NODE_BSDF_TRANSPARENT 138

View File

@ -94,6 +94,9 @@ void txt_sel_clear(struct Text *text);
void txt_sel_line(struct Text *text);
void txt_sel_set(struct Text *text, int startl, int startc, int endl, int endc);
char *txt_sel_to_buf(const struct Text *text, size_t *r_buf_strlen);
/**
* \param in_buffer: UTF8 encoded text, invalid UTF8 byte-sequences are handled gracefully.
*/
void txt_insert_buf(struct Text *text, const char *in_buffer, int in_buffer_len)
ATTR_NONNULL(1, 2);
void txt_split_curline(struct Text *text);

View File

@ -768,7 +768,7 @@ Mesh *curve_to_mesh_sweep(const CurvesGeometry &main,
mesh->tag_loose_verts_none();
if (!offsets.any_single_point_profile) {
/* If there are no single point profiles, every combination will have faces. */
mesh->loose_edges_tag_none();
mesh->tag_loose_edges_none();
}
}

View File

@ -1167,29 +1167,6 @@ static void layerDefault_origindex(void *data, const int count)
copy_vn_i((int *)data, count, ORIGINDEX_NONE);
}
static void layerInterp_bweight(const void **sources,
const float *weights,
const float * /*sub_weights*/,
int count,
void *dest)
{
float **in = (float **)sources;
if (count <= 0) {
return;
}
float f = 0.0f;
for (int i = 0; i < count; i++) {
const float interp_weight = weights[i];
f += *in[i] * interp_weight;
}
/* Delay writing to the destination in case dest is in sources. */
*((float *)dest) = f;
}
static void layerInterp_shapekey(const void **sources,
const float *weights,
const float * /*sub_weights*/,
@ -1786,8 +1763,8 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
{sizeof(int), "", 0, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr},
/* 28: CD_SHAPEKEY */
{sizeof(float[3]), "", 0, N_("ShapeKey"), nullptr, nullptr, layerInterp_shapekey},
/* 29: CD_BWEIGHT */
{sizeof(MFloatProperty), "MFloatProperty", 1, nullptr, nullptr, nullptr, layerInterp_bweight},
/* 29: CD_BWEIGHT */ /* DEPRECATED*/
{sizeof(MFloatProperty), "MFloatProperty", 1},
/* 30: CD_CREASE */
{sizeof(float), "", 0, nullptr, nullptr, nullptr, layerInterp_propFloat},
/* 31: CD_ORIGSPACE_MLOOP */
@ -2043,9 +2020,9 @@ const CustomData_MeshMasks CD_MASK_BAREMESH_ORIGINDEX = {
};
const CustomData_MeshMasks CD_MASK_MESH = {
/*vmask*/ (CD_MASK_PROP_FLOAT3 | CD_MASK_MDEFORMVERT | CD_MASK_MVERT_SKIN |
CD_MASK_PAINT_MASK | CD_MASK_PROP_ALL | CD_MASK_CREASE | CD_MASK_BWEIGHT),
CD_MASK_PAINT_MASK | CD_MASK_PROP_ALL | CD_MASK_CREASE),
/*emask*/
(CD_MASK_FREESTYLE_EDGE | CD_MASK_PROP_ALL | CD_MASK_BWEIGHT | CD_MASK_CREASE),
(CD_MASK_FREESTYLE_EDGE | CD_MASK_PROP_ALL | CD_MASK_CREASE),
/*fmask*/ 0,
/*pmask*/
(CD_MASK_FACEMAP | CD_MASK_FREESTYLE_FACE | CD_MASK_PROP_ALL),
@ -2055,10 +2032,9 @@ const CustomData_MeshMasks CD_MASK_MESH = {
const CustomData_MeshMasks CD_MASK_DERIVEDMESH = {
/*vmask*/ (CD_MASK_ORIGINDEX | CD_MASK_MDEFORMVERT | CD_MASK_SHAPEKEY | CD_MASK_MVERT_SKIN |
CD_MASK_PAINT_MASK | CD_MASK_ORCO | CD_MASK_CLOTH_ORCO | CD_MASK_PROP_ALL |
CD_MASK_CREASE | CD_MASK_BWEIGHT),
CD_MASK_CREASE),
/*emask*/
(CD_MASK_ORIGINDEX | CD_MASK_FREESTYLE_EDGE | CD_MASK_BWEIGHT | CD_MASK_PROP_ALL |
CD_MASK_CREASE),
(CD_MASK_ORIGINDEX | CD_MASK_FREESTYLE_EDGE | CD_MASK_PROP_ALL | CD_MASK_CREASE),
/*fmask*/ (CD_MASK_ORIGINDEX | CD_MASK_ORIGSPACE | CD_MASK_PREVIEW_MCOL | CD_MASK_TANGENT),
/*pmask*/
(CD_MASK_ORIGINDEX | CD_MASK_FREESTYLE_FACE | CD_MASK_FACEMAP | CD_MASK_PROP_ALL),
@ -2067,9 +2043,9 @@ const CustomData_MeshMasks CD_MASK_DERIVEDMESH = {
CD_MASK_PROP_ALL), /* XXX: MISSING #CD_MASK_MLOOPTANGENT ? */
};
const CustomData_MeshMasks CD_MASK_BMESH = {
/*vmask*/ (CD_MASK_MDEFORMVERT | CD_MASK_BWEIGHT | CD_MASK_MVERT_SKIN | CD_MASK_SHAPEKEY |
/*vmask*/ (CD_MASK_MDEFORMVERT | CD_MASK_MVERT_SKIN | CD_MASK_SHAPEKEY |
CD_MASK_SHAPE_KEYINDEX | CD_MASK_PAINT_MASK | CD_MASK_PROP_ALL | CD_MASK_CREASE),
/*emask*/ (CD_MASK_BWEIGHT | CD_MASK_CREASE | CD_MASK_FREESTYLE_EDGE | CD_MASK_PROP_ALL),
/*emask*/ (CD_MASK_CREASE | CD_MASK_FREESTYLE_EDGE | CD_MASK_PROP_ALL),
/*fmask*/ 0,
/*pmask*/
(CD_MASK_FREESTYLE_FACE | CD_MASK_FACEMAP | CD_MASK_PROP_ALL),
@ -2077,12 +2053,12 @@ const CustomData_MeshMasks CD_MASK_BMESH = {
(CD_MASK_MDISPS | CD_MASK_CUSTOMLOOPNORMAL | CD_MASK_GRID_PAINT_MASK | CD_MASK_PROP_ALL),
};
const CustomData_MeshMasks CD_MASK_EVERYTHING = {
/*vmask*/ (CD_MASK_BM_ELEM_PYPTR | CD_MASK_ORIGINDEX | CD_MASK_MDEFORMVERT | CD_MASK_BWEIGHT |
/*vmask*/ (CD_MASK_BM_ELEM_PYPTR | CD_MASK_ORIGINDEX | CD_MASK_MDEFORMVERT |
CD_MASK_MVERT_SKIN | CD_MASK_ORCO | CD_MASK_CLOTH_ORCO | CD_MASK_SHAPEKEY |
CD_MASK_SHAPE_KEYINDEX | CD_MASK_PAINT_MASK | CD_MASK_PROP_ALL | CD_MASK_CREASE),
/*emask*/
(CD_MASK_BM_ELEM_PYPTR | CD_MASK_ORIGINDEX | CD_MASK_BWEIGHT | CD_MASK_CREASE |
CD_MASK_FREESTYLE_EDGE | CD_MASK_PROP_ALL),
(CD_MASK_BM_ELEM_PYPTR | CD_MASK_ORIGINDEX | CD_MASK_CREASE | CD_MASK_FREESTYLE_EDGE |
CD_MASK_PROP_ALL),
/*fmask*/
(CD_MASK_MFACE | CD_MASK_ORIGINDEX | CD_MASK_NORMAL | CD_MASK_MTFACE | CD_MASK_MCOL |
CD_MASK_ORIGSPACE | CD_MASK_TANGENT | CD_MASK_TESSLOOPNORMAL | CD_MASK_PREVIEW_MCOL |

View File

@ -193,7 +193,7 @@ int BKE_object_data_transfer_dttype_to_cdtype(const int dtdata_type)
case DT_TYPE_SKIN:
return CD_MVERT_SKIN;
case DT_TYPE_BWEIGHT_VERT:
return CD_BWEIGHT;
return CD_FAKE_BWEIGHT;
case DT_TYPE_SHARP_EDGE:
return CD_FAKE_SHARP;
@ -202,7 +202,7 @@ int BKE_object_data_transfer_dttype_to_cdtype(const int dtdata_type)
case DT_TYPE_CREASE:
return CD_CREASE;
case DT_TYPE_BWEIGHT_EDGE:
return CD_BWEIGHT;
return CD_FAKE_BWEIGHT;
case DT_TYPE_FREESTYLE_EDGE:
return CD_FREESTYLE_EDGE;
@ -923,6 +923,24 @@ static bool data_transfer_layersmapping_generate(ListBase *r_map,
* since we can't access them from mesh vertices :/ */
return false;
}
if (r_map && cddata_type == CD_FAKE_BWEIGHT) {
if (!CustomData_get_layer_named(&me_dst->vdata, CD_PROP_FLOAT, "bevel_weight_vert")) {
CustomData_add_layer_named(
&me_dst->vdata, CD_PROP_FLOAT, CD_SET_DEFAULT, me_dst->totvert, "bevel_weight_vert");
}
data_transfer_layersmapping_add_item_cd(
r_map,
CD_PROP_FLOAT,
mix_mode,
mix_factor,
mix_weights,
CustomData_get_layer_named(&me_src->vdata, CD_PROP_FLOAT, "bevel_weight_vert"),
CustomData_get_layer_named_for_write(
&me_dst->vdata, CD_PROP_FLOAT, "bevel_weight_vert", me_dst->totvert),
interp,
interp_data);
return true;
}
}
else if (elem_type == ME_EDGE) {
if (!(cddata_type & CD_FAKE)) { /* Unused for edges, currently... */
@ -985,6 +1003,25 @@ static bool data_transfer_layersmapping_generate(ListBase *r_map,
interp_data);
return true;
}
if (r_map && cddata_type == CD_FAKE_BWEIGHT) {
if (!CustomData_get_layer_named(&me_dst->edata, CD_PROP_FLOAT, "bevel_weight_edge")) {
CustomData_add_layer_named(
&me_dst->edata, CD_PROP_FLOAT, CD_SET_DEFAULT, me_dst->totedge, "bevel_weight_edge");
}
data_transfer_layersmapping_add_item_cd(
r_map,
CD_PROP_FLOAT,
mix_mode,
mix_factor,
mix_weights,
CustomData_get_layer_named(&me_src->edata, CD_PROP_FLOAT, "bevel_weight_edge"),
CustomData_get_layer_named_for_write(
&me_dst->edata, CD_PROP_FLOAT, "bevel_weight_edge", me_dst->totedge),
interp,
interp_data);
return true;
}
return false;
}
else if (elem_type == ME_LOOP) {

View File

@ -2221,8 +2221,7 @@ int BKE_gpencil_object_material_index_get_by_name(Object *ob, const char *name)
Material *read_ma = NULL;
for (short i = 0; i < *totcol; i++) {
read_ma = BKE_object_material_get(ob, i + 1);
/* Material names are like "MAMaterial.001" */
if (STREQ(name, &read_ma->id.name[2])) {
if (STREQ(name, read_ma->id.name + 2)) {
return i;
}
}

View File

@ -82,6 +82,8 @@ static void material_init_data(ID *id)
BLI_assert(MEMCMP_STRUCT_AFTER_IS_ZERO(material, id));
MEMCPY_STRUCT_AFTER(material, DNA_struct_default_get(Material), id);
*((short *)id->name) = ID_MA;
}
static void material_copy_data(Main *bmain, ID *id_dst, const ID *id_src, const int flag)
@ -1992,14 +1994,14 @@ static Material *default_materials[] = {&default_material_empty,
static void material_default_gpencil_init(Material *ma)
{
strcpy(ma->id.name, "MADefault GPencil");
BLI_strncpy(ma->id.name + 2, "Default GPencil", MAX_NAME);
BKE_gpencil_material_attr_init(ma);
add_v3_fl(&ma->gp_style->stroke_rgba[0], 0.6f);
}
static void material_default_surface_init(Material *ma)
{
strcpy(ma->id.name, "MADefault Surface");
BLI_strncpy(ma->id.name + 2, "Default Surface", MAX_NAME);
bNodeTree *ntree = blender::bke::ntreeAddTreeEmbedded(
nullptr, &ma->id, "Shader Nodetree", ntreeType_Shader->idname);
@ -2027,7 +2029,7 @@ static void material_default_surface_init(Material *ma)
static void material_default_volume_init(Material *ma)
{
strcpy(ma->id.name, "MADefault Volume");
BLI_strncpy(ma->id.name + 2, "Default Volume", MAX_NAME);
bNodeTree *ntree = blender::bke::ntreeAddTreeEmbedded(
nullptr, &ma->id, "Shader Nodetree", ntreeType_Shader->idname);
@ -2052,7 +2054,7 @@ static void material_default_volume_init(Material *ma)
static void material_default_holdout_init(Material *ma)
{
strcpy(ma->id.name, "MADefault Holdout");
BLI_strncpy(ma->id.name + 2, "Default Holdout", MAX_NAME);
bNodeTree *ntree = blender::bke::ntreeAddTreeEmbedded(
nullptr, &ma->id, "Shader Nodetree", ntreeType_Shader->idname);

View File

@ -271,7 +271,7 @@ void BKE_mesh_calc_edges(Mesh *mesh, bool keep_existing_edges, const bool select
if (!keep_existing_edges) {
/* All edges are rebuilt from the faces, so there are no loose edges. */
mesh->loose_edges_tag_none();
mesh->tag_loose_edges_none();
}
/* Explicitly clear edge maps, because that way it can be parallelized. */

View File

@ -1334,6 +1334,56 @@ void BKE_mesh_legacy_bevel_weight_to_layers(Mesh *mesh)
}
}
void BKE_mesh_legacy_bevel_weight_to_generic(Mesh *mesh)
{
using namespace blender;
if (!mesh->attributes().contains("bevel_weight_vert")) {
void *data = nullptr;
const ImplicitSharingInfo *sharing_info = nullptr;
for (const int i : IndexRange(mesh->vdata.totlayer)) {
CustomDataLayer &layer = mesh->vdata.layers[i];
if (layer.type == CD_BWEIGHT) {
data = layer.data;
sharing_info = layer.sharing_info;
layer.data = nullptr;
layer.sharing_info = nullptr;
CustomData_free_layer(&mesh->vdata, CD_BWEIGHT, mesh->totvert, i);
break;
}
}
if (data != nullptr) {
CustomData_add_layer_named_with_data(
&mesh->vdata, CD_PROP_FLOAT, data, mesh->totvert, "bevel_weight_vert", sharing_info);
}
if (sharing_info != nullptr) {
sharing_info->remove_user_and_delete_if_last();
}
}
if (!mesh->attributes().contains("bevel_weight_edge")) {
void *data = nullptr;
const ImplicitSharingInfo *sharing_info = nullptr;
for (const int i : IndexRange(mesh->edata.totlayer)) {
CustomDataLayer &layer = mesh->edata.layers[i];
if (layer.type == CD_BWEIGHT) {
data = layer.data;
sharing_info = layer.sharing_info;
layer.data = nullptr;
layer.sharing_info = nullptr;
CustomData_free_layer(&mesh->edata, CD_BWEIGHT, mesh->totedge, i);
break;
}
}
if (data != nullptr) {
CustomData_add_layer_named_with_data(
&mesh->edata, CD_PROP_FLOAT, data, mesh->totedge, "bevel_weight_edge", sharing_info);
}
if (sharing_info != nullptr) {
sharing_info->remove_user_and_delete_if_last();
}
}
}
/** \} */
/* -------------------------------------------------------------------- */

View File

@ -190,7 +190,7 @@ void Mesh::tag_loose_verts_none() const
try_tag_verts_no_face_none(*this);
}
void Mesh::loose_edges_tag_none() const
void Mesh::tag_loose_edges_none() const
{
using namespace blender::bke;
this->runtime->loose_edges_cache.ensure([&](LooseEdgeCache &r_data) {
@ -314,9 +314,21 @@ void BKE_mesh_tag_edges_split(struct Mesh *mesh)
free_bvh_cache(*mesh->runtime);
reset_normals(*mesh->runtime);
free_subdiv_ccg(*mesh->runtime);
mesh->runtime->loose_edges_cache.tag_dirty();
mesh->runtime->loose_verts_cache.tag_dirty();
mesh->runtime->verts_no_face_cache.tag_dirty();
if (mesh->runtime->loose_edges_cache.is_cached() &&
mesh->runtime->loose_edges_cache.data().count != 0)
{
mesh->runtime->loose_edges_cache.tag_dirty();
}
if (mesh->runtime->loose_verts_cache.is_cached() &&
mesh->runtime->loose_verts_cache.data().count != 0)
{
mesh->runtime->loose_verts_cache.tag_dirty();
}
if (mesh->runtime->verts_no_face_cache.is_cached() &&
mesh->runtime->verts_no_face_cache.data().count != 0)
{
mesh->runtime->verts_no_face_cache.tag_dirty();
}
mesh->runtime->subsurf_face_dot_tags.clear_and_shrink();
mesh->runtime->subsurf_optimal_display_edges.clear_and_shrink();
if (mesh->runtime->shrinkwrap_data) {

View File

@ -1352,6 +1352,7 @@ namespace blender::bke {
static GHash *nodetreetypes_hash = nullptr;
static GHash *nodetypes_hash = nullptr;
static GHash *nodetypes_alias_hash = nullptr;
static GHash *nodesockettypes_hash = nullptr;
} // namespace blender::bke
@ -1416,6 +1417,19 @@ bNodeType *nodeTypeFind(const char *idname)
return nullptr;
}
const char *nodeTypeFindAlias(const char *alias)
{
if (alias[0]) {
const char *idname = static_cast<const char *>(
BLI_ghash_lookup(blender::bke::nodetypes_alias_hash, alias));
if (idname) {
return idname;
}
}
return alias;
}
static void node_free_type(void *nodetype_v)
{
bNodeType *nodetype = static_cast<bNodeType *>(nodetype_v);
@ -1458,6 +1472,11 @@ void nodeUnregisterType(bNodeType *nt)
BLI_ghash_remove(blender::bke::nodetypes_hash, nt->idname, nullptr, node_free_type);
}
void nodeRegisterAlias(bNodeType *nt, const char *alias)
{
BLI_ghash_insert(blender::bke::nodetypes_alias_hash, BLI_strdup(alias), BLI_strdup(nt->idname));
}
namespace blender::bke {
bool node_type_is_undefined(const bNode *node)
@ -4389,6 +4408,7 @@ void BKE_node_system_init()
{
blender::bke::nodetreetypes_hash = BLI_ghash_str_new("nodetreetypes_hash gh");
blender::bke::nodetypes_hash = BLI_ghash_str_new("nodetypes_hash gh");
blender::bke::nodetypes_alias_hash = BLI_ghash_str_new("nodetypes_alias_hash gh");
blender::bke::nodesockettypes_hash = BLI_ghash_str_new("nodesockettypes_hash gh");
register_nodes();
@ -4396,6 +4416,11 @@ void BKE_node_system_init()
void BKE_node_system_exit()
{
if (blender::bke::nodetypes_alias_hash) {
BLI_ghash_free(blender::bke::nodetypes_alias_hash, MEM_freeN, MEM_freeN);
blender::bke::nodetypes_alias_hash = nullptr;
}
if (blender::bke::nodetypes_hash) {
NODE_TYPES_BEGIN (nt) {
if (nt->rna_ext.free) {

View File

@ -1208,7 +1208,7 @@ Mesh *BKE_subdiv_to_mesh(Subdiv *subdiv,
result->tag_loose_verts_none();
}
if (coarse_mesh->loose_edges().count == 0) {
result->loose_edges_tag_none();
result->tag_loose_edges_none();
}
if (subdiv->settings.is_simple) {

View File

@ -630,7 +630,7 @@ static ImBuf *make_grayscale_ibuf_copy(ImBuf *ibuf)
IMB_assign_float_buffer(grayscale, rect_float, IB_TAKE_OWNERSHIP);
for (int i = 0; i < grayscale->x * grayscale->y; i++) {
const float *pixel = rect_float + ibuf->channels * i;
const float *pixel = ibuf->float_buffer.data + ibuf->channels * i;
rect_float[i] = 0.2126f * pixel[0] + 0.7152f * pixel[1] + 0.0722f * pixel[2];
}

View File

@ -350,8 +350,8 @@ static int path_normalize_impl(char *path, bool check_blend_relative_prefix)
* as these directories are expected to be skipped. */
BLI_assert(!IS_PARENT_DIR(start));
const size_t start_len = path_len - (start - path);
memmove(path_first_non_slash_part, start, start_len + 1);
BLI_assert(strlen(start) == start_len);
memmove(path_first_non_slash_part, start, start_len + 1);
path_len -= start - path_first_non_slash_part;
BLI_assert(strlen(path) == path_len);
}
@ -963,7 +963,7 @@ bool BLI_path_frame(char *path, size_t path_maxncpy, int frame, int digits)
if (path_frame_chars_find_range(path, &ch_sta, &ch_end)) {
char frame_str[FILENAME_FRAME_CHARS_MAX + 1]; /* One for null. */
const int ch_span = MIN2(ch_end - ch_sta, FILENAME_FRAME_CHARS_MAX);
BLI_snprintf(frame_str, sizeof(frame_str), "%.*d", ch_span, frame);
SNPRINTF(frame_str, "%.*d", ch_span, frame);
BLI_str_replace_range(path, path_maxncpy, ch_sta, ch_end, frame_str);
return true;
}
@ -983,7 +983,7 @@ bool BLI_path_frame_range(char *path, size_t path_maxncpy, int sta, int end, int
if (path_frame_chars_find_range(path, &ch_sta, &ch_end)) {
char frame_str[(FILENAME_FRAME_CHARS_MAX * 2) + 1 + 1]; /* One for null, one for the '-' */
const int ch_span = MIN2(ch_end - ch_sta, FILENAME_FRAME_CHARS_MAX);
BLI_snprintf(frame_str, sizeof(frame_str), "%.*d-%.*d", ch_span, sta, ch_span, end);
SNPRINTF(frame_str, "%.*d-%.*d", ch_span, sta, ch_span, end);
BLI_str_replace_range(path, path_maxncpy, ch_sta, ch_end, frame_str);
return true;
}

View File

@ -117,6 +117,10 @@ TEST(path_util, Normalize_UnbalancedAbsolute)
NORMALIZE("/a/b/c/../../../../../d", "/d");
NORMALIZE("/a/b/c/../../../../d", "/d");
NORMALIZE("/a/b/c/../../../d", "/d");
/* Use a longer path as it may hit corner cases. */
NORMALIZE("/home/username/Downloads/../../../../../Users/Example/Desktop/test.jpg",
"/Users/Example/Desktop/test.jpg");
}
/* #BLI_path_normalize: with relative paths that result in leading "../". */

View File

@ -30,7 +30,7 @@ TEST(string, StrCopyUTF8_ASCII)
const char src[] = {__VA_ARGS__, 0}; \
char dst[sizeof(src)]; \
memset(dst, 0xff, sizeof(dst)); \
BLI_strncpy_utf8(dst, src, sizeof(dst)); \
STRNCPY_UTF8(dst, src); \
EXPECT_EQ(strlen(dst), sizeof(dst) - 1); \
EXPECT_STREQ(dst, src); \
}
@ -70,7 +70,7 @@ TEST(string, StrCopyUTF8_TruncateEncoding)
EXPECT_EQ(BLI_str_utf8_size(src), byte_size); \
char dst[sizeof(src)]; \
memset(dst, 0xff, sizeof(dst)); \
BLI_strncpy_utf8(dst, src, sizeof(dst)); \
STRNCPY_UTF8(dst, src); \
EXPECT_EQ(strlen(dst), sizeof(dst) - 1); \
EXPECT_STREQ(dst, src); \
BLI_strncpy_utf8(dst, src, sizeof(dst) - 1); \
@ -97,13 +97,13 @@ TEST(string, StrCopyUTF8_TerminateEncodingEarly)
EXPECT_EQ(BLI_str_utf8_size(src), byte_size); \
char dst[sizeof(src)]; \
memset(dst, 0xff, sizeof(dst)); \
BLI_strncpy_utf8(dst, src, sizeof(dst)); \
STRNCPY_UTF8(dst, src); \
EXPECT_EQ(strlen(dst), sizeof(dst) - 1); \
EXPECT_STREQ(dst, src); \
for (int i = sizeof(dst) - 1; i > 1; i--) { \
src[i] = '\0'; \
memset(dst, 0xff, sizeof(dst)); \
const int dst_copied = BLI_strncpy_utf8_rlen(dst, src, sizeof(dst)); \
const int dst_copied = STRNCPY_UTF8_RLEN(dst, src); \
EXPECT_STREQ(dst, src); \
EXPECT_EQ(strlen(dst), i); \
EXPECT_EQ(dst_copied, i); \

View File

@ -2176,6 +2176,46 @@ static void versioning_replace_legacy_mix_rgb_node(bNodeTree *ntree)
}
}
static void versioning_replace_legacy_glossy_node(bNodeTree *ntree)
{
LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
if (node->type == SH_NODE_BSDF_GLOSSY_LEGACY) {
strcpy(node->idname, "ShaderNodeBsdfAnisotropic");
node->type = SH_NODE_BSDF_GLOSSY;
}
}
}
static void versioning_remove_microfacet_sharp_distribution(bNodeTree *ntree)
{
/* Find all glossy, glass and refraction BSDF nodes that have their distribution
* set to SHARP and set them to GGX, disconnect any link to the Roughness input
* and set its value to zero. */
LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
if (!ELEM(node->type, SH_NODE_BSDF_GLOSSY, SH_NODE_BSDF_GLASS, SH_NODE_BSDF_REFRACTION)) {
continue;
}
if (node->custom1 != SHD_GLOSSY_SHARP_DEPRECATED) {
continue;
}
node->custom1 = SHD_GLOSSY_GGX;
LISTBASE_FOREACH (bNodeSocket *, socket, &node->inputs) {
if (!STREQ(socket->identifier, "Roughness")) {
continue;
}
if (socket->link != nullptr) {
nodeRemLink(ntree, socket->link);
}
bNodeSocketValueFloat *socket_value = (bNodeSocketValueFloat *)socket->default_value;
socket_value->value = 0.0f;
break;
}
}
}
static void version_fix_image_format_copy(Main *bmain, ImageFormatData *format)
{
/* Fix bug where curves in image format were not properly copied to file output
@ -3211,20 +3251,6 @@ void blo_do_versions_300(FileData *fd, Library * /*lib*/, Main *bmain)
}
}
if (!MAIN_VERSION_ATLEAST(bmain, 301, 5)) {
LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
if (ntree->type != NTREE_GEOMETRY) {
continue;
}
LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
if (node->type != GEO_NODE_REALIZE_INSTANCES) {
continue;
}
node->custom1 |= GEO_NODE_REALIZE_INSTANCES_LEGACY_BEHAVIOR;
}
}
}
if (!MAIN_VERSION_ATLEAST(bmain, 301, 6)) {
/* Add node storage for map range node. */
FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
@ -4371,5 +4397,12 @@ void blo_do_versions_300(FileData *fd, Library * /*lib*/, Main *bmain)
*/
{
/* Keep this block, even when empty. */
/* Convert anisotropic BSDF node to glossy BSDF. */
FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
versioning_replace_legacy_glossy_node(ntree);
versioning_remove_microfacet_sharp_distribution(ntree);
}
FOREACH_NODETREE_END;
}
}

View File

@ -231,6 +231,12 @@ void blo_do_versions_400(FileData * /*fd*/, Library * /*lib*/, Main *bmain)
version_movieclips_legacy_camera_object(bmain);
}
if (!MAIN_VERSION_ATLEAST(bmain, 400, 2)) {
LISTBASE_FOREACH (Mesh *, mesh, &bmain->meshes) {
BKE_mesh_legacy_bevel_weight_to_generic(mesh);
}
}
/**
* Versioning code until next subversion bump goes here.
*

View File

@ -181,8 +181,8 @@ static void displacement_principled_nodes(bNode *node)
static bool node_has_roughness(const bNode *node)
{
return ELEM(node->type,
SH_NODE_BSDF_ANISOTROPIC,
SH_NODE_BSDF_GLASS,
SH_NODE_BSDF_GLOSSY_LEGACY,
SH_NODE_BSDF_GLOSSY,
SH_NODE_BSDF_REFRACTION);
}

View File

@ -1344,7 +1344,7 @@ static void bm_to_mesh_edges(const BMesh &bm,
});
if (!any_loose_edge) {
mesh.loose_edges_tag_none();
mesh.tag_loose_edges_none();
}
}

View File

@ -336,6 +336,8 @@ typedef struct BevelParams {
float pro_super_r;
/** Bevel amount affected by weights on edges or verts. */
bool use_weights;
int bweight_offset_vert;
int bweight_offset_edge;
/** Should bevel prefer to slide along edges rather than keep widths spec? */
bool loop_slide;
/** Should offsets be limited by collisions? */
@ -1277,9 +1279,12 @@ static void offset_meet_lines_percent_or_absolute(BevelParams *bp,
d5 = bp->offset * BM_edge_calc_length(e5.e) / 100.0f;
}
if (bp->use_weights) {
CustomData *cd = &bp->bm->edata;
e1_wt = BM_elem_float_data_get(cd, e1->e, CD_BWEIGHT);
e2_wt = BM_elem_float_data_get(cd, e2->e, CD_BWEIGHT);
e1_wt = bp->bweight_offset_edge == -1 ?
0.0f :
BM_ELEM_CD_GET_FLOAT(e1->e, bp->bweight_offset_edge);
e2_wt = bp->bweight_offset_edge == -1 ?
0.0f :
BM_ELEM_CD_GET_FLOAT(e2->e, bp->bweight_offset_edge);
}
else {
e1_wt = 1.0f;
@ -1605,9 +1610,10 @@ static bool offset_on_edge_between(BevelParams *bp,
if (bp->offset_type == BEVEL_AMT_PERCENT) {
float wt = 1.0;
if (bp->use_weights) {
CustomData *cd = &bp->bm->edata;
wt = 0.5f * (BM_elem_float_data_get(cd, e1->e, CD_BWEIGHT) +
BM_elem_float_data_get(cd, e2->e, CD_BWEIGHT));
wt = bp->bweight_offset_edge == -1 ?
0.0f :
0.5f * (BM_ELEM_CD_GET_FLOAT(e1->e, bp->bweight_offset_edge) +
BM_ELEM_CD_GET_FLOAT(e2->e, bp->bweight_offset_edge));
}
interp_v3_v3v3(meetco, v->co, v2->co, wt * bp->offset / 100.0f);
}
@ -6438,7 +6444,8 @@ static BevVert *bevel_vert_construct(BMesh *bm, BevelParams *bp, BMVert *v)
bv->offset *= weight;
}
else if (bp->use_weights) {
weight = BM_elem_float_data_get(&bm->vdata, v, CD_BWEIGHT);
weight = bp->bweight_offset_vert == -1 ? 0.0f :
BM_ELEM_CD_GET_FLOAT(v, bp->bweight_offset_vert);
bv->offset *= weight;
}
/* Find center axis. NOTE: Don't use vert normal, can give unwanted results. */
@ -6518,7 +6525,9 @@ static BevVert *bevel_vert_construct(BMesh *bm, BevelParams *bp, BMVert *v)
e->offset_r_spec = e->offset_l_spec;
}
if (bp->use_weights) {
weight = BM_elem_float_data_get(&bm->edata, e->e, CD_BWEIGHT);
weight = bp->bweight_offset_edge == -1 ?
0.0f :
BM_ELEM_CD_GET_FLOAT(e->e, bp->bweight_offset_edge);
e->offset_l_spec *= weight;
e->offset_r_spec *= weight;
}
@ -7751,6 +7760,10 @@ void BM_mesh_bevel(BMesh *bm,
.pro_super_r = -logf(2.0) / logf(sqrtf(profile)), /* Convert to superellipse exponent. */
.affect_type = affect_type,
.use_weights = use_weights,
.bweight_offset_vert = CustomData_get_offset_named(
&bm->vdata, CD_PROP_FLOAT, "bevel_weight_vert"),
.bweight_offset_edge = CustomData_get_offset_named(
&bm->edata, CD_PROP_FLOAT, "bevel_weight_edge"),
.loop_slide = loop_slide,
.limit_offset = limit_offset,
.offset_adjust = (bp.affect_type != BEVEL_AFFECT_VERTICES) &&

View File

@ -74,6 +74,11 @@ void main()
finalColor = EDIT_MESH_face_color(m_data.x);
bool occluded = true;
# ifdef GPU_METAL
/* Apply depth bias to overlay in order to prevent z-fighting on Apple Silicon GPUs. */
gl_Position.z -= 5e-5;
# endif
#elif defined(FACEDOT)
finalColor = EDIT_MESH_facedot_color(norAndFlag.w);

View File

@ -434,7 +434,8 @@ MeshRenderData *mesh_render_data_create(Object *object,
mr->vert_crease_ofs = CustomData_get_offset(&mr->bm->vdata, CD_CREASE);
mr->edge_crease_ofs = CustomData_get_offset(&mr->bm->edata, CD_CREASE);
mr->bweight_ofs = CustomData_get_offset(&mr->bm->edata, CD_BWEIGHT);
mr->bweight_ofs = CustomData_get_offset_named(
&mr->bm->edata, CD_PROP_FLOAT, "bevel_weight_edge");
#ifdef WITH_FREESTYLE
mr->freestyle_edge_ofs = CustomData_get_offset(&mr->bm->edata, CD_FREESTYLE_EDGE);
mr->freestyle_face_ofs = CustomData_get_offset(&mr->bm->pdata, CD_FREESTYLE_FACE);

View File

@ -1051,7 +1051,8 @@ static int paste_text_exec(bContext *C, wmOperator *op)
int len;
} clipboard_system = {NULL}, clipboard_vfont = {NULL};
clipboard_system.buf = WM_clipboard_text_get(selection, &clipboard_system.len);
/* No need for UTF8 validation as the conversion handles invalid sequences gracefully. */
clipboard_system.buf = WM_clipboard_text_get(selection, false, &clipboard_system.len);
if (clipboard_system.buf == NULL) {
return OPERATOR_CANCELLED;

View File

@ -808,8 +808,8 @@ static bool gpencil_weightpaint_brush_init(bContext *C, wmOperator *op)
gso->fn_kdtree = NULL;
gso->fn_used = 0;
gso->fn_size = 0;
gso->use_find_nearest = ((gso->brush->gpencil_weight_tool == GPWEIGHT_TOOL_BLUR) ||
(gso->brush->gpencil_weight_tool == GPWEIGHT_TOOL_SMEAR));
gso->use_find_nearest = ELEM(
gso->brush->gpencil_weight_tool, GPWEIGHT_TOOL_BLUR, GPWEIGHT_TOOL_SMEAR);
gso->gpd = ED_gpencil_data_get_active(C);
gso->scene = scene;

View File

@ -2435,19 +2435,21 @@ static void ui_apply_but(
/** \name Button Copy & Paste
* \{ */
static void ui_but_get_pasted_text_from_clipboard(char **buf_paste, int *buf_len)
static void ui_but_get_pasted_text_from_clipboard(const bool ensure_utf8,
char **r_buf_paste,
int *r_buf_len)
{
/* get only first line even if the clipboard contains multiple lines */
int length;
char *text = WM_clipboard_text_get_firstline(false, &length);
char *text = WM_clipboard_text_get_firstline(false, ensure_utf8, &length);
if (text) {
*buf_paste = text;
*buf_len = length;
*r_buf_paste = text;
*r_buf_len = length;
}
else {
*buf_paste = static_cast<char *>(MEM_callocN(sizeof(char), __func__));
*buf_len = 0;
*r_buf_paste = static_cast<char *>(MEM_callocN(sizeof(char), __func__));
*r_buf_len = 0;
}
}
@ -2831,7 +2833,7 @@ static void ui_but_paste(bContext *C, uiBut *but, uiHandleButtonData *data, cons
int buf_paste_len = 0;
char *buf_paste;
ui_but_get_pasted_text_from_clipboard(&buf_paste, &buf_paste_len);
ui_but_get_pasted_text_from_clipboard(UI_but_is_utf8(but), &buf_paste, &buf_paste_len);
const bool has_required_data = !(but->poin == nullptr && but->rnapoin.data == nullptr);
@ -3310,13 +3312,9 @@ static bool ui_textedit_copypaste(uiBut *but, uiHandleButtonData *data, const in
if (mode == UI_TEXTEDIT_PASTE) {
/* extract the first line from the clipboard */
int buf_len;
char *pbuf = WM_clipboard_text_get_firstline(false, &buf_len);
char *pbuf = WM_clipboard_text_get_firstline(false, UI_but_is_utf8(but), &buf_len);
if (pbuf) {
if (UI_but_is_utf8(but)) {
buf_len -= BLI_str_utf8_invalid_strip(pbuf, size_t(buf_len));
}
ui_textedit_insert_buf(but, data, pbuf, buf_len);
changed = true;
@ -3508,9 +3506,12 @@ static void ui_textedit_end(bContext *C, uiBut *but, uiHandleButtonData *data)
if (but) {
if (UI_but_is_utf8(but)) {
const int strip = BLI_str_utf8_invalid_strip(but->editstr, strlen(but->editstr));
/* not a file?, strip non utf-8 chars */
/* Strip non-UTF8 characters unless buttons support this.
* This should never happen as all text input should be valid UTF8,
* there is a small chance existing data contains invalid sequences.
* This could check could be made into an assertion if `but->editstr`
* is valid UTF8 when #ui_textedit_begin assigns the string. */
if (strip) {
/* won't happen often so isn't that annoying to keep it here for a while */
printf("%s: invalid utf8 - stripped chars %d\n", __func__, strip);
}
}
@ -3732,9 +3733,9 @@ static void ui_do_but_textedit(
if (event->val == KM_DBL_CLICK && had_selection == false) {
int selsta, selend;
BLI_str_cursor_step_bounds_utf8(data->str, strlen(data->str), but->pos, &selsta, &selend);
but->pos = (short)selend;
but->selsta = (short)selsta;
but->selend = (short)selend;
but->pos = short(selend);
but->selsta = short(selsta);
but->selend = short(selend);
retval = WM_UI_HANDLER_BREAK;
changed = true;
}

View File

@ -1396,7 +1396,6 @@ static bool copy_to_selected_button(bContext *C, bool all, bool poll)
Main *bmain = CTX_data_main(C);
PointerRNA ptr, lptr;
PropertyRNA *prop, *lprop;
bool success = false;
int index;
/* try to reset the nominated setting to its default value */
@ -1407,36 +1406,31 @@ static bool copy_to_selected_button(bContext *C, bool all, bool poll)
return false;
}
bool success = false;
char *path = nullptr;
bool use_path_from_id;
ListBase lb = {nullptr};
if (!UI_context_copy_to_selected_list(C, &ptr, prop, &lb, &use_path_from_id, &path)) {
return false;
}
if (BLI_listbase_is_empty(&lb)) {
MEM_SAFE_FREE(path);
return false;
}
if (UI_context_copy_to_selected_list(C, &ptr, prop, &lb, &use_path_from_id, &path)) {
LISTBASE_FOREACH (CollectionPointerLink *, link, &lb) {
if (link->ptr.data == ptr.data) {
continue;
}
LISTBASE_FOREACH (CollectionPointerLink *, link, &lb) {
if (link->ptr.data == ptr.data) {
continue;
}
if (!UI_context_copy_to_selected_check(
&ptr, &link->ptr, prop, path, use_path_from_id, &lptr, &lprop))
{
continue;
}
if (!UI_context_copy_to_selected_check(
&ptr, &link->ptr, prop, path, use_path_from_id, &lptr, &lprop))
{
continue;
}
if (poll) {
success = true;
break;
}
if (RNA_property_copy(bmain, &lptr, &ptr, prop, (all) ? -1 : index)) {
RNA_property_update(C, &lptr, prop);
success = true;
if (poll) {
success = true;
break;
}
if (RNA_property_copy(bmain, &lptr, &ptr, prop, (all) ? -1 : index)) {
RNA_property_update(C, &lptr, prop);
success = true;
}
}
}

View File

@ -644,7 +644,12 @@ static void *uilist_item_use_dynamic_tooltip(PointerRNA *itemptr, const char *pr
static char *uilist_item_tooltip_func(bContext * /*C*/, void *argN, const char *tip)
{
char *dyn_tooltip = static_cast<char *>(argN);
return BLI_sprintfN("%s - %s", tip, dyn_tooltip);
std::string tooltip_string = dyn_tooltip;
if (tip && tip[0]) {
tooltip_string += '\n';
tooltip_string += tip;
}
return BLI_strdupn(tooltip_string.c_str(), tooltip_string.size());
}
/**
@ -745,6 +750,9 @@ static void ui_template_list_layout_draw(const bContext *C,
int i = 0;
if (input_data->dataptr.data && input_data->prop) {
const bool editable = (RNA_property_flag(input_data->prop) & PROP_EDITABLE);
/* create list items */
for (i = visual_info.start_idx; i < visual_info.end_idx; i++) {
PointerRNA *itemptr = &items->item_vec[i].item;
@ -775,7 +783,7 @@ static void ui_template_list_layout_draw(const bContext *C,
org_i,
0,
0,
TIP_("Double click to rename"));
editable ? TIP_("Double click to rename") : "");
if ((dyntip_data = uilist_item_use_dynamic_tooltip(itemptr,
input_data->item_dyntip_propname))) {
UI_but_func_tooltip_set(but, uilist_item_tooltip_func, dyntip_data, MEM_freeN);

View File

@ -149,6 +149,7 @@ static bool path_select_poll_property(const bContext *C,
struct UserData {
BMesh *bm;
Mesh *me;
int cd_offset;
const struct PathSelectParams *op_params;
};
@ -182,7 +183,24 @@ static void mouse_mesh_shortest_path_vert(Scene *UNUSED(scene),
BMEditMesh *em = BKE_editmesh_from_object(obedit);
BMesh *bm = em->bm;
struct UserData user_data = {bm, obedit->data, op_params};
int cd_offset = -1;
switch (op_params->edge_mode) {
case EDGE_MODE_SELECT:
case EDGE_MODE_TAG_SEAM:
case EDGE_MODE_TAG_SHARP:
#ifdef WITH_FREESTYLE
case EDGE_MODE_TAG_FREESTYLE:
#endif
break;
case EDGE_MODE_TAG_CREASE:
cd_offset = CustomData_get_offset(&bm->edata, CD_CREASE);
break;
case EDGE_MODE_TAG_BEVEL:
cd_offset = CustomData_get_offset_named(&bm->edata, CD_PROP_FLOAT, "bevel_weight_edge");
break;
}
struct UserData user_data = {bm, obedit->data, cd_offset, op_params};
LinkNode *path = NULL;
bool is_path_ordered = false;
@ -281,7 +299,6 @@ static bool edgetag_test_cb(BMEdge *e, void *user_data_v)
{
struct UserData *user_data = user_data_v;
const char edge_mode = user_data->op_params->edge_mode;
BMesh *bm = user_data->bm;
switch (edge_mode) {
case EDGE_MODE_SELECT:
@ -291,11 +308,11 @@ static bool edgetag_test_cb(BMEdge *e, void *user_data_v)
case EDGE_MODE_TAG_SHARP:
return BM_elem_flag_test(e, BM_ELEM_SMOOTH) ? false : true;
case EDGE_MODE_TAG_CREASE:
return BM_elem_float_data_get(&bm->edata, e, CD_CREASE) ? true : false;
case EDGE_MODE_TAG_BEVEL:
return BM_elem_float_data_get(&bm->edata, e, CD_BWEIGHT) ? true : false;
return BM_ELEM_CD_GET_FLOAT(e, user_data->cd_offset);
#ifdef WITH_FREESTYLE
case EDGE_MODE_TAG_FREESTYLE: {
BMesh *bm = user_data->bm;
FreestyleEdge *fed = CustomData_bmesh_get(&bm->edata, e->head.data, CD_FREESTYLE_EDGE);
return (!fed) ? false : (fed->flag & FREESTYLE_EDGE_MARK) ? true : false;
}
@ -320,10 +337,8 @@ static void edgetag_set_cb(BMEdge *e, bool val, void *user_data_v)
BM_elem_flag_set(e, BM_ELEM_SMOOTH, !val);
break;
case EDGE_MODE_TAG_CREASE:
BM_elem_float_data_set(&bm->edata, e, CD_CREASE, (val) ? 1.0f : 0.0f);
break;
case EDGE_MODE_TAG_BEVEL:
BM_elem_float_data_set(&bm->edata, e, CD_BWEIGHT, (val) ? 1.0f : 0.0f);
BM_ELEM_CD_SET_FLOAT(e, user_data->cd_offset, (val) ? 1.0f : 0.0f);
break;
#ifdef WITH_FREESTYLE
case EDGE_MODE_TAG_FREESTYLE: {
@ -352,8 +367,8 @@ static void edgetag_ensure_cd_flag(Mesh *me, const char edge_mode)
}
break;
case EDGE_MODE_TAG_BEVEL:
if (!CustomData_has_layer(&bm->edata, CD_BWEIGHT)) {
BM_data_layer_add(bm, &bm->edata, CD_BWEIGHT);
if (!CustomData_has_layer_named(&bm->edata, CD_PROP_FLOAT, "bevel_weight_edge")) {
BM_data_layer_add_named(bm, &bm->edata, CD_PROP_FLOAT, "bevel_weight_edge");
}
break;
#ifdef WITH_FREESTYLE
@ -380,7 +395,24 @@ static void mouse_mesh_shortest_path_edge(Scene *scene,
BMEditMesh *em = BKE_editmesh_from_object(obedit);
BMesh *bm = em->bm;
struct UserData user_data = {bm, obedit->data, op_params};
int cd_offset = -1;
switch (op_params->edge_mode) {
case EDGE_MODE_SELECT:
case EDGE_MODE_TAG_SEAM:
case EDGE_MODE_TAG_SHARP:
#ifdef WITH_FREESTYLE
case EDGE_MODE_TAG_FREESTYLE:
#endif
break;
case EDGE_MODE_TAG_CREASE:
cd_offset = CustomData_get_offset(&bm->edata, CD_CREASE);
break;
case EDGE_MODE_TAG_BEVEL:
cd_offset = CustomData_get_offset_named(&bm->edata, CD_PROP_FLOAT, "bevel_weight_edge");
break;
}
struct UserData user_data = {bm, obedit->data, cd_offset, op_params};
LinkNode *path = NULL;
bool is_path_ordered = false;
@ -516,7 +548,24 @@ static void mouse_mesh_shortest_path_face(Scene *UNUSED(scene),
BMEditMesh *em = BKE_editmesh_from_object(obedit);
BMesh *bm = em->bm;
struct UserData user_data = {bm, obedit->data, op_params};
int cd_offset = -1;
switch (op_params->edge_mode) {
case EDGE_MODE_SELECT:
case EDGE_MODE_TAG_SEAM:
case EDGE_MODE_TAG_SHARP:
#ifdef WITH_FREESTYLE
case EDGE_MODE_TAG_FREESTYLE:
#endif
break;
case EDGE_MODE_TAG_CREASE:
cd_offset = CustomData_get_offset(&bm->edata, CD_CREASE);
break;
case EDGE_MODE_TAG_BEVEL:
cd_offset = CustomData_get_offset_named(&bm->edata, CD_PROP_FLOAT, "bevel_weight_edge");
break;
}
struct UserData user_data = {bm, obedit->data, cd_offset, op_params};
LinkNode *path = NULL;
bool is_path_ordered = false;

View File

@ -630,7 +630,6 @@ static int similar_edge_select_exec(bContext *C, wmOperator *op)
const float thresh = RNA_float_get(op->ptr, "threshold");
const float thresh_radians = thresh * (float)M_PI + FLT_EPSILON;
const int compare = RNA_enum_get(op->ptr, "compare");
int custom_data_type = -1;
int tot_edges_selected_all = 0;
uint objects_len = 0;
@ -669,15 +668,6 @@ static int similar_edge_select_exec(bContext *C, wmOperator *op)
break;
}
switch (type) {
case SIMEDGE_CREASE:
custom_data_type = CD_CREASE;
break;
case SIMEDGE_BEVEL:
custom_data_type = CD_BWEIGHT;
break;
}
int tree_index = 0;
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
Object *ob = objects[ob_index];
@ -696,14 +686,31 @@ static int similar_edge_select_exec(bContext *C, wmOperator *op)
}
break;
}
case SIMEDGE_CREASE:
case SIMEDGE_BEVEL: {
if (!CustomData_has_layer(&bm->edata, custom_data_type)) {
case SIMEDGE_CREASE: {
if (!CustomData_has_layer(&bm->edata, CD_CREASE)) {
BLI_kdtree_1d_insert(tree_1d, tree_index++, (float[1]){0.0f});
continue;
}
break;
}
case SIMEDGE_BEVEL: {
if (!CustomData_has_layer_named(&bm->edata, CD_PROP_FLOAT, "bevel_weight_edge")) {
BLI_kdtree_1d_insert(tree_1d, tree_index++, (float[1]){0.0f});
continue;
}
break;
}
}
int custom_data_offset;
switch (type) {
case SIMEDGE_CREASE:
custom_data_offset = CustomData_get_offset(&bm->edata, CD_CREASE);
break;
case SIMEDGE_BEVEL:
custom_data_offset = CustomData_get_offset_named(
&bm->edata, CD_PROP_FLOAT, "bevel_weight_edge");
break;
}
float ob_m3[3][3], ob_m3_inv[3][3];
@ -763,8 +770,7 @@ static int similar_edge_select_exec(bContext *C, wmOperator *op)
}
case SIMEDGE_CREASE:
case SIMEDGE_BEVEL: {
const float *value = CustomData_bmesh_get(
&bm->edata, edge->head.data, custom_data_type);
const float *value = BM_ELEM_CD_GET_FLOAT_P(edge, custom_data_offset);
BLI_kdtree_1d_insert(tree_1d, tree_index++, value);
break;
}
@ -799,9 +805,13 @@ static int similar_edge_select_exec(bContext *C, wmOperator *op)
}
break;
}
case SIMEDGE_CREASE:
case SIMEDGE_CREASE: {
has_custom_data_layer = CustomData_has_layer(&bm->edata, CD_CREASE);
ATTR_FALLTHROUGH;
}
case SIMEDGE_BEVEL: {
has_custom_data_layer = CustomData_has_layer(&bm->edata, custom_data_type);
has_custom_data_layer = CustomData_has_layer_named(
&bm->edata, CD_PROP_FLOAT, "bevel_weight_edge");
if (!has_custom_data_layer) {
/* Proceed only if we have to select all the edges that have custom data value of 0.0f.
* In this case we will just select all the edges.
@ -817,6 +827,17 @@ static int similar_edge_select_exec(bContext *C, wmOperator *op)
copy_m3_m4(ob_m3, ob->object_to_world);
invert_m3_m3(ob_m3_inv, ob_m3);
int custom_data_offset;
switch (type) {
case SIMEDGE_CREASE:
custom_data_offset = CustomData_get_offset(&bm->edata, CD_CREASE);
break;
case SIMEDGE_BEVEL:
custom_data_offset = CustomData_get_offset_named(
&bm->edata, CD_PROP_FLOAT, "bevel_weight_edge");
break;
}
BMEdge *edge; /* Mesh edge. */
BMIter iter; /* Selected edges iterator. */
@ -903,8 +924,7 @@ static int similar_edge_select_exec(bContext *C, wmOperator *op)
break;
}
const float *value = CustomData_bmesh_get(
&bm->edata, edge->head.data, custom_data_type);
const float *value = BM_ELEM_CD_GET_FLOAT_P(edge, custom_data_offset);
if (ED_select_similar_compare_float_tree(tree_1d, *value, thresh, compare)) {
select = true;
}

View File

@ -802,126 +802,6 @@ void MESH_OT_customdata_custom_splitnormals_clear(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* Vertex bevel weight. */
static int mesh_customdata_bevel_weight_vertex_state(bContext *C)
{
const Object *object = ED_object_context(C);
if (object && object->type == OB_MESH) {
const Mesh *mesh = static_cast<Mesh *>(object->data);
if (!ID_IS_LINKED(mesh)) {
const CustomData *data = GET_CD_DATA(mesh, vdata);
return CustomData_has_layer(data, CD_BWEIGHT);
}
}
return -1;
}
static bool mesh_customdata_bevel_weight_vertex_add_poll(bContext *C)
{
return mesh_customdata_bevel_weight_vertex_state(C) == 0;
}
static int mesh_customdata_bevel_weight_vertex_add_exec(bContext *C, wmOperator * /*op*/)
{
return mesh_customdata_add_exec__internal(C, BM_VERT, CD_BWEIGHT);
}
void MESH_OT_customdata_bevel_weight_vertex_add(wmOperatorType *ot)
{
ot->name = "Add Vertex Bevel Weight";
ot->idname = "MESH_OT_customdata_bevel_weight_vertex_add";
ot->description = "Add a vertex bevel weight layer";
ot->exec = mesh_customdata_bevel_weight_vertex_add_exec;
ot->poll = mesh_customdata_bevel_weight_vertex_add_poll;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static bool mesh_customdata_bevel_weight_vertex_clear_poll(bContext *C)
{
return (mesh_customdata_bevel_weight_vertex_state(C) == 1);
}
static int mesh_customdata_bevel_weight_vertex_clear_exec(bContext *C, wmOperator * /*op*/)
{
return mesh_customdata_clear_exec__internal(C, BM_VERT, CD_BWEIGHT);
}
void MESH_OT_customdata_bevel_weight_vertex_clear(wmOperatorType *ot)
{
ot->name = "Clear Vertex Bevel Weight";
ot->idname = "MESH_OT_customdata_bevel_weight_vertex_clear";
ot->description = "Clear the vertex bevel weight layer";
ot->exec = mesh_customdata_bevel_weight_vertex_clear_exec;
ot->poll = mesh_customdata_bevel_weight_vertex_clear_poll;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* Edge bevel weight. */
static int mesh_customdata_bevel_weight_edge_state(bContext *C)
{
const Object *ob = ED_object_context(C);
if (ob && ob->type == OB_MESH) {
const Mesh *mesh = static_cast<Mesh *>(ob->data);
if (!ID_IS_LINKED(mesh)) {
const CustomData *data = GET_CD_DATA(mesh, edata);
return CustomData_has_layer(data, CD_BWEIGHT);
}
}
return -1;
}
static bool mesh_customdata_bevel_weight_edge_add_poll(bContext *C)
{
return mesh_customdata_bevel_weight_edge_state(C) == 0;
}
static int mesh_customdata_bevel_weight_edge_add_exec(bContext *C, wmOperator * /*op*/)
{
return mesh_customdata_add_exec__internal(C, BM_EDGE, CD_BWEIGHT);
}
void MESH_OT_customdata_bevel_weight_edge_add(wmOperatorType *ot)
{
ot->name = "Add Edge Bevel Weight";
ot->idname = "MESH_OT_customdata_bevel_weight_edge_add";
ot->description = "Add an edge bevel weight layer";
ot->exec = mesh_customdata_bevel_weight_edge_add_exec;
ot->poll = mesh_customdata_bevel_weight_edge_add_poll;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static bool mesh_customdata_bevel_weight_edge_clear_poll(bContext *C)
{
return mesh_customdata_bevel_weight_edge_state(C) == 1;
}
static int mesh_customdata_bevel_weight_edge_clear_exec(bContext *C, wmOperator * /*op*/)
{
return mesh_customdata_clear_exec__internal(C, BM_EDGE, CD_BWEIGHT);
}
void MESH_OT_customdata_bevel_weight_edge_clear(wmOperatorType *ot)
{
ot->name = "Clear Edge Bevel Weight";
ot->idname = "MESH_OT_customdata_bevel_weight_edge_clear";
ot->description = "Clear the edge bevel weight layer";
ot->exec = mesh_customdata_bevel_weight_edge_clear_exec;
ot->poll = mesh_customdata_bevel_weight_edge_clear_poll;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* Edge crease. */
static int mesh_customdata_crease_edge_state(bContext *C)

View File

@ -323,10 +323,6 @@ void MESH_OT_customdata_skin_add(struct wmOperatorType *ot);
void MESH_OT_customdata_skin_clear(struct wmOperatorType *ot);
void MESH_OT_customdata_custom_splitnormals_add(struct wmOperatorType *ot);
void MESH_OT_customdata_custom_splitnormals_clear(struct wmOperatorType *ot);
void MESH_OT_customdata_bevel_weight_vertex_add(struct wmOperatorType *ot);
void MESH_OT_customdata_bevel_weight_vertex_clear(struct wmOperatorType *ot);
void MESH_OT_customdata_bevel_weight_edge_add(struct wmOperatorType *ot);
void MESH_OT_customdata_bevel_weight_edge_clear(struct wmOperatorType *ot);
void MESH_OT_customdata_crease_vertex_add(struct wmOperatorType *ot);
void MESH_OT_customdata_crease_vertex_clear(struct wmOperatorType *ot);
void MESH_OT_customdata_crease_edge_add(struct wmOperatorType *ot);

View File

@ -141,10 +141,6 @@ void ED_operatortypes_mesh(void)
WM_operatortype_append(MESH_OT_customdata_skin_clear);
WM_operatortype_append(MESH_OT_customdata_custom_splitnormals_add);
WM_operatortype_append(MESH_OT_customdata_custom_splitnormals_clear);
WM_operatortype_append(MESH_OT_customdata_bevel_weight_vertex_add);
WM_operatortype_append(MESH_OT_customdata_bevel_weight_vertex_clear);
WM_operatortype_append(MESH_OT_customdata_bevel_weight_edge_add);
WM_operatortype_append(MESH_OT_customdata_bevel_weight_edge_clear);
WM_operatortype_append(MESH_OT_customdata_crease_vertex_add);
WM_operatortype_append(MESH_OT_customdata_crease_vertex_clear);
WM_operatortype_append(MESH_OT_customdata_crease_edge_add);

View File

@ -186,7 +186,7 @@ static void bias_tangent_normal_pixels(
BLI_assert(channels >= 3);
for (int y = 0; y < height; y++) {
float *pixels = rect + ((size_t)stride) * y * channels;
float *pixels = rect + size_t(stride) * y * channels;
for (int x = 0; x < width; x++, pixels += channels) {
if (fabsf(pixels[0] - 0.5f) < 1.0f / 255.0f) {
pixels[0] = 0.5f + 1e-5f;

View File

@ -262,7 +262,7 @@ static void brush_painter_mask_imbuf_update(BrushPainter *painter,
if (!use_texture_old) {
brush_imbuf_tex_co(&tex_mapping, x, y, texco);
res = (ushort)(65535.0f * BKE_brush_sample_masktex(scene, brush, texco, thread, pool));
res = ushort(65535.0f * BKE_brush_sample_masktex(scene, brush, texco, thread, pool));
}
/* read from old texture buffer */
@ -1715,7 +1715,7 @@ static void paint_2d_fill_add_pixel_byte(const int x_px,
return;
}
coordinate = ((size_t)y_px) * ibuf->x + x_px;
coordinate = size_t(y_px) * ibuf->x + x_px;
if (!BLI_BITMAP_TEST(touched, coordinate)) {
float color_f[4];
@ -1744,7 +1744,7 @@ static void paint_2d_fill_add_pixel_float(const int x_px,
return;
}
coordinate = ((size_t)y_px) * ibuf->x + x_px;
coordinate = size_t(y_px) * ibuf->x + x_px;
if (!BLI_BITMAP_TEST(touched, coordinate)) {
if (len_squared_v4v4(ibuf->float_buffer.data + 4 * coordinate, color) <= threshold_sq) {
@ -1839,8 +1839,8 @@ void paint_2d_bucket_fill(const bContext *C,
if (do_float) {
for (x_px = 0; x_px < ibuf->x; x_px++) {
for (y_px = 0; y_px < ibuf->y; y_px++) {
blend_color_mix_float(ibuf->float_buffer.data + 4 * (((size_t)y_px) * ibuf->x + x_px),
ibuf->float_buffer.data + 4 * (((size_t)y_px) * ibuf->x + x_px),
blend_color_mix_float(ibuf->float_buffer.data + 4 * (size_t(y_px) * ibuf->x + x_px),
ibuf->float_buffer.data + 4 * (size_t(y_px) * ibuf->x + x_px),
color_f);
}
}
@ -1848,8 +1848,8 @@ void paint_2d_bucket_fill(const bContext *C,
else {
for (x_px = 0; x_px < ibuf->x; x_px++) {
for (y_px = 0; y_px < ibuf->y; y_px++) {
blend_color_mix_byte(ibuf->byte_buffer.data + 4 * (((size_t)y_px) * ibuf->x + x_px),
ibuf->byte_buffer.data + 4 * (((size_t)y_px) * ibuf->x + x_px),
blend_color_mix_byte(ibuf->byte_buffer.data + 4 * (size_t(y_px) * ibuf->x + x_px),
ibuf->byte_buffer.data + 4 * (size_t(y_px) * ibuf->x + x_px),
(uchar *)&color_b);
}
}
@ -1880,9 +1880,9 @@ void paint_2d_bucket_fill(const bContext *C,
ED_imapaint_dirty_region(ima, ibuf, iuser, 0, 0, ibuf->x, ibuf->y, false);
stack = BLI_stack_new(sizeof(size_t), __func__);
touched = BLI_BITMAP_NEW(((size_t)ibuf->x) * ibuf->y, "bucket_fill_bitmap");
touched = BLI_BITMAP_NEW(size_t(ibuf->x) * ibuf->y, "bucket_fill_bitmap");
coordinate = (((size_t)y_px) * ibuf->x + x_px);
coordinate = (size_t(y_px) * ibuf->x + x_px);
if (do_float) {
copy_v4_v4(pixel_color, ibuf->float_buffer.data + 4 * coordinate);
@ -2074,8 +2074,8 @@ void paint_2d_gradient_fill(
/* convert to premultiplied */
mul_v3_fl(color_f, color_f[3]);
color_f[3] *= brush_alpha;
IMB_blend_color_float(ibuf->float_buffer.data + 4 * (((size_t)y_px) * ibuf->x + x_px),
ibuf->float_buffer.data + 4 * (((size_t)y_px) * ibuf->x + x_px),
IMB_blend_color_float(ibuf->float_buffer.data + 4 * (size_t(y_px) * ibuf->x + x_px),
ibuf->float_buffer.data + 4 * (size_t(y_px) * ibuf->x + x_px),
color_f,
IMB_BlendMode(br->blend));
}
@ -2103,8 +2103,8 @@ void paint_2d_gradient_fill(
linearrgb_to_srgb_v3_v3(color_f, color_f);
rgba_float_to_uchar((uchar *)&color_b, color_f);
((uchar *)&color_b)[3] *= brush_alpha;
IMB_blend_color_byte(ibuf->byte_buffer.data + 4 * (((size_t)y_px) * ibuf->x + x_px),
ibuf->byte_buffer.data + 4 * (((size_t)y_px) * ibuf->x + x_px),
IMB_blend_color_byte(ibuf->byte_buffer.data + 4 * (size_t(y_px) * ibuf->x + x_px),
ibuf->byte_buffer.data + 4 * (size_t(y_px) * ibuf->x + x_px),
(uchar *)&color_b,
IMB_BlendMode(br->blend));
}

View File

@ -358,7 +358,7 @@ static int imapaint_pick_face(ViewContext *vc, const int mval[2], uint *r_index,
ED_view3d_select_id_validate(vc);
*r_index = DRW_select_buffer_sample_point(vc->depsgraph, vc->region, vc->v3d, mval);
if ((*r_index) == 0 || (*r_index) > (uint)totpoly) {
if ((*r_index) == 0 || (*r_index) > uint(totpoly)) {
return 0;
}

View File

@ -705,7 +705,7 @@ static int sculpt_face_set_init_exec(bContext *C, wmOperator *op)
}
case SCULPT_FACE_SETS_FROM_BEVEL_WEIGHT: {
const float *bevel_weights = static_cast<const float *>(
CustomData_get_layer(&mesh->edata, CD_BWEIGHT));
CustomData_get_layer_named(&mesh->edata, CD_PROP_FLOAT, "bevel_weight_edge"));
sculpt_face_sets_init_flood_fill(
ob, [&](const int /*from_face*/, const int edge, const int /*to_face*/) -> bool {
return bevel_weights ? bevel_weights[edge] < threshold : true;

View File

@ -1064,7 +1064,7 @@ static int console_paste_exec(bContext *C, wmOperator *op)
ConsoleLine *ci = console_history_verify(C);
int buf_len;
char *buf_str = WM_clipboard_text_get(selection, &buf_len);
char *buf_str = WM_clipboard_text_get(selection, true, &buf_len);
char *buf_step, *buf_next;
if (buf_str == NULL) {

View File

@ -504,7 +504,6 @@ static void node_shader_set_butfunc(bNodeType *ntype)
case SH_NODE_VECTOR_DISPLACEMENT:
ntype->draw_buttons = node_shader_buts_displacement;
break;
case SH_NODE_BSDF_GLOSSY:
case SH_NODE_BSDF_GLASS:
case SH_NODE_BSDF_REFRACTION:
ntype->draw_buttons = node_shader_buts_glossy;

View File

@ -132,7 +132,7 @@ static void text_listener(const wmSpaceTypeListenerParams *params)
switch (wmn->action) {
case NA_EDITED:
if (st->text) {
text_drawcache_tag_update(st, 1);
text_drawcache_tag_update(st, true);
text_update_edited(st->text);
}

View File

@ -712,7 +712,7 @@ static void text_update_drawcache(SpaceText *st, ARegion *region)
drawcache->valid_tail = 0;
}
void text_drawcache_tag_update(SpaceText *st, int full)
void text_drawcache_tag_update(SpaceText *st, const bool full)
{
/* This happens if text editor ops are called from Python. */
if (st == NULL) {

View File

@ -85,7 +85,7 @@ void wrap_offset_in_line(const struct SpaceText *st,
int *offc);
int text_get_char_pos(const struct SpaceText *st, const char *line, int cur);
void text_drawcache_tag_update(struct SpaceText *st, int full);
void text_drawcache_tag_update(struct SpaceText *st, bool full);
void text_free_caches(struct SpaceText *st);
bool text_do_suggest_select(struct SpaceText *st, struct ARegion *region, const int mval[2]);

View File

@ -306,7 +306,7 @@ static int text_new_exec(bContext *C, wmOperator *UNUSED(op))
st->top = 0;
st->runtime.scroll_ofs_px[0] = 0;
st->runtime.scroll_ofs_px[1] = 0;
text_drawcache_tag_update(st, 1);
text_drawcache_tag_update(st, true);
}
WM_event_add_notifier(C, NC_TEXT | NA_ADDED, text);
@ -389,7 +389,7 @@ static int text_open_exec(bContext *C, wmOperator *op)
st->runtime.scroll_ofs_px[1] = 0;
}
text_drawcache_tag_update(st, 1);
text_drawcache_tag_update(st, true);
WM_event_add_notifier(C, NC_TEXT | NA_ADDED, text);
MEM_freeN(op->customdata);
@ -479,7 +479,7 @@ static int text_reload_exec(bContext *C, wmOperator *op)
text_update_edited(text);
text_update_cursor_moved(C);
text_drawcache_tag_update(CTX_wm_space_text(C), 1);
text_drawcache_tag_update(st, true);
WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
text->flags &= ~TXT_ISDIRTY;
@ -538,7 +538,7 @@ static int text_unlink_exec(bContext *C, wmOperator *UNUSED(op))
BKE_id_delete(bmain, text);
text_drawcache_tag_update(st, 1);
text_drawcache_tag_update(st, true);
WM_event_add_notifier(C, NC_TEXT | NA_REMOVED, NULL);
return OPERATOR_FINISHED;
@ -918,18 +918,22 @@ void TEXT_OT_refresh_pyconstraints(wmOperatorType *ot)
static int text_paste_exec(bContext *C, wmOperator *op)
{
const bool selection = RNA_boolean_get(op->ptr, "selection");
SpaceText *st = CTX_wm_space_text(C);
Text *text = CTX_data_edit_text(C);
const bool selection = RNA_boolean_get(op->ptr, "selection");
char *buf;
int buf_len;
buf = WM_clipboard_text_get(selection, &buf_len);
/* No need for UTF8 validation as the conversion handles invalid sequences gracefully. */
buf = WM_clipboard_text_get(selection, false, &buf_len);
if (!buf) {
return OPERATOR_CANCELLED;
}
text_drawcache_tag_update(CTX_wm_space_text(C), 0);
text_drawcache_tag_update(st, false);
ED_text_undo_push_init(C);
@ -949,7 +953,7 @@ static int text_paste_exec(bContext *C, wmOperator *op)
WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
/* run the script while editing, evil but useful */
if (CTX_wm_space_text(C)->live_edit) {
if (st->live_edit) {
text_run_script(C, NULL);
}
@ -1070,9 +1074,10 @@ void TEXT_OT_copy(wmOperatorType *ot)
static int text_cut_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceText *st = CTX_wm_space_text(C);
Text *text = CTX_data_edit_text(C);
text_drawcache_tag_update(CTX_wm_space_text(C), 0);
text_drawcache_tag_update(st, false);
txt_copy_clipboard(text);
@ -1083,7 +1088,7 @@ static int text_cut_exec(bContext *C, wmOperator *UNUSED(op))
WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
/* run the script while editing, evil but useful */
if (CTX_wm_space_text(C)->live_edit) {
if (st->live_edit) {
text_run_script(C, NULL);
}
@ -1148,9 +1153,10 @@ void TEXT_OT_indent_or_autocomplete(wmOperatorType *ot)
static int text_indent_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceText *st = CTX_wm_space_text(C);
Text *text = CTX_data_edit_text(C);
text_drawcache_tag_update(CTX_wm_space_text(C), 0);
text_drawcache_tag_update(st, false);
ED_text_undo_push_init(C);
@ -1193,9 +1199,10 @@ void TEXT_OT_indent(wmOperatorType *ot)
static int text_unindent_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceText *st = CTX_wm_space_text(C);
Text *text = CTX_data_edit_text(C);
text_drawcache_tag_update(CTX_wm_space_text(C), 0);
text_drawcache_tag_update(st, false);
ED_text_undo_push_init(C);
@ -1238,7 +1245,7 @@ static int text_line_break_exec(bContext *C, wmOperator *UNUSED(op))
int a, curts;
int space = (text->flags & TXT_TABSTOSPACES) ? st->tabnumber : 1;
text_drawcache_tag_update(st, 0);
text_drawcache_tag_update(st, false);
/* Double check tabs/spaces before splitting the line. */
curts = txt_setcurr_tab_spaces(text, space);
@ -1290,11 +1297,12 @@ void TEXT_OT_line_break(wmOperatorType *ot)
static int text_comment_exec(bContext *C, wmOperator *op)
{
SpaceText *st = CTX_wm_space_text(C);
Text *text = CTX_data_edit_text(C);
int type = RNA_enum_get(op->ptr, "type");
const char *prefix = ED_text_format_comment_line_prefix(text);
text_drawcache_tag_update(CTX_wm_space_text(C), 0);
text_drawcache_tag_update(st, false);
ED_text_undo_push_init(C);
@ -1476,7 +1484,7 @@ static int text_convert_whitespace_exec(bContext *C, wmOperator *op)
text_update_edited(text);
text_update_cursor_moved(C);
text_drawcache_tag_update(st, 1);
text_drawcache_tag_update(st, true);
WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
return OPERATOR_FINISHED;
@ -2405,7 +2413,7 @@ static int text_delete_exec(bContext *C, wmOperator *op)
Text *text = CTX_data_edit_text(C);
int type = RNA_enum_get(op->ptr, "type");
text_drawcache_tag_update(st, 0);
text_drawcache_tag_update(st, true);
/* behavior could be changed here,
* but for now just don't jump words when we have a selection */
@ -3478,7 +3486,7 @@ static int text_insert_exec(bContext *C, wmOperator *op)
size_t i = 0;
uint code;
text_drawcache_tag_update(st, 0);
text_drawcache_tag_update(st, false);
str = RNA_string_get_alloc(op->ptr, "text", NULL, 0, &str_len);
@ -3513,6 +3521,7 @@ static int text_insert_exec(bContext *C, wmOperator *op)
static int text_insert_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
SpaceText *st = CTX_wm_space_text(C);
uint auto_close_char = 0;
int ret;
@ -3550,7 +3559,7 @@ static int text_insert_invoke(bContext *C, wmOperator *op, const wmEvent *event)
}
/* run the script while editing, evil but useful */
if (ret == OPERATOR_FINISHED && CTX_wm_space_text(C)->live_edit) {
if (ret == OPERATOR_FINISHED && st->live_edit) {
text_run_script(C, NULL);
}
@ -3629,7 +3638,7 @@ static int text_find_and_replace(bContext *C, wmOperator *op, short mode)
}
text_update_cursor_moved(C);
WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
text_drawcache_tag_update(CTX_wm_space_text(C), 1);
text_drawcache_tag_update(st, true);
}
}
MEM_freeN(tmp);
@ -3715,7 +3724,7 @@ static int text_replace_all(bContext *C)
} while (found);
WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
text_drawcache_tag_update(CTX_wm_space_text(C), 1);
text_drawcache_tag_update(st, true);
}
else {
/* Restore position */

View File

@ -209,7 +209,7 @@ static void text_undosys_step_decode(struct bContext *C,
st->text = text;
}
text_update_cursor_moved(C);
text_drawcache_tag_update(st, 1);
text_drawcache_tag_update(st, true);
WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
}

View File

@ -305,10 +305,12 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
BMEdge *eed;
BMIter iter;
const int cd_vert_bweight_offset = CustomData_get_offset(&bm->vdata, CD_BWEIGHT);
const int cd_vert_bweight_offset = CustomData_get_offset_named(
&bm->vdata, CD_PROP_FLOAT, "bevel_weight_vert");
const int cd_vert_crease_offset = CustomData_get_offset(&bm->vdata, CD_CREASE);
const int cd_vert_skin_offset = CustomData_get_offset(&bm->vdata, CD_MVERT_SKIN);
const int cd_edge_bweight_offset = CustomData_get_offset(&bm->edata, CD_BWEIGHT);
const int cd_edge_bweight_offset = CustomData_get_offset_named(
&bm->edata, CD_PROP_FLOAT, "bevel_weight_edge");
const int cd_edge_crease_offset = CustomData_get_offset(&bm->edata, CD_CREASE);
has_skinradius = (cd_vert_skin_offset != -1);
@ -997,10 +999,11 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
if (apply_vcos || median->bv_weight || median->v_crease || median->skin[0] ||
median->skin[1]) {
if (median->bv_weight) {
if (!CustomData_has_layer(&bm->vdata, CD_BWEIGHT)) {
BM_data_layer_add(bm, &bm->vdata, CD_BWEIGHT);
if (!CustomData_has_layer_named(&bm->vdata, CD_PROP_FLOAT, "bevel_weight_vert")) {
BM_data_layer_add_named(bm, &bm->vdata, CD_PROP_FLOAT, "bevel_weight_vert");
}
cd_vert_bweight_offset = CustomData_get_offset(&bm->vdata, CD_BWEIGHT);
cd_vert_bweight_offset = CustomData_get_offset_named(
&bm->vdata, CD_PROP_FLOAT, "bevel_weight_vert");
BLI_assert(cd_vert_bweight_offset != -1);
scale_bv_weight = compute_scale_factor(ve_median->bv_weight, median->bv_weight);
@ -1067,10 +1070,11 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
if (median->be_weight || median->e_crease) {
if (median->be_weight) {
if (!CustomData_has_layer(&bm->edata, CD_BWEIGHT)) {
BM_data_layer_add(bm, &bm->edata, CD_BWEIGHT);
if (!CustomData_has_layer_named(&bm->edata, CD_PROP_FLOAT, "bevel_weight_edge")) {
BM_data_layer_add_named(bm, &bm->edata, CD_PROP_FLOAT, "bevel_weight_edge");
}
cd_edge_bweight_offset = CustomData_get_offset(&bm->edata, CD_BWEIGHT);
cd_edge_bweight_offset = CustomData_get_offset_named(
&bm->edata, CD_PROP_FLOAT, "bevel_weight_edge");
BLI_assert(cd_edge_bweight_offset != -1);
scale_be_weight = compute_scale_factor(ve_median->be_weight, median->be_weight);

View File

@ -67,10 +67,11 @@ static void createTransEdge(bContext *UNUSED(C), TransInfo *t)
/* create data we need */
if (t->mode == TFM_BWEIGHT) {
if (!CustomData_has_layer(&em->bm->edata, CD_BWEIGHT)) {
BM_data_layer_add(em->bm, &em->bm->edata, CD_BWEIGHT);
if (!CustomData_has_layer_named(&em->bm->edata, CD_PROP_FLOAT, "bevel_weight_edge")) {
BM_data_layer_add_named(em->bm, &em->bm->edata, CD_PROP_FLOAT, "bevel_weight_edge");
}
cd_edge_float_offset = CustomData_get_offset(&em->bm->edata, CD_BWEIGHT);
cd_edge_float_offset = CustomData_get_offset_named(
&em->bm->edata, CD_PROP_FLOAT, "bevel_weight_edge");
}
else { /* if (t->mode == TFM_EDGE_CREASE) { */
BLI_assert(t->mode == TFM_EDGE_CREASE);

View File

@ -28,7 +28,7 @@
#include "transform_convert.h"
/* -------------------------------------------------------------------- */
/** \name Edit Mesh #CD_BWEIGHT and #CD_CREASE Transform Creation
/** \name Edit Mesh Bevel Weight and #CD_CREASE Transform Creation
* \{ */
static float *tc_mesh_cdata_transdata_center(const struct TransIslandData *island_data,
@ -85,10 +85,10 @@ static void createTransMeshVertCData(bContext *UNUSED(C), TransInfo *t)
int cd_offset = -1;
if (t->mode == TFM_BWEIGHT) {
if (!CustomData_has_layer(&bm->vdata, CD_BWEIGHT)) {
BM_data_layer_add(bm, &bm->vdata, CD_BWEIGHT);
if (!CustomData_has_layer_named(&bm->vdata, CD_PROP_FLOAT, "bevel_weight_vert")) {
BM_data_layer_add_named(bm, &bm->vdata, CD_PROP_FLOAT, "bevel_weight_vert");
}
cd_offset = CustomData_get_offset(&bm->vdata, CD_BWEIGHT);
cd_offset = CustomData_get_offset_named(&bm->vdata, CD_PROP_FLOAT, "bevel_weight_vert");
}
else {
if (!CustomData_has_layer(&bm->vdata, CD_CREASE)) {

View File

@ -474,6 +474,23 @@ static void protectflag_to_drawflags(short protectflag, short *drawflags)
}
}
/* Similar to #transform_object_deform_pose_armature_get but does not check visibility. */
static Object *gizmo_3d_transform_space_object_get(Scene *scene, ViewLayer *view_layer)
{
BKE_view_layer_synced_ensure(scene, view_layer);
Object *ob = BKE_view_layer_active_object_get(view_layer);
if (ob && ob->mode & OB_MODE_WEIGHT_PAINT) {
/* It is assumed that when the object is in Weight Paint mode, it is not in Edit mode. So we
* don't need to check the #OB_MODE_EDIT flag. */
BLI_assert(!(ob->mode & OB_MODE_EDIT));
Object *obpose = BKE_object_pose_armature_get(ob);
if (obpose != nullptr) {
ob = obpose;
}
}
return ob;
}
/**
* Run \a user_fn for each coordinate of elements selected in View3D (vertices, particles...).
* \note Each coordinate has the space matrix of the active object.
@ -519,15 +536,7 @@ static int gizmo_3d_foreach_selected(const bContext *C,
const bool is_curve_edit = GPENCIL_CURVE_EDIT_SESSIONS_ON(gpd);
int a, totsel = 0;
BKE_view_layer_synced_ensure(scene, view_layer);
Object *ob = BKE_view_layer_active_object_get(view_layer);
Object *obedit = OBEDIT_FROM_OBACT(ob);
if (ob && ob->mode & OB_MODE_WEIGHT_PAINT) {
Object *obpose = BKE_object_pose_armature_get(ob);
if (obpose != nullptr) {
ob = obpose;
}
}
Object *ob = gizmo_3d_transform_space_object_get(scene, view_layer);
if (is_gp_edit) {
float diff_mat[4][4];
@ -586,7 +595,7 @@ static int gizmo_3d_foreach_selected(const bContext *C,
}
}
}
else if (obedit) {
else if (Object *obedit = OBEDIT_FROM_OBACT(ob)) {
#define FOREACH_EDIT_OBJECT_BEGIN(ob_iter, use_mat_local) \
{ \
@ -937,15 +946,8 @@ int ED_transform_calc_gizmo_stats(const bContext *C,
(params->orientation_index - 1) :
BKE_scene_orientation_get_index(scene, SCE_ORIENT_DEFAULT);
BKE_view_layer_synced_ensure(scene, view_layer);
Object *ob = BKE_view_layer_active_object_get(view_layer);
Object *ob = gizmo_3d_transform_space_object_get(scene, view_layer);
Object *obedit = OBEDIT_FROM_OBACT(ob);
if (ob && ob->mode & OB_MODE_WEIGHT_PAINT) {
Object *obpose = BKE_object_pose_armature_get(ob);
if (obpose != nullptr) {
ob = obpose;
}
}
tbounds->use_matrix_space = false;
unit_m3(tbounds->axis);
@ -972,7 +974,7 @@ int ED_transform_calc_gizmo_stats(const bContext *C,
copy_m3_m4(diff_mat, ob->object_to_world);
normalize_m3(diff_mat);
invert_m3(diff_mat);
mul_m3_m3m3(tbounds->axis, tbounds->axis, diff_mat);
mul_m3_m3_pre(tbounds->axis, diff_mat);
normalize_m3(tbounds->axis);
tbounds->use_matrix_space = true;
@ -997,7 +999,7 @@ int ED_transform_calc_gizmo_stats(const bContext *C,
bGPdata *gpd = CTX_data_gpencil_data(C);
const bool is_gp_edit = GPENCIL_ANY_MODE(gpd);
if (!is_gp_edit && (obedit || (ob && (ob->mode & (OB_MODE_POSE | OB_MODE_SCULPT))))) {
if (ob && (ob->mode & OB_MODE_POSE)) {
if (ob->mode & OB_MODE_POSE) {
invert_m4_m4(ob->world_to_object, ob->object_to_world);
}
mul_m4_v3(ob->object_to_world, tbounds->center);

View File

@ -506,7 +506,7 @@ bool handleNumInput(bContext *C, NumInput *n, const wmEvent *event)
if (event->modifier & KM_CTRL) {
/* extract the first line from the clipboard */
int pbuf_len;
char *pbuf = WM_clipboard_text_get_firstline(false, &pbuf_len);
char *pbuf = WM_clipboard_text_get_firstline(false, true, &pbuf_len);
if (pbuf) {
const bool success = editstr_insert_at_cursor(n, pbuf, pbuf_len);

View File

@ -1441,7 +1441,7 @@ static void pack_islands_endjob(void *pidv)
DEG_id_tag_update(static_cast<ID *>(obedit->data), ID_RECALC_GEOMETRY);
WM_main_add_notifier(NC_GEOM | ND_DATA, obedit->data);
}
WM_main_add_notifier(NC_SPACE | ND_SPACE_IMAGE, NULL);
WM_main_add_notifier(NC_SPACE | ND_SPACE_IMAGE, nullptr);
if (pid->undo_str) {
ED_undo_push(pid->undo_context, pid->undo_str);

View File

@ -21,7 +21,6 @@ static inline bool naive_edges_equal(const int2 &edge1, const int2 &edge2)
static void add_new_vertices(Mesh &mesh, const Span<int> new_to_old_verts_map)
{
/* These types aren't supported for interpolation below. */
CustomData_free_layers(&mesh.vdata, CD_BWEIGHT, mesh.totvert);
CustomData_free_layers(&mesh.vdata, CD_SHAPEKEY, mesh.totvert);
CustomData_free_layers(&mesh.vdata, CD_CLOTH_ORCO, mesh.totvert);
CustomData_free_layers(&mesh.vdata, CD_MVERT_SKIN, mesh.totvert);

View File

@ -1158,7 +1158,7 @@ static void execute_realize_mesh_tasks(const RealizeInstancesOptions &options,
material_indices.finish();
if (all_meshes_info.no_loose_edges_hint) {
dst_mesh->loose_edges_tag_none();
dst_mesh->tag_loose_edges_none();
}
if (all_meshes_info.no_loose_verts_hint) {
dst_mesh->tag_loose_verts_none();

View File

@ -464,7 +464,6 @@ set(GLSL_SRC
shaders/material/gpu_shader_material_add_shader.glsl
shaders/material/gpu_shader_material_ambient_occlusion.glsl
shaders/material/gpu_shader_material_anisotropic.glsl
shaders/material/gpu_shader_material_attribute.glsl
shaders/material/gpu_shader_material_background.glsl
shaders/material/gpu_shader_material_bevel.glsl

View File

@ -178,6 +178,9 @@ bool Texture::init_view(GPUTexture *src_,
void Texture::usage_set(eGPUTextureUsage usage_flags)
{
gpu_image_usage_flags_ = usage_flags;
/* Metal: Texture clearing is done using framebuffer clear. This has no performance impact. */
/* TODO(fclem): Move this to metal backend instead to avoid side effects in other backends. */
gpu_image_usage_flags_ |= GPU_TEXTURE_USAGE_ATTACHMENT;
}
/** \} */

View File

@ -1390,9 +1390,15 @@ bool MTLShader::bake_compute_pipeline_state(MTLContext *ctx)
}
/* Compile PSO. */
MTLComputePipelineDescriptor *desc = [[MTLComputePipelineDescriptor alloc] init];
desc.maxTotalThreadsPerThreadgroup = 1024;
desc.computeFunction = compute_function;
id<MTLComputePipelineState> pso = [ctx->device
newComputePipelineStateWithFunction:compute_function
error:&error];
newComputePipelineStateWithDescriptor:desc
options:MTLPipelineOptionNone
reflection:nullptr
error:&error];
if (error) {
NSLog(@"Failed to create PSO for compute shader: %s error %@\n", this->name, error);

View File

@ -1,27 +0,0 @@
void node_bsdf_anisotropic(vec4 color,
float roughness,
float anisotropy,
float rotation,
vec3 N,
vec3 T,
float weight,
const float do_multiscatter,
out Closure result)
{
N = safe_normalize(N);
vec3 V = cameraVec(g_data.P);
float NV = dot(N, V);
vec2 split_sum = brdf_lut(NV, roughness);
ClosureReflection reflection_data;
reflection_data.weight = weight;
reflection_data.color = (do_multiscatter != 0.0) ?
F_brdf_multi_scatter(color.rgb, color.rgb, split_sum) :
F_brdf_single_scatter(color.rgb, color.rgb, split_sum);
reflection_data.N = N;
reflection_data.roughness = roughness;
result = closure_eval(reflection_data);
}

View File

@ -1,6 +1,13 @@
void node_bsdf_glossy(
vec4 color, float roughness, vec3 N, float weight, float do_multiscatter, out Closure result)
void node_bsdf_glossy(vec4 color,
float roughness,
float anisotropy,
float rotation,
vec3 N,
vec3 T,
float weight,
const float do_multiscatter,
out Closure result)
{
N = safe_normalize(N);
vec3 V = cameraVec(g_data.P);

View File

@ -201,7 +201,6 @@ typedef enum eCustomDataType {
#define CD_MASK_SHAPE_KEYINDEX (1 << CD_SHAPE_KEYINDEX)
#define CD_MASK_SHAPEKEY (1 << CD_SHAPEKEY)
#define CD_MASK_BWEIGHT (1 << CD_BWEIGHT)
#define CD_MASK_CREASE (1 << CD_CREASE)
#define CD_MASK_ORIGSPACE_MLOOP (1LL << CD_ORIGSPACE_MLOOP)
#define CD_MASK_PREVIEW_MLOOPCOL (1LL << CD_PREVIEW_MLOOPCOL)

View File

@ -325,12 +325,12 @@ typedef struct Mesh {
* \note To allow setting this status on meshes without changing them, this does not tag the
* cache dirty. If the mesh was changed first, the relevant dirty tags should be called first.
*/
void loose_edges_tag_none() const;
void tag_loose_edges_none() const;
/**
* Set the number of vertices not connected to edges to zero. Similar to #loose_edges_tag_none().
* Set the number of vertices not connected to edges to zero. Similar to #tag_loose_edges_none().
* There may still be vertices only used by loose edges though.
*
* \note If both #loose_edges_tag_none() and #tag_loose_verts_none() are called,
* \note If both #tag_loose_edges_none() and #tag_loose_verts_none() are called,
* all vertices are used by faces, so #verts_no_faces() will be tagged empty as well.
*/
void tag_loose_verts_none() const;

View File

@ -1518,11 +1518,6 @@ typedef struct NodeGeometryRaycast {
/* eCustomDataType. */
int8_t data_type;
/* Deprecated input types in new Ray-cast node. Can be removed when legacy nodes are no longer
* supported. */
uint8_t input_type_ray_direction;
uint8_t input_type_ray_length;
} NodeGeometryRaycast;
typedef struct NodeGeometryCurveFill {
@ -1698,7 +1693,7 @@ typedef struct NodeShaderMix {
/* glossy distributions */
#define SHD_GLOSSY_BECKMANN 0
#define SHD_GLOSSY_SHARP 1
#define SHD_GLOSSY_SHARP_DEPRECATED 1 /* deprecated */
#define SHD_GLOSSY_GGX 2
#define SHD_GLOSSY_ASHIKHMIN_SHIRLEY 3
#define SHD_GLOSSY_MULTI_GGX 4
@ -2437,9 +2432,6 @@ typedef enum GeometryNodeDeleteGeometryMode {
GEO_NODE_DELETE_GEOMETRY_MODE_ONLY_FACE = 2,
} GeometryNodeDeleteGeometryMode;
typedef enum GeometryNodeRealizeInstancesFlag {
GEO_NODE_REALIZE_INSTANCES_LEGACY_BEHAVIOR = (1 << 0),
} GeometryNodeRealizeInstancesFlag;
typedef enum GeometryNodeScaleElementsMode {
GEO_NODE_SCALE_ELEMENTS_UNIFORM = 0,

View File

@ -2163,7 +2163,7 @@ static void rna_def_gpencil_layer(BlenderRNA *brna)
prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_EULER);
RNA_def_property_float_sdna(prop, NULL, "rotation");
RNA_def_property_ui_text(prop, "Rotation", "Values for changes in rotation");
RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 100, RNA_TRANSLATION_PREC_DEFAULT);
RNA_def_property_update(prop, 0, "rna_GpencilLayerMatrix_update");
prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);

View File

@ -1655,7 +1655,7 @@ static void rna_def_modifier_gpenciloffset(BlenderRNA *brna)
prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_EULER);
RNA_def_property_float_sdna(prop, NULL, "rot");
RNA_def_property_ui_text(prop, "Rotation", "Values for changes in rotation");
RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 100, RNA_TRANSLATION_PREC_DEFAULT);
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);
@ -1673,7 +1673,7 @@ static void rna_def_modifier_gpenciloffset(BlenderRNA *brna)
prop = RNA_def_property(srna, "random_rotation", PROP_FLOAT, PROP_EULER);
RNA_def_property_float_sdna(prop, NULL, "rnd_rot");
RNA_def_property_ui_text(prop, "Random Rotation", "Value for changes in rotation");
RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 100, RNA_TRANSLATION_PREC_DEFAULT);
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
prop = RNA_def_property(srna, "random_scale", PROP_FLOAT, PROP_XYZ);
@ -2371,7 +2371,7 @@ static void rna_def_modifier_gpencilarray(BlenderRNA *brna)
prop = RNA_def_property(srna, "random_rotation", PROP_FLOAT, PROP_EULER);
RNA_def_property_float_sdna(prop, NULL, "rnd_rot");
RNA_def_property_ui_text(prop, "Random Rotation", "Value for changes in rotation");
RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 100, RNA_TRANSLATION_PREC_DEFAULT);
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
prop = RNA_def_property(srna, "random_scale", PROP_FLOAT, PROP_XYZ);

View File

@ -185,16 +185,6 @@ static bool rna_Mesh_has_custom_normals_get(PointerRNA *ptr)
return BKE_mesh_has_custom_loop_normals(me);
}
static bool rna_Mesh_has_edge_bevel_weight_get(PointerRNA *ptr)
{
return CustomData_has_layer(rna_mesh_edata(ptr), CD_BWEIGHT);
}
static bool rna_Mesh_has_vertex_bevel_weight_get(PointerRNA *ptr)
{
return CustomData_has_layer(rna_mesh_vdata(ptr), CD_BWEIGHT);
}
static bool rna_Mesh_has_edge_crease_get(PointerRNA *ptr)
{
return CustomData_has_layer(rna_mesh_edata(ptr), CD_CREASE);
@ -499,40 +489,6 @@ static void rna_MeshVertex_select_set(PointerRNA *ptr, bool value)
select_vert[index] = value;
}
static float rna_MeshVertex_bevel_weight_get(PointerRNA *ptr)
{
const Mesh *mesh = rna_mesh(ptr);
const int index = rna_MeshVertex_index_get(ptr);
const float *values = (const float *)CustomData_get_layer(&mesh->vdata, CD_BWEIGHT);
return values == NULL ? 0.0f : values[index];
}
static void rna_MeshVertex_bevel_weight_set(PointerRNA *ptr, float value)
{
Mesh *mesh = rna_mesh(ptr);
const int index = rna_MeshVertex_index_get(ptr);
float *values = (float *)CustomData_add_layer(
&mesh->vdata, CD_BWEIGHT, CD_SET_DEFAULT, mesh->totvert);
values[index] = clamp_f(value, 0.0f, 1.0f);
}
static float rna_MEdge_bevel_weight_get(PointerRNA *ptr)
{
const Mesh *mesh = rna_mesh(ptr);
const int index = rna_MeshEdge_index_get(ptr);
const float *values = (const float *)CustomData_get_layer(&mesh->edata, CD_BWEIGHT);
return values == NULL ? 0.0f : values[index];
}
static void rna_MEdge_bevel_weight_set(PointerRNA *ptr, float value)
{
Mesh *mesh = rna_mesh(ptr);
const int index = rna_MeshEdge_index_get(ptr);
float *values = (float *)CustomData_add_layer(
&mesh->edata, CD_BWEIGHT, CD_SET_DEFAULT, mesh->totedge);
values[index] = clamp_f(value, 0.0f, 1.0f);
}
static float rna_MEdge_crease_get(PointerRNA *ptr)
{
const Mesh *mesh = rna_mesh(ptr);
@ -2302,13 +2258,6 @@ static void rna_def_mvert(BlenderRNA *brna)
RNA_def_property_boolean_funcs(prop, "rna_MeshVertex_hide_get", "rna_MeshVertex_hide_set");
RNA_def_property_update(prop, 0, "rna_Mesh_update_select");
prop = RNA_def_property(srna, "bevel_weight", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_funcs(
prop, "rna_MeshVertex_bevel_weight_get", "rna_MeshVertex_bevel_weight_set", NULL);
RNA_def_property_ui_text(
prop, "Bevel Weight", "Weight used by the Bevel modifier 'Only Vertices' option");
RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all");
prop = RNA_def_property(srna, "groups", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_funcs(prop,
"rna_MeshVertex_groups_begin",
@ -2362,12 +2311,6 @@ static void rna_def_medge(BlenderRNA *brna)
prop, "Crease", "Weight used by the Subdivision Surface modifier for creasing");
RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all");
prop = RNA_def_property(srna, "bevel_weight", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_funcs(
prop, "rna_MEdge_bevel_weight_get", "rna_MEdge_bevel_weight_set", NULL);
RNA_def_property_ui_text(prop, "Bevel Weight", "Weight used by the Bevel modifier");
RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all");
prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_funcs(prop, "rna_MeshEdge_select_get", "rna_MeshEdge_select_set");
RNA_def_property_ui_text(prop, "Select", "");
@ -3792,18 +3735,6 @@ static void rna_def_mesh(BlenderRNA *brna)
RNA_def_property_boolean_funcs(prop, "rna_Mesh_has_custom_normals_get", NULL);
RNA_define_verify_sdna(true);
prop = RNA_def_property(srna, "has_bevel_weight_edge", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(
prop, "Has Edge Bevel Weight", "True if the mesh has an edge bevel weight layer");
RNA_def_property_boolean_funcs(prop, "rna_Mesh_has_edge_bevel_weight_get", NULL);
prop = RNA_def_property(srna, "has_bevel_weight_vertex", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(
prop, "Has Vertex Bevel Weight", "True if the mesh has an vertex bevel weight layer");
RNA_def_property_boolean_funcs(prop, "rna_Mesh_has_vertex_bevel_weight_get", NULL);
prop = RNA_def_property(srna, "has_crease_edge", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Has Edge Crease", "True if the mesh has an edge crease layer");

View File

@ -387,6 +387,7 @@ static void rna_def_metaball(BlenderRNA *brna)
RNA_def_property_float(prop, NULL, "rot");
RNA_def_property_ui_text(prop, "Texture Space Rotation", "Texture space rotation");
RNA_def_property_editable_func(prop, "rna_Meta_texspace_editable");
RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 100, RNA_TRANSLATION_PREC_DEFAULT);
RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
# endif

View File

@ -1185,6 +1185,9 @@ static bNode *rna_NodeTree_node_new(bNodeTree *ntree,
return NULL;
}
/* If the given idname is an alias, translate it to the proper idname. */
type = nodeTypeFindAlias(type);
ntype = nodeTypeFind(type);
if (!ntype) {
BKE_reportf(reports, RPT_ERROR, "Node type %s undefined", type);
@ -4740,11 +4743,6 @@ static const EnumPropertyItem node_ycc_items[] = {
};
static const EnumPropertyItem node_glossy_items[] = {
{SHD_GLOSSY_SHARP,
"SHARP",
0,
"Sharp",
"Results in perfectly sharp reflections like a mirror. The Roughness value is not used"},
{SHD_GLOSSY_BECKMANN, "BECKMANN", 0, "Beckmann", ""},
{SHD_GLOSSY_GGX, "GGX", 0, "GGX", ""},
{SHD_GLOSSY_ASHIKHMIN_SHIRLEY, "ASHIKHMIN_SHIRLEY", 0, "Ashikhmin-Shirley", ""},
@ -4757,25 +4755,7 @@ static const EnumPropertyItem node_glossy_items[] = {
{0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem node_anisotropic_items[] = {
{SHD_GLOSSY_BECKMANN, "BECKMANN", 0, "Beckmann", ""},
{SHD_GLOSSY_GGX, "GGX", 0, "GGX", ""},
{SHD_GLOSSY_MULTI_GGX,
"MULTI_GGX",
0,
"Multiscatter GGX",
"Slower than GGX but gives a more energy conserving results, which would otherwise be "
"visible as excessive darkening"},
{SHD_GLOSSY_ASHIKHMIN_SHIRLEY, "ASHIKHMIN_SHIRLEY", 0, "Ashikhmin-Shirley", ""},
{0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem node_glass_items[] = {
{SHD_GLOSSY_SHARP,
"SHARP",
0,
"Sharp",
"Results in perfectly sharp reflections like a mirror. The Roughness value is not used"},
{SHD_GLOSSY_BECKMANN, "BECKMANN", 0, "Beckmann", ""},
{SHD_GLOSSY_GGX, "GGX", 0, "GGX", ""},
{SHD_GLOSSY_MULTI_GGX,
@ -4788,11 +4768,6 @@ static const EnumPropertyItem node_glass_items[] = {
};
static const EnumPropertyItem node_refraction_items[] = {
{SHD_GLOSSY_SHARP,
"SHARP",
0,
"Sharp",
"Results in perfectly sharp reflections like a mirror. The Roughness value is not used"},
{SHD_GLOSSY_BECKMANN, "BECKMANN", 0, "Beckmann", ""},
{SHD_GLOSSY_GGX, "GGX", 0, "GGX", ""},
{0, NULL, 0, NULL, NULL},
@ -6301,17 +6276,6 @@ static void def_refraction(StructRNA *srna)
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_anisotropic(StructRNA *srna)
{
PropertyRNA *prop;
prop = RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "custom1");
RNA_def_property_enum_items(prop, node_anisotropic_items);
RNA_def_property_ui_text(prop, "Distribution", "Light scattering distribution on rough surface");
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_toon(StructRNA *srna)
{
PropertyRNA *prop;
@ -11274,16 +11238,6 @@ static void def_geo_viewer(StructRNA *srna)
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_geo_realize_instances(StructRNA *srna)
{
PropertyRNA *prop;
prop = RNA_def_property(srna, "legacy_behavior", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "custom1", GEO_NODE_REALIZE_INSTANCES_LEGACY_BEHAVIOR);
RNA_def_property_ui_text(
prop, "Legacy Behavior", "Behave like before instance attributes existed");
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_GeometryNode_socket_update");
}
static void def_geo_evaluate_at_index(StructRNA *srna)
{

View File

@ -3316,6 +3316,7 @@ static void rna_def_object(BlenderRNA *brna)
prop = RNA_def_property(srna, "rotation_euler", PROP_FLOAT, PROP_EULER);
RNA_def_property_float_sdna(prop, NULL, "rot");
RNA_def_property_editable_array_func(prop, "rna_Object_rotation_euler_editable");
RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 100, RNA_TRANSLATION_PREC_DEFAULT);
RNA_def_property_ui_text(prop, "Euler Rotation", "Rotation in Eulers");
RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
@ -3363,6 +3364,7 @@ static void rna_def_object(BlenderRNA *brna)
prop,
"Delta Rotation (Euler)",
"Extra rotation added to the rotation of the object (when using Euler rotations)");
RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 100, RNA_TRANSLATION_PREC_DEFAULT);
RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
prop = RNA_def_property(srna, "delta_rotation_quaternion", PROP_FLOAT, PROP_QUATERNION);

View File

@ -1097,6 +1097,7 @@ static void rna_def_pose_channel(BlenderRNA *brna)
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
RNA_def_property_editable_array_func(prop, "rna_PoseChannel_rotation_euler_editable");
RNA_def_property_ui_text(prop, "Euler Rotation", "Rotation in Eulers");
RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 100, RNA_TRANSLATION_PREC_DEFAULT);
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
prop = RNA_def_property(srna, "rotation_mode", PROP_ENUM, PROP_NONE);
@ -1356,6 +1357,7 @@ static void rna_def_pose_channel(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "custom_rotation_euler");
RNA_def_property_ui_text(
prop, "Custom Shape Rotation", "Adjust the rotation of the custom shape");
RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 100, RNA_TRANSLATION_PREC_DEFAULT);
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
prop = RNA_def_property(srna, "use_custom_shape_bone_size", PROP_BOOLEAN, PROP_NONE);

View File

@ -2934,6 +2934,7 @@ static void rna_def_view3d_cursor(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_float_sdna(prop, NULL, "rotation_euler");
RNA_def_property_ui_text(prop, "Euler Rotation", "3D rotation");
RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 100, RNA_TRANSLATION_PREC_DEFAULT);
RNA_def_property_update(prop, NC_WINDOW, NULL);
prop = RNA_def_property(srna, "rotation_mode", PROP_ENUM, PROP_NONE);

View File

@ -7165,7 +7165,7 @@ static void rna_def_space_filebrowser(BlenderRNA *brna)
NULL,
NULL,
NULL);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_flag(prop, PROP_EDITABLE);
prop = RNA_def_int(srna,
"bookmarks_active",
@ -7196,7 +7196,7 @@ static void rna_def_space_filebrowser(BlenderRNA *brna)
NULL,
NULL,
NULL);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_flag(prop, PROP_EDITABLE);
prop = RNA_def_int(srna,
"recent_folders_active",

View File

@ -506,6 +506,7 @@ static void rna_def_texmapping(BlenderRNA *brna)
prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_EULER);
RNA_def_property_float_sdna(prop, NULL, "rot");
RNA_def_property_ui_text(prop, "Rotation", "");
RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 100, RNA_TRANSLATION_PREC_DEFAULT);
RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);

View File

@ -72,10 +72,6 @@ static void requiredDataMask(ModifierData *md, CustomData_MeshMasks *r_cddata_ma
if (bmd->defgrp_name[0] != '\0') {
r_cddata_masks->vmask |= CD_MASK_MDEFORMVERT;
}
if (bmd->lim_flags & MOD_BEVEL_WEIGHT) {
r_cddata_masks->vmask |= CD_MASK_BWEIGHT;
r_cddata_masks->emask |= CD_MASK_BWEIGHT;
}
}
/*
@ -125,10 +121,15 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
MOD_get_vgroup(ctx->object, mesh, bmd->defgrp_name, &dvert, &vgroup);
}
const int bweight_offset_vert = CustomData_get_offset_named(
&bm->vdata, CD_PROP_FLOAT, "bevel_weight_vert");
const int bweight_offset_edge = CustomData_get_offset_named(
&bm->edata, CD_PROP_FLOAT, "bevel_weight_edge");
if (bmd->affect_type == MOD_BEVEL_AFFECT_VERTICES) {
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
if (bmd->lim_flags & MOD_BEVEL_WEIGHT) {
weight = BM_elem_float_data_get(&bm->vdata, v, CD_BWEIGHT);
weight = bweight_offset_vert == -1 ? 0.0f : BM_ELEM_CD_GET_FLOAT(v, bweight_offset_vert);
if (weight == 0.0f) {
continue;
}
@ -165,7 +166,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
if (BM_edge_is_manifold(e)) {
if (bmd->lim_flags & MOD_BEVEL_WEIGHT) {
weight = BM_elem_float_data_get(&bm->edata, e, CD_BWEIGHT);
weight = bweight_offset_edge == -1 ? 0.0f : BM_ELEM_CD_GET_FLOAT(e, bweight_offset_edge);
if (weight == 0.0f) {
continue;
}

View File

@ -385,8 +385,8 @@ Mesh *MOD_solidify_extrude_modifyMesh(ModifierData *md, const ModifierEvalContex
float *result_edge_bweight = nullptr;
if (do_bevel_convex) {
result_edge_bweight = static_cast<float *>(
CustomData_add_layer(&result->edata, CD_BWEIGHT, CD_SET_DEFAULT, result->totedge));
result_edge_bweight = static_cast<float *>(CustomData_add_layer_named(
&result->edata, CD_PROP_FLOAT, CD_SET_DEFAULT, result->totedge, "bevel_weight_edge"));
}
/* Initializes: (`i_end`, `do_shell_align`, `vert_index`). */

View File

@ -191,9 +191,9 @@ Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md,
/* These might be null. */
const float *orig_vert_bweight = static_cast<const float *>(
CustomData_get_layer(&mesh->vdata, CD_BWEIGHT));
CustomData_get_layer_named(&mesh->vdata, CD_PROP_FLOAT, "bevel_weight_vert"));
const float *orig_edge_bweight = static_cast<const float *>(
CustomData_get_layer(&mesh->edata, CD_BWEIGHT));
CustomData_get_layer_named(&mesh->edata, CD_PROP_FLOAT, "bevel_weight_edge"));
const float *orig_edge_crease = static_cast<const float *>(
CustomData_get_layer(&mesh->edata, CD_CREASE));
@ -2001,11 +2001,11 @@ Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md,
int *origindex_poly = static_cast<int *>(
CustomData_get_layer_for_write(&result->pdata, CD_ORIGINDEX, result->totpoly));
float *result_edge_bweight = static_cast<float *>(
CustomData_get_layer_for_write(&result->edata, CD_BWEIGHT, result->totedge));
float *result_edge_bweight = static_cast<float *>(CustomData_get_layer_named_for_write(
&result->edata, CD_PROP_FLOAT, "bevel_weight_edge", result->totedge));
if (bevel_convex != 0.0f || orig_vert_bweight != nullptr) {
result_edge_bweight = static_cast<float *>(
CustomData_add_layer(&result->edata, CD_BWEIGHT, CD_SET_DEFAULT, result->totedge));
result_edge_bweight = static_cast<float *>(CustomData_add_layer_named(
&result->edata, CD_PROP_FLOAT, CD_SET_DEFAULT, result->totedge, "bevel_weight_edge"));
}
/* Checks that result has dvert data. */

View File

@ -59,10 +59,9 @@ DefNode(ShaderNode, SH_NODE_ATTRIBUTE, def_sh_attribute, "ATT
DefNode(ShaderNode, SH_NODE_AMBIENT_OCCLUSION, def_sh_ambient_occlusion,"AMBIENT_OCCLUSION", AmbientOcclusion, "Ambient Occlusion", "Compute how much the hemisphere above the shading point is occluded, for example to add weathering effects to corners.\nNote: For Cycles, this may slow down renders significantly")
DefNode(ShaderNode, SH_NODE_BACKGROUND, 0, "BACKGROUND", Background, "Background", "Add background light emission.\nNote: This node should only be used for the world surface output")
DefNode(ShaderNode, SH_NODE_HOLDOUT, 0, "HOLDOUT", Holdout, "Holdout", "Create a \"hole\" in the image with zero alpha transparency, which is useful for compositing.\nNote: the holdout shader can only create alpha when transparency is enabled in the film settings")
DefNode(ShaderNode, SH_NODE_BSDF_ANISOTROPIC, def_anisotropic, "BSDF_ANISOTROPIC", BsdfAnisotropic, "Anisotropic BSDF", "Glossy reflection with separate control over U and V direction roughness")
DefNode(ShaderNode, SH_NODE_BSDF_DIFFUSE, 0, "BSDF_DIFFUSE", BsdfDiffuse, "Diffuse BSDF", "Lambertian and Oren-Nayar diffuse reflection")
DefNode(ShaderNode, SH_NODE_BSDF_PRINCIPLED, def_principled, "BSDF_PRINCIPLED", BsdfPrincipled, "Principled BSDF", "Physically-based, easy-to-use shader for rendering surface materials, based on the Disney principled model also known as the \"PBR\" shader")
DefNode(ShaderNode, SH_NODE_BSDF_GLOSSY, def_glossy, "BSDF_GLOSSY", BsdfGlossy, "Glossy BSDF", "Reflection with microfacet distribution, used for materials such as metal or mirrors")
DefNode(ShaderNode, SH_NODE_BSDF_GLOSSY, def_glossy, "BSDF_GLOSSY", BsdfAnisotropic, "Glossy BSDF", "Reflection with microfacet distribution, used for materials such as metal or mirrors")
DefNode(ShaderNode, SH_NODE_BSDF_GLASS, def_glass, "BSDF_GLASS", BsdfGlass, "Glass BSDF", "Glass-like shader mixing refraction and reflection at grazing angles")
DefNode(ShaderNode, SH_NODE_BSDF_REFRACTION, def_refraction, "BSDF_REFRACTION", BsdfRefraction, "Refraction BSDF", "Glossy refraction with sharp or microfacet distribution, typically used for materials that transmit light")
DefNode(ShaderNode, SH_NODE_BSDF_TRANSLUCENT, 0, "BSDF_TRANSLUCENT", BsdfTranslucent, "Translucent BSDF", "Lambertian diffuse transmission")
@ -282,10 +281,10 @@ DefNode(FunctionNode, FN_NODE_VALUE_TO_STRING, 0, "VALUE_TO_STRING", ValueToStri
DefNode(GeometryNode, GEO_NODE_ACCUMULATE_FIELD, def_geo_accumulate_field, "ACCUMULATE_FIELD", AccumulateField, "Accumulate Field", "Add the values of an evaluated field together and output the running total for each element")
DefNode(GeometryNode, GEO_NODE_ATTRIBUTE_DOMAIN_SIZE, def_geo_attribute_domain_size, "ATTRIBUTE_DOMAIN_SIZE", AttributeDomainSize, "Domain Size", "Retrieve the number of elements in a geometry for each attribute domain")
DefNode(GeometryNode, GEO_NODE_ATTRIBUTE_STATISTIC, def_geo_attribute_statistic, "ATTRIBUTE_STATISTIC",AttributeStatistic, "Attribute Statistic","Calculate statistics about a data set from a field evaluated on a geometry")
DefNode(GeometryNode, GEO_NODE_ATTRIBUTE_STATISTIC, def_geo_attribute_statistic, "ATTRIBUTE_STATISTIC",AttributeStatistic, "Attribute Statistic", "Calculate statistics about a data set from a field evaluated on a geometry")
DefNode(GeometryNode, GEO_NODE_BLUR_ATTRIBUTE, def_geo_blur_attribute, "BLUR_ATTRIBUTE", BlurAttribute, "Blur Attribute", "Mix attribute values of neighboring elements")
DefNode(GeometryNode, GEO_NODE_BOUNDING_BOX, 0, "BOUNDING_BOX", BoundBox, "Bounding Box", "Calculate the limits of a geometry's positions and generate a box mesh with those dimensions")
DefNode(GeometryNode, GEO_NODE_CAPTURE_ATTRIBUTE, def_geo_attribute_capture,"CAPTURE_ATTRIBUTE", CaptureAttribute, "Capture Attribute", "Store the result of a field on a geometry and output the data as a node socket. Allows remembering or interpolating data as the geometry changes, such as positions before deformation")
DefNode(GeometryNode, GEO_NODE_CAPTURE_ATTRIBUTE, def_geo_attribute_capture, "CAPTURE_ATTRIBUTE", CaptureAttribute, "Capture Attribute", "Store the result of a field on a geometry and output the data as a node socket. Allows remembering or interpolating data as the geometry changes, such as positions before deformation")
DefNode(GeometryNode, GEO_NODE_COLLECTION_INFO, def_geo_collection_info, "COLLECTION_INFO", CollectionInfo, "Collection Info", "Retrieve geometry instances from a collection")
DefNode(GeometryNode, GEO_NODE_CONVEX_HULL, 0, "CONVEX_HULL", ConvexHull, "Convex Hull", "Create a mesh that encloses all points in the input geometry with the smallest number of points")
DefNode(GeometryNode, GEO_NODE_CURVE_ENDPOINT_SELECTION, 0, "CURVE_ENDPOINT_SELECTION", CurveEndpointSelection, "Endpoint Selection", "Provide a selection for an arbitrary number of endpoints in each spline")
@ -301,7 +300,7 @@ DefNode(GeometryNode, GEO_NODE_CURVE_PRIMITIVE_SPIRAL,0, "CURVE_PRIMITIVE_SPIRAL
DefNode(GeometryNode, GEO_NODE_CURVE_PRIMITIVE_STAR, 0, "CURVE_PRIMITIVE_STAR", CurveStar, "Star", "Generate a poly spline in a star pattern by connecting alternating points of two circles")
DefNode(GeometryNode, GEO_NODE_CURVE_SET_HANDLE_TYPE, def_geo_curve_set_handle_type, "CURVE_SET_HANDLES", CurveSetHandles, "Set Handle Type", "Set the handle type for the control points of a Bézier curve")
DefNode(GeometryNode, GEO_NODE_CURVE_SPLINE_PARAMETER,0, "SPLINE_PARAMETER", SplineParameter, "Spline Parameter", "Retrieve how far along each spline a control point is")
DefNode(GeometryNode, GEO_NODE_CURVE_SPLINE_TYPE, def_geo_curve_spline_type,"CURVE_SPLINE_TYPE", CurveSplineType, "Set Spline Type", "Change the type of curves")
DefNode(GeometryNode, GEO_NODE_CURVE_SPLINE_TYPE, def_geo_curve_spline_type, "CURVE_SPLINE_TYPE", CurveSplineType, "Set Spline Type", "Change the type of curves")
DefNode(GeometryNode, GEO_NODE_CURVE_TO_MESH, 0, "CURVE_TO_MESH", CurveToMesh, "Curve to Mesh", "Convert curves into a mesh, optionally with a custom profile shape defined by curves")
DefNode(GeometryNode, GEO_NODE_CURVE_TO_POINTS, def_geo_curve_to_points, "CURVE_TO_POINTS", CurveToPoints, "Curve to Points", "Generate a point cloud by sampling positions along curves")
DefNode(GeometryNode, GEO_NODE_CURVE_TOPOLOGY_CURVE_OF_POINT, 0, "CURVE_OF_POINT", CurveOfPoint, "Curve of Point", "Retrieve the curve a control point is part of")
@ -326,7 +325,7 @@ DefNode(GeometryNode, GEO_NODE_IMAGE_INFO, 0, "IMAGE_INFO", ImageInfo, "Image In
DefNode(GeometryNode, GEO_NODE_IMAGE_TEXTURE, def_geo_image_texture, "IMAGE_TEXTURE", ImageTexture, "Image Texture", "Sample values from an image texture")
DefNode(GeometryNode, GEO_NODE_INDEX_OF_NEAREST, 0, "INDEX_OF_NEAREST", IndexOfNearest, "Index of Nearest", "Find the nearest element in a group. Similar to the \"Sample Nearest\" node")
DefNode(GeometryNode, GEO_NODE_IMAGE, def_geo_image, "IMAGE", InputImage, "Image", "Input image")
DefNode(GeometryNode, GEO_NODE_INPUT_CURVE_HANDLES, 0, "INPUT_CURVE_HANDLES", InputCurveHandlePositions,"Curve Handle Positions", "Retrieve the position of each Bézier control point's handles")
DefNode(GeometryNode, GEO_NODE_INPUT_CURVE_HANDLES, 0, "INPUT_CURVE_HANDLES", InputCurveHandlePositions, "Curve Handle Positions", "Retrieve the position of each Bézier control point's handles")
DefNode(GeometryNode, GEO_NODE_INPUT_CURVE_TILT, 0, "INPUT_CURVE_TILT", InputCurveTilt, "Curve Tilt", "Retrieve the angle at each control point used to twist the curve's normal around its tangent")
DefNode(GeometryNode, GEO_NODE_INPUT_ID, 0, "INPUT_ID", InputID, "ID", "Retrieve a stable random identifier value from the \"id\" attribute on the point domain, or the index if the attribute does not exist")
DefNode(GeometryNode, GEO_NODE_INPUT_INDEX, 0, "INDEX", InputIndex, "Index", "Retrieve an integer value indicating the position of each element in the list, starting at zero")
@ -355,12 +354,12 @@ DefNode(GeometryNode, GEO_NODE_INPUT_SPLINE_LENGTH, 0, "SPLINE_LENGTH", SplineLe
DefNode(GeometryNode, GEO_NODE_INPUT_SPLINE_RESOLUTION, 0, "INPUT_SPLINE_RESOLUTION", InputSplineResolution, "Spline Resolution", "Retrieve the number of evaluated points that will be generated for every control point on curves")
DefNode(GeometryNode, GEO_NODE_INPUT_TANGENT, 0, "INPUT_TANGENT", InputTangent, "Curve Tangent", "Retrieve the direction of curves at each control point")
DefNode(GeometryNode, GEO_NODE_INSTANCE_ON_POINTS, 0, "INSTANCE_ON_POINTS", InstanceOnPoints, "Instance on Points", "Generate a reference to geometry at each of the input points, without duplicating its underlying data")
DefNode(GeometryNode, GEO_NODE_INSTANCES_TO_POINTS, 0, "INSTANCES_TO_POINTS",InstancesToPoints, "Instances to Points","Generate points at the origins of instances.\nNote: Nested instances are not affected by this node")
DefNode(GeometryNode, GEO_NODE_INSTANCES_TO_POINTS, 0, "INSTANCES_TO_POINTS",InstancesToPoints, "Instances to Points", "Generate points at the origins of instances.\nNote: Nested instances are not affected by this node")
DefNode(GeometryNode, GEO_NODE_IS_VIEWPORT, 0, "IS_VIEWPORT", IsViewport, "Is Viewport", "Retrieve whether the nodes are being evaluated for the viewport rather than the final render")
DefNode(GeometryNode, GEO_NODE_JOIN_GEOMETRY, 0, "JOIN_GEOMETRY", JoinGeometry, "Join Geometry", "Merge separately generated geometries into a single one")
DefNode(GeometryNode, GEO_NODE_MATERIAL_SELECTION, 0, "MATERIAL_SELECTION", MaterialSelection, "Material Selection", "Provide a selection of faces that use the specified material")
DefNode(GeometryNode, GEO_NODE_MEAN_FILTER_SDF_VOLUME, 0, "MEAN_FILTER_SDF_VOLUME", MeanFilterSDFVolume, "Mean Filter SDF Volume", "Smooth the surface of an SDF volume by applying a mean filter")
DefNode(GeometryNode, GEO_NODE_MERGE_BY_DISTANCE, def_geo_merge_by_distance,"MERGE_BY_DISTANCE", MergeByDistance, "Merge by Distance", "Merge vertices or points within a given distance")
DefNode(GeometryNode, GEO_NODE_MERGE_BY_DISTANCE, def_geo_merge_by_distance, "MERGE_BY_DISTANCE", MergeByDistance, "Merge by Distance", "Merge vertices or points within a given distance")
DefNode(GeometryNode, GEO_NODE_MESH_BOOLEAN, def_geo_boolean, "MESH_BOOLEAN", MeshBoolean, "Mesh Boolean", "Cut, subtract, or join multiple mesh inputs")
DefNode(GeometryNode, GEO_NODE_MESH_FACE_GROUP_BOUNDARIES, 0, "MESH_FACE_SET_BOUNDARIES", MeshFaceSetBoundaries, "Face Group Boundaries", "Find edges on the boundaries between groups of faces with the same ID value")
DefNode(GeometryNode, GEO_NODE_MESH_PRIMITIVE_CIRCLE, def_geo_mesh_circle, "MESH_PRIMITIVE_CIRCLE", MeshCircle, "Mesh Circle", "Generate a circular ring of edges")
@ -391,7 +390,7 @@ DefNode(GeometryNode, GEO_NODE_POINTS_TO_VOLUME, def_geo_points_to_volume, "POIN
DefNode(GeometryNode, GEO_NODE_POINTS, 0, "POINTS", Points, "Points", "Generate a point cloud with positions and radii defined by fields")
DefNode(GeometryNode, GEO_NODE_PROXIMITY, def_geo_proximity, "PROXIMITY", Proximity, "Geometry Proximity", "Compute the closest location on the target geometry")
DefNode(GeometryNode, GEO_NODE_RAYCAST, def_geo_raycast, "RAYCAST", Raycast, "Raycast", "Cast rays from the context geometry onto a target geometry, and retrieve information from each hit point")
DefNode(GeometryNode, GEO_NODE_REALIZE_INSTANCES, def_geo_realize_instances,"REALIZE_INSTANCES", RealizeInstances, "Realize Instances", "Convert instances into real geometry data")
DefNode(GeometryNode, GEO_NODE_REALIZE_INSTANCES, 0, "REALIZE_INSTANCES", RealizeInstances, "Realize Instances", "Convert instances into real geometry data")
DefNode(GeometryNode, GEO_NODE_REMOVE_ATTRIBUTE, 0, "REMOVE_ATTRIBUTE", RemoveAttribute, "Remove Named Attribute", "Delete an attribute with a specified name from a geometry. Typically used to optimize performance")
DefNode(GeometryNode, GEO_NODE_REPLACE_MATERIAL, 0, "REPLACE_MATERIAL", ReplaceMaterial, "Replace Material", "Swap one material with another")
DefNode(GeometryNode, GEO_NODE_RESAMPLE_CURVE, def_geo_curve_resample, "RESAMPLE_CURVE", ResampleCurve, "Resample Curve", "Generate a poly spline for each input spline")
@ -407,8 +406,8 @@ DefNode(GeometryNode, GEO_NODE_SCALE_ELEMENTS, def_geo_scale_elements, "SCALE_EL
DefNode(GeometryNode, GEO_NODE_SCALE_INSTANCES, 0, "SCALE_INSTANCES", ScaleInstances, "Scale Instances", "Scale geometry instances in local or global space")
DefNode(GeometryNode, GEO_NODE_SDF_VOLUME_SPHERE, 0, "SDF_VOLUME_SPHERE", SDFVolumeSphere, "SDF Volume Sphere", "Generate an SDF Volume Sphere")
DefNode(GeometryNode, GEO_NODE_SELF_OBJECT, 0, "SELF_OBJECT", SelfObject, "Self Object", "Retrieve the object that contains the geometry nodes modifier currently being executed")
DefNode(GeometryNode, GEO_NODE_SEPARATE_COMPONENTS, 0, "SEPARATE_COMPONENTS",SeparateComponents, "Separate Components","Split a geometry into a separate output for each type of data in the geometry")
DefNode(GeometryNode, GEO_NODE_SEPARATE_GEOMETRY, def_geo_separate_geometry,"SEPARATE_GEOMETRY", SeparateGeometry, "Separate Geometry", "Split a geometry into two geometry outputs based on a selection")
DefNode(GeometryNode, GEO_NODE_SEPARATE_COMPONENTS, 0, "SEPARATE_COMPONENTS",SeparateComponents, "Separate Components", "Split a geometry into a separate output for each type of data in the geometry")
DefNode(GeometryNode, GEO_NODE_SEPARATE_GEOMETRY, def_geo_separate_geometry, "SEPARATE_GEOMETRY", SeparateGeometry, "Separate Geometry", "Split a geometry into two geometry outputs based on a selection")
DefNode(GeometryNode, GEO_NODE_SET_CURVE_HANDLES, def_geo_curve_set_handle_positions, "SET_CURVE_HANDLES", SetCurveHandlePositions, "Set Handle Positions", "Set the positions for the handles of Bézier curves")
DefNode(GeometryNode, GEO_NODE_SET_CURVE_NORMAL, def_geo_set_curve_normal, "SET_CURVE_NORMAL", SetCurveNormal, "Set Curve Normal", "Set the evaluation mode for curve normals")
DefNode(GeometryNode, GEO_NODE_SET_CURVE_RADIUS, 0, "SET_CURVE_RADIUS", SetCurveRadius, "Set Curve Radius", "Set the radius of the curve at each control point")
@ -429,10 +428,10 @@ DefNode(GeometryNode, GEO_NODE_STRING_JOIN, 0, "STRING_JOIN", StringJoin, "Join
DefNode(GeometryNode, GEO_NODE_STRING_TO_CURVES, def_geo_string_to_curves, "STRING_TO_CURVES", StringToCurves, "String to Curves", "Generate a paragraph of text with a specific font, using a curve instance to store each character")
DefNode(GeometryNode, GEO_NODE_SUBDIVIDE_CURVE, 0, "SUBDIVIDE_CURVE", SubdivideCurve, "Subdivide Curve", "Dividing each curve segment into a specified number of pieces")
DefNode(GeometryNode, GEO_NODE_SUBDIVIDE_MESH, 0, "SUBDIVIDE_MESH", SubdivideMesh, "Subdivide Mesh", "Divide mesh faces into smaller ones without changing the shape or volume, using linear interpolation to place the new vertices")
DefNode(GeometryNode, GEO_NODE_SUBDIVISION_SURFACE, def_geo_subdivision_surface, "SUBDIVISION_SURFACE",SubdivisionSurface, "Subdivision Surface","Divide mesh faces to form a smooth surface, using the Catmull-Clark subdivision method")
DefNode(GeometryNode, GEO_NODE_SUBDIVISION_SURFACE, def_geo_subdivision_surface, "SUBDIVISION_SURFACE",SubdivisionSurface, "Subdivision Surface", "Divide mesh faces to form a smooth surface, using the Catmull-Clark subdivision method")
DefNode(GeometryNode, GEO_NODE_SWITCH, def_geo_switch, "SWITCH", Switch, "Switch", "Switch between two inputs")
DefNode(GeometryNode, GEO_NODE_TRANSFORM_GEOMETRY, 0, "TRANSFORM_GEOMETRY", Transform, "Transform Geometry", "Translate, rotate or scale the geometry")
DefNode(GeometryNode, GEO_NODE_TRANSLATE_INSTANCES, 0, "TRANSLATE_INSTANCES",TranslateInstances, "Translate Instances","Move top-level geometry instances in local or global space")
DefNode(GeometryNode, GEO_NODE_TRANSLATE_INSTANCES, 0, "TRANSLATE_INSTANCES",TranslateInstances, "Translate Instances", "Move top-level geometry instances in local or global space")
DefNode(GeometryNode, GEO_NODE_TRIANGULATE, def_geo_triangulate, "TRIANGULATE", Triangulate, "Triangulate", "Convert all faces in a mesh to triangular faces")
DefNode(GeometryNode, GEO_NODE_TRIM_CURVE, def_geo_curve_trim, "TRIM_CURVE", TrimCurve, "Trim Curve", "Shorten curves by removing portions at the start or end")
DefNode(GeometryNode, GEO_NODE_UV_PACK_ISLANDS, 0, "UV_PACK_ISLANDS", UVPackIslands, "Pack UV Islands", "Scale islands of a UV map and move them so they fill the UV space as much as possible")

View File

@ -548,7 +548,7 @@ static void duplicate_faces(GeometrySet &geometry_set,
}
new_mesh->tag_loose_verts_none();
new_mesh->loose_edges_tag_none();
new_mesh->tag_loose_edges_none();
copy_face_attributes_without_id(edge_mapping,
vert_mapping,

View File

@ -120,7 +120,6 @@ static void expand_mesh(Mesh &mesh,
/* Remove types that aren't supported for interpolation in this node. */
if (vert_expand != 0) {
CustomData_free_layers(&mesh.vdata, CD_ORCO, mesh.totvert);
CustomData_free_layers(&mesh.vdata, CD_BWEIGHT, mesh.totvert);
CustomData_free_layers(&mesh.vdata, CD_SHAPEKEY, mesh.totvert);
CustomData_free_layers(&mesh.vdata, CD_CLOTH_ORCO, mesh.totvert);
CustomData_free_layers(&mesh.vdata, CD_MVERT_SKIN, mesh.totvert);
@ -129,7 +128,6 @@ static void expand_mesh(Mesh &mesh,
CustomData_realloc(&mesh.vdata, old_verts_num, mesh.totvert);
}
if (edge_expand != 0) {
CustomData_free_layers(&mesh.edata, CD_BWEIGHT, mesh.totedge);
CustomData_free_layers(&mesh.edata, CD_FREESTYLE_EDGE, mesh.totedge);
const int old_edges_num = mesh.totedge;
mesh.totedge += edge_expand;
@ -339,7 +337,12 @@ static void extrude_mesh_vertices(Mesh &mesh,
mesh, attribute_outputs.side_id.get(), ATTR_DOMAIN_EDGE, new_edge_range);
}
const bool no_loose_vert_hint = mesh.runtime->loose_verts_cache.is_cached() &&
mesh.runtime->loose_verts_cache.data().count == 0;
BKE_mesh_runtime_clear_cache(&mesh);
if (no_loose_vert_hint) {
mesh.tag_loose_verts_none();
}
}
static void fill_quad_consistent_direction(const Span<int> other_poly_verts,
@ -401,6 +404,21 @@ static VectorSet<int> vert_indices_from_edges(const Mesh &mesh, const Span<T> ed
return vert_indices;
}
static void tag_mesh_added_faces(Mesh &mesh)
{
const bool no_loose_vert_hint = mesh.runtime->loose_verts_cache.is_cached() &&
mesh.runtime->loose_verts_cache.data().count == 0;
const bool no_loose_edge_hint = mesh.runtime->loose_edges_cache.is_cached() &&
mesh.runtime->loose_edges_cache.data().count == 0;
BKE_mesh_runtime_clear_cache(&mesh);
if (no_loose_vert_hint) {
mesh.tag_loose_verts_none();
}
if (no_loose_edge_hint) {
mesh.tag_loose_edges_none();
}
}
static void extrude_mesh_edges(Mesh &mesh,
const Field<bool> &selection_field,
const Field<float3> &offset_field,
@ -679,7 +697,7 @@ static void extrude_mesh_edges(Mesh &mesh,
mesh, attribute_outputs.side_id.get(), ATTR_DOMAIN_FACE, new_poly_range);
}
BKE_mesh_runtime_clear_cache(&mesh);
tag_mesh_added_faces(mesh);
}
/**
@ -1090,7 +1108,7 @@ static void extrude_mesh_face_regions(Mesh &mesh,
mesh, attribute_outputs.side_id.get(), ATTR_DOMAIN_FACE, side_poly_range);
}
BKE_mesh_runtime_clear_cache(&mesh);
tag_mesh_added_faces(mesh);
}
static void extrude_individual_mesh_faces(
@ -1374,7 +1392,7 @@ static void extrude_individual_mesh_faces(
mesh, attribute_outputs.side_id.get(), ATTR_DOMAIN_FACE, side_poly_range);
}
BKE_mesh_runtime_clear_cache(&mesh);
tag_mesh_added_faces(mesh);
}
static void node_geo_exec(GeoNodeExecParams params)

View File

@ -154,7 +154,7 @@ static Mesh *create_circle_mesh(const float radius,
std::iota(corner_verts.begin(), corner_verts.end(), 0);
std::iota(corner_edges.begin(), corner_edges.end(), 0);
mesh->loose_edges_tag_none();
mesh->tag_loose_edges_none();
}
else if (fill_type == GEO_NODE_MESH_CIRCLE_FILL_TRIANGLE_FAN) {
for (const int i : poly_offsets.index_range()) {

View File

@ -724,7 +724,7 @@ Mesh *create_cylinder_or_cone_mesh(const float radius_top,
calculate_selection_outputs(config, attribute_outputs, mesh->attributes_for_write());
mesh->tag_loose_verts_none();
mesh->loose_edges_tag_none();
mesh->tag_loose_edges_none();
mesh->bounds_set_eager(calculate_bounds_cylinder(config));
return mesh;

View File

@ -150,7 +150,7 @@ Mesh *create_grid_mesh(const int verts_x,
}
mesh->tag_loose_verts_none();
mesh->loose_edges_tag_none();
mesh->tag_loose_edges_none();
const float3 bounds = float3(size_x * 0.5f, size_y * 0.5f, 0.0f);
mesh->bounds_set_eager({-bounds, bounds});

View File

@ -331,7 +331,7 @@ static Mesh *create_uv_sphere_mesh(const float radius,
});
mesh->tag_loose_verts_none();
mesh->loose_edges_tag_none();
mesh->tag_loose_edges_none();
mesh->bounds_set_eager(calculate_bounds_uv_sphere(radius, segments, rings));
BLI_assert(BKE_mesh_is_valid(mesh));

View File

@ -80,7 +80,7 @@ static void geometry_set_points_to_vertices(
}
}
mesh->loose_edges_tag_none();
mesh->tag_loose_edges_none();
geometry_set.replace_mesh(mesh);
geometry_set.keep_only_during_modify({GEO_COMPONENT_TYPE_MESH});

View File

@ -15,29 +15,13 @@ static void node_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Geometry>("Geometry").propagate_all();
}
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
{
uiItemR(layout, ptr, "legacy_behavior", 0, nullptr, ICON_NONE);
}
static void node_geo_exec(GeoNodeExecParams params)
{
const bool legacy_behavior = params.node().custom1 & GEO_NODE_REALIZE_INSTANCES_LEGACY_BEHAVIOR;
if (legacy_behavior) {
params.error_message_add(
NodeWarningType::Info,
TIP_("This node uses legacy behavior with regards to attributes on "
"instances. The behavior can be changed in the node properties in "
"the side bar. In most cases the new behavior is the same for files created in "
"Blender 3.0"));
}
GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry");
GeometryComponentEditData::remember_deformed_curve_positions_if_necessary(geometry_set);
geometry::RealizeInstancesOptions options;
options.keep_original_ids = legacy_behavior;
options.realize_instance_attributes = !legacy_behavior;
options.keep_original_ids = false;
options.realize_instance_attributes = true;
options.propagation_info = params.get_output_propagation_info("Geometry");
geometry_set = geometry::realize_instances(geometry_set, options);
params.set_output("Geometry", std::move(geometry_set));
@ -53,7 +37,6 @@ void register_node_type_geo_realize_instances()
geo_node_type_base(&ntype, GEO_NODE_REALIZE_INSTANCES, "Realize Instances", NODE_CLASS_GEOMETRY);
ntype.declare = file_ns::node_declare;
ntype.draw_buttons_ex = file_ns::node_layout;
ntype.geometry_node_execute = file_ns::node_geo_exec;
nodeRegisterType(&ntype);
}

View File

@ -32,7 +32,6 @@ set(SRC
nodes/node_shader_bevel.cc
nodes/node_shader_blackbody.cc
nodes/node_shader_brightness.cc
nodes/node_shader_bsdf_anisotropic.cc
nodes/node_shader_bsdf_diffuse.cc
nodes/node_shader_bsdf_glass.cc
nodes/node_shader_bsdf_glossy.cc

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