27# include <fmt/format.h>
47static float rna_Camera_angle_get(
PointerRNA *ptr)
49 const Camera *cam = id_cast<const Camera *>(ptr->owner_id);
54static void rna_Camera_angle_set(
PointerRNA *ptr,
float value)
56 Camera *cam = id_cast<Camera *>(ptr->owner_id);
61static float rna_Camera_angle_x_get(
PointerRNA *ptr)
63 const Camera *cam = id_cast<const Camera *>(ptr->owner_id);
67static void rna_Camera_angle_x_set(
PointerRNA *ptr,
float value)
69 Camera *cam = id_cast<Camera *>(ptr->owner_id);
73static float rna_Camera_angle_y_get(
PointerRNA *ptr)
75 const Camera *cam = id_cast<const Camera *>(ptr->owner_id);
79static void rna_Camera_angle_y_set(
PointerRNA *ptr,
float value)
81 Camera *cam = id_cast<Camera *>(ptr->owner_id);
104 if (engine_type && engine_type->update_custom_camera) {
107 engine_type->update_custom_camera(engine,
camera);
114static void rna_Camera_custom_mode_set(
PointerRNA *ptr,
int value)
120 camera->custom_filepath[0] =
'\0';
123 if (
camera->custom_shader) {
133 camera->custom_shader =
nullptr;
137 if (
camera->custom_bytecode) {
138 MEM_delete(
camera->custom_bytecode);
139 camera->custom_bytecode =
nullptr;
141 camera->custom_bytecode_hash[0] =
'\0';
145static void rna_Camera_custom_bytecode_get(
PointerRNA *ptr,
char *value)
148 strcpy(value, (
camera->custom_bytecode) ?
camera->custom_bytecode :
"");
151static int rna_Camera_custom_bytecode_length(
PointerRNA *ptr)
154 return (
camera->custom_bytecode) ? strlen(
camera->custom_bytecode) : 0;
157static void rna_Camera_custom_bytecode_set(
PointerRNA *ptr,
const char *value)
160 if (
camera->custom_bytecode) {
161 MEM_delete(
camera->custom_bytecode);
164 if (value && value[0]) {
168 camera->custom_bytecode =
nullptr;
181static void rna_Camera_background_images_remove(
Camera *cam,
191 bgpic_ptr->invalidate();
196static void rna_Camera_background_images_clear(
Camera *cam)
203static std::optional<std::string> rna_Camera_background_image_path(
const PointerRNA *ptr)
206 const Camera *
camera = id_cast<const Camera *>(ptr->owner_id);
210 if (bgpic_index >= 0) {
211 return fmt::format(
"background_images[{}]", bgpic_index);
220 const char *user =
static_cast<const char *
>(ptr->data);
221 const Camera *
camera = id_cast<const Camera *>(ptr->owner_id);
224 if (bgpic_index >= 0) {
225 return fmt::format(
"background_images[{}].image_user", bgpic_index);
229 if (bgpic_index >= 0) {
230 return fmt::format(
"background_images[{}].clip_user", bgpic_index);
236static bool rna_Camera_background_images_override_apply(
245 "Unsupported RNA override operation on background images collection");
247 Camera *cam_dst = id_cast<Camera *>(ptr_dst->owner_id);
248 const Camera *cam_src = id_cast<const Camera *>(ptr_src->owner_id);
254 BLI_findlink(&cam_dst->bg_images, opop->subitem_reference_index));
258 BLI_findlink(&cam_src->bg_images, opop->subitem_local_index));
260 if (bgpic_src ==
nullptr) {
280std::optional<std::string> rna_CameraDOFSettings_path(
const PointerRNA *ptr)
287 if (
GS(ptr->owner_id->name) ==
ID_CA) {
295static void rna_CameraDOFSettings_aperture_blades_set(
PointerRNA *ptr,
const int value)
299 if (
ELEM(value, 1, 2)) {
300 if (dofsettings->aperture_blades == 0) {
301 dofsettings->aperture_blades = 3;
304 dofsettings->aperture_blades = 0;
308 dofsettings->aperture_blades = value;
326 {0,
nullptr, 0,
nullptr,
nullptr},
330 {0,
"STRETCH", 0,
"Stretch",
""},
333 {0,
nullptr, 0,
nullptr,
nullptr},
337 {0,
"BACK", 0,
"Back",
""},
339 {0,
nullptr, 0,
nullptr,
nullptr},
345 srna,
"Background Image",
"Image and settings for display in the 3D View background");
351 "Override Background Image",
352 "In a local override camera, whether this background image comes from "
353 "the linked reference camera, or is local to the override");
387 "Parameters defining which layer, pass and frame of the image is displayed");
395 prop,
"Clip User",
"Parameters defining which frame of the movie clip is displayed");
414 prop,
"Rotation",
"Rotation for the background image (ortho view only)");
430 prop,
"Opacity",
"Image opacity to blend the image against the background color");
453 prop,
"Show On Foreground",
"Show this image in front of objects in viewport");
489 func,
"image",
"CameraBackgroundImage",
"",
"Image displayed as viewport background");
493 func =
RNA_def_function(srna,
"remove",
"rna_Camera_background_images_remove");
497 func,
"image",
"CameraBackgroundImage",
"",
"Image displayed as viewport background");
501 func =
RNA_def_function(srna,
"clear",
"rna_Camera_background_images_clear");
511 {
CAM_S3D_OFFAXIS,
"OFFAXIS", 0,
"Off-Axis",
"Off-axis frustums converging in a plane"},
512 {
CAM_S3D_PARALLEL,
"PARALLEL", 0,
"Parallel",
"Parallel cameras with no convergence"},
517 "Rotated cameras, looking at the same point at the convergence distance"},
518 {0,
nullptr, 0,
nullptr,
nullptr},
525 {0,
nullptr, 0,
nullptr,
nullptr},
550 "Interocular Distance",
551 "Set the distance between the eyes - the stereo plane distance / 30 should be fine");
558 "Convergence Plane Distance",
559 "The converge point for the stereo cameras "
560 "(often the distance between a projector and the projection screen)");
567 "Render every pixel rotating the camera around the "
568 "middle of the interocular distance");
574 prop,
"Use Pole Merge",
"Fade interocular distance to 0 after the given cutoff angle");
580 prop,
"Pole Merge Start Angle",
"Angle at which interocular distance starts to fade to 0");
586 prop,
"Pole Merge End Angle",
"Angle at which interocular distance is 0");
615 prop,
"Focus Object",
"Use this object to define the depth of field focal point");
621 prop,
"Focus Bone",
"Use this armature bone to define the depth of field focal point");
629 prop,
"Focus Distance",
"Distance to the focus point for depth of field");
636 "F-Stop ratio (lower numbers give more defocus, higher numbers give a sharper image)");
643 prop,
"Blades",
"Number of blades in aperture for polygonal bokeh (at least 3)");
667 {
CAM_PERSP,
"PERSP", 0,
"Perspective",
""},
668 {
CAM_ORTHO,
"ORTHO", 0,
"Orthographic",
""},
669 {
CAM_PANO,
"PANO", 0,
"Panoramic",
""},
671 {0,
nullptr, 0,
nullptr,
nullptr},
674 {0,
"MILLIMETERS", 0,
"Millimeters",
"Specify focal length of the lens in millimeters"},
679 "Specify the lens as the field of view's angle"},
680 {0,
nullptr, 0,
nullptr,
nullptr},
687 "Fit to the sensor width or height depending on image resolution"},
690 {0,
nullptr, 0,
nullptr,
nullptr},
698 "Spherical camera for environment maps, also known as Lat Long panorama"},
700 "EQUIANGULAR_CUBEMAP_FACE",
702 "Equiangular Cubemap Face",
703 "Single face of an equiangular cubemap"},
708 "Mirror ball mapping for environment maps"},
710 "FISHEYE_EQUIDISTANT",
712 "Fisheye Equidistant",
713 "Ideal for fulldomes, ignore the sensor dimensions"},
718 "Similar to most fisheye modern lens, takes sensor dimensions into consideration"},
720 "FISHEYE_LENS_POLYNOMIAL",
722 "Fisheye Lens Polynomial",
723 "Defines the lens projection as polynomial to allow real world camera lenses to be "
726 "CENTRAL_CYLINDRICAL",
728 "Central Cylindrical",
729 "Projection onto a virtual cylinder from its center, similar as a rotating panoramic "
731 {0,
nullptr, 0,
nullptr,
nullptr},
737 {0,
nullptr, 0,
nullptr,
nullptr},
756 prop,
"Sensor Fit",
"Method to fit image and field of view angle inside the sensor");
764 prop,
"Passepartout Alpha",
"Opacity (alpha) of the darkened overlay in Camera view");
806 prop,
"Focal Length",
"Perspective Camera focal length value in millimeters");
814 prop,
"Sensor Width",
"Horizontal size of the image sensor area in millimeters");
822 prop,
"Sensor Height",
"Vertical size of the image sensor area in millimeters");
830 prop,
"Orthographic Scale",
"Orthographic Camera scale (similar to zoom)");
838 prop,
"Display Size",
"Apparent size of the Camera object in the 3D View");
864 prop,
"Show Limits",
"Display the clipping range and focus point on the camera");
870 prop,
"Show Mist",
"Display a line from the Camera to indicate the mist area");
876 prop,
"Show Passepartout",
"Show a darkened overlay outside the image area in Camera view");
882 prop,
"Show Safe Areas",
"Show TV title safe and action safe areas in Camera view");
888 "Show Center-Cut Safe Areas",
889 "Show safe areas to fit content in a different aspect ratio");
900 prop,
"Show Sensor Size",
"Show sensor size (film gate) in Camera view");
906 prop,
"Display Background Images",
"Display reference images behind objects in the 3D View");
917 prop,
"Composition Guide Color",
"Color and alpha for compositional guide overlays");
924 prop,
"Center",
"Display center composition guide inside the camera view");
931 prop,
"Center Diagonal",
"Display diagonal center composition guide inside the camera view");
938 prop,
"Thirds",
"Display rule of thirds composition guide inside the camera view");
945 prop,
"Golden Ratio",
"Display golden ratio composition guide inside the camera view");
953 "Display golden triangle A composition guide inside the camera view");
961 "Display golden triangle B composition guide inside the camera view");
968 prop,
"Harmonious Triangle A",
"Display harmony A composition guide inside the camera view");
975 prop,
"Harmonious Triangle B",
"Display harmony B composition guide inside the camera view");
1000 prop,
"Min Latitude",
"Minimum latitude (vertical angle) for the equirectangular lens");
1007 prop,
"Max Latitude",
"Maximum latitude (vertical angle) for the equirectangular lens");
1013 prop,
"Min Longitude",
"Minimum longitude (horizontal angle) for the equirectangular lens");
1019 prop,
"Max Longitude",
"Maximum longitude (horizontal angle) for the equirectangular lens");
1050 prop,
"Min Longitude",
"Minimum Longitude value for the central cylindrical lens");
1056 prop,
"Max Longitude",
"Maximum Longitude value for the central cylindrical lens");
1062 prop,
"Min Height",
"Minimum Height value for the central cylindrical lens");
1068 prop,
"Max Height",
"Maximum Height value for the central cylindrical lens");
1080 prop,
"Custom File Path",
"Path to the shader defining the custom camera");
1097 "rna_Camera_custom_bytecode_get",
1098 "rna_Camera_custom_bytecode_length",
1099 "rna_Camera_custom_bytecode_set");
1106 "Custom Bytecode Hash",
1107 "Hash of the compiled bytecode of the custom shader, for quick equality checking");
1122 prop,
nullptr,
nullptr,
"rna_Camera_background_images_override_apply");
Camera data-block and utility functions.
General operations, lookup, etc. for blender objects.
#define BLT_I18NCONTEXT_ID_CAMERA
#define ID_BLEND_PATH_FROM_GLOBAL(_id)
#define RNA_TRANSLATION_PREC_DEFAULT
#define ND_DRAW_RENDER_VIEWPORT
#define BLI_assert_msg(a, msg)
void camera(KernelGlobals &kg, const ShadingData &sd, float3 &outview, float &outdepth, float &outdist)
void relations_invalidate_scene_strips(const Main *bmain, const Scene *scene_target)
void WM_main_add_notifier(uint type, void *reference)
@ CAM_CUSTOM_SHADER_EXTERNAL
@ CAM_CUSTOM_SHADER_INTERNAL
struct CameraBGImage * BKE_camera_background_image_copy(const struct CameraBGImage *bgpic_src, int flag)
void RNA_def_property_srna(PropertyRNA *prop, const char *type)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
@ COMPOSITION_GUIDES_THIRDS
@ COMPOSITION_GUIDES_GOLDEN
@ COMPOSITION_GUIDES_CENTER_DIAG
@ COMPOSITION_GUIDES_HARMONY_TRI_B
@ COMPOSITION_GUIDES_GOLDEN_TRI_A
@ COMPOSITION_GUIDES_HARMONY_TRI_A
@ COMPOSITION_GUIDES_CENTER
@ COMPOSITION_GUIDES_GOLDEN_TRI_B
void BKE_camera_background_image_remove(struct Camera *cam, struct CameraBGImage *bgpic)
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
char * STRNCPY(char(&dst)[N], const char *src)
void RNA_def_struct_ui_icon(StructRNA *srna, int icon)
void RNA_def_property_string_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_boolean_negative_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
void RNA_def_property_enum_default(PropertyRNA *prop, int value)
void RNA_def_property_override_funcs(PropertyRNA *prop, const char *diff, const char *store, const char *apply)
static void rna_def_camera_dof_settings_data(BlenderRNA *brna)
bool BLI_path_abs(char path[FILE_MAX], const char *basepath) ATTR_NONNULL(1
void RNA_property_update_main(Main *bmain, Scene *scene, PointerRNA *ptr, PropertyRNA *prop)
void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, const char *propname, const char *lengthpropname)
void RNA_api_camera(StructRNA *srna)
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
void RNA_define_lib_overridable(const bool make_overridable)
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)
static void rna_def_camera_background_image(BlenderRNA *brna)
void RNA_def_struct_nested(BlenderRNA *brna, StructRNA *srna, const char *structname)
@ LIBOVERRIDE_OP_INSERT_AFTER
void RNA_def_property_enum_bitflag_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_define_animate_sdna(bool animate)
void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double step, int precision)
void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, const char *propname)
@ PROPOVERRIDE_NO_PROP_NAME
@ PROPOVERRIDE_LIBRARY_INSERTION
@ PROPOVERRIDE_OVERRIDABLE_LIBRARY
void RNA_def_property_float_default(PropertyRNA *prop, float value)
void rna_def_animdata_common(StructRNA *srna)
void RE_engine_free(RenderEngine *engine)
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier_c_str, int type, int subtype)
float focallength_to_fov(float focal_length, float sensor)
void BKE_camera_background_image_clear(struct Camera *cam)
void * BLI_findlink(const ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
@ CAM_PANORAMA_CENTRAL_CYLINDRICAL
@ CAM_PANORAMA_EQUIRECTANGULAR
@ CAM_PANORAMA_MIRRORBALL
@ CAM_PANORAMA_FISHEYE_EQUISOLID
@ CAM_PANORAMA_EQUIANGULAR_CUBEMAP_FACE
@ CAM_PANORAMA_FISHEYE_LENS_POLYNOMIAL
@ CAM_PANORAMA_FISHEYE_EQUIDISTANT
int BLI_findindex(const ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
void RNA_def_parameter_clear_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
static void rna_def_camera_stereo_data(BlenderRNA *brna)
@ CAM_BGIMG_FLAG_CAMERACLIP
@ CAM_BGIMG_FLAG_FOREGROUND
@ CAM_BGIMG_FLAG_OVERRIDE_LIBRARY_LOCAL
@ CAM_BGIMG_FLAG_EXPANDED
@ CAM_BGIMG_FLAG_CAMERA_ASPECT
@ CAM_BGIMG_FLAG_CAMERA_CROP
@ CAM_BGIMG_FLAG_DISABLED
void RNA_def_property_int_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void DEG_id_tag_update(ID *id, unsigned int flags)
void BKE_report(ReportList *reports, eReportType type, const char *message)
void BLI_insertlinkafter(ListBase *listbase, void *vprevlink, void *vnewlink) ATTR_NONNULL(1)
void RNA_def_property_override_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
void RNA_def_property_range(PropertyRNA *prop, double min, double max)
void RNA_def_struct_path_func(StructRNA *srna, const char *path)
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
bool void BLI_path_rel(char path[FILE_MAX], const char *basepath) ATTR_NONNULL(1)
void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char *set, const char *item)
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier_c_str, const char *call)
void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const char *propname)
RenderEngineType * RE_engines_find(const char *idname)
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
float BKE_camera_sensor_size(int sensor_fit, float sensor_x, float sensor_y)
void RNA_def_function_flag(FunctionRNA *func, FunctionFlag flag)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
struct CameraBGImage * BKE_camera_background_image_new(struct Camera *cam)
RenderEngine * RE_engine_create(RenderEngineType *type)
void RNA_def_camera(BlenderRNA *brna)
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC
float fov_to_focallength(float hfov, float sensor)
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
ID_Type GS(const char *name)
static void rna_def_camera_background_images(BlenderRNA *brna, PropertyRNA *cprop)
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
void DEG_relations_tag_update(Main *bmain)
void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set)
std::optional< std::string > rna_CameraBackgroundImage_image_or_movieclip_user_path(const PointerRNA *ptr)
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_ui_icon(PropertyRNA *prop, int icon, int consecutive)