Difference between revisions of "Channel Mod Linear Blend"
Line 61: | Line 61: | ||
===[[Server_Tags |Server Tags]]=== | ===[[Server_Tags |Server Tags]]=== | ||
+ | |||
+ | Servers tags are examined when the server is initialized, and give information about the server. We set the tags in this case by taking descinfo[] arrays and associating the relevant data with the corresponding flags. | ||
The tags here indicate that the CSimpleKinematicsPackage class is dependent on the chanmodify SuperType with the internal name of cmSimpleKinematics. | The tags here indicate that the CSimpleKinematicsPackage class is dependent on the chanmodify SuperType with the internal name of cmSimpleKinematics. | ||
Line 71: | Line 73: | ||
===[[Initialize_(index)|Initialize]]=== | ===[[Initialize_(index)|Initialize]]=== | ||
+ | |||
+ | Intialize is called when we add the plugin to modo, and is the utility that exports the server. | ||
Our initialize function indicates that we will be exporting one server dependent on the CSimpleKinematicsPackage class that uses the Package and StaticDesc interfaces as well as being names cmSimpleKinematics. | Our initialize function indicates that we will be exporting one server dependent on the CSimpleKinematicsPackage class that uses the Package and StaticDesc interfaces as well as being names cmSimpleKinematics. | ||
Line 95: | Line 99: | ||
void *data) | void *data) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
Line 121: | Line 106: | ||
CLinearBlendPackage::CLinearBlendPackage () | CLinearBlendPackage::CLinearBlendPackage () | ||
{ | { | ||
− | + | ... | |
− | + | ||
} | } |
Revision as of 23:51, 11 September 2013
Channel Mod Linear Blend is a basic example plugin. This wiki page is intended as a walkthrough of the code in order to help you better understand the SDK.
When installed, this plugin adds the Linear Blend channel modifier, which allows you to take two channel inputs and combine them into a single output.
Contents
Code Walkthrough
Class Declarations
We want to have this class write out to the log, so we inherit from CLxLuxologyLogMessage.
class CLinearBlendLog : public CLxLuxologyLogMessage { public: CLinearBlendLog () : CLxLuxologyLogMessage ("cmLinearBlend") { } const char * GetFormat () { return "Linear Blend Object"; } };
To create an instance of the Linear Blend object we need to implement the Linear Blend Package object so we inherit from CLxPackageInstance. We also need to modify channels as part of our instance, so we inherit from CLxImpl_ChannelModItem.
class CLinearBlendInstance : public CLxImpl_PackageInstance, public CLxImpl_ChannelModItem { CLinearBlendLog log; public: CLinearBlendPackage *src_pkg; CLxUser_Item m_item; ILxUnknownID inst_ifc; LxResult pins_Initialize (ILxUnknownID item, ILxUnknownID super); void pins_Cleanup (void); LxResult pins_SynthName (char *buf, unsigned len); unsigned int cmod_Flags (ILxUnknownID item, unsigned int index); LxResult cmod_Allocate ( ILxUnknownID cmod, ILxUnknownID eval, ILxUnknownID item, void **ppvData); void cmod_Cleanup (void *data); LxResult cmod_Evaluate (ILxUnknownID cmod, ILxUnknownID attr, void *data); };
To set up our object we need a package, so we have this class inherit from CLxImpl_Package.
class CLinearBlendPackage : public CLxImpl_Package { public: static LXtTagInfoDesc descInfo[]; CLxPolymorph<CLinearBlendInstance> chanmod_factory; CLinearBlendPackage (); LxResult pkg_SetupChannels (ILxUnknownID addChan); LxResult pkg_TestInterface (const LXtGUID *guid); LxResult pkg_Attach (void **ppvObj); };
Server Tags
Servers tags are examined when the server is initialized, and give information about the server. We set the tags in this case by taking descinfo[] arrays and associating the relevant data with the corresponding flags.
The tags here indicate that the CSimpleKinematicsPackage class is dependent on the chanmodify SuperType with the internal name of cmSimpleKinematics.
LXtTagInfoDesc CLinearBlendPackage::descInfo[] = { { LXsPKG_SUPERTYPE, "chanModify" }, { LXsSRV_LOGSUBSYSTEM, "cmLinearBlend" }, { 0 } };
Initialize
Intialize is called when we add the plugin to modo, and is the utility that exports the server.
Our initialize function indicates that we will be exporting one server dependent on the CSimpleKinematicsPackage class that uses the Package and StaticDesc interfaces as well as being names cmSimpleKinematics.
void initialize () { CLxGenericPolymorph *srv; srv = new CLxPolymorph<CLinearBlendPackage>; srv->AddInterface (new CLxIfc_Package <CLinearBlendPackage>); srv->AddInterface (new CLxIfc_StaticDesc <CLinearBlendPackage>); thisModule.AddServer ("cmLinearBlend", srv); }
Implementations
This function evaluates the modifiers we have used on the given channels.
LxResult CLinearBlendInstance::cmod_Evaluate ( ILxUnknownID cmod, // ILxChannelModifierID ILxUnknownID attr, // ILxAttributesID void *data) { ... }
We create factories here to export CLinearBlendInstance.
CLinearBlendPackage::CLinearBlendPackage () { ... }