Viewport Control Bugs


(Steve Baer) #1

The viewport control really only got to an initial prototype level. I’m sure there are a ton of features that need to be added and probably more than one bug that needs to be fixed. Let me know when you run into anything that doesn’t seem quite right with this control.


Say Hello to Aviary
(David Mans) #2

Thanks Steve,
It really is an incredible asset to have and the ease of implementation is great.
I’m curious where the issue with changing the viewport shading is coming from as it was working in the demo we saw. The issues I’ve run into are have just been those listed above in a WPF control:

  • Changing Viewport Display mode
  • Zooming
  • Panning
  • GH Geometry Preview

I’m going to build out a little test project to launch from Grasshopper and host the controls in WPF, Winforms, and Eto for comparison.


(Steve Baer) #3

I’ll look into these. I’m prototyping an on-canvas viewport using this control and I’m sure I’ll run into the same problems.


(Steve Baer) #4

I’m able to repeat the bug where no GH geometry preview is being displayed and am investigating it today.


(Steve Baer) #6

Man, this control will eventually be super powerful, but right now it’s still a bit rough around the edges. For now, if you want GH geometry to show up in the control set the viewport name to “GH_HACK”

ctrl.Viewport.Name = "GH_HACK";

Grasshopper checks viewports to see if it should draw in them and it thinks that this control looks like a material preview window. The GH_HACK was added a while ago as I was trying to figure out how to tell GH it’s ok to draw in this viewport.


(Steve Baer) #7

I’m going to build in some default mouse wheel behavior for zooming, but for now you could override OnMouseWheel on the control and call Viewport.Magnify(x, false) Make x something like 1.1 when the wheel event delta is positive and 0.9 when the delta is negative


(David Mans) #8

Great, I’ll check these two techniques out tonight to prototype some interfaces I’m working on. Looking forward to the real deal, but this still opens up some pretty incredible opportunities.

On a side note, would this control work with Layouts?


(Steve Baer) #9

No, that would be a much bigger project. Just getting the OpenGL viewport embedded has been a bit tricky and we need to make that work well first.


(David Mans) #10

Thanks, good to know.


#11

Is this debate between programmers?


(David Mans) #12

Test of the “GH_HACK” name.
Updates are triggered by manually refreshing the viewport as it does not update when changes are made in rhino viewports. This accounts for the current lag.