Cleanup: replace an integer array with booleans for RNA type validation
This commit is contained in:
@@ -735,7 +735,7 @@ typedef enum StructFlag {
|
||||
STRUCT_NO_CONTEXT_WITHOUT_OWNER_ID = (1 << 11),
|
||||
} StructFlag;
|
||||
|
||||
typedef int (*StructValidateFunc)(struct PointerRNA *ptr, void *data, int *have_function);
|
||||
typedef int (*StructValidateFunc)(struct PointerRNA *ptr, void *data, bool *have_function);
|
||||
typedef int (*StructCallbackFunc)(struct bContext *C,
|
||||
struct PointerRNA *ptr,
|
||||
struct FunctionRNA *func,
|
||||
|
||||
@@ -286,7 +286,7 @@ static StructRNA *rna_KeyingSetInfo_register(Main *bmain,
|
||||
KeyingSetInfo dummy_ksi = {NULL};
|
||||
KeyingSetInfo *ksi;
|
||||
PointerRNA dummy_ksi_ptr = {NULL};
|
||||
int have_function[3];
|
||||
bool have_function[3];
|
||||
|
||||
/* setup dummy type info to store static properties in */
|
||||
/* TODO: perhaps we want to get users to register
|
||||
|
||||
@@ -1076,7 +1076,7 @@ static StructRNA *rna_NodeTree_register(Main *bmain,
|
||||
bNodeTreeType *nt, dummy_nt;
|
||||
bNodeTree dummy_ntree;
|
||||
PointerRNA dummy_ntree_ptr;
|
||||
int have_function[4];
|
||||
bool have_function[4];
|
||||
|
||||
/* setup dummy tree & tree type to store static properties in */
|
||||
memset(&dummy_nt, 0, sizeof(bNodeTreeType));
|
||||
@@ -1933,7 +1933,7 @@ static bNodeType *rna_Node_register_base(Main *bmain,
|
||||
PointerRNA dummy_node_ptr;
|
||||
FunctionRNA *func;
|
||||
PropertyRNA *parm;
|
||||
int have_function[10];
|
||||
bool have_function[10];
|
||||
|
||||
/* setup dummy node & node type to store static properties in */
|
||||
memset(&dummy_nt, 0, sizeof(bNodeType));
|
||||
@@ -2777,7 +2777,7 @@ static StructRNA *rna_NodeSocket_register(Main *UNUSED(bmain),
|
||||
bNodeSocketType *st, dummy_st;
|
||||
bNodeSocket dummy_sock;
|
||||
PointerRNA dummy_sock_ptr;
|
||||
int have_function[2];
|
||||
bool have_function[2];
|
||||
|
||||
/* setup dummy socket & socket type to store static properties in */
|
||||
memset(&dummy_st, 0, sizeof(bNodeSocketType));
|
||||
@@ -3070,7 +3070,7 @@ static StructRNA *rna_NodeSocketInterface_register(Main *UNUSED(bmain),
|
||||
bNodeSocketType *st, dummy_st;
|
||||
bNodeSocket dummy_sock;
|
||||
PointerRNA dummy_sock_ptr;
|
||||
int have_function[4];
|
||||
bool have_function[4];
|
||||
|
||||
/* setup dummy socket & socket type to store static properties in */
|
||||
memset(&dummy_st, 0, sizeof(bNodeSocketType));
|
||||
|
||||
@@ -337,7 +337,7 @@ static StructRNA *rna_RenderEngine_register(Main *bmain,
|
||||
RenderEngineType *et, dummy_et = {NULL};
|
||||
RenderEngine dummy_engine = {NULL};
|
||||
PointerRNA dummy_engine_ptr;
|
||||
int have_function[9];
|
||||
bool have_function[9];
|
||||
|
||||
/* setup dummy engine & engine type to store static properties in */
|
||||
dummy_engine.type = &dummy_et;
|
||||
|
||||
@@ -248,7 +248,7 @@ static StructRNA *rna_Panel_register(Main *bmain,
|
||||
PanelType *pt, *parent = NULL, dummy_pt = {NULL};
|
||||
Panel dummy_panel = {NULL};
|
||||
PointerRNA dummy_panel_ptr;
|
||||
int have_function[4];
|
||||
bool have_function[4];
|
||||
size_t over_alloc = 0; /* Warning, if this becomes a mess, we better do another allocation. */
|
||||
char _panel_descr[RNA_DYN_DESCR_MAX];
|
||||
size_t description_size = 0;
|
||||
@@ -689,7 +689,7 @@ static StructRNA *rna_UIList_register(Main *bmain,
|
||||
uiListType *ult, dummy_ult = {NULL};
|
||||
uiList dummy_uilist = {NULL};
|
||||
PointerRNA dummy_ul_ptr;
|
||||
int have_function[3];
|
||||
bool have_function[3];
|
||||
size_t over_alloc = 0; /* Warning, if this becomes a mess, we better do another allocation. */
|
||||
|
||||
/* setup dummy menu & menu type to store static properties in */
|
||||
@@ -817,7 +817,7 @@ static StructRNA *rna_Header_register(Main *bmain,
|
||||
HeaderType *ht, dummy_ht = {NULL};
|
||||
Header dummy_header = {NULL};
|
||||
PointerRNA dummy_header_ptr;
|
||||
int have_function[1];
|
||||
bool have_function[1];
|
||||
|
||||
/* setup dummy header & header type to store static properties in */
|
||||
dummy_header.type = &dummy_ht;
|
||||
@@ -967,7 +967,7 @@ static StructRNA *rna_Menu_register(Main *bmain,
|
||||
MenuType *mt, dummy_mt = {NULL};
|
||||
Menu dummy_menu = {NULL};
|
||||
PointerRNA dummy_menu_ptr;
|
||||
int have_function[2];
|
||||
bool have_function[2];
|
||||
size_t over_alloc = 0; /* Warning, if this becomes a mess, we better do another allocation. */
|
||||
size_t description_size = 0;
|
||||
char _menu_descr[RNA_DYN_DESCR_MAX];
|
||||
|
||||
@@ -822,7 +822,7 @@ static StructRNA *rna_AddonPref_register(Main *bmain,
|
||||
bAddonPrefType *apt, dummy_apt = {{'\0'}};
|
||||
bAddon dummy_addon = {NULL};
|
||||
PointerRNA dummy_addon_ptr;
|
||||
// int have_function[1];
|
||||
// bool have_function[1];
|
||||
|
||||
/* Setup dummy add-on preference and it's type to store static properties in. */
|
||||
RNA_pointer_create(NULL, &RNA_AddonPreferences, &dummy_addon, &dummy_addon_ptr);
|
||||
|
||||
@@ -1142,7 +1142,7 @@ static StructRNA *rna_wmKeyConfigPref_register(Main *bmain,
|
||||
wmKeyConfigPrefType_Runtime *kpt_rt, dummy_kpt_rt = {{'\0'}};
|
||||
wmKeyConfigPref dummy_kpt = {NULL};
|
||||
PointerRNA dummy_kpt_ptr;
|
||||
// int have_function[1];
|
||||
// bool have_function[1];
|
||||
|
||||
/* setup dummy keyconf-prefs & keyconf-prefs type to store static properties in */
|
||||
RNA_pointer_create(NULL, &RNA_KeyConfigPreferences, &dummy_kpt, &dummy_kpt_ptr);
|
||||
@@ -1488,7 +1488,7 @@ static StructRNA *rna_Operator_register(Main *bmain,
|
||||
wmOperatorType dummy_ot = {NULL};
|
||||
wmOperator dummy_operator = {NULL};
|
||||
PointerRNA dummy_operator_ptr;
|
||||
int have_function[8];
|
||||
bool have_function[8];
|
||||
|
||||
struct {
|
||||
char idname[OP_MAX_TYPENAME];
|
||||
@@ -1654,7 +1654,7 @@ static StructRNA *rna_MacroOperator_register(Main *bmain,
|
||||
wmOperatorType dummy_ot = {NULL};
|
||||
wmOperator dummy_operator = {NULL};
|
||||
PointerRNA dummy_operator_ptr;
|
||||
int have_function[4];
|
||||
bool have_function[4];
|
||||
|
||||
struct {
|
||||
char idname[OP_MAX_TYPENAME];
|
||||
|
||||
@@ -436,7 +436,7 @@ static StructRNA *rna_Gizmo_register(Main *bmain,
|
||||
PointerRNA dummy_gizmo_ptr;
|
||||
|
||||
/* Two sets of functions. */
|
||||
int have_function[8];
|
||||
bool have_function[8];
|
||||
|
||||
/* setup dummy gizmo & gizmo type to store static properties in */
|
||||
dummy_gizmo.type = &dummy_gt;
|
||||
@@ -818,7 +818,7 @@ static StructRNA *rna_GizmoGroup_register(Main *bmain,
|
||||
PointerRNA wgptr;
|
||||
|
||||
/* Two sets of functions. */
|
||||
int have_function[6];
|
||||
bool have_function[6];
|
||||
|
||||
/* setup dummy gizmogroup & gizmogroup type to store static properties in */
|
||||
dummy_gizmo_group.type = &dummy_wgt;
|
||||
|
||||
@@ -8096,7 +8096,7 @@ static int rna_function_arg_count(FunctionRNA *func, int *min_count)
|
||||
static int bpy_class_validate_recursive(PointerRNA *dummy_ptr,
|
||||
StructRNA *srna,
|
||||
void *py_data,
|
||||
int *have_function)
|
||||
bool *have_function)
|
||||
{
|
||||
const ListBase *lb;
|
||||
Link *link;
|
||||
@@ -8298,7 +8298,7 @@ static int bpy_class_validate_recursive(PointerRNA *dummy_ptr,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bpy_class_validate(PointerRNA *dummy_ptr, void *py_data, int *have_function)
|
||||
static int bpy_class_validate(PointerRNA *dummy_ptr, void *py_data, bool *have_function)
|
||||
{
|
||||
return bpy_class_validate_recursive(dummy_ptr, dummy_ptr->type, py_data, have_function);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user