rename rig to skeleton

This commit is contained in:
MihailRis
2024-07-10 04:28:12 +03:00
parent 91230ecbeb
commit 60f4f33180
24 changed files with 187 additions and 187 deletions
+5 -5
View File
@@ -30,11 +30,11 @@ Content::Content(
ContentUnitDefs<EntityDef> entities,
UptrsMap<std::string, ContentPackRuntime> packs,
UptrsMap<std::string, BlockMaterial> blockMaterials,
UptrsMap<std::string, rigging::RigConfig> rigs
UptrsMap<std::string, rigging::SkeletonConfig> skeletons
) : indices(std::move(indices)),
packs(std::move(packs)),
blockMaterials(std::move(blockMaterials)),
rigs(std::move(rigs)),
skeletons(std::move(skeletons)),
blocks(std::move(blocks)),
items(std::move(items)),
entities(std::move(entities)),
@@ -44,9 +44,9 @@ Content::Content(
Content::~Content() {
}
const rigging::RigConfig* Content::getRig(const std::string& id) const {
auto found = rigs.find(id);
if (found == rigs.end()) {
const rigging::SkeletonConfig* Content::getRig(const std::string& id) const {
auto found = skeletons.find(id);
if (found == skeletons.end()) {
return nullptr;
}
return found->second.get();
+4 -4
View File
@@ -22,7 +22,7 @@ class Content;
class ContentPackRuntime;
namespace rigging {
class RigConfig;
class SkeletonConfig;
}
enum class contenttype {
@@ -116,7 +116,7 @@ class Content {
std::unique_ptr<ContentIndices> indices;
UptrsMap<std::string, ContentPackRuntime> packs;
UptrsMap<std::string, BlockMaterial> blockMaterials;
UptrsMap<std::string, rigging::RigConfig> rigs;
UptrsMap<std::string, rigging::SkeletonConfig> skeletons;
public:
ContentUnitDefs<Block> blocks;
ContentUnitDefs<ItemDef> items;
@@ -131,7 +131,7 @@ public:
ContentUnitDefs<EntityDef> entities,
UptrsMap<std::string, ContentPackRuntime> packs,
UptrsMap<std::string, BlockMaterial> blockMaterials,
UptrsMap<std::string, rigging::RigConfig> rigs
UptrsMap<std::string, rigging::SkeletonConfig> skeletons
);
~Content();
@@ -139,7 +139,7 @@ public:
return indices.get();
}
const rigging::RigConfig* getRig(const std::string& id) const;
const rigging::SkeletonConfig* getRig(const std::string& id) const;
const BlockMaterial* findBlockMaterial(const std::string& id) const;
const ContentPackRuntime* getPackRuntime(const std::string& id) const;
+3 -3
View File
@@ -8,8 +8,8 @@ void ContentBuilder::add(std::unique_ptr<ContentPackRuntime> pack) {
packs[pack->getId()] = std::move(pack);
}
void ContentBuilder::add(std::unique_ptr<rigging::RigConfig> rig) {
rigs[rig->getName()] = std::move(rig);
void ContentBuilder::add(std::unique_ptr<rigging::SkeletonConfig> skeleton) {
skeletons[skeleton->getName()] = std::move(skeleton);
}
BlockMaterial& ContentBuilder::createBlockMaterial(const std::string& id) {
@@ -75,7 +75,7 @@ std::unique_ptr<Content> ContentBuilder::build() {
entities.build(),
std::move(packs),
std::move(blockMaterials),
std::move(rigs)
std::move(skeletons)
);
// Now, it's time to resolve foreign keys
+2 -2
View File
@@ -50,7 +50,7 @@ public:
class ContentBuilder {
UptrsMap<std::string, BlockMaterial> blockMaterials;
UptrsMap<std::string, rigging::RigConfig> rigs;
UptrsMap<std::string, rigging::SkeletonConfig> skeletons;
UptrsMap<std::string, ContentPackRuntime> packs;
std::unordered_map<std::string, contenttype> allNames;
public:
@@ -61,7 +61,7 @@ public:
~ContentBuilder();
void add(std::unique_ptr<ContentPackRuntime> pack);
void add(std::unique_ptr<rigging::RigConfig> rig);
void add(std::unique_ptr<rigging::SkeletonConfig> skeleton);
BlockMaterial& createBlockMaterial(const std::string& id);
+7 -7
View File
@@ -336,8 +336,8 @@ void ContentLoader::loadEntity(EntityDef& def, const std::string& name, const fs
}
}
root->flag("save", def.save.enabled);
root->flag("save-rig-pose", def.save.rig.pose);
root->flag("save-rig-textures", def.save.rig.textures);
root->flag("save-skeleton-pose", def.save.skeleton.pose);
root->flag("save-skeleton-textures", def.save.skeleton.textures);
root->flag("save-body-velocity", def.save.body.velocity);
root->flag("save-body-settings", def.save.body.settings);
@@ -347,7 +347,7 @@ void ContentLoader::loadEntity(EntityDef& def, const std::string& name, const fs
def.bodyType = *bodyType;
}
root->str("rig-name", def.rigName);
root->str("skeleton-name", def.skeletonName);
}
void ContentLoader::loadEntity(EntityDef& def, const std::string& full, const std::string& name) {
@@ -468,13 +468,13 @@ void ContentLoader::load() {
}
}
fs::path rigsDir = folder / fs::u8path("rigs");
if (fs::is_directory(rigsDir)) {
for (const auto& entry : fs::directory_iterator(rigsDir)) {
fs::path skeletonsDir = folder / fs::u8path("skeletons");
if (fs::is_directory(skeletonsDir)) {
for (const auto& entry : fs::directory_iterator(skeletonsDir)) {
const fs::path& file = entry.path();
std::string name = pack->id+":"+file.stem().u8string();
std::string text = files::read_string(file);
builder.add(rigging::RigConfig::parse(text, file.u8string(), name));
builder.add(rigging::SkeletonConfig::parse(text, file.u8string(), name));
}
}
}