git mv Code\Sandbox\Editor Code/Editor
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,791 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
// Description : Classes to deal with commands
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_INCLUDE_COMMAND_H
|
||||
#define CRYINCLUDE_EDITOR_INCLUDE_COMMAND_H
|
||||
#pragma once
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include "Util/EditorUtils.h"
|
||||
|
||||
inline string ToString(const QString& s)
|
||||
{
|
||||
return s.toUtf8().data();
|
||||
}
|
||||
|
||||
class CCommand
|
||||
{
|
||||
public:
|
||||
CCommand(
|
||||
const string& module,
|
||||
const string& name,
|
||||
const string& description,
|
||||
const string& example)
|
||||
: m_module(module)
|
||||
, m_name(name)
|
||||
, m_description(description)
|
||||
, m_example(example)
|
||||
, m_bAlsoAvailableInScripting(false)
|
||||
{}
|
||||
|
||||
virtual ~CCommand()
|
||||
{}
|
||||
|
||||
// Class for storing function parameters as a type-erased string
|
||||
struct CArgs
|
||||
{
|
||||
public:
|
||||
CArgs()
|
||||
: m_stringFlags(0)
|
||||
{}
|
||||
|
||||
template <typename T>
|
||||
void Add(T p)
|
||||
{
|
||||
assert(m_args.size() < 8 * sizeof(m_stringFlags));
|
||||
m_args.push_back(ToString(p));
|
||||
}
|
||||
void Add(const char* p)
|
||||
{
|
||||
assert(m_args.size() < 8 * sizeof(m_stringFlags));
|
||||
m_stringFlags |= 1 << m_args.size();
|
||||
m_args.push_back(p);
|
||||
}
|
||||
bool IsStringArg(int i) const
|
||||
{
|
||||
if (i < 0 || i >= GetArgCount())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_stringFlags & (1 << i))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
int GetArgCount() const
|
||||
{ return m_args.size(); }
|
||||
const string& GetArg(int i) const
|
||||
{
|
||||
assert(0 <= i && i < GetArgCount());
|
||||
return m_args[i];
|
||||
}
|
||||
private:
|
||||
DynArray<string> m_args;
|
||||
unsigned char m_stringFlags; // This is needed to quote string parameters when logging a command.
|
||||
};
|
||||
|
||||
const string& GetName() const { return m_name; }
|
||||
const string& GetModule() const { return m_module; }
|
||||
const string& GetDescription() const { return m_description; }
|
||||
const string& GetExample() const { return m_example; }
|
||||
|
||||
void SetAvailableInScripting() { m_bAlsoAvailableInScripting = true; };
|
||||
bool IsAvailableInScripting() const { return m_bAlsoAvailableInScripting; }
|
||||
|
||||
virtual QString Execute(const CArgs& args) = 0;
|
||||
|
||||
// Only a command without any arguments and return value can be a UI command.
|
||||
virtual bool CanBeUICommand() const { return false; }
|
||||
|
||||
protected:
|
||||
friend class CEditorCommandManager;
|
||||
string m_module;
|
||||
string m_name;
|
||||
string m_description;
|
||||
string m_example;
|
||||
bool m_bAlsoAvailableInScripting;
|
||||
|
||||
template <typename T>
|
||||
static string ToString_(T t) { return ::ToString(t); }
|
||||
static inline string ToString_(const char* val)
|
||||
{ return val; }
|
||||
template <typename T>
|
||||
static bool FromString_(T& t, const char* s) { return ::FromString(t, s); }
|
||||
static inline bool FromString_(const char*& val, const char* s)
|
||||
{ return (val = s) != 0; }
|
||||
|
||||
void PrintHelp()
|
||||
{
|
||||
CryLogAlways("%s.%s:", m_module.c_str(), m_name.c_str());
|
||||
if (m_description.length() > 0)
|
||||
{
|
||||
CryLogAlways(" %s", m_description.c_str());
|
||||
}
|
||||
if (m_example.length() > 0)
|
||||
{
|
||||
CryLogAlways(" Usage: %s", m_example.c_str());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class CCommand0
|
||||
: public CCommand
|
||||
{
|
||||
public:
|
||||
CCommand0(const string& module, const string& name,
|
||||
const string& description, const string& example,
|
||||
const AZStd::function<void()>& functor)
|
||||
: CCommand(module, name, description, example)
|
||||
, m_functor(functor) {}
|
||||
|
||||
// UI metadata for this command, if any
|
||||
struct SUIInfo
|
||||
{
|
||||
string caption;
|
||||
string tooltip;
|
||||
string description;
|
||||
string iconFilename;
|
||||
int iconIndex;
|
||||
int commandId; // Windows command id
|
||||
|
||||
SUIInfo()
|
||||
: iconIndex(0)
|
||||
, commandId(0) {}
|
||||
};
|
||||
|
||||
inline QString Execute([[maybe_unused]] const CArgs& args)
|
||||
{
|
||||
assert(args.GetArgCount() == 0);
|
||||
|
||||
m_functor();
|
||||
return "";
|
||||
}
|
||||
const SUIInfo& GetUIInfo() const { return m_uiInfo; }
|
||||
virtual bool CanBeUICommand() const { return true; }
|
||||
|
||||
protected:
|
||||
friend class CEditorCommandManager;
|
||||
AZStd::function<void()> m_functor;
|
||||
SUIInfo m_uiInfo;
|
||||
};
|
||||
|
||||
template <typename RT>
|
||||
class CCommand0wRet
|
||||
: public CCommand
|
||||
{
|
||||
public:
|
||||
CCommand0wRet(const string& module, const string& name,
|
||||
const string& description, const string& example,
|
||||
const AZStd::function<RT()>& functor);
|
||||
|
||||
QString Execute(const CArgs& args);
|
||||
|
||||
protected:
|
||||
friend class CEditorCommandManager;
|
||||
AZStd::function<RT()> m_functor;
|
||||
};
|
||||
|
||||
template <LIST(1, typename P)>
|
||||
class CCommand1
|
||||
: public CCommand
|
||||
{
|
||||
public:
|
||||
CCommand1(const string& module, const string& name,
|
||||
const string& description, const string& example,
|
||||
const AZStd::function<void(LIST(1, P))>& functor);
|
||||
|
||||
QString Execute(const CArgs& args);
|
||||
|
||||
protected:
|
||||
friend class CEditorCommandManager;
|
||||
AZStd::function<void(LIST(1, P))> m_functor;
|
||||
};
|
||||
|
||||
template <LIST(1, typename P), typename RT>
|
||||
class CCommand1wRet
|
||||
: public CCommand
|
||||
{
|
||||
public:
|
||||
CCommand1wRet(const string& module, const string& name,
|
||||
const string& description, const string& example,
|
||||
const AZStd::function<RT(LIST(1, P))>& functor);
|
||||
|
||||
QString Execute(const CArgs& args);
|
||||
|
||||
protected:
|
||||
friend class CEditorCommandManager;
|
||||
AZStd::function<RT(LIST(1, P))> m_functor;
|
||||
};
|
||||
|
||||
template <LIST(2, typename P)>
|
||||
class CCommand2
|
||||
: public CCommand
|
||||
{
|
||||
public:
|
||||
CCommand2(const string& module, const string& name,
|
||||
const string& description, const string& example,
|
||||
const AZStd::function<void(LIST(2, P))>& functor);
|
||||
|
||||
QString Execute(const CArgs& args);
|
||||
|
||||
protected:
|
||||
friend class CEditorCommandManager;
|
||||
AZStd::function<void(LIST(2, P))> m_functor;
|
||||
};
|
||||
|
||||
template <LIST(2, typename P), typename RT>
|
||||
class CCommand2wRet
|
||||
: public CCommand
|
||||
{
|
||||
public:
|
||||
CCommand2wRet(const string& module, const string& name,
|
||||
const string& description, const string& example,
|
||||
const AZStd::function<RT(LIST(2, P))>& functor);
|
||||
|
||||
QString Execute(const CArgs& args);
|
||||
|
||||
protected:
|
||||
friend class CEditorCommandManager;
|
||||
AZStd::function<RT(LIST(2, P))> m_functor;
|
||||
};
|
||||
|
||||
template <LIST(3, typename P)>
|
||||
class CCommand3
|
||||
: public CCommand
|
||||
{
|
||||
public:
|
||||
CCommand3(const string& module, const string& name,
|
||||
const string& description, const string& example,
|
||||
const AZStd::function<void(LIST(3, P))>& functor);
|
||||
|
||||
QString Execute(const CArgs& args);
|
||||
|
||||
protected:
|
||||
friend class CEditorCommandManager;
|
||||
AZStd::function<void(LIST(3, P))> m_functor;
|
||||
};
|
||||
|
||||
template <LIST(3, typename P), typename RT>
|
||||
class CCommand3wRet
|
||||
: public CCommand
|
||||
{
|
||||
public:
|
||||
CCommand3wRet(const string& module, const string& name,
|
||||
const string& description, const string& example,
|
||||
const AZStd::function<RT(LIST(3, P))>& functor);
|
||||
|
||||
QString Execute(const CArgs& args);
|
||||
|
||||
protected:
|
||||
friend class CEditorCommandManager;
|
||||
AZStd::function<RT(LIST(3, P))> m_functor;
|
||||
};
|
||||
|
||||
template <LIST(4, typename P)>
|
||||
class CCommand4
|
||||
: public CCommand
|
||||
{
|
||||
public:
|
||||
CCommand4(const string& module, const string& name,
|
||||
const string& description, const string& example,
|
||||
const AZStd::function<void(LIST(4, P))>& functor);
|
||||
|
||||
QString Execute(const CArgs& args);
|
||||
|
||||
protected:
|
||||
friend class CEditorCommandManager;
|
||||
AZStd::function<void(LIST(4, P))> m_functor;
|
||||
};
|
||||
|
||||
template <LIST(4, typename P), typename RT>
|
||||
class CCommand4wRet
|
||||
: public CCommand
|
||||
{
|
||||
public:
|
||||
CCommand4wRet(const string& module, const string& name,
|
||||
const string& description, const string& example,
|
||||
const AZStd::function<RT(LIST(4, P))>& functor);
|
||||
|
||||
QString Execute(const CArgs& args);
|
||||
|
||||
protected:
|
||||
friend class CEditorCommandManager;
|
||||
AZStd::function<RT(LIST(4, P))> m_functor;
|
||||
};
|
||||
|
||||
template <LIST(5, typename P)>
|
||||
class CCommand5
|
||||
: public CCommand
|
||||
{
|
||||
public:
|
||||
CCommand5(const string& module, const string& name,
|
||||
const string& description, const string& example,
|
||||
const AZStd::function<void(LIST(5, P))>& functor);
|
||||
|
||||
QString Execute(const CArgs& args);
|
||||
|
||||
protected:
|
||||
friend class CEditorCommandManager;
|
||||
AZStd::function<void(LIST(5, P))> m_functor;
|
||||
};
|
||||
|
||||
template <LIST(6, typename P)>
|
||||
class CCommand6
|
||||
: public CCommand
|
||||
{
|
||||
public:
|
||||
CCommand6(const string& module, const string& name,
|
||||
const string& description, const string& example,
|
||||
const AZStd::function<void(LIST(6, P))>& functor);
|
||||
|
||||
QString Execute(const CArgs& args);
|
||||
|
||||
protected:
|
||||
friend class CEditorCommandManager;
|
||||
AZStd::function<void(LIST(6, P))> m_functor;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template <typename RT>
|
||||
CCommand0wRet<RT>::CCommand0wRet(const string& module, const string& name,
|
||||
const string& description, const string& example,
|
||||
const AZStd::function<RT()>& functor)
|
||||
: CCommand(module, name, description, example)
|
||||
, m_functor(functor)
|
||||
{
|
||||
}
|
||||
|
||||
template <typename RT>
|
||||
QString CCommand0wRet<RT>::Execute(const CCommand::CArgs& args)
|
||||
{
|
||||
assert(args.GetArgCount() == 0);
|
||||
|
||||
RT ret = m_functor();
|
||||
return ToString_(ret).c_str();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template <LIST(1, typename P)>
|
||||
CCommand1<LIST(1, P)>::CCommand1(const string& module, const string& name,
|
||||
const string& description, const string& example,
|
||||
const AZStd::function<void(LIST(1, P))>& functor)
|
||||
: CCommand(module, name, description, example)
|
||||
, m_functor(functor)
|
||||
{
|
||||
}
|
||||
|
||||
template <LIST(1, typename P)>
|
||||
QString CCommand1<LIST(1, P)>::Execute(const CCommand::CArgs& args)
|
||||
{
|
||||
assert(args.GetArgCount() == 1);
|
||||
if (args.GetArgCount() < 1)
|
||||
{
|
||||
CryLogAlways("Cannot execute the command %s.%s! One argument required.", m_module.c_str(), m_name.c_str());
|
||||
PrintHelp();
|
||||
return "";
|
||||
}
|
||||
|
||||
P1 p1;
|
||||
bool ok = FromString_(p1, args.GetArg(0).c_str());
|
||||
if (ok)
|
||||
{
|
||||
m_functor(p1);
|
||||
}
|
||||
else
|
||||
{
|
||||
CryLogAlways("Cannot execute the command %s.%s(%s)! Invalid argument type.",
|
||||
m_module, m_name, args.GetArg(0).c_str());
|
||||
PrintHelp();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template <LIST(1, typename P), typename RT>
|
||||
CCommand1wRet<LIST(1, P), RT>::CCommand1wRet(const string& module, const string& name,
|
||||
const string& description, const string& example,
|
||||
const AZStd::function<RT(LIST(1, P))>& functor)
|
||||
: CCommand(module, name, description, example)
|
||||
, m_functor(functor)
|
||||
{
|
||||
}
|
||||
|
||||
template <LIST(1, typename P), typename RT>
|
||||
QString CCommand1wRet<LIST(1, P), RT>::Execute(const CCommand::CArgs& args)
|
||||
{
|
||||
assert(args.GetArgCount() == 1);
|
||||
if (args.GetArgCount() < 1)
|
||||
{
|
||||
CryLogAlways("Cannot execute the command %s.%s! One argument required.", m_module.c_str(), m_name.c_str());
|
||||
PrintHelp();
|
||||
return "";
|
||||
}
|
||||
|
||||
P1 p1;
|
||||
bool ok = FromString_(p1, args.GetArg(0).c_str());
|
||||
if (ok)
|
||||
{
|
||||
RT ret = m_functor(p1);
|
||||
return ToString_(ret).c_str();
|
||||
}
|
||||
else
|
||||
{
|
||||
CryLogAlways("Cannot execute the command %s.%s(%s)! Invalid argument type.",
|
||||
m_module, m_name, args.GetArg(0).c_str());
|
||||
PrintHelp();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template <LIST(2, typename P)>
|
||||
CCommand2<LIST(2, P)>::CCommand2(const string& module, const string& name,
|
||||
const string& description, const string& example,
|
||||
const AZStd::function<void(LIST(2, P))>& functor)
|
||||
: CCommand(module, name, description, example)
|
||||
, m_functor(functor)
|
||||
{
|
||||
}
|
||||
|
||||
template <LIST(2, typename P)>
|
||||
QString CCommand2<LIST(2, P)>::Execute(const CCommand::CArgs& args)
|
||||
{
|
||||
assert(args.GetArgCount() == 2);
|
||||
if (args.GetArgCount() < 2)
|
||||
{
|
||||
CryLogAlways("Cannot execute the command %s.%s! Two arguments required.", m_module.c_str(), m_name.c_str());
|
||||
PrintHelp();
|
||||
return "";
|
||||
}
|
||||
|
||||
P1 p1;
|
||||
P2 p2;
|
||||
bool ok = FromString_(p1, args.GetArg(0).c_str())
|
||||
&& FromString_(p2, args.GetArg(1).c_str());
|
||||
if (ok)
|
||||
{
|
||||
m_functor(p1, p2);
|
||||
}
|
||||
else
|
||||
{
|
||||
CryLogAlways("Cannot execute the command %s.%s(%s,%s)! Invalid argument type(s).",
|
||||
m_module, m_name, args.GetArg(0).c_str(), args.GetArg(1).c_str());
|
||||
PrintHelp();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template <LIST(2, typename P), typename RT>
|
||||
CCommand2wRet<LIST(2, P), RT>::CCommand2wRet(const string& module, const string& name,
|
||||
const string& description, const string& example,
|
||||
const AZStd::function<RT(LIST(2, P))>& functor)
|
||||
: CCommand(module, name, description, example)
|
||||
, m_functor(functor)
|
||||
{
|
||||
}
|
||||
|
||||
template <LIST(2, typename P), typename RT>
|
||||
QString CCommand2wRet<LIST(2, P), RT>::Execute(const CCommand::CArgs& args)
|
||||
{
|
||||
assert(args.GetArgCount() == 2);
|
||||
if (args.GetArgCount() < 2)
|
||||
{
|
||||
CryLogAlways("Cannot execute the command %s.%s! Two arguments required.", m_module.c_str(), m_name.c_str());
|
||||
PrintHelp();
|
||||
return "";
|
||||
}
|
||||
|
||||
P1 p1;
|
||||
P2 p2;
|
||||
bool ok = FromString_(p1, args.GetArg(0).c_str())
|
||||
&& FromString_(p2, args.GetArg(1).c_str());
|
||||
if (ok)
|
||||
{
|
||||
RT ret = m_functor(p1, p2);
|
||||
return ToString_(ret).c_str();
|
||||
}
|
||||
else
|
||||
{
|
||||
CryLogAlways("Cannot execute the command %s.%s(%s,%s)! Invalid argument type(s).",
|
||||
m_module, m_name, args.GetArg(0).c_str(), args.GetArg(1).c_str());
|
||||
PrintHelp();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template <LIST(3, typename P)>
|
||||
CCommand3<LIST(3, P)>::CCommand3(const string& module, const string& name,
|
||||
const string& description, const string& example,
|
||||
const AZStd::function<void(LIST(3, P))>& functor)
|
||||
: CCommand(module, name, description, example)
|
||||
, m_functor(functor)
|
||||
{
|
||||
}
|
||||
|
||||
template <LIST(3, typename P)>
|
||||
QString CCommand3<LIST(3, P)>::Execute(const CCommand::CArgs& args)
|
||||
{
|
||||
assert(args.GetArgCount() == 3);
|
||||
if (args.GetArgCount() < 3)
|
||||
{
|
||||
CryLogAlways("Cannot execute the command %s.%s! Three arguments required.", m_module.c_str(), m_name.c_str());
|
||||
PrintHelp();
|
||||
return "";
|
||||
}
|
||||
|
||||
P1 p1;
|
||||
P2 p2;
|
||||
P3 p3;
|
||||
bool ok = FromString_(p1, args.GetArg(0).c_str())
|
||||
&& FromString_(p2, args.GetArg(1).c_str())
|
||||
&& FromString_(p3, args.GetArg(2).c_str());
|
||||
if (ok)
|
||||
{
|
||||
m_functor(p1, p2, p3);
|
||||
}
|
||||
else
|
||||
{
|
||||
CryLogAlways("Cannot execute the command %s.%s(%s,%s,%s)! Invalid argument type(s).",
|
||||
m_module, m_name, args.GetArg(0).c_str(), args.GetArg(1).c_str(), args.GetArg(2).c_str());
|
||||
PrintHelp();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template <LIST(3, typename P), typename RT>
|
||||
CCommand3wRet<LIST(3, P), RT>::CCommand3wRet(const string& module, const string& name,
|
||||
const string& description, const string& example,
|
||||
const AZStd::function<RT(LIST(3, P))>& functor)
|
||||
: CCommand(module, name, description, example)
|
||||
, m_functor(functor)
|
||||
{
|
||||
}
|
||||
|
||||
template <LIST(3, typename P), typename RT>
|
||||
QString CCommand3wRet<LIST(3, P), RT>::Execute(const CCommand::CArgs& args)
|
||||
{
|
||||
assert(args.GetArgCount() == 3);
|
||||
if (args.GetArgCount() < 3)
|
||||
{
|
||||
CryLogAlways("Cannot execute the command %s.%s! Three arguments required.", m_module.c_str(), m_name.c_str());
|
||||
PrintHelp();
|
||||
return "";
|
||||
}
|
||||
|
||||
P1 p1;
|
||||
P2 p2;
|
||||
P3 p3;
|
||||
bool ok = FromString_(p1, args.GetArg(0).c_str())
|
||||
&& FromString_(p2, args.GetArg(1).c_str())
|
||||
&& FromString_(p3, args.GetArg(2).c_str());
|
||||
if (ok)
|
||||
{
|
||||
RT ret = m_functor(p1, p2, p3);
|
||||
return ToString_(ret).c_str();
|
||||
}
|
||||
else
|
||||
{
|
||||
CryLogAlways("Cannot execute the command %s.%s(%s,%s,%s)! Invalid argument type(s).",
|
||||
m_module, m_name, args.GetArg(0).c_str(), args.GetArg(1).c_str(), args.GetArg(2).c_str());
|
||||
PrintHelp();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template <LIST(4, typename P)>
|
||||
CCommand4<LIST(4, P)>::CCommand4(const string& module, const string& name,
|
||||
const string& description, const string& example,
|
||||
const AZStd::function<void(LIST(4, P))>& functor)
|
||||
: CCommand(module, name, description, example)
|
||||
, m_functor(functor)
|
||||
{
|
||||
}
|
||||
|
||||
template <LIST(4, typename P)>
|
||||
QString CCommand4<LIST(4, P)>::Execute(const CCommand::CArgs& args)
|
||||
{
|
||||
assert(args.GetArgCount() == 4);
|
||||
if (args.GetArgCount() < 4)
|
||||
{
|
||||
CryLogAlways("Cannot execute the command %s.%s! Four arguments required.", m_module.c_str(), m_name.c_str());
|
||||
PrintHelp();
|
||||
return "";
|
||||
}
|
||||
|
||||
P1 p1;
|
||||
P2 p2;
|
||||
P3 p3;
|
||||
P4 p4;
|
||||
bool ok = FromString_(p1, args.GetArg(0).c_str())
|
||||
&& FromString_(p2, args.GetArg(1).c_str())
|
||||
&& FromString_(p3, args.GetArg(2).c_str())
|
||||
&& FromString_(p4, args.GetArg(3).c_str());
|
||||
if (ok)
|
||||
{
|
||||
m_functor(p1, p2, p3, p4);
|
||||
}
|
||||
else
|
||||
{
|
||||
CryLogAlways("Cannot execute the command %s.%s(%s,%s,%s,%s)! Invalid argument type(s).",
|
||||
m_module, m_name, args.GetArg(0).c_str(), args.GetArg(1).c_str(), args.GetArg(2).c_str(),
|
||||
args.GetArg(3).c_str());
|
||||
PrintHelp();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template <LIST(4, typename P), typename RT>
|
||||
CCommand4wRet<LIST(4, P), RT>::CCommand4wRet(const string& module, const string& name,
|
||||
const string& description, const string& example,
|
||||
const AZStd::function<RT(LIST(4, P))>& functor)
|
||||
: CCommand(module, name, description, example)
|
||||
, m_functor(functor)
|
||||
{
|
||||
}
|
||||
|
||||
template <LIST(4, typename P), typename RT>
|
||||
QString CCommand4wRet<LIST(4, P), RT>::Execute(const CCommand::CArgs& args)
|
||||
{
|
||||
assert(args.GetArgCount() == 4);
|
||||
if (args.GetArgCount() < 4)
|
||||
{
|
||||
CryLogAlways("Cannot execute the command %s.%s! Four arguments required.", m_module.c_str(), m_name.c_str());
|
||||
PrintHelp();
|
||||
return "";
|
||||
}
|
||||
|
||||
P1 p1;
|
||||
P2 p2;
|
||||
P3 p3;
|
||||
P4 p4;
|
||||
bool ok = FromString_(p1, args.GetArg(0).c_str())
|
||||
&& FromString_(p2, args.GetArg(1).c_str())
|
||||
&& FromString_(p3, args.GetArg(2).c_str())
|
||||
&& FromString_(p4, args.GetArg(3).c_str());
|
||||
if (ok)
|
||||
{
|
||||
RT ret = m_functor(p1, p2, p3, p4);
|
||||
return ToString_(ret).c_str();
|
||||
}
|
||||
else
|
||||
{
|
||||
CryLogAlways("Cannot execute the command %s.%s(%s,%s,%s,%s)! Invalid argument type(s).",
|
||||
m_module, m_name, args.GetArg(0).c_str(), args.GetArg(1).c_str(), args.GetArg(2).c_str(),
|
||||
args.GetArg(3).c_str());
|
||||
PrintHelp();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template <LIST(5, typename P)>
|
||||
CCommand5<LIST(5, P)>::CCommand5(const string& module, const string& name,
|
||||
const string& description, const string& example,
|
||||
const AZStd::function<void(LIST(5, P))>& functor)
|
||||
: CCommand(module, name, description, example)
|
||||
, m_functor(functor)
|
||||
{
|
||||
}
|
||||
|
||||
template <LIST(5, typename P)>
|
||||
QString CCommand5<LIST(5, P)>::Execute(const CCommand::CArgs& args)
|
||||
{
|
||||
assert(args.GetArgCount() == 5);
|
||||
if (args.GetArgCount() < 5)
|
||||
{
|
||||
CryLogAlways("Cannot execute the command %s.%s! Five arguments required.", m_module.c_str(), m_name.c_str());
|
||||
PrintHelp();
|
||||
return "";
|
||||
}
|
||||
|
||||
P1 p1;
|
||||
P2 p2;
|
||||
P3 p3;
|
||||
P4 p4;
|
||||
P5 p5;
|
||||
bool ok = FromString_(p1, args.GetArg(0).c_str())
|
||||
&& FromString_(p2, args.GetArg(1).c_str())
|
||||
&& FromString_(p3, args.GetArg(2).c_str())
|
||||
&& FromString_(p4, args.GetArg(3).c_str())
|
||||
&& FromString_(p5, args.GetArg(4).c_str());
|
||||
if (ok)
|
||||
{
|
||||
m_functor(p1, p2, p3, p4, p5);
|
||||
}
|
||||
else
|
||||
{
|
||||
CryLogAlways("Cannot execute the command %s.%s(%s,%s,%s,%s,%s)! Invalid argument type(s).",
|
||||
m_module, m_name, args.GetArg(0).c_str(), args.GetArg(1).c_str(), args.GetArg(2).c_str(),
|
||||
args.GetArg(3).c_str(), args.GetArg(4).c_str());
|
||||
PrintHelp();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template <LIST(6, typename P)>
|
||||
CCommand6<LIST(6, P)>::CCommand6(const string& module, const string& name,
|
||||
const string& description, const string& example,
|
||||
const AZStd::function<void(LIST(6, P))>& functor)
|
||||
: CCommand(module, name, description, example)
|
||||
, m_functor(functor)
|
||||
{
|
||||
}
|
||||
|
||||
template <LIST(6, typename P)>
|
||||
QString CCommand6<LIST(6, P)>::Execute(const CCommand::CArgs& args)
|
||||
{
|
||||
assert(args.GetArgCount() == 6);
|
||||
if (args.GetArgCount() < 6)
|
||||
{
|
||||
CryLogAlways("Cannot execute the command %s.%s! Six arguments required.", m_module.c_str(), m_name.c_str());
|
||||
PrintHelp();
|
||||
return "";
|
||||
}
|
||||
|
||||
P1 p1 = 0;
|
||||
P2 p2 = 0;
|
||||
P3 p3 = 0;
|
||||
P4 p4 = 0;
|
||||
P5 p5 = 0;
|
||||
P6 p6 = 0;
|
||||
bool ok = FromString_(p1, args.GetArg(0).c_str())
|
||||
&& FromString_(p2, args.GetArg(1).c_str())
|
||||
&& FromString_(p3, args.GetArg(2).c_str())
|
||||
&& FromString_(p4, args.GetArg(3).c_str())
|
||||
&& FromString_(p5, args.GetArg(4).c_str())
|
||||
&& FromString_(p6, args.GetArg(5).c_str());
|
||||
if (ok)
|
||||
{
|
||||
m_functor(p1, p2, p3, p4, p5, p6);
|
||||
}
|
||||
else
|
||||
{
|
||||
CryLogAlways("Cannot execute the command %s.%s(%s,%s,%s,%s,%s,%s)! Invalid argument type(s).",
|
||||
m_module.c_str(), m_name.c_str(), args.GetArg(0).c_str(), args.GetArg(1).c_str(), args.GetArg(2).c_str(),
|
||||
args.GetArg(3).c_str(), args.GetArg(4).c_str(), args.GetArg(5).c_str());
|
||||
PrintHelp();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
#endif // CRYINCLUDE_EDITOR_INCLUDE_COMMAND_H
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
#include "EditorDefs.h"
|
||||
|
||||
#include "EditorCoreAPI.h"
|
||||
|
||||
#include <AzCore/Module/Environment.h>
|
||||
|
||||
|
||||
static IEditor* s_pEditor = nullptr;
|
||||
|
||||
void SetIEditor(IEditor* pEditor)
|
||||
{
|
||||
//this function is called multiple times so only check once if the static editor pointer is null
|
||||
if (s_pEditor == nullptr)
|
||||
{
|
||||
assert(pEditor);
|
||||
s_pEditor = pEditor;
|
||||
}
|
||||
else if (pEditor == nullptr)
|
||||
{
|
||||
//clearing the static editor pointer
|
||||
s_pEditor = nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
assert(pEditor == s_pEditor); //trigger a warning that multiple instances of the editor are attempting to register
|
||||
}
|
||||
}
|
||||
|
||||
IEditor* GetIEditor()
|
||||
{
|
||||
return s_pEditor;
|
||||
}
|
||||
|
||||
void SetEditorCoreEnvironment(SSystemGlobalEnvironment* pEnv)
|
||||
{
|
||||
assert(!gEnv);
|
||||
gEnv = pEnv;
|
||||
}
|
||||
|
||||
void AttachEditorCoreAZEnvironment(AZ::EnvironmentInstance pAzEnv)
|
||||
{
|
||||
AZ::Environment::Attach(pAzEnv);
|
||||
}
|
||||
|
||||
void DetachEditorCoreAZEnvironment()
|
||||
{
|
||||
AZ::Environment::Detach();
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
#ifndef CRYINCLUDE_EDITOR_CORE_INCLUDE_API_H
|
||||
#define CRYINCLUDE_EDITOR_CORE_INCLUDE_API_H
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/PlatformDef.h>
|
||||
|
||||
#if defined(AZ_PLATFORM_WINDOWS)
|
||||
#if defined(EDITOR_CORE)
|
||||
#define EDITOR_CORE_API AZ_DLL_EXPORT
|
||||
#else
|
||||
#define EDITOR_CORE_API AZ_DLL_IMPORT
|
||||
#endif
|
||||
#elif defined(AZ_PLATFORM_MAC) || defined(AZ_PLATFORM_LINUX)
|
||||
#if defined(EDITOR_CORE)
|
||||
#define EDITOR_CORE_API __attribute__ ((visibility ("default")))
|
||||
#else
|
||||
#define EDITOR_CORE_API
|
||||
#endif
|
||||
#endif
|
||||
|
||||
struct IEditor;
|
||||
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
namespace Internal
|
||||
{
|
||||
class EnvironmentInterface;
|
||||
}
|
||||
typedef Internal::EnvironmentInterface* EnvironmentInstance;
|
||||
}
|
||||
|
||||
EDITOR_CORE_API void SetIEditor(IEditor* pEditor);
|
||||
EDITOR_CORE_API IEditor* GetIEditor();
|
||||
|
||||
//! Attach the editorcore dll to the system environmen in the System DLL
|
||||
EDITOR_CORE_API void SetEditorCoreEnvironment(struct SSystemGlobalEnvironment* pEnv);
|
||||
|
||||
//! Attach the editorcore dll to the AZ Environment which allows ebus and memory allocation - should be done really early
|
||||
EDITOR_CORE_API void AttachEditorCoreAZEnvironment(AZ::EnvironmentInstance pAzEnv);
|
||||
|
||||
//! Detach the editorcore dll from the AZ Environment, should be done last.
|
||||
EDITOR_CORE_API void DetachEditorCoreAZEnvironment();
|
||||
|
||||
#if defined(AZ_PLATFORM_WINDOWS)
|
||||
#include "../IEditor.h"
|
||||
#endif
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_CORE_INCLUDE_API_H
|
||||
@@ -0,0 +1,143 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
// Description : Hit testing for editor viewport operations
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_INCLUDE_HITCONTEXT_H
|
||||
#define CRYINCLUDE_EDITOR_INCLUDE_HITCONTEXT_H
|
||||
#pragma once
|
||||
|
||||
class CGizmo;
|
||||
class CBaseObject;
|
||||
struct IDisplayViewport;
|
||||
class CDeepSelection;
|
||||
struct AABB;
|
||||
class CCamera;
|
||||
|
||||
#include <QRect>
|
||||
#include <platform.h>
|
||||
|
||||
//! Flags used in HitContext for nSubObjFlags member.
|
||||
enum ESubObjHitFlags
|
||||
{
|
||||
//! When set all hit elements will be selected.
|
||||
SO_HIT_SELECT = BIT(1),
|
||||
//! Only test selected elements for hit.
|
||||
SO_HIT_TEST_SELECTED = BIT(2),
|
||||
//! Only hit test point2d, not rectangle
|
||||
//! Will only test/select 1 closest element
|
||||
SO_HIT_POINT = BIT(3),
|
||||
//! Adds hit elements to previously selected ones.
|
||||
SO_HIT_SELECT_ADD = BIT(4),
|
||||
//! Remove hit elements from previously selected ones.
|
||||
SO_HIT_SELECT_REMOVE = BIT(5),
|
||||
//! Output flag, set if selection was changed.
|
||||
SO_HIT_SELECTION_CHANGED = BIT(6),
|
||||
//! Hit testing to highlight sub object-element.
|
||||
SO_HIT_HIGHLIGHT_ONLY = BIT(7),
|
||||
//! This hit test is not for editing sub-objects.
|
||||
//! (ex. for moving an object by its face-normal)
|
||||
SO_HIT_NO_EDIT = BIT(8),
|
||||
// Check hit with vertices.
|
||||
SO_HIT_ELEM_VERTEX = BIT(10),
|
||||
// Check hit with edges.
|
||||
SO_HIT_ELEM_EDGE = BIT(11),
|
||||
// Check hit with faces.
|
||||
SO_HIT_ELEM_FACE = BIT(12),
|
||||
// Check hit with polygons.
|
||||
SO_HIT_ELEM_POLYGON = BIT(13)
|
||||
};
|
||||
|
||||
#define SO_HIT_ELEM_ALL (SO_HIT_ELEM_VERTEX | SO_HIT_ELEM_EDGE | SO_HIT_ELEM_FACE | SO_HIT_ELEM_POLYGON)
|
||||
|
||||
//! Collision structure passed to HitTest function.
|
||||
struct HitContext
|
||||
{
|
||||
//! Viewport that originates hit testing.
|
||||
IDisplayViewport* view;
|
||||
//! 2D point on view that is used for hit testing.
|
||||
QPoint point2d;
|
||||
//! 2D Selection rectangle (Only when HitTestRect)
|
||||
QRect rect;
|
||||
//! Optional limiting bounding box for hit testing.
|
||||
AABB* bounds;
|
||||
//! Optional camera for culling perspective viewports.
|
||||
CCamera* camera;
|
||||
|
||||
//! Testing performed in 2D viewport.
|
||||
bool b2DViewport;
|
||||
//! True if axis collision must be ignored.
|
||||
bool bIgnoreAxis;
|
||||
//! Hit test only gizmo objects
|
||||
bool bOnlyGizmo;
|
||||
//! Test objects using advanced selection helpers.
|
||||
bool bUseSelectionHelpers;
|
||||
//! an object excluded in hittest.
|
||||
CBaseObject* pExcludedObject;
|
||||
|
||||
// Input parameters.
|
||||
|
||||
//! Ray origin.
|
||||
Vec3 raySrc;
|
||||
//! Ray direction.
|
||||
Vec3 rayDir;
|
||||
//! Relaxation parameter for hit testing.
|
||||
float distanceTolerance;
|
||||
//! Sub object hit testing flags, @see ESubObjHitFlags
|
||||
int nSubObjFlags;
|
||||
|
||||
// Output parameters.
|
||||
|
||||
//! true if this hit should have less priority then non weak hits.
|
||||
//! (exp: Ray hit entity bounding box but not entity geometry.)
|
||||
bool weakHit;
|
||||
//! constrain axis if hit AxisGizmo.
|
||||
int axis;
|
||||
//! if hit axis gizmo, 1 - move mode, 2 - rotate mode, 3 - scale mode, 4 - rotate circle mode
|
||||
int manipulatorMode;
|
||||
//! distance to the object from src.
|
||||
float dist;
|
||||
//! object that have been hit.
|
||||
CBaseObject* object;
|
||||
//! gizmo object that have been hit.
|
||||
CGizmo* gizmo;
|
||||
//! for deep selection mode
|
||||
CDeepSelection* pDeepSelection;
|
||||
//! For linking tool
|
||||
const char* name;
|
||||
//! true if this hit was from the object icon
|
||||
bool iconHit;
|
||||
|
||||
HitContext()
|
||||
{
|
||||
rect = QRect();
|
||||
b2DViewport = false;
|
||||
view = 0;
|
||||
camera = 0;
|
||||
point2d = QPoint();
|
||||
axis = 0;
|
||||
distanceTolerance = 0;
|
||||
raySrc(0, 0, 0);
|
||||
rayDir(0, 0, 0);
|
||||
dist = 0;
|
||||
object = 0;
|
||||
weakHit = false;
|
||||
manipulatorMode = 0;
|
||||
nSubObjFlags = 0;
|
||||
bounds = 0;
|
||||
bIgnoreAxis = false;
|
||||
bOnlyGizmo = false;
|
||||
bUseSelectionHelpers = false;
|
||||
pDeepSelection = 0;
|
||||
name = nullptr;
|
||||
iconHit = false;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_INCLUDE_HITCONTEXT_H
|
||||
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_INCLUDE_IANIMATIONCOMPRESSIONMANAGER_H
|
||||
#define CRYINCLUDE_EDITOR_INCLUDE_IANIMATIONCOMPRESSIONMANAGER_H
|
||||
#pragma once
|
||||
|
||||
struct IAnimationCompressionManager
|
||||
{
|
||||
virtual bool IsEnabled() const = 0;
|
||||
virtual void UpdateLocalAnimations() = 0;
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_INCLUDE_IANIMATIONCOMPRESSIONMANAGER_H
|
||||
@@ -0,0 +1,432 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
// Description : Standard interface for asset display in the asset browser,
|
||||
// this header should be used to create plugins.
|
||||
// The method Release of this interface should NOT be called.
|
||||
// Instead, the FreeData from the database (from IAssetItemDatabase) should
|
||||
// be used as it will safely release all the items from the database.
|
||||
// It is still possible to call the release method, but this is not the
|
||||
// recomended method, specially for usage outside of the plugins because there
|
||||
// is no guarantee that a the asset will be properly removed from the database
|
||||
// manager.
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_INCLUDE_IASSETITEM_H
|
||||
#define CRYINCLUDE_EDITOR_INCLUDE_IASSETITEM_H
|
||||
#pragma once
|
||||
|
||||
struct IAssetItemDatabase;
|
||||
|
||||
namespace AssetViewer
|
||||
{
|
||||
// Used in GetAssetFieldValue for each asset type to check if field name is the right one
|
||||
inline bool IsFieldName(const char* pIncomingFieldName, const char* pFieldName)
|
||||
{
|
||||
return !strncmp(pIncomingFieldName, pFieldName, strlen(pIncomingFieldName));
|
||||
}
|
||||
}
|
||||
|
||||
// Description:
|
||||
// This interface allows the programmer to extend asset display types visible in the asset browser.
|
||||
struct IAssetItem
|
||||
: public IUnknown
|
||||
{
|
||||
DEFINE_UUID(0x04F20346, 0x2EC3, 0x43f2, 0xBD, 0xA1, 0x2C, 0x0B, 0x97, 0x76, 0xF3, 0x84);
|
||||
|
||||
// The supported asset flags
|
||||
enum EAssetFlags
|
||||
{
|
||||
// asset is visible in the database for filtering and sorting (not asset view control related)
|
||||
eFlag_Visible = BIT(0),
|
||||
// the asset is loaded
|
||||
eFlag_Loaded = BIT(1),
|
||||
// the asset is loaded
|
||||
eFlag_Cached = BIT(2),
|
||||
// the asset is selected in a selection set
|
||||
eFlag_Selected = BIT(3),
|
||||
// this asset is invalid, no thumb is shown/available
|
||||
eFlag_Invalid = BIT(4),
|
||||
// this asset has some errors/warnings, in the asset browser it will show some blinking/red elements
|
||||
// and the user can check out the errors. Error text will be fetched using GetAssetFieldValue( "errors", &someStringVar )
|
||||
eFlag_HasErrors = BIT(5),
|
||||
// this flag is set when the asset is rendering its contents using GDI, and not the engine's rendering capabilities
|
||||
// (this flags is used as hint for the preview tool, which will use a double-buffer canvas if this flag is set,
|
||||
// and send a memory HDC to the OnBeginPreview method, for drawing of the asset)
|
||||
eFlag_UseGdiRendering = BIT(6),
|
||||
// set if this asset is draggable into the render viewports, and can be created there
|
||||
eFlag_CanBeDraggedInViewports = BIT(7),
|
||||
// set if this asset can be moved after creation, otherwise the asset instance will just be created where user clicked
|
||||
eFlag_CanBeMovedAfterDroppedIntoViewport = BIT(8),
|
||||
// the asset thumbnail image is loaded
|
||||
eFlag_ThumbnailLoaded = BIT(9),
|
||||
// the asset thumbnail image is loaded
|
||||
eFlag_UsedInLevel = BIT(10)
|
||||
};
|
||||
|
||||
// Asset field name and field values map
|
||||
typedef std::map < QString/*fieldName*/, QString/*value*/ > TAssetFieldValuesMap;
|
||||
// Dependency category names and corresponding files map, example: "Textures"=>{ "foam.dds","water.dds","normal.dds" }
|
||||
typedef std::map < QString/*dependencyCategory*/, std::set<QString>/*dependency filenames*/ > TAssetDependenciesMap;
|
||||
|
||||
virtual ~IAssetItem() {
|
||||
}
|
||||
|
||||
// Description:
|
||||
// Get the hash number/key used for database thumbnail and info records management
|
||||
virtual uint32 GetHash() const = 0;
|
||||
// Description:
|
||||
// Set the hash number/key used for database thumbnail and info records management
|
||||
virtual void SetHash(uint32 hash) = 0;
|
||||
// Description:
|
||||
// Get the owner database for this asset
|
||||
// Return Value:
|
||||
// The owner database for this asset
|
||||
// See Also:
|
||||
// SetOwnerDatabase()
|
||||
virtual IAssetItemDatabase* GetOwnerDatabase() const = 0;
|
||||
// Description:
|
||||
// Set the owner database for this asset
|
||||
// Arguments:
|
||||
// piOwnerDisplayDatabase - the owner database
|
||||
// See Also:
|
||||
// GetOwnerDatabase()
|
||||
virtual void SetOwnerDatabase(IAssetItemDatabase* pOwnerDisplayDatabase) = 0;
|
||||
// Description:
|
||||
// Get the asset's dependency files / objects
|
||||
// Return Value:
|
||||
// The vector with filenames which this asset is dependent upon, ex.: ["Textures"].(vector of textures)
|
||||
virtual const TAssetDependenciesMap& GetDependencies() const = 0;
|
||||
// Description:
|
||||
// Set the file size of this asset in bytes
|
||||
// Arguments:
|
||||
// aSize - size of the file in bytes
|
||||
// See Also:
|
||||
// GetFileSize()
|
||||
virtual void SetFileSize(quint64 aSize) = 0;
|
||||
// Description:
|
||||
// Get the file size of this asset in bytes
|
||||
// Return Value:
|
||||
// The file size of this asset in bytes
|
||||
// See Also:
|
||||
// SetFileSize()
|
||||
virtual quint64 GetFileSize() const = 0;
|
||||
// Description:
|
||||
// Set asset filename (extension included and no path)
|
||||
// Arguments:
|
||||
// pName - the asset filename (extension included and no path)
|
||||
// See Also:
|
||||
// GetFilename()
|
||||
virtual void SetFilename(const char* pName) = 0;
|
||||
// Description:
|
||||
// Get asset filename (extension included and no path)
|
||||
// Return Value:
|
||||
// The asset filename (extension included and no path)
|
||||
// See Also:
|
||||
// SetFilename()
|
||||
virtual QString GetFilename() const = 0;
|
||||
// Description:
|
||||
// Set the asset's relative path
|
||||
// Arguments:
|
||||
// pName - file's relative path
|
||||
// See Also:
|
||||
// GetRelativePath()
|
||||
virtual void SetRelativePath(const char* pName) = 0;
|
||||
// Description:
|
||||
// Get the asset's relative path
|
||||
// Return Value:
|
||||
// The asset's relative path
|
||||
// See Also:
|
||||
// SetRelativePath()
|
||||
virtual QString GetRelativePath() const = 0;
|
||||
// Description:
|
||||
// Set the file extension ( dot(s) must be included )
|
||||
// Arguments:
|
||||
// pExt - the file's extension
|
||||
// See Also:
|
||||
// GetFileExtension()
|
||||
virtual void SetFileExtension(const char* pExt) = 0;
|
||||
// Description:
|
||||
// Get the file extension ( dot(s) included )
|
||||
// Return Value:
|
||||
// The file extension ( dot(s) included )
|
||||
// See Also:
|
||||
// SetFileExtension()
|
||||
virtual QString GetFileExtension() const = 0;
|
||||
// Description:
|
||||
// Get the asset flags, with values from IAssetItem::EAssetFlags
|
||||
// Return Value:
|
||||
// The asset flags, with values from IAssetItem::EAssetFlags
|
||||
// See Also:
|
||||
// SetFlags(), SetFlag(), IsFlagSet()
|
||||
virtual UINT GetFlags() const = 0;
|
||||
// Description:
|
||||
// Set the asset flags
|
||||
// Arguments:
|
||||
// aFlags - flags, OR-ed values from IAssetItem::EAssetFlags
|
||||
// See Also:
|
||||
// GetFlags(), SetFlag(), IsFlagSet()
|
||||
virtual void SetFlags(UINT aFlags) = 0;
|
||||
// Description:
|
||||
// Set/clear a single flag bit for the asset
|
||||
// Arguments:
|
||||
// aFlag - the flag to set/clear, with values from IAssetItem::EAssetFlags
|
||||
// See Also:
|
||||
// GetFlags(), SetFlags(), IsFlagSet()
|
||||
virtual void SetFlag(EAssetFlags aFlag, bool bSet = true) = 0;
|
||||
// Description:
|
||||
// Check if a specified flag is set
|
||||
// Arguments:
|
||||
// aFlag - the flag to check, with values from IAssetItem::EAssetFlags
|
||||
// Return Value:
|
||||
// True if the flag is set
|
||||
// See Also:
|
||||
// GetFlags(), SetFlags(), SetFlag()
|
||||
virtual bool IsFlagSet(EAssetFlags aFlag) const = 0;
|
||||
// Description:
|
||||
// Set this asset's index; used in sorting, selections, and to know where an asset is in the current list
|
||||
// Arguments:
|
||||
// aIndex - the asset's index
|
||||
// See Also:
|
||||
// GetIndex()
|
||||
virtual void SetIndex(UINT aIndex) = 0;
|
||||
// Description:
|
||||
// Get the asset's index in the current list
|
||||
// Return Value:
|
||||
// The asset's index in the current list
|
||||
// See Also:
|
||||
// SetIndex()
|
||||
virtual UINT GetIndex() const = 0;
|
||||
// Description:
|
||||
// Get the asset's field raw data value into a user location, you must check the field's type ( from asset item's owner database )
|
||||
// before using this function and send the correct pointer to destination according to the type ( int8, float32, string, etc. )
|
||||
// Arguments:
|
||||
// pFieldName - the asset field name to query the value for
|
||||
// pDest - the destination variable address, must be the same type as the field type
|
||||
// Return Value:
|
||||
// True if the asset field name is found and the value is returned correctly
|
||||
// See Also:
|
||||
// SetAssetFieldValue()
|
||||
virtual QVariant GetAssetFieldValue(const char* pFieldName) const = 0;
|
||||
// Description:
|
||||
// Set the asset's field raw data value from a user location, you must check the field's type ( from asset item's owner database )
|
||||
// before using this function and send the correct pointer to source according to the type ( int8, float32, string, etc. )
|
||||
// Arguments:
|
||||
// pFieldName - the asset field name to set the value for
|
||||
// pSrc - the source variable address, must be the same type as the field type
|
||||
// Return Value:
|
||||
// True if the asset field name is found and the value is set correctly
|
||||
// See Also:
|
||||
// GetAssetFieldValue()
|
||||
virtual bool SetAssetFieldValue(const char* pFieldName, void* pSrc) = 0;
|
||||
// Description:
|
||||
// Get the drawing rectangle for the asset's thumb ( absolute viewer canvas location )
|
||||
// Arguments:
|
||||
// rstDrawingRectangle - destination location to set with the asset's thumbnail rectangle location
|
||||
// See Also:
|
||||
// SetDrawingRectangle()
|
||||
virtual void GetDrawingRectangle(QRect& rstDrawingRectangle) const = 0;
|
||||
// Description:
|
||||
// Set the drawing rectangle for the asset's thumb ( absolute viewer canvas location )
|
||||
// Arguments:
|
||||
// crstDrawingRectangle - source to set the asset's thumbnail rectangle
|
||||
// See Also:
|
||||
// GetDrawingRectangle()
|
||||
virtual void SetDrawingRectangle(const QRect& crstDrawingRectangle) = 0;
|
||||
// Description:
|
||||
// Checks if the given 2D point is inside the asset's thumb rectangle
|
||||
// Arguments:
|
||||
// nX - mouse pointer position on X axis, relative to the asset viewer control
|
||||
// nY - mouse pointer position on Y axis, relative to the asset viewer control
|
||||
// Return Value:
|
||||
// True if the given 2D point is inside the asset's thumb rectangle
|
||||
// See Also:
|
||||
// HitTest(CRect)
|
||||
virtual bool HitTest(int nX, int nY) const = 0;
|
||||
// Description:
|
||||
// Checks if the given rectangle intersects the asset thumb's rectangle
|
||||
// Arguments:
|
||||
// nX - mouse pointer position on X axis, relative to the asset viewer control
|
||||
// nY - mouse pointer position on Y axis, relative to the asset viewer control
|
||||
// Return Value:
|
||||
// True if the given rectangle intersects the asset thumb's rectangle
|
||||
// See Also:
|
||||
// HitTest(int nX,int nY)
|
||||
virtual bool HitTest(const QRect& roTestRect) const = 0;
|
||||
// Description:
|
||||
// When user drags this asset item into a viewport, this method is called when the dragging operation ends
|
||||
// and the mouse button is released, for the asset to return an instance of the asset object to be placed in the level
|
||||
// Arguments:
|
||||
// aX - instance's X position component in world coordinates
|
||||
// aY - instance's Y position component in world coordinates
|
||||
// aZ - instance's Z position component in world coordinates
|
||||
// Return Value:
|
||||
// The newly created asset instance (Example: BrushObject*)
|
||||
// See Also:
|
||||
// MoveInstanceInViewport()
|
||||
virtual void* CreateInstanceInViewport(float aX, float aY, float aZ) = 0;
|
||||
// Description:
|
||||
// When the mouse button is released after level object creation, the user now can move the mouse
|
||||
// and move the asset instance in the 3D world
|
||||
// Arguments:
|
||||
// pDraggedObject - the actual entity or brush object (CBaseObject* usually) to be moved around with the mouse
|
||||
// returned by the CreateInstanceInViewport()
|
||||
// aNewX - the new X world coordinates of the asset instance
|
||||
// aNewY - the new Y world coordinates of the asset instance
|
||||
// aNewZ - the new Z world coordinates of the asset instance
|
||||
// Return Value:
|
||||
// True if asset instance was moved properly
|
||||
// See Also:
|
||||
// CreateInstanceInViewport()
|
||||
virtual bool MoveInstanceInViewport(const void* pDraggedObject, float aNewX, float aNewY, float aNewZ) = 0;
|
||||
// Description:
|
||||
// This will be called when the user presses ESCAPE key when dragging the asset in the viewport, you must delete the given object
|
||||
// because the creation was aborted
|
||||
// Arguments:
|
||||
// pDraggedObject - the asset instance to be deleted ( you must cast to the needed type, and delete it properly )
|
||||
// See Also:
|
||||
// CreateInstanceInViewport()
|
||||
virtual void AbortCreateInstanceInViewport(const void* pDraggedObject) = 0;
|
||||
// Description:
|
||||
// This method is used to cache/load asset's data, so it can be previewed/rendered
|
||||
// Return Value:
|
||||
// True if the asset was successfully cached
|
||||
// See Also:
|
||||
// UnCache()
|
||||
virtual bool Cache() = 0;
|
||||
// Description:
|
||||
// This method is used to force cache/load asset's data, so it can be previewed/rendered
|
||||
// Return Value:
|
||||
// True if the asset was successfully forced cached
|
||||
// See Also:
|
||||
// UnCache(), Cache()
|
||||
virtual bool ForceCache() = 0;
|
||||
// Description:
|
||||
// This method is used to load the thumbnail image of the asset
|
||||
// Return Value:
|
||||
// True if thumb loaded ok
|
||||
// See Also:
|
||||
// UnloadThumbnail()
|
||||
virtual bool LoadThumbnail() = 0;
|
||||
// Description:
|
||||
// This method is used to unload the thumbnail image of the asset
|
||||
// See Also:
|
||||
// LoadThumbnail()
|
||||
virtual void UnloadThumbnail() = 0;
|
||||
// Description:
|
||||
// This is called when the asset starts to be previewed in full detail, so here you can load the whole asset, in fine detail
|
||||
// ( textures are fully loaded, models etc. ). It is called once, when the Preview dialog is shown
|
||||
// Arguments:
|
||||
// hPreviewWnd - the window handle of the quick preview dialog
|
||||
// hMemDC - the memory DC used to render assets that can render themselves in the DC, otherwise they will render in the dialog's HWND
|
||||
// See Also:
|
||||
// OnEndPreview(), GetCustomPreviewPanelHeader()
|
||||
virtual void OnBeginPreview(QWidget* hPreviewWnd) = 0;
|
||||
// Description:
|
||||
// Called when the Preview dialog is closed, you may release the detail asset data here
|
||||
// See Also:
|
||||
// OnBeginPreview(), GetCustomPreviewPanelHeader()
|
||||
virtual void OnEndPreview() = 0;
|
||||
// Description:
|
||||
// If the asset has a special preview panel with utility controls, to be placed at the top of the Preview window, it can return an child dialog window
|
||||
// otherwise it can return NULL, if no panel is available
|
||||
// Arguments:
|
||||
// pParentWnd - a valid CDialog*, or NULL
|
||||
// Return Value:
|
||||
// A valid child dialog window handle, if this asset wants to have a custom panel in the top side of the Asset Preview window,
|
||||
// otherwise it can return NULL, if no panel is available
|
||||
// See Also:
|
||||
// OnBeginPreview(), OnEndPreview()
|
||||
virtual QWidget* GetCustomPreviewPanelHeader(QWidget* pParentWnd) = 0;
|
||||
virtual QWidget* GetCustomPreviewPanelFooter(QWidget* pParentWnd) = 0;
|
||||
// Description:
|
||||
// Used when dragging/rotate/zoom a model, or other asset that can support preview
|
||||
// Arguments:
|
||||
// hRenderWindow - the rendering window handle
|
||||
// rstViewport - the viewport rectangle
|
||||
// aMouseX - the render window relative mouse pointer X coordinate
|
||||
// aMouseY - the render window relative mouse pointer Y coordinate
|
||||
// aMouseDeltaX - the X coordinate delta between two mouse movements
|
||||
// aMouseDeltaY - the Y coordinate delta between two mouse movements
|
||||
// aMouseWheelDelta - the mouse wheel scroll delta/step
|
||||
// aKeyFlags - the key flags, see WM_LBUTTONUP
|
||||
// See Also:
|
||||
// OnPreviewRenderKeyEvent()
|
||||
virtual void PreviewRender(
|
||||
QWidget* hRenderWindow,
|
||||
const QRect& rstViewport,
|
||||
int aMouseX = 0, int aMouseY = 0,
|
||||
int aMouseDeltaX = 0, int aMouseDeltaY = 0,
|
||||
int aMouseWheelDelta = 0, UINT aKeyFlags = 0) = 0;
|
||||
// Description:
|
||||
// This is called when the user manipulates the assets in interactive render and a key is pressed ( with down or up state )
|
||||
// Arguments:
|
||||
// bKeyDown - true if this is a WM_KEYDOWN event, else it is a WM_KEYUP event
|
||||
// aChar - the char/key code pressed/released
|
||||
// aKeyFlags - the key flags, compatible with WM_KEYDOWN/UP events
|
||||
// See Also:
|
||||
// InteractiveRender()
|
||||
virtual void OnPreviewRenderKeyEvent(bool bKeyDown, UINT aChar, UINT aKeyFlags) = 0;
|
||||
// Description:
|
||||
// Called when user clicked once on the thumb image
|
||||
// Arguments:
|
||||
// point - mouse coordinates relative to the thumbnail rectangle
|
||||
// aKeyFlags - the key flags, see WM_LBUTTONDOWN
|
||||
// See Also:
|
||||
// OnThumbDblClick()
|
||||
virtual void OnThumbClick(const QPoint& point, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers) = 0;
|
||||
// Description:
|
||||
// Called when user double clicked on the thumb image
|
||||
// Arguments:
|
||||
// point - mouse coordinates relative to the thumbnail rectangle
|
||||
// aKeyFlags - the key flags, see WM_LBUTTONDOWN
|
||||
// See Also:
|
||||
// OnThumbClick()
|
||||
//! called when user clicked twice on the thumb image
|
||||
virtual void OnThumbDblClick(const QPoint& point, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers) = 0;
|
||||
// Description:
|
||||
// Draw the cached thumb bitmap only, if any, no other kind of rendering
|
||||
// Arguments:
|
||||
// hDC - the destination DC, where to draw the thumb
|
||||
// rRect - the destination rectangle
|
||||
// Return Value:
|
||||
// True if drawing of the thumbnail was done OK
|
||||
// See Also:
|
||||
// Render()
|
||||
virtual bool DrawThumbImage(QPainter* painter, const QRect& rRect) = 0;
|
||||
// Description:
|
||||
// Writes asset info to a XML node.
|
||||
// This is needed to save cached info as a persistent XML file for the next run of the editor.
|
||||
// Arguments:
|
||||
// node - An XML node to contain the info
|
||||
// See Also:
|
||||
// FromXML()
|
||||
virtual void ToXML(XmlNodeRef& node) const = 0;
|
||||
// Description:
|
||||
// Gets asset info from a XML node.
|
||||
// This is needed to get the asset info from previous runs of the editor without re-caching it.
|
||||
// Arguments:
|
||||
// node - An XML node that contains info for this asset
|
||||
// See Also:
|
||||
// ToXML()
|
||||
virtual void FromXML(const XmlNodeRef& node) = 0;
|
||||
|
||||
// From IUnknown
|
||||
virtual HRESULT STDMETHODCALLTYPE QueryInterface([[maybe_unused]] const IID& riid, [[maybe_unused]] void** ppvObject)
|
||||
{
|
||||
return E_NOINTERFACE;
|
||||
};
|
||||
virtual ULONG STDMETHODCALLTYPE AddRef()
|
||||
{
|
||||
return 0;
|
||||
};
|
||||
virtual ULONG STDMETHODCALLTYPE Release()
|
||||
{
|
||||
return 0;
|
||||
};
|
||||
};
|
||||
#endif // CRYINCLUDE_EDITOR_INCLUDE_IASSETITEM_H
|
||||
@@ -0,0 +1,258 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
// Description : Standard interface for asset database creators used to
|
||||
// create an asset plugin for the asset browser
|
||||
// The category of the plugin must be Asset Item DB
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_INCLUDE_IASSETITEMDATABASE_H
|
||||
#define CRYINCLUDE_EDITOR_INCLUDE_IASSETITEMDATABASE_H
|
||||
#pragma once
|
||||
struct IAssetItem;
|
||||
struct IAssetViewer;
|
||||
|
||||
class QString;
|
||||
class QStringList;
|
||||
|
||||
// Description:
|
||||
// This struct keeps the info, filter and sorting settings for an asset field
|
||||
struct SAssetField
|
||||
{
|
||||
// the condition for the current filter on the field
|
||||
enum EAssetFilterCondition
|
||||
{
|
||||
eCondition_Any = 0,
|
||||
// string conditions
|
||||
// this also supports '*' and '?' as wildcards inside text
|
||||
eCondition_Contains,
|
||||
// this filter will search the target for at least one of the words specified
|
||||
// ( ex: filter: "water car moon" , field value : "the_great_moon.dds", this will pass the test
|
||||
// it also supports '*' and '?' as wildcards inside words text
|
||||
eCondition_ContainsOneOfTheWords,
|
||||
eCondition_StartsWith,
|
||||
eCondition_EndsWith,
|
||||
// string & numerical conditions
|
||||
eCondition_Equal,
|
||||
eCondition_Greater,
|
||||
eCondition_Less,
|
||||
eCondition_GreaterOrEqual,
|
||||
eCondition_LessOrEqual,
|
||||
eCondition_Not,
|
||||
eCondition_InsideRange
|
||||
};
|
||||
|
||||
// the asset field type
|
||||
enum EAssetFieldType
|
||||
{
|
||||
eType_None = 0,
|
||||
eType_Bool,
|
||||
eType_Int8,
|
||||
eType_Int16,
|
||||
eType_Int32,
|
||||
eType_Int64,
|
||||
eType_Float,
|
||||
eType_Double,
|
||||
eType_String
|
||||
};
|
||||
|
||||
// used when a field can have different specific values
|
||||
typedef QStringList TFieldEnumValues;
|
||||
|
||||
SAssetField(
|
||||
const char* pFieldName = "",
|
||||
const char* pDisplayName = "Unnamed field",
|
||||
EAssetFieldType aFieldType = eType_None,
|
||||
UINT aColumnWidth = 50,
|
||||
bool bVisibleInUI = true,
|
||||
bool bReadOnly = true)
|
||||
{
|
||||
m_fieldName = pFieldName;
|
||||
m_displayName = pDisplayName;
|
||||
m_fieldType = aFieldType;
|
||||
m_filterCondition = eCondition_Equal;
|
||||
m_bUseEnumValues = false;
|
||||
m_bReadOnly = bReadOnly;
|
||||
m_listColumnWidth = aColumnWidth;
|
||||
m_bFieldVisibleInUI = bVisibleInUI;
|
||||
m_bPostFilter = false;
|
||||
|
||||
SetupEnumValues();
|
||||
}
|
||||
|
||||
void SetupEnumValues()
|
||||
{
|
||||
m_bUseEnumValues = true;
|
||||
|
||||
if (m_fieldType == eType_Bool)
|
||||
{
|
||||
m_enumValues.clear();
|
||||
m_enumValues.push_back("Yes");
|
||||
m_enumValues.push_back("No");
|
||||
}
|
||||
}
|
||||
|
||||
// the field's display name, used in UI
|
||||
QString m_displayName,
|
||||
// the field internal name, used in C++ code
|
||||
m_fieldName,
|
||||
// the current filter value, if its empty "" then no filter is applied
|
||||
m_filterValue,
|
||||
// the field's max value, valid when the field's filter condition is eAssertFilterCondition_InsideRange
|
||||
m_maxFilterValue,
|
||||
// the name of the database holding this field, used in Asset Browser preset editor, if its "" then the field
|
||||
// is common to all current databases
|
||||
m_parentDatabaseName;
|
||||
// is this field visible in the UI ?
|
||||
bool m_bFieldVisibleInUI,
|
||||
// if true, then you cannot modify this field of an asset item, only use it
|
||||
m_bReadOnly,
|
||||
// this field filter is applied after the other filters
|
||||
m_bPostFilter;
|
||||
// the field data type
|
||||
EAssetFieldType m_fieldType;
|
||||
// the filter's condition
|
||||
EAssetFilterCondition m_filterCondition;
|
||||
// use the enum list values to choose a value for the field ?
|
||||
bool m_bUseEnumValues;
|
||||
// this map is used when asset field has m_bUseEnumValues on true,
|
||||
// choose a value for the field from this list in the UI
|
||||
TFieldEnumValues m_enumValues;
|
||||
// recommended list column width
|
||||
unsigned int m_listColumnWidth;
|
||||
};
|
||||
|
||||
struct SFieldFiltersPreset
|
||||
{
|
||||
QString presetName2;
|
||||
QStringList checkedDatabaseNames;
|
||||
bool bUsedInLevel;
|
||||
std::vector<SAssetField> fields;
|
||||
};
|
||||
|
||||
// Description:
|
||||
// This interface allows the programmer to extend asset display types
|
||||
// visible in the asset browser.
|
||||
struct IAssetItemDatabase
|
||||
: public IUnknown
|
||||
{
|
||||
DEFINE_UUID(0xFB09B039, 0x1D9D, 0x4057, 0xA5, 0xF0, 0xAA, 0x3C, 0x7B, 0x97, 0xAE, 0xA8)
|
||||
|
||||
typedef std::vector<SAssetField> TAssetFields;
|
||||
typedef std::map < QString/*field name*/, SAssetField > TAssetFieldFiltersMap;
|
||||
typedef std::map < QString/*asset filename*/, IAssetItem* > TFilenameAssetMap;
|
||||
typedef AZStd::function<bool(const IAssetItem*)> MetaDataChangeListener;
|
||||
|
||||
// Description:
|
||||
// Refresh the database by scanning the folders/paks for files, does not load the files, only filename and filesize are fetched
|
||||
virtual void Refresh() = 0;
|
||||
// Description:
|
||||
// Fills the asset meta data from the loaded xml meta data DB.
|
||||
// Arguments:
|
||||
// db - the database XML node from where to cache the info
|
||||
virtual void PrecacheFieldsInfoFromFileDB(const XmlNodeRef& db) = 0;
|
||||
// Description:
|
||||
// Return all assets loaded/scanned by this database
|
||||
// Return Value:
|
||||
// The assets map reference (filename-asset)
|
||||
virtual TFilenameAssetMap& GetAssets() = 0;
|
||||
// Description:
|
||||
// Get an asset item by its filename
|
||||
// Return Value:
|
||||
// A single asset from the database given the filename
|
||||
virtual IAssetItem* GetAsset(const char* pAssetFilename) = 0;
|
||||
// Description:
|
||||
// Return the asset fields this database's items support
|
||||
// Return Value:
|
||||
// The asset fields vector reference
|
||||
virtual TAssetFields& GetAssetFields() = 0;
|
||||
// Description:
|
||||
// Return an asset field object pointer by the field internal name
|
||||
// Arguments:
|
||||
// pFieldName - the internal field's name (ex: "filename", "relativepath")
|
||||
// Return Value:
|
||||
// The asset field object pointer
|
||||
virtual SAssetField* GetAssetFieldByName(const char* pFieldName) = 0;
|
||||
// Description:
|
||||
// Get the database name
|
||||
// Return Value:
|
||||
// Returns the database name, ex: "Textures"
|
||||
virtual const char* GetDatabaseName() const = 0;
|
||||
// Description:
|
||||
// Get the database supported file name extension(s)
|
||||
// Return Value:
|
||||
// Returns the supported extensions, separated by comma, ex: "tga,bmp,dds"
|
||||
virtual const char* GetSupportedExtensions() const = 0;
|
||||
// Description:
|
||||
// Free the database internal data structures
|
||||
virtual void FreeData() = 0;
|
||||
// Description:
|
||||
// Apply filters to this database which will set/unset the IAssetItem::eAssetFlag_Visible of each asset, based
|
||||
// on the given field filters
|
||||
// Arguments:
|
||||
// rFieldFilters - a reference to the field filters map (fieldname-field)
|
||||
// See Also:
|
||||
// ClearFilters()
|
||||
virtual void ApplyFilters(const TAssetFieldFiltersMap& rFieldFilters) = 0;
|
||||
// Description:
|
||||
// Clear the current filters, by setting the IAssetItem::eAssetFlag_Visible of each asset to true
|
||||
// See Also:
|
||||
// ApplyFilters()
|
||||
virtual void ClearFilters() = 0;
|
||||
virtual QWidget* CreateDbFilterDialog(QWidget* pParent, IAssetViewer* pViewerCtrl) = 0;
|
||||
virtual void UpdateDbFilterDialogUI(QWidget* pDlg) = 0;
|
||||
virtual void OnAssetBrowserOpen() = 0;
|
||||
virtual void OnAssetBrowserClose() = 0;
|
||||
// Description:
|
||||
// Gets the filename for saving new cached asset info.
|
||||
// Return Value:
|
||||
// A file name to save new transactions to the persistent asset info DB
|
||||
// See Also:
|
||||
// CAssetInfoFileDB, IAssetItem::ToXML(), IAssetItem::FromXML()
|
||||
virtual const char* GetTransactionFilename() const = 0;
|
||||
// Description:
|
||||
// Adds a callback to be called when the meta data of this asset changed.
|
||||
// Arguments:
|
||||
// callBack - A functor to be added
|
||||
// Return Value:
|
||||
// True if successful, false otherwise.
|
||||
// See Also:
|
||||
// RemoveMetaDataChangeListener()
|
||||
virtual bool AddMetaDataChangeListener(MetaDataChangeListener callBack) = 0;
|
||||
// Description:
|
||||
// Removes a callback from the list of meta data change listeners.
|
||||
// Arguments:
|
||||
// callBack - A functor to be removed
|
||||
// Return Value:
|
||||
// True if successful, false otherwise.
|
||||
// See Also:
|
||||
// AddMetaDataCHangeListener()
|
||||
virtual bool RemoveMetaDataChangeListener(MetaDataChangeListener callBack) = 0;
|
||||
// Description:
|
||||
// The method that should be called when the meta data of an asset item changes to notify all listeners
|
||||
// Arguments:
|
||||
// pAssetItem - An asset item whose meta data have changed
|
||||
// See Also:
|
||||
// AddMetaDataCHangeListener(), RemoveMetaDataChangeListener()
|
||||
virtual void OnMetaDataChange(const IAssetItem* pAssetItem) = 0;
|
||||
|
||||
//! from IUnknown
|
||||
virtual HRESULT STDMETHODCALLTYPE QueryInterface([[maybe_unused]] REFIID riid, [[maybe_unused]] void** ppvObject)
|
||||
{
|
||||
return E_NOINTERFACE;
|
||||
};
|
||||
virtual ULONG STDMETHODCALLTYPE AddRef()
|
||||
{
|
||||
return 0;
|
||||
};
|
||||
virtual ULONG STDMETHODCALLTYPE Release()
|
||||
{
|
||||
return 0;
|
||||
};
|
||||
};
|
||||
#endif // CRYINCLUDE_EDITOR_INCLUDE_IASSETITEMDATABASE_H
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
// Description : This file declares a control which objective is to display
|
||||
// multiple assets allowing selection and preview of such things
|
||||
// It also handles scrolling and changes in the thumbnail display size
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_INCLUDE_IASSETVIEWER_H
|
||||
#define CRYINCLUDE_EDITOR_INCLUDE_IASSETVIEWER_H
|
||||
#pragma once
|
||||
#include "IObservable.h"
|
||||
#include "IAssetItemDatabase.h"
|
||||
|
||||
struct IAssetItem;
|
||||
struct IAssetItemDatabase;
|
||||
|
||||
// Description:
|
||||
// Observer for the asset viewer events
|
||||
struct IAssetViewerObserver
|
||||
{
|
||||
virtual void OnChangeStatusBarInfo(UINT nSelectedItems, UINT nVisibleItems, UINT nTotalItems) {};
|
||||
virtual void OnSelectionChanged() {};
|
||||
virtual void OnChangedPreviewedAsset(IAssetItem* pAsset) {};
|
||||
virtual void OnAssetDblClick(IAssetItem* pAsset) {};
|
||||
virtual void OnAssetFilterChanged() {};
|
||||
};
|
||||
|
||||
// Description:
|
||||
// The asset viewer interface for the asset database plugins to use
|
||||
struct IAssetViewer
|
||||
{
|
||||
DEFINE_OBSERVABLE_PURE_METHODS(IAssetViewerObserver);
|
||||
|
||||
virtual HWND GetRenderWindow() = 0;
|
||||
virtual void ApplyFilters(const IAssetItemDatabase::TAssetFieldFiltersMap& rFieldFilters) = 0;
|
||||
virtual const IAssetItemDatabase::TAssetFieldFiltersMap& GetCurrentFilters() = 0;
|
||||
virtual void ClearFilters() = 0;
|
||||
};
|
||||
#endif // CRYINCLUDE_EDITOR_INCLUDE_IASSETVIEWER_H
|
||||
@@ -0,0 +1,142 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
#ifndef CRYINCLUDE_EDITOR_INCLUDE_IBASELIBRARYMANAGER_H
|
||||
#define CRYINCLUDE_EDITOR_INCLUDE_IBASELIBRARYMANAGER_H
|
||||
#pragma once
|
||||
|
||||
#include <IEditor.h>
|
||||
#include "Include/IDataBaseItem.h"
|
||||
#include "Include/IDataBaseLibrary.h"
|
||||
#include "Include/IDataBaseManager.h"
|
||||
#include "Util/TRefCountBase.h"
|
||||
|
||||
class CBaseLibraryItem;
|
||||
class CBaseLibrary;
|
||||
|
||||
struct IBaseLibraryManager
|
||||
: public TRefCountBase<IDataBaseManager>
|
||||
, public IEditorNotifyListener
|
||||
{
|
||||
//! Clear all libraries.
|
||||
virtual void ClearAll() = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// IDocListener implementation.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
virtual void OnEditorNotifyEvent(EEditorNotifyEvent event) = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Library items.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Make a new item in specified library.
|
||||
virtual IDataBaseItem* CreateItem(IDataBaseLibrary* pLibrary) = 0;
|
||||
//! Delete item from library and manager.
|
||||
virtual void DeleteItem(IDataBaseItem* pItem) = 0;
|
||||
|
||||
//! Find Item by its GUID.
|
||||
virtual IDataBaseItem* FindItem(REFGUID guid) const = 0;
|
||||
virtual IDataBaseItem* FindItemByName(const QString& fullItemName) = 0;
|
||||
virtual IDataBaseItem* LoadItemByName(const QString& fullItemName) = 0;
|
||||
|
||||
virtual IDataBaseItemEnumerator* GetItemEnumerator() = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Set item currently selected.
|
||||
virtual void SetSelectedItem(IDataBaseItem* pItem) = 0;
|
||||
// Get currently selected item.
|
||||
virtual IDataBaseItem* GetSelectedItem() const = 0;
|
||||
virtual IDataBaseItem* GetSelectedParentItem() const = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Libraries.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Add Item library.
|
||||
virtual IDataBaseLibrary* AddLibrary(const QString& library, bool isLevelLibrary = false, bool bIsLoading = true) = 0;
|
||||
virtual void DeleteLibrary(const QString& library, bool forceDeleteLevel = false) = 0;
|
||||
//! Get number of libraries.
|
||||
virtual int GetLibraryCount() const = 0;
|
||||
//! Get number of modified libraries.
|
||||
virtual int GetModifiedLibraryCount() const = 0;
|
||||
|
||||
//! Get Item library by index.
|
||||
virtual IDataBaseLibrary* GetLibrary(int index) const = 0;
|
||||
|
||||
//! Get Level Item library.
|
||||
virtual IDataBaseLibrary* GetLevelLibrary() const = 0;
|
||||
|
||||
//! Find Items Library by name.
|
||||
virtual IDataBaseLibrary* FindLibrary(const QString& library) = 0;
|
||||
|
||||
//! Find the Library's index by name.
|
||||
virtual int FindLibraryIndex(const QString& library) = 0;
|
||||
|
||||
//! Load Items library.
|
||||
#ifdef LoadLibrary
|
||||
#undef LoadLibrary
|
||||
#endif
|
||||
virtual IDataBaseLibrary* LoadLibrary(const QString& filename, bool bReload = false) = 0;
|
||||
|
||||
//! Save all modified libraries.
|
||||
virtual void SaveAllLibs() = 0;
|
||||
|
||||
//! Serialize property manager.
|
||||
virtual void Serialize(XmlNodeRef& node, bool bLoading) = 0;
|
||||
|
||||
//! Export items to game.
|
||||
virtual void Export(XmlNodeRef& node) = 0;
|
||||
|
||||
//! Returns unique name base on input name.
|
||||
// Vera@conffx, add LibName parameter so we could make an unique name depends on input library.
|
||||
// Arguments:
|
||||
// - name: name of the item
|
||||
// - libName: The library of the item. Given the library name, the function will return a unique name in the library
|
||||
// Default value "": The function will ignore the library name and return a unique name in the manager
|
||||
virtual QString MakeUniqueItemName(const QString& name, const QString& libName = "") = 0;
|
||||
virtual QString MakeFullItemName(IDataBaseLibrary* pLibrary, const QString& group, const QString& itemName) = 0;
|
||||
|
||||
//! Root node where this library will be saved.
|
||||
virtual QString GetRootNodeName() = 0;
|
||||
//! Path to libraries in this manager.
|
||||
virtual QString GetLibsPath() = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Validate library items for errors.
|
||||
virtual void Validate() = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
virtual void GatherUsedResources(CUsedResources& resources) = 0;
|
||||
|
||||
virtual void AddListener(IDataBaseManagerListener* pListener) = 0;
|
||||
virtual void RemoveListener(IDataBaseManagerListener* pListener) = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
virtual void RegisterItem(CBaseLibraryItem* pItem, REFGUID newGuid) = 0;
|
||||
virtual void RegisterItem(CBaseLibraryItem* pItem) = 0;
|
||||
virtual void UnregisterItem(CBaseLibraryItem* pItem) = 0;
|
||||
|
||||
// Only Used internally.
|
||||
virtual void OnRenameItem(CBaseLibraryItem* pItem, const QString& oldName) = 0;
|
||||
|
||||
// Called by items to indicated that they have been modified.
|
||||
// Sends item changed event to listeners.
|
||||
virtual void OnItemChanged(IDataBaseItem* pItem) = 0;
|
||||
virtual void OnUpdateProperties(IDataBaseItem* pItem, bool bRefresh) = 0;
|
||||
|
||||
//CONFETTI BEGIN
|
||||
// Used to change the library item order
|
||||
virtual void ChangeLibraryOrder(IDataBaseLibrary* lib, unsigned int newLocation) = 0;
|
||||
// simplifies the library renaming process
|
||||
virtual bool SetLibraryName(CBaseLibrary* lib, const QString& name) = 0;
|
||||
|
||||
|
||||
//Check if the file name is unique.
|
||||
//Params: library: library name. NOT the file path.
|
||||
virtual bool IsUniqueFilename(const QString& library) = 0;
|
||||
//CONFETTI END
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_INCLUDE_IBASELIBRARYMANAGER_H
|
||||
@@ -0,0 +1,206 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_INCLUDE_ICOMMANDMANAGER_H
|
||||
#define CRYINCLUDE_EDITOR_INCLUDE_ICOMMANDMANAGER_H
|
||||
#pragma once
|
||||
#include "Command.h"
|
||||
|
||||
typedef void (* TPfnDeleter)(void*);
|
||||
|
||||
class ICommandManager
|
||||
{
|
||||
public:
|
||||
virtual ~ICommandManager() = default;
|
||||
|
||||
virtual bool AddCommand(CCommand* pCommand, TPfnDeleter deleter = nullptr) = 0;
|
||||
virtual bool UnregisterCommand(const char* module, const char* name) = 0;
|
||||
virtual bool AttachUIInfo(const char* fullCmdName, const CCommand0::SUIInfo& uiInfo) = 0;
|
||||
virtual bool IsRegistered(const char* module, const char* name) const = 0;
|
||||
virtual bool IsRegistered(const char* cmdLine) const = 0;
|
||||
virtual bool IsRegistered(int commandId) const = 0;
|
||||
};
|
||||
|
||||
/// A set of helper template methods for an easy registration of commands
|
||||
namespace CommandManagerHelper
|
||||
{
|
||||
bool RegisterCommand(ICommandManager* pCmdMgr, const char* module, const char* name,
|
||||
const char* description, const char* example,
|
||||
const AZStd::function<void()>& functor);
|
||||
template <typename RT>
|
||||
bool RegisterCommand(ICommandManager* pCmdMgr, const char* module, const char* name,
|
||||
const char* description, const char* example,
|
||||
const AZStd::function<RT()>& functor);
|
||||
template <LIST(1, typename P)>
|
||||
bool RegisterCommand(ICommandManager* pCmdMgr, const char* module, const char* name,
|
||||
const char* description, const char* example,
|
||||
const AZStd::function<void(LIST(1, P))>& functor);
|
||||
template <LIST(1, typename P), typename RT>
|
||||
bool RegisterCommand(ICommandManager* pCmdMgr, const char* module, const char* name,
|
||||
const char* description, const char* example,
|
||||
const AZStd::function<RT(LIST(1, P))>& functor);
|
||||
template <LIST(2, typename P)>
|
||||
bool RegisterCommand(ICommandManager* pCmdMgr, const char* module, const char* name,
|
||||
const char* description, const char* example,
|
||||
const AZStd::function<void(LIST(2, P))>& functor);
|
||||
template <LIST(2, typename P), typename RT>
|
||||
bool RegisterCommand(ICommandManager* pCmdMgr, const char* module, const char* name,
|
||||
const char* description, const char* example,
|
||||
const AZStd::function<RT(LIST(2, P))>& functor);
|
||||
template <LIST(3, typename P)>
|
||||
bool RegisterCommand(ICommandManager* pCmdMgr, const char* module, const char* name,
|
||||
const char* description, const char* example,
|
||||
const AZStd::function<void(LIST(3, P))>& functor);
|
||||
template <LIST(3, typename P), typename RT>
|
||||
bool RegisterCommand(ICommandManager* pCmdMgr, const char* module, const char* name,
|
||||
const char* description, const char* example,
|
||||
const AZStd::function<RT(LIST(3, P))>& functor);
|
||||
template <LIST(4, typename P)>
|
||||
bool RegisterCommand(ICommandManager* pCmdMgr, const char* module, const char* name,
|
||||
const char* description, const char* example,
|
||||
const AZStd::function<void(LIST(4, P))>& functor);
|
||||
template <LIST(4, typename P), typename RT>
|
||||
bool RegisterCommand(ICommandManager* pCmdMgr, const char* module, const char* name,
|
||||
const char* description, const char* example,
|
||||
const AZStd::function<RT(LIST(4, P))>& functor);
|
||||
template <LIST(5, typename P)>
|
||||
bool RegisterCommand(ICommandManager* pCmdMgr, const char* module, const char* name,
|
||||
const char* description, const char* example,
|
||||
const AZStd::function<void(LIST(5, P))>& functor);
|
||||
template <LIST(6, typename P)>
|
||||
bool RegisterCommand(ICommandManager* pCmdMgr, const char* module, const char* name,
|
||||
const char* description, const char* example,
|
||||
const AZStd::function<void(LIST(6, P))>& functor);
|
||||
|
||||
namespace Private
|
||||
{
|
||||
template <typename FunctorType, typename CommandType>
|
||||
bool RegisterCommand(ICommandManager* pCmdMgr, const char* module, const char* name,
|
||||
const char* description, const char* example,
|
||||
const FunctorType& functor);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename FunctorType, typename CommandType>
|
||||
bool CommandManagerHelper::Private::RegisterCommand(ICommandManager* pCmdMgr,
|
||||
const char* module, const char* name,
|
||||
const char* description, const char* example,
|
||||
const FunctorType& functor)
|
||||
{
|
||||
assert(functor);
|
||||
if (!functor)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
CommandType* pCommand
|
||||
= new CommandType(module, name, description, example, functor);
|
||||
if (pCmdMgr->AddCommand(pCommand) == false)
|
||||
{
|
||||
delete pCommand;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
inline
|
||||
bool CommandManagerHelper::RegisterCommand(ICommandManager* pCmdMgr, const char* module, const char* name,
|
||||
const char* description, const char* example,
|
||||
const AZStd::function<void()>& functor)
|
||||
{
|
||||
return Private::RegisterCommand<AZStd::function<void()>, CCommand0>(pCmdMgr, module, name, description, example, functor);
|
||||
}
|
||||
|
||||
template <typename RT>
|
||||
bool CommandManagerHelper::RegisterCommand(ICommandManager* pCmdMgr, const char* module, const char* name,
|
||||
const char* description, const char* example,
|
||||
const AZStd::function<RT()>& functor)
|
||||
{
|
||||
return Private::RegisterCommand<AZStd::function<RT()>, CCommand0wRet<RT> >(pCmdMgr, module, name, description, example, functor);
|
||||
}
|
||||
|
||||
template <LIST(1, typename P)>
|
||||
bool CommandManagerHelper::RegisterCommand(ICommandManager* pCmdMgr, const char* module, const char* name,
|
||||
const char* description, const char* example,
|
||||
const AZStd::function<void(LIST(1, P))>& functor)
|
||||
{
|
||||
return Private::RegisterCommand<AZStd::function<void(LIST(1, P))>, CCommand1<LIST(1, P)> >(pCmdMgr, module, name, description, example, functor);
|
||||
}
|
||||
|
||||
template <LIST(1, typename P), typename RT>
|
||||
bool CommandManagerHelper::RegisterCommand(ICommandManager* pCmdMgr, const char* module, const char* name,
|
||||
const char* description, const char* example,
|
||||
const AZStd::function<RT(LIST(1, P))>& functor)
|
||||
{
|
||||
return Private::RegisterCommand<AZStd::function<RT(LIST(1, P))>, CCommand1wRet<LIST(1, P), RT> >(pCmdMgr, module, name, description, example, functor);
|
||||
}
|
||||
|
||||
template <LIST(2, typename P)>
|
||||
bool CommandManagerHelper::RegisterCommand(ICommandManager* pCmdMgr, const char* module, const char* name,
|
||||
const char* description, const char* example,
|
||||
const AZStd::function<void(LIST(2, P))>& functor)
|
||||
{
|
||||
return Private::RegisterCommand<AZStd::function<void(LIST(2, P))>, CCommand2<LIST(2, P)> >(pCmdMgr, module, name, description, example, functor);
|
||||
}
|
||||
|
||||
template <LIST(2, typename P), typename RT>
|
||||
bool CommandManagerHelper::RegisterCommand(ICommandManager* pCmdMgr, const char* module, const char* name,
|
||||
const char* description, const char* example,
|
||||
const AZStd::function<RT(LIST(2, P))>& functor)
|
||||
{
|
||||
return Private::RegisterCommand<AZStd::function<RT(LIST(2, P))>, CCommand2wRet<LIST(2, P), RT> >(pCmdMgr, module, name, description, example, functor);
|
||||
}
|
||||
|
||||
template <LIST(3, typename P)>
|
||||
bool CommandManagerHelper::RegisterCommand(ICommandManager* pCmdMgr, const char* module, const char* name,
|
||||
const char* description, const char* example,
|
||||
const AZStd::function<void(LIST(3, P))>& functor)
|
||||
{
|
||||
return Private::RegisterCommand<AZStd::function<void(LIST(3, P))>, CCommand3<LIST(3, P)> >(pCmdMgr, module, name, description, example, functor);
|
||||
}
|
||||
|
||||
template <LIST(3, typename P), typename RT>
|
||||
bool CommandManagerHelper::RegisterCommand(ICommandManager* pCmdMgr, const char* module, const char* name,
|
||||
const char* description, const char* example,
|
||||
const AZStd::function<RT(LIST(3, P))>& functor)
|
||||
{
|
||||
return Private::RegisterCommand<AZStd::function<RT(LIST(3, P))>, CCommand3wRet<LIST(3, P), RT> >(pCmdMgr, module, name, description, example, functor);
|
||||
}
|
||||
|
||||
template <LIST(4, typename P)>
|
||||
bool CommandManagerHelper::RegisterCommand(ICommandManager* pCmdMgr, const char* module, const char* name,
|
||||
const char* description, const char* example,
|
||||
const AZStd::function<void(LIST(4, P))>& functor)
|
||||
{
|
||||
return Private::RegisterCommand<AZStd::function<void(LIST(4, P))>, CCommand4<LIST(4, P)> >(pCmdMgr, module, name, description, example, functor);
|
||||
}
|
||||
|
||||
template <LIST(4, typename P), typename RT>
|
||||
bool CommandManagerHelper::RegisterCommand(ICommandManager* pCmdMgr, const char* module, const char* name,
|
||||
const char* description, const char* example,
|
||||
const AZStd::function<RT(LIST(4, P))>& functor)
|
||||
{
|
||||
return Private::RegisterCommand<AZStd::function<RT(LIST(4, P))>, CCommand4wRet<LIST(4, P), RT> >(pCmdMgr, module, name, description, example, functor);
|
||||
}
|
||||
|
||||
template <LIST(5, typename P)>
|
||||
bool CommandManagerHelper::RegisterCommand(ICommandManager* pCmdMgr, const char* module, const char* name,
|
||||
const char* description, const char* example,
|
||||
const AZStd::function<void(LIST(5, P))>& functor)
|
||||
{
|
||||
return Private::RegisterCommand<AZStd::function<void(LIST(5, P))>, CCommand5<LIST(5, P)> >(pCmdMgr, module, name, description, example, functor);
|
||||
}
|
||||
|
||||
template <LIST(6, typename P)>
|
||||
bool CommandManagerHelper::RegisterCommand(ICommandManager* pCmdMgr, const char* module, const char* name,
|
||||
const char* description, const char* example,
|
||||
const AZStd::function<void(LIST(6, P))>& functor)
|
||||
{
|
||||
return Private::RegisterCommand<AZStd::function<void(LIST(6, P))>, CCommand6<LIST(6, P)> >(pCmdMgr, module, name, description, example, functor);
|
||||
}
|
||||
#endif // CRYINCLUDE_EDITOR_INCLUDE_ICOMMANDMANAGER_H
|
||||
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
// Description : Standard interface for console connectivity plugins.
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_INCLUDE_ICONSOLECONNECTIVITY_H
|
||||
#define CRYINCLUDE_EDITOR_INCLUDE_ICONSOLECONNECTIVITY_H
|
||||
#pragma once
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Description
|
||||
// This interface provide access to the console connectivity
|
||||
// functionality.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
struct IConsoleConnectivity
|
||||
: public IUnknown
|
||||
{
|
||||
DEFINE_UUID(0x4DAA85E1, 0x8498, 0x402f, 0x9B, 0x85, 0x7F, 0x62, 0x9D, 0x76, 0x79, 0x8A);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//TODO: Must add the useful interface here.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Description:
|
||||
// Checks if a development console is connected to the development PC.
|
||||
// See Also:
|
||||
// Arguments:
|
||||
// Nothing
|
||||
// Return:
|
||||
// bool - true if it is connected, false otherwise.
|
||||
virtual bool IsConnectedToConsole() = 0;
|
||||
|
||||
// Description:
|
||||
// Send a file from the specified local filename to the console platform creating the full path
|
||||
// as required so it can copy to the remote filename.
|
||||
// See Also:
|
||||
// Nothing
|
||||
// Arguments:
|
||||
// szLocalFileName - is the local filename from which you want to copy the file.
|
||||
// szRemoteFilename - is the full path and filename to where you want to copy the file.
|
||||
// Return:
|
||||
// bool - true if the copy succeeded, false otherwise.
|
||||
virtual bool SendFile(const char* szLocalFileName, const char* szRemoteFilename) = 0;
|
||||
|
||||
// Description:
|
||||
// Notifies to the console that a file has been changed, typically uploaded.
|
||||
// This will be usually called after a SendFile (see above) call, so that the
|
||||
// system running on the console may decide what to do with this new file.
|
||||
// Typically the system will have to load or reloads this new file.
|
||||
// See Also:
|
||||
// SendFile
|
||||
// Arguments:
|
||||
// szRemoteFilename - is the full path and filename in the console of the changed
|
||||
// file.
|
||||
// Return:
|
||||
// bool - true if succeeded sending the notification, false otherwise.
|
||||
virtual bool NotifyFileChange(const char* szRemoteFilename) = 0;
|
||||
|
||||
|
||||
// Description:
|
||||
// Gets the the title IP for the connected console .
|
||||
// Arguments:
|
||||
// dwConsoleAddressPlaceholder - is the pointer to the placeholder of the variable
|
||||
// which will contain the title IP of the console.
|
||||
// Return:
|
||||
// bool - true if dwConsoleAddressPlaceholder now contains the IP address, else false.
|
||||
virtual bool GetConsoleAddress(DWORD* dwConsoleAddressPlaceholder) = 0;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// IUnknown
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject) { return E_NOINTERFACE; };
|
||||
virtual ULONG STDMETHODCALLTYPE AddRef() { return 0; };
|
||||
virtual ULONG STDMETHODCALLTYPE Release() { return 0; };
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_INCLUDE_ICONSOLECONNECTIVITY_H
|
||||
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_INCLUDE_IDATABASEITEM_H
|
||||
#define CRYINCLUDE_EDITOR_INCLUDE_IDATABASEITEM_H
|
||||
#pragma once
|
||||
|
||||
#include <qwindowdefs.h>
|
||||
#include <IEditor.h>
|
||||
|
||||
struct IDataBaseLibrary;
|
||||
class CUsedResources;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/** Base class for all items contained in BaseLibraray.
|
||||
*/
|
||||
struct IDataBaseItem
|
||||
{
|
||||
struct SerializeContext
|
||||
{
|
||||
XmlNodeRef node;
|
||||
bool bUndo;
|
||||
bool bLoading;
|
||||
bool bCopyPaste;
|
||||
bool bIgnoreChilds;
|
||||
bool bUniqName;
|
||||
SerializeContext()
|
||||
: node(0)
|
||||
, bLoading(false)
|
||||
, bCopyPaste(false)
|
||||
, bIgnoreChilds(false)
|
||||
, bUniqName(false)
|
||||
, bUndo(false) {};
|
||||
SerializeContext(XmlNodeRef _node, bool bLoad)
|
||||
: node(_node)
|
||||
, bLoading(bLoad)
|
||||
, bCopyPaste(false)
|
||||
, bIgnoreChilds(false)
|
||||
, bUniqName(false)
|
||||
, bUndo(false) {};
|
||||
SerializeContext(const SerializeContext& ctx)
|
||||
: node(ctx.node)
|
||||
, bLoading(ctx.bLoading)
|
||||
, bCopyPaste(ctx.bCopyPaste)
|
||||
, bIgnoreChilds(ctx.bIgnoreChilds)
|
||||
, bUniqName(ctx.bUniqName)
|
||||
, bUndo(ctx.bUndo) {};
|
||||
};
|
||||
|
||||
virtual EDataBaseItemType GetType() const = 0;
|
||||
|
||||
//! Return Library this item are contained in.
|
||||
//! Item can only be at one library.
|
||||
virtual IDataBaseLibrary* GetLibrary() const = 0;
|
||||
|
||||
//! Change item name.
|
||||
virtual void SetName(const QString& name) = 0;
|
||||
//! Get item name.
|
||||
virtual const QString& GetName() const = 0;
|
||||
|
||||
//! Get full item name, including name of library.
|
||||
//! Name formed by adding dot after name of library
|
||||
//! eg. library Pickup and item PickupRL form full item name: "Pickups.PickupRL".
|
||||
virtual QString GetFullName() const = 0;
|
||||
|
||||
//! Get only nameof group from prototype.
|
||||
virtual QString GetGroupName() = 0;
|
||||
//! Get short name of prototype without group.
|
||||
virtual QString GetShortName() = 0;
|
||||
|
||||
//! Serialize library item to archive.
|
||||
virtual void Serialize(SerializeContext& ctx) = 0;
|
||||
|
||||
//! Generate new unique id for this item.
|
||||
virtual void GenerateId() = 0;
|
||||
//! Returns GUID of this material.
|
||||
virtual const GUID& GetGUID() const = 0;
|
||||
|
||||
//! Validate item for errors.
|
||||
virtual void Validate() {};
|
||||
|
||||
//! Gathers resources by this item.
|
||||
virtual void GatherUsedResources([[maybe_unused]] CUsedResources& resources) {};
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_INCLUDE_IDATABASEITEM_H
|
||||
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_INCLUDE_IDATABASELIBRARY_H
|
||||
#define CRYINCLUDE_EDITOR_INCLUDE_IDATABASELIBRARY_H
|
||||
#pragma once
|
||||
|
||||
|
||||
struct IDataBaseManager;
|
||||
struct IDataBaseItem;
|
||||
|
||||
class QString;
|
||||
class XmlNodeRef;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Description:
|
||||
// Interface to access specific library of editor data base.
|
||||
// Ex. Archetype library, Material Library.
|
||||
// See Also:
|
||||
// IDataBaseItem,IDataBaseManager
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
struct IDataBaseLibrary
|
||||
{
|
||||
// Description:
|
||||
// Return IDataBaseManager interface to the manager for items stored in this library.
|
||||
virtual IDataBaseManager* GetManager() = 0;
|
||||
|
||||
// Description:
|
||||
// Return library name.
|
||||
virtual const QString& GetName() const = 0;
|
||||
|
||||
// Description:
|
||||
// Return filename where this library is stored.
|
||||
virtual const QString& GetFilename() const = 0;
|
||||
|
||||
// Description:
|
||||
// Save contents of library to file.
|
||||
virtual bool Save() = 0;
|
||||
|
||||
// Description:
|
||||
// Load library from file.
|
||||
// Arguments:
|
||||
// filename - Full specified library filename (relative to root game folder).
|
||||
virtual bool Load(const QString& filename) = 0;
|
||||
|
||||
// Description:
|
||||
// Serialize library parameters and items to/from XML node.
|
||||
virtual void Serialize(XmlNodeRef& node, bool bLoading) = 0;
|
||||
|
||||
// Description:
|
||||
// Marks library as modified, indicates that some item in library was modified.
|
||||
virtual void SetModified(bool bModified = true) = 0;
|
||||
|
||||
// Description:
|
||||
// Check if library parameters or any items where modified.
|
||||
// If any item was modified library may need saving before closing editor.
|
||||
virtual bool IsModified() const = 0;
|
||||
|
||||
// Description:
|
||||
// Check if this library is not shared and internal to current level.
|
||||
virtual bool IsLevelLibrary() const = 0;
|
||||
|
||||
// Description:
|
||||
// Make this library accessible only from current Level. (not shared)
|
||||
virtual void SetLevelLibrary(bool bEnable) = 0;
|
||||
|
||||
// Description:
|
||||
// Associate a new item with the library.
|
||||
// Watch out if item was already in another library.
|
||||
virtual void AddItem(IDataBaseItem* pItem, bool bRegister = true) = 0;
|
||||
|
||||
// Description:
|
||||
// Return number of items in library.
|
||||
virtual int GetItemCount() const = 0;
|
||||
|
||||
// Description:
|
||||
// Get item by index.
|
||||
// See Also:
|
||||
// GetItemCount
|
||||
// Arguments:
|
||||
// index - Index from 0 to GetItemCount()
|
||||
virtual IDataBaseItem* GetItem(int index) = 0;
|
||||
|
||||
// Description:
|
||||
// Remove item from library, does not destroy item,
|
||||
// only unliks it from this library, to delete item use IDataBaseManager.
|
||||
// See Also:
|
||||
// AddItem
|
||||
virtual void RemoveItem(IDataBaseItem* item) = 0;
|
||||
|
||||
// Description:
|
||||
// Remove all items from library, does not destroy items,
|
||||
// only unliks them from this library, to delete item use IDataBaseManager.
|
||||
// See Also:
|
||||
// RemoveItem,AddItem
|
||||
virtual void RemoveAllItems() = 0;
|
||||
|
||||
// Description:
|
||||
// Find item in library by name.
|
||||
// This function usually uses linear search so it is not particularry fast.
|
||||
// See Also:
|
||||
// GetItem
|
||||
virtual IDataBaseItem* FindItem(const QString& name) = 0;
|
||||
|
||||
|
||||
//CONFETTI BEGIN
|
||||
// Used to change the library item order
|
||||
virtual void ChangeItemOrder(CBaseLibraryItem* item, unsigned int newLocation) = 0;
|
||||
//CONFETTI END
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_INCLUDE_IDATABASELIBRARY_H
|
||||
@@ -0,0 +1,133 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_INCLUDE_IDATABASEMANAGER_H
|
||||
#define CRYINCLUDE_EDITOR_INCLUDE_IDATABASEMANAGER_H
|
||||
#pragma once
|
||||
|
||||
#include <QString>
|
||||
|
||||
struct IDataBaseItem;
|
||||
struct IDataBaseLibrary;
|
||||
class CUsedResources;
|
||||
|
||||
enum EDataBaseItemEvent
|
||||
{
|
||||
EDB_ITEM_EVENT_ADD,
|
||||
EDB_ITEM_EVENT_DELETE,
|
||||
EDB_ITEM_EVENT_CHANGED,
|
||||
EDB_ITEM_EVENT_SELECTED,
|
||||
EDB_ITEM_EVENT_UPDATE_PROPERTIES,
|
||||
EDB_ITEM_EVENT_UPDATE_PROPERTIES_NO_EDITOR_REFRESH
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Description:
|
||||
// Callback class to intercept item creation and deletion events.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
struct IDataBaseManagerListener
|
||||
{
|
||||
virtual void OnDataBaseItemEvent(IDataBaseItem* pItem, EDataBaseItemEvent event) = 0;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Description:
|
||||
// his interface is used to enumerate al items registered to the database manager.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
struct IDataBaseItemEnumerator
|
||||
{
|
||||
virtual ~IDataBaseItemEnumerator() = default;
|
||||
|
||||
virtual void Release() = 0;
|
||||
virtual IDataBaseItem* GetFirst() = 0;
|
||||
virtual IDataBaseItem* GetNext() = 0;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Interface to the collection of all items or specific type
|
||||
// in data base libraries.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
struct IDataBaseManager
|
||||
{
|
||||
//! Clear all libraries.
|
||||
virtual void ClearAll() = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Library items.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Make a new item in specified library.
|
||||
virtual IDataBaseItem* CreateItem(IDataBaseLibrary* pLibrary) = 0;
|
||||
//! Delete item from library and manager.
|
||||
virtual void DeleteItem(IDataBaseItem* pItem) = 0;
|
||||
|
||||
//! Find Item by its GUID.
|
||||
virtual IDataBaseItem* FindItem(REFGUID guid) const = 0;
|
||||
virtual IDataBaseItem* FindItemByName(const QString& fullItemName) = 0;
|
||||
|
||||
virtual IDataBaseItemEnumerator* GetItemEnumerator() = 0;
|
||||
|
||||
// Select one item in DB.
|
||||
virtual void SetSelectedItem(IDataBaseItem* pItem) = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Libraries.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Add Item library. Set isLevelLibrary to true if its the "level" library which gets saved inside the level
|
||||
virtual IDataBaseLibrary* AddLibrary(const QString& library, bool isLevelLibrary = false, bool bIsLoading = true) = 0;
|
||||
virtual void DeleteLibrary(const QString& library, bool forceDeleteLibrary = false) = 0;
|
||||
//! Get number of libraries.
|
||||
virtual int GetLibraryCount() const = 0;
|
||||
//! Get Item library by index.
|
||||
virtual IDataBaseLibrary* GetLibrary(int index) const = 0;
|
||||
|
||||
//! Find Items Library by name.
|
||||
virtual IDataBaseLibrary* FindLibrary(const QString& library) = 0;
|
||||
|
||||
//! Load Items library.
|
||||
#ifdef LoadLibrary
|
||||
#undef LoadLibrary
|
||||
#endif
|
||||
virtual IDataBaseLibrary* LoadLibrary(const QString& filename, bool bReload = false) = 0;
|
||||
|
||||
//! Save all modified libraries.
|
||||
virtual void SaveAllLibs() = 0;
|
||||
|
||||
//! Serialize property manager.
|
||||
virtual void Serialize(XmlNodeRef& node, bool bLoading) = 0;
|
||||
|
||||
//! Export items to game.
|
||||
virtual void Export([[maybe_unused]] XmlNodeRef& node) {};
|
||||
|
||||
//! Returns unique name base on input name.
|
||||
virtual QString MakeUniqueItemName(const QString& name, const QString& libName = "") = 0;
|
||||
virtual QString MakeFullItemName(IDataBaseLibrary* pLibrary, const QString& group, const QString& itemName) = 0;
|
||||
|
||||
//! Root node where this library will be saved.
|
||||
virtual QString GetRootNodeName() = 0;
|
||||
//! Path to libraries in this manager.
|
||||
virtual QString GetLibsPath() = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Validate library items for errors.
|
||||
virtual void Validate() = 0;
|
||||
|
||||
// Description:
|
||||
// Collects names of all resource files used by managed items.
|
||||
// Arguments:
|
||||
// resources - Structure where all filenames are collected.
|
||||
virtual void GatherUsedResources(CUsedResources& resources) = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Register listeners.
|
||||
virtual void AddListener(IDataBaseManagerListener* pListener) = 0;
|
||||
virtual void RemoveListener(IDataBaseManagerListener* pListener) = 0;
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_INCLUDE_IDATABASEMANAGER_H
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_INCLUDE_IDISPLAYVIEWPORT_H
|
||||
#define CRYINCLUDE_EDITOR_INCLUDE_IDISPLAYVIEWPORT_H
|
||||
#pragma once
|
||||
|
||||
struct DisplayContext;
|
||||
class CBaseObjectsCache;
|
||||
class QPoint;
|
||||
class CCamera;
|
||||
struct AABB;
|
||||
class CViewport;
|
||||
|
||||
// Viewport functionality required for DisplayContext
|
||||
struct IDisplayViewport
|
||||
{
|
||||
virtual void Update() = 0;
|
||||
virtual float GetScreenScaleFactor(const Vec3& position) const = 0;
|
||||
virtual float GetScreenScaleFactor(const CCamera& camera, const Vec3& object_position) = 0;
|
||||
virtual bool HitTestLine(const Vec3& lineP1, const Vec3& lineP2, const QPoint& hitpoint, int pixelRadius, float* pToCameraDistance = 0) const = 0;
|
||||
|
||||
/**
|
||||
* Gets the distance of the point on screen to the line defined by the two points, converted to screenspace.
|
||||
* @param lineP1 The first point of the line, in world space.
|
||||
* @param lineP2 The second point of the line, in world space.
|
||||
* @param point The point to check the distance from the line. This point is in screen space.
|
||||
* @return The distance of the point to the line.
|
||||
*/
|
||||
virtual float GetDistanceToLine(const Vec3& lineP1, const Vec3& lineP2, const QPoint& point) const = 0;
|
||||
|
||||
virtual CBaseObjectsCache* GetVisibleObjectsCache() = 0;
|
||||
|
||||
enum EAxis
|
||||
{
|
||||
AXIS_NONE,
|
||||
AXIS_X,
|
||||
AXIS_Y,
|
||||
AXIS_Z
|
||||
};
|
||||
virtual void GetPerpendicularAxis(EAxis* axis, bool* is2D) const = 0;
|
||||
|
||||
virtual const Matrix34& GetViewTM() const = 0;
|
||||
virtual const Matrix34& GetScreenTM() const = 0;
|
||||
virtual QPoint WorldToView(const Vec3& worldPoint) const = 0;
|
||||
virtual QPoint WorldToViewParticleEditor(const Vec3& worldPoint, int width, int height) const = 0;
|
||||
virtual Vec3 WorldToView3D(const Vec3& worldPoint, int flags = 0) const = 0;
|
||||
virtual Vec3 ViewToWorld(const QPoint& vp, bool* collideWithTerrain = nullptr, bool onlyTerrain = false, bool bSkipVegetation = false, bool bTestRenderMesh = false, bool* collideWithObject = nullptr) const = 0;
|
||||
virtual void ViewToWorldRay(const QPoint& vp, Vec3& raySrc, Vec3& rayDir) const = 0;
|
||||
virtual float GetGridStep() const = 0;
|
||||
virtual void setRay(QPoint& vp, Vec3& raySrc, Vec3& rayDir) = 0;
|
||||
virtual void setHitcontext(QPoint& vp, Vec3& raySrc, Vec3& rayDir) = 0;
|
||||
|
||||
virtual float GetAspectRatio() const = 0;
|
||||
virtual const ::Plane* GetConstructionPlane() const = 0;
|
||||
|
||||
virtual bool IsBoundsVisible(const AABB& box) const = 0;
|
||||
|
||||
virtual void ScreenToClient(QPoint& pt) const = 0;
|
||||
virtual void GetDimensions(int* width, int* height) const = 0;
|
||||
|
||||
virtual CViewport *asCViewport() { return nullptr; }
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_INCLUDE_IDISPLAYVIEWPORT_H
|
||||
@@ -0,0 +1,170 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
// Description : Class factory support classes
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_INCLUDE_IEDITORCLASSFACTORY_H
|
||||
#define CRYINCLUDE_EDITOR_INCLUDE_IEDITORCLASSFACTORY_H
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
|
||||
#define DEFINE_UUID(l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
|
||||
static const GUID uuid() { return { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }; }
|
||||
|
||||
#ifdef AZ_PLATFORM_WINDOWS
|
||||
#include <Unknwn.h>
|
||||
#else
|
||||
struct IUnknown
|
||||
{
|
||||
virtual ~IUnknown() = default;
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef __uuidof
|
||||
#undef __uuidof
|
||||
#endif
|
||||
#define __uuidof(T) T::uuid()
|
||||
|
||||
#if defined(AZ_PLATFORM_LINUX)
|
||||
|
||||
# ifndef _REFGUID_DEFINED
|
||||
# define _REFGUID_DEFINED
|
||||
typedef const GUID& REFGUID;
|
||||
# endif
|
||||
|
||||
# ifndef _REFIID_DEFINED
|
||||
# define _REFIID_DEFINED
|
||||
typedef const GUID& REFIID;
|
||||
# endif
|
||||
|
||||
# ifndef IID_DEFINED
|
||||
# define IID_DEFINED
|
||||
typedef GUID IID;
|
||||
# endif
|
||||
|
||||
#ifndef HRESULT_VALUES_DEFINED
|
||||
#define HRESULT_VALUES_DEFINED
|
||||
enum
|
||||
{
|
||||
E_OUTOFMEMORY = 0x8007000E,
|
||||
E_FAIL = 0x80004005,
|
||||
E_ABORT = 0x80004004,
|
||||
E_INVALIDARG = 0x80070057,
|
||||
E_NOINTERFACE = 0x80004002,
|
||||
E_NOTIMPL = 0x80004001,
|
||||
E_UNEXPECTED = 0x8000FFFF
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif // defined(AZ_PLATFORM_LINUX)
|
||||
|
||||
#include "SandboxAPI.h"
|
||||
|
||||
class QObject;
|
||||
class QString;
|
||||
|
||||
|
||||
//! System class IDs
|
||||
enum ESystemClassID
|
||||
{
|
||||
ESYSTEM_CLASS_OBJECT = 0x0001,
|
||||
ESYSTEM_CLASS_EDITTOOL = 0x0002,
|
||||
ESYSTEM_CLASS_PREFERENCE_PAGE = 0x0020,
|
||||
ESYSTEM_CLASS_VIEWPANE = 0x0021,
|
||||
//! Source/Asset Control Management Provider
|
||||
ESYSTEM_CLASS_SCM_PROVIDER = 0x0022,
|
||||
ESYSTEM_CLASS_CONSOLE_CONNECTIVITY = 0x0023,
|
||||
ESYSTEM_CLASS_ASSET_DISPLAY = 0x0024,
|
||||
ESYSTEM_CLASS_ASSET_TAGGING = 0x0025,
|
||||
ESYSTEM_CLASS_FRAMEWND_EXTENSION_PANE = 0x0030,
|
||||
ESYSTEM_CLASS_TRACKVIEW_KEYUI = 0x0040,
|
||||
ESYSTEM_CLASS_UITOOLS = 0x0050, // UI Emulator tool
|
||||
ESYSTEM_CLASS_CONTROL = 0x0900,
|
||||
ESYSTEM_CLASS_USER = 0x1000
|
||||
};
|
||||
|
||||
//! This interface describes a class created by a plugin
|
||||
struct IClassDesc
|
||||
: public IUnknown
|
||||
{
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// IUnknown implementation.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
virtual HRESULT STDMETHODCALLTYPE QueryInterface([[maybe_unused]] const IID& riid, [[maybe_unused]] void** ppvObj) { return E_NOINTERFACE; }
|
||||
virtual ULONG STDMETHODCALLTYPE AddRef() { return 0; }
|
||||
virtual ULONG STDMETHODCALLTYPE Release() { return 0; }
|
||||
|
||||
template<class Q>
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(Q** pp)
|
||||
{
|
||||
return QueryInterface(__uuidof(Q), (void**)pp);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Class description.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! This method returns an Editor defined GUID describing the class this plugin class is associated with.
|
||||
virtual ESystemClassID SystemClassID() = 0;
|
||||
//! Return the GUID of the class created by plugin.
|
||||
virtual REFGUID ClassID() = 0;
|
||||
//! This method returns the human readable name of the class.
|
||||
virtual QString ClassName() = 0;
|
||||
//! This method returns Category of this class, Category is specifying where this plugin class fits best in
|
||||
//! create panel.
|
||||
virtual QString Category() = 0;
|
||||
|
||||
#ifdef QSTRING_H
|
||||
virtual QString MenuSuggestion() { return QString(); }
|
||||
virtual QString Tooltip() { return QString(); }
|
||||
virtual QString Description() { return QString(); }
|
||||
#else
|
||||
//! This method returns the desired menu in which this plugin class would like to be placed in the editor.
|
||||
//! It is up to the editor to determine if it can and wants to fulfill this request.
|
||||
virtual QString MenuSuggestion();
|
||||
//! This method returns the tooltip for the pane
|
||||
virtual QString Tooltip();
|
||||
//! This method returns the description for the pane
|
||||
virtual QString Description();
|
||||
#endif
|
||||
|
||||
//! This method returns if the plugin should have a menu item for its pane.
|
||||
virtual bool ShowInMenu() const { return true; }
|
||||
//! Qt equivalent of CRuntimeClass::CreateObject(). We might create a full QRuntimeClass, if there's a need for it.
|
||||
virtual QObject* CreateQObject() const { return nullptr; }
|
||||
|
||||
//! For any class that may be conditionally enabled or disabled, this function can be overriden to return true if it is enabled, false otherwise.
|
||||
//! The default is to always return true.
|
||||
virtual bool IsEnabled() const { return true; }
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
};
|
||||
|
||||
|
||||
struct IViewPaneClass;
|
||||
|
||||
struct CRYEDIT_API IEditorClassFactory
|
||||
{
|
||||
public:
|
||||
virtual ~IEditorClassFactory() = default;
|
||||
|
||||
//! Register new class to the factory.
|
||||
virtual void RegisterClass(IClassDesc* pClassDesc) = 0;
|
||||
//! Find class in the factory by class name.
|
||||
virtual IClassDesc* FindClass(const char* pClassName) const = 0;
|
||||
//! Find class in the factory by class id
|
||||
virtual IClassDesc* FindClass(const GUID& rClassID) const = 0;
|
||||
virtual IViewPaneClass* FindViewPaneClassByTitle(const char* pPaneTitle) const = 0;
|
||||
virtual void UnregisterClass(const char* pClassName) = 0;
|
||||
virtual void UnregisterClass(const GUID& rClassID) = 0;
|
||||
//! Get classes that matching specific requirements.
|
||||
virtual void GetClassesBySystemID(ESystemClassID aSystemClassID, std::vector<IClassDesc*>& rOutClasses) = 0;
|
||||
virtual void GetClassesByCategory(const char* pCategory, std::vector<IClassDesc*>& rOutClasses) = 0;
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_INCLUDE_IEDITORCLASSFACTORY_H
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_INCLUDE_IEDITORFILEMONITOR_H
|
||||
#define CRYINCLUDE_EDITOR_INCLUDE_IEDITORFILEMONITOR_H
|
||||
#pragma once
|
||||
|
||||
struct IFileChangeListener
|
||||
{
|
||||
enum EChangeType
|
||||
{
|
||||
//! error or unknown change type
|
||||
eChangeType_Unknown,
|
||||
//! the file was created
|
||||
eChangeType_Created,
|
||||
//! the file was deleted
|
||||
eChangeType_Deleted,
|
||||
//! the file was modified (size changed,write)
|
||||
eChangeType_Modified,
|
||||
//! this is the old name of a renamed file
|
||||
eChangeType_RenamedOldName,
|
||||
//! this is the new name of a renamed file
|
||||
eChangeType_RenamedNewName
|
||||
};
|
||||
|
||||
virtual ~IFileChangeListener() = default;
|
||||
|
||||
virtual void OnFileChange(const char* sFilename, EChangeType eType) = 0;
|
||||
};
|
||||
|
||||
struct IFileChangeMonitor
|
||||
{
|
||||
virtual ~IFileChangeMonitor() = default;
|
||||
|
||||
// <interfuscator:shuffle>
|
||||
// Register the path of a file or directory to monitor
|
||||
// Path is relative to game directory, e.g. "Libs/WoundSystem/" or "Libs/WoundSystem/HitLocations.xml"
|
||||
virtual bool RegisterListener(IFileChangeListener* pListener, const char* sMonitorItem) = 0;
|
||||
// This function can be used to monitor files of specific type, e.g.
|
||||
// RegisterListener(pListener, "Animations", "caf")
|
||||
virtual bool RegisterListener(IFileChangeListener* pListener, const char* sFolder, const char* sExtension) = 0;
|
||||
virtual bool UnregisterListener(IFileChangeListener* pListener) = 0;
|
||||
// </interfuscator:shuffle>
|
||||
};
|
||||
|
||||
struct IEditorFileMonitor
|
||||
: public IFileChangeMonitor
|
||||
{
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_INCLUDE_IEDITORFILEMONITOR_H
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef CRYINCLUDE_EDITOR_INCLUDE_IEDITORMATERIAL_H
|
||||
#define CRYINCLUDE_EDITOR_INCLUDE_IEDITORMATERIAL_H
|
||||
|
||||
|
||||
#include "BaseLibraryItem.h"
|
||||
#include <IMaterial.h>
|
||||
|
||||
struct IEditorMaterial
|
||||
: public CBaseLibraryItem
|
||||
{
|
||||
virtual int GetFlags() const = 0;
|
||||
virtual _smart_ptr<IMaterial> GetMatInfo(bool bUseExistingEngineMaterial = false) = 0;
|
||||
virtual void DisableHighlightForFrame() = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
#ifndef CRYINCLUDE_EDITOR_MATERIAL_IEDITORMATERIALMANAGER_H
|
||||
#define CRYINCLUDE_EDITOR_MATERIAL_IEDITORMATERIALMANAGER_H
|
||||
#pragma once
|
||||
|
||||
#define MATERIAL_FILE_EXT ".mtl"
|
||||
#define DCC_MATERIAL_FILE_EXT ".dccmtl"
|
||||
#define MATERIALS_PATH "materials/"
|
||||
|
||||
#include <Include/IBaseLibraryManager.h>
|
||||
#include <IMaterial.h>
|
||||
|
||||
|
||||
struct IEditorMaterialManager
|
||||
{
|
||||
virtual void GotoMaterial(_smart_ptr<IMaterial> pMaterial) = 0;
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_MATERIAL_MATERIALMANAGER_H
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
// Description : Class that collects error reports to present them later.
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_INTERFACE_ERRORREPORT_H
|
||||
#define CRYINCLUDE_EDITOR_INTERFACE_ERRORREPORT_H
|
||||
#pragma once
|
||||
|
||||
#include <IValidator.h>
|
||||
|
||||
// forward declarations.
|
||||
class CParticleItem;
|
||||
class CBaseObject;
|
||||
class CBaseLibraryItem;
|
||||
class CErrorRecord;
|
||||
|
||||
/*! Error report manages collection of errors occurred during map analyzes or level load.
|
||||
*/
|
||||
struct IErrorReport
|
||||
: public IValidator
|
||||
{
|
||||
virtual ~IErrorReport(){}
|
||||
|
||||
//! If enabled errors are reported immediately and not stored.
|
||||
virtual void SetImmediateMode(bool bEnable) = 0;
|
||||
|
||||
virtual bool IsImmediateMode() const = 0;
|
||||
|
||||
virtual void SetShowErrors(bool bShowErrors = true) = 0;
|
||||
|
||||
//! Adds new error to report.
|
||||
virtual void ReportError(CErrorRecord& err) = 0;
|
||||
|
||||
//! Check if error report have any errors.
|
||||
virtual bool IsEmpty() const = 0;
|
||||
|
||||
//! Get number of contained error records.
|
||||
virtual int GetErrorCount() const = 0;
|
||||
|
||||
//! Get access to indexed error record.
|
||||
virtual CErrorRecord& GetError(int i) = 0;
|
||||
|
||||
//! Clear all error records.
|
||||
virtual void Clear() = 0;
|
||||
|
||||
//! Display dialog with all errors.
|
||||
virtual void Display() = 0;
|
||||
|
||||
//! Assign current Object to which new reported warnings are assigned.
|
||||
virtual void SetCurrentValidatorObject(CBaseObject* pObject) = 0;
|
||||
|
||||
//! Assign current Item to which new reported warnings are assigned.
|
||||
virtual void SetCurrentValidatorItem(CBaseLibraryItem* pItem) = 0;
|
||||
|
||||
//! Assign current filename.
|
||||
virtual void SetCurrentFile(const QString& file) = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Implement IValidator interface.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
virtual void Report(SValidatorRecord& record) = 0;
|
||||
};
|
||||
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_ERRORREPORT_H
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_INCLUDE_IEVENTLOOPHOOK_H
|
||||
#define CRYINCLUDE_EDITOR_INCLUDE_IEVENTLOOPHOOK_H
|
||||
#pragma once
|
||||
|
||||
struct IEventLoopHook
|
||||
{
|
||||
IEventLoopHook* pNextHook;
|
||||
|
||||
IEventLoopHook()
|
||||
: pNextHook(0) {}
|
||||
|
||||
virtual bool PrePumpMessage() { return false; }
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_INCLUDE_IEVENTLOOPHOOK_H
|
||||
@@ -0,0 +1,194 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
// Description : Export geometry interfaces
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_INCLUDE_IEXPORTMANAGER_H
|
||||
#define CRYINCLUDE_EDITOR_INCLUDE_IEXPORTMANAGER_H
|
||||
#pragma once
|
||||
|
||||
#define EXP_NAMESIZE 32
|
||||
struct IStatObj;
|
||||
enum class AnimParamType;
|
||||
|
||||
namespace Export
|
||||
{
|
||||
struct Vector3D
|
||||
{
|
||||
float x, y, z;
|
||||
};
|
||||
|
||||
|
||||
struct Quat
|
||||
{
|
||||
Vector3D v;
|
||||
float w;
|
||||
};
|
||||
|
||||
|
||||
struct UV
|
||||
{
|
||||
float u, v;
|
||||
};
|
||||
|
||||
|
||||
struct Face
|
||||
{
|
||||
uint32 idx[3];
|
||||
};
|
||||
|
||||
|
||||
struct Color
|
||||
{
|
||||
float r, g, b, a;
|
||||
};
|
||||
|
||||
typedef char TPath[_MAX_PATH];
|
||||
|
||||
struct Material
|
||||
{
|
||||
Color diffuse;
|
||||
Color specular;
|
||||
float opacity;
|
||||
float smoothness;
|
||||
char name[EXP_NAMESIZE];
|
||||
TPath mapDiffuse;
|
||||
TPath mapSpecular;
|
||||
TPath mapOpacity;
|
||||
TPath mapNormals;
|
||||
TPath mapDecal;
|
||||
TPath mapDisplacement;
|
||||
};
|
||||
|
||||
|
||||
struct Mesh
|
||||
{
|
||||
Material material;
|
||||
|
||||
virtual int GetFaceCount() const = 0;
|
||||
virtual const Face* GetFaceBuffer() const = 0;
|
||||
};
|
||||
|
||||
// The numbers in this enum list must reflect the one from AnimParamType.h
|
||||
enum AnimParamType
|
||||
{
|
||||
FOV = 0,
|
||||
PositionX = 51,
|
||||
PositionY = 52,
|
||||
PositionZ = 53,
|
||||
RotationX = 54,
|
||||
RotationY = 55,
|
||||
RotationZ = 56,
|
||||
|
||||
// FocalLength is an exceptional case for FBX importing from Maya. In engine we use FoV, not Focal Length, therefore
|
||||
// there is no equivalent AnimParamType::FocalLength in IMovieSystem.h. However we enumerate it here so we can detect
|
||||
// and convert it to FoV during import
|
||||
FocalLength,
|
||||
};
|
||||
|
||||
enum EEntityObjectType
|
||||
{
|
||||
eEntity = 0,
|
||||
eCamera = 1,
|
||||
eCameraTarget = 2,
|
||||
};
|
||||
|
||||
struct EntityAnimData
|
||||
{
|
||||
AnimParamType dataType;
|
||||
float keyTime;
|
||||
float keyValue;
|
||||
float leftTangent;
|
||||
float rightTangent;
|
||||
float leftTangentWeight;
|
||||
float rightTangentWeight;
|
||||
};
|
||||
|
||||
struct Object
|
||||
{
|
||||
Vector3D pos;
|
||||
Quat rot;
|
||||
Vector3D scale;
|
||||
char name[EXP_NAMESIZE];
|
||||
char materialName[EXP_NAMESIZE];
|
||||
int nParent;
|
||||
EEntityObjectType entityType;
|
||||
char cameraTargetNodeName[EXP_NAMESIZE];
|
||||
|
||||
virtual int GetVertexCount() const = 0;
|
||||
virtual const Vector3D* GetVertexBuffer() const = 0;
|
||||
|
||||
virtual int GetNormalCount() const = 0;
|
||||
virtual const Vector3D* GetNormalBuffer() const = 0;
|
||||
|
||||
virtual int GetTexCoordCount() const = 0;
|
||||
virtual const UV* GetTexCoordBuffer() const = 0;
|
||||
|
||||
virtual int GetMeshCount() const = 0;
|
||||
virtual Mesh* GetMesh(int index) const = 0;
|
||||
|
||||
virtual size_t MeshHash() const = 0;
|
||||
|
||||
virtual int GetEntityAnimationDataCount() const = 0;
|
||||
virtual const EntityAnimData* GetEntityAnimationData(int index) const = 0;
|
||||
virtual void SetEntityAnimationData(EntityAnimData entityData) = 0;
|
||||
};
|
||||
|
||||
|
||||
// IData: Collection of data like object meshes, materials, animations, etc.
|
||||
// used for export
|
||||
// This data is collected by Export Manager implementation
|
||||
struct IData
|
||||
{
|
||||
virtual int GetObjectCount() const = 0;
|
||||
virtual Object* GetObject(int index) const = 0;
|
||||
virtual Object* AddObject(const char* objectName) = 0;
|
||||
};
|
||||
} // namespace Export
|
||||
|
||||
|
||||
|
||||
// IExporter: interface to present an exporter
|
||||
// Exporter is responding to export data from object of IData type
|
||||
// to file with specified format
|
||||
// Exporter could be provided by user through plug-in system
|
||||
struct IExporter
|
||||
{
|
||||
virtual ~IExporter() = default;
|
||||
|
||||
// Get file extension of exporter type, f.i. "obj"
|
||||
virtual const char* GetExtension() const = 0;
|
||||
|
||||
// Get short format description for showing it in FileSave dialog
|
||||
// Example: "Object format"
|
||||
virtual const char* GetShortDescription() const = 0;
|
||||
|
||||
// Implementation of en exporting data to the file
|
||||
virtual bool ExportToFile(const char* filename, const Export::IData* pData) = 0;
|
||||
virtual bool ImportFromFile(const char* filename, Export::IData* pData) = 0;
|
||||
|
||||
// Before Export Manager is destroyed Release will be called
|
||||
virtual void Release() = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
// IExportManager: interface to export manager
|
||||
struct IExportManager
|
||||
{
|
||||
//! Register exporter
|
||||
//! return true if succeed, otherwise false
|
||||
virtual bool RegisterExporter(IExporter* pExporter) = 0;
|
||||
|
||||
virtual bool ExportSingleStatObj(IStatObj* pStatObj, const char* filename) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_INCLUDE_IEXPORTMANAGER_H
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_INCLUDE_IFACIALEDITOR_H
|
||||
#define CRYINCLUDE_EDITOR_INCLUDE_IFACIALEDITOR_H
|
||||
#pragma once
|
||||
|
||||
|
||||
class IFacialEditor
|
||||
{
|
||||
public:
|
||||
enum EyeType
|
||||
{
|
||||
EYE_LEFT,
|
||||
EYE_RIGHT
|
||||
};
|
||||
|
||||
virtual int GetNumMorphTargets() const = 0;
|
||||
virtual const char* GetMorphTargetName(int index) const = 0;
|
||||
virtual void PreviewEffector(int index, float value) = 0;
|
||||
virtual void ClearAllPreviewEffectors() = 0;
|
||||
virtual void SetForcedNeckRotation(const Quat& rotation) = 0;
|
||||
virtual void SetForcedEyeRotation(const Quat& rotation, EyeType eye) = 0;
|
||||
virtual int GetJoystickCount() const = 0;
|
||||
virtual const char* GetJoystickName(int joystickIndex) const = 0;
|
||||
virtual void SetJoystickPosition(int joystickIndex, float x, float y) = 0;
|
||||
virtual void GetJoystickPosition(int joystickIndex, float& x, float& y) const = 0;
|
||||
virtual void LoadJoystickFile(const char* filename) = 0;
|
||||
virtual void LoadCharacter(const char* filename) = 0;
|
||||
virtual void LoadSequence(const char* filename) = 0;
|
||||
virtual void SetVideoFrameResolution(int width, int height, int bpp) = 0;
|
||||
virtual int GetVideoFramePitch() = 0;
|
||||
virtual void* GetVideoFrameBits() = 0;
|
||||
virtual void ShowVideoFramePane() = 0;
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_INCLUDE_IFACIALEDITOR_H
|
||||
@@ -0,0 +1,208 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "StringUtils.h"
|
||||
#include "../Include/SandboxAPI.h"
|
||||
|
||||
class QWidget;
|
||||
|
||||
#ifdef CreateDirectory
|
||||
#undef CreateDirectory
|
||||
#endif
|
||||
|
||||
#ifdef RemoveDirectory
|
||||
#undef RemoveDirectory
|
||||
#endif
|
||||
|
||||
#ifdef CopyFile
|
||||
#undef CopyFile
|
||||
#endif
|
||||
|
||||
#ifdef MoveFile
|
||||
#undef MoveFile
|
||||
#endif
|
||||
|
||||
#ifdef DeleteFile
|
||||
#undef DeleteFile
|
||||
#endif
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
struct SourceControlFileInfo;
|
||||
}
|
||||
|
||||
typedef int (*ProgressRoutine)(
|
||||
qint64 totalFileSize,
|
||||
qint64 totalBytesTransferred,
|
||||
qint64 streamSize,
|
||||
qint64 streamBytesTransferred,
|
||||
long streamNumber,
|
||||
long callbackReason,
|
||||
void* sourceFile,
|
||||
void* destinationFile,
|
||||
void* data
|
||||
);
|
||||
|
||||
struct IFileUtil
|
||||
{
|
||||
//! File types used for File Open dialogs
|
||||
enum ECustomFileType
|
||||
{
|
||||
EFILE_TYPE_ANY,
|
||||
EFILE_TYPE_GEOMETRY,
|
||||
EFILE_TYPE_TEXTURE,
|
||||
EFILE_TYPE_SOUND,
|
||||
EFILE_TYPE_GEOMCACHE,
|
||||
EFILE_TYPE_LAST,
|
||||
};
|
||||
|
||||
struct FileDesc
|
||||
{
|
||||
QString filename;
|
||||
unsigned int attrib;
|
||||
time_t time_create; //! -1 for FAT file systems
|
||||
time_t time_access; //! -1 for FAT file systems
|
||||
time_t time_write;
|
||||
int64 size;
|
||||
};
|
||||
|
||||
enum ETextFileType
|
||||
{
|
||||
FILE_TYPE_SCRIPT,
|
||||
FILE_TYPE_SHADER,
|
||||
FILE_TYPE_BSPACE, // added back in 3.8 integration, may not end up needing this.
|
||||
};
|
||||
|
||||
enum ECopyTreeResult
|
||||
{
|
||||
ETREECOPYOK,
|
||||
ETREECOPYFAIL,
|
||||
ETREECOPYUSERCANCELED,
|
||||
ETREECOPYUSERDIDNTCOPYSOMEITEMS,
|
||||
};
|
||||
|
||||
struct ExtraMenuItems
|
||||
{
|
||||
QStringList names;
|
||||
int selectedIndexIfAny;
|
||||
|
||||
ExtraMenuItems()
|
||||
: selectedIndexIfAny(-1) {}
|
||||
|
||||
int AddItem(const QString& name)
|
||||
{
|
||||
names.push_back(name);
|
||||
return names.size() - 1;
|
||||
}
|
||||
};
|
||||
|
||||
typedef DynArray<FileDesc> FileArray;
|
||||
|
||||
typedef bool (* ScanDirectoryUpdateCallBack)(const QString& msg);
|
||||
|
||||
virtual ~IFileUtil() = default;
|
||||
|
||||
virtual bool ScanDirectory(const QString& path, const QString& fileSpec, FileArray& files, bool recursive = true, bool addDirAlso = false, ScanDirectoryUpdateCallBack updateCB = nullptr, bool bSkipPaks = false) = 0;
|
||||
|
||||
virtual void ShowInExplorer(const QString& path) = 0;
|
||||
|
||||
virtual bool CompileLuaFile(const char* luaFilename) = 0;
|
||||
virtual bool ExtractFile(QString& file, bool bMsgBoxAskForExtraction = true, const char* pDestinationFilename = nullptr) = 0;
|
||||
virtual void EditTextFile(const char* txtFile, int line = 0, ETextFileType fileType = FILE_TYPE_SCRIPT) = 0;
|
||||
virtual void EditTextureFile(const char* txtureFile, bool bUseGameFolder) = 0;
|
||||
|
||||
//! dcc filename calculation and extraction sub-routines
|
||||
virtual bool CalculateDccFilename(const QString& assetFilename, QString& dccFilename) = 0;
|
||||
|
||||
//! Reformat filter string for (MFC) CFileDialog style file filtering
|
||||
virtual void FormatFilterString(QString& filter) = 0;
|
||||
|
||||
virtual bool SelectSaveFile(const QString& fileFilter, const QString& defaulExtension, const QString& startFolder, QString& fileName) = 0;
|
||||
|
||||
//! Attempt to make a file writable
|
||||
virtual bool OverwriteFile(const QString& filename) = 0;
|
||||
|
||||
//! Checks out the file from source control API. Blocks until completed
|
||||
virtual bool CheckoutFile(const char* filename, QWidget* parentWindow = nullptr) = 0;
|
||||
|
||||
//! Discard changes to a file from source control API. Blocks until completed
|
||||
virtual bool RevertFile(const char* filename, QWidget* parentWindow = nullptr) = 0;
|
||||
|
||||
//! Renames (moves) a file through the source control API. Blocks until completed
|
||||
virtual bool RenameFile(const char* sourceFile, const char* targetFile, QWidget* parentWindow = nullptr) = 0;
|
||||
|
||||
//! Deletes a file using source control API. Blocks until completed
|
||||
virtual bool DeleteFromSourceControl(const char* filename, QWidget* parentWindow = nullptr) = 0;
|
||||
|
||||
//! Attempts to get the latest version of a file from source control. Blocks until completed
|
||||
virtual bool GetLatestFromSourceControl(const char* filename, QWidget* parentWindow = nullptr) = 0;
|
||||
|
||||
//! Gather information about a file using the source control API. Blocks until completed
|
||||
virtual bool GetFileInfoFromSourceControl(const char* filename, AzToolsFramework::SourceControlFileInfo& fileInfo, QWidget* parentWindow = nullptr) = 0;
|
||||
|
||||
//! Creates this directory.
|
||||
virtual void CreateDirectory(const char* dir) = 0;
|
||||
|
||||
//! Makes a backup file.
|
||||
virtual void BackupFile(const char* filename) = 0;
|
||||
|
||||
//! Makes a backup file, marked with a datestamp, e.g. myfile.20071014.093320.xml
|
||||
//! If bUseBackupSubDirectory is true, moves backup file into a relative subdirectory "backups"
|
||||
virtual void BackupFileDated(const char* filename, bool bUseBackupSubDirectory = false) = 0;
|
||||
|
||||
// ! Added deltree as a copy from the function found in Crypak.
|
||||
virtual bool Deltree(const char* szFolder, bool bRecurse) = 0;
|
||||
|
||||
// Checks if a file or directory exist.
|
||||
// We are using 3 functions here in order to make the names more instructive for the programmers.
|
||||
// Those functions only work for OS files and directories.
|
||||
virtual bool Exists(const QString& strPath, bool boDirectory, FileDesc* pDesc = nullptr) = 0;
|
||||
virtual bool FileExists(const QString& strFilePath, FileDesc* pDesc = nullptr) = 0;
|
||||
virtual bool PathExists(const QString& strPath) = 0;
|
||||
virtual bool GetDiskFileSize(const char* pFilePath, uint64& rOutSize) = 0;
|
||||
|
||||
// This function should be used only with physical files.
|
||||
virtual bool IsFileExclusivelyAccessable(const QString& strFilePath) = 0;
|
||||
|
||||
// Creates the entire path, if needed.
|
||||
virtual bool CreatePath(const QString& strPath) = 0;
|
||||
|
||||
// Attempts to delete a file (if read only it will set its attributes to normal first).
|
||||
virtual bool DeleteFile(const QString& strPath) = 0;
|
||||
|
||||
// Attempts to remove a directory (if read only it will set its attributes to normal first).
|
||||
virtual bool RemoveDirectory(const QString& strPath) = 0;
|
||||
|
||||
// Copies all the elements from the source directory to the target directory.
|
||||
// It doesn't copy the source folder to the target folder, only it's contents.
|
||||
// THIS FUNCTION IS NOT DESIGNED FOR MULTI-THREADED USAGE
|
||||
virtual ECopyTreeResult CopyTree(const QString& strSourceDirectory, const QString& strTargetDirectory, bool boRecurse = true, bool boConfirmOverwrite = false) = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// @param LPPROGRESS_ROUTINE pfnProgress - called by the system to notify of file copy progress
|
||||
// @param LPBOOL pbCancel - when the contents of this BOOL are set to TRUE, the system cancels the copy operation
|
||||
virtual ECopyTreeResult CopyFile(const QString& strSourceFile, const QString& strTargetFile, bool boConfirmOverwrite = false, ProgressRoutine pfnProgress = nullptr, bool* pbCancel = nullptr) = 0;
|
||||
|
||||
// As we don't have a FileUtil interface here, we have to duplicate some code :-( in order to keep
|
||||
// function calls clean.
|
||||
// Moves all the elements from the source directory to the target directory.
|
||||
// It doesn't move the source folder to the target folder, only it's contents.
|
||||
// THIS FUNCTION IS NOT DESIGNED FOR MULTI-THREADED USAGE
|
||||
virtual ECopyTreeResult MoveTree(const QString& strSourceDirectory, const QString& strTargetDirectory, bool boRecurse = true, bool boConfirmOverwrite = false) = 0;
|
||||
|
||||
virtual void GatherAssetFilenamesFromLevel(std::set<QString>& rOutFilenames, bool bMakeLowerCase = false, bool bMakeUnixPath = false) = 0;
|
||||
|
||||
// Get file attributes include source control attributes if available
|
||||
virtual uint32 GetAttributes(const char* filename, bool bUseSourceControl = true) = 0;
|
||||
|
||||
// Returns true if the files have the same content, false otherwise
|
||||
virtual bool CompareFiles(const QString& strFilePath1, const QString& strFilePath2) = 0;
|
||||
|
||||
virtual QString GetPath(const QString& path) = 0;
|
||||
};
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_INCLUDE_IGIZMOMANAGER_H
|
||||
#define CRYINCLUDE_EDITOR_INCLUDE_IGIZMOMANAGER_H
|
||||
#pragma once
|
||||
|
||||
class CGizmo;
|
||||
struct DisplayContext;
|
||||
struct HitContext;
|
||||
|
||||
/** GizmoManager manages set of currently active Gizmo objects.
|
||||
*/
|
||||
struct IGizmoManager
|
||||
{
|
||||
virtual ~IGizmoManager() = default;
|
||||
|
||||
virtual void AddGizmo(CGizmo* gizmo) = 0;
|
||||
virtual void RemoveGizmo(CGizmo* gizmo) = 0;
|
||||
|
||||
virtual int GetGizmoCount() const = 0;
|
||||
virtual CGizmo* GetGizmoByIndex(int nIndex) const = 0;
|
||||
|
||||
virtual void Display(DisplayContext& dc) = 0;
|
||||
virtual bool HitTest(HitContext& hc) = 0;
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_INCLUDE_IGIZMOMANAGER_H
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_INCLUDE_IICONMANAGER_H
|
||||
#define CRYINCLUDE_EDITOR_INCLUDE_IICONMANAGER_H
|
||||
#pragma once
|
||||
|
||||
struct IStatObj;
|
||||
struct IMaterial;
|
||||
class CBitmap;
|
||||
|
||||
// Note: values are used as array indices
|
||||
enum EStatObject
|
||||
{
|
||||
eStatObject_Arrow = 0,
|
||||
eStatObject_Axis,
|
||||
eStatObject_Sphere,
|
||||
eStatObject_Anchor,
|
||||
eStatObject_Entrance,
|
||||
eStatObject_HidePoint,
|
||||
eStatObject_HidePointSecondary,
|
||||
eStatObject_ReinforcementSpot,
|
||||
|
||||
eStatObject_COUNT
|
||||
};
|
||||
|
||||
// Note: values are used as array indices
|
||||
enum EIcon
|
||||
{
|
||||
eIcon_ScaleWarning = 0,
|
||||
eIcon_RotationWarning,
|
||||
|
||||
eIcon_COUNT
|
||||
};
|
||||
|
||||
// Note: image effects to apply to image
|
||||
enum EIconEffect
|
||||
{
|
||||
eIconEffect_Dim = 1 << 0,
|
||||
eIconEffect_HalfAlpha = 1 << 1,
|
||||
eIconEffect_TintRed = 1 << 2,
|
||||
eIconEffect_TintGreen = 1 << 3,
|
||||
eIconEffect_TintYellow = 1 << 4,
|
||||
eIconEffect_ColorEnabled = 1 << 5,
|
||||
eIconEffect_ColorDisabled = 1 << 6,
|
||||
};
|
||||
|
||||
struct IIconManager
|
||||
{
|
||||
virtual ~IIconManager() = default;
|
||||
virtual IStatObj* GetObject(EStatObject object) = 0;
|
||||
virtual int GetIconTexture(EIcon icon) = 0;
|
||||
virtual int GetIconTexture(const char* iconName) = 0;
|
||||
virtual QImage* GetIconBitmap(const char* filename, bool& haveAlpha, uint32 effects = 0) = 0;
|
||||
// Register an Icon for the specific command
|
||||
virtual void RegisterCommandIcon([[maybe_unused]] const char* filename, [[maybe_unused]] int nCommandId) {}
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_INCLUDE_IICONMANAGER_H
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
#ifndef CRYINCLUDE_EDITOR_INCLUDE_IIMAGEUTIL_H
|
||||
#define CRYINCLUDE_EDITOR_INCLUDE_IIMAGEUTIL_H
|
||||
#pragma once
|
||||
|
||||
#include "Util/Image.h"
|
||||
class CAlphaBitmap;
|
||||
|
||||
struct IImageUtil
|
||||
{
|
||||
virtual ~IImageUtil() = default;
|
||||
|
||||
//! Load image, detect image type by file extension.
|
||||
// Arguments:
|
||||
// pQualityLoss - 0 if info is not needed, pointer to the result otherwise - not need to preinitialize
|
||||
virtual bool LoadImage(const QString& fileName, CImageEx& image, bool* pQualityLoss = 0) = 0;
|
||||
|
||||
//! Save image, detect image type by file extension.
|
||||
virtual bool SaveImage(const QString& fileName, CImageEx& image) = 0;
|
||||
|
||||
// General image fucntions
|
||||
virtual bool LoadJPEG(const QString& strFileName, CImageEx& image) = 0;
|
||||
|
||||
virtual bool SaveJPEG(const QString& strFileName, CImageEx& image) = 0;
|
||||
|
||||
virtual bool SaveBitmap(const QString& szFileName, CImageEx& image) = 0;
|
||||
|
||||
virtual bool LoadBmp(const QString& file, CImageEx& image) = 0;
|
||||
|
||||
virtual bool SavePGM(const QString& fileName, const CImageEx& image) = 0;
|
||||
|
||||
virtual bool LoadPGM(const QString& fileName, CImageEx& image) = 0;
|
||||
|
||||
//! Scale source image to fit size of target image.
|
||||
virtual void ScaleToFit(const CByteImage& srcImage, CByteImage& trgImage) = 0;
|
||||
|
||||
//! Scale source image to fit size of target image.
|
||||
virtual void ScaleToFit(const CImageEx& srcImage, CImageEx& trgImage) = 0;
|
||||
|
||||
//! Scale source image to fit twice side by side in target image.
|
||||
virtual void ScaleToDoubleFit(const CImageEx& srcImage, CImageEx& trgImage) = 0;
|
||||
|
||||
//! Scale source image twice down image with filering
|
||||
enum _EAddrMode
|
||||
{
|
||||
WRAP, CLAMP
|
||||
};
|
||||
virtual void DownScaleSquareTextureTwice(const CImageEx& srcImage, CImageEx& trgImage, _EAddrMode eAddressingMode = WRAP) = 0;
|
||||
|
||||
//! Smooth image.
|
||||
virtual void SmoothImage(CByteImage& image, int numSteps) = 0;
|
||||
|
||||
//! behavior outside of the texture is not defined
|
||||
//! \param iniX in fix point 24.8
|
||||
//! \param iniY in fix point 24.8
|
||||
//! \return 0..255
|
||||
virtual unsigned char GetBilinearFilteredAt(const int iniX256, const int iniY256, const CByteImage& image) = 0;
|
||||
};
|
||||
#endif // CRYINCLUDE_EDITOR_INCLUDE_IIMAGEUTIL_H
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_INCLUDE_IKEYTIMESET_H
|
||||
#define CRYINCLUDE_EDITOR_INCLUDE_IKEYTIMESET_H
|
||||
#pragma once
|
||||
|
||||
|
||||
class IKeyTimeSet
|
||||
{
|
||||
public:
|
||||
virtual int GetKeyTimeCount() const = 0;
|
||||
virtual float GetKeyTime(int index) const = 0;
|
||||
virtual void MoveKeyTimes(int numChanges, int* indices, float scale, float offset, bool copyKeys) = 0;
|
||||
virtual bool GetKeyTimeSelected(int index) const = 0;
|
||||
virtual void SetKeyTimeSelected(int index, bool selected) = 0;
|
||||
virtual int GetKeyCount(int index) const = 0;
|
||||
virtual int GetKeyCountBound() const = 0;
|
||||
virtual void BeginEdittingKeyTimes() = 0;
|
||||
virtual void EndEdittingKeyTimes() = 0;
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_INCLUDE_IKEYTIMESET_H
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
#ifndef CRYINCLUDE_EDITORCORE_INCLUDE_ILOGFILE_H
|
||||
#define CRYINCLUDE_EDITORCORE_INCLUDE_ILOGFILE_H
|
||||
|
||||
#pragma once
|
||||
|
||||
struct ILogFile
|
||||
{
|
||||
virtual ~ILogFile() = default;
|
||||
|
||||
virtual const char* GetLogFileName() = 0;
|
||||
|
||||
//! Write to log spanpshot of current process memory usage.
|
||||
virtual QString GetMemUsage() = 0;
|
||||
|
||||
virtual void WriteString(const char* pszString) = 0;
|
||||
virtual void WriteLine(const char* pszLine) = 0;
|
||||
virtual void FormatLine(const char* pszMessage, ...) = 0;
|
||||
|
||||
// logs some useful information
|
||||
// should be called after CryLog() is available
|
||||
virtual void AboutSystem() = 0;
|
||||
|
||||
virtual void Warning(const char* format, ...) = 0;
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITORCORE_INCLUDE_ILOGFILE_H
|
||||
@@ -0,0 +1,278 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_INCLUDE_IOBJECTMANAGER_H
|
||||
#define CRYINCLUDE_EDITOR_INCLUDE_IOBJECTMANAGER_H
|
||||
#pragma once
|
||||
|
||||
// forward declarations.
|
||||
class CEntityObject;
|
||||
struct DisplayContext;
|
||||
struct IGizmoManager;
|
||||
class CTrackViewAnimNode;
|
||||
class CUsedResources;
|
||||
class CSelectionGroup;
|
||||
class CObjectClassDesc;
|
||||
class CObjectArchive;
|
||||
class CViewport;
|
||||
struct HitContext;
|
||||
enum class ImageRotationDegrees;
|
||||
struct IStatObj;
|
||||
|
||||
#include "ObjectEvent.h"
|
||||
|
||||
enum SerializeFlags
|
||||
{
|
||||
SERIALIZE_ALL = 0,
|
||||
SERIALIZE_ONLY_SHARED = 1,
|
||||
SERIALIZE_ONLY_NOTSHARED = 2,
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
typedef std::vector<CBaseObject*> CBaseObjectsArray;
|
||||
typedef std::pair< bool(CALLBACK*)(CBaseObject const&, void*), void* > BaseObjectFilterFunctor;
|
||||
|
||||
struct IObjectSelectCallback
|
||||
{
|
||||
//! Called when object is selected.
|
||||
//! Return true if selection should proceed, or false to abort object selection.
|
||||
virtual bool OnSelectObject(CBaseObject* obj) = 0;
|
||||
//! Return true if object can be selected.
|
||||
virtual bool CanSelectObject(CBaseObject* obj) = 0;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Interface to access editor objects scene graph.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
struct IObjectManager
|
||||
{
|
||||
public:
|
||||
virtual ~IObjectManager() = default;
|
||||
|
||||
//! This callback will be called on response to object event.
|
||||
struct EventListener
|
||||
{
|
||||
virtual void OnObjectEvent(CBaseObject*, int) = 0;
|
||||
};
|
||||
|
||||
virtual CBaseObject* NewObject(CObjectClassDesc* cls, CBaseObject* prev = 0, const QString& file = "", const char* newObjectName = nullptr) = 0;
|
||||
virtual CBaseObject* NewObject(const QString& typeName, CBaseObject* prev = 0, const QString& file = "", const char* newObjectName = nullptr) = 0;
|
||||
virtual CBaseObject* NewObject(CObjectArchive& archive, CBaseObject* pUndoObject = 0, bool bMakeNewId = false) = 0;
|
||||
|
||||
virtual void DeleteObject(CBaseObject* obj) = 0;
|
||||
virtual void DeleteSelection(CSelectionGroup* pSelection) = 0;
|
||||
virtual void DeleteAllObjects() = 0;
|
||||
virtual CBaseObject* CloneObject(CBaseObject* obj) = 0;
|
||||
|
||||
virtual void BeginEditParams(CBaseObject* obj, int flags) = 0;
|
||||
virtual void EndEditParams(int flags = 0) = 0;
|
||||
|
||||
//! Get number of objects manager by ObjectManager (not contain sub objects of groups).
|
||||
virtual int GetObjectCount() const = 0;
|
||||
|
||||
//! Get array of objects, managed by manager (not contain sub objects of groups).
|
||||
//! @param layer if 0 get objects for all layers, or layer to get objects from.
|
||||
virtual void GetObjects(CBaseObjectsArray& objects) const = 0;
|
||||
virtual void GetObjects(DynArray<CBaseObject*>& objects) const = 0;
|
||||
|
||||
//! Get array of objects that pass the filter.
|
||||
//! @param filter The filter functor, return true if you want to get the certain obj, return false if want to skip it.
|
||||
virtual void GetObjects(CBaseObjectsArray& objects, BaseObjectFilterFunctor const& filter) const = 0;
|
||||
|
||||
//! Display objects on specified display context.
|
||||
virtual void Display(DisplayContext& dc) = 0;
|
||||
|
||||
//! Called when selecting without selection helpers - this is needed since
|
||||
//! the visible object cache is normally not updated when not displaying helpers.
|
||||
virtual void ForceUpdateVisibleObjectCache(DisplayContext& dc) = 0;
|
||||
|
||||
//! Check intersection with objects.
|
||||
//! Find intersection with nearest to ray origin object hit by ray.
|
||||
//! If distance tollerance is specified certain relaxation applied on collision test.
|
||||
//! @return true if hit any object, and fills hitInfo structure.
|
||||
virtual bool HitTest(HitContext& hitInfo) = 0;
|
||||
|
||||
//! Check intersection with an object.
|
||||
//! @return true if hit, and fills hitInfo structure.
|
||||
virtual bool HitTestObject(CBaseObject* obj, HitContext& hc) = 0;
|
||||
|
||||
//! Gets a radius to be used for hit tests on the axis helpers, like the transform gizmo.
|
||||
//! @return the axis helper hit radius.
|
||||
virtual int GetAxisHelperHitRadius() const = 0;
|
||||
|
||||
//! Send event to all objects.
|
||||
//! Will cause OnEvent handler to be called on all objects.
|
||||
virtual void SendEvent(ObjectEvent event) = 0;
|
||||
|
||||
//! Send event to all objects within given bounding box.
|
||||
//! Will cause OnEvent handler to be called on objects within bounding box.
|
||||
virtual void SendEvent(ObjectEvent event, const AABB& bounds) = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Find object by ID.
|
||||
virtual CBaseObject* FindObject(REFGUID guid) const = 0;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Find object by name.
|
||||
virtual CBaseObject* FindObject(const QString& sName) const = 0;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Find objects of given type.
|
||||
virtual void FindObjectsOfType(const QMetaObject* pClass, std::vector<CBaseObject*>& result) = 0;
|
||||
virtual void FindObjectsOfType(ObjectType type, std::vector<CBaseObject*>& result) = 0;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Find objects which intersect with a given AABB.
|
||||
virtual void FindObjectsInAABB(const AABB& aabb, std::vector<CBaseObject*>& result) const = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Operations on objects.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Makes object visible or invisible.
|
||||
virtual void HideObject(CBaseObject* obj, bool hide) = 0;
|
||||
//! Shows the last hidden object based on hidden ID
|
||||
virtual void ShowLastHiddenObject() = 0;
|
||||
//! Freeze object, making it unselectable.
|
||||
virtual void FreezeObject(CBaseObject* obj, bool freeze) = 0;
|
||||
//! Unhide all hidden objects.
|
||||
virtual void UnhideAll() = 0;
|
||||
//! Unfreeze all frozen objects.
|
||||
virtual void UnfreezeAll() = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Object Selection.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
virtual bool SelectObject(CBaseObject* obj, bool bUseMask = true) = 0;
|
||||
virtual void UnselectObject(CBaseObject* obj) = 0;
|
||||
|
||||
//! Select objects within specified distance from given position.
|
||||
//! Return number of selected objects.
|
||||
virtual int SelectObjects(const AABB& box, bool bUnselect = false) = 0;
|
||||
|
||||
virtual void SelectEntities(std::set<CEntityObject*>& s) = 0;
|
||||
|
||||
virtual int MoveObjects(const AABB& box, const Vec3& offset, ImageRotationDegrees rotation, bool bIsCopy = false) = 0;
|
||||
|
||||
//! Selects/Unselects all objects within 2d rectangle in given viewport.
|
||||
virtual void SelectObjectsInRect(CViewport* view, const QRect& rect, bool bSelect) = 0;
|
||||
virtual void FindObjectsInRect(CViewport* view, const QRect& rect, std::vector<GUID>& guids) = 0;
|
||||
|
||||
//! Clear default selection set.
|
||||
//! @Return number of objects removed from selection.
|
||||
virtual int ClearSelection() = 0;
|
||||
|
||||
//! Deselect all current selected objects and selects object that were unselected.
|
||||
//! @Return number of selected objects.
|
||||
virtual int InvertSelection() = 0;
|
||||
|
||||
//! Get current selection.
|
||||
virtual CSelectionGroup* GetSelection() const = 0;
|
||||
//! Get named selection.
|
||||
virtual CSelectionGroup* GetSelection(const QString& name) const = 0;
|
||||
// Get selection group names
|
||||
virtual void GetNameSelectionStrings(QStringList& names) = 0;
|
||||
//! Change name of current selection group.
|
||||
//! And store it in list.
|
||||
virtual void NameSelection(const QString& name) = 0;
|
||||
//! Set one of name selections as current selection.
|
||||
virtual void SetSelection(const QString& name) = 0;
|
||||
//! Removes one of named selections.
|
||||
virtual void RemoveSelection(const QString& name) = 0;
|
||||
|
||||
//! Delete all objects in current selection group.
|
||||
virtual void DeleteSelection() = 0;
|
||||
|
||||
//! Generates uniq name base on type name of object.
|
||||
virtual QString GenerateUniqueObjectName(const QString& typeName) = 0;
|
||||
//! Register object name in object manager, needed for generating uniq names.
|
||||
virtual void RegisterObjectName(const QString& name) = 0;
|
||||
//! Enable/Disable generating of unique object names (Enabled by default).
|
||||
//! Return previous value.
|
||||
virtual bool EnableUniqObjectNames(bool bEnable) = 0;
|
||||
|
||||
//! Find object class by name.
|
||||
virtual CObjectClassDesc* FindClass(const QString& className) = 0;
|
||||
virtual void GetClassCategories(QStringList& categories) = 0;
|
||||
virtual void GetClassCategoryToolClassNamePairs(std::vector< std::pair<QString, QString> >& categoryToolClassNamePairs) = 0;
|
||||
virtual void GetClassTypes(const QString& category, QStringList& types) = 0;
|
||||
|
||||
//! Export objects to xml.
|
||||
//! When onlyShared is true ony objects with shared flags exported, overwise only not shared object exported.
|
||||
virtual void Export(const QString& levelPath, XmlNodeRef& rootNode, bool onlyShared) = 0;
|
||||
//! Export only entities to xml.
|
||||
virtual void ExportEntities(XmlNodeRef& rootNode) = 0;
|
||||
|
||||
//! Serialize Objects in manager to specified XML Node.
|
||||
//! @param flags Can be one of SerializeFlags.
|
||||
virtual void Serialize(XmlNodeRef& rootNode, bool bLoading, int flags = SERIALIZE_ALL) = 0;
|
||||
virtual void SerializeNameSelection(XmlNodeRef& rootNode, bool bLoading) = 0;
|
||||
|
||||
//! Load objects from object archive.
|
||||
//! @param bSelect if set newly loaded object will be selected.
|
||||
virtual void LoadObjects(CObjectArchive& ar, bool bSelect) = 0;
|
||||
|
||||
virtual void ChangeObjectId(REFGUID oldId, REFGUID newId) = 0;
|
||||
virtual bool IsDuplicateObjectName(const QString& newName) const = 0;
|
||||
virtual void ShowDuplicationMsgWarning(CBaseObject* obj, const QString& newName, bool bShowMsgBox) const = 0;
|
||||
virtual void ChangeObjectName(CBaseObject* obj, const QString& newName) = 0;
|
||||
|
||||
//! while loading PreFabs we need to force this IDs
|
||||
//! to force always the same IDs, on each load.
|
||||
//! needed for RAM-maps assignments
|
||||
virtual uint32 ForceID() const = 0;
|
||||
virtual void ForceID(uint32 FID) = 0;
|
||||
|
||||
//! Convert object of one type to object of another type.
|
||||
//! Original object is deleted.
|
||||
virtual bool ConvertToType(CBaseObject* pObject, const QString& typeName) = 0;
|
||||
|
||||
//! Set new selection callback.
|
||||
//! @return previous selection callback.
|
||||
virtual IObjectSelectCallback* SetSelectCallback(IObjectSelectCallback* callback) = 0;
|
||||
|
||||
// Enables/Disables creating of game objects.
|
||||
virtual void SetCreateGameObject(bool enable) = 0;
|
||||
//! Return true if objects loaded from xml should immidiatly create game objects associated with them.
|
||||
virtual bool IsCreateGameObjects() const = 0;
|
||||
|
||||
virtual IGizmoManager* GetGizmoManager() = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Invalidate visibily settings of objects.
|
||||
virtual void InvalidateVisibleList() = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// ObjectManager notification Callbacks.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
virtual void AddObjectEventListener(EventListener* listener) = 0;
|
||||
virtual void RemoveObjectEventListener(EventListener* listener) = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Used to indicate starting and ending of objects loading.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
virtual void StartObjectsLoading(int numObjects) = 0;
|
||||
virtual void EndObjectsLoading() = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Gathers all resources used by all objects.
|
||||
virtual void GatherUsedResources(CUsedResources& resources) = 0;
|
||||
|
||||
virtual bool IsLightClass(CBaseObject* pObject) = 0;
|
||||
|
||||
virtual void FindAndRenameProperty2(const char* property2Name, const QString& oldValue, const QString& newValue) = 0;
|
||||
virtual void FindAndRenameProperty2If(const char* property2Name, const QString& oldValue, const QString& newValue, const char* otherProperty2Name, const QString& otherValue) = 0;
|
||||
|
||||
virtual bool IsReloading() const = 0;
|
||||
|
||||
// Set bSkipUpdate to true if you want to skip update objects on the idle loop.
|
||||
virtual void SetSkipUpdate(bool bSkipUpdate) = 0;
|
||||
|
||||
virtual void SetExportingLevel(bool bExporting) = 0;
|
||||
virtual bool IsExportingLevelInprogress() const = 0;
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_INCLUDE_IOBJECTMANAGER_H
|
||||
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
// Description : To add plug-in to the Editor create a new DLL with class implementation derived from IPlugin
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_INCLUDE_IPLUGIN_H
|
||||
#define CRYINCLUDE_EDITOR_INCLUDE_IPLUGIN_H
|
||||
#pragma once
|
||||
|
||||
#include <IEditor.h>
|
||||
|
||||
// forbid plugins from loading across debug and release:
|
||||
|
||||
#define SANDBOX_PLUGIN_SYSTEM_BASE_VERSION 1
|
||||
|
||||
#if defined(_DEBUG)
|
||||
#define SANDBOX_PLUGIN_SYSTEM_VERSION (100000 + SANDBOX_PLUGIN_SYSTEM_BASE_VERSION)
|
||||
#else
|
||||
#define SANDBOX_PLUGIN_SYSTEM_VERSION SANDBOX_PLUGIN_SYSTEM_BASE_VERSION
|
||||
#endif
|
||||
|
||||
// Interface for instantiating the plugin for the editor
|
||||
struct IPlugin
|
||||
{
|
||||
enum EError
|
||||
{
|
||||
eError_None = 0,
|
||||
eError_VersionMismatch = 1
|
||||
};
|
||||
|
||||
virtual ~IPlugin() = default;
|
||||
|
||||
// Releases plugin.
|
||||
virtual void Release() = 0;
|
||||
//! Show a modal about dialog / message box for the plugin
|
||||
virtual void ShowAbout() = 0;
|
||||
//! Return the GUID of the plugin
|
||||
virtual const char* GetPluginGUID() = 0;
|
||||
virtual DWORD GetPluginVersion() = 0;
|
||||
//! Return the human readable name of the plugin
|
||||
virtual const char* GetPluginName() = 0;
|
||||
//! Asks if the plugin can exit now. This might involve asking the user if he wants to save
|
||||
//! data. The plugin is only supposed to ask for unsaved data which is not serialize into
|
||||
//! the editor project file. When data is modified which is saved into the project file, the
|
||||
//! plugin should call IEditor::SetDataModified() to make the editor ask
|
||||
virtual bool CanExitNow() = 0;
|
||||
//! this method is called when there is an event triggered inside the editor
|
||||
virtual void OnEditorNotify(EEditorNotifyEvent aEventId) = 0;
|
||||
};
|
||||
|
||||
// Initialization structure
|
||||
struct PLUGIN_INIT_PARAM
|
||||
{
|
||||
IEditor* pIEditorInterface;
|
||||
int pluginVersion;
|
||||
IPlugin::EError outErrorCode;
|
||||
};
|
||||
|
||||
// Plugin Settings structure
|
||||
struct SPluginSettings
|
||||
{
|
||||
// note: the pluginVersion in PLUGIN_INIT_PARAM denotes the version of the plugin manager
|
||||
// whereas this denotes the version of the individual plugin.
|
||||
// future: manage plugin versions.
|
||||
int pluginVersion;
|
||||
bool autoLoad;
|
||||
};
|
||||
|
||||
// Factory API
|
||||
extern "C"
|
||||
{
|
||||
PLUGIN_API IPlugin* CreatePluginInstance(PLUGIN_INIT_PARAM* pInitParam);
|
||||
PLUGIN_API void QueryPluginSettings(SPluginSettings& settings);
|
||||
}
|
||||
#endif // CRYINCLUDE_EDITOR_INCLUDE_IPLUGIN_H
|
||||
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
// Description : Custom preference page interfaces
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_INCLUDE_IPREFERENCESPAGE_H
|
||||
#define CRYINCLUDE_EDITOR_INCLUDE_IPREFERENCESPAGE_H
|
||||
#pragma once
|
||||
#include "Plugin.h"
|
||||
#include <AzCore/RTTI/RTTI.h>
|
||||
|
||||
//! The interface class for preferences pages.
|
||||
struct IPreferencesPage
|
||||
{
|
||||
AZ_RTTI(IPreferencesPage, "{DEB112AD-55AD-4407-8482-BDA095A64752}")
|
||||
|
||||
//! Return category where this preferences page belongs.
|
||||
virtual const char* GetCategory() = 0;
|
||||
//! Title of this preferences page.
|
||||
virtual const char* GetTitle() = 0;
|
||||
//! Return the icon for this page.
|
||||
virtual QIcon& GetIcon() = 0;
|
||||
//! Called by the editor when the Apply Now button is clicked.
|
||||
virtual void OnApply() = 0;
|
||||
//! Called by the editor when the Cancel button is clicked.
|
||||
virtual void OnCancel() = 0;
|
||||
//! Called by the editor when the Cancel button is clicked, and before the cancel has taken place.
|
||||
//! @return true to perform Cancel operation, false to abort Cancel.
|
||||
virtual bool OnQueryCancel() = 0;
|
||||
//! Called by the editor when the preferences page is made the active page or is not longer the active page.
|
||||
//! @param bActive true when page become active, false when page deactivated.
|
||||
};
|
||||
|
||||
//! Interface used to create new preferences pages.
|
||||
//! You can query this interface from any IClassDesc interface with ESYSTEM_CLASS_PREFERENCE_PAGE system class Id.
|
||||
struct IPreferencesPageCreator
|
||||
{
|
||||
DEFINE_UUID(0xD494113C, 0xBF13, 0x4171, 0x91, 0x71, 0x03, 0x33, 0xDF, 0x10, 0xEA, 0xFC)
|
||||
|
||||
//! Get number of preferences page hosted by this class.
|
||||
virtual int GetPagesCount() = 0;
|
||||
//! Creates a new preferences page by page index.
|
||||
//! @param index must be within 0 <= index < GetPagesCount().
|
||||
virtual IPreferencesPage* CreateEditorPreferencesPage(int index) = 0;
|
||||
};
|
||||
|
||||
//! A plugin class description for all IPreferencesPage derived classes.
|
||||
struct IPreferencesPageClassDesc
|
||||
: public IClassDesc
|
||||
{
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// IClassDesc implementation.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
virtual ESystemClassID SystemClassID() { return ESYSTEM_CLASS_PREFERENCE_PAGE; };
|
||||
//! This method returns the human readable name of the class.
|
||||
virtual QString ClassName() { return "Preferences Page"; };
|
||||
//! This method returns Category of this class,
|
||||
//! Category is specifying where this plugin class fits best in the create panel.
|
||||
virtual QString Category() { return "Preferences"; };
|
||||
//! Show a modal about dialog / message box for the plugin.
|
||||
virtual void ShowAbout() {};
|
||||
virtual bool CanExitNow() { return true; };
|
||||
//! The plugin should write / read its data to the passed stream. The data is saved to or loaded
|
||||
//! from the editor project file. This function is called during the usual save / load process of
|
||||
//! the editor's project file
|
||||
virtual void Serialize([[maybe_unused]] CXmlArchive& ar) {};
|
||||
};
|
||||
#endif // CRYINCLUDE_EDITOR_INCLUDE_IPREFERENCESPAGE_H
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
// Description : Interface for rendering custom 3D elements in the main
|
||||
// render viewport. Particularly usefull for debug geometries.
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_INCLUDE_IRENDERLISTENER_H
|
||||
#define CRYINCLUDE_EDITOR_INCLUDE_IRENDERLISTENER_H
|
||||
#pragma once
|
||||
|
||||
|
||||
struct DisplayContext;
|
||||
|
||||
struct IRenderListener
|
||||
: public IUnknown
|
||||
{
|
||||
DEFINE_UUID(0x8D52F857, 0x1027, 0x4346, 0xAC, 0x7B, 0xF6, 0x20, 0xDA, 0x7C, 0xCE, 0x42)
|
||||
|
||||
virtual void Render(DisplayContext& rDisplayContext) = 0;
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_INCLUDE_IRENDERLISTENER_H
|
||||
@@ -0,0 +1,134 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#pragma once
|
||||
// The aim of IResourceSelectorHost is to unify resource selection dialogs in a one
|
||||
// API that can be reused with plugins. It also makes possible to register new
|
||||
// resource selectors dynamically, e.g. inside plugins.
|
||||
//
|
||||
// Here is how new selectors are created. In your implementation file you add handler function:
|
||||
//
|
||||
// #include "IResourceSelectorHost.h"
|
||||
//
|
||||
// QString SoundFileSelector(const SResourceSelectorContext& x, const QString& previousValue)
|
||||
// {
|
||||
// CMyModalDialog dialog(CWnd::FromHandle(x.parentWindow));
|
||||
// ...
|
||||
// return previousValue;
|
||||
// }
|
||||
// REGISTER_RESOURCE_SELECTOR("Sound", SoundFileSelector, "Icons/sound_16x16.png")
|
||||
//
|
||||
// Here is how it can be invoked directly:
|
||||
//
|
||||
// SResourceSelectorContext x;
|
||||
// x.parentWindow = parent.GetSafeHwnd();
|
||||
// x.typeName = "Sound";
|
||||
// string newValue = GetIEditor()->GetResourceSelector()->SelectResource(x, previousValue).c_str();
|
||||
//
|
||||
// If you have your own resource selectors in the plugin you will need to run
|
||||
//
|
||||
// RegisterModuleResourceSelectors(GetIEditor()->GetResourceSelector())
|
||||
//
|
||||
// during plugin initialization.
|
||||
//
|
||||
// If you want to be able to pass some custom context to the selector (e.g. source of the information for the
|
||||
// list of items or something similar) then you can add a poitner argument to your selector function, i.e.:
|
||||
//
|
||||
// QString SoundFileSelector(const SResourceSelectorContext& x, const QString& previousValue,
|
||||
// SoundFileList* list) // your context argument
|
||||
|
||||
#include <QString>
|
||||
|
||||
class QWidget;
|
||||
|
||||
struct SResourceSelectorContext
|
||||
{
|
||||
const char* typeName;
|
||||
|
||||
// use either parentWidget or parentWindow (not both) until everything porting to QWidget.
|
||||
QWidget* parentWidget;
|
||||
|
||||
unsigned int entityId;
|
||||
void* contextObject;
|
||||
|
||||
SResourceSelectorContext()
|
||||
: parentWidget(0)
|
||||
, typeName(0)
|
||||
, entityId(0)
|
||||
, contextObject()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
// TResourceSelecitonFunction is used to declare handlers for specific types.
|
||||
//
|
||||
// For canceled dialogs previousValue should be returned.
|
||||
typedef QString (* TResourceSelectionFunction)(const SResourceSelectorContext& selectorContext, const QString& previousValue);
|
||||
typedef QString (* TResourceSelectionFunctionWithContext)(const SResourceSelectorContext& selectorContext, const QString& previousValue, void* contextObject);
|
||||
|
||||
struct SStaticResourceSelectorEntry;
|
||||
|
||||
// See note at the beginning of the file.
|
||||
struct IResourceSelectorHost
|
||||
{
|
||||
virtual ~IResourceSelectorHost() = default;
|
||||
virtual QString SelectResource(const SResourceSelectorContext& context, const QString& previousValue) = 0;
|
||||
virtual const char* ResourceIconPath(const char* typeName) const = 0;
|
||||
|
||||
virtual void RegisterResourceSelector(const SStaticResourceSelectorEntry* entry) = 0;
|
||||
|
||||
// secondary responsibility of this class is to store global selections
|
||||
virtual void SetGlobalSelection(const char* resourceType, const char* value) = 0;
|
||||
virtual const char* GetGlobalSelection(const char* resourceType) const = 0;
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
#define INTERNAL_RSH_COMBINE_UTIL(A, B) A##B
|
||||
#define INTERNAL_RSH_COMBINE(A, B) INTERNAL_RSH_COMBINE_UTIL(A, B)
|
||||
#define REGISTER_RESOURCE_SELECTOR(name, function, icon) \
|
||||
static SStaticResourceSelectorEntry INTERNAL_RSH_COMBINE(selector_##function, __LINE__)((name), (function), (icon));
|
||||
|
||||
struct SStaticResourceSelectorEntry
|
||||
{
|
||||
const char* typeName;
|
||||
TResourceSelectionFunction function;
|
||||
TResourceSelectionFunctionWithContext functionWithContext;
|
||||
const char* iconPath;
|
||||
|
||||
static SStaticResourceSelectorEntry*& GetFirst() { static SStaticResourceSelectorEntry* first; return first; }
|
||||
SStaticResourceSelectorEntry* next;
|
||||
|
||||
SStaticResourceSelectorEntry(const char* typeName, TResourceSelectionFunction function, const char* icon)
|
||||
: typeName(typeName)
|
||||
, function(function)
|
||||
, functionWithContext()
|
||||
, iconPath(icon)
|
||||
{
|
||||
next = GetFirst();
|
||||
GetFirst() = this;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
SStaticResourceSelectorEntry(const char* typeName, QString (*function)(const SResourceSelectorContext&, const QString& previousValue, T * context), const char* icon)
|
||||
: typeName(typeName)
|
||||
, function()
|
||||
, functionWithContext(TResourceSelectionFunctionWithContext(function))
|
||||
, iconPath(icon)
|
||||
{
|
||||
next = GetFirst();
|
||||
GetFirst() = this;
|
||||
}
|
||||
};
|
||||
|
||||
inline void RegisterModuleResourceSelectors(IResourceSelectorHost* editorResourceSelector)
|
||||
{
|
||||
for (SStaticResourceSelectorEntry* current = SStaticResourceSelectorEntry::GetFirst(); current != 0; current = current->next)
|
||||
{
|
||||
editorResourceSelector->RegisterResourceSelector(current);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <map>
|
||||
|
||||
#include <AzToolsFramework/SourceControl/SourceControlAPI.h>
|
||||
|
||||
#include "IEditorClassFactory.h"
|
||||
|
||||
// Source control status of item.
|
||||
enum ESccFileAttributes
|
||||
{
|
||||
SCC_FILE_ATTRIBUTE_INVALID = 0x0000, // File is not found.
|
||||
SCC_FILE_ATTRIBUTE_NORMAL = 0x0001, // Normal file on disk.
|
||||
SCC_FILE_ATTRIBUTE_READONLY = 0x0002, // Read only files cannot be modified at all, either read only file not under source control or file in packfile.
|
||||
SCC_FILE_ATTRIBUTE_INPAK = 0x0004, // File is inside pack file.
|
||||
SCC_FILE_ATTRIBUTE_MANAGED = 0x0008, // File is managed under source control.
|
||||
SCC_FILE_ATTRIBUTE_CHECKEDOUT = 0x0010, // File is under source control and is checked out.
|
||||
SCC_FILE_ATTRIBUTE_BYANOTHER = 0x0020, // File is under source control and is checked out by another user.
|
||||
SCC_FILE_ATTRIBUTE_FOLDER = 0x0040, // Managed folder.
|
||||
SCC_FILE_ATTRIBUTE_LOCKEDBYANOTHER = 0x0080, // File is under source control and is checked out and locked by another user.
|
||||
SCC_FILE_ATTRIBUTE_NOTATHEAD = 0x0100, // File is under source control and is not the latest version of the file
|
||||
SCC_FILE_ATTRIBUTE_ADD = 0x0200, // File is under source control and is marked for add
|
||||
SCC_FILE_ATTRIBUTE_MOVED = 0x0400, // File is under source control and is marked for move/add
|
||||
};
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Description
|
||||
// This interface provide access to the source control functionality.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
struct ISourceControl
|
||||
: public IUnknown
|
||||
{
|
||||
DEFINE_UUID(0x1D391E8C, 0xA124, 0x46bb, 0x80, 0x8D, 0x9B, 0xCA, 0x15, 0x5B, 0xCA, 0xFD)
|
||||
|
||||
// Source Control State
|
||||
enum ConnectivityState
|
||||
{
|
||||
Connected = 0,
|
||||
BadConfiguration,
|
||||
Disconnected_Retrying,
|
||||
Disconnected,
|
||||
};
|
||||
|
||||
using SourceControlState = AzToolsFramework::SourceControlState;
|
||||
|
||||
//function to enable/disable source control
|
||||
virtual void SetSourceControlState(SourceControlState state) = 0;
|
||||
virtual ConnectivityState GetConnectivityState() = 0;
|
||||
|
||||
// Show settings dialog
|
||||
virtual void ShowSettings() = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// IUnknown
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
virtual HRESULT STDMETHODCALLTYPE QueryInterface([[maybe_unused]] REFIID riid, [[maybe_unused]] void** ppvObject) { return E_NOINTERFACE; };
|
||||
virtual ULONG STDMETHODCALLTYPE AddRef() { return 0; };
|
||||
virtual ULONG STDMETHODCALLTYPE Release() { return 0; };
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
};
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
// Description : Calculate the reference frame for sub-object selections.
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_INCLUDE_ISUBOBJECTSELECTIONREFERENCEFRAMECALCULATOR_H
|
||||
#define CRYINCLUDE_EDITOR_INCLUDE_ISUBOBJECTSELECTIONREFERENCEFRAMECALCULATOR_H
|
||||
#pragma once
|
||||
|
||||
|
||||
class ISubObjectSelectionReferenceFrameCalculator
|
||||
{
|
||||
public:
|
||||
virtual void SetExplicitFrame(bool bAnySelected, const Matrix34& refFrame) = 0;
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_INCLUDE_ISUBOBJECTSELECTIONREFERENCEFRAMECALCULATOR_H
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
// Description : This file declares the interface used by the texture viewer
|
||||
// and (implemented first implemented by the Texture Database Creator) to
|
||||
// syncronize their threads. A thread interace could be useful there.
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_INCLUDE_ITEXTUREDATABASEUPDATER_H
|
||||
#define CRYINCLUDE_EDITOR_INCLUDE_ITEXTUREDATABASEUPDATER_H
|
||||
#pragma once
|
||||
|
||||
|
||||
class CTextureDatabaseItem;
|
||||
|
||||
struct ITextureDatabaseUpdater
|
||||
{
|
||||
public:
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Thread control
|
||||
virtual void NotifyShutDown() = 0;
|
||||
virtual void Lock() = 0;
|
||||
virtual void Unlock() = 0;
|
||||
virtual void WaitForThread() = 0;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Data access
|
||||
virtual CTextureDatabaseItem* GetItem(const char* szAddItem) = 0;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_INCLUDE_ITEXTUREDATABASEUPDATER_H
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_INCLUDE_ITRANSFORMMANIPULATOR_H
|
||||
#define CRYINCLUDE_EDITOR_INCLUDE_ITRANSFORMMANIPULATOR_H
|
||||
#pragma once
|
||||
|
||||
#include "IEditor.h"
|
||||
|
||||
struct IDisplayViewport;
|
||||
struct HitContext;
|
||||
class CViewport;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// ITransformManipulator implementation.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
struct ITransformManipulator
|
||||
{
|
||||
virtual Matrix34 GetTransformation(RefCoordSys coordSys, IDisplayViewport* view = nullptr) const = 0;
|
||||
virtual void SetTransformation(RefCoordSys coordSys, const Matrix34& tm) = 0;
|
||||
virtual bool HitTestManipulator(HitContext& hc) = 0;
|
||||
virtual bool MouseCallback(CViewport* view, EMouseEvent event, QPoint& point, int flags) = 0;
|
||||
virtual void SetAlwaysUseLocal(bool on) = 0;
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_INCLUDE_ITRANSFORMMANIPULATOR_H
|
||||
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_INCLUDE_IVIEWPANE_H
|
||||
#define CRYINCLUDE_EDITOR_INCLUDE_IVIEWPANE_H
|
||||
#pragma once
|
||||
|
||||
#include "IEditorClassFactory.h"
|
||||
|
||||
#include <QSize>
|
||||
|
||||
class QWidget;
|
||||
class QRect;
|
||||
|
||||
struct IViewPaneClass
|
||||
: public IClassDesc
|
||||
{
|
||||
DEFINE_UUID(0x7E13EC7C, 0xF621, 0x4aeb, 0xB6, 0x42, 0x67, 0xD7, 0x8E, 0xD4, 0x68, 0xF8)
|
||||
|
||||
enum EDockingDirection
|
||||
{
|
||||
DOCK_TOP,
|
||||
DOCK_LEFT,
|
||||
DOCK_RIGHT,
|
||||
DOCK_BOTTOM,
|
||||
DOCK_FLOAT,
|
||||
};
|
||||
|
||||
virtual ~IViewPaneClass() = default;
|
||||
|
||||
// Return text for view pane title.
|
||||
virtual QString GetPaneTitle() = 0;
|
||||
|
||||
// Return the string resource ID for the title's text.
|
||||
virtual unsigned int GetPaneTitleID() const = 0;
|
||||
|
||||
// Return preferable initial docking position for pane.
|
||||
virtual EDockingDirection GetDockingDirection() = 0;
|
||||
|
||||
// Initial pane size.
|
||||
virtual QRect GetPaneRect() = 0;
|
||||
|
||||
// Get Minimal view size
|
||||
virtual QSize GetMinSize() { return QSize(0, 0); }
|
||||
|
||||
// Return true if only one pane at a time of time view class can be created.
|
||||
virtual bool SinglePane() = 0;
|
||||
|
||||
// Return true if the view window wants to get ID_IDLE_UPDATE commands.
|
||||
virtual bool WantIdleUpdate() = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// IUnknown
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(const IID& riid, void** ppvObj)
|
||||
{
|
||||
if (riid == __uuidof(IViewPaneClass))
|
||||
{
|
||||
*ppvObj = this;
|
||||
return S_OK;
|
||||
}
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_INCLUDE_IVIEWPANE_H
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_INCLUDE_OBJECTEVENT_H
|
||||
#define CRYINCLUDE_EDITOR_INCLUDE_OBJECTEVENT_H
|
||||
#pragma once
|
||||
|
||||
//! Standart objects types.
|
||||
enum ObjectType
|
||||
{
|
||||
OBJTYPE_DUMMY = 1 << 20,
|
||||
OBJTYPE_AZENTITY = 1 << 21,
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Events that objects may want to handle.
|
||||
//! Passed to OnEvent method of CBaseObject.
|
||||
enum ObjectEvent
|
||||
{
|
||||
EVENT_INGAME = 1, //!< Signals that editor is switching into the game mode.
|
||||
EVENT_OUTOFGAME, //!< Signals that editor is switching out of the game mode.
|
||||
EVENT_REFRESH, //!< Signals that editor is refreshing level.
|
||||
EVENT_DBLCLICK, //!< Signals that object have been double clicked.
|
||||
EVENT_KEEP_HEIGHT, //!< Signals that object must preserve its height over changed terrain.
|
||||
EVENT_RELOAD_ENTITY,//!< Signals that entities scripts must be reloaded.
|
||||
EVENT_RELOAD_GEOM, //!< Signals that all possible geometries should be reloaded.
|
||||
EVENT_UNLOAD_GEOM, //!< Signals that all possible geometries should be unloaded.
|
||||
EVENT_MISSION_CHANGE, //!< Signals that mission have been changed.
|
||||
EVENT_ALIGN_TOGRID, //!< Object should align itself to the grid.
|
||||
|
||||
EVENT_PHYSICS_GETSTATE,//!< Signals that entities should accept their physical state from game.
|
||||
EVENT_PHYSICS_RESETSTATE,//!< Signals that physics state must be reseted on objects.
|
||||
EVENT_PHYSICS_APPLYSTATE,//!< Signals that the stored physics state must be applied to objects.
|
||||
|
||||
EVENT_FREE_GAME_DATA,//!< Object should free game data that its holding.
|
||||
EVENT_CONFIG_SPEC_CHANGE, //!< Called when config spec changed.
|
||||
EVENT_HIDE_HELPER, //!< Signals that happens when Helper mode switches to be hidden.
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_INCLUDE_OBJECTEVENT_H
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
// Description : Main header included by every file in Editor.
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_INCLUDE_SANDBOXAPI_H
|
||||
#define CRYINCLUDE_EDITOR_INCLUDE_SANDBOXAPI_H
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/PlatformDef.h>
|
||||
|
||||
#if defined(SANDBOX_API) || defined(CRYEDIT_API)
|
||||
#error SANDBOX_API and CRYEDIT_API should only be defined in this header. Use SANDBOX_EXPORTS and SANDBOX_IMPROTS to control it.
|
||||
#endif
|
||||
|
||||
#if defined(SANDBOX_IMPORTS) && defined(SANDBOX_EXPORTS)
|
||||
#error SANDBOX_EXPORTS and SANDBOX_IMPORTS can't be defined at the same time
|
||||
#endif
|
||||
|
||||
#if defined(SANDBOX_EXPORTS)
|
||||
// Editor.exe case
|
||||
#define CRYEDIT_API AZ_DLL_EXPORT
|
||||
#define SANDBOX_API AZ_DLL_EXPORT
|
||||
#elif defined(SANDBOX_IMPORTS)
|
||||
// Sandbox plugins that rely on/extend Editor types.
|
||||
#define CRYEDIT_API AZ_DLL_IMPORT
|
||||
#define SANDBOX_API AZ_DLL_IMPORT
|
||||
#else
|
||||
// Standalone plugins that use Editor plugins.
|
||||
#define CRYEDIT_API
|
||||
#define SANDBOX_API
|
||||
#endif
|
||||
#endif // CRYINCLUDE_EDITOR_INCLUDE_SANDBOXAPI_H
|
||||
Reference in New Issue
Block a user