mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-24 14:06:23 +01:00
- [Strand Create] Fix error when loading baked strands.
This commit is contained in:
parent
a0a02d7968
commit
1d9dc31a82
6 changed files with 60 additions and 27 deletions
|
@ -163,6 +163,12 @@ event_inherited();
|
||||||
new checkBox(function() /*=>*/ { PREFERENCES.slider_lock_mouse = !PREFERENCES.slider_lock_mouse; PREF_SAVE(); })
|
new checkBox(function() /*=>*/ { PREFERENCES.slider_lock_mouse = !PREFERENCES.slider_lock_mouse; PREF_SAVE(); })
|
||||||
));
|
));
|
||||||
|
|
||||||
|
ds_list_add(pref_global, new __Panel_Linear_Setting_Item_Preference(
|
||||||
|
__txtx("pref_pen_pool_delay", "Pen leave delay"),
|
||||||
|
"pen_pool_delay",
|
||||||
|
new textBox(TEXTBOX_INPUT.number, function(val) /*=>*/ { PREFERENCES.pen_pool_delay = max(0, val); PREF_SAVE(); })
|
||||||
|
));
|
||||||
|
|
||||||
ds_list_add(pref_global, __txt("Save/Load"));
|
ds_list_add(pref_global, __txt("Save/Load"));
|
||||||
|
|
||||||
ds_list_add(pref_global, new __Panel_Linear_Setting_Item_Preference(
|
ds_list_add(pref_global, new __Panel_Linear_Setting_Item_Preference(
|
||||||
|
|
|
@ -44,4 +44,7 @@ if(PEN_RIGHT_CLICK && !b2) PEN_RIGHT_RELEASE = true;
|
||||||
PEN_RIGHT_CLICK = b2;
|
PEN_RIGHT_CLICK = b2;
|
||||||
|
|
||||||
//print($"{PEN_RIGHT_CLICK} | {PEN_RIGHT_PRESS}, {PEN_RIGHT_RELEASE}");
|
//print($"{PEN_RIGHT_CLICK} | {PEN_RIGHT_PRESS}, {PEN_RIGHT_RELEASE}");
|
||||||
PEN_USE = true;
|
if(f & 0x2) {
|
||||||
|
PEN_POOL = PREFERENCES.pen_pool_delay;
|
||||||
|
PEN_USE = true;
|
||||||
|
}
|
|
@ -60,7 +60,9 @@ FILE_DROPPED = false;
|
||||||
watcher_surface = surface_create(1, 1);
|
watcher_surface = surface_create(1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
PEN_USE = false;
|
if(PEN_POOL <= 0) PEN_USE = false;
|
||||||
|
else PEN_POOL--;
|
||||||
|
|
||||||
PEN_RELEASED = false;
|
PEN_RELEASED = false;
|
||||||
PEN_RIGHT_PRESS = false;
|
PEN_RIGHT_PRESS = false;
|
||||||
PEN_RIGHT_RELEASE = false;
|
PEN_RIGHT_RELEASE = false;
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
globalvar PEN_USE, PEN_CONTACT, PEN_RELEASED, PEN_PRESSURE;
|
globalvar PEN_USE, PEN_POOL, PEN_CONTACT, PEN_RELEASED, PEN_PRESSURE;
|
||||||
globalvar PEN_X, PEN_Y, PEN_X_DELTA, PEN_Y_DELTA;
|
globalvar PEN_X, PEN_Y, PEN_X_DELTA, PEN_Y_DELTA;
|
||||||
globalvar PEN_RIGHT_CLICK, PEN_RIGHT_PRESS, PEN_RIGHT_RELEASE;
|
globalvar PEN_RIGHT_CLICK, PEN_RIGHT_PRESS, PEN_RIGHT_RELEASE;
|
||||||
|
|
||||||
PEN_USE = false;
|
PEN_USE = false;
|
||||||
|
PEN_POOL = 0;
|
||||||
|
|
||||||
PEN_X = 0;
|
PEN_X = 0;
|
||||||
PEN_Y = 0;
|
PEN_Y = 0;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
function StrandPoint(x, y) constructor {
|
function StrandPoint(x = 0, y = 0) constructor {
|
||||||
self.x = x;
|
self.x = x;
|
||||||
self.y = y;
|
self.y = y;
|
||||||
|
|
||||||
|
@ -16,10 +16,7 @@ function StrandPoint(x, y) constructor {
|
||||||
|
|
||||||
air_resist = 0.5;
|
air_resist = 0.5;
|
||||||
|
|
||||||
static set = function(x ,y) {
|
static set = function(x ,y) { self.x = x; self.y = y; }
|
||||||
self.x = x;
|
|
||||||
self.y = y;
|
|
||||||
}
|
|
||||||
|
|
||||||
static motionDelta = function() {
|
static motionDelta = function() {
|
||||||
dx = x - px;
|
dx = x - px;
|
||||||
|
@ -35,22 +32,44 @@ function StrandPoint(x, y) constructor {
|
||||||
}
|
}
|
||||||
|
|
||||||
static clone = function() { return new StrandPoint(x, y); }
|
static clone = function() { return new StrandPoint(x, y); }
|
||||||
|
|
||||||
|
static serialize = function(s) {
|
||||||
|
x = s.x;
|
||||||
|
y = s.y;
|
||||||
|
|
||||||
|
px = s.px;
|
||||||
|
py = s.py;
|
||||||
|
|
||||||
|
ppx = s.ppx;
|
||||||
|
ppy = s.ppy;
|
||||||
|
|
||||||
|
dx = s.dx;
|
||||||
|
dy = s.dy;
|
||||||
|
|
||||||
|
ikx = s.ikx;
|
||||||
|
iky = s.iky;
|
||||||
|
|
||||||
|
air_resist = s.air_resist;
|
||||||
|
|
||||||
|
return self;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function Strand(sx = 0, sy = 0, amount = 5, _length = 8, direct = 0, curlFreq = 4, curlSize = 8) constructor {
|
function Strand(sx = 0, sy = 0, amount = 5, _length = 8, _direct = 0, curlFreq = 4, curlSize = 8) constructor {
|
||||||
points = [];
|
|
||||||
id = irandom_range(10000, 99999);
|
id = irandom_range(10000, 99999);
|
||||||
self.length = array_create(amount, _length);
|
|
||||||
self.direct = direct;
|
points = [];
|
||||||
|
length = array_create(amount, _length);
|
||||||
|
direct = _direct;
|
||||||
curl_freq = curlFreq;
|
curl_freq = curlFreq;
|
||||||
curl_size = curlSize;
|
curl_size = curlSize;
|
||||||
|
|
||||||
tension = 0.8;
|
tension = 0.8;
|
||||||
spring = 0.1;
|
spring = 0.1;
|
||||||
angularTension = 0.1;
|
angularTension = 0.1;
|
||||||
|
rootStrength = -1;
|
||||||
|
rootForce = 0;
|
||||||
|
|
||||||
rootStrength = -1;
|
|
||||||
rootForce = 0;
|
|
||||||
free = false;
|
free = false;
|
||||||
|
|
||||||
var _sx = sx;
|
var _sx = sx;
|
||||||
|
@ -62,8 +81,8 @@ function Strand(sx = 0, sy = 0, amount = 5, _length = 8, direct = 0, curlFreq =
|
||||||
}
|
}
|
||||||
|
|
||||||
setOrigin(_sx, _sy);
|
setOrigin(_sx, _sy);
|
||||||
for( var i = 1; i < array_length(points); i++ )
|
|
||||||
restAngle[i] = 0;
|
restAngle = array_create(array_length(points), 0);
|
||||||
restAngle[0] = direct;
|
restAngle[0] = direct;
|
||||||
|
|
||||||
static motionDelta = function() {
|
static motionDelta = function() {
|
||||||
|
@ -361,24 +380,24 @@ function Strand(sx = 0, sy = 0, amount = 5, _length = 8, direct = 0, curlFreq =
|
||||||
var s = new Strand(points[0].x, points[0].y, array_length(points), length[0], direct, curl_freq, curl_size);
|
var s = new Strand(points[0].x, points[0].y, array_length(points), length[0], direct, curl_freq, curl_size);
|
||||||
for( var i = 0, n = array_length(points); i < n; i++ )
|
for( var i = 0, n = array_length(points); i < n; i++ )
|
||||||
s.points[i] = points[i].clone();
|
s.points[i] = points[i].clone();
|
||||||
|
|
||||||
s.restAngle = array_clone(restAngle);
|
s.restAngle = array_clone(restAngle);
|
||||||
s.length = array_clone(length);
|
s.length = array_clone(length);
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
static serialize = function() {
|
static serialize = function() { return { points, restAngle, length }; }
|
||||||
return {
|
|
||||||
points: points,
|
|
||||||
restAngle: restAngle,
|
|
||||||
length: length,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
static deserialize = function(s) {
|
static deserialize = function(s) {
|
||||||
points = s.points;
|
|
||||||
restAngle = s.restAngle;
|
restAngle = s.restAngle;
|
||||||
length = s.length;
|
length = s.length;
|
||||||
|
|
||||||
|
var _p = s.points;
|
||||||
|
points = array_create(array_length(_p));
|
||||||
|
for (var i = 0, n = array_length(_p); i < n; i++)
|
||||||
|
points[i] = new StrandPoint().serialize(_p[i]);
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,8 @@
|
||||||
|
|
||||||
PREFERENCES.double_click_delay = 0.25;
|
PREFERENCES.double_click_delay = 0.25;
|
||||||
PREFERENCES.mouse_wheel_speed = 1.00;
|
PREFERENCES.mouse_wheel_speed = 1.00;
|
||||||
|
|
||||||
|
PREFERENCES.pen_pool_delay = 1;
|
||||||
PREFERENCES.slider_lock_mouse = true;
|
PREFERENCES.slider_lock_mouse = true;
|
||||||
|
|
||||||
PREFERENCES.keyboard_repeat_start = 0.50;
|
PREFERENCES.keyboard_repeat_start = 0.50;
|
||||||
|
|
Loading…
Reference in a new issue