-
Notifications
You must be signed in to change notification settings - Fork 46
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
Get patches, nodes and links #466
Comments
Ok, I've just figured out how to make this work, but you need to change some code in rpd.js First, you need make function return import spec return spec; inside import function Rpd.import.plain = function(lines) or Rpd.import.json = function(json) Then you need to modify return of makeImportSpec function, like this: return {
patches: patches,
nodes: nodes,
inlets: inlets,
outlets: outlets,
links: links, Now you can use result of import function and get patch by id like this: imported = Rpd.import.plain(fileContent.toString());
patch = imported.patches['d08w'];
//or just select first
patch = imported.patches[Object.keys(imported.patches)[0]]; I'am not sure is it right way to get imported things, but at least this method works for me. |
So there is some behaviour you should know about. var exportFunc = Rpd.export.plain('Patch name'); but previous events will not be included in new export file. /* uncomment if you want use unsubscribe as function argument
if(unsubscribe === true)
knownEvents.offValue(pushCommand);
*/
var prevLines = lines.slice(0);
storeMoves();
var text = lines.join(COMMAND_SEPARATOR);
lines = prevLines;
return text; BUT I don't know how to get current patch/nodes/links without importing them or listen to Rpd.events (this method is not really comfortable to use for obtain information) |
Hello.
I've just became RPD newbie, and looking for functions for get patch, nodes or links out of Rpd. It's easy to store created patch by
but I can't figure out how to get patch which has been imported from json or plain-text.
This code below imports patch (with fix #464) and then creates a new patch with right name but different id, so it can't be used for control imported path.
I've searched for it in docs but found nothing about.
The text was updated successfully, but these errors were encountered: