Render-Plugin for SketchUp

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

Moderator: Moderators

Post Reply
f.schaaf
Posts: 14
Joined: Thu Jul 14, 2016 7:54 am

Render-Plugin for SketchUp

Post by f.schaaf »

Currently we're developing a Render-Plugin for SketchUp.
In our code, we basically use this code to set up the Spacemouse device:

Code: Select all

SiInitialize();
SiOpenData oData;
SiOpenWinInit(&oData, m_hwnd);
SiSetUiMode(SI_ALL_HANDLES, SI_UI_NO_CONTROLS);
m_siHdlDevice = SiOpen("OurApp", SI_ANY_DEVICE, SI_NO_MASK, SI_EVENT, &oData);
SiSyncAxesState axesState;
axesState.state = SI_SYNC_AXES_STATE_TX | SI_SYNC_AXES_STATE_TY | SI_SYNC_AXES_STATE_TZ
	| SI_SYNC_AXES_STATE_RX | SI_SYNC_AXES_STATE_RY | SI_SYNC_AXES_STATE_RZ;
SiSyncSetAxesState(m_siHdlDevice, axesState);
This works fine when use in Revit, but in SketchUp, the are problems:

- Open Sketchup. Spacemouse is usable in SketchUp
- Open our RenderWindow. Spacemouse is usable in our Plugin.
- Focus Sketchup. Spacemouse doesn't work anymore in SketchUp.
- Focus our RenderWindow. Spacemouse is still usable.

We're going to ask the SketchUp team to maybe share the code they're using with us,
in the meantime, do you have any additional tips on how to improve the implementation?
ngomes
Moderator
Moderator
Posts: 3321
Joined: Mon Nov 27, 2006 7:22 am
Contact:

Re: Render-Plugin for SketchUp

Post by ngomes »

Hi f.schaaf,

There's a conflict between 3Dconnexion's extension for SketchUp and your code as the driver will send data to the last opened connection if the HWND is the same (or under the same parent).

I would expect the extension to move the view without you needing to replicate the same behaviour. Why do you need to access the 3D mouse data?
Nuno Gomes
f.schaaf
Posts: 14
Joined: Thu Jul 14, 2016 7:54 am

Re: Render-Plugin for SketchUp

Post by f.schaaf »

We need to, because we have a custom viewport.
For more infor, see our homepage: http://www.enscape3d.com
So are you saying that there is a proprietaty extension in the 3DConnexion's driver?
In Revit, our Renderwindow is a child to the host application as well, and there, we do not experience the problem.
f.schaaf
Posts: 14
Joined: Thu Jul 14, 2016 7:54 am

Re: Render-Plugin for SketchUp

Post by f.schaaf »

I need to post a correction:

We do NOT initiate our RenderWindow with the HostApp's (be it SketchUp or Revit) hWnd, so we are not the HostApp's Child Window.
We are however, part of the same process. (Our Plugin.dll gets loaded by the HostApp).
While working, the client will often switch between the windows, thus using the SpaceMouse device in both Windows.
ngomes
Moderator
Moderator
Posts: 3321
Joined: Mon Nov 27, 2006 7:22 am
Contact:

Re: Render-Plugin for SketchUp

Post by ngomes »

f.schaaf wrote:So are you saying that there is a proprietaty extension in the 3DConnexion's driver?
That's correct. Refer to the "Extension Manager" panel.

Since your extension is doing all the rendering -- and as you pointed out, then your extension will need to handle the view changes. Can you get the underlying SketchUp view changes and propagate them to your window? Say, the user switches to a standard view ("top" or "left"), how does your extension handle that?
f.schaaf
Posts: 14
Joined: Thu Jul 14, 2016 7:54 am

Re: Render-Plugin for SketchUp

Post by f.schaaf »

ngomes wrote:Since your extension is doing all the rendering -- and as you pointed out, then your extension will need to handle the view changes. Can you get the underlying SketchUp view changes and propagate them to your window? Say, the user switches to a standard view ("top" or "left"), how does your extension handle that?
What you can do is sync the view from SketchUp to Enscape. Then you can control both views simultaneously with the SpaceMouse.
But that's not what you usually do. Usually, you would look around in Enscape independently (Sync off).

