access mesh string data layer as bytes since this is low level data storage

This commit is contained in:
Campbell Barton
2011-11-15 14:01:24 +00:00
parent 3ecb7b951e
commit 205b554bef
2 changed files with 12 additions and 3 deletions

View File

@@ -524,7 +524,11 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr
}
else {
const PropertySubType subtype= prop->subtype;
const char *string_copy_func= (subtype==PROP_FILEPATH || subtype==PROP_DIRPATH || subtype==PROP_FILENAME) ? "BLI_strncpy" : "BLI_strncpy_utf8";
const char *string_copy_func= (subtype==PROP_FILEPATH ||
subtype==PROP_DIRPATH ||
subtype==PROP_FILENAME ||
subtype==PROP_BYTESTRING) ?
"BLI_strncpy" : "BLI_strncpy_utf8";
rna_print_data_get(f, dp);
if(sprop->maxlength)
@@ -739,7 +743,11 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr
}
else {
const PropertySubType subtype= prop->subtype;
const char *string_copy_func= (subtype==PROP_FILEPATH || subtype==PROP_DIRPATH || subtype==PROP_FILENAME) ? "BLI_strncpy" : "BLI_strncpy_utf8";
const char *string_copy_func= (subtype==PROP_FILEPATH ||
subtype==PROP_DIRPATH ||
subtype==PROP_FILENAME ||
subtype==PROP_BYTESTRING) ?
"BLI_strncpy" : "BLI_strncpy_utf8";
rna_print_data_get(f, dp);
if(sprop->maxlength)

View File

@@ -1675,7 +1675,8 @@ static void rna_def_mproperties(BlenderRNA *brna)
RNA_def_struct_ui_text(srna, "Mesh String Property", "User defined string text value in a string properties layer");
RNA_def_struct_path_func(srna, "rna_MeshStringProperty_path");
prop= RNA_def_property(srna, "value", PROP_STRING, PROP_NONE);
/* low level mesh data access, treat as bytes */
prop= RNA_def_property(srna, "value", PROP_STRING, PROP_BYTESTRING);
RNA_def_property_string_sdna(prop, NULL, "s");
RNA_def_property_ui_text(prop, "Value", "");
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");