Skip to content

Instantly share code, notes, and snippets.

@mattcox
mattcox / eval_matrixChannel.cpp
Last active Jul 12, 2018
This snippet is to demonstrate how to write to a matrix channel in modo from an eval modifier. This is the correct way to write to a matrix. This does assume that you have set the matrix channel you want to drive as a channel for the modifier, using eval.AddChan(item_loc, LXsICHAN_XFRMCORE_WPOSMATRIX, LXfECHAN_WRITE); in your modifier constructo…
View eval_matrixChannel.cpp
/*
This snippet is to demonstrate how to write to a matrix channel
in modo from an eval modifier. This is the correct way to write
to a matrix. This does assume that you have set the matrix channel
you want to drive as a channel for the modifier, using something like:
eval.AddChan(item_loc, LXsICHAN_XFRMCORE_WPOSMATRIX, LXfECHAN_WRITE);
in your modifier constructor. This method will drive the matrix
channel directly, so instead of using the local channels to calculate
the world SRT, it'll use the values the modifier provides it with.
*/
@mattcox
mattcox / matchXfrm.cpp
Last active Jul 12, 2018
Match Transform Command for Luxology Modo.
View matchXfrm.cpp
/*
matchXfrm.cpp
Sample plugin to demonstrate a simple command that matches
position, rotation and scale between multiple selected items.
This command operates slightly differently to the built in
match.position, rotation, scale commands. The built in commands
will average out the transform if multiple items are selected,
@mattcox
mattcox / commandDemo.cpp
Last active Jul 12, 2018
Demonstrates how to spawn another command from a command plugin. This will create a new command with a single argument called "mask", the mask argument will be passed to the material.new command to create a new material mask.This should only be used in the context of a command plugin.
View commandDemo.cpp
#include <lx_plugin.hpp>
#include <lxu_command.hpp>
/*
* The server name is the name of the command that is used to run the command
* in modo. The argument name is the name of the argument that will define the
* material mask.
*/
#define SERVER_NAME "command.demo"
@mattcox
mattcox / modifierSample.cpp
Last active Jul 12, 2018
This sample plugin demonstrates how to create a very simple and pointless modifier. The modifier attaches to every light in the scene and sets the light radiance value to the distance from the center of the world.
View modifierSample.cpp
/*
*
* modifierSample.cpp
*
* This sample plugin demonstrates how to create a very simple and pointless
* modifier. The modifier attaches to every light in the scene and sets the
* light radiance value to the distance from the center of the world.
*
*/
@mattcox
mattcox / getInstance.cpp
Last active Jul 12, 2018
Demonstrates how to get a PackageInstance from a ILxItem COM interface. If you pass this function an item, it will return the class that it derives from, as long as it is one of your classes. Obviously, change the class name to whatever your class is called, as well as the server name!
View getInstance.cpp
Instance *
getInstance (
ILxUnknownID item)
{
CLxLoc_PackageInstance pkgInstance (item);
CLxSpawner <Instance> spawn ("myInstance");
if (pkgInstance.test ())
return spawn.Cast (pkgInstance);
@mattcox
mattcox / notifier.py
Created Oct 21, 2015
A pointless command that demonstrates how to use a notifier without arguments
View notifier.py
#!/usr/bin/env python
import lx
import lxu.command
import modo
class Command (lxu.command.BasicCommand):
def __init__ (self):
lxu.command.BasicCommand.__init__ (self)
@mattcox
mattcox / pmodel_createPlane_simple.cpp
Last active Jul 12, 2018
Demonstrates a simple plane mesh operation for the Modo procedural modelling system.
View pmodel_createPlane_simple.cpp
#include <lxsdk/lx_mesh.hpp>
#include <lxsdk/lx_pmodel.hpp>
#include <lxsdk/lx_seltypes.hpp>
#include <lxsdk/lxu_attributes.hpp>
#define SERVER_NAME "pmodel.createPlane"
#define ATTRs_SIZE "size"
#define ATTRi_SIZE 0
class MeshOp :
@mattcox
mattcox / pmodel_createPlane_incremental.cpp
Last active Jul 12, 2018
Demonstrates a simple plane mesh operation for the Modo procedural modelling system. This demonstrates how to do incremental updates that create the polygon on the first evaluation, and then updates point positions on subsequent evaluations. Incremental updates can significantly improve performance, as Modo will only rebuild the surface for draw…
View pmodel_createPlane_incremental.cpp
#include <lxsdk/lx_mesh.hpp>
#include <lxsdk/lx_pmodel.hpp>
#include <lxsdk/lx_seltypes.hpp>
#include <lxsdk/lxu_attributes.hpp>
#define SERVER_NAME "pmodel.createPlane"
#define ATTRs_SIZE "size"
#define ATTRi_SIZE 0
class MeshOp :
@mattcox
mattcox / Manual_ToolOperation_Example.cpp
Last active Jul 12, 2018
This example demonstrates how to manually implement a tool operation item.
View Manual_ToolOperation_Example.cpp
/*
*
* This example demonstrates how to manually implement a tool operation
* item.
*
*/
#include <lxsdk/lx_mesh.hpp>
#include <lxsdk/lx_tool.hpp>
#include <lxsdk/lx_toolui.hpp>
#include <lxsdk/lx_vector.hpp>
@mattcox
mattcox / notifier_cmd.py
Last active Jun 17, 2018
Demonstrates how to write an executable and queryable command. The difference is that this command will listen for state changes in a scene. If the selection changes, then the command will check its enable/disable state and force any form it's embedded into to update.
View notifier_cmd.py
#python
'''
Notifier Command
Demonstrates how to write an executable and queryable command.
The difference is that this command will listen for state changes
in a scene. If the selection changes, then the command will check
its enable/disable state and force any form it's embedded into