Rhino6 Win RhinoCommon questions

Hi - some comments and questions on the recent build of Rhino 6…

  1. Changing method names (like ShowMessageBox changes to ShowMessage) makes it a lot amount of work to have one codebase for both Rhino5 and Rhino6, filled with #if RHINO6 statements, and doesn’t add any functionality.

  2. warning CS0618: ‘Rhino.Render.RenderContent.AddPersistentRenderContent(Rhino.RhinoDoc, Rhino.Render.RenderContent)’ is obsolete: ‘Use RhinoDoc.RenderMaterials.Attach’ - there is no RenderMaterial.Attach method.

  3. ‘Rhino.Render.UI.IUserInterfaceSection’ is obsolete - what is it replaced with pls?

Thanks

Paul

2 Likes

Hi Paul,
Feel free to continue to call the ShowMessageBox function. We thought at one point that we were going to have to remove any reference to Winforms in RhinoCommon to get things to work on Mac. The ShowMessageBox function was returning a WinForms enum which is why it was marked as Obsolete. It will continue to work in V6 and more likely I will just remove the obsolete flag but keep another flag around to hide this function from autocomplete in Visual Studio in the future.

Thanks Steve.

Additional question,

  1. Where did Rhino.RhinoDoc.ActiveDoc.RenderMaterials.Render go pls?

  2. What is the deprecated Rhino.Render.RenderEnvironment.CurrentEnvironment returning? Is it returning ForAnyUsage? Is there source for the Rhino6 RhinoCommon on-line so I can look at this stuff myself?

Thanks

Paul

I’m going to need to have @andy jump in on these other questions.

@pkinnane,

I’m not finding Rhino.RhinoDoc.ActiveDoc.RenderMaterials.Render in the documentation, nor can I find it in the RhinoCommon SDK when I start a fresh C# project in VS2010. What was this supposed to do?

It returns background environment (or default if there isn’t any).

/Nathan

Thanks @nathanletwory. Any ideas on questions 2) and 3) above pls?

I’m not finding Rhino.RhinoDoc.ActiveDoc.RenderMaterials.Render in the documentation, nor can I find it in the RhinoCommon SDK when I start a fresh C# project in VS2010. What was this supposed to do?

It has vanished for me too - so it must have been in a previous version of Rhino WIP. Pls disregard this issue.

I have got the Octane plugin running, but there are a few show stoppers.

  1. When I close Rhino, Rhino is re-opening the Octane panel (ie. recreating the form) - which crashes Rhino. To replicate this, download the Rhino WIP demo version of the plugin from https://my.pcloud.com/publink/show?code=XZxdmNZkYIhB4kcPrVLS8XNfaDIbuM3Gd70 . Start Rhino, install the plugin, click the Gear icon on the tabs panel and add the OctaneRender panel. Then close Rhino, and it will crash (because Rhino is re-creating the OctaneRender panel for some reason).

  2. Materials are a bit of a mess. Start Rhino, click the Gear icon to add the OctaneRender panel, then click the Materials panel, + Octane Material, click on the Diffuse tree item and change the node type to Turbulence. The scrollbars should appear on the Material panel now (make the Rhino window smaller if it does) - move the scrollbar and all the widgets render artifacts on the screen.

Paul

I see the crash happening, for some reason your handlers are getting called in your HostMaster. I am in the process of rebuilding my dev machine with new SSDs (suspected drive failure causing all kinds of weird errors). Until I get that done and can have a better look could you try unregistering any events you have registered to Rhino during plug-in shutdown?

I see it is enough to just start scrolling in the material once added. This UI is created with Winforms, right? Reported as RH-39124.

/Nathan

Hi Paul, look here.

c.

Thanks Nathan - I will try unregistering the events in Dispose (although there are a lot of them!). This was not needed in Rhino5. FYI, I can see that the form constructor is being called when Rhino is shutdown.

Add the OctaneRender panel to the tabs

  • OctaneRenderForRhinoPlugIn.OnLoad
  • SetupForm constructor

Close Rhino

  • SetupForm.dispose
  • SetupForm constructor
    crash

This UI is created with Winforms, right?

The panel causing issues is created as follows. I have had issues in Rhino5 too (and reported it to you a couple of years ago), but for some reason it is much worse in Rhino6.

    public partial class OctaneMaterialTreeControl : UserControl, IUserInterfaceSection
    {
        public OctaneMaterialTreeControl()
        {
            SetStyle(ControlStyles.ResizeRedraw, true);
            InitializeComponent();
            this.groupBoxMaterials.HandleCreated += new EventHandler(groupBoxMaterials_HandleCreated);
            this.Anchor = AnchorStyles.Bottom | AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
            this.ClientSizeChanged += new EventHandler(OctaneMaterialTreeControl_ClientSizeChanged);
            this.HandleCreated += new EventHandler(OctaneMaterialTreeControl_HandleCreated);

            etc

Thanks

Paul

As extra failsafe you could also set a flag in your PlugIn.OnShutdown, and ensure you don’t call into anything Rhino.RhinoDoc once it is set.

This is a workaround attempt, and shouldn’t be necessary. I reported as RH-39142 .

Thanks Nathan

Hi @pkinnane,

Could you link me to an updated version of your plug-in, so that I can test it against a local build with a fix to the problem you reported?

Thank you,

/Nathan

Hi @pkinnane,

If you could test against latest public WIP that’d be great. The issue should be fixed.

Thank you,

/Nathan

@pkinnane,

Any chance you could test this, please? I’d like to get confirmation the bug is now properly fixed.

Thank you,

/Nathan

@nathanletwory - sorry for the delay - I got sidelined with some other work. I can confirm that this bug IS fixed in the next Rhino6 release.

Thanks

Paul

@pkinnane, thank you for the confirmation!

/Nathan

RH-39124 should be fixed in the latest RhinoWIP. Please give it a try.

Hi - this was fixed correctly in a previous release, but unfortunately this problem is worse than ever in the current RhinoWIP release (6.0.17262.13121, 19-Sep-17).

Paul

Hi @pkinnane,

can you maybe provide a new build of your plug-in for us to test? If you want to keep it private please send it as a direct message to me on Discourse.

/Nathan

Thanks @andy. I have re-engineered my plugin as you describe - but it was substantially more complex than I thought it would be - and I still have a lot of issues.

For instance - Rhino.PlugIns.RenderPlugIn.CreatePreview() is not being called when I click Thumbnails->Update All Previews.

Paul