Asset Metadata Stream Acces help wanted

Hello people.

I'm new on this forum so if I'm making any forum-guidline mistakes, I'm sorry.

My reason for joining is because I'm interested in making scripts but of course this goes hand in hand with questions... Currently I've got the assignment of making a Maxscript for school, some kind of Semesterexcercise.
The script is the following: An Auto Asset-tracking tool which makes it possible for students to format the paths of the assets in relative filenames. This prevents problems when the max file and assets are loaded onto another computer. Also, the users will be able to rename the files with prefixes ( if they need to put their name, classnumber or schoolname in front of every file, it happens) and move the assets to a new folder.

The problem is the following, I'm using the Asset Metadata Stream Acces functions and I'm trying to overwrite the filenames with the new, relative, paths. This is an extract from my script where the problems start.

FileAssets =#()
FileAssets = getMAXFileAssetMetadata SceneFilename

--Controling AssetData
for i=1 to Namelist.count do --Namelist is an array with all the assets, including their new relative paths & possibly new names
(
NameAsset = NameList[i]
PathAsset = getFilenamePath NameAsset
NameAsset = filenameFromPath NameAsset

--Using ToRelative function of pathconfig, also, SceneFilename
PathAsset = pathConfig.convertPathToRelativeTo PathAsset SceneFilename
PathAsset = (PathAsset + NameAsset)
NameList[i] = PathAsset
FileAssets[i].filename = NameList[i]

)

SetMaxFileAssetMetaData SceneFilename FileAssets

The problem here is the error I get:

FileAssets[i].filename = NameList[i] -> Unknown property: "filename" in undefined <<

When I replace the FileAssets[i].filename with just for example FileAssets[1].filename then the error doesn't show but still,

the assets in the Asset Manager won't change to the new paths... (they stay absolute paths)

Hope Somebody is able to help me!

Thanks,

Michiel

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
MichielH's picture

Never mind problem solved!

Never mind problem solved! thanks though.

Solution: use ATSO =)

MichielH's picture

Hello Insanto, thank you for

Hello Insanto, thank you for your response!

SceneFilename is my max Filename, earlier defined in my script ( SceneFilename = (maxFilePath + maxFileName))

I've tested the Metadata code in the Maxscript Listener with this code:

SceneFilename = maxFilePath + maxFileName
--"C:\Users\Michiel\Desktop\DAE\Semester 2\Character Modelling\Week 7 - Schildje\Schild4.max"
FileAssets =#()
--#()
FileAssets = getMAXFileAssetMetadata SceneFilename
--#((AssetMetadata_StructDef assetId:"{90A71A3D-2D0E-41E9-8DD2-2B24889A1B04}" filename:"C:\Users\Michiel\Desktop\DAE\Semester 2\Character Modelling\Week 7 - Schildje\Low_Polyspecularmap.psd" type:#bitmap), (and so on))

FileAssets[1].filename ="\Low_Polyspecularmap.psd"
--"\Low_Polyspecularmap.psd"
--"\Low_Polyspecularmap.psd"
FileAssets[1]
--(AssetMetadata_StructDef assetId:"{90A71A3D-2D0E-41E9-8DD2-2B24889A1B04}" filename:"\Low_Polyspecularmap.psd" type:#bitmap)
SetMaxFileAssetMetaData SceneFilename FileAssets
--true
savemaxfile scenefilename
--true
print FileAssets[1]
--(AssetMetadata_StructDef assetId:"{90A71A3D-2D0E-41E9-8DD2-2B24889A1B04}" filename:"\Low_Polyspecularmap.psd" " type:#bitmap)

But still, the AssetTracking doesn't change. maybe i'm forgetting something here...

Ps: Sorry for late response, lost my internet for a week

Graph's picture

do a print FileAssets[i]

do a
print FileAssets[i] inside the loop

is SceneFilename propperly defined?

Raphael Steves

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.