Kaydet (Commit) ee71c3de authored tarafından Armin Le Grand's avatar Armin Le Grand

tdf#118498 Correct CustomShape 3D Visualization

Change-Id: Ic312190616044f37fd92464ad605c6e0cdd5cc4d
Reviewed-on: https://gerrit.libreoffice.org/57547
Tested-by: Jenkins
Reviewed-by: 's avatarArmin Le Grand <Armin.Le.Grand@cib.de>
üst 4c2d0b0d
......@@ -125,22 +125,29 @@ namespace sdr
// Hack for calc, transform position of object according
// to current zoom so as objects relative position to grid
// appears stable
// TTTT: Need to check what *exactly* this is doing - in it's current
// form it's indeed pretty much a 'hack' as mentioned above and massively
// in the way for future changes...
const_cast< SdrObject* >( pSdrObjRepresentation )->SetGridOffset( aGridOff );
SdrObjListIter aIterator(*pSdrObjRepresentation);
while(aIterator.IsMore())
{
SdrObject& rCandidate = *aIterator.Next();
// apply offset to each part
rCandidate.SetGridOffset( aGridOff );
if(!b3DShape && dynamic_cast< E3dObject* >(&rCandidate))
{
b3DShape = true;
}
const drawinglayer::primitive2d::Primitive2DContainer xNew(rCandidate.GetViewContact().getViewIndependentPrimitive2DContainer());
xGroup.insert(xGroup.end(), xNew.begin(), xNew.end());
}
// tdf#118498 The processing of SdrObjListIter for SdrIterMode::DeepNoGroups
// did change for 3D-Objects, it now correctly enters and iterates the
// SdrObjects in the E3dScene (same as for SdrObjGroup). This is more correct
// as the old version which just checked for dynamic_cast<const SdrObjGroup*>
// and *only* entered these, ignoring E3dScene as grouping-object.
// But how to fix that? Taking back the SdrObjListIter change would be easy, but
// not correct. After checking ViewContactOfE3dScene and ViewContactOfGroup
// I see that both traverse their children by themselves (on VC-Level,
// see createViewIndependentPrimitive2DSequence implementations and usage of
// GetObjectCount()). Thus in principle iterating here (esp. 'deep') seems to
// be wrong anyways, it might have even created wrong and double geometries
// (only with complex CustomShapes with multiple representation SdrObects and
// only visible when transparency involved, but runtime-expensive).
// Thus: Just do not iterate, will check behaviour deeply.
b3DShape = (nullptr != dynamic_cast< const E3dObject* >(pSdrObjRepresentation));
const drawinglayer::primitive2d::Primitive2DContainer xNew(
pSdrObjRepresentation->GetViewContact().getViewIndependentPrimitive2DContainer());
xGroup.insert(xGroup.end(), xNew.begin(), xNew.end());
}
if(bHasText || !xGroup.empty())
......
......@@ -123,6 +123,14 @@ void SdrObjListIter::ImpProcessMarkList(const SdrMarkList& rMarkList, SdrIterMod
void SdrObjListIter::ImpProcessObj(const SdrObject& rSdrObject, SdrIterMode eMode)
{
// TTTT: Note: The behaviour has changed here, it will now deep-iterate
// for SdrObjGroup and E3dScene. Old version only deep-dived for SdrObjGroup,
// E3dScene was just added flat. This is now more correct, but potentially
// there will exist code in the 3D area that *self-iterates* with local
// functions/methods due to this iterator was not doing the expected thing.
// These will be difficult to find, but in most cases should do no harm,
// but cost runtime. Will need to have an eye on this aspect on continued
// changes...
const SdrObjList* pChildren(rSdrObject.getChildrenOfSdrObject());
const bool bIsGroup(nullptr != pChildren);
......
Markdown is supported
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