Skip to content

Instantly share code, notes, and snippets.

Avatar

Andreas Rånman rondreas

View GitHub Profile
@BigRoy
BigRoy / usdviewport_qt.py
Last active Dec 6, 2021
Example of how to embed a simple USD viewport in Qt application
View usdviewport_qt.py
"""
MIT License
Copyright (c) 2019 Roy Nieterau
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@Meatplowz
Meatplowz / FBX_Scene.py
Last active Jan 13, 2022
This is a wrapper FBX class useful in accessing and modifying the FBX Scene
View FBX_Scene.py
"""
This is a helper FBX class useful in accessing and modifying the FBX Scene
Documentation for the FBX SDK
http://help.autodesk.com/view/FBX/2015/ENU/?guid=__cpp_ref_index_html
Examples:
# instantiate the class, as seen below with a path to an FBX file
fbx_file = FBX_Class(r'c:\my_path\character.fbx')
#get all of the scene nodes
all_fbx_nodes = fbx_file.file.scene_nodes()
# remove namespaces from all of the nodes
View checksum.py
#!/usr/bin/python3
import hashlib, sys
"""
Command line tool to get checksums in python.
Supply filepath for file to process, and which hash
method to use.
"""
@mattcox
mattcox / pmodel_selectOdd.cpp
Last active Aug 26, 2021
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
View selectAxisUVs.py
#!/usr/bin/env python
# To install this plugin, simply copy this file (selectAxisUVs.py) into folder called "lxserv" in your modo scripts folder (and restart modo, if it's open).
# If you are unsure where your modo scripts folder is, you can open modo, then select System > Open User Scripts Folder.
# If there is no folder called "lxserv" in your MODO Scripts folder, simply create one and then put this file in there.
# Once MODO has been restarted, you can run the command via ffr.selectaxisuv
#
# Any issues, please drop me a line at jamesohare@gmail.com.
#
# James O'Hare
@mattcox
mattcox / shapeDraw.py
Last active Apr 16, 2020
Python example demonstrating how to modify GL drawing of an item.
View shapeDraw.py
#python
'''
Shape Draw python example. This python plugins demonstrates how to create
a Package that can be added to existing items, that controls how they draw
in the GL viewport. We will simply draw a circle. A radius channel and an
sides channel will control how the circle is drawn.
To use, add the python script to an lxserv folder in your scripts directory.
Select an locator item and enter: item.addPackage shape.draw. To remove the
@mattcox
mattcox / SurfaceForce.py
Last active Dec 16, 2021
This example plugin for modo 701, shows how to create a surface force in Python. The force will read a mesh, get the closest position on that mesh and find the normal at that position. A force will be created along the normal vector of the surface. The result is a force that pushes particles and dynamic objects away from the surface.
View SurfaceForce.py
#python
'''
Surface Force
This example plugin for modo 701, shows how to create a surface force in
Python. The force will read a mesh, get the closest position on that mesh
and find the normal at that position. A force will be created along the
normal vector of the surface. The result is a force that pushes particles