From 0c7035432abade0c8db5b2a83050dc4bd2e392ae Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Mon, 18 Jan 2016 07:59:07 +0000 Subject: [PATCH] EgtGeomKernel : - piccola miglioria a Relocate. --- GeomDB.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) 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 ;