Forum Groups
  All forums
    Help & Feedback
      Questions
      Work in progress
      Finished Art
      Non-Max related
    Community
      Offtopic
      News
    Hardware
    Photography



Maxunderground news unavailable

Looking for a little automation help
show user profile  jpedleham
I have lots and lots of jpegs all named like this (x is in place of a number)

xxxxxx_AMACxxxxxxx_LengthxWidth_xxxxxx_xx.jpg

Ive got my script working but id like to build in some error checking


posdirectory = getSavePath caption:"Select POS Folder"
for f in (getFiles (posdirectory+"\\*.jpg")) do
(

CURRENTFILENAME = filenamefrompath f
myarray = FilterString currentfilename "_Xx"
poslength = myarray[3] as integer
poswidth = myarray[4] as integer
currentpos = box length:poslength width:poswidth height:3 isSelected:on
newmat = StandardMaterial()
newmat.name = ("MAT_" + currentfilename as string)
myBmp = bitmaptexture filename: f
newmat.diffusemap = mybmp
$.material = newmat
modPanel.addModToSelection (Uvwmap ())
collapsestack($)
$.name = getFilenameFile f
deselect($)
)

Sometimes, there may be files in the folder that dont fit the correct filename structure. Id like to skip those if possible and just move onto the next file.
usually itll throw an error because the length value is undefined.
Also is there a way of automatically flipping the UV on the rear face of the box im creating so the jpeg displays correctly on both sides??

Thanks
Jack
read 234 times
4/21/2016 9:54:03 AM (last edit: 4/21/2016 11:01:55 AM)
show user profile  jpedleham
I figured out everything other than the UV flip which im happy to do manually unless its a simple snippet
read 219 times
4/21/2016 11:20:25 AM (last edit: 4/21/2016 11:21:04 AM)
show user profile  herfst1
UVW Xform is the way to go to flip uvs.
read 201 times
4/21/2016 1:55:19 PM (last edit: 4/21/2016 1:55:19 PM)
show user profile  jpedleham
Thats a brilliant idea actually. Is there a way you can pause the script and wait for the user to select a face in the edit poly modifier??

$.EditablePoly.SetSelection #Face #{1}
$.faceExtrudeHeight = 10
subobjectLevel = 0
modPanel.addModToSelection (Face_Extrude ()) ui:on
$.modifiers[#Face_Extrude].amount = 3
modPanel.addModToSelection (Cap_Holes ()) ui:on
actionMan.executeAction 0 "310"
modPanel.addModToSelection (Edit_Poly ()) ui:on
subobjectLevel = 4
$.modifiers.[#Edit_Poly].SetSelection #Face #{}
$.modifiers.[#Edit_Poly].Select #Face #{31} --here is where i want to wait for user input
modPanel.addModToSelection (UVW_Xform ()) ui:on
$.modifiers[#UVW_Xform].U_Flip = 1

read 177 times
4/22/2016 10:17:56 AM (last edit: 4/22/2016 10:19:54 AM)
show user profile  jpedleham
I Ended up using a small script from scriptspot that selected the top face of an object and adjusting it to select the bottom face instead removing the need for user interaction with this part of the process.
read 157 times
4/22/2016 4:00:38 PM (last edit: 4/22/2016 4:00:38 PM)
#Maxforums IRC
Open chat window


Support Maxforums.org