Skip to content

Commit

Permalink
Updated NoiseCrimeStudios Core Namespaces to match current projects.
Browse files Browse the repository at this point in the history
Updated NoiseCrimeStudios namespaces for Editor scripts to match current version of Core package.
Renamed NoiseCrimeStudioToolEnum.cs to UnityMenuEnumerations.cs
  • Loading branch information
noisecrime committed Apr 20, 2023
1 parent c75fbd9 commit c78c424
Show file tree
Hide file tree
Showing 16 changed files with 115 additions and 89 deletions.
16 changes: 16 additions & 0 deletions Assets/NoiseCrimeStudios/Core/Formatting/Numerical.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,22 @@ namespace NoiseCrimeStudios.Core.Formatting
{
public static class Numerical
{
#if UNITY_2019_4_OR_NEWER
/// <summary>
/// Returns the number of digits for a Int32 value.
/// </summary>
/// <see cref="https://stackoverflow.com/questions/4483886/how-can-i-get-a-count-of-the-total-number-of-digits-in-a-number"/>
public static int Int32_Digits_Log10( this int n ) =>
n == 0 ? 1 : ( n > 0 ? 1 : 2 ) + ( int )Math.Log10( Math.Abs( ( double )n ) );

/// <summary>
/// Returns the number of digits for a Int32 value.
/// </summary>
/// <see cref="https://stackoverflow.com/questions/4483886/how-can-i-get-a-count-of-the-total-number-of-digits-in-a-number"/>
public static int Int64_Digits_Log10( this long n ) =>
n == 0L ? 1 : ( n > 0L ? 1 : 2 ) + ( int )Math.Log10( Math.Abs( ( double )n ) );
#endif

// Overall this has proven to be the most efficeint method to use from this page
// https://stackoverflow.com/questions/281640/how-do-i-get-a-human-readable-file-size-in-bytes-abbreviation-using-net#4975942
// Returns the human-readable file size for an arbitrary, 64-bit file size. However it reverts to bytes for long.MinValue
Expand Down
1 change: 1 addition & 0 deletions Assets/NoiseCrimeStudios/Core/IO/DirectoryCopy.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.IO;
using NoiseCrimeStudios.Core.Utilities;

namespace NoiseCrimeStudios.Core.IO
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Text;
using UnityEngine;

namespace NoiseCrimeStudios.Core
namespace NoiseCrimeStudios.Core.Utilities
{
/// <summary>
/// Stringbuilder based logging with features for use via Debug.Log.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#if !UNITY_2019_4_OR_NEWER
using UnityEditor;

namespace NoiseCrimeStudios.Editor.Internal
namespace NoiseCrimeStudios.Core.Editor.Internal
{
/// <summary>Adds the Internal Unity IMGUI Debugger to the Window Menu.</summary>
/// <remarks>
/// Source: UnityCsReference\Editor\Mono\GUIDebugger\GUIViewDebuggerWindow.cs
/// MenuItem: [MenuItem("Window/Analysis/IMGUI Debugger", false, 102, true)]
/// </remarks>
public static class InternalDebugIMGUI
public static class InternalDebugIMGUI
{
#if UNITY_2018_2_OR_NEWER
[MenuItem( "Window/Analysis/IMGUI Debugger", false, 112 )]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using UnityEditor;

namespace NoiseCrimeStudios.Editor.Internal
namespace NoiseCrimeStudios.Core.Editor.Internal
{
/// <summary>Adds the Internal Unity Undo Debugger to the Widow Menu.</summary>
/// <remarks>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using UnityEditor;
using UnityEngine;

namespace NoiseCrimeStudios.Editor.Internal
namespace NoiseCrimeStudios.Core.Editor.Internal
{
/// <summary>
/// Exposes the native Unity 'ScreenShotting' methods to Unity Menu & Shortcut keys.
Expand Down
77 changes: 0 additions & 77 deletions Assets/NoiseCrimeStudios/Editor/NoiseCrimeStudioToolEnum.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using UnityEngine;

namespace NoiseCrimeStudios.Editor.IMGUI
namespace NoiseCrimeStudios.Core.Editor.IMGUI
{
/// <summary>Support for a clipped Unity IMGUI ScrollView.</summary>
/// <remarks>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using UnityEditor;
using UnityEngine;

namespace NoiseCrimeStudios.Editor.IMGUI
namespace NoiseCrimeStudios.Core.Editor.IMGUI
{
/// <summary>Collection of static methods to help with Unity's Immediate Mode GUI layout.</summary>
public static class EditorGUIMethods
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using UnityEditor;
using UnityEngine;

namespace NoiseCrimeStudios.Editor.IMGUI
namespace NoiseCrimeStudios.Core.Editor.IMGUI
{
/// <summary>Collection of custom styles for Unity's Immediate Mode GUI layout.</summary>
/// <remarks>
Expand Down
84 changes: 84 additions & 0 deletions Assets/NoiseCrimeStudios/Editor/UnityMenuEnumerations.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
// Was NoiseCrimeStudioToolEnum.cs

/// <remarks>
/// Setting a MenuItems priority prior to 2019.1 generally requires restarting Unity in most cases for it to be picked up.
/// Deleting, compiling, then restoring a priority may be sufficient to force Unity to reflect changes.
/// Unity Menu's and priorties link - https://blog.redbluegames.com/guide-to-extending-unity-editors-menus-b2de47a746db
/// PreviousPriorty + 11 == divider between entries.
/// As the menu path defines where item goes, the priorty can start at any value?
/// </remarks>

namespace NoiseCrimeStudios.Core.Editor
{
public static class EditorMenuPaths
{
public const string NoiseCrimeStudios = "Window/NoiseCrimeStudios/";
}

public enum WindowMenuItemPriorty
{
None = 0,

// NoiseCrimeStudio Specific
Inspectors = 400, // Window/NoiseCrimeStudios/Inspectors
EditorSettings = 411, // Window/NoiseCrimeStudios/Settings 1105
EditorTools = 422, // Window/NoiseCrimeStudios/Tools 1110
Windows = 433, // Window/NoiseCrimeStudios/Windows 1130
Examples = 444, // Window/NoiseCrimeStudios/Examples
Validations = 499 // Window/NoiseCrimeStudios/Validations
}

/// <summary>Enumeration for Asset Menu Items.</summary>
public enum AssetMenuItemPriority
{
Default = 0,

// Create
CreateScripts = 105, // Assets/Create

// Asset
Packages = 200, // Assets/ImportAssetPackage
References = 201, // Assets/Reference Checker

AssetInspectors = 202,

AssetTools = 210, // Assets/Tools
AssetInfo = 221, // Assets/Tools - Info

Legacy = 1000
}

/// <summary>Enumeration for Project Menu Items. Where Project is the specific Unity Project.</summary>
public enum ProjectMenuItemPriority
{
Default = 0,
Build = 10, // Project/Build
Tools = 50, // Project/Tools
Validation = 200 // Project/Validation
}

/* Needs to be in Core!
/// <summary>Enumeration for CreateAsset Menu Items.</summary>
public enum CreateAssetMenuItemPriority
{
// TODO For ScriptableObjects
}
*/

/// <summary>Enumeration for GameObject Menu Items.</summary>
public enum GameObjectMenuPriority
{
Default = -100,
CreateBegin = -10,
CreateEmpty = -1,
Create3D = 0,
Create2D = 1,
CreateEnd = 11,

ChildrenTop = 49,
ChildrenEnd = 50,

ParentEnd = 100,
DefaultEnd = 500
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

using System.Collections.Generic;
using System.IO;
using NoiseCrimeStudios.Core;
using NoiseCrimeStudios.Core.IO;
using NoiseCrimeStudios.Core.Utilities;
using UnityEditor;
using UnityEngine;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
using System;
using System.Collections.Generic;
using System.IO;
using NoiseCrimeStudios.Core.Editor;
using NoiseCrimeStudios.Core.Editor.IMGUI;
using NoiseCrimeStudios.Core.Formatting;
using NoiseCrimeStudios.Editor;
using NoiseCrimeStudios.Editor.IMGUI;
using UnityEditor;
using UnityEditorInternal;
using UnityEngine;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;
using System.IO;
using NoiseCrimeStudios.Core;
using NoiseCrimeStudios.Core.Utilities;
using UnityEditor;
using UnityEngine.Assertions;

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ The name of the package. Click this area to access a dropdown menu:


## Updates
*2023.04.20 () - Updated NoiseCrimeStudios Core Namespaces to match current projects.

* 2023.04.20 (430d1eb) - Updated EditorConfig to match the standard I'm using for all current and future projects. Resulted in a large amount of changes to files, but limited to things like addressing Name Rule violations, layout, explicit 'private' of methods and line endings.

* 2023.04.13 (3bc2d9c) - Version 1.1: Fixed issues with light/dark skin UI.
Expand Down

0 comments on commit c78c424

Please sign in to comment.