diff options
author | Willian Padovani Germano <wpgermano@gmail.com> | 2008-11-29 22:53:49 +0300 |
---|---|---|
committer | Willian Padovani Germano <wpgermano@gmail.com> | 2008-11-29 22:53:49 +0300 |
commit | fc20b877688367c8ed3b2871e0bd095a0dafab37 (patch) | |
tree | 19feec5fae7e39040d3246bf814ea28f9f45da57 /source/blender | |
parent | 2b7e3909670bd06f967884a908b9f805ec10dc3f (diff) |
RNA
Adding support for Cameras. Work in progress, I'm still learning about RNA.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/makesrna/RNA_access.h | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/makesrna.c | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_ID.c | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_camera.c | 133 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_internal.h | 1 |
5 files changed, 137 insertions, 0 deletions
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index a42ae8b16fc..851ea8bee9b 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -83,6 +83,7 @@ extern StructRNA RNA_Operator; extern StructRNA RNA_WindowManager; extern StructRNA RNA_Sensor; extern StructRNA RNA_MouseSensor; +extern StructRNA RNA_Camera; /* Pointer * diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index fd2a3c4124a..2842da1d72a 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -888,6 +888,7 @@ RNAProcessItem PROCESS_ITEMS[]= { {"rna_screen.c", RNA_def_screen}, {"rna_wm.c", RNA_def_wm}, {"rna_sensor.c", RNA_def_sensor}, + {"rna_camera.c", RNA_def_camera}, {NULL, NULL}}; static int rna_preprocess(char *basedirectory, FILE *f) diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index 4974d21e755..2277389d3ff 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -58,6 +58,7 @@ static StructRNA *rna_ID_refine(PointerRNA *ptr) ID *id= (ID*)ptr->data; switch(GS(id->name)) { + case ID_CA: return &RNA_Camera; case ID_LA: return &RNA_Lamp; case ID_LI: return &RNA_Library; case ID_MA: return &RNA_Material; diff --git a/source/blender/makesrna/intern/rna_camera.c b/source/blender/makesrna/intern/rna_camera.c new file mode 100644 index 00000000000..1fb3893bf5c --- /dev/null +++ b/source/blender/makesrna/intern/rna_camera.c @@ -0,0 +1,133 @@ +/** + * $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_camera_types.h" + +#ifdef RNA_RUNTIME + +#else + +void RNA_def_camera(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + static EnumPropertyItem prop_type_items[] = { + {CAM_PERSP, "PERSP", "Perspective", ""}, + {CAM_ORTHO, "ORTHO", "Orthographic", ""}, + {0, NULL, NULL, NULL}}; + + srna= RNA_def_struct(brna, "Camera", "ID", "Camera"); + + /* Enums */ + prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, prop_type_items); + RNA_def_property_ui_text(prop, "Type", "Camera types."); + + /* Number values */ + + prop= RNA_def_property(srna, "passepartout_alpha", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "passepartalpha"); + RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_ui_text(prop, "Passepartout Alpha", "Opacity (alpha) of the passepartout area in Camera view."); + + prop= RNA_def_property(srna, "angle", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "angle"); + RNA_def_property_range(prop, 0.0f, 100.0f); + RNA_def_property_ui_text(prop, "Angle", "Perspective Camera lens in degrees."); + + prop= RNA_def_property(srna, "clip_start", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "clipsta"); + RNA_def_property_range(prop, 0.0f, 100.0f); + RNA_def_property_ui_text(prop, "Clip Start", "Camera clipping start."); + + prop= RNA_def_property(srna, "clip_end", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "clipend"); + RNA_def_property_range(prop, 1.0f, 5000.0f); + RNA_def_property_ui_text(prop, "Clip End", "Camera clipping end."); + + prop= RNA_def_property(srna, "lens", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "lens"); + RNA_def_property_range(prop, 1.0f, 250.0f); + RNA_def_property_ui_text(prop, "Lens", "Perspective Camera lens in mm."); + + prop= RNA_def_property(srna, "ortho_scale", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "ortho_scale"); + RNA_def_property_range(prop, 0.01f, 1000.0f); + RNA_def_property_ui_text(prop, "Orthographic Scale", "Ortographic Camera scale."); + + prop= RNA_def_property(srna, "draw_size", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "drawsize"); + RNA_def_property_range(prop, 0.1f, 10.0f); + RNA_def_property_ui_text(prop, "Draw Size", "Apparent size of the Camera object in the 3D View."); + + prop= RNA_def_property(srna, "shift_x", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "shiftx"); + RNA_def_property_range(prop, -2.0f, 2.0f); + RNA_def_property_ui_text(prop, "Shift X", "Perspective Camera horizontal shift."); + + prop= RNA_def_property(srna, "shift_y", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "shifty"); + RNA_def_property_range(prop, -2.0f, 2.0f); + RNA_def_property_ui_text(prop, "Shift Y", "Perspective Camera vertical shift."); + + prop= RNA_def_property(srna, "dof_distance", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "YF_dofdist"); + RNA_def_property_range(prop, 0.0f, 5000.0f); + RNA_def_property_ui_text(prop, "DOF Distance", "Depth of field distance."); + + /* flag */ + prop= RNA_def_property(srna, "show_limits", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_SHOWLIMITS); + RNA_def_property_ui_text(prop, "Show Limits", "Draw the clipping range and focal point in Camera view."); + + prop= RNA_def_property(srna, "show_mist", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_SHOWMIST); + RNA_def_property_ui_text(prop, "Show Mist", "Draw a line from the Camera to indicate the mist area."); + + prop= RNA_def_property(srna, "show_passepartout", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_SHOWPASSEPARTOUT); + RNA_def_property_ui_text(prop, "Show Passepartout", "Enable passepartout mode in Camera view."); + + prop= RNA_def_property(srna, "show_title_safe", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_SHOWTITLESAFE); + RNA_def_property_ui_text(prop, "Show Title Safe", "Draw a title safe zone in Camera view."); + + prop= RNA_def_property(srna, "show_name", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_SHOWNAME); + RNA_def_property_ui_text(prop, "Show Name", "Draw the active Camera's name in Camera view."); + + prop= RNA_def_property(srna, "angle_toggle", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_ANGLETOGGLE); + RNA_def_property_ui_text(prop, "Angle Toggle", "Use degrees instead of mm as the unit of the Camera lens."); +} + +#endif + diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h index 0a6efa1fed9..9cc6606c40b 100644 --- a/source/blender/makesrna/intern/rna_internal.h +++ b/source/blender/makesrna/intern/rna_internal.h @@ -93,6 +93,7 @@ void RNA_def_scene(struct BlenderRNA *brna); void RNA_def_screen(struct BlenderRNA *brna); void RNA_def_wm(struct BlenderRNA *brna); void RNA_def_sensor(struct BlenderRNA *brna); +void RNA_def_camera(struct BlenderRNA *brna); /* ID Properties */ |