feat: add clearMorphAnimationData function
This commit is contained in:
@@ -781,6 +781,27 @@ namespace thermion_filament
|
||||
return true;
|
||||
}
|
||||
|
||||
void SceneManager::clearMorphAnimationBuffer(
|
||||
EntityId entityId)
|
||||
{
|
||||
std::lock_guard lock(_mutex);
|
||||
|
||||
auto entity = Entity::import(entityId);
|
||||
|
||||
if (entity.isNull())
|
||||
{
|
||||
Log("ERROR: invalid entity %d.", entityId);
|
||||
return;
|
||||
}
|
||||
|
||||
auto animationComponentInstance = _animationComponentManager->getInstance(entity);
|
||||
auto &animationComponent = _animationComponentManager->elementAt<0>(animationComponentInstance);
|
||||
auto &morphAnimations = animationComponent.morphAnimations;
|
||||
|
||||
morphAnimations.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
bool SceneManager::setMaterialColor(EntityId entityId, const char *meshName, int materialIndex, const float r, const float g, const float b, const float a)
|
||||
{
|
||||
|
||||
|
||||
@@ -405,7 +405,7 @@ extern "C"
|
||||
return ((SceneManager *)sceneManager)->setMorphTargetWeights(asset, weights, numWeights);
|
||||
}
|
||||
|
||||
bool set_morph_animation(
|
||||
EMSCRIPTEN_KEEPALIVE bool set_morph_animation(
|
||||
void *sceneManager,
|
||||
EntityId asset,
|
||||
const float *const morphData,
|
||||
@@ -418,6 +418,10 @@ extern "C"
|
||||
return result;
|
||||
}
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void clear_morph_animation(void* sceneManager, EntityId asset) {
|
||||
((SceneManager *)sceneManager)->clearMorphAnimationBuffer(asset);
|
||||
}
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void reset_to_rest_pose(void *sceneManager, EntityId entityId)
|
||||
{
|
||||
((SceneManager *)sceneManager)->resetBones(entityId);
|
||||
|
||||
Reference in New Issue
Block a user