Skip to content

Commit

Permalink
Update for v0.23.2
Browse files Browse the repository at this point in the history
  • Loading branch information
ButzYung committed Aug 25, 2024
1 parent b6515ff commit 493c23b
Show file tree
Hide file tree
Showing 8 changed files with 157 additions and 49 deletions.
9 changes: 5 additions & 4 deletions MMD.js/MMD_SA.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// MMD for System Animator
// (2024-05-18)
// (2024-06-02)

var use_full_spectrum = true

Expand Down Expand Up @@ -8942,6 +8942,7 @@ let i = 0;
this.model.springBoneManager.joints.forEach( e => {
// e.settings.dragForce = 1
e.settings.stiffness = settings_default[i].stiffness * ((restrict_physics) ? 10 : 1) * vrm_scale;
e.settings.gravityPower = settings_default[i].gravityPower;
i++;
});

Expand Down Expand Up @@ -12485,7 +12486,7 @@ function MMD_LR(name) {
const nj_list = ["0","1","2","3"];
function MMD_finger(name) {
let j_index;
var f = finger_map[RegExp.$1.toLowerCase()];
var f = finger_map[RegExp.$1.toLowerCase().replace(/middle/, 'mid')];
if (f) {
j_index = parseInt(RegExp.$2);
}
Expand Down Expand Up @@ -12551,7 +12552,7 @@ bone_map.forEach(name=>{
else if (/head/i.test(name)) {
rig('頭', name);
}
else if (/(thumb|index|mid|ring|pinky|little|finger)\D*(\d+)$/i.test(name)) {
else if (/(thumb|index|mid\D*|ring|pinky|little|finger)(\d+)$/i.test(name)) {
const name_MMD = MMD_finger(name);
if (!/twist|share/i.test(name))
rig(name_MMD, name);
Expand Down Expand Up @@ -12752,7 +12753,7 @@ hips_q.conjugate().premultiply(rig_rot);

const hips_q_inv = hips_q.clone().conjugate();

console.log('rig_rot,[hips_q]', rig_rot, [hips_q.clone(), motion_hips.quaternion, motion_hips.parent.getWorldQuaternion(new THREE.Quaternion()), new THREE.Quaternion().copy(hips_q_inv).premultiply(motion_hips.quaternion).multiply(q2.copy(motion_hips.quaternion).conjugate()).multiply(hips_q)])
console.log('rig_rot,[hips_q]', rig_rot, [hips_q.clone()]);//, motion_hips.quaternion, motion_hips.parent.getWorldQuaternion(new THREE.Quaternion()), new THREE.Quaternion().copy(hips_q_inv).premultiply(motion_hips.quaternion).multiply(q2.copy(motion_hips.quaternion).conjugate()).multiply(hips_q)]);
let _rig_rot_perpendicular = Math.abs(rig_rot.w) % 1 < 0.0001;
if (skeletons.length && (bone_clones['hips'].clone.quaternion.w != 1)) {
if (_rig_rot_perpendicular) {
Expand Down
155 changes: 118 additions & 37 deletions images/XR Animator/animate.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// XR Animator
// (2024-05-18)
// (2024-06-02)

var MMD_SA_options = {

Expand Down Expand Up @@ -189,6 +189,7 @@ var MMD_SA_options = {
,{ must_load:true, no_shuffle:true, path:Settings.f_path + '/assets/assets.zip#/motion/sitting_sexy08.vmd' }
,{ must_load:true, no_shuffle:true, path:Settings.f_path + '/assets/assets.zip#/motion/sitting_sexy09.vmd' }
,{ must_load:true, no_shuffle:true, path:Settings.f_path + '/assets/assets.zip#/motion/sitting_sexy10.vmd' }
,{ must_load:true, no_shuffle:true, path:Settings.f_path + '/assets/assets.zip#/motion/sitting_sexy11.vmd' }
,{ must_load:true, no_shuffle:true, path:Settings.f_path + '/assets/assets.zip#/motion/prone_pose01.vmd' }
,{ must_load:true, no_shuffle:true, path:Settings.f_path + '/assets/assets.zip#/motion/model_pose01.vmd' }
,{ must_load:true, no_shuffle:true, path:Settings.f_path + '/assets/assets.zip#/motion/model_pose02.vmd' }
Expand Down Expand Up @@ -1986,28 +1987,6 @@ cam_pos.copy(MMD_SA._trackball_camera.object.position)
}
}

,"kabedon_single_hand_v01": {
// look_at_screen: true,
motion_tracking_enabled: true,
motion_tracking_upper_body_only: true,
motion_tracking: {
// look_at_screen: true,
arm_default_stickiness: {
default_rotation_weight: 0.5,
},
arm_as_leg: {
enabled: true,
linked_side: 'right',
transformation: {
position: {
y: { add:1.5, scale:1.5 },
z: { add:0.4, scale:1.5, max:1 },
},
},
},
}
}

,"sitting_sexy01": {
// look_at_screen: true,

Expand Down Expand Up @@ -3139,6 +3118,72 @@ if (z_para) {
}
}

,"sitting_sexy11": {
look_at_screen_bone_list: [
{ name:"首", weight_screen:0.5, weight_motion:1 },
{ name:"頭", weight_screen:0.5, weight_motion:1 },
],
// "look_at_screen": true,
"motion_tracking_enabled": true,
"motion_tracking_upper_body_only": true,
"look_at_screen": true,
"center_view": [0,-6.5,8],
"motion_tracking": {
"look_at_screen": true,
"hip_adjustment": {
"feet_fixed_weight": 0.75,
"rotation_weight": 0.25,
"displacement_weight": 0.25,
"knee_fixed_weight": 0
},
"arm_default_stickiness": {
"default_position_weight": 0.75,
"default_rotation_weight": 0.75
},
"arm_as_leg": {
"transformation": {
"position": {
"x": {
"unit_length": 1,
"add": {
"left": 4,
"right":-4
},
"min": {
"left": 1,
"right": -10
},
"max": {
"left": 10,
"right": -1
},
"scale": 2
},
"y": {
"unit_length": 1,
"add": 10,
"scale": -2,
"min": 4
},
"z": {
"min": 0,
"max": 0
},
"rotation": {
"x": 90,
"y": 0,
"z": 0
}
},
"rotation": {
"y": {
"foot_ratio": 0.5
}
}
}
}
}
}

}

Expand Down Expand Up @@ -3323,15 +3368,15 @@ video:{
// hidden:true,
// hidden_on_webcam: true,
scale:0.4, top:-0.5,
//left:-0.5,//top:-1,
//left:+0.5,top:-0.25,
//scale:0.4*1,top:0,left:-3,
//scale:0.4*2,top:0,left:-1,
},
wireframe:{
// hidden:true,
// align_with_video:true,
top:0.5,
//left:+(0.4),top:-1,
//left:+(0.5),top:-1,
//left:1,
//top:0.8,left:0.4,
//top:0,left:3,
Expand Down Expand Up @@ -4357,6 +4402,8 @@ _motion_list[0] = [

{name:"model_pose03", info:"Model pose 03 (🙋/🦶)"},

{name:"sitting_sexy11", info:"Sit 16 (🙋/🦶)"},

].filter(m=>m!=null);

motion_list_length_default = _motion_list[0].length;
Expand Down Expand Up @@ -9111,7 +9158,7 @@ MMD_SA_options.Dungeon.para_by_grid_id[2].ground_y = explorer_ground_y;
,[
{
message: {
get content() { return 'XR Animator (v0.23.1)\n' + System._browser.translation.get('XR_Animator.UI.UI_options.about_XR_Animator.message'); }
get content() { return 'XR Animator (v0.23.2-b)\n' + System._browser.translation.get('XR_Animator.UI.UI_options.about_XR_Animator.message'); }
,bubble_index: 3
,branch_list: [
{ key:1, event_id: {
Expand Down Expand Up @@ -9877,7 +9924,6 @@ MMD_SA_options.Dungeon.utils.tooltip(

...(()=>{
let page2_index = 2;
let option_plus_minus = 'arm_horizontal_offset';

const hip_adjustment_index = 3;
const body_collider_index = 4;
Expand All @@ -9889,6 +9935,9 @@ MMD_SA_options.Dungeon.utils.tooltip(
let body_collider_option_active = 'Chest size';
const body_collider_options = ['Head size', 'Chest size', 'Waist size', 'Hip size'];

let option_plus_minus = 'arm_horizontal_offset';
const body_tracking_options = ['arm_horizontal_offset', 'arm_vertical_offset', 'limb_entry_duration', 'limb_return_duration', 'upper_rotation_offset'];

return [
{
message: {
Expand All @@ -9897,17 +9946,18 @@ MMD_SA_options.Dungeon.utils.tooltip(
'1. ' + System._browser.translation.get('XR_Animator.UI.motion_capture.mocap_options.body_tracking_options.AI_model_quality') + ': ' + System._browser.translation.get('Misc.' + (MMD_SA_options.user_camera.ML_models.pose.model_quality || 'Normal')),
'2. ┗ ' + System._browser.translation.get('XR_Animator.UI.motion_capture.mocap_options.body_tracking_options.AI_model_quality.z_depth_scale') + ': ' + ((MMD_SA_options.user_camera.ML_models.pose.model_quality == 'Best') ? System._browser.translation.get('Misc.' + ((MMD_SA_options.user_camera.ML_models.pose.z_depth_scale) ? ((MMD_SA_options.user_camera.ML_models.pose.z_depth_scale<3)?'Max':'Min'):'Medium')) : 'N/A'),
'3. ' + System._browser.translation.get('XR_Animator.UI.motion_capture.mocap_options.body_tracking_options.arm_horizontal_offset') + ': ' + (System._browser.camera.poseNet.arm_horizontal_offset_percent||0) + '%' + ((option_plus_minus == 'arm_horizontal_offset') ? '➕➖' : ''),
'4. ' + System._browser.translation.get('XR_Animator.UI.motion_capture.mocap_options.body_tracking_options.limb_entry_duration') + ': ' + System._browser.camera.poseNet.limb_entry_duration_percent + '%' + ((option_plus_minus == 'limb_entry_duration') ? '➕➖' : ''),
'5. ' + System._browser.translation.get('XR_Animator.UI.motion_capture.mocap_options.body_tracking_options.limb_return_duration') + ': ' + System._browser.camera.poseNet.limb_return_duration_percent + '%' + ((option_plus_minus == 'limb_return_duration') ? '➕➖' : ''),
'6. ' + System._browser.translation.get('XR_Animator.UI.motion_capture.mocap_options.body_tracking_options.upper_rotation_offset') + ': ' + ((MMD_SA.MMD.motionManager.para_SA.motion_tracking?.ML_models?.pose || MMD_SA_options.user_camera.ML_models.pose).upper_rotation_offset||0) + '°' + ((option_plus_minus == 'upper_rotation_offset') ? '➕➖' : ''),
'7. ' + System._browser.translation.get('XR_Animator.UI.motion_capture.mocap_options.body_tracking_options.hip_adjustment') + ' ' + ((page2_index!=hip_adjustment_index) ? '▶️' : '◀️'),
'8. ' + System._browser.translation.get('XR_Animator.UI.motion_capture.mocap_options.body_tracking_options.body_collider') + ' ' + ((page2_index!=body_collider_index) ? '▶️' : '◀️'),
'4. ' + System._browser.translation.get('XR_Animator.UI.motion_capture.mocap_options.body_tracking_options.arm_vertical_offset') + ': ' + (System._browser.camera.poseNet.arm_vertical_offset_percent||0) + '%' + ((option_plus_minus == 'arm_vertical_offset') ? '➕➖' : ''),
'5. ' + System._browser.translation.get('XR_Animator.UI.motion_capture.mocap_options.body_tracking_options.limb_entry_duration') + ': ' + System._browser.camera.poseNet.limb_entry_duration_percent + '%' + ((option_plus_minus == 'limb_entry_duration') ? '➕➖' : ''),
'6. ' + System._browser.translation.get('XR_Animator.UI.motion_capture.mocap_options.body_tracking_options.limb_return_duration') + ': ' + System._browser.camera.poseNet.limb_return_duration_percent + '%' + ((option_plus_minus == 'limb_return_duration') ? '➕➖' : ''),
'7. ' + System._browser.translation.get('XR_Animator.UI.motion_capture.mocap_options.body_tracking_options.upper_rotation_offset') + ': ' + ((MMD_SA.MMD.motionManager.para_SA.motion_tracking?.ML_models?.pose || MMD_SA_options.user_camera.ML_models.pose).upper_rotation_offset||0) + '°' + ((option_plus_minus == 'upper_rotation_offset') ? '➕➖' : ''),
'8. ' + System._browser.translation.get('XR_Animator.UI.motion_capture.mocap_options.body_tracking_options.hip_adjustment') + ' ' + ((page2_index!=hip_adjustment_index) ? '▶️' : '◀️'),
'9. ' + System._browser.translation.get('XR_Animator.UI.motion_capture.mocap_options.body_tracking_options.body_collider') + ' ' + ((page2_index!=body_collider_index) ? '▶️' : '◀️'),

'X. ' + System._browser.translation.get('Misc.done'),
].join('\n');
},
bubble_index: 3,
// para: { row_max:11 },
para: { row_max:11 },
branch_list: [
{ key:'any', func:(e)=>{
let step;
Expand Down Expand Up @@ -10002,13 +10052,29 @@ System._browser.camera.poseNet.hip_adjustment_smoothing_percent = THREE.Math.cla
return false;
}
}
else if (/Arrow(Up|Down)/.test(e.code)) {
step = 1;

let index = body_tracking_options.findIndex(v=>v==option_plus_minus);
index -= (e.code == 'ArrowUp') ? 1 : -1;
if (index < 0) {
index = body_tracking_options.length-1;
}
else if (index > body_tracking_options.length-1) {
index = 0;
}
option_plus_minus = body_tracking_options[index];
}
else if ((e.key == '+') || (e.key == '-')) {
step = 1;

let inc = (e.key == '+') ? 1 : -1;
if (option_plus_minus == 'arm_horizontal_offset') {
System._browser.camera.poseNet.arm_horizontal_offset_percent = THREE.Math.clamp((System._browser.camera.poseNet.arm_horizontal_offset_percent||0) + inc*2, -200,200);
}
else if (option_plus_minus == 'arm_vertical_offset') {
System._browser.camera.poseNet.arm_vertical_offset_percent = THREE.Math.clamp((System._browser.camera.poseNet.arm_vertical_offset_percent||0) + inc*2, -100,100);
}
else if (option_plus_minus == 'limb_entry_duration') {
System._browser.camera.poseNet.limb_entry_duration_percent = THREE.Math.clamp((System._browser.camera.poseNet.limb_entry_duration_percent||0) + inc*5, 25,400);
}
Expand Down Expand Up @@ -10065,6 +10131,19 @@ MMD_SA_options.Dungeon.utils.tooltip(
},
{ key:4, event_id: {
func: function () {
option_plus_minus = 'arm_vertical_offset';
},
goto_event: { branch_index:mocap_options_branch, step:1 },
},
onmouseover: function (e) {
MMD_SA_options.Dungeon.utils.tooltip(
e.clientX, e.clientY,
System._browser.translation.get('XR_Animator.UI.motion_capture.mocap_options.body_tracking_options.arm_vertical_offset') + ((option_plus_minus == 'arm_vertical_offset') ? ' (' + System._browser.translation.get('XR_Animator.UI.motion_capture.mocap_options.body_tracking_options.press_to_change_value') + ')' : '') + ':\n' + System._browser.translation.get('XR_Animator.UI.motion_capture.mocap_options.body_tracking_options.arm_vertical_offset.tooltip')
);
}
},
{ key:5, event_id: {
func: function () {
option_plus_minus = 'limb_entry_duration';
},
goto_event: { branch_index:mocap_options_branch, step:1 },
Expand All @@ -10076,7 +10155,7 @@ MMD_SA_options.Dungeon.utils.tooltip(
);
}
},
{ key:5, event_id: {
{ key:6, event_id: {
func: function () {
option_plus_minus = 'limb_return_duration';
},
Expand All @@ -10089,7 +10168,7 @@ MMD_SA_options.Dungeon.utils.tooltip(
);
}
},
{ key:6, event_id: {
{ key:7, event_id: {
func: function () {
option_plus_minus = 'upper_rotation_offset';
},
Expand All @@ -10102,14 +10181,14 @@ MMD_SA_options.Dungeon.utils.tooltip(
);
}
},
{ key:7, event_id: {
{ key:8, event_id: {
func: function () {
page2_index = (page2_index != hip_adjustment_index) ? hip_adjustment_index : 2;
},
goto_event: { branch_index:mocap_options_branch, step:1 },
}
},
{ key:8, event_id: {
{ key:9, event_id: {
func: function () {
page2_index = (page2_index != body_collider_index) ? body_collider_index : 2;
},
Expand Down Expand Up @@ -11798,6 +11877,7 @@ config.user_camera = {
hip_adjustment_smoothing_percent: System._browser.camera.poseNet.hip_adjustment_smoothing_percent,
upper_rotation_offset: MMD_SA_options.user_camera.ML_models.pose.upper_rotation_offset,
arm_horizontal_offset_percent: System._browser.camera.poseNet.arm_horizontal_offset_percent,
arm_vertical_offset_percent: System._browser.camera.poseNet.arm_vertical_offset_percent,
limb_entry_duration_percent: System._browser.camera.poseNet.limb_entry_duration_percent,
limb_return_duration_percent: System._browser.camera.poseNet.limb_return_duration_percent,

Expand Down Expand Up @@ -11990,6 +12070,7 @@ try {
System._browser.camera.poseNet.body_bend_reduction_power = config[p].ML_models.pose.body_bend_reduction_power;
System._browser.camera.poseNet.hip_camera = config[p].ML_models.pose.hip_camera;
System._browser.camera.poseNet.arm_horizontal_offset_percent = config[p].ML_models.pose.arm_horizontal_offset_percent;
System._browser.camera.poseNet.arm_vertical_offset_percent = config[p].ML_models.pose.arm_vertical_offset_percent;
System._browser.camera.poseNet.limb_entry_duration_percent = config[p].ML_models.pose.limb_entry_duration_percent;
System._browser.camera.poseNet.limb_return_duration_percent = config[p].ML_models.pose.limb_return_duration_percent;
System._browser.camera.poseNet.hip_adjustment_weight_percent = config[p].ML_models.pose.hip_adjustment_weight_percent;
Expand Down
Binary file modified images/XR Animator/assets/assets.zip
Binary file not shown.
16 changes: 15 additions & 1 deletion images/XR Animator/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,20 @@
}
}
},
"arm_vertical_offset": {
"_translation_": {
"_default_": "Arm vertical offset",
"ja": "腕の垂直位置オフセット",
"zh": "手臂垂直位置偏移"
},
"tooltip": {
"_translation_": {
"_default_": "Use this option if your want your avatar's arm position to be higher or lower than the one detected by mocap. Press ➕➖ key to change value. Default is \"0%\".",
"ja": "アバターの腕の位置を、モーションキャプチャによって検出された位置よりも高くまたは低くしたい場合は、このオプションを使用します。 ➕➖キーを押して値を変更します。 デフォルトは「0%」です。",
"zh": "如果您希望人物的手臂位置高於或低於動作捕捉所偵測到的位置,可使用此選項。 按➕➖鍵更改數值。 預設是「0%」。"
}
}
},
"upper_rotation_offset": {
"_translation_": {
"_default_": "Upper rotation offset",
Expand Down Expand Up @@ -2222,7 +2236,7 @@
},
"list": {
"_translation_": {
"_default_": "NewruGuru, Nymph, Shionay, shion, KuraiNoOni, MShade, Dominic Renner, Kai, ambyshard, Prajzis, 星洛薊野Azami,"
"_default_": "NewruGuru, Nymph, Shionay, shion, KuraiNoOni, MShade, Dominic Renner, Kai, ambyshard, Prajzis, Cylan Cade, LouLi Lou,"
}
}
}
Expand Down
11 changes: 10 additions & 1 deletion jThree/MMDplugin/v2.1.2_jThree.MMD.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// (2024-05-08)
// (2024-06-02)

/*!
* jThree.MMD.js JavaScript Library v1.6.1
Expand Down Expand Up @@ -4089,6 +4089,15 @@ rotated = true
}
if (!rotated) { /*DEBUG_show(i,0,1);*/break; }
}
/*
if (/\u8155\uFF29\uFF2B/.test(target.name)) {
const d = target.name.charAt(0);
const rot_lower_arm = mesh.bones_by_name[d+'ひじ+'].quaternion;
rot_lower_arm.fromArray(MMD_SA.THREEX.utils.convert_A_pose_rotation_to_T_pose(d+'ひじ', rot_lower_arm.toArray()));
rot_lower_arm.setFromEuler(MMD_SA.TEMP_v3.setEulerFromQuaternion(rot_lower_arm, 'YZX').setX(0), 'YZX');
rot_lower_arm.fromArray(MMD_SA.THREEX.utils.convert_T_pose_rotation_to_A_pose(d+'ひじ', rot_lower_arm.toArray()));
}
*/

// MMD IK operates on A pose. Convert it back to T pose for T-posed model
const bones_by_name = mesh.bones_by_name;
Expand Down
2 changes: 1 addition & 1 deletion jThree/three.core.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/SA_system_emulation.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit 493c23b

Please sign in to comment.