@@ -714,7 +714,7 @@ static float3 corner_space_custom_data_to_normal(const CornerNormalSpace &lnor_s
|
||||
return lnor_space.vec_lnor;
|
||||
}
|
||||
|
||||
float3 r_custom_lnor;
|
||||
float3 custom_lnor;
|
||||
|
||||
/* TODO: Check whether using #sincosf() gives any noticeable benefit
|
||||
* (could not even get it working under linux though)! */
|
||||
@@ -724,20 +724,20 @@ static float3 corner_space_custom_data_to_normal(const CornerNormalSpace &lnor_s
|
||||
alphafac;
|
||||
const float betafac = unit_short_to_float(clnor_data[1]);
|
||||
|
||||
mul_v3_v3fl(r_custom_lnor, lnor_space.vec_lnor, cosf(alpha));
|
||||
mul_v3_v3fl(custom_lnor, lnor_space.vec_lnor, cosf(alpha));
|
||||
|
||||
if (betafac == 0.0f) {
|
||||
madd_v3_v3fl(r_custom_lnor, lnor_space.vec_ref, sinf(alpha));
|
||||
madd_v3_v3fl(custom_lnor, lnor_space.vec_ref, sinf(alpha));
|
||||
}
|
||||
else {
|
||||
const float sinalpha = sinf(alpha);
|
||||
const float beta = (betafac > 0.0f ? lnor_space.ref_beta : pi2 - lnor_space.ref_beta) *
|
||||
betafac;
|
||||
madd_v3_v3fl(r_custom_lnor, lnor_space.vec_ref, sinalpha * cosf(beta));
|
||||
madd_v3_v3fl(r_custom_lnor, lnor_space.vec_ortho, sinalpha * sinf(beta));
|
||||
madd_v3_v3fl(custom_lnor, lnor_space.vec_ref, sinalpha * cosf(beta));
|
||||
madd_v3_v3fl(custom_lnor, lnor_space.vec_ortho, sinalpha * sinf(beta));
|
||||
}
|
||||
|
||||
return r_custom_lnor;
|
||||
return custom_lnor;
|
||||
}
|
||||
|
||||
} // namespace blender::bke::mesh
|
||||
@@ -766,7 +766,7 @@ short2 corner_space_custom_normal_to_data(const CornerNormalSpace &lnor_space,
|
||||
return short2(0);
|
||||
}
|
||||
|
||||
short2 r_clnor_data;
|
||||
short2 clnor_data;
|
||||
|
||||
const float pi2 = float(M_PI * 2.0);
|
||||
const float cos_alpha = math::dot(lnor_space.vec_lnor, custom_lnor);
|
||||
@@ -775,10 +775,10 @@ short2 corner_space_custom_normal_to_data(const CornerNormalSpace &lnor_space,
|
||||
if (alpha > lnor_space.ref_alpha) {
|
||||
/* Note we could stick to [0, pi] range here,
|
||||
* but makes decoding more complex, not worth it. */
|
||||
r_clnor_data[0] = unit_float_to_short(-(pi2 - alpha) / (pi2 - lnor_space.ref_alpha));
|
||||
clnor_data[0] = unit_float_to_short(-(pi2 - alpha) / (pi2 - lnor_space.ref_alpha));
|
||||
}
|
||||
else {
|
||||
r_clnor_data[0] = unit_float_to_short(alpha / lnor_space.ref_alpha);
|
||||
clnor_data[0] = unit_float_to_short(alpha / lnor_space.ref_alpha);
|
||||
}
|
||||
|
||||
/* Project custom lnor on (vec_ref, vec_ortho) plane. */
|
||||
@@ -793,17 +793,17 @@ short2 corner_space_custom_normal_to_data(const CornerNormalSpace &lnor_space,
|
||||
}
|
||||
|
||||
if (beta > lnor_space.ref_beta) {
|
||||
r_clnor_data[1] = unit_float_to_short(-(pi2 - beta) / (pi2 - lnor_space.ref_beta));
|
||||
clnor_data[1] = unit_float_to_short(-(pi2 - beta) / (pi2 - lnor_space.ref_beta));
|
||||
}
|
||||
else {
|
||||
r_clnor_data[1] = unit_float_to_short(beta / lnor_space.ref_beta);
|
||||
clnor_data[1] = unit_float_to_short(beta / lnor_space.ref_beta);
|
||||
}
|
||||
}
|
||||
else {
|
||||
r_clnor_data[1] = 0;
|
||||
clnor_data[1] = 0;
|
||||
}
|
||||
|
||||
return r_clnor_data;
|
||||
return clnor_data;
|
||||
}
|
||||
|
||||
} // namespace blender::bke::mesh
|
||||
|
||||
@@ -301,9 +301,9 @@ static blender::int2 convexhull_2d_sorted(const float2 *points,
|
||||
int r_points[])
|
||||
{
|
||||
const int top = convexhull_2d_sorted_impl(points, points_num, r_points);
|
||||
blender::int2 r_points_range = {0, top};
|
||||
convexhull_2d_stack_finalize(points, r_points, r_points_range);
|
||||
return r_points_range;
|
||||
blender::int2 points_range = {0, top};
|
||||
convexhull_2d_stack_finalize(points, r_points, points_range);
|
||||
return points_range;
|
||||
}
|
||||
|
||||
int BLI_convexhull_2d(blender::Span<float2> points, int r_points[])
|
||||
|
||||
@@ -908,20 +908,20 @@ static void fill_sphere_data(int nrings,
|
||||
}
|
||||
for (int r = 1; r < nrings; ++r) {
|
||||
double theta = r * delta_theta;
|
||||
double r_sin_theta;
|
||||
double r_cos_theta;
|
||||
double radius_sin_theta;
|
||||
double radius_cos_theta;
|
||||
if (nrings_even && r == half_nrings) {
|
||||
/* theta = pi/2. */
|
||||
r_sin_theta = radius;
|
||||
r_cos_theta = 0.0;
|
||||
radius_sin_theta = radius;
|
||||
radius_cos_theta = 0.0;
|
||||
}
|
||||
else {
|
||||
r_sin_theta = radius * sin(theta);
|
||||
r_cos_theta = radius * cos(theta);
|
||||
radius_sin_theta = radius * sin(theta);
|
||||
radius_cos_theta = radius * cos(theta);
|
||||
}
|
||||
double x = r_sin_theta * cos_phi + center[0];
|
||||
double y = r_sin_theta * sin_phi + center[1];
|
||||
double z = r_cos_theta + center[2];
|
||||
double x = radius_sin_theta * cos_phi + center[0];
|
||||
double y = radius_sin_theta * sin_phi + center[1];
|
||||
double z = radius_cos_theta + center[2];
|
||||
const Vert *v = arena->add_or_find_vert(mpq3(x, y, z), vid++);
|
||||
vert[vert_index_fn(s, r)] = v;
|
||||
}
|
||||
|
||||
@@ -872,17 +872,17 @@ void bmo_inset_region_exec(BMesh *bm, BMOperator *op)
|
||||
/* comment the first part because we know this verts in a tagged face */
|
||||
if (/* v->e && */ BM_elem_flag_test(v, BM_ELEM_TAG)) {
|
||||
BMVert **vout;
|
||||
int r_vout_len;
|
||||
int vout_len;
|
||||
BMVert *v_glue = nullptr;
|
||||
|
||||
/* disable touching twice, this _will_ happen if the flags not disabled */
|
||||
BM_elem_flag_disable(v, BM_ELEM_TAG);
|
||||
|
||||
bmesh_kernel_vert_separate(bm, v, &vout, &r_vout_len, false);
|
||||
bmesh_kernel_vert_separate(bm, v, &vout, &vout_len, false);
|
||||
v = nullptr; /* don't use again */
|
||||
|
||||
/* in some cases the edge doesn't split off */
|
||||
if (r_vout_len == 1) {
|
||||
if (vout_len == 1) {
|
||||
if (use_vert_coords_orig) {
|
||||
VERT_ORIG_STORE(vout[0]);
|
||||
}
|
||||
@@ -890,7 +890,7 @@ void bmo_inset_region_exec(BMesh *bm, BMOperator *op)
|
||||
continue;
|
||||
}
|
||||
|
||||
for (k = 0; k < r_vout_len; k++) {
|
||||
for (k = 0; k < vout_len; k++) {
|
||||
BMVert *v_split = vout[k]; /* only to avoid vout[k] all over */
|
||||
|
||||
/* need to check if this vertex is from a */
|
||||
@@ -1102,7 +1102,7 @@ void bmo_inset_region_exec(BMesh *bm, BMOperator *op)
|
||||
}
|
||||
|
||||
/* this saves expensive/slow glue check for common cases */
|
||||
if (r_vout_len > 2) {
|
||||
if (vout_len > 2) {
|
||||
bool ok = true;
|
||||
/* last step, nullptr this vertex if has a tagged face */
|
||||
BM_ITER_ELEM (f, &iter, v_split, BM_FACES_OF_VERT) {
|
||||
|
||||
@@ -124,7 +124,7 @@ static bool bm_vert_pair_share_splittable_face_cb(BMFace * /*f*/,
|
||||
static BMFace *bm_vert_pair_best_face_get(
|
||||
BMVert *v_a, BMVert *v_b, BMEdge **edgenet, const int edgenet_len, const float epsilon)
|
||||
{
|
||||
BMFace *r_best_face = nullptr;
|
||||
BMFace *best_face = nullptr;
|
||||
|
||||
BLI_assert(v_a != v_b);
|
||||
|
||||
@@ -133,9 +133,9 @@ static BMFace *bm_vert_pair_best_face_get(
|
||||
float data[2][3];
|
||||
copy_v3_v3(data[0], v_b->co);
|
||||
sub_v3_v3v3(data[1], v_a->co, data[0]);
|
||||
r_best_face = BM_vert_pair_shared_face_cb(
|
||||
best_face = BM_vert_pair_shared_face_cb(
|
||||
v_a, v_b, false, bm_vert_pair_share_splittable_face_cb, &data, &dummy, &dummy);
|
||||
BLI_assert(!r_best_face || BM_edge_in_face(edgenet[0], r_best_face) == false);
|
||||
BLI_assert(!best_face || BM_edge_in_face(edgenet[0], best_face) == false);
|
||||
}
|
||||
else {
|
||||
EDBMSplitBestFaceData data{};
|
||||
@@ -163,10 +163,10 @@ static BMFace *bm_vert_pair_best_face_get(
|
||||
data.r_best_face = nullptr;
|
||||
}
|
||||
}
|
||||
r_best_face = data.r_best_face;
|
||||
best_face = data.r_best_face;
|
||||
}
|
||||
|
||||
return r_best_face;
|
||||
return best_face;
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
@@ -11,38 +11,38 @@ VERTEX_SHADER_CREATE_INFO(overlay_edit_uv_stretching_area)
|
||||
|
||||
float3 weight_to_rgb(float weight)
|
||||
{
|
||||
float3 r_rgb;
|
||||
float3 rgb;
|
||||
float blend = ((weight / 2.0f) + 0.5f);
|
||||
|
||||
if (weight <= 0.25f) { /* blue->cyan */
|
||||
r_rgb[0] = 0.0f;
|
||||
r_rgb[1] = blend * weight * 4.0f;
|
||||
r_rgb[2] = blend;
|
||||
rgb[0] = 0.0f;
|
||||
rgb[1] = blend * weight * 4.0f;
|
||||
rgb[2] = blend;
|
||||
}
|
||||
else if (weight <= 0.50f) { /* cyan->green */
|
||||
r_rgb[0] = 0.0f;
|
||||
r_rgb[1] = blend;
|
||||
r_rgb[2] = blend * (1.0f - ((weight - 0.25f) * 4.0f));
|
||||
rgb[0] = 0.0f;
|
||||
rgb[1] = blend;
|
||||
rgb[2] = blend * (1.0f - ((weight - 0.25f) * 4.0f));
|
||||
}
|
||||
else if (weight <= 0.75f) { /* green->yellow */
|
||||
r_rgb[0] = blend * ((weight - 0.50f) * 4.0f);
|
||||
r_rgb[1] = blend;
|
||||
r_rgb[2] = 0.0f;
|
||||
rgb[0] = blend * ((weight - 0.50f) * 4.0f);
|
||||
rgb[1] = blend;
|
||||
rgb[2] = 0.0f;
|
||||
}
|
||||
else if (weight <= 1.0f) { /* yellow->red */
|
||||
r_rgb[0] = blend;
|
||||
r_rgb[1] = blend * (1.0f - ((weight - 0.75f) * 4.0f));
|
||||
r_rgb[2] = 0.0f;
|
||||
rgb[0] = blend;
|
||||
rgb[1] = blend * (1.0f - ((weight - 0.75f) * 4.0f));
|
||||
rgb[2] = 0.0f;
|
||||
}
|
||||
else {
|
||||
/* exceptional value, unclamped or nan,
|
||||
* avoid uninitialized memory use */
|
||||
r_rgb[0] = 1.0f;
|
||||
r_rgb[1] = 0.0f;
|
||||
r_rgb[2] = 1.0f;
|
||||
rgb[0] = 1.0f;
|
||||
rgb[1] = 0.0f;
|
||||
rgb[2] = 1.0f;
|
||||
}
|
||||
|
||||
return r_rgb;
|
||||
return rgb;
|
||||
}
|
||||
|
||||
#define M_PI 3.1415926535897932f
|
||||
|
||||
@@ -14,32 +14,32 @@ VERTEX_SHADER_CREATE_INFO(overlay_volume_velocity_mac)
|
||||
* TODO: port this to a color ramp. */
|
||||
float3 weight_to_color(float weight)
|
||||
{
|
||||
float3 r_rgb = float3(0.0f);
|
||||
float3 rgb = float3(0.0f);
|
||||
float blend = ((weight / 2.0f) + 0.5f);
|
||||
|
||||
if (weight <= 0.25f) { /* blue->cyan */
|
||||
r_rgb.g = blend * weight * 4.0f;
|
||||
r_rgb.b = blend;
|
||||
rgb.g = blend * weight * 4.0f;
|
||||
rgb.b = blend;
|
||||
}
|
||||
else if (weight <= 0.50f) { /* cyan->green */
|
||||
r_rgb.g = blend;
|
||||
r_rgb.b = blend * (1.0f - ((weight - 0.25f) * 4.0f));
|
||||
rgb.g = blend;
|
||||
rgb.b = blend * (1.0f - ((weight - 0.25f) * 4.0f));
|
||||
}
|
||||
else if (weight <= 0.75f) { /* green->yellow */
|
||||
r_rgb.r = blend * ((weight - 0.50f) * 4.0f);
|
||||
r_rgb.g = blend;
|
||||
rgb.r = blend * ((weight - 0.50f) * 4.0f);
|
||||
rgb.g = blend;
|
||||
}
|
||||
else if (weight <= 1.0f) { /* yellow->red */
|
||||
r_rgb.r = blend;
|
||||
r_rgb.g = blend * (1.0f - ((weight - 0.75f) * 4.0f));
|
||||
rgb.r = blend;
|
||||
rgb.g = blend * (1.0f - ((weight - 0.75f) * 4.0f));
|
||||
}
|
||||
else {
|
||||
/* exceptional value, unclamped or nan,
|
||||
* avoid uninitialized memory use */
|
||||
r_rgb = float3(1.0f, 0.0f, 1.0f);
|
||||
rgb = float3(1.0f, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
return r_rgb;
|
||||
return rgb;
|
||||
}
|
||||
|
||||
float3x3 rotation_from_vector(float3 v)
|
||||
|
||||
@@ -453,7 +453,7 @@ struct Instance : public DrawEngine {
|
||||
|
||||
short get_object_select_mode(Scene *scene, Object *ob)
|
||||
{
|
||||
short r_select_mode = 0;
|
||||
short select_mode = 0;
|
||||
if (ob->mode & (OB_MODE_WEIGHT_PAINT | OB_MODE_VERTEX_PAINT | OB_MODE_TEXTURE_PAINT)) {
|
||||
/* In order to sample flat colors for vertex weights / texture-paint / vertex-paint
|
||||
* we need to be in SCE_SELECT_FACE mode so select_cache_init() correctly sets up
|
||||
@@ -463,17 +463,17 @@ struct Instance : public DrawEngine {
|
||||
* So OB_MODE_VERTEX_PAINT is already included here [required for P1032 I guess]. */
|
||||
Mesh *me_orig = static_cast<Mesh *>(DEG_get_original(ob)->data);
|
||||
if (me_orig->editflag & ME_EDIT_PAINT_VERT_SEL) {
|
||||
r_select_mode = SCE_SELECT_VERTEX;
|
||||
select_mode = SCE_SELECT_VERTEX;
|
||||
}
|
||||
else {
|
||||
r_select_mode = SCE_SELECT_FACE;
|
||||
select_mode = SCE_SELECT_FACE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
r_select_mode = scene->toolsettings->selectmode;
|
||||
select_mode = scene->toolsettings->selectmode;
|
||||
}
|
||||
|
||||
return r_select_mode;
|
||||
return select_mode;
|
||||
}
|
||||
|
||||
bool check_ob_drawface_dot(short select_mode, const View3D *v3d, eDrawType dt)
|
||||
|
||||
@@ -67,7 +67,7 @@ bool SELECTID_Context::is_dirty(Depsgraph *depsgraph, RegionView3D *rv3d)
|
||||
uint *DRW_select_buffer_read(
|
||||
Depsgraph *depsgraph, ARegion *region, View3D *v3d, const rcti *rect, uint *r_buf_len)
|
||||
{
|
||||
uint *r_buf = nullptr;
|
||||
uint *buf = nullptr;
|
||||
uint buf_len = 0;
|
||||
|
||||
/* Clamp rect. */
|
||||
@@ -97,7 +97,7 @@ uint *DRW_select_buffer_read(
|
||||
|
||||
/* Read the UI32 pixels. */
|
||||
buf_len = BLI_rcti_size_x(rect) * BLI_rcti_size_y(rect);
|
||||
r_buf = MEM_malloc_arrayN<uint>(buf_len, __func__);
|
||||
buf = MEM_malloc_arrayN<uint>(buf_len, __func__);
|
||||
|
||||
GPUFrameBuffer *select_id_fb = DRW_engine_select_framebuffer_get();
|
||||
GPU_framebuffer_bind(select_id_fb);
|
||||
@@ -109,11 +109,11 @@ uint *DRW_select_buffer_read(
|
||||
1,
|
||||
0,
|
||||
GPU_DATA_UINT,
|
||||
r_buf);
|
||||
buf);
|
||||
|
||||
if (!BLI_rcti_compare(rect, &rect_clamp)) {
|
||||
/* The rect has been clamped so we need to realign the buffer and fill in the blanks */
|
||||
GPU_select_buffer_stride_realign(rect, &rect_clamp, r_buf);
|
||||
GPU_select_buffer_stride_realign(rect, &rect_clamp, buf);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ uint *DRW_select_buffer_read(
|
||||
*r_buf_len = buf_len;
|
||||
}
|
||||
|
||||
return r_buf;
|
||||
return buf;
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
@@ -103,8 +103,8 @@ Array<float2> polyline_fit_curve(Span<float2> points,
|
||||
corner_mask.to_indices(indices.as_mutable_span());
|
||||
uint *indicies_ptr = corner_mask.is_empty() ? nullptr : reinterpret_cast<uint *>(indices.data());
|
||||
|
||||
float *r_cubic_array;
|
||||
uint r_cubic_array_len;
|
||||
float *cubic_array;
|
||||
uint cubic_array_len;
|
||||
int error = curve_fit_cubic_to_points_fl(*points.data(),
|
||||
points.size(),
|
||||
2,
|
||||
@@ -112,8 +112,8 @@ Array<float2> polyline_fit_curve(Span<float2> points,
|
||||
CURVE_FIT_CALC_HIGH_QUALIY,
|
||||
indicies_ptr,
|
||||
indices.size(),
|
||||
&r_cubic_array,
|
||||
&r_cubic_array_len,
|
||||
&cubic_array,
|
||||
&cubic_array_len,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr);
|
||||
@@ -123,15 +123,14 @@ Array<float2> polyline_fit_curve(Span<float2> points,
|
||||
return {};
|
||||
}
|
||||
|
||||
if (r_cubic_array == nullptr) {
|
||||
if (cubic_array == nullptr) {
|
||||
return {};
|
||||
}
|
||||
|
||||
Span<float2> r_cubic_array_span(reinterpret_cast<float2 *>(r_cubic_array),
|
||||
r_cubic_array_len * 3);
|
||||
Array<float2> curve_positions(r_cubic_array_span);
|
||||
Span<float2> cubic_array_span(reinterpret_cast<float2 *>(cubic_array), cubic_array_len * 3);
|
||||
Array<float2> curve_positions(cubic_array_span);
|
||||
/* Free the c-style array. */
|
||||
free(r_cubic_array);
|
||||
free(cubic_array);
|
||||
return curve_positions;
|
||||
}
|
||||
|
||||
@@ -148,8 +147,8 @@ IndexMask polyline_detect_corners(Span<float2> points,
|
||||
if (points.size() == 1) {
|
||||
return IndexMask::from_indices<int>({0}, memory);
|
||||
}
|
||||
uint *r_corners;
|
||||
uint r_corner_len;
|
||||
uint *corners;
|
||||
uint corners_len;
|
||||
const int error = curve_fit_corners_detect_fl(*points.data(),
|
||||
points.size(),
|
||||
float2::type_length,
|
||||
@@ -157,22 +156,22 @@ IndexMask polyline_detect_corners(Span<float2> points,
|
||||
radius_max,
|
||||
samples_max,
|
||||
angle_threshold,
|
||||
&r_corners,
|
||||
&r_corner_len);
|
||||
&corners,
|
||||
&corners_len);
|
||||
if (error != 0) {
|
||||
/* Error occurred, return. */
|
||||
return IndexMask();
|
||||
}
|
||||
|
||||
if (r_corners == nullptr) {
|
||||
if (corners == nullptr) {
|
||||
return IndexMask();
|
||||
}
|
||||
|
||||
BLI_assert(samples_max < std::numeric_limits<int>::max());
|
||||
Span<int> indices(reinterpret_cast<int *>(r_corners), r_corner_len);
|
||||
Span<int> indices(reinterpret_cast<int *>(corners), corners_len);
|
||||
const IndexMask corner_mask = IndexMask::from_indices<int>(indices, memory);
|
||||
/* Free the c-style array. */
|
||||
free(r_corners);
|
||||
free(corners);
|
||||
return corner_mask;
|
||||
}
|
||||
|
||||
|
||||
@@ -1468,8 +1468,8 @@ static void vgroup_normalize_all_deform_if_active_is_deform(Object *ob,
|
||||
ReportList *reports,
|
||||
std::optional<int> current_frame = {})
|
||||
{
|
||||
int r_defgroup_tot = BKE_object_defgroup_count(ob);
|
||||
bool *defgroup_validmap = BKE_object_defgroup_validmap_get(ob, r_defgroup_tot);
|
||||
const int defgroup_tot = BKE_object_defgroup_count(ob);
|
||||
bool *defgroup_validmap = BKE_object_defgroup_validmap_get(ob, defgroup_tot);
|
||||
const int def_nr = BKE_object_defgroup_active_index_get(ob) - 1;
|
||||
|
||||
/* Only auto-normalize if the active group is bone-deforming. */
|
||||
|
||||
@@ -247,9 +247,9 @@ int console_textview_height(SpaceConsole *sc, const ARegion *region)
|
||||
|
||||
int console_char_pick(SpaceConsole *sc, const ARegion *region, const int mval[2])
|
||||
{
|
||||
int r_mval_pick_offset = 0;
|
||||
int mval_pick_offset = 0;
|
||||
void *mval_pick_item = nullptr;
|
||||
|
||||
console_textview_main__internal(sc, region, false, mval, &mval_pick_item, &r_mval_pick_offset);
|
||||
return r_mval_pick_offset;
|
||||
console_textview_main__internal(sc, region, false, mval, &mval_pick_item, &mval_pick_offset);
|
||||
return mval_pick_offset;
|
||||
}
|
||||
|
||||
@@ -38,19 +38,19 @@ blender::float2 ED_view3d_project_float_v2_m4(const ARegion *region,
|
||||
|
||||
copy_v3_v3(vec4, co);
|
||||
vec4[3] = 1.0;
|
||||
// r_co[0] = IS_CLIPPED; /* Always overwritten. */
|
||||
// co_region[0] = IS_CLIPPED; /* Always overwritten. */
|
||||
|
||||
mul_m4_v4(mat.ptr(), vec4);
|
||||
|
||||
blender::float2 r_co;
|
||||
blender::float2 co_region;
|
||||
if (vec4[3] > FLT_EPSILON) {
|
||||
r_co[0] = float(region->winx / 2.0f) + (region->winx / 2.0f) * vec4[0] / vec4[3];
|
||||
r_co[1] = float(region->winy / 2.0f) + (region->winy / 2.0f) * vec4[1] / vec4[3];
|
||||
co_region[0] = float(region->winx / 2.0f) + (region->winx / 2.0f) * vec4[0] / vec4[3];
|
||||
co_region[1] = float(region->winy / 2.0f) + (region->winy / 2.0f) * vec4[1] / vec4[3];
|
||||
}
|
||||
else {
|
||||
zero_v2(r_co);
|
||||
zero_v2(co_region);
|
||||
}
|
||||
return r_co;
|
||||
return co_region;
|
||||
}
|
||||
|
||||
void ED_view3d_project_float_v3_m4(const ARegion *region,
|
||||
@@ -760,11 +760,11 @@ bool ED_view3d_win_to_segment_clipped(const Depsgraph *depsgraph,
|
||||
blender::float4x4 ED_view3d_ob_project_mat_get(const RegionView3D *rv3d, const Object *ob)
|
||||
{
|
||||
float vmat[4][4];
|
||||
blender::float4x4 r_pmat;
|
||||
blender::float4x4 pmat;
|
||||
|
||||
mul_m4_m4m4(vmat, rv3d->viewmat, ob->object_to_world().ptr());
|
||||
mul_m4_m4m4(r_pmat.ptr(), rv3d->winmat, vmat);
|
||||
return r_pmat;
|
||||
mul_m4_m4m4(pmat.ptr(), rv3d->winmat, vmat);
|
||||
return pmat;
|
||||
}
|
||||
|
||||
blender::float4x4 ED_view3d_ob_project_mat_get_from_obmat(const RegionView3D *rv3d,
|
||||
|
||||
@@ -179,32 +179,32 @@ static float3 prop_dist_loc_get(const TransDataContainer *tc,
|
||||
const bool use_island,
|
||||
const float proj_vec[3])
|
||||
{
|
||||
float3 r_vec;
|
||||
float3 vec;
|
||||
|
||||
if (use_island) {
|
||||
if (tc->use_local_mat) {
|
||||
mul_v3_m4v3(r_vec, tc->mat, td->iloc);
|
||||
mul_v3_m4v3(vec, tc->mat, td->iloc);
|
||||
}
|
||||
else {
|
||||
mul_v3_m3v3(r_vec, td->mtx, td->iloc);
|
||||
mul_v3_m3v3(vec, td->mtx, td->iloc);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (tc->use_local_mat) {
|
||||
mul_v3_m4v3(r_vec, tc->mat, td->center);
|
||||
mul_v3_m4v3(vec, tc->mat, td->center);
|
||||
}
|
||||
else {
|
||||
mul_v3_m3v3(r_vec, td->mtx, td->center);
|
||||
mul_v3_m3v3(vec, td->mtx, td->center);
|
||||
}
|
||||
}
|
||||
|
||||
if (proj_vec) {
|
||||
float vec_p[3];
|
||||
project_v3_v3v3(vec_p, r_vec, proj_vec);
|
||||
sub_v3_v3(r_vec, vec_p);
|
||||
project_v3_v3v3(vec_p, vec, proj_vec);
|
||||
sub_v3_v3(vec, vec_p);
|
||||
}
|
||||
|
||||
return r_vec;
|
||||
return vec;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -495,24 +495,24 @@ void clipUVData(TransInfo *t)
|
||||
|
||||
char transform_convert_frame_side_dir_get(TransInfo *t, float cframe)
|
||||
{
|
||||
char r_dir;
|
||||
char dir;
|
||||
float center[2];
|
||||
if (t->flag & T_MODAL) {
|
||||
UI_view2d_region_to_view(
|
||||
(View2D *)t->view, t->mouse.imval[0], t->mouse.imval[1], ¢er[0], ¢er[1]);
|
||||
r_dir = (center[0] > cframe) ? 'R' : 'L';
|
||||
dir = (center[0] > cframe) ? 'R' : 'L';
|
||||
{
|
||||
/* XXX: This saves the direction in the "mirror" property to be used for redo! */
|
||||
if (r_dir == 'R') {
|
||||
if (dir == 'R') {
|
||||
t->flag |= T_NO_MIRROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
r_dir = (t->flag & T_NO_MIRROR) ? 'R' : 'L';
|
||||
dir = (t->flag & T_NO_MIRROR) ? 'R' : 'L';
|
||||
}
|
||||
|
||||
return r_dir;
|
||||
return dir;
|
||||
}
|
||||
|
||||
bool FrameOnMouseSide(char side, float frame, float cframe)
|
||||
|
||||
@@ -2179,10 +2179,10 @@ Array<TransDataVertSlideVert> transform_mesh_vert_slide_data_create(
|
||||
int td_selected_len = 0;
|
||||
tc->foreach_index_selected([&](const int /*i*/) { td_selected_len++; });
|
||||
|
||||
Array<TransDataVertSlideVert> r_sv(td_selected_len);
|
||||
Array<TransDataVertSlideVert> sv_array(td_selected_len);
|
||||
|
||||
r_loc_dst_buffer.reserve(r_sv.size() * 4);
|
||||
int r_sv_index = 0;
|
||||
r_loc_dst_buffer.reserve(sv_array.size() * 4);
|
||||
int sv_array_index = 0;
|
||||
tc->foreach_index_selected([&](const int i) {
|
||||
TransData *td = &tc->data[i];
|
||||
const int size_prev = r_loc_dst_buffer.size();
|
||||
@@ -2203,7 +2203,7 @@ Array<TransDataVertSlideVert> transform_mesh_vert_slide_data_create(
|
||||
}
|
||||
}
|
||||
|
||||
TransDataVertSlideVert &sv = r_sv[r_sv_index];
|
||||
TransDataVertSlideVert &sv = sv_array[sv_array_index];
|
||||
sv.td = &tc->data[i];
|
||||
/* The buffer address may change as the vector is resized. Avoid setting #Span. */
|
||||
// sv.targets = r_loc_dst_buffer.as_span().drop_front(size_prev);
|
||||
@@ -2211,18 +2211,18 @@ Array<TransDataVertSlideVert> transform_mesh_vert_slide_data_create(
|
||||
/* Store the buffer size temporarily in `target_curr`. */
|
||||
sv.co_link_curr = r_loc_dst_buffer.size() - size_prev;
|
||||
|
||||
r_sv_index++;
|
||||
sv_array_index++;
|
||||
});
|
||||
|
||||
int start = 0;
|
||||
for (TransDataVertSlideVert &sv : r_sv) {
|
||||
for (TransDataVertSlideVert &sv : sv_array) {
|
||||
int size = sv.co_link_curr;
|
||||
sv.co_link_orig_3d = r_loc_dst_buffer.as_span().slice(start, size);
|
||||
sv.co_link_curr = 0;
|
||||
start += size;
|
||||
}
|
||||
|
||||
return r_sv;
|
||||
return sv_array;
|
||||
}
|
||||
|
||||
/** \} */
|
||||
@@ -2339,8 +2339,8 @@ Array<TransDataEdgeSlideVert> transform_mesh_edge_slide_data_create(const TransD
|
||||
|
||||
/* Alloc and initialize the #TransDataEdgeSlideVert. */
|
||||
|
||||
Array<TransDataEdgeSlideVert> r_sv(td_selected_len);
|
||||
TransDataEdgeSlideVert *sv = r_sv.data();
|
||||
Array<TransDataEdgeSlideVert> sv_array(td_selected_len);
|
||||
TransDataEdgeSlideVert *sv = sv_array.data();
|
||||
int sv_index = 0;
|
||||
tc->foreach_index_selected([&](const int i) {
|
||||
TransData *td = &tc->data[i];
|
||||
@@ -2380,8 +2380,8 @@ Array<TransDataEdgeSlideVert> transform_mesh_edge_slide_data_create(const TransD
|
||||
|
||||
/* Compute the sliding groups. */
|
||||
int loop_nr = 0;
|
||||
for (int i : r_sv.index_range()) {
|
||||
TransDataEdgeSlideVert *sv = &r_sv[i];
|
||||
for (int i : sv_array.index_range()) {
|
||||
TransDataEdgeSlideVert *sv = &sv_array[i];
|
||||
if (sv->loop_nr != -1) {
|
||||
/* This vertex has already been computed. */
|
||||
continue;
|
||||
@@ -2502,14 +2502,14 @@ Array<TransDataEdgeSlideVert> transform_mesh_edge_slide_data_create(const TransD
|
||||
|
||||
next.i = td_connected[i_curr][0] != i_prev ? td_connected[i_curr][0] : td_connected[i_curr][1];
|
||||
if (next.i != -1) {
|
||||
next.sv = &r_sv[next.i];
|
||||
next.sv = &sv_array[next.i];
|
||||
next.v = static_cast<BMVert *>(next.sv->td->extra);
|
||||
next.vert_is_edge_pair = mesh_vert_is_inner(next.v);
|
||||
}
|
||||
|
||||
curr.i = i_curr;
|
||||
if (curr.i != -1) {
|
||||
curr.sv = &r_sv[curr.i];
|
||||
curr.sv = &sv_array[curr.i];
|
||||
curr.v = static_cast<BMVert *>(curr.sv->td->extra);
|
||||
curr.vert_is_edge_pair = mesh_vert_is_inner(curr.v);
|
||||
if (next.i != -1) {
|
||||
@@ -2525,7 +2525,7 @@ Array<TransDataEdgeSlideVert> transform_mesh_edge_slide_data_create(const TransD
|
||||
next_next.i = td_connected[next.i][0] != curr.i ? td_connected[next.i][0] :
|
||||
td_connected[next.i][1];
|
||||
if (next_next.i != -1) {
|
||||
next_next.sv = &r_sv[next_next.i];
|
||||
next_next.sv = &sv_array[next_next.i];
|
||||
next_next.v = static_cast<BMVert *>(next_next.sv->td->extra);
|
||||
next_next.vert_is_edge_pair = mesh_vert_is_inner(next_next.v);
|
||||
next.e = BM_edge_exists(next.v, next_next.v);
|
||||
@@ -2738,7 +2738,7 @@ Array<TransDataEdgeSlideVert> transform_mesh_edge_slide_data_create(const TransD
|
||||
loop_nr++;
|
||||
}
|
||||
*r_group_len = loop_nr;
|
||||
return r_sv;
|
||||
return sv_array;
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
@@ -559,8 +559,8 @@ struct UVGroups {
|
||||
|
||||
Array<TransDataVertSlideVert> sd_array_create_and_init(TransDataContainer *tc)
|
||||
{
|
||||
Array<TransDataVertSlideVert> r_sv(this->sd_len);
|
||||
TransDataVertSlideVert *sv = r_sv.data();
|
||||
Array<TransDataVertSlideVert> sv_array(this->sd_len);
|
||||
TransDataVertSlideVert *sv = sv_array.data();
|
||||
for (const int group_index : this->groups().index_range()) {
|
||||
for (int td_index : this->td_indices_get(group_index)) {
|
||||
TransData *td = &tc->data[td_index];
|
||||
@@ -569,13 +569,13 @@ struct UVGroups {
|
||||
}
|
||||
}
|
||||
|
||||
return r_sv;
|
||||
return sv_array;
|
||||
}
|
||||
|
||||
Array<TransDataEdgeSlideVert> sd_array_create_and_init_edge(TransDataContainer *tc)
|
||||
{
|
||||
Array<TransDataEdgeSlideVert> r_sv(this->sd_len);
|
||||
TransDataEdgeSlideVert *sv = r_sv.data();
|
||||
Array<TransDataEdgeSlideVert> sv_array(this->sd_len);
|
||||
TransDataEdgeSlideVert *sv = sv_array.data();
|
||||
for (const int group_index : this->groups().index_range()) {
|
||||
for (int td_index : this->td_indices_get(group_index)) {
|
||||
TransData *td = &tc->data[td_index];
|
||||
@@ -587,7 +587,7 @@ struct UVGroups {
|
||||
}
|
||||
}
|
||||
|
||||
return r_sv;
|
||||
return sv_array;
|
||||
}
|
||||
|
||||
MutableSpan<TransDataVertSlideVert> sd_group_get(MutableSpan<TransDataVertSlideVert> sd_array,
|
||||
@@ -640,9 +640,9 @@ Array<TransDataVertSlideVert> transform_mesh_uv_vert_slide_data_create(
|
||||
|
||||
UVGroups *uv_groups = mesh_uv_groups_get(tc, bm, offsets);
|
||||
|
||||
Array<TransDataVertSlideVert> r_sv = uv_groups->sd_array_create_and_init(tc);
|
||||
Array<TransDataVertSlideVert> sv_array = uv_groups->sd_array_create_and_init(tc);
|
||||
|
||||
r_loc_dst_buffer.reserve(r_sv.size() * 4);
|
||||
r_loc_dst_buffer.reserve(sv_array.size() * 4);
|
||||
|
||||
for (const int group_index : uv_groups->groups().index_range()) {
|
||||
const int size_prev = r_loc_dst_buffer.size();
|
||||
@@ -667,7 +667,7 @@ Array<TransDataVertSlideVert> transform_mesh_uv_vert_slide_data_create(
|
||||
}
|
||||
|
||||
const int size_new = r_loc_dst_buffer.size() - size_prev;
|
||||
for (TransDataVertSlideVert &sv : uv_groups->sd_group_get(r_sv, group_index)) {
|
||||
for (TransDataVertSlideVert &sv : uv_groups->sd_group_get(sv_array, group_index)) {
|
||||
/* The buffer address may change as the vector is resized. Avoid setting #Span now. */
|
||||
// sv.targets = r_loc_dst_buffer.as_span().drop_front(size_prev);
|
||||
|
||||
@@ -684,12 +684,12 @@ Array<TransDataVertSlideVert> transform_mesh_uv_vert_slide_data_create(
|
||||
}
|
||||
}
|
||||
|
||||
for (TransDataVertSlideVert &sv : r_sv) {
|
||||
for (TransDataVertSlideVert &sv : sv_array) {
|
||||
int start = POINTER_AS_INT(sv.co_link_orig_3d.data());
|
||||
sv.co_link_orig_3d = r_loc_dst_buffer.as_span().slice(start, sv.co_link_orig_3d.size());
|
||||
}
|
||||
|
||||
return r_sv;
|
||||
return sv_array;
|
||||
}
|
||||
|
||||
/** \} */
|
||||
@@ -819,7 +819,7 @@ Array<TransDataEdgeSlideVert> transform_mesh_uv_edge_slide_data_create(const Tra
|
||||
TransDataContainer *tc,
|
||||
int *r_group_len)
|
||||
{
|
||||
Array<TransDataEdgeSlideVert> r_sv;
|
||||
Array<TransDataEdgeSlideVert> sv_array;
|
||||
BMEditMesh *em = BKE_editmesh_from_object(tc->obedit);
|
||||
BMesh *bm = em->bm;
|
||||
const BMUVOffsets offsets = BM_uv_map_offsets_get(bm);
|
||||
@@ -878,7 +878,7 @@ Array<TransDataEdgeSlideVert> transform_mesh_uv_edge_slide_data_create(const Tra
|
||||
|
||||
if (group_linked_pair[1] != -1) {
|
||||
/* For Edge Slide, the vertex can only be connected to a maximum of 2 sliding edges. */
|
||||
return r_sv;
|
||||
return sv_array;
|
||||
}
|
||||
const int slot = int(group_linked_pair[0] != -1);
|
||||
group_linked_pair[slot] = group_index_dst;
|
||||
@@ -887,22 +887,22 @@ Array<TransDataEdgeSlideVert> transform_mesh_uv_edge_slide_data_create(const Tra
|
||||
|
||||
if (group_linked_pair[0] == -1) {
|
||||
/* For Edge Slide, the vertex must be connected to at least 1 sliding edge. */
|
||||
return r_sv;
|
||||
return sv_array;
|
||||
}
|
||||
}
|
||||
|
||||
/* Alloc and initialize the #TransDataEdgeSlideVert. */
|
||||
r_sv = uv_groups->sd_array_create_and_init_edge(tc);
|
||||
sv_array = uv_groups->sd_array_create_and_init_edge(tc);
|
||||
|
||||
/* Compute the sliding groups. */
|
||||
int loop_nr = 0;
|
||||
for (int i : r_sv.index_range()) {
|
||||
if (r_sv[i].loop_nr != -1) {
|
||||
for (int i : sv_array.index_range()) {
|
||||
if (sv_array[i].loop_nr != -1) {
|
||||
/* This vertex has already been computed. */
|
||||
continue;
|
||||
}
|
||||
|
||||
BMLoop *l = static_cast<BMLoop *>(r_sv[i].td->extra);
|
||||
BMLoop *l = static_cast<BMLoop *>(sv_array[i].td->extra);
|
||||
int group_index = BM_elem_index_get(l);
|
||||
|
||||
/* Start from a vertex connected to just a single edge or any if it doesn't exist. */
|
||||
@@ -1098,7 +1098,7 @@ Array<TransDataEdgeSlideVert> transform_mesh_uv_edge_slide_data_create(const Tra
|
||||
}
|
||||
|
||||
TransDataEdgeSlideVert *sv_first = nullptr;
|
||||
for (TransDataEdgeSlideVert &sv : uv_groups->sd_group_get(r_sv, curr.i)) {
|
||||
for (TransDataEdgeSlideVert &sv : uv_groups->sd_group_get(sv_array, curr.i)) {
|
||||
if (sv_first) {
|
||||
TransData *td = sv.td;
|
||||
sv = *sv_first;
|
||||
@@ -1136,7 +1136,7 @@ Array<TransDataEdgeSlideVert> transform_mesh_uv_edge_slide_data_create(const Tra
|
||||
loop_nr++;
|
||||
}
|
||||
*r_group_len = loop_nr;
|
||||
return r_sv;
|
||||
return sv_array;
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
@@ -792,12 +792,12 @@ short transform_orientation_matrix_get(bContext *C,
|
||||
}
|
||||
}
|
||||
|
||||
short r_orient_index = calc_orientation_from_type_ex(
|
||||
const short orient_index_result = calc_orientation_from_type_ex(
|
||||
scene, t->view_layer, v3d, rv3d, ob, obedit, orient_index, t->around, r_spacemtx);
|
||||
|
||||
if (rv3d && (t->options & CTX_PAINT_CURVE)) {
|
||||
/* Screen space in the 3d region. */
|
||||
if (r_orient_index == V3D_ORIENT_VIEW) {
|
||||
if (orient_index_result == V3D_ORIENT_VIEW) {
|
||||
unit_m3(r_spacemtx);
|
||||
}
|
||||
else {
|
||||
@@ -806,7 +806,7 @@ short transform_orientation_matrix_get(bContext *C,
|
||||
}
|
||||
}
|
||||
|
||||
return r_orient_index;
|
||||
return orient_index_result;
|
||||
}
|
||||
|
||||
const char *transform_orientations_spacename_get(TransInfo *t, const short orient_type)
|
||||
|
||||
@@ -762,7 +762,7 @@ static eSnapTargetOP snap_target_select_from_spacetype_and_tool_settings(TransIn
|
||||
/* `t->tsnap.target_operation` not initialized yet. */
|
||||
BLI_assert(t->tsnap.target_operation == SCE_SNAP_TARGET_ALL);
|
||||
|
||||
eSnapTargetOP r_target_operation = SCE_SNAP_TARGET_ALL;
|
||||
eSnapTargetOP target_operation = SCE_SNAP_TARGET_ALL;
|
||||
|
||||
if (ELEM(t->spacetype, SPACE_VIEW3D, SPACE_IMAGE) && !(t->options & CTX_CAMERA)) {
|
||||
BKE_view_layer_synced_ensure(t->scene, t->view_layer);
|
||||
@@ -784,45 +784,45 @@ static eSnapTargetOP snap_target_select_from_spacetype_and_tool_settings(TransIn
|
||||
/* Editing a mesh. */
|
||||
if ((t->flag & T_PROP_EDIT) != 0) {
|
||||
/* Exclude editmesh when using proportional edit. */
|
||||
r_target_operation |= SCE_SNAP_TARGET_NOT_EDITED;
|
||||
target_operation |= SCE_SNAP_TARGET_NOT_EDITED;
|
||||
}
|
||||
/* UV editing must never snap to the selection as this is what is transformed. */
|
||||
if (t->spacetype == SPACE_IMAGE) {
|
||||
r_target_operation |= SCE_SNAP_TARGET_NOT_SELECTED;
|
||||
target_operation |= SCE_SNAP_TARGET_NOT_SELECTED;
|
||||
}
|
||||
}
|
||||
else if (ELEM(obedit_type, OB_ARMATURE, OB_CURVES_LEGACY, OB_SURF, OB_LATTICE, OB_MBALL)) {
|
||||
/* Temporary limited to edit mode armature, curves, surfaces, lattices, and meta-balls.
|
||||
*/
|
||||
r_target_operation |= SCE_SNAP_TARGET_NOT_SELECTED;
|
||||
target_operation |= SCE_SNAP_TARGET_NOT_SELECTED;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* Object or pose mode. */
|
||||
r_target_operation |= SCE_SNAP_TARGET_NOT_SELECTED | SCE_SNAP_TARGET_NOT_ACTIVE;
|
||||
target_operation |= SCE_SNAP_TARGET_NOT_SELECTED | SCE_SNAP_TARGET_NOT_ACTIVE;
|
||||
}
|
||||
}
|
||||
else if (ELEM(t->spacetype, SPACE_NODE, SPACE_SEQ)) {
|
||||
r_target_operation |= SCE_SNAP_TARGET_NOT_SELECTED;
|
||||
target_operation |= SCE_SNAP_TARGET_NOT_SELECTED;
|
||||
}
|
||||
|
||||
/* Use scene defaults only when transform is modal. */
|
||||
if (t->flag & T_MODAL) {
|
||||
ToolSettings *ts = t->settings;
|
||||
SET_FLAG_FROM_TEST(
|
||||
r_target_operation, (ts->snap_flag & SCE_SNAP_NOT_TO_ACTIVE), SCE_SNAP_TARGET_NOT_ACTIVE);
|
||||
SET_FLAG_FROM_TEST(r_target_operation,
|
||||
target_operation, (ts->snap_flag & SCE_SNAP_NOT_TO_ACTIVE), SCE_SNAP_TARGET_NOT_ACTIVE);
|
||||
SET_FLAG_FROM_TEST(target_operation,
|
||||
!(ts->snap_flag & SCE_SNAP_TO_INCLUDE_EDITED),
|
||||
SCE_SNAP_TARGET_NOT_EDITED);
|
||||
SET_FLAG_FROM_TEST(r_target_operation,
|
||||
SET_FLAG_FROM_TEST(target_operation,
|
||||
!(ts->snap_flag & SCE_SNAP_TO_INCLUDE_NONEDITED),
|
||||
SCE_SNAP_TARGET_NOT_NONEDITED);
|
||||
SET_FLAG_FROM_TEST(r_target_operation,
|
||||
SET_FLAG_FROM_TEST(target_operation,
|
||||
(ts->snap_flag & SCE_SNAP_TO_ONLY_SELECTABLE),
|
||||
SCE_SNAP_TARGET_ONLY_SELECTABLE);
|
||||
}
|
||||
|
||||
return r_target_operation;
|
||||
return target_operation;
|
||||
}
|
||||
|
||||
static void snap_object_context_init(TransInfo *t)
|
||||
|
||||
@@ -284,16 +284,16 @@ Vector<GVArray> evaluate_fields(ResourceScope &scope,
|
||||
const FieldContext &context,
|
||||
Span<GVMutableArray> dst_varrays)
|
||||
{
|
||||
Vector<GVArray> r_varrays(fields_to_evaluate.size());
|
||||
Vector<GVArray> varrays(fields_to_evaluate.size());
|
||||
Array<bool> is_output_written_to_dst(fields_to_evaluate.size(), false);
|
||||
const int array_size = mask.min_array_size();
|
||||
|
||||
if (mask.is_empty()) {
|
||||
for (const int i : fields_to_evaluate.index_range()) {
|
||||
const CPPType &type = fields_to_evaluate[i].cpp_type();
|
||||
r_varrays[i] = GVArray::from_empty(type);
|
||||
varrays[i] = GVArray::from_empty(type);
|
||||
}
|
||||
return r_varrays;
|
||||
return varrays;
|
||||
}
|
||||
|
||||
/* Destination arrays are optional. Create a small utility method to access them. */
|
||||
@@ -326,12 +326,12 @@ Vector<GVArray> evaluate_fields(ResourceScope &scope,
|
||||
const int field_input_index = field_tree_info.deduplicated_field_inputs.index_of(
|
||||
field_input);
|
||||
const GVArray &varray = field_context_inputs[field_input_index];
|
||||
r_varrays[out_index] = varray;
|
||||
varrays[out_index] = varray;
|
||||
break;
|
||||
}
|
||||
case FieldNodeType::Constant: {
|
||||
const FieldConstant &field_constant = static_cast<const FieldConstant &>(field.node());
|
||||
r_varrays[out_index] = GVArray::from_single_ref(
|
||||
varrays[out_index] = GVArray::from_single_ref(
|
||||
field_constant.type(), mask.min_array_size(), field_constant.value().get());
|
||||
break;
|
||||
}
|
||||
@@ -350,7 +350,7 @@ Vector<GVArray> evaluate_fields(ResourceScope &scope,
|
||||
Vector<GFieldRef> constant_fields_to_evaluate;
|
||||
Vector<int> constant_field_indices;
|
||||
for (const int i : fields_to_evaluate.index_range()) {
|
||||
if (r_varrays[i]) {
|
||||
if (varrays[i]) {
|
||||
/* Already done. */
|
||||
continue;
|
||||
}
|
||||
@@ -399,13 +399,13 @@ Vector<GVArray> evaluate_fields(ResourceScope &scope,
|
||||
[buffer, mask, &type]() { type.destruct_indices(buffer, mask); });
|
||||
}
|
||||
|
||||
r_varrays[out_index] = GVArray::from_span({type, buffer, array_size});
|
||||
varrays[out_index] = GVArray::from_span({type, buffer, array_size});
|
||||
}
|
||||
else {
|
||||
/* Write the result into the existing span. */
|
||||
buffer = dst_varray.get_internal_span().data();
|
||||
|
||||
r_varrays[out_index] = dst_varray;
|
||||
varrays[out_index] = dst_varray;
|
||||
is_output_written_to_dst[out_index] = true;
|
||||
}
|
||||
|
||||
@@ -444,7 +444,7 @@ Vector<GVArray> evaluate_fields(ResourceScope &scope,
|
||||
|
||||
/* Create virtual array that can be used after the procedure has been executed below. */
|
||||
const int out_index = constant_field_indices[i];
|
||||
r_varrays[out_index] = GVArray::from_single_ref(type, array_size, buffer);
|
||||
varrays[out_index] = GVArray::from_single_ref(type, array_size, buffer);
|
||||
}
|
||||
|
||||
procedure_executor.call(mask, mf_params, mf_context);
|
||||
@@ -459,7 +459,7 @@ Vector<GVArray> evaluate_fields(ResourceScope &scope,
|
||||
/* Caller did not provide a destination for this output. */
|
||||
continue;
|
||||
}
|
||||
const GVArray &computed_varray = r_varrays[out_index];
|
||||
const GVArray &computed_varray = varrays[out_index];
|
||||
BLI_assert(computed_varray.type() == dst_varray.type());
|
||||
if (is_output_written_to_dst[out_index]) {
|
||||
/* The result has been written into the destination provided by the caller already. */
|
||||
@@ -484,10 +484,10 @@ Vector<GVArray> evaluate_fields(ResourceScope &scope,
|
||||
});
|
||||
});
|
||||
}
|
||||
r_varrays[out_index] = dst_varray;
|
||||
varrays[out_index] = dst_varray;
|
||||
}
|
||||
}
|
||||
return r_varrays;
|
||||
return varrays;
|
||||
}
|
||||
|
||||
void evaluate_constant_field(const GField &field, void *r_value)
|
||||
|
||||
@@ -773,25 +773,25 @@ void MTLWriter::write_materials(const char *blen_filepath,
|
||||
|
||||
Vector<int> MTLWriter::add_materials(const OBJMesh &mesh_to_export)
|
||||
{
|
||||
Vector<int> r_mtl_indices;
|
||||
r_mtl_indices.resize(mesh_to_export.tot_materials());
|
||||
Vector<int> mtl_indices;
|
||||
mtl_indices.resize(mesh_to_export.tot_materials());
|
||||
for (int16_t i = 0; i < mesh_to_export.tot_materials(); i++) {
|
||||
const Material *material = mesh_to_export.materials[i];
|
||||
if (!material) {
|
||||
r_mtl_indices[i] = -1;
|
||||
mtl_indices[i] = -1;
|
||||
continue;
|
||||
}
|
||||
int mtlmat_index = material_map_.lookup_default(material, -1);
|
||||
if (mtlmat_index != -1) {
|
||||
r_mtl_indices[i] = mtlmat_index;
|
||||
mtl_indices[i] = mtlmat_index;
|
||||
}
|
||||
else {
|
||||
mtlmaterials_.append(mtlmaterial_for_material(material));
|
||||
r_mtl_indices[i] = mtlmaterials_.size() - 1;
|
||||
material_map_.add_new(material, r_mtl_indices[i]);
|
||||
mtl_indices[i] = mtlmaterials_.size() - 1;
|
||||
material_map_.add_new(material, mtl_indices[i]);
|
||||
}
|
||||
}
|
||||
return r_mtl_indices;
|
||||
return mtl_indices;
|
||||
}
|
||||
|
||||
const char *MTLWriter::mtlmaterial_name(int index)
|
||||
|
||||
@@ -258,12 +258,12 @@ PointerRNA RNA_pointer_recast(PointerRNA *ptr)
|
||||
#if 0 /* works but this case if covered by more general code below. */
|
||||
if (RNA_struct_is_ID(ptr->type)) {
|
||||
/* simple case */
|
||||
*r_ptr = RNA_id_pointer_create(ptr->owner_id);
|
||||
return RNA_id_pointer_create(ptr->owner_id);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
PointerRNA r_ptr{*ptr};
|
||||
PointerRNA ptr_result{*ptr};
|
||||
PointerRNA t_ptr{*ptr};
|
||||
StructRNA *base;
|
||||
|
||||
@@ -271,10 +271,10 @@ PointerRNA RNA_pointer_recast(PointerRNA *ptr)
|
||||
t_ptr.type = base;
|
||||
rna_pointer_refine(t_ptr);
|
||||
if (t_ptr.type && t_ptr.type != ptr->type) {
|
||||
r_ptr = t_ptr;
|
||||
ptr_result = t_ptr;
|
||||
}
|
||||
}
|
||||
return r_ptr;
|
||||
return ptr_result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -841,12 +841,12 @@ PropertyRNA *RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
|
||||
{
|
||||
if (identifier[0] == '[' && identifier[1] == '"') {
|
||||
/* id prop lookup, not so common */
|
||||
PropertyRNA *r_prop = nullptr;
|
||||
PointerRNA r_ptr; /* only support single level props */
|
||||
if (RNA_path_resolve_property(ptr, identifier, &r_ptr, &r_prop) && (r_ptr.type == ptr->type) &&
|
||||
(r_ptr.data == ptr->data))
|
||||
PropertyRNA *prop_test = nullptr;
|
||||
PointerRNA ptr_test; /* only support single level props */
|
||||
if (RNA_path_resolve_property(ptr, identifier, &ptr_test, &prop_test) &&
|
||||
(ptr_test.type == ptr->type) && (ptr_test.data == ptr->data))
|
||||
{
|
||||
return r_prop;
|
||||
return prop_test;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -2421,12 +2421,12 @@ bool RNA_property_path_from_ID_check(PointerRNA *ptr, PropertyRNA *prop)
|
||||
bool ret = false;
|
||||
|
||||
if (path) {
|
||||
PointerRNA r_ptr;
|
||||
PropertyRNA *r_prop;
|
||||
PointerRNA ptr_test;
|
||||
PropertyRNA *prop_test;
|
||||
|
||||
PointerRNA id_ptr = RNA_id_pointer_create(ptr->owner_id);
|
||||
if (RNA_path_resolve(&id_ptr, path->c_str(), &r_ptr, &r_prop) == true) {
|
||||
ret = (prop == r_prop);
|
||||
if (RNA_path_resolve(&id_ptr, path->c_str(), &ptr_test, &prop_test) == true) {
|
||||
ret = (prop == prop_test);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -597,9 +597,9 @@ static const EnumPropertyItem *rna_NodeTreeInterfaceSocket_attribute_domain_item
|
||||
static PointerRNA rna_NodeTreeInterfaceItems_active_get(PointerRNA *ptr)
|
||||
{
|
||||
bNodeTreeInterface *interface = static_cast<bNodeTreeInterface *>(ptr->data);
|
||||
PointerRNA r_ptr = RNA_pointer_create_discrete(
|
||||
PointerRNA ptr_result = RNA_pointer_create_discrete(
|
||||
ptr->owner_id, &RNA_NodeTreeInterfaceItem, interface->active_item());
|
||||
return r_ptr;
|
||||
return ptr_result;
|
||||
}
|
||||
|
||||
static void rna_NodeTreeInterfaceItems_active_set(PointerRNA *ptr,
|
||||
|
||||
@@ -3714,8 +3714,8 @@ static PointerRNA rna_Node_paired_output_get(PointerRNA *ptr)
|
||||
const blender::bke::bNodeZoneType &zone_type = *blender::bke::zone_type_by_node_type(
|
||||
node->type_legacy);
|
||||
bNode *output_node = zone_type.get_corresponding_output(*ntree, *node);
|
||||
PointerRNA r_ptr = RNA_pointer_create_discrete(&ntree->id, &RNA_Node, output_node);
|
||||
return r_ptr;
|
||||
PointerRNA ptr_result = RNA_pointer_create_discrete(&ntree->id, &RNA_Node, output_node);
|
||||
return ptr_result;
|
||||
}
|
||||
|
||||
static bool rna_Node_pair_with_output(
|
||||
|
||||
@@ -95,7 +95,7 @@ static Strip *rna_Strip_split(
|
||||
ListBase *seqbase = blender::seq::get_seqbase_by_strip(scene, strip);
|
||||
|
||||
const char *error_msg = nullptr;
|
||||
Strip *r_seq = blender::seq::edit_strip_split(
|
||||
Strip *strip_split = blender::seq::edit_strip_split(
|
||||
bmain, scene, seqbase, strip, frame, blender::seq::eSplitMethod(split_method), &error_msg);
|
||||
if (error_msg != nullptr) {
|
||||
BKE_report(reports, RPT_ERROR, error_msg);
|
||||
@@ -107,7 +107,7 @@ static Strip *rna_Strip_split(
|
||||
|
||||
WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene);
|
||||
|
||||
return r_seq;
|
||||
return strip_split;
|
||||
}
|
||||
|
||||
static Strip *rna_Strip_parent_meta(ID *id, Strip *strip_self)
|
||||
|
||||
@@ -3182,9 +3182,9 @@ static void rna_FileBrowser_FSMenu_begin(CollectionPropertyIterator *iter, FSMen
|
||||
static PointerRNA rna_FileBrowser_FSMenu_get(CollectionPropertyIterator *iter)
|
||||
{
|
||||
ListBaseIterator *internal = &iter->internal.listbase;
|
||||
PointerRNA r_ptr = RNA_pointer_create_with_parent(
|
||||
PointerRNA ptr_result = RNA_pointer_create_with_parent(
|
||||
iter->parent, &RNA_FileBrowserFSMenuEntry, internal->link);
|
||||
return r_ptr;
|
||||
return ptr_result;
|
||||
}
|
||||
|
||||
static void rna_FileBrowser_FSMenu_end(CollectionPropertyIterator * /*iter*/) {}
|
||||
|
||||
@@ -625,8 +625,8 @@ static PointerRNA rna_PopMenuBegin(bContext *C,
|
||||
}
|
||||
|
||||
void *data = (void *)UI_popup_menu_begin(C, title, icon);
|
||||
PointerRNA r_ptr = RNA_pointer_create_discrete(nullptr, &RNA_UIPopupMenu, data);
|
||||
return r_ptr;
|
||||
PointerRNA ptr_result = RNA_pointer_create_discrete(nullptr, &RNA_UIPopupMenu, data);
|
||||
return ptr_result;
|
||||
}
|
||||
|
||||
static void rna_PopMenuEnd(bContext *C, PointerRNA *handle)
|
||||
@@ -645,8 +645,8 @@ static PointerRNA rna_PopoverBegin(bContext *C,
|
||||
}
|
||||
|
||||
void *data = (void *)UI_popover_begin(C, U.widget_unit * ui_units_x, from_active_button);
|
||||
PointerRNA r_ptr = RNA_pointer_create_discrete(nullptr, &RNA_UIPopover, data);
|
||||
return r_ptr;
|
||||
PointerRNA ptr_result = RNA_pointer_create_discrete(nullptr, &RNA_UIPopover, data);
|
||||
return ptr_result;
|
||||
}
|
||||
|
||||
static void rna_PopoverEnd(bContext *C, PointerRNA *handle, wmKeyMap *keymap)
|
||||
@@ -665,8 +665,8 @@ static PointerRNA rna_PieMenuBegin(
|
||||
void *data = (void *)UI_pie_menu_begin(
|
||||
C, title, icon, static_cast<const wmEvent *>(event->data));
|
||||
|
||||
PointerRNA r_ptr = RNA_pointer_create_discrete(nullptr, &RNA_UIPieMenu, data);
|
||||
return r_ptr;
|
||||
PointerRNA ptr_result = RNA_pointer_create_discrete(nullptr, &RNA_UIPieMenu, data);
|
||||
return ptr_result;
|
||||
}
|
||||
|
||||
static void rna_PieMenuEnd(bContext *C, PointerRNA *handle)
|
||||
|
||||
@@ -53,10 +53,10 @@ static const mf::MultiFunction *get_multi_function(const bNode &bnode)
|
||||
"RGB", [](float r, float g, float b, float a) { return ColorGeometry4f(r, g, b, a); });
|
||||
static auto hsva_fn = mf::build::SI4_SO<float, float, float, float, ColorGeometry4f>(
|
||||
"HSV", [](float h, float s, float v, float a) {
|
||||
ColorGeometry4f r_color;
|
||||
hsv_to_rgb(h, s, v, &r_color.r, &r_color.g, &r_color.b);
|
||||
r_color.a = a;
|
||||
return r_color;
|
||||
ColorGeometry4f color;
|
||||
hsv_to_rgb(h, s, v, &color.r, &color.g, &color.b);
|
||||
color.a = a;
|
||||
return color;
|
||||
});
|
||||
static auto hsla_fn = mf::build::SI4_SO<float, float, float, float, ColorGeometry4f>(
|
||||
"HSL", [](float h, float s, float l, float a) {
|
||||
|
||||
@@ -308,8 +308,8 @@ static void node_geo_exec(GeoNodeExecParams params)
|
||||
|
||||
switch (mode) {
|
||||
case GEO_NODE_CURVE_PRIMITIVE_ARC_TYPE_POINTS: {
|
||||
float3 r_center, r_normal;
|
||||
float r_radius;
|
||||
float3 center, normal;
|
||||
float radius;
|
||||
Curves *curves = create_arc_curve_from_points(
|
||||
std::max(params.extract_input<int>("Resolution"), 2),
|
||||
params.extract_input<float3>("Start"),
|
||||
@@ -318,13 +318,13 @@ static void node_geo_exec(GeoNodeExecParams params)
|
||||
params.extract_input<float>("Offset Angle"),
|
||||
params.extract_input<bool>("Connect Center"),
|
||||
params.extract_input<bool>("Invert Arc"),
|
||||
r_center,
|
||||
r_normal,
|
||||
r_radius);
|
||||
center,
|
||||
normal,
|
||||
radius);
|
||||
params.set_output("Curve", GeometrySet::from_curves(curves));
|
||||
params.set_output("Center", r_center);
|
||||
params.set_output("Normal", r_normal);
|
||||
params.set_output("Radius", r_radius);
|
||||
params.set_output("Center", center);
|
||||
params.set_output("Normal", normal);
|
||||
params.set_output("Radius", radius);
|
||||
break;
|
||||
}
|
||||
case GEO_NODE_CURVE_PRIMITIVE_ARC_TYPE_RADIUS: {
|
||||
|
||||
Reference in New Issue
Block a user