@nice2dev/game-engine 1.1.9 → 1.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +69 -0
- package/dist/cjs/ai/StateMachine.js +54 -0
- package/dist/cjs/editor/AnimationRetargeting.js +13 -0
- package/dist/cjs/editor/TimelineEditor.js +12 -0
- package/dist/cjs/index.js +8 -0
- package/dist/cjs/native-engine/AnimationSystem.js +840 -0
- package/dist/esm/ai/StateMachine.js +53 -1
- package/dist/esm/editor/AnimationRetargeting.js +13 -1
- package/dist/esm/editor/TimelineEditor.js +12 -1
- package/dist/esm/index.js +4 -3
- package/dist/esm/native-engine/AnimationSystem.js +835 -0
- package/dist/types/index.d.ts +4 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,74 @@
|
|
|
1
1
|
# @nice2dev/game-engine — Changelog
|
|
2
2
|
|
|
3
|
+
## 1.1.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- The package description on npm shows a dash instead of the mis-encoded "—".
|
|
8
|
+
- 1.1.10 — the additive part of OmniVerk's 1.2.0 list: ui-audio builds without optional packages, one
|
|
9
|
+
i18n context, dictionaries per language, data props optional. No breaking changes.
|
|
10
|
+
|
|
11
|
+
**`@nice2dev/ui-audio` no longer breaks the consumer's build.** It imported `react-bootstrap`,
|
|
12
|
+
`recharts`, `react-window`, `react-youtube` and `pitchy` statically while declaring none of them
|
|
13
|
+
(only optional entries in `peerDependenciesMeta`), so a Vite app without them failed with "failed to
|
|
14
|
+
resolve import". Loading them with `import()` is no way out: Vite 8 (Rolldown) resolves dynamic
|
|
15
|
+
imports at build time and fails the same way, which made `hls.js` and `phaser` mandatory too.
|
|
16
|
+
`react-bootstrap`, `recharts`, `react-window` and `phaser` are now gone from the code
|
|
17
|
+
(`NiceBarFillEditor` uses Nice controls, `NiceVocalPerformanceReport` uses `NiceChart` /
|
|
18
|
+
`NicePieChart`, the karaoke editor list uses `NiceVirtualScroller`, `NiceKaraokePhaserRenderer`
|
|
19
|
+
renders with the DOM and keeps its name); `pitchy`, `react-youtube` and `hls.js` are regular
|
|
20
|
+
`dependencies`. Found on the way: in live mode the vocal performance report subtracted UltraStar note
|
|
21
|
+
numbers from MIDI pitch, so every singer got thousands of cents of deviation and 0 % accuracy — it now
|
|
22
|
+
compares pitch within the octave, as the scoring does; `NiceBarFillEditor` put a colour into a
|
|
23
|
+
percentage slider.
|
|
24
|
+
|
|
25
|
+
**Every package declares what its bundle imports.** A new CI gate checks every `import`, `import()`
|
|
26
|
+
and `require()` in the published `dist` against `dependencies` and non-optional `peerDependencies`.
|
|
27
|
+
To reach zero: `@nice2dev/licensing` no longer has `require('webpack')` in its main bundle (the webpack
|
|
28
|
+
plugin uses `compiler.webpack`; webpack 4 gets a warning instead of feature flags) and `react` is a
|
|
29
|
+
required peer; `@nice2dev/erp-adapter` lists `@microsoft/signalr` in `dependencies` (still loaded on
|
|
30
|
+
first use); `@nice2dev/icons-cursor` declares its `react-dom` peer; `@nice2dev/ui-printing` treats
|
|
31
|
+
`@nice2dev/ui` as a required peer.
|
|
32
|
+
|
|
33
|
+
**One copy of each package, one i18n context.** `@nice2dev/ui` carried its own copy of
|
|
34
|
+
`@nice2dev/ui-core` and `@nice2dev/i18n`, and `ui-forms`, `ui-api`, `ui-bi`, `ui-designers`, `ui-math`
|
|
35
|
+
and `ui-video` each carried a copy of all of `@nice2dev/ui` (about 4.4 MB each). Every copy had its own
|
|
36
|
+
React contexts: a `NiceI18nProvider` imported from `@nice2dev/i18n` did not reach the controls of
|
|
37
|
+
`@nice2dev/ui`, which kept their English defaults and `lang` `'en'`, and the dictionaries ended up in
|
|
38
|
+
an app several times. These packages now import `@nice2dev/*` instead (`ui-forms` 4.4 MB → 82 kB).
|
|
39
|
+
Keep every `@nice2dev/*` package on the same version.
|
|
40
|
+
|
|
41
|
+
**Dictionaries per language.** `NiceI18nLazyProvider` takes the same props as `NiceI18nProvider`
|
|
42
|
+
(`t`, `lang`, `overrides`, plus `fallback` and `onError`) but loads only the active language's
|
|
43
|
+
dictionary, with `import()`; until it arrives the controls show their built-in English (or
|
|
44
|
+
`fallback`), and with `t` nothing is loaded at all. Also `loadNiceDictionary(lang)`, to start in a
|
|
45
|
+
language without a flash of English, and `getLoadedNiceDictionary(lang)`. Exported from
|
|
46
|
+
`@nice2dev/i18n`, `@nice2dev/ui-core` and `@nice2dev/ui`; in the `i18n` build every language is its own
|
|
47
|
+
file. `NiceI18nProvider` and `NICE_I18N_DICTIONARIES` are unchanged and still bring all 30 dictionaries.
|
|
48
|
+
`NiceTestWrapper` (ui-core) and `NiceShowcase` (ui) use the lazy provider now, so they no longer pull
|
|
49
|
+
every dictionary into the apps that bundle them.
|
|
50
|
+
|
|
51
|
+
**Data props are optional.** These controls threw a `TypeError` without data and now render empty:
|
|
52
|
+
`NiceTreeView.nodes`, `NiceAccordion.items`, `NiceCascadeSelect.options`, `NiceAutocomplete.options`,
|
|
53
|
+
`NiceAuditLog.entries`, `NiceDocumentVersionList.versions`, `NicePermissionMatrix.roles` / `actions`,
|
|
54
|
+
`WizardStep.content`, `NiceDiagramViewer.document`, `NiceOrgChartVisualizer.data`,
|
|
55
|
+
`NiceSpatialViewer.document`, and in `@nice2dev/events` the lists of `NiceGiftRegistry`,
|
|
56
|
+
`NiceParticipantList`, `NiceExpenseSplit`, `NiceSeatingChart`, `NiceMediaCollage` and `NiceEventMedia`.
|
|
57
|
+
`NiceMap` without `center` centres on its markers (the whole world without markers), `NiceCountdown`
|
|
58
|
+
without `targetDate` shows zero and never calls `onComplete`, `NiceChat` without `onSend` is read-only
|
|
59
|
+
(no input), and `NiceInvitationDesigner` gains `defaultTemplate`. A CI ratchet counts the required
|
|
60
|
+
array props that remain.
|
|
61
|
+
|
|
62
|
+
**Smaller fixes.** `NicePieChart` draws a 100 % slice as a full circle instead of nothing. In
|
|
63
|
+
development `NiceThemeProvider` warns when `--nice-primary` / `--nice-color-primary` (or another linked
|
|
64
|
+
pair) resolves to nothing on `:root` — usually an alias cycle in the app's CSS; the theming guides say
|
|
65
|
+
which side to set. `@nice2dev/game-engine` exports `createAnimationClip`, `AnimatorController` and
|
|
66
|
+
`createAnimatorController` (two modules exported each name, so `export *` dropped all three); the other
|
|
67
|
+
implementations are `StateMachineAnimatorController`, `createStateMachineAnimatorController`,
|
|
68
|
+
`createTimelineAnimationClip` and `createRetargetingAnimationClip`.
|
|
69
|
+
|
|
70
|
+
Nothing was renamed or removed.
|
|
71
|
+
|
|
3
72
|
## 1.1.9
|
|
4
73
|
|
|
5
74
|
### Patch Changes
|
|
@@ -509,6 +509,55 @@ class StateMachine {
|
|
|
509
509
|
return new StateMachine(JSON.parse(JSON.stringify(this.definition)));
|
|
510
510
|
}
|
|
511
511
|
}
|
|
512
|
+
// ============================================================
|
|
513
|
+
// Animation State Machine
|
|
514
|
+
// ============================================================
|
|
515
|
+
/** Extended state machine for animation control */
|
|
516
|
+
class AnimatorController extends StateMachine {
|
|
517
|
+
constructor(definition) {
|
|
518
|
+
super(definition);
|
|
519
|
+
this.motionValues = new Map();
|
|
520
|
+
this.blendTrees = new Map();
|
|
521
|
+
}
|
|
522
|
+
/** Get blended motion value for animation sampling */
|
|
523
|
+
getMotionValue(layerId) {
|
|
524
|
+
return this.motionValues.get(layerId) || 0;
|
|
525
|
+
}
|
|
526
|
+
/** Get current motion/clip name */
|
|
527
|
+
getMotionClip(layerId) {
|
|
528
|
+
const state = this.getCurrentState(layerId);
|
|
529
|
+
return state?.motion || null;
|
|
530
|
+
}
|
|
531
|
+
/** Register a blend tree for a state */
|
|
532
|
+
registerBlendTree(stateId, blendTree) {
|
|
533
|
+
this.blendTrees.set(stateId, blendTree);
|
|
534
|
+
}
|
|
535
|
+
/** Sample blend tree for current parameters */
|
|
536
|
+
sampleBlendTree(stateId) {
|
|
537
|
+
const blendTree = this.blendTrees.get(stateId);
|
|
538
|
+
if (!blendTree) {
|
|
539
|
+
return null;
|
|
540
|
+
}
|
|
541
|
+
const params = {};
|
|
542
|
+
for (const [name, value] of this.getParameterMap()) {
|
|
543
|
+
if (typeof value === 'number') {
|
|
544
|
+
params[name] = value;
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
return blendTree.sample(params);
|
|
548
|
+
}
|
|
549
|
+
getParameterMap() {
|
|
550
|
+
const map = new Map();
|
|
551
|
+
const definition = this.getDefinition();
|
|
552
|
+
for (const param of definition.parameters) {
|
|
553
|
+
const value = this.getParameter(param.name);
|
|
554
|
+
if (value !== undefined) {
|
|
555
|
+
map.set(param.name, value);
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
return map;
|
|
559
|
+
}
|
|
560
|
+
}
|
|
512
561
|
class BlendTree {
|
|
513
562
|
constructor(type, parameterX, parameterY) {
|
|
514
563
|
this.motions = [];
|
|
@@ -642,6 +691,9 @@ class BlendTree {
|
|
|
642
691
|
function createStateMachine(definition) {
|
|
643
692
|
return new StateMachine(definition);
|
|
644
693
|
}
|
|
694
|
+
function createAnimatorController(definition) {
|
|
695
|
+
return new AnimatorController(definition);
|
|
696
|
+
}
|
|
645
697
|
function createBlendTree1D(parameter) {
|
|
646
698
|
return new BlendTree('1d', parameter);
|
|
647
699
|
}
|
|
@@ -731,8 +783,10 @@ function createSMContext(params) {
|
|
|
731
783
|
};
|
|
732
784
|
}
|
|
733
785
|
|
|
786
|
+
exports.AnimatorController = AnimatorController;
|
|
734
787
|
exports.BlendTree = BlendTree;
|
|
735
788
|
exports.StateMachine = StateMachine;
|
|
789
|
+
exports.createAnimatorController = createAnimatorController;
|
|
736
790
|
exports.createBlendTree1D = createBlendTree1D;
|
|
737
791
|
exports.createBlendTree2D = createBlendTree2D;
|
|
738
792
|
exports.createSMCondition = createSMCondition;
|
|
@@ -735,7 +735,20 @@ function createBone(name, parentId = null, transform) {
|
|
|
735
735
|
children: [],
|
|
736
736
|
};
|
|
737
737
|
}
|
|
738
|
+
function createAnimationClip(name, sourceSkeletonId, duration = 1, frameRate = 30) {
|
|
739
|
+
return {
|
|
740
|
+
id: `clip_${Date.now()}`,
|
|
741
|
+
name,
|
|
742
|
+
duration,
|
|
743
|
+
frameRate,
|
|
744
|
+
tracks: [],
|
|
745
|
+
hasRootMotion: false,
|
|
746
|
+
isLooping: false,
|
|
747
|
+
sourceSkeletonId,
|
|
748
|
+
};
|
|
749
|
+
}
|
|
738
750
|
|
|
739
751
|
exports.AnimationRetargeting = AnimationRetargeting;
|
|
752
|
+
exports.createAnimationClip = createAnimationClip;
|
|
740
753
|
exports.createAnimationRetargeting = createAnimationRetargeting;
|
|
741
754
|
exports.createBone = createBone;
|
|
@@ -715,6 +715,17 @@ function createTrack(name, type) {
|
|
|
715
715
|
return baseTrack;
|
|
716
716
|
}
|
|
717
717
|
}
|
|
718
|
+
function createAnimationClip(trackId, startTime, duration) {
|
|
719
|
+
return {
|
|
720
|
+
id: `clip_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
|
|
721
|
+
name: 'Animation Clip',
|
|
722
|
+
type: 'animation',
|
|
723
|
+
trackId,
|
|
724
|
+
startTime,
|
|
725
|
+
duration,
|
|
726
|
+
curves: [],
|
|
727
|
+
};
|
|
728
|
+
}
|
|
718
729
|
function createAudioClip(trackId, startTime, duration, audioSource) {
|
|
719
730
|
return {
|
|
720
731
|
id: `clip_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
|
|
@@ -808,6 +819,7 @@ function createSignalMarker(name, time, signalName, payload) {
|
|
|
808
819
|
exports.TimelinePlayer = TimelinePlayer;
|
|
809
820
|
exports.TimelineRecorder = TimelineRecorder;
|
|
810
821
|
exports.applyEasing = applyEasing;
|
|
822
|
+
exports.createAnimationClip = createAnimationClip;
|
|
811
823
|
exports.createAnimationCurve = createAnimationCurve;
|
|
812
824
|
exports.createAudioClip = createAudioClip;
|
|
813
825
|
exports.createCameraClip = createCameraClip;
|
package/dist/cjs/index.js
CHANGED
|
@@ -152,6 +152,7 @@ var SceneGraph = require('./native-engine/SceneGraph.js');
|
|
|
152
152
|
var AssetPipeline = require('./native-engine/AssetPipeline.js');
|
|
153
153
|
var PhysicsEngine = require('./native-engine/PhysicsEngine.js');
|
|
154
154
|
var AudioEngine = require('./native-engine/AudioEngine.js');
|
|
155
|
+
var AnimationSystem = require('./native-engine/AnimationSystem.js');
|
|
155
156
|
var InputSystem = require('./native-engine/InputSystem.js');
|
|
156
157
|
var NetworkingSystem = require('./native-engine/NetworkingSystem.js');
|
|
157
158
|
var AsepriteImporter = require('./import/AsepriteImporter.js');
|
|
@@ -862,6 +863,7 @@ exports.createKeyframe = TimelineEditor.createKeyframe;
|
|
|
862
863
|
exports.createMarker = TimelineEditor.createMarker;
|
|
863
864
|
exports.createPropertyClip = TimelineEditor.createPropertyClip;
|
|
864
865
|
exports.createSignalMarker = TimelineEditor.createSignalMarker;
|
|
866
|
+
exports.createTimelineAnimationClip = TimelineEditor.createAnimationClip;
|
|
865
867
|
exports.createTimelineDefinition = TimelineEditor.createTimelineDefinition;
|
|
866
868
|
exports.createTimelinePlayer = TimelineEditor.createTimelinePlayer;
|
|
867
869
|
exports.createTimelineRecorder = TimelineEditor.createTimelineRecorder;
|
|
@@ -907,6 +909,7 @@ exports.createUndoRedoManager = UndoRedoPro.createUndoRedoManager;
|
|
|
907
909
|
exports.AnimationRetargeting = AnimationRetargeting.AnimationRetargeting;
|
|
908
910
|
exports.createAnimationRetargeting = AnimationRetargeting.createAnimationRetargeting;
|
|
909
911
|
exports.createBone = AnimationRetargeting.createBone;
|
|
912
|
+
exports.createRetargetingAnimationClip = AnimationRetargeting.createAnimationClip;
|
|
910
913
|
exports.DialogueManager = DialogueSystem$1.DialogueManager;
|
|
911
914
|
exports.createCondition = DialogueSystem$1.createCondition;
|
|
912
915
|
exports.createConditionGroup = DialogueSystem$1.createConditionGroup;
|
|
@@ -1140,6 +1143,7 @@ exports.createBlackboard = BehaviorTree.createBlackboard;
|
|
|
1140
1143
|
exports.createNodeRegistry = BehaviorTree.createNodeRegistry;
|
|
1141
1144
|
exports.BlendTree = StateMachine.BlendTree;
|
|
1142
1145
|
exports.StateMachine = StateMachine.StateMachine;
|
|
1146
|
+
exports.StateMachineAnimatorController = StateMachine.AnimatorController;
|
|
1143
1147
|
exports.createBlendTree1D = StateMachine.createBlendTree1D;
|
|
1144
1148
|
exports.createBlendTree2D = StateMachine.createBlendTree2D;
|
|
1145
1149
|
exports.createSMCondition = StateMachine.createSMCondition;
|
|
@@ -1151,6 +1155,7 @@ exports.createSMParameter = StateMachine.createSMParameter;
|
|
|
1151
1155
|
exports.createSMState = StateMachine.createSMState;
|
|
1152
1156
|
exports.createSMTransition = StateMachine.createSMTransition;
|
|
1153
1157
|
exports.createStateMachine = StateMachine.createStateMachine;
|
|
1158
|
+
exports.createStateMachineAnimatorController = StateMachine.createAnimatorController;
|
|
1154
1159
|
exports.VSDebugger = VisualScripting2.VSDebugger;
|
|
1155
1160
|
exports.VSGraphExecutor = VisualScripting2.VSGraphExecutor;
|
|
1156
1161
|
exports.VS_TYPE_COLORS = VisualScripting2.VS_TYPE_COLORS;
|
|
@@ -1244,6 +1249,9 @@ exports.PhysicsWorld = PhysicsEngine.PhysicsWorld;
|
|
|
1244
1249
|
exports.createPhysicsWorld = PhysicsEngine.createPhysicsWorld;
|
|
1245
1250
|
exports.AudioEngine = AudioEngine.AudioEngine;
|
|
1246
1251
|
exports.createAudioEngine = AudioEngine.createAudioEngine;
|
|
1252
|
+
exports.AnimatorController = AnimationSystem.AnimatorController;
|
|
1253
|
+
exports.createAnimationClip = AnimationSystem.createAnimationClip;
|
|
1254
|
+
exports.createAnimatorController = AnimationSystem.createAnimatorController;
|
|
1247
1255
|
exports.InputSystem = InputSystem.InputSystem;
|
|
1248
1256
|
exports.UISystem = InputSystem.UISystem;
|
|
1249
1257
|
exports.createInputSystem = InputSystem.createInputSystem;
|