Ejemplo n.º 1
0
        private static void CreateThumbnail <RendererType>() where RendererType : MvxMeshRenderer
        {
            GameObject thumbnailGO = new GameObject("DataStreamThumbnail");

            thumbnailGO.transform.SetParent(null);
            thumbnailGO.transform.localPosition = Vector3.zero;
            thumbnailGO.transform.localRotation = Quaternion.identity;
            thumbnailGO.transform.localScale    = new Vector3(0.01f, 0.01f, 0.01f);

            MvxFileDataStreamDefinition streamDefinition = ScriptableObject.CreateInstance <MvxFileDataStreamDefinition>();
            MvxDataStreamThumbnail      stream           = thumbnailGO.AddComponent <MvxDataStreamThumbnail>();

            stream.dataStreamDefinition = streamDefinition;
            MvxMeshRenderer renderer = thumbnailGO.AddComponent <RendererType>();

            renderer.mvxStream = stream;

            EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
        }
Ejemplo n.º 2
0
        private void DrawFrameIDProperty()
        {
            MvxDataStreamThumbnail stream = (MvxDataStreamThumbnail)target;

            if (!stream.isOpen || stream.mvxSourceInfo == null)
            {
                using (new EditorGUI.DisabledGroupScope(true))
                    EditorGUILayout.IntSlider(new GUIContent("Frame ID"), 0, 0, 0);
                return;
            }

            int  framesCount = (int)stream.mvxSourceInfo.GetNumFrames();
            uint frameId     = stream.frameId;
            uint newFrameId  = (uint)EditorGUILayout.IntSlider(new GUIContent("Frame ID"), (int)frameId, 0, framesCount - 1);

            if (frameId != newFrameId)
            {
                stream.frameId = newFrameId;
                EditorUtility.SetDirty(target);
            }
        }