mirror of
https://github.com/Siccity/xNode.git
synced 2026-02-06 15:24:55 +08:00
Cleanup
Removed unused code, added/fixed comments
This commit is contained in:
parent
ba69380638
commit
b9bd67bd28
@ -87,7 +87,6 @@ namespace XNodeEditor {
|
||||
private Type inspectedType;
|
||||
/// <summary> Tells a NodeEditor which Node type it is an editor for </summary>
|
||||
/// <param name="inspectedType">Type that this editor can edit</param>
|
||||
/// <param name="contextMenuName">Path to the node</param>
|
||||
public CustomNodeEditorAttribute(Type inspectedType) {
|
||||
this.inspectedType = inspectedType;
|
||||
}
|
||||
|
||||
@ -7,7 +7,10 @@ using UnityEngine;
|
||||
|
||||
namespace XNodeEditor.Internal {
|
||||
/// <summary> Handles caching of custom editor classes and their target types. Accessible with GetEditor(Type type) </summary>
|
||||
public class NodeEditorBase<T, A, K> where A : Attribute, NodeEditorBase<T, A, K>.INodeEditorAttrib where T : NodeEditorBase<T, A, K> where K : ScriptableObject {
|
||||
/// <typeparam name="T">Editor Type. Should be the type of the deriving script itself (eg. NodeEditor) </typeparam>
|
||||
/// <typeparam name="A">Attribute Type. The attribute used to connect with the runtime type (eg. CustomNodeEditorAttribute) </typeparam>
|
||||
/// <typeparam name="K">Runtime Type. The ScriptableObject this can be an editor for (eg. Node) </typeparam>
|
||||
public abstract class NodeEditorBase<T, A, K> where A : Attribute, NodeEditorBase<T, A, K>.INodeEditorAttrib where T : NodeEditorBase<T, A, K> where K : ScriptableObject {
|
||||
/// <summary> Custom editors defined with [CustomNodeEditor] </summary>
|
||||
private static Dictionary<Type, Type> editorTypes;
|
||||
private static Dictionary<K, T> editors = new Dictionary<K, T>();
|
||||
|
||||
@ -335,7 +335,6 @@ namespace XNodeEditor {
|
||||
|
||||
// Move array data if there is any
|
||||
if (hasArrayData) {
|
||||
SerializedProperty arrayDataOriginal = arrayData.Copy();
|
||||
arrayData.MoveArrayElement(reorderableListIndex, rl.index);
|
||||
}
|
||||
|
||||
|
||||
@ -71,16 +71,6 @@ namespace XNodeEditor {
|
||||
return types.ToArray();
|
||||
}
|
||||
|
||||
public static object ObjectFromType(Type type) {
|
||||
return Activator.CreateInstance(type);
|
||||
}
|
||||
|
||||
public static object ObjectFromFieldName(object obj, string fieldName) {
|
||||
Type type = obj.GetType();
|
||||
FieldInfo fieldInfo = type.GetField(fieldName);
|
||||
return fieldInfo.GetValue(obj);
|
||||
}
|
||||
|
||||
public static KeyValuePair<ContextMenu, MethodInfo>[] GetContextMenuMethods(object obj) {
|
||||
Type type = obj.GetType();
|
||||
MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
|
||||
|
||||
@ -65,7 +65,7 @@ namespace XNodeEditor {
|
||||
public string editorPrefsKey;
|
||||
/// <summary> Tells a NodeGraphEditor which Graph type it is an editor for </summary>
|
||||
/// <param name="inspectedType">Type that this editor can edit</param>
|
||||
/// <param name="uniquePreferencesID">Define unique key for unique layout settings instance</param>
|
||||
/// <param name="editorPrefsKey">Define unique key for unique layout settings instance</param>
|
||||
public CustomNodeGraphEditorAttribute(Type inspectedType, string editorPrefsKey = "xNode.Settings") {
|
||||
this.inspectedType = inspectedType;
|
||||
this.editorPrefsKey = editorPrefsKey;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user