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 414 forks source link

Having trouble making custom connection types #79

Closed snarlynarwhal closed 8 years ago

snarlynarwhal commented 8 years ago

I'm having trouble implementing custom connection types. The current documentation seemed quite straightforward and simple, but I keep getting an error.

Basically, I need the output of a node to be a custom component reference which I assign in the inspector.

1) Made Machine Node (assign Machine component in inspector) capture

2) Created ITypeDeclaration Interface ` using UnityEngine; using System;

public interface ITypeDeclaration {

string name { get; }
Color col { get; }
string InputKnob_TexPath { get; }
string OutputKnob_TexPath { get; }
Type Type { get; }

} `

3) Created MachineType ` using UnityEngine; using System;

public class MachineType : ITypeDeclaration {

public string name { get { return "Machine";  } }
public Color col { get { return Color.cyan; } }
public string InputKnob_TexPath  { get { return "Textures/In_Knob.png";  } }
public string OutputKnob_TexPath { get { return "Textures/Out_Knob.png"; } }
public Type Type { get { return typeof(Machine); } }

} `

4) In my MachineNode Create method, I have this line: node.CreateOutput("Machine", "Machine");

5) I get this error: capture

Maybe I'm misunderstanding this completely, but is it possible to do what I'm trying to do? Thanks ahead for the help!

Seneral commented 8 years ago

Hi, first, you don't need (must not) create the ITypeDeclaration (yourself). The documentation is in one regard outdated, as it refers to the master branch. There were changes so it does not fully apply to the develop branch:/ Though a way improved documentation is waiting to be published once the merge of master and develop is performed:) For your problem, you need to extend IConnectionTypeDeclaration. It's essentially the same but names have changed. For a detailed overview, take a look at ConnectionTypes.cs in the develop branch. At the very bottom, you see the new IConnectionTypeDeclaration and the default float type.

Everything else of your code seems fine:)

snarlynarwhal commented 8 years ago

Ahh, you're the man - thanks for the quick replies! :D

Seneral commented 8 years ago

No problem, thanks:)

oxi-dev0 commented 5 years ago

In the new version, where are the ITypeDeclarations and the types declared?