4 * ***** BEGIN GPL LICENSE BLOCK *****
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 * Contributor(s): Blender Foundation (2009).
22 * ***** END GPL LICENSE BLOCK *****
29 #include "RNA_access.h"
30 #include "RNA_define.h"
31 #include "RNA_types.h"
35 #include "BKE_context.h"
37 static PointerRNA rna_Context_manager_get(PointerRNA *ptr)
39 bContext *C= (bContext*)ptr->data;
40 return rna_pointer_inherit_refine(ptr, &RNA_WindowManager, CTX_wm_manager(C));
43 /*static PointerRNA rna_Context_window_get(PointerRNA *ptr)
45 bContext *C= (bContext*)ptr->data;
46 return rna_pointer_inherit_refine(ptr, &RNA_Window, CTX_wm_window(C));
49 static PointerRNA rna_Context_screen_get(PointerRNA *ptr)
51 bContext *C= (bContext*)ptr->data;
52 return rna_pointer_inherit_refine(ptr, &RNA_Screen, CTX_wm_screen(C));
55 static PointerRNA rna_Context_area_get(PointerRNA *ptr)
57 bContext *C= (bContext*)ptr->data;
59 RNA_pointer_create((ID*)CTX_wm_screen(C), &RNA_Area, CTX_wm_area(C), &newptr);
63 static PointerRNA rna_Context_space_data_get(PointerRNA *ptr)
65 bContext *C= (bContext*)ptr->data;
67 RNA_pointer_create((ID*)CTX_wm_screen(C), &RNA_Space, CTX_wm_space_data(C), &newptr);
71 static PointerRNA rna_Context_region_get(PointerRNA *ptr)
73 bContext *C= (bContext*)ptr->data;
75 RNA_pointer_create((ID*)CTX_wm_screen(C), &RNA_Region, CTX_wm_region(C), &newptr);
79 /*static PointerRNA rna_Context_region_data_get(PointerRNA *ptr)
81 bContext *C= (bContext*)ptr->data;
83 RNA_pointer_create((ID*)CTX_wm_screen(C), &RNA_RegionData, CTX_wm_region_data(C), &newptr);
87 static PointerRNA rna_Context_main_get(PointerRNA *ptr)
89 bContext *C= (bContext*)ptr->data;
90 return rna_pointer_inherit_refine(ptr, &RNA_Main, CTX_data_main(C));
93 static PointerRNA rna_Context_scene_get(PointerRNA *ptr)
95 bContext *C= (bContext*)ptr->data;
96 return rna_pointer_inherit_refine(ptr, &RNA_Scene, CTX_data_scene(C));
101 void RNA_def_context(BlenderRNA *brna)
106 srna= RNA_def_struct(brna, "Context", NULL);
107 RNA_def_struct_ui_text(srna, "Context", "Current windowmanager and data context.");
108 RNA_def_struct_sdna(srna, "bContext");
111 prop= RNA_def_property(srna, "manager", PROP_POINTER, PROP_NONE);
112 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
113 RNA_def_property_struct_type(prop, "WindowManager");
114 RNA_def_property_pointer_funcs(prop, "rna_Context_manager_get", NULL, NULL);
116 /* prop= RNA_def_property(srna, "window", PROP_POINTER, PROP_NONE);
117 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
118 RNA_def_property_struct_type(prop, "Window");
119 RNA_def_property_pointer_funcs(prop, "rna_Context_window_get", NULL, NULL); */
121 prop= RNA_def_property(srna, "screen", PROP_POINTER, PROP_NONE);
122 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
123 RNA_def_property_struct_type(prop, "Screen");
124 RNA_def_property_pointer_funcs(prop, "rna_Context_screen_get", NULL, NULL);
126 prop= RNA_def_property(srna, "area", PROP_POINTER, PROP_NONE);
127 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
128 RNA_def_property_struct_type(prop, "Area");
129 RNA_def_property_pointer_funcs(prop, "rna_Context_area_get", NULL, NULL);
131 prop= RNA_def_property(srna, "space_data", PROP_POINTER, PROP_NONE);
132 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
133 RNA_def_property_struct_type(prop, "Space");
134 RNA_def_property_pointer_funcs(prop, "rna_Context_space_data_get", NULL, NULL);
136 prop= RNA_def_property(srna, "region", PROP_POINTER, PROP_NONE);
137 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
138 RNA_def_property_struct_type(prop, "Region");
139 RNA_def_property_pointer_funcs(prop, "rna_Context_region_get", NULL, NULL);
141 /*prop= RNA_def_property(srna, "region_data", PROP_POINTER, PROP_NONE);
142 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
143 RNA_def_property_struct_type(prop, "RegionData");
144 RNA_def_property_pointer_funcs(prop, "rna_Context_region_data_get", NULL, NULL);*/
147 prop= RNA_def_property(srna, "main", PROP_POINTER, PROP_NONE);
148 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
149 RNA_def_property_struct_type(prop, "Main");
150 RNA_def_property_pointer_funcs(prop, "rna_Context_main_get", NULL, NULL);
152 prop= RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE);
153 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
154 RNA_def_property_struct_type(prop, "Scene");
155 RNA_def_property_pointer_funcs(prop, "rna_Context_scene_get", NULL, NULL);