diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-06-24 18:03:55 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-06-24 18:03:55 +0400 |
commit | 242d9c31d3316f99525925eb7da30522457064e8 (patch) | |
tree | 2ff511c7ebf191a2a6376c53a63050afe459492f /source/blender/editors/space_outliner | |
parent | 9abce5dfbaee953fcec0779a94cbadc3516b9daf (diff) |
RNA
* RNA_struct_name_get_alloc function to get the name from a
pointer, instead of having to deal with name property.
* CTX_data_pointer_get_type to get data from context with
a check for the RNA type.
Diffstat (limited to 'source/blender/editors/space_outliner')
-rw-r--r-- | source/blender/editors/space_outliner/outliner.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c index 16748af39d5..8017b8437ff 100644 --- a/source/blender/editors/space_outliner/outliner.c +++ b/source/blender/editors/space_outliner/outliner.c @@ -1031,7 +1031,7 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i } else if(ELEM3(type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) { PointerRNA pptr, propptr, *ptr= (PointerRNA*)idv; - PropertyRNA *prop, *iterprop, *nameprop; + PropertyRNA *prop, *iterprop; PropertyType proptype; PropertySubType propsubtype; int a, tot; @@ -1043,12 +1043,10 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i } else if(type == TSE_RNA_STRUCT) { /* struct */ - nameprop= RNA_struct_name_property(ptr->type); + te->name= RNA_struct_name_get_alloc(ptr, NULL, 0); - if(nameprop) { - te->name= RNA_property_string_get_alloc(ptr, nameprop, NULL, 0); + if(te->name) te->flag |= TE_FREE_NAME; - } else te->name= (char*)RNA_struct_ui_name(ptr->type); @@ -3075,7 +3073,7 @@ static void tree_element_to_path(SpaceOops *soops, TreeElement *te, TreeStoreEle TreeElement *tem, *temnext, *temsub; TreeStoreElem *tse, *tsenext; PointerRNA *ptr, *nextptr; - PropertyRNA *prop, *nameprop; + PropertyRNA *prop; char *newpath=NULL; /* optimise tricks: @@ -3119,17 +3117,16 @@ static void tree_element_to_path(SpaceOops *soops, TreeElement *te, TreeStoreEle newpath= RNA_path_append(*path, ptr, prop, 0, NULL); } else if(RNA_property_type(prop) == PROP_COLLECTION) { + char buf[128], *name; + temnext= (TreeElement*)(ld->next->data); tsenext= TREESTORE(temnext); nextptr= &temnext->rnaptr; - nameprop= RNA_struct_name_property(nextptr->type); + name= RNA_struct_name_get_alloc(nextptr, buf, sizeof(buf)); - if(nameprop) { + if(name) { /* if possible, use name as a key in the path */ - char buf[128], *name; - name= RNA_property_string_get_alloc(nextptr, nameprop, buf, sizeof(buf)); - newpath= RNA_path_append(*path, NULL, prop, 0, name); if(name != buf) |