Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-01-15 07:59:59 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-01-15 07:59:59 +0300
commit129196dc32b9e67c7008a3b31ce6e2154f9811da (patch)
treeb74e634538aeb21131fcef732d08bbdb2a6fea1d /source/blender/makesrna/intern/rna_access.c
parent82a94d0f848ba7adcd5c68dc0796623697c74ad1 (diff)
parentec52e64a5df7da7637c912d79734b236049e6761 (diff)
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/makesrna/intern/rna_access.c')
-rw-r--r--source/blender/makesrna/intern/rna_access.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index d0cde1f79a3..86d65c6e7db 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -3043,6 +3043,42 @@ void RNA_property_string_set(PointerRNA *ptr, PropertyRNA *prop, const char *val
}
}
+void RNA_property_string_set_bytes(PointerRNA *ptr, PropertyRNA *prop, const char *value, int len)
+{
+ StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
+ IDProperty *idprop;
+
+ BLI_assert(RNA_property_type(prop) == PROP_STRING);
+ BLI_assert(RNA_property_subtype(prop) == PROP_BYTESTRING);
+
+ if ((idprop = rna_idproperty_check(&prop, ptr))) {
+ IDP_ResizeArray(idprop, len);
+ memcpy(idprop->data.pointer, value, (size_t)len);
+
+ rna_idproperty_touch(idprop);
+ }
+ else if (sprop->set) {
+ /* XXX, should take length argument (currently not used). */
+ sprop->set(ptr, value); /* set function needs to clamp its self */
+ }
+ else if (sprop->set_ex) {
+ /* XXX, should take length argument (currently not used). */
+ sprop->set_ex(ptr, prop, value); /* set function needs to clamp its self */
+ }
+ else if (prop->flag & PROP_EDITABLE) {
+ IDProperty *group;
+
+ group = RNA_struct_idprops(ptr, 1);
+ if (group) {
+ IDPropertyTemplate val = {0};
+ val.string.str = value;
+ val.string.len = len;
+ val.string.subtype = IDP_STRING_SUB_BYTE;
+ IDP_AddToGroup(group, IDP_New(IDP_STRING, &val, prop->identifier));
+ }
+ }
+}
+
void RNA_property_string_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop, char *value)
{
StringPropertyRNA *sprop = (StringPropertyRNA *)rna_ensure_property(prop);