Skip to content

Instantly share code, notes, and snippets.

Twistedsheep

Block or report user

Report or block Twistedsheep

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
@Twistedsheep
Twistedsheep / uiModelExportEntry.py
Created Sep 19, 2017
idTech Model Export Entry (PySide Designer Generated)
View uiModelExportEntry.py
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'C:\Users\nstevenson\AppData\Roaming\Luxology\Scripts\europa\uiModelExportEntry.ui'
#
# Created: Wed Apr 06 21:26:20 2016
# by: pyside-uic 0.2.15 running on PySide 1.2.4
#
# WARNING! All changes made in this file will be lost!
from PySide import QtCore, QtGui
@Twistedsheep
Twistedsheep / uiMain.py
Last active Oct 7, 2017
idTech Main Module (PySide Designer Generated)
View uiMain.py
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'C:\Users\nstevenson\AppData\Roaming\Luxology\Scripts\doom\uiMain.ui'
#
# Created: Wed Apr 06 21:26:20 2016
# by: pyside-uic 0.2.15 running on PySide 1.2.4
#
# WARNING! All changes made in this file will be lost!
from PySide import QtCore, QtGui
@Twistedsheep
Twistedsheep / idTechWrapper.py
Last active Sep 19, 2017
idTech Layout Register Plugin
View idTechWrapper.py
import lx
import lxifc
import PySide
from PySide import QtGui
import doom.main
class idTechExporter(lxifc.CustomView):
def customview_Init(self, pane):
if pane == None:
@Twistedsheep
Twistedsheep / md5.py
Last active Sep 19, 2017
md5 mesh format exporter and importer
View md5.py
import lx, lxu, lxifc
import modo
import sys, os, math, datetime
__author__ = 'Nicholas Stevenson'
__date__ = 'October 2015'
# Huge thanks David Henry for his web site dissecting the format and contents of id's md5mesh and md5anim files.
# His work made creating this much, much easier.
@Twistedsheep
Twistedsheep / main.py
Last active Sep 19, 2017
idTech Main Module
View main.py
import modo, lx, lxu, os, json, ast
import doom.uiMain
import doom.uiModelExportEntry
from PySide import QtCore, QtGui
# This is the default in-scene attribute that will be created and stored on our primary data node
# It will hold the pickled data as a string.
# The data node will hold the DataAttribute as a string. Our internal data will be pickled and written to
# this attribute
@Twistedsheep
Twistedsheep / StoreAndFetchData.py
Last active Jan 29, 2016
Example code, plucked from a tool of mine, that stores its data on an in-scene object, using a standard string channel.
View StoreAndFetchData.py
# Data storage to and from the in-scene node
def storeData(self, data):
node = self.getNode()
ModelData = json.dumps( data[ModelEntries], sort_keys=True )
AnimationData = json.dumps( data[AnimationEntries], sort_keys=True )
lx.eval('item.channel item:{%s} name:{%s} value:{%s}' %(node.UniqueName(), ModelEntries, ModelData))
lx.eval('item.channel item:{%s} name:{%s} value:{%s}' %(node.UniqueName(), AnimationEntries, AnimationData))
@Twistedsheep
Twistedsheep / AlphabetizeMeshes.py
Created Jan 14, 2016
Modo script to alphabetize all mesh items in the current scene.
View AlphabetizeMeshes.py
import modo
scene = modo.Scene() # Create and save a modo Scene
# item in the variable named scene
meshItems = scene.items(itype='mesh') # Get all mesh items in the current scene
# Using a list comprehension, go through
rootMeshes = [item for item in meshItems if item.parent is None] # each mesh object and only keep those
# that don't have parents.
@Twistedsheep
Twistedsheep / PrintMeshItems.py
Created Jan 14, 2016
Example Code to print out all meshes in the currently selected scene.
View PrintMeshItems.py
import modo
scene = modo.Scene() # Create and save a modo Scene item in the variable named scene
# This is the mesh item type
meshType = modo.c.MESH_TYPE # you can also use 'mesh' in its place
# but using the item type is considered a better practice
meshes = scene.items(itype=meshType) # The scene object allows you to give it an item type
# if you only need a specific type of items.
@Twistedsheep
Twistedsheep / ListComprehension.py
Created Jan 13, 2016
List Comprehensions: This is an example of list comprehensions and what they do. The code in the middle section is how you create a list of items who don't have parents. The code at the very end is how you achieve the same thing using a list comprehension. List comprehensions are used everywhere in Python and are very, very useful.
View ListComprehension.py
import modo
sceneItems = modo.Scene().items()
# In this example, we're going to get all the items in the scene
# that don't have any parents. In short, only root items.
# The long way of doing this would be...
rootItems = [] # Start with an empty list
@Twistedsheep
Twistedsheep / lx_vs_modo.py
Last active Jan 13, 2016
This file is an example of Modo's Lx, Lxu python modules, and how they compare to the new TD SDK available in Modo 901.
View lx_vs_modo.py
#!/usr/bin/env python
# List Cameras and their Focal Lengths
#
# Classic Modo Python
#
import lx, lxu
# Create a scene selection service object
You can’t perform that action at this time.