27# include <fmt/format.h>
60static void rna_Camera_angle_x_set(
PointerRNA *
ptr,
float value)
72static void rna_Camera_angle_y_set(
PointerRNA *
ptr,
float value)
107static void rna_Camera_custom_mode_set(
PointerRNA *
ptr,
int value)
111 if (camera->custom_mode != value) {
112 camera->custom_mode = value;
113 camera->custom_filepath[0] =
'\0';
116 if (camera->custom_shader) {
117 Text *text =
reinterpret_cast<Text *
>(camera->custom_shader);
126 camera->custom_shader =
nullptr;
130 if (camera->custom_bytecode) {
132 camera->custom_bytecode =
nullptr;
134 camera->custom_bytecode_hash[0] =
'\0';
138static void rna_Camera_custom_bytecode_get(
PointerRNA *
ptr,
char *value)
141 strcpy(value, (camera->custom_bytecode) ? camera->custom_bytecode :
"");
147 return (camera->custom_bytecode) ? strlen(camera->custom_bytecode) : 0;
150static void rna_Camera_custom_bytecode_set(
PointerRNA *
ptr,
const char *value)
153 if (camera->custom_bytecode) {
157 if (value && value[0]) {
161 camera->custom_bytecode =
nullptr;
174static void rna_Camera_background_images_remove(
Camera *cam,
189static void rna_Camera_background_images_clear(
Camera *cam)
196static std::optional<std::string> rna_Camera_background_image_path(
const PointerRNA *
ptr)
201 const int bgpic_index =
BLI_findindex(&camera->bg_images, bgpic);
203 if (bgpic_index >= 0) {
204 return fmt::format(
"background_images[{}]", bgpic_index);
213 const char *user =
static_cast<const char *
>(
ptr->data);
217 if (bgpic_index >= 0) {
218 return fmt::format(
"background_images[{}].image_user", bgpic_index);
222 if (bgpic_index >= 0) {
223 return fmt::format(
"background_images[{}].clip_user", bgpic_index);
229static bool rna_Camera_background_images_override_apply(
238 "Unsupported RNA override operation on background images collection");
241 const Camera *cam_src = (
const Camera *)ptr_src->owner_id;
247 BLI_findlink(&cam_dst->bg_images, opop->subitem_reference_index));
251 BLI_findlink(&cam_src->bg_images, opop->subitem_local_index));
253 if (bgpic_src ==
nullptr) {
273std::optional<std::string> rna_CameraDOFSettings_path(
const PointerRNA *
ptr)
288static void rna_CameraDOFSettings_aperture_blades_set(
PointerRNA *
ptr,
const int value)
292 if (
ELEM(value, 1, 2)) {
293 if (dofsettings->aperture_blades == 0) {
294 dofsettings->aperture_blades = 3;
297 dofsettings->aperture_blades = 0;
301 dofsettings->aperture_blades = value;
315 {0,
nullptr, 0,
nullptr,
nullptr},
319 {0,
"STRETCH", 0,
"Stretch",
""},
322 {0,
nullptr, 0,
nullptr,
nullptr},
326 {0,
"BACK", 0,
"Back",
""},
328 {0,
nullptr, 0,
nullptr,
nullptr},
334 srna,
"Background Image",
"Image and settings for display in the 3D View background");
340 "Override Background Image",
341 "In a local override camera, whether this background image comes from "
342 "the linked reference camera, or is local to the override");
376 "Parameters defining which layer, pass and frame of the image is displayed");
384 prop,
"Clip User",
"Parameters defining which frame of the movie clip is displayed");
403 prop,
"Rotation",
"Rotation for the background image (ortho view only)");
419 prop,
"Opacity",
"Image opacity to blend the image against the background color");
442 prop,
"Show On Foreground",
"Show this image in front of objects in viewport");
478 func,
"image",
"CameraBackgroundImage",
"",
"Image displayed as viewport background");
481 func =
RNA_def_function(srna,
"remove",
"rna_Camera_background_images_remove");
485 func,
"image",
"CameraBackgroundImage",
"",
"Image displayed as viewport background");
489 func =
RNA_def_function(srna,
"clear",
"rna_Camera_background_images_clear");
499 {
CAM_S3D_OFFAXIS,
"OFFAXIS", 0,
"Off-Axis",
"Off-axis frustums converging in a plane"},
500 {
CAM_S3D_PARALLEL,
"PARALLEL", 0,
"Parallel",
"Parallel cameras with no convergence"},
505 "Rotated cameras, looking at the same point at the convergence distance"},
506 {0,
nullptr, 0,
nullptr,
nullptr},
513 {0,
nullptr, 0,
nullptr,
nullptr},
538 "Interocular Distance",
539 "Set the distance between the eyes - the stereo plane distance / 30 should be fine");
546 "Convergence Plane Distance",
547 "The converge point for the stereo cameras "
548 "(often the distance between a projector and the projection screen)");
555 "Render every pixel rotating the camera around the "
556 "middle of the interocular distance");
562 prop,
"Use Pole Merge",
"Fade interocular distance to 0 after the given cutoff angle");
568 prop,
"Pole Merge Start Angle",
"Angle at which interocular distance starts to fade to 0");
574 prop,
"Pole Merge End Angle",
"Angle at which interocular distance is 0");
603 prop,
"Focus Object",
"Use this object to define the depth of field focal point");
609 prop,
"Focus Bone",
"Use this armature bone to define the depth of field focal point");
617 prop,
"Focus Distance",
"Distance to the focus point for depth of field");
624 "F-Stop ratio (lower numbers give more defocus, higher numbers give a sharper image)");
631 prop,
"Blades",
"Number of blades in aperture for polygonal bokeh (at least 3)");
655 {
CAM_PERSP,
"PERSP", 0,
"Perspective",
""},
656 {
CAM_ORTHO,
"ORTHO", 0,
"Orthographic",
""},
657 {
CAM_PANO,
"PANO", 0,
"Panoramic",
""},
659 {0,
nullptr, 0,
nullptr,
nullptr},
662 {0,
"MILLIMETERS", 0,
"Millimeters",
"Specify focal length of the lens in millimeters"},
667 "Specify the lens as the field of view's angle"},
668 {0,
nullptr, 0,
nullptr,
nullptr},
675 "Fit to the sensor width or height depending on image resolution"},
678 {0,
nullptr, 0,
nullptr,
nullptr},
686 "Spherical camera for environment maps, also known as Lat Long panorama"},
688 "EQUIANGULAR_CUBEMAP_FACE",
690 "Equiangular Cubemap Face",
691 "Single face of an equiangular cubemap"},
696 "Mirror ball mapping for environment maps"},
698 "FISHEYE_EQUIDISTANT",
700 "Fisheye Equidistant",
701 "Ideal for fulldomes, ignore the sensor dimensions"},
706 "Similar to most fisheye modern lens, takes sensor dimensions into consideration"},
708 "FISHEYE_LENS_POLYNOMIAL",
710 "Fisheye Lens Polynomial",
711 "Defines the lens projection as polynomial to allow real world camera lenses to be "
714 "CENTRAL_CYLINDRICAL",
716 "Central Cylindrical",
717 "Projection onto a virtual cylinder from its center, similar as a rotating panoramic "
719 {0,
nullptr, 0,
nullptr,
nullptr},
725 {0,
nullptr, 0,
nullptr,
nullptr},
744 prop,
"Sensor Fit",
"Method to fit image and field of view angle inside the sensor");
752 prop,
"Passepartout Alpha",
"Opacity (alpha) of the darkened overlay in Camera view");
794 prop,
"Focal Length",
"Perspective Camera focal length value in millimeters");
802 prop,
"Sensor Width",
"Horizontal size of the image sensor area in millimeters");
810 prop,
"Sensor Height",
"Vertical size of the image sensor area in millimeters");
818 prop,
"Orthographic Scale",
"Orthographic Camera scale (similar to zoom)");
826 prop,
"Display Size",
"Apparent size of the Camera object in the 3D View");
852 prop,
"Show Limits",
"Display the clipping range and focus point on the camera");
858 prop,
"Show Mist",
"Display a line from the Camera to indicate the mist area");
864 prop,
"Show Passepartout",
"Show a darkened overlay outside the image area in Camera view");
870 prop,
"Show Safe Areas",
"Show TV title safe and action safe areas in Camera view");
876 "Show Center-Cut Safe Areas",
877 "Show safe areas to fit content in a different aspect ratio");
888 prop,
"Show Sensor Size",
"Show sensor size (film gate) in Camera view");
894 prop,
"Display Background Images",
"Display reference images behind objects in the 3D View");
905 prop,
"Composition Guide Color",
"Color and alpha for compositional guide overlays");
911 prop,
"Center",
"Display center composition guide inside the camera view");
917 prop,
"Center Diagonal",
"Display diagonal center composition guide inside the camera view");
923 prop,
"Thirds",
"Display rule of thirds composition guide inside the camera view");
929 prop,
"Golden Ratio",
"Display golden ratio composition guide inside the camera view");
936 "Display golden triangle A composition guide inside the camera view");
943 "Display golden triangle B composition guide inside the camera view");
949 prop,
"Harmonious Triangle A",
"Display harmony A composition guide inside the camera view");
955 prop,
"Harmonious Triangle B",
"Display harmony B composition guide inside the camera view");
980 prop,
"Min Latitude",
"Minimum latitude (vertical angle) for the equirectangular lens");
987 prop,
"Max Latitude",
"Maximum latitude (vertical angle) for the equirectangular lens");
993 prop,
"Min Longitude",
"Minimum longitude (horizontal angle) for the equirectangular lens");
999 prop,
"Max Longitude",
"Maximum longitude (horizontal angle) for the equirectangular lens");
1030 prop,
"Min Longitude",
"Minimum Longitude value for the central cylindrical lens");
1036 prop,
"Max Longitude",
"Maximum Longitude value for the central cylindrical lens");
1042 prop,
"Min Height",
"Minimum Height value for the central cylindrical lens");
1048 prop,
"Max Height",
"Maximum Height value for the central cylindrical lens");
1060 prop,
"Custom File Path",
"Path to the shader defining the custom camera");
1077 "rna_Camera_custom_bytecode_get",
1078 "rna_Camera_custom_bytecode_length",
1079 "rna_Camera_custom_bytecode_set");
1086 "Custom Bytecode Hash",
1087 "Hash of the compiled bytecode of the custom shader, for quick equality checking");
1102 prop,
nullptr,
nullptr,
"rna_Camera_background_images_override_apply");
Camera data-block and utility functions.
float BKE_camera_sensor_size(int sensor_fit, float sensor_x, float sensor_y)
struct CameraBGImage * BKE_camera_background_image_new(struct Camera *cam)
void BKE_camera_background_image_clear(struct Camera *cam)
struct CameraBGImage * BKE_camera_background_image_copy(const struct CameraBGImage *bgpic_src, int flag)
void BKE_camera_background_image_remove(struct Camera *cam, struct CameraBGImage *bgpic)
General operations, lookup, etc. for blender objects.
void BKE_report(ReportList *reports, eReportType type, const char *message)
#define BLI_assert_msg(a, msg)
int BLI_findindex(const ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void * BLI_findlink(const ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void BLI_insertlinkafter(ListBase *listbase, void *vprevlink, void *vnewlink) ATTR_NONNULL(1)
float fov_to_focallength(float hfov, float sensor)
float focallength_to_fov(float focal_length, float sensor)
bool BLI_path_abs(char path[FILE_MAX], const char *basepath) ATTR_NONNULL(1
bool void BLI_path_rel(char path[FILE_MAX], const char *basepath) ATTR_NONNULL(1)
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC
char * STRNCPY(char(&dst)[N], const char *src)
#define BLT_I18NCONTEXT_ID_CAMERA
void DEG_id_tag_update(ID *id, unsigned int flags)
void DEG_relations_tag_update(Main *bmain)
#define ID_BLEND_PATH_FROM_GLOBAL(_id)
@ LIBOVERRIDE_OP_INSERT_AFTER
@ CAM_CUSTOM_SHADER_EXTERNAL
@ CAM_CUSTOM_SHADER_INTERNAL
@ CAM_PANORAMA_CENTRAL_CYLINDRICAL
@ CAM_PANORAMA_FISHEYE_EQUIDISTANT
@ CAM_PANORAMA_MIRRORBALL
@ CAM_PANORAMA_EQUIANGULAR_CUBEMAP_FACE
@ CAM_PANORAMA_FISHEYE_EQUISOLID
@ CAM_PANORAMA_EQUIRECTANGULAR
@ CAM_PANORAMA_FISHEYE_LENS_POLYNOMIAL
@ CAM_BGIMG_FLAG_CAMERA_CROP
@ CAM_BGIMG_FLAG_CAMERACLIP
@ CAM_BGIMG_FLAG_CAMERA_ASPECT
@ CAM_BGIMG_FLAG_DISABLED
@ CAM_BGIMG_FLAG_FOREGROUND
@ CAM_BGIMG_FLAG_OVERRIDE_LIBRARY_LOCAL
@ CAM_BGIMG_FLAG_EXPANDED
#define RNA_TRANSLATION_PREC_DEFAULT
@ PROPOVERRIDE_OVERRIDABLE_LIBRARY
@ PROPOVERRIDE_LIBRARY_INSERTION
@ PROPOVERRIDE_NO_PROP_NAME
#define ND_DRAW_RENDER_VIEWPORT
RenderEngineType * RE_engines_find(const char *idname)
RenderEngine * RE_engine_create(RenderEngineType *type)
void RE_engine_free(RenderEngine *engine)
void MEM_freeN(void *vmemh)
void relations_invalidate_scene_strips(const Main *bmain, const Scene *scene_target)
void RNA_property_update_main(Main *bmain, Scene *scene, PointerRNA *ptr, PropertyRNA *prop)
void rna_def_animdata_common(StructRNA *srna)
static void rna_def_camera_stereo_data(BlenderRNA *brna)
void RNA_def_camera(BlenderRNA *brna)
static void rna_def_camera_dof_settings_data(BlenderRNA *brna)
static void rna_def_camera_background_image(BlenderRNA *brna)
static void rna_def_camera_background_images(BlenderRNA *brna, PropertyRNA *cprop)
void RNA_api_camera(StructRNA *srna)
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_define_lib_overridable(const bool make_overridable)
void RNA_def_struct_path_func(StructRNA *srna, const char *path)
void RNA_define_animate_sdna(bool animate)
void RNA_def_parameter_clear_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set)
void RNA_def_property_float_default(PropertyRNA *prop, float value)
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
void RNA_def_property_enum_default(PropertyRNA *prop, int value)
void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
void RNA_def_property_string_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_ui_icon(PropertyRNA *prop, int icon, int consecutive)
void RNA_def_property_srna(PropertyRNA *prop, const char *type)
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier, const char *call)
void RNA_def_property_range(PropertyRNA *prop, double min, double max)
PropertyRNA * RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, const char *propname, const char *lengthpropname)
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char *set, const char *item)
void RNA_def_property_enum_bitflag_sdna(PropertyRNA *prop, const char *structname, const char *propname)
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
void RNA_def_function_flag(FunctionRNA *func, int flag)
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_int_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void RNA_def_struct_ui_icon(StructRNA *srna, int icon)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
void RNA_def_property_override_funcs(PropertyRNA *prop, const char *diff, const char *store, const char *apply)
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double step, int precision)
void RNA_def_property_boolean_negative_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
void RNA_def_struct_nested(BlenderRNA *brna, StructRNA *srna, const char *structname)
void RNA_def_property_override_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
std::optional< std::string > rna_CameraBackgroundImage_image_or_movieclip_user_path(const PointerRNA *ptr)
struct ListBase bg_images
IDOverrideLibraryPropertyOperation * liboverride_operation
void(* update_custom_camera)(struct RenderEngine *engine, struct Camera *cam)
void WM_main_add_notifier(uint type, void *reference)