1 [
ComponentEditorProps(
category:
"GameScripted/Editor", description:
"System to force streaming of all editable entities to client who has opened editor. Works only with SCR_EditorBaseEntity!", icon:
"WBData/ComponentEditorProps/componentEditor.png")]
13 protected RplIdentity m_EditorIdentity = RplIdentity.Invalid();
15 protected void EnableStreaming(
bool enable)
22 if (!m_EditorIdentity.IsValid())
24 PlayerController playerController =
GetGame().GetPlayerManager().GetPlayerController(GetManager().
GetPlayerID());
26 m_EditorIdentity = playerController.GetRplIdentity();
30 if (m_EditorIdentity == RplIdentity.Local())
34 set<SCR_EditableEntityComponent> entities =
new set<SCR_EditableEntityComponent>();
35 core.GetAllEntities(entities);
36 for (
int i = 0, count = entities.Count(); i < count; i++)
38 EnableStreamingForEntity(entities[i], enable);
44 if (!entity.GetOwner())
47 RplComponent entityRpl = RplComponent.Cast(entity.GetOwner().FindComponent(RplComponent));
50 entityRpl.EnableStreamingConNode(m_EditorIdentity, enable);
62 if (GetManager().IsOpened() && m_EditorIdentity != RplIdentity.Local())
63 GetGame().GetCallqueue().CallLater(EnableStreamingForEntity, 1,
false, entity,
false);
67 if (GetManager().IsOpened() && m_EditorIdentity != RplIdentity.Local())
68 EnableStreamingForEntity(entity,
true);
71 override void EOnEditorActivateServer()
73 EnableStreaming(
false);
77 core.Event_OnEntityRegistered.Insert(OnEntityRegistered);
79 override void EOnEditorDeactivateServer()
81 EnableStreaming(
true);
85 core.Event_OnEntityRegistered.Remove(OnEntityRegistered);