Critical Panel error in RhinoWIP

Version : (6.0.17164.11481, 13-Jun-17)

My plugin adds a panel (the OctaneRender panel). When the user adds this panel to their UI, or opens the panel, Octane is authenticated and a bunch of other key initialisation code is run.

However in RhinoWIP, the construction of my form is being called everytime a .rhi is opened (AFTER ReadDocument()). This is causing my plugin initialisation code to be run AFTER the scene BinaryArchiveReader has been read, causing a lot of problems (not the least being all Octane data is being wiped). This does not happen in Rhino5, and is a breaking change for my plugin.

Is this a bug in RhinoWIP, or a fundamental change to the addin UI system pls? If the later, is there some documentation of the change, so that I can plan a resolution? And why would the UI panel be re-created when opening a scene? The panel has not changed, and is docked in the Rhino tab panel.

Thanks

Paul

Paul

I’ve made some major changes to the panels during the last few weeks. I will work with you on this starting from Monday to make sure this works for you.

Andy

Hi @andy, any news on this pls?

Paul

The panels are being changed so that code that is written for them will work on the Mac version of Rhino. To this end, it will now be (theoretically) possible to create multiple panels of the same type, and have similar panels running at the same time with views onto different documents.

Note that on the Mac, there are, by default, two panels for each thing - two object properties, two layers - etc etc. And if you have multiple document windows open, there are 2 x num documents.

The work on the C# panels is not entirely finished, but what you can expect is that on Windows, panels will be closed when a document is closed and opened when a document is opened. And you will be able to query the panel to determine which document it should display data for.

There is, on the C++ at the moment, a way of making panels have no “Document context”. This is for panels like the libraries panel, or the notifications panel that have application context. However, I’m not entirely convinced this is going to work on the Mac - you could still have several of those panels open, even if they don’t show the details of the document they are docked into.

I would say your key problem is that you are predicating a pile of important initialization code on how our panel system works. I wouldn’t do this - any initialization needs to be done in OnLoadPlugIn or something similar.

However - if you really can’t do it any other way, let’s work out a way that this could work for you.

  • Andy

Thanks Andy

I would say your key problem is that you are predicating a pile of important initialization code on how our panel system works. I wouldn’t do this - any initialization needs to be done in OnLoadPlugIn or something similar.

I agree - I have pulled all that code out of the panel now.

However, having multiple panels for a single information source does not seem a particularly robust solution. If a user modifies an Octane parameter in one OctaneRender tab - how is the second OctaneRender tab going to be updated to match? And if RHino updates the second, how is Octane going to know that the panel change was Rhino sync’ing the two panels rather than an actual change initiated by the user?

There are times when the Octane render engine needs to update the OctaneRender tab - but how will it know which to update? A single Rhino scene translates to a single Octane nodegraph - and there can only be one OctaneRender panel for that scene otherwise it gets incredibly confusing for the user.

Paul

@andy, @dale Further to the above, I need to initialise Octane data when a scene is created or loaded. However ReadDocument() is only called when loading a scene which contains previously saved Octane data. How can I detect when a scene has been created pls, or loaded without Octane data? I need a solution which works with both Rhino5 and Rhino6.

Thanks

Paul

Hi @pkinnane,

If you want to know when Rhino creates a new model or when it opens an existing model, then provide a handler for the following events:

RhinoDoc.NewDocument
RhinoDoc.BeginOpenDocument

Here is an example that may be helpful.

https://github.com/mcneel/rhino-developer-samples/tree/wip/rhinocommon/cs/SampleCsEventWatcher

Does this help?

– Dale

Paul

I don’t know if you’ve looked at the Mac version, but that’s the way it is right now. It’s not for me to judge whether this is a good design, but I at least have to make it so that the SDK allows this.

The way it works in the panels is that an event is raised when there is new information for a panel to display, and the panel does simply updates it’s information from its information source. When the information is changed, the model code must raise the event. It’s pretty simple and works well.

Your model code (“Octane Render Engine”) should never know anything about it’s view (UI). It should only know that events need to be raised when data is changed. The views have the responsibility to react to the events.

In the over loaded function ReadDocument I fill the information of my panel. But now, in Rhino 6 it doesn´t work because a new panel is automatically created after reading the document. So the read information has been lost.
Can I prevent from the creation of another panel every time readDocument is called? Or where can I fill the readed information from the document into the panel?

Thanks

Hi @Eliseo,

Rhino does not create panels when it reads documents. It does, however, re-open all panels that were open when Rhino last closed.

Does this help?

– Dale

Hi Dale,

The execution of the program goes through the contructor of the panel every time I open a document…