Merge pull request #42565 from akien-mga/3.2-cherrypicks

Cherry-picks for the 3.2 branch (future 3.2.4) - 4th batch
This commit is contained in:
Rémi Verschelde 2020-10-05 08:29:10 +02:00 committed by GitHub
commit 68b192b62e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 49 additions and 46 deletions

View File

@ -276,7 +276,11 @@ void ScriptServer::save_global_classes() {
gcarr.push_back(d);
}
ProjectSettings::get_singleton()->set("_global_script_classes", gcarr);
if (gcarr.empty()) {
ProjectSettings::get_singleton()->clear("_global_script_classes");
} else {
ProjectSettings::get_singleton()->set("_global_script_classes", gcarr);
}
ProjectSettings::get_singleton()->save();
}

View File

@ -4182,11 +4182,12 @@ String String::sprintf(const Array &values, bool *error) const {
int number_len = str.length();
// Padding.
int pad_chars_count = (value < 0 || show_sign) ? min_chars - 1 : min_chars;
String pad_char = pad_with_zeroes ? String("0") : String(" ");
if (left_justified) {
str = str.rpad(min_chars, pad_char);
str = str.rpad(pad_chars_count, pad_char);
} else {
str = str.lpad(min_chars, pad_char);
str = str.lpad(pad_chars_count, pad_char);
}
// Sign.

View File

@ -681,6 +681,17 @@
Sets the update mode (see [enum UpdateMode]) of a value track.
</description>
</method>
<method name="value_track_interpolate" qualifiers="const">
<return type="float">
</return>
<argument index="0" name="track_idx" type="int">
</argument>
<argument index="1" name="time_sec" type="float">
</argument>
<description>
Returns the interpolated value at the given time (in seconds). The [code]track_idx[/code] must be the index of a value track.
</description>
</method>
</methods>
<members>
<member name="length" type="float" setter="set_length" getter="get_length" default="1.0">

View File

@ -136,7 +136,7 @@
</description>
</method>
<method name="get_priority" qualifiers="virtual">
<return type="String">
<return type="int">
</return>
<description>
Override this method to set the gizmo's priority. Higher values correspond to higher priority. If a gizmo with higher priority conflicts with another gizmo, only the gizmo with higher priority will be used.

View File

@ -45,13 +45,13 @@
The height of the 9-slice's bottom row. A margin of 16 means the 9-slice's bottom corners and side will have a height of 16 pixels. You can set all 4 margin values individually to create panels with non-uniform borders.
</member>
<member name="patch_margin_left" type="int" setter="set_patch_margin" getter="get_patch_margin" default="0">
The height of the 9-slice's left column.
The width of the 9-slice's left column. A margin of 16 means the 9-slice's left corners and side will have a width of 16 pixels. You can set all 4 margin values individually to create panels with non-uniform borders.
</member>
<member name="patch_margin_right" type="int" setter="set_patch_margin" getter="get_patch_margin" default="0">
The height of the 9-slice's right column.
The width of the 9-slice's right column. A margin of 16 means the 9-slice's right corners and side will have a width of 16 pixels. You can set all 4 margin values individually to create panels with non-uniform borders.
</member>
<member name="patch_margin_top" type="int" setter="set_patch_margin" getter="get_patch_margin" default="0">
The height of the 9-slice's top row.
The height of the 9-slice's top row. A margin of 16 means the 9-slice's top corners and side will have a height of 16 pixels. You can set all 4 margin values individually to create panels with non-uniform borders.
</member>
<member name="region_rect" type="Rect2" setter="set_region_rect" getter="get_region_rect" default="Rect2( 0, 0, 0, 0 )">
Rectangular region of the texture to sample from. If you're working with an atlas, use this property to define the area the 9-slice should use. All other properties are relative to this one. If the rect is empty, NinePatchRect will use the whole texture.

View File

@ -6,7 +6,6 @@
<description>
Singleton used to load resource files from the filesystem.
It uses the many [ResourceFormatLoader] classes registered in the engine (either built-in or from a plugin) to load files into memory and convert them to a format that can be used by the engine.
GDScript has a simplified [method @GDScript.load] built-in method which can be used in most situations, leaving the use of [ResourceLoader] for more advanced scenarios.
</description>
<tutorials>
</tutorials>
@ -74,7 +73,8 @@
The registered [ResourceFormatLoader]s are queried sequentially to find the first one which can handle the file's extension, and then attempt loading. If loading fails, the remaining ResourceFormatLoaders are also attempted.
An optional [code]type_hint[/code] can be used to further specify the [Resource] type that should be handled by the [ResourceFormatLoader].
If [code]no_cache[/code] is [code]true[/code], the resource cache will be bypassed and the resource will be loaded anew. Otherwise, the cached resource will be returned if it exists.
Returns an empty resource if no ResourceFormatLoader could handle the file.
Returns an empty resource if no [ResourceFormatLoader] could handle the file.
GDScript has a simplified [method @GDScript.load] built-in method which can be used in most situations, leaving the use of [ResourceLoader] for more advanced scenarios.
</description>
</method>
<method name="load_interactive">

View File

@ -140,7 +140,7 @@
</member>
<member name="contacts_reported" type="int" setter="set_max_contacts_reported" getter="get_max_contacts_reported" default="0">
The maximum number of contacts that will be recorded. Requires [member contact_monitor] to be set to [code]true[/code].
[b]Note:[/b] The number of contacts is different from the number of collisions. Collisions between parallel edges will result in two contacts (one at each end), and collisions between parallel faces will result in four contacts (one at each corner).
[b]Note:[/b] The number of contacts is different from the number of collisions. Collisions between parallel edges will result in two contacts (one at each end).
</member>
<member name="continuous_cd" type="int" setter="set_continuous_collision_detection_mode" getter="get_continuous_collision_detection_mode" enum="RigidBody2D.CCDMode" default="0">
Continuous collision detection mode.

View File

@ -965,7 +965,11 @@ void EditorData::script_class_save_icon_paths() {
d[E->get()] = _script_class_icon_paths[E->get()];
}
ProjectSettings::get_singleton()->set("_global_script_class_icons", d);
if (d.empty()) {
ProjectSettings::get_singleton()->clear("_global_script_class_icons");
} else {
ProjectSettings::get_singleton()->set("_global_script_class_icons", d);
}
ProjectSettings::get_singleton()->save();
}

