Well, It seems there isn’t a general solution for this. What if I limit my request to very specific and managed situation:
We can create or extend our controller and use it for the property.
We need to only support float type.
We have also control over MSX side.
Performance is important but at least I need one working method.
you already have it built-in in recent max versions…
it has “getValue” handler. You can use it for updating your UI control
I already used this feature in my rigging a lot and works perfect.
Is it possible to create a plugin like this inside C#?
Another problem for me is I have to support Max 2014-2019.
Yes, you can create a Controller plugin with the NET.SDK, but it’s a pain in the ass.
The names in the UI won’t look fine and possibly you will need different versions for 2014, 2016 and possibly 2017 and up.
I think the user @48design knows how to overwrite the UI with WPF, but he has not time to write an snipet.
Sorry, What you mean by
The names in the UI won’t look fine and possibly you will need different versions for 2014, 2016 and possibly 2017 and up.
The strings for the parameters block are not encoded correctly, so in your UI you will see instead of your parameter name for example “width” you will see a mix of extrange characters. This was solved, if I remember, in version 2017.
For compatibility between versions, there are some methods you MUST override that have changed, for example:
- in Max 2014:
public override RefResult NotifyRefChanged(IInterval changeInt, IReferenceTarget hTarget, ref UIntPtr partID, RefMessage message) - in Max 2016
public override RefResult NotifyRefChanged(IInterval changeInt, IReferenceTarget hTarget, ref UIntPtr partID, RefMessage message, bool propagate)
There’s one more parameter! Surely someone with better knowledge of C# can avoid this problem by asking for the max version and creating an #if , but I don’t.
And there are things that desappear (I don’t remember exactly, but after days to get something working, when I tryed it with 2017 version this cammand didn’t exits).
Got it, Thanks, I guessed Autodesk.max is changed over the time.Note that I don’t want to replace native controls. My UI is completely separate window snapped over the Max UI, So I don’t need to interact with parameterblocks or any other max controls. My pipeline is to create a WPF library include my windows, panels and controls. then I will load it as runtime dll in max. I will add eventhandlers and properties and bindings as much as possible in C#, But sometimes I had to add some eventhandlers in Max. In case the custom controls such as spinner, I prefer to add controller property in C#, because I’m pretty sure is much faster than MSX.
You right, I shouldn’t say that without measuring…, But I want to say working with available methods inside a class like IControl is faster compare to call a MaxScript function by using C# and “ExecuteMAXScriptScript” to return a value.
Hi!
As I got mentioned here: indeed I didn’t have time, yet, because my little son was born and eats all of my time…
In fact I am not able to overwrite the UI with WPF, I do only open/close a WPF window when opening/closing the parameter dialog.
Best regards