@hivey/cli 0.9.60 → 0.9.62
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/native/darwin-arm64/hivey +0 -0
- package/package.json +1 -1
- package/repo/skills/hivey/scripts/new_wiki.py +12 -0
- package/repo/skills/hivey-agent-map/SKILL.md +36 -3
- package/repo/skills/hivey-agent-map/scripts/agent_map.py +16 -6
- package/repo/skills/hivey-agent-map/scripts/office/OutlineEffect.js +539 -0
- package/repo/skills/hivey-agent-map/scripts/office/RoomEnvironment.js +148 -0
- package/repo/skills/hivey-agent-map/scripts/office/loaders/GLTFLoader.js +4663 -0
- package/repo/skills/hivey-agent-map/scripts/office/models/LICENSE-kenney-space-kit.txt +23 -0
- package/repo/skills/hivey-agent-map/scripts/office/models/LICENSE-kenney-space-station-kit.txt +28 -0
- package/repo/skills/hivey-agent-map/scripts/office/models/LICENSE-robot.txt +2 -0
- package/repo/skills/hivey-agent-map/scripts/office/models/astronautA.glb.b64 +1 -0
- package/repo/skills/hivey-agent-map/scripts/office/models/astronautB.glb.b64 +1 -0
- package/repo/skills/hivey-agent-map/scripts/office/models/barrels.glb.b64 +1 -0
- package/repo/skills/hivey-agent-map/scripts/office/models/barrels_rail.glb.b64 +1 -0
- package/repo/skills/hivey-agent-map/scripts/office/models/craft_cargoA.glb.b64 +1 -0
- package/repo/skills/hivey-agent-map/scripts/office/models/craft_racer.glb.b64 +1 -0
- package/repo/skills/hivey-agent-map/scripts/office/models/craft_speederA.glb.b64 +1 -0
- package/repo/skills/hivey-agent-map/scripts/office/models/desk_chairArms.glb.b64 +1 -0
- package/repo/skills/hivey-agent-map/scripts/office/models/desk_computer.glb.b64 +1 -0
- package/repo/skills/hivey-agent-map/scripts/office/models/machine_generator.glb.b64 +1 -0
- package/repo/skills/hivey-agent-map/scripts/office/models/machine_generatorLarge.glb.b64 +1 -0
- package/repo/skills/hivey-agent-map/scripts/office/models/machine_wireless.glb.b64 +1 -0
- package/repo/skills/hivey-agent-map/scripts/office/models/robot.glb.b64 +1 -0
- package/repo/skills/hivey-agent-map/scripts/office/models/satelliteDish_detailed.glb.b64 +1 -0
- package/repo/skills/hivey-agent-map/scripts/office/models/satelliteDish_large.glb.b64 +1 -0
- package/repo/skills/hivey-agent-map/scripts/office/models/station/Textures/colormap.png.b64 +1 -0
- package/repo/skills/hivey-agent-map/scripts/office/models/station/chair-cushion-headrest.glb.b64 +1 -0
- package/repo/skills/hivey-agent-map/scripts/office/models/station/computer-system.glb.b64 +1 -0
- package/repo/skills/hivey-agent-map/scripts/office/models/station/computer-wide.glb.b64 +1 -0
- package/repo/skills/hivey-agent-map/scripts/office/models/station/container-flat.glb.b64 +1 -0
- package/repo/skills/hivey-agent-map/scripts/office/models/station/container-tall.glb.b64 +1 -0
- package/repo/skills/hivey-agent-map/scripts/office/models/station/container-wide.glb.b64 +1 -0
- package/repo/skills/hivey-agent-map/scripts/office/models/station/display-wall-wide.glb.b64 +1 -0
- package/repo/skills/hivey-agent-map/scripts/office/models/station/pipe-ring-colored.glb.b64 +1 -0
- package/repo/skills/hivey-agent-map/scripts/office/music/README.txt +2 -0
- package/repo/skills/hivey-agent-map/scripts/office/music/space.mp3.b64 +1 -0
- package/repo/skills/hivey-agent-map/scripts/office/office.html +179 -0
- package/repo/skills/hivey-agent-map/scripts/office/office.js +754 -0
- package/repo/skills/hivey-agent-map/scripts/office/postprocessing/EffectComposer.js +231 -0
- package/repo/skills/hivey-agent-map/scripts/office/postprocessing/MaskPass.js +104 -0
- package/repo/skills/hivey-agent-map/scripts/office/postprocessing/OutputPass.js +95 -0
- package/repo/skills/hivey-agent-map/scripts/office/postprocessing/Pass.js +95 -0
- package/repo/skills/hivey-agent-map/scripts/office/postprocessing/RenderPass.js +99 -0
- package/repo/skills/hivey-agent-map/scripts/office/postprocessing/ShaderPass.js +77 -0
- package/repo/skills/hivey-agent-map/scripts/office/postprocessing/UnrealBloomPass.js +415 -0
- package/repo/skills/hivey-agent-map/scripts/office/shaders/CopyShader.js +45 -0
- package/repo/skills/hivey-agent-map/scripts/office/shaders/LuminosityHighPassShader.js +66 -0
- package/repo/skills/hivey-agent-map/scripts/office/shaders/OutputShader.js +81 -0
- package/repo/skills/hivey-agent-map/scripts/office/ship.js +578 -0
- package/repo/skills/hivey-agent-map/scripts/office/three.module.min.js +6 -0
- package/repo/skills/hivey-agent-map/scripts/office/utils/BufferGeometryUtils.js +1375 -0
- package/repo/skills/hivey-agent-map/scripts/office/utils/SkeletonUtils.js +413 -0
- package/repo/skills/hivey-agent-map/scripts/office.py +522 -0
- package/repo/skills/hivey-agent-map/scripts/report.py +105 -2
- package/repo/skills/hivey-agent-map/scripts/serve.py +190 -9
- package/repo/skills/hivey-create-wiki/SKILL.md +27 -2
- package/repo/skills/hivey-swarm-creator/SKILL.md +4 -0
- package/repo/skills/hivey-swarm-creator/references/wiki-memory.md +3 -0
- package/repo/skills/hivey-wiki-lint/SKILL.md +7 -2
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AnimationClip,
|
|
3
|
+
AnimationMixer,
|
|
4
|
+
Matrix4,
|
|
5
|
+
Quaternion,
|
|
6
|
+
QuaternionKeyframeTrack,
|
|
7
|
+
SkeletonHelper,
|
|
8
|
+
Vector3,
|
|
9
|
+
VectorKeyframeTrack
|
|
10
|
+
} from '../three.module.min.js';
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
function retarget( target, source, options = {} ) {
|
|
14
|
+
|
|
15
|
+
const pos = new Vector3(),
|
|
16
|
+
quat = new Quaternion(),
|
|
17
|
+
scale = new Vector3(),
|
|
18
|
+
bindBoneMatrix = new Matrix4(),
|
|
19
|
+
relativeMatrix = new Matrix4(),
|
|
20
|
+
globalMatrix = new Matrix4();
|
|
21
|
+
|
|
22
|
+
options.preserveMatrix = options.preserveMatrix !== undefined ? options.preserveMatrix : true;
|
|
23
|
+
options.preservePosition = options.preservePosition !== undefined ? options.preservePosition : true;
|
|
24
|
+
options.preserveHipPosition = options.preserveHipPosition !== undefined ? options.preserveHipPosition : false;
|
|
25
|
+
options.useTargetMatrix = options.useTargetMatrix !== undefined ? options.useTargetMatrix : false;
|
|
26
|
+
options.hip = options.hip !== undefined ? options.hip : 'hip';
|
|
27
|
+
options.names = options.names || {};
|
|
28
|
+
|
|
29
|
+
const sourceBones = source.isObject3D ? source.skeleton.bones : getBones( source ),
|
|
30
|
+
bones = target.isObject3D ? target.skeleton.bones : getBones( target );
|
|
31
|
+
|
|
32
|
+
let bindBones,
|
|
33
|
+
bone, name, boneTo,
|
|
34
|
+
bonesPosition;
|
|
35
|
+
|
|
36
|
+
// reset bones
|
|
37
|
+
|
|
38
|
+
if ( target.isObject3D ) {
|
|
39
|
+
|
|
40
|
+
target.skeleton.pose();
|
|
41
|
+
|
|
42
|
+
} else {
|
|
43
|
+
|
|
44
|
+
options.useTargetMatrix = true;
|
|
45
|
+
options.preserveMatrix = false;
|
|
46
|
+
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if ( options.preservePosition ) {
|
|
50
|
+
|
|
51
|
+
bonesPosition = [];
|
|
52
|
+
|
|
53
|
+
for ( let i = 0; i < bones.length; i ++ ) {
|
|
54
|
+
|
|
55
|
+
bonesPosition.push( bones[ i ].position.clone() );
|
|
56
|
+
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if ( options.preserveMatrix ) {
|
|
62
|
+
|
|
63
|
+
// reset matrix
|
|
64
|
+
|
|
65
|
+
target.updateMatrixWorld();
|
|
66
|
+
|
|
67
|
+
target.matrixWorld.identity();
|
|
68
|
+
|
|
69
|
+
// reset children matrix
|
|
70
|
+
|
|
71
|
+
for ( let i = 0; i < target.children.length; ++ i ) {
|
|
72
|
+
|
|
73
|
+
target.children[ i ].updateMatrixWorld( true );
|
|
74
|
+
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if ( options.offsets ) {
|
|
80
|
+
|
|
81
|
+
bindBones = [];
|
|
82
|
+
|
|
83
|
+
for ( let i = 0; i < bones.length; ++ i ) {
|
|
84
|
+
|
|
85
|
+
bone = bones[ i ];
|
|
86
|
+
name = options.names[ bone.name ] || bone.name;
|
|
87
|
+
|
|
88
|
+
if ( options.offsets[ name ] ) {
|
|
89
|
+
|
|
90
|
+
bone.matrix.multiply( options.offsets[ name ] );
|
|
91
|
+
|
|
92
|
+
bone.matrix.decompose( bone.position, bone.quaternion, bone.scale );
|
|
93
|
+
|
|
94
|
+
bone.updateMatrixWorld();
|
|
95
|
+
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
bindBones.push( bone.matrixWorld.clone() );
|
|
99
|
+
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
for ( let i = 0; i < bones.length; ++ i ) {
|
|
105
|
+
|
|
106
|
+
bone = bones[ i ];
|
|
107
|
+
name = options.names[ bone.name ] || bone.name;
|
|
108
|
+
|
|
109
|
+
boneTo = getBoneByName( name, sourceBones );
|
|
110
|
+
|
|
111
|
+
globalMatrix.copy( bone.matrixWorld );
|
|
112
|
+
|
|
113
|
+
if ( boneTo ) {
|
|
114
|
+
|
|
115
|
+
boneTo.updateMatrixWorld();
|
|
116
|
+
|
|
117
|
+
if ( options.useTargetMatrix ) {
|
|
118
|
+
|
|
119
|
+
relativeMatrix.copy( boneTo.matrixWorld );
|
|
120
|
+
|
|
121
|
+
} else {
|
|
122
|
+
|
|
123
|
+
relativeMatrix.copy( target.matrixWorld ).invert();
|
|
124
|
+
relativeMatrix.multiply( boneTo.matrixWorld );
|
|
125
|
+
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// ignore scale to extract rotation
|
|
129
|
+
|
|
130
|
+
scale.setFromMatrixScale( relativeMatrix );
|
|
131
|
+
relativeMatrix.scale( scale.set( 1 / scale.x, 1 / scale.y, 1 / scale.z ) );
|
|
132
|
+
|
|
133
|
+
// apply to global matrix
|
|
134
|
+
|
|
135
|
+
globalMatrix.makeRotationFromQuaternion( quat.setFromRotationMatrix( relativeMatrix ) );
|
|
136
|
+
|
|
137
|
+
if ( target.isObject3D ) {
|
|
138
|
+
|
|
139
|
+
const boneIndex = bones.indexOf( bone ),
|
|
140
|
+
wBindMatrix = bindBones ? bindBones[ boneIndex ] : bindBoneMatrix.copy( target.skeleton.boneInverses[ boneIndex ] ).invert();
|
|
141
|
+
|
|
142
|
+
globalMatrix.multiply( wBindMatrix );
|
|
143
|
+
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
globalMatrix.copyPosition( relativeMatrix );
|
|
147
|
+
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if ( bone.parent && bone.parent.isBone ) {
|
|
151
|
+
|
|
152
|
+
bone.matrix.copy( bone.parent.matrixWorld ).invert();
|
|
153
|
+
bone.matrix.multiply( globalMatrix );
|
|
154
|
+
|
|
155
|
+
} else {
|
|
156
|
+
|
|
157
|
+
bone.matrix.copy( globalMatrix );
|
|
158
|
+
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if ( options.preserveHipPosition && name === options.hip ) {
|
|
162
|
+
|
|
163
|
+
bone.matrix.setPosition( pos.set( 0, bone.position.y, 0 ) );
|
|
164
|
+
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
bone.matrix.decompose( bone.position, bone.quaternion, bone.scale );
|
|
168
|
+
|
|
169
|
+
bone.updateMatrixWorld();
|
|
170
|
+
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if ( options.preservePosition ) {
|
|
174
|
+
|
|
175
|
+
for ( let i = 0; i < bones.length; ++ i ) {
|
|
176
|
+
|
|
177
|
+
bone = bones[ i ];
|
|
178
|
+
name = options.names[ bone.name ] || bone.name;
|
|
179
|
+
|
|
180
|
+
if ( name !== options.hip ) {
|
|
181
|
+
|
|
182
|
+
bone.position.copy( bonesPosition[ i ] );
|
|
183
|
+
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
if ( options.preserveMatrix ) {
|
|
191
|
+
|
|
192
|
+
// restore matrix
|
|
193
|
+
|
|
194
|
+
target.updateMatrixWorld( true );
|
|
195
|
+
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function retargetClip( target, source, clip, options = {} ) {
|
|
201
|
+
|
|
202
|
+
options.useFirstFramePosition = options.useFirstFramePosition !== undefined ? options.useFirstFramePosition : false;
|
|
203
|
+
options.fps = options.fps !== undefined ? options.fps : 30;
|
|
204
|
+
options.names = options.names || [];
|
|
205
|
+
|
|
206
|
+
if ( ! source.isObject3D ) {
|
|
207
|
+
|
|
208
|
+
source = getHelperFromSkeleton( source );
|
|
209
|
+
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
const numFrames = Math.round( clip.duration * ( options.fps / 1000 ) * 1000 ),
|
|
213
|
+
delta = 1 / options.fps,
|
|
214
|
+
convertedTracks = [],
|
|
215
|
+
mixer = new AnimationMixer( source ),
|
|
216
|
+
bones = getBones( target.skeleton ),
|
|
217
|
+
boneDatas = [];
|
|
218
|
+
let positionOffset,
|
|
219
|
+
bone, boneTo, boneData,
|
|
220
|
+
name;
|
|
221
|
+
|
|
222
|
+
mixer.clipAction( clip ).play();
|
|
223
|
+
mixer.update( 0 );
|
|
224
|
+
|
|
225
|
+
source.updateMatrixWorld();
|
|
226
|
+
|
|
227
|
+
for ( let i = 0; i < numFrames; ++ i ) {
|
|
228
|
+
|
|
229
|
+
const time = i * delta;
|
|
230
|
+
|
|
231
|
+
retarget( target, source, options );
|
|
232
|
+
|
|
233
|
+
for ( let j = 0; j < bones.length; ++ j ) {
|
|
234
|
+
|
|
235
|
+
name = options.names[ bones[ j ].name ] || bones[ j ].name;
|
|
236
|
+
|
|
237
|
+
boneTo = getBoneByName( name, source.skeleton );
|
|
238
|
+
|
|
239
|
+
if ( boneTo ) {
|
|
240
|
+
|
|
241
|
+
bone = bones[ j ];
|
|
242
|
+
boneData = boneDatas[ j ] = boneDatas[ j ] || { bone: bone };
|
|
243
|
+
|
|
244
|
+
if ( options.hip === name ) {
|
|
245
|
+
|
|
246
|
+
if ( ! boneData.pos ) {
|
|
247
|
+
|
|
248
|
+
boneData.pos = {
|
|
249
|
+
times: new Float32Array( numFrames ),
|
|
250
|
+
values: new Float32Array( numFrames * 3 )
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
if ( options.useFirstFramePosition ) {
|
|
256
|
+
|
|
257
|
+
if ( i === 0 ) {
|
|
258
|
+
|
|
259
|
+
positionOffset = bone.position.clone();
|
|
260
|
+
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
bone.position.sub( positionOffset );
|
|
264
|
+
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
boneData.pos.times[ i ] = time;
|
|
268
|
+
|
|
269
|
+
bone.position.toArray( boneData.pos.values, i * 3 );
|
|
270
|
+
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
if ( ! boneData.quat ) {
|
|
274
|
+
|
|
275
|
+
boneData.quat = {
|
|
276
|
+
times: new Float32Array( numFrames ),
|
|
277
|
+
values: new Float32Array( numFrames * 4 )
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
boneData.quat.times[ i ] = time;
|
|
283
|
+
|
|
284
|
+
bone.quaternion.toArray( boneData.quat.values, i * 4 );
|
|
285
|
+
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
mixer.update( delta );
|
|
291
|
+
|
|
292
|
+
source.updateMatrixWorld();
|
|
293
|
+
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
for ( let i = 0; i < boneDatas.length; ++ i ) {
|
|
297
|
+
|
|
298
|
+
boneData = boneDatas[ i ];
|
|
299
|
+
|
|
300
|
+
if ( boneData ) {
|
|
301
|
+
|
|
302
|
+
if ( boneData.pos ) {
|
|
303
|
+
|
|
304
|
+
convertedTracks.push( new VectorKeyframeTrack(
|
|
305
|
+
'.bones[' + boneData.bone.name + '].position',
|
|
306
|
+
boneData.pos.times,
|
|
307
|
+
boneData.pos.values
|
|
308
|
+
) );
|
|
309
|
+
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
convertedTracks.push( new QuaternionKeyframeTrack(
|
|
313
|
+
'.bones[' + boneData.bone.name + '].quaternion',
|
|
314
|
+
boneData.quat.times,
|
|
315
|
+
boneData.quat.values
|
|
316
|
+
) );
|
|
317
|
+
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
mixer.uncacheAction( clip );
|
|
323
|
+
|
|
324
|
+
return new AnimationClip( clip.name, - 1, convertedTracks );
|
|
325
|
+
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
function clone( source ) {
|
|
329
|
+
|
|
330
|
+
const sourceLookup = new Map();
|
|
331
|
+
const cloneLookup = new Map();
|
|
332
|
+
|
|
333
|
+
const clone = source.clone();
|
|
334
|
+
|
|
335
|
+
parallelTraverse( source, clone, function ( sourceNode, clonedNode ) {
|
|
336
|
+
|
|
337
|
+
sourceLookup.set( clonedNode, sourceNode );
|
|
338
|
+
cloneLookup.set( sourceNode, clonedNode );
|
|
339
|
+
|
|
340
|
+
} );
|
|
341
|
+
|
|
342
|
+
clone.traverse( function ( node ) {
|
|
343
|
+
|
|
344
|
+
if ( ! node.isSkinnedMesh ) return;
|
|
345
|
+
|
|
346
|
+
const clonedMesh = node;
|
|
347
|
+
const sourceMesh = sourceLookup.get( node );
|
|
348
|
+
const sourceBones = sourceMesh.skeleton.bones;
|
|
349
|
+
|
|
350
|
+
clonedMesh.skeleton = sourceMesh.skeleton.clone();
|
|
351
|
+
clonedMesh.bindMatrix.copy( sourceMesh.bindMatrix );
|
|
352
|
+
|
|
353
|
+
clonedMesh.skeleton.bones = sourceBones.map( function ( bone ) {
|
|
354
|
+
|
|
355
|
+
return cloneLookup.get( bone );
|
|
356
|
+
|
|
357
|
+
} );
|
|
358
|
+
|
|
359
|
+
clonedMesh.bind( clonedMesh.skeleton, clonedMesh.bindMatrix );
|
|
360
|
+
|
|
361
|
+
} );
|
|
362
|
+
|
|
363
|
+
return clone;
|
|
364
|
+
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
// internal helper
|
|
368
|
+
|
|
369
|
+
function getBoneByName( name, skeleton ) {
|
|
370
|
+
|
|
371
|
+
for ( let i = 0, bones = getBones( skeleton ); i < bones.length; i ++ ) {
|
|
372
|
+
|
|
373
|
+
if ( name === bones[ i ].name )
|
|
374
|
+
|
|
375
|
+
return bones[ i ];
|
|
376
|
+
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
function getBones( skeleton ) {
|
|
382
|
+
|
|
383
|
+
return Array.isArray( skeleton ) ? skeleton : skeleton.bones;
|
|
384
|
+
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
|
|
388
|
+
function getHelperFromSkeleton( skeleton ) {
|
|
389
|
+
|
|
390
|
+
const source = new SkeletonHelper( skeleton.bones[ 0 ] );
|
|
391
|
+
source.skeleton = skeleton;
|
|
392
|
+
|
|
393
|
+
return source;
|
|
394
|
+
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
function parallelTraverse( a, b, callback ) {
|
|
398
|
+
|
|
399
|
+
callback( a, b );
|
|
400
|
+
|
|
401
|
+
for ( let i = 0; i < a.children.length; i ++ ) {
|
|
402
|
+
|
|
403
|
+
parallelTraverse( a.children[ i ], b.children[ i ], callback );
|
|
404
|
+
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
export {
|
|
410
|
+
retarget,
|
|
411
|
+
retargetClip,
|
|
412
|
+
clone,
|
|
413
|
+
};
|