Ejemplo n.º 1
0
    private void PlayAndRecord()
    {
        StateToRestore = CreateCloudState();
        ChangeCloudState(InitialState);

        UIMenu.gameObject.SetActive(false);
        GameObject sphere = MobileCamera.gameObject.transform.parent.gameObject;

        ControllerTransform       = sphere.transform.parent;
        sphere.transform.parent   = null;
        sphere.transform.position = CameraWaypointsDict[0].obj.transform.position;
        sphere.transform.rotation = CameraWaypointsDict[0].obj.transform.rotation;
        //animationScript.InitializeFirstKeyframe(sphere.transform);
        //GameObject go = new GameObject("dummy");
        //go.transform.position = WaypointList[0].transform.position;
        sphere.transform.SetParent(WaypointContainer.transform);
        foreach (KeyValuePair <int, CameraWaypoint> g in CameraWaypointsDict)
        {
            g.Value.obj.SetActive(false);
        }
        WaypointContainer.GetComponent <MeshRenderer>().enabled = false;

        //TODO : Disable all UI when recording

        MobileCamera.gameObject.AddComponent <ScreenRecorder>();
        Debug.Log(AnimationDuration);
        MobileCamera.gameObject.GetComponent <ScreenRecorder>().maxFrames = (AnimationDuration * FramesPerSecond) + FramesPerSecond;

        MobileCamera.gameObject.GetComponent <ScreenRecorder>().OnRecordingEnd += RestoreObjects;

        animationScript.PlayAnimation();
        MobileCamera.gameObject.GetComponent <ScreenRecorder>().ActivateRecording();
    }
Ejemplo n.º 2
0
 private void ChangeCloudState(CloudStateInTime state)
 {
     CloudUpdater.instance.OverrideBoxScale(state.BoxScale);
     CloudUpdater.instance.OverrideMesh(state.Mesh);
     CloudUpdater.instance.ChangePointSize(state.PointSize);
     CloudUpdater.instance.ChangeCloudScale(state.Scale);
     CloudUpdater.instance.ChangeCurrentColorMap(state.ColorMap);
 }
Ejemplo n.º 3
0
 private void AddCloudState()
 {
     if (!CloudSelector.instance.noSelection)
     {
         CloudStateInTime state = CreateCloudState();
         CloudStateDict.Add(state.ID, state);
         animationScript.AddAnimationEvent(state);
         UIMenu.CreateCloudStateTimingButton(state.ID, state.Time);
     }
     //get mesh from cloudData
 }
Ejemplo n.º 4
0
    public void PlaceWaypoint(Vector3 position, Quaternion rotation, float time = -1)
    {
        //animationScript.AddKeyframe(tr);
        GameObject s = CreateWaypointGameObject(position, rotation);

        if (CameraWaypointsDict.Count == 0)
        {
            CreateWaypointContainer(position);

            if (!CloudSelector.instance.noSelection)
            {
                CloudStateInTime state = CreateCloudState();
                InitialState = state;
            }
        }
        s.transform.SetParent(WaypointContainer.transform);

        //Debug.Log("s : " + s.transform.localRotation.eulerAngles);
        //Debug.Log("sphere : " + sphere.transform.rotation.eulerAngles);
        float TimeToAssign;

        if (time >= 0)
        {
            TimeToAssign = time;
        }
        else
        {
            TimeToAssign = WaypointMasterID * KeyFrameTimestep;
        }
        CameraWaypoint campoint = new CameraWaypoint(WaypointMasterID, Mathf.RoundToInt(TimeToAssign));

        campoint.obj = s;
        int indexkey;

        indexkey = animationScript.AddKeyframe(s.transform, campoint.Time);
        WaypointMasterID++;
        campoint.IndexKey = indexkey;

        //Debug.Log("Adding key for point "+campoint.ID+" at time "+campoint.Time+" / Result : "+ campoint.IndexKey);
        //Debug.Log(animationScript.curvePositionX[campoint.IndexKey].ToString());
        CameraWaypointsDict.Add(campoint.ID, campoint);
        //CREATE NEW BUTTON
        UIMenu.CreateTimeButton(campoint.ID, campoint.Time);
        CalculateAnimationDuration();
        ReloadMesh();
    }
Ejemplo n.º 5
0
    private CloudStateInTime CreateCloudState()
    {
        CloudData clouddata = CloudUpdater.instance.LoadCurrentStatus();
        Mesh      mesh      = new Mesh();

        mesh.indexFormat = UnityEngine.Rendering.IndexFormat.UInt32;
        mesh.vertices    = clouddata.gameObject.GetComponent <MeshFilter>().mesh.vertices;
        mesh.SetIndices(clouddata.gameObject.GetComponent <MeshFilter>().mesh.GetIndices(0), MeshTopology.Points, 0);
        mesh.uv  = clouddata.gameObject.GetComponent <MeshFilter>().mesh.uv;
        mesh.uv2 = clouddata.gameObject.GetComponent <MeshFilter>().mesh.uv2;
        mesh.uv3 = clouddata.gameObject.GetComponent <MeshFilter>().mesh.uv3;
        mesh.uv4 = clouddata.gameObject.GetComponent <MeshFilter>().mesh.uv4;
        mesh.uv5 = clouddata.gameObject.GetComponent <MeshFilter>().mesh.uv5;
        int              time     = StateMasterID * KeyFrameTimestep;
        float            psize    = clouddata.globalMetaData.point_size;
        Vector3          scale    = clouddata.globalMetaData.scale;
        Vector3          boxscale = clouddata.globalMetaData.box_scale;
        string           color    = clouddata.globalMetaData.colormapName;
        CloudStateInTime state    = new CloudStateInTime(StateMasterID, time, mesh, psize, scale, boxscale, color);

        StateMasterID++;
        return(state);
    }