summaryrefslogtreecommitdiff
path: root/scene/resources
diff options
context:
space:
mode:
Diffstat (limited to 'scene/resources')
-rw-r--r--scene/resources/animation.cpp103
-rw-r--r--scene/resources/animation.h8
-rw-r--r--scene/resources/audio_stream_sample.cpp20
-rw-r--r--scene/resources/audio_stream_sample.h4
-rw-r--r--scene/resources/bit_map.cpp12
-rw-r--r--scene/resources/capsule_shape.cpp26
-rw-r--r--scene/resources/capsule_shape_2d.cpp4
-rw-r--r--scene/resources/circle_shape_2d.cpp2
-rw-r--r--scene/resources/concave_polygon_shape.cpp14
-rw-r--r--scene/resources/concave_polygon_shape.h4
-rw-r--r--scene/resources/concave_polygon_shape_2d.cpp24
-rw-r--r--scene/resources/concave_polygon_shape_2d.h4
-rw-r--r--scene/resources/convex_polygon_shape.cpp10
-rw-r--r--scene/resources/convex_polygon_shape.h6
-rw-r--r--scene/resources/convex_polygon_shape_2d.cpp2
-rw-r--r--scene/resources/curve.cpp91
-rw-r--r--scene/resources/curve.h20
-rw-r--r--scene/resources/cylinder_shape.cpp4
-rw-r--r--scene/resources/default_theme/default_theme.cpp6
-rw-r--r--scene/resources/dynamic_font.cpp4
-rw-r--r--scene/resources/dynamic_font.h2
-rw-r--r--scene/resources/environment.cpp88
-rw-r--r--scene/resources/font.cpp28
-rw-r--r--scene/resources/font.h8
-rw-r--r--scene/resources/gradient.cpp4
-rw-r--r--scene/resources/height_map_shape.cpp18
-rw-r--r--scene/resources/height_map_shape.h6
-rw-r--r--scene/resources/line_shape_2d.cpp2
-rw-r--r--scene/resources/material.cpp57
-rw-r--r--scene/resources/material.h4
-rw-r--r--scene/resources/mesh.cpp139
-rw-r--r--scene/resources/mesh.h6
-rw-r--r--scene/resources/mesh_data_tool.cpp116
-rw-r--r--scene/resources/mesh_library.cpp6
-rw-r--r--scene/resources/multimesh.cpp70
-rw-r--r--scene/resources/multimesh.h20
-rw-r--r--scene/resources/navigation_mesh.cpp52
-rw-r--r--scene/resources/navigation_mesh.h6
-rw-r--r--scene/resources/packed_scene.cpp36
-rw-r--r--scene/resources/packed_scene.h2
-rw-r--r--scene/resources/particles_material.cpp58
-rw-r--r--scene/resources/physics_material.cpp4
-rw-r--r--scene/resources/polygon_path_finder.cpp32
-rw-r--r--scene/resources/primitive_meshes.cpp136
-rw-r--r--scene/resources/ray_shape.cpp2
-rw-r--r--scene/resources/resource_format_text.cpp4
-rw-r--r--scene/resources/segment_shape_2d.cpp2
-rw-r--r--scene/resources/shape.cpp10
-rw-r--r--scene/resources/shape.h2
-rw-r--r--scene/resources/shape_2d.cpp2
-rw-r--r--scene/resources/skin.cpp30
-rw-r--r--scene/resources/skin.h12
-rw-r--r--scene/resources/sky.cpp26
-rw-r--r--scene/resources/sphere_shape.cpp2
-rw-r--r--scene/resources/style_box.cpp36
-rw-r--r--scene/resources/surface_tool.cpp120
-rw-r--r--scene/resources/text_file.cpp8
-rw-r--r--scene/resources/texture.cpp71
-rw-r--r--scene/resources/texture.h4
-rw-r--r--scene/resources/theme.cpp70
-rw-r--r--scene/resources/theme.h14
-rw-r--r--scene/resources/tile_set.cpp2
-rw-r--r--scene/resources/visual_shader.cpp116
-rw-r--r--scene/resources/visual_shader.h10
-rw-r--r--scene/resources/visual_shader_nodes.cpp551
-rw-r--r--scene/resources/visual_shader_nodes.h202
-rw-r--r--scene/resources/world.cpp4
-rw-r--r--scene/resources/world_2d.cpp4
68 files changed, 1572 insertions, 1000 deletions
diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp
index 91d1e32053..ba1f738115 100644
--- a/scene/resources/animation.cpp
+++ b/scene/resources/animation.cpp
@@ -91,11 +91,11 @@ bool Animation::_set(const StringName &p_name, const Variant &p_value) {
if (track_get_type(track) == TYPE_TRANSFORM) {
TransformTrack *tt = static_cast<TransformTrack *>(tracks[track]);
- PoolVector<float> values = p_value;
+ Vector<float> values = p_value;
int vcount = values.size();
ERR_FAIL_COND_V(vcount % 12, false); // should be multiple of 11
- PoolVector<float>::Read r = values.read();
+ const float *r = values.ptr();
tt->transforms.resize(vcount / 12);
@@ -140,7 +140,7 @@ bool Animation::_set(const StringName &p_name, const Variant &p_value) {
vt->update_mode = UpdateMode(um);
}
- PoolVector<float> times = d["times"];
+ Vector<float> times = d["times"];
Array values = d["values"];
ERR_FAIL_COND_V(times.size() != values.size(), false);
@@ -149,7 +149,7 @@ bool Animation::_set(const StringName &p_name, const Variant &p_value) {
int valcount = times.size();
- PoolVector<float>::Read rt = times.read();
+ const float *rt = times.ptr();
vt->values.resize(valcount);
@@ -161,10 +161,10 @@ bool Animation::_set(const StringName &p_name, const Variant &p_value) {
if (d.has("transitions")) {
- PoolVector<float> transitions = d["transitions"];
+ Vector<float> transitions = d["transitions"];
ERR_FAIL_COND_V(transitions.size() != valcount, false);
- PoolVector<float>::Read rtr = transitions.read();
+ const float *rtr = transitions.ptr();
for (int i = 0; i < valcount; i++) {
@@ -184,7 +184,7 @@ bool Animation::_set(const StringName &p_name, const Variant &p_value) {
ERR_FAIL_COND_V(!d.has("times"), false);
ERR_FAIL_COND_V(!d.has("values"), false);
- PoolVector<float> times = d["times"];
+ Vector<float> times = d["times"];
Array values = d["values"];
ERR_FAIL_COND_V(times.size() != values.size(), false);
@@ -193,7 +193,7 @@ bool Animation::_set(const StringName &p_name, const Variant &p_value) {
int valcount = times.size();
- PoolVector<float>::Read rt = times.read();
+ const float *rt = times.ptr();
for (int i = 0; i < valcount; i++) {
@@ -202,10 +202,10 @@ bool Animation::_set(const StringName &p_name, const Variant &p_value) {
if (d.has("transitions")) {
- PoolVector<float> transitions = d["transitions"];
+ Vector<float> transitions = d["transitions"];
ERR_FAIL_COND_V(transitions.size() != valcount, false);
- PoolVector<float>::Read rtr = transitions.read();
+ const float *rtr = transitions.ptr();
for (int i = 0; i < valcount; i++) {
@@ -220,8 +220,8 @@ bool Animation::_set(const StringName &p_name, const Variant &p_value) {
ERR_FAIL_COND_V(!d.has("times"), false);
ERR_FAIL_COND_V(!d.has("points"), false);
- PoolVector<float> times = d["times"];
- PoolRealArray values = d["points"];
+ Vector<float> times = d["times"];
+ PackedFloat32Array values = d["points"];
ERR_FAIL_COND_V(times.size() * 5 != values.size(), false);
@@ -229,8 +229,8 @@ bool Animation::_set(const StringName &p_name, const Variant &p_value) {
int valcount = times.size();
- PoolVector<float>::Read rt = times.read();
- PoolVector<float>::Read rv = values.read();
+ const float *rt = times.ptr();
+ const float *rv = values.ptr();
bt->values.resize(valcount);
@@ -254,7 +254,7 @@ bool Animation::_set(const StringName &p_name, const Variant &p_value) {
ERR_FAIL_COND_V(!d.has("times"), false);
ERR_FAIL_COND_V(!d.has("clips"), false);
- PoolVector<float> times = d["times"];
+ Vector<float> times = d["times"];
Array clips = d["clips"];
ERR_FAIL_COND_V(clips.size() != times.size(), false);
@@ -263,7 +263,7 @@ bool Animation::_set(const StringName &p_name, const Variant &p_value) {
int valcount = times.size();
- PoolVector<float>::Read rt = times.read();
+ const float *rt = times.ptr();
ad->values.clear();
@@ -295,8 +295,8 @@ bool Animation::_set(const StringName &p_name, const Variant &p_value) {
ERR_FAIL_COND_V(!d.has("times"), false);
ERR_FAIL_COND_V(!d.has("clips"), false);
- PoolVector<float> times = d["times"];
- PoolVector<String> clips = d["clips"];
+ Vector<float> times = d["times"];
+ Vector<String> clips = d["clips"];
ERR_FAIL_COND_V(clips.size() != times.size(), false);
@@ -304,8 +304,8 @@ bool Animation::_set(const StringName &p_name, const Variant &p_value) {
int valcount = times.size();
- PoolVector<float>::Read rt = times.read();
- PoolVector<String>::Read rc = clips.read();
+ const float *rt = times.ptr();
+ const String *rc = clips.ptr();
an->values.resize(valcount);
@@ -373,11 +373,11 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const {
if (track_get_type(track) == TYPE_TRANSFORM) {
- PoolVector<real_t> keys;
+ Vector<float> keys;
int kk = track_get_key_count(track);
keys.resize(kk * 12);
- PoolVector<real_t>::Write w = keys.write();
+ real_t *w = keys.ptrw();
int idx = 0;
for (int i = 0; i < track_get_key_count(track); i++) {
@@ -403,7 +403,6 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const {
w[idx++] = scale.z;
}
- w.release();
r_ret = keys;
return true;
@@ -413,8 +412,8 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const {
Dictionary d;
- PoolVector<float> key_times;
- PoolVector<float> key_transitions;
+ Vector<float> key_times;
+ Vector<float> key_transitions;
Array key_values;
int kk = vt->values.size();
@@ -423,8 +422,8 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const {
key_transitions.resize(kk);
key_values.resize(kk);
- PoolVector<float>::Write wti = key_times.write();
- PoolVector<float>::Write wtr = key_transitions.write();
+ float *wti = key_times.ptrw();
+ float *wtr = key_transitions.ptrw();
int idx = 0;
@@ -438,9 +437,6 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const {
idx++;
}
- wti.release();
- wtr.release();
-
d["times"] = key_times;
d["transitions"] = key_transitions;
d["values"] = key_values;
@@ -456,8 +452,8 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const {
Dictionary d;
- PoolVector<float> key_times;
- PoolVector<float> key_transitions;
+ Vector<float> key_times;
+ Vector<float> key_transitions;
Array key_values;
int kk = track_get_key_count(track);
@@ -466,8 +462,8 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const {
key_transitions.resize(kk);
key_values.resize(kk);
- PoolVector<float>::Write wti = key_times.write();
- PoolVector<float>::Write wtr = key_transitions.write();
+ float *wti = key_times.ptrw();
+ float *wtr = key_transitions.ptrw();
int idx = 0;
for (int i = 0; i < track_get_key_count(track); i++) {
@@ -478,9 +474,6 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const {
idx++;
}
- wti.release();
- wtr.release();
-
d["times"] = key_times;
d["transitions"] = key_transitions;
d["values"] = key_values;
@@ -497,16 +490,16 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const {
Dictionary d;
- PoolVector<float> key_times;
- PoolVector<float> key_points;
+ Vector<float> key_times;
+ Vector<float> key_points;
int kk = bt->values.size();
key_times.resize(kk);
key_points.resize(kk * 5);
- PoolVector<float>::Write wti = key_times.write();
- PoolVector<float>::Write wpo = key_points.write();
+ float *wti = key_times.ptrw();
+ float *wpo = key_points.ptrw();
int idx = 0;
@@ -523,9 +516,6 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const {
idx++;
}
- wti.release();
- wpo.release();
-
d["times"] = key_times;
d["points"] = key_points;
@@ -538,14 +528,14 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const {
Dictionary d;
- PoolVector<float> key_times;
+ Vector<float> key_times;
Array clips;
int kk = ad->values.size();
key_times.resize(kk);
- PoolVector<float>::Write wti = key_times.write();
+ float *wti = key_times.ptrw();
int idx = 0;
@@ -562,8 +552,6 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const {
idx++;
}
- wti.release();
-
d["times"] = key_times;
d["clips"] = clips;
@@ -576,16 +564,16 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const {
Dictionary d;
- PoolVector<float> key_times;
- PoolVector<String> clips;
+ Vector<float> key_times;
+ Vector<String> clips;
int kk = an->values.size();
key_times.resize(kk);
clips.resize(kk);
- PoolVector<float>::Write wti = key_times.write();
- PoolVector<String>::Write wcl = clips.write();
+ float *wti = key_times.ptrw();
+ String *wcl = clips.ptrw();
const TKey<StringName> *vls = an->values.ptr();
@@ -595,9 +583,6 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const {
wcl[i] = vls[i].value;
}
- wti.release();
- wcl.release();
-
d["times"] = key_times;
d["clips"] = clips;
@@ -1063,7 +1048,7 @@ void Animation::track_insert_key(int p_track, float p_time, const Variant &p_key
ERR_FAIL_COND(p_key.get_type() != Variant::DICTIONARY);
Dictionary d = p_key;
- ERR_FAIL_COND(!d.has("method") || d["method"].get_type() != Variant::STRING);
+ ERR_FAIL_COND(!d.has("method") || (d["method"].get_type() != Variant::STRING_NAME && d["method"].get_type() != Variant::STRING));
ERR_FAIL_COND(!d.has("args") || !d["args"].is_array());
MethodKey k;
@@ -1635,7 +1620,7 @@ Variant Animation::_cubic_interpolate(const Variant &p_pre_a, const Variant &p_a
vformat |= 1 << type_pa;
vformat |= 1 << type_pb;
- if (vformat == ((1 << Variant::INT) | (1 << Variant::REAL)) || vformat == (1 << Variant::REAL)) {
+ if (vformat == ((1 << Variant::INT) | (1 << Variant::FLOAT)) || vformat == (1 << Variant::FLOAT)) {
//mix of real and int
real_t p0 = p_pre_a;
@@ -2825,9 +2810,9 @@ void Animation::_bind_methods() {
ClassDB::bind_method(D_METHOD("clear"), &Animation::clear);
ClassDB::bind_method(D_METHOD("copy_track", "track_idx", "to_animation"), &Animation::copy_track);
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "length", PROPERTY_HINT_RANGE, "0.001,99999,0.001"), "set_length", "get_length");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "length", PROPERTY_HINT_RANGE, "0.001,99999,0.001"), "set_length", "get_length");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "loop"), "set_loop", "has_loop");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "step", PROPERTY_HINT_RANGE, "0,4096,0.001"), "set_step", "get_step");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "step", PROPERTY_HINT_RANGE, "0,4096,0.001"), "set_step", "get_step");
ADD_SIGNAL(MethodInfo("tracks_changed"));
diff --git a/scene/resources/animation.h b/scene/resources/animation.h
index 6ac0ea04d9..ea4f92878d 100644
--- a/scene/resources/animation.h
+++ b/scene/resources/animation.h
@@ -242,11 +242,11 @@ private:
return ret;
}
- PoolVector<int> _value_track_get_key_indices(int p_track, float p_time, float p_delta) const {
+ Vector<int> _value_track_get_key_indices(int p_track, float p_time, float p_delta) const {
List<int> idxs;
value_track_get_key_indices(p_track, p_time, p_delta, &idxs);
- PoolVector<int> idxr;
+ Vector<int> idxr;
for (List<int>::Element *E = idxs.front(); E; E = E->next()) {
@@ -254,11 +254,11 @@ private:
}
return idxr;
}
- PoolVector<int> _method_track_get_key_indices(int p_track, float p_time, float p_delta) const {
+ Vector<int> _method_track_get_key_indices(int p_track, float p_time, float p_delta) const {
List<int> idxs;
method_track_get_key_indices(p_track, p_time, p_delta, &idxs);
- PoolVector<int> idxr;
+ Vector<int> idxr;
for (List<int>::Element *E = idxs.front(); E; E = E->next()) {
diff --git a/scene/resources/audio_stream_sample.cpp b/scene/resources/audio_stream_sample.cpp
index a412d8a5e2..ed25729c40 100644
--- a/scene/resources/audio_stream_sample.cpp
+++ b/scene/resources/audio_stream_sample.cpp
@@ -477,7 +477,7 @@ float AudioStreamSample::get_length() const {
return float(len) / mix_rate;
}
-void AudioStreamSample::set_data(const PoolVector<uint8_t> &p_data) {
+void AudioStreamSample::set_data(const Vector<uint8_t> &p_data) {
AudioServer::get_singleton()->lock();
if (data) {
@@ -489,28 +489,28 @@ void AudioStreamSample::set_data(const PoolVector<uint8_t> &p_data) {
int datalen = p_data.size();
if (datalen) {
- PoolVector<uint8_t>::Read r = p_data.read();
+ const uint8_t *r = p_data.ptr();
int alloc_len = datalen + DATA_PAD * 2;
data = AudioServer::get_singleton()->audio_data_alloc(alloc_len); //alloc with some padding for interpolation
zeromem(data, alloc_len);
uint8_t *dataptr = (uint8_t *)data;
- copymem(dataptr + DATA_PAD, r.ptr(), datalen);
+ copymem(dataptr + DATA_PAD, r, datalen);
data_bytes = datalen;
}
AudioServer::get_singleton()->unlock();
}
-PoolVector<uint8_t> AudioStreamSample::get_data() const {
+Vector<uint8_t> AudioStreamSample::get_data() const {
- PoolVector<uint8_t> pv;
+ Vector<uint8_t> pv;
if (data) {
pv.resize(data_bytes);
{
- PoolVector<uint8_t>::Write w = pv.write();
+ uint8_t *w = pv.ptrw();
uint8_t *dataptr = (uint8_t *)data;
- copymem(w.ptr(), dataptr + DATA_PAD, data_bytes);
+ copymem(w, dataptr + DATA_PAD, data_bytes);
}
}
@@ -566,8 +566,8 @@ Error AudioStreamSample::save_to_wav(const String &p_path) {
file->store_32(sub_chunk_2_size); //Subchunk2Size
// Add data
- PoolVector<uint8_t> data = get_data();
- PoolVector<uint8_t>::Read read_data = data.read();
+ Vector<uint8_t> data = get_data();
+ const uint8_t *read_data = data.ptr();
switch (format) {
case AudioStreamSample::FORMAT_8_BITS:
for (unsigned int i = 0; i < data_bytes; i++) {
@@ -629,7 +629,7 @@ void AudioStreamSample::_bind_methods() {
ClassDB::bind_method(D_METHOD("save_to_wav", "path"), &AudioStreamSample::save_to_wav);
- ADD_PROPERTY(PropertyInfo(Variant::POOL_BYTE_ARRAY, "data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_data", "get_data");
+ ADD_PROPERTY(PropertyInfo(Variant::PACKED_BYTE_ARRAY, "data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_data", "get_data");
ADD_PROPERTY(PropertyInfo(Variant::INT, "format", PROPERTY_HINT_ENUM, "8-Bit,16-Bit,IMA-ADPCM"), "set_format", "get_format");
ADD_PROPERTY(PropertyInfo(Variant::INT, "loop_mode", PROPERTY_HINT_ENUM, "Disabled,Forward,Ping-Pong,Backward"), "set_loop_mode", "get_loop_mode");
ADD_PROPERTY(PropertyInfo(Variant::INT, "loop_begin"), "set_loop_begin", "get_loop_begin");
diff --git a/scene/resources/audio_stream_sample.h b/scene/resources/audio_stream_sample.h
index adcac14ea8..0b46bc1c75 100644
--- a/scene/resources/audio_stream_sample.h
+++ b/scene/resources/audio_stream_sample.h
@@ -138,8 +138,8 @@ public:
virtual float get_length() const; //if supported, otherwise return 0
- void set_data(const PoolVector<uint8_t> &p_data);
- PoolVector<uint8_t> get_data() const;
+ void set_data(const Vector<uint8_t> &p_data);
+ Vector<uint8_t> get_data() const;
Error save_to_wav(const String &p_path);
diff --git a/scene/resources/bit_map.cpp b/scene/resources/bit_map.cpp
index 06323a8d31..6730f86e0c 100644
--- a/scene/resources/bit_map.cpp
+++ b/scene/resources/bit_map.cpp
@@ -52,7 +52,7 @@ void BitMap::create_from_image_alpha(const Ref<Image> &p_image, float p_threshol
create(Size2(img->get_width(), img->get_height()));
- PoolVector<uint8_t>::Read r = img->get_data().read();
+ const uint8_t *r = img->get_data().ptr();
uint8_t *w = bitmask.ptrw();
for (int i = 0; i < width * height; i++) {
@@ -426,7 +426,7 @@ struct FillBitsStackEntry {
static void fill_bits(const BitMap *p_src, Ref<BitMap> &p_map, const Point2i &p_pos, const Rect2i &rect) {
// Using a custom stack to work iteratively to avoid stack overflow on big bitmaps
- PoolVector<FillBitsStackEntry> stack;
+ Vector<FillBitsStackEntry> stack;
// Tracking size since we won't be shrinking the stack vector
int stack_size = 0;
@@ -601,11 +601,11 @@ Array BitMap::_opaque_to_polygons_bind(const Rect2 &p_rect, float p_epsilon) con
const Vector<Vector2> &polygon = result[i];
- PoolVector2Array polygon_array;
+ PackedVector2Array polygon_array;
polygon_array.resize(polygon.size());
{
- PoolVector2Array::Write w = polygon_array.write();
+ Vector2 *w = polygon_array.ptrw();
for (int j = 0; j < polygon.size(); j++) {
w[j] = polygon[j];
}
@@ -640,15 +640,13 @@ Ref<Image> BitMap::convert_to_image() const {
Ref<Image> image;
image.instance();
image->create(width, height, false, Image::FORMAT_L8);
- image->lock();
+
for (int i = 0; i < width; i++) {
for (int j = 0; j < height; j++) {
image->set_pixel(i, j, get_bit(Point2(i, j)) ? Color(1, 1, 1) : Color(0, 0, 0));
}
}
- image->unlock();
-
return image;
}
void BitMap::blit(const Vector2 &p_pos, const Ref<BitMap> &p_bitmap) {
diff --git a/scene/resources/capsule_shape.cpp b/scene/resources/capsule_shape.cpp
index 933129936a..dddbd7fef3 100644
--- a/scene/resources/capsule_shape.cpp
+++ b/scene/resources/capsule_shape.cpp
@@ -38,7 +38,7 @@ Vector<Vector3> CapsuleShape::get_debug_mesh_lines() {
Vector<Vector3> points;
- Vector3 d(0, 0, height * 0.5);
+ Vector3 d(0, height * 0.5, 0);
for (int i = 0; i < 360; i++) {
float ra = Math::deg2rad((float)i);
@@ -46,24 +46,24 @@ Vector<Vector3> CapsuleShape::get_debug_mesh_lines() {
Point2 a = Vector2(Math::sin(ra), Math::cos(ra)) * radius;
Point2 b = Vector2(Math::sin(rb), Math::cos(rb)) * radius;
- points.push_back(Vector3(a.x, a.y, 0) + d);
- points.push_back(Vector3(b.x, b.y, 0) + d);
+ points.push_back(Vector3(a.x, 0, a.y) + d);
+ points.push_back(Vector3(b.x, 0, b.y) + d);
- points.push_back(Vector3(a.x, a.y, 0) - d);
- points.push_back(Vector3(b.x, b.y, 0) - d);
+ points.push_back(Vector3(a.x, 0, a.y) - d);
+ points.push_back(Vector3(b.x, 0, b.y) - d);
if (i % 90 == 0) {
- points.push_back(Vector3(a.x, a.y, 0) + d);
- points.push_back(Vector3(a.x, a.y, 0) - d);
+ points.push_back(Vector3(a.x, 0, a.y) + d);
+ points.push_back(Vector3(a.x, 0, a.y) - d);
}
Vector3 dud = i < 180 ? d : -d;
- points.push_back(Vector3(0, a.y, a.x) + dud);
- points.push_back(Vector3(0, b.y, b.x) + dud);
- points.push_back(Vector3(a.y, 0, a.x) + dud);
- points.push_back(Vector3(b.y, 0, b.x) + dud);
+ points.push_back(Vector3(0, a.x, a.y) + dud);
+ points.push_back(Vector3(0, b.x, b.y) + dud);
+ points.push_back(Vector3(a.y, a.x, 0) + dud);
+ points.push_back(Vector3(b.y, b.x, 0) + dud);
}
return points;
@@ -115,8 +115,8 @@ void CapsuleShape::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_height", "height"), &CapsuleShape::set_height);
ClassDB::bind_method(D_METHOD("get_height"), &CapsuleShape::get_height);
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "radius", PROPERTY_HINT_RANGE, "0.01,4096,0.01"), "set_radius", "get_radius");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "height", PROPERTY_HINT_RANGE, "0.01,4096,0.01"), "set_height", "get_height");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "radius", PROPERTY_HINT_RANGE, "0.01,4096,0.01"), "set_radius", "get_radius");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "height", PROPERTY_HINT_RANGE, "0.01,4096,0.01"), "set_height", "get_height");
}
CapsuleShape::CapsuleShape() :
diff --git a/scene/resources/capsule_shape_2d.cpp b/scene/resources/capsule_shape_2d.cpp
index 5658395cee..9b8083de97 100644
--- a/scene/resources/capsule_shape_2d.cpp
+++ b/scene/resources/capsule_shape_2d.cpp
@@ -109,8 +109,8 @@ void CapsuleShape2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_height", "height"), &CapsuleShape2D::set_height);
ClassDB::bind_method(D_METHOD("get_height"), &CapsuleShape2D::get_height);
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "radius"), "set_radius", "get_radius");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "height"), "set_height", "get_height");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "radius"), "set_radius", "get_radius");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "height"), "set_height", "get_height");
}
CapsuleShape2D::CapsuleShape2D() :
diff --git a/scene/resources/circle_shape_2d.cpp b/scene/resources/circle_shape_2d.cpp
index 10f8ab8a8a..37874e17ef 100644
--- a/scene/resources/circle_shape_2d.cpp
+++ b/scene/resources/circle_shape_2d.cpp
@@ -60,7 +60,7 @@ void CircleShape2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_radius", "radius"), &CircleShape2D::set_radius);
ClassDB::bind_method(D_METHOD("get_radius"), &CircleShape2D::get_radius);
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "radius", PROPERTY_HINT_RANGE, "0.01,16384,0.5"), "set_radius", "get_radius");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "radius", PROPERTY_HINT_RANGE, "0.01,16384,0.5"), "set_radius", "get_radius");
}
Rect2 CircleShape2D::get_rect() const {
diff --git a/scene/resources/concave_polygon_shape.cpp b/scene/resources/concave_polygon_shape.cpp
index 0a93f99ea3..fe123a2df7 100644
--- a/scene/resources/concave_polygon_shape.cpp
+++ b/scene/resources/concave_polygon_shape.cpp
@@ -36,11 +36,11 @@ Vector<Vector3> ConcavePolygonShape::get_debug_mesh_lines() {
Set<DrawEdge> edges;
- PoolVector<Vector3> data = get_faces();
+ Vector<Vector3> data = get_faces();
int datalen = data.size();
ERR_FAIL_COND_V((datalen % 3) != 0, Vector<Vector3>());
- PoolVector<Vector3>::Read r = data.read();
+ const Vector3 *r = data.ptr();
for (int i = 0; i < datalen; i += 3) {
@@ -65,8 +65,8 @@ Vector<Vector3> ConcavePolygonShape::get_debug_mesh_lines() {
}
real_t ConcavePolygonShape::get_enclosing_radius() const {
- PoolVector<Vector3> data = get_faces();
- PoolVector<Vector3>::Read read = data.read();
+ Vector<Vector3> data = get_faces();
+ const Vector3 *read = data.ptr();
real_t r = 0;
for (int i(0); i < data.size(); i++) {
r = MAX(read[i].length_squared(), r);
@@ -78,13 +78,13 @@ void ConcavePolygonShape::_update_shape() {
Shape::_update_shape();
}
-void ConcavePolygonShape::set_faces(const PoolVector<Vector3> &p_faces) {
+void ConcavePolygonShape::set_faces(const Vector<Vector3> &p_faces) {
PhysicsServer::get_singleton()->shape_set_data(get_shape(), p_faces);
notify_change_to_owners();
}
-PoolVector<Vector3> ConcavePolygonShape::get_faces() const {
+Vector<Vector3> ConcavePolygonShape::get_faces() const {
return PhysicsServer::get_singleton()->shape_get_data(get_shape());
}
@@ -93,7 +93,7 @@ void ConcavePolygonShape::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_faces", "faces"), &ConcavePolygonShape::set_faces);
ClassDB::bind_method(D_METHOD("get_faces"), &ConcavePolygonShape::get_faces);
- ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR3_ARRAY, "data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "set_faces", "get_faces");
+ ADD_PROPERTY(PropertyInfo(Variant::PACKED_VECTOR3_ARRAY, "data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "set_faces", "get_faces");
}
ConcavePolygonShape::ConcavePolygonShape() :
diff --git a/scene/resources/concave_polygon_shape.h b/scene/resources/concave_polygon_shape.h
index b4bebbd7b4..63aabb27d7 100644
--- a/scene/resources/concave_polygon_shape.h
+++ b/scene/resources/concave_polygon_shape.h
@@ -63,8 +63,8 @@ protected:
virtual void _update_shape();
public:
- void set_faces(const PoolVector<Vector3> &p_faces);
- PoolVector<Vector3> get_faces() const;
+ void set_faces(const Vector<Vector3> &p_faces);
+ Vector<Vector3> get_faces() const;
virtual Vector<Vector3> get_debug_mesh_lines();
virtual real_t get_enclosing_radius() const;
diff --git a/scene/resources/concave_polygon_shape_2d.cpp b/scene/resources/concave_polygon_shape_2d.cpp
index 840733add3..c3e9e19721 100644
--- a/scene/resources/concave_polygon_shape_2d.cpp
+++ b/scene/resources/concave_polygon_shape_2d.cpp
@@ -35,12 +35,12 @@
bool ConcavePolygonShape2D::_edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const {
- PoolVector<Vector2> s = get_segments();
+ Vector<Vector2> s = get_segments();
int len = s.size();
if (len == 0 || (len % 2) == 1)
return false;
- PoolVector<Vector2>::Read r = s.read();
+ const Vector2 *r = s.ptr();
for (int i = 0; i < len; i += 2) {
Vector2 closest = Geometry::get_closest_point_to_segment_2d(p_point, &r[i]);
if (p_point.distance_to(closest) < p_tolerance)
@@ -50,25 +50,25 @@ bool ConcavePolygonShape2D::_edit_is_selected_on_click(const Point2 &p_point, do
return false;
}
-void ConcavePolygonShape2D::set_segments(const PoolVector<Vector2> &p_segments) {
+void ConcavePolygonShape2D::set_segments(const Vector<Vector2> &p_segments) {
Physics2DServer::get_singleton()->shape_set_data(get_rid(), p_segments);
emit_changed();
}
-PoolVector<Vector2> ConcavePolygonShape2D::get_segments() const {
+Vector<Vector2> ConcavePolygonShape2D::get_segments() const {
return Physics2DServer::get_singleton()->shape_get_data(get_rid());
}
void ConcavePolygonShape2D::draw(const RID &p_to_rid, const Color &p_color) {
- PoolVector<Vector2> s = get_segments();
+ Vector<Vector2> s = get_segments();
int len = s.size();
if (len == 0 || (len % 2) == 1)
return;
- PoolVector<Vector2>::Read r = s.read();
+ const Vector2 *r = s.ptr();
for (int i = 0; i < len; i += 2) {
VisualServer::get_singleton()->canvas_item_add_line(p_to_rid, r[i], r[i + 1], p_color, 2);
}
@@ -76,14 +76,14 @@ void ConcavePolygonShape2D::draw(const RID &p_to_rid, const Color &p_color) {
Rect2 ConcavePolygonShape2D::get_rect() const {
- PoolVector<Vector2> s = get_segments();
+ Vector<Vector2> s = get_segments();
int len = s.size();
if (len == 0)
return Rect2();
Rect2 rect;
- PoolVector<Vector2>::Read r = s.read();
+ const Vector2 *r = s.ptr();
for (int i = 0; i < len; i++) {
if (i == 0)
rect.position = r[i];
@@ -95,8 +95,8 @@ Rect2 ConcavePolygonShape2D::get_rect() const {
}
real_t ConcavePolygonShape2D::get_enclosing_radius() const {
- PoolVector<Vector2> data = get_segments();
- PoolVector<Vector2>::Read read = data.read();
+ Vector<Vector2> data = get_segments();
+ const Vector2 *read = data.ptr();
real_t r = 0;
for (int i(0); i < data.size(); i++) {
r = MAX(read[i].length_squared(), r);
@@ -109,11 +109,11 @@ void ConcavePolygonShape2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_segments", "segments"), &ConcavePolygonShape2D::set_segments);
ClassDB::bind_method(D_METHOD("get_segments"), &ConcavePolygonShape2D::get_segments);
- ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR2_ARRAY, "segments"), "set_segments", "get_segments");
+ ADD_PROPERTY(PropertyInfo(Variant::PACKED_VECTOR2_ARRAY, "segments"), "set_segments", "get_segments");
}
ConcavePolygonShape2D::ConcavePolygonShape2D() :
Shape2D(Physics2DServer::get_singleton()->concave_polygon_shape_create()) {
- PoolVector<Vector2> empty;
+ Vector<Vector2> empty;
set_segments(empty);
}
diff --git a/scene/resources/concave_polygon_shape_2d.h b/scene/resources/concave_polygon_shape_2d.h
index 4e47ad34b8..f89995567e 100644
--- a/scene/resources/concave_polygon_shape_2d.h
+++ b/scene/resources/concave_polygon_shape_2d.h
@@ -42,8 +42,8 @@ protected:
public:
virtual bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const;
- void set_segments(const PoolVector<Vector2> &p_segments);
- PoolVector<Vector2> get_segments() const;
+ void set_segments(const Vector<Vector2> &p_segments);
+ Vector<Vector2> get_segments() const;
virtual void draw(const RID &p_to_rid, const Color &p_color);
virtual Rect2 get_rect() const;
diff --git a/scene/resources/convex_polygon_shape.cpp b/scene/resources/convex_polygon_shape.cpp
index 21fdcc1f06..b7463605b4 100644
--- a/scene/resources/convex_polygon_shape.cpp
+++ b/scene/resources/convex_polygon_shape.cpp
@@ -34,7 +34,7 @@
Vector<Vector3> ConvexPolygonShape::get_debug_mesh_lines() {
- PoolVector<Vector3> points = get_points();
+ Vector<Vector3> points = get_points();
if (points.size() > 3) {
@@ -56,8 +56,8 @@ Vector<Vector3> ConvexPolygonShape::get_debug_mesh_lines() {
}
real_t ConvexPolygonShape::get_enclosing_radius() const {
- PoolVector<Vector3> data = get_points();
- PoolVector<Vector3>::Read read = data.read();
+ Vector<Vector3> data = get_points();
+ const Vector3 *read = data.ptr();
real_t r = 0;
for (int i(0); i < data.size(); i++) {
r = MAX(read[i].length_squared(), r);
@@ -71,14 +71,14 @@ void ConvexPolygonShape::_update_shape() {
Shape::_update_shape();
}
-void ConvexPolygonShape::set_points(const PoolVector<Vector3> &p_points) {
+void ConvexPolygonShape::set_points(const Vector<Vector3> &p_points) {
points = p_points;
_update_shape();
notify_change_to_owners();
}
-PoolVector<Vector3> ConvexPolygonShape::get_points() const {
+Vector<Vector3> ConvexPolygonShape::get_points() const {
return points;
}
diff --git a/scene/resources/convex_polygon_shape.h b/scene/resources/convex_polygon_shape.h
index e3bf02399a..fcd733887e 100644
--- a/scene/resources/convex_polygon_shape.h
+++ b/scene/resources/convex_polygon_shape.h
@@ -36,7 +36,7 @@
class ConvexPolygonShape : public Shape {
GDCLASS(ConvexPolygonShape, Shape);
- PoolVector<Vector3> points;
+ Vector<Vector3> points;
protected:
static void _bind_methods();
@@ -44,8 +44,8 @@ protected:
virtual void _update_shape();
public:
- void set_points(const PoolVector<Vector3> &p_points);
- PoolVector<Vector3> get_points() const;
+ void set_points(const Vector<Vector3> &p_points);
+ Vector<Vector3> get_points() const;
virtual Vector<Vector3> get_debug_mesh_lines();
virtual real_t get_enclosing_radius() const;
diff --git a/scene/resources/convex_polygon_shape_2d.cpp b/scene/resources/convex_polygon_shape_2d.cpp
index 296d014cc7..95967429c9 100644
--- a/scene/resources/convex_polygon_shape_2d.cpp
+++ b/scene/resources/convex_polygon_shape_2d.cpp
@@ -74,7 +74,7 @@ void ConvexPolygonShape2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_points", "points"), &ConvexPolygonShape2D::set_points);
ClassDB::bind_method(D_METHOD("get_points"), &ConvexPolygonShape2D::get_points);
- ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR2_ARRAY, "points"), "set_points", "get_points");
+ ADD_PROPERTY(PropertyInfo(Variant::PACKED_VECTOR2_ARRAY, "points"), "set_points", "get_points");
}
void ConvexPolygonShape2D::draw(const RID &p_to_rid, const Color &p_color) {
diff --git a/scene/resources/curve.cpp b/scene/resources/curve.cpp
index 397f6ca906..a68eb77378 100644
--- a/scene/resources/curve.cpp
+++ b/scene/resources/curve.cpp
@@ -392,7 +392,7 @@ void Curve::set_data(Array input) {
for (int i = 0; i < input.size(); i += ELEMS) {
ERR_FAIL_COND(input[i].get_type() != Variant::VECTOR2);
ERR_FAIL_COND(!input[i + 1].is_num());
- ERR_FAIL_COND(input[i + 2].get_type() != Variant::REAL);
+ ERR_FAIL_COND(input[i + 2].get_type() != Variant::FLOAT);
ERR_FAIL_COND(input[i + 3].get_type() != Variant::INT);
int left_mode = input[i + 3];
@@ -524,8 +524,8 @@ void Curve::_bind_methods() {
ClassDB::bind_method(D_METHOD("_get_data"), &Curve::get_data);
ClassDB::bind_method(D_METHOD("_set_data", "data"), &Curve::set_data);
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "min_value", PROPERTY_HINT_RANGE, "-1024,1024,0.01"), "set_min_value", "get_min_value");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "max_value", PROPERTY_HINT_RANGE, "-1024,1024,0.01"), "set_max_value", "get_max_value");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "min_value", PROPERTY_HINT_RANGE, "-1024,1024,0.01"), "set_min_value", "get_min_value");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "max_value", PROPERTY_HINT_RANGE, "-1024,1024,0.01"), "set_max_value", "get_max_value");
ADD_PROPERTY(PropertyInfo(Variant::INT, "bake_resolution", PROPERTY_HINT_RANGE, "1,1000,1"), "set_bake_resolution", "get_bake_resolution");
ADD_PROPERTY(PropertyInfo(Variant::INT, "_data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_data", "_get_data");
@@ -741,7 +741,7 @@ void Curve2D::_bake() const {
pointlist.push_back(lastpos);
baked_point_cache.resize(pointlist.size());
- PoolVector2Array::Write w = baked_point_cache.write();
+ Vector2 *w = baked_point_cache.ptrw();
int idx = 0;
for (List<Vector2>::Element *E = pointlist.front(); E; E = E->next()) {
@@ -771,7 +771,7 @@ Vector2 Curve2D::interpolate_baked(float p_offset, bool p_cubic) const {
return baked_point_cache.get(0);
int bpc = baked_point_cache.size();
- PoolVector2Array::Read r = baked_point_cache.read();
+ const Vector2 *r = baked_point_cache.ptr();
if (p_offset < 0)
return r[0];
@@ -800,7 +800,7 @@ Vector2 Curve2D::interpolate_baked(float p_offset, bool p_cubic) const {
}
}
-PoolVector2Array Curve2D::get_baked_points() const {
+PackedVector2Array Curve2D::get_baked_points() const {
if (baked_cache_dirty)
_bake();
@@ -833,7 +833,7 @@ Vector2 Curve2D::get_closest_point(const Vector2 &p_to_point) const {
if (pc == 1)
return baked_point_cache.get(0);
- PoolVector2Array::Read r = baked_point_cache.read();
+ const Vector2 *r = baked_point_cache.ptr();
Vector2 nearest;
float nearest_dist = -1.0f;
@@ -869,7 +869,7 @@ float Curve2D::get_closest_offset(const Vector2 &p_to_point) const {
if (pc == 1)
return 0.0f;
- PoolVector2Array::Read r = baked_point_cache.read();
+ const Vector2 *r = baked_point_cache.ptr();
float nearest = 0.0f;
float nearest_dist = -1.0f;
@@ -899,9 +899,9 @@ Dictionary Curve2D::_get_data() const {
Dictionary dc;
- PoolVector2Array d;
+ PackedVector2Array d;
d.resize(points.size() * 3);
- PoolVector2Array::Write w = d.write();
+ Vector2 *w = d.ptrw();
for (int i = 0; i < points.size(); i++) {
@@ -910,8 +910,6 @@ Dictionary Curve2D::_get_data() const {
w[i * 3 + 2] = points[i].pos;
}
- w = PoolVector2Array::Write();
-
dc["points"] = d;
return dc;
@@ -920,11 +918,11 @@ void Curve2D::_set_data(const Dictionary &p_data) {
ERR_FAIL_COND(!p_data.has("points"));
- PoolVector2Array rp = p_data["points"];
+ PackedVector2Array rp = p_data["points"];
int pc = rp.size();
ERR_FAIL_COND(pc % 3 != 0);
points.resize(pc / 3);
- PoolVector2Array::Read r = rp.read();
+ const Vector2 *r = rp.ptr();
for (int i = 0; i < points.size(); i++) {
@@ -936,9 +934,9 @@ void Curve2D::_set_data(const Dictionary &p_data) {
baked_cache_dirty = true;
}
-PoolVector2Array Curve2D::tessellate(int p_max_stages, float p_tolerance) const {
+PackedVector2Array Curve2D::tessellate(int p_max_stages, float p_tolerance) const {
- PoolVector2Array tess;
+ PackedVector2Array tess;
if (points.size() == 0) {
return tess;
@@ -956,7 +954,7 @@ PoolVector2Array Curve2D::tessellate(int p_max_stages, float p_tolerance) const
}
tess.resize(pc);
- PoolVector2Array::Write bpw = tess.write();
+ Vector2 *bpw = tess.ptrw();
bpw[0] = points[0].pos;
int pidx = 0;
@@ -972,8 +970,6 @@ PoolVector2Array Curve2D::tessellate(int p_max_stages, float p_tolerance) const
bpw[pidx] = points[i + 1].pos;
}
- bpw = PoolVector2Array::Write();
-
return tess;
}
@@ -1005,7 +1001,7 @@ void Curve2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("_get_data"), &Curve2D::_get_data);
ClassDB::bind_method(D_METHOD("_set_data"), &Curve2D::_set_data);
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "bake_interval", PROPERTY_HINT_RANGE, "0.01,512,0.01"), "set_bake_interval", "get_bake_interval");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "bake_interval", PROPERTY_HINT_RANGE, "0.01,512,0.01"), "set_bake_interval", "get_bake_interval");
ADD_PROPERTY(PropertyInfo(Variant::INT, "_data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_data", "_get_data");
}
@@ -1258,14 +1254,14 @@ void Curve3D::_bake() const {
pointlist.push_back(Plane(lastpos, lastilt));
baked_point_cache.resize(pointlist.size());
- PoolVector3Array::Write w = baked_point_cache.write();
+ Vector3 *w = baked_point_cache.ptrw();
int idx = 0;
baked_tilt_cache.resize(pointlist.size());
- PoolRealArray::Write wt = baked_tilt_cache.write();
+ real_t *wt = baked_tilt_cache.ptrw();
baked_up_vector_cache.resize(up_vector_enabled ? pointlist.size() : 0);
- PoolVector3Array::Write up_write = baked_up_vector_cache.write();
+ Vector3 *up_write = baked_up_vector_cache.ptrw();
Vector3 sideways;
Vector3 up;
@@ -1333,7 +1329,7 @@ Vector3 Curve3D::interpolate_baked(float p_offset, bool p_cubic) const {
return baked_point_cache.get(0);
int bpc = baked_point_cache.size();
- PoolVector3Array::Read r = baked_point_cache.read();
+ const Vector3 *r = baked_point_cache.ptr();
if (p_offset < 0)
return r[0];
@@ -1375,7 +1371,7 @@ float Curve3D::interpolate_baked_tilt(float p_offset) const {
return baked_tilt_cache.get(0);
int bpc = baked_tilt_cache.size();
- PoolRealArray::Read r = baked_tilt_cache.read();
+ const real_t *r = baked_tilt_cache.ptr();
if (p_offset < 0)
return r[0];
@@ -1410,9 +1406,9 @@ Vector3 Curve3D::interpolate_baked_up_vector(float p_offset, bool p_apply_tilt)
if (count == 1)
return baked_up_vector_cache.get(0);
- PoolVector3Array::Read r = baked_up_vector_cache.read();
- PoolVector3Array::Read rp = baked_point_cache.read();
- PoolRealArray::Read rt = baked_tilt_cache.read();
+ const Vector3 *r = baked_up_vector_cache.ptr();
+ const Vector3 *rp = baked_point_cache.ptr();
+ const real_t *rt = baked_tilt_cache.ptr();
float offset = CLAMP(p_offset, 0.0f, baked_max_ofs);
@@ -1441,7 +1437,7 @@ Vector3 Curve3D::interpolate_baked_up_vector(float p_offset, bool p_apply_tilt)
return up.rotated(axis, up.angle_to(up1) * frac);
}
-PoolVector3Array Curve3D::get_baked_points() const {
+PackedVector3Array Curve3D::get_baked_points() const {
if (baked_cache_dirty)
_bake();
@@ -1449,7 +1445,7 @@ PoolVector3Array Curve3D::get_baked_points() const {
return baked_point_cache;
}
-PoolRealArray Curve3D::get_baked_tilts() const {
+PackedFloat32Array Curve3D::get_baked_tilts() const {
if (baked_cache_dirty)
_bake();
@@ -1457,7 +1453,7 @@ PoolRealArray Curve3D::get_baked_tilts() const {
return baked_tilt_cache;
}
-PoolVector3Array Curve3D::get_baked_up_vectors() const {
+PackedVector3Array Curve3D::get_baked_up_vectors() const {
if (baked_cache_dirty)
_bake();
@@ -1478,7 +1474,7 @@ Vector3 Curve3D::get_closest_point(const Vector3 &p_to_point) const {
if (pc == 1)
return baked_point_cache.get(0);
- PoolVector3Array::Read r = baked_point_cache.read();
+ const Vector3 *r = baked_point_cache.ptr();
Vector3 nearest;
float nearest_dist = -1.0f;
@@ -1514,7 +1510,7 @@ float Curve3D::get_closest_offset(const Vector3 &p_to_point) const {
if (pc == 1)
return 0.0f;
- PoolVector3Array::Read r = baked_point_cache.read();
+ const Vector3 *r = baked_point_cache.ptr();
float nearest = 0.0f;
float nearest_dist = -1.0f;
@@ -1568,12 +1564,12 @@ Dictionary Curve3D::_get_data() const {
Dictionary dc;
- PoolVector3Array d;
+ PackedVector3Array d;
d.resize(points.size() * 3);
- PoolVector3Array::Write w = d.write();
- PoolRealArray t;
+ Vector3 *w = d.ptrw();
+ PackedFloat32Array t;
t.resize(points.size());
- PoolRealArray::Write wt = t.write();
+ real_t *wt = t.ptrw();
for (int i = 0; i < points.size(); i++) {
@@ -1583,9 +1579,6 @@ Dictionary Curve3D::_get_data() const {
wt[i] = points[i].tilt;
}
- w = PoolVector3Array::Write();
- wt = PoolRealArray::Write();
-
dc["points"] = d;
dc["tilts"] = t;
@@ -1596,13 +1589,13 @@ void Curve3D::_set_data(const Dictionary &p_data) {
ERR_FAIL_COND(!p_data.has("points"));
ERR_FAIL_COND(!p_data.has("tilts"));
- PoolVector3Array rp = p_data["points"];
+ PackedVector3Array rp = p_data["points"];
int pc = rp.size();
ERR_FAIL_COND(pc % 3 != 0);
points.resize(pc / 3);
- PoolVector3Array::Read r = rp.read();
- PoolRealArray rtl = p_data["tilts"];
- PoolRealArray::Read rt = rtl.read();
+ const Vector3 *r = rp.ptr();
+ PackedFloat32Array rtl = p_data["tilts"];
+ const real_t *rt = rtl.ptr();
for (int i = 0; i < points.size(); i++) {
@@ -1615,9 +1608,9 @@ void Curve3D::_set_data(const Dictionary &p_data) {
baked_cache_dirty = true;
}
-PoolVector3Array Curve3D::tessellate(int p_max_stages, float p_tolerance) const {
+PackedVector3Array Curve3D::tessellate(int p_max_stages, float p_tolerance) const {
- PoolVector3Array tess;
+ PackedVector3Array tess;
if (points.size() == 0) {
return tess;
@@ -1635,7 +1628,7 @@ PoolVector3Array Curve3D::tessellate(int p_max_stages, float p_tolerance) const
}
tess.resize(pc);
- PoolVector3Array::Write bpw = tess.write();
+ Vector3 *bpw = tess.ptrw();
bpw[0] = points[0].pos;
int pidx = 0;
@@ -1651,8 +1644,6 @@ PoolVector3Array Curve3D::tessellate(int p_max_stages, float p_tolerance) const
bpw[pidx] = points[i + 1].pos;
}
- bpw = PoolVector3Array::Write();
-
return tess;
}
@@ -1691,7 +1682,7 @@ void Curve3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("_get_data"), &Curve3D::_get_data);
ClassDB::bind_method(D_METHOD("_set_data"), &Curve3D::_set_data);
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "bake_interval", PROPERTY_HINT_RANGE, "0.01,512,0.01"), "set_bake_interval", "get_bake_interval");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "bake_interval", PROPERTY_HINT_RANGE, "0.01,512,0.01"), "set_bake_interval", "get_bake_interval");
ADD_PROPERTY(PropertyInfo(Variant::INT, "_data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_data", "_get_data");
ADD_GROUP("Up Vector", "up_vector_");
diff --git a/scene/resources/curve.h b/scene/resources/curve.h
index b02466534c..7dcbf1ceff 100644
--- a/scene/resources/curve.h
+++ b/scene/resources/curve.h
@@ -168,7 +168,7 @@ class Curve2D : public Resource {
};
mutable bool baked_cache_dirty;
- mutable PoolVector2Array baked_point_cache;
+ mutable PackedVector2Array baked_point_cache;
mutable float baked_max_ofs;
void _bake() const;
@@ -202,11 +202,11 @@ public:
float get_baked_length() const;
Vector2 interpolate_baked(float p_offset, bool p_cubic = false) const;
- PoolVector2Array get_baked_points() const; //useful for going through
+ PackedVector2Array get_baked_points() const; //useful for going through
Vector2 get_closest_point(const Vector2 &p_to_point) const;
float get_closest_offset(const Vector2 &p_to_point) const;
- PoolVector2Array tessellate(int p_max_stages = 5, float p_tolerance = 4) const; //useful for display
+ PackedVector2Array tessellate(int p_max_stages = 5, float p_tolerance = 4) const; //useful for display
Curve2D();
};
@@ -234,9 +234,9 @@ class Curve3D : public Resource {
};
mutable bool baked_cache_dirty;
- mutable PoolVector3Array baked_point_cache;
- mutable PoolRealArray baked_tilt_cache;
- mutable PoolVector3Array baked_up_vector_cache;
+ mutable PackedVector3Array baked_point_cache;
+ mutable PackedFloat32Array baked_tilt_cache;
+ mutable PackedVector3Array baked_up_vector_cache;
mutable float baked_max_ofs;
void _bake() const;
@@ -277,13 +277,13 @@ public:
Vector3 interpolate_baked(float p_offset, bool p_cubic = false) const;
float interpolate_baked_tilt(float p_offset) const;
Vector3 interpolate_baked_up_vector(float p_offset, bool p_apply_tilt = false) const;
- PoolVector3Array get_baked_points() const; //useful for going through
- PoolRealArray get_baked_tilts() const; //useful for going through
- PoolVector3Array get_baked_up_vectors() const;
+ PackedVector3Array get_baked_points() const; //useful for going through
+ PackedFloat32Array get_baked_tilts() const; //useful for going through
+ PackedVector3Array get_baked_up_vectors() const;
Vector3 get_closest_point(const Vector3 &p_to_point) const;
float get_closest_offset(const Vector3 &p_to_point) const;
- PoolVector3Array tessellate(int p_max_stages = 5, float p_tolerance = 4) const; //useful for display
+ PackedVector3Array tessellate(int p_max_stages = 5, float p_tolerance = 4) const; //useful for display
Curve3D();
};
diff --git a/scene/resources/cylinder_shape.cpp b/scene/resources/cylinder_shape.cpp
index b9b0d77a1b..53d368d32a 100644
--- a/scene/resources/cylinder_shape.cpp
+++ b/scene/resources/cylinder_shape.cpp
@@ -108,8 +108,8 @@ void CylinderShape::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_height", "height"), &CylinderShape::set_height);
ClassDB::bind_method(D_METHOD("get_height"), &CylinderShape::get_height);
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "radius", PROPERTY_HINT_RANGE, "0.01,4096,0.01"), "set_radius", "get_radius");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "height", PROPERTY_HINT_RANGE, "0.01,4096,0.01"), "set_height", "get_height");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "radius", PROPERTY_HINT_RANGE, "0.01,4096,0.01"), "set_radius", "get_radius");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "height", PROPERTY_HINT_RANGE, "0.01,4096,0.01"), "set_height", "get_height");
}
CylinderShape::CylinderShape() :
diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp
index 5a6a8dc286..04bc95ade6 100644
--- a/scene/resources/default_theme/default_theme.cpp
+++ b/scene/resources/default_theme/default_theme.cpp
@@ -706,9 +706,6 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_color("font_color_disabled", "TabContainer", control_font_color_disabled);
theme->set_constant("side_margin", "TabContainer", 8 * scale);
- theme->set_constant("top_margin", "TabContainer", 24 * scale);
- theme->set_constant("label_valign_fg", "TabContainer", 0 * scale);
- theme->set_constant("label_valign_bg", "TabContainer", 2 * scale);
theme->set_constant("hseparation", "TabContainer", 4 * scale);
// Tabs
@@ -732,9 +729,6 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_color("font_color_bg", "Tabs", control_font_color_low);
theme->set_color("font_color_disabled", "Tabs", control_font_color_disabled);
- theme->set_constant("top_margin", "Tabs", 24 * scale);
- theme->set_constant("label_valign_fg", "Tabs", 0 * scale);
- theme->set_constant("label_valign_bg", "Tabs", 2 * scale);
theme->set_constant("hseparation", "Tabs", 4 * scale);
// Separators
diff --git a/scene/resources/dynamic_font.cpp b/scene/resources/dynamic_font.cpp
index d2a90f388e..79a1500129 100644
--- a/scene/resources/dynamic_font.cpp
+++ b/scene/resources/dynamic_font.cpp
@@ -442,7 +442,7 @@ DynamicFontAtSize::TexturePosition DynamicFontAtSize::_find_texture_pos_for_glyp
{
//zero texture
- PoolVector<uint8_t>::Write w = tex.imgdata.write();
+ uint8_t *w = tex.imgdata.ptrw();
ERR_FAIL_COND_V(texsize * texsize * p_color_size > tex.imgdata.size(), ret);
for (int i = 0; i < texsize * texsize * p_color_size; i++) {
w[i] = 0;
@@ -480,7 +480,7 @@ DynamicFontAtSize::Character DynamicFontAtSize::_bitmap_to_character(FT_Bitmap b
CharTexture &tex = textures.write[tex_pos.index];
{
- PoolVector<uint8_t>::Write wr = tex.imgdata.write();
+ uint8_t *wr = tex.imgdata.ptrw();
for (int i = 0; i < h; i++) {
for (int j = 0; j < w; j++) {
diff --git a/scene/resources/dynamic_font.h b/scene/resources/dynamic_font.h
index 94f03665d3..fa6db370f8 100644
--- a/scene/resources/dynamic_font.h
+++ b/scene/resources/dynamic_font.h
@@ -129,7 +129,7 @@ class DynamicFontAtSize : public Reference {
struct CharTexture {
- PoolVector<uint8_t> imgdata;
+ Vector<uint8_t> imgdata;
int texture_size;
Vector<int> offsets;
Ref<ImageTexture> texture;
diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp
index 6790f02128..d407dd3722 100644
--- a/scene/resources/environment.cpp
+++ b/scene/resources/environment.cpp
@@ -870,16 +870,16 @@ void Environment::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "background_canvas_max_layer", PROPERTY_HINT_RANGE, "-1000,1000,1"), "set_canvas_max_layer", "get_canvas_max_layer");
ADD_PROPERTY(PropertyInfo(Variant::INT, "background_camera_feed_id", PROPERTY_HINT_RANGE, "1,10,1"), "set_camera_feed_id", "get_camera_feed_id");
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "background_color"), "set_bg_color", "get_bg_color");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "background_energy", PROPERTY_HINT_RANGE, "0,16,0.01"), "set_bg_energy", "get_bg_energy");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "background_energy", PROPERTY_HINT_RANGE, "0,16,0.01"), "set_bg_energy", "get_bg_energy");
ADD_GROUP("Sky", "sky_");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "sky", PROPERTY_HINT_RESOURCE_TYPE, "Sky"), "set_sky", "get_sky");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "sky_custom_fov", PROPERTY_HINT_RANGE, "0,180,0.1"), "set_sky_custom_fov", "get_sky_custom_fov");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "sky_custom_fov", PROPERTY_HINT_RANGE, "0,180,0.1"), "set_sky_custom_fov", "get_sky_custom_fov");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "sky_rotation"), "set_sky_rotation", "get_sky_rotation");
ADD_GROUP("Ambient Light", "ambient_light_");
ADD_PROPERTY(PropertyInfo(Variant::INT, "ambient_light_source", PROPERTY_HINT_ENUM, "Background,Disabled,Color,Sky"), "set_ambient_source", "get_ambient_source");
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "ambient_light_color"), "set_ambient_light_color", "get_ambient_light_color");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "ambient_light_sky_contribution", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_ambient_light_sky_contribution", "get_ambient_light_sky_contribution");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "ambient_light_energy", PROPERTY_HINT_RANGE, "0,16,0.01"), "set_ambient_light_energy", "get_ambient_light_energy");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "ambient_light_sky_contribution", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_ambient_light_sky_contribution", "get_ambient_light_sky_contribution");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "ambient_light_energy", PROPERTY_HINT_RANGE, "0,16,0.01"), "set_ambient_light_energy", "get_ambient_light_energy");
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "ambient_light_occlusion_color", PROPERTY_HINT_COLOR_NO_ALPHA), "set_ao_color", "get_ao_color");
ADD_GROUP("Reflected Light", "reflected_light_");
ADD_PROPERTY(PropertyInfo(Variant::INT, "reflected_light_source", PROPERTY_HINT_ENUM, "Background,Disabled,Sky"), "set_reflection_source", "get_reflection_source");
@@ -930,17 +930,17 @@ void Environment::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "fog_enabled"), "set_fog_enabled", "is_fog_enabled");
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "fog_color"), "set_fog_color", "get_fog_color");
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "fog_sun_color"), "set_fog_sun_color", "get_fog_sun_color");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "fog_sun_amount", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_fog_sun_amount", "get_fog_sun_amount");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "fog_sun_amount", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_fog_sun_amount", "get_fog_sun_amount");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "fog_depth_enabled"), "set_fog_depth_enabled", "is_fog_depth_enabled");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "fog_depth_begin", PROPERTY_HINT_RANGE, "0,4000,0.1"), "set_fog_depth_begin", "get_fog_depth_begin");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "fog_depth_end", PROPERTY_HINT_RANGE, "0,4000,0.1,or_greater"), "set_fog_depth_end", "get_fog_depth_end");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "fog_depth_curve", PROPERTY_HINT_EXP_EASING), "set_fog_depth_curve", "get_fog_depth_curve");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "fog_depth_begin", PROPERTY_HINT_RANGE, "0,4000,0.1"), "set_fog_depth_begin", "get_fog_depth_begin");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "fog_depth_end", PROPERTY_HINT_RANGE, "0,4000,0.1,or_greater"), "set_fog_depth_end", "get_fog_depth_end");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "fog_depth_curve", PROPERTY_HINT_EXP_EASING), "set_fog_depth_curve", "get_fog_depth_curve");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "fog_transmit_enabled"), "set_fog_transmit_enabled", "is_fog_transmit_enabled");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "fog_transmit_curve", PROPERTY_HINT_EXP_EASING), "set_fog_transmit_curve", "get_fog_transmit_curve");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "fog_transmit_curve", PROPERTY_HINT_EXP_EASING), "set_fog_transmit_curve", "get_fog_transmit_curve");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "fog_height_enabled"), "set_fog_height_enabled", "is_fog_height_enabled");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "fog_height_min", PROPERTY_HINT_RANGE, "-4000,4000,0.1,or_lesser,or_greater"), "set_fog_height_min", "get_fog_height_min");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "fog_height_max", PROPERTY_HINT_RANGE, "-4000,4000,0.1,or_lesser,or_greater"), "set_fog_height_max", "get_fog_height_max");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "fog_height_curve", PROPERTY_HINT_EXP_EASING), "set_fog_height_curve", "get_fog_height_curve");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "fog_height_min", PROPERTY_HINT_RANGE, "-4000,4000,0.1,or_lesser,or_greater"), "set_fog_height_min", "get_fog_height_min");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "fog_height_max", PROPERTY_HINT_RANGE, "-4000,4000,0.1,or_lesser,or_greater"), "set_fog_height_max", "get_fog_height_max");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "fog_height_curve", PROPERTY_HINT_EXP_EASING), "set_fog_height_curve", "get_fog_height_curve");
ClassDB::bind_method(D_METHOD("set_tonemapper", "mode"), &Environment::set_tonemapper);
ClassDB::bind_method(D_METHOD("get_tonemapper"), &Environment::get_tonemapper);
@@ -968,14 +968,14 @@ void Environment::_bind_methods() {
ADD_GROUP("Tonemap", "tonemap_");
ADD_PROPERTY(PropertyInfo(Variant::INT, "tonemap_mode", PROPERTY_HINT_ENUM, "Linear,Reinhard,Filmic,Aces"), "set_tonemapper", "get_tonemapper");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "tonemap_exposure", PROPERTY_HINT_RANGE, "0,16,0.01"), "set_tonemap_exposure", "get_tonemap_exposure");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "tonemap_white", PROPERTY_HINT_RANGE, "0,16,0.01"), "set_tonemap_white", "get_tonemap_white");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "tonemap_exposure", PROPERTY_HINT_RANGE, "0,16,0.01"), "set_tonemap_exposure", "get_tonemap_exposure");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "tonemap_white", PROPERTY_HINT_RANGE, "0,16,0.01"), "set_tonemap_white", "get_tonemap_white");
ADD_GROUP("Auto Exposure", "auto_exposure_");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "auto_exposure_enabled"), "set_tonemap_auto_exposure", "get_tonemap_auto_exposure");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "auto_exposure_scale", PROPERTY_HINT_RANGE, "0.01,64,0.01"), "set_tonemap_auto_exposure_grey", "get_tonemap_auto_exposure_grey");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "auto_exposure_min_luma", PROPERTY_HINT_RANGE, "0,16,0.01"), "set_tonemap_auto_exposure_min", "get_tonemap_auto_exposure_min");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "auto_exposure_max_luma", PROPERTY_HINT_RANGE, "0,16,0.01"), "set_tonemap_auto_exposure_max", "get_tonemap_auto_exposure_max");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "auto_exposure_speed", PROPERTY_HINT_RANGE, "0.01,64,0.01"), "set_tonemap_auto_exposure_speed", "get_tonemap_auto_exposure_speed");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "auto_exposure_scale", PROPERTY_HINT_RANGE, "0.01,64,0.01"), "set_tonemap_auto_exposure_grey", "get_tonemap_auto_exposure_grey");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "auto_exposure_min_luma", PROPERTY_HINT_RANGE, "0,16,0.01"), "set_tonemap_auto_exposure_min", "get_tonemap_auto_exposure_min");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "auto_exposure_max_luma", PROPERTY_HINT_RANGE, "0,16,0.01"), "set_tonemap_auto_exposure_max", "get_tonemap_auto_exposure_max");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "auto_exposure_speed", PROPERTY_HINT_RANGE, "0.01,64,0.01"), "set_tonemap_auto_exposure_speed", "get_tonemap_auto_exposure_speed");
ClassDB::bind_method(D_METHOD("set_ssr_enabled", "enabled"), &Environment::set_ssr_enabled);
ClassDB::bind_method(D_METHOD("is_ssr_enabled"), &Environment::is_ssr_enabled);
@@ -998,9 +998,9 @@ void Environment::_bind_methods() {
ADD_GROUP("SS Reflections", "ss_reflections_");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "ss_reflections_enabled"), "set_ssr_enabled", "is_ssr_enabled");
ADD_PROPERTY(PropertyInfo(Variant::INT, "ss_reflections_max_steps", PROPERTY_HINT_RANGE, "1,512,1"), "set_ssr_max_steps", "get_ssr_max_steps");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "ss_reflections_fade_in", PROPERTY_HINT_EXP_EASING), "set_ssr_fade_in", "get_ssr_fade_in");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "ss_reflections_fade_out", PROPERTY_HINT_EXP_EASING), "set_ssr_fade_out", "get_ssr_fade_out");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "ss_reflections_depth_tolerance", PROPERTY_HINT_RANGE, "0.1,128,0.1"), "set_ssr_depth_tolerance", "get_ssr_depth_tolerance");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "ss_reflections_fade_in", PROPERTY_HINT_EXP_EASING), "set_ssr_fade_in", "get_ssr_fade_in");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "ss_reflections_fade_out", PROPERTY_HINT_EXP_EASING), "set_ssr_fade_out", "get_ssr_fade_out");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "ss_reflections_depth_tolerance", PROPERTY_HINT_RANGE, "0.1,128,0.1"), "set_ssr_depth_tolerance", "get_ssr_depth_tolerance");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "ss_reflections_roughness"), "set_ssr_rough", "is_ssr_rough");
ClassDB::bind_method(D_METHOD("set_ssao_enabled", "enabled"), &Environment::set_ssao_enabled);
@@ -1029,13 +1029,13 @@ void Environment::_bind_methods() {
ADD_GROUP("SSAO", "ssao_");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "ssao_enabled"), "set_ssao_enabled", "is_ssao_enabled");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "ssao_radius", PROPERTY_HINT_RANGE, "0.1,128,0.1"), "set_ssao_radius", "get_ssao_radius");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "ssao_intensity", PROPERTY_HINT_RANGE, "0.0,128,0.1"), "set_ssao_intensity", "get_ssao_intensity");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "ssao_bias", PROPERTY_HINT_RANGE, "0.001,8,0.001"), "set_ssao_bias", "get_ssao_bias");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "ssao_light_affect", PROPERTY_HINT_RANGE, "0.00,1,0.01"), "set_ssao_direct_light_affect", "get_ssao_direct_light_affect");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "ssao_ao_channel_affect", PROPERTY_HINT_RANGE, "0.00,1,0.01"), "set_ssao_ao_channel_affect", "get_ssao_ao_channel_affect");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "ssao_radius", PROPERTY_HINT_RANGE, "0.1,128,0.1"), "set_ssao_radius", "get_ssao_radius");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "ssao_intensity", PROPERTY_HINT_RANGE, "0.0,128,0.1"), "set_ssao_intensity", "get_ssao_intensity");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "ssao_bias", PROPERTY_HINT_RANGE, "0.001,8,0.001"), "set_ssao_bias", "get_ssao_bias");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "ssao_light_affect", PROPERTY_HINT_RANGE, "0.00,1,0.01"), "set_ssao_direct_light_affect", "get_ssao_direct_light_affect");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "ssao_ao_channel_affect", PROPERTY_HINT_RANGE, "0.00,1,0.01"), "set_ssao_ao_channel_affect", "get_ssao_ao_channel_affect");
ADD_PROPERTY(PropertyInfo(Variant::INT, "ssao_blur", PROPERTY_HINT_ENUM, "Disabled,1x1,2x2,3x3"), "set_ssao_blur", "get_ssao_blur");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "ssao_edge_sharpness", PROPERTY_HINT_RANGE, "0,32,0.01"), "set_ssao_edge_sharpness", "get_ssao_edge_sharpness");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "ssao_edge_sharpness", PROPERTY_HINT_RANGE, "0,32,0.01"), "set_ssao_edge_sharpness", "get_ssao_edge_sharpness");
ClassDB::bind_method(D_METHOD("set_glow_enabled", "enabled"), &Environment::set_glow_enabled);
ClassDB::bind_method(D_METHOD("is_glow_enabled"), &Environment::is_glow_enabled);
@@ -1080,14 +1080,14 @@ void Environment::_bind_methods() {
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "glow_levels/6"), "set_glow_level", "is_glow_level_enabled", 5);
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "glow_levels/7"), "set_glow_level", "is_glow_level_enabled", 6);
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "glow_intensity", PROPERTY_HINT_RANGE, "0.0,8.0,0.01"), "set_glow_intensity", "get_glow_intensity");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "glow_mix", PROPERTY_HINT_RANGE, "0.0,1.0,0.001"), "set_glow_mix", "get_glow_mix");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "glow_strength", PROPERTY_HINT_RANGE, "0.0,2.0,0.01"), "set_glow_strength", "get_glow_strength");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "glow_bloom", PROPERTY_HINT_RANGE, "0.0,1.0,0.01"), "set_glow_bloom", "get_glow_bloom");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "glow_intensity", PROPERTY_HINT_RANGE, "0.0,8.0,0.01"), "set_glow_intensity", "get_glow_intensity");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "glow_mix", PROPERTY_HINT_RANGE, "0.0,1.0,0.001"), "set_glow_mix", "get_glow_mix");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "glow_strength", PROPERTY_HINT_RANGE, "0.0,2.0,0.01"), "set_glow_strength", "get_glow_strength");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "glow_bloom", PROPERTY_HINT_RANGE, "0.0,1.0,0.01"), "set_glow_bloom", "get_glow_bloom");
ADD_PROPERTY(PropertyInfo(Variant::INT, "glow_blend_mode", PROPERTY_HINT_ENUM, "Additive,Screen,Softlight,Replace,Mix"), "set_glow_blend_mode", "get_glow_blend_mode");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "glow_hdr_threshold", PROPERTY_HINT_RANGE, "0.0,4.0,0.01"), "set_glow_hdr_bleed_threshold", "get_glow_hdr_bleed_threshold");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "glow_hdr_luminance_cap", PROPERTY_HINT_RANGE, "0.0,256.0,0.01"), "set_glow_hdr_luminance_cap", "get_glow_hdr_luminance_cap");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "glow_hdr_scale", PROPERTY_HINT_RANGE, "0.0,4.0,0.01"), "set_glow_hdr_bleed_scale", "get_glow_hdr_bleed_scale");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "glow_hdr_threshold", PROPERTY_HINT_RANGE, "0.0,4.0,0.01"), "set_glow_hdr_bleed_threshold", "get_glow_hdr_bleed_threshold");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "glow_hdr_luminance_cap", PROPERTY_HINT_RANGE, "0.0,256.0,0.01"), "set_glow_hdr_luminance_cap", "get_glow_hdr_luminance_cap");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "glow_hdr_scale", PROPERTY_HINT_RANGE, "0.0,4.0,0.01"), "set_glow_hdr_bleed_scale", "get_glow_hdr_bleed_scale");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "glow_bicubic_upscale"), "set_glow_bicubic_upscale", "is_glow_bicubic_upscale_enabled");
ClassDB::bind_method(D_METHOD("set_adjustment_enable", "enabled"), &Environment::set_adjustment_enable);
@@ -1107,9 +1107,9 @@ void Environment::_bind_methods() {
ADD_GROUP("Adjustments", "adjustment_");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "adjustment_enabled"), "set_adjustment_enable", "is_adjustment_enabled");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "adjustment_brightness", PROPERTY_HINT_RANGE, "0.01,8,0.01"), "set_adjustment_brightness", "get_adjustment_brightness");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "adjustment_contrast", PROPERTY_HINT_RANGE, "0.01,8,0.01"), "set_adjustment_contrast", "get_adjustment_contrast");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "adjustment_saturation", PROPERTY_HINT_RANGE, "0.01,8,0.01"), "set_adjustment_saturation", "get_adjustment_saturation");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "adjustment_brightness", PROPERTY_HINT_RANGE, "0.01,8,0.01"), "set_adjustment_brightness", "get_adjustment_brightness");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "adjustment_contrast", PROPERTY_HINT_RANGE, "0.01,8,0.01"), "set_adjustment_contrast", "get_adjustment_contrast");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "adjustment_saturation", PROPERTY_HINT_RANGE, "0.01,8,0.01"), "set_adjustment_saturation", "get_adjustment_saturation");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "adjustment_color_correction", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_adjustment_color_correction", "get_adjustment_color_correction");
BIND_ENUM_CONSTANT(BG_CLEAR_COLOR);
@@ -1361,7 +1361,7 @@ void CameraEffects::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_dof_blur_amount", "intensity"), &CameraEffects::set_dof_blur_amount);
ClassDB::bind_method(D_METHOD("get_dof_blur_amount"), &CameraEffects::get_dof_blur_amount);
- ClassDB::bind_method(D_METHOD("set_override_exposure_enabled", "enable"), &CameraEffects::set_override_exposure);
+ ClassDB::bind_method(D_METHOD("set_override_exposure_enabled", "enable"), &CameraEffects::set_override_exposure_enabled);
ClassDB::bind_method(D_METHOD("is_override_exposure_enabled"), &CameraEffects::is_override_exposure_enabled);
ClassDB::bind_method(D_METHOD("set_override_exposure", "exposure"), &CameraEffects::set_override_exposure);
@@ -1369,15 +1369,15 @@ void CameraEffects::_bind_methods() {
ADD_GROUP("DOF Blur", "dof_blur_");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "dof_blur_far_enabled"), "set_dof_blur_far_enabled", "is_dof_blur_far_enabled");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "dof_blur_far_distance", PROPERTY_HINT_EXP_RANGE, "0.01,8192,0.01"), "set_dof_blur_far_distance", "get_dof_blur_far_distance");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "dof_blur_far_transition", PROPERTY_HINT_EXP_RANGE, "0.01,8192,0.01"), "set_dof_blur_far_transition", "get_dof_blur_far_transition");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "dof_blur_far_distance", PROPERTY_HINT_EXP_RANGE, "0.01,8192,0.01"), "set_dof_blur_far_distance", "get_dof_blur_far_distance");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "dof_blur_far_transition", PROPERTY_HINT_EXP_RANGE, "0.01,8192,0.01"), "set_dof_blur_far_transition", "get_dof_blur_far_transition");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "dof_blur_near_enabled"), "set_dof_blur_near_enabled", "is_dof_blur_near_enabled");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "dof_blur_near_distance", PROPERTY_HINT_EXP_RANGE, "0.01,8192,0.01"), "set_dof_blur_near_distance", "get_dof_blur_near_distance");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "dof_blur_near_transition", PROPERTY_HINT_EXP_RANGE, "0.01,8192,0.01"), "set_dof_blur_near_transition", "get_dof_blur_near_transition");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "dof_blur_amount", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_dof_blur_amount", "get_dof_blur_amount");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "dof_blur_near_distance", PROPERTY_HINT_EXP_RANGE, "0.01,8192,0.01"), "set_dof_blur_near_distance", "get_dof_blur_near_distance");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "dof_blur_near_transition", PROPERTY_HINT_EXP_RANGE, "0.01,8192,0.01"), "set_dof_blur_near_transition", "get_dof_blur_near_transition");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "dof_blur_amount", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_dof_blur_amount", "get_dof_blur_amount");
ADD_GROUP("Override Exposure", "override_");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "override_exposure_enable"), "set_override_exposure_enabled", "is_override_exposure_enabled");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "override_exposure", PROPERTY_HINT_RANGE, "0,16,0.01"), "set_override_exposure", "get_override_exposure");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "override_exposure", PROPERTY_HINT_RANGE, "0,16,0.01"), "set_override_exposure", "get_override_exposure");
}
CameraEffects::CameraEffects() {
diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp
index 663ae5d45d..316d6f04d7 100644
--- a/scene/resources/font.cpp
+++ b/scene/resources/font.cpp
@@ -107,7 +107,7 @@ Font::Font() {
/////////////////////////////////////////////////////////////////
-void BitmapFont::_set_chars(const PoolVector<int> &p_chars) {
+void BitmapFont::_set_chars(const Vector<int> &p_chars) {
int len = p_chars.size();
//char 1 charsize 1 texture, 4 rect, 2 align, advance 1
@@ -116,7 +116,7 @@ void BitmapFont::_set_chars(const PoolVector<int> &p_chars) {
return; //none to do
int chars = len / 9;
- PoolVector<int>::Read r = p_chars.read();
+ const int *r = p_chars.ptr();
for (int i = 0; i < chars; i++) {
const int *data = &r[i * 9];
@@ -124,16 +124,16 @@ void BitmapFont::_set_chars(const PoolVector<int> &p_chars) {
}
}
-PoolVector<int> BitmapFont::_get_chars() const {
+Vector<int> BitmapFont::_get_chars() const {
- PoolVector<int> chars;
+ Vector<int> chars;
const CharType *key = NULL;
while ((key = char_map.next(key))) {
const Character *c = char_map.getptr(*key);
- ERR_FAIL_COND_V(!c, PoolVector<int>());
+ ERR_FAIL_COND_V(!c, Vector<int>());
chars.push_back(*key);
chars.push_back(c->texture_idx);
chars.push_back(c->rect.position.x);
@@ -149,13 +149,13 @@ PoolVector<int> BitmapFont::_get_chars() const {
return chars;
}
-void BitmapFont::_set_kernings(const PoolVector<int> &p_kernings) {
+void BitmapFont::_set_kernings(const Vector<int> &p_kernings) {
int len = p_kernings.size();
ERR_FAIL_COND(len % 3);
if (!len)
return;
- PoolVector<int>::Read r = p_kernings.read();
+ const int *r = p_kernings.ptr();
for (int i = 0; i < len / 3; i++) {
@@ -164,9 +164,9 @@ void BitmapFont::_set_kernings(const PoolVector<int> &p_kernings) {
}
}
-PoolVector<int> BitmapFont::_get_kernings() const {
+Vector<int> BitmapFont::_get_kernings() const {
- PoolVector<int> kernings;
+ Vector<int> kernings;
for (Map<KerningPairKey, int>::Element *E = kerning_map.front(); E; E = E->next()) {
@@ -192,7 +192,7 @@ Vector<Variant> BitmapFont::_get_textures() const {
Vector<Variant> rtextures;
for (int i = 0; i < textures.size(); i++)
- rtextures.push_back(textures[i].get_ref_ptr());
+ rtextures.push_back(textures[i]);
return rtextures;
}
@@ -625,11 +625,11 @@ void BitmapFont::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_fallback"), &BitmapFont::get_fallback);
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "textures", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_textures", "_get_textures");
- ADD_PROPERTY(PropertyInfo(Variant::POOL_INT_ARRAY, "chars", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_chars", "_get_chars");
- ADD_PROPERTY(PropertyInfo(Variant::POOL_INT_ARRAY, "kernings", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_kernings", "_get_kernings");
+ ADD_PROPERTY(PropertyInfo(Variant::PACKED_INT32_ARRAY, "chars", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_chars", "_get_chars");
+ ADD_PROPERTY(PropertyInfo(Variant::PACKED_INT32_ARRAY, "kernings", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_kernings", "_get_kernings");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "height", PROPERTY_HINT_RANGE, "1,1024,1"), "set_height", "get_height");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "ascent", PROPERTY_HINT_RANGE, "0,1024,1"), "set_ascent", "get_ascent");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "height", PROPERTY_HINT_RANGE, "1,1024,1"), "set_height", "get_height");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "ascent", PROPERTY_HINT_RANGE, "0,1024,1"), "set_ascent", "get_ascent");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "distance_field"), "set_distance_field_hint", "is_distance_field_hint");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "fallback", PROPERTY_HINT_RESOURCE_TYPE, "BitmapFont"), "set_fallback", "get_fallback");
}
diff --git a/scene/resources/font.h b/scene/resources/font.h
index fc1d92e2f9..1ce8e79f09 100644
--- a/scene/resources/font.h
+++ b/scene/resources/font.h
@@ -146,10 +146,10 @@ private:
float ascent;
bool distance_field_hint;
- void _set_chars(const PoolVector<int> &p_chars);
- PoolVector<int> _get_chars() const;
- void _set_kernings(const PoolVector<int> &p_kernings);
- PoolVector<int> _get_kernings() const;
+ void _set_chars(const Vector<int> &p_chars);
+ Vector<int> _get_chars() const;
+ void _set_kernings(const Vector<int> &p_kernings);
+ Vector<int> _get_kernings() const;
void _set_textures(const Vector<Variant> &p_textures);
Vector<Variant> _get_textures() const;
diff --git a/scene/resources/gradient.cpp b/scene/resources/gradient.cpp
index fe5a01886d..7bce04beaf 100644
--- a/scene/resources/gradient.cpp
+++ b/scene/resources/gradient.cpp
@@ -72,8 +72,8 @@ void Gradient::_bind_methods() {
ClassDB::bind_method(D_METHOD(COLOR_RAMP_SET_COLORS, "colors"), &Gradient::set_colors);
ClassDB::bind_method(D_METHOD(COLOR_RAMP_GET_COLORS), &Gradient::get_colors);
- ADD_PROPERTY(PropertyInfo(Variant::POOL_REAL_ARRAY, "offsets"), COLOR_RAMP_SET_OFFSETS, COLOR_RAMP_GET_OFFSETS);
- ADD_PROPERTY(PropertyInfo(Variant::POOL_COLOR_ARRAY, "colors"), COLOR_RAMP_SET_COLORS, COLOR_RAMP_GET_COLORS);
+ ADD_PROPERTY(PropertyInfo(Variant::PACKED_FLOAT32_ARRAY, "offsets"), COLOR_RAMP_SET_OFFSETS, COLOR_RAMP_GET_OFFSETS);
+ ADD_PROPERTY(PropertyInfo(Variant::PACKED_COLOR_ARRAY, "colors"), COLOR_RAMP_SET_COLORS, COLOR_RAMP_GET_COLORS);
}
Vector<float> Gradient::get_offsets() const {
diff --git a/scene/resources/height_map_shape.cpp b/scene/resources/height_map_shape.cpp
index 48c9221e27..fa45ddcabb 100644
--- a/scene/resources/height_map_shape.cpp
+++ b/scene/resources/height_map_shape.cpp
@@ -42,7 +42,7 @@ Vector<Vector3> HeightMapShape::get_debug_mesh_lines() {
Vector2 size(map_width - 1, map_depth - 1);
Vector2 start = size * -0.5;
- PoolRealArray::Read r = map_data.read();
+ const real_t *r = map_data.ptr();
// reserve some memory for our points..
points.resize(((map_width - 1) * map_depth * 2) + (map_width * (map_depth - 1) * 2));
@@ -102,7 +102,7 @@ void HeightMapShape::set_map_width(int p_new) {
int new_size = map_width * map_depth;
map_data.resize(map_width * map_depth);
- PoolRealArray::Write w = map_data.write();
+ real_t *w = map_data.ptrw();
while (was_size < new_size) {
w[was_size++] = 0.0;
}
@@ -128,7 +128,7 @@ void HeightMapShape::set_map_depth(int p_new) {
int new_size = map_width * map_depth;
map_data.resize(new_size);
- PoolRealArray::Write w = map_data.write();
+ real_t *w = map_data.ptrw();
while (was_size < new_size) {
w[was_size++] = 0.0;
}
@@ -144,7 +144,7 @@ int HeightMapShape::get_map_depth() const {
return map_depth;
}
-void HeightMapShape::set_map_data(PoolRealArray p_new) {
+void HeightMapShape::set_map_data(PackedFloat32Array p_new) {
int size = (map_width * map_depth);
if (p_new.size() != size) {
// fail
@@ -152,8 +152,8 @@ void HeightMapShape::set_map_data(PoolRealArray p_new) {
}
// copy
- PoolRealArray::Write w = map_data.write();
- PoolRealArray::Read r = p_new.read();
+ real_t *w = map_data.ptrw();
+ const real_t *r = p_new.ptr();
for (int i = 0; i < size; i++) {
float val = r[i];
w[i] = val;
@@ -174,7 +174,7 @@ void HeightMapShape::set_map_data(PoolRealArray p_new) {
_change_notify("map_data");
}
-PoolRealArray HeightMapShape::get_map_data() const {
+PackedFloat32Array HeightMapShape::get_map_data() const {
return map_data;
}
@@ -188,7 +188,7 @@ void HeightMapShape::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "map_width", PROPERTY_HINT_RANGE, "1,4096,1"), "set_map_width", "get_map_width");
ADD_PROPERTY(PropertyInfo(Variant::INT, "map_depth", PROPERTY_HINT_RANGE, "1,4096,1"), "set_map_depth", "get_map_depth");
- ADD_PROPERTY(PropertyInfo(Variant::POOL_REAL_ARRAY, "map_data"), "set_map_data", "get_map_data");
+ ADD_PROPERTY(PropertyInfo(Variant::PACKED_FLOAT32_ARRAY, "map_data"), "set_map_data", "get_map_data");
}
HeightMapShape::HeightMapShape() :
@@ -197,7 +197,7 @@ HeightMapShape::HeightMapShape() :
map_width = 2;
map_depth = 2;
map_data.resize(map_width * map_depth);
- PoolRealArray::Write w = map_data.write();
+ real_t *w = map_data.ptrw();
w[0] = 0.0;
w[1] = 0.0;
w[2] = 0.0;
diff --git a/scene/resources/height_map_shape.h b/scene/resources/height_map_shape.h
index a6263f061f..b8204f6c98 100644
--- a/scene/resources/height_map_shape.h
+++ b/scene/resources/height_map_shape.h
@@ -38,7 +38,7 @@ class HeightMapShape : public Shape {
int map_width;
int map_depth;
- PoolRealArray map_data;
+ PackedFloat32Array map_data;
float min_height;
float max_height;
@@ -51,8 +51,8 @@ public:
int get_map_width() const;
void set_map_depth(int p_new);
int get_map_depth() const;
- void set_map_data(PoolRealArray p_new);
- PoolRealArray get_map_data() const;
+ void set_map_data(PackedFloat32Array p_new);
+ PackedFloat32Array get_map_data() const;
virtual Vector<Vector3> get_debug_mesh_lines();
virtual real_t get_enclosing_radius() const;
diff --git a/scene/resources/line_shape_2d.cpp b/scene/resources/line_shape_2d.cpp
index d1bb61820b..3b30b4528a 100644
--- a/scene/resources/line_shape_2d.cpp
+++ b/scene/resources/line_shape_2d.cpp
@@ -113,7 +113,7 @@ void LineShape2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_d"), &LineShape2D::get_d);
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "normal"), "set_normal", "get_normal");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "d"), "set_d", "get_d");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "d"), "set_d", "get_d");
}
LineShape2D::LineShape2D() :
diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp
index 01e3c4c930..ff51cab0a4 100644
--- a/scene/resources/material.cpp
+++ b/scene/resources/material.cpp
@@ -197,7 +197,7 @@ void ShaderMaterial::set_shader(const Ref<Shader> &p_shader) {
// This can be a slow operation, and `_change_notify()` (which is called by `_shader_changed()`)
// does nothing in non-editor builds anyway. See GH-34741 for details.
if (shader.is_valid() && Engine::get_singleton()->is_editor_hint()) {
- shader->disconnect("changed", this, "_shader_changed");
+ shader->disconnect_compat("changed", this, "_shader_changed");
}
shader = p_shader;
@@ -207,7 +207,7 @@ void ShaderMaterial::set_shader(const Ref<Shader> &p_shader) {
rid = shader->get_rid();
if (Engine::get_singleton()->is_editor_hint()) {
- shader->connect("changed", this, "_shader_changed");
+ shader->connect_compat("changed", this, "_shader_changed");
}
}
@@ -419,10 +419,11 @@ void BaseMaterial3D::_update_shader() {
switch (texture_filter) {
case TEXTURE_FILTER_NEAREST: texfilter_str = "filter_nearest"; break;
case TEXTURE_FILTER_LINEAR: texfilter_str = "filter_linear"; break;
- case TEXTURE_FILTER_NEAREST_WITH_MIMPAMPS: texfilter_str = "filter_nearest_mipmap"; break;
+ case TEXTURE_FILTER_NEAREST_WITH_MIPMAPS: texfilter_str = "filter_nearest_mipmap"; break;
case TEXTURE_FILTER_LINEAR_WITH_MIPMAPS: texfilter_str = "filter_linear_mipmap"; break;
- case TEXTURE_FILTER_NEAREST_WITH_MIMPAMPS_ANISOTROPIC: texfilter_str = "filter_nearest_mipmap_aniso"; break;
+ case TEXTURE_FILTER_NEAREST_WITH_MIPMAPS_ANISOTROPIC: texfilter_str = "filter_nearest_mipmap_aniso"; break;
case TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC: texfilter_str = "filter_linear_mipmap_aniso"; break;
+ case TEXTURE_FILTER_MAX: break; // Internal value, skip.
}
if (flags[FLAG_USE_TEXTURE_REPEAT]) {
@@ -2222,7 +2223,7 @@ void BaseMaterial3D::_bind_methods() {
ADD_GROUP("Transparency", "");
ADD_PROPERTY(PropertyInfo(Variant::INT, "transparency", PROPERTY_HINT_ENUM, "Disabled,Alpha,AlphaScissor,DepthPrePass"), "set_transparency", "get_transparency");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "alpha_scissor_threshold", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_alpha_scissor_threshold", "get_alpha_scissor_threshold");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "alpha_scissor_threshold", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_alpha_scissor_threshold", "get_alpha_scissor_threshold");
ADD_PROPERTY(PropertyInfo(Variant::INT, "blend_mode", PROPERTY_HINT_ENUM, "Mix,Add,Sub,Mul"), "set_blend_mode", "get_blend_mode");
ADD_PROPERTY(PropertyInfo(Variant::INT, "cull_mode", PROPERTY_HINT_ENUM, "Back,Front,Disabled"), "set_cull_mode", "get_cull_mode");
ADD_PROPERTY(PropertyInfo(Variant::INT, "depth_draw_mode", PROPERTY_HINT_ENUM, "Opaque Only,Always,Never"), "set_depth_draw_mode", "get_depth_draw_mode");
@@ -2247,56 +2248,56 @@ void BaseMaterial3D::_bind_methods() {
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "orm_texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_texture", "get_texture", TEXTURE_ORM);
ADD_GROUP("Metallic", "metallic_");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "metallic", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_metallic", "get_metallic");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "metallic_specular", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_specular", "get_specular");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "metallic", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_metallic", "get_metallic");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "metallic_specular", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_specular", "get_specular");
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "metallic_texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_texture", "get_texture", TEXTURE_METALLIC);
ADD_PROPERTY(PropertyInfo(Variant::INT, "metallic_texture_channel", PROPERTY_HINT_ENUM, "Red,Green,Blue,Alpha,Gray"), "set_metallic_texture_channel", "get_metallic_texture_channel");
ADD_GROUP("Roughness", "roughness_");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "roughness", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_roughness", "get_roughness");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "roughness", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_roughness", "get_roughness");
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "roughness_texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_texture", "get_texture", TEXTURE_ROUGHNESS);
ADD_PROPERTY(PropertyInfo(Variant::INT, "roughness_texture_channel", PROPERTY_HINT_ENUM, "Red,Green,Blue,Alpha,Gray"), "set_roughness_texture_channel", "get_roughness_texture_channel");
ADD_GROUP("Emission", "emission_");
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "emission_enabled"), "set_feature", "get_feature", FEATURE_EMISSION);
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "emission", PROPERTY_HINT_COLOR_NO_ALPHA), "set_emission", "get_emission");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "emission_energy", PROPERTY_HINT_RANGE, "0,16,0.01,or_greater"), "set_emission_energy", "get_emission_energy");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "emission_energy", PROPERTY_HINT_RANGE, "0,16,0.01,or_greater"), "set_emission_energy", "get_emission_energy");
ADD_PROPERTY(PropertyInfo(Variant::INT, "emission_operator", PROPERTY_HINT_ENUM, "Add,Multiply"), "set_emission_operator", "get_emission_operator");
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "emission_on_uv2"), "set_flag", "get_flag", FLAG_EMISSION_ON_UV2);
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "emission_texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_texture", "get_texture", TEXTURE_EMISSION);
ADD_GROUP("NormalMap", "normal_");
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "normal_enabled"), "set_feature", "get_feature", FEATURE_NORMAL_MAPPING);
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "normal_scale", PROPERTY_HINT_RANGE, "-16,16,0.01"), "set_normal_scale", "get_normal_scale");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "normal_scale", PROPERTY_HINT_RANGE, "-16,16,0.01"), "set_normal_scale", "get_normal_scale");
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "normal_texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_texture", "get_texture", TEXTURE_NORMAL);
ADD_GROUP("Rim", "rim_");
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "rim_enabled"), "set_feature", "get_feature", FEATURE_RIM);
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "rim", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_rim", "get_rim");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "rim_tint", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_rim_tint", "get_rim_tint");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "rim", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_rim", "get_rim");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "rim_tint", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_rim_tint", "get_rim_tint");
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "rim_texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_texture", "get_texture", TEXTURE_RIM);
ADD_GROUP("Clearcoat", "clearcoat_");
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "clearcoat_enabled"), "set_feature", "get_feature", FEATURE_CLEARCOAT);
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "clearcoat", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_clearcoat", "get_clearcoat");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "clearcoat_gloss", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_clearcoat_gloss", "get_clearcoat_gloss");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "clearcoat", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_clearcoat", "get_clearcoat");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "clearcoat_gloss", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_clearcoat_gloss", "get_clearcoat_gloss");
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "clearcoat_texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_texture", "get_texture", TEXTURE_CLEARCOAT);
ADD_GROUP("Anisotropy", "anisotropy_");
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "anisotropy_enabled"), "set_feature", "get_feature", FEATURE_ANISOTROPY);
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "anisotropy", PROPERTY_HINT_RANGE, "-1,1,0.01"), "set_anisotropy", "get_anisotropy");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "anisotropy", PROPERTY_HINT_RANGE, "-1,1,0.01"), "set_anisotropy", "get_anisotropy");
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "anisotropy_flowmap", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_texture", "get_texture", TEXTURE_FLOWMAP);
ADD_GROUP("Ambient Occlusion", "ao_");
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "ao_enabled"), "set_feature", "get_feature", FEATURE_AMBIENT_OCCLUSION);
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "ao_light_affect", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_ao_light_affect", "get_ao_light_affect");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "ao_light_affect", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_ao_light_affect", "get_ao_light_affect");
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "ao_texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_texture", "get_texture", TEXTURE_AMBIENT_OCCLUSION);
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "ao_on_uv2"), "set_flag", "get_flag", FLAG_AO_ON_UV2);
ADD_PROPERTY(PropertyInfo(Variant::INT, "ao_texture_channel", PROPERTY_HINT_ENUM, "Red,Green,Blue,Alpha,Gray"), "set_ao_texture_channel", "get_ao_texture_channel");
ADD_GROUP("Height", "heightmap_");
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "heightmap_enabled"), "set_feature", "get_feature", FEATURE_HEIGHT_MAPPING);
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "heightmap_scale", PROPERTY_HINT_RANGE, "-16,16,0.01"), "set_heightmap_scale", "get_heightmap_scale");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "heightmap_scale", PROPERTY_HINT_RANGE, "-16,16,0.01"), "set_heightmap_scale", "get_heightmap_scale");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "heightmap_deep_parallax"), "set_heightmap_deep_parallax", "is_heightmap_deep_parallax_enabled");
ADD_PROPERTY(PropertyInfo(Variant::INT, "heightmap_min_layers", PROPERTY_HINT_RANGE, "1,32,1"), "set_heightmap_deep_parallax_min_layers", "get_heightmap_deep_parallax_min_layers");
ADD_PROPERTY(PropertyInfo(Variant::INT, "heightmap_max_layers", PROPERTY_HINT_RANGE, "1,32,1"), "set_heightmap_deep_parallax_max_layers", "get_heightmap_deep_parallax_max_layers");
@@ -2307,7 +2308,7 @@ void BaseMaterial3D::_bind_methods() {
ADD_GROUP("Subsurf Scatter", "subsurf_scatter_");
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "subsurf_scatter_enabled"), "set_feature", "get_feature", FEATURE_SUBSURACE_SCATTERING);
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "subsurf_scatter_strength", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_subsurface_scattering_strength", "get_subsurface_scattering_strength");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "subsurf_scatter_strength", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_subsurface_scattering_strength", "get_subsurface_scattering_strength");
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "subsurf_scatter_texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_texture", "get_texture", TEXTURE_SUBSURFACE_SCATTERING);
ADD_GROUP("Transmission", "transmission_");
@@ -2317,7 +2318,7 @@ void BaseMaterial3D::_bind_methods() {
ADD_GROUP("Refraction", "refraction_");
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "refraction_enabled"), "set_feature", "get_feature", FEATURE_REFRACTION);
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "refraction_scale", PROPERTY_HINT_RANGE, "-1,1,0.01"), "set_refraction", "get_refraction");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "refraction_scale", PROPERTY_HINT_RANGE, "-1,1,0.01"), "set_refraction", "get_refraction");
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "refraction_texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_texture", "get_texture", TEXTURE_REFRACTION);
ADD_PROPERTY(PropertyInfo(Variant::INT, "refraction_texture_channel", PROPERTY_HINT_ENUM, "Red,Green,Blue,Alpha,Gray"), "set_refraction_texture_channel", "get_refraction_texture_channel");
@@ -2333,14 +2334,14 @@ void BaseMaterial3D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "uv1_scale"), "set_uv1_scale", "get_uv1_scale");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "uv1_offset"), "set_uv1_offset", "get_uv1_offset");
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "uv1_triplanar"), "set_flag", "get_flag", FLAG_UV1_USE_TRIPLANAR);
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "uv1_triplanar_sharpness", PROPERTY_HINT_EXP_EASING), "set_uv1_triplanar_blend_sharpness", "get_uv1_triplanar_blend_sharpness");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "uv1_triplanar_sharpness", PROPERTY_HINT_EXP_EASING), "set_uv1_triplanar_blend_sharpness", "get_uv1_triplanar_blend_sharpness");
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "uv1_world_triplanar"), "set_flag", "get_flag", FLAG_UV1_USE_WORLD_TRIPLANAR);
ADD_GROUP("UV2", "uv2_");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "uv2_scale"), "set_uv2_scale", "get_uv2_scale");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "uv2_offset"), "set_uv2_offset", "get_uv2_offset");
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "uv2_triplanar"), "set_flag", "get_flag", FLAG_UV2_USE_TRIPLANAR);
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "uv2_triplanar_sharpness", PROPERTY_HINT_EXP_EASING), "set_uv2_triplanar_blend_sharpness", "get_uv2_triplanar_blend_sharpness");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "uv2_triplanar_sharpness", PROPERTY_HINT_EXP_EASING), "set_uv2_triplanar_blend_sharpness", "get_uv2_triplanar_blend_sharpness");
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "uv2_world_triplanar"), "set_flag", "get_flag", FLAG_UV2_USE_WORLD_TRIPLANAR);
ADD_GROUP("Sampling", "texture_");
@@ -2362,18 +2363,18 @@ void BaseMaterial3D::_bind_methods() {
ADD_GROUP("Grow", "grow_");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "grow"), "set_grow_enabled", "is_grow_enabled");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "grow_amount", PROPERTY_HINT_RANGE, "-16,16,0.001"), "set_grow", "get_grow");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "grow_amount", PROPERTY_HINT_RANGE, "-16,16,0.001"), "set_grow", "get_grow");
ADD_GROUP("Transform", "");
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "fixed_size"), "set_flag", "get_flag", FLAG_FIXED_SIZE);
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "use_point_size"), "set_flag", "get_flag", FLAG_USE_POINT_SIZE);
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "point_size", PROPERTY_HINT_RANGE, "0.1,128,0.1"), "set_point_size", "get_point_size");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "point_size", PROPERTY_HINT_RANGE, "0.1,128,0.1"), "set_point_size", "get_point_size");
ADD_GROUP("Proximity Fade", "proximity_fade_");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "proximity_fade_enable"), "set_proximity_fade", "is_proximity_fade_enabled");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "proximity_fade_distance", PROPERTY_HINT_RANGE, "0,4096,0.01"), "set_proximity_fade_distance", "get_proximity_fade_distance");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "proximity_fade_distance", PROPERTY_HINT_RANGE, "0,4096,0.01"), "set_proximity_fade_distance", "get_proximity_fade_distance");
ADD_GROUP("Distance Fade", "distance_fade_");
ADD_PROPERTY(PropertyInfo(Variant::INT, "distance_fade_mode", PROPERTY_HINT_ENUM, "Disabled,PixelAlpha,PixelDither,ObjectDither"), "set_distance_fade", "get_distance_fade");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "distance_fade_min_distance", PROPERTY_HINT_RANGE, "0,4096,0.01"), "set_distance_fade_min_distance", "get_distance_fade_min_distance");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "distance_fade_max_distance", PROPERTY_HINT_RANGE, "0,4096,0.01"), "set_distance_fade_max_distance", "get_distance_fade_max_distance");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "distance_fade_min_distance", PROPERTY_HINT_RANGE, "0,4096,0.01"), "set_distance_fade_min_distance", "get_distance_fade_min_distance");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "distance_fade_max_distance", PROPERTY_HINT_RANGE, "0,4096,0.01"), "set_distance_fade_max_distance", "get_distance_fade_max_distance");
BIND_ENUM_CONSTANT(TEXTURE_ALBEDO);
BIND_ENUM_CONSTANT(TEXTURE_METALLIC);
@@ -2396,9 +2397,9 @@ void BaseMaterial3D::_bind_methods() {
BIND_ENUM_CONSTANT(TEXTURE_FILTER_NEAREST);
BIND_ENUM_CONSTANT(TEXTURE_FILTER_LINEAR);
- BIND_ENUM_CONSTANT(TEXTURE_FILTER_NEAREST_WITH_MIMPAMPS);
+ BIND_ENUM_CONSTANT(TEXTURE_FILTER_NEAREST_WITH_MIPMAPS);
BIND_ENUM_CONSTANT(TEXTURE_FILTER_LINEAR_WITH_MIPMAPS);
- BIND_ENUM_CONSTANT(TEXTURE_FILTER_NEAREST_WITH_MIMPAMPS_ANISOTROPIC);
+ BIND_ENUM_CONSTANT(TEXTURE_FILTER_NEAREST_WITH_MIPMAPS_ANISOTROPIC);
BIND_ENUM_CONSTANT(TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC);
BIND_ENUM_CONSTANT(TEXTURE_FILTER_MAX);
diff --git a/scene/resources/material.h b/scene/resources/material.h
index 8c5a648058..927334c74d 100644
--- a/scene/resources/material.h
+++ b/scene/resources/material.h
@@ -138,9 +138,9 @@ public:
enum TextureFilter {
TEXTURE_FILTER_NEAREST,
TEXTURE_FILTER_LINEAR,
- TEXTURE_FILTER_NEAREST_WITH_MIMPAMPS,
+ TEXTURE_FILTER_NEAREST_WITH_MIPMAPS,
TEXTURE_FILTER_LINEAR_WITH_MIPMAPS,
- TEXTURE_FILTER_NEAREST_WITH_MIMPAMPS_ANISOTROPIC,
+ TEXTURE_FILTER_NEAREST_WITH_MIPMAPS_ANISOTROPIC,
TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC,
TEXTURE_FILTER_MAX
};
diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp
index 58463abad8..08c4169167 100644
--- a/scene/resources/mesh.cpp
+++ b/scene/resources/mesh.cpp
@@ -63,9 +63,9 @@ Ref<TriangleMesh> Mesh::generate_triangle_mesh() const {
if (facecount == 0 || (facecount % 3) != 0)
return triangle_mesh;
- PoolVector<Vector3> faces;
+ Vector<Vector3> faces;
faces.resize(facecount);
- PoolVector<Vector3>::Write facesw = faces.write();
+ Vector3 *facesw = faces.ptrw();
int widx = 0;
@@ -78,14 +78,14 @@ Ref<TriangleMesh> Mesh::generate_triangle_mesh() const {
ERR_FAIL_COND_V(a.empty(), Ref<TriangleMesh>());
int vc = surface_get_array_len(i);
- PoolVector<Vector3> vertices = a[ARRAY_VERTEX];
- PoolVector<Vector3>::Read vr = vertices.read();
+ Vector<Vector3> vertices = a[ARRAY_VERTEX];
+ const Vector3 *vr = vertices.ptr();
if (surface_get_format(i) & ARRAY_FORMAT_INDEX) {
int ic = surface_get_array_index_len(i);
- PoolVector<int> indices = a[ARRAY_INDEX];
- PoolVector<int>::Read ir = indices.read();
+ Vector<int> indices = a[ARRAY_INDEX];
+ const int *ir = indices.ptr();
for (int j = 0; j < ic; j++) {
int index = ir[j];
@@ -99,8 +99,6 @@ Ref<TriangleMesh> Mesh::generate_triangle_mesh() const {
}
}
- facesw.release();
-
triangle_mesh = Ref<TriangleMesh>(memnew(TriangleMesh));
triangle_mesh->create(faces);
@@ -118,15 +116,15 @@ void Mesh::generate_debug_mesh_lines(Vector<Vector3> &r_lines) {
if (tm.is_null())
return;
- PoolVector<int> triangle_indices;
+ Vector<int> triangle_indices;
tm->get_indices(&triangle_indices);
const int triangles_num = tm->get_triangles().size();
- PoolVector<Vector3> vertices = tm->get_vertices();
+ Vector<Vector3> vertices = tm->get_vertices();
debug_lines.resize(tm->get_triangles().size() * 6); // 3 lines x 2 points each line
- PoolVector<int>::Read ind_r = triangle_indices.read();
- PoolVector<Vector3>::Read ver_r = vertices.read();
+ const int *ind_r = triangle_indices.ptr();
+ const Vector3 *ver_r = vertices.ptr();
for (int j = 0, x = 0, i = 0; i < triangles_num; j += 6, x += 3, ++i) {
// Triangle line 1
debug_lines.write[j + 0] = ver_r[ind_r[x + 0]];
@@ -148,7 +146,7 @@ void Mesh::generate_debug_mesh_indices(Vector<Vector3> &r_points) {
if (tm.is_null())
return;
- PoolVector<Vector3> vertices = tm->get_vertices();
+ Vector<Vector3> vertices = tm->get_vertices();
int vertices_size = vertices.size();
r_points.resize(vertices_size);
@@ -162,20 +160,20 @@ bool Mesh::surface_is_softbody_friendly(int p_idx) const {
return (surface_format & Mesh::ARRAY_FLAG_USE_DYNAMIC_UPDATE && (!(surface_format & Mesh::ARRAY_COMPRESS_NORMAL)));
}
-PoolVector<Face3> Mesh::get_faces() const {
+Vector<Face3> Mesh::get_faces() const {
Ref<TriangleMesh> tm = generate_triangle_mesh();
if (tm.is_valid())
return tm->get_faces();
- return PoolVector<Face3>();
+ return Vector<Face3>();
/*
for (int i=0;i<surfaces.size();i++) {
if (VisualServer::get_singleton()->mesh_surface_get_primitive_type( mesh, i ) != VisualServer::PRIMITIVE_TRIANGLES )
continue;
- PoolVector<int> indices;
- PoolVector<Vector3> vertices;
+ Vector<int> indices;
+ Vector<Vector3> vertices;
vertices=VisualServer::get_singleton()->mesh_surface_get_array(mesh, i,VisualServer::ARRAY_VERTEX);
@@ -196,10 +194,10 @@ PoolVector<Face3> Mesh::get_faces() const {
if (len<=0)
continue;
- PoolVector<int>::Read indicesr = indices.read();
+ const int* indicesr = indices.ptr();
const int *indicesptr = indicesr.ptr();
- PoolVector<Vector3>::Read verticesr = vertices.read();
+ const Vector3* verticesr = vertices.ptr();
const Vector3 *verticesptr = verticesr.ptr();
int old_faces=faces.size();
@@ -207,7 +205,7 @@ PoolVector<Face3> Mesh::get_faces() const {
faces.resize(new_faces);
- PoolVector<Face3>::Write facesw = faces.write();
+ Face3* facesw = faces.ptrw();
Face3 *facesptr=facesw.ptr();
@@ -230,13 +228,13 @@ PoolVector<Face3> Mesh::get_faces() const {
Ref<Shape> Mesh::create_convex_shape() const {
- PoolVector<Vector3> vertices;
+ Vector<Vector3> vertices;
for (int i = 0; i < get_surface_count(); i++) {
Array a = surface_get_arrays(i);
ERR_FAIL_COND_V(a.empty(), Ref<ConvexPolygonShape>());
- PoolVector<Vector3> v = a[ARRAY_VERTEX];
+ Vector<Vector3> v = a[ARRAY_VERTEX];
vertices.append_array(v);
}
@@ -247,11 +245,11 @@ Ref<Shape> Mesh::create_convex_shape() const {
Ref<Shape> Mesh::create_trimesh_shape() const {
- PoolVector<Face3> faces = get_faces();
+ Vector<Face3> faces = get_faces();
if (faces.size() == 0)
return Ref<Shape>();
- PoolVector<Vector3> face_points;
+ Vector<Vector3> face_points;
face_points.resize(faces.size() * 3);
for (int i = 0; i < face_points.size(); i++) {
@@ -279,7 +277,7 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const {
if (i == 0) {
arrays = a;
- PoolVector<Vector3> v = a[ARRAY_VERTEX];
+ Vector<Vector3> v = a[ARRAY_VERTEX];
index_accum += v.size();
} else {
@@ -297,8 +295,8 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const {
case ARRAY_VERTEX:
case ARRAY_NORMAL: {
- PoolVector<Vector3> dst = arrays[j];
- PoolVector<Vector3> src = a[j];
+ Vector<Vector3> dst = arrays[j];
+ Vector<Vector3> src = a[j];
if (j == ARRAY_VERTEX)
vcount = src.size();
if (dst.size() == 0 || src.size() == 0) {
@@ -312,8 +310,8 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const {
case ARRAY_BONES:
case ARRAY_WEIGHTS: {
- PoolVector<real_t> dst = arrays[j];
- PoolVector<real_t> src = a[j];
+ Vector<real_t> dst = arrays[j];
+ Vector<real_t> src = a[j];
if (dst.size() == 0 || src.size() == 0) {
arrays[j] = Variant();
continue;
@@ -323,8 +321,8 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const {
} break;
case ARRAY_COLOR: {
- PoolVector<Color> dst = arrays[j];
- PoolVector<Color> src = a[j];
+ Vector<Color> dst = arrays[j];
+ Vector<Color> src = a[j];
if (dst.size() == 0 || src.size() == 0) {
arrays[j] = Variant();
continue;
@@ -335,8 +333,8 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const {
} break;
case ARRAY_TEX_UV:
case ARRAY_TEX_UV2: {
- PoolVector<Vector2> dst = arrays[j];
- PoolVector<Vector2> src = a[j];
+ Vector<Vector2> dst = arrays[j];
+ Vector<Vector2> src = a[j];
if (dst.size() == 0 || src.size() == 0) {
arrays[j] = Variant();
continue;
@@ -346,15 +344,15 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const {
} break;
case ARRAY_INDEX: {
- PoolVector<int> dst = arrays[j];
- PoolVector<int> src = a[j];
+ Vector<int> dst = arrays[j];
+ Vector<int> src = a[j];
if (dst.size() == 0 || src.size() == 0) {
arrays[j] = Variant();
continue;
}
{
int ss = src.size();
- PoolVector<int>::Write w = src.write();
+ int *w = src.ptrw();
for (int k = 0; k < ss; k++) {
w[k] += index_accum;
}
@@ -372,18 +370,18 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const {
ERR_FAIL_COND_V(arrays.size() != ARRAY_MAX, Ref<ArrayMesh>());
{
- PoolVector<int>::Write ir;
- PoolVector<int> indices = arrays[ARRAY_INDEX];
+ int *ir;
+ Vector<int> indices = arrays[ARRAY_INDEX];
bool has_indices = false;
- PoolVector<Vector3> vertices = arrays[ARRAY_VERTEX];
+ Vector<Vector3> vertices = arrays[ARRAY_VERTEX];
int vc = vertices.size();
ERR_FAIL_COND_V(!vc, Ref<ArrayMesh>());
- PoolVector<Vector3>::Write r = vertices.write();
+ Vector3 *r = vertices.ptrw();
if (indices.size()) {
ERR_FAIL_COND_V(indices.size() % 3 != 0, Ref<ArrayMesh>());
vc = indices.size();
- ir = indices.write();
+ ir = indices.ptrw();
has_indices = true;
}
@@ -440,14 +438,13 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const {
r[i] = t;
}
- r.release();
arrays[ARRAY_VERTEX] = vertices;
if (!has_indices) {
- PoolVector<int> new_indices;
+ Vector<int> new_indices;
new_indices.resize(vertices.size());
- PoolVector<int>::Write iw = new_indices.write();
+ int *iw = new_indices.ptrw();
for (int j = 0; j < vc2; j += 3) {
@@ -456,7 +453,6 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const {
iw[j + 2] = j + 1;
}
- iw.release();
arrays[ARRAY_INDEX] = new_indices;
} else {
@@ -465,7 +461,6 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const {
SWAP(ir[j + 1], ir[j + 2]);
}
- ir.release();
arrays[ARRAY_INDEX] = indices;
}
}
@@ -548,10 +543,10 @@ Vector<Ref<Shape> > Mesh::convex_decompose() const {
ERR_FAIL_COND_V(!convex_composition_function, Vector<Ref<Shape> >());
- PoolVector<Face3> faces = get_faces();
+ Vector<Face3> faces = get_faces();
Vector<Face3> f3;
f3.resize(faces.size());
- PoolVector<Face3>::Read f = faces.read();
+ const Face3 *f = faces.ptr();
for (int i = 0; i < f3.size(); i++) {
f3.write[i] = f[i];
}
@@ -568,10 +563,10 @@ Vector<Ref<Shape> > Mesh::convex_decompose() const {
points.insert(decomposed[i][j].vertex[2]);
}
- PoolVector<Vector3> convex_points;
+ Vector<Vector3> convex_points;
convex_points.resize(points.size());
{
- PoolVector<Vector3>::Write w = convex_points.write();
+ Vector3 *w = convex_points.ptrw();
int idx = 0;
for (Set<Vector3>::Element *E = points.front(); E; E = E->next()) {
w[idx++] = E->get();
@@ -590,7 +585,7 @@ Vector<Ref<Shape> > Mesh::convex_decompose() const {
Mesh::Mesh() {
}
-static PoolVector<uint8_t> _fix_array_compatibility(const PoolVector<uint8_t> &p_src, uint32_t p_format, uint32_t p_elements) {
+static Vector<uint8_t> _fix_array_compatibility(const Vector<uint8_t> &p_src, uint32_t p_format, uint32_t p_elements) {
bool vertex_16bit = p_format & ((1 << (Mesh::ARRAY_VERTEX + Mesh::ARRAY_COMPRESS_BASE)));
bool has_bones = (p_format & Mesh::ARRAY_FORMAT_BONES);
@@ -608,18 +603,18 @@ static PoolVector<uint8_t> _fix_array_compatibility(const PoolVector<uint8_t> &p
uint32_t src_stride = p_src.size() / p_elements;
uint32_t dst_stride = src_stride + (vertex_16bit ? 4 : 0) + (bone_8 ? 4 : 0) - (weight_32 ? 8 : 0);
- PoolVector<uint8_t> ret = p_src;
+ Vector<uint8_t> ret = p_src;
ret.resize(dst_stride * p_elements);
{
- PoolVector<uint8_t>::Write w = ret.write();
- PoolVector<uint8_t>::Read r = p_src.read();
+ uint8_t *w = ret.ptrw();
+ const uint8_t *r = p_src.ptr();
for (uint32_t i = 0; i < p_elements; i++) {
uint32_t remaining = src_stride;
- const uint8_t *src = (const uint8_t *)(r.ptr() + src_stride * i);
- uint8_t *dst = (uint8_t *)(w.ptr() + dst_stride * i);
+ const uint8_t *src = (const uint8_t *)(r + src_stride * i);
+ uint8_t *dst = (uint8_t *)(w + dst_stride * i);
if (!vertex_2d) { //3D
if (vertex_16bit) {
@@ -714,9 +709,9 @@ bool ArrayMesh::_set(const StringName &p_name, const Variant &p_value) {
if (p_name == "blend_shape/names") {
- PoolVector<String> sk = p_value;
+ Vector<String> sk = p_value;
int sz = sk.size();
- PoolVector<String>::Read r = sk.read();
+ const String *r = sk.ptr();
for (int i = 0; i < sz; i++)
add_blend_shape(r[i]);
return true;
@@ -766,8 +761,8 @@ bool ArrayMesh::_set(const StringName &p_name, const Variant &p_value) {
} else if (d.has("array_data")) {
//print_line("array data (old style");
//older format (3.x)
- PoolVector<uint8_t> array_data = d["array_data"];
- PoolVector<uint8_t> array_index_data;
+ Vector<uint8_t> array_data = d["array_data"];
+ Vector<uint8_t> array_index_data;
if (d.has("array_index_data"))
array_index_data = d["array_index_data"];
@@ -797,12 +792,12 @@ bool ArrayMesh::_set(const StringName &p_name, const Variant &p_value) {
if (d.has("index_count"))
index_count = d["index_count"];
- Vector<PoolVector<uint8_t> > blend_shapes;
+ Vector<Vector<uint8_t> > blend_shapes;
if (d.has("blend_shape_data")) {
Array blend_shape_data = d["blend_shape_data"];
for (int i = 0; i < blend_shape_data.size(); i++) {
- PoolVector<uint8_t> shape = blend_shape_data[i];
+ Vector<uint8_t> shape = blend_shape_data[i];
shape = _fix_array_compatibility(shape, format, vertex_count);
blend_shapes.push_back(shape);
@@ -1049,7 +1044,7 @@ bool ArrayMesh::_get(const StringName &p_name, Variant &r_ret) const {
if (p_name == "blend_shape/names") {
- PoolVector<String> sk;
+ Vector<String> sk;
for (int i = 0; i < blend_shapes.size(); i++)
sk.push_back(blend_shapes[i]);
r_ret = sk;
@@ -1081,7 +1076,7 @@ void ArrayMesh::_get_property_list(List<PropertyInfo> *p_list) const {
return;
if (blend_shapes.size()) {
- p_list->push_back(PropertyInfo(Variant::POOL_STRING_ARRAY, "blend_shape/names", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL));
+ p_list->push_back(PropertyInfo(Variant::PACKED_STRING_ARRAY, "blend_shape/names", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL));
p_list->push_back(PropertyInfo(Variant::INT, "blend_shape/mode", PROPERTY_HINT_ENUM, "Normalized,Relative"));
}
@@ -1112,7 +1107,7 @@ void ArrayMesh::_recompute_aabb() {
#ifndef _MSC_VER
#warning need to add binding to add_surface using future MeshSurfaceData object
#endif
-void ArrayMesh::add_surface(uint32_t p_format, PrimitiveType p_primitive, const PoolVector<uint8_t> &p_array, int p_vertex_count, const PoolVector<uint8_t> &p_index_array, int p_index_count, const AABB &p_aabb, const Vector<PoolVector<uint8_t> > &p_blend_shapes, const Vector<AABB> &p_bone_aabb, const Vector<VS::SurfaceData::LOD> &p_lods) {
+void ArrayMesh::add_surface(uint32_t p_format, PrimitiveType p_primitive, const Vector<uint8_t> &p_array, int p_vertex_count, const Vector<uint8_t> &p_index_array, int p_index_count, const AABB &p_aabb, const Vector<Vector<uint8_t> > &p_blend_shapes, const Vector<AABB> &p_bone_aabb, const Vector<VS::SurfaceData::LOD> &p_lods) {
_create_if_empty();
@@ -1293,7 +1288,7 @@ String ArrayMesh::surface_get_name(int p_idx) const {
return surfaces[p_idx].name;
}
-void ArrayMesh::surface_update_region(int p_surface, int p_offset, const PoolVector<uint8_t> &p_data) {
+void ArrayMesh::surface_update_region(int p_surface, int p_offset, const Vector<uint8_t> &p_data) {
ERR_FAIL_INDEX(p_surface, surfaces.size());
VS::get_singleton()->mesh_surface_update_region(mesh, p_surface, p_offset, p_data);
@@ -1404,12 +1399,12 @@ Error ArrayMesh::lightmap_unwrap(const Transform &p_base_transform, float p_texe
s.material = surface_get_material(i);
s.vertices = SurfaceTool::create_vertex_array_from_triangle_arrays(arrays);
- PoolVector<Vector3> rvertices = arrays[Mesh::ARRAY_VERTEX];
+ Vector<Vector3> rvertices = arrays[Mesh::ARRAY_VERTEX];
int vc = rvertices.size();
- PoolVector<Vector3>::Read r = rvertices.read();
+ const Vector3 *r = rvertices.ptr();
- PoolVector<Vector3> rnormals = arrays[Mesh::ARRAY_NORMAL];
- PoolVector<Vector3>::Read rn = rnormals.read();
+ Vector<Vector3> rnormals = arrays[Mesh::ARRAY_NORMAL];
+ const Vector3 *rn = rnormals.ptr();
int vertex_ofs = vertices.size() / 3;
@@ -1431,7 +1426,7 @@ Error ArrayMesh::lightmap_unwrap(const Transform &p_base_transform, float p_texe
uv_index.write[j + vertex_ofs] = Pair<int, int>(i, j);
}
- PoolVector<int> rindices = arrays[Mesh::ARRAY_INDEX];
+ Vector<int> rindices = arrays[Mesh::ARRAY_INDEX];
int ic = rindices.size();
if (ic == 0) {
@@ -1447,7 +1442,7 @@ Error ArrayMesh::lightmap_unwrap(const Transform &p_base_transform, float p_texe
}
} else {
- PoolVector<int>::Read ri = rindices.read();
+ const int *ri = rindices.ptr();
for (int j = 0; j < ic / 3; j++) {
if (Face3(r[ri[j * 3 + 0]], r[ri[j * 3 + 1]], r[ri[j * 3 + 2]]).is_degenerate())
diff --git a/scene/resources/mesh.h b/scene/resources/mesh.h
index b8f3702bbe..0e356c16a6 100644
--- a/scene/resources/mesh.h
+++ b/scene/resources/mesh.h
@@ -126,7 +126,7 @@ public:
virtual int get_blend_shape_count() const = 0;
virtual StringName get_blend_shape_name(int p_index) const = 0;
- PoolVector<Face3> get_faces() const;
+ Vector<Face3> get_faces() const;
Ref<TriangleMesh> generate_triangle_mesh() const;
void generate_debug_mesh_lines(Vector<Vector3> &r_lines);
void generate_debug_mesh_indices(Vector<Vector3> &r_points);
@@ -193,7 +193,7 @@ protected:
public:
void add_surface_from_arrays(PrimitiveType p_primitive, const Array &p_arrays, const Array &p_blend_shapes = Array(), const Dictionary &p_lods = Dictionary(), uint32_t p_flags = ARRAY_COMPRESS_DEFAULT);
- void add_surface(uint32_t p_format, PrimitiveType p_primitive, const PoolVector<uint8_t> &p_array, int p_vertex_count, const PoolVector<uint8_t> &p_index_array, int p_index_count, const AABB &p_aabb, const Vector<PoolVector<uint8_t> > &p_blend_shapes = Vector<PoolVector<uint8_t> >(), const Vector<AABB> &p_bone_aabbs = Vector<AABB>(), const Vector<VS::SurfaceData::LOD> &p_lods = Vector<VS::SurfaceData::LOD>());
+ void add_surface(uint32_t p_format, PrimitiveType p_primitive, const Vector<uint8_t> &p_array, int p_vertex_count, const Vector<uint8_t> &p_index_array, int p_index_count, const AABB &p_aabb, const Vector<Vector<uint8_t> > &p_blend_shapes = Vector<Vector<uint8_t> >(), const Vector<AABB> &p_bone_aabbs = Vector<AABB>(), const Vector<VS::SurfaceData::LOD> &p_lods = Vector<VS::SurfaceData::LOD>());
Array surface_get_arrays(int p_surface) const;
Array surface_get_blend_shape_arrays(int p_surface) const;
@@ -207,7 +207,7 @@ public:
void set_blend_shape_mode(BlendShapeMode p_mode);
BlendShapeMode get_blend_shape_mode() const;
- void surface_update_region(int p_surface, int p_offset, const PoolVector<uint8_t> &p_data);
+ void surface_update_region(int p_surface, int p_offset, const Vector<uint8_t> &p_data);
int get_surface_count() const;
void surface_remove(int p_idx);
diff --git a/scene/resources/mesh_data_tool.cpp b/scene/resources/mesh_data_tool.cpp
index 7a303443e3..675cfc6d64 100644
--- a/scene/resources/mesh_data_tool.cpp
+++ b/scene/resources/mesh_data_tool.cpp
@@ -47,7 +47,7 @@ Error MeshDataTool::create_from_surface(const Ref<ArrayMesh> &p_mesh, int p_surf
Array arrays = p_mesh->surface_get_arrays(p_surface);
ERR_FAIL_COND_V(arrays.empty(), ERR_INVALID_PARAMETER);
- PoolVector<Vector3> varray = arrays[Mesh::ARRAY_VERTEX];
+ Vector<Vector3> varray = arrays[Mesh::ARRAY_VERTEX];
int vcount = varray.size();
ERR_FAIL_COND_V(vcount == 0, ERR_INVALID_PARAMETER);
@@ -56,34 +56,34 @@ Error MeshDataTool::create_from_surface(const Ref<ArrayMesh> &p_mesh, int p_surf
format = p_mesh->surface_get_format(p_surface);
material = p_mesh->surface_get_material(p_surface);
- PoolVector<Vector3>::Read vr = varray.read();
+ const Vector3 *vr = varray.ptr();
- PoolVector<Vector3>::Read nr;
+ const Vector3 *nr;
if (arrays[Mesh::ARRAY_NORMAL].get_type() != Variant::NIL)
- nr = arrays[Mesh::ARRAY_NORMAL].operator PoolVector<Vector3>().read();
+ nr = arrays[Mesh::ARRAY_NORMAL].operator Vector<Vector3>().ptr();
- PoolVector<real_t>::Read ta;
+ const real_t *ta;
if (arrays[Mesh::ARRAY_TANGENT].get_type() != Variant::NIL)
- ta = arrays[Mesh::ARRAY_TANGENT].operator PoolVector<real_t>().read();
+ ta = arrays[Mesh::ARRAY_TANGENT].operator Vector<real_t>().ptr();
- PoolVector<Vector2>::Read uv;
+ const Vector2 *uv;
if (arrays[Mesh::ARRAY_TEX_UV].get_type() != Variant::NIL)
- uv = arrays[Mesh::ARRAY_TEX_UV].operator PoolVector<Vector2>().read();
- PoolVector<Vector2>::Read uv2;
+ uv = arrays[Mesh::ARRAY_TEX_UV].operator Vector<Vector2>().ptr();
+ const Vector2 *uv2;
if (arrays[Mesh::ARRAY_TEX_UV2].get_type() != Variant::NIL)
- uv2 = arrays[Mesh::ARRAY_TEX_UV2].operator PoolVector<Vector2>().read();
+ uv2 = arrays[Mesh::ARRAY_TEX_UV2].operator Vector<Vector2>().ptr();
- PoolVector<Color>::Read col;
+ const Color *col;
if (arrays[Mesh::ARRAY_COLOR].get_type() != Variant::NIL)
- col = arrays[Mesh::ARRAY_COLOR].operator PoolVector<Color>().read();
+ col = arrays[Mesh::ARRAY_COLOR].operator Vector<Color>().ptr();
- PoolVector<int>::Read bo;
+ const int *bo;
if (arrays[Mesh::ARRAY_BONES].get_type() != Variant::NIL)
- bo = arrays[Mesh::ARRAY_BONES].operator PoolVector<int>().read();
+ bo = arrays[Mesh::ARRAY_BONES].operator Vector<int>().ptr();
- PoolVector<real_t>::Read we;
+ const real_t *we;
if (arrays[Mesh::ARRAY_WEIGHTS].get_type() != Variant::NIL)
- we = arrays[Mesh::ARRAY_WEIGHTS].operator PoolVector<real_t>().read();
+ we = arrays[Mesh::ARRAY_WEIGHTS].operator Vector<real_t>().ptr();
vertices.resize(vcount);
@@ -91,18 +91,18 @@ Error MeshDataTool::create_from_surface(const Ref<ArrayMesh> &p_mesh, int p_surf
Vertex v;
v.vertex = vr[i];
- if (nr.ptr())
+ if (nr)
v.normal = nr[i];
- if (ta.ptr())
+ if (ta)
v.tangent = Plane(ta[i * 4 + 0], ta[i * 4 + 1], ta[i * 4 + 2], ta[i * 4 + 3]);
- if (uv.ptr())
+ if (uv)
v.uv = uv[i];
- if (uv2.ptr())
+ if (uv2)
v.uv2 = uv2[i];
- if (col.ptr())
+ if (col)
v.color = col[i];
- if (we.ptr()) {
+ if (we) {
v.weights.push_back(we[i * 4 + 0]);
v.weights.push_back(we[i * 4 + 1]);
@@ -110,7 +110,7 @@ Error MeshDataTool::create_from_surface(const Ref<ArrayMesh> &p_mesh, int p_surf
v.weights.push_back(we[i * 4 + 3]);
}
- if (bo.ptr()) {
+ if (bo) {
v.bones.push_back(bo[i * 4 + 0]);
v.bones.push_back(bo[i * 4 + 1]);
@@ -121,7 +121,7 @@ Error MeshDataTool::create_from_surface(const Ref<ArrayMesh> &p_mesh, int p_surf
vertices.write[i] = v;
}
- PoolVector<int> indices;
+ Vector<int> indices;
if (arrays[Mesh::ARRAY_INDEX].get_type() != Variant::NIL) {
@@ -129,13 +129,13 @@ Error MeshDataTool::create_from_surface(const Ref<ArrayMesh> &p_mesh, int p_surf
} else {
//make code simpler
indices.resize(vcount);
- PoolVector<int>::Write iw = indices.write();
+ int *iw = indices.ptrw();
for (int i = 0; i < vcount; i++)
iw[i] = i;
}
int icount = indices.size();
- PoolVector<int>::Read r = indices.read();
+ const int *r = indices.ptr();
Map<Point2i, int> edge_indices;
@@ -187,61 +187,61 @@ Error MeshDataTool::commit_to_surface(const Ref<ArrayMesh> &p_mesh) {
int vcount = vertices.size();
- PoolVector<Vector3> v;
- PoolVector<Vector3> n;
- PoolVector<real_t> t;
- PoolVector<Vector2> u;
- PoolVector<Vector2> u2;
- PoolVector<Color> c;
- PoolVector<int> b;
- PoolVector<real_t> w;
- PoolVector<int> in;
+ Vector<Vector3> v;
+ Vector<Vector3> n;
+ Vector<real_t> t;
+ Vector<Vector2> u;
+ Vector<Vector2> u2;
+ Vector<Color> c;
+ Vector<int> b;
+ Vector<real_t> w;
+ Vector<int> in;
{
v.resize(vcount);
- PoolVector<Vector3>::Write vr = v.write();
+ Vector3 *vr = v.ptrw();
- PoolVector<Vector3>::Write nr;
+ Vector3 *nr;
if (format & Mesh::ARRAY_FORMAT_NORMAL) {
n.resize(vcount);
- nr = n.write();
+ nr = n.ptrw();
}
- PoolVector<real_t>::Write ta;
+ real_t *ta;
if (format & Mesh::ARRAY_FORMAT_TANGENT) {
t.resize(vcount * 4);
- ta = t.write();
+ ta = t.ptrw();
}
- PoolVector<Vector2>::Write uv;
+ Vector2 *uv;
if (format & Mesh::ARRAY_FORMAT_TEX_UV) {
u.resize(vcount);
- uv = u.write();
+ uv = u.ptrw();
}
- PoolVector<Vector2>::Write uv2;
+ Vector2 *uv2;
if (format & Mesh::ARRAY_FORMAT_TEX_UV2) {
u2.resize(vcount);
- uv2 = u2.write();
+ uv2 = u2.ptrw();
}
- PoolVector<Color>::Write col;
+ Color *col;
if (format & Mesh::ARRAY_FORMAT_COLOR) {
c.resize(vcount);
- col = c.write();
+ col = c.ptrw();
}
- PoolVector<int>::Write bo;
+ int *bo;
if (format & Mesh::ARRAY_FORMAT_BONES) {
b.resize(vcount * 4);
- bo = b.write();
+ bo = b.ptrw();
}
- PoolVector<real_t>::Write we;
+ real_t *we;
if (format & Mesh::ARRAY_FORMAT_WEIGHTS) {
w.resize(vcount * 4);
- we = w.write();
+ we = w.ptrw();
}
for (int i = 0; i < vcount; i++) {
@@ -249,22 +249,22 @@ Error MeshDataTool::commit_to_surface(const Ref<ArrayMesh> &p_mesh) {
const Vertex &vtx = vertices[i];
vr[i] = vtx.vertex;
- if (nr.ptr())
+ if (nr)
nr[i] = vtx.normal;
- if (ta.ptr()) {
+ if (ta) {
ta[i * 4 + 0] = vtx.tangent.normal.x;
ta[i * 4 + 1] = vtx.tangent.normal.y;
ta[i * 4 + 2] = vtx.tangent.normal.z;
ta[i * 4 + 3] = vtx.tangent.d;
}
- if (uv.ptr())
+ if (uv)
uv[i] = vtx.uv;
- if (uv2.ptr())
+ if (uv2)
uv2[i] = vtx.uv2;
- if (col.ptr())
+ if (col)
col[i] = vtx.color;
- if (we.ptr()) {
+ if (we) {
we[i * 4 + 0] = vtx.weights[0];
we[i * 4 + 1] = vtx.weights[1];
@@ -272,7 +272,7 @@ Error MeshDataTool::commit_to_surface(const Ref<ArrayMesh> &p_mesh) {
we[i * 4 + 3] = vtx.weights[3];
}
- if (bo.ptr()) {
+ if (bo) {
bo[i * 4 + 0] = vtx.bones[0];
bo[i * 4 + 1] = vtx.bones[1];
@@ -283,7 +283,7 @@ Error MeshDataTool::commit_to_surface(const Ref<ArrayMesh> &p_mesh) {
int fc = faces.size();
in.resize(fc * 3);
- PoolVector<int>::Write iw = in.write();
+ int *iw = in.ptrw();
for (int i = 0; i < fc; i++) {
iw[i * 3 + 0] = faces[i].v[0];
diff --git a/scene/resources/mesh_library.cpp b/scene/resources/mesh_library.cpp
index ac016bec5d..fffd192348 100644
--- a/scene/resources/mesh_library.cpp
+++ b/scene/resources/mesh_library.cpp
@@ -29,7 +29,6 @@
/*************************************************************************/
#include "mesh_library.h"
-#include "core/engine.h"
bool MeshLibrary::_set(const StringName &p_name, const Variant &p_value) {
@@ -202,11 +201,6 @@ Transform MeshLibrary::get_item_navmesh_transform(int p_item) const {
Ref<Texture2D> MeshLibrary::get_item_preview(int p_item) const {
- if (!Engine::get_singleton()->is_editor_hint()) {
- ERR_PRINT("MeshLibrary item previews are only generated in an editor context, which means they aren't available in a running project.");
- return Ref<Texture2D>();
- }
-
ERR_FAIL_COND_V_MSG(!item_map.has(p_item), Ref<Texture2D>(), "Requested for nonexistent MeshLibrary item '" + itos(p_item) + "'.");
return item_map[p_item].preview;
}
diff --git a/scene/resources/multimesh.cpp b/scene/resources/multimesh.cpp
index 9c34ae0504..aa8be326f5 100644
--- a/scene/resources/multimesh.cpp
+++ b/scene/resources/multimesh.cpp
@@ -35,17 +35,17 @@
#ifndef DISABLE_DEPRECATED
// Kept for compatibility from 3.x to 4.0.
-void MultiMesh::_set_transform_array(const PoolVector<Vector3> &p_array) {
+void MultiMesh::_set_transform_array(const Vector<Vector3> &p_array) {
if (transform_format != TRANSFORM_3D)
return;
- const PoolVector<Vector3> &xforms = p_array;
+ const Vector<Vector3> &xforms = p_array;
int len = xforms.size();
ERR_FAIL_COND((len / 4) != instance_count);
if (len == 0)
return;
- PoolVector<Vector3>::Read r = xforms.read();
+ const Vector3 *r = xforms.ptr();
for (int i = 0; i < len / 4; i++) {
@@ -59,18 +59,18 @@ void MultiMesh::_set_transform_array(const PoolVector<Vector3> &p_array) {
}
}
-PoolVector<Vector3> MultiMesh::_get_transform_array() const {
+Vector<Vector3> MultiMesh::_get_transform_array() const {
if (transform_format != TRANSFORM_3D)
- return PoolVector<Vector3>();
+ return Vector<Vector3>();
if (instance_count == 0)
- return PoolVector<Vector3>();
+ return Vector<Vector3>();
- PoolVector<Vector3> xforms;
+ Vector<Vector3> xforms;
xforms.resize(instance_count * 4);
- PoolVector<Vector3>::Write w = xforms.write();
+ Vector3 *w = xforms.ptrw();
for (int i = 0; i < instance_count; i++) {
@@ -84,18 +84,18 @@ PoolVector<Vector3> MultiMesh::_get_transform_array() const {
return xforms;
}
-void MultiMesh::_set_transform_2d_array(const PoolVector<Vector2> &p_array) {
+void MultiMesh::_set_transform_2d_array(const Vector<Vector2> &p_array) {
if (transform_format != TRANSFORM_2D)
return;
- const PoolVector<Vector2> &xforms = p_array;
+ const Vector<Vector2> &xforms = p_array;
int len = xforms.size();
ERR_FAIL_COND((len / 3) != instance_count);
if (len == 0)
return;
- PoolVector<Vector2>::Read r = xforms.read();
+ const Vector2 *r = xforms.ptr();
for (int i = 0; i < len / 3; i++) {
@@ -108,18 +108,18 @@ void MultiMesh::_set_transform_2d_array(const PoolVector<Vector2> &p_array) {
}
}
-PoolVector<Vector2> MultiMesh::_get_transform_2d_array() const {
+Vector<Vector2> MultiMesh::_get_transform_2d_array() const {
if (transform_format != TRANSFORM_2D)
- return PoolVector<Vector2>();
+ return Vector<Vector2>();
if (instance_count == 0)
- return PoolVector<Vector2>();
+ return Vector<Vector2>();
- PoolVector<Vector2> xforms;
+ Vector<Vector2> xforms;
xforms.resize(instance_count * 3);
- PoolVector<Vector2>::Write w = xforms.write();
+ Vector2 *w = xforms.ptrw();
for (int i = 0; i < instance_count; i++) {
@@ -132,15 +132,15 @@ PoolVector<Vector2> MultiMesh::_get_transform_2d_array() const {
return xforms;
}
-void MultiMesh::_set_color_array(const PoolVector<Color> &p_array) {
+void MultiMesh::_set_color_array(const Vector<Color> &p_array) {
- const PoolVector<Color> &colors = p_array;
+ const Vector<Color> &colors = p_array;
int len = colors.size();
if (len == 0)
return;
ERR_FAIL_COND(len != instance_count);
- PoolVector<Color>::Read r = colors.read();
+ const Color *r = colors.ptr();
for (int i = 0; i < len; i++) {
@@ -148,12 +148,12 @@ void MultiMesh::_set_color_array(const PoolVector<Color> &p_array) {
}
}
-PoolVector<Color> MultiMesh::_get_color_array() const {
+Vector<Color> MultiMesh::_get_color_array() const {
if (instance_count == 0 || !use_colors)
- return PoolVector<Color>();
+ return Vector<Color>();
- PoolVector<Color> colors;
+ Vector<Color> colors;
colors.resize(instance_count);
for (int i = 0; i < instance_count; i++) {
@@ -164,15 +164,15 @@ PoolVector<Color> MultiMesh::_get_color_array() const {
return colors;
}
-void MultiMesh::_set_custom_data_array(const PoolVector<Color> &p_array) {
+void MultiMesh::_set_custom_data_array(const Vector<Color> &p_array) {
- const PoolVector<Color> &custom_datas = p_array;
+ const Vector<Color> &custom_datas = p_array;
int len = custom_datas.size();
if (len == 0)
return;
ERR_FAIL_COND(len != instance_count);
- PoolVector<Color>::Read r = custom_datas.read();
+ const Color *r = custom_datas.ptr();
for (int i = 0; i < len; i++) {
@@ -180,12 +180,12 @@ void MultiMesh::_set_custom_data_array(const PoolVector<Color> &p_array) {
}
}
-PoolVector<Color> MultiMesh::_get_custom_data_array() const {
+Vector<Color> MultiMesh::_get_custom_data_array() const {
if (instance_count == 0 || !use_custom_data)
- return PoolVector<Color>();
+ return Vector<Color>();
- PoolVector<Color> custom_datas;
+ Vector<Color> custom_datas;
custom_datas.resize(instance_count);
for (int i = 0; i < instance_count; i++) {
@@ -197,11 +197,11 @@ PoolVector<Color> MultiMesh::_get_custom_data_array() const {
}
#endif // DISABLE_DEPRECATED
-void MultiMesh::set_buffer(const PoolVector<float> &p_buffer) {
+void MultiMesh::set_buffer(const Vector<float> &p_buffer) {
VS::get_singleton()->multimesh_set_buffer(multimesh, p_buffer);
}
-PoolVector<float> MultiMesh::get_buffer() const {
+Vector<float> MultiMesh::get_buffer() const {
return VS::get_singleton()->multimesh_get_buffer(multimesh);
}
@@ -350,7 +350,7 @@ void MultiMesh::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "instance_count", PROPERTY_HINT_RANGE, "0,16384,1,or_greater"), "set_instance_count", "get_instance_count");
ADD_PROPERTY(PropertyInfo(Variant::INT, "visible_instance_count", PROPERTY_HINT_RANGE, "-1,16384,1,or_greater"), "set_visible_instance_count", "get_visible_instance_count");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "mesh", PROPERTY_HINT_RESOURCE_TYPE, "Mesh"), "set_mesh", "get_mesh");
- ADD_PROPERTY(PropertyInfo(Variant::POOL_REAL_ARRAY, "buffer", PROPERTY_HINT_NONE), "set_buffer", "get_buffer");
+ ADD_PROPERTY(PropertyInfo(Variant::PACKED_FLOAT32_ARRAY, "buffer", PROPERTY_HINT_NONE), "set_buffer", "get_buffer");
#ifndef DISABLE_DEPRECATED
// Kept for compatibility from 3.x to 4.0.
@@ -363,10 +363,10 @@ void MultiMesh::_bind_methods() {
ClassDB::bind_method(D_METHOD("_set_custom_data_array"), &MultiMesh::_set_custom_data_array);
ClassDB::bind_method(D_METHOD("_get_custom_data_array"), &MultiMesh::_get_custom_data_array);
- ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR3_ARRAY, "transform_array", PROPERTY_HINT_NONE, "", 0), "_set_transform_array", "_get_transform_array");
- ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR2_ARRAY, "transform_2d_array", PROPERTY_HINT_NONE, "", 0), "_set_transform_2d_array", "_get_transform_2d_array");
- ADD_PROPERTY(PropertyInfo(Variant::POOL_COLOR_ARRAY, "color_array", PROPERTY_HINT_NONE, "", 0), "_set_color_array", "_get_color_array");
- ADD_PROPERTY(PropertyInfo(Variant::POOL_COLOR_ARRAY, "custom_data_array", PROPERTY_HINT_NONE, "", 0), "_set_custom_data_array", "_get_custom_data_array");
+ ADD_PROPERTY(PropertyInfo(Variant::PACKED_VECTOR3_ARRAY, "transform_array", PROPERTY_HINT_NONE, "", 0), "_set_transform_array", "_get_transform_array");
+ ADD_PROPERTY(PropertyInfo(Variant::PACKED_VECTOR2_ARRAY, "transform_2d_array", PROPERTY_HINT_NONE, "", 0), "_set_transform_2d_array", "_get_transform_2d_array");
+ ADD_PROPERTY(PropertyInfo(Variant::PACKED_COLOR_ARRAY, "color_array", PROPERTY_HINT_NONE, "", 0), "_set_color_array", "_get_color_array");
+ ADD_PROPERTY(PropertyInfo(Variant::PACKED_COLOR_ARRAY, "custom_data_array", PROPERTY_HINT_NONE, "", 0), "_set_custom_data_array", "_get_custom_data_array");
#endif
BIND_ENUM_CONSTANT(TRANSFORM_2D);
diff --git a/scene/resources/multimesh.h b/scene/resources/multimesh.h
index 5423e66358..8ca30a5b88 100644
--- a/scene/resources/multimesh.h
+++ b/scene/resources/multimesh.h
@@ -59,20 +59,20 @@ protected:
#ifndef DISABLE_DEPRECATED
// Kept for compatibility from 3.x to 4.0.
- void _set_transform_array(const PoolVector<Vector3> &p_array);
- PoolVector<Vector3> _get_transform_array() const;
+ void _set_transform_array(const Vector<Vector3> &p_array);
+ Vector<Vector3> _get_transform_array() const;
- void _set_transform_2d_array(const PoolVector<Vector2> &p_array);
- PoolVector<Vector2> _get_transform_2d_array() const;
+ void _set_transform_2d_array(const Vector<Vector2> &p_array);
+ Vector<Vector2> _get_transform_2d_array() const;
- void _set_color_array(const PoolVector<Color> &p_array);
- PoolVector<Color> _get_color_array() const;
+ void _set_color_array(const Vector<Color> &p_array);
+ Vector<Color> _get_color_array() const;
- void _set_custom_data_array(const PoolVector<Color> &p_array);
- PoolVector<Color> _get_custom_data_array() const;
+ void _set_custom_data_array(const Vector<Color> &p_array);
+ Vector<Color> _get_custom_data_array() const;
#endif
- void set_buffer(const PoolVector<float> &p_buffer);
- PoolVector<float> get_buffer() const;
+ void set_buffer(const Vector<float> &p_buffer);
+ Vector<float> get_buffer() const;
public:
void set_mesh(const Ref<Mesh> &p_mesh);
diff --git a/scene/resources/navigation_mesh.cpp b/scene/resources/navigation_mesh.cpp
index e6544778bc..e0aff2182e 100644
--- a/scene/resources/navigation_mesh.cpp
+++ b/scene/resources/navigation_mesh.cpp
@@ -32,7 +32,7 @@
void NavigationMesh::create_from_mesh(const Ref<Mesh> &p_mesh) {
- vertices = PoolVector<Vector3>();
+ vertices = Vector<Vector3>();
clear_polygons();
for (int i = 0; i < p_mesh->get_surface_count(); i++) {
@@ -40,15 +40,15 @@ void NavigationMesh::create_from_mesh(const Ref<Mesh> &p_mesh) {
if (p_mesh->surface_get_primitive_type(i) != Mesh::PRIMITIVE_TRIANGLES)
continue;
Array arr = p_mesh->surface_get_arrays(i);
- PoolVector<Vector3> varr = arr[Mesh::ARRAY_VERTEX];
- PoolVector<int> iarr = arr[Mesh::ARRAY_INDEX];
+ Vector<Vector3> varr = arr[Mesh::ARRAY_VERTEX];
+ Vector<int> iarr = arr[Mesh::ARRAY_INDEX];
if (varr.size() == 0 || iarr.size() == 0)
continue;
int from = vertices.size();
vertices.append_array(varr);
int rlen = iarr.size();
- PoolVector<int>::Read r = iarr.read();
+ const int *r = iarr.ptr();
for (int j = 0; j < rlen; j += 3) {
Vector<int> vi;
@@ -252,13 +252,13 @@ bool NavigationMesh::get_filter_walkable_low_height_spans() const {
return filter_walkable_low_height_spans;
}
-void NavigationMesh::set_vertices(const PoolVector<Vector3> &p_vertices) {
+void NavigationMesh::set_vertices(const Vector<Vector3> &p_vertices) {
vertices = p_vertices;
_change_notify();
}
-PoolVector<Vector3> NavigationMesh::get_vertices() const {
+Vector<Vector3> NavigationMesh::get_vertices() const {
return vertices;
}
@@ -309,8 +309,8 @@ Ref<Mesh> NavigationMesh::get_debug_mesh() {
if (debug_mesh.is_valid())
return debug_mesh;
- PoolVector<Vector3> vertices = get_vertices();
- PoolVector<Vector3>::Read vr = vertices.read();
+ Vector<Vector3> vertices = get_vertices();
+ const Vector3 *vr = vertices.ptr();
List<Face3> faces;
for (int i = 0; i < get_polygon_count(); i++) {
Vector<int> p = get_polygon(i);
@@ -326,11 +326,11 @@ Ref<Mesh> NavigationMesh::get_debug_mesh() {
}
Map<_EdgeKey, bool> edge_map;
- PoolVector<Vector3> tmeshfaces;
+ Vector<Vector3> tmeshfaces;
tmeshfaces.resize(faces.size() * 3);
{
- PoolVector<Vector3>::Write tw = tmeshfaces.write();
+ Vector3 *tw = tmeshfaces.ptrw();
int tidx = 0;
for (List<Face3>::Element *E = faces.front(); E; E = E->next()) {
@@ -369,10 +369,10 @@ Ref<Mesh> NavigationMesh::get_debug_mesh() {
}
}
- PoolVector<Vector3> varr;
+ Vector<Vector3> varr;
varr.resize(lines.size());
{
- PoolVector<Vector3>::Write w = varr.write();
+ Vector3 *w = varr.ptrw();
int idx = 0;
for (List<Vector3>::Element *E = lines.front(); E; E = E->next()) {
w[idx++] = E->get();
@@ -478,7 +478,7 @@ void NavigationMesh::_bind_methods() {
BIND_CONSTANT(PARSED_GEOMETRY_STATIC_COLLIDERS);
BIND_CONSTANT(PARSED_GEOMETRY_BOTH);
- ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR3_ARRAY, "vertices", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "set_vertices", "get_vertices");
+ ADD_PROPERTY(PropertyInfo(Variant::PACKED_VECTOR3_ARRAY, "vertices", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "set_vertices", "get_vertices");
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "polygons", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_polygons", "_get_polygons");
ADD_PROPERTY(PropertyInfo(Variant::INT, "sample_partition_type/sample_partition_type", PROPERTY_HINT_ENUM, "Watershed,Monotone,Layers"), "set_sample_partition_type", "get_sample_partition_type");
@@ -487,19 +487,19 @@ void NavigationMesh::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "geometry/source_geometry_mode", PROPERTY_HINT_ENUM, "Navmesh Children, Group With Children, Group Explicit"), "set_source_geometry_mode", "get_source_geometry_mode");
ADD_PROPERTY(PropertyInfo(Variant::STRING, "geometry/source_group_name"), "set_source_group_name", "get_source_group_name");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "cell/size", PROPERTY_HINT_RANGE, "0.1,1.0,0.01,or_greater"), "set_cell_size", "get_cell_size");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "cell/height", PROPERTY_HINT_RANGE, "0.1,1.0,0.01,or_greater"), "set_cell_height", "get_cell_height");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "agent/height", PROPERTY_HINT_RANGE, "0.1,5.0,0.01,or_greater"), "set_agent_height", "get_agent_height");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "agent/radius", PROPERTY_HINT_RANGE, "0.1,5.0,0.01,or_greater"), "set_agent_radius", "get_agent_radius");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "agent/max_climb", PROPERTY_HINT_RANGE, "0.1,5.0,0.01,or_greater"), "set_agent_max_climb", "get_agent_max_climb");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "agent/max_slope", PROPERTY_HINT_RANGE, "0.0,90.0,0.1"), "set_agent_max_slope", "get_agent_max_slope");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "region/min_size", PROPERTY_HINT_RANGE, "0.0,150.0,0.01,or_greater"), "set_region_min_size", "get_region_min_size");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "region/merge_size", PROPERTY_HINT_RANGE, "0.0,150.0,0.01,or_greater"), "set_region_merge_size", "get_region_merge_size");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "edge/max_length", PROPERTY_HINT_RANGE, "0.0,50.0,0.01,or_greater"), "set_edge_max_length", "get_edge_max_length");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "edge/max_error", PROPERTY_HINT_RANGE, "0.1,3.0,0.01,or_greater"), "set_edge_max_error", "get_edge_max_error");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "polygon/verts_per_poly", PROPERTY_HINT_RANGE, "3.0,12.0,1.0,or_greater"), "set_verts_per_poly", "get_verts_per_poly");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "detail/sample_distance", PROPERTY_HINT_RANGE, "0.0,16.0,0.01,or_greater"), "set_detail_sample_distance", "get_detail_sample_distance");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "detail/sample_max_error", PROPERTY_HINT_RANGE, "0.0,16.0,0.01,or_greater"), "set_detail_sample_max_error", "get_detail_sample_max_error");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "cell/size", PROPERTY_HINT_RANGE, "0.1,1.0,0.01,or_greater"), "set_cell_size", "get_cell_size");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "cell/height", PROPERTY_HINT_RANGE, "0.1,1.0,0.01,or_greater"), "set_cell_height", "get_cell_height");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "agent/height", PROPERTY_HINT_RANGE, "0.1,5.0,0.01,or_greater"), "set_agent_height", "get_agent_height");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "agent/radius", PROPERTY_HINT_RANGE, "0.1,5.0,0.01,or_greater"), "set_agent_radius", "get_agent_radius");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "agent/max_climb", PROPERTY_HINT_RANGE, "0.1,5.0,0.01,or_greater"), "set_agent_max_climb", "get_agent_max_climb");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "agent/max_slope", PROPERTY_HINT_RANGE, "0.0,90.0,0.1"), "set_agent_max_slope", "get_agent_max_slope");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "region/min_size", PROPERTY_HINT_RANGE, "0.0,150.0,0.01,or_greater"), "set_region_min_size", "get_region_min_size");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "region/merge_size", PROPERTY_HINT_RANGE, "0.0,150.0,0.01,or_greater"), "set_region_merge_size", "get_region_merge_size");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "edge/max_length", PROPERTY_HINT_RANGE, "0.0,50.0,0.01,or_greater"), "set_edge_max_length", "get_edge_max_length");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "edge/max_error", PROPERTY_HINT_RANGE, "0.1,3.0,0.01,or_greater"), "set_edge_max_error", "get_edge_max_error");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "polygon/verts_per_poly", PROPERTY_HINT_RANGE, "3.0,12.0,1.0,or_greater"), "set_verts_per_poly", "get_verts_per_poly");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "detail/sample_distance", PROPERTY_HINT_RANGE, "0.0,16.0,0.01,or_greater"), "set_detail_sample_distance", "get_detail_sample_distance");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "detail/sample_max_error", PROPERTY_HINT_RANGE, "0.0,16.0,0.01,or_greater"), "set_detail_sample_max_error", "get_detail_sample_max_error");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "filter/low_hanging_obstacles"), "set_filter_low_hanging_obstacles", "get_filter_low_hanging_obstacles");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "filter/ledge_spans"), "set_filter_ledge_spans", "get_filter_ledge_spans");
diff --git a/scene/resources/navigation_mesh.h b/scene/resources/navigation_mesh.h
index a2b1c62eab..cc3ac6e3fd 100644
--- a/scene/resources/navigation_mesh.h
+++ b/scene/resources/navigation_mesh.h
@@ -39,7 +39,7 @@ class NavigationMesh : public Resource {
GDCLASS(NavigationMesh, Resource);
- PoolVector<Vector3> vertices;
+ Vector<Vector3> vertices;
struct Polygon {
Vector<int> indices;
};
@@ -179,8 +179,8 @@ public:
void create_from_mesh(const Ref<Mesh> &p_mesh);
- void set_vertices(const PoolVector<Vector3> &p_vertices);
- PoolVector<Vector3> get_vertices() const;
+ void set_vertices(const Vector<Vector3> &p_vertices);
+ Vector<Vector3> get_vertices() const;
void add_polygon(const Vector<int> &p_polygon);
int get_polygon_count() const;
diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp
index 3e7d350eec..00910095c7 100644
--- a/scene/resources/packed_scene.cpp
+++ b/scene/resources/packed_scene.cpp
@@ -331,7 +331,7 @@ Node *SceneState::instance(GenEditState p_edit_state) const {
binds.write[j] = props[c.binds[j]];
}
- cfrom->connect(snames[c.signal], cto, snames[c.method], binds, CONNECT_PERSIST | c.flags);
+ cfrom->connect_compat(snames[c.signal], cto, snames[c.method], binds, CONNECT_PERSIST | c.flags);
}
//Node *s = ret_nodes[0];
@@ -532,7 +532,7 @@ Error SceneState::_parse_node(Node *p_owner, Node *p_node, int p_parent_idx, Map
if (exists) {
//check if already exists and did not change
- if (value.get_type() == Variant::REAL && original.get_type() == Variant::REAL) {
+ if (value.get_type() == Variant::FLOAT && original.get_type() == Variant::FLOAT) {
//this must be done because, as some scenes save as text, there might be a tiny difference in floats due to numerical error
float a = value;
float b = original;
@@ -702,7 +702,7 @@ Error SceneState::_parse_connections(Node *p_owner, Node *p_node, Map<StringName
// only connections that originate or end into main saved scene are saved
// everything else is discarded
- Node *target = Object::cast_to<Node>(c.target);
+ Node *target = Object::cast_to<Node>(c.callable.get_object());
if (!target) {
continue;
@@ -734,7 +734,7 @@ Error SceneState::_parse_connections(Node *p_owner, Node *p_node, Map<StringName
NodePath signal_from = common_parent->get_path_to(p_node);
NodePath signal_to = common_parent->get_path_to(target);
- if (ps->has_connection(signal_from, c.signal, signal_to, c.method)) {
+ if (ps->has_connection(signal_from, c.signal.get_name(), signal_to, c.callable.get_method())) {
exists = true;
break;
}
@@ -766,7 +766,7 @@ Error SceneState::_parse_connections(Node *p_owner, Node *p_node, Map<StringName
if (from_node >= 0 && to_node >= 0) {
//this one has state for this node, save
- if (state->is_connection(from_node, c.signal, to_node, c.method)) {
+ if (state->is_connection(from_node, c.signal.get_name(), to_node, c.callable.get_method())) {
exists2 = true;
break;
}
@@ -784,7 +784,7 @@ Error SceneState::_parse_connections(Node *p_owner, Node *p_node, Map<StringName
if (from_node >= 0 && to_node >= 0) {
//this one has state for this node, save
- if (state->is_connection(from_node, c.signal, to_node, c.method)) {
+ if (state->is_connection(from_node, c.signal.get_name(), to_node, c.callable.get_method())) {
exists2 = true;
break;
}
@@ -831,8 +831,8 @@ Error SceneState::_parse_connections(Node *p_owner, Node *p_node, Map<StringName
ConnectionData cd;
cd.from = src_id;
cd.to = target_id;
- cd.method = _nm_get_string(c.method, name_map);
- cd.signal = _nm_get_string(c.signal, name_map);
+ cd.method = _nm_get_string(c.callable.get_method(), name_map);
+ cd.signal = _nm_get_string(c.signal.get_name(), name_map);
cd.flags = c.flags;
for (int i = 0; i < c.binds.size(); i++) {
@@ -1098,19 +1098,19 @@ void SceneState::set_bundled_scene(const Dictionary &p_dictionary) {
ERR_FAIL_COND_MSG(version > PACKED_SCENE_VERSION, "Save format version too new.");
const int node_count = p_dictionary["node_count"];
- const PoolVector<int> snodes = p_dictionary["nodes"];
+ const Vector<int> snodes = p_dictionary["nodes"];
ERR_FAIL_COND(snodes.size() < node_count);
const int conn_count = p_dictionary["conn_count"];
- const PoolVector<int> sconns = p_dictionary["conns"];
+ const Vector<int> sconns = p_dictionary["conns"];
ERR_FAIL_COND(sconns.size() < conn_count);
- PoolVector<String> snames = p_dictionary["names"];
+ Vector<String> snames = p_dictionary["names"];
if (snames.size()) {
int namecount = snames.size();
names.resize(namecount);
- PoolVector<String>::Read r = snames.read();
+ const String *r = snames.ptr();
for (int i = 0; i < names.size(); i++)
names.write[i] = r[i];
}
@@ -1131,7 +1131,7 @@ void SceneState::set_bundled_scene(const Dictionary &p_dictionary) {
nodes.resize(node_count);
if (node_count) {
- PoolVector<int>::Read r = snodes.read();
+ const int *r = snodes.ptr();
int idx = 0;
for (int i = 0; i < node_count; i++) {
NodeData &nd = nodes.write[i];
@@ -1159,7 +1159,7 @@ void SceneState::set_bundled_scene(const Dictionary &p_dictionary) {
connections.resize(conn_count);
if (conn_count) {
- PoolVector<int>::Read r = sconns.read();
+ const int *r = sconns.ptr();
int idx = 0;
for (int i = 0; i < conn_count; i++) {
ConnectionData &cd = connections.write[i];
@@ -1205,12 +1205,12 @@ void SceneState::set_bundled_scene(const Dictionary &p_dictionary) {
Dictionary SceneState::get_bundled_scene() const {
- PoolVector<String> rnames;
+ Vector<String> rnames;
rnames.resize(names.size());
if (names.size()) {
- PoolVector<String>::Write r = rnames.write();
+ String *r = rnames.ptrw();
for (int i = 0; i < names.size(); i++)
r[i] = names[i];
@@ -1612,10 +1612,10 @@ void SceneState::add_editable_instance(const NodePath &p_path) {
editable_instances.push_back(p_path);
}
-PoolVector<String> SceneState::_get_node_groups(int p_idx) const {
+Vector<String> SceneState::_get_node_groups(int p_idx) const {
Vector<StringName> groups = get_node_groups(p_idx);
- PoolVector<String> ret;
+ Vector<String> ret;
for (int i = 0; i < groups.size(); i++)
ret.push_back(groups[i]);
diff --git a/scene/resources/packed_scene.h b/scene/resources/packed_scene.h
index b4966e2528..c5873a0792 100644
--- a/scene/resources/packed_scene.h
+++ b/scene/resources/packed_scene.h
@@ -103,7 +103,7 @@ class SceneState : public Reference {
static bool disable_placeholders;
- PoolVector<String> _get_node_groups(int p_idx) const;
+ Vector<String> _get_node_groups(int p_idx) const;
int _find_base_scene_node_remap_key(int p_idx) const;
diff --git a/scene/resources/particles_material.cpp b/scene/resources/particles_material.cpp
index d852dca7fa..e820aec2ed 100644
--- a/scene/resources/particles_material.cpp
+++ b/scene/resources/particles_material.cpp
@@ -189,7 +189,7 @@ void ParticlesMaterial::_update_shader() {
} break;
case EMISSION_SHAPE_DIRECTED_POINTS: {
code += "uniform sampler2D emission_texture_normal : hint_black;\n";
- FALLTHROUGH;
+ [[fallthrough]];
}
case EMISSION_SHAPE_POINTS: {
code += "uniform sampler2D emission_texture_points : hint_black;\n";
@@ -1153,14 +1153,14 @@ void ParticlesMaterial::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_lifetime_randomness"), &ParticlesMaterial::get_lifetime_randomness);
ADD_GROUP("Time", "");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "lifetime_randomness", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_lifetime_randomness", "get_lifetime_randomness");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "lifetime_randomness", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_lifetime_randomness", "get_lifetime_randomness");
ADD_GROUP("Trail", "trail_");
ADD_PROPERTY(PropertyInfo(Variant::INT, "trail_divisor", PROPERTY_HINT_RANGE, "1,1000000,1"), "set_trail_divisor", "get_trail_divisor");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "trail_size_modifier", PROPERTY_HINT_RESOURCE_TYPE, "CurveTexture"), "set_trail_size_modifier", "get_trail_size_modifier");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "trail_color_modifier", PROPERTY_HINT_RESOURCE_TYPE, "GradientTexture"), "set_trail_color_modifier", "get_trail_color_modifier");
ADD_GROUP("Emission Shape", "emission_");
ADD_PROPERTY(PropertyInfo(Variant::INT, "emission_shape", PROPERTY_HINT_ENUM, "Point,Sphere,Box,Points,Directed Points"), "set_emission_shape", "get_emission_shape");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "emission_sphere_radius", PROPERTY_HINT_RANGE, "0.01,128,0.01,or_greater"), "set_emission_sphere_radius", "get_emission_sphere_radius");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "emission_sphere_radius", PROPERTY_HINT_RANGE, "0.01,128,0.01,or_greater"), "set_emission_sphere_radius", "get_emission_sphere_radius");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "emission_box_extents"), "set_emission_box_extents", "get_emission_box_extents");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "emission_point_texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_emission_point_texture", "get_emission_point_texture");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "emission_normal_texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_emission_normal_texture", "get_emission_normal_texture");
@@ -1172,59 +1172,59 @@ void ParticlesMaterial::_bind_methods() {
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "flag_disable_z"), "set_flag", "get_flag", FLAG_DISABLE_Z);
ADD_GROUP("Direction", "");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "direction"), "set_direction", "get_direction");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "spread", PROPERTY_HINT_RANGE, "0,180,0.01"), "set_spread", "get_spread");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "flatness", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_flatness", "get_flatness");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "spread", PROPERTY_HINT_RANGE, "0,180,0.01"), "set_spread", "get_spread");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "flatness", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_flatness", "get_flatness");
ADD_GROUP("Gravity", "");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "gravity"), "set_gravity", "get_gravity");
ADD_GROUP("Initial Velocity", "initial_");
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "initial_velocity", PROPERTY_HINT_RANGE, "0,1000,0.01,or_lesser,or_greater"), "set_param", "get_param", PARAM_INITIAL_LINEAR_VELOCITY);
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "initial_velocity_random", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param_randomness", "get_param_randomness", PARAM_INITIAL_LINEAR_VELOCITY);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "initial_velocity", PROPERTY_HINT_RANGE, "0,1000,0.01,or_lesser,or_greater"), "set_param", "get_param", PARAM_INITIAL_LINEAR_VELOCITY);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "initial_velocity_random", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param_randomness", "get_param_randomness", PARAM_INITIAL_LINEAR_VELOCITY);
ADD_GROUP("Angular Velocity", "angular_");
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "angular_velocity", PROPERTY_HINT_RANGE, "-720,720,0.01,or_lesser,or_greater"), "set_param", "get_param", PARAM_ANGULAR_VELOCITY);
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "angular_velocity_random", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param_randomness", "get_param_randomness", PARAM_ANGULAR_VELOCITY);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "angular_velocity", PROPERTY_HINT_RANGE, "-720,720,0.01,or_lesser,or_greater"), "set_param", "get_param", PARAM_ANGULAR_VELOCITY);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "angular_velocity_random", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param_randomness", "get_param_randomness", PARAM_ANGULAR_VELOCITY);
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "angular_velocity_curve", PROPERTY_HINT_RESOURCE_TYPE, "CurveTexture"), "set_param_texture", "get_param_texture", PARAM_ANGULAR_VELOCITY);
ADD_GROUP("Orbit Velocity", "orbit_");
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "orbit_velocity", PROPERTY_HINT_RANGE, "-1000,1000,0.01,or_lesser,or_greater"), "set_param", "get_param", PARAM_ORBIT_VELOCITY);
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "orbit_velocity_random", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param_randomness", "get_param_randomness", PARAM_ORBIT_VELOCITY);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "orbit_velocity", PROPERTY_HINT_RANGE, "-1000,1000,0.01,or_lesser,or_greater"), "set_param", "get_param", PARAM_ORBIT_VELOCITY);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "orbit_velocity_random", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param_randomness", "get_param_randomness", PARAM_ORBIT_VELOCITY);
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "orbit_velocity_curve", PROPERTY_HINT_RESOURCE_TYPE, "CurveTexture"), "set_param_texture", "get_param_texture", PARAM_ORBIT_VELOCITY);
ADD_GROUP("Linear Accel", "linear_");
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "linear_accel", PROPERTY_HINT_RANGE, "-100,100,0.01,or_lesser,or_greater"), "set_param", "get_param", PARAM_LINEAR_ACCEL);
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "linear_accel_random", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param_randomness", "get_param_randomness", PARAM_LINEAR_ACCEL);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "linear_accel", PROPERTY_HINT_RANGE, "-100,100,0.01,or_lesser,or_greater"), "set_param", "get_param", PARAM_LINEAR_ACCEL);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "linear_accel_random", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param_randomness", "get_param_randomness", PARAM_LINEAR_ACCEL);
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "linear_accel_curve", PROPERTY_HINT_RESOURCE_TYPE, "CurveTexture"), "set_param_texture", "get_param_texture", PARAM_LINEAR_ACCEL);
ADD_GROUP("Radial Accel", "radial_");
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "radial_accel", PROPERTY_HINT_RANGE, "-100,100,0.01,or_lesser,or_greater"), "set_param", "get_param", PARAM_RADIAL_ACCEL);
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "radial_accel_random", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param_randomness", "get_param_randomness", PARAM_RADIAL_ACCEL);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "radial_accel", PROPERTY_HINT_RANGE, "-100,100,0.01,or_lesser,or_greater"), "set_param", "get_param", PARAM_RADIAL_ACCEL);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "radial_accel_random", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param_randomness", "get_param_randomness", PARAM_RADIAL_ACCEL);
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "radial_accel_curve", PROPERTY_HINT_RESOURCE_TYPE, "CurveTexture"), "set_param_texture", "get_param_texture", PARAM_RADIAL_ACCEL);
ADD_GROUP("Tangential Accel", "tangential_");
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "tangential_accel", PROPERTY_HINT_RANGE, "-100,100,0.01,or_lesser,or_greater"), "set_param", "get_param", PARAM_TANGENTIAL_ACCEL);
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "tangential_accel_random", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param_randomness", "get_param_randomness", PARAM_TANGENTIAL_ACCEL);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "tangential_accel", PROPERTY_HINT_RANGE, "-100,100,0.01,or_lesser,or_greater"), "set_param", "get_param", PARAM_TANGENTIAL_ACCEL);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "tangential_accel_random", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param_randomness", "get_param_randomness", PARAM_TANGENTIAL_ACCEL);
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "tangential_accel_curve", PROPERTY_HINT_RESOURCE_TYPE, "CurveTexture"), "set_param_texture", "get_param_texture", PARAM_TANGENTIAL_ACCEL);
ADD_GROUP("Damping", "");
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "damping", PROPERTY_HINT_RANGE, "0,100,0.01,or_greater"), "set_param", "get_param", PARAM_DAMPING);
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "damping_random", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param_randomness", "get_param_randomness", PARAM_DAMPING);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "damping", PROPERTY_HINT_RANGE, "0,100,0.01,or_greater"), "set_param", "get_param", PARAM_DAMPING);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "damping_random", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param_randomness", "get_param_randomness", PARAM_DAMPING);
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "damping_curve", PROPERTY_HINT_RESOURCE_TYPE, "CurveTexture"), "set_param_texture", "get_param_texture", PARAM_DAMPING);
ADD_GROUP("Angle", "");
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "angle", PROPERTY_HINT_RANGE, "-720,720,0.1,or_lesser,or_greater"), "set_param", "get_param", PARAM_ANGLE);
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "angle_random", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param_randomness", "get_param_randomness", PARAM_ANGLE);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "angle", PROPERTY_HINT_RANGE, "-720,720,0.1,or_lesser,or_greater"), "set_param", "get_param", PARAM_ANGLE);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "angle_random", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param_randomness", "get_param_randomness", PARAM_ANGLE);
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "angle_curve", PROPERTY_HINT_RESOURCE_TYPE, "CurveTexture"), "set_param_texture", "get_param_texture", PARAM_ANGLE);
ADD_GROUP("Scale", "");
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "scale", PROPERTY_HINT_RANGE, "0,1000,0.01,or_greater"), "set_param", "get_param", PARAM_SCALE);
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "scale_random", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param_randomness", "get_param_randomness", PARAM_SCALE);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "scale", PROPERTY_HINT_RANGE, "0,1000,0.01,or_greater"), "set_param", "get_param", PARAM_SCALE);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "scale_random", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param_randomness", "get_param_randomness", PARAM_SCALE);
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "scale_curve", PROPERTY_HINT_RESOURCE_TYPE, "CurveTexture"), "set_param_texture", "get_param_texture", PARAM_SCALE);
ADD_GROUP("Color", "");
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "color"), "set_color", "get_color");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "color_ramp", PROPERTY_HINT_RESOURCE_TYPE, "GradientTexture"), "set_color_ramp", "get_color_ramp");
ADD_GROUP("Hue Variation", "hue_");
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "hue_variation", PROPERTY_HINT_RANGE, "-1,1,0.01"), "set_param", "get_param", PARAM_HUE_VARIATION);
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "hue_variation_random", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param_randomness", "get_param_randomness", PARAM_HUE_VARIATION);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "hue_variation", PROPERTY_HINT_RANGE, "-1,1,0.01"), "set_param", "get_param", PARAM_HUE_VARIATION);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "hue_variation_random", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param_randomness", "get_param_randomness", PARAM_HUE_VARIATION);
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "hue_variation_curve", PROPERTY_HINT_RESOURCE_TYPE, "CurveTexture"), "set_param_texture", "get_param_texture", PARAM_HUE_VARIATION);
ADD_GROUP("Animation", "anim_");
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "anim_speed", PROPERTY_HINT_RANGE, "0,128,0.01,or_greater"), "set_param", "get_param", PARAM_ANIM_SPEED);
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "anim_speed_random", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param_randomness", "get_param_randomness", PARAM_ANIM_SPEED);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "anim_speed", PROPERTY_HINT_RANGE, "0,128,0.01,or_greater"), "set_param", "get_param", PARAM_ANIM_SPEED);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "anim_speed_random", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param_randomness", "get_param_randomness", PARAM_ANIM_SPEED);
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "anim_speed_curve", PROPERTY_HINT_RESOURCE_TYPE, "CurveTexture"), "set_param_texture", "get_param_texture", PARAM_ANIM_SPEED);
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "anim_offset", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param", "get_param", PARAM_ANIM_OFFSET);
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "anim_offset_random", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param_randomness", "get_param_randomness", PARAM_ANIM_OFFSET);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "anim_offset", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param", "get_param", PARAM_ANIM_OFFSET);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "anim_offset_random", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param_randomness", "get_param_randomness", PARAM_ANIM_OFFSET);
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "anim_offset_curve", PROPERTY_HINT_RESOURCE_TYPE, "CurveTexture"), "set_param_texture", "get_param_texture", PARAM_ANIM_OFFSET);
BIND_ENUM_CONSTANT(PARAM_INITIAL_LINEAR_VELOCITY);
diff --git a/scene/resources/physics_material.cpp b/scene/resources/physics_material.cpp
index 0db115ecc0..8ac0191452 100644
--- a/scene/resources/physics_material.cpp
+++ b/scene/resources/physics_material.cpp
@@ -44,9 +44,9 @@ void PhysicsMaterial::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_absorbent", "absorbent"), &PhysicsMaterial::set_absorbent);
ClassDB::bind_method(D_METHOD("is_absorbent"), &PhysicsMaterial::is_absorbent);
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "friction"), "set_friction", "get_friction");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "friction"), "set_friction", "get_friction");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "rough"), "set_rough", "is_rough");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "bounce"), "set_bounce", "get_bounce");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "bounce"), "set_bounce", "get_bounce");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "absorbent"), "set_absorbent", "is_absorbent");
}
diff --git a/scene/resources/polygon_path_finder.cpp b/scene/resources/polygon_path_finder.cpp
index 9a1d478777..eff0721cef 100644
--- a/scene/resources/polygon_path_finder.cpp
+++ b/scene/resources/polygon_path_finder.cpp
@@ -415,7 +415,7 @@ void PolygonPathFinder::_set_data(const Dictionary &p_data) {
ERR_FAIL_COND(!p_data.has("segments"));
ERR_FAIL_COND(!p_data.has("bounds"));
- PoolVector<Vector2> p = p_data["points"];
+ Vector<Vector2> p = p_data["points"];
Array c = p_data["connections"];
ERR_FAIL_COND(c.size() != p.size());
@@ -425,11 +425,11 @@ void PolygonPathFinder::_set_data(const Dictionary &p_data) {
int pc = p.size();
points.resize(pc + 2);
- PoolVector<Vector2>::Read pr = p.read();
+ const Vector2 *pr = p.ptr();
for (int i = 0; i < pc; i++) {
points.write[i].pos = pr[i];
- PoolVector<int> con = c[i];
- PoolVector<int>::Read cr = con.read();
+ Vector<int> con = c[i];
+ const int *cr = con.ptr();
int cc = con.size();
for (int j = 0; j < cc; j++) {
@@ -439,19 +439,19 @@ void PolygonPathFinder::_set_data(const Dictionary &p_data) {
if (p_data.has("penalties")) {
- PoolVector<float> penalties = p_data["penalties"];
+ Vector<float> penalties = p_data["penalties"];
if (penalties.size() == pc) {
- PoolVector<float>::Read pr2 = penalties.read();
+ const float *pr2 = penalties.ptr();
for (int i = 0; i < pc; i++) {
points.write[i].penalty = pr2[i];
}
}
}
- PoolVector<int> segs = p_data["segments"];
+ Vector<int> segs = p_data["segments"];
int sc = segs.size();
ERR_FAIL_COND(sc & 1);
- PoolVector<int>::Read sr = segs.read();
+ const int *sr = segs.ptr();
for (int i = 0; i < sc; i += 2) {
Edge e(sr[i], sr[i + 1]);
@@ -463,25 +463,25 @@ void PolygonPathFinder::_set_data(const Dictionary &p_data) {
Dictionary PolygonPathFinder::_get_data() const {
Dictionary d;
- PoolVector<Vector2> p;
- PoolVector<int> ind;
+ Vector<Vector2> p;
+ Vector<int> ind;
Array connections;
p.resize(MAX(0, points.size() - 2));
connections.resize(MAX(0, points.size() - 2));
ind.resize(edges.size() * 2);
- PoolVector<float> penalties;
+ Vector<float> penalties;
penalties.resize(MAX(0, points.size() - 2));
{
- PoolVector<Vector2>::Write wp = p.write();
- PoolVector<float>::Write pw = penalties.write();
+ Vector2 *wp = p.ptrw();
+ float *pw = penalties.ptrw();
for (int i = 0; i < points.size() - 2; i++) {
wp[i] = points[i].pos;
pw[i] = points[i].penalty;
- PoolVector<int> c;
+ Vector<int> c;
c.resize(points[i].connections.size());
{
- PoolVector<int>::Write cw = c.write();
+ int *cw = c.ptrw();
int idx = 0;
for (Set<int>::Element *E = points[i].connections.front(); E; E = E->next()) {
cw[idx++] = E->get();
@@ -492,7 +492,7 @@ Dictionary PolygonPathFinder::_get_data() const {
}
{
- PoolVector<int>::Write iw = ind.write();
+ int *iw = ind.ptrw();
int idx = 0;
for (Set<Edge>::Element *E = edges.front(); E; E = E->next()) {
iw[idx++] = E->get().points[0];
diff --git a/scene/resources/primitive_meshes.cpp b/scene/resources/primitive_meshes.cpp
index fa0ded12a1..00fc016ca1 100644
--- a/scene/resources/primitive_meshes.cpp
+++ b/scene/resources/primitive_meshes.cpp
@@ -40,7 +40,7 @@ void PrimitiveMesh::_update() const {
arr.resize(VS::ARRAY_MAX);
_create_mesh_array(arr);
- PoolVector<Vector3> points = arr[VS::ARRAY_VERTEX];
+ Vector<Vector3> points = arr[VS::ARRAY_VERTEX];
aabb = AABB();
@@ -48,7 +48,7 @@ void PrimitiveMesh::_update() const {
ERR_FAIL_COND(pc == 0);
{
- PoolVector<Vector3>::Read r = points.read();
+ const Vector3 *r = points.ptr();
for (int i = 0; i < pc; i++) {
if (i == 0)
aabb.position = r[i];
@@ -57,16 +57,16 @@ void PrimitiveMesh::_update() const {
}
}
- PoolVector<int> indices = arr[VS::ARRAY_INDEX];
+ Vector<int> indices = arr[VS::ARRAY_INDEX];
if (flip_faces) {
- PoolVector<Vector3> normals = arr[VS::ARRAY_NORMAL];
+ Vector<Vector3> normals = arr[VS::ARRAY_NORMAL];
if (normals.size() && indices.size()) {
{
int nc = normals.size();
- PoolVector<Vector3>::Write w = normals.write();
+ Vector3 *w = normals.ptrw();
for (int i = 0; i < nc; i++) {
w[i] = -w[i];
}
@@ -74,7 +74,7 @@ void PrimitiveMesh::_update() const {
{
int ic = indices.size();
- PoolVector<int>::Write w = indices.write();
+ int *w = indices.ptrw();
for (int i = 0; i < ic; i += 3) {
SWAP(w[i + 0], w[i + 1]);
}
@@ -282,11 +282,11 @@ void CapsuleMesh::_create_mesh_array(Array &p_arr) const {
// note, this has been aligned with our collision shape but I've left the descriptions as top/middle/bottom
- PoolVector<Vector3> points;
- PoolVector<Vector3> normals;
- PoolVector<float> tangents;
- PoolVector<Vector2> uvs;
- PoolVector<int> indices;
+ Vector<Vector3> points;
+ Vector<Vector3> normals;
+ Vector<float> tangents;
+ Vector<Vector2> uvs;
+ Vector<int> indices;
point = 0;
#define ADD_TANGENT(m_x, m_y, m_z, m_d) \
@@ -303,19 +303,19 @@ void CapsuleMesh::_create_mesh_array(Array &p_arr) const {
v /= (rings + 1);
w = sin(0.5 * Math_PI * v);
- z = radius * cos(0.5 * Math_PI * v);
+ y = radius * cos(0.5 * Math_PI * v);
for (i = 0; i <= radial_segments; i++) {
u = i;
u /= radial_segments;
- x = sin(u * (Math_PI * 2.0));
- y = -cos(u * (Math_PI * 2.0));
+ x = -sin(u * (Math_PI * 2.0));
+ z = cos(u * (Math_PI * 2.0));
- Vector3 p = Vector3(x * radius * w, y * radius * w, z);
- points.push_back(p + Vector3(0.0, 0.0, 0.5 * mid_height));
+ Vector3 p = Vector3(x * radius * w, y, -z * radius * w);
+ points.push_back(p + Vector3(0.0, 0.5 * mid_height, 0.0));
normals.push_back(p.normalized());
- ADD_TANGENT(-y, x, 0.0, 1.0)
+ ADD_TANGENT(z, 0.0, x, 1.0)
uvs.push_back(Vector2(u, v * onethird));
point++;
@@ -341,20 +341,20 @@ void CapsuleMesh::_create_mesh_array(Array &p_arr) const {
v = j;
v /= (rings + 1);
- z = mid_height * v;
- z = (mid_height * 0.5) - z;
+ y = mid_height * v;
+ y = (mid_height * 0.5) - y;
for (i = 0; i <= radial_segments; i++) {
u = i;
u /= radial_segments;
- x = sin(u * (Math_PI * 2.0));
- y = -cos(u * (Math_PI * 2.0));
+ x = -sin(u * (Math_PI * 2.0));
+ z = cos(u * (Math_PI * 2.0));
- Vector3 p = Vector3(x * radius, y * radius, z);
+ Vector3 p = Vector3(x * radius, y, -z * radius);
points.push_back(p);
- normals.push_back(Vector3(x, y, 0.0));
- ADD_TANGENT(-y, x, 0.0, 1.0)
+ normals.push_back(Vector3(x, 0.0, -z));
+ ADD_TANGENT(z, 0.0, x, 1.0)
uvs.push_back(Vector2(u, onethird + (v * onethird)));
point++;
@@ -382,19 +382,19 @@ void CapsuleMesh::_create_mesh_array(Array &p_arr) const {
v /= (rings + 1);
v += 1.0;
w = sin(0.5 * Math_PI * v);
- z = radius * cos(0.5 * Math_PI * v);
+ y = radius * cos(0.5 * Math_PI * v);
for (i = 0; i <= radial_segments; i++) {
float u2 = i;
u2 /= radial_segments;
- x = sin(u2 * (Math_PI * 2.0));
- y = -cos(u2 * (Math_PI * 2.0));
+ x = -sin(u2 * (Math_PI * 2.0));
+ z = cos(u2 * (Math_PI * 2.0));
- Vector3 p = Vector3(x * radius * w, y * radius * w, z);
- points.push_back(p + Vector3(0.0, 0.0, -0.5 * mid_height));
+ Vector3 p = Vector3(x * radius * w, y, -z * radius * w);
+ points.push_back(p + Vector3(0.0, -0.5 * mid_height, 0.0));
normals.push_back(p.normalized());
- ADD_TANGENT(-y, x, 0.0, 1.0)
+ ADD_TANGENT(z, 0.0, x, 1.0)
uvs.push_back(Vector2(u2, twothirds + ((v - 1.0) * onethird)));
point++;
@@ -431,8 +431,8 @@ void CapsuleMesh::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_rings", "rings"), &CapsuleMesh::set_rings);
ClassDB::bind_method(D_METHOD("get_rings"), &CapsuleMesh::get_rings);
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "radius", PROPERTY_HINT_RANGE, "0.001,100.0,0.001,or_greater"), "set_radius", "get_radius");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "mid_height", PROPERTY_HINT_RANGE, "0.001,100.0,0.001,or_greater"), "set_mid_height", "get_mid_height");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "radius", PROPERTY_HINT_RANGE, "0.001,100.0,0.001,or_greater"), "set_radius", "get_radius");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "mid_height", PROPERTY_HINT_RANGE, "0.001,100.0,0.001,or_greater"), "set_mid_height", "get_mid_height");
ADD_PROPERTY(PropertyInfo(Variant::INT, "radial_segments", PROPERTY_HINT_RANGE, "1,100,1,or_greater"), "set_radial_segments", "get_radial_segments");
ADD_PROPERTY(PropertyInfo(Variant::INT, "rings", PROPERTY_HINT_RANGE, "1,100,1,or_greater"), "set_rings", "get_rings");
}
@@ -495,11 +495,11 @@ void CubeMesh::_create_mesh_array(Array &p_arr) const {
// set our bounding box
- PoolVector<Vector3> points;
- PoolVector<Vector3> normals;
- PoolVector<float> tangents;
- PoolVector<Vector2> uvs;
- PoolVector<int> indices;
+ Vector<Vector3> points;
+ Vector<Vector3> normals;
+ Vector<float> tangents;
+ Vector<Vector2> uvs;
+ Vector<int> indices;
point = 0;
#define ADD_TANGENT(m_x, m_y, m_z, m_d) \
@@ -746,11 +746,11 @@ void CylinderMesh::_create_mesh_array(Array &p_arr) const {
int i, j, prevrow, thisrow, point;
float x, y, z, u, v, radius;
- PoolVector<Vector3> points;
- PoolVector<Vector3> normals;
- PoolVector<float> tangents;
- PoolVector<Vector2> uvs;
- PoolVector<int> indices;
+ Vector<Vector3> points;
+ Vector<Vector3> normals;
+ Vector<float> tangents;
+ Vector<Vector2> uvs;
+ Vector<int> indices;
point = 0;
#define ADD_TANGENT(m_x, m_y, m_z, m_d) \
@@ -891,9 +891,9 @@ void CylinderMesh::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_rings", "rings"), &CylinderMesh::set_rings);
ClassDB::bind_method(D_METHOD("get_rings"), &CylinderMesh::get_rings);
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "top_radius", PROPERTY_HINT_RANGE, "0.001,100.0,0.001,or_greater"), "set_top_radius", "get_top_radius");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "bottom_radius", PROPERTY_HINT_RANGE, "0.001,100.0,0.001,or_greater"), "set_bottom_radius", "get_bottom_radius");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "height", PROPERTY_HINT_RANGE, "0.001,100.0,0.001,or_greater"), "set_height", "get_height");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "top_radius", PROPERTY_HINT_RANGE, "0.001,100.0,0.001,or_greater"), "set_top_radius", "get_top_radius");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "bottom_radius", PROPERTY_HINT_RANGE, "0.001,100.0,0.001,or_greater"), "set_bottom_radius", "get_bottom_radius");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "height", PROPERTY_HINT_RANGE, "0.001,100.0,0.001,or_greater"), "set_height", "get_height");
ADD_PROPERTY(PropertyInfo(Variant::INT, "radial_segments", PROPERTY_HINT_RANGE, "1,100,1,or_greater"), "set_radial_segments", "get_radial_segments");
ADD_PROPERTY(PropertyInfo(Variant::INT, "rings", PROPERTY_HINT_RANGE, "1,100,1,or_greater"), "set_rings", "get_rings");
}
@@ -962,11 +962,11 @@ void PlaneMesh::_create_mesh_array(Array &p_arr) const {
Size2 start_pos = size * -0.5;
- PoolVector<Vector3> points;
- PoolVector<Vector3> normals;
- PoolVector<float> tangents;
- PoolVector<Vector2> uvs;
- PoolVector<int> indices;
+ Vector<Vector3> points;
+ Vector<Vector3> normals;
+ Vector<float> tangents;
+ Vector<Vector2> uvs;
+ Vector<int> indices;
point = 0;
#define ADD_TANGENT(m_x, m_y, m_z, m_d) \
@@ -1079,11 +1079,11 @@ void PrismMesh::_create_mesh_array(Array &p_arr) const {
// set our bounding box
- PoolVector<Vector3> points;
- PoolVector<Vector3> normals;
- PoolVector<float> tangents;
- PoolVector<Vector2> uvs;
- PoolVector<int> indices;
+ Vector<Vector3> points;
+ Vector<Vector3> normals;
+ Vector<float> tangents;
+ Vector<Vector2> uvs;
+ Vector<int> indices;
point = 0;
#define ADD_TANGENT(m_x, m_y, m_z, m_d) \
@@ -1291,7 +1291,7 @@ void PrismMesh::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_subdivide_depth", "segments"), &PrismMesh::set_subdivide_depth);
ClassDB::bind_method(D_METHOD("get_subdivide_depth"), &PrismMesh::get_subdivide_depth);
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "left_to_right", PROPERTY_HINT_RANGE, "-2.0,2.0,0.1"), "set_left_to_right", "get_left_to_right");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "left_to_right", PROPERTY_HINT_RANGE, "-2.0,2.0,0.1"), "set_left_to_right", "get_left_to_right");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "size"), "set_size", "get_size");
ADD_PROPERTY(PropertyInfo(Variant::INT, "subdivide_width", PROPERTY_HINT_RANGE, "0,100,1,or_greater"), "set_subdivide_width", "get_subdivide_width");
ADD_PROPERTY(PropertyInfo(Variant::INT, "subdivide_height", PROPERTY_HINT_RANGE, "0,100,1,or_greater"), "set_subdivide_height", "get_subdivide_height");
@@ -1357,10 +1357,10 @@ PrismMesh::PrismMesh() {
*/
void QuadMesh::_create_mesh_array(Array &p_arr) const {
- PoolVector<Vector3> faces;
- PoolVector<Vector3> normals;
- PoolVector<float> tangents;
- PoolVector<Vector2> uvs;
+ Vector<Vector3> faces;
+ Vector<Vector3> normals;
+ Vector<float> tangents;
+ Vector<Vector2> uvs;
faces.resize(6);
normals.resize(6);
@@ -1437,11 +1437,11 @@ void SphereMesh::_create_mesh_array(Array &p_arr) const {
// set our bounding box
- PoolVector<Vector3> points;
- PoolVector<Vector3> normals;
- PoolVector<float> tangents;
- PoolVector<Vector2> uvs;
- PoolVector<int> indices;
+ Vector<Vector3> points;
+ Vector<Vector3> normals;
+ Vector<float> tangents;
+ Vector<Vector2> uvs;
+ Vector<int> indices;
point = 0;
#define ADD_TANGENT(m_x, m_y, m_z, m_d) \
@@ -1515,8 +1515,8 @@ void SphereMesh::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_is_hemisphere", "is_hemisphere"), &SphereMesh::set_is_hemisphere);
ClassDB::bind_method(D_METHOD("get_is_hemisphere"), &SphereMesh::get_is_hemisphere);
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "radius", PROPERTY_HINT_RANGE, "0.001,100.0,0.001,or_greater"), "set_radius", "get_radius");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "height", PROPERTY_HINT_RANGE, "0.001,100.0,0.001,or_greater"), "set_height", "get_height");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "radius", PROPERTY_HINT_RANGE, "0.001,100.0,0.001,or_greater"), "set_radius", "get_radius");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "height", PROPERTY_HINT_RANGE, "0.001,100.0,0.001,or_greater"), "set_height", "get_height");
ADD_PROPERTY(PropertyInfo(Variant::INT, "radial_segments", PROPERTY_HINT_RANGE, "1,100,1,or_greater"), "set_radial_segments", "get_radial_segments");
ADD_PROPERTY(PropertyInfo(Variant::INT, "rings", PROPERTY_HINT_RANGE, "1,100,1,or_greater"), "set_rings", "get_rings");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "is_hemisphere"), "set_is_hemisphere", "get_is_hemisphere");
@@ -1581,7 +1581,7 @@ SphereMesh::SphereMesh() {
*/
void PointMesh::_create_mesh_array(Array &p_arr) const {
- PoolVector<Vector3> faces;
+ Vector<Vector3> faces;
faces.resize(1);
faces.set(0, Vector3(0.0, 0.0, 0.0));
diff --git a/scene/resources/ray_shape.cpp b/scene/resources/ray_shape.cpp
index 1a9b7e6dd2..906abaf60c 100644
--- a/scene/resources/ray_shape.cpp
+++ b/scene/resources/ray_shape.cpp
@@ -87,7 +87,7 @@ void RayShape::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_slips_on_slope", "active"), &RayShape::set_slips_on_slope);
ClassDB::bind_method(D_METHOD("get_slips_on_slope"), &RayShape::get_slips_on_slope);
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "length", PROPERTY_HINT_RANGE, "0,4096,0.01"), "set_length", "get_length");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "length", PROPERTY_HINT_RANGE, "0,4096,0.01"), "set_length", "get_length");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "slips_on_slope"), "set_slips_on_slope", "get_slips_on_slope");
}
diff --git a/scene/resources/resource_format_text.cpp b/scene/resources/resource_format_text.cpp
index 9779f9c9ca..956cc0bc4a 100644
--- a/scene/resources/resource_format_text.cpp
+++ b/scene/resources/resource_format_text.cpp
@@ -35,7 +35,7 @@
#include "core/project_settings.h"
#include "core/version.h"
-//version 2: changed names for basis, aabb, poolvectors, etc.
+//version 2: changed names for basis, aabb, Vectors, etc.
#define FORMAT_VERSION 2
#include "core/os/dir_access.h"
@@ -1377,7 +1377,7 @@ void ResourceFormatSaverTextInstance::_find_resources(const Variant &p_variant,
switch (p_variant.get_type()) {
case Variant::OBJECT: {
- RES res = p_variant.operator RefPtr();
+ RES res = p_variant;
if (res.is_null() || external_resources.has(res))
return;
diff --git a/scene/resources/segment_shape_2d.cpp b/scene/resources/segment_shape_2d.cpp
index 3094d0f9bd..2e78a4fccf 100644
--- a/scene/resources/segment_shape_2d.cpp
+++ b/scene/resources/segment_shape_2d.cpp
@@ -154,7 +154,7 @@ void RayShape2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_slips_on_slope", "active"), &RayShape2D::set_slips_on_slope);
ClassDB::bind_method(D_METHOD("get_slips_on_slope"), &RayShape2D::get_slips_on_slope);
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "length"), "set_length", "get_length");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "length"), "set_length", "get_length");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "slips_on_slope"), "set_slips_on_slope", "get_slips_on_slope");
}
diff --git a/scene/resources/shape.cpp b/scene/resources/shape.cpp
index b50c68727a..4a6da18f2b 100644
--- a/scene/resources/shape.cpp
+++ b/scene/resources/shape.cpp
@@ -35,7 +35,7 @@
#include "scene/resources/mesh.h"
#include "servers/physics_server.h"
-void Shape::add_vertices_to_array(PoolVector<Vector3> &array, const Transform &p_xform) {
+void Shape::add_vertices_to_array(Vector<Vector3> &array, const Transform &p_xform) {
Vector<Vector3> toadd = get_debug_mesh_lines();
@@ -43,7 +43,7 @@ void Shape::add_vertices_to_array(PoolVector<Vector3> &array, const Transform &p
int base = array.size();
array.resize(base + toadd.size());
- PoolVector<Vector3>::Write w = array.write();
+ Vector3 *w = array.ptrw();
for (int i = 0; i < toadd.size(); i++) {
w[i + base] = p_xform.xform(toadd[i]);
}
@@ -70,11 +70,11 @@ Ref<ArrayMesh> Shape::get_debug_mesh() {
if (!lines.empty()) {
//make mesh
- PoolVector<Vector3> array;
+ Vector<Vector3> array;
array.resize(lines.size());
{
- PoolVector<Vector3>::Write w = array.write();
+ Vector3 *w = array.ptrw();
for (int i = 0; i < lines.size(); i++) {
w[i] = lines[i];
}
@@ -106,7 +106,7 @@ void Shape::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_margin", "margin"), &Shape::set_margin);
ClassDB::bind_method(D_METHOD("get_margin"), &Shape::get_margin);
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "margin", PROPERTY_HINT_RANGE, "0.001,10,0.001"), "set_margin", "get_margin");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "margin", PROPERTY_HINT_RANGE, "0.001,10,0.001"), "set_margin", "get_margin");
}
Shape::Shape() :
diff --git a/scene/resources/shape.h b/scene/resources/shape.h
index 227a581c96..e5ccbf7e28 100644
--- a/scene/resources/shape.h
+++ b/scene/resources/shape.h
@@ -61,7 +61,7 @@ public:
/// Returns the radius of a sphere that fully enclose this shape
virtual real_t get_enclosing_radius() const = 0;
- void add_vertices_to_array(PoolVector<Vector3> &array, const Transform &p_xform);
+ void add_vertices_to_array(Vector<Vector3> &array, const Transform &p_xform);
real_t get_margin() const;
void set_margin(real_t p_margin);
diff --git a/scene/resources/shape_2d.cpp b/scene/resources/shape_2d.cpp
index 9e97c65a3c..64930c3117 100644
--- a/scene/resources/shape_2d.cpp
+++ b/scene/resources/shape_2d.cpp
@@ -105,7 +105,7 @@ void Shape2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("collide_and_get_contacts", "local_xform", "with_shape", "shape_xform"), &Shape2D::collide_and_get_contacts);
ClassDB::bind_method(D_METHOD("collide_with_motion_and_get_contacts", "local_xform", "local_motion", "with_shape", "shape_xform", "shape_motion"), &Shape2D::collide_with_motion_and_get_contacts);
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "custom_solver_bias", PROPERTY_HINT_RANGE, "0,1,0.001"), "set_custom_solver_bias", "get_custom_solver_bias");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "custom_solver_bias", PROPERTY_HINT_RANGE, "0,1,0.001"), "set_custom_solver_bias", "get_custom_solver_bias");
}
Shape2D::Shape2D(const RID &p_rid) {
diff --git a/scene/resources/skin.cpp b/scene/resources/skin.cpp
index 9c8710a59c..df0620b6c4 100644
--- a/scene/resources/skin.cpp
+++ b/scene/resources/skin.cpp
@@ -45,6 +45,24 @@ void Skin::add_bind(int p_bone, const Transform &p_pose) {
set_bind_pose(index, p_pose);
}
+void Skin::add_named_bind(const String &p_name, const Transform &p_pose) {
+
+ uint32_t index = bind_count;
+ set_bind_count(bind_count + 1);
+ set_bind_name(index, p_name);
+ set_bind_pose(index, p_pose);
+}
+
+void Skin::set_bind_name(int p_index, const StringName &p_name) {
+ ERR_FAIL_INDEX(p_index, bind_count);
+ bool notify_change = (binds_ptr[p_index].name != StringName()) != (p_name != StringName());
+ binds_ptr[p_index].name = p_name;
+ emit_changed();
+ if (notify_change) {
+ _change_notify();
+ }
+}
+
void Skin::set_bind_bone(int p_index, int p_bone) {
ERR_FAIL_INDEX(p_index, bind_count);
binds_ptr[p_index].bone = p_bone;
@@ -75,6 +93,9 @@ bool Skin::_set(const StringName &p_name, const Variant &p_value) {
if (what == "bone") {
set_bind_bone(index, p_value);
return true;
+ } else if (what == "name") {
+ set_bind_name(index, p_value);
+ return true;
} else if (what == "pose") {
set_bind_pose(index, p_value);
return true;
@@ -95,6 +116,9 @@ bool Skin::_get(const StringName &p_name, Variant &r_ret) const {
if (what == "bone") {
r_ret = get_bind_bone(index);
return true;
+ } else if (what == "name") {
+ r_ret = get_bind_name(index);
+ return true;
} else if (what == "pose") {
r_ret = get_bind_pose(index);
return true;
@@ -105,7 +129,8 @@ bool Skin::_get(const StringName &p_name, Variant &r_ret) const {
void Skin::_get_property_list(List<PropertyInfo> *p_list) const {
p_list->push_back(PropertyInfo(Variant::INT, "bind_count", PROPERTY_HINT_RANGE, "0,16384,1,or_greater"));
for (int i = 0; i < get_bind_count(); i++) {
- p_list->push_back(PropertyInfo(Variant::INT, "bind/" + itos(i) + "/bone", PROPERTY_HINT_RANGE, "0,16384,1,or_greater"));
+ p_list->push_back(PropertyInfo(Variant::STRING_NAME, "bind/" + itos(i) + "/name"));
+ p_list->push_back(PropertyInfo(Variant::INT, "bind/" + itos(i) + "/bone", PROPERTY_HINT_RANGE, "0,16384,1,or_greater", get_bind_name(i) != StringName() ? PROPERTY_USAGE_NOEDITOR : PROPERTY_USAGE_DEFAULT));
p_list->push_back(PropertyInfo(Variant::TRANSFORM, "bind/" + itos(i) + "/pose"));
}
}
@@ -120,6 +145,9 @@ void Skin::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_bind_pose", "bind_index", "pose"), &Skin::set_bind_pose);
ClassDB::bind_method(D_METHOD("get_bind_pose", "bind_index"), &Skin::get_bind_pose);
+ ClassDB::bind_method(D_METHOD("set_bind_name", "bind_index", "name"), &Skin::set_bind_name);
+ ClassDB::bind_method(D_METHOD("get_bind_name", "bind_index"), &Skin::get_bind_name);
+
ClassDB::bind_method(D_METHOD("set_bind_bone", "bind_index", "bone"), &Skin::set_bind_bone);
ClassDB::bind_method(D_METHOD("get_bind_bone", "bind_index"), &Skin::get_bind_bone);
diff --git a/scene/resources/skin.h b/scene/resources/skin.h
index ddc7c655f5..57aaf1afd4 100644
--- a/scene/resources/skin.h
+++ b/scene/resources/skin.h
@@ -37,7 +37,8 @@ class Skin : public Resource {
GDCLASS(Skin, Resource)
struct Bind {
- int bone;
+ int bone = -1;
+ StringName name;
Transform pose;
};
@@ -58,9 +59,11 @@ public:
inline int get_bind_count() const { return bind_count; }
void add_bind(int p_bone, const Transform &p_pose);
+ void add_named_bind(const String &p_name, const Transform &p_pose);
void set_bind_bone(int p_index, int p_bone);
void set_bind_pose(int p_index, const Transform &p_pose);
+ void set_bind_name(int p_index, const StringName &p_name);
inline int get_bind_bone(int p_index) const {
#ifdef DEBUG_ENABLED
@@ -69,6 +72,13 @@ public:
return binds_ptr[p_index].bone;
}
+ inline StringName get_bind_name(int p_index) const {
+#ifdef DEBUG_ENABLED
+ ERR_FAIL_INDEX_V(p_index, bind_count, StringName());
+#endif
+ return binds_ptr[p_index].name;
+ }
+
inline Transform get_bind_pose(int p_index) const {
#ifdef DEBUG_ENABLED
ERR_FAIL_INDEX_V(p_index, bind_count, Transform());
diff --git a/scene/resources/sky.cpp b/scene/resources/sky.cpp
index 3e797a7bde..54648e8af7 100644
--- a/scene/resources/sky.cpp
+++ b/scene/resources/sky.cpp
@@ -130,7 +130,7 @@ Ref<Image> ProceduralSky::_generate_sky() {
update_queued = false;
- PoolVector<uint8_t> imgdata;
+ Vector<uint8_t> imgdata;
static const int size[TEXTURE_SIZE_MAX] = {
256, 512, 1024, 2048, 4096
@@ -142,9 +142,9 @@ Ref<Image> ProceduralSky::_generate_sky() {
imgdata.resize(w * h * 4); //RGBE
{
- PoolVector<uint8_t>::Write dataw = imgdata.write();
+ uint8_t *dataw = imgdata.ptrw();
- uint32_t *ptr = (uint32_t *)dataw.ptr();
+ uint32_t *ptr = (uint32_t *)dataw;
Color sky_top_linear = sky_top_color.to_linear();
Color sky_horizon_linear = sky_horizon_color.to_linear();
@@ -509,23 +509,23 @@ void ProceduralSky::_bind_methods() {
ADD_GROUP("Sky", "sky_");
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "sky_top_color"), "set_sky_top_color", "get_sky_top_color");
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "sky_horizon_color"), "set_sky_horizon_color", "get_sky_horizon_color");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "sky_curve", PROPERTY_HINT_EXP_EASING), "set_sky_curve", "get_sky_curve");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "sky_energy", PROPERTY_HINT_RANGE, "0,64,0.01"), "set_sky_energy", "get_sky_energy");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "sky_curve", PROPERTY_HINT_EXP_EASING), "set_sky_curve", "get_sky_curve");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "sky_energy", PROPERTY_HINT_RANGE, "0,64,0.01"), "set_sky_energy", "get_sky_energy");
ADD_GROUP("Ground", "ground_");
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "ground_bottom_color"), "set_ground_bottom_color", "get_ground_bottom_color");
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "ground_horizon_color"), "set_ground_horizon_color", "get_ground_horizon_color");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "ground_curve", PROPERTY_HINT_EXP_EASING), "set_ground_curve", "get_ground_curve");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "ground_energy", PROPERTY_HINT_RANGE, "0,64,0.01"), "set_ground_energy", "get_ground_energy");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "ground_curve", PROPERTY_HINT_EXP_EASING), "set_ground_curve", "get_ground_curve");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "ground_energy", PROPERTY_HINT_RANGE, "0,64,0.01"), "set_ground_energy", "get_ground_energy");
ADD_GROUP("Sun", "sun_");
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "sun_color"), "set_sun_color", "get_sun_color");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "sun_latitude", PROPERTY_HINT_RANGE, "-180,180,0.01"), "set_sun_latitude", "get_sun_latitude");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "sun_longitude", PROPERTY_HINT_RANGE, "-180,180,0.01"), "set_sun_longitude", "get_sun_longitude");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "sun_angle_min", PROPERTY_HINT_RANGE, "0,360,0.01"), "set_sun_angle_min", "get_sun_angle_min");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "sun_angle_max", PROPERTY_HINT_RANGE, "0,360,0.01"), "set_sun_angle_max", "get_sun_angle_max");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "sun_curve", PROPERTY_HINT_EXP_EASING), "set_sun_curve", "get_sun_curve");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "sun_energy", PROPERTY_HINT_RANGE, "0,64,0.01"), "set_sun_energy", "get_sun_energy");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "sun_latitude", PROPERTY_HINT_RANGE, "-180,180,0.01"), "set_sun_latitude", "get_sun_latitude");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "sun_longitude", PROPERTY_HINT_RANGE, "-180,180,0.01"), "set_sun_longitude", "get_sun_longitude");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "sun_angle_min", PROPERTY_HINT_RANGE, "0,360,0.01"), "set_sun_angle_min", "get_sun_angle_min");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "sun_angle_max", PROPERTY_HINT_RANGE, "0,360,0.01"), "set_sun_angle_max", "get_sun_angle_max");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "sun_curve", PROPERTY_HINT_EXP_EASING), "set_sun_curve", "get_sun_curve");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "sun_energy", PROPERTY_HINT_RANGE, "0,64,0.01"), "set_sun_energy", "get_sun_energy");
ADD_GROUP("Texture2D", "texture_");
ADD_PROPERTY(PropertyInfo(Variant::INT, "texture_size", PROPERTY_HINT_ENUM, "256,512,1024,2048,4096"), "set_texture_size", "get_texture_size");
diff --git a/scene/resources/sphere_shape.cpp b/scene/resources/sphere_shape.cpp
index 56121b6941..825708d1e2 100644
--- a/scene/resources/sphere_shape.cpp
+++ b/scene/resources/sphere_shape.cpp
@@ -83,7 +83,7 @@ void SphereShape::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_radius", "radius"), &SphereShape::set_radius);
ClassDB::bind_method(D_METHOD("get_radius"), &SphereShape::get_radius);
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "radius", PROPERTY_HINT_RANGE, "0,4096,0.01"), "set_radius", "get_radius");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "radius", PROPERTY_HINT_RANGE, "0,4096,0.01"), "set_radius", "get_radius");
}
SphereShape::SphereShape() :
diff --git a/scene/resources/style_box.cpp b/scene/resources/style_box.cpp
index 1766b531d5..119cbcd098 100644
--- a/scene/resources/style_box.cpp
+++ b/scene/resources/style_box.cpp
@@ -104,10 +104,10 @@ void StyleBox::_bind_methods() {
ClassDB::bind_method(D_METHOD("draw", "canvas_item", "rect"), &StyleBox::draw);
ADD_GROUP("Content Margin", "content_margin_");
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "content_margin_left", PROPERTY_HINT_RANGE, "-1,2048,1"), "set_default_margin", "get_default_margin", MARGIN_LEFT);
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "content_margin_right", PROPERTY_HINT_RANGE, "-1,2048,1"), "set_default_margin", "get_default_margin", MARGIN_RIGHT);
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "content_margin_top", PROPERTY_HINT_RANGE, "-1,2048,1"), "set_default_margin", "get_default_margin", MARGIN_TOP);
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "content_margin_bottom", PROPERTY_HINT_RANGE, "-1,2048,1"), "set_default_margin", "get_default_margin", MARGIN_BOTTOM);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "content_margin_left", PROPERTY_HINT_RANGE, "-1,2048,1"), "set_default_margin", "get_default_margin", MARGIN_LEFT);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "content_margin_right", PROPERTY_HINT_RANGE, "-1,2048,1"), "set_default_margin", "get_default_margin", MARGIN_RIGHT);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "content_margin_top", PROPERTY_HINT_RANGE, "-1,2048,1"), "set_default_margin", "get_default_margin", MARGIN_TOP);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "content_margin_bottom", PROPERTY_HINT_RANGE, "-1,2048,1"), "set_default_margin", "get_default_margin", MARGIN_BOTTOM);
}
StyleBox::StyleBox() {
@@ -339,15 +339,15 @@ void StyleBoxTexture::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "normal_map", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_normal_map", "get_normal_map");
ADD_PROPERTY(PropertyInfo(Variant::RECT2, "region_rect"), "set_region_rect", "get_region_rect");
ADD_GROUP("Margin", "margin_");
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "margin_left", PROPERTY_HINT_RANGE, "0,2048,1"), "set_margin_size", "get_margin_size", MARGIN_LEFT);
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "margin_right", PROPERTY_HINT_RANGE, "0,2048,1"), "set_margin_size", "get_margin_size", MARGIN_RIGHT);
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "margin_top", PROPERTY_HINT_RANGE, "0,2048,1"), "set_margin_size", "get_margin_size", MARGIN_TOP);
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "margin_bottom", PROPERTY_HINT_RANGE, "0,2048,1"), "set_margin_size", "get_margin_size", MARGIN_BOTTOM);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "margin_left", PROPERTY_HINT_RANGE, "0,2048,1"), "set_margin_size", "get_margin_size", MARGIN_LEFT);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "margin_right", PROPERTY_HINT_RANGE, "0,2048,1"), "set_margin_size", "get_margin_size", MARGIN_RIGHT);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "margin_top", PROPERTY_HINT_RANGE, "0,2048,1"), "set_margin_size", "get_margin_size", MARGIN_TOP);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "margin_bottom", PROPERTY_HINT_RANGE, "0,2048,1"), "set_margin_size", "get_margin_size", MARGIN_BOTTOM);
ADD_GROUP("Expand Margin", "expand_margin_");
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "expand_margin_left", PROPERTY_HINT_RANGE, "0,2048,1"), "set_expand_margin_size", "get_expand_margin_size", MARGIN_LEFT);
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "expand_margin_right", PROPERTY_HINT_RANGE, "0,2048,1"), "set_expand_margin_size", "get_expand_margin_size", MARGIN_RIGHT);
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "expand_margin_top", PROPERTY_HINT_RANGE, "0,2048,1"), "set_expand_margin_size", "get_expand_margin_size", MARGIN_TOP);
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "expand_margin_bottom", PROPERTY_HINT_RANGE, "0,2048,1"), "set_expand_margin_size", "get_expand_margin_size", MARGIN_BOTTOM);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "expand_margin_left", PROPERTY_HINT_RANGE, "0,2048,1"), "set_expand_margin_size", "get_expand_margin_size", MARGIN_LEFT);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "expand_margin_right", PROPERTY_HINT_RANGE, "0,2048,1"), "set_expand_margin_size", "get_expand_margin_size", MARGIN_RIGHT);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "expand_margin_top", PROPERTY_HINT_RANGE, "0,2048,1"), "set_expand_margin_size", "get_expand_margin_size", MARGIN_TOP);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "expand_margin_bottom", PROPERTY_HINT_RANGE, "0,2048,1"), "set_expand_margin_size", "get_expand_margin_size", MARGIN_BOTTOM);
ADD_GROUP("Axis Stretch", "axis_stretch_");
ADD_PROPERTY(PropertyInfo(Variant::INT, "axis_stretch_horizontal", PROPERTY_HINT_ENUM, "Stretch,Tile,Tile Fit"), "set_h_axis_stretch_mode", "get_h_axis_stretch_mode");
ADD_PROPERTY(PropertyInfo(Variant::INT, "axis_stretch_vertical", PROPERTY_HINT_ENUM, "Stretch,Tile,Tile Fit"), "set_v_axis_stretch_mode", "get_v_axis_stretch_mode");
@@ -933,10 +933,10 @@ void StyleBoxFlat::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "corner_detail", PROPERTY_HINT_RANGE, "1,20,1"), "set_corner_detail", "get_corner_detail");
ADD_GROUP("Expand Margin", "expand_margin_");
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "expand_margin_left", PROPERTY_HINT_RANGE, "0,2048,1"), "set_expand_margin", "get_expand_margin", MARGIN_LEFT);
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "expand_margin_right", PROPERTY_HINT_RANGE, "0,2048,1"), "set_expand_margin", "get_expand_margin", MARGIN_RIGHT);
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "expand_margin_top", PROPERTY_HINT_RANGE, "0,2048,1"), "set_expand_margin", "get_expand_margin", MARGIN_TOP);
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "expand_margin_bottom", PROPERTY_HINT_RANGE, "0,2048,1"), "set_expand_margin", "get_expand_margin", MARGIN_BOTTOM);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "expand_margin_left", PROPERTY_HINT_RANGE, "0,2048,1"), "set_expand_margin", "get_expand_margin", MARGIN_LEFT);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "expand_margin_right", PROPERTY_HINT_RANGE, "0,2048,1"), "set_expand_margin", "get_expand_margin", MARGIN_RIGHT);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "expand_margin_top", PROPERTY_HINT_RANGE, "0,2048,1"), "set_expand_margin", "get_expand_margin", MARGIN_TOP);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "expand_margin_bottom", PROPERTY_HINT_RANGE, "0,2048,1"), "set_expand_margin", "get_expand_margin", MARGIN_BOTTOM);
ADD_GROUP("Shadow", "shadow_");
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "shadow_color"), "set_shadow_color", "get_shadow_color");
@@ -1035,8 +1035,8 @@ void StyleBoxLine::_bind_methods() {
ClassDB::bind_method(D_METHOD("is_vertical"), &StyleBoxLine::is_vertical);
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "color"), "set_color", "get_color");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "grow_begin", PROPERTY_HINT_RANGE, "-300,300,1"), "set_grow_begin", "get_grow_begin");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "grow_end", PROPERTY_HINT_RANGE, "-300,300,1"), "set_grow_end", "get_grow_end");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "grow_begin", PROPERTY_HINT_RANGE, "-300,300,1"), "set_grow_begin", "get_grow_begin");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "grow_end", PROPERTY_HINT_RANGE, "-300,300,1"), "set_grow_end", "get_grow_end");
ADD_PROPERTY(PropertyInfo(Variant::INT, "thickness", PROPERTY_HINT_RANGE, "0,10"), "set_thickness", "get_thickness");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "vertical"), "set_vertical", "is_vertical");
}
diff --git a/scene/resources/surface_tool.cpp b/scene/resources/surface_tool.cpp
index a1e6430255..fa177d03fb 100644
--- a/scene/resources/surface_tool.cpp
+++ b/scene/resources/surface_tool.cpp
@@ -288,9 +288,9 @@ Array SurfaceTool::commit_to_arrays() {
case Mesh::ARRAY_VERTEX:
case Mesh::ARRAY_NORMAL: {
- PoolVector<Vector3> array;
+ Vector<Vector3> array;
array.resize(varr_len);
- PoolVector<Vector3>::Write w = array.write();
+ Vector3 *w = array.ptrw();
int idx = 0;
for (List<Vertex>::Element *E = vertex_array.front(); E; E = E->next(), idx++) {
@@ -307,7 +307,6 @@ Array SurfaceTool::commit_to_arrays() {
}
}
- w.release();
a[i] = array;
} break;
@@ -315,9 +314,9 @@ Array SurfaceTool::commit_to_arrays() {
case Mesh::ARRAY_TEX_UV:
case Mesh::ARRAY_TEX_UV2: {
- PoolVector<Vector2> array;
+ Vector<Vector2> array;
array.resize(varr_len);
- PoolVector<Vector2>::Write w = array.write();
+ Vector2 *w = array.ptrw();
int idx = 0;
for (List<Vertex>::Element *E = vertex_array.front(); E; E = E->next(), idx++) {
@@ -335,14 +334,13 @@ Array SurfaceTool::commit_to_arrays() {
}
}
- w.release();
a[i] = array;
} break;
case Mesh::ARRAY_TANGENT: {
- PoolVector<float> array;
+ Vector<float> array;
array.resize(varr_len * 4);
- PoolVector<float>::Write w = array.write();
+ float *w = array.ptrw();
int idx = 0;
for (List<Vertex>::Element *E = vertex_array.front(); E; E = E->next(), idx += 4) {
@@ -358,15 +356,14 @@ Array SurfaceTool::commit_to_arrays() {
w[idx + 3] = d < 0 ? -1 : 1;
}
- w.release();
a[i] = array;
} break;
case Mesh::ARRAY_COLOR: {
- PoolVector<Color> array;
+ Vector<Color> array;
array.resize(varr_len);
- PoolVector<Color>::Write w = array.write();
+ Color *w = array.ptrw();
int idx = 0;
for (List<Vertex>::Element *E = vertex_array.front(); E; E = E->next(), idx++) {
@@ -375,14 +372,13 @@ Array SurfaceTool::commit_to_arrays() {
w[idx] = v.color;
}
- w.release();
a[i] = array;
} break;
case Mesh::ARRAY_BONES: {
- PoolVector<int> array;
+ Vector<int> array;
array.resize(varr_len * 4);
- PoolVector<int>::Write w = array.write();
+ int *w = array.ptrw();
int idx = 0;
for (List<Vertex>::Element *E = vertex_array.front(); E; E = E->next(), idx += 4) {
@@ -396,15 +392,14 @@ Array SurfaceTool::commit_to_arrays() {
}
}
- w.release();
a[i] = array;
} break;
case Mesh::ARRAY_WEIGHTS: {
- PoolVector<float> array;
+ Vector<float> array;
array.resize(varr_len * 4);
- PoolVector<float>::Write w = array.write();
+ float *w = array.ptrw();
int idx = 0;
for (List<Vertex>::Element *E = vertex_array.front(); E; E = E->next(), idx += 4) {
@@ -418,7 +413,6 @@ Array SurfaceTool::commit_to_arrays() {
}
}
- w.release();
a[i] = array;
} break;
@@ -426,9 +420,9 @@ Array SurfaceTool::commit_to_arrays() {
ERR_CONTINUE(index_array.size() == 0);
- PoolVector<int> array;
+ Vector<int> array;
array.resize(index_array.size());
- PoolVector<int>::Write w = array.write();
+ int *w = array.ptrw();
int idx = 0;
for (List<int>::Element *E = index_array.front(); E; E = E->next(), idx++) {
@@ -436,8 +430,6 @@ Array SurfaceTool::commit_to_arrays() {
w[idx] = E->get();
}
- w.release();
-
a[i] = array;
} break;
@@ -535,68 +527,46 @@ Vector<SurfaceTool::Vertex> SurfaceTool::create_vertex_array_from_triangle_array
Vector<SurfaceTool::Vertex> ret;
- PoolVector<Vector3> varr = p_arrays[VS::ARRAY_VERTEX];
- PoolVector<Vector3> narr = p_arrays[VS::ARRAY_NORMAL];
- PoolVector<float> tarr = p_arrays[VS::ARRAY_TANGENT];
- PoolVector<Color> carr = p_arrays[VS::ARRAY_COLOR];
- PoolVector<Vector2> uvarr = p_arrays[VS::ARRAY_TEX_UV];
- PoolVector<Vector2> uv2arr = p_arrays[VS::ARRAY_TEX_UV2];
- PoolVector<int> barr = p_arrays[VS::ARRAY_BONES];
- PoolVector<float> warr = p_arrays[VS::ARRAY_WEIGHTS];
+ Vector<Vector3> varr = p_arrays[VS::ARRAY_VERTEX];
+ Vector<Vector3> narr = p_arrays[VS::ARRAY_NORMAL];
+ Vector<float> tarr = p_arrays[VS::ARRAY_TANGENT];
+ Vector<Color> carr = p_arrays[VS::ARRAY_COLOR];
+ Vector<Vector2> uvarr = p_arrays[VS::ARRAY_TEX_UV];
+ Vector<Vector2> uv2arr = p_arrays[VS::ARRAY_TEX_UV2];
+ Vector<int> barr = p_arrays[VS::ARRAY_BONES];
+ Vector<float> warr = p_arrays[VS::ARRAY_WEIGHTS];
int vc = varr.size();
-
if (vc == 0)
return ret;
- int lformat = 0;
- PoolVector<Vector3>::Read rv;
+ int lformat = 0;
if (varr.size()) {
lformat |= VS::ARRAY_FORMAT_VERTEX;
- rv = varr.read();
}
- PoolVector<Vector3>::Read rn;
if (narr.size()) {
lformat |= VS::ARRAY_FORMAT_NORMAL;
- rn = narr.read();
}
- PoolVector<float>::Read rt;
if (tarr.size()) {
lformat |= VS::ARRAY_FORMAT_TANGENT;
- rt = tarr.read();
}
- PoolVector<Color>::Read rc;
if (carr.size()) {
lformat |= VS::ARRAY_FORMAT_COLOR;
- rc = carr.read();
}
-
- PoolVector<Vector2>::Read ruv;
if (uvarr.size()) {
lformat |= VS::ARRAY_FORMAT_TEX_UV;
- ruv = uvarr.read();
}
-
- PoolVector<Vector2>::Read ruv2;
if (uv2arr.size()) {
lformat |= VS::ARRAY_FORMAT_TEX_UV2;
- ruv2 = uv2arr.read();
}
-
- PoolVector<int>::Read rb;
if (barr.size()) {
lformat |= VS::ARRAY_FORMAT_BONES;
- rb = barr.read();
}
-
- PoolVector<float>::Read rw;
if (warr.size()) {
lformat |= VS::ARRAY_FORMAT_WEIGHTS;
- rw = warr.read();
}
for (int i = 0; i < vc; i++) {
-
Vertex v;
if (lformat & VS::ARRAY_FORMAT_VERTEX)
v.vertex = varr[i];
@@ -640,68 +610,46 @@ Vector<SurfaceTool::Vertex> SurfaceTool::create_vertex_array_from_triangle_array
void SurfaceTool::_create_list_from_arrays(Array arr, List<Vertex> *r_vertex, List<int> *r_index, int &lformat) {
- PoolVector<Vector3> varr = arr[VS::ARRAY_VERTEX];
- PoolVector<Vector3> narr = arr[VS::ARRAY_NORMAL];
- PoolVector<float> tarr = arr[VS::ARRAY_TANGENT];
- PoolVector<Color> carr = arr[VS::ARRAY_COLOR];
- PoolVector<Vector2> uvarr = arr[VS::ARRAY_TEX_UV];
- PoolVector<Vector2> uv2arr = arr[VS::ARRAY_TEX_UV2];
- PoolVector<int> barr = arr[VS::ARRAY_BONES];
- PoolVector<float> warr = arr[VS::ARRAY_WEIGHTS];
+ Vector<Vector3> varr = arr[VS::ARRAY_VERTEX];
+ Vector<Vector3> narr = arr[VS::ARRAY_NORMAL];
+ Vector<float> tarr = arr[VS::ARRAY_TANGENT];
+ Vector<Color> carr = arr[VS::ARRAY_COLOR];
+ Vector<Vector2> uvarr = arr[VS::ARRAY_TEX_UV];
+ Vector<Vector2> uv2arr = arr[VS::ARRAY_TEX_UV2];
+ Vector<int> barr = arr[VS::ARRAY_BONES];
+ Vector<float> warr = arr[VS::ARRAY_WEIGHTS];
int vc = varr.size();
-
if (vc == 0)
return;
- lformat = 0;
- PoolVector<Vector3>::Read rv;
+ lformat = 0;
if (varr.size()) {
lformat |= VS::ARRAY_FORMAT_VERTEX;
- rv = varr.read();
}
- PoolVector<Vector3>::Read rn;
if (narr.size()) {
lformat |= VS::ARRAY_FORMAT_NORMAL;
- rn = narr.read();
}
- PoolVector<float>::Read rt;
if (tarr.size()) {
lformat |= VS::ARRAY_FORMAT_TANGENT;
- rt = tarr.read();
}
- PoolVector<Color>::Read rc;
if (carr.size()) {
lformat |= VS::ARRAY_FORMAT_COLOR;
- rc = carr.read();
}
-
- PoolVector<Vector2>::Read ruv;
if (uvarr.size()) {
lformat |= VS::ARRAY_FORMAT_TEX_UV;
- ruv = uvarr.read();
}
-
- PoolVector<Vector2>::Read ruv2;
if (uv2arr.size()) {
lformat |= VS::ARRAY_FORMAT_TEX_UV2;
- ruv2 = uv2arr.read();
}
-
- PoolVector<int>::Read rb;
if (barr.size()) {
lformat |= VS::ARRAY_FORMAT_BONES;
- rb = barr.read();
}
-
- PoolVector<float>::Read rw;
if (warr.size()) {
lformat |= VS::ARRAY_FORMAT_WEIGHTS;
- rw = warr.read();
}
for (int i = 0; i < vc; i++) {
-
Vertex v;
if (lformat & VS::ARRAY_FORMAT_VERTEX)
v.vertex = varr[i];
@@ -742,12 +690,12 @@ void SurfaceTool::_create_list_from_arrays(Array arr, List<Vertex> *r_vertex, Li
//indices
- PoolVector<int> idx = arr[VS::ARRAY_INDEX];
+ Vector<int> idx = arr[VS::ARRAY_INDEX];
int is = idx.size();
if (is) {
lformat |= VS::ARRAY_FORMAT_INDEX;
- PoolVector<int>::Read iarr = idx.read();
+ const int *iarr = idx.ptr();
for (int i = 0; i < is; i++) {
r_index->push_back(iarr[i]);
}
diff --git a/scene/resources/text_file.cpp b/scene/resources/text_file.cpp
index af55d2dde3..e291dcb67e 100644
--- a/scene/resources/text_file.cpp
+++ b/scene/resources/text_file.cpp
@@ -50,7 +50,7 @@ void TextFile::reload_from_file() {
Error TextFile::load_text(const String &p_path) {
- PoolVector<uint8_t> sourcef;
+ Vector<uint8_t> sourcef;
Error err;
FileAccess *f = FileAccess::open(p_path, FileAccess::READ, &err);
@@ -58,15 +58,15 @@ Error TextFile::load_text(const String &p_path) {
int len = f->get_len();
sourcef.resize(len + 1);
- PoolVector<uint8_t>::Write w = sourcef.write();
- int r = f->get_buffer(w.ptr(), len);
+ uint8_t *w = sourcef.ptrw();
+ int r = f->get_buffer(w, len);
f->close();
memdelete(f);
ERR_FAIL_COND_V(r != len, ERR_CANT_OPEN);
w[len] = 0;
String s;
- ERR_FAIL_COND_V_MSG(s.parse_utf8((const char *)w.ptr()), ERR_INVALID_DATA, "Script '" + p_path + "' contains invalid unicode (UTF-8), so it was not loaded. Please ensure that scripts are saved in valid UTF-8 unicode.");
+ ERR_FAIL_COND_V_MSG(s.parse_utf8((const char *)w), ERR_INVALID_DATA, "Script '" + p_path + "' contains invalid unicode (UTF-8), so it was not loaded. Please ensure that scripts are saved in valid UTF-8 unicode.");
text = s;
path = p_path;
return OK;
diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp
index 4ddceed58e..64de19c197 100644
--- a/scene/resources/texture.cpp
+++ b/scene/resources/texture.cpp
@@ -388,11 +388,11 @@ Ref<Image> StreamTexture::load_image_from_file(FileAccess *f, int p_size_limit)
continue;
}
- PoolVector<uint8_t> pv;
+ Vector<uint8_t> pv;
pv.resize(size);
{
- PoolVector<uint8_t>::Write wr = pv.write();
- f->get_buffer(wr.ptr(), size);
+ uint8_t *wr = pv.ptrw();
+ f->get_buffer(wr, size);
}
Ref<Image> img;
@@ -405,7 +405,6 @@ Ref<Image> StreamTexture::load_image_from_file(FileAccess *f, int p_size_limit)
}
if (img.is_null() || img->empty()) {
- memdelete(f);
ERR_FAIL_COND_V(img.is_null() || img->empty(), Ref<Image>());
}
@@ -438,19 +437,19 @@ Ref<Image> StreamTexture::load_image_from_file(FileAccess *f, int p_size_limit)
} else {
//rarer use case, but needs to be supported
- PoolVector<uint8_t> img_data;
+ Vector<uint8_t> img_data;
img_data.resize(total_size);
{
- PoolVector<uint8_t>::Write wr = img_data.write();
+ uint8_t *wr = img_data.ptrw();
int ofs = 0;
for (int i = 0; i < mipmap_images.size(); i++) {
- PoolVector<uint8_t> id = mipmap_images[i]->get_data();
+ Vector<uint8_t> id = mipmap_images[i]->get_data();
int len = id.size();
- PoolVector<uint8_t>::Read r = id.read();
- copymem(&wr[ofs], r.ptr(), len);
+ const uint8_t *r = id.ptr();
+ copymem(&wr[ofs], r, len);
ofs += len;
}
}
@@ -474,12 +473,12 @@ Ref<Image> StreamTexture::load_image_from_file(FileAccess *f, int p_size_limit)
continue; //oops, size limit enforced, go to next
}
- PoolVector<uint8_t> data;
+ Vector<uint8_t> data;
data.resize(size - ofs);
{
- PoolVector<uint8_t>::Write wr = data.write();
- f->get_buffer(wr.ptr(), data.size());
+ uint8_t *wr = data.ptrw();
+ f->get_buffer(wr, data.size());
}
Ref<Image> image;
@@ -588,6 +587,8 @@ Error StreamTexture::_load_data(const String &p_path, int &tw, int &th, int &tw_
image = load_image_from_file(f, p_size_limit);
+ memdelete(f);
+
if (image.is_null() || image->empty()) {
return ERR_CANT_OPEN;
}
@@ -1408,11 +1409,11 @@ void CurveTexture::ensure_default_setup(float p_min, float p_max) {
void CurveTexture::set_curve(Ref<Curve> p_curve) {
if (_curve != p_curve) {
if (_curve.is_valid()) {
- _curve->disconnect(CoreStringNames::get_singleton()->changed, this, "_update");
+ _curve->disconnect_compat(CoreStringNames::get_singleton()->changed, this, "_update");
}
_curve = p_curve;
if (_curve.is_valid()) {
- _curve->connect(CoreStringNames::get_singleton()->changed, this, "_update");
+ _curve->connect_compat(CoreStringNames::get_singleton()->changed, this, "_update");
}
_update();
}
@@ -1420,13 +1421,13 @@ void CurveTexture::set_curve(Ref<Curve> p_curve) {
void CurveTexture::_update() {
- PoolVector<uint8_t> data;
+ Vector<uint8_t> data;
data.resize(_width * sizeof(float));
// The array is locked in that scope
{
- PoolVector<uint8_t>::Write wd8 = data.write();
- float *wd = (float *)wd8.ptr();
+ uint8_t *wd8 = data.ptrw();
+ float *wd = (float *)wd8;
if (_curve.is_valid()) {
Curve &curve = **_curve;
@@ -1513,11 +1514,11 @@ void GradientTexture::set_gradient(Ref<Gradient> p_gradient) {
if (p_gradient == gradient)
return;
if (gradient.is_valid()) {
- gradient->disconnect(CoreStringNames::get_singleton()->changed, this, "_update");
+ gradient->disconnect_compat(CoreStringNames::get_singleton()->changed, this, "_update");
}
gradient = p_gradient;
if (gradient.is_valid()) {
- gradient->connect(CoreStringNames::get_singleton()->changed, this, "_update");
+ gradient->connect_compat(CoreStringNames::get_singleton()->changed, this, "_update");
}
_update();
emit_changed();
@@ -1543,10 +1544,10 @@ void GradientTexture::_update() {
if (gradient.is_null())
return;
- PoolVector<uint8_t> data;
+ Vector<uint8_t> data;
data.resize(width * 4);
{
- PoolVector<uint8_t>::Write wd8 = data.write();
+ uint8_t *wd8 = data.ptrw();
Gradient &g = **gradient;
for (int i = 0; i < width; i++) {
@@ -1845,11 +1846,11 @@ void AnimatedTexture::_bind_methods() {
ClassDB::bind_method(D_METHOD("_update_proxy"), &AnimatedTexture::_update_proxy);
ADD_PROPERTY(PropertyInfo(Variant::INT, "frames", PROPERTY_HINT_RANGE, "1," + itos(MAX_FRAMES), PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), "set_frames", "get_frames");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "fps", PROPERTY_HINT_RANGE, "0,1024,0.1"), "set_fps", "get_fps");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "fps", PROPERTY_HINT_RANGE, "0,1024,0.1"), "set_fps", "get_fps");
for (int i = 0; i < MAX_FRAMES; i++) {
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "frame_" + itos(i) + "/texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "set_frame_texture", "get_frame_texture", i);
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "frame_" + itos(i) + "/delay_sec", PROPERTY_HINT_RANGE, "0.0,16.0,0.01", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "set_frame_delay", "get_frame_delay", i);
+ ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "frame_" + itos(i) + "/delay_sec", PROPERTY_HINT_RANGE, "0.0,16.0,0.01", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "set_frame_delay", "get_frame_delay", i);
}
BIND_CONSTANT(MAX_FRAMES);
@@ -1866,7 +1867,7 @@ AnimatedTexture::AnimatedTexture() {
fps = 4;
prev_ticks = 0;
current_frame = 0;
- VisualServer::get_singleton()->connect("frame_pre_draw", this, "_update_proxy");
+ VisualServer::get_singleton()->connect_compat("frame_pre_draw", this, "_update_proxy");
#ifndef NO_THREADS
rw_lock = RWLock::create();
@@ -2094,11 +2095,11 @@ RES ResourceFormatLoaderTextureLayered::load(const String &p_path, const String
for (int i = 0; i < mipmaps; i++) {
uint32_t size = f->get_32();
- PoolVector<uint8_t> pv;
+ Vector<uint8_t> pv;
pv.resize(size);
{
- PoolVector<uint8_t>::Write w = pv.write();
- f->get_buffer(w.ptr(), size);
+ uint8_t *w = pv.ptrw();
+ f->get_buffer(w, size);
}
Ref<Image> img = Image::lossless_unpacker(pv);
@@ -2121,19 +2122,19 @@ RES ResourceFormatLoaderTextureLayered::load(const String &p_path, const String
} else {
int total_size = Image::get_image_data_size(tw, th, format, true);
- PoolVector<uint8_t> img_data;
+ Vector<uint8_t> img_data;
img_data.resize(total_size);
{
- PoolVector<uint8_t>::Write w = img_data.write();
+ uint8_t *w = img_data.ptrw();
int ofs = 0;
for (int i = 0; i < mipmap_images.size(); i++) {
- PoolVector<uint8_t> id = mipmap_images[i]->get_data();
+ Vector<uint8_t> id = mipmap_images[i]->get_data();
int len = id.size();
- PoolVector<uint8_t>::Read r = id.read();
- copymem(&w[ofs], r.ptr(), len);
+ const uint8_t *r = id.ptr();
+ copymem(&w[ofs], r, len);
ofs += len;
}
}
@@ -2155,12 +2156,12 @@ RES ResourceFormatLoaderTextureLayered::load(const String &p_path, const String
int total_size = Image::get_image_data_size(tw, th, format, use_mipmaps);
- PoolVector<uint8_t> img_data;
+ Vector<uint8_t> img_data;
img_data.resize(total_size);
{
- PoolVector<uint8_t>::Write w = img_data.write();
- int bytes = f->get_buffer(w.ptr(), total_size);
+ uint8_t *w = img_data.ptrw();
+ int bytes = f->get_buffer(w, total_size);
if (bytes != total_size) {
if (r_error) {
*r_error = ERR_FILE_CORRUPT;
diff --git a/scene/resources/texture.h b/scene/resources/texture.h
index b42b770903..cd8576539b 100644
--- a/scene/resources/texture.h
+++ b/scene/resources/texture.h
@@ -52,7 +52,7 @@ public:
class Texture2D : public Texture {
- GDCLASS(Texture2D, Resource);
+ GDCLASS(Texture2D, Texture);
OBJ_SAVE_TYPE(Texture2D); // Saves derived classes with common type so they can be interchanged.
protected:
@@ -350,7 +350,7 @@ public:
class TextureLayered : public Texture {
- GDCLASS(TextureLayered, Resource);
+ GDCLASS(TextureLayered, Texture);
VS::TextureLayeredType layered_type;
diff --git a/scene/resources/theme.cpp b/scene/resources/theme.cpp
index 75903c1383..5db521bc20 100644
--- a/scene/resources/theme.cpp
+++ b/scene/resources/theme.cpp
@@ -37,112 +37,112 @@ void Theme::_emit_theme_changed() {
emit_changed();
}
-PoolVector<String> Theme::_get_icon_list(const String &p_type) const {
+Vector<String> Theme::_get_icon_list(const String &p_type) const {
- PoolVector<String> ilret;
+ Vector<String> ilret;
List<StringName> il;
get_icon_list(p_type, &il);
ilret.resize(il.size());
int i = 0;
- PoolVector<String>::Write w = ilret.write();
+ String *w = ilret.ptrw();
for (List<StringName>::Element *E = il.front(); E; E = E->next(), i++) {
w[i] = E->get();
}
return ilret;
}
-PoolVector<String> Theme::_get_stylebox_list(const String &p_type) const {
+Vector<String> Theme::_get_stylebox_list(const String &p_type) const {
- PoolVector<String> ilret;
+ Vector<String> ilret;
List<StringName> il;
get_stylebox_list(p_type, &il);
ilret.resize(il.size());
int i = 0;
- PoolVector<String>::Write w = ilret.write();
+ String *w = ilret.ptrw();
for (List<StringName>::Element *E = il.front(); E; E = E->next(), i++) {
w[i] = E->get();
}
return ilret;
}
-PoolVector<String> Theme::_get_stylebox_types(void) const {
+Vector<String> Theme::_get_stylebox_types(void) const {
- PoolVector<String> ilret;
+ Vector<String> ilret;
List<StringName> il;
get_stylebox_types(&il);
ilret.resize(il.size());
int i = 0;
- PoolVector<String>::Write w = ilret.write();
+ String *w = ilret.ptrw();
for (List<StringName>::Element *E = il.front(); E; E = E->next(), i++) {
w[i] = E->get();
}
return ilret;
}
-PoolVector<String> Theme::_get_font_list(const String &p_type) const {
+Vector<String> Theme::_get_font_list(const String &p_type) const {
- PoolVector<String> ilret;
+ Vector<String> ilret;
List<StringName> il;
get_font_list(p_type, &il);
ilret.resize(il.size());
int i = 0;
- PoolVector<String>::Write w = ilret.write();
+ String *w = ilret.ptrw();
for (List<StringName>::Element *E = il.front(); E; E = E->next(), i++) {
w[i] = E->get();
}
return ilret;
}
-PoolVector<String> Theme::_get_color_list(const String &p_type) const {
+Vector<String> Theme::_get_color_list(const String &p_type) const {
- PoolVector<String> ilret;
+ Vector<String> ilret;
List<StringName> il;
get_color_list(p_type, &il);
ilret.resize(il.size());
int i = 0;
- PoolVector<String>::Write w = ilret.write();
+ String *w = ilret.ptrw();
for (List<StringName>::Element *E = il.front(); E; E = E->next(), i++) {
w[i] = E->get();
}
return ilret;
}
-PoolVector<String> Theme::_get_constant_list(const String &p_type) const {
+Vector<String> Theme::_get_constant_list(const String &p_type) const {
- PoolVector<String> ilret;
+ Vector<String> ilret;
List<StringName> il;
get_constant_list(p_type, &il);
ilret.resize(il.size());
int i = 0;
- PoolVector<String>::Write w = ilret.write();
+ String *w = ilret.ptrw();
for (List<StringName>::Element *E = il.front(); E; E = E->next(), i++) {
w[i] = E->get();
}
return ilret;
}
-PoolVector<String> Theme::_get_type_list(const String &p_type) const {
+Vector<String> Theme::_get_type_list(const String &p_type) const {
- PoolVector<String> ilret;
+ Vector<String> ilret;
List<StringName> il;
get_type_list(&il);
ilret.resize(il.size());
int i = 0;
- PoolVector<String>::Write w = ilret.write();
+ String *w = ilret.ptrw();
for (List<StringName>::Element *E = il.front(); E; E = E->next(), i++) {
w[i] = E->get();
}
@@ -302,13 +302,13 @@ void Theme::set_default_theme_font(const Ref<Font> &p_default_font) {
return;
if (default_theme_font.is_valid()) {
- default_theme_font->disconnect("changed", this, "_emit_theme_changed");
+ default_theme_font->disconnect_compat("changed", this, "_emit_theme_changed");
}
default_theme_font = p_default_font;
if (default_theme_font.is_valid()) {
- default_theme_font->connect("changed", this, "_emit_theme_changed", varray(), CONNECT_REFERENCE_COUNTED);
+ default_theme_font->connect_compat("changed", this, "_emit_theme_changed", varray(), CONNECT_REFERENCE_COUNTED);
}
_change_notify();
@@ -366,13 +366,13 @@ void Theme::set_icon(const StringName &p_name, const StringName &p_type, const R
bool new_value = !icon_map.has(p_type) || !icon_map[p_type].has(p_name);
if (icon_map[p_type].has(p_name) && icon_map[p_type][p_name].is_valid()) {
- icon_map[p_type][p_name]->disconnect("changed", this, "_emit_theme_changed");
+ icon_map[p_type][p_name]->disconnect_compat("changed", this, "_emit_theme_changed");
}
icon_map[p_type][p_name] = p_icon;
if (p_icon.is_valid()) {
- icon_map[p_type][p_name]->connect("changed", this, "_emit_theme_changed", varray(), CONNECT_REFERENCE_COUNTED);
+ icon_map[p_type][p_name]->connect_compat("changed", this, "_emit_theme_changed", varray(), CONNECT_REFERENCE_COUNTED);
}
if (new_value) {
@@ -401,7 +401,7 @@ void Theme::clear_icon(const StringName &p_name, const StringName &p_type) {
ERR_FAIL_COND(!icon_map[p_type].has(p_name));
if (icon_map[p_type][p_name].is_valid()) {
- icon_map[p_type][p_name]->disconnect("changed", this, "_emit_theme_changed");
+ icon_map[p_type][p_name]->disconnect_compat("changed", this, "_emit_theme_changed");
}
icon_map[p_type].erase(p_name);
@@ -479,13 +479,13 @@ void Theme::set_stylebox(const StringName &p_name, const StringName &p_type, con
bool new_value = !style_map.has(p_type) || !style_map[p_type].has(p_name);
if (style_map[p_type].has(p_name) && style_map[p_type][p_name].is_valid()) {
- style_map[p_type][p_name]->disconnect("changed", this, "_emit_theme_changed");
+ style_map[p_type][p_name]->disconnect_compat("changed", this, "_emit_theme_changed");
}
style_map[p_type][p_name] = p_style;
if (p_style.is_valid()) {
- style_map[p_type][p_name]->connect("changed", this, "_emit_theme_changed", varray(), CONNECT_REFERENCE_COUNTED);
+ style_map[p_type][p_name]->connect_compat("changed", this, "_emit_theme_changed", varray(), CONNECT_REFERENCE_COUNTED);
}
if (new_value)
@@ -514,7 +514,7 @@ void Theme::clear_stylebox(const StringName &p_name, const StringName &p_type) {
ERR_FAIL_COND(!style_map[p_type].has(p_name));
if (style_map[p_type][p_name].is_valid()) {
- style_map[p_type][p_name]->disconnect("changed", this, "_emit_theme_changed");
+ style_map[p_type][p_name]->disconnect_compat("changed", this, "_emit_theme_changed");
}
style_map[p_type].erase(p_name);
@@ -554,13 +554,13 @@ void Theme::set_font(const StringName &p_name, const StringName &p_type, const R
bool new_value = !font_map.has(p_type) || !font_map[p_type].has(p_name);
if (font_map[p_type][p_name].is_valid()) {
- font_map[p_type][p_name]->disconnect("changed", this, "_emit_theme_changed");
+ font_map[p_type][p_name]->disconnect_compat("changed", this, "_emit_theme_changed");
}
font_map[p_type][p_name] = p_font;
if (p_font.is_valid()) {
- font_map[p_type][p_name]->connect("changed", this, "_emit_theme_changed", varray(), CONNECT_REFERENCE_COUNTED);
+ font_map[p_type][p_name]->connect_compat("changed", this, "_emit_theme_changed", varray(), CONNECT_REFERENCE_COUNTED);
}
if (new_value) {
@@ -589,7 +589,7 @@ void Theme::clear_font(const StringName &p_name, const StringName &p_type) {
ERR_FAIL_COND(!font_map[p_type].has(p_name));
if (font_map[p_type][p_name].is_valid()) {
- font_map[p_type][p_name]->disconnect("changed", this, "_emit_theme_changed");
+ font_map[p_type][p_name]->disconnect_compat("changed", this, "_emit_theme_changed");
}
font_map[p_type].erase(p_name);
@@ -722,7 +722,7 @@ void Theme::clear() {
while ((L = icon_map[*K].next(L))) {
Ref<Texture2D> icon = icon_map[*K][*L];
if (icon.is_valid()) {
- icon->disconnect("changed", this, "_emit_theme_changed");
+ icon->disconnect_compat("changed", this, "_emit_theme_changed");
}
}
}
@@ -735,7 +735,7 @@ void Theme::clear() {
while ((L = style_map[*K].next(L))) {
Ref<StyleBox> style = style_map[*K][*L];
if (style.is_valid()) {
- style->disconnect("changed", this, "_emit_theme_changed");
+ style->disconnect_compat("changed", this, "_emit_theme_changed");
}
}
}
@@ -748,7 +748,7 @@ void Theme::clear() {
while ((L = font_map[*K].next(L))) {
Ref<Font> font = font_map[*K][*L];
if (font.is_valid()) {
- font->disconnect("changed", this, "_emit_theme_changed");
+ font->disconnect_compat("changed", this, "_emit_theme_changed");
}
}
}
diff --git a/scene/resources/theme.h b/scene/resources/theme.h
index e60734b144..3d01f71ea0 100644
--- a/scene/resources/theme.h
+++ b/scene/resources/theme.h
@@ -52,13 +52,13 @@ class Theme : public Resource {
HashMap<StringName, HashMap<StringName, Color> > color_map;
HashMap<StringName, HashMap<StringName, int> > constant_map;
- PoolVector<String> _get_icon_list(const String &p_type) const;
- PoolVector<String> _get_stylebox_list(const String &p_type) const;
- PoolVector<String> _get_stylebox_types(void) const;
- PoolVector<String> _get_font_list(const String &p_type) const;
- PoolVector<String> _get_color_list(const String &p_type) const;
- PoolVector<String> _get_constant_list(const String &p_type) const;
- PoolVector<String> _get_type_list(const String &p_type) const;
+ Vector<String> _get_icon_list(const String &p_type) const;
+ Vector<String> _get_stylebox_list(const String &p_type) const;
+ Vector<String> _get_stylebox_types(void) const;
+ Vector<String> _get_font_list(const String &p_type) const;
+ Vector<String> _get_color_list(const String &p_type) const;
+ Vector<String> _get_constant_list(const String &p_type) const;
+ Vector<String> _get_type_list(const String &p_type) const;
protected:
bool _set(const StringName &p_name, const Variant &p_value);
diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp
index 7383e18473..f42b56bc83 100644
--- a/scene/resources/tile_set.cpp
+++ b/scene/resources/tile_set.cpp
@@ -360,7 +360,7 @@ void TileSet::_get_property_list(List<PropertyInfo> *p_list) const {
p_list->push_back(PropertyInfo(Variant::VECTOR2, pre + "shape_transform", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR));
p_list->push_back(PropertyInfo(Variant::OBJECT, pre + "shape", PROPERTY_HINT_RESOURCE_TYPE, "Shape2D", PROPERTY_USAGE_NOEDITOR));
p_list->push_back(PropertyInfo(Variant::BOOL, pre + "shape_one_way", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR));
- p_list->push_back(PropertyInfo(Variant::REAL, pre + "shape_one_way_margin", PROPERTY_HINT_RANGE, "0,128,0.01", PROPERTY_USAGE_NOEDITOR));
+ p_list->push_back(PropertyInfo(Variant::FLOAT, pre + "shape_one_way_margin", PROPERTY_HINT_RANGE, "0,128,0.01", PROPERTY_USAGE_NOEDITOR));
p_list->push_back(PropertyInfo(Variant::ARRAY, pre + "shapes", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR));
p_list->push_back(PropertyInfo(Variant::INT, pre + "z_index", PROPERTY_HINT_RANGE, itos(VS::CANVAS_ITEM_Z_MIN) + "," + itos(VS::CANVAS_ITEM_Z_MAX) + ",1", PROPERTY_USAGE_NOEDITOR));
}
diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp
index f80fe9f791..556d299198 100644
--- a/scene/resources/visual_shader.cpp
+++ b/scene/resources/visual_shader.cpp
@@ -32,6 +32,7 @@
#include "core/vmap.h"
#include "servers/visual/shader_types.h"
+#include "visual_shader_nodes.h"
bool VisualShaderNode::is_simple_decl() const {
return simple_decl;
@@ -127,6 +128,7 @@ void VisualShaderNode::_bind_methods() {
ADD_SIGNAL(MethodInfo("editor_refresh_request"));
BIND_ENUM_CONSTANT(PORT_TYPE_SCALAR);
+ BIND_ENUM_CONSTANT(PORT_TYPE_SCALAR_INT);
BIND_ENUM_CONSTANT(PORT_TYPE_VECTOR);
BIND_ENUM_CONSTANT(PORT_TYPE_BOOLEAN);
BIND_ENUM_CONSTANT(PORT_TYPE_TRANSFORM);
@@ -266,14 +268,13 @@ void VisualShaderNodeCustom::_bind_methods() {
BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_name"));
BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_description"));
BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_category"));
- BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_subcategory"));
BIND_VMETHOD(MethodInfo(Variant::INT, "_get_return_icon_type"));
BIND_VMETHOD(MethodInfo(Variant::INT, "_get_input_port_count"));
BIND_VMETHOD(MethodInfo(Variant::INT, "_get_input_port_type", PropertyInfo(Variant::INT, "port")));
- BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_input_port_name", PropertyInfo(Variant::INT, "port")));
+ BIND_VMETHOD(MethodInfo(Variant::STRING_NAME, "_get_input_port_name", PropertyInfo(Variant::INT, "port")));
BIND_VMETHOD(MethodInfo(Variant::INT, "_get_output_port_count"));
BIND_VMETHOD(MethodInfo(Variant::INT, "_get_output_port_type", PropertyInfo(Variant::INT, "port")));
- BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_output_port_name", PropertyInfo(Variant::INT, "port")));
+ BIND_VMETHOD(MethodInfo(Variant::STRING_NAME, "_get_output_port_name", PropertyInfo(Variant::INT, "port")));
BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_code", PropertyInfo(Variant::ARRAY, "input_vars"), PropertyInfo(Variant::ARRAY, "output_vars"), PropertyInfo(Variant::INT, "mode"), PropertyInfo(Variant::INT, "type")));
BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_global_code", PropertyInfo(Variant::INT, "mode")));
BIND_VMETHOD(MethodInfo(Variant::BOOL, "_is_highend"));
@@ -285,6 +286,49 @@ VisualShaderNodeCustom::VisualShaderNodeCustom() {
/////////////////////////////////////////////////////////
+void VisualShader::set_version(const String &p_version) {
+ version = p_version;
+}
+
+String VisualShader::get_version() const {
+ return version;
+}
+
+void VisualShader::update_version(const String &p_new_version) {
+ if (version == "") {
+ for (int i = 0; i < TYPE_MAX; i++) {
+ for (Map<int, Node>::Element *E = graph[i].nodes.front(); E; E = E->next()) {
+ Ref<VisualShaderNodeExpression> expression = Object::cast_to<VisualShaderNodeExpression>(E->get().node.ptr());
+ if (expression.is_valid()) {
+ for (int j = 0; j < expression->get_input_port_count(); j++) {
+ int type = expression->get_input_port_type(j);
+ if (type > 0) { // + PORT_TYPE_SCALAR_INT
+ type += 1;
+ }
+ expression->set_input_port_type(j, type);
+ }
+ for (int j = 0; j < expression->get_output_port_count(); j++) {
+ int type = expression->get_output_port_type(j);
+ if (type > 0) { // + PORT_TYPE_SCALAR_INT
+ type += 1;
+ }
+ expression->set_output_port_type(j, type);
+ }
+ }
+ Ref<VisualShaderNodeCompare> compare = Object::cast_to<VisualShaderNodeCompare>(E->get().node.ptr());
+ if (compare.is_valid()) {
+ int ctype = int(compare->get_comparison_type());
+ if (int(ctype) > 0) { // + PORT_TYPE_SCALAR_INT
+ ctype += 1;
+ }
+ compare->set_comparison_type(VisualShaderNodeCompare::ComparisonType(ctype));
+ }
+ }
+ }
+ }
+ set_version(p_new_version);
+}
+
void VisualShader::add_node(Type p_type, const Ref<VisualShaderNode> &p_node, const Vector2 &p_position, int p_id) {
ERR_FAIL_COND(p_node.is_null());
ERR_FAIL_COND(p_id < 2);
@@ -305,10 +349,10 @@ void VisualShader::add_node(Type p_type, const Ref<VisualShaderNode> &p_node, co
if (input.is_valid()) {
input->shader_mode = shader_mode;
input->shader_type = p_type;
- input->connect("input_type_changed", this, "_input_type_changed", varray(p_type, p_id));
+ input->connect_compat("input_type_changed", this, "_input_type_changed", varray(p_type, p_id));
}
- n.node->connect("changed", this, "_queue_update");
+ n.node->connect_compat("changed", this, "_queue_update");
Ref<VisualShaderNodeCustom> custom = n.node;
if (custom.is_valid()) {
@@ -375,10 +419,10 @@ void VisualShader::remove_node(Type p_type, int p_id) {
Ref<VisualShaderNodeInput> input = g->nodes[p_id].node;
if (input.is_valid()) {
- input->disconnect("input_type_changed", this, "_input_type_changed");
+ input->disconnect_compat("input_type_changed", this, "_input_type_changed");
}
- g->nodes[p_id].node->disconnect("changed", this, "_queue_update");
+ g->nodes[p_id].node->disconnect_compat("changed", this, "_queue_update");
g->nodes.erase(p_id);
@@ -470,7 +514,7 @@ bool VisualShader::can_connect_nodes(Type p_type, int p_from_node, int p_from_po
}
bool VisualShader::is_port_types_compatible(int p_a, int p_b) const {
- return MAX(0, p_a - 2) == (MAX(0, p_b - 2));
+ return MAX(0, p_a - 3) == (MAX(0, p_b - 3));
}
void VisualShader::connect_nodes_forced(Type p_type, int p_from_node, int p_from_port, int p_to_node, int p_to_port) {
@@ -698,9 +742,11 @@ String VisualShader::generate_preview_shader(Type p_type, int p_node, int p_port
ERR_FAIL_COND_V(err != OK, String());
if (node->get_output_port_type(p_port) == VisualShaderNode::PORT_TYPE_SCALAR) {
- code += "\tCOLOR.rgb = vec3( n_out" + itos(p_node) + "p" + itos(p_port) + " );\n";
+ code += "\tCOLOR.rgb = vec3(n_out" + itos(p_node) + "p" + itos(p_port) + " );\n";
+ } else if (node->get_output_port_type(p_port) == VisualShaderNode::PORT_TYPE_SCALAR_INT) {
+ code += "\tCOLOR.rgb = vec3(float(n_out" + itos(p_node) + "p" + itos(p_port) + "));\n";
} else if (node->get_output_port_type(p_port) == VisualShaderNode::PORT_TYPE_BOOLEAN) {
- code += "\tCOLOR.rgb = vec3( n_out" + itos(p_node) + "p" + itos(p_port) + " ? 1.0 : 0.0 );\n";
+ code += "\tCOLOR.rgb = vec3(n_out" + itos(p_node) + "p" + itos(p_port) + " ? 1.0 : 0.0);\n";
} else {
code += "\tCOLOR.rgb = n_out" + itos(p_node) + "p" + itos(p_port) + ";\n";
}
@@ -985,8 +1031,8 @@ bool VisualShader::_get(const StringName &p_name, Variant &r_ret) const {
}
return false;
}
-void VisualShader::_get_property_list(List<PropertyInfo> *p_list) const {
+void VisualShader::_get_property_list(List<PropertyInfo> *p_list) const {
//mode
p_list->push_back(PropertyInfo(Variant::INT, "mode", PROPERTY_HINT_ENUM, "Spatial,CanvasItem,Particles"));
//render modes
@@ -995,7 +1041,6 @@ void VisualShader::_get_property_list(List<PropertyInfo> *p_list) const {
Set<String> toggles;
for (int i = 0; i < ShaderTypes::get_singleton()->get_modes(VisualServer::ShaderMode(shader_mode)).size(); i++) {
-
String mode = ShaderTypes::get_singleton()->get_modes(VisualServer::ShaderMode(shader_mode))[i];
int idx = 0;
bool in_enum = false;
@@ -1020,7 +1065,6 @@ void VisualShader::_get_property_list(List<PropertyInfo> *p_list) const {
}
for (Map<String, String>::Element *E = blend_mode_enums.front(); E; E = E->next()) {
-
p_list->push_back(PropertyInfo(Variant::INT, "modes/" + E->key(), PROPERTY_HINT_ENUM, E->get()));
}
@@ -1050,7 +1094,7 @@ void VisualShader::_get_property_list(List<PropertyInfo> *p_list) const {
p_list->push_back(PropertyInfo(Variant::STRING, prop_name + "/expression", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR));
}
}
- p_list->push_back(PropertyInfo(Variant::POOL_INT_ARRAY, "nodes/" + String(type_string[i]) + "/connections", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR));
+ p_list->push_back(PropertyInfo(Variant::PACKED_INT32_ARRAY, "nodes/" + String(type_string[i]) + "/connections", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR));
}
}
@@ -1113,24 +1157,40 @@ Error VisualShader::_write_node(Type type, StringBuilder &global_code, StringBui
inputs[i] = src_var;
} else if (in_type == VisualShaderNode::PORT_TYPE_SCALAR && out_type == VisualShaderNode::PORT_TYPE_VECTOR) {
inputs[i] = "dot(" + src_var + ", vec3(0.333333, 0.333333, 0.333333))";
+ } else if (in_type == VisualShaderNode::PORT_TYPE_SCALAR_INT && out_type == VisualShaderNode::PORT_TYPE_VECTOR) {
+ inputs[i] = "dot(float(" + src_var + "), vec3(0.333333, 0.333333, 0.333333))";
} else if (in_type == VisualShaderNode::PORT_TYPE_VECTOR && out_type == VisualShaderNode::PORT_TYPE_SCALAR) {
inputs[i] = "vec3(" + src_var + ")";
+ } else if (in_type == VisualShaderNode::PORT_TYPE_VECTOR && out_type == VisualShaderNode::PORT_TYPE_SCALAR_INT) {
+ inputs[i] = "vec3(float(" + src_var + "))";
} else if (in_type == VisualShaderNode::PORT_TYPE_BOOLEAN && out_type == VisualShaderNode::PORT_TYPE_VECTOR) {
inputs[i] = "all(bvec3(" + src_var + "))";
} else if (in_type == VisualShaderNode::PORT_TYPE_BOOLEAN && out_type == VisualShaderNode::PORT_TYPE_SCALAR) {
inputs[i] = src_var + " > 0.0 ? true : false";
+ } else if (in_type == VisualShaderNode::PORT_TYPE_BOOLEAN && out_type == VisualShaderNode::PORT_TYPE_SCALAR_INT) {
+ inputs[i] = src_var + " > 0 ? true : false";
} else if (in_type == VisualShaderNode::PORT_TYPE_SCALAR && out_type == VisualShaderNode::PORT_TYPE_BOOLEAN) {
inputs[i] = src_var + " ? 1.0 : 0.0";
+ } else if (in_type == VisualShaderNode::PORT_TYPE_SCALAR_INT && out_type == VisualShaderNode::PORT_TYPE_BOOLEAN) {
+ inputs[i] = src_var + " ? 1 : 0";
} else if (in_type == VisualShaderNode::PORT_TYPE_VECTOR && out_type == VisualShaderNode::PORT_TYPE_BOOLEAN) {
inputs[i] = "vec3(" + src_var + " ? 1.0 : 0.0)";
+ } else if (in_type == VisualShaderNode::PORT_TYPE_SCALAR && out_type == VisualShaderNode::PORT_TYPE_SCALAR_INT) {
+ inputs[i] = "float(" + src_var + ")";
+ } else if (in_type == VisualShaderNode::PORT_TYPE_SCALAR_INT && out_type == VisualShaderNode::PORT_TYPE_SCALAR) {
+ inputs[i] = "int(" + src_var + ")";
}
} else {
Variant defval = vsnode->get_input_port_default_value(i);
- if (defval.get_type() == Variant::REAL || defval.get_type() == Variant::INT) {
+ if (defval.get_type() == Variant::FLOAT) {
float val = defval;
inputs[i] = "n_in" + itos(node) + "p" + itos(i);
code += "\tfloat " + inputs[i] + " = " + vformat("%.5f", val) + ";\n";
+ } else if (defval.get_type() == Variant::INT) {
+ int val = defval;
+ inputs[i] = "n_in" + itos(node) + "p" + itos(i);
+ code += "\tint " + inputs[i] + " = " + itos(val) + ";\n";
} else if (defval.get_type() == Variant::BOOL) {
bool val = defval;
inputs[i] = "n_in" + itos(node) + "p" + itos(i);
@@ -1170,6 +1230,7 @@ Error VisualShader::_write_node(Type type, StringBuilder &global_code, StringBui
String var_name = "n_out" + itos(node) + "p" + itos(i);
switch (vsnode->get_output_port_type(i)) {
case VisualShaderNode::PORT_TYPE_SCALAR: outputs[i] = "float " + var_name; break;
+ case VisualShaderNode::PORT_TYPE_SCALAR_INT: outputs[i] = "int " + var_name; break;
case VisualShaderNode::PORT_TYPE_VECTOR: outputs[i] = "vec3 " + var_name; break;
case VisualShaderNode::PORT_TYPE_BOOLEAN: outputs[i] = "bool " + var_name; break;
case VisualShaderNode::PORT_TYPE_TRANSFORM: outputs[i] = "mat4 " + var_name; break;
@@ -1183,6 +1244,7 @@ Error VisualShader::_write_node(Type type, StringBuilder &global_code, StringBui
outputs[i] = "n_out" + itos(node) + "p" + itos(i);
switch (vsnode->get_output_port_type(i)) {
case VisualShaderNode::PORT_TYPE_SCALAR: code += String() + "\tfloat " + outputs[i] + ";\n"; break;
+ case VisualShaderNode::PORT_TYPE_SCALAR_INT: code += String() + "\tint " + outputs[i] + ";\n"; break;
case VisualShaderNode::PORT_TYPE_VECTOR: code += String() + "\tvec3 " + outputs[i] + ";\n"; break;
case VisualShaderNode::PORT_TYPE_BOOLEAN: code += String() + "\tbool " + outputs[i] + ";\n"; break;
case VisualShaderNode::PORT_TYPE_TRANSFORM: code += String() + "\tmat4 " + outputs[i] + ";\n"; break;
@@ -1412,6 +1474,9 @@ void VisualShader::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_node_connections", "type"), &VisualShader::_get_node_connections);
+ ClassDB::bind_method(D_METHOD("set_version", "version"), &VisualShader::set_version);
+ ClassDB::bind_method(D_METHOD("get_version"), &VisualShader::get_version);
+
ClassDB::bind_method(D_METHOD("set_graph_offset", "offset"), &VisualShader::set_graph_offset);
ClassDB::bind_method(D_METHOD("get_graph_offset"), &VisualShader::get_graph_offset);
@@ -1421,6 +1486,7 @@ void VisualShader::_bind_methods() {
ClassDB::bind_method(D_METHOD("_input_type_changed"), &VisualShader::_input_type_changed);
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "graph_offset", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_graph_offset", "get_graph_offset");
+ ADD_PROPERTY(PropertyInfo(Variant::STRING, "version", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_version", "get_version");
BIND_ENUM_CONSTANT(TYPE_VERTEX);
BIND_ENUM_CONSTANT(TYPE_FRAGMENT);
@@ -1576,7 +1642,7 @@ const VisualShaderNodeInput::Port VisualShaderNodeInput::ports[] = {
{ Shader::MODE_PARTICLES, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_SCALAR, "delta", "DELTA" },
{ Shader::MODE_PARTICLES, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_SCALAR, "lifetime", "LIFETIME" },
- { Shader::MODE_PARTICLES, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_SCALAR, "index", "float(INDEX)" },
+ { Shader::MODE_PARTICLES, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_SCALAR_INT, "index", "INDEX" },
{ Shader::MODE_PARTICLES, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_TRANSFORM, "emission_transform", "EMISSION_TRANSFORM" },
{ Shader::MODE_PARTICLES, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_SCALAR, "time", "TIME" },
@@ -1684,17 +1750,20 @@ String VisualShaderNodeInput::generate_code(Shader::Mode p_mode, VisualShader::T
switch (get_output_port_type(0)) {
case PORT_TYPE_SCALAR: {
code = "\t" + p_output_vars[0] + " = 0.0;\n";
- } break; //default (none found) is scalar
+ } break;
+ case PORT_TYPE_SCALAR_INT: {
+ code = "\t" + p_output_vars[0] + " = 0;\n";
+ } break;
case PORT_TYPE_VECTOR: {
code = "\t" + p_output_vars[0] + " = vec3(0.0);\n";
- } break; //default (none found) is scalar
+ } break;
case PORT_TYPE_TRANSFORM: {
code = "\t" + p_output_vars[0] + " = mat4( vec4(1.0,0.0,0.0,0.0), vec4(0.0,1.0,0.0,0.0), vec4(0.0,0.0,1.0,0.0), vec4(0.0,0.0,0.0,1.0) );\n";
- } break; //default (none found) is scalar
+ } break;
case PORT_TYPE_BOOLEAN: {
code = "\t" + p_output_vars[0] + " = false;\n";
} break;
- default:
+ default: //default (none found) is scalar
break;
}
}
@@ -1847,7 +1916,7 @@ void VisualShaderNodeInput::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_input_name"), &VisualShaderNodeInput::get_input_name);
ClassDB::bind_method(D_METHOD("get_input_real_name"), &VisualShaderNodeInput::get_input_real_name);
- ADD_PROPERTY(PropertyInfo(Variant::STRING, "input_name", PROPERTY_HINT_ENUM, ""), "set_input_name", "get_input_name");
+ ADD_PROPERTY(PropertyInfo(Variant::STRING_NAME, "input_name", PROPERTY_HINT_ENUM, ""), "set_input_name", "get_input_name");
ADD_SIGNAL(MethodInfo("input_type_changed"));
}
VisualShaderNodeInput::VisualShaderNodeInput() {
@@ -2047,7 +2116,7 @@ void VisualShaderNodeUniform::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_uniform_name", "name"), &VisualShaderNodeUniform::set_uniform_name);
ClassDB::bind_method(D_METHOD("get_uniform_name"), &VisualShaderNodeUniform::get_uniform_name);
- ADD_PROPERTY(PropertyInfo(Variant::STRING, "uniform_name"), "set_uniform_name", "get_uniform_name");
+ ADD_PROPERTY(PropertyInfo(Variant::STRING_NAME, "uniform_name"), "set_uniform_name", "get_uniform_name");
}
VisualShaderNodeUniform::VisualShaderNodeUniform() {
@@ -2626,6 +2695,9 @@ String VisualShaderNodeExpression::generate_code(Shader::Mode p_mode, VisualShad
case PORT_TYPE_SCALAR:
tk = "0.0";
break;
+ case PORT_TYPE_SCALAR_INT:
+ tk = "0";
+ break;
case PORT_TYPE_VECTOR:
tk = "vec3(0.0, 0.0, 0.0)";
break;
diff --git a/scene/resources/visual_shader.h b/scene/resources/visual_shader.h
index 1ee75a4cb7..450dcfa081 100644
--- a/scene/resources/visual_shader.h
+++ b/scene/resources/visual_shader.h
@@ -41,6 +41,10 @@ class VisualShaderNode;
class VisualShader : public Shader {
GDCLASS(VisualShader, Shader);
+ friend class VisualShaderNodeVersionChecker;
+
+ String version = "";
+
public:
enum Type {
TYPE_VERTEX,
@@ -118,6 +122,11 @@ protected:
void _get_property_list(List<PropertyInfo> *p_list) const;
public:
+ void set_version(const String &p_version);
+ String get_version() const;
+
+ void update_version(const String &p_new_version);
+
enum {
NODE_ID_INVALID = -1,
NODE_ID_OUTPUT = 0,
@@ -182,6 +191,7 @@ protected:
public:
enum PortType {
PORT_TYPE_SCALAR,
+ PORT_TYPE_SCALAR_INT,
PORT_TYPE_VECTOR,
PORT_TYPE_BOOLEAN,
PORT_TYPE_TRANSFORM,
diff --git a/scene/resources/visual_shader_nodes.cpp b/scene/resources/visual_shader_nodes.cpp
index 95a8155c31..2064ca10f3 100644
--- a/scene/resources/visual_shader_nodes.cpp
+++ b/scene/resources/visual_shader_nodes.cpp
@@ -30,66 +30,127 @@
#include "visual_shader_nodes.h"
-////////////// Scalar
+////////////// Scalar(Float)
-String VisualShaderNodeScalarConstant::get_caption() const {
- return "Scalar";
+String VisualShaderNodeFloatConstant::get_caption() const {
+ return "ScalarFloat";
}
-int VisualShaderNodeScalarConstant::get_input_port_count() const {
+int VisualShaderNodeFloatConstant::get_input_port_count() const {
return 0;
}
-VisualShaderNodeScalarConstant::PortType VisualShaderNodeScalarConstant::get_input_port_type(int p_port) const {
+VisualShaderNodeFloatConstant::PortType VisualShaderNodeFloatConstant::get_input_port_type(int p_port) const {
return PORT_TYPE_SCALAR;
}
-String VisualShaderNodeScalarConstant::get_input_port_name(int p_port) const {
+String VisualShaderNodeFloatConstant::get_input_port_name(int p_port) const {
return String();
}
-int VisualShaderNodeScalarConstant::get_output_port_count() const {
+int VisualShaderNodeFloatConstant::get_output_port_count() const {
return 1;
}
-VisualShaderNodeScalarConstant::PortType VisualShaderNodeScalarConstant::get_output_port_type(int p_port) const {
+VisualShaderNodeFloatConstant::PortType VisualShaderNodeFloatConstant::get_output_port_type(int p_port) const {
return PORT_TYPE_SCALAR;
}
-String VisualShaderNodeScalarConstant::get_output_port_name(int p_port) const {
+String VisualShaderNodeFloatConstant::get_output_port_name(int p_port) const {
return ""; //no output port means the editor will be used as port
}
-String VisualShaderNodeScalarConstant::generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview) const {
+String VisualShaderNodeFloatConstant::generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview) const {
return "\t" + p_output_vars[0] + " = " + vformat("%.6f", constant) + ";\n";
}
-void VisualShaderNodeScalarConstant::set_constant(float p_value) {
+void VisualShaderNodeFloatConstant::set_constant(float p_value) {
constant = p_value;
emit_changed();
}
-float VisualShaderNodeScalarConstant::get_constant() const {
+float VisualShaderNodeFloatConstant::get_constant() const {
return constant;
}
-Vector<StringName> VisualShaderNodeScalarConstant::get_editable_properties() const {
+Vector<StringName> VisualShaderNodeFloatConstant::get_editable_properties() const {
Vector<StringName> props;
props.push_back("constant");
return props;
}
-void VisualShaderNodeScalarConstant::_bind_methods() {
+void VisualShaderNodeFloatConstant::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_constant", "value"), &VisualShaderNodeScalarConstant::set_constant);
- ClassDB::bind_method(D_METHOD("get_constant"), &VisualShaderNodeScalarConstant::get_constant);
+ ClassDB::bind_method(D_METHOD("set_constant", "value"), &VisualShaderNodeFloatConstant::set_constant);
+ ClassDB::bind_method(D_METHOD("get_constant"), &VisualShaderNodeFloatConstant::get_constant);
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "constant"), "set_constant", "get_constant");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "constant"), "set_constant", "get_constant");
}
-VisualShaderNodeScalarConstant::VisualShaderNodeScalarConstant() {
+VisualShaderNodeFloatConstant::VisualShaderNodeFloatConstant() {
+ constant = 0.0;
+}
+
+////////////// Scalar(Int)
+
+String VisualShaderNodeIntConstant::get_caption() const {
+ return "ScalarInt";
+}
+
+int VisualShaderNodeIntConstant::get_input_port_count() const {
+ return 0;
+}
+
+VisualShaderNodeIntConstant::PortType VisualShaderNodeIntConstant::get_input_port_type(int p_port) const {
+ return PORT_TYPE_SCALAR_INT;
+}
+
+String VisualShaderNodeIntConstant::get_input_port_name(int p_port) const {
+ return String();
+}
+
+int VisualShaderNodeIntConstant::get_output_port_count() const {
+ return 1;
+}
+
+VisualShaderNodeIntConstant::PortType VisualShaderNodeIntConstant::get_output_port_type(int p_port) const {
+ return PORT_TYPE_SCALAR_INT;
+}
+
+String VisualShaderNodeIntConstant::get_output_port_name(int p_port) const {
+ return ""; //no output port means the editor will be used as port
+}
+
+String VisualShaderNodeIntConstant::generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview) const {
+ return "\t" + p_output_vars[0] + " = " + itos(constant) + ";\n";
+}
+
+void VisualShaderNodeIntConstant::set_constant(int p_value) {
+ constant = p_value;
+ emit_changed();
+}
+
+int VisualShaderNodeIntConstant::get_constant() const {
+ return constant;
+}
+
+Vector<StringName> VisualShaderNodeIntConstant::get_editable_properties() const {
+ Vector<StringName> props;
+ props.push_back("constant");
+ return props;
+}
+
+void VisualShaderNodeIntConstant::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("set_constant", "value"), &VisualShaderNodeIntConstant::set_constant);
+ ClassDB::bind_method(D_METHOD("get_constant"), &VisualShaderNodeIntConstant::get_constant);
+
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "constant"), "set_constant", "get_constant");
+}
+
+VisualShaderNodeIntConstant::VisualShaderNodeIntConstant() {
constant = 0;
}
@@ -936,37 +997,37 @@ VisualShaderNodeCubemap::VisualShaderNodeCubemap() {
simple_decl = false;
}
-////////////// Scalar Op
+////////////// Float Op
-String VisualShaderNodeScalarOp::get_caption() const {
- return "ScalarOp";
+String VisualShaderNodeFloatOp::get_caption() const {
+ return "FloatOp";
}
-int VisualShaderNodeScalarOp::get_input_port_count() const {
+int VisualShaderNodeFloatOp::get_input_port_count() const {
return 2;
}
-VisualShaderNodeScalarOp::PortType VisualShaderNodeScalarOp::get_input_port_type(int p_port) const {
+VisualShaderNodeFloatOp::PortType VisualShaderNodeFloatOp::get_input_port_type(int p_port) const {
return PORT_TYPE_SCALAR;
}
-String VisualShaderNodeScalarOp::get_input_port_name(int p_port) const {
+String VisualShaderNodeFloatOp::get_input_port_name(int p_port) const {
return p_port == 0 ? "a" : "b";
}
-int VisualShaderNodeScalarOp::get_output_port_count() const {
+int VisualShaderNodeFloatOp::get_output_port_count() const {
return 1;
}
-VisualShaderNodeScalarOp::PortType VisualShaderNodeScalarOp::get_output_port_type(int p_port) const {
+VisualShaderNodeFloatOp::PortType VisualShaderNodeFloatOp::get_output_port_type(int p_port) const {
return PORT_TYPE_SCALAR;
}
-String VisualShaderNodeScalarOp::get_output_port_name(int p_port) const {
+String VisualShaderNodeFloatOp::get_output_port_name(int p_port) const {
return "op"; //no output port means the editor will be used as port
}
-String VisualShaderNodeScalarOp::generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview) const {
+String VisualShaderNodeFloatOp::generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview) const {
String code = "\t" + p_output_vars[0] + " = ";
switch (op) {
@@ -986,27 +1047,27 @@ String VisualShaderNodeScalarOp::generate_code(Shader::Mode p_mode, VisualShader
return code;
}
-void VisualShaderNodeScalarOp::set_operator(Operator p_op) {
+void VisualShaderNodeFloatOp::set_operator(Operator p_op) {
op = p_op;
emit_changed();
}
-VisualShaderNodeScalarOp::Operator VisualShaderNodeScalarOp::get_operator() const {
+VisualShaderNodeFloatOp::Operator VisualShaderNodeFloatOp::get_operator() const {
return op;
}
-Vector<StringName> VisualShaderNodeScalarOp::get_editable_properties() const {
+Vector<StringName> VisualShaderNodeFloatOp::get_editable_properties() const {
Vector<StringName> props;
props.push_back("operator");
return props;
}
-void VisualShaderNodeScalarOp::_bind_methods() {
+void VisualShaderNodeFloatOp::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_operator", "op"), &VisualShaderNodeScalarOp::set_operator);
- ClassDB::bind_method(D_METHOD("get_operator"), &VisualShaderNodeScalarOp::get_operator);
+ ClassDB::bind_method(D_METHOD("set_operator", "op"), &VisualShaderNodeFloatOp::set_operator);
+ ClassDB::bind_method(D_METHOD("get_operator"), &VisualShaderNodeFloatOp::get_operator);
ADD_PROPERTY(PropertyInfo(Variant::INT, "operator", PROPERTY_HINT_ENUM, "Add,Sub,Multiply,Divide,Remainder,Power,Max,Min,Atan2,Step"), "set_operator", "get_operator");
@@ -1022,12 +1083,97 @@ void VisualShaderNodeScalarOp::_bind_methods() {
BIND_ENUM_CONSTANT(OP_STEP);
}
-VisualShaderNodeScalarOp::VisualShaderNodeScalarOp() {
+VisualShaderNodeFloatOp::VisualShaderNodeFloatOp() {
op = OP_ADD;
set_input_port_default_value(0, 0.0);
set_input_port_default_value(1, 0.0);
}
+////////////// Integer Op
+
+String VisualShaderNodeIntOp::get_caption() const {
+ return "IntOp";
+}
+
+int VisualShaderNodeIntOp::get_input_port_count() const {
+ return 2;
+}
+
+VisualShaderNodeIntOp::PortType VisualShaderNodeIntOp::get_input_port_type(int p_port) const {
+ return PORT_TYPE_SCALAR_INT;
+}
+
+String VisualShaderNodeIntOp::get_input_port_name(int p_port) const {
+ return p_port == 0 ? "a" : "b";
+}
+
+int VisualShaderNodeIntOp::get_output_port_count() const {
+ return 1;
+}
+
+VisualShaderNodeIntOp::PortType VisualShaderNodeIntOp::get_output_port_type(int p_port) const {
+ return PORT_TYPE_SCALAR_INT;
+}
+
+String VisualShaderNodeIntOp::get_output_port_name(int p_port) const {
+ return "op"; //no output port means the editor will be used as port
+}
+
+String VisualShaderNodeIntOp::generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview) const {
+
+ String code = "\t" + p_output_vars[0] + " = ";
+ switch (op) {
+
+ case OP_ADD: code += p_input_vars[0] + " + " + p_input_vars[1] + ";\n"; break;
+ case OP_SUB: code += p_input_vars[0] + " - " + p_input_vars[1] + ";\n"; break;
+ case OP_MUL: code += p_input_vars[0] + " * " + p_input_vars[1] + ";\n"; break;
+ case OP_DIV: code += p_input_vars[0] + " / " + p_input_vars[1] + ";\n"; break;
+ case OP_MOD: code += p_input_vars[0] + " % " + p_input_vars[1] + ";\n"; break;
+ case OP_MAX: code += "max(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n"; break;
+ case OP_MIN: code += "min(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n"; break;
+ }
+
+ return code;
+}
+
+void VisualShaderNodeIntOp::set_operator(Operator p_op) {
+
+ op = p_op;
+ emit_changed();
+}
+
+VisualShaderNodeIntOp::Operator VisualShaderNodeIntOp::get_operator() const {
+ return op;
+}
+
+Vector<StringName> VisualShaderNodeIntOp::get_editable_properties() const {
+ Vector<StringName> props;
+ props.push_back("operator");
+ return props;
+}
+
+void VisualShaderNodeIntOp::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("set_operator", "op"), &VisualShaderNodeIntOp::set_operator);
+ ClassDB::bind_method(D_METHOD("get_operator"), &VisualShaderNodeIntOp::get_operator);
+
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "operator", PROPERTY_HINT_ENUM, "Add,Sub,Multiply,Divide,Remainder,Max,Min"), "set_operator", "get_operator");
+
+ BIND_ENUM_CONSTANT(OP_ADD);
+ BIND_ENUM_CONSTANT(OP_SUB);
+ BIND_ENUM_CONSTANT(OP_MUL);
+ BIND_ENUM_CONSTANT(OP_DIV);
+ BIND_ENUM_CONSTANT(OP_MOD);
+ BIND_ENUM_CONSTANT(OP_MAX);
+ BIND_ENUM_CONSTANT(OP_MIN);
+}
+
+VisualShaderNodeIntOp::VisualShaderNodeIntOp() {
+ op = OP_ADD;
+ set_input_port_default_value(0, 0);
+ set_input_port_default_value(1, 0);
+}
+
////////////// Vector Op
String VisualShaderNodeVectorOp::get_caption() const {
@@ -1462,37 +1608,37 @@ VisualShaderNodeTransformVecMult::VisualShaderNodeTransformVecMult() {
set_input_port_default_value(1, Vector3());
}
-////////////// Scalar Func
+////////////// Float Func
-String VisualShaderNodeScalarFunc::get_caption() const {
- return "ScalarFunc";
+String VisualShaderNodeFloatFunc::get_caption() const {
+ return "FloatFunc";
}
-int VisualShaderNodeScalarFunc::get_input_port_count() const {
+int VisualShaderNodeFloatFunc::get_input_port_count() const {
return 1;
}
-VisualShaderNodeScalarFunc::PortType VisualShaderNodeScalarFunc::get_input_port_type(int p_port) const {
+VisualShaderNodeFloatFunc::PortType VisualShaderNodeFloatFunc::get_input_port_type(int p_port) const {
return PORT_TYPE_SCALAR;
}
-String VisualShaderNodeScalarFunc::get_input_port_name(int p_port) const {
+String VisualShaderNodeFloatFunc::get_input_port_name(int p_port) const {
return "";
}
-int VisualShaderNodeScalarFunc::get_output_port_count() const {
+int VisualShaderNodeFloatFunc::get_output_port_count() const {
return 1;
}
-VisualShaderNodeScalarFunc::PortType VisualShaderNodeScalarFunc::get_output_port_type(int p_port) const {
+VisualShaderNodeFloatFunc::PortType VisualShaderNodeFloatFunc::get_output_port_type(int p_port) const {
return PORT_TYPE_SCALAR;
}
-String VisualShaderNodeScalarFunc::get_output_port_name(int p_port) const {
+String VisualShaderNodeFloatFunc::get_output_port_name(int p_port) const {
return ""; //no output port means the editor will be used as port
}
-String VisualShaderNodeScalarFunc::generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview) const {
+String VisualShaderNodeFloatFunc::generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview) const {
static const char *scalar_func_id[FUNC_ONEMINUS + 1] = {
"sin($)",
@@ -1532,27 +1678,27 @@ String VisualShaderNodeScalarFunc::generate_code(Shader::Mode p_mode, VisualShad
return "\t" + p_output_vars[0] + " = " + String(scalar_func_id[func]).replace("$", p_input_vars[0]) + ";\n";
}
-void VisualShaderNodeScalarFunc::set_function(Function p_func) {
+void VisualShaderNodeFloatFunc::set_function(Function p_func) {
func = p_func;
emit_changed();
}
-VisualShaderNodeScalarFunc::Function VisualShaderNodeScalarFunc::get_function() const {
+VisualShaderNodeFloatFunc::Function VisualShaderNodeFloatFunc::get_function() const {
return func;
}
-Vector<StringName> VisualShaderNodeScalarFunc::get_editable_properties() const {
+Vector<StringName> VisualShaderNodeFloatFunc::get_editable_properties() const {
Vector<StringName> props;
props.push_back("function");
return props;
}
-void VisualShaderNodeScalarFunc::_bind_methods() {
+void VisualShaderNodeFloatFunc::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_function", "func"), &VisualShaderNodeScalarFunc::set_function);
- ClassDB::bind_method(D_METHOD("get_function"), &VisualShaderNodeScalarFunc::get_function);
+ ClassDB::bind_method(D_METHOD("set_function", "func"), &VisualShaderNodeFloatFunc::set_function);
+ ClassDB::bind_method(D_METHOD("get_function"), &VisualShaderNodeFloatFunc::get_function);
ADD_PROPERTY(PropertyInfo(Variant::INT, "function", PROPERTY_HINT_ENUM, "Sin,Cos,Tan,ASin,ACos,ATan,SinH,CosH,TanH,Log,Exp,Sqrt,Abs,Sign,Floor,Round,Ceil,Frac,Saturate,Negate,ACosH,ASinH,ATanH,Degrees,Exp2,InverseSqrt,Log2,Radians,Reciprocal,RoundEven,Trunc,OneMinus"), "set_function", "get_function");
@@ -1590,11 +1736,108 @@ void VisualShaderNodeScalarFunc::_bind_methods() {
BIND_ENUM_CONSTANT(FUNC_ONEMINUS);
}
-VisualShaderNodeScalarFunc::VisualShaderNodeScalarFunc() {
+VisualShaderNodeFloatFunc::VisualShaderNodeFloatFunc() {
func = FUNC_SIGN;
set_input_port_default_value(0, 0.0);
}
+////////////// Int Func
+
+String VisualShaderNodeIntFunc::get_caption() const {
+ return "IntFunc";
+}
+
+int VisualShaderNodeIntFunc::get_input_port_count() const {
+ if (func == FUNC_CLAMP) {
+ return 3;
+ }
+ return 1;
+}
+
+VisualShaderNodeIntFunc::PortType VisualShaderNodeIntFunc::get_input_port_type(int p_port) const {
+ return PORT_TYPE_SCALAR_INT;
+}
+
+String VisualShaderNodeIntFunc::get_input_port_name(int p_port) const {
+ if (func == FUNC_CLAMP) {
+ if (p_port == 0) {
+ return "";
+ } else if (p_port == 1) {
+ return "min";
+ } else if (p_port == 2) {
+ return "max";
+ }
+ }
+ return "";
+}
+
+int VisualShaderNodeIntFunc::get_output_port_count() const {
+ return 1;
+}
+
+VisualShaderNodeIntFunc::PortType VisualShaderNodeIntFunc::get_output_port_type(int p_port) const {
+ return PORT_TYPE_SCALAR_INT;
+}
+
+String VisualShaderNodeIntFunc::get_output_port_name(int p_port) const {
+ return ""; //no output port means the editor will be used as port
+}
+
+String VisualShaderNodeIntFunc::generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview) const {
+ if (func == FUNC_CLAMP) {
+ return "\t" + p_output_vars[0] + " = clamp(" + p_input_vars[0] + ", " + p_input_vars[1] + ", " + p_input_vars[2] + ");\n";
+ }
+
+ static const char *int_func_id[FUNC_SIGN + 1] = {
+ "abs($)",
+ "",
+ "-($)",
+ "sign($)"
+ };
+
+ return "\t" + p_output_vars[0] + " = " + String(int_func_id[func]).replace("$", p_input_vars[0]) + ";\n";
+}
+
+void VisualShaderNodeIntFunc::set_function(Function p_func) {
+ if (func != p_func) {
+ if (p_func == FUNC_CLAMP) {
+ set_input_port_default_value(1, 0);
+ set_input_port_default_value(2, 0);
+ }
+ }
+ func = p_func;
+ emit_changed();
+}
+
+VisualShaderNodeIntFunc::Function VisualShaderNodeIntFunc::get_function() const {
+
+ return func;
+}
+
+Vector<StringName> VisualShaderNodeIntFunc::get_editable_properties() const {
+ Vector<StringName> props;
+ props.push_back("function");
+ return props;
+}
+
+void VisualShaderNodeIntFunc::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("set_function", "func"), &VisualShaderNodeIntFunc::set_function);
+ ClassDB::bind_method(D_METHOD("get_function"), &VisualShaderNodeIntFunc::get_function);
+
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "function", PROPERTY_HINT_ENUM, "Abs,Clamp,Negate,Sign"), "set_function", "get_function");
+
+ BIND_ENUM_CONSTANT(FUNC_ABS);
+ BIND_ENUM_CONSTANT(FUNC_CLAMP);
+ BIND_ENUM_CONSTANT(FUNC_NEGATE);
+ BIND_ENUM_CONSTANT(FUNC_SIGN);
+}
+
+VisualShaderNodeIntFunc::VisualShaderNodeIntFunc() {
+ func = FUNC_SIGN;
+ set_input_port_default_value(0, 0);
+}
+
////////////// Vector Func
String VisualShaderNodeVectorFunc::get_caption() const {
@@ -3008,37 +3251,37 @@ VisualShaderNodeTransformDecompose::VisualShaderNodeTransformDecompose() {
set_input_port_default_value(0, Transform());
}
-////////////// Scalar Uniform
+////////////// Float Uniform
-String VisualShaderNodeScalarUniform::get_caption() const {
- return "ScalarUniform";
+String VisualShaderNodeFloatUniform::get_caption() const {
+ return "FloatUniform";
}
-int VisualShaderNodeScalarUniform::get_input_port_count() const {
+int VisualShaderNodeFloatUniform::get_input_port_count() const {
return 0;
}
-VisualShaderNodeScalarUniform::PortType VisualShaderNodeScalarUniform::get_input_port_type(int p_port) const {
+VisualShaderNodeFloatUniform::PortType VisualShaderNodeFloatUniform::get_input_port_type(int p_port) const {
return PORT_TYPE_SCALAR;
}
-String VisualShaderNodeScalarUniform::get_input_port_name(int p_port) const {
+String VisualShaderNodeFloatUniform::get_input_port_name(int p_port) const {
return String();
}
-int VisualShaderNodeScalarUniform::get_output_port_count() const {
+int VisualShaderNodeFloatUniform::get_output_port_count() const {
return 1;
}
-VisualShaderNodeScalarUniform::PortType VisualShaderNodeScalarUniform::get_output_port_type(int p_port) const {
+VisualShaderNodeFloatUniform::PortType VisualShaderNodeFloatUniform::get_output_port_type(int p_port) const {
return PORT_TYPE_SCALAR;
}
-String VisualShaderNodeScalarUniform::get_output_port_name(int p_port) const {
+String VisualShaderNodeFloatUniform::get_output_port_name(int p_port) const {
return ""; //no output port means the editor will be used as port
}
-String VisualShaderNodeScalarUniform::generate_global(Shader::Mode p_mode, VisualShader::Type p_type, int p_id) const {
+String VisualShaderNodeFloatUniform::generate_global(Shader::Mode p_mode, VisualShader::Type p_type, int p_id) const {
if (hint == HINT_RANGE) {
return "uniform float " + get_uniform_name() + " : hint_range(" + rtos(hint_range_min) + ", " + rtos(hint_range_max) + ");\n";
} else if (hint == HINT_RANGE_STEP) {
@@ -3047,70 +3290,70 @@ String VisualShaderNodeScalarUniform::generate_global(Shader::Mode p_mode, Visua
return "uniform float " + get_uniform_name() + ";\n";
}
-String VisualShaderNodeScalarUniform::generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview) const {
+String VisualShaderNodeFloatUniform::generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview) const {
return "\t" + p_output_vars[0] + " = " + get_uniform_name() + ";\n";
}
-void VisualShaderNodeScalarUniform::set_hint(Hint p_hint) {
+void VisualShaderNodeFloatUniform::set_hint(Hint p_hint) {
hint = p_hint;
emit_changed();
}
-VisualShaderNodeScalarUniform::Hint VisualShaderNodeScalarUniform::get_hint() const {
+VisualShaderNodeFloatUniform::Hint VisualShaderNodeFloatUniform::get_hint() const {
return hint;
}
-void VisualShaderNodeScalarUniform::set_min(float p_value) {
+void VisualShaderNodeFloatUniform::set_min(float p_value) {
hint_range_min = p_value;
emit_changed();
}
-float VisualShaderNodeScalarUniform::get_min() const {
+float VisualShaderNodeFloatUniform::get_min() const {
return hint_range_min;
}
-void VisualShaderNodeScalarUniform::set_max(float p_value) {
+void VisualShaderNodeFloatUniform::set_max(float p_value) {
hint_range_max = p_value;
emit_changed();
}
-float VisualShaderNodeScalarUniform::get_max() const {
+float VisualShaderNodeFloatUniform::get_max() const {
return hint_range_max;
}
-void VisualShaderNodeScalarUniform::set_step(float p_value) {
+void VisualShaderNodeFloatUniform::set_step(float p_value) {
hint_range_step = p_value;
emit_changed();
}
-float VisualShaderNodeScalarUniform::get_step() const {
+float VisualShaderNodeFloatUniform::get_step() const {
return hint_range_step;
}
-void VisualShaderNodeScalarUniform::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_hint", "hint"), &VisualShaderNodeScalarUniform::set_hint);
- ClassDB::bind_method(D_METHOD("get_hint"), &VisualShaderNodeScalarUniform::get_hint);
+void VisualShaderNodeFloatUniform::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("set_hint", "hint"), &VisualShaderNodeFloatUniform::set_hint);
+ ClassDB::bind_method(D_METHOD("get_hint"), &VisualShaderNodeFloatUniform::get_hint);
- ClassDB::bind_method(D_METHOD("set_min", "value"), &VisualShaderNodeScalarUniform::set_min);
- ClassDB::bind_method(D_METHOD("get_min"), &VisualShaderNodeScalarUniform::get_min);
+ ClassDB::bind_method(D_METHOD("set_min", "value"), &VisualShaderNodeFloatUniform::set_min);
+ ClassDB::bind_method(D_METHOD("get_min"), &VisualShaderNodeFloatUniform::get_min);
- ClassDB::bind_method(D_METHOD("set_max", "value"), &VisualShaderNodeScalarUniform::set_max);
- ClassDB::bind_method(D_METHOD("get_max"), &VisualShaderNodeScalarUniform::get_max);
+ ClassDB::bind_method(D_METHOD("set_max", "value"), &VisualShaderNodeFloatUniform::set_max);
+ ClassDB::bind_method(D_METHOD("get_max"), &VisualShaderNodeFloatUniform::get_max);
- ClassDB::bind_method(D_METHOD("set_step", "value"), &VisualShaderNodeScalarUniform::set_step);
- ClassDB::bind_method(D_METHOD("get_step"), &VisualShaderNodeScalarUniform::get_step);
+ ClassDB::bind_method(D_METHOD("set_step", "value"), &VisualShaderNodeFloatUniform::set_step);
+ ClassDB::bind_method(D_METHOD("get_step"), &VisualShaderNodeFloatUniform::get_step);
ADD_PROPERTY(PropertyInfo(Variant::INT, "hint", PROPERTY_HINT_ENUM, "None,Range,Range+Step"), "set_hint", "get_hint");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "min"), "set_min", "get_min");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "max"), "set_max", "get_max");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "step"), "set_step", "get_step");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "min"), "set_min", "get_min");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "max"), "set_max", "get_max");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "step"), "set_step", "get_step");
BIND_ENUM_CONSTANT(HINT_NONE);
BIND_ENUM_CONSTANT(HINT_RANGE);
BIND_ENUM_CONSTANT(HINT_RANGE_STEP);
}
-Vector<StringName> VisualShaderNodeScalarUniform::get_editable_properties() const {
+Vector<StringName> VisualShaderNodeFloatUniform::get_editable_properties() const {
Vector<StringName> props;
props.push_back("hint");
if (hint == HINT_RANGE || hint == HINT_RANGE_STEP) {
@@ -3123,13 +3366,135 @@ Vector<StringName> VisualShaderNodeScalarUniform::get_editable_properties() cons
return props;
}
-VisualShaderNodeScalarUniform::VisualShaderNodeScalarUniform() {
+VisualShaderNodeFloatUniform::VisualShaderNodeFloatUniform() {
hint = HINT_NONE;
hint_range_min = 0.0;
hint_range_max = 1.0;
hint_range_step = 0.1;
}
+////////////// Integer Uniform
+
+String VisualShaderNodeIntUniform::get_caption() const {
+ return "IntUniform";
+}
+
+int VisualShaderNodeIntUniform::get_input_port_count() const {
+ return 0;
+}
+
+VisualShaderNodeIntUniform::PortType VisualShaderNodeIntUniform::get_input_port_type(int p_port) const {
+ return PORT_TYPE_SCALAR_INT;
+}
+
+String VisualShaderNodeIntUniform::get_input_port_name(int p_port) const {
+ return String();
+}
+
+int VisualShaderNodeIntUniform::get_output_port_count() const {
+ return 1;
+}
+
+VisualShaderNodeIntUniform::PortType VisualShaderNodeIntUniform::get_output_port_type(int p_port) const {
+ return PORT_TYPE_SCALAR_INT;
+}
+
+String VisualShaderNodeIntUniform::get_output_port_name(int p_port) const {
+ return ""; //no output port means the editor will be used as port
+}
+
+String VisualShaderNodeIntUniform::generate_global(Shader::Mode p_mode, VisualShader::Type p_type, int p_id) const {
+ if (hint == HINT_RANGE) {
+ return "uniform int " + get_uniform_name() + " : hint_range(" + rtos(hint_range_min) + ", " + rtos(hint_range_max) + ");\n";
+ } else if (hint == HINT_RANGE_STEP) {
+ return "uniform int " + get_uniform_name() + " : hint_range(" + rtos(hint_range_min) + ", " + rtos(hint_range_max) + ", " + rtos(hint_range_step) + ");\n";
+ }
+ return "uniform int " + get_uniform_name() + ";\n";
+}
+
+String VisualShaderNodeIntUniform::generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview) const {
+ return "\t" + p_output_vars[0] + " = " + get_uniform_name() + ";\n";
+}
+
+void VisualShaderNodeIntUniform::set_hint(Hint p_hint) {
+ hint = p_hint;
+ emit_changed();
+}
+
+VisualShaderNodeIntUniform::Hint VisualShaderNodeIntUniform::get_hint() const {
+ return hint;
+}
+
+void VisualShaderNodeIntUniform::set_min(int p_value) {
+ hint_range_min = p_value;
+ emit_changed();
+}
+
+int VisualShaderNodeIntUniform::get_min() const {
+ return hint_range_min;
+}
+
+void VisualShaderNodeIntUniform::set_max(int p_value) {
+ hint_range_max = p_value;
+ emit_changed();
+}
+
+int VisualShaderNodeIntUniform::get_max() const {
+ return hint_range_max;
+}
+
+void VisualShaderNodeIntUniform::set_step(int p_value) {
+ hint_range_step = p_value;
+ emit_changed();
+}
+
+int VisualShaderNodeIntUniform::get_step() const {
+ return hint_range_step;
+}
+
+void VisualShaderNodeIntUniform::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("set_hint", "hint"), &VisualShaderNodeIntUniform::set_hint);
+ ClassDB::bind_method(D_METHOD("get_hint"), &VisualShaderNodeIntUniform::get_hint);
+
+ ClassDB::bind_method(D_METHOD("set_min", "value"), &VisualShaderNodeIntUniform::set_min);
+ ClassDB::bind_method(D_METHOD("get_min"), &VisualShaderNodeIntUniform::get_min);
+
+ ClassDB::bind_method(D_METHOD("set_max", "value"), &VisualShaderNodeIntUniform::set_max);
+ ClassDB::bind_method(D_METHOD("get_max"), &VisualShaderNodeIntUniform::get_max);
+
+ ClassDB::bind_method(D_METHOD("set_step", "value"), &VisualShaderNodeIntUniform::set_step);
+ ClassDB::bind_method(D_METHOD("get_step"), &VisualShaderNodeIntUniform::get_step);
+
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "hint", PROPERTY_HINT_ENUM, "None,Range,Range+Step"), "set_hint", "get_hint");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "min"), "set_min", "get_min");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "max"), "set_max", "get_max");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "step"), "set_step", "get_step");
+
+ BIND_ENUM_CONSTANT(HINT_NONE);
+ BIND_ENUM_CONSTANT(HINT_RANGE);
+ BIND_ENUM_CONSTANT(HINT_RANGE_STEP);
+}
+
+Vector<StringName> VisualShaderNodeIntUniform::get_editable_properties() const {
+ Vector<StringName> props;
+ props.push_back("hint");
+ if (hint == HINT_RANGE || hint == HINT_RANGE_STEP) {
+ props.push_back("min");
+ props.push_back("max");
+ }
+ if (hint == HINT_RANGE_STEP) {
+ props.push_back("step");
+ }
+ return props;
+}
+
+VisualShaderNodeIntUniform::VisualShaderNodeIntUniform() {
+ hint = HINT_NONE;
+ hint_range_min = 0;
+ hint_range_max = 100;
+ hint_range_step = 1;
+}
+
////////////// Boolean Uniform
String VisualShaderNodeBooleanUniform::get_caption() const {
@@ -3968,6 +4333,8 @@ VisualShaderNodeCompare::PortType VisualShaderNodeCompare::get_input_port_type(i
switch (ctype) {
case CTYPE_SCALAR:
return PORT_TYPE_SCALAR;
+ case CTYPE_SCALAR_INT:
+ return PORT_TYPE_SCALAR_INT;
case CTYPE_VECTOR:
return PORT_TYPE_VECTOR;
case CTYPE_BOOLEAN:
@@ -4046,10 +4413,14 @@ String VisualShaderNodeCompare::generate_code(Shader::Mode p_mode, VisualShader:
} else if (func == FUNC_NOT_EQUAL) {
code += "\t" + p_output_vars[0] + " = !(abs(" + p_input_vars[0] + " - " + p_input_vars[1] + ") < " + p_input_vars[2] + ");";
} else {
- code += "\t" + p_output_vars[0] + " = " + (p_input_vars[0] + "$" + p_input_vars[1]).replace("$", ops[func]) + ";\n";
+ code += "\t" + p_output_vars[0] + " = " + (p_input_vars[0] + " $ " + p_input_vars[1]).replace("$", ops[func]) + ";\n";
}
break;
+ case CTYPE_SCALAR_INT:
+ code += "\t" + p_output_vars[0] + " = " + (p_input_vars[0] + " $ " + p_input_vars[1]).replace("$", ops[func]) + ";\n";
+ break;
+
case CTYPE_VECTOR:
code += "\t{\n";
code += "\t\tbvec3 _bv = " + String(funcs[func]).replace("$", p_input_vars[0] + ", " + p_input_vars[1]) + ";\n";
@@ -4085,6 +4456,11 @@ void VisualShaderNodeCompare::set_comparison_type(ComparisonType p_type) {
set_input_port_default_value(1, 0.0);
simple_decl = true;
break;
+ case CTYPE_SCALAR_INT:
+ set_input_port_default_value(0, 0);
+ set_input_port_default_value(1, 0);
+ simple_decl = true;
+ break;
case CTYPE_VECTOR:
set_input_port_default_value(0, Vector3(0.0, 0.0, 0.0));
set_input_port_default_value(1, Vector3(0.0, 0.0, 0.0));
@@ -4151,11 +4527,12 @@ void VisualShaderNodeCompare::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_condition", "condition"), &VisualShaderNodeCompare::set_condition);
ClassDB::bind_method(D_METHOD("get_condition"), &VisualShaderNodeCompare::get_condition);
- ADD_PROPERTY(PropertyInfo(Variant::INT, "type", PROPERTY_HINT_ENUM, "Scalar,Vector,Boolean,Transform"), "set_comparison_type", "get_comparison_type");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "type", PROPERTY_HINT_ENUM, "Float,Int,Vector,Boolean,Transform"), "set_comparison_type", "get_comparison_type");
ADD_PROPERTY(PropertyInfo(Variant::INT, "function", PROPERTY_HINT_ENUM, "a == b,a != b,a > b,a >= b,a < b,a <= b"), "set_function", "get_function");
ADD_PROPERTY(PropertyInfo(Variant::INT, "condition", PROPERTY_HINT_ENUM, "All,Any"), "set_condition", "get_condition");
BIND_ENUM_CONSTANT(CTYPE_SCALAR);
+ BIND_ENUM_CONSTANT(CTYPE_SCALAR_INT);
BIND_ENUM_CONSTANT(CTYPE_VECTOR);
BIND_ENUM_CONSTANT(CTYPE_BOOLEAN);
BIND_ENUM_CONSTANT(CTYPE_TRANSFORM);
diff --git a/scene/resources/visual_shader_nodes.h b/scene/resources/visual_shader_nodes.h
index 85782bc509..035e39230c 100644
--- a/scene/resources/visual_shader_nodes.h
+++ b/scene/resources/visual_shader_nodes.h
@@ -37,8 +37,8 @@
/// CONSTANTS
///////////////////////////////////////
-class VisualShaderNodeScalarConstant : public VisualShaderNode {
- GDCLASS(VisualShaderNodeScalarConstant, VisualShaderNode);
+class VisualShaderNodeFloatConstant : public VisualShaderNode {
+ GDCLASS(VisualShaderNodeFloatConstant, VisualShaderNode);
float constant;
protected:
@@ -62,7 +62,37 @@ public:
virtual Vector<StringName> get_editable_properties() const;
- VisualShaderNodeScalarConstant();
+ VisualShaderNodeFloatConstant();
+};
+
+///////////////////////////////////////
+
+class VisualShaderNodeIntConstant : public VisualShaderNode {
+ GDCLASS(VisualShaderNodeIntConstant, VisualShaderNode);
+ int constant;
+
+protected:
+ static void _bind_methods();
+
+public:
+ virtual String get_caption() const;
+
+ virtual int get_input_port_count() const;
+ virtual PortType get_input_port_type(int p_port) const;
+ virtual String get_input_port_name(int p_port) const;
+
+ virtual int get_output_port_count() const;
+ virtual PortType get_output_port_type(int p_port) const;
+ virtual String get_output_port_name(int p_port) const;
+
+ virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
+
+ void set_constant(int p_value);
+ int get_constant() const;
+
+ virtual Vector<StringName> get_editable_properties() const;
+
+ VisualShaderNodeIntConstant();
};
///////////////////////////////////////
@@ -314,8 +344,8 @@ VARIANT_ENUM_CAST(VisualShaderNodeCubemap::Source)
/// OPS
///////////////////////////////////////
-class VisualShaderNodeScalarOp : public VisualShaderNode {
- GDCLASS(VisualShaderNodeScalarOp, VisualShaderNode);
+class VisualShaderNodeFloatOp : public VisualShaderNode {
+ GDCLASS(VisualShaderNodeFloatOp, VisualShaderNode);
public:
enum Operator {
@@ -354,10 +384,52 @@ public:
virtual Vector<StringName> get_editable_properties() const;
- VisualShaderNodeScalarOp();
+ VisualShaderNodeFloatOp();
};
-VARIANT_ENUM_CAST(VisualShaderNodeScalarOp::Operator)
+VARIANT_ENUM_CAST(VisualShaderNodeFloatOp::Operator)
+
+class VisualShaderNodeIntOp : public VisualShaderNode {
+ GDCLASS(VisualShaderNodeIntOp, VisualShaderNode);
+
+public:
+ enum Operator {
+ OP_ADD,
+ OP_SUB,
+ OP_MUL,
+ OP_DIV,
+ OP_MOD,
+ OP_MAX,
+ OP_MIN,
+ };
+
+protected:
+ Operator op;
+
+ static void _bind_methods();
+
+public:
+ virtual String get_caption() const;
+
+ virtual int get_input_port_count() const;
+ virtual PortType get_input_port_type(int p_port) const;
+ virtual String get_input_port_name(int p_port) const;
+
+ virtual int get_output_port_count() const;
+ virtual PortType get_output_port_type(int p_port) const;
+ virtual String get_output_port_name(int p_port) const;
+
+ virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
+
+ void set_operator(Operator p_op);
+ Operator get_operator() const;
+
+ virtual Vector<StringName> get_editable_properties() const;
+
+ VisualShaderNodeIntOp();
+};
+
+VARIANT_ENUM_CAST(VisualShaderNodeIntOp::Operator)
class VisualShaderNodeVectorOp : public VisualShaderNode {
GDCLASS(VisualShaderNodeVectorOp, VisualShaderNode);
@@ -539,11 +611,11 @@ public:
VARIANT_ENUM_CAST(VisualShaderNodeTransformVecMult::Operator)
///////////////////////////////////////
-/// SCALAR FUNC
+/// FLOAT FUNC
///////////////////////////////////////
-class VisualShaderNodeScalarFunc : public VisualShaderNode {
- GDCLASS(VisualShaderNodeScalarFunc, VisualShaderNode);
+class VisualShaderNodeFloatFunc : public VisualShaderNode {
+ GDCLASS(VisualShaderNodeFloatFunc, VisualShaderNode);
public:
enum Function {
@@ -604,10 +676,53 @@ public:
virtual Vector<StringName> get_editable_properties() const;
- VisualShaderNodeScalarFunc();
+ VisualShaderNodeFloatFunc();
+};
+
+VARIANT_ENUM_CAST(VisualShaderNodeFloatFunc::Function)
+
+///////////////////////////////////////
+/// INT FUNC
+///////////////////////////////////////
+
+class VisualShaderNodeIntFunc : public VisualShaderNode {
+ GDCLASS(VisualShaderNodeIntFunc, VisualShaderNode);
+
+public:
+ enum Function {
+ FUNC_ABS,
+ FUNC_CLAMP,
+ FUNC_NEGATE,
+ FUNC_SIGN,
+ };
+
+protected:
+ Function func;
+
+ static void _bind_methods();
+
+public:
+ virtual String get_caption() const;
+
+ virtual int get_input_port_count() const;
+ virtual PortType get_input_port_type(int p_port) const;
+ virtual String get_input_port_name(int p_port) const;
+
+ virtual int get_output_port_count() const;
+ virtual PortType get_output_port_type(int p_port) const;
+ virtual String get_output_port_name(int p_port) const;
+
+ virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
+
+ void set_function(Function p_func);
+ Function get_function() const;
+
+ virtual Vector<StringName> get_editable_properties() const;
+
+ VisualShaderNodeIntFunc();
};
-VARIANT_ENUM_CAST(VisualShaderNodeScalarFunc::Function)
+VARIANT_ENUM_CAST(VisualShaderNodeIntFunc::Function)
///////////////////////////////////////
/// VECTOR FUNC
@@ -1297,8 +1412,8 @@ public:
/// UNIFORMS
///////////////////////////////////////
-class VisualShaderNodeScalarUniform : public VisualShaderNodeUniform {
- GDCLASS(VisualShaderNodeScalarUniform, VisualShaderNodeUniform);
+class VisualShaderNodeFloatUniform : public VisualShaderNodeUniform {
+ GDCLASS(VisualShaderNodeFloatUniform, VisualShaderNodeUniform);
public:
enum Hint {
@@ -1344,10 +1459,62 @@ public:
virtual Vector<StringName> get_editable_properties() const;
- VisualShaderNodeScalarUniform();
+ VisualShaderNodeFloatUniform();
+};
+
+VARIANT_ENUM_CAST(VisualShaderNodeFloatUniform::Hint)
+
+class VisualShaderNodeIntUniform : public VisualShaderNodeUniform {
+ GDCLASS(VisualShaderNodeIntUniform, VisualShaderNodeUniform);
+
+public:
+ enum Hint {
+ HINT_NONE,
+ HINT_RANGE,
+ HINT_RANGE_STEP,
+ };
+
+private:
+ Hint hint;
+ int hint_range_min;
+ int hint_range_max;
+ int hint_range_step;
+
+protected:
+ static void _bind_methods();
+
+public:
+ virtual String get_caption() const;
+
+ virtual int get_input_port_count() const;
+ virtual PortType get_input_port_type(int p_port) const;
+ virtual String get_input_port_name(int p_port) const;
+
+ virtual int get_output_port_count() const;
+ virtual PortType get_output_port_type(int p_port) const;
+ virtual String get_output_port_name(int p_port) const;
+
+ virtual String generate_global(Shader::Mode p_mode, VisualShader::Type p_type, int p_id) const;
+ virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty
+
+ void set_hint(Hint p_hint);
+ Hint get_hint() const;
+
+ void set_min(int p_value);
+ int get_min() const;
+
+ void set_max(int p_value);
+ int get_max() const;
+
+ void set_step(int p_value);
+ int get_step() const;
+
+ virtual Vector<StringName> get_editable_properties() const;
+
+ VisualShaderNodeIntUniform();
};
-VARIANT_ENUM_CAST(VisualShaderNodeScalarUniform::Hint)
+VARIANT_ENUM_CAST(VisualShaderNodeIntUniform::Hint)
///////////////////////////////////////
@@ -1669,9 +1836,10 @@ class VisualShaderNodeCompare : public VisualShaderNode {
public:
enum ComparisonType {
CTYPE_SCALAR,
+ CTYPE_SCALAR_INT,
CTYPE_VECTOR,
CTYPE_BOOLEAN,
- CTYPE_TRANSFORM
+ CTYPE_TRANSFORM,
};
enum Function {
diff --git a/scene/resources/world.cpp b/scene/resources/world.cpp
index 78c08080b5..a7e519479f 100644
--- a/scene/resources/world.cpp
+++ b/scene/resources/world.cpp
@@ -360,9 +360,9 @@ World::World() {
PhysicsServer::get_singleton()->area_set_param(space, PhysicsServer::AREA_PARAM_GRAVITY, GLOBAL_DEF("physics/3d/default_gravity", 9.8));
PhysicsServer::get_singleton()->area_set_param(space, PhysicsServer::AREA_PARAM_GRAVITY_VECTOR, GLOBAL_DEF("physics/3d/default_gravity_vector", Vector3(0, -1, 0)));
PhysicsServer::get_singleton()->area_set_param(space, PhysicsServer::AREA_PARAM_LINEAR_DAMP, GLOBAL_DEF("physics/3d/default_linear_damp", 0.1));
- ProjectSettings::get_singleton()->set_custom_property_info("physics/3d/default_linear_damp", PropertyInfo(Variant::REAL, "physics/3d/default_linear_damp", PROPERTY_HINT_RANGE, "-1,100,0.001,or_greater"));
+ ProjectSettings::get_singleton()->set_custom_property_info("physics/3d/default_linear_damp", PropertyInfo(Variant::FLOAT, "physics/3d/default_linear_damp", PROPERTY_HINT_RANGE, "-1,100,0.001,or_greater"));
PhysicsServer::get_singleton()->area_set_param(space, PhysicsServer::AREA_PARAM_ANGULAR_DAMP, GLOBAL_DEF("physics/3d/default_angular_damp", 0.1));
- ProjectSettings::get_singleton()->set_custom_property_info("physics/3d/default_angular_damp", PropertyInfo(Variant::REAL, "physics/3d/default_angular_damp", PROPERTY_HINT_RANGE, "-1,100,0.001,or_greater"));
+ ProjectSettings::get_singleton()->set_custom_property_info("physics/3d/default_angular_damp", PropertyInfo(Variant::FLOAT, "physics/3d/default_angular_damp", PROPERTY_HINT_RANGE, "-1,100,0.001,or_greater"));
#ifdef _3D_DISABLED
indexer = NULL;
diff --git a/scene/resources/world_2d.cpp b/scene/resources/world_2d.cpp
index 5cc809d8e3..6bdc4cf6f0 100644
--- a/scene/resources/world_2d.cpp
+++ b/scene/resources/world_2d.cpp
@@ -394,9 +394,9 @@ World2D::World2D() {
Physics2DServer::get_singleton()->area_set_param(space, Physics2DServer::AREA_PARAM_GRAVITY, GLOBAL_DEF("physics/2d/default_gravity", 98));
Physics2DServer::get_singleton()->area_set_param(space, Physics2DServer::AREA_PARAM_GRAVITY_VECTOR, GLOBAL_DEF("physics/2d/default_gravity_vector", Vector2(0, 1)));
Physics2DServer::get_singleton()->area_set_param(space, Physics2DServer::AREA_PARAM_LINEAR_DAMP, GLOBAL_DEF("physics/2d/default_linear_damp", 0.1));
- ProjectSettings::get_singleton()->set_custom_property_info("physics/2d/default_linear_damp", PropertyInfo(Variant::REAL, "physics/2d/default_linear_damp", PROPERTY_HINT_RANGE, "-1,100,0.001,or_greater"));
+ ProjectSettings::get_singleton()->set_custom_property_info("physics/2d/default_linear_damp", PropertyInfo(Variant::FLOAT, "physics/2d/default_linear_damp", PROPERTY_HINT_RANGE, "-1,100,0.001,or_greater"));
Physics2DServer::get_singleton()->area_set_param(space, Physics2DServer::AREA_PARAM_ANGULAR_DAMP, GLOBAL_DEF("physics/2d/default_angular_damp", 1.0));
- ProjectSettings::get_singleton()->set_custom_property_info("physics/2d/default_angular_damp", PropertyInfo(Variant::REAL, "physics/2d/default_angular_damp", PROPERTY_HINT_RANGE, "-1,100,0.001,or_greater"));
+ ProjectSettings::get_singleton()->set_custom_property_info("physics/2d/default_angular_damp", PropertyInfo(Variant::FLOAT, "physics/2d/default_angular_damp", PROPERTY_HINT_RANGE, "-1,100,0.001,or_greater"));
indexer = memnew(SpatialIndexer2D);
}