Animations - Creating a Curve2IPO wizard

Re: Animations - Creating a Curve2IPO wizard

Postby teedyo » Tue Jul 08, 2008 2:11 pm

NameError: name 'myIpoCurve' is not defined


You need to define myIpoCurve to let it know that is to be a list. Just before your loop, add the line:

myIpoCurve = []

Note that I know squat about python and I'm assuming from your code that myIpoCurve is intended to be a list of BezTriples.
teedyo
 
Posts: 212
Joined: Tue Oct 09, 2007 5:47 pm

Re: Animations - Creating a Curve2IPO wizard

Postby Grogyan » Thu Jul 10, 2008 9:29 pm

Nope, thanks for the thought
I have this without declaring it a list
Code: Select all
   myIPOCurveX = ((H1_X, 0, 0, P_X, 0, 0, H2_X, 0, 0)) # currently redundant
   myIPOCurveY = ((0, H1_Y, 0, 0, P_Y, 0, 0, H2_Y, 0)) # currently redundant
   myIPOCurveZ = ((0, 0, H1_Z, 0, 0, P_Z, 0, 0, H2_Z)) # currently redundant


But after days of scouring I found it, hidden in an obscure piece of documentation
Code: Select all
def setBeztriple(curvepos,pointpos,newbeztriple):
 """
 Sets the beztriple of the Ipo (B{deprecated}). B{Note}: use
 L{IpoCurve.bezierPoints<IpoCurve.IpoCurve.bezierPoints>} to get a
 BezTriple point, then use the
 L{BezTriple} API to set the point's attributes.
 @type curvepos: int
 @param curvepos: the position of the curve in the Ipo.
 @type pointpos: int
 @param pointpos: the position of the point in the curve.
 @type newbeztriple: list of 9 floats
 @param newbeztriple: the new value for the point
 @rtype: None
 @return: None
 """


Its one of those areas that you always skip over because ots either no longer maintained or is due to be removed entirely

Yet it leaves me with another problem, deciphering
L{IpoCurve.bezierPoints<IpoCurve.IpoCurve.bezierPoints>} to get a
BezTriple point, then use the
L{BezTriple} API to set the point's attributes


to work with my needs
Better to have loved and lost than never to have loved at all
User avatar
Grogyan
 
Posts: 1203
Joined: Thu Oct 11, 2007 1:27 am

Re: Animations - Creating a Curve2IPO wizard

Postby Grogyan » Fri Jul 11, 2008 10:45 pm

Well the code still does the same thing and I still cannot apply the example in the documentation.

So while this script does indeed create a set of ipo curves, the only way to see how close an object follows it is to make all the handles AUTO.
Nor is there any rotation of the object in any axis

I'm going to upload the .blend file into the first post in hopes that someone can help me.

or

Upload it to the subversion repository

Have to Ask Nadnerb or Lontahv if I can do this


Oh and if anyone can help, please do, my head is hurting, after reading about bezier curves and b-splines over the past week as well as making sense of the Blender API
Better to have loved and lost than never to have loved at all
User avatar
Grogyan
 
Posts: 1203
Joined: Thu Oct 11, 2007 1:27 am

Re: Animations - Creating a Curve2IPO wizard

Postby Lontahv » Fri Jul 11, 2008 11:44 pm

The subversion repository... is this very separate from PyPrp (I mean, do you want this to be distributed with PyPrp). I think keeping PyPrp slim and then having add-ons would be great. And, couldn't your tool help non-age-writers as well?

I think your best bet is having your own host (you could get a free hosting service--google-pages is good).

Then what you can do is add your tool to many wikis when you feel like it (say, blender-plugin list). But for now, until most of the bugs are swashed I think It's best to keep it in the GoW. You can just have a tutorial entry with a link on the GoW. 8-)
Currently getting some ink on my hands over at the Guild Of Ink-Makers (PyPRP2).
User avatar
Lontahv
Councilor of Artistic Direction
 
Posts: 1331
Joined: Wed Oct 03, 2007 2:09 pm

Re: Animations - Creating a Curve2IPO wizard

Postby Grogyan » Sat Jul 12, 2008 12:43 am

Ok
is this very separate from PyPrp

Yes and no. My reason for doing this is for the GoW because that functionality doesn't exist in that way in Blender

And, couldn't your tool help non-age-writers as well?

Yeah it will help with virtually every way to do animation in Blender requiring path following, including possibly using it in a couple of robotics projects I have lined up

So you might be onto something by just having a link on the wiki about it and store a version on the Blender plugin repository

But also realise this, if I do that then I probably wont be able to finish it as i'm not entirely sure I can even do it entirely on my own, and its getting to the point where i'll need to do some fancy algorithms that are beyond me
Better to have loved and lost than never to have loved at all
User avatar
Grogyan
 
Posts: 1203
Joined: Thu Oct 11, 2007 1:27 am

Re: Animations - Creating a Curve2IPO wizard

Postby Lontahv » Sat Jul 12, 2008 2:26 am

Ah, I see.

