void HandleCancelAnnotation() { if (_rightController.GetPressUp(SteamVR_Controller.ButtonMask.ApplicationMenu) && _video != null && _annotationManager.staticAnnotationList.Count > 0) { int numberOfAnnotations = _annotationManager.staticAnnotationList.Count; StaticAnnotation lastAnnotation = _annotationManager.staticAnnotationList[numberOfAnnotations - 1]; lastAnnotation.reset(); _annotationManager.staticAnnotationList.Remove(lastAnnotation); _annotationManager.DrawAnnotationsOnTimeline(); //Debug.Log("pressed cancel annotation"); } }
public void HandleFloorAnnotation() { if (!bFloor) { Renderer[] renderers = currentAnimationGO.GetComponentsInChildren <Renderer>(); renderers[0].sharedMaterial = scribblerMaterial; // TODO renderers[1].sharedMaterial = scribblerMaterial; //currentAnimationGO.GetComponent<Renderer>().sharedMaterial.SetTexture("_MainTex", scribblerTexture); currentAnimationGO.SetActive(true); currentAnnotation = floorAnnotation = new FloorAnnotation(_video, _rightHand, _rightController, inputManager.PointerColor, _head); floorAnnotation.IsActive = true; floorAnnotation.setAnnotationDurationTextMesh(_annotationDurationGO.GetComponent <TextMesh>()); floorAnnotation.setID(currentAnnotationID); currentAnnotationID++; bFloor = true; } }
public void HandleSpeechAnnotation() { if (!bSpeechToText) { Renderer[] renderers = currentAnimationGO.GetComponentsInChildren <Renderer>(); renderers[0].sharedMaterial = speechMaterial; renderers[1].sharedMaterial = speechMaterial; //currentAnimationGO.GetComponent<Renderer>().sharedMaterial.SetTexture("_MainTex", speechTexture); currentAnimationGO.SetActive(true); currentAnnotation = speechAnnotation = new SpeechAnnotation(_video, _rightHand, _rightController, _head); speechAnnotation.IsActive = true; speechAnnotation.setAnnotationDurationTextMesh(_annotationDurationGO.GetComponent <TextMesh>()); speechAnnotation.setID(currentAnnotationID); currentAnnotationID++; bSpeechToText = true; } }
public void HandleMarkAnnotation(GameObject _head, GameObject _rightPointer) { if (!bMark) { Renderer[] renderers = currentAnimationGO.GetComponentsInChildren <Renderer>(); renderers[0].sharedMaterial = markMaterial; renderers[1].sharedMaterial = markMaterial; //currentAnimationGO.GetComponent<Renderer>().sharedMaterial.SetTexture("_MainTex", markTexture); currentAnimationGO.SetActive(true); currentAnnotation = markAnnotation = new MarkAnnotation(_video, _rightHand, _rightController, _head); markAnnotation.IsActive = true; markAnnotation.setAnnotationDurationTextMesh(_annotationDurationGO.GetComponent <TextMesh>()); markAnnotation.setID(currentAnnotationID); currentAnnotationID++; bMark = true; } }
public void HandleVisualEffectsAnnotation(GameObject _head, GameObject _rightPointer, string effectType) { if (!bVisualEffect) { Renderer[] renderers = currentAnimationGO.GetComponentsInChildren <Renderer>(); renderers[0].sharedMaterial = visualEffectsMaterial; renderers[1].sharedMaterial = visualEffectsMaterial; //currentAnimationGO.GetComponent<Renderer>().sharedMaterial.SetTexture("_MainTex", highlightPointsTexture); currentAnimationGO.SetActive(true); currentAnnotation = visualEffectAnnotation = new VisualEffectAnnotation(_video, _rightHand, _rightController, _head, inputManager.PointerColor, effectType); visualEffectAnnotation.IsActive = true; visualEffectAnnotation.setAnnotationDurationTextMesh(_annotationDurationGO.GetComponent <TextMesh>()); visualEffectAnnotation.setID(currentAnnotationID); currentAnnotationID++; bVisualEffect = true; } }
void LoadAnnotations() { _annotationManager.resetStaticAnnotationList(); string name = _video.configFile; name = name.Replace(".ini", ".xml"); if (System.IO.File.Exists(name)) { XmlDocument d = new XmlDocument(); d.Load(XmlReader.Create(name)); XmlNodeList l = d.SelectNodes("/Annotations/Annotation"); foreach (XmlNode n in l) { string type = n.Attributes["type"].Value; System.Type t = System.Type.GetType(type); StaticAnnotation a = System.Activator.CreateInstance(t, _video, _rightHand, _rightController, _head) as StaticAnnotation; a.deserialize(n.InnerText); _annotationManager.staticAnnotationList.Add(a); } } }
// Use this for initialization public void init() { IsAnnotationActive = false; currentAnimationGO = GameObject.Instantiate(Resources.Load("Prefabs/CurrentAnnotation")) as GameObject; currentAnimationGO.SetActive(false); bVisualEffect = false; bScribbler = false; bSpeechToText = false; bMark = false; IsPlayingVideo = false; //Load menu buttons materials speechMaterial = Resources.Load("Materials/speechToTextMat") as Material; scribblerMaterial = Resources.Load("Materials/scribblerMat") as Material; visualEffectsMaterial = Resources.Load("Materials/highlightPointsMat") as Material; markMaterial = Resources.Load("Materials/markMat") as Material; deleteTexture = Resources.Load("Textures/deleteActive") as Texture; scribblerAnnotation = null; visualEffectAnnotation = null; markAnnotation = null; speechAnnotation = null; staticAnnotationList = new List <StaticAnnotation>(); currentTime = 0.0f; currentAnnotationID = 0; currentAnnotation = null; inputManager = GameObject.Find("Controller (right)").GetComponentInChildren <InputManager>(); currentAnnotationSelected = -1; DrawAnnotationsOnTimeline(); }