godotengine / godotengine/godot

3D viewport sun rotation not update after reopen the project.

Open
#115,491 0 comments 1 reaction 0 assignees View on GitHub
bug topic:3d topic:editor
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

Reproduce in 4.6-stable.

### System information

Windows 11 - 4.6.stable

### Issue description

3D viewport sun rotation not update when set editor states.

### Steps to reproduce

1. Set 3D viewport lighting preview settings, change the sun rotation.
2. Save a 3D scene.
3. Reopen the project, the sun is still the default value.

Default settings:
Image

Change sun rotation and save:
Image

Reopen the project, all settings are recovered but sun rotation:
Image

editor/scene/3d/node_3d_editor_plugin.cpp
https://github.com/godotengine/godot/blob/77579f93e6ee7cf2515da4a7a5000d8a0244be98/editor/scene/3d/node_3d_editor_plugin.cpp

in set_state function:
https://github.com/godotengine/godot/blob/77579f93e6ee7cf2515da4a7a5000d8a0244be98/editor/scene/3d/node_3d_editor_plugin.cpp#L7210

https://github.com/godotengine/godot/blob/77579f93e6ee7cf2515da4a7a5000d8a0244be98/editor/scene/3d/node_3d_editor_plugin.cpp#L7317

```c++
sun_rotation = pd["sun_rotation"];

environ_sky_color->set_pick_color(pd["environ_sky_color"]);
environ_ground_color->set_pick_color(pd["environ_ground_color"]);
```

should update like other settings:
```c++
sun_angle_altitude->set_value_no_signal(-Math::rad_to_deg(sun_rotation.x));
sun_angle_azimuth->set_value_no_signal(180.0 - Math::rad_to_deg(sun_rotation.y));
```

### Minimal reproduction project (MRP)

Test in any project.

Contributor guide

Open the contributing guide

Research direction

Start in editor/scene/3d/node_3d_editor_plugin.cpp at the set_state function around the linked lines, and compare sun_rotation restoration with the other lighting settings. Ensure the saved rotation is reflected in the sun altitude and azimuth controls, then reopen a saved 3D scene to verify the changed sun rotation is restored.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-graphics, tooling
Issue type
Bug
Difficulty
1/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.