
Class Reference
DK_Tool(DevKit &parent);Creates a DK_Tool object.
virtual ~DK_Tool(void);Destroys a DK_Tool object. You can override this method if desired: memory should be freed in the destructor to avoid memory leaks.
virtual void copy(const DK_Tool *other) = 0;Copies the *other tool into this DK_Tool object. It is called when users choose Copy from the Tool menu, and is also used to restore values when users click Cancel in a tool editor.
This method must be overridden. It should copy the private data members you defined in the class you derived from DK_Tool (that is, your custom tool class).
virtual void init(void) = 0;Initializes the tool and readies it for use.
This method must be overridden. It should set all parameters to their default values and create all required target legs. You do not need to create the OptionalBackground target leg.
const char *getToolName(void) const;Returns the name of the tool. The default name is the classID, but the user can change the name of a tool instance in the Eddie interface.
virtual const char *classID(void) const = 0;Returns the class name of the tool.
This method must be overridden. The class name should be the third argument passed to the DK_DSOFUNC macro from the DK_ToolGUI subclass of your tool, as well as the base name of your .so and .icon files.
virtual Boolval willChange(float from_frame,
float to_frame);
Returns TRUE if the image that the tool will render changes between the specified frames. You can override this method if desired. You need only examine the state of your internal data; any DK_AnimParam instances you create are examined directly by Eddie.
virtual Boolval isAttachable(void) const;Specifies whether the tool can be attached to a target leg of another tool in a hierarchy. The default is TRUE.
You should override this function and return FALSE if the tool cannot be attached (for example, an output tool).
virtual Boolval IsPackageable(void) const;Specifies whether the tool can be included in a packaged hierarchy. The default is TRUE.
If your tool is an input tool that generates images rather than processes them, you should override this function and return FALSE.
virtual DK_IRect2 defaultRect(float frame);Called by Eddie to determine the preferred size and position of your tool's rendered image. The default uses the size and position of the child image attached to leg 0.
You can override this function if desired. Note that Eddie can also override this function based on user input: for example, rendering the Processing Region only.
enum RenderStatus {
FAILURE,
DID_REQUEST,
DID_ALL
};
Enumerates the status after rendering:
virtual RenderStatus render
(float frame,
DK_Image &outim,
DK_IRect2 &area_to_do) = 0;
Renders the specified image at the specified frame. This method must be overridden. This is where your custom effect is applied. You can ignore the area_to_do argument if desired, but you should return the RenderStatus as enumerated in the previous section. For an overview the steps involved in writing a render method, see Rendering.
void discardCachedResults(void);Discards all cached information. This forces Eddie to call the render method when it needs to update a frame from your tool.
virtual void write(FILE *fp);Writes to an ASCII function file (.fn3). The default does not write anything.
You should override this method. You should sequentially write out all data needed to preserve the state of your tool, in the order and format expected by the read method. You can use simple fprintf() calls to write out the state of your variables; for example:
fprintf(fp, "_myPrivateString %s\n",
_myPrivateString);
fprintf(fp, "_myPrivateBool %d\n",
_myPrivateBool);
virtual void read(FILE *fp);Reads an ASCII description of the variables for this tool from the specified function file (.fn3). By default, nothing is read.
You should override this method. The format and sequence of variables being read from the function should be identical to the one written out by the write method. Simple fscanf() calls can be used to read the variable descriptions; for example:
char dummyString[1024];
long dummyLong;
fscanf(fp, "%s %s", dummyString,
_myPrivateString);
fscanf(fp, "%s %ld", dummyString, &dummyLong);
_myPrivateBool = (Boolval) dummyLong;
static void pushProgress
(const char *process_name);
Creates an entry with the specified process name in the Progress Meter.
static Boolval updateProgress
(float fraction_complete);
Updates the last entry in the Progress Meter. The argument must be a number between 0 and 1; Eddie estimates the time remaining based on this fraction. This function returns TRUE if the users clicks Cancel or if Eddie abandons the operation for any reason.static void popProgress(void);Removes the last entry from the Progress Meter.
void createLeg(const char *name,
DK_LegColour colour,
Boolval isOptional);
Creates a new target leg. This function is used in the init method of your tool's DK_Tool subclass. DK_LegColour is enumerated in DK_Types.h. If the isOptional parameter is 0, the leg is always displayed; if it is 1, the leg is displayed only when the user chooses Targets -> Show from the Tool menu. void deleteLeg();Deletes the last target leg created.
void deleteAllLegs();Deletes all target legs except for OptionalBackground.
Boolval isConnected(u_int leg_index);Returns TRUE if the specified target leg is connected to a child tool.
DK_Image &getChildImage(float frame_no,
u_int leg_index);
Gets the image rendered by the child tool connected to the specified target leg, at the specified frame.
if ((sptr = img->getDataPtr()) == NULL)
{ delete img;
return FAILURE;
}
DK_IRect2 getChildRect(float frame_no,
u_int leg_index);
Gets the coordinates of the rectangular region used at the specified frame by the child tool connected to the specified target leg.
Boolval willChangeChild(float from_frame,
float to_frame,
u_int leg_index);
Returns TRUE if the image from the child connected to the specified target leg changes between the specified frames.float getGlobalScale(void);Returns the Global Scale set in the main Eddie workspace. This is a positive value, where 1.0 represents full scale. Depending on your tool, it may be necessary to adjust the size of brushes and so on, based on the Global Scale value.
DK_IVector2 getCurrentCamera(void);Returns the x and y resolution of the camera as set in the Preferences dialogue box or in an output tool.
virtual void getFrameRange(int &first,
int &last) const;
Returns the range of frames your tool is capable of providing. The default indicates that the tool can handle all frames.You should override this function if your tool reads an external data source that has definite duration, such as a 3D scene or a disk recorder. To specify that your tool can handle all frame numbers, set the first frame larger than the last frame.
void updateDuration();Forces the Eddie kernel to call getFrameRange in order to re-evaluate the frame range that your tool can provide.
