bpy.props.StringProperty()'s maxlen arg was off by 1 since it included the null terminator for C strings.

This commit is contained in:
Campbell Barton
2010-06-24 21:28:33 +00:00
parent 49db2d18b2
commit bfb9ef7ee9

View File

@@ -586,7 +586,7 @@ PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw)
}
prop= RNA_def_property(srna, id, PROP_STRING, subtype);
if(maxlen != 0) RNA_def_property_string_maxlength(prop, maxlen);
if(maxlen != 0) RNA_def_property_string_maxlength(prop, maxlen + 1); /* +1 since it includes null terminator */
if(def) RNA_def_property_string_default(prop, def);
RNA_def_property_ui_text(prop, name, description);