BabylonPropertiesActionItem.cs 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. using Autodesk.Max;
  2. using ActionItem = Autodesk.Max.Plugins.ActionItem;
  3. namespace Max2Babylon
  4. {
  5. public class BabylonPropertiesActionItem : ActionItem
  6. {
  7. public override bool ExecuteAction()
  8. {
  9. if (Loader.Core.SelNodeCount == 0)
  10. {
  11. using (var frm = new ScenePropertiesForm())
  12. {
  13. frm.ShowDialog();
  14. return true;
  15. }
  16. }
  17. var firstNode = Loader.Core.GetSelNode(0);
  18. if (firstNode.ObjectRef != null && firstNode.ObjectRef.Eval(0).Obj.SuperClassID == SClass_ID.Camera)
  19. {
  20. using (var frm = new CameraPropertiesForm())
  21. {
  22. frm.ShowDialog();
  23. return true;
  24. }
  25. }
  26. if (firstNode.ObjectRef != null && firstNode.ObjectRef.Eval(0).Obj.SuperClassID == SClass_ID.Geomobject)
  27. {
  28. using (var frm = new ObjectPropertiesForm())
  29. {
  30. frm.ShowDialog();
  31. return true;
  32. }
  33. }
  34. if (firstNode.ObjectRef != null && firstNode.ObjectRef.Eval(0).Obj.SuperClassID == SClass_ID.Light)
  35. {
  36. using (var frm = new LightPropertiesForm())
  37. {
  38. frm.ShowDialog();
  39. return true;
  40. }
  41. }
  42. Loader.Core.PushPrompt("Selected entity does not have Babylon.js specific properties");
  43. return true;
  44. }
  45. public override int Id_
  46. {
  47. get { return 1; }
  48. }
  49. public override string ButtonText
  50. {
  51. get { return "Babylon Properties"; }
  52. }
  53. public override string MenuText
  54. {
  55. get { return "Babylon Properties"; }
  56. }
  57. public override string DescriptionText
  58. {
  59. get { return "UI for setting Babylon.js specific properties"; }
  60. }
  61. public override string CategoryText
  62. {
  63. get { return "Babylon"; }
  64. }
  65. public override bool IsChecked_
  66. {
  67. get { return false; }
  68. }
  69. public override bool IsItemVisible
  70. {
  71. get { return true; }
  72. }
  73. public override bool IsEnabled_
  74. {
  75. get { return true; }
  76. }
  77. }
  78. }