hubs-plugin-api icon indicating copy to clipboard operation
hubs-plugin-api copied to clipboard

Spoke Node API

Open robertlong opened this issue 5 years ago • 0 comments

I think the Spoke Node API is going to live on for a while. Maybe we'll migrate completely to ECSY, but I think it may take a while. If we want an API for Spoke in the meantime, here's a start.

import Spoke from "spoke";
import { Mesh, BoxBufferGeometry, MeshBasicMaterial } from "three";
import React from "react";

class CubeNode extends Spoke.EditorNodeMixin(Mesh) {
  constructor() {
    super(new BoxBufferGeometry(), new MeshBasicMaterial());
  }
 ...
}

function CubeNodeEditor({ node }) {
  return (
    <Spoke.NodeEditor>
    ...
    </Spoke.NodeEditor>
  )
}

export function config(editor) {
  editor.registerNode(CubeNode, CubeNodeEditor);
}

robertlong avatar Jun 12 '20 15:06 robertlong