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_define.h"
28 #include "RNA_types.h"
30 #include "rna_internal.h"
32 #include "DNA_camera_types.h"
40 void RNA_def_camera(BlenderRNA *brna)
44 static EnumPropertyItem prop_type_items[] = {
45 {CAM_PERSP, "PERSP", 0, "Perspective", ""},
46 {CAM_ORTHO, "ORTHO", 0, "Orthographic", ""},
47 {0, NULL, 0, NULL, NULL}};
48 static EnumPropertyItem prop_lens_unit_items[] = {
49 {0, "MILLIMETERS", 0, "Millimeters", ""},
50 {CAM_ANGLETOGGLE, "DEGREES", 0, "Degrees", ""},
51 {0, NULL, 0, NULL, NULL}};
53 srna= RNA_def_struct(brna, "Camera", "ID");
54 RNA_def_struct_ui_text(srna, "Camera", "Camera datablock for storing camera settings.");
55 RNA_def_struct_ui_icon(srna, ICON_CAMERA_DATA);
58 prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
59 RNA_def_property_enum_items(prop, prop_type_items);
60 RNA_def_property_ui_text(prop, "Type", "Camera types.");
61 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
65 prop= RNA_def_property(srna, "passepartout_alpha", PROP_FLOAT, PROP_PERCENTAGE);
66 RNA_def_property_float_sdna(prop, NULL, "passepartalpha");
67 RNA_def_property_range(prop, 0.0f, 1.0f);
68 RNA_def_property_ui_text(prop, "Passepartout Alpha", "Opacity (alpha) of the darkened overlay in Camera view.");
69 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
71 prop= RNA_def_property(srna, "angle", PROP_FLOAT, PROP_NONE);
72 RNA_def_property_float_sdna(prop, NULL, "angle");
73 RNA_def_property_range(prop, 0.0f, 100.0f);
74 RNA_def_property_ui_text(prop, "Angle", "Perspective Camera lend field of view in degrees.");
75 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
77 prop= RNA_def_property(srna, "clip_start", PROP_FLOAT, PROP_NONE);
78 RNA_def_property_float_sdna(prop, NULL, "clipsta");
79 RNA_def_property_range(prop, 0.0f, FLT_MAX);
80 RNA_def_property_ui_text(prop, "Clip Start", "Camera near clipping distance.");
81 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
83 prop= RNA_def_property(srna, "clip_end", PROP_FLOAT, PROP_NONE);
84 RNA_def_property_float_sdna(prop, NULL, "clipend");
85 RNA_def_property_range(prop, 1.0f, FLT_MAX);
86 RNA_def_property_ui_text(prop, "Clip End", "Camera far clipping distance.");
87 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
89 prop= RNA_def_property(srna, "lens", PROP_FLOAT, PROP_NONE);
90 RNA_def_property_float_sdna(prop, NULL, "lens");
91 RNA_def_property_range(prop, 1.0f, 250.0f);
92 RNA_def_property_ui_text(prop, "Lens", "Perspective Camera lens value in mm.");
93 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
95 prop= RNA_def_property(srna, "ortho_scale", PROP_FLOAT, PROP_NONE);
96 RNA_def_property_float_sdna(prop, NULL, "ortho_scale");
97 RNA_def_property_range(prop, 0.01f, 1000.0f);
98 RNA_def_property_ui_text(prop, "Orthographic Scale", "Orthographic Camera scale (similar to zoom).");
99 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
101 prop= RNA_def_property(srna, "draw_size", PROP_FLOAT, PROP_NONE);
102 RNA_def_property_float_sdna(prop, NULL, "drawsize");
103 RNA_def_property_range(prop, 0.1f, 10.0f);
104 RNA_def_property_ui_text(prop, "Draw Size", "Apparent size of the Camera object in the 3D View.");
105 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
107 prop= RNA_def_property(srna, "shift_x", PROP_FLOAT, PROP_NONE);
108 RNA_def_property_float_sdna(prop, NULL, "shiftx");
109 RNA_def_property_range(prop, -2.0f, 2.0f);
110 RNA_def_property_ui_text(prop, "Shift X", "Perspective Camera horizontal shift.");
111 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
113 prop= RNA_def_property(srna, "shift_y", PROP_FLOAT, PROP_NONE);
114 RNA_def_property_float_sdna(prop, NULL, "shifty");
115 RNA_def_property_range(prop, -2.0f, 2.0f);
116 RNA_def_property_ui_text(prop, "Shift Y", "Perspective Camera vertical shift.");
117 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
119 prop= RNA_def_property(srna, "dof_distance", PROP_FLOAT, PROP_NONE);
120 RNA_def_property_float_sdna(prop, NULL, "YF_dofdist");
121 RNA_def_property_range(prop, 0.0f, 5000.0f);
122 RNA_def_property_ui_text(prop, "DOF Distance", "Distance to the focus point for depth of field.");
123 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
126 prop= RNA_def_property(srna, "show_limits", PROP_BOOLEAN, PROP_NONE);
127 RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_SHOWLIMITS);
128 RNA_def_property_ui_text(prop, "Show Limits", "Draw the clipping range and focus point on the camera.");
129 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
131 prop= RNA_def_property(srna, "show_mist", PROP_BOOLEAN, PROP_NONE);
132 RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_SHOWMIST);
133 RNA_def_property_ui_text(prop, "Show Mist", "Draw a line from the Camera to indicate the mist area.");
134 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
136 prop= RNA_def_property(srna, "show_passepartout", PROP_BOOLEAN, PROP_NONE);
137 RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_SHOWPASSEPARTOUT);
138 RNA_def_property_ui_text(prop, "Show Passepartout", "Show a darkened overlay outside the image area in Camera view.");
139 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
141 prop= RNA_def_property(srna, "show_title_safe", PROP_BOOLEAN, PROP_NONE);
142 RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_SHOWTITLESAFE);
143 RNA_def_property_ui_text(prop, "Show Title Safe", "Show indicators for the title safe zone in Camera view.");
144 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
146 prop= RNA_def_property(srna, "show_name", PROP_BOOLEAN, PROP_NONE);
147 RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_SHOWNAME);
148 RNA_def_property_ui_text(prop, "Show Name", "Show the active Camera's name in Camera view.");
149 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
151 prop= RNA_def_property(srna, "lens_unit", PROP_ENUM, PROP_NONE);
152 RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
153 RNA_def_property_enum_items(prop, prop_lens_unit_items);
154 RNA_def_property_ui_text(prop, "Lens Unit", "Unit to edit lens in for the user interface.");
156 prop= RNA_def_property(srna, "panorama", PROP_BOOLEAN, PROP_NONE);
157 RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_PANORAMA);
158 RNA_def_property_ui_text(prop, "Panorama", "Render the scene with a cylindrical camera for pseudo-fisheye lens effects.");
159 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
162 rna_def_animdata_common(srna);
164 prop= RNA_def_property(srna, "dof_object", PROP_POINTER, PROP_NONE);
165 RNA_def_property_struct_type(prop, "Object");
166 RNA_def_property_pointer_sdna(prop, NULL, "dof_ob");
167 RNA_def_property_flag(prop, PROP_EDITABLE);
168 RNA_def_property_ui_text(prop, "DOF Object", "Use this object to define the depth of field focal point.");
169 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);