diff options
author | Julian Eisel <julian@blender.org> | 2020-11-07 22:13:37 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2020-11-11 21:08:56 +0300 |
commit | 44d8fafd7f0d4f17f1e4c79ec5f9b6154d9bd57c (patch) | |
tree | 5ee271cf60843dc3112142ac9f07825c0b6e06e1 /source/blender/editors/space_outliner/tree/common.cc | |
parent | ad0c387fdf6ed8bfdaedb7f40717ce1811c5680a (diff) |
UI Code Quality: Convert Outliner Blender File mode to new tree buiding design
See https://developer.blender.org/D9499.
Also:
* Add `space_outliner/tree/common.cc` for functions shared between display
modes.
* I had to add a cast to `ListBaseWrapper` to make it work with ID lists.
* Cleanup: Remove internal `Tree` alias for `ListBase`. That was more confusing
than helpful.
Diffstat (limited to 'source/blender/editors/space_outliner/tree/common.cc')
-rw-r--r-- | source/blender/editors/space_outliner/tree/common.cc | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/source/blender/editors/space_outliner/tree/common.cc b/source/blender/editors/space_outliner/tree/common.cc new file mode 100644 index 00000000000..56b5d62195e --- /dev/null +++ b/source/blender/editors/space_outliner/tree/common.cc @@ -0,0 +1,41 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** \file + * \ingroup spoutliner + * + * Functions and helpers shared between tree-view types or other tree related code. + */ + +#include "BKE_idtype.h" + +#include "RNA_access.h" + +#include "tree_view.hh" + +/* -------------------------------------------------------------------- */ +/** \name ID Helpers. + * + * \{ */ + +const char *outliner_idcode_to_plural(short idcode) +{ + const char *propname = BKE_idtype_idcode_to_name_plural(idcode); + PropertyRNA *prop = RNA_struct_type_find_property(&RNA_BlendData, propname); + return (prop) ? RNA_property_ui_name(prop) : "UNKNOWN"; +} + +/** \} */ |