mcneel / rhino.inside

Sample Projects for Rhino.Inside
MIT License
382 stars 169 forks source link

ViewportControl and floating window #249

Open corbane opened 4 years ago

corbane commented 4 years ago

I am experimenting RhinoInside with the WinFormsApp example.

The RhinoWindows.Forms.Controls.ViewportControl behaves unexpectedly.

It opens floating windows saved in the file. Being able to have floating windows is good enough, but it uses the inputs entry as Rhino. We can select an object with a left click and translation comes with ctrl/right click.

image

sbaer commented 4 years ago

I don't understand this bug report. Could you elaborate on what the issue is?

corbane commented 4 years ago

Yes of course,

when we open a Rhino file saved without floating windows in a ViewportControl, it defines its own event handler

when we open a Rhino file saved with floating windows in a ViewportControl it defines its own event handler, and, it opens a floating window at the dimensions save in the file. For this second window, it keeps the Rhinoceros event managers.

ViewportControl flotting viewport
Selectable object no Left click
can move objects no yes
Translation view Left right Maj + Left click
Rotation view Left click Left click
Zoom view no Ctrl/Alt + Left click
Middle click nothing Error "No toolbar or group named 'default.Popup' found to pop-up"
Contextual menu no yes
Can access to the Rhino properties page no yes (I changed the persistent settings of Rhino with this control)
Shortcuts no yes (Ctrl+X, Ctrl+S works)

ViewportControl Should Not Open Floating Windows. Or else, both must have the same event handlers. we currently have the first non editable and the second editable (Rhino settings included)

tongbong commented 3 years ago

@corbane Do you still have the code? I don't know about you but I would expect the viewport control to always behave like described in the "floating viewport" column.

/!\ Edit, after having loaded the file, run this command RhinoApp.RunScript(@"-NewFloatingViewport Projection=CopyActive Perspective", true);

corbane commented 3 years ago

Hello @tongbong, My code is https://github.com/mcneel/rhino.inside/tree/master/DotNet/WinFormsApp

I have a doubt with RhinoApp.RunScript Indeed, in Rhino, there is no problem with a floating window, but this is not the behavior of the Rhino floating viewport.

In the screenshot you can see a classic "Windows.Forms" that embed Rhino.Inside and RhinoWindows.Forms.Controls.ViewportControl (RhinoWindows.dll).

When we open a Rhino file in this standalone ViewportControl. if this file is saved with a Rhino floating viewport, a floating viewport is also opened with the standalone window . The second column corresponds to the events of this floating viewport.

ViewportControl and floating window

tongbong commented 3 years ago

Thanks @corbane for reacting quickly.

I understand that in your case the floating viewport is saved inside the file. With the command I run, I feel I suffer the same behavior than you. May I ask what you are trying to achieve / or goals ?

In my case, I am looking for a full featured 3D viewer with a strong 3D geometric kernel to display data inside a standalone application. And I see Rhino Inside as a promising package.