RNA: use const array arguments, order array length afterwards
Use const arguments for array input arguments as there is no reason for them to be modified. Using non-const arguments meant some functions (uiTemplateNodeSocket for e.g.) couldn't use 'const' qualifier so the generated type signature would match. Also use suffix "_num" instead of "_len" for array lengths, ordering these arguments after the array (in keeping with Blender's conventions).
This commit is contained in:
@@ -2510,7 +2510,7 @@ void uiTemplateComponentMenu(uiLayout *layout,
|
||||
struct PointerRNA *ptr,
|
||||
const char *propname,
|
||||
const char *name);
|
||||
void uiTemplateNodeSocket(uiLayout *layout, struct bContext *C, float color[4]);
|
||||
void uiTemplateNodeSocket(uiLayout *layout, struct bContext *C, const float color[4]);
|
||||
|
||||
/**
|
||||
* Draw the main CacheFile properties and operators (file path, scale, etc.), that is those which
|
||||
|
||||
@@ -6888,7 +6888,7 @@ void uiTemplateComponentMenu(uiLayout *layout,
|
||||
/** \name Node Socket Icon Template
|
||||
* \{ */
|
||||
|
||||
void uiTemplateNodeSocket(uiLayout *layout, bContext * /*C*/, float color[4])
|
||||
void uiTemplateNodeSocket(uiLayout *layout, bContext * /*C*/, const float color[4])
|
||||
{
|
||||
uiBlock *block = uiLayoutGetBlock(layout);
|
||||
UI_block_align_begin(block);
|
||||
|
||||
@@ -430,19 +430,19 @@ static void rna_construct_wrapper_function_name(
|
||||
}
|
||||
}
|
||||
|
||||
void *rna_alloc_from_buffer(const char *buffer, int buffer_len)
|
||||
void *rna_alloc_from_buffer(const char *buffer, int buffer_size)
|
||||
{
|
||||
AllocDefRNA *alloc = static_cast<AllocDefRNA *>(MEM_callocN(sizeof(AllocDefRNA), "AllocDefRNA"));
|
||||
alloc->mem = MEM_mallocN(buffer_len, __func__);
|
||||
memcpy(alloc->mem, buffer, buffer_len);
|
||||
alloc->mem = MEM_mallocN(buffer_size, __func__);
|
||||
memcpy(alloc->mem, buffer, buffer_size);
|
||||
rna_addtail(&DefRNA.allocs, alloc);
|
||||
return alloc->mem;
|
||||
}
|
||||
|
||||
void *rna_calloc(int buffer_len)
|
||||
void *rna_calloc(int buffer_size)
|
||||
{
|
||||
AllocDefRNA *alloc = static_cast<AllocDefRNA *>(MEM_callocN(sizeof(AllocDefRNA), "AllocDefRNA"));
|
||||
alloc->mem = MEM_callocN(buffer_len, __func__);
|
||||
alloc->mem = MEM_callocN(buffer_size, __func__);
|
||||
rna_addtail(&DefRNA.allocs, alloc);
|
||||
return alloc->mem;
|
||||
}
|
||||
@@ -598,6 +598,11 @@ static int rna_enum_bitmask(PropertyRNA *prop)
|
||||
return mask;
|
||||
}
|
||||
|
||||
static bool rna_parameter_is_const(const PropertyDefRNA *dparm)
|
||||
{
|
||||
return (dparm->prop->arraydimension) && ((dparm->prop->flag_parameter & PARM_OUTPUT) == 0);
|
||||
}
|
||||
|
||||
static int rna_color_quantize(PropertyRNA *prop, PropertyDefRNA *dp)
|
||||
{
|
||||
return ((prop->type == PROP_FLOAT) && ELEM(prop->subtype, PROP_COLOR, PROP_COLOR_GAMMA) &&
|
||||
@@ -3062,7 +3067,7 @@ static void rna_def_function_wrapper_funcs(FILE *f, StructDefRNA *dsrna, Functio
|
||||
WRITE_COMMA;
|
||||
|
||||
if (dparm->prop->flag & PROP_DYNAMIC) {
|
||||
fprintf(f, "%s_len, %s", dparm->prop->identifier, dparm->prop->identifier);
|
||||
fprintf(f, "%s, %s_num", dparm->prop->identifier, dparm->prop->identifier);
|
||||
}
|
||||
else {
|
||||
fprintf(f, "%s", rna_safe_id(dparm->prop->identifier));
|
||||
@@ -3161,11 +3166,12 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA
|
||||
|
||||
/* for dynamic parameters we pass an additional int for the length of the parameter */
|
||||
if (flag & PROP_DYNAMIC) {
|
||||
fprintf(f, "\tint %s%s_len;\n", pout ? "*" : "", dparm->prop->identifier);
|
||||
fprintf(f, "\tint %s%s_num;\n", pout ? "*" : "", dparm->prop->identifier);
|
||||
}
|
||||
|
||||
fprintf(f,
|
||||
"\t%s%s %s%s;\n",
|
||||
"\t%s%s%s %s%s;\n",
|
||||
rna_parameter_is_const(dparm) ? "const " : "",
|
||||
rna_type_struct(dparm->prop),
|
||||
rna_parameter_type_name(dparm->prop),
|
||||
ptrstr,
|
||||
@@ -3249,7 +3255,7 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA
|
||||
* RNA_parameter_get, we could just call the function directly, but this is faster. */
|
||||
if (flag & PROP_DYNAMIC) {
|
||||
fprintf(f,
|
||||
"\t%s_len = %s((ParameterDynAlloc *)_data)->array_tot;\n",
|
||||
"\t%s_num = %s((ParameterDynAlloc *)_data)->array_tot;\n",
|
||||
rna_safe_id(dparm->prop->identifier),
|
||||
pout ? "(int *)&" : "(int)");
|
||||
data_str = "(&(((ParameterDynAlloc *)_data)->array))";
|
||||
@@ -3264,7 +3270,8 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA
|
||||
}
|
||||
|
||||
fprintf(f,
|
||||
"((%s%s %s)%s);\n",
|
||||
"((%s%s%s %s)%s);\n",
|
||||
rna_parameter_is_const(dparm) ? "const " : "",
|
||||
rna_type_struct(dparm->prop),
|
||||
rna_parameter_type_name(dparm->prop),
|
||||
ptrstr,
|
||||
@@ -3343,7 +3350,7 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA
|
||||
|
||||
if (dparm->prop->flag & PROP_DYNAMIC) {
|
||||
fprintf(f,
|
||||
"%s_len, %s",
|
||||
"%s, %s_num",
|
||||
rna_safe_id(dparm->prop->identifier),
|
||||
rna_safe_id(dparm->prop->identifier));
|
||||
}
|
||||
@@ -3883,7 +3890,7 @@ static void rna_generate_static_parameter_prototypes(FILE *f,
|
||||
first = 0;
|
||||
|
||||
if (flag & PROP_DYNAMIC) {
|
||||
fprintf(f, "int %s%s_len, ", pout ? "*" : "", dparm->prop->identifier);
|
||||
fprintf(f, "int %s%s_num, ", pout ? "*" : "", dparm->prop->identifier);
|
||||
}
|
||||
|
||||
if (!(flag & PROP_DYNAMIC) && dparm->prop->arraydimension) {
|
||||
|
||||
@@ -645,7 +645,7 @@ static bool rna_Armature_is_editmode_get(PointerRNA *ptr)
|
||||
return (arm->edbo != nullptr);
|
||||
}
|
||||
|
||||
static void rna_Armature_transform(bArmature *arm, float mat[16])
|
||||
static void rna_Armature_transform(bArmature *arm, const float mat[16])
|
||||
{
|
||||
ED_armature_transform(arm, (const float(*)[4])mat, true);
|
||||
}
|
||||
|
||||
@@ -24,12 +24,12 @@
|
||||
# include "BKE_armature.h"
|
||||
# include "BLI_math_vector.h"
|
||||
|
||||
static void rna_EditBone_align_roll(EditBone *ebo, float no[3])
|
||||
static void rna_EditBone_align_roll(EditBone *ebo, const float no[3])
|
||||
{
|
||||
ebo->roll = ED_armature_ebone_roll_to_vector(ebo, no, false);
|
||||
}
|
||||
|
||||
static float rna_Bone_do_envelope(Bone *bone, float vec[3])
|
||||
static float rna_Bone_do_envelope(Bone *bone, const float vec[3])
|
||||
{
|
||||
float scale = (bone->flag & BONE_MULT_VG_ENV) == BONE_MULT_VG_ENV ? bone->weight : 1.0f;
|
||||
return distfactor_to_bone(vec,
|
||||
@@ -42,10 +42,10 @@ static float rna_Bone_do_envelope(Bone *bone, float vec[3])
|
||||
|
||||
static void rna_Bone_convert_local_to_pose(Bone *bone,
|
||||
float r_matrix[16],
|
||||
float matrix[16],
|
||||
float matrix_local[16],
|
||||
float parent_matrix[16],
|
||||
float parent_matrix_local[16],
|
||||
const float matrix[16],
|
||||
const float matrix_local[16],
|
||||
const float parent_matrix[16],
|
||||
const float parent_matrix_local[16],
|
||||
bool invert)
|
||||
{
|
||||
BoneParentTransform bpt;
|
||||
@@ -74,13 +74,13 @@ static void rna_Bone_convert_local_to_pose(Bone *bone,
|
||||
BKE_bone_parent_transform_apply(&bpt, (float(*)[4])matrix, (float(*)[4])r_matrix);
|
||||
}
|
||||
|
||||
static void rna_Bone_MatrixFromAxisRoll(float axis[3], float roll, float r_matrix[9])
|
||||
static void rna_Bone_MatrixFromAxisRoll(const float axis[3], float roll, float r_matrix[9])
|
||||
{
|
||||
vec_roll_to_mat3(axis, roll, (float(*)[3])r_matrix);
|
||||
}
|
||||
|
||||
static void rna_Bone_AxisRollFromMatrix(float matrix[9],
|
||||
float axis_override[3],
|
||||
static void rna_Bone_AxisRollFromMatrix(const float matrix[9],
|
||||
const float axis_override[3],
|
||||
float r_axis[3],
|
||||
float *r_roll)
|
||||
{
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "rna_internal.h" /* own include */
|
||||
|
||||
#ifdef RNA_RUNTIME
|
||||
static void rna_Curve_transform(Curve *cu, float mat[16], bool shape_keys)
|
||||
static void rna_Curve_transform(Curve *cu, const float mat[16], bool shape_keys)
|
||||
{
|
||||
BKE_curve_transform(cu, (const float(*)[4])mat, shape_keys, true);
|
||||
|
||||
@@ -37,7 +37,7 @@ static float rna_Nurb_calc_length(Nurb *nu, int resolution_u)
|
||||
return BKE_nurb_calc_length(nu, resolution_u);
|
||||
}
|
||||
|
||||
static void rna_Nurb_valid_message(Nurb *nu, int direction, int *result_len, const char **r_result)
|
||||
static void rna_Nurb_valid_message(Nurb *nu, int direction, const char **r_result, int *result_len)
|
||||
{
|
||||
const bool is_surf = nu->pntsv > 1;
|
||||
const short type = nu->type;
|
||||
|
||||
@@ -205,12 +205,12 @@ static int rna_KeyBlock_normals_vert_len(const PointerRNA *ptr,
|
||||
|
||||
static void rna_KeyBlock_normals_vert_calc(ID *id,
|
||||
KeyBlock *data,
|
||||
int *normals_len,
|
||||
float **normals)
|
||||
float **normals,
|
||||
int *normals_num)
|
||||
{
|
||||
Mesh *me = rna_KeyBlock_normals_get_mesh(nullptr, id);
|
||||
|
||||
*normals_len = (me ? me->totvert : 0) * 3;
|
||||
*normals_num = (me ? me->totvert : 0) * 3;
|
||||
|
||||
if (ELEM(nullptr, me, data) || (me->totvert == 0)) {
|
||||
*normals = nullptr;
|
||||
@@ -218,7 +218,7 @@ static void rna_KeyBlock_normals_vert_calc(ID *id,
|
||||
}
|
||||
|
||||
*normals = static_cast<float *>(
|
||||
MEM_mallocN(sizeof(**normals) * (size_t)(*normals_len), __func__));
|
||||
MEM_mallocN(sizeof(**normals) * (size_t)(*normals_num), __func__));
|
||||
|
||||
BKE_keyblock_mesh_calc_normals(data, me, (float(*)[3])(*normals), nullptr, nullptr);
|
||||
}
|
||||
@@ -236,12 +236,12 @@ static int rna_KeyBlock_normals_poly_len(const PointerRNA *ptr,
|
||||
|
||||
static void rna_KeyBlock_normals_poly_calc(ID *id,
|
||||
KeyBlock *data,
|
||||
int *normals_len,
|
||||
float **normals)
|
||||
float **normals,
|
||||
int *normals_num)
|
||||
{
|
||||
Mesh *me = rna_KeyBlock_normals_get_mesh(nullptr, id);
|
||||
|
||||
*normals_len = (me ? me->faces_num : 0) * 3;
|
||||
*normals_num = (me ? me->faces_num : 0) * 3;
|
||||
|
||||
if (ELEM(nullptr, me, data) || (me->faces_num == 0)) {
|
||||
*normals = nullptr;
|
||||
@@ -249,7 +249,7 @@ static void rna_KeyBlock_normals_poly_calc(ID *id,
|
||||
}
|
||||
|
||||
*normals = static_cast<float *>(
|
||||
MEM_mallocN(sizeof(**normals) * (size_t)(*normals_len), __func__));
|
||||
MEM_mallocN(sizeof(**normals) * (size_t)(*normals_num), __func__));
|
||||
|
||||
BKE_keyblock_mesh_calc_normals(data, me, nullptr, (float(*)[3])(*normals), nullptr);
|
||||
}
|
||||
@@ -267,12 +267,12 @@ static int rna_KeyBlock_normals_loop_len(const PointerRNA *ptr,
|
||||
|
||||
static void rna_KeyBlock_normals_loop_calc(ID *id,
|
||||
KeyBlock *data,
|
||||
int *normals_len,
|
||||
float **normals)
|
||||
float **normals,
|
||||
int *normals_num)
|
||||
{
|
||||
Mesh *me = rna_KeyBlock_normals_get_mesh(nullptr, id);
|
||||
|
||||
*normals_len = (me ? me->totloop : 0) * 3;
|
||||
*normals_num = (me ? me->totloop : 0) * 3;
|
||||
|
||||
if (ELEM(nullptr, me, data) || (me->totloop == 0)) {
|
||||
*normals = nullptr;
|
||||
@@ -280,7 +280,7 @@ static void rna_KeyBlock_normals_loop_calc(ID *id,
|
||||
}
|
||||
|
||||
*normals = static_cast<float *>(
|
||||
MEM_mallocN(sizeof(**normals) * (size_t)(*normals_len), __func__));
|
||||
MEM_mallocN(sizeof(**normals) * (size_t)(*normals_num), __func__));
|
||||
|
||||
BKE_keyblock_mesh_calc_normals(data, me, nullptr, nullptr, (float(*)[3])(*normals));
|
||||
}
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
#include "rna_internal.h" /* own include */
|
||||
|
||||
#ifdef RNA_RUNTIME
|
||||
static void rna_Lattice_transform(Lattice *lt, float mat[16], bool shape_keys)
|
||||
static void rna_Lattice_transform(Lattice *lt, const float mat[16], bool shape_keys)
|
||||
{
|
||||
BKE_lattice_transform(lt, (float(*)[4])mat, shape_keys);
|
||||
BKE_lattice_transform(lt, (const float(*)[4])mat, shape_keys);
|
||||
|
||||
DEG_id_tag_update(<->id, 0);
|
||||
}
|
||||
|
||||
@@ -93,9 +93,9 @@ static void rna_Mesh_calc_looptri(Mesh *mesh)
|
||||
}
|
||||
|
||||
static void rna_Mesh_calc_smooth_groups(
|
||||
Mesh *mesh, bool use_bitflags, int *r_poly_group_len, int **r_poly_group, int *r_group_total)
|
||||
Mesh *mesh, bool use_bitflags, int **r_poly_group, int *r_poly_group_num, int *r_group_total)
|
||||
{
|
||||
*r_poly_group_len = mesh->faces_num;
|
||||
*r_poly_group_num = mesh->faces_num;
|
||||
const bool *sharp_edges = (const bool *)CustomData_get_layer_named(
|
||||
&mesh->edge_data, CD_PROP_BOOL, "sharp_edge");
|
||||
const bool *sharp_faces = (const bool *)CustomData_get_layer_named(
|
||||
@@ -111,16 +111,16 @@ static void rna_Mesh_calc_smooth_groups(
|
||||
|
||||
static void rna_Mesh_normals_split_custom_set(Mesh *mesh,
|
||||
ReportList *reports,
|
||||
int normals_len,
|
||||
float *normals)
|
||||
const float *normals,
|
||||
int normals_num)
|
||||
{
|
||||
float(*loop_normals)[3] = (float(*)[3])normals;
|
||||
const int numloops = mesh->totloop;
|
||||
if (normals_len != numloops * 3) {
|
||||
if (normals_num != numloops * 3) {
|
||||
BKE_reportf(reports,
|
||||
RPT_ERROR,
|
||||
"Number of custom normals is not number of loops (%f / %d)",
|
||||
float(normals_len) / 3.0f,
|
||||
float(normals_num) / 3.0f,
|
||||
numloops);
|
||||
return;
|
||||
}
|
||||
@@ -132,16 +132,16 @@ static void rna_Mesh_normals_split_custom_set(Mesh *mesh,
|
||||
|
||||
static void rna_Mesh_normals_split_custom_set_from_vertices(Mesh *mesh,
|
||||
ReportList *reports,
|
||||
int normals_len,
|
||||
float *normals)
|
||||
const float *normals,
|
||||
int normals_num)
|
||||
{
|
||||
float(*vert_normals)[3] = (float(*)[3])normals;
|
||||
const int numverts = mesh->totvert;
|
||||
if (normals_len != numverts * 3) {
|
||||
if (normals_num != numverts * 3) {
|
||||
BKE_reportf(reports,
|
||||
RPT_ERROR,
|
||||
"Number of custom normals is not number of vertices (%f / %d)",
|
||||
float(normals_len) / 3.0f,
|
||||
float(normals_num) / 3.0f,
|
||||
numverts);
|
||||
return;
|
||||
}
|
||||
@@ -151,9 +151,9 @@ static void rna_Mesh_normals_split_custom_set_from_vertices(Mesh *mesh,
|
||||
DEG_id_tag_update(&mesh->id, 0);
|
||||
}
|
||||
|
||||
static void rna_Mesh_transform(Mesh *mesh, float mat[16], bool shape_keys)
|
||||
static void rna_Mesh_transform(Mesh *mesh, const float mat[16], bool shape_keys)
|
||||
{
|
||||
BKE_mesh_transform(mesh, (float(*)[4])mat, shape_keys);
|
||||
BKE_mesh_transform(mesh, (const float(*)[4])mat, shape_keys);
|
||||
|
||||
DEG_id_tag_update(&mesh->id, 0);
|
||||
}
|
||||
|
||||
@@ -20,9 +20,9 @@
|
||||
#include "rna_internal.h" /* own include */
|
||||
|
||||
#ifdef RNA_RUNTIME
|
||||
static void rna_Meta_transform(MetaBall *mb, float mat[16])
|
||||
static void rna_Meta_transform(MetaBall *mb, const float mat[16])
|
||||
{
|
||||
BKE_mball_transform(mb, (float(*)[4])mat, true);
|
||||
BKE_mball_transform(mb, (const float(*)[4])mat, true);
|
||||
|
||||
DEG_id_tag_update(&mb->id, 0);
|
||||
}
|
||||
|
||||
@@ -973,16 +973,16 @@ static void rna_HookModifier_vertex_indices_get(PointerRNA *ptr, int *values)
|
||||
|
||||
static void rna_HookModifier_vertex_indices_set(HookModifierData *hmd,
|
||||
ReportList *reports,
|
||||
int indices_len,
|
||||
int *indices)
|
||||
const int *indices,
|
||||
int indices_num)
|
||||
{
|
||||
if (indices_len == 0) {
|
||||
if (indices_num == 0) {
|
||||
MEM_SAFE_FREE(hmd->indexar);
|
||||
hmd->indexar_num = 0;
|
||||
}
|
||||
else {
|
||||
/* Reject negative indices. */
|
||||
for (int i = 0; i < indices_len; i++) {
|
||||
for (int i = 0; i < indices_num; i++) {
|
||||
if (indices[i] < 0) {
|
||||
BKE_reportf(reports, RPT_ERROR, "Negative vertex index in vertex_indices_set");
|
||||
return;
|
||||
@@ -990,14 +990,14 @@ static void rna_HookModifier_vertex_indices_set(HookModifierData *hmd,
|
||||
}
|
||||
|
||||
/* Copy and sort the index array. */
|
||||
size_t size = sizeof(int) * indices_len;
|
||||
size_t size = sizeof(int) * indices_num;
|
||||
int *buffer = static_cast<int *>(MEM_mallocN(size, "hook indexar"));
|
||||
memcpy(buffer, indices, size);
|
||||
|
||||
qsort(buffer, indices_len, sizeof(int), BLI_sortutil_cmp_int);
|
||||
qsort(buffer, indices_num, sizeof(int), BLI_sortutil_cmp_int);
|
||||
|
||||
/* Reject duplicate indices. */
|
||||
for (int i = 1; i < indices_len; i++) {
|
||||
for (int i = 1; i < indices_num; i++) {
|
||||
if (buffer[i] == buffer[i - 1]) {
|
||||
BKE_reportf(reports, RPT_ERROR, "Duplicate index %d in vertex_indices_set", buffer[i]);
|
||||
MEM_freeN(buffer);
|
||||
@@ -1008,7 +1008,7 @@ static void rna_HookModifier_vertex_indices_set(HookModifierData *hmd,
|
||||
/* Success - save the new array. */
|
||||
MEM_SAFE_FREE(hmd->indexar);
|
||||
hmd->indexar = buffer;
|
||||
hmd->indexar_num = indices_len;
|
||||
hmd->indexar_num = indices_num;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4343,8 +4343,8 @@ void rna_ShaderNodePointDensity_density_cache(bNode *self, Depsgraph *depsgraph)
|
||||
|
||||
void rna_ShaderNodePointDensity_density_calc(bNode *self,
|
||||
Depsgraph *depsgraph,
|
||||
int *length,
|
||||
float **values)
|
||||
float **values,
|
||||
int *values_num)
|
||||
{
|
||||
NodeShaderTexPointDensity *shader_point_density = static_cast<NodeShaderTexPointDensity *>(
|
||||
self->storage);
|
||||
@@ -4352,16 +4352,16 @@ void rna_ShaderNodePointDensity_density_calc(bNode *self,
|
||||
const int resolution = shader_point_density->cached_resolution;
|
||||
|
||||
if (depsgraph == nullptr) {
|
||||
*length = 0;
|
||||
*values_num = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
/* TODO(sergey): Will likely overflow, but how to pass size_t via RNA? */
|
||||
*length = 4 * resolution * resolution * resolution;
|
||||
*values_num = 4 * resolution * resolution * resolution;
|
||||
|
||||
if (*values == nullptr) {
|
||||
*values = static_cast<float *>(
|
||||
MEM_mallocN(sizeof(float) * (*length), "point density dynamic array"));
|
||||
MEM_mallocN(sizeof(float) * (*values_num), "point density dynamic array"));
|
||||
}
|
||||
|
||||
/* Single-threaded sampling of the voxel domain. */
|
||||
|
||||
@@ -2065,8 +2065,8 @@ static void rna_Object_vgroup_clear(Object *ob, Main *bmain, ReportList *reports
|
||||
static void rna_VertexGroup_vertex_add(ID *id,
|
||||
bDeformGroup *def,
|
||||
ReportList *reports,
|
||||
int index_len,
|
||||
int *index,
|
||||
const int *index,
|
||||
int index_num,
|
||||
float weight,
|
||||
int assignmode)
|
||||
{
|
||||
@@ -2078,7 +2078,7 @@ static void rna_VertexGroup_vertex_add(ID *id,
|
||||
return;
|
||||
}
|
||||
|
||||
while (index_len--) {
|
||||
while (index_num--) {
|
||||
/* XXX: not efficient calling within loop. */
|
||||
ED_vgroup_vert_add(ob, def, *index++, weight, assignmode);
|
||||
}
|
||||
@@ -2088,7 +2088,7 @@ static void rna_VertexGroup_vertex_add(ID *id,
|
||||
}
|
||||
|
||||
static void rna_VertexGroup_vertex_remove(
|
||||
ID *id, bDeformGroup *dg, ReportList *reports, int index_len, int *index)
|
||||
ID *id, bDeformGroup *dg, ReportList *reports, const int *index, int index_num)
|
||||
{
|
||||
Object *ob = reinterpret_cast<Object *>(id);
|
||||
|
||||
@@ -2098,7 +2098,7 @@ static void rna_VertexGroup_vertex_remove(
|
||||
return;
|
||||
}
|
||||
|
||||
while (index_len--) {
|
||||
while (index_num--) {
|
||||
ED_vgroup_vert_remove(ob, dg, *index++);
|
||||
}
|
||||
|
||||
|
||||
@@ -289,7 +289,7 @@ static bool rna_Object_visible_in_viewport_get(Object *ob, View3D *v3d)
|
||||
static void rna_Object_mat_convert_space(Object *ob,
|
||||
ReportList *reports,
|
||||
bPoseChannel *pchan,
|
||||
float mat[16],
|
||||
const float mat[16],
|
||||
float mat_ret[16],
|
||||
int from,
|
||||
int to)
|
||||
@@ -365,11 +365,15 @@ static void rna_Object_calc_matrix_camera(Object *ob,
|
||||
copy_m4_m4((float(*)[4])mat_ret, params.winmat);
|
||||
}
|
||||
|
||||
static void rna_Object_camera_fit_coords(
|
||||
Object *ob, Depsgraph *depsgraph, int num_cos, float *cos, float co_ret[3], float *scale_ret)
|
||||
static void rna_Object_camera_fit_coords(Object *ob,
|
||||
Depsgraph *depsgraph,
|
||||
const float *cos,
|
||||
int cos_num,
|
||||
float co_ret[3],
|
||||
float *scale_ret)
|
||||
{
|
||||
BKE_camera_view_frame_fit_to_coords(
|
||||
depsgraph, (const float(*)[3])cos, num_cos / 3, ob, co_ret, scale_ret);
|
||||
depsgraph, (const float(*)[3])cos, cos_num / 3, ob, co_ret, scale_ret);
|
||||
}
|
||||
|
||||
static void rna_Object_crazyspace_eval(Object *object,
|
||||
@@ -383,7 +387,7 @@ static void rna_Object_crazyspace_eval(Object *object,
|
||||
static void rna_Object_crazyspace_displacement_to_deformed(Object *object,
|
||||
ReportList *reports,
|
||||
const int vertex_index,
|
||||
float displacement[3],
|
||||
const float displacement[3],
|
||||
float r_displacement_deformed[3])
|
||||
{
|
||||
BKE_crazyspace_api_displacement_to_deformed(
|
||||
@@ -393,7 +397,7 @@ static void rna_Object_crazyspace_displacement_to_deformed(Object *object,
|
||||
static void rna_Object_crazyspace_displacement_to_original(Object *object,
|
||||
ReportList *reports,
|
||||
const int vertex_index,
|
||||
float displacement_deformed[3],
|
||||
const float displacement_deformed[3],
|
||||
float r_displacement[3])
|
||||
{
|
||||
BKE_crazyspace_api_displacement_to_original(
|
||||
@@ -589,8 +593,8 @@ static Object *eval_object_ensure(Object *ob,
|
||||
static void rna_Object_ray_cast(Object *ob,
|
||||
bContext *C,
|
||||
ReportList *reports,
|
||||
float origin[3],
|
||||
float direction[3],
|
||||
const float origin[3],
|
||||
const float direction[3],
|
||||
float distance,
|
||||
PointerRNA *rnaptr_depsgraph,
|
||||
bool *r_success,
|
||||
@@ -611,11 +615,12 @@ static void rna_Object_ray_cast(Object *ob,
|
||||
float distmin;
|
||||
|
||||
/* Needed for valid distance check from #isect_ray_aabb_v3_simple() call. */
|
||||
normalize_v3(direction);
|
||||
float direction_unit[3];
|
||||
normalize_v3_v3(direction_unit, direction);
|
||||
|
||||
if (!bb ||
|
||||
(isect_ray_aabb_v3_simple(origin, direction, bb->vec[0], bb->vec[6], &distmin, nullptr) &&
|
||||
distmin <= distance))
|
||||
if (!bb || (isect_ray_aabb_v3_simple(
|
||||
origin, direction_unit, bb->vec[0], bb->vec[6], &distmin, nullptr) &&
|
||||
distmin <= distance))
|
||||
{
|
||||
BVHTreeFromMesh treeData = {nullptr};
|
||||
|
||||
@@ -633,7 +638,7 @@ static void rna_Object_ray_cast(Object *ob,
|
||||
|
||||
if (BLI_bvhtree_ray_cast(treeData.tree,
|
||||
origin,
|
||||
direction,
|
||||
direction_unit,
|
||||
0.0f,
|
||||
&hit,
|
||||
treeData.raycast_callback,
|
||||
@@ -663,7 +668,7 @@ static void rna_Object_ray_cast(Object *ob,
|
||||
static void rna_Object_closest_point_on_mesh(Object *ob,
|
||||
bContext *C,
|
||||
ReportList *reports,
|
||||
float origin[3],
|
||||
const float origin[3],
|
||||
float distance,
|
||||
PointerRNA *rnaptr_depsgraph,
|
||||
bool *r_success,
|
||||
|
||||
@@ -345,7 +345,7 @@ static void rna_ParticleHairKey_co_object_set(ID *id,
|
||||
Object *object,
|
||||
ParticleSystemModifierData *modifier,
|
||||
ParticleData *particle,
|
||||
float co[3])
|
||||
const float co[3])
|
||||
{
|
||||
|
||||
if (particle == nullptr) {
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
# include "BLI_ghash.h"
|
||||
|
||||
static float rna_PoseBone_do_envelope(bPoseChannel *chan, float vec[3])
|
||||
static float rna_PoseBone_do_envelope(bPoseChannel *chan, const float vec[3])
|
||||
{
|
||||
Bone *bone = chan->bone;
|
||||
|
||||
|
||||
@@ -820,8 +820,8 @@ static void rna_RigidBodyCon_motor_ang_target_velocity_set(PointerRNA *ptr, floa
|
||||
static void rna_RigidBodyWorld_convex_sweep_test(RigidBodyWorld *rbw,
|
||||
ReportList *reports,
|
||||
Object *object,
|
||||
float ray_start[3],
|
||||
float ray_end[3],
|
||||
const float ray_start[3],
|
||||
const float ray_end[3],
|
||||
float r_location[3],
|
||||
float r_hitpoint[3],
|
||||
float r_normal[3],
|
||||
|
||||
@@ -128,8 +128,8 @@ static void rna_SceneRender_get_frame_path(
|
||||
|
||||
static void rna_Scene_ray_cast(Scene *scene,
|
||||
Depsgraph *depsgraph,
|
||||
float origin[3],
|
||||
float direction[3],
|
||||
const float origin[3],
|
||||
const float direction[3],
|
||||
float ray_dist,
|
||||
bool *r_success,
|
||||
float r_location[3],
|
||||
@@ -138,7 +138,8 @@ static void rna_Scene_ray_cast(Scene *scene,
|
||||
Object **r_ob,
|
||||
float r_obmat[16])
|
||||
{
|
||||
normalize_v3(direction);
|
||||
float direction_unit[3];
|
||||
normalize_v3_v3(direction_unit, direction);
|
||||
SnapObjectContext *sctx = ED_transform_snap_object_context_create(scene, 0);
|
||||
|
||||
SnapObjectParams snap_object_params{};
|
||||
@@ -149,7 +150,7 @@ static void rna_Scene_ray_cast(Scene *scene,
|
||||
nullptr,
|
||||
&snap_object_params,
|
||||
origin,
|
||||
direction,
|
||||
direction_unit,
|
||||
&ray_dist,
|
||||
r_location,
|
||||
r_normal,
|
||||
|
||||
@@ -40,7 +40,7 @@ static void rna_Text_from_string(Text *text, const char *str)
|
||||
BKE_text_write(text, str, strlen(str));
|
||||
}
|
||||
|
||||
static void rna_Text_as_string(Text *text, int *r_result_len, const char **result)
|
||||
static void rna_Text_as_string(Text *text, const char **result, int *r_result_len)
|
||||
{
|
||||
size_t result_len;
|
||||
*result = txt_to_buf(text, &result_len);
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
# include "RE_pipeline.h"
|
||||
# include "RE_texture.h"
|
||||
|
||||
static void texture_evaluate(Tex *tex, float value[3], float r_color[4])
|
||||
static void texture_evaluate(Tex *tex, const float value[3], float r_color[4])
|
||||
{
|
||||
TexResult texres = {0.0f};
|
||||
|
||||
|
||||
@@ -735,7 +735,7 @@ static MovieTrackingMarker *rna_trackingMarkers_find_frame(MovieTrackingTrack *t
|
||||
|
||||
static MovieTrackingMarker *rna_trackingMarkers_insert_frame(MovieTrackingTrack *track,
|
||||
int framenr,
|
||||
float co[2])
|
||||
const float co[2])
|
||||
{
|
||||
MovieTrackingMarker marker, *new_marker;
|
||||
|
||||
|
||||
@@ -29,19 +29,25 @@
|
||||
|
||||
# include "ED_gizmo_library.h"
|
||||
|
||||
static void rna_gizmo_draw_preset_box(wmGizmo *gz, float matrix[16], int select_id)
|
||||
static void rna_gizmo_draw_preset_box(wmGizmo *gz, const float matrix[16], int select_id)
|
||||
{
|
||||
ED_gizmo_draw_preset_box(gz, (float(*)[4])matrix, select_id);
|
||||
ED_gizmo_draw_preset_box(gz, (const float(*)[4])matrix, select_id);
|
||||
}
|
||||
|
||||
static void rna_gizmo_draw_preset_arrow(wmGizmo *gz, float matrix[16], int axis, int select_id)
|
||||
static void rna_gizmo_draw_preset_arrow(wmGizmo *gz,
|
||||
const float matrix[16],
|
||||
int axis,
|
||||
int select_id)
|
||||
{
|
||||
ED_gizmo_draw_preset_arrow(gz, (float(*)[4])matrix, axis, select_id);
|
||||
ED_gizmo_draw_preset_arrow(gz, (const float(*)[4])matrix, axis, select_id);
|
||||
}
|
||||
|
||||
static void rna_gizmo_draw_preset_circle(wmGizmo *gz, float matrix[16], int axis, int select_id)
|
||||
static void rna_gizmo_draw_preset_circle(wmGizmo *gz,
|
||||
const float matrix[16],
|
||||
int axis,
|
||||
int select_id)
|
||||
{
|
||||
ED_gizmo_draw_preset_circle(gz, (float(*)[4])matrix, axis, select_id);
|
||||
ED_gizmo_draw_preset_circle(gz, (const float(*)[4])matrix, axis, select_id);
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
Reference in New Issue
Block a user