1 // Copyright 2001-2018 Crytek GmbH / Crytek Group. All rights reserved.
5 #include "CrySchematyc2/Prerequisites.h"
7 #include <CrySerialization/Forward.h>
8 #include <CrySchematyc2/TemplateUtils/TemplateUtils_Delegate.h>
10 #include "CrySchematyc2/BasicTypes.h"
11 #include "CrySchematyc2/GUID.h"
16 struct IScriptExtensionMap
;
19 //////////////////////////////////////////////////
21 struct IScriptElement
;
23 struct INewScriptFile
// #SchematycTODO : Move to separate file?
25 virtual ~INewScriptFile() {}
27 virtual SGUID
GetGUID() const = 0;
28 virtual const char* GetName() const = 0;
29 virtual const CTimeValue
& GetTimeStamp() const = 0; // #SchematycTODO : Should we be getting the timestamp directly from the file itself?
30 virtual void AddElement(IScriptElement
& element
) = 0;
31 virtual void RemoveElement(IScriptElement
& element
) = 0;
32 virtual uint32
GetElementCount() const = 0;
35 //////////////////////////////////////////////////
37 enum class EScriptElementType
49 AbstractInterfaceFunction
,
50 AbstractInterfaceTask
,
59 AbstractInterfaceImplementation
,
65 enum class EScriptElementFlags
68 System
= BIT(0), // Element was created by system and therefore can't be removed by users.
69 FromFile
= BIT(1), // Element was loaded from file.
70 Discard
= BIT(2) // #SchematycTODO : Either remove or replace with flag indicating element 'can' be discarded.
71 // #SchematycTODO : Use flags to specify whether element can be renamed, copied, removed etc?
74 DECLARE_ENUM_CLASS_FLAGS(EScriptElementFlags
)
76 typedef TemplateUtils::CDelegate
<void (const SGUID
&)> ScriptDependancyEnumerator
;
78 enum class EScriptRefreshReason
80 Load
, // Sent immediately after all files have been loaded.
81 EditorAdd
, // Editor only. Sent immediately after element is first added to file.
82 EditorFixUp
, // Editor only. Sent after editor plug-in has been initialized to fix-up files and resolve broken/deprecated dependencies.
83 EditorPaste
, // Editor only. Sent immediately after one or more elements have been pasted to file.
84 EditorEnvModified
, // Editor only. Sent when environment has been modified.
85 EditorDependencyModified
, // Editor only. Sent when a dependency has been modified.
86 EditorSelect
, // Editor only. Sent when an element is selected.
90 struct SScriptRefreshParams
92 explicit inline SScriptRefreshParams(EScriptRefreshReason _reason
, const SGUID
& _guid
= SGUID())
97 EScriptRefreshReason reason
;
101 struct IScriptElement
103 virtual ~IScriptElement() {}
105 virtual EScriptElementType
GetElementType() const = 0;
107 virtual IScriptFile
& GetFile() = 0;
108 virtual const IScriptFile
& GetFile() const = 0;
109 virtual SGUID
GetGUID() const = 0;
110 virtual SGUID
GetScopeGUID() const = 0; // #SchematycTODO : Remove?
112 virtual bool SetName(const char* szName
) = 0;
113 virtual const char* GetName() const = 0;
114 //virtual void SetAccessor(EAccessor accessor) = 0;
115 virtual EAccessor
GetAccessor() const = 0;
116 virtual EGraphExecutionFilter
GetExecutionFilter() const = 0;
117 virtual void SetElementFlags(EScriptElementFlags flags
) = 0;
118 virtual EScriptElementFlags
GetElementFlags() const = 0;
119 virtual void SetNewFile(INewScriptFile
* pNewFile
) = 0;
120 virtual INewScriptFile
* GetNewFile() = 0;
121 virtual const INewScriptFile
* GetNewFile() const = 0;
123 ////////////////////////////////////////////////////////////////////////////////////////////////////
124 // #SchematycTODO : Can these functions be made private/protected?
125 virtual void AttachChild(IScriptElement
& child
) = 0;
126 virtual void DetachChild(IScriptElement
& child
) = 0;
127 virtual void SetParent(IScriptElement
* pParent
) = 0;
128 virtual void SetPrevSibling(IScriptElement
* pPrevSibling
) = 0;
129 virtual void SetNextSibling(IScriptElement
* pNextSibling
) = 0;
130 ////////////////////////////////////////////////////////////////////////////////////////////////////
132 virtual IScriptElement
* GetParent() = 0;
133 virtual const IScriptElement
* GetParent() const = 0;
134 virtual IScriptElement
* GetFirstChild() = 0;
135 virtual const IScriptElement
* GetFirstChild() const = 0;
136 virtual IScriptElement
* GetLastChild() = 0;
137 virtual const IScriptElement
* GetLastChild() const = 0;
138 virtual IScriptElement
* GetPrevSibling() = 0;
139 virtual const IScriptElement
* GetPrevSibling() const = 0;
140 virtual IScriptElement
* GetNextSibling() = 0;
141 virtual const IScriptElement
* GetNextSibling() const = 0;
143 virtual IScriptExtensionMap
& GetExtensions() = 0;
144 virtual const IScriptExtensionMap
& GetExtensions() const = 0;
146 virtual void EnumerateDependencies(const ScriptDependancyEnumerator
& enumerator
) const = 0;
147 virtual void Refresh(const SScriptRefreshParams
& params
) = 0;
148 virtual void Serialize(Serialization::IArchive
& archive
) = 0;
149 virtual void RemapGUIDs(IGUIDRemapper
& guidRemapper
) = 0;