89 const float4x4 &ob_mat = ob->object_to_world();
144 float (*matrix)[4] =
static_cast<float (*)[4]
>(value_p);
155 float gizmo_scale =
camera->ortho_scale;
157 matrix[0][0] = gizmo_scale;
158 matrix[1][1] = gizmo_scale;
163 const float4x4 &ob_mat = ob->object_to_world();
166 matrix[3][0] =
camera->shiftx * gizmo_scale * -matrix_sign;
167 matrix[3][1] =
camera->shifty * gizmo_scale;
174 const float (*matrix)[4] =
static_cast<const float (*)[4]
>(value_p);
189 float ortho_scale =
len_v3(matrix[0]);
210 const float4x4 &ob_mat = ob->object_to_world();
235 &ca->id, RNA_CameraDOFSettings, &ca->dof);
237 cagzgroup->
dop_dist,
"offset", &camera_dof_ptr,
"focus_distance", -1);
246 const bool is_ortho = (ca->type ==
CAM_ORTHO);
252 float scale_matrix = 1.0f;
262 offset[0] = ((ob->
scale[0] > 0.0f) ? -2.0f : 2.0f) * ca->shiftx;
263 offset[1] = 2.0f * ca->shifty;
274 float zscale_or_one = ob->
scale[2] == 0.0f ? 1.0f :
fabsf(ob->
scale[2]);
276 0.0f, 0.0f, -1.0f * ca->drawsize / zscale_or_one};
284 const float *gizmo_y_axis = ob_mat.
ptr()[1];
292 const float pivot[2] = {ca->shiftx, -ca->shifty};
295 mul_v2_fl(offset, ca->ortho_scale * 0.5f);
302 const float ob_scale_inv[3] = {
307 const float ob_scale_uniform_inv = (ob_scale_inv[0] + ob_scale_inv[1] + ob_scale_inv[2]) /
309 scale_matrix = (ca->drawsize * 0.5f) / ob_scale_uniform_inv;
334 widget, gz_prop_type, &camera_ptr, ortho_scale_prop, -1);
344 float step, precision;
352 scale_matrix * range /
354 (0.5f * sensor_size));
380 msg_sub_value_gz_tag_refresh.
owner = region;
386 &rna_CameraDOFSettings_focus_distance,
387 &rna_Camera_display_size,
388 &rna_Camera_ortho_scale,
389 &rna_Camera_sensor_fit,
390 &rna_Camera_sensor_width,
391 &rna_Camera_sensor_height,
408 mbus, RenderSettings, resolution_x, &msg_sub_value_gz_tag_refresh);
410 mbus, RenderSettings, resolution_y, &msg_sub_value_gz_tag_refresh);
412 mbus, RenderSettings, pixel_aspect_x, &msg_sub_value_gz_tag_refresh);
414 mbus, RenderSettings, pixel_aspect_y, &msg_sub_value_gz_tag_refresh);
420 gzgt->
name =
"Camera Widgets";
421 gzgt->
idname =
"VIEW3D_GGT_camera";
457 float (*matrix)[4] =
static_cast<float (*)[4]
>(value_p);
461 const rctf *border = viewgroup->
state.edit_border;
474 const float (*matrix)[4] =
static_cast<const float (*)[4]
>(value_p);
477 rctf *border = viewgroup->
state.edit_border;
562 scene, depsgraph, v3d, rv3d, region->
winx, region->
winy,
false,
false,
true);
572 viewgroup->
state.view_border = rect;
573 viewgroup->
state.roll = 0.0f;
574 viewgroup->
state.flipped_x =
false;
585 if (viewgroup->
state.roll != 0.0f || viewgroup->
state.flipped_x) {
586 const int center_x = region->
winx / 2;
587 const int center_y = region->
winy / 2;
595 if (viewgroup->
state.flipped_x) {
615 viewgroup->
scene = scene;
634 viewgroup->
state.roll = 0.0f;
635 viewgroup->
state.flipped_x =
false;
651 gzgt->
name =
"Camera View Widgets";
652 gzgt->
idname =
"VIEW3D_GGT_camera_view";
Camera data-block and utility functions.
Object is a sort of wrapper for general info.
Read Blender memory allocation and freeing.
VecBase< float, D > step(VecOp< float, D >, VecOp< float, D >) RET
void camera(KernelGlobals &kg, const ShadingData &sd, float3 &outview, float &outdepth, float &outdist)
VecBase< float, 3 > float3
VecBase< T, 3 > transform_point(const CartesianBasis &basis, const VecBase< T, 3 > &v)
void get_color_3fv(int colorid, float col[3])
static void WIDGETGROUP_camera_setup(const bContext *C, wmGizmoGroup *gzgroup)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
MINLINE void negate_v3_v3(float r[3], const float a[3])
void RNA_float_set_array(PointerRNA *ptr, const char *name, const float *values)
void ED_gizmo_arrow3d_set_range_fac(wmGizmo *gz, const float range_fac)
static void WIDGETGROUP_camera_refresh(const bContext *C, wmGizmoGroup *gzgroup)
Object * BKE_view_layer_active_object_get(const ViewLayer *view_layer)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
void WM_gizmo_do_msg_notify_tag_refresh(bContext *, wmMsgSubscribeKey *, wmMsgSubscribeValue *msg_val)
void BLI_rctf_recenter(struct rctf *rect, float x, float y)
void WM_gizmo_set_matrix_rotation_from_yz_axis(wmGizmo *gz, const float y_axis[3], const float z_axis[3])
void RNA_property_update_main(Main *bmain, Scene *scene, PointerRNA *ptr, PropertyRNA *prop)
void WM_gizmo_target_property_def_func(wmGizmo *gz, const char *idname, const wmGizmoPropertyFnParams *params)
PointerRNA RNA_id_pointer_create(ID *id)
MINLINE void mul_v2_fl(float r[2], float f)
void RNA_property_float_set(PointerRNA *ptr, PropertyRNA *prop, float value)
static void gizmo_orthoscale_prop_matrix_get(const wmGizmo *, wmGizmoProperty *gz_prop, void *value_p)
const wmGizmoPropertyType * WM_gizmotype_target_property_find(const wmGizmoType *gzt, const char *idname)
const wmGizmoType * WM_gizmotype_find(const StringRef idname, bool quiet)
void BLI_rctf_resize(struct rctf *rect, float x, float y)
bool is_negative_m4(const float mat[4][4])
static bool WIDGETGROUP_camera_poll(const bContext *C, wmGizmoGroupType *)
void RNA_enum_set(PointerRNA *ptr, const char *name, int value)
Base * BKE_view_layer_active_base_get(ViewLayer *view_layer)
void WM_gizmo_set_matrix_offset_location(wmGizmo *gz, const float offset[3])
@ ED_GIZMO_CAGE_XFORM_FLAG_SCALE
@ ED_GIZMO_CAGE_XFORM_FLAG_TRANSLATE
@ ED_GIZMO_CAGE_XFORM_FLAG_SCALE_UNIFORM
MatBase< float, 4, 4 > float4x4
void VIEW3D_GGT_camera(wmGizmoGroupType *gzgt)
ViewLayer * CTX_data_view_layer(const bContext *C)
MINLINE void mul_v3_fl(float r[3], float f)
@ ED_GIZMO_CAGE2D_STYLE_BOX
void WM_gizmo_target_property_def_rna(wmGizmo *gz, const char *idname, PointerRNA *ptr, const char *propname, int index)
void WM_gizmo_set_scale(wmGizmo *gz, const float scale)
void VIEW3D_GGT_camera_view(wmGizmoGroupType *gzgt)
static void WIDGETGROUP_camera_view_setup(const bContext *, wmGizmoGroup *gzgroup)
void WM_gizmo_set_flag(wmGizmo *gz, const int flag, const bool enable)
void * MEM_new_zeroed(size_t len, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2)
void WM_gizmo_target_property_clear_rna_ptr(wmGizmo *gz, const wmGizmoPropertyType *gz_prop_type)
@ ED_GIZMO_ARROW_XFORM_FLAG_CONSTRAINED
void DEG_id_tag_update(ID *id, unsigned int flags)
BLI_INLINE float BLI_rctf_size_y(const struct rctf *rct)
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)
@ V3D_GIZMO_SHOW_CAMERA_DOF_DIST
@ V3D_GIZMO_SHOW_CAMERA_LENS
constexpr size_t ARRAY_SIZE(const T(&arg)[N]) noexcept
bool BKE_view_layer_synced_ensure(const Main &bmain, const Scene *scene, ViewLayer *view_layer)
void unit_m4(float m[4][4])
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
static void WIDGETGROUP_camera_view_refresh(const bContext *C, wmGizmoGroup *gzgroup)
static bool WIDGETGROUP_camera_view_poll(const bContext *C, wmGizmoGroupType *)
MINLINE float len_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT
wmGizmo * WM_gizmo_new(const StringRef idname, wmGizmoGroup *gzgroup, PointerRNA *properties)
bool WM_gizmo_group_is_modal(const wmGizmoGroup *gzgroup)
int BKE_camera_sensor_fit(int sensor_fit, float sizex, float sizey)
@ ED_GIZMO_ARROW_STYLE_CONE
@ ED_GIZMO_ARROW_STYLE_CROSS
static void WIDGETGROUP_camera_message_subscribe(const bContext *C, wmGizmoGroup *gzgroup, wmMsgBus *mbus)
void WM_msg_subscribe_rna(wmMsgBus *mbus, PointerRNA *ptr, const PropertyRNA *prop, const wmMsgSubscribeValue *msg_val_params, const char *id_repr)
@ WM_GIZMOGROUPTYPE_DEPTH_3D
@ WM_GIZMOGROUPTYPE_PERSISTENT
@ WM_GIZMOGROUPTYPE_SCALE
float BKE_camera_sensor_size(int sensor_fit, float sensor_x, float sensor_y)
void rotate_m4(float mat[4][4], char axis, float angle)
Depsgraph * CTX_data_expect_evaluated_depsgraph(const bContext *C)
void transpose_m4(float R[4][4])
Main * CTX_data_main(const bContext *C)
BLI_INLINE float BLI_rctf_size_x(const struct rctf *rct)
bool BLI_rctf_isect(const struct rctf *src1, const struct rctf *src2, struct rctf *dest)
BLI_INLINE float BLI_rctf_cent_y(const struct rctf *rct)
static void gizmo_render_border_prop_matrix_set(const wmGizmo *, wmGizmoProperty *gz_prop, const void *value_p)
MINLINE void negate_v4(float r[4])
static void gizmo_render_border_prop_matrix_get(const wmGizmo *, wmGizmoProperty *gz_prop, void *value_p)
Scene * CTX_data_scene(const bContext *C)
wmKeyMap * WM_gizmogroup_setup_keymap_generic_maybe_drag(const wmGizmoGroupType *, wmKeyConfig *kc)
static void WIDGETGROUP_camera_view_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup)
void RNA_property_float_ui_range(PointerRNA *ptr, PropertyRNA *prop, float *softmin, float *softmax, float *step, float *precision)
void WM_gizmo_set_matrix_location(wmGizmo *gz, const float origin[3])
wmGizmo * WM_gizmo_new_ptr(const wmGizmoType *gzt, wmGizmoGroup *gzgroup, PointerRNA *properties)
bool BKE_id_is_editable(const Main *bmain, const ID *id)
void WM_gizmo_target_property_def_rna_ptr(wmGizmo *gz, const wmGizmoPropertyType *gz_prop_type, PointerRNA *ptr, PropertyRNA *prop, int index)
static void gizmo_orthoscale_prop_matrix_set(const wmGizmo *, wmGizmoProperty *gz_prop, const void *value_p)
ARegion * CTX_wm_region(const bContext *C)
BLI_INLINE float BLI_rctf_cent_x(const struct rctf *rct)
View3D * CTX_wm_view3d(const bContext *C)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
const c_style_mat & ptr() const
eRegionView3D_Persp persp
eView3D_GizmoShowCamera gizmo_show_camera
eView3D_GizmoFlag gizmo_flag
wmGizmoGroupFnMsgBusSubscribe message_subscribe
wmGizmoGroupFnRefresh refresh
wmGizmoGroupFnSetupKeymap setup_keymap
wmGizmoGroupFnDrawPrepare draw_prepare
eWM_GizmoFlagGroupTypeFlag flag
wmGizmoMap * parent_gzmap
ListBaseT< wmGizmo > gizmos
wmGizmoPropertyFnSet value_set_fn
wmGizmoPropertyFnRangeGet range_get_fn
wmGizmoPropertyFnGet value_get_fn
const wmGizmoPropertyType * type
struct blender::wmGizmoProperty::@216011055122204070127377170176223170047224321165 custom_func
#define WM_msg_subscribe_rna_anon_prop(mbus, type_, prop_, value)