void startSearch(string cursor = "")
        {
            _hasFetchedPreviews = false;
            SketchfabRequest request = new SketchfabRequest(_lastQuery + cursor, SketchfabPlugin.getLogger().getHeader());

            request.setCallback(handleSearch);
            _api.registerRequest(request);
        }
Beispiel #2
0
        void searchCursor(string cursorUrl)
        {
            _hasFetchedPreviews = false;
            SketchfabRequest request = new SketchfabRequest(cursorUrl, SketchfabPlugin.getLogger().getHeader());

            request.setCallback(handleSearch);
            _api.registerRequest(request);
        }
 private void checkValidity()
 {
     if (_ui == null)
     {
         _ui = SketchfabPlugin.getUI();
     }
     if (_api == null)
     {
         _api = SketchfabPlugin.getAPI();
     }
     if (_logger == null)
     {
         _logger = SketchfabPlugin.getLogger();
     }
 }
Beispiel #4
0
        void displaySearchBox()
        {
            GUILayout.BeginHorizontal();
            GUILayout.Label("Search:", GUILayout.Width(80));
            GUI.SetNextControlName("SearchTextField");
            _query = EditorGUILayout.TextField(_query, GUILayout.Width(350));

            if (Event.current.keyCode == KeyCode.Return && GUI.GetNameOfFocusedControl() == "SearchTextField")
            {
                triggerSearch();
            }

            if (GUILayout.Button("Search", GUILayout.Width(120)))
            {
                triggerSearch();
            }

            GUILayout.FlexibleSpace();
            bool       previous = _myModels;
            GUIContent content  = _logger.isUserBasic() ? new GUIContent("My Models", SketchfabUI.getPlanIcon("pro")) : new GUIContent("My Models");

            bool previousState = GUI.enabled;

            GUI.enabled = SketchfabPlugin.getLogger().isUserLogged();
            _myModels   = GUILayout.Toggle(_myModels, content, GUILayout.Height(18));
            GUI.enabled = previousState;

            if (_myModels != previous)
            {
                if (_myModels)
                {
                    resetFilersOwnModels();
                }
                else
                {
                    resetFilters();
                }

                triggerSearch();
            }

            GUILayout.EndHorizontal();
        }
Beispiel #5
0
        private void checkValidity()
        {
            if (_browserManager == null)
            {
                _browserManager = new SketchfabBrowserManager(OnRefreshUpdate, true);
                resetFilters();
                _currentUid      = "";
                _categoryName    = "";
                _categoriesNames = new string[0];

                // Setup sortBy
                _sortBy    = new string[] { "Relevance", "Likes", "Views", "Recent" };
                _polyCount = new string[] { "Any", "Up to 10k", "10k to 50k", "50k to 100k", "100k to 250k", "250k +" };
                this.Repaint();
                GL.sRGBWrite = true;
            }

            SketchfabPlugin.checkValidity();
            _ui     = SketchfabPlugin.getUI();
            _logger = SketchfabPlugin.getLogger();
        }
        private void checkValidity()
        {
            if (_browserManager == null)
            {
                _browserManager = new SketchfabBrowserManager(OnRefreshUpdate, true);
                resetFilters();
                _currentUid      = "";
                _categoryName    = "";
                _categoriesNames = new string[0];

                // Setup sortBy
                _sortBy    = new string[] { "Relevance", "Likes", "Views", "Recent" };
                _polyCount = new string[] { "Any", "Up to 10k", "10k to 50k", "50k to 100k", "100k to 250k", "250k +" };
                _searchIn  = new string[] { "free downloadable", "my models", "store purchases" };
                _license   = new string[] { "any", "CC BY", "CC BY SA", "CC BY-ND", "CC BY-NC", "CC BY-NC-SA", "CC BY-NC-ND", "CC0" };               // No search for store models so only CC licenses here
                this.Repaint();
                GL.sRGBWrite = true;
            }

            SketchfabPlugin.checkValidity();
            _ui     = SketchfabPlugin.getUI();
            _logger = SketchfabPlugin.getLogger();
        }