//---------------------------------------------------------------------------------------------------------------------- /// <summary> /// StreamingImageSequencePlayableAsset GUI Drawing /// </summary> public override void OnInspectorGUI() { if (null == m_asset) return; Undo.RecordObject(m_asset, "StreamingImageSequencePlayableAssetInspector::OnInspectorGUI"); using (new EditorGUILayout.VerticalScope (GUI.skin.box)) { m_resolutionFoldout = EditorGUILayout.Foldout(m_resolutionFoldout, "Resolution"); if (m_resolutionFoldout) { ImageDimensionInt res = m_asset.GetResolution(); EditorGUILayout.LabelField("Width", $"{res.Width } px"); EditorGUILayout.LabelField("Height", $"{res.Height } px"); } GUILayout.Space(4f); } GUILayout.Space(4f); using (new EditorGUILayout.VerticalScope(GUI.skin.box)) { GUILayout.Label("Folder", "BoldLabel"); GUILayout.Space(4f); DrawFolderGUI(); } GUILayout.Space(4f); using (new EditorGUILayout.VerticalScope(GUI.skin.box)) { int numImages = m_asset.GetNumImages(); EditorGUILayout.BeginHorizontal(); GUILayout.Label("Images: " + numImages, "BoldLabel"); if (GUILayout.Button("Reload", GUILayout.Width(50))) { m_asset.Reload(); } EditorGUILayout.EndHorizontal(); using (new EditorGUI.DisabledScope(0 == numImages)) { if (0 == numImages) EditorGUILayout.IntField("FPS", 0); else { TimelineClip clip = m_asset.GetBoundTimelineClipSISData().GetOwner(); float prevFps = numImages / (float)(clip.duration); float fps = EditorGUILayout.FloatField("FPS", prevFps); if (!Mathf.Approximately(fps, prevFps) && !Mathf.Approximately(fps, 0.0f)) { double prevDuration = clip.duration; clip.duration = numImages / fps; clip.timeScale = (prevDuration * clip.timeScale) / clip.duration; } } } GUILayout.Space(4f); m_imageListFoldout = EditorGUILayout.Foldout(m_imageListFoldout, "Images"); if (m_imageListFoldout) { DoImageGUI(); } } if (null == TimelineEditor.selectedClip) return; GUILayout.Space(15); //Frame markers if (TimelineEditor.selectedClip.asset == m_asset) { InspectorUtility.ShowFrameMarkersGUI(m_asset); } GUILayout.Space(15); using (new EditorGUILayout.VerticalScope(GUI.skin.box)) { EditorGUILayout.LabelField("Background Colors"); ++EditorGUI.indentLevel; Color timelineBgColor = m_asset.GetTimelineBGColor(); m_asset.SetTimelineBGColor(EditorGUILayout.ColorField("In Timeline Window", timelineBgColor)); --EditorGUI.indentLevel; GUILayout.Space(15); } if (GUILayout.Button("Reset Curve (Not Undoable)")) { //AnimationClip.SetCurve() doesn't seem to be undoable StreamingImageSequencePlayableAsset.ResetTimelineClipCurve(TimelineEditor.selectedClip); } }
//---------------------------------------------------------------------------------------------------------------------- /// <summary> /// StreamingImageSequencePlayableAsset GUI Drawing /// </summary> public override void OnInspectorGUI() { if (null == m_asset) return; using (new EditorGUILayout.VerticalScope (GUI.skin.box)) { m_resolutionFoldout = EditorGUILayout.Foldout(m_resolutionFoldout, "Resolution"); if (m_resolutionFoldout) { ImageDimensionInt res = m_asset.GetResolution(); EditorGUILayout.LabelField("Width", $"{res.Width } px"); EditorGUILayout.LabelField("Height", $"{res.Height } px"); } GUILayout.Space(4f); } GUILayout.Space(4f); using (new EditorGUILayout.VerticalScope(GUI.skin.box)) { GUILayout.Label("Folder", "BoldLabel"); GUILayout.Space(4f); DrawFolderGUI(); } GUILayout.Space(4f); using (new EditorGUILayout.VerticalScope(GUI.skin.box)) { int numImages = m_asset.GetNumImages(); EditorGUILayout.BeginHorizontal(); GUILayout.Label("Images: " + numImages, "BoldLabel"); if (GUILayout.Button("Reload", GUILayout.Width(50))) { m_asset.Reload(); } EditorGUILayout.EndHorizontal(); using (new EditorGUI.DisabledScope(0 == numImages)) { if (0 == numImages) EditorGUILayout.IntField("FPS", 0); else { TimelineClip clip = m_asset.GetBoundClipData()?.GetOwner(); //There is no assigned clip if the playableAsset is not loaded in TimelineWindow if (null != clip) { EditorGUIDrawerUtility.DrawUndoableGUI(clip.GetParentTrack(), "Change FPS", /*guiFunc=*/ ()=> { float fps = SISPlayableAssetUtility.CalculateFPS(m_asset); float val = EditorGUILayout.FloatField("FPS", fps); return Mathf.Max(0.1f, val); }, /*updateFunc=*/ (float newFPS) => { SISPlayableAssetUtility.SetFPS(m_asset, newFPS); } ); } } } GUILayout.Space(4f); m_imageListFoldout = EditorGUILayout.Foldout(m_imageListFoldout, "Images"); if (m_imageListFoldout) { DoImageGUI(); } } if (null == TimelineEditor.selectedClip) return; GUILayout.Space(15); //Frame markers if (TimelineEditor.selectedClip.asset == m_asset) { using (new EditorGUILayout.HorizontalScope()) { InspectorUtility.DrawFrameMarkersGUI(m_asset); if (GUILayout.Button("Reset", GUILayout.Width(50f))) { m_asset.ResetPlayableFrames(); } } } GUILayout.Space(15); using (new EditorGUILayout.VerticalScope(GUI.skin.box)) { EditorGUILayout.LabelField("Background Colors"); ++EditorGUI.indentLevel; EditorGUIDrawerUtility.DrawUndoableGUI(m_asset, "Change BG Color", /*guiFunc=*/ ()=> EditorGUILayout.ColorField("In Timeline Window", m_asset.GetTimelineBGColor()), /*updateFunc=*/ (Color newColor) => { m_asset.SetTimelineBGColor(newColor); } ); --EditorGUI.indentLevel; GUILayout.Space(15); } if (GUILayout.Button("Reset Curve (Not Undoable)")) { //AnimationUtility.SetEditorCurve(), which is called below, doesn't seem to be undoable EditorCurveBinding curveBinding = StreamingImageSequencePlayableAsset.GetTimeCurveBinding(); ExtendedClipEditorUtility.ResetClipDataCurve(m_asset, curveBinding); } }
//---------------------------------------------------------------------------------------------------------------------- /// <summary> /// StreamingImageSequencePlayableAsset GUI Drawing /// </summary> public override void OnInspectorGUI() { if (null == m_asset) return; EditorGUI.BeginChangeCheck(); serializedObject.Update(); Undo.RecordObject(m_asset, "StreamingImageSequencePlayableAssetInspector::OnInspectorGUI"); using (new EditorGUILayout.VerticalScope (GUI.skin.box)) { m_resolutionFoldout = EditorGUILayout.Foldout(m_resolutionFoldout, "Resolution"); if (m_resolutionFoldout) { ImageDimensionInt res = m_asset.GetResolution(); EditorGUILayout.LabelField("Width", $"{res.Width } px"); EditorGUILayout.LabelField("Height", $"{res.Height } px"); } GUILayout.Space(4f); } GUILayout.Space(4f); using (new EditorGUILayout.VerticalScope(GUI.skin.box)) { GUILayout.Label("Folder", "BoldLabel"); GUILayout.Space(4f); DoFolderGUI(); } GUILayout.Space(4f); using (new EditorGUILayout.VerticalScope(GUI.skin.box)) { int numImages = 0; if (m_asset.HasImages()) { numImages = m_asset.GetImageFileNames().Count; } EditorGUILayout.BeginHorizontal(); GUILayout.Label("Images: " + numImages, "BoldLabel"); if (GUILayout.Button("Reload", GUILayout.Width(50))) { m_asset.Reload(); } EditorGUILayout.EndHorizontal(); GUILayout.Space(4f); m_imageListFoldout = EditorGUILayout.Foldout(m_imageListFoldout, "Images"); if (m_imageListFoldout) { DoImageGUI(); } } if (null!= TimelineEditor.selectedClip) { GUILayout.Space(15); //Frame markers if (TimelineEditor.selectedClip.asset == m_asset) { InspectorUtility.ShowFrameMarkersGUI(m_asset); } GUILayout.Space(15); if (GUILayout.Button("Reset Curve (Not Undoable)")) { //AnimationClip.SetCurve() doesn't seem to be undoable StreamingImageSequencePlayableAsset.ResetTimelineClipCurve(TimelineEditor.selectedClip); } } serializedObject.ApplyModifiedProperties(); EditorGUI.EndChangeCheck(); }