BabylonActionsBuilderActionItem.cs 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. using Autodesk.Max;
  2. using ActionItem = Autodesk.Max.Plugins.ActionItem;
  3. namespace Max2Babylon
  4. {
  5. public class BabylonActionsBuilderActionItem : ActionItem
  6. {
  7. public override bool ExecuteAction()
  8. {
  9. if (Loader.Core.SelNodeCount > 1)
  10. {
  11. Loader.Core.PushPrompt("Actions Builder only supports one Node");
  12. }
  13. else
  14. {
  15. IINode node = null;
  16. SClass_ID type;
  17. if (Loader.Core.SelNodeCount == 0)
  18. type = SClass_ID.Scene;
  19. else
  20. {
  21. node = Loader.Core.GetSelNode(0);
  22. type = node.ObjectRef.Eval(0).Obj.SuperClassID;
  23. }
  24. if (type == SClass_ID.Geomobject || type == SClass_ID.Light || type == SClass_ID.Camera || type == SClass_ID.Scene)
  25. {
  26. using (var ab = new ActionsBuilderForm())
  27. {
  28. // Just show dialog
  29. ab.ShowDialog();
  30. }
  31. }
  32. }
  33. return true;
  34. }
  35. public override int Id_
  36. {
  37. get { return 2; }
  38. }
  39. public override string ButtonText
  40. {
  41. get { return "Babylon Actions Builder"; }
  42. }
  43. public override string MenuText
  44. {
  45. get { return "Babylon Actions Builder"; }
  46. }
  47. public override string DescriptionText
  48. {
  49. get { return "UI graph to build custom actions on selected object"; }
  50. }
  51. public override string CategoryText
  52. {
  53. get { return "Babylon"; }
  54. }
  55. public override bool IsChecked_
  56. {
  57. get { return false; }
  58. }
  59. public override bool IsItemVisible
  60. {
  61. get { return true; }
  62. }
  63. public override bool IsEnabled_
  64. {
  65. get { return true; }
  66. }
  67. }
  68. }