Пример #1
0
        public bool SetCameraAndMessage(string cameraButtonName)
        {
            if (cameraDictionary.ContainsKey(cameraButtonName))
            {
                loadedMessageText           = cameraDictionary[cameraButtonName].Text;
                displayedCurrentMessageText = string.Empty;

                if (studioneocam != null)
                {
                    studioneocam.targetPos   = cameraDictionary[cameraButtonName].TargetPos;
                    studioneocam.fieldOfView = cameraDictionary[cameraButtonName].CameraFov;
                    studioneocam.cameraAngle = cameraDictionary[cameraButtonName].CameraAngle;

                    // to set the distance we need this export and import stuff
                    Studio.CameraControl.CameraData cameraData = new Studio.CameraControl.CameraData();
                    cameraData.pos      = studioneocam.Export().pos;
                    cameraData.rotate   = studioneocam.Export().rotate;
                    cameraData.parse    = studioneocam.Export().parse;
                    cameraData.distance = cameraDictionary[cameraButtonName].CameraDistance;
                    studioneocam.Import(cameraData);
                }

                StartCoroutine("DisplayMessageCoRoutine");

                lastButtonPressed = cameraButtonName;
                lastPlayedButton  = cameraButtonName;

                return(true);
            }
            else
            {
                // the requested camera position was not found
                return(false);
            }
        }
Пример #2
0
 public static bool IsSame(this Studio.CameraControl.CameraData cameraData1,
                           Studio.CameraControl.CameraData cameraData2)
 {
     return(cameraData1 != null && cameraData2 != null && cameraData1.distance == cameraData2.distance &&
            cameraData1.pos == cameraData2.pos &&
            cameraData1.rotate == cameraData2.rotate && cameraData1.rotation == cameraData2.rotation);
 }
 public void hsneo_dump_camera2(StreamWriter file)
 {
     Studio.Studio                   studio = Studio.Studio.Instance;
     Studio.CameraControl            c      = studio.cameraCtrl;
     Studio.CameraControl.CameraData cdata  = cameraData;
     file.WriteLine(String.Format("game.move_camera(pos=%s, distance=%s, rotate=%s)", cdata.pos.ToString(), cdata.distance.ToString(), cdata.rotate.ToString()));
     file.WriteLine(String.Format("# for VN Scene Script %s", this.camera_calcstr_for_vnscene()));
     file.WriteLine(String.Format("# other one: 'cam': {{ 'goto_pos': (({0:F3}, {1:F3}, {2:F3}), ({3:F3}, {4:F3}, {5:F3}), ({6:F3}, {7:F3}, {8:F3})) }}, ", cdata.pos.x, cdata.pos.y, cdata.pos.z, cdata.distance.x, cdata.distance.y, cdata.distance.z, cdata.rotate.x, cdata.rotate.y, cdata.rotate.z));
 }
Пример #4
0
        public void CurrentToCameraCtrl()
        {
            GetCurrentLookDirAndRot(out Vector3 pos, out Vector3 vector, out Vector3 rotate);
            Studio.CameraControl.CameraData cameraData = new Studio.CameraControl.CameraData();
            VR.Camera.Head.TransformPoint(vector.normalized * DEFAULT_DISTANCE * DISTANCE_RATIO);
            Vector3 distance = new Vector3(0f, 0f, -1f * DEFAULT_DISTANCE * DISTANCE_RATIO);

            cameraData.Set(pos, rotate, distance, studio.cameraCtrl.fieldOfView);
            studio.cameraCtrl.Import(cameraData);
        }
Пример #5
0
        private static void StartPOV()
        {
            var ctrlInfo = Studio.Studio.GetCtrlInfo(Singleton <Studio.Studio> .Instance.treeNodeCtrl.selectNode);

            if (!(ctrlInfo is OCIChar ocichar))
            {
                return;
            }

            var temp = GameObject.Find("StudioScene/Camera/CameraSet/CameraController");

            if (temp == null)
            {
                return;
            }

            cc = temp.GetComponent <Studio.CameraControl>();
            if (cc == null)
            {
                return;
            }

            chara = ocichar.charInfo;

            eyes = chara.eyeLookCtrl.eyeLookScript.eyeObjs;
            if (eyes == null)
            {
                return;
            }

            head = chara.objHeadBone;
            if (head == null)
            {
                return;
            }

            if (hideHead.Value)
            {
                head.SetActive(false);
            }

            var data = cc.Export();

            backupData = data;
            backupFov  = cc.fieldOfView;

            cc.Import(new Studio.CameraControl.CameraData(data)
            {
                distance = Vector3.zero
            });
            viewRotation = Vector3.zero;

            toggle = true;
        }
