Forums › 💬 NodeCanvas › ⚙️ Support › Dynamic Variable log spam in Editor
Hey everyone,
this is just a quick patch which creates a new NCPref option to disable the Editor log spam regarding creation/promotion of dynamic BBParameters. Maybe this is useful to somebody else.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
.../Framework/Design/Editor/Windows/GraphEditor_Toolbar.cs | 1 + .../NodeCanvas/Framework/Design/PartialEditor/NCPrefs.cs | 6 ++++++ .../NodeCanvas/Framework/Runtime/Variables/BBParameter.cs | 12 ++++++++++-- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Assets/Packages/ParadoxNotion/NodeCanvas/Framework/Design/Editor/Windows/GraphEditor_Toolbar.cs b/Assets/Packages/ParadoxNotion/NodeCanvas/Framework/Design/Editor/Windows/GraphEditor_Toolbar.cs index a736683..767e6be 100644 --- a/Assets/Packages/ParadoxNotion/NodeCanvas/Framework/Design/Editor/Windows/GraphEditor_Toolbar.cs +++ b/Assets/Packages/ParadoxNotion/NodeCanvas/Framework/Design/Editor/Windows/GraphEditor_Toolbar.cs @@ -201,6 +201,7 @@ namespace NodeCanvas.Editor { menu.AddItem (new GUIContent ("Show Node IDs"), NCPrefs.showNodeIDs, ()=> {NCPrefs.showNodeIDs = !NCPrefs.showNodeIDs;}); menu.AddItem (new GUIContent ("Grid Snap"), NCPrefs.doSnap, ()=> {NCPrefs.doSnap = !NCPrefs.doSnap;}); menu.AddItem (new GUIContent ("Log Events"), NCPrefs.logEvents, ()=>{ NCPrefs.logEvents = !NCPrefs.logEvents; }); + menu.AddItem (new GUIContent ("Log Dynamic Parameters"), NCPrefs.logDynamicParameters, ()=>{ NCPrefs.logDynamicParameters = !NCPrefs.logDynamicParameters; }); menu.AddItem (new GUIContent ("Breakpoints Pause Editor"), NCPrefs.breakpointPauseEditor, ()=> {NCPrefs.breakpointPauseEditor = !NCPrefs.breakpointPauseEditor;}); menu.AddItem (new GUIContent ("Highlight Active In Hierarchy"), NCPrefs.highlightOwnersInHierarchy, ()=> {NCPrefs.highlightOwnersInHierarchy = !NCPrefs.highlightOwnersInHierarchy;}); if (graph.autoSort){ diff --git a/Assets/Packages/ParadoxNotion/NodeCanvas/Framework/Design/PartialEditor/NCPrefs.cs b/Assets/Packages/ParadoxNotion/NodeCanvas/Framework/Design/PartialEditor/NCPrefs.cs index 08d7fc0..ba477fb 100644 --- a/Assets/Packages/ParadoxNotion/NodeCanvas/Framework/Design/PartialEditor/NCPrefs.cs +++ b/Assets/Packages/ParadoxNotion/NodeCanvas/Framework/Design/PartialEditor/NCPrefs.cs @@ -25,6 +25,7 @@ namespace NodeCanvas.Editor{ public bool useExternalInspector = false; public bool showWelcomeWindow = true; public bool logEvents = true; + public bool logDynamicParameters = true; public bool highlightOwnersInHierarchy = false; public bool useBrowser = true; public bool breakpointPauseEditor = true; @@ -153,6 +154,11 @@ namespace NodeCanvas.Editor{ set {if (data.logEvents != value){ data.logEvents = value; Save(); } } } + public static bool logDynamicParameters{ + get {return data.logDynamicParameters;} + set {if (data.logDynamicParameters != value){ data.logDynamicParameters = value; Save(); } } + } + public static bool highlightOwnersInHierarchy{ get {return data.highlightOwnersInHierarchy;} set {if (data.highlightOwnersInHierarchy != value){ data.highlightOwnersInHierarchy = value; Save(); } } diff --git a/Assets/Packages/ParadoxNotion/NodeCanvas/Framework/Runtime/Variables/BBParameter.cs b/Assets/Packages/ParadoxNotion/NodeCanvas/Framework/Runtime/Variables/BBParameter.cs index a5a5cc6..49563cb 100644 --- a/Assets/Packages/ParadoxNotion/NodeCanvas/Framework/Runtime/Variables/BBParameter.cs +++ b/Assets/Packages/ParadoxNotion/NodeCanvas/Framework/Runtime/Variables/BBParameter.cs @@ -7,6 +7,10 @@ using NodeCanvas.Framework.Internal; using UnityEngine; using Logger = ParadoxNotion.Services.Logger; +#if UNITY_EDITOR +using NodeCanvas.Editor; +#endif + namespace NodeCanvas.Framework { #if UNITY_EDITOR //handles missing parameter types and upgrades of T to BBParameter<T> @@ -316,7 +320,9 @@ namespace NodeCanvas.Framework { varRef = targetBB.AddVariable(varName, varType); if (varRef != null){ #if UNITY_EDITOR - Logger.Log(string.Format("Parameter '{0}' (of type '{1}') promoted to a Variable in Blackboard '{2}'.", varName, varType.FriendlyName(), bbName), "Variable", this); + if (NCPrefs.logDynamicParameters) { + Logger.Log(string.Format("Parameter '{0}' (of type '{1}') promoted to a Variable in Blackboard '{2}'.", varName, varType.FriendlyName(), bbName), "Variable", this); + } #endif } else { Logger.LogError(string.Format("Parameter {0} (of type '{1}') failed to promote to a Variable in Blackboard '{2}'.", varName, varType.FriendlyName(), bbName), "Variable", this); @@ -397,7 +403,9 @@ namespace NodeCanvas.Framework { //Dynamic? if (bb != null && !string.IsNullOrEmpty(name)){ #if UNITY_EDITOR - Logger.LogWarning(string.Format("Dynamic Parameter Variable '{0}' Encountered...", name), "Variable", this ); + if (NCPrefs.logDynamicParameters) { + Logger.LogWarning(string.Format("Dynamic Parameter Variable '{0}' Encountered...", name), "Variable", this ); + } #endif //setting the varRef property also binds it varRef = PromoteToVariable(bb); |
Hey, Thanks!
I have just added this as well for the next version update 😉
