Giter Site home page Giter Site logo

Comments (1)

hydrusbeta avatar hydrusbeta commented on August 18, 2024

I think I have the same question. I'll explain my concrete use-case below in case that helps with deciding on the relative priority of this issue.

I am attempting to build "probe" nodes whose sole purpose is to observe data at various stages of the logic graph. For example, I want to create a "Probe Audio" node for playing back an audio signal at a specific point:
probe audio node

To do this, I have created a custom Control:

Controls.custom({
    name: input.Name,
    label: input.Name,
    render: (data, onChange, _context, _redraw, _portProps, _controlData) => (
        <ProbeAudio src={data} setSrc={onChange}/>
    ),
})

Where ProbeAudio is defined like this:

import {get_base64_data_from_server} from './server_api';

export default function ProbeAudio({src, setSrc} : {src: string, setSrc: (a: string) => void}){
    return (
        <div>
            <button onClick={()=>{
                const my_id = "???" // How do I get the ID of the node that this custom Control belongs to?
                const data : string = get_base64_data_from_server(my_id)
                setSrc(data);
            }}>
                Refresh
            </button>
            <audio src={src} controls={true}/>
        </div>
    );
}

However, I don't know how to get the ID (or more precisely, the data-node-id attribute) of the Node that the custom Control belongs to. I need it in order to identify the node I want to retrieve the data for (there may be many "Audio Probe" nodes throughout the graph). I can use the nodeEditor ref to get data about all nodes (via nodeEditor.current?.getNodes()), but that doesn't help me identify which node this one is.

I am also not using the Root Engine that comes with Flume; my intention is to execute the logic graph in my own engine on a separate server and then use an API to retrieve the results.

from flume.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.