Merge branch 'master' into refactor-mesh-position-generic
This commit is contained in:
commit
695b48b128
|
@ -61,17 +61,17 @@ ContinuationIndentWidth: 4
|
|||
# This tries to match Blender's style as much as possible. One
|
||||
BreakBeforeBraces: Custom
|
||||
BraceWrapping: {
|
||||
AfterClass: 'false'
|
||||
AfterControlStatement: 'false'
|
||||
AfterEnum : 'false'
|
||||
AfterFunction : 'true'
|
||||
AfterNamespace : 'false'
|
||||
AfterStruct : 'false'
|
||||
AfterUnion : 'false'
|
||||
BeforeCatch : 'true'
|
||||
BeforeElse : 'true'
|
||||
IndentBraces : 'false'
|
||||
AfterObjCDeclaration: 'true'
|
||||
AfterClass: 'false',
|
||||
AfterControlStatement: 'false',
|
||||
AfterEnum : 'false',
|
||||
AfterFunction : 'true',
|
||||
AfterNamespace : 'false',
|
||||
AfterStruct : 'false',
|
||||
AfterUnion : 'false',
|
||||
BeforeCatch : 'true',
|
||||
BeforeElse : 'true',
|
||||
IndentBraces : 'false',
|
||||
AfterObjCDeclaration: 'true',
|
||||
}
|
||||
|
||||
# For switch statements, indent the cases.
|
||||
|
|
|
@ -5050,30 +5050,33 @@ def km_sculpt(params):
|
|||
# Expand
|
||||
("sculpt.expand", {"type": 'A', "value": 'PRESS', "shift": True},
|
||||
{"properties": [
|
||||
("target", "MASK"),
|
||||
("falloff_type", "GEODESIC"),
|
||||
("invert", True),
|
||||
("use_auto_mask", True),
|
||||
("use_mask_preserve" , True)]}),
|
||||
("target", "MASK"),
|
||||
("falloff_type", "GEODESIC"),
|
||||
("invert", True),
|
||||
("use_auto_mask", True),
|
||||
("use_mask_preserve", True),
|
||||
]}),
|
||||
("sculpt.expand", {"type": 'A', "value": 'PRESS', "shift": True, "alt": True},
|
||||
{"properties": [
|
||||
("target", "MASK"),
|
||||
("falloff_type", "NORMALS"),
|
||||
("invert", False),
|
||||
("use_mask_preserve" , True)]}),
|
||||
("target", "MASK"),
|
||||
("falloff_type", "NORMALS"),
|
||||
("invert", False),
|
||||
("use_mask_preserve", True),
|
||||
]}),
|
||||
("sculpt.expand", {"type": 'W', "value": 'PRESS', "shift": True},
|
||||
{"properties": [
|
||||
("target", "FACE_SETS"),
|
||||
("falloff_type", "GEODESIC"),
|
||||
("invert", False),
|
||||
("use_mask_preserve" , False),
|
||||
("use_modify_active", False)]}),
|
||||
("use_mask_preserve", False),
|
||||
("use_modify_active", False),
|
||||
]}),
|
||||
("sculpt.expand", {"type": 'W', "value": 'PRESS', "shift": True, "alt": True},
|
||||
{"properties": [
|
||||
("target", "FACE_SETS"),
|
||||
("falloff_type", "BOUNDARY_FACE_SET"),
|
||||
("invert", False),
|
||||
("use_mask_preserve" , False),
|
||||
("use_mask_preserve", False),
|
||||
("use_modify_active", True),
|
||||
]}),
|
||||
# Partial Visibility Show/hide
|
||||
|
|
|
@ -57,19 +57,19 @@ class MotionPathButtonsPanel:
|
|||
# Update Selected.
|
||||
col = layout.column(align=True)
|
||||
row = col.row(align=True)
|
||||
row.operator(f"{op_category}.paths_update", text="Update Path", icon=icon)
|
||||
row.operator(f"{op_category}.paths_clear", text="", icon='X').only_selected = True
|
||||
row.operator(op_category + ".paths_update", text="Update Path", icon=icon)
|
||||
row.operator(op_category + ".paths_clear", text="", icon='X').only_selected = True
|
||||
else:
|
||||
# Calculate.
|
||||
col = layout.column(align=True)
|
||||
col.label(text="Nothing to show yet...", icon='ERROR')
|
||||
col.operator(f"{op_category}.paths_calculate", text="Calculate...", icon=icon)
|
||||
col.operator(op_category + ".paths_calculate", text="Calculate...", icon=icon)
|
||||
|
||||
# Update All & Clear All.
|
||||
# Note that 'col' is from inside the preceeding `if` or `else` block.
|
||||
row = col.row(align=True)
|
||||
row.operator("object.paths_update_visible", text="Update All Paths", icon='WORLD')
|
||||
row.operator(f"{op_category}.paths_clear", text="", icon='X').only_selected = False
|
||||
row.operator(op_category + ".paths_clear", text="", icon='X').only_selected = False
|
||||
|
||||
|
||||
class MotionPathButtonsPanel_display:
|
||||
|
|
|
@ -723,8 +723,18 @@ class VIEW3D_HT_header(Header):
|
|||
|
||||
row = layout.row(align=True)
|
||||
domain = curves.selection_domain
|
||||
row.operator("curves.set_selection_domain", text="", icon='CURVE_BEZCIRCLE', depress=(domain == 'POINT')).domain = 'POINT'
|
||||
row.operator("curves.set_selection_domain", text="", icon='CURVE_PATH', depress=(domain == 'CURVE')).domain = 'CURVE'
|
||||
row.operator(
|
||||
"curves.set_selection_domain",
|
||||
text="",
|
||||
icon='CURVE_BEZCIRCLE',
|
||||
depress=(domain == 'POINT'),
|
||||
).domain = 'POINT'
|
||||
row.operator(
|
||||
"curves.set_selection_domain",
|
||||
text="",
|
||||
icon='CURVE_PATH',
|
||||
depress=(domain == 'CURVE'),
|
||||
).domain = 'CURVE'
|
||||
|
||||
# Grease Pencil
|
||||
if obj and obj.type == 'GPENCIL' and context.gpencil_data:
|
||||
|
|
|
@ -713,6 +713,11 @@ bNode *node_copy_with_mapping(bNodeTree *dst_tree,
|
|||
|
||||
bNode *node_copy(bNodeTree *dst_tree, const bNode &src_node, int flag, bool use_unique);
|
||||
|
||||
/**
|
||||
* Free the node itself.
|
||||
*
|
||||
* \note ID user reference-counting and changing the `nodes_by_id` vector are up to the caller.
|
||||
*/
|
||||
void node_free_node(bNodeTree *tree, bNode *node);
|
||||
|
||||
} // namespace blender::bke
|
||||
|
|
|
@ -655,6 +655,11 @@ inline bool bNodeLink::is_available() const
|
|||
return this->fromsock->is_available() && this->tosock->is_available();
|
||||
}
|
||||
|
||||
inline bool bNodeLink::is_used() const
|
||||
{
|
||||
return !this->is_muted() && this->is_available();
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
@ -673,6 +678,20 @@ inline int bNodeSocket::index_in_tree() const
|
|||
return this->runtime->index_in_all_sockets;
|
||||
}
|
||||
|
||||
inline int bNodeSocket::index_in_all_inputs() const
|
||||
{
|
||||
BLI_assert(blender::bke::node_tree_runtime::topology_cache_is_available(*this));
|
||||
BLI_assert(this->is_input());
|
||||
return this->runtime->index_in_inout_sockets;
|
||||
}
|
||||
|
||||
inline int bNodeSocket::index_in_all_outputs() const
|
||||
{
|
||||
BLI_assert(blender::bke::node_tree_runtime::topology_cache_is_available(*this));
|
||||
BLI_assert(this->is_output());
|
||||
return this->runtime->index_in_inout_sockets;
|
||||
}
|
||||
|
||||
inline bool bNodeSocket::is_hidden() const
|
||||
{
|
||||
return (this->flag & SOCK_HIDDEN) != 0;
|
||||
|
|
|
@ -452,6 +452,7 @@ set(SRC
|
|||
BKE_pbvh_pixels.hh
|
||||
BKE_pointcache.h
|
||||
BKE_pointcloud.h
|
||||
BKE_pose_backup.h
|
||||
BKE_preferences.h
|
||||
BKE_report.h
|
||||
BKE_rigidbody.h
|
||||
|
|
|
@ -108,7 +108,7 @@ static void action_copy_data(Main *UNUSED(bmain), ID *id_dst, const ID *id_src,
|
|||
/* Duplicate F-Curve. */
|
||||
|
||||
/* XXX TODO: pass subdata flag?
|
||||
* But surprisingly does not seem to be doing any ID refcounting... */
|
||||
* But surprisingly does not seem to be doing any ID reference-counting. */
|
||||
fcurve_dst = BKE_fcurve_copy(fcurve_src);
|
||||
|
||||
BLI_addtail(&action_dst->curves, fcurve_dst);
|
||||
|
|
|
@ -416,9 +416,9 @@ static void setup_app_data(bContext *C,
|
|||
* means that we do not reset their user count, however we do increase that one when doing
|
||||
* lib_link on local IDs using linked ones.
|
||||
* There is no real way to predict amount of changes here, so we have to fully redo
|
||||
* refcounting.
|
||||
* Now that we re-use (and do not liblink in readfile.c) most local datablocks as well, we have
|
||||
* to recompute refcount for all local IDs too. */
|
||||
* reference-counting.
|
||||
* Now that we re-use (and do not liblink in readfile.c) most local data-blocks as well,
|
||||
* we have to recompute reference-counts for all local IDs too. */
|
||||
BKE_main_id_refcount_recompute(bmain, false);
|
||||
}
|
||||
|
||||
|
|
|
@ -1463,9 +1463,9 @@ static bool cloth_build_springs(ClothModifierData *clmd, Mesh *mesh)
|
|||
Cloth *cloth = clmd->clothObject;
|
||||
ClothSpring *spring = nullptr, *tspring = nullptr, *tspring2 = nullptr;
|
||||
uint struct_springs = 0, shear_springs = 0, bend_springs = 0, struct_springs_real = 0;
|
||||
uint mvert_num = (uint)mesh->totvert;
|
||||
uint mvert_num = uint(mesh->totvert);
|
||||
uint numedges = uint(mesh->totedge);
|
||||
uint numpolys = (uint)mesh->totpoly;
|
||||
uint numpolys = uint(mesh->totpoly);
|
||||
float shrink_factor;
|
||||
const MEdge *medge = BKE_mesh_edges(mesh);
|
||||
const MPoly *mpoly = BKE_mesh_polys(mesh);
|
||||
|
@ -1650,7 +1650,7 @@ static bool cloth_build_springs(ClothModifierData *clmd, Mesh *mesh)
|
|||
for (int i = 0; i < mvert_num; i++) {
|
||||
if (cloth->verts[i].spring_count > 0) {
|
||||
cloth->verts[i].avg_spring_len = cloth->verts[i].avg_spring_len * 0.49f /
|
||||
(float(cloth->verts[i].spring_count));
|
||||
float(cloth->verts[i].spring_count);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1511,8 +1511,8 @@ Depsgraph *CTX_data_expect_evaluated_depsgraph(const bContext *C)
|
|||
{
|
||||
Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
|
||||
/* TODO(sergey): Assert that the dependency graph is fully evaluated.
|
||||
* Note that first the depsgraph and scene post-eval hooks needs to run extra round of updates
|
||||
* first to make check here really reliable. */
|
||||
* Note that first the depsgraph and scene post-evaluation hooks needs to run extra round of
|
||||
* updates first to make check here really reliable. */
|
||||
return depsgraph;
|
||||
}
|
||||
|
||||
|
|
|
@ -732,7 +732,7 @@ static void cp_key(const int start,
|
|||
|
||||
if (flagflo) {
|
||||
ktot += start * kd;
|
||||
a = (int)floor(ktot);
|
||||
a = int(floor(ktot));
|
||||
if (a) {
|
||||
ktot -= a;
|
||||
k1 += a * key->elemsize;
|
||||
|
@ -1078,7 +1078,7 @@ static void do_key(const int start,
|
|||
if (flagdo & 1) {
|
||||
if (flagflo & 1) {
|
||||
k1tot += start * k1d;
|
||||
a = (int)floor(k1tot);
|
||||
a = int(floor(k1tot));
|
||||
if (a) {
|
||||
k1tot -= a;
|
||||
k1 += a * key->elemsize;
|
||||
|
@ -1091,7 +1091,7 @@ static void do_key(const int start,
|
|||
if (flagdo & 2) {
|
||||
if (flagflo & 2) {
|
||||
k2tot += start * k2d;
|
||||
a = (int)floor(k2tot);
|
||||
a = int(floor(k2tot));
|
||||
if (a) {
|
||||
k2tot -= a;
|
||||
k2 += a * key->elemsize;
|
||||
|
@ -1104,7 +1104,7 @@ static void do_key(const int start,
|
|||
if (flagdo & 4) {
|
||||
if (flagflo & 4) {
|
||||
k3tot += start * k3d;
|
||||
a = (int)floor(k3tot);
|
||||
a = int(floor(k3tot));
|
||||
if (a) {
|
||||
k3tot -= a;
|
||||
k3 += a * key->elemsize;
|
||||
|
@ -1117,7 +1117,7 @@ static void do_key(const int start,
|
|||
if (flagdo & 8) {
|
||||
if (flagflo & 8) {
|
||||
k4tot += start * k4d;
|
||||
a = (int)floor(k4tot);
|
||||
a = int(floor(k4tot));
|
||||
if (a) {
|
||||
k4tot -= a;
|
||||
k4 += a * key->elemsize;
|
||||
|
@ -1660,7 +1660,7 @@ int BKE_keyblock_element_count(const Key *key)
|
|||
|
||||
size_t BKE_keyblock_element_calc_size_from_shape(const Key *key, const int shape_index)
|
||||
{
|
||||
return (size_t)BKE_keyblock_element_count_from_shape(key, shape_index) * key->elemsize;
|
||||
return size_t(BKE_keyblock_element_count_from_shape(key, shape_index)) * key->elemsize;
|
||||
}
|
||||
|
||||
size_t BKE_keyblock_element_calc_size(const Key *key)
|
||||
|
|
|
@ -1057,7 +1057,7 @@ static void layer_collection_objects_sync(ViewLayer *view_layer,
|
|||
}
|
||||
|
||||
/* Holdout and indirect only */
|
||||
if ((layer->flag & LAYER_COLLECTION_HOLDOUT)) {
|
||||
if (layer->flag & LAYER_COLLECTION_HOLDOUT) {
|
||||
base->flag_from_collection |= BASE_HOLDOUT;
|
||||
}
|
||||
if (layer->flag & LAYER_COLLECTION_INDIRECT_ONLY) {
|
||||
|
|
|
@ -322,8 +322,8 @@ void id_us_min(ID *id)
|
|||
|
||||
if (id->us <= limit) {
|
||||
if (!ID_TYPE_IS_DEPRECATED(GS(id->name))) {
|
||||
/* Do not assert on deprecated ID types, we cannot really ensure that their ID refcounting
|
||||
* is valid... */
|
||||
/* Do not assert on deprecated ID types, we cannot really ensure that their ID
|
||||
* reference-counting is valid. */
|
||||
CLOG_ERROR(&LOG,
|
||||
"ID user decrement error: %s (from '%s'): %d <= %d",
|
||||
id->name,
|
||||
|
|
|
@ -261,7 +261,7 @@ static bool library_foreach_ID_link(Main *bmain,
|
|||
* (the node tree), but re-use those generated for the 'owner' ID (the material). */
|
||||
if (inherit_data == NULL) {
|
||||
data.cb_flag = ID_IS_LINKED(id) ? IDWALK_CB_INDIRECT_USAGE : 0;
|
||||
/* When an ID is defined as not refcounting its ID usages, it should never do it. */
|
||||
/* When an ID is defined as not reference-counting its ID usages, it should never do it. */
|
||||
data.cb_flag_clear = (id->tag & LIB_TAG_NO_USER_REFCOUNT) ?
|
||||
IDWALK_CB_USER | IDWALK_CB_USER_ONE :
|
||||
0;
|
||||
|
|
|
@ -1045,7 +1045,7 @@ Mesh *BKE_mesh_new_from_object_to_bmain(Main *bmain,
|
|||
* everything is only allowed to reference original data-blocks.
|
||||
*
|
||||
* Note that user-count updates has to be done *after* mesh has been transferred to Main database
|
||||
* (since doing refcounting on non-Main IDs is forbidden). */
|
||||
* (since doing reference-counting on non-Main IDs is forbidden). */
|
||||
BKE_library_foreach_ID_link(
|
||||
nullptr, &mesh->id, foreach_libblock_make_original_callback, nullptr, IDWALK_NOP);
|
||||
|
||||
|
|
|
@ -924,7 +924,7 @@ static void loop_manifold_fan_around_vert_next(const Span<MLoop> loops,
|
|||
const uint vert_fan_next = loops[*r_mlfan_curr_index].v;
|
||||
const MPoly &mpfan_next = polys[*r_mpfan_curr_index];
|
||||
if ((vert_fan_orig == vert_fan_next && vert_fan_orig == mv_pivot_index) ||
|
||||
(vert_fan_orig != vert_fan_next && vert_fan_orig != mv_pivot_index)) {
|
||||
(!ELEM(vert_fan_orig, vert_fan_next, mv_pivot_index))) {
|
||||
/* We need the previous loop, but current one is our vertex's loop. */
|
||||
*r_mlfan_vert_index = *r_mlfan_curr_index;
|
||||
if (--(*r_mlfan_curr_index) < mpfan_next.loopstart) {
|
||||
|
|
|
@ -1589,7 +1589,7 @@ void BKE_mesh_remap_calc_loops_from_mesh(const int mode,
|
|||
}
|
||||
}
|
||||
|
||||
if ((size_t)mp_dst->totloop > islands_res_buff_size) {
|
||||
if (size_t(mp_dst->totloop) > islands_res_buff_size) {
|
||||
islands_res_buff_size = size_t(mp_dst->totloop) + MREMAP_DEFAULT_BUFSIZE;
|
||||
for (tindex = 0; tindex < num_trees; tindex++) {
|
||||
islands_res[tindex] = static_cast<IslandResult *>(
|
||||
|
@ -2254,7 +2254,7 @@ void BKE_mesh_remap_calc_polys_from_mesh(const int mode,
|
|||
*/
|
||||
RNG *rng = BLI_rng_new(0);
|
||||
|
||||
const size_t numpolys_src = (size_t)me_src->totpoly;
|
||||
const size_t numpolys_src = size_t(me_src->totpoly);
|
||||
|
||||
/* Here it's simpler to just allocate for all polys :/ */
|
||||
int *indices = static_cast<int *>(MEM_mallocN(sizeof(*indices) * numpolys_src, __func__));
|
||||
|
|
|
@ -2952,11 +2952,6 @@ void nodeRebuildIDVector(bNodeTree *node_tree)
|
|||
|
||||
namespace blender::bke {
|
||||
|
||||
/**
|
||||
* Free the node itself.
|
||||
*
|
||||
* \note: ID user refcounting and changing the `nodes_by_id` vector are up to the caller.
|
||||
*/
|
||||
void node_free_node(bNodeTree *ntree, bNode *node)
|
||||
{
|
||||
/* since it is called while free database, node->id is undefined */
|
||||
|
@ -3031,7 +3026,7 @@ void ntreeFreeLocalNode(bNodeTree *ntree, bNode *node)
|
|||
void nodeRemoveNode(Main *bmain, bNodeTree *ntree, bNode *node, bool do_id_user)
|
||||
{
|
||||
/* This function is not for localized node trees, we do not want
|
||||
* do to ID user refcounting and removal of animdation data then. */
|
||||
* do to ID user reference-counting and removal of animdation data then. */
|
||||
BLI_assert((ntree->id.tag & LIB_TAG_LOCALIZED) == 0);
|
||||
|
||||
bool node_has_id = false;
|
||||
|
|
|
@ -36,7 +36,7 @@ MeshUVVert *MeshPrimitive::get_other_uv_vertex(const MeshVertex *v1, const MeshV
|
|||
BLI_assert(vertices[0].vertex == v1 || vertices[1].vertex == v1 || vertices[2].vertex == v1);
|
||||
BLI_assert(vertices[0].vertex == v2 || vertices[1].vertex == v2 || vertices[2].vertex == v2);
|
||||
for (MeshUVVert &uv_vertex : vertices) {
|
||||
if (uv_vertex.vertex != v1 && uv_vertex.vertex != v2) {
|
||||
if (!ELEM(uv_vertex.vertex, v1, v2)) {
|
||||
return &uv_vertex;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3789,7 +3789,7 @@ void blo_do_versions_300(FileData *fd, Library * /*lib*/, Main *bmain)
|
|||
LISTBASE_FOREACH (MovieClip *, clip, &bmain->movieclips) {
|
||||
MovieTracking *tracking = &clip->tracking;
|
||||
|
||||
const float frame_center_x = (float(clip->lastsize[0])) / 2;
|
||||
const float frame_center_x = float(clip->lastsize[0]) / 2;
|
||||
const float frame_center_y = float(clip->lastsize[1]) / 2;
|
||||
|
||||
tracking->camera.principal_point[0] = (tracking->camera.principal_legacy[0] -
|
||||
|
@ -3828,8 +3828,8 @@ void blo_do_versions_300(FileData *fd, Library * /*lib*/, Main *bmain)
|
|||
LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
|
||||
if (sl->spacetype == SPACE_VIEW3D) {
|
||||
View3D *v3d = (View3D *)sl;
|
||||
v3d->overlay.flag |= (int)(V3D_OVERLAY_SCULPT_SHOW_MASK |
|
||||
V3D_OVERLAY_SCULPT_SHOW_FACE_SETS);
|
||||
v3d->overlay.flag |= int(V3D_OVERLAY_SCULPT_SHOW_MASK |
|
||||
V3D_OVERLAY_SCULPT_SHOW_FACE_SETS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -919,7 +919,7 @@ static void bm_mesh_loops_calc_normals_for_vert_with_clnors(BMesh *bm,
|
|||
BLI_linklist_prepend_alloca(&loops_of_vert, l_curr);
|
||||
loops_of_vert_count += 1;
|
||||
|
||||
const uint index_test = (uint)BM_elem_index_get(l_curr);
|
||||
const uint index_test = uint(BM_elem_index_get(l_curr));
|
||||
if (index_best > index_test) {
|
||||
index_best = index_test;
|
||||
link_best = loops_of_vert;
|
||||
|
|
|
@ -92,10 +92,10 @@ static void OVERLAY_engine_init(void *vedata)
|
|||
}
|
||||
|
||||
if (ts->sculpt) {
|
||||
if (!(v3d->overlay.flag & (int)V3D_OVERLAY_SCULPT_SHOW_FACE_SETS)) {
|
||||
if (!(v3d->overlay.flag & int(V3D_OVERLAY_SCULPT_SHOW_FACE_SETS))) {
|
||||
pd->overlay.sculpt_mode_face_sets_opacity = 0.0f;
|
||||
}
|
||||
if (!(v3d->overlay.flag & (int)V3D_OVERLAY_SCULPT_SHOW_MASK)) {
|
||||
if (!(v3d->overlay.flag & int(V3D_OVERLAY_SCULPT_SHOW_MASK))) {
|
||||
pd->overlay.sculpt_mode_mask_opacity = 0.0f;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -276,7 +276,7 @@ BLI_INLINE int32_t pack_rotation_aspect_hardness(float rot, float asp, float har
|
|||
int32_t packed = 0;
|
||||
/* Aspect uses 9 bits */
|
||||
float asp_normalized = (asp > 1.0f) ? (1.0f / asp) : asp;
|
||||
packed |= (int32_t)unit_float_to_uchar_clamp(asp_normalized);
|
||||
packed |= int32_t(unit_float_to_uchar_clamp(asp_normalized));
|
||||
/* Store if inversed in the 9th bit. */
|
||||
if (asp > 1.0f) {
|
||||
packed |= 1 << 8;
|
||||
|
@ -284,13 +284,13 @@ BLI_INLINE int32_t pack_rotation_aspect_hardness(float rot, float asp, float har
|
|||
/* Rotation uses 9 bits */
|
||||
/* Rotation are in [-90°..90°] range, so we can encode the sign of the angle + the cosine
|
||||
* because the cosine will always be positive. */
|
||||
packed |= (int32_t)unit_float_to_uchar_clamp(cosf(rot)) << 9;
|
||||
packed |= int32_t(unit_float_to_uchar_clamp(cosf(rot))) << 9;
|
||||
/* Store sine sign in 9th bit. */
|
||||
if (rot < 0.0f) {
|
||||
packed |= 1 << 17;
|
||||
}
|
||||
/* Hardness uses 8 bits */
|
||||
packed |= (int32_t)unit_float_to_uchar_clamp(hard) << 18;
|
||||
packed |= int32_t(unit_float_to_uchar_clamp(hard)) << 18;
|
||||
return packed;
|
||||
}
|
||||
|
||||
|
@ -315,7 +315,7 @@ static void gpencil_buffer_add_point(GPUIndexBufBuilder *ibo,
|
|||
/* Encode fill opacity defined by opacity modifier in vertex color alpha. If
|
||||
* no opacity modifier, the value will be always 1.0f. The opacity factor can be any
|
||||
* value between 0.0f and 2.0f */
|
||||
col->fcol[3] = ((int)(col->fcol[3] * 10000.0f) * 10.0f) + gps->fill_opacity_fac;
|
||||
col->fcol[3] = (int(col->fcol[3] * 10000.0f) * 10.0f) + gps->fill_opacity_fac;
|
||||
|
||||
vert->strength = (round_cap0) ? pt->strength : -pt->strength;
|
||||
vert->u_stroke = pt->uv_fac;
|
||||
|
@ -579,7 +579,7 @@ bGPDstroke *DRW_cache_gpencil_sbuffer_stroke_data_get(Object *ob)
|
|||
gps->runtime.stroke_start = 0;
|
||||
copy_v4_v4(gps->vert_color_fill, gpd->runtime.vert_color_fill);
|
||||
/* Caps. */
|
||||
gps->caps[0] = gps->caps[1] = (short)brush->gpencil_settings->caps_type;
|
||||
gps->caps[0] = gps->caps[1] = short(brush->gpencil_settings->caps_type);
|
||||
|
||||
gpd->runtime.sbuffer_gps = gps;
|
||||
}
|
||||
|
|
|
@ -66,13 +66,14 @@ typedef struct PoseBlendData {
|
|||
/* For temp-loading the Action from the pose library. */
|
||||
AssetTempIDConsumer *temp_id_consumer;
|
||||
|
||||
/* Blend factor, interval [0, 1] for interpolating between current and given pose. */
|
||||
/* Blend factor, interval [-1, 1] for interpolating between current and given pose.
|
||||
* Positive factors will blend in `act`, whereas negative factors will blend in `act_flipped`. */
|
||||
float blend_factor;
|
||||
struct PoseBackup *pose_backup;
|
||||
|
||||
Object *ob; /* Object to work on. */
|
||||
bAction *act; /* Pose to blend into the current pose. */
|
||||
bool free_action;
|
||||
Object *ob; /* Object to work on. */
|
||||
bAction *act; /* Pose to blend into the current pose. */
|
||||
bAction *act_flipped; /* Flipped copy of `act`. */
|
||||
|
||||
Scene *scene; /* For auto-keying. */
|
||||
ScrArea *area; /* For drawing status text. */
|
||||
|
@ -83,12 +84,19 @@ typedef struct PoseBlendData {
|
|||
char headerstr[UI_MAX_DRAW_STR];
|
||||
} PoseBlendData;
|
||||
|
||||
static void poselib_blend_flip_pose(bContext *C, wmOperator *op);
|
||||
/** Return the bAction that should be blended.
|
||||
* This is either pbd->act or pbd->act_flipped, depending on the sign of the blend factor.
|
||||
*/
|
||||
static bAction *poselib_action_to_blend(PoseBlendData *pbd)
|
||||
{
|
||||
return (pbd->blend_factor >= 0) ? pbd->act : pbd->act_flipped;
|
||||
}
|
||||
|
||||
/* Makes a copy of the current pose for restoration purposes - doesn't do constraints currently */
|
||||
static void poselib_backup_posecopy(PoseBlendData *pbd)
|
||||
{
|
||||
pbd->pose_backup = BKE_pose_backup_create_selected_bones(pbd->ob, pbd->act);
|
||||
const bAction *action = poselib_action_to_blend(pbd);
|
||||
pbd->pose_backup = BKE_pose_backup_create_selected_bones(pbd->ob, action);
|
||||
|
||||
if (pbd->state == POSE_BLEND_INIT) {
|
||||
/* Ready for blending now. */
|
||||
|
@ -168,19 +176,32 @@ static void poselib_blend_apply(bContext *C, wmOperator *op)
|
|||
/* Perform the actual blending. */
|
||||
struct Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
|
||||
AnimationEvalContext anim_eval_context = BKE_animsys_eval_context_construct(depsgraph, 0.0f);
|
||||
BKE_pose_apply_action_blend(pbd->ob, pbd->act, &anim_eval_context, pbd->blend_factor);
|
||||
bAction *to_blend = poselib_action_to_blend(pbd);
|
||||
BKE_pose_apply_action_blend(pbd->ob, to_blend, &anim_eval_context, fabs(pbd->blend_factor));
|
||||
}
|
||||
|
||||
/* ---------------------------- */
|
||||
|
||||
static void poselib_blend_set_factor(PoseBlendData *pbd, const float new_factor)
|
||||
{
|
||||
pbd->blend_factor = CLAMPIS(new_factor, 0.0f, 1.0f);
|
||||
const bool sign_changed = signf(new_factor) != signf(pbd->blend_factor);
|
||||
if (sign_changed) {
|
||||
/* The zero point was crossed, meaning that the pose will be flipped. This means the pose
|
||||
* backup has to change, as it only contains the bones for one side. */
|
||||
BKE_pose_backup_restore(pbd->pose_backup);
|
||||
BKE_pose_backup_free(pbd->pose_backup);
|
||||
}
|
||||
|
||||
pbd->blend_factor = CLAMPIS(new_factor, -1.0f, 1.0f);
|
||||
pbd->needs_redraw = true;
|
||||
|
||||
if (sign_changed) {
|
||||
poselib_backup_posecopy(pbd);
|
||||
}
|
||||
}
|
||||
|
||||
/* Return operator return value. */
|
||||
static int poselib_blend_handle_event(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
static int poselib_blend_handle_event(bContext *UNUSED(C), wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
PoseBlendData *pbd = op->customdata;
|
||||
|
||||
|
@ -226,10 +247,6 @@ static int poselib_blend_handle_event(bContext *C, wmOperator *op, const wmEvent
|
|||
pbd->state = pbd->state == POSE_BLEND_BLENDING ? POSE_BLEND_ORIGINAL : POSE_BLEND_BLENDING;
|
||||
pbd->needs_redraw = true;
|
||||
break;
|
||||
|
||||
case EVT_FKEY:
|
||||
poselib_blend_flip_pose(C, op);
|
||||
break;
|
||||
}
|
||||
|
||||
return OPERATOR_RUNNING_MODAL;
|
||||
|
@ -280,30 +297,6 @@ static bAction *flip_pose(bContext *C, Object *ob, bAction *action)
|
|||
return action_copy;
|
||||
}
|
||||
|
||||
/* Flip the target pose the interactive blend operator is currently using. */
|
||||
static void poselib_blend_flip_pose(bContext *C, wmOperator *op)
|
||||
{
|
||||
PoseBlendData *pbd = op->customdata;
|
||||
bAction *old_action = pbd->act;
|
||||
bAction *new_action = flip_pose(C, pbd->ob, old_action);
|
||||
|
||||
/* Before flipping over to the other side, this side needs to be restored. */
|
||||
BKE_pose_backup_restore(pbd->pose_backup);
|
||||
BKE_pose_backup_free(pbd->pose_backup);
|
||||
pbd->pose_backup = NULL;
|
||||
|
||||
if (pbd->free_action) {
|
||||
BKE_id_free(NULL, old_action);
|
||||
}
|
||||
|
||||
pbd->free_action = true;
|
||||
pbd->act = new_action;
|
||||
pbd->needs_redraw = true;
|
||||
|
||||
/* Refresh the pose backup to use the flipped bones. */
|
||||
poselib_backup_posecopy(pbd);
|
||||
}
|
||||
|
||||
/* Return true on success, false if the context isn't suitable. */
|
||||
static bool poselib_blend_init_data(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
|
@ -320,18 +313,21 @@ static bool poselib_blend_init_data(bContext *C, wmOperator *op, const wmEvent *
|
|||
PoseBlendData *pbd;
|
||||
op->customdata = pbd = MEM_callocN(sizeof(PoseBlendData), "PoseLib Preview Data");
|
||||
|
||||
bAction *action = poselib_blend_init_get_action(C, op);
|
||||
if (action == NULL) {
|
||||
pbd->act = poselib_blend_init_get_action(C, op);
|
||||
if (pbd->act == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Maybe flip the Action. */
|
||||
/* Passing `flipped=True` is the same as flipping the sign of the blend factor. */
|
||||
const bool apply_flipped = RNA_boolean_get(op->ptr, "flipped");
|
||||
if (apply_flipped) {
|
||||
action = flip_pose(C, ob, action);
|
||||
pbd->free_action = true;
|
||||
const float multiply_factor = apply_flipped ? -1.0f : 1.0f;
|
||||
pbd->blend_factor = multiply_factor * RNA_float_get(op->ptr, "blend_factor");
|
||||
|
||||
/* Only construct the flipped pose if there is a chance it's actually needed. */
|
||||
const bool is_interactive = (event != NULL);
|
||||
if (is_interactive || pbd->blend_factor < 0) {
|
||||
pbd->act_flipped = flip_pose(C, ob, pbd->act);
|
||||
}
|
||||
pbd->act = action;
|
||||
|
||||
/* Get the basic data. */
|
||||
pbd->ob = ob;
|
||||
|
@ -342,12 +338,12 @@ static bool poselib_blend_init_data(bContext *C, wmOperator *op, const wmEvent *
|
|||
|
||||
pbd->state = POSE_BLEND_INIT;
|
||||
pbd->needs_redraw = true;
|
||||
pbd->blend_factor = RNA_float_get(op->ptr, "blend_factor");
|
||||
|
||||
/* Just to avoid a clang-analyzer warning (false positive), it's set properly below. */
|
||||
pbd->release_confirm_info.use_release_confirm = false;
|
||||
|
||||
/* Release confirm data. Only available if there's an event to work with. */
|
||||
if (event != NULL) {
|
||||
if (is_interactive) {
|
||||
PropertyRNA *release_confirm_prop = RNA_struct_find_property(op->ptr, "release_confirm");
|
||||
pbd->release_confirm_info.use_release_confirm = (release_confirm_prop != NULL) &&
|
||||
RNA_property_boolean_get(op->ptr,
|
||||
|
@ -356,10 +352,11 @@ static bool poselib_blend_init_data(bContext *C, wmOperator *op, const wmEvent *
|
|||
ED_slider_init(pbd->slider, event);
|
||||
ED_slider_factor_set(pbd->slider, pbd->blend_factor);
|
||||
ED_slider_allow_overshoot_set(pbd->slider, false);
|
||||
ED_slider_is_bidirectional_set(pbd->slider, true);
|
||||
}
|
||||
|
||||
if (pbd->release_confirm_info.use_release_confirm) {
|
||||
BLI_assert(event != NULL);
|
||||
BLI_assert(is_interactive);
|
||||
pbd->release_confirm_info.init_event_type = WM_userdef_event_type_from_keymap_type(
|
||||
event->type);
|
||||
}
|
||||
|
@ -397,7 +394,8 @@ static void poselib_blend_cleanup(bContext *C, wmOperator *op)
|
|||
poselib_keytag_pose(C, scene, pbd);
|
||||
|
||||
/* Ensure the redo panel has the actually-used value, instead of the initial value. */
|
||||
RNA_float_set(op->ptr, "blend_factor", pbd->blend_factor);
|
||||
RNA_float_set(op->ptr, "blend_factor", fabs(pbd->blend_factor));
|
||||
RNA_boolean_set(op->ptr, "flipped", pbd->blend_factor < 0);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -426,10 +424,8 @@ static void poselib_blend_free(wmOperator *op)
|
|||
return;
|
||||
}
|
||||
|
||||
if (pbd->free_action) {
|
||||
/* Run before #poselib_tempload_exit to avoid any problems from indirectly
|
||||
* referenced ID pointers. */
|
||||
BKE_id_free(NULL, pbd->act);
|
||||
if (pbd->act_flipped) {
|
||||
BKE_id_free(NULL, pbd->act_flipped);
|
||||
}
|
||||
poselib_tempload_exit(pbd);
|
||||
|
||||
|
@ -489,11 +485,7 @@ static int poselib_blend_modal(bContext *C, wmOperator *op, const wmEvent *event
|
|||
strcpy(tab_string, TIP_("[Tab] - Show blended pose"));
|
||||
}
|
||||
|
||||
BLI_snprintf(status_string,
|
||||
sizeof(status_string),
|
||||
"[F] - Flip pose | %s | %s",
|
||||
tab_string,
|
||||
slider_string);
|
||||
BLI_snprintf(status_string, sizeof(status_string), "%s | %s", tab_string, slider_string);
|
||||
ED_workspace_status_text(C, status_string);
|
||||
|
||||
poselib_blend_apply(C, op);
|
||||
|
@ -558,6 +550,8 @@ static bool poselib_blend_poll(bContext *C)
|
|||
|
||||
void POSELIB_OT_apply_pose_asset(wmOperatorType *ot)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
|
||||
/* Identifiers: */
|
||||
ot->name = "Apply Pose Asset";
|
||||
ot->idname = "POSELIB_OT_apply_pose_asset";
|
||||
|
@ -574,17 +568,21 @@ void POSELIB_OT_apply_pose_asset(wmOperatorType *ot)
|
|||
RNA_def_float_factor(ot->srna,
|
||||
"blend_factor",
|
||||
1.0f,
|
||||
0.0f,
|
||||
-1.0f,
|
||||
1.0f,
|
||||
"Blend Factor",
|
||||
"Amount that the pose is applied on top of the existing poses",
|
||||
0.0f,
|
||||
"Amount that the pose is applied on top of the existing poses. A negative "
|
||||
"value will apply the pose flipped over the X-axis",
|
||||
-1.0f,
|
||||
1.0f);
|
||||
RNA_def_boolean(ot->srna,
|
||||
"flipped",
|
||||
false,
|
||||
"Apply Flipped",
|
||||
"When enabled, applies the pose flipped over the X-axis");
|
||||
prop = RNA_def_boolean(
|
||||
ot->srna,
|
||||
"flipped",
|
||||
false,
|
||||
"Apply Flipped",
|
||||
"When enabled, applies the pose flipped over the X-axis. This is the same as "
|
||||
"passing a negative `blend_factor`");
|
||||
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
|
||||
}
|
||||
|
||||
void POSELIB_OT_blend_pose_asset(wmOperatorType *ot)
|
||||
|
@ -610,22 +608,26 @@ void POSELIB_OT_blend_pose_asset(wmOperatorType *ot)
|
|||
prop = RNA_def_float_factor(ot->srna,
|
||||
"blend_factor",
|
||||
0.0f,
|
||||
0.0f,
|
||||
-1.0f,
|
||||
1.0f,
|
||||
"Blend Factor",
|
||||
"Amount that the pose is applied on top of the existing poses",
|
||||
0.0f,
|
||||
"Amount that the pose is applied on top of the existing poses. A "
|
||||
"negative value will apply the pose flipped over the X-axis",
|
||||
-1.0f,
|
||||
1.0f);
|
||||
/* Blending should always start at 0%, and not at whatever percentage was last used. This RNA
|
||||
* property just exists for symmetry with the Apply operator (and thus simplicity of the rest of
|
||||
* the code, which can assume this property exists). */
|
||||
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
|
||||
|
||||
RNA_def_boolean(ot->srna,
|
||||
"flipped",
|
||||
false,
|
||||
"Apply Flipped",
|
||||
"When enabled, applies the pose flipped over the X-axis");
|
||||
prop = RNA_def_boolean(ot->srna,
|
||||
"flipped",
|
||||
false,
|
||||
"Apply Flipped",
|
||||
"When enabled, applies the pose flipped over the X-axis. This is the "
|
||||
"same as passing a negative `blend_factor`");
|
||||
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
|
||||
|
||||
prop = RNA_def_boolean(ot->srna,
|
||||
"release_confirm",
|
||||
false,
|
||||
|
|
|
@ -98,6 +98,9 @@ void ED_slider_factor_set(struct tSlider *slider, float factor);
|
|||
bool ED_slider_allow_overshoot_get(struct tSlider *slider);
|
||||
void ED_slider_allow_overshoot_set(struct tSlider *slider, bool value);
|
||||
|
||||
bool ED_slider_is_bidirectional_get(struct tSlider *slider);
|
||||
void ED_slider_is_bidirectional_set(struct tSlider *slider, bool value);
|
||||
|
||||
/* ************** XXX OLD CRUFT WARNING ************* */
|
||||
|
||||
/**
|
||||
|
|
|
@ -175,8 +175,8 @@ static bool eyedropper_cryptomatte_sample_renderlayer_fl(RenderLayer *render_lay
|
|||
if (STRPREFIX(render_pass->name, render_pass_name_prefix) &&
|
||||
!STREQLEN(render_pass->name, render_pass_name_prefix, sizeof(render_pass->name))) {
|
||||
BLI_assert(render_pass->channels == 4);
|
||||
const int x = (int)(fpos[0] * render_pass->rectx);
|
||||
const int y = (int)(fpos[1] * render_pass->recty);
|
||||
const int x = int(fpos[0] * render_pass->rectx);
|
||||
const int y = int(fpos[1] * render_pass->recty);
|
||||
const int offset = 4 * (y * render_pass->rectx + x);
|
||||
zero_v3(r_col);
|
||||
r_col[0] = render_pass->rect[offset];
|
||||
|
|
|
@ -115,10 +115,10 @@ void UI_draw_roundbox_3ub_alpha(
|
|||
const rctf *rect, bool filled, float rad, const uchar col[3], uchar alpha)
|
||||
{
|
||||
const float colv[4] = {
|
||||
(float(col[0])) / 255.0f,
|
||||
(float(col[1])) / 255.0f,
|
||||
(float(col[2])) / 255.0f,
|
||||
(float(alpha)) / 255.0f,
|
||||
float(col[0]) / 255.0f,
|
||||
float(col[1]) / 255.0f,
|
||||
float(col[2]) / 255.0f,
|
||||
float(alpha) / 255.0f,
|
||||
};
|
||||
UI_draw_roundbox_4fv_ex(rect, (filled) ? colv : nullptr, nullptr, 1.0f, colv, U.pixelsize, rad);
|
||||
}
|
||||
|
@ -1791,7 +1791,7 @@ void ui_draw_but_CURVEPROFILE(ARegion *region,
|
|||
/* Create array of the positions of the table's points. */
|
||||
float(*table_coords)[2] = static_cast<float(*)[2]>(
|
||||
MEM_mallocN(sizeof(*table_coords) * tot_points, __func__));
|
||||
for (uint i = 0; i < (uint)BKE_curveprofile_table_size(profile); i++) {
|
||||
for (uint i = 0; i < uint(BKE_curveprofile_table_size(profile)); i++) {
|
||||
/* Only add the points from the table here. */
|
||||
table_coords[i][0] = pts[i].x;
|
||||
table_coords[i][1] = pts[i].y;
|
||||
|
|
|
@ -837,7 +837,7 @@ static ImBuf *create_mono_icon_with_border(ImBuf *buf,
|
|||
blend_color_interpolate_float(dest_rgba, orig_rgba, border_rgba, 1.0 - orig_rgba[3]);
|
||||
linearrgb_to_srgb_v4(dest_srgb, dest_rgba);
|
||||
|
||||
const uint alpha_mask = (uint)(dest_srgb[3] * 255) << 24;
|
||||
const uint alpha_mask = uint(dest_srgb[3] * 255) << 24;
|
||||
const uint cpack = rgb_to_cpack(dest_srgb[0], dest_srgb[1], dest_srgb[2]) | alpha_mask;
|
||||
result->rect[offset_write] = cpack;
|
||||
}
|
||||
|
@ -1549,11 +1549,11 @@ static void icon_draw_rect(float x,
|
|||
/* preserve aspect ratio and center */
|
||||
if (rw > rh) {
|
||||
draw_w = w;
|
||||
draw_h = (int)((float(rh) / float(rw)) * float(w));
|
||||
draw_h = int((float(rh) / float(rw)) * float(w));
|
||||
draw_y += (h - draw_h) / 2;
|
||||
}
|
||||
else if (rw < rh) {
|
||||
draw_w = (int)((float(rw) / float(rh)) * float(h));
|
||||
draw_w = int((float(rw) / float(rh)) * float(h));
|
||||
draw_h = h;
|
||||
draw_x += (w - draw_w) / 2;
|
||||
}
|
||||
|
@ -1772,7 +1772,7 @@ static void icon_draw_texture(float x,
|
|||
sizeof(text_overlay->text),
|
||||
text_color,
|
||||
¶ms);
|
||||
text_width = (float)UI_fontstyle_string_width(&fstyle_small, text_overlay->text) / UI_UNIT_X /
|
||||
text_width = float(UI_fontstyle_string_width(&fstyle_small, text_overlay->text)) / UI_UNIT_X /
|
||||
zoom_factor;
|
||||
}
|
||||
|
||||
|
@ -1868,7 +1868,7 @@ static void icon_draw_size(float x,
|
|||
}
|
||||
|
||||
/* scale width and height according to aspect */
|
||||
int w = (int)(fdraw_size / aspect + 0.5f);
|
||||
int w = int(fdraw_size / aspect + 0.5f);
|
||||
int h = int(fdraw_size / aspect + 0.5f);
|
||||
|
||||
DrawInfo *di = icon_ensure_drawinfo(icon);
|
||||
|
|
|
@ -335,7 +335,7 @@ static int ui_text_icon_width_ex(uiLayout *layout,
|
|||
const float aspect = layout->root->block->aspect;
|
||||
const uiFontStyle *fstyle = UI_FSTYLE_WIDGET;
|
||||
return UI_fontstyle_string_width_with_block_aspect(fstyle, name, aspect) +
|
||||
(int)ceilf(unit_x * margin);
|
||||
int(ceilf(unit_x * margin));
|
||||
}
|
||||
return unit_x * 10;
|
||||
}
|
||||
|
@ -4315,7 +4315,7 @@ static void ui_litem_grid_flow_compute(ListBase *items,
|
|||
int item_w, item_h;
|
||||
ui_item_size(item, &item_w, &item_h);
|
||||
|
||||
global_avg_w += (float)(item_w * item_w);
|
||||
global_avg_w += float(item_w * item_w);
|
||||
global_totweight_w += float(item_w);
|
||||
global_max_h = max_ii(global_max_h, item_h);
|
||||
|
||||
|
@ -4361,8 +4361,8 @@ static void ui_litem_grid_flow_compute(ListBase *items,
|
|||
/* Compute positions and sizes of all cells. */
|
||||
if (results->cos_x_array != nullptr && results->widths_array != nullptr) {
|
||||
/* We enlarge/narrow columns evenly to match available width. */
|
||||
const float wfac = (float)(parameters->litem_w -
|
||||
(parameters->tot_columns - 1) * parameters->space_x) /
|
||||
const float wfac = float(parameters->litem_w -
|
||||
(parameters->tot_columns - 1) * parameters->space_x) /
|
||||
tot_w;
|
||||
|
||||
for (int col = 0; col < parameters->tot_columns; col++) {
|
||||
|
@ -4382,7 +4382,7 @@ static void ui_litem_grid_flow_compute(ListBase *items,
|
|||
(results->cos_x_array[col] - parameters->litem_x);
|
||||
}
|
||||
else {
|
||||
results->widths_array[col] = (int)(avg_w[col] * wfac);
|
||||
results->widths_array[col] = int(avg_w[col] * wfac);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4460,10 +4460,10 @@ static void ui_litem_estimate_grid_flow(uiLayout *litem)
|
|||
gflow->tot_columns = 1;
|
||||
}
|
||||
else {
|
||||
gflow->tot_columns = min_ii(max_ii((int)(litem->w / avg_w), 1), gflow->tot_items);
|
||||
gflow->tot_columns = min_ii(max_ii(int(litem->w / avg_w), 1), gflow->tot_items);
|
||||
}
|
||||
}
|
||||
gflow->tot_rows = (int)ceilf(float(gflow->tot_items) / gflow->tot_columns);
|
||||
gflow->tot_rows = int(ceilf(float(gflow->tot_items) / gflow->tot_columns));
|
||||
|
||||
/* Try to tweak number of columns and rows to get better filling of last column or row,
|
||||
* and apply 'modulo' value to number of columns or rows.
|
||||
|
@ -4479,9 +4479,9 @@ static void ui_litem_estimate_grid_flow(uiLayout *litem)
|
|||
gflow->tot_columns = gflow->tot_columns - (gflow->tot_columns % modulo);
|
||||
}
|
||||
/* Find smallest number of columns conserving computed optimal number of rows. */
|
||||
for (gflow->tot_rows = (int)ceilf(float(gflow->tot_items) / gflow->tot_columns);
|
||||
for (gflow->tot_rows = int(ceilf(float(gflow->tot_items) / gflow->tot_columns));
|
||||
(gflow->tot_columns - step) > 0 &&
|
||||
(int)ceilf(float(gflow->tot_items) / (gflow->tot_columns - step)) <= gflow->tot_rows;
|
||||
int(ceilf(float(gflow->tot_items) / (gflow->tot_columns - step))) <= gflow->tot_rows;
|
||||
gflow->tot_columns -= step) {
|
||||
/* pass */
|
||||
}
|
||||
|
@ -4493,9 +4493,9 @@ static void ui_litem_estimate_grid_flow(uiLayout *litem)
|
|||
gflow->tot_items);
|
||||
}
|
||||
/* Find smallest number of rows conserving computed optimal number of columns. */
|
||||
for (gflow->tot_columns = (int)ceilf(float(gflow->tot_items) / gflow->tot_rows);
|
||||
for (gflow->tot_columns = int(ceilf(float(gflow->tot_items) / gflow->tot_rows));
|
||||
(gflow->tot_rows - step) > 0 &&
|
||||
(int)ceilf(float(gflow->tot_items) / (gflow->tot_rows - step)) <= gflow->tot_columns;
|
||||
int(ceilf(float(gflow->tot_items) / (gflow->tot_rows - step))) <= gflow->tot_columns;
|
||||
gflow->tot_rows -= step) {
|
||||
/* pass */
|
||||
}
|
||||
|
@ -4505,8 +4505,8 @@ static void ui_litem_estimate_grid_flow(uiLayout *litem)
|
|||
/* Set evenly-spaced axes size
|
||||
* (quick optimization in case we have even columns and rows). */
|
||||
if (gflow->even_columns && gflow->even_rows) {
|
||||
litem->w = (int)(gflow->tot_columns * avg_w) + space_x * (gflow->tot_columns - 1);
|
||||
litem->h = (int)(gflow->tot_rows * max_h) + space_y * (gflow->tot_rows - 1);
|
||||
litem->w = int(gflow->tot_columns * avg_w) + space_x * (gflow->tot_columns - 1);
|
||||
litem->h = int(gflow->tot_rows * max_h) + space_y * (gflow->tot_rows - 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -4714,7 +4714,7 @@ static void ui_litem_layout_split(uiLayout *litem)
|
|||
x += colw;
|
||||
|
||||
if (item->next) {
|
||||
const float width = extra_pixel + (w - (int)(w * percentage)) / (float(tot) - 1);
|
||||
const float width = extra_pixel + (w - int(w * percentage)) / (float(tot) - 1);
|
||||
extra_pixel = width - int(width);
|
||||
colw = int(width);
|
||||
colw = MAX2(colw, 0);
|
||||
|
@ -6135,7 +6135,7 @@ uiLayout *uiItemsAlertBox(uiBlock *block, const int size, const eAlertIcon icon)
|
|||
const float icon_padding = 5.0f * U.dpi_fac;
|
||||
/* Calculate the factor of the fixed icon column depending on the block width. */
|
||||
const float split_factor = (float(icon_size) + icon_padding) /
|
||||
(float)(dialog_width - style->columnspace);
|
||||
float(dialog_width - style->columnspace);
|
||||
|
||||
uiLayout *block_layout = UI_block_layout(
|
||||
block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, dialog_width, 0, 0, style);
|
||||
|
|
|
@ -3183,7 +3183,7 @@ void uiTemplatePreview(uiLayout *layout,
|
|||
if (!ui_preview) {
|
||||
ui_preview = MEM_cnew<uiPreview>(__func__);
|
||||
BLI_strncpy(ui_preview->preview_id, preview_id, sizeof(ui_preview->preview_id));
|
||||
ui_preview->height = (short)(UI_UNIT_Y * 7.6f);
|
||||
ui_preview->height = short(UI_UNIT_Y * 7.6f);
|
||||
BLI_addtail(®ion->ui_previews, ui_preview);
|
||||
}
|
||||
|
||||
|
@ -3225,7 +3225,7 @@ void uiTemplatePreview(uiLayout *layout,
|
|||
0,
|
||||
0,
|
||||
UI_UNIT_X * 10,
|
||||
(short)(UI_UNIT_Y * 0.3f),
|
||||
short(UI_UNIT_Y * 0.3f),
|
||||
&ui_preview->height,
|
||||
UI_UNIT_Y,
|
||||
UI_UNIT_Y * 50.0f,
|
||||
|
@ -4028,7 +4028,7 @@ void uiTemplateHistogram(uiLayout *layout, PointerRNA *ptr, const char *propname
|
|||
0,
|
||||
0,
|
||||
UI_UNIT_X * 10,
|
||||
(short)(UI_UNIT_Y * 0.3f),
|
||||
short(UI_UNIT_Y * 0.3f),
|
||||
&hist->height,
|
||||
UI_UNIT_Y,
|
||||
UI_UNIT_Y * 20.0f,
|
||||
|
@ -4090,7 +4090,7 @@ void uiTemplateWaveform(uiLayout *layout, PointerRNA *ptr, const char *propname)
|
|||
0,
|
||||
0,
|
||||
UI_UNIT_X * 10,
|
||||
(short)(UI_UNIT_Y * 0.3f),
|
||||
short(UI_UNIT_Y * 0.3f),
|
||||
&scopes->wavefrm_height,
|
||||
UI_UNIT_Y,
|
||||
UI_UNIT_Y * 20.0f,
|
||||
|
@ -4152,7 +4152,7 @@ void uiTemplateVectorscope(uiLayout *layout, PointerRNA *ptr, const char *propna
|
|||
0,
|
||||
0,
|
||||
UI_UNIT_X * 10,
|
||||
(short)(UI_UNIT_Y * 0.3f),
|
||||
short(UI_UNIT_Y * 0.3f),
|
||||
&scopes->vecscope_height,
|
||||
UI_UNIT_Y,
|
||||
UI_UNIT_Y * 20.0f,
|
||||
|
|
|
@ -133,9 +133,9 @@ static const uiWidgetStateInfo STATE_INFO_NULL = {0};
|
|||
static void color_blend_v3_v3(uchar cp[3], const uchar cpstate[3], const float fac)
|
||||
{
|
||||
if (fac != 0.0f) {
|
||||
cp[0] = (int)((1.0f - fac) * cp[0] + fac * cpstate[0]);
|
||||
cp[1] = (int)((1.0f - fac) * cp[1] + fac * cpstate[1]);
|
||||
cp[2] = (int)((1.0f - fac) * cp[2] + fac * cpstate[2]);
|
||||
cp[0] = int((1.0f - fac) * cp[0] + fac * cpstate[0]);
|
||||
cp[1] = int((1.0f - fac) * cp[1] + fac * cpstate[1]);
|
||||
cp[2] = int((1.0f - fac) * cp[2] + fac * cpstate[2]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -880,7 +880,7 @@ static void shape_preset_init_trias_ex(uiWidgetTrias *tria,
|
|||
const float minsize = ELEM(where, 'r', 'l') ? BLI_rcti_size_y(rect) : BLI_rcti_size_x(rect);
|
||||
|
||||
/* center position and size */
|
||||
float centx = (float)rect->xmin + 0.4f * minsize;
|
||||
float centx = float(rect->xmin) + 0.4f * minsize;
|
||||
float centy = float(rect->ymin) + 0.5f * minsize;
|
||||
tria->size = sizex = sizey = -0.5f * triasize * minsize;
|
||||
|
||||
|
@ -1448,8 +1448,8 @@ static void widget_draw_submenu_tria(const uiBut *but,
|
|||
const uiWidgetColors *wcol)
|
||||
{
|
||||
const float aspect = but->block->aspect * U.inv_dpi_fac;
|
||||
const int tria_height = (int)(ICON_DEFAULT_HEIGHT / aspect);
|
||||
const int tria_width = (int)(ICON_DEFAULT_WIDTH / aspect) - 2 * U.pixelsize;
|
||||
const int tria_height = int(ICON_DEFAULT_HEIGHT / aspect);
|
||||
const int tria_width = int(ICON_DEFAULT_WIDTH / aspect) - 2 * U.pixelsize;
|
||||
const int xs = rect->xmax - tria_width;
|
||||
const int ys = (rect->ymin + rect->ymax - tria_height) / 2.0f;
|
||||
|
||||
|
@ -1507,7 +1507,7 @@ static void ui_text_clip_right_ex(const uiFontStyle *fstyle,
|
|||
/* At least one character, so clip and add the ellipsis. */
|
||||
memcpy(str + l_end, sep, sep_len + 1); /* +1 for trailing '\0'. */
|
||||
if (r_final_len) {
|
||||
*r_final_len = (size_t)(l_end) + sep_len;
|
||||
*r_final_len = size_t(l_end) + sep_len;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -1602,7 +1602,7 @@ float UI_text_clip_middle_ex(const uiFontStyle *fstyle,
|
|||
memmove(str + l_end + sep_len, str + r_offset, r_len);
|
||||
memcpy(str + l_end, sep, sep_len);
|
||||
/* -1 to remove trailing '\0'! */
|
||||
final_lpart_len = (size_t)(l_end + sep_len + r_len - 1);
|
||||
final_lpart_len = size_t(l_end + sep_len + r_len - 1);
|
||||
|
||||
while (BLF_width(fstyle->uifont_id, str, max_len) > okwidth) {
|
||||
/* This will happen because a lot of string width processing is done in integer pixels,
|
||||
|
@ -1638,10 +1638,10 @@ static void ui_text_clip_middle(const uiFontStyle *fstyle, uiBut *but, const rct
|
|||
/* No margin for labels! */
|
||||
const int border = ELEM(but->type, UI_BTYPE_LABEL, UI_BTYPE_MENU, UI_BTYPE_POPOVER) ?
|
||||
0 :
|
||||
(int)(UI_TEXT_CLIP_MARGIN + 0.5f);
|
||||
const float okwidth = (float)max_ii(BLI_rcti_size_x(rect) - border, 0);
|
||||
int(UI_TEXT_CLIP_MARGIN + 0.5f);
|
||||
const float okwidth = float(max_ii(BLI_rcti_size_x(rect) - border, 0));
|
||||
const size_t max_len = sizeof(but->drawstr);
|
||||
const float minwidth = (float)(UI_DPI_ICON_SIZE) / but->block->aspect * 2.0f;
|
||||
const float minwidth = float(UI_DPI_ICON_SIZE) / but->block->aspect * 2.0f;
|
||||
|
||||
but->ofs = 0;
|
||||
but->strwidth = UI_text_clip_middle_ex(fstyle, but->drawstr, okwidth, minwidth, max_len, '\0');
|
||||
|
@ -1661,10 +1661,10 @@ static void ui_text_clip_middle_protect_right(const uiFontStyle *fstyle,
|
|||
/* No margin for labels! */
|
||||
const int border = ELEM(but->type, UI_BTYPE_LABEL, UI_BTYPE_MENU, UI_BTYPE_POPOVER) ?
|
||||
0 :
|
||||
(int)(UI_TEXT_CLIP_MARGIN + 0.5f);
|
||||
const float okwidth = (float)max_ii(BLI_rcti_size_x(rect) - border, 0);
|
||||
int(UI_TEXT_CLIP_MARGIN + 0.5f);
|
||||
const float okwidth = float(max_ii(BLI_rcti_size_x(rect) - border, 0));
|
||||
const size_t max_len = sizeof(but->drawstr);
|
||||
const float minwidth = (float)(UI_DPI_ICON_SIZE) / but->block->aspect * 2.0f;
|
||||
const float minwidth = float(UI_DPI_ICON_SIZE) / but->block->aspect * 2.0f;
|
||||
|
||||
but->ofs = 0;
|
||||
but->strwidth = UI_text_clip_middle_ex(fstyle, but->drawstr, okwidth, minwidth, max_len, rsep);
|
||||
|
@ -1675,7 +1675,7 @@ static void ui_text_clip_middle_protect_right(const uiFontStyle *fstyle,
|
|||
*/
|
||||
static void ui_text_clip_cursor(const uiFontStyle *fstyle, uiBut *but, const rcti *rect)
|
||||
{
|
||||
const int border = (int)(UI_TEXT_CLIP_MARGIN + 0.5f);
|
||||
const int border = int(UI_TEXT_CLIP_MARGIN + 0.5f);
|
||||
const int okwidth = max_ii(BLI_rcti_size_x(rect) - border, 0);
|
||||
|
||||
BLI_assert(but->editstr && but->pos >= 0);
|
||||
|
@ -2119,7 +2119,7 @@ static void widget_draw_text(const uiFontStyle *fstyle,
|
|||
for (int i = 0; i < ARRAY_SIZE(keys); i++) {
|
||||
const char *drawstr_menu = strchr(drawstr_ofs, keys[i]);
|
||||
if (drawstr_menu != nullptr && drawstr_menu < drawstr_end) {
|
||||
ul_index = (int)(drawstr_menu - drawstr_ofs);
|
||||
ul_index = int(drawstr_menu - drawstr_ofs);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -2814,7 +2814,7 @@ void ui_hsvcircle_vals_from_pos(
|
|||
/* duplication of code... well, simple is better now */
|
||||
const float centx = BLI_rcti_cent_x_fl(rect);
|
||||
const float centy = BLI_rcti_cent_y_fl(rect);
|
||||
const float radius = (float)min_ii(BLI_rcti_size_x(rect), BLI_rcti_size_y(rect)) / 2.0f;
|
||||
const float radius = float(min_ii(BLI_rcti_size_x(rect), BLI_rcti_size_y(rect))) / 2.0f;
|
||||
const float m_delta[2] = {mx - centx, my - centy};
|
||||
const float dist_sq = len_squared_v2(m_delta);
|
||||
|
||||
|
@ -2828,7 +2828,7 @@ void ui_hsvcircle_pos_from_vals(
|
|||
/* duplication of code... well, simple is better now */
|
||||
const float centx = BLI_rcti_cent_x_fl(rect);
|
||||
const float centy = BLI_rcti_cent_y_fl(rect);
|
||||
const float radius = (float)min_ii(BLI_rcti_size_x(rect), BLI_rcti_size_y(rect)) / 2.0f;
|
||||
const float radius = float(min_ii(BLI_rcti_size_x(rect), BLI_rcti_size_y(rect))) / 2.0f;
|
||||
|
||||
const float ang = 2.0f * float(M_PI) * hsv[0] + float(M_PI_2);
|
||||
|
||||
|
@ -2853,7 +2853,7 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, const uiWidgetColors *wcol, const
|
|||
const float radstep = 2.0f * float(M_PI) / float(tot);
|
||||
const float centx = BLI_rcti_cent_x_fl(rect);
|
||||
const float centy = BLI_rcti_cent_y_fl(rect);
|
||||
const float radius = (float)min_ii(BLI_rcti_size_x(rect), BLI_rcti_size_y(rect)) / 2.0f;
|
||||
const float radius = float(min_ii(BLI_rcti_size_x(rect), BLI_rcti_size_y(rect))) / 2.0f;
|
||||
|
||||
ColorPicker *cpicker = static_cast<ColorPicker *>(but->custom_data);
|
||||
float rgb[3], hsv[3], rgb_center[3];
|
||||
|
@ -3086,7 +3086,7 @@ void ui_draw_gradient(const rcti *rect,
|
|||
sx1 = rect->xmin + dx * BLI_rcti_size_x(rect);
|
||||
sx2 = rect->xmin + dx_next * BLI_rcti_size_x(rect);
|
||||
sy = rect->ymin;
|
||||
dy = (float)BLI_rcti_size_y(rect) / 3.0f;
|
||||
dy = float(BLI_rcti_size_y(rect)) / 3.0f;
|
||||
|
||||
for (a = 0; a < 3; a++, sy += dy) {
|
||||
immAttr4f(col, col0[a][0], col0[a][1], col0[a][2], alpha);
|
||||
|
@ -3551,7 +3551,7 @@ static void widget_scroll(uiBut *but,
|
|||
const float /*zoom*/)
|
||||
{
|
||||
/* calculate slider part */
|
||||
const float value = (float)ui_but_value_get(but);
|
||||
const float value = float(ui_but_value_get(but));
|
||||
|
||||
const float size = max_ff((but->softmax + but->a1 - but->softmin), 2.0f);
|
||||
|
||||
|
@ -3726,7 +3726,7 @@ static void widget_numslider(uiBut *but,
|
|||
rcti rect1 = *rect;
|
||||
float factor, factor_ui;
|
||||
float factor_discard = 1.0f; /* No discard. */
|
||||
const float value = (float)ui_but_value_get(but);
|
||||
const float value = float(ui_but_value_get(but));
|
||||
const float softmin = but->softmin;
|
||||
const float softmax = but->softmax;
|
||||
const float softrange = softmax - softmin;
|
||||
|
@ -3758,7 +3758,7 @@ static void widget_numslider(uiBut *but,
|
|||
}
|
||||
}
|
||||
|
||||
const float width = (float)BLI_rcti_size_x(rect);
|
||||
const float width = float(BLI_rcti_size_x(rect));
|
||||
factor_ui = factor * width;
|
||||
/* The rectangle width needs to be at least twice the corner radius for the round corners
|
||||
* to be drawn properly. */
|
||||
|
@ -4979,9 +4979,9 @@ static void ui_draw_clip_tri(uiBlock *block, rcti *rect, uiWidgetType *wt)
|
|||
float draw_color[4];
|
||||
const uchar *color = wt->wcol.text;
|
||||
|
||||
draw_color[0] = (float(color[0])) / 255.0f;
|
||||
draw_color[1] = (float(color[1])) / 255.0f;
|
||||
draw_color[2] = (float(color[2])) / 255.0f;
|
||||
draw_color[0] = float(color[0]) / 255.0f;
|
||||
draw_color[1] = float(color[1]) / 255.0f;
|
||||
draw_color[2] = float(color[2]) / 255.0f;
|
||||
draw_color[3] = 1.0f;
|
||||
|
||||
if (block->flag & UI_BLOCK_CLIPTOP) {
|
||||
|
@ -5129,7 +5129,7 @@ static void draw_disk_shaded(float start,
|
|||
|
||||
immBegin(GPU_PRIM_TRI_STRIP, subd * 2);
|
||||
for (int i = 0; i < subd; i++) {
|
||||
const float a = start + ((i) / (float)(subd - 1)) * angle;
|
||||
const float a = start + ((i) / float(subd - 1)) * angle;
|
||||
const float s = sinf(a);
|
||||
const float c = cosf(a);
|
||||
const float y1 = s * radius_int;
|
||||
|
@ -5380,9 +5380,9 @@ void ui_draw_menu_item(const uiFontStyle *fstyle,
|
|||
|
||||
{
|
||||
char drawstr[UI_MAX_DRAW_STR];
|
||||
const float okwidth = (float)BLI_rcti_size_x(rect);
|
||||
const float okwidth = float(BLI_rcti_size_x(rect));
|
||||
const size_t max_len = sizeof(drawstr);
|
||||
const float minwidth = (float)(UI_DPI_ICON_SIZE);
|
||||
const float minwidth = float(UI_DPI_ICON_SIZE);
|
||||
|
||||
BLI_strncpy(drawstr, name, sizeof(drawstr));
|
||||
if (drawstr[0]) {
|
||||
|
@ -5431,7 +5431,7 @@ void ui_draw_menu_item(const uiFontStyle *fstyle,
|
|||
char hint_drawstr[UI_MAX_DRAW_STR];
|
||||
{
|
||||
const size_t max_len = sizeof(hint_drawstr);
|
||||
const float minwidth = (float)(UI_DPI_ICON_SIZE);
|
||||
const float minwidth = float(UI_DPI_ICON_SIZE);
|
||||
|
||||
BLI_strncpy(hint_drawstr, cpoin + 1, sizeof(hint_drawstr));
|
||||
if (hint_drawstr[0] && (max_hint_width < INT_MAX)) {
|
||||
|
@ -5484,7 +5484,7 @@ void ui_draw_preview_item_stateless(const uiFontStyle *fstyle,
|
|||
|
||||
{
|
||||
char drawstr[UI_MAX_DRAW_STR];
|
||||
const float okwidth = (float)BLI_rcti_size_x(&trect);
|
||||
const float okwidth = float(BLI_rcti_size_x(&trect));
|
||||
const size_t max_len = sizeof(drawstr);
|
||||
const float minwidth = float(UI_DPI_ICON_SIZE);
|
||||
|
||||
|
|
|
@ -1141,51 +1141,51 @@ void UI_FontThemeColor(int fontid, int colorid)
|
|||
float UI_GetThemeValuef(int colorid)
|
||||
{
|
||||
const uchar *cp = UI_ThemeGetColorPtr(g_theme_state.theme, g_theme_state.spacetype, colorid);
|
||||
return (float(cp[0]));
|
||||
return float(cp[0]);
|
||||
}
|
||||
|
||||
int UI_GetThemeValue(int colorid)
|
||||
{
|
||||
const uchar *cp = UI_ThemeGetColorPtr(g_theme_state.theme, g_theme_state.spacetype, colorid);
|
||||
return (int(cp[0]));
|
||||
return int(cp[0]);
|
||||
}
|
||||
|
||||
float UI_GetThemeValueTypef(int colorid, int spacetype)
|
||||
{
|
||||
const uchar *cp = UI_ThemeGetColorPtr(g_theme_state.theme, spacetype, colorid);
|
||||
return (float(cp[0]));
|
||||
return float(cp[0]);
|
||||
}
|
||||
|
||||
int UI_GetThemeValueType(int colorid, int spacetype)
|
||||
{
|
||||
const uchar *cp = UI_ThemeGetColorPtr(g_theme_state.theme, spacetype, colorid);
|
||||
return (int(cp[0]));
|
||||
return int(cp[0]);
|
||||
}
|
||||
|
||||
void UI_GetThemeColor3fv(int colorid, float col[3])
|
||||
{
|
||||
const uchar *cp = UI_ThemeGetColorPtr(g_theme_state.theme, g_theme_state.spacetype, colorid);
|
||||
col[0] = (float(cp[0])) / 255.0f;
|
||||
col[1] = (float(cp[1])) / 255.0f;
|
||||
col[2] = (float(cp[2])) / 255.0f;
|
||||
col[0] = float(cp[0]) / 255.0f;
|
||||
col[1] = float(cp[1]) / 255.0f;
|
||||
col[2] = float(cp[2]) / 255.0f;
|
||||
}
|
||||
|
||||
void UI_GetThemeColor4fv(int colorid, float col[4])
|
||||
{
|
||||
const uchar *cp = UI_ThemeGetColorPtr(g_theme_state.theme, g_theme_state.spacetype, colorid);
|
||||
col[0] = (float(cp[0])) / 255.0f;
|
||||
col[1] = (float(cp[1])) / 255.0f;
|
||||
col[2] = (float(cp[2])) / 255.0f;
|
||||
col[3] = (float(cp[3])) / 255.0f;
|
||||
col[0] = float(cp[0]) / 255.0f;
|
||||
col[1] = float(cp[1]) / 255.0f;
|
||||
col[2] = float(cp[2]) / 255.0f;
|
||||
col[3] = float(cp[3]) / 255.0f;
|
||||
}
|
||||
|
||||
void UI_GetThemeColorType4fv(int colorid, int spacetype, float col[4])
|
||||
{
|
||||
const uchar *cp = UI_ThemeGetColorPtr(g_theme_state.theme, spacetype, colorid);
|
||||
col[0] = (float(cp[0])) / 255.0f;
|
||||
col[1] = (float(cp[1])) / 255.0f;
|
||||
col[2] = (float(cp[2])) / 255.0f;
|
||||
col[3] = (float(cp[3])) / 255.0f;
|
||||
col[0] = float(cp[0]) / 255.0f;
|
||||
col[1] = float(cp[1]) / 255.0f;
|
||||
col[2] = float(cp[2]) / 255.0f;
|
||||
col[3] = float(cp[3]) / 255.0f;
|
||||
}
|
||||
|
||||
void UI_GetThemeColorShade3fv(int colorid, int offset, float col[3])
|
||||
|
@ -1361,9 +1361,9 @@ void UI_GetThemeColor4ubv(int colorid, uchar col[4])
|
|||
void UI_GetThemeColorType3fv(int colorid, int spacetype, float col[3])
|
||||
{
|
||||
const uchar *cp = UI_ThemeGetColorPtr(g_theme_state.theme, spacetype, colorid);
|
||||
col[0] = (float(cp[0])) / 255.0f;
|
||||
col[1] = (float(cp[1])) / 255.0f;
|
||||
col[2] = (float(cp[2])) / 255.0f;
|
||||
col[0] = float(cp[0]) / 255.0f;
|
||||
col[1] = float(cp[1]) / 255.0f;
|
||||
col[2] = float(cp[2]) / 255.0f;
|
||||
}
|
||||
|
||||
void UI_GetThemeColorType3ubv(int colorid, int spacetype, uchar col[3])
|
||||
|
|
|
@ -217,7 +217,7 @@ static void load_tex_task_cb_ex(void *__restrict userdata,
|
|||
|
||||
/* Clamp to avoid precision overflow. */
|
||||
CLAMP(avg, 0.0f, 1.0f);
|
||||
buffer[index] = 255 - (uchar)(255 * avg);
|
||||
buffer[index] = 255 - uchar(255 * avg);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -386,7 +386,7 @@ static void load_tex_cursor_task_cb(void *__restrict userdata,
|
|||
/* Falloff curve. */
|
||||
float avg = BKE_brush_curve_strength_clamped(br, len, 1.0f);
|
||||
|
||||
buffer[index] = (uchar)(255 * avg);
|
||||
buffer[index] = uchar(255 * avg);
|
||||
}
|
||||
else {
|
||||
buffer[index] = 0;
|
||||
|
|
|
@ -604,8 +604,8 @@ static int project_bucket_offset(const ProjPaintState *ps, const float projCoSS[
|
|||
*
|
||||
* Second multiplication does similar but for vertical offset
|
||||
*/
|
||||
return (int)(((projCoSS[0] - ps->screenMin[0]) / ps->screen_width) * ps->buckets_x) +
|
||||
((int)(((projCoSS[1] - ps->screenMin[1]) / ps->screen_height) * ps->buckets_y) *
|
||||
return int(((projCoSS[0] - ps->screenMin[0]) / ps->screen_width) * ps->buckets_x) +
|
||||
(int(((projCoSS[1] - ps->screenMin[1]) / ps->screen_height) * ps->buckets_y) *
|
||||
ps->buckets_x);
|
||||
}
|
||||
|
||||
|
@ -787,8 +787,8 @@ static bool project_paint_PickColor(
|
|||
}
|
||||
}
|
||||
else {
|
||||
// xi = (int)((uv[0]*ibuf->x) + 0.5f);
|
||||
// yi = (int)((uv[1]*ibuf->y) + 0.5f);
|
||||
// xi = int((uv[0]*ibuf->x) + 0.5f);
|
||||
// yi = int((uv[1]*ibuf->y) + 0.5f);
|
||||
// if (xi < 0 || xi >= ibuf->x || yi < 0 || yi >= ibuf->y) return false;
|
||||
|
||||
/* wrap */
|
||||
|
@ -1080,11 +1080,11 @@ static bool pixel_bounds_uv(const float uv_quad[4][2],
|
|||
minmax_v2v2_v2(min_uv, max_uv, uv_quad[2]);
|
||||
minmax_v2v2_v2(min_uv, max_uv, uv_quad[3]);
|
||||
|
||||
bounds_px->xmin = (int)(ibuf_x * min_uv[0]);
|
||||
bounds_px->ymin = (int)(ibuf_y * min_uv[1]);
|
||||
bounds_px->xmin = int(ibuf_x * min_uv[0]);
|
||||
bounds_px->ymin = int(ibuf_y * min_uv[1]);
|
||||
|
||||
bounds_px->xmax = (int)(ibuf_x * max_uv[0]) + 1;
|
||||
bounds_px->ymax = (int)(ibuf_y * max_uv[1]) + 1;
|
||||
bounds_px->xmax = int(ibuf_x * max_uv[0]) + 1;
|
||||
bounds_px->ymax = int(ibuf_y * max_uv[1]) + 1;
|
||||
|
||||
// printf("%d %d %d %d\n", min_px[0], min_px[1], max_px[0], max_px[1]);
|
||||
|
||||
|
@ -1110,11 +1110,11 @@ static bool pixel_bounds_array(
|
|||
uv++;
|
||||
}
|
||||
|
||||
bounds_px->xmin = (int)(ibuf_x * min_uv[0]);
|
||||
bounds_px->ymin = (int)(ibuf_y * min_uv[1]);
|
||||
bounds_px->xmin = int(ibuf_x * min_uv[0]);
|
||||
bounds_px->ymin = int(ibuf_y * min_uv[1]);
|
||||
|
||||
bounds_px->xmax = (int)(ibuf_x * max_uv[0]) + 1;
|
||||
bounds_px->ymax = (int)(ibuf_y * max_uv[1]) + 1;
|
||||
bounds_px->xmax = int(ibuf_x * max_uv[0]) + 1;
|
||||
bounds_px->ymax = int(ibuf_y * max_uv[1]) + 1;
|
||||
|
||||
// printf("%d %d %d %d\n", min_px[0], min_px[1], max_px[0], max_px[1]);
|
||||
|
||||
|
@ -1945,7 +1945,7 @@ static ProjPixel *project_paint_uvpixel_init(const ProjPaintState *ps,
|
|||
projPixel->x_px = x_px;
|
||||
projPixel->y_px = y_px;
|
||||
|
||||
projPixel->mask = (ushort)(mask * 65535);
|
||||
projPixel->mask = ushort(mask * 65535);
|
||||
if (ps->do_masking) {
|
||||
projPixel->mask_accum = projima->maskRect[tile_index] + tile_offset;
|
||||
}
|
||||
|
@ -1954,8 +1954,8 @@ static ProjPixel *project_paint_uvpixel_init(const ProjPaintState *ps,
|
|||
}
|
||||
|
||||
/* which bounding box cell are we in?, needed for undo */
|
||||
projPixel->bb_cell_index = (int)((float(x_px) / float(ibuf->x)) * PROJ_BOUNDBOX_DIV) +
|
||||
(int)((float(y_px) / float(ibuf->y)) * PROJ_BOUNDBOX_DIV) *
|
||||
projPixel->bb_cell_index = int((float(x_px) / float(ibuf->x)) * PROJ_BOUNDBOX_DIV) +
|
||||
int((float(y_px) / float(ibuf->y)) * PROJ_BOUNDBOX_DIV) *
|
||||
PROJ_BOUNDBOX_DIV;
|
||||
|
||||
/* done with view3d_project_float inline */
|
||||
|
@ -3112,13 +3112,13 @@ static void project_paint_face_init(const ProjPaintState *ps,
|
|||
|
||||
has_isect = 0;
|
||||
for (y = bounds_px.ymin; y < bounds_px.ymax; y++) {
|
||||
// uv[1] = (((float)y) + 0.5f) / (float)ibuf->y;
|
||||
// uv[1] = (float(y) + 0.5f) / float(ibuf->y);
|
||||
/* use pixel offset UV coords instead */
|
||||
uv[1] = float(y) / ibuf_yf;
|
||||
|
||||
has_x_isect = 0;
|
||||
for (x = bounds_px.xmin; x < bounds_px.xmax; x++) {
|
||||
// uv[0] = (((float)x) + 0.5f) / ibuf->x;
|
||||
// uv[0] = (float(x) + 0.5f) / float(ibuf->x);
|
||||
/* use pixel offset UV coords instead */
|
||||
uv[0] = float(x) / ibuf_xf;
|
||||
|
||||
|
@ -3322,7 +3322,7 @@ static void project_paint_face_init(const ProjPaintState *ps,
|
|||
|
||||
has_isect = 0;
|
||||
for (y = bounds_px.ymin; y < bounds_px.ymax; y++) {
|
||||
// uv[1] = (((float)y) + 0.5f) / (float)ibuf->y;
|
||||
// uv[1] = (float(y) + 0.5f) / float(ibuf->y);
|
||||
/* use offset uvs instead */
|
||||
uv[1] = float(y) / ibuf_yf;
|
||||
|
||||
|
@ -3330,7 +3330,7 @@ static void project_paint_face_init(const ProjPaintState *ps,
|
|||
for (x = bounds_px.xmin; x < bounds_px.xmax; x++) {
|
||||
const float puv[2] = {float(x), float(y)};
|
||||
bool in_bounds;
|
||||
// uv[0] = (((float)x) + 0.5f) / (float)ibuf->x;
|
||||
// uv[0] = (float(x) + 0.5f) / float(ibuf->x);
|
||||
/* use offset uvs instead */
|
||||
uv[0] = float(x) / ibuf_xf;
|
||||
|
||||
|
@ -3379,7 +3379,7 @@ static void project_paint_face_init(const ProjPaintState *ps,
|
|||
pixel_on_edge[3] = 1.0f;
|
||||
/* cast because of const */
|
||||
mul_m4_v4((float(*)[4])ps->projectMat, pixel_on_edge);
|
||||
pixel_on_edge[0] = (float)(ps->winx * 0.5f) +
|
||||
pixel_on_edge[0] = float(ps->winx * 0.5f) +
|
||||
(ps->winx * 0.5f) * pixel_on_edge[0] / pixel_on_edge[3];
|
||||
pixel_on_edge[1] = float(ps->winy * 0.5f) +
|
||||
(ps->winy * 0.5f) * pixel_on_edge[1] / pixel_on_edge[3];
|
||||
|
@ -3455,17 +3455,15 @@ static void project_paint_bucket_bounds(const ProjPaintState *ps,
|
|||
* is always truncated to 1, is this really correct? */
|
||||
|
||||
/* these offsets of 0.5 and 1.5 seem odd but they are correct */
|
||||
bucketMin[0] =
|
||||
(int)((int)(((float)(min[0] - ps->screenMin[0]) / ps->screen_width) * ps->buckets_x) + 0.5f);
|
||||
bucketMin[1] = (int)((int)(((float)(min[1] - ps->screenMin[1]) / ps->screen_height) *
|
||||
ps->buckets_y) +
|
||||
0.5f);
|
||||
bucketMin[0] = int(int((float(min[0] - ps->screenMin[0]) / ps->screen_width) * ps->buckets_x) +
|
||||
0.5f);
|
||||
bucketMin[1] = int(int((float(min[1] - ps->screenMin[1]) / ps->screen_height) * ps->buckets_y) +
|
||||
0.5f);
|
||||
|
||||
bucketMax[0] =
|
||||
(int)((int)(((float)(max[0] - ps->screenMin[0]) / ps->screen_width) * ps->buckets_x) + 1.5f);
|
||||
bucketMax[1] = (int)((int)(((float)(max[1] - ps->screenMin[1]) / ps->screen_height) *
|
||||
ps->buckets_y) +
|
||||
1.5f);
|
||||
bucketMax[0] = int(int((float(max[0] - ps->screenMin[0]) / ps->screen_width) * ps->buckets_x) +
|
||||
1.5f);
|
||||
bucketMax[1] = int(int((float(max[1] - ps->screenMin[1]) / ps->screen_height) * ps->buckets_y) +
|
||||
1.5f);
|
||||
|
||||
/* in case the rect is outside the mesh 2d bounds */
|
||||
CLAMP(bucketMin[0], 0, ps->buckets_x);
|
||||
|
@ -3820,8 +3818,8 @@ static void proj_paint_state_screen_coords_init(ProjPaintState *ps, const int di
|
|||
mul_v3_m4v3(projScreenCo, ps->projectMat, ps->positions_eval[a]);
|
||||
|
||||
/* screen space, not clamped */
|
||||
projScreenCo[0] = (float)(ps->winx * 0.5f) + (ps->winx * 0.5f) * projScreenCo[0];
|
||||
projScreenCo[1] = (float)(ps->winy * 0.5f) + (ps->winy * 0.5f) * projScreenCo[1];
|
||||
projScreenCo[0] = float(ps->winx * 0.5f) + (ps->winx * 0.5f) * projScreenCo[0];
|
||||
projScreenCo[1] = float(ps->winy * 0.5f) + (ps->winy * 0.5f) * projScreenCo[1];
|
||||
minmax_v2v2_v2(ps->screenMin, ps->screenMax, projScreenCo);
|
||||
}
|
||||
}
|
||||
|
@ -3834,9 +3832,9 @@ static void proj_paint_state_screen_coords_init(ProjPaintState *ps, const int di
|
|||
|
||||
if (projScreenCo[3] > ps->clip_start) {
|
||||
/* screen space, not clamped */
|
||||
projScreenCo[0] = (float)(ps->winx * 0.5f) +
|
||||
projScreenCo[0] = float(ps->winx * 0.5f) +
|
||||
(ps->winx * 0.5f) * projScreenCo[0] / projScreenCo[3];
|
||||
projScreenCo[1] = (float)(ps->winy * 0.5f) +
|
||||
projScreenCo[1] = float(ps->winy * 0.5f) +
|
||||
(ps->winy * 0.5f) * projScreenCo[1] / projScreenCo[3];
|
||||
/* Use the depth for bucket point occlusion */
|
||||
projScreenCo[2] = projScreenCo[2] / projScreenCo[3];
|
||||
|
@ -4544,7 +4542,7 @@ static void project_paint_begin(const bContext *C,
|
|||
ps->screen_width = ps->screenMax[0] - ps->screenMin[0];
|
||||
ps->screen_height = ps->screenMax[1] - ps->screenMin[1];
|
||||
|
||||
ps->buckets_x = (int)(ps->screen_width / ((float(diameter)) / PROJ_BUCKET_BRUSH_DIV));
|
||||
ps->buckets_x = int(ps->screen_width / (float(diameter) / PROJ_BUCKET_BRUSH_DIV));
|
||||
ps->buckets_y = int(ps->screen_height / (float(diameter) / PROJ_BUCKET_BRUSH_DIV));
|
||||
|
||||
// printf("\tscreenspace bucket division x:%d y:%d\n", ps->buckets_x, ps->buckets_y);
|
||||
|
@ -4588,9 +4586,9 @@ static void paint_proj_begin_clone(ProjPaintState *ps, const float mouse[2])
|
|||
projCo[3] = 1.0f;
|
||||
mul_m4_v4(ps->projectMat, projCo);
|
||||
ps->cloneOffset[0] = mouse[0] -
|
||||
((float)(ps->winx * 0.5f) + (ps->winx * 0.5f) * projCo[0] / projCo[3]);
|
||||
(float(ps->winx * 0.5f) + (ps->winx * 0.5f) * projCo[0] / projCo[3]);
|
||||
ps->cloneOffset[1] = mouse[1] -
|
||||
((float)(ps->winy * 0.5f) + (ps->winy * 0.5f) * projCo[1] / projCo[3]);
|
||||
(float(ps->winy * 0.5f) + (ps->winy * 0.5f) * projCo[1] / projCo[3]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4796,7 +4794,7 @@ static bool project_bucket_iter_next(ProjPaintState *ps,
|
|||
project_bucket_bounds(ps, bucket_x, bucket_y, bucket_bounds);
|
||||
|
||||
if ((ps->source != PROJ_SRC_VIEW) ||
|
||||
project_bucket_isect_circle(mval, (float)(diameter * diameter), bucket_bounds)) {
|
||||
project_bucket_isect_circle(mval, float(diameter * diameter), bucket_bounds)) {
|
||||
*bucket_index = bidx;
|
||||
|
||||
return true;
|
||||
|
@ -4836,7 +4834,7 @@ static void do_projectpaint_clone(ProjPaintState *ps, ProjPixel *projPixel, floa
|
|||
clone_rgba[0] = clone_pt[0];
|
||||
clone_rgba[1] = clone_pt[1];
|
||||
clone_rgba[2] = clone_pt[2];
|
||||
clone_rgba[3] = (uchar)(clone_pt[3] * mask);
|
||||
clone_rgba[3] = uchar(clone_pt[3] * mask);
|
||||
|
||||
if (ps->do_masking) {
|
||||
IMB_blend_color_byte(projPixel->pixel.ch_pt,
|
||||
|
@ -5290,7 +5288,7 @@ static void do_projectpaint_thread(TaskPool *__restrict /*pool*/, void *ph_v)
|
|||
}
|
||||
}
|
||||
BKE_colorband_evaluate(brush->gradient, f, color_f);
|
||||
color_f[3] *= (float(projPixel->mask)) * (1.0f / 65535.0f) * brush_alpha;
|
||||
color_f[3] *= float(projPixel->mask) * (1.0f / 65535.0f) * brush_alpha;
|
||||
|
||||
if (is_floatbuf) {
|
||||
/* Convert to premutliplied. */
|
||||
|
@ -5320,7 +5318,7 @@ static void do_projectpaint_thread(TaskPool *__restrict /*pool*/, void *ph_v)
|
|||
else {
|
||||
if (is_floatbuf) {
|
||||
float newColor_f[4];
|
||||
newColor_f[3] = (float(projPixel->mask)) * (1.0f / 65535.0f) * brush_alpha;
|
||||
newColor_f[3] = float(projPixel->mask) * (1.0f / 65535.0f) * brush_alpha;
|
||||
copy_v3_v3(newColor_f, ps->paint_color_linear);
|
||||
|
||||
IMB_blend_color_float(projPixel->pixel.f_pt,
|
||||
|
@ -5357,7 +5355,7 @@ static void do_projectpaint_thread(TaskPool *__restrict /*pool*/, void *ph_v)
|
|||
projPixel->projCoSS[0],
|
||||
projPixel->projCoSS[1]);
|
||||
if (projPixel->newColor.f[3]) {
|
||||
float mask = (float(projPixel->mask)) * (1.0f / 65535.0f);
|
||||
float mask = float(projPixel->mask) * (1.0f / 65535.0f);
|
||||
|
||||
mul_v4_v4fl(projPixel->newColor.f, projPixel->newColor.f, mask);
|
||||
|
||||
|
@ -5374,7 +5372,7 @@ static void do_projectpaint_thread(TaskPool *__restrict /*pool*/, void *ph_v)
|
|||
projPixel->projCoSS[0],
|
||||
projPixel->projCoSS[1]);
|
||||
if (projPixel->newColor.ch[3]) {
|
||||
float mask = (float(projPixel->mask)) * (1.0f / 65535.0f);
|
||||
float mask = float(projPixel->mask) * (1.0f / 65535.0f);
|
||||
projPixel->newColor.ch[3] *= mask;
|
||||
|
||||
blend_color_mix_byte(
|
||||
|
@ -5404,7 +5402,7 @@ static void do_projectpaint_thread(TaskPool *__restrict /*pool*/, void *ph_v)
|
|||
float mask;
|
||||
|
||||
/* Extra mask for normal, layer stencil, etc. */
|
||||
float custom_mask = (float(projPixel->mask)) * (1.0f / 65535.0f);
|
||||
float custom_mask = float(projPixel->mask) * (1.0f / 65535.0f);
|
||||
|
||||
/* Mask texture. */
|
||||
if (ps->is_maskbrush) {
|
||||
|
@ -5803,7 +5801,7 @@ void paint_proj_stroke(const bContext *C,
|
|||
View3D *v3d = CTX_wm_view3d(C);
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
float *cursor = scene->cursor.location;
|
||||
const int mval_i[2] = {(int)pos[0], int(pos[1])};
|
||||
const int mval_i[2] = {int(pos[0]), int(pos[1])};
|
||||
|
||||
view3d_operator_needs_opengl(C);
|
||||
|
||||
|
|
|
@ -517,7 +517,7 @@ enum eBlurKernelType;
|
|||
BlurKernel *paint_new_blur_kernel(struct Brush *br, bool proj);
|
||||
void paint_delete_blur_kernel(BlurKernel *);
|
||||
|
||||
/* Initialize viewport pivot from evaulated bounding box center of ob. */
|
||||
/** Initialize viewport pivot from evaluated bounding box center of `ob`. */
|
||||
void paint_init_pivot(struct Object *ob, struct Scene *scene);
|
||||
|
||||
/* paint curve defines */
|
||||
|
|
|
@ -178,7 +178,7 @@ static void gather_add_node_operations(const bContext &C,
|
|||
if (!(node_type->poll && node_type->poll(node_type, &node_tree, &disabled_hint))) {
|
||||
continue;
|
||||
}
|
||||
if ((StringRefNull(node_tree.typeinfo->group_idname) == node_type->idname)) {
|
||||
if (StringRefNull(node_tree.typeinfo->group_idname) == node_type->idname) {
|
||||
/* Skip the empty group type. */
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -263,7 +263,7 @@ static bool clip_uv_transform_shear(const TransInfo *t, float *vec, float *vec_i
|
|||
for (int i = 0; i < max_i; i++) {
|
||||
/* Binary search. */
|
||||
const float value_mid = (value_inside_bounds + value) / 2.0f;
|
||||
if (value_mid == value_inside_bounds || value_mid == value) {
|
||||
if (ELEM(value_mid, value_inside_bounds, value)) {
|
||||
break; /* float precision reached. */
|
||||
}
|
||||
if (uv_shear_in_clip_bounds_test(t, value_mid)) {
|
||||
|
|
|
@ -75,6 +75,11 @@ typedef struct tSlider {
|
|||
/** Last mouse cursor position used for mouse movement delta calculation. */
|
||||
float last_cursor[2];
|
||||
|
||||
/** Allow negative values as well.
|
||||
* This is set by the code that uses the slider, as not all operations support
|
||||
* negative values. */
|
||||
bool is_bidirectional;
|
||||
|
||||
/** Enable range beyond 0-100%.
|
||||
* This is set by the code that uses the slider, as not all operations support
|
||||
* extrapolation. */
|
||||
|
@ -89,6 +94,7 @@ typedef struct tSlider {
|
|||
|
||||
/** Reduces factor delta from mouse movement. */
|
||||
bool precision;
|
||||
|
||||
} tSlider;
|
||||
|
||||
static void draw_overshoot_triangle(const uint8_t color[4],
|
||||
|
@ -279,14 +285,19 @@ static void slider_draw(const struct bContext *UNUSED(C), ARegion *region, void
|
|||
.ymax = line_y + line_width / 2,
|
||||
};
|
||||
float line_start_factor = 0;
|
||||
int handle_pos_x = main_line_rect.xmin + SLIDE_PIXEL_DISTANCE * slider->factor;
|
||||
|
||||
int handle_pos_x;
|
||||
if (slider->overshoot) {
|
||||
main_line_rect.xmin = main_line_rect.xmin - SLIDE_PIXEL_DISTANCE * OVERSHOOT_RANGE_DELTA;
|
||||
main_line_rect.xmax = main_line_rect.xmax + SLIDE_PIXEL_DISTANCE * OVERSHOOT_RANGE_DELTA;
|
||||
line_start_factor = slider->factor - 0.5f - OVERSHOOT_RANGE_DELTA;
|
||||
handle_pos_x = region->winx / 2;
|
||||
}
|
||||
else if (slider->is_bidirectional) {
|
||||
handle_pos_x = main_line_rect.xmin + SLIDE_PIXEL_DISTANCE * (slider->factor / 2 + 0.5f);
|
||||
}
|
||||
else {
|
||||
handle_pos_x = main_line_rect.xmin + SLIDE_PIXEL_DISTANCE * slider->factor;
|
||||
}
|
||||
|
||||
draw_backdrop(fontid, &main_line_rect, color_bg, slider->region_header->winy, base_tick_height);
|
||||
|
||||
|
@ -350,7 +361,10 @@ static void slider_update_factor(tSlider *slider, const wmEvent *event)
|
|||
copy_v2fl_v2i(slider->last_cursor, event->xy);
|
||||
|
||||
if (!slider->overshoot) {
|
||||
slider->factor = clamp_f(slider->factor, 0, 1);
|
||||
slider->factor = clamp_f(slider->factor, -1, 1);
|
||||
}
|
||||
if (!slider->is_bidirectional) {
|
||||
slider->factor = max_ff(slider->factor, 0);
|
||||
}
|
||||
|
||||
if (slider->increments) {
|
||||
|
@ -504,6 +518,16 @@ void ED_slider_allow_overshoot_set(struct tSlider *slider, const bool value)
|
|||
slider->allow_overshoot = value;
|
||||
}
|
||||
|
||||
bool ED_slider_is_bidirectional_get(struct tSlider *slider)
|
||||
{
|
||||
return slider->is_bidirectional;
|
||||
}
|
||||
|
||||
void ED_slider_is_bidirectional_set(struct tSlider *slider, const bool value)
|
||||
{
|
||||
slider->is_bidirectional = value;
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
void ED_region_draw_mouse_line_cb(const bContext *C, ARegion *region, void *arg_info)
|
||||
|
|
|
@ -42,11 +42,11 @@ static void mul_v2_m2_add_v2v2(float r[2],
|
|||
const float b[2])
|
||||
{
|
||||
/* Compute `r = mat * (a + b)` with high precision. */
|
||||
const double x = static_cast<double>(a[0]) + double(b[0]);
|
||||
const double y = static_cast<double>(a[1]) + double(b[1]);
|
||||
const double x = double(a[0]) + double(b[0]);
|
||||
const double y = double(a[1]) + double(b[1]);
|
||||
|
||||
r[0] = static_cast<float>(mat[0][0] * x + mat[1][0] * y);
|
||||
r[1] = static_cast<float>(mat[0][1] * x + mat[1][1] * y);
|
||||
r[0] = float(mat[0][0] * x + mat[1][0] * y);
|
||||
r[1] = float(mat[0][1] * x + mat[1][1] * y);
|
||||
}
|
||||
|
||||
static void island_uv_transform(FaceIsland *island,
|
||||
|
|
|
@ -84,6 +84,12 @@ class FieldNode {
|
|||
|
||||
virtual uint64_t hash() const;
|
||||
virtual bool is_equal_to(const FieldNode &other) const;
|
||||
|
||||
/**
|
||||
* Calls the callback for every field input that the current field depends on. This is recursive,
|
||||
* so if a field input depends on other field inputs, those are taken into account as well.
|
||||
*/
|
||||
virtual void for_each_field_input_recursive(FunctionRef<void(const FieldInput &)> fn) const;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -579,6 +579,18 @@ bool IndexFieldInput::is_equal_to(const fn::FieldNode &other) const
|
|||
/* Avoid generating the destructor in every translation unit. */
|
||||
FieldNode::~FieldNode() = default;
|
||||
|
||||
void FieldNode::for_each_field_input_recursive(FunctionRef<void(const FieldInput &)> fn) const
|
||||
{
|
||||
if (field_inputs_) {
|
||||
for (const FieldInput &field_input : field_inputs_->deduplicated_nodes) {
|
||||
fn(field_input);
|
||||
if (&field_input != this) {
|
||||
field_input.for_each_field_input_recursive(fn);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
|
|
@ -372,7 +372,7 @@ static void custom_range_header_draw(const bContext *UNUSED(C), Panel *panel)
|
|||
|
||||
int mode = RNA_enum_get(ptr, "mode");
|
||||
|
||||
uiLayoutSetActive(layout, (mode != GP_TIME_MODE_FIX && mode != GP_TIME_MODE_CHAIN));
|
||||
uiLayoutSetActive(layout, !ELEM(mode, GP_TIME_MODE_FIX, GP_TIME_MODE_CHAIN));
|
||||
|
||||
uiItemR(layout, ptr, "use_custom_frame_range", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
@ -388,7 +388,7 @@ static void custom_range_panel_draw(const bContext *UNUSED(C), Panel *panel)
|
|||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
uiLayoutSetActive(layout,
|
||||
(mode != GP_TIME_MODE_FIX && mode != GP_TIME_MODE_CHAIN) &&
|
||||
(!ELEM(mode, GP_TIME_MODE_FIX, GP_TIME_MODE_CHAIN)) &&
|
||||
RNA_boolean_get(ptr, "use_custom_frame_range"));
|
||||
|
||||
col = uiLayoutColumn(layout, true);
|
||||
|
|
|
@ -4608,7 +4608,7 @@ static void lineart_create_edges_from_isec_data(LineartIsecData *d)
|
|||
e->t1 = is->tri1;
|
||||
e->t2 = is->tri2;
|
||||
/* This is so we can also match intersection edges from shadow to later viewing stage. */
|
||||
e->edge_identifier = ((uint64_t(e->t1->target_reference)) << 32) | e->t2->target_reference;
|
||||
e->edge_identifier = (uint64_t(e->t1->target_reference) << 32) | e->t2->target_reference;
|
||||
e->flags = LRT_EDGE_FLAG_INTERSECTION;
|
||||
e->intersection_mask = (is->tri1->intersection_mask | is->tri2->intersection_mask);
|
||||
BLI_addtail(&e->segments, es);
|
||||
|
|
|
@ -262,7 +262,7 @@ bool GPU_backend_type_selection_detect(void)
|
|||
backends_to_check.append(GPU_BACKEND_OPENGL);
|
||||
}
|
||||
|
||||
/* Add fallback to OpenGL when Metal backend is requested on a platform that doens't support
|
||||
/* Add fallback to OpenGL when Metal backend is requested on a platform that doesn't support
|
||||
* metal. */
|
||||
if (backends_to_check[0] == GPU_BACKEND_METAL) {
|
||||
backends_to_check.append(GPU_BACKEND_OPENGL);
|
||||
|
|
|
@ -286,7 +286,7 @@ void MTLShaderInterface::prepare_common_shader_inputs()
|
|||
MTLShaderInputAttribute &shd_attr = attributes_[attr_index];
|
||||
current_input->name_offset = shd_attr.name_offset;
|
||||
current_input->name_hash = BLI_hash_string(this->get_name_at_offset(shd_attr.name_offset));
|
||||
/* For Metal, we flatten the vertex attribute indices within the shader in order to minimise
|
||||
/* For Metal, we flatten the vertex attribute indices within the shader in order to minimize
|
||||
* complexity. ShaderInput "Location" contains the original attribute location, as can be
|
||||
* fetched using `GPU_shader_get_attribute_info`. ShaderInput binding contains the array index
|
||||
* into the MTLShaderInterface `attributes_` array. */
|
||||
|
|
|
@ -827,7 +827,7 @@ void GLPixelBuffer::unmap()
|
|||
|
||||
int64_t GLPixelBuffer::get_native_handle()
|
||||
{
|
||||
return (int64_t)gl_id_;
|
||||
return int64_t(gl_id_);
|
||||
}
|
||||
|
||||
uint GLPixelBuffer::get_size()
|
||||
|
|
|
@ -596,7 +596,7 @@ AbcUvScope get_uv_scope(const Alembic::AbcGeom::GeometryScope scope,
|
|||
/* kVaryingScope is sometimes used for vertex scopes as the values vary across the vertices. To
|
||||
* be sure, one has to check the size of the data against the number of vertices, as it could
|
||||
* also be a varying attribute across the faces (i.e. one value per face). */
|
||||
if ((ELEM(scope, kVaryingScope, kVertexScope)) && indices->size() == config.totvert) {
|
||||
if (ELEM(scope, kVaryingScope, kVertexScope) && indices->size() == config.totvert) {
|
||||
return ABC_UV_SCOPE_VERTEX;
|
||||
}
|
||||
|
||||
|
|
|
@ -178,7 +178,7 @@ void GpencilExporterPDF::export_gpencil_layers()
|
|||
gps_duplicate->thickness += gpl->line_change;
|
||||
/* Apply object scale to thickness. */
|
||||
const float scalef = mat4_to_scale(ob->object_to_world);
|
||||
gps_duplicate->thickness = ceilf((float)gps_duplicate->thickness * scalef);
|
||||
gps_duplicate->thickness = ceilf(float(gps_duplicate->thickness) * scalef);
|
||||
CLAMP_MIN(gps_duplicate->thickness, 1.0f);
|
||||
/* Fill. */
|
||||
if ((is_fill) && (params_.flag & GP_EXPORT_FILL)) {
|
||||
|
|
|
@ -199,7 +199,7 @@ void GpencilExporterSVG::export_gpencil_layers()
|
|||
gps_duplicate->thickness += gpl->line_change;
|
||||
/* Apply object scale to thickness. */
|
||||
const float scalef = mat4_to_scale(ob->object_to_world);
|
||||
gps_duplicate->thickness = ceilf((float)gps_duplicate->thickness * scalef);
|
||||
gps_duplicate->thickness = ceilf(float(gps_duplicate->thickness) * scalef);
|
||||
CLAMP_MIN(gps_duplicate->thickness, 1.0f);
|
||||
|
||||
const bool is_normalized = ((params_.flag & GP_EXPORT_NORM_THICKNESS) != 0) ||
|
||||
|
|
|
@ -812,7 +812,7 @@ enum {
|
|||
* ID is considered as runtime, and should not be saved when writing .blend file, nor influence
|
||||
* (in)direct status of linked data.
|
||||
*
|
||||
* Only meaningful for IDs belonging to regular Main database, all other cases are implicitely
|
||||
* Only meaningful for IDs belonging to regular Main database, all other cases are implicitly
|
||||
* considered runtime-only.
|
||||
*
|
||||
* RESET_NEVER
|
||||
|
@ -860,10 +860,10 @@ enum {
|
|||
|
||||
/**
|
||||
* Most of ID tags are cleared on file write (i.e. also when storing undo steps), since they
|
||||
* either have of very short lifetime (not expected to exist accross undo steps), or are info that
|
||||
* either have of very short lifetime (not expected to exist across undo steps), or are info that
|
||||
* will be re-generated when reading undo steps.
|
||||
*
|
||||
* However a few of these need to be explicitely preserved accross undo steps.
|
||||
* However a few of these need to be explicitly preserved across undo steps.
|
||||
*/
|
||||
#define LIB_TAG_KEEP_ON_UNDO (LIB_TAG_EXTRAUSER | LIB_TAG_MISSING | LIB_TAG_RUNTIME)
|
||||
|
||||
|
|
|
@ -187,6 +187,10 @@ typedef struct bNodeSocket {
|
|||
int index() const;
|
||||
/** Socket index in the entire node tree. Inputs and outputs share the same index space. */
|
||||
int index_in_tree() const;
|
||||
/** Socket index in the entire node tree. All inputs share the same index space. */
|
||||
int index_in_all_inputs() const;
|
||||
/** Socket index in the entire node tree. All outputs share the same index space. */
|
||||
int index_in_all_outputs() const;
|
||||
/** Node this socket belongs to. */
|
||||
bNode &owner_node();
|
||||
const bNode &owner_node() const;
|
||||
|
@ -490,6 +494,8 @@ typedef struct bNodeLink {
|
|||
#ifdef __cplusplus
|
||||
bool is_muted() const;
|
||||
bool is_available() const;
|
||||
/** Both linked sockets are available and the link is not muted. */
|
||||
bool is_used() const;
|
||||
#endif
|
||||
|
||||
} bNodeLink;
|
||||
|
|
|
@ -389,6 +389,17 @@ static PointerRNA rna_AttributeGroup_new(
|
|||
ID *id, ReportList *reports, const char *name, const int type, const int domain)
|
||||
{
|
||||
CustomDataLayer *layer = BKE_id_attribute_new(id, name, type, domain, reports);
|
||||
|
||||
if ((GS(id->name) == ID_ME) && ELEM(layer->type, CD_PROP_COLOR, CD_PROP_BYTE_COLOR)) {
|
||||
Mesh *mesh = (Mesh *)id;
|
||||
if (!mesh->active_color_attribute) {
|
||||
mesh->active_color_attribute = BLI_strdup(layer->name);
|
||||
}
|
||||
if (!mesh->default_color_attribute) {
|
||||
mesh->default_color_attribute = BLI_strdup(layer->name);
|
||||
}
|
||||
}
|
||||
|
||||
DEG_id_tag_update(id, ID_RECALC_GEOMETRY);
|
||||
WM_main_add_notifier(NC_GEOM | ND_DATA, id);
|
||||
|
||||
|
|
|
@ -267,7 +267,7 @@ static void rna_DriverTarget_update_name(Main *bmain, Scene *scene, PointerRNA *
|
|||
|
||||
/* ----------- */
|
||||
|
||||
/* NOTE: this function exists only to avoid id refcounting. */
|
||||
/* NOTE: this function exists only to avoid id reference-counting. */
|
||||
static void rna_DriverTarget_id_set(PointerRNA *ptr,
|
||||
PointerRNA value,
|
||||
struct ReportList *UNUSED(reports))
|
||||
|
|
|
@ -103,7 +103,7 @@ static void rna_Mask_update_parent(Main *bmain, Scene *scene, PointerRNA *ptr)
|
|||
rna_Mask_update_data(bmain, scene, ptr);
|
||||
}
|
||||
|
||||
/* NOTE: this function exists only to avoid id refcounting. */
|
||||
/* NOTE: this function exists only to avoid id reference-counting. */
|
||||
static void rna_MaskParent_id_set(PointerRNA *ptr,
|
||||
PointerRNA value,
|
||||
struct ReportList *UNUSED(reports))
|
||||
|
|
|
@ -216,28 +216,29 @@ void RNA_api_pose(StructRNA *srna)
|
|||
func,
|
||||
"Create a backup of the current pose. Only those bones that are animated in the Action are "
|
||||
"backed up. The object owns the backup, and each object can have only one backup at a time. "
|
||||
"When you no longer need it, it must be freed use `backup_clear()`.");
|
||||
"When you no longer need it, it must be freed use `backup_clear()`");
|
||||
RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_NO_SELF);
|
||||
parm = RNA_def_pointer(func,
|
||||
"action",
|
||||
"Action",
|
||||
"Action",
|
||||
"An Action with animation data for the bones. Only the animated bones "
|
||||
"will be included in the backup.");
|
||||
"An Action with animation data for the bones. "
|
||||
"Only the animated bones will be included in the backup");
|
||||
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
||||
|
||||
func = RNA_def_function(srna, "backup_restore", "rna_Pose_backup_restore");
|
||||
RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_NO_SELF | FUNC_USE_CONTEXT);
|
||||
RNA_def_function_ui_description(func,
|
||||
"Restore the previously made pose backup. This can be called "
|
||||
"multiple times. See `Pose.backup_create()` for more info.");
|
||||
RNA_def_function_ui_description(
|
||||
func,
|
||||
"Restore the previously made pose backup. "
|
||||
"This can be called multiple times. See `Pose.backup_create()` for more info");
|
||||
/* return value */
|
||||
parm = RNA_def_boolean(
|
||||
func,
|
||||
"success",
|
||||
false,
|
||||
"",
|
||||
"`True` when the backup was restored, `False` if there was no backup to restore.");
|
||||
"`True` when the backup was restored, `False` if there was no backup to restore");
|
||||
RNA_def_function_return(func, parm);
|
||||
|
||||
func = RNA_def_function(srna, "backup_clear", "rna_Pose_backup_clear");
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#ifdef RNA_RUNTIME
|
||||
|
||||
//#include "DNA_anim_types.h"
|
||||
// #include "DNA_anim_types.h"
|
||||
# include "DNA_image_types.h"
|
||||
# include "DNA_mask_types.h"
|
||||
# include "DNA_sound_types.h"
|
||||
|
@ -83,6 +83,8 @@ static void rna_Sequences_move_strip_to_meta(
|
|||
DEG_relations_tag_update(bmain);
|
||||
DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS);
|
||||
|
||||
SEQ_sequence_lookup_tag(scene, SEQ_LOOKUP_TAG_INVALID);
|
||||
|
||||
WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene);
|
||||
}
|
||||
|
||||
|
|
|
@ -1966,7 +1966,7 @@ static void rna_SpaceTextEditor_updateEdited(Main *UNUSED(bmain),
|
|||
|
||||
/* Space Properties */
|
||||
|
||||
/* NOTE: this function exists only to avoid id refcounting. */
|
||||
/* NOTE: this function exists only to avoid id reference-counting. */
|
||||
static void rna_SpaceProperties_pin_id_set(PointerRNA *ptr,
|
||||
PointerRNA value,
|
||||
struct ReportList *UNUSED(reports))
|
||||
|
|
|
@ -490,8 +490,8 @@ static Mesh *arrayModifier_doArray(ArrayModifierData *amd,
|
|||
/* Ensure we keep things to a reasonable level, in terms of rough total amount of generated
|
||||
* vertices.
|
||||
*/
|
||||
if (((size_t)count * (size_t)chunk_nverts + (size_t)start_cap_nverts +
|
||||
(size_t)end_cap_nverts) > max_verts_num) {
|
||||
if ((size_t(count) * size_t(chunk_nverts) + size_t(start_cap_nverts) +
|
||||
size_t(end_cap_nverts)) > max_verts_num) {
|
||||
count = 1;
|
||||
offset_is_too_small = true;
|
||||
}
|
||||
|
@ -512,8 +512,8 @@ static Mesh *arrayModifier_doArray(ArrayModifierData *amd,
|
|||
/* Ensure we keep things to a reasonable level, in terms of rough total amount of generated
|
||||
* vertices.
|
||||
*/
|
||||
else if (((size_t)count * (size_t)chunk_nverts + (size_t)start_cap_nverts +
|
||||
(size_t)end_cap_nverts) > max_verts_num) {
|
||||
else if ((size_t(count) * size_t(chunk_nverts) + size_t(start_cap_nverts) +
|
||||
size_t(end_cap_nverts)) > max_verts_num) {
|
||||
count = 1;
|
||||
BKE_modifier_set_error(ctx->object,
|
||||
&amd->modifier,
|
||||
|
|
|
@ -738,7 +738,7 @@ ModifierTypeInfo modifierType_WeightedNormal = {
|
|||
/* type */ eModifierTypeType_Constructive,
|
||||
/* flags */ eModifierTypeFlag_AcceptsMesh | eModifierTypeFlag_SupportsMapping |
|
||||
eModifierTypeFlag_SupportsEditmode | eModifierTypeFlag_EnableInEditmode,
|
||||
/* icon */ ICON_MOD_VERTEX_WEIGHT,
|
||||
/* icon */ ICON_MOD_NORMALEDIT,
|
||||
|
||||
/* copyData */ BKE_modifier_copydata_generic,
|
||||
|
||||
|
|
|
@ -65,6 +65,76 @@ struct FieldInferencingInterface {
|
|||
Vector<OutputFieldDependency> outputs;
|
||||
};
|
||||
|
||||
namespace anonymous_attribute_lifetime {
|
||||
|
||||
/**
|
||||
* Attributes can be propagated from an input geometry to an output geometry.
|
||||
*/
|
||||
struct PropagateRelation {
|
||||
int from_geometry_input;
|
||||
int to_geometry_output;
|
||||
|
||||
friend bool operator==(const PropagateRelation &a, const PropagateRelation &b)
|
||||
{
|
||||
return a.from_geometry_input == b.from_geometry_input &&
|
||||
a.to_geometry_output == b.to_geometry_output;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* References to attributes can be propagated from an input field to an output field.
|
||||
*/
|
||||
struct ReferenceRelation {
|
||||
int from_field_input;
|
||||
int to_field_output;
|
||||
|
||||
friend bool operator==(const ReferenceRelation &a, const ReferenceRelation &b)
|
||||
{
|
||||
return a.from_field_input == b.from_field_input && a.to_field_output == b.to_field_output;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* An input field is evaluated on an input geometry.
|
||||
*/
|
||||
struct EvalRelation {
|
||||
int field_input;
|
||||
int geometry_input;
|
||||
|
||||
friend bool operator==(const EvalRelation &a, const EvalRelation &b)
|
||||
{
|
||||
return a.field_input == b.field_input && a.geometry_input == b.geometry_input;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* An output field is available on an output geometry.
|
||||
*/
|
||||
struct AvailableRelation {
|
||||
int field_output;
|
||||
int geometry_output;
|
||||
|
||||
friend bool operator==(const AvailableRelation &a, const AvailableRelation &b)
|
||||
{
|
||||
return a.field_output == b.field_output && a.geometry_output == b.geometry_output;
|
||||
}
|
||||
};
|
||||
|
||||
struct RelationsInNode {
|
||||
Vector<PropagateRelation> propagate_relations;
|
||||
Vector<ReferenceRelation> reference_relations;
|
||||
Vector<EvalRelation> eval_relations;
|
||||
Vector<AvailableRelation> available_relations;
|
||||
Vector<int> available_on_none;
|
||||
};
|
||||
|
||||
bool operator==(const RelationsInNode &a, const RelationsInNode &b);
|
||||
bool operator!=(const RelationsInNode &a, const RelationsInNode &b);
|
||||
std::ostream &operator<<(std::ostream &stream, const RelationsInNode &relations);
|
||||
|
||||
} // namespace anonymous_attribute_lifetime
|
||||
namespace aal = anonymous_attribute_lifetime;
|
||||
|
||||
using ImplicitInputValueFn = std::function<void(const bNode &node, void *r_value)>;
|
||||
|
||||
/**
|
||||
|
@ -146,9 +216,23 @@ class SocketDeclaration {
|
|||
bool matches_common_data(const bNodeSocket &socket) const;
|
||||
};
|
||||
|
||||
class NodeDeclarationBuilder;
|
||||
|
||||
class BaseSocketDeclarationBuilder {
|
||||
protected:
|
||||
int index_ = -1;
|
||||
bool reference_pass_all_ = false;
|
||||
bool field_on_all_ = false;
|
||||
bool propagate_from_all_ = false;
|
||||
NodeDeclarationBuilder *node_decl_builder_ = nullptr;
|
||||
|
||||
friend class NodeDeclarationBuilder;
|
||||
|
||||
public:
|
||||
virtual ~BaseSocketDeclarationBuilder() = default;
|
||||
|
||||
protected:
|
||||
virtual SocketDeclaration *declaration() = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -225,6 +309,26 @@ class SocketDeclarationBuilder : public BaseSocketDeclarationBuilder {
|
|||
return *(Self *)this;
|
||||
}
|
||||
|
||||
/**
|
||||
* For inputs this means that the input field is evaluated on all geometry inputs. For outputs
|
||||
* it means that this contains an anonymous attribute reference that is available on all geometry
|
||||
* outputs.
|
||||
*/
|
||||
Self &field_on_all()
|
||||
{
|
||||
if (decl_->in_out == SOCK_IN) {
|
||||
this->supports_field();
|
||||
}
|
||||
else {
|
||||
this->field_source();
|
||||
}
|
||||
field_on_all_ = true;
|
||||
return *(Self *)this;
|
||||
}
|
||||
|
||||
/** For inputs that are evaluated or available on a subset of the geometry sockets. */
|
||||
Self &field_on(Span<int> indices);
|
||||
|
||||
/** The input supports a field and is a field by default when nothing is connected. */
|
||||
Self &implicit_field(ImplicitInputValueFn fn)
|
||||
{
|
||||
|
@ -234,6 +338,22 @@ class SocketDeclarationBuilder : public BaseSocketDeclarationBuilder {
|
|||
return *(Self *)this;
|
||||
}
|
||||
|
||||
/** The input is an implicit field that is evaluated on all geometry inputs. */
|
||||
Self &implicit_field_on_all(ImplicitInputValueFn fn)
|
||||
{
|
||||
this->implicit_field(fn);
|
||||
field_on_all_ = true;
|
||||
return *(Self *)this;
|
||||
}
|
||||
|
||||
/** The input is evaluated on a subset of the geometry inputs. */
|
||||
Self &implicit_field_on(ImplicitInputValueFn fn, const Span<int> input_indices)
|
||||
{
|
||||
this->implicit_field(fn);
|
||||
this->field_on(input_indices);
|
||||
return *(Self *)this;
|
||||
}
|
||||
|
||||
/** The output is always a field, regardless of any inputs. */
|
||||
Self &field_source()
|
||||
{
|
||||
|
@ -241,21 +361,55 @@ class SocketDeclarationBuilder : public BaseSocketDeclarationBuilder {
|
|||
return *(Self *)this;
|
||||
}
|
||||
|
||||
/** The output is a field if any of the inputs is a field. */
|
||||
/** The output is a field if any of the inputs are a field. */
|
||||
Self &dependent_field()
|
||||
{
|
||||
decl_->output_field_dependency = OutputFieldDependency::ForDependentField();
|
||||
this->reference_pass_all();
|
||||
return *(Self *)this;
|
||||
}
|
||||
|
||||
/** The output is a field if any of the inputs with indices in the given list is a field. */
|
||||
Self &dependent_field(Vector<int> input_dependencies)
|
||||
{
|
||||
this->reference_pass(input_dependencies);
|
||||
decl_->output_field_dependency = OutputFieldDependency::ForPartiallyDependentField(
|
||||
std::move(input_dependencies));
|
||||
return *(Self *)this;
|
||||
}
|
||||
|
||||
/**
|
||||
* For outputs that combine all input fields into a new field. The output is a field even if none
|
||||
* of the inputs is a field.
|
||||
*/
|
||||
Self &field_source_reference_all()
|
||||
{
|
||||
this->field_source();
|
||||
this->reference_pass_all();
|
||||
return *(Self *)this;
|
||||
}
|
||||
|
||||
/**
|
||||
* For outputs that combine a subset of input fields into a new field.
|
||||
*/
|
||||
Self &reference_pass(Span<int> input_indices);
|
||||
|
||||
/**
|
||||
* For outputs that combine all input fields into a new field.
|
||||
*/
|
||||
Self &reference_pass_all()
|
||||
{
|
||||
reference_pass_all_ = true;
|
||||
return *(Self *)this;
|
||||
}
|
||||
|
||||
/** Attributes from the all geometry inputs can be propagated. */
|
||||
Self &propagate_all()
|
||||
{
|
||||
propagate_from_all_ = true;
|
||||
return *(Self *)this;
|
||||
}
|
||||
|
||||
/** The priority of the input for determining the domain of the node. See
|
||||
* realtime_compositor::InputDescriptor for more information. */
|
||||
Self &compositor_domain_priority(int priority)
|
||||
|
@ -291,6 +445,12 @@ class SocketDeclarationBuilder : public BaseSocketDeclarationBuilder {
|
|||
decl_->make_available_fn_ = std::move(fn);
|
||||
return *(Self *)this;
|
||||
}
|
||||
|
||||
protected:
|
||||
SocketDeclaration *declaration() override
|
||||
{
|
||||
return decl_;
|
||||
}
|
||||
};
|
||||
|
||||
using SocketDeclarationPtr = std::unique_ptr<SocketDeclaration>;
|
||||
|
@ -299,19 +459,26 @@ class NodeDeclaration {
|
|||
public:
|
||||
Vector<SocketDeclarationPtr> inputs;
|
||||
Vector<SocketDeclarationPtr> outputs;
|
||||
std::unique_ptr<aal::RelationsInNode> anonymous_attribute_relations_;
|
||||
|
||||
friend NodeDeclarationBuilder;
|
||||
|
||||
bool matches(const bNode &node) const;
|
||||
Span<SocketDeclarationPtr> sockets(eNodeSocketInOut in_out) const;
|
||||
|
||||
const aal::RelationsInNode *anonymous_attribute_relations() const
|
||||
{
|
||||
return anonymous_attribute_relations_.get();
|
||||
}
|
||||
|
||||
MEM_CXX_CLASS_ALLOC_FUNCS("NodeDeclaration")
|
||||
};
|
||||
|
||||
class NodeDeclarationBuilder {
|
||||
private:
|
||||
NodeDeclaration &declaration_;
|
||||
Vector<std::unique_ptr<BaseSocketDeclarationBuilder>> builders_;
|
||||
Vector<std::unique_ptr<BaseSocketDeclarationBuilder>> input_builders_;
|
||||
Vector<std::unique_ptr<BaseSocketDeclarationBuilder>> output_builders_;
|
||||
bool is_function_node_ = false;
|
||||
|
||||
public:
|
||||
|
@ -333,6 +500,14 @@ class NodeDeclarationBuilder {
|
|||
template<typename DeclType>
|
||||
typename DeclType::Builder &add_output(StringRef name, StringRef identifier = "");
|
||||
|
||||
aal::RelationsInNode &get_anonymous_attribute_relations()
|
||||
{
|
||||
if (!declaration_.anonymous_attribute_relations_) {
|
||||
declaration_.anonymous_attribute_relations_ = std::make_unique<aal::RelationsInNode>();
|
||||
}
|
||||
return *declaration_.anonymous_attribute_relations_;
|
||||
}
|
||||
|
||||
private:
|
||||
template<typename DeclType>
|
||||
typename DeclType::Builder &add_socket(StringRef name,
|
||||
|
@ -349,6 +524,44 @@ void id_or_index(const bNode &node, void *r_value);
|
|||
|
||||
void build_node_declaration(const bNodeType &typeinfo, NodeDeclaration &r_declaration);
|
||||
|
||||
template<typename SocketDecl>
|
||||
typename SocketDeclarationBuilder<SocketDecl>::Self &SocketDeclarationBuilder<
|
||||
SocketDecl>::reference_pass(const Span<int> input_indices)
|
||||
{
|
||||
aal::RelationsInNode &relations = node_decl_builder_->get_anonymous_attribute_relations();
|
||||
for (const int from_input : input_indices) {
|
||||
aal::ReferenceRelation relation;
|
||||
relation.from_field_input = from_input;
|
||||
relation.to_field_output = index_;
|
||||
relations.reference_relations.append(relation);
|
||||
}
|
||||
return *(Self *)this;
|
||||
}
|
||||
|
||||
template<typename SocketDecl>
|
||||
typename SocketDeclarationBuilder<SocketDecl>::Self &SocketDeclarationBuilder<
|
||||
SocketDecl>::field_on(const Span<int> indices)
|
||||
{
|
||||
aal::RelationsInNode &relations = node_decl_builder_->get_anonymous_attribute_relations();
|
||||
if (decl_->in_out == SOCK_IN) {
|
||||
for (const int input_index : indices) {
|
||||
aal::EvalRelation relation;
|
||||
relation.field_input = index_;
|
||||
relation.geometry_input = input_index;
|
||||
relations.eval_relations.append(relation);
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (const int output_index : indices) {
|
||||
aal::AvailableRelation relation;
|
||||
relation.field_output = index_;
|
||||
relation.geometry_output = output_index;
|
||||
relations.available_relations.append(relation);
|
||||
}
|
||||
}
|
||||
return *(Self *)this;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name #OutputFieldDependency Inline Methods
|
||||
* \{ */
|
||||
|
@ -490,12 +703,15 @@ inline typename DeclType::Builder &NodeDeclarationBuilder::add_socket(StringRef
|
|||
std::unique_ptr<DeclType> socket_decl = std::make_unique<DeclType>();
|
||||
std::unique_ptr<Builder> socket_decl_builder = std::make_unique<Builder>();
|
||||
socket_decl_builder->decl_ = &*socket_decl;
|
||||
|
||||
socket_decl_builder->node_decl_builder_ = this;
|
||||
socket_decl->name = name;
|
||||
socket_decl->identifier = identifier.is_empty() ? name : identifier;
|
||||
socket_decl->in_out = in_out;
|
||||
declarations.append(std::move(socket_decl));
|
||||
socket_decl_builder->index_ = declarations.append_and_get_index(std::move(socket_decl));
|
||||
Builder &socket_decl_builder_ref = *socket_decl_builder;
|
||||
builders_.append(std::move(socket_decl_builder));
|
||||
((in_out == SOCK_IN) ? input_builders_ : output_builders_)
|
||||
.append(std::move(socket_decl_builder));
|
||||
return socket_decl_builder_ref;
|
||||
}
|
||||
|
||||
|
|
|
@ -195,7 +195,7 @@ class BokehBlurOperation : public NodeOperation {
|
|||
|
||||
int get_max_size()
|
||||
{
|
||||
return static_cast<int>(bnode().custom4);
|
||||
return int(bnode().custom4);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -459,29 +459,29 @@ class GlareOperation : public NodeOperation {
|
|||
return 1.0f - std::pow(get_color_modulation_factor(), iteration + 1);
|
||||
}
|
||||
|
||||
/* Streaks are computed by iteratively applying a filter that samples 3 neighbouring pixels in
|
||||
* the direction of the streak. Those neighbouring pixels are then combined using a weighted sum.
|
||||
* The weights of the neighbours are the fade factors computed by this method. Farther neighbours
|
||||
/* Streaks are computed by iteratively applying a filter that samples 3 neighboring pixels in
|
||||
* the direction of the streak. Those neighboring pixels are then combined using a weighted sum.
|
||||
* The weights of the neighbors are the fade factors computed by this method. Farther neighbors
|
||||
* are expected to have lower weights because they contribute less to the combined result. Since
|
||||
* the iteration magnitude represents how far the neighbours are, as noted in the description of
|
||||
* the compute_streak_iteration_magnitude method, the fade factor for the closest neighbour is
|
||||
* the iteration magnitude represents how far the neighbors are, as noted in the description of
|
||||
* the compute_streak_iteration_magnitude method, the fade factor for the closest neighbor is
|
||||
* computed as the user supplied fade parameter raised to the power of the magnitude, noting that
|
||||
* the fade value is in the [0, 1] range while the magnitude is larger than or equal one, so the
|
||||
* higher the power the lower the resulting fade factor. Furthermore, the other two neighbours
|
||||
* are just squared and cubed versions of the fade factor for the closest neighbour to get even
|
||||
* lower fade factors for those farther neighbours. */
|
||||
* higher the power the lower the resulting fade factor. Furthermore, the other two neighbors
|
||||
* are just squared and cubed versions of the fade factor for the closest neighbor to get even
|
||||
* lower fade factors for those farther neighbors. */
|
||||
float3 compute_streak_fade_factors(float iteration_magnitude)
|
||||
{
|
||||
const float fade_factor = std::pow(node_storage(bnode()).fade, iteration_magnitude);
|
||||
return float3(fade_factor, std::pow(fade_factor, 2.0f), std::pow(fade_factor, 3.0f));
|
||||
}
|
||||
|
||||
/* Streaks are computed by iteratively applying a filter that samples the neighbouring pixels in
|
||||
/* Streaks are computed by iteratively applying a filter that samples the neighboring pixels in
|
||||
* the direction of the streak. Each higher iteration samples pixels that are farther away, the
|
||||
* magnitude computed by this method describes how farther away the neighbours are sampled. The
|
||||
* magnitude computed by this method describes how farther away the neighbors are sampled. The
|
||||
* magnitude exponentially increase with the iteration. A base of 4, was chosen as compromise
|
||||
* between better quality and performance, since a lower base corresponds to more tightly spaced
|
||||
* neighbours but would require more iterations to produce a streak of the same length. */
|
||||
* neighbors but would require more iterations to produce a streak of the same length. */
|
||||
float compute_streak_iteration_magnitude(int iteration)
|
||||
{
|
||||
return std::pow(4.0f, iteration);
|
||||
|
|
|
@ -40,33 +40,33 @@ static void node_declare(NodeDeclarationBuilder &b)
|
|||
N_("An index used to group values together for multiple separate accumulations"));
|
||||
|
||||
b.add_output<decl::Vector>(N_("Leading"), "Leading Vector")
|
||||
.field_source()
|
||||
.field_source_reference_all()
|
||||
.description(N_(leading_out_description));
|
||||
b.add_output<decl::Float>(N_("Leading"), "Leading Float")
|
||||
.field_source()
|
||||
.field_source_reference_all()
|
||||
.description(N_(leading_out_description));
|
||||
b.add_output<decl::Int>(N_("Leading"), "Leading Int")
|
||||
.field_source()
|
||||
.field_source_reference_all()
|
||||
.description(N_(leading_out_description));
|
||||
|
||||
b.add_output<decl::Vector>(N_("Trailing"), "Trailing Vector")
|
||||
.field_source()
|
||||
.field_source_reference_all()
|
||||
.description(N_(trailing_out_description));
|
||||
b.add_output<decl::Float>(N_("Trailing"), "Trailing Float")
|
||||
.field_source()
|
||||
.field_source_reference_all()
|
||||
.description(N_(trailing_out_description));
|
||||
b.add_output<decl::Int>(N_("Trailing"), "Trailing Int")
|
||||
.field_source()
|
||||
.field_source_reference_all()
|
||||
.description(N_(trailing_out_description));
|
||||
|
||||
b.add_output<decl::Vector>(N_("Total"), "Total Vector")
|
||||
.field_source()
|
||||
.field_source_reference_all()
|
||||
.description(N_(total_out_description));
|
||||
b.add_output<decl::Float>(N_("Total"), "Total Float")
|
||||
.field_source()
|
||||
.field_source_reference_all()
|
||||
.description(N_(total_out_description));
|
||||
b.add_output<decl::Int>(N_("Total"), "Total Int")
|
||||
.field_source()
|
||||
.field_source_reference_all()
|
||||
.description(N_(total_out_description));
|
||||
}
|
||||
|
||||
|
|
|
@ -16,18 +16,18 @@ NODE_STORAGE_FUNCS(NodeGeometryAttributeCapture)
|
|||
static void node_declare(NodeDeclarationBuilder &b)
|
||||
{
|
||||
b.add_input<decl::Geometry>(N_("Geometry"));
|
||||
b.add_input<decl::Vector>(N_("Value")).supports_field();
|
||||
b.add_input<decl::Float>(N_("Value"), "Value_001").supports_field();
|
||||
b.add_input<decl::Color>(N_("Value"), "Value_002").supports_field();
|
||||
b.add_input<decl::Bool>(N_("Value"), "Value_003").supports_field();
|
||||
b.add_input<decl::Int>(N_("Value"), "Value_004").supports_field();
|
||||
b.add_input<decl::Vector>(N_("Value")).field_on_all();
|
||||
b.add_input<decl::Float>(N_("Value"), "Value_001").field_on_all();
|
||||
b.add_input<decl::Color>(N_("Value"), "Value_002").field_on_all();
|
||||
b.add_input<decl::Bool>(N_("Value"), "Value_003").field_on_all();
|
||||
b.add_input<decl::Int>(N_("Value"), "Value_004").field_on_all();
|
||||
|
||||
b.add_output<decl::Geometry>(N_("Geometry"));
|
||||
b.add_output<decl::Vector>(N_("Attribute")).field_source();
|
||||
b.add_output<decl::Float>(N_("Attribute"), "Attribute_001").field_source();
|
||||
b.add_output<decl::Color>(N_("Attribute"), "Attribute_002").field_source();
|
||||
b.add_output<decl::Bool>(N_("Attribute"), "Attribute_003").field_source();
|
||||
b.add_output<decl::Int>(N_("Attribute"), "Attribute_004").field_source();
|
||||
b.add_output<decl::Geometry>(N_("Geometry")).propagate_all();
|
||||
b.add_output<decl::Vector>(N_("Attribute")).field_on_all();
|
||||
b.add_output<decl::Float>(N_("Attribute"), "Attribute_001").field_on_all();
|
||||
b.add_output<decl::Color>(N_("Attribute"), "Attribute_002").field_on_all();
|
||||
b.add_output<decl::Bool>(N_("Attribute"), "Attribute_003").field_on_all();
|
||||
b.add_output<decl::Int>(N_("Attribute"), "Attribute_004").field_on_all();
|
||||
}
|
||||
|
||||
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
||||
|
|
|
@ -17,9 +17,9 @@ namespace blender::nodes::node_geo_attribute_statistic_cc {
|
|||
static void node_declare(NodeDeclarationBuilder &b)
|
||||
{
|
||||
b.add_input<decl::Geometry>(N_("Geometry"));
|
||||
b.add_input<decl::Bool>(N_("Selection")).default_value(true).supports_field().hide_value();
|
||||
b.add_input<decl::Float>(N_("Attribute")).hide_value().supports_field();
|
||||
b.add_input<decl::Vector>(N_("Attribute"), "Attribute_001").hide_value().supports_field();
|
||||
b.add_input<decl::Bool>(N_("Selection")).default_value(true).field_on_all().hide_value();
|
||||
b.add_input<decl::Float>(N_("Attribute")).hide_value().field_on_all();
|
||||
b.add_input<decl::Vector>(N_("Attribute"), "Attribute_001").hide_value().field_on_all();
|
||||
|
||||
b.add_output<decl::Float>(N_("Mean"));
|
||||
b.add_output<decl::Float>(N_("Median"));
|
||||
|
|
|
@ -58,10 +58,16 @@ static void node_declare(NodeDeclarationBuilder &b)
|
|||
.supports_field()
|
||||
.description(N_("Relative mix weight of neighboring elements"));
|
||||
|
||||
b.add_output<decl::Float>(N_("Value"), "Value_Float").field_source().dependent_field();
|
||||
b.add_output<decl::Int>(N_("Value"), "Value_Int").field_source().dependent_field();
|
||||
b.add_output<decl::Vector>(N_("Value"), "Value_Vector").field_source().dependent_field();
|
||||
b.add_output<decl::Color>(N_("Value"), "Value_Color").field_source().dependent_field();
|
||||
b.add_output<decl::Float>(N_("Value"), "Value_Float")
|
||||
.field_source_reference_all()
|
||||
.dependent_field();
|
||||
b.add_output<decl::Int>(N_("Value"), "Value_Int").field_source_reference_all().dependent_field();
|
||||
b.add_output<decl::Vector>(N_("Value"), "Value_Vector")
|
||||
.field_source_reference_all()
|
||||
.dependent_field();
|
||||
b.add_output<decl::Color>(N_("Value"), "Value_Color")
|
||||
.field_source_reference_all()
|
||||
.dependent_field();
|
||||
}
|
||||
|
||||
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
||||
|
@ -434,6 +440,12 @@ class BlurAttributeFieldInput final : public bke::GeometryFieldInput {
|
|||
return GVArray::ForGArray(std::move(main_buffer));
|
||||
}
|
||||
|
||||
void for_each_field_input_recursive(FunctionRef<void(const FieldInput &)> fn) const
|
||||
{
|
||||
weight_field_.node().for_each_field_input_recursive(fn);
|
||||
value_field_.node().for_each_field_input_recursive(fn);
|
||||
}
|
||||
|
||||
uint64_t hash() const override
|
||||
{
|
||||
return get_default_hash_3(iterations_, weight_field_, value_field_);
|
||||
|
|
|
@ -20,8 +20,8 @@ static void node_declare(NodeDeclarationBuilder &b)
|
|||
b.add_input<decl::Geometry>(N_("Mesh 2")).multi_input().supported_type(GEO_COMPONENT_TYPE_MESH);
|
||||
b.add_input<decl::Bool>(N_("Self Intersection"));
|
||||
b.add_input<decl::Bool>(N_("Hole Tolerant"));
|
||||
b.add_output<decl::Geometry>(N_("Mesh"));
|
||||
b.add_output<decl::Bool>(N_("Intersecting Edges")).field_source();
|
||||
b.add_output<decl::Geometry>(N_("Mesh")).propagate_all();
|
||||
b.add_output<decl::Bool>(N_("Intersecting Edges")).field_on_all();
|
||||
}
|
||||
|
||||
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
||||
|
|
|
@ -22,7 +22,7 @@ static void node_declare(NodeDeclarationBuilder &b)
|
|||
.supports_field()
|
||||
.description(N_("The amount of points to select from the end of each spline"));
|
||||
b.add_output<decl::Bool>(N_("Selection"))
|
||||
.field_source()
|
||||
.field_source_reference_all()
|
||||
.description(
|
||||
N_("The selection from the start and end of the splines based on the input sizes"));
|
||||
}
|
||||
|
@ -77,6 +77,12 @@ class EndpointFieldInput final : public bke::CurvesFieldInput {
|
|||
return VArray<bool>::ForContainer(std::move(selection));
|
||||
};
|
||||
|
||||
void for_each_field_input_recursive(FunctionRef<void(const FieldInput &)> fn) const
|
||||
{
|
||||
start_size_.node().for_each_field_input_recursive(fn);
|
||||
end_size_.node().for_each_field_input_recursive(fn);
|
||||
}
|
||||
|
||||
uint64_t hash() const override
|
||||
{
|
||||
return get_default_hash_2(start_size_, end_size_);
|
||||
|
|
|
@ -18,18 +18,18 @@ static void node_declare(NodeDeclarationBuilder &b)
|
|||
.default_value(1)
|
||||
.min(1)
|
||||
.max(1000)
|
||||
.supports_field()
|
||||
.field_on_all()
|
||||
.make_available([](bNode &node) { node_storage(node).mode = GEO_NODE_CURVE_FILLET_POLY; });
|
||||
b.add_input<decl::Float>(N_("Radius"))
|
||||
.min(0.0f)
|
||||
.max(FLT_MAX)
|
||||
.subtype(PropertySubType::PROP_DISTANCE)
|
||||
.default_value(0.25f)
|
||||
.supports_field();
|
||||
.field_on_all();
|
||||
b.add_input<decl::Bool>(N_("Limit Radius"))
|
||||
.description(
|
||||
N_("Limit the maximum value of the radius in order to avoid overlapping fillets"));
|
||||
b.add_output<decl::Geometry>(N_("Curve"));
|
||||
b.add_output<decl::Geometry>(N_("Curve")).propagate_all();
|
||||
}
|
||||
|
||||
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
||||
|
|
|
@ -29,7 +29,7 @@ static void node_declare(NodeDeclarationBuilder &b)
|
|||
.description(N_("The counterclockwise rotation of the inner set of points"));
|
||||
b.add_output<decl::Geometry>(N_("Curve"));
|
||||
b.add_output<decl::Bool>(N_("Outer Points"))
|
||||
.field_source()
|
||||
.field_on_all()
|
||||
.description(N_("An attribute field with a selection of the outer points"));
|
||||
}
|
||||
|
||||
|
|
|
@ -16,14 +16,14 @@ NODE_STORAGE_FUNCS(NodeGeometryCurveResample)
|
|||
static void node_declare(NodeDeclarationBuilder &b)
|
||||
{
|
||||
b.add_input<decl::Geometry>(N_("Curve")).supported_type(GEO_COMPONENT_TYPE_CURVE);
|
||||
b.add_input<decl::Bool>(N_("Selection")).default_value(true).supports_field().hide_value();
|
||||
b.add_input<decl::Int>(N_("Count")).default_value(10).min(1).max(100000).supports_field();
|
||||
b.add_input<decl::Bool>(N_("Selection")).default_value(true).field_on_all().hide_value();
|
||||
b.add_input<decl::Int>(N_("Count")).default_value(10).min(1).max(100000).field_on_all();
|
||||
b.add_input<decl::Float>(N_("Length"))
|
||||
.default_value(0.1f)
|
||||
.min(0.01f)
|
||||
.supports_field()
|
||||
.field_on_all()
|
||||
.subtype(PROP_DISTANCE);
|
||||
b.add_output<decl::Geometry>(N_("Curve"));
|
||||
b.add_output<decl::Geometry>(N_("Curve")).propagate_all();
|
||||
}
|
||||
|
||||
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
||||
|
|
|
@ -11,8 +11,8 @@ namespace blender::nodes::node_geo_curve_reverse_cc {
|
|||
static void node_declare(NodeDeclarationBuilder &b)
|
||||
{
|
||||
b.add_input<decl::Geometry>(N_("Curve")).supported_type(GEO_COMPONENT_TYPE_CURVE);
|
||||
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().supports_field();
|
||||
b.add_output<decl::Geometry>(N_("Curve"));
|
||||
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().field_on_all();
|
||||
b.add_output<decl::Geometry>(N_("Curve")).propagate_all();
|
||||
}
|
||||
|
||||
static void node_geo_exec(GeoNodeExecParams params)
|
||||
|
|
|
@ -23,24 +23,24 @@ static void node_declare(NodeDeclarationBuilder &b)
|
|||
.only_realized_data()
|
||||
.supported_type(GEO_COMPONENT_TYPE_CURVE);
|
||||
|
||||
b.add_input<decl::Float>(N_("Value"), "Value_Float").hide_value().supports_field();
|
||||
b.add_input<decl::Int>(N_("Value"), "Value_Int").hide_value().supports_field();
|
||||
b.add_input<decl::Vector>(N_("Value"), "Value_Vector").hide_value().supports_field();
|
||||
b.add_input<decl::Color>(N_("Value"), "Value_Color").hide_value().supports_field();
|
||||
b.add_input<decl::Bool>(N_("Value"), "Value_Bool").hide_value().supports_field();
|
||||
b.add_input<decl::Float>(N_("Value"), "Value_Float").hide_value().field_on_all();
|
||||
b.add_input<decl::Int>(N_("Value"), "Value_Int").hide_value().field_on_all();
|
||||
b.add_input<decl::Vector>(N_("Value"), "Value_Vector").hide_value().field_on_all();
|
||||
b.add_input<decl::Color>(N_("Value"), "Value_Color").hide_value().field_on_all();
|
||||
b.add_input<decl::Bool>(N_("Value"), "Value_Bool").hide_value().field_on_all();
|
||||
|
||||
b.add_input<decl::Float>(N_("Factor"))
|
||||
.min(0.0f)
|
||||
.max(1.0f)
|
||||
.subtype(PROP_FACTOR)
|
||||
.supports_field()
|
||||
.field_on_all()
|
||||
.make_available([](bNode &node) { node_storage(node).mode = GEO_NODE_CURVE_SAMPLE_FACTOR; });
|
||||
b.add_input<decl::Float>(N_("Length"))
|
||||
.min(0.0f)
|
||||
.subtype(PROP_DISTANCE)
|
||||
.supports_field()
|
||||
.field_on_all()
|
||||
.make_available([](bNode &node) { node_storage(node).mode = GEO_NODE_CURVE_SAMPLE_LENGTH; });
|
||||
b.add_input<decl::Int>(N_("Curve Index")).supports_field().make_available([](bNode &node) {
|
||||
b.add_input<decl::Int>(N_("Curve Index")).field_on_all().make_available([](bNode &node) {
|
||||
node_storage(node).use_all_curves = false;
|
||||
});
|
||||
|
||||
|
|
|
@ -16,8 +16,8 @@ NODE_STORAGE_FUNCS(NodeGeometryCurveSetHandles)
|
|||
static void node_declare(NodeDeclarationBuilder &b)
|
||||
{
|
||||
b.add_input<decl::Geometry>(N_("Curve")).supported_type(GEO_COMPONENT_TYPE_CURVE);
|
||||
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().supports_field();
|
||||
b.add_output<decl::Geometry>(N_("Curve"));
|
||||
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().field_on_all();
|
||||
b.add_output<decl::Geometry>(N_("Curve")).propagate_all();
|
||||
}
|
||||
|
||||
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
||||
|
|
|
@ -16,8 +16,8 @@ NODE_STORAGE_FUNCS(NodeGeometryCurveSplineType)
|
|||
static void node_declare(NodeDeclarationBuilder &b)
|
||||
{
|
||||
b.add_input<decl::Geometry>(N_("Curve")).supported_type(GEO_COMPONENT_TYPE_CURVE);
|
||||
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().supports_field();
|
||||
b.add_output<decl::Geometry>(N_("Curve"));
|
||||
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().field_on_all();
|
||||
b.add_output<decl::Geometry>(N_("Curve")).propagate_all();
|
||||
}
|
||||
|
||||
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
||||
|
|
|
@ -18,10 +18,10 @@ static void node_declare(NodeDeclarationBuilder &b)
|
|||
.default_value(1)
|
||||
.min(0)
|
||||
.max(1000)
|
||||
.supports_field()
|
||||
.field_on_all()
|
||||
.description(
|
||||
N_("The number of control points to create on the segment following each point"));
|
||||
b.add_output<decl::Geometry>(N_("Curve"));
|
||||
b.add_output<decl::Geometry>(N_("Curve")).propagate_all();
|
||||
}
|
||||
|
||||
static void node_geo_exec(GeoNodeExecParams params)
|
||||
|
|
|
@ -20,7 +20,7 @@ static void node_declare(NodeDeclarationBuilder &b)
|
|||
b.add_input<decl::Bool>(N_("Fill Caps"))
|
||||
.description(
|
||||
N_("If the profile spline is cyclic, fill the ends of the generated mesh with N-gons"));
|
||||
b.add_output<decl::Geometry>(N_("Mesh"));
|
||||
b.add_output<decl::Geometry>(N_("Mesh")).propagate_all();
|
||||
}
|
||||
|
||||
static void geometry_set_curve_to_mesh(GeometrySet &geometry_set,
|
||||
|
|
|
@ -34,10 +34,10 @@ static void node_declare(NodeDeclarationBuilder &b)
|
|||
.subtype(PROP_DISTANCE)
|
||||
.make_available(
|
||||
[](bNode &node) { node_storage(node).mode = GEO_NODE_CURVE_RESAMPLE_LENGTH; });
|
||||
b.add_output<decl::Geometry>(N_("Points"));
|
||||
b.add_output<decl::Vector>(N_("Tangent")).field_source();
|
||||
b.add_output<decl::Vector>(N_("Normal")).field_source();
|
||||
b.add_output<decl::Vector>(N_("Rotation")).field_source();
|
||||
b.add_output<decl::Geometry>(N_("Points")).propagate_all();
|
||||
b.add_output<decl::Vector>(N_("Tangent")).field_on_all();
|
||||
b.add_output<decl::Vector>(N_("Normal")).field_on_all();
|
||||
b.add_output<decl::Vector>(N_("Rotation")).field_on_all();
|
||||
}
|
||||
|
||||
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
||||
|
|
|
@ -12,10 +12,10 @@ static void node_declare(NodeDeclarationBuilder &b)
|
|||
.implicit_field(implicit_field_inputs::index)
|
||||
.description(N_("The control point to retrieve data from"));
|
||||
b.add_output<decl::Int>(N_("Curve Index"))
|
||||
.dependent_field()
|
||||
.field_source_reference_all()
|
||||
.description(N_("The curve the control point is part of"));
|
||||
b.add_output<decl::Int>(N_("Index in Curve"))
|
||||
.dependent_field()
|
||||
.field_source_reference_all()
|
||||
.description(N_("How far along the control point is along its curve"));
|
||||
}
|
||||
|
||||
|
|
|
@ -22,10 +22,11 @@ static void node_declare(NodeDeclarationBuilder &b)
|
|||
.supports_field()
|
||||
.description(N_("Which of the sorted points to output"));
|
||||
b.add_output<decl::Int>(N_("Point Index"))
|
||||
.dependent_field()
|
||||
.field_source_reference_all()
|
||||
.description(N_("A point of the curve, chosen by the sort index"));
|
||||
b.add_output<decl::Int>(N_("Total"))
|
||||
.dependent_field()
|
||||
.field_source()
|
||||
.reference_pass({0})
|
||||
.description(N_("The number of points in the curve"));
|
||||
}
|
||||
|
||||
|
@ -100,6 +101,13 @@ class PointsOfCurveInput final : public bke::CurvesFieldInput {
|
|||
return VArray<int>::ForContainer(std::move(point_of_curve));
|
||||
}
|
||||
|
||||
void for_each_field_input_recursive(FunctionRef<void(const FieldInput &)> fn) const
|
||||
{
|
||||
curve_index_.node().for_each_field_input_recursive(fn);
|
||||
sort_index_.node().for_each_field_input_recursive(fn);
|
||||
sort_weight_.node().for_each_field_input_recursive(fn);
|
||||
}
|
||||
|
||||
uint64_t hash() const override
|
||||
{
|
||||
return 26978695677882;
|
||||
|
|
|
@ -25,26 +25,26 @@ static void node_declare(NodeDeclarationBuilder &b)
|
|||
.max(1.0f)
|
||||
.subtype(PROP_FACTOR)
|
||||
.make_available([](bNode &node) { node_storage(node).mode = GEO_NODE_CURVE_SAMPLE_FACTOR; })
|
||||
.supports_field();
|
||||
.field_on_all();
|
||||
b.add_input<decl::Float>(N_("End"))
|
||||
.min(0.0f)
|
||||
.max(1.0f)
|
||||
.default_value(1.0f)
|
||||
.subtype(PROP_FACTOR)
|
||||
.make_available([](bNode &node) { node_storage(node).mode = GEO_NODE_CURVE_SAMPLE_FACTOR; })
|
||||
.supports_field();
|
||||
.field_on_all();
|
||||
b.add_input<decl::Float>(N_("Start"), "Start_001")
|
||||
.min(0.0f)
|
||||
.subtype(PROP_DISTANCE)
|
||||
.make_available([](bNode &node) { node_storage(node).mode = GEO_NODE_CURVE_SAMPLE_LENGTH; })
|
||||
.supports_field();
|
||||
.field_on_all();
|
||||
b.add_input<decl::Float>(N_("End"), "End_001")
|
||||
.min(0.0f)
|
||||
.default_value(1.0f)
|
||||
.subtype(PROP_DISTANCE)
|
||||
.make_available([](bNode &node) { node_storage(node).mode = GEO_NODE_CURVE_SAMPLE_LENGTH; })
|
||||
.supports_field();
|
||||
b.add_output<decl::Geometry>(N_("Curve"));
|
||||
.field_on_all();
|
||||
b.add_output<decl::Geometry>(N_("Curve")).propagate_all();
|
||||
}
|
||||
|
||||
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
||||
|
|
|
@ -38,7 +38,7 @@ NODE_STORAGE_FUNCS(NodeGeometryCurveTrim)
|
|||
static void node_declare(NodeDeclarationBuilder &b)
|
||||
{
|
||||
b.add_input<decl::Geometry>(N_("Curves")).supported_type(GEO_COMPONENT_TYPE_CURVE);
|
||||
b.add_output<decl::Geometry>(N_("Curves"));
|
||||
b.add_output<decl::Geometry>(N_("Curves")).propagate_all();
|
||||
}
|
||||
|
||||
static void deform_curves(const CurvesGeometry &curves,
|
||||
|
|
|
@ -1112,9 +1112,9 @@ static void node_declare(NodeDeclarationBuilder &b)
|
|||
b.add_input<decl::Bool>(N_("Selection"))
|
||||
.default_value(true)
|
||||
.hide_value()
|
||||
.supports_field()
|
||||
.field_on_all()
|
||||
.description(N_("The parts of the geometry to be deleted"));
|
||||
b.add_output<decl::Geometry>(N_("Geometry"));
|
||||
b.add_output<decl::Geometry>(N_("Geometry")).propagate_all();
|
||||
}
|
||||
|
||||
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
||||
|
|
|
@ -46,7 +46,7 @@ static void node_declare(NodeDeclarationBuilder &b)
|
|||
.min(0.0f)
|
||||
.max(FLT_MAX)
|
||||
.description(N_("Minimum density of a volume cell to contain a grid point"));
|
||||
b.add_output<decl::Geometry>(N_("Points"));
|
||||
b.add_output<decl::Geometry>(N_("Points")).propagate_all();
|
||||
}
|
||||
|
||||
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
||||
|
|
|
@ -34,7 +34,7 @@ static void node_declare(NodeDeclarationBuilder &b)
|
|||
};
|
||||
|
||||
b.add_input<decl::Geometry>(N_("Mesh")).supported_type(GEO_COMPONENT_TYPE_MESH);
|
||||
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().supports_field();
|
||||
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().field_on_all();
|
||||
b.add_input<decl::Float>(N_("Distance Min"))
|
||||
.min(0.0f)
|
||||
.subtype(PROP_DISTANCE)
|
||||
|
@ -46,20 +46,20 @@ static void node_declare(NodeDeclarationBuilder &b)
|
|||
b.add_input<decl::Float>(N_("Density"))
|
||||
.default_value(10.0f)
|
||||
.min(0.0f)
|
||||
.supports_field()
|
||||
.field_on_all()
|
||||
.make_available(enable_random);
|
||||
b.add_input<decl::Float>(N_("Density Factor"))
|
||||
.default_value(1.0f)
|
||||
.min(0.0f)
|
||||
.max(1.0f)
|
||||
.subtype(PROP_FACTOR)
|
||||
.supports_field()
|
||||
.field_on_all()
|
||||
.make_available(enable_poisson);
|
||||
b.add_input<decl::Int>(N_("Seed"));
|
||||
|
||||
b.add_output<decl::Geometry>(N_("Points"));
|
||||
b.add_output<decl::Vector>(N_("Normal")).field_source();
|
||||
b.add_output<decl::Vector>(N_("Rotation")).subtype(PROP_EULER).field_source();
|
||||
b.add_output<decl::Geometry>(N_("Points")).propagate_all();
|
||||
b.add_output<decl::Vector>(N_("Normal")).field_on_all();
|
||||
b.add_output<decl::Vector>(N_("Rotation")).subtype(PROP_EULER).field_on_all();
|
||||
}
|
||||
|
||||
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
||||
|
|
|
@ -22,7 +22,7 @@ static void node_declare(NodeDeclarationBuilder &b)
|
|||
.description(
|
||||
"Keep non-manifold boundaries of the input mesh in place by avoiding the dual "
|
||||
"transformation there");
|
||||
b.add_output<decl::Geometry>("Dual Mesh");
|
||||
b.add_output<decl::Geometry>("Dual Mesh").propagate_all();
|
||||
}
|
||||
|
||||
enum class EdgeType : int8_t {
|
||||
|
|
|
@ -28,17 +28,18 @@ NODE_STORAGE_FUNCS(NodeGeometryDuplicateElements);
|
|||
static void node_declare(NodeDeclarationBuilder &b)
|
||||
{
|
||||
b.add_input<decl::Geometry>(N_("Geometry"));
|
||||
b.add_input<decl::Bool>(N_("Selection")).hide_value().default_value(true).supports_field();
|
||||
b.add_input<decl::Bool>(N_("Selection")).hide_value().default_value(true).field_on_all();
|
||||
b.add_input<decl::Int>(N_("Amount"))
|
||||
.min(0)
|
||||
.default_value(1)
|
||||
.supports_field()
|
||||
.field_on_all()
|
||||
.description(N_("The number of duplicates to create for each element"));
|
||||
|
||||
b.add_output<decl::Geometry>(N_("Geometry"))
|
||||
.propagate_all()
|
||||
.description(N_("The duplicated geometry, not including the original geometry"));
|
||||
b.add_output<decl::Int>(N_("Duplicate Index"))
|
||||
.field_source()
|
||||
.field_on_all()
|
||||
.description(N_("The indices of the duplicates for each element"));
|
||||
}
|
||||
|
||||
|
|
|
@ -13,9 +13,9 @@ namespace blender::nodes::node_geo_edge_paths_to_curves_cc {
|
|||
static void node_declare(NodeDeclarationBuilder &b)
|
||||
{
|
||||
b.add_input<decl::Geometry>(N_("Mesh")).supported_type(GEO_COMPONENT_TYPE_MESH);
|
||||
b.add_input<decl::Bool>(N_("Start Vertices")).default_value(true).hide_value().supports_field();
|
||||
b.add_input<decl::Int>(N_("Next Vertex Index")).default_value(-1).hide_value().supports_field();
|
||||
b.add_output<decl::Geometry>(N_("Curves"));
|
||||
b.add_input<decl::Bool>(N_("Start Vertices")).default_value(true).hide_value().field_on_all();
|
||||
b.add_input<decl::Int>(N_("Next Vertex Index")).default_value(-1).hide_value().field_on_all();
|
||||
b.add_output<decl::Geometry>(N_("Curves")).propagate_all();
|
||||
}
|
||||
|
||||
static Curves *edge_paths_to_curves_convert(const Mesh &mesh,
|
||||
|
|
|
@ -17,7 +17,7 @@ static void node_declare(NodeDeclarationBuilder &b)
|
|||
{
|
||||
b.add_input<decl::Bool>(N_("Start Vertices")).default_value(true).hide_value().supports_field();
|
||||
b.add_input<decl::Int>(N_("Next Vertex Index")).default_value(-1).hide_value().supports_field();
|
||||
b.add_output<decl::Bool>(N_("Selection")).field_source();
|
||||
b.add_output<decl::Bool>(N_("Selection")).field_source_reference_all();
|
||||
}
|
||||
|
||||
static void edge_paths_to_selection(const Mesh &src_mesh,
|
||||
|
@ -92,6 +92,12 @@ class PathToEdgeSelectionFieldInput final : public bke::MeshFieldInput {
|
|||
VArray<bool>::ForContainer(std::move(selection)), ATTR_DOMAIN_EDGE, domain);
|
||||
}
|
||||
|
||||
void for_each_field_input_recursive(FunctionRef<void(const FieldInput &)> fn) const
|
||||
{
|
||||
start_vertices_.node().for_each_field_input_recursive(fn);
|
||||
next_vertex_.node().for_each_field_input_recursive(fn);
|
||||
}
|
||||
|
||||
uint64_t hash() const override
|
||||
{
|
||||
return get_default_hash_2(start_vertices_, next_vertex_);
|
||||
|
|
|
@ -11,8 +11,8 @@ namespace blender::nodes::node_geo_edge_split_cc {
|
|||
static void node_declare(NodeDeclarationBuilder &b)
|
||||
{
|
||||
b.add_input<decl::Geometry>(N_("Mesh")).supported_type(GEO_COMPONENT_TYPE_MESH);
|
||||
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().supports_field();
|
||||
b.add_output<decl::Geometry>(N_("Mesh"));
|
||||
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().field_on_all();
|
||||
b.add_output<decl::Geometry>(N_("Mesh")).propagate_all();
|
||||
}
|
||||
|
||||
static void node_geo_exec(GeoNodeExecParams params)
|
||||
|
|
|
@ -24,16 +24,16 @@ NODE_STORAGE_FUNCS(NodeGeometryExtrudeMesh)
|
|||
static void node_declare(NodeDeclarationBuilder &b)
|
||||
{
|
||||
b.add_input<decl::Geometry>("Mesh").supported_type(GEO_COMPONENT_TYPE_MESH);
|
||||
b.add_input<decl::Bool>(N_("Selection")).default_value(true).supports_field().hide_value();
|
||||
b.add_input<decl::Bool>(N_("Selection")).default_value(true).field_on_all().hide_value();
|
||||
b.add_input<decl::Vector>(N_("Offset"))
|
||||
.subtype(PROP_TRANSLATION)
|
||||
.implicit_field(implicit_field_inputs::normal)
|
||||
.hide_value();
|
||||
b.add_input<decl::Float>(N_("Offset Scale")).default_value(1.0f).supports_field();
|
||||
b.add_input<decl::Float>(N_("Offset Scale")).default_value(1.0f).field_on_all();
|
||||
b.add_input<decl::Bool>(N_("Individual")).default_value(true);
|
||||
b.add_output<decl::Geometry>("Mesh");
|
||||
b.add_output<decl::Bool>(N_("Top")).field_source();
|
||||
b.add_output<decl::Bool>(N_("Side")).field_source();
|
||||
b.add_output<decl::Geometry>("Mesh").propagate_all();
|
||||
b.add_output<decl::Bool>(N_("Top")).field_on_all();
|
||||
b.add_output<decl::Bool>(N_("Side")).field_on_all();
|
||||
}
|
||||
|
||||
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
||||
|
|
|
@ -80,11 +80,11 @@ static void node_declare(NodeDeclarationBuilder &b)
|
|||
b.add_input<decl::Color>(N_("Value"), "Value_Color").hide_value().supports_field();
|
||||
b.add_input<decl::Bool>(N_("Value"), "Value_Bool").hide_value().supports_field();
|
||||
|
||||
b.add_output<decl::Float>(N_("Value"), "Value_Float").field_source();
|
||||
b.add_output<decl::Int>(N_("Value"), "Value_Int").field_source();
|
||||
b.add_output<decl::Vector>(N_("Value"), "Value_Vector").field_source();
|
||||
b.add_output<decl::Color>(N_("Value"), "Value_Color").field_source();
|
||||
b.add_output<decl::Bool>(N_("Value"), "Value_Bool").field_source();
|
||||
b.add_output<decl::Float>(N_("Value"), "Value_Float").field_source_reference_all();
|
||||
b.add_output<decl::Int>(N_("Value"), "Value_Int").field_source_reference_all();
|
||||
b.add_output<decl::Vector>(N_("Value"), "Value_Vector").field_source_reference_all();
|
||||
b.add_output<decl::Color>(N_("Value"), "Value_Color").field_source_reference_all();
|
||||
b.add_output<decl::Bool>(N_("Value"), "Value_Bool").field_source_reference_all();
|
||||
}
|
||||
|
||||
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
||||
|
|
|
@ -15,8 +15,8 @@ namespace blender::nodes::node_geo_flip_faces_cc {
|
|||
static void node_declare(NodeDeclarationBuilder &b)
|
||||
{
|
||||
b.add_input<decl::Geometry>(N_("Mesh")).supported_type(GEO_COMPONENT_TYPE_MESH);
|
||||
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().supports_field();
|
||||
b.add_output<decl::Geometry>(N_("Mesh"));
|
||||
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().field_on_all();
|
||||
b.add_output<decl::Geometry>(N_("Mesh")).propagate_all();
|
||||
}
|
||||
|
||||
static void mesh_flip_faces(Mesh &mesh, const Field<bool> &selection_field)
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace blender::nodes::node_geo_geometry_to_instance_cc {
|
|||
static void node_declare(NodeDeclarationBuilder &b)
|
||||
{
|
||||
b.add_input<decl::Geometry>(N_("Geometry")).multi_input();
|
||||
b.add_output<decl::Geometry>(N_("Instances"));
|
||||
b.add_output<decl::Geometry>(N_("Instances")).propagate_all();
|
||||
}
|
||||
|
||||
static void node_geo_exec(GeoNodeExecParams params)
|
||||
|
|
|
@ -27,8 +27,8 @@ static void node_declare(NodeDeclarationBuilder &b)
|
|||
.implicit_field(implicit_field_inputs::position)
|
||||
.description("Texture coordinates from 0 to 1");
|
||||
b.add_input<decl::Int>(N_("Frame")).min(0).max(MAXFRAMEF);
|
||||
b.add_output<decl::Color>(N_("Color")).no_muted_links().dependent_field();
|
||||
b.add_output<decl::Float>(N_("Alpha")).no_muted_links().dependent_field();
|
||||
b.add_output<decl::Color>(N_("Color")).no_muted_links().dependent_field().reference_pass_all();
|
||||
b.add_output<decl::Float>(N_("Alpha")).no_muted_links().dependent_field().reference_pass_all();
|
||||
}
|
||||
|
||||
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
||||
|
|
|
@ -13,8 +13,8 @@ static void node_declare(NodeDeclarationBuilder &b)
|
|||
.supports_field()
|
||||
.description(N_("Output the handle positions relative to the corresponding control point "
|
||||
"instead of in the local space of the geometry"));
|
||||
b.add_output<decl::Vector>(N_("Left")).field_source();
|
||||
b.add_output<decl::Vector>(N_("Right")).field_source();
|
||||
b.add_output<decl::Vector>(N_("Left")).field_source_reference_all();
|
||||
b.add_output<decl::Vector>(N_("Right")).field_source_reference_all();
|
||||
}
|
||||
|
||||
class HandlePositionFieldInput final : public bke::CurvesFieldInput {
|
||||
|
@ -71,6 +71,11 @@ class HandlePositionFieldInput final : public bke::CurvesFieldInput {
|
|||
VArray<float3>::ForContainer(std::move(output)), ATTR_DOMAIN_POINT, domain);
|
||||
}
|
||||
|
||||
void for_each_field_input_recursive(FunctionRef<void(const FieldInput &)> fn) const
|
||||
{
|
||||
relative_.node().for_each_field_input_recursive(fn);
|
||||
}
|
||||
|
||||
uint64_t hash() const override
|
||||
{
|
||||
return get_default_hash_2(relative_, left_);
|
||||
|
|
|
@ -76,6 +76,11 @@ class PlanarFieldInput final : public bke::MeshFieldInput {
|
|||
VArray<bool>::ForFunc(polys.size(), planar_fn), ATTR_DOMAIN_FACE, domain);
|
||||
}
|
||||
|
||||
void for_each_field_input_recursive(FunctionRef<void(const FieldInput &)> fn) const
|
||||
{
|
||||
threshold_.node().for_each_field_input_recursive(fn);
|
||||
}
|
||||
|
||||
uint64_t hash() const override
|
||||
{
|
||||
/* Some random constant hash. */
|
||||
|
|
|
@ -129,6 +129,12 @@ class ShortestEdgePathsNextVertFieldInput final : public bke::MeshFieldInput {
|
|||
VArray<int>::ForContainer(std::move(next_index)), ATTR_DOMAIN_POINT, domain);
|
||||
}
|
||||
|
||||
void for_each_field_input_recursive(FunctionRef<void(const FieldInput &)> fn) const
|
||||
{
|
||||
end_selection_.node().for_each_field_input_recursive(fn);
|
||||
cost_.node().for_each_field_input_recursive(fn);
|
||||
}
|
||||
|
||||
uint64_t hash() const override
|
||||
{
|
||||
/* Some random constant hash. */
|
||||
|
|
|
@ -19,29 +19,29 @@ namespace blender::nodes::node_geo_instance_on_points_cc {
|
|||
static void node_declare(NodeDeclarationBuilder &b)
|
||||
{
|
||||
b.add_input<decl::Geometry>(N_("Points")).description(N_("Points to instance on"));
|
||||
b.add_input<decl::Bool>(N_("Selection")).default_value(true).supports_field().hide_value();
|
||||
b.add_input<decl::Bool>(N_("Selection")).default_value(true).field_on({0}).hide_value();
|
||||
b.add_input<decl::Geometry>(N_("Instance"))
|
||||
.description(N_("Geometry that is instanced on the points"));
|
||||
b.add_input<decl::Bool>(N_("Pick Instance"))
|
||||
.supports_field()
|
||||
.field_on({0})
|
||||
.description(N_("Choose instances from the \"Instance\" input at each point instead of "
|
||||
"instancing the entire geometry"));
|
||||
b.add_input<decl::Int>(N_("Instance Index"))
|
||||
.implicit_field(implicit_field_inputs::id_or_index)
|
||||
.implicit_field_on(implicit_field_inputs::id_or_index, {0})
|
||||
.description(
|
||||
N_("Index of the instance used for each point. This is only used when Pick Instances "
|
||||
"is on. By default the point index is used"));
|
||||
b.add_input<decl::Vector>(N_("Rotation"))
|
||||
.subtype(PROP_EULER)
|
||||
.supports_field()
|
||||
.field_on({0})
|
||||
.description(N_("Rotation of the instances"));
|
||||
b.add_input<decl::Vector>(N_("Scale"))
|
||||
.default_value({1.0f, 1.0f, 1.0f})
|
||||
.subtype(PROP_XYZ)
|
||||
.supports_field()
|
||||
.field_on({0})
|
||||
.description(N_("Scale of the instances"));
|
||||
|
||||
b.add_output<decl::Geometry>(N_("Instances"));
|
||||
b.add_output<decl::Geometry>(N_("Instances")).propagate_all();
|
||||
}
|
||||
|
||||
static void add_instances_from_component(
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue