§19. Assets: Store Libraries as Records
[[[assets]]]
Overview
[[[assets#overview]]]
- #673: docs: the asset type, the library wizard and prefix buckets
- #674: feat(core): declare the asset type and its block
- #675: feat(core): a source's site_id, and finding a record by site and id
- #676: feat(core): asset columns and a formats link table in the cache
- #677: feat(core): the .rehuterms license sidecar
- #678: feat(agent): asset fields in the editor, the browser and the search line
- #679: feat(agent): Open in Web Browser on the browser's selection
- #688: feat(agent): the license subdock, Refresh License, and the sidecar's path in Copy as JSON
- #705: feat: an asset holds a list of licenses, each with its own text
The block, the cache, the license sidecar, the editor, the browser and the license's dock are built
(#674, #676, #677, #678, #679, #688): asset is a declared type whose fields are read and checked as §19.1 says, kept
in the catalog cache, one column each and formats in a link table of its own, shown and edited beside a record's
other fields, and a column, a preset and a filter token of the browsers, with Open in Web Browser and Refresh
License on their selection, and the license's text shown and edited in a dock of its own. The rest is the design for
this fourth resource type: something acquired from a store to be used in other work, such as a 3D model, a texture
set, an animation pack, an audio pack, a Blender add-on or an Unreal plugin. It answers the 3D objects as a resource
category question [[appendices.open-questions#still-open]] left open.
- What it is for. A store library of a few thousand items, most of them never downloaded, that has to answer three questions fast: what do I own, can I use it in this project (format, engine version, license) and where is it.
- A record is mostly metadata. One
.rehuand a few screenshots per item; the files themselves arrive later, for the few items actually used ([[assets#online-only]]). - Records are created by a scan of the store account, not by hand: the library wizard ([[acquisition-tooling#library-wizard]]) reads what the account owns and writes one record per item.
- A library is thousands of small files in one root, so such a root spreads them over prefix buckets ([[mounts-and-storage#buckets]]).
- Daz3D is the same type with more on it ([[assets#install]]), not a type beside it.
§19.1 The asset block
[[[assets#block]]]
Every field is optional, and a missing field means not known. A plugin has no triangle count and a scan of a store page measures nothing; neither is an error, and neither writes a zero. The block follows the rules every plugin block does ([[plugins#plugin-blocks]]).
| Key | Value type | Filled by | Meaning |
|---|---|---|---|
kind |
one of [[assets#kind]] | scan, or by hand | what the item is; unknown until something says |
licenses |
list of {license, url} |
scan | each license the item is held under ([[assets#licenses]]): a short id (fab-standard, cc-by-4.0, fab-ue-only), unique in the list, and where the store states its terms, if it does |
formats |
string list | scan | file formats delivered: fbx, glb, blend, uasset |
compatibility |
map, string to string | scan | what it works with and in which versions: {"blender": ">=4,<5", "unreal": "5.1-5.6"} |
source_updated |
partial-precision date | scan | when the store last changed the item |
advertised_version |
string | scan | the version the store offers |
current_version |
string | by hand, or an install manager | the version of the local files |
advertised_size |
size (bytes) | scan | the download size the store states |
advertised_triangles |
range text | scan | the triangle count the store states, per format ([[assets#ranges]]) |
advertised_texture_size |
range text | scan | the longest side of the largest texture the store states ([[assets#ranges]]) |
triangles |
integer | measured | triangle count of the heaviest mesh at full detail |
texture_size |
integer | measured | longest side, in pixels, of its largest texture |
acquired |
UTC time, or a partial-precision date | scan | when the account got it, where the store says |
- Reused from the core, not repeated in the table:
description,released(the store's publication date),authors, the tag lists, the screenshots, and the measured size pair ([[field-schema#duration-size]]). - Taken from the set tutorials and reference images share:
rating,favorite,online([[assets#online-only]]) andcollections(a store bundle is a collection).complete,keepandlearning_pathsare left out: they describe content being studied, and an asset is not. source_updatedis notupdated. The core'supdatedis when the record was last edited ([[field-schema#resource-types]]); a store changing its item is a fact about the item.advertised_sizeexists here and nowhere else. [[field-schema#duration-size]] has none because no site publishes a tutorial's size. Stores do publish an asset's, and for a record with no files it is the only size there is: it is what a download is planned with.- The version pair is the size pair's shape: what the store offers beside what is on disk. An item whose two versions differ has an update waiting.
- The advertised counts are what the store states, as text ([[assets#ranges]]); the measured ones are
filled after a download, by hand until something measures them, and the scan never guesses them.
The measured fields are
trianglesandtexture_size.trianglesis the heaviest single mesh because a pack's total says nothing about what one object costs to draw. acquiredis never asked for. Where the store shows the date the scan records it; where it does not, the field stays empty. Fab states it for every owned item (the entitlement'screatedAt). It sorts the library, and beside the date a license was read ([[assets#licenses]]) it says how far the saved terms are from the day the item was got.acquiredis a time where the store gives one, unlikereleased, the core's publication date: an ISO 8601 UTC time with six fractional digits and aZ(Fab'screatedAtto the microsecond:2024-05-03T12:34:56.789123Z), a partial-precision date (2024-05-03) where the store gives only a day. Never a local offset, so its text sorts in time order and the cache compares it as text; the library scan's cursor is the newest one ([[acquisition-tooling#library-scan-job]]).formatsis a field, not tags, because it is the filter used most and the tag lists are the store's own vocabulary. The cache gives it a link table of its own, as tags have.- What the store calls its categories goes into
advertised_tagsuntouched, as every scraped tag does ([[acquisition-tooling#scraper-protocols]]). - What the scan makes from a store's field, rather than copies from its tag list, is a tag too, always prefixed
by what it is, because a store's own tags describe what is depicted and a bare word collides with them (a
mature wolf, a windows prop). As tags, two spellings of one label merge the way any tag does, where fields
would each need a merge of their own. The separator is
-, never:, which the search line reads as a field token. From Fab: rating-maturewhere the listing isisMature;platform-<name>, lower-cased, for each of an Unreal format'stargetPlatforms(platform-windows,platform-mac); none means any;ai-forbiddenwhere the listing isisAiForbidden, Fab's NoAI mark: no generative-AI datasets, development or training under a Standard License, as the item was tagged when it was got. It does not bar using AI tools on the file ([[appendices.assets#ai-tags]]);ai-generatedwhere the listing isisAiGenerated, Fab's CreatedWithAI mark.
The licenses an item is owned under are its licenses, never tags (#705).
- A delisted item, written without its listing, carries only the labels its library entry states: rating-mature
and platform-<name>. The AI marks are a listing's alone.
- A rig and levels of detail are the user's tags (extra_tags). Fab states them per format and mostly leaves
them empty, so the scan writes nothing for them.
- What an item needs or supplies is not here. No Fab listing states it; Daz3D's products do, and its design adds
requires / provides when it is made ([[assets#install]]).
§19.1.1 A count the store states as a range
[[[assets#ranges]]]
A store gives some figures as a band: Fab's triangle count of a format is [12, 13), a texture's longest side
[1024, 2049). advertised_triangles and advertised_texture_size keep them as text a person reads at a
glance and types by hand, inclusive at both ends: a value alone (12), a band (1000-4999), several values or
bands apart as a comma list, ascending (1024,2048, 12,40-60), written and read only by
rehuco_core.ValueRange. A count the store states no range for, or one with nothing inside it, is left out.
A text typed that is no range stays as it was typed: it never locks the document, and a search finds nothing in it.
A value has at most 18 digits (rehuco_core.value_range.MAX_DIGITS); a longer one is no value, since the cache's integers could not
hold it.
A search compares by the bounds (#678): advertised_triangles<15 finds a record when any value of its range is
below 15, so 14, 12-13, 1-14 and 10-20 all match; >15 finds one whose largest value is above it, and <= and
>= read the same two ends. The word is the field's full name, an operator and a whole number, with no space, since
the line splits on them; triangles<15 stays free text, the measured count not being a range. The cache keeps the two
bounds of each field in columns of their own (schema v11), NULL where the text is no range, so the comparison is an
integer one and a text that is no range is never found.
§19.1.2 kind
[[[assets#kind]]]
One value from a closed list: model, pack, character, animation, material, texture, decal, brush,
hdri, audio, vfx, plugin, tool, template, unknown.
- A
packis many models sold as one item: an environment, a kit, a prop set. - A
decalis a texture projected onto a surface: cracks, stains, road markings. Abrushis a sculpting or painting brush, or an alpha. Fab lists both as categories of their own. - A missing
kindreads as not known. The kind filter still finds such a record both asunknownand as an empty kind, so the unsorted items are one filter away whichever way they came to be:kind:unknownfinds an asset with that kind or none,kind:""an asset with none, and both only among assets, a tutorial's kind being missing for good. The other tokens an asset adds arelicenses:andformats:, each matching one value whole as the other field tokens do, case and accents ignored as a tag's are:licenses:fab-standardfinds every asset holding that license among its licenses. - A MetaHuman is a
character. A Blender add-on or an Unreal code plugin is aplugin; a standalone program is atool; a sample project is atemplate. unknownis a real value, not a missing one. A scan that cannot classify an item writesunknown, so the items nobody has sorted are one filter away. It is the one field of the block that is never left empty.- A site's scan maps the store's own listing type to a kind where the store states one, and writes
unknownotherwise. It does not infer a kind from a title.
§19.1.3 A record keeps its license text
[[[assets#licenses]]]
The terms are what decides whether an item can ship, and they are the store's to change or to take down. So a
record keeps the texts themselves, in a sidecar beside it: <stem>.rehuterms, one per record, never shared between
records. An item is held under a list of licenses (#705): an account can own one under several -- the Standard
License and its UEFN - Reference only tier, say -- so the block's licenses names each, in the user's order, by its
short id (what a library is filtered by) and, where the store states its terms, their url. Ids are unique in the list,
so Fab's Personal and Professional tiers, which grant the same rights, are one fab-standard.
- The file is JSON, one text per license id. Each id holds
title,url(where the text was read),read, the date it was read -- a store's terms change, and a saved text is only as good as its date -- andtext, the terms as Markdown as a list of their lines, so the file reads line by line and every line is kept exactly, trailing spaces included; text with nourlhas nourlkey. It is written as a.rehuis (two-space indents, characters as they are), read and written byrehuco_core.license_terms, an atomic write under the record's own lock, and a file that cannot be read is refused, never taken for empty terms. JSON over YAML (#705): a YAML block shows a text better, but turns any line ending in a space into one escaped string, and its parser is ten to five hundred times slower (0.5-25 ms against 0.05 ms for a 57 KB text), which Refresh License over a library of 20,000 feels; the cache's scan never opens the file. - It is bookkeeping, not content. Named by its suffix alone,
<stem>.rehutermsis left out of a record's content, size and checksums as a screenshot and a.rehuserare, so a scan writing it or a refresh replacing it never makes a checksum stale, and a move never refuses a record for it. The Files list shows it as the record's license. - It belongs to the record as its screenshots and its
.rehuserdo. A rename, a move and a delete carry it, and a record moved by hand takes it along with the rest of its files. A root that is offline takes nothing from another root's records, and a store that has gone leaves every text where it was. - The scan writes it with a new record ([[acquisition-tooling#library-scan-job]]), reading each distinct license
once per run, keyed by the store's license path rather than by its
url, which differs between labels of one license and may be empty (below). The text is therefore the terms on the day of the scan, which for an item got years earlier is not the day it was got;acquiredbesidereadshows the gap, and nothing recovers the older text. - An item owned under several tiers holds every one (#684, #705): each is an entry of
licenseswith its text, broadest first -- Professional, Personal, CC BY, UE Marketplace, UEFN - Reference only, a tier no list names coming after under its own group and slug, with nourl-- and an id met twice is kept once, its text read from the first tier of it. The tiers are the library entry's, never the public listing's, which offers all of them. A Fab URL dropped on a record reads them from the account's own state of that listing, when the persona browser is logged in to Fab, by the same rule (#702), and reads the text of each (#703): a license the record has no text for holds the one read, as a preset picked in the dock does, and the record's next Save writes it; a text the record already has, saved or typed, is kept. - What Fab gives (#686): each owned item names its license(s) as a
group(name,slug,url) and apath(license/standard/reference-plus-source,license/cc/cc-by,license/legacy/uem). Thepathis the stable identifier and the short id is derived from it; the label is not (Creative Commons and Creative Commons Attribution (CC BY 4.0) are bothlicense/cc/cc-by, and their URLs differ: a generic index page, and the license's own page). Standard License links to/eula, whose full text is public JSON at/i/eula/fab_eula; the CC pages read logged out; UE Marketplace has no URL, so its entry has an id and no text. An item may hold several licenses (a Personal and a UEFN reference only tier; 241 of 4,250), and three delisted items hold none. - A file with no
urlis terms written for that item alone. It is typed in, and nothing ever refreshes it. - It is read and edited in a License subdock of its own (#688, #705), as the description is, since the text can
be long; the Main Editor shows no license. An asset's document has it, hidden by default. At its top, a list of
the record's licenses, each its id and its
url, growing with its rows and never scrolling; the first is selected when the record is shown, and the one selected is kept while the record still holds it, under a new id too. Below it, the selected license's terms rendered as Markdown under their title, with a line saying the day and the address they were read from. F2 or the dock's Edit action makes the list editable and swaps the rendered terms for an editor of the text: the list shows an add and a delete button beside it and a grip at each row's left that drags the row to another place, as the Roots view's do. The id is picked from a list: Custom first, then the presets a scan writes, a preset another row holds shown but not to be picked. A preset is itsurland its text: picking one sets the row'surland reads its text in the background over plain HTTP, as Refresh License does, the text landing when it arrives (none forfab-ue-only, which has no terms page; a text that cannot be read is logged, and a refresh fills it in later). Picking Custom leaves that name in the cell, selected, to be typed over or kept as it is, with nourlor text of a preset's -- many records can hold a license so named, each with its own text; a custom license renamed keeps theurland text its user gave it. Theurlcell is typed into. An id is never emptied or given twice. A row added stays while the dock edits, wherever the focus goes, and is a license once it has an id; the rows still without one go when the editing stops or the record is saved. Deleting a license takes its text out of the file. Reading, the list shows neither buttons nor grips and takes no edit. A license with no text shows nothing but its row, the empty view saying so. The text's day, and itsurlwhere it was read, are shown and never edited. Typing into a license with none makes terms written for that item alone, titled by the license's id, with nourland today for the day; terms typed and emptied again before a save are gone, and a saved text is never removed by typing, only emptied. A double-click on the record's.rehutermsrow in the Files list shows the dock in its reading mode; for a type with no such dock, as in the Roots view, the system's app opens the file. A file that cannot be read is named in the dock and left alone until it is fixed, and a document that cannot be written shows the terms and cannot edit them. - The text is saved with the record, by its Save (#688). In memory the terms ride the document's payload as a
per-user state does, under a reserved top-level key that no
.rehuever holds, so an edit makes the document dirty, a Revert drops it, and the save's check, a save kept across a quit and the conflict dialog treat it as one of the record's details. It is judged apart from the rest in one way: a save that finds its own text already in the file, as after one cut short between the text and the record, is no conflict, and a document that holds none takes the file's. The save writes the.rehutermsbefore the record, and only where its text differs. A writer that read the record without the text -- progress, a Measure, a rename of a value -- leaves the file as it is, and a file that cannot be read is never written over. A text changed on disk meanwhile is the record changed there: an open document without edits reads it again, and one with edits is told, and the save shows the difference. - Nothing reads a license from the net when a record is opened. A saved text changes only through Refresh
License, on the browser dock's selection: each distinct
urlamong the selected records' licenses is read once and compared with what each record holds for that license. - A refresh never replaces a text unasked. A record with none gets one. Where the terms differ, the user is shown the license, both dates and how many records hold the older text, and it is replaced only on a yes. The text an item was got under may be the one that still applies to it, so it is not the tool's to overwrite.
- How a refresh runs (#688). It is a job on the task queue, off the GUI thread, unchained and not kept across a
quit.
Each record is read for its type, its licenses and its saved texts, and each license is settled on its own:
a text is compared as its Markdown without the blanks around it, never by its title or its day, and a write
changes that license's text alone. A text with no
urlis never touched, whatever its license'surlsays, and a record that is not an asset, a license that states no address and one that states an address no reader knows are left as they are. The texts Fab's listings point at are read over plain HTTP, with no login: the Standard License from its public JSON and Creative Commons BY from its plain legal code (an address is matched to its reader whatever its case or closing slash, since the record's is the license's page and not where its text is read from); a text is kept with its lines ended in LF whatever the server sent. A store that does not answer costs the records of that license, counted as such, and no other; a record that is unreadable, locked, on a share that does not answer or gone is counted, logged and left as it was, and the rest go on. The question is a dialog that does not block the window: one row per license, each unchecked, with how many records hold another text, the days those were read and the day the store's was; Replace Checked enqueues a second job that replaces the checked licenses' texts only in a record that still holds the text that was compared, and Keep All changes nothing. The row of the Tasks dock says what the run counted. - A restriction is a different license, never a note. Content a store limits to one engine gets an id of its own
(
fab-ue-only; Fab's UEFN reference only tier,fab-uefn-reference-only) so the limit is a filter, not a sentence in a description. - Copy paths as JSON names the file (#688). The list holds an object for every selected resource, its
pathand, for an asset that has a.rehuterms, itslicense: the path of that file, so whatever reads the selection can read the terms. Whether a record has one is a question for its disk, so it is asked off the GUI thread and the clipboard is set once it answers; Copy paths stays immediate and plain.
Why the text is kept, and when a license binds the buyer, is [[appendices.assets#acquisition]].
A few thousand copies of two or three texts is the price, and it is paid on purpose: one shared copy per root, a cache, or a license record of its own each leave some record without its terms the day a root is offline, a file is moved by hand, or a store is gone.
§19.1.4 A source carries the store's id
[[[assets#site-id]]]
sources[] ([[field-schema#sources]]) gains one optional key, site_id: the store's own identifier for the item,
a listing id or a SKU. It is a core field because any type's source can have one, though only the library scan needs
it.
- It is the match key for a rescan. A store renames items and serves one item under several URLs; the id is the one thing that stays.
- It is a row of the source's card in the editor, under the publisher: read, corrected, typed in for a source a scrape never filled, or emptied, which removes the key.
- The cache indexes
(site, site_id), where the site is the source'spublisher, which a scraper fills with itssite_name([[acquisition-tooling#scraper-registry]]), compared ignoring case, so finding the record for a listing is one lookup and never a walk. A source has no site key of its own: a publisher edited by hand stops the match. - An item owned on two stores is one record with two sources, each with its own id, as a tutorial sold on two platforms already is.
§19.2 A record without its files
[[[assets#online-only]]]
Most asset records hold no content, and that needs no field. The measured current_size already says it: empty or
zero means nothing is local, a value means the files are there. This is the reading [[field-schema#online-flag]]
already gives a tutorial kept as a .rehu, its screenshots and a URL, and it closes the online-only and mixed
local/online resources question for this type.
onlinekeeps its meaning: the item can still be had from its source. A rescan that no longer finds an item in the account sets it false and changes nothing else; a scan never deletes a record.- Downloading is not this type's business. Files reach a record's place by whatever means the store offers; the next size measurement finds them.
§19.3 Using an asset, and installing one
[[[assets#install]]]
There is no install action for assets in general, because there is no one thing to do: a store's launcher adds its packs to a project, a Blender add-on installs through Blender, and a loose model goes through whatever import pipeline the project has. Unlike Daz3D ([[plugins#daz3d-plugin]]), where installing is registering with one application, none of that is rehuco's to drive.
- What the browser offers instead is Open in Web Browser (#679) on the selected records, in the table's context
menu above Refresh License and the two copies: each record's primary source URL, opened in the user's everyday
browser, in the table's order and once however many records share it. From there the store's own page does the rest.
Only an
httporhttpsaddress naming a host counts, since a.rehuis outside input; a record with none adds nothing, and with none selected that has one the entry is disabled. More than ten pages asks first, with Cancel the default. - A site may bring its own install manager later. Daz3D is the first, and the per-user, per-machine
installedfield [[data-model]] reserves for it belongs to that manager's block, as doescurrent_versionwhen a manager sets it. A store that turns out to be worth the same treatment gets the same shape. - Daz3D is therefore
assetplus a manager: itsskuis asite_id, and therequires/providesits products state are fields its design adds to this block. It is not a second type with a second set of columns.
§19.4 What adding the type touches
[[[assets#new-type-touches]]]
The first type added since the original three, so the places that enumerate types are listed once, here, for whoever adds the next.
rehuco-core: the field tuples andBUILTIN_PLUGINSinplugins/plugin_registry.py, and the exports beside it;BLOCK_TARGETSand a migrations subpackage once the block's shape first changes (assethas neither yet: a block with no chain is version 0); the per-key value rules inrehu_locks.py, checked only where the type declares the key; the typed getters onrehu_document.py;TYPE_FIELD_COLUMNS(withCOLUMN_FIELDSfor a column named apart from its field, asasset_kindis), the column DDL and a schema step inrehudb.pyandmigrations/rehudb/, with the formats link table;rehudb_scan.py, which fills them;PLUGIN_PLACEHOLDERSinlocation_pattern.py; and, for a type with a sidecar of its own as this one has ([[assets#licenses]]), whatever enumerates a record's files.rehuco-agent: the field-to-widget map indocuments/document_fields.py;TYPE_DOCK_NAMES; the browser's columns and presets; the root layouts editor; the per-type settings pages and location templates;type_label;SCRAPED_FIELD_NAMESand the scrape result schema. A type that adds filterable fields adds them to the filter line'sCatalogFieldand to the in-memory matcher (catalog_snapshot.py), which the contract test holds to the cache's.- Specs: the badge table in [[plugins#badge-colors]] and the mapping table in [[field-schema#resource-types]].
§19.5 Deferral
[[[assets#deferral]]]
- Measuring
trianglesandtexture_sizefrom downloaded files. Until then they are typed in. - Install managers, Daz3D's included ([[assets#install]]).
- Licenses as something to browse. A branch of the Tag Browser ([[plugins#tag-browser]]) listing the license ids in use, and a document per license, wait until someone wants more than the filter.
- Any store beyond the first. The wizard's protocol ([[acquisition-tooling#library-wizard]]) is what a second one is written against; none is designed here.