diff options
Diffstat (limited to 'scene')
95 files changed, 1141 insertions, 995 deletions
diff --git a/scene/2d/audio_stream_player_2d.cpp b/scene/2d/audio_stream_player_2d.cpp index 1423a804ff..73782e1515 100644 --- a/scene/2d/audio_stream_player_2d.cpp +++ b/scene/2d/audio_stream_player_2d.cpp @@ -1,7 +1,10 @@ #include "audio_stream_player_2d.h" + +#include "engine.h" #include "scene/2d/area_2d.h" #include "scene/main/viewport.h" + void AudioStreamPlayer2D::_mix_audio() { if (!stream_playback.is_valid()) { @@ -120,7 +123,7 @@ void AudioStreamPlayer2D::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { AudioServer::get_singleton()->add_callback(_mix_audios, this); - if (autoplay && !get_tree()->is_editor_hint()) { + if (autoplay && !Engine::get_singleton()->is_editor_hint()) { play(); } } diff --git a/scene/2d/back_buffer_copy.cpp b/scene/2d/back_buffer_copy.cpp index 748a527ca0..44bee20d0a 100644 --- a/scene/2d/back_buffer_copy.cpp +++ b/scene/2d/back_buffer_copy.cpp @@ -85,9 +85,9 @@ void BackBufferCopy::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "copy_mode", PROPERTY_HINT_ENUM, "Disabled,Rect,Viewport"), "set_copy_mode", "get_copy_mode"); ADD_PROPERTY(PropertyInfo(Variant::RECT2, "rect"), "set_rect", "get_rect"); - BIND_CONSTANT(COPY_MODE_DISABLED); - BIND_CONSTANT(COPY_MODE_RECT); - BIND_CONSTANT(COPY_MODE_VIEWPORT); + BIND_ENUM_CONSTANT(COPY_MODE_DISABLED); + BIND_ENUM_CONSTANT(COPY_MODE_RECT); + BIND_ENUM_CONSTANT(COPY_MODE_VIEWPORT); } BackBufferCopy::BackBufferCopy() { diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp index 20571abdb9..f309631715 100644 --- a/scene/2d/camera_2d.cpp +++ b/scene/2d/camera_2d.cpp @@ -38,7 +38,7 @@ void Camera2D::_update_scroll() { if (!is_inside_tree()) return; - if (get_tree()->is_editor_hint()) { + if (Engine::get_singleton()->is_editor_hint()) { update(); //will just be drawn return; } @@ -85,7 +85,7 @@ Transform2D Camera2D::get_camera_transform() { if (anchor_mode == ANCHOR_MODE_DRAG_CENTER) { - if (h_drag_enabled && !get_tree()->is_editor_hint()) { + if (h_drag_enabled && !Engine::get_singleton()->is_editor_hint()) { camera_pos.x = MIN(camera_pos.x, (new_camera_pos.x + screen_size.x * 0.5 * drag_margin[MARGIN_RIGHT])); camera_pos.x = MAX(camera_pos.x, (new_camera_pos.x - screen_size.x * 0.5 * drag_margin[MARGIN_LEFT])); } else { @@ -97,7 +97,7 @@ Transform2D Camera2D::get_camera_transform() { } } - if (v_drag_enabled && !get_tree()->is_editor_hint()) { + if (v_drag_enabled && !Engine::get_singleton()->is_editor_hint()) { camera_pos.y = MIN(camera_pos.y, (new_camera_pos.y + screen_size.y * 0.5 * drag_margin[MARGIN_BOTTOM])); camera_pos.y = MAX(camera_pos.y, (new_camera_pos.y - screen_size.y * 0.5 * drag_margin[MARGIN_TOP])); @@ -136,7 +136,7 @@ Transform2D Camera2D::get_camera_transform() { camera_pos.y -= screen_rect.position.y - limit[MARGIN_TOP]; } - if (smoothing_enabled && !get_tree()->is_editor_hint()) { + if (smoothing_enabled && !Engine::get_singleton()->is_editor_hint()) { float c = smoothing * get_fixed_process_delta_time(); smoothed_camera_pos = ((camera_pos - smoothed_camera_pos) * c) + smoothed_camera_pos; @@ -240,7 +240,7 @@ void Camera2D::_notification(int p_what) { add_to_group(group_name); add_to_group(canvas_group_name); - if (get_tree()->is_editor_hint()) { + if (Engine::get_singleton()->is_editor_hint()) { set_fixed_process(false); } @@ -262,7 +262,7 @@ void Camera2D::_notification(int p_what) { } break; case NOTIFICATION_DRAW: { - if (!is_inside_tree() || !get_tree()->is_editor_hint()) + if (!is_inside_tree() || !Engine::get_singleton()->is_editor_hint()) break; if (screen_drawing_enabled) { @@ -497,7 +497,7 @@ void Camera2D::align() { void Camera2D::set_follow_smoothing(float p_speed) { smoothing = p_speed; - if (smoothing > 0 && !(is_inside_tree() && get_tree()->is_editor_hint())) + if (smoothing > 0 && !(is_inside_tree() && Engine::get_singleton()->is_editor_hint())) set_fixed_process(true); else set_fixed_process(false); @@ -735,8 +735,8 @@ void Camera2D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::BOOL, "editor_draw_limits"), "set_limit_drawing_enabled", "is_limit_drawing_enabled"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "editor_draw_drag_margin"), "set_margin_drawing_enabled", "is_margin_drawing_enabled"); - BIND_CONSTANT(ANCHOR_MODE_DRAG_CENTER); - BIND_CONSTANT(ANCHOR_MODE_FIXED_TOP_LEFT); + BIND_ENUM_CONSTANT(ANCHOR_MODE_DRAG_CENTER); + BIND_ENUM_CONSTANT(ANCHOR_MODE_FIXED_TOP_LEFT); } Camera2D::Camera2D() { diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp index cdd8fdf350..5a519dee69 100644 --- a/scene/2d/canvas_item.cpp +++ b/scene/2d/canvas_item.cpp @@ -188,14 +188,15 @@ void CanvasItemMaterial::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "blend_mode", PROPERTY_HINT_ENUM, "Mix,Add,Sub,Mul,Premult Alpha"), "set_blend_mode", "get_blend_mode"); ADD_PROPERTY(PropertyInfo(Variant::INT, "light_mode", PROPERTY_HINT_ENUM, "Normal,Unshaded,Light Only"), "set_light_mode", "get_light_mode"); - BIND_CONSTANT(BLEND_MODE_MIX); - BIND_CONSTANT(BLEND_MODE_ADD); - BIND_CONSTANT(BLEND_MODE_SUB); - BIND_CONSTANT(BLEND_MODE_MUL); - BIND_CONSTANT(BLEND_MODE_PREMULT_ALPHA); - BIND_CONSTANT(LIGHT_MODE_NORMAL); - BIND_CONSTANT(LIGHT_MODE_UNSHADED); - BIND_CONSTANT(LIGHT_MODE_LIGHT_ONLY); + BIND_ENUM_CONSTANT(BLEND_MODE_MIX); + BIND_ENUM_CONSTANT(BLEND_MODE_ADD); + BIND_ENUM_CONSTANT(BLEND_MODE_SUB); + BIND_ENUM_CONSTANT(BLEND_MODE_MUL); + BIND_ENUM_CONSTANT(BLEND_MODE_PREMULT_ALPHA); + + BIND_ENUM_CONSTANT(LIGHT_MODE_NORMAL); + BIND_ENUM_CONSTANT(LIGHT_MODE_UNSHADED); + BIND_ENUM_CONSTANT(LIGHT_MODE_LIGHT_ONLY); } CanvasItemMaterial::CanvasItemMaterial() @@ -1042,11 +1043,11 @@ void CanvasItem::_bind_methods() { ADD_SIGNAL(MethodInfo("hide")); ADD_SIGNAL(MethodInfo("item_rect_changed")); - BIND_CONSTANT(BLEND_MODE_MIX); - BIND_CONSTANT(BLEND_MODE_ADD); - BIND_CONSTANT(BLEND_MODE_SUB); - BIND_CONSTANT(BLEND_MODE_MUL); - BIND_CONSTANT(BLEND_MODE_PREMULT_ALPHA); + BIND_ENUM_CONSTANT(BLEND_MODE_MIX); + BIND_ENUM_CONSTANT(BLEND_MODE_ADD); + BIND_ENUM_CONSTANT(BLEND_MODE_SUB); + BIND_ENUM_CONSTANT(BLEND_MODE_MUL); + BIND_ENUM_CONSTANT(BLEND_MODE_PREMULT_ALPHA); BIND_CONSTANT(NOTIFICATION_DRAW); BIND_CONSTANT(NOTIFICATION_VISIBILITY_CHANGED); diff --git a/scene/2d/collision_polygon_2d.cpp b/scene/2d/collision_polygon_2d.cpp index bd669eb4c8..433661e393 100644 --- a/scene/2d/collision_polygon_2d.cpp +++ b/scene/2d/collision_polygon_2d.cpp @@ -30,6 +30,7 @@ #include "collision_polygon_2d.h" #include "collision_object_2d.h" +#include "engine.h" #include "scene/resources/concave_polygon_shape_2d.h" #include "scene/resources/convex_polygon_shape_2d.h" @@ -134,7 +135,7 @@ void CollisionPolygon2D::_notification(int p_what) { parent->shape_owner_set_one_way_collision(owner_id, one_way_collision); } - /*if (get_tree()->is_editor_hint()) { + /*if (Engine::get_singleton()->is_editor_hint()) { //display above all else set_z_as_relative(false); set_z(VS::CANVAS_ITEM_Z_MAX - 1); @@ -158,7 +159,7 @@ void CollisionPolygon2D::_notification(int p_what) { case NOTIFICATION_DRAW: { - if (!get_tree()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint()) { + if (!Engine::get_singleton()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint()) { break; } diff --git a/scene/2d/collision_shape_2d.cpp b/scene/2d/collision_shape_2d.cpp index ff4aa245ec..3fda4ab464 100644 --- a/scene/2d/collision_shape_2d.cpp +++ b/scene/2d/collision_shape_2d.cpp @@ -28,7 +28,9 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "collision_shape_2d.h" + #include "collision_object_2d.h" +#include "engine.h" #include "scene/resources/capsule_shape_2d.h" #include "scene/resources/circle_shape_2d.h" #include "scene/resources/concave_polygon_shape_2d.h" @@ -59,7 +61,7 @@ void CollisionShape2D::_notification(int p_what) { parent->shape_owner_set_one_way_collision(owner_id, one_way_collision); } - /*if (get_tree()->is_editor_hint()) { + /*if (Engine::get_singleton()->is_editor_hint()) { //display above all else set_z_as_relative(false); set_z(VS::CANVAS_ITEM_Z_MAX - 1); @@ -90,7 +92,7 @@ void CollisionShape2D::_notification(int p_what) { } break;*/ case NOTIFICATION_DRAW: { - if (!get_tree()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint()) { + if (!Engine::get_singleton()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint()) { break; } diff --git a/scene/2d/joints_2d.cpp b/scene/2d/joints_2d.cpp index 1bb40a28b5..ee41dca3a6 100644 --- a/scene/2d/joints_2d.cpp +++ b/scene/2d/joints_2d.cpp @@ -28,6 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "joints_2d.h" + +#include "engine.h" #include "physics_body_2d.h" #include "servers/physics_2d_server.h" @@ -152,7 +154,7 @@ void PinJoint2D::_notification(int p_what) { if (!is_inside_tree()) break; - if (!get_tree()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint()) { + if (!Engine::get_singleton()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint()) { break; } @@ -227,7 +229,7 @@ void GrooveJoint2D::_notification(int p_what) { if (!is_inside_tree()) break; - if (!get_tree()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint()) { + if (!Engine::get_singleton()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint()) { break; } @@ -317,7 +319,7 @@ void DampedSpringJoint2D::_notification(int p_what) { if (!is_inside_tree()) break; - if (!get_tree()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint()) { + if (!Engine::get_singleton()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint()) { break; } diff --git a/scene/2d/light_2d.cpp b/scene/2d/light_2d.cpp index ffe69fa93f..219574cbfd 100644 --- a/scene/2d/light_2d.cpp +++ b/scene/2d/light_2d.cpp @@ -28,6 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "light_2d.h" + +#include "engine.h" #include "servers/visual_server.h" void Light2D::edit_set_pivot(const Point2 &p_pivot) { @@ -70,7 +72,7 @@ void Light2D::_update_light_visibility() { #ifdef TOOLS_ENABLED if (editor_only) { - if (!get_tree()->is_editor_hint()) { + if (!Engine::get_singleton()->is_editor_hint()) { editor_ok = false; } else { editor_ok = (get_tree()->get_edited_scene_root() && (this == get_tree()->get_edited_scene_root() || get_owner() == get_tree()->get_edited_scene_root())); @@ -437,10 +439,10 @@ void Light2D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::REAL, "shadow_filter_smooth", PROPERTY_HINT_RANGE, "0,64,0.1"), "set_shadow_smooth", "get_shadow_smooth"); ADD_PROPERTY(PropertyInfo(Variant::INT, "shadow_item_cull_mask", PROPERTY_HINT_LAYERS_2D_RENDER), "set_item_shadow_cull_mask", "get_item_shadow_cull_mask"); - BIND_CONSTANT(MODE_ADD); - BIND_CONSTANT(MODE_SUB); - BIND_CONSTANT(MODE_MIX); - BIND_CONSTANT(MODE_MASK); + BIND_ENUM_CONSTANT(MODE_ADD); + BIND_ENUM_CONSTANT(MODE_SUB); + BIND_ENUM_CONSTANT(MODE_MIX); + BIND_ENUM_CONSTANT(MODE_MASK); } Light2D::Light2D() { diff --git a/scene/2d/light_occluder_2d.cpp b/scene/2d/light_occluder_2d.cpp index a1a8e7d9c4..680adeea69 100644 --- a/scene/2d/light_occluder_2d.cpp +++ b/scene/2d/light_occluder_2d.cpp @@ -29,6 +29,8 @@ /*************************************************************************/ #include "light_occluder_2d.h" +#include "engine.h" + void OccluderPolygon2D::set_polygon(const PoolVector<Vector2> &p_polygon) { polygon = p_polygon; @@ -87,9 +89,9 @@ void OccluderPolygon2D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "cull_mode", PROPERTY_HINT_ENUM, "Disabled,ClockWise,CounterClockWise"), "set_cull_mode", "get_cull_mode"); ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR2_ARRAY, "polygon"), "set_polygon", "get_polygon"); - BIND_CONSTANT(CULL_DISABLED); - BIND_CONSTANT(CULL_CLOCKWISE); - BIND_CONSTANT(CULL_COUNTER_CLOCKWISE); + BIND_ENUM_CONSTANT(CULL_DISABLED); + BIND_ENUM_CONSTANT(CULL_CLOCKWISE); + BIND_ENUM_CONSTANT(CULL_COUNTER_CLOCKWISE); } OccluderPolygon2D::OccluderPolygon2D() { @@ -130,7 +132,7 @@ void LightOccluder2D::_notification(int p_what) { if (p_what == NOTIFICATION_DRAW) { - if (get_tree()->is_editor_hint()) { + if (Engine::get_singleton()->is_editor_hint()) { if (occluder_polygon.is_valid()) { diff --git a/scene/2d/line_2d.cpp b/scene/2d/line_2d.cpp index 5438557d0b..6e7bfe63c8 100644 --- a/scene/2d/line_2d.cpp +++ b/scene/2d/line_2d.cpp @@ -322,16 +322,16 @@ void Line2D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::REAL, "sharp_limit"), "set_sharp_limit", "get_sharp_limit"); ADD_PROPERTY(PropertyInfo(Variant::INT, "round_precision"), "set_round_precision", "get_round_precision"); - BIND_CONSTANT(LINE_JOINT_SHARP); - BIND_CONSTANT(LINE_JOINT_BEVEL); - BIND_CONSTANT(LINE_JOINT_ROUND); + BIND_ENUM_CONSTANT(LINE_JOINT_SHARP); + BIND_ENUM_CONSTANT(LINE_JOINT_BEVEL); + BIND_ENUM_CONSTANT(LINE_JOINT_ROUND); - BIND_CONSTANT(LINE_CAP_NONE); - BIND_CONSTANT(LINE_CAP_BOX); - BIND_CONSTANT(LINE_CAP_ROUND); + BIND_ENUM_CONSTANT(LINE_CAP_NONE); + BIND_ENUM_CONSTANT(LINE_CAP_BOX); + BIND_ENUM_CONSTANT(LINE_CAP_ROUND); - BIND_CONSTANT(LINE_TEXTURE_NONE); - BIND_CONSTANT(LINE_TEXTURE_TILE); + BIND_ENUM_CONSTANT(LINE_TEXTURE_NONE); + BIND_ENUM_CONSTANT(LINE_TEXTURE_TILE); ClassDB::bind_method(D_METHOD("_gradient_changed"), &Line2D::_gradient_changed); } diff --git a/scene/2d/navigation_polygon.cpp b/scene/2d/navigation_polygon.cpp index 779751c1c5..7515d486c2 100644 --- a/scene/2d/navigation_polygon.cpp +++ b/scene/2d/navigation_polygon.cpp @@ -30,6 +30,7 @@ #include "navigation_polygon.h" #include "core_string_names.h" +#include "engine.h" #include "navigation2d.h" #include "thirdparty/misc/triangulator.h" @@ -297,7 +298,7 @@ void NavigationPolygonInstance::set_enabled(bool p_enabled) { } } - if (get_tree()->is_editor_hint() || get_tree()->is_debugging_navigation_hint()) + if (Engine::get_singleton()->is_editor_hint() || get_tree()->is_debugging_navigation_hint()) update(); //update_gizmo(); @@ -352,7 +353,7 @@ void NavigationPolygonInstance::_notification(int p_what) { } break; case NOTIFICATION_DRAW: { - if (is_inside_tree() && (get_tree()->is_editor_hint() || get_tree()->is_debugging_navigation_hint()) && navpoly.is_valid()) { + if (is_inside_tree() && (Engine::get_singleton()->is_editor_hint() || get_tree()->is_debugging_navigation_hint()) && navpoly.is_valid()) { PoolVector<Vector2> verts = navpoly->get_vertices(); int vsize = verts.size(); @@ -432,7 +433,7 @@ Ref<NavigationPolygon> NavigationPolygonInstance::get_navigation_polygon() const void NavigationPolygonInstance::_navpoly_changed() { - if (is_inside_tree() && (get_tree()->is_editor_hint() || get_tree()->is_debugging_navigation_hint())) + if (is_inside_tree() && (Engine::get_singleton()->is_editor_hint() || get_tree()->is_debugging_navigation_hint())) update(); } diff --git a/scene/2d/parallax_layer.cpp b/scene/2d/parallax_layer.cpp index 0e83b9aaae..4b62d70648 100644 --- a/scene/2d/parallax_layer.cpp +++ b/scene/2d/parallax_layer.cpp @@ -28,10 +28,15 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "parallax_layer.h" + +#include "engine.h" #include "parallax_background.h" void ParallaxLayer::set_motion_scale(const Size2 &p_scale) { + if (!get_parent()) + return; + motion_scale = p_scale; ParallaxBackground *pb = get_parent()->cast_to<ParallaxBackground>(); @@ -49,6 +54,9 @@ Size2 ParallaxLayer::get_motion_scale() const { void ParallaxLayer::set_motion_offset(const Size2 &p_offset) { + if (!get_parent()) + return; + motion_offset = p_offset; ParallaxBackground *pb = get_parent()->cast_to<ParallaxBackground>(); @@ -111,7 +119,7 @@ void ParallaxLayer::set_base_offset_and_scale(const Point2 &p_offset, float p_sc if (!is_inside_tree()) return; - if (get_tree()->is_editor_hint()) + if (Engine::get_singleton()->is_editor_hint()) return; Point2 new_ofs = ((orig_offset + p_offset) * motion_scale) * p_scale + motion_offset; diff --git a/scene/2d/particles_2d.cpp b/scene/2d/particles_2d.cpp index a2ec33f403..b0c00c4a64 100644 --- a/scene/2d/particles_2d.cpp +++ b/scene/2d/particles_2d.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "particles_2d.h" +#include "engine.h" #include "scene/3d/particles.h" #include "scene/scene_string_names.h" @@ -295,7 +296,7 @@ void Particles2D::_notification(int p_what) { VS::get_singleton()->canvas_item_add_particles(get_canvas_item(), particles, texture_rid, normal_rid, h_frames, v_frames); #ifdef TOOLS_ENABLED - if (get_tree()->is_editor_hint() && (this == get_tree()->get_edited_scene_root() || get_tree()->get_edited_scene_root()->is_a_parent_of(this))) { + if (Engine::get_singleton()->is_editor_hint() && (this == get_tree()->get_edited_scene_root() || get_tree()->get_edited_scene_root()->is_a_parent_of(this))) { draw_rect(visibility_rect, Color(0, 0.7, 0.9, 0.4), false); } @@ -388,8 +389,8 @@ void Particles2D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "h_frames", PROPERTY_HINT_RANGE, "1,1024,1"), "set_h_frames", "get_h_frames"); ADD_PROPERTY(PropertyInfo(Variant::INT, "v_frames", PROPERTY_HINT_RANGE, "1,1024,1"), "set_v_frames", "get_v_frames"); - BIND_CONSTANT(DRAW_ORDER_INDEX); - BIND_CONSTANT(DRAW_ORDER_LIFETIME); + BIND_ENUM_CONSTANT(DRAW_ORDER_INDEX); + BIND_ENUM_CONSTANT(DRAW_ORDER_LIFETIME); } Particles2D::Particles2D() { diff --git a/scene/2d/path_2d.cpp b/scene/2d/path_2d.cpp index 6b30e97de8..a79f60c96f 100644 --- a/scene/2d/path_2d.cpp +++ b/scene/2d/path_2d.cpp @@ -28,6 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "path_2d.h" + +#include "engine.h" #include "scene/scene_string_names.h" void Path2D::_notification(int p_what) { @@ -35,7 +37,7 @@ void Path2D::_notification(int p_what) { if (p_what == NOTIFICATION_DRAW && curve.is_valid()) { //draw the curve!! - if (!get_tree()->is_editor_hint() && !get_tree()->is_debugging_navigation_hint()) { + if (!Engine::get_singleton()->is_editor_hint() && !get_tree()->is_debugging_navigation_hint()) { return; } @@ -56,7 +58,7 @@ void Path2D::_notification(int p_what) { void Path2D::_curve_changed() { - if (is_inside_tree() && get_tree()->is_editor_hint()) + if (is_inside_tree() && Engine::get_singleton()->is_editor_hint()) update(); } diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp index 6ec1642138..aaba9da299 100644 --- a/scene/2d/physics_body_2d.cpp +++ b/scene/2d/physics_body_2d.cpp @@ -28,6 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "physics_body_2d.h" + +#include "engine.h" #include "scene/scene_string_names.h" void PhysicsBody2D::_notification(int p_what) { @@ -802,13 +804,13 @@ void RigidBody2D::_notification(int p_what) { #ifdef TOOLS_ENABLED if (p_what == NOTIFICATION_ENTER_TREE) { - if (get_tree()->is_editor_hint()) { + if (Engine::get_singleton()->is_editor_hint()) { set_notify_local_transform(true); //used for warnings and only in editor } } if (p_what == NOTIFICATION_LOCAL_TRANSFORM_CHANGED) { - if (get_tree()->is_editor_hint()) { + if (Engine::get_singleton()->is_editor_hint()) { update_configuration_warning(); } } @@ -931,14 +933,14 @@ void RigidBody2D::_bind_methods() { ADD_SIGNAL(MethodInfo("body_exited", PropertyInfo(Variant::OBJECT, "body"))); ADD_SIGNAL(MethodInfo("sleeping_state_changed")); - BIND_CONSTANT(MODE_STATIC); - BIND_CONSTANT(MODE_KINEMATIC); - BIND_CONSTANT(MODE_RIGID); - BIND_CONSTANT(MODE_CHARACTER); + BIND_ENUM_CONSTANT(MODE_STATIC); + BIND_ENUM_CONSTANT(MODE_KINEMATIC); + BIND_ENUM_CONSTANT(MODE_RIGID); + BIND_ENUM_CONSTANT(MODE_CHARACTER); - BIND_CONSTANT(CCD_MODE_DISABLED); - BIND_CONSTANT(CCD_MODE_CAST_RAY); - BIND_CONSTANT(CCD_MODE_CAST_SHAPE); + BIND_ENUM_CONSTANT(CCD_MODE_DISABLED); + BIND_ENUM_CONSTANT(CCD_MODE_CAST_RAY); + BIND_ENUM_CONSTANT(CCD_MODE_CAST_SHAPE); } RigidBody2D::RigidBody2D() diff --git a/scene/2d/polygon_2d.cpp b/scene/2d/polygon_2d.cpp index 7e2d6d1b5a..cde5724069 100644 --- a/scene/2d/polygon_2d.cpp +++ b/scene/2d/polygon_2d.cpp @@ -143,9 +143,7 @@ void Polygon2D::_notification(int p_what) { Transform2D texmat(tex_rot, tex_ofs); texmat.scale(tex_scale); - Size2 tex_size = Vector2(1, 1); - - tex_size = texture->get_size(); + Size2 tex_size = texture->get_size(); uvs.resize(points.size()); if (points.size() == uv.size()) { diff --git a/scene/2d/position_2d.cpp b/scene/2d/position_2d.cpp index 74ad9c17e2..7688faa23b 100644 --- a/scene/2d/position_2d.cpp +++ b/scene/2d/position_2d.cpp @@ -28,6 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "position_2d.h" + +#include "engine.h" #include "scene/resources/texture.h" void Position2D::_draw_cross() { @@ -52,7 +54,7 @@ void Position2D::_notification(int p_what) { case NOTIFICATION_DRAW: { if (!is_inside_tree()) break; - if (get_tree()->is_editor_hint()) + if (Engine::get_singleton()->is_editor_hint()) _draw_cross(); } break; diff --git a/scene/2d/ray_cast_2d.cpp b/scene/2d/ray_cast_2d.cpp index cfb4059714..fbec922a2d 100644 --- a/scene/2d/ray_cast_2d.cpp +++ b/scene/2d/ray_cast_2d.cpp @@ -28,14 +28,16 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "ray_cast_2d.h" + #include "collision_object_2d.h" +#include "engine.h" #include "physics_body_2d.h" #include "servers/physics_2d_server.h" void RayCast2D::set_cast_to(const Vector2 &p_point) { cast_to = p_point; - if (is_inside_tree() && (get_tree()->is_editor_hint() || get_tree()->is_debugging_collisions_hint())) + if (is_inside_tree() && (Engine::get_singleton()->is_editor_hint() || get_tree()->is_debugging_collisions_hint())) update(); } @@ -92,7 +94,7 @@ Vector2 RayCast2D::get_collision_normal() const { void RayCast2D::set_enabled(bool p_enabled) { enabled = p_enabled; - if (is_inside_tree() && !get_tree()->is_editor_hint()) + if (is_inside_tree() && !Engine::get_singleton()->is_editor_hint()) set_fixed_process(p_enabled); if (!p_enabled) collided = false; @@ -132,7 +134,7 @@ void RayCast2D::_notification(int p_what) { case NOTIFICATION_ENTER_TREE: { - if (enabled && !get_tree()->is_editor_hint()) + if (enabled && !Engine::get_singleton()->is_editor_hint()) set_fixed_process(true); else set_fixed_process(false); @@ -153,7 +155,7 @@ void RayCast2D::_notification(int p_what) { case NOTIFICATION_DRAW: { - if (!get_tree()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint()) + if (!Engine::get_singleton()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint()) break; Transform2D xf; xf.rotate(cast_to.angle()); diff --git a/scene/2d/screen_button.cpp b/scene/2d/screen_button.cpp index 37139b2b93..e8e5e9411f 100644 --- a/scene/2d/screen_button.cpp +++ b/scene/2d/screen_button.cpp @@ -112,7 +112,7 @@ void TouchScreenButton::_notification(int p_what) { if (!is_inside_tree()) return; - if (!get_tree()->is_editor_hint() && !OS::get_singleton()->has_touchscreen_ui_hint() && visibility == VISIBILITY_TOUCHSCREEN_ONLY) + if (!Engine::get_singleton()->is_editor_hint() && !OS::get_singleton()->has_touchscreen_ui_hint() && visibility == VISIBILITY_TOUCHSCREEN_ONLY) return; if (finger_pressed != -1) { @@ -129,7 +129,7 @@ void TouchScreenButton::_notification(int p_what) { if (!shape_visible) return; - if (!get_tree()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint()) + if (!Engine::get_singleton()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint()) return; if (shape.is_valid()) { Color draw_col = get_tree()->get_debug_collisions_color(); @@ -141,11 +141,11 @@ void TouchScreenButton::_notification(int p_what) { } break; case NOTIFICATION_ENTER_TREE: { - if (!get_tree()->is_editor_hint() && !OS::get_singleton()->has_touchscreen_ui_hint() && visibility == VISIBILITY_TOUCHSCREEN_ONLY) + if (!Engine::get_singleton()->is_editor_hint() && !OS::get_singleton()->has_touchscreen_ui_hint() && visibility == VISIBILITY_TOUCHSCREEN_ONLY) return; update(); - if (!get_tree()->is_editor_hint()) + if (!Engine::get_singleton()->is_editor_hint()) set_process_input(is_visible_in_tree()); } break; @@ -154,7 +154,7 @@ void TouchScreenButton::_notification(int p_what) { _release(true); } break; case NOTIFICATION_VISIBILITY_CHANGED: { - if (get_tree()->is_editor_hint()) + if (Engine::get_singleton()->is_editor_hint()) break; if (is_visible_in_tree()) { set_process_input(true); diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index 68b026b1b3..5d246e331f 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -1315,15 +1315,18 @@ void TileMap::_bind_methods() { ADD_SIGNAL(MethodInfo("settings_changed")); BIND_CONSTANT(INVALID_CELL); - BIND_CONSTANT(MODE_SQUARE); - BIND_CONSTANT(MODE_ISOMETRIC); - BIND_CONSTANT(MODE_CUSTOM); - BIND_CONSTANT(HALF_OFFSET_X); - BIND_CONSTANT(HALF_OFFSET_Y); - BIND_CONSTANT(HALF_OFFSET_DISABLED); - BIND_CONSTANT(TILE_ORIGIN_TOP_LEFT); - BIND_CONSTANT(TILE_ORIGIN_CENTER); - BIND_CONSTANT(TILE_ORIGIN_BOTTOM_LEFT); + + BIND_ENUM_CONSTANT(MODE_SQUARE); + BIND_ENUM_CONSTANT(MODE_ISOMETRIC); + BIND_ENUM_CONSTANT(MODE_CUSTOM); + + BIND_ENUM_CONSTANT(HALF_OFFSET_X); + BIND_ENUM_CONSTANT(HALF_OFFSET_Y); + BIND_ENUM_CONSTANT(HALF_OFFSET_DISABLED); + + BIND_ENUM_CONSTANT(TILE_ORIGIN_TOP_LEFT); + BIND_ENUM_CONSTANT(TILE_ORIGIN_CENTER); + BIND_ENUM_CONSTANT(TILE_ORIGIN_BOTTOM_LEFT); } TileMap::TileMap() { diff --git a/scene/2d/visibility_notifier_2d.cpp b/scene/2d/visibility_notifier_2d.cpp index fb71b61d45..2f2ad08f01 100644 --- a/scene/2d/visibility_notifier_2d.cpp +++ b/scene/2d/visibility_notifier_2d.cpp @@ -29,20 +29,20 @@ /*************************************************************************/ #include "visibility_notifier_2d.h" +#include "engine.h" #include "particles_2d.h" #include "scene/2d/animated_sprite.h" #include "scene/2d/physics_body_2d.h" #include "scene/animation/animation_player.h" #include "scene/main/viewport.h" #include "scene/scene_string_names.h" -#include "scene/scene_string_names.h" void VisibilityNotifier2D::_enter_viewport(Viewport *p_viewport) { ERR_FAIL_COND(viewports.has(p_viewport)); viewports.insert(p_viewport); - if (is_inside_tree() && get_tree()->is_editor_hint()) + if (is_inside_tree() && Engine::get_singleton()->is_editor_hint()) return; if (viewports.size() == 1) { @@ -58,7 +58,7 @@ void VisibilityNotifier2D::_exit_viewport(Viewport *p_viewport) { ERR_FAIL_COND(!viewports.has(p_viewport)); viewports.erase(p_viewport); - if (is_inside_tree() && get_tree()->is_editor_hint()) + if (is_inside_tree() && Engine::get_singleton()->is_editor_hint()) return; emit_signal(SceneStringNames::get_singleton()->viewport_exited, p_viewport); @@ -74,7 +74,7 @@ void VisibilityNotifier2D::set_rect(const Rect2 &p_rect) { rect = p_rect; if (is_inside_tree()) { get_world_2d()->_update_notifier(this, get_global_transform().xform(rect)); - if (get_tree()->is_editor_hint()) { + if (Engine::get_singleton()->is_editor_hint()) { update(); item_rect_changed(); } @@ -108,7 +108,7 @@ void VisibilityNotifier2D::_notification(int p_what) { } break; case NOTIFICATION_DRAW: { - if (get_tree()->is_editor_hint()) { + if (Engine::get_singleton()->is_editor_hint()) { draw_rect(rect, Color(1, 0.5, 1, 0.2)); } @@ -236,7 +236,7 @@ void VisibilityEnabler2D::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { - if (get_tree()->is_editor_hint()) + if (Engine::get_singleton()->is_editor_hint()) return; Node *from = this; @@ -254,7 +254,7 @@ void VisibilityEnabler2D::_notification(int p_what) { if (p_what == NOTIFICATION_EXIT_TREE) { - if (get_tree()->is_editor_hint()) + if (Engine::get_singleton()->is_editor_hint()) return; for (Map<Node *, Variant>::Element *E = nodes.front(); E; E = E->next()) { @@ -341,13 +341,13 @@ void VisibilityEnabler2D::_bind_methods() { ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "process_parent"), "set_enabler", "is_enabler_enabled", ENABLER_PARENT_PROCESS); ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "fixed_process_parent"), "set_enabler", "is_enabler_enabled", ENABLER_PARENT_FIXED_PROCESS); - BIND_CONSTANT(ENABLER_FREEZE_BODIES); - BIND_CONSTANT(ENABLER_PAUSE_ANIMATIONS); - BIND_CONSTANT(ENABLER_PAUSE_PARTICLES); - BIND_CONSTANT(ENABLER_PAUSE_ANIMATED_SPRITES); - BIND_CONSTANT(ENABLER_PARENT_PROCESS); - BIND_CONSTANT(ENABLER_PARENT_FIXED_PROCESS); - BIND_CONSTANT(ENABLER_MAX); + BIND_ENUM_CONSTANT(ENABLER_FREEZE_BODIES); + BIND_ENUM_CONSTANT(ENABLER_PAUSE_ANIMATIONS); + BIND_ENUM_CONSTANT(ENABLER_PAUSE_PARTICLES); + BIND_ENUM_CONSTANT(ENABLER_PAUSE_ANIMATED_SPRITES); + BIND_ENUM_CONSTANT(ENABLER_PARENT_PROCESS); + BIND_ENUM_CONSTANT(ENABLER_PARENT_FIXED_PROCESS); + BIND_ENUM_CONSTANT(ENABLER_MAX); } void VisibilityEnabler2D::set_enabler(Enabler p_enabler, bool p_enable) { diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp index 6abc2caac8..1ae6f552f4 100644 --- a/scene/3d/audio_stream_player_3d.cpp +++ b/scene/3d/audio_stream_player_3d.cpp @@ -215,7 +215,7 @@ void AudioStreamPlayer3D::_notification(int p_what) { velocity_tracker->reset(get_global_transform().origin); AudioServer::get_singleton()->add_callback(_mix_audios, this); - if (autoplay && !get_tree()->is_editor_hint()) { + if (autoplay && !Engine::get_singleton()->is_editor_hint()) { play(); } } @@ -888,16 +888,16 @@ void AudioStreamPlayer3D::_bind_methods() { ADD_GROUP("Doppler", "doppler_"); ADD_PROPERTY(PropertyInfo(Variant::INT, "doppler_tracking", PROPERTY_HINT_ENUM, "Disabled,Idle,Fixed"), "set_doppler_tracking", "get_doppler_tracking"); - BIND_CONSTANT(ATTENUATION_INVERSE_DISTANCE); - BIND_CONSTANT(ATTENUATION_INVERSE_SQUARE_DISTANCE); - BIND_CONSTANT(ATTENUATION_LOGARITHMIC); + BIND_ENUM_CONSTANT(ATTENUATION_INVERSE_DISTANCE); + BIND_ENUM_CONSTANT(ATTENUATION_INVERSE_SQUARE_DISTANCE); + BIND_ENUM_CONSTANT(ATTENUATION_LOGARITHMIC); - BIND_CONSTANT(OUT_OF_RANGE_MIX); - BIND_CONSTANT(OUT_OF_RANGE_PAUSE); + BIND_ENUM_CONSTANT(OUT_OF_RANGE_MIX); + BIND_ENUM_CONSTANT(OUT_OF_RANGE_PAUSE); - BIND_CONSTANT(DOPPLER_TRACKING_DISABLED); - BIND_CONSTANT(DOPPLER_TRACKING_IDLE_STEP); - BIND_CONSTANT(DOPPLER_TRACKING_FIXED_STEP); + BIND_ENUM_CONSTANT(DOPPLER_TRACKING_DISABLED); + BIND_ENUM_CONSTANT(DOPPLER_TRACKING_IDLE_STEP); + BIND_ENUM_CONSTANT(DOPPLER_TRACKING_FIXED_STEP); } AudioStreamPlayer3D::AudioStreamPlayer3D() { diff --git a/scene/3d/camera.cpp b/scene/3d/camera.cpp index 3c5eb21d38..9db7253fd6 100644 --- a/scene/3d/camera.cpp +++ b/scene/3d/camera.cpp @@ -564,15 +564,15 @@ void Camera::_bind_methods() { ClassDB::bind_method(D_METHOD("get_doppler_tracking"), &Camera::get_doppler_tracking); //ClassDB::bind_method(D_METHOD("_camera_make_current"),&Camera::_camera_make_current ); - BIND_CONSTANT(PROJECTION_PERSPECTIVE); - BIND_CONSTANT(PROJECTION_ORTHOGONAL); + BIND_ENUM_CONSTANT(PROJECTION_PERSPECTIVE); + BIND_ENUM_CONSTANT(PROJECTION_ORTHOGONAL); - BIND_CONSTANT(KEEP_WIDTH); - BIND_CONSTANT(KEEP_HEIGHT); + BIND_ENUM_CONSTANT(KEEP_WIDTH); + BIND_ENUM_CONSTANT(KEEP_HEIGHT); - BIND_CONSTANT(DOPPLER_TRACKING_DISABLED) - BIND_CONSTANT(DOPPLER_TRACKING_IDLE_STEP) - BIND_CONSTANT(DOPPLER_TRACKING_FIXED_STEP) + BIND_ENUM_CONSTANT(DOPPLER_TRACKING_DISABLED) + BIND_ENUM_CONSTANT(DOPPLER_TRACKING_IDLE_STEP) + BIND_ENUM_CONSTANT(DOPPLER_TRACKING_FIXED_STEP) } float Camera::get_fov() const { diff --git a/scene/3d/character_camera.cpp b/scene/3d/character_camera.cpp index 065e21fccd..ce047f91c2 100644 --- a/scene/3d/character_camera.cpp +++ b/scene/3d/character_camera.cpp @@ -659,8 +659,8 @@ void CharacterCamera::_bind_methods() { ClassDB::bind_method(D_METHOD("_ray_collision"),&CharacterCamera::_ray_collision); - BIND_CONSTANT( CAMERA_FIXED ); - BIND_CONSTANT( CAMERA_FOLLOW ); + BIND_ENUM_CONSTANT( CAMERA_FIXED ); + BIND_ENUM_CONSTANT( CAMERA_FOLLOW ); } void CharacterCamera::_ray_collision(Vector3 p_point, Vector3 p_normal, int p_subindex, ObjectID p_against,int p_idx) { diff --git a/scene/3d/gi_probe.cpp b/scene/3d/gi_probe.cpp index 2174f924ac..460580d4fe 100644 --- a/scene/3d/gi_probe.cpp +++ b/scene/3d/gi_probe.cpp @@ -1488,10 +1488,10 @@ void GIProbe::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::BOOL, "compress"), "set_compress", "is_compressed"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "GIProbeData"), "set_probe_data", "get_probe_data"); - BIND_CONSTANT(SUBDIV_64); - BIND_CONSTANT(SUBDIV_128); - BIND_CONSTANT(SUBDIV_256); - BIND_CONSTANT(SUBDIV_MAX); + BIND_ENUM_CONSTANT(SUBDIV_64); + BIND_ENUM_CONSTANT(SUBDIV_128); + BIND_ENUM_CONSTANT(SUBDIV_256); + BIND_ENUM_CONSTANT(SUBDIV_MAX); } GIProbe::GIProbe() { diff --git a/scene/3d/interpolated_camera.cpp b/scene/3d/interpolated_camera.cpp index 36a6660bf9..a481018890 100644 --- a/scene/3d/interpolated_camera.cpp +++ b/scene/3d/interpolated_camera.cpp @@ -29,12 +29,14 @@ /*************************************************************************/ #include "interpolated_camera.h" +#include "engine.h" + void InterpolatedCamera::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: { - if (get_tree()->is_editor_hint() && enabled) + if (Engine::get_singleton()->is_editor_hint() && enabled) set_fixed_process(false); } break; @@ -106,7 +108,7 @@ void InterpolatedCamera::set_interpolation_enabled(bool p_enable) { return; enabled = p_enable; if (p_enable) { - if (is_inside_tree() && get_tree()->is_editor_hint()) + if (is_inside_tree() && Engine::get_singleton()->is_editor_hint()) return; set_process(true); } else diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp index 1304954cf3..f4b5cc5731 100644 --- a/scene/3d/light.cpp +++ b/scene/3d/light.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "light.h" +#include "engine.h" #include "project_settings.h" #include "scene/resources/surface_tool.h" @@ -150,7 +151,7 @@ void Light::_update_visibility() { #ifdef TOOLS_ENABLED if (editor_only) { - if (!get_tree()->is_editor_hint()) { + if (!Engine::get_singleton()->is_editor_hint()) { editor_ok = false; } else { editor_ok = (get_tree()->get_edited_scene_root() && (this == get_tree()->get_edited_scene_root() || get_owner() == get_tree()->get_edited_scene_root())); @@ -235,21 +236,21 @@ void Light::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::BOOL, "editor_only"), "set_editor_only", "is_editor_only"); ADD_GROUP("", ""); - BIND_CONSTANT(PARAM_ENERGY); - BIND_CONSTANT(PARAM_SPECULAR); - BIND_CONSTANT(PARAM_RANGE); - BIND_CONSTANT(PARAM_ATTENUATION); - BIND_CONSTANT(PARAM_SPOT_ANGLE); - BIND_CONSTANT(PARAM_SPOT_ATTENUATION); - BIND_CONSTANT(PARAM_CONTACT_SHADOW_SIZE); - BIND_CONSTANT(PARAM_SHADOW_MAX_DISTANCE); - BIND_CONSTANT(PARAM_SHADOW_SPLIT_1_OFFSET); - BIND_CONSTANT(PARAM_SHADOW_SPLIT_2_OFFSET); - BIND_CONSTANT(PARAM_SHADOW_SPLIT_3_OFFSET); - BIND_CONSTANT(PARAM_SHADOW_NORMAL_BIAS); - BIND_CONSTANT(PARAM_SHADOW_BIAS); + BIND_ENUM_CONSTANT(PARAM_ENERGY); + BIND_ENUM_CONSTANT(PARAM_SPECULAR); + BIND_ENUM_CONSTANT(PARAM_RANGE); + BIND_ENUM_CONSTANT(PARAM_ATTENUATION); + BIND_ENUM_CONSTANT(PARAM_SPOT_ANGLE); + BIND_ENUM_CONSTANT(PARAM_SPOT_ATTENUATION); + BIND_ENUM_CONSTANT(PARAM_CONTACT_SHADOW_SIZE); + BIND_ENUM_CONSTANT(PARAM_SHADOW_MAX_DISTANCE); + BIND_ENUM_CONSTANT(PARAM_SHADOW_SPLIT_1_OFFSET); + BIND_ENUM_CONSTANT(PARAM_SHADOW_SPLIT_2_OFFSET); + BIND_ENUM_CONSTANT(PARAM_SHADOW_SPLIT_3_OFFSET); + BIND_ENUM_CONSTANT(PARAM_SHADOW_NORMAL_BIAS); + BIND_ENUM_CONSTANT(PARAM_SHADOW_BIAS); - BIND_CONSTANT(PARAM_MAX); + BIND_ENUM_CONSTANT(PARAM_MAX); } Light::Light(VisualServer::LightType p_type) { @@ -334,9 +335,9 @@ void DirectionalLight::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::BOOL, "directional_shadow_blend_splits"), "set_blend_splits", "is_blend_splits_enabled"); ADD_PROPERTYI(PropertyInfo(Variant::REAL, "directional_shadow_normal_bias", PROPERTY_HINT_RANGE, "0,16,0.01"), "set_param", "get_param", PARAM_SHADOW_NORMAL_BIAS); - BIND_CONSTANT(SHADOW_ORTHOGONAL); - BIND_CONSTANT(SHADOW_PARALLEL_2_SPLITS); - BIND_CONSTANT(SHADOW_PARALLEL_4_SPLITS); + BIND_ENUM_CONSTANT(SHADOW_ORTHOGONAL); + BIND_ENUM_CONSTANT(SHADOW_PARALLEL_2_SPLITS); + BIND_ENUM_CONSTANT(SHADOW_PARALLEL_4_SPLITS); } DirectionalLight::DirectionalLight() diff --git a/scene/3d/particles.cpp b/scene/3d/particles.cpp index e88a52c76a..70f46e3a0a 100644 --- a/scene/3d/particles.cpp +++ b/scene/3d/particles.cpp @@ -347,9 +347,10 @@ void Particles::_bind_methods() { ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "draw_pass_" + itos(i + 1), PROPERTY_HINT_RESOURCE_TYPE, "Mesh"), "set_draw_pass_mesh", "get_draw_pass_mesh", i); } - BIND_CONSTANT(DRAW_ORDER_INDEX); - BIND_CONSTANT(DRAW_ORDER_LIFETIME); - BIND_CONSTANT(DRAW_ORDER_VIEW_DEPTH); + BIND_ENUM_CONSTANT(DRAW_ORDER_INDEX); + BIND_ENUM_CONSTANT(DRAW_ORDER_LIFETIME); + BIND_ENUM_CONSTANT(DRAW_ORDER_VIEW_DEPTH); + BIND_CONSTANT(MAX_DRAW_PASSES); } @@ -1487,29 +1488,29 @@ void ParticlesMaterial::_bind_methods() { ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "anim_offset_curve", PROPERTY_HINT_RESOURCE_TYPE, "CurveTexture"), "set_param_texture", "get_param_texture", PARAM_ANIM_OFFSET); ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "anim_loop"), "set_flag", "get_flag", FLAG_ANIM_LOOP); - BIND_CONSTANT(PARAM_INITIAL_LINEAR_VELOCITY); - BIND_CONSTANT(PARAM_ANGULAR_VELOCITY); - BIND_CONSTANT(PARAM_ORBIT_VELOCITY); - BIND_CONSTANT(PARAM_LINEAR_ACCEL); - BIND_CONSTANT(PARAM_RADIAL_ACCEL); - BIND_CONSTANT(PARAM_TANGENTIAL_ACCEL); - BIND_CONSTANT(PARAM_DAMPING); - BIND_CONSTANT(PARAM_ANGLE); - BIND_CONSTANT(PARAM_SCALE); - BIND_CONSTANT(PARAM_HUE_VARIATION); - BIND_CONSTANT(PARAM_ANIM_SPEED); - BIND_CONSTANT(PARAM_ANIM_OFFSET); - BIND_CONSTANT(PARAM_MAX); - - BIND_CONSTANT(FLAG_ALIGN_Y_TO_VELOCITY); - BIND_CONSTANT(FLAG_ROTATE_Y); - BIND_CONSTANT(FLAG_MAX); - - BIND_CONSTANT(EMISSION_SHAPE_POINT); - BIND_CONSTANT(EMISSION_SHAPE_SPHERE); - BIND_CONSTANT(EMISSION_SHAPE_BOX); - BIND_CONSTANT(EMISSION_SHAPE_POINTS); - BIND_CONSTANT(EMISSION_SHAPE_DIRECTED_POINTS); + BIND_ENUM_CONSTANT(PARAM_INITIAL_LINEAR_VELOCITY); + BIND_ENUM_CONSTANT(PARAM_ANGULAR_VELOCITY); + BIND_ENUM_CONSTANT(PARAM_ORBIT_VELOCITY); + BIND_ENUM_CONSTANT(PARAM_LINEAR_ACCEL); + BIND_ENUM_CONSTANT(PARAM_RADIAL_ACCEL); + BIND_ENUM_CONSTANT(PARAM_TANGENTIAL_ACCEL); + BIND_ENUM_CONSTANT(PARAM_DAMPING); + BIND_ENUM_CONSTANT(PARAM_ANGLE); + BIND_ENUM_CONSTANT(PARAM_SCALE); + BIND_ENUM_CONSTANT(PARAM_HUE_VARIATION); + BIND_ENUM_CONSTANT(PARAM_ANIM_SPEED); + BIND_ENUM_CONSTANT(PARAM_ANIM_OFFSET); + BIND_ENUM_CONSTANT(PARAM_MAX); + + BIND_ENUM_CONSTANT(FLAG_ALIGN_Y_TO_VELOCITY); + BIND_ENUM_CONSTANT(FLAG_ROTATE_Y); + BIND_ENUM_CONSTANT(FLAG_MAX); + + BIND_ENUM_CONSTANT(EMISSION_SHAPE_POINT); + BIND_ENUM_CONSTANT(EMISSION_SHAPE_SPHERE); + BIND_ENUM_CONSTANT(EMISSION_SHAPE_BOX); + BIND_ENUM_CONSTANT(EMISSION_SHAPE_POINTS); + BIND_ENUM_CONSTANT(EMISSION_SHAPE_DIRECTED_POINTS); } ParticlesMaterial::ParticlesMaterial() diff --git a/scene/3d/path.cpp b/scene/3d/path.cpp index f8df21004e..0ca7f96fd7 100644 --- a/scene/3d/path.cpp +++ b/scene/3d/path.cpp @@ -28,11 +28,13 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "path.h" + +#include "engine.h" #include "scene/scene_string_names.h" void Path::_notification(int p_what) { #if 0 - if (p_what==NOTIFICATION_DRAW && curve.is_valid() && is_inside_scene() && get_scene()->is_editor_hint()) { + if (p_what==NOTIFICATION_DRAW && curve.is_valid() && is_inside_scene() && Engine::get_singleton()->is_editor_hint()) { //draw the curve!! for(int i=0;i<curve->get_point_count();i++) { @@ -53,7 +55,7 @@ void Path::_notification(int p_what) { void Path::_curve_changed() { - if (is_inside_tree() && get_tree()->is_editor_hint()) + if (is_inside_tree() && Engine::get_singleton()->is_editor_hint()) update_gizmo(); } @@ -281,10 +283,10 @@ void PathFollow::_bind_methods() { ClassDB::bind_method(D_METHOD("set_loop", "loop"), &PathFollow::set_loop); ClassDB::bind_method(D_METHOD("has_loop"), &PathFollow::has_loop); - BIND_CONSTANT(ROTATION_NONE); - BIND_CONSTANT(ROTATION_Y); - BIND_CONSTANT(ROTATION_XY); - BIND_CONSTANT(ROTATION_XYZ); + BIND_ENUM_CONSTANT(ROTATION_NONE); + BIND_ENUM_CONSTANT(ROTATION_Y); + BIND_ENUM_CONSTANT(ROTATION_XY); + BIND_ENUM_CONSTANT(ROTATION_XYZ); } void PathFollow::set_offset(float p_offset) { diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp index dc8f72d77e..402cd6314b 100644 --- a/scene/3d/physics_body.cpp +++ b/scene/3d/physics_body.cpp @@ -28,6 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "physics_body.h" + +#include "engine.h" #include "method_bind_ext.gen.inc" #include "scene/scene_string_names.h" @@ -476,13 +478,13 @@ void RigidBody::_notification(int p_what) { #ifdef TOOLS_ENABLED if (p_what == NOTIFICATION_ENTER_TREE) { - if (get_tree()->is_editor_hint()) { + if (Engine::get_singleton()->is_editor_hint()) { set_notify_local_transform(true); //used for warnings and only in editor } } if (p_what == NOTIFICATION_LOCAL_TRANSFORM_CHANGED) { - if (get_tree()->is_editor_hint()) { + if (Engine::get_singleton()->is_editor_hint()) { update_configuration_warning(); } } @@ -868,10 +870,10 @@ void RigidBody::_bind_methods() { ADD_SIGNAL(MethodInfo("body_exited", PropertyInfo(Variant::OBJECT, "body"))); ADD_SIGNAL(MethodInfo("sleeping_state_changed")); - BIND_CONSTANT(MODE_STATIC); - BIND_CONSTANT(MODE_KINEMATIC); - BIND_CONSTANT(MODE_RIGID); - BIND_CONSTANT(MODE_CHARACTER); + BIND_ENUM_CONSTANT(MODE_STATIC); + BIND_ENUM_CONSTANT(MODE_KINEMATIC); + BIND_ENUM_CONSTANT(MODE_RIGID); + BIND_ENUM_CONSTANT(MODE_CHARACTER); } RigidBody::RigidBody() diff --git a/scene/3d/physics_joint.cpp b/scene/3d/physics_joint.cpp index 61d496935b..55007c6dc6 100644 --- a/scene/3d/physics_joint.cpp +++ b/scene/3d/physics_joint.cpp @@ -188,9 +188,9 @@ void PinJoint::_bind_methods() { ADD_PROPERTYI(PropertyInfo(Variant::REAL, "params/damping", PROPERTY_HINT_RANGE, "0.01,8.0,0.01"), "set_param", "get_param", PARAM_DAMPING); ADD_PROPERTYI(PropertyInfo(Variant::REAL, "params/impulse_clamp", PROPERTY_HINT_RANGE, "0.0,64.0,0.01"), "set_param", "get_param", PARAM_IMPULSE_CLAMP); - BIND_CONSTANT(PARAM_BIAS); - BIND_CONSTANT(PARAM_DAMPING); - BIND_CONSTANT(PARAM_IMPULSE_CLAMP); + BIND_ENUM_CONSTANT(PARAM_BIAS); + BIND_ENUM_CONSTANT(PARAM_DAMPING); + BIND_ENUM_CONSTANT(PARAM_IMPULSE_CLAMP); } void PinJoint::set_param(Param p_param, float p_value) { @@ -282,19 +282,19 @@ void HingeJoint::_bind_methods() { ADD_PROPERTYI(PropertyInfo(Variant::REAL, "motor/target_velocity", PROPERTY_HINT_RANGE, "0.01,4096,0.01"), "set_param", "get_param", PARAM_MOTOR_TARGET_VELOCITY); ADD_PROPERTYI(PropertyInfo(Variant::REAL, "motor/max_impulse", PROPERTY_HINT_RANGE, "0.01,1024,0.01"), "set_param", "get_param", PARAM_MOTOR_MAX_IMPULSE); - BIND_CONSTANT(PARAM_BIAS); - BIND_CONSTANT(PARAM_LIMIT_UPPER); - BIND_CONSTANT(PARAM_LIMIT_LOWER); - BIND_CONSTANT(PARAM_LIMIT_BIAS); - BIND_CONSTANT(PARAM_LIMIT_SOFTNESS); - BIND_CONSTANT(PARAM_LIMIT_RELAXATION); - BIND_CONSTANT(PARAM_MOTOR_TARGET_VELOCITY); - BIND_CONSTANT(PARAM_MOTOR_MAX_IMPULSE); - BIND_CONSTANT(PARAM_MAX); + BIND_ENUM_CONSTANT(PARAM_BIAS); + BIND_ENUM_CONSTANT(PARAM_LIMIT_UPPER); + BIND_ENUM_CONSTANT(PARAM_LIMIT_LOWER); + BIND_ENUM_CONSTANT(PARAM_LIMIT_BIAS); + BIND_ENUM_CONSTANT(PARAM_LIMIT_SOFTNESS); + BIND_ENUM_CONSTANT(PARAM_LIMIT_RELAXATION); + BIND_ENUM_CONSTANT(PARAM_MOTOR_TARGET_VELOCITY); + BIND_ENUM_CONSTANT(PARAM_MOTOR_MAX_IMPULSE); + BIND_ENUM_CONSTANT(PARAM_MAX); - BIND_CONSTANT(FLAG_USE_LIMIT); - BIND_CONSTANT(FLAG_ENABLE_MOTOR); - BIND_CONSTANT(FLAG_MAX); + BIND_ENUM_CONSTANT(FLAG_USE_LIMIT); + BIND_ENUM_CONSTANT(FLAG_ENABLE_MOTOR); + BIND_ENUM_CONSTANT(FLAG_MAX); } void HingeJoint::set_param(Param p_param, float p_value) { @@ -428,31 +428,31 @@ void SliderJoint::_bind_methods() { ADD_PROPERTYI(PropertyInfo(Variant::REAL, "angular_ortho/restitution", PROPERTY_HINT_RANGE, "0.01,16.0,0.01"), "set_param", "get_param", PARAM_ANGULAR_ORTHOGONAL_RESTITUTION); ADD_PROPERTYI(PropertyInfo(Variant::REAL, "angular_ortho/damping", PROPERTY_HINT_RANGE, "0,16.0,0.01"), "set_param", "get_param", PARAM_ANGULAR_ORTHOGONAL_DAMPING); - BIND_CONSTANT(PARAM_LINEAR_LIMIT_UPPER); - BIND_CONSTANT(PARAM_LINEAR_LIMIT_LOWER); - BIND_CONSTANT(PARAM_LINEAR_LIMIT_SOFTNESS); - BIND_CONSTANT(PARAM_LINEAR_LIMIT_RESTITUTION); - BIND_CONSTANT(PARAM_LINEAR_LIMIT_DAMPING); - BIND_CONSTANT(PARAM_LINEAR_MOTION_SOFTNESS); - BIND_CONSTANT(PARAM_LINEAR_MOTION_RESTITUTION); - BIND_CONSTANT(PARAM_LINEAR_MOTION_DAMPING); - BIND_CONSTANT(PARAM_LINEAR_ORTHOGONAL_SOFTNESS); - BIND_CONSTANT(PARAM_LINEAR_ORTHOGONAL_RESTITUTION); - BIND_CONSTANT(PARAM_LINEAR_ORTHOGONAL_DAMPING); - - BIND_CONSTANT(PARAM_ANGULAR_LIMIT_UPPER); - BIND_CONSTANT(PARAM_ANGULAR_LIMIT_LOWER); - BIND_CONSTANT(PARAM_ANGULAR_LIMIT_SOFTNESS); - BIND_CONSTANT(PARAM_ANGULAR_LIMIT_RESTITUTION); - BIND_CONSTANT(PARAM_ANGULAR_LIMIT_DAMPING); - BIND_CONSTANT(PARAM_ANGULAR_MOTION_SOFTNESS); - BIND_CONSTANT(PARAM_ANGULAR_MOTION_RESTITUTION); - BIND_CONSTANT(PARAM_ANGULAR_MOTION_DAMPING); - BIND_CONSTANT(PARAM_ANGULAR_ORTHOGONAL_SOFTNESS); - BIND_CONSTANT(PARAM_ANGULAR_ORTHOGONAL_RESTITUTION); - BIND_CONSTANT(PARAM_ANGULAR_ORTHOGONAL_DAMPING); - - BIND_CONSTANT(PARAM_MAX); + BIND_ENUM_CONSTANT(PARAM_LINEAR_LIMIT_UPPER); + BIND_ENUM_CONSTANT(PARAM_LINEAR_LIMIT_LOWER); + BIND_ENUM_CONSTANT(PARAM_LINEAR_LIMIT_SOFTNESS); + BIND_ENUM_CONSTANT(PARAM_LINEAR_LIMIT_RESTITUTION); + BIND_ENUM_CONSTANT(PARAM_LINEAR_LIMIT_DAMPING); + BIND_ENUM_CONSTANT(PARAM_LINEAR_MOTION_SOFTNESS); + BIND_ENUM_CONSTANT(PARAM_LINEAR_MOTION_RESTITUTION); + BIND_ENUM_CONSTANT(PARAM_LINEAR_MOTION_DAMPING); + BIND_ENUM_CONSTANT(PARAM_LINEAR_ORTHOGONAL_SOFTNESS); + BIND_ENUM_CONSTANT(PARAM_LINEAR_ORTHOGONAL_RESTITUTION); + BIND_ENUM_CONSTANT(PARAM_LINEAR_ORTHOGONAL_DAMPING); + + BIND_ENUM_CONSTANT(PARAM_ANGULAR_LIMIT_UPPER); + BIND_ENUM_CONSTANT(PARAM_ANGULAR_LIMIT_LOWER); + BIND_ENUM_CONSTANT(PARAM_ANGULAR_LIMIT_SOFTNESS); + BIND_ENUM_CONSTANT(PARAM_ANGULAR_LIMIT_RESTITUTION); + BIND_ENUM_CONSTANT(PARAM_ANGULAR_LIMIT_DAMPING); + BIND_ENUM_CONSTANT(PARAM_ANGULAR_MOTION_SOFTNESS); + BIND_ENUM_CONSTANT(PARAM_ANGULAR_MOTION_RESTITUTION); + BIND_ENUM_CONSTANT(PARAM_ANGULAR_MOTION_DAMPING); + BIND_ENUM_CONSTANT(PARAM_ANGULAR_ORTHOGONAL_SOFTNESS); + BIND_ENUM_CONSTANT(PARAM_ANGULAR_ORTHOGONAL_RESTITUTION); + BIND_ENUM_CONSTANT(PARAM_ANGULAR_ORTHOGONAL_DAMPING); + + BIND_ENUM_CONSTANT(PARAM_MAX); } void SliderJoint::set_param(Param p_param, float p_value) { @@ -560,12 +560,12 @@ void ConeTwistJoint::_bind_methods() { ADD_PROPERTYI(PropertyInfo(Variant::REAL, "softness", PROPERTY_HINT_RANGE, "0.01,16.0,0.01"), "set_param", "get_param", PARAM_SOFTNESS); ADD_PROPERTYI(PropertyInfo(Variant::REAL, "relaxation", PROPERTY_HINT_RANGE, "0.01,16.0,0.01"), "set_param", "get_param", PARAM_RELAXATION); - BIND_CONSTANT(PARAM_SWING_SPAN); - BIND_CONSTANT(PARAM_TWIST_SPAN); - BIND_CONSTANT(PARAM_BIAS); - BIND_CONSTANT(PARAM_SOFTNESS); - BIND_CONSTANT(PARAM_RELAXATION); - BIND_CONSTANT(PARAM_MAX); + BIND_ENUM_CONSTANT(PARAM_SWING_SPAN); + BIND_ENUM_CONSTANT(PARAM_TWIST_SPAN); + BIND_ENUM_CONSTANT(PARAM_BIAS); + BIND_ENUM_CONSTANT(PARAM_SOFTNESS); + BIND_ENUM_CONSTANT(PARAM_RELAXATION); + BIND_ENUM_CONSTANT(PARAM_MAX); } void ConeTwistJoint::set_param(Param p_param, float p_value) { @@ -773,26 +773,26 @@ void Generic6DOFJoint::_bind_methods() { ADD_PROPERTYI(PropertyInfo(Variant::REAL, "angular_motor_z/target_velocity"), "set_param_z", "get_param_z", PARAM_ANGULAR_MOTOR_TARGET_VELOCITY); ADD_PROPERTYI(PropertyInfo(Variant::REAL, "angular_motor_z/force_limit"), "set_param_z", "get_param_z", PARAM_ANGULAR_MOTOR_FORCE_LIMIT); - BIND_CONSTANT(PARAM_LINEAR_LOWER_LIMIT); - BIND_CONSTANT(PARAM_LINEAR_UPPER_LIMIT); - BIND_CONSTANT(PARAM_LINEAR_LIMIT_SOFTNESS); - BIND_CONSTANT(PARAM_LINEAR_RESTITUTION); - BIND_CONSTANT(PARAM_LINEAR_DAMPING); - BIND_CONSTANT(PARAM_ANGULAR_LOWER_LIMIT); - BIND_CONSTANT(PARAM_ANGULAR_UPPER_LIMIT); - BIND_CONSTANT(PARAM_ANGULAR_LIMIT_SOFTNESS); - BIND_CONSTANT(PARAM_ANGULAR_DAMPING); - BIND_CONSTANT(PARAM_ANGULAR_RESTITUTION); - BIND_CONSTANT(PARAM_ANGULAR_FORCE_LIMIT); - BIND_CONSTANT(PARAM_ANGULAR_ERP); - BIND_CONSTANT(PARAM_ANGULAR_MOTOR_TARGET_VELOCITY); - BIND_CONSTANT(PARAM_ANGULAR_MOTOR_FORCE_LIMIT); - BIND_CONSTANT(PARAM_MAX); - - BIND_CONSTANT(FLAG_ENABLE_LINEAR_LIMIT); - BIND_CONSTANT(FLAG_ENABLE_ANGULAR_LIMIT); - BIND_CONSTANT(FLAG_ENABLE_MOTOR); - BIND_CONSTANT(FLAG_MAX); + BIND_ENUM_CONSTANT(PARAM_LINEAR_LOWER_LIMIT); + BIND_ENUM_CONSTANT(PARAM_LINEAR_UPPER_LIMIT); + BIND_ENUM_CONSTANT(PARAM_LINEAR_LIMIT_SOFTNESS); + BIND_ENUM_CONSTANT(PARAM_LINEAR_RESTITUTION); + BIND_ENUM_CONSTANT(PARAM_LINEAR_DAMPING); + BIND_ENUM_CONSTANT(PARAM_ANGULAR_LOWER_LIMIT); + BIND_ENUM_CONSTANT(PARAM_ANGULAR_UPPER_LIMIT); + BIND_ENUM_CONSTANT(PARAM_ANGULAR_LIMIT_SOFTNESS); + BIND_ENUM_CONSTANT(PARAM_ANGULAR_DAMPING); + BIND_ENUM_CONSTANT(PARAM_ANGULAR_RESTITUTION); + BIND_ENUM_CONSTANT(PARAM_ANGULAR_FORCE_LIMIT); + BIND_ENUM_CONSTANT(PARAM_ANGULAR_ERP); + BIND_ENUM_CONSTANT(PARAM_ANGULAR_MOTOR_TARGET_VELOCITY); + BIND_ENUM_CONSTANT(PARAM_ANGULAR_MOTOR_FORCE_LIMIT); + BIND_ENUM_CONSTANT(PARAM_MAX); + + BIND_ENUM_CONSTANT(FLAG_ENABLE_LINEAR_LIMIT); + BIND_ENUM_CONSTANT(FLAG_ENABLE_ANGULAR_LIMIT); + BIND_ENUM_CONSTANT(FLAG_ENABLE_MOTOR); + BIND_ENUM_CONSTANT(FLAG_MAX); } void Generic6DOFJoint::set_param_x(Param p_param, float p_value) { diff --git a/scene/3d/ray_cast.cpp b/scene/3d/ray_cast.cpp index 67e7fb0e12..b0aab6cc4d 100644 --- a/scene/3d/ray_cast.cpp +++ b/scene/3d/ray_cast.cpp @@ -30,12 +30,14 @@ #include "ray_cast.h" #include "collision_object.h" +#include "engine.h" #include "mesh_instance.h" #include "servers/physics_server.h" + void RayCast::set_cast_to(const Vector3 &p_point) { cast_to = p_point; - if (is_inside_tree() && (get_tree()->is_editor_hint() || get_tree()->is_debugging_collisions_hint())) + if (is_inside_tree() && (Engine::get_singleton()->is_editor_hint() || get_tree()->is_debugging_collisions_hint())) update_gizmo(); if (is_inside_tree() && get_tree()->is_debugging_collisions_hint()) _update_debug_shape(); @@ -94,7 +96,7 @@ Vector3 RayCast::get_collision_normal() const { void RayCast::set_enabled(bool p_enabled) { enabled = p_enabled; - if (is_inside_tree() && !get_tree()->is_editor_hint()) + if (is_inside_tree() && !Engine::get_singleton()->is_editor_hint()) set_fixed_process(p_enabled); if (!p_enabled) collided = false; @@ -118,7 +120,7 @@ void RayCast::_notification(int p_what) { case NOTIFICATION_ENTER_TREE: { - if (enabled && !get_tree()->is_editor_hint()) { + if (enabled && !Engine::get_singleton()->is_editor_hint()) { set_fixed_process(true); if (get_tree()->is_debugging_collisions_hint()) diff --git a/scene/3d/reflection_probe.cpp b/scene/3d/reflection_probe.cpp index 0dc5b58e45..194146b6b3 100644 --- a/scene/3d/reflection_probe.cpp +++ b/scene/3d/reflection_probe.cpp @@ -252,8 +252,8 @@ void ReflectionProbe::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::REAL, "interior_ambient_energy", PROPERTY_HINT_RANGE, "0,16,0.01"), "set_interior_ambient_energy", "get_interior_ambient_energy"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "interior_ambient_contrib", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_interior_ambient_probe_contribution", "get_interior_ambient_probe_contribution"); - BIND_CONSTANT(UPDATE_ONCE); - BIND_CONSTANT(UPDATE_ALWAYS); + BIND_ENUM_CONSTANT(UPDATE_ONCE); + BIND_ENUM_CONSTANT(UPDATE_ALWAYS); } ReflectionProbe::ReflectionProbe() { diff --git a/scene/3d/spatial.cpp b/scene/3d/spatial.cpp index 848b08eb8f..6498238e12 100644 --- a/scene/3d/spatial.cpp +++ b/scene/3d/spatial.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "spatial.h" +#include "engine.h" #include "message_queue.h" #include "scene/main/viewport.h" #include "scene/scene_string_names.h" @@ -134,7 +135,7 @@ void Spatial::_notification(int p_what) { else data.C = NULL; - if (data.toplevel && !get_tree()->is_editor_hint()) { + if (data.toplevel && !Engine::get_singleton()->is_editor_hint()) { if (data.parent) { data.local_transform = data.parent->get_global_transform() * get_transform(); @@ -178,7 +179,7 @@ void Spatial::_notification(int p_what) { get_script_instance()->call_multilevel(SceneStringNames::get_singleton()->_enter_world, NULL, 0); } #ifdef TOOLS_ENABLED - if (get_tree()->is_editor_hint()) { + if (Engine::get_singleton()->is_editor_hint()) { //get_scene()->call_group(SceneMainLoop::GROUP_CALL_REALTIME,SceneStringNames::get_singleton()->_spatial_editor_group,SceneStringNames::get_singleton()->_request_gizmo,this); get_tree()->call_group_flags(0, SceneStringNames::get_singleton()->_spatial_editor_group, SceneStringNames::get_singleton()->_request_gizmo, this); @@ -492,7 +493,7 @@ void Spatial::set_as_toplevel(bool p_enabled) { if (data.toplevel == p_enabled) return; - if (is_inside_tree() && !get_tree()->is_editor_hint()) { + if (is_inside_tree() && !Engine::get_singleton()->is_editor_hint()) { if (p_enabled) set_transform(get_global_transform()); diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp index 978662f7dc..e45cb6d5b9 100644 --- a/scene/3d/sprite_3d.cpp +++ b/scene/3d/sprite_3d.cpp @@ -276,14 +276,14 @@ void SpriteBase3D::_bind_methods() { ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "double_sided"), "set_draw_flag", "get_draw_flag", FLAG_DOUBLE_SIDED); ADD_PROPERTY(PropertyInfo(Variant::INT, "alpha_cut", PROPERTY_HINT_ENUM, "Disabled,Discard,Opaque Pre-Pass"), "set_alpha_cut_mode", "get_alpha_cut_mode"); - BIND_CONSTANT(FLAG_TRANSPARENT); - BIND_CONSTANT(FLAG_SHADED); - BIND_CONSTANT(FLAG_DOUBLE_SIDED); - BIND_CONSTANT(FLAG_MAX); - - BIND_CONSTANT(ALPHA_CUT_DISABLED); - BIND_CONSTANT(ALPHA_CUT_DISCARD); - BIND_CONSTANT(ALPHA_CUT_OPAQUE_PREPASS); + BIND_ENUM_CONSTANT(FLAG_TRANSPARENT); + BIND_ENUM_CONSTANT(FLAG_SHADED); + BIND_ENUM_CONSTANT(FLAG_DOUBLE_SIDED); + BIND_ENUM_CONSTANT(FLAG_MAX); + + BIND_ENUM_CONSTANT(ALPHA_CUT_DISABLED); + BIND_ENUM_CONSTANT(ALPHA_CUT_DISCARD); + BIND_ENUM_CONSTANT(ALPHA_CUT_OPAQUE_PREPASS); } SpriteBase3D::SpriteBase3D() { diff --git a/scene/3d/vehicle_body.cpp b/scene/3d/vehicle_body.cpp index adf235c525..2a41c8f30e 100644 --- a/scene/3d/vehicle_body.cpp +++ b/scene/3d/vehicle_body.cpp @@ -559,6 +559,9 @@ void VehicleBody::_resolve_single_bilateral(PhysicsDirectBodyState *s, const Vec b2invinertia, b2invmass); + // FIXME: rel_vel assignment here is overwritten by the following assignment. + // What seemes to be intented in the next next assignment is: rel_vel = normal.dot(rel_vel); + // Investigate why. real_t rel_vel = jac.getRelativeVelocity( s->get_linear_velocity(), s->get_transform().basis.transposed().xform(s->get_angular_velocity()), diff --git a/scene/3d/visibility_notifier.cpp b/scene/3d/visibility_notifier.cpp index cc81a4cb56..0b77968dca 100644 --- a/scene/3d/visibility_notifier.cpp +++ b/scene/3d/visibility_notifier.cpp @@ -29,11 +29,11 @@ /*************************************************************************/ #include "visibility_notifier.h" +#include "engine.h" #include "scene/3d/camera.h" #include "scene/3d/physics_body.h" #include "scene/animation/animation_player.h" #include "scene/scene_string_names.h" -#include "scene/scene_string_names.h" void VisibilityNotifier::_enter_camera(Camera *p_camera) { @@ -187,7 +187,7 @@ void VisibilityEnabler::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { - if (get_tree()->is_editor_hint()) + if (Engine::get_singleton()->is_editor_hint()) return; Node *from = this; @@ -200,7 +200,7 @@ void VisibilityEnabler::_notification(int p_what) { if (p_what == NOTIFICATION_EXIT_TREE) { - if (get_tree()->is_editor_hint()) + if (Engine::get_singleton()->is_editor_hint()) return; for (Map<Node *, Variant>::Element *E = nodes.front(); E; E = E->next()) { @@ -252,9 +252,9 @@ void VisibilityEnabler::_bind_methods() { ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "pause_animations"), "set_enabler", "is_enabler_enabled", ENABLER_PAUSE_ANIMATIONS); ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "freeze_bodies"), "set_enabler", "is_enabler_enabled", ENABLER_FREEZE_BODIES); - BIND_CONSTANT(ENABLER_FREEZE_BODIES); - BIND_CONSTANT(ENABLER_PAUSE_ANIMATIONS); - BIND_CONSTANT(ENABLER_MAX); + BIND_ENUM_CONSTANT(ENABLER_FREEZE_BODIES); + BIND_ENUM_CONSTANT(ENABLER_PAUSE_ANIMATIONS); + BIND_ENUM_CONSTANT(ENABLER_MAX); } void VisibilityEnabler::set_enabler(Enabler p_enabler, bool p_enable) { diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp index e2a0636466..3acb11541f 100644 --- a/scene/animation/animation_player.cpp +++ b/scene/animation/animation_player.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "animation_player.h" +#include "engine.h" #include "message_queue.h" #include "scene/scene_string_names.h" @@ -199,7 +200,7 @@ void AnimationPlayer::_notification(int p_what) { } break; case NOTIFICATION_READY: { - if (!get_tree()->is_editor_hint() && animation_set.has(autoplay)) { + if (!Engine::get_singleton()->is_editor_hint() && animation_set.has(autoplay)) { play(autoplay); set_autoplay(""); //this line is the fix for autoplay issues with animatio _animation_process(0); @@ -344,7 +345,7 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, float ERR_FAIL_COND(p_anim->node_cache.size() != p_anim->animation->get_track_count()); Animation *a = p_anim->animation.operator->(); - bool can_call = is_inside_tree() && !get_tree()->is_editor_hint(); + bool can_call = is_inside_tree() && !Engine::get_singleton()->is_editor_hint(); for (int i = 0; i < a->get_track_count(); i++) { @@ -955,7 +956,7 @@ void AnimationPlayer::play(const StringName &p_name, float p_custom_blend, float emit_signal(SceneStringNames::get_singleton()->animation_started, c.assigned); - if (is_inside_tree() && get_tree()->is_editor_hint()) + if (is_inside_tree() && Engine::get_singleton()->is_editor_hint()) return; // no next in this case StringName next = animation_get_next(p_name); @@ -1277,8 +1278,8 @@ void AnimationPlayer::_bind_methods() { ADD_SIGNAL(MethodInfo("animation_changed", PropertyInfo(Variant::STRING, "old_name"), PropertyInfo(Variant::STRING, "new_name"))); ADD_SIGNAL(MethodInfo("animation_started", PropertyInfo(Variant::STRING, "name"))); - BIND_CONSTANT(ANIMATION_PROCESS_FIXED); - BIND_CONSTANT(ANIMATION_PROCESS_IDLE); + BIND_ENUM_CONSTANT(ANIMATION_PROCESS_FIXED); + BIND_ENUM_CONSTANT(ANIMATION_PROCESS_IDLE); } AnimationPlayer::AnimationPlayer() { diff --git a/scene/animation/animation_tree_player.cpp b/scene/animation/animation_tree_player.cpp index c12e97c4a5..fd8b33e666 100644 --- a/scene/animation/animation_tree_player.cpp +++ b/scene/animation/animation_tree_player.cpp @@ -1797,16 +1797,16 @@ void AnimationTreePlayer::_bind_methods() { ADD_GROUP("Playback", "playback_"); ADD_PROPERTY(PropertyInfo(Variant::INT, "playback_process_mode", PROPERTY_HINT_ENUM, "Fixed,Idle"), "set_animation_process_mode", "get_animation_process_mode"); - BIND_CONSTANT(NODE_OUTPUT); - BIND_CONSTANT(NODE_ANIMATION); - BIND_CONSTANT(NODE_ONESHOT); - BIND_CONSTANT(NODE_MIX); - BIND_CONSTANT(NODE_BLEND2); - BIND_CONSTANT(NODE_BLEND3); - BIND_CONSTANT(NODE_BLEND4); - BIND_CONSTANT(NODE_TIMESCALE); - BIND_CONSTANT(NODE_TIMESEEK); - BIND_CONSTANT(NODE_TRANSITION); + BIND_ENUM_CONSTANT(NODE_OUTPUT); + BIND_ENUM_CONSTANT(NODE_ANIMATION); + BIND_ENUM_CONSTANT(NODE_ONESHOT); + BIND_ENUM_CONSTANT(NODE_MIX); + BIND_ENUM_CONSTANT(NODE_BLEND2); + BIND_ENUM_CONSTANT(NODE_BLEND3); + BIND_ENUM_CONSTANT(NODE_BLEND4); + BIND_ENUM_CONSTANT(NODE_TIMESCALE); + BIND_ENUM_CONSTANT(NODE_TIMESEEK); + BIND_ENUM_CONSTANT(NODE_TRANSITION); } AnimationTreePlayer::AnimationTreePlayer() { diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp index 78d3357bb4..45994ba050 100644 --- a/scene/animation/tween.cpp +++ b/scene/animation/tween.cpp @@ -224,25 +224,25 @@ void Tween::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "playback_process_mode", PROPERTY_HINT_ENUM, "Fixed,Idle"), "set_tween_process_mode", "get_tween_process_mode"); - BIND_CONSTANT(TWEEN_PROCESS_FIXED); - BIND_CONSTANT(TWEEN_PROCESS_IDLE); - - BIND_CONSTANT(TRANS_LINEAR); - BIND_CONSTANT(TRANS_SINE); - BIND_CONSTANT(TRANS_QUINT); - BIND_CONSTANT(TRANS_QUART); - BIND_CONSTANT(TRANS_QUAD); - BIND_CONSTANT(TRANS_EXPO); - BIND_CONSTANT(TRANS_ELASTIC); - BIND_CONSTANT(TRANS_CUBIC); - BIND_CONSTANT(TRANS_CIRC); - BIND_CONSTANT(TRANS_BOUNCE); - BIND_CONSTANT(TRANS_BACK); - - BIND_CONSTANT(EASE_IN); - BIND_CONSTANT(EASE_OUT); - BIND_CONSTANT(EASE_IN_OUT); - BIND_CONSTANT(EASE_OUT_IN); + BIND_ENUM_CONSTANT(TWEEN_PROCESS_FIXED); + BIND_ENUM_CONSTANT(TWEEN_PROCESS_IDLE); + + BIND_ENUM_CONSTANT(TRANS_LINEAR); + BIND_ENUM_CONSTANT(TRANS_SINE); + BIND_ENUM_CONSTANT(TRANS_QUINT); + BIND_ENUM_CONSTANT(TRANS_QUART); + BIND_ENUM_CONSTANT(TRANS_QUAD); + BIND_ENUM_CONSTANT(TRANS_EXPO); + BIND_ENUM_CONSTANT(TRANS_ELASTIC); + BIND_ENUM_CONSTANT(TRANS_CUBIC); + BIND_ENUM_CONSTANT(TRANS_CIRC); + BIND_ENUM_CONSTANT(TRANS_BOUNCE); + BIND_ENUM_CONSTANT(TRANS_BACK); + + BIND_ENUM_CONSTANT(EASE_IN); + BIND_ENUM_CONSTANT(EASE_OUT); + BIND_ENUM_CONSTANT(EASE_IN_OUT); + BIND_ENUM_CONSTANT(EASE_OUT_IN); } Variant &Tween::_get_initial_val(InterpolateData &p_data) { diff --git a/scene/audio/audio_player.cpp b/scene/audio/audio_player.cpp index a8ddcbbb45..d4d8f7dbed 100644 --- a/scene/audio/audio_player.cpp +++ b/scene/audio/audio_player.cpp @@ -29,6 +29,8 @@ /*************************************************************************/ #include "audio_player.h" +#include "engine.h" + void AudioStreamPlayer::_mix_audio() { if (!stream_playback.is_valid()) { @@ -100,7 +102,7 @@ void AudioStreamPlayer::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { AudioServer::get_singleton()->add_callback(_mix_audios, this); - if (autoplay && !get_tree()->is_editor_hint()) { + if (autoplay && !Engine::get_singleton()->is_editor_hint()) { play(); } } diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp index 9c20decef0..9054063a4b 100644 --- a/scene/gui/base_button.cpp +++ b/scene/gui/base_button.cpp @@ -514,13 +514,13 @@ void BaseButton::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "shortcut", PROPERTY_HINT_RESOURCE_TYPE, "ShortCut"), "set_shortcut", "get_shortcut"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "group", PROPERTY_HINT_RESOURCE_TYPE, "ButtonGroup"), "set_button_group", "get_button_group"); - BIND_CONSTANT(DRAW_NORMAL); - BIND_CONSTANT(DRAW_PRESSED); - BIND_CONSTANT(DRAW_HOVER); - BIND_CONSTANT(DRAW_DISABLED); + BIND_ENUM_CONSTANT(DRAW_NORMAL); + BIND_ENUM_CONSTANT(DRAW_PRESSED); + BIND_ENUM_CONSTANT(DRAW_HOVER); + BIND_ENUM_CONSTANT(DRAW_DISABLED); - BIND_CONSTANT(ACTION_MODE_BUTTON_PRESS); - BIND_CONSTANT(ACTION_MODE_BUTTON_RELEASE); + BIND_ENUM_CONSTANT(ACTION_MODE_BUTTON_PRESS); + BIND_ENUM_CONSTANT(ACTION_MODE_BUTTON_RELEASE); } BaseButton::BaseButton() { diff --git a/scene/gui/box_container.cpp b/scene/gui/box_container.cpp index 16b2cfa083..2cc4be96a7 100644 --- a/scene/gui/box_container.cpp +++ b/scene/gui/box_container.cpp @@ -295,9 +295,9 @@ void BoxContainer::_bind_methods() { ClassDB::bind_method(D_METHOD("get_alignment"), &BoxContainer::get_alignment); ClassDB::bind_method(D_METHOD("set_alignment", "alignment"), &BoxContainer::set_alignment); - BIND_CONSTANT(ALIGN_BEGIN); - BIND_CONSTANT(ALIGN_CENTER); - BIND_CONSTANT(ALIGN_END); + BIND_ENUM_CONSTANT(ALIGN_BEGIN); + BIND_ENUM_CONSTANT(ALIGN_CENTER); + BIND_ENUM_CONSTANT(ALIGN_END); ADD_PROPERTY(PropertyInfo(Variant::INT, "alignment", PROPERTY_HINT_ENUM, "Begin,Center,End"), "set_alignment", "get_alignment"); } diff --git a/scene/gui/button.cpp b/scene/gui/button.cpp index 5036e4f7f6..c8838f3eca 100644 --- a/scene/gui/button.cpp +++ b/scene/gui/button.cpp @@ -245,9 +245,9 @@ void Button::_bind_methods() { ClassDB::bind_method(D_METHOD("get_text_align"), &Button::get_text_align); ClassDB::bind_method(D_METHOD("is_flat"), &Button::is_flat); - BIND_CONSTANT(ALIGN_LEFT); - BIND_CONSTANT(ALIGN_CENTER); - BIND_CONSTANT(ALIGN_RIGHT); + BIND_ENUM_CONSTANT(ALIGN_LEFT); + BIND_ENUM_CONSTANT(ALIGN_CENTER); + BIND_ENUM_CONSTANT(ALIGN_RIGHT); ADD_PROPERTYNZ(PropertyInfo(Variant::STRING, "text", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT_INTL), "set_text", "get_text"); ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT, "icon", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), "set_button_icon", "get_button_icon"); diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp index 5e110362c8..5257f9df35 100644 --- a/scene/gui/color_picker.cpp +++ b/scene/gui/color_picker.cpp @@ -204,7 +204,7 @@ void ColorPicker::_update_presets() { } void ColorPicker::_text_type_toggled() { - if (!get_tree()->is_editor_hint()) + if (!Engine::get_singleton()->is_editor_hint()) return; text_is_constructor = !text_is_constructor; if (text_is_constructor) { diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index c97426ad42..6a3ef66e0a 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -1329,7 +1329,7 @@ void Control::set_anchor(Margin p_margin, float p_anchor, bool p_keep_margin, bo void Control::_set_anchor(Margin p_margin, float p_anchor) { #ifdef TOOLS_ENABLED - if (is_inside_tree() && get_tree()->is_editor_hint()) { + if (is_inside_tree() && Engine::get_singleton()->is_editor_hint()) { set_anchor(p_margin, p_anchor, EDITOR_DEF("editors/2d/keep_margins_when_changing_anchors", false)); } else { set_anchor(p_margin, p_anchor, false); @@ -2634,9 +2634,9 @@ void Control::_bind_methods() { ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT, "theme", PROPERTY_HINT_RESOURCE_TYPE, "Theme"), "set_theme", "get_theme"); ADD_GROUP("", ""); - BIND_CONSTANT(FOCUS_NONE); - BIND_CONSTANT(FOCUS_CLICK); - BIND_CONSTANT(FOCUS_ALL); + BIND_ENUM_CONSTANT(FOCUS_NONE); + BIND_ENUM_CONSTANT(FOCUS_CLICK); + BIND_ENUM_CONSTANT(FOCUS_ALL); BIND_CONSTANT(NOTIFICATION_RESIZED); BIND_CONSTANT(NOTIFICATION_MOUSE_ENTER); @@ -2646,56 +2646,56 @@ void Control::_bind_methods() { BIND_CONSTANT(NOTIFICATION_THEME_CHANGED); BIND_CONSTANT(NOTIFICATION_MODAL_CLOSE); - BIND_CONSTANT(CURSOR_ARROW); - BIND_CONSTANT(CURSOR_IBEAM); - BIND_CONSTANT(CURSOR_POINTING_HAND); - BIND_CONSTANT(CURSOR_CROSS); - BIND_CONSTANT(CURSOR_WAIT); - BIND_CONSTANT(CURSOR_BUSY); - BIND_CONSTANT(CURSOR_DRAG); - BIND_CONSTANT(CURSOR_CAN_DROP); - BIND_CONSTANT(CURSOR_FORBIDDEN); - BIND_CONSTANT(CURSOR_VSIZE); - BIND_CONSTANT(CURSOR_HSIZE); - BIND_CONSTANT(CURSOR_BDIAGSIZE); - BIND_CONSTANT(CURSOR_FDIAGSIZE); - BIND_CONSTANT(CURSOR_MOVE); - BIND_CONSTANT(CURSOR_VSPLIT); - BIND_CONSTANT(CURSOR_HSPLIT); - BIND_CONSTANT(CURSOR_HELP); - - BIND_CONSTANT(PRESET_TOP_LEFT); - BIND_CONSTANT(PRESET_TOP_RIGHT); - BIND_CONSTANT(PRESET_BOTTOM_LEFT); - BIND_CONSTANT(PRESET_BOTTOM_RIGHT); - BIND_CONSTANT(PRESET_CENTER_LEFT); - BIND_CONSTANT(PRESET_CENTER_TOP); - BIND_CONSTANT(PRESET_CENTER_RIGHT); - BIND_CONSTANT(PRESET_CENTER_BOTTOM); - BIND_CONSTANT(PRESET_CENTER); - BIND_CONSTANT(PRESET_LEFT_WIDE); - BIND_CONSTANT(PRESET_TOP_WIDE); - BIND_CONSTANT(PRESET_RIGHT_WIDE); - BIND_CONSTANT(PRESET_BOTTOM_WIDE); - BIND_CONSTANT(PRESET_VCENTER_WIDE); - BIND_CONSTANT(PRESET_HCENTER_WIDE); - BIND_CONSTANT(PRESET_WIDE); - - BIND_CONSTANT(SIZE_EXPAND); - BIND_CONSTANT(SIZE_FILL); - BIND_CONSTANT(SIZE_EXPAND_FILL); - BIND_CONSTANT(SIZE_SHRINK_CENTER); - BIND_CONSTANT(SIZE_SHRINK_END); - - BIND_CONSTANT(MOUSE_FILTER_STOP); - BIND_CONSTANT(MOUSE_FILTER_PASS); - BIND_CONSTANT(MOUSE_FILTER_IGNORE); - - BIND_CONSTANT(GROW_DIRECTION_BEGIN); - BIND_CONSTANT(GROW_DIRECTION_END); - - BIND_CONSTANT(ANCHOR_BEGIN); - BIND_CONSTANT(ANCHOR_END); + BIND_ENUM_CONSTANT(CURSOR_ARROW); + BIND_ENUM_CONSTANT(CURSOR_IBEAM); + BIND_ENUM_CONSTANT(CURSOR_POINTING_HAND); + BIND_ENUM_CONSTANT(CURSOR_CROSS); + BIND_ENUM_CONSTANT(CURSOR_WAIT); + BIND_ENUM_CONSTANT(CURSOR_BUSY); + BIND_ENUM_CONSTANT(CURSOR_DRAG); + BIND_ENUM_CONSTANT(CURSOR_CAN_DROP); + BIND_ENUM_CONSTANT(CURSOR_FORBIDDEN); + BIND_ENUM_CONSTANT(CURSOR_VSIZE); + BIND_ENUM_CONSTANT(CURSOR_HSIZE); + BIND_ENUM_CONSTANT(CURSOR_BDIAGSIZE); + BIND_ENUM_CONSTANT(CURSOR_FDIAGSIZE); + BIND_ENUM_CONSTANT(CURSOR_MOVE); + BIND_ENUM_CONSTANT(CURSOR_VSPLIT); + BIND_ENUM_CONSTANT(CURSOR_HSPLIT); + BIND_ENUM_CONSTANT(CURSOR_HELP); + + BIND_ENUM_CONSTANT(PRESET_TOP_LEFT); + BIND_ENUM_CONSTANT(PRESET_TOP_RIGHT); + BIND_ENUM_CONSTANT(PRESET_BOTTOM_LEFT); + BIND_ENUM_CONSTANT(PRESET_BOTTOM_RIGHT); + BIND_ENUM_CONSTANT(PRESET_CENTER_LEFT); + BIND_ENUM_CONSTANT(PRESET_CENTER_TOP); + BIND_ENUM_CONSTANT(PRESET_CENTER_RIGHT); + BIND_ENUM_CONSTANT(PRESET_CENTER_BOTTOM); + BIND_ENUM_CONSTANT(PRESET_CENTER); + BIND_ENUM_CONSTANT(PRESET_LEFT_WIDE); + BIND_ENUM_CONSTANT(PRESET_TOP_WIDE); + BIND_ENUM_CONSTANT(PRESET_RIGHT_WIDE); + BIND_ENUM_CONSTANT(PRESET_BOTTOM_WIDE); + BIND_ENUM_CONSTANT(PRESET_VCENTER_WIDE); + BIND_ENUM_CONSTANT(PRESET_HCENTER_WIDE); + BIND_ENUM_CONSTANT(PRESET_WIDE); + + BIND_ENUM_CONSTANT(SIZE_EXPAND); + BIND_ENUM_CONSTANT(SIZE_FILL); + BIND_ENUM_CONSTANT(SIZE_EXPAND_FILL); + BIND_ENUM_CONSTANT(SIZE_SHRINK_CENTER); + BIND_ENUM_CONSTANT(SIZE_SHRINK_END); + + BIND_ENUM_CONSTANT(MOUSE_FILTER_STOP); + BIND_ENUM_CONSTANT(MOUSE_FILTER_PASS); + BIND_ENUM_CONSTANT(MOUSE_FILTER_IGNORE); + + BIND_ENUM_CONSTANT(GROW_DIRECTION_BEGIN); + BIND_ENUM_CONSTANT(GROW_DIRECTION_END); + + BIND_ENUM_CONSTANT(ANCHOR_BEGIN); + BIND_ENUM_CONSTANT(ANCHOR_END); ADD_SIGNAL(MethodInfo("resized")); ADD_SIGNAL(MethodInfo("gui_input", PropertyInfo(Variant::OBJECT, "ev", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent"))); diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp index ef8b0adfa9..b911a18312 100644 --- a/scene/gui/dialogs.cpp +++ b/scene/gui/dialogs.cpp @@ -227,11 +227,11 @@ void WindowDialog::_notification(int p_what) { } break; #ifdef TOOLS_ENABLED case NOTIFICATION_POST_POPUP: { - if (get_tree() && get_tree()->is_editor_hint() && EditorNode::get_singleton()) + if (get_tree() && Engine::get_singleton()->is_editor_hint() && EditorNode::get_singleton()) EditorNode::get_singleton()->dim_editor(true); } break; case NOTIFICATION_POPUP_HIDE: { - if (get_tree() && get_tree()->is_editor_hint() && EditorNode::get_singleton()) + if (get_tree() && Engine::get_singleton()->is_editor_hint() && EditorNode::get_singleton()) EditorNode::get_singleton()->dim_editor(false); } break; #endif diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp index b3530c2971..0b898c4d2e 100644 --- a/scene/gui/file_dialog.cpp +++ b/scene/gui/file_dialog.cpp @@ -718,16 +718,15 @@ void FileDialog::_bind_methods() { ADD_SIGNAL(MethodInfo("files_selected", PropertyInfo(Variant::POOL_STRING_ARRAY, "paths"))); ADD_SIGNAL(MethodInfo("dir_selected", PropertyInfo(Variant::STRING, "dir"))); - BIND_CONSTANT(MODE_OPEN_FILE); - BIND_CONSTANT(MODE_OPEN_FILES); - BIND_CONSTANT(MODE_OPEN_DIR); - BIND_CONSTANT(MODE_OPEN_ANY); - - BIND_CONSTANT(MODE_SAVE_FILE); - - BIND_CONSTANT(ACCESS_RESOURCES); - BIND_CONSTANT(ACCESS_USERDATA); - BIND_CONSTANT(ACCESS_FILESYSTEM); + BIND_ENUM_CONSTANT(MODE_OPEN_FILE); + BIND_ENUM_CONSTANT(MODE_OPEN_FILES); + BIND_ENUM_CONSTANT(MODE_OPEN_DIR); + BIND_ENUM_CONSTANT(MODE_OPEN_ANY); + BIND_ENUM_CONSTANT(MODE_SAVE_FILE); + + BIND_ENUM_CONSTANT(ACCESS_RESOURCES); + BIND_ENUM_CONSTANT(ACCESS_USERDATA); + BIND_ENUM_CONSTANT(ACCESS_FILESYSTEM); ADD_PROPERTY(PropertyInfo(Variant::INT, "mode", PROPERTY_HINT_ENUM, "Open one,Open many,Open folder,Open any,Save"), "set_mode", "get_mode"); ADD_PROPERTY(PropertyInfo(Variant::INT, "access", PROPERTY_HINT_ENUM, "Resources,User data,File system"), "set_access", "get_access"); diff --git a/scene/gui/graph_node.cpp b/scene/gui/graph_node.cpp index b9062295b5..4b4ecc5e98 100644 --- a/scene/gui/graph_node.cpp +++ b/scene/gui/graph_node.cpp @@ -710,9 +710,9 @@ void GraphNode::_bind_methods() { ADD_SIGNAL(MethodInfo("close_request")); ADD_SIGNAL(MethodInfo("resize_request", PropertyInfo(Variant::VECTOR2, "new_minsize"))); - BIND_CONSTANT(OVERLAY_DISABLED); - BIND_CONSTANT(OVERLAY_BREAKPOINT); - BIND_CONSTANT(OVERLAY_POSITION); + BIND_ENUM_CONSTANT(OVERLAY_DISABLED); + BIND_ENUM_CONSTANT(OVERLAY_BREAKPOINT); + BIND_ENUM_CONSTANT(OVERLAY_POSITION); } GraphNode::GraphNode() { diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp index b30a6000ff..c7889a6cf2 100644 --- a/scene/gui/item_list.cpp +++ b/scene/gui/item_list.cpp @@ -1374,10 +1374,11 @@ void ItemList::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "icon_mode", PROPERTY_HINT_ENUM, "Top,Left"), "set_icon_mode", "get_icon_mode"); ADD_PROPERTYNO(PropertyInfo(Variant::REAL, "icon_scale"), "set_icon_scale", "get_icon_scale"); - BIND_CONSTANT(ICON_MODE_TOP); - BIND_CONSTANT(ICON_MODE_LEFT); - BIND_CONSTANT(SELECT_SINGLE); - BIND_CONSTANT(SELECT_MULTI); + BIND_ENUM_CONSTANT(ICON_MODE_TOP); + BIND_ENUM_CONSTANT(ICON_MODE_LEFT); + + BIND_ENUM_CONSTANT(SELECT_SINGLE); + BIND_ENUM_CONSTANT(SELECT_MULTI); ADD_SIGNAL(MethodInfo("item_selected", PropertyInfo(Variant::INT, "index"))); ADD_SIGNAL(MethodInfo("item_rmb_selected", PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::VECTOR2, "atpos"))); diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp index 84074f96a8..cf7303cbe7 100644 --- a/scene/gui/label.cpp +++ b/scene/gui/label.cpp @@ -644,15 +644,15 @@ void Label::_bind_methods() { ClassDB::bind_method(D_METHOD("set_max_lines_visible", "lines_visible"), &Label::set_max_lines_visible); ClassDB::bind_method(D_METHOD("get_max_lines_visible"), &Label::get_max_lines_visible); - BIND_CONSTANT(ALIGN_LEFT); - BIND_CONSTANT(ALIGN_CENTER); - BIND_CONSTANT(ALIGN_RIGHT); - BIND_CONSTANT(ALIGN_FILL); - - BIND_CONSTANT(VALIGN_TOP); - BIND_CONSTANT(VALIGN_CENTER); - BIND_CONSTANT(VALIGN_BOTTOM); - BIND_CONSTANT(VALIGN_FILL); + BIND_ENUM_CONSTANT(ALIGN_LEFT); + BIND_ENUM_CONSTANT(ALIGN_CENTER); + BIND_ENUM_CONSTANT(ALIGN_RIGHT); + BIND_ENUM_CONSTANT(ALIGN_FILL); + + BIND_ENUM_CONSTANT(VALIGN_TOP); + BIND_ENUM_CONSTANT(VALIGN_CENTER); + BIND_ENUM_CONSTANT(VALIGN_BOTTOM); + BIND_ENUM_CONSTANT(VALIGN_FILL); ADD_PROPERTYNZ(PropertyInfo(Variant::STRING, "text", PROPERTY_HINT_MULTILINE_TEXT, "", PROPERTY_USAGE_DEFAULT_INTL), "set_text", "get_text"); ADD_PROPERTYNZ(PropertyInfo(Variant::INT, "align", PROPERTY_HINT_ENUM, "Left,Center,Right,Fill"), "set_align", "get_align"); diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index e91f8add31..c5360b0df0 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -534,7 +534,7 @@ void LineEdit::_notification(int p_what) { switch (p_what) { #ifdef TOOLS_ENABLED case NOTIFICATION_ENTER_TREE: { - if (get_tree()->is_editor_hint()) { + if (Engine::get_singleton()->is_editor_hint()) { cursor_set_blink_enabled(EDITOR_DEF("text_editor/cursor/caret_blink", false)); cursor_set_blink_speed(EDITOR_DEF("text_editor/cursor/caret_blink_speed", 0.65)); @@ -1352,18 +1352,18 @@ void LineEdit::_bind_methods() { ADD_SIGNAL(MethodInfo("text_changed", PropertyInfo(Variant::STRING, "text"))); ADD_SIGNAL(MethodInfo("text_entered", PropertyInfo(Variant::STRING, "text"))); - BIND_CONSTANT(ALIGN_LEFT); - BIND_CONSTANT(ALIGN_CENTER); - BIND_CONSTANT(ALIGN_RIGHT); - BIND_CONSTANT(ALIGN_FILL); - - BIND_CONSTANT(MENU_CUT); - BIND_CONSTANT(MENU_COPY); - BIND_CONSTANT(MENU_PASTE); - BIND_CONSTANT(MENU_CLEAR); - BIND_CONSTANT(MENU_SELECT_ALL); - BIND_CONSTANT(MENU_UNDO); - BIND_CONSTANT(MENU_MAX); + BIND_ENUM_CONSTANT(ALIGN_LEFT); + BIND_ENUM_CONSTANT(ALIGN_CENTER); + BIND_ENUM_CONSTANT(ALIGN_RIGHT); + BIND_ENUM_CONSTANT(ALIGN_FILL); + + BIND_ENUM_CONSTANT(MENU_CUT); + BIND_ENUM_CONSTANT(MENU_COPY); + BIND_ENUM_CONSTANT(MENU_PASTE); + BIND_ENUM_CONSTANT(MENU_CLEAR); + BIND_ENUM_CONSTANT(MENU_SELECT_ALL); + BIND_ENUM_CONSTANT(MENU_UNDO); + BIND_ENUM_CONSTANT(MENU_MAX); ADD_PROPERTYNZ(PropertyInfo(Variant::STRING, "text"), "set_text", "get_text"); ADD_PROPERTYNZ(PropertyInfo(Variant::INT, "align", PROPERTY_HINT_ENUM, "Left,Center,Right,Fill"), "set_align", "get_align"); diff --git a/scene/gui/line_edit.h b/scene/gui/line_edit.h index fb0eaa9446..7d04e4618b 100644 --- a/scene/gui/line_edit.h +++ b/scene/gui/line_edit.h @@ -186,5 +186,6 @@ public: }; VARIANT_ENUM_CAST(LineEdit::Align); +VARIANT_ENUM_CAST(LineEdit::MenuItems); #endif diff --git a/scene/gui/link_button.cpp b/scene/gui/link_button.cpp index 9cb67b75e2..632e9ec4fc 100644 --- a/scene/gui/link_button.cpp +++ b/scene/gui/link_button.cpp @@ -130,9 +130,9 @@ void LinkButton::_bind_methods() { ClassDB::bind_method(D_METHOD("set_underline_mode", "underline_mode"), &LinkButton::set_underline_mode); ClassDB::bind_method(D_METHOD("get_underline_mode"), &LinkButton::get_underline_mode); - BIND_CONSTANT(UNDERLINE_MODE_ALWAYS); - BIND_CONSTANT(UNDERLINE_MODE_ON_HOVER); - BIND_CONSTANT(UNDERLINE_MODE_NEVER); + BIND_ENUM_CONSTANT(UNDERLINE_MODE_ALWAYS); + BIND_ENUM_CONSTANT(UNDERLINE_MODE_ON_HOVER); + BIND_ENUM_CONSTANT(UNDERLINE_MODE_NEVER); ADD_PROPERTYNZ(PropertyInfo(Variant::STRING, "text"), "set_text", "get_text"); ADD_PROPERTYNZ(PropertyInfo(Variant::INT, "underline", PROPERTY_HINT_ENUM, "Always,On Hover,Never"), "set_underline_mode", "get_underline_mode"); diff --git a/scene/gui/patch_9_rect.cpp b/scene/gui/patch_9_rect.cpp index 249090830d..71cbef495c 100644 --- a/scene/gui/patch_9_rect.cpp +++ b/scene/gui/patch_9_rect.cpp @@ -82,9 +82,9 @@ void NinePatchRect::_bind_methods() { ADD_PROPERTYNZ(PropertyInfo(Variant::INT, "axis_stretch_horizontal", PROPERTY_HINT_ENUM, "Stretch,Tile,Tile Fit"), "set_h_axis_stretch_mode", "get_h_axis_stretch_mode"); ADD_PROPERTYNZ(PropertyInfo(Variant::INT, "axis_stretch_vertical", PROPERTY_HINT_ENUM, "Stretch,Tile,Tile Fit"), "set_v_axis_stretch_mode", "get_v_axis_stretch_mode"); - BIND_CONSTANT(AXIS_STRETCH_MODE_STRETCH); - BIND_CONSTANT(AXIS_STRETCH_MODE_TILE); - BIND_CONSTANT(AXIS_STRETCH_MODE_TILE_FIT); + BIND_ENUM_CONSTANT(AXIS_STRETCH_MODE_STRETCH); + BIND_ENUM_CONSTANT(AXIS_STRETCH_MODE_TILE); + BIND_ENUM_CONSTANT(AXIS_STRETCH_MODE_TILE_FIT); } void NinePatchRect::set_texture(const Ref<Texture> &p_tex) { diff --git a/scene/gui/popup.cpp b/scene/gui/popup.cpp index b21139f969..4725300a5f 100644 --- a/scene/gui/popup.cpp +++ b/scene/gui/popup.cpp @@ -28,6 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "popup.h" + +#include "engine.h" #include "os/keyboard.h" void Popup::_gui_input(Ref<InputEvent> p_event) { @@ -48,7 +50,7 @@ void Popup::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { //small helper to make editing of these easier in editor #ifdef TOOLS_ENABLED - if (get_tree()->is_editor_hint() && get_tree()->get_edited_scene_root() && get_tree()->get_edited_scene_root()->is_a_parent_of(this)) { + if (Engine::get_singleton()->is_editor_hint() && get_tree()->get_edited_scene_root() && get_tree()->get_edited_scene_root()->is_a_parent_of(this)) { set_as_toplevel(false); } #endif @@ -247,6 +249,7 @@ void Popup::_bind_methods() { ADD_SIGNAL(MethodInfo("popup_hide")); ADD_GROUP("Popup", "popup_"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "popup_exclusive"), "set_exclusive", "is_exclusive"); + BIND_CONSTANT(NOTIFICATION_POST_POPUP); BIND_CONSTANT(NOTIFICATION_POPUP_HIDE); } diff --git a/scene/gui/reference_rect.cpp b/scene/gui/reference_rect.cpp index 400ff299a9..441c3e721b 100644 --- a/scene/gui/reference_rect.cpp +++ b/scene/gui/reference_rect.cpp @@ -29,13 +29,15 @@ /*************************************************************************/ #include "reference_rect.h" +#include "engine.h" + void ReferenceRect::_notification(int p_what) { if (p_what == NOTIFICATION_DRAW) { if (!is_inside_tree()) return; - if (get_tree()->is_editor_hint()) + if (Engine::get_singleton()->is_editor_hint()) draw_style_box(get_stylebox("border"), Rect2(Point2(), get_size())); } } diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index 42084ade25..f0efbdc517 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -1915,26 +1915,26 @@ void RichTextLabel::_bind_methods() { ADD_SIGNAL(MethodInfo("meta_clicked", PropertyInfo(Variant::NIL, "meta"))); - BIND_CONSTANT(ALIGN_LEFT); - BIND_CONSTANT(ALIGN_CENTER); - BIND_CONSTANT(ALIGN_RIGHT); - BIND_CONSTANT(ALIGN_FILL); - - BIND_CONSTANT(LIST_NUMBERS); - BIND_CONSTANT(LIST_LETTERS); - BIND_CONSTANT(LIST_DOTS); - - BIND_CONSTANT(ITEM_FRAME); - BIND_CONSTANT(ITEM_TEXT); - BIND_CONSTANT(ITEM_IMAGE); - BIND_CONSTANT(ITEM_NEWLINE); - BIND_CONSTANT(ITEM_FONT); - BIND_CONSTANT(ITEM_COLOR); - BIND_CONSTANT(ITEM_UNDERLINE); - BIND_CONSTANT(ITEM_ALIGN); - BIND_CONSTANT(ITEM_INDENT); - BIND_CONSTANT(ITEM_LIST); - BIND_CONSTANT(ITEM_META); + BIND_ENUM_CONSTANT(ALIGN_LEFT); + BIND_ENUM_CONSTANT(ALIGN_CENTER); + BIND_ENUM_CONSTANT(ALIGN_RIGHT); + BIND_ENUM_CONSTANT(ALIGN_FILL); + + BIND_ENUM_CONSTANT(LIST_NUMBERS); + BIND_ENUM_CONSTANT(LIST_LETTERS); + BIND_ENUM_CONSTANT(LIST_DOTS); + + BIND_ENUM_CONSTANT(ITEM_FRAME); + BIND_ENUM_CONSTANT(ITEM_TEXT); + BIND_ENUM_CONSTANT(ITEM_IMAGE); + BIND_ENUM_CONSTANT(ITEM_NEWLINE); + BIND_ENUM_CONSTANT(ITEM_FONT); + BIND_ENUM_CONSTANT(ITEM_COLOR); + BIND_ENUM_CONSTANT(ITEM_UNDERLINE); + BIND_ENUM_CONSTANT(ITEM_ALIGN); + BIND_ENUM_CONSTANT(ITEM_INDENT); + BIND_ENUM_CONSTANT(ITEM_LIST); + BIND_ENUM_CONSTANT(ITEM_META); } void RichTextLabel::set_visible_characters(int p_visible) { diff --git a/scene/gui/spin_box.cpp b/scene/gui/spin_box.cpp index c5b9df15b9..751edc5a43 100644 --- a/scene/gui/spin_box.cpp +++ b/scene/gui/spin_box.cpp @@ -192,7 +192,7 @@ void SpinBox::_notification(int p_what) { int w = updown->get_width(); if (w != last_w) { - line_edit->set_margin(MARGIN_RIGHT, w); + line_edit->set_margin(MARGIN_RIGHT, -w); last_w = w; } diff --git a/scene/gui/split_container.cpp b/scene/gui/split_container.cpp index e3dad08809..5fc3db4672 100644 --- a/scene/gui/split_container.cpp +++ b/scene/gui/split_container.cpp @@ -410,9 +410,9 @@ void SplitContainer::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::BOOL, "collapsed"), "set_collapsed", "is_collapsed"); ADD_PROPERTY(PropertyInfo(Variant::INT, "dragger_visibility", PROPERTY_HINT_ENUM, "Visible,Hidden,Hidden & Collapsed"), "set_dragger_visibility", "get_dragger_visibility"); - BIND_CONSTANT(DRAGGER_VISIBLE); - BIND_CONSTANT(DRAGGER_HIDDEN); - BIND_CONSTANT(DRAGGER_HIDDEN_COLLAPSED); + BIND_ENUM_CONSTANT(DRAGGER_VISIBLE); + BIND_ENUM_CONSTANT(DRAGGER_HIDDEN); + BIND_ENUM_CONSTANT(DRAGGER_HIDDEN_COLLAPSED); } SplitContainer::SplitContainer(bool p_vertical) { diff --git a/scene/gui/tabs.cpp b/scene/gui/tabs.cpp index acffbbc499..b0dc88bbb4 100644 --- a/scene/gui/tabs.cpp +++ b/scene/gui/tabs.cpp @@ -815,15 +815,15 @@ void Tabs::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "current_tab", PROPERTY_HINT_RANGE, "-1,4096,1", PROPERTY_USAGE_EDITOR), "set_current_tab", "get_current_tab"); ADD_PROPERTYNZ(PropertyInfo(Variant::INT, "tab_close_display_policy", PROPERTY_HINT_ENUM, "Show Never,Show Active Only,Show Always"), "set_tab_close_display_policy", "get_tab_close_display_policy"); - BIND_CONSTANT(ALIGN_LEFT); - BIND_CONSTANT(ALIGN_CENTER); - BIND_CONSTANT(ALIGN_RIGHT); - BIND_CONSTANT(ALIGN_MAX); - - BIND_CONSTANT(CLOSE_BUTTON_SHOW_ACTIVE_ONLY); - BIND_CONSTANT(CLOSE_BUTTON_SHOW_ALWAYS); - BIND_CONSTANT(CLOSE_BUTTON_SHOW_NEVER); - BIND_CONSTANT(CLOSE_BUTTON_MAX); + BIND_ENUM_CONSTANT(ALIGN_LEFT); + BIND_ENUM_CONSTANT(ALIGN_CENTER); + BIND_ENUM_CONSTANT(ALIGN_RIGHT); + BIND_ENUM_CONSTANT(ALIGN_MAX); + + BIND_ENUM_CONSTANT(CLOSE_BUTTON_SHOW_ACTIVE_ONLY); + BIND_ENUM_CONSTANT(CLOSE_BUTTON_SHOW_ALWAYS); + BIND_ENUM_CONSTANT(CLOSE_BUTTON_SHOW_NEVER); + BIND_ENUM_CONSTANT(CLOSE_BUTTON_MAX); } Tabs::Tabs() { diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index f99cbbad89..f15fb71f87 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -429,7 +429,7 @@ void TextEdit::_notification(int p_what) { if (scrolling && v_scroll->get_value() != target_v_scroll) { double target_y = target_v_scroll - v_scroll->get_value(); double dist = sqrt(target_y * target_y); - double vel = ((target_y / dist) * 50) * get_fixed_process_delta_time(); + double vel = ((target_y / dist) * v_scroll_speed) * get_fixed_process_delta_time(); if (vel >= dist) { v_scroll->set_value(target_v_scroll); @@ -459,7 +459,7 @@ void TextEdit::_notification(int p_what) { int line_number_char_count = 0; { - int lc = text.size() + 1; + int lc = text.size(); cache.line_number_w = 0; while (lc) { cache.line_number_w += 1; @@ -3898,11 +3898,9 @@ bool TextEdit::search(const String &p_key, uint32_t p_search_flags, int p_from_l //search through the whole documment, but start by current line - int line = -1; + int line = p_from_line; int pos = -1; - line = p_from_line; - for (int i = 0; i < text.size() + 1; i++) { //backwards is broken... //int idx=(p_search_flags&SEARCH_BACKWARDS)?(text.size()-i):i; //do backwards seearch @@ -4264,6 +4262,14 @@ bool TextEdit::is_smooth_scroll_enabled() const { return smooth_scroll_enabled; } +void TextEdit::set_v_scroll_speed(float p_speed) { + v_scroll_speed = p_speed; +} + +float TextEdit::get_v_scroll_speed() const { + return v_scroll_speed; +} + void TextEdit::set_completion(bool p_enabled, const Vector<String> &p_prefixes) { completion_prefixes.clear(); @@ -4704,9 +4710,9 @@ void TextEdit::_bind_methods() { ClassDB::bind_method(D_METHOD("_click_selection_held"), &TextEdit::_click_selection_held); ClassDB::bind_method(D_METHOD("_toggle_draw_caret"), &TextEdit::_toggle_draw_caret); - BIND_CONSTANT(SEARCH_MATCH_CASE); - BIND_CONSTANT(SEARCH_WHOLE_WORDS); - BIND_CONSTANT(SEARCH_BACKWARDS); + BIND_ENUM_CONSTANT(SEARCH_MATCH_CASE); + BIND_ENUM_CONSTANT(SEARCH_WHOLE_WORDS); + BIND_ENUM_CONSTANT(SEARCH_BACKWARDS); /* ClassDB::bind_method(D_METHOD("delete_char"),&TextEdit::delete_char); @@ -4766,6 +4772,8 @@ void TextEdit::_bind_methods() { ClassDB::bind_method(D_METHOD("set_smooth_scroll_enable", "enable"), &TextEdit::set_smooth_scroll_enabled); ClassDB::bind_method(D_METHOD("is_smooth_scroll_enabled"), &TextEdit::is_smooth_scroll_enabled); + ClassDB::bind_method(D_METHOD("set_v_scroll_speed", "speed"), &TextEdit::set_v_scroll_speed); + ClassDB::bind_method(D_METHOD("get_v_scroll_speed"), &TextEdit::get_v_scroll_speed); ClassDB::bind_method(D_METHOD("add_keyword_color", "keyword", "color"), &TextEdit::add_keyword_color); ClassDB::bind_method(D_METHOD("add_color_region", "begin_key", "end_key", "color", "line_only"), &TextEdit::add_color_region, DEFVAL(false)); @@ -4777,6 +4785,7 @@ void TextEdit::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::BOOL, "show_line_numbers"), "set_show_line_numbers", "is_show_line_numbers_enabled"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "highlight_all_occurrences"), "set_highlight_all_occurrences", "is_highlight_all_occurrences_enabled"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "smooth_scrolling"), "set_smooth_scroll_enable", "is_smooth_scroll_enabled"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "v_scroll_speed"), "set_v_scroll_speed", "get_v_scroll_speed"); ADD_GROUP("Caret", "caret_"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "caret_block_mode"), "cursor_set_block_mode", "cursor_is_block_mode"); @@ -4789,13 +4798,13 @@ void TextEdit::_bind_methods() { ADD_SIGNAL(MethodInfo("breakpoint_toggled", PropertyInfo(Variant::INT, "row"))); ADD_SIGNAL(MethodInfo("symbol_lookup", PropertyInfo(Variant::STRING, "symbol"), PropertyInfo(Variant::INT, "row"), PropertyInfo(Variant::INT, "column"))); - BIND_CONSTANT(MENU_CUT); - BIND_CONSTANT(MENU_COPY); - BIND_CONSTANT(MENU_PASTE); - BIND_CONSTANT(MENU_CLEAR); - BIND_CONSTANT(MENU_SELECT_ALL); - BIND_CONSTANT(MENU_UNDO); - BIND_CONSTANT(MENU_MAX); + BIND_ENUM_CONSTANT(MENU_CUT); + BIND_ENUM_CONSTANT(MENU_COPY); + BIND_ENUM_CONSTANT(MENU_PASTE); + BIND_ENUM_CONSTANT(MENU_CLEAR); + BIND_ENUM_CONSTANT(MENU_SELECT_ALL); + BIND_ENUM_CONSTANT(MENU_UNDO); + BIND_ENUM_CONSTANT(MENU_MAX); GLOBAL_DEF("gui/timers/text_edit_idle_detect_sec", 3); } @@ -4916,6 +4925,7 @@ TextEdit::TextEdit() { smooth_scroll_enabled = false; scrolling = false; target_v_scroll = 0; + v_scroll_speed = 80; raised_from_completion = false; diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h index c4e0700531..1abfe368dd 100644 --- a/scene/gui/text_edit.h +++ b/scene/gui/text_edit.h @@ -259,6 +259,7 @@ class TextEdit : public Control { bool smooth_scroll_enabled; bool scrolling; float target_v_scroll; + float v_scroll_speed; bool raised_from_completion; @@ -494,6 +495,9 @@ public: void set_smooth_scroll_enabled(bool p_enable); bool is_smooth_scroll_enabled() const; + void set_v_scroll_speed(float p_speed); + float get_v_scroll_speed() const; + uint32_t get_version() const; uint32_t get_saved_version() const; void tag_saved_version(); @@ -535,4 +539,7 @@ public: ~TextEdit(); }; +VARIANT_ENUM_CAST(TextEdit::MenuItems); +VARIANT_ENUM_CAST(TextEdit::SearchFlags); + #endif // TEXT_EDIT_H diff --git a/scene/gui/texture_button.cpp b/scene/gui/texture_button.cpp index 7abf8380ce..d307b463d9 100644 --- a/scene/gui/texture_button.cpp +++ b/scene/gui/texture_button.cpp @@ -208,13 +208,13 @@ void TextureButton::_bind_methods() { ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "expand", PROPERTY_HINT_RESOURCE_TYPE, "bool"), "set_expand", "get_expand"); ADD_PROPERTYNZ(PropertyInfo(Variant::INT, "stretch_mode", PROPERTY_HINT_ENUM, "Scale,Tile,Keep,Keep Centered,Keep Aspect,Keep Aspect Centered,Keep Aspect Covered"), "set_stretch_mode", "get_stretch_mode"); - BIND_CONSTANT(STRETCH_SCALE); - BIND_CONSTANT(STRETCH_TILE); - BIND_CONSTANT(STRETCH_KEEP); - BIND_CONSTANT(STRETCH_KEEP_CENTERED); - BIND_CONSTANT(STRETCH_KEEP_ASPECT); - BIND_CONSTANT(STRETCH_KEEP_ASPECT_CENTERED); - BIND_CONSTANT(STRETCH_KEEP_ASPECT_COVERED); + BIND_ENUM_CONSTANT(STRETCH_SCALE); + BIND_ENUM_CONSTANT(STRETCH_TILE); + BIND_ENUM_CONSTANT(STRETCH_KEEP); + BIND_ENUM_CONSTANT(STRETCH_KEEP_CENTERED); + BIND_ENUM_CONSTANT(STRETCH_KEEP_ASPECT); + BIND_ENUM_CONSTANT(STRETCH_KEEP_ASPECT_CENTERED); + BIND_ENUM_CONSTANT(STRETCH_KEEP_ASPECT_COVERED); } void TextureButton::set_normal_texture(const Ref<Texture> &p_normal) { diff --git a/scene/gui/texture_progress.cpp b/scene/gui/texture_progress.cpp index 081c7ddb73..08025452d8 100644 --- a/scene/gui/texture_progress.cpp +++ b/scene/gui/texture_progress.cpp @@ -29,6 +29,8 @@ /*************************************************************************/ #include "texture_progress.h" +#include "engine.h" + void TextureProgress::set_under_texture(const Ref<Texture> &p_texture) { under = p_texture; @@ -179,7 +181,7 @@ void TextureProgress::_notification(int p_what) { } draw_polygon(points, Vector<Color>(), uvs, progress); } - if (get_tree()->is_editor_hint()) { + if (Engine::get_singleton()->is_editor_hint()) { Point2 p = progress->get_size(); p.x *= get_relative_center().x; p.y *= get_relative_center().y; @@ -273,12 +275,12 @@ void TextureProgress::_bind_methods() { ADD_PROPERTYNZ(PropertyInfo(Variant::REAL, "radial_fill_degrees", PROPERTY_HINT_RANGE, "0.0,360.0,0.1,slider"), "set_fill_degrees", "get_fill_degrees"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "radial_center_offset"), "set_radial_center_offset", "get_radial_center_offset"); - BIND_CONSTANT(FILL_LEFT_TO_RIGHT); - BIND_CONSTANT(FILL_RIGHT_TO_LEFT); - BIND_CONSTANT(FILL_TOP_TO_BOTTOM); - BIND_CONSTANT(FILL_BOTTOM_TO_TOP); - BIND_CONSTANT(FILL_CLOCKWISE); - BIND_CONSTANT(FILL_COUNTER_CLOCKWISE); + BIND_ENUM_CONSTANT(FILL_LEFT_TO_RIGHT); + BIND_ENUM_CONSTANT(FILL_RIGHT_TO_LEFT); + BIND_ENUM_CONSTANT(FILL_TOP_TO_BOTTOM); + BIND_ENUM_CONSTANT(FILL_BOTTOM_TO_TOP); + BIND_ENUM_CONSTANT(FILL_CLOCKWISE); + BIND_ENUM_CONSTANT(FILL_COUNTER_CLOCKWISE); } TextureProgress::TextureProgress() { diff --git a/scene/gui/texture_progress.h b/scene/gui/texture_progress.h index c0c2779cf9..3c018febf3 100644 --- a/scene/gui/texture_progress.h +++ b/scene/gui/texture_progress.h @@ -89,4 +89,6 @@ private: Point2 get_relative_center(); }; +VARIANT_ENUM_CAST(TextureProgress::FillMode); + #endif // TEXTURE_PROGRESS_H diff --git a/scene/gui/texture_rect.cpp b/scene/gui/texture_rect.cpp index 92a3db6a74..db340fd4d7 100644 --- a/scene/gui/texture_rect.cpp +++ b/scene/gui/texture_rect.cpp @@ -112,14 +112,14 @@ void TextureRect::_bind_methods() { ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "expand"), "set_expand", "has_expand"); ADD_PROPERTYNO(PropertyInfo(Variant::INT, "stretch_mode", PROPERTY_HINT_ENUM, "Scale On Expand (Compat),Scale,Tile,Keep,Keep Centered,Keep Aspect,Keep Aspect Centered,Keep Aspect Covered"), "set_stretch_mode", "get_stretch_mode"); - BIND_CONSTANT(STRETCH_SCALE_ON_EXPAND); - BIND_CONSTANT(STRETCH_SCALE); - BIND_CONSTANT(STRETCH_TILE); - BIND_CONSTANT(STRETCH_KEEP); - BIND_CONSTANT(STRETCH_KEEP_CENTERED); - BIND_CONSTANT(STRETCH_KEEP_ASPECT); - BIND_CONSTANT(STRETCH_KEEP_ASPECT_CENTERED); - BIND_CONSTANT(STRETCH_KEEP_ASPECT_COVERED); + BIND_ENUM_CONSTANT(STRETCH_SCALE_ON_EXPAND); + BIND_ENUM_CONSTANT(STRETCH_SCALE); + BIND_ENUM_CONSTANT(STRETCH_TILE); + BIND_ENUM_CONSTANT(STRETCH_KEEP); + BIND_ENUM_CONSTANT(STRETCH_KEEP_CENTERED); + BIND_ENUM_CONSTANT(STRETCH_KEEP_ASPECT); + BIND_ENUM_CONSTANT(STRETCH_KEEP_ASPECT_CENTERED); + BIND_ENUM_CONSTANT(STRETCH_KEEP_ASPECT_COVERED); } void TextureRect::set_texture(const Ref<Texture> &p_tex) { diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 3e8d8aed8a..20bf818d44 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -752,12 +752,12 @@ void TreeItem::_bind_methods() { ClassDB::bind_method(D_METHOD("set_disable_folding", "disable"), &TreeItem::set_disable_folding); ClassDB::bind_method(D_METHOD("is_folding_disabled"), &TreeItem::is_folding_disabled); - BIND_CONSTANT(CELL_MODE_STRING); - BIND_CONSTANT(CELL_MODE_CHECK); - BIND_CONSTANT(CELL_MODE_RANGE); - BIND_CONSTANT(CELL_MODE_RANGE_EXPRESSION); - BIND_CONSTANT(CELL_MODE_ICON); - BIND_CONSTANT(CELL_MODE_CUSTOM); + BIND_ENUM_CONSTANT(CELL_MODE_STRING); + BIND_ENUM_CONSTANT(CELL_MODE_CHECK); + BIND_ENUM_CONSTANT(CELL_MODE_RANGE); + BIND_ENUM_CONSTANT(CELL_MODE_RANGE_EXPRESSION); + BIND_ENUM_CONSTANT(CELL_MODE_ICON); + BIND_ENUM_CONSTANT(CELL_MODE_CUSTOM); } void TreeItem::clear_children() { @@ -1459,7 +1459,6 @@ void Tree::select_single_item(TreeItem *p_selected, TreeItem *p_current, int p_c c.selected = true; selected_item = p_selected; selected_col = 0; - selected_item = p_selected; if (!emitted_row) { emit_signal("item_selected"); emitted_row = true; @@ -3658,13 +3657,13 @@ void Tree::_bind_methods() { ADD_SIGNAL(MethodInfo("item_activated")); ADD_SIGNAL(MethodInfo("column_title_pressed", PropertyInfo(Variant::INT, "column"))); - BIND_CONSTANT(SELECT_SINGLE); - BIND_CONSTANT(SELECT_ROW); - BIND_CONSTANT(SELECT_MULTI); + BIND_ENUM_CONSTANT(SELECT_SINGLE); + BIND_ENUM_CONSTANT(SELECT_ROW); + BIND_ENUM_CONSTANT(SELECT_MULTI); - BIND_CONSTANT(DROP_MODE_DISABLED); - BIND_CONSTANT(DROP_MODE_ON_ITEM); - BIND_CONSTANT(DROP_MODE_INBETWEEN); + BIND_ENUM_CONSTANT(DROP_MODE_DISABLED); + BIND_ENUM_CONSTANT(DROP_MODE_ON_ITEM); + BIND_ENUM_CONSTANT(DROP_MODE_INBETWEEN); } Tree::Tree() { diff --git a/scene/gui/tree.h b/scene/gui/tree.h index 1e46956cd9..49a410f115 100644 --- a/scene/gui/tree.h +++ b/scene/gui/tree.h @@ -583,4 +583,5 @@ public: }; VARIANT_ENUM_CAST(Tree::SelectMode); +VARIANT_ENUM_CAST(Tree::DropModeFlags); #endif diff --git a/scene/gui/video_player.cpp b/scene/gui/video_player.cpp index 9c018a4e7c..37d10fb63e 100644 --- a/scene/gui/video_player.cpp +++ b/scene/gui/video_player.cpp @@ -116,7 +116,7 @@ void VideoPlayer::_notification(int p_notification) { case NOTIFICATION_ENTER_TREE: { - if (stream.is_valid() && autoplay && !get_tree()->is_editor_hint()) { + if (stream.is_valid() && autoplay && !Engine::get_singleton()->is_editor_hint()) { play(); } } break; @@ -399,7 +399,6 @@ VideoPlayer::VideoPlayer() { paused = false; autoplay = false; expand = true; - loops = false; audio_track = 0; diff --git a/scene/main/http_request.cpp b/scene/main/http_request.cpp index a9b2dba186..e57cd857f8 100644 --- a/scene/main/http_request.cpp +++ b/scene/main/http_request.cpp @@ -547,19 +547,19 @@ void HTTPRequest::_bind_methods() { ADD_SIGNAL(MethodInfo("request_completed", PropertyInfo(Variant::INT, "result"), PropertyInfo(Variant::INT, "response_code"), PropertyInfo(Variant::POOL_STRING_ARRAY, "headers"), PropertyInfo(Variant::POOL_BYTE_ARRAY, "body"))); - BIND_CONSTANT(RESULT_SUCCESS); - //BIND_CONSTANT( RESULT_NO_BODY ); - BIND_CONSTANT(RESULT_CHUNKED_BODY_SIZE_MISMATCH); - BIND_CONSTANT(RESULT_CANT_CONNECT); - BIND_CONSTANT(RESULT_CANT_RESOLVE); - BIND_CONSTANT(RESULT_CONNECTION_ERROR); - BIND_CONSTANT(RESULT_SSL_HANDSHAKE_ERROR); - BIND_CONSTANT(RESULT_NO_RESPONSE); - BIND_CONSTANT(RESULT_BODY_SIZE_LIMIT_EXCEEDED); - BIND_CONSTANT(RESULT_REQUEST_FAILED); - BIND_CONSTANT(RESULT_DOWNLOAD_FILE_CANT_OPEN); - BIND_CONSTANT(RESULT_DOWNLOAD_FILE_WRITE_ERROR); - BIND_CONSTANT(RESULT_REDIRECT_LIMIT_REACHED); + BIND_ENUM_CONSTANT(RESULT_SUCCESS); + //BIND_ENUM_CONSTANT( RESULT_NO_BODY ); + BIND_ENUM_CONSTANT(RESULT_CHUNKED_BODY_SIZE_MISMATCH); + BIND_ENUM_CONSTANT(RESULT_CANT_CONNECT); + BIND_ENUM_CONSTANT(RESULT_CANT_RESOLVE); + BIND_ENUM_CONSTANT(RESULT_CONNECTION_ERROR); + BIND_ENUM_CONSTANT(RESULT_SSL_HANDSHAKE_ERROR); + BIND_ENUM_CONSTANT(RESULT_NO_RESPONSE); + BIND_ENUM_CONSTANT(RESULT_BODY_SIZE_LIMIT_EXCEEDED); + BIND_ENUM_CONSTANT(RESULT_REQUEST_FAILED); + BIND_ENUM_CONSTANT(RESULT_DOWNLOAD_FILE_CANT_OPEN); + BIND_ENUM_CONSTANT(RESULT_DOWNLOAD_FILE_WRITE_ERROR); + BIND_ENUM_CONSTANT(RESULT_REDIRECT_LIMIT_REACHED); } HTTPRequest::HTTPRequest() { diff --git a/scene/main/http_request.h b/scene/main/http_request.h index 6099d4e9bf..104f529eae 100644 --- a/scene/main/http_request.h +++ b/scene/main/http_request.h @@ -137,4 +137,6 @@ public: ~HTTPRequest(); }; +VARIANT_ENUM_CAST(HTTPRequest::Result); + #endif // HTTPREQUEST_H diff --git a/scene/main/node.cpp b/scene/main/node.cpp index 0474c6fd26..c850a5ae74 100755 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -1954,6 +1954,23 @@ void Node::propagate_notification(int p_notification) { data.blocked--; } +void Node::propagate_call(const StringName &p_method, const Array &p_args, const bool p_parent_first) { + + data.blocked++; + + if (p_parent_first && has_method(p_method)) + callv(p_method, p_args); + + for (int i = 0; i < data.children.size(); i++) { + data.children[i]->propagate_call(p_method, p_args, p_parent_first); + } + + if (!p_parent_first && has_method(p_method)) + callv(p_method, p_args); + + data.blocked--; +} + void Node::_propagate_replace_owner(Node *p_owner, Node *p_by_owner) { if (get_owner() == p_owner) set_owner(p_by_owner); @@ -2761,6 +2778,7 @@ void Node::_bind_methods() { ClassDB::bind_method(D_METHOD("set_filename", "filename"), &Node::set_filename); ClassDB::bind_method(D_METHOD("get_filename"), &Node::get_filename); ClassDB::bind_method(D_METHOD("propagate_notification", "what"), &Node::propagate_notification); + ClassDB::bind_method(D_METHOD("propagate_call", "method", "args", "parent_first"), &Node::propagate_call, DEFVAL(Array()), DEFVAL(false)); ClassDB::bind_method(D_METHOD("set_fixed_process", "enable"), &Node::set_fixed_process); ClassDB::bind_method(D_METHOD("get_fixed_process_delta_time"), &Node::get_fixed_process_delta_time); ClassDB::bind_method(D_METHOD("is_fixed_processing"), &Node::is_fixed_processing); @@ -2858,20 +2876,20 @@ void Node::_bind_methods() { BIND_CONSTANT(NOTIFICATION_INTERNAL_PROCESS); BIND_CONSTANT(NOTIFICATION_INTERNAL_FIXED_PROCESS); - BIND_CONSTANT(RPC_MODE_DISABLED); - BIND_CONSTANT(RPC_MODE_REMOTE); - BIND_CONSTANT(RPC_MODE_SYNC); - BIND_CONSTANT(RPC_MODE_MASTER); - BIND_CONSTANT(RPC_MODE_SLAVE); + BIND_ENUM_CONSTANT(RPC_MODE_DISABLED); + BIND_ENUM_CONSTANT(RPC_MODE_REMOTE); + BIND_ENUM_CONSTANT(RPC_MODE_SYNC); + BIND_ENUM_CONSTANT(RPC_MODE_MASTER); + BIND_ENUM_CONSTANT(RPC_MODE_SLAVE); - BIND_CONSTANT(PAUSE_MODE_INHERIT); - BIND_CONSTANT(PAUSE_MODE_STOP); - BIND_CONSTANT(PAUSE_MODE_PROCESS); + BIND_ENUM_CONSTANT(PAUSE_MODE_INHERIT); + BIND_ENUM_CONSTANT(PAUSE_MODE_STOP); + BIND_ENUM_CONSTANT(PAUSE_MODE_PROCESS); - BIND_CONSTANT(DUPLICATE_SIGNALS); - BIND_CONSTANT(DUPLICATE_GROUPS); - BIND_CONSTANT(DUPLICATE_SCRIPTS); - BIND_CONSTANT(DUPLICATE_USE_INSTANCING); + BIND_ENUM_CONSTANT(DUPLICATE_SIGNALS); + BIND_ENUM_CONSTANT(DUPLICATE_GROUPS); + BIND_ENUM_CONSTANT(DUPLICATE_SCRIPTS); + BIND_ENUM_CONSTANT(DUPLICATE_USE_INSTANCING); ADD_SIGNAL(MethodInfo("renamed")); ADD_SIGNAL(MethodInfo("tree_entered")); diff --git a/scene/main/node.h b/scene/main/node.h index bb8d80a0c8..b5ce6682d8 100644 --- a/scene/main/node.h +++ b/scene/main/node.h @@ -298,6 +298,8 @@ public: void propagate_notification(int p_notification); + void propagate_call(const StringName &p_method, const Array &p_args = Array(), const bool p_parent_first = false); + /* PROCESSING */ void set_fixed_process(bool p_process); float get_fixed_process_delta_time() const; @@ -412,6 +414,8 @@ public: ~Node(); }; +VARIANT_ENUM_CAST(Node::DuplicateFlags); + typedef Set<Node *, Node::Comparator> NodeSet; #endif diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp index 2e67a1feaf..00460e9eda 100644 --- a/scene/main/scene_tree.cpp +++ b/scene/main/scene_tree.cpp @@ -38,6 +38,7 @@ #include <stdio.h> //#include "servers/spatial_sound_2d_server.h" +#include "editor/editor_node.h" #include "io/marshalls.h" #include "io/resource_loader.h" #include "scene/resources/material.h" @@ -382,7 +383,7 @@ bool SceneTree::is_input_handled() { void SceneTree::input_event(const Ref<InputEvent> &p_event) { - if (is_editor_hint() && (p_event->cast_to<InputEventJoypadButton>() || p_event->cast_to<InputEventJoypadMotion>())) + if (Engine::get_singleton()->is_editor_hint() && (p_event->cast_to<InputEventJoypadButton>() || p_event->cast_to<InputEventJoypadMotion>())) return; //avoid joy input on editor root_lock++; @@ -541,7 +542,7 @@ bool SceneTree::idle(float p_time) { #ifdef TOOLS_ENABLED - if (is_editor_hint()) { + if (Engine::get_singleton()->is_editor_hint()) { //simple hack to reload fallback environment if it changed from editor String env_path = ProjectSettings::get_singleton()->get("rendering/environment/default_environment"); env_path = env_path.strip_edges(); //user may have added a space or two @@ -616,7 +617,7 @@ void SceneTree::_notification(int p_notification) { get_root()->propagate_notification(p_notification); } break; case NOTIFICATION_TRANSLATION_CHANGED: { - if (!is_editor_hint()) { + if (!Engine::get_singleton()->is_editor_hint()) { get_root()->propagate_notification(Node::NOTIFICATION_TRANSLATION_CHANGED); } } break; @@ -626,6 +627,19 @@ void SceneTree::_notification(int p_notification) { } break; + case NOTIFICATION_WM_ABOUT: { + +#ifdef TOOLS_ENABLED + if (Engine::get_singleton()->is_editor_hint()) { + EditorNode::get_singleton()->show_about(); + } else { +#endif + get_root()->propagate_notification(p_notification); +#ifdef TOOLS_ENABLED + } +#endif + } break; + default: break; }; @@ -642,19 +656,10 @@ void SceneTree::set_quit_on_go_back(bool p_enable) { } #ifdef TOOLS_ENABLED -void SceneTree::set_editor_hint(bool p_enabled) { - - editor_hint = p_enabled; -} bool SceneTree::is_node_being_edited(const Node *p_node) const { - return editor_hint && edited_scene_root && edited_scene_root->is_a_parent_of(p_node); -} - -bool SceneTree::is_editor_hint() const { - - return editor_hint; + return Engine::get_singleton()->is_editor_hint() && edited_scene_root && edited_scene_root->is_a_parent_of(p_node); } #endif @@ -2114,8 +2119,6 @@ void SceneTree::_bind_methods() { ClassDB::bind_method(D_METHOD("set_auto_accept_quit", "enabled"), &SceneTree::set_auto_accept_quit); - ClassDB::bind_method(D_METHOD("set_editor_hint", "enable"), &SceneTree::set_editor_hint); - ClassDB::bind_method(D_METHOD("is_editor_hint"), &SceneTree::is_editor_hint); ClassDB::bind_method(D_METHOD("set_debug_collisions_hint", "enable"), &SceneTree::set_debug_collisions_hint); ClassDB::bind_method(D_METHOD("is_debugging_collisions_hint"), &SceneTree::is_debugging_collisions_hint); ClassDB::bind_method(D_METHOD("set_debug_navigation_hint", "enable"), &SceneTree::set_debug_navigation_hint); @@ -2202,18 +2205,19 @@ void SceneTree::_bind_methods() { ADD_SIGNAL(MethodInfo("connection_failed")); ADD_SIGNAL(MethodInfo("server_disconnected")); - BIND_CONSTANT(GROUP_CALL_DEFAULT); - BIND_CONSTANT(GROUP_CALL_REVERSE); - BIND_CONSTANT(GROUP_CALL_REALTIME); - BIND_CONSTANT(GROUP_CALL_UNIQUE); + BIND_ENUM_CONSTANT(GROUP_CALL_DEFAULT); + BIND_ENUM_CONSTANT(GROUP_CALL_REVERSE); + BIND_ENUM_CONSTANT(GROUP_CALL_REALTIME); + BIND_ENUM_CONSTANT(GROUP_CALL_UNIQUE); + + BIND_ENUM_CONSTANT(STRETCH_MODE_DISABLED); + BIND_ENUM_CONSTANT(STRETCH_MODE_2D); + BIND_ENUM_CONSTANT(STRETCH_MODE_VIEWPORT); - BIND_CONSTANT(STRETCH_MODE_DISABLED); - BIND_CONSTANT(STRETCH_MODE_2D); - BIND_CONSTANT(STRETCH_MODE_VIEWPORT); - BIND_CONSTANT(STRETCH_ASPECT_IGNORE); - BIND_CONSTANT(STRETCH_ASPECT_KEEP); - BIND_CONSTANT(STRETCH_ASPECT_KEEP_WIDTH); - BIND_CONSTANT(STRETCH_ASPECT_KEEP_HEIGHT); + BIND_ENUM_CONSTANT(STRETCH_ASPECT_IGNORE); + BIND_ENUM_CONSTANT(STRETCH_ASPECT_KEEP); + BIND_ENUM_CONSTANT(STRETCH_ASPECT_KEEP_WIDTH); + BIND_ENUM_CONSTANT(STRETCH_ASPECT_KEEP_HEIGHT); } SceneTree *SceneTree::singleton = NULL; @@ -2240,9 +2244,6 @@ SceneTree::SceneTree() { accept_quit = true; quit_on_go_back = true; initialized = false; -#ifdef TOOLS_ENABLED - editor_hint = false; -#endif #ifdef DEBUG_ENABLED debug_collisions_hint = false; debug_navigation_hint = false; @@ -2312,7 +2313,7 @@ SceneTree::SceneTree() { if (env.is_valid()) { root->get_world()->set_fallback_environment(env); } else { - if (is_editor_hint()) { + if (Engine::get_singleton()->is_editor_hint()) { //file was erased, clear the field. ProjectSettings::get_singleton()->set("rendering/environment/default_environment", ""); } else { diff --git a/scene/main/scene_tree.h b/scene/main/scene_tree.h index 3543ebee90..c62607244e 100644 --- a/scene/main/scene_tree.h +++ b/scene/main/scene_tree.h @@ -111,9 +111,6 @@ private: bool quit_on_go_back; uint32_t last_id; -#ifdef TOOLS_ENABLED - bool editor_hint; -#endif #ifdef DEBUG_ENABLED bool debug_collisions_hint; bool debug_navigation_hint; @@ -363,14 +360,8 @@ public: _FORCE_INLINE_ float get_idle_process_time() const { return idle_process_time; } #ifdef TOOLS_ENABLED - void set_editor_hint(bool p_enabled); - - bool is_editor_hint() const; bool is_node_being_edited(const Node *p_node) const; #else - void set_editor_hint(bool p_enabled) {} - - bool is_editor_hint() const { return false; } bool is_node_being_edited(const Node *p_node) const { return false; } #endif @@ -465,5 +456,6 @@ public: VARIANT_ENUM_CAST(SceneTree::StretchMode); VARIANT_ENUM_CAST(SceneTree::StretchAspect); +VARIANT_ENUM_CAST(SceneTree::CallGroupFlags); #endif diff --git a/scene/main/timer.cpp b/scene/main/timer.cpp index a61d1100e6..42690ab93a 100755 --- a/scene/main/timer.cpp +++ b/scene/main/timer.cpp @@ -29,6 +29,8 @@ /*************************************************************************/ #include "timer.h" +#include "engine.h" + void Timer::_notification(int p_what) { switch (p_what) { @@ -37,7 +39,7 @@ void Timer::_notification(int p_what) { if (autostart) { #ifdef TOOLS_ENABLED - if (get_tree()->is_editor_hint() && get_tree()->get_edited_scene_root() && (get_tree()->get_edited_scene_root() == this || get_tree()->get_edited_scene_root()->is_a_parent_of(this))) + if (Engine::get_singleton()->is_editor_hint() && get_tree()->get_edited_scene_root() && (get_tree()->get_edited_scene_root() == this || get_tree()->get_edited_scene_root()->is_a_parent_of(this))) break; #endif start(); @@ -202,8 +204,8 @@ void Timer::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::BOOL, "one_shot"), "set_one_shot", "is_one_shot"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "autostart"), "set_autostart", "has_autostart"); - BIND_CONSTANT(TIMER_PROCESS_FIXED); - BIND_CONSTANT(TIMER_PROCESS_IDLE); + BIND_ENUM_CONSTANT(TIMER_PROCESS_FIXED); + BIND_ENUM_CONSTANT(TIMER_PROCESS_IDLE); } Timer::Timer() { diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index a22d897669..e0800f4907 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -1354,7 +1354,7 @@ void Viewport::_vp_input(const Ref<InputEvent> &p_ev) { return; #ifdef TOOLS_ENABLED - if (get_tree()->is_editor_hint() && get_tree()->get_edited_scene_root() && get_tree()->get_edited_scene_root()->is_a_parent_of(this)) { + if (Engine::get_singleton()->is_editor_hint() && get_tree()->get_edited_scene_root() && get_tree()->get_edited_scene_root()->is_a_parent_of(this)) { return; } #endif @@ -1374,7 +1374,7 @@ void Viewport::_vp_unhandled_input(const Ref<InputEvent> &p_ev) { if (disable_input) return; #ifdef TOOLS_ENABLED - if (get_tree()->is_editor_hint() && get_tree()->get_edited_scene_root() && get_tree()->get_edited_scene_root()->is_a_parent_of(this)) { + if (Engine::get_singleton()->is_editor_hint() && get_tree()->get_edited_scene_root() && get_tree()->get_edited_scene_root()->is_a_parent_of(this)) { return; } #endif @@ -1456,6 +1456,10 @@ void Viewport::_gui_show_tooltip() { gui.tooltip_popup = NULL; } + if (!gui.tooltip) { + return; + } + Control *rp = gui.tooltip->get_root_parent_control(); if (!rp) return; @@ -2772,38 +2776,38 @@ void Viewport::_bind_methods() { ADD_SIGNAL(MethodInfo("size_changed")); - BIND_CONSTANT(UPDATE_DISABLED); - BIND_CONSTANT(UPDATE_ONCE); - BIND_CONSTANT(UPDATE_WHEN_VISIBLE); - BIND_CONSTANT(UPDATE_ALWAYS); - - BIND_CONSTANT(SHADOW_ATLAS_QUADRANT_SUBDIV_DISABLED); - BIND_CONSTANT(SHADOW_ATLAS_QUADRANT_SUBDIV_1); - BIND_CONSTANT(SHADOW_ATLAS_QUADRANT_SUBDIV_4); - BIND_CONSTANT(SHADOW_ATLAS_QUADRANT_SUBDIV_16); - BIND_CONSTANT(SHADOW_ATLAS_QUADRANT_SUBDIV_64); - BIND_CONSTANT(SHADOW_ATLAS_QUADRANT_SUBDIV_256); - BIND_CONSTANT(SHADOW_ATLAS_QUADRANT_SUBDIV_1024); - BIND_CONSTANT(SHADOW_ATLAS_QUADRANT_SUBDIV_MAX); - - BIND_CONSTANT(RENDER_INFO_OBJECTS_IN_FRAME); - BIND_CONSTANT(RENDER_INFO_VERTICES_IN_FRAME); - BIND_CONSTANT(RENDER_INFO_MATERIAL_CHANGES_IN_FRAME); - BIND_CONSTANT(RENDER_INFO_SHADER_CHANGES_IN_FRAME); - BIND_CONSTANT(RENDER_INFO_SURFACE_CHANGES_IN_FRAME); - BIND_CONSTANT(RENDER_INFO_DRAW_CALLS_IN_FRAME); - BIND_CONSTANT(RENDER_INFO_MAX); - - BIND_CONSTANT(DEBUG_DRAW_DISABLED); - BIND_CONSTANT(DEBUG_DRAW_UNSHADED); - BIND_CONSTANT(DEBUG_DRAW_OVERDRAW); - BIND_CONSTANT(DEBUG_DRAW_WIREFRAME); - - BIND_CONSTANT(MSAA_DISABLED); - BIND_CONSTANT(MSAA_2X); - BIND_CONSTANT(MSAA_4X); - BIND_CONSTANT(MSAA_8X); - BIND_CONSTANT(MSAA_16X); + BIND_ENUM_CONSTANT(UPDATE_DISABLED); + BIND_ENUM_CONSTANT(UPDATE_ONCE); + BIND_ENUM_CONSTANT(UPDATE_WHEN_VISIBLE); + BIND_ENUM_CONSTANT(UPDATE_ALWAYS); + + BIND_ENUM_CONSTANT(SHADOW_ATLAS_QUADRANT_SUBDIV_DISABLED); + BIND_ENUM_CONSTANT(SHADOW_ATLAS_QUADRANT_SUBDIV_1); + BIND_ENUM_CONSTANT(SHADOW_ATLAS_QUADRANT_SUBDIV_4); + BIND_ENUM_CONSTANT(SHADOW_ATLAS_QUADRANT_SUBDIV_16); + BIND_ENUM_CONSTANT(SHADOW_ATLAS_QUADRANT_SUBDIV_64); + BIND_ENUM_CONSTANT(SHADOW_ATLAS_QUADRANT_SUBDIV_256); + BIND_ENUM_CONSTANT(SHADOW_ATLAS_QUADRANT_SUBDIV_1024); + BIND_ENUM_CONSTANT(SHADOW_ATLAS_QUADRANT_SUBDIV_MAX); + + BIND_ENUM_CONSTANT(RENDER_INFO_OBJECTS_IN_FRAME); + BIND_ENUM_CONSTANT(RENDER_INFO_VERTICES_IN_FRAME); + BIND_ENUM_CONSTANT(RENDER_INFO_MATERIAL_CHANGES_IN_FRAME); + BIND_ENUM_CONSTANT(RENDER_INFO_SHADER_CHANGES_IN_FRAME); + BIND_ENUM_CONSTANT(RENDER_INFO_SURFACE_CHANGES_IN_FRAME); + BIND_ENUM_CONSTANT(RENDER_INFO_DRAW_CALLS_IN_FRAME); + BIND_ENUM_CONSTANT(RENDER_INFO_MAX); + + BIND_ENUM_CONSTANT(DEBUG_DRAW_DISABLED); + BIND_ENUM_CONSTANT(DEBUG_DRAW_UNSHADED); + BIND_ENUM_CONSTANT(DEBUG_DRAW_OVERDRAW); + BIND_ENUM_CONSTANT(DEBUG_DRAW_WIREFRAME); + + BIND_ENUM_CONSTANT(MSAA_DISABLED); + BIND_ENUM_CONSTANT(MSAA_2X); + BIND_ENUM_CONSTANT(MSAA_4X); + BIND_ENUM_CONSTANT(MSAA_8X); + BIND_ENUM_CONSTANT(MSAA_16X); } Viewport::Viewport() { diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp index a2ff45c623..8878e59e71 100644 --- a/scene/resources/animation.cpp +++ b/scene/resources/animation.cpp @@ -1676,17 +1676,17 @@ void Animation::_bind_methods() { ClassDB::bind_method(D_METHOD("clear"), &Animation::clear); - BIND_CONSTANT(TYPE_VALUE); - BIND_CONSTANT(TYPE_TRANSFORM); - BIND_CONSTANT(TYPE_METHOD); + BIND_ENUM_CONSTANT(TYPE_VALUE); + BIND_ENUM_CONSTANT(TYPE_TRANSFORM); + BIND_ENUM_CONSTANT(TYPE_METHOD); - BIND_CONSTANT(INTERPOLATION_NEAREST); - BIND_CONSTANT(INTERPOLATION_LINEAR); - BIND_CONSTANT(INTERPOLATION_CUBIC); + BIND_ENUM_CONSTANT(INTERPOLATION_NEAREST); + BIND_ENUM_CONSTANT(INTERPOLATION_LINEAR); + BIND_ENUM_CONSTANT(INTERPOLATION_CUBIC); - BIND_CONSTANT(UPDATE_CONTINUOUS); - BIND_CONSTANT(UPDATE_DISCRETE); - BIND_CONSTANT(UPDATE_TRIGGER); + BIND_ENUM_CONSTANT(UPDATE_CONTINUOUS); + BIND_ENUM_CONSTANT(UPDATE_DISCRETE); + BIND_ENUM_CONSTANT(UPDATE_TRIGGER); } void Animation::clear() { diff --git a/scene/resources/color_ramp.cpp b/scene/resources/color_ramp.cpp index 1825225abd..68f707220f 100644 --- a/scene/resources/color_ramp.cpp +++ b/scene/resources/color_ramp.cpp @@ -149,7 +149,7 @@ void Gradient::set_offset(int pos, const float offset) { } float Gradient::get_offset(int pos) const { - if (points.size() > pos) + if (points.size() && points.size() > pos) return points[pos].offset; return 0; //TODO: Maybe throw some error instead? } @@ -164,7 +164,7 @@ void Gradient::set_color(int pos, const Color &color) { } Color Gradient::get_color(int pos) const { - if (points.size() > pos) + if (points.size() && points.size() > pos) return points[pos].color; return Color(0, 0, 0, 1); //TODO: Maybe throw some error instead? } diff --git a/scene/resources/dynamic_font.cpp b/scene/resources/dynamic_font.cpp index e424ee48a8..57b860583e 100644 --- a/scene/resources/dynamic_font.cpp +++ b/scene/resources/dynamic_font.cpp @@ -892,10 +892,10 @@ void DynamicFont::_bind_methods() { ADD_GROUP("Font", ""); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "font_data", PROPERTY_HINT_RESOURCE_TYPE, "DynamicFontData"), "set_font_data", "get_font_data"); - BIND_CONSTANT(SPACING_TOP); - BIND_CONSTANT(SPACING_BOTTOM); - BIND_CONSTANT(SPACING_CHAR); - BIND_CONSTANT(SPACING_SPACE); + BIND_ENUM_CONSTANT(SPACING_TOP); + BIND_ENUM_CONSTANT(SPACING_BOTTOM); + BIND_ENUM_CONSTANT(SPACING_CHAR); + BIND_ENUM_CONSTANT(SPACING_SPACE); } DynamicFont::DynamicFont() { diff --git a/scene/resources/dynamic_font.h b/scene/resources/dynamic_font.h index 9024761b96..b8ff2845e7 100644 --- a/scene/resources/dynamic_font.h +++ b/scene/resources/dynamic_font.h @@ -236,6 +236,8 @@ public: ~DynamicFont(); }; +VARIANT_ENUM_CAST(DynamicFont::SpacingType); + ///////////// class ResourceFormatLoaderDynamicFont : public ResourceFormatLoader { diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp index 0bf6a50d93..60a700aad8 100644 --- a/scene/resources/environment.cpp +++ b/scene/resources/environment.cpp @@ -1114,23 +1114,26 @@ void Environment::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::REAL, "adjustment_saturation", PROPERTY_HINT_RANGE, "0.01,8,0.01"), "set_adjustment_saturation", "get_adjustment_saturation"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "adjustment_color_correction", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), "set_adjustment_color_correction", "get_adjustment_color_correction"); - BIND_CONSTANT(BG_KEEP); - BIND_CONSTANT(BG_CLEAR_COLOR); - BIND_CONSTANT(BG_COLOR); - BIND_CONSTANT(BG_SKY); - BIND_CONSTANT(BG_CANVAS); - BIND_CONSTANT(BG_MAX); - BIND_CONSTANT(GLOW_BLEND_MODE_ADDITIVE); - BIND_CONSTANT(GLOW_BLEND_MODE_SCREEN); - BIND_CONSTANT(GLOW_BLEND_MODE_SOFTLIGHT); - BIND_CONSTANT(GLOW_BLEND_MODE_REPLACE); - BIND_CONSTANT(TONE_MAPPER_LINEAR); - BIND_CONSTANT(TONE_MAPPER_REINHARDT); - BIND_CONSTANT(TONE_MAPPER_FILMIC); - BIND_CONSTANT(TONE_MAPPER_ACES); - BIND_CONSTANT(DOF_BLUR_QUALITY_LOW); - BIND_CONSTANT(DOF_BLUR_QUALITY_MEDIUM); - BIND_CONSTANT(DOF_BLUR_QUALITY_HIGH); + BIND_ENUM_CONSTANT(BG_KEEP); + BIND_ENUM_CONSTANT(BG_CLEAR_COLOR); + BIND_ENUM_CONSTANT(BG_COLOR); + BIND_ENUM_CONSTANT(BG_SKY); + BIND_ENUM_CONSTANT(BG_CANVAS); + BIND_ENUM_CONSTANT(BG_MAX); + + BIND_ENUM_CONSTANT(GLOW_BLEND_MODE_ADDITIVE); + BIND_ENUM_CONSTANT(GLOW_BLEND_MODE_SCREEN); + BIND_ENUM_CONSTANT(GLOW_BLEND_MODE_SOFTLIGHT); + BIND_ENUM_CONSTANT(GLOW_BLEND_MODE_REPLACE); + + BIND_ENUM_CONSTANT(TONE_MAPPER_LINEAR); + BIND_ENUM_CONSTANT(TONE_MAPPER_REINHARDT); + BIND_ENUM_CONSTANT(TONE_MAPPER_FILMIC); + BIND_ENUM_CONSTANT(TONE_MAPPER_ACES); + + BIND_ENUM_CONSTANT(DOF_BLUR_QUALITY_LOW); + BIND_ENUM_CONSTANT(DOF_BLUR_QUALITY_MEDIUM); + BIND_ENUM_CONSTANT(DOF_BLUR_QUALITY_HIGH); } Environment::Environment() { diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index a111f64e06..555c94a512 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -1718,88 +1718,88 @@ void SpatialMaterial::_bind_methods() { ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "uv2_triplanar"), "set_flag", "get_flag", FLAG_UV2_USE_TRIPLANAR); ADD_PROPERTY(PropertyInfo(Variant::REAL, "uv2_triplanar_sharpness", PROPERTY_HINT_EXP_EASING), "set_uv2_triplanar_blend_sharpness", "get_uv2_triplanar_blend_sharpness"); - BIND_CONSTANT(TEXTURE_ALBEDO); - BIND_CONSTANT(TEXTURE_METALLIC); - BIND_CONSTANT(TEXTURE_ROUGHNESS); - BIND_CONSTANT(TEXTURE_EMISSION); - BIND_CONSTANT(TEXTURE_NORMAL); - BIND_CONSTANT(TEXTURE_RIM); - BIND_CONSTANT(TEXTURE_CLEARCOAT); - BIND_CONSTANT(TEXTURE_FLOWMAP); - BIND_CONSTANT(TEXTURE_AMBIENT_OCCLUSION); - BIND_CONSTANT(TEXTURE_DEPTH); - BIND_CONSTANT(TEXTURE_SUBSURFACE_SCATTERING); - BIND_CONSTANT(TEXTURE_REFRACTION); - BIND_CONSTANT(TEXTURE_DETAIL_MASK); - BIND_CONSTANT(TEXTURE_DETAIL_ALBEDO); - BIND_CONSTANT(TEXTURE_DETAIL_NORMAL); - BIND_CONSTANT(TEXTURE_MAX); - - BIND_CONSTANT(DETAIL_UV_1); - BIND_CONSTANT(DETAIL_UV_2); - - BIND_CONSTANT(FEATURE_TRANSPARENT); - BIND_CONSTANT(FEATURE_EMISSION); - BIND_CONSTANT(FEATURE_NORMAL_MAPPING); - BIND_CONSTANT(FEATURE_RIM); - BIND_CONSTANT(FEATURE_CLEARCOAT); - BIND_CONSTANT(FEATURE_ANISOTROPY); - BIND_CONSTANT(FEATURE_AMBIENT_OCCLUSION); - BIND_CONSTANT(FEATURE_DEPTH_MAPPING); - BIND_CONSTANT(FEATURE_SUBSURACE_SCATTERING); - BIND_CONSTANT(FEATURE_REFRACTION); - BIND_CONSTANT(FEATURE_DETAIL); - BIND_CONSTANT(FEATURE_MAX); - - BIND_CONSTANT(BLEND_MODE_MIX); - BIND_CONSTANT(BLEND_MODE_ADD); - BIND_CONSTANT(BLEND_MODE_SUB); - BIND_CONSTANT(BLEND_MODE_MUL); - - BIND_CONSTANT(DEPTH_DRAW_OPAQUE_ONLY); - BIND_CONSTANT(DEPTH_DRAW_ALWAYS); - BIND_CONSTANT(DEPTH_DRAW_DISABLED); - BIND_CONSTANT(DEPTH_DRAW_ALPHA_OPAQUE_PREPASS); - - BIND_CONSTANT(CULL_BACK); - BIND_CONSTANT(CULL_FRONT); - BIND_CONSTANT(CULL_DISABLED); - - BIND_CONSTANT(FLAG_UNSHADED); - BIND_CONSTANT(FLAG_USE_VERTEX_LIGHTING); - BIND_CONSTANT(FLAG_ONTOP); - BIND_CONSTANT(FLAG_ALBEDO_FROM_VERTEX_COLOR); - BIND_CONSTANT(FLAG_SRGB_VERTEX_COLOR); - BIND_CONSTANT(FLAG_USE_POINT_SIZE); - BIND_CONSTANT(FLAG_FIXED_SIZE); - BIND_CONSTANT(FLAG_UV1_USE_TRIPLANAR); - BIND_CONSTANT(FLAG_UV2_USE_TRIPLANAR); - BIND_CONSTANT(FLAG_AO_ON_UV2); - BIND_CONSTANT(FLAG_USE_ALPHA_SCISSOR); - BIND_CONSTANT(FLAG_MAX); - - BIND_CONSTANT(DIFFUSE_LAMBERT); - BIND_CONSTANT(DIFFUSE_HALF_LAMBERT); - BIND_CONSTANT(DIFFUSE_OREN_NAYAR); - BIND_CONSTANT(DIFFUSE_BURLEY); - BIND_CONSTANT(DIFFUSE_TOON); - - BIND_CONSTANT(SPECULAR_SCHLICK_GGX); - BIND_CONSTANT(SPECULAR_BLINN); - BIND_CONSTANT(SPECULAR_PHONG); - BIND_CONSTANT(SPECULAR_TOON); - BIND_CONSTANT(SPECULAR_DISABLED); - - BIND_CONSTANT(BILLBOARD_DISABLED); - BIND_CONSTANT(BILLBOARD_ENABLED); - BIND_CONSTANT(BILLBOARD_FIXED_Y); - BIND_CONSTANT(BILLBOARD_PARTICLES); - - BIND_CONSTANT(TEXTURE_CHANNEL_RED); - BIND_CONSTANT(TEXTURE_CHANNEL_GREEN); - BIND_CONSTANT(TEXTURE_CHANNEL_BLUE); - BIND_CONSTANT(TEXTURE_CHANNEL_ALPHA); - BIND_CONSTANT(TEXTURE_CHANNEL_GRAYSCALE); + BIND_ENUM_CONSTANT(TEXTURE_ALBEDO); + BIND_ENUM_CONSTANT(TEXTURE_METALLIC); + BIND_ENUM_CONSTANT(TEXTURE_ROUGHNESS); + BIND_ENUM_CONSTANT(TEXTURE_EMISSION); + BIND_ENUM_CONSTANT(TEXTURE_NORMAL); + BIND_ENUM_CONSTANT(TEXTURE_RIM); + BIND_ENUM_CONSTANT(TEXTURE_CLEARCOAT); + BIND_ENUM_CONSTANT(TEXTURE_FLOWMAP); + BIND_ENUM_CONSTANT(TEXTURE_AMBIENT_OCCLUSION); + BIND_ENUM_CONSTANT(TEXTURE_DEPTH); + BIND_ENUM_CONSTANT(TEXTURE_SUBSURFACE_SCATTERING); + BIND_ENUM_CONSTANT(TEXTURE_REFRACTION); + BIND_ENUM_CONSTANT(TEXTURE_DETAIL_MASK); + BIND_ENUM_CONSTANT(TEXTURE_DETAIL_ALBEDO); + BIND_ENUM_CONSTANT(TEXTURE_DETAIL_NORMAL); + BIND_ENUM_CONSTANT(TEXTURE_MAX); + + BIND_ENUM_CONSTANT(DETAIL_UV_1); + BIND_ENUM_CONSTANT(DETAIL_UV_2); + + BIND_ENUM_CONSTANT(FEATURE_TRANSPARENT); + BIND_ENUM_CONSTANT(FEATURE_EMISSION); + BIND_ENUM_CONSTANT(FEATURE_NORMAL_MAPPING); + BIND_ENUM_CONSTANT(FEATURE_RIM); + BIND_ENUM_CONSTANT(FEATURE_CLEARCOAT); + BIND_ENUM_CONSTANT(FEATURE_ANISOTROPY); + BIND_ENUM_CONSTANT(FEATURE_AMBIENT_OCCLUSION); + BIND_ENUM_CONSTANT(FEATURE_DEPTH_MAPPING); + BIND_ENUM_CONSTANT(FEATURE_SUBSURACE_SCATTERING); + BIND_ENUM_CONSTANT(FEATURE_REFRACTION); + BIND_ENUM_CONSTANT(FEATURE_DETAIL); + BIND_ENUM_CONSTANT(FEATURE_MAX); + + BIND_ENUM_CONSTANT(BLEND_MODE_MIX); + BIND_ENUM_CONSTANT(BLEND_MODE_ADD); + BIND_ENUM_CONSTANT(BLEND_MODE_SUB); + BIND_ENUM_CONSTANT(BLEND_MODE_MUL); + + BIND_ENUM_CONSTANT(DEPTH_DRAW_OPAQUE_ONLY); + BIND_ENUM_CONSTANT(DEPTH_DRAW_ALWAYS); + BIND_ENUM_CONSTANT(DEPTH_DRAW_DISABLED); + BIND_ENUM_CONSTANT(DEPTH_DRAW_ALPHA_OPAQUE_PREPASS); + + BIND_ENUM_CONSTANT(CULL_BACK); + BIND_ENUM_CONSTANT(CULL_FRONT); + BIND_ENUM_CONSTANT(CULL_DISABLED); + + BIND_ENUM_CONSTANT(FLAG_UNSHADED); + BIND_ENUM_CONSTANT(FLAG_USE_VERTEX_LIGHTING); + BIND_ENUM_CONSTANT(FLAG_ONTOP); + BIND_ENUM_CONSTANT(FLAG_ALBEDO_FROM_VERTEX_COLOR); + BIND_ENUM_CONSTANT(FLAG_SRGB_VERTEX_COLOR); + BIND_ENUM_CONSTANT(FLAG_USE_POINT_SIZE); + BIND_ENUM_CONSTANT(FLAG_FIXED_SIZE); + BIND_ENUM_CONSTANT(FLAG_UV1_USE_TRIPLANAR); + BIND_ENUM_CONSTANT(FLAG_UV2_USE_TRIPLANAR); + BIND_ENUM_CONSTANT(FLAG_AO_ON_UV2); + BIND_ENUM_CONSTANT(FLAG_USE_ALPHA_SCISSOR); + BIND_ENUM_CONSTANT(FLAG_MAX); + + BIND_ENUM_CONSTANT(DIFFUSE_LAMBERT); + BIND_ENUM_CONSTANT(DIFFUSE_HALF_LAMBERT); + BIND_ENUM_CONSTANT(DIFFUSE_OREN_NAYAR); + BIND_ENUM_CONSTANT(DIFFUSE_BURLEY); + BIND_ENUM_CONSTANT(DIFFUSE_TOON); + + BIND_ENUM_CONSTANT(SPECULAR_SCHLICK_GGX); + BIND_ENUM_CONSTANT(SPECULAR_BLINN); + BIND_ENUM_CONSTANT(SPECULAR_PHONG); + BIND_ENUM_CONSTANT(SPECULAR_TOON); + BIND_ENUM_CONSTANT(SPECULAR_DISABLED); + + BIND_ENUM_CONSTANT(BILLBOARD_DISABLED); + BIND_ENUM_CONSTANT(BILLBOARD_ENABLED); + BIND_ENUM_CONSTANT(BILLBOARD_FIXED_Y); + BIND_ENUM_CONSTANT(BILLBOARD_PARTICLES); + + BIND_ENUM_CONSTANT(TEXTURE_CHANNEL_RED); + BIND_ENUM_CONSTANT(TEXTURE_CHANNEL_GREEN); + BIND_ENUM_CONSTANT(TEXTURE_CHANNEL_BLUE); + BIND_ENUM_CONSTANT(TEXTURE_CHANNEL_ALPHA); + BIND_ENUM_CONSTANT(TEXTURE_CHANNEL_GRAYSCALE); } SpatialMaterial::SpatialMaterial() diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp index af30e75aed..ebba0ba67f 100644 --- a/scene/resources/mesh.cpp +++ b/scene/resources/mesh.cpp @@ -415,13 +415,13 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const { void Mesh::_bind_methods() { - BIND_CONSTANT(PRIMITIVE_POINTS); - BIND_CONSTANT(PRIMITIVE_LINES); - BIND_CONSTANT(PRIMITIVE_LINE_STRIP); - BIND_CONSTANT(PRIMITIVE_LINE_LOOP); - BIND_CONSTANT(PRIMITIVE_TRIANGLES); - BIND_CONSTANT(PRIMITIVE_TRIANGLE_STRIP); - BIND_CONSTANT(PRIMITIVE_TRIANGLE_FAN); + BIND_ENUM_CONSTANT(PRIMITIVE_POINTS); + BIND_ENUM_CONSTANT(PRIMITIVE_LINES); + BIND_ENUM_CONSTANT(PRIMITIVE_LINE_STRIP); + BIND_ENUM_CONSTANT(PRIMITIVE_LINE_LOOP); + BIND_ENUM_CONSTANT(PRIMITIVE_TRIANGLES); + BIND_ENUM_CONSTANT(PRIMITIVE_TRIANGLE_STRIP); + BIND_ENUM_CONSTANT(PRIMITIVE_TRIANGLE_FAN); } Mesh::Mesh() { @@ -1026,25 +1026,25 @@ void ArrayMesh::_bind_methods() { BIND_CONSTANT(NO_INDEX_ARRAY); BIND_CONSTANT(ARRAY_WEIGHTS_SIZE); - BIND_CONSTANT(ARRAY_VERTEX); - BIND_CONSTANT(ARRAY_NORMAL); - BIND_CONSTANT(ARRAY_TANGENT); - BIND_CONSTANT(ARRAY_COLOR); - BIND_CONSTANT(ARRAY_TEX_UV); - BIND_CONSTANT(ARRAY_TEX_UV2); - BIND_CONSTANT(ARRAY_BONES); - BIND_CONSTANT(ARRAY_WEIGHTS); - BIND_CONSTANT(ARRAY_INDEX); - - BIND_CONSTANT(ARRAY_FORMAT_VERTEX); - BIND_CONSTANT(ARRAY_FORMAT_NORMAL); - BIND_CONSTANT(ARRAY_FORMAT_TANGENT); - BIND_CONSTANT(ARRAY_FORMAT_COLOR); - BIND_CONSTANT(ARRAY_FORMAT_TEX_UV); - BIND_CONSTANT(ARRAY_FORMAT_TEX_UV2); - BIND_CONSTANT(ARRAY_FORMAT_BONES); - BIND_CONSTANT(ARRAY_FORMAT_WEIGHTS); - BIND_CONSTANT(ARRAY_FORMAT_INDEX); + BIND_ENUM_CONSTANT(ARRAY_VERTEX); + BIND_ENUM_CONSTANT(ARRAY_NORMAL); + BIND_ENUM_CONSTANT(ARRAY_TANGENT); + BIND_ENUM_CONSTANT(ARRAY_COLOR); + BIND_ENUM_CONSTANT(ARRAY_TEX_UV); + BIND_ENUM_CONSTANT(ARRAY_TEX_UV2); + BIND_ENUM_CONSTANT(ARRAY_BONES); + BIND_ENUM_CONSTANT(ARRAY_WEIGHTS); + BIND_ENUM_CONSTANT(ARRAY_INDEX); + + BIND_ENUM_CONSTANT(ARRAY_FORMAT_VERTEX); + BIND_ENUM_CONSTANT(ARRAY_FORMAT_NORMAL); + BIND_ENUM_CONSTANT(ARRAY_FORMAT_TANGENT); + BIND_ENUM_CONSTANT(ARRAY_FORMAT_COLOR); + BIND_ENUM_CONSTANT(ARRAY_FORMAT_TEX_UV); + BIND_ENUM_CONSTANT(ARRAY_FORMAT_TEX_UV2); + BIND_ENUM_CONSTANT(ARRAY_FORMAT_BONES); + BIND_ENUM_CONSTANT(ARRAY_FORMAT_WEIGHTS); + BIND_ENUM_CONSTANT(ARRAY_FORMAT_INDEX); } ArrayMesh::ArrayMesh() { diff --git a/scene/resources/mesh.h b/scene/resources/mesh.h index ad3c10b6bc..bccb39e8cd 100644 --- a/scene/resources/mesh.h +++ b/scene/resources/mesh.h @@ -218,6 +218,7 @@ public: }; VARIANT_ENUM_CAST(Mesh::ArrayType); +VARIANT_ENUM_CAST(Mesh::ArrayFormat); VARIANT_ENUM_CAST(Mesh::PrimitiveType); VARIANT_ENUM_CAST(Mesh::BlendShapeMode); diff --git a/scene/resources/multimesh.cpp b/scene/resources/multimesh.cpp index 231e59cdb5..b65800ebbd 100644 --- a/scene/resources/multimesh.cpp +++ b/scene/resources/multimesh.cpp @@ -213,11 +213,12 @@ void MultiMesh::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR3_ARRAY, "transform_array", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_transform_array", "_get_transform_array"); ADD_PROPERTY(PropertyInfo(Variant::POOL_COLOR_ARRAY, "color_array", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_color_array", "_get_color_array"); - BIND_CONSTANT(TRANSFORM_2D); - BIND_CONSTANT(TRANSFORM_3D); - BIND_CONSTANT(COLOR_NONE); - BIND_CONSTANT(COLOR_8BIT); - BIND_CONSTANT(COLOR_FLOAT); + BIND_ENUM_CONSTANT(TRANSFORM_2D); + BIND_ENUM_CONSTANT(TRANSFORM_3D); + + BIND_ENUM_CONSTANT(COLOR_NONE); + BIND_ENUM_CONSTANT(COLOR_8BIT); + BIND_ENUM_CONSTANT(COLOR_FLOAT); } MultiMesh::MultiMesh() { diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp index 4dfc23fa67..d7ea675a47 100644 --- a/scene/resources/packed_scene.cpp +++ b/scene/resources/packed_scene.cpp @@ -1689,9 +1689,9 @@ void SceneState::_bind_methods() { ClassDB::bind_method(D_METHOD("get_connection_flags", "idx"), &SceneState::get_connection_flags); ClassDB::bind_method(D_METHOD("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); + BIND_ENUM_CONSTANT(GEN_EDIT_STATE_DISABLED); + BIND_ENUM_CONSTANT(GEN_EDIT_STATE_INSTANCE); + BIND_ENUM_CONSTANT(GEN_EDIT_STATE_MAIN); } SceneState::SceneState() { @@ -1792,9 +1792,9 @@ void PackedScene::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::DICTIONARY, "_bundled"), "_set_bundled_scene", "_get_bundled_scene"); - BIND_CONSTANT(GEN_EDIT_STATE_DISABLED); - BIND_CONSTANT(GEN_EDIT_STATE_INSTANCE); - BIND_CONSTANT(GEN_EDIT_STATE_MAIN); + BIND_ENUM_CONSTANT(GEN_EDIT_STATE_DISABLED); + BIND_ENUM_CONSTANT(GEN_EDIT_STATE_INSTANCE); + BIND_ENUM_CONSTANT(GEN_EDIT_STATE_MAIN); } PackedScene::PackedScene() { diff --git a/scene/resources/primitive_meshes.cpp b/scene/resources/primitive_meshes.cpp index 6a3ddde02a..2b8c0ddedd 100644 --- a/scene/resources/primitive_meshes.cpp +++ b/scene/resources/primitive_meshes.cpp @@ -1016,13 +1016,9 @@ void PrismMesh::_create_mesh_array(Array &p_arr) const { for (j = 0; j <= (subdivide_h + 1); j++) { float scale = (y - start_pos.y) / size.y; float scaled_size_x = size.x * scale; - float start_x = start_pos.x; - float offset_front = 0.0; - float offset_back = 0.0; - - start_x += (1.0 - scale) * size.x * left_to_right; - offset_front += (1.0 - scale) * onethird * left_to_right; - offset_back = (1.0 - scale) * onethird * (1.0 - left_to_right); + float start_x = start_pos.x + (1.0 - scale) * size.x * left_to_right; + float offset_front = (1.0 - scale) * onethird * left_to_right; + float offset_back = (1.0 - scale) * onethird * (1.0 - left_to_right); x = 0.0; for (i = 0; i <= (subdivide_w + 1); i++) { diff --git a/scene/resources/shader.cpp b/scene/resources/shader.cpp index b72eb9fbef..acd04a9321 100644 --- a/scene/resources/shader.cpp +++ b/scene/resources/shader.cpp @@ -137,9 +137,9 @@ void Shader::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::STRING, "code", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_code", "get_code"); - BIND_CONSTANT(MODE_SPATIAL); - BIND_CONSTANT(MODE_CANVAS_ITEM); - BIND_CONSTANT(MODE_PARTICLES); + BIND_ENUM_CONSTANT(MODE_SPATIAL); + BIND_ENUM_CONSTANT(MODE_CANVAS_ITEM); + BIND_ENUM_CONSTANT(MODE_PARTICLES); } Shader::Shader() { diff --git a/scene/resources/shader_graph.cpp b/scene/resources/shader_graph.cpp index f68aed6af9..ed63e84d4c 100644 --- a/scene/resources/shader_graph.cpp +++ b/scene/resources/shader_graph.cpp @@ -272,129 +272,129 @@ void ShaderGraph::_bind_methods() { //void get_connections(ShaderType p_which,List<Connection> *p_connections) const; - BIND_CONSTANT( NODE_INPUT ); // all inputs (shader type dependent) - BIND_CONSTANT( NODE_SCALAR_CONST ); //scalar constant - BIND_CONSTANT( NODE_VEC_CONST ); //vec3 constant - BIND_CONSTANT( NODE_RGB_CONST ); //rgb constant (shows a color picker instead) - BIND_CONSTANT( NODE_XFORM_CONST ); // 4x4 matrix constant - BIND_CONSTANT( NODE_TIME ); // time in seconds - BIND_CONSTANT( NODE_SCREEN_TEX ); // screen texture sampler (takes UV) (only usable in fragment shader) - BIND_CONSTANT( NODE_SCALAR_OP ); // scalar vs scalar op (mul ); add ); div ); etc) - BIND_CONSTANT( NODE_VEC_OP ); // vec3 vs vec3 op (mul );ad );div );crossprod );etc) - BIND_CONSTANT( NODE_VEC_SCALAR_OP ); // vec3 vs scalar op (mul ); add ); div ); etc) - BIND_CONSTANT( NODE_RGB_OP ); // vec3 vs vec3 rgb op (with scalar amount) ); like brighten ); darken ); burn ); dodge ); multiply ); etc. - BIND_CONSTANT( NODE_XFORM_MULT ); // mat4 x mat4 - BIND_CONSTANT( NODE_XFORM_VEC_MULT ); // mat4 x vec3 mult (with no-translation option) - BIND_CONSTANT( NODE_XFORM_VEC_INV_MULT ); // mat4 x vec3 inverse mult (with no-translation option) - BIND_CONSTANT( NODE_SCALAR_FUNC ); // scalar function (sin ); cos ); etc) - BIND_CONSTANT( NODE_VEC_FUNC ); // vector function (normalize ); negate ); reciprocal ); rgb2hsv ); hsv2rgb ); etc ); etc) - BIND_CONSTANT( NODE_VEC_LEN ); // vec3 length - BIND_CONSTANT( NODE_DOT_PROD ); // vec3 . vec3 (dot product -> scalar output) - BIND_CONSTANT( NODE_VEC_TO_SCALAR ); // 1 vec3 input ); 3 scalar outputs - BIND_CONSTANT( NODE_SCALAR_TO_VEC ); // 3 scalar input ); 1 vec3 output - BIND_CONSTANT( NODE_VEC_TO_XFORM ); // 3 vec input ); 1 xform output - BIND_CONSTANT( NODE_XFORM_TO_VEC ); // 3 vec input ); 1 xform output - BIND_CONSTANT( NODE_SCALAR_INTERP ); // scalar interpolation (with optional curve) - BIND_CONSTANT( NODE_VEC_INTERP ); // vec3 interpolation (with optional curve) - BIND_CONSTANT( NODE_COLOR_RAMP ); - BIND_CONSTANT( NODE_CURVE_MAP ); - BIND_CONSTANT( NODE_SCALAR_INPUT ); // scalar uniform (assignable in material) - BIND_CONSTANT( NODE_VEC_INPUT ); // vec3 uniform (assignable in material) - BIND_CONSTANT( NODE_RGB_INPUT ); // color uniform (assignable in material) - BIND_CONSTANT( NODE_XFORM_INPUT ); // mat4 uniform (assignable in material) - BIND_CONSTANT( NODE_TEXTURE_INPUT ); // texture input (assignable in material) - BIND_CONSTANT( NODE_CUBEMAP_INPUT ); // cubemap input (assignable in material) - BIND_CONSTANT( NODE_DEFAULT_TEXTURE ); - BIND_CONSTANT( NODE_OUTPUT ); // output (shader type dependent) - BIND_CONSTANT( NODE_COMMENT ); // comment - BIND_CONSTANT( NODE_TYPE_MAX ); - - BIND_CONSTANT( SLOT_TYPE_SCALAR ); - BIND_CONSTANT( SLOT_TYPE_VEC ); - BIND_CONSTANT( SLOT_TYPE_XFORM ); - BIND_CONSTANT( SLOT_TYPE_TEXTURE ); - BIND_CONSTANT( SLOT_MAX ); - - BIND_CONSTANT( SHADER_TYPE_VERTEX ); - BIND_CONSTANT( SHADER_TYPE_FRAGMENT ); - BIND_CONSTANT( SHADER_TYPE_LIGHT ); - BIND_CONSTANT( SHADER_TYPE_MAX ); - - - BIND_CONSTANT( SLOT_IN ); - BIND_CONSTANT( SLOT_OUT ); - - BIND_CONSTANT( GRAPH_OK ); - BIND_CONSTANT( GRAPH_ERROR_CYCLIC ); - BIND_CONSTANT( GRAPH_ERROR_MISSING_CONNECTIONS ); - - BIND_CONSTANT( SCALAR_OP_ADD ); - BIND_CONSTANT( SCALAR_OP_SUB ); - BIND_CONSTANT( SCALAR_OP_MUL ); - BIND_CONSTANT( SCALAR_OP_DIV ); - BIND_CONSTANT( SCALAR_OP_MOD ); - BIND_CONSTANT( SCALAR_OP_POW ); - BIND_CONSTANT( SCALAR_OP_MAX ); - BIND_CONSTANT( SCALAR_OP_MIN ); - BIND_CONSTANT( SCALAR_OP_ATAN2 ); - BIND_CONSTANT( SCALAR_MAX_OP ); - - BIND_CONSTANT( VEC_OP_ADD ); - BIND_CONSTANT( VEC_OP_SUB ); - BIND_CONSTANT( VEC_OP_MUL ); - BIND_CONSTANT( VEC_OP_DIV ); - BIND_CONSTANT( VEC_OP_MOD ); - BIND_CONSTANT( VEC_OP_POW ); - BIND_CONSTANT( VEC_OP_MAX ); - BIND_CONSTANT( VEC_OP_MIN ); - BIND_CONSTANT( VEC_OP_CROSS ); - BIND_CONSTANT( VEC_MAX_OP ); - - BIND_CONSTANT( VEC_SCALAR_OP_MUL ); - BIND_CONSTANT( VEC_SCALAR_OP_DIV ); - BIND_CONSTANT( VEC_SCALAR_OP_POW ); - BIND_CONSTANT( VEC_SCALAR_MAX_OP ); - - BIND_CONSTANT( RGB_OP_SCREEN ); - BIND_CONSTANT( RGB_OP_DIFFERENCE ); - BIND_CONSTANT( RGB_OP_DARKEN ); - BIND_CONSTANT( RGB_OP_LIGHTEN ); - BIND_CONSTANT( RGB_OP_OVERLAY ); - BIND_CONSTANT( RGB_OP_DODGE ); - BIND_CONSTANT( RGB_OP_BURN ); - BIND_CONSTANT( RGB_OP_SOFT_LIGHT ); - BIND_CONSTANT( RGB_OP_HARD_LIGHT ); - BIND_CONSTANT( RGB_MAX_OP ); - - BIND_CONSTANT( SCALAR_FUNC_SIN ); - BIND_CONSTANT( SCALAR_FUNC_COS ); - BIND_CONSTANT( SCALAR_FUNC_TAN ); - BIND_CONSTANT( SCALAR_FUNC_ASIN ); - BIND_CONSTANT( SCALAR_FUNC_ACOS ); - BIND_CONSTANT( SCALAR_FUNC_ATAN ); - BIND_CONSTANT( SCALAR_FUNC_SINH ); - BIND_CONSTANT( SCALAR_FUNC_COSH ); - BIND_CONSTANT( SCALAR_FUNC_TANH ); - BIND_CONSTANT( SCALAR_FUNC_LOG ); - BIND_CONSTANT( SCALAR_FUNC_EXP ); - BIND_CONSTANT( SCALAR_FUNC_SQRT ); - BIND_CONSTANT( SCALAR_FUNC_ABS ); - BIND_CONSTANT( SCALAR_FUNC_SIGN ); - BIND_CONSTANT( SCALAR_FUNC_FLOOR ); - BIND_CONSTANT( SCALAR_FUNC_ROUND ); - BIND_CONSTANT( SCALAR_FUNC_CEIL ); - BIND_CONSTANT( SCALAR_FUNC_FRAC ); - BIND_CONSTANT( SCALAR_FUNC_SATURATE ); - BIND_CONSTANT( SCALAR_FUNC_NEGATE ); - BIND_CONSTANT( SCALAR_MAX_FUNC ); - - BIND_CONSTANT( VEC_FUNC_NORMALIZE ); - BIND_CONSTANT( VEC_FUNC_SATURATE ); - BIND_CONSTANT( VEC_FUNC_NEGATE ); - BIND_CONSTANT( VEC_FUNC_RECIPROCAL ); - BIND_CONSTANT( VEC_FUNC_RGB2HSV ); - BIND_CONSTANT( VEC_FUNC_HSV2RGB ); - BIND_CONSTANT( VEC_MAX_FUNC ); + BIND_ENUM_CONSTANT( NODE_INPUT ); // all inputs (shader type dependent) + BIND_ENUM_CONSTANT( NODE_SCALAR_CONST ); //scalar constant + BIND_ENUM_CONSTANT( NODE_VEC_CONST ); //vec3 constant + BIND_ENUM_CONSTANT( NODE_RGB_CONST ); //rgb constant (shows a color picker instead) + BIND_ENUM_CONSTANT( NODE_XFORM_CONST ); // 4x4 matrix constant + BIND_ENUM_CONSTANT( NODE_TIME ); // time in seconds + BIND_ENUM_CONSTANT( NODE_SCREEN_TEX ); // screen texture sampler (takes UV) (only usable in fragment shader) + BIND_ENUM_CONSTANT( NODE_SCALAR_OP ); // scalar vs scalar op (mul ); add ); div ); etc) + BIND_ENUM_CONSTANT( NODE_VEC_OP ); // vec3 vs vec3 op (mul );ad );div );crossprod );etc) + BIND_ENUM_CONSTANT( NODE_VEC_SCALAR_OP ); // vec3 vs scalar op (mul ); add ); div ); etc) + BIND_ENUM_CONSTANT( NODE_RGB_OP ); // vec3 vs vec3 rgb op (with scalar amount) ); like brighten ); darken ); burn ); dodge ); multiply ); etc. + BIND_ENUM_CONSTANT( NODE_XFORM_MULT ); // mat4 x mat4 + BIND_ENUM_CONSTANT( NODE_XFORM_VEC_MULT ); // mat4 x vec3 mult (with no-translation option) + BIND_ENUM_CONSTANT( NODE_XFORM_VEC_INV_MULT ); // mat4 x vec3 inverse mult (with no-translation option) + BIND_ENUM_CONSTANT( NODE_SCALAR_FUNC ); // scalar function (sin ); cos ); etc) + BIND_ENUM_CONSTANT( NODE_VEC_FUNC ); // vector function (normalize ); negate ); reciprocal ); rgb2hsv ); hsv2rgb ); etc ); etc) + BIND_ENUM_CONSTANT( NODE_VEC_LEN ); // vec3 length + BIND_ENUM_CONSTANT( NODE_DOT_PROD ); // vec3 . vec3 (dot product -> scalar output) + BIND_ENUM_CONSTANT( NODE_VEC_TO_SCALAR ); // 1 vec3 input ); 3 scalar outputs + BIND_ENUM_CONSTANT( NODE_SCALAR_TO_VEC ); // 3 scalar input ); 1 vec3 output + BIND_ENUM_CONSTANT( NODE_VEC_TO_XFORM ); // 3 vec input ); 1 xform output + BIND_ENUM_CONSTANT( NODE_XFORM_TO_VEC ); // 3 vec input ); 1 xform output + BIND_ENUM_CONSTANT( NODE_SCALAR_INTERP ); // scalar interpolation (with optional curve) + BIND_ENUM_CONSTANT( NODE_VEC_INTERP ); // vec3 interpolation (with optional curve) + BIND_ENUM_CONSTANT( NODE_COLOR_RAMP ); + BIND_ENUM_CONSTANT( NODE_CURVE_MAP ); + BIND_ENUM_CONSTANT( NODE_SCALAR_INPUT ); // scalar uniform (assignable in material) + BIND_ENUM_CONSTANT( NODE_VEC_INPUT ); // vec3 uniform (assignable in material) + BIND_ENUM_CONSTANT( NODE_RGB_INPUT ); // color uniform (assignable in material) + BIND_ENUM_CONSTANT( NODE_XFORM_INPUT ); // mat4 uniform (assignable in material) + BIND_ENUM_CONSTANT( NODE_TEXTURE_INPUT ); // texture input (assignable in material) + BIND_ENUM_CONSTANT( NODE_CUBEMAP_INPUT ); // cubemap input (assignable in material) + BIND_ENUM_CONSTANT( NODE_DEFAULT_TEXTURE ); + BIND_ENUM_CONSTANT( NODE_OUTPUT ); // output (shader type dependent) + BIND_ENUM_CONSTANT( NODE_COMMENT ); // comment + BIND_ENUM_CONSTANT( NODE_TYPE_MAX ); + + BIND_ENUM_CONSTANT( SLOT_TYPE_SCALAR ); + BIND_ENUM_CONSTANT( SLOT_TYPE_VEC ); + BIND_ENUM_CONSTANT( SLOT_TYPE_XFORM ); + BIND_ENUM_CONSTANT( SLOT_TYPE_TEXTURE ); + BIND_ENUM_CONSTANT( SLOT_MAX ); + + BIND_ENUM_CONSTANT( SHADER_TYPE_VERTEX ); + BIND_ENUM_CONSTANT( SHADER_TYPE_FRAGMENT ); + BIND_ENUM_CONSTANT( SHADER_TYPE_LIGHT ); + BIND_ENUM_CONSTANT( SHADER_TYPE_MAX ); + + + BIND_ENUM_CONSTANT( SLOT_IN ); + BIND_ENUM_CONSTANT( SLOT_OUT ); + + BIND_ENUM_CONSTANT( GRAPH_OK ); + BIND_ENUM_CONSTANT( GRAPH_ERROR_CYCLIC ); + BIND_ENUM_CONSTANT( GRAPH_ERROR_MISSING_CONNECTIONS ); + + BIND_ENUM_CONSTANT( SCALAR_OP_ADD ); + BIND_ENUM_CONSTANT( SCALAR_OP_SUB ); + BIND_ENUM_CONSTANT( SCALAR_OP_MUL ); + BIND_ENUM_CONSTANT( SCALAR_OP_DIV ); + BIND_ENUM_CONSTANT( SCALAR_OP_MOD ); + BIND_ENUM_CONSTANT( SCALAR_OP_POW ); + BIND_ENUM_CONSTANT( SCALAR_OP_MAX ); + BIND_ENUM_CONSTANT( SCALAR_OP_MIN ); + BIND_ENUM_CONSTANT( SCALAR_OP_ATAN2 ); + BIND_ENUM_CONSTANT( SCALAR_MAX_OP ); + + BIND_ENUM_CONSTANT( VEC_OP_ADD ); + BIND_ENUM_CONSTANT( VEC_OP_SUB ); + BIND_ENUM_CONSTANT( VEC_OP_MUL ); + BIND_ENUM_CONSTANT( VEC_OP_DIV ); + BIND_ENUM_CONSTANT( VEC_OP_MOD ); + BIND_ENUM_CONSTANT( VEC_OP_POW ); + BIND_ENUM_CONSTANT( VEC_OP_MAX ); + BIND_ENUM_CONSTANT( VEC_OP_MIN ); + BIND_ENUM_CONSTANT( VEC_OP_CROSS ); + BIND_ENUM_CONSTANT( VEC_MAX_OP ); + + BIND_ENUM_CONSTANT( VEC_SCALAR_OP_MUL ); + BIND_ENUM_CONSTANT( VEC_SCALAR_OP_DIV ); + BIND_ENUM_CONSTANT( VEC_SCALAR_OP_POW ); + BIND_ENUM_CONSTANT( VEC_SCALAR_MAX_OP ); + + BIND_ENUM_CONSTANT( RGB_OP_SCREEN ); + BIND_ENUM_CONSTANT( RGB_OP_DIFFERENCE ); + BIND_ENUM_CONSTANT( RGB_OP_DARKEN ); + BIND_ENUM_CONSTANT( RGB_OP_LIGHTEN ); + BIND_ENUM_CONSTANT( RGB_OP_OVERLAY ); + BIND_ENUM_CONSTANT( RGB_OP_DODGE ); + BIND_ENUM_CONSTANT( RGB_OP_BURN ); + BIND_ENUM_CONSTANT( RGB_OP_SOFT_LIGHT ); + BIND_ENUM_CONSTANT( RGB_OP_HARD_LIGHT ); + BIND_ENUM_CONSTANT( RGB_MAX_OP ); + + BIND_ENUM_CONSTANT( SCALAR_FUNC_SIN ); + BIND_ENUM_CONSTANT( SCALAR_FUNC_COS ); + BIND_ENUM_CONSTANT( SCALAR_FUNC_TAN ); + BIND_ENUM_CONSTANT( SCALAR_FUNC_ASIN ); + BIND_ENUM_CONSTANT( SCALAR_FUNC_ACOS ); + BIND_ENUM_CONSTANT( SCALAR_FUNC_ATAN ); + BIND_ENUM_CONSTANT( SCALAR_FUNC_SINH ); + BIND_ENUM_CONSTANT( SCALAR_FUNC_COSH ); + BIND_ENUM_CONSTANT( SCALAR_FUNC_TANH ); + BIND_ENUM_CONSTANT( SCALAR_FUNC_LOG ); + BIND_ENUM_CONSTANT( SCALAR_FUNC_EXP ); + BIND_ENUM_CONSTANT( SCALAR_FUNC_SQRT ); + BIND_ENUM_CONSTANT( SCALAR_FUNC_ABS ); + BIND_ENUM_CONSTANT( SCALAR_FUNC_SIGN ); + BIND_ENUM_CONSTANT( SCALAR_FUNC_FLOOR ); + BIND_ENUM_CONSTANT( SCALAR_FUNC_ROUND ); + BIND_ENUM_CONSTANT( SCALAR_FUNC_CEIL ); + BIND_ENUM_CONSTANT( SCALAR_FUNC_FRAC ); + BIND_ENUM_CONSTANT( SCALAR_FUNC_SATURATE ); + BIND_ENUM_CONSTANT( SCALAR_FUNC_NEGATE ); + BIND_ENUM_CONSTANT( SCALAR_MAX_FUNC ); + + BIND_ENUM_CONSTANT( VEC_FUNC_NORMALIZE ); + BIND_ENUM_CONSTANT( VEC_FUNC_SATURATE ); + BIND_ENUM_CONSTANT( VEC_FUNC_NEGATE ); + BIND_ENUM_CONSTANT( VEC_FUNC_RECIPROCAL ); + BIND_ENUM_CONSTANT( VEC_FUNC_RGB2HSV ); + BIND_ENUM_CONSTANT( VEC_FUNC_HSV2RGB ); + BIND_ENUM_CONSTANT( VEC_MAX_FUNC ); ADD_SIGNAL(MethodInfo("updated")); @@ -415,60 +415,60 @@ void ShaderGraph::_bind_methods() { ClassDB::bind_method(D_METHOD("clear"),&ShaderGraph::clear ); - BIND_CONSTANT( NODE_IN ); ///< param 0: name - BIND_CONSTANT( NODE_OUT ); ///< param 0: name - BIND_CONSTANT( NODE_CONSTANT ); ///< param 0: value - BIND_CONSTANT( NODE_PARAMETER ); ///< param 0: name - BIND_CONSTANT( NODE_ADD ); - BIND_CONSTANT( NODE_SUB ); - BIND_CONSTANT( NODE_MUL ); - BIND_CONSTANT( NODE_DIV ); - BIND_CONSTANT( NODE_MOD ); - BIND_CONSTANT( NODE_SIN ); - BIND_CONSTANT( NODE_COS ); - BIND_CONSTANT( NODE_TAN ); - BIND_CONSTANT( NODE_ARCSIN ); - BIND_CONSTANT( NODE_ARCCOS ); - BIND_CONSTANT( NODE_ARCTAN ); - BIND_CONSTANT( NODE_POW ); - BIND_CONSTANT( NODE_LOG ); - BIND_CONSTANT( NODE_MAX ); - BIND_CONSTANT( NODE_MIN ); - BIND_CONSTANT( NODE_COMPARE ); - BIND_CONSTANT( NODE_TEXTURE ); ///< param 0: texture - BIND_CONSTANT( NODE_TIME ); ///< param 0: interval length - BIND_CONSTANT( NODE_NOISE ); - BIND_CONSTANT( NODE_PASS ); - BIND_CONSTANT( NODE_VEC_IN ); ///< param 0: name - BIND_CONSTANT( NODE_VEC_OUT ); ///< param 0: name - BIND_CONSTANT( NODE_VEC_CONSTANT ); ///< param 0: value - BIND_CONSTANT( NODE_VEC_PARAMETER ); ///< param 0: name - BIND_CONSTANT( NODE_VEC_ADD ); - BIND_CONSTANT( NODE_VEC_SUB ); - BIND_CONSTANT( NODE_VEC_MUL ); - BIND_CONSTANT( NODE_VEC_DIV ); - BIND_CONSTANT( NODE_VEC_MOD ); - BIND_CONSTANT( NODE_VEC_CROSS ); - BIND_CONSTANT( NODE_VEC_DOT ); - BIND_CONSTANT( NODE_VEC_POW ); - BIND_CONSTANT( NODE_VEC_NORMALIZE ); - BIND_CONSTANT( NODE_VEC_TRANSFORM3 ); - BIND_CONSTANT( NODE_VEC_TRANSFORM4 ); - BIND_CONSTANT( NODE_VEC_COMPARE ); - BIND_CONSTANT( NODE_VEC_TEXTURE_2D ); - BIND_CONSTANT( NODE_VEC_TEXTURE_CUBE ); - BIND_CONSTANT( NODE_VEC_NOISE ); - BIND_CONSTANT( NODE_VEC_0 ); - BIND_CONSTANT( NODE_VEC_1 ); - BIND_CONSTANT( NODE_VEC_2 ); - BIND_CONSTANT( NODE_VEC_BUILD ); - BIND_CONSTANT( NODE_VEC_PASS ); - BIND_CONSTANT( NODE_COLOR_CONSTANT ); - BIND_CONSTANT( NODE_COLOR_PARAMETER ); - BIND_CONSTANT( NODE_TEXTURE_PARAMETER ); - BIND_CONSTANT( NODE_TEXTURE_2D_PARAMETER ); - BIND_CONSTANT( NODE_TEXTURE_CUBE_PARAMETER ); - BIND_CONSTANT( NODE_TYPE_MAX ); + BIND_ENUM_CONSTANT( NODE_IN ); ///< param 0: name + BIND_ENUM_CONSTANT( NODE_OUT ); ///< param 0: name + BIND_ENUM_CONSTANT( NODE_CONSTANT ); ///< param 0: value + BIND_ENUM_CONSTANT( NODE_PARAMETER ); ///< param 0: name + BIND_ENUM_CONSTANT( NODE_ADD ); + BIND_ENUM_CONSTANT( NODE_SUB ); + BIND_ENUM_CONSTANT( NODE_MUL ); + BIND_ENUM_CONSTANT( NODE_DIV ); + BIND_ENUM_CONSTANT( NODE_MOD ); + BIND_ENUM_CONSTANT( NODE_SIN ); + BIND_ENUM_CONSTANT( NODE_COS ); + BIND_ENUM_CONSTANT( NODE_TAN ); + BIND_ENUM_CONSTANT( NODE_ARCSIN ); + BIND_ENUM_CONSTANT( NODE_ARCCOS ); + BIND_ENUM_CONSTANT( NODE_ARCTAN ); + BIND_ENUM_CONSTANT( NODE_POW ); + BIND_ENUM_CONSTANT( NODE_LOG ); + BIND_ENUM_CONSTANT( NODE_MAX ); + BIND_ENUM_CONSTANT( NODE_MIN ); + BIND_ENUM_CONSTANT( NODE_COMPARE ); + BIND_ENUM_CONSTANT( NODE_TEXTURE ); ///< param 0: texture + BIND_ENUM_CONSTANT( NODE_TIME ); ///< param 0: interval length + BIND_ENUM_CONSTANT( NODE_NOISE ); + BIND_ENUM_CONSTANT( NODE_PASS ); + BIND_ENUM_CONSTANT( NODE_VEC_IN ); ///< param 0: name + BIND_ENUM_CONSTANT( NODE_VEC_OUT ); ///< param 0: name + BIND_ENUM_CONSTANT( NODE_VEC_CONSTANT ); ///< param 0: value + BIND_ENUM_CONSTANT( NODE_VEC_PARAMETER ); ///< param 0: name + BIND_ENUM_CONSTANT( NODE_VEC_ADD ); + BIND_ENUM_CONSTANT( NODE_VEC_SUB ); + BIND_ENUM_CONSTANT( NODE_VEC_MUL ); + BIND_ENUM_CONSTANT( NODE_VEC_DIV ); + BIND_ENUM_CONSTANT( NODE_VEC_MOD ); + BIND_ENUM_CONSTANT( NODE_VEC_CROSS ); + BIND_ENUM_CONSTANT( NODE_VEC_DOT ); + BIND_ENUM_CONSTANT( NODE_VEC_POW ); + BIND_ENUM_CONSTANT( NODE_VEC_NORMALIZE ); + BIND_ENUM_CONSTANT( NODE_VEC_TRANSFORM3 ); + BIND_ENUM_CONSTANT( NODE_VEC_TRANSFORM4 ); + BIND_ENUM_CONSTANT( NODE_VEC_COMPARE ); + BIND_ENUM_CONSTANT( NODE_VEC_TEXTURE_2D ); + BIND_ENUM_CONSTANT( NODE_VEC_TEXTURE_CUBE ); + BIND_ENUM_CONSTANT( NODE_VEC_NOISE ); + BIND_ENUM_CONSTANT( NODE_VEC_0 ); + BIND_ENUM_CONSTANT( NODE_VEC_1 ); + BIND_ENUM_CONSTANT( NODE_VEC_2 ); + BIND_ENUM_CONSTANT( NODE_VEC_BUILD ); + BIND_ENUM_CONSTANT( NODE_VEC_PASS ); + BIND_ENUM_CONSTANT( NODE_COLOR_CONSTANT ); + BIND_ENUM_CONSTANT( NODE_COLOR_PARAMETER ); + BIND_ENUM_CONSTANT( NODE_TEXTURE_PARAMETER ); + BIND_ENUM_CONSTANT( NODE_TEXTURE_2D_PARAMETER ); + BIND_ENUM_CONSTANT( NODE_TEXTURE_CUBE_PARAMETER ); + BIND_ENUM_CONSTANT( NODE_TYPE_MAX ); #endif } diff --git a/scene/resources/sky_box.cpp b/scene/resources/sky_box.cpp index cc3cfe4dc0..b7f2feb58d 100644 --- a/scene/resources/sky_box.cpp +++ b/scene/resources/sky_box.cpp @@ -49,14 +49,14 @@ void Sky::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "radiance_size", PROPERTY_HINT_ENUM, "32,64,128,256,512,1024,2048"), "set_radiance_size", "get_radiance_size"); - BIND_CONSTANT(RADIANCE_SIZE_32); - BIND_CONSTANT(RADIANCE_SIZE_64); - BIND_CONSTANT(RADIANCE_SIZE_128); - BIND_CONSTANT(RADIANCE_SIZE_256); - BIND_CONSTANT(RADIANCE_SIZE_512); - BIND_CONSTANT(RADIANCE_SIZE_1024); - BIND_CONSTANT(RADIANCE_SIZE_2048); - BIND_CONSTANT(RADIANCE_SIZE_MAX); + BIND_ENUM_CONSTANT(RADIANCE_SIZE_32); + BIND_ENUM_CONSTANT(RADIANCE_SIZE_64); + BIND_ENUM_CONSTANT(RADIANCE_SIZE_128); + BIND_ENUM_CONSTANT(RADIANCE_SIZE_256); + BIND_ENUM_CONSTANT(RADIANCE_SIZE_512); + BIND_ENUM_CONSTANT(RADIANCE_SIZE_1024); + BIND_ENUM_CONSTANT(RADIANCE_SIZE_2048); + BIND_ENUM_CONSTANT(RADIANCE_SIZE_MAX); } Sky::Sky() { @@ -517,12 +517,12 @@ void ProceduralSky::_bind_methods() { ADD_GROUP("Texture", "texture_"); ADD_PROPERTY(PropertyInfo(Variant::INT, "texture_size", PROPERTY_HINT_ENUM, "256,512,1024,2048,4096"), "set_texture_size", "get_texture_size"); - BIND_CONSTANT(TEXTURE_SIZE_256); - BIND_CONSTANT(TEXTURE_SIZE_512); - BIND_CONSTANT(TEXTURE_SIZE_1024); - BIND_CONSTANT(TEXTURE_SIZE_2048); - BIND_CONSTANT(TEXTURE_SIZE_4096); - BIND_CONSTANT(TEXTURE_SIZE_MAX); + BIND_ENUM_CONSTANT(TEXTURE_SIZE_256); + BIND_ENUM_CONSTANT(TEXTURE_SIZE_512); + BIND_ENUM_CONSTANT(TEXTURE_SIZE_1024); + BIND_ENUM_CONSTANT(TEXTURE_SIZE_2048); + BIND_ENUM_CONSTANT(TEXTURE_SIZE_4096); + BIND_ENUM_CONSTANT(TEXTURE_SIZE_MAX); } ProceduralSky::ProceduralSky() { diff --git a/scene/resources/style_box.cpp b/scene/resources/style_box.cpp index d6a730647f..3100aab8ad 100644 --- a/scene/resources/style_box.cpp +++ b/scene/resources/style_box.cpp @@ -191,6 +191,22 @@ void StyleBoxTexture::set_expand_margin_size(Margin p_expand_margin, float p_siz emit_changed(); } +void StyleBoxTexture::set_expand_margin_size_individual(float p_left, float p_top, float p_right, float p_bottom) { + expand_margin[MARGIN_LEFT] = p_left; + expand_margin[MARGIN_TOP] = p_top; + expand_margin[MARGIN_RIGHT] = p_right; + expand_margin[MARGIN_BOTTOM] = p_bottom; + emit_changed(); +} + +void StyleBoxTexture::set_expand_margin_size_all(float p_expand_margin_size) { + for (int i = 0; i < 4; i++) { + + expand_margin[i] = p_expand_margin_size; + } + emit_changed(); +} + float StyleBoxTexture::get_expand_margin_size(Margin p_expand_margin) const { ERR_FAIL_INDEX_V(p_expand_margin, 4, 0); @@ -257,6 +273,8 @@ void StyleBoxTexture::_bind_methods() { ClassDB::bind_method(D_METHOD("get_margin_size", "margin"), &StyleBoxTexture::get_margin_size); ClassDB::bind_method(D_METHOD("set_expand_margin_size", "margin", "size"), &StyleBoxTexture::set_expand_margin_size); + ClassDB::bind_method(D_METHOD("set_expand_margin_all", "size"), &StyleBoxFlat::set_expand_margin_size_all); + ClassDB::bind_method(D_METHOD("set_expand_margin_individual", "size_left", "size_top", "size_right", "size_bottom"), &StyleBoxFlat::set_expand_margin_size_individual); ClassDB::bind_method(D_METHOD("get_expand_margin_size", "margin"), &StyleBoxTexture::get_expand_margin_size); ClassDB::bind_method(D_METHOD("set_region_rect", "region"), &StyleBoxTexture::set_region_rect); @@ -296,9 +314,9 @@ void StyleBoxTexture::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::COLOR, "modulate_color"), "set_modulate", "get_modulate"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "draw_center"), "set_draw_center", "get_draw_center"); - BIND_CONSTANT(AXIS_STRETCH_MODE_STRETCH); - BIND_CONSTANT(AXIS_STRETCH_MODE_TILE); - BIND_CONSTANT(AXIS_STRETCH_MODE_TILE_FIT); + BIND_ENUM_CONSTANT(AXIS_STRETCH_MODE_STRETCH); + BIND_ENUM_CONSTANT(AXIS_STRETCH_MODE_TILE); + BIND_ENUM_CONSTANT(AXIS_STRETCH_MODE_TILE_FIT); } StyleBoxTexture::StyleBoxTexture() { @@ -421,7 +439,25 @@ void StyleBoxFlat::set_expand_margin_size(Margin p_expand_margin, float p_size) expand_margin[p_expand_margin] = p_size; emit_changed(); } + +void StyleBoxFlat::set_expand_margin_size_individual(float p_left, float p_top, float p_right, float p_bottom) { + expand_margin[MARGIN_LEFT] = p_left; + expand_margin[MARGIN_TOP] = p_top; + expand_margin[MARGIN_RIGHT] = p_right; + expand_margin[MARGIN_BOTTOM] = p_bottom; + emit_changed(); +} + +void StyleBoxFlat::set_expand_margin_size_all(float p_expand_margin_size) { + for (int i = 0; i < 4; i++) { + + expand_margin[i] = p_expand_margin_size; + } + emit_changed(); +} + float StyleBoxFlat::get_expand_margin_size(Margin p_expand_margin) const { + return expand_margin[p_expand_margin]; } void StyleBoxFlat::set_filled(bool p_filled) { @@ -736,6 +772,8 @@ void StyleBoxFlat::_bind_methods() { ClassDB::bind_method(D_METHOD("get_corner_radius", "corner"), &StyleBoxFlat::get_corner_radius); ClassDB::bind_method(D_METHOD("set_expand_margin", "margin", "size"), &StyleBoxFlat::set_expand_margin_size); + ClassDB::bind_method(D_METHOD("set_expand_margin_all", "size"), &StyleBoxFlat::set_expand_margin_size_all); + ClassDB::bind_method(D_METHOD("set_expand_margin_individual", "size_left", "size_top", "size_right", "size_bottom"), &StyleBoxFlat::set_expand_margin_size_individual); ClassDB::bind_method(D_METHOD("get_expand_margin", "margin"), &StyleBoxFlat::get_expand_margin_size); ClassDB::bind_method(D_METHOD("set_filled", "filled"), &StyleBoxFlat::set_filled); diff --git a/scene/resources/style_box.h b/scene/resources/style_box.h index a750fae753..30eb9543e8 100644 --- a/scene/resources/style_box.h +++ b/scene/resources/style_box.h @@ -101,6 +101,8 @@ protected: public: void set_expand_margin_size(Margin p_expand_margin, float p_size); + void set_expand_margin_size_all(float p_expand_margin_size); + void set_expand_margin_size_individual(float p_left, float p_top, float p_right, float p_bottom); float get_expand_margin_size(Margin p_expand_margin) const; void set_margin_size(Margin p_margin, float p_size); @@ -196,6 +198,8 @@ public: //EXPANDS void set_expand_margin_size(Margin p_expand_margin, float p_size); + void set_expand_margin_size_all(float p_expand_margin_size); + void set_expand_margin_size_individual(float p_left, float p_top, float p_right, float p_bottom); float get_expand_margin_size(Margin p_expand_margin) const; //FILLED diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index 9a251c029d..f542d2a8de 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -75,14 +75,14 @@ void Texture::_bind_methods() { ClassDB::bind_method(D_METHOD("draw_rect_region", "canvas_item", "rect", "src_rect", "modulate", "transpose", "normal_map", "clip_uv"), &Texture::draw_rect_region, DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(Variant()), DEFVAL(true)); ClassDB::bind_method(D_METHOD("get_data"), &Texture::get_data); - BIND_CONSTANT(FLAG_MIPMAPS); - BIND_CONSTANT(FLAG_REPEAT); - BIND_CONSTANT(FLAG_FILTER); - BIND_CONSTANT(FLAG_VIDEO_SURFACE); - BIND_CONSTANT(FLAGS_DEFAULT); - BIND_CONSTANT(FLAG_ANISOTROPIC_FILTER); - BIND_CONSTANT(FLAG_CONVERT_TO_LINEAR); - BIND_CONSTANT(FLAG_MIRRORED_REPEAT); + BIND_ENUM_CONSTANT(FLAG_MIPMAPS); + BIND_ENUM_CONSTANT(FLAG_REPEAT); + BIND_ENUM_CONSTANT(FLAG_FILTER); + BIND_ENUM_CONSTANT(FLAG_VIDEO_SURFACE); + BIND_ENUM_CONSTANT(FLAGS_DEFAULT); + BIND_ENUM_CONSTANT(FLAG_ANISOTROPIC_FILTER); + BIND_ENUM_CONSTANT(FLAG_CONVERT_TO_LINEAR); + BIND_ENUM_CONSTANT(FLAG_MIRRORED_REPEAT); } Texture::Texture() { @@ -362,9 +362,9 @@ void ImageTexture::_bind_methods() { ClassDB::bind_method(D_METHOD("set_size_override", "size"), &ImageTexture::set_size_override); ClassDB::bind_method(D_METHOD("_reload_hook", "rid"), &ImageTexture::_reload_hook); - BIND_CONSTANT(STORAGE_RAW); - BIND_CONSTANT(STORAGE_COMPRESS_LOSSY); - BIND_CONSTANT(STORAGE_COMPRESS_LOSSLESS); + BIND_ENUM_CONSTANT(STORAGE_RAW); + BIND_ENUM_CONSTANT(STORAGE_COMPRESS_LOSSY); + BIND_ENUM_CONSTANT(STORAGE_COMPRESS_LOSSLESS); } ImageTexture::ImageTexture() { @@ -1335,19 +1335,21 @@ void CubeMap::_bind_methods() { ClassDB::bind_method(D_METHOD("set_lossy_storage_quality", "quality"), &CubeMap::set_lossy_storage_quality); ClassDB::bind_method(D_METHOD("get_lossy_storage_quality"), &CubeMap::get_lossy_storage_quality); - BIND_CONSTANT(STORAGE_RAW); - BIND_CONSTANT(STORAGE_COMPRESS_LOSSY); - BIND_CONSTANT(STORAGE_COMPRESS_LOSSLESS); - BIND_CONSTANT(SIDE_LEFT); - BIND_CONSTANT(SIDE_RIGHT); - BIND_CONSTANT(SIDE_BOTTOM); - BIND_CONSTANT(SIDE_TOP); - BIND_CONSTANT(SIDE_FRONT); - BIND_CONSTANT(SIDE_BACK); - BIND_CONSTANT(FLAG_MIPMAPS); - BIND_CONSTANT(FLAG_REPEAT); - BIND_CONSTANT(FLAG_FILTER); - BIND_CONSTANT(FLAGS_DEFAULT); + BIND_ENUM_CONSTANT(STORAGE_RAW); + BIND_ENUM_CONSTANT(STORAGE_COMPRESS_LOSSY); + BIND_ENUM_CONSTANT(STORAGE_COMPRESS_LOSSLESS); + + BIND_ENUM_CONSTANT(SIDE_LEFT); + BIND_ENUM_CONSTANT(SIDE_RIGHT); + BIND_ENUM_CONSTANT(SIDE_BOTTOM); + BIND_ENUM_CONSTANT(SIDE_TOP); + BIND_ENUM_CONSTANT(SIDE_FRONT); + BIND_ENUM_CONSTANT(SIDE_BACK); + + BIND_ENUM_CONSTANT(FLAG_MIPMAPS); + BIND_ENUM_CONSTANT(FLAG_REPEAT); + BIND_ENUM_CONSTANT(FLAG_FILTER); + BIND_ENUM_CONSTANT(FLAGS_DEFAULT); } CubeMap::CubeMap() { @@ -1366,13 +1368,14 @@ CubeMap::~CubeMap() { VisualServer::get_singleton()->free(cubemap); } -/* BIND_CONSTANT( FLAG_CUBEMAP ); - BIND_CONSTANT( CUBEMAP_LEFT ); - BIND_CONSTANT( CUBEMAP_RIGHT ); - BIND_CONSTANT( CUBEMAP_BOTTOM ); - BIND_CONSTANT( CUBEMAP_TOP ); - BIND_CONSTANT( CUBEMAP_FRONT ); - BIND_CONSTANT( CUBEMAP_BACK ); +/* BIND_ENUM(CubeMapSize); + BIND_ENUM_CONSTANT( FLAG_CUBEMAP ); + BIND_ENUM_CONSTANT( CUBEMAP_LEFT ); + BIND_ENUM_CONSTANT( CUBEMAP_RIGHT ); + BIND_ENUM_CONSTANT( CUBEMAP_BOTTOM ); + BIND_ENUM_CONSTANT( CUBEMAP_TOP ); + BIND_ENUM_CONSTANT( CUBEMAP_FRONT ); + BIND_ENUM_CONSTANT( CUBEMAP_BACK ); */ /////////////////////////// |