RNA: support compiling rna files as C++ code
Compiling files in `makesrna` as C code is often a bit annoying when converting other files to C++ (#103343). That's because one often had to introduce additional C wrappers. The goal of this patch is to support compiling rna files as C++ code. This mostly required changes in `makesrna.c` to make the generated code compatible with C and C++. The cmake code had to change a bit as well because we need to pass different compiler options for C++ code to avoid some warnings. This commit also converts a few rna files to C++ already, although that is mostly just for testing. The rest of the files are expected to be converted after this patch is merged. It's possible, even likely, that `makesrna.c` has to change a little bit more to support C++, but that is hard to know without converting all files first. Co-authored-by: Lukas Tönne <lukas@blender.org> Co-authored-by: Ray Molenkamp <github@lazydodo.com> Pull Request: https://projects.blender.org/blender/blender/pulls/108290
This commit is contained in:
@@ -310,6 +310,7 @@ typedef enum PropertyFlag {
|
|||||||
**/
|
**/
|
||||||
PROP_PATH_OUTPUT = (1 << 2),
|
PROP_PATH_OUTPUT = (1 << 2),
|
||||||
} PropertyFlag;
|
} PropertyFlag;
|
||||||
|
ENUM_OPERATORS(PropertyFlag, PROP_NO_DEG_UPDATE)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flags related to comparing and overriding RNA properties.
|
* Flags related to comparing and overriding RNA properties.
|
||||||
@@ -354,6 +355,7 @@ typedef enum PropertyOverrideFlag {
|
|||||||
*/
|
*/
|
||||||
PROPOVERRIDE_NO_PROP_NAME = (1 << 11),
|
PROPOVERRIDE_NO_PROP_NAME = (1 << 11),
|
||||||
} PropertyOverrideFlag;
|
} PropertyOverrideFlag;
|
||||||
|
ENUM_OPERATORS(PropertyOverrideFlag, PROPOVERRIDE_NO_PROP_NAME);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function parameters flags.
|
* Function parameters flags.
|
||||||
|
|||||||
@@ -41,16 +41,16 @@ set(DEFSRC
|
|||||||
rna_gpencil_legacy_modifier.c
|
rna_gpencil_legacy_modifier.c
|
||||||
rna_image.c
|
rna_image.c
|
||||||
rna_key.c
|
rna_key.c
|
||||||
rna_lattice.c
|
rna_lattice.cc
|
||||||
rna_layer.c
|
rna_layer.c
|
||||||
rna_light.c
|
rna_light.c
|
||||||
rna_lightprobe.c
|
rna_lightprobe.c
|
||||||
rna_linestyle.c
|
rna_linestyle.c
|
||||||
rna_main.c
|
rna_main.c
|
||||||
rna_mask.c
|
rna_mask.cc
|
||||||
rna_material.c
|
rna_material.c
|
||||||
rna_mesh.c
|
rna_mesh.c
|
||||||
rna_meta.c
|
rna_meta.cc
|
||||||
rna_modifier.c
|
rna_modifier.c
|
||||||
rna_movieclip.c
|
rna_movieclip.c
|
||||||
rna_nla.c
|
rna_nla.c
|
||||||
@@ -61,7 +61,7 @@ set(DEFSRC
|
|||||||
rna_palette.c
|
rna_palette.c
|
||||||
rna_particle.c
|
rna_particle.c
|
||||||
rna_pointcloud.c
|
rna_pointcloud.c
|
||||||
rna_pose.c
|
rna_pose.cc
|
||||||
rna_render.c
|
rna_render.c
|
||||||
rna_rigidbody.c
|
rna_rigidbody.c
|
||||||
rna_rna.c
|
rna_rna.c
|
||||||
@@ -106,7 +106,7 @@ set(APISRC
|
|||||||
rna_curve_api.c
|
rna_curve_api.c
|
||||||
rna_fcurve_api.c
|
rna_fcurve_api.c
|
||||||
rna_image_api.c
|
rna_image_api.c
|
||||||
rna_lattice_api.c
|
rna_lattice_api.cc
|
||||||
rna_main_api.c
|
rna_main_api.c
|
||||||
rna_material_api.c
|
rna_material_api.c
|
||||||
rna_mesh_api.c
|
rna_mesh_api.c
|
||||||
@@ -137,21 +137,42 @@ set_source_files_properties(${GENSRC} PROPERTIES GENERATED TRUE)
|
|||||||
# CFLAGS for Generated Files
|
# CFLAGS for Generated Files
|
||||||
#
|
#
|
||||||
# less strict flags for generated source
|
# less strict flags for generated source
|
||||||
|
set(GENSRC_FLAGS)
|
||||||
set(GENSRC_CFLAGS)
|
set(GENSRC_CFLAGS)
|
||||||
|
set(GENSRC_CXXFLAGS)
|
||||||
if(CMAKE_COMPILER_IS_GNUCC OR (CMAKE_C_COMPILER_ID MATCHES "Clang"))
|
if(CMAKE_COMPILER_IS_GNUCC OR (CMAKE_C_COMPILER_ID MATCHES "Clang"))
|
||||||
set(GENSRC_CFLAGS "-Wno-missing-prototypes")
|
set(GENSRC_CFLAGS "-Wno-missing-prototypes")
|
||||||
|
set(GENSRC_CXXFLAGS "-Wno-missing-declarations")
|
||||||
endif()
|
endif()
|
||||||
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||||
string(APPEND GENSRC_CFLAGS " -Wno-missing-variable-declarations")
|
string(APPEND GENSRC_FLAGS " -Wno-missing-variable-declarations")
|
||||||
elseif(MSVC)
|
elseif(MSVC)
|
||||||
# Restore warn C4100 (unreferenced formal parameter) back to w4
|
# Restore warn C4100 (unreferenced formal parameter) back to w4
|
||||||
remove_cc_flag(/w34100)
|
remove_cc_flag(/w34100)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(GENSRC_CFLAGS)
|
set(GENSRC_C ${GENSRC})
|
||||||
set_source_files_properties(${GENSRC} PROPERTIES COMPILE_FLAGS "${GENSRC_CFLAGS}")
|
list(FILTER GENSRC_C INCLUDE REGEX ".*\.c$")
|
||||||
|
set(GENSRC_CXX ${GENSRC})
|
||||||
|
list(FILTER GENSRC_CXX INCLUDE REGEX ".*\.cc$")
|
||||||
|
|
||||||
|
if(GENSRC_FLAGS)
|
||||||
|
set_source_files_properties(${GENSRC} PROPERTIES COMPILE_FLAGS "${GENSRC_FLAGS}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(GENSRC_CFLAGS)
|
||||||
|
set_source_files_properties(${GENSRC_C} PROPERTIES COMPILE_FLAGS "${GENSRC_CFLAGS}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(GENSRC_CXXFLAGS)
|
||||||
|
set_source_files_properties(${GENSRC_CXX} PROPERTIES COMPILE_FLAGS "${GENSRC_CXXFLAGS}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
unset(GENSRC_C)
|
||||||
|
unset(GENSRC_CXX)
|
||||||
|
unset(GENSRC_FLAGS)
|
||||||
unset(GENSRC_CFLAGS)
|
unset(GENSRC_CFLAGS)
|
||||||
|
unset(GENSRC_CXXFLAGS)
|
||||||
|
|
||||||
|
|
||||||
# NOTE: Disable clang-tidy because generated files are stored outside of the source,
|
# NOTE: Disable clang-tidy because generated files are stored outside of the source,
|
||||||
|
|||||||
@@ -743,7 +743,7 @@ static char *rna_def_property_get_func(
|
|||||||
case PROP_STRING: {
|
case PROP_STRING: {
|
||||||
StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
|
StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
|
||||||
UNUSED_VARS_NDEBUG(sprop);
|
UNUSED_VARS_NDEBUG(sprop);
|
||||||
fprintf(f, "void %s(PointerRNA *ptr, char *value)\n", func);
|
fprintf(f, "RNA_EXTERN_C void %s(PointerRNA *ptr, char *value)\n", func);
|
||||||
fprintf(f, "{\n");
|
fprintf(f, "{\n");
|
||||||
if (manualfunc) {
|
if (manualfunc) {
|
||||||
fprintf(f, " %s(ptr, value);\n", manualfunc);
|
fprintf(f, " %s(ptr, value);\n", manualfunc);
|
||||||
@@ -781,7 +781,7 @@ static char *rna_def_property_get_func(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PROP_POINTER: {
|
case PROP_POINTER: {
|
||||||
fprintf(f, "PointerRNA %s(PointerRNA *ptr)\n", func);
|
fprintf(f, "RNA_EXTERN_C PointerRNA %s(PointerRNA *ptr)\n", func);
|
||||||
fprintf(f, "{\n");
|
fprintf(f, "{\n");
|
||||||
if (manualfunc) {
|
if (manualfunc) {
|
||||||
fprintf(f, " return %s(ptr);\n", manualfunc);
|
fprintf(f, " return %s(ptr);\n", manualfunc);
|
||||||
@@ -831,11 +831,14 @@ static char *rna_def_property_get_func(
|
|||||||
default:
|
default:
|
||||||
if (prop->arraydimension) {
|
if (prop->arraydimension) {
|
||||||
if (prop->flag & PROP_DYNAMIC) {
|
if (prop->flag & PROP_DYNAMIC) {
|
||||||
fprintf(f, "void %s(PointerRNA *ptr, %s values[])\n", func, rna_type_type(prop));
|
fprintf(f,
|
||||||
|
"RNA_EXTERN_C void %s(PointerRNA *ptr, %s values[])\n",
|
||||||
|
func,
|
||||||
|
rna_type_type(prop));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fprintf(f,
|
fprintf(f,
|
||||||
"void %s(PointerRNA *ptr, %s values[%u])\n",
|
"RNA_EXTERN_C void %s(PointerRNA *ptr, %s values[%u])\n",
|
||||||
func,
|
func,
|
||||||
rna_type_type(prop),
|
rna_type_type(prop),
|
||||||
prop->totarraylength);
|
prop->totarraylength);
|
||||||
@@ -931,7 +934,7 @@ static char *rna_def_property_get_func(
|
|||||||
fprintf(f, "}\n\n");
|
fprintf(f, "}\n\n");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fprintf(f, "%s %s(PointerRNA *ptr)\n", rna_type_type(prop), func);
|
fprintf(f, "RNA_EXTERN_C %s %s(PointerRNA *ptr)\n", rna_type_type(prop), func);
|
||||||
fprintf(f, "{\n");
|
fprintf(f, "{\n");
|
||||||
|
|
||||||
if (manualfunc) {
|
if (manualfunc) {
|
||||||
@@ -1022,17 +1025,25 @@ static void rna_clamp_value_range_check(FILE *f,
|
|||||||
{
|
{
|
||||||
if (prop->type == PROP_INT) {
|
if (prop->type == PROP_INT) {
|
||||||
IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
|
IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
|
||||||
|
fprintf(f, " {\n");
|
||||||
|
fprintf(f, "#ifdef __cplusplus\n");
|
||||||
|
fprintf(f, " using T = decltype(%s%s);\n", dnaname_prefix, dnaname);
|
||||||
|
fprintf(f, " static_assert(std::numeric_limits<T>::max() >= %d);\n", iprop->hardmax);
|
||||||
|
fprintf(f, " static_assert(std::numeric_limits<T>::min() <= %d);\n", iprop->hardmin);
|
||||||
|
fprintf(f, "#else\n");
|
||||||
fprintf(f,
|
fprintf(f,
|
||||||
" { BLI_STATIC_ASSERT("
|
" BLI_STATIC_ASSERT("
|
||||||
"(TYPEOF_MAX(%s%s) >= %d) && "
|
"(TYPEOF_MAX(%s%s) >= %d) && "
|
||||||
"(TYPEOF_MIN(%s%s) <= %d), "
|
"(TYPEOF_MIN(%s%s) <= %d), "
|
||||||
"\"invalid limits\"); }\n",
|
"\"invalid limits\");\n",
|
||||||
dnaname_prefix,
|
dnaname_prefix,
|
||||||
dnaname,
|
dnaname,
|
||||||
iprop->hardmax,
|
iprop->hardmax,
|
||||||
dnaname_prefix,
|
dnaname_prefix,
|
||||||
dnaname,
|
dnaname,
|
||||||
iprop->hardmin);
|
iprop->hardmin);
|
||||||
|
fprintf(f, "#endif\n");
|
||||||
|
fprintf(f, " }\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* USE_RNA_RANGE_CHECK */
|
#endif /* USE_RNA_RANGE_CHECK */
|
||||||
@@ -1050,7 +1061,7 @@ static void rna_clamp_value(FILE *f, PropertyRNA *prop, int array)
|
|||||||
fprintf(f, "CLAMPIS(value, ");
|
fprintf(f, "CLAMPIS(value, ");
|
||||||
}
|
}
|
||||||
if (iprop->range) {
|
if (iprop->range) {
|
||||||
fprintf(f, "prop_clamp_min, prop_clamp_max);");
|
fprintf(f, "prop_clamp_min, prop_clamp_max);\n");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
rna_int_print(f, iprop->hardmin);
|
rna_int_print(f, iprop->hardmin);
|
||||||
@@ -1072,7 +1083,7 @@ static void rna_clamp_value(FILE *f, PropertyRNA *prop, int array)
|
|||||||
fprintf(f, "CLAMPIS(value, ");
|
fprintf(f, "CLAMPIS(value, ");
|
||||||
}
|
}
|
||||||
if (fprop->range) {
|
if (fprop->range) {
|
||||||
fprintf(f, "prop_clamp_min, prop_clamp_max);");
|
fprintf(f, "prop_clamp_min, prop_clamp_max);\n");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
rna_float_print(f, fprop->hardmin);
|
rna_float_print(f, fprop->hardmin);
|
||||||
@@ -1110,7 +1121,7 @@ static char *rna_def_property_search_func(FILE *f,
|
|||||||
func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "search");
|
func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "search");
|
||||||
|
|
||||||
fprintf(f,
|
fprintf(f,
|
||||||
"void %s("
|
"RNA_EXTERN_C void %s("
|
||||||
"const bContext *C, "
|
"const bContext *C, "
|
||||||
"PointerRNA *ptr, "
|
"PointerRNA *ptr, "
|
||||||
"PropertyRNA *prop, "
|
"PropertyRNA *prop, "
|
||||||
@@ -1151,7 +1162,7 @@ static char *rna_def_property_set_func(
|
|||||||
switch (prop->type) {
|
switch (prop->type) {
|
||||||
case PROP_STRING: {
|
case PROP_STRING: {
|
||||||
StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
|
StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
|
||||||
fprintf(f, "void %s(PointerRNA *ptr, const char *value)\n", func);
|
fprintf(f, "RNA_EXTERN_C void %s(PointerRNA *ptr, const char *value)\n", func);
|
||||||
fprintf(f, "{\n");
|
fprintf(f, "{\n");
|
||||||
if (manualfunc) {
|
if (manualfunc) {
|
||||||
fprintf(f, " %s(ptr, value);\n", manualfunc);
|
fprintf(f, " %s(ptr, value);\n", manualfunc);
|
||||||
@@ -1166,7 +1177,8 @@ static char *rna_def_property_set_func(
|
|||||||
f, " if (data->%s != NULL) { MEM_freeN(data->%s); }\n", dp->dnaname, dp->dnaname);
|
f, " if (data->%s != NULL) { MEM_freeN(data->%s); }\n", dp->dnaname, dp->dnaname);
|
||||||
fprintf(f, " const int length = strlen(value);\n");
|
fprintf(f, " const int length = strlen(value);\n");
|
||||||
fprintf(f, " if (length > 0) {\n");
|
fprintf(f, " if (length > 0) {\n");
|
||||||
fprintf(f, " data->%s = MEM_mallocN(length + 1, __func__);\n", dp->dnaname);
|
fprintf(
|
||||||
|
f, " data->%s = (char *)MEM_mallocN(length + 1, __func__);\n", dp->dnaname);
|
||||||
fprintf(f, " memcpy(data->%s, value, length + 1);\n", dp->dnaname);
|
fprintf(f, " memcpy(data->%s, value, length + 1);\n", dp->dnaname);
|
||||||
fprintf(f, " } else { data->%s = NULL; }\n", dp->dnaname);
|
fprintf(f, " } else { data->%s = NULL; }\n", dp->dnaname);
|
||||||
}
|
}
|
||||||
@@ -1196,7 +1208,10 @@ static char *rna_def_property_set_func(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PROP_POINTER: {
|
case PROP_POINTER: {
|
||||||
fprintf(f, "void %s(PointerRNA *ptr, PointerRNA value, struct ReportList *reports)\n", func);
|
fprintf(
|
||||||
|
f,
|
||||||
|
"RNA_EXTERN_C void %s(PointerRNA *ptr, PointerRNA value, struct ReportList *reports)\n",
|
||||||
|
func);
|
||||||
fprintf(f, "{\n");
|
fprintf(f, "{\n");
|
||||||
if (manualfunc) {
|
if (manualfunc) {
|
||||||
fprintf(f, " %s(ptr, value, reports);\n", manualfunc);
|
fprintf(f, " %s(ptr, value, reports);\n", manualfunc);
|
||||||
@@ -1229,7 +1244,7 @@ static char *rna_def_property_set_func(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(f, " data->%s = value.data;\n", dp->dnaname);
|
fprintf(f, " *(void **)&data->%s = value.data;\n", dp->dnaname);
|
||||||
}
|
}
|
||||||
fprintf(f, "}\n\n");
|
fprintf(f, "}\n\n");
|
||||||
break;
|
break;
|
||||||
@@ -1237,11 +1252,14 @@ static char *rna_def_property_set_func(
|
|||||||
default:
|
default:
|
||||||
if (prop->arraydimension) {
|
if (prop->arraydimension) {
|
||||||
if (prop->flag & PROP_DYNAMIC) {
|
if (prop->flag & PROP_DYNAMIC) {
|
||||||
fprintf(f, "void %s(PointerRNA *ptr, const %s values[])\n", func, rna_type_type(prop));
|
fprintf(f,
|
||||||
|
"RNA_EXTERN_C void %s(PointerRNA *ptr, const %s values[])\n",
|
||||||
|
func,
|
||||||
|
rna_type_type(prop));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fprintf(f,
|
fprintf(f,
|
||||||
"void %s(PointerRNA *ptr, const %s values[%u])\n",
|
"RNA_EXTERN_C void %s(PointerRNA *ptr, const %s values[%u])\n",
|
||||||
func,
|
func,
|
||||||
rna_type_type(prop),
|
rna_type_type(prop),
|
||||||
prop->totarraylength);
|
prop->totarraylength);
|
||||||
@@ -1353,7 +1371,7 @@ static char *rna_def_property_set_func(
|
|||||||
fprintf(f, "}\n\n");
|
fprintf(f, "}\n\n");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fprintf(f, "void %s(PointerRNA *ptr, %s value)\n", func, rna_type_type(prop));
|
fprintf(f, "RNA_EXTERN_C void %s(PointerRNA *ptr, %s value)\n", func, rna_type_type(prop));
|
||||||
fprintf(f, "{\n");
|
fprintf(f, "{\n");
|
||||||
|
|
||||||
if (manualfunc) {
|
if (manualfunc) {
|
||||||
@@ -1439,7 +1457,7 @@ static char *rna_def_property_length_func(
|
|||||||
|
|
||||||
func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "length");
|
func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "length");
|
||||||
|
|
||||||
fprintf(f, "int %s(PointerRNA *ptr)\n", func);
|
fprintf(f, "RNA_EXTERN_C int %s(PointerRNA *ptr)\n", func);
|
||||||
fprintf(f, "{\n");
|
fprintf(f, "{\n");
|
||||||
if (manualfunc) {
|
if (manualfunc) {
|
||||||
fprintf(f, " return %s(ptr);\n", manualfunc);
|
fprintf(f, " return %s(ptr);\n", manualfunc);
|
||||||
@@ -1472,7 +1490,7 @@ static char *rna_def_property_length_func(
|
|||||||
|
|
||||||
func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "length");
|
func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "length");
|
||||||
|
|
||||||
fprintf(f, "int %s(PointerRNA *ptr)\n", func);
|
fprintf(f, "RNA_EXTERN_C int %s(PointerRNA *ptr)\n", func);
|
||||||
fprintf(f, "{\n");
|
fprintf(f, "{\n");
|
||||||
if (manualfunc) {
|
if (manualfunc) {
|
||||||
fprintf(f, " return %s(ptr);\n", manualfunc);
|
fprintf(f, " return %s(ptr);\n", manualfunc);
|
||||||
@@ -1521,7 +1539,7 @@ static char *rna_def_property_begin_func(
|
|||||||
|
|
||||||
func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "begin");
|
func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "begin");
|
||||||
|
|
||||||
fprintf(f, "void %s(CollectionPropertyIterator *iter, PointerRNA *ptr)\n", func);
|
fprintf(f, "RNA_EXTERN_C void %s(CollectionPropertyIterator *iter, PointerRNA *ptr)\n", func);
|
||||||
fprintf(f, "{\n");
|
fprintf(f, "{\n");
|
||||||
|
|
||||||
if (!manualfunc) {
|
if (!manualfunc) {
|
||||||
@@ -1610,7 +1628,7 @@ static char *rna_def_property_lookup_int_func(FILE *f,
|
|||||||
|
|
||||||
func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "lookup_int");
|
func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "lookup_int");
|
||||||
|
|
||||||
fprintf(f, "int %s(PointerRNA *ptr, int index, PointerRNA *r_ptr)\n", func);
|
fprintf(f, "RNA_EXTERN_C int %s(PointerRNA *ptr, int index, PointerRNA *r_ptr)\n", func);
|
||||||
fprintf(f, "{\n");
|
fprintf(f, "{\n");
|
||||||
|
|
||||||
if (manualfunc) {
|
if (manualfunc) {
|
||||||
@@ -1754,7 +1772,21 @@ static char *rna_def_property_lookup_string_func(FILE *f,
|
|||||||
|
|
||||||
func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "lookup_string");
|
func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "lookup_string");
|
||||||
|
|
||||||
fprintf(f, "int %s(PointerRNA *ptr, const char *key, PointerRNA *r_ptr)\n", func);
|
if (!manualfunc) {
|
||||||
|
/* XXX extern declaration could be avoid by including RNA_blender.h, but this has lots of
|
||||||
|
* unknown DNA types in functions, leading to conflicting function signatures.
|
||||||
|
*/
|
||||||
|
fprintf(f,
|
||||||
|
"RNA_EXTERN_C int %s_%s_length(PointerRNA *);\n",
|
||||||
|
item_name_base->identifier,
|
||||||
|
rna_safe_id(item_name_prop->identifier));
|
||||||
|
fprintf(f,
|
||||||
|
"RNA_EXTERN_C void %s_%s_get(PointerRNA *, char *);\n\n",
|
||||||
|
item_name_base->identifier,
|
||||||
|
rna_safe_id(item_name_prop->identifier));
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf(f, "RNA_EXTERN_C int %s(PointerRNA *ptr, const char *key, PointerRNA *r_ptr)\n", func);
|
||||||
fprintf(f, "{\n");
|
fprintf(f, "{\n");
|
||||||
|
|
||||||
if (manualfunc) {
|
if (manualfunc) {
|
||||||
@@ -1763,18 +1795,6 @@ static char *rna_def_property_lookup_string_func(FILE *f,
|
|||||||
return func;
|
return func;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXX extern declaration could be avoid by including RNA_blender.h, but this has lots of unknown
|
|
||||||
* DNA types in functions, leading to conflicting function signatures.
|
|
||||||
*/
|
|
||||||
fprintf(f,
|
|
||||||
" extern int %s_%s_length(PointerRNA *);\n",
|
|
||||||
item_name_base->identifier,
|
|
||||||
rna_safe_id(item_name_prop->identifier));
|
|
||||||
fprintf(f,
|
|
||||||
" extern void %s_%s_get(PointerRNA *, char *);\n\n",
|
|
||||||
item_name_base->identifier,
|
|
||||||
rna_safe_id(item_name_prop->identifier));
|
|
||||||
|
|
||||||
fprintf(f, " bool found = false;\n");
|
fprintf(f, " bool found = false;\n");
|
||||||
fprintf(f, " CollectionPropertyIterator iter;\n");
|
fprintf(f, " CollectionPropertyIterator iter;\n");
|
||||||
fprintf(f, " char namebuf[%d];\n", namebuflen);
|
fprintf(f, " char namebuf[%d];\n", namebuflen);
|
||||||
@@ -1844,7 +1864,7 @@ static char *rna_def_property_next_func(FILE *f,
|
|||||||
|
|
||||||
func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "next");
|
func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "next");
|
||||||
|
|
||||||
fprintf(f, "void %s(CollectionPropertyIterator *iter)\n", func);
|
fprintf(f, "RNA_EXTERN_C void %s(CollectionPropertyIterator *iter)\n", func);
|
||||||
fprintf(f, "{\n");
|
fprintf(f, "{\n");
|
||||||
fprintf(f, " %s(iter);\n", manualfunc);
|
fprintf(f, " %s(iter);\n", manualfunc);
|
||||||
|
|
||||||
@@ -1873,7 +1893,7 @@ static char *rna_def_property_end_func(FILE *f,
|
|||||||
|
|
||||||
func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "end");
|
func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "end");
|
||||||
|
|
||||||
fprintf(f, "void %s(CollectionPropertyIterator *iter)\n", func);
|
fprintf(f, "RNA_EXTERN_C void %s(CollectionPropertyIterator *iter)\n", func);
|
||||||
fprintf(f, "{\n");
|
fprintf(f, "{\n");
|
||||||
if (manualfunc) {
|
if (manualfunc) {
|
||||||
fprintf(f, " %s(iter);\n", manualfunc);
|
fprintf(f, " %s(iter);\n", manualfunc);
|
||||||
@@ -2127,7 +2147,7 @@ static void rna_def_property_funcs_header(FILE *f, StructRNA *srna, PropertyDefR
|
|||||||
fprintf(f, "bool %sget(PointerRNA *ptr);\n", func);
|
fprintf(f, "bool %sget(PointerRNA *ptr);\n", func);
|
||||||
fprintf(f, "void %sset(PointerRNA *ptr, bool value);\n", func);
|
fprintf(f, "void %sset(PointerRNA *ptr, bool value);\n", func);
|
||||||
}
|
}
|
||||||
else if (prop->arraydimension && prop->totarraylength) {
|
else if ((prop->flag & PROP_DYNAMIC) == 0 && prop->arraydimension && prop->totarraylength) {
|
||||||
fprintf(f, "void %sget(PointerRNA *ptr, bool values[%u]);\n", func, prop->totarraylength);
|
fprintf(f, "void %sget(PointerRNA *ptr, bool values[%u]);\n", func, prop->totarraylength);
|
||||||
fprintf(f,
|
fprintf(f,
|
||||||
"void %sset(PointerRNA *ptr, const bool values[%u]);\n",
|
"void %sset(PointerRNA *ptr, const bool values[%u]);\n",
|
||||||
@@ -2145,7 +2165,7 @@ static void rna_def_property_funcs_header(FILE *f, StructRNA *srna, PropertyDefR
|
|||||||
fprintf(f, "int %sget(PointerRNA *ptr);\n", func);
|
fprintf(f, "int %sget(PointerRNA *ptr);\n", func);
|
||||||
fprintf(f, "void %sset(PointerRNA *ptr, int value);\n", func);
|
fprintf(f, "void %sset(PointerRNA *ptr, int value);\n", func);
|
||||||
}
|
}
|
||||||
else if (prop->arraydimension && prop->totarraylength) {
|
else if ((prop->flag & PROP_DYNAMIC) == 0 && prop->arraydimension && prop->totarraylength) {
|
||||||
fprintf(f, "void %sget(PointerRNA *ptr, int values[%u]);\n", func, prop->totarraylength);
|
fprintf(f, "void %sget(PointerRNA *ptr, int values[%u]);\n", func, prop->totarraylength);
|
||||||
fprintf(
|
fprintf(
|
||||||
f, "void %sset(PointerRNA *ptr, const int values[%u]);\n", func, prop->totarraylength);
|
f, "void %sset(PointerRNA *ptr, const int values[%u]);\n", func, prop->totarraylength);
|
||||||
@@ -2161,7 +2181,7 @@ static void rna_def_property_funcs_header(FILE *f, StructRNA *srna, PropertyDefR
|
|||||||
fprintf(f, "float %sget(PointerRNA *ptr);\n", func);
|
fprintf(f, "float %sget(PointerRNA *ptr);\n", func);
|
||||||
fprintf(f, "void %sset(PointerRNA *ptr, float value);\n", func);
|
fprintf(f, "void %sset(PointerRNA *ptr, float value);\n", func);
|
||||||
}
|
}
|
||||||
else if (prop->arraydimension && prop->totarraylength) {
|
else if ((prop->flag & PROP_DYNAMIC) == 0 && prop->arraydimension && prop->totarraylength) {
|
||||||
fprintf(f, "void %sget(PointerRNA *ptr, float values[%u]);\n", func, prop->totarraylength);
|
fprintf(f, "void %sget(PointerRNA *ptr, float values[%u]);\n", func, prop->totarraylength);
|
||||||
fprintf(f,
|
fprintf(f,
|
||||||
"void %sset(PointerRNA *ptr, const float values[%u]);\n",
|
"void %sset(PointerRNA *ptr, const float values[%u]);\n",
|
||||||
@@ -2846,7 +2866,7 @@ static void rna_def_property_wrapper_funcs(FILE *f, StructDefRNA *dsrna, Propert
|
|||||||
char funcname[2048];
|
char funcname[2048];
|
||||||
rna_construct_wrapper_function_name(
|
rna_construct_wrapper_function_name(
|
||||||
funcname, sizeof(funcname), dsrna->srna->identifier, dp->prop->identifier, "get_length");
|
funcname, sizeof(funcname), dsrna->srna->identifier, dp->prop->identifier, "get_length");
|
||||||
fprintf(f, "int %s(PointerRNA *ptr, int *arraylen)\n", funcname);
|
fprintf(f, "RNA_EXTERN_C int %s(PointerRNA *ptr, int *arraylen)\n", funcname);
|
||||||
fprintf(f, "{\n");
|
fprintf(f, "{\n");
|
||||||
fprintf(f, "\treturn %s(ptr, arraylen);\n", rna_function_string(dp->prop->getlength));
|
fprintf(f, "\treturn %s(ptr, arraylen);\n", rna_function_string(dp->prop->getlength));
|
||||||
fprintf(f, "}\n\n");
|
fprintf(f, "}\n\n");
|
||||||
@@ -2869,6 +2889,7 @@ static void rna_def_function_wrapper_funcs(FILE *f, StructDefRNA *dsrna, Functio
|
|||||||
rna_construct_wrapper_function_name(
|
rna_construct_wrapper_function_name(
|
||||||
funcname, sizeof(funcname), srna->identifier, func->identifier, "func");
|
funcname, sizeof(funcname), srna->identifier, func->identifier, "func");
|
||||||
|
|
||||||
|
fprintf(f, "RNA_EXTERN_C ");
|
||||||
rna_generate_static_parameter_prototypes(f, srna, dfunc, funcname, 0);
|
rna_generate_static_parameter_prototypes(f, srna, dfunc, funcname, 0);
|
||||||
|
|
||||||
fprintf(f, "\n{\n");
|
fprintf(f, "\n{\n");
|
||||||
@@ -2946,9 +2967,10 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA
|
|||||||
funcname = rna_alloc_function_name(srna->identifier, func->identifier, "call");
|
funcname = rna_alloc_function_name(srna->identifier, func->identifier, "call");
|
||||||
|
|
||||||
/* function definition */
|
/* function definition */
|
||||||
fprintf(f,
|
fprintf(
|
||||||
"void %s(bContext *C, ReportList *reports, PointerRNA *_ptr, ParameterList *_parms)",
|
f,
|
||||||
funcname);
|
"static void %s(bContext *C, ReportList *reports, PointerRNA *_ptr, ParameterList *_parms)",
|
||||||
|
funcname);
|
||||||
fprintf(f, "\n{\n");
|
fprintf(f, "\n{\n");
|
||||||
|
|
||||||
/* variable definitions */
|
/* variable definitions */
|
||||||
@@ -3020,7 +3042,7 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA
|
|||||||
rna_type_struct(dparm->prop),
|
rna_type_struct(dparm->prop),
|
||||||
rna_parameter_type_name(dparm->prop),
|
rna_parameter_type_name(dparm->prop),
|
||||||
ptrstr,
|
ptrstr,
|
||||||
dparm->prop->identifier);
|
rna_safe_id(dparm->prop->identifier));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (has_data) {
|
if (has_data) {
|
||||||
@@ -3101,14 +3123,14 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA
|
|||||||
if (flag & PROP_DYNAMIC) {
|
if (flag & PROP_DYNAMIC) {
|
||||||
fprintf(f,
|
fprintf(f,
|
||||||
"\t%s_len = %s((ParameterDynAlloc *)_data)->array_tot;\n",
|
"\t%s_len = %s((ParameterDynAlloc *)_data)->array_tot;\n",
|
||||||
dparm->prop->identifier,
|
rna_safe_id(dparm->prop->identifier),
|
||||||
pout ? "(int *)&" : "(int)");
|
pout ? "(int *)&" : "(int)");
|
||||||
data_str = "(&(((ParameterDynAlloc *)_data)->array))";
|
data_str = "(&(((ParameterDynAlloc *)_data)->array))";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
data_str = "_data";
|
data_str = "_data";
|
||||||
}
|
}
|
||||||
fprintf(f, "\t%s = ", dparm->prop->identifier);
|
fprintf(f, "\t%s = ", rna_safe_id(dparm->prop->identifier));
|
||||||
|
|
||||||
if (!pout) {
|
if (!pout) {
|
||||||
fprintf(f, "%s", valstr);
|
fprintf(f, "%s", valstr);
|
||||||
@@ -3193,10 +3215,13 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA
|
|||||||
first = 0;
|
first = 0;
|
||||||
|
|
||||||
if (dparm->prop->flag & PROP_DYNAMIC) {
|
if (dparm->prop->flag & PROP_DYNAMIC) {
|
||||||
fprintf(f, "%s_len, %s", dparm->prop->identifier, dparm->prop->identifier);
|
fprintf(f,
|
||||||
|
"%s_len, %s",
|
||||||
|
rna_safe_id(dparm->prop->identifier),
|
||||||
|
rna_safe_id(dparm->prop->identifier));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fprintf(f, "%s", dparm->prop->identifier);
|
fprintf(f, "%s", rna_safe_id(dparm->prop->identifier));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3495,7 +3520,7 @@ static void rna_generate_internal_property_prototypes(BlenderRNA *UNUSED(brna),
|
|||||||
for (prop = base->cont.properties.first; prop; prop = prop->next) {
|
for (prop = base->cont.properties.first; prop; prop = prop->next) {
|
||||||
fprintf(f,
|
fprintf(f,
|
||||||
"%s%s rna_%s_%s;\n",
|
"%s%s rna_%s_%s;\n",
|
||||||
"extern ",
|
"RNA_EXTERN_C_OR_EXTERN ",
|
||||||
rna_property_structname(prop->type),
|
rna_property_structname(prop->type),
|
||||||
base->identifier,
|
base->identifier,
|
||||||
prop->identifier);
|
prop->identifier);
|
||||||
@@ -3509,7 +3534,7 @@ static void rna_generate_internal_property_prototypes(BlenderRNA *UNUSED(brna),
|
|||||||
|
|
||||||
for (prop = srna->cont.properties.first; prop; prop = prop->next) {
|
for (prop = srna->cont.properties.first; prop; prop = prop->next) {
|
||||||
fprintf(f,
|
fprintf(f,
|
||||||
"extern %s rna_%s_%s;\n",
|
"RNA_EXTERN_C %s rna_%s_%s;\n",
|
||||||
rna_property_structname(prop->type),
|
rna_property_structname(prop->type),
|
||||||
srna->identifier,
|
srna->identifier,
|
||||||
prop->identifier);
|
prop->identifier);
|
||||||
@@ -4145,7 +4170,7 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
|
|||||||
rna_function_string(iprop->getarray_ex),
|
rna_function_string(iprop->getarray_ex),
|
||||||
rna_function_string(iprop->setarray_ex),
|
rna_function_string(iprop->setarray_ex),
|
||||||
rna_function_string(iprop->range_ex));
|
rna_function_string(iprop->range_ex));
|
||||||
rna_int_print(f, iprop->ui_scale_type);
|
fprintf(f, "%s", rna_ui_scale_type_string(iprop->ui_scale_type));
|
||||||
fprintf(f, ", ");
|
fprintf(f, ", ");
|
||||||
rna_int_print(f, iprop->softmin);
|
rna_int_print(f, iprop->softmin);
|
||||||
fprintf(f, ", ");
|
fprintf(f, ", ");
|
||||||
@@ -4207,7 +4232,7 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
|
|||||||
case PROP_STRING: {
|
case PROP_STRING: {
|
||||||
StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
|
StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
|
||||||
fprintf(f,
|
fprintf(f,
|
||||||
"\t%s, %s, %s, %s, %s, %s, %s, %d, %d, ",
|
"\t%s, %s, %s, %s, %s, %s, %s, (eStringPropertySearchFlag)%d, %d, ",
|
||||||
rna_function_string(sprop->get),
|
rna_function_string(sprop->get),
|
||||||
rna_function_string(sprop->length),
|
rna_function_string(sprop->length),
|
||||||
rna_function_string(sprop->set),
|
rna_function_string(sprop->set),
|
||||||
@@ -4530,14 +4555,14 @@ static RNAProcessItem PROCESS_ITEMS[] = {
|
|||||||
{"rna_image.c", "rna_image_api.c", RNA_def_image},
|
{"rna_image.c", "rna_image_api.c", RNA_def_image},
|
||||||
{"rna_key.c", NULL, RNA_def_key},
|
{"rna_key.c", NULL, RNA_def_key},
|
||||||
{"rna_light.c", NULL, RNA_def_light},
|
{"rna_light.c", NULL, RNA_def_light},
|
||||||
{"rna_lattice.c", "rna_lattice_api.c", RNA_def_lattice},
|
{"rna_lattice.cc", "rna_lattice_api.cc", RNA_def_lattice},
|
||||||
{"rna_layer.c", NULL, RNA_def_view_layer},
|
{"rna_layer.c", NULL, RNA_def_view_layer},
|
||||||
{"rna_linestyle.c", NULL, RNA_def_linestyle},
|
{"rna_linestyle.c", NULL, RNA_def_linestyle},
|
||||||
{"rna_main.c", "rna_main_api.c", RNA_def_main},
|
{"rna_main.c", "rna_main_api.c", RNA_def_main},
|
||||||
{"rna_fluid.c", NULL, RNA_def_fluid},
|
{"rna_fluid.c", NULL, RNA_def_fluid},
|
||||||
{"rna_material.c", "rna_material_api.c", RNA_def_material},
|
{"rna_material.c", "rna_material_api.c", RNA_def_material},
|
||||||
{"rna_mesh.c", "rna_mesh_api.c", RNA_def_mesh},
|
{"rna_mesh.c", "rna_mesh_api.c", RNA_def_mesh},
|
||||||
{"rna_meta.c", "rna_meta_api.c", RNA_def_meta},
|
{"rna_meta.cc", "rna_meta_api.c", RNA_def_meta},
|
||||||
{"rna_modifier.c", NULL, RNA_def_modifier},
|
{"rna_modifier.c", NULL, RNA_def_modifier},
|
||||||
{"rna_gpencil_legacy_modifier.c", NULL, RNA_def_greasepencil_modifier},
|
{"rna_gpencil_legacy_modifier.c", NULL, RNA_def_greasepencil_modifier},
|
||||||
{"rna_shader_fx.c", NULL, RNA_def_shader_fx},
|
{"rna_shader_fx.c", NULL, RNA_def_shader_fx},
|
||||||
@@ -4550,7 +4575,7 @@ static RNAProcessItem PROCESS_ITEMS[] = {
|
|||||||
{"rna_palette.c", NULL, RNA_def_palette},
|
{"rna_palette.c", NULL, RNA_def_palette},
|
||||||
{"rna_particle.c", NULL, RNA_def_particle},
|
{"rna_particle.c", NULL, RNA_def_particle},
|
||||||
{"rna_pointcloud.c", NULL, RNA_def_pointcloud},
|
{"rna_pointcloud.c", NULL, RNA_def_pointcloud},
|
||||||
{"rna_pose.c", "rna_pose_api.c", RNA_def_pose},
|
{"rna_pose.cc", "rna_pose_api.c", RNA_def_pose},
|
||||||
{"rna_curveprofile.c", NULL, RNA_def_profile},
|
{"rna_curveprofile.c", NULL, RNA_def_profile},
|
||||||
{"rna_lightprobe.c", NULL, RNA_def_lightprobe},
|
{"rna_lightprobe.c", NULL, RNA_def_lightprobe},
|
||||||
{"rna_render.c", NULL, RNA_def_render},
|
{"rna_render.c", NULL, RNA_def_render},
|
||||||
@@ -4578,7 +4603,7 @@ static RNAProcessItem PROCESS_ITEMS[] = {
|
|||||||
{"rna_world.c", NULL, RNA_def_world},
|
{"rna_world.c", NULL, RNA_def_world},
|
||||||
{"rna_movieclip.c", NULL, RNA_def_movieclip},
|
{"rna_movieclip.c", NULL, RNA_def_movieclip},
|
||||||
{"rna_tracking.c", NULL, RNA_def_tracking},
|
{"rna_tracking.c", NULL, RNA_def_tracking},
|
||||||
{"rna_mask.c", NULL, RNA_def_mask},
|
{"rna_mask.cc", NULL, RNA_def_mask},
|
||||||
{"rna_xr.c", NULL, RNA_def_xr},
|
{"rna_xr.c", NULL, RNA_def_xr},
|
||||||
{NULL, NULL},
|
{NULL, NULL},
|
||||||
};
|
};
|
||||||
@@ -4629,6 +4654,13 @@ static void rna_generate(BlenderRNA *brna, FILE *f, const char *filename, const
|
|||||||
fprintf(f, "#include \"%s\"\n", api_filename);
|
fprintf(f, "#include \"%s\"\n", api_filename);
|
||||||
}
|
}
|
||||||
fprintf(f, "\n");
|
fprintf(f, "\n");
|
||||||
|
fprintf(f, "#ifdef __cplusplus\n");
|
||||||
|
fprintf(f, "# define RNA_EXTERN_C extern \"C\"\n");
|
||||||
|
fprintf(f, "# define RNA_EXTERN_C_OR_EXTERN extern \"C\"\n");
|
||||||
|
fprintf(f, "#else\n");
|
||||||
|
fprintf(f, "# define RNA_EXTERN_C\n");
|
||||||
|
fprintf(f, "# define RNA_EXTERN_C_OR_EXTERN extern\n");
|
||||||
|
fprintf(f, "#endif\n");
|
||||||
|
|
||||||
/* we want the included C files to have warnings enabled but for the generated code
|
/* we want the included C files to have warnings enabled but for the generated code
|
||||||
* ignore unused-parameter warnings which are hard to prevent */
|
* ignore unused-parameter warnings which are hard to prevent */
|
||||||
@@ -5354,7 +5386,9 @@ static int rna_preprocess(const char *outfile, const char *public_header_outfile
|
|||||||
fprintf(file,
|
fprintf(file,
|
||||||
"/* Automatically generated function declarations for the Data API.\n"
|
"/* Automatically generated function declarations for the Data API.\n"
|
||||||
" * Do not edit manually, changes will be overwritten. */\n\n");
|
" * Do not edit manually, changes will be overwritten. */\n\n");
|
||||||
|
fprintf(file, "#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n");
|
||||||
rna_generate_struct_rna_prototypes(brna, file);
|
rna_generate_struct_rna_prototypes(brna, file);
|
||||||
|
fprintf(file, "#ifdef __cplusplus\n}\n#endif\n");
|
||||||
fclose(file);
|
fclose(file);
|
||||||
status = (DefRNA.error != 0);
|
status = (DefRNA.error != 0);
|
||||||
}
|
}
|
||||||
@@ -5363,8 +5397,14 @@ static int rna_preprocess(const char *outfile, const char *public_header_outfile
|
|||||||
for (i = 0; PROCESS_ITEMS[i].filename; i++) {
|
for (i = 0; PROCESS_ITEMS[i].filename; i++) {
|
||||||
strcpy(deffile, outfile);
|
strcpy(deffile, outfile);
|
||||||
strcat(deffile, PROCESS_ITEMS[i].filename);
|
strcat(deffile, PROCESS_ITEMS[i].filename);
|
||||||
deffile[strlen(deffile) - 2] = '\0';
|
if (deffile[strlen(deffile) - 3] == '.') {
|
||||||
strcat(deffile, "_gen.c" TMP_EXT);
|
deffile[strlen(deffile) - 3] = '\0';
|
||||||
|
strcat(deffile, "_gen.cc" TMP_EXT);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
deffile[strlen(deffile) - 2] = '\0';
|
||||||
|
strcat(deffile, "_gen.c" TMP_EXT);
|
||||||
|
}
|
||||||
|
|
||||||
if (status) {
|
if (status) {
|
||||||
make_bad_file(deffile, __LINE__);
|
make_bad_file(deffile, __LINE__);
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ static void rna_Lattice_points_begin(CollectionPropertyIterator *iter, PointerRN
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_Lattice_update_data(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
|
static void rna_Lattice_update_data(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
|
||||||
{
|
{
|
||||||
ID *id = ptr->owner_id;
|
ID *id = ptr->owner_id;
|
||||||
|
|
||||||
@@ -94,9 +94,7 @@ static void rna_Lattice_update_data(Main *UNUSED(bmain), Scene *UNUSED(scene), P
|
|||||||
* we could split this up differently (one update call per property)
|
* we could split this up differently (one update call per property)
|
||||||
* but for now that's overkill
|
* but for now that's overkill
|
||||||
*/
|
*/
|
||||||
static void rna_Lattice_update_data_editlatt(Main *UNUSED(bmain),
|
static void rna_Lattice_update_data_editlatt(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
|
||||||
Scene *UNUSED(scene),
|
|
||||||
PointerRNA *ptr)
|
|
||||||
{
|
{
|
||||||
ID *id = ptr->owner_id;
|
ID *id = ptr->owner_id;
|
||||||
Lattice *lt = (Lattice *)ptr->owner_id;
|
Lattice *lt = (Lattice *)ptr->owner_id;
|
||||||
@@ -126,7 +124,8 @@ static void rna_Lattice_update_size(Main *bmain, Scene *scene, PointerRNA *ptr)
|
|||||||
neww = (lt->opntsw > 0) ? lt->opntsw : lt->pntsw;
|
neww = (lt->opntsw > 0) ? lt->opntsw : lt->pntsw;
|
||||||
|
|
||||||
/* #BKE_lattice_resize needs an object, any object will have the same result */
|
/* #BKE_lattice_resize needs an object, any object will have the same result */
|
||||||
for (ob = bmain->objects.first; ob; ob = ob->id.next) {
|
for (ob = static_cast<Object *>(bmain->objects.first); ob;
|
||||||
|
ob = static_cast<Object *>(ob->id.next)) {
|
||||||
if (ob->data == lt) {
|
if (ob->data == lt) {
|
||||||
BKE_lattice_resize(lt, newu, newv, neww, ob);
|
BKE_lattice_resize(lt, newu, newv, neww, ob);
|
||||||
if (lt->editlatt) {
|
if (lt->editlatt) {
|
||||||
@@ -149,7 +148,7 @@ static void rna_Lattice_update_size(Main *bmain, Scene *scene, PointerRNA *ptr)
|
|||||||
|
|
||||||
static void rna_Lattice_use_outside_set(PointerRNA *ptr, bool value)
|
static void rna_Lattice_use_outside_set(PointerRNA *ptr, bool value)
|
||||||
{
|
{
|
||||||
Lattice *lt = ptr->data;
|
Lattice *lt = static_cast<Lattice *>(ptr->data);
|
||||||
|
|
||||||
if (value) {
|
if (value) {
|
||||||
lt->flag |= LT_OUTSIDE;
|
lt->flag |= LT_OUTSIDE;
|
||||||
@@ -172,11 +171,11 @@ static void rna_Lattice_use_outside_set(PointerRNA *ptr, bool value)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rna_Lattice_size_editable(PointerRNA *ptr, const char **UNUSED(r_info))
|
static int rna_Lattice_size_editable(PointerRNA *ptr, const char ** /*r_info*/)
|
||||||
{
|
{
|
||||||
Lattice *lt = (Lattice *)ptr->data;
|
Lattice *lt = (Lattice *)ptr->data;
|
||||||
|
|
||||||
return (lt->key == NULL) ? PROP_EDITABLE : 0;
|
return (lt->key == NULL) ? int(PROP_EDITABLE) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_Lattice_points_u_set(PointerRNA *ptr, int value)
|
static void rna_Lattice_points_u_set(PointerRNA *ptr, int value)
|
||||||
@@ -202,7 +201,7 @@ static void rna_Lattice_points_w_set(PointerRNA *ptr, int value)
|
|||||||
|
|
||||||
static void rna_Lattice_vg_name_set(PointerRNA *ptr, const char *value)
|
static void rna_Lattice_vg_name_set(PointerRNA *ptr, const char *value)
|
||||||
{
|
{
|
||||||
Lattice *lt = ptr->data;
|
Lattice *lt = static_cast<Lattice *>(ptr->data);
|
||||||
STRNCPY(lt->vgroup, value);
|
STRNCPY(lt->vgroup, value);
|
||||||
|
|
||||||
if (lt->editlatt) {
|
if (lt->editlatt) {
|
||||||
@@ -40,7 +40,7 @@ void RNA_api_lattice(StructRNA *srna)
|
|||||||
func = RNA_def_function(srna, "transform", "rna_Lattice_transform");
|
func = RNA_def_function(srna, "transform", "rna_Lattice_transform");
|
||||||
RNA_def_function_ui_description(func, "Transform lattice by a matrix");
|
RNA_def_function_ui_description(func, "Transform lattice by a matrix");
|
||||||
parm = RNA_def_float_matrix(func, "matrix", 4, 4, NULL, 0.0f, 0.0f, "", "Matrix", 0.0f, 0.0f);
|
parm = RNA_def_float_matrix(func, "matrix", 4, 4, NULL, 0.0f, 0.0f, "", "Matrix", 0.0f, 0.0f);
|
||||||
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
RNA_def_parameter_flags(parm, PropertyFlag(0), PARM_REQUIRED);
|
||||||
RNA_def_boolean(func, "shape_keys", 0, "", "Transform Shape Keys");
|
RNA_def_boolean(func, "shape_keys", 0, "", "Transform Shape Keys");
|
||||||
|
|
||||||
RNA_def_function(srna, "update_gpu_tag", "rna_Lattice_update_gpu_tag");
|
RNA_def_function(srna, "update_gpu_tag", "rna_Lattice_update_gpu_tag");
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
|
|
||||||
# include "WM_api.h"
|
# include "WM_api.h"
|
||||||
|
|
||||||
static void rna_Mask_update_data(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
|
static void rna_Mask_update_data(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
|
||||||
{
|
{
|
||||||
Mask *mask = (Mask *)ptr->owner_id;
|
Mask *mask = (Mask *)ptr->owner_id;
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ static void rna_Mask_update_data(Main *UNUSED(bmain), Scene *UNUSED(scene), Poin
|
|||||||
|
|
||||||
static void rna_Mask_update_parent(Main *bmain, Scene *scene, PointerRNA *ptr)
|
static void rna_Mask_update_parent(Main *bmain, Scene *scene, PointerRNA *ptr)
|
||||||
{
|
{
|
||||||
MaskParent *parent = ptr->data;
|
MaskParent *parent = static_cast<MaskParent *>(ptr->data);
|
||||||
|
|
||||||
if (parent->id) {
|
if (parent->id) {
|
||||||
if (GS(parent->id->name) == ID_MC) {
|
if (GS(parent->id->name) == ID_MC) {
|
||||||
@@ -108,11 +108,11 @@ static void rna_Mask_update_parent(Main *bmain, Scene *scene, PointerRNA *ptr)
|
|||||||
/* NOTE: this function exists only to avoid id reference-counting. */
|
/* NOTE: this function exists only to avoid id reference-counting. */
|
||||||
static void rna_MaskParent_id_set(PointerRNA *ptr,
|
static void rna_MaskParent_id_set(PointerRNA *ptr,
|
||||||
PointerRNA value,
|
PointerRNA value,
|
||||||
struct ReportList *UNUSED(reports))
|
struct ReportList * /*reports*/)
|
||||||
{
|
{
|
||||||
MaskParent *mpar = (MaskParent *)ptr->data;
|
MaskParent *mpar = (MaskParent *)ptr->data;
|
||||||
|
|
||||||
mpar->id = value.data;
|
mpar->id = static_cast<ID *>(value.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static StructRNA *rna_MaskParent_id_typef(PointerRNA *ptr)
|
static StructRNA *rna_MaskParent_id_typef(PointerRNA *ptr)
|
||||||
@@ -186,7 +186,7 @@ static PointerRNA rna_Mask_layer_active_get(PointerRNA *ptr)
|
|||||||
|
|
||||||
static void rna_Mask_layer_active_set(PointerRNA *ptr,
|
static void rna_Mask_layer_active_set(PointerRNA *ptr,
|
||||||
PointerRNA value,
|
PointerRNA value,
|
||||||
struct ReportList *UNUSED(reports))
|
struct ReportList * /*reports*/)
|
||||||
{
|
{
|
||||||
Mask *mask = (Mask *)ptr->owner_id;
|
Mask *mask = (Mask *)ptr->owner_id;
|
||||||
MaskLayer *masklay = (MaskLayer *)value.data;
|
MaskLayer *masklay = (MaskLayer *)value.data;
|
||||||
@@ -223,7 +223,7 @@ static PointerRNA rna_MaskLayer_active_spline_get(PointerRNA *ptr)
|
|||||||
|
|
||||||
static void rna_MaskLayer_active_spline_set(PointerRNA *ptr,
|
static void rna_MaskLayer_active_spline_set(PointerRNA *ptr,
|
||||||
PointerRNA value,
|
PointerRNA value,
|
||||||
struct ReportList *UNUSED(reports))
|
struct ReportList * /*reports*/)
|
||||||
{
|
{
|
||||||
MaskLayer *masklay = (MaskLayer *)ptr->data;
|
MaskLayer *masklay = (MaskLayer *)ptr->data;
|
||||||
MaskSpline *spline = (MaskSpline *)value.data;
|
MaskSpline *spline = (MaskSpline *)value.data;
|
||||||
@@ -246,7 +246,7 @@ static PointerRNA rna_MaskLayer_active_spline_point_get(PointerRNA *ptr)
|
|||||||
|
|
||||||
static void rna_MaskLayer_active_spline_point_set(PointerRNA *ptr,
|
static void rna_MaskLayer_active_spline_point_set(PointerRNA *ptr,
|
||||||
PointerRNA value,
|
PointerRNA value,
|
||||||
struct ReportList *UNUSED(reports))
|
struct ReportList * /*reports*/)
|
||||||
{
|
{
|
||||||
MaskLayer *masklay = (MaskLayer *)ptr->data;
|
MaskLayer *masklay = (MaskLayer *)ptr->data;
|
||||||
MaskSpline *spline;
|
MaskSpline *spline;
|
||||||
@@ -254,7 +254,7 @@ static void rna_MaskLayer_active_spline_point_set(PointerRNA *ptr,
|
|||||||
|
|
||||||
masklay->act_point = NULL;
|
masklay->act_point = NULL;
|
||||||
|
|
||||||
for (spline = masklay->splines.first; spline; spline = spline->next) {
|
for (spline = static_cast<MaskSpline *>(masklay->splines.first); spline; spline = spline->next) {
|
||||||
if (point >= spline->points && point < spline->points + spline->tot_point) {
|
if (point >= spline->points && point < spline->points + spline->tot_point) {
|
||||||
masklay->act_point = point;
|
masklay->act_point = point;
|
||||||
|
|
||||||
@@ -316,9 +316,12 @@ static int rna_MaskSplinePoint_handle_type_get(PointerRNA *ptr)
|
|||||||
static MaskSpline *mask_spline_from_point(Mask *mask, MaskSplinePoint *point)
|
static MaskSpline *mask_spline_from_point(Mask *mask, MaskSplinePoint *point)
|
||||||
{
|
{
|
||||||
MaskLayer *mask_layer;
|
MaskLayer *mask_layer;
|
||||||
for (mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
|
for (mask_layer = static_cast<MaskLayer *>(mask->masklayers.first); mask_layer;
|
||||||
|
mask_layer = mask_layer->next)
|
||||||
|
{
|
||||||
MaskSpline *spline;
|
MaskSpline *spline;
|
||||||
for (spline = mask_layer->splines.first; spline; spline = spline->next) {
|
for (spline = static_cast<MaskSpline *>(mask_layer->splines.first); spline;
|
||||||
|
spline = spline->next) {
|
||||||
if (point >= spline->points && point < spline->points + spline->tot_point) {
|
if (point >= spline->points && point < spline->points + spline->tot_point) {
|
||||||
return spline;
|
return spline;
|
||||||
}
|
}
|
||||||
@@ -399,7 +402,7 @@ static MaskLayer *rna_Mask_layers_new(Mask *mask, const char *name)
|
|||||||
|
|
||||||
static void rna_Mask_layers_remove(Mask *mask, ReportList *reports, PointerRNA *masklay_ptr)
|
static void rna_Mask_layers_remove(Mask *mask, ReportList *reports, PointerRNA *masklay_ptr)
|
||||||
{
|
{
|
||||||
MaskLayer *masklay = masklay_ptr->data;
|
MaskLayer *masklay = static_cast<MaskLayer *>(masklay_ptr->data);
|
||||||
if (BLI_findindex(&mask->masklayers, masklay) == -1) {
|
if (BLI_findindex(&mask->masklayers, masklay) == -1) {
|
||||||
BKE_reportf(reports,
|
BKE_reportf(reports,
|
||||||
RPT_ERROR,
|
RPT_ERROR,
|
||||||
@@ -440,7 +443,7 @@ static void rna_MaskLayer_spline_remove(ID *id,
|
|||||||
PointerRNA *spline_ptr)
|
PointerRNA *spline_ptr)
|
||||||
{
|
{
|
||||||
Mask *mask = (Mask *)id;
|
Mask *mask = (Mask *)id;
|
||||||
MaskSpline *spline = spline_ptr->data;
|
MaskSpline *spline = static_cast<MaskSpline *>(spline_ptr->data);
|
||||||
|
|
||||||
if (BKE_mask_spline_remove(mask_layer, spline) == false) {
|
if (BKE_mask_spline_remove(mask_layer, spline) == false) {
|
||||||
BKE_reportf(
|
BKE_reportf(
|
||||||
@@ -487,7 +490,7 @@ static void rna_MaskSpline_points_add(ID *id, MaskSpline *spline, int count)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (layer = mask->masklayers.first; layer; layer = layer->next) {
|
for (layer = static_cast<MaskLayer *>(mask->masklayers.first); layer; layer = layer->next) {
|
||||||
if (BLI_findindex(&layer->splines, spline) != -1) {
|
if (BLI_findindex(&layer->splines, spline) != -1) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -503,8 +506,8 @@ static void rna_MaskSpline_points_add(ID *id, MaskSpline *spline, int count)
|
|||||||
active_point_index = layer->act_point - spline->points;
|
active_point_index = layer->act_point - spline->points;
|
||||||
}
|
}
|
||||||
|
|
||||||
spline->points = MEM_recallocN(spline->points,
|
spline->points = static_cast<MaskSplinePoint *>(
|
||||||
sizeof(MaskSplinePoint) * (spline->tot_point + count));
|
MEM_recallocN(spline->points, sizeof(MaskSplinePoint) * (spline->tot_point + count)));
|
||||||
spline->tot_point += count;
|
spline->tot_point += count;
|
||||||
|
|
||||||
if (active_point_index >= 0) {
|
if (active_point_index >= 0) {
|
||||||
@@ -534,13 +537,13 @@ static void rna_MaskSpline_point_remove(ID *id,
|
|||||||
PointerRNA *point_ptr)
|
PointerRNA *point_ptr)
|
||||||
{
|
{
|
||||||
Mask *mask = (Mask *)id;
|
Mask *mask = (Mask *)id;
|
||||||
MaskSplinePoint *point = point_ptr->data;
|
MaskSplinePoint *point = static_cast<MaskSplinePoint *>(point_ptr->data);
|
||||||
MaskSplinePoint *new_point_array;
|
MaskSplinePoint *new_point_array;
|
||||||
MaskLayer *layer;
|
MaskLayer *layer;
|
||||||
int active_point_index = -1;
|
int active_point_index = -1;
|
||||||
int point_index;
|
int point_index;
|
||||||
|
|
||||||
for (layer = mask->masklayers.first; layer; layer = layer->next) {
|
for (layer = static_cast<MaskLayer *>(mask->masklayers.first); layer; layer = layer->next) {
|
||||||
if (BLI_findindex(&layer->splines, spline) != -1) {
|
if (BLI_findindex(&layer->splines, spline) != -1) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -563,8 +566,8 @@ static void rna_MaskSpline_point_remove(ID *id,
|
|||||||
|
|
||||||
point_index = point - spline->points;
|
point_index = point - spline->points;
|
||||||
|
|
||||||
new_point_array = MEM_mallocN(sizeof(MaskSplinePoint) * (spline->tot_point - 1),
|
new_point_array = static_cast<MaskSplinePoint *>(
|
||||||
"remove mask point");
|
MEM_mallocN(sizeof(MaskSplinePoint) * (spline->tot_point - 1), "remove mask point"));
|
||||||
|
|
||||||
memcpy(new_point_array, spline->points, sizeof(MaskSplinePoint) * point_index);
|
memcpy(new_point_array, spline->points, sizeof(MaskSplinePoint) * point_index);
|
||||||
memcpy(new_point_array + point_index,
|
memcpy(new_point_array + point_index,
|
||||||
@@ -809,7 +812,7 @@ static void rna_def_mask_splines(BlenderRNA *brna)
|
|||||||
RNA_def_function_flag(func, FUNC_USE_REPORTS);
|
RNA_def_function_flag(func, FUNC_USE_REPORTS);
|
||||||
parm = RNA_def_pointer(func, "spline", "MaskSpline", "", "The spline to remove");
|
parm = RNA_def_pointer(func, "spline", "MaskSpline", "", "The spline to remove");
|
||||||
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
|
||||||
RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
|
RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, ParameterFlag(0));
|
||||||
|
|
||||||
/* active spline */
|
/* active spline */
|
||||||
prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
|
prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
|
||||||
@@ -847,7 +850,7 @@ static void rna_def_maskSplinePoints(BlenderRNA *brna)
|
|||||||
RNA_def_function_ui_description(func, "Add a number of point to this spline");
|
RNA_def_function_ui_description(func, "Add a number of point to this spline");
|
||||||
parm = RNA_def_int(
|
parm = RNA_def_int(
|
||||||
func, "count", 1, 0, INT_MAX, "Number", "Number of points to add to the spline", 0, INT_MAX);
|
func, "count", 1, 0, INT_MAX, "Number", "Number of points to add to the spline", 0, INT_MAX);
|
||||||
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
RNA_def_parameter_flags(parm, PropertyFlag(0), PARM_REQUIRED);
|
||||||
|
|
||||||
/* Remove the point */
|
/* Remove the point */
|
||||||
func = RNA_def_function(srna, "remove", "rna_MaskSpline_point_remove");
|
func = RNA_def_function(srna, "remove", "rna_MaskSpline_point_remove");
|
||||||
@@ -856,7 +859,7 @@ static void rna_def_maskSplinePoints(BlenderRNA *brna)
|
|||||||
RNA_def_function_flag(func, FUNC_USE_REPORTS);
|
RNA_def_function_flag(func, FUNC_USE_REPORTS);
|
||||||
parm = RNA_def_pointer(func, "point", "MaskSplinePoint", "", "The point to remove");
|
parm = RNA_def_pointer(func, "point", "MaskSplinePoint", "", "The point to remove");
|
||||||
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
|
||||||
RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
|
RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, ParameterFlag(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_def_maskSpline(BlenderRNA *brna)
|
static void rna_def_maskSpline(BlenderRNA *brna)
|
||||||
@@ -1071,7 +1074,7 @@ static void rna_def_masklayers(BlenderRNA *brna, PropertyRNA *cprop)
|
|||||||
RNA_def_function_ui_description(func, "Remove layer from this mask");
|
RNA_def_function_ui_description(func, "Remove layer from this mask");
|
||||||
parm = RNA_def_pointer(func, "layer", "MaskLayer", "", "Shape to be removed");
|
parm = RNA_def_pointer(func, "layer", "MaskLayer", "", "Shape to be removed");
|
||||||
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
|
||||||
RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
|
RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, ParameterFlag(0));
|
||||||
|
|
||||||
/* clear all layers */
|
/* clear all layers */
|
||||||
func = RNA_def_function(srna, "clear", "rna_Mask_layers_clear");
|
func = RNA_def_function(srna, "clear", "rna_Mask_layers_clear");
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
# include "WM_api.h"
|
# include "WM_api.h"
|
||||||
# include "WM_types.h"
|
# include "WM_types.h"
|
||||||
|
|
||||||
static int rna_Meta_texspace_editable(PointerRNA *ptr, const char **UNUSED(r_info))
|
static int rna_Meta_texspace_editable(PointerRNA *ptr, const char ** /*r_info*/)
|
||||||
{
|
{
|
||||||
MetaBall *mb = (MetaBall *)ptr->data;
|
MetaBall *mb = (MetaBall *)ptr->data;
|
||||||
return (mb->texspace_flag & MB_TEXSPACE_FLAG_AUTO) ? 0 : PROP_EDITABLE;
|
return (mb->texspace_flag & MB_TEXSPACE_FLAG_AUTO) ? 0 : PROP_EDITABLE;
|
||||||
@@ -75,7 +75,7 @@ static void rna_Meta_texspace_size_set(PointerRNA *ptr, const float *values)
|
|||||||
copy_v3_v3(mb->texspace_size, values);
|
copy_v3_v3(mb->texspace_size, values);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_MetaBall_redraw_data(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
|
static void rna_MetaBall_redraw_data(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
|
||||||
{
|
{
|
||||||
ID *id = ptr->owner_id;
|
ID *id = ptr->owner_id;
|
||||||
|
|
||||||
@@ -83,7 +83,7 @@ static void rna_MetaBall_redraw_data(Main *UNUSED(bmain), Scene *UNUSED(scene),
|
|||||||
WM_main_add_notifier(NC_GEOM | ND_DATA, id);
|
WM_main_add_notifier(NC_GEOM | ND_DATA, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_MetaBall_update_data(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
|
static void rna_MetaBall_update_data(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
|
||||||
{
|
{
|
||||||
MetaBall *mb = (MetaBall *)ptr->owner_id;
|
MetaBall *mb = (MetaBall *)ptr->owner_id;
|
||||||
|
|
||||||
@@ -101,7 +101,7 @@ static void rna_MetaBall_update_data(Main *bmain, Scene *UNUSED(scene), PointerR
|
|||||||
|
|
||||||
static void rna_MetaBall_update_rotation(Main *bmain, Scene *scene, PointerRNA *ptr)
|
static void rna_MetaBall_update_rotation(Main *bmain, Scene *scene, PointerRNA *ptr)
|
||||||
{
|
{
|
||||||
MetaElem *ml = ptr->data;
|
MetaElem *ml = static_cast<MetaElem *>(ptr->data);
|
||||||
normalize_qt(ml->quat);
|
normalize_qt(ml->quat);
|
||||||
rna_MetaBall_update_data(bmain, scene, ptr);
|
rna_MetaBall_update_data(bmain, scene, ptr);
|
||||||
}
|
}
|
||||||
@@ -121,7 +121,7 @@ static MetaElem *rna_MetaBall_elements_new(MetaBall *mb, int type)
|
|||||||
|
|
||||||
static void rna_MetaBall_elements_remove(MetaBall *mb, ReportList *reports, PointerRNA *ml_ptr)
|
static void rna_MetaBall_elements_remove(MetaBall *mb, ReportList *reports, PointerRNA *ml_ptr)
|
||||||
{
|
{
|
||||||
MetaElem *ml = ml_ptr->data;
|
MetaElem *ml = static_cast<MetaElem *>(ml_ptr->data);
|
||||||
|
|
||||||
if (BLI_remlink_safe(&mb->elems, ml) == false) {
|
if (BLI_remlink_safe(&mb->elems, ml) == false) {
|
||||||
BKE_reportf(
|
BKE_reportf(
|
||||||
@@ -159,7 +159,7 @@ static bool rna_Meta_is_editmode_get(PointerRNA *ptr)
|
|||||||
static char *rna_MetaElement_path(const PointerRNA *ptr)
|
static char *rna_MetaElement_path(const PointerRNA *ptr)
|
||||||
{
|
{
|
||||||
const MetaBall *mb = (MetaBall *)ptr->owner_id;
|
const MetaBall *mb = (MetaBall *)ptr->owner_id;
|
||||||
const MetaElem *ml = ptr->data;
|
const MetaElem *ml = static_cast<MetaElem *>(ptr->data);
|
||||||
int index = -1;
|
int index = -1;
|
||||||
|
|
||||||
if (mb->editelems) {
|
if (mb->editelems) {
|
||||||
@@ -294,7 +294,7 @@ static void rna_def_metaball_elements(BlenderRNA *brna, PropertyRNA *cprop)
|
|||||||
RNA_def_function_flag(func, FUNC_USE_REPORTS);
|
RNA_def_function_flag(func, FUNC_USE_REPORTS);
|
||||||
parm = RNA_def_pointer(func, "element", "MetaElement", "", "The element to remove");
|
parm = RNA_def_pointer(func, "element", "MetaElement", "", "The element to remove");
|
||||||
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
|
||||||
RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
|
RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, ParameterFlag(0));
|
||||||
|
|
||||||
func = RNA_def_function(srna, "clear", "rna_MetaBall_elements_clear");
|
func = RNA_def_function(srna, "clear", "rna_MetaBall_elements_clear");
|
||||||
RNA_def_function_ui_description(func, "Remove all elements from the metaball");
|
RNA_def_function_ui_description(func, "Remove all elements from the metaball");
|
||||||
@@ -83,7 +83,7 @@ const EnumPropertyItem rna_enum_color_sets_items[] = {
|
|||||||
|
|
||||||
# include "RNA_access.h"
|
# include "RNA_access.h"
|
||||||
|
|
||||||
static void rna_Pose_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
|
static void rna_Pose_update(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
|
||||||
{
|
{
|
||||||
/* XXX when to use this? ob->pose->flag |= (POSE_LOCKED|POSE_DO_UNLOCK); */
|
/* XXX when to use this? ob->pose->flag |= (POSE_LOCKED|POSE_DO_UNLOCK); */
|
||||||
|
|
||||||
@@ -91,7 +91,7 @@ static void rna_Pose_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRN
|
|||||||
WM_main_add_notifier(NC_OBJECT | ND_POSE, ptr->owner_id);
|
WM_main_add_notifier(NC_OBJECT | ND_POSE, ptr->owner_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_Pose_dependency_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
|
static void rna_Pose_dependency_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
|
||||||
{
|
{
|
||||||
DEG_relations_tag_update(bmain);
|
DEG_relations_tag_update(bmain);
|
||||||
|
|
||||||
@@ -99,7 +99,7 @@ static void rna_Pose_dependency_update(Main *bmain, Scene *UNUSED(scene), Pointe
|
|||||||
WM_main_add_notifier(NC_OBJECT | ND_POSE, ptr->owner_id);
|
WM_main_add_notifier(NC_OBJECT | ND_POSE, ptr->owner_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_Pose_IK_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
|
static void rna_Pose_IK_update(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
|
||||||
{
|
{
|
||||||
/* XXX when to use this? ob->pose->flag |= (POSE_LOCKED|POSE_DO_UNLOCK); */
|
/* XXX when to use this? ob->pose->flag |= (POSE_LOCKED|POSE_DO_UNLOCK); */
|
||||||
Object *ob = (Object *)ptr->owner_id;
|
Object *ob = (Object *)ptr->owner_id;
|
||||||
@@ -110,14 +110,14 @@ static void rna_Pose_IK_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Pointe
|
|||||||
BIK_clear_data(ob->pose);
|
BIK_clear_data(ob->pose);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *rna_Pose_path(const PointerRNA *UNUSED(ptr))
|
static char *rna_Pose_path(const PointerRNA * /*ptr*/)
|
||||||
{
|
{
|
||||||
return BLI_strdup("pose");
|
return BLI_strdup("pose");
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *rna_PoseBone_path(const PointerRNA *ptr)
|
static char *rna_PoseBone_path(const PointerRNA *ptr)
|
||||||
{
|
{
|
||||||
const bPoseChannel *pchan = ptr->data;
|
const bPoseChannel *pchan = static_cast<const bPoseChannel *>(ptr->data);
|
||||||
char name_esc[sizeof(pchan->name) * 2];
|
char name_esc[sizeof(pchan->name) * 2];
|
||||||
|
|
||||||
BLI_str_escape(name_esc, pchan->name, sizeof(name_esc));
|
BLI_str_escape(name_esc, pchan->name, sizeof(name_esc));
|
||||||
@@ -153,7 +153,7 @@ static void rna_bone_group_remove(ID *id, bPose *pose, ReportList *reports, Poin
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bActionGroup *grp = grp_ptr->data;
|
bActionGroup *grp = static_cast<bActionGroup *>(grp_ptr->data);
|
||||||
const int grp_idx = BLI_findindex(&pose->agroups, grp);
|
const int grp_idx = BLI_findindex(&pose->agroups, grp);
|
||||||
|
|
||||||
if (grp_idx == -1) {
|
if (grp_idx == -1) {
|
||||||
@@ -174,7 +174,7 @@ void rna_ActionGroup_colorset_set(PointerRNA *ptr, int value)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bActionGroup *grp = ptr->data;
|
bActionGroup *grp = static_cast<bActionGroup *>(ptr->data);
|
||||||
|
|
||||||
/* ensure only valid values get set */
|
/* ensure only valid values get set */
|
||||||
if ((value >= -1) && (value < 21)) {
|
if ((value >= -1) && (value < 21)) {
|
||||||
@@ -187,7 +187,7 @@ void rna_ActionGroup_colorset_set(PointerRNA *ptr, int value)
|
|||||||
|
|
||||||
bool rna_ActionGroup_is_custom_colorset_get(PointerRNA *ptr)
|
bool rna_ActionGroup_is_custom_colorset_get(PointerRNA *ptr)
|
||||||
{
|
{
|
||||||
bActionGroup *grp = ptr->data;
|
bActionGroup *grp = static_cast<bActionGroup *>(ptr->data);
|
||||||
|
|
||||||
return (grp->customCol < 0);
|
return (grp->customCol < 0);
|
||||||
}
|
}
|
||||||
@@ -199,7 +199,7 @@ static void rna_BoneGroup_name_set(PointerRNA *ptr, const char *value)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bActionGroup *agrp = ptr->data;
|
bActionGroup *agrp = static_cast<bActionGroup *>(ptr->data);
|
||||||
|
|
||||||
/* copy the new name into the name slot */
|
/* copy the new name into the name slot */
|
||||||
STRNCPY_UTF8(agrp->name, value);
|
STRNCPY_UTF8(agrp->name, value);
|
||||||
@@ -214,7 +214,7 @@ static void rna_BoneGroup_name_set(PointerRNA *ptr, const char *value)
|
|||||||
|
|
||||||
static IDProperty **rna_PoseBone_idprops(PointerRNA *ptr)
|
static IDProperty **rna_PoseBone_idprops(PointerRNA *ptr)
|
||||||
{
|
{
|
||||||
bPoseChannel *pchan = ptr->data;
|
bPoseChannel *pchan = static_cast<bPoseChannel *>(ptr->data);
|
||||||
return &pchan->prop;
|
return &pchan->prop;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -234,10 +234,10 @@ static void rna_Pose_ik_solver_set(struct PointerRNA *ptr, int value)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_Pose_ik_solver_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
|
static void rna_Pose_ik_solver_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
|
||||||
{
|
{
|
||||||
Object *ob = (Object *)ptr->owner_id;
|
Object *ob = (Object *)ptr->owner_id;
|
||||||
bPose *pose = ptr->data;
|
bPose *pose = static_cast<bPose *>(ptr->data);
|
||||||
|
|
||||||
BKE_pose_tag_recalc(bmain, pose); /* checks & sorts pose channels */
|
BKE_pose_tag_recalc(bmain, pose); /* checks & sorts pose channels */
|
||||||
DEG_relations_tag_update(bmain);
|
DEG_relations_tag_update(bmain);
|
||||||
@@ -252,7 +252,7 @@ static void rna_Pose_ik_solver_update(Main *bmain, Scene *UNUSED(scene), Pointer
|
|||||||
/* rotation - axis-angle */
|
/* rotation - axis-angle */
|
||||||
static void rna_PoseChannel_rotation_axis_angle_get(PointerRNA *ptr, float *value)
|
static void rna_PoseChannel_rotation_axis_angle_get(PointerRNA *ptr, float *value)
|
||||||
{
|
{
|
||||||
bPoseChannel *pchan = ptr->data;
|
bPoseChannel *pchan = static_cast<bPoseChannel *>(ptr->data);
|
||||||
|
|
||||||
/* for now, assume that rotation mode is axis-angle */
|
/* for now, assume that rotation mode is axis-angle */
|
||||||
value[0] = pchan->rotAngle;
|
value[0] = pchan->rotAngle;
|
||||||
@@ -262,7 +262,7 @@ static void rna_PoseChannel_rotation_axis_angle_get(PointerRNA *ptr, float *valu
|
|||||||
/* rotation - axis-angle */
|
/* rotation - axis-angle */
|
||||||
static void rna_PoseChannel_rotation_axis_angle_set(PointerRNA *ptr, const float *value)
|
static void rna_PoseChannel_rotation_axis_angle_set(PointerRNA *ptr, const float *value)
|
||||||
{
|
{
|
||||||
bPoseChannel *pchan = ptr->data;
|
bPoseChannel *pchan = static_cast<bPoseChannel *>(ptr->data);
|
||||||
|
|
||||||
/* for now, assume that rotation mode is axis-angle */
|
/* for now, assume that rotation mode is axis-angle */
|
||||||
pchan->rotAngle = value[0];
|
pchan->rotAngle = value[0];
|
||||||
@@ -273,7 +273,7 @@ static void rna_PoseChannel_rotation_axis_angle_set(PointerRNA *ptr, const float
|
|||||||
|
|
||||||
static void rna_PoseChannel_rotation_mode_set(PointerRNA *ptr, int value)
|
static void rna_PoseChannel_rotation_mode_set(PointerRNA *ptr, int value)
|
||||||
{
|
{
|
||||||
bPoseChannel *pchan = ptr->data;
|
bPoseChannel *pchan = static_cast<bPoseChannel *>(ptr->data);
|
||||||
|
|
||||||
/* use API Method for conversions... */
|
/* use API Method for conversions... */
|
||||||
BKE_rotMode_change_values(
|
BKE_rotMode_change_values(
|
||||||
@@ -285,7 +285,7 @@ static void rna_PoseChannel_rotation_mode_set(PointerRNA *ptr, int value)
|
|||||||
|
|
||||||
static float rna_PoseChannel_length_get(PointerRNA *ptr)
|
static float rna_PoseChannel_length_get(PointerRNA *ptr)
|
||||||
{
|
{
|
||||||
bPoseChannel *pchan = ptr->data;
|
bPoseChannel *pchan = static_cast<bPoseChannel *>(ptr->data);
|
||||||
return len_v3v3(pchan->pose_head, pchan->pose_tail);
|
return len_v3v3(pchan->pose_head, pchan->pose_tail);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -300,12 +300,12 @@ static void rna_PoseChannel_name_set(PointerRNA *ptr, const char *value)
|
|||||||
STRNCPY(oldname, pchan->name);
|
STRNCPY(oldname, pchan->name);
|
||||||
|
|
||||||
BLI_assert(BKE_id_is_in_global_main(&ob->id));
|
BLI_assert(BKE_id_is_in_global_main(&ob->id));
|
||||||
BLI_assert(BKE_id_is_in_global_main(ob->data));
|
BLI_assert(BKE_id_is_in_global_main(static_cast<ID *>(ob->data)));
|
||||||
ED_armature_bone_rename(G_MAIN, ob->data, oldname, newname);
|
ED_armature_bone_rename(G_MAIN, static_cast<bArmature *>(ob->data), oldname, newname);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* See rna_Bone_update_renamed() */
|
/* See rna_Bone_update_renamed() */
|
||||||
static void rna_PoseChannel_name_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
|
static void rna_PoseChannel_name_update(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
|
||||||
{
|
{
|
||||||
ID *id = ptr->owner_id;
|
ID *id = ptr->owner_id;
|
||||||
|
|
||||||
@@ -323,7 +323,7 @@ static PointerRNA rna_PoseChannel_bone_get(PointerRNA *ptr)
|
|||||||
PointerRNA tmp_ptr = *ptr;
|
PointerRNA tmp_ptr = *ptr;
|
||||||
|
|
||||||
/* Replace the id_data pointer with the Armature ID. */
|
/* Replace the id_data pointer with the Armature ID. */
|
||||||
tmp_ptr.owner_id = ob->data;
|
tmp_ptr.owner_id = static_cast<ID *>(ob->data);
|
||||||
|
|
||||||
return rna_pointer_inherit_refine(&tmp_ptr, &RNA_Bone, pchan->bone);
|
return rna_pointer_inherit_refine(&tmp_ptr, &RNA_Bone, pchan->bone);
|
||||||
}
|
}
|
||||||
@@ -366,10 +366,10 @@ static StructRNA *rna_Pose_ikparam_typef(PointerRNA *ptr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_Itasc_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
|
static void rna_Itasc_update(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
|
||||||
{
|
{
|
||||||
Object *ob = (Object *)ptr->owner_id;
|
Object *ob = (Object *)ptr->owner_id;
|
||||||
bItasc *itasc = ptr->data;
|
bItasc *itasc = static_cast<bItasc *>(ptr->data);
|
||||||
|
|
||||||
/* verify values */
|
/* verify values */
|
||||||
if (itasc->precision < 0.0001f) {
|
if (itasc->precision < 0.0001f) {
|
||||||
@@ -415,7 +415,7 @@ static PointerRNA rna_PoseChannel_bone_group_get(PointerRNA *ptr)
|
|||||||
bActionGroup *grp;
|
bActionGroup *grp;
|
||||||
|
|
||||||
if (pose) {
|
if (pose) {
|
||||||
grp = BLI_findlink(&pose->agroups, pchan->agrp_index - 1);
|
grp = static_cast<bActionGroup *>(BLI_findlink(&pose->agroups, pchan->agrp_index - 1));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
grp = NULL;
|
grp = NULL;
|
||||||
@@ -426,7 +426,7 @@ static PointerRNA rna_PoseChannel_bone_group_get(PointerRNA *ptr)
|
|||||||
|
|
||||||
static void rna_PoseChannel_bone_group_set(PointerRNA *ptr,
|
static void rna_PoseChannel_bone_group_set(PointerRNA *ptr,
|
||||||
PointerRNA value,
|
PointerRNA value,
|
||||||
struct ReportList *UNUSED(reports))
|
struct ReportList * /*reports*/)
|
||||||
{
|
{
|
||||||
Object *ob = (Object *)ptr->owner_id;
|
Object *ob = (Object *)ptr->owner_id;
|
||||||
bPose *pose = (ob) ? ob->pose : NULL;
|
bPose *pose = (ob) ? ob->pose : NULL;
|
||||||
@@ -453,7 +453,7 @@ static void rna_PoseChannel_bone_group_index_set(PointerRNA *ptr, int value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void rna_PoseChannel_bone_group_index_range(
|
static void rna_PoseChannel_bone_group_index_range(
|
||||||
PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
|
PointerRNA *ptr, int *min, int *max, int * /*softmin*/, int * /*softmax*/)
|
||||||
{
|
{
|
||||||
Object *ob = (Object *)ptr->owner_id;
|
Object *ob = (Object *)ptr->owner_id;
|
||||||
bPose *pose = (ob) ? ob->pose : NULL;
|
bPose *pose = (ob) ? ob->pose : NULL;
|
||||||
@@ -471,7 +471,7 @@ static PointerRNA rna_Pose_active_bone_group_get(PointerRNA *ptr)
|
|||||||
|
|
||||||
static void rna_Pose_active_bone_group_set(PointerRNA *ptr,
|
static void rna_Pose_active_bone_group_set(PointerRNA *ptr,
|
||||||
PointerRNA value,
|
PointerRNA value,
|
||||||
struct ReportList *UNUSED(reports))
|
struct ReportList * /*reports*/)
|
||||||
{
|
{
|
||||||
bPose *pose = (bPose *)ptr->data;
|
bPose *pose = (bPose *)ptr->data;
|
||||||
pose->active_group = BLI_findindex(&pose->agroups, value.data) + 1;
|
pose->active_group = BLI_findindex(&pose->agroups, value.data) + 1;
|
||||||
@@ -490,7 +490,7 @@ static void rna_Pose_active_bone_group_index_set(PointerRNA *ptr, int value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void rna_Pose_active_bone_group_index_range(
|
static void rna_Pose_active_bone_group_index_range(
|
||||||
PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
|
PointerRNA *ptr, int *min, int *max, int * /*softmin*/, int * /*softmax*/)
|
||||||
{
|
{
|
||||||
bPose *pose = (bPose *)ptr->data;
|
bPose *pose = (bPose *)ptr->data;
|
||||||
|
|
||||||
@@ -567,7 +567,7 @@ static PointerRNA rna_PoseChannel_active_constraint_get(PointerRNA *ptr)
|
|||||||
|
|
||||||
static void rna_PoseChannel_active_constraint_set(PointerRNA *ptr,
|
static void rna_PoseChannel_active_constraint_set(PointerRNA *ptr,
|
||||||
PointerRNA value,
|
PointerRNA value,
|
||||||
struct ReportList *UNUSED(reports))
|
struct ReportList * /*reports*/)
|
||||||
{
|
{
|
||||||
bPoseChannel *pchan = (bPoseChannel *)ptr->data;
|
bPoseChannel *pchan = (bPoseChannel *)ptr->data;
|
||||||
BKE_constraints_active_set(&pchan->constraints, (bConstraint *)value.data);
|
BKE_constraints_active_set(&pchan->constraints, (bConstraint *)value.data);
|
||||||
@@ -590,7 +590,7 @@ static bConstraint *rna_PoseChannel_constraints_new(ID *id,
|
|||||||
static void rna_PoseChannel_constraints_remove(
|
static void rna_PoseChannel_constraints_remove(
|
||||||
ID *id, bPoseChannel *pchan, Main *bmain, ReportList *reports, PointerRNA *con_ptr)
|
ID *id, bPoseChannel *pchan, Main *bmain, ReportList *reports, PointerRNA *con_ptr)
|
||||||
{
|
{
|
||||||
bConstraint *con = con_ptr->data;
|
bConstraint *con = static_cast<bConstraint *>(con_ptr->data);
|
||||||
const bool is_ik = ELEM(con->type, CONSTRAINT_TYPE_KINEMATIC, CONSTRAINT_TYPE_SPLINEIK);
|
const bool is_ik = ELEM(con->type, CONSTRAINT_TYPE_KINEMATIC, CONSTRAINT_TYPE_SPLINEIK);
|
||||||
Object *ob = (Object *)id;
|
Object *ob = (Object *)id;
|
||||||
|
|
||||||
@@ -639,7 +639,7 @@ static bConstraint *rna_PoseChannel_constraints_copy(ID *id,
|
|||||||
PointerRNA *con_ptr)
|
PointerRNA *con_ptr)
|
||||||
{
|
{
|
||||||
Object *ob = (Object *)id;
|
Object *ob = (Object *)id;
|
||||||
bConstraint *con = con_ptr->data;
|
bConstraint *con = static_cast<bConstraint *>(con_ptr->data);
|
||||||
bConstraint *new_con = BKE_constraint_copy_for_pose(ob, pchan, con);
|
bConstraint *new_con = BKE_constraint_copy_for_pose(ob, pchan, con);
|
||||||
new_con->flag |= CONSTRAINT_OVERRIDE_LIBRARY_LOCAL;
|
new_con->flag |= CONSTRAINT_OVERRIDE_LIBRARY_LOCAL;
|
||||||
|
|
||||||
@@ -652,16 +652,16 @@ static bConstraint *rna_PoseChannel_constraints_copy(ID *id,
|
|||||||
bool rna_PoseChannel_constraints_override_apply(Main *bmain,
|
bool rna_PoseChannel_constraints_override_apply(Main *bmain,
|
||||||
PointerRNA *ptr_dst,
|
PointerRNA *ptr_dst,
|
||||||
PointerRNA *ptr_src,
|
PointerRNA *ptr_src,
|
||||||
PointerRNA *UNUSED(ptr_storage),
|
PointerRNA * /*ptr_storage*/,
|
||||||
PropertyRNA *prop_dst,
|
PropertyRNA *prop_dst,
|
||||||
PropertyRNA *UNUSED(prop_src),
|
PropertyRNA * /*prop_src*/,
|
||||||
PropertyRNA *UNUSED(prop_storage),
|
PropertyRNA * /*prop_storage*/,
|
||||||
const int UNUSED(len_dst),
|
const int /*len_dst*/,
|
||||||
const int UNUSED(len_src),
|
const int /*len_src*/,
|
||||||
const int UNUSED(len_storage),
|
const int /*len_storage*/,
|
||||||
PointerRNA *UNUSED(ptr_item_dst),
|
PointerRNA * /*ptr_item_dst*/,
|
||||||
PointerRNA *UNUSED(ptr_item_src),
|
PointerRNA * /*ptr_item_src*/,
|
||||||
PointerRNA *UNUSED(ptr_item_storage),
|
PointerRNA * /*ptr_item_storage*/,
|
||||||
IDOverrideLibraryPropertyOperation *opop)
|
IDOverrideLibraryPropertyOperation *opop)
|
||||||
{
|
{
|
||||||
BLI_assert(opop->operation == LIBOVERRIDE_OP_INSERT_AFTER &&
|
BLI_assert(opop->operation == LIBOVERRIDE_OP_INSERT_AFTER &&
|
||||||
@@ -674,14 +674,15 @@ bool rna_PoseChannel_constraints_override_apply(Main *bmain,
|
|||||||
* even if we insert several items in a row, we always insert first one, then second one, etc.
|
* even if we insert several items in a row, we always insert first one, then second one, etc.
|
||||||
* So we should always find 'anchor' constraint in both _src *and* _dst */
|
* So we should always find 'anchor' constraint in both _src *and* _dst */
|
||||||
const size_t name_offset = offsetof(bConstraint, name);
|
const size_t name_offset = offsetof(bConstraint, name);
|
||||||
bConstraint *con_anchor = BLI_listbase_string_or_index_find(&pchan_dst->constraints,
|
bConstraint *con_anchor = static_cast<bConstraint *>(
|
||||||
opop->subitem_reference_name,
|
BLI_listbase_string_or_index_find(&pchan_dst->constraints,
|
||||||
name_offset,
|
opop->subitem_reference_name,
|
||||||
opop->subitem_reference_index);
|
name_offset,
|
||||||
|
opop->subitem_reference_index));
|
||||||
/* If `con_anchor` is NULL, `con_src` will be inserted in first position. */
|
/* If `con_anchor` is NULL, `con_src` will be inserted in first position. */
|
||||||
|
|
||||||
bConstraint *con_src = BLI_listbase_string_or_index_find(
|
bConstraint *con_src = static_cast<bConstraint *>(BLI_listbase_string_or_index_find(
|
||||||
&pchan_src->constraints, opop->subitem_local_name, name_offset, opop->subitem_local_index);
|
&pchan_src->constraints, opop->subitem_local_name, name_offset, opop->subitem_local_index));
|
||||||
|
|
||||||
if (con_src == NULL) {
|
if (con_src == NULL) {
|
||||||
BLI_assert(con_src != NULL);
|
BLI_assert(con_src != NULL);
|
||||||
@@ -703,7 +704,7 @@ bool rna_PoseChannel_constraints_override_apply(Main *bmain,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rna_PoseChannel_proxy_editable(PointerRNA *UNUSED(ptr), const char **UNUSED(r_info))
|
static int rna_PoseChannel_proxy_editable(PointerRNA * /*ptr*/, const char ** /*r_info*/)
|
||||||
{
|
{
|
||||||
# if 0
|
# if 0
|
||||||
Object *ob = (Object *)ptr->owner_id;
|
Object *ob = (Object *)ptr->owner_id;
|
||||||
@@ -853,12 +854,13 @@ static bPoseChannel *rna_PoseChannel_ensure_own_pchan(Object *ob,
|
|||||||
|
|
||||||
static void rna_PoseChannel_custom_shape_transform_set(PointerRNA *ptr,
|
static void rna_PoseChannel_custom_shape_transform_set(PointerRNA *ptr,
|
||||||
PointerRNA value,
|
PointerRNA value,
|
||||||
struct ReportList *UNUSED(reports))
|
struct ReportList * /*reports*/)
|
||||||
{
|
{
|
||||||
bPoseChannel *pchan = (bPoseChannel *)ptr->data;
|
bPoseChannel *pchan = (bPoseChannel *)ptr->data;
|
||||||
Object *ob = (Object *)ptr->owner_id;
|
Object *ob = (Object *)ptr->owner_id;
|
||||||
|
|
||||||
pchan->custom_tx = rna_PoseChannel_ensure_own_pchan(ob, (Object *)value.owner_id, value.data);
|
pchan->custom_tx = static_cast<bPoseChannel *>(rna_PoseChannel_ensure_own_pchan(
|
||||||
|
ob, (Object *)value.owner_id, static_cast<bPoseChannel *>(value.data)));
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
@@ -962,7 +964,7 @@ static void rna_def_pose_channel_constraints(BlenderRNA *brna, PropertyRNA *cpro
|
|||||||
/* constraint to add */
|
/* constraint to add */
|
||||||
parm = RNA_def_enum(
|
parm = RNA_def_enum(
|
||||||
func, "type", rna_enum_constraint_type_items, 1, "", "Constraint type to add");
|
func, "type", rna_enum_constraint_type_items, 1, "", "Constraint type to add");
|
||||||
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
RNA_def_parameter_flags(parm, PropertyFlag(0), PARM_REQUIRED);
|
||||||
|
|
||||||
func = RNA_def_function(srna, "remove", "rna_PoseChannel_constraints_remove");
|
func = RNA_def_function(srna, "remove", "rna_PoseChannel_constraints_remove");
|
||||||
RNA_def_function_ui_description(func, "Remove a constraint from this object");
|
RNA_def_function_ui_description(func, "Remove a constraint from this object");
|
||||||
@@ -971,16 +973,16 @@ static void rna_def_pose_channel_constraints(BlenderRNA *brna, PropertyRNA *cpro
|
|||||||
/* constraint to remove */
|
/* constraint to remove */
|
||||||
parm = RNA_def_pointer(func, "constraint", "Constraint", "", "Removed constraint");
|
parm = RNA_def_pointer(func, "constraint", "Constraint", "", "Removed constraint");
|
||||||
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
|
||||||
RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
|
RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, ParameterFlag(0));
|
||||||
|
|
||||||
func = RNA_def_function(srna, "move", "rna_PoseChannel_constraints_move");
|
func = RNA_def_function(srna, "move", "rna_PoseChannel_constraints_move");
|
||||||
RNA_def_function_ui_description(func, "Move a constraint to a different position");
|
RNA_def_function_ui_description(func, "Move a constraint to a different position");
|
||||||
RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN | FUNC_USE_REPORTS);
|
RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN | FUNC_USE_REPORTS);
|
||||||
parm = RNA_def_int(
|
parm = RNA_def_int(
|
||||||
func, "from_index", -1, INT_MIN, INT_MAX, "From Index", "Index to move", 0, 10000);
|
func, "from_index", -1, INT_MIN, INT_MAX, "From Index", "Index to move", 0, 10000);
|
||||||
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
RNA_def_parameter_flags(parm, PropertyFlag(0), PARM_REQUIRED);
|
||||||
parm = RNA_def_int(func, "to_index", -1, INT_MIN, INT_MAX, "To Index", "Target index", 0, 10000);
|
parm = RNA_def_int(func, "to_index", -1, INT_MIN, INT_MAX, "To Index", "Target index", 0, 10000);
|
||||||
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
RNA_def_parameter_flags(parm, PropertyFlag(0), PARM_REQUIRED);
|
||||||
|
|
||||||
func = RNA_def_function(srna, "copy", "rna_PoseChannel_constraints_copy");
|
func = RNA_def_function(srna, "copy", "rna_PoseChannel_constraints_copy");
|
||||||
RNA_def_function_ui_description(func, "Add a new constraint that is a copy of the given one");
|
RNA_def_function_ui_description(func, "Add a new constraint that is a copy of the given one");
|
||||||
@@ -992,7 +994,7 @@ static void rna_def_pose_channel_constraints(BlenderRNA *brna, PropertyRNA *cpro
|
|||||||
"",
|
"",
|
||||||
"Constraint to copy - may belong to a different object");
|
"Constraint to copy - may belong to a different object");
|
||||||
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
|
||||||
RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
|
RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, ParameterFlag(0));
|
||||||
/* return type */
|
/* return type */
|
||||||
parm = RNA_def_pointer(func, "new_constraint", "Constraint", "", "New constraint");
|
parm = RNA_def_pointer(func, "new_constraint", "Constraint", "", "New constraint");
|
||||||
RNA_def_function_return(func, parm);
|
RNA_def_function_return(func, parm);
|
||||||
@@ -1645,7 +1647,7 @@ static void rna_def_bone_groups(BlenderRNA *brna, PropertyRNA *cprop)
|
|||||||
/* bone group to remove */
|
/* bone group to remove */
|
||||||
parm = RNA_def_pointer(func, "group", "BoneGroup", "", "Removed bone group");
|
parm = RNA_def_pointer(func, "group", "BoneGroup", "", "Removed bone group");
|
||||||
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
|
||||||
RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
|
RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, ParameterFlag(0));
|
||||||
|
|
||||||
prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
|
prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
|
||||||
RNA_def_property_struct_type(prop, "BoneGroup");
|
RNA_def_property_struct_type(prop, "BoneGroup");
|
||||||
Reference in New Issue
Block a user