Make your own free website on Tripod.com
Home
Tutorial
Gallary
Molpharm
Author : sushil Ronghe
Education :M.S. Pharmacoinformatics

Pre-Requisite - You should be a medium to high level blender user,as well as has some experience with python

For whom - Those who want to programm the Blender.Ipo

Claim : After reading this tutorial you will be able to create a complex animation in complex environment where it is impossible to draw the curves (curve fallow) or set the keys for object or bones

Aim : Makeing blender worlds most popular software in this field


<>If you are really looking for ,How to use Blender.Ipo,you have reached a write place.<> Background :I did not find a tutorial on this topic.This is very good place to start the basic of python scripting in blender as well as become a good script writer.I was looking for Ipo stuff?, did not got any relevant hit so started playing with the objects by studying the documentation (the best way to learn blender python). I hope you will like this effort. I like to do every thing in blender from my INDRA Weapon 'Python'.Another explaination is we need to concentrate less on the screen so saving the life of our eyes.Lesser work for blender,as a result saving electricity Another thing i will like to inform you this is not basic tutorial for scripting in blender.I have written this tutorial only for animating the object with script,and give a brief idea for using IPO in your scripts.You can start any way


Playing with Action


I hope you know enough about this kind of programming and a basics of blender as well as you have installed the latest version of blender and python scripts are working fine on your Work station

Ipo (Interpolation)

