1 // Copyright 2001-2016 Crytek GmbH / Crytek Group. All rights reserved.
6 #include "MainFrameWnd.h"
10 CCryLinkCommands
CCryLinkCommands::s_instance
;
12 static void RpcEditorShow(IConsoleCmdArgs
* pArgs
)
17 if(pArgs
->GetArgCount() >= 2)
19 itemGuid
= StringUtils::SysGUIDFromString(pArgs
->GetArg(1));
23 if(pArgs
->GetArgCount() >= 3)
25 childGuid
= StringUtils::SysGUIDFromString(pArgs
->GetArg(2));
30 if(CWnd
* mainWnd
= GetIEditor()->OpenView("Schematyc2"))
32 static_cast<CMainFrameWnd
*>(mainWnd
)->SelectItem(itemGuid
, childGuid
);
38 static void RpcRefreshDetailView(IConsoleCmdArgs
* pArgs
)
42 if (CWnd
* mainWnd
= GetIEditor()->FindView("Schematyc2"))
44 static_cast<CMainFrameWnd
*>(mainWnd
)->UpdatePreview();
49 static void RpcEditorGoto(IConsoleCmdArgs
* pArgs
)
54 if (pArgs
->GetArgCount() >= 2)
56 itemGuid
= StringUtils::SysGUIDFromString(pArgs
->GetArg(1));
60 if (pArgs
->GetArgCount() >= 3)
62 lastItemGuid
= StringUtils::SysGUIDFromString(pArgs
->GetArg(2));
67 if (CWnd
* mainWnd
= GetIEditor()->OpenView("Schematyc2"))
69 static_cast<CMainFrameWnd
*>(mainWnd
)->GotoItem(itemGuid
, lastItemGuid
);
75 static void DiffSelectedItem()
77 if (CWnd
* mainWnd
= GetIEditor()->OpenView("Schematyc2"))
79 static_cast<CMainFrameWnd
*>(mainWnd
)->DiffSelectedItem();
83 static void RpcEditorShowAndDiff(IConsoleCmdArgs
* pArgs
)
89 CCryLinkCommands::CCryLinkCommands()
91 , m_bRegistered(false)
96 CCryLinkCommands::~CCryLinkCommands()
101 void CCryLinkCommands::Register(IConsole
* pConsole
)
103 CRY_ASSERT(pConsole
);
104 m_pConsole
= pConsole
;
105 if(m_pConsole
&& !m_bRegistered
)
107 REGISTER_COMMAND("sc_rpcShowLegacy", RpcEditorShow
, VF_NULL
, "Opens the specified graph in Schematyc editor and focuses the optional child: Properties: docGuid childGuid");
108 REGISTER_COMMAND("sc_rpcGotoLegacy", RpcEditorGoto
, VF_NULL
, "Opens the specified graph in Schematyc editor");
109 REGISTER_COMMAND("sc_rpcShowAndDiffLegacy", RpcEditorShowAndDiff
, VF_NULL
, "Opens the specified graph in Schematyc editor and diff with have version: Properties: docGuid");
110 REGISTER_COMMAND("sc_rpcRefreshDetailViewLegacy", RpcRefreshDetailView
, VF_NULL
, "Refreshes the detail view");
112 m_bRegistered
= true;
116 void CCryLinkCommands::Unregister()
118 if(m_pConsole
&& m_bRegistered
)
120 m_pConsole
->RemoveCommand("sc_rpcShowLegacy");
121 m_pConsole
->RemoveCommand("sc_rpcGotoLegacy");
122 m_pConsole
->RemoveCommand("sc_rpcShowAndDiffLegacy");
123 m_pConsole
->RemoveCommand("sc_rpcRefreshDetailViewLegacy");
125 m_bRegistered
= false;