Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Commit

Permalink
Added partial keyword to core classes to make them easier to extend
Browse files Browse the repository at this point in the history
Basic criterions:
- Class should be commonly accessed by users through the API
- or class describes the core structure of the framework
- or class is a key modifiaction point for custom extensions (GUI/Callbacks)
- and class is not containing only elements that are fetched in the whole assembly either way or is responsible for fetching additional content from assemblies

Adding an additional source file to the project with the same class heading will allow you to extend the partial classes with additional variables and functions, but not to change methods.
For that, you might need to extend and override classes if possible or directly modify the framework.
  • Loading branch information
Seneral committed Sep 14, 2016
1 parent 7b88838 commit 1641989
Show file tree
Hide file tree
Showing 12 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Node_Editor/Framework/DefaultNodeCalculator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace NodeEditorFramework
{
public class DefaultNodeCalculator : INodeCalculator
public partial class DefaultNodeCalculator : INodeCalculator
{
// A list of Nodes from which calculation originates -> Call StartCalculation
public List<Node> workList;
Expand Down
2 changes: 1 addition & 1 deletion Node_Editor/Framework/Node.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace NodeEditorFramework
{
public abstract class Node : ScriptableObject
public abstract partial class Node : ScriptableObject
{
public Rect rect = new Rect ();
internal Vector2 contentOffset = Vector2.zero;
Expand Down
2 changes: 1 addition & 1 deletion Node_Editor/Framework/NodeCanvas.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace NodeEditorFramework
{
[NodeCanvasType("Default")]
public class NodeCanvas : ScriptableObject
public partial class NodeCanvas : ScriptableObject
{ // Just contains the nodes and global canvas stuff; an associated NodeEditorState holds the actual state now
public virtual string canvasName { get { return "Calculation Canvas"; } }

Expand Down
2 changes: 1 addition & 1 deletion Node_Editor/Framework/NodeCanvasSceneSave.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using UnityEngine;
using NodeEditorFramework;

public class NodeCanvasSceneSave : MonoBehaviour
public partial class NodeCanvasSceneSave : MonoBehaviour
{
public string saveName;
public NodeCanvas savedNodeCanvas;
Expand Down
2 changes: 1 addition & 1 deletion Node_Editor/Framework/NodeEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace NodeEditorFramework
/// <summary>
/// Central class of NodeEditor providing the GUI to draw the Node Editor Canvas, bundling all other parts of the Framework
/// </summary>
public static class NodeEditor
public static partial class NodeEditor
{
public static INodeCalculator Calculator;

Expand Down
4 changes: 2 additions & 2 deletions Node_Editor/Framework/NodeEditorCallbackReceiver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace NodeEditorFramework
{
public abstract class NodeEditorCallbackReceiver : MonoBehaviour
public abstract partial class NodeEditorCallbackReceiver : MonoBehaviour
{
// Editor
public virtual void OnEditorStartUp () {}
Expand All @@ -25,7 +25,7 @@ public virtual void OnAddConnection (NodeInput input) {}
public virtual void OnRemoveConnection (NodeInput input) {}
}

public static class NodeEditorCallbacks
public static partial class NodeEditorCallbacks
{
private static int receiverCount;
private static List<NodeEditorCallbackReceiver> callbackReceiver;
Expand Down
2 changes: 1 addition & 1 deletion Node_Editor/Framework/NodeEditorGUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace NodeEditorFramework
{
public static class NodeEditorGUI
public static partial class NodeEditorGUI
{
// static GUI settings, textures and styles
public static int knobSize = 16;
Expand Down
2 changes: 1 addition & 1 deletion Node_Editor/Framework/NodeEditorSaveManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace NodeEditorFramework
/// <summary>
/// Manager handling all save and load operations on NodeCanvases and NodeEditorStates of the Node Editor, both as assets and in the scene
/// </summary>
public static class NodeEditorSaveManager
public static partial class NodeEditorSaveManager
{
#region Scene Saving

Expand Down
2 changes: 1 addition & 1 deletion Node_Editor/Framework/NodeEditorState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace NodeEditorFramework
{
public class NodeEditorState : ScriptableObject
public partial class NodeEditorState : ScriptableObject
{ // holds the state of a NodeCanvas inside a NodeEditor
public NodeCanvas canvas;
public NodeEditorState parentEditor;
Expand Down
2 changes: 1 addition & 1 deletion Node_Editor/Framework/NodeInput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace NodeEditorFramework
/// <summary>
/// NodeInput accepts one connection to a NodeOutput by default
/// </summary>
public class NodeInput : NodeKnob
public partial class NodeInput : NodeKnob
{
// NodeKnob Members
protected override NodeSide defaultSide { get { return NodeSide.Left; } }
Expand Down
2 changes: 1 addition & 1 deletion Node_Editor/Framework/NodeKnob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public enum NodeSide { Left = 4, Top = 3, Right = 2, Bottom = 1 }
/// Abstract knob on the side of an node that handles positioning drawing with a texture and even labeling and positioning calls
/// </summary>
[System.Serializable]
public class NodeKnob : ScriptableObject
public partial class NodeKnob : ScriptableObject
{
// Main
public Node body;
Expand Down
2 changes: 1 addition & 1 deletion Node_Editor/Framework/NodeOutput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace NodeEditorFramework
/// <summary>
/// Node output accepts multiple connections to NodeInputs by default
/// </summary>
public class NodeOutput : NodeKnob
public partial class NodeOutput : NodeKnob
{
// NodeKnob Members
protected override NodeSide defaultSide { get { return NodeSide.Right; } }
Expand Down

0 comments on commit 1641989

Please sign in to comment.