Ejemplo n.º 1
0
 private void SetConstraintsData()
 {
     foreach (Constraint constraint in ConstraintManager.GetAllConstraints())
     {
         ConstraintData constraintData = new ConstraintData
         {
             type = constraint.constraintType
         };
         Utils.GetTransformRelativePathTo(constraint.gobject.transform, rootTransform, out constraintData.source);
         Utils.GetTransformRelativePathTo(constraint.target.transform, rootTransform, out constraintData.target);
         SceneData.Current.constraints.Add(constraintData);
     }
 }
Ejemplo n.º 2
0
        private void LoadConstraint(ConstraintData data)
        {
            Transform sourceTransform = rootTransform.Find(data.source);

            if (null == sourceTransform)
            {
                Debug.LogWarning($"Object name not found for animation: {data.source}");
                return;
            }
            Transform targetTransform = rootTransform.Find(data.target);

            if (null == targetTransform)
            {
                Debug.LogWarning($"Object name not found for animation: {data.target}");
                return;
            }

            // Create constraint
            ConstraintManager.AddConstraint(sourceTransform.gameObject, targetTransform.gameObject, data.type);
        }
Ejemplo n.º 3
0
        public void FromBytes(byte[] buffer, ref int index)
        {
            for (int i = 0; i < 6; i++)
            {
                if (buffer[i] != headerBuffer[i])
                {
                    throw new Exception("Invalid VRtist file Header");
                }
            }
            index += 6;

            fileVersion = Converter.GetInt(buffer, ref index);
            if (fileVersion > version)
            {
                throw new Exception("File version mismatch, please update VRtist");
            }


            int objectsCount = Converter.GetInt(buffer, ref index);

            for (int i = 0; i < objectsCount; i++)
            {
                ObjectData data = new ObjectData();
                data.FromBytes(buffer, ref index);
                objects.Add(data);
            }

            int lightsCount = Converter.GetInt(buffer, ref index);

            for (int i = 0; i < lightsCount; i++)
            {
                LightData data = new LightData();
                data.FromBytes(buffer, ref index);
                lights.Add(data);
            }

            int camerasCount = Converter.GetInt(buffer, ref index);

            for (int i = 0; i < camerasCount; i++)
            {
                CameraData data = new CameraData();
                data.FromBytes(buffer, ref index);
                cameras.Add(data);
            }

            skyData = new SkySettings
            {
                topColor    = Converter.GetColor(buffer, ref index),
                middleColor = Converter.GetColor(buffer, ref index),
                bottomColor = Converter.GetColor(buffer, ref index)
            };

            int animationsCount = Converter.GetInt(buffer, ref index);

            for (int i = 0; i < animationsCount; i++)
            {
                AnimationData data = new AnimationData();
                data.FromBytes(buffer, ref index);
                animations.Add(data);
            }

            int rigCount = Converter.GetInt(buffer, ref index);

            for (int i = 0; i < rigCount; i++)
            {
                RigData data = new RigData();
                data.FromBytes(buffer, ref index);
                rigs.Add(data);
            }

            fps          = Converter.GetFloat(buffer, ref index);
            startFrame   = Converter.GetInt(buffer, ref index);
            endFrame     = Converter.GetInt(buffer, ref index);
            currentFrame = Converter.GetInt(buffer, ref index);

            int constraintsCount = Converter.GetInt(buffer, ref index);

            for (int i = 0; i < constraintsCount; i++)
            {
                ConstraintData data = new ConstraintData();
                data.FromBytes(buffer, ref index);
                constraints.Add(data);
            }

            int shotsCount = Converter.GetInt(buffer, ref index);

            for (int i = 0; i < shotsCount; i++)
            {
                ShotData data = new ShotData();
                data.FromBytes(buffer, ref index);
                shots.Add(data);
            }

            playerData = new PlayerData();
            playerData.FromBytes(buffer, ref index);
        }