Add VIS_Editor visibility flag

qteditor
Sven Eberhardt 2016-08-02 00:13:53 -04:00
parent 582c82c159
commit 1d566ec6c5
5 changed files with 12 additions and 4 deletions

View File

@ -54,6 +54,10 @@ this.Visibility = [<funclink>VIS_Enemies</funclink>]; // This is also possible (
<col><code>VIS_OverlayOnly</code></col>
<col>Only overlays will be visible, other visibility-rules still apply.</col>
</row>
<row id="VIS_Editor">
<col><code>VIS_Editor</code></col>
<col>Visible in editor (both neutral and player viewports).</col>
</row>
</table>
</text>
<related>

View File

@ -69,7 +69,3 @@ public func GetConditionalIDList(string condition, string name, proplist default
id = { Type = "def", Filter=condition } } };
return { Name = name, Type = "array", Display = 3, Elements = counted_id };
}
// TODO: Implement a true VIS_Editor in the engine
static const VIS_Editor = VIS_God;

View File

@ -43,6 +43,7 @@
#include "graphics/C4GraphicsResource.h"
#include "game/C4GraphicsSystem.h"
#include "game/C4Game.h"
#include "game/C4Application.h"
#include "player/C4PlayerList.h"
#include "object/C4GameObjects.h"
#include "control/C4Record.h"
@ -4161,6 +4162,11 @@ bool C4Object::IsVisible(int32_t iForPlr, bool fAsOverlay) const
if (!fAsOverlay) return false;
if (Visibility == VIS_OverlayOnly) return true;
}
// editor visibility
if (::Application.isEditor)
{
if (Visibility & VIS_Editor) return true;
}
// check visibility
fDraw=false;
if (Visibility & VIS_Owner) fDraw = fDraw || (iForPlr==Owner);

View File

@ -69,6 +69,7 @@
#define VIS_God 32
#define VIS_LayerToggle 64
#define VIS_OverlayOnly 128
#define VIS_Editor 256
// Helper struct to serialize an object's mesh instance with other object's mesh instances attached
class C4MeshDenumerator: public StdMeshInstance::AttachedMesh::Denumerator

View File

@ -2435,6 +2435,7 @@ C4ScriptConstDef C4ScriptObjectConstMap[]=
{ "VIS_God" ,C4V_Int, VIS_God},
{ "VIS_LayerToggle" ,C4V_Int, VIS_LayerToggle},
{ "VIS_OverlayOnly" ,C4V_Int, VIS_OverlayOnly},
{ "VIS_Editor" ,C4V_Int, VIS_Editor},
{ "C4MN_Style_Normal" ,C4V_Int, C4MN_Style_Normal},
{ "C4MN_Style_Context" ,C4V_Int, C4MN_Style_Context},