Example #1
0
        private bool CheckInstantiationPercentage()
        {
            float tPerc = 0;
            float mPerc = 0;

            if (RuntimeMeshLoader.IsInstanced())
            {
                mPerc = (float)RuntimeMeshLoader.Instance.requested / (float)RuntimeMeshLoader.Instance.toRequest;
            }
            if (RuntimeTextureLoader.IsInstanced())
            {
                tPerc = 1;
                if (RuntimeTextureLoader.Instance.toRequest != 0)
                {
                    tPerc = (float)RuntimeTextureLoader.Instance.requested / (float)RuntimeTextureLoader.Instance.toRequest;
                }
            }
            if (tPerc == 1 && mPerc == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #2
0
        private void CustomUpdate()
        {
            if (RuntimeMeshLoader.IsInstanced())
            {
                RuntimeMeshLoader.Instance.saveMesh = ATSettings.saveMesh;

                RuntimeMeshLoader.Instance.Update();

                this.isCalculateNormalAssigned = false;
            }
            else
            {
                this.isCurrentlyImporting = false;

                if (!this.isCalculateNormalAssigned)
                {
                    foreach (var item in GameObject.FindObjectsOfType <VMesh>())
                    {
                        if (item != null)
                        {
                            if (item.GetComponent <RecalculateNormalsComponent>() == null)
                            {
                                var normalCompoenent = item.gameObject.AddComponent <RecalculateNormalsComponent>();

                                if (ATSettings.setNormalToZero)
                                {
                                    normalCompoenent.RecalculateNormals(0);
                                }
                            }
                        }
                    }
                    this.isCalculateNormalAssigned = true;
                }
            }
            if (RuntimeMeshDataOrderedLoader.IsInstanced())
            {
                RuntimeMeshDataOrderedLoader.Instance.Update();
            }
            if (RuntimeTextureLoader.IsInstanced())
            {
                RuntimeTextureLoader.Instance.Update();
            }
            if (RuntimeJSonLoader.IsInstanced())
            {
                RuntimeJSonLoader.Instance.Update();
            }

            if (this.avrsChanged != null)
            {
                if (this.avrsChanged.isOpened)
                {
                    this.avrsChanged.isImporting = true;
                    Import(this.avrsChanged);
                }
                this.avrsChanged = null;
            }
        }
Example #3
0
        private void DrawProjectField()
        {
            var labelSkin = new GUIStyle(GUI.skin.label);

            labelSkin.alignment = TextAnchor.UpperLeft;
            labelSkin.fontStyle = FontStyle.Normal;
            labelSkin.clipping  = TextClipping.Overflow;
            labelSkin.fontSize  = 11;

            var toggleSkin = new GUIStyle(GUI.skin.toggle);

            toggleSkin.alignment = TextAnchor.UpperLeft;

            foreach (var p in this.avrsProjects)
            {
                if (p == null)
                {
                    continue;
                }

                GUILayout.BeginVertical(GUI.skin.box);

                p.isOpenedInUI = EditorGUILayout.Foldout(p.isOpenedInUI, p.projectName, true);

                if (p.isOpenedInUI)
                {
                    if (p.views != null)
                    {
                        foreach (var avrs in p.views)
                        {
                            if (avrs == null)
                            {
                                continue;
                            }

                            var horizontal = EditorGUILayout.BeginHorizontal(GUI.skin.box);

                            GUILayout.Label(avrs.thumbnail, GUILayout.Width(32), GUILayout.Height(32));

                            var rectBar = EditorGUILayout.BeginVertical();

                            if (!Client.Instance.isSubscriptionFree)
                            {
                                var syncChanged = avrs.autoSync;

                                avrs.autoSync = GUILayout.Toggle(avrs.autoSync, "Auto sync");

                                if (syncChanged != avrs.autoSync)
                                {
                                    avrs.SetSyncTo(avrs.autoSync);
                                }
                            }
                            else
                            {
                                avrs.autoSync = false;
                            }

                            GUILayout.Label(avrs.name, labelSkin);

                            string projectPathToSee = avrs.projectPath;

                            if (avrs.projectPath.Length > 100) // in this way we avoid to have a label too long
                            {
                                projectPathToSee = "..." + avrs.projectPath.Substring(100);
                            }
                            else if (avrs.projectPath.Length > 50)
                            {
                                projectPathToSee = "..." + avrs.projectPath.Substring(50);
                            }

                            GUILayout.Label(projectPathToSee, labelSkin);

                            GUILayout.Space(20);

                            if (avrs.isImporting)
                            {
                                if (!RuntimeMeshLoader.IsInstanced())
                                {
                                    avrs.isImporting = false;
                                }

                                if (RuntimeMeshLoader.IsInstanced())
                                {
                                    float perc = (float)RuntimeMeshLoader.Instance.requested / (float)RuntimeMeshLoader.Instance.toRequest;

                                    var progressField = new Rect(12, rectBar.yMax - 15, rectBar.width + 36, 15);

                                    EditorGUI.ProgressBar(progressField, perc, "Importing... " + RuntimeMeshLoader.Instance.requested + "/" + RuntimeMeshLoader.Instance.toRequest);

                                    this.Repaint();
                                }
                            }

                            EditorGUILayout.EndVertical();

                            if (!avrs.isImporting && !this.isCurrentlyImporting)
                            {
                                var import = GUILayout.Button(this.syncTexture, GUILayout.Height(32), GUILayout.Width(32));

                                if (import)
                                {
                                    avrs.isImporting = true;
                                    Import(avrs);
                                }
                            }

                            EditorGUILayout.EndHorizontal();
                        }
                    }
                }

                GUILayout.EndVertical();
            }
        }