Skip to content

Commit

Permalink
Merge pull request #46 from EvenTorset/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
EvenTorset authored Aug 7, 2024
2 parents 33af106 + bb7a0eb commit 2300a40
Show file tree
Hide file tree
Showing 85 changed files with 1,843 additions and 2,955 deletions.
25 changes: 24 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
# Changelog

## [14.0.0] - 2024-08-07

### Highlights
- Added `NodeAnimatedRotation` - A function that creates a `NodeSpin` action from a rotation property. Animating the rotation directly is not normally possible, it can only be done by controlling the angular speed. This function makes it possible by converting a rotation property to an angular speed property.
- Added more utility functions:
- `FXRUtility.box` - Creates an outline of a cuboid shape.
- `FXRUtility.rect` - Creates a rectangle.
- `FXRUtility.ellipse` - Creates an ellipse.
- `FXRUtility.ellipsoid` - Creates three ellipses that form the outline of an ellipsoid.
- `FXRUtility.cylinder` - Creates an outline of a cylinder.
- `FXRUtility.transform` - Wraps a list of nodes in one that has a transform applied to it. The transform is defined by a translation, a direction to align with, and a roll angle. This makes it easier to point nodes in specific directions, or to just move them.
- `FXRUtility.outlineEmitters` - Adds outlines for all node and particle emitters in a node.
- `FXRUtility.animatedNodeRotation` - Creates a `NodeSpin` action from a rotation property. Animating the rotation directly is not normally possible, it can only be done by controlling the angular speed. This function makes it possible by converting a rotation property to an angular speed property.
- Added `anyValueDiff` - This function subtracts one `AnyValue` from another. (An `AnyValue` is any scalar or vector value, including all types of properties.) This function simply uses the existing `anyValueSum` and `anyValueMult` functions to do this, so it works very similarly to those.
- The three box size fields in the force volume actions have been converted to a single vector field.
- The fallback for distortion and blur colors when applying a color palette has been changed to just white. This fixes partial palettes making some effects have strange-looking, bright or dark rectangles floating around.
- `DataAction`s now have a new `meta` property with some information about the action type.
- `meta.isAppearance` - True if the action is an appearance action.
- `meta.isParticle` - True if the action defines a particle appearance.
- More is likely to be added to this in the future, if there are other things like this that is useful to have easy access to.
- All of the position offset, speed, and acceleration fields in the GPU particle actions have been converted to vector fields. This got rid of 68 fields in total, so it can simplify things a lot.

## [13.0.0] - 2024-08-04

### Highlights
Expand Down Expand Up @@ -32,7 +54,7 @@
- The color multiplier and bloom color fields in the LensFlare action (10014) have been converted to vector fields.
- This fixes a bug where these fields were not changed by the recolor functions in the library.
- Converting point lights between DS3 and the other games should now keep the brightness more like the original. DS3 point lights seem to work a bit differently, so it stil won't be perfectly accurate, but it should be much closer than before.
- The rate of time can now be adjusted on nodes or actions using the new scaleRateOfTime method.
- The rate of time can now be adjusted on nodes or actions using the new `scaleRateOfTime` method.
- The rate of time in action 10500 is now automatically applied to everything when writing to DS3. This fixes converting effects from newer games to DS3 causing them to play at a different rate than the original effect if the original had a non-unit value for the rate of time.
- The `FXR.toArrayBuffer` method will now throw if the FXR's ID is invalid.
- Added an `FXR.name` getter function to FXR objects, which returns a file name for the FXR based on its ID.
Expand Down Expand Up @@ -115,6 +137,7 @@
- External values 2000 and 70200 for AC6 have been documented thanks to lugia19.
- Fixed action 301 (EqualDistanceEmitter) missing a type for one of its fields, potentially causing issues when writing to DS3's structure.

