forked from bartvdbraak/blender
RNA & interface functions for checking if RNA in a button uses valid rna property (not currently used).
This commit is contained in:
parent
0c9488b2f3
commit
b3d70cbcba
@ -1211,6 +1211,17 @@ int ui_is_but_unit(uiBut *but)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int ui_is_but_rna_valid(uiBut *but)
|
||||
{
|
||||
if (but->rnaprop==NULL || RNA_struct_contains_property(&but->rnapoin, but->rnaprop)) {
|
||||
return TRUE;
|
||||
}
|
||||
else {
|
||||
printf("property removed %s: %p\n", but->drawstr, but->rnaprop);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
double ui_get_but_val(uiBut *but)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
|
@ -376,6 +376,7 @@ extern void ui_set_but_soft_range(uiBut *but, double value);
|
||||
extern void ui_check_but(uiBut *but);
|
||||
extern int ui_is_but_float(uiBut *but);
|
||||
extern int ui_is_but_unit(uiBut *but);
|
||||
extern int ui_is_but_rna_valid(uiBut *but);
|
||||
|
||||
extern void ui_bounds_block(uiBlock *block);
|
||||
extern void ui_block_translate(uiBlock *block, int x, int y);
|
||||
|
@ -621,6 +621,7 @@ int RNA_struct_idprops_register_check(StructRNA *type);
|
||||
|
||||
|
||||
PropertyRNA *RNA_struct_find_property(PointerRNA *ptr, const char *identifier);
|
||||
int RNA_struct_contains_property(PointerRNA *ptr, PropertyRNA *prop_test);
|
||||
|
||||
/* lower level functions for access to type properties */
|
||||
const struct ListBase *RNA_struct_type_properties(StructRNA *srna);
|
||||
|
@ -574,6 +574,28 @@ PropertyRNA *RNA_struct_find_nested(PointerRNA *ptr, StructRNA *srna)
|
||||
return prop;
|
||||
}
|
||||
|
||||
int RNA_struct_contains_property(PointerRNA *ptr, PropertyRNA *prop_test)
|
||||
{
|
||||
/* note, prop_test could be freed memory, only use for comparison */
|
||||
|
||||
/* validate the RNA is ok */
|
||||
PropertyRNA *iterprop;
|
||||
int found= FALSE;
|
||||
|
||||
iterprop= RNA_struct_iterator_property(ptr->type);
|
||||
|
||||
RNA_PROP_BEGIN(ptr, itemptr, iterprop) {
|
||||
/* PropertyRNA *prop= itemptr.data; */
|
||||
if(prop_test == (PropertyRNA *)itemptr.data) {
|
||||
found= TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
RNA_PROP_END;
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
/* low level direct access to type->properties, note this ignores parent classes so should be used with care */
|
||||
const struct ListBase *RNA_struct_type_properties(StructRNA *srna)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user