mirror of
https://github.com/antopilo/Nuake.git
synced 2026-09-15 20:08:54 +03:00
Drag & drop of .material files
This commit is contained in:
@@ -43,6 +43,7 @@ void MaterialEditor::Draw(Ref<Nuake::Material> material)
|
||||
ImGui::TableSetupColumn("name", 0, 0.3f);
|
||||
ImGui::TableSetupColumn("set", 0, 0.6f);
|
||||
ImGui::TableSetupColumn("reset", 0, 0.1f);
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
ImGui::Text("Unlit");
|
||||
@@ -51,6 +52,15 @@ void MaterialEditor::Draw(Ref<Nuake::Material> material)
|
||||
bool unlit = material->data.u_Unlit == 1;
|
||||
ImGui::Checkbox("Unlit", &unlit);
|
||||
material->data.u_Unlit = (int)unlit;
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
ImGui::Text("Emissive");
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
ImGui::DragFloat("##Emissiveness", &material->data.u_Emissive, 0.1f, 1.0f);
|
||||
ImGui::TableNextColumn();
|
||||
}
|
||||
ImGui::EndTable();
|
||||
}
|
||||
@@ -62,7 +72,7 @@ void MaterialEditor::Draw(Ref<Nuake::Material> material)
|
||||
UIFont boldfont = UIFont(Fonts::Bold);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0.f, 0.f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0.f, 8.f));
|
||||
AlbedoOpened = ImGui::CollapsingHeader("Albedo", ImGuiTreeNodeFlags_DefaultOpen);
|
||||
AlbedoOpened = ImGui::CollapsingHeader(" ALBEDO", ImGuiTreeNodeFlags_DefaultOpen);
|
||||
ImGui::PopStyleVar(2);
|
||||
}
|
||||
|
||||
|
||||
@@ -163,7 +163,8 @@ void EditorSelectionPanel::DrawFile(Ref<Nuake::File> file)
|
||||
using namespace Nuake;
|
||||
if (file->GetExtension() == ".material")
|
||||
{
|
||||
DrawMaterialPanel(std::static_pointer_cast<Material>(selectedResource));
|
||||
MaterialEditor matEditor;
|
||||
matEditor.Draw(std::static_pointer_cast<Material>(selectedResource));
|
||||
}
|
||||
if (file->GetExtension() == ".project")
|
||||
{
|
||||
|
||||
@@ -232,6 +232,10 @@ namespace Nuake
|
||||
{
|
||||
dragType = "_Map";
|
||||
}
|
||||
else if (fileExtension == ".material")
|
||||
{
|
||||
dragType = "_Material";
|
||||
}
|
||||
else if (fileExtension == ".obj" || fileExtension == ".mdl" || fileExtension == ".gltf" || fileExtension == ".md3" || fileExtension == ".fbx" || fileExtension == ".glb")
|
||||
{
|
||||
dragType = "_Model";
|
||||
@@ -444,14 +448,15 @@ namespace Nuake
|
||||
{
|
||||
if (ImGui::MenuItem("Material"))
|
||||
{
|
||||
std::string path = FileDialog::SaveFile("*.material");
|
||||
if (!String::EndsWith(path, ".material"))
|
||||
{
|
||||
path += ".material";
|
||||
}
|
||||
|
||||
const std::string path = FileDialog::SaveFile("*.material");
|
||||
if (!path.empty())
|
||||
{
|
||||
std::string finalPath = path;
|
||||
if (!String::EndsWith(path, ".material"))
|
||||
{
|
||||
finalPath = path + ".material";
|
||||
}
|
||||
|
||||
Ref<Material> material = CreateRef<Material>();
|
||||
material->IsEmbedded = false;
|
||||
auto jsonData = material->Serialize();
|
||||
|
||||
Reference in New Issue
Block a user