예제 #1
0
        public ParticleSampler(Model model, Studio studio) : base(model, studio)
        {
            particleModel = model as ParticleModel;

            vecFromCameraToModel = model.transform.position - Camera.main.transform.position;
        }
예제 #2
0
        public static void DoCameraFollowing(Model model, Vector3 modelPosition, Vector3 vecFromCameraToModel, Studio studio)
        {
            Camera.main.transform.position = modelPosition - vecFromCameraToModel;

            if (studio.shadow.type == ShadowType.TopDown)
            {
                ShadowHelper.LocateShadowToModel(model, studio);
            }

            if (studio.lit.cameraPositionFollow)
            {
                studio.lit.com.transform.position = Camera.main.transform.position;
            }
        }
예제 #3
0
 public void SetInfo(List <Frame> frames, Studio studio)
 {
     this.frames = frames;
     this.studio = studio;
 }
예제 #4
0
        protected void OnInspectorGUI_Multi()
        {
            EditorGUILayout.HelpBox("Displayed information is of the first selected model,\nbut any change affects all selected models.", MessageType.Info);

            MeshModel[] models = new MeshModel[targets.Length];

            for (int i = 0; i < models.Length; ++i)
            {
                models[i] = targets[i] as MeshModel;
            }

            MeshModel firstModel = models[0];

            bool isAllSkinnedModel = true;

            foreach (MeshModel model in models)
            {
                isAllSkinnedModel &= model.IsSkinnedModel();
            }

            bool isAllNotFixingToGround = true;

            foreach (MeshModel model in models)
            {
                isAllNotFixingToGround &= (!model.isFixingToOrigin || !model.isFixingToGround);
            }

            PivotType pivotType            = PivotType.Bottom;
            bool      isPivotTypeChanged   = false;
            bool      isGroundPivot        = false;
            bool      isGroundPivotChanged = false;

            if (isAllSkinnedModel || isAllNotFixingToGround)
            {
                EditorGUILayout.Space();

                if (isAllSkinnedModel)
                {
                    pivotType = DrawPivotTypeField(firstModel, out isPivotTypeChanged);
                }

                if (isAllNotFixingToGround)
                {
                    isGroundPivot = DrawGroundPivotField(firstModel, out isGroundPivotChanged);
                }
            }

            bool hasAllRootBone = true;

            foreach (MeshModel model in models)
            {
                hasAllRootBone &= (model.rootBoneObj != null);
            }

            bool isFixingToOrigin        = false;
            bool isFixingToOriginChanged = false;

            bool isAllFixingToOrigin     = true;
            bool isAllNotGroundPivot     = true;
            bool isFixingToGround        = false;
            bool isFixingToGroundChanged = false;

            if (isAllSkinnedModel && hasAllRootBone)
            {
                EditorGUILayout.Space();

                EditorGUILayout.LabelField("Root Bone");

                EditorGUI.indentLevel++;
                {
                    isFixingToOrigin = DrawFixToOriginField(firstModel, out isFixingToOriginChanged);

                    foreach (MeshModel model in models)
                    {
                        isAllFixingToOrigin &= model.isFixingToOrigin;
                    }
                    foreach (MeshModel model in models)
                    {
                        isAllNotGroundPivot &= !model.isGroundPivot;
                    }

                    if (isAllFixingToOrigin && isAllNotGroundPivot)
                    {
                        EditorGUI.indentLevel++;
                        isFixingToGround = DrawFixToGroundField(firstModel, out isFixingToGroundChanged);
                        EditorGUI.indentLevel--;
                    }
                }
                EditorGUI.indentLevel--;
            }

            EditorGUILayout.Space();

            bool       isSpritePrefabChanged;
            GameObject spritePrefab = DrawSpritePrefabField(firstModel, out isSpritePrefabChanged);

            bool hasAllSpritePrefab = true;

            foreach (MeshModel model in models)
            {
                hasAllSpritePrefab &= (model.spritePrefab != null);
            }

            PrefabBuilder prefabBuilder          = null;
            bool          isPrefabBuilderChanged = false;

            if (hasAllSpritePrefab)
            {
                EditorGUI.indentLevel++;
                prefabBuilder = DrawPrefabBuilderField(model, out isPrefabBuilderChanged);
                EditorGUI.indentLevel--;
            }

            EditorGUILayout.Space();

            bool   isNameSuffixChanged;
            string nameSuffix = DrawModelNameSuffix(firstModel, out isNameSuffixChanged);

            if (isNameSuffixChanged)
            {
                PathHelper.CorrectPathString(ref nameSuffix);
            }

            if (isPivotTypeChanged || isGroundPivotChanged || isFixingToOriginChanged || isFixingToGroundChanged ||
                isSpritePrefabChanged || isPrefabBuilderChanged || isNameSuffixChanged)
            {
                foreach (MeshModel model in models)
                {
                    Undo.RecordObject(model, "Mesh Model");

                    if (isAllSkinnedModel && isPivotTypeChanged)
                    {
                        model.pivotType = pivotType;
                    }
                    if (isAllNotFixingToGround && isGroundPivotChanged)
                    {
                        model.isGroundPivot = isGroundPivot;
                    }

                    if (isAllSkinnedModel && hasAllRootBone)
                    {
                        if (isFixingToOriginChanged)
                        {
                            model.isFixingToOrigin = isFixingToOrigin;
                        }
                        if (isAllFixingToOrigin && isAllNotGroundPivot && isFixingToGroundChanged)
                        {
                            model.isFixingToGround = isFixingToGround;
                        }
                    }

                    if (isSpritePrefabChanged)
                    {
                        model.spritePrefab = spritePrefab;
                    }

                    if (hasAllSpritePrefab && isPrefabBuilderChanged)
                    {
                        model.prefabBuilder = prefabBuilder;
                    }

                    if (isNameSuffixChanged)
                    {
                        model.nameSuffix = nameSuffix;
                    }
                }
            }

            Studio studio = FindObjectOfType <Studio>();

            if (studio == null)
            {
                return;
            }

            EditorGUILayout.Space();

            if (DrawingHelper.DrawWideButton("Add all to the model list"))
            {
                foreach (MeshModel model in models)
                {
                    AddToModelList(model);
                }
            }
        }
