BabylonPropertiesActionItem.cs 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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.Light)
  27. {
  28. using (var frm = new LightPropertiesForm())
  29. {
  30. frm.ShowDialog();
  31. return true;
  32. }
  33. }
  34. // consider non-recognized objects as meshes so they can be animated intermediate nodes
  35. using (var frm = new ObjectPropertiesForm())
  36. {
  37. frm.ShowDialog();
  38. return true;
  39. }
  40. }
  41. public override int Id_
  42. {
  43. get { return 1; }
  44. }
  45. public override string ButtonText
  46. {
  47. get { return "Babylon Properties"; }
  48. }
  49. public override string MenuText
  50. {
  51. get { return "Babylon Properties"; }
  52. }
  53. public override string DescriptionText
  54. {
  55. get { return "UI for setting Babylon.js specific properties"; }
  56. }
  57. public override string CategoryText
  58. {
  59. get { return "Babylon"; }
  60. }
  61. public override bool IsChecked_
  62. {
  63. get { return false; }
  64. }
  65. public override bool IsItemVisible
  66. {
  67. get { return true; }
  68. }
  69. public override bool IsEnabled_
  70. {
  71. get { return true; }
  72. }
  73. }
  74. }