Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

BL_BlenderIPO.cpp

Go to the documentation of this file.
00001 extern "C" void calc_ipo(struct Ipo *ipo, float ctime);
00002 extern "C" void execute_ipo(struct ID *id, Ipo *ipo);
00003 
00004 //extern "C" struct Material* give_current_material(struct Object* ob,int active);
00005 //extern "C" void  where_is_object_time(struct Object* ob,float ctime);
00006 
00007 #include "BL_BlenderIPO.h"
00008 
00009 #include "blender.h"
00010 #include "ipo.h"
00011 #include "ipo_extern.h"
00012 
00013 
00014 static const int BL_MAX_CHANNELS = 32;
00015 
00016 float BL_ScalarInterpolator::GetValue(float currentTime) const {
00017         return IPO_GetFloatValue(m_blender_ipo, m_channel, currentTime);
00018 }
00019 
00020 
00021 BL_InterpolatorList::BL_InterpolatorList(struct Ipo *ipo) {
00022         IPO_Channel channels[BL_MAX_CHANNELS];
00023 
00024         int num_channels = IPO_GetChannels(ipo, channels);
00025 
00026         int i;
00027 
00028         for (i = 0; i != num_channels; ++i) {
00029                 BL_ScalarInterpolator *new_ipo =
00030                         new BL_ScalarInterpolator(ipo, channels[i]); 
00031 
00032                 //assert(new_ipo);
00033                 push_back(new_ipo);
00034         }
00035 }
00036 
00037 BL_InterpolatorList::~BL_InterpolatorList() {
00038         BL_InterpolatorList::iterator i;
00039         for (i = begin(); !(i == end()); ++i) {
00040                 delete *i;
00041         }
00042 }
00043 
00044 
00045 KX_IScalarInterpolator *BL_InterpolatorList::GetScalarInterpolator(BL_IpoChannel channel) {
00046         BL_InterpolatorList::iterator i = begin();
00047         while (!(i == end()) && 
00048                    (static_cast<BL_ScalarInterpolator *>(*i))->GetChannel() != 
00049                    channel) {
00050                 ++i;
00051         }
00052         
00053         return (i == end()) ? 0 : *i;
00054 }       
00055 
00056 
00057 
00058 
00059 
00060 void BL_calc_ipo(struct Object* blenderobject, float curframetime)

00061 {
00062         calc_ipo(blenderobject->ipo,curframetime);
00063 }
00064 
00065 
00066 bool    BL_HasIPO(struct Object* blenderobj)

00067 {
00068         bool result = false;
00069         if (blenderobj)
00070                 result = (blenderobj->ipo != 0);
00071         return result;
00072 }
00073 
00074 void BL_execute_ipo(struct Object* blenderobject)

00075 {
00076         execute_ipo((ID *)blenderobject, blenderobject->ipo);
00077 }
00078 
00079 void BL_DoDLocIPO(struct Object* blenderobject)

00080 {
00081         if(blenderobject->ipo) {
00082                 //vec[0]= ob->rot[0]+ob->drot[0];
00083                 //vec[1]= ob->rot[1]+ob->drot[1];
00084                 //vec[2]= ob->rot[2]+ob->drot[2];
00085         
00086                 blenderobject->loc[0]+=blenderobject->dloc[0]; //?? doesn't work
00087                 blenderobject->loc[1]+=blenderobject->dloc[1];
00088                 blenderobject->loc[2]+=blenderobject->dloc[2];
00089                 
00090                 blenderobject->dloc[0] = 0.0;
00091                 blenderobject->dloc[1] = 0.0;
00092                 blenderobject->dloc[2] = 0.0;
00093 
00094                 /*
00095                 blenderobject->rot[0]+=blenderobject->drot[0];

00096                 blenderobject->rot[1]+=blenderobject->drot[1];

00097                 blenderobject->rot[2]+=blenderobject->drot[2];

00098                 

00099                 blenderobject->drot[0] = 0;

00100                 blenderobject->drot[1] = 0;

00101                 blenderobject->drot[2] = 0;

00102 
00103                 blenderobject->size[0]+=blenderobject->dsize[0];

00104                 blenderobject->size[1]+=blenderobject->dsize[1];

00105                 blenderobject->size[2]+=blenderobject->dsize[2];

00106                 blenderobject->dsize[0] = 0;

00107                 blenderobject->dsize[1] = 0;

00108                 blenderobject->dsize[2] = 0;

00109                 */
00110         }
00111 }

Generated at Thu Feb 1 13:03:01 2001 for Ketsji Game Engine by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000