Commit c6bde2e4 authored by Mike Kremer's avatar Mike Kremer
Browse files

Detach skin from skeleton if mesh is removed from scene.

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@13027 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 834c36a0
......@@ -175,8 +175,34 @@ void SkeletalAnimationPlugin::addedEmptyObject(int /*_id*/) {
/** \brief Update ui when the object is deleted
*
*/
void SkeletalAnimationPlugin::objectDeleted(int /*_id*/) {
checkObjectSelection();
void SkeletalAnimationPlugin::objectDeleted(int _id) {
checkObjectSelection();
// Check for skin that is to be cleared
BaseObjectData* bod = 0;
if (!PluginFunctions::getObject(_id, bod)) {
return;
}
if (bod->hasObjectData(OBJECTDATA_SKIN)) {
BaseSkin* baseSkin = 0;
if (bod->dataType(DATA_TRIANGLE_MESH))
baseSkin = dynamic_cast<BaseSkin*> (bod->objectData(OBJECTDATA_SKIN));
else if (bod->dataType(DATA_POLY_MESH))
baseSkin = dynamic_cast<BaseSkin*> (bod->objectData(OBJECTDATA_SKIN));
if (baseSkin) {
BaseObjectData* skeletonObj = PluginFunctions::skeletonObject(baseSkin->skeletonId());
if(skeletonObj) {
// Detach skin from skeleton
detachSkin(bod, skeletonObj);
}
}
}
}
//------------------------------------------------------------------------------
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment