Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: export to code #104

Closed
CheweyZ opened this issue May 19, 2018 · 12 comments
Closed

Feature: export to code #104

CheweyZ opened this issue May 19, 2018 · 12 comments

Comments

@CheweyZ
Copy link

CheweyZ commented May 19, 2018

I'm not sure what this would mean at your end depending on how you have it setup but would it be possible to have a feature that exports your current setup of blocks into JS given the logic that it runs is already in the blocks?

Note if not intending to add would you have any standout features of what I should do to implement it my self? as currently having issues figuring out the call stack of passing info between nodes in terms of code almost calling functions

@Ni55aN
Copy link
Member

Ni55aN commented May 19, 2018

You can try to write lines of code inside the workers into a common string/file.
I can not exactly guarantee the success of this method, since I have not yet tested

@Ni55aN
Copy link
Member

Ni55aN commented May 19, 2018

Everything works well for simple example:
https://jsfiddle.net/Ni55aN/hp4gcqum/

@Ni55aN
Copy link
Member

Ni55aN commented Jun 6, 2018

This functionality can be implemented in the form of a plugin in v1.0.0 #80

@Clasen00
Copy link

Clasen00 commented Sep 7, 2018

@Ni55aN can you please explain a little how can I use source code of my node in 1.0.8 alpha version of Rete? Because in 1.0.2 I could use something like this worker(node, inputs, outputs, sourceCode) {} so sourceCode var was the exactly source code. But in the current version this variable returning 'undefined' value. What can I do with this? Where I can find source code of specific node to append some js to it?

@Clasen00
Copy link

Clasen00 commented Sep 7, 2018

@Ni55aN to be more clear there is an example of what I want to do: https://codepen.io/hatead/pen/mjPmxV?editors=0010

@Ni55aN
Copy link
Member

Ni55aN commented Sep 7, 2018

The major difference between alpha.2 and alpha.8 is inputs/outputs indexes #146

https://rete.readthedocs.io/en/latest/Components/

@Clasen00
Copy link

Clasen00 commented Sep 7, 2018

@Ni55aN so there is no any examples about how i can append some js to the specific node?

@Ni55aN
Copy link
Member

Ni55aN commented Sep 7, 2018

@Clasen00 do you mean a visual elements or logic ?

@Clasen00
Copy link

Clasen00 commented Sep 7, 2018

@Ni55aN i mean how to add some custom elements to the specific node :) Like in that example https://codepen.io/hatead/pen/mjPmxV?editors=0010 there is "+" and "-" buttons, i need this in my project)

@Ni55aN
Copy link
Member

Ni55aN commented Sep 7, 2018

@Clasen00 ok, let's start again from beginning

But in the current version this variable returning 'undefined' value.

Did you pass the sourceCode variable to engine.process() ?

there is "+" and "-" buttons, i need this in my project)

You need a ButtonControl from the example, but this component rendered with a rete-alight-render-plugin. Currently rete-vue-render-plugin is more preferable.
In any case, you can use alight-render together with vue-render - just add this.render = 'alight'; to constructor of exist ButtonControl and node.addControl(new ButtonControl(this.editor, 'btn', "+" )) inside builder()

@Clasen00
Copy link

Clasen00 commented Sep 7, 2018

@Ni55aN thank you! I will try!

@Ni55aN
Copy link
Member

Ni55aN commented Oct 20, 2018

A codegenaration is a quite complex, so I need any help of those who have experience with it.

Currently code-plugin can only create a very simple code constructiona

@Ni55aN Ni55aN closed this as completed Oct 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants