summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
Diffstat (limited to 'scene')
-rw-r--r--scene/3d/baked_lightmap.cpp12
-rw-r--r--scene/3d/baked_lightmap.h2
-rw-r--r--scene/3d/portal.h3
-rw-r--r--scene/3d/room_instance.h2
-rw-r--r--scene/3d/voxel_light_baker.cpp53
-rw-r--r--scene/gui/control.cpp2
-rw-r--r--scene/gui/line_edit.cpp33
-rw-r--r--scene/gui/line_edit.h5
-rw-r--r--scene/gui/text_edit.cpp16
-rw-r--r--scene/gui/text_edit.h2
-rw-r--r--scene/main/viewport.cpp3
-rw-r--r--scene/resources/mesh.cpp7
-rw-r--r--scene/resources/packed_scene.cpp13
-rw-r--r--scene/resources/packed_scene.h2
-rw-r--r--scene/resources/room.h2
15 files changed, 76 insertions, 81 deletions
diff --git a/scene/3d/baked_lightmap.cpp b/scene/3d/baked_lightmap.cpp
index 3d9bb73181..7afac94e71 100644
--- a/scene/3d/baked_lightmap.cpp
+++ b/scene/3d/baked_lightmap.cpp
@@ -298,7 +298,7 @@ BakedLightmap::BakeError BakedLightmap::bake(Node *p_from_node, bool p_create_vi
Ref<BakedLightmapData> new_light_data;
new_light_data.instance();
- static const int subdiv_value[SUBDIV_MAX] = { 8, 9, 10, 11, 12, 13 };
+ static const int subdiv_value[SUBDIV_MAX] = { 8, 9, 10, 11 };
VoxelLightBaker baker;
@@ -678,7 +678,7 @@ void BakedLightmap::_bind_methods() {
ClassDB::bind_method(D_METHOD("debug_bake"), &BakedLightmap::_debug_bake);
ClassDB::set_method_flags(get_class_static(), _scs_create("debug_bake"), METHOD_FLAGS_DEFAULT | METHOD_FLAG_EDITOR);
- ADD_PROPERTY(PropertyInfo(Variant::INT, "bake_subdiv", PROPERTY_HINT_ENUM, "128,256,512,1024,2048,4096"), "set_bake_subdiv", "get_bake_subdiv");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "bake_subdiv", PROPERTY_HINT_ENUM, "128,256,512,1024"), "set_bake_subdiv", "get_bake_subdiv");
ADD_PROPERTY(PropertyInfo(Variant::INT, "capture_subdiv", PROPERTY_HINT_ENUM, "128,256,512"), "set_capture_subdiv", "get_capture_subdiv");
ADD_PROPERTY(PropertyInfo(Variant::INT, "bake_quality", PROPERTY_HINT_ENUM, "Low,Medium,High"), "set_bake_quality", "get_bake_quality");
ADD_PROPERTY(PropertyInfo(Variant::INT, "bake_mode", PROPERTY_HINT_ENUM, "ConeTrace,RayTrace"), "set_bake_mode", "get_bake_mode");
@@ -693,8 +693,6 @@ void BakedLightmap::_bind_methods() {
BIND_ENUM_CONSTANT(SUBDIV_256);
BIND_ENUM_CONSTANT(SUBDIV_512);
BIND_ENUM_CONSTANT(SUBDIV_1024);
- BIND_ENUM_CONSTANT(SUBDIV_2048);
- BIND_ENUM_CONSTANT(SUBDIV_4096);
BIND_ENUM_CONSTANT(SUBDIV_MAX);
BIND_ENUM_CONSTANT(BAKE_QUALITY_LOW);
@@ -702,6 +700,12 @@ void BakedLightmap::_bind_methods() {
BIND_ENUM_CONSTANT(BAKE_QUALITY_HIGH);
BIND_ENUM_CONSTANT(BAKE_MODE_CONE_TRACE);
BIND_ENUM_CONSTANT(BAKE_MODE_RAY_TRACE);
+
+ BIND_ENUM_CONSTANT(BAKE_ERROR_OK);
+ BIND_ENUM_CONSTANT(BAKE_ERROR_NO_SAVE_PATH);
+ BIND_ENUM_CONSTANT(BAKE_ERROR_NO_MESHES);
+ BIND_ENUM_CONSTANT(BAKE_ERROR_CANT_CREATE_IMAGE);
+ BIND_ENUM_CONSTANT(BAKE_ERROR_USER_ABORTED);
}
BakedLightmap::BakedLightmap() {
diff --git a/scene/3d/baked_lightmap.h b/scene/3d/baked_lightmap.h
index 5595ec1e61..f63749a0b4 100644
--- a/scene/3d/baked_lightmap.h
+++ b/scene/3d/baked_lightmap.h
@@ -64,8 +64,6 @@ public:
SUBDIV_256,
SUBDIV_512,
SUBDIV_1024,
- SUBDIV_2048,
- SUBDIV_4096,
SUBDIV_MAX
};
diff --git a/scene/3d/portal.h b/scene/3d/portal.h
index 4ea208a718..a3a7956286 100644
--- a/scene/3d/portal.h
+++ b/scene/3d/portal.h
@@ -39,7 +39,8 @@
If a portal is placed next (very close to) a similar, opposing portal, they automatically connect,
otherwise, a portal connects to the parent room
*/
-//this will be redone and replaced by area portals, left for reference since a new class with this name will have to exist and want to reuse the gizmos
+// FIXME: This will be redone and replaced by area portals, left for reference
+// since a new class with this name will have to exist and want to reuse the gizmos
#if 0
class Portal : public VisualInstance {
diff --git a/scene/3d/room_instance.h b/scene/3d/room_instance.h
index 3069ea2eba..2b2f80a0c6 100644
--- a/scene/3d/room_instance.h
+++ b/scene/3d/room_instance.h
@@ -44,7 +44,7 @@
*/
-//this will be removed, left for reference
+// FIXME: this will be removed, left for reference
#if 0
class Room : public VisualInstance {
diff --git a/scene/3d/voxel_light_baker.cpp b/scene/3d/voxel_light_baker.cpp
index 98dc1590d8..39ff6fa35e 100644
--- a/scene/3d/voxel_light_baker.cpp
+++ b/scene/3d/voxel_light_baker.cpp
@@ -897,17 +897,7 @@ void VoxelLightBaker::plot_light_omni(const Vector3 &p_pos, const Color &p_color
float dt = CLAMP((d + distance_adv) / local_radius, 0, 1);
att *= powf(1.0 - dt, p_attenutation);
}
-#if 0
- if (light_cache.type == VS::LIGHT_SPOT) {
-
- float angle = Math::rad2deg(acos(light_axis.dot(spot_axis)));
- if (angle > light_cache.spot_angle)
- continue;
- float d = CLAMP(angle / light_cache.spot_angle, 1, 0);
- att *= powf(1.0 - d, light_cache.spot_attenuation);
- }
-#endif
clip_planes = 0;
for (int c = 0; c < 3; c++) {
@@ -1041,17 +1031,7 @@ void VoxelLightBaker::plot_light_spot(const Vector3 &p_pos, const Vector3 &p_axi
float dt = CLAMP((d + distance_adv) / local_radius, 0, 1);
att *= powf(1.0 - dt, p_attenutation);
}
-#if 0
- if (light_cache.type == VS::LIGHT_SPOT) {
-
- float angle = Math::rad2deg(acos(light_axis.dot(spot_axis)));
- if (angle > light_cache.spot_angle)
- continue;
- float d = CLAMP(angle / light_cache.spot_angle, 1, 0);
- att *= powf(1.0 - d, light_cache.spot_attenuation);
- }
-#endif
clip_planes = 0;
for (int c = 0; c < 3; c++) {
@@ -1614,6 +1594,18 @@ Vector3 VoxelLightBaker::_compute_pixel_light_at_pos(const Vector3 &p_pos, const
return accum;
}
+uint32_t xorshiftstate[] = { 123 }; // anything non-zero will do here
+
+_ALWAYS_INLINE_ uint32_t xorshift32() {
+ /* Algorithm "xor" from p. 4 of Marsaglia, "Xorshift RNGs" */
+ uint32_t x = xorshiftstate[0];
+ x ^= x << 13;
+ x ^= x >> 17;
+ x ^= x << 5;
+ xorshiftstate[0] = x;
+ return x;
+}
+
Vector3 VoxelLightBaker::_compute_ray_trace_at_pos(const Vector3 &p_pos, const Vector3 &p_normal) {
int samples_per_quality[3] = { 48, 128, 512 };
@@ -1638,9 +1630,9 @@ Vector3 VoxelLightBaker::_compute_ray_trace_at_pos(const Vector3 &p_pos, const V
for (int i = 0; i < samples; i++) {
- float random_angle1 = (((Math::rand() % 65535) / 65535.0) * 2.0 - 1.0) * spread;
+ float random_angle1 = (((xorshift32() % 65535) / 65535.0) * 2.0 - 1.0) * spread;
Vector3 axis(0, sin(random_angle1), cos(random_angle1));
- float random_angle2 = ((Math::rand() % 65535) / 65535.0) * Math_PI * 2.0;
+ float random_angle2 = ((xorshift32() % 65535) / 65535.0) * Math_PI * 2.0;
Basis rot(Vector3(0, 0, 1), random_angle2);
axis = rot.xform(axis);
@@ -1692,7 +1684,7 @@ Vector3 VoxelLightBaker::_compute_ray_trace_at_pos(const Vector3 &p_pos, const V
}
cell = bc->childs[child];
- if (cell == CHILD_EMPTY)
+ if (unlikely(cell == CHILD_EMPTY))
break;
half >>= 1;
@@ -1701,12 +1693,12 @@ Vector3 VoxelLightBaker::_compute_ray_trace_at_pos(const Vector3 &p_pos, const V
pos += advance;
}
- if (cell != CHILD_EMPTY) {
+ if (unlikely(cell != CHILD_EMPTY)) {
for (int i = 0; i < 6; i++) {
//anisotropic read light
float amount = direction.dot(aniso_normal[i]);
- if (amount < 0)
- amount = 0;
+ if (amount <= 0)
+ continue;
accum.x += light[cell].accum[i][0] * amount;
accum.y += light[cell].accum[i][1] * amount;
accum.z += light[cell].accum[i][2] * amount;
@@ -1781,7 +1773,7 @@ Error VoxelLightBaker::make_lightmap(const Transform &p_xform, Ref<Mesh> &p_mesh
//print_line("bake line " + itos(i) + " / " + itos(height));
#ifdef _OPENMP
-#pragma omp parallel for
+#pragma omp parallel for schedule(dynamic, 1)
#endif
for (int j = 0; j < width; j++) {
@@ -1878,12 +1870,14 @@ Error VoxelLightBaker::make_lightmap(const Transform &p_xform, Ref<Mesh> &p_mesh
LightMap *lightmap_ptr = lightmap.ptrw();
const Cell *cells = bake_cells.ptr();
const Light *light = bake_light.ptr();
-
+#ifdef _OPENMP
+#pragma omp parallel
+#endif
for (int i = 0; i < height; i++) {
//print_line("bake line " + itos(i) + " / " + itos(height));
#ifdef _OPENMP
-#pragma omp parallel for
+#pragma omp parallel for schedule(dynamic, 1)
#endif
for (int j = 0; j < width; j++) {
@@ -2002,6 +1996,7 @@ Error VoxelLightBaker::make_lightmap(const Transform &p_xform, Ref<Mesh> &p_mesh
}
}
+// Enable for debugging
#if 0
{
PoolVector<uint8_t> img;
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index 81d2b6731f..b34abf5a46 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -2835,7 +2835,7 @@ void Control::_bind_methods() {
ADD_PROPERTYNZ(PropertyInfo(Variant::REAL, "rect_rotation", PROPERTY_HINT_RANGE, "-1080,1080,0.01"), "set_rotation_degrees", "get_rotation_degrees");
ADD_PROPERTYNO(PropertyInfo(Variant::VECTOR2, "rect_scale"), "set_scale", "get_scale");
ADD_PROPERTYNO(PropertyInfo(Variant::VECTOR2, "rect_pivot_offset"), "set_pivot_offset", "get_pivot_offset");
- ADD_PROPERTYNO(PropertyInfo(Variant::BOOL, "rect_clip_content"), "set_clip_contents", "is_clipping_contents");
+ ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "rect_clip_content"), "set_clip_contents", "is_clipping_contents");
ADD_GROUP("Hint", "hint_");
ADD_PROPERTYNZ(PropertyInfo(Variant::STRING, "hint_tooltip", PROPERTY_HINT_MULTILINE_TEXT), "set_tooltip", "_get_tooltip");
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index 85ae6d6241..cebbb2193d 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -85,7 +85,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
if ((cursor_pos < selection.begin) || (cursor_pos > selection.end) || !selection.enabled) {
- selection_clear();
+ deselect();
selection.cursor_start = cursor_pos;
selection.creating = true;
} else if (selection.enabled) {
@@ -99,7 +99,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
} else {
if ((!selection.creating) && (!selection.doubleclick)) {
- selection_clear();
+ deselect();
}
selection.creating = false;
selection.doubleclick = false;
@@ -175,7 +175,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
if (editable) {
- selection_clear();
+ deselect();
text = text.substr(cursor_pos, text.length() - cursor_pos);
Ref<Font> font = get_font("font");
@@ -204,7 +204,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
if (editable) {
- selection_clear();
+ deselect();
text = text.substr(0, cursor_pos);
_text_changed();
}
@@ -827,7 +827,7 @@ void LineEdit::shift_selection_check_pre(bool p_shift) {
selection.cursor_start = cursor_pos;
}
if (!p_shift)
- selection_clear();
+ deselect();
}
void LineEdit::shift_selection_check_post(bool p_shift) {
@@ -880,13 +880,6 @@ void LineEdit::set_cursor_at_pixel_pos(int p_x) {
}
set_cursor_position(ofs);
-
- /*
- int new_cursor_pos=p_x;
- int charwidth=draw_area->get_font_char_width(' ',0);
- new_cursor_pos=( ( (new_cursor_pos-2)+ (charwidth/2) ) /charwidth );
- if (new_cursor_pos>(int)text.length()) new_cursor_pos=text.length();
- set_cursor_position(window_pos+new_cursor_pos); */
}
bool LineEdit::cursor_get_blink_enabled() const {
@@ -941,11 +934,6 @@ void LineEdit::delete_char() {
set_cursor_position(get_cursor_position() - 1);
- if (cursor_pos == window_pos) {
-
- //set_window_pos(cursor_pos-get_window_length());
- }
-
_text_changed();
}
@@ -1143,7 +1131,7 @@ Size2 LineEdit::get_minimum_size() const {
/* selection */
-void LineEdit::selection_clear() {
+void LineEdit::deselect() {
selection.begin = 0;
selection.end = 0;
@@ -1159,7 +1147,7 @@ void LineEdit::selection_delete() {
if (selection.enabled)
delete_text(selection.begin, selection.end);
- selection_clear();
+ deselect();
}
void LineEdit::set_max_length(int p_max_length) {
@@ -1224,7 +1212,7 @@ bool LineEdit::is_secret() const {
void LineEdit::select(int p_from, int p_to) {
if (p_from == 0 && p_to == 0) {
- selection_clear();
+ deselect();
return;
}
@@ -1383,7 +1371,9 @@ void LineEdit::_bind_methods() {
ClassDB::bind_method(D_METHOD("_gui_input"), &LineEdit::_gui_input);
ClassDB::bind_method(D_METHOD("clear"), &LineEdit::clear);
+ ClassDB::bind_method(D_METHOD("select", "from", "to"), &LineEdit::select, DEFVAL(0), DEFVAL(-1));
ClassDB::bind_method(D_METHOD("select_all"), &LineEdit::select_all);
+ ClassDB::bind_method(D_METHOD("deselect"), &LineEdit::deselect);
ClassDB::bind_method(D_METHOD("set_text", "text"), &LineEdit::set_text);
ClassDB::bind_method(D_METHOD("get_text"), &LineEdit::get_text);
ClassDB::bind_method(D_METHOD("set_placeholder", "text"), &LineEdit::set_placeholder);
@@ -1405,7 +1395,6 @@ void LineEdit::_bind_methods() {
ClassDB::bind_method(D_METHOD("is_editable"), &LineEdit::is_editable);
ClassDB::bind_method(D_METHOD("set_secret", "enabled"), &LineEdit::set_secret);
ClassDB::bind_method(D_METHOD("is_secret"), &LineEdit::is_secret);
- ClassDB::bind_method(D_METHOD("select", "from", "to"), &LineEdit::select, DEFVAL(0), DEFVAL(-1));
ClassDB::bind_method(D_METHOD("menu_option", "option"), &LineEdit::menu_option);
ClassDB::bind_method(D_METHOD("get_menu"), &LineEdit::get_menu);
ClassDB::bind_method(D_METHOD("set_context_menu_enabled", "enable"), &LineEdit::set_context_menu_enabled);
@@ -1457,7 +1446,7 @@ LineEdit::LineEdit() {
pass = false;
placeholder_alpha = 0.6;
- selection_clear();
+ deselect();
set_focus_mode(FOCUS_ALL);
editable = true;
set_default_cursor_shape(CURSOR_IBEAM);
diff --git a/scene/gui/line_edit.h b/scene/gui/line_edit.h
index c3a299c2f5..5ca4ca15df 100644
--- a/scene/gui/line_edit.h
+++ b/scene/gui/line_edit.h
@@ -119,7 +119,6 @@ private:
void shift_selection_check_pre(bool);
void shift_selection_check_post(bool);
- void selection_clear();
void selection_fill_at_cursor();
void selection_delete();
void set_window_pos(int p_pos);
@@ -155,7 +154,9 @@ public:
bool is_context_menu_enabled();
PopupMenu *get_menu() const;
+ void select(int p_from = 0, int p_to = -1);
void select_all();
+ void deselect();
void delete_char();
void delete_text(int p_from_column, int p_to_column);
@@ -190,8 +191,6 @@ public:
void set_secret(bool p_secret);
bool is_secret() const;
- void select(int p_from = 0, int p_to = -1);
-
virtual Size2 get_minimum_size() const;
void set_expand_to_text_length(bool p_enabled);
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 2ce709732c..07f1bdf8e5 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -4084,7 +4084,7 @@ void TextEdit::cut() {
backspace_at_cursor();
update();
cursor_set_line(cursor.line + 1);
- cut_copy_line = true;
+ cut_copy_line = clipboard;
} else {
@@ -4098,7 +4098,7 @@ void TextEdit::cut() {
selection.active = false;
selection.selecting_mode = Selection::MODE_NONE;
update();
- cut_copy_line = false;
+ cut_copy_line = "";
}
}
@@ -4107,11 +4107,11 @@ void TextEdit::copy() {
if (!selection.active) {
String clipboard = _base_get_text(cursor.line, 0, cursor.line, text[cursor.line].length());
OS::get_singleton()->set_clipboard(clipboard);
- cut_copy_line = true;
+ cut_copy_line = clipboard;
} else {
String clipboard = _base_get_text(selection.from_line, selection.from_column, selection.to_line, selection.to_column);
OS::get_singleton()->set_clipboard(clipboard);
- cut_copy_line = false;
+ cut_copy_line = "";
}
}
@@ -4127,7 +4127,7 @@ void TextEdit::paste() {
cursor_set_line(selection.from_line);
cursor_set_column(selection.from_column);
- } else if (cut_copy_line) {
+ } else if (!cut_copy_line.empty() && cut_copy_line == clipboard) {
cursor_set_column(0);
String ins = "\n";
@@ -5468,8 +5468,10 @@ void TextEdit::_bind_methods() {
ClassDB::bind_method(D_METHOD("cut"), &TextEdit::cut);
ClassDB::bind_method(D_METHOD("copy"), &TextEdit::copy);
ClassDB::bind_method(D_METHOD("paste"), &TextEdit::paste);
- ClassDB::bind_method(D_METHOD("select_all"), &TextEdit::select_all);
+
ClassDB::bind_method(D_METHOD("select", "from_line", "from_column", "to_line", "to_column"), &TextEdit::select);
+ ClassDB::bind_method(D_METHOD("select_all"), &TextEdit::select_all);
+ ClassDB::bind_method(D_METHOD("deselect"), &TextEdit::deselect);
ClassDB::bind_method(D_METHOD("is_selection_active"), &TextEdit::is_selection_active);
ClassDB::bind_method(D_METHOD("get_selection_from_line"), &TextEdit::get_selection_from_line);
@@ -5681,4 +5683,4 @@ TextEdit::TextEdit() {
}
TextEdit::~TextEdit() {
-} \ No newline at end of file
+}
diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h
index edef28cc25..836d5c7388 100644
--- a/scene/gui/text_edit.h
+++ b/scene/gui/text_edit.h
@@ -270,7 +270,7 @@ class TextEdit : public Control {
bool brace_matching_enabled;
bool highlight_current_line;
bool auto_indent;
- bool cut_copy_line;
+ String cut_copy_line;
bool insert_mode;
bool select_identifiers_enabled;
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 1666aa5415..f5d7043a40 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -1811,8 +1811,7 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
_gui_call_input(gui.mouse_focus, mb);
}
- if (mb->get_button_mask() == 0) {
- // Last mouse button was released
+ if (mb->get_button_index() == gui.mouse_focus_button) {
gui.mouse_focus = NULL;
gui.mouse_focus_button = -1;
}
diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp
index bb33962be6..bf5f7bf039 100644
--- a/scene/resources/mesh.cpp
+++ b/scene/resources/mesh.cpp
@@ -1111,13 +1111,14 @@ Error ArrayMesh::lightmap_unwrap(const Transform &p_base_transform, float p_texe
for (int j = 0; j < vc; j++) {
Vector3 v = p_base_transform.xform(r[j]);
+ Vector3 n = p_base_transform.basis.xform(rn[j]).normalized();
vertices[(j + vertex_ofs) * 3 + 0] = v.x;
vertices[(j + vertex_ofs) * 3 + 1] = v.y;
vertices[(j + vertex_ofs) * 3 + 2] = v.z;
- normals[(j + vertex_ofs) * 3 + 0] = rn[j].x;
- normals[(j + vertex_ofs) * 3 + 1] = rn[j].y;
- normals[(j + vertex_ofs) * 3 + 2] = rn[j].z;
+ normals[(j + vertex_ofs) * 3 + 0] = n.x;
+ normals[(j + vertex_ofs) * 3 + 1] = n.y;
+ normals[(j + vertex_ofs) * 3 + 2] = n.z;
uv_index[j + vertex_ofs] = Pair<int, int>(i, j);
}
diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp
index fdf0035a05..879f76e6d8 100644
--- a/scene/resources/packed_scene.cpp
+++ b/scene/resources/packed_scene.cpp
@@ -1117,9 +1117,11 @@ void SceneState::set_bundled_scene(const Dictionary &p_dictionary) {
nd.parent = r[idx++];
nd.owner = r[idx++];
nd.type = r[idx++];
- nd.name = r[idx++];
+ uint32_t name_index = r[idx++];
+ nd.name = name_index & ((1 << NAME_INDEX_BITS) - 1);
+ nd.index = (name_index >> NAME_INDEX_BITS);
+ nd.index--; //0 is invaild, stored as 1
nd.instance = r[idx++];
- nd.index = r[idx++];
nd.properties.resize(r[idx++]);
for (int j = 0; j < nd.properties.size(); j++) {
@@ -1210,9 +1212,12 @@ Dictionary SceneState::get_bundled_scene() const {
rnodes.push_back(nd.parent);
rnodes.push_back(nd.owner);
rnodes.push_back(nd.type);
- rnodes.push_back(nd.name);
+ uint32_t name_index = nd.name;
+ if (nd.index < (1 << (32 - NAME_INDEX_BITS)) - 1) { //save if less than 16k childs
+ name_index |= uint32_t(nd.index + 1) << NAME_INDEX_BITS; //for backwards compatibility, index 0 is no index
+ }
+ rnodes.push_back(name_index);
rnodes.push_back(nd.instance);
- rnodes.push_back(nd.index);
rnodes.push_back(nd.properties.size());
for (int j = 0; j < nd.properties.size(); j++) {
diff --git a/scene/resources/packed_scene.h b/scene/resources/packed_scene.h
index 83920c8041..70deea24ff 100644
--- a/scene/resources/packed_scene.h
+++ b/scene/resources/packed_scene.h
@@ -48,6 +48,8 @@ class SceneState : public Reference {
enum {
NO_PARENT_SAVED = 0x7FFFFFFF,
+ NAME_INDEX_BITS = 18,
+ NAME_MASK = (1 << NAME_INDEX_BITS) - 1,
};
struct NodeData {
diff --git a/scene/resources/room.h b/scene/resources/room.h
index aadee858c2..0e021cfcf7 100644
--- a/scene/resources/room.h
+++ b/scene/resources/room.h
@@ -36,7 +36,7 @@
@author Juan Linietsky <reduzio@gmail.com>
*/
-//left for reference but will be removed when portals are reimplemented using Area
+// FIXME: left for reference but will be removed when portals are reimplemented using Area
#if 0
class RoomBounds : public Resource {