1 // Copyright 2001-2019 Crytek GmbH / Crytek Group. All rights reserved.
4 #include "Script/GraphNodes/ScriptGraphCommentNode.h"
6 #include <CrySchematyc2/IDomainContext.h>
7 #include <CrySchematyc2/Script/IScriptGraphNodeCompiler.h>
8 #include <CrySchematyc2/Script/IScriptGraphNodeCreationMenu.h>
10 #include "Script/GraphNodes/ScriptGraphNodeFactory.h"
14 const SGUID
CScriptGraphCommentNode::s_typeGUID
= "1EA03A11-C06C-4A26-B611-563CB152E57F";
16 CScriptGraphCommentNode::CScriptGraphCommentNode()
22 CScriptGraphCommentNode::CScriptGraphCommentNode(const SGUID
& guid
)
23 : CScriptGraphNodeBase(guid
)
29 CScriptGraphCommentNode::CScriptGraphCommentNode(const SGUID
& guid
, const Vec2
& pos
)
30 : CScriptGraphNodeBase(guid
, pos
)
36 const char* CScriptGraphCommentNode::GetComment() const
41 SGUID
CScriptGraphCommentNode::GetTypeGUID() const
46 EScriptGraphColor
CScriptGraphCommentNode::GetColor() const
48 return EScriptGraphColor::White
;
51 void CScriptGraphCommentNode::Refresh(const SScriptRefreshParams
& params
)
53 CScriptGraphNodeBase::Refresh(params
);
57 void CScriptGraphCommentNode::Serialize(Serialization::IArchive
& archive
)
59 CRY_PROFILE_FUNCTION(PROFILE_LOADING_ONLY
);
60 CScriptGraphNodeBase::Serialize(archive
);
61 archive(m_str
, "str", "Comment Contents");
64 void CScriptGraphCommentNode::Compile_New(IScriptGraphNodeCompiler
& compiler
) const
68 void CScriptGraphCommentNode::RegisterCreator(CScriptGraphNodeFactory
& factory
)
70 struct SNodeCreationMenuCommand
: public IScriptGraphNodeCreationMenuCommand
73 IScriptGraphNodePtr
Execute(const Vec2
& pos
)
75 return std::make_shared
<CScriptGraphCommentNode
>(gEnv
->pSchematyc2
->CreateGUID(), pos
);
80 struct SCreator
: public IScriptGraphNodeCreator
82 // IScriptGraphNodeCreator
83 virtual SGUID
GetTypeGUID() const override
85 return CScriptGraphCommentNode::s_typeGUID
;
88 virtual IScriptGraphNodePtr
CreateNode() override
90 return std::make_shared
<CScriptGraphCommentNode
>(gEnv
->pSchematyc2
->CreateGUID());
93 virtual void PopulateNodeCreationMenu(IScriptGraphNodeCreationMenu
& nodeCreationMenu
, const IDomainContext
& domainContext
, const IScriptGraphExtension
& graph
) override
95 nodeCreationMenu
.AddOption("Comment", "Add a simple comment", "", std::make_shared
<SNodeCreationMenuCommand
>());
97 // ~IScriptGraphNodeCreator
100 factory
.RegisterCreator(std::make_shared
<SCreator
>());