The problem remains that if you switch between Enscape and SketchUp, the SpaceMouse ceases to work in SketchUp, and it is unclear, why.
When I apply input to the spaceMouse device while SketchUp has focus, nothing happens. No events are received by Enscape, and no movement occurs in SketchUp.
I'd like to know why this occurs and how to avoid it.

Here you can see how the view can be synced to SketchUp and also how it's used to look around independently.
https://www.youtube.com/watch?v=KwWe6JiyQqw
ngomes
Moderator
Moderator
Posts: 3321
Joined: Mon Nov 27, 2006 7:22 am
Contact:

Re: Render-Plugin for SketchUp

Post by ngomes »

Hi f.schaaf,

Thanks for the YT link. Very cool product you got there. Congrats.
What you can do is sync the view from SketchUp to Enscape. Then you can control both views simultaneously with the SpaceMouse.
But that's not what you usually do. Usually, you would look around in Enscape independently (Sync off).
Understood. Several applications that support 3D mice have multiple connection for different view window (MDIs, for example). Normally, they all share the same higher-order parent window. Perhaps in this case, Enscape does not share a common parent with the 3Dx extension window (hidden).

In your call to SiOpen, you have entered an HWND. Can you say how this window is parented?
f.schaaf
Posts: 14
Joined: Thu Jul 14, 2016 7:54 am

Re: Render-Plugin for SketchUp

Post by f.schaaf »

ngomes wrote:In your call to SiOpen, you have entered an HWND. Can you say how this window is parented?
Our hWnd is not parented.
ngomes
Moderator
Moderator
Posts: 3321
Joined: Mon Nov 27, 2006 7:22 am
Contact:

Re: Render-Plugin for SketchUp

Post by ngomes »

f.schaaf wrote:
ngomes wrote:In your call to SiOpen, you have entered an HWND. Can you say how this window is parented?
Our hWnd is not parented.
This might explain the issue. The driver will not be able to determine which window to send the events and may end up defaulting to precisely the window that has no focus (and does not update the view). I will look into this with others at 3Dx to see what we can do about it.
ngomes
Moderator
Moderator
Posts: 3321
Joined: Mon Nov 27, 2006 7:22 am
Contact:

Re: Render-Plugin for SketchUp

Post by ngomes »

Could you please send us driver log file? We're interested in seeing what the driver is doing when you switch between Enscape and SketchUp.

To enable logging, right-click the driver icon (3Dconnexion logo) and select "write log file". The file is saved to %LOCALAPPDATA%\3Dconnexion\3DxWare. We also suggest you package the log in a zip file and send the file PM in this forum or some other process that you may prefer.
jwick
Moderator
Moderator
Posts: 3331
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Re: Render-Plugin for SketchUp

Post by jwick »

Would it be possible to get an alpha of your product? I can't see why it wouldn't work.
What HWND are you supplying in the SiOpen args? I assume it is the visible OpenGL window that you are creating.
f.schaaf
Posts: 14
Joined: Thu Jul 14, 2016 7:54 am

Re: Render-Plugin for SketchUp

Post by f.schaaf »

Hi jwick, I've sent you a PM.
jwick wrote:What HWND are you supplying in the SiOpen args? I assume it is the visible OpenGL window that you are creating.
Exactly.
jwick
Moderator
Moderator
Posts: 3331
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Re: Render-Plugin for SketchUp

Post by jwick »

I've got it. Thanks.
I can reproduce the scenario.
f.schaaf
Posts: 14
Joined: Thu Jul 14, 2016 7:54 am

Re: Render-Plugin for SketchUp

Post by f.schaaf »

Thank you very much for the follow up.

So do you think this is something we could fix in our code?
jwick
Moderator
Moderator
Posts: 3331
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Re: Render-Plugin for SketchUp

Post by jwick »

No, I like the way yours is working.
I think we are going to try to change our plugin so it works better with yours.
Post Reply