예제 #5
0
 public Sampler(Model model, Studio studio)
 {
     this.model  = model;
     this.studio = studio;
 }
예제 #6
0
        protected void OnInspectorGUI_Multi()
        {
            EditorGUILayout.HelpBox("Displayed information is of the first selected model,\nbut any change affects all selected models.", MessageType.Info);

            ParticleModel[] models = new ParticleModel[targets.Length];

            for (int i = 0; i < models.Length; ++i)
            {
                models[i] = targets[i] as ParticleModel;
            }

            ParticleModel firstModel = models[0];

            EditorGUILayout.Space();

            bool isGroundPivotChanged;
            bool isGroundPivot = DrawGroundPivotField(firstModel, out isGroundPivotChanged);

            EditorGUILayout.Space();

            bool isLoopingChanged;
            bool isLooping = DrawLoopingField(firstModel, out isLoopingChanged);

            bool isAllLooping = true;

            foreach (ParticleModel model in models)
            {
                isAllLooping &= model.isLooping;
            }

            bool isPrewarmChanged = false;
            bool isPrewarm        = false;

            if (isAllLooping)
            {
                EditorGUI.indentLevel++;
                isPrewarm = DrawPrewarmField(firstModel, out isPrewarmChanged);
                EditorGUI.indentLevel--;
            }

            EditorGUILayout.Space();

            bool       isSpritePrefabChanged;
            GameObject spritePrefab = DrawSpritePrefabField(firstModel, out isSpritePrefabChanged);

            bool hasAllSpritePrefab = true;

            foreach (ParticleModel model in models)
            {
                hasAllSpritePrefab &= (model.spritePrefab != null);
            }

            PrefabBuilder prefabBuilder          = null;
            bool          isPrefabBuilderChanged = false;

            if (hasAllSpritePrefab)
            {
                EditorGUI.indentLevel++;
                prefabBuilder = DrawPrefabBuilderField(model, out isPrefabBuilderChanged);
                EditorGUI.indentLevel--;
            }

            EditorGUILayout.Space();

            bool   isNameSuffixChanged;
            string nameSuffix = DrawModelNameSuffix(firstModel, out isNameSuffixChanged);

            if (isNameSuffixChanged)
            {
                PathHelper.CorrectPathString(ref nameSuffix);
            }

            if (isGroundPivotChanged || isLoopingChanged || isPrewarmChanged ||
                isSpritePrefabChanged || isPrefabBuilderChanged || isNameSuffixChanged)
            {
                foreach (ParticleModel model in models)
                {
                    Undo.RecordObject(model, "Particle Model");
                    if (isGroundPivotChanged)
                    {
                        model.isGroundPivot = isGroundPivot;
                    }
                    if (isLoopingChanged)
                    {
                        model.isLooping = isLooping;
                    }
                    if (isPrewarmChanged)
                    {
                        model.isPrewarm = isPrewarm;
                    }
                    if (isSpritePrefabChanged)
                    {
                        model.spritePrefab = spritePrefab;
                    }
                    if (hasAllSpritePrefab && isPrefabBuilderChanged)
                    {
                        model.prefabBuilder = prefabBuilder;
                    }
                    if (isNameSuffixChanged)
                    {
                        model.nameSuffix = nameSuffix;
                    }
                }
            }

            Studio studio = FindObjectOfType <Studio>();

            if (studio == null)
            {
                return;
            }

            EditorGUILayout.Space();

            if (DrawingHelper.DrawWideButton("Add all to the model list"))
            {
                foreach (ParticleModel model in models)
                {
                    AddToModelList(model);
                }
            }
        }
예제 #7
0
 public Batcher(List <Model> modelList, Studio studio)
 {
     this.modelList = modelList;
     this.studio    = studio;
 }