Add object rendering toggle
This commit is contained in:
parent
963ab721cd
commit
a6e667e1da
|
@ -29,6 +29,8 @@ public partial class Mission : Node3D
|
|||
}
|
||||
}
|
||||
|
||||
private const string OBJECT_MODELS_GROUP = "ObjectModels";
|
||||
|
||||
[Export(PropertyHint.GlobalFile, "*.mis")]
|
||||
public string FileName { get; set; }
|
||||
[Export]
|
||||
|
@ -94,10 +96,14 @@ public partial class Mission : Node3D
|
|||
{
|
||||
Build = true;
|
||||
}
|
||||
if (keyEvent.Keycode == Key.O)
|
||||
if (keyEvent.Keycode == Key.L)
|
||||
{
|
||||
ToggleLightmap();
|
||||
}
|
||||
if (keyEvent.Keycode == Key.O)
|
||||
{
|
||||
ToggleObjectRendering();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -127,6 +133,17 @@ public partial class Mission : Node3D
|
|||
}
|
||||
}
|
||||
|
||||
public void ToggleObjectRendering()
|
||||
{
|
||||
// It might be "better" to use a parent node and just toggle that, but
|
||||
// the performance of this is completely fine so we'll stick with it
|
||||
foreach (var node in GetTree().GetNodesInGroup(OBJECT_MODELS_GROUP))
|
||||
{
|
||||
var node3d = node as Node3D;
|
||||
node3d.Visible = !node3d.Visible;
|
||||
}
|
||||
}
|
||||
|
||||
public void ToggleLightmap()
|
||||
{
|
||||
if (_lmLayerMask == Vector2I.Zero)
|
||||
|
@ -309,6 +326,8 @@ public partial class Mission : Node3D
|
|||
}
|
||||
}
|
||||
|
||||
model.AddToGroup(OBJECT_MODELS_GROUP);
|
||||
|
||||
AddChild(model);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue