Style: clang-format: Disable AllowShortIfStatementsOnASingleLine
This commit is contained in:
parent
6e600cb3f0
commit
3d15f04668
|
@ -15,7 +15,7 @@ AllowAllParametersOfDeclarationOnNextLine: false
|
||||||
# AllowShortBlocksOnASingleLine: false
|
# AllowShortBlocksOnASingleLine: false
|
||||||
AllowShortCaseLabelsOnASingleLine: true
|
AllowShortCaseLabelsOnASingleLine: true
|
||||||
AllowShortFunctionsOnASingleLine: Inline
|
AllowShortFunctionsOnASingleLine: Inline
|
||||||
AllowShortIfStatementsOnASingleLine: true
|
# AllowShortIfStatementsOnASingleLine: false
|
||||||
# AllowShortLoopsOnASingleLine: false
|
# AllowShortLoopsOnASingleLine: false
|
||||||
# AlwaysBreakAfterDefinitionReturnType: None
|
# AlwaysBreakAfterDefinitionReturnType: None
|
||||||
# AlwaysBreakAfterReturnType: None
|
# AlwaysBreakAfterReturnType: None
|
||||||
|
|
|
@ -1436,16 +1436,19 @@ Variant ClassDB::class_get_default_property_value(const StringName &p_class, con
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!default_values.has(p_class)) {
|
if (!default_values.has(p_class)) {
|
||||||
if (r_valid != NULL) *r_valid = false;
|
if (r_valid != NULL)
|
||||||
|
*r_valid = false;
|
||||||
return Variant();
|
return Variant();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!default_values[p_class].has(p_property)) {
|
if (!default_values[p_class].has(p_property)) {
|
||||||
if (r_valid != NULL) *r_valid = false;
|
if (r_valid != NULL)
|
||||||
|
*r_valid = false;
|
||||||
return Variant();
|
return Variant();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (r_valid != NULL) *r_valid = true;
|
if (r_valid != NULL)
|
||||||
|
*r_valid = true;
|
||||||
return default_values[p_class][p_property];
|
return default_values[p_class][p_property];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -406,7 +406,8 @@ bool Color::html_is_valid(const String &p_color) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Color Color::named(const String &p_name) {
|
Color Color::named(const String &p_name) {
|
||||||
if (_named_colors.empty()) _populate_named_colors(); // from color_names.inc
|
if (_named_colors.empty())
|
||||||
|
_populate_named_colors(); // from color_names.inc
|
||||||
String name = p_name;
|
String name = p_name;
|
||||||
// Normalize name
|
// Normalize name
|
||||||
name = name.replace(" ", "");
|
name = name.replace(" ", "");
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
|
|
||||||
static Map<String, Color> _named_colors;
|
static Map<String, Color> _named_colors;
|
||||||
static void _populate_named_colors() {
|
static void _populate_named_colors() {
|
||||||
if (!_named_colors.empty()) return;
|
if (!_named_colors.empty())
|
||||||
|
return;
|
||||||
_named_colors.insert("aliceblue", Color(0.94, 0.97, 1.00));
|
_named_colors.insert("aliceblue", Color(0.94, 0.97, 1.00));
|
||||||
_named_colors.insert("antiquewhite", Color(0.98, 0.92, 0.84));
|
_named_colors.insert("antiquewhite", Color(0.98, 0.92, 0.84));
|
||||||
_named_colors.insert("aqua", Color(0.00, 1.00, 1.00));
|
_named_colors.insert("aqua", Color(0.00, 1.00, 1.00));
|
||||||
|
|
|
@ -233,7 +233,8 @@
|
||||||
cmd->method = p_method; \
|
cmd->method = p_method; \
|
||||||
SEMIC_SEP_LIST(CMD_ASSIGN_PARAM, N); \
|
SEMIC_SEP_LIST(CMD_ASSIGN_PARAM, N); \
|
||||||
unlock(); \
|
unlock(); \
|
||||||
if (sync) sync->post(); \
|
if (sync) \
|
||||||
|
sync->post(); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CMD_RET_TYPE(N) CommandRet##N<T, M, COMMA_SEP_LIST(TYPE_ARG, N) COMMA(N) R>
|
#define CMD_RET_TYPE(N) CommandRet##N<T, M, COMMA_SEP_LIST(TYPE_ARG, N) COMMA(N) R>
|
||||||
|
@ -249,7 +250,8 @@
|
||||||
cmd->ret = r_ret; \
|
cmd->ret = r_ret; \
|
||||||
cmd->sync_sem = ss; \
|
cmd->sync_sem = ss; \
|
||||||
unlock(); \
|
unlock(); \
|
||||||
if (sync) sync->post(); \
|
if (sync) \
|
||||||
|
sync->post(); \
|
||||||
ss->sem.wait(); \
|
ss->sem.wait(); \
|
||||||
ss->in_use = false; \
|
ss->in_use = false; \
|
||||||
}
|
}
|
||||||
|
@ -266,7 +268,8 @@
|
||||||
SEMIC_SEP_LIST(CMD_ASSIGN_PARAM, N); \
|
SEMIC_SEP_LIST(CMD_ASSIGN_PARAM, N); \
|
||||||
cmd->sync_sem = ss; \
|
cmd->sync_sem = ss; \
|
||||||
unlock(); \
|
unlock(); \
|
||||||
if (sync) sync->post(); \
|
if (sync) \
|
||||||
|
sync->post(); \
|
||||||
ss->sem.wait(); \
|
ss->sem.wait(); \
|
||||||
ss->in_use = false; \
|
ss->in_use = false; \
|
||||||
}
|
}
|
||||||
|
@ -408,12 +411,14 @@ class CommandQueueMT {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool flush_one(bool p_lock = true) {
|
bool flush_one(bool p_lock = true) {
|
||||||
if (p_lock) lock();
|
if (p_lock)
|
||||||
|
lock();
|
||||||
tryagain:
|
tryagain:
|
||||||
|
|
||||||
// tried to read an empty queue
|
// tried to read an empty queue
|
||||||
if (read_ptr_and_epoch == write_ptr_and_epoch) {
|
if (read_ptr_and_epoch == write_ptr_and_epoch) {
|
||||||
if (p_lock) unlock();
|
if (p_lock)
|
||||||
|
unlock();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -436,15 +441,18 @@ class CommandQueueMT {
|
||||||
|
|
||||||
read_ptr_and_epoch = (read_ptr << 1) | (read_ptr_and_epoch & 1);
|
read_ptr_and_epoch = (read_ptr << 1) | (read_ptr_and_epoch & 1);
|
||||||
|
|
||||||
if (p_lock) unlock();
|
if (p_lock)
|
||||||
|
unlock();
|
||||||
cmd->call();
|
cmd->call();
|
||||||
if (p_lock) lock();
|
if (p_lock)
|
||||||
|
lock();
|
||||||
|
|
||||||
cmd->post();
|
cmd->post();
|
||||||
cmd->~CommandBase();
|
cmd->~CommandBase();
|
||||||
*(uint32_t *)&command_mem[size_ptr] &= ~1;
|
*(uint32_t *)&command_mem[size_ptr] &= ~1;
|
||||||
|
|
||||||
if (p_lock) unlock();
|
if (p_lock)
|
||||||
|
unlock();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,8 @@ private:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
*out = next_power_of_2(o);
|
*out = next_power_of_2(o);
|
||||||
if (_add_overflow(o, static_cast<size_t>(32), &p)) return false; //no longer allocated here
|
if (_add_overflow(o, static_cast<size_t>(32), &p))
|
||||||
|
return false; //no longer allocated here
|
||||||
return true;
|
return true;
|
||||||
#else
|
#else
|
||||||
// Speed is more important than correctness here, do the operations unchecked
|
// Speed is more important than correctness here, do the operations unchecked
|
||||||
|
|
|
@ -2931,11 +2931,13 @@ void Image::bumpmap_to_normalmap(float bump_scale) {
|
||||||
|
|
||||||
for (int ty = 0; ty < height; ty++) {
|
for (int ty = 0; ty < height; ty++) {
|
||||||
int py = ty + 1;
|
int py = ty + 1;
|
||||||
if (py >= height) py -= height;
|
if (py >= height)
|
||||||
|
py -= height;
|
||||||
|
|
||||||
for (int tx = 0; tx < width; tx++) {
|
for (int tx = 0; tx < width; tx++) {
|
||||||
int px = tx + 1;
|
int px = tx + 1;
|
||||||
if (px >= width) px -= width;
|
if (px >= width)
|
||||||
|
px -= width;
|
||||||
float here = read_ptr[ty * width + tx];
|
float here = read_ptr[ty * width + tx];
|
||||||
float to_right = read_ptr[ty * width + px];
|
float to_right = read_ptr[ty * width + px];
|
||||||
float above = read_ptr[py * width + tx];
|
float above = read_ptr[py * width + tx];
|
||||||
|
|
|
@ -431,7 +431,8 @@ PackedData::PackedDir *DirAccessPack::_find_dir(String p_dir) {
|
||||||
|
|
||||||
nd = nd.simplify_path();
|
nd = nd.simplify_path();
|
||||||
|
|
||||||
if (nd == "") nd = ".";
|
if (nd == "")
|
||||||
|
nd = ".";
|
||||||
|
|
||||||
if (nd.begins_with("/")) {
|
if (nd.begins_with("/")) {
|
||||||
nd = nd.replace_first("/", "");
|
nd = nd.replace_first("/", "");
|
||||||
|
|
|
@ -52,16 +52,20 @@ protected:
|
||||||
public:
|
public:
|
||||||
//operator Variant() const;
|
//operator Variant() const;
|
||||||
bool operator==(const IP_Address &p_ip) const {
|
bool operator==(const IP_Address &p_ip) const {
|
||||||
if (p_ip.valid != valid) return false;
|
if (p_ip.valid != valid)
|
||||||
if (!valid) return false;
|
return false;
|
||||||
|
if (!valid)
|
||||||
|
return false;
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
if (field32[i] != p_ip.field32[i])
|
if (field32[i] != p_ip.field32[i])
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
bool operator!=(const IP_Address &p_ip) const {
|
bool operator!=(const IP_Address &p_ip) const {
|
||||||
if (p_ip.valid != valid) return true;
|
if (p_ip.valid != valid)
|
||||||
if (!valid) return true;
|
return true;
|
||||||
|
if (!valid)
|
||||||
|
return true;
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
if (field32[i] != p_ip.field32[i])
|
if (field32[i] != p_ip.field32[i])
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -121,7 +121,8 @@ static inline int encode_cstring(const char *p_string, uint8_t *p_data) {
|
||||||
len++;
|
len++;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (p_data) *p_data = 0;
|
if (p_data)
|
||||||
|
*p_data = 0;
|
||||||
return len + 1;
|
return len + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -142,7 +142,8 @@ Node *MultiplayerAPI::get_root_node() {
|
||||||
|
|
||||||
void MultiplayerAPI::set_network_peer(const Ref<NetworkedMultiplayerPeer> &p_peer) {
|
void MultiplayerAPI::set_network_peer(const Ref<NetworkedMultiplayerPeer> &p_peer) {
|
||||||
|
|
||||||
if (p_peer == network_peer) return; // Nothing to do
|
if (p_peer == network_peer)
|
||||||
|
return; // Nothing to do
|
||||||
|
|
||||||
ERR_FAIL_COND_MSG(p_peer.is_valid() && p_peer->get_connection_status() == NetworkedMultiplayerPeer::CONNECTION_DISCONNECTED,
|
ERR_FAIL_COND_MSG(p_peer.is_valid() && p_peer->get_connection_status() == NetworkedMultiplayerPeer::CONNECTION_DISCONNECTED,
|
||||||
"Supplied NetworkedMultiplayerPeer must be connecting or connected.");
|
"Supplied NetworkedMultiplayerPeer must be connecting or connected.");
|
||||||
|
@ -504,8 +505,9 @@ void MultiplayerAPI::_send_rpc(Node *p_from, int p_to, bool p_unreliable, bool p
|
||||||
|
|
||||||
int ofs = 0;
|
int ofs = 0;
|
||||||
|
|
||||||
#define MAKE_ROOM(m_amount) \
|
#define MAKE_ROOM(m_amount) \
|
||||||
if (packet_cache.size() < m_amount) packet_cache.resize(m_amount);
|
if (packet_cache.size() < m_amount) \
|
||||||
|
packet_cache.resize(m_amount);
|
||||||
|
|
||||||
// Encode type.
|
// Encode type.
|
||||||
MAKE_ROOM(1);
|
MAKE_ROOM(1);
|
||||||
|
|
|
@ -161,7 +161,8 @@ public:
|
||||||
static bool get_timestamp_on_load() { return timestamp_on_load; }
|
static bool get_timestamp_on_load() { return timestamp_on_load; }
|
||||||
|
|
||||||
static void notify_load_error(const String &p_err) {
|
static void notify_load_error(const String &p_err) {
|
||||||
if (err_notify) err_notify(err_notify_ud, p_err);
|
if (err_notify)
|
||||||
|
err_notify(err_notify_ud, p_err);
|
||||||
}
|
}
|
||||||
static void set_error_notify_func(void *p_ud, ResourceLoadErrorNotify p_err_notify) {
|
static void set_error_notify_func(void *p_ud, ResourceLoadErrorNotify p_err_notify) {
|
||||||
err_notify = p_err_notify;
|
err_notify = p_err_notify;
|
||||||
|
@ -169,7 +170,8 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
static void notify_dependency_error(const String &p_path, const String &p_dependency, const String &p_type) {
|
static void notify_dependency_error(const String &p_path, const String &p_dependency, const String &p_type) {
|
||||||
if (dep_err_notify) dep_err_notify(dep_err_notify_ud, p_path, p_dependency, p_type);
|
if (dep_err_notify)
|
||||||
|
dep_err_notify(dep_err_notify_ud, p_path, p_dependency, p_type);
|
||||||
}
|
}
|
||||||
static void set_dependency_error_notify_func(void *p_ud, DependencyErrorNotify p_err_notify) {
|
static void set_dependency_error_notify_func(void *p_ud, DependencyErrorNotify p_err_notify) {
|
||||||
dep_err_notify = p_err_notify;
|
dep_err_notify = p_err_notify;
|
||||||
|
|
|
@ -353,7 +353,8 @@ public:
|
||||||
|
|
||||||
Element *it = front();
|
Element *it = front();
|
||||||
while (it) {
|
while (it) {
|
||||||
if (it->value == p_val) return it;
|
if (it->value == p_val)
|
||||||
|
return it;
|
||||||
it = it->next();
|
it = it->next();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -164,7 +164,8 @@ void AStar::connect_points(int p_id, int p_with_id, bool bidirectional) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Segment s(p_id, p_with_id);
|
Segment s(p_id, p_with_id);
|
||||||
if (bidirectional) s.direction = Segment::BIDIRECTIONAL;
|
if (bidirectional)
|
||||||
|
s.direction = Segment::BIDIRECTIONAL;
|
||||||
|
|
||||||
Set<Segment>::Element *element = segments.find(s);
|
Set<Segment>::Element *element = segments.find(s);
|
||||||
if (element != NULL) {
|
if (element != NULL) {
|
||||||
|
@ -290,7 +291,8 @@ int AStar::get_closest_point(const Vector3 &p_point, bool p_include_disabled) co
|
||||||
|
|
||||||
for (OAHashMap<int, Point *>::Iterator it = points.iter(); it.valid; it = points.next_iter(it)) {
|
for (OAHashMap<int, Point *>::Iterator it = points.iter(); it.valid; it = points.next_iter(it)) {
|
||||||
|
|
||||||
if (!p_include_disabled && !(*it.value)->enabled) continue; // Disabled points should not be considered.
|
if (!p_include_disabled && !(*it.value)->enabled)
|
||||||
|
continue; // Disabled points should not be considered.
|
||||||
|
|
||||||
// Keep the closest point's ID, and in case of multiple closest IDs,
|
// Keep the closest point's ID, and in case of multiple closest IDs,
|
||||||
// the smallest one (makes it deterministic).
|
// the smallest one (makes it deterministic).
|
||||||
|
@ -344,7 +346,8 @@ bool AStar::_solve(Point *begin_point, Point *end_point) {
|
||||||
|
|
||||||
pass++;
|
pass++;
|
||||||
|
|
||||||
if (!end_point->enabled) return false;
|
if (!end_point->enabled)
|
||||||
|
return false;
|
||||||
|
|
||||||
bool found_route = false;
|
bool found_route = false;
|
||||||
|
|
||||||
|
@ -455,7 +458,8 @@ PoolVector<Vector3> AStar::get_point_path(int p_from_id, int p_to_id) {
|
||||||
Point *end_point = b;
|
Point *end_point = b;
|
||||||
|
|
||||||
bool found_route = _solve(begin_point, end_point);
|
bool found_route = _solve(begin_point, end_point);
|
||||||
if (!found_route) return PoolVector<Vector3>();
|
if (!found_route)
|
||||||
|
return PoolVector<Vector3>();
|
||||||
|
|
||||||
Point *p = end_point;
|
Point *p = end_point;
|
||||||
int pc = 1; // Begin point
|
int pc = 1; // Begin point
|
||||||
|
@ -503,7 +507,8 @@ PoolVector<int> AStar::get_id_path(int p_from_id, int p_to_id) {
|
||||||
Point *end_point = b;
|
Point *end_point = b;
|
||||||
|
|
||||||
bool found_route = _solve(begin_point, end_point);
|
bool found_route = _solve(begin_point, end_point);
|
||||||
if (!found_route) return PoolVector<int>();
|
if (!found_route)
|
||||||
|
return PoolVector<int>();
|
||||||
|
|
||||||
Point *p = end_point;
|
Point *p = end_point;
|
||||||
int pc = 1; // Begin point
|
int pc = 1; // Begin point
|
||||||
|
@ -733,7 +738,8 @@ PoolVector<Vector2> AStar2D::get_point_path(int p_from_id, int p_to_id) {
|
||||||
AStar::Point *end_point = b;
|
AStar::Point *end_point = b;
|
||||||
|
|
||||||
bool found_route = _solve(begin_point, end_point);
|
bool found_route = _solve(begin_point, end_point);
|
||||||
if (!found_route) return PoolVector<Vector2>();
|
if (!found_route)
|
||||||
|
return PoolVector<Vector2>();
|
||||||
|
|
||||||
AStar::Point *p = end_point;
|
AStar::Point *p = end_point;
|
||||||
int pc = 1; // Begin point
|
int pc = 1; // Begin point
|
||||||
|
@ -781,7 +787,8 @@ PoolVector<int> AStar2D::get_id_path(int p_from_id, int p_to_id) {
|
||||||
AStar::Point *end_point = b;
|
AStar::Point *end_point = b;
|
||||||
|
|
||||||
bool found_route = _solve(begin_point, end_point);
|
bool found_route = _solve(begin_point, end_point);
|
||||||
if (!found_route) return PoolVector<int>();
|
if (!found_route)
|
||||||
|
return PoolVector<int>();
|
||||||
|
|
||||||
AStar::Point *p = end_point;
|
AStar::Point *p = end_point;
|
||||||
int pc = 1; // Begin point
|
int pc = 1; // Begin point
|
||||||
|
@ -813,7 +820,8 @@ bool AStar2D::_solve(AStar::Point *begin_point, AStar::Point *end_point) {
|
||||||
|
|
||||||
astar.pass++;
|
astar.pass++;
|
||||||
|
|
||||||
if (!end_point->enabled) return false;
|
if (!end_point->enabled)
|
||||||
|
return false;
|
||||||
|
|
||||||
bool found_route = false;
|
bool found_route = false;
|
||||||
|
|
||||||
|
|
|
@ -951,7 +951,8 @@ void Basis::get_axis_angle(Vector3 &r_axis, real_t &r_angle) const {
|
||||||
real_t s = Math::sqrt((elements[1][2] - elements[2][1]) * (elements[1][2] - elements[2][1]) + (elements[2][0] - elements[0][2]) * (elements[2][0] - elements[0][2]) + (elements[0][1] - elements[1][0]) * (elements[0][1] - elements[1][0])); // s=|axis||sin(angle)|, used to normalise
|
real_t s = Math::sqrt((elements[1][2] - elements[2][1]) * (elements[1][2] - elements[2][1]) + (elements[2][0] - elements[0][2]) * (elements[2][0] - elements[0][2]) + (elements[0][1] - elements[1][0]) * (elements[0][1] - elements[1][0])); // s=|axis||sin(angle)|, used to normalise
|
||||||
|
|
||||||
angle = Math::acos((elements[0][0] + elements[1][1] + elements[2][2] - 1) / 2);
|
angle = Math::acos((elements[0][0] + elements[1][1] + elements[2][2] - 1) / 2);
|
||||||
if (angle < 0) s = -s;
|
if (angle < 0)
|
||||||
|
s = -s;
|
||||||
x = (elements[2][1] - elements[1][2]) / s;
|
x = (elements[2][1] - elements[1][2]) / s;
|
||||||
y = (elements[0][2] - elements[2][0]) / s;
|
y = (elements[0][2] - elements[2][0]) / s;
|
||||||
z = (elements[1][0] - elements[0][1]) / s;
|
z = (elements[1][0] - elements[0][1]) / s;
|
||||||
|
|
|
@ -200,20 +200,26 @@ struct BVH_ABB {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool intersects_point(const Point &p_pt) const {
|
bool intersects_point(const Point &p_pt) const {
|
||||||
if (_any_lessthan(-p_pt, neg_max)) return false;
|
if (_any_lessthan(-p_pt, neg_max))
|
||||||
if (_any_lessthan(p_pt, min)) return false;
|
return false;
|
||||||
|
if (_any_lessthan(p_pt, min))
|
||||||
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool intersects(const BVH_ABB &p_o) const {
|
bool intersects(const BVH_ABB &p_o) const {
|
||||||
if (_any_morethan(p_o.min, -neg_max)) return false;
|
if (_any_morethan(p_o.min, -neg_max))
|
||||||
if (_any_morethan(min, -p_o.neg_max)) return false;
|
return false;
|
||||||
|
if (_any_morethan(min, -p_o.neg_max))
|
||||||
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_other_within(const BVH_ABB &p_o) const {
|
bool is_other_within(const BVH_ABB &p_o) const {
|
||||||
if (_any_lessthan(p_o.neg_max, neg_max)) return false;
|
if (_any_lessthan(p_o.neg_max, neg_max))
|
||||||
if (_any_lessthan(p_o.min, min)) return false;
|
return false;
|
||||||
|
if (_any_lessthan(p_o.min, min))
|
||||||
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -443,20 +443,23 @@ void CameraMatrix::invert() {
|
||||||
|
|
||||||
/** Divide column by minus pivot value **/
|
/** Divide column by minus pivot value **/
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
if (i != k) matrix[i][k] /= (-pvt_val);
|
if (i != k)
|
||||||
|
matrix[i][k] /= (-pvt_val);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Reduce the matrix **/
|
/** Reduce the matrix **/
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
hold = matrix[i][k];
|
hold = matrix[i][k];
|
||||||
for (j = 0; j < 4; j++) {
|
for (j = 0; j < 4; j++) {
|
||||||
if (i != k && j != k) matrix[i][j] += hold * matrix[k][j];
|
if (i != k && j != k)
|
||||||
|
matrix[i][j] += hold * matrix[k][j];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Divide row by pivot **/
|
/** Divide row by pivot **/
|
||||||
for (j = 0; j < 4; j++) {
|
for (j = 0; j < 4; j++) {
|
||||||
if (j != k) matrix[k][j] /= pvt_val;
|
if (j != k)
|
||||||
|
matrix[k][j] /= pvt_val;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Replace pivot by reciprocal (at last we can touch it). **/
|
/** Replace pivot by reciprocal (at last we can touch it). **/
|
||||||
|
|
|
@ -113,10 +113,14 @@ public:
|
||||||
real_t mub = (d_of(p1, q1, q2, q1) + mua * d_of(q2, q1, p2, p1)) / d_of(q2, q1, q2, q1);
|
real_t mub = (d_of(p1, q1, q2, q1) + mua * d_of(q2, q1, p2, p1)) / d_of(q2, q1, q2, q1);
|
||||||
|
|
||||||
// Clip the value between [0..1] constraining the solution to lie on the original curves.
|
// Clip the value between [0..1] constraining the solution to lie on the original curves.
|
||||||
if (mua < 0) mua = 0;
|
if (mua < 0)
|
||||||
if (mub < 0) mub = 0;
|
mua = 0;
|
||||||
if (mua > 1) mua = 1;
|
if (mub < 0)
|
||||||
if (mub > 1) mub = 1;
|
mub = 0;
|
||||||
|
if (mua > 1)
|
||||||
|
mua = 1;
|
||||||
|
if (mub > 1)
|
||||||
|
mub = 1;
|
||||||
c1 = p1.linear_interpolate(p2, mua);
|
c1 = p1.linear_interpolate(p2, mua);
|
||||||
c2 = q1.linear_interpolate(q2, mub);
|
c2 = q1.linear_interpolate(q2, mub);
|
||||||
}
|
}
|
||||||
|
@ -506,7 +510,8 @@ public:
|
||||||
|
|
||||||
bool orientation = an.cross(bn) > 0;
|
bool orientation = an.cross(bn) > 0;
|
||||||
|
|
||||||
if ((bn.cross(cn) > 0) != orientation) return false;
|
if ((bn.cross(cn) > 0) != orientation)
|
||||||
|
return false;
|
||||||
|
|
||||||
return (cn.cross(an) > 0) == orientation;
|
return (cn.cross(an) > 0) == orientation;
|
||||||
}
|
}
|
||||||
|
@ -713,7 +718,8 @@ public:
|
||||||
|
|
||||||
// If the term we intend to square root is less than 0 then the answer won't be real,
|
// If the term we intend to square root is less than 0 then the answer won't be real,
|
||||||
// so it definitely won't be t in the range 0 to 1.
|
// so it definitely won't be t in the range 0 to 1.
|
||||||
if (sqrtterm < 0) return -1;
|
if (sqrtterm < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
// If we can assume that the line segment starts outside the circle (e.g. for continuous time collision detection)
|
// If we can assume that the line segment starts outside the circle (e.g. for continuous time collision detection)
|
||||||
// then the following can be skipped and we can just return the equivalent of res1.
|
// then the following can be skipped and we can just return the equivalent of res1.
|
||||||
|
@ -721,8 +727,10 @@ public:
|
||||||
real_t res1 = (-b - sqrtterm) / (2 * a);
|
real_t res1 = (-b - sqrtterm) / (2 * a);
|
||||||
real_t res2 = (-b + sqrtterm) / (2 * a);
|
real_t res2 = (-b + sqrtterm) / (2 * a);
|
||||||
|
|
||||||
if (res1 >= 0 && res1 <= 1) return res1;
|
if (res1 >= 0 && res1 <= 1)
|
||||||
if (res2 >= 0 && res2 <= 1) return res2;
|
return res1;
|
||||||
|
if (res2 >= 0 && res2 <= 1)
|
||||||
|
return res2;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -206,7 +206,8 @@ Quat Quat::slerpni(const Quat &p_to, const real_t &p_weight) const {
|
||||||
|
|
||||||
real_t dot = from.dot(p_to);
|
real_t dot = from.dot(p_to);
|
||||||
|
|
||||||
if (Math::absf(dot) > 0.9999) return from;
|
if (Math::absf(dot) > 0.9999)
|
||||||
|
return from;
|
||||||
|
|
||||||
real_t theta = Math::acos(dot),
|
real_t theta = Math::acos(dot),
|
||||||
sinT = 1.0 / Math::sin(theta),
|
sinT = 1.0 / Math::sin(theta),
|
||||||
|
|
|
@ -570,14 +570,16 @@ bool TriangleMesh::intersect_convex_shape(const Plane *p_planes, int p_plane_cou
|
||||||
if (p.intersects_segment(point, next_point, &res)) {
|
if (p.intersects_segment(point, next_point, &res)) {
|
||||||
bool inisde = true;
|
bool inisde = true;
|
||||||
for (int k = 0; k < p_plane_count; k++) {
|
for (int k = 0; k < p_plane_count; k++) {
|
||||||
if (k == i) continue;
|
if (k == i)
|
||||||
|
continue;
|
||||||
const Plane &pp = p_planes[k];
|
const Plane &pp = p_planes[k];
|
||||||
if (pp.is_point_over(res)) {
|
if (pp.is_point_over(res)) {
|
||||||
inisde = false;
|
inisde = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (inisde) return true;
|
if (inisde)
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p.is_point_over(point)) {
|
if (p.is_point_over(point)) {
|
||||||
|
@ -585,7 +587,8 @@ bool TriangleMesh::intersect_convex_shape(const Plane *p_planes, int p_plane_cou
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (over) return true;
|
if (over)
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
stack[level] = (VISIT_DONE_BIT << VISITED_BIT_SHIFT) | node;
|
stack[level] = (VISIT_DONE_BIT << VISITED_BIT_SHIFT) | node;
|
||||||
|
@ -667,7 +670,8 @@ bool TriangleMesh::inside_convex_shape(const Plane *p_planes, int p_plane_count,
|
||||||
case TEST_AABB_BIT: {
|
case TEST_AABB_BIT: {
|
||||||
|
|
||||||
bool intersects = scale.xform(b.aabb).intersects_convex_shape(p_planes, p_plane_count, p_points, p_point_count);
|
bool intersects = scale.xform(b.aabb).intersects_convex_shape(p_planes, p_plane_count, p_points, p_point_count);
|
||||||
if (!intersects) return false;
|
if (!intersects)
|
||||||
|
return false;
|
||||||
|
|
||||||
bool inside = scale.xform(b.aabb).inside_convex_shape(p_planes, p_plane_count);
|
bool inside = scale.xform(b.aabb).inside_convex_shape(p_planes, p_plane_count);
|
||||||
if (inside) {
|
if (inside) {
|
||||||
|
@ -682,7 +686,8 @@ bool TriangleMesh::inside_convex_shape(const Plane *p_planes, int p_plane_count,
|
||||||
Vector3 point = scale.xform(vertexptr[s.indices[j]]);
|
Vector3 point = scale.xform(vertexptr[s.indices[j]]);
|
||||||
for (int i = 0; i < p_plane_count; i++) {
|
for (int i = 0; i < p_plane_count; i++) {
|
||||||
const Plane &p = p_planes[i];
|
const Plane &p = p_planes[i];
|
||||||
if (p.is_point_over(point)) return false;
|
if (p.is_point_over(point))
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -103,13 +103,16 @@ bool Triangulate::snip(const Vector<Vector2> &p_contour, int u, int v, int w, in
|
||||||
// To avoid that we allow zero-area triangles if all else failed.
|
// To avoid that we allow zero-area triangles if all else failed.
|
||||||
float threshold = relaxed ? -CMP_EPSILON : CMP_EPSILON;
|
float threshold = relaxed ? -CMP_EPSILON : CMP_EPSILON;
|
||||||
|
|
||||||
if (threshold > (((Bx - Ax) * (Cy - Ay)) - ((By - Ay) * (Cx - Ax)))) return false;
|
if (threshold > (((Bx - Ax) * (Cy - Ay)) - ((By - Ay) * (Cx - Ax))))
|
||||||
|
return false;
|
||||||
|
|
||||||
for (p = 0; p < n; p++) {
|
for (p = 0; p < n; p++) {
|
||||||
if ((p == u) || (p == v) || (p == w)) continue;
|
if ((p == u) || (p == v) || (p == w))
|
||||||
|
continue;
|
||||||
Px = contour[V[p]].x;
|
Px = contour[V[p]].x;
|
||||||
Py = contour[V[p]].y;
|
Py = contour[V[p]].y;
|
||||||
if (is_inside_triangle(Ax, Ay, Bx, By, Cx, Cy, Px, Py, relaxed)) return false;
|
if (is_inside_triangle(Ax, Ay, Bx, By, Cx, Cy, Px, Py, relaxed))
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -119,7 +122,8 @@ bool Triangulate::triangulate(const Vector<Vector2> &contour, Vector<int> &resul
|
||||||
/* allocate and initialize list of Vertices in polygon */
|
/* allocate and initialize list of Vertices in polygon */
|
||||||
|
|
||||||
int n = contour.size();
|
int n = contour.size();
|
||||||
if (n < 3) return false;
|
if (n < 3)
|
||||||
|
return false;
|
||||||
|
|
||||||
Vector<int> V;
|
Vector<int> V;
|
||||||
V.resize(n);
|
V.resize(n);
|
||||||
|
@ -161,11 +165,14 @@ bool Triangulate::triangulate(const Vector<Vector2> &contour, Vector<int> &resul
|
||||||
|
|
||||||
/* three consecutive vertices in current polygon, <u,v,w> */
|
/* three consecutive vertices in current polygon, <u,v,w> */
|
||||||
int u = v;
|
int u = v;
|
||||||
if (nv <= u) u = 0; /* previous */
|
if (nv <= u)
|
||||||
|
u = 0; /* previous */
|
||||||
v = u + 1;
|
v = u + 1;
|
||||||
if (nv <= v) v = 0; /* new v */
|
if (nv <= v)
|
||||||
|
v = 0; /* new v */
|
||||||
int w = v + 1;
|
int w = v + 1;
|
||||||
if (nv <= w) w = 0; /* next */
|
if (nv <= w)
|
||||||
|
w = 0; /* next */
|
||||||
|
|
||||||
if (snip(contour, u, v, w, nv, V, relaxed)) {
|
if (snip(contour, u, v, w, nv, V, relaxed)) {
|
||||||
int a, b, c, s, t;
|
int a, b, c, s, t;
|
||||||
|
|
|
@ -165,7 +165,8 @@ struct VariantObjectClassChecker<Control *> {
|
||||||
#define CHECK_NOARG(m_arg) \
|
#define CHECK_NOARG(m_arg) \
|
||||||
{ \
|
{ \
|
||||||
if (p_arg##m_arg.get_type() != Variant::NIL) { \
|
if (p_arg##m_arg.get_type() != Variant::NIL) { \
|
||||||
if (r_argerror) *r_argerror = (m_arg - 1); \
|
if (r_argerror) \
|
||||||
|
*r_argerror = (m_arg - 1); \
|
||||||
return CALL_ERROR_EXTRA_ARGUMENT; \
|
return CALL_ERROR_EXTRA_ARGUMENT; \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
|
@ -373,7 +373,8 @@ NodePath::NodePath(const String &p_path) {
|
||||||
|
|
||||||
String str = path.substr(from, i - from);
|
String str = path.substr(from, i - from);
|
||||||
if (str == "") {
|
if (str == "") {
|
||||||
if (path[i] == 0) continue; // Allow end-of-path :
|
if (path[i] == 0)
|
||||||
|
continue; // Allow end-of-path :
|
||||||
|
|
||||||
ERR_FAIL_MSG("Invalid NodePath '" + p_path + "'.");
|
ERR_FAIL_MSG("Invalid NodePath '" + p_path + "'.");
|
||||||
}
|
}
|
||||||
|
|
|
@ -561,7 +561,8 @@ void Object::set_indexed(const Vector<StringName> &p_names, const Variant &p_val
|
||||||
}
|
}
|
||||||
|
|
||||||
bool valid = false;
|
bool valid = false;
|
||||||
if (!r_valid) r_valid = &valid;
|
if (!r_valid)
|
||||||
|
r_valid = &valid;
|
||||||
|
|
||||||
List<Variant> value_stack;
|
List<Variant> value_stack;
|
||||||
|
|
||||||
|
|
|
@ -350,7 +350,8 @@ protected:
|
||||||
return (bool (Object::*)(const StringName &, const Variant &)) & m_class::_set; \
|
return (bool (Object::*)(const StringName &, const Variant &)) & m_class::_set; \
|
||||||
} \
|
} \
|
||||||
virtual bool _setv(const StringName &p_name, const Variant &p_property) { \
|
virtual bool _setv(const StringName &p_name, const Variant &p_property) { \
|
||||||
if (m_inherits::_setv(p_name, p_property)) return true; \
|
if (m_inherits::_setv(p_name, p_property)) \
|
||||||
|
return true; \
|
||||||
if (m_class::_get_set() != m_inherits::_get_set()) { \
|
if (m_class::_get_set() != m_inherits::_get_set()) { \
|
||||||
return _set(p_name, p_property); \
|
return _set(p_name, p_property); \
|
||||||
} \
|
} \
|
||||||
|
|
|
@ -146,7 +146,8 @@ struct DirAccessRef {
|
||||||
DirAccess *f;
|
DirAccess *f;
|
||||||
DirAccessRef(DirAccess *fa) { f = fa; }
|
DirAccessRef(DirAccess *fa) { f = fa; }
|
||||||
~DirAccessRef() {
|
~DirAccessRef() {
|
||||||
if (f) memdelete(f);
|
if (f)
|
||||||
|
memdelete(f);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -192,7 +192,8 @@ struct FileAccessRef {
|
||||||
operator FileAccess *() { return f; }
|
operator FileAccess *() { return f; }
|
||||||
FileAccessRef(FileAccess *fa) { f = fa; }
|
FileAccessRef(FileAccess *fa) { f = fa; }
|
||||||
~FileAccessRef() {
|
~FileAccessRef() {
|
||||||
if (f) memdelete(f);
|
if (f)
|
||||||
|
memdelete(f);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -130,9 +130,10 @@ void memdelete_allocator(T *p_class) {
|
||||||
A::free(p_class);
|
A::free(p_class);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define memdelete_notnull(m_v) \
|
#define memdelete_notnull(m_v) \
|
||||||
{ \
|
{ \
|
||||||
if (m_v) memdelete(m_v); \
|
if (m_v) \
|
||||||
|
memdelete(m_v); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define memnew_arr(m_class, m_count) memnew_arr_template<m_class>(m_count)
|
#define memnew_arr(m_class, m_count) memnew_arr_template<m_class>(m_count)
|
||||||
|
|
|
@ -388,7 +388,8 @@ Error OS::dialog_show(String p_title, String p_description, Vector<String> p_but
|
||||||
|
|
||||||
print("%ls\n--------\n%ls\n", p_title.c_str(), p_description.c_str());
|
print("%ls\n--------\n%ls\n", p_title.c_str(), p_description.c_str());
|
||||||
for (int i = 0; i < p_buttons.size(); i++) {
|
for (int i = 0; i < p_buttons.size(); i++) {
|
||||||
if (i > 0) print(", ");
|
if (i > 0)
|
||||||
|
print(", ");
|
||||||
print("%i=%ls", i + 1, p_buttons[i].c_str());
|
print("%i=%ls", i + 1, p_buttons[i].c_str());
|
||||||
};
|
};
|
||||||
print("\n");
|
print("\n");
|
||||||
|
@ -696,7 +697,8 @@ bool OS::has_feature(const String &p_feature) {
|
||||||
|
|
||||||
void OS::center_window() {
|
void OS::center_window() {
|
||||||
|
|
||||||
if (is_window_fullscreen()) return;
|
if (is_window_fullscreen())
|
||||||
|
return;
|
||||||
|
|
||||||
Point2 sp = get_screen_position(get_current_screen());
|
Point2 sp = get_screen_position(get_current_screen());
|
||||||
Size2 scr = get_screen_size(get_current_screen());
|
Size2 scr = get_screen_size(get_current_screen());
|
||||||
|
|
|
@ -181,7 +181,8 @@ PoolAllocator::ID PoolAllocator::alloc(int p_size) {
|
||||||
|
|
||||||
ERR_FAIL_COND_V(p_size < 1, POOL_ALLOCATOR_INVALID_ID);
|
ERR_FAIL_COND_V(p_size < 1, POOL_ALLOCATOR_INVALID_ID);
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
if (p_size > free_mem) OS::get_singleton()->debug_break();
|
if (p_size > free_mem)
|
||||||
|
OS::get_singleton()->debug_break();
|
||||||
#endif
|
#endif
|
||||||
ERR_FAIL_COND_V(p_size > free_mem, POOL_ALLOCATOR_INVALID_ID);
|
ERR_FAIL_COND_V(p_size > free_mem, POOL_ALLOCATOR_INVALID_ID);
|
||||||
|
|
||||||
|
|
|
@ -121,7 +121,8 @@ private:
|
||||||
public:
|
public:
|
||||||
_FORCE_INLINE_ bool in_list() const { return _root; }
|
_FORCE_INLINE_ bool in_list() const { return _root; }
|
||||||
_FORCE_INLINE_ void remove_from_list() {
|
_FORCE_INLINE_ void remove_from_list() {
|
||||||
if (_root) _root->remove(this);
|
if (_root)
|
||||||
|
_root->remove(this);
|
||||||
}
|
}
|
||||||
_FORCE_INLINE_ SelfList<T> *next() { return _next; }
|
_FORCE_INLINE_ SelfList<T> *next() { return _next; }
|
||||||
_FORCE_INLINE_ SelfList<T> *prev() { return _prev; }
|
_FORCE_INLINE_ SelfList<T> *prev() { return _prev; }
|
||||||
|
|
|
@ -1002,7 +1002,8 @@ String TranslationServer::get_locale() const {
|
||||||
|
|
||||||
String TranslationServer::get_locale_name(const String &p_locale) const {
|
String TranslationServer::get_locale_name(const String &p_locale) const {
|
||||||
|
|
||||||
if (!locale_name_map.has(p_locale)) return String();
|
if (!locale_name_map.has(p_locale))
|
||||||
|
return String();
|
||||||
return locale_name_map[p_locale];
|
return locale_name_map[p_locale];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1955,7 +1955,8 @@ bool String::is_numeric() const {
|
||||||
};
|
};
|
||||||
|
|
||||||
int s = 0;
|
int s = 0;
|
||||||
if (operator[](0) == '-') ++s;
|
if (operator[](0) == '-')
|
||||||
|
++s;
|
||||||
bool dot = false;
|
bool dot = false;
|
||||||
for (int i = s; i < length(); i++) {
|
for (int i = s; i < length(); i++) {
|
||||||
|
|
||||||
|
|
|
@ -441,7 +441,8 @@ public:
|
||||||
Variant(const Variant &p_variant);
|
Variant(const Variant &p_variant);
|
||||||
_FORCE_INLINE_ Variant() { type = NIL; }
|
_FORCE_INLINE_ Variant() { type = NIL; }
|
||||||
_FORCE_INLINE_ ~Variant() {
|
_FORCE_INLINE_ ~Variant() {
|
||||||
if (type != Variant::NIL) clear();
|
if (type != Variant::NIL)
|
||||||
|
clear();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -166,21 +166,26 @@ bool Variant::booleanize() const {
|
||||||
return; \
|
return; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DEFAULT_OP_NUM(m_prefix, m_op_name, m_name, m_op, m_type) \
|
#define DEFAULT_OP_NUM(m_prefix, m_op_name, m_name, m_op, m_type) \
|
||||||
CASE_TYPE(m_prefix, m_op_name, m_name) { \
|
CASE_TYPE(m_prefix, m_op_name, m_name) { \
|
||||||
if (p_b.type == INT) _RETURN(p_a._data.m_type m_op p_b._data._int); \
|
if (p_b.type == INT) \
|
||||||
if (p_b.type == REAL) _RETURN(p_a._data.m_type m_op p_b._data._real); \
|
_RETURN(p_a._data.m_type m_op p_b._data._int); \
|
||||||
\
|
if (p_b.type == REAL) \
|
||||||
_RETURN_FAIL \
|
_RETURN(p_a._data.m_type m_op p_b._data._real); \
|
||||||
|
\
|
||||||
|
_RETURN_FAIL \
|
||||||
};
|
};
|
||||||
|
|
||||||
#define DEFAULT_OP_NUM_NULL(m_prefix, m_op_name, m_name, m_op, m_type) \
|
#define DEFAULT_OP_NUM_NULL(m_prefix, m_op_name, m_name, m_op, m_type) \
|
||||||
CASE_TYPE(m_prefix, m_op_name, m_name) { \
|
CASE_TYPE(m_prefix, m_op_name, m_name) { \
|
||||||
if (p_b.type == INT) _RETURN(p_a._data.m_type m_op p_b._data._int); \
|
if (p_b.type == INT) \
|
||||||
if (p_b.type == REAL) _RETURN(p_a._data.m_type m_op p_b._data._real); \
|
_RETURN(p_a._data.m_type m_op p_b._data._int); \
|
||||||
if (p_b.type == NIL) _RETURN(!(p_b.type m_op NIL)); \
|
if (p_b.type == REAL) \
|
||||||
\
|
_RETURN(p_a._data.m_type m_op p_b._data._real); \
|
||||||
_RETURN_FAIL \
|
if (p_b.type == NIL) \
|
||||||
|
_RETURN(!(p_b.type m_op NIL)); \
|
||||||
|
\
|
||||||
|
_RETURN_FAIL \
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
|
@ -204,12 +209,14 @@ bool Variant::booleanize() const {
|
||||||
_RETURN_FAIL \
|
_RETURN_FAIL \
|
||||||
};
|
};
|
||||||
#else
|
#else
|
||||||
#define DEFAULT_OP_NUM_DIV(m_prefix, m_op_name, m_name, m_type) \
|
#define DEFAULT_OP_NUM_DIV(m_prefix, m_op_name, m_name, m_type) \
|
||||||
CASE_TYPE(m_prefix, m_op_name, m_name) { \
|
CASE_TYPE(m_prefix, m_op_name, m_name) { \
|
||||||
if (p_b.type == INT) _RETURN(p_a._data.m_type / p_b._data._int); \
|
if (p_b.type == INT) \
|
||||||
if (p_b.type == REAL) _RETURN(p_a._data.m_type / p_b._data._real); \
|
_RETURN(p_a._data.m_type / p_b._data._int); \
|
||||||
\
|
if (p_b.type == REAL) \
|
||||||
_RETURN_FAIL \
|
_RETURN(p_a._data.m_type / p_b._data._real); \
|
||||||
|
\
|
||||||
|
_RETURN_FAIL \
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -223,39 +230,50 @@ bool Variant::booleanize() const {
|
||||||
_RETURN(p_a._data.m_type); \
|
_RETURN(p_a._data.m_type); \
|
||||||
};
|
};
|
||||||
|
|
||||||
#define DEFAULT_OP_NUM_VEC(m_prefix, m_op_name, m_name, m_op, m_type) \
|
#define DEFAULT_OP_NUM_VEC(m_prefix, m_op_name, m_name, m_op, m_type) \
|
||||||
CASE_TYPE(m_prefix, m_op_name, m_name) { \
|
CASE_TYPE(m_prefix, m_op_name, m_name) { \
|
||||||
if (p_b.type == INT) _RETURN(p_a._data.m_type m_op p_b._data._int); \
|
if (p_b.type == INT) \
|
||||||
if (p_b.type == REAL) _RETURN(p_a._data.m_type m_op p_b._data._real); \
|
_RETURN(p_a._data.m_type m_op p_b._data._int); \
|
||||||
if (p_b.type == VECTOR2) _RETURN(p_a._data.m_type m_op *reinterpret_cast<const Vector2 *>(p_b._data._mem)); \
|
if (p_b.type == REAL) \
|
||||||
if (p_b.type == VECTOR3) _RETURN(p_a._data.m_type m_op *reinterpret_cast<const Vector3 *>(p_b._data._mem)); \
|
_RETURN(p_a._data.m_type m_op p_b._data._real); \
|
||||||
\
|
if (p_b.type == VECTOR2) \
|
||||||
_RETURN_FAIL \
|
_RETURN(p_a._data.m_type m_op *reinterpret_cast<const Vector2 *>(p_b._data._mem)); \
|
||||||
|
if (p_b.type == VECTOR3) \
|
||||||
|
_RETURN(p_a._data.m_type m_op *reinterpret_cast<const Vector3 *>(p_b._data._mem)); \
|
||||||
|
\
|
||||||
|
_RETURN_FAIL \
|
||||||
};
|
};
|
||||||
|
|
||||||
#define DEFAULT_OP_STR_REV(m_prefix, m_op_name, m_name, m_op, m_type) \
|
#define DEFAULT_OP_STR_REV(m_prefix, m_op_name, m_name, m_op, m_type) \
|
||||||
CASE_TYPE(m_prefix, m_op_name, m_name) { \
|
CASE_TYPE(m_prefix, m_op_name, m_name) { \
|
||||||
if (p_b.type == STRING) _RETURN(*reinterpret_cast<const m_type *>(p_b._data._mem) m_op *reinterpret_cast<const String *>(p_a._data._mem)); \
|
if (p_b.type == STRING) \
|
||||||
if (p_b.type == NODE_PATH) _RETURN(*reinterpret_cast<const m_type *>(p_b._data._mem) m_op *reinterpret_cast<const NodePath *>(p_a._data._mem)); \
|
_RETURN(*reinterpret_cast<const m_type *>(p_b._data._mem) m_op *reinterpret_cast<const String *>(p_a._data._mem)); \
|
||||||
\
|
if (p_b.type == NODE_PATH) \
|
||||||
_RETURN_FAIL \
|
_RETURN(*reinterpret_cast<const m_type *>(p_b._data._mem) m_op *reinterpret_cast<const NodePath *>(p_a._data._mem)); \
|
||||||
|
\
|
||||||
|
_RETURN_FAIL \
|
||||||
};
|
};
|
||||||
|
|
||||||
#define DEFAULT_OP_STR(m_prefix, m_op_name, m_name, m_op, m_type) \
|
#define DEFAULT_OP_STR(m_prefix, m_op_name, m_name, m_op, m_type) \
|
||||||
CASE_TYPE(m_prefix, m_op_name, m_name) { \
|
CASE_TYPE(m_prefix, m_op_name, m_name) { \
|
||||||
if (p_b.type == STRING) _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const String *>(p_b._data._mem)); \
|
if (p_b.type == STRING) \
|
||||||
if (p_b.type == NODE_PATH) _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const NodePath *>(p_b._data._mem)); \
|
_RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const String *>(p_b._data._mem)); \
|
||||||
\
|
if (p_b.type == NODE_PATH) \
|
||||||
_RETURN_FAIL \
|
_RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const NodePath *>(p_b._data._mem)); \
|
||||||
|
\
|
||||||
|
_RETURN_FAIL \
|
||||||
};
|
};
|
||||||
|
|
||||||
#define DEFAULT_OP_STR_NULL(m_prefix, m_op_name, m_name, m_op, m_type) \
|
#define DEFAULT_OP_STR_NULL(m_prefix, m_op_name, m_name, m_op, m_type) \
|
||||||
CASE_TYPE(m_prefix, m_op_name, m_name) { \
|
CASE_TYPE(m_prefix, m_op_name, m_name) { \
|
||||||
if (p_b.type == STRING) _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const String *>(p_b._data._mem)); \
|
if (p_b.type == STRING) \
|
||||||
if (p_b.type == NODE_PATH) _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const NodePath *>(p_b._data._mem)); \
|
_RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const String *>(p_b._data._mem)); \
|
||||||
if (p_b.type == NIL) _RETURN(!(p_b.type m_op NIL)); \
|
if (p_b.type == NODE_PATH) \
|
||||||
\
|
_RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const NodePath *>(p_b._data._mem)); \
|
||||||
_RETURN_FAIL \
|
if (p_b.type == NIL) \
|
||||||
|
_RETURN(!(p_b.type m_op NIL)); \
|
||||||
|
\
|
||||||
|
_RETURN_FAIL \
|
||||||
};
|
};
|
||||||
|
|
||||||
#define DEFAULT_OP_LOCALMEM_REV(m_prefix, m_op_name, m_name, m_op, m_type) \
|
#define DEFAULT_OP_LOCALMEM_REV(m_prefix, m_op_name, m_name, m_op, m_type) \
|
||||||
|
@ -294,13 +312,16 @@ bool Variant::booleanize() const {
|
||||||
_RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem)); \
|
_RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem)); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DEFAULT_OP_LOCALMEM_NUM(m_prefix, m_op_name, m_name, m_op, m_type) \
|
#define DEFAULT_OP_LOCALMEM_NUM(m_prefix, m_op_name, m_name, m_op, m_type) \
|
||||||
CASE_TYPE(m_prefix, m_op_name, m_name) { \
|
CASE_TYPE(m_prefix, m_op_name, m_name) { \
|
||||||
if (p_b.type == m_name) _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const m_type *>(p_b._data._mem)); \
|
if (p_b.type == m_name) \
|
||||||
if (p_b.type == INT) _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op p_b._data._int); \
|
_RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const m_type *>(p_b._data._mem)); \
|
||||||
if (p_b.type == REAL) _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op p_b._data._real); \
|
if (p_b.type == INT) \
|
||||||
\
|
_RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op p_b._data._int); \
|
||||||
_RETURN_FAIL \
|
if (p_b.type == REAL) \
|
||||||
|
_RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op p_b._data._real); \
|
||||||
|
\
|
||||||
|
_RETURN_FAIL \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DEFAULT_OP_PTR(m_op, m_name, m_sub) \
|
#define DEFAULT_OP_PTR(m_op, m_name, m_sub) \
|
||||||
|
@ -398,7 +419,8 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a,
|
||||||
SWITCH(math, p_op, p_a.type) {
|
SWITCH(math, p_op, p_a.type) {
|
||||||
SWITCH_OP(math, OP_EQUAL, p_a.type) {
|
SWITCH_OP(math, OP_EQUAL, p_a.type) {
|
||||||
CASE_TYPE(math, OP_EQUAL, NIL) {
|
CASE_TYPE(math, OP_EQUAL, NIL) {
|
||||||
if (p_b.type == NIL) _RETURN(true);
|
if (p_b.type == NIL)
|
||||||
|
_RETURN(true);
|
||||||
if (p_b.type == OBJECT)
|
if (p_b.type == OBJECT)
|
||||||
_RETURN(_UNSAFE_OBJ_PROXY_PTR(p_b) == NULL);
|
_RETURN(_UNSAFE_OBJ_PROXY_PTR(p_b) == NULL);
|
||||||
|
|
||||||
|
@ -485,7 +507,8 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a,
|
||||||
|
|
||||||
SWITCH_OP(math, OP_NOT_EQUAL, p_a.type) {
|
SWITCH_OP(math, OP_NOT_EQUAL, p_a.type) {
|
||||||
CASE_TYPE(math, OP_NOT_EQUAL, NIL) {
|
CASE_TYPE(math, OP_NOT_EQUAL, NIL) {
|
||||||
if (p_b.type == NIL) _RETURN(false);
|
if (p_b.type == NIL)
|
||||||
|
_RETURN(false);
|
||||||
if (p_b.type == OBJECT)
|
if (p_b.type == OBJECT)
|
||||||
_RETURN(_UNSAFE_OBJ_PROXY_PTR(p_b) != NULL);
|
_RETURN(_UNSAFE_OBJ_PROXY_PTR(p_b) != NULL);
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,8 @@ public:
|
||||||
void remove(int p_index) { _cowdata.remove(p_index); }
|
void remove(int p_index) { _cowdata.remove(p_index); }
|
||||||
void erase(const T &p_val) {
|
void erase(const T &p_val) {
|
||||||
int idx = find(p_val);
|
int idx = find(p_val);
|
||||||
if (idx >= 0) remove(idx);
|
if (idx >= 0)
|
||||||
|
remove(idx);
|
||||||
};
|
};
|
||||||
void invert();
|
void invert();
|
||||||
|
|
||||||
|
|
|
@ -1191,7 +1191,8 @@ float SchlickFresnel(float u) {
|
||||||
}
|
}
|
||||||
|
|
||||||
float GTR1(float NdotH, float a) {
|
float GTR1(float NdotH, float a) {
|
||||||
if (a >= 1.0) return 1.0 / M_PI;
|
if (a >= 1.0)
|
||||||
|
return 1.0 / M_PI;
|
||||||
float a2 = a * a;
|
float a2 = a * a;
|
||||||
float t = 1.0 + (a2 - 1.0) * NdotH * NdotH;
|
float t = 1.0 + (a2 - 1.0) * NdotH * NdotH;
|
||||||
return (a2 - 1.0) / (M_PI * log(a2) * t);
|
return (a2 - 1.0) / (M_PI * log(a2) * t);
|
||||||
|
|
|
@ -985,7 +985,8 @@ float SchlickFresnel(float u) {
|
||||||
}
|
}
|
||||||
|
|
||||||
float GTR1(float NdotH, float a) {
|
float GTR1(float NdotH, float a) {
|
||||||
if (a >= 1.0) return 1.0 / M_PI;
|
if (a >= 1.0)
|
||||||
|
return 1.0 / M_PI;
|
||||||
float a2 = a * a;
|
float a2 = a * a;
|
||||||
float t = 1.0 + (a2 - 1.0) * NdotH * NdotH;
|
float t = 1.0 + (a2 - 1.0) * NdotH * NdotH;
|
||||||
return (a2 - 1.0) / (M_PI * log(a2) * t);
|
return (a2 - 1.0) / (M_PI * log(a2) * t);
|
||||||
|
|
|
@ -248,7 +248,8 @@ void IP_Unix::get_local_interfaces(Map<String, Interface_Info> *r_interfaces) co
|
||||||
info.ip_addresses.push_front(_sockaddr2ip(ifa->ifa_addr));
|
info.ip_addresses.push_front(_sockaddr2ip(ifa->ifa_addr));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ifAddrStruct != NULL) freeifaddrs(ifAddrStruct);
|
if (ifAddrStruct != NULL)
|
||||||
|
freeifaddrs(ifAddrStruct);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -333,7 +333,8 @@ void FindReplaceBar::_update_results_count() {
|
||||||
results_count = 0;
|
results_count = 0;
|
||||||
|
|
||||||
String searched = get_search_text();
|
String searched = get_search_text();
|
||||||
if (searched.empty()) return;
|
if (searched.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
String full_text = text_edit->get_text();
|
String full_text = text_edit->get_text();
|
||||||
|
|
||||||
|
@ -341,7 +342,8 @@ void FindReplaceBar::_update_results_count() {
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
int pos = is_case_sensitive() ? full_text.find(searched, from_pos) : full_text.findn(searched, from_pos);
|
int pos = is_case_sensitive() ? full_text.find(searched, from_pos) : full_text.findn(searched, from_pos);
|
||||||
if (pos == -1) break;
|
if (pos == -1)
|
||||||
|
break;
|
||||||
|
|
||||||
int pos_subsequent = pos + searched.length();
|
int pos_subsequent = pos + searched.length();
|
||||||
if (is_whole_words()) {
|
if (is_whole_words()) {
|
||||||
|
|
|
@ -700,7 +700,8 @@ bool EditorFileDialog::_is_open_should_be_disabled() {
|
||||||
void EditorFileDialog::update_file_name() {
|
void EditorFileDialog::update_file_name() {
|
||||||
int idx = filter->get_selected() - 1;
|
int idx = filter->get_selected() - 1;
|
||||||
if ((idx == -1 && filter->get_item_count() == 2) || (filter->get_item_count() > 2 && idx >= 0 && idx < filter->get_item_count() - 2)) {
|
if ((idx == -1 && filter->get_item_count() == 2) || (filter->get_item_count() > 2 && idx >= 0 && idx < filter->get_item_count() - 2)) {
|
||||||
if (idx == -1) idx += 1;
|
if (idx == -1)
|
||||||
|
idx += 1;
|
||||||
String filter_str = filters[idx];
|
String filter_str = filters[idx];
|
||||||
String file_str = file->get_text();
|
String file_str = file->get_text();
|
||||||
String base_name = file_str.get_basename();
|
String base_name = file_str.get_basename();
|
||||||
|
|
|
@ -1786,7 +1786,8 @@ void FindBar::_update_results_count() {
|
||||||
results_count = 0;
|
results_count = 0;
|
||||||
|
|
||||||
String searched = search_text->get_text();
|
String searched = search_text->get_text();
|
||||||
if (searched.empty()) return;
|
if (searched.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
String full_text = rich_text_label->get_text();
|
String full_text = rich_text_label->get_text();
|
||||||
|
|
||||||
|
|
|
@ -3063,12 +3063,18 @@ void EditorNode::_update_debug_options() {
|
||||||
bool check_live_debug = EditorSettings::get_singleton()->get_project_metadata("debug_options", "run_live_debug", true);
|
bool check_live_debug = EditorSettings::get_singleton()->get_project_metadata("debug_options", "run_live_debug", true);
|
||||||
bool check_reload_scripts = EditorSettings::get_singleton()->get_project_metadata("debug_options", "run_reload_scripts", true);
|
bool check_reload_scripts = EditorSettings::get_singleton()->get_project_metadata("debug_options", "run_reload_scripts", true);
|
||||||
|
|
||||||
if (check_deploy_remote) _menu_option_confirm(RUN_DEPLOY_REMOTE_DEBUG, true);
|
if (check_deploy_remote)
|
||||||
if (check_file_server) _menu_option_confirm(RUN_FILE_SERVER, true);
|
_menu_option_confirm(RUN_DEPLOY_REMOTE_DEBUG, true);
|
||||||
if (check_debug_collisons) _menu_option_confirm(RUN_DEBUG_COLLISONS, true);
|
if (check_file_server)
|
||||||
if (check_debug_navigation) _menu_option_confirm(RUN_DEBUG_NAVIGATION, true);
|
_menu_option_confirm(RUN_FILE_SERVER, true);
|
||||||
if (check_live_debug) _menu_option_confirm(RUN_LIVE_DEBUG, true);
|
if (check_debug_collisons)
|
||||||
if (check_reload_scripts) _menu_option_confirm(RUN_RELOAD_SCRIPTS, true);
|
_menu_option_confirm(RUN_DEBUG_COLLISONS, true);
|
||||||
|
if (check_debug_navigation)
|
||||||
|
_menu_option_confirm(RUN_DEBUG_NAVIGATION, true);
|
||||||
|
if (check_live_debug)
|
||||||
|
_menu_option_confirm(RUN_LIVE_DEBUG, true);
|
||||||
|
if (check_reload_scripts)
|
||||||
|
_menu_option_confirm(RUN_RELOAD_SCRIPTS, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorNode::_update_file_menu_opened() {
|
void EditorNode::_update_file_menu_opened() {
|
||||||
|
@ -3342,7 +3348,8 @@ void EditorNode::_remove_edited_scene(bool p_change_tab) {
|
||||||
ScriptEditor::get_singleton()->close_builtin_scripts_from_scene(editor_data.get_scene_path(old_index));
|
ScriptEditor::get_singleton()->close_builtin_scripts_from_scene(editor_data.get_scene_path(old_index));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p_change_tab) _scene_tab_changed(new_index);
|
if (p_change_tab)
|
||||||
|
_scene_tab_changed(new_index);
|
||||||
editor_data.remove_scene(old_index);
|
editor_data.remove_scene(old_index);
|
||||||
editor_data.get_undo_redo().clear_history(false);
|
editor_data.get_undo_redo().clear_history(false);
|
||||||
_update_title();
|
_update_title();
|
||||||
|
|
|
@ -1682,20 +1682,28 @@ bool CanvasItemEditor::_gui_input_anchors(const Ref<InputEvent> &p_event) {
|
||||||
|
|
||||||
switch (drag_type) {
|
switch (drag_type) {
|
||||||
case DRAG_ANCHOR_TOP_LEFT:
|
case DRAG_ANCHOR_TOP_LEFT:
|
||||||
if (!use_single_axis || !use_y) control->set_anchor(MARGIN_LEFT, new_anchor.x, false, false);
|
if (!use_single_axis || !use_y)
|
||||||
if (!use_single_axis || use_y) control->set_anchor(MARGIN_TOP, new_anchor.y, false, false);
|
control->set_anchor(MARGIN_LEFT, new_anchor.x, false, false);
|
||||||
|
if (!use_single_axis || use_y)
|
||||||
|
control->set_anchor(MARGIN_TOP, new_anchor.y, false, false);
|
||||||
break;
|
break;
|
||||||
case DRAG_ANCHOR_TOP_RIGHT:
|
case DRAG_ANCHOR_TOP_RIGHT:
|
||||||
if (!use_single_axis || !use_y) control->set_anchor(MARGIN_RIGHT, new_anchor.x, false, false);
|
if (!use_single_axis || !use_y)
|
||||||
if (!use_single_axis || use_y) control->set_anchor(MARGIN_TOP, new_anchor.y, false, false);
|
control->set_anchor(MARGIN_RIGHT, new_anchor.x, false, false);
|
||||||
|
if (!use_single_axis || use_y)
|
||||||
|
control->set_anchor(MARGIN_TOP, new_anchor.y, false, false);
|
||||||
break;
|
break;
|
||||||
case DRAG_ANCHOR_BOTTOM_RIGHT:
|
case DRAG_ANCHOR_BOTTOM_RIGHT:
|
||||||
if (!use_single_axis || !use_y) control->set_anchor(MARGIN_RIGHT, new_anchor.x, false, false);
|
if (!use_single_axis || !use_y)
|
||||||
if (!use_single_axis || use_y) control->set_anchor(MARGIN_BOTTOM, new_anchor.y, false, false);
|
control->set_anchor(MARGIN_RIGHT, new_anchor.x, false, false);
|
||||||
|
if (!use_single_axis || use_y)
|
||||||
|
control->set_anchor(MARGIN_BOTTOM, new_anchor.y, false, false);
|
||||||
break;
|
break;
|
||||||
case DRAG_ANCHOR_BOTTOM_LEFT:
|
case DRAG_ANCHOR_BOTTOM_LEFT:
|
||||||
if (!use_single_axis || !use_y) control->set_anchor(MARGIN_LEFT, new_anchor.x, false, false);
|
if (!use_single_axis || !use_y)
|
||||||
if (!use_single_axis || use_y) control->set_anchor(MARGIN_BOTTOM, new_anchor.y, false, false);
|
control->set_anchor(MARGIN_LEFT, new_anchor.x, false, false);
|
||||||
|
if (!use_single_axis || use_y)
|
||||||
|
control->set_anchor(MARGIN_BOTTOM, new_anchor.y, false, false);
|
||||||
break;
|
break;
|
||||||
case DRAG_ANCHOR_ALL:
|
case DRAG_ANCHOR_ALL:
|
||||||
if (!use_single_axis || !use_y) {
|
if (!use_single_axis || !use_y) {
|
||||||
|
@ -5139,7 +5147,8 @@ void CanvasItemEditor::_focus_selection(int p_op) {
|
||||||
Map<Node *, Object *> &selection = editor_selection->get_selection();
|
Map<Node *, Object *> &selection = editor_selection->get_selection();
|
||||||
for (Map<Node *, Object *>::Element *E = selection.front(); E; E = E->next()) {
|
for (Map<Node *, Object *>::Element *E = selection.front(); E; E = E->next()) {
|
||||||
CanvasItem *canvas_item = Object::cast_to<CanvasItem>(E->key());
|
CanvasItem *canvas_item = Object::cast_to<CanvasItem>(E->key());
|
||||||
if (!canvas_item) continue;
|
if (!canvas_item)
|
||||||
|
continue;
|
||||||
if (canvas_item->get_viewport() != EditorNode::get_singleton()->get_scene_root())
|
if (canvas_item->get_viewport() != EditorNode::get_singleton()->get_scene_root())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
|
@ -288,8 +288,10 @@ bool Path2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
Vector2 gpoint = mm->get_position();
|
Vector2 gpoint = mm->get_position();
|
||||||
|
|
||||||
Ref<Curve2D> curve = node->get_curve();
|
Ref<Curve2D> curve = node->get_curve();
|
||||||
if (curve == NULL) return true;
|
if (curve == NULL)
|
||||||
if (curve->get_point_count() < 2) return true;
|
return true;
|
||||||
|
if (curve->get_point_count() < 2)
|
||||||
|
return true;
|
||||||
|
|
||||||
// Find edge
|
// Find edge
|
||||||
edge_point = xform.xform(curve->get_closest_point(xform.affine_inverse().xform(mm->get_position())));
|
edge_point = xform.xform(curve->get_closest_point(xform.affine_inverse().xform(mm->get_position())));
|
||||||
|
|
|
@ -635,7 +635,8 @@ Ref<EditorSpatialGizmo> PathSpatialGizmoPlugin::create_gizmo(Spatial *p_spatial)
|
||||||
Ref<PathSpatialGizmo> ref;
|
Ref<PathSpatialGizmo> ref;
|
||||||
|
|
||||||
Path *path = Object::cast_to<Path>(p_spatial);
|
Path *path = Object::cast_to<Path>(p_spatial);
|
||||||
if (path) ref = Ref<PathSpatialGizmo>(memnew(PathSpatialGizmo(path)));
|
if (path)
|
||||||
|
ref = Ref<PathSpatialGizmo>(memnew(PathSpatialGizmo(path)));
|
||||||
|
|
||||||
return ref;
|
return ref;
|
||||||
}
|
}
|
||||||
|
|
|
@ -818,7 +818,8 @@ void ScriptTextEditor::_code_complete_scripts(void *p_ud, const String &p_code,
|
||||||
|
|
||||||
void ScriptTextEditor::_code_complete_script(const String &p_code, List<ScriptCodeCompletionOption> *r_options, bool &r_force) {
|
void ScriptTextEditor::_code_complete_script(const String &p_code, List<ScriptCodeCompletionOption> *r_options, bool &r_force) {
|
||||||
|
|
||||||
if (color_panel->is_visible_in_tree()) return;
|
if (color_panel->is_visible_in_tree())
|
||||||
|
return;
|
||||||
Node *base = get_tree()->get_edited_scene_root();
|
Node *base = get_tree()->get_edited_scene_root();
|
||||||
if (base) {
|
if (base) {
|
||||||
base = _find_node_for_script(base, base, script);
|
base = _find_node_for_script(base, base, script);
|
||||||
|
|
|
@ -708,9 +708,11 @@ void SpatialEditorViewport::_select_region() {
|
||||||
item = sel;
|
item = sel;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selected.find(item) != -1) continue;
|
if (selected.find(item) != -1)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (_is_node_locked(item)) continue;
|
if (_is_node_locked(item))
|
||||||
|
continue;
|
||||||
|
|
||||||
Ref<EditorSpatialGizmo> seg = sp->get_gizmo();
|
Ref<EditorSpatialGizmo> seg = sp->get_gizmo();
|
||||||
|
|
||||||
|
@ -1349,7 +1351,8 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
|
||||||
|
|
||||||
if (cursor.region_select) {
|
if (cursor.region_select) {
|
||||||
|
|
||||||
if (!clicked_wants_append) _clear_selected();
|
if (!clicked_wants_append)
|
||||||
|
_clear_selected();
|
||||||
|
|
||||||
_select_region();
|
_select_region();
|
||||||
cursor.region_select = false;
|
cursor.region_select = false;
|
||||||
|
@ -2042,7 +2045,8 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (k->get_scancode() == KEY_SPACE) {
|
if (k->get_scancode() == KEY_SPACE) {
|
||||||
if (!k->is_pressed()) emit_signal("toggle_maximize_view", this);
|
if (!k->is_pressed())
|
||||||
|
emit_signal("toggle_maximize_view", this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4616,7 +4620,8 @@ Dictionary SpatialEditor::get_state() const {
|
||||||
|
|
||||||
Dictionary gizmos_status;
|
Dictionary gizmos_status;
|
||||||
for (int i = 0; i < gizmo_plugins_by_name.size(); i++) {
|
for (int i = 0; i < gizmo_plugins_by_name.size(); i++) {
|
||||||
if (!gizmo_plugins_by_name[i]->can_be_hidden()) continue;
|
if (!gizmo_plugins_by_name[i]->can_be_hidden())
|
||||||
|
continue;
|
||||||
int state = gizmos_menu->get_item_state(gizmos_menu->get_item_index(i));
|
int state = gizmos_menu->get_item_state(gizmos_menu->get_item_index(i));
|
||||||
String name = gizmo_plugins_by_name[i]->get_name();
|
String name = gizmo_plugins_by_name[i]->get_name();
|
||||||
gizmos_status[name] = state;
|
gizmos_status[name] = state;
|
||||||
|
@ -4710,7 +4715,8 @@ void SpatialEditor::set_state(const Dictionary &p_state) {
|
||||||
gizmos_status.get_key_list(&keys);
|
gizmos_status.get_key_list(&keys);
|
||||||
|
|
||||||
for (int j = 0; j < gizmo_plugins_by_name.size(); ++j) {
|
for (int j = 0; j < gizmo_plugins_by_name.size(); ++j) {
|
||||||
if (!gizmo_plugins_by_name[j]->can_be_hidden()) continue;
|
if (!gizmo_plugins_by_name[j]->can_be_hidden())
|
||||||
|
continue;
|
||||||
int state = EditorSpatialGizmoPlugin::VISIBLE;
|
int state = EditorSpatialGizmoPlugin::VISIBLE;
|
||||||
for (int i = 0; i < keys.size(); i++) {
|
for (int i = 0; i < keys.size(); i++) {
|
||||||
if (gizmo_plugins_by_name.write[j]->get_name() == keys[i]) {
|
if (gizmo_plugins_by_name.write[j]->get_name() == keys[i]) {
|
||||||
|
@ -5612,7 +5618,8 @@ void SpatialEditor::_update_gizmos_menu() {
|
||||||
gizmos_menu->clear();
|
gizmos_menu->clear();
|
||||||
|
|
||||||
for (int i = 0; i < gizmo_plugins_by_name.size(); ++i) {
|
for (int i = 0; i < gizmo_plugins_by_name.size(); ++i) {
|
||||||
if (!gizmo_plugins_by_name[i]->can_be_hidden()) continue;
|
if (!gizmo_plugins_by_name[i]->can_be_hidden())
|
||||||
|
continue;
|
||||||
String plugin_name = gizmo_plugins_by_name[i]->get_name();
|
String plugin_name = gizmo_plugins_by_name[i]->get_name();
|
||||||
const int plugin_state = gizmo_plugins_by_name[i]->get_state();
|
const int plugin_state = gizmo_plugins_by_name[i]->get_state();
|
||||||
gizmos_menu->add_multistate_item(TTR(plugin_name), 3, plugin_state, i);
|
gizmos_menu->add_multistate_item(TTR(plugin_name), 3, plugin_state, i);
|
||||||
|
@ -5636,7 +5643,8 @@ void SpatialEditor::_update_gizmos_menu() {
|
||||||
|
|
||||||
void SpatialEditor::_update_gizmos_menu_theme() {
|
void SpatialEditor::_update_gizmos_menu_theme() {
|
||||||
for (int i = 0; i < gizmo_plugins_by_name.size(); ++i) {
|
for (int i = 0; i < gizmo_plugins_by_name.size(); ++i) {
|
||||||
if (!gizmo_plugins_by_name[i]->can_be_hidden()) continue;
|
if (!gizmo_plugins_by_name[i]->can_be_hidden())
|
||||||
|
continue;
|
||||||
const int plugin_state = gizmo_plugins_by_name[i]->get_state();
|
const int plugin_state = gizmo_plugins_by_name[i]->get_state();
|
||||||
const int idx = gizmos_menu->get_item_index(i);
|
const int idx = gizmos_menu->get_item_index(i);
|
||||||
switch (plugin_state) {
|
switch (plugin_state) {
|
||||||
|
@ -6163,9 +6171,11 @@ void SpatialEditor::_request_gizmo(Object *p_obj) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpatialEditor::_toggle_maximize_view(Object *p_viewport) {
|
void SpatialEditor::_toggle_maximize_view(Object *p_viewport) {
|
||||||
if (!p_viewport) return;
|
if (!p_viewport)
|
||||||
|
return;
|
||||||
SpatialEditorViewport *current_viewport = Object::cast_to<SpatialEditorViewport>(p_viewport);
|
SpatialEditorViewport *current_viewport = Object::cast_to<SpatialEditorViewport>(p_viewport);
|
||||||
if (!current_viewport) return;
|
if (!current_viewport)
|
||||||
|
return;
|
||||||
|
|
||||||
int index = -1;
|
int index = -1;
|
||||||
bool maximized = false;
|
bool maximized = false;
|
||||||
|
@ -6177,7 +6187,8 @@ void SpatialEditor::_toggle_maximize_view(Object *p_viewport) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (index == -1) return;
|
if (index == -1)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!maximized) {
|
if (!maximized) {
|
||||||
|
|
||||||
|
@ -6904,7 +6915,8 @@ Ref<SpatialMaterial> EditorSpatialGizmoPlugin::get_material(const String &p_name
|
||||||
ERR_FAIL_COND_V(!materials.has(p_name), Ref<SpatialMaterial>());
|
ERR_FAIL_COND_V(!materials.has(p_name), Ref<SpatialMaterial>());
|
||||||
ERR_FAIL_COND_V(materials[p_name].size() == 0, Ref<SpatialMaterial>());
|
ERR_FAIL_COND_V(materials[p_name].size() == 0, Ref<SpatialMaterial>());
|
||||||
|
|
||||||
if (p_gizmo.is_null() || materials[p_name].size() == 1) return materials[p_name][0];
|
if (p_gizmo.is_null() || materials[p_name].size() == 1)
|
||||||
|
return materials[p_name][0];
|
||||||
|
|
||||||
int index = (p_gizmo->is_selected() ? 1 : 0) + (p_gizmo->is_editable() ? 2 : 0);
|
int index = (p_gizmo->is_selected() ? 1 : 0) + (p_gizmo->is_editable() ? 2 : 0);
|
||||||
|
|
||||||
|
@ -6941,7 +6953,8 @@ Ref<EditorSpatialGizmo> EditorSpatialGizmoPlugin::get_gizmo(Spatial *p_spatial)
|
||||||
|
|
||||||
Ref<EditorSpatialGizmo> ref = create_gizmo(p_spatial);
|
Ref<EditorSpatialGizmo> ref = create_gizmo(p_spatial);
|
||||||
|
|
||||||
if (ref.is_null()) return ref;
|
if (ref.is_null())
|
||||||
|
return ref;
|
||||||
|
|
||||||
ref->set_plugin(this);
|
ref->set_plugin(this);
|
||||||
ref->set_spatial_node(p_spatial);
|
ref->set_spatial_node(p_spatial);
|
||||||
|
@ -7000,7 +7013,8 @@ Ref<EditorSpatialGizmo> EditorSpatialGizmoPlugin::create_gizmo(Spatial *p_spatia
|
||||||
}
|
}
|
||||||
|
|
||||||
Ref<EditorSpatialGizmo> ref;
|
Ref<EditorSpatialGizmo> ref;
|
||||||
if (has_gizmo(p_spatial)) ref.instance();
|
if (has_gizmo(p_spatial))
|
||||||
|
ref.instance();
|
||||||
return ref;
|
return ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -126,7 +126,8 @@ void TileSetEditor::_import_node(Node *p_node, Ref<TileSet> p_library) {
|
||||||
sb->get_shape_owners(&shapes);
|
sb->get_shape_owners(&shapes);
|
||||||
|
|
||||||
for (List<uint32_t>::Element *E = shapes.front(); E; E = E->next()) {
|
for (List<uint32_t>::Element *E = shapes.front(); E; E = E->next()) {
|
||||||
if (sb->is_shape_owner_disabled(E->get())) continue;
|
if (sb->is_shape_owner_disabled(E->get()))
|
||||||
|
continue;
|
||||||
|
|
||||||
Transform2D shape_transform = sb->get_transform() * sb->shape_owner_get_transform(E->get());
|
Transform2D shape_transform = sb->get_transform() * sb->shape_owner_get_transform(E->get());
|
||||||
bool one_way = sb->is_shape_owner_one_way_collision_enabled(E->get());
|
bool one_way = sb->is_shape_owner_one_way_collision_enabled(E->get());
|
||||||
|
|
|
@ -1266,11 +1266,13 @@ void VisualShaderEditor::_port_name_focus_out(Object *line_edit, int p_node_id,
|
||||||
List<String> output_names;
|
List<String> output_names;
|
||||||
|
|
||||||
for (int i = 0; i < node->get_input_port_count(); i++) {
|
for (int i = 0; i < node->get_input_port_count(); i++) {
|
||||||
if (!p_output && i == p_port_id) continue;
|
if (!p_output && i == p_port_id)
|
||||||
|
continue;
|
||||||
input_names.push_back(node->get_input_port_name(i));
|
input_names.push_back(node->get_input_port_name(i));
|
||||||
}
|
}
|
||||||
for (int i = 0; i < node->get_output_port_count(); i++) {
|
for (int i = 0; i < node->get_output_port_count(); i++) {
|
||||||
if (p_output && i == p_port_id) continue;
|
if (p_output && i == p_port_id)
|
||||||
|
continue;
|
||||||
output_names.push_back(node->get_output_port_name(i));
|
output_names.push_back(node->get_output_port_name(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -436,11 +436,13 @@ void ProjectSettingsEditor::_show_last_added(const Ref<InputEvent> &p_event, con
|
||||||
}
|
}
|
||||||
child = child->get_next();
|
child = child->get_next();
|
||||||
}
|
}
|
||||||
if (found) break;
|
if (found)
|
||||||
|
break;
|
||||||
r = r->get_next();
|
r = r->get_next();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (found) input_editor->ensure_cursor_is_visible();
|
if (found)
|
||||||
|
input_editor->ensure_cursor_is_visible();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectSettingsEditor::_wait_for_key(const Ref<InputEvent> &p_event) {
|
void ProjectSettingsEditor::_wait_for_key(const Ref<InputEvent> &p_event) {
|
||||||
|
@ -1551,7 +1553,8 @@ void ProjectSettingsEditor::_update_translations() {
|
||||||
String n = names[i];
|
String n = names[i];
|
||||||
String l = langs[i];
|
String l = langs[i];
|
||||||
bool is_checked = l_filter.has(l);
|
bool is_checked = l_filter.has(l);
|
||||||
if (filter_mode == SHOW_ONLY_SELECTED_LOCALES && !is_checked) continue;
|
if (filter_mode == SHOW_ONLY_SELECTED_LOCALES && !is_checked)
|
||||||
|
continue;
|
||||||
|
|
||||||
TreeItem *t = translation_filter->create_item(root);
|
TreeItem *t = translation_filter->create_item(root);
|
||||||
t->set_cell_mode(0, TreeItem::CELL_MODE_CHECK);
|
t->set_cell_mode(0, TreeItem::CELL_MODE_CHECK);
|
||||||
|
|
|
@ -613,8 +613,10 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
||||||
for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
|
for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
|
||||||
int index = E->get()->get_index();
|
int index = E->get()->get_index();
|
||||||
|
|
||||||
if (index > highest_id) highest_id = index;
|
if (index > highest_id)
|
||||||
if (index < lowest_id) lowest_id = index;
|
highest_id = index;
|
||||||
|
if (index < lowest_id)
|
||||||
|
lowest_id = index;
|
||||||
|
|
||||||
if (E->get()->get_parent() != common_parent)
|
if (E->get()->get_parent() != common_parent)
|
||||||
common_parent = NULL;
|
common_parent = NULL;
|
||||||
|
@ -623,8 +625,10 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
||||||
if (!common_parent || (MOVING_DOWN && highest_id >= common_parent->get_child_count() - MOVING_DOWN) || (MOVING_UP && lowest_id == 0))
|
if (!common_parent || (MOVING_DOWN && highest_id >= common_parent->get_child_count() - MOVING_DOWN) || (MOVING_UP && lowest_id == 0))
|
||||||
break; // one or more nodes can not be moved
|
break; // one or more nodes can not be moved
|
||||||
|
|
||||||
if (selection.size() == 1) editor_data->get_undo_redo().create_action(TTR("Move Node In Parent"));
|
if (selection.size() == 1)
|
||||||
if (selection.size() > 1) editor_data->get_undo_redo().create_action(TTR("Move Nodes In Parent"));
|
editor_data->get_undo_redo().create_action(TTR("Move Node In Parent"));
|
||||||
|
if (selection.size() > 1)
|
||||||
|
editor_data->get_undo_redo().create_action(TTR("Move Nodes In Parent"));
|
||||||
|
|
||||||
for (int i = 0; i < selection.size(); i++) {
|
for (int i = 0; i < selection.size(); i++) {
|
||||||
Node *top_node = selection[i];
|
Node *top_node = selection[i];
|
||||||
|
|
|
@ -165,11 +165,14 @@ String ScriptCreateDialog::_validate_path(const String &p_path, bool p_file_must
|
||||||
|
|
||||||
String p = p_path.strip_edges();
|
String p = p_path.strip_edges();
|
||||||
|
|
||||||
if (p == "") return TTR("Path is empty.");
|
if (p == "")
|
||||||
if (p.get_file().get_basename() == "") return TTR("Filename is empty.");
|
return TTR("Path is empty.");
|
||||||
|
if (p.get_file().get_basename() == "")
|
||||||
|
return TTR("Filename is empty.");
|
||||||
|
|
||||||
p = ProjectSettings::get_singleton()->localize_path(p);
|
p = ProjectSettings::get_singleton()->localize_path(p);
|
||||||
if (!p.begins_with("res://")) return TTR("Path is not local.");
|
if (!p.begins_with("res://"))
|
||||||
|
return TTR("Path is not local.");
|
||||||
|
|
||||||
DirAccess *d = DirAccess::create(DirAccess::ACCESS_RESOURCES);
|
DirAccess *d = DirAccess::create(DirAccess::ACCESS_RESOURCES);
|
||||||
if (d->change_dir(p.get_base_dir()) != OK) {
|
if (d->change_dir(p.get_base_dir()) != OK) {
|
||||||
|
@ -214,12 +217,15 @@ String ScriptCreateDialog::_validate_path(const String &p_path, bool p_file_must
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!found) return TTR("Invalid extension.");
|
if (!found)
|
||||||
if (!match) return TTR("Wrong extension chosen.");
|
return TTR("Invalid extension.");
|
||||||
|
if (!match)
|
||||||
|
return TTR("Wrong extension chosen.");
|
||||||
|
|
||||||
/* Let ScriptLanguage do custom validation */
|
/* Let ScriptLanguage do custom validation */
|
||||||
String path_error = ScriptServer::get_language(language_menu->get_selected())->validate_path(p);
|
String path_error = ScriptServer::get_language(language_menu->get_selected())->validate_path(p);
|
||||||
if (path_error != "") return path_error;
|
if (path_error != "")
|
||||||
|
return path_error;
|
||||||
|
|
||||||
/* All checks passed */
|
/* All checks passed */
|
||||||
return "";
|
return "";
|
||||||
|
|
|
@ -206,7 +206,8 @@ public:
|
||||||
|
|
||||||
void ScriptEditorDebugger::debug_copy() {
|
void ScriptEditorDebugger::debug_copy() {
|
||||||
String msg = reason->get_text();
|
String msg = reason->get_text();
|
||||||
if (msg == "") return;
|
if (msg == "")
|
||||||
|
return;
|
||||||
OS::get_singleton()->set_clipboard(msg);
|
OS::get_singleton()->set_clipboard(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -421,7 +421,8 @@ bool EditorSpatialGizmo::intersect_frustum(const Camera *p_camera, const Vector<
|
||||||
ERR_FAIL_COND_V(!spatial_node, false);
|
ERR_FAIL_COND_V(!spatial_node, false);
|
||||||
ERR_FAIL_COND_V(!valid, false);
|
ERR_FAIL_COND_V(!valid, false);
|
||||||
|
|
||||||
if (hidden && !gizmo_plugin->is_selectable_when_hidden()) return false;
|
if (hidden && !gizmo_plugin->is_selectable_when_hidden())
|
||||||
|
return false;
|
||||||
|
|
||||||
if (selectable_icon_size > 0.0f) {
|
if (selectable_icon_size > 0.0f) {
|
||||||
Vector3 origin = spatial_node->get_global_transform().get_origin();
|
Vector3 origin = spatial_node->get_global_transform().get_origin();
|
||||||
|
@ -460,10 +461,12 @@ bool EditorSpatialGizmo::intersect_frustum(const Camera *p_camera, const Vector<
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (any_out) break;
|
if (any_out)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!any_out) return true;
|
if (!any_out)
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (collision_mesh.is_valid()) {
|
if (collision_mesh.is_valid()) {
|
||||||
|
@ -495,7 +498,8 @@ bool EditorSpatialGizmo::intersect_ray(Camera *p_camera, const Point2 &p_point,
|
||||||
ERR_FAIL_COND_V(!spatial_node, false);
|
ERR_FAIL_COND_V(!spatial_node, false);
|
||||||
ERR_FAIL_COND_V(!valid, false);
|
ERR_FAIL_COND_V(!valid, false);
|
||||||
|
|
||||||
if (hidden && !gizmo_plugin->is_selectable_when_hidden()) return false;
|
if (hidden && !gizmo_plugin->is_selectable_when_hidden())
|
||||||
|
return false;
|
||||||
|
|
||||||
if (r_gizmo_handle && !hidden) {
|
if (r_gizmo_handle && !hidden) {
|
||||||
|
|
||||||
|
@ -776,7 +780,8 @@ EditorSpatialGizmo::EditorSpatialGizmo() {
|
||||||
|
|
||||||
EditorSpatialGizmo::~EditorSpatialGizmo() {
|
EditorSpatialGizmo::~EditorSpatialGizmo() {
|
||||||
|
|
||||||
if (gizmo_plugin != NULL) gizmo_plugin->unregister_gizmo(this);
|
if (gizmo_plugin != NULL)
|
||||||
|
gizmo_plugin->unregister_gizmo(this);
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -173,7 +173,8 @@ bool test_add_remove() {
|
||||||
for (int i = 0; i < 20000; i++) {
|
for (int i = 0; i < 20000; i++) {
|
||||||
int u = Math::rand() % 5;
|
int u = Math::rand() % 5;
|
||||||
int v = Math::rand() % 4;
|
int v = Math::rand() % 4;
|
||||||
if (u == v) v = 4;
|
if (u == v)
|
||||||
|
v = 4;
|
||||||
if (Math::rand() % 2 == 1) {
|
if (Math::rand() % 2 == 1) {
|
||||||
// Add a (possibly existing) directed edge and confirm connectivity
|
// Add a (possibly existing) directed edge and confirm connectivity
|
||||||
a.connect_points(u, v, false);
|
a.connect_points(u, v, false);
|
||||||
|
@ -195,7 +196,8 @@ bool test_add_remove() {
|
||||||
for (int j = 0; j < 10; j++) {
|
for (int j = 0; j < 10; j++) {
|
||||||
int u = Math::rand() % 5;
|
int u = Math::rand() % 5;
|
||||||
int v = Math::rand() % 4;
|
int v = Math::rand() % 4;
|
||||||
if (u == v) v = 4;
|
if (u == v)
|
||||||
|
v = 4;
|
||||||
if (Math::rand() % 2 == 1)
|
if (Math::rand() % 2 == 1)
|
||||||
a.connect_points(u, v, false);
|
a.connect_points(u, v, false);
|
||||||
else
|
else
|
||||||
|
@ -239,7 +241,8 @@ bool test_solutions() {
|
||||||
int u, v;
|
int u, v;
|
||||||
u = Math::rand() % N;
|
u = Math::rand() % N;
|
||||||
v = Math::rand() % (N - 1);
|
v = Math::rand() % (N - 1);
|
||||||
if (u == v) v = N - 1;
|
if (u == v)
|
||||||
|
v = N - 1;
|
||||||
|
|
||||||
// Pick a random operation
|
// Pick a random operation
|
||||||
int op = Math::rand();
|
int op = Math::rand();
|
||||||
|
@ -253,14 +256,16 @@ bool test_solutions() {
|
||||||
// Add edge (u, v); possibly bidirectional
|
// Add edge (u, v); possibly bidirectional
|
||||||
a.connect_points(u, v, op % 2);
|
a.connect_points(u, v, op % 2);
|
||||||
adj[u][v] = true;
|
adj[u][v] = true;
|
||||||
if (op % 2) adj[v][u] = true;
|
if (op % 2)
|
||||||
|
adj[v][u] = true;
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
case 7:
|
case 7:
|
||||||
// Remove edge (u, v); possibly bidirectional
|
// Remove edge (u, v); possibly bidirectional
|
||||||
a.disconnect_points(u, v, op % 2);
|
a.disconnect_points(u, v, op % 2);
|
||||||
adj[u][v] = false;
|
adj[u][v] = false;
|
||||||
if (op % 2) adj[v][u] = false;
|
if (op % 2)
|
||||||
|
adj[v][u] = false;
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
// Remove point u and add it back; clears adjacent edges and changes coordinates
|
// Remove point u and add it back; clears adjacent edges and changes coordinates
|
||||||
|
@ -291,12 +296,14 @@ bool test_solutions() {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (int u = 0; u < N; u++)
|
for (int u = 0; u < N; u++)
|
||||||
for (int v = 0; v < N; v++)
|
for (int v = 0; v < N; v++)
|
||||||
if (adj[u][v]) count++;
|
if (adj[u][v])
|
||||||
|
count++;
|
||||||
printf("Test #%4d: %3d edges, ", test + 1, count);
|
printf("Test #%4d: %3d edges, ", test + 1, count);
|
||||||
count = 0;
|
count = 0;
|
||||||
for (int u = 0; u < N; u++)
|
for (int u = 0; u < N; u++)
|
||||||
for (int v = 0; v < N; v++)
|
for (int v = 0; v < N; v++)
|
||||||
if (!Math::is_inf(d[u][v])) count++;
|
if (!Math::is_inf(d[u][v]))
|
||||||
|
count++;
|
||||||
printf("%3d/%d pairs of reachable points\n", count - N, N * (N - 1));
|
printf("%3d/%d pairs of reachable points\n", count - N, N * (N - 1));
|
||||||
|
|
||||||
// Check A*'s output
|
// Check A*'s output
|
||||||
|
@ -339,7 +346,8 @@ bool test_solutions() {
|
||||||
}
|
}
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
if (!match) return false;
|
if (!match)
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -968,22 +968,26 @@ bool test_31() {
|
||||||
String a = "";
|
String a = "";
|
||||||
success = a[0] == 0;
|
success = a[0] == 0;
|
||||||
OS::get_singleton()->print("Is 0 String[0]:, %s\n", success ? "OK" : "FAIL");
|
OS::get_singleton()->print("Is 0 String[0]:, %s\n", success ? "OK" : "FAIL");
|
||||||
if (!success) state = false;
|
if (!success)
|
||||||
|
state = false;
|
||||||
|
|
||||||
String b = "Godot";
|
String b = "Godot";
|
||||||
success = b[b.size()] == 0;
|
success = b[b.size()] == 0;
|
||||||
OS::get_singleton()->print("Is 0 String[size()]:, %s\n", success ? "OK" : "FAIL");
|
OS::get_singleton()->print("Is 0 String[size()]:, %s\n", success ? "OK" : "FAIL");
|
||||||
if (!success) state = false;
|
if (!success)
|
||||||
|
state = false;
|
||||||
|
|
||||||
const String c = "";
|
const String c = "";
|
||||||
success = c[0] == 0;
|
success = c[0] == 0;
|
||||||
OS::get_singleton()->print("Is 0 const String[0]:, %s\n", success ? "OK" : "FAIL");
|
OS::get_singleton()->print("Is 0 const String[0]:, %s\n", success ? "OK" : "FAIL");
|
||||||
if (!success) state = false;
|
if (!success)
|
||||||
|
state = false;
|
||||||
|
|
||||||
const String d = "Godot";
|
const String d = "Godot";
|
||||||
success = d[d.size()] == 0;
|
success = d[d.size()] == 0;
|
||||||
OS::get_singleton()->print("Is 0 const String[size()]:, %s\n", success ? "OK" : "FAIL");
|
OS::get_singleton()->print("Is 0 const String[size()]:, %s\n", success ? "OK" : "FAIL");
|
||||||
if (!success) state = false;
|
if (!success)
|
||||||
|
state = false;
|
||||||
|
|
||||||
return state;
|
return state;
|
||||||
};
|
};
|
||||||
|
|
|
@ -81,7 +81,8 @@ void ShapeBullet::add_owner(ShapeOwnerBullet *p_owner) {
|
||||||
|
|
||||||
void ShapeBullet::remove_owner(ShapeOwnerBullet *p_owner, bool p_permanentlyFromThisBody) {
|
void ShapeBullet::remove_owner(ShapeOwnerBullet *p_owner, bool p_permanentlyFromThisBody) {
|
||||||
Map<ShapeOwnerBullet *, int>::Element *E = owners.find(p_owner);
|
Map<ShapeOwnerBullet *, int>::Element *E = owners.find(p_owner);
|
||||||
if (!E) return;
|
if (!E)
|
||||||
|
return;
|
||||||
E->get()--;
|
E->get()--;
|
||||||
if (p_permanentlyFromThisBody || 0 >= E->get()) {
|
if (p_permanentlyFromThisBody || 0 >= E->get()) {
|
||||||
owners.erase(E);
|
owners.erase(E);
|
||||||
|
|
|
@ -171,7 +171,8 @@ public:
|
||||||
contactDebugCount = 0;
|
contactDebugCount = 0;
|
||||||
}
|
}
|
||||||
_FORCE_INLINE_ void add_debug_contact(const Vector3 &p_contact) {
|
_FORCE_INLINE_ void add_debug_contact(const Vector3 &p_contact) {
|
||||||
if (contactDebugCount < contactDebug.size()) contactDebug.write[contactDebugCount++] = p_contact;
|
if (contactDebugCount < contactDebug.size())
|
||||||
|
contactDebug.write[contactDebugCount++] = p_contact;
|
||||||
}
|
}
|
||||||
_FORCE_INLINE_ Vector<Vector3> get_debug_contacts() { return contactDebug; }
|
_FORCE_INLINE_ Vector<Vector3> get_debug_contacts() { return contactDebug; }
|
||||||
_FORCE_INLINE_ int get_debug_contact_count() { return contactDebugCount; }
|
_FORCE_INLINE_ int get_debug_contact_count() { return contactDebugCount; }
|
||||||
|
|
|
@ -138,10 +138,12 @@ inline bool is_point_in_triangle(const Vector3 &p_point, const Vector3 p_vertice
|
||||||
lambda[2] = p_vertices[0].cross(p_vertices[1]).dot(p_point) / det;
|
lambda[2] = p_vertices[0].cross(p_vertices[1]).dot(p_point) / det;
|
||||||
|
|
||||||
// Point is in the plane if all lambdas sum to 1.
|
// Point is in the plane if all lambdas sum to 1.
|
||||||
if (!Math::is_equal_approx(lambda[0] + lambda[1] + lambda[2], 1)) return false;
|
if (!Math::is_equal_approx(lambda[0] + lambda[1] + lambda[2], 1))
|
||||||
|
return false;
|
||||||
|
|
||||||
// Point is inside the triangle if all lambdas are positive.
|
// Point is inside the triangle if all lambdas are positive.
|
||||||
if (lambda[0] < 0 || lambda[1] < 0 || lambda[2] < 0) return false;
|
if (lambda[0] < 0 || lambda[1] < 0 || lambda[2] < 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -532,7 +534,8 @@ void CSGBrushOperation::MeshMerge::_add_distance(List<real_t> &r_intersectionsA,
|
||||||
|
|
||||||
// Check if distance exists.
|
// Check if distance exists.
|
||||||
for (const List<real_t>::Element *E = intersections.front(); E; E = E->next())
|
for (const List<real_t>::Element *E = intersections.front(); E; E = E->next())
|
||||||
if (Math::is_equal_approx(**E, p_distance)) return;
|
if (Math::is_equal_approx(**E, p_distance))
|
||||||
|
return;
|
||||||
|
|
||||||
intersections.push_back(p_distance);
|
intersections.push_back(p_distance);
|
||||||
}
|
}
|
||||||
|
@ -798,7 +801,8 @@ int CSGBrushOperation::Build2DFaces::_add_vertex(const Vertex2D &p_vertex) {
|
||||||
|
|
||||||
// Check if vertex exists.
|
// Check if vertex exists.
|
||||||
int vertex_id = _get_point_idx(p_vertex.point);
|
int vertex_id = _get_point_idx(p_vertex.point);
|
||||||
if (vertex_id != -1) return vertex_id;
|
if (vertex_id != -1)
|
||||||
|
return vertex_id;
|
||||||
|
|
||||||
vertices.push_back(p_vertex);
|
vertices.push_back(p_vertex);
|
||||||
return vertices.size() - 1;
|
return vertices.size() - 1;
|
||||||
|
@ -824,7 +828,8 @@ void CSGBrushOperation::Build2DFaces::_add_vertex_idx_sorted(Vector<int> &r_vert
|
||||||
|
|
||||||
// Sort along the axis with the greatest difference.
|
// Sort along the axis with the greatest difference.
|
||||||
int axis = 0;
|
int axis = 0;
|
||||||
if (Math::abs(new_point.x - first_point.x) < Math::abs(new_point.y - first_point.y)) axis = 1;
|
if (Math::abs(new_point.x - first_point.x) < Math::abs(new_point.y - first_point.y))
|
||||||
|
axis = 1;
|
||||||
|
|
||||||
// Add it to the beginning or the end appropriately.
|
// Add it to the beginning or the end appropriately.
|
||||||
if (new_point[axis] < first_point[axis])
|
if (new_point[axis] < first_point[axis])
|
||||||
|
@ -842,7 +847,8 @@ void CSGBrushOperation::Build2DFaces::_add_vertex_idx_sorted(Vector<int> &r_vert
|
||||||
|
|
||||||
// Determine axis being sorted against i.e. the axis with the greatest difference.
|
// Determine axis being sorted against i.e. the axis with the greatest difference.
|
||||||
int axis = 0;
|
int axis = 0;
|
||||||
if (Math::abs(last_point.x - first_point.x) < Math::abs(last_point.y - first_point.y)) axis = 1;
|
if (Math::abs(last_point.x - first_point.x) < Math::abs(last_point.y - first_point.y))
|
||||||
|
axis = 1;
|
||||||
|
|
||||||
// Insert the point at the appropriate index.
|
// Insert the point at the appropriate index.
|
||||||
for (int insert_idx = 0; insert_idx < r_vertex_indices.size(); ++insert_idx) {
|
for (int insert_idx = 0; insert_idx < r_vertex_indices.size(); ++insert_idx) {
|
||||||
|
@ -861,7 +867,8 @@ void CSGBrushOperation::Build2DFaces::_add_vertex_idx_sorted(Vector<int> &r_vert
|
||||||
void CSGBrushOperation::Build2DFaces::_merge_faces(const Vector<int> &p_segment_indices) {
|
void CSGBrushOperation::Build2DFaces::_merge_faces(const Vector<int> &p_segment_indices) {
|
||||||
|
|
||||||
int segments = p_segment_indices.size() - 1;
|
int segments = p_segment_indices.size() - 1;
|
||||||
if (segments < 2) return;
|
if (segments < 2)
|
||||||
|
return;
|
||||||
|
|
||||||
// Faces around an inner vertex are merged by moving the inner vertex to the first vertex.
|
// Faces around an inner vertex are merged by moving the inner vertex to the first vertex.
|
||||||
for (int sorted_idx = 1; sorted_idx < segments; ++sorted_idx) {
|
for (int sorted_idx = 1; sorted_idx < segments; ++sorted_idx) {
|
||||||
|
@ -901,7 +908,8 @@ void CSGBrushOperation::Build2DFaces::_merge_faces(const Vector<int> &p_segment_
|
||||||
|
|
||||||
// Skip flattened faces.
|
// Skip flattened faces.
|
||||||
if (outer_edge_idx[0] == p_segment_indices[closest_idx] ||
|
if (outer_edge_idx[0] == p_segment_indices[closest_idx] ||
|
||||||
outer_edge_idx[1] == p_segment_indices[closest_idx]) continue;
|
outer_edge_idx[1] == p_segment_indices[closest_idx])
|
||||||
|
continue;
|
||||||
|
|
||||||
//Don't create degenerate triangles.
|
//Don't create degenerate triangles.
|
||||||
Vector2 edge1[2] = {
|
Vector2 edge1[2] = {
|
||||||
|
@ -934,7 +942,8 @@ void CSGBrushOperation::Build2DFaces::_merge_faces(const Vector<int> &p_segment_
|
||||||
for (int i = 0; i < merge_faces_idx.size(); ++i)
|
for (int i = 0; i < merge_faces_idx.size(); ++i)
|
||||||
faces.remove(merge_faces_idx[i]);
|
faces.remove(merge_faces_idx[i]);
|
||||||
|
|
||||||
if (degenerate_points.size() == 0) continue;
|
if (degenerate_points.size() == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
// Split faces using degenerate points.
|
// Split faces using degenerate points.
|
||||||
for (int face_idx = 0; face_idx < faces.size(); ++face_idx) {
|
for (int face_idx = 0; face_idx < faces.size(); ++face_idx) {
|
||||||
|
@ -964,7 +973,8 @@ void CSGBrushOperation::Build2DFaces::_merge_faces(const Vector<int> &p_segment_
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (existing) continue;
|
if (existing)
|
||||||
|
continue;
|
||||||
|
|
||||||
// Check if point is on an each edge.
|
// Check if point is on an each edge.
|
||||||
for (int face_edge_idx = 0; face_edge_idx < 3; ++face_edge_idx) {
|
for (int face_edge_idx = 0; face_edge_idx < 3; ++face_edge_idx) {
|
||||||
|
@ -1053,10 +1063,12 @@ void CSGBrushOperation::Build2DFaces::_find_edge_intersections(const Vector2 p_s
|
||||||
|
|
||||||
// Check if intersection point is an edge point.
|
// Check if intersection point is an edge point.
|
||||||
if ((intersection_point - edge_points[0]).length_squared() < vertex_snap2 ||
|
if ((intersection_point - edge_points[0]).length_squared() < vertex_snap2 ||
|
||||||
(intersection_point - edge_points[1]).length_squared() < vertex_snap2) continue;
|
(intersection_point - edge_points[1]).length_squared() < vertex_snap2)
|
||||||
|
continue;
|
||||||
|
|
||||||
// Check if edge exists, by checking if the intersecting segment is parallel to the edge.
|
// Check if edge exists, by checking if the intersecting segment is parallel to the edge.
|
||||||
if (are_segements_parallel(p_segment_points, edge_points, vertex_snap2)) continue;
|
if (are_segements_parallel(p_segment_points, edge_points, vertex_snap2))
|
||||||
|
continue;
|
||||||
|
|
||||||
// Add the intersection point as a new vertex.
|
// Add the intersection point as a new vertex.
|
||||||
Vertex2D new_vertex;
|
Vertex2D new_vertex;
|
||||||
|
@ -1387,7 +1399,8 @@ void CSGBrushOperation::update_faces(const CSGBrush &p_brush_a, const int p_face
|
||||||
p_collection.build2DFacesB[p_face_idx_b] = Build2DFaces();
|
p_collection.build2DFacesB[p_face_idx_b] = Build2DFaces();
|
||||||
has_degenerate = true;
|
has_degenerate = true;
|
||||||
}
|
}
|
||||||
if (has_degenerate) return;
|
if (has_degenerate)
|
||||||
|
return;
|
||||||
|
|
||||||
// Ensure B has points either side of or in the plane of A.
|
// Ensure B has points either side of or in the plane of A.
|
||||||
int in_plane_count = 0, over_count = 0, under_count = 0;
|
int in_plane_count = 0, over_count = 0, under_count = 0;
|
||||||
|
@ -1403,7 +1416,8 @@ void CSGBrushOperation::update_faces(const CSGBrush &p_brush_a, const int p_face
|
||||||
under_count++;
|
under_count++;
|
||||||
}
|
}
|
||||||
// If all points under or over the plane, there is no intesection.
|
// If all points under or over the plane, there is no intesection.
|
||||||
if (over_count == 3 || under_count == 3) return;
|
if (over_count == 3 || under_count == 3)
|
||||||
|
return;
|
||||||
|
|
||||||
// Ensure A has points either side of or in the plane of B.
|
// Ensure A has points either side of or in the plane of B.
|
||||||
in_plane_count = 0;
|
in_plane_count = 0;
|
||||||
|
@ -1421,7 +1435,8 @@ void CSGBrushOperation::update_faces(const CSGBrush &p_brush_a, const int p_face
|
||||||
under_count++;
|
under_count++;
|
||||||
}
|
}
|
||||||
// If all points under or over the plane, there is no intesection.
|
// If all points under or over the plane, there is no intesection.
|
||||||
if (over_count == 3 || under_count == 3) return;
|
if (over_count == 3 || under_count == 3)
|
||||||
|
return;
|
||||||
|
|
||||||
// Check for intersection using the SAT theorem.
|
// Check for intersection using the SAT theorem.
|
||||||
{
|
{
|
||||||
|
|
|
@ -1799,11 +1799,15 @@ CSGBrush *CSGPolygon::_build_brush() {
|
||||||
final_polygon_min = p;
|
final_polygon_min = p;
|
||||||
final_polygon_max = final_polygon_min;
|
final_polygon_max = final_polygon_min;
|
||||||
} else {
|
} else {
|
||||||
if (p.x < final_polygon_min.x) final_polygon_min.x = p.x;
|
if (p.x < final_polygon_min.x)
|
||||||
if (p.y < final_polygon_min.y) final_polygon_min.y = p.y;
|
final_polygon_min.x = p.x;
|
||||||
|
if (p.y < final_polygon_min.y)
|
||||||
|
final_polygon_min.y = p.y;
|
||||||
|
|
||||||
if (p.x > final_polygon_max.x) final_polygon_max.x = p.x;
|
if (p.x > final_polygon_max.x)
|
||||||
if (p.y > final_polygon_max.y) final_polygon_max.y = p.y;
|
final_polygon_max.x = p.x;
|
||||||
|
if (p.y > final_polygon_max.y)
|
||||||
|
final_polygon_max.y = p.y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Vector2 final_polygon_size = final_polygon_max - final_polygon_min;
|
Vector2 final_polygon_size = final_polygon_max - final_polygon_min;
|
||||||
|
|
|
@ -223,7 +223,8 @@ DirectPropertyMap PropertyTable::GetUnparsedProperties() const {
|
||||||
for (const LazyPropertyMap::value_type &element : lazyProps) {
|
for (const LazyPropertyMap::value_type &element : lazyProps) {
|
||||||
|
|
||||||
// Skip parsed properties
|
// Skip parsed properties
|
||||||
if (props.end() != props.find(element.first)) continue;
|
if (props.end() != props.find(element.first))
|
||||||
|
continue;
|
||||||
|
|
||||||
// Read the element's value.
|
// Read the element's value.
|
||||||
// Wrap the naked pointer (since the call site is required to acquire ownership)
|
// Wrap the naked pointer (since the call site is required to acquire ownership)
|
||||||
|
@ -231,7 +232,8 @@ DirectPropertyMap PropertyTable::GetUnparsedProperties() const {
|
||||||
Property *prop = ReadTypedProperty(element.second);
|
Property *prop = ReadTypedProperty(element.second);
|
||||||
|
|
||||||
// Element could not be read. Skip it.
|
// Element could not be read. Skip it.
|
||||||
if (!prop) continue;
|
if (!prop)
|
||||||
|
continue;
|
||||||
|
|
||||||
// Add to result
|
// Add to result
|
||||||
result[element.first] = prop;
|
result[element.first] = prop;
|
||||||
|
|
|
@ -181,7 +181,8 @@ void *godot_get_class_tag(const godot_string_name *p_class) {
|
||||||
}
|
}
|
||||||
|
|
||||||
godot_object *godot_object_cast_to(const godot_object *p_object, void *p_class_tag) {
|
godot_object *godot_object_cast_to(const godot_object *p_object, void *p_class_tag) {
|
||||||
if (!p_object) return NULL;
|
if (!p_object)
|
||||||
|
return NULL;
|
||||||
Object *o = (Object *)p_object;
|
Object *o = (Object *)p_object;
|
||||||
|
|
||||||
return o->is_class_ptr(p_class_tag) ? (godot_object *)o : NULL;
|
return o->is_class_ptr(p_class_tag) ? (godot_object *)o : NULL;
|
||||||
|
|
|
@ -870,71 +870,92 @@ int GDScriptCompiler::_parse_expression(CodeGen &codegen, const GDScriptParser::
|
||||||
} break;
|
} break;
|
||||||
//unary operators
|
//unary operators
|
||||||
case GDScriptParser::OperatorNode::OP_NEG: {
|
case GDScriptParser::OperatorNode::OP_NEG: {
|
||||||
if (!_create_unary_operator(codegen, on, Variant::OP_NEGATE, p_stack_level)) return -1;
|
if (!_create_unary_operator(codegen, on, Variant::OP_NEGATE, p_stack_level))
|
||||||
|
return -1;
|
||||||
} break;
|
} break;
|
||||||
case GDScriptParser::OperatorNode::OP_POS: {
|
case GDScriptParser::OperatorNode::OP_POS: {
|
||||||
if (!_create_unary_operator(codegen, on, Variant::OP_POSITIVE, p_stack_level)) return -1;
|
if (!_create_unary_operator(codegen, on, Variant::OP_POSITIVE, p_stack_level))
|
||||||
|
return -1;
|
||||||
} break;
|
} break;
|
||||||
case GDScriptParser::OperatorNode::OP_NOT: {
|
case GDScriptParser::OperatorNode::OP_NOT: {
|
||||||
if (!_create_unary_operator(codegen, on, Variant::OP_NOT, p_stack_level)) return -1;
|
if (!_create_unary_operator(codegen, on, Variant::OP_NOT, p_stack_level))
|
||||||
|
return -1;
|
||||||
} break;
|
} break;
|
||||||
case GDScriptParser::OperatorNode::OP_BIT_INVERT: {
|
case GDScriptParser::OperatorNode::OP_BIT_INVERT: {
|
||||||
if (!_create_unary_operator(codegen, on, Variant::OP_BIT_NEGATE, p_stack_level)) return -1;
|
if (!_create_unary_operator(codegen, on, Variant::OP_BIT_NEGATE, p_stack_level))
|
||||||
|
return -1;
|
||||||
} break;
|
} break;
|
||||||
//binary operators (in precedence order)
|
//binary operators (in precedence order)
|
||||||
case GDScriptParser::OperatorNode::OP_IN: {
|
case GDScriptParser::OperatorNode::OP_IN: {
|
||||||
if (!_create_binary_operator(codegen, on, Variant::OP_IN, p_stack_level)) return -1;
|
if (!_create_binary_operator(codegen, on, Variant::OP_IN, p_stack_level))
|
||||||
|
return -1;
|
||||||
} break;
|
} break;
|
||||||
case GDScriptParser::OperatorNode::OP_EQUAL: {
|
case GDScriptParser::OperatorNode::OP_EQUAL: {
|
||||||
if (!_create_binary_operator(codegen, on, Variant::OP_EQUAL, p_stack_level)) return -1;
|
if (!_create_binary_operator(codegen, on, Variant::OP_EQUAL, p_stack_level))
|
||||||
|
return -1;
|
||||||
} break;
|
} break;
|
||||||
case GDScriptParser::OperatorNode::OP_NOT_EQUAL: {
|
case GDScriptParser::OperatorNode::OP_NOT_EQUAL: {
|
||||||
if (!_create_binary_operator(codegen, on, Variant::OP_NOT_EQUAL, p_stack_level)) return -1;
|
if (!_create_binary_operator(codegen, on, Variant::OP_NOT_EQUAL, p_stack_level))
|
||||||
|
return -1;
|
||||||
} break;
|
} break;
|
||||||
case GDScriptParser::OperatorNode::OP_LESS: {
|
case GDScriptParser::OperatorNode::OP_LESS: {
|
||||||
if (!_create_binary_operator(codegen, on, Variant::OP_LESS, p_stack_level)) return -1;
|
if (!_create_binary_operator(codegen, on, Variant::OP_LESS, p_stack_level))
|
||||||
|
return -1;
|
||||||
} break;
|
} break;
|
||||||
case GDScriptParser::OperatorNode::OP_LESS_EQUAL: {
|
case GDScriptParser::OperatorNode::OP_LESS_EQUAL: {
|
||||||
if (!_create_binary_operator(codegen, on, Variant::OP_LESS_EQUAL, p_stack_level)) return -1;
|
if (!_create_binary_operator(codegen, on, Variant::OP_LESS_EQUAL, p_stack_level))
|
||||||
|
return -1;
|
||||||
} break;
|
} break;
|
||||||
case GDScriptParser::OperatorNode::OP_GREATER: {
|
case GDScriptParser::OperatorNode::OP_GREATER: {
|
||||||
if (!_create_binary_operator(codegen, on, Variant::OP_GREATER, p_stack_level)) return -1;
|
if (!_create_binary_operator(codegen, on, Variant::OP_GREATER, p_stack_level))
|
||||||
|
return -1;
|
||||||
} break;
|
} break;
|
||||||
case GDScriptParser::OperatorNode::OP_GREATER_EQUAL: {
|
case GDScriptParser::OperatorNode::OP_GREATER_EQUAL: {
|
||||||
if (!_create_binary_operator(codegen, on, Variant::OP_GREATER_EQUAL, p_stack_level)) return -1;
|
if (!_create_binary_operator(codegen, on, Variant::OP_GREATER_EQUAL, p_stack_level))
|
||||||
|
return -1;
|
||||||
} break;
|
} break;
|
||||||
case GDScriptParser::OperatorNode::OP_ADD: {
|
case GDScriptParser::OperatorNode::OP_ADD: {
|
||||||
if (!_create_binary_operator(codegen, on, Variant::OP_ADD, p_stack_level)) return -1;
|
if (!_create_binary_operator(codegen, on, Variant::OP_ADD, p_stack_level))
|
||||||
|
return -1;
|
||||||
} break;
|
} break;
|
||||||
case GDScriptParser::OperatorNode::OP_SUB: {
|
case GDScriptParser::OperatorNode::OP_SUB: {
|
||||||
if (!_create_binary_operator(codegen, on, Variant::OP_SUBTRACT, p_stack_level)) return -1;
|
if (!_create_binary_operator(codegen, on, Variant::OP_SUBTRACT, p_stack_level))
|
||||||
|
return -1;
|
||||||
} break;
|
} break;
|
||||||
case GDScriptParser::OperatorNode::OP_MUL: {
|
case GDScriptParser::OperatorNode::OP_MUL: {
|
||||||
if (!_create_binary_operator(codegen, on, Variant::OP_MULTIPLY, p_stack_level)) return -1;
|
if (!_create_binary_operator(codegen, on, Variant::OP_MULTIPLY, p_stack_level))
|
||||||
|
return -1;
|
||||||
} break;
|
} break;
|
||||||
case GDScriptParser::OperatorNode::OP_DIV: {
|
case GDScriptParser::OperatorNode::OP_DIV: {
|
||||||
if (!_create_binary_operator(codegen, on, Variant::OP_DIVIDE, p_stack_level)) return -1;
|
if (!_create_binary_operator(codegen, on, Variant::OP_DIVIDE, p_stack_level))
|
||||||
|
return -1;
|
||||||
} break;
|
} break;
|
||||||
case GDScriptParser::OperatorNode::OP_MOD: {
|
case GDScriptParser::OperatorNode::OP_MOD: {
|
||||||
if (!_create_binary_operator(codegen, on, Variant::OP_MODULE, p_stack_level)) return -1;
|
if (!_create_binary_operator(codegen, on, Variant::OP_MODULE, p_stack_level))
|
||||||
|
return -1;
|
||||||
} break;
|
} break;
|
||||||
//case GDScriptParser::OperatorNode::OP_SHIFT_LEFT: { if (!_create_binary_operator(codegen,on,Variant::OP_SHIFT_LEFT,p_stack_level)) return -1;} break;
|
//case GDScriptParser::OperatorNode::OP_SHIFT_LEFT: { if (!_create_binary_operator(codegen,on,Variant::OP_SHIFT_LEFT,p_stack_level)) return -1;} break;
|
||||||
//case GDScriptParser::OperatorNode::OP_SHIFT_RIGHT: { if (!_create_binary_operator(codegen,on,Variant::OP_SHIFT_RIGHT,p_stack_level)) return -1;} break;
|
//case GDScriptParser::OperatorNode::OP_SHIFT_RIGHT: { if (!_create_binary_operator(codegen,on,Variant::OP_SHIFT_RIGHT,p_stack_level)) return -1;} break;
|
||||||
case GDScriptParser::OperatorNode::OP_BIT_AND: {
|
case GDScriptParser::OperatorNode::OP_BIT_AND: {
|
||||||
if (!_create_binary_operator(codegen, on, Variant::OP_BIT_AND, p_stack_level)) return -1;
|
if (!_create_binary_operator(codegen, on, Variant::OP_BIT_AND, p_stack_level))
|
||||||
|
return -1;
|
||||||
} break;
|
} break;
|
||||||
case GDScriptParser::OperatorNode::OP_BIT_OR: {
|
case GDScriptParser::OperatorNode::OP_BIT_OR: {
|
||||||
if (!_create_binary_operator(codegen, on, Variant::OP_BIT_OR, p_stack_level)) return -1;
|
if (!_create_binary_operator(codegen, on, Variant::OP_BIT_OR, p_stack_level))
|
||||||
|
return -1;
|
||||||
} break;
|
} break;
|
||||||
case GDScriptParser::OperatorNode::OP_BIT_XOR: {
|
case GDScriptParser::OperatorNode::OP_BIT_XOR: {
|
||||||
if (!_create_binary_operator(codegen, on, Variant::OP_BIT_XOR, p_stack_level)) return -1;
|
if (!_create_binary_operator(codegen, on, Variant::OP_BIT_XOR, p_stack_level))
|
||||||
|
return -1;
|
||||||
} break;
|
} break;
|
||||||
//shift
|
//shift
|
||||||
case GDScriptParser::OperatorNode::OP_SHIFT_LEFT: {
|
case GDScriptParser::OperatorNode::OP_SHIFT_LEFT: {
|
||||||
if (!_create_binary_operator(codegen, on, Variant::OP_SHIFT_LEFT, p_stack_level)) return -1;
|
if (!_create_binary_operator(codegen, on, Variant::OP_SHIFT_LEFT, p_stack_level))
|
||||||
|
return -1;
|
||||||
} break;
|
} break;
|
||||||
case GDScriptParser::OperatorNode::OP_SHIFT_RIGHT: {
|
case GDScriptParser::OperatorNode::OP_SHIFT_RIGHT: {
|
||||||
if (!_create_binary_operator(codegen, on, Variant::OP_SHIFT_RIGHT, p_stack_level)) return -1;
|
if (!_create_binary_operator(codegen, on, Variant::OP_SHIFT_RIGHT, p_stack_level))
|
||||||
|
return -1;
|
||||||
} break;
|
} break;
|
||||||
//assignment operators
|
//assignment operators
|
||||||
case GDScriptParser::OperatorNode::OP_ASSIGN_ADD:
|
case GDScriptParser::OperatorNode::OP_ASSIGN_ADD:
|
||||||
|
|
|
@ -123,10 +123,12 @@ class GDScriptCompiler {
|
||||||
|
|
||||||
Vector<int> opcodes;
|
Vector<int> opcodes;
|
||||||
void alloc_stack(int p_level) {
|
void alloc_stack(int p_level) {
|
||||||
if (p_level >= stack_max) stack_max = p_level + 1;
|
if (p_level >= stack_max)
|
||||||
|
stack_max = p_level + 1;
|
||||||
}
|
}
|
||||||
void alloc_call(int p_params) {
|
void alloc_call(int p_params) {
|
||||||
if (p_params >= call_max) call_max = p_params;
|
if (p_params >= call_max)
|
||||||
|
call_max = p_params;
|
||||||
}
|
}
|
||||||
|
|
||||||
int current_line;
|
int current_line;
|
||||||
|
|
|
@ -57,7 +57,8 @@ struct GDScriptDataType {
|
||||||
Ref<Script> script_type_ref;
|
Ref<Script> script_type_ref;
|
||||||
|
|
||||||
bool is_type(const Variant &p_variant, bool p_allow_implicit_conversion = false) const {
|
bool is_type(const Variant &p_variant, bool p_allow_implicit_conversion = false) const {
|
||||||
if (!has_type) return true; // Can't type check
|
if (!has_type)
|
||||||
|
return true; // Can't type check
|
||||||
|
|
||||||
switch (kind) {
|
switch (kind) {
|
||||||
case UNINITIALIZED:
|
case UNINITIALIZED:
|
||||||
|
|
|
@ -2037,7 +2037,8 @@ bool GDScriptParser::_reduce_export_var_type(Variant &p_value, int p_line) {
|
||||||
if (p_value.get_type() == Variant::ARRAY) {
|
if (p_value.get_type() == Variant::ARRAY) {
|
||||||
Array arr = p_value;
|
Array arr = p_value;
|
||||||
for (int i = 0; i < arr.size(); i++) {
|
for (int i = 0; i < arr.size(); i++) {
|
||||||
if (!_reduce_export_var_type(arr[i], p_line)) return false;
|
if (!_reduce_export_var_type(arr[i], p_line))
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -2046,7 +2047,8 @@ bool GDScriptParser::_reduce_export_var_type(Variant &p_value, int p_line) {
|
||||||
Dictionary dict = p_value;
|
Dictionary dict = p_value;
|
||||||
for (int i = 0; i < dict.size(); i++) {
|
for (int i = 0; i < dict.size(); i++) {
|
||||||
Variant value = dict.get_value_at_index(i);
|
Variant value = dict.get_value_at_index(i);
|
||||||
if (!_reduce_export_var_type(value, p_line)) return false;
|
if (!_reduce_export_var_type(value, p_line))
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -3374,7 +3376,8 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) {
|
||||||
|
|
||||||
_parse_pattern_block(compiled_branches, match_node->branches, p_static);
|
_parse_pattern_block(compiled_branches, match_node->branches, p_static);
|
||||||
|
|
||||||
if (error_set) return;
|
if (error_set)
|
||||||
|
return;
|
||||||
|
|
||||||
ControlFlowNode *match_cf_node = alloc_node<ControlFlowNode>();
|
ControlFlowNode *match_cf_node = alloc_node<ControlFlowNode>();
|
||||||
match_cf_node->cf_type = ControlFlowNode::CF_MATCH;
|
match_cf_node->cf_type = ControlFlowNode::CF_MATCH;
|
||||||
|
@ -4999,7 +5002,8 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_reduce_export_var_type(cn->value, member.line)) return;
|
if (!_reduce_export_var_type(cn->value, member.line))
|
||||||
|
return;
|
||||||
|
|
||||||
member._export.type = cn->value.get_type();
|
member._export.type = cn->value.get_type();
|
||||||
member._export.usage |= PROPERTY_USAGE_SCRIPT_VARIABLE;
|
member._export.usage |= PROPERTY_USAGE_SCRIPT_VARIABLE;
|
||||||
|
@ -5528,8 +5532,10 @@ void GDScriptParser::_determine_inheritance(ClassNode *p_class, bool p_recursive
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (base_class) break;
|
if (base_class)
|
||||||
if (found) continue;
|
break;
|
||||||
|
if (found)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (p->constant_expressions.has(base)) {
|
if (p->constant_expressions.has(base)) {
|
||||||
if (p->constant_expressions[base].expression->type != Node::TYPE_CONSTANT) {
|
if (p->constant_expressions[base].expression->type != Node::TYPE_CONSTANT) {
|
||||||
|
@ -5631,10 +5637,12 @@ void GDScriptParser::_determine_inheritance(ClassNode *p_class, bool p_recursive
|
||||||
}
|
}
|
||||||
|
|
||||||
String GDScriptParser::DataType::to_string() const {
|
String GDScriptParser::DataType::to_string() const {
|
||||||
if (!has_type) return "var";
|
if (!has_type)
|
||||||
|
return "var";
|
||||||
switch (kind) {
|
switch (kind) {
|
||||||
case BUILTIN: {
|
case BUILTIN: {
|
||||||
if (builtin_type == Variant::NIL) return "null";
|
if (builtin_type == Variant::NIL)
|
||||||
|
return "null";
|
||||||
return Variant::get_type_name(builtin_type);
|
return Variant::get_type_name(builtin_type);
|
||||||
} break;
|
} break;
|
||||||
case NATIVE: {
|
case NATIVE: {
|
||||||
|
@ -5798,8 +5806,10 @@ bool GDScriptParser::_parse_type(DataType &r_type, bool p_can_be_void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
GDScriptParser::DataType GDScriptParser::_resolve_type(const DataType &p_source, int p_line) {
|
GDScriptParser::DataType GDScriptParser::_resolve_type(const DataType &p_source, int p_line) {
|
||||||
if (!p_source.has_type) return p_source;
|
if (!p_source.has_type)
|
||||||
if (p_source.kind != DataType::UNRESOLVED) return p_source;
|
return p_source;
|
||||||
|
if (p_source.kind != DataType::UNRESOLVED)
|
||||||
|
return p_source;
|
||||||
|
|
||||||
Vector<String> full_name = p_source.native_type.operator String().split(".", false);
|
Vector<String> full_name = p_source.native_type.operator String().split(".", false);
|
||||||
int name_part = 0;
|
int name_part = 0;
|
||||||
|
@ -7031,7 +7041,8 @@ bool GDScriptParser::_get_function_signature(DataType &p_base_type, const String
|
||||||
native = "_" + native.operator String();
|
native = "_" + native.operator String();
|
||||||
}
|
}
|
||||||
if (!ClassDB::class_exists(native)) {
|
if (!ClassDB::class_exists(native)) {
|
||||||
if (!check_types) return false;
|
if (!check_types)
|
||||||
|
return false;
|
||||||
ERR_FAIL_V_MSG(false, "Parser bug: Class '" + String(native) + "' not found.");
|
ERR_FAIL_V_MSG(false, "Parser bug: Class '" + String(native) + "' not found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7126,7 +7137,8 @@ GDScriptParser::DataType GDScriptParser::_reduce_function_call_type(const Operat
|
||||||
par_types.write[i - 1] = _reduce_node_type(p_call->arguments[i]);
|
par_types.write[i - 1] = _reduce_node_type(p_call->arguments[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error_set) return DataType();
|
if (error_set)
|
||||||
|
return DataType();
|
||||||
|
|
||||||
// Special case: check copy constructor. Those are defined implicitly in Variant.
|
// Special case: check copy constructor. Those are defined implicitly in Variant.
|
||||||
if (par_types.size() == 1) {
|
if (par_types.size() == 1) {
|
||||||
|
@ -7194,7 +7206,8 @@ GDScriptParser::DataType GDScriptParser::_reduce_function_call_type(const Operat
|
||||||
err += "' matches the signature '";
|
err += "' matches the signature '";
|
||||||
err += Variant::get_type_name(tn->vtype) + "(";
|
err += Variant::get_type_name(tn->vtype) + "(";
|
||||||
for (int i = 0; i < par_types.size(); i++) {
|
for (int i = 0; i < par_types.size(); i++) {
|
||||||
if (i > 0) err += ", ";
|
if (i > 0)
|
||||||
|
err += ", ";
|
||||||
err += par_types[i].to_string();
|
err += par_types[i].to_string();
|
||||||
}
|
}
|
||||||
err += ")'.";
|
err += ")'.";
|
||||||
|
@ -7563,7 +7576,8 @@ bool GDScriptParser::_get_member_type(const DataType &p_base_type, const StringN
|
||||||
native = "_" + native.operator String();
|
native = "_" + native.operator String();
|
||||||
}
|
}
|
||||||
if (!ClassDB::class_exists(native)) {
|
if (!ClassDB::class_exists(native)) {
|
||||||
if (!check_types) return false;
|
if (!check_types)
|
||||||
|
return false;
|
||||||
ERR_FAIL_V_MSG(false, "Parser bug: Class \"" + String(native) + "\" not found.");
|
ERR_FAIL_V_MSG(false, "Parser bug: Class \"" + String(native) + "\" not found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7861,12 +7875,14 @@ void GDScriptParser::_check_class_level_types(ClassNode *p_class) {
|
||||||
// Function declarations
|
// Function declarations
|
||||||
for (int i = 0; i < p_class->static_functions.size(); i++) {
|
for (int i = 0; i < p_class->static_functions.size(); i++) {
|
||||||
_check_function_types(p_class->static_functions[i]);
|
_check_function_types(p_class->static_functions[i]);
|
||||||
if (error_set) return;
|
if (error_set)
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < p_class->functions.size(); i++) {
|
for (int i = 0; i < p_class->functions.size(); i++) {
|
||||||
_check_function_types(p_class->functions[i]);
|
_check_function_types(p_class->functions[i]);
|
||||||
if (error_set) return;
|
if (error_set)
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Class variables
|
// Class variables
|
||||||
|
@ -7946,7 +7962,8 @@ void GDScriptParser::_check_class_level_types(ClassNode *p_class) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setter and getter
|
// Setter and getter
|
||||||
if (v.setter == StringName() && v.getter == StringName()) continue;
|
if (v.setter == StringName() && v.getter == StringName())
|
||||||
|
continue;
|
||||||
|
|
||||||
bool found_getter = false;
|
bool found_getter = false;
|
||||||
bool found_setter = false;
|
bool found_setter = false;
|
||||||
|
@ -7989,10 +8006,12 @@ void GDScriptParser::_check_class_level_types(ClassNode *p_class) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (found_getter && found_setter) break;
|
if (found_getter && found_setter)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((found_getter || v.getter == StringName()) && (found_setter || v.setter == StringName())) continue;
|
if ((found_getter || v.getter == StringName()) && (found_setter || v.setter == StringName()))
|
||||||
|
continue;
|
||||||
|
|
||||||
// Check for static functions
|
// Check for static functions
|
||||||
for (int j = 0; j < p_class->static_functions.size(); j++) {
|
for (int j = 0; j < p_class->static_functions.size(); j++) {
|
||||||
|
@ -8064,7 +8083,8 @@ void GDScriptParser::_check_class_level_types(ClassNode *p_class) {
|
||||||
for (int i = 0; i < p_class->subclasses.size(); i++) {
|
for (int i = 0; i < p_class->subclasses.size(); i++) {
|
||||||
current_class = p_class->subclasses[i];
|
current_class = p_class->subclasses[i];
|
||||||
_check_class_level_types(current_class);
|
_check_class_level_types(current_class);
|
||||||
if (error_set) return;
|
if (error_set)
|
||||||
|
return;
|
||||||
current_class = p_class;
|
current_class = p_class;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8201,7 +8221,8 @@ void GDScriptParser::_check_class_blocks_types(ClassNode *p_class) {
|
||||||
_check_block_types(current_block);
|
_check_block_types(current_block);
|
||||||
current_block = NULL;
|
current_block = NULL;
|
||||||
current_function = NULL;
|
current_function = NULL;
|
||||||
if (error_set) return;
|
if (error_set)
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < p_class->functions.size(); i++) {
|
for (int i = 0; i < p_class->functions.size(); i++) {
|
||||||
|
@ -8211,7 +8232,8 @@ void GDScriptParser::_check_class_blocks_types(ClassNode *p_class) {
|
||||||
_check_block_types(current_block);
|
_check_block_types(current_block);
|
||||||
current_block = NULL;
|
current_block = NULL;
|
||||||
current_function = NULL;
|
current_function = NULL;
|
||||||
if (error_set) return;
|
if (error_set)
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
|
@ -8232,7 +8254,8 @@ void GDScriptParser::_check_class_blocks_types(ClassNode *p_class) {
|
||||||
for (int i = 0; i < p_class->subclasses.size(); i++) {
|
for (int i = 0; i < p_class->subclasses.size(); i++) {
|
||||||
current_class = p_class->subclasses[i];
|
current_class = p_class->subclasses[i];
|
||||||
_check_class_blocks_types(current_class);
|
_check_class_blocks_types(current_class);
|
||||||
if (error_set) return;
|
if (error_set)
|
||||||
|
return;
|
||||||
current_class = p_class;
|
current_class = p_class;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8502,7 +8525,8 @@ void GDScriptParser::_check_block_types(BlockNode *p_block) {
|
||||||
_add_warning(GDScriptWarning::RETURN_VALUE_DISCARDED, op->line, func_name);
|
_add_warning(GDScriptWarning::RETURN_VALUE_DISCARDED, op->line, func_name);
|
||||||
}
|
}
|
||||||
#endif // DEBUG_ENABLED
|
#endif // DEBUG_ENABLED
|
||||||
if (error_set) return;
|
if (error_set)
|
||||||
|
return;
|
||||||
} break;
|
} break;
|
||||||
case OperatorNode::OP_YIELD: {
|
case OperatorNode::OP_YIELD: {
|
||||||
_mark_line_as_safe(op->line);
|
_mark_line_as_safe(op->line);
|
||||||
|
@ -8537,7 +8561,8 @@ void GDScriptParser::_check_block_types(BlockNode *p_block) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!function_type.has_type) break;
|
if (!function_type.has_type)
|
||||||
|
break;
|
||||||
|
|
||||||
if (function_type.kind == DataType::BUILTIN && function_type.builtin_type == Variant::NIL) {
|
if (function_type.kind == DataType::BUILTIN && function_type.builtin_type == Variant::NIL) {
|
||||||
// Return void, should not have arguments
|
// Return void, should not have arguments
|
||||||
|
@ -8597,7 +8622,8 @@ void GDScriptParser::_check_block_types(BlockNode *p_block) {
|
||||||
current_block = p_block->sub_blocks[i];
|
current_block = p_block->sub_blocks[i];
|
||||||
_check_block_types(current_block);
|
_check_block_types(current_block);
|
||||||
current_block = p_block;
|
current_block = p_block;
|
||||||
if (error_set) return;
|
if (error_set)
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
|
@ -8740,7 +8766,8 @@ Error GDScriptParser::_parse(const String &p_base_path) {
|
||||||
current_function = NULL;
|
current_function = NULL;
|
||||||
current_block = NULL;
|
current_block = NULL;
|
||||||
|
|
||||||
if (for_completion) check_types = false;
|
if (for_completion)
|
||||||
|
check_types = false;
|
||||||
|
|
||||||
// Resolve all class-level stuff before getting into function blocks
|
// Resolve all class-level stuff before getting into function blocks
|
||||||
_check_class_level_types(main_class);
|
_check_class_level_types(main_class);
|
||||||
|
|
|
@ -650,12 +650,14 @@ private:
|
||||||
void _check_block_types(BlockNode *p_block);
|
void _check_block_types(BlockNode *p_block);
|
||||||
_FORCE_INLINE_ void _mark_line_as_safe(int p_line) const {
|
_FORCE_INLINE_ void _mark_line_as_safe(int p_line) const {
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
if (safe_lines) safe_lines->insert(p_line);
|
if (safe_lines)
|
||||||
|
safe_lines->insert(p_line);
|
||||||
#endif // DEBUG_ENABLED
|
#endif // DEBUG_ENABLED
|
||||||
}
|
}
|
||||||
_FORCE_INLINE_ void _mark_line_as_unsafe(int p_line) const {
|
_FORCE_INLINE_ void _mark_line_as_unsafe(int p_line) const {
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
if (safe_lines) safe_lines->erase(p_line);
|
if (safe_lines)
|
||||||
|
safe_lines->erase(p_line);
|
||||||
#endif // DEBUG_ENABLED
|
#endif // DEBUG_ENABLED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -402,7 +402,8 @@ String ExtendGDScriptParser::parse_documentation(int p_line, bool p_docs_down) {
|
||||||
int start_line = p_docs_down ? p_line : p_line - 1;
|
int start_line = p_docs_down ? p_line : p_line - 1;
|
||||||
for (int i = start_line; true; i += step) {
|
for (int i = start_line; true; i += step) {
|
||||||
|
|
||||||
if (i < 0 || i >= lines.size()) break;
|
if (i < 0 || i >= lines.size())
|
||||||
|
break;
|
||||||
|
|
||||||
String line_comment = lines[i].strip_edges(true, false);
|
String line_comment = lines[i].strip_edges(true, false);
|
||||||
if (line_comment.begins_with("#")) {
|
if (line_comment.begins_with("#")) {
|
||||||
|
|
|
@ -197,7 +197,8 @@ Array GDScriptWorkspace::symbol(const Dictionary &p_params) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Error GDScriptWorkspace::initialize() {
|
Error GDScriptWorkspace::initialize() {
|
||||||
if (initialized) return OK;
|
if (initialized)
|
||||||
|
return OK;
|
||||||
|
|
||||||
DocData *doc = EditorHelp::get_doc_data();
|
DocData *doc = EditorHelp::get_doc_data();
|
||||||
for (Map<String, DocData::ClassDoc>::Element *E = doc->class_list.front(); E; E = E->next()) {
|
for (Map<String, DocData::ClassDoc>::Element *E = doc->class_list.front(); E; E = E->next()) {
|
||||||
|
|
|
@ -282,7 +282,8 @@ struct Command {
|
||||||
Dictionary dict;
|
Dictionary dict;
|
||||||
dict["title"] = title;
|
dict["title"] = title;
|
||||||
dict["command"] = command;
|
dict["command"] = command;
|
||||||
if (arguments.size()) dict["arguments"] = arguments;
|
if (arguments.size())
|
||||||
|
dict["arguments"] = arguments;
|
||||||
return dict;
|
return dict;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -946,16 +947,20 @@ struct CompletionItem {
|
||||||
dict["preselect"] = preselect;
|
dict["preselect"] = preselect;
|
||||||
dict["sortText"] = sortText;
|
dict["sortText"] = sortText;
|
||||||
dict["filterText"] = filterText;
|
dict["filterText"] = filterText;
|
||||||
if (commitCharacters.size()) dict["commitCharacters"] = commitCharacters;
|
if (commitCharacters.size())
|
||||||
|
dict["commitCharacters"] = commitCharacters;
|
||||||
dict["command"] = command.to_json();
|
dict["command"] = command.to_json();
|
||||||
}
|
}
|
||||||
return dict;
|
return dict;
|
||||||
}
|
}
|
||||||
|
|
||||||
void load(const Dictionary &p_dict) {
|
void load(const Dictionary &p_dict) {
|
||||||
if (p_dict.has("label")) label = p_dict["label"];
|
if (p_dict.has("label"))
|
||||||
if (p_dict.has("kind")) kind = p_dict["kind"];
|
label = p_dict["label"];
|
||||||
if (p_dict.has("detail")) detail = p_dict["detail"];
|
if (p_dict.has("kind"))
|
||||||
|
kind = p_dict["kind"];
|
||||||
|
if (p_dict.has("detail"))
|
||||||
|
detail = p_dict["detail"];
|
||||||
if (p_dict.has("documentation")) {
|
if (p_dict.has("documentation")) {
|
||||||
Variant doc = p_dict["documentation"];
|
Variant doc = p_dict["documentation"];
|
||||||
if (doc.get_type() == Variant::STRING) {
|
if (doc.get_type() == Variant::STRING) {
|
||||||
|
@ -965,12 +970,18 @@ struct CompletionItem {
|
||||||
documentation.value = v["value"];
|
documentation.value = v["value"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (p_dict.has("deprecated")) deprecated = p_dict["deprecated"];
|
if (p_dict.has("deprecated"))
|
||||||
if (p_dict.has("preselect")) preselect = p_dict["preselect"];
|
deprecated = p_dict["deprecated"];
|
||||||
if (p_dict.has("sortText")) sortText = p_dict["sortText"];
|
if (p_dict.has("preselect"))
|
||||||
if (p_dict.has("filterText")) filterText = p_dict["filterText"];
|
preselect = p_dict["preselect"];
|
||||||
if (p_dict.has("insertText")) insertText = p_dict["insertText"];
|
if (p_dict.has("sortText"))
|
||||||
if (p_dict.has("data")) data = p_dict["data"];
|
sortText = p_dict["sortText"];
|
||||||
|
if (p_dict.has("filterText"))
|
||||||
|
filterText = p_dict["filterText"];
|
||||||
|
if (p_dict.has("insertText"))
|
||||||
|
insertText = p_dict["insertText"];
|
||||||
|
if (p_dict.has("data"))
|
||||||
|
data = p_dict["data"];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -152,7 +152,8 @@ Variant JSONRPC::process_action(const Variant &p_action, bool p_process_arr_elem
|
||||||
|
|
||||||
String JSONRPC::process_string(const String &p_input) {
|
String JSONRPC::process_string(const String &p_input) {
|
||||||
|
|
||||||
if (p_input.empty()) return String();
|
if (p_input.empty())
|
||||||
|
return String();
|
||||||
|
|
||||||
Variant ret;
|
Variant ret;
|
||||||
Variant input;
|
Variant input;
|
||||||
|
|
|
@ -387,7 +387,8 @@ Vector3 LightmapperCPU::_fix_sample_position(const Vector3 &p_position, const Ve
|
||||||
|
|
||||||
for (int i = -1; i <= 1; i += 1) {
|
for (int i = -1; i <= 1; i += 1) {
|
||||||
for (int j = -1; j <= 1; j += 1) {
|
for (int j = -1; j <= 1; j += 1) {
|
||||||
if (i == 0 && j == 0) continue;
|
if (i == 0 && j == 0)
|
||||||
|
continue;
|
||||||
Vector3 offset = Vector3(half_size.x * i, half_size.y * j, 0.0);
|
Vector3 offset = Vector3(half_size.x * i, half_size.y * j, 0.0);
|
||||||
Vector3 rotated_offset = tangent_basis.xform_inv(offset);
|
Vector3 rotated_offset = tangent_basis.xform_inv(offset);
|
||||||
Vector3 target = p_texel_center + rotated_offset;
|
Vector3 target = p_texel_center + rotated_offset;
|
||||||
|
|
|
@ -36,7 +36,8 @@
|
||||||
|
|
||||||
int PacketPeerMbedDTLS::bio_send(void *ctx, const unsigned char *buf, size_t len) {
|
int PacketPeerMbedDTLS::bio_send(void *ctx, const unsigned char *buf, size_t len) {
|
||||||
|
|
||||||
if (buf == NULL || len <= 0) return 0;
|
if (buf == NULL || len <= 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
PacketPeerMbedDTLS *sp = (PacketPeerMbedDTLS *)ctx;
|
PacketPeerMbedDTLS *sp = (PacketPeerMbedDTLS *)ctx;
|
||||||
|
|
||||||
|
@ -53,7 +54,8 @@ int PacketPeerMbedDTLS::bio_send(void *ctx, const unsigned char *buf, size_t len
|
||||||
|
|
||||||
int PacketPeerMbedDTLS::bio_recv(void *ctx, unsigned char *buf, size_t len) {
|
int PacketPeerMbedDTLS::bio_recv(void *ctx, unsigned char *buf, size_t len) {
|
||||||
|
|
||||||
if (buf == NULL || len <= 0) return 0;
|
if (buf == NULL || len <= 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
PacketPeerMbedDTLS *sp = (PacketPeerMbedDTLS *)ctx;
|
PacketPeerMbedDTLS *sp = (PacketPeerMbedDTLS *)ctx;
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,8 @@
|
||||||
|
|
||||||
int StreamPeerMbedTLS::bio_send(void *ctx, const unsigned char *buf, size_t len) {
|
int StreamPeerMbedTLS::bio_send(void *ctx, const unsigned char *buf, size_t len) {
|
||||||
|
|
||||||
if (buf == NULL || len <= 0) return 0;
|
if (buf == NULL || len <= 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
StreamPeerMbedTLS *sp = (StreamPeerMbedTLS *)ctx;
|
StreamPeerMbedTLS *sp = (StreamPeerMbedTLS *)ctx;
|
||||||
|
|
||||||
|
@ -54,7 +55,8 @@ int StreamPeerMbedTLS::bio_send(void *ctx, const unsigned char *buf, size_t len)
|
||||||
|
|
||||||
int StreamPeerMbedTLS::bio_recv(void *ctx, unsigned char *buf, size_t len) {
|
int StreamPeerMbedTLS::bio_recv(void *ctx, unsigned char *buf, size_t len) {
|
||||||
|
|
||||||
if (buf == NULL || len <= 0) return 0;
|
if (buf == NULL || len <= 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
StreamPeerMbedTLS *sp = (StreamPeerMbedTLS *)ctx;
|
StreamPeerMbedTLS *sp = (StreamPeerMbedTLS *)ctx;
|
||||||
|
|
||||||
|
|
|
@ -59,13 +59,19 @@ Vector3 MobileVRInterface::scale_magneto(const Vector3 &p_magnetometer) {
|
||||||
};
|
};
|
||||||
|
|
||||||
// adjust our min and max
|
// adjust our min and max
|
||||||
if (mag_raw.x > mag_next_max.x) mag_next_max.x = mag_raw.x;
|
if (mag_raw.x > mag_next_max.x)
|
||||||
if (mag_raw.y > mag_next_max.y) mag_next_max.y = mag_raw.y;
|
mag_next_max.x = mag_raw.x;
|
||||||
if (mag_raw.z > mag_next_max.z) mag_next_max.z = mag_raw.z;
|
if (mag_raw.y > mag_next_max.y)
|
||||||
|
mag_next_max.y = mag_raw.y;
|
||||||
|
if (mag_raw.z > mag_next_max.z)
|
||||||
|
mag_next_max.z = mag_raw.z;
|
||||||
|
|
||||||
if (mag_raw.x < mag_next_min.x) mag_next_min.x = mag_raw.x;
|
if (mag_raw.x < mag_next_min.x)
|
||||||
if (mag_raw.y < mag_next_min.y) mag_next_min.y = mag_raw.y;
|
mag_next_min.x = mag_raw.x;
|
||||||
if (mag_raw.z < mag_next_min.z) mag_next_min.z = mag_raw.z;
|
if (mag_raw.y < mag_next_min.y)
|
||||||
|
mag_next_min.y = mag_raw.y;
|
||||||
|
if (mag_raw.z < mag_next_min.z)
|
||||||
|
mag_next_min.z = mag_raw.z;
|
||||||
|
|
||||||
// scale our x, y and z
|
// scale our x, y and z
|
||||||
if (!(mag_current_max.x - mag_current_min.x)) {
|
if (!(mag_current_max.x - mag_current_min.x)) {
|
||||||
|
|
|
@ -573,7 +573,8 @@ class BindingsGenerator {
|
||||||
const List<InternalCall>::Element *find_icall_by_name(const String &p_name, const List<InternalCall> &p_list) {
|
const List<InternalCall>::Element *find_icall_by_name(const String &p_name, const List<InternalCall> &p_list) {
|
||||||
const List<InternalCall>::Element *it = p_list.front();
|
const List<InternalCall>::Element *it = p_list.front();
|
||||||
while (it) {
|
while (it) {
|
||||||
if (it->get().name == p_name) return it;
|
if (it->get().name == p_name)
|
||||||
|
return it;
|
||||||
it = it->next();
|
it = it->next();
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -525,9 +525,10 @@ namespace Marshal {
|
||||||
|
|
||||||
#ifdef MONO_GLUE_ENABLED
|
#ifdef MONO_GLUE_ENABLED
|
||||||
#ifdef TOOLS_ENABLED
|
#ifdef TOOLS_ENABLED
|
||||||
#define NO_GLUE_RET(m_ret) \
|
#define NO_GLUE_RET(m_ret) \
|
||||||
{ \
|
{ \
|
||||||
if (!GDMonoCache::cached_data.godot_api_cache_updated) return m_ret; \
|
if (!GDMonoCache::cached_data.godot_api_cache_updated) \
|
||||||
|
return m_ret; \
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#define NO_GLUE_RET(m_ret) \
|
#define NO_GLUE_RET(m_ret) \
|
||||||
|
|
|
@ -194,19 +194,22 @@ Ref<OpenSimplexNoise> NoiseTexture::get_noise() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void NoiseTexture::set_width(int p_width) {
|
void NoiseTexture::set_width(int p_width) {
|
||||||
if (p_width == size.x) return;
|
if (p_width == size.x)
|
||||||
|
return;
|
||||||
size.x = p_width;
|
size.x = p_width;
|
||||||
_queue_update();
|
_queue_update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NoiseTexture::set_height(int p_height) {
|
void NoiseTexture::set_height(int p_height) {
|
||||||
if (p_height == size.y) return;
|
if (p_height == size.y)
|
||||||
|
return;
|
||||||
size.y = p_height;
|
size.y = p_height;
|
||||||
_queue_update();
|
_queue_update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NoiseTexture::set_seamless(bool p_seamless) {
|
void NoiseTexture::set_seamless(bool p_seamless) {
|
||||||
if (p_seamless == seamless) return;
|
if (p_seamless == seamless)
|
||||||
|
return;
|
||||||
seamless = p_seamless;
|
seamless = p_seamless;
|
||||||
_queue_update();
|
_queue_update();
|
||||||
}
|
}
|
||||||
|
@ -216,7 +219,8 @@ bool NoiseTexture::get_seamless() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void NoiseTexture::set_as_normalmap(bool p_as_normalmap) {
|
void NoiseTexture::set_as_normalmap(bool p_as_normalmap) {
|
||||||
if (p_as_normalmap == as_normalmap) return;
|
if (p_as_normalmap == as_normalmap)
|
||||||
|
return;
|
||||||
as_normalmap = p_as_normalmap;
|
as_normalmap = p_as_normalmap;
|
||||||
_queue_update();
|
_queue_update();
|
||||||
_change_notify();
|
_change_notify();
|
||||||
|
@ -228,7 +232,8 @@ bool NoiseTexture::is_normalmap() {
|
||||||
|
|
||||||
void NoiseTexture::set_bump_strength(float p_bump_strength) {
|
void NoiseTexture::set_bump_strength(float p_bump_strength) {
|
||||||
|
|
||||||
if (p_bump_strength == bump_strength) return;
|
if (p_bump_strength == bump_strength)
|
||||||
|
return;
|
||||||
bump_strength = p_bump_strength;
|
bump_strength = p_bump_strength;
|
||||||
if (as_normalmap)
|
if (as_normalmap)
|
||||||
_queue_update();
|
_queue_update();
|
||||||
|
|
|
@ -70,7 +70,8 @@ int OpenSimplexNoise::get_seed() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenSimplexNoise::set_octaves(int p_octaves) {
|
void OpenSimplexNoise::set_octaves(int p_octaves) {
|
||||||
if (p_octaves == octaves) return;
|
if (p_octaves == octaves)
|
||||||
|
return;
|
||||||
|
|
||||||
ERR_FAIL_COND_MSG(p_octaves > MAX_OCTAVES, vformat("The number of OpenSimplexNoise octaves is limited to %d; ignoring the new value.", MAX_OCTAVES));
|
ERR_FAIL_COND_MSG(p_octaves > MAX_OCTAVES, vformat("The number of OpenSimplexNoise octaves is limited to %d; ignoring the new value.", MAX_OCTAVES));
|
||||||
|
|
||||||
|
@ -79,19 +80,22 @@ void OpenSimplexNoise::set_octaves(int p_octaves) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenSimplexNoise::set_period(float p_period) {
|
void OpenSimplexNoise::set_period(float p_period) {
|
||||||
if (p_period == period) return;
|
if (p_period == period)
|
||||||
|
return;
|
||||||
period = p_period;
|
period = p_period;
|
||||||
emit_changed();
|
emit_changed();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenSimplexNoise::set_persistence(float p_persistence) {
|
void OpenSimplexNoise::set_persistence(float p_persistence) {
|
||||||
if (p_persistence == persistence) return;
|
if (p_persistence == persistence)
|
||||||
|
return;
|
||||||
persistence = p_persistence;
|
persistence = p_persistence;
|
||||||
emit_changed();
|
emit_changed();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenSimplexNoise::set_lacunarity(float p_lacunarity) {
|
void OpenSimplexNoise::set_lacunarity(float p_lacunarity) {
|
||||||
if (p_lacunarity == lacunarity) return;
|
if (p_lacunarity == lacunarity)
|
||||||
|
return;
|
||||||
lacunarity = p_lacunarity;
|
lacunarity = p_lacunarity;
|
||||||
emit_changed();
|
emit_changed();
|
||||||
}
|
}
|
||||||
|
|
|
@ -207,7 +207,8 @@ void VideoStreamPlaybackTheora::set_file(const String &p_file) {
|
||||||
|
|
||||||
while (!stateflag) {
|
while (!stateflag) {
|
||||||
int ret = buffer_data();
|
int ret = buffer_data();
|
||||||
if (ret == 0) break;
|
if (ret == 0)
|
||||||
|
break;
|
||||||
while (ogg_sync_pageout(&oy, &og) > 0) {
|
while (ogg_sync_pageout(&oy, &og) > 0) {
|
||||||
ogg_stream_state test;
|
ogg_stream_state test;
|
||||||
|
|
||||||
|
@ -284,7 +285,8 @@ void VideoStreamPlaybackTheora::set_file(const String &p_file) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
vorbis_p++;
|
vorbis_p++;
|
||||||
if (vorbis_p == 3) break;
|
if (vorbis_p == 3)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The header pages/packets will arrive before anything else we
|
/* The header pages/packets will arrive before anything else we
|
||||||
|
|
|
@ -144,7 +144,8 @@ void WebRTCMultiplayer::poll() {
|
||||||
|
|
||||||
void WebRTCMultiplayer::_find_next_peer() {
|
void WebRTCMultiplayer::_find_next_peer() {
|
||||||
Map<int, Ref<ConnectedPeer>>::Element *E = peer_map.find(next_packet_peer);
|
Map<int, Ref<ConnectedPeer>>::Element *E = peer_map.find(next_packet_peer);
|
||||||
if (E) E = E->next();
|
if (E)
|
||||||
|
E = E->next();
|
||||||
// After last.
|
// After last.
|
||||||
while (E) {
|
while (E) {
|
||||||
for (List<Ref<WebRTCDataChannel>>::Element *F = E->get()->channels.front(); F; F = F->next()) {
|
for (List<Ref<WebRTCDataChannel>>::Element *F = E->get()->channels.front(); F; F = F->next()) {
|
||||||
|
|
|
@ -424,7 +424,8 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
|
||||||
}
|
}
|
||||||
|
|
||||||
d.name = vendor + " " + device;
|
d.name = vendor + " " + device;
|
||||||
if (device == String()) continue;
|
if (device == String())
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
ndevices.push_back(d);
|
ndevices.push_back(d);
|
||||||
|
|
|
@ -1064,7 +1064,8 @@ public class Godot extends Fragment implements SensorEventListener, IDownloaderC
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
for (int i = cc.length; --i >= 0; cnt += cc[i] != 0 ? 1 : 0)
|
for (int i = cc.length; --i >= 0; cnt += cc[i] != 0 ? 1 : 0)
|
||||||
;
|
;
|
||||||
if (cnt == 0) return false;
|
if (cnt == 0)
|
||||||
|
return false;
|
||||||
mView.queueEvent(new Runnable() {
|
mView.queueEvent(new Runnable() {
|
||||||
// This method will be called on the rendering thread:
|
// This method will be called on the rendering thread:
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
|
@ -610,7 +610,8 @@ String EditorExportPlatformIOS::_get_linker_flags() {
|
||||||
String result;
|
String result;
|
||||||
for (int i = 0; i < export_plugins.size(); ++i) {
|
for (int i = 0; i < export_plugins.size(); ++i) {
|
||||||
String flags = export_plugins[i]->get_ios_linker_flags();
|
String flags = export_plugins[i]->get_ios_linker_flags();
|
||||||
if (flags.length() == 0) continue;
|
if (flags.length() == 0)
|
||||||
|
continue;
|
||||||
if (result.length() > 0) {
|
if (result.length() > 0) {
|
||||||
result += ' ';
|
result += ' ';
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,8 @@ int iphone_main(int argc, char **argv, String data_dir) {
|
||||||
size_t len = strlen(argv[0]);
|
size_t len = strlen(argv[0]);
|
||||||
|
|
||||||
while (len--) {
|
while (len--) {
|
||||||
if (argv[0][len] == '/') break;
|
if (argv[0][len] == '/')
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (len >= 0) {
|
if (len >= 0) {
|
||||||
|
|
|
@ -381,7 +381,8 @@ bool joypad::check_ff_features() {
|
||||||
if (ret == FF_OK && (features.supportedEffects & FFCAP_ET_CONSTANTFORCE)) {
|
if (ret == FF_OK && (features.supportedEffects & FFCAP_ET_CONSTANTFORCE)) {
|
||||||
uint32_t val;
|
uint32_t val;
|
||||||
ret = FFDeviceGetForceFeedbackProperty(ff_device, FFPROP_FFGAIN, &val, sizeof(val));
|
ret = FFDeviceGetForceFeedbackProperty(ff_device, FFPROP_FFGAIN, &val, sizeof(val));
|
||||||
if (ret != FF_OK) return false;
|
if (ret != FF_OK)
|
||||||
|
return false;
|
||||||
int num_axes = features.numFfAxes;
|
int num_axes = features.numFfAxes;
|
||||||
ff_axes = (DWORD *)memalloc(sizeof(DWORD) * num_axes);
|
ff_axes = (DWORD *)memalloc(sizeof(DWORD) * num_axes);
|
||||||
ff_directions = (LONG *)memalloc(sizeof(LONG) * num_axes);
|
ff_directions = (LONG *)memalloc(sizeof(LONG) * num_axes);
|
||||||
|
@ -516,14 +517,16 @@ void JoypadOSX::joypad_vibration_stop(int p_id, uint64_t p_timestamp) {
|
||||||
|
|
||||||
int JoypadOSX::get_joy_index(int p_id) const {
|
int JoypadOSX::get_joy_index(int p_id) const {
|
||||||
for (int i = 0; i < device_list.size(); i++) {
|
for (int i = 0; i < device_list.size(); i++) {
|
||||||
if (device_list[i].id == p_id) return i;
|
if (device_list[i].id == p_id)
|
||||||
|
return i;
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int JoypadOSX::get_joy_ref(IOHIDDeviceRef p_device) const {
|
int JoypadOSX::get_joy_ref(IOHIDDeviceRef p_device) const {
|
||||||
for (int i = 0; i < device_list.size(); i++) {
|
for (int i = 0; i < device_list.size(); i++) {
|
||||||
if (device_list[i].device_ref == p_device) return i;
|
if (device_list[i].device_ref == p_device)
|
||||||
|
return i;
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2867,13 +2867,15 @@ void OS_OSX::request_attention() {
|
||||||
|
|
||||||
bool OS_OSX::get_window_per_pixel_transparency_enabled() const {
|
bool OS_OSX::get_window_per_pixel_transparency_enabled() const {
|
||||||
|
|
||||||
if (!is_layered_allowed()) return false;
|
if (!is_layered_allowed())
|
||||||
|
return false;
|
||||||
return layered_window;
|
return layered_window;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OS_OSX::set_window_per_pixel_transparency_enabled(bool p_enabled) {
|
void OS_OSX::set_window_per_pixel_transparency_enabled(bool p_enabled) {
|
||||||
|
|
||||||
if (!is_layered_allowed()) return;
|
if (!is_layered_allowed())
|
||||||
|
return;
|
||||||
if (layered_window != p_enabled) {
|
if (layered_window != p_enabled) {
|
||||||
if (p_enabled) {
|
if (p_enabled) {
|
||||||
GLint opacity = 0;
|
GLint opacity = 0;
|
||||||
|
|
|
@ -265,7 +265,8 @@ void AppxPackager::make_content_types(const String &p_path) {
|
||||||
|
|
||||||
String ext = file_metadata[i].name.get_extension().to_lower();
|
String ext = file_metadata[i].name.get_extension().to_lower();
|
||||||
|
|
||||||
if (types.has(ext)) continue;
|
if (types.has(ext))
|
||||||
|
continue;
|
||||||
|
|
||||||
types[ext] = content_type(ext);
|
types[ext] = content_type(ext);
|
||||||
|
|
||||||
|
@ -664,8 +665,10 @@ class EditorExportPlatformUWP : public EditorExportPlatform {
|
||||||
|
|
||||||
bool _valid_resource_name(const String &p_name) const {
|
bool _valid_resource_name(const String &p_name) const {
|
||||||
|
|
||||||
if (p_name.empty()) return false;
|
if (p_name.empty())
|
||||||
if (p_name.ends_with(".")) return false;
|
return false;
|
||||||
|
if (p_name.ends_with("."))
|
||||||
|
return false;
|
||||||
|
|
||||||
static const char *invalid_names[] = {
|
static const char *invalid_names[] = {
|
||||||
"CON", "PRN", "AUX", "NUL", "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7",
|
"CON", "PRN", "AUX", "NUL", "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7",
|
||||||
|
@ -675,7 +678,8 @@ class EditorExportPlatformUWP : public EditorExportPlatform {
|
||||||
|
|
||||||
const char **t = invalid_names;
|
const char **t = invalid_names;
|
||||||
while (*t) {
|
while (*t) {
|
||||||
if (p_name == *t) return false;
|
if (p_name == *t)
|
||||||
|
return false;
|
||||||
t++;
|
t++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -686,19 +690,25 @@ class EditorExportPlatformUWP : public EditorExportPlatform {
|
||||||
|
|
||||||
Vector<String> parts = p_guid.split("-");
|
Vector<String> parts = p_guid.split("-");
|
||||||
|
|
||||||
if (parts.size() != 5) return false;
|
if (parts.size() != 5)
|
||||||
if (parts[0].length() != 8) return false;
|
return false;
|
||||||
|
if (parts[0].length() != 8)
|
||||||
|
return false;
|
||||||
for (int i = 1; i < 4; i++)
|
for (int i = 1; i < 4; i++)
|
||||||
if (parts[i].length() != 4) return false;
|
if (parts[i].length() != 4)
|
||||||
if (parts[4].length() != 12) return false;
|
return false;
|
||||||
|
if (parts[4].length() != 12)
|
||||||
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool _valid_bgcolor(const String &p_color) const {
|
bool _valid_bgcolor(const String &p_color) const {
|
||||||
|
|
||||||
if (p_color.empty()) return true;
|
if (p_color.empty())
|
||||||
if (p_color.begins_with("#") && p_color.is_valid_html_color()) return true;
|
return true;
|
||||||
|
if (p_color.begins_with("#") && p_color.is_valid_html_color())
|
||||||
|
return true;
|
||||||
|
|
||||||
// Colors from https://msdn.microsoft.com/en-us/library/windows/apps/dn934817.aspx
|
// Colors from https://msdn.microsoft.com/en-us/library/windows/apps/dn934817.aspx
|
||||||
static const char *valid_colors[] = {
|
static const char *valid_colors[] = {
|
||||||
|
@ -732,7 +742,8 @@ class EditorExportPlatformUWP : public EditorExportPlatform {
|
||||||
const char **color = valid_colors;
|
const char **color = valid_colors;
|
||||||
|
|
||||||
while (*color) {
|
while (*color) {
|
||||||
if (p_color == *color) return true;
|
if (p_color == *color)
|
||||||
|
return true;
|
||||||
color++;
|
color++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -881,7 +892,8 @@ class EditorExportPlatformUWP : public EditorExportPlatform {
|
||||||
ERR_PRINT("Unable to load logo");
|
ERR_PRINT("Unable to load logo");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!image) return data;
|
if (!image)
|
||||||
|
return data;
|
||||||
|
|
||||||
String tmp_path = EditorSettings::get_singleton()->get_cache_dir().plus_file("uwp_tmp_logo.png");
|
String tmp_path = EditorSettings::get_singleton()->get_cache_dir().plus_file("uwp_tmp_logo.png");
|
||||||
|
|
||||||
|
@ -1287,7 +1299,8 @@ public:
|
||||||
path = path.replace(".scale-100", "");
|
path = path.replace(".scale-100", "");
|
||||||
|
|
||||||
data = _get_image_data(p_preset, path);
|
data = _get_image_data(p_preset, path);
|
||||||
if (data.size() > 0) do_read = false;
|
if (data.size() > 0)
|
||||||
|
do_read = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//read
|
//read
|
||||||
|
|
|
@ -48,7 +48,8 @@ void JoypadUWP::process_controllers() {
|
||||||
|
|
||||||
ControllerDevice &joy = controllers[i];
|
ControllerDevice &joy = controllers[i];
|
||||||
|
|
||||||
if (!joy.connected) break;
|
if (!joy.connected)
|
||||||
|
break;
|
||||||
|
|
||||||
switch (joy.type) {
|
switch (joy.type) {
|
||||||
|
|
||||||
|
|
|
@ -120,7 +120,8 @@ bool OS_UWP::is_window_fullscreen() const {
|
||||||
|
|
||||||
void OS_UWP::set_keep_screen_on(bool p_enabled) {
|
void OS_UWP::set_keep_screen_on(bool p_enabled) {
|
||||||
|
|
||||||
if (is_keep_screen_on() == p_enabled) return;
|
if (is_keep_screen_on() == p_enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
if (p_enabled)
|
if (p_enabled)
|
||||||
display_request->RequestActive();
|
display_request->RequestActive();
|
||||||
|
@ -873,7 +874,8 @@ void OS_UWP::run() {
|
||||||
while (!force_quit) {
|
while (!force_quit) {
|
||||||
|
|
||||||
CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessAllIfPresent);
|
CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessAllIfPresent);
|
||||||
if (managed_object->alert_close_handle) continue;
|
if (managed_object->alert_close_handle)
|
||||||
|
continue;
|
||||||
process_events(); // get rid of pending events
|
process_events(); // get rid of pending events
|
||||||
if (Main::iteration())
|
if (Main::iteration())
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -281,7 +281,8 @@ void JoypadWindows::close_joypad(int id) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!d_joypads[id].attached) return;
|
if (!d_joypads[id].attached)
|
||||||
|
return;
|
||||||
|
|
||||||
d_joypads[id].di_joy->Unacquire();
|
d_joypads[id].di_joy->Unacquire();
|
||||||
d_joypads[id].di_joy->Release();
|
d_joypads[id].di_joy->Release();
|
||||||
|
|
|
@ -2090,7 +2090,8 @@ Point2 OS_Windows::get_window_position() const {
|
||||||
|
|
||||||
void OS_Windows::set_window_position(const Point2 &p_position) {
|
void OS_Windows::set_window_position(const Point2 &p_position) {
|
||||||
|
|
||||||
if (video_mode.fullscreen) return;
|
if (video_mode.fullscreen)
|
||||||
|
return;
|
||||||
RECT r;
|
RECT r;
|
||||||
GetWindowRect(hWnd, &r);
|
GetWindowRect(hWnd, &r);
|
||||||
MoveWindow(hWnd, p_position.x, p_position.y, r.right - r.left, r.bottom - r.top, TRUE);
|
MoveWindow(hWnd, p_position.x, p_position.y, r.right - r.left, r.bottom - r.top, TRUE);
|
||||||
|
@ -2327,13 +2328,15 @@ bool OS_Windows::is_console_visible() const {
|
||||||
|
|
||||||
bool OS_Windows::get_window_per_pixel_transparency_enabled() const {
|
bool OS_Windows::get_window_per_pixel_transparency_enabled() const {
|
||||||
|
|
||||||
if (!is_layered_allowed()) return false;
|
if (!is_layered_allowed())
|
||||||
|
return false;
|
||||||
return layered_window;
|
return layered_window;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OS_Windows::set_window_per_pixel_transparency_enabled(bool p_enabled) {
|
void OS_Windows::set_window_per_pixel_transparency_enabled(bool p_enabled) {
|
||||||
|
|
||||||
if (!is_layered_allowed()) return;
|
if (!is_layered_allowed())
|
||||||
|
return;
|
||||||
if (layered_window != p_enabled) {
|
if (layered_window != p_enabled) {
|
||||||
if (p_enabled) {
|
if (p_enabled) {
|
||||||
//enable per-pixel alpha
|
//enable per-pixel alpha
|
||||||
|
@ -3294,19 +3297,22 @@ OS::LatinKeyboardVariant OS_Windows::get_latin_keyboard_variant() const {
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (azerty[i] != 0) {
|
while (azerty[i] != 0) {
|
||||||
if (azerty[i] == hex) return LATIN_KEYBOARD_AZERTY;
|
if (azerty[i] == hex)
|
||||||
|
return LATIN_KEYBOARD_AZERTY;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
while (qwertz[i] != 0) {
|
while (qwertz[i] != 0) {
|
||||||
if (qwertz[i] == hex) return LATIN_KEYBOARD_QWERTZ;
|
if (qwertz[i] == hex)
|
||||||
|
return LATIN_KEYBOARD_QWERTZ;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
while (dvorak[i] != 0) {
|
while (dvorak[i] != 0) {
|
||||||
if (dvorak[i] == hex) return LATIN_KEYBOARD_DVORAK;
|
if (dvorak[i] == hex)
|
||||||
|
return LATIN_KEYBOARD_DVORAK;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -179,7 +179,8 @@ int detect_prime() {
|
||||||
|
|
||||||
close(fdset[0]);
|
close(fdset[0]);
|
||||||
|
|
||||||
if (i) setenv("DRI_PRIME", "1", 1);
|
if (i)
|
||||||
|
setenv("DRI_PRIME", "1", 1);
|
||||||
create_context();
|
create_context();
|
||||||
|
|
||||||
const char *vendor = (const char *)glGetString(GL_VENDOR);
|
const char *vendor = (const char *)glGetString(GL_VENDOR);
|
||||||
|
|
|
@ -492,7 +492,8 @@ void JoypadLinux::process_joypads() {
|
||||||
}
|
}
|
||||||
for (int i = 0; i < JOYPADS_MAX; i++) {
|
for (int i = 0; i < JOYPADS_MAX; i++) {
|
||||||
|
|
||||||
if (joypads[i].fd == -1) continue;
|
if (joypads[i].fd == -1)
|
||||||
|
continue;
|
||||||
|
|
||||||
input_event events[32];
|
input_event events[32];
|
||||||
Joypad *joy = &joypads[i];
|
Joypad *joy = &joypads[i];
|
||||||
|
|
|
@ -980,13 +980,15 @@ Point2 OS_X11::get_mouse_position() const {
|
||||||
|
|
||||||
bool OS_X11::get_window_per_pixel_transparency_enabled() const {
|
bool OS_X11::get_window_per_pixel_transparency_enabled() const {
|
||||||
|
|
||||||
if (!is_layered_allowed()) return false;
|
if (!is_layered_allowed())
|
||||||
|
return false;
|
||||||
return layered_window;
|
return layered_window;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OS_X11::set_window_per_pixel_transparency_enabled(bool p_enabled) {
|
void OS_X11::set_window_per_pixel_transparency_enabled(bool p_enabled) {
|
||||||
|
|
||||||
if (!is_layered_allowed()) return;
|
if (!is_layered_allowed())
|
||||||
|
return;
|
||||||
if (layered_window != p_enabled) {
|
if (layered_window != p_enabled) {
|
||||||
if (p_enabled) {
|
if (p_enabled) {
|
||||||
layered_window = true;
|
layered_window = true;
|
||||||
|
@ -1150,7 +1152,8 @@ int OS_X11::get_screen_count() const {
|
||||||
// Using Xinerama Extension
|
// Using Xinerama Extension
|
||||||
int event_base, error_base;
|
int event_base, error_base;
|
||||||
const Bool ext_okay = XineramaQueryExtension(x11_display, &event_base, &error_base);
|
const Bool ext_okay = XineramaQueryExtension(x11_display, &event_base, &error_base);
|
||||||
if (!ext_okay) return 0;
|
if (!ext_okay)
|
||||||
|
return 0;
|
||||||
|
|
||||||
int count;
|
int count;
|
||||||
XineramaScreenInfo *xsi = XineramaQueryScreens(x11_display, &count);
|
XineramaScreenInfo *xsi = XineramaQueryScreens(x11_display, &count);
|
||||||
|
@ -1227,7 +1230,8 @@ Size2 OS_X11::get_screen_size(int p_screen) const {
|
||||||
// Using Xinerama Extension
|
// Using Xinerama Extension
|
||||||
int event_base, error_base;
|
int event_base, error_base;
|
||||||
const Bool ext_okay = XineramaQueryExtension(x11_display, &event_base, &error_base);
|
const Bool ext_okay = XineramaQueryExtension(x11_display, &event_base, &error_base);
|
||||||
if (!ext_okay) return Size2i(0, 0);
|
if (!ext_okay)
|
||||||
|
return Size2i(0, 0);
|
||||||
|
|
||||||
int count;
|
int count;
|
||||||
XineramaScreenInfo *xsi = XineramaQueryScreens(x11_display, &count);
|
XineramaScreenInfo *xsi = XineramaQueryScreens(x11_display, &count);
|
||||||
|
|
|
@ -226,9 +226,11 @@ private:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
_FORCE_INLINE_ void _notify_transform() {
|
_FORCE_INLINE_ void _notify_transform() {
|
||||||
if (!is_inside_tree()) return;
|
if (!is_inside_tree())
|
||||||
|
return;
|
||||||
_notify_transform(this);
|
_notify_transform(this);
|
||||||
if (!block_transform_notify && notify_local_transform) notification(NOTIFICATION_LOCAL_TRANSFORM_CHANGED);
|
if (!block_transform_notify && notify_local_transform)
|
||||||
|
notification(NOTIFICATION_LOCAL_TRANSFORM_CHANGED);
|
||||||
}
|
}
|
||||||
|
|
||||||
void item_rect_changed(bool p_size_changed = true);
|
void item_rect_changed(bool p_size_changed = true);
|
||||||
|
|
|
@ -970,7 +970,8 @@ void CPUParticles2D::_particles_process(float p_delta) {
|
||||||
|
|
||||||
//scale by scale
|
//scale by scale
|
||||||
float base_scale = tex_scale * Math::lerp(parameters[PARAM_SCALE], 1.0f, p.scale_rand * randomness[PARAM_SCALE]);
|
float base_scale = tex_scale * Math::lerp(parameters[PARAM_SCALE], 1.0f, p.scale_rand * randomness[PARAM_SCALE]);
|
||||||
if (base_scale < 0.000001) base_scale = 0.000001;
|
if (base_scale < 0.000001)
|
||||||
|
base_scale = 0.000001;
|
||||||
|
|
||||||
p.transform.elements[0] *= base_scale;
|
p.transform.elements[0] *= base_scale;
|
||||||
p.transform.elements[1] *= base_scale;
|
p.transform.elements[1] *= base_scale;
|
||||||
|
@ -1206,7 +1207,8 @@ void CPUParticles2D::convert_from_particles(Node *p_particles) {
|
||||||
set_param(m_param, material->get_param(ParticlesMaterial::m_param)); \
|
set_param(m_param, material->get_param(ParticlesMaterial::m_param)); \
|
||||||
{ \
|
{ \
|
||||||
Ref<CurveTexture> ctex = material->get_param_texture(ParticlesMaterial::m_param); \
|
Ref<CurveTexture> ctex = material->get_param_texture(ParticlesMaterial::m_param); \
|
||||||
if (ctex.is_valid()) set_param_curve(m_param, ctex->get_curve()); \
|
if (ctex.is_valid()) \
|
||||||
|
set_param_curve(m_param, ctex->get_curve()); \
|
||||||
} \
|
} \
|
||||||
set_param_randomness(m_param, material->get_param_randomness(ParticlesMaterial::m_param));
|
set_param_randomness(m_param, material->get_param_randomness(ParticlesMaterial::m_param));
|
||||||
|
|
||||||
|
|
|
@ -1535,7 +1535,8 @@ Vector2 KinematicCollision2D::get_remainder() const {
|
||||||
return collision.remainder;
|
return collision.remainder;
|
||||||
}
|
}
|
||||||
Object *KinematicCollision2D::get_local_shape() const {
|
Object *KinematicCollision2D::get_local_shape() const {
|
||||||
if (!owner) return NULL;
|
if (!owner)
|
||||||
|
return NULL;
|
||||||
uint32_t ownerid = owner->shape_find_owner(collision.local_shape);
|
uint32_t ownerid = owner->shape_find_owner(collision.local_shape);
|
||||||
return owner->shape_owner_get_owner(ownerid);
|
return owner->shape_owner_get_owner(ownerid);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1355,7 +1355,8 @@ bool TileMap::get_collision_use_parent() const {
|
||||||
|
|
||||||
void TileMap::set_collision_use_parent(bool p_use_parent) {
|
void TileMap::set_collision_use_parent(bool p_use_parent) {
|
||||||
|
|
||||||
if (use_parent == p_use_parent) return;
|
if (use_parent == p_use_parent)
|
||||||
|
return;
|
||||||
|
|
||||||
_clear_quadrants();
|
_clear_quadrants();
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue