using namespace HDK_Sample;
};
methodItems);
PRM_Name(
"firstweight",
"Omit First Weight Channel"),
};
{
};
bool
{
changes |=
enableParm(
"firstweight", GETDIFFERENCE());
return changes;
}
{ 0, 0, 0 }
};
{
}
{
}
CHOP_Blend::~CHOP_Blend()
{
}
CHOP_Blend::getCacheInputClip(
int j)
{
return (j>=0 && j<myInputClip.
entries()) ?
myInputClip(j) : 0;
}
{
int num_motion_tracks;
int num_clips;
int difference;
int fweight;
short int percent = -1;
int stopped = 0;
fpreal adjust[2] = {1.0, -1.0};
difference = GETDIFFERENCE();
if(difference)
fweight = FIRST_WEIGHT();
else
fweight = 0;
if(!blendclip)
num_clips = findInputClips(context, blendclip);
num_motion_tracks = findFirstAvailableTracks(context);
total = myTotalArray.
array();
if(boss->
opStart(
"Blending Channels"))
{
for(i=0; i<num_motion_tracks; i++)
{
myTotalArray.
constant(difference ? 1.0 : 0.0);
for(j=difference?1:0; j<num_clips; j++)
{
clip = getCacheInputClip(j+1);
if(!clip)
continue;
if(difference && fweight)
else
if(!track || !blend)
continue;
{
{
if (w[k])
{
data[k] += w[k]*src[k];
total[k] += w[k]*adjust[difference];
}
}
}
else
{
{
if (w[k])
{
data[k] += w[k] *
total[k] += w[k]*adjust[difference];
}
}
}
{
stopped = 1;
break;
}
}
if(!stopped)
{
if(!difference)
{
j = myAvailableTracks(i);
if ( j!=-1 && getCacheInputClip(j))
{
track = getCacheInputClip(j)->
getTrack(i);
if(blend)
else
continue;
}
else
track = 0;
{
{
data[k] /= total[k];
}
else
{
if(track && blend)
{
total[k]-= w[k];
weight = 1.0 - total[k];
total[k]+= weight;
data[k] /= total[k];
}
}
}
}
else
{
j = myAvailableTracks(i);
if (j != -1)
{
clip = getCacheInputClip(j);
if (track)
{
{
data[k] += src[k] * total[k];
}
else
{
{
data[k] += val * total[k];
}
}
}
}
{
stopped = 1;
break;
}
}
}
if(stopped)
break;
}
}
}
int
{
if(GETDIFFERENCE() && FIRST_WEIGHT())
num_clips ++;
for (int i=0; i<=num_clips; i++)
return num_clips;
}
int
CHOP_Blend::findFirstAvailableTracks(
OP_Context &context)
{
int num_motion_tracks = 0;
{
if (!clip)
continue;
}
myAvailableTracks.
entries(num_motion_tracks);
for (int i=0; i<num_motion_tracks; i++)
{
int j = 1;
{
if (!clip)
{
j++;
continue;
}
if (!track)
j++;
}
myAvailableTracks(i) = track ? j : -1;
}
for (int i=0; i<num_motion_tracks; i++)
{
int j = myAvailableTracks(i);
if (j == -1)
continue;
if (track)
}
return num_motion_tracks;
}
{
"HDK Blend",
2,
9999,
}