diff options
Diffstat (limited to 'scene/resources')
49 files changed, 637 insertions, 602 deletions
diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp index b5c438d953..c962e1a671 100644 --- a/scene/resources/animation.cpp +++ b/scene/resources/animation.cpp @@ -72,6 +72,8 @@ bool Animation::_set(const StringName& p_name, const Variant& p_value) { track_set_path(track,p_value); else if (what=="interp") track_set_interpolation_type(track,InterpolationType(p_value.operator int())); + else if (what=="loop_wrap") + track_set_interpolation_loop_wrap(track,p_value); else if (what=="imported") track_set_imported(track,p_value); else if (what == "keys" || what=="key_values") { @@ -79,14 +81,14 @@ 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]); - DVector<float> values=p_value; + PoolVector<float> values=p_value; int vcount=values.size(); #if 0 // old compatibility hack if ((vcount%11) == 0) { - DVector<float>::Read r = values.read(); + PoolVector<float>::Read r = values.read(); tt->transforms.resize(vcount/11); @@ -121,7 +123,7 @@ bool Animation::_set(const StringName& p_name, const Variant& p_value) { #endif ERR_FAIL_COND_V(vcount%12,false); // shuld be multiple of 11 - DVector<float>::Read r = values.read(); + PoolVector<float>::Read r = values.read(); tt->transforms.resize(vcount/12); @@ -172,7 +174,7 @@ bool Animation::_set(const StringName& p_name, const Variant& p_value) { - DVector<float> times=d["times"]; + PoolVector<float> times=d["times"]; Array values=d["values"]; ERR_FAIL_COND_V(times.size()!=values.size(),false); @@ -181,7 +183,7 @@ bool Animation::_set(const StringName& p_name, const Variant& p_value) { int valcount=times.size(); - DVector<float>::Read rt = times.read(); + PoolVector<float>::Read rt = times.read(); vt->values.resize(valcount); @@ -193,10 +195,10 @@ bool Animation::_set(const StringName& p_name, const Variant& p_value) { if (d.has("transitions")) { - DVector<float> transitions = d["transitions"]; + PoolVector<float> transitions = d["transitions"]; ERR_FAIL_COND_V(transitions.size()!=valcount,false); - DVector<float>::Read rtr = transitions.read(); + PoolVector<float>::Read rtr = transitions.read(); for(int i=0;i<valcount;i++) { @@ -218,7 +220,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); - DVector<float> times=d["times"]; + PoolVector<float> times=d["times"]; Array values=d["values"]; ERR_FAIL_COND_V(times.size()!=values.size(),false); @@ -227,7 +229,7 @@ bool Animation::_set(const StringName& p_name, const Variant& p_value) { int valcount=times.size(); - DVector<float>::Read rt = times.read(); + PoolVector<float>::Read rt = times.read(); for(int i=0;i<valcount;i++) { @@ -236,10 +238,10 @@ bool Animation::_set(const StringName& p_name, const Variant& p_value) { if (d.has("transitions")) { - DVector<float> transitions = d["transitions"]; + PoolVector<float> transitions = d["transitions"]; ERR_FAIL_COND_V(transitions.size()!=valcount,false); - DVector<float>::Read rtr = transitions.read(); + PoolVector<float>::Read rtr = transitions.read(); for(int i=0;i<valcount;i++) { @@ -291,17 +293,19 @@ bool Animation::_get(const StringName& p_name,Variant &r_ret) const { r_ret=track_get_path(track); else if (what=="interp") r_ret = track_get_interpolation_type(track); + else if (what=="loop_wrap") + r_ret = track_get_interpolation_loop_wrap(track); else if (what=="imported") r_ret = track_is_imported(track); else if (what=="keys") { if (track_get_type(track)==TYPE_TRANSFORM) { - DVector<real_t> keys; + PoolVector<real_t> keys; int kk=track_get_key_count(track); keys.resize(kk*12); - DVector<real_t>::Write w = keys.write(); + PoolVector<real_t>::Write w = keys.write(); int idx=0; for(int i=0;i<track_get_key_count(track);i++) { @@ -327,7 +331,7 @@ bool Animation::_get(const StringName& p_name,Variant &r_ret) const { w[idx++]=scale.z; } - w = DVector<real_t>::Write(); + w = PoolVector<real_t>::Write(); r_ret=keys; return true; @@ -338,8 +342,8 @@ bool Animation::_get(const StringName& p_name,Variant &r_ret) const { Dictionary d; - DVector<float> key_times; - DVector<float> key_transitions; + PoolVector<float> key_times; + PoolVector<float> key_transitions; Array key_values; int kk=vt->values.size(); @@ -348,8 +352,8 @@ bool Animation::_get(const StringName& p_name,Variant &r_ret) const { key_transitions.resize(kk); key_values.resize(kk); - DVector<float>::Write wti=key_times.write(); - DVector<float>::Write wtr=key_transitions.write(); + PoolVector<float>::Write wti=key_times.write(); + PoolVector<float>::Write wtr=key_transitions.write(); int idx=0; @@ -363,8 +367,8 @@ bool Animation::_get(const StringName& p_name,Variant &r_ret) const { idx++; } - wti=DVector<float>::Write(); - wtr=DVector<float>::Write(); + wti=PoolVector<float>::Write(); + wtr=PoolVector<float>::Write(); d["times"]=key_times; d["transitions"]=key_transitions; @@ -382,8 +386,8 @@ bool Animation::_get(const StringName& p_name,Variant &r_ret) const { Dictionary d; - DVector<float> key_times; - DVector<float> key_transitions; + PoolVector<float> key_times; + PoolVector<float> key_transitions; Array key_values; int kk=track_get_key_count(track); @@ -392,8 +396,8 @@ bool Animation::_get(const StringName& p_name,Variant &r_ret) const { key_transitions.resize(kk); key_values.resize(kk); - DVector<float>::Write wti=key_times.write(); - DVector<float>::Write wtr=key_transitions.write(); + PoolVector<float>::Write wti=key_times.write(); + PoolVector<float>::Write wtr=key_transitions.write(); int idx=0; for(int i=0;i<track_get_key_count(track);i++) { @@ -404,8 +408,8 @@ bool Animation::_get(const StringName& p_name,Variant &r_ret) const { idx++; } - wti=DVector<float>::Write(); - wtr=DVector<float>::Write(); + wti=PoolVector<float>::Write(); + wtr=PoolVector<float>::Write(); d["times"]=key_times; d["transitions"]=key_transitions; @@ -440,6 +444,7 @@ void Animation::_get_property_list( List<PropertyInfo> *p_list) const { p_list->push_back( PropertyInfo( Variant::STRING, "tracks/"+itos(i)+"/type", PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR) ); p_list->push_back( PropertyInfo( Variant::NODE_PATH, "tracks/"+itos(i)+"/path", PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR) ); p_list->push_back( PropertyInfo( Variant::INT, "tracks/"+itos(i)+"/interp", PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR) ); + p_list->push_back( PropertyInfo( Variant::BOOL, "tracks/"+itos(i)+"/loop_wrap", PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR) ); p_list->push_back( PropertyInfo( Variant::BOOL, "tracks/"+itos(i)+"/imported", PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR) ); p_list->push_back( PropertyInfo( Variant::ARRAY, "tracks/"+itos(i)+"/keys", PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR) ); } @@ -559,6 +564,19 @@ Animation::InterpolationType Animation::track_get_interpolation_type(int p_track return tracks[p_track]->interpolation; } +void Animation::track_set_interpolation_loop_wrap(int p_track,bool p_enable) { + ERR_FAIL_INDEX(p_track, tracks.size()); + tracks[p_track]->loop_wrap=p_enable; + emit_changed(); + +} + +bool Animation::track_get_interpolation_loop_wrap(int p_track) const{ + + ERR_FAIL_INDEX_V(p_track, tracks.size(),INTERPOLATION_NEAREST); + return tracks[p_track]->loop_wrap; + +} // transform /* @@ -1211,7 +1229,7 @@ float Animation::_cubic_interpolate( const float& p_pre_a,const float& p_a, cons } template<class T> -T Animation::_interpolate( const Vector< TKey<T> >& p_keys, float p_time, InterpolationType p_interp, bool *p_ok) const { +T Animation::_interpolate( const Vector< TKey<T> >& p_keys, float p_time, InterpolationType p_interp, bool p_loop_wrap,bool *p_ok) const { int len=_find( p_keys, length )+1; // try to find last key (there may be more past the end) @@ -1239,7 +1257,7 @@ T Animation::_interpolate( const Vector< TKey<T> >& p_keys, float p_time, Inter float c=0; // prepare for all cases of interpolation - if (loop) { + if (loop && p_loop_wrap) { // loop if (idx>=0) { @@ -1363,7 +1381,7 @@ Error Animation::transform_track_interpolate(int p_track, float p_time, Vector3 bool ok; - TransformKey tk = _interpolate( tt->transforms, p_time, tt->interpolation, &ok ); + TransformKey tk = _interpolate( tt->transforms, p_time, tt->interpolation, tt->loop_wrap, &ok ); if (!ok) // ?? return ERR_UNAVAILABLE; @@ -1391,7 +1409,7 @@ Variant Animation::value_track_interpolate(int p_track, float p_time) const { bool ok; - Variant res = _interpolate( vt->values, p_time, vt->update_mode==UPDATE_CONTINUOUS?vt->interpolation:INTERPOLATION_NEAREST, &ok ); + Variant res = _interpolate( vt->values, p_time, vt->update_mode==UPDATE_CONTINUOUS?vt->interpolation:INTERPOLATION_NEAREST,vt->loop_wrap, &ok ); if (ok) { @@ -1711,6 +1729,8 @@ void Animation::_bind_methods() { ClassDB::bind_method(_MD("track_set_interpolation_type","idx","interpolation"),&Animation::track_set_interpolation_type); ClassDB::bind_method(_MD("track_get_interpolation_type","idx"),&Animation::track_get_interpolation_type); + ClassDB::bind_method(_MD("track_set_interpolation_loop_wrap","idx","interpolation"),&Animation::track_set_interpolation_loop_wrap); + ClassDB::bind_method(_MD("track_get_interpolation_loop_wrap","idx"),&Animation::track_get_interpolation_loop_wrap); ClassDB::bind_method(_MD("transform_track_interpolate","idx","time_sec"),&Animation::_transform_track_interpolate); diff --git a/scene/resources/animation.h b/scene/resources/animation.h index 90824d8c7b..b81ac4f1bf 100644 --- a/scene/resources/animation.h +++ b/scene/resources/animation.h @@ -39,12 +39,7 @@ class Animation : public Resource { RES_BASE_EXTENSION("anm"); public: - enum LoopMode { - LOOP_NONE, - LOOP_ENABLED, - LOOP_WRAP - }; enum TrackType { TYPE_VALUE, ///< Set a value in a property, can be interpolated. @@ -71,9 +66,10 @@ private: TrackType type; InterpolationType interpolation; + bool loop_wrap; NodePath path; // path to something bool imported; - Track() { interpolation=INTERPOLATION_LINEAR; imported=false;} + Track() { interpolation=INTERPOLATION_LINEAR; imported=false; loop_wrap=true;} virtual ~Track() {} }; @@ -164,7 +160,7 @@ private: _FORCE_INLINE_ float _cubic_interpolate( const float& p_pre_a,const float& p_a, const float& p_b, const float& p_post_b, float p_c) const; template<class T> - _FORCE_INLINE_ T _interpolate( const Vector< TKey<T> >& p_keys, float p_time, InterpolationType p_interp,bool *p_ok) const; + _FORCE_INLINE_ T _interpolate( const Vector< TKey<T> >& p_keys, float p_time, InterpolationType p_interp,bool p_loop_wrap,bool *p_ok) const; _FORCE_INLINE_ void _value_track_get_key_indices_in_range(const ValueTrack * vt, float from_time, float to_time,List<int> *p_indices) const; _FORCE_INLINE_ void _method_track_get_key_indices_in_range(const MethodTrack * mt, float from_time, float to_time,List<int> *p_indices) const; @@ -188,11 +184,11 @@ private: return ret; } - DVector<int> _value_track_get_key_indices(int p_track, float p_time, float p_delta) const { + PoolVector<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); - DVector<int> idxr; + PoolVector<int> idxr; for (List<int>::Element *E=idxs.front();E;E=E->next()) { @@ -200,11 +196,11 @@ private: } return idxr; } - DVector<int> _method_track_get_key_indices(int p_track, float p_time, float p_delta) const { + PoolVector<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); - DVector<int> idxr; + PoolVector<int> idxr; for (List<int>::Element *E=idxs.front();E;E=E->next()) { @@ -260,6 +256,8 @@ public: void track_set_interpolation_type(int p_track,InterpolationType p_interp); InterpolationType track_get_interpolation_type(int p_track) const; + void track_set_interpolation_loop_wrap(int p_track,bool p_enable); + bool track_get_interpolation_loop_wrap(int p_track) const; Error transform_track_interpolate(int p_track, float p_time, Vector3 * r_loc, Quat *r_rot, Vector3 *r_scale) const; diff --git a/scene/resources/bit_mask.cpp b/scene/resources/bit_mask.cpp index 81ba28fd26..d669ab771c 100644 --- a/scene/resources/bit_mask.cpp +++ b/scene/resources/bit_mask.cpp @@ -51,7 +51,7 @@ void BitMap::create_from_image_alpha(const Image& p_image){ create(Size2(img.get_width(),img.get_height())); - DVector<uint8_t>::Read r = img.get_data().read(); + PoolVector<uint8_t>::Read r = img.get_data().read(); uint8_t *w = bitmask.ptr(); for(int i=0;i<width*height;i++) { diff --git a/scene/resources/concave_polygon_shape.cpp b/scene/resources/concave_polygon_shape.cpp index fc1a3a9961..5190bba6a5 100644 --- a/scene/resources/concave_polygon_shape.cpp +++ b/scene/resources/concave_polygon_shape.cpp @@ -34,11 +34,11 @@ Vector<Vector3> ConcavePolygonShape::_gen_debug_mesh_lines() { Set<DrawEdge> edges; - DVector<Vector3> data=get_faces(); + PoolVector<Vector3> data=get_faces(); int datalen=data.size(); ERR_FAIL_COND_V( (datalen%3)!=0,Vector<Vector3>() ); - DVector<Vector3>::Read r=data.read(); + PoolVector<Vector3>::Read r=data.read(); for(int i=0;i<datalen;i+=3) { @@ -94,13 +94,13 @@ void ConcavePolygonShape::_update_shape() { } -void ConcavePolygonShape::set_faces(const DVector<Vector3>& p_faces) { +void ConcavePolygonShape::set_faces(const PoolVector<Vector3>& p_faces) { PhysicsServer::get_singleton()->shape_set_data(get_shape(),p_faces); notify_change_to_owners(); } -DVector<Vector3> ConcavePolygonShape::get_faces() const { +PoolVector<Vector3> ConcavePolygonShape::get_faces() const { return PhysicsServer::get_singleton()->shape_get_data(get_shape()); diff --git a/scene/resources/concave_polygon_shape.h b/scene/resources/concave_polygon_shape.h index 08d95da0ac..36e806d37a 100644 --- a/scene/resources/concave_polygon_shape.h +++ b/scene/resources/concave_polygon_shape.h @@ -67,8 +67,8 @@ protected: virtual Vector<Vector3> _gen_debug_mesh_lines(); public: - void set_faces(const DVector<Vector3>& p_faces); - DVector<Vector3> get_faces() const; + void set_faces(const PoolVector<Vector3>& p_faces); + PoolVector<Vector3> get_faces() const; ConcavePolygonShape(); diff --git a/scene/resources/concave_polygon_shape_2d.cpp b/scene/resources/concave_polygon_shape_2d.cpp index 4be95cb26d..e794643132 100644 --- a/scene/resources/concave_polygon_shape_2d.cpp +++ b/scene/resources/concave_polygon_shape_2d.cpp @@ -31,13 +31,13 @@ #include "servers/physics_2d_server.h" #include "servers/visual_server.h" -void ConcavePolygonShape2D::set_segments(const DVector<Vector2>& p_segments) { +void ConcavePolygonShape2D::set_segments(const PoolVector<Vector2>& p_segments) { Physics2DServer::get_singleton()->shape_set_data(get_rid(),p_segments); emit_changed(); } -DVector<Vector2> ConcavePolygonShape2D::get_segments() const { +PoolVector<Vector2> ConcavePolygonShape2D::get_segments() const { return Physics2DServer::get_singleton()->shape_get_data(get_rid()); } @@ -45,12 +45,12 @@ DVector<Vector2> ConcavePolygonShape2D::get_segments() const { void ConcavePolygonShape2D::draw(const RID& p_to_rid,const Color& p_color) { - DVector<Vector2> s = get_segments(); + PoolVector<Vector2> s = get_segments(); int len=s.size(); if (len==0 || (len%2)==1) return; - DVector<Vector2>::Read r = s.read(); + PoolVector<Vector2>::Read r = s.read(); 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); } @@ -60,14 +60,14 @@ void ConcavePolygonShape2D::draw(const RID& p_to_rid,const Color& p_color) { Rect2 ConcavePolygonShape2D::get_rect() const { - DVector<Vector2> s = get_segments(); + PoolVector<Vector2> s = get_segments(); int len=s.size(); if (len==0) return Rect2(); Rect2 rect; - DVector<Vector2>::Read r = s.read(); + PoolVector<Vector2>::Read r = s.read(); for(int i=0;i<len;i++) { if (i==0) rect.pos=r[i]; diff --git a/scene/resources/concave_polygon_shape_2d.h b/scene/resources/concave_polygon_shape_2d.h index 36c67254f3..309fb4a7b3 100644 --- a/scene/resources/concave_polygon_shape_2d.h +++ b/scene/resources/concave_polygon_shape_2d.h @@ -38,8 +38,8 @@ protected: static void _bind_methods(); public: - void set_segments(const DVector<Vector2>& p_segments); - DVector<Vector2> get_segments() const; + void set_segments(const PoolVector<Vector2>& p_segments); + PoolVector<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 21e93e4b5c..ca9897bf97 100644 --- a/scene/resources/convex_polygon_shape.cpp +++ b/scene/resources/convex_polygon_shape.cpp @@ -32,7 +32,7 @@ Vector<Vector3> ConvexPolygonShape::_gen_debug_mesh_lines() { - DVector<Vector3> points = get_points(); + PoolVector<Vector3> points = get_points(); if (points.size()>3) { @@ -64,14 +64,14 @@ void ConvexPolygonShape::_update_shape() { emit_changed(); } -void ConvexPolygonShape::set_points(const DVector<Vector3>& p_points) { +void ConvexPolygonShape::set_points(const PoolVector<Vector3>& p_points) { points=p_points; _update_shape(); notify_change_to_owners(); } -DVector<Vector3> ConvexPolygonShape::get_points() const { +PoolVector<Vector3> ConvexPolygonShape::get_points() const { return points; } diff --git a/scene/resources/convex_polygon_shape.h b/scene/resources/convex_polygon_shape.h index 296a0ce4ca..215de941c6 100644 --- a/scene/resources/convex_polygon_shape.h +++ b/scene/resources/convex_polygon_shape.h @@ -34,7 +34,7 @@ class ConvexPolygonShape : public Shape { GDCLASS(ConvexPolygonShape,Shape); - DVector<Vector3> points; + PoolVector<Vector3> points; protected: @@ -45,8 +45,8 @@ protected: virtual Vector<Vector3> _gen_debug_mesh_lines(); public: - void set_points(const DVector<Vector3>& p_points); - DVector<Vector3> get_points() const; + void set_points(const PoolVector<Vector3>& p_points); + PoolVector<Vector3> get_points() const; ConvexPolygonShape(); }; diff --git a/scene/resources/curve.cpp b/scene/resources/curve.cpp index fd0e9be304..50c546b855 100644 --- a/scene/resources/curve.cpp +++ b/scene/resources/curve.cpp @@ -143,17 +143,17 @@ Vector2 Curve2D::interpolatef(real_t p_findex) const { } -DVector<Point2> Curve2D::bake(int p_subdivs) const { +PoolVector<Point2> Curve2D::bake(int p_subdivs) const { int pc = points.size(); - DVector<Point2> ret; + PoolVector<Point2> ret; if (pc<2) return ret; ret.resize((pc-1)*p_subdivs+1); - DVector<Point2>::Write w = ret.write(); + PoolVector<Point2>::Write w = ret.write(); const Point *r = points.ptr(); for(int i=0;i<pc;i++) { @@ -175,7 +175,7 @@ DVector<Point2> Curve2D::bake(int p_subdivs) const { } } - w = DVector<Point2>::Write(); + w = PoolVector<Point2>::Write(); return ret; } diff --git a/scene/resources/curve.h b/scene/resources/curve.h index 289de50444..670232c9b2 100644 --- a/scene/resources/curve.h +++ b/scene/resources/curve.h @@ -72,7 +72,7 @@ public: Vector2 interpolate(int p_index, float p_offset) const; Vector2 interpolatef(real_t p_findex) const; - DVector<Point2> bake(int p_subdivs=10) const; + PoolVector<Point2> bake(int p_subdivs=10) const; void advance(real_t p_distance,int &r_index, real_t &r_pos) const; void get_approx_position_from_offset(real_t p_offset,int &r_index, real_t &r_pos,int p_subdivs=16) const; diff --git a/scene/resources/default_theme/color_picker_hue.png b/scene/resources/default_theme/color_picker_hue.png Binary files differindex 9bdd24f4fe..de2cd0c2bf 100644 --- a/scene/resources/default_theme/color_picker_hue.png +++ b/scene/resources/default_theme/color_picker_hue.png diff --git a/scene/resources/default_theme/color_picker_main.png b/scene/resources/default_theme/color_picker_main.png Binary files differdeleted file mode 100644 index 0498628180..0000000000 --- a/scene/resources/default_theme/color_picker_main.png +++ /dev/null diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp index 4c6cf1c7c0..3c6e65bf41 100644 --- a/scene/resources/default_theme/default_theme.cpp +++ b/scene/resources/default_theme/default_theme.cpp @@ -835,15 +835,9 @@ void fill_default_theme(Ref<Theme>& t, const Ref<Font> & default_font, const Ref t->set_icon("screen_picker","ColorPicker", make_icon( icon_color_pick_png ) ); t->set_icon("add_preset","ColorPicker", make_icon( icon_add_png ) ); - t->set_icon("color_area", "ColorPicker", make_icon( color_picker_main_png)); t->set_icon("color_hue", "ColorPicker", make_icon( color_picker_hue_png)); t->set_icon("color_sample", "ColorPicker", make_icon( color_picker_sample_png)); - t->set_shader("uv_editor", "ColorPicker", make_shader("", uv_editor_shader_code, "")); - t->set_shader("w_editor", "ColorPicker", make_shader("", w_editor_shader_code, "")); - - - // TooltipPanel Ref<StyleBoxTexture> style_tt = make_stylebox( tooltip_bg_png,4,4,4,4); diff --git a/scene/resources/default_theme/make_header.py b/scene/resources/default_theme/make_header.py index 68c9e92527..68c9e92527 100644..100755 --- a/scene/resources/default_theme/make_header.py +++ b/scene/resources/default_theme/make_header.py diff --git a/scene/resources/default_theme/theme_data.h b/scene/resources/default_theme/theme_data.h index 913ea9b5e9..46fd770a27 100644 --- a/scene/resources/default_theme/theme_data.h +++ b/scene/resources/default_theme/theme_data.h @@ -70,12 +70,7 @@ static const unsigned char close_hl_png[]={ static const unsigned char color_picker_hue_png[]={ -0x89,0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,0x0,0x0,0x10,0x0,0x0,0x1,0x0,0x8,0x2,0x0,0x0,0x0,0x35,0x30,0x61,0x19,0x0,0x0,0x0,0x9,0x70,0x48,0x59,0x73,0x0,0x0,0xb,0x13,0x0,0x0,0xb,0x13,0x1,0x0,0x9a,0x9c,0x18,0x0,0x0,0x0,0x7,0x74,0x49,0x4d,0x45,0x7,0xe0,0x9,0x18,0xc,0x24,0x18,0xa9,0xb3,0x2c,0xb7,0x0,0x0,0x0,0x23,0x49,0x44,0x41,0x54,0x68,0xde,0xed,0xc1,0x31,0x1,0x0,0x0,0x0,0xc2,0xa0,0xf5,0x4f,0x6d,0xd,0xf,0xa0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xbe,0xd,0x31,0x0,0x0,0x1,0x35,0x84,0x14,0xe2,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82 -}; - - -static const unsigned char color_picker_main_png[]={ -0x89,0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,0x0,0x1,0x0,0x0,0x0,0x1,0x0,0x8,0x2,0x0,0x0,0x0,0xd3,0x10,0x3f,0x31,0x0,0x0,0x0,0x9,0x70,0x48,0x59,0x73,0x0,0x0,0xb,0x13,0x0,0x0,0xb,0x13,0x1,0x0,0x9a,0x9c,0x18,0x0,0x0,0x0,0x7,0x74,0x49,0x4d,0x45,0x7,0xe0,0x9,0x18,0xc,0x23,0x22,0x20,0xfe,0x63,0xc2,0x0,0x0,0x0,0xd5,0x49,0x44,0x41,0x54,0x78,0xda,0xed,0xc1,0x31,0x1,0x0,0x0,0x0,0xc2,0xa0,0xf5,0x4f,0xed,0x65,0xb,0xa0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80,0x1b,0x1,0x2d,0x0,0x1,0x9e,0xcb,0xc2,0xed,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82 +0x89,0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,0x0,0x0,0x1,0x0,0x0,0x1,0x0,0x8,0x2,0x0,0x0,0x0,0xfd,0x5c,0x8b,0xcf,0x0,0x0,0x0,0x59,0x49,0x44,0x41,0x54,0x28,0x91,0xcd,0xd0,0x31,0xa,0x3,0x31,0x10,0x43,0xd1,0x87,0xc0,0xf6,0xfd,0x8f,0x1b,0xdb,0x30,0x69,0x76,0x21,0x65,0xd8,0x14,0x71,0xf1,0xf9,0x8c,0x84,0x9a,0x51,0x44,0x13,0xfd,0x21,0xe3,0x87,0xed,0xf7,0xa8,0xcd,0x2a,0x99,0x8e,0x46,0x2b,0x94,0xd0,0x43,0xb,0xe3,0x64,0xb3,0x2a,0xa6,0x93,0xb9,0x9f,0x9a,0x4e,0x3a,0x69,0x97,0xc7,0xe5,0x3b,0x1b,0xff,0xef,0x6d,0xa5,0xec,0x30,0xc3,0xeb,0xf2,0xc,0xeb,0xe3,0x5e,0x27,0xf4,0x8a,0x37,0x75,0x7b,0x8a,0xe5,0x90,0x9a,0xab,0x81,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82 }; @@ -577,39 +572,3 @@ static const unsigned char window_resizer_png[]={ -static const char *uv_editor_shader_code= - "vec3 nd1sl2=vec3(UV,0);" - "uniform float H=0;" - "float nd4sl0=H;" - "float nd7sl0=nd1sl2.x;" - "float nd7sl1=nd1sl2.y;" - "float nd7sl2=nd1sl2.z;" - "float nd2sl1def=-1;" - "float nd2sl0=nd7sl1*nd2sl1def;" - "float nd6sl1def=1;" - "float nd6sl0=nd2sl0+nd6sl1def;" - "vec3 nd3sl0=vec3(nd4sl0,nd7sl0,nd6sl0);" - "vec3 nd5sl0;" - "{" - " vec3 c = nd3sl0;" - " vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);" - " vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);" - " nd5sl0=c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);" - "}" - "COLOR.rgb=nd5sl0;"; - - -static const char *w_editor_shader_code= - "vec3 nd1sl2=vec3(UV,0);" - "float nd2sl1=1-nd1sl2.y;" - "vec3 nd3sl0=vec3(nd2sl1,1,1);" - "vec3 nd6sl0;" - "{" - " vec3 c = nd3sl0;" - " vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);" - " vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);" - " nd6sl0=c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);" - "}" - "COLOR.rgb=nd6sl0;"; - - diff --git a/scene/resources/default_theme/uv_editor.gsl b/scene/resources/default_theme/uv_editor.gsl deleted file mode 100644 index 8c24e76dd5..0000000000 --- a/scene/resources/default_theme/uv_editor.gsl +++ /dev/null @@ -1,19 +0,0 @@ -vec3 nd1sl2=vec3(UV,0);
-uniform float H=0;
-float nd4sl0=H;
-float nd7sl0=nd1sl2.x;
-float nd7sl1=nd1sl2.y;
-float nd7sl2=nd1sl2.z;
-float nd2sl1def=-1;
-float nd2sl0=nd7sl1*nd2sl1def;
-float nd6sl1def=1;
-float nd6sl0=nd2sl0+nd6sl1def;
-vec3 nd3sl0=vec3(nd4sl0,nd7sl0,nd6sl0);
-vec3 nd5sl0;
-{
- vec3 c = nd3sl0;
- vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
- vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
- nd5sl0=c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
-}
-COLOR.rgb=nd5sl0;
\ No newline at end of file diff --git a/scene/resources/default_theme/w_editor.gsl b/scene/resources/default_theme/w_editor.gsl deleted file mode 100644 index 6d2dd9a0bb..0000000000 --- a/scene/resources/default_theme/w_editor.gsl +++ /dev/null @@ -1,11 +0,0 @@ -vec3 nd1sl2=vec3(UV,0);
-float nd2sl1=1-nd1sl2.y;
-vec3 nd3sl0=vec3(nd2sl1,1,1);
-vec3 nd6sl0;
-{
- vec3 c = nd3sl0;
- vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
- vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
- nd6sl0=c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
-}
-COLOR.rgb=nd6sl0;
\ No newline at end of file diff --git a/scene/resources/dynamic_font.cpp b/scene/resources/dynamic_font.cpp index e157ee46d0..3aadbdbe19 100644 --- a/scene/resources/dynamic_font.cpp +++ b/scene/resources/dynamic_font.cpp @@ -535,7 +535,7 @@ void DynamicFontAtSize::_update_char(CharType p_char) { { //zero texture - DVector<uint8_t>::Write w = tex.imgdata.write(); + PoolVector<uint8_t>::Write w = tex.imgdata.write(); ERR_FAIL_COND(texsize*texsize*2 > tex.imgdata.size()); for(int i=0;i<texsize*texsize*2;i++) { w[i]=0; @@ -556,7 +556,7 @@ void DynamicFontAtSize::_update_char(CharType p_char) { CharTexture &tex=textures[tex_index]; { - DVector<uint8_t>::Write wr = tex.imgdata.write(); + PoolVector<uint8_t>::Write wr = tex.imgdata.write(); for(int i=0;i<h;i++) { @@ -899,14 +899,17 @@ void DynamicFont::_bind_methods() { ClassDB::bind_method(_MD("get_fallback_count"),&DynamicFont::get_fallback_count); - ADD_PROPERTY(PropertyInfo(Variant::INT,"font/size"),_SCS("set_size"),_SCS("get_size")); - ADD_PROPERTYINZ(PropertyInfo(Variant::INT,"extra_spacing/top"),_SCS("set_spacing"),_SCS("get_spacing"),SPACING_TOP); - ADD_PROPERTYINZ(PropertyInfo(Variant::INT,"extra_spacing/bottom"),_SCS("set_spacing"),_SCS("get_spacing"),SPACING_BOTTOM); - ADD_PROPERTYINZ(PropertyInfo(Variant::INT,"extra_spacing/char"),_SCS("set_spacing"),_SCS("get_spacing"),SPACING_CHAR); - ADD_PROPERTYINZ(PropertyInfo(Variant::INT,"extra_spacing/space"),_SCS("set_spacing"),_SCS("get_spacing"),SPACING_SPACE); - ADD_PROPERTY(PropertyInfo(Variant::BOOL,"font/use_mipmaps"),_SCS("set_use_mipmaps"),_SCS("get_use_mipmaps")); - ADD_PROPERTY(PropertyInfo(Variant::BOOL,"font/use_filter"),_SCS("set_use_filter"),_SCS("get_use_filter")); - ADD_PROPERTY(PropertyInfo(Variant::OBJECT,"font/font",PROPERTY_HINT_RESOURCE_TYPE,"DynamicFontData"),_SCS("set_font_data"),_SCS("get_font_data")); + ADD_GROUP("Settings",""); + ADD_PROPERTY(PropertyInfo(Variant::INT,"size"),_SCS("set_size"),_SCS("get_size")); + ADD_PROPERTY(PropertyInfo(Variant::BOOL,"use_mipmaps"),_SCS("set_use_mipmaps"),_SCS("get_use_mipmaps")); + ADD_PROPERTY(PropertyInfo(Variant::BOOL,"use_filter"),_SCS("set_use_filter"),_SCS("get_use_filter")); + ADD_GROUP("Extra Spacing","extra_spacing"); + ADD_PROPERTYINZ(PropertyInfo(Variant::INT,"extra_spacing_top"),_SCS("set_spacing"),_SCS("get_spacing"),SPACING_TOP); + ADD_PROPERTYINZ(PropertyInfo(Variant::INT,"extra_spacing_bottom"),_SCS("set_spacing"),_SCS("get_spacing"),SPACING_BOTTOM); + ADD_PROPERTYINZ(PropertyInfo(Variant::INT,"extra_spacing_char"),_SCS("set_spacing"),_SCS("get_spacing"),SPACING_CHAR); + ADD_PROPERTYINZ(PropertyInfo(Variant::INT,"extra_spacing_space"),_SCS("set_spacing"),_SCS("get_spacing"),SPACING_SPACE); + ADD_GROUP("Font",""); + ADD_PROPERTY(PropertyInfo(Variant::OBJECT,"font_data",PROPERTY_HINT_RESOURCE_TYPE,"DynamicFontData"),_SCS("set_font_data"),_SCS("get_font_data")); BIND_CONSTANT( SPACING_TOP ); BIND_CONSTANT( SPACING_BOTTOM ); diff --git a/scene/resources/dynamic_font.h b/scene/resources/dynamic_font.h index 133d48bdea..321ec7e332 100644 --- a/scene/resources/dynamic_font.h +++ b/scene/resources/dynamic_font.h @@ -107,7 +107,7 @@ class DynamicFontAtSize : public Reference { struct CharTexture { - DVector<uint8_t> imgdata; + PoolVector<uint8_t> imgdata; int texture_size; Vector<int> offsets; Ref<ImageTexture> texture; diff --git a/scene/resources/dynamic_font_stb.cpp b/scene/resources/dynamic_font_stb.cpp index c931b4d6c8..a25667d85a 100644 --- a/scene/resources/dynamic_font_stb.cpp +++ b/scene/resources/dynamic_font_stb.cpp @@ -26,10 +26,10 @@ void DynamicFontData::lock() { void DynamicFontData::unlock() { - fr = DVector<uint8_t>::Read(); + fr = PoolVector<uint8_t>::Read(); } -void DynamicFontData::set_font_data(const DVector<uint8_t>& p_font) { +void DynamicFontData::set_font_data(const PoolVector<uint8_t>& p_font) { //clear caches and stuff ERR_FAIL_COND(font_data.size()) ; font_data=p_font; @@ -284,7 +284,7 @@ void DynamicFontAtSize::_update_char(CharType p_char) { { //zero texture - DVector<uint8_t>::Write w = tex.imgdata.write(); + PoolVector<uint8_t>::Write w = tex.imgdata.write(); ERR_FAIL_COND(texsize*texsize*2 > tex.imgdata.size()); for(int i=0;i<texsize*texsize*2;i++) { w[i]=0; @@ -305,7 +305,7 @@ void DynamicFontAtSize::_update_char(CharType p_char) { CharTexture &tex=textures[tex_index]; { - DVector<uint8_t>::Write wr = tex.imgdata.write(); + PoolVector<uint8_t>::Write wr = tex.imgdata.write(); for(int i=0;i<h;i++) { for(int j=0;j<w;j++) { @@ -485,14 +485,14 @@ RES ResourceFormatLoaderDynamicFont::load(const String &p_path, const String& p_ FileAccess *f = FileAccess::open(p_path,FileAccess::READ); ERR_FAIL_COND_V(!f,RES()); - DVector<uint8_t> data; + PoolVector<uint8_t> data; data.resize(f->get_len()); ERR_FAIL_COND_V(data.size()==0,RES()); { - DVector<uint8_t>::Write w = data.write(); + PoolVector<uint8_t>::Write w = data.write(); f->get_buffer(w.ptr(),data.size()); } diff --git a/scene/resources/dynamic_font_stb.h b/scene/resources/dynamic_font_stb.h index ad7ca0009d..07a3e5ee6c 100644 --- a/scene/resources/dynamic_font_stb.h +++ b/scene/resources/dynamic_font_stb.h @@ -18,8 +18,8 @@ class DynamicFontData : public Resource { bool valid; - DVector<uint8_t> font_data; - DVector<uint8_t>::Read fr; + PoolVector<uint8_t> font_data; + PoolVector<uint8_t>::Read fr; const uint8_t* last_data_ptr; struct KerningPairKey { @@ -56,7 +56,7 @@ friend class DynamicFont; Ref<DynamicFontAtSize> _get_dynamic_font_at_size(int p_size); public: - void set_font_data(const DVector<uint8_t>& p_font); + void set_font_data(const PoolVector<uint8_t>& p_font); DynamicFontData(); ~DynamicFontData(); }; @@ -71,7 +71,7 @@ class DynamicFontAtSize : public Reference { struct CharTexture { - DVector<uint8_t> imgdata; + PoolVector<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 55c9bbeae4..ffc0a38fc2 100644 --- a/scene/resources/environment.cpp +++ b/scene/resources/environment.cpp @@ -723,15 +723,17 @@ void Environment::_bind_methods() { ClassDB::bind_method(_MD("get_ambient_light_skybox_contribution"),&Environment::get_ambient_light_skybox_contribution); - ADD_PROPERTY(PropertyInfo(Variant::INT,"background/mode",PROPERTY_HINT_ENUM,"Clear Color,Custom Color,Skybox,Canvas,Keep"),_SCS("set_background"),_SCS("get_background") ); - ADD_PROPERTY(PropertyInfo(Variant::OBJECT,"background/skybox",PROPERTY_HINT_RESOURCE_TYPE,"SkyBox"),_SCS("set_skybox"),_SCS("get_skybox") ); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"background/skybox_scale",PROPERTY_HINT_RANGE,"0,32,0.01"),_SCS("set_skybox_scale"),_SCS("get_skybox_scale") ); - ADD_PROPERTY(PropertyInfo(Variant::COLOR,"background/color"),_SCS("set_bg_color"),_SCS("get_bg_color") ); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"background/energy",PROPERTY_HINT_RANGE,"0,16,0.01"),_SCS("set_bg_energy"),_SCS("get_bg_energy") ); - ADD_PROPERTY(PropertyInfo(Variant::INT,"background/canvas_max_layer",PROPERTY_HINT_RANGE,"-1000,1000,1"),_SCS("set_canvas_max_layer"),_SCS("get_canvas_max_layer") ); - ADD_PROPERTY(PropertyInfo(Variant::COLOR,"ambient_light/color"),_SCS("set_ambient_light_color"),_SCS("get_ambient_light_color") ); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"ambient_light/energy",PROPERTY_HINT_RANGE,"0,16,0.01"),_SCS("set_ambient_light_energy"),_SCS("get_ambient_light_energy") ); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"ambient_light/skybox_contribution",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_ambient_light_skybox_contribution"),_SCS("get_ambient_light_skybox_contribution") ); + ADD_GROUP("Background","background_"); + ADD_PROPERTY(PropertyInfo(Variant::INT,"background_mode",PROPERTY_HINT_ENUM,"Clear Color,Custom Color,Skybox,Canvas,Keep"),_SCS("set_background"),_SCS("get_background") ); + ADD_PROPERTY(PropertyInfo(Variant::OBJECT,"background_skybox",PROPERTY_HINT_RESOURCE_TYPE,"SkyBox"),_SCS("set_skybox"),_SCS("get_skybox") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"background_skybox_scale",PROPERTY_HINT_RANGE,"0,32,0.01"),_SCS("set_skybox_scale"),_SCS("get_skybox_scale") ); + ADD_PROPERTY(PropertyInfo(Variant::COLOR,"background_color"),_SCS("set_bg_color"),_SCS("get_bg_color") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"background_energy",PROPERTY_HINT_RANGE,"0,16,0.01"),_SCS("set_bg_energy"),_SCS("get_bg_energy") ); + ADD_PROPERTY(PropertyInfo(Variant::INT,"background_canvas_max_layer",PROPERTY_HINT_RANGE,"-1000,1000,1"),_SCS("set_canvas_max_layer"),_SCS("get_canvas_max_layer") ); + ADD_GROUP("Ambient Light","ambient_light_"); + ADD_PROPERTY(PropertyInfo(Variant::COLOR,"ambient_light_color"),_SCS("set_ambient_light_color"),_SCS("get_ambient_light_color") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"ambient_light_energy",PROPERTY_HINT_RANGE,"0,16,0.01"),_SCS("set_ambient_light_energy"),_SCS("get_ambient_light_energy") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"ambient_light_skybox_contribution",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_ambient_light_skybox_contribution"),_SCS("get_ambient_light_skybox_contribution") ); ClassDB::bind_method(_MD("set_ssr_enabled","enabled"),&Environment::set_ssr_enabled); @@ -755,13 +757,14 @@ void Environment::_bind_methods() { ClassDB::bind_method(_MD("set_ssr_rough","rough"),&Environment::set_ssr_rough); ClassDB::bind_method(_MD("is_ssr_rough"),&Environment::is_ssr_rough); - ADD_PROPERTY(PropertyInfo(Variant::BOOL,"ss_reflections/enabled"),_SCS("set_ssr_enabled"),_SCS("is_ssr_enabled") ); - ADD_PROPERTY(PropertyInfo(Variant::INT,"ss_reflections/max_steps",PROPERTY_HINT_RANGE,"1,512,1"),_SCS("set_ssr_max_steps"),_SCS("get_ssr_max_steps") ); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"ss_reflections/accel",PROPERTY_HINT_RANGE,"0,4,0.01"),_SCS("set_ssr_accel"),_SCS("get_ssr_accel") ); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"ss_reflections/fade",PROPERTY_HINT_EXP_EASING),_SCS("set_ssr_fade"),_SCS("get_ssr_fade") ); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"ss_reflections/depth_tolerance",PROPERTY_HINT_RANGE,"0.1,128,0.1"),_SCS("set_ssr_depth_tolerance"),_SCS("get_ssr_depth_tolerance") ); - ADD_PROPERTY(PropertyInfo(Variant::BOOL,"ss_reflections/accel_smooth"),_SCS("set_ssr_smooth"),_SCS("is_ssr_smooth") ); - ADD_PROPERTY(PropertyInfo(Variant::BOOL,"ss_reflections/roughness"),_SCS("set_ssr_rough"),_SCS("is_ssr_rough") ); + ADD_GROUP("SS Reflections","ss_reflections_"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL,"ss_reflections_enabled"),_SCS("set_ssr_enabled"),_SCS("is_ssr_enabled") ); + ADD_PROPERTY(PropertyInfo(Variant::INT,"ss_reflections_max_steps",PROPERTY_HINT_RANGE,"1,512,1"),_SCS("set_ssr_max_steps"),_SCS("get_ssr_max_steps") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"ss_reflections_accel",PROPERTY_HINT_RANGE,"0,4,0.01"),_SCS("set_ssr_accel"),_SCS("get_ssr_accel") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"ss_reflections_fade",PROPERTY_HINT_EXP_EASING),_SCS("set_ssr_fade"),_SCS("get_ssr_fade") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"ss_reflections_depth_tolerance",PROPERTY_HINT_RANGE,"0.1,128,0.1"),_SCS("set_ssr_depth_tolerance"),_SCS("get_ssr_depth_tolerance") ); + ADD_PROPERTY(PropertyInfo(Variant::BOOL,"ss_reflections_accel_smooth"),_SCS("set_ssr_smooth"),_SCS("is_ssr_smooth") ); + ADD_PROPERTY(PropertyInfo(Variant::BOOL,"ss_reflections_roughness"),_SCS("set_ssr_rough"),_SCS("is_ssr_rough") ); ClassDB::bind_method(_MD("set_ssao_enabled","enabled"),&Environment::set_ssao_enabled); ClassDB::bind_method(_MD("is_ssao_enabled"),&Environment::is_ssao_enabled); @@ -790,15 +793,16 @@ void Environment::_bind_methods() { ClassDB::bind_method(_MD("set_ssao_blur","enabled"),&Environment::set_ssao_blur); ClassDB::bind_method(_MD("is_ssao_blur_enabled"),&Environment::is_ssao_blur_enabled); - ADD_PROPERTY(PropertyInfo(Variant::BOOL,"ambient_occlusion/enabled"),_SCS("set_ssao_enabled"),_SCS("is_ssao_enabled") ); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"ambient_occlusion/radius",PROPERTY_HINT_RANGE,"0.1,16,0.1"),_SCS("set_ssao_radius"),_SCS("get_ssao_radius") ); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"ambient_occlusion/intensity",PROPERTY_HINT_RANGE,"0.0,9,0.1"),_SCS("set_ssao_intensity"),_SCS("get_ssao_intensity") ); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"ambient_occlusion/radius2",PROPERTY_HINT_RANGE,"0.0,16,0.1"),_SCS("set_ssao_radius2"),_SCS("get_ssao_radius2") ); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"ambient_occlusion/intensity2",PROPERTY_HINT_RANGE,"0.0,9,0.1"),_SCS("set_ssao_intensity2"),_SCS("get_ssao_intensity2") ); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"ambient_occlusion/bias",PROPERTY_HINT_RANGE,"0.001,8,0.001"),_SCS("set_ssao_bias"),_SCS("get_ssao_bias") ); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"ambient_occlusion/light_affect",PROPERTY_HINT_RANGE,"0.00,1,0.01"),_SCS("set_ssao_direct_light_affect"),_SCS("get_ssao_direct_light_affect") ); - ADD_PROPERTY(PropertyInfo(Variant::COLOR,"ambient_occlusion/color",PROPERTY_HINT_COLOR_NO_ALPHA),_SCS("set_ssao_color"),_SCS("get_ssao_color") ); - ADD_PROPERTY(PropertyInfo(Variant::BOOL,"ambient_occlusion/blur"),_SCS("set_ssao_blur"),_SCS("is_ssao_blur_enabled") ); + ADD_GROUP("SSAO","ssao_"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL,"ssao_enabled"),_SCS("set_ssao_enabled"),_SCS("is_ssao_enabled") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"ssao_radius",PROPERTY_HINT_RANGE,"0.1,16,0.1"),_SCS("set_ssao_radius"),_SCS("get_ssao_radius") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"ssao_intensity",PROPERTY_HINT_RANGE,"0.0,9,0.1"),_SCS("set_ssao_intensity"),_SCS("get_ssao_intensity") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"ssao_radius2",PROPERTY_HINT_RANGE,"0.0,16,0.1"),_SCS("set_ssao_radius2"),_SCS("get_ssao_radius2") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"ssao_intensity2",PROPERTY_HINT_RANGE,"0.0,9,0.1"),_SCS("set_ssao_intensity2"),_SCS("get_ssao_intensity2") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"ssao_bias",PROPERTY_HINT_RANGE,"0.001,8,0.001"),_SCS("set_ssao_bias"),_SCS("get_ssao_bias") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"ssao_light_affect",PROPERTY_HINT_RANGE,"0.00,1,0.01"),_SCS("set_ssao_direct_light_affect"),_SCS("get_ssao_direct_light_affect") ); + ADD_PROPERTY(PropertyInfo(Variant::COLOR,"ssao_color",PROPERTY_HINT_COLOR_NO_ALPHA),_SCS("set_ssao_color"),_SCS("get_ssao_color") ); + ADD_PROPERTY(PropertyInfo(Variant::BOOL,"ssao_blur"),_SCS("set_ssao_blur"),_SCS("is_ssao_blur_enabled") ); ClassDB::bind_method(_MD("set_dof_blur_far_enabled","enabled"),&Environment::set_dof_blur_far_enabled); ClassDB::bind_method(_MD("is_dof_blur_far_enabled"),&Environment::is_dof_blur_far_enabled); @@ -830,17 +834,19 @@ void Environment::_bind_methods() { ClassDB::bind_method(_MD("set_dof_blur_near_quality","level"),&Environment::set_dof_blur_near_quality); ClassDB::bind_method(_MD("get_dof_blur_near_quality"),&Environment::get_dof_blur_near_quality); - ADD_PROPERTY(PropertyInfo(Variant::BOOL,"dof_blur_far/enabled"),_SCS("set_dof_blur_far_enabled"),_SCS("is_dof_blur_far_enabled") ); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"dof_blur_far/distance",PROPERTY_HINT_EXP_RANGE,"0.01,8192,0.01"),_SCS("set_dof_blur_far_distance"),_SCS("get_dof_blur_far_distance") ); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"dof_blur_far/transition",PROPERTY_HINT_EXP_RANGE,"0.01,8192,0.01"),_SCS("set_dof_blur_far_transition"),_SCS("get_dof_blur_far_transition") ); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"dof_blur_far/amount",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_dof_blur_far_amount"),_SCS("get_dof_blur_far_amount") ); - ADD_PROPERTY(PropertyInfo(Variant::INT,"dof_blur_far/quality",PROPERTY_HINT_ENUM,"Low,Medium,High"),_SCS("set_dof_blur_far_quality"),_SCS("get_dof_blur_far_quality") ); + ADD_GROUP("DOF Far Blur","dof_blur_far_"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL,"dof_blur_far_enabled"),_SCS("set_dof_blur_far_enabled"),_SCS("is_dof_blur_far_enabled") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"dof_blur_far_distance",PROPERTY_HINT_EXP_RANGE,"0.01,8192,0.01"),_SCS("set_dof_blur_far_distance"),_SCS("get_dof_blur_far_distance") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"dof_blur_far_transition",PROPERTY_HINT_EXP_RANGE,"0.01,8192,0.01"),_SCS("set_dof_blur_far_transition"),_SCS("get_dof_blur_far_transition") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"dof_blur_far_amount",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_dof_blur_far_amount"),_SCS("get_dof_blur_far_amount") ); + ADD_PROPERTY(PropertyInfo(Variant::INT,"dof_blur_far_quality",PROPERTY_HINT_ENUM,"Low,Medium,High"),_SCS("set_dof_blur_far_quality"),_SCS("get_dof_blur_far_quality") ); - ADD_PROPERTY(PropertyInfo(Variant::BOOL,"dof_blur_near/enabled"),_SCS("set_dof_blur_near_enabled"),_SCS("is_dof_blur_near_enabled") ); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"dof_blur_near/distance",PROPERTY_HINT_EXP_RANGE,"0.01,8192,0.01"),_SCS("set_dof_blur_near_distance"),_SCS("get_dof_blur_near_distance") ); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"dof_blur_near/transition",PROPERTY_HINT_EXP_RANGE,"0.01,8192,0.01"),_SCS("set_dof_blur_near_transition"),_SCS("get_dof_blur_near_transition") ); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"dof_blur_near/amount",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_dof_blur_near_amount"),_SCS("get_dof_blur_near_amount") ); - ADD_PROPERTY(PropertyInfo(Variant::INT,"dof_blur_near/quality",PROPERTY_HINT_ENUM,"Low,Medium,High"),_SCS("set_dof_blur_near_quality"),_SCS("get_dof_blur_near_quality") ); + ADD_GROUP("DOF Far Near","dof_blur_near_"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL,"dof_blur_near_enabled"),_SCS("set_dof_blur_near_enabled"),_SCS("is_dof_blur_near_enabled") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"dof_blur_near_distance",PROPERTY_HINT_EXP_RANGE,"0.01,8192,0.01"),_SCS("set_dof_blur_near_distance"),_SCS("get_dof_blur_near_distance") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"dof_blur_near_transition",PROPERTY_HINT_EXP_RANGE,"0.01,8192,0.01"),_SCS("set_dof_blur_near_transition"),_SCS("get_dof_blur_near_transition") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"dof_blur_near_amount",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_dof_blur_near_amount"),_SCS("get_dof_blur_near_amount") ); + ADD_PROPERTY(PropertyInfo(Variant::INT,"dof_blur_near_quality",PROPERTY_HINT_ENUM,"Low,Medium,High"),_SCS("set_dof_blur_near_quality"),_SCS("get_dof_blur_near_quality") ); ClassDB::bind_method(_MD("set_glow_enabled","enabled"),&Environment::set_glow_enabled); @@ -870,22 +876,23 @@ void Environment::_bind_methods() { ClassDB::bind_method(_MD("set_glow_bicubic_upscale","enabled"),&Environment::set_glow_bicubic_upscale); ClassDB::bind_method(_MD("is_glow_bicubic_upscale_enabled"),&Environment::is_glow_bicubic_upscale_enabled); - ADD_PROPERTY(PropertyInfo(Variant::BOOL,"glow/enabled"),_SCS("set_glow_enabled"),_SCS("is_glow_enabled") ); - ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"glow/levels/1"),_SCS("set_glow_level"),_SCS("is_glow_level_enabled"),0 ); - ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"glow/levels/2"),_SCS("set_glow_level"),_SCS("is_glow_level_enabled"),1 ); - ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"glow/levels/3"),_SCS("set_glow_level"),_SCS("is_glow_level_enabled"),2 ); - ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"glow/levels/4"),_SCS("set_glow_level"),_SCS("is_glow_level_enabled"),3 ); - ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"glow/levels/5"),_SCS("set_glow_level"),_SCS("is_glow_level_enabled"),4 ); - ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"glow/levels/6"),_SCS("set_glow_level"),_SCS("is_glow_level_enabled"),5 ); - ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"glow/levels/7"),_SCS("set_glow_level"),_SCS("is_glow_level_enabled"),6 ); - - ADD_PROPERTY(PropertyInfo(Variant::REAL,"glow/intensity",PROPERTY_HINT_RANGE,"0.0,8.0,0.01"),_SCS("set_glow_intensity"),_SCS("get_glow_intensity") ); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"glow/strength",PROPERTY_HINT_RANGE,"0.0,2.0,0.01"),_SCS("set_glow_strength"),_SCS("get_glow_strength") ); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"glow/bloom",PROPERTY_HINT_RANGE,"0.0,1.0,0.01"),_SCS("set_glow_bloom"),_SCS("get_glow_bloom") ); - ADD_PROPERTY(PropertyInfo(Variant::INT,"glow/blend_mode",PROPERTY_HINT_ENUM,"Additive,Screen,Softlight,Replace"),_SCS("set_glow_blend_mode"),_SCS("get_glow_blend_mode") ); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"glow/hdr_treshold",PROPERTY_HINT_RANGE,"0.0,4.0,0.01"),_SCS("set_glow_hdr_bleed_treshold"),_SCS("get_glow_hdr_bleed_treshold") ); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"glow/hdr_scale",PROPERTY_HINT_RANGE,"0.0,4.0,0.01"),_SCS("set_glow_hdr_bleed_scale"),_SCS("get_glow_hdr_bleed_scale") ); - ADD_PROPERTY(PropertyInfo(Variant::BOOL,"glow/bicubic_upscale"),_SCS("set_glow_bicubic_upscale"),_SCS("is_glow_bicubic_upscale_enabled") ); + ADD_GROUP("Glow","glow_"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL,"glow_enabled"),_SCS("set_glow_enabled"),_SCS("is_glow_enabled") ); + ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"glow_levels/1"),_SCS("set_glow_level"),_SCS("is_glow_level_enabled"),0 ); + ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"glow_levels/2"),_SCS("set_glow_level"),_SCS("is_glow_level_enabled"),1 ); + ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"glow_levels/3"),_SCS("set_glow_level"),_SCS("is_glow_level_enabled"),2 ); + ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"glow_levels/4"),_SCS("set_glow_level"),_SCS("is_glow_level_enabled"),3 ); + ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"glow_levels/5"),_SCS("set_glow_level"),_SCS("is_glow_level_enabled"),4 ); + ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"glow_levels/6"),_SCS("set_glow_level"),_SCS("is_glow_level_enabled"),5 ); + ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"glow_levels/7"),_SCS("set_glow_level"),_SCS("is_glow_level_enabled"),6 ); + + ADD_PROPERTY(PropertyInfo(Variant::REAL,"glow_intensity",PROPERTY_HINT_RANGE,"0.0,8.0,0.01"),_SCS("set_glow_intensity"),_SCS("get_glow_intensity") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"glow_strength",PROPERTY_HINT_RANGE,"0.0,2.0,0.01"),_SCS("set_glow_strength"),_SCS("get_glow_strength") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"glow_bloom",PROPERTY_HINT_RANGE,"0.0,1.0,0.01"),_SCS("set_glow_bloom"),_SCS("get_glow_bloom") ); + ADD_PROPERTY(PropertyInfo(Variant::INT,"glow_blend_mode",PROPERTY_HINT_ENUM,"Additive,Screen,Softlight,Replace"),_SCS("set_glow_blend_mode"),_SCS("get_glow_blend_mode") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"glow_hdr_treshold",PROPERTY_HINT_RANGE,"0.0,4.0,0.01"),_SCS("set_glow_hdr_bleed_treshold"),_SCS("get_glow_hdr_bleed_treshold") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"glow_hdr_scale",PROPERTY_HINT_RANGE,"0.0,4.0,0.01"),_SCS("set_glow_hdr_bleed_scale"),_SCS("get_glow_hdr_bleed_scale") ); + ADD_PROPERTY(PropertyInfo(Variant::BOOL,"glow_bicubic_upscale"),_SCS("set_glow_bicubic_upscale"),_SCS("is_glow_bicubic_upscale_enabled") ); ClassDB::bind_method(_MD("set_tonemapper","mode"),&Environment::set_tonemapper); @@ -913,14 +920,16 @@ void Environment::_bind_methods() { ClassDB::bind_method(_MD("get_tonemap_auto_exposure_grey"),&Environment::get_tonemap_auto_exposure_grey); - ADD_PROPERTY(PropertyInfo(Variant::INT,"tonemap/mode",PROPERTY_HINT_ENUM,"Linear,Reindhart,Filmic,Aces"),_SCS("set_tonemapper"),_SCS("get_tonemapper") ); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"tonemap/exposure",PROPERTY_HINT_RANGE,"0,16,0.01"),_SCS("set_tonemap_exposure"),_SCS("get_tonemap_exposure") ); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"tonemap/white",PROPERTY_HINT_RANGE,"0,16,0.01"),_SCS("set_tonemap_white"),_SCS("get_tonemap_white") ); - ADD_PROPERTY(PropertyInfo(Variant::BOOL,"auto_exposure/enabled"),_SCS("set_tonemap_auto_exposure"),_SCS("get_tonemap_auto_exposure") ); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"auto_exposure/scale",PROPERTY_HINT_RANGE,"0.01,64,0.01"),_SCS("set_tonemap_auto_exposure_grey"),_SCS("get_tonemap_auto_exposure_grey") ); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"auto_exposure/min_luma",PROPERTY_HINT_RANGE,"0,16,0.01"),_SCS("set_tonemap_auto_exposure_min"),_SCS("get_tonemap_auto_exposure_min") ); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"auto_exposure/max_luma",PROPERTY_HINT_RANGE,"0,16,0.01"),_SCS("set_tonemap_auto_exposure_max"),_SCS("get_tonemap_auto_exposure_max") ); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"auto_exposure/speed",PROPERTY_HINT_RANGE,"0.01,64,0.01"),_SCS("set_tonemap_auto_exposure_speed"),_SCS("get_tonemap_auto_exposure_speed") ); + ADD_GROUP("Tonemap","tonemap_"); + ADD_PROPERTY(PropertyInfo(Variant::INT,"tonemap_mode",PROPERTY_HINT_ENUM,"Linear,Reindhart,Filmic,Aces"),_SCS("set_tonemapper"),_SCS("get_tonemapper") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"tonemap_exposure",PROPERTY_HINT_RANGE,"0,16,0.01"),_SCS("set_tonemap_exposure"),_SCS("get_tonemap_exposure") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"tonemap_white",PROPERTY_HINT_RANGE,"0,16,0.01"),_SCS("set_tonemap_white"),_SCS("get_tonemap_white") ); + ADD_GROUP("Auto Exposure","auto_exposure_"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL,"auto_expoure_enabled"),_SCS("set_tonemap_auto_exposure"),_SCS("get_tonemap_auto_exposure") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"auto_expoure_scale",PROPERTY_HINT_RANGE,"0.01,64,0.01"),_SCS("set_tonemap_auto_exposure_grey"),_SCS("get_tonemap_auto_exposure_grey") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"auto_expoure_min_luma",PROPERTY_HINT_RANGE,"0,16,0.01"),_SCS("set_tonemap_auto_exposure_min"),_SCS("get_tonemap_auto_exposure_min") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"auto_expoure_max_luma",PROPERTY_HINT_RANGE,"0,16,0.01"),_SCS("set_tonemap_auto_exposure_max"),_SCS("get_tonemap_auto_exposure_max") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"auto_expoure_speed",PROPERTY_HINT_RANGE,"0.01,64,0.01"),_SCS("set_tonemap_auto_exposure_speed"),_SCS("get_tonemap_auto_exposure_speed") ); ClassDB::bind_method(_MD("set_adjustment_enable","enabled"),&Environment::set_adjustment_enable); ClassDB::bind_method(_MD("is_adjustment_enabled"),&Environment::is_adjustment_enabled); @@ -937,15 +946,15 @@ void Environment::_bind_methods() { ClassDB::bind_method(_MD("set_adjustment_color_correction","color_correction"),&Environment::set_adjustment_color_correction); ClassDB::bind_method(_MD("get_adjustment_color_correction"),&Environment::get_adjustment_color_correction); - ADD_PROPERTY(PropertyInfo(Variant::BOOL,"adjustment/enabled"),_SCS("set_adjustment_enable"),_SCS("is_adjustment_enabled") ); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"adjustment/brightness",PROPERTY_HINT_RANGE,"0.01,8,0.01"),_SCS("set_adjustment_brightness"),_SCS("get_adjustment_brightness") ); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"adjustment/contrast",PROPERTY_HINT_RANGE,"0.01,8,0.01"),_SCS("set_adjustment_contrast"),_SCS("get_adjustment_contrast") ); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"adjustment/saturation",PROPERTY_HINT_RANGE,"0.01,8,0.01"),_SCS("set_adjustment_saturation"),_SCS("get_adjustment_saturation") ); - ADD_PROPERTY(PropertyInfo(Variant::OBJECT,"adjustment/color_correction",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_adjustment_color_correction"),_SCS("get_adjustment_color_correction") ); + ADD_GROUP("Adjustments","adjustment_"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL,"adjustment_enabled"),_SCS("set_adjustment_enable"),_SCS("is_adjustment_enabled") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"adjustment_brightness",PROPERTY_HINT_RANGE,"0.01,8,0.01"),_SCS("set_adjustment_brightness"),_SCS("get_adjustment_brightness") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"adjustment_contrast",PROPERTY_HINT_RANGE,"0.01,8,0.01"),_SCS("set_adjustment_contrast"),_SCS("get_adjustment_contrast") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"adjustment_saturation",PROPERTY_HINT_RANGE,"0.01,8,0.01"),_SCS("set_adjustment_saturation"),_SCS("get_adjustment_saturation") ); + ADD_PROPERTY(PropertyInfo(Variant::OBJECT,"adjustment_color_correction",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_adjustment_color_correction"),_SCS("get_adjustment_color_correction") ); GLOBAL_DEF("rendering/skybox/irradiance_cube_resolution",256); - GLOBAL_DEF("rendering/skybox/radiance_cube_resolution",64); BIND_CONSTANT(BG_KEEP); BIND_CONSTANT(BG_CLEAR_COLOR); diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp index d4e18c58b8..0464a64031 100644 --- a/scene/resources/font.cpp +++ b/scene/resources/font.cpp @@ -97,7 +97,7 @@ Font::Font() { ///////////////////////////////////////////////////////////////// -void BitmapFont::_set_chars(const DVector<int>& p_chars) { +void BitmapFont::_set_chars(const PoolVector<int>& p_chars) { int len = p_chars.size(); //char 1 charsize 1 texture, 4 rect, 2 align, advance 1 @@ -107,7 +107,7 @@ void BitmapFont::_set_chars(const DVector<int>& p_chars) { int chars = len/9; - DVector<int>::Read r=p_chars.read(); + PoolVector<int>::Read r=p_chars.read(); for(int i=0;i<chars;i++) { const int* data = &r[i*9]; @@ -116,9 +116,9 @@ void BitmapFont::_set_chars(const DVector<int>& p_chars) { } -DVector<int> BitmapFont::_get_chars() const { +PoolVector<int> BitmapFont::_get_chars() const { - DVector<int> chars; + PoolVector<int> chars; const CharType* key=NULL; @@ -140,13 +140,13 @@ DVector<int> BitmapFont::_get_chars() const { return chars; } -void BitmapFont::_set_kernings(const DVector<int>& p_kernings) { +void BitmapFont::_set_kernings(const PoolVector<int>& p_kernings) { int len=p_kernings.size(); ERR_FAIL_COND(len%3); if (!len) return; - DVector<int>::Read r=p_kernings.read(); + PoolVector<int>::Read r=p_kernings.read(); for(int i=0;i<len/3;i++) { @@ -155,9 +155,9 @@ void BitmapFont::_set_kernings(const DVector<int>& p_kernings) { } } -DVector<int> BitmapFont::_get_kernings() const { +PoolVector<int> BitmapFont::_get_kernings() const { - DVector<int> kernings; + PoolVector<int> kernings; for(Map<KerningPairKey,int>::Element *E=kerning_map.front();E;E=E->next()) { diff --git a/scene/resources/font.h b/scene/resources/font.h index 397d48cbb0..ad0f0176db 100644 --- a/scene/resources/font.h +++ b/scene/resources/font.h @@ -109,10 +109,10 @@ private: float ascent; bool distance_field_hint; - void _set_chars(const DVector<int>& p_chars); - DVector<int> _get_chars() const; - void _set_kernings(const DVector<int>& p_kernings); - DVector<int> _get_kernings() const; + 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_textures(const Vector<Variant> & p_textures); Vector<Variant> _get_textures() const; diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index d36705b4bb..112ecaae2f 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -927,79 +927,97 @@ void FixedSpatialMaterial::_bind_methods() { ClassDB::bind_method(_MD("set_uv2_offset","offset"),&FixedSpatialMaterial::set_uv2_offset); ClassDB::bind_method(_MD("get_uv2_offset"),&FixedSpatialMaterial::get_uv2_offset); - ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"flags/transparent"),_SCS("set_feature"),_SCS("get_feature"),FEATURE_TRANSPARENT); - ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"flags/unshaded"),_SCS("set_flag"),_SCS("get_flag"),FLAG_UNSHADED); - ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"flags/on_top"),_SCS("set_flag"),_SCS("get_flag"),FLAG_ONTOP); - ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"flags/use_point_size"),_SCS("set_flag"),_SCS("get_flag"),FLAG_USE_POINT_SIZE); - ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"vertex_color/use_as_albedo"),_SCS("set_flag"),_SCS("get_flag"),FLAG_ALBEDO_FROM_VERTEX_COLOR); - ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"vertex_color/is_srgb"),_SCS("set_flag"),_SCS("get_flag"),FLAG_SRGB_VERTEX_COLOR); - - ADD_PROPERTY(PropertyInfo(Variant::INT,"params/diffuse_mode",PROPERTY_HINT_ENUM,"Labert,Lambert Wrap,Oren Nayar,Burley"),_SCS("set_diffuse_mode"),_SCS("get_diffuse_mode")); - ADD_PROPERTY(PropertyInfo(Variant::INT,"params/blend_mode",PROPERTY_HINT_ENUM,"Mix,Add,Sub,Mul"),_SCS("set_blend_mode"),_SCS("get_blend_mode")); - ADD_PROPERTY(PropertyInfo(Variant::INT,"params/cull_mode",PROPERTY_HINT_ENUM,"Back,Front,Disabled"),_SCS("set_cull_mode"),_SCS("get_cull_mode")); - ADD_PROPERTY(PropertyInfo(Variant::INT,"params/depth_draw_mode",PROPERTY_HINT_ENUM,"Opaque Only,Always,Never,Opaque Pre-Pass"),_SCS("set_depth_draw_mode"),_SCS("get_depth_draw_mode")); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"params/line_width",PROPERTY_HINT_RANGE,"0.1,128,0.1"),_SCS("set_line_width"),_SCS("get_line_width")); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"params/point_size",PROPERTY_HINT_RANGE,"0.1,128,0.1"),_SCS("set_point_size"),_SCS("get_point_size")); - - ADD_PROPERTY(PropertyInfo(Variant::COLOR,"albedo/color"),_SCS("set_albedo"),_SCS("get_albedo")); - ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"albedo/texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_ALBEDO); - - ADD_PROPERTY(PropertyInfo(Variant::INT,"specular/mode",PROPERTY_HINT_ENUM,"Metallic,Specular"),_SCS("set_specular_mode"),_SCS("get_specular_mode")); - ADD_PROPERTY(PropertyInfo(Variant::COLOR,"specular/color",PROPERTY_HINT_COLOR_NO_ALPHA),_SCS("set_specular"),_SCS("get_specular")); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"specular/metalness",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_metalness"),_SCS("get_metalness")); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"specular/roughness",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_roughness"),_SCS("get_roughness")); - ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"specular/texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_SPECULAR); - - ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"emission/enabled"),_SCS("set_feature"),_SCS("get_feature"),FEATURE_EMISSION); - ADD_PROPERTY(PropertyInfo(Variant::COLOR,"emission/color",PROPERTY_HINT_COLOR_NO_ALPHA),_SCS("set_emission"),_SCS("get_emission")); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"emission/energy",PROPERTY_HINT_RANGE,"0,16,0.01"),_SCS("set_emission_energy"),_SCS("get_emission_energy")); - ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"emission/texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_EMISSION); - - ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"normal/enabled"),_SCS("set_feature"),_SCS("get_feature"),FEATURE_NORMAL_MAPPING); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"normal/scale",PROPERTY_HINT_RANGE,"-16,16,0.01"),_SCS("set_normal_scale"),_SCS("get_normal_scale")); - ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"normal/texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_NORMAL); - - ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"rim/enabled"),_SCS("set_feature"),_SCS("get_feature"),FEATURE_RIM); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"rim/amount",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_rim"),_SCS("get_rim")); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"rim/tint",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_rim_tint"),_SCS("get_rim_tint")); - ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"rim/texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_RIM); - - ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"clearcoat/enabled"),_SCS("set_feature"),_SCS("get_feature"),FEATURE_CLEARCOAT); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"clearcoat/amount",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_clearcoat"),_SCS("get_clearcoat")); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"clearcoat/gloss",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_clearcoat_gloss"),_SCS("get_clearcoat_gloss")); - ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"clearcoat/texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_CLEARCOAT); - - ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"anisotropy/enabled"),_SCS("set_feature"),_SCS("get_feature"),FEATURE_ANISOTROPY); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"anisotropy/anisotropy",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_anisotropy"),_SCS("get_anisotropy")); - ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"anisotropy/flowmap",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_FLOWMAP); - - ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"ao/enabled"),_SCS("set_feature"),_SCS("get_feature"),FEATURE_AMBIENT_OCCLUSION); - ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"ao/texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_AMBIENT_OCCLUSION); - - ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"height/enabled"),_SCS("set_feature"),_SCS("get_feature"),FEATURE_HEIGHT_MAPPING); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"height/scale",PROPERTY_HINT_RANGE,"-16,16,0.01"),_SCS("set_height_scale"),_SCS("get_height_scale")); - ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"height/texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_HEIGHT); - - ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"subsurf_scatter/enabled"),_SCS("set_feature"),_SCS("get_feature"),FEATURE_SUBSURACE_SCATTERING); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"subsurf_scatter/strength",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_subsurface_scattering_strength"),_SCS("get_subsurface_scattering_strength")); - ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"subsurf_scatter/texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_SUBSURFACE_SCATTERING); - - ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"refraction/enabled"),_SCS("set_feature"),_SCS("get_feature"),FEATURE_REFRACTION); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"refraction/displacement",PROPERTY_HINT_RANGE,"-1,1,0.01"),_SCS("set_refraction"),_SCS("get_refraction")); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"refraction/roughness",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_refraction_roughness"),_SCS("get_refraction_roughness")); - ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"refraction/texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_REFRACTION); - - ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"detail/enabled"),_SCS("set_feature"),_SCS("get_feature"),FEATURE_DETAIL); - ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"detail/mask",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_DETAIL_MASK); - ADD_PROPERTY(PropertyInfo(Variant::INT,"detail/blend_mode",PROPERTY_HINT_ENUM,"Mix,Add,Sub,Mul"),_SCS("set_detail_blend_mode"),_SCS("get_detail_blend_mode")); - ADD_PROPERTY(PropertyInfo(Variant::INT,"detail/uv_layer",PROPERTY_HINT_ENUM,"UV1,UV2"),_SCS("set_detail_uv"),_SCS("get_detail_uv")); - ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"detail/albedo",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_DETAIL_ALBEDO); - ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"detail/normal",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_DETAIL_NORMAL); - - ADD_PROPERTY(PropertyInfo(Variant::VECTOR2,"uv1/scale"),_SCS("set_uv1_scale"),_SCS("get_uv1_scale")); - ADD_PROPERTY(PropertyInfo(Variant::VECTOR2,"uv1/offset"),_SCS("set_uv1_offset"),_SCS("get_uv1_offset")); - ADD_PROPERTY(PropertyInfo(Variant::VECTOR2,"uv2/scale"),_SCS("set_uv2_scale"),_SCS("get_uv2_scale")); - ADD_PROPERTY(PropertyInfo(Variant::VECTOR2,"uv2/offset"),_SCS("set_uv2_offset"),_SCS("get_uv2_offset")); + ADD_GROUP("Flags","flags_"); + ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"flags_transparent"),_SCS("set_feature"),_SCS("get_feature"),FEATURE_TRANSPARENT); + ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"flags_unshaded"),_SCS("set_flag"),_SCS("get_flag"),FLAG_UNSHADED); + ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"flags_on_top"),_SCS("set_flag"),_SCS("get_flag"),FLAG_ONTOP); + ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"flags_use_point_size"),_SCS("set_flag"),_SCS("get_flag"),FLAG_USE_POINT_SIZE); + ADD_GROUP("Vertex Color","vertex_color"); + ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"vertex_color_use_as_albedo"),_SCS("set_flag"),_SCS("get_flag"),FLAG_ALBEDO_FROM_VERTEX_COLOR); + ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"vertex_color_is_srgb"),_SCS("set_flag"),_SCS("get_flag"),FLAG_SRGB_VERTEX_COLOR); + + ADD_GROUP("Parameters","params_"); + ADD_PROPERTY(PropertyInfo(Variant::INT,"params_diffuse_mode",PROPERTY_HINT_ENUM,"Labert,Lambert Wrap,Oren Nayar,Burley"),_SCS("set_diffuse_mode"),_SCS("get_diffuse_mode")); + ADD_PROPERTY(PropertyInfo(Variant::INT,"params_blend_mode",PROPERTY_HINT_ENUM,"Mix,Add,Sub,Mul"),_SCS("set_blend_mode"),_SCS("get_blend_mode")); + ADD_PROPERTY(PropertyInfo(Variant::INT,"params_cull_mode",PROPERTY_HINT_ENUM,"Back,Front,Disabled"),_SCS("set_cull_mode"),_SCS("get_cull_mode")); + ADD_PROPERTY(PropertyInfo(Variant::INT,"params_depth_draw_mode",PROPERTY_HINT_ENUM,"Opaque Only,Always,Never,Opaque Pre-Pass"),_SCS("set_depth_draw_mode"),_SCS("get_depth_draw_mode")); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"params_line_width",PROPERTY_HINT_RANGE,"0.1,128,0.1"),_SCS("set_line_width"),_SCS("get_line_width")); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"params_point_size",PROPERTY_HINT_RANGE,"0.1,128,0.1"),_SCS("set_point_size"),_SCS("get_point_size")); + + ADD_GROUP("Albedo","albedo_"); + ADD_PROPERTY(PropertyInfo(Variant::COLOR,"albedo_color"),_SCS("set_albedo"),_SCS("get_albedo")); + ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"albedo_texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_ALBEDO); + + ADD_GROUP("Specular","specular_"); + ADD_PROPERTY(PropertyInfo(Variant::INT,"specular_mode",PROPERTY_HINT_ENUM,"Metallic,Specular"),_SCS("set_specular_mode"),_SCS("get_specular_mode")); + ADD_PROPERTY(PropertyInfo(Variant::COLOR,"specular_color",PROPERTY_HINT_COLOR_NO_ALPHA),_SCS("set_specular"),_SCS("get_specular")); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"specular_metalness",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_metalness"),_SCS("get_metalness")); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"specular_roughness",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_roughness"),_SCS("get_roughness")); + ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"specular_texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_SPECULAR); + + ADD_GROUP("Emission","emission_"); + ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"emission_enabled"),_SCS("set_feature"),_SCS("get_feature"),FEATURE_EMISSION); + ADD_PROPERTY(PropertyInfo(Variant::COLOR,"emission_color",PROPERTY_HINT_COLOR_NO_ALPHA),_SCS("set_emission"),_SCS("get_emission")); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"emission_energy",PROPERTY_HINT_RANGE,"0,16,0.01"),_SCS("set_emission_energy"),_SCS("get_emission_energy")); + ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"emission_texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_EMISSION); + + ADD_GROUP("NormapMap","normal_"); + ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"normal_enabled"),_SCS("set_feature"),_SCS("get_feature"),FEATURE_NORMAL_MAPPING); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"normal_scale",PROPERTY_HINT_RANGE,"-16,16,0.01"),_SCS("set_normal_scale"),_SCS("get_normal_scale")); + ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"normal_texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_NORMAL); + + ADD_GROUP("Rim","rim_"); + ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"rim_enabled"),_SCS("set_feature"),_SCS("get_feature"),FEATURE_RIM); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"rim_amount",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_rim"),_SCS("get_rim")); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"rim_tint",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_rim_tint"),_SCS("get_rim_tint")); + ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"rim_texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_RIM); + + ADD_GROUP("Clearcoat","clearcoat_"); + ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"clearcoat_enabled"),_SCS("set_feature"),_SCS("get_feature"),FEATURE_CLEARCOAT); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"clearcoat_amount",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_clearcoat"),_SCS("get_clearcoat")); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"clearcoat_gloss",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_clearcoat_gloss"),_SCS("get_clearcoat_gloss")); + ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"clearcoat_texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_CLEARCOAT); + + ADD_GROUP("Anisotropy","anisotropy_"); + ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"anisotropy_enabled"),_SCS("set_feature"),_SCS("get_feature"),FEATURE_ANISOTROPY); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"anisotropy_anisotropy",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_anisotropy"),_SCS("get_anisotropy")); + ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"anisotropy_flowmap",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_FLOWMAP); + + ADD_GROUP("Ambient Occlusion","ao_"); + ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"ao_enabled"),_SCS("set_feature"),_SCS("get_feature"),FEATURE_AMBIENT_OCCLUSION); + ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"ao_texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_AMBIENT_OCCLUSION); + + ADD_GROUP("Height","height_"); + ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"height_enabled"),_SCS("set_feature"),_SCS("get_feature"),FEATURE_HEIGHT_MAPPING); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"height_scale",PROPERTY_HINT_RANGE,"-16,16,0.01"),_SCS("set_height_scale"),_SCS("get_height_scale")); + ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"height_texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_HEIGHT); + + ADD_GROUP("Subsurf Scatter","subsurf_scatter_"); + ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"subsurf_scatter_enabled"),_SCS("set_feature"),_SCS("get_feature"),FEATURE_SUBSURACE_SCATTERING); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"subsurf_scatter_strength",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_subsurface_scattering_strength"),_SCS("get_subsurface_scattering_strength")); + ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"subsurf_scatter_texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_SUBSURFACE_SCATTERING); + + ADD_GROUP("Refraction","refraction_"); + ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"refraction_enabled"),_SCS("set_feature"),_SCS("get_feature"),FEATURE_REFRACTION); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"refraction_displacement",PROPERTY_HINT_RANGE,"-1,1,0.01"),_SCS("set_refraction"),_SCS("get_refraction")); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"refraction_roughness",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_refraction_roughness"),_SCS("get_refraction_roughness")); + ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"refraction_texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_REFRACTION); + + ADD_GROUP("Detail","detail_"); + ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"detail_enabled"),_SCS("set_feature"),_SCS("get_feature"),FEATURE_DETAIL); + ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"detail_mask",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_DETAIL_MASK); + ADD_PROPERTY(PropertyInfo(Variant::INT,"detail_blend_mode",PROPERTY_HINT_ENUM,"Mix,Add,Sub,Mul"),_SCS("set_detail_blend_mode"),_SCS("get_detail_blend_mode")); + ADD_PROPERTY(PropertyInfo(Variant::INT,"detail_uv_layer",PROPERTY_HINT_ENUM,"UV1,UV2"),_SCS("set_detail_uv"),_SCS("get_detail_uv")); + ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"detail_albedo",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_DETAIL_ALBEDO); + ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"detail_normal",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_DETAIL_NORMAL); + + ADD_GROUP("UV1","uv1_"); + ADD_PROPERTY(PropertyInfo(Variant::VECTOR2,"uv1_scale"),_SCS("set_uv1_scale"),_SCS("get_uv1_scale")); + ADD_PROPERTY(PropertyInfo(Variant::VECTOR2,"uv1_offset"),_SCS("set_uv1_offset"),_SCS("get_uv1_offset")); + + ADD_GROUP("UV2","uv2_"); + ADD_PROPERTY(PropertyInfo(Variant::VECTOR2,"uv2_scale"),_SCS("set_uv2_scale"),_SCS("get_uv2_scale")); + ADD_PROPERTY(PropertyInfo(Variant::VECTOR2,"uv2_offset"),_SCS("set_uv2_offset"),_SCS("get_uv2_offset")); BIND_CONSTANT( TEXTURE_ALBEDO ); diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp index ed35eb0216..bad87910ff 100644 --- a/scene/resources/mesh.cpp +++ b/scene/resources/mesh.cpp @@ -79,9 +79,9 @@ bool Mesh::_set(const StringName& p_name, const Variant& p_value) { if (p_name=="morph_target/names") { - DVector<String> sk=p_value; + PoolVector<String> sk=p_value; int sz = sk.size(); - DVector<String>::Read r = sk.read(); + PoolVector<String>::Read r = sk.read(); for(int i=0;i<sz;i++) add_morph_target(r[i]); return true; @@ -133,8 +133,8 @@ bool Mesh::_set(const StringName& p_name, const Variant& p_value) { } else if (d.has("array_data")) { - DVector<uint8_t> array_data = d["array_data"]; - DVector<uint8_t> array_index_data; + PoolVector<uint8_t> array_data = d["array_data"]; + PoolVector<uint8_t> array_index_data; if (d.has("array_index_data")) array_index_data=d["array_index_data"]; @@ -151,12 +151,12 @@ bool Mesh::_set(const StringName& p_name, const Variant& p_value) { if (d.has("index_count")) index_count=d["index_count"]; - Vector< DVector<uint8_t> > morphs; + Vector< PoolVector<uint8_t> > morphs; if (d.has("morph_data")) { Array morph_data=d["morph_data"]; for(int i=0;i<morph_data.size();i++) { - DVector<uint8_t> morph = morph_data[i]; + PoolVector<uint8_t> morph = morph_data[i]; morphs.push_back(morph_data[i]); } } @@ -201,7 +201,7 @@ bool Mesh::_get(const StringName& p_name,Variant &r_ret) const { if (p_name=="morph_target/names") { - DVector<String> sk; + PoolVector<String> sk; for(int i=0;i<morph_targets.size();i++) sk.push_back(morph_targets[i]); r_ret=sk; @@ -251,7 +251,7 @@ bool Mesh::_get(const StringName& p_name,Variant &r_ret) const { } d["skeleton_aabb"]=arr; - Vector< DVector<uint8_t> > morph_data = VS::get_singleton()->mesh_surface_get_blend_shapes(mesh,idx); + Vector< PoolVector<uint8_t> > morph_data = VS::get_singleton()->mesh_surface_get_blend_shapes(mesh,idx); Array md; for(int i=0;i<morph_data.size();i++) { @@ -306,7 +306,7 @@ void Mesh::_recompute_aabb() { } -void Mesh::add_surface(uint32_t p_format,PrimitiveType p_primitive,const DVector<uint8_t>& p_array,int p_vertex_count,const DVector<uint8_t>& p_index_array,int p_index_count,const AABB& p_aabb,const Vector<DVector<uint8_t> >& p_blend_shapes,const Vector<AABB>& p_bone_aabbs) { +void Mesh::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_aabbs) { Surface s; s.aabb=p_aabb; @@ -330,10 +330,10 @@ void Mesh::add_surface_from_arrays(PrimitiveType p_primitive,const Array& p_arra /* make aABB? */ { - DVector<Vector3> vertices=p_arrays[ARRAY_VERTEX]; + PoolVector<Vector3> vertices=p_arrays[ARRAY_VERTEX]; int len=vertices.size(); ERR_FAIL_COND(len==0); - DVector<Vector3>::Read r=vertices.read(); + PoolVector<Vector3>::Read r=vertices.read(); const Vector3 *vtx=r.ptr(); // check AABB @@ -569,21 +569,21 @@ AABB Mesh::get_custom_aabb() const { } -DVector<Face3> Mesh::get_faces() const { +PoolVector<Face3> Mesh::get_faces() const { Ref<TriangleMesh> tm = generate_triangle_mesh(); if (tm.is_valid()) return tm->get_faces(); - return DVector<Face3>(); + return PoolVector<Face3>(); /* for (int i=0;i<surfaces.size();i++) { if (VisualServer::get_singleton()->mesh_surface_get_primitive_type( mesh, i ) != VisualServer::PRIMITIVE_TRIANGLES ) continue; - DVector<int> indices; - DVector<Vector3> vertices; + PoolVector<int> indices; + PoolVector<Vector3> vertices; vertices=VisualServer::get_singleton()->mesh_surface_get_array(mesh, i,VisualServer::ARRAY_VERTEX); @@ -604,10 +604,10 @@ DVector<Face3> Mesh::get_faces() const { if (len<=0) continue; - DVector<int>::Read indicesr = indices.read(); + PoolVector<int>::Read indicesr = indices.read(); const int *indicesptr = indicesr.ptr(); - DVector<Vector3>::Read verticesr = vertices.read(); + PoolVector<Vector3>::Read verticesr = vertices.read(); const Vector3 *verticesptr = verticesr.ptr(); int old_faces=faces.size(); @@ -615,7 +615,7 @@ DVector<Face3> Mesh::get_faces() const { faces.resize(new_faces); - DVector<Face3>::Write facesw = faces.write(); + PoolVector<Face3>::Write facesw = faces.write(); Face3 *facesptr=facesw.ptr(); @@ -639,12 +639,12 @@ DVector<Face3> Mesh::get_faces() const { Ref<Shape> Mesh::create_convex_shape() const { - DVector<Vector3> vertices; + PoolVector<Vector3> vertices; for(int i=0;i<get_surface_count();i++) { Array a = surface_get_arrays(i); - DVector<Vector3> v=a[ARRAY_VERTEX]; + PoolVector<Vector3> v=a[ARRAY_VERTEX]; vertices.append_array(v); } @@ -656,11 +656,11 @@ Ref<Shape> Mesh::create_convex_shape() const { Ref<Shape> Mesh::create_trimesh_shape() const { - DVector<Face3> faces = get_faces(); + PoolVector<Face3> faces = get_faces(); if (faces.size()==0) return Ref<Shape>(); - DVector<Vector3> face_points; + PoolVector<Vector3> face_points; face_points.resize( faces.size()*3 ); for (int i=0;i<face_points.size();i++) { @@ -681,9 +681,9 @@ void Mesh::center_geometry() { for(int i=0;i<get_surface_count();i++) { - DVector<Vector3> geom = surface_get_array(i,ARRAY_VERTEX); + PoolVector<Vector3> geom = surface_get_array(i,ARRAY_VERTEX); int gc =geom.size(); - DVector<Vector3>::Write w = geom.write(); + PoolVector<Vector3>::Write w = geom.write(); surfaces[i].aabb.pos-=ofs; for(int i=0;i<gc;i++) { @@ -691,7 +691,7 @@ void Mesh::center_geometry() { w[i]-=ofs; } - w = DVector<Vector3>::Write(); + w = PoolVector<Vector3>::Write(); surface_set_array(i,ARRAY_VERTEX,geom); @@ -752,9 +752,9 @@ Ref<TriangleMesh> Mesh::generate_triangle_mesh() const { if (facecount==0 || (facecount%3)!=0) return triangle_mesh; - DVector<Vector3> faces; + PoolVector<Vector3> faces; faces.resize(facecount); - DVector<Vector3>::Write facesw=faces.write(); + PoolVector<Vector3>::Write facesw=faces.write(); int widx=0; @@ -766,14 +766,14 @@ Ref<TriangleMesh> Mesh::generate_triangle_mesh() const { Array a = surface_get_arrays(i); int vc = surface_get_array_len(i); - DVector<Vector3> vertices = a[ARRAY_VERTEX]; - DVector<Vector3>::Read vr=vertices.read(); + PoolVector<Vector3> vertices = a[ARRAY_VERTEX]; + PoolVector<Vector3>::Read vr=vertices.read(); if (surface_get_format(i)&ARRAY_FORMAT_INDEX) { int ic=surface_get_array_index_len(i); - DVector<int> indices = a[ARRAY_INDEX]; - DVector<int>::Read ir = indices.read(); + PoolVector<int> indices = a[ARRAY_INDEX]; + PoolVector<int>::Read ir = indices.read(); for(int i=0;i<ic;i++) { int index = ir[i]; @@ -788,7 +788,7 @@ Ref<TriangleMesh> Mesh::generate_triangle_mesh() const { } - facesw=DVector<Vector3>::Write(); + facesw=PoolVector<Vector3>::Write(); triangle_mesh = Ref<TriangleMesh>( memnew( TriangleMesh )); @@ -814,7 +814,7 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const { if (i==0) { arrays=a; - DVector<Vector3> v=a[ARRAY_VERTEX]; + PoolVector<Vector3> v=a[ARRAY_VERTEX]; index_accum+=v.size(); } else { @@ -831,8 +831,8 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const { case ARRAY_VERTEX: case ARRAY_NORMAL: { - DVector<Vector3> dst = arrays[j]; - DVector<Vector3> src = a[j]; + PoolVector<Vector3> dst = arrays[j]; + PoolVector<Vector3> src = a[j]; if (j==ARRAY_VERTEX) vcount=src.size(); if (dst.size()==0 || src.size()==0) { @@ -846,8 +846,8 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const { case ARRAY_BONES: case ARRAY_WEIGHTS: { - DVector<real_t> dst = arrays[j]; - DVector<real_t> src = a[j]; + PoolVector<real_t> dst = arrays[j]; + PoolVector<real_t> src = a[j]; if (dst.size()==0 || src.size()==0) { arrays[j]=Variant(); continue; @@ -857,8 +857,8 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const { } break; case ARRAY_COLOR: { - DVector<Color> dst = arrays[j]; - DVector<Color> src = a[j]; + PoolVector<Color> dst = arrays[j]; + PoolVector<Color> src = a[j]; if (dst.size()==0 || src.size()==0) { arrays[j]=Variant(); continue; @@ -869,8 +869,8 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const { } break; case ARRAY_TEX_UV: case ARRAY_TEX_UV2: { - DVector<Vector2> dst = arrays[j]; - DVector<Vector2> src = a[j]; + PoolVector<Vector2> dst = arrays[j]; + PoolVector<Vector2> src = a[j]; if (dst.size()==0 || src.size()==0) { arrays[j]=Variant(); continue; @@ -880,15 +880,15 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const { } break; case ARRAY_INDEX: { - DVector<int> dst = arrays[j]; - DVector<int> src = a[j]; + PoolVector<int> dst = arrays[j]; + PoolVector<int> src = a[j]; if (dst.size()==0 || src.size()==0) { arrays[j]=Variant(); continue; } { int ss = src.size(); - DVector<int>::Write w = src.write(); + PoolVector<int>::Write w = src.write(); for(int k=0;k<ss;k++) { w[k]+=index_accum; } @@ -906,13 +906,13 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const { } { - DVector<int>::Write ir; - DVector<int> indices =arrays[ARRAY_INDEX]; + PoolVector<int>::Write ir; + PoolVector<int> indices =arrays[ARRAY_INDEX]; bool has_indices=false; - DVector<Vector3> vertices =arrays[ARRAY_VERTEX]; + PoolVector<Vector3> vertices =arrays[ARRAY_VERTEX]; int vc = vertices.size(); ERR_FAIL_COND_V(!vc,Ref<Mesh>()); - DVector<Vector3>::Write r=vertices.write(); + PoolVector<Vector3>::Write r=vertices.write(); if (indices.size()) { @@ -977,14 +977,14 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const { r[i]=t; } - r = DVector<Vector3>::Write(); + r = PoolVector<Vector3>::Write(); arrays[ARRAY_VERTEX]=vertices; if (!has_indices) { - DVector<int> new_indices; + PoolVector<int> new_indices; new_indices.resize(vertices.size()); - DVector<int>::Write iw = new_indices.write(); + PoolVector<int>::Write iw = new_indices.write(); for(int j=0;j<vc2;j+=3) { @@ -993,7 +993,7 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const { iw[j+2]=j+1; } - iw=DVector<int>::Write(); + iw=PoolVector<int>::Write(); arrays[ARRAY_INDEX]=new_indices; } else { @@ -1002,7 +1002,7 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const { SWAP(ir[j+1],ir[j+2]); } - ir=DVector<int>::Write(); + ir=PoolVector<int>::Write(); arrays[ARRAY_INDEX]=indices; } diff --git a/scene/resources/mesh.h b/scene/resources/mesh.h index 9be90b6436..f92db837ea 100644 --- a/scene/resources/mesh.h +++ b/scene/resources/mesh.h @@ -139,7 +139,7 @@ protected: public: void add_surface_from_arrays(PrimitiveType p_primitive, const Array& p_arrays, const Array& p_blend_shapes=Array(), uint32_t p_flags=ARRAY_COMPRESS_DEFAULT); - void add_surface(uint32_t p_format,PrimitiveType p_primitive,const DVector<uint8_t>& p_array,int p_vertex_count,const DVector<uint8_t>& p_index_array,int p_index_count,const AABB& p_aabb,const Vector<DVector<uint8_t> >& p_blend_shapes=Vector<DVector<uint8_t> >(),const Vector<AABB>& p_bone_aabbs=Vector<AABB>()); + 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>()); Array surface_get_arrays(int p_surface) const; virtual Array surface_get_morph_arrays(int p_surface) const; @@ -186,7 +186,7 @@ public: void center_geometry(); void regen_normalmaps(); - DVector<Face3> get_faces() const; + PoolVector<Face3> get_faces() const; Ref<TriangleMesh> generate_triangle_mesh() const; Mesh(); diff --git a/scene/resources/mesh_data_tool.cpp b/scene/resources/mesh_data_tool.cpp index 4a753e6c09..ec699ee8e3 100644 --- a/scene/resources/mesh_data_tool.cpp +++ b/scene/resources/mesh_data_tool.cpp @@ -51,7 +51,7 @@ Error MeshDataTool::create_from_surface(const Ref<Mesh>& p_mesh,int p_surface) { Array arrays = p_mesh->surface_get_arrays(p_surface); ERR_FAIL_COND_V( arrays.empty(), ERR_INVALID_PARAMETER ); - DVector<Vector3> varray = arrays[Mesh::ARRAY_VERTEX]; + PoolVector<Vector3> varray = arrays[Mesh::ARRAY_VERTEX]; int vcount = varray.size(); ERR_FAIL_COND_V( vcount == 0, ERR_INVALID_PARAMETER); @@ -60,34 +60,34 @@ Error MeshDataTool::create_from_surface(const Ref<Mesh>& p_mesh,int p_surface) { format = p_mesh->surface_get_format(p_surface); material=p_mesh->surface_get_material(p_surface); - DVector<Vector3>::Read vr = varray.read(); + PoolVector<Vector3>::Read vr = varray.read(); - DVector<Vector3>::Read nr; + PoolVector<Vector3>::Read nr; if (arrays[Mesh::ARRAY_NORMAL].get_type()!=Variant::NIL) - nr = arrays[Mesh::ARRAY_NORMAL].operator DVector<Vector3>().read(); + nr = arrays[Mesh::ARRAY_NORMAL].operator PoolVector<Vector3>().read(); - DVector<real_t>::Read ta; + PoolVector<real_t>::Read ta; if (arrays[Mesh::ARRAY_TANGENT].get_type()!=Variant::NIL) - ta = arrays[Mesh::ARRAY_TANGENT].operator DVector<real_t>().read(); + ta = arrays[Mesh::ARRAY_TANGENT].operator PoolVector<real_t>().read(); - DVector<Vector2>::Read uv; + PoolVector<Vector2>::Read uv; if (arrays[Mesh::ARRAY_TEX_UV].get_type()!=Variant::NIL) - uv = arrays[Mesh::ARRAY_TEX_UV].operator DVector<Vector2>().read(); - DVector<Vector2>::Read uv2; + uv = arrays[Mesh::ARRAY_TEX_UV].operator PoolVector<Vector2>().read(); + PoolVector<Vector2>::Read uv2; if (arrays[Mesh::ARRAY_TEX_UV2].get_type()!=Variant::NIL) - uv2 = arrays[Mesh::ARRAY_TEX_UV2].operator DVector<Vector2>().read(); + uv2 = arrays[Mesh::ARRAY_TEX_UV2].operator PoolVector<Vector2>().read(); - DVector<Color>::Read col; + PoolVector<Color>::Read col; if (arrays[Mesh::ARRAY_COLOR].get_type()!=Variant::NIL) - col = arrays[Mesh::ARRAY_COLOR].operator DVector<Color>().read(); + col = arrays[Mesh::ARRAY_COLOR].operator PoolVector<Color>().read(); - DVector<real_t>::Read bo; + PoolVector<real_t>::Read bo; if (arrays[Mesh::ARRAY_BONES].get_type()!=Variant::NIL) - bo = arrays[Mesh::ARRAY_BONES].operator DVector<real_t>().read(); + bo = arrays[Mesh::ARRAY_BONES].operator PoolVector<real_t>().read(); - DVector<real_t>::Read we; + PoolVector<real_t>::Read we; if (arrays[Mesh::ARRAY_WEIGHTS].get_type()!=Variant::NIL) - we = arrays[Mesh::ARRAY_WEIGHTS].operator DVector<real_t>().read(); + we = arrays[Mesh::ARRAY_WEIGHTS].operator PoolVector<real_t>().read(); vertices.resize(vcount); @@ -129,7 +129,7 @@ Error MeshDataTool::create_from_surface(const Ref<Mesh>& p_mesh,int p_surface) { } - DVector<int> indices; + PoolVector<int> indices; if (arrays[Mesh::ARRAY_INDEX].get_type()!=Variant::NIL) { @@ -137,14 +137,14 @@ Error MeshDataTool::create_from_surface(const Ref<Mesh>& p_mesh,int p_surface) { } else { //make code simpler indices.resize(vcount); - DVector<int>::Write iw=indices.write(); + PoolVector<int>::Write iw=indices.write(); for(int i=0;i<vcount;i++) iw[i]=i; } int icount=indices.size(); - DVector<int>::Read r = indices.read(); + PoolVector<int>::Read r = indices.read(); Map<Point2i,int> edge_indices; @@ -199,59 +199,59 @@ Error MeshDataTool::commit_to_surface(const Ref<Mesh>& p_mesh) { int vcount=vertices.size(); - DVector<Vector3> v; - DVector<Vector3> n; - DVector<real_t> t; - DVector<Vector2> u; - DVector<Vector2> u2; - DVector<Color> c; - DVector<real_t> b; - DVector<real_t> w; - DVector<int> in; + PoolVector<Vector3> v; + PoolVector<Vector3> n; + PoolVector<real_t> t; + PoolVector<Vector2> u; + PoolVector<Vector2> u2; + PoolVector<Color> c; + PoolVector<real_t> b; + PoolVector<real_t> w; + PoolVector<int> in; { v.resize(vcount); - DVector<Vector3>::Write vr=v.write(); + PoolVector<Vector3>::Write vr=v.write(); - DVector<Vector3>::Write nr; + PoolVector<Vector3>::Write nr; if (format&Mesh::ARRAY_FORMAT_NORMAL) { n.resize(vcount); nr = n.write(); } - DVector<real_t>::Write ta; + PoolVector<real_t>::Write ta; if (format&Mesh::ARRAY_FORMAT_TANGENT) { t.resize(vcount*4); ta = t.write(); } - DVector<Vector2>::Write uv; + PoolVector<Vector2>::Write uv; if (format&Mesh::ARRAY_FORMAT_TEX_UV) { u.resize(vcount); uv = u.write(); } - DVector<Vector2>::Write uv2; + PoolVector<Vector2>::Write uv2; if (format&Mesh::ARRAY_FORMAT_TEX_UV2) { u2.resize(vcount); uv2 = u2.write(); } - DVector<Color>::Write col; + PoolVector<Color>::Write col; if (format&Mesh::ARRAY_FORMAT_COLOR) { c.resize(vcount); col = c.write(); } - DVector<real_t>::Write bo; + PoolVector<real_t>::Write bo; if (format&Mesh::ARRAY_FORMAT_BONES) { b.resize(vcount*4); bo = b.write(); } - DVector<real_t>::Write we; + PoolVector<real_t>::Write we; if (format&Mesh::ARRAY_FORMAT_WEIGHTS) { w.resize(vcount*4); we = w.write(); @@ -299,7 +299,7 @@ Error MeshDataTool::commit_to_surface(const Ref<Mesh>& p_mesh) { int fc = faces.size(); in.resize(fc*3); - DVector<int>::Write iw=in.write(); + PoolVector<int>::Write iw=in.write(); for(int i=0;i<fc;i++) { iw[i*3+0]=faces[i].v[0]; diff --git a/scene/resources/multimesh.cpp b/scene/resources/multimesh.cpp index 802f58e8ca..143870c920 100644 --- a/scene/resources/multimesh.cpp +++ b/scene/resources/multimesh.cpp @@ -31,17 +31,17 @@ -void MultiMesh::_set_transform_array(const DVector<Vector3>& p_array) { +void MultiMesh::_set_transform_array(const PoolVector<Vector3>& p_array) { int instance_count = get_instance_count(); - DVector<Vector3> xforms = p_array; + PoolVector<Vector3> xforms = p_array; int len=xforms.size(); ERR_FAIL_COND((len/4) != instance_count); if (len==0) return; - DVector<Vector3>::Read r = xforms.read(); + PoolVector<Vector3>::Read r = xforms.read(); for(int i=0;i<len/4;i++) { @@ -56,17 +56,17 @@ void MultiMesh::_set_transform_array(const DVector<Vector3>& p_array) { } -DVector<Vector3> MultiMesh::_get_transform_array() const { +PoolVector<Vector3> MultiMesh::_get_transform_array() const { int instance_count = get_instance_count(); if (instance_count==0) - return DVector<Vector3>(); + return PoolVector<Vector3>(); - DVector<Vector3> xforms; + PoolVector<Vector3> xforms; xforms.resize(instance_count*4); - DVector<Vector3>::Write w = xforms.write(); + PoolVector<Vector3>::Write w = xforms.write(); for(int i=0;i<instance_count;i++) { @@ -82,17 +82,17 @@ DVector<Vector3> MultiMesh::_get_transform_array() const { } -void MultiMesh::_set_color_array(const DVector<Color>& p_array) { +void MultiMesh::_set_color_array(const PoolVector<Color>& p_array) { int instance_count = get_instance_count(); - DVector<Color> colors = p_array; + PoolVector<Color> colors = p_array; int len=colors.size(); ERR_FAIL_COND(len != instance_count); if (len==0) return; - DVector<Color>::Read r = colors.read(); + PoolVector<Color>::Read r = colors.read(); for(int i=0;i<len;i++) { @@ -101,14 +101,14 @@ void MultiMesh::_set_color_array(const DVector<Color>& p_array) { } -DVector<Color> MultiMesh::_get_color_array() const { +PoolVector<Color> MultiMesh::_get_color_array() const { int instance_count = get_instance_count(); if (instance_count==0) - return DVector<Color>(); + return PoolVector<Color>(); - DVector<Color> colors; + PoolVector<Color> colors; colors.resize(instance_count); for(int i=0;i<instance_count;i++) { diff --git a/scene/resources/multimesh.h b/scene/resources/multimesh.h index ab2ef59214..3ba109a087 100644 --- a/scene/resources/multimesh.h +++ b/scene/resources/multimesh.h @@ -59,11 +59,11 @@ protected: static void _bind_methods(); - void _set_transform_array(const DVector<Vector3>& p_array); - DVector<Vector3> _get_transform_array() const; + void _set_transform_array(const PoolVector<Vector3>& p_array); + PoolVector<Vector3> _get_transform_array() const; - void _set_color_array(const DVector<Color>& p_array); - DVector<Color> _get_color_array() const; + void _set_color_array(const PoolVector<Color>& p_array); + PoolVector<Color> _get_color_array() const; public: diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp index 7d86513c51..625cc6a596 100644 --- a/scene/resources/packed_scene.cpp +++ b/scene/resources/packed_scene.cpp @@ -42,7 +42,7 @@ bool SceneState::can_instance() const { } -Node *SceneState::instance(bool p_gen_edit_state) const { +Node *SceneState::instance(GenEditState p_edit_state) const { // nodes where instancing failed (because something is missing) List<Node*> stray_instances; @@ -76,7 +76,9 @@ Node *SceneState::instance(bool p_gen_edit_state) const { Node **ret_nodes=(Node**)alloca( sizeof(Node*)*nc ); - bool gen_node_path_cache=p_gen_edit_state && node_path_cache.empty(); + bool gen_node_path_cache=p_edit_state!=GEN_EDIT_STATE_DISABLED && node_path_cache.empty(); + + Map<Ref<Resource>,Ref<Resource> > resources_local_to_scene; for(int i=0;i<nc;i++) { @@ -105,9 +107,9 @@ Node *SceneState::instance(bool p_gen_edit_state) const { //print_line("scene inherit"); Ref<PackedScene> sdata = props[ base_scene_idx ]; ERR_FAIL_COND_V( !sdata.is_valid(), NULL); - node = sdata->instance(p_gen_edit_state); + node = sdata->instance(p_edit_state==GEN_EDIT_STATE_DISABLED ? PackedScene::GEN_EDIT_STATE_DISABLED : PackedScene::GEN_EDIT_STATE_INSTANCE); //only main gets main edit state ERR_FAIL_COND_V(!node,NULL); - if (p_gen_edit_state) { + if (p_edit_state!=GEN_EDIT_STATE_DISABLED) { node->set_scene_inherited_state(sdata->get_state()); } @@ -121,7 +123,7 @@ Node *SceneState::instance(bool p_gen_edit_state) const { Ref<PackedScene> sdata = ResourceLoader::load(path,"PackedScene"); ERR_FAIL_COND_V( !sdata.is_valid(), NULL); - node = sdata->instance(p_gen_edit_state); + node = sdata->instance(p_edit_state==GEN_EDIT_STATE_DISABLED ? PackedScene::GEN_EDIT_STATE_DISABLED : PackedScene::GEN_EDIT_STATE_INSTANCE); ERR_FAIL_COND_V(!node,NULL); } else { InstancePlaceholder *ip = memnew( InstancePlaceholder ); @@ -132,7 +134,7 @@ Node *SceneState::instance(bool p_gen_edit_state) const { } else { Ref<PackedScene> sdata = props[ n.instance&FLAG_MASK ]; ERR_FAIL_COND_V( !sdata.is_valid(), NULL); - node = sdata->instance(p_gen_edit_state); + node = sdata->instance(p_edit_state==GEN_EDIT_STATE_DISABLED ? PackedScene::GEN_EDIT_STATE_DISABLED : PackedScene::GEN_EDIT_STATE_INSTANCE); ERR_FAIL_COND_V(!node,NULL); } @@ -166,8 +168,8 @@ Node *SceneState::instance(bool p_gen_edit_state) const { } else if (ret_nodes[n.parent]->cast_to<Node2D>()) { obj = memnew( Node2D ); } - } + if (!obj) { obj = memnew( Node ); } @@ -212,7 +214,43 @@ Node *SceneState::instance(bool p_gen_edit_state) const { } } else { - node->set(snames[ nprops[j].name ],props[ nprops[j].value ],&valid); + Variant value = props[ nprops[j].value ]; + + if (value.get_type()==Variant::OBJECT) { + //handle resources that are local to scene by duplicating them if needed + Ref<Resource> res = value; + if (res.is_valid()) { + if (res->is_local_to_scene()) { + + Map<Ref<Resource>,Ref<Resource> >::Element *E=resources_local_to_scene.find(res); + + if (E) { + value=E->get(); + } else { + + Node *base = i==0?node:ret_nodes[0]; + + if (p_edit_state==GEN_EDIT_STATE_MAIN) { + + res->local_scene=base; + resources_local_to_scene[res]=res; + + } else { + Node *base = i==0?node:ret_nodes[0]; + Ref<Resource> local_dupe = res->duplicate_for_local_scene(base,resources_local_to_scene); + resources_local_to_scene[res]=local_dupe; + res=local_dupe; + value=local_dupe; + } + + res->setup_local_to_scene(); + + } + //must make a copy, because this res is local to scene + } + } + } + node->set(snames[ nprops[j].name ],value,&valid); } } } @@ -1139,12 +1177,12 @@ void SceneState::set_bundled_scene(const Dictionary& d) { ERR_FAIL(); } - DVector<String> snames = d["names"]; + PoolVector<String> snames = d["names"]; if (snames.size()) { int namecount = snames.size(); names.resize(namecount); - DVector<String>::Read r =snames.read(); + PoolVector<String>::Read r =snames.read(); for(int i=0;i<names.size();i++) names[i]=r[i]; } @@ -1166,8 +1204,8 @@ void SceneState::set_bundled_scene(const Dictionary& d) { nodes.resize(d["node_count"]); int nc=nodes.size(); if (nc) { - DVector<int> snodes = d["nodes"]; - DVector<int>::Read r = snodes.read(); + PoolVector<int> snodes = d["nodes"]; + PoolVector<int>::Read r = snodes.read(); int idx=0; for(int i=0;i<nc;i++) { NodeData &nd = nodes[i]; @@ -1196,8 +1234,8 @@ void SceneState::set_bundled_scene(const Dictionary& d) { if (cc) { - DVector<int> sconns = d["conns"]; - DVector<int>::Read r = sconns.read(); + PoolVector<int> sconns = d["conns"]; + PoolVector<int>::Read r = sconns.read(); int idx=0; for(int i=0;i<cc;i++) { ConnectionData &cd = connections[i]; @@ -1245,12 +1283,12 @@ void SceneState::set_bundled_scene(const Dictionary& d) { Dictionary SceneState::get_bundled_scene() const { - DVector<String> rnames; + PoolVector<String> rnames; rnames.resize(names.size()); if (names.size()) { - DVector<String>::Write r=rnames.write(); + PoolVector<String>::Write r=rnames.write(); for(int i=0;i<names.size();i++) r[i]=names[i]; @@ -1659,10 +1697,10 @@ void SceneState::add_editable_instance(const NodePath& p_path){ editable_instances.push_back(p_path); } -DVector<String> SceneState::_get_node_groups(int p_idx) const { +PoolVector<String> SceneState::_get_node_groups(int p_idx) const { Vector<StringName> groups = get_node_groups(p_idx); - DVector<String> ret; + PoolVector<String> ret; for(int i=0;i<groups.size();i++) ret.push_back(groups[i]); @@ -1693,6 +1731,10 @@ void SceneState::_bind_methods() { ClassDB::bind_method(_MD("get_connection_method","idx"),&SceneState::get_connection_method); ClassDB::bind_method(_MD("get_connection_flags","idx"),&SceneState::get_connection_flags); ClassDB::bind_method(_MD("get_connection_binds","idx"),&SceneState::get_connection_binds); + + BIND_CONSTANT( GEN_EDIT_STATE_DISABLED ); + BIND_CONSTANT( GEN_EDIT_STATE_INSTANCE ); + BIND_CONSTANT( GEN_EDIT_STATE_MAIN ); } SceneState::SceneState() { @@ -1732,20 +1774,20 @@ bool PackedScene::can_instance() const { return state->can_instance(); } -Node *PackedScene::instance(bool p_gen_edit_state) const { +Node *PackedScene::instance(GenEditState p_edit_state) const { #ifndef TOOLS_ENABLED - if (p_gen_edit_state) { + if (p_edit_state!=GEN_EDIT_STATE_DISABLED) { ERR_EXPLAIN("Edit state is only for editors, does not work without tools compiled"); - ERR_FAIL_COND_V(p_gen_edit_state,NULL); + ERR_FAIL_COND_V(p_edit_state!=GEN_EDIT_STATE_DISABLED,NULL); } #endif - Node *s = state->instance(p_gen_edit_state); + Node *s = state->instance((SceneState::GenEditState)p_edit_state); if (!s) return NULL; - if (p_gen_edit_state) { + if (p_edit_state!=GEN_EDIT_STATE_DISABLED) { s->set_scene_instance_state(state); } @@ -1792,7 +1834,7 @@ void PackedScene::set_path(const String& p_path,bool p_take_over) { void PackedScene::_bind_methods() { ClassDB::bind_method(_MD("pack","path:Node"),&PackedScene::pack); - ClassDB::bind_method(_MD("instance:Node","gen_edit_state"),&PackedScene::instance,DEFVAL(false)); + ClassDB::bind_method(_MD("instance:Node","edit_state"),&PackedScene::instance,DEFVAL(false)); ClassDB::bind_method(_MD("can_instance"),&PackedScene::can_instance); ClassDB::bind_method(_MD("_set_bundled_scene"),&PackedScene::_set_bundled_scene); ClassDB::bind_method(_MD("_get_bundled_scene"),&PackedScene::_get_bundled_scene); @@ -1800,6 +1842,10 @@ void PackedScene::_bind_methods() { ADD_PROPERTY( PropertyInfo(Variant::DICTIONARY,"_bundled"),_SCS("_set_bundled_scene"),_SCS("_get_bundled_scene")); + BIND_CONSTANT( GEN_EDIT_STATE_DISABLED ); + BIND_CONSTANT( GEN_EDIT_STATE_INSTANCE ); + BIND_CONSTANT( GEN_EDIT_STATE_MAIN ); + } PackedScene::PackedScene() { diff --git a/scene/resources/packed_scene.h b/scene/resources/packed_scene.h index 2eda624dc3..381b356b1e 100644 --- a/scene/resources/packed_scene.h +++ b/scene/resources/packed_scene.h @@ -102,7 +102,7 @@ class SceneState : public Reference { static bool disable_placeholders; - DVector<String> _get_node_groups(int p_idx) const; + PoolVector<String> _get_node_groups(int p_idx) const; protected: @@ -117,6 +117,12 @@ public: FLAG_MASK=(1<<24)-1, }; + enum GenEditState { + GEN_EDIT_STATE_DISABLED, + GEN_EDIT_STATE_INSTANCE, + GEN_EDIT_STATE_MAIN, + }; + static void set_disable_placeholders(bool p_disable); int find_node_by_path(const NodePath& p_node) const; @@ -136,7 +142,7 @@ public: void clear(); bool can_instance() const; - Node *instance(bool p_gen_edit_state=false) const; + Node *instance(GenEditState p_edit_state) const; //unbuild API @@ -187,6 +193,8 @@ public: SceneState(); }; +VARIANT_ENUM_CAST(SceneState::GenEditState) + class PackedScene : public Resource { GDCLASS(PackedScene, Resource ); @@ -203,13 +211,18 @@ protected: static void _bind_methods(); public: + enum GenEditState { + GEN_EDIT_STATE_DISABLED, + GEN_EDIT_STATE_INSTANCE, + GEN_EDIT_STATE_MAIN, + }; Error pack(Node *p_scene); void clear(); bool can_instance() const; - Node *instance(bool p_gen_edit_state=false) const; + Node *instance(GenEditState p_edit_state=GEN_EDIT_STATE_DISABLED) const; void recreate_state(); void replace_state(Ref<SceneState> p_by); @@ -225,4 +238,6 @@ public: }; +VARIANT_ENUM_CAST(PackedScene::GenEditState) + #endif // SCENE_PRELOADER_H diff --git a/scene/resources/polygon_path_finder.cpp b/scene/resources/polygon_path_finder.cpp index 3dc3e6005a..2156487407 100644 --- a/scene/resources/polygon_path_finder.cpp +++ b/scene/resources/polygon_path_finder.cpp @@ -448,7 +448,7 @@ void PolygonPathFinder::_set_data(const Dictionary& p_data) { ERR_FAIL_COND(!p_data.has("segments")); ERR_FAIL_COND(!p_data.has("bounds")); - DVector<Vector2> p=p_data["points"]; + PoolVector<Vector2> p=p_data["points"]; Array c=p_data["connections"]; ERR_FAIL_COND(c.size()!=p.size()); @@ -458,11 +458,11 @@ void PolygonPathFinder::_set_data(const Dictionary& p_data) { int pc = p.size(); points.resize(pc+2); - DVector<Vector2>::Read pr=p.read(); + PoolVector<Vector2>::Read pr=p.read(); for(int i=0;i<pc;i++) { points[i].pos=pr[i]; - DVector<int> con=c[i]; - DVector<int>::Read cr=con.read(); + PoolVector<int> con=c[i]; + PoolVector<int>::Read cr=con.read(); int cc=con.size(); for(int j=0;j<cc;j++) { @@ -473,19 +473,19 @@ void PolygonPathFinder::_set_data(const Dictionary& p_data) { if (p_data.has("penalties")) { - DVector<float> penalties=p_data["penalties"]; + PoolVector<float> penalties=p_data["penalties"]; if (penalties.size()==pc) { - DVector<float>::Read pr = penalties.read(); + PoolVector<float>::Read pr = penalties.read(); for(int i=0;i<pc;i++) { points[i].penalty=pr[i]; } } } - DVector<int> segs=p_data["segments"]; + PoolVector<int> segs=p_data["segments"]; int sc=segs.size(); ERR_FAIL_COND(sc&1); - DVector<int>::Read sr = segs.read(); + PoolVector<int>::Read sr = segs.read(); for(int i=0;i<sc;i+=2) { Edge e(sr[i],sr[i+1]); @@ -498,25 +498,25 @@ void PolygonPathFinder::_set_data(const Dictionary& p_data) { Dictionary PolygonPathFinder::_get_data() const{ Dictionary d; - DVector<Vector2> p; - DVector<int> ind; + PoolVector<Vector2> p; + PoolVector<int> ind; Array connections; p.resize(points.size()-2); connections.resize(points.size()-2); ind.resize(edges.size()*2); - DVector<float> penalties; + PoolVector<float> penalties; penalties.resize(points.size()-2); { - DVector<Vector2>::Write wp=p.write(); - DVector<float>::Write pw=penalties.write(); + PoolVector<Vector2>::Write wp=p.write(); + PoolVector<float>::Write pw=penalties.write(); for(int i=0;i<points.size()-2;i++) { wp[i]=points[i].pos; pw[i]=points[i].penalty; - DVector<int> c; + PoolVector<int> c; c.resize(points[i].connections.size()); { - DVector<int>::Write cw=c.write(); + PoolVector<int>::Write cw=c.write(); int idx=0; for (Set<int>::Element *E=points[i].connections.front();E;E=E->next()) { cw[idx++]=E->get(); @@ -527,7 +527,7 @@ Dictionary PolygonPathFinder::_get_data() const{ } { - DVector<int>::Write iw=ind.write(); + PoolVector<int>::Write iw=ind.write(); 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/room.cpp b/scene/resources/room.cpp index c4d11b94d1..88648272be 100644 --- a/scene/resources/room.cpp +++ b/scene/resources/room.cpp @@ -37,12 +37,12 @@ RID RoomBounds::get_rid() const { } -void RoomBounds::set_geometry_hint(const DVector<Face3>& p_geometry_hint) { +void RoomBounds::set_geometry_hint(const PoolVector<Face3>& p_geometry_hint) { geometry_hint=p_geometry_hint; } -DVector<Face3> RoomBounds::get_geometry_hint() const { +PoolVector<Face3> RoomBounds::get_geometry_hint() const { return geometry_hint; } diff --git a/scene/resources/room.h b/scene/resources/room.h index 6a8deac8b3..84d68e5718 100644 --- a/scene/resources/room.h +++ b/scene/resources/room.h @@ -41,7 +41,7 @@ class RoomBounds : public Resource { RES_BASE_EXTENSION("room"); RID area; - DVector<Face3> geometry_hint; + PoolVector<Face3> geometry_hint; protected: @@ -53,8 +53,8 @@ public: virtual RID get_rid() const; - void set_geometry_hint(const DVector<Face3>& geometry_hint); - DVector<Face3> get_geometry_hint() const; + void set_geometry_hint(const PoolVector<Face3>& geometry_hint); + PoolVector<Face3> get_geometry_hint() const; RoomBounds(); ~RoomBounds(); diff --git a/scene/resources/sample.cpp b/scene/resources/sample.cpp index 8ea02ac943..e07e4d3767 100644 --- a/scene/resources/sample.cpp +++ b/scene/resources/sample.cpp @@ -119,18 +119,18 @@ int Sample::get_length() const { return length; } -void Sample::set_data(const DVector<uint8_t>& p_buffer) { +void Sample::set_data(const PoolVector<uint8_t>& p_buffer) { if (sample.is_valid()) AudioServer::get_singleton()->sample_set_data(sample,p_buffer); } -DVector<uint8_t> Sample::get_data() const { +PoolVector<uint8_t> Sample::get_data() const { if (sample.is_valid()) return AudioServer::get_singleton()->sample_get_data(sample); - return DVector<uint8_t>(); + return PoolVector<uint8_t>(); } diff --git a/scene/resources/sample.h b/scene/resources/sample.h index c011f63144..be2cf67954 100644 --- a/scene/resources/sample.h +++ b/scene/resources/sample.h @@ -82,8 +82,8 @@ public: bool is_stereo() const; int get_length() const; - void set_data(const DVector<uint8_t>& p_buffer); - DVector<uint8_t> get_data() const; + void set_data(const PoolVector<uint8_t>& p_buffer); + PoolVector<uint8_t> get_data() const; void set_mix_rate(int p_rate); int get_mix_rate() const; diff --git a/scene/resources/scene_format_text.cpp b/scene/resources/scene_format_text.cpp index af38bdd82b..fa56f63465 100644 --- a/scene/resources/scene_format_text.cpp +++ b/scene/resources/scene_format_text.cpp @@ -112,7 +112,7 @@ Error ResourceInteractiveLoaderText::_parse_ext_resource(VariantParser::Stream* if (path.find("://")==-1 && path.is_rel_path()) { // path is relative to file being loaded, so convert to a resource path - path=Globals::get_singleton()->localize_path(res_path.get_base_dir().plus_file(path)); + path=GlobalConfig::get_singleton()->localize_path(res_path.get_base_dir().plus_file(path)); } @@ -172,7 +172,7 @@ Error ResourceInteractiveLoaderText::poll() { if (path.find("://")==-1 && path.is_rel_path()) { // path is relative to file being loaded, so convert to a resource path - path=Globals::get_singleton()->localize_path(local_path.get_base_dir().plus_file(path)); + path=GlobalConfig::get_singleton()->localize_path(local_path.get_base_dir().plus_file(path)); } if (remaps.has(path)) { @@ -661,7 +661,7 @@ void ResourceInteractiveLoaderText::get_dependencies(FileAccess *f,List<String> if (path.find("://")==-1 && path.is_rel_path()) { // path is relative to file being loaded, so convert to a resource path - path=Globals::get_singleton()->localize_path(local_path.get_base_dir().plus_file(path)); + path=GlobalConfig::get_singleton()->localize_path(local_path.get_base_dir().plus_file(path)); } @@ -948,9 +948,9 @@ Ref<ResourceInteractiveLoader> ResourceFormatLoaderText::load_interactive(const } Ref<ResourceInteractiveLoaderText> ria = memnew( ResourceInteractiveLoaderText ); - ria->local_path=Globals::get_singleton()->localize_path(p_path); + ria->local_path=GlobalConfig::get_singleton()->localize_path(p_path); ria->res_path=ria->local_path; -// ria->set_local_path( Globals::get_singleton()->localize_path(p_path) ); +// ria->set_local_path( GlobalConfig::get_singleton()->localize_path(p_path) ); ria->open(f); return ria; @@ -999,9 +999,9 @@ String ResourceFormatLoaderText::get_resource_type(const String &p_path) const{ } Ref<ResourceInteractiveLoaderText> ria = memnew( ResourceInteractiveLoaderText ); - ria->local_path=Globals::get_singleton()->localize_path(p_path); + ria->local_path=GlobalConfig::get_singleton()->localize_path(p_path); ria->res_path=ria->local_path; -// ria->set_local_path( Globals::get_singleton()->localize_path(p_path) ); +// ria->set_local_path( GlobalConfig::get_singleton()->localize_path(p_path) ); String r = ria->recognize(f); return r; } @@ -1016,9 +1016,9 @@ void ResourceFormatLoaderText::get_dependencies(const String& p_path,List<String } Ref<ResourceInteractiveLoaderText> ria = memnew( ResourceInteractiveLoaderText ); - ria->local_path=Globals::get_singleton()->localize_path(p_path); + ria->local_path=GlobalConfig::get_singleton()->localize_path(p_path); ria->res_path=ria->local_path; -// ria->set_local_path( Globals::get_singleton()->localize_path(p_path) ); +// ria->set_local_path( GlobalConfig::get_singleton()->localize_path(p_path) ); ria->get_dependencies(f,p_dependencies,p_add_types); @@ -1033,9 +1033,9 @@ Error ResourceFormatLoaderText::rename_dependencies(const String &p_path,const M } Ref<ResourceInteractiveLoaderText> ria = memnew( ResourceInteractiveLoaderText ); - ria->local_path=Globals::get_singleton()->localize_path(p_path); + ria->local_path=GlobalConfig::get_singleton()->localize_path(p_path); ria->res_path=ria->local_path; -// ria->set_local_path( Globals::get_singleton()->localize_path(p_path) ); +// ria->set_local_path( GlobalConfig::get_singleton()->localize_path(p_path) ); return ria->rename_dependencies(f,p_path,p_map); } @@ -1173,7 +1173,7 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path,const RES& p_re ERR_FAIL_COND_V( err, ERR_CANT_OPEN ); FileAccessRef _fref(f); - local_path = Globals::get_singleton()->localize_path(p_path); + local_path = GlobalConfig::get_singleton()->localize_path(p_path); relative_paths=p_flags&ResourceSaver::FLAG_RELATIVE_PATHS; skip_editor=p_flags&ResourceSaver::FLAG_OMIT_EDITOR_PROPERTIES; diff --git a/scene/resources/shader_graph.cpp b/scene/resources/shader_graph.cpp index 0c31e1406f..37b019e369 100644 --- a/scene/resources/shader_graph.cpp +++ b/scene/resources/shader_graph.cpp @@ -554,8 +554,8 @@ void ShaderGraph::node_add(ShaderType p_type, NodeType p_node_type,int p_id) { case NODE_XFORM_TO_VEC: {} break; // 3 scalar input: {} break; 1 vec3 output case NODE_SCALAR_INTERP: {} break; // scalar interpolation (with optional curve) case NODE_VEC_INTERP: {} break; // vec3 interpolation (with optional curve) - case NODE_COLOR_RAMP: { node.param1=DVector<Color>(); node.param2=DVector<real_t>();} break; // vec3 interpolation (with optional curve) - case NODE_CURVE_MAP: { node.param1=DVector<Vector2>();} break; // vec3 interpolation (with optional curve) + case NODE_COLOR_RAMP: { node.param1=PoolVector<Color>(); node.param2=PoolVector<real_t>();} break; // vec3 interpolation (with optional curve) + case NODE_CURVE_MAP: { node.param1=PoolVector<Vector2>();} break; // vec3 interpolation (with optional curve) case NODE_SCALAR_INPUT: {node.param1=_find_unique_name("Scalar"); node.param2=0;} break; // scalar uniform (assignable in material) case NODE_VEC_INPUT: {node.param1=_find_unique_name("Vec3");node.param2=Vector3();} break; // vec3 uniform (assignable in material) case NODE_RGB_INPUT: {node.param1=_find_unique_name("Color");node.param2=Color();} break; // color uniform (assignable in material) @@ -1082,7 +1082,7 @@ ShaderGraph::VecFunc ShaderGraph::vec_func_node_get_function(ShaderType p_type, return VecFunc(func); } -void ShaderGraph::color_ramp_node_set_ramp(ShaderType p_type,int p_id,const DVector<Color>& p_colors, const DVector<real_t>& p_offsets){ +void ShaderGraph::color_ramp_node_set_ramp(ShaderType p_type,int p_id,const PoolVector<Color>& p_colors, const PoolVector<real_t>& p_offsets){ ERR_FAIL_INDEX(p_type,3); ERR_FAIL_COND(!shader[p_type].node_map.has(p_id)); @@ -1094,27 +1094,27 @@ void ShaderGraph::color_ramp_node_set_ramp(ShaderType p_type,int p_id,const DVec } -DVector<Color> ShaderGraph::color_ramp_node_get_colors(ShaderType p_type,int p_id) const{ +PoolVector<Color> ShaderGraph::color_ramp_node_get_colors(ShaderType p_type,int p_id) const{ - ERR_FAIL_INDEX_V(p_type,3,DVector<Color>()); - ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),DVector<Color>()); + ERR_FAIL_INDEX_V(p_type,3,PoolVector<Color>()); + ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),PoolVector<Color>()); const Node& n = shader[p_type].node_map[p_id]; return n.param1; } -DVector<real_t> ShaderGraph::color_ramp_node_get_offsets(ShaderType p_type,int p_id) const{ +PoolVector<real_t> ShaderGraph::color_ramp_node_get_offsets(ShaderType p_type,int p_id) const{ - ERR_FAIL_INDEX_V(p_type,3,DVector<real_t>()); - ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),DVector<real_t>()); + ERR_FAIL_INDEX_V(p_type,3,PoolVector<real_t>()); + ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),PoolVector<real_t>()); const Node& n = shader[p_type].node_map[p_id]; return n.param2; } -void ShaderGraph::curve_map_node_set_points(ShaderType p_type,int p_id,const DVector<Vector2>& p_points) { +void ShaderGraph::curve_map_node_set_points(ShaderType p_type,int p_id,const PoolVector<Vector2>& p_points) { ERR_FAIL_INDEX(p_type,3); ERR_FAIL_COND(!shader[p_type].node_map.has(p_id)); @@ -1124,10 +1124,10 @@ void ShaderGraph::curve_map_node_set_points(ShaderType p_type,int p_id,const DVe } -DVector<Vector2> ShaderGraph::curve_map_node_get_points(ShaderType p_type,int p_id) const{ +PoolVector<Vector2> ShaderGraph::curve_map_node_get_points(ShaderType p_type,int p_id) const{ - ERR_FAIL_INDEX_V(p_type,3,DVector<Vector2>()); - ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),DVector<Vector2>()); + ERR_FAIL_INDEX_V(p_type,3,PoolVector<Vector2>()); + ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),PoolVector<Vector2>()); const Node& n = shader[p_type].node_map[p_id]; return n.param1; @@ -2450,16 +2450,16 @@ void ShaderGraph::_add_node_code(ShaderType p_type,Node *p_node,const Vector<Str DEF_SCALAR(0); static const int color_ramp_len=512; - DVector<uint8_t> cramp; + PoolVector<uint8_t> cramp; cramp.resize(color_ramp_len*4); { - DVector<Color> colors=p_node->param1; - DVector<real_t> offsets=p_node->param2; + PoolVector<Color> colors=p_node->param1; + PoolVector<real_t> offsets=p_node->param2; int cc =colors.size(); - DVector<uint8_t>::Write crw = cramp.write(); - DVector<Color>::Read cr = colors.read(); - DVector<real_t>::Read ofr = offsets.read(); + PoolVector<uint8_t>::Write crw = cramp.write(); + PoolVector<Color>::Read cr = colors.read(); + PoolVector<real_t>::Read ofr = offsets.read(); int at=0; Color color_at(0,0,0,1); @@ -2508,14 +2508,14 @@ void ShaderGraph::_add_node_code(ShaderType p_type,Node *p_node,const Vector<Str static const int curve_map_len=256; bool mapped[256]; zeromem(mapped,sizeof(mapped)); - DVector<uint8_t> cmap; + PoolVector<uint8_t> cmap; cmap.resize(curve_map_len); { - DVector<Point2> points=p_node->param1; + PoolVector<Point2> points=p_node->param1; int pc =points.size(); - DVector<uint8_t>::Write cmw = cmap.write(); - DVector<Point2>::Read pr = points.read(); + PoolVector<uint8_t>::Write cmw = cmap.write(); + PoolVector<Point2>::Read pr = points.read(); Vector2 prev=Vector2(0,0); Vector2 prev2=Vector2(0,0); diff --git a/scene/resources/shader_graph.h b/scene/resources/shader_graph.h index 57893f27c0..f4e24dbe78 100644 --- a/scene/resources/shader_graph.h +++ b/scene/resources/shader_graph.h @@ -326,12 +326,12 @@ public: void vec_func_node_set_function(ShaderType p_which,int p_id,VecFunc p_func); VecFunc vec_func_node_get_function(ShaderType p_which,int p_id) const; - void color_ramp_node_set_ramp(ShaderType p_which,int p_id,const DVector<Color>& p_colors, const DVector<real_t>& p_offsets); - DVector<Color> color_ramp_node_get_colors(ShaderType p_which,int p_id) const; - DVector<real_t> color_ramp_node_get_offsets(ShaderType p_which,int p_id) const; + void color_ramp_node_set_ramp(ShaderType p_which,int p_id,const PoolVector<Color>& p_colors, const PoolVector<real_t>& p_offsets); + PoolVector<Color> color_ramp_node_get_colors(ShaderType p_which,int p_id) const; + PoolVector<real_t> color_ramp_node_get_offsets(ShaderType p_which,int p_id) const; - void curve_map_node_set_points(ShaderType p_which, int p_id, const DVector<Vector2>& p_points); - DVector<Vector2> curve_map_node_get_points(ShaderType p_which,int p_id) const; + void curve_map_node_set_points(ShaderType p_which, int p_id, const PoolVector<Vector2>& p_points); + PoolVector<Vector2> curve_map_node_get_points(ShaderType p_which,int p_id) const; void input_node_set_name(ShaderType p_which,int p_id,const String& p_name); String input_node_get_name(ShaderType p_which,int p_id); diff --git a/scene/resources/shape.cpp b/scene/resources/shape.cpp index f00443276f..a90c3b47a9 100644 --- a/scene/resources/shape.cpp +++ b/scene/resources/shape.cpp @@ -34,7 +34,7 @@ #include "scene/main/scene_main_loop.h" -void Shape::add_vertices_to_array(DVector<Vector3> &array, const Transform& p_xform) { +void Shape::add_vertices_to_array(PoolVector<Vector3> &array, const Transform& p_xform) { Vector<Vector3> toadd = _gen_debug_mesh_lines(); @@ -42,7 +42,7 @@ void Shape::add_vertices_to_array(DVector<Vector3> &array, const Transform& p_xf int base=array.size(); array.resize(base+toadd.size()); - DVector<Vector3>::Write w = array.write(); + PoolVector<Vector3>::Write w = array.write(); for(int i=0;i<toadd.size();i++) { w[i+base]=p_xform.xform(toadd[i]); } @@ -61,11 +61,11 @@ Ref<Mesh> Shape::get_debug_mesh() { if (!lines.empty()) { //make mesh - DVector<Vector3> array; + PoolVector<Vector3> array; array.resize(lines.size()); { - DVector<Vector3>::Write w=array.write(); + PoolVector<Vector3>::Write w=array.write(); for(int i=0;i<lines.size();i++) { w[i]=lines[i]; } diff --git a/scene/resources/shape.h b/scene/resources/shape.h index 94a8ec7075..29a93b642c 100644 --- a/scene/resources/shape.h +++ b/scene/resources/shape.h @@ -53,7 +53,7 @@ public: Ref<Mesh> get_debug_mesh(); - void add_vertices_to_array(DVector<Vector3> &array, const Transform& p_xform); + void add_vertices_to_array(PoolVector<Vector3> &array, const Transform& p_xform); Shape(); ~Shape(); diff --git a/scene/resources/sky_box.cpp b/scene/resources/sky_box.cpp index 95e3053bc3..2a4fbfa8d4 100644 --- a/scene/resources/sky_box.cpp +++ b/scene/resources/sky_box.cpp @@ -126,12 +126,13 @@ void ImageSkyBox::_bind_methods() { hints+="*."+E->get(); } - ADD_PROPERTYI(PropertyInfo(Variant::STRING,"image_path/negative_x",PROPERTY_HINT_FILE,hints),_SCS("set_image_path"),_SCS("get_image_path"),IMAGE_PATH_NEGATIVE_X); - ADD_PROPERTYI(PropertyInfo(Variant::STRING,"image_path/positive_x",PROPERTY_HINT_FILE,hints),_SCS("set_image_path"),_SCS("get_image_path"),IMAGE_PATH_POSITIVE_X); - ADD_PROPERTYI(PropertyInfo(Variant::STRING,"image_path/negative_y",PROPERTY_HINT_FILE,hints),_SCS("set_image_path"),_SCS("get_image_path"),IMAGE_PATH_NEGATIVE_Y); - ADD_PROPERTYI(PropertyInfo(Variant::STRING,"image_path/positive_y",PROPERTY_HINT_FILE,hints),_SCS("set_image_path"),_SCS("get_image_path"),IMAGE_PATH_POSITIVE_Y); - ADD_PROPERTYI(PropertyInfo(Variant::STRING,"image_path/negative_z",PROPERTY_HINT_FILE,hints),_SCS("set_image_path"),_SCS("get_image_path"),IMAGE_PATH_NEGATIVE_Z); - ADD_PROPERTYI(PropertyInfo(Variant::STRING,"image_path/positive_z",PROPERTY_HINT_FILE,hints),_SCS("set_image_path"),_SCS("get_image_path"),IMAGE_PATH_POSITIVE_Z); + ADD_GROUP("Image Path","image_path_"); + ADD_PROPERTYI(PropertyInfo(Variant::STRING,"image_path_negative_x",PROPERTY_HINT_FILE,hints),_SCS("set_image_path"),_SCS("get_image_path"),IMAGE_PATH_NEGATIVE_X); + ADD_PROPERTYI(PropertyInfo(Variant::STRING,"image_path_positive_x",PROPERTY_HINT_FILE,hints),_SCS("set_image_path"),_SCS("get_image_path"),IMAGE_PATH_POSITIVE_X); + ADD_PROPERTYI(PropertyInfo(Variant::STRING,"image_path_negative_y",PROPERTY_HINT_FILE,hints),_SCS("set_image_path"),_SCS("get_image_path"),IMAGE_PATH_NEGATIVE_Y); + ADD_PROPERTYI(PropertyInfo(Variant::STRING,"image_path_positive_y",PROPERTY_HINT_FILE,hints),_SCS("set_image_path"),_SCS("get_image_path"),IMAGE_PATH_POSITIVE_Y); + ADD_PROPERTYI(PropertyInfo(Variant::STRING,"image_path_negative_z",PROPERTY_HINT_FILE,hints),_SCS("set_image_path"),_SCS("get_image_path"),IMAGE_PATH_NEGATIVE_Z); + ADD_PROPERTYI(PropertyInfo(Variant::STRING,"image_path_positive_z",PROPERTY_HINT_FILE,hints),_SCS("set_image_path"),_SCS("get_image_path"),IMAGE_PATH_POSITIVE_Z); BIND_CONSTANT( IMAGE_PATH_NEGATIVE_X ); BIND_CONSTANT( IMAGE_PATH_POSITIVE_X ); diff --git a/scene/resources/style_box.cpp b/scene/resources/style_box.cpp index 146e53300d..066062f302 100644 --- a/scene/resources/style_box.cpp +++ b/scene/resources/style_box.cpp @@ -85,10 +85,11 @@ void StyleBox::_bind_methods() { ClassDB::bind_method(_MD("draw","canvas_item","rect"),&StyleBox::draw); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "content_margin/left", PROPERTY_HINT_RANGE,"-1,2048,1" ), _SCS("set_default_margin"),_SCS("get_default_margin"), MARGIN_LEFT ); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "content_margin/right", PROPERTY_HINT_RANGE,"-1,2048,1" ), _SCS("set_default_margin"),_SCS("get_default_margin"), MARGIN_RIGHT ); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "content_margin/top", PROPERTY_HINT_RANGE,"-1,2048,1" ), _SCS("set_default_margin"),_SCS("get_default_margin"), MARGIN_TOP); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "content_margin/bottom", PROPERTY_HINT_RANGE,"-1,2048,1" ), _SCS("set_default_margin"),_SCS("get_default_margin"), MARGIN_BOTTOM ); + ADD_GROUP("Content Margin","content_margin_"); + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "content_margin_left", PROPERTY_HINT_RANGE,"-1,2048,1" ), _SCS("set_default_margin"),_SCS("get_default_margin"), MARGIN_LEFT ); + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "content_margin_right", PROPERTY_HINT_RANGE,"-1,2048,1" ), _SCS("set_default_margin"),_SCS("get_default_margin"), MARGIN_RIGHT ); + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "content_margin_top", PROPERTY_HINT_RANGE,"-1,2048,1" ), _SCS("set_default_margin"),_SCS("get_default_margin"), MARGIN_TOP); + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "content_margin_bottom", PROPERTY_HINT_RANGE,"-1,2048,1" ), _SCS("set_default_margin"),_SCS("get_default_margin"), MARGIN_BOTTOM ); } @@ -231,15 +232,18 @@ void StyleBoxTexture::_bind_methods() { ADD_PROPERTY( PropertyInfo( Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture" ), _SCS("set_texture"),_SCS("get_texture") ); ADD_PROPERTYNZ( PropertyInfo( Variant::RECT2, "region_rect"), _SCS("set_region_rect"),_SCS("get_region_rect")); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "margin/left", PROPERTY_HINT_RANGE,"0,2048,1" ), _SCS("set_margin_size"),_SCS("get_margin_size"), MARGIN_LEFT ); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "margin/right", PROPERTY_HINT_RANGE,"0,2048,1" ), _SCS("set_margin_size"),_SCS("get_margin_size"), MARGIN_RIGHT ); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "margin/top", PROPERTY_HINT_RANGE,"0,2048,1" ), _SCS("set_margin_size"),_SCS("get_margin_size"), MARGIN_TOP); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "margin/bottom", PROPERTY_HINT_RANGE,"0,2048,1" ), _SCS("set_margin_size"),_SCS("get_margin_size"), MARGIN_BOTTOM ); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "expand_margin/left", PROPERTY_HINT_RANGE,"0,2048,1" ), _SCS("set_expand_margin_size"),_SCS("get_expand_margin_size"), MARGIN_LEFT ); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "expand_margin/right", PROPERTY_HINT_RANGE,"0,2048,1" ), _SCS("set_expand_margin_size"),_SCS("get_expand_margin_size"), MARGIN_RIGHT ); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "expand_margin/top", PROPERTY_HINT_RANGE,"0,2048,1" ), _SCS("set_expand_margin_size"),_SCS("get_expand_margin_size"), MARGIN_TOP ); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "expand_margin/bottom", PROPERTY_HINT_RANGE,"0,2048,1" ), _SCS("set_expand_margin_size"),_SCS("get_expand_margin_size"), MARGIN_BOTTOM ); - ADD_PROPERTY( PropertyInfo( Variant::COLOR, "modulate/color" ), _SCS("set_modulate"),_SCS("get_modulate")); + ADD_GROUP("Margin","margin_"); + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "margin_left", PROPERTY_HINT_RANGE,"0,2048,1" ), _SCS("set_margin_size"),_SCS("get_margin_size"), MARGIN_LEFT ); + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "margin_right", PROPERTY_HINT_RANGE,"0,2048,1" ), _SCS("set_margin_size"),_SCS("get_margin_size"), MARGIN_RIGHT ); + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "margin_top", PROPERTY_HINT_RANGE,"0,2048,1" ), _SCS("set_margin_size"),_SCS("get_margin_size"), MARGIN_TOP); + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "margin_bottom", PROPERTY_HINT_RANGE,"0,2048,1" ), _SCS("set_margin_size"),_SCS("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" ), _SCS("set_expand_margin_size"),_SCS("get_expand_margin_size"), MARGIN_LEFT ); + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "expand_margin_right", PROPERTY_HINT_RANGE,"0,2048,1" ), _SCS("set_expand_margin_size"),_SCS("get_expand_margin_size"), MARGIN_RIGHT ); + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "expand_margin_top", PROPERTY_HINT_RANGE,"0,2048,1" ), _SCS("set_expand_margin_size"),_SCS("get_expand_margin_size"), MARGIN_TOP ); + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "expand_margin_bottom", PROPERTY_HINT_RANGE,"0,2048,1" ), _SCS("set_expand_margin_size"),_SCS("get_expand_margin_size"), MARGIN_BOTTOM ); + ADD_GROUP("Modulate","modulate_"); + ADD_PROPERTY( PropertyInfo( Variant::COLOR, "modulate_color" ), _SCS("set_modulate"),_SCS("get_modulate")); ADD_PROPERTY( PropertyInfo( Variant::BOOL, "draw_center" ) , _SCS("set_draw_center"),_SCS("get_draw_center")); } diff --git a/scene/resources/surface_tool.cpp b/scene/resources/surface_tool.cpp index 2ed620c097..cc13c0ff11 100644 --- a/scene/resources/surface_tool.cpp +++ b/scene/resources/surface_tool.cpp @@ -262,9 +262,9 @@ Ref<Mesh> SurfaceTool::commit(const Ref<Mesh>& p_existing) { case Mesh::ARRAY_FORMAT_VERTEX: case Mesh::ARRAY_FORMAT_NORMAL: { - DVector<Vector3> array; + PoolVector<Vector3> array; array.resize(varr_len); - DVector<Vector3>::Write w = array.write(); + PoolVector<Vector3>::Write w = array.write(); int idx=0; for(List< Vertex >::Element *E=vertex_array.front();E;E=E->next(),idx++) { @@ -282,7 +282,7 @@ Ref<Mesh> SurfaceTool::commit(const Ref<Mesh>& p_existing) { } - w=DVector<Vector3>::Write(); + w=PoolVector<Vector3>::Write(); a[i]=array; } break; @@ -290,9 +290,9 @@ Ref<Mesh> SurfaceTool::commit(const Ref<Mesh>& p_existing) { case Mesh::ARRAY_FORMAT_TEX_UV: case Mesh::ARRAY_FORMAT_TEX_UV2: { - DVector<Vector2> array; + PoolVector<Vector2> array; array.resize(varr_len); - DVector<Vector2>::Write w = array.write(); + PoolVector<Vector2>::Write w = array.write(); int idx=0; for(List< Vertex >::Element *E=vertex_array.front();E;E=E->next(),idx++) { @@ -311,15 +311,15 @@ Ref<Mesh> SurfaceTool::commit(const Ref<Mesh>& p_existing) { } - w=DVector<Vector2>::Write(); + w=PoolVector<Vector2>::Write(); a[i]=array; } break; case Mesh::ARRAY_FORMAT_TANGENT: { - DVector<float> array; + PoolVector<float> array; array.resize(varr_len*4); - DVector<float>::Write w = array.write(); + PoolVector<float>::Write w = array.write(); int idx=0; for(List< Vertex >::Element *E=vertex_array.front();E;E=E->next(),idx+=4) { @@ -335,15 +335,15 @@ Ref<Mesh> SurfaceTool::commit(const Ref<Mesh>& p_existing) { w[idx+3]=d<0 ? -1 : 1; } - w=DVector<float>::Write(); + w=PoolVector<float>::Write(); a[i]=array; } break; case Mesh::ARRAY_FORMAT_COLOR: { - DVector<Color> array; + PoolVector<Color> array; array.resize(varr_len); - DVector<Color>::Write w = array.write(); + PoolVector<Color>::Write w = array.write(); int idx=0; for(List< Vertex >::Element *E=vertex_array.front();E;E=E->next(),idx++) { @@ -352,15 +352,15 @@ Ref<Mesh> SurfaceTool::commit(const Ref<Mesh>& p_existing) { w[idx]=v.color; } - w=DVector<Color>::Write(); + w=PoolVector<Color>::Write(); a[i]=array; } break; case Mesh::ARRAY_FORMAT_BONES: { - DVector<int> array; + PoolVector<int> array; array.resize(varr_len*4); - DVector<int>::Write w = array.write(); + PoolVector<int>::Write w = array.write(); int idx=0; for(List< Vertex >::Element *E=vertex_array.front();E;E=E->next(),idx+=4) { @@ -375,16 +375,16 @@ Ref<Mesh> SurfaceTool::commit(const Ref<Mesh>& p_existing) { } - w=DVector<int>::Write(); + w=PoolVector<int>::Write(); a[i]=array; } break; case Mesh::ARRAY_FORMAT_WEIGHTS: { - DVector<float> array; + PoolVector<float> array; array.resize(varr_len*4); - DVector<float>::Write w = array.write(); + PoolVector<float>::Write w = array.write(); int idx=0; for(List< Vertex >::Element *E=vertex_array.front();E;E=E->next(),idx+=4) { @@ -399,7 +399,7 @@ Ref<Mesh> SurfaceTool::commit(const Ref<Mesh>& p_existing) { } - w=DVector<float>::Write(); + w=PoolVector<float>::Write(); a[i]=array; } break; @@ -407,9 +407,9 @@ Ref<Mesh> SurfaceTool::commit(const Ref<Mesh>& p_existing) { ERR_CONTINUE( index_array.size() ==0 ); - DVector<int> array; + PoolVector<int> array; array.resize(index_array.size()); - DVector<int>::Write w = array.write(); + PoolVector<int>::Write w = array.write(); int idx=0; for(List< int>::Element *E=index_array.front();E;E=E->next(),idx++) { @@ -417,7 +417,7 @@ Ref<Mesh> SurfaceTool::commit(const Ref<Mesh>& p_existing) { w[idx]=E->get(); } - w=DVector<int>::Write(); + w=PoolVector<int>::Write(); a[i]=array; } break; @@ -490,14 +490,14 @@ void SurfaceTool::_create_list(const Ref<Mesh>& p_existing, int p_surface, List< Array arr = p_existing->surface_get_arrays(p_surface); ERR_FAIL_COND( arr.size() !=VS::ARRAY_MAX ); - DVector<Vector3> varr = arr[VS::ARRAY_VERTEX]; - DVector<Vector3> narr = arr[VS::ARRAY_NORMAL]; - DVector<float> tarr = arr[VS::ARRAY_TANGENT]; - DVector<Color> carr = arr[VS::ARRAY_COLOR]; - DVector<Vector2> uvarr = arr[VS::ARRAY_TEX_UV]; - DVector<Vector2> uv2arr = arr[VS::ARRAY_TEX_UV2]; - DVector<int> barr = arr[VS::ARRAY_BONES]; - DVector<float> warr = arr[VS::ARRAY_WEIGHTS]; + 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]; int vc = varr.size(); @@ -505,46 +505,46 @@ void SurfaceTool::_create_list(const Ref<Mesh>& p_existing, int p_surface, List< return; lformat=0; - DVector<Vector3>::Read rv; + PoolVector<Vector3>::Read rv; if (varr.size()) { lformat|=VS::ARRAY_FORMAT_VERTEX; rv=varr.read(); } - DVector<Vector3>::Read rn; + PoolVector<Vector3>::Read rn; if (narr.size()) { lformat|=VS::ARRAY_FORMAT_NORMAL; rn=narr.read(); } - DVector<float>::Read rt; + PoolVector<float>::Read rt; if (tarr.size()) { lformat|=VS::ARRAY_FORMAT_TANGENT; rt=tarr.read(); } - DVector<Color>::Read rc; + PoolVector<Color>::Read rc; if (carr.size()) { lformat|=VS::ARRAY_FORMAT_COLOR; rc=carr.read(); } - DVector<Vector2>::Read ruv; + PoolVector<Vector2>::Read ruv; if (uvarr.size()) { lformat|=VS::ARRAY_FORMAT_TEX_UV; ruv=uvarr.read(); } - DVector<Vector2>::Read ruv2; + PoolVector<Vector2>::Read ruv2; if (uv2arr.size()) { lformat|=VS::ARRAY_FORMAT_TEX_UV2; ruv2=uv2arr.read(); } - DVector<int>::Read rb; + PoolVector<int>::Read rb; if (barr.size()) { lformat|=VS::ARRAY_FORMAT_BONES; rb=barr.read(); } - DVector<float>::Read rw; + PoolVector<float>::Read rw; if (warr.size()) { lformat|=VS::ARRAY_FORMAT_WEIGHTS; rw=warr.read(); @@ -592,12 +592,12 @@ void SurfaceTool::_create_list(const Ref<Mesh>& p_existing, int p_surface, List< //indices - DVector<int> idx= arr[VS::ARRAY_INDEX]; + PoolVector<int> idx= arr[VS::ARRAY_INDEX]; int is = idx.size(); if (is) { lformat|=VS::ARRAY_FORMAT_INDEX; - DVector<int>::Read iarr=idx.read(); + PoolVector<int>::Read iarr=idx.read(); for(int i=0;i<is;i++) { r_index->push_back(iarr[i]); } diff --git a/scene/resources/theme.h b/scene/resources/theme.h index 94ac910e9f..e9d890cf97 100644 --- a/scene/resources/theme.h +++ b/scene/resources/theme.h @@ -72,13 +72,13 @@ protected: Ref<Font> default_theme_font; - DVector<String> _get_icon_list(const String& p_type) const { DVector<String> ilret; List<StringName> il; get_icon_list(p_type,&il); for(List<StringName>::Element *E=il.front();E;E=E->next()) { ilret.push_back(E->get()); } return ilret; } - DVector<String> _get_stylebox_list(const String& p_type) const { DVector<String> ilret; List<StringName> il; get_stylebox_list(p_type,&il); for(List<StringName>::Element *E=il.front();E;E=E->next()) { ilret.push_back(E->get()); } return ilret; } - DVector<String> _get_stylebox_types(void) const { DVector<String> ilret; List<StringName> il; get_stylebox_types(&il); for(List<StringName>::Element *E=il.front();E;E=E->next()) { ilret.push_back(E->get()); } return ilret; } - DVector<String> _get_font_list(const String& p_type) const { DVector<String> ilret; List<StringName> il; get_font_list(p_type,&il); for(List<StringName>::Element *E=il.front();E;E=E->next()) { ilret.push_back(E->get()); } return ilret; } - DVector<String> _get_color_list(const String& p_type) const { DVector<String> ilret; List<StringName> il; get_color_list(p_type,&il); for(List<StringName>::Element *E=il.front();E;E=E->next()) { ilret.push_back(E->get()); } return ilret; } - DVector<String> _get_constant_list(const String& p_type) const { DVector<String> ilret; List<StringName> il; get_constant_list(p_type,&il); for(List<StringName>::Element *E=il.front();E;E=E->next()) { ilret.push_back(E->get()); } return ilret; } - DVector<String> _get_type_list(const String& p_type) const { DVector<String> ilret; List<StringName> il; get_type_list(&il); for(List<StringName>::Element *E=il.front();E;E=E->next()) { ilret.push_back(E->get()); } return ilret; } + PoolVector<String> _get_icon_list(const String& p_type) const { PoolVector<String> ilret; List<StringName> il; get_icon_list(p_type,&il); for(List<StringName>::Element *E=il.front();E;E=E->next()) { ilret.push_back(E->get()); } return ilret; } + PoolVector<String> _get_stylebox_list(const String& p_type) const { PoolVector<String> ilret; List<StringName> il; get_stylebox_list(p_type,&il); for(List<StringName>::Element *E=il.front();E;E=E->next()) { ilret.push_back(E->get()); } return ilret; } + PoolVector<String> _get_stylebox_types(void) const { PoolVector<String> ilret; List<StringName> il; get_stylebox_types(&il); for(List<StringName>::Element *E=il.front();E;E=E->next()) { ilret.push_back(E->get()); } return ilret; } + PoolVector<String> _get_font_list(const String& p_type) const { PoolVector<String> ilret; List<StringName> il; get_font_list(p_type,&il); for(List<StringName>::Element *E=il.front();E;E=E->next()) { ilret.push_back(E->get()); } return ilret; } + PoolVector<String> _get_color_list(const String& p_type) const { PoolVector<String> ilret; List<StringName> il; get_color_list(p_type,&il); for(List<StringName>::Element *E=il.front();E;E=E->next()) { ilret.push_back(E->get()); } return ilret; } + PoolVector<String> _get_constant_list(const String& p_type) const { PoolVector<String> ilret; List<StringName> il; get_constant_list(p_type,&il); for(List<StringName>::Element *E=il.front();E;E=E->next()) { ilret.push_back(E->get()); } return ilret; } + PoolVector<String> _get_type_list(const String& p_type) const { PoolVector<String> ilret; List<StringName> il; get_type_list(&il); for(List<StringName>::Element *E=il.front();E;E=E->next()) { ilret.push_back(E->get()); } return ilret; } static void _bind_methods(); public: diff --git a/scene/resources/world.cpp b/scene/resources/world.cpp index e89a460558..64f3dd8b97 100644 --- a/scene/resources/world.cpp +++ b/scene/resources/world.cpp @@ -332,10 +332,10 @@ World::World() { sound_space = SpatialSoundServer::get_singleton()->space_create(); PhysicsServer::get_singleton()->space_set_active(space,true); - PhysicsServer::get_singleton()->area_set_param(space,PhysicsServer::AREA_PARAM_GRAVITY,GLOBAL_DEF("physics/default_gravity",9.8)); - PhysicsServer::get_singleton()->area_set_param(space,PhysicsServer::AREA_PARAM_GRAVITY_VECTOR,GLOBAL_DEF("physics/default_gravity_vector",Vector3(0,-1,0))); - PhysicsServer::get_singleton()->area_set_param(space,PhysicsServer::AREA_PARAM_LINEAR_DAMP,GLOBAL_DEF("physics/default_linear_damp",0.1)); - PhysicsServer::get_singleton()->area_set_param(space,PhysicsServer::AREA_PARAM_ANGULAR_DAMP,GLOBAL_DEF("physics/default_angular_damp",0.1)); + 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)); + PhysicsServer::get_singleton()->area_set_param(space,PhysicsServer::AREA_PARAM_ANGULAR_DAMP,GLOBAL_DEF("physics/3d/default_angular_damp",0.1)); #ifdef _3D_DISABLED indexer = NULL; diff --git a/scene/resources/world_2d.cpp b/scene/resources/world_2d.cpp index 46434bfd60..98c5ae3bb9 100644 --- a/scene/resources/world_2d.cpp +++ b/scene/resources/world_2d.cpp @@ -404,18 +404,16 @@ World2D::World2D() { //set space2D to be more friendly with pixels than meters, by adjusting some constants Physics2DServer::get_singleton()->space_set_active(space,true); - 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_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))); // TODO: Remove this deprecation warning and compatibility code for 2.2 or 3.0 - if (Globals::get_singleton()->get("physics_2d/default_density") && !Globals::get_singleton()->get("physics_2d/default_linear_damp")) { - WARN_PRINT("Deprecated parameter 'physics_2d/default_density'. It was renamed to 'physics_2d/default_linear_damp', adjusting your project settings accordingly (make sure to adjust scripts that potentially rely on 'physics_2d/default_density'."); - Globals::get_singleton()->set("physics_2d/default_linear_damp", Globals::get_singleton()->get("physics_2d/default_density")); - Globals::get_singleton()->set_persisting("physics_2d/default_linear_damp", true); - Globals::get_singleton()->set_persisting("physics_2d/default_density", false); - Globals::get_singleton()->save(); + if (GlobalConfig::get_singleton()->get("physics/2d/default_density") && !GlobalConfig::get_singleton()->get("physics/2d/default_linear_damp")) { + WARN_PRINT("Deprecated parameter 'physics/2d/default_density'. It was renamed to 'physics/2d/default_linear_damp', adjusting your project settings accordingly (make sure to adjust scripts that potentially rely on 'physics/2d/default_density'."); + GlobalConfig::get_singleton()->set("physics/2d/default_linear_damp", GlobalConfig::get_singleton()->get("physics/2d/default_density")); + GlobalConfig::get_singleton()->save(); } - Physics2DServer::get_singleton()->area_set_param(space,Physics2DServer::AREA_PARAM_LINEAR_DAMP,GLOBAL_DEF("physics_2d/default_linear_damp",0.1)); - Physics2DServer::get_singleton()->area_set_param(space,Physics2DServer::AREA_PARAM_ANGULAR_DAMP,GLOBAL_DEF("physics_2d/default_angular_damp",1)); + Physics2DServer::get_singleton()->area_set_param(space,Physics2DServer::AREA_PARAM_LINEAR_DAMP,GLOBAL_DEF("physics/2d/default_linear_damp",0.1)); + Physics2DServer::get_singleton()->area_set_param(space,Physics2DServer::AREA_PARAM_ANGULAR_DAMP,GLOBAL_DEF("physics/2d/default_angular_damp",1)); indexer = memnew( SpatialIndexer2D ); } |