Advertisement
Guest User

Untitled

a guest
Nov 2nd, 2015
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.36 KB | None | 0 0
  1. macroScript testing
  2. category:"test"
  3. toolTip: "testing the test"
  4.  
  5. (
  6.  
  7. )
  8.  
  9. rollout UVTool "UV AutoUnwrap V0.6"
  10. (
  11. spinner mapChannelNo "Map Channel: " range:[0,100,2] type:#integer
  12. -- spinner customFlattenAngle "Angle: " type:#float range:[0,1000,45.0] scale:5.0
  13. spinner spacing "Spacing: " type:#float range:[0,100,0.007] scale:0.001
  14. -- checkbox packed "Pack" checked:true
  15. button unwrap "Unwrap"
  16.  
  17.  
  18. -- ==============
  19. -- MAIN SCRIPT
  20. -- ==============
  21.  
  22. on unwrap pressed do
  23. (
  24. -- creates an array from suitable geometry in selection
  25. local geoToUV = (for o in selection where (isKindOf o GeometryClass and canConvertTo o Editable_Mesh) collect o)
  26.  
  27. -- checks to see if anything will be unwrapped, and generates error popup if not
  28. if geoToUV.count == 0 then messagebox "No suitable geometry selected!"
  29. else
  30. (
  31. clearSelection() -- clears selection once original selection has been saved as geoToUV array
  32.  
  33. for i in 1 to geoToUV.count do -- loops through array of suitable geometry
  34. (
  35. select geoToUV[i] -- selects "i"th piece of geometry
  36.  
  37. -- main UVW block
  38. modPanel.addModToSelection (Unwrap_UVW ()) ui:on
  39. geoToUV[i].modifiers[#Unwrap_UVW].unwrap.setMapChannel mapChannelNo.value
  40. geoToUV[i].modifiers[#Unwrap_UVW].unwrap.move ()
  41. geoToUV[i].modifiers[#Unwrap_UVW].texMapList.count = 0
  42. geoToUV[i].modifiers[#Unwrap_UVW].texMapIDList.count = 0
  43. geoToUV[i].modifiers[#Unwrap_UVW].baseMaterial_list.count = 1
  44. geoToUV[i].modifiers[#Unwrap_UVW].baseMaterial_list[1] = undefined
  45. geoToUV[i].modifiers[#Unwrap_UVW].texMapList.count = 0
  46. geoToUV[i].modifiers[#Unwrap_UVW].texMapIDList.count = 0
  47. geoToUV[i].modifiers[#Unwrap_UVW].texMapList.count = 1
  48. geoToUV[i].modifiers[#Unwrap_UVW].texMapIDList.count = 1
  49. geoToUV[i].modifiers[#Unwrap_UVW].texMapList[1] = Checker ()
  50. geoToUV[i].modifiers[#Unwrap_UVW].texMapIDList[1] = -1
  51. subobjectLevel = 3
  52. actionMan.executeAction 0 "40021"
  53. max select all
  54. geoToUV[i].modifiers[#Unwrap_UVW].flattenMap 45.0 #([1,0,0], [-1,0,0], [0,1,0], [0,-1,0], [0,0,1], [0,0,-1]) (spacing.value/2) true 0 true true
  55. subobjectLevel = 0
  56.  
  57.  
  58. -- packed section - still issues with packing code. Also, no longer works within UI
  59. -- if packed == true do
  60. -- (
  61. -- selection[i].modifiers[#unwrap_uvw].unwrap.move ()
  62. -- subobjectLevel = 3
  63. -- max select all
  64. -- selection[i].modifiers[#unwrap_uvw].pack 1 0.007 true true true
  65. -- subobjectLevel = 0
  66. -- modPanel.addModToSelection (TurboSmooth ()) ui:on -- Tests to see if this block works
  67. -- )
  68.  
  69.  
  70. clearSelection()
  71. )
  72. select geoToUV#() -- selects geometry which has been modified
  73. )
  74.  
  75. )
  76. )
  77.  
  78. createDialog UVTool width:200
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement