add RNA_property_is_set function, use for WM_menu_invoke to avoid double lookup and...
[blender.git] / source / blender / makesrna / intern / rna_access.c
index 41641af6514f2623d19fe431eb1e7652c63a15f3..ddd0fa1434c4a6e71a6a7889b07c520f3a97f992 100644 (file)
@@ -4412,15 +4412,22 @@ int RNA_collection_length(PointerRNA *ptr, const char *name)
        }
 }
 
-int RNA_struct_property_is_set(PointerRNA *ptr, const char *name)
+int RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop)
 {
-       PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+       if(prop->flag & PROP_IDPROPERTY) {
+               return (rna_idproperty_find(ptr, prop->identifier) != NULL);
+       }
+       else {
+               return 1;
+       }
+}
+
+int RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier)
+{
+       PropertyRNA *prop= RNA_struct_find_property(ptr, identifier);
 
        if(prop) {
-               if(prop->flag & PROP_IDPROPERTY)
-                       return (rna_idproperty_find(ptr, name) != NULL);
-               else
-                       return 1;
+               return RNA_property_is_set(ptr, prop);
        }
        else {
                /* python raises an error */