Skip to content

Instantly share code, notes, and snippets.

CanOfColliders

View GitHub Profile
@CanOfColliders
CanOfColliders / split-skymap-into-images.py
Created Jul 15, 2013
Simple script to split a cubemap/skymap image produced by blender into 6 separated image files for use in Unity3Ds skybox materials.
View split-skymap-into-images.py
#!/usr/bin/env python
# Will split a png cubemap/skymap image produced by blender into 6 separated image files for use in a skybox within unity
# Requires Python Imaging Library > http://www.pythonware.com/products/pil/
# The author takes no responsibility for any damage this script might cause,
# feel free to use, change and or share this script.
# 2013-07, CanOfColliders, m@canofcolliders.com
from PIL import Image
@CanOfColliders
CanOfColliders / castToType.py
Last active Dec 17, 2015
Python: Trys to cast a string into int or float if possible, won't throw an error if not, just returns the string untouched.
View castToType.py
# trys to cast strings into float or int if possible, or returns it.
def castToType(n):
n = n.replace(",", ".")
try:
num = float(n)
if "." not in n:
return int(num)
return num
except ValueError:
return n
You can’t perform that action at this time.