mirror of
https://github.com/JannisX11/blockbench.git
synced 2025-04-06 17:31:09 +08:00
Fix scale keyframes defaulting to 0
This commit is contained in:
parent
5d11899da4
commit
9ee8deb082
@ -21,9 +21,9 @@ class KeyframeDataPoint {
|
||||
return copy;
|
||||
}
|
||||
}
|
||||
new Property(KeyframeDataPoint, 'molang', 'x', {label: 'X', condition: point => point.keyframe.transform});
|
||||
new Property(KeyframeDataPoint, 'molang', 'y', {label: 'Y', condition: point => point.keyframe.transform});
|
||||
new Property(KeyframeDataPoint, 'molang', 'z', {label: 'Z', condition: point => point.keyframe.transform});
|
||||
new Property(KeyframeDataPoint, 'molang', 'x', { label: 'X', condition: point => point.keyframe.transform, default: point => (point && point.keyframe.channel == 'scale' ? '1' : '0') });
|
||||
new Property(KeyframeDataPoint, 'molang', 'y', { label: 'Y', condition: point => point.keyframe.transform, default: point => (point && point.keyframe.channel == 'scale' ? '1' : '0') });
|
||||
new Property(KeyframeDataPoint, 'molang', 'z', { label: 'Z', condition: point => point.keyframe.transform, default: point => (point && point.keyframe.channel == 'scale' ? '1' : '0') });
|
||||
new Property(KeyframeDataPoint, 'string', 'effect', {label: tl('data.effect'), condition: point => ['particle', 'sound'].includes(point.keyframe.channel)});
|
||||
new Property(KeyframeDataPoint, 'string', 'locator',{label: tl('data.locator'), condition: point => 'particle' == point.keyframe.channel});
|
||||
new Property(KeyframeDataPoint, 'molang', 'script', {label: tl('timeline.pre_effect_script'), condition: point => ['particle', 'timeline'].includes(point.keyframe.channel), default: ''});
|
||||
|
@ -37,7 +37,7 @@ class Property {
|
||||
if (this.isMolang) {
|
||||
Object.defineProperty(target_class.prototype, `${name}_string`, {
|
||||
get() {
|
||||
return typeof this[name] == 'number' ? trimFloatNumber(this[name]) || scope.default : this[name];
|
||||
return typeof this[name] == 'number' ? trimFloatNumber(this[name]) || scope.getDefault(this) : this[name];
|
||||
},
|
||||
set(val) {
|
||||
this[name] = val;
|
||||
@ -53,6 +53,13 @@ class Property {
|
||||
if (options.label) this.label = options.label;
|
||||
if (options.options) this.options = options.options;
|
||||
}
|
||||
getDefault(instance) {
|
||||
if (typeof this.default == 'function') {
|
||||
return this.default(instance);
|
||||
} else {
|
||||
return this.default;
|
||||
}
|
||||
}
|
||||
merge(instance, data) {
|
||||
if (data[this.name] == undefined || !Condition(this.condition, instance)) return;
|
||||
|
||||
@ -90,11 +97,8 @@ class Property {
|
||||
}
|
||||
reset(instance) {
|
||||
if (instance[this.name] == undefined && !Condition(this.condition, instance)) return;
|
||||
if (typeof this.default == 'function') {
|
||||
var dft = this.default(instance);
|
||||
} else {
|
||||
var dft = this.default;
|
||||
}
|
||||
var dft = this.getDefault(instance)
|
||||
|
||||
if (this.isArray || this.isVector || this.isVector2) {
|
||||
if (instance[this.name] instanceof Array == false) {
|
||||
instance[this.name] = [];
|
||||
|
Loading…
x
Reference in New Issue
Block a user