parent
266fc1c1ff
commit
3cefb27830
Notes:
blender-bot
2023-02-14 06:47:29 +01:00
Referenced by issue #55281, Wireframe crash
|
@ -47,8 +47,6 @@
|
|||
#include "WM_types.h"
|
||||
#include "WM_message.h"
|
||||
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
#include "view3d_intern.h" /* own include */
|
||||
|
||||
|
||||
|
@ -78,9 +76,7 @@ static bool WIDGETGROUP_camera_poll(const bContext *C, wmManipulatorGroupType *U
|
|||
|
||||
static void WIDGETGROUP_camera_setup(const bContext *C, wmManipulatorGroup *mgroup)
|
||||
{
|
||||
const Depsgraph *depsgraph = CTX_data_depsgraph(C);
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
const Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob);
|
||||
float dir[3];
|
||||
|
||||
const wmManipulatorType *wt_arrow = WM_manipulatortype_find("MANIPULATOR_WT_arrow_3d", true);
|
||||
|
@ -88,7 +84,7 @@ static void WIDGETGROUP_camera_setup(const bContext *C, wmManipulatorGroup *mgro
|
|||
struct CameraWidgetGroup *camgroup = MEM_callocN(sizeof(struct CameraWidgetGroup), __func__);
|
||||
mgroup->customdata = camgroup;
|
||||
|
||||
negate_v3_v3(dir, ob_eval->obmat[2]);
|
||||
negate_v3_v3(dir, ob->obmat[2]);
|
||||
|
||||
/* dof distance */
|
||||
{
|
||||
|
@ -128,28 +124,26 @@ static void WIDGETGROUP_camera_refresh(const bContext *C, wmManipulatorGroup *mg
|
|||
if (!mgroup->customdata)
|
||||
return;
|
||||
|
||||
const Depsgraph *depsgraph = CTX_data_depsgraph(C);
|
||||
struct CameraWidgetGroup *camgroup = mgroup->customdata;
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
const Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob);
|
||||
Camera *ca = ob_eval->data;
|
||||
Camera *ca = ob->data;
|
||||
PointerRNA camera_ptr;
|
||||
float dir[3];
|
||||
|
||||
const float ob_scale_inv[3] = {
|
||||
1.0f / len_v3(ob_eval->obmat[0]),
|
||||
1.0f / len_v3(ob_eval->obmat[1]),
|
||||
1.0f / len_v3(ob_eval->obmat[2]),
|
||||
1.0f / len_v3(ob->obmat[0]),
|
||||
1.0f / len_v3(ob->obmat[1]),
|
||||
1.0f / len_v3(ob->obmat[2]),
|
||||
};
|
||||
const float ob_scale_uniform_inv = (ob_scale_inv[0] + ob_scale_inv[1] + ob_scale_inv[2]) / 3.0f;
|
||||
|
||||
RNA_pointer_create(&ca->id, &RNA_Camera, ca, &camera_ptr);
|
||||
|
||||
negate_v3_v3(dir, ob_eval->obmat[2]);
|
||||
negate_v3_v3(dir, ob->obmat[2]);
|
||||
|
||||
if (ca->flag & CAM_SHOWLIMITS) {
|
||||
WM_manipulator_set_matrix_location(camgroup->dop_dist, ob_eval->obmat[3]);
|
||||
WM_manipulator_set_matrix_rotation_from_yz_axis(camgroup->dop_dist, ob_eval->obmat[1], dir);
|
||||
WM_manipulator_set_matrix_location(camgroup->dop_dist, ob->obmat[3]);
|
||||
WM_manipulator_set_matrix_rotation_from_yz_axis(camgroup->dop_dist, ob->obmat[1], dir);
|
||||
WM_manipulator_set_scale(camgroup->dop_dist, ca->drawsize);
|
||||
WM_manipulator_set_flag(camgroup->dop_dist, WM_MANIPULATOR_HIDDEN, false);
|
||||
|
||||
|
@ -186,8 +180,8 @@ static void WIDGETGROUP_camera_refresh(const bContext *C, wmManipulatorGroup *mg
|
|||
aspect[1] = (sensor_fit == CAMERA_SENSOR_FIT_HOR) ? aspy / aspx : 1.0f;
|
||||
|
||||
unit_m4(widget->matrix_basis);
|
||||
WM_manipulator_set_matrix_location(widget, ob_eval->obmat[3]);
|
||||
WM_manipulator_set_matrix_rotation_from_yz_axis(widget, ob_eval->obmat[1], dir);
|
||||
WM_manipulator_set_matrix_location(widget, ob->obmat[3]);
|
||||
WM_manipulator_set_matrix_rotation_from_yz_axis(widget, ob->obmat[1], dir);
|
||||
|
||||
if (is_ortho) {
|
||||
scale_matrix = ca->ortho_scale * 0.5f;
|
||||
|
|
Loading…
Reference in New Issue