Rhino7 - SimulateMaterial is never called


This code runs fine under Rhino 6, but under Rhino 7 SimulateMaterial is never called.
Has it been changed since Rhino6?

public class MyMaterial : RenderMaterial
	public override string TypeName => "My Material";
	public override string TypeDescription => "My Material";

	public override void SimulateMaterial(ref Material simulation, bool isForDataOnly)
		// code never reaches this ...


Not sure, but I have logged https://mcneel.myjetbrains.com/youtrack/issue/RH-58946 to track this issue.



Sorry this has taken so long - the answer is that it was deprecated and is no longer called:

/// [Obsolete(“SimulatedMaterial with TextureGeneration instead, and don’t override this virtual function”)]


I understand it now!

And after checking the assembly I see now a new function:
PhysicallyBasedMaterial SimulatedPhysicallyBasedMaterial(RenderTexture.TextureGeneration tg);

Is it possible to set the physically based simulation for my material too? (this one is not a virtual function)


Just call material.PhysicallyBased.etc to set the values. Renderers that support PBR can choose to do so. Otherwise they will use the base line material…which you set in the normal way.

SimulatedPhysicallyBasedMaterial.will create a PBR guess from the non-PBR simulation.

It should be non-virtual…

Thanks for the info.

By the way, as in this case the RhinoCommon for Rhino 7 contains different declaration as RhinoCommon for Rhino 6.

Do you have recommendation for what is the best policy to support both version of Rhino?

I should create different plugin versions for Rhino 6 and Rhino 7 - right? There is no other way to do it?