├── .editorconfig ├── .gitattributes ├── .github ├── FUNDING.yml └── workflows │ ├── main.yml │ └── npm-publish.yml ├── .gitignore ├── CHANGELOG.md ├── CHANGELOG.md.meta ├── Editor.meta ├── Editor ├── RenameWindow.cs ├── RenameWindow.cs.meta ├── RenameWindow.uss ├── RenameWindow.uss.meta ├── RenameWindow.uxml ├── RenameWindow.uxml.meta ├── Settings.cs ├── Settings.cs.meta ├── com.litefeel.renametools.Editor.asmdef └── com.litefeel.renametools.Editor.asmdef.meta ├── LICENSE.md ├── LICENSE.md.meta ├── README.md ├── README.md.meta ├── package.json └── package.json.meta /.editorconfig: -------------------------------------------------------------------------------- 1 | # To learn more about .editorconfig see https://aka.ms/editorconfigdocs 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | [*.cs] 7 | charset = utf-8 8 | indent_style = space 9 | indent_size = 4 10 | trim_trailing_whitespace = true 11 | insert_final_newline = true 12 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | custom: "https://www.paypal.me/litefeel" 13 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: Test 2 | 3 | on: 4 | pull_request: {} 5 | push: {} 6 | 7 | # env: 8 | # UNITY_LICENSE_FILE: UnityLicense/2019.2.11f1.ulf 9 | 10 | jobs: 11 | Test: 12 | name: Test ${{ matrix.unityVersion }} ${{ matrix.testMode }} 🔑 13 | runs-on: ubuntu-latest 14 | strategy: 15 | fail-fast: false 16 | matrix: 17 | unityVersion: 18 | - 2019.4.20f1 19 | - 2020.3.0f1 20 | - 2021.1.0f1 21 | steps: 22 | # Set env 23 | - name: Set env UNITY_LICENSE_FILE 24 | run: echo "UNITY_LICENSE_FILE=UnityLicense/${{ matrix.unityVersion }}.ulf" >> $GITHUB_ENV 25 | 26 | # Checkout Empty Project 27 | - name: Checkout Empty Project 28 | uses: actions/checkout@v2 29 | with: 30 | repository: litefeel/UnityEmptyProject 31 | 32 | # Checkout this project 33 | - name: Checkout repository 34 | uses: actions/checkout@v2 35 | with: 36 | lfs: true 37 | path: Packages/MyPlugin 38 | 39 | # Cache 40 | - uses: actions/cache@v2 41 | with: 42 | path: Library 43 | key: Library 44 | 45 | # Test 46 | - name: Run tests 47 | uses: game-ci/unity-test-runner@v2 48 | id: tests 49 | with: 50 | customParameters: "-nographics" 51 | unityVersion: ${{ matrix.unityVersion }} 52 | 53 | # # Build 54 | # - name: Build project 55 | # uses: litefeel/unity-builder@v0.14 56 | # with: 57 | # unityVersion: ${{ matrix.unityVersion }} 58 | # targetPlatform: WebGL 59 | 60 | # Output 61 | - uses: actions/upload-artifact@v2 62 | name: Upload tests 63 | with: 64 | name: Test results for ${{ matrix.testMode }} on unity ${{ matrix.unityVersion }} 65 | path: ${{ steps.tests.outputs.artifactsPath }} 66 | 67 | # - uses: actions/upload-artifact@v2 68 | # name: Upload build 69 | # with: 70 | # name: Build 71 | # path: build 72 | -------------------------------------------------------------------------------- /.github/workflows/npm-publish.yml: -------------------------------------------------------------------------------- 1 | # https://github.com/marketplace/actions/publish-to-npm 2 | 3 | name: npm-publish 4 | on: 5 | push: 6 | branches: 7 | - master # Change this to your default branch 8 | jobs: 9 | npm-publish: 10 | name: npm-publish 11 | runs-on: ubuntu-latest 12 | steps: 13 | - name: Checkout repository 14 | uses: actions/checkout@v2 15 | - name: Publish if version has been updated 16 | uses: pascalgn/npm-publish-action@1.3.6 17 | with: # All of theses inputs are optional 18 | tag_name: "%s" 19 | tag_message: "%s" 20 | create_tag: "true" 21 | commit_pattern: "^Release (\\S+)" 22 | workspace: "." 23 | publish_command: "yarn" 24 | publish_args: "--non-interactive" 25 | env: # More info about the environment variables in the README 26 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Leave this as is, it's automatically generated 27 | NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} # You need to set this in your repo settings 28 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /[Ll]ibrary/ 2 | /[Tt]emp/ 3 | /[Oo]bj/ 4 | /[Bb]uild/ 5 | /[Bb]uilds/ 6 | /Assets/AssetStoreTools* 7 | 8 | # Autogenerated VS/MD solution and project files 9 | ExportedObj/ 10 | *.csproj 11 | *.unityproj 12 | *.sln 13 | *.suo 14 | *.tmp 15 | *.user 16 | *.userprefs 17 | *.pidb 18 | *.booproj 19 | *.svd 20 | .vs 21 | 22 | # Unity3D generated meta files 23 | *.pidb.meta 24 | 25 | # Unity3D Generated File On Crash Reports 26 | sysinfo.txt 27 | 28 | # Unity3D AssetStoreTools 29 | Assets/AssetStoreTools -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | #### v2.0.0 - 2021-04-02 2 | - Using UIElements 3 | 4 | #### v1.0.0 - 2020-01-02 5 | - initial version -------------------------------------------------------------------------------- /CHANGELOG.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c6e45b2f3ae8e12459130c68adcb4e91 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 47de859a6abe40048a744541fd9cb52e 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/RenameWindow.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using UnityEditor; 4 | using UnityEngine; 5 | using UnityEngine.UIElements; 6 | 7 | namespace litefeel.RenameTools 8 | { 9 | public class RenameWindow : EditorWindow 10 | { 11 | private TextField m_NameTF; 12 | private VisualElement m_NameTI; 13 | private TextElement m_CountTxt; 14 | private List m_TFList = new List(); 15 | 16 | private string m_TemplateName = ""; 17 | private List m_Selections = new List(); 18 | private TemplateContainer m_RootTree; 19 | 20 | [MenuItem("Window/LiteFeel/Rename Tools #F2")] 21 | public static void ShowExample() 22 | { 23 | RenameWindow wnd = GetWindow(); 24 | wnd.titleContent = new GUIContent("Rename Tools"); 25 | wnd.SetActive(); 26 | } 27 | 28 | private void SetActive() 29 | { 30 | m_NameTI.Focus(); 31 | OnSelectionChange(); 32 | m_NameTF.SelectRange(m_NameTF.text.Length, m_NameTF.text.Length); 33 | } 34 | 35 | private void OnSelectionChange() 36 | { 37 | m_Selections = Selection.gameObjects 38 | .Where(go => !EditorUtility.IsPersistent(go)) 39 | .Select(go => go.transform) 40 | .OrderBy(go => go, new SortCamper()) 41 | .ToList(); 42 | 43 | SetSelectionName(); 44 | m_NameTF.value = m_TemplateName; 45 | } 46 | public void SetSelectionName() 47 | { 48 | m_TemplateName = m_Selections.Count > 0 ? m_Selections[0].name : ""; 49 | UpdateChangeInfo(); 50 | } 51 | 52 | public void CreateGUI() 53 | { 54 | // Each editor window contains a root VisualElement object 55 | VisualElement root = rootVisualElement; 56 | 57 | // Import UXML 58 | var visualTree = AssetDatabase.LoadAssetAtPath("Packages/com.litefeel.renametools/Editor/RenameWindow.uxml"); 59 | m_RootTree = visualTree.CloneTree(); 60 | root.Add(m_RootTree); 61 | m_NameTF = m_RootTree.Q("nameTxt"); 62 | m_NameTF.isDelayed = true; 63 | m_NameTI = m_NameTF.Q(TextField.textInputUssName); 64 | m_NameTI.RegisterCallback(e => 65 | { 66 | m_TemplateName = m_NameTF.text; 67 | UpdateChangeInfo(); 68 | }); 69 | m_NameTI.RegisterCallback(e => 70 | { 71 | if (e.keyCode == KeyCode.KeypadEnter) 72 | { 73 | m_NameTI.Focus(); 74 | DoRename(); 75 | } 76 | }); 77 | m_RootTree.Q