Skip to content

feat: add SMP <pattern> macro grammar to the physics XSD#7

Draft
DaymareOn wants to merge 3 commits into
mainfrom
feat/xsd-pattern-grammar
Draft

feat: add SMP <pattern> macro grammar to the physics XSD#7
DaymareOn wants to merge 3 commits into
mainfrom
feat/xsd-pattern-grammar

Conversation

@DaymareOn

@DaymareOn DaymareOn commented Jun 24, 2026

Copy link
Copy Markdown
Owner

What Adds the <pattern> / <pattern-default> / <param> / <body> / <repeat> grammar to hdtSMP64.xsd (2.1.0 -> 2.2.0), so an external XML editor validating a pattern-bearing physics file against this schema accepts it instead of flagging the new elements. FSMP itself expands patterns before its own validation, so in-game and the FSMP validator are unaffected - this is purely for author tooling. ## Details - system now allows pattern, pattern-default, repeat. - pattern-default: name (required) plus optional author (namespace) and version; holds param* then one body. - body / repeat content is lax (xsd:any skip), because templates carry ${placeholders} the strict element types would reject; the expanded output is still validated strictly. - pattern (use): name (required) plus optional version plus any other attribute (the parameter values). ## Verified .NET XmlSchema: the schema compiles clean, a pattern-bearing sample validates, and invalid docs (missing name, unknown element) still error - and the allowed-children list now includes pattern, pattern-default, repeat. ## Companion PR Implements the editor-schema half of DaymareOn/hdtSMP64#397 (feat/xml-patterns). ## Status Draft. Branched from origin/main, isolated from the in-progress work on feat-sch-degrees-warning. 🤖 Generated with Claude Code

Update (da42538)

Also adds, so that pattern library files (the patterns/*.xml kind) validate, not just <system> files that use patterns:

  • XSD: a <patterns> root element (holds pattern-default definitions only).
  • Schematron (hdtSMP64.sch): a pattern-macros rule set — <repeat count> must be a non-negative integer or a ${...} placeholder, <repeat from> an integer or placeholder, count="0" warns, and param / pattern-default names must not contain spaces. Written without XPath-2.0 regex so they never error in the runtime validator (which only sees expanded docs) yet fire in an authoring editor.

Verified with .NET XmlSchema (schema compiles; system + patterns docs validate; bad library rejected; count rule flags only malformed repeats).

FSMP expands <pattern>/<pattern-default> macros before validation, but an
external XML editor validating a pattern-bearing file against this schema would
flag the new elements. Add them so editors accept such files:

- system now allows pattern, pattern-default, and repeat.
- pattern-default: name (required) plus optional author (namespace) and version;
  holds param* then one body.
- param: name (required) plus optional default.
- body / repeat content is lax (xsd:any skip) because templates carry
  ${placeholders} the strict element types would reject; FSMP validates the
  expanded output strictly.
- pattern (use): name (required) plus optional version plus any other attribute
  (the parameter values).

Schema version 2.1.0 -> 2.2.0. Verified with .NET XmlSchema: the schema
compiles, a pattern-bearing sample validates, and invalid docs (missing name,
unknown element) still error.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 5ae626a2-c639-416e-bd21-dde0bb3e332a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/xsd-pattern-grammar

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

DaymareOn and others added 2 commits June 24, 2026 19:09
Completes editor support for pattern files:
- hdtSMP64.xsd gains a <patterns> root element so shared pattern-library files
  (patterns/*.xml) validate, not just <system> files that use patterns.
- hdtSMP64.sch gains a pattern-macros rule set: repeat count must be a
  non-negative integer or a placeholder, repeat from must be an integer or a
  placeholder, count="0" warns (emits nothing), and param / pattern-default
  names must not contain spaces. Written without XPath-2.0 regex so they never
  error in the runtime validator (which only ever sees expanded docs) yet fire
  in an authoring editor.

Verified with .NET XmlSchema: the schema compiles; a system doc and a patterns
library both validate; a bone in a patterns root is rejected; the count rule
flags only the malformed repeats.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
A worked example for the modder guide: rebuilds one Cloaks of Skyrim cloak
as a crossed 2-D tissue using the FSMP pattern feature. Ships only XML config
(cloak.xml consumer + shared patterns/DaydreamingDay.xml library), no art
assets; requires Cloaks of Skyrim + Artesian Cloaks of Skyrim for the rigged
NIF. Includes a README (requirements, install, credits, permissions) and a
reproducible package.ps1 that builds the versioned zip (attached to a GitHub
Release, not committed).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant