Geometry Nodes: Blur node speed up #109764

Merged
Hans Goudey merged 4 commits from mod_moder/blender:tmp_cleanup_blur_tp_map into main 2023-07-10 13:47:36 +02:00
66 changed files with 376 additions and 181 deletions
Showing only changes of commit 8f8eddae82 - Show all commits

View File

@ -16,7 +16,7 @@ STATUS_ERR_MISSING_UV_LAYER = (1 << 4)
STATUS_ERR_NO_FACES_SELECTED = (1 << 5)
def extend(obj, EXTEND_MODE):
def extend(obj, EXTEND_MODE, use_uv_selection):
import bmesh
from .uvcalc_transform import is_face_uv_selected
@ -38,7 +38,11 @@ def extend(obj, EXTEND_MODE):
uv_act = bm.loops.layers.uv.active # Always use the active UV layer.
# Construct a set of selected quads.
faces = {f for f in bm.faces if len(f.verts) == 4 and is_face_uv_selected(f, uv_act, False)}
faces = {f for f in bm.faces if len(f.verts) == 4 and f.select}
if use_uv_selection:
# Filter `faces` to extract only UV selected quads.
faces = {f for f in faces if is_face_uv_selected(f, uv_act, False)}
if not faces:
return STATUS_ERR_NO_FACES_SELECTED
@ -214,6 +218,11 @@ def extend(obj, EXTEND_MODE):
def main(context, operator):
use_uv_selection = True
view = context.space_data
if context.space_data and context.space_data.type == 'VIEW_3D':
use_uv_selection = False # When called from the 3D editor, UV selection is ignored.
num_meshes = 0
num_errors = 0
status = 0
@ -222,7 +231,7 @@ def main(context, operator):
for ob in ob_list:
num_meshes += 1
ret = extend(ob, operator.properties.mode)
ret = extend(ob, operator.properties.mode, use_uv_selection)
if ret != STATUS_OK:
num_errors += 1
status |= ret

View File

@ -113,7 +113,7 @@ def island_uv_bounds_center(island, uv_layer):
# ------------------------------------------------------------------------------
# Align UV Rotation Operator
def find_rotation_auto(bm, uv_layer, faces):
def find_rotation_auto(bm, uv_layer, faces, aspect_y):
sum_u = 0.0
sum_v = 0.0
for face in faces:
@ -122,7 +122,7 @@ def find_rotation_auto(bm, uv_layer, faces):
uv = loop[uv_layer].uv
du = uv[0] - prev_uv[0]
dv = uv[1] - prev_uv[1]
edge_angle = math.atan2(dv, du)
edge_angle = math.atan2(dv, du * aspect_y)
edge_angle *= 4.0 # Wrap 4 times around the circle
sum_u += math.cos(edge_angle)
sum_v += math.sin(edge_angle)
@ -132,7 +132,7 @@ def find_rotation_auto(bm, uv_layer, faces):
return -math.atan2(sum_v, sum_u) / 4.0
def find_rotation_edge(bm, uv_layer, faces):
def find_rotation_edge(bm, uv_layer, faces, aspect_y):
sum_u = 0.0
sum_v = 0.0
for face in faces:
@ -143,7 +143,7 @@ def find_rotation_edge(bm, uv_layer, faces):
if prev_select:
du = uv[0] - prev_uv[0]
dv = uv[1] - prev_uv[1]
edge_angle = math.atan2(dv, du)
edge_angle = math.atan2(dv, du * aspect_y)
edge_angle *= 2.0 # Wrap 2 times around the circle
sum_u += math.cos(edge_angle)
sum_v += math.sin(edge_angle)
@ -159,7 +159,7 @@ def find_rotation_edge(bm, uv_layer, faces):
return -math.atan2(sum_v, sum_u) / 2.0
def find_rotation_geometry(bm, uv_layer, faces, method, axis):
def find_rotation_geometry(bm, uv_layer, faces, method, axis, aspect_y):
sum_u_co = Vector((0.0, 0.0, 0.0))
sum_v_co = Vector((0.0, 0.0, 0.0))
for face in faces:
@ -168,6 +168,9 @@ def find_rotation_geometry(bm, uv_layer, faces, method, axis):
delta_uv0 = face.loops[fan - 1][uv_layer].uv - face.loops[0][uv_layer].uv
delta_uv1 = face.loops[fan][uv_layer].uv - face.loops[0][uv_layer].uv
delta_uv0[0] *= aspect_y
delta_uv1[0] *= aspect_y
mat = Matrix((delta_uv0, delta_uv1))
mat.invert_safe()
@ -190,14 +193,14 @@ def find_rotation_geometry(bm, uv_layer, faces, method, axis):
return math.atan2(sum_u_co[axis_index], sum_v_co[axis_index])
def align_uv_rotation_island(bm, uv_layer, faces, method, axis):
def align_uv_rotation_island(bm, uv_layer, faces, method, axis, aspect_y):
angle = 0.0
if method == 'AUTO':
angle = find_rotation_auto(bm, uv_layer, faces)
angle = find_rotation_auto(bm, uv_layer, faces, aspect_y)
elif method == 'EDGE':
angle = find_rotation_edge(bm, uv_layer, faces)
angle = find_rotation_edge(bm, uv_layer, faces, aspect_y)
elif method == 'GEOMETRY':
angle = find_rotation_geometry(bm, uv_layer, faces, method, axis)
angle = find_rotation_geometry(bm, uv_layer, faces, method, axis, aspect_y)
if angle == 0.0:
return False # No change.
@ -208,21 +211,21 @@ def align_uv_rotation_island(bm, uv_layer, faces, method, axis):
cos_angle = math.cos(angle)
sin_angle = math.sin(angle)
delta_u = mid_u - cos_angle * mid_u + sin_angle * mid_v
delta_v = mid_v - sin_angle * mid_u - cos_angle * mid_v
delta_u = mid_u - cos_angle * mid_u + sin_angle / aspect_y * mid_v
delta_v = mid_v - sin_angle * aspect_y * mid_u - cos_angle * mid_v
# Apply transform.
for face in faces:
for loop in face.loops:
pre_uv = loop[uv_layer].uv
u = cos_angle * pre_uv[0] - sin_angle * pre_uv[1] + delta_u
v = sin_angle * pre_uv[0] + cos_angle * pre_uv[1] + delta_v
u = cos_angle * pre_uv[0] - sin_angle / aspect_y * pre_uv[1] + delta_u
v = sin_angle * aspect_y * pre_uv[0] + cos_angle * pre_uv[1] + delta_v
loop[uv_layer].uv = u, v
return True
def align_uv_rotation_bmesh(mesh, bm, method, axis):
def align_uv_rotation_bmesh(mesh, bm, method, axis, aspect_y):
import bpy_extras.bmesh_utils
uv_layer = bm.loops.layers.uv.active
@ -233,18 +236,39 @@ def align_uv_rotation_bmesh(mesh, bm, method, axis):
changed = False
for island in islands:
if is_island_uv_selected(island, uv_layer, method == 'EDGE'):
if align_uv_rotation_island(bm, uv_layer, island, method, axis):
if align_uv_rotation_island(bm, uv_layer, island, method, axis, aspect_y):
changed = True
return changed
def align_uv_rotation(context, method, axis):
def get_aspect_y(context):
area = context.area
if not area:
return 1.0
space_data = context.area.spaces.active
if not space_data:
return 1.0
if not space_data.image:
return 1.0
image_width = space_data.image.size[0]
image_height = space_data.image.size[1]
if image_height:
return image_width / image_height
return 1.0
def align_uv_rotation(context, method, axis, correct_aspect):
import bmesh
aspect_y = 1.0
if correct_aspect:
aspect_y = get_aspect_y(context)
ob_list = context.objects_in_mode_unique_data
for ob in ob_list:
bm = bmesh.from_edit_mesh(ob.data)
if bm.loops.layers.uv:
if align_uv_rotation_bmesh(ob.data, bm, method, axis):
if align_uv_rotation_bmesh(ob.data, bm, method, axis, aspect_y):
bmesh.update_edit_mesh(ob.data)
return {'FINISHED'}
@ -274,14 +298,21 @@ class AlignUVRotation(Operator):
),
)
correct_aspect: BoolProperty(
name="Correct Aspect",
description="Take image aspect ratio into account",
default=False,
)
def execute(self, context):
return align_uv_rotation(context, self.method, self.axis)
return align_uv_rotation(context, self.method, self.axis, self.correct_aspect)
def draw(self, _context):
layout = self.layout
layout.prop(self, "method")
if self.method == 'GEOMETRY':
layout.prop(self, "axis")
layout.prop(self, "correct_aspect")
@classmethod
def poll(cls, context):

View File

@ -27,7 +27,7 @@ extern "C" {
/* Blender file format version. */
#define BLENDER_FILE_VERSION BLENDER_VERSION
#define BLENDER_FILE_SUBVERSION 7
#define BLENDER_FILE_SUBVERSION 8
/* Minimum Blender version that supports reading file written with the current
* version. Older Blender versions will test this and show a warning if the file

View File

@ -1470,8 +1470,8 @@ void calc_action_range(const bAction *act, float *start, float *end, short incl_
max += 1.0f;
}
*start = min;
*end = max;
*start = max_ff(min, MINAFRAMEF);
*end = min_ff(max, MAXFRAMEF);
}
else {
*start = 0.0f;

View File

@ -790,6 +790,22 @@ static float vfont_descent(const VFontData *vfd)
return vfd->em_height - vfont_ascent(vfd);
}
/**
* Track additional information when using the cursor to select with multiple text boxes.
* This gives a more predictable result when the user moves the cursor outside the text-box.
*/
typedef struct TextBoxBounds_ForCursor {
/**
* Describes the minimum rectangle that contains all characters in a text-box,
* values are compatible with #TextBox.
*/
rctf bounds;
/**
* The last character in this text box or -1 when unfilled.
*/
int char_index_last;
} TextBoxBounds_ForCursor;
static bool vfont_to_curve(Object *ob,
Curve *cu,
const eEditFontMode mode,
@ -933,6 +949,23 @@ static bool vfont_to_curve(Object *ob,
custrinfo[i].flag &= ~(CU_CHINFO_WRAP | CU_CHINFO_SMALLCAPS_CHECK | CU_CHINFO_OVERFLOW);
}
TextBoxBounds_ForCursor *tb_bounds_for_cursor = NULL;
if (cursor_params != NULL) {
if (cu->textoncurve == NULL && (cu->totbox > 1) && (slen > 0)) {
tb_bounds_for_cursor = MEM_malloc_arrayN(
cu->totbox, sizeof(TextBoxBounds_ForCursor), "TextboxBounds_Cursor");
for (curbox = 0; curbox < cu->totbox; curbox++) {
TextBoxBounds_ForCursor *tb_bounds = &tb_bounds_for_cursor[curbox];
tb_bounds->char_index_last = -1;
tb_bounds->bounds.xmin = FLT_MAX;
tb_bounds->bounds.xmax = -FLT_MAX;
tb_bounds->bounds.ymin = FLT_MAX;
tb_bounds->bounds.ymax = -FLT_MAX;
}
}
curbox = 0;
}
i = 0;
while (i <= slen) {
/* Characters in the list */
@ -1072,6 +1105,10 @@ static bool vfont_to_curve(Object *ob,
CLAMP_MIN(maxlen, lineinfo[lnr].x_min);
if (tb_bounds_for_cursor != NULL) {
tb_bounds_for_cursor[curbox].char_index_last = i;
}
if ((tb_scale.h != 0.0f) && (-(yof - tb_scale.y) > (tb_scale.h - linedist) - yof_scale)) {
if (cu->totbox > (curbox + 1)) {
maxlen = 0;
@ -1331,6 +1368,44 @@ static bool vfont_to_curve(Object *ob,
}
}
}
if (tb_bounds_for_cursor != NULL) {
int char_beg_next = 0;
for (curbox = 0; curbox < cu->totbox; curbox++) {
TextBoxBounds_ForCursor *tb_bounds = &tb_bounds_for_cursor[curbox];
if (tb_bounds->char_index_last == -1) {
continue;
}
const int char_beg = char_beg_next;
const int char_end = tb_bounds->char_index_last;
struct TempLineInfo *line_beg = &lineinfo[chartransdata[char_beg].linenr];
struct TempLineInfo *line_end = &lineinfo[chartransdata[char_end].linenr];
int char_idx_offset = char_beg;
rctf *bounds = &tb_bounds->bounds;
/* In a text-box with no curves, 'yof' only decrements over lines, 'ymax' and 'ymin'
* can be obtained from any character in the first and last line of the text-box. */
bounds->ymax = chartransdata[char_beg].yof;
bounds->ymin = chartransdata[char_end].yof;
for (struct TempLineInfo *line = line_beg; line <= line_end; line++) {
const struct CharTrans *first_char_line = &chartransdata[char_idx_offset];
const struct CharTrans *last_char_line = &chartransdata[char_idx_offset + line->char_nr];
bounds->xmin = min_ff(bounds->xmin, first_char_line->xof);
bounds->xmax = max_ff(bounds->xmax, last_char_line->xof);
char_idx_offset += line->char_nr + 1;
}
/* Move the bounds into a space compatible with `cursor_location`. */
bounds->xmin *= font_size;
bounds->xmax *= font_size;
bounds->ymin *= font_size;
bounds->ymax *= font_size;
char_beg_next = tb_bounds->char_index_last + 1;
}
}
MEM_freeN(lineinfo);
MEM_freeN(i_textbox_array);
@ -1748,35 +1823,104 @@ static bool vfont_to_curve(Object *ob,
}
if (cursor_params) {
cursor_params->r_string_offset = -1;
for (i = 0; i <= slen; i++, ct++) {
info = &custrinfo[i];
ascii = mem[i];
if (info->flag & CU_CHINFO_SMALLCAPS_CHECK) {
ascii = towupper(ascii);
}
ct = &chartransdata[i];
che = find_vfont_char(vfd, ascii);
float charwidth = char_width(cu, che, info);
float charhalf = (charwidth / 2.0f);
if (cursor_params->cursor_location[1] >= (ct->yof - (0.25f * linedist)) * font_size &&
cursor_params->cursor_location[1] <= (ct->yof + (0.75f * linedist)) * font_size)
{
/* On this row. */
if (cursor_params->cursor_location[0] >= (ct->xof * font_size) &&
cursor_params->cursor_location[0] <= ((ct->xof + charhalf) * font_size))
{
/* Left half of character. */
cursor_params->r_string_offset = i;
}
else if (cursor_params->cursor_location[0] >= ((ct->xof + charhalf) * font_size) &&
cursor_params->cursor_location[0] <= ((ct->xof + charwidth) * font_size))
{
/* Right half of character. */
cursor_params->r_string_offset = i + 1;
}
}
const float *cursor_location = cursor_params->cursor_location;
/* Erasing all text could give slen = 0 */
if (slen == 0) {
cursor_params->r_string_offset = -1;
}
else if (cu->textoncurve != NULL) {
int closest_char = -1;
float closest_dist_sq = FLT_MAX;
for (i = 0; i <= slen; i++) {
const float char_location[2] = {
chartransdata[i].xof * font_size,
chartransdata[i].yof * font_size,
};
const float test_dist_sq = len_squared_v2v2(cursor_location, char_location);
if (closest_dist_sq > test_dist_sq) {
closest_char = i;
closest_dist_sq = test_dist_sq;
}
}
cursor_params->r_string_offset = closest_char;
}
else {
/* Find the first box closest to `cursor_location`. */
int char_beg = 0;
int char_end = slen;
if (tb_bounds_for_cursor != NULL) {
/* Search for the closest box. */
int closest_box = -1;
float closest_dist_sq = FLT_MAX;
for (curbox = 0; curbox < cu->totbox; curbox++) {
const TextBoxBounds_ForCursor *tb_bounds = &tb_bounds_for_cursor[curbox];
if (tb_bounds->char_index_last == -1) {
continue;
}
/* The closest point in the box to the `cursor_location`
* by clamping it to the bounding box. */
const float cursor_location_clamped[2] = {
clamp_f(cursor_location[0], tb_bounds->bounds.xmin, tb_bounds->bounds.xmax),
clamp_f(cursor_location[1], tb_bounds->bounds.ymin, tb_bounds->bounds.ymax),
};
const float test_dist_sq = len_squared_v2v2(cursor_location, cursor_location_clamped);
if (test_dist_sq < closest_dist_sq) {
closest_dist_sq = test_dist_sq;
closest_box = curbox;
}
}
if (closest_box != -1) {
if (closest_box != 0) {
char_beg = tb_bounds_for_cursor[closest_box - 1].char_index_last + 1;
}
char_end = tb_bounds_for_cursor[closest_box].char_index_last;
}
MEM_freeN(tb_bounds_for_cursor);
tb_bounds_for_cursor = NULL; /* Safety only. */
}
const float interline_offset = ((linedist - 0.5f) / 2.0f) * font_size;
/* Loop until find the line where `cursor_location` is over. */
for (i = char_beg; i <= char_end; i++) {
if (cursor_location[1] >= ((chartransdata[i].yof * font_size) - interline_offset)) {
break;
}
}
i = min_ii(i, char_end);
const float char_yof = chartransdata[i].yof;
/* Loop back until find the first character of the line, this because `cursor_location` can
* be positioned further below the text, so #i can be the last character of the last line. */
for (; i >= char_beg + 1 && chartransdata[i - 1].yof == char_yof; i--) {
}
/* Loop until find the first character to the right of `cursor_location`
* (using the character midpoint on the x-axis as a reference). */
for (; i <= char_end && char_yof == chartransdata[i].yof; i++) {
info = &custrinfo[i];
ascii = info->flag & CU_CHINFO_SMALLCAPS_CHECK ? towupper(mem[i]) : mem[i];
che = find_vfont_char(vfd, ascii);
const float charwidth = char_width(cu, che, info);
const float charhalf = (charwidth / 2.0f);
if (cursor_location[0] <= ((chartransdata[i].xof + charhalf) * font_size)) {
break;
}
}
i = min_ii(i, char_end);
/* If there is no character to the right of the cursor we are on the next line, go back to
* the last character of the previous line. */
if (i > char_beg && chartransdata[i].yof != char_yof) {
i -= 1;
}
cursor_params->r_string_offset = i;
}
/* Must be cleared & freed. */
BLI_assert(tb_bounds_for_cursor == NULL);
}
/* Scale to fit only works for single text box layouts. */

View File

@ -40,7 +40,7 @@ struct HeapNode_Chunk {
* \note keep type in sync with nodes_num in heap_node_alloc_chunk.
*/
#define HEAP_CHUNK_DEFAULT_NUM \
((uint)((MEM_SIZE_OPTIMAL((1 << 16) - sizeof(struct HeapNode_Chunk))) / sizeof(HeapNode)))
(uint)(MEM_SIZE_OPTIMAL((1 << 16) - sizeof(struct HeapNode_Chunk)) / sizeof(HeapNode))
struct Heap {
uint size;

View File

@ -258,6 +258,12 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain)
}
}
if (!MAIN_VERSION_ATLEAST(bmain, 400, 8)) {
LISTBASE_FOREACH (bAction *, act, &bmain->actions) {
act->frame_start = max_ff(act->frame_start, MINAFRAMEF);
act->frame_end = min_ff(act->frame_end, MAXFRAMEF);
}
}
/**
* Versioning code until next subversion bump goes here.
*

View File

@ -61,7 +61,7 @@ void DespeckleOperation::execute_pixel(float output[4], int x, int y, void * /*d
input_operation_->read(color_org, x2, y2, nullptr);
#define TOT_DIV_ONE 1.0f
#define TOT_DIV_CNR (float)M_SQRT1_2
#define TOT_DIV_CNR float(M_SQRT1_2)
#define WTOT (TOT_DIV_ONE * 4 + TOT_DIV_CNR * 4)
@ -177,7 +177,7 @@ void DespeckleOperation::update_memory_buffer_partial(MemoryBuffer *output,
const float *in1 = nullptr;
#define TOT_DIV_ONE 1.0f
#define TOT_DIV_CNR (float)M_SQRT1_2
#define TOT_DIV_CNR float(M_SQRT1_2)
#define WTOT (TOT_DIV_ONE * 4 + TOT_DIV_CNR * 4)

View File

@ -76,4 +76,4 @@ void lightprobe_eval(ClosureDiffuse diffuse,
SphericalHarmonicL1 irradiance = lightprobe_irradiance_sample(irradiance_atlas_tx, P);
out_diffuse += spherical_harmonics_evaluate_lambert(diffuse.N, irradiance);
}
}

View File

@ -30,4 +30,4 @@ vec3 octahedral_uv_to_direction(vec2 co)
}
return v;
}
}

View File

@ -16,4 +16,4 @@ void main()
vec4 col = textureLod(cubemap_tx, R, 0.0);
imageStore(octahedral_img, octahedral_coord, col);
}
}

View File

@ -2466,7 +2466,7 @@ static float x_axis_name[4][2] = {
{-0.9f * S_X, 1.0f * S_Y},
{1.0f * S_X, -1.0f * S_Y},
};
#define X_LEN (ARRAY_SIZE(x_axis_name))
#define X_LEN ARRAY_SIZE(x_axis_name)
#undef S_X
#undef S_Y
@ -2480,7 +2480,7 @@ static float y_axis_name[6][2] = {
{0.0f * S_X, -0.1f * S_Y},
{0.0f * S_X, -1.0f * S_Y},
};
#define Y_LEN (ARRAY_SIZE(y_axis_name))
#define Y_LEN ARRAY_SIZE(y_axis_name)
#undef S_X
#undef S_Y
@ -2498,7 +2498,7 @@ static float z_axis_name[10][2] = {
{-1.00f * S_X, -1.00f * S_Y},
{1.00f * S_X, -1.00f * S_Y},
};
#define Z_LEN (ARRAY_SIZE(z_axis_name))
#define Z_LEN ARRAY_SIZE(z_axis_name)
#undef S_X
#undef S_Y
@ -2525,7 +2525,7 @@ static float axis_marker[8][2] = {
{-S_X, 0.0f}
#endif
};
#define MARKER_LEN (ARRAY_SIZE(axis_marker))
#define MARKER_LEN ARRAY_SIZE(axis_marker)
#define MARKER_FILL_LAYER 6
#undef S_X
#undef S_Y

View File

@ -4219,7 +4219,7 @@ static void ANIM_OT_channel_view_pick(wmOperatorType *ot)
/** \name Operator Registration
* \{ */
void ED_operatortypes_animchannels(void)
void ED_operatortypes_animchannels()
{
WM_operatortype_append(ANIM_OT_channels_select_all);
WM_operatortype_append(ANIM_OT_channels_select_box);

View File

@ -1474,7 +1474,7 @@ static size_t animfilter_action(bAnimContext *ac,
/* un-grouped F-Curves (only if we're not only considering those channels in the active group) */
if (!(filter_mode & ANIMFILTER_ACTGROUPED)) {
FCurve *firstfcu = (lastchan) ? (lastchan->next) : static_cast<FCurve *>((act->curves.first));
FCurve *firstfcu = (lastchan) ? (lastchan->next) : static_cast<FCurve *>(act->curves.first);
items += animfilter_fcurves(
anim_data, ads, firstfcu, ANIMTYPE_FCURVE, filter_mode, nullptr, owner_id, &act->id);
}

View File

@ -237,7 +237,7 @@ void getcolor_fcurve_rainbow(int cur, int tot, float out[3])
* However, only a range of 0.3 to 1.0 is really usable to avoid clashing
* with some other stuff
*/
fac = ((float)cur / (float)tot) * 0.7f;
fac = (float(cur) / float(tot)) * 0.7f;
/* the base color can get offset a bit so that the colors aren't so identical */
hsv[0] += fac * HSV_BANDWIDTH;

View File

@ -1028,7 +1028,7 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, const wmEvent *even
value = TIME2FRA(value);
}
RNA_int_set(op->ptr, "frames", (int)value);
RNA_int_set(op->ptr, "frames", int(value));
ed_marker_move_apply(C, op);
ed_marker_move_update_header(C, op);
}
@ -1078,7 +1078,7 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, const wmEvent *even
0.1 * FPS,
0);
RNA_int_set(op->ptr, "frames", (int)fac);
RNA_int_set(op->ptr, "frames", int(fac));
ed_marker_move_apply(C, op);
ed_marker_move_update_header(C, op);
}
@ -1094,7 +1094,7 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, const wmEvent *even
value = TIME2FRA(value);
}
RNA_int_set(op->ptr, "frames", (int)value);
RNA_int_set(op->ptr, "frames", int(value));
ed_marker_move_apply(C, op);
ed_marker_move_update_header(C, op);
}
@ -1897,7 +1897,7 @@ static void MARKER_OT_camera_bind(wmOperatorType *ot)
/** \name Registration
* \{ */
void ED_operatortypes_marker(void)
void ED_operatortypes_marker()
{
WM_operatortype_append(MARKER_OT_add);
WM_operatortype_append(MARKER_OT_move);

View File

@ -173,7 +173,7 @@ static void motionpaths_calc_bake_targets(ListBase *targets, int cframe)
copy_v3_v3(mpv->co, ob_eval->object_to_world[3]);
}
float mframe = (float)(cframe);
float mframe = float(cframe);
/* Tag if it's a keyframe */
if (ED_keylist_find_exact(mpt->keylist, mframe)) {

View File

@ -653,7 +653,7 @@ static void ANIM_OT_previewrange_clear(wmOperatorType *ot)
/** \name Registration
* \{ */
void ED_operatortypes_anim(void)
void ED_operatortypes_anim()
{
/* Animation Editors only -------------------------- */
WM_operatortype_append(ANIM_OT_change_frame);

View File

@ -573,7 +573,7 @@ bool ANIM_remove_driver(
/* Copy/Paste Buffer for Driver Data... */
static FCurve *channeldriver_copypaste_buf = nullptr;
void ANIM_drivers_copybuf_free(void)
void ANIM_drivers_copybuf_free()
{
/* free the buffer F-Curve if it exists, as if it were just another F-Curve */
if (channeldriver_copypaste_buf) {
@ -582,7 +582,7 @@ void ANIM_drivers_copybuf_free(void)
channeldriver_copypaste_buf = nullptr;
}
bool ANIM_driver_can_paste(void)
bool ANIM_driver_can_paste()
{
return (channeldriver_copypaste_buf != nullptr);
}
@ -694,7 +694,7 @@ bool ANIM_paste_driver(
/* Copy/Paste Buffer for Driver Variables... */
static ListBase driver_vars_copybuf = {nullptr, nullptr};
void ANIM_driver_vars_copybuf_free(void)
void ANIM_driver_vars_copybuf_free()
{
/* Free the driver variables kept in the buffer */
if (driver_vars_copybuf.first) {
@ -710,7 +710,7 @@ void ANIM_driver_vars_copybuf_free(void)
BLI_listbase_clear(&driver_vars_copybuf);
}
bool ANIM_driver_vars_can_paste(void)
bool ANIM_driver_vars_can_paste()
{
return (BLI_listbase_is_empty(&driver_vars_copybuf) == false);
}

View File

@ -950,7 +950,7 @@ static ListBase fmodifier_copypaste_buf = {nullptr, nullptr};
/* ---------- */
void ANIM_fmodifiers_copybuf_free(void)
void ANIM_fmodifiers_copybuf_free()
{
/* just free the whole buffer */
free_fmodifiers(&fmodifier_copypaste_buf);

View File

@ -397,7 +397,7 @@ void ED_ANIM_get_1d_gauss_kernel(const float sigma, const int kernel_size, doubl
double sum = 0.0;
for (int i = 0; i < kernel_size; i++) {
const double normalized_index = (double)i / (kernel_size - 1);
const double normalized_index = double(i) / (kernel_size - 1);
r_kernel[i] = exp(-normalized_index * normalized_index / sigma_sq);
if (i == 0) {
sum += r_kernel[i];
@ -433,7 +433,7 @@ void smooth_fcurve_segment(FCurve *fcu,
filter_result += samples[sample_index + j] * kernel_value;
filter_result += samples[sample_index - j] * kernel_value;
}
const float key_y_value = interpf((float)filter_result, samples[sample_index], factor);
const float key_y_value = interpf(float(filter_result), samples[sample_index], factor);
BKE_fcurve_keyframe_move_value_with_handles(&fcu->bezt[i], key_y_value);
}
}
@ -862,7 +862,7 @@ struct tAnimCopybufItem {
bool is_bone; /* special flag for armature bones */
};
void ANIM_fcurves_copybuf_free(void)
void ANIM_fcurves_copybuf_free()
{
tAnimCopybufItem *aci, *acn;

View File

@ -616,7 +616,7 @@ void ANIM_keyingset_info_unregister(Main *bmain, KeyingSetInfo *ksi)
BLI_freelinkN(&keyingset_type_infos, ksi);
}
void ANIM_keyingset_infos_exit(void)
void ANIM_keyingset_infos_exit()
{
KeyingSetInfo *ksi, *next;

View File

@ -1269,7 +1269,7 @@ static int armature_symmetrize_exec(bContext *C, wmOperator *op)
{
if (ebone_iter->temp.ebone) {
/* copy all flags except for ... */
const int flag_copy = ((int)~0) & ~(BONE_SELECTED | BONE_ROOTSEL | BONE_TIPSEL);
const int flag_copy = int(~0) & ~(BONE_SELECTED | BONE_ROOTSEL | BONE_TIPSEL);
EditBone *ebone = ebone_iter->temp.ebone;

View File

@ -136,7 +136,7 @@ void ED_armature_origin_set(
add_v3_v3(cent, ebone->tail);
}
if (total) {
mul_v3_fl(cent, 1.0f / (float)total);
mul_v3_fl(cent, 1.0f / float(total));
}
}
}
@ -190,7 +190,7 @@ float ED_armature_ebone_roll_to_vector(const EditBone *bone,
sub_v3_v3v3(align_axis_proj, align_axis, vec);
if (axis_only) {
if (angle_v3v3(align_axis_proj, mat[2]) > (float)(M_PI_2)) {
if (angle_v3v3(align_axis_proj, mat[2]) > float(M_PI_2)) {
negate_v3(align_axis_proj);
}
}

View File

@ -18,7 +18,7 @@
/* ************************** registration **********************************/
void ED_operatortypes_armature(void)
void ED_operatortypes_armature()
{
/* Both operators `ARMATURE_OT_*` and `POSE_OT_*` are registered here. */
@ -127,7 +127,7 @@ void ED_operatortypes_armature(void)
WM_operatortype_append(POSE_OT_blend_to_neighbors);
}
void ED_operatormacros_armature(void)
void ED_operatormacros_armature()
{
wmOperatorType *ot;
wmOperatorTypeMacro *otmacro;

View File

@ -1700,7 +1700,7 @@ static void select_similar_direction(bContext *C, const float thresh)
float dir[3];
bone_direction_worldspace_get(ob, ebone, dir);
if (angle_v3v3(dir_act, dir) / (float)M_PI < (thresh + FLT_EPSILON)) {
if (angle_v3v3(dir_act, dir) / float(M_PI) < (thresh + FLT_EPSILON)) {
ED_armature_ebone_select_set(ebone, true);
changed = true;
}

View File

@ -638,11 +638,11 @@ static void armature_finalize_restpose(ListBase *bonelist, ListBase *editbonelis
mul_m3_m3m3(difmat, imat, postmat);
#if 0
printf("Bone %s\n", curBone->name);
print_m4("premat", premat);
print_m4("postmat", postmat);
print_m4("difmat", difmat);
#if 0
printf("Bone %s\n", curBone->name);
print_m4("premat", premat);
print_m4("postmat", postmat);
print_m4("difmat", difmat);
printf("Roll = %f\n", RAD2DEGF(-atan2(difmat[2][0], difmat[2][2])));
#endif

View File

@ -627,7 +627,7 @@ static int pose_bone_rotmode_exec(bContext *C, wmOperator *op)
CTX_DATA_BEGIN_WITH_ID (C, bPoseChannel *, pchan, selected_pose_bones, Object *, ob) {
/* use API Method for conversions... */
BKE_rotMode_change_values(
pchan->quat, pchan->eul, pchan->rotAxis, &pchan->rotAngle, pchan->rotmode, (short)mode);
pchan->quat, pchan->eul, pchan->rotAxis, &pchan->rotAngle, pchan->rotmode, short(mode));
/* finally, set the new rotation type */
pchan->rotmode = mode;

View File

@ -49,7 +49,7 @@
#include "armature_intern.h"
/* utility macros for storing a temp int in the bone (selection flag) */
#define PBONE_PREV_FLAG_GET(pchan) ((void)0, (POINTER_AS_INT((pchan)->temp)))
#define PBONE_PREV_FLAG_GET(pchan) ((void)0, POINTER_AS_INT((pchan)->temp))
#define PBONE_PREV_FLAG_SET(pchan, val) ((pchan)->temp = POINTER_FROM_INT(val))
/* ***************** Pose Select Utilities ********************* */

View File

@ -15,7 +15,7 @@
#include "lattice_intern.h"
void ED_operatortypes_lattice(void)
void ED_operatortypes_lattice()
{
WM_operatortype_append(LATTICE_OT_select_all);
WM_operatortype_append(LATTICE_OT_select_more);

View File

@ -582,7 +582,7 @@ static void edbm_bevel_numinput_set_value(wmOperator *op)
CLAMP(value, value_clamp_min[vmode], value_clamp_max[vmode]);
if (vmode == SEGMENTS_VALUE) {
opdata->segments = value;
RNA_int_set(op->ptr, "segments", (int)value);
RNA_int_set(op->ptr, "segments", int(value));
}
else {
RNA_float_set(op->ptr, value_rna_name[vmode], value);

View File

@ -740,16 +740,16 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, const w
}
}
mul_v3_fl(local_center, 1.0f / (float)local_verts_len);
mul_v3_fl(local_center, 1.0f / float(local_verts_len));
mul_m4_v3(vc.obedit->object_to_world, local_center);
mul_v3_fl(local_center, (float)local_verts_len);
mul_v3_fl(local_center, float(local_verts_len));
add_v3_v3(center, local_center);
verts_len += local_verts_len;
}
if (verts_len != 0) {
mul_v3_fl(center, 1.0f / (float)verts_len);
mul_v3_fl(center, 1.0f / float(verts_len));
}
/* Then we process the meshes. */

View File

@ -644,7 +644,7 @@ static void knifetool_draw_angle(const KnifeTool_OpData *kcd,
}
else {
BKE_unit_value_as_string(
numstr, sizeof(numstr), (double)angle, angle_precision, B_UNIT_ROTATION, unit, false);
numstr, sizeof(numstr), double(angle), angle_precision, B_UNIT_ROTATION, unit, false);
}
BLF_enable(blf_mono_font, BLF_ROTATION);
@ -2350,10 +2350,10 @@ static void knife_make_cuts(KnifeTool_OpData *kcd, Object *ob)
if (!f || kfe->e) {
continue;
}
list = static_cast<ListBase *>(BLI_smallhash_lookup(fhash, (uintptr_t)f));
list = static_cast<ListBase *>(BLI_smallhash_lookup(fhash, uintptr_t(f)));
if (!list) {
list = knife_empty_list(kcd);
BLI_smallhash_insert(fhash, (uintptr_t)f, list);
BLI_smallhash_insert(fhash, uintptr_t(f), list);
}
knife_append_list(kcd, list, kfe);
}
@ -2372,10 +2372,10 @@ static void knife_make_cuts(KnifeTool_OpData *kcd, Object *ob)
if (!e) {
continue;
}
list = static_cast<ListBase *>(BLI_smallhash_lookup(ehash, (uintptr_t)e));
list = static_cast<ListBase *>(BLI_smallhash_lookup(ehash, uintptr_t(e)));
if (!list) {
list = knife_empty_list(kcd);
BLI_smallhash_insert(ehash, (uintptr_t)e, list);
BLI_smallhash_insert(ehash, uintptr_t(e), list);
}
/* There can be more than one kfe in kfv's list with same e. */
if (!find_ref(list, kfv)) {
@ -2958,12 +2958,12 @@ static void knife_find_line_hits(KnifeTool_OpData *kcd)
continue;
}
/* For faces, store index of lowest hit looptri in hash. */
if (BLI_smallhash_haskey(&faces, (uintptr_t)f)) {
if (BLI_smallhash_haskey(&faces, uintptr_t(f))) {
continue;
}
/* Don't care what the value is except that it is non-null, for iterator. */
BLI_smallhash_insert(&faces, (uintptr_t)f, f);
BLI_smallhash_insert(&fobs, (uintptr_t)f, (void *)(uintptr_t)ob_index);
BLI_smallhash_insert(&faces, uintptr_t(f), f);
BLI_smallhash_insert(&fobs, uintptr_t(f), (void *)uintptr_t(ob_index));
list = knife_get_face_kedges(kcd, ob, ob_index, f);
for (ref = static_cast<Ref *>(list->first); ref; ref = ref->next) {
@ -2971,14 +2971,14 @@ static void knife_find_line_hits(KnifeTool_OpData *kcd)
if (kfe->is_invalid) {
continue;
}
if (BLI_smallhash_haskey(&kfes, (uintptr_t)kfe)) {
if (BLI_smallhash_haskey(&kfes, uintptr_t(kfe))) {
continue;
}
BLI_smallhash_insert(&kfes, (uintptr_t)kfe, kfe);
BLI_smallhash_insert(&kfes, uintptr_t(kfe), kfe);
v = kfe->v1;
BLI_smallhash_reinsert(&kfvs, (uintptr_t)v, v);
BLI_smallhash_reinsert(&kfvs, uintptr_t(v), v);
v = kfe->v2;
BLI_smallhash_reinsert(&kfvs, (uintptr_t)v, v);
BLI_smallhash_reinsert(&kfvs, uintptr_t(v), v);
}
}
@ -3141,7 +3141,7 @@ static void knife_find_line_hits(KnifeTool_OpData *kcd)
{
float p[3], p_cage[3];
uint ob_index = (uint)(uintptr_t)BLI_smallhash_lookup(&fobs, (uintptr_t)f);
uint ob_index = (uint)(uintptr_t)BLI_smallhash_lookup(&fobs, uintptr_t(f));
ob = kcd->objects[ob_index];
if (use_hit_prev &&
@ -3346,7 +3346,7 @@ static float knife_snap_size(KnifeTool_OpData *kcd, float maxsize)
kcd, maxsize * 2.0f, kcd->curr.ob, kcd->curr.ob_index, kcd->curr.bmface, kcd->curr.cage);
}
return density ? min_ff(maxsize / ((float)density * 0.5f), maxsize) : maxsize;
return density ? min_ff(maxsize / (float(density) * 0.5f), maxsize) : maxsize;
}
/* Snap to edge when in a constrained mode.

View File

@ -122,7 +122,7 @@ struct EditMesh_PreSelEdgeRing {
int verts_len;
};
struct EditMesh_PreSelEdgeRing *EDBM_preselect_edgering_create(void)
struct EditMesh_PreSelEdgeRing *EDBM_preselect_edgering_create()
{
struct EditMesh_PreSelEdgeRing *psel = static_cast<EditMesh_PreSelEdgeRing *>(
MEM_callocN(sizeof(*psel), __func__));
@ -185,7 +185,7 @@ void EDBM_preselect_edgering_draw(struct EditMesh_PreSelEdgeRing *psel, const fl
/* Same size as an edit mode vertex */
immUniform1f("size",
2.0 * U.pixelsize *
max_ff(1.0f, UI_GetThemeValuef(TH_VERTEX_SIZE) * (float)M_SQRT2 / 2.0f));
max_ff(1.0f, UI_GetThemeValuef(TH_VERTEX_SIZE) * float(M_SQRT2) / 2.0f));
immBegin(GPU_PRIM_POINTS, psel->verts_len);
@ -221,7 +221,7 @@ static void view3d_preselect_mesh_edgering_update_verts_from_edge(
edgering_vcos_get_pair(&eed_start->v1, v_cos, coords);
for (i = 1; i <= previewlines; i++) {
const float fac = (i / ((float)previewlines + 1));
const float fac = (i / (float(previewlines) + 1));
interp_v3_v3v3(verts[tot], v_cos[0], v_cos[1], fac);
tot++;
}
@ -291,7 +291,7 @@ static void view3d_preselect_mesh_edgering_update_edges_from_edge(
eve_last = v[0][0];
for (i = 1; i <= previewlines; i++) {
const float fac = (i / ((float)previewlines + 1));
const float fac = (i / (float(previewlines) + 1));
float v_cos[2][2][3];
edgering_vcos_get(v, v_cos, coords);
@ -318,7 +318,7 @@ static void view3d_preselect_mesh_edgering_update_edges_from_edge(
edgering_find_order(eed_last, eed_start, eve_last, v);
for (i = 1; i <= previewlines; i++) {
const float fac = (i / ((float)previewlines + 1));
const float fac = (i / (float(previewlines) + 1));
float v_cos[2][2][3];
if (!v[0][0] || !v[0][1] || !v[1][0] || !v[1][1]) {

View File

@ -83,7 +83,7 @@ eEditMesh_PreSelPreviewAction EDBM_preselect_action_get(struct EditMesh_PreSelEl
return psel->preview_action;
}
struct EditMesh_PreSelElem *EDBM_preselect_elem_create(void)
struct EditMesh_PreSelElem *EDBM_preselect_elem_create()
{
struct EditMesh_PreSelElem *psel = static_cast<EditMesh_PreSelElem *>(
MEM_callocN(sizeof(*psel), __func__));

View File

@ -81,7 +81,7 @@ static int edbm_rip_edge_invoke(bContext *C, wmOperator * /*op*/, const wmEvent
cent_tot += 1;
}
}
mul_v2_fl(cent_sco, 1.0f / (float)cent_tot);
mul_v2_fl(cent_sco, 1.0f / float(cent_tot));
/* not essential, but gives more expected results with edge selection */
if (bm->totedgesel) {

View File

@ -583,7 +583,7 @@ static int similar_edge_select_exec(bContext *C, wmOperator *op)
const int type = RNA_enum_get(op->ptr, "type");
const float thresh = RNA_float_get(op->ptr, "threshold");
const float thresh_radians = thresh * (float)M_PI + FLT_EPSILON;
const float thresh_radians = thresh * float(M_PI) + FLT_EPSILON;
const int compare = RNA_enum_get(op->ptr, "compare");
int tot_edges_selected_all = 0;
@ -961,7 +961,7 @@ static int similar_vert_select_exec(bContext *C, wmOperator *op)
/* get the type from RNA */
const int type = RNA_enum_get(op->ptr, "type");
const float thresh = RNA_float_get(op->ptr, "threshold");
const float thresh_radians = thresh * (float)M_PI + FLT_EPSILON;
const float thresh_radians = thresh * float(M_PI) + FLT_EPSILON;
const int compare = RNA_enum_get(op->ptr, "compare");
int tot_verts_selected_all = 0;

View File

@ -615,7 +615,7 @@ int BM_uv_element_get_unique_index(UvElementMap *element_map, UvElement *child)
return unique_index[index];
}
#define INVALID_ISLAND (uint(-1))
#define INVALID_ISLAND uint(-1)
static void bm_uv_assign_island(UvElementMap *element_map,
UvElement *element,

View File

@ -20,7 +20,7 @@
/**************************** registration **********************************/
void ED_operatortypes_mesh(void)
void ED_operatortypes_mesh()
{
WM_operatortype_append(MESH_OT_select_all);
WM_operatortype_append(MESH_OT_select_interior_faces);
@ -205,7 +205,7 @@ static int ED_operator_editmesh_face_select(bContext *C)
}
#endif
void ED_operatormacros_mesh(void)
void ED_operatormacros_mesh()
{
wmOperatorType *ot;
wmOperatorTypeMacro *otmacro;

View File

@ -301,7 +301,7 @@ static bool mball_select_similar_type(Object *obedit,
BKE_object_rot_to_mat3(obedit, rmat, true);
mul_m3_v3(rmat, dir);
float thresh_cos = cosf(thresh * (float)M_PI_2);
float thresh_cos = cosf(thresh * float(M_PI_2));
KDTreeNearest_3d nearest;
if (BLI_kdtree_3d_find_nearest(tree_3d, dir, &nearest) != -1) {

View File

@ -18,7 +18,7 @@
#include "mball_intern.h"
void ED_operatortypes_metaball(void)
void ED_operatortypes_metaball()
{
WM_operatortype_append(MBALL_OT_delete_metaelems);
WM_operatortype_append(MBALL_OT_duplicate_metaelems);
@ -31,7 +31,7 @@ void ED_operatortypes_metaball(void)
WM_operatortype_append(MBALL_OT_select_random_metaelems);
}
void ED_operatormacros_metaball(void)
void ED_operatormacros_metaball()
{
wmOperatorType *ot;
wmOperatorTypeMacro *otmacro;

View File

@ -654,4 +654,4 @@ void OBJECT_OT_collection_objects_select(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
}

View File

@ -1130,7 +1130,7 @@ static int followpath_path_animate_exec(bContext *C, wmOperator *op)
* y = Ax + B
* 1 0 <-- coefficients array indices
*/
float A = standardRange / (float)(len);
float A = standardRange / float(len);
float B = (float)(-sfra) * A;
gen->coefficients[1] = A;
@ -2793,4 +2793,4 @@ void POSE_OT_ik_clear(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/** \} */
/** \} */

View File

@ -87,7 +87,7 @@ static int return_editmesh_indexar(BMEditMesh *em,
nr++;
}
mul_v3_fl(r_cent, 1.0f / (float)indexar_num);
mul_v3_fl(r_cent, 1.0f / float(indexar_num));
return indexar_num;
}
@ -120,7 +120,7 @@ static bool return_editmesh_vgroup(Object *obedit, BMEditMesh *em, char *r_name,
const ListBase *defbase = BKE_object_defgroup_list(obedit);
bDeformGroup *dg = static_cast<bDeformGroup *>(BLI_findlink(defbase, defgrp_index));
BLI_strncpy(r_name, dg->name, sizeof(dg->name));
mul_v3_fl(r_cent, 1.0f / (float)indexar_num);
mul_v3_fl(r_cent, 1.0f / float(indexar_num));
return true;
}
}
@ -197,7 +197,7 @@ static int return_editlattice_indexar(Lattice *editlatt,
nr++;
}
mul_v3_fl(r_cent, 1.0f / (float)indexar_num);
mul_v3_fl(r_cent, 1.0f / float(indexar_num));
return indexar_num;
}
@ -313,7 +313,7 @@ static int return_editcurve_indexar(Object *obedit,
}
}
mul_v3_fl(r_cent, 1.0f / (float)indexar_num);
mul_v3_fl(r_cent, 1.0f / float(indexar_num));
return indexar_num;
}

View File

@ -26,7 +26,7 @@
/* ************************** registration **********************************/
void ED_operatortypes_object(void)
void ED_operatortypes_object()
{
WM_operatortype_append(OBJECT_OT_location_clear);
WM_operatortype_append(OBJECT_OT_rotation_clear);
@ -290,7 +290,7 @@ void ED_operatortypes_object(void)
WM_operatortype_append(OBJECT_OT_light_linking_unlink_from_collection);
}
void ED_operatormacros_object(void)
void ED_operatormacros_object()
{
wmOperatorType *ot;
wmOperatorTypeMacro *otmacro;

View File

@ -2048,12 +2048,12 @@ static void single_mat_users(
FOREACH_OBJECT_FLAG_BEGIN (scene, view_layer, v3d, flag, ob) {
if (BKE_id_is_editable(bmain, &ob->id)) {
for (a = 1; a <= ob->totcol; a++) {
ma = BKE_object_material_get(ob, (short)a);
ma = BKE_object_material_get(ob, short(a));
if (single_data_needs_duplication(&ma->id)) {
man = (Material *)BKE_id_copy_ex(
bmain, &ma->id, nullptr, LIB_ID_COPY_DEFAULT | LIB_ID_COPY_ACTIONS);
man->id.us = 0;
BKE_object_material_assign(bmain, ob, man, (short)a, BKE_MAT_ASSIGN_USERPREF);
BKE_object_material_assign(bmain, ob, man, short(a), BKE_MAT_ASSIGN_USERPREF);
}
}
}

View File

@ -161,7 +161,7 @@ struct XFormObjectSkipChild {
int mode;
};
struct XFormObjectSkipChild_Container *ED_object_xform_skip_child_container_create(void)
struct XFormObjectSkipChild_Container *ED_object_xform_skip_child_container_create()
{
struct XFormObjectSkipChild_Container *xcs = static_cast<XFormObjectSkipChild_Container *>(
MEM_callocN(sizeof(*xcs), __func__));
@ -409,7 +409,7 @@ static void trans_obdata_in_obmode_free_elem(void *xf_p)
MEM_freeN(xf);
}
struct XFormObjectData_Container *ED_object_data_xform_container_create(void)
struct XFormObjectData_Container *ED_object_data_xform_container_create()
{
struct XFormObjectData_Container *xds = static_cast<XFormObjectData_Container *>(
MEM_callocN(sizeof(*xds), __func__));

View File

@ -428,7 +428,7 @@ static void SCENE_OT_delete(wmOperatorType *ot)
/** \name Registration
* \{ */
void ED_operatortypes_scene(void)
void ED_operatortypes_scene()
{
WM_operatortype_append(SCENE_OT_new);
WM_operatortype_append(SCENE_OT_delete);

View File

@ -2562,7 +2562,8 @@ void ED_view3d_mats_rv3d_restore(RegionView3D *rv3d, RV3DMatrixStore *rv3dmat_pt
void ED_scene_draw_fps(const Scene *scene, int xoffset, int *yoffset)
{
ScreenFrameRateInfo *fpsi = static_cast<ScreenFrameRateInfo *>(scene->fps_info);
char printable[16];
/* 8 4-bytes chars (complex writing systems like Devanagari in UTF8 encoding) */
char printable[32];
if (!fpsi || !fpsi->lredrawtime || !fpsi->redrawtime) {
return;

View File

@ -53,7 +53,7 @@ static IKPlugin ikplugin_tab[] = {
static IKPlugin *get_plugin(bPose *pose)
{
if (!pose || pose->iksolver < 0 || pose->iksolver >= ((ARRAY_SIZE(ikplugin_tab)) - 1)) {
if (!pose || pose->iksolver < 0 || pose->iksolver >= (ARRAY_SIZE(ikplugin_tab) - 1)) {
return NULL;
}

View File

@ -116,7 +116,7 @@
# define MAKE_ID(a, b, c, d) ((int)(a) << 24 | (int)(b) << 16 | (c) << 8 | (d))
#else
/* Little Endian */
# define MAKE_ID(a, b, c, d) ((int)(d) << 24 | (int)(c) << 16 | (b) << 8 | (a))
# define MAKE_ID(a, b, c, d) (int(d) << 24 | int(c) << 16 | (b) << 8 | (a))
#endif
/* ************************* DIV ********************** */
@ -296,7 +296,7 @@ int DNA_struct_alias_find_nr(const SDNA *sdna, const char *str)
BLI_INLINE const char *pad_up_4(const char *ptr)
{
return (const char *)((((uintptr_t)ptr) + 3) & ~3);
return (const char *)((uintptr_t(ptr) + 3) & ~3);
}
/**
@ -563,18 +563,18 @@ SDNA *DNA_sdna_from_data(const void *data,
*/
static SDNA *g_sdna = nullptr;
void DNA_sdna_current_init(void)
void DNA_sdna_current_init()
{
g_sdna = DNA_sdna_from_data(DNAstr, DNAlen, false, false, nullptr);
}
const SDNA *DNA_sdna_current_get(void)
const SDNA *DNA_sdna_current_get()
{
BLI_assert(g_sdna != nullptr);
return g_sdna;
}
void DNA_sdna_current_free(void)
void DNA_sdna_current_free()
{
DNA_sdna_free(g_sdna);
g_sdna = nullptr;

View File

@ -1219,7 +1219,7 @@ static void dna_write(FILE *file, const void *pntr, const int size)
}
}
void print_struct_sizes(void)
void print_struct_sizes()
{
int unknown = structs_len;
printf("\n\n*** All detected structs:\n");
@ -1622,7 +1622,7 @@ int main(int argc, char **argv)
*
* \{ */
static void UNUSED_FUNCTION(dna_rename_defs_ensure)(void)
static void UNUSED_FUNCTION(dna_rename_defs_ensure)()
{
#define DNA_STRUCT_RENAME(old, new) (void)sizeof(new);
#define DNA_STRUCT_RENAME_ELEM(struct_name, old, new) (void)offsetof(struct_name, new);

View File

@ -921,7 +921,7 @@ static void rna_def_action(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_float_sdna(prop, nullptr, "frame_start");
RNA_def_property_float_funcs(prop, nullptr, "rna_Action_start_frame_set", nullptr);
RNA_def_property_ui_range(prop, MINFRAME, MAXFRAME, 100, 2);
RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
RNA_def_property_ui_text(
prop, "Start Frame", "The start frame of the manually set intended playback range");
RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, nullptr);
@ -930,7 +930,7 @@ static void rna_def_action(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_float_sdna(prop, nullptr, "frame_end");
RNA_def_property_float_funcs(prop, nullptr, "rna_Action_end_frame_set", nullptr);
RNA_def_property_ui_range(prop, MINFRAME, MAXFRAME, 100, 2);
RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
RNA_def_property_ui_text(
prop, "End Frame", "The end frame of the manually set intended playback range");
RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, nullptr);

View File

@ -542,11 +542,11 @@ static bool rna_BrushCapabilitiesSculpt_has_plane_offset_get(PointerRNA *ptr)
static bool rna_BrushCapabilitiesSculpt_has_random_texture_angle_get(PointerRNA *ptr)
{
Brush *br = (Brush *)ptr->data;
return (!ELEM(br->sculpt_tool,
SCULPT_TOOL_GRAB,
SCULPT_TOOL_ROTATE,
SCULPT_TOOL_SNAKE_HOOK,
SCULPT_TOOL_THUMB));
return !ELEM(br->sculpt_tool,
SCULPT_TOOL_GRAB,
SCULPT_TOOL_ROTATE,
SCULPT_TOOL_SNAKE_HOOK,
SCULPT_TOOL_THUMB);
}
static bool rna_TextureCapabilities_has_random_texture_angle_get(PointerRNA *ptr)

View File

@ -857,4 +857,4 @@ void RNA_def_camera(BlenderRNA *brna)
RNA_api_camera(srna);
}
#endif
#endif

View File

@ -102,4 +102,4 @@ void RNA_api_drivers(StructRNA * /*srna*/)
/* PropertyRNA *parm; */
}
#endif
#endif

View File

@ -229,4 +229,4 @@ void RNA_def_lightprobe(BlenderRNA *brna)
rna_def_lightprobe(brna);
}
#endif
#endif

View File

@ -463,4 +463,4 @@ void RNA_def_movieclip(BlenderRNA *brna)
rna_def_movieClipScopes(brna);
}
#endif
#endif

View File

@ -1055,17 +1055,17 @@ static float rna_PartSetting_linelenhead_get(PointerRNA *ptr)
static bool rna_PartSettings_is_fluid_get(PointerRNA *ptr)
{
ParticleSettings *part = static_cast<ParticleSettings *>(ptr->data);
return (ELEM(part->type,
PART_FLUID,
PART_FLUID_FLIP,
PART_FLUID_FOAM,
PART_FLUID_SPRAY,
PART_FLUID_BUBBLE,
PART_FLUID_TRACER,
PART_FLUID_SPRAYFOAM,
PART_FLUID_SPRAYBUBBLE,
PART_FLUID_FOAMBUBBLE,
PART_FLUID_SPRAYFOAMBUBBLE));
return ELEM(part->type,
PART_FLUID,
PART_FLUID_FLIP,
PART_FLUID_FOAM,
PART_FLUID_SPRAY,
PART_FLUID_BUBBLE,
PART_FLUID_TRACER,
PART_FLUID_SPRAYFOAM,
PART_FLUID_SPRAYBUBBLE,
PART_FLUID_FOAMBUBBLE,
PART_FLUID_SPRAYFOAMBUBBLE);
}
static void rna_ParticleSettings_use_clump_curve_update(Main *bmain, Scene *scene, PointerRNA *ptr)

View File

@ -108,4 +108,4 @@ void RNA_def_sound(BlenderRNA *brna)
rna_def_sound(brna);
}
#endif
#endif

View File

@ -298,4 +298,4 @@ void RNA_def_text(BlenderRNA *brna)
rna_def_text(brna);
}
#endif
#endif

View File

@ -74,4 +74,4 @@ void RNA_def_timeline_marker(BlenderRNA *brna)
rna_def_timeline_marker(brna);
}
#endif
#endif

View File

@ -70,4 +70,4 @@ void RNA_def_vfont(BlenderRNA *brna)
RNA_api_vfont(srna);
}
#endif
#endif

View File

@ -172,4 +172,4 @@ void RNA_api_workspace_tool(StructRNA *srna)
RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN);
}
#endif
#endif

View File

@ -267,4 +267,4 @@ void RNA_def_world(BlenderRNA *brna)
rna_def_world_mist(brna);
}
#endif
#endif

View File

@ -2021,9 +2021,13 @@ Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md,
const float *vertex_crease = static_cast<const float *>(
CustomData_get_layer_named(&mesh->vdata, CD_PROP_FLOAT, "crease_vert"));
float *result_edge_crease = nullptr;
if (vertex_crease) {
result_edge_crease = (float *)CustomData_add_layer_named(
&result->edata, CD_PROP_FLOAT, CD_SET_DEFAULT, result->totedge, "crease_edge");
if (vertex_crease || orig_edge_crease) {
result_edge_crease = static_cast<float *>(CustomData_get_layer_named_for_write(
&result->edata, CD_PROP_FLOAT, "crease_edge", result->totedge));
if (!result_edge_crease) {
result_edge_crease = (float *)CustomData_add_layer_named(
&result->edata, CD_PROP_FLOAT, CD_SET_DEFAULT, result->totedge, "crease_edge");
}
/* delete all vertex creases in the result if a rim is used. */
if (do_rim) {
CustomData_free_layer_named(&result->vdata, "crease_vert", result->totvert);