Skip to content

Commit

Permalink
Fix bugs about material summary
Browse files Browse the repository at this point in the history
  • Loading branch information
durswd committed Feb 16, 2024
1 parent 27557dc commit 660ff4b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 11 deletions.
26 changes: 18 additions & 8 deletions Dev/Cpp/EffekseerMaterial/efkMat.Models.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2033,39 +2033,49 @@ bool Material::Save(std::vector<uint8_t>& data, const char* basePath)
// param 2
BinaryWriter bwParam2;

const auto storeSummary = [](BinaryWriter& bw, std::shared_ptr<NodeDescription> node_description)
{
if (node_description != nullptr)
{
bw.Push(GetVectorFromStr(node_description->Summary));
bw.Push(GetVectorFromStr(node_description->Detail));
}
else
{
bw.Push(GetVectorFromStr(""));
bw.Push(GetVectorFromStr(""));
}
};

{
bwParam2.Push(static_cast<int32_t>(CustomData.size()));

for (size_t ci = 0; ci < CustomData.size(); ci++)
{
bwParam2.Push(GetVectorFromStr(CustomData[ci].Description->Summary));
bwParam2.Push(GetVectorFromStr(CustomData[ci].Description->Detail));
storeSummary(bwParam2, CustomData[ci].Description);
}
}

bwParam2.Push(static_cast<int32_t>(result.Textures.size()));

for (size_t i = 0; i < result.Textures.size(); i++)
{
bwParam2.Push(GetVectorFromStr(result.Textures[i]->Description->Summary));
bwParam2.Push(GetVectorFromStr(result.Textures[i]->Description->Detail));
storeSummary(bwParam2, result.Textures[i]->Description);
}

bwParam2.Push(static_cast<int32_t>(result.Uniforms.size()));

for (size_t i = 0; i < result.Uniforms.size(); i++)
{
bwParam2.Push(GetVectorFromStr(result.Uniforms[i]->Description->Summary));
bwParam2.Push(GetVectorFromStr(result.Uniforms[i]->Description->Detail));
storeSummary(bwParam2, result.Uniforms[i]->Description);
}

{
bwParam2.Push(static_cast<int32_t>(result.Gradients.size()));

for (size_t i = 0; i < result.Gradients.size(); i++)
{
bwParam2.Push(GetVectorFromStr(result.Gradients[i]->Description->Summary));
bwParam2.Push(GetVectorFromStr(result.Gradients[i]->Description->Detail));
storeSummary(bwParam2, result.Gradients[i]->Description);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1434,7 +1434,7 @@ void GraphicsDevice::Draw(const Effekseer::Backend::DrawParameter& drawParam)
GLExt::glUseProgram(shader->GetProgram());

// textures
for (int32_t i = 0; i < drawParam.ResourceSlotCount; i++)
for (int32_t i = 0; i < std::min(static_cast<int>(shader->GetTextureLocations().size()), drawParam.ResourceSlotCount); i++)
{
const auto textureSlot = shader->GetTextureLocations()[i];

Expand Down
7 changes: 5 additions & 2 deletions Dev/Editor/EffekseerCore/Utils/MaterialInformation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -233,12 +233,15 @@ void LoadSummaryDescription(MaterialVersion version, BinaryReader reader, out st
descriptions.Add((Language)lang, desc);
}

if (!string.IsNullOrEmpty(summaries[Language.English]))
summary = string.Empty;
description = string.Empty;

if (summaries.ContainsKey(Language.English) && !string.IsNullOrEmpty(summaries[Language.English]))
{
summary = summaries[Language.English];
description = descriptions[Language.English];
}
else
else if (summaries.ContainsKey(Language.Japanese))
{
summary = summaries[Language.Japanese];
description = descriptions[Language.Japanese];
Expand Down

0 comments on commit 660ff4b

Please sign in to comment.