Frame Range to sequence

 04 April 2012 JokerMartini Expert   portfolio John Martini CG Supervisor, 3D, Maxscript, VFX Ingenuity Engine Los Angeles, USA Frame Range to sequence Is there an easy way to turn a given input sequence to an array of numbers. Same way max's render frame range is handled in the edittext. --user input --"30,36,22 - 20,-3 - 2" --result wanted -- #(-3,-2-1,0,1,2,20,21,22,30,36) __________________ ____________ ___ __ _ John A. Martini JokerMartini@hotmail.com www.JokerMartini.com share quote
 04 April 2012 JokerMartini Expert   portfolio John Martini CG Supervisor, 3D, Maxscript, VFX Ingenuity Engine Los Angeles, USA Seems like having those negative values really makes things confusing. __________________ ____________ ___ __ _ John A. Martini JokerMartini@hotmail.com www.JokerMartini.com share quote
 04 April 2012 Bobo Krakatoa Guy   Borislav Petrov Product Specialist Thinkbox Software Vancouver, Canada Originally Posted by JokerMartini: Seems like having those negative values really makes things confusing. May I ask what you are trying to do? EDIT: Here is a possible solution for YOUR specific syntax (where the delimiter is " - " and not "-"): ``````fn getFramesArrayFromString theString = ( theString = filterString (substituteString theString " - " "..") "," theFrames = for i in theString where not matchPattern i pattern:"*..*" collect i as integer for i in theString where matchPattern i pattern:"*..*" do ( local thePair = (for j in filterString i "." collect j as integer) local theStep = if thePair[1] > thePair[2] then -1 else 1 for k = thePair[1] to thePair[2] by theStep do appendIfUnique theFrames k ) sort theFrames ) getFramesArrayFromString "30,36,22 - 20,-3 - 2" --> #(-3, -2, -1, 0, 1, 2, 20, 21, 22, 30, 36)`````` __________________ Bobo Last edited by Bobo : 04 April 2012 at 02:27 AM. share quote
 04 April 2012 JokerMartini Expert   portfolio John Martini CG Supervisor, 3D, Maxscript, VFX Ingenuity Engine Los Angeles, USA I'm making an attribute holder with a multilistview that contains (these time intervalsl created by the user) inwhich controls the birth frames of a particle system. The list view has an input field for the user to insert frame ranges or individual frames. Check out that attached file. It's just the attribute side of it right now. __________________ ____________ ___ __ _ John A. Martini JokerMartini@hotmail.com www.JokerMartini.com Last edited by JokerMartini : 04 April 2012 at 04:12 PM. share quote
 04 April 2012 Bobo Krakatoa Guy   Borislav Petrov Product Specialist Thinkbox Software Vancouver, Canada Originally Posted by JokerMartini: The list view has an input field for the user to insert frame ranges or individual frames. In that case, the code I posted won't do in its current form - you will need to expand it to perform a significant amount of sanity checks, ensuring the user is not entering garbage... __________________ Bobo share quote
 04 April 2012 JokerMartini Expert   portfolio John Martini CG Supervisor, 3D, Maxscript, VFX Ingenuity Engine Los Angeles, USA I've wrote up so functions that check for that. It seems like it will work great for this. Thanks for you help Bobo. __________________ ____________ ___ __ _ John A. Martini JokerMartini@hotmail.com www.JokerMartini.com share quote
 04 April 2012 CGTalk Moderation Expert Thread automatically closed This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum. __________________ CGTalk Policy/Legalities Note that as CGTalk Members, you agree to the terms and conditions of using this website. share quote

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts vB code is On Smilies are On [IMG] code is On HTML code is Off CGSociety Society of Digital Artists www.cgsociety.org Powered by vBulletinCopyright ©2000 - 2006, Jelsoft Enterprises Ltd.