View File

@ -6624,7 +6624,7 @@ void EditorSpatialGizmoPlugin::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_material", "name", "gizmo"), &EditorSpatialGizmoPlugin::get_material); //, DEFVAL(Ref<EditorSpatialGizmo>()));
BIND_VMETHOD(MethodInfo(Variant::STRING, "get_name"));
BIND_VMETHOD(MethodInfo(Variant::STRING, "get_priority"));
BIND_VMETHOD(MethodInfo(Variant::INT, "get_priority"));
BIND_VMETHOD(MethodInfo(Variant::BOOL, "can_be_hidden"));
BIND_VMETHOD(MethodInfo(Variant::BOOL, "is_selectable_when_hidden"));

View File

@ -101,9 +101,9 @@ void UNSCALE_BT_BASIS(btTransform &scaledBasis) {
btVector3 column2 = basis.getColumn(2);
// Check for zero scaling.
if (btFuzzyZero(column0[0])) {
if (btFuzzyZero(column1[1])) {
if (btFuzzyZero(column2[2])) {
if (column0.fuzzyZero()) {
if (column1.fuzzyZero()) {
if (column2.fuzzyZero()) {
// All dimensions are fuzzy zero. Create a default basis.
column0 = btVector3(1, 0, 0);
column1 = btVector3(0, 1, 0);
@ -115,7 +115,7 @@ void UNSCALE_BT_BASIS(btTransform &scaledBasis) {
column0 = column1.cross(column2);
}
} else { // Column 1 scale not fuzzy zero.
if (btFuzzyZero(column2[2])) {
if (column2.fuzzyZero()) {
// Create two vectors othogonal to column 1.
// Ensure that a default basis is created if column 1 = <0, 1, 0>
column0 = btVector3(column1[1], -column1[0], 0);
@ -126,8 +126,8 @@ void UNSCALE_BT_BASIS(btTransform &scaledBasis) {
}
}
} else { // Column 0 scale not fuzzy zero.
if (btFuzzyZero(column1[1])) {
if (btFuzzyZero(column2[2])) {
if (column1.fuzzyZero()) {
if (column2.fuzzyZero()) {
// Create two vectors orthogonal to column 0.
// Ensure that a default basis is created if column 0 = <1, 0, 0>
column2 = btVector3(-column0[2], 0, column0[0]);
@ -137,7 +137,7 @@ void UNSCALE_BT_BASIS(btTransform &scaledBasis) {
column1 = column2.cross(column0);
}
} else { // Column 0 and column 1 scales not fuzzy zero.
if (btFuzzyZero(column2[2])) {
if (column2.fuzzyZero()) {
// Create column 2 orthogonal to column 0 and column 1.
column2 = column0.cross(column1);
}

View File

@ -634,6 +634,7 @@
var main = load("res://main.tscn") # main will contain a PackedScene resource.
[/codeblock]
[b]Important:[/b] The path must be absolute, a local path will just return [code]null[/code].
This method is a simplified version of [method ResourceLoader.load], which can be used for more advanced scenarios.
</description>
</method>
<method name="log">
@ -766,7 +767,7 @@
Returns the integer modulus of [code]a/b[/code] that wraps equally in positive and negative.
[codeblock]
for i in range(-3, 4):
print("%2.0f %2.0f %2.0f" % [i, i % 3, posmod(i, 3)])
print("%2d %2d %2d" % [i, i % 3, posmod(i, 3)])
[/codeblock]
Produces:
[codeblock]

View File

@ -1,6 +1,7 @@
import os
from emscripten_helpers import parse_config, run_closure_compiler, create_engine_file
from emscripten_helpers import run_closure_compiler, create_engine_file
from SCons.Util import WhereIs
def is_active():
@ -12,7 +13,7 @@ def get_name():
def can_build():
return "EM_CONFIG" in os.environ or os.path.exists(os.path.expanduser("~/.emscripten"))
return WhereIs("emcc") is not None
def get_opts():
@ -100,9 +101,6 @@ def configure(env):
# Closure compiler extern and support for ecmascript specs (const, let, etc).
env["ENV"]["EMCC_CLOSURE_ARGS"] = "--language_in ECMASCRIPT6"
em_config = parse_config()
env.PrependENVPath("PATH", em_config["EMCC_ROOT"])
env["CC"] = "emcc"
env["CXX"] = "em++"
env["LINK"] = "emcc"

View File

@ -1,28 +1,11 @@
import os
def parse_config():
em_config_file = os.getenv("EM_CONFIG") or os.path.expanduser("~/.emscripten")
if not os.path.exists(em_config_file):
raise RuntimeError("Emscripten configuration file '%s' does not exist" % em_config_file)
normalized = {}
em_config = {}
with open(em_config_file) as f:
try:
# Emscripten configuration file is a Python file with simple assignments.
exec(f.read(), em_config)
except StandardError as e:
raise RuntimeError("Emscripten configuration file '%s' is invalid:\n%s" % (em_config_file, e))
normalized["EMCC_ROOT"] = em_config.get("EMSCRIPTEN_ROOT")
normalized["NODE_JS"] = em_config.get("NODE_JS")
normalized["CLOSURE_BIN"] = os.path.join(normalized["EMCC_ROOT"], "node_modules", ".bin", "google-closure-compiler")
return normalized
from SCons.Util import WhereIs
def run_closure_compiler(target, source, env, for_signature):
cfg = parse_config()
cmd = [cfg["NODE_JS"], cfg["CLOSURE_BIN"]]
closure_bin = os.path.join(os.path.dirname(WhereIs("emcc")), "node_modules", ".bin", "google-closure-compiler")
cmd = [WhereIs("node"), closure_bin]
cmd.extend(["--compilation_level", "ADVANCED_OPTIMIZATIONS"])
for f in env["JSEXTERNS"]:
cmd.extend(["--externs", f.get_abspath()])

View File

@ -2788,6 +2788,7 @@ void Animation::_bind_methods() {
ClassDB::bind_method(D_METHOD("value_track_get_update_mode", "track_idx"), &Animation::value_track_get_update_mode);
ClassDB::bind_method(D_METHOD("value_track_get_key_indices", "track_idx", "time_sec", "delta"), &Animation::_value_track_get_key_indices);
ClassDB::bind_method(D_METHOD("value_track_interpolate", "track_idx", "time_sec"), &Animation::value_track_interpolate);
ClassDB::bind_method(D_METHOD("method_track_get_key_indices", "track_idx", "time_sec", "delta"), &Animation::_method_track_get_key_indices);
ClassDB::bind_method(D_METHOD("method_track_get_name", "track_idx", "key_idx"), &Animation::method_track_get_name);

View File

@ -47,7 +47,7 @@ bool CollisionSolver2DSW::solve_static_line(const Shape2DSW *p_shape_A, const Tr
Vector2 supports[2];
int support_count;
p_shape_B->get_supports(p_transform_A.affine_inverse().basis_xform(-n).normalized(), supports, support_count);
p_shape_B->get_supports(p_transform_B.affine_inverse().basis_xform(-n).normalized(), supports, support_count);
bool found = false;