![]() |
|
Translate, rotate and scale - Printable Version +- AB4D Forum (https://forum.ab4d.com) +-- Forum: Products Forums (https://forum.ab4d.com/forumdisplay.php?fid=4) +--- Forum: Ab3d.DXEngine (https://forum.ab4d.com/forumdisplay.php?fid=11) +--- Thread: Translate, rotate and scale (/showthread.php?tid=4256) |
Translate, rotate and scale - GraPhiX - 04-22-2021 Hi i have just purchased DxEngine. i already had powertoys i have created a viewer with powertoys in VB.NET all was working fine, now i have created a dxviewport i can rotate and move the camera/viewport but when i select the modelmover or rotator the widgets appear but i cannot select them, any idea what i have not done? Code: Dim MystandardTransform3D = New StandardTransform3D()RE: Translate, rotate and scale - abenedik - 04-23-2021 ModelMoverVisual3D, ModelScalarVisual3D and ModelRotatorVisual3D internally use UIElement3D objects that can get mouse events. But this is not possible when those objects are rendered by DXEngine - in this case the Viewport3D is not actually visible from the WPF's perspective and therefore the UIElement3D objects do not receive any mouse events. When you put ModelMoverVisual3D, ModelScalarVisual3D and ModelRotatorVisual3D into an overlay Viewport3D (Viewport3D objects that is rendered on top of DXViewportView - is defined after DXViewportView and take the same space in the window), then you do not need to change anything because the UIElement3D objects will get mouse events because they are rendered by WPF's Viewport3D. But when ModelMoverVisual3D, ModelScalarVisual3D and ModelRotatorVisual3D are rendered in the same 3D scene as other objects and are therefore rendered by DXEngine, then they will not get any mouse events. As described in the comments for "Other Ab3d.PowerToys samples / ModelMover inside object" and "Other Ab3d.PowerToys samples / ModelRotatorSample" sample in Ab3d.DXEngine samples project, you need to do the following to add support for those objects in DXEngine (coped text from the comments): When ModelMoverVisual3D is used inside DXEngine, the mouse events on UIElement3D objects that are used inside ModelMoverVisual3D will not work. Therefore ModelMoverVisual3D also supports using Ab3d.Utilities.EventManager3D that can process mouse events when inside Ab3d.DXEngine. To make ModelMoverVisual3D work inside DXEngine, the following code changes need to be done: 1) EventManager3D needs to be created and its CustomEventsSourceElement must be set the DXViewportView or a parent Border or some other parent element that has Background property set (see line 69) 2) When ModelMoverVisual3D is created, we need to call the SubscribeWithEventManager3D method on the created ModelMoverVisual3D and pass the EventManager3D as a parameter (see line 84) 3) To allow the user to click on arrows that are inside the selected model, we need to exclude the selected model from being processed by EventManager3D. This can be done by calling RegisterExcludedVisual3D on EventManager3D (see line 226) 4) Because we called RegisterExcludedVisual3D, we need to call RemoveExcludedVisual3D after the mouse moving is completed (see line 207) Another option is to create an overlay Viewport3D and move the ModelMoverVisual3D, ModelScalarVisual3D and ModelRotatorVisual3D to it. RE: Translate, rotate and scale - GraPhiX - 04-23-2021 Thank you for you quick response, i am an idiot i did not know there were DXEngine samples i was still using powertoy samples, once i seen the sample i got it working :) going through all the samples now RE: Translate, rotate and scale - GraPhiX - 04-23-2021 (04-23-2021, 11:48 AM)GraPhiX Wrote: Thank you for you quick response, i am an idiot i did not know there were DXEngine samples i was still using powertoy samples, once i seen the sample i got it working :) going through all the samples now I spoke too soon :( _modelMover works _modelRotator works _modelScaler not working :( Code: Public Sub ShowModelMover()Code: Public Sub ShowModelRotator(sender As Object, e As ModelRotatedEventArgs)Code: Public Sub ShowModelScalar(sender As Object, ARGSS As ModelScaledEventArgs)the error is BC30456 'SubscribeWithEventManager3D' is not a member of 'ModelScalarVisual3D' RE: Translate, rotate and scale - GraPhiX - 04-23-2021 looking at Ab3d.Visuals Public Class ModelScalarVisual3D this line is missing Public Sub SubscribeWithEventManager3D(eventManager3D As EventManager3D) is this a bug or am i wrong RE: Translate, rotate and scale - abenedik - 04-26-2021 SubscribeWithEventManager3D is missing from the ModelScalarVisual3D. I will update the code and send you a pre-release version with that method. RE: Translate, rotate and scale - GraPhiX - 04-26-2021 (04-26-2021, 11:44 AM)abenedik Wrote: SubscribeWithEventManager3D is missing from the ModelScalarVisual3D. I will update the code and send you a pre-release version with that method. Thank you very much :) installed update and it works perfectly |