[Closed] Format to newScript
Can I format a string into a new script in a way that the new mxs compiler (max9 and on)
will be opened and not the old one?
in short: no
in long: you can format to a file and then open that file into the new editor. This is only useful if you only need an ‘end result’ opened (you can’t format to it again and automatically see the results in the editor) and don’t have to worry about closing the editor window/tab.
other than “they simply didn’t implement any of that”? Maybe in the next version – would be nice, as hopefully that would mean the scripts opened with PFlow would open in the new editor as well (right now you’d have to hack about with a timer that watches for the temporary file).
What I’m looking for is even more complicated,
I want it to work like the script operator / birth script operator in particle flow
where you can open a script in a new window, edit it and close.
The next time you open the script it will be the updated script.
I want the script to be saved as a string value in a local / global variable declared in a rollout definition.
Any ideas on how to approach this?
Richard – I see you’ve already answered my question before I managed to type it.
can you explain yourself on the temporary file watching idea?
Matan, what is it that you are actually trying to achieve? Can you store it as a string value in a CA Def?
I would go with Paul’s recommendation of a Custom Attribute block for the actual storage… that or a Scripted Plugin… depends a bit on what you’re working on.
Once you have the string, you need to get it into a window, still.
So format the string to a file, and once done, grab the file’s modification date. Then call “edit <filespec>” to open the file in the new editor, and start a timer (rollout or .NET) that essentially just looks for the modification date of the file. If the user saves the file (you’ll have to instruct them to do so), then do whatever it is you want done when the file changes. Include a button (or build in a timeout e.g. 30 minutes without file activity = assume the user’s done editing) for when the user is done editing so you can stop the timer.
You’ll have to jump through some hoops, as you can tell, largely due to the lack of access to the new editor. Not that you’d be all that much much better off with the old editor, mind you
dotnet provides a class called filesystemwatcher that could simplify the process of this somewhat. It provides a changed, created and deleted event that allows you to trigger a function when a file is modifed etc. Im not sure exactly how this could help, but it might simplify the notification process.
Thanks for the replies,
Paul – I guess I wasn’t clear enough, I don’t need the script to be stored in the scene
but only while my rollout is opened so there is no need to store the data in a CA.
Anyhow I think I can manage with a simple multi text box,
I don’t want it to get too messy.
Again, thanks fo all your help,
and I hope Autodesk will implement this in the near future!