Skip to content

Import a 3D Model and automatically assign and export animations

TypeScript

Resolved merge conflicts and removed rogue skeleton offset lines.

DarthMarino181f75f80cda
diff --git a/src/lib/processes/load-skeleton/PreviewSkeletonManager.ts b/src/lib/processes/load-skeleton/PreviewSkeletonManager.ts
index 28abaca..27098c2 100644
--- a/src/lib/processes/load-skeleton/PreviewSkeletonManager.ts
+++ b/src/lib/processes/load-skeleton/PreviewSkeletonManager.ts
@@ -14,10 +14,7 @@ export async function add_preview_skeleton (
root: Scene,
skeleton_type: SkeletonType,
hand_skeleton_type: HandSkeletonType,
- skeleton_scale: number = 1.0,
- skeleton_offset_x: number = 0.0,
- skeleton_offset_y: number = 0.0,
- skeleton_offset_z: number = 0.0
+ skeleton_scale: number = 1.0
): Promise<Object3D<Object3DEventMap>> {
let preview_skeleton_group = root.getObjectByName(skeleton_group_name) as Group | undefined
@@ -27,9 +24,8 @@ export async function add_preview_skeleton (
const previous_file_path = preview_skeleton_group.userData.skeleton_type
const previous_hand_type = preview_skeleton_group.userData.hand_skeleton_type
if (previous_file_path === skeleton_type && previous_hand_type === hand_skeleton_type) {
- // Only update scale and offset
+ // Only update scale
preview_skeleton_group.scale.set(skeleton_scale, skeleton_scale, skeleton_scale)
- preview_skeleton_group.position.set(skeleton_offset_x, skeleton_offset_y, skeleton_offset_z)
// Return the first child (should be loaded_scene)
return preview_skeleton_group.children[0]
} else {
@@ -62,7 +58,6 @@ export async function add_preview_skeleton (
skeleton_helper.name = 'preview_skeleton'
preview_skeleton_group.add(skeleton_helper)
preview_skeleton_group.scale.set(skeleton_scale, skeleton_scale, skeleton_scale)
- preview_skeleton_group.position.set(skeleton_offset_x, skeleton_offset_y, skeleton_offset_z)
root.add(preview_skeleton_group)
return loaded_scene
}
diff --git a/src/lib/processes/load-skeleton/StepLoadSkeleton.ts b/src/lib/processes/load-skeleton/StepLoadSkeleton.ts
index 22ad445..64ff763 100644
--- a/src/lib/processes/load-skeleton/StepLoadSkeleton.ts
+++ b/src/lib/processes/load-skeleton/StepLoadSkeleton.ts
@@ -21,9 +21,6 @@ export class StepLoadSkeleton extends EventTarget {
// this is useful since position keyframes will need to be scaled
// to prevent large offsets
private skeleton_scale_percentage: number = 1.0
- public skeleton_offset_x: number = 0.0
- public skeleton_offset_y: number = 0.0
- public skeleton_offset_z: number = 0.0
// this was invented since this value is stored on a DOM element
// this helps the marketing page set the type and doesn't rely on a DOM value
@@ -76,8 +73,7 @@ export class StepLoadSkeleton extends EventTarget {
// so just use that and load the preview right when we enter this step
if (!this.has_select_skeleton_ui_option()) {
add_preview_skeleton(this._main_scene, this.skeleton_file_path(),
- this.hand_skeleton_type(), this.skeleton_scale_percentage,
- this.skeleton_offset_x, this.skeleton_offset_y, this.skeleton_offset_z).catch((err) => {
+ this.hand_skeleton_type(), this.skeleton_scale_percentage).catch((err) => {
console.error('error loading preview skeleton: ', err)
})
@@ -155,7 +151,7 @@ export class StepLoadSkeleton extends EventTarget {
// load the preview skeleton
// need to get the file name for the correct skeleton
// we pass the skeleton scale in the case where we set a skeleton, change scale, then change the skeleton
- add_preview_skeleton(this._main_scene, this.skeleton_file_path(), this.hand_skeleton_type(), this.skeleton_scale(), this.skeleton_offset_x, this.skeleton_offset_y, this.skeleton_offset_z).then(() => {
+ add_preview_skeleton(this._main_scene, this.skeleton_file_path(), this.hand_skeleton_type(), this.skeleton_scale()).then(() => {
// enable the ability to progress to next step
this.allow_proceeding_to_next_step(true)
}).catch((err) => {
@@ -183,7 +179,7 @@ export class StepLoadSkeleton extends EventTarget {
this.ui.dom_hand_skeleton_selection?.addEventListener('change', () => {
// rebuild the preview skeleton with the new hand skeleton type
// make sure we keep existing scale if we made a change to that
- add_preview_skeleton(this._main_scene, this.skeleton_file_path(), this.hand_skeleton_type(), this.skeleton_scale(), this.skeleton_offset_x, this.skeleton_offset_y, this.skeleton_offset_z).catch((err) => {
+ add_preview_skeleton(this._main_scene, this.skeleton_file_path(), this.hand_skeleton_type(), this.skeleton_scale()).catch((err) => {
console.error('error loading preview skeleton: ', err)
})
})
@@ -209,7 +205,7 @@ export class StepLoadSkeleton extends EventTarget {
if (this.ui.dom_scale_skeleton_percentage_display !== null) {
this.ui.dom_scale_skeleton_percentage_display.textContent = display_value
}
- add_preview_skeleton(this._main_scene, this.skeleton_file_path(), this.hand_skeleton_type(), this.skeleton_scale_percentage, this.skeleton_offset_x, this.skeleton_offset_y, this.skeleton_offset_z)
+ add_preview_skeleton(this._main_scene, this.skeleton_file_path(), this.hand_skeleton_type(), this.skeleton_scale_percentage)
.catch((err) => {
console.error('error loading preview skeleton: ', err)
})
@@ -247,8 +243,7 @@ export class StepLoadSkeleton extends EventTarget {
helper.modify_hand_skeleton(this.loaded_armature, this.hand_skeleton_type())
}
- // reset the armature position and apply offset from the skeleton gizmo
- this.loaded_armature.position.set(this.skeleton_offset_x, this.skeleton_offset_y, this.skeleton_offset_z)
+ this.loaded_armature.position.set(0, 0, 0)
this.loaded_armature.updateWorldMatrix(true, true)
// scale the armature to what we picked using the scale slider/preview