00001 #include "clip.h"
00002 #include "colors.h"
00003 #include "edl.h"
00004 #include "edlsession.h"
00005 #include "floatauto.h"
00006 #include "floatautos.h"
00007 #include "intauto.h"
00008 #include "intautos.h"
00009 #include "maskautos.h"
00010 #include "overlayframe.inc"
00011 #include "transportque.inc"
00012 #include "vautomation.h"
00013
00014
00015 VAutomation::VAutomation(EDL *edl, Track *track)
00016 : Automation(edl, track)
00017 {
00018 }
00019
00020
00021
00022 VAutomation::~VAutomation()
00023 {
00024 }
00025
00026
00027 int VAutomation::create_objects()
00028 {
00029 Automation::create_objects();
00030
00031 autos[AUTOMATION_FADE] = new FloatAutos(edl, track, 100);
00032 autos[AUTOMATION_FADE]->create_objects();
00033
00034 autos[AUTOMATION_MODE] = new IntAutos(edl, track, TRANSFER_NORMAL);
00035 autos[AUTOMATION_MODE]->create_objects();
00036
00037 autos[AUTOMATION_MASK] = new MaskAutos(edl, track);
00038 autos[AUTOMATION_MASK]->create_objects();
00039
00040 autos[AUTOMATION_CAMERA_X] = new FloatAutos(edl, track, 0.0);
00041 autos[AUTOMATION_CAMERA_X]->create_objects();
00042
00043 autos[AUTOMATION_CAMERA_Y] = new FloatAutos(edl, track, 0.0);
00044 autos[AUTOMATION_CAMERA_Y]->create_objects();
00045
00046 autos[AUTOMATION_PROJECTOR_X] = new FloatAutos(edl, track, 0.0);
00047 autos[AUTOMATION_PROJECTOR_X]->create_objects();
00048
00049 autos[AUTOMATION_PROJECTOR_Y] = new FloatAutos(edl, track, 0.0);
00050 autos[AUTOMATION_PROJECTOR_Y]->create_objects();
00051
00052 autos[AUTOMATION_CAMERA_Z] = new FloatAutos(edl, track, 1.0);
00053 autos[AUTOMATION_CAMERA_Z]->create_objects();
00054
00055 autos[AUTOMATION_PROJECTOR_Z] = new FloatAutos(edl, track, 1.0);
00056 autos[AUTOMATION_PROJECTOR_Z]->create_objects();
00057
00058
00059
00060
00061 for(int i = 0; i < AUTOMATION_TOTAL; i++)
00062 if (autos[i])
00063 {
00064 autos[i]->autoidx = i;
00065 autos[i]->autogrouptype = autogrouptype(i, autos[i]->track);
00066 }
00067
00068 return 0;
00069 }
00070
00071 int VAutomation::direct_copy_possible(int64_t start, int direction)
00072 {
00073 int64_t end = (direction == PLAY_FORWARD) ? (start + 1) : (start - 1);
00074
00075 if(!Automation::direct_copy_possible(start, direction))
00076 return 0;
00077
00078
00079 double constant;
00080 if(((FloatAutos*)autos[AUTOMATION_FADE])->automation_is_constant(
00081 start, 1, direction, constant))
00082 {
00083 if(!EQUIV(constant, 100))
00084 return 0;
00085 }
00086 else
00087
00088 return 0;
00089
00090
00091 if(autos[AUTOMATION_MUTE]->automation_is_constant(start, end))
00092 {
00093 if(autos[AUTOMATION_MUTE]->get_automation_constant(start, end) > 0)
00094 return 0;
00095 }
00096 else
00097 return 0;
00098
00099
00100 FloatAuto *previous = 0, *next = 0;
00101 float z = ((FloatAutos*)autos[AUTOMATION_PROJECTOR_Z])->get_value(
00102 start, direction, previous, next);
00103 if(!EQUIV(z, 1)) return 0;
00104
00105 previous = 0;
00106 next = 0;
00107 float x = ((FloatAutos*)autos[AUTOMATION_PROJECTOR_X])->get_value(start,
00108 direction,
00109 previous,
00110 next);
00111 if(!EQUIV(x, 0)) return 0;
00112 previous = 0;
00113 next = 0;
00114 float y = ((FloatAutos*)autos[AUTOMATION_PROJECTOR_Y])->get_value(start,
00115 direction,
00116 previous,
00117 next);
00118 if(!EQUIV(y, 0)) return 0;
00119
00120
00121
00122
00123
00124 previous = 0;
00125 next = 0;
00126 z = ((FloatAutos*)autos[AUTOMATION_CAMERA_Z])->get_value(
00127 start,
00128 direction,
00129 previous,
00130 next);
00131 if(!EQUIV(z, 1)) return 0;
00132
00133
00134
00135 previous = 0;
00136 next = 0;
00137 x = ((FloatAutos*)autos[AUTOMATION_CAMERA_X])->get_value(start,
00138 direction,
00139 previous,
00140 next);
00141 if(!EQUIV(x, 0)) return 0;
00142
00143 previous = 0;
00144 next = 0;
00145 y = ((FloatAutos*)autos[AUTOMATION_CAMERA_Y])->get_value(start,
00146 direction,
00147 previous,
00148 next);
00149
00150 if(!EQUIV(y, 0)) return 0;
00151
00152
00153 if(((MaskAutos*)autos[AUTOMATION_MASK])->mask_exists(start, direction))
00154 return 0;
00155
00156 return 1;
00157 }
00158
00159 void VAutomation::get_projector(float *x,
00160 float *y,
00161 float *z,
00162 int64_t position,
00163 int direction)
00164 {
00165 FloatAuto *before, *after;
00166 before = 0;
00167 after = 0;
00168 *x = ((FloatAutos*)autos[AUTOMATION_PROJECTOR_X])->get_value(position,
00169 direction,
00170 before,
00171 after);
00172 before = 0;
00173 after = 0;
00174 *y = ((FloatAutos*)autos[AUTOMATION_PROJECTOR_Y])->get_value(position,
00175 direction,
00176 before,
00177 after);
00178 before = 0;
00179 after = 0;
00180 *z = ((FloatAutos*)autos[AUTOMATION_PROJECTOR_Z])->get_value(position,
00181 direction,
00182 before,
00183 after);
00184 }
00185
00186
00187 void VAutomation::get_camera(float *x,
00188 float *y,
00189 float *z,
00190 int64_t position,
00191 int direction)
00192 {
00193 FloatAuto *before, *after;
00194 before = 0;
00195 after = 0;
00196 *x = ((FloatAutos*)autos[AUTOMATION_CAMERA_X])->get_value(position,
00197 direction,
00198 before,
00199 after);
00200 before = 0;
00201 after = 0;
00202 *y = ((FloatAutos*)autos[AUTOMATION_CAMERA_Y])->get_value(position,
00203 direction,
00204 before,
00205 after);
00206 before = 0;
00207 after = 0;
00208 *z = ((FloatAutos*)autos[AUTOMATION_CAMERA_Z])->get_value(position,
00209 direction,
00210 before,
00211 after);
00212 }
00213