diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-08-11 01:31:05 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-08-11 01:31:05 +0400 |
commit | f6682ab773c91ef0f760efdbe69f1a599cc1ac95 (patch) | |
tree | 94cd702de42afc5607e3159b54ee1698d4233347 /source/blender/editors/space_outliner | |
parent | 6e5b78a2774b3d10226e3c48e558a9059086e416 (diff) |
RNA: subtypes and units
* Reviewed subtypes, making them more specific and adding new ones.
* Subtypes now have an associated type of units (length, area, volume,
mass, rotation, time, velocity, acceleration). These are not used
yet anywhere.
* Centralized code that decides the name of array items based on
subtype (XYZ, RGB), was copied in 3 places.
* RNA_def_float etc functions still need to be update, will do this
later together with another change.
Diffstat (limited to 'source/blender/editors/space_outliner')
-rw-r--r-- | source/blender/editors/space_outliner/outliner.c | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c index 51cc8507ff8..4f5d3f8f736 100644 --- a/source/blender/editors/space_outliner/outliner.c +++ b/source/blender/editors/space_outliner/outliner.c @@ -1096,31 +1096,20 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i } } else if(type == TSE_RNA_ARRAY_ELEM) { - /* array property element */ - static char *vectoritem[4]= {" x", " y", " z", " w"}; - static char *quatitem[4]= {" w", " x", " y", " z"}; - static char *coloritem[4]= {" r", " g", " b", " a"}; + char c; prop= parent->directdata; - proptype= RNA_property_type(prop); - propsubtype= RNA_property_subtype(prop); - tot= RNA_property_array_length(prop); te->directdata= prop; te->rnaptr= *ptr; te->index= index; - if(tot == 4 && propsubtype == PROP_ROTATION) - te->name= quatitem[index]; - else if(tot <= 4 && (propsubtype == PROP_VECTOR || propsubtype == PROP_ROTATION)) - te->name= vectoritem[index]; - else if(tot <= 4 && propsubtype == PROP_COLOR) - te->name= coloritem[index]; - else { - te->name= MEM_callocN(sizeof(char)*20, "OutlinerRNAArrayName"); - sprintf(te->name, " %d", index+1); - te->flag |= TE_FREE_NAME; - } + c= RNA_property_array_item_char(prop, index); + + te->name= MEM_callocN(sizeof(char)*20, "OutlinerRNAArrayName"); + if(c) sprintf(te->name, " %c", c); + else sprintf(te->name, " %d", index+1); + te->flag |= TE_FREE_NAME; } } else if(type == TSE_KEYMAP) { |