00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __COP2_PixelBase_h__
00021 #define __COP2_PixelBase_h__
00022
00023 #include "COP2_API.h"
00024 #include <UT/UT_IntArray.h>
00025 #include "COP2_Node.h"
00026
00027 #define ARG_PIXELBASE_RGBA "scopergba"
00028 #define ARG_PIXELBASE_SCOPE "pscope"
00029 #define ARG_PIXELBASE_FSCOPE "fscope"
00030 #define ARG_PIXELBASE_FRANGE "frange"
00031 #define ARG_PIXELBASE_FDROP "fdropoff"
00032 #define ARG_PIXELBASE_FFUNC "fdropfunc"
00033 #define ARG_PIXELBASE_FEFFECT "foutside"
00034 #define ARG_PIXELBASE_SPECIFIC "flist"
00035
00036 #define ARG_PIXELBASE_AUTOFRAME "fautoadjust"
00037 #define ARG_PIXELBASE_CURLENGTH "currange"
00038
00039 class COP2_API COP2_PixelBase : public COP2_Node
00040 {
00041 public:
00042
00043 virtual TIL_Sequence *cookSequenceInfo(OP_ERROR &err);
00044
00045 static OP_TemplatePair myTemplatePair;
00046 static PRM_Template myTemplateList[];
00047
00048 static int scopeChanged(void *data, int idx, float t,
00049 const PRM_Template *);
00050 static int toggleScope(void *data, int idx, float t,
00051 const PRM_Template *);
00052 static int frameChanged(void *data, int idx, float t,
00053 const PRM_Template *);
00054
00055 virtual unsigned disableParms();
00056
00057 virtual bool isPixelBased() const { return true; }
00058
00059 void setScope(const UT_String &st);
00060
00061 virtual bool isTimeDepOperation();
00062 protected:
00063 COP2_PixelBase(OP_Network *parent,
00064 const char *name,
00065 OP_Operator *entry);
00066 virtual ~COP2_PixelBase();
00067
00068 virtual int scope(UT_String &scope);
00069 virtual int frameScope(UT_String &scope);
00070
00071 virtual bool usesPartialFrameScope() { return true; }
00072 virtual float getFrameScopeEffect(int image_index);
00073
00074 virtual COP2_ThreadPref getThreadPreference() const
00075 { return COP2_THREAD_MULTI; }
00076
00077 virtual void getInputDependenciesForOutputArea(
00078 COP2_CookAreaInfo &output_area,
00079 const COP2_CookAreaList &input_areas,
00080 COP2_CookAreaList &needed_areas);
00081
00082 virtual bool isFrameScoped(int image_index);
00083
00084 virtual void setDefaultScope(bool color, bool alpha,
00085 const char *others);
00086
00087 private:
00088 void toggleScope(int comp);
00089 void updateButtons();
00090 void updateFrameScope(int op, float t);
00091
00092 void getFrameScope(UT_IntArray &scope_frames,
00093 bool &allscoped);
00094
00095 void autoAdjustLength(int oldlen, int newlen);
00096
00097 int myFrameScopeMethod;
00098 float myFrameScopeStart;
00099 float myFrameScopeEnd;
00100 float myFrameScopePreDrop;
00101 float myFrameScopePostDrop;
00102 int myFrameScopeFunction;
00103 float myFrameScopeEffect;
00104 UT_IntArray mySpecificFrames;
00105 bool myScopeAllFlag;
00106
00107 protected:
00108 int RGBA()
00109 { return evalInt(ARG_PIXELBASE_RGBA,0,0); }
00110
00111
00112 int FSCOPE_METHOD()
00113 { return evalInt(ARG_PIXELBASE_FSCOPE,0,0); }
00114
00115 void FRANGE(float &start, float &end)
00116 { start = evalFloat(ARG_PIXELBASE_FRANGE,0,0);
00117 end = evalFloat(ARG_PIXELBASE_FRANGE,1,0); }
00118
00119 void FDROP(float &start, float &end)
00120 { start = evalFloat(ARG_PIXELBASE_FDROP,0,0);
00121 end = evalFloat(ARG_PIXELBASE_FDROP,1,0); }
00122
00123 int FSCOPE_FUNCTION()
00124 { return evalInt(ARG_PIXELBASE_FFUNC,0,0); }
00125
00126 float FSCOPE_EFFECT()
00127 { return evalFloat(ARG_PIXELBASE_FEFFECT, 0, 0); }
00128
00129 void FRAME_SPECIFIC(UT_String &st)
00130 { evalString(st, ARG_PIXELBASE_SPECIFIC,0,0); }
00131
00132 int FAUTO()
00133 { return evalInt(ARG_PIXELBASE_AUTOFRAME, 0,0); }
00134
00135 int CURRENT_LENGTH()
00136 { return evalInt(ARG_PIXELBASE_CURLENGTH, 0,0); }
00137
00138 void SCOPE(UT_String &st)
00139 { evalString(st, ARG_PIXELBASE_SCOPE,0,0); }
00140
00141
00142 void SET_SCOPE(const UT_String &st)
00143 {
00144 setChRefString(ARG_PIXELBASE_SCOPE,0,0, st,
00145 CH_STRING_LITERAL);
00146 }
00147
00148 void SET_FRANGE(float start, float end)
00149 {
00150 if( canAccess(PRM_WRITE_OK) )
00151 {
00152 setSilentFloat(ARG_PIXELBASE_FRANGE,0,0, start);
00153 setSilentFloat(ARG_PIXELBASE_FRANGE,1,0, end);
00154 }
00155 }
00156
00157 void SET_FDROP(float start, float end)
00158 {
00159 if( canAccess(PRM_WRITE_OK) )
00160 {
00161 setSilentFloat(ARG_PIXELBASE_FDROP,0,0, start);
00162 setSilentFloat(ARG_PIXELBASE_FDROP,1,0, end);
00163 }
00164 }
00165
00166 void SET_CURRENT_LENGTH(int length)
00167 {
00168 if( canAccess(PRM_WRITE_OK) )
00169 setSilentInt(ARG_PIXELBASE_CURLENGTH, 0,0, length);
00170 }
00171
00172 };
00173
00174 #endif