Beispiel #1
0
    /// <summary>
    /// Sets the window title and minimum pane size
    /// </summary>
    public void Awake()
    {
        base.title   = TITLE;
        this.minSize = new Vector2(700f, 500f);

        mocapLogo = Resources.Load("Cinema Mocap") as Texture2D;
        if (mocapLogo == null)
        {
            UnityEngine.Debug.LogWarning("Cinema Mocap image missing from Resources folder.");
        }
        radarLogo = Resources.Load("Cinema Radar") as Texture2D;
        if (radarLogo == null)
        {
            UnityEngine.Debug.LogWarning("Cinema Radar image missing from Resources folder.");
        }
        recordingImage = Resources.Load("Recording") as Texture2D;
        if (recordingImage == null)
        {
            UnityEngine.Debug.LogWarning("Recording Image missing from Resources folder.");
        }

        cinema_mocap_humanoid_prefab = Resources.Load("Player") as GameObject;
        if (cinema_mocap_humanoid_prefab == null)
        {
            UnityEngine.Debug.LogError("Cinema_Mocap_Humanoid.dae is missing from the Resources folder. This item is required for the system.");
        }
        rigData     = ColladaUtility.ReadRigData(SOURCE_FILE);
        inputMapper = new NUIInputToRigMapper(rigData);

        workingResolution = ResolutionData.FromZigResolution(kinectCaptureResolution);
    }
Beispiel #2
0
    /// <summary>
    /// Once capturing is complete, write out the animation file.
    /// </summary>
    private void StopRecording()
    {
        // Change to stopped state
        stopwatch.Stop();
        captureState = RecordingState.NotRecording;

        // Check if there is capture data
        if (captureData == null)
        {
            UnityEngine.Debug.LogWarning("No capture data was found.");
            return;
        }

        // Reload the rig data and mapper if necessary
        if (inputMapper == null)
        {
            rigData     = ColladaUtility.ReadRigData(SOURCE_FILE);
            inputMapper = new NUIInputToRigMapper(rigData);
        }

        // Map captured data to Collada data
        ColladaAnimationData data = inputMapper.GetColladaAnimation(captureData);

        // Check filename
        string appendedFileName = string.Format("MoCapHumanoid@{0}", fileName);
        string newFileName      = appendedFileName;

        if (System.IO.File.Exists(string.Format(FILE_DESTINATION, appendedFileName)))
        {
            newFileName = getNewFilename(appendedFileName);
            UnityEngine.Debug.LogWarning(string.Format(NAME_DUPLICATE_ERROR_MSG, appendedFileName, newFileName));
        }

        // Save
        if (transformationType == TransformationType.Matrix)
        {
            ColladaUtility.SaveAnimationData(data, SOURCE_FILE_MATRIX, string.Format(FILE_DESTINATION, newFileName), true);
        }
        else
        {
            ColladaUtility.SaveAnimationData(data, SOURCE_FILE, string.Format(FILE_DESTINATION, newFileName), false);
        }

        AssetDatabase.Refresh();
    }
Beispiel #3
0
        public override void Initialize()
        {
            rigData = ColladaUtility.ReadRigData(SOURCE_FILE_PATH);

            cinema_mocap_humanoid_prefab = Resources.Load(SKELETON_NAME) as GameObject;
            if (cinema_mocap_humanoid_prefab == null)
            {
                UnityEngine.Debug.LogError(string.Format("{0} is missing from the Resources folder. This item is required for the system.", SOURCE_FILE));
            }

            // Try to find if the Skeleton exists in the scene already and assign the reference.
            HumanoidPoser[] previewSkeletons = GameObject.FindObjectsOfType <HumanoidPoser>();
            foreach (HumanoidPoser rhp in previewSkeletons)
            {
                if (rhp.gameObject.name == SKELETON_NAME)
                {
                    cinema_mocap_humanoid_instance = rhp.gameObject;
                }
            }

            LoadEditorPrefs();
        }