Advertisement
Guest User

Maxscript Toggle Medit Map Navigator

a guest
Feb 19th, 2019
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1.  
  2. /*
  3. / Script: Open Basic material editor with Map Navigator aligned to the right side or Toggle Map Navigator
  4. / Author: Panteleev Sergey
  5. / Year: 2019
  6. / Contacts: fatbbc @ gmail.com
  7. */
  8.  
  9. fn ToggleMeditMapNavigator align:true =
  10. (
  11. if MatEditor.mode == #basic and MatEditor.isOpen() do
  12. (
  13. local done = false
  14. for handle in UIAccessor.GetPopupDialogs() while not done where MatchPattern (UIAccessor.GetWindowText handle) pattern:"Material Editor*" do
  15. (
  16. local mapnav = windows.getChildHWND 0 "Material/Map Navigator"
  17.  
  18. if mapnav == undefined then
  19. (
  20. for data in windows.getChildrenHWND handle where UIAccessor.GetWindowResourceID data[1] == 1100 do UIAccessor.PressButton data[1]
  21.  
  22. if align do
  23. (
  24. for hwnd in UIAccessor.GetPopupDialogs() where UIAccessor.GetWindowText hwnd == "Material/Map Navigator" do
  25. (
  26. medit_rect = windows.getWindowPos handle
  27. mapnav_rect = windows.getWindowPos hwnd
  28.  
  29. windows.setWindowPos hwnd (medit_rect.x + medit_rect.w) medit_rect.y mapnav_rect.w mapnav_rect.h true
  30.  
  31. )
  32. )
  33.  
  34. windows.sendMessage handle 0x7 0 0
  35.  
  36. )
  37. else
  38. (
  39. UIAccessor.CloseDialog mapnav[1]
  40.  
  41. )
  42.  
  43.  
  44. done = true
  45. )
  46.  
  47.  
  48. )
  49.  
  50. )
  51.  
  52. if MatEditor.mode == #basic do
  53. (
  54. if not MatEditor.isOpen() then
  55. (
  56. MatEditor.open()
  57.  
  58. ToggleMeditMapNavigator()
  59.  
  60. ) else ToggleMeditMapNavigator()
  61.  
  62. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement