2025-12-01

This commit is contained in:
2026-03-17 14:58:51 -06:00
parent 183e865f8b
commit 4b82b57113
6846 changed files with 954887 additions and 162606 deletions
+48 -21
View File
@@ -23,9 +23,12 @@ import bpy
from .modules.poliigon_core.assets import AssetType
from .modules.poliigon_core.api_remote_control_params import (
CATEGORY_ALL,
KEY_TAB_IMPORTED,
KEY_TAB_MY_ASSETS,
KEY_TAB_ONLINE)
KEY_TAB_RECENT_DOWNLOADS,
KEY_TAB_ONLINE,
KEY_TAB_LOCAL)
from .modules.poliigon_core.multilingual import _t
from .dialogs.dlg_account import build_user
from .dialogs.dlg_add_node_groups import (
@@ -35,9 +38,10 @@ from .dialogs.dlg_area_categories import build_categories
from .dialogs.dlg_area_notifications import notification_banner
from .dialogs.dlg_area_tabs import build_areas
from .dialogs.dlg_area_upgrade_banner import build_upgrade_banner
from .dialogs.dlg_assets import build_assets
from .dialogs.dlg_assets import build_assets, POLIIGON_MT_asset_display_options
from .dialogs.dlg_init_library import build_library
from .dialogs.dlg_login import build_login
from .dialogs.dlg_onboarding_survey import build_onboarding_survey
from .dialogs.utils_dlg import (
check_dpi,
get_ui_scale)
@@ -78,10 +82,10 @@ def _imported_tab_check_assets(area: str, props_wm) -> None:
if area != KEY_TAB_IMPORTED:
return
category_list = cTB.settings["category"][area]
category_list = cTB.settings["category"]
query_key = cTB.get_accumulated_query_cache_key(
tab=KEY_TAB_IMPORTED,
search=props_wm.search_imported,
search=props_wm.search,
category_list=category_list)
if query_key not in cTB._asset_index.cached_queries:
@@ -92,15 +96,29 @@ def _imported_tab_check_assets(area: str, props_wm) -> None:
def _get_assets_upon_changed_search(area: str) -> None:
if cTB.vSearch[area] == cTB.vLastSearch[area]:
search = cTB.vSearch[area]
if search == cTB.vLastSearch[area]:
return
# Reset category to "All Assets"
# We can't use the operator durinng draw, so we need to do it manually
# bpy.ops.poliigon.poliigon_setting(mode="category_0_All Assets")
cTB.settings["category"] = [CATEGORY_ALL]
cTB.vActiveAsset = None
cTB.vActiveMat = None
cTB.vActiveMode = None
cTB.vActiveCat = [CATEGORY_ALL]
cTB.vAssetType = CATEGORY_ALL
cTB.vPage[area] = 0
cTB.vPages[area] = 0
cTB.f_GetAssets()
cTB.vLastSearch[area] = cTB.vSearch[area]
if search != "":
cTB.signal_search(search)
cTB.vLastSearch[area] = search
def _build_search(cTB, props_wm, area: str) -> None:
@@ -108,14 +126,9 @@ def _build_search(cTB, props_wm, area: str) -> None:
row_aligned = row.row(align=True)
# NEED SEPARATE PROPS FOR SPECIFIC DESCRIPTIONS
row_aligned.prop(
props_wm, f"search_{area}", icon="VIEWZOOM")
row_aligned.prop(props_wm, "search", icon="VIEWZOOM")
if area == KEY_TAB_ONLINE and len(props_wm.search_poliigon):
search_show_x = 1
elif area == KEY_TAB_MY_ASSETS and len(props_wm.search_my_assets):
search_show_x = 1
elif area == KEY_TAB_IMPORTED and len(props_wm.search_imported):
if len(props_wm.search):
search_show_x = 1
else:
search_show_x = 0
@@ -141,11 +154,17 @@ def build_ui(ui, context):
cTB.vUI = ui
cTB.vContext = context
area = cTB.settings["area"]
props_wm = bpy.context.window_manager.poliigon_props
cTB.vSearch[KEY_TAB_ONLINE] = props_wm.search_poliigon
cTB.vSearch[KEY_TAB_MY_ASSETS] = props_wm.search_my_assets
cTB.vSearch[KEY_TAB_IMPORTED] = props_wm.search_imported
# Reset Filter to Online if any search term is added
if props_wm.search != "" and props_wm.search != cTB.vSearch[KEY_TAB_ONLINE]:
cTB.settings["area"] = KEY_TAB_ONLINE
area = cTB.settings["area"]
cTB.vSearch[KEY_TAB_ONLINE] = props_wm.search
cTB.vSearch[KEY_TAB_MY_ASSETS] = props_wm.search
cTB.vSearch[KEY_TAB_RECENT_DOWNLOADS] = props_wm.search
cTB.vSearch[KEY_TAB_IMPORTED] = props_wm.search
cTB.vSearch[KEY_TAB_LOCAL] = props_wm.search
_imported_tab_check_assets(area, props_wm)
@@ -165,12 +184,17 @@ def build_ui(ui, context):
if cTB.f_add_survey_notification_once(cTB):
save_settings(cTB)
notification_banner(cTB, cTB.vBase)
if not cTB.is_logged_in() or cTB.user is None:
build_login(cTB)
return
# If user_profile is None, "how_will_you_use_poliigon" is null in the API
# but don't show the survey if already submitted once this session (in
# case the request failed) and also to immediately proceed to the grid.
if cTB.user.user_profile is None and cTB.did_show_profile_survey is False:
build_onboarding_survey(cTB)
return
# Here we really need to check settings and not simply get primary path
# from addon-core, to get around addon-core providing a default path we
# are not interested in.
@@ -180,6 +204,8 @@ def build_ui(ui, context):
build_library(cTB)
return
notification_banner(cTB, cTB.vBase)
cTB.vBase.separator()
cTB.logger_ui.debug("build_ui -> build_upgrade_banner")
@@ -194,7 +220,7 @@ def build_ui(ui, context):
_build_search(cTB, props_wm, area)
cTB.vActiveCat = cTB.settings["category"][area]
cTB.vActiveCat = cTB.settings["category"]
cTB.vAssetType = cTB.vActiveCat[0]
cTB.logger_ui.debug("build_ui -> build_categories")
@@ -294,7 +320,8 @@ class POLIIGON_PT_toolbox(Panel):
classes = (
POLIIGON_PT_toolbox,
POLIIGON_MT_add_node_groups
POLIIGON_MT_add_node_groups,
POLIIGON_MT_asset_display_options
)