00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef __CHOP_CHANNEL_H__
00020 #define __CHOP_CHANNEL_H__
00021
00022 #include "CHOP_API.h"
00023 #include <SYS/SYS_Types.h>
00024 #include <CH/CH_Types.h>
00025 #include <UT/UT_IntArray.h>
00026 #include <UT/UT_PtrArray.h>
00027 #include <UT/UT_StringArray.h>
00028 #include <UT/UT_SymbolTable.h>
00029
00030 #include "CHOP_Node.h"
00031
00032 class OP_Channels;
00033 class PRM_Parm;
00034
00035 class CHOP_API CHOP_Channel : public CHOP_Node
00036 {
00037 public:
00038 static OP_Node * myConstructor(OP_Network*, const char *,
00039 OP_Operator *);
00040 static OP_TemplatePair myTemplatePair;
00041 static OP_VariablePair myVariablePair;
00042 static PRM_Template myTemplateList[];
00043 static CH_LocalVariable myVariableList[];
00044
00045
00046 virtual OP_ERROR cookMyChop(OP_Context &context);
00047
00048 virtual unsigned disableParms();
00049
00050 virtual void cookMyHandles(OP_Context &context);
00051 virtual float handleChanged(CHOP_Handle *, CHOP_HandleData *);
00052
00053 virtual bool findParmFromTrack(float t, const char *trackname,
00054 OP_Node *&node, PRM_Parm *&parm,
00055 int &vecidx);
00056
00057
00058 void clearChannelInstances();
00059
00060
00061 int getNumChannelInstances();
00062
00063
00064 int appendChannelInstance();
00065
00066
00067
00068
00069 static void organizeChanRefs(
00070 const CH_ChannelRefList &chan_refs,
00071 OP_NodeList &nodes,
00072 UT_PtrArray<PRM_Parm *> &parms,
00073 UT_IntArray &used_fields);
00074
00075
00076
00077
00078
00079
00080
00081
00082 bool appendParmCopy(float t, const PRM_Parm *src_parm,
00083 unsigned copy_field,
00084 CH_ChannelRefList &new_refs,
00085 bool copy_value = true,
00086 bool current_value_only = false,
00087 bool lock_copy = false);
00088
00089
00090
00091 void removeChannelRefs(float t,
00092 const CH_ChannelRefList &refs);
00093
00094
00095
00096 bool synchSourceParms(
00097 float t, bool force, bool synch_keys,
00098 const UT_StringArray &parm_paths,
00099 const UT_PtrArray<PRM_Parm *> &parms,
00100 const UT_IntArray &fields);
00101
00102 int getNumPoseKeys(float t);
00103 bool addPoseKey(float t, bool only_synch=false);
00104 bool copyPoseKeyToSource(float t, unsigned key_idx);
00105 bool removePoseKey(float t, unsigned key_idx);
00106 bool updatePoseKey(float t, unsigned key_idx);
00107
00108
00109
00110 void getSourceChannelRefs(float t,
00111 CH_ChannelRefList &refs);
00112
00113
00114
00115 bool matchParmPaths(float t,
00116 const UT_StringArray &parm_paths);
00117
00118
00119 void findConflicts(float t,
00120 const CH_ChannelRefList &refs,
00121 CH_ChannelRefList &conflicts);
00122
00123 void setRangeToValueAnimation(float t);
00124
00125 protected:
00126 CHOP_Channel(OP_Network *net, const char *name,
00127 OP_Operator *op);
00128 virtual ~CHOP_Channel();
00129
00130 virtual int usesScope() const { return false; }
00131 virtual int usesUnits();
00132
00133 virtual float getVariableValue(int index, int thread);
00134
00135 virtual void buildParmDependency(int parm_index);
00136 virtual void handleOpDependency(
00137 int referenced_op_id,
00138 const OP_Dependency &op_dep,
00139 OP_InterestType interest_type,
00140 bool &need_cook,
00141 const char *old_fullpath,
00142 const char *old_cwd,
00143 const char *old_chan_name);
00144
00145 private:
00146 bool initializeClip(float t, bool key_per_sample,
00147 UT_IntArray &instances,
00148 UT_IntArray &components);
00149
00150 void getInterval(float t, fpreal &start, fpreal &end);
00151
00152 OP_Node * getExportParent(UT_String *export_path,
00153 bool add_trailing_slash);
00154
00155 bool getTrackSource(OP_Node *export_parent,
00156 CL_Track *track,
00157 OP_Node *&node,
00158 UT_String &channel_name);
00159 bool getTrackSourceParm(OP_Node *export_parent,
00160 CL_Track *track,
00161 PRM_Parm *&parm,
00162 int &vi,
00163 OP_Node **source = NULL);
00164 bool getTrackSourceRef(OP_Node *export_parent,
00165 CL_Track *track,
00166 CH_ChannelRef &new_ref);
00167
00168 void getTrackPrefix(const PRM_Parm *src_parm,
00169 UT_String &track_prefix);
00170
00171 void getTrackParmMappings(float t,
00172 UT_IntArray &instances,
00173 UT_IntArray &components);
00174 int copyToExport(float t);
00175 static int copyToExportCallback(void *data, int, float t,
00176 const PRM_Template *);
00177
00178 int updateAliases(float t);
00179 static int updateAliasesCallback(void *data, int, float t,
00180 const PRM_Template *);
00181
00182 bool getChannelCopies(float t,
00183 const UT_StringArray &parm_paths,
00184 CH_ChannelList &channels,
00185 OP_Channels &collection);
00186 void restoreChannelCopies(float t,
00187 CH_ChannelList &channels);
00188
00189 bool isChannelNameParm(int parm_index);
00190
00191
00192 private:
00193 int my_C;
00194 int my_I;
00195 int my_NC;
00196 UT_ExpandArray myChannelArray;
00197 UT_IntArray myTrackInstances;
00198 UT_IntArray myTrackComponents;
00199 };
00200
00201 #endif // __CHOP_CHANNEL_H__