first thing you have to believe is ,curve is not exactly curve it is a set of lines drawn or approximated to look like a curve. As the 3D world in computer is not 3D ,because the screen is flat.These are some of the intrested thing i learn during OpenGL days of mine. So coming back to curve there are number of ways to approximate the curve some of these methods are very famous like

  • Spline
  • Bezier
  • NurbS
  • Hermite

  • You can get a complete book on mathematics involved in geometric modelling if you search on google,that much knowledge is not essential.but recently i have come across a good quote,"There's a huge difference between what a skilled artist and someone poking at buttons and using presets can accomplish."If you need any help in this regard ,go google.Ok so let's Start

    What is Object?

    Object is instance of the datatype,that can be built in or created by the programmer. Blender has so many objects,But the programmers who were involve in blender design were intelligent enough to understand the need to create a module called Object. Blender documentation has a good explaination of these Object. Blender.Object in python is associated with a ipo object,every ipo is associated with number of ipocurves of different type. Some of the times i find the word channels for these curve types

    Blender ---> Object---> Ipo --->IpoCurve

    Getting familier!! open up Blender and "AKEY" "XKEY" "Enter" now add one cube named it as a Rony. switch from model to animation window.Look at the ipo window all those names arrenge in a column are the ipocurves. LMB on LocX and add 5 key at frame (CTRL-LMB) 1 , 5 , 10 ,15 , 20 at values 0.0, 2.0 , 4.0 , 6.0 , 8.0, What is your intension ronghester ?? I just want to move rony on x-axis.Now Alt -A and you will see the animation is going On. Now we will first talk with blender to get familiar with this IPO

    <--!script-->

    import Object from Blender   # hi buddy can you come out side for a while
    rony = Object.Get('Rony')     #I want to discuss,something very serious about,Rony,
    action = rony.getIpo()       #If you can see his activity.
    posX = action.getCurve('LocX')   #he is moving along the X-Axis whole day
    for i in range(0,21,5):
    print posX[i]      # These are the places Rony visited last time.

    Run the script,what happend,you got the numbers back you supplied ! now change the for loop range function to look like this range(0,21,1) run the script you will get the numbers which we have never supplied to blender,this is the approximation.<>Here is the short explaination,when we input the number at particular time these are consider as a control points ande it get approximated to form the curve <>. Now after for loop put this line

    posX[25] = 0.0 # Please bring rony back to home


    this means we have set one more control point for the curve posX which represent the location X of rony. the index 25 means at the "25 th frame" .Now see the ipo editor you will be surprised to see the curve is extended to the point we have specified. Now "ALT A" the animation will extend upto 25 frame.You must have to understand what you have done,because this is the power of blender. Let's discuss,

  • we have asked for particular Object (you must know the name of the thing you want).
  • Taken up the Ipo of this object
  • Taken up the Ipo curve of this Ipo object
  • And asked for control points

  • It is intresting to note that the curve has [] operator,we can't imagine how much imagination the programmers has put into this software during development .In this case we have taken up a curve from blender means backward way,now we will go forward way (Means we will create a curve and then set it in blender. Once you have finished with this you are ready to make a very complex animation in very complex world. Be brave! again select all and delete add a new cube named it Rony. And understand the fallowing script,put it in blender and run,,,Viola

    <--!script-->

    import Object from Blender
    rony = Object.Get('Rony')
    # I want to discuss something very serious about Rony
    action = Ipo.New('Object','cometoschool') # Make a Move for ROny
    action.addCurve('LocX') # The move will involve the X and Y axiz
    action.addCurve('LocY')
    posX = action.getCurve('LocX') # get the move on XAxis
    posY = action.getCurve('LocY') # get the move on YAxis
    counter = -1;
    value = 1;
    for i in range(0,21,5): # set the values for each time frame along X
    posX[i] = i*0.2;
    value = counter*2*i*value;
    posY[i] = value;
    #same for Y
    rony.setIpo(action) # i have set the path for rony,now he #will go to school and not in BAR

    We have created the 2D spiral animation for our hero Rony,entirely by script,see the ipo editor the curves are there.Here onwards use such script to animate the objects,once you get into this business you will find this very usefull,and owe me a beer in a blender WC! .If you think this,can be done without scripting You are correct,but you are denying to accept the power blender wants to give you,as well as not respecting the efforts blender developer has made. # :~
    Here onwards we will see how to use Blender.ipo for creating something meaningful.


    Spinning


    Spinning means rotating about itself,like fan also the wheel can be animated with Spinning.Example the fan of helicoptor.Here is helicoptor 'Eagle' we have to animate the fan as it moves in general. first let's consider Eagle is made up of 2 object

  • Fan
  • Body

  • do fallowing step by step,
  • step 1: Ask blender for fan reference
  • step 2: Create an Ipo For Curve "RotZ" if Z is Up
  • step 3:add the angles and time frame as per ur convenience and need
  • step 4:set this Ipo for Fan

  • Infact one can make a function,which will take up the argument for Object,Upaxis,angle,and frame . when ever you have to apply spining for a object,just run your function with the arguments that suit best for the underling condition.Here is one such function.

    <--!script-->

    import Object from Blender
    def Spin(ObjName = 'Cube',axiz='RotZ',angle = 10,frame=6):
    Rony = Object.Get('ObjName')
    #
    # Blender give me this Object we have some thing serious to work here
    #
    Spin = Ipo.New('Object','spin')
    #
    # Create an Ipo of the type object and name "spin"
    #
    Spin.add('RotZ') # add the IpoCurve 'RotZ'
    ZZ = Spin.getCurve('RotZ') # get it back
    for i in range(1,6,1):
    ZZ[i] = i*360/angle
    ZZ.setExtrapolation(Extrapolation)
    Rony.setIpo(spin)



    if __name__=='__main__':
    Spin('Fan')

    Let's animate the Circular Motion, You must have learned this in you physics class, When i discovered the beauty of IPO in Blender python i thought for what kind of animation i can use this? Very first thing came to my mind is circular motion, we all know electron is revolving round the nucleus what if electron become lazy and nomore want to revolve it will slowly get into the center of atom,let's animate this!.i will include the script for this ipo menace for other software in the world.The script can take up object provided with axis ,and angle as well as number of frame etc.One can use this script for many purpose,

    <--!script-->

    import Object from Blender
    def Eagal(ObjName = 'Cube',axis1='LocX',axis2='LocY',radius = 10,angle=30,frameElapsed =3 ):
    Rony = Object.Get('ObjName')
    #
    # Blender give me this Object we have some thing serious to work here
    #
    Eagle = Ipo.New('Object','eagle')
    #
    # Create an Ipo of the type object and name "spin"
    #
    Spin.add(axis1) # add the IpoCurve 'axis1'
    Spin.add(axis2) # add the IpoCurve 'axis2'
    XX = Spin.getCurve(axis1) # get it back
    YY = Spin.getCurve(axis2) # get it back
    counter =1;
    for j in range(radius,0,-1):
    for i in range(0,360/angle,1):
    XX[counter] = j*cos(i*360/angle)
    YY[counter] = j*sin(i*360/angle)
    counter = counter+frameElapsed
    Rony.setIpo(eagle)



    if __name__=='__main__':
    Eagle('Fan')

    Now i think one can undetstand the script easily.it is only for the 2 axis,but it can easily be extended for Z axis,i will like to give this as a assignment to you.<>One more intresting thing you can create a butterfly by using this script.<> The ipo curves will look like this intresting and it is created in just a second,if you do not include the typing time in this. this shows the object is coming spiraly towards the origin and then going back to his home by using the same path. Now can you draw this curves by hand?.if you run the script and develop such graphs by your own then you can see this is amazing! the figure first of for the "movingIn.py" and "two for movingInandOut.py"

    <--!script-->

    import Object from Blender
    def Eagal(ObjName = 'Cube',axis1='LocX',axis2='LocY',radius = 10,angle=30,frameElapsed =3 ):
    Rony = Object.Get('ObjName')
    #
    # Blender give me this Object we have some thing serious to work here
    #
    Eagle = Ipo.New('Object','eagle')
    #
    # Create an Ipo of the type object and name "spin"
    #
    Spin.add(axis1) # add the IpoCurve 'axis1'
    Spin.add(axis2) # add the IpoCurve 'axis2'
    XX = Spin.getCurve(axis1) # get it back
    YY = Spin.getCurve(axis2) # get it back
    counter =1;
    for j in range(radius,0,-1):
    for i in range(0,360/angle,1):
    XX[counter] = j*cos(i*360/angle)
    YY[counter] = j*sin(i*360/angle)
    counter = counter+frameElapsed
    for j in range(0,radius+1,1):
    for i in range(360/angle,-1,-1):
    XX[counter] = j*cos(i*360/angle)
    YY[counter] = j*sin(i*360/angle)
    counter = counter+frameElapsed
    Rony.setIpo(eagle)



    if __name__=='__main__':
    Eagle('Fan')


    moveIn.py


    moveInandOut.py


    End Note


    Ref :
  • jmsoler
  • Blender.Ipo

  • Comments and critics are highly appriciated,I will also include the scripts for making an actions like walk, jump,kick and all those body movements human know,But everything in world requires time, as i have this template ready i don't think it will require most effort let's see. Happy Blendering

    Page Up