Skip to content

Instantly share code, notes, and snippets.

@pharan
pharan / BlendModeMaterialsAsset.cs
Last active September 16, 2018 07:50
Initial implementation of slot blend mode processing on the attachment level for Spine-Unity.
/******************************************************************************
* Spine Runtimes Software License v2.5
*
* Copyright (c) 2013-2016, Esoteric Software
* All rights reserved.
*
* You are granted a perpetual, non-exclusive, non-sublicensable, and
* non-transferable license to use, install, execute, and perform the Spine
* Runtimes software and derivative works solely for personal or internal
* use. Without the written permission of Esoteric Software (see Section 2 of
@pharan
pharan / SpineMeshUVResizeCalculator.cs
Last active August 30, 2018 09:53
How to calculate how much to trim unused space on backing image for a Spine mesh, and output new UVs that map to the trimmed image.
using System;
public static class SpineMeshUVResizeCalculator {
public struct MeshUVData {
public float[] uvs;
public float imageWidth;
public float imageHeight;
public float trimLeft;
public float trimRight;
@pharan
pharan / AnimationTools.cs
Last active June 6, 2018 17:37
Preview of the spine-unity AnimationTools static class module.
/******************************************************************************
* Spine Runtimes Software License v2.5
*
* Copyright (c) 2013-2018, Esoteric Software
* All rights reserved.
*
* You are granted a perpetual, non-exclusive, non-sublicensable, and
* non-transferable license to use, install, execute, and perform the Spine
* Runtimes software and derivative works solely for personal or internal
* use. Without the written permission of Esoteric Software (see Section 2 of
@pharan
pharan / PaintBrush.cs
Created November 11, 2017 00:08
Unity PaintBrush MonoBehaviour class based on https://pastebin.com/rMx1PVXi
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PaintBrush : MonoBehaviour
{
public int resolution = 512;
Texture2D whiteMap;
public float brushSize;
public Texture2D brushTexture;
@pharan
pharan / AnimationMixer.cs
Created July 29, 2017 16:27
Spine.AnimationMixer. For adapting native Spine Animation Mixing into external animation track systems.
/******************************************************************************
* Spine Runtimes Software License v2.5
*
* Copyright (c) 2013-2016, Esoteric Software
* All rights reserved.
*
* You are granted a perpetual, non-exclusive, non-sublicensable, and
* non-transferable license to use, install, execute, and perform the Spine
* Runtimes software and derivative works solely for personal or internal
* use. Without the written permission of Esoteric Software (see Section 2 of
@pharan
pharan / AttachmentTools.cs
Last active July 17, 2017 02:18
Caching version of AttachmentTools
/******************************************************************************
* Spine Runtimes Software License v2.5
*
* Copyright (c) 2013-2016, Esoteric Software
* All rights reserved.
*
* You are granted a perpetual, non-exclusive, non-sublicensable, and
* non-transferable license to use, install, execute, and perform the Spine
* Runtimes software and derivative works solely for personal or internal
* use. Without the written permission of Esoteric Software (see Section 2 of
@pharan
pharan / SkeletonDataAssetInspector.cs
Created June 26, 2017 16:29
SkeletonDataAssetInspector for Spine 3.5 that allows both Spine.Unity.AtlasAssets and TK2D sprite collections.
/******************************************************************************
* Spine Runtimes Software License v2.5
*
* Copyright (c) 2013-2016, Esoteric Software
* All rights reserved.
*
* You are granted a perpetual, non-exclusive, non-sublicensable, and
* non-transferable license to use, install, execute, and perform the Spine
* Runtimes software and derivative works solely for personal or internal
* use. Without the written permission of Esoteric Software (see Section 2 of
@pharan
pharan / SkeletonLit.shader
Created May 26, 2017 08:40
Legacy version of Spine's Skeleton Lit shader from 3.5.
Shader "Spine/Skeleton Lit" {
Properties {
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
[NoScaleOffset] _MainTex ("Texture to blend", 2D) = "black" {}
}
// 2 texture stage GPUs
SubShader {
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
LOD 100
@pharan
pharan / AtlasRegionAttacher.cs
Created May 19, 2017 07:13
Deprecated AtlasRegionAttacher.cs from Spine-Unity for Spine 3.5
/******************************************************************************
* Spine Runtimes Software License v2.5
*
* Copyright (c) 2013-2016, Esoteric Software
* All rights reserved.
*
* You are granted a perpetual, non-exclusive, non-sublicensable, and
* non-transferable license to use, install, execute, and perform the Spine
* Runtimes software and derivative works solely for personal or internal
* use. Without the written permission of Esoteric Software (see Section 2 of
@pharan
pharan / CustomSkin.cs
Created May 19, 2017 07:08
Deprecated CustomSkin.cs file from Spine-Unity for Spine 3.5
/******************************************************************************
* Spine Runtimes Software License v2.5
*
* Copyright (c) 2013-2016, Esoteric Software
* All rights reserved.
*
* You are granted a perpetual, non-exclusive, non-sublicensable, and
* non-transferable license to use, install, execute, and perform the Spine
* Runtimes software and derivative works solely for personal or internal
* use. Without the written permission of Esoteric Software (see Section 2 of