This file contains 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
/** | |
* Input Module to use the new unity ui with multitouch from https://github.com/TouchScript | |
* Install TouchScript in your unity project, then add an EventSystem and replace the InputModules by this one. | |
* | |
* | |
* Basically modified TouchInputModule from | |
* https://bitbucket.org/Unity-Technologies/ui/src/5fc21bb4ecf4b40ff6630057edaa070252909b2e/UnityEngine.UI/EventSystem/InputModules/TouchInputModule.cs?at=4.6 | |
* and changing ProcessTouchEvent to take events from TouchScript | |
* | |
* Got the TouchScript stuff from |
This file contains 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
using UnityEngine; | |
using UnityEditor; | |
using System; | |
using System.IO; | |
using System.Linq; | |
using System.Collections; | |
using System.Collections.Generic; | |
public class AssetExtractor : EditorWindow { | |
Vector2 scrollPos; |
This file contains 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
using UnityEngine; | |
using System.Collections; | |
/** | |
* Singleton usefull if fields set in editor scripts need to be used in game. | |
*/ | |
public class ResourcesSingleton : MonoBehaviour { | |
private static ResourcesSingleton _instance; | |
public static ResourcesSingleton instance { |
This file contains 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
using System; | |
using System.IO; | |
using UnityEngine; | |
[RequireComponent(typeof(Camera))] | |
public class CaptureFrames : MonoBehaviour { | |
public int frameRate = 30; | |
string path; | |
Texture2D renderedImage; |
This file contains 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
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using UnityEditor; | |
public class BuildAutomation { | |
public struct BuildTargetAndGroup { | |
public BuildTargetGroup group; | |
public BuildTarget target; |
This file contains 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
# generate shapekey from armature (or other) deformation | |
# deformation should not change the vertex order | |
import bpy | |
obj = bpy.context.selected_objects[0] | |
# use to_mesh to get deformed mesh data | |
# https://blender.stackexchange.com/questions/34789/how-to-get-vertex-coordinates-after-modifier-in-python | |
temp_data = obj.to_mesh(bpy.context.scene, True, 'PREVIEW') |
This file contains 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
/* | |
* Ambient Occlusion and Direction. | |
* | |
* Calculates AO and the average direction where the ambient light came from. | |
* | |
* Original AO code from https://github.com/sambler/osl-shaders/blob/master/ramps/BaAmbientOcclusion/BaAmbientOcclusion.osl | |
* | |
*/ | |
void rng_seed(output int rng, int seed) |
This file contains 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
#ifndef MAINLIGHT_INCLUDED | |
#define MAINLIGHT_INCLUDED | |
void GetMainLightData_float(out half3 direction, out half3 color, out half distanceAttenuation, out half shadowAttenuation) | |
{ | |
#ifdef SHADERGRAPH_PREVIEW | |
// In Shader Graph Preview we will assume a default light direction and white color | |
direction = half3(-0.3, -0.8, 0.6); | |
color = half3(1, 1, 1); | |
distanceAttenuation = 1.0; |
This file contains 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 bpy | |
# convert the activ attribute to a shape key | |
# the active attribute is expected to be a Vector in the Vertex domain | |
def active_attribute_to_shape_key(context): | |
obj = context.active_object | |
mesh = obj.data | |
attribute_index = mesh.attributes.active_index | |
attribute = mesh.attributes[attribute_index] | |
This file contains 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
=== function zahl_schreiben(x) | |
~zahl_schreiben_rec(x, true, true, true) | |
=== function zahl_schreiben_rec(x, start, kurz_einhundert, hundert_und1_bis_12) | |
~ x = INT(x) // cast to an int, since this function can only handle ints! | |
{ | |
- x >= 1000000: | |
~ temp k = x mod 1000000 | |
~ temp millionen = (x - k) / 1000000 | |
{ |