Pixel-Composer/scripts/panel_keyframe_driver/panel_keyframe_driver.gml

92 lines
2.9 KiB
Text
Raw Normal View History

2023-12-18 04:40:21 +01:00
function Panel_Keyframe_Driver(key) : Panel_Linear_Setting() constructor {
title = __txtx("driver_settings", "Driver Settings");
self.key = key;
w = ui(380);
#region data
prop_default = [
new __Panel_Linear_Setting_Item(
__txtx("driver_type", "Type"),
new scrollBox( [ "None", "Linear", "Wiggle", "Sine" ], function(val) { key.drivers.type = val; setProp(); }),
function() { return key.drivers.type; }
),
];
prop_linear = [
new __Panel_Linear_Setting_Item(
__txt("Speed"),
2024-07-26 09:38:39 +02:00
new textBox( TEXTBOX_INPUT.number, function(val) { key.drivers.speed = val; }),
2023-12-18 04:40:21 +01:00
function() { return key.drivers.speed; }
),
];
prop_wiggle = [
new __Panel_Linear_Setting_Item(
__txt("Seed"),
2024-07-26 09:38:39 +02:00
new textBox( TEXTBOX_INPUT.number, function(val) { key.drivers.seed = val; }),
2023-12-18 04:40:21 +01:00
function() { return key.drivers.seed; }
),
new __Panel_Linear_Setting_Item(
__txt("Sync axis"),
new checkBox( function() { key.drivers.axis_sync = !key.drivers.axis_sync; }),
function() { return key.drivers.axis_sync }
),
new __Panel_Linear_Setting_Item(
__txt("Frequency"),
2024-07-26 09:38:39 +02:00
new textBox( TEXTBOX_INPUT.number, function(val) { key.drivers.frequency = val; }),
2023-12-18 04:40:21 +01:00
function() { return key.drivers.frequency; }
),
new __Panel_Linear_Setting_Item(
__txt("Amplitude"),
2024-07-26 09:38:39 +02:00
new textBox( TEXTBOX_INPUT.number, function(val) { key.drivers.amplitude = val; }),
2023-12-18 04:40:21 +01:00
function() { return key.drivers.amplitude; }
),
new __Panel_Linear_Setting_Item(
__txt("Octave"),
2024-07-26 09:38:39 +02:00
new textBox( TEXTBOX_INPUT.number, function(val) { key.drivers.octave = val; }),
2023-12-18 04:40:21 +01:00
function() { return key.drivers.octave; }
),
];
prop_sine = [
new __Panel_Linear_Setting_Item(
__txt("Sync axis"),
new checkBox( function() { key.drivers.axis_sync = !key.drivers.axis_sync; }),
function() { return key.drivers.axis_sync }
),
new __Panel_Linear_Setting_Item(
__txt("Frequency"),
2024-07-26 09:38:39 +02:00
new textBox( TEXTBOX_INPUT.number, function(val) { key.drivers.frequency = val; }),
2023-12-18 04:40:21 +01:00
function() { return key.drivers.frequency; }
),
new __Panel_Linear_Setting_Item(
__txt("Amplitude"),
2024-07-26 09:38:39 +02:00
new textBox( TEXTBOX_INPUT.number, function(val) { key.drivers.amplitude = val; }),
2023-12-18 04:40:21 +01:00
function() { return key.drivers.amplitude; }
),
new __Panel_Linear_Setting_Item(
__txt("Phase"),
2024-07-26 09:38:39 +02:00
new textBox( TEXTBOX_INPUT.number, function(val) { key.drivers.phase = val; }),
2023-12-18 04:40:21 +01:00
function() { return key.drivers.phase ; }
),
];
#endregion
static setProp = function() {
properties = [];
array_append(properties, prop_default);
switch(key.drivers.type) {
case DRIVER_TYPE.linear : array_append(properties, prop_linear); break;
case DRIVER_TYPE.wiggle : array_append(properties, prop_wiggle); break;
case DRIVER_TYPE.sine : array_append(properties, prop_sine); break;
}
setHeight();
panel.contentResize();
}
run_in(1, function() { setProp(); });
}