Is it possible to get the xml data from a track node, like tracks[num].to_xml() ? Istracks[num] return a xml string?
If 1. is just a reference, can I duplicate the object using a standard lua recursive duplication function for objects? This would I guess only work if there were magic methods defined for each kind of object, right?
Is the syntax above right? I didn’t get this difference between pattern track object and track object.
Thanks for help
You are creating a reference to “live” userdata (C+object), but not a new instance.
You can’t create new instances of these objects that are not tied to the song, somehow.
So, your code might do the mistake of assuming that the source pattern is still around when it’s time to copy to the target.
But, at this time the source pattern might actually be gone, or have changed somehow.
If you need to copy an entire pattern, I would recommend using a temp pattern to hold the results - so, that temp pattern essentially becomes the “buffer”
Is it possible to get the xml data from a track node, like tracks[num].to_xml() ?
If 1. is just a reference, can I duplicate the object using a standard lua recursive duplication function for objects? This would I guess only work if there were magic methods defined for each kind of object, right?
XML support in the API would be very nice to see. But right now, answer would be no
PS: If you are planning to do recursive copies of tables, don’t forget the ‘extended’ table.rcopy method - it’s part in the Renoise API, but not standard Lua…
Yes, .toXML() would be a dream wouldn’t? As far as I understand, your simply could then copy any content to a variable and later insert the xml to the renoise xml song data…?
And a .revertToObject() of course
One problem do I have now:
I want to make a pattern copy-paste functionality / shortcuts that takes care of track names and also works for two Renoise app instances…
Like I have opened a song in an older version in Renoise A, and a newer version of the song in Renoise B. The newer song has some additional tracks, but the naming of the old tracks is identical with the naming in the old song version.
So I would like to copy each track data (including commands + automation) to a table with track name keys and then somehow then… convert to xml ?
I think this idea won’t work by using lua for cross-instance-copying, since
.copy_from() only works with a track object instance in the same app
No way to transfer custom copy-buffer data?
Any ideas here?
Wouldn’t it be cool to have to more shortcuts" Pattern Editor:Pattern Operations:Copy by track names" and" Pattern Editor:Pattern Operations:Paste by track names" that would work cross-app-instance? I would set those to super-ctrl-F4 and super-ctrl-F5 then…
no, songs would be almost identical, assuming that identical named tracks would be have identical devices. (btw i think copy paste patterns, internally the automation is already copied by device name, not by device position). Currently if copy-paste pattern, it will simply paste the tracks contents in the order of the source song. So if a new track was inserted later, the pasting doesn’t fit anymore. I would like this by track name…
…or the internal copy-paste-pattern function of Renoise should be improved that it takes care of source and target track names, instead just positions. This would not change anything while copying within one song, but improve transferring between songs! If track names/ids not match = no copying.
But I won’t write a feature request. Seems not make sense.