Add authors and license to model file
This commit is contained in:
parent
678393ccb1
commit
972a0cc9b9
1
TODO.md
1
TODO.md
|
@ -6,7 +6,6 @@
|
|||
|
||||
## models
|
||||
- clipping (alpha stencil)
|
||||
- model copyright and authors
|
||||
|
||||
## Bugs
|
||||
- incorrect appdata location on Windows
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
[format]
|
||||
version_major = 0
|
||||
version_minor = 2
|
||||
version_minor = 5
|
||||
|
||||
[model_info]
|
||||
name = "Richard Stallman"
|
||||
version = "1.0"
|
||||
version = "1.1"
|
||||
artist = "Ruben Rodriguez"
|
||||
modeler = "Epicalert"
|
||||
license = "CC-BY-4.0"
|
||||
|
||||
[[part]]
|
||||
texture = "bg.webp"
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#define BUFFER_SIZE_TEXTURE 16777220 // 16 MiB
|
||||
|
||||
#define SUPPORTED_MODEL_MAJOR 0
|
||||
#define SUPPORTED_MODEL_MINOR 4
|
||||
#define SUPPORTED_MODEL_MINOR 5
|
||||
|
||||
void textureFromArchive(zip_t* archive, const char* path, ModelPart* part, size_t slot, std::string triggerName) {
|
||||
zip_file_t* textureFile = zip_fopen(archive, path, 0);
|
||||
|
@ -90,8 +90,30 @@ Model::Model(const char* path) {
|
|||
} else {
|
||||
name = nameResult.second;
|
||||
}
|
||||
|
||||
// get authors
|
||||
// artist (or photographer if image)
|
||||
auto artistResult = modelInfo->getString("artist");
|
||||
|
||||
if (artistResult.first) {
|
||||
artist = artistResult.second;
|
||||
}
|
||||
// rigger/modeler
|
||||
auto modelerResult = modelInfo->getString("modeler");
|
||||
|
||||
if (modelerResult.first) {
|
||||
modeler = modelerResult.second;
|
||||
}
|
||||
|
||||
// get license (SPDX identifier, if not present file is assumed to be proprietary)
|
||||
auto licenseResult = modelInfo->getString("license");
|
||||
|
||||
if (licenseResult.first) {
|
||||
license = licenseResult.second;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// parse parts
|
||||
auto partsDescArray = modelDesc.table->getArray("part");
|
||||
|
||||
|
@ -212,3 +234,7 @@ std::string Model::getName() {
|
|||
return name;
|
||||
}
|
||||
|
||||
std::string Model::getInfoString() {
|
||||
return fmt::format("{}\n{}\n\nArtist: {}\nModeler: {}",
|
||||
name, license, artist, modeler);
|
||||
}
|
||||
|
|
|
@ -10,6 +10,10 @@ class Model {
|
|||
|
||||
std::string name;
|
||||
|
||||
std::string artist;
|
||||
std::string modeler;
|
||||
std::string license;
|
||||
|
||||
public:
|
||||
Model(const char* path);
|
||||
|
||||
|
@ -18,6 +22,7 @@ class Model {
|
|||
void updateTransforms(struct FaceData faceData);
|
||||
|
||||
std::string getName();
|
||||
std::string getInfoString();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue