Wrapped buttons window in RNA
authorMatt Ebb <matt@mke3.net>
Tue, 2 Jun 2009 08:08:41 +0000 (08:08 +0000)
committerMatt Ebb <matt@mke3.net>
Tue, 2 Jun 2009 08:08:41 +0000 (08:08 +0000)
source/blender/editors/space_buttons/buttons_intern.h
source/blender/makesdna/DNA_space_types.h
source/blender/makesrna/RNA_access.h
source/blender/makesrna/intern/rna_space.c

index 6050b4f0562971f172c5124350b343e72f4c2bd5..9d49a1eeaabe923bc040fe336ff2129d6a02a785 100644 (file)
@@ -32,19 +32,6 @@ struct ARegion;
 struct ARegionType;
 struct bContext;
 
-/* warning: the values of these defines are used in sbuts->tabs[8] */
-/* buts->mainb new */
-#define BCONTEXT_SCENE         0
-#define BCONTEXT_WORLD         1
-#define BCONTEXT_OBJECT                2
-#define BCONTEXT_DATA          3
-#define BCONTEXT_MATERIAL      4
-#define BCONTEXT_TEXTURE       5
-#define BCONTEXT_PARTICLE      6
-#define BCONTEXT_PHYSICS       7
-#define BCONTEXT_GAME          8
-#define BCONTEXT_BONE          9
-#define BCONTEXT_MODIFIER      10
 
 /* buts->scaflag */            
 #define BUTS_SENS_SEL          1
index 8cdb51bcab0e0051880f677e17fc88c5e30154ea..ad07237fdc5ce386075329231bee18921cb5196f 100644 (file)
@@ -463,6 +463,22 @@ typedef struct SpaceImaSel {
 #define TAB_SCENE_SOUND                3
 #define TAB_SCENE_SEQUENCER    4
 
+
+/* warning: the values of these defines are used in sbuts->tabs[8] */
+/* buts->mainb new */
+#define BCONTEXT_SCENE         0
+#define BCONTEXT_WORLD         1
+#define BCONTEXT_OBJECT                2
+#define BCONTEXT_DATA          3
+#define BCONTEXT_MATERIAL      4
+#define BCONTEXT_TEXTURE       5
+#define BCONTEXT_PARTICLE      6
+#define BCONTEXT_PHYSICS       7
+#define BCONTEXT_GAME          8
+#define BCONTEXT_BONE          9
+#define BCONTEXT_MODIFIER      10
+
+
 /* sbuts->flag */
 #define SB_PRV_OSA                     1
 
index 523faee79bfb9e92cd5b9a3dcb39880bc1f8e78e..ccc94fd35d53319a1bc92ea5a2f0e23f580649d4 100644 (file)
@@ -245,6 +245,7 @@ extern StructRNA RNA_Sound;
 extern StructRNA RNA_SoundSequence;
 extern StructRNA RNA_Space;
 extern StructRNA RNA_Space3DView;
+extern StructRNA RNA_SpaceButtonsWindow;
 extern StructRNA RNA_SpaceImageEditor;
 extern StructRNA RNA_SpaceUVEditor;
 extern StructRNA RNA_SpaceTextEditor;
index 56967a8490350fd6201b5699166fb2877fc2bac0..55c56beea7cfed3774dc2285e45b461f8f1e4305 100644 (file)
@@ -74,9 +74,9 @@ static StructRNA* rna_Space_refine(struct PointerRNA *ptr)
                */
                case SPACE_OUTLINER:
                        return &RNA_SpaceOutliner;
-               /* case SPACE_BUTS:
+               case SPACE_BUTS:
                        return &RNA_SpaceButtonsWindow;
-               case SPACE_FILE:
+               /* case SPACE_FILE:
                        return &RNA_SpaceFileBrowser;*/
                case SPACE_IMAGE:
                        return &RNA_SpaceImageEditor;
@@ -471,6 +471,45 @@ static void rna_def_space_3dview(BlenderRNA *brna)
        
 }
 
+static void rna_def_space_buttons(BlenderRNA *brna)
+{
+       StructRNA *srna;
+       PropertyRNA *prop;
+
+       static EnumPropertyItem buttons_context_items[] = {
+               {BCONTEXT_SCENE, "SCENE", "Scene", ""},
+               {BCONTEXT_WORLD, "WORLD", "World", ""},
+               {BCONTEXT_OBJECT, "OBJECT", "Object", ""},
+               {BCONTEXT_DATA, "DATA", "Data", ""},
+               {BCONTEXT_MATERIAL, "MATERIAL", "Material", ""},
+               {BCONTEXT_TEXTURE, "TEXTURE", "Texture", ""},
+               {BCONTEXT_PARTICLE, "PARTICLE", "Particle", ""},
+               {BCONTEXT_PHYSICS, "PHYSICS", "Physics", ""},
+               {BCONTEXT_GAME, "GAME", "Game", ""},
+               {BCONTEXT_BONE, "BONE", "Bone", ""},
+               {BCONTEXT_MODIFIER, "MODIFIER", "Modifier", ""},
+               {0, NULL, NULL, NULL}};
+               
+       static EnumPropertyItem panel_alignment_items[] = {
+               {1, "HORIZONTAL", "Horizontal", ""},
+               {2, "VERTICAL", "Vertical", ""},
+               {0, NULL, NULL, NULL}};
+               
+       srna= RNA_def_struct(brna, "SpaceButtonsWindow", "Space");
+       RNA_def_struct_sdna(srna, "SpaceButs");
+       RNA_def_struct_ui_text(srna, "Buttons Space", "Buttons Window space data");
+       
+       prop= RNA_def_property(srna, "buttons_context", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_sdna(prop, NULL, "mainb");
+       RNA_def_property_enum_items(prop, buttons_context_items);
+       RNA_def_property_ui_text(prop, "Buttons Context", "The type of active data to display and edit in the buttons window");
+       
+       prop= RNA_def_property(srna, "panel_alignment", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_sdna(prop, NULL, "align");
+       RNA_def_property_enum_items(prop, panel_alignment_items);
+       RNA_def_property_ui_text(prop, "Panel Alignment", "Arrangement of the panels within the buttons window");
+}
+
 static void rna_def_space_image(BlenderRNA *brna)
 {
        StructRNA *srna;
@@ -624,6 +663,7 @@ void RNA_def_space(BlenderRNA *brna)
        rna_def_space_outliner(brna);
        rna_def_background_image(brna);
        rna_def_space_3dview(brna);
+       rna_def_space_buttons(brna);
 }
 
 #endif