Skip to content

Instantly share code, notes, and snippets.

Lukasz Pazera lukpazera

View GitHub Profile
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;
lukpazera /
Last active Jan 28, 2016
One way to pass item argument to command. Doing the same by using lx.eval and passing item ident is much easier though.
import modo
item = modo.Scene().selected[0]
cmdSvc = lx.service.Command()
cmd = cmdSvc.Spawn(lx.symbol.iCTAG_NULL, 'texture.reference')
attr = lx.object.Attributes(cmd)
val = attr.Value(attr.Lookup("item"), True)
valRef = lx.object.ValueReference(val)
lukpazera / chanUIDepend.cpp
Last active Nov 25, 2015
Setting up dependencies between channels on a custom item requires implementing ChannelUI interface .
View chanUIDepend.cpp
* If you want to create dependencies between channels on a custom item
* such that one channel enable state depends on some other channel value
* (on the same item) you need to implement ChannelUI interface for your item.
/* This is needed to obtain the implemented custom item type.
* (see DependencyCountIndex() method below)
static CLxItemType cit_self (MY_CUSTOM_ITEM_TYPE_NAME);
You can’t perform that action at this time.