Closed sucv closed 1 year ago
Could you double check the location of the new models? When you are adding new model, please make sure the models are in the build directory build-QtLive2d-Desktop_Qt_6_4_2_GCC_64bit-Debug/src/Sample/Resources
as well. When Qt Creator build the project, it will copy Resources folder from src to the build directory. But if you don't rebuild it, it won't help you copy.
Please let me know if that works.
Thanks for your prompt response!
Confirmed. I always use clean
before building. Now I also tried manually deleting the entire built folder.
I added haru2
in LAppDefine.cpp
. This haru is the normal one in the official collections. After the building, I can see the model in both the F:\VB_shared\build-QtLive2d-Desktop_Qt_6_4_2_GCC_64bit-Debug\src\Sample\Resources\haru2
and F:\VB_shared\QtLive2d_new\src\Sample\Resources\haru2
. But it crashed without opening the window.
Hi sucv, just tried on my own to add a haru to the application. Everything is fine. Here is a document for adding the model to Sample.
Step 1: Add the model to Resources
folder, make sure the model folder has following structure.
└───Haru2
│ ...
│ Haru2.model3.json
│ ...
├───expressions
│
├───Haru.2048
│
├───motions
│
└───sounds
We use haru2 as example, since we already have a model called haru, the new model will called haru2.
Step 2: Modify LAppDefine.cpp
, add addition line called haru2 in the ModelDir
variable.
const csmChar* ModelDir[] = {
"miku_sample_t04",
"Haru",
"Hiyori",
"Mark",
"Natori",
"Rice",
"Haru2"
};
When we try to load model Haru2, firstly, LAppDefine.cpp
will try to find a folder called Haru2
under the Resources
folder. Then it will try to find a Haru2.model3.json
file where store all information about a Live2d model under Haru2
folder. So, the most important thing will be make sure LAppDefine.cpp
can find the *.model3.json
.
From the log u provide to me, I think there is 2 possibility,
Haru2
but there isn't exist a Haru2.model3.json
.Please let me know if the above information is helpful for you. And feel free to ask me if u have any other questions.
Oh my, I named the model folder haru2, but I didn't also change the json name to haru2.model3.json
.
Thanks again for your help!
no worries.
Several models from the official collections (https://www.live2d.com/en/download/sample-data/) cannot be opened. Such as Niziiro Mao, and Haru (not the receptionist version, the normal one down there).
I always received such kinds of errors.
And when I run the code using debug, in
CubismJson.cpp
, the line 107_root = ParseValue(reinterpret_cast<const csmChar*>(buffer), size, 0, &endPos);
, which called the line 369csmChar c = static_cast<csmChar>(buffer[i] & 0xFF);
caused this.I validated all the JSON files in those model folders, they are all valid. It would be greatly appreciated if you could find the reason. Thanks.