Exemple #1
0
        public static POV[] ReadSavedCamsFile()
        {
            var povs = new POV[10];

            if (File.Exists(savedCamFilePath))
            {
                using var fs = new FileStream(savedCamFilePath, FileMode.Open);

                for (int i = 0; i < 10; i++)
                {
                    povs[i] = new POV
                    {
                        Position = new Vector3(fs.ReadFloat(), fs.ReadFloat(), fs.ReadFloat()),
                        Rotation = new Vector3
                        {
                            Y = (fs.ReadInt32() % 65536).UnrealRotationUnitsToDegrees(),
                            Z = (fs.ReadInt32() % 65536).UnrealRotationUnitsToDegrees(),
                            X = (fs.ReadInt32() % 65536).UnrealRotationUnitsToDegrees()
                        },
                        FOV   = fs.ReadFloat(),
                        Index = i
                    };
                }
            }
            else
            {
                for (int i = 0; i < 10; i++)
                {
                    povs[i] = new POV();
                }
            }

            return(povs);
        }
Exemple #2
0
        public static void CreateCurveFromSavedCams(ExportEntry export)
        {
            POV[] cams = ReadSavedCamsFile();

            var props       = export.GetProperties();
            var posTrack    = props.GetProp <StructProperty>("PosTrack").GetProp <ArrayProperty <StructProperty> >("Points");
            var rotTrack    = props.GetProp <StructProperty>("EulerTrack").GetProp <ArrayProperty <StructProperty> >("Points");
            var lookupTrack = props.GetProp <StructProperty>("LookupTrack").GetProp <ArrayProperty <StructProperty> >("Points");

            posTrack.Clear();
            rotTrack.Clear();


            for (int i = 0; i < cams.Length; i++)
            {
                POV cam = cams[i];
                if (cam.IsZero)
                {
                    break;
                }

                posTrack.Add(new InterpCurvePoint <Vector3>
                {
                    InVal      = i * 2,
                    OutVal     = cam.Position,
                    InterpMode = EInterpCurveMode.CIM_CurveUser
                }.ToStructProperty(MEGame.ME3));
                rotTrack.Add(new InterpCurvePoint <Vector3>
                {
                    InVal      = i * 2,
                    OutVal     = cam.Rotation,
                    InterpMode = EInterpCurveMode.CIM_CurveUser
                }.ToStructProperty(MEGame.ME3));
                lookupTrack.Add(new StructProperty("InterpLookupPoint", false, new NameProperty("None", "GroupName"), new FloatProperty(0, "Time")));
            }
            export.WriteProperties(props);
        }