engine

package
v0.1.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2021 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	Id         int
	Type       string
	Properties map[string]interface{}

	Inputs []int
	Output [][]int

	Status string
}

func (*Block) Done

func (b *Block) Done()

func (*Block) ReSet

func (b *Block) ReSet()

type Graph

type Graph struct {
	Blocks map[int]*Block
	Links  map[int]*Link
}

func New

func New() *Graph

func NewGraphByDefinition

func NewGraphByDefinition(definition string) (*Graph, error)

func NewGraphByFile

func NewGraphByFile(filename string) (*Graph, error)

func NewGraphByScene

func NewGraphByScene(bs []*scene.BlockDefinition, s *scene.Scene) (*Graph, error)

func (*Graph) AddBlock

func (g *Graph) AddBlock(id int, tp string, properties map[string]interface{}, inputs []int, outputs [][]int) *Block
func (g *Graph) AddLink(id, sourceId, sourceSlot, targetId, targetSlot int) *Link

func (*Graph) FindBlockById

func (g *Graph) FindBlockById(id int) *Block

func (*Graph) FindLinkBySourcePort

func (g *Graph) FindLinkBySourcePort(id, slot int) []*Link

func (*Graph) Run

func (g *Graph) Run() []*Block

type GraphX

type GraphX struct {
	Nodes []Node        `json:"nodes"`
	Links []interface{} `json:"links"`
}
type Link struct {
	Id      int
	Source  Port
	Target  Port
	IsReady bool
}

type Node

type Node struct {
	Id         int                    `json:"id"`
	Type       string                 `json:"type"`
	Properties map[string]interface{} `json:"properties"`
	Inputs     []interface{}          `json:"inputs"`
	Outputs    []interface{}          `json:"outputs"`
}

type Output

type Output struct {
	Name string      `json:"name"`
	Type string      `json:"type"`
	Link interface{} `json:"link"`
}

type Port

type Port struct {
	Id   int
	Slot int
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL