Viewport Control Bugs

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.

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.

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.

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

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.

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

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?

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.

Thanks, good to know.

1 Like

Is this debate between programmers?

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.

1 Like