Skip to content

Instantly share code, notes, and snippets.

Lukasz Pazera lukpazera

Block or report user

Report or block lukpazera

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
lukpazera / toolInput.cpp
Created Jun 10, 2019
A method to track input for tool events, thought it might be useful to others.
View toolInput.cpp
void input_testing(ILxUnknownID vts)
// setup
CLxUser_VectorStack vec(vts);
LXpToolInputEvent *input_event;
input_event = (LXpToolInputEvent *)vec.Read(offset_input);
// Tool Input Count(could be used to track number of clicks etc)
int count = input_event->count;
lukpazera /
Created Jun 10, 2019
Mesh listener setup snippet from Tom Dymond, posted on Foundry coding slack channel.
import modo, lxifc
geo = modo.MeshGeometry("Cube").internalMesh
port = lx.object.ListenerPort(geo)
class mesh_listener(lxifc.MeshListener):
undoService = lx.service.Undo()
def __init__(self):
self.listenerService = lx.service.Listener()
self.COM_object = lx.object.Unknown(port)
lukpazera /
Last active Apr 10, 2019
Using python TDSDK to merge two rotation transform items in MODO. The assumption is that the 2nd item is zero rotation one so effectively this removes zeroed rotation from an item.
import modo
scene = modo.Scene()
i = scene.selected[0]
l = modo.LocatorSuperType(i)
rot = l.rotation
transformsStack = [xfrm for xfrm in l.transforms]
lukpazera /
Created Apr 3, 2019
This gist will calculate rotation offset angle values for a rotation constraint between two items in MODO.
""" This gist will calculate rotation offset angle values for a rotation constraint
between two items in MODO. It'll be exactly the same as setting up the constraint
with compensation turned on.
This code can be useed to update existing rotation constraint setup with new offset
without reapplying the constraint again.
The process is simple.
- get the world rotation matrix of the target and invert it.
- multiply source world rotation matrix by the inverted target matrix.
lukpazera / ItemPackageFormFilter.CFG
Created Dec 12, 2018
This is an example of a MODO config file that sets up a properties form that is only visible for an item that contains a given package. One more snatch from James O'Hare.
View ItemPackageFormFilter.CFG
<atom type="Filters">
<hash type="Preset" key="ffr_morphCage.package:filterPreset">
<atom type="Name">Morph Cage View</atom>
<atom type="Enable">1</atom>
<list type="Node">1 .group 0 &quot;&quot;</list>
<list type="Node">1 packagename ffr_morphCage</list>
<list type="Node">-1 .endgroup </list>
lukpazera /
Created Dec 12, 2018
An example of setting up a notifier for command argument in MODO SDK. Snatched from post by James O'Hare on MODO slack coding channel.
class Notifier(lxifc.UIValueHints):
def __init__(self):
self._notifiers = [('channel.value', '+v channelName itemType'),]
def uiv_NotifierCount(self):
return len(self._notifiers)
def uiv_NotifierByIndex(self, index):
return self._notifiers[index]
lukpazera / layoutWindowConfigExample.CFG
Created Nov 24, 2018
How to define layout in MODO config so it's available by key to the layout.window command. Snatched from Funk example on MODO slack channel.
View layoutWindowConfigExample.CFG
<atom type="Frame">
<hash type="Layout" key="base.mbUVSingle_Layout" val="viewportGroup">
<atom type="IdealSize">1323 875</atom>
<list type="Port">UVmodel 0 1 0 1 TemplateUV_View</list>
<atom type="SwitcherClass">normal</atom>
<atom type="UserName">Mario UV</atom>
<hash type="LayoutWindow" key="mbUvWindow">
<atom type="Title">Mario UV</atom>
lukpazera /
Created Sep 7, 2018
This command shows how to set up text hints for an integer command argument in python. Courtesy of James O'Hare.
import lx
import lxu.command
my_hint = ( (0, 'zero' ),
(1, 'one' ),
(-1, 'minusone' ),)
class TextValueHint_Cmd(lxu.command.BasicCommand):
lukpazera /
Created Aug 29, 2018
Script that prints out channel package for each channel of the first selected item.
import modo
item = modo.Scene().selected[0]
chanCount = item.internalItem.ChannelCount()
chanList = []
for i in xrange(chanCount - 1, -1, -1):
package = item.internalItem.ChannelPackage(i)
except LookupError:
lukpazera / wxfrmInvert.cpp
Last active Feb 15, 2016
Two ways to get item's inverted world transform matrix.
View wxfrmInvert.cpp
* This snippet demonstrates two of the ways to obtain item's inverted world transform matrix.
// --- METHOD 1
CLxUser_Scene scene;
item.Context (scene);
CLxUser_ChannelRead chanRead;
CLxUser_SelectionService selSvc;
You can’t perform that action at this time.