Difference between revisions of "CLxImpl Tool"

From The Foundry MODO SDK wiki
Jump to: navigation, search
(Interface Methods)
(Undocumented Methods)
Line 182: Line 182:
 
I am currently giving these methods there own category as so far I have not been able to get them to work.
 
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  
 
They are related to procedural tools however please refer to the SDK docs for more info  
 +
 +
=== 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)
  
 
=== tool_GetOp(void** ppvObj,unsigned flags) ===
 
=== tool_GetOp(void** ppvObj,unsigned flags) ===

Revision as of 09:00, 18 October 2019


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;
}
Return Value Description
LXi_TASK_ACEN Refers to a action center, defines a position about which a tool operation is centered.
LXi_TASK_ACTR A Actor or state altering tool, most tools will be made using this, refers to the primary tool in the tool pipe.
LXi_TASK_AXIS Refers to the axis, defines a axis or co-ordinate suystem in which a tool operates.
LXi_TASK_BRSH Refers to a paint brush.
LXi_TASK_CONS Refers to a constraint, constrains mouse events to move along a continuous surface
LXi_TASK_CONT Refers to a content preset.
LXi_TASK_EFFR Refers to a effector, read particles and effects at the position.
LXi_TASK_NOZL Refers to a nozzle(used with brushes)
LXi_TASK_PATH Refers to a path generator
LXi_TASK_PINK Paint Ink
LXi_TASK_POST Refers to a post apply actor
LXi_TASK_PTCL Refers to a surface particle generator
LXi_TASK_SIDE Not 100% Sure, by process of elimination I bielive it isthe visual aid - Adds to display without changing anything.
LXi_TASK_SNAP Refers to the snap, attracts and locks mouse events to specific positions or elements.
LXi_TASK_STYL Doesnt actually effect anything.
LXi_TASK_SYMM Refers to tool symmetry
LXi_TASK_WGHT Refers to the falloff, defines the strength of the tool operation through space.
LXs_TASK_WORK Refers to the workplane.

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_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)

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)