If the user changed the portal Z scale in the editor the portal margin display could become incorrectly sized.
This is because the portal margin is measured in world space units, and has to be back calculated into model space using the inverse global transform of the portal node. The model space size of the margin is thus tied to the current scale of the node.
This PR forces updating the gizmo each time the transform is changed. This isn't super efficient, but as this is an editor only feature it should be okay, and it is unlikely to be a performance problem.
Due to a quirk in CSG Shapes, updating is usually deferred to the next frame. This is problematic as we need to read back the geometry on the first frame when converting levels.
This PR adds a function to CSGShape to force immediate updating (if dirty), and calls it during room conversion.
Portal margins were not being correctly sent to the PortalRenderer from the SceneTree, so all margins were being used as default (1.0). This PR fixes this.
The default autoplace algorithm places instances in the highest priority Room. It became apparent that there are some situations in which users will want to override this and force placement in a Room from a particular RoomGroup, especially an "outside" RoomGroup.
This setting allows the user to specify a preference for Room priority. When set to 0, the setting is ignored and the highest priority Room is chosen.
Although explicit portals did a check to detect internal portals, this check was missing from autolinked portals. This meant they were incorrectly clipping the room bounds of the enclosing outer room.
This PR adds a check for internal rooms during the autolinking and sets the internal flag where needed.
- Use background and line colors that match better with the
rest of the editor.
- Use translucent lines to make overlapping lines visible.
- Tweak the error message to mention the UV layer in question
when there is no UV for a defined layer.
(cherry picked from commit 8cdfd2e706)
- Allow some tolerance when clicking the plane move/scale,
even if the click is actually slightly outside the plane
(similar to Blender).
- Make the rotate manipulation circles visually thinner to be
less distracting.
- Make the hovered color less saturated to be more distinguishable
from the non-hovered state.
- Don't set brightness above 1.0 to prevent the gizmo from glowing
when hovered.
(cherry picked from commit 6cfcbbbb93)
The default portal margin is stored in the RoomManager. Previously this was propagated to Portals when the value was changed, and Portals each stored this default value.
This caused a bug during loading, if the RoomManager was loaded before Portals, the value was never propagated.
This PR makes the default margin a static value stored in the RoomManager, and the Portals now read directly from the static value when required, and do not store locally. This gets around the problem.
Use `System.Array.Empty<T>` to get an empty array instead of allocating
a new one every time. Since arrays are immutable there is no need to
allocate them every time.
(cherry picked from commit accd05f4ad)