Seneral / Node_Editor_Framework

A flexible and modular Node Editor Framework for creating node based displays and editors in Unity
https://nodeeditor.seneral.dev
MIT License
2.01k stars 415 forks source link

DropDown does not work #116

Closed michaelsakharov closed 7 years ago

michaelsakharov commented 7 years ago

Dropdown does not work on Develop and Master branches It drops down but you cannot select anything

Unity 5.4.3

And also this error, But they are different things i think

NullReferenceException: Object reference not set to an instance of an object UnityEditor.EditorGUI.HasKeyboardFocus (Int32 controlID) (at C:/buildslave/unity/build/Editor/Mono/EditorGUI.cs:1762) UnityEditor.EditorGUI.DoNumberField (UnityEditor.RecycledTextEditor editor, Rect position, Rect dragHotZone, Int32 id, Boolean isDouble, System.Double& doubleVal, System.Int64& longVal, System.String formatString, UnityEngine.GUIStyle style, Boolean draggable, Double dragSensitivity) (at C:/buildslave/unity/build/Editor/Mono/EditorGUI.cs:1776) UnityEditor.EditorGUI.DoFloatField (UnityEditor.RecycledTextEditor editor, Rect position, Rect dragHotZone, Int32 id, Single value, System.String formatString, UnityEngine.GUIStyle style, Boolean draggable, Single dragSensitivity) (at C:/buildslave/unity/build/Editor/Mono/EditorGUI.cs:1721) UnityEditor.EditorGUI.DoFloatField (UnityEditor.RecycledTextEditor editor, Rect position, Rect dragHotZone, Int32 id, Single value, System.String formatString, UnityEngine.GUIStyle style, Boolean draggable) (at C:/buildslave/unity/build/Editor/Mono/EditorGUI.cs:1714) UnityEditor.EditorGUI.FloatFieldInternal (Rect position, UnityEngine.GUIContent label, Single value, UnityEngine.GUIStyle style) (at C:/buildslave/unity/build/Editor/Mono/EditorGUI.cs:1588) UnityEditor.EditorGUI.FloatField (Rect position, UnityEngine.GUIContent label, Single value, UnityEngine.GUIStyle style) (at C:/buildslave/unity/build/artifacts/generated/common/editor/EditorGUIBindings.gen.cs:291) UnityEditor.EditorGUI.FloatField (Rect position, System.String label, Single value, UnityEngine.GUIStyle style) (at C:/buildslave/unity/build/artifacts/generated/common/editor/EditorGUIBindings.gen.cs:279) UnityEditor.EditorGUI.FloatField (Rect position, System.String label, Single value) (at C:/buildslave/unity/build/artifacts/generated/common/editor/EditorGUIBindings.gen.cs:274) UnityEditor.EditorGUILayout.FloatField (System.String label, Single value, UnityEngine.GUILayoutOption[] options) (at C:/buildslave/unity/build/Editor/Mono/EditorGUI.cs:5752) NodeEditorFramework.Standard.DynamicNode.NodeGUI () (at Assets/Plugins/Node_Editor/Nodes/Example/DynamicNode.cs:57) NodeEditorFramework.Node.DrawNode () (at Assets/Plugins/Node_Editor/Framework/Node.cs:259) NodeEditorFramework.NodeEditor.DrawSubCanvas (NodeEditorFramework.NodeCanvas nodeCanvas, NodeEditorFramework.NodeEditorState editorState) (at Assets/Plugins/Node_Editor/Framework/NodeEditor.cs:243) NodeEditorFramework.NodeEditor.DrawCanvas (NodeEditorFramework.NodeCanvas nodeCanvas, NodeEditorFramework.NodeEditorState editorState) (at Assets/Plugins/Node_Editor/Framework/NodeEditor.cs:165) NodeEditorFramework.Standard.RTNodeEditor.OnGUI () (at Assets/Plugins/Node_Editor/Example/RTNodeEditor.cs:67)

Seneral commented 7 years ago

I need more information... like

Same for the second error, when did this happen, what did you do then, etc.? Thanks:)

michaelsakharov commented 7 years ago

capture

Runtime No error for the dropdown It will open but I cannot select anything in it.

The error happens with the DynamicCalculationNode on the forum page Can't type inside the fields capture

Also, the dropdown does not work either

EDIT--------- I discovered that the dialog nodes also give the same error and same bug.

Seneral commented 7 years ago

A well, both problems have the same cause, actually. Both the dropdown and the textfields used are editor controls, which do not work at runtime (even if the editor classes are available). This is impossible for us to change so we made replacement controls (found in RTEditorGUI). Replacement for popups are on their way (you see one working every time when right clicking;)) but enumPopup has not yet been replaced. FloatField has been replaced, but the example is very old so it still uses editor controls. To fix it, simply replace

if (input.connection != null)
    GUILayout.Label (input.name + ": " + input.GetValue<float> ());
#if UNITY_EDITOR
else
    data.value = UnityEditor.EditorGUILayout.FloatField (input.name, data.value);
if (cnt > 0)

with

if (input.connection != null)
    GUILayout.Label (input.name + ": " + input.GetValue<float> ());
else
    data.value = RTEditorGUI.FloatField (input.name, data.value);
#if UNITY_EDITOR
if (cnt > 0)

in NodeGUI of DynamicNode.

Again, this is only a problem at runtime, in the editor window it should work fine:)