Synide

From The Foundry MODO SDK wiki
Jump to: navigation, search

Articles

Reading Persistant Data.
Example Command - sy.partifymesh.
File Formats.

Tips

Polygon Pick Tags

  • When using CLxUser_StringTag.Set to define a Polygons LXi_PTAG_PICK tag with multiple values remember to NOT have a trailing ; after the last PICK value.
eg.
CLxUser_StringTag.Set(LXi_PTAG_PICK , "Head;Neck;Spine3");
instead of
CLxUser_StringTag.Set(LXi_PTAG_PICK , "Head;Neck;Spine3;");

Make sure to load ALL 'common' proj files

  • When first loading the SDK Visual Studio solution one should make sure that all the .cpp's for the 'common' project are actually included in the common project. On the odd occasion some are inadvertently left out. Once the solution is open, right-click the common project and select 'Add>Existing Files...' from the context menu. Navigate to the folder 'lxsdk_?????\common' and select ALL the .cpp files.

Matrix channel manipulation

  • When working with a 'locator' you sometimes want to get access to the 'other' matrices besides the 'WorldTransform'. Well, a 'locator' is still a 'item' so instead of getting the 'locator' as a CLxUser_Locator retrieve it as a CLxUser_Item instead. Then, do a CLxUser_Item.ChannelLookup specifying which matrix channel you want. (See LXsICHAN_XFRMCORE_???? defines in lxidef.h for the list of appropriate channel names). Once, you have the channel index you want use your previously setup channel reader to retrieve a matrix pointer into a ILxMatrixID with CLxUser_ChannelRead.ValueObj.
    Once you have the ID then 'set' a CLxUser_Matrix to this ID. See the CLxUser_Matrix class for the various methods relating to getting and setting the LXtMatrix or LXtVector components of the matrix in question.
eg. (Presumption of already having the ID of the locator.)
CLxUser_Item	Loc;
CLxUser_Matrix	MatrixObj;
ILxMatrixID		MatrixObjID;
unsigned		chanIndex;
LXtMatrix		Matrix3;
LXtVector		Pos;
 
Loc.set(ID);
Loc.ChannelLookup(LXsICHAN_XFRMCORE_WPIVPOSMATRIX, &chanIndex); //World Pivot 'Translation' matrix.
theXfrmChanReader.ValueObj(Loc, chanIndex, (void **)&MatrixObjID);
MatrixObj.set(MatrixObjID);
MatrixObj.Get3(Matrix3);
MatrixObj.GetOffset(Pos);

Useful Quick Links

Musings About Stuff

Additional Selection Types?

VPRT = viewport
SCMN = schmNode
KEDK = keyedkey
INMP = inputmappable
ICMD = inputcommand
HAUL = toolHauling
SCHM = schematic

Additional Graphs

schmChan = 'schematic channels graph' describes the links between channels of items from the schmItems graph.
schmItem = 'schematic items graph' describes the links between 'schmNode' items and the main scene items they represent.
deformTree = 'deformers tree graph'
SplineDeformerMeshes
assemblyDeform
assemblyInputs
assemblyItems
assemblyLinks
assemblyOutputs
assemblyRoot
backdropClip
chanMods
cmSound
currentGroups
itemGroups
chanGroups
deformTree
deformers
dynamic
emitSource
forceFalloff
groups
ikRefs
ikRetarget
ikTasks
itemSym
localShader
mesh
meshInst
pModFalloffs
parent
particle
particleOp
particleSim
pickWalkLR
pickWalkUD
pointCache
reference
schmItem
select
sgenSource
shadeLoc
shapeFalloff
source
substancegraph
targets
volumeLight
volumeSurf
xfrmCore
xfrmLocal

Basic item transform collation through to the linked main item

The basic flow for the calculation is:

The local transform channels are stored in the local transform matrices on each transform item. The local transform matrices are multiply from the bottom up and the resulting matrix is written to the local matrix channel. The local matrix is multiplied by it's parents world matrix and this is then written into the world matrix channel for the item.

The world matrix is then split out into world position, world rotation and world scale matrices.

See... OOO in transform

Matrix Channel Read/Write in ChannelModifier

As per Matt Cox...

// Assuming we have a single matrix input into the channel modifier and a single matrix output.
 
LxResult chanMod_instance::cmod_Evaluate (ILxUnknownID cmod, ILxUnknownID attr, void *data)		
{
	CLxLoc_ChannelModifier	 chanMod (cmod);
	LXtMatrix4 *matrixInput, *matrixOutput;
	unsigned count;
 
	// Read the matrix.
	chanMod.ReadInputVal(attr, 0, (void**) &matrixInput);
 
	// Do something with the matrix here. Split it off into vectors...etc.
	// We'll simply pass the input to the output here.
 
	// Writing the matrix value is pretty much taken from the SDK wiki FAQ.
	chanMod.OutputCount (0, &count);
	for (unsigned x = 0; x < count; x++) {
		chanMod.WriteOutputValByIndex (attr, 0, x, (void **) (&matrixOutput));
		for (int i = 0; i <= 3; i++) {
			for (int ii = 0; ii <= 3; ii++) {
				(*matrixOutput)[ii][i] = (*matrixInput)[ii][i];
			}
		}
	}
 
	return LXe_OK;
}