feat: implemented live refresh
This commit is contained in:
parent
bab106eeea
commit
7ed438bcb2
3 changed files with 53 additions and 4 deletions
|
|
@ -7,6 +7,7 @@
|
|||
void PointPrimitiveNode::_bind_methods() {
|
||||
BIND_GET_SET(primitive);
|
||||
ClassDB::bind_method(D_METHOD("push_transform_changes"), &self_type::push_transform_changes);
|
||||
ClassDB::bind_method(D_METHOD("preview_transform_changes"), &self_type::preview_transform_changes);
|
||||
}
|
||||
|
||||
void PointPrimitiveNode::on_underlying_changed() {
|
||||
|
|
@ -30,6 +31,22 @@ void PointPrimitiveNode::_notification(int what) {
|
|||
}
|
||||
}
|
||||
|
||||
void PointPrimitiveNode::preview_transform_changes() {
|
||||
if (this->primitive.is_valid()) {
|
||||
this->pushing_change = true;
|
||||
Vector3 const position{ get_global_position() };
|
||||
Vector2 const center{ position.x, position.z };
|
||||
if (center != this->primitive->get_center()) {
|
||||
this->primitive->set_center(center);
|
||||
}
|
||||
if (position.y != this->primitive->get_height()) {
|
||||
this->primitive->set_height(position.y);
|
||||
}
|
||||
|
||||
this->pushing_change = false;
|
||||
}
|
||||
}
|
||||
|
||||
void PointPrimitiveNode::push_transform_changes() {
|
||||
if (this->primitive.is_valid()) {
|
||||
this->pushing_change = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue