- 3D rotation unit now interpolate in the current unit.

This commit is contained in:
Tanasart 2024-05-11 19:56:19 +07:00
parent d3c024abb2
commit 14fbe0e229
2 changed files with 8 additions and 23 deletions

View file

@ -205,7 +205,7 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
return _f.lerpTo(_t, _lrp); return _f.lerpTo(_t, _lrp);
} }
if(prop.display_type == VALUE_DISPLAY.d3quarternion) if(prop.display_type == VALUE_DISPLAY.d3quarternion && prop.display_data.angle_display == QUARTERNION_DISPLAY.quarterion)
return quarternionArraySlerp(_f, _t, _lrp); return quarternionArraySlerp(_f, _t, _lrp);
if(prop.type == VALUE_TYPE.color) { if(prop.type == VALUE_TYPE.color) {

View file

@ -1492,6 +1492,9 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
static valueProcess = function(value, nodeFrom, applyUnit = true, arrIndex = 0) { #region static valueProcess = function(value, nodeFrom, applyUnit = true, arrIndex = 0) { #region
var typeFrom = nodeFrom.type; var typeFrom = nodeFrom.type;
if(applyUnit && display_type == VALUE_DISPLAY.d3quarternion && display_data.angle_display == QUARTERNION_DISPLAY.euler)
return quarternionFromEuler(value[0], value[1], value[2]);
#region color compatibility [ color, palette, gradient ] #region color compatibility [ color, palette, gradient ]
if(type == VALUE_TYPE.gradient && typeFrom == VALUE_TYPE.color) { if(type == VALUE_TYPE.gradient && typeFrom == VALUE_TYPE.color) {
if(is_instanceof(value, gradientObject)) if(is_instanceof(value, gradientObject))
@ -1716,9 +1719,6 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
val = arrayBalance(val); val = arrayBalance(val);
if(value_from != noone && display_type == VALUE_DISPLAY.d3quarternion && display_data.angle_display == QUARTERNION_DISPLAY.euler)
val = quarternionFromEuler(val[0], val[1], val[2]);
if(isArray(val) && array_length(val) < 1024) { #region Process data if(isArray(val) && array_length(val) < 1024) { #region Process data
var _val = array_create(array_length(val)); var _val = array_create(array_length(val));
for( var i = 0, n = array_length(val); i < n; i++ ) for( var i = 0, n = array_length(val); i < n; i++ )
@ -1902,13 +1902,6 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
} else } else
val = ds_list_empty(animator.values)? 0 : animator.processType(animator.values[| 0].value); val = ds_list_empty(animator.values)? 0 : animator.processType(animator.values[| 0].value);
if(display_type == VALUE_DISPLAY.d3quarternion) {
switch(display_data.angle_display) {
case QUARTERNION_DISPLAY.quarterion : return val;
case QUARTERNION_DISPLAY.euler : return quarternionToEuler(val[0], val[1], val[2], val[3]);
}
}
return val; return val;
} #endregion } #endregion
@ -1974,7 +1967,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
return array_length(ar); return array_length(ar);
} #endregion } #endregion
static setValue = function(val = 0, record = true, time = CURRENT_FRAME, _update = true) { #region static setValue = function(val = 0, record = true, time = CURRENT_FRAME, _update = true) { #region //Set value
val = unit.invApply(val); val = unit.invApply(val);
return setValueDirect(val, noone, record, time, _update); return setValueDirect(val, noone, record, time, _update);
} #endregion } #endregion
@ -2002,24 +1995,16 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
var _node = PANEL_INSPECTOR.inspectings[i]; var _node = PANEL_INSPECTOR.inspectings[i];
if(ind >= ds_list_size(_node.inputs)) continue; if(ind >= ds_list_size(_node.inputs)) continue;
var r = _node.inputs[| ind].setValueInspectorDirect(val, index); var r = _node.inputs[| ind].setValueDirect(val, index);
if(_node == node) res = r; if(_node == node) res = r;
} }
} else { } else {
res = setValueInspectorDirect(val, index); res = setValueDirect(val, index);
} }
return res; return res;
} #endregion } #endregion
static setValueInspectorDirect = function(val = 0, index = noone) {
if(display_type == VALUE_DISPLAY.d3quarternion && display_data.angle_display == QUARTERNION_DISPLAY.euler) {
var _qval = quarternionFromEuler(-val[0], -val[1], -val[2]);
return setValueDirect(_qval);
}
return setValueDirect(val, index);
}
static setValueDirect = function(val = 0, index = noone, record = true, time = CURRENT_FRAME, _update = true) { #region static setValueDirect = function(val = 0, index = noone, record = true, time = CURRENT_FRAME, _update = true) { #region
is_modified = true; is_modified = true;
var updated = false; var updated = false;