Pixel-Composer/scripts/panel_keyframe_driver/panel_keyframe_driver.gml

93 lines
3 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;
2025-01-11 04:31:00 +01:00
shift_height = false;
2023-12-18 04:40:21 +01:00
w = ui(380);
#region data
prop_default = [
new __Panel_Linear_Setting_Item(
__txtx("driver_type", "Type"),
2025-01-11 04:31:00 +01:00
new scrollBox( [ "None", "Linear", "Wiggle", "Sine" ], function(val) /*=>*/ { key.drivers.type = val; setProp(); }, false),
function() /*=>*/ {return key.drivers.type}
2023-12-18 04:40:21 +01:00
),
];
prop_linear = [
new __Panel_Linear_Setting_Item(
__txt("Speed"),
2025-01-11 04:31:00 +01:00
new textBox( TEXTBOX_INPUT.number, function(val) /*=>*/ { key.drivers.speed = val; }),
function() /*=>*/ {return key.drivers.speed}
2023-12-18 04:40:21 +01:00
),
];
prop_wiggle = [
new __Panel_Linear_Setting_Item(
__txt("Seed"),
2025-01-11 04:31:00 +01:00
new textBox( TEXTBOX_INPUT.number, function(val) /*=>*/ { key.drivers.seed = val; }),
function() /*=>*/ {return key.drivers.seed}
2023-12-18 04:40:21 +01:00
),
new __Panel_Linear_Setting_Item(
__txt("Sync axis"),
2025-01-11 04:31:00 +01:00
new checkBox( function() /*=>*/ { key.drivers.axis_sync = !key.drivers.axis_sync; }),
function() /*=>*/ {return key.drivers.axis_sync}
2023-12-18 04:40:21 +01:00
),
new __Panel_Linear_Setting_Item(
__txt("Frequency"),
2025-01-11 04:31:00 +01:00
new textBox( TEXTBOX_INPUT.number, function(val) /*=>*/ { key.drivers.frequency = val; }),
function() /*=>*/ {return key.drivers.frequency}
2023-12-18 04:40:21 +01:00
),
new __Panel_Linear_Setting_Item(
__txt("Amplitude"),
2025-01-11 04:31:00 +01:00
new textBox( TEXTBOX_INPUT.number, function(val) /*=>*/ { key.drivers.amplitude = val; }),
function() /*=>*/ {return key.drivers.amplitude}
2023-12-18 04:40:21 +01:00
),
new __Panel_Linear_Setting_Item(
__txt("Octave"),
2025-01-11 04:31:00 +01:00
new textBox( TEXTBOX_INPUT.number, function(val) /*=>*/ { key.drivers.octave = val; }),
function() /*=>*/ {return key.drivers.octave}
2023-12-18 04:40:21 +01:00
),
];
prop_sine = [
new __Panel_Linear_Setting_Item(
__txt("Sync axis"),
2025-01-11 04:31:00 +01:00
new checkBox( function() /*=>*/ { key.drivers.axis_sync = !key.drivers.axis_sync; }),
function() /*=>*/ {return key.drivers.axis_sync}
2023-12-18 04:40:21 +01:00
),
new __Panel_Linear_Setting_Item(
__txt("Frequency"),
2025-01-11 04:31:00 +01:00
new textBox( TEXTBOX_INPUT.number, function(val) /*=>*/ { key.drivers.frequency = val; }),
function() /*=>*/ {return key.drivers.frequency}
2023-12-18 04:40:21 +01:00
),
new __Panel_Linear_Setting_Item(
__txt("Amplitude"),
2025-01-11 04:31:00 +01:00
new textBox( TEXTBOX_INPUT.number, function(val) /*=>*/ { key.drivers.amplitude = val; }),
function() /*=>*/ {return key.drivers.amplitude}
2023-12-18 04:40:21 +01:00
),
new __Panel_Linear_Setting_Item(
__txt("Phase"),
2025-01-11 04:31:00 +01:00
new textBox( TEXTBOX_INPUT.number, function(val) /*=>*/ { key.drivers.phase = val; }),
function() /*=>*/ {return key.drivers.phase}
2023-12-18 04:40:21 +01:00
),
];
#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();
}
2025-01-11 04:31:00 +01:00
run_in(1, function() /*=>*/ {return setProp()});
2023-12-18 04:40:21 +01:00
}