diff --git a/GeomDB.cpp b/GeomDB.cpp index 9a672d1..dd2f640 100644 --- a/GeomDB.cpp +++ b/GeomDB.cpp @@ -1095,12 +1095,11 @@ GeomDB::Relocate( int nId, int nRefId, int nSonBeforeAfter, bool bGlob) if ( pNewGroup == nullptr) return false ; - // se riferimento al padre e vecchio e nuovo padre coincidono, non devo fare alcunché - if ( IS_GDB_SON( nSonBeforeAfter) && pGroup->m_nId == pNewGroup->m_nId) - return true ; + // verifico se l'oggetto rimane nello stesso gruppo + bool bSameGroup = ( pGroup->m_nId == pNewGroup->m_nId) ; - // se rilocazione in globale - if ( bGlob) { + // se cambia gruppo e rilocazione in globale + if ( ! bSameGroup && bGlob) { // recupero il riferimento del sorgente Frame3d frCurr ; if ( ! pGroup->GetGlobFrame( frCurr)) @@ -1128,9 +1127,9 @@ GeomDB::Relocate( int nId, int nRefId, int nSonBeforeAfter, bool bGlob) return false ; } - // se il materiale è ereditato, notifico che può essere cambiato + // se cambia gruppo e il materiale è ereditato, notifico che può essere cambiato int nMat ; - if ( ! pGdbObj->GetMaterial( nMat) || nMat == GDB_MT_PARENT) + if ( ! bSameGroup && ( ! pGdbObj->GetMaterial( nMat) || nMat == GDB_MT_PARENT)) pGdbObj->OnSetMaterial() ; return true ;