Пример #6
0
        protected override void Start()
        {
            base.Start();

            cameraData             = Traverse.Create(camera).Field("cameraData").GetValue <Studio.CameraControl.CameraData>();
            treeNodeCtrl.onSelect += new Action <TreeNodeObject>(OnSelectWork);
            studio.onDelete       += new Action <ObjectCtrlInfo>(OnDeleteWork);
            var systemMenuContent = studio.transform.Find("Canvas Main Menu/04_System/Viewport/Content");

            systemMenuContent.Find("Load").GetComponent <Button>().onClick.AddListener(ResetModState);
            Guitime.pos = new Vector2(1f, 1f);
        }
        override public void move_camera_direct(CamData cam)
        {
            Studio.CameraControl.CameraData cdata = cameraData;
            Studio.CameraControl            c     = studio.cameraCtrl;

            cdata.pos = cam.position;

            cdata.distance = cam.distance;

            cdata.rotate = cam.rotation;

            cdata.parse = cam.fov;
        }
        /*        public string calc_py_path()
         *      {
         *          var rootfolder = Path.GetFullPath(Path.Combine(Application.dataPath, ".."));
         *          // os.path.splitext(__file__)[0] + '.ini'
         *          var pydirname = path.dirname(@__file__);
         *          return path.relpath(pydirname, rootfolder);
         *      }
         */

        //
        //         camobj = self.get_camera_num(camnum)
        //         self.move_camera_obj(camobj)
        //
        public void to_camera(int camnum)
        {
            Studio.Studio studio = Studio.Studio.Instance;
            SceneInfo     si     = studio.sceneInfo;

            Studio.CameraControl.CameraData[] cdatas = si.cameraData;

            Studio.CameraControl.CameraData cdata = cameraData;
            //var targetInfos = trav.Field("listBones");

            //CameraData cdata = c.cameraData;
            cdata.Copy(cdatas[camnum - 1]);
        }
Пример #9
0
        protected override void Start()
        {
            base.Start();

            cameraData             = Utils.GetSecureField <Studio.CameraControl.CameraData, Studio.CameraControl>("cameraData", camera);
            treeNodeCtrl.onSelect += new Action <TreeNodeObject>(OnSelectWork);
            studio.onDelete       += new Action <ObjectCtrlInfo>(OnDeleteWork);
            Transform systemMenuContent = studio.transform.Find("Canvas Main Menu/04_System/Viewport/Content");

            systemMenuContent.Find("Load").GetComponent <Button>().onClick.AddListener(() => ResetModState());
            systemMenuContent.Find("End").GetComponent <Button>().onClick.AddListener(() => HideLockOnTargets());
            OverrideControllerCreate();
        }
Пример #10
0
        protected override void Start()
        {
            base.Start();

            cameraData             = Utils.GetSecureField <Studio.CameraControl.CameraData, Studio.CameraControl>("cameraData", camera);
            treeNodeCtrl.onSelect += new Action <TreeNodeObject>(OnSelectWork);
            studio.onDelete       += new Action <ObjectCtrlInfo>(OnDeleteWork);
            Transform systemMenuContent = studio.transform.Find("Canvas Main Menu/04_System/Viewport/Content");

            systemMenuContent.Find("Load").GetComponent <Button>().onClick.AddListener(() => StartCoroutine(OnSceneMenuOpen()));
            systemMenuContent.Find("End").GetComponent <Button>().onClick.AddListener(() => showLockOnTargets = false);
            InstallNearClipPlaneSlider();
            StartCoroutine(InstallSettingsReloadButton());
            OverrideControllerCreate();
        }
Пример #11
0
        private static void StopPOV()
        {
            if (cc != null && backupData != null)
            {
                cc.Import(backupData);
                cc.fieldOfView = backupFov;
            }

            if (head != null)
            {
                head.SetActive(true);
            }

            chara      = null;
            eyes       = null;
            backupData = null;
            toggle     = false;
        }
Пример #12
0
        private void UpdateCameraPos()
        {
            if (this.cameraControl == null)
            {
                this.cameraControl = UnityEngine.Object.FindObjectOfType <Studio.CameraControl>();
            }
            Quaternion quaternion    = Quaternion.Euler(0f, 180f, 0f) * this.t_camera.localRotation;
            Vector3    localPosition = this.t_length.localPosition;

            localPosition.z -= this.cameraDistanceAdjust;
            Studio.CameraControl.CameraData cameraData = new Studio.CameraControl.CameraData();
            Vector3 vector = this.t_camera.localPosition * this.modelScale + this.cameraPosAdjust;

            cameraData.pos      = vector;
            cameraData.distance = localPosition;
            cameraData.rotate   = quaternion.eulerAngles;
            cameraData.parse    = this.t_view_angle.localPosition.z * -1f;
            this.cameraControl.Import(cameraData);
            this.cameraControl.transform.rotation = quaternion;
            this.cameraControl.transform.position = quaternion * localPosition + vector;
            this.cameraControl.fieldOfView        = this.t_view_angle.localPosition.z;
        }
Пример #13
0
 public static bool IsInitial(this Studio.CameraControl.CameraData cameraData)
 {
     return(cameraData.IsSame(Utils.GetSceneSaveCamera()));
 }
Пример #14
0
 public static bool IsFree(this Studio.CameraControl.CameraData cameraData)
 {
     return(cameraData.IsSame(Utils.GetResetCamera()));
 }
Пример #15
0
 void Start()
 {
     cameraData = Traverse.Create(camera).Field("cameraData").GetValue <Studio.CameraControl.CameraData>();
 }
Пример #16
0
 private static bool AreCameraDataEqual(Studio.CameraControl.CameraData cameraData1,
                                        Studio.CameraControl.CameraData cameraData2)
 {
     return(cameraData1.distance == cameraData2.distance && cameraData1.pos == cameraData2.pos &&
            cameraData1.rotate == cameraData2.rotate && cameraData1.rotation == cameraData2.rotation);
 }
Пример #17
0
 internal static Studio.CameraControl.CameraData GetSceneSaveCamera()
 {
     Studio.CameraControl.CameraData sceneSaveCamera = null;
     GetSceneInfo().SafeProc(si => sceneSaveCamera = si.cameraSaveData);
     return(sceneSaveCamera);
 }
Пример #18
0
 internal static Studio.CameraControl.CameraData GetResetCamera()
 {
     Studio.CameraControl.CameraData resetData = null;
     GetCameraControl().SafeProc(cc => resetData = cc.cameraReset);
     return(resetData);
 }