Open dialogue for several files at once

Become a member of the CGSociety

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

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  05 May 2008
Open dialogue for several files at once

I want to create a script that lets me select a bunch of JPG files and that creates for each JPG a plane with a material of that JPG assigned to it. Now I've managed to do that with one File:


 f = getOpenFileName caption:"Open JPGs" types:"JPG (*.jpg)|*.jpg|All Files (*.*)|*.*|"
 myFile = filenameFromPath f
 myPlane = plane()
 myPlane.name = myFile
 myPlane.length = 30
 myPlane.width = 40
 myPlane.material = standard diffuseMap:(myBitmap) showInViewport:true name:myFile Self_Illumination:100
 


Work perfectly but getOpenFileName lets me only select one JPG at a time. How do I do that if I want to select several JPGs at once?
__________________
http://www.krystian.de
 
  05 May 2008
http://www.scriptspot.com/bobo/mxs9...FileDialog.html
__________________
Bobo
 
  05 May 2008
Works!

Ha! It works. This is my final code:


  theDialog = dotNetObject  "System.Windows.Forms.OpenFileDialog"
  theDialog.title = "PLEASE Select One Or More Files"
  theDialog.Multiselect = true
  theDialog.Filter = "JPG Files (*.jpg)|*.jpg|All Files (*.*)|*.*"
  theDialog.FilterIndex = 1
  result = theDialog.showDialog()
  result.ToString()
  result.Equals result.OK
  theFilenames = theDialog.fileNames
  
  if result.Equals result.OK then
  (	
  	myZ = 0
  	for o in theFilenames do 
  	(
  		myFile = filenameFromPath o
  		myPlane = plane()
  		myPlane.name = myFile
  		myPlane.length = 30
  		myPlane.width = 40
  		myPlane.pos.z = myZ
  		myBitmap = bitmaptexture()
  		myBitmap.filename = o
  		myBitmap.reload()
  		myPlane.material = standard diffuseMap:(myBitmap) showInViewport:true name:myFile Self_Illumination:100
  		myZ = myZ + 10
  	)
  )
  


Thank you! Again. You have been a great help!
__________________
http://www.krystian.de
 
  05 May 2008
sweet i know this will come in handy. Thanks bobo
 
  05 May 2008
Just thinking out loud here krystman but you might want to check the aspect ratio of all the jpegs you're importing and respect that in the plane size as well. Just in case you have JPegs of different sizes to avoid stretching.
 
  05 May 2008
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
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:08 PM.


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