kwaroran / character-card-spec-v3

A updated spec for character card used on roleplay.
MIT License
34 stars 4 forks source link

Use of ccdefault: is unclear #7

Closed DominaeDev closed 3 months ago

DominaeDev commented 4 months ago

how the path for embedded assets formated SHOULD follow this format: embeded://path/to/asset.png. this format is case sensitive, and sepearated by /. if the URI field is ccdefault:, the application SHOULD use the default asset for the type.

The spec says that if the uri is ccdefault: a default should be used. It then proceeds to say:

how the default asset is determined is up to the application except it is specified in the specification.

I'm trying to make sense of this in the context of making an editor, hoping to load and save charx-files and be compatible with many different applications. Since the uri field no longer contains a specific location for the asset, how would an editor know which data to assign that particular asset? If it's up to every application/editor to determine their own default behavior, wouldn't that defeat the purpose of the uri field and risk incompatibilities arising between different applications and editors? For instance, how should an editor interpret ccdefault: when reading an arbitrary charx file, without knowing its intended application?

Here are some others questions that arose as I tried to follow the spec: Is ccdefault: equivalent to embedded://assets/{type}/main.{ext}, or does it point to any (or first) asset of that type? What should happen if multiple assets of the same type have a uri of ccdefault:, or is that not allowed? I can't find the answers in the spec.

Or, and I'm coming to this realizations as I'm writing this, should an editor ignore the assets array altogether when reading a charx and just look at the contents of the zip instead?

kwaroran commented 4 months ago

If the type field is icon, the asset SHOULD be used as an icon or protrait of the character. if one of the assets is icon type, the application SHOULD use the asset as the icon of the character card. if there is multiple icon type assets, the application SHOULD use the main icon or let the user choose the icon, or change dynamically by the application. how the main icon choosed is below on the specification. if uri field is ccdefault:, and the card is PNG/APNG embedded, ccdefault: SHOULD point the PNG/APNG file itself or modified version of the PNG/APNG file.

The ccdefault: was initially devised to facilitate the retrieval of the PNG file itself from character cards embedded within the PNG. However, since it is possible that the ccdefault: will be located outside the PNG file, in which case it is designated as the default asset serving as a fallback in this instance. In this context, the term "default asset" typically denotes a placeholder image. It would probably be a good idea to display something like a simple person icon in the editor you are creating.

So in CharX, in most cases, you can expect ccdefault: would work like 'No Image here, use placeholder'. In the case of characters with proper assets, the correct format would be embeded:// rather than ccdefault:.

DominaeDev commented 4 months ago

I see. That helps! Thanks for clarifying.