Skip to content

Instantly share code, notes, and snippets.

Matt Cox mattcox

Block or report user

Report or block mattcox

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mattcox
mattcox / meshDumpCurvesCommand.py
Created Nov 7, 2019
Demonstrates how to print vertex information for the points on an ILxCurve.
View meshDumpCurvesCommand.py
#python
import lx
import lxifc
import lxu.command
import modo
class Command(lxu.command.BasicCommand):
def __init__(self):
lxu.command.BasicCommand.__init__(self)
@mattcox
mattcox / SetCOM.cpp
Created Feb 15, 2019
Demonstrates how to implement a custom Polymorph object that implements the SetCOM method. When the COM object is allocated, the SetCOM method will be passed a copy of the object, which can be useful if the allocated object needs passing to additional methods from within the COM implementation. Note: As the COM object is maintaining a pointer to…
View SetCOM.cpp
class SomeInterface :
public CLxImpl_Foo
{
public:
class MyPolymorph :
public CLxPolymorph<SomeInterface>
{
public:
virtual void
SetCOM(
@mattcox
mattcox / kitDumpCommand.py
Created Feb 14, 2019
Demonstrates how to list the kits installed in Modo, and query the version numbers. This mostly is a wrapper for the kit.version command.
View kitDumpCommand.py
#python
'''
Demonstrates how to list the kits installed in Modo, and query the version
numbers. This mostly is a wrapper for the kit.version command.
'''
import lx
@mattcox
mattcox / printMeshTags.py
Last active Oct 4, 2018
This sample code demonstrates how to enumerate over all polygons on the active mesh layer, and print the material tag assigned to each polygon to the event log.
View printMeshTags.py
#python
'''
This sample code demonstrates how to enumerate over all polygons on the active
mesh layer, and print the material tag assigned to each polygon to the event
log.
'''
import lx
import lxu.command
@mattcox
mattcox / previewSocketExample.py
Created Aug 13, 2018
This sample script demonstrates the basics for connecting to the preview socket, setting the resolution, and the pixel format, and reading back a floating point buffer of the image.
View previewSocketExample.py
'''
This sample script demonstrates the basics for connecting to the preview
socket, setting the resolution, and the pixel format, and reading back a
floating point buffer of the image.
To test it, launch modo, and execute the command:
telnet.listen port:5678 raw:true
Then run the following in an external Python client.
'''
@mattcox
mattcox / getReferenceScenesAndItems.py
Created Jul 24, 2018
Collect reference items in the selected scene.
View getReferenceScenesAndItems.py
import lxu.select
class ReferencedItems:
def __init__(self, scene):
self.mScene = lx.object.Scene(scene)
self.mSceneFilename = self.mScene.Filename()
self.mItems = []
def AddItem(self, item):
print item
@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 / EvaluateParticles.cpp
Created Nov 20, 2017
This demonstrates how to evaluate a particle source for it's particles. By default, only position, transform and ID are evaluated, however it could easily be extended to support other types.
View EvaluateParticles.cpp
/*
* This demonstrates how to evaluate a particle source for it's particles.
* By default, only position, transform and ID are evaluated, however it
* could easily be extended to support other types.
*
* To evaluate particles, you must provide a TriangleSoup to the Tableau,
* allowing it populate your soup with the particle data. This is very
* similar to reading surfaces, but we only care about vertex data, not
* polygons.
*
@mattcox
mattcox / continueOnFunctionMiss.py
Created Jul 21, 2017
This script when attached to a breakpoint will continue lldb if the provided function doesn't appear in the current backtrace.
View continueOnFunctionMiss.py
#!/usr/bin/env python
'''
This script when attached to a breakpoint will continue lldb if the provided
function doesn't appear in the current backtrace.
To use this script, add a file called .lldbinit to your home directory,
with the following line:
@mattcox
mattcox / pmodel_selectOdd.cpp
Last active Jul 12, 2018
Example of a simple selection operation for the Modo procedural modelling system that selects every other polygon. It demonstrates how to use thread slots, to allow selection to be evaluated from multiple threads
View pmodel_selectOdd.cpp
#include <lxsdk/lx_mesh.hpp>
#include <lxsdk/lx_pmodel.hpp>
#include <lxsdk/lx_seltypes.hpp>
#include <lxsdk/lx_thread.hpp>
#include <lxsdk/lxu_attributes.hpp>
#define SERVER_NAME "pmodel.selectEveryOther"
/*
* The Selection Operation is evaluated in parallel from multiple threads. As
You can’t perform that action at this time.