This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Imports | |
# ------------------------------------------------------------------------------ | |
import sys | |
import uuid | |
import json | |
from random import randint | |
from PySide import QtCore, QtGui | |
NODES = [] | |
HIERARCHY = {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn get_all_nodes nodes:#() = | |
( | |
allnodes = #() | |
for n in nodes do | |
( | |
append allnodes n | |
join allnodes (get_all_nodes nodes:(n.children)) | |
) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
existing_names = [getattr(x, "name", "") for x in nodes if type(x).__name__ == node_class] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_nodes(items=[], ages=[]): | |
myresults = [] | |
print "Searching..." | |
# pseudo code | |
for item in items: | |
if item.age in ages: | |
print "\t","valid age" | |
myresults.append(item) | |
myresults.extend( get_nodes(items=item.children, ages=ages) ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn sortbyage v1 v2 = | |
( | |
if v1.age < v2.age then -1 else if v1.age > v2.age then 1 else 0 | |
) | |
fn sortbyname v1 v2 = | |
( | |
act = stricmp v1.name v2.name | |
if act == 0 then sortbyage v1 v2 else act | |
) | |
qsort <an_array_of_persons> sortbyname |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/******************************************************** | |
:Created By: John Martini | |
:Company: JokerMartini | |
:Site: http://JokerMartini.com | |
:Email: [email protected] | |
:Client: | |
:Purpose: | |
:History: | |
:Todo: | |
:Bugs: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- test scene setup | |
delete objects | |
tm = Inverse( viewport.getTM() ) | |
camA = FreeCamera wirecolor:orange transform:tm | |
tm = camA.transform | |
origin = [0,0,0] | |
fn flip_tm_along_vector tm:undefined origin:[0,0,0] = | |
( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--Bobo: The other way would be to use MatrixFromNormal, set the .row4 to the position of the object and assign to the .transform property. | |
( | |
s = sphere pos:[10,20,30] | |
t = teapot radius:5 | |
theMesh = snapshotasmesh s | |
for f = 1 to theMesh.numfaces do | |
( | |
theClone = instance t | |
theClone.transform = matrixFromNormal (getFaceNormal theMesh f) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--Create a point | |
p=point pos:[-20,0,0] size:20 axistripod:true box:true | |
--Rotate it 90 in z | |
rotate p (eulerAngles 0 0 45) | |
--Get the transform matrix to work with. | |
tm=p.transform | |
--Mirror the tm across the world matrix in x |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from PySide import QtGui | |
class Example(QtGui.QWidget): | |
def __init__(self): | |
super(Example, self).__init__() | |
self.initUI() | |