MCPcopy Create free account
hub / github.com/axmolengine/axmol / SetupModel

Method SetupModel

tests/live2d-tests/Source/LAppModel.cpp:132–268  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

130
131
132void LAppModel::SetupModel(ICubismModelSetting* setting)
133{
134 _updating = true;
135 _initialized = false;
136
137 _modelSetting = setting;
138
139 csmByte* buffer;
140 csmSizeInt size;
141
142 //Cubism Model
143 if (strcmp(_modelSetting->GetModelFileName(), "") != 0)
144 {
145 csmString path = _modelSetting->GetModelFileName();
146 path = _modelHomeDir + path;
147
148 if (_debugMode)LAppPal::PrintLog("[APP]create model: %s", setting->GetModelFileName());
149
150 buffer = CreateBuffer(path.GetRawString(), &size);
151 LoadModel(buffer, size);
152 DeleteBuffer(buffer, path.GetRawString());
153
154 }
155
156 //Expression
157 if (_modelSetting->GetExpressionCount() > 0)
158 {
159 const csmInt32 count = _modelSetting->GetExpressionCount();
160 for (csmInt32 i = 0; i < count; i++)
161 {
162 csmString name = _modelSetting->GetExpressionName(i);
163 csmString path = _modelSetting->GetExpressionFileName(i);
164 path = _modelHomeDir + path;
165
166 buffer = CreateBuffer(path.GetRawString(), &size);
167 ACubismMotion* motion = LoadExpression(buffer, size, name.GetRawString());
168
169 if (_expressions[name] != NULL)
170 {
171 ACubismMotion::Delete(_expressions[name]);
172 _expressions[name] = NULL;
173 }
174 _expressions[name] = motion;
175
176 DeleteBuffer(buffer, path.GetRawString());
177 }
178 }
179
180 //Physics
181 if (strcmp(_modelSetting->GetPhysicsFileName(), "") != 0)
182 {
183 csmString path = _modelSetting->GetPhysicsFileName();
184 path = _modelHomeDir + path;
185
186 buffer = CreateBuffer(path.GetRawString(), &size);
187 LoadPhysics(buffer, size);
188 DeleteBuffer(buffer, path.GetRawString());
189 }

Callers

nothing calls this directly

Calls 15

CreateBufferFunction · 0.85
DeleteBufferFunction · 0.85
BreathParameterDataClass · 0.85
GetModelFileNameMethod · 0.80
GetExpressionCountMethod · 0.80
GetExpressionNameMethod · 0.80
GetExpressionFileNameMethod · 0.80
GetPhysicsFileNameMethod · 0.80
GetPoseFileNameMethod · 0.80
GetIdMethod · 0.80
SetParametersMethod · 0.80

Tested by

no test coverage detected