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 02-19-2013, 09:16 AM   #1
sarboon
New Member
Ignatius Low
Indonesia, Indonesia
 
Join Date: Apr 2006
Posts: 6
Setting render output path via Metadata Stream

Hi,

I would like to set the render output path of max files without opening the max files as the files might be large and it doesn't make sense to load up files just to set render output path.

Is it possible to set it by altering the metadata stream? I am able to load the bitmap assets with getMAXFileAssetMetadata and then alter and write them back with setMAXFileAssetMetada. However this changes all the paths of all bitmaps including the render output path of completed renders. Is there some way to change only the renderoutput path without affecting the rest of the assets?

Many thanks
 
Old 02-19-2013, 08:17 PM   #2
Swordslayer
isKindOf Artist
 
Swordslayer's Avatar
portfolio
Vojtech Cada
3D generalist
Czech Republic
 
Join Date: Jun 2006
Posts: 376
Send a message via ICQ to Swordslayer
Hi, it depends, some of the output files have #RenderOutput type but render elements and other output types are just #Bitmap - however checking if the file at path (either original or replaced) exists (for example using doesFileExist function) should give you enough information to make the decision.
__________________
Blog :: LinkedIn profile
 
Old 02-20-2013, 02:06 AM   #3
sarboon
New Member
Ignatius Low
Indonesia, Indonesia
 
Join Date: Apr 2006
Posts: 6
Quote:
Originally Posted by Swordslayer
Hi, it depends, some of the output files have #RenderOutput type but render elements and other output types are just #Bitmap - however checking if the file at path (either original or replaced) exists (for example using doesFileExist function) should give you enough information to make the decision.


doesFileExist simply returns either true of false and it only queries the current open scene?

I am new to maxscript and am trying very hard to wrap my head around it.

Thanks in advance for the patience

Last edited by sarboon : 02-20-2013 at 06:27 AM.
 
Old 02-20-2013, 07:47 AM   #4
Swordslayer
isKindOf Artist
 
Swordslayer's Avatar
portfolio
Vojtech Cada
3D generalist
Czech Republic
 
Join Date: Jun 2006
Posts: 376
Send a message via ICQ to Swordslayer
That's okay, doesFileExist <filename_string> checks whether the string you pass to it is a valid file or directory (any file or directory, no relationship to the current scene or 3ds max at all). Output files that are not rendered yet don't exists, whereas texture bitmaps (for example) do exist (if they don't there's a problem, anyway).
__________________
Blog :: LinkedIn profile
 
Old 03-04-2013, 06:55 AM   #5
sarboon
New Member
Ignatius Low
Indonesia, Indonesia
 
Join Date: Apr 2006
Posts: 6
Quote:
Originally Posted by Swordslayer
That's okay, doesFileExist <filename_string> checks whether the string you pass to it is a valid file or directory (any file or directory, no relationship to the current scene or 3ds max at all). Output files that are not rendered yet don't exists, whereas texture bitmaps (for example) do exist (if they don't there's a problem, anyway).


Thanks for that. It definitely pointed me in the right direction and was a good way to go about handling the problem that I didn't think of. Let me give it a try first. I'll probably get stuck but at least I am headed in the right direction.
 
Old 03-05-2013, 08:47 AM   #6
sarboon
New Member
Ignatius Low
Indonesia, Indonesia
 
Join Date: Apr 2006
Posts: 6
Quote:
Originally Posted by Swordslayer
Hi, it depends, some of the output files have #RenderOutput type but render elements and other output types are just #Bitmap - however checking if the file at path (either original or replaced) exists (for example using doesFileExist function) should give you enough information to make the decision.


What if I managed to get the asset ID of the file to repath. How would one go about altering the path of just that particular file with setMAXFileAssetMetadata?
 
Old 03-05-2013, 09:03 AM   #7
Swordslayer
isKindOf Artist
 
Swordslayer's Avatar
portfolio
Vojtech Cada
3D generalist
Czech Republic
 
Join Date: Jun 2006
Posts: 376
Send a message via ICQ to Swordslayer
Then it's simple:

Code:
outputData = for data in assetMetadata where data.assetId == assetId do exit with data


Repath it, set the asset metadata and you're done.
__________________
Blog :: LinkedIn profile
 
Old 03-26-2013, 06:25 AM   #8
sarboon
New Member
Ignatius Low
Indonesia, Indonesia
 
Join Date: Apr 2006
Posts: 6
Okay that took me a while to work through. But more specifically, after the metastream is loaded into an array, how would one go about altering the path of the bitmap that matches the asset ID?

I have gotten the metadatastream loaded into the array. I can only set path of the current open scene with asset ID. What do I look at to alter the array? Is it a case of looping it to another array and checking at each loop for a matching assetID? and then if there is a match replace the path and store it in the new array?

