!B (Sandbox) (CE-21795) Importing models with multisubmaterials via fbx switches...
[CRYENGINE.git] / Code / CryEngine / CrySchematyc2 / Script / GraphNodes / ScriptGraphCommentNode.cpp
blob9abed7f87f1ecbeaf518d7e1e1ffb726ecd87ac2
1 // Copyright 2001-2019 Crytek GmbH / Crytek Group. All rights reserved.
3 #include "StdAfx.h"
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"
12 namespace Schematyc2
14 const SGUID CScriptGraphCommentNode::s_typeGUID = "1EA03A11-C06C-4A26-B611-563CB152E57F";
16 CScriptGraphCommentNode::CScriptGraphCommentNode()
17 : m_str()
19 SetName("Comment");
22 CScriptGraphCommentNode::CScriptGraphCommentNode(const SGUID& guid)
23 : CScriptGraphNodeBase(guid)
24 , m_str()
26 SetName("Comment");
29 CScriptGraphCommentNode::CScriptGraphCommentNode(const SGUID& guid, const Vec2& pos)
30 : CScriptGraphNodeBase(guid, pos)
31 , m_str()
33 SetName("Comment");
36 const char* CScriptGraphCommentNode::GetComment() const
38 return m_str.c_str();
41 SGUID CScriptGraphCommentNode::GetTypeGUID() const
43 return s_typeGUID;
46 EScriptGraphColor CScriptGraphCommentNode::GetColor() const
48 return EScriptGraphColor::White;
51 void CScriptGraphCommentNode::Refresh(const SScriptRefreshParams& params)
53 CScriptGraphNodeBase::Refresh(params);
54 SetName("Comment");
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
72 // IMenuCommand
73 IScriptGraphNodePtr Execute(const Vec2& pos)
75 return std::make_shared<CScriptGraphCommentNode>(gEnv->pSchematyc2->CreateGUID(), pos);
77 // ~IMenuCommand
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>());