multiple files can be open at the same time
This commit is contained in:
@@ -38,9 +38,18 @@ std::unique_ptr<Node> GraphSerializer::CreateNode(const std::string& type,
|
||||
if (type == "Pow") return std::make_unique<PowNode>();
|
||||
if (type == "Square") return std::make_unique<SquareNode>();
|
||||
if (type == "OneMinus") return std::make_unique<OneMinusNode>();
|
||||
if (type == "Abs") return std::make_unique<AbsNode>();
|
||||
if (type == "Negate") return std::make_unique<NegateNode>();
|
||||
if (type == "Min") return std::make_unique<MinNode>();
|
||||
if (type == "Max") return std::make_unique<MaxNode>();
|
||||
if (type == "Clamp") return std::make_unique<ClampNode>();
|
||||
if (type == "Map") {
|
||||
return std::make_unique<MapNode>(
|
||||
j.value("min0", 0.0f),
|
||||
j.value("max0", 1.0f),
|
||||
j.value("min1", 0.0f),
|
||||
j.value("max1", 1.0f));
|
||||
}
|
||||
|
||||
// Noise nodes (frequency baked in)
|
||||
if (type == "PerlinNoise") return std::make_unique<PerlinNoiseNode>(j.value("frequency", 0.01f));
|
||||
@@ -117,6 +126,11 @@ nlohmann::json GraphSerializer::ToJson(const Graph& g)
|
||||
} else if (const auto* qd = dynamic_cast<const QueryDistanceNode*>(node)) {
|
||||
jNode["tileId"] = qd->tileID;
|
||||
jNode["maxDistance"] = qd->maxDistance;
|
||||
} else if (const auto* mn = dynamic_cast<const MapNode*>(node)) {
|
||||
jNode["min0"] = mn->min0;
|
||||
jNode["max0"] = mn->max0;
|
||||
jNode["min1"] = mn->min1;
|
||||
jNode["max1"] = mn->max1;
|
||||
} else if (const auto* pn = dynamic_cast<const PerlinNoiseNode*>(node)) {
|
||||
jNode["frequency"] = pn->frequency;
|
||||
} else if (const auto* sn = dynamic_cast<const SimplexNoiseNode*>(node)) {
|
||||
|
||||
Reference in New Issue
Block a user