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 (2008)
22 * ***** END GPL LICENSE BLOCK *****
27 #include "RNA_access.h"
28 #include "RNA_define.h"
29 #include "RNA_types.h"
31 #include "rna_internal.h"
33 #include "DNA_object_types.h"
34 #include "DNA_space_types.h"
35 #include "DNA_view3d_types.h"
39 EnumPropertyItem space_type_items[] = {
40 {SPACE_EMPTY, "EMPTY", "Empty", ""},
41 {SPACE_VIEW3D, "VIEW_3D", "3D View", ""},
42 {SPACE_IPO, "GRAPH_EDITOR", "Graph Editor", ""},
43 {SPACE_OUTLINER, "OUTLINER", "Outliner", ""},
44 {SPACE_BUTS, "BUTTONS_WINDOW", "Buttons Window", ""},
45 {SPACE_FILE, "FILE_BROWSER", "File Browser", ""},
46 {SPACE_IMAGE, "IMAGE_EDITOR", "Image Editor", ""},
47 {SPACE_INFO, "USER_PREFERENCES", "User Preferences", ""},
48 {SPACE_SEQ, "SEQUENCE_EDITOR", "Sequence Editor", ""},
49 {SPACE_TEXT, "TEXT_EDITOR", "Text Editor", ""},
50 //{SPACE_IMASEL, "IMAGE_BROWSER", "Image Browser", ""},
51 {SPACE_SOUND, "AUDIO_WINDOW", "Audio Window", ""},
52 {SPACE_ACTION, "DOPESHEET_EDITOR", "DopeSheet Editor", ""},
53 {SPACE_NLA, "NLA_EDITOR", "NLA Editor", ""},
54 {SPACE_SCRIPT, "SCRIPTS_WINDOW", "Scripts Window", ""},
55 {SPACE_TIME, "TIMELINE", "Timeline", ""},
56 {SPACE_NODE, "NODE_EDITOR", "Node Editor", ""},
57 {0, NULL, NULL, NULL}};
61 #include "DNA_scene_types.h"
63 #include "BKE_brush.h"
64 #include "BKE_context.h"
66 static StructRNA* rna_Space_refine(struct PointerRNA *ptr)
68 SpaceLink *space= (SpaceLink*)ptr->data;
70 switch(space->spacetype) {
72 return &RNA_Space3DView;
74 return &RNA_SpaceGraphEditor;
77 return &RNA_SpaceOutliner;
79 return &RNA_SpaceButtonsWindow;
81 return &RNA_SpaceFileBrowser;*/
83 return &RNA_SpaceImageEditor;
85 return &RNA_SpaceUserPreferences;*/
87 return &RNA_SpaceSequenceEditor;
89 return &RNA_SpaceTextEditor;
91 // return &RNA_SpaceImageBrowser;
93 return &RNA_SpaceAudioWindow;
95 return &RNA_SpaceDopeSheetEditor;
97 return &RNA_SpaceNLAEditor;
99 return &RNA_SpaceScriptsWindow;
101 return &RNA_SpaceTimeline;
103 return &RNA_SpaceNodeEditor;*/
109 static PointerRNA rna_SpaceImage_uvedit_get(PointerRNA *ptr)
111 return rna_pointer_inherit_refine(ptr, &RNA_SpaceUVEditor, ptr->data);
114 static void rna_SpaceImage_paint_update(bContext *C, PointerRNA *ptr)
116 Scene *scene= CTX_data_scene(C);
119 brush_check_exists(&scene->toolsettings->imapaint.brush);
122 void rna_SpaceTextEditor_word_wrap_set(PointerRNA *ptr, int value)
124 SpaceText *st= (SpaceText*)(ptr->data);
130 void rna_SpaceTextEditor_text_set(PointerRNA *ptr, PointerRNA value)
132 SpaceText *st= (SpaceText*)(ptr->data);
134 st->text= value.data;
138 StructRNA *rna_SpaceButtonsWindow_pin_id_typef(PointerRNA *ptr)
140 SpaceButs *sbuts= (SpaceButs*)(ptr->data);
143 return ID_code_to_RNA_type(GS(sbuts->pinid->name));
150 static void rna_def_space(BlenderRNA *brna)
155 srna= RNA_def_struct(brna, "Space", NULL);
156 RNA_def_struct_sdna(srna, "SpaceLink");
157 RNA_def_struct_ui_text(srna, "Space", "Space data for a screen area.");
158 RNA_def_struct_refine_func(srna, "rna_Space_refine");
160 prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
161 RNA_def_property_enum_sdna(prop, NULL, "spacetype");
162 RNA_def_property_enum_items(prop, space_type_items);
163 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
164 RNA_def_property_ui_text(prop, "Type", "Space data type.");
167 static void rna_def_space_image_uv(BlenderRNA *brna)
173 static EnumPropertyItem select_mode_items[] = {
174 {SI_SELECT_VERTEX, "VERTEX", "Vertex", "Vertex selection mode."},
175 //{SI_SELECT_EDGE, "Edge", "Edge", "Edge selection mode."},
176 {SI_SELECT_FACE, "FACE", "Face", "Face selection mode."},
177 {SI_SELECT_ISLAND, "ISLAND", "Island", "Island selection mode."},
178 {0, NULL, NULL, NULL}};
181 static EnumPropertyItem sticky_mode_items[] = {
182 {SI_STICKY_DISABLE, "DISABLED", "Disabled", "Sticky vertex selection disabled."},
183 {SI_STICKY_LOC, "SHARED_LOCATION", "SHARED_LOCATION", "Select UVs that are at the same location and share a mesh vertex."},
184 {SI_STICKY_VERTEX, "SHARED_VERTEX", "SHARED_VERTEX", "Select UVs that share mesh vertex, irrespective if they are in the same location."},
185 {0, NULL, NULL, NULL}};
187 static EnumPropertyItem dt_uv_items[] = {
188 {SI_UVDT_OUTLINE, "OUTLINE", "Outline", "Draw white edges with black outline."},
189 {SI_UVDT_DASH, "DASH", "Dash", "Draw dashed black-white edges."},
190 {SI_UVDT_BLACK, "BLACK", "Black", "Draw black edges."},
191 {SI_UVDT_WHITE, "WHITE", "White", "Draw white edges."},
192 {0, NULL, NULL, NULL}};
194 static EnumPropertyItem dt_uvstretch_items[] = {
195 {SI_UVDT_STRETCH_ANGLE, "ANGLE", "Angle", "Angular distortion between UV and 3D angles."},
196 {SI_UVDT_STRETCH_AREA, "AREA", "Area", "Area distortion between UV and 3D faces."},
197 {0, NULL, NULL, NULL}};
199 srna= RNA_def_struct(brna, "SpaceUVEditor", NULL);
200 RNA_def_struct_sdna(srna, "SpaceImage");
201 RNA_def_struct_nested(brna, srna, "SpaceImageEditor");
202 RNA_def_struct_ui_text(srna, "Space UV Editor", "UV editor data for the image editor space.");
205 /*prop= RNA_def_property(srna, "selection_mode", PROP_ENUM, PROP_NONE);
206 RNA_def_property_enum_sdna(prop, NULL, "selectmode");
207 RNA_def_property_enum_items(prop, select_mode_items);
208 RNA_def_property_ui_text(prop, "Selection Mode", "UV selection and display mode.");*/
210 prop= RNA_def_property(srna, "sticky_selection_mode", PROP_ENUM, PROP_NONE);
211 RNA_def_property_enum_sdna(prop, NULL, "sticky");
212 RNA_def_property_enum_items(prop, sticky_mode_items);
213 RNA_def_property_ui_text(prop, "Sticky Selection Mode", "Automatically select also UVs sharing the same vertex as the ones being selected.");
216 prop= RNA_def_property(srna, "edge_draw_type", PROP_ENUM, PROP_NONE);
217 RNA_def_property_enum_sdna(prop, NULL, "dt_uv");
218 RNA_def_property_enum_items(prop, dt_uv_items);
219 RNA_def_property_ui_text(prop, "Edge Draw Type", "Draw type for drawing UV edges.");
221 prop= RNA_def_property(srna, "draw_smooth_edges", PROP_BOOLEAN, PROP_NONE);
222 RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_SMOOTH_UV);
223 RNA_def_property_ui_text(prop, "Draw Smooth Edges", "Draw UV edges anti-aliased.");
225 prop= RNA_def_property(srna, "draw_stretch", PROP_BOOLEAN, PROP_NONE);
226 RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DRAW_STRETCH);
227 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).");
229 prop= RNA_def_property(srna, "draw_stretch_type", PROP_ENUM, PROP_NONE);
230 RNA_def_property_enum_sdna(prop, NULL, "dt_uvstretch");
231 RNA_def_property_enum_items(prop, dt_uvstretch_items);
232 RNA_def_property_ui_text(prop, "Draw Stretch Type", "Type of stretch to draw.");
234 prop= RNA_def_property(srna, "draw_modified_edges", PROP_ENUM, PROP_NONE);
235 RNA_def_property_enum_sdna(prop, NULL, "dt_uvstretch");
236 RNA_def_property_enum_items(prop, dt_uvstretch_items);
237 RNA_def_property_ui_text(prop, "Draw Modified Edges", "Draw edges from the final mesh after object modifier evaluation.");
239 /*prop= RNA_def_property(srna, "local_view", PROP_BOOLEAN, PROP_NONE);
240 RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_LOCAL_UV);
241 RNA_def_property_ui_text(prop, "Local View", "Draw only faces with the currently displayed image assigned.");*/
243 prop= RNA_def_property(srna, "normalized_coordinates", PROP_BOOLEAN, PROP_NONE);
244 RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_COORDFLOATS);
245 RNA_def_property_ui_text(prop, "Normalized Coordinates", "Display UV coordinates from 0.0 to 1.0 rather than in pixels.");
247 /* todo: move edge and face drawing options here from G.f */
250 /*prop= RNA_def_property(srna, "sync_selection", PROP_BOOLEAN, PROP_NONE);
251 RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_SYNC_UVSEL);
252 RNA_def_property_ui_text(prop, "Sync Selection", "Keep UV and edit mode mesh selection in sync.");*/
254 prop= RNA_def_property(srna, "snap_to_pixels", PROP_BOOLEAN, PROP_NONE);
255 RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_PIXELSNAP);
256 RNA_def_property_ui_text(prop, "Snap to Pixels", "Snap UVs to pixel locations while editing.");
258 prop= RNA_def_property(srna, "constrain_to_image_bounds", PROP_BOOLEAN, PROP_NONE);
259 RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_CLIP_UV);
260 RNA_def_property_ui_text(prop, "Constrain to Image Bounds", "Constraint to stay within the image bounds while editing.");
262 prop= RNA_def_property(srna, "live_unwrap", PROP_BOOLEAN, PROP_NONE);
263 RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_LIVE_UNWRAP);
264 RNA_def_property_ui_text(prop, "Live Unwrap", "Continuously unwrap the selected UV island while transforming pinned vertices.");
267 static void rna_def_space_outliner(BlenderRNA *brna)
272 static EnumPropertyItem display_mode_items[] = {
273 {0, "ALL_SCENES", "All Scenes", ""},
274 {1, "CURRENT_SCENE", "Current Scene", ""},
275 {2, "VISIBLE_LAYERS", "Visible Layers", ""},
276 {3, "SELECTED", "Selected", ""},
277 {4, "ACTIVE", "Active", ""},
278 {5, "SAME_TYPES", "Same Types", ""},
279 {6, "GROUPS", "Groups", ""},
280 {7, "LIBRARIES", "Libraries", ""},
281 {10, "SEQUENCE", "Sequence", ""},
282 {11, "DATABLOCKS", "Datablocks", ""},
283 {12, "USER_PREFERENCES", "User Preferences", ""},
284 {0, NULL, NULL, NULL}};
286 srna= RNA_def_struct(brna, "SpaceOutliner", "Space");
287 RNA_def_struct_sdna(srna, "SpaceOops");
288 RNA_def_struct_ui_text(srna, "Space Outliner", "Outliner space data.");
290 prop= RNA_def_property(srna, "display_mode", PROP_ENUM, PROP_NONE);
291 RNA_def_property_enum_sdna(prop, NULL, "outlinevis");
292 RNA_def_property_enum_items(prop, display_mode_items);
293 RNA_def_property_ui_text(prop, "Display Mode", "Type of information to display");
294 RNA_def_property_update(prop, NC_WINDOW, NULL);
296 prop= RNA_def_property(srna, "show_restriction_columns", PROP_BOOLEAN, PROP_NONE);
297 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SO_HIDE_RESTRICTCOLS);
298 RNA_def_property_ui_text(prop, "Show Restriction Columns", "Show colum");
299 RNA_def_property_update(prop, NC_WINDOW, NULL);
303 static void rna_def_background_image(BlenderRNA *brna)
308 srna= RNA_def_struct(brna, "BackgroundImage", NULL);
309 RNA_def_struct_sdna(srna, "BGpic");
310 RNA_def_struct_ui_text(srna, "Background Image", "Image and settings for display in the 3d View background.");
312 prop= RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
313 RNA_def_property_pointer_sdna(prop, NULL, "ima");
314 RNA_def_property_ui_text(prop, "Image", "Image displayed and edited in this space.");
316 prop= RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NEVER_NULL);
317 RNA_def_property_pointer_sdna(prop, NULL, "iuser");
318 RNA_def_property_ui_text(prop, "Image User", "Parameters defining which layer, pass and frame of the image is displayed.");
320 prop= RNA_def_property(srna, "x_offset", PROP_FLOAT, PROP_NONE);
321 RNA_def_property_float_sdna(prop, NULL, "xof");
322 RNA_def_property_ui_text(prop, "X Offset", "Offsets image horizontally from the view center");
324 prop= RNA_def_property(srna, "y_offset", PROP_FLOAT, PROP_NONE);
325 RNA_def_property_float_sdna(prop, NULL, "yof");
326 RNA_def_property_ui_text(prop, "Y Offset", "Offsets image vertically from the view center");
328 prop= RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
329 RNA_def_property_float_sdna(prop, NULL, "size");
330 RNA_def_property_ui_text(prop, "Size", "Scaling factor for the background image.");
331 RNA_def_property_range(prop, 0.0, FLT_MAX);
333 prop= RNA_def_property(srna, "transparency", PROP_FLOAT, PROP_NONE);
334 RNA_def_property_float_sdna(prop, NULL, "blend");
335 RNA_def_property_ui_text(prop, "Transparency", "Amount to blend the image against the background color.");
336 RNA_def_property_range(prop, 0.0, 1.0);
340 static void rna_def_space_3dview(BlenderRNA *brna)
345 static EnumPropertyItem viewport_shading_items[] = {
346 {OB_BOUNDBOX, "BOUNDBOX", "Bounding Box", "Display the object's local bounding boxes only"},
347 {OB_WIRE, "WIREFRAME", "Wireframe", "Display the object as wire edges"},
348 {OB_SOLID, "SOLID", "Solid", "Display the object solid, lit with default OpenGL lights"},
349 {OB_SHADED, "SHADED", "Shaded", "Display the object solid, with preview shading interpolated at vertices"},
350 {OB_TEXTURE, "TEXTURED", "Textured", "Display the object solid, with face-assigned textures"},
351 {0, NULL, NULL, NULL}};
353 static EnumPropertyItem pivot_items[] = {
354 {V3D_CENTER, "BOUNDING_BOX_CENTER", "Bounding Box Center", ""},
355 {V3D_CURSOR, "CURSOR", "3D Cursor", ""},
356 {V3D_LOCAL, "INDIVIDUAL_CENTERS", "Individual Centers", ""},
357 {V3D_CENTROID, "MEDIAN_POINT", "Median Point", ""},
358 {V3D_ACTIVE, "ACTIVE_ELEMENT", "Active Element", ""},
359 {0, NULL, NULL, NULL}};
361 static EnumPropertyItem transform_orientation_items[] = {
362 {V3D_MANIP_GLOBAL, "ORIENT_GLOBAL", "Global", "Align the transformation axes to world space"},
363 {V3D_MANIP_LOCAL, "ORIENT_LOCAL", "Local", "Align the transformation axes to the selected objects' local space"},
364 {V3D_MANIP_NORMAL, "ORIENT_NORMAL", "Normal", "Align the transformation axes to average normal of selected elements (bone Y axis for pose mode)"},
365 {V3D_MANIP_VIEW, "ORIENT_VIEW", "View", "Align the transformation axes to the window"},
366 {V3D_MANIP_CUSTOM, "ORIENT_CUSTOM", "Custom", "Use a custom transform orientation"},
367 {0, NULL, NULL, NULL}};
369 srna= RNA_def_struct(brna, "Space3DView", "Space");
370 RNA_def_struct_sdna(srna, "View3D");
371 RNA_def_struct_ui_text(srna, "3D View Space", "3D View space data");
373 prop= RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
374 RNA_def_property_pointer_sdna(prop, NULL, "camera");
375 RNA_def_property_ui_text(prop, "Camera", "Active camera used in this view (when unlocked from the scene's active camera).");
377 prop= RNA_def_property(srna, "lock_object", PROP_POINTER, PROP_NONE);
378 RNA_def_property_pointer_sdna(prop, NULL, "ob_centre");
379 RNA_def_property_ui_text(prop, "Lock Object", "3D View center is locked to this object's position");
381 prop= RNA_def_property(srna, "background_image", PROP_POINTER, PROP_NONE);
382 RNA_def_property_pointer_sdna(prop, NULL, "bgpic");
383 RNA_def_property_ui_text(prop, "Background Image", "Image and settings to display in the 3D View background");
385 prop= RNA_def_property(srna, "viewport_shading", PROP_ENUM, PROP_NONE);
386 RNA_def_property_enum_sdna(prop, NULL, "drawtype");
387 RNA_def_property_enum_items(prop, viewport_shading_items);
388 RNA_def_property_ui_text(prop, "Viewport Shading", "Method to display/shade objects in the 3D View.");
390 prop= RNA_def_property(srna, "localview", PROP_BOOLEAN, PROP_NONE);
391 RNA_def_property_boolean_sdna(prop, NULL, "localview", 0);
392 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
393 RNA_def_property_ui_text(prop, "Local View", "Display an isolated sub-set of objects, apart from the scene visibility.");
395 prop= RNA_def_property(srna, "lens", PROP_FLOAT, PROP_NONE);
396 RNA_def_property_float_sdna(prop, NULL, "lens");
397 RNA_def_property_ui_text(prop, "Lens", "Lens angle (mm) in perspective view.");
398 RNA_def_property_range(prop, 1.0f, 250.0f);
400 prop= RNA_def_property(srna, "clip_start", PROP_FLOAT, PROP_NONE);
401 RNA_def_property_float_sdna(prop, NULL, "near");
402 RNA_def_property_range(prop, 0.0f, FLT_MAX);
403 RNA_def_property_ui_text(prop, "Clip Start", "3D View near clipping distance.");
405 prop= RNA_def_property(srna, "clip_end", PROP_FLOAT, PROP_NONE);
406 RNA_def_property_float_sdna(prop, NULL, "far");
407 RNA_def_property_range(prop, 1.0f, FLT_MAX);
408 RNA_def_property_ui_text(prop, "Clip End", "3D View far clipping distance.");
410 prop= RNA_def_property(srna, "grid_spacing", PROP_FLOAT, PROP_NONE);
411 RNA_def_property_float_sdna(prop, NULL, "grid");
412 RNA_def_property_ui_text(prop, "Grid Spacing", "The distance between 3D View grid lines.");
413 RNA_def_property_range(prop, 0.0f, FLT_MAX);
415 prop= RNA_def_property(srna, "grid_lines", PROP_INT, PROP_NONE);
416 RNA_def_property_int_sdna(prop, NULL, "gridlines");
417 RNA_def_property_ui_text(prop, "Grid Lines", "The number of grid lines to display in perspective view.");
418 RNA_def_property_range(prop, 0, 1024);
420 prop= RNA_def_property(srna, "grid_subdivisions", PROP_INT, PROP_NONE);
421 RNA_def_property_int_sdna(prop, NULL, "gridsubdiv");
422 RNA_def_property_ui_text(prop, "Grid Subdivisions", "The number of subdivisions between grid lines.");
423 RNA_def_property_range(prop, 1, 1024);
425 prop= RNA_def_property(srna, "display_floor", PROP_BOOLEAN, PROP_NONE);
426 RNA_def_property_boolean_sdna(prop, NULL, "gridflag", V3D_SHOW_FLOOR);
427 RNA_def_property_ui_text(prop, "Display Grid Floor", "Show the ground plane grid in perspective view.");
429 prop= RNA_def_property(srna, "display_x_axis", PROP_BOOLEAN, PROP_NONE);
430 RNA_def_property_boolean_sdna(prop, NULL, "gridflag", V3D_SHOW_X);
431 RNA_def_property_ui_text(prop, "Display X Axis", "Show the X axis line in perspective view.");
433 prop= RNA_def_property(srna, "display_y_axis", PROP_BOOLEAN, PROP_NONE);
434 RNA_def_property_boolean_sdna(prop, NULL, "gridflag", V3D_SHOW_Y);
435 RNA_def_property_ui_text(prop, "Display Y Axis", "Show the Y axis line in perspective view.");
437 prop= RNA_def_property(srna, "display_z_axis", PROP_BOOLEAN, PROP_NONE);
438 RNA_def_property_boolean_sdna(prop, NULL, "gridflag", V3D_SHOW_Z);
439 RNA_def_property_ui_text(prop, "Display Z Axis", "Show the Z axis line in perspective view.");
441 prop= RNA_def_property(srna, "outline_selected", PROP_BOOLEAN, PROP_NONE);
442 RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_SELECT_OUTLINE);
443 RNA_def_property_ui_text(prop, "Outline Selected", "Show an outline highlight around selected objects in non-wireframe views.");
445 prop= RNA_def_property(srna, "all_object_centers", PROP_BOOLEAN, PROP_NONE);
446 RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_DRAW_CENTERS);
447 RNA_def_property_ui_text(prop, "All Object Centers", "Show the object center dot for all (selected and unselected) objects.");
449 prop= RNA_def_property(srna, "relationship_lines", PROP_BOOLEAN, PROP_NONE);
450 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", V3D_HIDE_HELPLINES);
451 RNA_def_property_ui_text(prop, "Relationship Lines", "Show dashed lines indicating parent or constraint relationships.");
453 prop= RNA_def_property(srna, "textured_solid", PROP_BOOLEAN, PROP_NONE);
454 RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_SOLID_TEX);
455 RNA_def_property_ui_text(prop, "Textured Solid", "Display face-assigned textures in solid view");
457 prop= RNA_def_property(srna, "pivot_point", PROP_ENUM, PROP_NONE);
458 RNA_def_property_enum_sdna(prop, NULL, "around");
459 RNA_def_property_enum_items(prop, pivot_items);
460 RNA_def_property_ui_text(prop, "Pivot Point", "Pivot center for rotation/scaling.");
462 prop= RNA_def_property(srna, "manipulator", PROP_BOOLEAN, PROP_NONE);
463 RNA_def_property_boolean_sdna(prop, NULL, "twflag", V3D_USE_MANIPULATOR);
464 RNA_def_property_ui_text(prop, "Manipulator", "Use a 3D manipulator widget for controlling transforms.");
466 prop= RNA_def_property(srna, "manipulator_translate", PROP_BOOLEAN, PROP_NONE);
467 RNA_def_property_boolean_sdna(prop, NULL, "twtype", V3D_MANIP_TRANSLATE);
468 RNA_def_property_ui_text(prop, "Manipulator Translate", "Use the manipulator for movement transformations.");
470 prop= RNA_def_property(srna, "manipulator_rotate", PROP_BOOLEAN, PROP_NONE);
471 RNA_def_property_boolean_sdna(prop, NULL, "twtype", V3D_MANIP_ROTATE);
472 RNA_def_property_ui_text(prop, "Manipulator Rotate", "Use the manipulator for rotation transformations.");
474 prop= RNA_def_property(srna, "manipulator_scale", PROP_BOOLEAN, PROP_NONE);
475 RNA_def_property_boolean_sdna(prop, NULL, "twtype", V3D_MANIP_SCALE);
476 RNA_def_property_ui_text(prop, "Manipulator Scale", "Use the manipulator for scale transformations.");
478 prop= RNA_def_property(srna, "transform_orientation", PROP_ENUM, PROP_NONE);
479 RNA_def_property_enum_sdna(prop, NULL, "twmode");
480 RNA_def_property_enum_items(prop, transform_orientation_items);
481 RNA_def_property_ui_text(prop, "Transform Orientation", "The alignment of manipulator handles.");
485 static void rna_def_space_buttons(BlenderRNA *brna)
490 static EnumPropertyItem buttons_context_items[] = {
491 {BCONTEXT_SCENE, "SCENE", "Scene", ""},
492 {BCONTEXT_WORLD, "WORLD", "World", ""},
493 {BCONTEXT_OBJECT, "OBJECT", "Object", ""},
494 {BCONTEXT_DATA, "DATA", "Data", ""},
495 {BCONTEXT_MATERIAL, "MATERIAL", "Material", ""},
496 {BCONTEXT_TEXTURE, "TEXTURE", "Texture", ""},
497 {BCONTEXT_PARTICLE, "PARTICLE", "Particle", ""},
498 {BCONTEXT_PHYSICS, "PHYSICS", "Physics", ""},
499 {BCONTEXT_GAME, "GAME", "Game", ""},
500 {BCONTEXT_BONE, "BONE", "Bone", ""},
501 {BCONTEXT_MODIFIER, "MODIFIER", "Modifier", ""},
502 {BCONTEXT_CONSTRAINT, "CONSTRAINT", "Constraint", ""},
503 {0, NULL, NULL, NULL}};
505 static EnumPropertyItem panel_alignment_items[] = {
506 {1, "HORIZONTAL", "Horizontal", ""},
507 {2, "VERTICAL", "Vertical", ""},
508 {0, NULL, NULL, NULL}};
510 srna= RNA_def_struct(brna, "SpaceButtonsWindow", "Space");
511 RNA_def_struct_sdna(srna, "SpaceButs");
512 RNA_def_struct_ui_text(srna, "Buttons Space", "Buttons Window space data");
514 prop= RNA_def_property(srna, "buttons_context", PROP_ENUM, PROP_NONE);
515 RNA_def_property_enum_sdna(prop, NULL, "mainb");
516 RNA_def_property_enum_items(prop, buttons_context_items);
517 RNA_def_property_ui_text(prop, "Buttons Context", "The type of active data to display and edit in the buttons window");
519 prop= RNA_def_property(srna, "panel_alignment", PROP_ENUM, PROP_NONE);
520 RNA_def_property_enum_sdna(prop, NULL, "align");
521 RNA_def_property_enum_items(prop, panel_alignment_items);
522 RNA_def_property_ui_text(prop, "Panel Alignment", "Arrangement of the panels within the buttons window");
525 prop= RNA_def_property(srna, "pin_id", PROP_POINTER, PROP_NONE);
526 RNA_def_property_pointer_sdna(prop, NULL, "pinid");
527 RNA_def_property_struct_type(prop, "ID");
528 RNA_def_property_pointer_funcs(prop, NULL, NULL, "rna_SpaceButtonsWindow_pin_id_typef");
529 RNA_def_property_flag(prop, PROP_EDITABLE);
532 static void rna_def_space_image(BlenderRNA *brna)
537 static EnumPropertyItem draw_channels_items[] = {
538 {0, "COLOR", "Color", "Draw image with RGB colors."},
539 {SI_USE_ALPHA, "COLOR_ALPHA", "Color and Alpha", "Draw image with RGB colors and alpha transparency."},
540 {SI_SHOW_ALPHA, "ALPHA", "Alpha", "Draw alpha transparency channel."},
541 {SI_SHOW_ZBUF, "Z_BUFFER", "Z-Buffer", "Draw Z-buffer associated with image (mapped from camera clip start to end)."},
542 {SI_COLOR_CORRECTION, "COLOR_CORRECTED", "Color Corrected", "Display color corrected image."},
543 {0, NULL, NULL, NULL}};
545 srna= RNA_def_struct(brna, "SpaceImageEditor", "Space");
546 RNA_def_struct_sdna(srna, "SpaceImage");
547 RNA_def_struct_ui_text(srna, "Space Image Editor", "Image and UV editor space data.");
550 prop= RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
551 RNA_def_property_ui_text(prop, "Image", "Image displayed and edited in this space.");
553 prop= RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NEVER_NULL);
554 RNA_def_property_pointer_sdna(prop, NULL, "iuser");
555 RNA_def_property_ui_text(prop, "Image User", "Parameters defining which layer, pass and frame of the image is displayed.");
557 prop= RNA_def_property(srna, "curves", PROP_POINTER, PROP_NONE);
558 RNA_def_property_pointer_sdna(prop, NULL, "cumap");
559 RNA_def_property_ui_text(prop, "Curves", "Color curve mapping to use for displaying the image.");
561 prop= RNA_def_property(srna, "image_pin", PROP_BOOLEAN, PROP_NONE);
562 RNA_def_property_boolean_sdna(prop, NULL, "pin", 0);
563 RNA_def_property_ui_text(prop, "Image Pin", "Display current image regardless of object selection.");
566 prop= RNA_def_property(srna, "draw_repeated", PROP_BOOLEAN, PROP_NONE);
567 RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DRAW_TILE);
568 RNA_def_property_ui_text(prop, "Draw Repeated", "Draw the image repeated outside of the main view.");
570 prop= RNA_def_property(srna, "draw_channels", PROP_ENUM, PROP_NONE);
571 RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
572 RNA_def_property_enum_items(prop, draw_channels_items);
573 RNA_def_property_ui_text(prop, "Draw Channels", "Channels of the image to draw.");
576 prop= RNA_def_property(srna, "uv_editor", PROP_POINTER, PROP_NEVER_NULL);
577 RNA_def_property_struct_type(prop, "SpaceUVEditor");
578 RNA_def_property_pointer_funcs(prop, "rna_SpaceImage_uvedit_get", NULL, NULL);
579 RNA_def_property_ui_text(prop, "UV Editor", "UV editor settings.");
582 prop= RNA_def_property(srna, "image_painting", PROP_BOOLEAN, PROP_NONE);
583 RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DRAWTOOL);
584 RNA_def_property_ui_text(prop, "Image Painting", "Enable image painting mode.");
585 RNA_def_property_update(prop, 0, "rna_SpaceImage_paint_update");
588 prop= RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
589 RNA_def_property_pointer_sdna(prop, NULL, "gpd");
590 RNA_def_property_struct_type(prop, "UnknownType");
591 RNA_def_property_ui_text(prop, "Grease Pencil", "Grease pencil data for this space.");
593 prop= RNA_def_property(srna, "use_grease_pencil", PROP_BOOLEAN, PROP_NONE);
594 RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DISPGP);
595 RNA_def_property_ui_text(prop, "Use Grease Pencil", "Display and edit the grease pencil freehand annotations overlay.");
598 prop= RNA_def_property(srna, "update_automatically", PROP_BOOLEAN, PROP_NONE);
599 RNA_def_property_boolean_sdna(prop, NULL, "lock", 0);
600 RNA_def_property_ui_text(prop, "Update Automatically", "Update other affected window spaces automatically to reflect changes during interactive operations such as transform.");
602 rna_def_space_image_uv(brna);
606 static void rna_def_space_sequencer(BlenderRNA *brna)
611 static EnumPropertyItem display_mode_items[] = {
612 {SEQ_DRAW_SEQUENCE, "SEQUENCER", "Sequencer", ""},
613 {SEQ_DRAW_IMG_IMBUF, "IMAGE", "Image Preview", ""},
614 {SEQ_DRAW_IMG_WAVEFORM, "WAVEFORM", "Luma Waveform", ""},
615 {SEQ_DRAW_IMG_VECTORSCOPE, "VECTOR_SCOPE", "Chroma Vectorscope", ""},
616 {SEQ_DRAW_IMG_HISTOGRAM, "HISTOGRAM", "Histogram", ""},
617 {0, NULL, NULL, NULL}};
619 srna= RNA_def_struct(brna, "SpaceSequenceEditor", "Space");
620 RNA_def_struct_sdna(srna, "SpaceSeq");
621 RNA_def_struct_ui_text(srna, "Space Sequence Editor", "Sequence editor space data.");
623 /* display type, fairly important */
624 prop= RNA_def_property(srna, "display_mode", PROP_ENUM, PROP_NONE);
625 RNA_def_property_enum_sdna(prop, NULL, "mainb");
626 RNA_def_property_enum_items(prop, display_mode_items);
627 RNA_def_property_ui_text(prop, "Display Mode", "The view mode to use for displaying sequencer output.");
628 RNA_def_property_update(prop, ND_SEQUENCER|ND_DISPLAY, NULL); // review notifier
631 prop= RNA_def_property(srna, "draw_frames", PROP_BOOLEAN, PROP_NONE);
632 RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_DRAWFRAMES);
633 RNA_def_property_ui_text(prop, "Draw Frames", "Draw frames rather then seconds.");
634 RNA_def_property_update(prop, ND_SEQUENCER|ND_DISPLAY, NULL); // review notifier
636 prop= RNA_def_property(srna, "transform_markers", PROP_BOOLEAN, PROP_NONE);
637 RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_MARKER_TRANS);
638 RNA_def_property_ui_text(prop, "Transform Markers", "Transform markers as well as strips.");
640 prop= RNA_def_property(srna, "seperate_color_preview", PROP_BOOLEAN, PROP_NONE);
641 RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_DRAW_COLOR_SEPERATED);
642 RNA_def_property_ui_text(prop, "Transform Markers", "Seperate color channels in preview.");
643 RNA_def_property_update(prop, ND_SEQUENCER|ND_DISPLAY, NULL); // review notifier
645 prop= RNA_def_property(srna, "draw_safe_margin", PROP_BOOLEAN, PROP_NONE);
646 RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_DRAW_SAFE_MARGINS);
647 RNA_def_property_ui_text(prop, "Safe Margin", "Draw title safe margins in preview.");
648 RNA_def_property_update(prop, ND_SEQUENCER|ND_DISPLAY, NULL); // review notifier
650 prop= RNA_def_property(srna, "use_grease_pencil", PROP_BOOLEAN, PROP_NONE);
651 RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_DRAW_GPENCIL);
652 RNA_def_property_ui_text(prop, "Use Grease Pencil", "Display and edit the grease pencil freehand annotations overlay.");
653 RNA_def_property_update(prop, ND_SEQUENCER|ND_DISPLAY, NULL); // review notifier
656 prop= RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
657 RNA_def_property_pointer_sdna(prop, NULL, "gpd");
658 RNA_def_property_struct_type(prop, "UnknownType");
659 RNA_def_property_ui_text(prop, "Grease Pencil", "Grease pencil data for this space.");
661 prop= RNA_def_property(srna, "display_channel", PROP_INT, PROP_NONE);
662 RNA_def_property_int_sdna(prop, NULL, "chanshown");
663 RNA_def_property_ui_text(prop, "Display Channel", "The channel number shown in the image preview. 0 is the result of all strips combined.");
664 RNA_def_property_range(prop, 0, 32); // MAXSEQ --- todo, move from BKE_sequence.h
665 RNA_def_property_update(prop, ND_SEQUENCER|ND_DISPLAY, NULL); // review notifier
667 prop= RNA_def_property(srna, "draw_overexposed", PROP_INT, PROP_NONE);
668 RNA_def_property_int_sdna(prop, NULL, "zebra");
669 RNA_def_property_ui_text(prop, "Show Overexposed", "Show overexposed areas with zebra stripes.");
670 RNA_def_property_range(prop, 0, 110);
671 RNA_def_property_update(prop, ND_SEQUENCER|ND_DISPLAY, NULL); // review notifier
674 /* not sure we need rna access to these but adding anyway */
675 prop= RNA_def_property(srna, "x_offset", PROP_FLOAT, PROP_NONE);
676 RNA_def_property_float_sdna(prop, NULL, "xof");
677 RNA_def_property_ui_text(prop, "X Offset", "Offsets image horizontally from the view center");
679 prop= RNA_def_property(srna, "y_offset", PROP_FLOAT, PROP_NONE);
680 RNA_def_property_float_sdna(prop, NULL, "yof");
681 RNA_def_property_ui_text(prop, "Y Offset", "Offsets image horizontally from the view center");
683 prop= RNA_def_property(srna, "zoom", PROP_FLOAT, PROP_NONE);
684 RNA_def_property_float_sdna(prop, NULL, "zoom");
685 RNA_def_property_ui_text(prop, "Zoom", "Display zoom level");
688 static void rna_def_space_text(BlenderRNA *brna)
693 static EnumPropertyItem font_size_items[] = {
694 {12, "SCREEN_12", "Screen 12", ""},
695 {15, "SCREEN_15", "Screen 15", ""},
696 {0, NULL, NULL, NULL}};
698 srna= RNA_def_struct(brna, "SpaceTextEditor", "Space");
699 RNA_def_struct_sdna(srna, "SpaceText");
700 RNA_def_struct_ui_text(srna, "Space Text Editor", "Text editor space data.");
703 prop= RNA_def_property(srna, "text", PROP_POINTER, PROP_NONE);
704 RNA_def_property_flag(prop, PROP_EDITABLE);
705 RNA_def_property_ui_text(prop, "Text", "Text displayed and edited in this space.");
706 RNA_def_property_pointer_funcs(prop, NULL, "rna_SpaceTextEditor_text_set", NULL);
707 RNA_def_property_update(prop, NC_TEXT|NA_EDITED, NULL);
710 prop= RNA_def_property(srna, "syntax_highlight", PROP_BOOLEAN, PROP_NONE);
711 RNA_def_property_boolean_sdna(prop, NULL, "showsyntax", 0);
712 RNA_def_property_ui_text(prop, "Syntax Highlight", "Syntax highlight for scripting.");
713 RNA_def_property_update(prop, NC_TEXT|ND_DISPLAY, NULL);
715 prop= RNA_def_property(srna, "word_wrap", PROP_BOOLEAN, PROP_NONE);
716 RNA_def_property_boolean_sdna(prop, NULL, "wordwrap", 0);
717 RNA_def_property_boolean_funcs(prop, NULL, "rna_SpaceTextEditor_word_wrap_set");
718 RNA_def_property_ui_text(prop, "Word Wrap", "Wrap words if there is not enough horizontal space.");
719 RNA_def_property_update(prop, NC_TEXT|ND_DISPLAY, NULL);
721 prop= RNA_def_property(srna, "line_numbers", PROP_BOOLEAN, PROP_NONE);
722 RNA_def_property_boolean_sdna(prop, NULL, "showlinenrs", 0);
723 RNA_def_property_ui_text(prop, "Line Numbers", "Show line numbers next to the text.");
724 RNA_def_property_update(prop, NC_TEXT|ND_DISPLAY, NULL);
726 prop= RNA_def_property(srna, "overwrite", PROP_BOOLEAN, PROP_NONE);
727 RNA_def_property_ui_text(prop, "Overwrite", "Overwrite characters when typing rather than inserting them.");
728 RNA_def_property_update(prop, NC_TEXT|ND_DISPLAY, NULL);
730 prop= RNA_def_property(srna, "tab_width", PROP_INT, PROP_NONE);
731 RNA_def_property_int_sdna(prop, NULL, "tabnumber");
732 RNA_def_property_range(prop, 2, 8);
733 RNA_def_property_ui_text(prop, "Tab Width", "Number of spaces to display tabs with.");
734 RNA_def_property_update(prop, NC_TEXT|ND_DISPLAY, NULL);
736 prop= RNA_def_property(srna, "font_size", PROP_ENUM, PROP_NONE);
737 RNA_def_property_enum_sdna(prop, NULL, "lheight");
738 RNA_def_property_enum_items(prop, font_size_items);
739 RNA_def_property_ui_text(prop, "Font Size", "Font size to use for displaying the text.");
740 RNA_def_property_update(prop, NC_TEXT|ND_DISPLAY, NULL);
743 prop= RNA_def_property(srna, "find_all", PROP_BOOLEAN, PROP_NONE);
744 RNA_def_property_boolean_sdna(prop, NULL, "flags", ST_FIND_ALL);
745 RNA_def_property_ui_text(prop, "Find All", "Search in all text datablocks, instead of only the active one.");
747 prop= RNA_def_property(srna, "find_wrap", PROP_BOOLEAN, PROP_NONE);
748 RNA_def_property_boolean_sdna(prop, NULL, "flags", ST_FIND_WRAP);
749 RNA_def_property_ui_text(prop, "Find Wrap", "Search again from the start of the file when reaching the end.");
751 prop= RNA_def_property(srna, "find_text", PROP_STRING, PROP_NONE);
752 RNA_def_property_string_sdna(prop, NULL, "findstr");
753 RNA_def_property_ui_text(prop, "Find Text", "Text to search for with the find tool.");
755 prop= RNA_def_property(srna, "replace_text", PROP_STRING, PROP_NONE);
756 RNA_def_property_string_sdna(prop, NULL, "replacestr");
757 RNA_def_property_ui_text(prop, "Replace Text", "Text to replace selected text with using the replace tool.");
760 void RNA_def_space(BlenderRNA *brna)
763 rna_def_space_image(brna);
764 rna_def_space_sequencer(brna);
765 rna_def_space_text(brna);
766 rna_def_space_outliner(brna);
767 rna_def_background_image(brna);
768 rna_def_space_3dview(brna);
769 rna_def_space_buttons(brna);