40 using namespace HDK_Sample;
55 PRM_Name(
"firstweight",
"Omit First Weight Channel"),
76 changes |=
enableParm(
"firstweight", GETDIFFERENCE());
115 CHOP_Blend::getCacheInputClip(
int j)
119 return (j>=0 && j<myInputClip.
entries()) ?
129 int num_motion_tracks;
138 short int percent = -1;
140 fpreal adjust[2] = {1.0, -1.0};
143 difference = GETDIFFERENCE();
145 fweight = FIRST_WEIGHT();
157 num_clips = findInputClips(context, blendclip);
160 num_motion_tracks = findFirstAvailableTracks(context);
168 total = myTotalArray.
array();
170 if(boss->
opStart(
"Blending Channels"))
172 for(i=0; i<num_motion_tracks; i++)
182 myTotalArray.
constant(difference ? 1.0 : 0.0);
187 for(j=difference?1:0; j<num_clips; j++)
189 clip = getCacheInputClip(j+1);
195 if(difference && fweight)
218 data[k] += w[k]*src[k];
222 total[k] += w[k]*adjust[difference];
237 total[k] += w[k]*adjust[difference];
257 j = myAvailableTracks(i);
258 if ( j!=-1 && getCacheInputClip(j))
260 track = getCacheInputClip(j)->
getTrack(i);
289 weight = 1.0 - total[k];
291 data[k] += weight*
val;
303 j = myAvailableTracks(i);
306 clip = getCacheInputClip(j);
307 track = clip ? clip->
getTrack(i) : 0;
315 data[k] += src[k] * total[k];
323 data[k] += val * total[k];
353 if(GETDIFFERENCE() && FIRST_WEIGHT())
362 myInputClip.
entries(num_clips+1);
364 for (
int i=0; i<=num_clips; i++)
373 CHOP_Blend::findFirstAvailableTracks(
OP_Context &context)
377 int num_motion_tracks = 0;
378 for (
int i=1; i<
nInputs(); i++)
394 myAvailableTracks.
entries(num_motion_tracks);
396 for (
int i=0; i<num_motion_tracks; i++)
415 myAvailableTracks(i) = track ? j : -1;
420 for (
int i=0; i<num_motion_tracks; i++)
422 int j = myAvailableTracks(i);
433 return num_motion_tracks;
bool updateParmsFlags() override
void constant(fpreal value=0)
GT_API const UT_StringHolder time
static OP_TemplatePair myTemplatePair
CL_Track * getTrack(int index)
PRM_API const PRM_Type PRM_ORD
void setCapacity(exint new_capacity)
CHOP_Blend(OP_Network *net, const char *name, OP_Operator *op)
bool addOperator(OP_Operator *op, std::ostream *err=nullptr)
static OP_VariablePair myVariablePair
static OP_Node * myConstructor(OP_Network *, const char *, OP_Operator *)
bool updateParmsFlags() override
static OP_TemplatePair myTemplatePair
virtual unsigned nInputs() const
vint4 blend(const vint4 &a, const vint4 &b, const vbool4 &mask)
int opInterrupt(int percent=-1)
const CL_Clip * inputClip(int idx, OP_Context &context)
bool enableParm(int pi, int state, int v=-1)
static OP_VariablePair myVariablePair
OP_ERROR cookMyChop(OP_Context &context) override
static CH_LocalVariable myVariableList[]
GLuint const GLchar * name
SYS_FORCE_INLINE UT_StringHolder getToken(Add enum_value)
GLenum GLenum GLsizei void * table
PRM_API const PRM_Type PRM_SWITCHER
exint entries() const
Alias of size(). size() is preferred.
bool SYSequalZero(const UT_Vector3T< T > &v)
CL_Track * dupTrackInfo(const CL_Track *, int data_too=0, const UT_StringHolder &name=UT_StringHolder::theEmptyString)
PRM_API PRM_Default PRMoneDefaults[]
PRM_API PRM_Name PRMswitcherName
void newChopOperator(OP_OperatorTable *table)
UT_API UT_Interrupt * UTgetInterrupt()
Obtain global UT_Interrupt singleton.
fpreal evaluateSingleTime(const CL_Track *track, fpreal t) const
PRM_API const PRM_Type PRM_TOGGLE
static PRM_Template myTemplateList[]
int getTrackLength() const
void constant(const T &v)
Quickly set the array to a single value.
int opStart(const char *opname=0, int npoll=0, int immediate_dialog=0, int *opid=0)
GLubyte GLubyte GLubyte GLubyte w
int isSameRange(const CL_Clip &v) const
const CL_Clip * copyInputAttributes(OP_Context &context, int destroy=1)
int getParmIndex(const PRM_Parm *parm) const
PRM_API PRM_Default PRMzeroDefaults[]
SYS_FORCE_INLINE PRM_ParmList * getParmList()
IMATH_INTERNAL_NAMESPACE_HEADER_ENTER IMATH_HOSTDEVICE IMATH_CONSTEXPR14 T clip(const T &p, const Box< T > &box) IMATH_NOEXCEPT
fpreal getTime(fpreal index) const