Code:
(AssetMetadata_StructDef assetId:"{A5F0CDC8-DBA7-4E27-A452-71F142398860}" filename:"c:\temp\picture1.jpg" type:#bitmap), (AssetMetadata_StructDef assetId:"{038B1AA9-27F4-4552-A5FB-91644ADB9E1D}" filename:"c:\temp\picture2.jpg" type:#bitmap), (AssetMetadata_StructDef assetId:"{0860F962-85BD-4F08-9480-2421D77E6029}" filename:"c:\temp\picture3.jpg" type:#bitmap))
 
Old 03-26-2013, 07:11 AM   #9
Swordslayer
isKindOf Artist
 
Swordslayer's Avatar
portfolio
Vojtech Cada
3D generalist
Czech Republic
 
Join Date: Jun 2006
Posts: 376
Send a message via ICQ to Swordslayer
Just reread my last reply, it still applies. Example code would then be:

Code:
( local file = maxFilePath + maxFileName local assetMetadata = getMAXFileAssetMetadata file local elementMgr = maxOps.getCurRenderElementMgr() local elementMax = elementMgr.numRenderElements() for element = 0 to elementMax do ( local filename = elementMgr.getRenderElementFilename element local asset = filename as AssetUser local assetID = asset.getAssetId() local outputData = for data in assetMetadata where data.assetId == assetId do exit with data outputData.filename = substituteString outputData.filename "C:" "D:" -- for example ) setMAXFileAssetMetada file assetMetadata )


Not at max now to test it so the way I'm getting assetID there might not work as I expect it to (I recall being able to get AssetUser from .filename property of a bitmapTexture but no luck with it when using the exact same string coming from elsewhere) but as you already have that part working, just plug it in.

Of course you could collect all the render elements' filenames in advance and then loop the assetMetadata once, this is just a sample to get you going.
__________________
Blog :: LinkedIn profile
 
Old 03-31-2013, 07:23 PM   #10
MZ
Expert
 
MZ's Avatar
portfolio
Mehdi Zangeneh
Animation TD
Bina Film
Tehran, Iran
 
Join Date: Sep 2007
Posts: 360
Quote:
Originally Posted by sarboon
Hi,

I would like to set the render output path of max files without opening the max files as the files might be large and it doesn't make sense to load up files just to set render output path.



3dmax do not have a good metadata!, I always use a callback to write all data to a text file. by using 3dsmaxcmd you can render a file by your own render settings include output path, preset, output size, frame range,... without opening max file.
__________________
http://3dcutout.com/
 
Old 04-05-2013, 01:28 AM   #11
sarboon
New Member
Ignatius Low
Indonesia, Indonesia
 
Join Date: Apr 2006
Posts: 6
Quote:
Originally Posted by MZ
3dmax do not have a good metadata!, I always use a callback to write all data to a text file. by using 3dsmaxcmd you can render a file by your own render settings include output path, preset, output size, frame range,... without opening max file.


Are you manually starting the renders with 3dsmaxcmd or are you using a rendermanager?

I have finally managed to repath all the assets on the max file to realize 3dsmaxcmd doesnt seem to like paths set my setassetmetadata. I need to load up the max file, save it again before 3dsmaxcmd seem to recognize the updated path.

Anyone else seem to notice that behavior with 3dsmaxcmd and setassetmetadata?
 
Old 04-05-2013, 11:40 AM   #12
MZ
Expert
 
MZ's Avatar
portfolio
Mehdi Zangeneh
Animation TD
Bina Film
Tehran, Iran
 
Join Date: Sep 2007
Posts: 360
I know using command-line(cmd) is a little tricky, you can use hiddendoscommand inside maxscript to execute command-line. if you want to render a file by specific outputpath then run this functions:

fn QMark Txt = "\""+Txt+"\" "

fn CMDRender MaxFile:"" OutputName:"" =
(
Str = QMark ((getdir #maxroot)+"3dsmaxcmd")
Str+= QMark MaxFile
Str+= "-outputName:"+(QMark OutputName)
hiddendoscommand Str
)
--Example:
CMDRender MaxFile:"C:\CMDTest.max" OutputName:"C:\CMDTest.avi"

For more information about command-line just take a look at 3dmax help:

http://docs.autodesk.com/3DSMAX/15/...mber=d30e452436

http://docs.autodesk.com/3DSMAX/15/...mber=d30e452436

--
__________________
http://3dcutout.com/
 
Old 04-05-2013, 11:40 AM   #13
CGTalk Moderation
Expert
CGTalk Forum Leader
 
Join Date: Sep 2003
Posts: 1,066,478
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 04:21 PM.


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