RNA
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Thu, 15 Jan 2009 04:22:23 +0000 (04:22 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Thu, 15 Jan 2009 04:22:23 +0000 (04:22 +0000)
* Work around bScreen/Screen DNA name patching, so bScreen does not
  require manual callbacks to be written for properties.
* Added SpaceLink and SpaceImage RNA.
* Fix issue initializing ID property arrays with default values.

DNA
* Some DNA changes for space image.
* And a fix for corrupt clone image pointer in reading brushes.

12 files changed:
source/blender/blenloader/intern/readfile.c
source/blender/makesdna/DNA_scene_types.h
source/blender/makesdna/DNA_space_types.h
source/blender/makesrna/RNA_access.h
source/blender/makesrna/intern/CMakeLists.txt
source/blender/makesrna/intern/makesrna.c
source/blender/makesrna/intern/rna_access.c
source/blender/makesrna/intern/rna_internal.h
source/blender/makesrna/intern/rna_material.c
source/blender/makesrna/intern/rna_scene.c
source/blender/makesrna/intern/rna_screen.c
source/blender/makesrna/intern/rna_space.c [new file with mode: 0644]

index 10cdb21858569b77aaee94d810cf7b46895a9db1..c0d873ed6b028ebc0963492352c726feea284217 100644 (file)
@@ -1490,6 +1490,8 @@ static void lib_link_brush(FileData *fd, Main *main)
                                if(mtex)
                                        mtex->tex= newlibadr_us(fd, brush->id.lib, mtex->tex);
                        }
+
+                       brush->clone.image= newlibadr_us(fd, brush->id.lib, brush->clone.image);
                }
        }
 }
@@ -5237,6 +5239,7 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
                                break;
                }
        }
+
        /* main region */
        ar= MEM_callocN(sizeof(ARegion), "area region from do_versions");
        
