Display folder content in Listbox
Hi there!
I'm trying to build a small browser for published Assets.
What the script will do is showing all maxfiles in a certain folder so you can select the Asset you wanna reference. Later it will Xref the Asset, bring also in it's proxy, link a locator to it and lock the Xref.
The question is, how can I get the files of a folder in a rollout listbox?
This is what I came up with so far:
projectRoot = pathConfig.removePathLeaf maxfilepath + "\\"
pubPath = projectRoot + "Assets\PUB\\"
pubFiles = pubPath + "*PUB.max"
files = getFiles pubFiles
rollout Referencer "Referencer" width:394 height:426
(
label 'lbl9' "Reference Assets" pos:[157,17] width:93 height:39 align:#left
listbox objectToKill "Objects:" items:(for o in files collect o) pos:[31,61] width:330 height:20 align:#left
button 'refBtn' "Reference" pos:[119,358] width:139 height:40 align:#left
on refList selected sel do
(
)
on refBtn pressed do
(
)
)
So I get the content of the folder in the list. Now I guess I have to create an array which is corresponding with the list storing the file path informations. How can I create that and read it out?
Thanks :)
Comments
Hi! Thanks for your reply! I
Hi! Thanks for your reply! I got the naming working and spent some hours on finding out how to get the Xref selection, but unfortunately it seems like I don't understand how I can get it going. Sorry for asking again. I was reading through the batch script you posted, but as far as I saw the selection is set with #select flags, which doesn't work for Xrefs. Could you please help me with this? Thank you :)
you just did not search them
you just did not search them thoroughly....search term "uniquename"......
you should really read them ....
n for another case (select after merge)of your problem by reading this script
http://www.scriptspot.com/3ds-max/scripts/batch-loader
Yes after the Xref comes in I
Yes after the Xref comes in I wanna do some operations on it by maxscript. And by the way, there's another problem I step into. When I Xref objects by maxscript I get name clashes. So if I reference 3 times an object called "tree_001" it doesn't number up the object, so I get 3 Xref objects called "tree_001". Any Idea how to get around this?
this is the code I use:
.....
objectName = h3 + "_001"
proxyName = h3 + "_proxy"
proxyPath = c1 + "_proxy.max"
XrefImporter = xrefs.addNewXRefObject assetPath objectName
XrefImporter.proxyfilename = proxyPath
XrefImporter.proxyobjectname = proxyName
XrefImporter.useProxy = true
......
I couldn't find any way to change the Name of the XrefObject in the scene in the maxhelp, or did I just not see it?
Thanks
you mean select object after
you mean select object after xref?
Thanks! I'm now at the point
Thanks! I'm now at the point where everything with Xref is working so far.
I'm running into a different problem. When get in the Xref the object is not selected, but I also need to do an operation on it. I was trying to find a call to select or process in any way a xref which just got imported, but couldn't find any. Am I blind? Thanks :)
on Referencer open do (