void OnGUI() { GUILayout.Label("Rename Multiple Files", EditorStyles.boldLabel); GUILayout.Label("Note: Undo is not currently supported. Save your scene first!"); rename = EditorGUILayout.TextField("New Name: ", rename); nameOperation = (NameOperation)EditorGUILayout.EnumPopup("Operation: ", nameOperation); numberItems = EditorGUILayout.Toggle("Number Items: ", numberItems); if (numberItems) { numberPadding = Mathf.Clamp(EditorGUILayout.IntField("Number Padding: ", numberPadding), 0, 10000); startNumber = EditorGUILayout.IntField("Start Number: ", startNumber); incrementBy = Mathf.Clamp(EditorGUILayout.IntField("Increment by (step): ", incrementBy), 1, 100000); sortInHierarchy = EditorGUILayout.Toggle("Sort in Hierarchy: ", sortInHierarchy); } if (Selection.transforms.Length > 0) { if (GUILayout.Button("Rename " + Selection.transforms.Length + " Item(s)")) { AdvancedRename.RenameNames(rename, nameOperation == NameOperation.AddSuffix, nameOperation == NameOperation.AddPrefix, numberItems, sortInHierarchy, numberPadding, startNumber, incrementBy); } } string sample = ""; if (nameOperation == NameOperation.AddPrefix) { sample = rename + "[name]"; } else if (nameOperation == NameOperation.AddSuffix) { sample = "[name]" + rename; } else if (nameOperation == NameOperation.NewName) { sample = rename; } if (numberItems) { string padFormat = ""; for (int padNum = 0; padNum < numberPadding; padNum++) { padFormat += "0"; } sample += startNumber.ToString(padFormat); } GUILayout.Space(10); GUILayout.Label("Preview: " + sample); }
void OnGUI() { GUILayout.Label("重命名多个文件", EditorStyles.boldLabel); GUILayout.Label("注意: 目前不支持回退功能,请先保存你的场景!"); rename = EditorGUILayout.TextField("新名字: ", rename); nameOperation = (NameOperation)EditorGUILayout.EnumPopup("选择: ", nameOperation); numberItems = EditorGUILayout.Toggle("数字项: ", numberItems); if (numberItems) { numberPadding = Mathf.Clamp(EditorGUILayout.IntField("数字填充: ", numberPadding), 0, 100); startNumber = EditorGUILayout.IntField("开始数字: ", startNumber); incrementBy = Mathf.Clamp(EditorGUILayout.IntField("数字每次增加的数值: ", incrementBy), 1, 100000); sortInHierarchy = EditorGUILayout.Toggle("Hierarchy中排序: ", sortInHierarchy); } if (Selection.transforms.Length > 0) { if (GUILayout.Button("你选择了 " + Selection.transforms.Length + " 个对象来进行重命名")) { RenameNames(rename, nameOperation == NameOperation.添加后缀, nameOperation == NameOperation.添加前缀, numberItems, sortInHierarchy, numberPadding, startNumber, incrementBy); } } string sample = ""; if (nameOperation == NameOperation.添加前缀) { sample = rename + "[name]"; } else if (nameOperation == NameOperation.添加后缀) { sample = "[name]" + rename; } else if (nameOperation == NameOperation.新名字) { sample = rename; } if (numberItems) { string padFormat = ""; for (int padNum = 0; padNum < numberPadding; padNum++) { padFormat += "0"; } sample += startNumber.ToString(padFormat); } GUILayout.Space(10); GUILayout.Label("预览: " + sample); }
void OnGUI() { GUILayout.Label("Rename Multiple Files", EditorStyles.boldLabel); GUILayout.Label("Note: Undo is not currently supported. Save your scene first!"); rename = EditorGUILayout.TextField("New Name: ", rename); nameOperation = (NameOperation)EditorGUILayout.EnumPopup("Operation: ", nameOperation); numberItems = EditorGUILayout.Toggle("Number Items: ", numberItems); if (numberItems) { numberPadding = Mathf.Clamp(EditorGUILayout.IntField("Number Padding: ", numberPadding), 0, 10000); startNumber = EditorGUILayout.IntField("Start Number: ", startNumber); incrementBy = Mathf.Clamp(EditorGUILayout.IntField("Increment by (step): ", incrementBy), 1, 100000); sortInHierarchy = EditorGUILayout.Toggle("Sort in Hierarchy: ", sortInHierarchy); } if (Selection.transforms.Length > 0) { if (GUILayout.Button("Rename " + Selection.transforms.Length + " Item(s)")) { Utilities.RenameNames(rename, nameOperation == NameOperation.AddSuffix, nameOperation == NameOperation.AddPrefix, numberItems, sortInHierarchy, numberPadding, startNumber, incrementBy); } } string sample = ""; if (nameOperation == NameOperation.AddPrefix) { sample = rename + "[name]"; } else if (nameOperation == NameOperation.AddSuffix) { sample = "[name]" + rename; } else if (nameOperation == NameOperation.NewName) { sample = rename; } if (numberItems) { string padFormat = ""; for (int padNum = 0; padNum < numberPadding; padNum++) { padFormat += "0"; } sample += startNumber.ToString(padFormat); } GUILayout.Space (10); GUILayout.Label("Preview: " + sample); }