void OnGUI() { if (GUI.Button(new Rect(20, 220, 220, 30), "Editable " + editable)) { editable = !editable; } if (GUI.Button(new Rect(20, 20, 100, 30), "Change Skin")) { skinId++; if (skinId % 2 == 1) { skin.material = translucentSkin; } else { skin.material = basicSkin; } } if (GUI.Button(new Rect(20, 60, 100, 30), "Switch Opacity")) { opacityArg++; FaceTracing faceTracing = GetComponent <FaceTracing>(); Material opacityMaterial; if (opacityArg % 2 == 1) { opacityMaterial = transparent; } else { opacityMaterial = opaque; } faceTracing.switchOpacity(opacityMaterial, opacityArg); } if (GUI.Button(new Rect(20, 100, 100, 30), "Show Grid")) { if (gridScript != null) { gridScript.SwitchVisibleStatus(); gridScript.SwitchVisibleTracking(); } if (gridScript2 != null) { gridScript2.SwitchVisibleStatus(); gridScript2.SwitchVisibleTracking(); } } if (GUI.Button(new Rect(20, 150, 100, 30), "Save Group")) { //gridScript.SwitchVisibleStatus(); saveGroup = true; inputField.SetActive(true); //InputField field = inputField.GetComponent<InputField>(); //field.text = groupName; } if (saveGroup) { if (Input.GetKeyDown(KeyCode.Return)) { InputField field = inputField.GetComponent <InputField>(); string fieldText = field.text; if (fieldText.Length > 0) { //save FaceTracing faceTracing = GetComponent <FaceTracing>(); saveGroupFile(faceTracing.returnGroupIndexes(), faceTracing.returnTrackingStrengths(), fieldText); } saveGroup = false; inputField.SetActive(false); } } GUI.Button(new Rect(20, 250, 150, 30), "Strength:" + power); if (Input.GetKey(KeyCode.X)) { if (power > 0) { power--; } } if (Input.GetKey(KeyCode.C)) { if (power < 100) { power++; } } float hM = 30; float wM = 120; float yM = Screen.height - modificatorModes.Count * hM; for (int i = 0; i < modificatorModes.Count; i++) { if (GUI.Button(new Rect(0, yM, wM, hM), modificatorModes[i])) { modificatorModeValue = i; } yM += hM; } }
void OnGUI() { //float sX = Screen.width / 20; //float sW = Screen.width; //float sY = Screen.height - Screen.height / 8; //float sH = Screen.height / 8; //GUI.Button(new Rect(0, sY, sW, sH), ""); Rect renderRect = new Rect(rx, ry, rw, rh); if (!fullScreen) { GUI.DrawTexture(renderRect, renderCam); } float modeW = 100; float modeY = 140; for (int i = 0; i < modes.Count; i++) { GUI.color = Color.white; if (i == modeValue) { GUI.color = Color.yellow; } if (GUI.Button(new Rect(0 + modeW * i, modeY, modeW, 30), modes[i])) { modeValue = i; selectionMode(); } } GUI.color = Color.white; switch (modeValue) { case 0: //SELECTION MODE //CHANGE HUMAN SKIN OPACITY if (GUI.Button(new Rect(20, 20, 100, 30), "Change Skin")) { skinId++; if (skinId % 2 == 1) { skin.material = translucentSkin; } else { skin.material = basicSkin; } } if (GUI.Button(new Rect(20, 60, 100, 30), "Switch Opacity")) { opacityArg++; SkinnedFaceTracing faceTracing = GetComponent <SkinnedFaceTracing>(); Material opacityMaterial; opacityMaterial = opaque; if (opacityArg % 2 == 1) { opacityMaterial = transparent; } faceTracing.switchOpacity(opacityMaterial, opacityArg); } if (GUI.Button(new Rect(20, 150, 100, 30), "Save Group")) { saveGroup = true; fieldActive = !fieldActive; inputField.SetActive(fieldActive); faceNameField.SetActive(false); } GUI.Button(new Rect(20, 250, 150, 30), "Strength:" + power); if (saveGroup) { if (Input.GetKeyDown(KeyCode.Return)) { fieldActive = false; InputField field = inputField.GetComponent <InputField>(); string fieldText = field.text; if (fieldText.Length > 0) { saveGroupFile(faceTracing.returnVertexIndexes(), faceTracing.returnTrackingStrengths(), fieldText); } saveGroup = false; inputField.SetActive(false); } } if (GUI.Button(new Rect(20, 280, 100, 30), "Save Face")) { saveFace = true; saveFaceActive = !saveFaceActive; faceNameField.SetActive(saveFaceActive); inputField.SetActive(false); } if (saveFace) { if (Input.GetKeyDown(KeyCode.Return)) { print("try to"); saveFaceActive = false; InputField field = faceNameField.GetComponent <InputField>(); string fieldText = field.text; if (fieldText.Length > 0) { saveFaceFile(fieldText); } saveFace = false; faceNameField.SetActive(false); } } break; case 1: //EDIT MODE if (GUI.Button(new Rect(20, 100, 100, 30), "Show Grid")) { gridScript2.SwitchVisibleStatus(); gridScript2.SwitchVisibleTracking(); } float hM = 30; float wM = 120; float yM = Screen.height - modificatorModes.Count * hM; for (int i = 0; i < modificatorModes.Count; i++) { GUI.color = Color.white; if (i == modificatorModeValue) { GUI.color = Color.green; } if (GUI.Button(new Rect(0, yM, wM, hM), modificatorModes[i])) { modificatorModeValue = i; } yM += hM; } break; } if (Input.GetKey(KeyCode.X)) { if (power > 0) { power--; } } if (Input.GetKey(KeyCode.C)) { if (power < 100) { power++; } } }