105 ot->
name =
"View Lock Clear";
107 ot->
idname =
"VIEW3D_OT_view_lock_clear";
143 EditBone *ebone_act = (id_cast<bArmature *>(obact->
data))->act_edbone;
162 ot->
name =
"View Lock to Active";
163 ot->
description =
"Lock the view to the active object/bone";
164 ot->
idname =
"VIEW3D_OT_view_lock_to_active";
199 scene, depsgraph, v3d, rv3d, region->
winx, region->
winy,
true,
true,
false);
217 ot->
name =
"Frame Camera Bounds";
218 ot->
description =
"Center the camera view, resizing the view to fit its bounds";
219 ot->
idname =
"VIEW3D_OT_view_center_camera";
249 ot->
name =
"View Lock Center";
251 ot->
idname =
"VIEW3D_OT_view_center_lock";
286 scene, depsgraph, v3d, rv3d, region->
winx, region->
winy,
false,
false,
true);
302 std::swap(border.
xmin, border.
xmax);
309 const float pivot[2] = {region->
winx / 2.0f, region->
winy / 2.0f};
363 ot->
name =
"Set Render Region";
364 ot->
description =
"Set the boundaries of the border render and enable border render";
365 ot->
idname =
"VIEW3D_OT_render_border";
396 rctf *border =
nullptr;
426 ot->
name =
"Clear Render Region";
427 ot->
description =
"Clear the boundaries of the border render and disable border render";
428 ot->
idname =
"VIEW3D_OT_clear_render_border";
449 Depsgraph *depsgraph,
455 int im_width, im_height;
459 scene, depsgraph, v3d, rv3d, region->
winx, region->
winy,
true,
true,
false);
489 ot->
name =
"Zoom Camera 1:1";
490 ot->
description =
"Match the camera to 1:1 to the render output";
491 ot->
idname =
"VIEW3D_OT_zoom_camera_1_to_1";
516 if (!is_camera_lock) {
522 const float horizon_plane[3] = {0.0f, 0.0f, 1.0f};
525 const float axis_fallback[3] = {1.0f, 0.0f, 0.0f};
552 ot->
name =
"Set View Roll";
554 ot->
idname =
"VIEW3D_OT_view_roll_set";
581 {0,
nullptr, 0,
nullptr,
nullptr},
609 ot->
name =
"Flip View";
610 ot->
description =
"Flip the camera view along the given direction";
611 ot->
idname =
"VIEW3D_OT_view_flip";
661 ot->
name =
"View Perspective/Orthographic";
662 ot->
description =
"Switch the current view from perspective/orthographic projection";
663 ot->
idname =
"VIEW3D_OT_view_persportho";
703 ot->
name =
"View Navigation (Walk/Fly)";
705 "Interactively navigate around the scene (uses the mode (walk/fly) preference)";
706 ot->
idname =
"VIEW3D_OT_navigate";
723 if (v3d !=
nullptr) {
761 ot->
name =
"Add Camera Background Image";
762 ot->
description =
"Add a new background image to the active camera";
763 ot->
idname =
"VIEW3D_OT_camera_background_image_add";
774 ot->
srna,
"filepath",
nullptr,
FILE_MAX,
"Filepath",
"Path to image file");
781 "Select the file relative to the blend file");
805 "Cannot remove background image %d from camera '%s', as it is from the linked "
828 ot->
name =
"Remove Camera Background Image";
829 ot->
description =
"Remove a background image from the camera";
830 ot->
idname =
"VIEW3D_OT_camera_background_image_remove";
841 ot->
srna,
"index", 0, 0,
INT_MAX,
"Index",
"Background image index to remove", 0,
INT_MAX);
855 World *world = id_cast<World *>(
857 if (world ==
nullptr) {
863 scene->
world = world;
881 ot->
name =
"Drop World";
883 ot->
idname =
"VIEW3D_OT_drop_world";
906 const float mat[4][4])
913 for (
int i = 0; i < 8; i++) {
936 rv3d->
clipbb = MEM_new<BoundBox>(
"clipbb");
952 MEM_SAFE_DELETE(rv3d->
clipbb);
976 ot->
name =
"Clipping Region";
978 ot->
idname =
"VIEW3D_OT_clip_border";
1003 const bool use_depth,
1004 float r_cursor_co[3])
1010 bool depth_used =
false;
1014 if (rv3d ==
nullptr) {
1040 if (depth_used ==
false) {
1049 const bool use_depth,
1051 float r_cursor_co[3],
1052 float r_cursor_quat[4])
1059 if (rv3d ==
nullptr) {
1070 r_cursor_quat[0] *= -1.0f;
1079 r_cursor_quat[0] *= -1.0f;
1081 const float mval_fl[2] = {
float(mval[0]),
float(mval[1])};
1088 const Object *ob_dummy =
nullptr;
1118 float z_src[3] = {0, 0, 1};
1126 const float ortho_axis_dot[3] = {
1133 float tquat_best[4];
1134 float angle_best = -1.0f;
1143 for (
int axis = 0; axis < 2; axis++) {
1144 float tan_src[3] = {0, 0, 0};
1145 tan_src[axis] = 1.0f;
1148 for (
int axis_sign = 0; axis_sign < 2; axis_sign++) {
1149 float tquat_test[4];
1152 if (angle_test < angle_best || angle_best == -1.0f) {
1153 angle_best = angle_test;
1159 mul_qt_qtqt(r_cursor_quat, tquat_best, r_cursor_quat);
1168 const bool use_depth,
1181 quat = cursor_curr->rotation();
1184 C, mval, use_depth, orientation, cursor_curr->
location, &quat.
w);
1188 float tmat[3][3], cmat[3][3];
1196 cursor_curr->set_rotation(quat,
true);
1205 float co_2d_curr[2], co_2d_prev[2];
1212 rv3d->
ofs_lock[0] += (co_2d_curr[0] - co_2d_prev[0]) / (region->
winx * 0.5f);
1213 rv3d->
ofs_lock[1] += (co_2d_curr[1] - co_2d_prev[1]) / (region->
winy * 0.5f);
1263 ot->
name =
"Set 3D Cursor";
1264 ot->
description =
"Set the location of the 3D cursor";
1265 ot->
idname =
"VIEW3D_OT_cursor3d";
1283 "Orient to the current transform setting"},
1285 {0,
nullptr, 0,
nullptr,
nullptr},
1289 ot->
srna,
"use_depth",
true,
"Surface Project",
"Project onto the surface");
1297 "Preset viewpoint to use");
1308 {
OB_WIRE,
"WIREFRAME", 0,
"Wireframe",
"Toggle wireframe shading"},
1309 {
OB_SOLID,
"SOLID", 0,
"Solid",
"Toggle solid shading"},
1310 {
OB_MATERIAL,
"MATERIAL", 0,
"Material Preview",
"Toggle material preview shading"},
1311 {
OB_RENDER,
"RENDERED", 0,
"Rendered",
"Toggle rendered shading"},
1312 {0,
nullptr, 0,
nullptr,
nullptr},
1359 ot->
name =
"Toggle Shading Type";
1360 ot->
description =
"Toggle shading type in 3D viewport";
1361 ot->
idname =
"VIEW3D_OT_toggle_shading";
1413 ot->
name =
"Toggle X-Ray";
1414 ot->
idname =
"VIEW3D_OT_toggle_xray";
1415 ot->
description =
"Transparent scene display. Allow selecting through items";
Blender kernel action and pose functionality.
Camera data-block and utility functions.
General operations, lookup, etc. for blender objects.
#define STRNCPY_UTF8(dst, src)
#define ID_IS_OVERRIDE_LIBRARY(_id)
#define RV3D_VIEW_IS_AXIS(view)
#define RV3D_LOCK_FLAGS(rv3d)
Read Blender memory allocation and freeing.
#define ND_RENDER_OPTIONS
#define NS_VIEW3D_SHADING
#define ND_DRAW_RENDER_VIEWPORT
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
QuaternionBase< float > Quaternion
ID * WM_operator_drop_load_path(bContext *C, wmOperator *op, const short idcode)
@ V3D_OVERLAY_BONE_SELECT
MINLINE float min_ff(float a, float b)
bool ED_view3d_context_user_region(bContext *C, View3D **r_v3d, ARegion **r_region)
void VIEW3D_OT_view_roll_set(wmOperatorType *ot)
MINLINE void negate_v3_v3(float r[3], const float a[3])
bool ED_operator_scene_editable(bContext *C)
void VIEW3D_OT_view_center_lock(wmOperatorType *ot)
void BKE_camera_background_image_remove(struct Camera *cam, struct CameraBGImage *bgpic)
static wmOperatorStatus view3d_set_roll_exec(bContext *C, wmOperator *op)
ScrArea * CTX_wm_area(const bContext *C)
bool ED_view3d_camera_lock_check(const View3D *v3d, const RegionView3D *rv3d)
int RNA_enum_get(PointerRNA *ptr, const char *name)
static bool view3d_camera_user_poll(bContext *C)
void VIEW3D_OT_clear_render_border(wmOperatorType *ot)
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, const int maxlen, const char *ui_name, const char *ui_description)
void ED_view3d_clipping_local(RegionView3D *rv3d, const float mat[4][4])
void VIEW3D_OT_view_persportho(wmOperatorType *ot)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
static wmOperatorStatus render_border_exec(bContext *C, wmOperator *op)
void VIEW3D_OT_clip_border(wmOperatorType *ot)
bool ED_operator_rv3d_user_region_poll(bContext *C)
static wmOperatorStatus camera_background_image_add_exec(bContext *C, wmOperator *op)
wmOperatorStatus WM_gesture_box_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void WM_operator_properties_id_lookup(wmOperatorType *ot, const bool add_name_prop)
MINLINE void copy_v3_v3(float r[3], const float a[3])
void BLI_rctf_rotate_expand_around(rctf *dst, const rctf *src, const float pivot[2], float angle)
void ED_view3d_cursor3d_position_rotation(bContext *C, const int mval[2], bool use_depth, enum eV3DCursorOrient orientation, float r_cursor_co[3], float r_cursor_quat[4])
static wmOperatorStatus view3d_clipping_invoke(bContext *C, wmOperator *op, const wmEvent *event)
ID * WM_operator_properties_id_lookup_from_name_or_session_uid(Main *bmain, PointerRNA *ptr, const ID_Type type)
void mul_v3_m4v3(float r[3], const float mat[4][4], const float vec[3])
static wmOperatorStatus view3d_clipping_exec(bContext *C, wmOperator *op)
float angle_normalized_qt(const float q[4])
void VIEW3D_OT_view_lock_clear(wmOperatorType *ot)
void ED_view3d_cursor3d_position(bContext *C, const int mval[2], bool use_depth, float r_cursor_co[3])
void VIEW3D_OT_toggle_shading(wmOperatorType *ot)
bool invert_m4_m4(float inverse[4][4], const float mat[4][4])
void VIEW3D_OT_view_lock_to_active(wmOperatorType *ot)
static bool camera_background_image_add_poll(bContext *C)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
void WM_operator_properties_border(wmOperatorType *ot)
void axis_angle_to_mat3(float R[3][3], const float axis[3], float angle)
int RNA_int_get(PointerRNA *ptr, const char *name)
bool is_negative_m4(const float mat[4][4])
static void calc_local_clipping(float clip_local[6][4], const BoundBox *clipbb, const float mat[4][4])
void view3d_operator_needs_gpu(const bContext *C)
void rotation_between_vecs_to_quat(float q[4], const float v1[3], const float v2[3])
void mul_qt_qtqt(float q[4], const float a[4], const float b[4])
RegionView3D * ED_view3d_context_rv3d(bContext *C)
@ RV3D_LOCK_ANY_TRANSFORM
static bool drop_world_poll(bContext *C)
void ED_region_tag_redraw(ARegion *region)
@ V3D_SHADING_XRAY_WIREFRAME
static void view3d_set_1_to_1_viewborder(Scene *scene, Depsgraph *depsgraph, ARegion *region, View3D *v3d)
bool ED_operator_camera_poll(bContext *C)
void VIEW3D_OT_view_center_camera(wmOperatorType *ot)
static wmOperatorStatus clear_render_border_exec(bContext *C, wmOperator *)
float angle_signed_on_axis_v3v3_v3(const float v1[3], const float v2[3], const float axis[3]) ATTR_WARN_UNUSED_RESULT
void BKE_render_resolution(const RenderData *r, const bool use_crop, int *r_width, int *r_height)
static wmOperatorStatus view3d_navigate_invoke(bContext *C, wmOperator *, const wmEvent *event)
bool RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop)
void mul_qt_v3(const float q[4], float r[3])
void quat_to_mat3(float m[3][3], const float q[4])
void ED_view3d_lock_clear(View3D *v3d)
void VIEW3D_OT_navigate(wmOperatorType *ot)
void * BLI_findlink(const ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE bool equals_v4v4(const float v1[4], const float v2[4]) ATTR_WARN_UNUSED_RESULT
bool ED_view3d_autodist(ARegion *region, View3D *v3d, const int mval[2], float mouse_worldloc[3], const float fallback_depth_pt[3])
void CTX_wm_operator_poll_msg_set(bContext *C, const char *msg)
VecBase< float, 2 > float2
static wmOperatorStatus view3d_flip_view_exec(bContext *C, wmOperator *op)
void VIEW3D_OT_cursor3d(wmOperatorType *ot)
static wmOperatorStatus view3d_cursor3d_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void VIEW3D_OT_render_border(wmOperatorType *ot)
static wmOperatorStatus toggle_xray_exec(bContext *C, wmOperator *op)
static wmOperatorStatus view_lock_to_active_exec(bContext *C, wmOperator *)
void copy_qt_qt(float q[4], const float a[4])
@ CAM_BGIMG_FLAG_OVERRIDE_LIBRARY_LOCAL
void DEG_id_tag_update(ID *id, unsigned int flags)
void BKE_report(ReportList *reports, eReportType type, const char *message)
Object * BKE_object_pose_armature_get(Object *ob)
T * DEG_get_evaluated(const Depsgraph *depsgraph, T *id)
static wmOperatorStatus viewpersportho_exec(bContext *C, wmOperator *)
static Camera * background_image_camera_from_context(bContext *C)
float BKE_screen_view3d_zoom_from_fac(float zoomfac)
BLI_INLINE float BLI_rctf_size_y(const struct rctf *rct)
Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C, bool rna_write_check=false)
void ED_undo_push(bContext *C, const char *str, UndoEncodeHints hints=UndoEncodeHints(0))
static wmOperatorStatus view3d_zoom_1_to_1_camera_exec(bContext *C, wmOperator *)
rctf BKE_camera_view_border(const struct Scene *scene, const struct Depsgraph *depsgraph, const struct View3D *v3d, const struct RegionView3D *rv3d, int winx, int winy, bool no_shift, bool no_zoom, bool no_roll)
eV3DProjStatus ED_view3d_project_float_global(const ARegion *region, const float co[3], float r_co[2], eV3DProjTest flag)
static wmOperatorStatus view3d_center_lock_exec(bContext *C, wmOperator *)
void WM_operator_properties_border_to_rcti(wmOperator *op, rcti *r_rect)
void ED_view3d_cursor3d_update(bContext *C, const int mval[2], bool use_depth, enum eV3DCursorOrient orientation)
void VIEW3D_OT_zoom_camera_1_to_1(wmOperatorType *ot)
void RNA_def_property_subtype(PropertyRNA *prop, PropertySubType subtype)
MINLINE void negate_v3(float r[3])
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
bool ED_operator_view3d_active(bContext *C)
float ED_view3d_calc_zfac(const RegionView3D *rv3d, const float co[3])
RegionView3D * CTX_wm_region_view3d(const bContext *C)
wmOperatorStatus WM_operator_name_call(bContext *C, const char *opstring, wm::OpCallContext context, PointerRNA *properties, const wmEvent *event)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
wmMsgBus * CTX_wm_message_bus(const bContext *C)
void VIEW3D_OT_view_flip(wmOperatorType *ot)
MINLINE int axis_dominant_v3_ortho_single(const float vec[3])
void project_plane_v3_v3v3(float out[3], const float p[3], const float v_plane[3])
@ V3D_CURSOR_ORIENT_XFORM
MINLINE float normalize_v3(float n[3])
bool ED_view3d_offset_lock_check(const View3D *v3d, const RegionView3D *rv3d)
wmOperatorStatus WM_gesture_box_modal(bContext *C, wmOperator *op, const wmEvent *event)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, const int default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
struct CameraBGImage * BKE_camera_background_image_new(struct Camera *cam)
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
Main * CTX_data_main(const bContext *C)
void VIEW3D_OT_toggle_xray(wmOperatorType *ot)
BLI_INLINE float BLI_rctf_size_x(const struct rctf *rct)
void ED_view3d_clipping_calc(BoundBox *bb, float planes[4][4], const ARegion *region, const Object *ob, const rcti *rect)
void ED_view3d_depth_override(Depsgraph *depsgraph, ARegion *region, View3D *v3d, Object *obact, eV3DDepthOverrideMode mode, bool use_overlay, ViewDepths **r_depths)
@ USER_LOCK_CURSOR_ADJUST
float ED_view3d_calc_zfac_ex(const RegionView3D *rv3d, const float co[3], bool *r_flip)
@ PROP_PATH_SUPPORTS_BLEND_RELATIVE
bool ED_operator_region_view3d_active(bContext *C)
void WM_gesture_box_cancel(bContext *C, wmOperator *op)
void ED_view3d_smooth_view_force_finish(bContext *C, View3D *v3d, ARegion *region)
void ED_view3d_win_to_3d_int(const View3D *v3d, const ARegion *region, const float depth_pt[3], const int mval[2], float r_out[3])
void VIEW3D_OT_camera_background_image_remove(wmOperatorType *ot)
void ED_view3d_clipping_calc_from_boundbox(float clip[4][4], const BoundBox *bb, bool is_flip)
void DEG_relations_tag_update(Main *bmain)
bPoseChannel * BKE_pose_channel_active_if_bonecoll_visible(Object *ob) ATTR_WARN_UNUSED_RESULT
void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, bool value)
Scene * CTX_data_scene(const bContext *C)
static wmOperatorStatus toggle_shading_exec(bContext *C, wmOperator *op)
static void view3d_set_view_angle(ARegion *region, View3D *v3d, const float input_angle)
static wmOperatorStatus view3d_center_camera_exec(bContext *C, wmOperator *)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
static bool view3d_region_wire_or_solid_poll(bContext *C)
static const EnumPropertyItem prop_flip_directions[]
void VIEW3D_OT_drop_world(wmOperatorType *ot)
PropertyRNA * RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, const float default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
Object * CTX_data_active_object(const bContext *C)
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
static bool view3d_lock_poll(bContext *C)
MINLINE void zero_v2(float r[2])
ARegion * CTX_wm_region(const bContext *C)
float view3d_horizon_correct_quat(float quat[4], const float horizon_plane[3], const bool horizon_plane_no_flip, const float axis_fallback[3], const float angle_target, const float factor)
void WM_msg_publish_rna_params(wmMsgBus *mbus, const wmMsgParams_RNA *msg_key_params)
float RNA_float_get(PointerRNA *ptr, const char *name)
void mat3_to_quat(float q[4], const float mat[3][3])
PointerRNA CTX_data_pointer_get_type(const bContext *C, const char *member, StructRNA *type)
bool RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop)
static const EnumPropertyItem prop_shading_type_items[]
View3D * CTX_wm_view3d(const bContext *C)
void VIEW3D_OT_camera_background_image_add(wmOperatorType *ot)
static wmOperatorStatus view_lock_clear_exec(bContext *C, wmOperator *)
void ED_area_tag_redraw(ScrArea *area)
void ED_view3d_shade_update(Main *bmain, View3D *v3d, ScrArea *area)
static wmOperatorStatus camera_background_image_remove_exec(bContext *C, wmOperator *op)
static wmOperatorStatus drop_world_exec(bContext *C, wmOperator *op)
float angle_wrap_rad(float angle)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
eCamera_BGImage_Flag flag
eRegionView3D_Persp persp
struct Object * ob_center
wmOperatorStatus(*) exec(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
void(*) cancel(bContext *C, wmOperator *op)
bool(*) poll(bContext *C) ATTR_WARN_UNUSED_RESULT
wmOperatorStatus(*) invoke(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
wmOperatorStatus(*) modal(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
struct ReportList * reports
struct wmOperatorType * type