Fix Viewport interpolation mode

Viewport interpolation mode is a special case, which should be set to ON instead of INHERIT.
This commit is contained in:
lawnjelly 2024-05-20 08:56:04 +01:00 committed by Relintai
parent 2473bd2234
commit 4f1f6633e1
2 changed files with 8 additions and 0 deletions

View File

@ -211,6 +211,7 @@
<member name="msaa" type="int" setter="set_msaa" getter="get_msaa" enum="Viewport.MSAA" default="0"> <member name="msaa" type="int" setter="set_msaa" getter="get_msaa" enum="Viewport.MSAA" default="0">
The multisample anti-aliasing mode. A higher number results in smoother edges at the cost of significantly worse performance. A value of 4 is best unless targeting very high-end systems. The multisample anti-aliasing mode. A higher number results in smoother edges at the cost of significantly worse performance. A value of 4 is best unless targeting very high-end systems.
</member> </member>
<member name="physics_interpolation_mode" type="int" setter="set_physics_interpolation_mode" getter="get_physics_interpolation_mode" overrides="Node" enum="Node.PhysicsInterpolationMode" default="2" />
<member name="physics_object_picking" type="bool" setter="set_physics_object_picking" getter="get_physics_object_picking" default="false"> <member name="physics_object_picking" type="bool" setter="set_physics_object_picking" getter="get_physics_object_picking" default="false">
If [code]true[/code], the objects rendered by viewport become subjects of mouse picking process. If [code]true[/code], the objects rendered by viewport become subjects of mouse picking process.
</member> </member>

View File

@ -3469,6 +3469,13 @@ Viewport::Viewport() {
local_input_handled = false; local_input_handled = false;
handle_input_locally = true; handle_input_locally = true;
physics_last_id = 0; //ensures first time there will be a check physics_last_id = 0; //ensures first time there will be a check
// Physics interpolation mode for viewports is a special case.
// Typically viewports will be housed within Controls,
// and Controls default to PHYSICS_INTERPOLATION_MODE_OFF.
// Viewports can thus inherit physics interpolation OFF, which is unexpected.
// Setting to ON allows each viewport to have a fresh interpolation state.
set_physics_interpolation_mode(Node::PHYSICS_INTERPOLATION_MODE_ON);
} }
Viewport::~Viewport() { Viewport::~Viewport() {