Home Technical Talk

[3ds Max] script vertex compare

naskeleton
polycounter lvl 2
Offline / Send Message
naskeleton polycounter lvl 2
Hi guys, I have made a script that is supposed to find the difference between the position of every vertex in a first mesh and a second mesh.

The goal is to automatically select for morpher the vertex that require vertex color to white and with a Ctrl+i the black vertex color.

Currently the script work with simple mesh like cube, but when I try with more complex mesh, it didn't work.
maybe it's because array are limited ?

Thx for your help.
  1. sM1 = #()
  2. sM2 = #()
  3. cV1 = #()
  4. cV2 = #()
  5. aDV = #()
  6. pCb1 = #()
  7. pCb2 = #()
  8. sPO1 = #()
  9. sPO2 = #()

  10. aDV as array

  11. rollout pick_box_test "Pick Meshes"
  12. (
  13. pickbutton chooseit1 "Pick Mesh 1" width:140
  14. on chooseit1 picked obj do
  15. if obj != undefined do
  16. (
  17. sPO1 = obj.pos
  18. obj.pos = [0,0,0]
  19. chooseit1.text = obj.name
  20. sM1 = obj
  21. pCb1 = true
  22. )

  23. pickbutton chooseit2 "Pick Mesh 2" width:140
  24. on chooseit2 picked obj do
  25. if obj != undefined do
  26. (
  27. sPO2 = obj.pos
  28. obj.pos = [0,0,0]
  29. chooseit2.text = obj.name
  30. sM2 = obj
  31. pCb2 = true
  32. if pCb1 and pCB2 do 
  33. if sM1.verts.count == sM1.verts.count do
  34. for i=1 to sM1.verts.count do
  35. (
  36. sM1.selectedVerts = #{i}
  37. cV1 = sM1.verts[i].pos
  38. cV2 = sM2.verts[i].pos
  39. if cV1 != cV2 do appendIfUnique aDV i
  40. )
  41. sM1.pos = sPO1
  42. sM2.pos = sPO2
  43. sM1.selectedVerts = aDV
  44. )
  45. )
  46. createDialog pick_box_test




Replies

Sign In or Register to comment.