private void UpdateScaled() { Vector2 posCur = startMargin; while (widgets.Count < widgetsCount) { widgets.Add(EditorPlus.GetScaledButtonRectByPos(ref posCur, widgetSize * widgetScale, widgetMargin, startMargin, area)); } }
void Unity4() { if (GUI.skin != IconsSkin) { GUI.skin = IconsSkin; } Vector2 posCur = StartMargin; GUIContent cnt = new GUIContent(UnityPrimitiveCubeThumb); cnt.tooltip = "Cube"; if (GUI.Button(EditorPlus.GetButtonRectByPos(ref posCur, ButtonSize, ButtonMargin, StartMargin, window.position), cnt)) { EditorApplication.ExecuteMenuItem("GameObject/Create Other/Cube"); } cnt = new GUIContent(UnityPrimitiveSphereThumb); cnt.tooltip = "Sphere"; if (GUI.Button(EditorPlus.GetButtonRectByPos(ref posCur, ButtonSize, ButtonMargin, StartMargin, window.position), cnt)) { EditorApplication.ExecuteMenuItem("GameObject/Create Other/Sphere"); } cnt = new GUIContent(UnityPrimitiveCylinderThumb); cnt.tooltip = "Cylinder"; if (GUI.Button(EditorPlus.GetButtonRectByPos(ref posCur, ButtonSize, ButtonMargin, StartMargin, window.position), cnt)) { EditorApplication.ExecuteMenuItem("GameObject/Create Other/Cylinder"); } cnt = new GUIContent(UnityPrimitiveCapsuleThumb); cnt.tooltip = "Capsule"; if (GUI.Button(EditorPlus.GetButtonRectByPos(ref posCur, ButtonSize, ButtonMargin, StartMargin, window.position), cnt)) { EditorApplication.ExecuteMenuItem("GameObject/Create Other/Capsule"); } cnt = new GUIContent(UnityPrimitivePlaneThumb); cnt.tooltip = "Plane"; if (GUI.Button(EditorPlus.GetButtonRectByPos(ref posCur, ButtonSize, ButtonMargin, StartMargin, window.position), cnt)) { EditorApplication.ExecuteMenuItem("GameObject/Create Other/Plane"); } cnt = new GUIContent(UnityPrimitiveQuadThumb); cnt.tooltip = "Quad"; if (GUI.Button(EditorPlus.GetButtonRectByPos(ref posCur, ButtonSize, ButtonMargin, StartMargin, window.position), cnt)) { EditorApplication.ExecuteMenuItem("GameObject/Create Other/Quad"); } cnt = new GUIContent(UnityPrimitivePointlightThumb); cnt.tooltip = "Point Light"; if (GUI.Button(EditorPlus.GetButtonRectByPos(ref posCur, ButtonSize, ButtonMargin, StartMargin, window.position), cnt)) { EditorApplication.ExecuteMenuItem("GameObject/Create Other/Point Light"); } cnt = new GUIContent(UnityPrimitiveArealightThumb); cnt.tooltip = "Area Light"; if (GUI.Button(EditorPlus.GetButtonRectByPos(ref posCur, ButtonSize, ButtonMargin, StartMargin, window.position), cnt)) { EditorApplication.ExecuteMenuItem("GameObject/Create Other/Area Light"); } cnt = new GUIContent(UnityPrimitiveSunlightThumb); cnt.tooltip = "Directional Light"; if (GUI.Button(EditorPlus.GetButtonRectByPos(ref posCur, ButtonSize, ButtonMargin, StartMargin, window.position), cnt)) { EditorApplication.ExecuteMenuItem("GameObject/Create Other/Directional Light"); } cnt = new GUIContent(UnityPrimitiveSpotlightThumb); cnt.tooltip = "Spotlight"; if (GUI.Button(EditorPlus.GetButtonRectByPos(ref posCur, ButtonSize, ButtonMargin, StartMargin, window.position), cnt)) { EditorApplication.ExecuteMenuItem("GameObject/Create Other/Spotlight"); } cnt = new GUIContent(UnityPrimitiveParticlesystemThumb); cnt.tooltip = "Particle System"; if (GUI.Button(EditorPlus.GetButtonRectByPos(ref posCur, ButtonSize, ButtonMargin, StartMargin, window.position), cnt)) { EditorApplication.ExecuteMenuItem("GameObject/Create Other/Particle System"); } cnt = new GUIContent(UnityPrimitiveAudioreverbThumb); cnt.tooltip = "Audio Reverb Zone"; if (GUI.Button(EditorPlus.GetButtonRectByPos(ref posCur, ButtonSize, ButtonMargin, StartMargin, window.position), cnt)) { EditorApplication.ExecuteMenuItem("GameObject/Create Other/Audio Reverb Zone"); } cnt = new GUIContent(UnityPrimitiveCameraviewportThumb); cnt.tooltip = "Camera Viewport aligned"; if (GUI.Button(EditorPlus.GetButtonRectByPos(ref posCur, ButtonSize, ButtonMargin, StartMargin, window.position), cnt)) { EditorApplication.ExecuteMenuItem("GameObject/Create Other/Camera"); GameObject goCam = Selection.activeGameObject; if (goCam != null && SceneView.lastActiveSceneView != null && SceneView.lastActiveSceneView.camera != null) { goCam.transform.position = SceneView.lastActiveSceneView.camera.transform.position; goCam.transform.rotation = SceneView.lastActiveSceneView.camera.transform.rotation; } } cnt = new GUIContent(UnityPrimitiveCameraThumb); cnt.tooltip = "Camera"; if (GUI.Button(EditorPlus.GetButtonRectByPos(ref posCur, ButtonSize, ButtonMargin, StartMargin, window.position), cnt)) { EditorApplication.ExecuteMenuItem("GameObject/Create Other/Camera"); } cnt = new GUIContent(UnityPrimitiveTreeThumb); cnt.tooltip = "Tree"; if (GUI.Button(EditorPlus.GetButtonRectByPos(ref posCur, ButtonSize, ButtonMargin, StartMargin, window.position), cnt)) { EditorApplication.ExecuteMenuItem("GameObject/Create Other/Tree"); } cnt = new GUIContent(UnityPrimitiveLandscapeThumb); cnt.tooltip = "Terrain"; if (GUI.Button(EditorPlus.GetButtonRectByPos(ref posCur, ButtonSize, ButtonMargin, StartMargin, window.position), cnt)) { EditorApplication.ExecuteMenuItem("GameObject/Create Other/Terrain"); } cnt = new GUIContent(UnityPrimitiveNullobjectThumb); cnt.tooltip = "Create Empty"; if (GUI.Button(EditorPlus.GetButtonRectByPos(ref posCur, ButtonSize, ButtonMargin, StartMargin, window.position), cnt)) { EditorApplication.ExecuteMenuItem("GameObject/Create Empty"); } }
void OnGUI() { if (!init) { return; } EditorGUILayout.BeginScrollView(ScrollViewPosition); EditorGUILayout.LabelField(""); EditorGUILayout.LabelField("Editor Plus Config"); #if EPlus_5 int cacheSize = EditorPlus.UnityTextureCache; cacheSize = EditorGUILayout.IntSlider("Unity Preview Cache Size", cacheSize, 20, 500); if (EditorPlus.UnityTextureCache != cacheSize) { EditorPlus.SetUnityCacheSize(cacheSize); } #endif EditorGUILayout.LabelField(""); EditorGUILayout.LabelField("Skins"); if (GUILayout.Button("Light 1")) { EditorPlus.Skin1(); } if (GUILayout.Button("Light 2")) { EditorPlus.Skin2(); } if (GUILayout.Button("Light 3")) { EditorPlus.Skin3(); } if (GUILayout.Button("Dark 1")) { EditorPlus.Skin4(); } if (GUILayout.Button("Dark 2")) { EditorPlus.Skin5(); } EditorGUILayout.LabelField(""); EditorPlusHistoryInternal.historyUseSceneSaving = GUILayout.Toggle(EditorPlusHistoryInternal.historyUseSceneSaving, "Save History Objects in Scenes"); if (GUILayout.Button("Remove save data in scene files")) { EditorPlusClearScenes.Run(); } if (GUILayout.Button("Readme")) { AssetDatabase.OpenAsset(AssetDatabase.LoadMainAssetAtPath(EditorPlus.PlusPath + "EditorPlus_Readme.pdf")); } if (GUILayout.Button("Website")) { Application.OpenURL("http://www.flowfiregames.com/"); } GUILayout.EndScrollView(); }