mirror of
https://github.com/antopilo/Nuake.git
synced 2026-09-09 20:08:57 +03:00
Editor improvements
- Can now copy nuake.net dll in debug build - Scrolling outside the viewport wont move the editor cam - Can now double click to to open .sln files - Right arrow now works in file system panel
This commit is contained in:
@@ -2017,6 +2017,14 @@ namespace Nuake {
|
||||
Nuake::ScriptingEngineNet::Get().GenerateSolution(FileSystem::Root, Engine::GetProject()->Name);
|
||||
Nuake::Logger::Log("Generated Solution.");
|
||||
}
|
||||
|
||||
#ifdef NK_DEBUG
|
||||
if (ImGui::MenuItem("Copy Nuake.NET", NULL))
|
||||
{
|
||||
Nuake::ScriptingEngineNet::Get().CopyNuakeNETAssemblies(FileSystem::Root);
|
||||
Nuake::Logger::Log("Copied Nuake.Net Assemblies.");
|
||||
}
|
||||
#endif // NK_DEBUG
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
|
||||
@@ -247,16 +247,23 @@ namespace Nuake
|
||||
if (selected)
|
||||
{
|
||||
if (ImGui::IsMouseDoubleClicked(0))
|
||||
{
|
||||
if (file->GetFileType() == FileType::Map)
|
||||
{
|
||||
switch (file->GetFileType())
|
||||
{
|
||||
OS::OpenTrenchbroomMap(file->GetAbsolutePath());
|
||||
}
|
||||
|
||||
if (file->GetFileType() == FileType::Scene)
|
||||
{
|
||||
shouldOpenScene = true;
|
||||
case FileType::Map:
|
||||
OS::OpenTrenchbroomMap(file->GetAbsolutePath());
|
||||
break;
|
||||
case FileType::NetScript:
|
||||
OS::OpenIn(file->GetAbsolutePath());
|
||||
break;
|
||||
case FileType::Scene:
|
||||
shouldOpenScene = true;
|
||||
break;
|
||||
case FileType::Solution:
|
||||
OS::OpenIn(file->GetAbsolutePath());
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Editor->Selection = EditorSelection(file);
|
||||
@@ -402,9 +409,6 @@ namespace Nuake
|
||||
//}
|
||||
ImGui::PopStyleVar();
|
||||
|
||||
|
||||
|
||||
|
||||
const std::string openSceneId = "Open Scene" + std::string("##") + hoverMenuId;
|
||||
|
||||
|
||||
@@ -632,7 +636,7 @@ namespace Nuake
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger::Log("[FileSystem] Cannot create script files that starts with a number.", "editor", CRITICAL);
|
||||
Logger::Log("Cannot create script files that starts with a number.", "filesystem", CRITICAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -749,7 +753,10 @@ namespace Nuake
|
||||
const auto buttonWidth = cursorEnd - cursorStart;
|
||||
if (ImGui::Button((std::string(ICON_FA_ANGLE_RIGHT)).c_str(), buttonSize))
|
||||
{
|
||||
// TODO
|
||||
if (Editor->Selection.Type == EditorSelectionType::Directory)
|
||||
{
|
||||
m_CurrentDirectory = Editor->Selection.Directory;
|
||||
}
|
||||
}
|
||||
|
||||
const uint32_t numButtonAfterPathBrowser = 2;
|
||||
@@ -808,13 +815,6 @@ namespace Nuake
|
||||
OS::OpenIn(m_CurrentDirectory->FullPath);
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
if (ImGui::Button((std::string(ICON_FA_ELLIPSIS_V)).c_str(), buttonSize))
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
ImGui::PopStyleColor(); // Button color
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
@@ -65,7 +65,8 @@ namespace Nuake
|
||||
Scene,
|
||||
Wad,
|
||||
Map,
|
||||
Assembly
|
||||
Assembly,
|
||||
Solution
|
||||
};
|
||||
|
||||
class File
|
||||
@@ -135,6 +136,10 @@ namespace Nuake
|
||||
{
|
||||
return FileType::NetScript;
|
||||
}
|
||||
if (ext == ".sln")
|
||||
{
|
||||
return FileType::Solution;
|
||||
}
|
||||
|
||||
return FileType::Unkown;
|
||||
}
|
||||
|
||||
@@ -161,27 +161,29 @@ namespace Nuake
|
||||
Right = glm::normalize(glm::cross(Up, Direction));
|
||||
|
||||
|
||||
if (Input::IsMouseButtonDown(2))
|
||||
if (controlled)
|
||||
{
|
||||
Vector3 movement = Vector3(0);
|
||||
const float deltaX = x - mouseLastX;
|
||||
const float deltaY = y - mouseLastY;
|
||||
movement += Right * (deltaX * ts);
|
||||
movement += Up * (deltaY * ts);
|
||||
Translation += Vector3(movement) * 0.5f;
|
||||
if (Input::IsMouseButtonDown(2))
|
||||
{
|
||||
Vector3 movement = Vector3(0);
|
||||
const float deltaX = x - mouseLastX;
|
||||
const float deltaY = y - mouseLastY;
|
||||
movement += Right * (deltaX * ts);
|
||||
movement += Up * (deltaY * ts);
|
||||
Translation += Vector3(movement) * 0.5f;
|
||||
|
||||
mouseLastX = x;
|
||||
mouseLastY = y;
|
||||
controlled = true;
|
||||
mouseLastX = x;
|
||||
mouseLastY = y;
|
||||
controlled = true;
|
||||
|
||||
SetDirection(glm::normalize(Direction));
|
||||
SetDirection(glm::normalize(Direction));
|
||||
}
|
||||
else if (Input::YScroll != 0)
|
||||
{
|
||||
Translation += Vector3(Direction) * Input::YScroll;
|
||||
Input::YScroll = 0.0f;
|
||||
}
|
||||
}
|
||||
else if (Input::YScroll != 0)
|
||||
{
|
||||
Translation += Vector3(Direction) * Input::YScroll;
|
||||
Input::YScroll = 0.0f;
|
||||
}
|
||||
|
||||
|
||||
SetDirection(glm::normalize(Direction));
|
||||
|
||||
|
||||
@@ -216,7 +216,7 @@ namespace Nuake
|
||||
return m_EntityToManagedObjects.find(entity.GetID()) != m_EntityToManagedObjects.end();
|
||||
}
|
||||
|
||||
void ScriptingEngineNet::GenerateSolution(const std::string& path, const std::string& projectName)
|
||||
void ScriptingEngineNet::CopyNuakeNETAssemblies(const std::string& path)
|
||||
{
|
||||
// Create .Net directory in projects folder.
|
||||
const auto netDirectionPath = '/' + m_NetDirectory + '/';
|
||||
@@ -236,6 +236,11 @@ namespace Nuake
|
||||
{
|
||||
std::filesystem::copy_file(fileToCopy, netDir + fileToCopy, std::filesystem::copy_options::overwrite_existing);
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptingEngineNet::GenerateSolution(const std::string& path, const std::string& projectName)
|
||||
{
|
||||
CopyNuakeNETAssemblies(path);
|
||||
|
||||
// Generate premake5 templates
|
||||
// ----------------------------------------
|
||||
|
||||
@@ -55,6 +55,7 @@ namespace Nuake {
|
||||
Coral::ManagedObject GetEntityScript(const Entity& entity);
|
||||
bool HasEntityScriptInstance(const Entity& entity);
|
||||
|
||||
void CopyNuakeNETAssemblies(const std::string& path);
|
||||
void GenerateSolution(const std::string& path, const std::string& projectName);
|
||||
void CreateEntityScript(const std::string& path, const std::string& entityName);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user