Home Technical Talk
The BRAWL² Tournament Challenge has been announced!

It starts May 12, and ends Sept 12. Let's see what you got!

https://polycount.com/discussion/237047/the-brawl²-tournament

TexTools 3.0+

1234579

Replies

  • maze
    Hi there, I am having a small problem using textools when trying to find the pixel ratio of an asset composed of several objets.

    Basically I normalize the shells, then use the pixel ratio picker, but it does give me this error:

    pix2: -1.#IND

    It was working ok but then I am not sure what I did and started getting that! Thanks for your help! I'll appreciate it!
  • debashish
    is there a way to make this install on max2011?
    i tried the manual install, throwing errors :(
  • e-freak
    Just wanted to share some love: Tried out TexTools for the first time and am so addicted to it already! Great work :D
  • Valerien
    Waow, this tool is really impressive ! Now extending textures to pack multiple objects in it is a piece of cake, and all that stuff for free !
  • Octo
    Offline / Send Message
    Octo polycounter lvl 18
    'Hard Edges' in the Bake texture maps thingy is giving me unexpected results.
    The edges in the render are offset, and doesn't match the UVs...also, the lowest thickness (1) is way too fat, and my model is to scale (if that matters, it's a tank)
  • WarrenM
    I use this script all the time and it's amazing! But you know, I can never get "Rectify" to work. It looks like I should be able to select UV islands made up of quads and have them get straightened into rectangles but it never does anything when I left click the button. Is this a known thing or is there a hidden 'gotcha' that I'm not aware of?
  • AnimeAngel
    ya i have seen that too with rectify. I'll select a element that is fairly close to rectangular in the first place. click rectify and it will usually ball it all up and make a huge mess. Crtl-z
    Also can't get the linear align to work now in 2011. It never quite straightens it, always have to use the old scaling method again to get lines straight.
    Still an amazing tool overall and can't live without it. :)
  • AdamB
    Octo wrote: »
    'Hard Edges' in the Bake texture maps thingy is giving me unexpected results.
    The edges in the render are offset, and doesn't match the UVs...also, the lowest thickness (1) is way too fat, and my model is to scale (if that matters, it's a tank)
    I've been wondering myself how this works, any tips would be great!
  • cupsster
    Offline / Send Message
    cupsster polycounter lvl 11
    Hi Render,

    maybe you can implement something from this stuff.. I'd like to see transfer of UV from hipoly to lowpoly for example.. missing this :)
    1. -- UV Layout
    2.  
    3. -- This program was split off from the Surface Toolkit.... Thanks to the guy who coded the TV drawing routine I'm using.
    4. -- please email me at vajuras@planetunreal.com so I can give ya credit. www.cyberkreations.com/kreationsedge
    5.  
    6. -- Updated May 9, 2001 to work in Max 4. I think my interest in this was rekindled so that it could be used to help Chilliskinner advance.
    7.  
    8. -- On jan. 23 the unwrap algorithm was vastly improved to handle unwraps on the right
    9. -- and left side. Also, added Match UVW function/utility.
    10.  
    11. -- 2/7
    12. -- Made the Camera Projection Logic.
    13.  
    14. -- 2/14
    15. -- Improved "Update Map" routine which would have an error.
    16. -- Render_map will now convert object to mesh if not an Editable Object.
    17. -- Added ability to separately render TVFaces without splitting a mesh object. This
    18. -- method seems to work much better and return more accurate results...
    19.  
    20. -- 2/20
    21. -- Update_Texture now works with Multi-materials...
    22.  
    23. -- 2/23
    24. -- started working on the Skin Composer routine.
    25.  
    26. -- 3/02
    27. -- Actually put in the AI for Blender.
    28. -- Upgraded the UV Manager to create an alpha channel for uv maps.
    29.  
    30. -- Blender uses advanced algorithm to compute across any range [n, n] instead of [0, 100].
    31. -- This is the code that does the math:
    32. -- dist = abs(sort_gy - sort_ly)
    33. -- pnt = 1/dist
    34. -- p_dist = abs(pix.y - sort_ly)
    35. -- blend_pnt = p_dist*pnt
    36.  
    37.  
    38. -- 3/12
    39. -- Added Attachments Utility
    40.  
    41. -- 4/17
    42. -- Fixed a bug where the VertexSelection did not work for SurfUnwrap.
    43.  
    44. -- v1.2
    45. -- 4-21
    46. -- Added Edge Colors & Surface Glue.
    47. -- Extended the range of the size of an image.
    48. -- The Script used to crash if the restore 0r Apply under Project UVW button was pressed.
    49. -- You can now enter float values for the Width & Length of a bitmap (UV Manager)
    50. -- A lot of easy crashes were fixed that may be caused if a user clicks the wrong button.
    51.  
    52. -- v1.2.2
    53. -- Fixed a crash that may occur during a 'render map' when the color comes up undefined...
    54. -- Default Material checkbox will now go & load the Material's diffusemap. Changes a BitmapTexture to Bitmap.
    55. -- Increased User Feedback
    56.  
    57. -- v1.2.3 -> v1.2.4
    58. -- Fixed the bug in which the edge color array would crash the utility.
    59. -- The utility displays the expiration date.
    60.  
    61. -- v1.3
    62. -- Added UV Mesher Tool.
    63. -- Improved Glue Tool Performance.
    64.  
    65. -- v1.3.3
    66. -- UV Mesher grabs the dimension of the Diffuse Channel Bitmap if available.
    67. -- WARP feature for the UV Mesher was fixed.
    68.  
    69. -- v1.4
    70. -- UpdateMap feature now reloads all the mapping channels instead of just the diffuse channel.
    71.  
    72. utility surfHelp "UV Layout"
    73. (
    74. local sort_y, morph_state = false
    75.  
    76. -- stores the selection of cross objects
    77. local b_cross = #()
    78. local b_crossNum = 0
    79.  
    80. local s_width = 190
    81. local s_height = 345
    82.  
    83. -- For the 3D Paint Options
    84. local default_secs = 3600
    85. local map_type = 0 --default mapping: planar
    86. local uvw_axis = 0
    87.  
    88. -- Emergency ShutDown
    89. local shutDown = false
    90.  
    91. -- Determines if this script is registed, if so, all features are enabled.
    92. local register = true
    93.  
    94. label display_global ""
    95.  
    96. --stores color for each edge (UV Layout & Edge)
    97. local color_mat = #()
    98.  
    99. -- global user_color
    100. local global_color = red
    101.  
    102. -- selection set data
    103. local sel_set =#(), sel_index = 1
    104.  
    105. -- Variables for GLUE
    106. local glue_set = #()
    107. local glue_names = #()
    108. local glue_objA = #()
    109. local glue_objB = #()
    110. local glue_pos = #(#())
    111. local previous_b = #() -- Stores the original OBJECT B
    112.  
    113. -- Variables for UV Mesher
    114. local face_set = #() -- Stores the origin for the TVFace.
    115.  
    116. fn grab_sel =
    117. (
    118. selection as array
    119. )
    120.  
    121. -- Selects all the faces in a mesh.
    122. fn setFaceArray tar numF =
    123. (
    124. tar = #()
    125. for i = 1 to numF do
    126. (
    127. tar[i] = i
    128. )
    129. return tar
    130. )
    131.  
    132. -- Retrieves the date from a string and returns it in a 3-element array. The string must conform to localTime String Conventions
    133. -- meaning a space character must be included like "11/23/98 8:23PM". This function can also tokenize a regular string.
    134. -- This routine automatically looks for / and \\ (backslash) but, an extra delimeter can be searched.
    135. -- By default, you should send a space character.
    136. fn get_all_tokens str_in delimeter =
    137. (
    138. tokens = #()
    139. str = str_in as string
    140. len = str.count
    141. count = 1 -- Count the # of tokens
    142. elmo = 0 -- Count valid charcters
    143. for a = 1 to len do
    144. (
    145. if str[a] == "/" or str[a] == delimeter or str[a] == "\\" then
    146. (
    147. this_token = substring str count elmo
    148. append tokens this_token
    149.  
    150. -- Set the pointer to the beginning of the next slot.
    151. count = a + 1
    152. elmo = 0
    153. )
    154. else
    155. (
    156. -- Count the valid characters
    157. elmo = elmo + 1
    158. )
    159. )
    160.  
    161. if shutDown == true then
    162. (
    163. shutDown == true
    164. return #()
    165. )
    166. -- Return the last token also.
    167. this_token = substring str count elmo
    168. append tokens this_token
    169.  
    170. tokens
    171. )
    172. -- Replace all occurances of a character with another.
    173. fn replace_char str delimeter new_char =
    174. (
    175. len = str.count
    176. for a = 1 to len do
    177. (
    178. if str[a] == delimeter then str[a] = new_char
    179. )
    180. str
    181. )
    182.  
    183. -- Opt 1: Encrypt
    184. -- 2: Not Encrypted
    185. fn read_data file_name opt =
    186. (
    187. count = 1
    188. j_name = #()
    189. if opt == 2 then file = openFile (file_name)
    190. else
    191. file = openEncryptedFile (file_name) 252525
    192. if file != undefined then
    193. (
    194. while (not eof file) do
    195. (
    196. str = readline file
    197. j_name[count] = str
    198. count = count + 1
    199. )
    200. close file
    201. ) -- if
    202. j_name
    203. )
    204. -- Opt 1: encrypt
    205. -- 2: not encrypt
    206. fn save_data file_name path_string opt =
    207. (
    208.  
    209. if file_name != undefined then
    210. (
    211. if opt == 1 then file = createFile(file_name+".tmp")
    212. else
    213. file = createFile(file_name)
    214. format "%\n" path_string to:file
    215. close file
    216. ) -- if
    217. if opt == 1 then (
    218. encryptFile (file_name+".tmp") file_name 299525
    219. deleteFile (file_name+".tmp")
    220. )
    221. )
    222. -- Use the .ini file to determine where the MAX ROOT is.
    223. fn get_root =
    224. (
    225. f = read_data "uv_max/layout.ini" 2
    226. if f.count < 1 then (
    227. messagebox "Please press the Online Help (.chm) button first to install the .ini file before continuing."
    228. return #()
    229. )
    230.  
    231. tokens = get_all_tokens f[1] "-"
    232. tokens
    233. ) -- warez
    234.  
    235. -- This function will return another point that lies in the same spline. This func is called by the unwrap_spline
    236. -- func which in turn uses this AI to help determine which xAxis to assign to a spline knot. The Spline Ends Algorithm
    237. -- is applied which states that the very next vertex in the spline order can be used to determine the direction of the
    238. -- knot.
    239. fn findOtherKnot obj spl vert =
    240. (
    241. local pnt
    242. numK = numKnots obj spl
    243. old_pnt = getKnotPoint obj spl vert
    244. next_vert = vert - 1
    245. if vert >1 then next_vert = vert - 1
    246. else
    247. next_vert = vert + 1
    248.  
    249. pnt = getKnotPoint obj spl next_vert
    250. gw = "NEXT:"+next_vert as string+" SENT:"+vert as string
    251. -- Return the same point back if no vert exists on a different xAxis in the same spline.
    252. pnt
    253. )
    254. -- This function will return another point that lies in the same spline. This func is called by the radialSolver
    255. -- func which in turn uses this AI to help determine which xAxis to assign to a spline knot.
    256. fn simpleFindOtherKnot obj spl vert =
    257. (
    258. local pnt
    259. numK = numKnots obj spl
    260. old_pnt = getKnotPoint obj spl vert
    261. for i = 1 to numK do
    262. (
    263. pnt = getKnotPoint obj spl i
    264. if old_pnt.x != pnt.x then return pnt
    265. )
    266. -- Return the same point back if no vert exists on a different xAxis in the same spline.
    267. pnt
    268. )
    269. -- This function makes any knot that equal the deformed knot move also similar to the Global Transform Func.
    270. -- Since the new position is along the yAxis, it will not be deformed again.
    271. -- Var:
    272. -- new_pos - new position where this vert should move
    273. fn makeAllKnotsEqual obj spl vert new_pos thres =
    274. (
    275. nums = numSplines obj
    276. old = getKnotPoint obj spl vert -- current position of the before the new move.
    277. for i = 1 to nums do
    278. (
    279. numk = numKnots obj i
    280. for j = 1 to numk do
    281. (
    282. pnt = getKnotPoint obj i j
    283. -- Exclude the spline where the original knot came from. Spline Ends Algorithm.
    284.  
    285. pntxUp = old.x + thres
    286. pntxDown = old.x - thres
    287. pntyUp = old.y + thres
    288. pntyDown = old.y - thres
    289. pntzUp = old.z + thres
    290. pntzDown = old.z - thres
    291. if i != spl and (pnt.x <= pntxUp and pnt.x >= pntxDown) and (pnt.y <= pntyUp and pnt.y >= pntyDown) and (pnt.z <= pntzUp and pnt.z >= pntzDown) then
    292. (
    293. pnt = new_pos
    294. setKnotPoint obj spl vert pnt
    295. )
    296. )
    297. )
    298. )
    299. -- This function will solve for a radial b-spline since the Spline Ends Algor. fails if the points lie within the
    300. -- threshold.
    301. fn radialSolver obj spl vert =
    302. (
    303. numS = numSplines obj
    304. new_spline = spl - 1
    305. -- limit checks
    306. if new_spline < 1 then new_spline = spl + 1
    307. if new_spline > numS then new_spline = spl
    308. pnt = simpleFindOtherKnot obj new_spline vert
    309. -- Return another point on another spline that can be used to determine the direction.
    310. pnt
    311. )
    312. -- This function unwraps a spline object. If the surf is cylindrical/spherical, the knots along the mid spline behind the base axis
    313. -- will be pulled apart. Spline Ends Algorithm examines a spline and will assign to the middle knot automatically the direction
    314. -- the knot should go which is naturally, determined by the Order of the spline.
    315. -- b_a - Y axis
    316. -- x_a - X axis
    317. fn unwrap_spline obj b_a x_a thres output =
    318. (
    319. local num_s, num_k, val, pnt, gw
    320. dist = 0.0 -- distance pnt from x_a
    321. try (
    322. num_s = numSplines obj
    323. ) catch (
    324. messagebox "Please choose a valid object."
    325. return 0
    326. )
    327. for i = 1 to num_s do
    328. (
    329. num_k = numKnots obj i
    330.  
    331. calcy = (i as float / num_s as float) * 100
    332. calcy = calcy as integer
    333. lc = calcy as string + "%"
    334. output.text = lc
    335.  
    336. for j = 1 to num_k do
    337. (
    338. pnt = getKnotPoint obj i j
    339. gw = i as string + ":" + j as string + " "+pnt as string
    340.  
    341. -- If the point is below the base axis, adjust the val variable.
    342. if pnt.y > b_a then val = pnt.y - b_a
    343. else
    344. val = 0
    345. ny = pnt.y
    346. nx = pnt.x
    347. dist = (abs(x_a - pnt.x))/100
    348. -- New Y coordinate will be at base axis. If Y coordinate is less than base axis, then let it keep its position.
    349. if pnt.y > b_a then
    350. (
    351. ny = b_a
    352. --nx = pnt.x - val
    353. --gw = "Behind base "+i as string+":"+j as string+" "+pnt.x as string
    354. --print gw
    355. -- If the point is along the middle spline behind the base axis.... Determine which direction to move.
    356. midUp = (x_a as float + thres as float)
    357. midDown = (x_a as float - thres as float)
    358. if pnt.x <= midUp and pnt.x >= midDown then
    359. (
    360. otherKnot = findOtherKnot obj i j
    361. --gw = "Mid "+i as string+":"+j as string
    362. --print gw
    363. -- If the Spline Ends Algorithm has failed in case of radial b-splines then, use the radial b-solver algorithm
    364. -- instead.
    365. if otherKnot.x == pnt.x then otherKnot = radialSolver obj i j
    366. est = otherKnot.x
    367.  
    368. if est < (x_a) then nx = pnt.x - (val * dist)
    369. else
    370. nx = pnt.x + (val * dist)
    371. -- Now, deform any other colliding vertices.... The deformed verts will not ever be deformed again because
    372. -- they will equal the b_a.
    373. new_pnt = [nx, ny, pnt.z]
    374. makeAllKnotsEqual obj i j new_pnt thres
    375. )
    376. else
    377. (
    378.  
    379. if pnt.x < x_a then nx = pnt.x - (val * dist)
    380. else
    381. (
    382. if pnt.x > x_a then
    383. (
    384. nx = pnt.x + (val * dist)
    385. gw = gw + "RIGHT "
    386. new_pnt = [nx, ny, pnt.z]
    387. --makeAllKnotsEqual obj i j new_pnt thres
    388. ) -- if
    389. ) -- if
    390. ) -- if
    391. ) -- if
    392. setKnotPoint obj i j [nx, ny, pnt.z]
    393. updateShape obj
    394. --gw = gw + " "+nx as string + ":" + ny as string + " " + val as string
    395. --print gw
    396. )
    397. )
    398. try (
    399. ) catch (
    400. messagebox "Please select a valid object"
    401. return 0
    402. )
    403. output.text = "->"
    404. )
    405. -- This is a general func designed to work with any type of surface. It
    406. -- takes the object and computes the highest or lowest x value.
    407. -- option 1: largest, opt 2: least
    408. fn compute_percent obj opt =
    409. (
    410. local sort = 0, diff_x = 0.0, sort_x = 0
    411. convertToMesh obj
    412. numS = getnumverts obj
    413. for i = 1 to numS do
    414. (
    415. pnt = getvert obj i
    416. if i == 1 then (
    417. diff_x = pnt.x
    418. sort_x = i
    419. )
    420. else
    421. (
    422. if opt == 1 and pnt.x > diff_X then
    423. (
    424. sort_x = i
    425. diff_x = pnt.x
    426. )
    427.  
    428. if opt != 1 and pnt.x < diff_X then
    429. (
    430. sort_x = i
    431. diff_x = pnt.x
    432. )
    433.  
    434. )
    435. )
    436. sort_x
    437. )
    438. -- This function unwraps a mesh object. The val is computed to determine the total
    439. -- distance a point should be moved along the X axis. The dist is computed as the
    440. -- distance the point is from the X axis which gives a percentage value.
    441. -- b_a - Y axis
    442. -- x_a - X axis
    443. fn unwrap_mesh obj b_a x_a x_width use_stack disp =
    444. (
    445. local num_s, num_k, val, pnt, gw, target = #(), i, sort_x
    446. dist = 0.0 -- distance pnt.x is from x_a divided by 100 to get
    447. -- a percentage. This computation will then be used
    448. -- to determine how far from the X axis the points
    449. -- should be deformed.
    450. count = 1
    451. select_i = 0 -- turns on if stack is present...
    452. num_verts = 0
    453. try (
    454. dummy = getnumfaces obj
    455. ) catch (
    456. convertToMesh obj
    457. )
    458. --Had to take out unwrap support for a vertex selection. It was a useless feature anyway...
    459. num_verts = getnumverts obj
    460. if select_i == 0 or use_stack == false then
    461. (
    462. for i = 1 to num_verts do
    463. (
    464. target[i] = i
    465. )
    466. ) -- if
    467. disp.text = "Analyzing Topology...."
    468. sort_x = compute_percent obj 1
    469. far_vert = getvert obj sort_x
    470. sort_neg = compute_percent obj 2
    471. least_vert = getvert obj sort_neg
    472. -- Get the percentage from the farthest vert. Then, this value will be used
    473. -- to equate the values to a range [low, 100]
    474. percent = 100 / (abs(x_a - far_vert.x))
    475. percent_neg = 100 / (abs(x_a - least_vert.x))
    476. progressStart "Unwrapping..."
    477. cond = true
    478. count = 1
    479. for i in target do
    480. (
    481. calcy = (i as float / num_verts as float) * 100
    482. calcy = calcy as integer
    483. lc = calcy as string + "%"
    484. if select_i == 1 then disp.text = "Using Stack Selection...."
    485. else
    486. cond = progressUpdate calcy
    487. if cond == false then return 0
    488. try (
    489. pnt = getvert obj i
    490. ) catch (
    491. pnt = getvert obj count
    492. )
    493. -- If the point is below the base axis, adjust the val variable.
    494. if pnt.y > b_a then val = pnt.y - b_a
    495. else
    496. val = 0
    497. ny = pnt.y
    498. nx = pnt.x
    499. if pnt.x < x_a then dist = (abs(pnt.x - x_a)) * percent_neg
    500. else
    501. if pnt.x > x_a then dist = (abs( pnt.x - x_a)) * percent
    502. dist = dist / 100
    503. -- If the user wants to morph the mesh, then let dist always eq. 1 so
    504. -- that the verts may be deformed.
    505. --if morph_state == true then dist = 1
    506. -- New Y coordinate will be at base axis. If Y coordinate is less than base axis, then let it keep its position.
    507. if pnt.y > b_a then
    508. (
    509. ny = b_a
    510. --nx = pnt.x - val
    511. -- Include the middle spline as well
    512. -- If midpoint is from LEFT TO RIGHT then mid = x_a + 1
    513. --mid = x_a + 1
    514. if pnt.x < x_a then
    515. nx = pnt.x - (val * dist)
    516. else
    517. (
    518. if pnt.x > x_a then (
    519. nx = pnt.x + (val * dist)
    520. )
    521. total = val * dist
    522. --gw = "Dist:"+dist as string+" Val:"+val as string+" Total:"+total as string
    523. --print gw
    524. )
    525. ) -- if
    526. try (
    527. setvert obj i [nx, ny, pnt.z]
    528. ) catch (
    529. setvert obj count [nx, ny, pnt.z]
    530. )
    531. --gw = gw + " X:Y "+nx as string + ":" + ny as string + " V:" + val as string
    532. --print gw
    533.  
    534. count = count + 1
    535. )
    536. update obj
    537. disp.text = ""
    538. progressEnd()
    539. -- Return target array.
    540. target
    541. )
    542.  
    543. -- This function uses the array (spl) to restore the original target.
    544. fn restore_spline obj spl output =
    545. (
    546. local token = #()
    547. local count = 1
    548. if classof obj != editable_mesh then return
    549. try (
    550. lengt = spl.count
    551. for i = 1 to lengt do
    552. (
    553. calcy = (i as float / lengt as float) * 100
    554. calcy = calcy as integer
    555. lc = calcy as string + "%"
    556. output.text = lc
    557. token = get_token spl[i] " "
    558. setKnotPoint obj (token[1] as Number) (token[2] as Number) [token[3] as float, token[4] as float, token[5] as float]
    559. )
    560. ) catch (
    561. messagebox "Cannot restore shape."
    562. return 0
    563. )
    564. output.text = "->"
    565. updateShape obj
    566. )
    567. fn restore_mesh obj target spl output =
    568. (
    569. leng = target.count -- Get the Vertex Selection
    570. real_num = getnumverts obj -- Get # of verts in the mesh object
    571. count = 0
    572. collapseStack obj
    573. if leng < 1 then
    574. (
    575. -- Fill target array
    576. for i = 1 to real_num do
    577. (
    578. count = count + 1
    579. target[count] = getvert obj i
    580. )
    581. )
    582. count = 0
    583. progressStart "Restoring..."
    584. for i in target do
    585. (
    586. count = count + 1
    587. calcy = (count as float / leng as float) * 100
    588. calcy = calcy as integer
    589. progressUpdate calcy
    590. -- An empty target array means No Vertex Selection was made.
    591. if leng == real_num or leng < 1 then setvert obj count spl[count]
    592. else
    593. setvert obj i spl[i]
    594. --gw = "Restore:"+spl[count] as string
    595. )
    596. try (
    597. --output.text = "->"
    598. progressEnd()
    599. ) catch ()
    600. update obj
    601. )
    602. -- This func draws the pixels in-between the 2 points.
    603. fn draw_line x1 y1 x2 y2 uvBMP u_color =
    604. (
    605. pnt = #()
    606. -- Compute the pixels between 2 points. First, derive the distance.
    607. dist_x = abs(x2 - x1)
    608. dist_y = abs(y2 - y1)
    609. if x1 > x2 then l_x = x2
    610. else
    611. l_x = x1
    612.  
    613. if y1 > y2 then l_y = y2
    614. else
    615. l_y = y1
    616. -- Let i take the value of y
    617. for i = 1 to (dist_y) do
    618. (
    619. -- move right
    620. diff_x = x2 - x1
    621. diff_y = y2 - y1
    622.  
    623. pnt[i] = [0,0]
    624. if diff_x > 0 then pnt[i].x = diff_x
    625. if diff_y > 0 then pnt[i].y = diff_y
    626. )
    627. )
    628.  
    629. -- Bresenham line implimentation for MAXScript
    630. -- by Harry Denholm, Kinetix 1998
    631. function BLine bmp x1 y1 x2 y2 c old_color =
    632. (
    633. -- stick the colour into an array
    634. local ary = c
    635. if ary == undefined then ary = #(old_color)
    636. -- assign originals
    637. local Xb = x1 as integer
    638. local Yb = y1 as integer
    639. -- build the line deltas
    640. local dX = x2-x1 as float
    641. local dY = y2-y1 as float
    642. -- straight horiz
    643. if dy == 0.0f do (
    644. local xsign = 1
    645. if xb > x2 then xsign = 1 as integer
    646. if x2 < xb then xsign = -1 as integer
    647. setPixels bmp [xb,yb] ary
    648. while xb != x2 do
    649. (
    650. xb += xsign
    651. setPixels bmp [xb,yb] ary
    652. )
    653. return true
    654. )
    655. -- straight vertical
    656. if dx == 0.0f do (
    657. local ysign = 1
    658. if yb > y2 then ysign = 1 as integer
    659. if y2 < yb then ysign = -1 as integer
    660. setPixels bmp [xb,yb] ary
    661. while yb != y2 do
    662. (
    663. yb += ysign
    664. setPixels bmp [xb,yb] ary
    665. )
    666. return true
    667. )
    668. -- no straights, go for bresenham line slide
    669. -- set up the movements
    670. local xsign = 1
    671. if xb > x2 then xsign = 1 as integer
    672. if x2 < xb then xsign = -1 as integer
    673. local ysign = 1
    674. if yb > y2 then ysign = 1 as integer
    675. if y2 < yb then ysign = -1 as integer
    676. dx = abs(dx)
    677. dy = abs(dy)
    678. setPixels bmp [xb,yb] ary
    679. -- line more vertical than horizontal
    680. if dx < dy then
    681. (
    682. p = 2 * dx - dy
    683. const1 = 2 * dx
    684. const2 = 2 * (dx - dy)
    685. while yb != y2 do
    686. (
    687. yb += ysign
    688. if p < 0 then ( p = p + const1 )
    689. else
    690. (
    691. p += const2
    692. xb += xsign
    693. )
    694. setPixels bmp [xb,yb] ary
    695. )
    696. )
    697. -- line more horizontal than vertical
    698. else
    699. (
    700. p = 2 * dy - dx
    701. const2 = 2 * (dy - dx)
    702. const1 = 2 * dy
    703. while xb != x2 do
    704. (
    705. xb = xb + xsign
    706. if p < 0 then ( p = p + const1 )
    707. else
    708. ( p = p + const2
    709. yb = yb + ysign
    710. )
    711. setPixels bmp [xb,yb] ary
    712. )
    713. )
    714. )
    715. -- Set material color to the bitmap.
    716. fn setMaterial uvBMP inMat =
    717. (
    718. iW = uvBMP.width
    719. iH = uvBMP.height
    720. inMat.alpha = 0.0
    721. mat_color = #(inMat)
    722. for i = 1 to iW do
    723. (
    724. for j = 1 to iH do
    725. (
    726. setPixels uvBMP [i,j] mat_color
    727. )
    728. )
    729. )
    730. -- This function renders the unwrapped surface or face selection.
    731. -- opt - use face selection from stack.
    732. fn render_uvw obj uvBMP u_color opt =
    733. (
    734. target = #()
    735. try (
    736. iW = uvBMP.width
    737. iH = uvBMP.height
    738. ) catch (
    739. messagebox "Please select a bitmap or uncheck the Include Bitmap option."
    740. return 0
    741. )
    742. status = false
    743. count = 0
    744. edge_num = 0
    745. t_count = getnumfaces obj
    746. Uobj = obj
    747. cCol = newCol = u_color
    748. display_global.text = "Rendering UVW Coordinates..."
    749. progressStart "Rendering..."
    750. -- Always assume that a UVWmap mod is at the top so, grab the next mod.
    751. try (
    752. target = getFaceSelection Uobj Uobj.modifiers[1]
    753. ) catch (
    754. try (
    755. target = getFaceSelection Uobj Uobj.modifiers[2]
    756. ) catch (
    757. -- Set the func. to use all the faces in the mesh.
    758. opt = false
    759. ) -- catch
    760. ) -- catch
    761.  
    762. gw = "Faces:"+t_count as string+" "+target as string
    763. print gw
    764. if opt == false then (
    765. target = #()
    766. --delta = (100.0/(getnumfaces Uobj)) as float
    767. for a = 1 to t_count do
    768. (
    769. target[a] = a
    770. )
    771. )
    772. limit = target.count
    773. for t in target do
    774. (
    775. -- update our progress bar
    776. count = count + 1
    777. calcy = (count as float / limit as float) * 100
    778. calcy = calcy as integer
    779. progressUpdate calcy
    780. --progressUpdate ((t*delta) as integer)
    781. status = getProgressCancel()
    782. if shutDown == true then(
    783. status == true
    784. )
    785. if status == true then (
    786. progressEnd()
    787. display_global.text = ""
    788. return false
    789. )
    790. -- get the faces
    791. faceN = getface Uobj t
    792. faceT = getTVFace Uobj t
    793. -- take the TVs out of the face index
    794. tva = gettvert Uobj faceT.x
    795. tvb = gettvert Uobj faceT.y
    796. tvc = gettvert Uobj faceT.z
    797. -- unwrap TVs. If a new Edge Color exists, use that color instead.
    798. try (
    799. edge_num = t * 3
    800. newCol = #(color_mat[edge_num-2])
    801. if color_mat[edge_num-2] == 0 then newCol = cCol
    802. ) catch (
    803. newCol = cCol
    804. )
    805. if newCol == undefined then newCol = cCol
    806. if (getedgevis Uobj t 1 and color_mat[edge_num-2] != -1) then \
    807. Bline uvBMP (iW*tva.x) (iH*(1.0-tva.y)) (iW*tvb.x) (iH*(1.0-tvb.y)) newCol cCol
    808.  
    809. try (
    810. edge_num = t * 3
    811. newCol = #(color_mat[edge_num-1])
    812. if color_mat[edge_num-1] == 0 then newCol = cCol
    813. ) catch (
    814. newCol =cCol
    815. )
    816.  
    817. if newCol == undefined then newCol = cCol
    818.  
    819. if (getedgevis Uobj t 2 and color_mat[edge_num-1] != -1) then \
    820. Bline uvBMP (iW*tvb.x) (iH*(1.0-tvb.y)) (iW*tvc.x) (iH*(1.0-tvc.y)) newCol cCol
    821.  
    822. try (
    823. edge_num = t * 3
    824. newCol = #(color_mat[edge_num])
    825. if color_mat[edge_num] == 0 then newCol = cCol
    826. ) catch (
    827. newCol =cCol
    828. )
    829.  
    830. if newCol == undefined then newCol = cCol
    831.  
    832. if (getedgevis Uobj t 3 and color_mat[edge_num] != -1) then \
    833. Bline uvBMP (iW*tvc.x) (iH*(1.0-tvc.y)) (iW*tva.x) (iH*(1.0-tva.y)) newCol cCol
    834.  
    835. )
    836. progressEnd()
    837. display_global.text = ""
    838. display uvBMP
    839. )
    840. -- This func copies the UVW coordinates and material assignments from one object
    841. -- to another.
    842. fn match_uvw target source deform_uv =
    843. (
    844. tmap = true -- texture mapping applied
    845. t_equal = true -- if tverts equal then deform the texure vertices. If not,
    846. -- simply assign the materials.
    847. --convertToMesh target
    848. --convertToMesh source
    849. try (
    850. a = getnumfaces target
    851. b = getnumfaces source
    852. ) catch (
    853. return 0
    854. )
    855. if a != b then (
    856. messagebox "These objects have different face counts (topology)."
    857. return 0
    858. )
    859. try (
    860. c = getnumtverts target
    861. d = getnumtverts source
    862. ) catch (
    863. --messagebox "No Mapping Applied..."
    864. --return 0
    865. tmap = false
    866. c = d = 0
    867. )
    868. if c < 1 or d < 1 then (
    869. --messagebox "No Mapping Applied..."
    870. --return 0
    871. tmap = false
    872. )
    873. if c != d then (
    874. --messagebox "The objects have different counts of texture vertices."
    875. --return 0
    876. t_equal = false
    877. )
    878. progressStart "Setting TVFaces...."
    879. --convertToMesh source
    880. -- copy materials
    881. f = target.material
    882. source.material = f
    883. for i = 1 to a do
    884. (
    885. calcy = (a as float / i as float) * 100
    886. calcy = calcy as integer
    887. progressUpdate calcy
    888. -- Copy separate face assignments if Multi-Object has been applied.
    889. f = getfacematid target i
    890. setfacematid source i f
    891. if tmap == true and t_equal == true and deform_tv == true then (
    892. f = getTVFace target i
    893. t1 = gettvert target f.x
    894. settvert source f.x t1
    895.  
    896. t2 = gettvert target f.y
    897. settvert source f.y t2
    898. t3 = gettvert target f.z
    899. settvert source f.z t3
    900. setTVFace source i f.x f.y f.z
    901. )
    902. )
    903. progressEnd()
    904. update source
    905. )
    906. -- Update Map
    907. -- Updates a standard and multi-material's diffusemap.
    908. fn update_texture obj junk_bitmap =
    909. (
    910. local file_name
    911. count = 0 -- count # of updated textures
    912. -- Grab the Current Selection to refresh the buffer.
    913. obj_array = grab_sel()
    914. obj = obj_array[1]
    915. try (
    916. classify = classof obj.material
    917. ) catch (
    918. messagebox "Please select the object first!"
    919. return false
    920. )
    921. if classify != Standardmaterial and classify != Multimaterial then
    922. (
    923. messagebox "Wrong Material Type! This utility only works with\n Standard & MultiMaterials."
    924. return false
    925. )
    926. if classify == Standardmaterial then
    927. (
    928. try (
    929. file_name = obj.material.diffusemap.filename
    930. obj.material.diffusemap.filename = file_name
    931. count = count + 1
    932.  
    933. update obj
    934. freeSceneBitmaps()
    935.  
    936. ) catch ()
    937.  
    938. try (
    939. file_name = obj.material.bumpmap.filename
    940. obj.material.bumpmap.filename = file_name
    941. count = count + 1
    942.  
    943. update obj
    944. freeSceneBitmaps()
    945.  
    946. ) catch ()
    947. try (
    948. file_name = obj.material.opacitymap.filename
    949. obj.material.opacitymap.filename = file_name
    950. count = count + 1
    951.  
    952. update obj
    953. freeSceneBitmaps()
    954.  
    955. ) catch ()
    956. try (
    957. file_name = obj.material.filtermap.filename
    958. obj.material.filtermap.filename = file_name
    959. count = count + 1
    960.  
    961. update obj
    962. freeSceneBitmaps()
    963.  
    964. ) catch ()
    965. try (
    966. file_name = obj.material.reflectionmap.filename
    967. obj.material.reflectionmap.filename = file_name
    968. count = count + 1
    969.  
    970. update obj
    971. freeSceneBitmaps()
    972.  
    973. ) catch ()
    974. try (
    975. file_name = obj.material.refractionmap.filename
    976. obj.material.refractionmap.filename = file_name
    977. count = count + 1
    978.  
    979. update obj
    980. freeSceneBitmaps()
    981.  
    982. ) catch ()
    983.  
    984. try (
    985. file_name = obj.material.selfillummap.filename
    986. obj.material.selfillummap.filename = file_name
    987. count = count + 1
    988.  
    989. update obj
    990. freeSceneBitmaps()
    991.  
    992. ) catch ()
    993.  
    994. try (
    995. file_name = obj.material.shinestrengthmap.filename
    996. obj.material.shinestrengthmap.filename = file_name
    997. count = count + 1
    998.  
    999. update obj
    1000. freeSceneBitmaps()
    1001.  
    1002. ) catch ()
    1003.  
    1004. try (
    1005. file_name = obj.material.shininessmap.filename
    1006. obj.material.shininessmap.filename = file_name
    1007. count = count + 1
    1008.  
    1009. update obj
    1010. freeSceneBitmaps()
    1011.  
    1012. ) catch ()
    1013.  
    1014. try (
    1015. file_name = obj.material.specularmap.filename
    1016. obj.material.specularmap.filename = file_name
    1017. count = count + 1
    1018.  
    1019. update obj
    1020. freeSceneBitmaps()
    1021.  
    1022. ) catch ()
    1023.  
    1024. try (
    1025. file_name = obj.material.ambientmap.filename
    1026. obj.material.ambientmap.filename = file_name
    1027. count = count + 1
    1028.  
    1029. update obj
    1030. freeSceneBitmaps()
    1031.  
    1032. ) catch ()
    1033. if count > 0 then
    1034. messagebox (count as string +" Bitmap Texture(s) has been updated.")
    1035. )
    1036. if classify == Multimaterial then
    1037. (
    1038. -- what are the number of sub-materials?
    1039. mat_count = obj.material.numsubs
    1040. -- Set the loop to go through the obj.material array
    1041. for a = 1 to mat_count do
    1042. (
    1043. try (
    1044. file_name = obj.material[a].diffusemap.filename
    1045. obj.material[a].diffusemap.filename = file_name
    1046. count = count + 1
    1047. update obj
    1048. freeSceneBitmaps()
    1049.  
    1050. ) catch ()
    1051. try (
    1052. file_name = obj.material[a].bumpmap.filename
    1053. obj[a].material.bumpmap.filename = file_name
    1054. count = count + 1
    1055.  
    1056. update obj
    1057. freeSceneBitmaps()
    1058.  
    1059. ) catch ()
    1060. try (
    1061. file_name = obj.material[a].opacitymap.filename
    1062. obj.material[a].opacitymap.filename = file_name
    1063. count = count + 1
    1064.  
    1065. update obj
    1066. freeSceneBitmaps()
    1067.  
    1068. ) catch ()
    1069. try (
    1070. file_name = obj.material[a].filtermap.filename
    1071. obj.material[a].filtermap.filename = file_name
    1072. count = count + 1
    1073.  
    1074. update obj
    1075. freeSceneBitmaps()
    1076.  
    1077. ) catch ()
    1078. try (
    1079. file_name = obj.material[a].reflectionmap.filename
    1080. obj.material[a].reflectionmap.filename = file_name
    1081. count = count + 1
    1082.  
    1083. update obj
    1084. freeSceneBitmaps()
    1085.  
    1086. ) catch ()
    1087. try (
    1088. file_name = obj.material[a].refractionmap.filename
    1089. obj.material[a].refractionmap.filename = file_name
    1090. count = count + 1
    1091.  
    1092. update obj
    1093. freeSceneBitmaps()
    1094.  
    1095. ) catch ()
    1096.  
    1097. try (
    1098. file_name = obj.material[a].selfillummap.filename
    1099. obj.material[a].selfillummap.filename = file_name
    1100. count = count + 1
    1101.  
    1102. update obj
    1103. freeSceneBitmaps()
    1104.  
    1105. ) catch ()
    1106.  
    1107. try (
    1108. file_name = obj.material[a].shinestrengthmap.filename
    1109. obj.material[a].shinestrengthmap.filename = file_name
    1110. count = count + 1
    1111.  
    1112. update obj
    1113. freeSceneBitmaps()
    1114.  
    1115. ) catch ()
    1116.  
    1117. try (
    1118. file_name = obj.material[a].shininessmap.filename
    1119. obj.material[a].shininessmap.filename = file_name
    1120. count = count + 1
    1121.  
    1122. update obj
    1123. freeSceneBitmaps()
    1124.  
    1125. ) catch ()
    1126.  
    1127. try (
    1128. file_name = obj.material[a].specularmap.filename
    1129. obj.material[a].specularmap.filename = file_name
    1130. count = count + 1
    1131.  
    1132. update obj
    1133. freeSceneBitmaps()
    1134.  
    1135. ) catch ()
    1136.  
    1137. try (
    1138. file_name = obj.material[a].ambientmap.filename
    1139. obj.material[a].ambientmap.filename = file_name
    1140. count = count + 1
    1141.  
    1142. update obj
    1143. freeSceneBitmaps()
    1144.  
    1145. ) catch ()
    1146. ) -- loop
    1147.  
    1148. if count > 0 then
    1149. messagebox (count as string +" Bitmap Textures has been updated.")
    1150. ) -- if
    1151. true
    1152. )
    1153. -- this func looks for the uvwmap mod in the modifier stack and then the modifier
    1154. -- is returned.
    1155. fn check_stack mod_name obj =
    1156. (
    1157. local mod_n
    1158. this_stack = obj.modifiers.count
    1159. for i = 1 to this_stack do
    1160. (
    1161. mod_n = obj.modifiers[i]
    1162. names = classof mod_n
    1163. if names == mod_name then exit
    1164. )
    1165. return mod_n
    1166. )
    1167. fn expire_script =
    1168. (
    1169. messagebox "This script is time-sensitive. Please make sure your system clock is functioning properly." title:"System Clock Error"
    1170. )
    1171. fn test_script =
    1172. (
    1173. token = #()
    1174. token = get_all_tokens localTime " "
    1175.  
    1176. if token[3] as integer < 0 then
    1177. (
    1178. print token[1]
    1179. expire_script()
    1180. return false
    1181. )
    1182. true
    1183. )
    1184. fn process_diff pntA pntB =
    1185. (
    1186. diffX = abs(pntA.x - pntB.x)
    1187. diffY = abs(pntA.y - pntB.y)
    1188. diffZ = abs(pntA.z - pntB.z)
    1189. mean = diffX + diffY + diffZ
    1190.  
    1191. mean
    1192. )
    1193. ---------------------------------------------------------------------------------
    1194. -- UI
    1195. ---------------------------------------------------------------------------------
    1196.  
    1197. -- SurfUnwrap
    1198. local unwrap_obj -- unwrap surface
    1199. local meshU_obj -- stores the 'target' array from the vertSelection
    1200. local object = true -- picked spline surf
    1201. local old_spl = #() -- store the original mesh/spline
    1202. local x_width = 0.0
    1203. local rPressed = 0 -- stores if restore button pressed
    1204. -- Junk Bitmap
    1205. local junk_bitmap = ""
    1206.  
    1207. -- Button Width
    1208. local b_width = 135, b_height = 18
    1209.  
    1210.  
    1211.  
    1212. rollout attach_roll "<-- Attachments -->"
    1213. (
    1214. local group_a, group_b
    1215. local attach_num = 0
    1216. local m_list = #()
    1217. group ""
    1218. (
    1219. pickbutton obj_a "Source" width:100 tooltip:"Source object"
    1220. pickbutton obj_b "Attach" width:100 tooltip:"Choose mesh to attach."
    1221. checkbox no_attach "Do not Attach" checked:false align:#center
    1222. button save_list "Output" width:50 tooltip:"Output Attachments List to MAXscript Listener." across:2
    1223. button reset_list "Reset" width:50 tooltip:"Reset Attachments List."
    1224. button list_help "Help" width:110
    1225. )
    1226. on list_help pressed do
    1227. (
    1228. messagebox "Use the Attachments Utility to keep track of the order you used to attach mesh objects." title:"Attachments Utility"
    1229. )
    1230. on save_list pressed do
    1231. (
    1232. print "Attachments Utility"
    1233. for i = 1 to m_list.count do
    1234. (
    1235. gw = m_list[i]
    1236. -- Output Attachments List to the Listener
    1237. print gw
    1238. )
    1239. )
    1240. group ""
    1241. (
    1242. listbox mesh_list items:m_list height:3
    1243. )
    1244. on obj_a picked nobj do
    1245. (
    1246. group_a = nobj
    1247. obj_a.text = group_a.name
    1248. if classof group_a != Editable_Mesh then convertToMesh group_a
    1249. select group_a
    1250. )
    1251. fn make_attach nobj =
    1252. (
    1253. diffuse_a = diffuse_b = undefined
    1254. group_b = nobj
    1255. gw = group_b.name as string
    1256. gwo = group_a.name as string
    1257. if classof group_b != Editable_Mesh then convertToMesh group_b
    1258. if no_attach.checked == false then
    1259. (
    1260. attach group_a group_b
    1261. attach_num = attach_num + 1
    1262. )
    1263. next = m_list.count + 1
    1264. m_list[next] = next as string+": "+gwo + "->" + gw
    1265. mesh_list.items = m_list
    1266. select group_a
    1267. )
    1268. on obj_b picked nobj do
    1269. (
    1270. make_attach nobj
    1271. )
    1272. on reset_list pressed do
    1273. (
    1274. group_a = group_b = undefined
    1275. m_list = #()
    1276. attach_num = 0
    1277. mesh_list.items = m_list
    1278. obj_a.text = "Source"
    1279. )
    1280. ) -- rollout
    1281.  
    1282.  
    1283.  
    1284.  
    1285. -- This fn works to glue mesh pieces together.
    1286. rollout glue_roll "Surf Glue"
    1287. (
    1288. local pick_str, objA, objB, index, arrA = #(), arrB = #()
    1289. group "Source Data"
    1290. (
    1291. pickbutton p_a "OBJECT A" width:80
    1292. pickbutton p_b "OBJECT B" width:80
    1293. button store "COPY" width:80 tooltip:"Stores the overlaps to memory"
    1294. spinner set_thres "Scale:" range:[0, 1, .1] scale:.1 type:#float width:60 align:#center
    1295. label p_ab "A<-->B" across:2
    1296. label p_count "[Unknown]" align:#left
    1297. )
    1298. listbox glue_items "Pieces:" items:glue_names height:3
    1299. button paste "GLUE" width:50 tooltip:"GLUE together mesh pieces." across:2
    1300. button reset "Reset" width:50 tooltip:"Reset this tool."
    1301. button r_obj "Restore Object" width:110 tooltip:"Restore OBJECT B"
    1302. button g_help "Help" width:110
    1303.  
    1304. on g_help pressed do
    1305. (
    1306. messagebox "Use this utility to close the gaps between detached mesh pieces." title:"GLUE"
    1307. )
    1308. -- This feature will allow users to examine a Vertex Selection when they click
    1309. -- on the group.
    1310. on glue_items selected val do
    1311. (
    1312. try (
    1313. setvertselection glue_objA[val] glue_pos[val]
    1314. setvertselection glue_objB[val] glue_set[val]
    1315.  
    1316. update glue_objA[val]
    1317. update glue_objB[val]
    1318. ) catch (
    1319. messagebox "You cannot select a deleted scene node." title:"GLUE"
    1320. )
    1321. )
    1322. on r_obj pressed do
    1323. (
    1324. try (
    1325. f = getnumverts objB
    1326. ) catch (
    1327. messagebox "You cannot restore a deleted scene node." title:"GLUE"
    1328. return 0
    1329. )
    1330.  
    1331. count = 1
    1332. g_index = glue_items.selection
    1333. for i in glue_set[g_index] do
    1334. (
    1335. setvert objB i previous_b[count]
    1336. count = count + 1
    1337. )
    1338. update objB
    1339. )
    1340. on reset pressed do
    1341. (
    1342. glue_set = #()
    1343. glue_names = #()
    1344. glue_items.items = glue_names
    1345. p_a.text = "OBJECT A"
    1346. p_b.text = "OBJECT B"
    1347. p_count.text = "[Unknown]"
    1348. objA = objB = undefined
    1349. previous_b = #()
    1350. )
    1351. on p_a picked nobj do
    1352. (
    1353. objA = nobj
    1354. p_a.text = objA.name
    1355. select objA
    1356. progressStart "Transforming Data....."
    1357. type = classof objA
    1358. if type == editable_mesh or type == sphere or type == box then
    1359. (
    1360. converttomesh objA
    1361. numV = getnumverts objA
    1362. arrA[1] = #()
    1363. for i = 1 to numV do
    1364. (
    1365. calcy = (i as float / numV as float) * 100
    1366. calcy = calcy as integer
    1367. progressUpdate calcy
    1368. arrA[1][i] = getvert objA i
    1369. )
    1370. )
    1371. progressEnd()
    1372. )
    1373. on p_b picked nobj do
    1374. (
    1375. objB = nobj
    1376. p_b.text = objB.name
    1377. select objB
    1378. progressStart "Transforming Data....."
    1379. type = classof objB
    1380. if type == editable_mesh or type == sphere or type == box then
    1381. (
    1382. converttomesh objB
    1383. numV = getnumverts objB
    1384. arrB[1] = #()
    1385. for i = 1 to numV do
    1386. (
    1387. calcy = (i as float / numV as float) * 100
    1388. calcy = calcy as integer
    1389. progressUpdate calcy
    1390. arrB[1][i] = getvert objB i
    1391. )
    1392. )
    1393. progressEnd()
    1394. )
    1395. -- This function saves the colliding vertices from obj B to an array.
    1396. fn copySel objA objB thres =
    1397. (
    1398. local pntA, pntB, diff
    1399. a = arrA[1].count
    1400. b = arrB[1].count
    1401. g_index = glue_set.count + 1
    1402. arry = #()
    1403. count = 0
    1404.  
    1405. glue_objB[g_index] = objB
    1406. glue_objA[g_index] = objA
    1407. glue_pos[g_index] = #()
    1408. glue_set[g_index] = #()
    1409. progressStart "Searching...."
    1410. -- Look for a collision
    1411. for i = 1 to a do
    1412. (
    1413. pntA = arrA[1][i]
    1414. prcnt = (i as float/a as float * 100.0) as integer
    1415. progressUpdate prcnt
    1416. loc = findItem arrB[1] pntA
    1417. if loc == 0 then
    1418. (
    1419. for j = 1 to arrB.count do
    1420. (
    1421. pntB = arrB[1][j]
    1422. diff = process_diff pntA pntB
    1423. if diff < thres then
    1424. (
    1425. loc = j
    1426. exit
    1427. )
    1428. ) -- loop
    1429. ) -- if
    1430. if diff < thres or loc != 0 then
    1431. (
    1432. count = count + 1
    1433. append glue_set[g_index] loc
    1434. append glue_pos[g_index] i
    1435. append arry i
    1436. )
    1437. ) -- loop i
    1438. progressEnd()
    1439. convertTomesh objB
    1440. setvertselection objB glue_set[g_index]
    1441. convertToMesh objA
    1442. setvertselection objA arry
    1443. gw = objA.name as string + "<-->" + objB.name as string
    1444. if count > 1 then
    1445. (
    1446. glue_names[g_index] = gw
    1447. try (
    1448. glue_items.items = glue_names
    1449. ) catch (
    1450. messagebox "Unknown Error"
    1451. return 0
    1452. )
    1453. gw = "["+count as string+"]"
    1454. p_count.text = gw
    1455. )
    1456. count
    1457. )
    1458.  
    1459. on store pressed do
    1460. (
    1461. if classof objA == Editable_mesh and classof objB == Editable_mesh then copySel objA objB set_thres.value
    1462. )
    1463.  
    1464.  
    1465. fn pasteSel =
    1466. (
    1467. index = glue_items.selection
    1468. count = 1
    1469. -- ReSelect the objects. Update the data.
    1470. try (
    1471. select glue_objA[index]
    1472. a = selection as array
    1473. objA = a[1]
    1474. ) catch (
    1475. messagebox "Please click COPY first to copy the vertex positions before performing a GLUE operation." title:"GLUE"
    1476. return 0
    1477. )
    1478.  
    1479. try (
    1480. select glue_objB[index]
    1481. a = selection as array
    1482. objB = a[1]
    1483. ) catch (
    1484. messagebox "Please click COPY first to copy the vertex positions before performing a GLUE operation." title:"GLUE"
    1485. return 0
    1486. )
    1487. previous_b = #()
    1488. try (
    1489. for i in glue_set[index] do
    1490. (
    1491. append previous_b (getvert objB i)
    1492. pnt = getvert objA glue_pos[index][count]
    1493. setvert objB i pnt
    1494. count = count + 1
    1495. )
    1496. update objB
    1497. ) catch (
    1498. messagebox "You have made an invalid selection. This node has been deleted." title:"GLUE"
    1499. )
    1500. )
    1501. on paste pressed do
    1502. (
    1503. pasteSel()
    1504. )
    1505. ) -- rollout
    1506.  
    1507.  
  • cupsster
    Offline / Send Message
    cupsster polycounter lvl 11
    1.  
    2.  
    3. rollout surf_unwrap "Source Materials"
    4. (
    5. local uvBMP, file, default_size = 256
    6. fn createAttachFloater =
    7. (
    8. try
    9. (
    10. closeRolloutFloater attachFloater
    11. removeRollout attachFloater
    12. )
    13. catch ()
    14. attachFloater = newRolloutFloater "Mesh Attach" 175 300 270 150
    15. addRollout attach_roll attachFloater
    16. )
    17.  
    18. fn createGlueFloater =
    19. (
    20. try
    21. (
    22. closeRolloutFloater glueFloater
    23. removeRollout glueFloater
    24. )
    25. catch ()
    26. glueFloater = newRolloutFloater "GLUE" 175 360 270 150
    27. addRollout glue_roll glueFloater
    28. )
    29. group "Parameters"
    30. (
    31. PickButton pickUnwrap "<Surf>" width:100
    32. PickButton pickY "=>" width:20 height:16 pos:[30, 60]
    33. editText grid_pos "Y Axis:" text:"0.0" fieldWidth:60 enabled:false pos:[54, 60]
    34. PickButton pickX "=>" width:20 height:16 pos:[30, 80]
    35. editText grid_Xpos "X Axis:" text:"0.0" fieldWidth:60 pos:[54, 80] enabled:false
    36. checkbox morph "Use Stack" checked:false pos:[30, 100]
    37.  
    38. spinner set_width "Scale:" range:[0, 1, .1] scale:.1 type:#float width:60 align:#center
    39. )
    40. group "Options"
    41. (
    42. button unwrapSurf "Unwrap" width:50 across:2 tooltip:"Unwrap the mesh object."
    43. button restore "Restore" width:50 tooltip:"Restore the mesh object."
    44. button start_attach "Attach" width:50 across:2 tooltip:"Attachments Log"
    45. button start_glue "Glue" width:50 tooltip:"Glue Mesh Pieces together."
    46. )
    47. button surf_help "Help" width:100
    48. label disp_unwrap ""
    49. on start_attach pressed do createAttachFloater()
    50. on start_glue pressed do createGlueFloater()
    51. on surf_help pressed do
    52. (
    53. messagebox "Use this utility to directlty unwrap a mesh or spline (Surface Tools) surface according to the postions of the X and Y planar grids.
    54. \n1. After non-circular, open sections of the mesh have been detached, draw the grids for the X and Y axis.
    55. \n2. Position the object whereas the X grid is in the middle and the Y grid is in front.
    56. \n3. Click the Unwrap button."
    57. )
    58. on pickY picked nobj do
    59. (
    60. grid_pos.text = nobj.pos.y as string
    61. select nobj
    62. )
    63. on morph changed state do
    64. (
    65. morph_state = state
    66. )
    67.  
    68. on pickX picked nobj do
    69. (
    70. grid_Xpos.text = nobj.pos.x as string
    71. select nobj
    72. )
    73. on set_width changed val do
    74. (
    75. x_width = val
    76. )
    77. on restore pressed do
    78. (
    79. if object == true then restore_spline unwrap_obj old_spl disp_unwrap
    80. else
    81. restore_mesh unwrap_obj meshU_obj old_spl disp_unwrap
    82. )
    83. on pickUnwrap picked nobj do
    84. (
    85. local old_k, old_s
    86. -- Do not let the user panel reset itself again.
    87. rPressed = 1
    88. unwrap_obj = nobj
    89. pickUnwrap.text =unwrap_obj.name
    90. try (
    91. convertToSplineShape nobj
    92. unwrap_obj = nobj
    93. pnt = getKnotPoint unwrap_obj 1 1
    94. object = true
    95. count = 1
    96. old_s = numSplines unwrap_obj
    97. for i = 1 to old_s do
    98. (
    99. old_k = numKnots unwrap_obj i
    100. for j = 1 to old_k do
    101. (
    102. pnt = getKnotPoint unwrap_obj i j
    103. old_spl[count] = i as string + " " + j as string + " " + pnt.x as string + " " + pnt.y as string + " " + pnt.z as string
    104. count = count + 1
    105. )
    106. )
    107. )
    108. catch (
    109. object = false
    110. pnt = [0, 0, 0]
    111. try
    112. (
    113. -- Determine if it is a mesh object.
    114. old_k = getnumverts unwrap_obj
    115. for i = 1 to old_k do
    116. (
    117. old_spl[i] = getvert unwrap_obj i
    118. )
    119. ) catch (
    120. -- This is not a mesh either. Try NURBS Point Surf...
    121. )
    122. ) -- main catch
    123. if rPressed == 0 then
    124. (
    125. grid_pos.text = unwrap_obj.pos.y as string
    126. grid_Xpos.text = pnt.x as string
    127. )
    128. grid_pos.enabled = true
    129. grid_Xpos.enabled = true
    130. select unwrap_obj
    131. )
    132. on unwrapSurf pressed do
    133. (
    134. b_axis = grid_pos.text as float
    135. x_a = grid_Xpos.text as float
    136. thres = set_width.value
    137. if object == true then unwrap_spline unwrap_obj b_axis x_a thres disp_unwrap
    138. else
    139. (
    140. meshU_obj = unwrap_mesh unwrap_obj b_axis x_a x_width morph.checked disp_unwrap
    141. )
    142. )
    143. ) -- rollout
    144.  
    145.  
    146.  
    147.  
    148. rollout map_roll "Mapping Types"
    149. (
    150. group "Parameters"
    151. (
    152. radiobuttons uvw_type "Mapping Type:" labels:#("Planar", "Cylindrical", "Spherical", "Shrink Wrap", "Box", "Face") default:1
    153. radiobuttons align_type "Axis:" labels:#("X", "Y", "Z") default:1
    154. )
    155. on uvw_map changed val do
    156. (
    157. map_type = val - 1
    158. )
    159. on align_type changed val do
    160. (
    161. uvw_axis = val - 1
    162. )
    163.  
    164. )
    165. -- color_mat & global_color are global varibles used here.
    166. rollout edge_roll "Assign Edge Color"
    167. (
    168. local l_obj, arry = #()
    169. fn assign_edges obj colA =
    170. (
    171. l_obj = obj
    172. sel_index = sel_set.count + 1
    173. if color_mat.count < 1 then
    174. (
    175. f = getnumfaces obj * 3
    176. for a = 1 to f do
    177. (
    178. color_mat[a] = 0
    179. )
    180. )
    181. -- Get EdgeSelection from Edit_Mesh or Editable_Mesh modifiers
    182. try (
    183. arry = getEdgeSelection obj obj.modifiers[1]
    184. ) catch (
    185. try (
    186. arry = getEdgeSelection obj
    187. ) catch (
    188. messagebox "Please add an Edit Mesh modifier to your mesh to select the edges!"
    189. return 0
    190. )
    191. )
    192. if arry.count >= 1 then
    193. (
    194. sel_set[sel_index] = arry
    195. sel_index = sel_index + 1
    196. try (
    197. for i in arry do
    198. (
    199. color_mat[i] = colA
    200. )
    201. ) catch (
    202. messagebox "Please use an Edit Mesh modifier to select the edge."
    203. )
    204. )
    205. else
    206. messagebox "There was not an EdgeSelection Present." title:"Edge Colors"
    207. )
    208. group "Source Data"
    209. (
    210. colorpicker edge_color "Edge:" color:global_color offset:[0,0]
    211. pickbutton p_obj "SOURCE" width:80 height:25
    212. button get_edges "-->Get<--" width:80
    213. button unselect "Invisible Edges" width:80 tooltip:"Make unselected edges invisible."
    214. )
    215. -- Code -1 means do not draw this edge.
    216. fn makeInvisible =
    217. (
    218. try (
    219. numE = getnumfaces l_obj
    220. ) catch (
    221. messagebox "Please pick the SOURCE object first."
    222. return 0
    223. )
    224. numE = numE * 3
    225. try (
    226. for i = 1 to numE do
    227. (
    228. if color_mat[i] == 0 then color_mat[i] = -1
    229. )
    230. ) catch (
    231. messagebox "There is a problem with this node."
    232. )
    233. )
    234. on unselect pressed do
    235. (
    236. makeInvisible()
    237. )
    238. group "Color Assignments"
    239. (
    240. label e_title "NumOfEdges:" across:2
    241. label e_num "UNKNOWN"
    242. spinner c_set "Set:" type:#integer range:[1, 10000, sel_index] scale:1 width:80 enabled:false align:#center
    243. )
    244. on c_set changed val do
    245. (
    246. if val > sel_set.count then
    247. (
    248. val = val - 1
    249. c_set.value = val
    250. )
    251. try (
    252. convertToMesh l_obj
    253. setEdgeSelection l_obj sel_set[val]
    254. update l_obj
    255. select l_obj
    256. ) catch (
    257. messagebox "Could not set the Edge Selection." title:"Assign Edge Colors"
    258. )
    259. )
    260. button reset "Reset" width:80
    261. button e_help "Help!" width:80
    262. on reset pressed do
    263. (
    264. sel_set = #()
    265. sel_index = 0
    266. c_set.value = 1
    267. c_set.enabled = false
    268. color_mat =#()
    269. p_obj.text = "SOURCE"
    270. e_num.text = "UNKNOWN"
    271. global_color = white
    272. edge_color.color = white
    273. arry = #()
    274. )
    275. fn setup nobj =
    276. (
    277. if classof nobj == editable_mesh then
    278. (
    279. assign_edges nobj edge_color.color
    280. gw = (getnumfaces nobj * 3) as string
    281. e_num.text = gw
    282. select nobj
    283. p_obj.text = nobj.name
    284. c_set.enabled = true
    285. )
    286. else
    287. messagebox "Please use an EDIT MESH modifier to select an edge." title:"Edge Color Assignments"
    288. )
    289. on p_obj picked nobj do
    290. (
    291. setup nobj
    292. )
    293. on get_edges pressed do
    294. (
    295. a = selection as array
    296. setup a[1]
    297. )
    298. on e_help pressed do
    299. (
    300. messagebox "Use this utility to color the edges of a mesh so that a 'texture seam' does not appear." title:"Edge Color Assignments"
    301. )
    302. ) --rollout
    303.  
    304.  
    305.  
    306. -- this rollout is used to create a mesh based on the texture UVs...
    307. -- UV Mesher
    308. rollout uv_roll "Texture UVs->MESH"
    309. (
    310. local obj, default_size = 256, obj_a, obj_b
    311. fn make_mesh iW iH iZ z_on face_sel =
    312. (
    313. if classof obj != editable_mesh then
    314. (
    315. return 0
    316. )
    317.  
    318. numF = getnumfaces obj
    319. numV = getnumtverts obj
    320. tar = #()
    321. if z_on == false then iZ = 0.0
    322. -- Get Face Selection
    323. if face_sel == true then
    324. (
    325. try (
    326. tar = getFaceSelection obj obj.modifiers[1]
    327. ) catch (
    328. tar = setFaceArray tar numF
    329. messagebox "There was not a Face Selection present at the top of the modifier stack." title:"UV Mesher"
    330. )
    331. )
    332. else
    333. tar = setFaceArray tar numF
    334. Uobj = mesh numverts:numV numfaces:tar.count
    335. Uobj.pos = [0,0,0]
    336. for t in tar do
    337. (
    338. -- get the faces
    339. try (
    340. faceT = getTVFace obj t
    341. ) catch (
    342. messagebox "This object does not have any UVW Mapping Applied."
    343. return 0
    344. )
    345. -- take the TVs out of the face index
    346. tva = gettvert obj faceT.x
    347. tvb = gettvert obj faceT.y
    348. tvc = gettvert obj faceT.z
    349. -- Translate the TVs to 3D Space positions.
    350. a = [(tva.x*iW),(tva.y*iH), (tva.z*iZ)]
    351. b = [(tvb.x*iW),(tvb.y*iH), (tvb.z*iZ)]
    352. c = [(tvc.x*iW),(tvc.y*iH), (tvc.z*iZ)]
    353. setvert Uobj faceT.x a
    354. setvert Uobj faceT.y b
    355. setvert Uobj faceT.z c
    356. setface Uobj t faceT.x faceT.y faceT.z
    357. e1 = getedgevis obj t 1
    358. setedgevis Uobj t 1 e1
    359.  
    360. e2 = getedgevis obj t 2
    361. setedgevis Uobj t 2 e2
    362.  
    363. e3 = getedgevis obj t 3
    364. setedgevis Uobj t 3 e3
    365. )
    366. update Uobj
    367. Uobj.wirecolor = obj.wirecolor
    368. -- Delete Unnecessary verts from the node.
    369. zero_pnt = [0,0,0] as string
    370. count = 0
    371. numV = getnumverts Uobj
    372. for y = 1 to numV do
    373. (
    374. try (
    375. pnt = getvert Uobj y
    376. if pnt as string == zero_pnt then
    377. (
    378. deletevert Uobj y
    379. numV = numV - 1
    380. count = count + 1
    381. )
    382. ) catch ()
    383. )
    384. gw = "There were "+count as string+" unnecessary vertices deleted from the node."
    385. messagebox gw title:"UV Mesher"
    386. --rotate Uobj 90 [1, 0, 0]
    387. )
    388. fn deform_uvs objA objB iW iH iZ =
    389. (
    390. local numT
    391. converttomesh objA
    392. converttomesh objB
    393. try (
    394. getTVFace objA 1
    395. ) catch (
    396. messagebox "Please apply UVW Mapping to the SOURE object." title:"UV Mesher"
    397. return 0
    398. )
    399. numF = getnumfaces objA
    400. numF2 = getnumfaces objB
    401. if numF != numF2 then
    402. (
    403. messagebox "These objects do not have an equal # of faces." title:"UV Mesher"
    404. return 0
    405. )
    406. converttomesh objA
    407. for i = 1 to numF do
    408. (
    409. fa = getTVFace objA i
    410. fb = getFace objB i
    411. va1 = getvert objB fb.x
    412. va2 = getvert objB fb.y
    413. va3 = getvert objB fb.z
    414. if iZ != 0 then tz = va1.z/iZ
    415. else
    416. tz = 0
    417. tpnt1 = [(va1.x/iW), (va1.y/iH), tz]
    418.  
    419. if iZ != 0 then tz = va2.z/iZ
    420. else
    421. tz = 0
    422. tpnt2 = [(va2.x/iW), (va2.y/iH), tz]
    423. if iZ != 0 then tz = va3.z/iZ
    424. else
    425. tz = 0
    426. tpnt3 = [(va3.x/iW), (va3.y/iH), tz]
    427. settvert objA fa.x tpnt1
    428. settvert objA fa.y tpnt2
    429. settvert objA fa.z tpnt3
    430. )
    431. update objA
    432. )
    433. fn morph_mesh objA objB =
    434. (
    435. numF = getnumfaces objB
    436. numFa = getnumfaces objA
    437. if numFa < numF then
    438. (
    439. messagebox "SOURCE Object does not contain enough faces to create the morph target."
    440. return 0
    441. )
    442. index_v = #()
    443. index_p = #()
    444. count = 1
    445. progressStart "Analyzing...."
    446.  
    447. for t = 1 to numF do
    448. (
    449. calcy = (t as float / numF as float) * 100
    450. calcy = calcy as integer
    451. progressUpdate calcy
    452.  
    453. -- get the faces
    454. faceT = getface objB t
    455. -- take the Vertices out of the face index from TARGET
    456. tva = getvert objB faceT.x
    457. tvb = getvert objB faceT.y
    458. tvc = getvert objB faceT.z
    459. -- take Vertices out of the face index from SOURCE
    460. faceS = getface objA t
    461. setvert objA faceS.x tva
    462. setvert objA faceS.y tvb
    463. setvert objA faceS.z tvc
    464.  
    465. -- Mark all the verts that are not moving.
    466. index_v[faceS.x] = 1
    467. index_v[faceS.y] = 1
    468. index_v[faceS.z] = 1
    469. ) -- loop t
    470.  
    471. progressEnd()
    472. update objA
    473.  
    474. progressStart "Checking...."
    475. numV = getnumverts objA
    476. for i = 1 to numV do
    477. (
    478. calcy = (i as float / numV as float) * 100
    479. calcy = calcy as integer
    480. progressUpdate calcy
    481.  
    482. if index_v[i] == undefined then
    483. (
    484. index_p[count] = i
    485. count = count + 1
    486. )
    487. )
    488. progressEnd()
    489. if index_p.count >= 1 then
    490. (
    491. gw = index_p as string
    492. setvertselection objA index_p
    493. update objA
    494. gw = "I have found "+count as string+" incorrect vertices. Go to Editable Mesh->Sub-Object Vertex to delete the selection."
    495. messagebox gw title:"UV Mesher"
    496. )
    497. select objA
    498. )
    499. group "Source Objects"
    500. (
    501. pickbutton p_obj "SOURCE" width:100
    502. spinner mesh_sizeY "Length:" type:#float range:[1, 8000, default_size] scale:1 width:95 offset:[-2,0] enabled:register
    503. spinner mesh_sizeX " Width:" type:#float range:[1, 8000, default_size] scale:1 width:95 offset:[-5,0] enabled:register
    504. spinner mesh_sizeZ "Height:" type:#float range:[0, 8000, default_size] scale:1 width:95 offset:[-5,0] enabled:register
    505. checkbox z_on "Depth" checked:true align:#center
    506. button f_ap "APPLY" width:100
    507. )
    508. on z_on changed state do
    509. (
    510. if state == false then
    511. (
    512. mesh_sizeZ.enabled = false
    513. )
    514. else
    515. mesh_sizeZ.enabled = true
    516. )
    517. on p_obj picked nobj do
    518. (
    519. type = classof nobj
    520. if classof nobj == Editable_mesh or type == sphere or type == cylinder then
    521. (
    522. obj = nobj
    523. p_obj.text = obj.name
    524. select obj
    525. converttomesh obj
    526. -- Get Dimensions of the Diffuse Channel
    527. try (
    528. map = obj.material.diffusemap
    529. file_sel = openBitmap map.filename
    530. mesh_sizeX.value = file_sel.width
    531. mesh_sizeY.value = file_sel.height
    532. ) catch ()
    533. )
    534. else
    535. (
    536. messagebox "Please apply an Edit Mesh modifier to your mesh object." title:"UV Mesher"
    537. )
    538. )
    539. on f_ap pressed do
    540. (
    541.  
    542. if classof obj == editable_mesh then make_mesh mesh_sizeX.value mesh_sizeY.value mesh_sizeZ.value z_on.checked false
    543. else
    544. messagebox "Please select an Editable Mesh Object or Convert the Object to an Editable Mesh."
    545. )
    546. group "Manipulate Surf"
    547. (
    548. pickbutton obj1 "SOURCE" width:100
    549. pickbutton obj2 "TARGET" width:100
    550. button d_uv "WARP" width:45 height:25 across:2 align:#center tooltip:"Match SOURCE UV Coords to TARGET UV Mesh"
    551. button morph_uv "MORPH" width:45 height:25 tooltip:"Morph UV Mesh to SOURCE Object."
    552. )
    553. on morph_uv pressed do
    554. (
    555. if classof obj_a == editable_mesh and classof obj_b == editable_mesh then
    556. morph_mesh obj_a obj_b
    557. )
    558. on obj1 picked nobj do
    559. (
    560. type = classof nobj
    561. if classof nobj == editable_mesh then
    562. (
    563. obj_a = nobj
    564. obj1.text = nobj.name
    565. select obj_a
    566. )
    567. else
    568. (
    569. messagebox "Please select an Editable Mesh Object or Convert the Object to an Editable Mesh."
    570. )
    571. )
    572. on obj2 picked nobj do
    573. (
    574. type = classof nobj
    575. if classof nobj == editable_mesh or type == sphere or type == cylinder then
    576. (
    577. obj_b = nobj
    578. obj2.text = nobj.name
    579. select obj_b
    580. converttomesh obj_b
    581. )
    582. else
    583. messagebox "Please select an Editable Mesh Object or Convert the Object to an Editable Mesh."
    584. )
    585. on d_uv pressed do
    586. (
    587. if classof obj_a == editable_mesh and classof obj_b == editable_mesh then
    588. deform_uvs obj_a obj_b mesh_sizeX.value mesh_sizeY.value mesh_sizeZ.value
    589. else
    590. messagebox "Please select Editable Mesh Objects only."
    591. )
    592. )
    593. -- UV Renderer
    594. rollout rend_roll "UV Manager"
    595. (
    596. local default_size = 256, file_sel
    597. fn createEdgeFloater =
    598. (
    599. try
    600. (
    601. closeRolloutFloater edgeFloater
    602. removeRollout edgeFloater
    603. )
    604. catch ()
    605. edgeFloater = newRolloutFloater "Assign Colors" 175 340 270 150
    606. addRollout edge_roll edgeFloater
    607. )
    608.  
    609. group "Render Settings"
    610. (
    611. colorpicker user_color "Wire:" color:white offset:[0,0]
    612. colorpicker mat_color "Mat:" color:black offset:[0,0]
    613. checkbox def_mat "Default Material" checked:false offset:[25,0]
    614. checkbutton use_stack "Use Stack" width:100 tooltip:"Use Face Selection from stack."
    615. --checkbutton light_stack "Highlight Faces" width:100 tooltip:"Highlight the Face Selection."
    616.  
    617. spinner image_sizeY "Length:" type:#float range:[10, 8000, default_size] scale:1 width:95 offset:[-2,0] enabled:register
    618. spinner image_sizeX " Width:" type:#float range:[10, 8000, default_size] scale:1 width:95 offset:[-5,0] enabled:register
    619.  
    620. button user_map "<NONE>" width:100 tooltip:"Choose the texture for the object." enabled:register
    621. button display_map "Display Image" width:100 tooltip:"Display Image." enabled:register
    622. button render_map "Render Map" width:100 tooltip:"Render the UV Map."
    623. button assign_map "Edge Colors" width:100 tooltip:"Assigns Colors to UV Edges."
    624. checkbox mapping "Include Bitmap" checked:false offset:[25,0] enabled:register
    625. )
    626. on assign_map pressed do
    627. (
    628. -- move user_color to the global color
    629. global_color = user_color.color
    630. createEdgeFloater()
    631. )
    632. on display_map pressed do
    633. (
    634. try (
    635. display file_sel
    636. ) catch (
    637. messagebox "There is no image stored in the buffer."
    638. )
    639. )
    640. on user_map pressed do
    641. (
    642. filename = selectBitMap caption:"Select Bitmap Texture"
    643. file_sel = filename
    644. --image_sizeX.value = file_sel.width
    645. --image_sizeY.value = file_sel.height
    646. --try (
    647. if file_sel != undefined then
    648. (
    649. arry = get_all_tokens file_sel.filename " "
    650. user_map.text = arry[arry.count]
    651. )
    652. else
    653. file_sel = ""
    654. )
    655. on cancel_op pressed do
    656. (
    657. shutDown=true
    658. progressEnd()
    659. )
    660. on def_mat changed val do
    661. (
    662. try (
    663. obj_array = selection as array
    664. unwrap_obj = obj_array[1]
    665. classify = classof unwrap_obj.material
    666. if val == true then mat_color.enabled = false
    667. else
    668. mat_color.enabled = true
    669. if val == true and classify == Standardmaterial then
    670. (
    671. try (
    672. mat_color.color = unwrap_obj.material.diffuse
    673. map = unwrap_obj.material.diffusemap
    674. file_sel = openBitmap map.filename
    675. image_sizeX.value = file_sel.width
    676. image_sizeY.value = file_sel.height
    677. arry = get_all_tokens file_sel.filename " "
    678. user_map.text = arry[arry.count]
    679.  
    680. ) catch ()
    681. )
    682. else
    683. (
    684. messagebox "This feature presently only works with Standard Materials."
    685. mat_color.enabled = true
    686. def_mat.checked = false
    687. )
    688. ) catch (
    689. messagebox "You have selected an invalid object."
    690. )
    691. ) -- group
    692. fn uv_rend =
    693. (
    694. err = 0
    695. obj_array = grab_sel()
    696. unwrap_obj = obj_array[1]
    697. tv_count = 0 -- # of tverts.
    698. if unwrap_obj == undefined then
    699. (
    700. return 0
    701. )
    702. try (
    703. g = getnumverts unwrap_obj
    704. ) catch (
    705. convertToMesh unwrap_obj
    706. )
    707. -- initialize the edge color array.....
    708. progressStart "Analyzing........"
    709. f = getnumfaces unwrap_obj
    710. f = f * 3
    711. try (
    712. if color_mat.count != f then
    713. (
    714. color_mat = #()
    715. for i = 1 to f do
    716. (
    717. calcy = (i as float / f as float) * 100
    718. calcy = calcy as integer
    719. if calcy < 1 then calcy = 1
    720. progressUpdate calcy
    721. color_mat[i] = 0
    722. )
    723. )
    724. ) catch ()
    725. progressEnd()
    726. try (
    727. tv_count = getnumtverts unwrap_obj
    728. ) catch (
    729. )
    730. mod_n = check_stack uvwmap unwrap_obj
    731. gw = classof mod_n
    732.  
    733. -- if uvwmap is not found, then add it w/planar projection.
    734. if gw != uvwmap then (
    735. if tv_count <= 0 then
    736. (
    737. addModifier unwrap_obj (uvwmap maptype:map_type)
    738. mod_n = unwrap_obj.modifiers[1]
    739. )
    740. ) -- if
    741. --try
    742. --(
    743. err = 1
    744. tv_count = getnumtverts unwrap_obj
    745. if mapping.checked then uvBMP = file_sel
    746. else
    747. (
    748. if user_map.text != "<NONE>" then
    749. (
    750. uvBMP = bitmap file_sel.width file_sel.height
    751. )
    752. else
    753. uvBMP = bitmap image_sizeX.value image_sizeY.value
    754. setMaterial uvBMP mat_color.color
    755. ) -- else
    756. arr = user_color.color
    757. arr.alpha = 255.0
    758. u_color = #(arr)
    759. err = 2
    760. if tv_count > 0 then render_uvw unwrap_obj uvBMP (u_color)(use_stack.checked)
    761. else
    762. messagebox "This object must be mapped."
    763. --)
    764. --catch (
    765. -- messagebox "Cannot Render." title:"UV Manager"
    766. --)
    767.  
    768. ) -- function
    769. on render_map pressed do
    770. (
    771. uv_rend()
    772. ) -- func
    773. ) -- rollout
    774. rollout match_roll "Source Materials"
    775. (
    776. local target, source
    777. group "" (
    778. pickbutton pick_tar "<TARGET>" width:100
    779. pickbutton pick_source "<SOURCE>" width:100
    780. checkbutton deform_tverts "Match Tverts" width:100 checked:false tooltip:"Match Texture Vertices Also."
    781. button help "Help" width:100
    782. button start_util "Apply"
    783. )
    784. on help pressed do
    785. (
    786. messagebox "Use this routine to copy material and UVW coordinates (if Match Tverts is checked) from one object to another."
    787. )
    788. on pick_tar picked nobj do
    789. (
    790. target = nobj
    791. pick_tar.text = nobj.name
    792. )
    793.  
    794. on pick_source picked nobj do
    795. (
    796. source = nobj
    797. pick_source.text = nobj.name
    798. )
    799. on start_util pressed do
    800. (
    801. match_uvw target source deform_tverts.checked
    802. )
    803.  
    804. ) -- rollout
    805. rollout cam_roll "Projection Render"
    806. (
    807. local obj, mod, c_width = 85
    808. local my_cam, my_texture, cam_set = #()
    809. local offset_w = 10.0, offset_h = 10.0
    810. -- This func automatically adjusts the camera lens to "fit" the mesh. The Y and Z
    811. -- fields are considered.
    812. fn adjust_lens =
    813. (
    814. )
    815. group "Reference Information"
    816. (
    817. pickbutton pick_obj "<SOURCE>" width:c_width enabled:register
    818. spinner o_w "Width:" type:#float range:[0, 16000, 0] scale:.1 width:95 offset:[-5,0] enabled:false
    819. spinner o_l "Length:" type:#float range:[0, 16000, 0] scale:.1 width:95 offset:[-5,0] enabled:false
    820. spinner o_h "Height:" type:#float range:[0, 16000, 0] scale:.1 width:95 offset:[-5,0] enabled:false
    821.  
    822. )
    823. on pick_obj picked nobj do
    824. (
    825. obj = nobj
    826. pick_obj.text = obj.name
    827. mod = check_stack uvwmap obj
    828. gw = classof mod
    829.  
    830. -- if uvwmap is not found, then add it w/planar projection.
    831. if gw != uvwmap then (
    832. addModifier obj (uvwmap maptype:0)
    833. mod = obj.modifiers[1]
    834. )
    835. o_w.value = mod.width
    836. o_h.value = mod.height
    837. o_l.value = mod.length
    838. )
    839.  
    840. group "Camera (Manual Focus)"
    841. (
    842. button sel_cam "Select Camera" width:c_width tooltip:"Select the user's camera."
    843. button rend_cam "Render Cam" width:c_width tooltip:"Render the Camera"
    844. --spinner x_cam "X:" type:#float range:[0, 16000, 0] scale:.1 width:85 offset:[-20,0] enabled:false
    845. --spinner z_cam "Z:" type:#float range:[0, 16000, 0] scale:.1 width:85 offset:[-20,0] enabled:false
    846. checkbox rend_view "Render" checked:true offset:[33, 0]
    847. )
    848.  
    849. on rend_cam pressed do
    850. (
    851. t_l = o_w.value + offset_w
    852. t_h = o_l.value + offset_h
    853. if cam_set != undefined then
    854. (
    855. try (
    856. my_texture = render camera:cam_set[1] \
    857. frame:currenttime \
    858. outputwidth:t_l \
    859. outputHeight:t_h \
    860. showcone:true \
    861. vfb:rend_view.checked
    862. ) catch (
    863. return 0
    864. )
    865. )
    866. )
    867. fn assign_cam =
    868. (
    869. local name_cam
    870. a = grab_sel()
    871. try (
    872. name_cam = classof a[1]
    873. ) catch (
    874. messagebox "Please reselect the camera set."
    875. return false
    876. )
    877. if a.count < 2 then (
    878. messagebox "Please select both the camera and the camera.target..."
    879. return false
    880. )
    881. if name_cam == targetcamera then (
    882. cam_set = a
    883. select cam_set
    884. -- Adjust the camera position (adjust both camera objects).
    885. cam_dist = (o_l.value / 4) + o_w.value
    886. if obj == undefined then (
    887. messagebox "Please select the object."
    888. return false
    889. )
    890. cam_set[1].pos = [obj.center.x, (0 - cam_dist), obj.center.z]
    891. cam_set[2].pos = [obj.center.x, obj.center.y, obj.center.z]
    892. -- This rotation value was taken from the MAXscripter Selection Array.
    893. rotate cam_set[1] (quat 1 0 0 1)
    894. rotate cam_set[2] (quat 1 0 0 1)
    895. )
    896. return true
    897. )
    898. -- Adjust the camera lens to focus on the target.
    899. fn focus_lens =
    900. (
    901. thres = 0.1
    902. scale_value = .01
    903. -- Scale the object until it is within bounds.
    904. for i = 1 to 300 do
    905. (
    906. ns = cam_set[1].scale
    907. if cam_set[1].max.z < (obj.max.z + thres) and cam_set[1].max.z > (obj.max.z - thres) then
    908. (
    909. --print "EXIT Z"
    910. --if cam_set[1].max.z < obj.max.z then cam_set[1].scale = [ns.x, ns.y + .01, nz]
    911. exit
    912. )
    913. --gw = "NS:"+ns as string+" obj_max:"+obj.max as string+" cam:"+cam_set[1].max as string
    914. --print gw
    915. if obj.max.z > cam_set[1].max.z then cam_set.scale = [ns.x, ns.y + scale_value, ns.z]
    916. else
    917. cam_set.scale = [ns.x, ns.y - scale_value, ns.z]
    918. )
    919. for i = 1 to 300 do
    920. (
    921. ns = cam_set[1].scale
    922. if cam_set[1].max.x < (obj.max.x + thres) and cam_set[1].max.x > (obj.max.x - thres) then
    923. (
    924. --print "EXIT X"
    925. --if cam_set[1].max.x < obj.max.x then cam_set[1].scale = [ns.x, ns.y + .5, nz]
    926. exit
    927. )
    928. ns = cam_set[1].scale
    929. --gw = "NS:"+ns as string+" obj_max:"+obj.max as string+" cam:"+cam_set[1].max as string
    930. --print gw
    931. if obj.max.x > cam_set[1].max.x then cam_set.scale = [ns.x + scale_value, ns.y, ns.z]
    932. else
    933. cam_set.scale = [ns.x - scale_value, ns.y, ns.z]
    934. )
    935. )
    936. on sel_cam pressed do
    937. (
    938. status = assign_cam()
    939. if status == true then focus_lens()
    940. )
    941. ) -- rollout
    942.  
    943.  
    944.  
    945. fn createSurfFloater =
    946. (
    947. try
    948. (
    949. closeRolloutFloater surfFloater
    950. removeRollout surfFloater
    951. )
    952. catch ()
    953. surfFloater = newRolloutFloater "Flatten Surface" s_width s_height 250 150
    954. addRollout surf_unwrap surfFloater
    955. )
    956.  
    957. fn createMatFloater =
    958. (
    959. try
    960. (
    961. closeRolloutFloater matFloater
    962. removeRollout matFloater
    963. )
    964. catch ()
    965. matFloater = newRolloutFloater "UVW Match" 155 225 250 150
    966. addRollout match_roll matFloater
    967. )
    968. fn createCamFloater =
    969. (
    970. try
    971. (
    972. closeRolloutFloater camFloater
    973. removeRollout camFloater
    974. )
    975. catch ()
    976. camFloater = newRolloutFloater "Planar Projection" 175 280 250 150
    977. addRollout cam_roll camFloater
    978. )
    979.  
    980. fn createRendFloater =
    981. (
    982. try
    983. (
    984. closeRolloutFloater rendFloater
    985. removeRollout rendFloater
    986. )
    987. catch ()
    988. rendFloater = newRolloutFloater "UV Manager" 175 375 250 150
    989. addRollout rend_roll rendFloater
    990. )
    991.  
    992. fn createUVMesh =
    993. (
    994. try
    995. (
    996. closeRolloutFloater uvFloater
    997. removeRollout uvFloater
    998. )
    999. catch ()
    1000. uvFloater = newRolloutFloater "UV Mesher" 175 350 270 150
    1001. addRollout uv_roll uvFloater
    1002. )
    1003. group ""
    1004. (
    1005. button surf_start "Flatten Surf" width:b_width height:20 tooltip:"Surface Flatten Utility"
    1006. button rend_start "UV Manager" width:b_width height:20 tooltip:"Render UVW Coordinates to a Bitmap."
    1007. button mat_start "Project UVW" width:b_width height:20 tooltip:"Copy material/UVW from one object to another."
    1008. button build_mesh "UV Mesher" width:b_width tooltip:"Create a Mesh based on UV Coordinates."
    1009. button cam_start "Camera Projection" width:b_width height:20 tooltip:"Render Surface to Camera."
    1010. button update_map "Update Map" width:b_width height:20 tooltip:"Update the Texure." enabled:register
    1011. )
    1012.  
    1013. group "About"
    1014. (
    1015. label t1 " UV Layout for MAX" align:#left
    1016. label t3 " Release 1.5" align:#left
    1017. label t4 " \xa9 2001 Richard Osborne" align:#left
    1018. label t5 " Kreation's Edge" align:#left
    1019. button helpButton "Online Help (.chm)" width:100 height:25
    1020. )
    1021. on update_map pressed do
    1022. (
    1023. mode = test_script()
    1024. update_texture unwrap_obj junk_bitmap
    1025. )
    1026.  
    1027. on build_mesh pressed do
    1028. (
    1029. mode = test_script()
    1030. createUVMesh()
    1031. )
    1032. on skin_start pressed do
    1033. (
    1034. mode = test_script()
    1035. createSkinFloater()
    1036. )
    1037. on surf_start pressed do
    1038. (
    1039. mode = test_script()
    1040. createSurfFloater()
    1041. )
    1042.  
    1043. on mat_start pressed do
    1044. (
    1045. mode = test_script()
    1046. createMatFloater()
    1047. )
    1048.  
    1049. on rend_start pressed do
    1050. (
    1051. mode = test_script()
    1052. createRendFloater()
    1053. )
    1054. on cam_start pressed do
    1055. (
    1056. mode = test_script()
    1057. createCamFloater()
    1058. )
    1059. on helpButton pressed do
    1060. (
    1061. local leng = 0, file_name -- store the path_Name length.
    1062. local status, f_path = "", root_path = ""
    1063. f = read_data "uv_max/layout.ini" 2
    1064. try (
    1065. leng = f[1].count
    1066. file_name = f[1]
    1067. if file_name=="undefined" or file_name.count < 1 then leng = 0
    1068. else
    1069. f_path = getFilenamePath file_name
    1070. ) catch (
    1071. leng = 0
    1072. )
    1073. if leng < 1 then
    1074. (
    1075. file_name = getOpenFileName caption:"Find the UV Layout Online Help (.chm) File..."
    1076. if file_name != undefined then
    1077. save_data "layout.ini" file_name 2
    1078. )
    1079. if file_name != undefined then
    1080. (
    1081. try (
    1082. com = "hh "+file_name
    1083. status = DOScommand com
    1084. ) catch ()
    1085. )
    1086. )
    1087. )

    stitch them together.. only 40000 character per post.. :/
  • gnoop
    Offline / Send Message
    gnoop sublime tool
    Just dounloaded and installed Textools. When I try to unwrap with a help of Roadkill nothing happens. Nothing at all. I set the path to Roadkill correctly. Am I missing anything else?
  • Junkie_XL
    Offline / Send Message
    Junkie_XL polycounter lvl 14
    So what is the scoop on the new uv editor in max 2012? Are there things textools still does better?
  • Perfectblue
    Marked for later, awesome.
  • Spicypixel
    Offline / Send Message
    Spicypixel polycounter lvl 6
    I would love to add textools to 2012, it's nice that autodesk upped their game but I like the flow of the tools in textools. I don't think it would be bad to have a choice.
  • MattLichy
    They took tools directly from his toolbar and implemented them now.
  • mortalhuman
    gnoop wrote: »
    Just dounloaded and installed Textools. When I try to unwrap with a help of Roadkill nothing happens. Nothing at all. I set the path to Roadkill correctly. Am I missing anything else?

    I second this. My roadkill exe isn't named "roadkill.exe" so maybe that's the problem, I didn't rename it, and I wouldn't figure that name would be hardcoded like that, I can't get it to work either though. Still been just exporting and reimporting. Which is messy of course.
  • devingeesr
    Offline / Send Message
    devingeesr polycounter lvl 13
    I'm currently using tex tools in max 2012. Which is awesome Autodesk might have updated there tools but you still have a whole set that they still don't have. I am currently having issues with the ambient occlusion and the light tracer but other than that the rest of the tool are great. I wanted to know if there was a way to dock the tool on to a side panel or a panel on the bottom. It might not bother some people but I would like to have the tool docked just so that it's more a part of the interface and jut not floating around. Thanks again man that is an awesome tool!
  • OnePride
    Hi all! sorry for my English :) I have scene with more then 400 objects, which i need to pack at 5 textures with 2048x2048 dimensions. Where and what objects will be placed on current texture are no so important. My problem is that the pack method from the textools don't consider from aspect ratio of the texture correctly. All works fine if we have aspect ratio = 1. For example, set in the textools toolbar height 256 and width 1280 (256*5 textures), then select objects and open UV editor. We see that all objects are stretched by 5 times in horizontal (only if we were mapped objects when aspect ratio was set to 1 by default). Set horizontal scale to 20% (100/5) to parry distortion and use the pack method. And we see that average offsets between objects by horizontal and vertical are not equal. Result horizontal offset will be more than vertical offset by 5 times.
    Can i fix it? If it is, where i can see the pack function?
  • EarthQuake
    I'm sure that i'm just doing something dumb here as i'm not really a max guy, but i'm trying to get the uv island -> smoothing group function to work. Basically nothing happens when I click the "split" button. I've tried being in various modes, 3d, uv, polygon in edit mesh etc etc.

    Is there some specific way I need to use this?
  • Quack!
    Offline / Send Message
    Quack! polycounter lvl 17
    The Split button takes your smoothing groups and sets your uv seams at the hard edges.

    The UV-Island->Smoothing Group is in the little 'Tools' rollout above the Edit UV button. Are you using the "Smoothing groups from UV Shells" under this toolset?
  • renderhjs
    Offline / Send Message
    renderhjs sublime tool
    always make sure you have a editable poly as a base at least because meshes are not everywhere supported in TexTools & I don't care about them. I haven't look yet into it but I assume that it translates the first UV channel to the smoothing groups so make sure the UV channel you want is the 1st.
  • Moosey_G
    I have no idea how the UV swap to XYZ works, but it's been marvelous in unwrapping organic materials! Thanks for the plugin.
  • Michael Knubben
    Moosey: If I'm not mistaken, it works by swapping channels in the channel lister in Max. You could do it by hand, I'm told.
  • mcbrightside
    Pardon me for sounding like a dork, but for some reason once I installed tex tools very few of the tools actually work. The Linear, Relax, and Checkered/Shaded buttons work, but the ones which I really need (like Mirror, Stitch and Align) don't. I am using a Student version of Max 2011, which I'm pretty sure I read Tex Tools should work with.

    Is there something I might be missing? Thanks.
  • renderhjs
    Offline / Send Message
    renderhjs sublime tool
    always operate on editable poly objects, not meshes. 90% of the tools are written soley for the editable poly object type as the mesh object is outdated. I haven't tested myself TexTools with max 2011 (2010 here at work) but I highly assume that it is compatible.
  • orbital
    I dont seem to make it work on 2011 or 2012... can anyone confirm?
  • mcbrightside
    It looks like that's the problem, thank you for your help!

    I guess my problem now is that I've already rigged my model. If I add the Editable Poly modifier wont that screw up my weights and stuff?
  • cw
    Offline / Send Message
    cw polycounter lvl 17
    It looks like that's the problem, thank you for your help!

    I guess my problem now is that I've already rigged my model. If I add the Editable Poly modifier wont that screw up my weights and stuff?

    use skin tools in utilities to extract skin weights, then you can change the mesh to edit poly, re-apply skin, import the weights back from the skindata and you should be sorted. Good luck!
  • r_fletch_r
    Offline / Send Message
    r_fletch_r polycounter lvl 9
    It looks like that's the problem, thank you for your help!

    I guess my problem now is that I've already rigged my model. If I add the Editable Poly modifier wont that screw up my weights and stuff?

    it should be fine. converting from a mesh to editable poly doesnt change vertex indexes. which is what skin works with.
  • renderhjs
    Offline / Send Message
    renderhjs sublime tool
    just in general: its always good to first do the modeling and unwrapping (they belong together as they define the mesh or poly data) and then apply additional modifiers such as the skin modifier.
    Some functions (texel ratio related) do expect however the base object to be a editable poly with the same tris and face count as the latest state of the modifier stack- its things like these that make it easier to make scripts for apps such as modo.
  • humfrez
    Big thanks in the first place for this great tool!

    and just to share a bit of my findings using non-programmer skills... i wanted to keep polygons or quads on the mesh after its been unwrapped with roadkill ( thus exported to obj and imported back ), rather than have the messy triangles (under max 2009)

    this script "fn_40__unwrap_with_roadkill.ms" changes the OBJ export settings to use triangles.

    so to use quads you need to change the 13th value in this line from 0 to 1
    to use polygons you need to change the 13th value in this line to 0 to 2

    fnWriteBinary outputCfgPath #(16, 0, 0, 0, 86, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -128, 63, 0, 0, 1, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 46, 47, 109, 97, 112, 115, 47, 0, 1, 0, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 3, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 60, 78, 79, 78, 69, 62)

    it took me 2hrs to figure it out so it might save some other artist some time :)
    im sure a programmer would do this in a few seconds :)

    thanks again for the scripts.
  • humfrez
    hm, it wasnt such a good idea after all to change to quads for exporting OBJ :)
    roadkill gives very different results for some objects with often unusable results
    so triangles it is.
  • devingeesr
    Offline / Send Message
    devingeesr polycounter lvl 13
    I'm assuming thats a no go max 12 is there going to be an update soon?
  • maze
    ...care to create textools for SI??? I am so missing this tool in SI!!!! ...anyways just wanted to say thanks for this awesome tool, although I cant use it at work anymore!
  • jayoplus
    I hope I can get some help with this, and maybe I'm doing something wrong.
    I keep getting this error when I use the create block out map.

    "--No ""display"" function for undefined"

    Doesn't matter what option I select (clipboard, display, save as). All the other texture maps work just fine.
    Using Max 2012.
    Thanks.
  • jazznazz
    Offline / Send Message
    jazznazz polycounter lvl 13
    Hi renderhjs , I can't thank You enough for TexTools, been using it for three years now, I think :)
    a very little thing , the get/set texel density works only for UV channel 1,regardless of what UV channel I set to be edited :(
  • Noors
    Offline / Send Message
    Noors greentooth
    It seems I can't use the normalize function on channel 2. It always use the channel 1. Is this the wanted behavior ?
    It's a bit annoying as I would particularly like this option to normalize my uv's for a lightmap packing. For now i have to switch my channels which is lil tedious.
    Thanks for helping.
  • Joshua Stubbles
    Offline / Send Message
    Joshua Stubbles polycounter lvl 20
    Hey Render, I was also wondering if there's plans to make more of the tools work while editing multiple objects? Things like normalizing the texel ratio for all islands, or aligning an island via an edge selection, don't work with multiple objects selected.

    Regardless, great toolset and I've been using it since it's initial release. It's most welcomed :)
  • Alphavader
    Offline / Send Message
    Alphavader polycounter lvl 11
    please do a maya version :*
  • Lamont
    Offline / Send Message
    Lamont polycounter lvl 16
    I would like to add that when I normalize UV/ratio it will flip and make inverted faces.
  • styx
    The Roadkill tool, does it only work with the 1st Uv channel? It doesn't seem to work for me in the second channel, I have max 2009.
  • McGreed
    Offline / Send Message
    McGreed polycounter lvl 16
    I was wondering how much 3ds max 2012 has improved in the UV tools, and how much this plugin is still needed, is there still loads of features missin in 2012?
  • MrOneTwo
    Offline / Send Message
    MrOneTwo polycounter lvl 12
    Regarding Uvs TexTools offers only few features max is missing (nothing big though). Its worth using Textools for its map generation features. It handles copying texel density better. Autodesk after few years almost caught up to renderhjs...almost ;p
  • mLichy
    More like took his ideas and made them not as good.
  • cptSwing
    Offline / Send Message
    cptSwing polycounter lvl 13
    couple of functions I still keep textools installed for:

    - aligning shells to each other
    - aligning a single shell to the edge you've selected (rotates the shell so that edge is straight). very cool.
    - it's one-click relax button always gives me cooler results
    - uv shell to smoothing group
    - and yeah, various masks
  • MrOneTwo
    Offline / Send Message
    MrOneTwo polycounter lvl 12
    mLichy wrote: »
    More like took his ideas and made them not as good.

    Yeaaaaaaahhh... true dat ;p For example normalizing uv shells in 3ds max pretty much... doesn't work. Yeah it kinda works but TexTools uses math to do this... 3ds max guesses...at least thats what the result looks like.
  • WarrenM
    I've found the normalizing in Max to work pretty well, actually. Seems accurate, at least. If you get time, some comparison shots would be interesting.
  • vondecrolock
    Just a little question.. I just come back to max, first reflex.. TEXTOOLS :P A lot of improvement, seem's cool but after instaling ( files are in the proprer folder, auto instal worked great) the launch bouton doesn't work : / I had no problem with older version and max 2009, but i currently use 2012 64bit now (fresh install & admin right).. Any idea? 2012 is not listed in supported version, but i knew it works properly with max 2012..

    Any suggestion?
  • Furyofaseraph
    Offline / Send Message
    Furyofaseraph polycounter lvl 17
    Small question.
    I'm wondering if there are any plans to let the Texel Density be measured in Pixels/WorldUnit instead of Pixels/MaxUnit - I measure things in meters and it is a hassle to constantly do the math to keep the proper proportions of things.
  • renderhjs
    Offline / Send Message
    renderhjs sublime tool
    Just a little question.. I just come back to max, first reflex.. TEXTOOLS :P A lot of improvement, seem's cool but after instaling ( files are in the proprer folder, auto instal worked great) the launch bouton doesn't work : / I had no problem with older version and max 2009, but i currently use 2012 64bit now (fresh install & admin right).. Any idea? 2012 is not listed in supported version, but i knew it works properly with max 2012..

    Any suggestion?
    I don't have a copy of max 2011,2012 or greater available to me. These days I use texTools at work for unwrapping and texturing but I don't actively develop it anymore because it does what I needed it to do within 3dsmax 2010 as its the 3dsMax version my company works with.
    But I also stated hopefully clear enough in the past that the MZP textools file is just a ZIP so you can open it and explore the scripts, use them for other scripts and or improve them with the new 3dsMax 2012 or greater versions.
    I got an email back in 2011 I think from Autodesk that they would like to take some ideas and tools from TexTools into 3dsMax and I believe my credits should be within 3dsMax 2012 because of the UV tools. For me though that was a sign that they finally addressed the UV tools and there is not much need for me trying to fix max with TexTools.

    Small question.
    I'm wondering if there are any plans to let the Texel Density be measured in Pixels/WorldUnit instead of Pixels/MaxUnit - I measure things in meters and it is a hassle to constantly do the math to keep the proper proportions of things.
    Shouldn't be to hard to open the script and look into it yourself. I know that maxscript has some convertion tools for the units. Personally I work closer with Game Engines that I write or modify myself, which is why real units (internal units) matter as the real deal. But for some people that use UDK, Unity etc. and that prefer unit conversions (unity scales e.g by default units to 0.01).
    If you are not that great or skilled in Maxscript, try to find at least the script within the TexTools.mzp (zip file), make a thread here in Tech talk on polycount and ask people to help you with it so works with set units in Max.
1234579
Sign In or Register to comment.