2011-02-23 10:52:22 +00:00
|
|
|
/*
|
2008-11-29 19:53:49 +00:00
|
|
|
* 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,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2008-11-29 19:53:49 +00:00
|
|
|
*/
|
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
* \ingroup RNA
|
2011-02-27 20:20:01 +00:00
|
|
|
*/
|
|
|
|
|
2008-11-29 19:53:49 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#include "DNA_camera_types.h"
|
|
|
|
|
2010-01-26 11:25:39 +00:00
|
|
|
#include "BLI_math.h"
|
|
|
|
|
2017-10-26 21:40:37 +11:00
|
|
|
#include "RNA_access.h"
|
2013-03-07 02:44:55 +00:00
|
|
|
#include "RNA_define.h"
|
|
|
|
|
|
|
|
#include "rna_internal.h"
|
|
|
|
|
2017-10-26 21:40:37 +11:00
|
|
|
#include "WM_api.h"
|
2009-01-05 05:42:48 +00:00
|
|
|
#include "WM_types.h"
|
|
|
|
|
2008-11-29 19:53:49 +00:00
|
|
|
#ifdef RNA_RUNTIME
|
|
|
|
|
2011-11-18 21:19:03 +00:00
|
|
|
#include "BKE_camera.h"
|
2010-04-15 04:56:44 +00:00
|
|
|
#include "BKE_object.h"
|
2017-11-24 12:19:26 +01:00
|
|
|
#include "BKE_sequencer.h"
|
2017-06-08 10:14:53 +02:00
|
|
|
|
|
|
|
#include "DEG_depsgraph.h"
|
|
|
|
#include "DEG_depsgraph_build.h"
|
2009-10-01 04:14:43 +00:00
|
|
|
|
2010-02-04 21:48:10 +00:00
|
|
|
static float rna_Camera_angle_get(PointerRNA *ptr)
|
|
|
|
{
|
2012-03-05 23:30:41 +00:00
|
|
|
Camera *cam = ptr->id.data;
|
2012-05-05 00:58:22 +00:00
|
|
|
float sensor = BKE_camera_sensor_size(cam->sensor_fit, cam->sensor_x, cam->sensor_y);
|
2011-11-04 14:36:06 +00:00
|
|
|
return focallength_to_fov(cam->lens, sensor);
|
2010-02-04 21:48:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void rna_Camera_angle_set(PointerRNA *ptr, float value)
|
|
|
|
{
|
2012-03-05 23:30:41 +00:00
|
|
|
Camera *cam = ptr->id.data;
|
2012-05-05 00:58:22 +00:00
|
|
|
float sensor = BKE_camera_sensor_size(cam->sensor_fit, cam->sensor_x, cam->sensor_y);
|
2012-03-05 23:30:41 +00:00
|
|
|
cam->lens = fov_to_focallength(value, sensor);
|
2011-11-04 14:36:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static float rna_Camera_angle_x_get(PointerRNA *ptr)
|
|
|
|
{
|
2012-03-05 23:30:41 +00:00
|
|
|
Camera *cam = ptr->id.data;
|
2011-11-04 14:36:06 +00:00
|
|
|
return focallength_to_fov(cam->lens, cam->sensor_x);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void rna_Camera_angle_x_set(PointerRNA *ptr, float value)
|
|
|
|
{
|
2012-03-05 23:30:41 +00:00
|
|
|
Camera *cam = ptr->id.data;
|
|
|
|
cam->lens = fov_to_focallength(value, cam->sensor_x);
|
2011-11-04 14:36:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static float rna_Camera_angle_y_get(PointerRNA *ptr)
|
|
|
|
{
|
2012-03-05 23:30:41 +00:00
|
|
|
Camera *cam = ptr->id.data;
|
2011-11-04 14:36:06 +00:00
|
|
|
return focallength_to_fov(cam->lens, cam->sensor_y);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void rna_Camera_angle_y_set(PointerRNA *ptr, float value)
|
|
|
|
{
|
2012-03-05 23:30:41 +00:00
|
|
|
Camera *cam = ptr->id.data;
|
|
|
|
cam->lens = fov_to_focallength(value, cam->sensor_y);
|
2011-11-04 14:36:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void rna_Camera_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Camera *camera = (Camera *)ptr->id.data;
|
2011-11-04 14:36:06 +00:00
|
|
|
|
2017-06-08 10:14:53 +02:00
|
|
|
DEG_id_tag_update(&camera->id, 0);
|
2010-02-04 21:48:10 +00:00
|
|
|
}
|
2009-10-01 04:14:43 +00:00
|
|
|
|
2015-05-12 13:29:00 +05:00
|
|
|
static void rna_Camera_dependency_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
|
|
|
|
{
|
|
|
|
Camera *camera = (Camera *)ptr->id.data;
|
2017-06-08 10:14:53 +02:00
|
|
|
DEG_relations_tag_update(bmain);
|
|
|
|
DEG_id_tag_update(&camera->id, 0);
|
2015-05-12 13:29:00 +05:00
|
|
|
}
|
|
|
|
|
2017-10-26 21:40:37 +11:00
|
|
|
static CameraBGImage *rna_Camera_background_images_new(Camera *cam)
|
|
|
|
{
|
|
|
|
CameraBGImage *bgpic = BKE_camera_background_image_new(cam);
|
|
|
|
|
|
|
|
WM_main_add_notifier(NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, cam);
|
|
|
|
|
|
|
|
return bgpic;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void rna_Camera_background_images_remove(Camera *cam, ReportList *reports, PointerRNA *bgpic_ptr)
|
|
|
|
{
|
|
|
|
CameraBGImage *bgpic = bgpic_ptr->data;
|
|
|
|
if (BLI_findindex(&cam->bg_images, bgpic) == -1) {
|
|
|
|
BKE_report(reports, RPT_ERROR, "Background image cannot be removed");
|
|
|
|
}
|
|
|
|
|
|
|
|
BKE_camera_background_image_remove(cam, bgpic);
|
|
|
|
RNA_POINTER_INVALIDATE(bgpic_ptr);
|
|
|
|
|
|
|
|
WM_main_add_notifier(NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, cam);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void rna_Camera_background_images_clear(Camera *cam)
|
|
|
|
{
|
|
|
|
BKE_camera_background_image_clear(cam);
|
|
|
|
|
|
|
|
WM_main_add_notifier(NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, cam);
|
|
|
|
}
|
|
|
|
|
2017-11-24 12:19:26 +01:00
|
|
|
static void rna_Camera_dof_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
|
|
|
|
{
|
|
|
|
/* TODO(sergey): Can be more selective here. */
|
|
|
|
BKE_sequencer_cache_cleanup();
|
|
|
|
BKE_sequencer_preprocessed_cache_cleanup();
|
|
|
|
WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene);
|
|
|
|
}
|
|
|
|
|
2008-11-29 19:53:49 +00:00
|
|
|
#else
|
|
|
|
|
2017-10-26 21:40:37 +11:00
|
|
|
static void rna_def_camera_background_image(BlenderRNA *brna)
|
|
|
|
{
|
|
|
|
StructRNA *srna;
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
static const EnumPropertyItem bgpic_source_items[] = {
|
|
|
|
{CAM_BGIMG_SOURCE_IMAGE, "IMAGE", 0, "Image", ""},
|
|
|
|
{CAM_BGIMG_SOURCE_MOVIE, "MOVIE_CLIP", 0, "Movie Clip", ""},
|
2019-02-03 14:01:45 +11:00
|
|
|
{0, NULL, 0, NULL, NULL},
|
2017-10-26 21:40:37 +11:00
|
|
|
};
|
|
|
|
|
|
|
|
static const EnumPropertyItem bgpic_camera_frame_items[] = {
|
|
|
|
{0, "STRETCH", 0, "Stretch", ""},
|
|
|
|
{CAM_BGIMG_FLAG_CAMERA_ASPECT, "FIT", 0, "Fit", ""},
|
|
|
|
{CAM_BGIMG_FLAG_CAMERA_ASPECT | CAM_BGIMG_FLAG_CAMERA_CROP, "CROP", 0, "Crop", ""},
|
2019-02-03 14:01:45 +11:00
|
|
|
{0, NULL, 0, NULL, NULL},
|
2017-10-26 21:40:37 +11:00
|
|
|
};
|
|
|
|
|
2018-09-03 18:58:41 +02:00
|
|
|
static const EnumPropertyItem bgpic_display_depth_items[] = {
|
2017-10-26 21:40:37 +11:00
|
|
|
{0, "BACK", 0, "Back", ""},
|
|
|
|
{CAM_BGIMG_FLAG_FOREGROUND, "FRONT", 0, "Front", ""},
|
2019-02-03 14:01:45 +11:00
|
|
|
{0, NULL, 0, NULL, NULL},
|
2017-10-26 21:40:37 +11:00
|
|
|
};
|
|
|
|
|
|
|
|
srna = RNA_def_struct(brna, "CameraBackgroundImage", NULL);
|
|
|
|
RNA_def_struct_sdna(srna, "CameraBGImage");
|
|
|
|
RNA_def_struct_ui_text(srna, "Background Image", "Image and settings for display in the 3D View background");
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "source", PROP_ENUM, PROP_NONE);
|
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "source");
|
|
|
|
RNA_def_property_enum_items(prop, bgpic_source_items);
|
|
|
|
RNA_def_property_ui_text(prop, "Background Source", "Data source used for background");
|
|
|
|
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
|
|
|
|
RNA_def_property_pointer_sdna(prop, NULL, "ima");
|
|
|
|
RNA_def_property_ui_text(prop, "Image", "Image displayed and edited in this space");
|
|
|
|
RNA_def_property_flag(prop, PROP_EDITABLE);
|
|
|
|
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
|
|
|
|
RNA_def_property_pointer_sdna(prop, NULL, "clip");
|
|
|
|
RNA_def_property_ui_text(prop, "MovieClip", "Movie clip displayed and edited in this space");
|
|
|
|
RNA_def_property_flag(prop, PROP_EDITABLE);
|
|
|
|
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NONE);
|
|
|
|
RNA_def_property_flag(prop, PROP_NEVER_NULL);
|
|
|
|
RNA_def_property_pointer_sdna(prop, NULL, "iuser");
|
|
|
|
RNA_def_property_ui_text(prop, "Image User",
|
|
|
|
"Parameters defining which layer, pass and frame of the image is displayed");
|
|
|
|
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "clip_user", PROP_POINTER, PROP_NONE);
|
|
|
|
RNA_def_property_flag(prop, PROP_NEVER_NULL);
|
|
|
|
RNA_def_property_struct_type(prop, "MovieClipUser");
|
|
|
|
RNA_def_property_pointer_sdna(prop, NULL, "cuser");
|
|
|
|
RNA_def_property_ui_text(prop, "Clip User", "Parameters defining which frame of the movie clip is displayed");
|
|
|
|
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_XYZ);
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "offset");
|
|
|
|
RNA_def_property_ui_text(prop, "Offset", "");
|
|
|
|
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_FACTOR);
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "scale");
|
|
|
|
RNA_def_property_ui_text(prop, "Scale", "Scale the background image");
|
|
|
|
RNA_def_property_range(prop, 0.0, FLT_MAX);
|
|
|
|
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_ANGLE);
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "rotation");
|
|
|
|
RNA_def_property_ui_text(prop, "Rotation", "Rotation for the background image (ortho view only)");
|
|
|
|
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "use_flip_x", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_BGIMG_FLAG_FLIP_X);
|
|
|
|
RNA_def_property_ui_text(prop, "Flip Horizontally", "Flip the background image horizontally");
|
|
|
|
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "use_flip_y", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_BGIMG_FLAG_FLIP_Y);
|
|
|
|
RNA_def_property_ui_text(prop, "Flip Vertically", "Flip the background image vertically");
|
|
|
|
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "alpha", PROP_FLOAT, PROP_NONE);
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "alpha");
|
|
|
|
RNA_def_property_ui_text(prop, "Alpha", "Image opacity to blend the image against the background color");
|
|
|
|
RNA_def_property_range(prop, 0.0, 1.0);
|
|
|
|
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
|
2019-04-01 10:22:06 +02:00
|
|
|
RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE);
|
2017-10-26 21:40:37 +11:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_BGIMG_FLAG_EXPANDED);
|
|
|
|
RNA_def_property_ui_text(prop, "Show Expanded", "Show the expanded in the user interface");
|
2018-11-22 15:31:19 +11:00
|
|
|
RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1);
|
2017-10-26 21:40:37 +11:00
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "use_camera_clip", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_BGIMG_FLAG_CAMERACLIP);
|
|
|
|
RNA_def_property_ui_text(prop, "Camera Clip", "Use movie clip from active scene camera");
|
|
|
|
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "show_background_image", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CAM_BGIMG_FLAG_DISABLED);
|
|
|
|
RNA_def_property_ui_text(prop, "Show Background Image", "Show this image as background");
|
|
|
|
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "show_on_foreground", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_BGIMG_FLAG_FOREGROUND);
|
|
|
|
RNA_def_property_ui_text(prop, "Show On Foreground", "Show this image in front of objects in viewport");
|
|
|
|
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
|
|
|
|
|
|
|
|
/* expose 1 flag as a enum of 2 items */
|
2018-09-03 18:58:41 +02:00
|
|
|
prop = RNA_def_property(srna, "display_depth", PROP_ENUM, PROP_NONE);
|
2017-10-26 21:40:37 +11:00
|
|
|
RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
|
2018-09-03 18:58:41 +02:00
|
|
|
RNA_def_property_enum_items(prop, bgpic_display_depth_items);
|
|
|
|
RNA_def_property_ui_text(prop, "Depth", "Display under or over everything");
|
2017-10-26 21:40:37 +11:00
|
|
|
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
|
|
|
|
|
|
|
|
/* expose 2 flags as a enum of 3 items */
|
|
|
|
prop = RNA_def_property(srna, "frame_method", PROP_ENUM, PROP_NONE);
|
|
|
|
RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
|
|
|
|
RNA_def_property_enum_items(prop, bgpic_camera_frame_items);
|
|
|
|
RNA_def_property_ui_text(prop, "Frame Method", "How the image fits in the camera frame");
|
|
|
|
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void rna_def_camera_background_images(BlenderRNA *brna, PropertyRNA *cprop)
|
|
|
|
{
|
|
|
|
StructRNA *srna;
|
|
|
|
FunctionRNA *func;
|
|
|
|
PropertyRNA *parm;
|
|
|
|
|
|
|
|
RNA_def_property_srna(cprop, "CameraBackgroundImages");
|
|
|
|
srna = RNA_def_struct(brna, "CameraBackgroundImages", NULL);
|
|
|
|
RNA_def_struct_sdna(srna, "Camera");
|
|
|
|
RNA_def_struct_ui_text(srna, "Background Images", "Collection of background images");
|
|
|
|
|
|
|
|
func = RNA_def_function(srna, "new", "rna_Camera_background_images_new");
|
|
|
|
RNA_def_function_ui_description(func, "Add new background image");
|
|
|
|
parm = RNA_def_pointer(func, "image", "CameraBackgroundImage", "", "Image displayed as viewport background");
|
|
|
|
RNA_def_function_return(func, parm);
|
|
|
|
|
|
|
|
func = RNA_def_function(srna, "remove", "rna_Camera_background_images_remove");
|
|
|
|
RNA_def_function_ui_description(func, "Remove background image");
|
|
|
|
RNA_def_function_flag(func, FUNC_USE_REPORTS);
|
|
|
|
parm = RNA_def_pointer(func, "image", "CameraBackgroundImage", "", "Image displayed as viewport background");
|
|
|
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
|
|
|
|
RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
|
|
|
|
|
|
|
|
func = RNA_def_function(srna, "clear", "rna_Camera_background_images_clear");
|
|
|
|
RNA_def_function_ui_description(func, "Remove all background images");
|
|
|
|
}
|
|
|
|
|
2015-04-06 10:40:12 -03:00
|
|
|
static void rna_def_camera_stereo_data(BlenderRNA *brna)
|
|
|
|
{
|
|
|
|
StructRNA *srna;
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
2017-10-18 15:07:26 +11:00
|
|
|
static const EnumPropertyItem convergence_mode_items[] = {
|
2015-04-06 20:43:34 +02:00
|
|
|
{CAM_S3D_OFFAXIS, "OFFAXIS", 0, "Off-Axis", "Off-axis frustums converging in a plane"},
|
2015-04-06 10:40:12 -03:00
|
|
|
{CAM_S3D_PARALLEL, "PARALLEL", 0, "Parallel", "Parallel cameras with no convergence"},
|
|
|
|
{CAM_S3D_TOE, "TOE", 0, "Toe-in", "Rotated cameras, looking at the convergence distance"},
|
2019-02-03 14:01:45 +11:00
|
|
|
{0, NULL, 0, NULL, NULL},
|
2015-04-06 10:40:12 -03:00
|
|
|
};
|
|
|
|
|
2017-10-18 15:07:26 +11:00
|
|
|
static const EnumPropertyItem pivot_items[] = {
|
2015-04-06 10:40:12 -03:00
|
|
|
{CAM_S3D_PIVOT_LEFT, "LEFT", 0, "Left", ""},
|
|
|
|
{CAM_S3D_PIVOT_RIGHT, "RIGHT", 0, "Right", ""},
|
|
|
|
{CAM_S3D_PIVOT_CENTER, "CENTER", 0, "Center", ""},
|
2019-02-03 14:01:45 +11:00
|
|
|
{0, NULL, 0, NULL, NULL},
|
2015-04-06 10:40:12 -03:00
|
|
|
};
|
|
|
|
|
|
|
|
srna = RNA_def_struct(brna, "CameraStereoData", NULL);
|
|
|
|
RNA_def_struct_sdna(srna, "CameraStereoSettings");
|
|
|
|
RNA_def_struct_nested(brna, srna, "Camera");
|
2015-10-24 02:44:43 +11:00
|
|
|
RNA_def_struct_ui_text(srna, "Stereo", "Stereoscopy settings for a Camera data-block");
|
2015-04-06 10:40:12 -03:00
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "convergence_mode", PROP_ENUM, PROP_NONE);
|
|
|
|
RNA_def_property_enum_items(prop, convergence_mode_items);
|
|
|
|
RNA_def_property_ui_text(prop, "Mode", "");
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "pivot", PROP_ENUM, PROP_NONE);
|
|
|
|
RNA_def_property_enum_items(prop, pivot_items);
|
|
|
|
RNA_def_property_ui_text(prop, "Pivot", "");
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "interocular_distance", PROP_FLOAT, PROP_DISTANCE);
|
2016-05-28 12:21:59 +02:00
|
|
|
RNA_def_property_range(prop, 0.0f, FLT_MAX);
|
2016-05-28 12:36:52 +02:00
|
|
|
RNA_def_property_ui_range(prop, 0.0f, 1e4f, 1, 3);
|
2015-04-06 20:43:34 +02:00
|
|
|
RNA_def_property_ui_text(prop, "Interocular Distance",
|
|
|
|
"Set the distance between the eyes - the stereo plane distance / 30 should be fine");
|
2015-04-06 10:40:12 -03:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "convergence_distance", PROP_FLOAT, PROP_DISTANCE);
|
|
|
|
RNA_def_property_range(prop, 0.00001f, FLT_MAX);
|
2016-05-06 12:32:23 +02:00
|
|
|
RNA_def_property_ui_range(prop, 0.00001f, 15.f, 1, 3);
|
2015-04-06 20:43:34 +02:00
|
|
|
RNA_def_property_ui_text(prop, "Convergence Plane Distance",
|
|
|
|
"The converge point for the stereo cameras "
|
|
|
|
"(often the distance between a projector and the projection screen)");
|
2015-04-06 10:40:12 -03:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
|
Multi-View: Cycles - Spherical Stereo support (VR Panoramas)
This is a new option for panorama cameras to render
stereo that can be used in virtual reality devices
The option is available under the camera panel when Multi-View is enabled (Views option in the Render Layers panel)
Known limitations:
------------------
* Parallel convergence is not supported (you need to set a convergence distance really high to simulate this effect).
* Pivot was not supposed to affect the render but it does, this has to be looked at, but for now set it to CENTER
* Derivatives in perspective camera need to be pre-computed or we shuld get rid of kcam->dx/dy (Sergey words, I don't fully grasp the implication shere)
* This works in perspective mode and in panorama mode. However, for fully benefit from this effect in perspective mode you need to render a cube map. (there is an addon for this, developed separately, perhaps we could include it in master).
* We have no support for "neck distance" at the moment. This is supposed to help with objects at short distances.
* We have no support to rotate the "Up Axis" of the stereo plane. Meaning, we hardcode 0,0,1 as UP, and create the stereo pair related to that. (although we could take the camera local UP when rendering panoramas, this wouldn't work for perspective cameras.
* We have no support for interocular distance attenuation based on the proximity of the poles (which helps to reduce the pole rotation effect/artifact).
THIS NEEDS DOCS - both in 2.78 release log and the Blender manual.
Meanwhile you can read about it here: http://code.blender.org/2015/03/1451
This patch specifically dates from March 2015, as you can see in the code.blender.org post. Many thanks to all the reviewers, testers and minor sponsors who helped me maintain spherical-stereo for 1 year.
All that said, have fun with this. This feature was what got me started with Multi-View development (at the time what I was looking for was Fulldome stereo support, but the implementation is the same). In order to make this into Blender I had to make it aiming at a less-specic user-case Thus Multi-View started. (this was December 2012, during Siggraph Asia and a chat I had with Paul Bourke during the conference). I don't have the original patch anymore, but you can find a re-based version of it from March 2013, right before I start with the Multi-View project https://developer.blender.org/P332
Reviewers: sergey, dingto
Subscribers: #cycles
Differential Revision: https://developer.blender.org/D1223
2016-03-10 09:28:29 -03:00
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "use_spherical_stereo", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_S3D_SPHERICAL);
|
|
|
|
RNA_def_property_ui_text(prop, "Spherical Stereo",
|
|
|
|
"Render every pixel rotating the camera around the "
|
|
|
|
"middle of the interocular distance");
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
|
2016-05-17 14:12:29 +02:00
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "use_pole_merge", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_S3D_POLE_MERGE);
|
|
|
|
RNA_def_property_ui_text(prop, "Use Pole Merge",
|
|
|
|
"Fade interocular distance to 0 after the given cutoff angle");
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "pole_merge_angle_from", PROP_FLOAT, PROP_ANGLE);
|
2016-07-22 04:05:38 +10:00
|
|
|
RNA_def_property_range(prop, 0.0f, M_PI / 2.0);
|
2016-05-17 14:12:29 +02:00
|
|
|
RNA_def_property_ui_text(prop, "Pole Merge Start Angle",
|
|
|
|
"Angle at which interocular distance starts to fade to 0");
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "pole_merge_angle_to", PROP_FLOAT, PROP_ANGLE);
|
2016-07-22 04:05:38 +10:00
|
|
|
RNA_def_property_range(prop, 0.0f, M_PI / 2.0);
|
2016-05-17 14:12:29 +02:00
|
|
|
RNA_def_property_ui_text(prop, "Pole Merge End Angle",
|
|
|
|
"Angle at which interocular distance is 0");
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
|
2015-04-06 10:40:12 -03:00
|
|
|
}
|
|
|
|
|
2008-11-29 19:53:49 +00:00
|
|
|
void RNA_def_camera(BlenderRNA *brna)
|
|
|
|
{
|
|
|
|
StructRNA *srna;
|
|
|
|
PropertyRNA *prop;
|
2017-10-18 15:07:26 +11:00
|
|
|
static const EnumPropertyItem prop_type_items[] = {
|
2009-06-16 00:52:21 +00:00
|
|
|
{CAM_PERSP, "PERSP", 0, "Perspective", ""},
|
|
|
|
{CAM_ORTHO, "ORTHO", 0, "Orthographic", ""},
|
2012-05-04 16:20:51 +00:00
|
|
|
{CAM_PANO, "PANO", 0, "Panoramic", ""},
|
2019-02-03 14:01:45 +11:00
|
|
|
{0, NULL, 0, NULL, NULL},
|
2012-05-12 11:01:29 +00:00
|
|
|
};
|
2017-10-18 15:07:26 +11:00
|
|
|
static const EnumPropertyItem prop_lens_unit_items[] = {
|
2012-12-31 14:52:55 +00:00
|
|
|
{0, "MILLIMETERS", 0, "Millimeters", "Specify the lens in millimeters"},
|
|
|
|
{CAM_ANGLETOGGLE, "FOV", 0, "Field of View", "Specify the lens as the field of view's angle"},
|
2019-02-03 14:01:45 +11:00
|
|
|
{0, NULL, 0, NULL, NULL},
|
2012-05-12 11:01:29 +00:00
|
|
|
};
|
2017-10-18 15:07:26 +11:00
|
|
|
static const EnumPropertyItem sensor_fit_items[] = {
|
2011-11-18 23:15:11 +00:00
|
|
|
{CAMERA_SENSOR_FIT_AUTO, "AUTO", 0, "Auto", "Fit to the sensor width or height depending on image resolution"},
|
|
|
|
{CAMERA_SENSOR_FIT_HOR, "HORIZONTAL", 0, "Horizontal", "Fit to the sensor width"},
|
|
|
|
{CAMERA_SENSOR_FIT_VERT, "VERTICAL", 0, "Vertical", "Fit to the sensor height"},
|
2019-02-03 14:01:45 +11:00
|
|
|
{0, NULL, 0, NULL, NULL},
|
2012-05-12 11:01:29 +00:00
|
|
|
};
|
2008-11-29 19:53:49 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
srna = RNA_def_struct(brna, "Camera", "ID");
|
2015-10-24 02:44:43 +11:00
|
|
|
RNA_def_struct_ui_text(srna, "Camera", "Camera data-block for storing camera settings");
|
2009-06-03 23:16:51 +00:00
|
|
|
RNA_def_struct_ui_icon(srna, ICON_CAMERA_DATA);
|
2008-11-29 19:53:49 +00:00
|
|
|
|
|
|
|
/* Enums */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
|
2008-11-29 19:53:49 +00:00
|
|
|
RNA_def_property_enum_items(prop, prop_type_items);
|
2010-02-10 20:41:01 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Type", "Camera types");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_update");
|
2011-05-10 03:03:53 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "sensor_fit", PROP_ENUM, PROP_NONE);
|
2011-11-04 14:36:06 +00:00
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "sensor_fit");
|
|
|
|
RNA_def_property_enum_items(prop, sensor_fit_items);
|
2011-11-18 23:15:11 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Sensor Fit", "Method to fit image and field of view angle inside the sensor");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_update");
|
2011-11-04 14:36:06 +00:00
|
|
|
|
2008-11-29 19:53:49 +00:00
|
|
|
/* Number values */
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "passepartout_alpha", PROP_FLOAT, PROP_FACTOR);
|
2008-11-29 19:53:49 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "passepartalpha");
|
2018-07-26 12:29:16 +02:00
|
|
|
RNA_def_property_float_default(prop, 0.5f);
|
2010-02-10 20:41:01 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Passepartout Alpha", "Opacity (alpha) of the darkened overlay in Camera view");
|
2015-01-19 15:40:05 +11:00
|
|
|
RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
|
2008-11-29 19:53:49 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "angle_x", PROP_FLOAT, PROP_ANGLE);
|
2012-12-31 14:52:55 +00:00
|
|
|
RNA_def_property_range(prop, DEG2RAD(0.367), DEG2RAD(172.847));
|
2011-11-04 14:36:06 +00:00
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
2012-12-31 14:52:55 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Horizontal FOV", "Camera lens horizontal field of view");
|
2011-11-04 14:36:06 +00:00
|
|
|
RNA_def_property_float_funcs(prop, "rna_Camera_angle_x_get", "rna_Camera_angle_x_set", NULL);
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_update");
|
2011-11-04 14:36:06 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "angle_y", PROP_FLOAT, PROP_ANGLE);
|
2012-12-31 14:52:55 +00:00
|
|
|
RNA_def_property_range(prop, DEG2RAD(0.367), DEG2RAD(172.847));
|
2011-11-04 14:36:06 +00:00
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
2012-12-31 14:52:55 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Vertical FOV", "Camera lens vertical field of view");
|
2011-11-04 14:36:06 +00:00
|
|
|
RNA_def_property_float_funcs(prop, "rna_Camera_angle_y_get", "rna_Camera_angle_y_set", NULL);
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_update");
|
2011-11-04 14:36:06 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
|
2012-12-31 14:52:55 +00:00
|
|
|
RNA_def_property_range(prop, DEG2RAD(0.367), DEG2RAD(172.847));
|
2011-11-04 14:36:06 +00:00
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
2012-12-31 14:52:55 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Field of View", "Camera lens field of view");
|
2011-11-04 14:36:06 +00:00
|
|
|
RNA_def_property_float_funcs(prop, "rna_Camera_angle_get", "rna_Camera_angle_set", NULL);
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_update");
|
2011-11-04 14:36:06 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "clip_start", PROP_FLOAT, PROP_DISTANCE);
|
2018-07-26 12:29:16 +02:00
|
|
|
RNA_def_property_float_default(prop, 0.1f);
|
2016-06-23 18:43:36 +10:00
|
|
|
RNA_def_property_range(prop, 1e-6f, FLT_MAX);
|
|
|
|
RNA_def_property_ui_range(prop, 0.001f, FLT_MAX, 10, 3);
|
2010-02-10 20:41:01 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Clip Start", "Camera near clipping distance");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
|
2008-11-29 19:53:49 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "clip_end", PROP_FLOAT, PROP_DISTANCE);
|
2018-07-26 12:29:16 +02:00
|
|
|
RNA_def_property_float_default(prop, 1000.0f);
|
2016-06-23 18:43:36 +10:00
|
|
|
RNA_def_property_range(prop, 1e-6f, FLT_MAX);
|
|
|
|
RNA_def_property_ui_range(prop, 0.001f, FLT_MAX, 10, 3);
|
2010-02-10 20:41:01 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Clip End", "Camera far clipping distance");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
|
2008-11-29 19:53:49 +00:00
|
|
|
|
2013-03-13 17:16:49 +00:00
|
|
|
prop = RNA_def_property(srna, "lens", PROP_FLOAT, PROP_DISTANCE_CAMERA);
|
2008-11-29 19:53:49 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "lens");
|
2018-07-26 12:29:16 +02:00
|
|
|
RNA_def_property_float_default(prop, 50.0f);
|
2013-11-25 05:26:25 +01:00
|
|
|
RNA_def_property_range(prop, 1.0f, FLT_MAX);
|
2019-03-28 15:56:53 +01:00
|
|
|
RNA_def_property_ui_range(prop, 1.0f, 5000.0f, 100, 4);
|
2010-09-27 05:16:45 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Focal Length", "Perspective Camera lens value in millimeters");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_update");
|
2011-11-04 14:36:06 +00:00
|
|
|
|
2013-03-13 17:16:49 +00:00
|
|
|
prop = RNA_def_property(srna, "sensor_width", PROP_FLOAT, PROP_DISTANCE_CAMERA);
|
2011-11-04 14:36:06 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "sensor_x");
|
2018-07-26 12:29:16 +02:00
|
|
|
RNA_def_property_float_default(prop, 36.0f);
|
2011-11-04 14:36:06 +00:00
|
|
|
RNA_def_property_range(prop, 1.0f, FLT_MAX);
|
2019-03-28 15:56:53 +01:00
|
|
|
RNA_def_property_ui_range(prop, 1.0f, 100.f, 100, 4);
|
2011-11-04 14:36:06 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Sensor Width", "Horizontal size of the image sensor area in millimeters");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_update");
|
2011-11-04 14:36:06 +00:00
|
|
|
|
2013-03-13 17:16:49 +00:00
|
|
|
prop = RNA_def_property(srna, "sensor_height", PROP_FLOAT, PROP_DISTANCE_CAMERA);
|
2011-11-04 14:36:06 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "sensor_y");
|
2018-07-26 12:29:16 +02:00
|
|
|
RNA_def_property_float_default(prop, 34.0f);
|
2011-11-04 14:36:06 +00:00
|
|
|
RNA_def_property_range(prop, 1.0f, FLT_MAX);
|
2019-03-28 15:56:53 +01:00
|
|
|
RNA_def_property_ui_range(prop, 1.0f, 100.f, 100, 4);
|
2011-11-04 14:36:06 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Sensor Height", "Vertical size of the image sensor area in millimeters");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_update");
|
2008-11-29 19:53:49 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "ortho_scale", PROP_FLOAT, PROP_NONE);
|
2008-11-29 19:53:49 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "ortho_scale");
|
2018-07-26 12:29:16 +02:00
|
|
|
RNA_def_property_float_default(prop, 6.0f);
|
2013-02-21 18:08:01 +00:00
|
|
|
RNA_def_property_range(prop, FLT_MIN, FLT_MAX);
|
|
|
|
RNA_def_property_ui_range(prop, 0.001f, 10000.0f, 10, 3);
|
2010-02-10 20:41:01 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Orthographic Scale", "Orthographic Camera scale (similar to zoom)");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_update");
|
2008-11-29 19:53:49 +00:00
|
|
|
|
2018-09-03 18:58:41 +02:00
|
|
|
prop = RNA_def_property(srna, "display_size", PROP_FLOAT, PROP_DISTANCE);
|
2008-11-29 19:53:49 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "drawsize");
|
2018-07-26 12:29:16 +02:00
|
|
|
RNA_def_property_float_default(prop, 1.0f);
|
2010-11-17 01:15:31 +00:00
|
|
|
RNA_def_property_range(prop, 0.01f, 1000.0f);
|
|
|
|
RNA_def_property_ui_range(prop, 0.01, 100, 1, 2);
|
2018-09-03 18:58:41 +02:00
|
|
|
RNA_def_property_ui_text(prop, "Display Size", "Apparent size of the Camera object in the 3D View");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
|
2008-11-29 19:53:49 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "shift_x", PROP_FLOAT, PROP_NONE);
|
2008-11-29 19:53:49 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "shiftx");
|
2010-02-09 16:05:12 +00:00
|
|
|
RNA_def_property_range(prop, -10.0f, 10.0f);
|
|
|
|
RNA_def_property_ui_range(prop, -2.0, 2.0, 1, 3);
|
2015-07-02 13:53:36 -03:00
|
|
|
RNA_def_property_ui_text(prop, "Shift X", "Camera horizontal shift");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_update");
|
2008-11-29 19:53:49 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "shift_y", PROP_FLOAT, PROP_NONE);
|
2008-11-29 19:53:49 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "shifty");
|
2010-02-09 16:05:12 +00:00
|
|
|
RNA_def_property_range(prop, -10.0f, 10.0f);
|
|
|
|
RNA_def_property_ui_range(prop, -2.0, 2.0, 1, 3);
|
2015-07-02 13:53:36 -03:00
|
|
|
RNA_def_property_ui_text(prop, "Shift Y", "Camera vertical shift");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_update");
|
2008-11-29 19:53:49 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "dof_distance", PROP_FLOAT, PROP_DISTANCE);
|
2013-11-25 05:26:25 +01:00
|
|
|
RNA_def_property_range(prop, 0.0f, FLT_MAX);
|
|
|
|
RNA_def_property_ui_range(prop, 0.0f, 5000.0f, 1, 2);
|
2010-02-10 20:41:01 +00:00
|
|
|
RNA_def_property_ui_text(prop, "DOF Distance", "Distance to the focus point for depth of field");
|
2017-11-24 12:19:26 +01:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_dof_update");
|
2008-11-29 19:53:49 +00:00
|
|
|
|
2015-04-06 10:40:12 -03:00
|
|
|
/* Stereo Settings */
|
|
|
|
prop = RNA_def_property(srna, "stereo", PROP_POINTER, PROP_NONE);
|
|
|
|
RNA_def_property_flag(prop, PROP_NEVER_NULL);
|
|
|
|
RNA_def_property_pointer_sdna(prop, NULL, "stereo");
|
|
|
|
RNA_def_property_struct_type(prop, "CameraStereoData");
|
|
|
|
RNA_def_property_ui_text(prop, "Stereo", "");
|
|
|
|
|
2008-11-29 19:53:49 +00:00
|
|
|
/* flag */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "show_limits", PROP_BOOLEAN, PROP_NONE);
|
2008-11-29 19:53:49 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_SHOWLIMITS);
|
2018-09-03 18:58:41 +02:00
|
|
|
RNA_def_property_ui_text(prop, "Show Limits", "Display the clipping range and focus point on the camera");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
|
2008-11-29 19:53:49 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "show_mist", PROP_BOOLEAN, PROP_NONE);
|
2008-11-29 19:53:49 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_SHOWMIST);
|
2018-09-03 18:58:41 +02:00
|
|
|
RNA_def_property_ui_text(prop, "Show Mist", "Display a line from the Camera to indicate the mist area");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
|
2008-11-29 19:53:49 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "show_passepartout", PROP_BOOLEAN, PROP_NONE);
|
2008-11-29 19:53:49 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_SHOWPASSEPARTOUT);
|
2018-07-26 12:29:16 +02:00
|
|
|
RNA_def_property_boolean_default(prop, true);
|
2012-03-18 09:27:36 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Show Passepartout",
|
|
|
|
"Show a darkened overlay outside the image area in Camera view");
|
2015-01-19 15:40:05 +11:00
|
|
|
RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
|
2008-11-29 19:53:49 +00:00
|
|
|
|
2015-01-19 16:30:35 +11:00
|
|
|
prop = RNA_def_property(srna, "show_safe_areas", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_SHOW_SAFE_MARGINS);
|
|
|
|
RNA_def_property_ui_text(prop, "Show Safe Areas", "Show TV title safe and action safe areas in Camera view");
|
|
|
|
RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "show_safe_center", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_SHOW_SAFE_CENTER);
|
2015-04-06 20:43:34 +02:00
|
|
|
RNA_def_property_ui_text(prop, "Show Center-cut safe areas",
|
|
|
|
"Show safe areas to fit content in a different aspect ratio");
|
2015-01-19 15:40:05 +11:00
|
|
|
RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
|
2008-11-29 19:53:49 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "show_name", PROP_BOOLEAN, PROP_NONE);
|
2008-11-29 19:53:49 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_SHOWNAME);
|
2010-02-10 20:41:01 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Show Name", "Show the active Camera's name in Camera view");
|
2015-01-19 15:40:05 +11:00
|
|
|
RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
|
2008-11-29 19:53:49 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "show_sensor", PROP_BOOLEAN, PROP_NONE);
|
2011-11-04 14:36:06 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_SHOWSENSOR);
|
|
|
|
RNA_def_property_ui_text(prop, "Show Sensor Size", "Show sensor size (film gate) in Camera view");
|
2015-01-19 15:40:05 +11:00
|
|
|
RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
|
2011-11-04 14:36:06 +00:00
|
|
|
|
2017-10-26 21:40:37 +11:00
|
|
|
prop = RNA_def_property(srna, "show_background_images", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_SHOW_BG_IMAGE);
|
|
|
|
RNA_def_property_ui_text(prop, "Display Background Images",
|
|
|
|
"Display reference images behind objects in the 3D View");
|
|
|
|
RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "lens_unit", PROP_ENUM, PROP_NONE);
|
2008-12-03 20:17:12 +00:00
|
|
|
RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
|
|
|
|
RNA_def_property_enum_items(prop, prop_lens_unit_items);
|
2010-02-10 20:41:01 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Lens Unit", "Unit to edit lens in for the user interface");
|
2008-11-30 23:27:10 +00:00
|
|
|
|
2019-03-21 15:01:07 +01:00
|
|
|
/* dtx */
|
2019-03-21 16:05:32 +01:00
|
|
|
prop = RNA_def_property(srna, "show_composition_center", PROP_BOOLEAN, PROP_NONE);
|
2019-03-21 15:01:07 +01:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "dtx", CAM_DTX_CENTER);
|
2019-03-21 15:09:11 +01:00
|
|
|
RNA_def_property_ui_text(prop, "Center", "Display center composition guide inside the camera view");
|
2019-03-21 15:01:07 +01:00
|
|
|
RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
|
|
|
|
|
2019-03-21 16:05:32 +01:00
|
|
|
prop = RNA_def_property(srna, "show_composition_center_diagonal", PROP_BOOLEAN, PROP_NONE);
|
2019-03-21 15:01:07 +01:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "dtx", CAM_DTX_CENTER_DIAG);
|
2019-03-21 15:09:11 +01:00
|
|
|
RNA_def_property_ui_text(prop, "Center Diagonal", "Display diagonal center composition guide inside the camera view");
|
2019-03-21 15:01:07 +01:00
|
|
|
RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
|
|
|
|
|
2019-03-21 16:05:32 +01:00
|
|
|
prop = RNA_def_property(srna, "show_composition_thirds", PROP_BOOLEAN, PROP_NONE);
|
2019-03-21 15:01:07 +01:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "dtx", CAM_DTX_THIRDS);
|
2019-03-21 15:09:11 +01:00
|
|
|
RNA_def_property_ui_text(prop, "Thirds", "Display rule of thirds composition guide inside the camera view");
|
2019-03-21 15:01:07 +01:00
|
|
|
RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
|
|
|
|
|
2019-03-21 16:05:32 +01:00
|
|
|
prop = RNA_def_property(srna, "show_composition_golden", PROP_BOOLEAN, PROP_NONE);
|
2019-03-21 15:01:07 +01:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "dtx", CAM_DTX_GOLDEN);
|
2019-03-21 15:09:11 +01:00
|
|
|
RNA_def_property_ui_text(prop, "Golden Ratio", "Display golden ratio composition guide inside the camera view");
|
2019-03-21 15:01:07 +01:00
|
|
|
RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
|
|
|
|
|
2019-03-21 16:05:32 +01:00
|
|
|
prop = RNA_def_property(srna, "show_composition_golden_tria_a", PROP_BOOLEAN, PROP_NONE);
|
2019-03-21 15:01:07 +01:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "dtx", CAM_DTX_GOLDEN_TRI_A);
|
2019-03-21 15:09:11 +01:00
|
|
|
RNA_def_property_ui_text(prop, "Golden Triangle A", "Display golden triangle A composition guide inside the camera view");
|
2019-03-21 15:01:07 +01:00
|
|
|
RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
|
|
|
|
|
2019-03-21 16:05:32 +01:00
|
|
|
prop = RNA_def_property(srna, "show_composition_golden_tria_b", PROP_BOOLEAN, PROP_NONE);
|
2019-03-21 15:01:07 +01:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "dtx", CAM_DTX_GOLDEN_TRI_B);
|
2019-03-21 15:09:11 +01:00
|
|
|
RNA_def_property_ui_text(prop, "Golden Triangle B", "Display golden triangle B composition guide inside the camera view");
|
2019-03-21 15:01:07 +01:00
|
|
|
RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
|
|
|
|
|
2019-03-21 16:05:32 +01:00
|
|
|
prop = RNA_def_property(srna, "show_composition_harmony_tri_a", PROP_BOOLEAN, PROP_NONE);
|
2019-03-21 15:01:07 +01:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "dtx", CAM_DTX_HARMONY_TRI_A);
|
2019-03-21 15:09:11 +01:00
|
|
|
RNA_def_property_ui_text(prop, "Harmonious Triangle A", "Display harmony A composition guide inside the camera view");
|
2019-03-21 15:01:07 +01:00
|
|
|
RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
|
|
|
|
|
2019-03-21 16:05:32 +01:00
|
|
|
prop = RNA_def_property(srna, "show_composition_harmony_tri_b", PROP_BOOLEAN, PROP_NONE);
|
2019-03-21 15:01:07 +01:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "dtx", CAM_DTX_HARMONY_TRI_B);
|
2019-03-21 15:09:11 +01:00
|
|
|
RNA_def_property_ui_text(prop, "Harmonious Triangle B", "Display harmony B composition guide inside the camera view");
|
2019-03-21 15:01:07 +01:00
|
|
|
RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
|
|
|
|
|
2008-12-03 20:17:12 +00:00
|
|
|
/* pointers */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "dof_object", PROP_POINTER, PROP_NONE);
|
2008-11-30 23:27:10 +00:00
|
|
|
RNA_def_property_struct_type(prop, "Object");
|
|
|
|
RNA_def_property_pointer_sdna(prop, NULL, "dof_ob");
|
2009-05-28 23:23:47 +00:00
|
|
|
RNA_def_property_flag(prop, PROP_EDITABLE);
|
2010-02-10 20:41:01 +00:00
|
|
|
RNA_def_property_ui_text(prop, "DOF Object", "Use this object to define the depth of field focal point");
|
2015-05-12 13:29:00 +05:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_dependency_update");
|
2011-09-29 08:23:52 +00:00
|
|
|
|
2015-02-12 18:54:41 +01:00
|
|
|
prop = RNA_def_property(srna, "gpu_dof", PROP_POINTER, PROP_NONE);
|
|
|
|
RNA_def_property_struct_type(prop, "GPUDOFSettings");
|
|
|
|
RNA_def_property_ui_text(prop, "GPU Depth Of Field", "");
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
|
|
|
|
|
2017-10-26 21:40:37 +11:00
|
|
|
prop = RNA_def_property(srna, "background_images", PROP_COLLECTION, PROP_NONE);
|
|
|
|
RNA_def_property_collection_sdna(prop, NULL, "bg_images", NULL);
|
|
|
|
RNA_def_property_struct_type(prop, "CameraBackgroundImage");
|
|
|
|
RNA_def_property_ui_text(prop, "Background Images", "List of background images");
|
|
|
|
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
|
|
|
|
|
2015-02-12 18:54:41 +01:00
|
|
|
rna_def_animdata_common(srna);
|
|
|
|
|
2017-10-26 21:40:37 +11:00
|
|
|
rna_def_camera_background_image(brna);
|
|
|
|
rna_def_camera_background_images(brna, prop);
|
|
|
|
|
2015-04-06 10:40:12 -03:00
|
|
|
/* Nested Data */
|
|
|
|
RNA_define_animate_sdna(true);
|
|
|
|
|
|
|
|
/* *** Animated *** */
|
|
|
|
rna_def_camera_stereo_data(brna);
|
|
|
|
|
2011-09-29 08:23:52 +00:00
|
|
|
/* Camera API */
|
|
|
|
RNA_api_camera(srna);
|
2008-11-29 19:53:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|