[BUG] ghgl Edit code... window stuck behind Grasshopper!

Hi @stevebaer,

Unfortunately, the Edit code… window of ghgl v7.1.0 - installed through PackageManager - still doesn’t appear to be working right in the latest, stable release of Rhino 7 (7.2.21012.11002, 2021-01-12) for macOS.

At first I thought that the previous issue with the window not popping up at all, still wasn’t fix. Then I noticed that it simply opens behind the Grasshopper window!

2021-01-14 16-03-57.2021-01-14 16_07_03

Like at Playboy Mansion - where everything that happens in the grotto, stays in grotto -, the editor window also remains positioned behind the Grasshopper window no matter what!

Guess I need to wait for another update. :slight_smile:

Addendum
Setting the glLineWidth… parameter for the GL Shader component also does nothing. The displayed line width remains the same, whether I change it to 0.1 or 16.0! However, glPointWidth… seems to be working fine.

Addendum II
Wow, otherwise the code editor is great. Your autosolve works fast and code completion is snappy, too! Can you please implement these amazing changes in the GHPython component, which editor-wise has been - sorry - a trainwreck since Rhino 5? Great job! :slight_smile:

Addendum III
Using _time also doesn’t seem to work! Nothing is animated, but when I constantly recompute things move.

Addendum IV
Each time you double-click the GL Shader component or select Edit code… while right-clicking on it, an individual editor window gets opened! I didn’t notice that, until I tried to close Rhino (and it crashed). The code editor windows were hidden behind the Rhino window.

You need to set Draw Mode to GL_LINES, GL_LINE_LOOP, or GL_LINE_STRIP for the line width to have any effect

I got pretty far on this feature in V7, but still need to do quite a bit of work to solve the case of not completely locking up Rhino when you accidentally create an infinite loop while typing.

Works for me. I’m not currently testing on a Mac though

1 Like

Yes, I know. I followed your tutorial on Vimeo. It does not work, I’m telling you. I’m not exactly a total shader noob. I’ve messed with OpenGL in C++. :wink:

:slight_smile:

Doesn’t seem to work here. I also got this from your tutorial, the code I mean. Maybe somebody else could verify this?

Hi, @stevebaer awesome tool! I have the latest update on Mac and Windows but the Edit Code window not popping up in both systems. Literally, nothing appears.

Then, related only to Mac as @diff-arch mentioned

and also in the case of using multiple shaders the Sort Order option doesn´t work, it only shows one shader
but seems that the Mac version has some bugs, sometimes when I open a file, the shader shows nothing…
Thanks for your support.
T.

1 Like

What version of Rhino are you using?

MAC. Rhino V7 (7.3.21053.23032, 2021-02-22)
WINDOWS Rhino V7 (7.3.21053.23031, 2/22/2021)
When I try to Edit Code on Windows this is the report RhinoDotNetCrash.txt, fortunately, it doesn´t close my rhino just generate the report, on Mac there is no report.

[ERROR] FATAL UNHANDLED EXCEPTION: System.MissingMethodException: Method not found: ‘Void Eto.CodeEditor.CodeEditor…ctor(Eto.CodeEditor.ProgrammingLanguage, Boolean)’.
at ghgl.ShaderEditorControl…ctor(ShaderType type, GLSLViewModel model)
at ghgl.GLSLEditorDialog.ShowTab(ShaderType type)
at ghgl.GLSLEditorDialog…ctor(GLSLViewModel model, Boolean includeTessellationShaders, String componentName)
at ghgl.GLShaderComponentBase.OpenEditor()
at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.WndProc(Message& m)
at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
[END ERROR]

@Alain did we break the SDK for our CodeEditor? It is ok if we did, I just need to know so I can update GhGL

1 Like

@stevebaer , not that I know of. I can check 1st thing tomorrow morning.

1 Like

In Rhino 7.4 for macOS, I’ve also noticed a couple of times that the shader display oftentimes doesn’t refresh! When I use the GL Shader component to make for instance a custom point display - it usually works -, but when the component is deleted from the GH canvas the custom display remains visible in the Rhino scene. I haven’t found a way to get rid of it, other than relaunching Rhino.

My observations from my initial post also still remain valid, I’ve just given up on trying to use for example the CodeEditor, since the bugs are so unpredictable. I’m eagerly waiting for an update of ghgl though.

@steve, I don’t see any changes with the code editor and even though the window shows up as expected on my windows machine it does stays behind the main Grasshopper window on macos. If I reference the macos Grasshopper assembly and use one of the ‘Show’ EtoExtensions it shows up in front. I’ll create a YT issue.

We have to reference a different assembly to get access to some extension functions?

It looks that way. Those extension methods are part of the shim that makes Grasshopper work on the mac. I’ll investigate more in case I misunderstood something. I’ll add my notes to he YT issue.

It looks like Rhino 7.6 fixes this issue

Unfortunately, there still seem to be lots of issues in 7.6 for macOS!

glLineWidth still does nothing, like already mentioned in January above. The Draw Mode settings work fine, but GL_LINE, GL_LINE_LOOP, and GL_LINE_STRIP only display a very, very fine line that, depending on the colour, can barely be noticed in the viewport.

A minor bug happens, when double-click the component instead of opening the editor with right-click Edit code…. The Grasshopper keyword search box pops up at the mouse location each and every time.

At first, things work fine when playing with the GL Shader component, but after some time it completely gives up and stops working? It simply doesn’t refresh the Rhino viewport any more and playing with its inputs or internal code does nothing.

And like before the viewport doesn’t get cleared, when you remove the component from the canvas. Rhino needs to be relaunched to get rid of the display.

That’s as far as I went for now.

2 posts were split to a new topic: GhGL crash on Windows

I still need to look into these other issues. But first, does the script editor window stay on top?

Yes, that seems to be fixed.

The open editor, as well as the other editors (Python, C#, etc.) now seem to be children of the Grasshopper window, meaning when you select and move it, the editors follow.
Has this change been made recently, after the all editors were broken on macOS?

Thanks; I don’t know the details of the fix other than the GhGL editor used to work in the past, was broken for a while, and now works again. @Alain would probably have a better idea of the exact timing of the fix if you care to know.

Hi,
The problem where the editors were not showing up at all was caused by an incorrect Xamarin.Mac version. I think that the problem with the editor being behind Grasshopper was fix by improvements @curtisw made to Grasshopper.

I’m having the same issue of GHGL code editor opening behind the Grasshopper window in Rhino 7.5 on Mac OS. In the current Rhino 8 WIP, the code editor does not open at all. Would love to play with this!

While I’m posting… is it possible to access the output of the vertex shader for mesh coloring?