Save/Load render preset (.rps) inside maxfile. Possible?

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Display Modes
  11 November 2013
Save/Load render preset (.rps) inside maxfile. Possible?

Is it possible to save/load a binary file inside of max file?
For example. render preset file and uvw file.
  11 November 2013
something like this ?

fn EncodeOnRootNodeDemo = 
 	if (fname = getOpenFileName caption:"load UVW" types:"UVW File(*.uvw)|*.uvw|" ) != undefined then
 		if (fstream = fopen fname "rb") != undefined then
 			fseek fstream 0 #seek_end
 			maxlen = ftell fstream
 			fseek fstream 0 #seek_set
 			ss = StringStream ""
 			for i = 1 to maxlen do print (ReadByte fstream #unsigned) to:ss
 			fclose  fstream;
 -- attach it to root node appdata		
 		setappdata rootnode 666 ss
 -- now the proof		
 		savemaxfile "this_is_appdata_test.max"
 		resetMaxFile #noPrompt
 		loadMaxFile "this_is_appdata_test.max"
 		ss = StringStream (getappdata rootnode 666);
 		if (fstream = fopen ((getFilenamePath fname) + "new.uvw") "wb") != undefined then
 			while not eof ss do WriteByte fstream (readvalue ss) #unsigned
 			fclose fstream;

Last edited by Klunk : 11 November 2013 at 12:10 PM.
  11 November 2013
Nice! Thanks!
  11 November 2013
OK.. finally I had time to play with your code.
This is what I'm trying to do.

I want to run renderpresets.Save command and save *.rps data in the scene.
The problem is that I don't want to save temp rps file on the drive.
I want to put the data directly into appdata.
Then I want to load the appdata using renderpresets.Load

  11 November 2013
think you are always going to have to use temp files somewhere along the line but they can be deleted once they have been used as the data will reside in the max file.

saving could be like...

save the rps as a temp file.
read back in and attach to the rootnode
delete the rps file.

restoring would then be...

write the rps from the rootnode data to temp rps file
load the temp rps file
delete temp rps file
  11 November 2013
Thanks for reply.
I guess I need to find a better solution.

  11 November 2013
Thread automatically closed

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.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 02:01 AM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.