index 1a6fa00c841ed6a98351506a28710b87266df530..e322da8843860f401539ea3dd65620f5f9c52d73 100644 (file)
@@ -431,6 +431,8 @@ typedef struct ToolSettings {
        short uvcalc_mapdir;
        short uvcalc_mapalign;
        short uvcalc_flag;
+       short uv_flag, uv_selectmode;
+       short uv_pad[2];
 
        /* Auto-IK */
        short autoik_chainlen;
@@ -838,6 +840,16 @@ typedef struct Scene {
 #define UVCALC_NO_ASPECT_CORRECT       2       /* would call this UVCALC_ASPECT_CORRECT, except it should be default with old file */
 #define UVCALC_TRANSFORM_CORRECT       4       /* adjust UV's while transforming to avoid distortion */
 
+/* toolsettings->uv_flag */
+#define UV_SYNC_SELECTION      1
+#define UV_SHOW_SAME_IMAGE     2
+
+/* toolsettings->uv_selectmode */
+#define UV_SELECT_VERTEX       0
+#define UV_SELECT_EDGE         1 /* not implemented */
+#define UV_SELECT_FACE         2
+#define UV_SELECT_ISLAND       3
+
 /* toolsettings->edge_mode */
 #define EDGE_MODE_SELECT                               0
 #define EDGE_MODE_TAG_SEAM                             1
index dc1f0827c5cfb3f9fa4400b1f8dc05ddc50513a3..45383f2fa34cdd3ca9ea3fa1d07f5a5ac409ef03 100644 (file)
@@ -222,30 +222,26 @@ typedef struct SpaceImage {
        SpaceLink *next, *prev;
        ListBase regionbase;            /* storage of regions for inactive spaces */
        int spacetype;
-       float blockscale;
 
+       float blockscale;
        short blockhandler[8];
-
-       View2D v2d; /* depricated, copied to region */
        
        struct Image *image;
        struct ImageUser iuser;
        
        struct CurveMapping *cumap;
-       short mode, menunr;
-       short imanr;
+       short menunr, imanr, pad2;
        short curtile; /* the currently active tile of the image when tile is enabled, is kept in sync with the active faces tile */
        int flag;
-       short selectmode;
        short imtypenr, lock;
-       short pin;
-       float zoom;
+       short pin, pad3;
        char dt_uv; /* UV draw type */
        char sticky; /* sticky selection type */
        char dt_uvstretch;
-       char pad[5];
+       char pad;
        
        float xof, yof;                                 /* user defined offset, image is centered */
+       float zoom, pad4;                               /* user defined zoom level */
        float centx, centy;                             /* storage for offset while render drawing */
        
        struct bGPdata *gpd;                    /* grease pencil data */
@@ -544,10 +540,6 @@ typedef struct SpaceImaSel {
 #define MOVIEFILE_ICON         1024 /* movie file that preview can't load */
 #define FOLDERFILE                     2048 /* represents folders for filtering */
 
-/* SpaceImage->mode */
-#define SI_TEXTURE             0
-#define SI_SHOW                        1
-
 /* SpaceImage->dt_uv */
 #define SI_UVDT_OUTLINE        0
 #define SI_UVDT_DASH   1
@@ -565,12 +557,6 @@ typedef struct SpaceImaSel {
 #define SI_STICKY_DISABLE      1
 #define SI_STICKY_VERTEX       2
 
-/* SpaceImage->selectmode */
-#define SI_SELECT_VERTEX       0
-#define SI_SELECT_EDGE         1 /* not implemented */
-#define SI_SELECT_FACE         2
-#define SI_SELECT_ISLAND       3
-
 /* SpaceImage->flag */
 #define SI_BE_SQUARE   1<<0
 #define SI_EDITTILE            1<<1
@@ -590,8 +576,8 @@ typedef struct SpaceImaSel {
                /* next two for render window dislay */
 #define SI_PREVSPACE   1<<15
 #define SI_FULLWINDOW  1<<16
-#define SI_SYNC_UVSEL  1<<17
-#define SI_LOCAL_UV            1<<18
+#define SI_DEPRECATED4 1<<17
+#define SI_DEPRECATED5 1<<18
                /* this means that the image is drawn until it reaches the view edge,
                 * in the image view, its unrelated to the 'tile' mode for texface */
 #define SI_DRAW_TILE   1<<19 
index 9ca12af8b9e7fbf2bdd9cefdde137444ab9f954a..e601dc68bebd9e4b0617e1d56eb4e2e3c6690c5b 100644 (file)
@@ -218,6 +218,9 @@ extern StructRNA RNA_SoftBodySettings;
 extern StructRNA RNA_SoftbodyModifier;
 extern StructRNA RNA_Sound;
 extern StructRNA RNA_SoundSequence;
+extern StructRNA RNA_Space;
+extern StructRNA RNA_SpaceImageEditor;
+extern StructRNA RNA_SpaceUVEditor;
 extern StructRNA RNA_SpeedControlSequence;
 extern StructRNA RNA_SpotLamp;
 extern StructRNA RNA_StringProperty;
index 5eaef1ab246c30eedaf565d10b10f6ba9c9aac62..c0ab3f62039b5a38b155498b42b5c818f28c7b2e 100644 (file)
@@ -63,6 +63,7 @@ SET(DEFSRC
      rna_sensor.c
      rna_sequence.c
      rna_sound.c
+     rna_space.c
      rna_text.c
      rna_texture.c
      rna_userdef.c
@@ -109,6 +110,7 @@ SET(GENSRC
      rna_sensor_gen.c
      rna_sequence_gen.c
      rna_sound_gen.c
+     rna_space_gen.c
      rna_text_gen.c
      rna_texture_gen.c
      rna_userdef_gen.c
index 9025f3f0eae23fb8b9096bc96efb3e8f2a53207d..f7da27eb0433be2498863422c58d40b9af629c18 100644 (file)
@@ -579,7 +579,14 @@ static void rna_auto_types()
        PropertyDefRNA *dp;
 
        for(ds=DefRNA.structs.first; ds; ds=ds->next) {
+               /* DNA name for Screen is patched in 2.5, we do the reverse here .. */
+               if(ds->dnaname && strcmp(ds->dnaname, "Screen") == 0)
+                       ds->dnaname= "bScreen";
+
                for(dp=ds->properties.first; dp; dp=dp->next) {
+                       if(dp->dnastructname && strcmp(dp->dnastructname, "Screen") == 0)
+                               dp->dnastructname= "bScreen";
+
                        if(dp->dnatype) {
                                if(dp->prop->type == PROP_POINTER) {
                                        PointerPropertyRNA *pprop= (PointerPropertyRNA*)dp->prop;
@@ -946,6 +953,7 @@ RNAProcessItem PROCESS_ITEMS[]= {
        {"rna_scriptlink.c", RNA_def_scriptlink},
        {"rna_sensor.c", RNA_def_sensor},
        {"rna_sequence.c", RNA_def_sequence},
+       {"rna_space.c", RNA_def_space},
        {"rna_text.c", RNA_def_text},
        {"rna_sound.c", RNA_def_sound},
        {"rna_userdef.c", RNA_def_userdef},
index 34d90c4a06366f7f79b4fcc758a9c17ba20216a7..aa8bd3ed7666d828f61774caed99015a678a4da7 100644 (file)
@@ -580,8 +580,10 @@ int RNA_property_boolean_get_array(PointerRNA *ptr, PropertyRNA *prop, int index
                return ((int*)IDP_Array(idprop))[index];
        else if(bprop->getarray)
                return bprop->getarray(ptr, index);
-       else
+       else if(bprop->defaultarray)
                return bprop->defaultarray[index];
+       else
+               return 0;
 }
 
 void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, int index, int value)
@@ -604,7 +606,10 @@ void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, int inde
                if(group) {
                        idprop= IDP_New(IDP_ARRAY, val, (char*)prop->identifier);
                        IDP_AddToGroup(group, idprop);
-                       memcpy(idprop->data.pointer, bprop->defaultarray, sizeof(int)*prop->arraylength);
+                       if(bprop->defaultarray)
+                               memcpy(idprop->data.pointer, bprop->defaultarray, sizeof(int)*prop->arraylength);
+                       else
+                               memset(idprop->data.pointer, 0, sizeof(int)*prop->arraylength);
                        ((int*)idprop->data.pointer)[index]= value;
                }
        }
@@ -653,8 +658,10 @@ int RNA_property_int_get_array(PointerRNA *ptr, PropertyRNA *prop, int index)
                return ((int*)IDP_Array(idprop))[index];
        else if(iprop->getarray)
                return iprop->getarray(ptr, index);
-       else
+       else if(iprop->defaultarray)
                return iprop->defaultarray[index];
+       else
+               return 0.0f;
 }
 
 void RNA_property_int_set_array(PointerRNA *ptr, PropertyRNA *prop, int index, int value)
@@ -677,7 +684,10 @@ void RNA_property_int_set_array(PointerRNA *ptr, PropertyRNA *prop, int index, i
                if(group) {
                        idprop= IDP_New(IDP_ARRAY, val, (char*)prop->identifier);
                        IDP_AddToGroup(group, idprop);
-                       memcpy(idprop->data.pointer, iprop->defaultarray, sizeof(int)*prop->arraylength);
+                       if(iprop->defaultarray)
+                               memcpy(idprop->data.pointer, iprop->defaultarray, sizeof(int)*prop->arraylength);
+                       else
+                               memset(idprop->data.pointer, 0, sizeof(int)*prop->arraylength);
                        ((int*)idprop->data.pointer)[index]= value;
                }
        }
@@ -739,8 +749,10 @@ float RNA_property_float_get_array(PointerRNA *ptr, PropertyRNA *prop, int index
        }
        else if(fprop->getarray)
                return fprop->getarray(ptr, index);
-       else
+       else if(fprop->defaultarray)
                return fprop->defaultarray[index];
+       else
+               return 0.0f;
 }
 
 void RNA_property_float_set_array(PointerRNA *ptr, PropertyRNA *prop, int index, float value)
@@ -768,7 +780,10 @@ void RNA_property_float_set_array(PointerRNA *ptr, PropertyRNA *prop, int index,
                if(group) {
                        idprop= IDP_New(IDP_ARRAY, val, (char*)prop->identifier);
                        IDP_AddToGroup(group, idprop);
-                       memcpy(idprop->data.pointer, fprop->defaultarray, sizeof(float)*prop->arraylength);
+                       if(fprop->defaultarray)
+                               memcpy(idprop->data.pointer, fprop->defaultarray, sizeof(float)*prop->arraylength);
+                       else
+                               memset(idprop->data.pointer, 0, sizeof(float)*prop->arraylength);
                        ((float*)IDP_Array(idprop))[index]= value;
                }
        }
index 814bc0f3733dc3c83bc06fed2b26d757167009ec..55610266312dd842e425e09aa43a2b577b882b69 100644 (file)
@@ -132,6 +132,7 @@ void RNA_def_screen(struct BlenderRNA *brna);
 void RNA_def_scriptlink(struct BlenderRNA *brna);
 void RNA_def_sensor(struct BlenderRNA *brna);
 void RNA_def_sequence(struct BlenderRNA *brna);
+void RNA_def_space(struct BlenderRNA *brna);
 void RNA_def_text(struct BlenderRNA *brna);
 void RNA_def_texture(struct BlenderRNA *brna);
 void RNA_def_sound(struct BlenderRNA *brna);
index 62c8d33c28f0affd07755bc88d34aece93e703ae..6f37b38f1dae15869c2c5cc598244b334dfeafff 100644 (file)
@@ -296,7 +296,7 @@ static void rna_def_material_raymirror(BlenderRNA *brna)
        prop= RNA_def_property(srna, "reflect", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "ray_mirror");
        RNA_def_property_range(prop, 0.0f, 1.0f);
-       RNA_def_property_ui_text(prop, "", "Sets the amount mirror reflection for raytrace.");
+       RNA_def_property_ui_text(prop, "Reflect", "Sets the amount mirror reflection for raytrace.");
        RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);
        
        prop= RNA_def_property(srna, "fresnel", PROP_FLOAT, PROP_NONE);
index f64dda26b23d522528db642fd90f972b83580807..8ac4b851892f6bbca5791ca27a82380528dcc3b0 100644 (file)
@@ -163,10 +163,10 @@ void RNA_def_scene(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Visible Layers", "Layers visible when rendering the scene.");
        RNA_def_property_boolean_funcs(prop, NULL, "rna_Scene_layer_set");
 
-       prop= RNA_def_property(srna, "proportional_mode", PROP_ENUM, PROP_NONE);
+       prop= RNA_def_property(srna, "proportional_editing_falloff", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_sdna(prop, NULL, "prop_mode");
        RNA_def_property_enum_items(prop, prop_mode_items);
-       RNA_def_property_ui_text(prop, "Proportional Mode", "Proportional editing mode.");
+       RNA_def_property_ui_text(prop, "Proportional Editing Falloff", "Falloff type for proportional editing mode.");
 
        prop= RNA_def_property(srna, "current_frame", PROP_INT, PROP_NONE);
        RNA_def_property_flag(prop, PROP_NOT_DRIVEABLE);
index d56230bf2a58972249a1676c5c9cd096f1ea77e4..f67c36427b702325b79c615bd29cc8b9456531d0 100644 (file)
 
 #ifdef RNA_RUNTIME
 
-static void *rna_Screen_scene_get(PointerRNA *ptr)
-{
-       bScreen *sc= (bScreen*)ptr->data;
-       return sc->scene;
-}
-
-static void rna_Screen_areas_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
-{
-       bScreen *scr= (bScreen*)ptr->data;
-       rna_iterator_listbase_begin(iter, &scr->areabase, NULL);
-}
-
 #else
 
-static void RNA_def_scrarea(BlenderRNA *brna)
+static void rna_def_scrarea(BlenderRNA *brna)
 {
        StructRNA *srna;
+       PropertyRNA *prop;
        
        srna= RNA_def_struct(brna, "Area", NULL);
        RNA_def_struct_ui_text(srna, "Area", "Area in a subdivided screen, containing an editor.");
        RNA_def_struct_sdna(srna, "ScrArea");
+
+       prop= RNA_def_property(srna, "spaces", PROP_COLLECTION, PROP_NONE);
+       RNA_def_property_collection_sdna(prop, NULL, "spacedata", NULL);
+       RNA_def_property_struct_type(prop, "Space");
+       RNA_def_property_ui_text(prop, "Spaces", "Spaces contained in this area, the first space is active.");
+
+       prop= RNA_def_property(srna, "active_space", PROP_POINTER, PROP_NONE);
+       RNA_def_property_pointer_sdna(prop, NULL, "spacedata.first");
+       RNA_def_property_struct_type(prop, "Space");
+       RNA_def_property_ui_text(prop, "Active Space", "Space currently being displayed in this area.");
+
+       prop= RNA_def_property(srna, "regions", PROP_COLLECTION, PROP_NONE);
+       RNA_def_property_collection_sdna(prop, NULL, "regionbase", NULL);
+       RNA_def_property_struct_type(prop, "Region");
+       RNA_def_property_ui_text(prop, "Regions", "Regions this area is subdivided in.");
 }
 
-static void RNA_def_panel(BlenderRNA *brna)
+static void rna_def_panel(BlenderRNA *brna)
 {
        StructRNA *srna;
        
@@ -66,7 +70,7 @@ static void RNA_def_panel(BlenderRNA *brna)
        RNA_def_struct_sdna(srna, "Panel");
 }
 
-static void RNA_def_region(BlenderRNA *brna)
+static void rna_def_region(BlenderRNA *brna)
 {
        StructRNA *srna;
        
@@ -75,36 +79,31 @@ static void RNA_def_region(BlenderRNA *brna)
        RNA_def_struct_sdna(srna, "ARegion");
 }
 
-static void RNA_def_bscreen(BlenderRNA *brna)
+static void rna_def_bscreen(BlenderRNA *brna)
 {
        StructRNA *srna;
        PropertyRNA *prop;
        
        srna= RNA_def_struct(brna, "Screen", "ID");
+       RNA_def_struct_sdna(srna, "Screen"); /* it is actually bScreen but for 2.5 the dna is patched! */
        RNA_def_struct_ui_text(srna, "Screen", "Screen datablock, defining the layout of areas in a window.");
-       RNA_def_struct_sdna(srna, "bScreen");
        
        prop= RNA_def_property(srna, "scene", PROP_POINTER, PROP_NEVER_NULL);
-       RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
-       RNA_def_property_struct_type(prop, "Scene");
-       RNA_def_property_pointer_funcs(prop, "rna_Screen_scene_get", NULL, NULL);
        RNA_def_property_ui_text(prop, "Scene", "Active scene to be edited in the screen.");
        
        prop= RNA_def_property(srna, "areas", PROP_COLLECTION, PROP_NONE);
-       RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
+       RNA_def_property_collection_sdna(prop, NULL, "areabase", NULL);
        RNA_def_property_struct_type(prop, "Area");
-       RNA_def_property_collection_funcs(prop, "rna_Screen_areas_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0, 0);
-       RNA_def_property_ui_text(prop, "Areas", "All Screen Areas");
+       RNA_def_property_ui_text(prop, "Areas", "Areas the screen is subdivided into.");
 }
 
 void RNA_def_screen(BlenderRNA *brna)
 {
-       RNA_def_bscreen(brna);
-       RNA_def_scrarea(brna);
-       RNA_def_panel(brna);
-       RNA_def_region(brna);
+       rna_def_bscreen(brna);
+       rna_def_scrarea(brna);
+       rna_def_panel(brna);
+       rna_def_region(brna);
 }
 
 #endif
 
-
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
new file mode 100644 (file)
index 0000000..2c36609
--- /dev/null
@@ -0,0 +1,305 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ * Contributor(s): Blender Foundation (2008)
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <stdlib.h>
+
+#include "RNA_define.h"
+#include "RNA_types.h"
+
+#include "rna_internal.h"
+
+#include "DNA_space_types.h"
+
+#ifdef RNA_RUNTIME
+
+static StructRNA* rna_Space_refine(struct PointerRNA *ptr)
+{
+       SpaceLink *space= (SpaceLink*)ptr->data;
+
+       switch(space->spacetype) {
+               /*case SPACE_VIEW3D:
+                       return &RNA_SpaceView3D;
+               case SPACE_IPO:
+                       return &RNA_SpaceIpoEditor;
+               case SPACE_OOPS:
+                       return &RNA_SpaceOutliner;
+               case SPACE_BUTS:
+                       return &RNA_SpaceButtonsWindow;
+               case SPACE_FILE:
+                       return &RNA_SpaceFileBrowser;*/
+               case SPACE_IMAGE:
+                       return &RNA_SpaceImageEditor;
+               /*case SPACE_INFO:
+                       return &RNA_SpaceUserPreferences;
+               case SPACE_SEQ:
+                       return &RNA_SpaceSequenceEditor;
+               case SPACE_TEXT:
+                       return &RNA_SpaceTextEditor;
+               //case SPACE_IMASEL:
+               //      return &RNA_SpaceImageBrowser;
+               case SPACE_SOUND:
+                       return &RNA_SpaceAudioWindow;
+               case SPACE_ACTION:
+                       return &RNA_SpaceActionEditor;
+               case SPACE_NLA:
+                       return &RNA_SpaceNLAEditor;
+               case SPACE_SCRIPT:
+                       return &RNA_SpaceScriptsWindow;
+               case SPACE_TIME:
+                       return &RNA_SpaceTimeline;
+               case SPACE_NODE:
+                       return &RNA_SpaceNodeEditor;*/
+               default:
+                       return &RNA_Space;
+       }
+}
+
+static void *rna_SpaceImage_self_get(PointerRNA *ptr)
+{
+       return ptr->id.data;
+}
+
+#else
+
+static void rna_def_space(BlenderRNA *brna)
+{
+       StructRNA *srna;
+       PropertyRNA *prop;
+
+       static EnumPropertyItem type_items[] = {
+               {SPACE_EMPTY, "EMPTY", "Empty", ""},
+               {SPACE_VIEW3D, "VIEW_3D", "3D View", ""},
+               {SPACE_IPO, "IPO_EDITOR", "Ipo Editor", ""},
+               {SPACE_OOPS, "OUTLINER", "Outliner", ""},
+               {SPACE_BUTS, "BUTTONS_WINDOW", "Buttons Window", ""},
+               {SPACE_FILE, "FILE_BROWSER", "File Browser", ""},
+               {SPACE_IMAGE, "IMAGE_EDITOR", "Image Editor", ""},
+               {SPACE_INFO, "USER_PREFERENCES", "User Preferences", ""},
+               {SPACE_SEQ, "SEQUENCE_EDITOR", "Sequence Editor", ""},
+               {SPACE_TEXT, "TEXT_EDITOR", "Text Editor", ""},
+               //{SPACE_IMASEL, "IMAGE_BROWSER", "Image Browser", ""},
+               {SPACE_SOUND, "AUDIO_WINDOW", "Audio Window", ""},
+               {SPACE_ACTION, "ACTION_EDITOR", "Action Editor", ""},
+               {SPACE_NLA, "NLA_EDITOR", "NLA Editor", ""},
+               {SPACE_SCRIPT, "SCRIPTS_WINDOW", "Scripts Window", ""},
+               {SPACE_TIME, "TIMELINE", "Timeline", ""},
+               {SPACE_NODE, "NODE_EDITOR", "Node Editor", ""},
+               {0, NULL, NULL, NULL}};
+       
+       srna= RNA_def_struct(brna, "Space", NULL);
+       RNA_def_struct_sdna(srna, "SpaceLink");
+       RNA_def_struct_ui_text(srna, "Space", "Space data for a screen area.");
+       RNA_def_struct_refine_func(srna, "rna_Space_refine");
+       
+       prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_sdna(prop, NULL, "spacetype");
+       RNA_def_property_enum_items(prop, type_items);
+       RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
+       RNA_def_property_ui_text(prop, "Type", "Space data type.");
+}
+
+static void rna_def_space_image_uv(BlenderRNA *brna)
+{
+       StructRNA *srna;
+       PropertyRNA *prop;
+
+#if 0
+       static EnumPropertyItem select_mode_items[] = {
+               {SI_SELECT_VERTEX, "VERTEX", "Vertex", "Vertex selection mode."},
+               //{SI_SELECT_EDGE, "Edge", "Edge", "Edge selection mode."},
+               {SI_SELECT_FACE, "FACE", "Face", "Face selection mode."},
+               {SI_SELECT_ISLAND, "ISLAND", "Island", "Island selection mode."},
+               {0, NULL, NULL, NULL}};
+#endif
+
+       static EnumPropertyItem sticky_mode_items[] = {
+               {SI_STICKY_DISABLE, "DISABLED", "Disabled", "Sticky vertex selection disabled."},
+               {SI_STICKY_LOC, "SHARED_LOCATION", "SHARED_LOCATION", "Select UVs that are at the same location and share a mesh vertex."},
+               {SI_STICKY_VERTEX, "SHARED_VERTEX", "SHARED_VERTEX", "Select UVs that share mesh vertex, irrespective if they are in the same location."},
+               {0, NULL, NULL, NULL}};
+
+       static EnumPropertyItem dt_uv_items[] = {
+               {SI_UVDT_OUTLINE, "OUTLINE", "Outline", "Draw white edges with black outline."},
+               {SI_UVDT_DASH, "DASH", "Dash", "Draw dashed black-white edges."},
+               {SI_UVDT_BLACK, "BLACK", "Black", "Draw black edges."},
+               {SI_UVDT_WHITE, "WHITE", "White", "Draw white edges."},
+               {0, NULL, NULL, NULL}};
+
+       static EnumPropertyItem dt_uvstretch_items[] = {
+               {SI_UVDT_STRETCH_ANGLE, "ANGLE", "Angle", "Angular distortion between UV and 3D angles."},
+               {SI_UVDT_STRETCH_AREA, "AREA", "Area", "Area distortion between UV and 3D faces."},
+               {0, NULL, NULL, NULL}};
+
+       srna= RNA_def_struct(brna, "SpaceUVEditor", NULL);
+       RNA_def_struct_sdna(srna, "SpaceImage");
+       RNA_def_struct_nested(brna, srna, "SpaceImageEditor");
+       RNA_def_struct_ui_text(srna, "Space UV Editor", "UV editor data for the image editor space.");
+
+       /* selection */
+       /*prop= RNA_def_property(srna, "selection_mode", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_sdna(prop, NULL, "selectmode");
+       RNA_def_property_enum_items(prop, select_mode_items);
+       RNA_def_property_ui_text(prop, "Selection Mode", "UV selection and display mode.");*/
+
+       prop= RNA_def_property(srna, "sticky_selection_mode", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_sdna(prop, NULL, "sticky");
+       RNA_def_property_enum_items(prop, sticky_mode_items);
+       RNA_def_property_ui_text(prop, "Sticky Selection Mode", "Automatically select also UVs sharing the same vertex as the ones being selected.");
+
+       /* drawing */
+       prop= RNA_def_property(srna, "edge_draw_type", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_sdna(prop, NULL, "dt_uv");
+       RNA_def_property_enum_items(prop, dt_uv_items);
+       RNA_def_property_ui_text(prop, "Edge Draw Type", "Draw type for drawing UV edges.");
+
+       prop= RNA_def_property(srna, "draw_smooth_edges", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_SMOOTH_UV);
+       RNA_def_property_ui_text(prop, "Draw Smooth Edges", "Draw UV edges anti-aliased.");
+
+       prop= RNA_def_property(srna, "draw_stretch", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DRAW_STRETCH);
+       RNA_def_property_ui_text(prop, "Draw Stretch", "Draw faces colored according to the difference in shape between UVs and their 3D coordinates (blue for low distortion, red for high distortion).");
+
+       prop= RNA_def_property(srna, "draw_stretch_type", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_sdna(prop, NULL, "dt_uvstretch");
+       RNA_def_property_enum_items(prop, dt_uvstretch_items);
+       RNA_def_property_ui_text(prop, "Draw Stretch Type", "Type of stretch to draw.");
+
+       prop= RNA_def_property(srna, "draw_modified_edges", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_sdna(prop, NULL, "dt_uvstretch");
+       RNA_def_property_enum_items(prop, dt_uvstretch_items);
+       RNA_def_property_ui_text(prop, "Draw Modified Edges", "Draw edges from the final mesh after object modifier evaluation.");
+
+       /*prop= RNA_def_property(srna, "local_view", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_LOCAL_UV);
+       RNA_def_property_ui_text(prop, "Local View", "Draw only faces with the currently displayed image assigned.");*/
+
+       prop= RNA_def_property(srna, "display_normalized_coordinates", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_COORDFLOATS);
+       RNA_def_property_ui_text(prop, "Display Normalized Coordinates", "Display UV coordinates from 0.0 to 1.0 rather than in pixels.");
+
+       /* todo: move edge and face drawing options here from G.f */
+
+       /* editing */
+       /*prop= RNA_def_property(srna, "sync_selection", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_SYNC_UVSEL);
+       RNA_def_property_ui_text(prop, "Sync Selection", "Keep UV and edit mode mesh selection in sync.");*/
+
+       prop= RNA_def_property(srna, "snap_to_pixels", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_PIXELSNAP);
+       RNA_def_property_ui_text(prop, "Snap to Pixels", "Snap UVs to pixel locations while editing.");
+
+       prop= RNA_def_property(srna, "constrain_quads_rectangular", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_BE_SQUARE);
+       RNA_def_property_ui_text(prop, "Constrain Quads Rectangular", "Constrain quads to be rectangular while editing.");
+
+       prop= RNA_def_property(srna, "constrain_to_image_bounds", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_CLIP_UV);
+       RNA_def_property_ui_text(prop, "Constrain to Image Bounds", "Constraint to stay within the image bounds while editing.");
+
+       prop= RNA_def_property(srna, "live_unwrap", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_LIVE_UNWRAP);
+       RNA_def_property_ui_text(prop, "Live Unwrap", "Continuously unwrap the selected UV island while transforming pinned vertices.");
+}
+
+static void rna_def_space_image(BlenderRNA *brna)
+{
+       StructRNA *srna;
+       PropertyRNA *prop;
+
+       static EnumPropertyItem draw_channels_items[] = {
+               {0, "COLOR", "Color", "Draw image with RGB colors."},
+               {SI_USE_ALPHA, "COLOR_ALPHA", "Color and Alpha", "Draw image with RGB colors and alpha transparency."},
+               {SI_SHOW_ALPHA, "ALPHA", "Alpha", "Draw alpha transparency channel."},
+               {SI_SHOW_ZBUF, "Z_BUFFER", "Z-Buffer", "Draw Z-buffer associated with image (mapped from camera clip start to end)."},
+               {0, NULL, NULL, NULL}};
+
+       srna= RNA_def_struct(brna, "SpaceImageEditor", "Space");
+       RNA_def_struct_sdna(srna, "SpaceImage");
+       RNA_def_struct_ui_text(srna, "Space Image Editor", "Image and UV editor space data.");
+
+       /* image */
+       prop= RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
+       RNA_def_property_ui_text(prop, "Image", "Image displayed and edited in this space.");
+
+       prop= RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NEVER_NULL);
+       RNA_def_property_pointer_sdna(prop, NULL, "iuser");
+       RNA_def_property_ui_text(prop, "Image User", "Parameters defining which layer, pass and frame of the image is displayed.");
+
+       prop= RNA_def_property(srna, "curves", PROP_POINTER, PROP_NONE);
+       RNA_def_property_pointer_sdna(prop, NULL, "cumap");
+       RNA_def_property_ui_text(prop, "Curves", "Color curve mapping to use for displaying the image.");
+
+       prop= RNA_def_property(srna, "image_pin", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "pin", 0);
+       RNA_def_property_ui_text(prop, "Image Pin", "Display current image regardless of object selection.");
+
+       /* image draw */
+       prop= RNA_def_property(srna, "draw_repeated", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DRAW_TILE);
+       RNA_def_property_ui_text(prop, "Draw Repeated", "Draw the image repeated outside of the main view.");
+
+       prop= RNA_def_property(srna, "draw_channels", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
+       RNA_def_property_enum_items(prop, draw_channels_items);
+       RNA_def_property_ui_text(prop, "Draw Channels", "Channels of the image to draw.");
+
+       /* uv */
+       prop= RNA_def_property(srna, "uv_editor", PROP_POINTER, PROP_NEVER_NULL);
+       RNA_def_property_struct_type(prop, "SpaceUVEditor");
+       RNA_def_property_pointer_funcs(prop, "rna_SpaceImage_self_get", NULL, NULL);
+       RNA_def_property_ui_text(prop, "UV Editor", "UV editor settings.");
+       
+       /* paint */
+       prop= RNA_def_property(srna, "image_painting", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DRAWTOOL);
+       RNA_def_property_flag(prop, PROP_NOT_EDITABLE); // brush check
+       RNA_def_property_ui_text(prop, "Image Painting", "Enable image painting mode.");
+
+       /* grease pencil */
+       prop= RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
+       RNA_def_property_pointer_sdna(prop, NULL, "gpd");
+       RNA_def_property_struct_type(prop, "UnknownType");
+       RNA_def_property_ui_text(prop, "Grease Pencil", "Grease pencil data for this space.");
+
+       prop= RNA_def_property(srna, "use_grease_pencil", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DISPGP);
+       RNA_def_property_ui_text(prop, "Use Grease Pencil", "Display and edit the grease pencil freehand annotations overlay.");
+
+       /* update */
+       prop= RNA_def_property(srna, "update_automatically", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "lock", 0);
+       RNA_def_property_ui_text(prop, "Update Automatically", "Update other affected window spaces automatically to reflect changes during interactive operations such as transform.");
+
+       rna_def_space_image_uv(brna);
+}
+
+void RNA_def_space(BlenderRNA *brna)
+{
+       rna_def_space(brna);
+       rna_def_space_image(brna);
+}
+
+#endif
+