RNA:
* Added support for using pointers + collections as operator properties,
but with the restriction that they must point to other type derived from
ID property groups. The "add" function for these properties will allocate
a new ID property group and point to that.
* Added support for arrays with type IDP_GROUP in ID properties.
* Fix bug getting/setting float array values.
Example code for collections, note the "OperatorMousePath" type is defined
in rna_wm.c and has a float[2] property named "loc".
Defining the operator property:
prop= RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_runtime(prop, &RNA_OperatorMousePath);
Adding values:
PointerRNA itemptr;
float loc[2] = {1, 1},
RNA_collection_add(op->ptr, "path", &itemptr);
RNA_float_set_array(&itemptr, "loc", loc);
Iterating:
RNA_BEGIN(op->ptr, itemptr, "path") {
float loc[2];
RNA_float_get_array(&itemptr, "loc", loc);
printf("Location: %f %f\n", loc[0], loc[1]);
}
RNA_END;
This commit is contained in:
@@ -110,7 +110,6 @@ static void rna_def_ID_properties(BlenderRNA *brna)
|
||||
srna= RNA_def_struct(brna, "IDProperty", NULL);
|
||||
RNA_def_struct_ui_text(srna, "ID Property", "stores arbitrary properties");
|
||||
|
||||
|
||||
/* IDP_STRING */
|
||||
prop= RNA_def_property(srna, "string", PROP_STRING, PROP_NONE);
|
||||
RNA_def_property_flag(prop, PROP_EXPORT|PROP_IDPROPERTY);
|
||||
@@ -144,6 +143,10 @@ static void rna_def_ID_properties(BlenderRNA *brna)
|
||||
RNA_def_property_flag(prop, PROP_EXPORT|PROP_NOT_EDITABLE|PROP_IDPROPERTY);
|
||||
RNA_def_property_struct_type(prop, "IDPropertyGroup");
|
||||
|
||||
prop= RNA_def_property(srna, "collection", PROP_COLLECTION, PROP_NONE);
|
||||
RNA_def_property_flag(prop, PROP_EXPORT|PROP_IDPROPERTY);
|
||||
RNA_def_property_struct_type(prop, "IDPropertyGroup");
|
||||
|
||||
/* IDP_ID -- not implemented yet in id properties */
|
||||
|
||||
/* ID property groups > level 0, since level 0 group is merged
|
||||
|
||||
Reference in New Issue
Block a user