-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
52 changed files
with
5,926 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
/*/ | ||
!com.vrchat.core.*/ | ||
!com.acchosen.vr-stage-lighting |
155 changes: 155 additions & 0 deletions
155
Packages/com.acchosen.vr-stage-lighting/Editor/VRSL DMX Default Fixture Definitions.asset
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
%YAML 1.1 | ||
%TAG !u! tag:unity3d.com,2011: | ||
--- !u!114 &11400000 | ||
MonoBehaviour: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
m_GameObject: {fileID: 0} | ||
m_Enabled: 1 | ||
m_EditorHideFlags: 0 | ||
m_Script: {fileID: 11500000, guid: 5234e5a618f589b49aa604ad3e28f500, type: 3} | ||
m_Name: VRSL DMX Default Fixture Definitions | ||
m_EditorClassIdentifier: | ||
definitions: | ||
- name: SpotLight 13CH | ||
channelNames: | ||
- Pan | ||
- Fine Pan | ||
- Tilt | ||
- Fine Tilt | ||
- Zoom | ||
- Dimmer | ||
- Strobe | ||
- Red | ||
- Green | ||
- Blue | ||
- GOBO Spin | ||
- GOBO Select | ||
- Movement Speed | ||
foldOut: 0 | ||
- name: WashLight 13CH | ||
channelNames: | ||
- Pan | ||
- Fine Pan | ||
- Tilt | ||
- Fine Tilt | ||
- Zoom | ||
- Dimmer | ||
- Red | ||
- Green | ||
- Blue | ||
- None | ||
- None | ||
- None | ||
- Movement Speed | ||
foldOut: 0 | ||
- name: ParLight 13CH | ||
channelNames: | ||
- None | ||
- None | ||
- None | ||
- None | ||
- None | ||
- Dimmer | ||
- Strobe | ||
- Red | ||
- Green | ||
- Blue | ||
- None | ||
- None | ||
- None | ||
foldOut: 0 | ||
- name: Blinder 13CH | ||
channelNames: | ||
- None | ||
- None | ||
- None | ||
- None | ||
- None | ||
- Dimmer | ||
- Strobe | ||
- Red | ||
- Green | ||
- Blue | ||
- None | ||
- None | ||
- None | ||
foldOut: 0 | ||
- name: LightBar 13CH | ||
channelNames: | ||
- None | ||
- None | ||
- None | ||
- None | ||
- None | ||
- Dimmer | ||
- Strobe | ||
- Red | ||
- Green | ||
- Blue | ||
- None | ||
- None | ||
- None | ||
foldOut: 0 | ||
- name: ParLight 5CH | ||
channelNames: | ||
- Dimmer | ||
- Red | ||
- Green | ||
- Blue | ||
- Strobe | ||
foldOut: 0 | ||
- name: Blinder 5CH | ||
channelNames: | ||
- Dimmer | ||
- Red | ||
- Green | ||
- Blue | ||
- Strobe | ||
foldOut: 0 | ||
- name: LightBar 5CH | ||
channelNames: | ||
- Dimmer | ||
- Red | ||
- Green | ||
- Blue | ||
- Strobe | ||
foldOut: 0 | ||
- name: Flasher 1CH | ||
channelNames: | ||
- Dimmer | ||
foldOut: 0 | ||
- name: DiscoBall 1CH | ||
channelNames: | ||
- Dimmer | ||
foldOut: 0 | ||
- name: Laser 13CH | ||
channelNames: | ||
- Pan | ||
- Tilt | ||
- Length | ||
- Width | ||
- Flatness | ||
- Beam Count | ||
- Spin Speed | ||
- Red | ||
- Green | ||
- Blue | ||
- Dimmer | ||
- Beam Thickness | ||
- Movement Speed | ||
foldOut: 0 | ||
- name: Generic 5CH | ||
channelNames: | ||
- Dimmer | ||
- Red | ||
- Green | ||
- Blue | ||
- Strobe | ||
foldOut: 0 | ||
- name: Other | ||
channelNames: | ||
- Unknown | ||
foldOut: 1 |
8 changes: 8 additions & 0 deletions
8
...ges/com.acchosen.vr-stage-lighting/Editor/VRSL DMX Default Fixture Definitions.asset.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
227 changes: 227 additions & 0 deletions
227
Packages/com.acchosen.vr-stage-lighting/Editor/VRSL_DMXPatchExporter.cs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,227 @@ | ||
#if !COMPILER_UDONSHARP && UNITY_EDITOR | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
using UnityEditor; | ||
using UdonSharpEditor; | ||
using UnityEngine.SceneManagement; | ||
using System.IO; | ||
using System; | ||
|
||
namespace VRSL.EditorScripts | ||
{ | ||
public class VRSL_DMXPatchExporter : Editor | ||
{ | ||
private static VRSL_LocalUIControlPanel panel; | ||
private static List<GameObject> sceneObjects = new List<GameObject>(); | ||
public static bool hasLocalPanel; | ||
static List<GameObject> GetAllObjectsOnlyInScene() | ||
{ | ||
List<GameObject> objectsInScene = new List<GameObject>(); | ||
|
||
foreach (GameObject go in Resources.FindObjectsOfTypeAll(typeof(GameObject)) as GameObject[]) | ||
{ | ||
if (!EditorUtility.IsPersistent(go.transform.root.gameObject) && !(go.hideFlags == HideFlags.NotEditable || go.hideFlags == HideFlags.HideAndDontSave)) | ||
objectsInScene.Add(go); | ||
} | ||
|
||
return objectsInScene; | ||
} | ||
private static void CheckForLocalPanel() | ||
{ | ||
sceneObjects = GetAllObjectsOnlyInScene(); | ||
hasLocalPanel = false; | ||
panel = null; | ||
// colorLabel = new GUIContent(); | ||
// colorLabel.text = "Emission Color"; | ||
foreach (GameObject go in sceneObjects) | ||
{ | ||
#pragma warning disable 0618 //suppressing obsoletion warnings | ||
panel = go.GetUdonSharpComponent<VRSL_LocalUIControlPanel>(); | ||
#pragma warning restore 0618 | ||
if(panel != null) | ||
{ | ||
hasLocalPanel = true; | ||
break; | ||
} | ||
} | ||
return; | ||
} | ||
|
||
|
||
[MenuItem("VRSL/Save Patch Data", priority = 500)] | ||
public static void SavePatchData() | ||
{ | ||
CheckForLocalPanel(); | ||
if(!hasLocalPanel){Debug.LogWarning("VRSL Patch Exporter: Please make sure there is a VRSL-LocalUIControlPanel in your scene before attempting to save."); return;} | ||
if(panel.fixtureSaveFile == "NONE") | ||
{ | ||
try | ||
{ | ||
VRSL_DMXPatchSettings asset = ScriptableObject.CreateInstance<VRSL_DMXPatchSettings>(); | ||
asset.SetDMXFixtureData(); | ||
string name = "VRSL DMX Patch Data_" + SceneManager.GetActiveScene().name + ".asset"; | ||
string parentDirectory = "VRSL DMX Patch Folder"; | ||
if(AssetDatabase.IsValidFolder("Assets/" + parentDirectory) == false) | ||
{ | ||
AssetDatabase.CreateFolder("Assets", parentDirectory); | ||
} | ||
string path = "Assets/" + parentDirectory + "/" + name; | ||
AssetDatabase.CreateAsset(asset, path); | ||
// AssetDatabase.SaveAssets(); | ||
|
||
// EditorUtility.FocusProjectWindow(); | ||
|
||
// Selection.activeObject = asset; | ||
|
||
|
||
SerializedObject so = new SerializedObject(panel); | ||
so.FindProperty("fixtureSaveFile").stringValue = AssetDatabase.GUIDFromAssetPath(path).ToString(); | ||
so.ApplyModifiedProperties(); | ||
#pragma warning disable 0618 //suppressing obsoletion warnings | ||
panel.UpdateProxy(); | ||
#pragma warning restore 0618 //suppressing obsoletion warnings | ||
panel.fixtureSaveFile = so.FindProperty("fixtureSaveFile").stringValue; | ||
#pragma warning disable 0618 //suppressing obsoletion warnings | ||
panel.ApplyProxyModifications(); | ||
#pragma warning restore 0618 //suppressing obsoletion warnings | ||
|
||
/// asset = (VRSL_DMXPatchSettings) AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(panel.fixtureSaveFile), typeof(VRSL_DMXPatchSettings)); | ||
// asset.SetScene(); | ||
// asset.SetDMXFixtureData(); | ||
asset.ForceSave(); | ||
} | ||
catch | ||
{ | ||
Debug.LogError("VRSL Patch Exporter: Failed to create patch data."); | ||
} | ||
} | ||
else | ||
{ | ||
try | ||
{ | ||
VRSL_DMXPatchSettings asset = (VRSL_DMXPatchSettings) AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(panel.fixtureSaveFile), typeof(VRSL_DMXPatchSettings)); | ||
asset.SetScene(); | ||
asset.SetDMXFixtureData(); | ||
asset.ForceSave(); | ||
} | ||
catch (NullReferenceException e) | ||
{ | ||
// Debug.LogError("VRSL Patch Exporter: Could not find patch data file. Removing Link patch data link."); | ||
e.GetType(); | ||
SerializedObject so = new SerializedObject(panel); | ||
so.FindProperty("fixtureSaveFile").stringValue = "NONE"; | ||
so.ApplyModifiedProperties(); | ||
#pragma warning disable 0618 //suppressing obsoletion warnings | ||
panel.UpdateProxy(); | ||
#pragma warning restore 0618 //suppressing obsoletion warnings | ||
panel.fixtureSaveFile = so.FindProperty("fixtureSaveFile").stringValue; | ||
#pragma warning disable 0618 //suppressing obsoletion warnings | ||
panel.ApplyProxyModifications(); | ||
#pragma warning restore 0618 //suppressing obsoletion warnings | ||
SavePatchData(); | ||
} | ||
catch(Exception e) | ||
{ | ||
Debug.LogError("VRSL Patch Exporter: Failed to save patch data."); | ||
e.GetType(); | ||
} | ||
} | ||
|
||
|
||
} | ||
[MenuItem("VRSL/Load Patch Data", priority = 501)] | ||
public static void LoadPatchData() | ||
{ | ||
CheckForLocalPanel(); | ||
if(!hasLocalPanel){Debug.LogWarning("VRSL Patch Exporter: Please make sure there is a VRSL-LocalUIControlPanel in your scene before attempting to Load."); return;} | ||
if(panel.fixtureSaveFile != "NONE") | ||
{ | ||
try | ||
{ | ||
VRSL_DMXPatchSettings asset = (VRSL_DMXPatchSettings) AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(panel.fixtureSaveFile), typeof(VRSL_DMXPatchSettings)); | ||
asset.LoadDMXFixtureData(); | ||
} | ||
catch | ||
{ | ||
Debug.LogError("VRSL Patch Exporter: Failed to load patch data."); | ||
} | ||
} | ||
else | ||
{ | ||
Debug.LogError("VRSL Patch Exporter: Fixture Save File Not Found. The file may have been lost or has not been created yet."); | ||
} | ||
} | ||
[MenuItem("VRSL/Export/To JSON", priority = 502)] | ||
public static void ExportToJSON() | ||
{ | ||
CheckForLocalPanel(); | ||
if(!hasLocalPanel){Debug.LogWarning("VRSL Patch Exporter: Please make sure there is a VRSL-LocalUIControlPanel in your scene before attempting to export."); return;} | ||
if(panel.fixtureSaveFile != "NONE") | ||
{ | ||
try | ||
{ | ||
VRSL_DMXPatchSettings asset = (VRSL_DMXPatchSettings) AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(panel.fixtureSaveFile), typeof(VRSL_DMXPatchSettings)); | ||
asset.ToJsonFile(true); | ||
} | ||
catch | ||
{ | ||
Debug.LogError("VRSL Patch Exporter: Failed to export patch data."); | ||
} | ||
} | ||
else | ||
{ | ||
Debug.LogError("VRSL Patch Exporter: Fixture Save File Not Found. The file may have been lost or has not been created yet."); | ||
} | ||
} | ||
|
||
[MenuItem("VRSL/Export/To MVR", priority = 503)] | ||
public static void ExportToMVR() | ||
{ | ||
CheckForLocalPanel(); | ||
if(!hasLocalPanel){Debug.LogWarning("VRSL Patch Exporter: Please make sure there is a VRSL-LocalUIControlPanel in your scene before attempting to export."); return;} | ||
if(panel.fixtureSaveFile != "NONE") | ||
{ | ||
try | ||
{ | ||
VRSL_DMXPatchSettings asset = (VRSL_DMXPatchSettings) AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(panel.fixtureSaveFile), typeof(VRSL_DMXPatchSettings)); | ||
asset.ToMVRFile(); | ||
} | ||
catch | ||
{ | ||
Debug.LogError("VRSL Patch Exporter: Failed to export patch data."); | ||
throw; | ||
} | ||
} | ||
else | ||
{ | ||
Debug.LogError("VRSL Patch Exporter: Fixture Save File Not Found. The file may have been lost or has not been created yet."); | ||
} | ||
} | ||
|
||
[MenuItem("VRSL/Export/To PDF", priority = 504)] | ||
public static void ExportToPDF() | ||
{ | ||
CheckForLocalPanel(); | ||
if(!hasLocalPanel){Debug.LogWarning("VRSL Patch Exporter: Please make sure there is a VRSL-LocalUIControlPanel in your scene before attempting to export."); return;} | ||
if(panel.fixtureSaveFile != "NONE") | ||
{ | ||
try | ||
{ | ||
VRSL_DMXPatchSettings asset = (VRSL_DMXPatchSettings) AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(panel.fixtureSaveFile), typeof(VRSL_DMXPatchSettings)); | ||
asset.ToPDF(); | ||
} | ||
catch | ||
{ | ||
Debug.LogError("VRSL Patch Exporter: Failed to export patch data."); | ||
throw; | ||
} | ||
} | ||
else | ||
{ | ||
Debug.LogError("VRSL Patch Exporter: Fixture Save File Not Found. The file may have been lost or has not been created yet."); | ||
} | ||
} | ||
} | ||
} | ||
#endif |
Oops, something went wrong.