close #29
This commit is contained in:
parent
78023946cd
commit
f29a1549c5
2 changed files with 23 additions and 10 deletions
|
@ -1,5 +1,4 @@
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace cylvester
|
namespace cylvester
|
||||||
{
|
{
|
||||||
|
@ -17,20 +16,35 @@ namespace cylvester
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnEnable()
|
private void OnEnable()
|
||||||
{
|
{
|
||||||
object[] foundObjects = FindObjectsOfType(typeof(PdBackend));
|
var foundObjects = FindObjectsOfType(typeof(PdBackend));
|
||||||
|
if (foundObjects.Length != 1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
pdBackend_ = (IPdBackend) foundObjects[0];
|
||||||
dspToggle_ = new EditorToggle();
|
dspToggle_ = new EditorToggle();
|
||||||
togglePresenter_ = new TogglePresenter(dspToggle_, pdBackend_);
|
|
||||||
|
togglePresenter_ = new TogglePresenter(dspToggle_, pdBackend_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnGUI ()
|
private void OnGUI ()
|
||||||
{
|
{
|
||||||
foundObjects.
|
if(!ValidatePdBackend(pdBackend_))
|
||||||
|
return;
|
||||||
|
|
||||||
dspToggle_.State = EditorGUILayout.Toggle("Pure Data Process", dspToggle_.State);
|
dspToggle_.State = EditorGUILayout.Toggle("Pure Data Process", dspToggle_.State);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool ValidatePdBackend(IPdBackend pdBackend)
|
||||||
|
{
|
||||||
|
var exist = pdBackend_ != null;
|
||||||
|
if (!exist)
|
||||||
|
{
|
||||||
|
EditorGUILayout.LabelField("No Pd backend found in the scene");
|
||||||
|
}
|
||||||
|
return exist;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,8 +20,7 @@ namespace cylvester
|
||||||
|
|
||||||
onToggleChanged_ = () =>
|
onToggleChanged_ = () =>
|
||||||
{
|
{
|
||||||
var state = editorToggle_.State;
|
pdBackend.State = editorToggle_.State;
|
||||||
// apply state to pd backend;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
editorToggle_.ToggleStateChanged += onToggleChanged_;
|
editorToggle_.ToggleStateChanged += onToggleChanged_;
|
||||||
|
|
Loading…
Reference in a new issue