[14.0.0]: https://github.com/EvenTorset/fxr/compare/v13.0.0...v14.0.0
[13.0.0]: https://github.com/EvenTorset/fxr/compare/v12.2.0...v13.0.0
[12.2.0]: https://github.com/EvenTorset/fxr/compare/v12.1.0...v12.2.0
[12.1.0]: https://github.com/EvenTorset/fxr/compare/v12.0.0...v12.1.0
Expand Down
16 changes: 14 additions & 2 deletions build/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@ const timeMap = {
sq: 4,
}

function toTSString(v) {
if (typeof v === 'string' || Array.isArray(v)) {
return JSON.stringify(v)
}
return v.toString()
}

function naturalSorter(as, bs) {
let a, b, a1, b1, i = 0, n, L,
rx = /(\.\d+)|(\d+(\.\d+)?)|([^\d.]+)|(\.\D+)|(\.$)/g
Expand Down Expand Up @@ -131,6 +138,10 @@ export default async function(writeToDist = true) {
for (const fn of fs.readdirSync(actionsDir).sort(naturalSorter)) {
const data = yaml.parse(await fs.promises.readFile(path.join(actionsDir, fn), 'utf-8'))

if (!('meta' in data)) {
throw new Error('Missing meta object in action data: ' + fn)
}

if ('slot' in data) {
if (!actionSlots.has(data.slot)) {
actionSlots.set(data.slot, [])
Expand Down Expand Up @@ -284,7 +295,8 @@ export default async function(writeToDist = true) {
* ${data.desc.trim().replace(/\n/g, '\n * ')}
*/
class ${data.name} extends DataAction {
declare type: ActionType.${data.name}
declare readonly type: ActionType.${data.name}
declare readonly meta: ActionMeta & {${Object.entries(data.meta).map(e => `${e[0]}:${toTSString(e[1])}`)}}
${Object.entries(data.properties ?? {}).filter(e => !e[1].omitClassProp).map(([k, v]) => {
return (
'desc' in v ? `
Expand Down Expand Up @@ -326,7 +338,7 @@ export default async function(writeToDist = true) {
propNames.length > 1 ? `props: ${data.name}Params = {}` :
`${propNames[0]}: ${data.properties[propNames[0]].type ?? typeMap[data.properties[propNames[0]].field]} = ${defValTS(firstProp)}`
: ''}) {
super(ActionType.${data.name})${'properties' in data ? `
super(ActionType.${data.name}, {${Object.entries(data.meta).map(e => `${e[0]}:${toTSString(e[1])}`)}})${'properties' in data ? `
this.assign(${propNames.length > 1 ? 'props' : `{ ${propNames[0]} }`})` : ''}
}
}
Expand Down
5 changes: 4 additions & 1 deletion build/docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ await fs.rename('docs/functions', 'docs/funcs')
for await (const filePath of getFiles('docs')) {
if (filePath.endsWith('.html')) {
const content = await fs.readFile(filePath, 'utf-8')
await fs.writeFile(filePath, content.replace(/href="((?:..\/)*)functions/g, 'href="$1funcs'))
await fs.writeFile(filePath, content
.replace(/href="((?:..\/)*)functions/g, 'href="$1funcs')
.replace(/&lt;a href=&quot;.+?&quot; class=&quot;.*?&quot;&gt;<wbr\/>(.+?)&lt;\/a&gt;/, '$1')
)
}
}

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cccode/fxr",
"version": "13.0.0",
"version": "14.0.0",
"description": "JavaScript library for creating and editing FXR files for Dark Souls 3, Sekiro, Elden Ring, and Armored Core 6.",
"author": "CCCode",
"type": "module",
Expand Down
3 changes: 3 additions & 0 deletions src/actions/1.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
type: 1
name: NodeAcceleration
slot: NodeMovement
meta:
isAppearance: false
isParticle: false
desc: |
Controls the movement of the node. This is the most basic action for controlling the acceleration of nodes.
properties:
Expand Down
Loading

0 comments on commit 2300a40

Please sign in to comment.