CGTalk > Software > Autodesk 3ds max > 3dsMax SDK and MaxScript
Login register
Thread Closed share thread « Previous Thread | Next Thread »  
 
Thread Tools Search this Thread Display Modes
Old 11-13-2013, 09:07 AM   #1
gandhics
Expert
 
gandhics's Avatar
Changsoo Eun
VFX Artist
FuseFX
USA
 
Join Date: Sep 2002
Posts: 828
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.
 
Old 11-13-2013, 11:48 AM   #2
Klunk
Lord of the posts
 
Klunk's Avatar
portfolio
Klunk
United Kingdom
 
Join Date: Sep 2005
Posts: 701
something like this ?

Code:
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; ) ) ) EncodeOnRootNodeDemo();

Last edited by Klunk : 11-13-2013 at 12:10 PM.
 
Old 11-13-2013, 07:56 PM   #3
gandhics
Expert
 
gandhics's Avatar
Changsoo Eun
VFX Artist
FuseFX
USA
 
Join Date: Sep 2002
Posts: 828
Nice! Thanks!
 
Old 11-19-2013, 09:50 AM   #4
gandhics
Expert
 
gandhics's Avatar
Changsoo Eun
VFX Artist
FuseFX
USA
 
Join Date: Sep 2002
Posts: 828
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

Thanks.
 
Old 11-19-2013, 01:28 PM   #5
Klunk
Lord of the posts
 
Klunk's Avatar
portfolio
Klunk
United Kingdom
 
Join Date: Sep 2005
Posts: 701
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
 
Old 11-20-2013, 09:05 AM   #6
gandhics
Expert
 
gandhics's Avatar
Changsoo Eun
VFX Artist
FuseFX
USA
 
Join Date: Sep 2002
Posts: 828
Thanks for reply.
I guess I need to find a better solution.

Thanks.
 
Old 11-20-2013, 09:05 AM   #7
CGTalk Moderation
Lord of the posts
CGTalk Forum Leader
 
Join Date: Sep 2003
Posts: 1,066,481
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


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
CGSociety
Society of Digital Artists
www.cgsociety.org

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

All times are GMT. The time now is 12:14 PM.


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