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

Method PreloadMotionGroup

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

Source from the content-addressed store, hash-verified

268}
269
270void LAppModel::PreloadMotionGroup(const csmChar* group)
271{
272 const csmInt32 count = _modelSetting->GetMotionCount(group);
273
274 for (csmInt32 i = 0; i < count; i++)
275 {
276 //ex) idle_0
277 csmString name = Utils::CubismString::GetFormatedString("%s_%d", group, i);
278 csmString path = _modelSetting->GetMotionFileName(group, i);
279 path = _modelHomeDir + path;
280
281 if (_debugMode)LAppPal::PrintLog("[APP]load motion: %s => [%s_%d] ", path.GetRawString(), group, i);
282
283 csmByte* buffer;
284 csmSizeInt size;
285 buffer = CreateBuffer(path.GetRawString(), &size);
286 CubismMotion* tmpMotion = static_cast<CubismMotion*>(LoadMotion(buffer, size, name.GetRawString()));
287
288 csmFloat32 fadeTime = _modelSetting->GetMotionFadeInTimeValue(group, i);
289 if (fadeTime >= 0.0f)
290 {
291 tmpMotion->SetFadeInTime(fadeTime);
292 }
293
294 fadeTime = _modelSetting->GetMotionFadeOutTimeValue(group, i);
295 if (fadeTime >= 0.0f)
296 {
297 tmpMotion->SetFadeOutTime(fadeTime);
298 }
299 tmpMotion->SetEffectIds(_eyeBlinkIds, _lipSyncIds);
300
301 if (_motions[name] != NULL)
302 {
303 ACubismMotion::Delete(_motions[name]);
304 }
305 _motions[name] = tmpMotion;
306
307 DeleteBuffer(buffer, path.GetRawString());
308
309 csmString voice = _modelSetting->GetMotionSoundFileName(group, i);
310 if (strcmp(voice.GetRawString(), "") != 0)
311 {
312 csmString path = voice;
313 path = _modelHomeDir + path;
314
315#if USE_AUDIO_ENGINE
316 AudioEngine::preload(path.GetRawString());
317#elif USE_SIMPLE_AUDIO_ENGINE
318 SimpleAudioEngine::getInstance()->preloadEffect(path.GetRawString());
319#endif
320 }
321 }
322}
323
324void LAppModel::ReleaseMotionGroup(const csmChar* group) const
325{

Callers

nothing calls this directly

Calls 14

CreateBufferFunction · 0.85
DeleteBufferFunction · 0.85
preloadFunction · 0.85
getInstanceFunction · 0.85
GetMotionCountMethod · 0.80
GetMotionFileNameMethod · 0.80
SetFadeInTimeMethod · 0.80
SetFadeOutTimeMethod · 0.80
SetEffectIdsMethod · 0.80

Tested by

no test coverage detected