Very cool! So amazing to see this in Softimage! :) Regards, Simon
On 3 May 2012 09:55, Ahmidou Lyazidi <ahmidou....@gmail.com> wrote: > Hi Jo, and thanks for the snipet! > I already have a structure not that far, but my problem is elsewhere. The > fcurves's tangents interpretation in 3d is not a simple mapping of the X,Y > values. > I also had to deal with fcurves that don't have necessary three keys a the > same time but only one or two, so I don't have all the information to draw > the tangents as they should be. > But I think I'm near the solution, I just have to restructure some part of > my code to make it more efficient and test :) > > Best regards > A. > > 2012/4/30 jo benayoun <jobenay...@gmail.com> > >> Hi Ahmidou, >> looks quite nice ! :) >> >> For your problem, I would go in c by reproducing a kinda structure that >> mimic FCurves ones like the following. >> >> """ >> struct bezfragments { >> double cps[4][3]; >> uint_t interp; >> }; >> >> struct motionpath { >> constchar_t *source; >> ushort_t color[3]; >> uint_t flags; >> uint_t nbezfragments; >> struct bezfragments *[1]; >> }; >> """ >> >> A MotionPath as a FCurve is a fixed length array of bezier curves with >> some extra informations like the object which is the source, the color of >> the path and some other flags for ui convenience (selection mode, ...). >> You have the choice to represent your bezier segments by pairing control >> points by 3 or by 4, I dont think it makes a huge difference. >> This system coupled with a "MotionPathManager" will avoid you to have to >> query the softimage API each time you need to redraw your viewport as your >> datas are cached in memory. >> Also, by subscripting to any event like "siOnValueChange", you will be >> able to rebuild a motion path targeting just what you need. Also a good >> point for perfs. >> Anyways .... Here is a little pysnippet (I dont have the possibility to >> write it in C right now) ! It should I hope answer to your first question ! >> :) >> >> jo >> >> >> """ >> # Im quite sure gmail will eat my indent efforts so take care about that ! >> # Each key for each params must have a buddy on the others axes. >> # Create a cube, animate its pos's being sure a key is set at the same >> frame for the three axes. >> # >> >> import random >> >> >> class BezFragment(object): >> cpoints = tuple() >> interp = int() >> >> class MotionPath(object): >> source = str() >> color = tuple() >> bezfragments = tuple() >> >> >> def build_axis_data(param): >> keys = tuple(param.Source.Keys) >> res = list() >> bfrag = None >> i = 0 >> >> while i < (len(keys)-1): >> cp = list() >> >> key = keys[i] >> nextkey = keys[i+1] >> cp.append(round(key.Value, 1)) >> cp.append(round(key.Time, 1)) >> cp.append(round(key.Value + key.LeftTanX, 1)) >> cp.append(round(key.Time + key.LeftTanY, 1)) >> cp.append(round(nextkey.Value - key.RightTanY, 1)) >> cp.append(round(nextkey.Time - key.RightTanX, 1)) >> cp.append(round(nextkey.Value, 1)) >> cp.append(round(nextkey.Time, 1)) >> >> bfrag = BezFragment() >> res.append(bfrag) >> bfrag.interp = key.Interpolation >> bfrag.cpoints = tuple(cp) >> >> i += 1 >> >> return tuple(res) >> >> >> def build_motion_path(siobj): >> x = build_axis_data(siobj.Kinematics.Local.posx) >> y = build_axis_data(siobj.Kinematics.Local.posy) >> z = build_axis_data(siobj.Kinematics.Local.posz) >> >> mp = MotionPath() >> mp.source = siobj.FullName >> mp.color = (random.randint(120, 255), random.randint(120, 255), >> random.randint(120, 255), >> ) >> mp.bezfragments = tuple(zip(x, y, z)) >> return mp >> >> >> def log_bezfragment(bfrag): >> msg = "{0}:({1}, {2})---o ({3}, {4}) ({5}, {6})o---({7}, {8})\n" \ >> " \______________________________________/" >> print msg.format("", *bfrag.cpoints) >> return None >> >> >> def log_obj_motionpath(): >> for obj in Application.Selection: >> mp = build_motion_path(obj) >> >> print "source: {0}".format(mp.source) >> print "mp-color: {0}".format(mp.color) >> for bezf in mp.bezfragments: >> print "\ncp" >> for xyz in bezf: >> log_bezfragment(xyz) >> return None >> >> >> log_obj_motionpath() >> >> """ >> >> >> >> >> >> >> >> >> >> >> >> >> 2012/4/30 Ahmidou Lyazidi <ahmidou....@gmail.com> >> >>> I think I got it :) >>> >>> >>> 2012/4/30 Halim Negadi <hneg...@gmail.com> >>> >>>> Looks awesome Ahmidou, can't wait to play with it. >>>> Cheers, >>>> H. >>>> >>>> >>>> On Mon, Apr 30, 2012 at 4:44 PM, Ahmidou Lyazidi <ahmidou....@gmail.com >>>> > wrote: >>>> >>>>> Well, as soon as I have resolved the tangent handle stuff :) I'm sure >>>>> it's simple, but I can't get it... >>>>> >>>>> >>>>> 2012/4/30 Philip Melancon <philip.melan...@modusfx.com> >>>>> >>>>>> This is looking amazing, do you have an idea of when/how you plan to >>>>>> release this nice little piece of animation goodness? I know that the >>>>>> animators I work with would kill for something like this! >>>>>> >>>>>> Philip Melancon >>>>>> Lead Crowd TD >>>>>> Modus FX >>>>>> >>>>>> >>>>>> On 4/30/2012 10:30 AM, Xavier Lapointe wrote: >>>>>> >>>>>> Whoa, this is awesome. >>>>>> >>>>>> I feel some animators out there are probably jubilating right now >>>>>> :) >>>>>> >>>>>> No virus found in this message. >>>>>> Checked by AVG - www.avg.com >>>>>> Version: 2012.0.1913 / Virus Database: 2411/4969 - Release Date: >>>>>> 04/30/12 >>>>>> >>>>>> >>>>> >>>>> >>>>> -- >>>>> Ahmidou Lyazidi >>>>> Director | TD | CG artist >>>>> http://vimeo.com/ahmidou/videos >>>>> >>>>> >>>> >>> >>> >>> -- >>> Ahmidou Lyazidi >>> Director | TD | CG artist >>> http://vimeo.com/ahmidou/videos >>> >>> >> > > > -- > Ahmidou Lyazidi > Director | TD | CG artist > http://vimeo.com/ahmidou/videos > >