Skip to content

Commit 40e7fe5

Browse files
committed
Rework camera view variable access
1 parent 42a57dd commit 40e7fe5

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

editor/import/3d/scene_import_settings.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -667,19 +667,19 @@ void SceneImportSettingsDialog::_update_camera() {
667667
Vector3 center = camera_aabb.get_center();
668668
float camera_size = camera_aabb.get_longest_axis_size();
669669

670-
const int view = GLOBAL_GET("editor/import/camera_view");
671-
672670
Transform3D xf;
673-
if (view == 0) {
671+
if (current_camera_view == 0) {
672+
WARN_PRINT("Camera set to orthogonal");
674673
camera->set_orthogonal(camera_size * zoom, 0.0001, camera_size * 2);
675674
xf.basis = Basis(Vector3(0, 1, 0), rot_y) * Basis(Vector3(1, 0, 0), rot_x);
676675
xf.origin = center;
677676
xf.translate_local(0, 0, camera_size);
678677
} else {
678+
WARN_PRINT("Camera set to perspective");
679679
camera->set_perspective(camera_size * 2, 0.0001, camera_size * zoom * 12);
680680
xf.basis = Basis(Vector3(0, 1, 0), rot_y) * Basis(Vector3(1, 0, 0), rot_x);
681681
xf.origin = center;
682-
xf.translate_local(0, 0, camera_size * zoom * 10);
682+
xf.translate_local(0, 0, camera_size * zoom * 5);
683683
}
684684

685685
camera->set_transform(xf);
@@ -1778,6 +1778,8 @@ SceneImportSettingsDialog::SceneImportSettingsDialog() {
17781778
base_viewport->add_child(camera);
17791779
camera->make_current();
17801780

1781+
current_camera_view = GLOBAL_GET("editor/import/camera_view");
1782+
17811783
if (GLOBAL_GET("rendering/lights_and_shadows/use_physical_light_units")) {
17821784
camera_attributes.instantiate();
17831785
camera->set_attributes(camera_attributes);

editor/import/3d/scene_import_settings.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,8 @@ class SceneImportSettingsDialog : public ConfirmationDialog {
223223

224224
int current_action = 0;
225225

226+
int current_camera_view = 0;
227+
226228
Vector<TreeItem *> save_path_items;
227229

228230
TreeItem *save_path_item = nullptr;

0 commit comments

Comments
 (0)