diff options
-rw-r--r-- | SConstruct | 29 | ||||
-rw-r--r-- | doc/classes/AnimationPlayer.xml | 1 | ||||
-rw-r--r-- | drivers/SCsub | 9 | ||||
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 7 | ||||
-rw-r--r-- | methods.py | 47 | ||||
-rw-r--r-- | platform/windows/SCsub | 6 |
6 files changed, 52 insertions, 47 deletions
diff --git a/SConstruct b/SConstruct index b7b0321039..e38e0dc231 100644 --- a/SConstruct +++ b/SConstruct @@ -320,31 +320,6 @@ if selected_platform in platform_list: if env["tools"]: env["tests"] = True - if env["vsproj"]: - env.vs_incs = [] - env.vs_srcs = [] - - def AddToVSProject(sources): - for x in sources: - if type(x) == type(""): - fname = env.File(x).path - else: - fname = env.File(x)[0].path - pieces = fname.split(".") - if len(pieces) > 0: - basename = pieces[0] - basename = basename.replace("\\\\", "/") - if os.path.isfile(basename + ".h"): - env.vs_incs = env.vs_incs + [basename + ".h"] - elif os.path.isfile(basename + ".hpp"): - env.vs_incs = env.vs_incs + [basename + ".hpp"] - if os.path.isfile(basename + ".c"): - env.vs_srcs = env.vs_srcs + [basename + ".c"] - elif os.path.isfile(basename + ".cpp"): - env.vs_srcs = env.vs_srcs + [basename + ".cpp"] - - env.AddToVSProject = AddToVSProject - env.extra_suffix = "" if env["extra_suffix"] != "": @@ -646,6 +621,10 @@ if selected_platform in platform_list: CacheDir(scons_cache_path) print("Scons cache enabled... (path: '" + scons_cache_path + "')") + if env["vsproj"]: + env.vs_incs = [] + env.vs_srcs = [] + Export("env") # Build subdirs, the build order is dependent on link order. diff --git a/doc/classes/AnimationPlayer.xml b/doc/classes/AnimationPlayer.xml index 8396cdb6cf..ac91272e00 100644 --- a/doc/classes/AnimationPlayer.xml +++ b/doc/classes/AnimationPlayer.xml @@ -9,7 +9,6 @@ Updating the target properties of animations occurs at process time. </description> <tutorials> - <link title="Animations">https://docs.godotengine.org/en/latest/getting_started/step_by_step/animations.html</link> <link title="2D Sprite animation">https://docs.godotengine.org/en/latest/tutorials/2d/2d_sprite_animation.html</link> <link title="Animation tutorial index">https://docs.godotengine.org/en/latest/tutorials/animation/index.html</link> </tutorials> diff --git a/drivers/SCsub b/drivers/SCsub index c812057138..e2ac9ee01e 100644 --- a/drivers/SCsub +++ b/drivers/SCsub @@ -32,15 +32,6 @@ else: SConscript("png/SCsub") SConscript("spirv-reflect/SCsub") -if env["vsproj"]: - import os - - path = os.getcwd() - # Change directory so the path resolves correctly in the function call. - os.chdir("..") - env.AddToVSProject(env.drivers_sources) - os.chdir(path) - env.add_source_files(env.drivers_sources, "*.cpp") lib = env.add_library("drivers", env.drivers_sources) diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index d582de4245..ef4ba9819f 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -863,10 +863,11 @@ Vector2 CanvasItemEditor::_position_to_anchor(const Control *p_control, Vector2 ERR_FAIL_COND_V(!p_control, Vector2()); Rect2 parent_rect = p_control->get_parent_anchorable_rect(); - ERR_FAIL_COND_V(parent_rect.size.x == 0, Vector2()); - ERR_FAIL_COND_V(parent_rect.size.y == 0, Vector2()); - return (p_control->get_transform().xform(position) - parent_rect.position) / parent_rect.size; + Vector2 output = Vector2(); + output.x = (parent_rect.size.x == 0) ? 0.0 : (p_control->get_transform().xform(position).x - parent_rect.position.x) / parent_rect.size.x; + output.y = (parent_rect.size.y == 0) ? 0.0 : (p_control->get_transform().xform(position).y - parent_rect.position.y) / parent_rect.size.y; + return output; } void CanvasItemEditor::_save_canvas_item_ik_chain(const CanvasItem *p_canvas_item, List<float> *p_bones_length, List<Dictionary> *p_bones_state) { diff --git a/methods.py b/methods.py index 555d9fa594..f7134b472b 100644 --- a/methods.py +++ b/methods.py @@ -7,6 +7,8 @@ from collections import OrderedDict # We need to define our own `Action` method to control the verbosity of output # and whenever we need to run those commands in a subprocess on some platforms. from SCons.Script import Action +from SCons import Node +from SCons.Script import Glob from platform_methods import run_in_subprocess @@ -526,6 +528,35 @@ def generate_cpp_hint_file(filename): print("Could not write cpp.hint file.") +def glob_recursive(pattern, node="."): + results = [] + for f in Glob(str(node) + "/*", source=True): + if type(f) is Node.FS.Dir: + results += glob_recursive(pattern, f) + results += Glob(str(node) + "/" + pattern, source=True) + return results + + +def add_to_vs_project(env, sources): + for x in sources: + if type(x) == type(""): + fname = env.File(x).path + else: + fname = env.File(x)[0].path + pieces = fname.split(".") + if len(pieces) > 0: + basename = pieces[0] + basename = basename.replace("\\\\", "/") + if os.path.isfile(basename + ".h"): + env.vs_incs += [basename + ".h"] + elif os.path.isfile(basename + ".hpp"): + env.vs_incs += [basename + ".hpp"] + if os.path.isfile(basename + ".c"): + env.vs_srcs += [basename + ".c"] + elif os.path.isfile(basename + ".cpp"): + env.vs_srcs += [basename + ".cpp"] + + def generate_vs_project(env, num_jobs): batch_file = find_visual_c_batch_file(env) if batch_file: @@ -558,12 +589,16 @@ def generate_vs_project(env, num_jobs): result = " ^& ".join(common_build_prefix + [" ".join([commands] + common_build_postfix)]) return result - env.AddToVSProject(env.core_sources) - env.AddToVSProject(env.main_sources) - env.AddToVSProject(env.modules_sources) - env.AddToVSProject(env.scene_sources) - env.AddToVSProject(env.servers_sources) - env.AddToVSProject(env.editor_sources) + add_to_vs_project(env, env.core_sources) + add_to_vs_project(env, env.drivers_sources) + add_to_vs_project(env, env.main_sources) + add_to_vs_project(env, env.modules_sources) + add_to_vs_project(env, env.scene_sources) + add_to_vs_project(env, env.servers_sources) + add_to_vs_project(env, env.editor_sources) + + for header in glob_recursive("**/*.h"): + env.vs_incs.append(str(header)) env["MSVSBUILDCOM"] = build_commandline("scons") env["MSVSREBUILDCOM"] = build_commandline("scons vsproj=yes") diff --git a/platform/windows/SCsub b/platform/windows/SCsub index daffe59f34..e3f86977a4 100644 --- a/platform/windows/SCsub +++ b/platform/windows/SCsub @@ -26,10 +26,10 @@ prog = env.add_program("#bin/godot", common_win + res_obj, PROGSUFFIX=env["PROGS # Microsoft Visual Studio Project Generation if env["vsproj"]: - env.vs_srcs = env.vs_srcs + ["platform/windows/" + res_file] - env.vs_srcs = env.vs_srcs + ["platform/windows/godot.natvis"] + env.vs_srcs += ["platform/windows/" + res_file] + env.vs_srcs += ["platform/windows/godot.natvis"] for x in common_win: - env.vs_srcs = env.vs_srcs + ["platform/windows/" + str(x)] + env.vs_srcs += ["platform/windows/" + str(x)] if not os.getenv("VCINSTALLDIR"): if (env["debug_symbols"] == "full" or env["debug_symbols"] == "yes") and env["separate_debug_symbols"]: |