Hi Nathan, I appreciate the dedication. It's a pet project, so the long pauses are OK, and the fact you go back to this at all is great.
I'll give your other suggestion a try, though I would love to know why it failed me using RegEx. I forwarded you the scripts in another email. Thanks again, Ron Ganbar email: [email protected] tel: +44 (0)7968 007 309 [UK] +972 (0)54 255 9765 [Israel] url: http://ronganbar.wordpress.com/ On 25 June 2012 20:01, Nathan Rusch <[email protected]> wrote: > I would still caution that even though it is often *possible* to use > regexps for text parsing, it isn’t necessarily the simplest or best idea > from either a performance or organizational standpoint. In this case, your > script would almost certainly end up being faster and more concise without > them. > > All that being said, I’ll try to give it another look sometime soon, at > least to figure out what’s going on (my suspicion is something to do with > line-endings), and to help show regexps in action. > > One problem is I deleted the original email, and for whatever reason this > thread didn’t make it to the forums, so would you mind re-sending your > attachments, either to the list or directly to me? > > Thanks, > > -Nathan > > > *From:* Ron Ganbar <[email protected]> > *Sent:* Tuesday, June 19, 2012 12:28 AM > *To:* Nuke Python discussion <[email protected]> > *Subject:* Re: [Nuke-python] AE Transform to Nuke > > Hi Nathan, > thanks a lot for having a look at this. > > The weird thing is that the code I have works perfectly when reading the > text from a text file, just not when reading from paste. Really annoying to > start and write it again from scratch. Plus, I would love to have learned > from this script something useful about re. > Any chance you can have another look? > > Thanks, > Ron Ganbar > email: [email protected] > tel: +44 (0)7968 007 309 [UK] > +972 (0)54 255 9765 [Israel] > url: http://ronganbar.wordpress.com/ > > > > On 19 June 2012 07:32, Nathan Rusch <[email protected]> wrote: > >> Hey Ron, >> >> I finally got a minute to take a look at your code, and I think it’s >> pretty clear that the regular expressions are simply failing to match >> meaningful pieces of the incoming data. However, having done AE keyframe >> parsing myself in the past (for corner-pinning), I think you may be >> overcomplicating the situation a little. I would suggest switching to >> simple per-line tokenization based on simple whitespace splitting (which >> Python makes ridiculously easy), with logic similar to this: >> >> 1) Break your raw data into lines (with rawdata.splitlines()) >> 2) Find all 'Transform *' header indices in your line list >> 3) Starting at each header index + 1 extra line (to account for column >> headers), loop until you hit the next header index (or blank line). >> 4) At each line, simply use line.split() to tokenize it into strings >> representing each column, cast each to an appropriate value, and add it to >> a list of keyframes. >> 5) For the header, you know it will be all lines up to the first >> meaningful keyframe block, and it’s easy enough to do the same and parse >> each line based on its text. I would just grab those values first and use >> them to do on-the-fly image space conversion for things like position. >> >> Also, depending on how many different types of keyframes you want to >> paste in, you may want to consider a simple hierarchy of functions (or even >> classes) for parsing different types of keyframe blocks (Position, >> Rotation, Scale, ...), and maybe even creating the different types of nodes >> in-line. They will all use the same basic technique for extracting raw >> data, but then each would be able to handle it slightly differently. >> >> Anyway, hope this makes sense. >> >> -Nathan >> >> >> *From:* Ron Ganbar <[email protected]> >> *Sent:* Friday, June 01, 2012 5:17 AM >> *To:* Nuke Python discussion <[email protected]> >> *Subject:* [Nuke-python] AE Transform to Nuke >> >> Hi all, >> so I've been trying to write this AE Transform to Nuke Transform parser >> where you simply copy keyframes in After Effects and paste them into Nuke >> and you get a Transform. >> I got it to work too after a lot of help from the forum - thanks everyone! >> But when I collected it into a function and created a callback for it, it >> broke, and I don't know why. It's been doing my head in for the past three >> weeks and I can't figure out why! >> >> I was hoping someone would take a look at it. >> >> I'm attaching two files: >> AE_to_Nuke.txt is a copy of a few keyframes from After Effects. This is >> what you should copy then paste in the DAG to test the function. >> AE_to_Nuke.py is the function I wrote, including the callback at the >> bottom. >> >> Any help would be greatly appreciated. >> >> Thanks, >> Ron Ganbar >> email: [email protected] >> tel: +44 (0)7968 007 309 [UK] >> +972 (0)54 255 9765 [Israel] >> url: http://ronganbar.wordpress.com/ >> >> ------------------------------ >> _______________________________________________ >> Nuke-python mailing list >> [email protected], http://forums.thefoundry.co.uk/ >> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python >> >> _______________________________________________ >> Nuke-python mailing list >> [email protected], http://forums.thefoundry.co.uk/ >> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python >> >> > > ------------------------------ > _______________________________________________ > Nuke-python mailing list > [email protected], http://forums.thefoundry.co.uk/ > http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python > > > _______________________________________________ > Nuke-python mailing list > [email protected], http://forums.thefoundry.co.uk/ > http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python > >
_______________________________________________ Nuke-python mailing list [email protected], http://forums.thefoundry.co.uk/ http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
