Skip to content

Commit

Permalink
Make expression can recognize float ending with dot
Browse files Browse the repository at this point in the history
  • Loading branch information
akien-mga authored and jsjtxietian committed Apr 17, 2024
2 parents 41fc152 + 2a757e4 commit 20d6606
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
5 changes: 4 additions & 1 deletion core/math/expression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ Error Expression::_get_token(Token &r_token) {
}

char32_t next_char = (str_ofs >= expression.length()) ? 0 : expression[str_ofs];
if (is_digit(cchar) || (cchar == '.' && is_digit(next_char))) {
if (is_digit(cchar) || cchar == '.') {
//a number

String num;
Expand Down Expand Up @@ -1039,6 +1039,9 @@ Expression::ENode *Expression::_parse_expression() {
case TK_OP_BIT_INVERT:
op = Variant::OP_BIT_NEGATE;
break;
case TK_IDENTIFIER:
_set_error("Unexpected character.");
return nullptr;
default: {
}
}
Expand Down
8 changes: 6 additions & 2 deletions modules/fbx/fbx_document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -990,8 +990,8 @@ Error FBXDocument::_parse_images(Ref<FBXState> p_state, const String &p_base_pat
for (int texture_i = 0; texture_i < static_cast<int>(fbx_scene->texture_files.count); texture_i++) {
const ufbx_texture_file &fbx_texture_file = fbx_scene->texture_files[texture_i];
String path = _as_string(fbx_texture_file.filename);
path = ProjectSettings::get_singleton()->localize_path(path);
if (path.is_absolute_path() && !path.is_resource_file()) {
// Use only filename for absolute paths to avoid portability issues.
if (path.is_absolute_path()) {
path = path.get_file();
}
if (!p_base_path.is_empty()) {
Expand Down Expand Up @@ -2239,6 +2239,10 @@ Error FBXDocument::_parse_lights(Ref<FBXState> p_state) {
}

String FBXDocument::_get_texture_path(const String &p_base_dir, const String &p_source_file_path) const {
// Check if the original path exists first.
if (FileAccess::exists(p_source_file_path)) {
return p_source_file_path.strip_edges();
}
const String tex_file_name = p_source_file_path.get_file();
const Vector<String> subdirs = {
"", "textures/", "Textures/", "images/",
Expand Down

0 comments on commit 20d6606

Please sign in to comment.