Merge branch 'blender-v4.0-release'
This commit is contained in:
@@ -307,7 +307,7 @@ ccl_device
|
||||
bsdf->alpha_x = bsdf->alpha_y = sqr(roughness);
|
||||
bsdf->ior = (sd->flag & SD_BACKFACING) ? 1.0f / ior : ior;
|
||||
|
||||
fresnel->f0 = make_float3(F0_from_ior(ior));
|
||||
fresnel->f0 = make_float3(F0_from_ior(ior)) * specular_tint;
|
||||
fresnel->f90 = one_spectrum();
|
||||
fresnel->exponent = -ior;
|
||||
fresnel->reflection_tint = one_spectrum();
|
||||
|
||||
@@ -35,11 +35,15 @@ def connect_sockets(input, output):
|
||||
return
|
||||
|
||||
if output_node.type == 'GROUP_OUTPUT' and type(input) == bpy.types.NodeSocketVirtual:
|
||||
output_node.id_data.outputs.new(type(output).__name__, output.name)
|
||||
output_node.id_data.interface.new_socket(
|
||||
name=output.name, socket_type=type(output).__name__, in_out='OUTPUT'
|
||||
)
|
||||
input = output_node.inputs[-2]
|
||||
|
||||
if input_node.type == 'GROUP_INPUT' and type(output) == bpy.types.NodeSocketVirtual:
|
||||
output_node.id_data.inputs.new(type(input).__name__, input.name)
|
||||
input_node.id_data.interface.new_socket(
|
||||
name=input.name, socket_type=type(input).__name__, in_out='INPUT'
|
||||
)
|
||||
output = input_node.outputs[-2]
|
||||
|
||||
return input_node.id_data.links.new(input, output)
|
||||
|
||||
@@ -966,7 +966,6 @@ class SEQUENCER_MT_strip_retiming(Menu):
|
||||
layout.operator("sequencer.retiming_segment_speed_set")
|
||||
layout.operator("sequencer.retiming_show", icon="CHECKBOX_HLT")
|
||||
|
||||
|
||||
def draw(self, context):
|
||||
ed = context.scene.sequence_editor
|
||||
if ed.selected_retiming_keys:
|
||||
|
||||
@@ -1450,7 +1450,8 @@ static void mesh_normals_loop_custom_set(Span<float3> positions,
|
||||
int prev_corner = -1;
|
||||
const float *org_nor = nullptr;
|
||||
|
||||
for (const int lidx : fan_corners) {
|
||||
for (int i = fan_corners.index_range().last(); i >= 0; i--) {
|
||||
const int lidx = fan_corners[i];
|
||||
float *nor = r_custom_loop_normals[lidx];
|
||||
|
||||
if (!org_nor) {
|
||||
|
||||
@@ -1546,6 +1546,19 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 400, 29)) {
|
||||
/* Unhide all Reroute nodes. */
|
||||
FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
|
||||
LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
|
||||
if (node->is_reroute()) {
|
||||
static_cast<bNodeSocket *>(node->inputs.first)->flag &= ~SOCK_HIDDEN;
|
||||
static_cast<bNodeSocket *>(node->outputs.first)->flag &= ~SOCK_HIDDEN;
|
||||
}
|
||||
}
|
||||
}
|
||||
FOREACH_NODETREE_END;
|
||||
}
|
||||
|
||||
/**
|
||||
* Versioning code until next subversion bump goes here.
|
||||
*
|
||||
|
||||
@@ -43,8 +43,10 @@ bool ED_asset_mark_id(ID *id)
|
||||
|
||||
const IDTypeInfo *id_type_info = BKE_idtype_get_info_from_id(id);
|
||||
id->asset_data = BKE_asset_metadata_create();
|
||||
id->asset_data->local_type_info = id_type_info->asset_type_info;
|
||||
id->asset_data->local_type_info->on_mark_asset_fn(id, id->asset_data);
|
||||
if (AssetTypeInfo *type_info = id_type_info->asset_type_info) {
|
||||
id->asset_data->local_type_info = type_info;
|
||||
type_info->on_mark_asset_fn(id, id->asset_data);
|
||||
}
|
||||
|
||||
/* Important for asset storage to update properly! */
|
||||
ED_assetlist_storage_tag_main_data_dirty();
|
||||
|
||||
@@ -374,7 +374,7 @@ static bool node_update_basis_buttons(const bContext &C,
|
||||
loc.x = round(loc.x);
|
||||
loc.y = round(loc.y);
|
||||
|
||||
dy -= NODE_DYS / 2;
|
||||
dy -= NODE_DYS / 4;
|
||||
|
||||
uiLayout *layout = UI_block_layout(&block,
|
||||
UI_LAYOUT_VERTICAL,
|
||||
@@ -398,7 +398,7 @@ static bool node_update_basis_buttons(const bContext &C,
|
||||
int buty;
|
||||
UI_block_layout_resolve(&block, nullptr, &buty);
|
||||
|
||||
dy = buty - NODE_DYS / 2;
|
||||
dy = buty - NODE_DYS / 4;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -798,8 +798,8 @@ static void add_panel_items_recursive(const bContext &C,
|
||||
|
||||
/* Finalize the vertical extent of the content. */
|
||||
if (!is_parent_collapsed) {
|
||||
locy -= 2 * NODE_ITEM_SPACING_Y; /* Space at bottom of panel contents. */
|
||||
if (parent_runtime) {
|
||||
locy -= 2 * NODE_ITEM_SPACING_Y; /* Space at bottom of panel contents. */
|
||||
parent_runtime->min_content_y = round(locy);
|
||||
}
|
||||
locy -= NODE_ITEM_SPACING_Y / 2; /* Space at top of next panel header. */
|
||||
|
||||
@@ -1102,6 +1102,11 @@ bool node_has_hidden_sockets(bNode *node)
|
||||
|
||||
void node_set_hidden_sockets(bNode *node, int set)
|
||||
{
|
||||
/* The Reroute node is the socket itself, do not hide this. */
|
||||
if (node->is_reroute()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (set == 0) {
|
||||
LISTBASE_FOREACH (bNodeSocket *, sock, &node->inputs) {
|
||||
sock->flag &= ~SOCK_HIDDEN;
|
||||
|
||||
@@ -51,11 +51,10 @@ struct WeldLoop {
|
||||
int flag;
|
||||
struct {
|
||||
/* Indices relative to the original Mesh. */
|
||||
int vert;
|
||||
int edge;
|
||||
int vert;
|
||||
int loop_orig;
|
||||
/* Switches to this loop when iterating. Except when it is the first loop of the polygon. */
|
||||
int switch_to;
|
||||
int loop_next;
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -69,8 +68,11 @@ struct WeldPoly {
|
||||
int poly_orig;
|
||||
int loop_start;
|
||||
int loop_end;
|
||||
|
||||
/* To find groups. */
|
||||
int loop_ctx_start;
|
||||
int loop_ctx_len;
|
||||
#ifdef USE_WELD_DEBUG
|
||||
/* Final Polygon Size. */
|
||||
int loop_len;
|
||||
#endif
|
||||
};
|
||||
@@ -114,15 +116,17 @@ struct WeldMesh {
|
||||
|
||||
struct WeldLoopOfPolyIter {
|
||||
int loop_iter;
|
||||
int loop_orig_start;
|
||||
int loop_end;
|
||||
|
||||
/* Weld group. */
|
||||
int loop_ctx_start;
|
||||
int loop_ctx_len;
|
||||
int *group;
|
||||
|
||||
Span<WeldLoop> wloop;
|
||||
Span<int> corner_verts;
|
||||
Span<int> corner_edges;
|
||||
Span<int> loop_map;
|
||||
/* Weld group. */
|
||||
int *group;
|
||||
|
||||
/* Return */
|
||||
int group_len;
|
||||
@@ -261,9 +265,9 @@ static void weld_assert_poly_no_vert_repetition(const WeldPoly *wp,
|
||||
return;
|
||||
}
|
||||
else {
|
||||
while (weld_iter_loop_of_poly_next(iter)) {
|
||||
do {
|
||||
verts[i++] = iter.v;
|
||||
}
|
||||
} while (weld_iter_loop_of_poly_next(iter));
|
||||
}
|
||||
|
||||
BLI_assert(i == wp->loop_len);
|
||||
@@ -277,30 +281,6 @@ static void weld_assert_poly_no_vert_repetition(const WeldPoly *wp,
|
||||
}
|
||||
}
|
||||
|
||||
static void weld_assert_poly_len(const WeldPoly *wp,
|
||||
const Span<WeldLoop> wloop,
|
||||
Span<int> loop_map)
|
||||
{
|
||||
if (wp->flag == ELEM_COLLAPSED) {
|
||||
return;
|
||||
}
|
||||
|
||||
int len = 0;
|
||||
for (int l = wp->loop_start; l <= wp->loop_end; l++) {
|
||||
int loop_ctx = loop_map[l];
|
||||
if (loop_ctx == OUT_OF_CONTEXT) {
|
||||
len++;
|
||||
continue;
|
||||
}
|
||||
const WeldLoop *wl = &wloop[loop_ctx];
|
||||
BLI_assert(wp->loop_start <= wl->loop_orig);
|
||||
if (wl->flag != ELEM_COLLAPSED) {
|
||||
len++;
|
||||
}
|
||||
}
|
||||
BLI_assert(wp->loop_len >= len);
|
||||
}
|
||||
|
||||
#endif /* USE_WELD_DEBUG */
|
||||
|
||||
/** \} */
|
||||
@@ -507,6 +487,57 @@ static void weld_edge_find_doubles(Span<WeldEdge> weld_edges,
|
||||
/** \name Poly and Loop API
|
||||
* \{ */
|
||||
|
||||
static bool weld_iter_loop_of_poly_next(WeldLoopOfPolyIter &iter)
|
||||
{
|
||||
if (iter.loop_iter > iter.loop_end) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Span<WeldLoop> wloop = iter.wloop;
|
||||
Span<int> loop_map = iter.loop_map;
|
||||
int l = iter.loop_iter;
|
||||
int l_next = l + 1;
|
||||
|
||||
int loop_ctx = loop_map[l];
|
||||
if (loop_ctx != OUT_OF_CONTEXT) {
|
||||
const WeldLoop *wl = &wloop[loop_ctx];
|
||||
#ifdef USE_WELD_DEBUG
|
||||
BLI_assert(wl->flag != ELEM_COLLAPSED);
|
||||
BLI_assert(iter.v != wl->vert);
|
||||
#endif
|
||||
iter.v = wl->vert;
|
||||
iter.e = wl->edge;
|
||||
if (wl->loop_next > l) {
|
||||
/* Allow the loop to break. */
|
||||
l_next = wl->loop_next;
|
||||
}
|
||||
|
||||
if (iter.group) {
|
||||
iter.group_len = 0;
|
||||
int count = iter.loop_ctx_len;
|
||||
for (wl = &wloop[iter.loop_ctx_start]; count--; wl++) {
|
||||
if (wl->vert == iter.v) {
|
||||
iter.group[iter.group_len++] = wl->loop_orig;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
#ifdef USE_WELD_DEBUG
|
||||
BLI_assert(iter.v != iter.corner_verts[l]);
|
||||
#endif
|
||||
iter.v = iter.corner_verts[l];
|
||||
iter.e = iter.corner_edges[l];
|
||||
if (iter.group) {
|
||||
iter.group[0] = l;
|
||||
iter.group_len = 1;
|
||||
}
|
||||
}
|
||||
|
||||
iter.loop_iter = l_next;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool weld_iter_loop_of_poly_begin(WeldLoopOfPolyIter &iter,
|
||||
const WeldPoly &wp,
|
||||
Span<WeldLoop> wloop,
|
||||
@@ -520,92 +551,21 @@ static bool weld_iter_loop_of_poly_begin(WeldLoopOfPolyIter &iter,
|
||||
}
|
||||
|
||||
iter.loop_iter = wp.loop_start;
|
||||
iter.loop_orig_start = wp.loop_start;
|
||||
iter.loop_end = wp.loop_end;
|
||||
iter.loop_ctx_start = wp.loop_ctx_start;
|
||||
iter.loop_ctx_len = wp.loop_ctx_len;
|
||||
|
||||
iter.wloop = wloop;
|
||||
iter.corner_verts = corner_verts;
|
||||
iter.corner_edges = corner_edges;
|
||||
iter.loop_map = loop_map;
|
||||
iter.group = group_buffer;
|
||||
|
||||
int group_len = 0;
|
||||
if (group_buffer) {
|
||||
/* Include any final loops that are collapsed.
|
||||
* Would it be better to move this to `weld_iter_loop_of_poly_next`? */
|
||||
int loop_end_ctx;
|
||||
int loop_end = wp.loop_end;
|
||||
while (((loop_end_ctx = loop_map[loop_end]) != OUT_OF_CONTEXT) &&
|
||||
(wloop[loop_end_ctx].flag == ELEM_COLLAPSED))
|
||||
{
|
||||
loop_end--;
|
||||
group_len++;
|
||||
}
|
||||
int i = 0;
|
||||
while (loop_end < wp.loop_end) {
|
||||
iter.group[i++] = ++loop_end;
|
||||
}
|
||||
}
|
||||
iter.group_len = group_len;
|
||||
iter.group_len = 0;
|
||||
|
||||
#ifdef USE_WELD_DEBUG
|
||||
iter.v = OUT_OF_CONTEXT;
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool weld_iter_loop_of_poly_next(WeldLoopOfPolyIter &iter)
|
||||
{
|
||||
Span<WeldLoop> wloop = iter.wloop;
|
||||
Span<int> loop_map = iter.loop_map;
|
||||
int l = iter.loop_iter;
|
||||
if (l == iter.loop_orig_start) {
|
||||
/* `grupo_len` is already calculated in the first loop */
|
||||
}
|
||||
else {
|
||||
iter.group_len = 0;
|
||||
}
|
||||
|
||||
while (l <= iter.loop_end) {
|
||||
if (iter.group) {
|
||||
iter.group[iter.group_len++] = l;
|
||||
}
|
||||
|
||||
int loop_ctx = loop_map[l];
|
||||
if (loop_ctx != OUT_OF_CONTEXT) {
|
||||
const WeldLoop *wl = &wloop[loop_ctx];
|
||||
if (wl->flag == ELEM_COLLAPSED) {
|
||||
l++;
|
||||
continue;
|
||||
}
|
||||
else if (wl->switch_to != OUT_OF_CONTEXT) {
|
||||
if (iter.group) {
|
||||
iter.group[iter.group_len++] = wl->switch_to;
|
||||
}
|
||||
if (l != iter.loop_orig_start) {
|
||||
l = wl->switch_to;
|
||||
loop_ctx = loop_map[l];
|
||||
wl = &wloop[loop_ctx];
|
||||
}
|
||||
}
|
||||
#ifdef USE_WELD_DEBUG
|
||||
BLI_assert(iter.v != wl->vert);
|
||||
#endif
|
||||
iter.v = wl->vert;
|
||||
iter.e = wl->edge;
|
||||
}
|
||||
else {
|
||||
#ifdef USE_WELD_DEBUG
|
||||
BLI_assert(iter.v != iter.corner_verts[l]);
|
||||
#endif
|
||||
iter.v = iter.corner_verts[l];
|
||||
iter.e = iter.corner_edges[l];
|
||||
}
|
||||
iter.loop_iter = l + 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return weld_iter_loop_of_poly_next(iter);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -640,23 +600,45 @@ static void weld_poly_loop_ctx_alloc(const OffsetIndices<int> faces,
|
||||
const int loopstart = faces[i].start();
|
||||
const int totloop = faces[i].size();
|
||||
const int loop_end = loopstart + totloop - 1;
|
||||
int v_first = corner_verts[loopstart];
|
||||
int v_dest_first = vert_dest_map[v_first];
|
||||
bool is_vert_first_ctx = v_dest_first != OUT_OF_CONTEXT;
|
||||
|
||||
int v_next = v_first;
|
||||
int v_dest_next = v_dest_first;
|
||||
bool is_vert_next_ctx = is_vert_first_ctx;
|
||||
|
||||
int prev_wloop_len = wloop_len;
|
||||
for (const int loop_orig : faces[i]) {
|
||||
int v = corner_verts[loop_orig];
|
||||
int e = corner_edges[loop_orig];
|
||||
int v_dest = vert_dest_map[v];
|
||||
int e_dest = edge_dest_map[e];
|
||||
bool is_vert_ctx = v_dest != OUT_OF_CONTEXT;
|
||||
bool is_edge_ctx = e_dest != OUT_OF_CONTEXT;
|
||||
if (is_vert_ctx || is_edge_ctx) {
|
||||
wloop.increase_size_by_unchecked(1);
|
||||
int v = v_next;
|
||||
int v_dest = v_dest_next;
|
||||
bool is_vert_ctx = is_vert_next_ctx;
|
||||
|
||||
int loop_next;
|
||||
if (loop_orig != loop_end) {
|
||||
loop_next = loop_orig + 1;
|
||||
v_next = corner_verts[loop_next];
|
||||
v_dest_next = vert_dest_map[v_next];
|
||||
is_vert_next_ctx = v_dest_next != OUT_OF_CONTEXT;
|
||||
}
|
||||
else {
|
||||
loop_next = loopstart;
|
||||
v_next = v_first;
|
||||
v_dest_next = v_dest_first;
|
||||
is_vert_next_ctx = is_vert_first_ctx;
|
||||
}
|
||||
|
||||
if (is_vert_ctx || is_vert_next_ctx) {
|
||||
int e = corner_edges[loop_orig];
|
||||
int e_dest = edge_dest_map[e];
|
||||
bool is_edge_ctx = e_dest != OUT_OF_CONTEXT;
|
||||
|
||||
wloop.increase_size_by_unchecked(1);
|
||||
WeldLoop &wl = wloop.last();
|
||||
wl.vert = is_vert_ctx ? v_dest : v;
|
||||
wl.edge = is_edge_ctx ? e_dest : e;
|
||||
wl.loop_orig = loop_orig;
|
||||
wl.switch_to = OUT_OF_CONTEXT;
|
||||
wl.loop_next = loop_next;
|
||||
|
||||
loop_map[loop_orig] = wloop_len++;
|
||||
}
|
||||
@@ -664,26 +646,30 @@ static void weld_poly_loop_ctx_alloc(const OffsetIndices<int> faces,
|
||||
loop_map[loop_orig] = OUT_OF_CONTEXT;
|
||||
}
|
||||
}
|
||||
|
||||
if (wloop_len != prev_wloop_len) {
|
||||
int loop_ctx_len = wloop_len - prev_wloop_len;
|
||||
wpoly.increase_size_by_unchecked(1);
|
||||
|
||||
WeldPoly &wp = wpoly.last();
|
||||
int loops_len = wloop_len - prev_wloop_len;
|
||||
wp.poly_dst = OUT_OF_CONTEXT;
|
||||
wp.poly_orig = i;
|
||||
wp.loop_start = loopstart;
|
||||
wp.loop_end = loop_end;
|
||||
|
||||
wp.loop_ctx_start = prev_wloop_len;
|
||||
wp.loop_ctx_len = loop_ctx_len;
|
||||
|
||||
#ifdef USE_WELD_DEBUG
|
||||
wp.loop_len = totloop;
|
||||
#endif
|
||||
|
||||
face_map[i] = wpoly_len++;
|
||||
if (totloop > 5 && loops_len > 1) {
|
||||
if (totloop > 5 && loop_ctx_len > 1) {
|
||||
/* We could be smarter here and actually count how many new polygons will be created.
|
||||
* But counting this can be inefficient as it depends on the number of non-consecutive
|
||||
* self face merges. For now just estimate a maximum value. */
|
||||
int max_new = std::min((totloop / 3), loops_len) - 1;
|
||||
int max_new = std::min((totloop / 3), loop_ctx_len) - 1;
|
||||
maybe_new_poly += max_new;
|
||||
CLAMP_MIN(max_ctx_poly_len, totloop);
|
||||
}
|
||||
@@ -704,7 +690,6 @@ static void weld_poly_loop_ctx_alloc(const OffsetIndices<int> faces,
|
||||
}
|
||||
|
||||
static void weld_poly_split_recursive(int poly_loop_len,
|
||||
const int start_loop_from,
|
||||
Span<int> vert_dest_map,
|
||||
WeldPoly *r_wp,
|
||||
WeldMesh *r_weld_mesh,
|
||||
@@ -718,56 +703,56 @@ static void weld_poly_split_recursive(int poly_loop_len,
|
||||
Span<int> loop_map = r_weld_mesh->loop_map;
|
||||
MutableSpan<WeldLoop> wloop = r_weld_mesh->wloop;
|
||||
|
||||
int loop_end_ctx;
|
||||
int loop_end = r_wp->loop_end;
|
||||
while (((loop_end_ctx = loop_map[loop_end]) == OUT_OF_CONTEXT) ||
|
||||
(wloop[loop_end_ctx].flag == ELEM_COLLAPSED))
|
||||
{
|
||||
loop_end--;
|
||||
}
|
||||
|
||||
int loop_kill = 0;
|
||||
// WeldLoop *wla_prev = &wloop[loop_end_ctx]; /* UNUSED. */
|
||||
|
||||
int loop_ctx_a, loop_ctx_a_prev = loop_map[loop_end];
|
||||
for (int la = start_loop_from; la <= loop_end; loop_ctx_a_prev = loop_ctx_a, la++) {
|
||||
loop_ctx_a = loop_map[la];
|
||||
int loop_end = r_wp->loop_end;
|
||||
int loop_ctx_a = loop_map[loop_end];
|
||||
WeldLoop *wla_prev = (loop_ctx_a != OUT_OF_CONTEXT) ? &wloop[loop_ctx_a] : nullptr;
|
||||
int la = r_wp->loop_start;
|
||||
do {
|
||||
int loop_ctx_a = loop_map[la];
|
||||
if (loop_ctx_a == OUT_OF_CONTEXT) {
|
||||
la++;
|
||||
wla_prev = nullptr;
|
||||
continue;
|
||||
}
|
||||
|
||||
WeldLoop *wla = &wloop[loop_ctx_a];
|
||||
if (wla->flag == ELEM_COLLAPSED) {
|
||||
continue;
|
||||
}
|
||||
BLI_assert(wla->flag != ELEM_COLLAPSED);
|
||||
|
||||
int vert_a = wla->vert;
|
||||
if (vert_dest_map[vert_a] == OUT_OF_CONTEXT) {
|
||||
/* Only test vertices that will be merged. */
|
||||
// wla_prev = wla; /* UNUSED. */
|
||||
la = wla->loop_next;
|
||||
wla_prev = wla;
|
||||
continue;
|
||||
}
|
||||
wa_continue:
|
||||
// WeldLoop *wlb_prev = wla; /* UNUSED. */
|
||||
int killed_ab = 0;
|
||||
int loop_ctx_b, loop_ctx_b_prev = loop_ctx_a_prev;
|
||||
for (int lb = la + 1; lb <= loop_end; loop_ctx_b_prev = loop_ctx_b, lb++) {
|
||||
loop_ctx_b = loop_map[lb];
|
||||
|
||||
int dist_a = 1;
|
||||
int lb_prev = la;
|
||||
WeldLoop *wlb_prev = wla;
|
||||
int lb = wla->loop_next;
|
||||
do {
|
||||
int loop_ctx_b = loop_map[lb];
|
||||
if (loop_ctx_b == OUT_OF_CONTEXT) {
|
||||
dist_a++;
|
||||
lb_prev = lb;
|
||||
wlb_prev = nullptr;
|
||||
lb++;
|
||||
continue;
|
||||
}
|
||||
|
||||
WeldLoop *wlb = &wloop[loop_ctx_b];
|
||||
if (wlb->flag == ELEM_COLLAPSED) {
|
||||
killed_ab++;
|
||||
continue;
|
||||
}
|
||||
BLI_assert(wlb->flag != ELEM_COLLAPSED);
|
||||
int vert_b = wlb->vert;
|
||||
if (vert_a != vert_b) {
|
||||
// wlb_prev = wlb; /* UNUSED. */
|
||||
dist_a++;
|
||||
lb_prev = lb;
|
||||
wlb_prev = wlb;
|
||||
lb = wlb->loop_next;
|
||||
continue;
|
||||
}
|
||||
|
||||
int dist_a = wlb->loop_orig - wla->loop_orig - killed_ab;
|
||||
int dist_b = poly_loop_len - dist_a;
|
||||
|
||||
BLI_assert(dist_a != 0 && dist_b != 0);
|
||||
@@ -797,32 +782,31 @@ static void weld_poly_split_recursive(int poly_loop_len,
|
||||
return;
|
||||
}
|
||||
else {
|
||||
wla_prev->loop_next = lb;
|
||||
wlb_prev->loop_next = la;
|
||||
if (r_wp->loop_start == la) {
|
||||
r_wp->loop_start = lb;
|
||||
}
|
||||
|
||||
if (dist_a == 2) {
|
||||
WeldLoop *wlb_prev = &wloop[loop_ctx_b_prev];
|
||||
BLI_assert(wlb_prev->flag != ELEM_COLLAPSED);
|
||||
wla->flag = ELEM_COLLAPSED;
|
||||
wlb_prev->flag = ELEM_COLLAPSED;
|
||||
loop_kill += 2;
|
||||
dist_a = dist_b;
|
||||
}
|
||||
else if (dist_b == 2) {
|
||||
WeldLoop *wla_prev = &wloop[loop_ctx_a_prev];
|
||||
BLI_assert(wla_prev->flag != ELEM_COLLAPSED);
|
||||
wlb->flag = ELEM_COLLAPSED;
|
||||
wla_prev->flag = ELEM_COLLAPSED;
|
||||
loop_kill += 2;
|
||||
dist_b = dist_a;
|
||||
lb = la;
|
||||
|
||||
r_wp->loop_start = la;
|
||||
r_wp->loop_end = loop_end = lb_prev;
|
||||
|
||||
poly_loop_len = dist_a;
|
||||
break;
|
||||
}
|
||||
else {
|
||||
if (r_wp->loop_start == la) {
|
||||
r_wp->loop_start = lb;
|
||||
/* Specify a value for the `switch_to` in order to form groups and a more pretty merge.
|
||||
* But it's not really necessary for Weld to work. */
|
||||
wlb->switch_to = wla->switch_to != OUT_OF_CONTEXT ? wla->switch_to : la;
|
||||
}
|
||||
wla->switch_to = lb;
|
||||
|
||||
r_weld_mesh->wpoly.increase_size_by_unchecked(1);
|
||||
r_weld_mesh->wpoly_new_len++;
|
||||
|
||||
@@ -830,22 +814,36 @@ static void weld_poly_split_recursive(int poly_loop_len,
|
||||
new_test->poly_dst = OUT_OF_CONTEXT;
|
||||
new_test->poly_orig = r_wp->poly_orig;
|
||||
new_test->loop_start = la;
|
||||
new_test->loop_end = lb - 1;
|
||||
new_test->loop_end = lb_prev;
|
||||
new_test->loop_ctx_start = r_wp->loop_ctx_start;
|
||||
new_test->loop_ctx_len = r_wp->loop_ctx_len;
|
||||
|
||||
#ifdef USE_WELD_DEBUG
|
||||
new_test->loop_len = dist_a;
|
||||
#endif
|
||||
weld_poly_split_recursive(
|
||||
dist_a, la, vert_dest_map, new_test, r_weld_mesh, r_poly_kill, r_loop_kill);
|
||||
dist_a, vert_dest_map, new_test, r_weld_mesh, r_poly_kill, r_loop_kill);
|
||||
}
|
||||
|
||||
la = lb;
|
||||
wla = wlb;
|
||||
poly_loop_len = dist_b;
|
||||
goto wa_continue;
|
||||
|
||||
dist_a = 1;
|
||||
}
|
||||
|
||||
wlb_prev = wlb;
|
||||
lb_prev = lb;
|
||||
lb = wlb->loop_next;
|
||||
} while (lb_prev != loop_end);
|
||||
|
||||
wla_prev = wla;
|
||||
if (la == loop_end) {
|
||||
/* No need to start again. */
|
||||
break;
|
||||
}
|
||||
}
|
||||
la = wla->loop_next;
|
||||
} while (la != loop_end);
|
||||
|
||||
*r_loop_kill += loop_kill;
|
||||
#ifdef USE_WELD_DEBUG
|
||||
@@ -893,9 +891,13 @@ static void weld_poly_loop_ctx_setup_collapsed_and_split(const int remain_edge_c
|
||||
for (const int i : wpoly_original_range) {
|
||||
WeldPoly &wp = wpoly[i];
|
||||
int poly_loop_len = (wp.loop_end - wp.loop_start) + 1;
|
||||
for (int l = wp.loop_start; l <= wp.loop_end; l++) {
|
||||
WeldLoop *wl_prev = nullptr;
|
||||
bool chang_loop_start = false;
|
||||
int l = wp.loop_start;
|
||||
do {
|
||||
int loop_ctx = loop_map[l];
|
||||
if (loop_ctx == OUT_OF_CONTEXT) {
|
||||
wl_prev = nullptr;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -910,24 +912,59 @@ static void weld_poly_loop_ctx_setup_collapsed_and_split(const int remain_edge_c
|
||||
poly_loop_len = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (l == wp.loop_start) {
|
||||
chang_loop_start = true;
|
||||
}
|
||||
|
||||
loop_kill_len++;
|
||||
poly_loop_len--;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (chang_loop_start) {
|
||||
wp.loop_start = l;
|
||||
chang_loop_start = false;
|
||||
}
|
||||
if (wl_prev) {
|
||||
wl_prev->loop_next = l;
|
||||
}
|
||||
wl_prev = wl;
|
||||
BLI_assert(wl->loop_next == l + 1 || l == wp.loop_end);
|
||||
}
|
||||
} while (l++ != wp.loop_end);
|
||||
|
||||
if (poly_loop_len) {
|
||||
if (wl_prev) {
|
||||
wl_prev->loop_next = wp.loop_start;
|
||||
wp.loop_end = wl_prev->loop_orig;
|
||||
}
|
||||
|
||||
#ifdef USE_WELD_DEBUG
|
||||
wp.loop_len = poly_loop_len;
|
||||
weld_assert_poly_len(&wp, wloop, loop_map);
|
||||
|
||||
for (int loop_orig : IndexRange(wp.loop_start, poly_loop_len)) {
|
||||
int loop_ctx = loop_map[loop_orig];
|
||||
if (loop_ctx == OUT_OF_CONTEXT) {
|
||||
continue;
|
||||
}
|
||||
|
||||
WeldLoop *wl = &wloop[loop_ctx];
|
||||
if (wl->flag == ELEM_COLLAPSED) {
|
||||
continue;
|
||||
}
|
||||
|
||||
loop_ctx = loop_map[wl->loop_next];
|
||||
if (loop_ctx == OUT_OF_CONTEXT) {
|
||||
continue;
|
||||
}
|
||||
|
||||
wl = &wloop[loop_ctx];
|
||||
BLI_assert(wl->flag != ELEM_COLLAPSED);
|
||||
}
|
||||
#endif
|
||||
|
||||
weld_poly_split_recursive(poly_loop_len,
|
||||
wp.loop_start,
|
||||
vert_dest_map,
|
||||
&wp,
|
||||
r_weld_mesh,
|
||||
&face_kill_len,
|
||||
&loop_kill_len);
|
||||
weld_poly_split_recursive(
|
||||
poly_loop_len, vert_dest_map, &wp, r_weld_mesh, &face_kill_len, &loop_kill_len);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1141,9 +1178,9 @@ static void weld_poly_find_doubles(const Span<int> corner_verts,
|
||||
continue;
|
||||
}
|
||||
|
||||
while (weld_iter_loop_of_poly_next(iter)) {
|
||||
do {
|
||||
new_corner_edges.append(iter.e);
|
||||
}
|
||||
} while (weld_iter_loop_of_poly_next(iter));
|
||||
}
|
||||
|
||||
poly_offs_[face_len] = new_corner_edges.size();
|
||||
@@ -1571,11 +1608,8 @@ static Mesh *create_merged_mesh(const Mesh &mesh,
|
||||
const int poly_ctx = weld_mesh.face_map[i];
|
||||
if (poly_ctx == OUT_OF_CONTEXT) {
|
||||
int mp_loop_len = src_faces[i].size();
|
||||
CustomData_copy_data(&mesh.loop_data,
|
||||
&result->loop_data,
|
||||
src_faces[i].start(),
|
||||
loop_cur,
|
||||
src_faces[i].size());
|
||||
CustomData_copy_data(
|
||||
&mesh.loop_data, &result->loop_data, src_faces[i].start(), loop_cur, mp_loop_len);
|
||||
for (; mp_loop_len--; loop_cur++) {
|
||||
dst_corner_verts[loop_cur] = vert_final_map[dst_corner_verts[loop_cur]];
|
||||
dst_corner_edges[loop_cur] = edge_final_map[dst_corner_edges[loop_cur]];
|
||||
@@ -1598,13 +1632,13 @@ static Mesh *create_merged_mesh(const Mesh &mesh,
|
||||
if (wp.poly_dst != OUT_OF_CONTEXT) {
|
||||
continue;
|
||||
}
|
||||
while (weld_iter_loop_of_poly_next(iter)) {
|
||||
do {
|
||||
customdata_weld(
|
||||
&mesh.loop_data, &result->loop_data, group_buffer.data(), iter.group_len, loop_cur);
|
||||
dst_corner_verts[loop_cur] = vert_final_map[iter.v];
|
||||
dst_corner_edges[loop_cur] = edge_final_map[iter.e];
|
||||
loop_cur++;
|
||||
}
|
||||
} while (weld_iter_loop_of_poly_next(iter));
|
||||
}
|
||||
|
||||
CustomData_copy_data(&mesh.face_data, &result->face_data, i, r_i, 1);
|
||||
@@ -1631,13 +1665,13 @@ static Mesh *create_merged_mesh(const Mesh &mesh,
|
||||
if (wp.poly_dst != OUT_OF_CONTEXT) {
|
||||
continue;
|
||||
}
|
||||
while (weld_iter_loop_of_poly_next(iter)) {
|
||||
do {
|
||||
customdata_weld(
|
||||
&mesh.loop_data, &result->loop_data, group_buffer.data(), iter.group_len, loop_cur);
|
||||
dst_corner_verts[loop_cur] = vert_final_map[iter.v];
|
||||
dst_corner_edges[loop_cur] = edge_final_map[iter.e];
|
||||
loop_cur++;
|
||||
}
|
||||
} while (weld_iter_loop_of_poly_next(iter));
|
||||
|
||||
dst_face_offsets[r_i] = loop_start;
|
||||
r_i++;
|
||||
|
||||
@@ -2041,7 +2041,7 @@ void RNA_def_main_gpencil_legacy(BlenderRNA *brna, PropertyRNA *cprop)
|
||||
func, "do_ui_user", true, "", "Make sure interface does not reference this grease pencil");
|
||||
}
|
||||
|
||||
#ifdef WITH_GREASE_PENCIL_V3
|
||||
# ifdef WITH_GREASE_PENCIL_V3
|
||||
void RNA_def_main_grease_pencil(BlenderRNA *brna, PropertyRNA *cprop)
|
||||
{
|
||||
StructRNA *srna;
|
||||
@@ -2051,7 +2051,7 @@ void RNA_def_main_grease_pencil(BlenderRNA *brna, PropertyRNA *cprop)
|
||||
RNA_def_struct_sdna(srna, "Main");
|
||||
RNA_def_struct_ui_text(srna, "Main Grease Pencils", "Collection of grease pencils");
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
|
||||
void RNA_def_main_movieclips(BlenderRNA *brna, PropertyRNA *cprop)
|
||||
{
|
||||
|
||||
@@ -293,6 +293,15 @@ static void rna_NodeSocket_hide_set(PointerRNA *ptr, bool value)
|
||||
return;
|
||||
}
|
||||
|
||||
bNodeTree *ntree = reinterpret_cast<bNodeTree *>(ptr->owner_id);
|
||||
bNode *node;
|
||||
nodeFindNode(ntree, sock, &node, nullptr);
|
||||
|
||||
/* The Reroute node is the socket itself, do not hide this. */
|
||||
if (node->is_reroute()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (value) {
|
||||
sock->flag |= SOCK_HIDDEN;
|
||||
}
|
||||
|
||||
@@ -791,7 +791,7 @@ static void rna_uiLayout_template_node_operator_asset_menu_items(uiLayout *layou
|
||||
const char *catalog_path)
|
||||
{
|
||||
using namespace blender;
|
||||
ed::geometry::ui_template_node_operator_asset_menu_items(*layout, *C, StringRef(catalog_path));
|
||||
ed::geometry::ui_template_node_operator_asset_menu_items(*layout, *C, StringRef(catalog_path));
|
||||
}
|
||||
|
||||
static void rna_uiLayout_template_modifier_asset_menu_items(uiLayout *layout,
|
||||
@@ -799,12 +799,12 @@ static void rna_uiLayout_template_modifier_asset_menu_items(uiLayout *layout,
|
||||
const char *catalog_path)
|
||||
{
|
||||
using namespace blender;
|
||||
ed::object::ui_template_modifier_asset_menu_items(*layout, *C, StringRef(catalog_path));
|
||||
ed::object::ui_template_modifier_asset_menu_items(*layout, *C, StringRef(catalog_path));
|
||||
}
|
||||
|
||||
static void rna_uiLayout_template_node_operator_root_items(uiLayout *layout, bContext *C)
|
||||
{
|
||||
blender::ed::geometry::ui_template_node_operator_asset_root_items(*layout, *C);
|
||||
blender::ed::geometry::ui_template_node_operator_asset_root_items(*layout, *C);
|
||||
}
|
||||
|
||||
static int rna_ui_get_rnaptr_icon(bContext *C, PointerRNA *ptr_icon)
|
||||
|
||||
@@ -69,7 +69,6 @@ static void node_declare(NodeDeclarationBuilder &b)
|
||||
.default_value({1.0f, 0.2f, 0.1f})
|
||||
.min(0.0f)
|
||||
.max(100.0f)
|
||||
.compact()
|
||||
.description("Scattering radius to use for subsurface component (multiplied with Scale)");
|
||||
#define SOCK_SUBSURFACE_RADIUS_ID 8
|
||||
sss.add_input<decl::Float>("Subsurface Scale")
|
||||
|
||||
@@ -17,11 +17,7 @@ static void node_declare(NodeDeclarationBuilder &b)
|
||||
{
|
||||
b.add_input<decl::Color>("Color").default_value({0.8f, 0.8f, 0.8f, 1.0f});
|
||||
b.add_input<decl::Float>("Scale").default_value(1.0f).min(0.0f).max(1000.0f);
|
||||
b.add_input<decl::Vector>("Radius")
|
||||
.default_value({1.0f, 0.2f, 0.1f})
|
||||
.min(0.0f)
|
||||
.max(100.0f)
|
||||
.compact();
|
||||
b.add_input<decl::Vector>("Radius").default_value({1.0f, 0.2f, 0.1f}).min(0.0f).max(100.0f);
|
||||
b.add_input<decl::Float>("IOR").default_value(1.4f).min(1.01f).max(3.8f).subtype(PROP_FACTOR);
|
||||
b.add_input<decl::Float>("Anisotropy")
|
||||
.default_value(0.0f)
|
||||
|
||||
Reference in New Issue
Block a user