02-05-2018, 03:32 PM
.Hi,
In my application I need to allow the user to chose which objects are visible in the display (and they change frequently).
Right now I am adding/removing ModelVisual3D objects from Viewport3D.Children,using Add and Remove methods on the collection.
This seems to work some of the time. But often it throws an exception:
I assume there is some difference in the objects known about by the dxscene and the viewport?
How do I *safely* modify which ModelVisual3Ds are shown? In particular removing (permanently) and then adding new models.
Any help is most appreciated.
regards,
Simon
In my application I need to allow the user to chose which objects are visible in the display (and they change frequently).
Right now I am adding/removing ModelVisual3D objects from Viewport3D.Children,using Add and Remove methods on the collection.
This seems to work some of the time. But often it throws an exception:
Code:
DXEngine Fatal: Unhandled exception in Update: Object reference not set to an instance of an object.
Object reference not set to an instance of an object.
NullReferenceException
at Ab3d.DirectX.MeshObjectNode.OnInitializeResources(DXScene dxScene)
at Ab3d.DirectX.SharedDXSceneResource.InitializeResources(DXScene dxScene)
at Ab3d.DirectX.SceneNode.(SceneNode , Int32 , Boolean , Boolean )
at Ab3d.DirectX.Models.WpfModelVisual3DNode.RecreateContentSceneNode()
at Ab3d.DirectX.Models.WpfModelVisual3DNode.OnInitializeResources(DXScene dxScene)
at Ab3d.DirectX.SharedDXSceneResource.InitializeResources(DXScene dxScene)
at Ab3d.DirectX.SceneNode.(SceneNode , Int32 , Boolean , Boolean )
at Ab3d.DirectX.Models.WpfVisual3DCollectionNode.e(Visual3D fq)
at Ab3d.DirectX.Models.WpfVisual3DCollectionNode.d()
at Ab3d.DirectX.Models.WpfVisual3DCollectionNode.OnInitializeResources(DXScene dxScene)
at Ab3d.DirectX.SharedDXSceneResource.InitializeResources(DXScene dxScene)
at Ab3d.DirectX.Models.WpfModelVisual3DNode.e(SceneNodeDirtyFlags& eh)
at Ab3d.DirectX.Models.WpfModelVisual3DNode.RecreateContentSceneNode()
at Ab3d.DirectX.Models.WpfModelVisual3DNode.OnInitializeResources(DXScene dxScene)
at Ab3d.DirectX.SharedDXSceneResource.InitializeResources(DXScene dxScene)
at Ab3d.DirectX.SceneNode.(SceneNode , Int32 , Boolean , Boolean )
at Ab3d.DirectX.Models.WpfVisual3DCollectionNode.e(Visual3D fq)
at Ab3d.DirectX.Models.WpfVisual3DCollectionNode.b()
at Ab3d.DirectX.Models.WpfVisual3DCollectionNode.Update()
at Ab3d.DirectX.DXScene.Update()
at Ab3d.DirectX.Controls.DXView.Update()
at Ab3d.DirectX.Controls.DXView.h(Object ng, EventArgs nh)
I assume there is some difference in the objects known about by the dxscene and the viewport?
How do I *safely* modify which ModelVisual3Ds are shown? In particular removing (permanently) and then adding new models.
Any help is most appreciated.
regards,
Simon