CLxImpl Tool

From The Foundry MODO SDK wiki
Revision as of 08:15, 18 October 2019 by TomDym (Talk | contribs) (Created page with "<br> == Introduction == The CLxImpl_Tool interface contains the core methods we will use to build our tool and must always be included when creating a tool. It should be not...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Introduction

The CLxImpl_Tool interface contains the core methods we will use to build our tool and must always be included when creating a tool. It should be noted that some of the methods within CLxImpl_Tool are also dependant on other packages however where possible I will mention these.

#include <lx_layer.hpp>
#include <lx_tool.hpp>

class BasicTool : public CLxImpl_Tool
{
public:
    BasicToolCLxImpl_Tool();
}

Interface Methods

tool_Reset()

The Reset method sets the tool attributes back to their initial/default state(as defined within the constructor).

Header Definition

void		  tool_Reset() LXx_OVERRIDE;

Implementation

void BasicTool::tool_Reset()
{
    attr_SetFlt(0, 0.0);
    attr_SetFlt(1, 0.0);
}
  • attr_SetFlt, attr_SetBool, attr_SetInt, etc are used to reset different variable types.
  • The index is used to reference the required attribute in the order it was defined in.
  • The value argument is the value you wish it to reset to.

tool_Evaluate()

This method applys the tool, recursively applying any hierarchy of sub-tools. Naturally, it validates the tool state upon completion.

Header Definition

void		  tool_Evaluate(ILxUnknownID vts) LXx_OVERRIDE;

Implementation

void BasicTool::tool_Evaluate(ILxUnknownID vts)
{
    double factorX, factorY;

    attr_GetFlt(0, &factorX);
    attr_GetFlt(1, &factorY);

    my_log.Info("Factor X: " + std::to_string(factorX) + " Factor Y: " + toString(factorY));
}
  • attr_GetFlt can be used to retrieve a attribute for use within the tool.

tool_VectorType()

This method returns the tool vector type, describing the vector packets required for processing.

Header Definition

LXtObjectID	  tool_VectorType() LXx_OVERRIDE;

Implementation

LXtObjectID BasicTool::tool_VectorType()
{
    return v_type.m_loc;	// peek method; does not add-ref
}

tool_Task()

Specifies the type of task performed by the tool.

Header Definition

LXtID4		  tool_Task() LXx_OVERRIDE;

Implementation

LXtID4 BasicTool::tool_Task()
{
    return LXi_TASK_ACTR;
}

tool_Order()

Specifies the order in the pipe, by returning an Ordinal string.

Header Definition

const char *  tool_Order() LXx_OVERRIDE;

Implementation

const char *BasicTool::tool_Order()
{
    return LXs_ORD_ACTR;
}

tool_Sequence()

This method uses the attribute sequence object given to store the tool's complete state by generating the sequence of attribute changes needed to reproduce that exact state. A tool whose state is expressed entirely by its attributes may return LXe_NOTIMPL from this method, and let the system build the sequence directly from the attribute list. //BasicToolCLxImpl_Tool::tool_Sequence ===

tool_ShouldBeAttribute(LXtID4 task)

int tool_ShouldBeAttribute(LXtID4 task)

Undocumented Methods

I am currently giving these methods there own category as so far I have not been able to get them to work. They are related to procedural tools however please refer to the SDK docs for more info

tool_GetOp(void** ppvObj,unsigned flags)

LxResult tool_GetOp(void** ppvObj,unsigned flags)

tool_CompareOp(ILxUnknownID vts, LXtObjectID toolop)

int tool_CompareOp(ILxUnknownID vts, LXtObjectID toolop)

tool_UpdateOp(ILxUnknownID toolOP)

LxResult tool_UpdateOp(ILxUnknownID toolOP)