WIP: Brush assets project #106303
|
@ -231,7 +231,7 @@ class IMAGE_MT_image(Menu):
|
|||
|
||||
layout.menu("IMAGE_MT_image_invert")
|
||||
layout.operator("image.resize", text="Resize")
|
||||
layout.menu("IMAGE_MT_image_flip")
|
||||
layout.menu("IMAGE_MT_image_transform")
|
||||
|
||||
if ima and not show_render:
|
||||
if ima.packed_file:
|
||||
|
@ -248,13 +248,17 @@ class IMAGE_MT_image(Menu):
|
|||
layout.operator("gpencil.image_to_grease_pencil", text="Generate Grease Pencil")
|
||||
|
||||
|
||||
class IMAGE_MT_image_flip(Menu):
|
||||
bl_label = "Flip"
|
||||
class IMAGE_MT_image_transform(Menu):
|
||||
bl_label = "Transform"
|
||||
|
||||
def draw(self, _context):
|
||||
layout = self.layout
|
||||
layout.operator("image.flip", text="Horizontally").use_flip_x = True
|
||||
layout.operator("image.flip", text="Vertically").use_flip_y = True
|
||||
layout.operator("image.flip", text="Flip Horizontally").use_flip_x = True
|
||||
layout.operator("image.flip", text="Flip Vertically").use_flip_y = True
|
||||
layout.separator()
|
||||
layout.operator("image.rotate_orthogonal", text="Rotate 90\u00B0 Clockwise").degrees = '90'
|
||||
layout.operator("image.rotate_orthogonal", text="Rotate 90\u00B0 Counter-Clockwise").degrees = '270'
|
||||
layout.operator("image.rotate_orthogonal", text="Rotate 180\u00B0").degrees = '180'
|
||||
|
||||
|
||||
class IMAGE_MT_image_invert(Menu):
|
||||
|
@ -1684,7 +1688,7 @@ classes = (
|
|||
IMAGE_MT_select,
|
||||
IMAGE_MT_select_linked,
|
||||
IMAGE_MT_image,
|
||||
IMAGE_MT_image_flip,
|
||||
IMAGE_MT_image_transform,
|
||||
IMAGE_MT_image_invert,
|
||||
IMAGE_MT_uvs,
|
||||
IMAGE_MT_uvs_showhide,
|
||||
|
|
|
@ -372,12 +372,6 @@ void BKE_blender_userdef_app_template_data_swap(UserDef *userdef_a, UserDef *use
|
|||
} \
|
||||
((void)0)
|
||||
|
||||
#define LISTBASE_SWAP(id) \
|
||||
{ \
|
||||
SWAP(ListBase, userdef_a->id, userdef_b->id); \
|
||||
} \
|
||||
((void)0)
|
||||
|
||||
#define FLAG_SWAP(id, ty, flags) \
|
||||
{ \
|
||||
CHECK_TYPE(&(userdef_a->id), ty *); \
|
||||
|
@ -389,12 +383,12 @@ void BKE_blender_userdef_app_template_data_swap(UserDef *userdef_a, UserDef *use
|
|||
} \
|
||||
((void)0)
|
||||
|
||||
LISTBASE_SWAP(uistyles);
|
||||
LISTBASE_SWAP(uifonts);
|
||||
LISTBASE_SWAP(themes);
|
||||
LISTBASE_SWAP(addons);
|
||||
LISTBASE_SWAP(user_keymaps);
|
||||
LISTBASE_SWAP(user_keyconfig_prefs);
|
||||
std::swap(userdef_a->uistyles, userdef_b->uistyles);
|
||||
std::swap(userdef_a->uifonts, userdef_b->uifonts);
|
||||
std::swap(userdef_a->themes, userdef_b->themes);
|
||||
std::swap(userdef_a->addons, userdef_b->addons);
|
||||
std::swap(userdef_a->user_keymaps, userdef_b->user_keymaps);
|
||||
std::swap(userdef_a->user_keyconfig_prefs, userdef_b->user_keyconfig_prefs);
|
||||
|
||||
DATA_SWAP(font_path_ui);
|
||||
DATA_SWAP(font_path_ui_mono);
|
||||
|
|
|
@ -513,7 +513,7 @@ static void swap_old_bmain_data_for_blendfile(ReuseOldBMainData *reuse_data, con
|
|||
BLI_assert(BLI_listbase_is_empty(old_lb) || !ID_IS_LINKED(old_lb->last));
|
||||
BLI_assert(BLI_listbase_is_empty(new_lb) || !ID_IS_LINKED(new_lb->last));
|
||||
|
||||
SWAP(ListBase, *new_lb, *old_lb);
|
||||
std::swap(*new_lb, *old_lb);
|
||||
|
||||
/* TODO: Could add per-IDType control over namemaps clearing, if this becomes a performances
|
||||
* concern. */
|
||||
|
|
|
@ -1101,7 +1101,7 @@ static void cloth_selfcollision(void *__restrict userdata,
|
|||
int indexA = data->overlap[index].indexA, indexB = data->overlap[index].indexB;
|
||||
|
||||
if (indexA > indexB) {
|
||||
SWAP(int, indexA, indexB);
|
||||
std::swap( indexA, indexB);
|
||||
}
|
||||
|
||||
const blender::int3 vert_tri_a = clmd->clothObject->vert_tris[indexA];
|
||||
|
|
|
@ -1343,7 +1343,7 @@ void sort_time_fcurve(FCurve *fcu)
|
|||
if (a < (fcu->totvert - 1)) {
|
||||
/* Swap if one is after the other (and indicate that order has changed). */
|
||||
if (bezt->vec[1][0] > (bezt + 1)->vec[1][0]) {
|
||||
SWAP(BezTriple, *bezt, *(bezt + 1));
|
||||
std::swap(*bezt, *(bezt + 1));
|
||||
ok = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -860,7 +860,7 @@ void IDP_CopyPropertyContent(IDProperty *dst, const IDProperty *src)
|
|||
IDProperty *idprop_tmp = IDP_CopyProperty(src);
|
||||
idprop_tmp->prev = dst->prev;
|
||||
idprop_tmp->next = dst->next;
|
||||
SWAP(IDProperty, *dst, *idprop_tmp);
|
||||
std::swap(*dst, *idprop_tmp);
|
||||
IDP_FreeProperty(idprop_tmp);
|
||||
}
|
||||
|
||||
|
|
|
@ -903,7 +903,7 @@ static void id_embedded_swap(ID **embedded_id_a,
|
|||
remapper_id_b,
|
||||
0);
|
||||
/* Manual 'remap' of owning embedded pointer in owner ID. */
|
||||
SWAP(ID *, *embedded_id_a, *embedded_id_b);
|
||||
std::swap(*embedded_id_a, *embedded_id_b);
|
||||
|
||||
/* Restore internal pointers to the swapped embedded IDs in their owners' data. This also
|
||||
* includes the potential self-references inside the embedded IDs themselves. */
|
||||
|
|
|
@ -449,8 +449,8 @@ void BKE_mask_point_direction_switch(MaskSplinePoint *point)
|
|||
copy_v2_v2(point->bezt.vec[0], point->bezt.vec[2]);
|
||||
copy_v2_v2(point->bezt.vec[2], co_tmp);
|
||||
/* in this case the flags are unlikely to be different but swap anyway */
|
||||
SWAP(uint8_t, point->bezt.f1, point->bezt.f3);
|
||||
SWAP(uint8_t, point->bezt.h1, point->bezt.h2);
|
||||
std::swap(point->bezt.f1, point->bezt.f3);
|
||||
std::swap(point->bezt.h1, point->bezt.h2);
|
||||
|
||||
/* swap UW's */
|
||||
if (tot_uw > 1) {
|
||||
|
@ -458,7 +458,7 @@ void BKE_mask_point_direction_switch(MaskSplinePoint *point)
|
|||
for (int i = 0; i < tot_uw_half; i++) {
|
||||
MaskSplinePointUW *uw_a = &point->uw[i];
|
||||
MaskSplinePointUW *uw_b = &point->uw[tot_uw - (i + 1)];
|
||||
SWAP(MaskSplinePointUW, *uw_a, *uw_b);
|
||||
std::swap(*uw_a, *uw_b);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -482,7 +482,7 @@ void BKE_mask_spline_direction_switch(MaskLayer *masklay, MaskSpline *spline)
|
|||
for (i = 0; i < tot_point_half; i++) {
|
||||
MaskSplinePoint *point_a = &spline->points[i];
|
||||
MaskSplinePoint *point_b = &spline->points[tot_point - (i + 1)];
|
||||
SWAP(MaskSplinePoint, *point_a, *point_b);
|
||||
std::swap(*point_a, *point_b);
|
||||
}
|
||||
|
||||
/* correct UW's */
|
||||
|
@ -491,8 +491,8 @@ void BKE_mask_spline_direction_switch(MaskLayer *masklay, MaskSpline *spline)
|
|||
|
||||
BKE_mask_point_direction_switch(&spline->points[i]);
|
||||
|
||||
SWAP(MaskSplinePointUW *, spline->points[i].uw, spline->points[i_prev].uw);
|
||||
SWAP(int, spline->points[i].tot_uw, spline->points[i_prev].tot_uw);
|
||||
std::swap(spline->points[i].uw, spline->points[i_prev].uw);
|
||||
std::swap(spline->points[i].tot_uw, spline->points[i_prev].tot_uw);
|
||||
|
||||
i_prev = i;
|
||||
}
|
||||
|
@ -507,7 +507,7 @@ void BKE_mask_spline_direction_switch(MaskLayer *masklay, MaskSpline *spline)
|
|||
for (i = 0; i < tot_point_half; i++) {
|
||||
MaskLayerShapeElem *fp_a = &fp_arr[spline_index + (i)];
|
||||
MaskLayerShapeElem *fp_b = &fp_arr[spline_index + (tot_point - (i + 1))];
|
||||
SWAP(MaskLayerShapeElem, *fp_a, *fp_b);
|
||||
std::swap(*fp_a, *fp_b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -851,14 +851,14 @@ MaskSplinePointUW *BKE_mask_point_sort_uw(MaskSplinePoint *point, MaskSplinePoin
|
|||
|
||||
if (idx > 0 && point->uw[idx - 1].u > uw->u) {
|
||||
while (idx > 0 && point->uw[idx - 1].u > point->uw[idx].u) {
|
||||
SWAP(MaskSplinePointUW, point->uw[idx - 1], point->uw[idx]);
|
||||
std::swap(point->uw[idx - 1], point->uw[idx]);
|
||||
idx--;
|
||||
}
|
||||
}
|
||||
|
||||
if (idx < point->tot_uw - 1 && point->uw[idx + 1].u < uw->u) {
|
||||
while (idx < point->tot_uw - 1 && point->uw[idx + 1].u < point->uw[idx].u) {
|
||||
SWAP(MaskSplinePointUW, point->uw[idx + 1], point->uw[idx]);
|
||||
std::swap(point->uw[idx + 1], point->uw[idx]);
|
||||
idx++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -778,7 +778,7 @@ bool BKE_nlastrips_has_space(ListBase *strips, float start, float end)
|
|||
}
|
||||
if (start > end) {
|
||||
puts("BKE_nlastrips_has_space() error... start and end arguments swapped");
|
||||
SWAP(float, start, end);
|
||||
std::swap(start, end);
|
||||
}
|
||||
|
||||
/* loop over NLA strips checking for any overlaps with this area... */
|
||||
|
@ -1235,7 +1235,7 @@ bool BKE_nlatrack_has_space(NlaTrack *nlt, float start, float end)
|
|||
|
||||
if (start > end) {
|
||||
puts("BKE_nlatrack_has_space() error... start and end arguments swapped");
|
||||
SWAP(float, start, end);
|
||||
std::swap(start, end);
|
||||
}
|
||||
|
||||
/* check if there's any space left in the track for a strip of the given length */
|
||||
|
|
|
@ -212,7 +212,7 @@ static void split_pixel_node(
|
|||
if (mid < co1[axis]) {
|
||||
t = 1.0f - (mid - co2[axis]) / (co1[axis] - co2[axis]);
|
||||
|
||||
SWAP(UDIMTilePixels *, tile1, tile2);
|
||||
std::swap(tile1, tile2);
|
||||
}
|
||||
else {
|
||||
t = (mid - co1[axis]) / (co2[axis] - co1[axis]);
|
||||
|
|
|
@ -699,7 +699,7 @@ static void studiolight_radiance_preview(uint *icon_buffer, StudioLight *sl)
|
|||
sphere_normal_from_uv(normal, dx, dy);
|
||||
reflect_v3_v3v3(direction, incoming, normal);
|
||||
/* We want to see horizon not poles. */
|
||||
SWAP(float, direction[1], direction[2]);
|
||||
std::swap(direction[1], direction[2]);
|
||||
direction[1] = -direction[1];
|
||||
|
||||
float4 color = studiolight_calculate_radiance(sl->equirect_radiance_buffer, direction);
|
||||
|
@ -762,7 +762,7 @@ static void studiolight_irradiance_preview(uint *icon_buffer, StudioLight *sl)
|
|||
float normal[3], color[3];
|
||||
sphere_normal_from_uv(normal, dx, dy);
|
||||
/* We want to see horizon not poles. */
|
||||
SWAP(float, normal[1], normal[2]);
|
||||
std::swap(normal[1], normal[2]);
|
||||
normal[1] = -normal[1];
|
||||
|
||||
studiolight_lights_eval(sl, color, normal);
|
||||
|
|
|
@ -41,10 +41,6 @@ MINLINE void swap_v2_v2(float a[2], float b[2]);
|
|||
MINLINE void swap_v3_v3(float a[3], float b[3]);
|
||||
MINLINE void swap_v4_v4(float a[4], float b[4]);
|
||||
|
||||
MINLINE void swap_v2_v2_db(double a[2], double b[2]);
|
||||
MINLINE void swap_v3_v3_db(double a[3], double b[3]);
|
||||
MINLINE void swap_v4_v4_db(double a[4], double b[4]);
|
||||
|
||||
/* unsigned char */
|
||||
|
||||
MINLINE void copy_v2_v2_uchar(unsigned char r[2], const unsigned char a[2]);
|
||||
|
|
|
@ -67,17 +67,6 @@ extern "C" {
|
|||
} \
|
||||
(void)0
|
||||
|
||||
/* swap with a temp value */
|
||||
#define SWAP_TVAL(tval, a, b) \
|
||||
{ \
|
||||
CHECK_TYPE_PAIR(tval, a); \
|
||||
CHECK_TYPE_PAIR(tval, b); \
|
||||
(tval) = (a); \
|
||||
(a) = (b); \
|
||||
(b) = (tval); \
|
||||
} \
|
||||
(void)0
|
||||
|
||||
/* shift around elements */
|
||||
#define SHIFT3(type, a, b, c) \
|
||||
{ \
|
||||
|
|
|
@ -70,25 +70,12 @@ struct Heap {
|
|||
|
||||
BLI_INLINE void heap_swap(Heap *heap, const uint i, const uint j)
|
||||
{
|
||||
#if 1
|
||||
HeapNode **tree = heap->tree;
|
||||
HeapNode *pi = tree[i], *pj = tree[j];
|
||||
pi->index = j;
|
||||
tree[j] = pi;
|
||||
pj->index = i;
|
||||
tree[i] = pj;
|
||||
#elif 0
|
||||
SWAP(uint, heap->tree[i]->index, heap->tree[j]->index);
|
||||
SWAP(HeapNode *, heap->tree[i], heap->tree[j]);
|
||||
#else
|
||||
HeapNode **tree = heap->tree;
|
||||
union {
|
||||
uint index;
|
||||
HeapNode *node;
|
||||
} tmp;
|
||||
SWAP_TVAL(tmp.index, tree[i]->index, tree[j]->index);
|
||||
SWAP_TVAL(tmp.node, tree[i], tree[j]);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void heap_down(Heap *heap, uint i)
|
||||
|
|
|
@ -70,7 +70,7 @@ void BLI_listbase_split_after(ListBase *original_listbase, ListBase *split_listb
|
|||
|
||||
if (vlink == nullptr) {
|
||||
/* Move everything into `split_listbase`. */
|
||||
SWAP(ListBase, *original_listbase, *split_listbase);
|
||||
std::swap(*original_listbase, *split_listbase);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1260,8 +1260,8 @@ int isect_seg_seg_v2_point_ex(const float v0[2],
|
|||
if (equals_v2v2(v0, v1)) {
|
||||
if (len_squared_v2v2(v2, v3) > square_f(eps)) {
|
||||
/* use non-point segment as basis */
|
||||
SWAP(const float *, v0, v2);
|
||||
SWAP(const float *, v1, v3);
|
||||
std::swap(v0, v2);
|
||||
std::swap(v1, v3);
|
||||
|
||||
sub_v2_v2v2(s10, v1, v0);
|
||||
sub_v2_v2v2(s30, v3, v0);
|
||||
|
@ -1283,7 +1283,7 @@ int isect_seg_seg_v2_point_ex(const float v0[2],
|
|||
u_b = dot_v2v2(s30, s10) / dot_v2v2(s10, s10);
|
||||
|
||||
if (u_a > u_b) {
|
||||
SWAP(float, u_a, u_b);
|
||||
std::swap(u_a, u_b);
|
||||
}
|
||||
|
||||
if (u_a > endpoint_max || u_b < endpoint_min) {
|
||||
|
@ -1795,7 +1795,7 @@ void isect_ray_tri_watertight_v3_precalc(IsectRayPrecalc *isect_precalc,
|
|||
|
||||
/* Swap kx and ky dimensions to preserve winding direction of triangles. */
|
||||
if (ray_direction[kz] < 0.0f) {
|
||||
SWAP(int, kx, ky);
|
||||
std::swap(kx, ky);
|
||||
}
|
||||
|
||||
/* Calculate the shear constants. */
|
||||
|
@ -2320,9 +2320,9 @@ bool isect_tri_tri_v3_ex(const float tri_a[3][3],
|
|||
double offset1 = fac1 * (dot_c - dot_b);
|
||||
if (offset0 > offset1) {
|
||||
/* Sort min max. */
|
||||
SWAP(double, offset0, offset1);
|
||||
SWAP(float, fac0, fac1);
|
||||
SWAP(int, tri_i[0], tri_i[2]);
|
||||
std::swap(offset0, offset1);
|
||||
std::swap(fac0, fac1);
|
||||
std::swap(tri_i[0], tri_i[2]);
|
||||
}
|
||||
|
||||
range[i].min = float(dot_b + offset0);
|
||||
|
@ -2586,7 +2586,7 @@ static bool getLowestRoot(
|
|||
|
||||
/* Sort so x1 <= x2 */
|
||||
if (r1 > r2) {
|
||||
SWAP(float, r1, r2);
|
||||
std::swap(r1, r2);
|
||||
}
|
||||
|
||||
/* Get lowest root: */
|
||||
|
@ -2669,7 +2669,7 @@ bool isect_sweeping_sphere_tri_v3(const float p1[3],
|
|||
float t1 = (-a - radius) / nordotv;
|
||||
|
||||
if (t0 > t1) {
|
||||
SWAP(float, t0, t1);
|
||||
std::swap(t0, t1);
|
||||
}
|
||||
|
||||
if (t0 > 1.0f || t1 < 0.0f) {
|
||||
|
@ -3646,7 +3646,7 @@ void interp_weights_quad_v3(float w[4],
|
|||
cross_v3_v3v3(n, n1, n2);
|
||||
|
||||
ok = barycentric_weights(v1, v2, v4, co, n, w);
|
||||
SWAP(float, w[2], w[3]);
|
||||
std::swap(w[2], w[3]);
|
||||
|
||||
if (!ok || (w[0] < 0.0f)) {
|
||||
/* if w[1] is negative, co is on the other side of the v1-v3 edge,
|
||||
|
|
|
@ -317,27 +317,6 @@ MINLINE void swap_v4_v4(float a[4], float b[4])
|
|||
SWAP(float, a[3], b[3]);
|
||||
}
|
||||
|
||||
MINLINE void swap_v2_v2_db(double a[2], double b[2])
|
||||
{
|
||||
SWAP(double, a[0], b[0]);
|
||||
SWAP(double, a[1], b[1]);
|
||||
}
|
||||
|
||||
MINLINE void swap_v3_v3_db(double a[3], double b[3])
|
||||
{
|
||||
SWAP(double, a[0], b[0]);
|
||||
SWAP(double, a[1], b[1]);
|
||||
SWAP(double, a[2], b[2]);
|
||||
}
|
||||
|
||||
MINLINE void swap_v4_v4_db(double a[4], double b[4])
|
||||
{
|
||||
SWAP(double, a[0], b[0]);
|
||||
SWAP(double, a[1], b[1]);
|
||||
SWAP(double, a[2], b[2]);
|
||||
SWAP(double, a[3], b[3]);
|
||||
}
|
||||
|
||||
/* float args -> vec */
|
||||
|
||||
MINLINE void copy_v2_fl2(float v[2], float x, float y)
|
||||
|
|
|
@ -360,7 +360,7 @@ static void do_versions_mesh_mloopcol_swap_2_62_1(Mesh *mesh)
|
|||
if (layer->type == CD_PROP_BYTE_COLOR) {
|
||||
MLoopCol *mloopcol = static_cast<MLoopCol *>(layer->data);
|
||||
for (int i = 0; i < mesh->corners_num; i++, mloopcol++) {
|
||||
SWAP(uchar, mloopcol->r, mloopcol->b);
|
||||
std::swap(mloopcol->r, mloopcol->b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4581,7 +4581,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
|||
if (!DNA_struct_member_exists(fd->filesdna, "SceneDisplay", "float", "shadow_focus")) {
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
float *dir = scene->display.light_direction;
|
||||
SWAP(float, dir[2], dir[1]);
|
||||
std::swap(dir[2], dir[1]);
|
||||
dir[2] = -dir[2];
|
||||
dir[0] = -dir[0];
|
||||
}
|
||||
|
|
|
@ -1044,7 +1044,7 @@ void bmesh_kernel_loop_reverse(BMesh *bm,
|
|||
l_iter->e = e_prev;
|
||||
#endif
|
||||
|
||||
SWAP(BMLoop *, l_iter->next, l_iter->prev);
|
||||
std::swap(l_iter->next, l_iter->prev);
|
||||
|
||||
if (cd_loop_mdisp_offset != -1) {
|
||||
MDisps *md = static_cast<MDisps *>(BM_ELEM_CD_GET_VOID_P(l_iter, cd_loop_mdisp_offset));
|
||||
|
@ -2691,9 +2691,9 @@ void bmesh_face_swap_data(BMFace *f_a, BMFace *f_b)
|
|||
l_iter->f = f_a;
|
||||
} while ((l_iter = l_iter->next) != l_first);
|
||||
|
||||
SWAP(BMFace, (*f_a), (*f_b));
|
||||
std::swap((*f_a), (*f_b));
|
||||
|
||||
/* swap back */
|
||||
SWAP(void *, f_a->head.data, f_b->head.data);
|
||||
SWAP(int, f_a->head.index, f_b->head.index);
|
||||
std::swap(f_a->head.data, f_b->head.data);
|
||||
std::swap(f_a->head.index, f_b->head.index);
|
||||
}
|
||||
|
|
|
@ -771,7 +771,7 @@ bool BM_edgeloop_overlap_check(BMEdgeLoopStore *el_store_a, BMEdgeLoopStore *el_
|
|||
{
|
||||
/* A little more efficient if 'a' as smaller. */
|
||||
if (el_store_a->len > el_store_b->len) {
|
||||
SWAP(BMEdgeLoopStore *, el_store_a, el_store_b);
|
||||
std::swap(el_store_a, el_store_b);
|
||||
}
|
||||
|
||||
/* init */
|
||||
|
|
|
@ -331,7 +331,7 @@ static void bm_log_vert_values_swap(BMesh *bm, BMLog *log, GHash *verts)
|
|||
|
||||
swap_v3_v3(v->co, lv->co);
|
||||
swap_v3_v3(v->no, lv->no);
|
||||
SWAP(char, v->head.hflag, lv->hflag);
|
||||
std::swap(v->head.hflag, lv->hflag);
|
||||
mask = lv->mask;
|
||||
lv->mask = vert_mask_get(v, cd_vert_mask_offset);
|
||||
vert_mask_set(v, mask, cd_vert_mask_offset);
|
||||
|
@ -347,7 +347,7 @@ static void bm_log_face_values_swap(BMLog *log, GHash *faces)
|
|||
uint id = POINTER_AS_UINT(key);
|
||||
BMFace *f = bm_log_face_from_id(log, id);
|
||||
|
||||
SWAP(char, f->head.hflag, lf->hflag);
|
||||
std::swap(f->head.hflag, lf->hflag);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -569,8 +569,8 @@ BMVert *BM_edge_split_n(BMesh *bm, BMEdge *e, int numcuts, BMVert **r_varr)
|
|||
|
||||
void BM_edge_verts_swap(BMEdge *e)
|
||||
{
|
||||
SWAP(BMVert *, e->v1, e->v2);
|
||||
SWAP(BMDiskLink, e->v1_disk_link, e->v2_disk_link);
|
||||
std::swap(e->v1, e->v2);
|
||||
std::swap(e->v1_disk_link, e->v2_disk_link);
|
||||
}
|
||||
|
||||
void BM_edge_calc_rotate(BMEdge *e, const bool ccw, BMLoop **r_l1, BMLoop **r_l2)
|
||||
|
@ -592,7 +592,7 @@ void BM_edge_calc_rotate(BMEdge *e, const bool ccw, BMLoop **r_l1, BMLoop **r_l2
|
|||
* gives more predictable results since that way the next vert
|
||||
* just stitches from face fa / fb */
|
||||
if (!ccw) {
|
||||
SWAP(BMFace *, fa, fb);
|
||||
std::swap(fa, fb);
|
||||
}
|
||||
|
||||
*r_l1 = BM_face_other_vert_loop(fb, v2, v1);
|
||||
|
|
|
@ -201,7 +201,7 @@ static bool bm_face_split_edgenet_find_loop_pair(BMVert *v_init,
|
|||
swap = !swap;
|
||||
}
|
||||
if (swap) {
|
||||
SWAP(BMEdge *, e_pair[0], e_pair[1]);
|
||||
std::swap(e_pair[0], e_pair[1]);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -150,8 +150,8 @@ static void bridge_loop_pair(BMesh *bm,
|
|||
el_store_b_len = BM_edgeloop_length_get((BMEdgeLoopStore *)el_store_b);
|
||||
|
||||
if (el_store_a_len < el_store_b_len) {
|
||||
SWAP(int, el_store_a_len, el_store_b_len);
|
||||
SWAP(BMEdgeLoopStore *, el_store_a, el_store_b);
|
||||
std::swap(el_store_a_len, el_store_b_len);
|
||||
std::swap(el_store_a, el_store_b);
|
||||
}
|
||||
|
||||
if (use_merge) {
|
||||
|
|
|
@ -221,7 +221,7 @@ void bmo_edgenet_prepare_exec(BMesh *bm, BMOperator *op)
|
|||
}
|
||||
#endif
|
||||
if (dot_v3v3(dvec1, dvec2) < 0.0f) {
|
||||
SWAP(BMVert *, v3, v4);
|
||||
std::swap(v3, v4);
|
||||
}
|
||||
|
||||
e = BM_edge_create(bm, v1, v3, nullptr, BM_CREATE_NO_DOUBLE);
|
||||
|
|
|
@ -265,7 +265,7 @@ void bmo_extrude_vert_indiv_exec(BMesh *bm, BMOperator *op)
|
|||
/* not essential, but ensures face normals from extruded edges are contiguous */
|
||||
if (BM_vert_is_wire_endpoint(v)) {
|
||||
if (v->e->v1 == v) {
|
||||
SWAP(BMVert *, v, dupev);
|
||||
std::swap(v, dupev);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -596,7 +596,7 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op)
|
|||
/* not essential, but ensures face normals from extruded edges are contiguous */
|
||||
if (BM_vert_is_wire_endpoint(v)) {
|
||||
if (v->e->v1 == v) {
|
||||
SWAP(BMVert *, v, v2);
|
||||
std::swap(v, v2);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -176,7 +176,7 @@ static int hull_final_edges_lookup(HullFinalEdges *final_edges, BMVert *v1, BMVe
|
|||
|
||||
/* Use lower vertex pointer for hash key */
|
||||
if (v1 > v2) {
|
||||
SWAP(BMVert *, v1, v2);
|
||||
std::swap(v1, v2);
|
||||
}
|
||||
|
||||
adj = static_cast<ListBase *>(BLI_ghash_lookup(final_edges->edges, v1));
|
||||
|
@ -213,7 +213,7 @@ static HullFinalEdges *hull_final_edges(BLI_mempool *hull_triangles)
|
|||
|
||||
/* Use lower vertex pointer for hash key */
|
||||
if (v1 > v2) {
|
||||
SWAP(BMVert *, v1, v2);
|
||||
std::swap(v1, v2);
|
||||
}
|
||||
|
||||
adj = static_cast<ListBase *>(BLI_ghash_lookup(final_edges->edges, v1));
|
||||
|
|
|
@ -278,7 +278,7 @@ void bmo_weld_verts_exec(BMesh *bm, BMOperator *op)
|
|||
bmesh_face_swap_data(f_new, f);
|
||||
|
||||
if (bm->use_toolflags) {
|
||||
SWAP(BMFlagLayer *, ((BMFace_OFlag *)f)->oflags, ((BMFace_OFlag *)f_new)->oflags);
|
||||
std::swap(((BMFace_OFlag *)f)->oflags, ((BMFace_OFlag *)f_new)->oflags);
|
||||
}
|
||||
|
||||
BMO_face_flag_disable(bm, f, ELE_DEL);
|
||||
|
|
|
@ -247,7 +247,7 @@ static GSet *bm_edgering_pair_calc(BMesh *bm, ListBase *eloops_rim)
|
|||
pair_test.second = el_store_other;
|
||||
|
||||
if (pair_test.first > pair_test.second) {
|
||||
SWAP(const void *, pair_test.first, pair_test.second);
|
||||
std::swap(pair_test.first, pair_test.second);
|
||||
}
|
||||
|
||||
void **pair_key_p;
|
||||
|
|
|
@ -197,7 +197,7 @@ void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op)
|
|||
|
||||
if (winding_votes < 0) {
|
||||
LISTBASE_FOREACH (ScanFillFace *, sf_tri, &sf_ctx.fillfacebase) {
|
||||
SWAP(ScanFillVert *, sf_tri->v2, sf_tri->v3);
|
||||
std::swap(sf_tri->v2, sf_tri->v3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ static GSet *erot_gset_new()
|
|||
/* ensure v0 is smaller */
|
||||
#define EDGE_ORD(v0, v1) \
|
||||
if (v0 > v1) { \
|
||||
SWAP(int, v0, v1); \
|
||||
std::swap( v0, v1); \
|
||||
} \
|
||||
(void)0
|
||||
|
||||
|
|
|
@ -763,7 +763,7 @@ static bool contig_ldata_across_edge(BMesh *bm, BMEdge *e, BMFace *f1, BMFace *f
|
|||
* should now have lef1 and lef2 being f1 and f2 in either order.
|
||||
*/
|
||||
if (lef1->f == f2) {
|
||||
SWAP(BMLoop *, lef1, lef2);
|
||||
std::swap(lef1, lef2);
|
||||
}
|
||||
if (lef1->f != f1 || lef2->f != f2) {
|
||||
return false;
|
||||
|
@ -6405,13 +6405,13 @@ static BevVert *bevel_vert_construct(BMesh *bm, BevelParams *bp, BMVert *v)
|
|||
}
|
||||
if (ccw_test_sum < 0) {
|
||||
for (int i = 0; i <= (tot_edges / 2) - 1; i++) {
|
||||
SWAP(EdgeHalf, bv->edges[i], bv->edges[tot_edges - i - 1]);
|
||||
SWAP(BMFace *, bv->edges[i].fprev, bv->edges[i].fnext);
|
||||
SWAP(BMFace *, bv->edges[tot_edges - i - 1].fprev, bv->edges[tot_edges - i - 1].fnext);
|
||||
std::swap(bv->edges[i], bv->edges[tot_edges - i - 1]);
|
||||
std::swap(bv->edges[i].fprev, bv->edges[i].fnext);
|
||||
std::swap(bv->edges[tot_edges - i - 1].fprev, bv->edges[tot_edges - i - 1].fnext);
|
||||
}
|
||||
if (tot_edges % 2 == 1) {
|
||||
int i = tot_edges / 2;
|
||||
SWAP(BMFace *, bv->edges[i].fprev, bv->edges[i].fnext);
|
||||
std::swap(bv->edges[i].fprev, bv->edges[i].fnext);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -349,7 +349,7 @@ static BMVert *bm_isect_edge_tri(ISectState *s,
|
|||
float ix[3];
|
||||
|
||||
if (BM_elem_index_get(e_v0) > BM_elem_index_get(e_v1)) {
|
||||
SWAP(BMVert *, e_v0, e_v1);
|
||||
std::swap(e_v0, e_v1);
|
||||
}
|
||||
|
||||
#ifdef USE_PARANOID
|
||||
|
@ -374,11 +374,11 @@ static BMVert *bm_isect_edge_tri(ISectState *s,
|
|||
#define KEY_EDGE_TRI_ORDER(k) \
|
||||
{ \
|
||||
if (k[2] > k[3]) { \
|
||||
SWAP(int, k[2], k[3]); \
|
||||
std::swap(k[2], k[3]); \
|
||||
} \
|
||||
if (k[0] > k[2]) { \
|
||||
SWAP(int, k[0], k[2]); \
|
||||
SWAP(int, k[1], k[3]); \
|
||||
std::swap(k[0], k[2]); \
|
||||
std::swap(k[1], k[3]); \
|
||||
} \
|
||||
} \
|
||||
(void)0
|
||||
|
@ -1305,7 +1305,7 @@ bool BM_mesh_intersect(BMesh *bm,
|
|||
# endif
|
||||
}
|
||||
else {
|
||||
SWAP(BMVert *, v_a, v_b);
|
||||
std::swap(v_a, v_b);
|
||||
e = e_pair[1];
|
||||
# ifdef USE_PARANOID
|
||||
e_keep = e_pair[0];
|
||||
|
|
|
@ -59,7 +59,7 @@ static bool bm_vert_pair_share_best_splittable_face_cb(BMFace *f,
|
|||
float min = dot_v3v3(l_a->v->co, no);
|
||||
float max = dot_v3v3(l_b->v->co, no);
|
||||
if (min > max) {
|
||||
SWAP(float, min, max);
|
||||
std::swap(min, max);
|
||||
}
|
||||
|
||||
BMEdge **e_iter = &data->edgenet[0];
|
||||
|
@ -891,7 +891,7 @@ bool BM_mesh_intersect_edges(
|
|||
BM_elem_flag_enable(e, BM_ELEM_TAG);
|
||||
|
||||
if (v_cut == -1) {
|
||||
SWAP(BMVert *, va, vb);
|
||||
std::swap(va, vb);
|
||||
v_cut = v_cut_other;
|
||||
v_cut_other = -1;
|
||||
}
|
||||
|
|
|
@ -934,7 +934,7 @@ static void bm_face_region_pivot_edge_use_best(GHash *gh,
|
|||
e_pivot_test_id[0] = (SUID_Int)BLI_ghash_lookup(gh, e_test->v1);
|
||||
e_pivot_test_id[1] = (SUID_Int)BLI_ghash_lookup(gh, e_test->v2);
|
||||
if (e_pivot_test_id[0] > e_pivot_test_id[1]) {
|
||||
SWAP(SUID_Int, e_pivot_test_id[0], e_pivot_test_id[1]);
|
||||
std::swap(e_pivot_test_id[0], e_pivot_test_id[1]);
|
||||
}
|
||||
|
||||
if ((*r_e_pivot_best == nullptr) ||
|
||||
|
@ -1302,7 +1302,7 @@ static void bm_vert_fasthash_edge_order(const UIDFashMatch *fm,
|
|||
e_fm[1] = fm[BM_elem_index_get(e->v2)];
|
||||
|
||||
if (e_fm[0] > e_fm[1]) {
|
||||
SWAP(UIDFashMatch, e_fm[0], e_fm[1]);
|
||||
std::swap(e_fm[0], e_fm[1]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -527,15 +527,15 @@ static void dof_dilate_tiles_pass_draw(EEVEE_FramebufferList *fbl,
|
|||
GPU_framebuffer_bind(fbl->dof_dilate_tiles_fb);
|
||||
DRW_draw_pass(drw_pass);
|
||||
|
||||
SWAP(GPUFrameBuffer *, fbl->dof_dilate_tiles_fb, fbl->dof_flatten_tiles_fb);
|
||||
SWAP(GPUTexture *, fx->dof_coc_dilated_tiles_bg_tx, fx->dof_coc_tiles_bg_tx);
|
||||
SWAP(GPUTexture *, fx->dof_coc_dilated_tiles_fg_tx, fx->dof_coc_tiles_fg_tx);
|
||||
std::swap(fbl->dof_dilate_tiles_fb, fbl->dof_flatten_tiles_fb);
|
||||
std::swap(fx->dof_coc_dilated_tiles_bg_tx, fx->dof_coc_tiles_bg_tx);
|
||||
std::swap(fx->dof_coc_dilated_tiles_fg_tx, fx->dof_coc_tiles_fg_tx);
|
||||
}
|
||||
}
|
||||
/* Swap again so that final textures are dof_coc_dilated_tiles_*_tx. */
|
||||
SWAP(GPUFrameBuffer *, fbl->dof_dilate_tiles_fb, fbl->dof_flatten_tiles_fb);
|
||||
SWAP(GPUTexture *, fx->dof_coc_dilated_tiles_bg_tx, fx->dof_coc_tiles_bg_tx);
|
||||
SWAP(GPUTexture *, fx->dof_coc_dilated_tiles_fg_tx, fx->dof_coc_tiles_fg_tx);
|
||||
std::swap(fbl->dof_dilate_tiles_fb, fbl->dof_flatten_tiles_fb);
|
||||
std::swap(fx->dof_coc_dilated_tiles_bg_tx, fx->dof_coc_tiles_bg_tx);
|
||||
std::swap(fx->dof_coc_dilated_tiles_fg_tx, fx->dof_coc_tiles_fg_tx);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1066,7 +1066,7 @@ static void eevee_lightbake_render_world_sample(void *ved, void *user_data)
|
|||
GPU_framebuffer_clear_color(lbake->store_fb, blender::float4{1.0f, 1.0f, 1.0f, 1.0f});
|
||||
DRW_draw_pass(vedata->psl->probe_grid_fill);
|
||||
|
||||
SWAP(GPUTexture *, lbake->grid_prev, lcache->grid_tx.tex);
|
||||
std::swap(lbake->grid_prev, lcache->grid_tx.tex);
|
||||
|
||||
/* Make a copy for later. */
|
||||
eevee_lightbake_copy_irradiance(lbake, lcache);
|
||||
|
@ -1158,7 +1158,7 @@ static void eevee_lightbake_render_grid_sample(void *ved, void *user_data)
|
|||
egrid->level_bias = 1.0f;
|
||||
|
||||
/* Use the previous bounce for rendering this bounce. */
|
||||
SWAP(GPUTexture *, lbake->grid_prev, lcache->grid_tx.tex);
|
||||
std::swap(lbake->grid_prev, lcache->grid_tx.tex);
|
||||
|
||||
/* TODO: do this once for the whole bake when we have independent DRWManagers.
|
||||
* WARNING: Some of the things above require this. */
|
||||
|
@ -1185,7 +1185,7 @@ static void eevee_lightbake_render_grid_sample(void *ved, void *user_data)
|
|||
EEVEE_lightbake_render_scene(sldata, vedata, lbake->rt_fb, pos, prb->clipsta, prb->clipend);
|
||||
|
||||
/* Restore before filtering. */
|
||||
SWAP(GPUTexture *, lbake->grid_prev, lcache->grid_tx.tex);
|
||||
std::swap(lbake->grid_prev, lcache->grid_tx.tex);
|
||||
|
||||
EEVEE_lightbake_filter_diffuse(
|
||||
sldata, vedata, lbake->rt_color, lbake->store_fb, sample_offset, prb->intensity);
|
||||
|
@ -1301,8 +1301,8 @@ static bool eevee_lightbake_cube_comp(EEVEE_LightProbe *prb_a, EEVEE_LightProbe
|
|||
sorted = true; \
|
||||
for (int i = 0; i < (elems_len)-1; i++) { \
|
||||
if ((comp_fn)((elems) + i, (elems) + i + 1)) { \
|
||||
SWAP(elems_type, (elems)[i], (elems)[i + 1]); \
|
||||
SWAP(LightProbe *, (prbs)[i], (prbs)[i + 1]); \
|
||||
std::swap((elems)[i], (elems)[i + 1]); \
|
||||
std::swap((prbs)[i], (prbs)[i + 1]); \
|
||||
sorted = false; \
|
||||
} \
|
||||
} \
|
||||
|
|
|
@ -52,9 +52,9 @@ extern struct DrawEngineType draw_engine_eevee_type;
|
|||
#define SWAP_DOUBLE_BUFFERS() \
|
||||
{ \
|
||||
if (effects->swap_double_buffer) { \
|
||||
SWAP(struct GPUFrameBuffer *, fbl->main_fb, fbl->double_buffer_fb); \
|
||||
SWAP(struct GPUFrameBuffer *, fbl->main_color_fb, fbl->double_buffer_color_fb); \
|
||||
SWAP(GPUTexture *, txl->color, txl->color_double_buffer); \
|
||||
std::swap(fbl->main_fb, fbl->double_buffer_fb); \
|
||||
std::swap(fbl->main_color_fb, fbl->double_buffer_color_fb); \
|
||||
std::swap(txl->color, txl->color_double_buffer); \
|
||||
effects->swap_double_buffer = false; \
|
||||
} \
|
||||
} \
|
||||
|
@ -78,16 +78,16 @@ extern struct DrawEngineType draw_engine_eevee_type;
|
|||
#define SWAP_BUFFERS_TAA() \
|
||||
{ \
|
||||
if (effects->target_buffer == fbl->effect_color_fb) { \
|
||||
SWAP(struct GPUFrameBuffer *, fbl->effect_fb, fbl->taa_history_fb); \
|
||||
SWAP(struct GPUFrameBuffer *, fbl->effect_color_fb, fbl->taa_history_color_fb); \
|
||||
SWAP(GPUTexture *, txl->color_post, txl->taa_history); \
|
||||
std::swap(fbl->effect_fb, fbl->taa_history_fb); \
|
||||
std::swap(fbl->effect_color_fb, fbl->taa_history_color_fb); \
|
||||
std::swap(txl->color_post, txl->taa_history); \
|
||||
effects->source_buffer = txl->taa_history; \
|
||||
effects->target_buffer = fbl->effect_color_fb; \
|
||||
} \
|
||||
else { \
|
||||
SWAP(struct GPUFrameBuffer *, fbl->main_fb, fbl->taa_history_fb); \
|
||||
SWAP(struct GPUFrameBuffer *, fbl->main_color_fb, fbl->taa_history_color_fb); \
|
||||
SWAP(GPUTexture *, txl->color, txl->taa_history); \
|
||||
std::swap(fbl->main_fb, fbl->taa_history_fb); \
|
||||
std::swap(fbl->main_color_fb, fbl->taa_history_color_fb); \
|
||||
std::swap(txl->color, txl->taa_history); \
|
||||
effects->source_buffer = txl->taa_history; \
|
||||
effects->target_buffer = fbl->main_color_fb; \
|
||||
} \
|
||||
|
|
|
@ -52,9 +52,7 @@ void EEVEE_shadows_init(EEVEE_ViewLayerData *sldata)
|
|||
}
|
||||
|
||||
/* Flip buffers */
|
||||
SWAP(EEVEE_ShadowCasterBuffer *,
|
||||
sldata->lights->shcaster_frontbuffer,
|
||||
sldata->lights->shcaster_backbuffer);
|
||||
std::swap(sldata->lights->shcaster_frontbuffer, sldata->lights->shcaster_backbuffer);
|
||||
|
||||
int sh_cube_size = scene_eval->eevee.shadow_cube_size;
|
||||
int sh_cascade_size = scene_eval->eevee.shadow_cascade_size;
|
||||
|
|
|
@ -560,9 +560,9 @@ void EEVEE_volumes_compute(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
|
|||
|
||||
DRW_draw_pass(psl->volumetric_integration_ps);
|
||||
|
||||
SWAP(GPUFrameBuffer *, fbl->volumetric_scat_fb, fbl->volumetric_integ_fb);
|
||||
SWAP(GPUTexture *, txl->volume_scatter, txl->volume_scatter_history);
|
||||
SWAP(GPUTexture *, txl->volume_transmit, txl->volume_transmit_history);
|
||||
std::swap(fbl->volumetric_scat_fb, fbl->volumetric_integ_fb);
|
||||
std::swap(txl->volume_scatter, txl->volume_scatter_history);
|
||||
std::swap(txl->volume_transmit, txl->volume_transmit_history);
|
||||
|
||||
effects->volume_scatter = txl->volume_scatter;
|
||||
effects->volume_transmit = txl->volume_transmit;
|
||||
|
|
|
@ -73,9 +73,9 @@ static DRWShadingGroup *gpencil_vfx_pass_create(
|
|||
tgp_vfx->target_fb = iter->target_fb;
|
||||
tgp_vfx->vfx_ps = pass;
|
||||
|
||||
SWAP(GPUFrameBuffer **, iter->target_fb, iter->source_fb);
|
||||
SWAP(GPUTexture **, iter->target_color_tx, iter->source_color_tx);
|
||||
SWAP(GPUTexture **, iter->target_reveal_tx, iter->source_reveal_tx);
|
||||
std::swap(iter->target_fb, iter->source_fb);
|
||||
std::swap(iter->target_color_tx, iter->source_color_tx);
|
||||
std::swap(iter->target_reveal_tx, iter->source_reveal_tx);
|
||||
|
||||
BLI_LINKS_APPEND(&iter->tgp_ob->vfx, tgp_vfx);
|
||||
|
||||
|
@ -366,7 +366,7 @@ static void gpencil_vfx_shadow(ShadowShaderFxData *fx, Object *ob, gpIterVfxData
|
|||
rotate_v2_v2fl(wave_dir, dir, fx->rotation);
|
||||
/* Rotate 90 degrees. */
|
||||
copy_v2_v2(wave_ofs, wave_dir);
|
||||
SWAP(float, wave_ofs[0], wave_ofs[1]);
|
||||
std::swap(wave_ofs[0], wave_ofs[1]);
|
||||
wave_ofs[1] *= -1.0f;
|
||||
/* Keep world space scaling and aspect ratio. */
|
||||
mul_v2_fl(wave_dir, 1.0f / (max_ff(1e-8f, fx->period) * distance_factor));
|
||||
|
@ -523,7 +523,7 @@ static void gpencil_vfx_wave(WaveShaderFxData *fx, Object *ob, gpIterVfxData *it
|
|||
}
|
||||
/* Rotate 90 degrees. */
|
||||
copy_v2_v2(wave_ofs, wave_dir);
|
||||
SWAP(float, wave_ofs[0], wave_ofs[1]);
|
||||
std::swap(wave_ofs[0], wave_ofs[1]);
|
||||
wave_ofs[1] *= -1.0f;
|
||||
/* Keep world space scaling and aspect ratio. */
|
||||
mul_v2_fl(wave_dir, 1.0f / (max_ff(1e-8f, fx->period) * distance_factor));
|
||||
|
|
|
@ -341,7 +341,7 @@ void ShadowPass::init(const SceneState &scene_state, SceneResources &resources)
|
|||
|
||||
float3 direction_ws = scene.display.light_direction;
|
||||
/* Turn the light in a way where it's more user friendly to control. */
|
||||
SWAP(float, direction_ws.y, direction_ws.z);
|
||||
std::swap(direction_ws.y, direction_ws.z);
|
||||
direction_ws *= float3(-1, 1, -1);
|
||||
|
||||
float planes[6][4];
|
||||
|
|
|
@ -399,10 +399,10 @@ class StorageArrayBuffer : public detail::StorageCommon<T, len, device_only> {
|
|||
|
||||
static void swap(StorageArrayBuffer &a, StorageArrayBuffer &b)
|
||||
{
|
||||
SWAP(T *, a.data_, b.data_);
|
||||
SWAP(GPUStorageBuf *, a.ssbo_, b.ssbo_);
|
||||
SWAP(int64_t, a.len_, b.len_);
|
||||
SWAP(const char *, a.name_, b.name_);
|
||||
std::swap(a.data_, b.data_);
|
||||
std::swap(a.ssbo_, b.ssbo_);
|
||||
std::swap(a.len_, b.len_);
|
||||
std::swap(a.name_, b.name_);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -486,7 +486,7 @@ class StorageVectorBuffer : public StorageArrayBuffer<T, len, false> {
|
|||
static void swap(StorageVectorBuffer &a, StorageVectorBuffer &b)
|
||||
{
|
||||
StorageArrayBuffer<T, len, false>::swap(a, b);
|
||||
SWAP(int64_t, a.item_len_, b.item_len_);
|
||||
std::swap(a.item_len_, b.item_len_);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1264,8 +1264,8 @@ class Framebuffer : NonCopyable {
|
|||
*/
|
||||
static void swap(Framebuffer &a, Framebuffer &b)
|
||||
{
|
||||
SWAP(GPUFrameBuffer *, a.fb_, b.fb_);
|
||||
SWAP(const char *, a.name_, b.name_);
|
||||
std::swap(a.fb_, b.fb_);
|
||||
std::swap(a.name_, b.name_);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1288,7 +1288,7 @@ template<typename T, int64_t len> class SwapChain {
|
|||
for (auto i : IndexRange(len - 1)) {
|
||||
auto i_next = (i + 1) % len;
|
||||
if constexpr (std::is_trivial_v<T>) {
|
||||
SWAP(T, chain_[i], chain_[i_next]);
|
||||
std::swap(chain_[i], chain_[i_next]);
|
||||
}
|
||||
else {
|
||||
T::swap(chain_[i], chain_[i_next]);
|
||||
|
|
|
@ -165,7 +165,7 @@ void DRW_stats_reset()
|
|||
/* Swap queries for the next frame and sum up each lvl time. */
|
||||
for (int i = DTP.timer_increment - 1; i >= 0; i--) {
|
||||
DRWTimer *timer = &DTP.timers[i];
|
||||
SWAP(uint32_t, timer->query[0], timer->query[1]);
|
||||
std::swap(timer->query[0], timer->query[1]);
|
||||
|
||||
BLI_assert(timer->lvl < MAX_NESTED_TIMER);
|
||||
|
||||
|
|
|
@ -921,8 +921,8 @@ static void mirror_bezier_xaxis_ex(BezTriple *bezt, const float center)
|
|||
}
|
||||
swap_v3_v3(bezt->vec[0], bezt->vec[2]);
|
||||
|
||||
SWAP(uint8_t, bezt->h1, bezt->h2);
|
||||
SWAP(uint8_t, bezt->f1, bezt->f3);
|
||||
std::swap(bezt->h1, bezt->h2);
|
||||
std::swap(bezt->f1, bezt->f3);
|
||||
}
|
||||
|
||||
static void mirror_bezier_yaxis_ex(BezTriple *bezt, const float center)
|
||||
|
|
|
@ -179,7 +179,7 @@ static int armature_click_extrude_exec(bContext *C, wmOperator * /*op*/)
|
|||
if (flipbone == nullptr) {
|
||||
break;
|
||||
}
|
||||
SWAP(EditBone *, flipbone, ebone);
|
||||
std::swap(flipbone, ebone);
|
||||
}
|
||||
|
||||
newbone = ED_armature_ebone_add(arm, ebone->name);
|
||||
|
@ -1493,7 +1493,7 @@ static int armature_extrude_exec(bContext *C, wmOperator *op)
|
|||
if (flipbone == nullptr) {
|
||||
break;
|
||||
}
|
||||
SWAP(EditBone *, flipbone, ebone);
|
||||
std::swap(flipbone, ebone);
|
||||
}
|
||||
|
||||
totbone++;
|
||||
|
@ -1567,7 +1567,7 @@ static int armature_extrude_exec(bContext *C, wmOperator *op)
|
|||
|
||||
/* restore ebone if we were flipping */
|
||||
if (a == 1 && flipbone) {
|
||||
SWAP(EditBone *, flipbone, ebone);
|
||||
std::swap(flipbone, ebone);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1252,7 +1252,7 @@ bool ED_armature_edit_select_op_from_tagged(bArmature *arm, const int sel_op)
|
|||
/* Cleanup flags. */
|
||||
LISTBASE_FOREACH (EditBone *, ebone, arm->edbo) {
|
||||
if (ebone->flag & BONE_DONE) {
|
||||
SWAP(int, ebone->temp.i, ebone->flag);
|
||||
std::swap(ebone->temp.i, ebone->flag);
|
||||
ebone->flag |= BONE_DONE;
|
||||
if ((ebone->flag & BONE_CONNECTED) && ebone->parent) {
|
||||
if ((ebone->parent->flag & BONE_DONE) == 0) {
|
||||
|
@ -2268,7 +2268,7 @@ static int armature_shortest_path_pick_invoke(bContext *C, wmOperator *op, const
|
|||
/* pass */
|
||||
}
|
||||
else if (ED_armature_ebone_is_child_recursive(ebone_dst, ebone_src)) {
|
||||
SWAP(EditBone *, ebone_src, ebone_dst);
|
||||
std::swap(ebone_src, ebone_dst);
|
||||
}
|
||||
else if ((ebone_isect_parent = ED_armature_ebone_find_shared_parent(ebone_isect_child, 2))) {
|
||||
/* pass */
|
||||
|
|
|
@ -1777,7 +1777,7 @@ static void ed_surf_delete_selected(Object *obedit)
|
|||
if (newu == 1 && nu->pntsv > 1) { /* make a U spline */
|
||||
nu->pntsu = nu->pntsv;
|
||||
nu->pntsv = 1;
|
||||
SWAP(short, nu->orderu, nu->orderv);
|
||||
std::swap(nu->orderu, nu->orderv);
|
||||
BKE_nurb_order_clamp_u(nu);
|
||||
MEM_SAFE_FREE(nu->knotsv);
|
||||
}
|
||||
|
@ -4109,7 +4109,7 @@ static void switchdirection_knots(float *base, int tot)
|
|||
fp2 = fp1 + (a - 1);
|
||||
a /= 2;
|
||||
while (fp1 != fp2 && a > 0) {
|
||||
SWAP(float, *fp1, *fp2);
|
||||
std::swap(*fp1, *fp2);
|
||||
a--;
|
||||
fp1++;
|
||||
fp2--;
|
||||
|
@ -4144,12 +4144,12 @@ static void rotate_direction_nurb(Nurb *nu)
|
|||
BPoint *bp1, *bp2, *temp;
|
||||
int u, v;
|
||||
|
||||
SWAP(int, nu->pntsu, nu->pntsv);
|
||||
SWAP(short, nu->orderu, nu->orderv);
|
||||
SWAP(short, nu->resolu, nu->resolv);
|
||||
SWAP(short, nu->flagu, nu->flagv);
|
||||
std::swap(nu->pntsu, nu->pntsv);
|
||||
std::swap(nu->orderu, nu->orderv);
|
||||
std::swap(nu->resolu, nu->resolv);
|
||||
std::swap(nu->flagu, nu->flagv);
|
||||
|
||||
SWAP(float *, nu->knotsu, nu->knotsv);
|
||||
std::swap(nu->knotsu, nu->knotsv);
|
||||
switchdirection_knots(nu->knotsv, KNOTSV(nu));
|
||||
|
||||
temp = static_cast<BPoint *>(MEM_dupallocN(nu->bp));
|
||||
|
@ -4692,7 +4692,7 @@ static int make_segment_exec(bContext *C, wmOperator *op)
|
|||
}
|
||||
else if ((nu1 && !nu2) || (!nu1 && nu2)) {
|
||||
if (nu2) {
|
||||
SWAP(Nurb *, nu1, nu2);
|
||||
std::swap(nu1, nu2);
|
||||
}
|
||||
|
||||
if (!(nu1->flagu & CU_NURB_CYCLIC) && nu1->pntsu > 1) {
|
||||
|
|
|
@ -1886,14 +1886,14 @@ static void curve_select_shortest_path_curve(Nurb *nu, int vert_src, int vert_ds
|
|||
int i;
|
||||
|
||||
if (vert_src > vert_dst) {
|
||||
SWAP(int, vert_src, vert_dst);
|
||||
std::swap( vert_src, vert_dst);
|
||||
}
|
||||
|
||||
if (nu->flagu & CU_NURB_CYCLIC) {
|
||||
if (curve_calc_dist_span(nu, vert_src, vert_dst) >
|
||||
curve_calc_dist_span(nu, vert_dst, vert_src))
|
||||
{
|
||||
SWAP(int, vert_src, vert_dst);
|
||||
std::swap( vert_src, vert_dst);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3051,10 +3051,10 @@ void ED_gpencil_projected_2d_bound_box(const GP_SpaceConversion *gsc,
|
|||
|
||||
/* Ensure the bounding box is oriented to axis. */
|
||||
if (r_max[0] < r_min[0]) {
|
||||
SWAP(float, r_min[0], r_max[0]);
|
||||
std::swap(r_min[0], r_max[0]);
|
||||
}
|
||||
if (r_max[1] < r_min[1]) {
|
||||
SWAP(float, r_min[1], r_max[1]);
|
||||
std::swap(r_min[1], r_max[1]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3602,6 +3602,9 @@ static int menu_item_enum_opname_menu_active(bContext *C, uiBut *but, MenuItemLe
|
|||
/* so the context is passed to itemf functions (some need it) */
|
||||
WM_operator_properties_sanitize(&ptr, false);
|
||||
PropertyRNA *prop = RNA_struct_find_property(&ptr, lvl->propname);
|
||||
if (!prop) {
|
||||
return -1;
|
||||
}
|
||||
RNA_property_enum_items_gettexted(C, &ptr, prop, &item_array, &totitem, &free);
|
||||
int active = RNA_enum_from_name(item_array, but->str.c_str());
|
||||
if (free) {
|
||||
|
|
|
@ -701,7 +701,7 @@ static int slide_point_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
|||
&data->spline->points[0],
|
||||
&data->spline->points[data->spline->tot_point - 1]))
|
||||
{
|
||||
SWAP(float, delta[0], delta[1]);
|
||||
std::swap(delta[0], delta[1]);
|
||||
delta[1] *= -1;
|
||||
|
||||
/* flip last point */
|
||||
|
|
|
@ -313,7 +313,7 @@ static int mask_shape_key_rekey_exec(bContext *C, wmOperator *op)
|
|||
MaskSplinePoint *point = &spline->points[i];
|
||||
|
||||
/* not especially efficient but makes this easier to follow */
|
||||
SWAP(MaskLayerShapeElem, *shape_ele_src, *shape_ele_dst);
|
||||
std::swap(*shape_ele_src, *shape_ele_dst);
|
||||
|
||||
if (MASKPOINT_ISSEL_ANY(point)) {
|
||||
if (do_location) {
|
||||
|
|
|
@ -325,7 +325,7 @@ static int edbm_polybuild_face_at_cursor_invoke(bContext *C, wmOperator *op, con
|
|||
v_tri[1] = e_act->v2;
|
||||
v_tri[2] = BM_vert_create(bm, center, nullptr, BM_CREATE_NOP);
|
||||
if (e_act->l && e_act->l->v == v_tri[0]) {
|
||||
SWAP(BMVert *, v_tri[0], v_tri[1]);
|
||||
std::swap(v_tri[0], v_tri[1]);
|
||||
}
|
||||
BM_face_create_verts(bm, v_tri, 3, f_reference, BM_CREATE_NOP, true);
|
||||
edbm_flag_disable_all_multi(vc.scene, vc.view_layer, vc.v3d, BM_ELEM_SELECT);
|
||||
|
@ -359,7 +359,7 @@ static int edbm_polybuild_face_at_cursor_invoke(bContext *C, wmOperator *op, con
|
|||
if (e_pair[1] != nullptr) {
|
||||
/* Quad from edge pair. */
|
||||
if (BM_edge_calc_length_squared(e_pair[0]) < BM_edge_calc_length_squared(e_pair[1])) {
|
||||
SWAP(BMEdge *, e_pair[0], e_pair[1]);
|
||||
std::swap(e_pair[0], e_pair[1]);
|
||||
}
|
||||
|
||||
BMFace *f_reference = e_pair[0]->l ? e_pair[0]->l->f : nullptr;
|
||||
|
@ -374,7 +374,7 @@ static int edbm_polybuild_face_at_cursor_invoke(bContext *C, wmOperator *op, con
|
|||
v_quad[2] = BM_vert_create(bm, center, nullptr, BM_CREATE_NOP);
|
||||
v_quad[3] = BM_edge_other_vert(e_pair[1], v_act);
|
||||
if (e_pair[0]->l && e_pair[0]->l->v == v_quad[0]) {
|
||||
SWAP(BMVert *, v_quad[1], v_quad[3]);
|
||||
std::swap(v_quad[1], v_quad[3]);
|
||||
}
|
||||
// BMFace *f_new =
|
||||
BM_face_create_verts(bm, v_quad, 4, f_reference, BM_CREATE_NOP, true);
|
||||
|
|
|
@ -467,10 +467,10 @@ static void edbm_tagged_loop_pairs_do_fill_faces(BMesh *bm, UnorderedLoopPair *u
|
|||
f_verts[3] = ulp->l_pair[0]->e->v2;
|
||||
|
||||
if (ulp->flag & ULP_FLIP_0) {
|
||||
SWAP(BMVert *, f_verts[0], f_verts[3]);
|
||||
std::swap(f_verts[0], f_verts[3]);
|
||||
}
|
||||
if (ulp->flag & ULP_FLIP_1) {
|
||||
SWAP(BMVert *, f_verts[1], f_verts[2]);
|
||||
std::swap(f_verts[1], f_verts[2]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -482,7 +482,7 @@ static void edbm_tagged_loop_pairs_do_fill_faces(BMesh *bm, UnorderedLoopPair *u
|
|||
|
||||
/* don't use the flip flags */
|
||||
if (v_shared == ulp->l_pair[0]->v) {
|
||||
SWAP(BMVert *, f_verts[0], f_verts[1]);
|
||||
std::swap(f_verts[0], f_verts[1]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -724,7 +724,7 @@ static int edbm_rip_invoke__vert(bContext *C, const wmEvent *event, Object *obed
|
|||
* vout[2+] == splice with glue (when vout_len > 2)
|
||||
*/
|
||||
if (vi_best != 0) {
|
||||
SWAP(BMVert *, vout[0], vout[vi_best]);
|
||||
std::swap(vout[0], vout[vi_best]);
|
||||
vi_best = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1496,7 +1496,7 @@ static bool bm_vert_connect_select_history_edge_to_vert_path(BMesh *bm, ListBase
|
|||
return false;
|
||||
}
|
||||
|
||||
SWAP(ListBase, bm->selected, selected_orig);
|
||||
std::swap(bm->selected, selected_orig);
|
||||
|
||||
/* convert edge selection into 2 ordered loops (where the first edge ends up in the middle) */
|
||||
LISTBASE_FOREACH (BMEditSelection *, ese, &selected_orig) {
|
||||
|
@ -1568,7 +1568,7 @@ static int edbm_vert_connect_path_exec(bContext *C, wmOperator *op)
|
|||
BMEditSelection *ese = static_cast<BMEditSelection *>(bm->selected.first);
|
||||
if (ese->htype == BM_EDGE) {
|
||||
if (bm_vert_connect_select_history_edge_to_vert_path(bm, &selected_orig)) {
|
||||
SWAP(ListBase, bm->selected, selected_orig);
|
||||
std::swap(bm->selected, selected_orig);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7924,7 +7924,7 @@ static int mesh_symmetry_snap_exec(bContext *C, wmOperator *op)
|
|||
float co[3], co_mirr[3];
|
||||
|
||||
if ((v->co[axis] > v_mirr->co[axis]) == axis_sign) {
|
||||
SWAP(BMVert *, v, v_mirr);
|
||||
std::swap(v, v_mirr);
|
||||
}
|
||||
|
||||
copy_v3_v3(co_mirr, v_mirr->co);
|
||||
|
|
|
@ -476,7 +476,7 @@ static int data_transfer_exec(bContext *C, wmOperator *op)
|
|||
}
|
||||
|
||||
if (reverse_transfer) {
|
||||
SWAP(int, layers_src, layers_dst);
|
||||
std::swap(layers_src, layers_dst);
|
||||
}
|
||||
|
||||
if (fromto_idx != DT_MULTILAYER_INDEX_INVALID) {
|
||||
|
@ -490,7 +490,7 @@ static int data_transfer_exec(bContext *C, wmOperator *op)
|
|||
Object *ob_dst = static_cast<Object *>(ctx_ob_dst->ptr.data);
|
||||
|
||||
if (reverse_transfer) {
|
||||
SWAP(Object *, ob_src, ob_dst);
|
||||
std::swap(ob_src, ob_dst);
|
||||
}
|
||||
|
||||
if (data_transfer_exec_is_object_valid(op, ob_src, ob_dst, reverse_transfer)) {
|
||||
|
@ -529,7 +529,7 @@ static int data_transfer_exec(bContext *C, wmOperator *op)
|
|||
}
|
||||
|
||||
if (reverse_transfer) {
|
||||
SWAP(Object *, ob_src, ob_dst);
|
||||
std::swap(ob_src, ob_dst);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1120,9 +1120,8 @@ static int time_segment_move_exec(bContext *C, wmOperator *op)
|
|||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
SWAP(TimeGpencilModifierSegment,
|
||||
gpmd->segments[gpmd->segment_active_index],
|
||||
gpmd->segments[gpmd->segment_active_index - 1]);
|
||||
std::swap(gpmd->segments[gpmd->segment_active_index],
|
||||
gpmd->segments[gpmd->segment_active_index - 1]);
|
||||
|
||||
gpmd->segment_active_index--;
|
||||
}
|
||||
|
@ -1131,9 +1130,8 @@ static int time_segment_move_exec(bContext *C, wmOperator *op)
|
|||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
SWAP(TimeGpencilModifierSegment,
|
||||
gpmd->segments[gpmd->segment_active_index],
|
||||
gpmd->segments[gpmd->segment_active_index + 1]);
|
||||
std::swap(gpmd->segments[gpmd->segment_active_index],
|
||||
gpmd->segments[gpmd->segment_active_index + 1]);
|
||||
|
||||
gpmd->segment_active_index++;
|
||||
}
|
||||
|
@ -1365,9 +1363,8 @@ static int dash_segment_move_exec(bContext *C, wmOperator *op)
|
|||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
SWAP(DashGpencilModifierSegment,
|
||||
dmd->segments[dmd->segment_active_index],
|
||||
dmd->segments[dmd->segment_active_index - 1]);
|
||||
std::swap(dmd->segments[dmd->segment_active_index],
|
||||
dmd->segments[dmd->segment_active_index - 1]);
|
||||
|
||||
dmd->segment_active_index--;
|
||||
}
|
||||
|
@ -1376,9 +1373,8 @@ static int dash_segment_move_exec(bContext *C, wmOperator *op)
|
|||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
SWAP(DashGpencilModifierSegment,
|
||||
dmd->segments[dmd->segment_active_index],
|
||||
dmd->segments[dmd->segment_active_index + 1]);
|
||||
std::swap(dmd->segments[dmd->segment_active_index],
|
||||
dmd->segments[dmd->segment_active_index + 1]);
|
||||
|
||||
dmd->segment_active_index++;
|
||||
}
|
||||
|
|
|
@ -232,7 +232,7 @@ static int object_warp_verts_exec(bContext *C, wmOperator *op)
|
|||
}
|
||||
|
||||
if (min > max) {
|
||||
SWAP(float, min, max);
|
||||
std::swap(min, max);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2335,11 +2335,11 @@ void ED_area_data_copy(ScrArea *area_dst, ScrArea *area_src, const bool do_free)
|
|||
|
||||
void ED_area_data_swap(ScrArea *area_dst, ScrArea *area_src)
|
||||
{
|
||||
SWAP(char, area_dst->spacetype, area_src->spacetype);
|
||||
SWAP(SpaceType *, area_dst->type, area_src->type);
|
||||
std::swap(area_dst->spacetype, area_src->spacetype);
|
||||
std::swap(area_dst->type, area_src->type);
|
||||
|
||||
SWAP(ListBase, area_dst->spacedata, area_src->spacedata);
|
||||
SWAP(ListBase, area_dst->regionbase, area_src->regionbase);
|
||||
std::swap(area_dst->spacedata, area_src->spacedata);
|
||||
std::swap(area_dst->regionbase, area_src->regionbase);
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
|
|
@ -4072,7 +4072,7 @@ static int region_quadview_exec(bContext *C, wmOperator *op)
|
|||
|
||||
if (ED_view3d_context_user_region(C, &v3d_user, ®ion_user)) {
|
||||
if (region != region_user) {
|
||||
SWAP(void *, region->regiondata, region_user->regiondata);
|
||||
std::swap(region->regiondata, region_user->regiondata);
|
||||
rv3d = static_cast<RegionView3D *>(region->regiondata);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -168,7 +168,7 @@ static float *geodesic_mesh_create(Object *ob, GSet *initial_verts, const float
|
|||
|
||||
if (dists[v1] == FLT_MAX || dists[v2] == FLT_MAX) {
|
||||
if (dists[v1] > dists[v2]) {
|
||||
SWAP(int, v1, v2);
|
||||
std::swap( v1, v2);
|
||||
}
|
||||
sculpt_geodesic_mesh_test_dist_add(
|
||||
vert_positions, v2, v1, SCULPT_GEODESIC_VERTEX_NONE, dists, initial_verts);
|
||||
|
|
|
@ -393,18 +393,18 @@ static void update_modified_node_grids(PBVHNode &node, PartialUpdateData &data)
|
|||
}
|
||||
}
|
||||
|
||||
static bool test_swap_v3_v3(float a[3], float b[3])
|
||||
static bool test_swap_v3_v3(float3 &a, float3 &b)
|
||||
{
|
||||
/* No need for float comparison here (memory is exactly equal or not). */
|
||||
if (memcmp(a, b, sizeof(float[3])) != 0) {
|
||||
swap_v3_v3(a, b);
|
||||
std::swap(a, b);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool restore_deformed(
|
||||
const SculptSession *ss, Node &unode, int uindex, int oindex, float coord[3])
|
||||
const SculptSession *ss, Node &unode, int uindex, int oindex, float3 &coord)
|
||||
{
|
||||
if (test_swap_v3_v3(coord, unode.orig_position[uindex])) {
|
||||
copy_v3_v3(unode.position[uindex], ss->deform_cos[oindex]);
|
||||
|
@ -446,24 +446,23 @@ static bool restore_coords(
|
|||
|
||||
if (ss->shapekey_active) {
|
||||
float(*vertCos)[3] = BKE_keyblock_convert_to_vertcos(ob, ss->shapekey_active);
|
||||
const Span key_positions(reinterpret_cast<const float3 *>(vertCos),
|
||||
ss->shapekey_active->totelem);
|
||||
MutableSpan key_positions(reinterpret_cast<float3 *>(vertCos), ss->shapekey_active->totelem);
|
||||
|
||||
if (!unode.orig_position.is_empty()) {
|
||||
if (ss->deform_modifiers_active) {
|
||||
for (const int i : index.index_range()) {
|
||||
restore_deformed(ss, unode, i, index[i], vertCos[index[i]]);
|
||||
restore_deformed(ss, unode, i, index[i], key_positions[index[i]]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (const int i : index.index_range()) {
|
||||
swap_v3_v3(vertCos[index[i]], unode.orig_position[i]);
|
||||
std::swap(key_positions[index[i]], unode.orig_position[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (const int i : index.index_range()) {
|
||||
swap_v3_v3(vertCos[index[i]], unode.position[i]);
|
||||
std::swap(key_positions[index[i]], unode.position[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -486,14 +485,14 @@ static bool restore_coords(
|
|||
}
|
||||
else {
|
||||
for (const int i : index.index_range()) {
|
||||
swap_v3_v3(positions[index[i]], unode.orig_position[i]);
|
||||
std::swap(positions[index[i]], unode.orig_position[i]);
|
||||
modified_verts[index[i]] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (const int i : index.index_range()) {
|
||||
swap_v3_v3(positions[index[i]], unode.position[i]);
|
||||
std::swap(positions[index[i]], unode.position[i]);
|
||||
modified_verts[index[i]] = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -668,7 +668,7 @@ static void draw_fcurve_curve(bAnimContext *ac,
|
|||
|
||||
/* Account for reversed NLA strip effect. */
|
||||
if (fcu_end < fcu_start) {
|
||||
SWAP(float, fcu_start, fcu_end);
|
||||
std::swap(fcu_start, fcu_end);
|
||||
}
|
||||
|
||||
/* Clamp to graph editor rendering bounds. */
|
||||
|
|
|
@ -69,6 +69,7 @@ void IMAGE_OT_clipboard_copy(wmOperatorType *ot);
|
|||
void IMAGE_OT_clipboard_paste(wmOperatorType *ot);
|
||||
|
||||
void IMAGE_OT_flip(wmOperatorType *ot);
|
||||
void IMAGE_OT_rotate_orthogonal(wmOperatorType *ot);
|
||||
void IMAGE_OT_invert(wmOperatorType *ot);
|
||||
void IMAGE_OT_resize(wmOperatorType *ot);
|
||||
|
||||
|
|
|
@ -2841,6 +2841,88 @@ void IMAGE_OT_flip(wmOperatorType *ot)
|
|||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Rotate Orthogonal Operator (90, 180, 270)
|
||||
* \{ */
|
||||
|
||||
static int image_rotate_orthogonal_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Image *ima = image_from_context(C);
|
||||
ImageUser iuser = image_user_from_context_and_active_tile(C, ima);
|
||||
ImBuf *ibuf = BKE_image_acquire_ibuf(ima, &iuser, nullptr);
|
||||
SpaceImage *sima = CTX_wm_space_image(C);
|
||||
const bool is_paint = ((sima != nullptr) && (sima->mode == SI_MODE_PAINT));
|
||||
|
||||
if (ibuf == nullptr) {
|
||||
/* TODO: this should actually never happen, but does for render-results -> cleanup. */
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
int degrees = RNA_enum_get(op->ptr, "degrees");
|
||||
|
||||
ED_image_undo_push_begin_with_image(op->type->name, ima, ibuf, &iuser);
|
||||
|
||||
if (is_paint) {
|
||||
ED_imapaint_clear_partial_redraw();
|
||||
}
|
||||
|
||||
if (!IMB_rotate_orthogonal(ibuf, degrees)) {
|
||||
BKE_image_release_ibuf(ima, ibuf, nullptr);
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
ibuf->userflags |= IB_DISPLAY_BUFFER_INVALID;
|
||||
BKE_image_mark_dirty(ima, ibuf);
|
||||
|
||||
if (ibuf->mipmap[0]) {
|
||||
ibuf->userflags |= IB_MIPMAP_INVALID;
|
||||
}
|
||||
|
||||
ED_image_undo_push_end();
|
||||
|
||||
BKE_image_partial_update_mark_full_update(ima);
|
||||
|
||||
WM_event_add_notifier(C, NC_IMAGE | NA_EDITED, ima);
|
||||
|
||||
BKE_image_release_ibuf(ima, ibuf, nullptr);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void IMAGE_OT_rotate_orthogonal(wmOperatorType *ot)
|
||||
{
|
||||
static const EnumPropertyItem orthogonal_rotation_items[] = {
|
||||
{90, "90", 0, "90 Degrees", "Rotate 90 degrees clockwise"},
|
||||
{180, "180", 0, "180 Degrees", "Rotate 180 degrees clockwise"},
|
||||
{270, "270", 0, "270 Degrees", "Rotate 270 degrees clockwise"},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
/* identifiers */
|
||||
ot->name = "Rotate Image Orthogonal";
|
||||
ot->idname = "IMAGE_OT_rotate_orthogonal";
|
||||
ot->description = "Rotate the image";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec = image_rotate_orthogonal_exec;
|
||||
ot->poll = image_from_context_has_data_poll_active_tile;
|
||||
|
||||
/* properties */
|
||||
PropertyRNA *prop;
|
||||
prop = RNA_def_enum(ot->srna,
|
||||
"degrees",
|
||||
orthogonal_rotation_items,
|
||||
90,
|
||||
"Degrees",
|
||||
"Amount of rotation in degrees (90, 180, 270)");
|
||||
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER;
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Clipboard Copy Operator
|
||||
* \{ */
|
||||
|
|
|
@ -220,6 +220,7 @@ static void image_operatortypes()
|
|||
WM_operatortype_append(IMAGE_OT_clipboard_paste);
|
||||
|
||||
WM_operatortype_append(IMAGE_OT_flip);
|
||||
WM_operatortype_append(IMAGE_OT_rotate_orthogonal);
|
||||
WM_operatortype_append(IMAGE_OT_invert);
|
||||
WM_operatortype_append(IMAGE_OT_resize);
|
||||
|
||||
|
|
|
@ -2585,7 +2585,7 @@ static int sequencer_change_effect_input_exec(bContext *C, wmOperator *op)
|
|||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
SWAP(Sequence *, *seq_1, *seq_2);
|
||||
std::swap(*seq_1, *seq_2);
|
||||
|
||||
SEQ_relations_invalidate_cache_preprocessed(scene, seq);
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
|
||||
|
|
|
@ -91,7 +91,7 @@ static void viewdolly_apply(ViewOpsData *vod, const int xy[2], const bool zoom_i
|
|||
len2 = (vod->region->winrct.ymax - vod->init.event_xy[1]) + 5;
|
||||
}
|
||||
if (zoom_invert) {
|
||||
SWAP(float, len1, len2);
|
||||
std::swap(len1, len2);
|
||||
}
|
||||
|
||||
zfac = 1.0f + ((len1 - len2) * 0.01f * vod->rv3d->dist);
|
||||
|
|
|
@ -194,7 +194,7 @@ static float viewzoom_scale_value(const rcti *winrct,
|
|||
|
||||
/* intentionally ignore 'zoom_invert' for scale */
|
||||
if (zoom_invert_force) {
|
||||
SWAP(float, len_new, len_old);
|
||||
std::swap(len_new, len_old);
|
||||
}
|
||||
|
||||
zfac = val_orig * (len_old / max_ff(len_new, 1.0f)) / val;
|
||||
|
@ -213,7 +213,7 @@ static float viewzoom_scale_value(const rcti *winrct,
|
|||
}
|
||||
|
||||
if (zoom_invert != zoom_invert_force) {
|
||||
SWAP(float, len_new, len_old);
|
||||
std::swap(len_new, len_old);
|
||||
}
|
||||
|
||||
zfac = val_orig * (2.0f * ((len_new / max_ff(len_old, 1.0f)) - 1.0f) + 1.0f) / val;
|
||||
|
|
|
@ -1134,7 +1134,7 @@ static int view3d_interactive_add_modal(bContext *C, wmOperator *op, const wmEve
|
|||
bToolRef *tref = ipd->area->runtime.tool;
|
||||
PointerRNA temp_props;
|
||||
WM_toolsystem_ref_properties_init_for_keymap(tref, &temp_props, &op_props, ot);
|
||||
SWAP(PointerRNA, temp_props, op_props);
|
||||
std::swap(temp_props, op_props);
|
||||
WM_operator_properties_free(&temp_props);
|
||||
}
|
||||
|
||||
|
|
|
@ -700,9 +700,7 @@ static int countAndCleanTransDataContainer(TransInfo *t)
|
|||
if (tc->data_len == 0) {
|
||||
uint index = tc - t->data_container;
|
||||
if (index + 1 != t->data_container_len) {
|
||||
SWAP(TransDataContainer,
|
||||
t->data_container[index],
|
||||
t->data_container[t->data_container_len - 1]);
|
||||
std::swap(t->data_container[index], t->data_container[t->data_container_len - 1]);
|
||||
}
|
||||
t->data_container_len -= 1;
|
||||
}
|
||||
|
|
|
@ -757,7 +757,7 @@ static void sort_time_beztmaps(BeztMap *bezms, int totvert)
|
|||
bezm->newIndex++;
|
||||
(bezm + 1)->newIndex--;
|
||||
|
||||
SWAP(BeztMap, *bezm, *(bezm + 1));
|
||||
std::swap(*bezm, *(bezm + 1));
|
||||
|
||||
ok = 1;
|
||||
}
|
||||
|
|
|
@ -1100,8 +1100,8 @@ void transform_convert_mesh_connectivity_distance(BMesh *bm,
|
|||
if (BM_elem_flag_test(e, tag_loose) || (dists[i1] == FLT_MAX || dists[i2] == FLT_MAX)) {
|
||||
/* Propagate along edge from vertex with smallest to largest distance. */
|
||||
if (dists[i1] > dists[i2]) {
|
||||
SWAP(int, i1, i2);
|
||||
SWAP(BMVert *, v1, v2);
|
||||
std::swap(i1, i2);
|
||||
std::swap(v1, v2);
|
||||
}
|
||||
|
||||
if (bmesh_test_dist_add(v2, v1, nullptr, dists, index, mtx)) {
|
||||
|
|
|
@ -471,7 +471,7 @@ static void calcEdgeSlide_mval_range(TransInfo *t,
|
|||
int l_nr = sv->loop_nr;
|
||||
if (dot_v3v3(loop_dir[l_nr], mval_dir) < 0.0f) {
|
||||
swap_v3_v3(sv->dir_side[0], sv->dir_side[1]);
|
||||
SWAP(BMVert *, sv->v_side[0], sv->v_side[1]);
|
||||
std::swap(sv->v_side[0], sv->v_side[1]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1050,7 +1050,7 @@ int getTransformOrientation_ex(const Scene *scene,
|
|||
}
|
||||
|
||||
if (v_pair_swap) {
|
||||
SWAP(BMVert *, v_pair[0], v_pair[1]);
|
||||
std::swap(v_pair[0], v_pair[1]);
|
||||
}
|
||||
|
||||
add_v3_v3v3(normal, v_pair[1]->no, v_pair[0]->no);
|
||||
|
@ -1099,7 +1099,7 @@ int getTransformOrientation_ex(const Scene *scene,
|
|||
}
|
||||
|
||||
if (v_pair_swap) {
|
||||
SWAP(BMVert *, v_pair[0], v_pair[1]);
|
||||
std::swap(v_pair[0], v_pair[1]);
|
||||
}
|
||||
|
||||
sub_v3_v3v3(dir_pair[0], v->co, v_pair[0]->co);
|
||||
|
|
|
@ -85,7 +85,7 @@ void ED_editors_init(bContext *C)
|
|||
ReportList *reports = CTX_wm_reports(C);
|
||||
int reports_flag_prev = reports->flag & ~RPT_STORE;
|
||||
|
||||
SWAP(int, reports->flag, reports_flag_prev);
|
||||
std::swap( reports->flag, reports_flag_prev);
|
||||
|
||||
/* Don't do undo pushes when calling an operator. */
|
||||
wm->op_undo_depth++;
|
||||
|
@ -208,7 +208,7 @@ void ED_editors_init(bContext *C)
|
|||
|
||||
asset::list::storage_tag_main_data_dirty();
|
||||
|
||||
SWAP(int, reports->flag, reports_flag_prev);
|
||||
std::swap( reports->flag, reports_flag_prev);
|
||||
wm->op_undo_depth--;
|
||||
}
|
||||
|
||||
|
|
|
@ -404,7 +404,7 @@ bool handleNumInput(bContext *C, NumInput *n, const wmEvent *event)
|
|||
true);
|
||||
if (t_cur != cur) {
|
||||
if (t_cur < cur) {
|
||||
SWAP(int, t_cur, cur);
|
||||
std::swap( t_cur, cur);
|
||||
n->str_cur = cur;
|
||||
}
|
||||
/* +1 for trailing '\0'. */
|
||||
|
|
|
@ -248,7 +248,7 @@ static void bm_loop_calc_uv_angle_from_dir(BMLoop *l,
|
|||
normalize_v2(dir_test[1]);
|
||||
|
||||
/* Rotate 90 degrees. */
|
||||
SWAP(float, dir_test[1][0], dir_test[1][1]);
|
||||
std::swap(dir_test[1][0], dir_test[1][1]);
|
||||
dir_test[1][1] *= -1.0f;
|
||||
|
||||
if (BM_face_uv_calc_cross(l->f, cd_loop_uv_offset) > 0.0f) {
|
||||
|
|
|
@ -4218,7 +4218,7 @@ BLI_INLINE uint overlap_hash(const void *overlap_v)
|
|||
int x = overlap->indexA;
|
||||
int y = overlap->indexB;
|
||||
if (x > y) {
|
||||
SWAP(int, x, y);
|
||||
std::swap( x, y);
|
||||
}
|
||||
return BLI_hash_int_2d(x, y);
|
||||
}
|
||||
|
|
|
@ -698,7 +698,7 @@ static void stitch_uv_edge_generate_linked_edges(GHash *edge_hash, StitchState *
|
|||
|
||||
/* make sure the indices are well behaved */
|
||||
if (index1 > index2) {
|
||||
SWAP(int, index1, index2);
|
||||
std::swap( index1, index2);
|
||||
}
|
||||
|
||||
edgetmp.uv1 = index1;
|
||||
|
|
|
@ -168,8 +168,8 @@ static void applyLength(GpencilModifierData *md,
|
|||
}
|
||||
|
||||
if (first_fac < 0) {
|
||||
SWAP(float, first_fac, second_fac);
|
||||
SWAP(int, first_mode, second_mode);
|
||||
std::swap(first_fac, second_fac);
|
||||
std::swap( first_mode, second_mode);
|
||||
}
|
||||
const int first_extra_point_count = ceil(first_fac * lmd->point_density);
|
||||
const int second_extra_point_count = ceil(second_fac * lmd->point_density);
|
||||
|
|
|
@ -729,7 +729,7 @@ static bool lineart_shadow_cast_onto_triangle(LineartData *ld,
|
|||
double *r_gloc_2,
|
||||
bool *r_facing_light)
|
||||
{
|
||||
|
||||
using namespace blender;
|
||||
double *LFBC = sedge->fbc1, *RFBC = sedge->fbc2, *FBC0 = tri->v[0]->fbcoord,
|
||||
*FBC1 = tri->v[1]->fbcoord, *FBC2 = tri->v[2]->fbcoord;
|
||||
|
||||
|
@ -786,7 +786,7 @@ static bool lineart_shadow_cast_onto_triangle(LineartData *ld,
|
|||
|
||||
/* Get projected global position. */
|
||||
|
||||
double gpos1[3], gpos2[3];
|
||||
double3 gpos1, gpos2;
|
||||
double *v1 = (trie[0] == 0 ? FBC0 : (trie[0] == 1 ? FBC1 : FBC2));
|
||||
double *v2 = (trie[0] == 0 ? FBC1 : (trie[0] == 1 ? FBC2 : FBC0));
|
||||
double *v3 = (trie[1] == 0 ? FBC0 : (trie[1] == 1 ? FBC1 : FBC2));
|
||||
|
@ -806,7 +806,7 @@ static bool lineart_shadow_cast_onto_triangle(LineartData *ld,
|
|||
interp_v3_v3v3_db(gpos1, gv1, gv2, gr1);
|
||||
interp_v3_v3v3_db(gpos2, gv3, gv4, gr2);
|
||||
|
||||
double fbc1[4], fbc2[4];
|
||||
double4 fbc1, fbc2;
|
||||
|
||||
mul_v4_m4v3_db(fbc1, ld->conf.view_projection, gpos1);
|
||||
mul_v4_m4v3_db(fbc2, ld->conf.view_projection, gpos2);
|
||||
|
@ -819,9 +819,9 @@ static bool lineart_shadow_cast_onto_triangle(LineartData *ld,
|
|||
double at1 = ratiod(LFBC[use], RFBC[use], fbc1[use]);
|
||||
double at2 = ratiod(LFBC[use], RFBC[use], fbc2[use]);
|
||||
if (at1 > at2) {
|
||||
swap_v3_v3_db(gpos1, gpos2);
|
||||
swap_v4_v4_db(fbc1, fbc2);
|
||||
SWAP(double, at1, at2);
|
||||
std::swap(gpos1, gpos2);
|
||||
std::swap(fbc1, fbc2);
|
||||
std::swap(at1, at2);
|
||||
}
|
||||
|
||||
/* If not effectively projecting anything. */
|
||||
|
|
|
@ -148,7 +148,7 @@ GPUBatch *GPU_batch_wire_from_poly_2d_encoded(const uchar *polys_flat,
|
|||
data.as_u16[0] = *((const uint16_t *)polys_step[i_prev]);
|
||||
data.as_u16[1] = *((const uint16_t *)polys_step[i]);
|
||||
if (data.as_u16[0] > data.as_u16[1]) {
|
||||
SWAP(uint16_t, data.as_u16[0], data.as_u16[1]);
|
||||
std::swap(data.as_u16[0], data.as_u16[1]);
|
||||
}
|
||||
*lines_step = data.as_u32;
|
||||
lines_step++;
|
||||
|
|
|
@ -515,7 +515,7 @@ bool gpu_select_pick_load_id(uint id, bool end)
|
|||
ps->gpu.rect_depth = depth_buf_malloc(ps->src.rect_len);
|
||||
}
|
||||
|
||||
SWAP(DepthBufCache *, ps->gpu.rect_depth, ps->gpu.rect_depth_test);
|
||||
std::swap(ps->gpu.rect_depth, ps->gpu.rect_depth_test);
|
||||
|
||||
if (g_pick_state.mode == GPU_SELECT_PICK_ALL) {
|
||||
/* (fclem) This is to be on the safe side. I don't know if this is required. */
|
||||
|
|
|
@ -526,10 +526,10 @@ void GPU_viewport_draw_to_screen_ex(GPUViewport *viewport,
|
|||
/* Mirror the UV rect in case axis-swapped drawing is requested (by passing a rect with min and
|
||||
* max values swapped). */
|
||||
if (BLI_rcti_size_x(rect) < 0) {
|
||||
SWAP(float, uv_rect.xmin, uv_rect.xmax);
|
||||
std::swap(uv_rect.xmin, uv_rect.xmax);
|
||||
}
|
||||
if (BLI_rcti_size_y(rect) < 0) {
|
||||
SWAP(float, uv_rect.ymin, uv_rect.ymax);
|
||||
std::swap(uv_rect.ymin, uv_rect.ymax);
|
||||
}
|
||||
|
||||
gpu_viewport_draw_colormanaged(
|
||||
|
|
|
@ -529,6 +529,9 @@ ImBuf *IMB_double_y(ImBuf *ibuf1);
|
|||
void IMB_flipx(ImBuf *ibuf);
|
||||
void IMB_flipy(ImBuf *ibuf);
|
||||
|
||||
/* Rotate by 90 degree increments. Returns true if the ImBuf is altered. */
|
||||
bool IMB_rotate_orthogonal(ImBuf *ibuf, int degrees);
|
||||
|
||||
/* Pre-multiply alpha. */
|
||||
|
||||
void IMB_premultiply_alpha(ImBuf *ibuf);
|
||||
|
|
|
@ -1098,10 +1098,10 @@ void IMB_rectfill_area_replace(
|
|||
CLAMP(y2, 0, height);
|
||||
|
||||
if (x1 > x2) {
|
||||
SWAP(int, x1, x2);
|
||||
std::swap( x1, x2);
|
||||
}
|
||||
if (y1 > y2) {
|
||||
SWAP(int, y1, y2);
|
||||
std::swap( y1, y2);
|
||||
}
|
||||
if (x1 == x2 || y1 == y2) {
|
||||
return;
|
||||
|
@ -1153,10 +1153,10 @@ void buf_rectfill_area(uchar *rect,
|
|||
CLAMP(y2, 0, height);
|
||||
|
||||
if (x1 > x2) {
|
||||
SWAP(int, x1, x2);
|
||||
std::swap( x1, x2);
|
||||
}
|
||||
if (y1 > y2) {
|
||||
SWAP(int, y1, y2);
|
||||
std::swap( y1, y2);
|
||||
}
|
||||
if (x1 == x2 || y1 == y2) {
|
||||
return;
|
||||
|
|
|
@ -14,6 +14,95 @@
|
|||
#include "IMB_imbuf_types.hh"
|
||||
#include "imbuf.hh"
|
||||
|
||||
bool IMB_rotate_orthogonal(ImBuf *ibuf, int degrees)
|
||||
{
|
||||
if (!ELEM(degrees, 90, 180, 270)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const int size_x = ibuf->x;
|
||||
const int size_y = ibuf->y;
|
||||
|
||||
if (ibuf->float_buffer.data) {
|
||||
float *float_pixels = ibuf->float_buffer.data;
|
||||
float *orig_float_pixels = static_cast<float *>(MEM_dupallocN(float_pixels));
|
||||
const int channels = ibuf->channels;
|
||||
if (degrees == 90) {
|
||||
std::swap(ibuf->x, ibuf->y);
|
||||
for (int y = 0; y < size_y; y++) {
|
||||
for (int x = 0; x < size_x; x++) {
|
||||
const float *source_pixel = &orig_float_pixels[(y * size_x + x) * channels];
|
||||
memcpy(&float_pixels[(y + ((size_x - x - 1) * size_y)) * channels],
|
||||
source_pixel,
|
||||
sizeof(float) * channels);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (degrees == 180) {
|
||||
for (int y = 0; y < size_y; y++) {
|
||||
for (int x = 0; x < size_x; x++) {
|
||||
const float *source_pixel = &orig_float_pixels[(y * size_x + x) * channels];
|
||||
memcpy(&float_pixels[(((size_y - y - 1) * size_x) + (size_x - x - 1)) * channels],
|
||||
source_pixel,
|
||||
sizeof(float) * channels);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (degrees == 270) {
|
||||
std::swap(ibuf->x, ibuf->y);
|
||||
for (int y = 0; y < size_y; y++) {
|
||||
for (int x = 0; x < size_x; x++) {
|
||||
const float *source_pixel = &orig_float_pixels[(y * size_x + x) * channels];
|
||||
memcpy(&float_pixels[((size_y - y - 1) + (x * size_y)) * channels],
|
||||
source_pixel,
|
||||
sizeof(float) * channels);
|
||||
}
|
||||
}
|
||||
}
|
||||
MEM_freeN(orig_float_pixels);
|
||||
if (ibuf->byte_buffer.data) {
|
||||
IMB_rect_from_float(ibuf);
|
||||
}
|
||||
}
|
||||
else if (ibuf->byte_buffer.data) {
|
||||
uchar *char_pixels = ibuf->byte_buffer.data;
|
||||
uchar *orig_char_pixels = static_cast<uchar *>(MEM_dupallocN(char_pixels));
|
||||
if (degrees == 90) {
|
||||
std::swap(ibuf->x, ibuf->y);
|
||||
for (int y = 0; y < size_y; y++) {
|
||||
for (int x = 0; x < size_x; x++) {
|
||||
const uchar *source_pixel = &orig_char_pixels[(y * size_x + x) * 4];
|
||||
memcpy(
|
||||
&char_pixels[(y + ((size_x - x - 1) * size_y)) * 4], source_pixel, sizeof(uchar[4]));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (degrees == 180) {
|
||||
for (int y = 0; y < size_y; y++) {
|
||||
for (int x = 0; x < size_x; x++) {
|
||||
const uchar *source_pixel = &orig_char_pixels[(y * size_x + x) * 4];
|
||||
memcpy(&char_pixels[(((size_y - y - 1) * size_x) + (size_x - x - 1)) * 4],
|
||||
source_pixel,
|
||||
sizeof(uchar[4]));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (degrees == 270) {
|
||||
std::swap(ibuf->x, ibuf->y);
|
||||
for (int y = 0; y < size_y; y++) {
|
||||
for (int x = 0; x < size_x; x++) {
|
||||
const uchar *source_pixel = &orig_char_pixels[(y * size_x + x) * 4];
|
||||
memcpy(
|
||||
&char_pixels[((size_y - y - 1) + (x * size_y)) * 4], source_pixel, sizeof(uchar[4]));
|
||||
}
|
||||
}
|
||||
}
|
||||
MEM_freeN(orig_char_pixels);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void IMB_flipy(ImBuf *ibuf)
|
||||
{
|
||||
size_t x_size, y_size;
|
||||
|
@ -90,7 +179,7 @@ void IMB_flipx(ImBuf *ibuf)
|
|||
for (yi = y - 1; yi >= 0; yi--) {
|
||||
const size_t x_offset = size_t(x) * yi;
|
||||
for (xr = x - 1, xl = 0; xr >= xl; xr--, xl++) {
|
||||
SWAP(uint, rect[x_offset + xr], rect[x_offset + xl]);
|
||||
std::swap(rect[x_offset + xr], rect[x_offset + xl]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -553,7 +553,7 @@ static const char *load_tristrips_element(PlyReadBuffer &file,
|
|||
int a = strip[i - 2], b = strip[i - 1], c = strip[i];
|
||||
/* Flip odd triangles. */
|
||||
if ((i - start) & 1) {
|
||||
SWAP(int, a, b);
|
||||
std::swap( a, b);
|
||||
}
|
||||
/* Add triangle if it's not degenerate. */
|
||||
if (a != b && a != c && b != c) {
|
||||
|
|
|
@ -380,7 +380,7 @@ Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md,
|
|||
}
|
||||
|
||||
if (v2 < v1) {
|
||||
SWAP(uint, v1, v2);
|
||||
std::swap(v1, v2);
|
||||
}
|
||||
sub_v3_v3v3(edgedir, orig_mvert_co[v2], orig_mvert_co[v1]);
|
||||
orig_edge_lengths[i] = len_squared_v3(edgedir);
|
||||
|
|
|
@ -138,7 +138,7 @@ int imagewrap(Tex *tex,
|
|||
|
||||
/* setup mapping */
|
||||
if (tex->imaflag & TEX_IMAROT) {
|
||||
SWAP(float, fx, fy);
|
||||
std::swap(fx, fy);
|
||||
}
|
||||
|
||||
if (tex->extend == TEX_CHECKER) {
|
||||
|
@ -1055,7 +1055,7 @@ static int imagewraposa_aniso(Tex *tex,
|
|||
|
||||
if (tex->imaflag & TEX_IMAROT) {
|
||||
float t;
|
||||
SWAP(float, minx, miny);
|
||||
std::swap(minx, miny);
|
||||
/* must rotate dxt/dyt 90 deg
|
||||
* yet another blender problem is that swapping X/Y axes (or any tex projection switches)
|
||||
* should do something similar, but it doesn't, it only swaps coords,
|
||||
|
@ -1459,7 +1459,7 @@ int imagewraposa(Tex *tex,
|
|||
}
|
||||
|
||||
if (tex->imaflag & TEX_IMAROT) {
|
||||
SWAP(float, minx, miny);
|
||||
std::swap(minx, miny);
|
||||
}
|
||||
|
||||
if (minx > 0.25f) {
|
||||
|
|
|
@ -775,8 +775,8 @@ static void do_2d_mapping(
|
|||
proj = cubemap_glob(n, texvec[0], texvec[1], texvec[2], &fx, &fy);
|
||||
|
||||
if (proj == 1) {
|
||||
SWAP(float, dxt[1], dxt[2]);
|
||||
SWAP(float, dyt[1], dyt[2]);
|
||||
std::swap(dxt[1], dxt[2]);
|
||||
std::swap(dyt[1], dyt[2]);
|
||||
}
|
||||
else if (proj == 2) {
|
||||
float f1 = dxt[0], f2 = dyt[0];
|
||||
|
@ -1226,7 +1226,7 @@ float texture_value_blend(float tex, float out, float fact, float facg, int blen
|
|||
fact *= facg;
|
||||
facm = 1.0f - fact;
|
||||
if (flip) {
|
||||
SWAP(float, fact, facm);
|
||||
std::swap(fact, facm);
|
||||
}
|
||||
|
||||
switch (blendtype) {
|
||||
|
|
|
@ -79,15 +79,15 @@ bool SEQ_edit_sequence_swap(Scene *scene, Sequence *seq_a, Sequence *seq_b, cons
|
|||
BLI_strncpy(seq_b->name + 2, name, sizeof(seq_b->name) - 2);
|
||||
|
||||
/* swap back opacity, and overlay mode */
|
||||
SWAP(int, seq_a->blend_mode, seq_b->blend_mode);
|
||||
SWAP(float, seq_a->blend_opacity, seq_b->blend_opacity);
|
||||
std::swap(seq_a->blend_mode, seq_b->blend_mode);
|
||||
std::swap(seq_a->blend_opacity, seq_b->blend_opacity);
|
||||
|
||||
SWAP(Sequence *, seq_a->prev, seq_b->prev);
|
||||
SWAP(Sequence *, seq_a->next, seq_b->next);
|
||||
SWAP(float, seq_a->start, seq_b->start);
|
||||
SWAP(float, seq_a->startofs, seq_b->startofs);
|
||||
SWAP(float, seq_a->endofs, seq_b->endofs);
|
||||
SWAP(int, seq_a->machine, seq_b->machine);
|
||||
std::swap(seq_a->prev, seq_b->prev);
|
||||
std::swap(seq_a->next, seq_b->next);
|
||||
std::swap(seq_a->start, seq_b->start);
|
||||
std::swap(seq_a->startofs, seq_b->startofs);
|
||||
std::swap(seq_a->endofs, seq_b->endofs);
|
||||
std::swap(seq_a->machine, seq_b->machine);
|
||||
seq_time_effect_range_set(scene, seq_a);
|
||||
seq_time_effect_range_set(scene, seq_b);
|
||||
|
||||
|
|
|
@ -189,8 +189,8 @@ static void seq_retiming_line_segments_tangent_circle(const SeqRetimingKey *star
|
|||
sub_v2_v2v2_db(v1, s1_1, s1_2);
|
||||
sub_v2_v2v2_db(v2, s2_1, s2_2);
|
||||
/* Rotate segments by 90 degrees around seg. 1 end and seg. 2 start point. */
|
||||
SWAP(double, v1[0], v1[1]);
|
||||
SWAP(double, v2[0], v2[1]);
|
||||
std::swap(v1[0], v1[1]);
|
||||
std::swap(v2[0], v2[1]);
|
||||
v1[0] *= -1;
|
||||
v2[0] *= -1;
|
||||
copy_v2_v2_db(s1_1, s1_2);
|
||||
|
|
|
@ -227,7 +227,7 @@ void seq_time_effect_range_set(const Scene *scene, Sequence *seq)
|
|||
}
|
||||
|
||||
if (seq->startdisp > seq->enddisp) {
|
||||
SWAP(int, seq->startdisp, seq->enddisp);
|
||||
std::swap( seq->startdisp, seq->enddisp);
|
||||
}
|
||||
|
||||
/* Values unusable for effects, these should be always 0. */
|
||||
|
|
|
@ -607,10 +607,10 @@ static void draw_display_buffer(const PlayDisplayContext *display_ctx,
|
|||
BLI_rctf_init(&preview, 0.0f, 1.0f, 0.0f, 1.0f);
|
||||
if (draw_flip) {
|
||||
if (draw_flip[0]) {
|
||||
SWAP(float, preview.xmin, preview.xmax);
|
||||
std::swap(preview.xmin, preview.xmax);
|
||||
}
|
||||
if (draw_flip[1]) {
|
||||
SWAP(float, preview.ymin, preview.ymax);
|
||||
std::swap(preview.ymin, preview.ymax);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -129,7 +129,7 @@ static void wm_xr_draw_viewport_buffers_to_active_framebuffer(
|
|||
|
||||
/* For upside down contexts, draw with inverted y-values. */
|
||||
if (is_upside_down) {
|
||||
SWAP(int, rect.ymin, rect.ymax);
|
||||
std::swap(rect.ymin, rect.ymax);
|
||||
}
|
||||
GPU_viewport_draw_to_screen_ex(vp->viewport, 0, &rect, draw_view->expects_srgb_buffer, true);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue