public override void OnInspectorGUI() { DrawDefaultInspector(); HPV_Manager manager = SingletonService <HPV_Manager> .GetSingleton(); if (!manager) { return; } byte m_node_id = ((HPV_Node)target).getID(); GUILayoutOption[] options = { GUILayout.Width(250), GUILayout.Height(100) }; // global vertical EditorGUILayout.BeginVertical(options); EditorGUILayout.Separator(); // play controls horizontal EditorGUILayout.LabelField("Play Controls"); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button(playState_str, GUILayout.MinWidth(75), GUILayout.ExpandWidth(true), GUILayout.MinHeight(40), GUILayout.ExpandHeight(true))) { playState = !playState; if (playState) { playState_str = "Stop"; loop_in = 0; loop_out = manager.getNumberOfFrames(m_node_id); rangeMin = 0.0f; rangeMax = 1.0f; speed = 1.0f; prev_speed = 1.0f; seek = 0.0f; prev_seek = 0.0f; manager.startVideo(m_node_id); } else { playState_str = "Play"; manager.stopVideo(m_node_id); } } if (playState) { if (GUILayout.Button(pauzeState_str, GUILayout.MinWidth(75), GUILayout.ExpandWidth(true), GUILayout.MinHeight(40), GUILayout.ExpandHeight(true))) { pauzeState = !pauzeState; if (pauzeState) { pauzeState_str = "Resume"; manager.pauseVideo(m_node_id); } else { pauzeState_str = "Pauze"; manager.resumeVideo(m_node_id); } } } // end play controls horizontal EditorGUILayout.EndHorizontal(); // start pauze controls horizontal EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("<< BWD", GUILayout.MinWidth(75), GUILayout.ExpandWidth(true), GUILayout.MinHeight(40), GUILayout.ExpandHeight(true))) { manager.setDirection(m_node_id, false); } if (GUILayout.Button("FWD >>", GUILayout.MinWidth(75), GUILayout.ExpandWidth(true), GUILayout.MinHeight(40), GUILayout.ExpandHeight(true))) { manager.setDirection(m_node_id, true); } // end pauze controls horizontal EditorGUILayout.EndHorizontal(); EditorGUILayout.Separator(); EditorGUILayout.LabelField("Speed"); speed = EditorGUILayout.Slider(speed, -10, 10); if (!isNearlyEqual(speed, prev_speed)) { prev_speed = speed; manager.setSpeed(m_node_id, speed); } EditorGUILayout.Separator(); EditorGUILayout.LabelField("Loop"); loop_index = EditorGUILayout.Popup(loop_index, loop_options); if (loop_index != prev_loop_index) { manager.setLoopState(m_node_id, loop_index); prev_loop_index = loop_index; } EditorGUILayout.IntField(loop_in); EditorGUILayout.IntField(loop_out); EditorGUILayout.MinMaxSlider(ref rangeMin, ref rangeMax, 0.0f, 1.0f); if (GUILayout.Button("Update loop points")) { loop_in = (int)(rangeMin * (manager.getNumberOfFrames(m_node_id) - 1)); loop_out = (int)(rangeMax * (manager.getNumberOfFrames(m_node_id) - 1)); manager.setLoopIn(m_node_id, loop_in); manager.setLoopOut(m_node_id, loop_out); } EditorGUILayout.Separator(); EditorGUILayout.LabelField("Seek"); seek = EditorGUILayout.Slider(seek, 0.0f, 1.0f); if (!isNearlyEqual(seek, prev_seek)) { manager.seekToPos(m_node_id, seek); prev_seek = seek; } bShowStats = EditorGUILayout.Foldout(bShowStats, "Decode stats"); if (bShowStats) { if (bShowStats != prevShowStats) { manager.enableStats(m_node_id, bShowStats); prevShowStats = bShowStats; } IntPtr ptr = manager.getDecodeStatsPtr(m_node_id); HPV_Unity_Bridge.HPVDecodeStats decode_stats = (HPV_Unity_Bridge.HPVDecodeStats)Marshal.PtrToStructure(ptr, typeof(HPV_Unity_Bridge.HPVDecodeStats)); string stats = "HDD: " + (decode_stats.hdd_read_time / (float)1e6).ToString("F") + "ms"; stats += "\nL4Z: " + (decode_stats.l4z_decompress_time / (float)1e6).ToString("F") + "ms"; stats += "\nGPU: " + (decode_stats.gpu_upload_time / (float)1e6).ToString("F") + "ms"; EditorGUILayout.HelpBox(stats, MessageType.Info); Repaint(); } else if (!bShowStats && prevShowStats) { manager.enableStats(m_node_id, bShowStats); prevShowStats = bShowStats; } // end global vertical EditorGUILayout.EndVertical(); }