Created
January 20, 2012 07:31
-
-
Save keijiro/1646002 to your computer and use it in GitHub Desktop.
CustomizedLightProbeGroupEditor.js
This file contains hidden or 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
#pragma strict | |
@CustomEditor(LightProbeGroup) | |
class CustomizedLightProbeGroupEditor extends Editor { | |
var probeNumber : int; | |
function OnEnable() { | |
probeNumber = (target as LightProbeGroup).probePositions.Length; | |
} | |
function OnInspectorGUI() { | |
probeNumber = EditorGUILayout.IntField("Number of probes", probeNumber); | |
if (GUILayout.Button("Recreate Probes")) { | |
var positions : Vector3[] = new Vector3[probeNumber]; | |
for (var i = 0; i < positions.Length; ++i) { | |
positions[i] = Random.insideUnitSphere; | |
} | |
(target as LightProbeGroup).probePositions = positions; | |
} | |
} | |
function OnSceneGUI() { | |
var group = target as LightProbeGroup; | |
for (var position in group.probePositions) { | |
Handles.DotCap(0, group.transform.TransformPoint(position), Quaternion.identity, 0.1); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment