PDA

View Full Version : dotNet WPF window using Maxscript


Blanks
09-15-2009, 02:02 PM
Right so I managed to create a WPF window using maxscript but for some reason when I opened another window maxscript crashes. Sometimes the window doesn't open and i get a runtime error saying - dotNet runtime exception: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

Anybody know why. I really want this to work because WPF controls offer way more than winforms controls.

Could somebody try it there end. It may be my system.

heres the small code

myWindow = dotNetObject "System.Windows.Window"
myWindow.Show()

cyfer
09-15-2009, 03:33 PM
http://forums.cgsociety.org/showthread.php?f=98&t=741179

http://forums.cgsociety.org/showthread.php?f=98&t=775339

Blanks
09-15-2009, 04:11 PM
I guess I'll have to put my ideas on hold then until I can get a 64bit system. Thanks for the links. Don't know why sometimes it opens though.

biddle
09-17-2009, 06:26 PM
I guess I'll have to put my ideas on hold then until I can get a 64bit system. Thanks for the links. Don't know why sometimes it opens though.

I feel your pain.

The only way I was able to get WPF integration working reliably through maxscript was to re-compile the mxsdotnet.dlx plugin in DEBUG mode.

I found that I didn't need to modify anything, just compile and replace the plugin that ships with Max. The code is in the SDK in the samples\maxscript\mxsdotNet folder.

[I just checked and this 'fixes' the crash bug in your simple case for Max 2010 32 bit and it should work in Max9 through 2009 as well ...I've be trying to leverage WPF in Max for a while :/]


.biddle

PEN
09-17-2009, 07:24 PM
So Mike? This corrects the error on 32bit? Can we get the recompile from you?

cyfer
09-17-2009, 08:22 PM
it is working here too !
the only difference is the file got bigger with the Debug code

thanks biddle , now i Can Get Into Media Assemblies :applause:

biddle
09-17-2009, 09:21 PM
You can try compiling in release mode, I just got sick and tired of trying to pin down what worked with what and have stuck with the debug builds. If it did crash I could load it in the debugger.

Paul, what version(s) do you need a mxsdotnet.dlx for?

Let me know and I'd be happy to build 'em.

I've attached 2010 32 bit. (Make sure you save your original before you stomp it)

biddle
09-17-2009, 09:40 PM
Here's a little WPF demo.

I just verified that it works as far back as Max 9 (32bit) as long as you have a recompiled MXSDotNet.dlx

[EDIT: Whoops! The version I attached doesn't properly handle keyboard accelerators so the text input controls don't get any keystrokes. My bad, I'll fix it & upload again]

[EDIT#2: fixed the text input]

PEN
09-18-2009, 12:55 AM
Thanks Mike, I don't know if I can do anything with this as I don't really know what it does yet. I have lots of clients still on 32 bit so at least I can test it out now and see what i can do.

PEN
09-18-2009, 01:04 AM
Just did a quick read on WPF..and the rabbit hole goes deeper and deeper.

biddle
09-18-2009, 02:42 AM
I think the biggest takeaway is that you separate all the 'ui' code out into xaml leaving only the binding to events in a maxscript loader.

The xaml source file in that little demo was my first attempt to fiddle around with xamlpad.exe (http://msdn.microsoft.com/en-us/library/ms742398.aspx) and see if I could something to work.

PEN
09-18-2009, 11:13 AM
I have already started working on storing UI's in XML files and then I saw this. I have another big project that I would like to add to my RAIC system and I could really use this. Problem is I don't want to have to rely on my clients having to install and over write DLL's.

Blanks
09-19-2009, 07:04 PM
Thanks Biddle I'll give it a try.

CGTalk Moderation
09-19-2009, 07:04 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.