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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2013-06-10 15:08:37 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2013-06-10 15:08:37 +0400
commit4aae3e3698570519389ba6f8f76bd748ce9808da (patch)
tree55339b43a8b779b3533fba7ae32bd6b90285c2b3
parenta86e7c8b0140596e825b74769570ae05699a145f (diff)
RNA: simplify space type items code, no need to have this duplicated.
-rw-r--r--source/blender/makesrna/intern/rna_screen.c50
-rw-r--r--source/blender/makesrna/intern/rna_space.c23
2 files changed, 7 insertions, 66 deletions
diff --git a/source/blender/makesrna/intern/rna_screen.c b/source/blender/makesrna/intern/rna_screen.c
index 15fe399f608..f9171887bfb 100644
--- a/source/blender/makesrna/intern/rna_screen.c
+++ b/source/blender/makesrna/intern/rna_screen.c
@@ -105,56 +105,16 @@ static int rna_Screen_fullscreen_get(PointerRNA *ptr)
return (sc->full != 0);
}
-
-/* Returns an UI-compatible list */
-/* Note: Should not be needed, but for now we need to keep EMPTY at least in the static version of this enum, so... */
+/* UI compatible list: should not be needed, but for now we need to keep EMPTY
+ * at least in the static version of this enum for python scripts. */
static EnumPropertyItem *rna_Area_type_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr),
PropertyRNA *UNUSED(prop), int *free)
{
- EnumPropertyItem *item = NULL;
- EnumPropertyItem sep = {0, "", ICON_NONE, NULL, NULL};
- int totitem = 0;
-
- RNA_enum_items_add_value(&item, &totitem, space_type_items, SPACE_VIEW3D);
-
- RNA_enum_item_add(&item, &totitem, &sep);
-
- RNA_enum_items_add_value(&item, &totitem, space_type_items, SPACE_TIME);
- RNA_enum_items_add_value(&item, &totitem, space_type_items, SPACE_IPO);
- RNA_enum_items_add_value(&item, &totitem, space_type_items, SPACE_ACTION);
- RNA_enum_items_add_value(&item, &totitem, space_type_items, SPACE_NLA);
-
- RNA_enum_item_add(&item, &totitem, &sep);
-
- RNA_enum_items_add_value(&item, &totitem, space_type_items, SPACE_IMAGE);
- RNA_enum_items_add_value(&item, &totitem, space_type_items, SPACE_SEQ);
- RNA_enum_items_add_value(&item, &totitem, space_type_items, SPACE_CLIP);
- RNA_enum_items_add_value(&item, &totitem, space_type_items, SPACE_TEXT);
- RNA_enum_items_add_value(&item, &totitem, space_type_items, SPACE_NODE);
- RNA_enum_items_add_value(&item, &totitem, space_type_items, SPACE_LOGIC);
-
- RNA_enum_item_add(&item, &totitem, &sep);
-
- RNA_enum_items_add_value(&item, &totitem, space_type_items, SPACE_BUTS);
- RNA_enum_items_add_value(&item, &totitem, space_type_items, SPACE_OUTLINER);
- RNA_enum_items_add_value(&item, &totitem, space_type_items, SPACE_USERPREF);
- RNA_enum_items_add_value(&item, &totitem, space_type_items, SPACE_INFO);
-
- RNA_enum_item_add(&item, &totitem, &sep);
-
- RNA_enum_items_add_value(&item, &totitem, space_type_items, SPACE_FILE);
-
- RNA_enum_item_add(&item, &totitem, &sep);
-
- RNA_enum_items_add_value(&item, &totitem, space_type_items, SPACE_CONSOLE);
-
- RNA_enum_item_end(&item, &totitem);
- *free = 1;
-
- return item;
+ /* +1 to skip SPACE_EMPTY */
+ *free = 0;
+ return space_type_items + 1;
}
-
static void rna_Area_type_set(PointerRNA *ptr, int value)
{
ScrArea *sa = (ScrArea *)ptr->data;
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 6b03f7df5bd..93b2bce4860 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -60,7 +60,8 @@
EnumPropertyItem space_type_items[] = {
-#if 0 /* XXX This can't work right now, because keymaps export abused SPACE_EMPTY, so we need it in RNA for now. */
+ /* empty must be here for python, is skipped for UI */
+ {SPACE_EMPTY, "EMPTY", ICON_NONE, "Empty", ""},
{SPACE_VIEW3D, "VIEW_3D", ICON_VIEW3D, "3D View", ""},
{0, "", ICON_NONE, NULL, NULL},
{SPACE_TIME, "TIMELINE", ICON_TIME, "Timeline", ""},
@@ -83,26 +84,6 @@ EnumPropertyItem space_type_items[] = {
{SPACE_FILE, "FILE_BROWSER", ICON_FILESEL, "File Browser", ""},
{0, "", ICON_NONE, NULL, NULL},
{SPACE_CONSOLE, "CONSOLE", ICON_CONSOLE, "Python Console", ""},
-#else
- {SPACE_EMPTY, "EMPTY", ICON_NONE, "Empty", ""},
- {SPACE_VIEW3D, "VIEW_3D", ICON_VIEW3D, "3D View", ""},
- {SPACE_IPO, "GRAPH_EDITOR", ICON_IPO, "Graph Editor", ""},
- {SPACE_OUTLINER, "OUTLINER", ICON_OOPS, "Outliner", ""},
- {SPACE_BUTS, "PROPERTIES", ICON_BUTS, "Properties", ""},
- {SPACE_FILE, "FILE_BROWSER", ICON_FILESEL, "File Browser", ""},
- {SPACE_IMAGE, "IMAGE_EDITOR", ICON_IMAGE_COL, "UV/Image Editor", ""},
- {SPACE_INFO, "INFO", ICON_INFO, "Info", ""},
- {SPACE_SEQ, "SEQUENCE_EDITOR", ICON_SEQUENCE, "Video Sequence Editor", ""},
- {SPACE_TEXT, "TEXT_EDITOR", ICON_TEXT, "Text Editor", ""},
- {SPACE_ACTION, "DOPESHEET_EDITOR", ICON_ACTION, "Dope Sheet", ""},
- {SPACE_NLA, "NLA_EDITOR", ICON_NLA, "NLA Editor", ""},
- {SPACE_TIME, "TIMELINE", ICON_TIME, "Timeline", ""},
- {SPACE_NODE, "NODE_EDITOR", ICON_NODETREE, "Node Editor", ""},
- {SPACE_LOGIC, "LOGIC_EDITOR", ICON_LOGIC, "Logic Editor", ""},
- {SPACE_CONSOLE, "CONSOLE", ICON_CONSOLE, "Python Console", ""},
- {SPACE_USERPREF, "USER_PREFERENCES", ICON_PREFERENCES, "User Preferences", ""},
- {SPACE_CLIP, "CLIP_EDITOR", ICON_CLIP, "Movie Clip Editor", ""},
-#endif
{0, NULL, 0, NULL, NULL}
};