PackageMsgAutoGenEditorWindow.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. © Siemens AG, 2019
  3. Author: Sifan Ye (sifan.ye@siemens.com)
  4. Licensed under the Apache License, Version 2.0 (the "License");
  5. you may not use this file except in compliance with the License.
  6. You may obtain a copy of the License at
  7. <http://www.apache.org/licenses/LICENSE-2.0>.
  8. Unless required by applicable law or agreed to in writing, software
  9. distributed under the License is distributed on an "AS IS" BASIS,
  10. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. See the License for the specific language governing permissions and
  12. limitations under the License.
  13. */
  14. using System.Collections.Generic;
  15. using RosSharp.RosBridgeClient.MessageGeneration;
  16. using UnityEditor;
  17. using UnityEngine;
  18. namespace RosSharp.RosBridgeClient
  19. {
  20. public class PackageMsgAutoGenEditorWindow : PackageAutoGenEditorWindow
  21. {
  22. protected override string GenerationType
  23. {
  24. get { return "message"; }
  25. }
  26. protected override string FileExtension
  27. {
  28. get { return "msg"; }
  29. }
  30. [MenuItem("RosBridgeClient/Auto Generate Messages/Package Messages...", false, 1)]
  31. private static void OpenWindow()
  32. {
  33. PackageMsgAutoGenEditorWindow window = GetWindow<PackageMsgAutoGenEditorWindow>(false, "Message Auto Generation", true);
  34. window.minSize = new Vector2(750, 100);
  35. window.maxSize = new Vector2(750, 100);
  36. window.Show();
  37. }
  38. protected override List<string> Generate(string inPath, string outPath, string rosPackageName = "")
  39. {
  40. return MessageAutoGen.GenerateSingleMessage(inPath, outPath, rosPackageName);
  41. }
  42. }
  43. }