diff options
author | Andrew Hale <TrumanBlending@gmail.com> | 2018-08-27 16:51:27 +0300 |
---|---|---|
committer | Andrew Hale <TrumanBlending@gmail.com> | 2018-08-27 17:15:54 +0300 |
commit | 1e6a5eb0879119808fde8f002eed5ac7909944ec (patch) | |
tree | 599f852c269a9194606aa0b8754dfa4c885fd969 /source/blender/python/bmesh/bmesh_py_ops.c | |
parent | 09e1e2b8ce48f7692b0b3f4425a7bcd7d0bec476 (diff) |
Implement BMesh Operator string enumerators and docs generation.
Partial implementation of T56496 for review.
Reviewers: campbellbarton
Reviewed By: campbellbarton
Differential Revision: https://developer.blender.org/D3635
Diffstat (limited to 'source/blender/python/bmesh/bmesh_py_ops.c')
-rw-r--r-- | source/blender/python/bmesh/bmesh_py_ops.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/source/blender/python/bmesh/bmesh_py_ops.c b/source/blender/python/bmesh/bmesh_py_ops.c index ee96c859858..dedc78d79b4 100644 --- a/source/blender/python/bmesh/bmesh_py_ops.c +++ b/source/blender/python/bmesh/bmesh_py_ops.c @@ -75,10 +75,14 @@ static char *bmp_slots_as_args(const BMOSlotType slot_types[BMO_OP_MAX_SLOTS], c { DynStr *dyn_str = BLI_dynstr_new(); char *ret; + bool quoted; + bool set; int i = 0; while (*slot_types[i].name) { + quoted = false; + set = false; /* cut off '.out' by using a string size arg */ const int name_len = is_out ? (strchr(slot_types[i].name, '.') - slot_types[i].name) : @@ -86,7 +90,19 @@ static char *bmp_slots_as_args(const BMOSlotType slot_types[BMO_OP_MAX_SLOTS], c const char *value = "<Unknown>"; switch (slot_types[i].type) { case BMO_OP_SLOT_BOOL: value = "False"; break; - case BMO_OP_SLOT_INT: value = "0"; break; + case BMO_OP_SLOT_INT: + if (slot_types[i].subtype.intg == BMO_OP_SLOT_SUBTYPE_INT_ENUM) { + value = slot_types[i].enum_flags[0].identifier; + quoted = true; + } + else if (slot_types[i].subtype.intg == BMO_OP_SLOT_SUBTYPE_INT_FLAG) { + value = ""; + set = true; + } + else { + value = "0"; + } + break; case BMO_OP_SLOT_FLT: value = "0.0"; break; case BMO_OP_SLOT_PTR: value = "None"; break; case BMO_OP_SLOT_MAT: value = "Matrix()"; break; @@ -95,7 +111,11 @@ static char *bmp_slots_as_args(const BMOSlotType slot_types[BMO_OP_MAX_SLOTS], c (slot_types[i].subtype.elem & BMO_OP_SLOT_SUBTYPE_ELEM_IS_SINGLE) ? "None" : "[]"; break; case BMO_OP_SLOT_MAPPING: value = "{}"; break; } - BLI_dynstr_appendf(dyn_str, i ? ", %.*s=%s" : "%.*s=%s", name_len, slot_types[i].name, value); + BLI_dynstr_appendf(dyn_str, i ? ", %.*s=%s%s%s%s%s" : "%.*s=%s%s%s%s%s", + name_len, slot_types[i].name, + set ? "{" : "", quoted ? "'" : "", + value, + quoted ? "'" : "", set ? "}" : ""); i++; } |