How to use the 3DxWare SDK in an Application with multiple different Views

Post questions, comments and feedback to our 3Dconnexion Windows Development Team.

Moderator: Moderators

Post Reply
StefanF
Posts: 4
Joined: Mon Dec 20, 2021 12:48 pm

How to use the 3DxWare SDK in an Application with multiple different Views

Post by StefanF »

Hello,

I have an application that uses a MFC multiple-document interface (MDI) with multiple different View types (one 3D, others 2D) that all can be opened at the same time and each view should work with the SpaceMouse.

My first working implementation derived MainFrame from TDx::SpaceMouse::Navigation3D::CNavigation3D like the navlib_viewer Sample does.

But because of the difference between the views (3d vs. 2d) I tried to derive each View class from TDx::SpaceMouse::Navigation3D::CNavigation3D and call Enable3DNavigation(); in OnSetActive() and Disable3DNavigation(); in OnKillActive().
This seems to work, but I am not sure if this is the right solution.

I would be grateful for a recommendation.
ngomes
Moderator
Moderator
Posts: 3321
Joined: Mon Nov 27, 2006 7:22 am
Contact:

Re: How to use the 3DxWare SDK in an Application with multiple different Views

Post by ngomes »

StefanF wrote: Mon Dec 20, 2021 1:07 pm But because of the difference between the views (3d vs. 2d) I tried to derive each View class from TDx::SpaceMouse::Navigation3D::CNavigation3D and call Enable3DNavigation(); in OnSetActive() and Disable3DNavigation(); in OnKillActive().
Not quite.

If you derive from CNavigation3D for each View (a perfectly reasonable approach), you are opening a "connection" to the driver but, as you verified, it cannot determine which view is active. For this, set the "Focus" property when your view becomes active.

Calling Enable3DNavigation() is expensive but the "Focus" property is lightweight and meant precisely for what you're looking to address.
Nuno Gomes
StefanF
Posts: 4
Joined: Mon Dec 20, 2021 12:48 pm

Re: How to use the 3DxWare SDK in an Application with multiple different Views

Post by StefanF »

Many thanks for the quick response. I will change that.
I have a few more questions:
EnableNavigation has to be called for each connection after the window has been created, right?
Could I also use different profiles for the different views?
ngomes
Moderator
Moderator
Posts: 3321
Joined: Mon Nov 27, 2006 7:22 am
Contact:

Re: How to use the 3DxWare SDK in an Application with multiple different Views

Post by ngomes »

StefanF wrote: Tue Dec 21, 2021 7:24 am EnableNavigation has to be called for each connection after the window has been created, right?
That's correct. Each instance of CNavigation3D must be "enabled" by calling that method.
Could I also use different profiles for the different views?
Are you referring to driver profiles? If so, the driver can only support different "button" profiles: users can assign different commands for different application "command sets" (or "environments"). Refer to CNavigation3D::ActiveCommandSet() and section 3.4.8 in page 15 of the navlib.pdf document.
StefanF
Posts: 4
Joined: Mon Dec 20, 2021 12:48 pm

Re: How to use the 3DxWare SDK in an Application with multiple different Views

Post by StefanF »

Thank you very much.
Are you referring to driver profiles? If so, the driver can only support different "button" profiles: users can assign different commands for different application "command sets" (or "environments"). Refer to CNavigation3D::ActiveCommandSet() and section 3.4.8 in page 15 of the navlib.pdf document.
I was thinking of the Profile property in Enable3DNavigation - something like setting the property to <My Application Name>.<View Type 1> in one view class and to <My Application Name>.<View Type 2> in another view class to allow users different settings (e.g. speed) for the different views.
ngomes
Moderator
Moderator
Posts: 3321
Joined: Mon Nov 27, 2006 7:22 am
Contact:

Re: How to use the 3DxWare SDK in an Application with multiple different Views

Post by ngomes »

StefanF wrote: Tue Dec 21, 2021 10:20 am I was thinking of the Profile property in Enable3DNavigation - something like setting the property to <My Application Name>.<View Type 1> in one view class and to <My Application Name>.<View Type 2> in another view class to allow users different settings (e.g. speed) for the different views.
That is undesirable. Normally, users will adjust speed on a per application basis, not per view or environment.
StefanF
Posts: 4
Joined: Mon Dec 20, 2021 12:48 pm

Re: How to use the 3DxWare SDK in an Application with multiple different Views

Post by StefanF »

I understand. Many thanks for your help.
Post Reply