11 #ifndef __GU_AgentClip__
12 #define __GU_AgentClip__
83 bool copy_external_ref);
87 static void computeWorldTransforms(
94 static void computeLocalTransforms(
103 static void computeWorldTransforms(
112 static void computeLocalTransforms(
126 , myFileName(filename)
127 , myIsFile(filename.isstring())
128 , myIsLoaded(!filename.isstring())
129 , myHasLoadErrors(false)
130 , myNumXformTracks(0)
141 int64 getMemoryUsage(
bool inclusive)
const;
147 void init(
exint num_samples);
161 { ensureLoaded();
return myNumXformTracks; }
165 bool worldspace =
false)
const;
180 {
UT_ASSERT(isFile());
return myFileName; }
187 {
UT_ASSERT(isFile());
return myIsLoaded; }
190 {
return myHasLoadErrors; }
202 if (myLocalTransforms.entries() < 1)
204 return myLocalTransforms(0).entries();
211 return myLocalTransforms.entries();
217 { ensureLoaded();
return myStart; }
219 { ensureLoaded(); myStart =
t; }
231 { ensureLoaded();
return mySampleRate; }
235 mySampleRate = sample_rate;
248 void setLocalTransforms(
252 void setLocalTransforms(
exint sample_i,
253 const XformArray &xforms);
258 return myLocalTransforms(sample_i);
263 return myWorldTransforms(sample_i);
268 return *myChannelValueSamples[sample_i];
274 Matrix4 &xform_sample)
const;
296 exint channelCount()
const;
306 void addScaledLocalTransforms(
314 void addScaledLocalTransforms(
321 void concatLocalTransforms(
326 void addScaledLocalTransform(
334 void addScaledChannelValues(
344 return (seconds - myStart) * mySampleRate;
349 return myStart + (sample / mySampleRate);
354 SYSrint(sampleFromSeconds(seconds));
360 sampleFromSeconds(seconds),
378 void removeFromFileCache();
388 void initChannels(
exint num_samples);
391 void computeWorldSpaceSamples();
399 bool myHasLoadErrors;
400 int myNumXformTracks;
422 mutable UT_Lock myDelayLoadLock;
431 exint i = myRig->findChannel(name);
436 auto it = mySpareChannelIndex.find(name);
437 return it != mySpareChannelIndex.end() ? it->second : -1;
447 return myRig->channelName(i);
449 return mySpareChannelNames[i - myRig->channelCount()];
456 return myRig->channelCount() + mySpareChannelNames.
entries();
fpreal sampleFromSeconds(fpreal seconds) const
GT_API const UT_StringHolder filename
int numTransformTracks() const
static SYS_NO_DISCARD_RESULT UT_StringHolder forceValidName(const UT_StringHolder &clipname)
Replaces whitespace, special characters, etc with underscores.
UT_IntrusivePtr< const GU_AgentClip > GU_AgentClipConstPtr
exint findChannel(const UT_StringRef &name) const
Finds a channel by name. Returns -1 if the channel does not exist.
UT_IntrusivePtr< GU_AgentClip > GU_AgentClipPtr
fpreal wrappedSampleFromSeconds(fpreal seconds) const
Matrix4ArrayConstPtr worldTransforms(exint sample_i) const
A reference counter base class for use with UT_IntrusivePtr.
const GU_AgentRig & rig() const
UT_Matrix4T< FloatType > Matrix4
UT_SharedPtr< FloatArray > FloatArrayPtr
GA_API const UT_StringHolder scale
UT_Array< Matrix4 > Matrix4Array
A rig for the agent primitive.
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
const FloatArray & channelValues(exint sample_i) const
int & sampleCount(char *base, int xStride, int yStride, int x, int y)
void setName(const UT_StringHolder &name)
UT_Array< GU_AgentClipConstPtr > GU_AgentClipPtrArray
bool isFile() const
Returns whether the clip references a file on disk.
Wrapper around hboost::intrusive_ptr.
#define SYS_NO_DISCARD_RESULT
UT_Array< FloatType > FloatArray
GU_AgentXformT< FloatType > Xform
exint channelCount() const
GLuint const GLchar * name
const XformArray & localTransforms(exint sample_i) const
UT_SharedPtr< const Matrix4Array > Matrix4ArrayConstPtr
SYS_NO_DISCARD_RESULT UT_StringRef forceValidVariableName(const char *safechars=nullptr) const
fpreal32 SYSrint(fpreal32 val)
const UT_StringHolder & channelName(exint i) const
Returns the name of the specified channel.
exint entries() const
Alias of size(). size() is preferred.
void setSampleRate(fpreal sample_rate)
UT_Array< Xform > XformArray
const UT_StringHolder & name() const
UT_Array< FloatType > FloatArray
fpreal length() const
Length of the clip, in seconds.
exint nearestSampleFromSeconds(fpreal seconds) const
UT_SharedPtr< Matrix4Array > Matrix4ArrayPtr
const UT_StringHolder & fileName() const
Returns the name of the file referenced by the clip.
fpreal sampleRate() const
bool hasLoadErrors() const
Returns whether there were errors when loading the clip from disk.
fpreal secondsFromSample(fpreal sample) const
exint transformsPerSample() const
Number of transforms in each sample.
IMATH_INTERNAL_NAMESPACE_HEADER_ENTER IMATH_HOSTDEVICE IMATH_CONSTEXPR14 T clip(const T &p, const Box< T > &box) IMATH_NOEXCEPT
bool isLoaded() const
Returns whether the clip's contents have been loaded from disk.
ImageBuf OIIO_API channels(const ImageBuf &src, int nchannels, cspan< int > channelorder, cspan< float > channelvalues={}, cspan< std::string > newchannelnames={}, bool shuffle_channel_names=false, int nthreads=0)
exint sampleCount() const
Number of samples in this clip.