new rna api call: RNA_struct_idprops_unset(op->ptr, "someprop"), added to allow un...
[blender-staging.git] / source / blender / makesrna / intern / rna_access.c
index cd9b23da5d3dc7162f01fcb832ba97070aebf5a4..03622ec756fe75d137f112bb7c7befb42c6cd049 100644 (file)
@@ -521,6 +521,24 @@ int RNA_struct_idprops_register_check(StructRNA *type)
        return (type->flag & STRUCT_NO_IDPROPERTIES) == 0;
 }
 
+/* remove an id-property */
+int RNA_struct_idprops_unset(PointerRNA *ptr, const char *identifier)
+{
+       IDProperty *group= RNA_struct_idprops(ptr, 0);
+
+       if(group) {
+               IDProperty *idp= IDP_GetPropertyFromGroup(group, identifier);
+               if(idp) {
+                       IDP_RemFromGroup(group, idp);
+                       IDP_FreeProperty(idp);
+                       MEM_freeN(idp);
+
+                       return 1;
+               }
+       }
+       return 0;
+}
+
 int RNA_struct_is_a(StructRNA *type, StructRNA *srna)
 {
        StructRNA *base;