Exemplo n.º 1
0
        void ShowCachedEntry(CachedEntry entry)
        {
            if (entry.status == CachedEntryStatus.Ignored)
            {
                return;
            }
            else if (entry.status != CachedEntryStatus.Folder)
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField(entry.label);

                if (entry.hasBuildButton && GUILayout.Button(entry.buildLabel, GUILayout.Width(BUTTON_WIDTH)))
                {
                    // build this msg/srv file
                    switch (entry.status)
                    {
                    case CachedEntryStatus.BuiltMsgFile:
                    case CachedEntryStatus.UnbuiltMsgFile:
                        MessageAutoGen.GenerateSingleMessage(entry.path, MessageGenBrowserSettings.Get().outputPath);
                        break;

                    case CachedEntryStatus.BuiltSrvFile:
                    case CachedEntryStatus.UnbuiltSrvFile:
                        ServiceAutoGen.GenerateSingleService(entry.path, MessageGenBrowserSettings.Get().outputPath);
                        break;
                    }
                    AssetDatabase.Refresh();
                    m_IsCacheDirty = true;
                }
                EditorGUILayout.EndHorizontal();
            }
            else
            {
                bool isFoldedOut = m_FoldedOutHash.Contains(entry.path);

                EditorGUILayout.BeginHorizontal();
                bool shouldBeFoldedOut = EditorGUILayout.Foldout(isFoldedOut, entry.label, true, EditorStyles.foldout);
                if (entry.hasBuildButton && GUILayout.Button(entry.buildLabel, GUILayout.Width(BUTTON_WIDTH)))
                {
                    // build this directory
                    MessageAutoGen.GenerateDirectoryMessages(entry.path, MessageGenBrowserSettings.Get().outputPath);
                    ServiceAutoGen.GenerateDirectoryServices(entry.path, MessageGenBrowserSettings.Get().outputPath);
                    AssetDatabase.Refresh();
                    m_IsCacheDirty = true;
                }
                EditorGUILayout.EndHorizontal();

                if (isFoldedOut)
                {
                    EditorGUI.indentLevel++;
                    foreach (CachedEntry subEntry in entry.contents)
                    {
                        ShowCachedEntry(subEntry);
                    }
                    EditorGUI.indentLevel--;
                }

                if (shouldBeFoldedOut != isFoldedOut)
                {
                    m_IsCacheDirty = true;

                    if (shouldBeFoldedOut)
                    {
                        m_FoldedOutHash.Add(entry.path);
                    }
                    else
                    {
                        m_FoldedOutHash.Remove(entry.path);
                    }
                }
            }
        }
Exemplo n.º 2
0
 protected override List <string> Generate(string inPath, string outPath, string rosPackageName = "")
 {
     return(ServiceAutoGen.GenerateSingleService(inPath, outPath, rosPackageName));
 }