SVN's are a great way to have others help on it. You could PM Zrax about setting up a new folder in the SVN for your project. It could be: http://svn.guildofwriters.com/Curve2IPO/

:)
Currently getting some ink on my hands over at the Guild Of Ink-Makers (PyPRP2).
User avatar
Lontahv
Councilor of Artistic Direction
 
Posts: 1331
Joined: Wed Oct 03, 2007 2:09 pm

Re: Animations - Creating a Curve2IPO wizard

Postby Grogyan » Sat Jul 12, 2008 2:58 am

Ok, cool, so Zrax is the one I need to talk to then

Thanks much Lontahv, pal

In the mean time i've done
- fixed a few bugs
- added a couple of checks in
- adding code in place for continuous curves

Still stymied for applying the bezier handle data
Better to have loved and lost than never to have loved at all
User avatar
Grogyan
 
Posts: 1203
Joined: Thu Oct 11, 2007 1:27 am

Re: Animations - Creating a Curve2IPO wizard

Postby Jojon » Sat Jul 12, 2008 3:13 am

Just a random thought: maybe using a birail approach would be intuitive (in some ways, clumsy in others), for the banking thing.
Jojon
 
Posts: 1116
Joined: Sun Sep 30, 2007 5:49 am

Re: Animations - Creating a Curve2IPO wizard

Postby Lontahv » Sat Jul 12, 2008 3:32 am

Ok, here's the way that PyPrp reads the handle info:

Code: Select all
           
            # We need to get the list of BezCurves
            # Then get the value for each and create a matrix
            # Then store that in a frame and store than in the list
            xcurve = ipo[Ipo.MA_OFSX].bezierPoints
            for frm in range(len(xcurve)):
                frame = prp_AnimClasses.hsMatrix44Key()
                num = xcurve[frm].pt[0] - 1
                frame.fFrameNum = int(num)
                frame.fFrameTime = num/30.0

                matx = hsMatrix44()
                matx.translate((xcurve[frm].pt[1], ipo[Ipo.MA_OFSY].bezierPoints[frm].pt[1], ipo[Ipo.MA_OFSZ].bezierPoints[frm].pt[1]))

                frame.fValue = matx
                KeyList.append(frame)


Ok, now I think I remember someone saying something about getting the various handle points from the index. We just used the central point. I'm really not sure about this but you should play with the index-num.

Try something like:

Code: Select all
xcurve = ipo[Blender.Ipo.OB_LOCX].bezierPoints

handle_1 = xcurve[frame_num].pt[0]
middle = xcurve[frame_num].pt[1]
handle_2 = xcurve[frame_num].pt[2]



And of course I'm sure you know how to feed data now that you know how to read it (I really hope I have that right with the code).

That code won't run but in some combination with:

Code: Select all
   # Here set the current frame
   # myIpo = myCurveIPO.__setitem__ (myCurrentPathLen, nCurvePoints)
   # Here Append current frame with BezTriple nCurvePoints
   # myIPOCurves = myIPOCurveSet.IpoCurve.
   # myIPOCurves = myIPOCurveSet.__setitem__(myCurrentPathLen, nCurvePoints)
   #myIPOCurves = Blender.Ipo.addCurve([Blender.Ipo.OB_LOCX])  # retrieves an Ipo object
   #ipo.name = 'ipo1'                              # change the Ipo's name
   #icu = ipo[Blender.Ipo.OB_LOCX] # request X Location Ipo curve object
   #if icu != None and len(icu.bezierPoints) > 0: # if curve exists and has BezTriple points
   #   val = icu[2.5]              # get the curve's value at time 2.5


That part of your code it should work well.
Currently getting some ink on my hands over at the Guild Of Ink-Makers (PyPRP2).
User avatar
Lontahv
Councilor of Artistic Direction
 
Posts: 1331
Joined: Wed Oct 03, 2007 2:09 pm

Re: Animations - Creating a Curve2IPO wizard

Postby Grogyan » Mon Jul 14, 2008 12:36 am

Zrax was kind enough to allow this project to be part of a seperate thread on subversion here at the Guild of Writers
http://svn.guildofwriters.com/Curve2IPO/Trunk

Anyone is welcome to help finish it, just ask Zrax for an account


Well Lontahv, i've managed to add the bezierPoints postfix on something that the compiler won't complain about, but it aslo removes the Ipo from the graph

I'll load up what I have into a folder called contrib on that svn thread before I head to bed.

The example didn't work, probably my fault somewhere :D
Also my thoughts of what, could work, failed also

On some upside, i'll be moving into my new role at work probably tomorrow as an electronics technician


Doh, I nearly forgot, need to remind the RAD contestants that they only have 1 week left of build time, and another pm to the judges on something ;)@Lontahv
Better to have loved and lost than never to have loved at all
User avatar
Grogyan
 
Posts: 1203
Joined: Thu Oct 11, 2007 1:27 am

PreviousNext

Return to Grogyan's Journal

Who is online

Users browsing this forum: No registered users and 0 guests