mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
add 'model-name' block property
This commit is contained in:
parent
64369fb189
commit
423ac2c44e
5 changed files with 23 additions and 17 deletions
|
|
@ -219,14 +219,15 @@ void ContentLoader::loadBlock(
|
|||
}
|
||||
|
||||
// block model
|
||||
std::string modelName;
|
||||
root.at("model").get(modelName);
|
||||
if (auto model = BlockModel_from(modelName)) {
|
||||
std::string modelTypeName;
|
||||
root.at("model").get(modelTypeName);
|
||||
root.at("model-name").get(def.modelName);
|
||||
if (auto model = BlockModel_from(modelTypeName)) {
|
||||
if (*model == BlockModel::custom) {
|
||||
if (root.has("model-primitives")) {
|
||||
def.customModelRaw = root["model-primitives"];
|
||||
} else {
|
||||
throw std::runtime_error(name + ": no 'model-primitives' found");
|
||||
} else if (def.modelName.empty()) {
|
||||
throw std::runtime_error(name + ": no 'model-primitives' or 'model-name' found");
|
||||
}
|
||||
for (uint i = 0; i < 6; i++) {
|
||||
std::string& texture = def.textureFaces[i];
|
||||
|
|
@ -236,8 +237,8 @@ void ContentLoader::loadBlock(
|
|||
}
|
||||
}
|
||||
def.model = *model;
|
||||
} else if (!modelName.empty()) {
|
||||
logger.error() << "unknown model " << modelName;
|
||||
} else if (!modelTypeName.empty()) {
|
||||
logger.error() << "unknown model " << modelTypeName;
|
||||
def.model = BlockModel::none;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue