Skip to content

Instantly share code, notes, and snippets.

using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using BepInEx;
using UniVRM10;
using GameNetcodeStuff;
using UniGLTF;
using UnityEngine;
using UnityEngine.Rendering;
@Ooseykins
Ooseykins / IFacialMocapReciever.cs
Created August 15, 2022 02:57
Simpler Unity receiver for IFacialMocap. Statically access IFacialMocapReciever.currentFrame to get the most recent weights and transforms.
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using UnityEngine;
public class IFacialMocapReciever : MonoBehaviour
{
@Ooseykins
Ooseykins / TransformSlider.cs
Created August 15, 2022 02:52
Script for sliding bracelets up and down a character's arm, or other simple incline-plane-like simulations. SliderTransform origins will be placed along the topmost edge of the rendered gizmo.
using UnityEngine;
public class TransformSlider : MonoBehaviour {
[Min(0.01f)]
public float length = 0.1f;
float totalOffset;
public float scale = 0.05f;
public AnimationCurve scaleCurve = AnimationCurve.Linear(0f,1f,1f,0.5f);
public Vector3 gravity;
[System.Serializable]
@Ooseykins
Ooseykins / ScriptableObjectWithColorEditor.cs
Last active August 3, 2022 04:41
Override of RenderStaticPreview for tinting an asset preview icon to a scriptable object's color
using UnityEngine;
using UnityEditor;
[CustomEditor(typeof(ScriptableObjectWithColor))]
public class ScriptableObjectWithColorEditor : Editor
{
public override Texture2D RenderStaticPreview(string assetPath, Object[] subAssets, int width, int height)
{
ScriptableObjectWithColor targetObj = (ScriptableObjectWithColor)target;
if (targetObj == null)
@Ooseykins
Ooseykins / VRMSwapBoneNames.py
Last active December 28, 2022 20:10
Imported vrm/vroid models have bone names that aren't compatible with Blender's mirrored bone editing. This will toggle the vertex group names and bone names between the two versions. This script adds a menu option for object mode "VRM Swap Bone Names".
bl_info = {
"name": "VRM Swap Bone Names",
"blender": (3, 4, 1),
"category": "Object",
}
import bpy
class VRMSwapBoneNamesOperator(bpy.types.Operator):
@Ooseykins
Ooseykins / DesktopCapture.cs
Last active September 10, 2021 10:32
Unity component to read uDesktopDuplication (or other) texture as single colour
using UnityEngine;
using System;
public class DesktopCapture : MonoBehaviour
{
[SerializeField]
uDesktopDuplication.Texture uddTexture;
public Light spotLight;
[Tooltip("Power of 2 to use for the texture size")]