Skip to content

Instantly share code, notes, and snippets.

@CheapDevotion
CheapDevotion / BVHImporter.cs
Last active June 12, 2023 18:42
A simple Unity Editor utility that converts bvh (animation) files to fbx using the Blender Python API and imports them into your project.
using UnityEngine;
using UnityEditor;
using System.IO;
using System.Diagnostics;
public class BVHImporter : EditorWindow {
public const string BLENDER_EXEC = @"C:\Program Files\Blender Foundation\Blender\blender.exe";
public const string PHYTHON_CODE = @"import bpy;import sys;argv = sys.argv;argv = argv[argv.index(\""--\"") + 1:];bvh_in = argv[0];fbx_out = argv[0] + \"".fbx\"";objs = bpy.data.objects;bpy.ops.import_anim.bvh(filepath=bvh_in, filter_glob=\""*.bvh\"", global_scale=1, frame_start=1, use_fps_scale=False, use_cyclic=False, rotate_mode='NATIVE', axis_forward='-Z', axis_up='Y');objs.remove(objs[\""Cube\""], True);objs.remove(objs[\""Lamp\""], True);objs.remove(objs[\""Camera\""], True);bpy.ops.export_scene.fbx(filepath=fbx_out, axis_forward='-Z', axis_up='Y', use_anim=True, use_selection=True, use_default_take=False);";
1 210-AFTR Alienware 15 $640.99
1 310-0173 Airborne Documentation, System Exchanges,Factory Install $0.00
1 332-1286 US Order $0.00
1 332-1530 Dell.com Order $0.00
1 332-1530 Dell.com Order $0.00
1 338-BIFZ Intel(R) Core(TM) i7-6700HQ (Quad-Core, 6MB Cache, up to 3.5GHz w/ Turbo Boost) $150.00
1 340-AAPP Directship Info Mod $0.00
1 340-ACQQ No Option Included $0.00
1 340-AGUD Safety/Environment and Regulatory Guide (English/French) $0.00
1 340-ASNB Placemat (English,French,BRPT,Spanish) $0.00
------------------
System Information
------------------
Operating System: Windows 8.1 Enterprise 64-bit (6.3, Build 9600) (9600.winblue_ltsb.150715-0840)
Language: English (Regional Setting: English)
System Manufacturer: Dell Inc.
System Model: XPS 8500
BIOS: BIOS Date: 05/25/12 17:09:41 Ver: 04.06.05
Processor: Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz (8 CPUs), ~3.4GHz
Memory: 32768MB RAM
@CheapDevotion
CheapDevotion / GroupSelection.cs
Last active August 29, 2015 14:14
A UnityEditor script that provides a hotkey for quickly grouping GameObjects.
using UnityEngine;
using System.Collections;
using UnityEditor;
public class ParentSelection : ScriptableObject {
[MenuItem("OffTheGrid/Group Objects %g")]
static void GroupObjects()
{
GameObject[] objects = Selection.gameObjects;
@CheapDevotion
CheapDevotion / LayerSelectWizard.cs
Created January 19, 2015 01:59
A simple wizard for selecting or hiding scene objects based on layer.
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
public class LayerSelectWizard : ScriptableWizard
{
public LayerMask selectedLayers;
@CheapDevotion
CheapDevotion / Tree.cs
Last active August 29, 2015 13:57
Unity Recursive Trees
/// Let's draw trees with a recursive algorithm in Unity!
/// 2014 Aaron San Filippo (@AeornFlippout)
/// Let me know if you have fun with this or make any cool additions :)
//INSTRUCTIONS:
//1. attach this component to an object in your scene that the camera can see.
// (see further instructions below)
using UnityEngine;
@CheapDevotion
CheapDevotion / select2json.js
Created September 4, 2012 16:54
Converts an html select list to a javascript object.
var array = new Object();
$("#select option").each(function() {
var optgroup = $(this).parent().attr("label");
if (optgroup != undefined) {
if (array[optgroup] == undefined) {
array[optgroup] = new Object();
}
array[optgroup][$(this).val()] = $(this).text();
}