PDA

View Full Version : Can I save changes made in XRef Scene (by using tree.children[…])


Tertium
05-17-2008, 07:09 PM
Manual says XRefScene.tree is readonly. I can change objects in XRef scene like this:


--assume myxrefscene1 is scene from file “myfile1.max” included in current file - “main.max”
myxrefscene1.tree.children[1].material.diffuseMap.filename = “c:\\1\\fff.jpg”


But of course when i save current working file - main.max - and reload it i see that no changes saved in edited object of myfile1.max.
Is there any way to save changes in scene from another, which including it as xrefscene?
Or maybe some hacks to do that? (but not opening it in max and edit it smile )

DaveWortley
05-18-2008, 03:36 PM
I'm having the same issue.

I'm working on a solution to this, an interface that you could do all these changes in, and that interface would record it all, write it to a script file and that script file would load on file open.

Not a simple solution, there must be an easier way, but might envolve more hard-core coding in the SDK. I've got a post in this forum somewhere about it.

thatoneguy
05-19-2008, 09:18 AM
I've also been toying with this. My most promising solution so far has been to create a "open XRef" mode which really just means merge it in but store a list of all the objects that were in the scene and then then save the objects back out as to XRef file.

I haven't finished it yet though because it gets tricky when it comes to ignored object types such as lights. It then has to keep track of what it merged in already and what is new and handle it outside of the XRef merge scene function as a result.

Unfortunately I won't be able to work on ProfessorXref until sometime in june so it's up to you if you need something in the mean time. :D

Kramsurfer
05-20-2008, 01:22 AM
We have something similar to that here. It's basically a merge and delete function.
I have a helper object in the scene with a randomly generated ID on it as a custom attribute. This helper is then assigned a file to merge. It merges the full contents of the file when enabled and tags each object merged with that ID via Appdata. When disabled, it deletes them from the scene. There's also a save function, which allows you to save select all the objects tag with the ID back to the scene File... it was working great until max 9 and it's Save Selected slow down thing... for some reason, save selected from large files, even if it's ONE node can take several minutes.... Hoping Max 2009 does not have this issue...

I avoiding using the native X-ref System altogether... I've tested a #postopen callback that builds the max file pre render time, even over network rendering... that was the ulimate goal, I just doesn't have priority here..

good luck

CosyTo
05-30-2008, 04:39 PM
I'm having the same issue.

I'm working on a solution to this, an interface that you could do all these changes in, and that interface would record it all, write it to a script file and that script file would load on file open.

Not a simple solution, there must be an easier way, but might envolve more hard-core coding in the SDK. I've got a post in this forum somewhere about it.

I made a script a long time ago that did something similar. The trick was to write all modified properties into the object custom properties as small code lines. Another small general script can read those values and re-apply them. That way you do not have to hard-code the all modified properties, the object takes care of it by themselves. That general script was embeded into the max file and launched upon opening the file or modifying an XRef source. It worked very well.

CGTalk Moderation
05-30-2008, 04:39 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.