summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
Diffstat (limited to 'scene')
-rw-r--r--scene/2d/animated_sprite.cpp1
-rw-r--r--scene/2d/animated_sprite.h1
-rw-r--r--scene/2d/area_2d.cpp1
-rw-r--r--scene/2d/area_2d.h1
-rw-r--r--scene/2d/back_buffer_copy.cpp1
-rw-r--r--scene/2d/back_buffer_copy.h1
-rw-r--r--scene/2d/camera_2d.cpp1
-rw-r--r--scene/2d/camera_2d.h1
-rw-r--r--scene/2d/canvas_item.cpp145
-rw-r--r--scene/2d/canvas_item.h41
-rw-r--r--scene/2d/canvas_modulate.cpp1
-rw-r--r--scene/2d/canvas_modulate.h1
-rw-r--r--scene/2d/collision_object_2d.cpp1
-rw-r--r--scene/2d/collision_object_2d.h1
-rw-r--r--scene/2d/collision_polygon_2d.cpp1
-rw-r--r--scene/2d/collision_polygon_2d.h1
-rw-r--r--scene/2d/collision_shape_2d.cpp1
-rw-r--r--scene/2d/collision_shape_2d.h1
-rw-r--r--scene/2d/joints_2d.cpp1
-rw-r--r--scene/2d/joints_2d.h1
-rw-r--r--scene/2d/light_2d.cpp1
-rw-r--r--scene/2d/light_2d.h1
-rw-r--r--scene/2d/light_occluder_2d.cpp1
-rw-r--r--scene/2d/light_occluder_2d.h1
-rw-r--r--scene/2d/line_2d.cpp1
-rw-r--r--scene/2d/line_2d.h1
-rw-r--r--scene/2d/line_builder.cpp3
-rw-r--r--scene/2d/line_builder.h1
-rw-r--r--scene/2d/navigation2d.cpp1
-rw-r--r--scene/2d/navigation2d.h1
-rw-r--r--scene/2d/navigation_polygon.cpp1
-rw-r--r--scene/2d/navigation_polygon.h1
-rw-r--r--scene/2d/node_2d.cpp23
-rw-r--r--scene/2d/node_2d.h1
-rw-r--r--scene/2d/parallax_background.cpp1
-rw-r--r--scene/2d/parallax_background.h1
-rw-r--r--scene/2d/parallax_layer.cpp1
-rw-r--r--scene/2d/parallax_layer.h1
-rw-r--r--scene/2d/particles_2d.cpp11
-rw-r--r--scene/2d/particles_2d.h1
-rw-r--r--scene/2d/path_2d.cpp1
-rw-r--r--scene/2d/path_2d.h1
-rw-r--r--scene/2d/path_texture.cpp1
-rw-r--r--scene/2d/path_texture.h1
-rw-r--r--scene/2d/physics_body_2d.cpp14
-rw-r--r--scene/2d/physics_body_2d.h3
-rw-r--r--scene/2d/polygon_2d.cpp1
-rw-r--r--scene/2d/polygon_2d.h1
-rw-r--r--scene/2d/position_2d.cpp1
-rw-r--r--scene/2d/position_2d.h1
-rw-r--r--scene/2d/ray_cast_2d.cpp1
-rw-r--r--scene/2d/ray_cast_2d.h1
-rw-r--r--scene/2d/remote_transform_2d.cpp1
-rw-r--r--scene/2d/remote_transform_2d.h1
-rw-r--r--scene/2d/screen_button.cpp32
-rw-r--r--scene/2d/screen_button.h5
-rw-r--r--scene/2d/sprite.cpp1
-rw-r--r--scene/2d/sprite.h1
-rw-r--r--scene/2d/tile_map.cpp43
-rw-r--r--scene/2d/tile_map.h7
-rw-r--r--scene/2d/visibility_notifier_2d.cpp1
-rw-r--r--scene/2d/visibility_notifier_2d.h1
-rw-r--r--scene/2d/y_sort.cpp1
-rw-r--r--scene/2d/y_sort.h1
-rw-r--r--scene/3d/area.cpp1
-rw-r--r--scene/3d/area.h1
-rw-r--r--scene/3d/baked_light_instance.cpp15
-rw-r--r--scene/3d/baked_light_instance.h1
-rw-r--r--scene/3d/body_shape.cpp1
-rw-r--r--scene/3d/body_shape.h1
-rw-r--r--scene/3d/bone_attachment.cpp1
-rw-r--r--scene/3d/bone_attachment.h1
-rw-r--r--scene/3d/camera.cpp1
-rw-r--r--scene/3d/camera.h1
-rw-r--r--scene/3d/character_camera.cpp1
-rw-r--r--scene/3d/character_camera.h1
-rw-r--r--scene/3d/collision_object.cpp1
-rw-r--r--scene/3d/collision_object.h1
-rw-r--r--scene/3d/collision_polygon.cpp1
-rw-r--r--scene/3d/collision_polygon.h1
-rw-r--r--scene/3d/gi_probe.cpp15
-rw-r--r--scene/3d/gi_probe.h1
-rw-r--r--scene/3d/immediate_geometry.cpp1
-rw-r--r--scene/3d/immediate_geometry.h1
-rw-r--r--scene/3d/interpolated_camera.cpp1
-rw-r--r--scene/3d/interpolated_camera.h1
-rw-r--r--scene/3d/light.cpp1
-rw-r--r--scene/3d/light.h1
-rw-r--r--scene/3d/listener.cpp1
-rw-r--r--scene/3d/listener.h1
-rw-r--r--scene/3d/mesh_instance.cpp1
-rw-r--r--scene/3d/mesh_instance.h1
-rw-r--r--scene/3d/multimesh_instance.cpp1
-rw-r--r--scene/3d/multimesh_instance.h1
-rw-r--r--scene/3d/navigation.cpp1
-rw-r--r--scene/3d/navigation.h1
-rw-r--r--scene/3d/navigation_mesh.cpp1
-rw-r--r--scene/3d/navigation_mesh.h1
-rw-r--r--scene/3d/particles.cpp1619
-rw-r--r--scene/3d/particles.h385
-rw-r--r--scene/3d/path.cpp1
-rw-r--r--scene/3d/path.h1
-rw-r--r--scene/3d/physics_body.cpp1
-rw-r--r--scene/3d/physics_body.h1
-rw-r--r--scene/3d/physics_joint.cpp1
-rw-r--r--scene/3d/physics_joint.h1
-rw-r--r--scene/3d/portal.cpp1
-rw-r--r--scene/3d/portal.h1
-rw-r--r--scene/3d/position_3d.cpp1
-rw-r--r--scene/3d/position_3d.h1
-rw-r--r--scene/3d/proximity_group.cpp1
-rw-r--r--scene/3d/proximity_group.h1
-rw-r--r--scene/3d/quad.cpp1
-rw-r--r--scene/3d/quad.h1
-rw-r--r--scene/3d/ray_cast.cpp1
-rw-r--r--scene/3d/ray_cast.h1
-rw-r--r--scene/3d/reflection_probe.cpp1
-rw-r--r--scene/3d/reflection_probe.h1
-rw-r--r--scene/3d/remote_transform.cpp1
-rw-r--r--scene/3d/remote_transform.h1
-rw-r--r--scene/3d/room_instance.cpp1
-rw-r--r--scene/3d/room_instance.h1
-rw-r--r--scene/3d/scenario_fx.cpp1
-rw-r--r--scene/3d/scenario_fx.h1
-rw-r--r--scene/3d/skeleton.cpp1
-rw-r--r--scene/3d/skeleton.h1
-rw-r--r--scene/3d/spatial.cpp24
-rw-r--r--scene/3d/spatial.h7
-rw-r--r--scene/3d/spatial_indexer.cpp1
-rw-r--r--scene/3d/spatial_indexer.h1
-rw-r--r--scene/3d/sprite_3d.cpp1
-rw-r--r--scene/3d/sprite_3d.h1
-rw-r--r--scene/3d/test_cube.cpp1
-rw-r--r--scene/3d/test_cube.h1
-rw-r--r--scene/3d/vehicle_body.cpp1
-rw-r--r--scene/3d/vehicle_body.h1
-rw-r--r--scene/3d/visibility_notifier.cpp1
-rw-r--r--scene/3d/visibility_notifier.h1
-rw-r--r--scene/3d/visual_instance.cpp7
-rw-r--r--scene/3d/visual_instance.h4
-rw-r--r--scene/animation/animation_cache.cpp1
-rw-r--r--scene/animation/animation_cache.h1
-rw-r--r--scene/animation/animation_player.cpp3
-rw-r--r--scene/animation/animation_player.h1
-rw-r--r--scene/animation/animation_tree_player.cpp1
-rw-r--r--scene/animation/animation_tree_player.h1
-rw-r--r--scene/animation/tween.cpp2
-rw-r--r--scene/animation/tween.h1
-rw-r--r--scene/animation/tween_interpolaters.cpp1
-rw-r--r--scene/audio/audio_player.cpp1
-rw-r--r--scene/audio/audio_player.h1
-rw-r--r--scene/gui/base_button.cpp1
-rw-r--r--scene/gui/base_button.h1
-rw-r--r--scene/gui/box_container.cpp3
-rw-r--r--scene/gui/box_container.h1
-rw-r--r--scene/gui/button.cpp1
-rw-r--r--scene/gui/button.h1
-rw-r--r--scene/gui/button_array.cpp1
-rw-r--r--scene/gui/button_array.h1
-rw-r--r--scene/gui/button_group.cpp1
-rw-r--r--scene/gui/button_group.h1
-rw-r--r--scene/gui/center_container.cpp1
-rw-r--r--scene/gui/center_container.h1
-rw-r--r--scene/gui/check_box.cpp1
-rw-r--r--scene/gui/check_box.h1
-rw-r--r--scene/gui/check_button.cpp1
-rw-r--r--scene/gui/check_button.h1
-rw-r--r--scene/gui/color_picker.cpp3
-rw-r--r--scene/gui/color_picker.h1
-rw-r--r--scene/gui/color_ramp_edit.cpp3
-rw-r--r--scene/gui/color_ramp_edit.h1
-rw-r--r--scene/gui/color_rect.cpp1
-rw-r--r--scene/gui/color_rect.h1
-rw-r--r--scene/gui/container.cpp3
-rw-r--r--scene/gui/container.h1
-rw-r--r--scene/gui/control.cpp51
-rw-r--r--scene/gui/control.h9
-rw-r--r--scene/gui/dialogs.cpp63
-rw-r--r--scene/gui/dialogs.h1
-rw-r--r--scene/gui/file_dialog.cpp1
-rw-r--r--scene/gui/file_dialog.h1
-rw-r--r--scene/gui/graph_edit.cpp21
-rw-r--r--scene/gui/graph_edit.h1
-rw-r--r--scene/gui/graph_node.cpp1
-rw-r--r--scene/gui/graph_node.h1
-rw-r--r--scene/gui/grid_container.cpp1
-rw-r--r--scene/gui/grid_container.h1
-rw-r--r--scene/gui/input_action.cpp1
-rw-r--r--scene/gui/input_action.h1
-rw-r--r--scene/gui/item_list.cpp1
-rw-r--r--scene/gui/item_list.h1
-rw-r--r--scene/gui/label.cpp1
-rw-r--r--scene/gui/label.h1
-rw-r--r--scene/gui/line_edit.cpp3
-rw-r--r--scene/gui/line_edit.h1
-rw-r--r--scene/gui/link_button.cpp1
-rw-r--r--scene/gui/link_button.h1
-rw-r--r--scene/gui/margin_container.cpp1
-rw-r--r--scene/gui/margin_container.h1
-rw-r--r--scene/gui/menu_button.cpp7
-rw-r--r--scene/gui/menu_button.h1
-rw-r--r--scene/gui/option_button.cpp3
-rw-r--r--scene/gui/option_button.h1
-rw-r--r--scene/gui/panel.cpp1
-rw-r--r--scene/gui/panel.h1
-rw-r--r--scene/gui/panel_container.cpp1
-rw-r--r--scene/gui/panel_container.h1
-rw-r--r--scene/gui/patch_9_rect.cpp35
-rw-r--r--scene/gui/patch_9_rect.h1
-rw-r--r--scene/gui/popup.cpp17
-rw-r--r--scene/gui/popup.h1
-rw-r--r--scene/gui/popup_menu.cpp19
-rw-r--r--scene/gui/popup_menu.h1
-rw-r--r--scene/gui/progress_bar.cpp1
-rw-r--r--scene/gui/progress_bar.h1
-rw-r--r--scene/gui/range.cpp11
-rw-r--r--scene/gui/range.h1
-rw-r--r--scene/gui/reference_rect.cpp1
-rw-r--r--scene/gui/reference_rect.h1
-rw-r--r--scene/gui/rich_text_label.cpp3
-rw-r--r--scene/gui/rich_text_label.h1
-rw-r--r--scene/gui/scroll_bar.cpp3
-rw-r--r--scene/gui/scroll_bar.h1
-rw-r--r--scene/gui/scroll_container.cpp1
-rw-r--r--scene/gui/scroll_container.h1
-rw-r--r--scene/gui/separator.cpp1
-rw-r--r--scene/gui/separator.h1
-rw-r--r--scene/gui/slider.cpp1
-rw-r--r--scene/gui/slider.h1
-rw-r--r--scene/gui/spin_box.cpp1
-rw-r--r--scene/gui/spin_box.h1
-rw-r--r--scene/gui/split_container.cpp3
-rw-r--r--scene/gui/split_container.h1
-rw-r--r--scene/gui/tab_container.cpp5
-rw-r--r--scene/gui/tab_container.h1
-rw-r--r--scene/gui/tabs.cpp1
-rw-r--r--scene/gui/tabs.h1
-rw-r--r--scene/gui/text_edit.cpp171
-rw-r--r--scene/gui/text_edit.h17
-rw-r--r--scene/gui/texture_button.cpp1
-rw-r--r--scene/gui/texture_button.h1
-rw-r--r--scene/gui/texture_progress.cpp1
-rw-r--r--scene/gui/texture_progress.h1
-rw-r--r--scene/gui/texture_rect.cpp1
-rw-r--r--scene/gui/texture_rect.h1
-rw-r--r--scene/gui/tool_button.cpp1
-rw-r--r--scene/gui/tool_button.h1
-rw-r--r--scene/gui/tree.cpp27
-rw-r--r--scene/gui/tree.h1
-rw-r--r--scene/gui/video_player.cpp1
-rw-r--r--scene/gui/video_player.h1
-rw-r--r--scene/gui/viewport_container.cpp1
-rw-r--r--scene/gui/viewport_container.h1
-rw-r--r--scene/io/resource_format_image.cpp1
-rw-r--r--scene/io/resource_format_image.h1
-rw-r--r--scene/io/resource_format_wav.cpp5
-rw-r--r--scene/io/resource_format_wav.h1
-rw-r--r--scene/main/canvas_layer.cpp1
-rw-r--r--scene/main/canvas_layer.h1
-rw-r--r--scene/main/http_request.cpp3
-rw-r--r--scene/main/http_request.h1
-rw-r--r--scene/main/instance_placeholder.cpp1
-rw-r--r--scene/main/instance_placeholder.h1
-rwxr-xr-xscene/main/node.cpp10
-rw-r--r--scene/main/node.h1
-rw-r--r--scene/main/resource_preloader.cpp1
-rw-r--r--scene/main/resource_preloader.h1
-rw-r--r--scene/main/scene_main_loop.cpp53
-rw-r--r--scene/main/scene_main_loop.h23
-rwxr-xr-x[-rw-r--r--]scene/main/timer.cpp33
-rwxr-xr-x[-rw-r--r--]scene/main/timer.h10
-rw-r--r--scene/main/viewport.cpp19
-rw-r--r--scene/main/viewport.h3
-rw-r--r--scene/register_scene_types.cpp30
-rw-r--r--scene/register_scene_types.h1
-rw-r--r--scene/resources/animation.cpp1
-rw-r--r--scene/resources/animation.h1
-rw-r--r--scene/resources/audio_stream_resampled.cpp1
-rw-r--r--scene/resources/audio_stream_resampled.h1
-rw-r--r--scene/resources/audio_stream_sample.cpp3
-rw-r--r--scene/resources/audio_stream_sample.h1
-rw-r--r--scene/resources/baked_light.cpp1
-rw-r--r--scene/resources/baked_light.h1
-rw-r--r--scene/resources/bit_mask.cpp1
-rw-r--r--scene/resources/bit_mask.h1
-rw-r--r--scene/resources/bounds.cpp1
-rw-r--r--scene/resources/bounds.h1
-rw-r--r--scene/resources/box_shape.cpp1
-rw-r--r--scene/resources/box_shape.h1
-rw-r--r--scene/resources/canvas.cpp1
-rw-r--r--scene/resources/canvas.h1
-rw-r--r--scene/resources/capsule_shape.cpp1
-rw-r--r--scene/resources/capsule_shape.h1
-rw-r--r--scene/resources/capsule_shape_2d.cpp1
-rw-r--r--scene/resources/capsule_shape_2d.h1
-rw-r--r--scene/resources/circle_shape_2d.cpp1
-rw-r--r--scene/resources/circle_shape_2d.h1
-rw-r--r--scene/resources/color_ramp.cpp1
-rw-r--r--scene/resources/color_ramp.h1
-rw-r--r--scene/resources/concave_polygon_shape.cpp1
-rw-r--r--scene/resources/concave_polygon_shape.h1
-rw-r--r--scene/resources/concave_polygon_shape_2d.cpp1
-rw-r--r--scene/resources/concave_polygon_shape_2d.h1
-rw-r--r--scene/resources/convex_polygon_shape.cpp1
-rw-r--r--scene/resources/convex_polygon_shape.h1
-rw-r--r--scene/resources/convex_polygon_shape_2d.cpp1
-rw-r--r--scene/resources/convex_polygon_shape_2d.h1
-rw-r--r--scene/resources/curve.cpp1
-rw-r--r--scene/resources/curve.h7
-rw-r--r--scene/resources/default_theme/default_theme.cpp25
-rw-r--r--scene/resources/default_theme/default_theme.h1
-rwxr-xr-xscene/resources/default_theme/make_header.py2
-rw-r--r--scene/resources/dynamic_font.cpp27
-rw-r--r--scene/resources/dynamic_font.h2
-rw-r--r--scene/resources/dynamic_font_stb.cpp1
-rw-r--r--scene/resources/dynamic_font_stb.h1
-rw-r--r--scene/resources/environment.cpp1
-rw-r--r--scene/resources/environment.h1
-rw-r--r--scene/resources/font.cpp1
-rw-r--r--scene/resources/font.h1
-rw-r--r--scene/resources/gibberish_stream.cpp1
-rw-r--r--scene/resources/gibberish_stream.h1
-rw-r--r--scene/resources/material.cpp550
-rw-r--r--scene/resources/material.h89
-rw-r--r--scene/resources/mesh.cpp75
-rw-r--r--scene/resources/mesh.h17
-rw-r--r--scene/resources/mesh_data_tool.cpp1
-rw-r--r--scene/resources/mesh_data_tool.h1
-rw-r--r--scene/resources/mesh_library.cpp1
-rw-r--r--scene/resources/mesh_library.h1
-rw-r--r--scene/resources/multimesh.cpp1
-rw-r--r--scene/resources/multimesh.h1
-rw-r--r--scene/resources/packed_scene.cpp5
-rw-r--r--scene/resources/packed_scene.h1
-rw-r--r--scene/resources/plane_shape.cpp1
-rw-r--r--scene/resources/plane_shape.h1
-rw-r--r--scene/resources/polygon_path_finder.cpp1
-rw-r--r--scene/resources/polygon_path_finder.h1
-rw-r--r--scene/resources/ray_shape.cpp1
-rw-r--r--scene/resources/ray_shape.h1
-rw-r--r--scene/resources/rectangle_shape_2d.cpp1
-rw-r--r--scene/resources/rectangle_shape_2d.h1
-rw-r--r--scene/resources/room.cpp1
-rw-r--r--scene/resources/room.h1
-rw-r--r--scene/resources/scene_format_text.cpp1
-rw-r--r--scene/resources/scene_format_text.h1
-rw-r--r--scene/resources/segment_shape_2d.cpp1
-rw-r--r--scene/resources/segment_shape_2d.h1
-rw-r--r--scene/resources/shader.cpp20
-rw-r--r--scene/resources/shader.h32
-rw-r--r--scene/resources/shader_graph.cpp1
-rw-r--r--scene/resources/shader_graph.h1
-rw-r--r--scene/resources/shape.cpp1
-rw-r--r--scene/resources/shape.h1
-rw-r--r--scene/resources/shape_2d.cpp1
-rw-r--r--scene/resources/shape_2d.h1
-rw-r--r--scene/resources/shape_line_2d.cpp1
-rw-r--r--scene/resources/shape_line_2d.h1
-rw-r--r--scene/resources/sky_box.cpp1
-rw-r--r--scene/resources/sky_box.h1
-rw-r--r--scene/resources/space_2d.cpp1
-rw-r--r--scene/resources/space_2d.h1
-rw-r--r--scene/resources/sphere_shape.cpp1
-rw-r--r--scene/resources/sphere_shape.h1
-rw-r--r--scene/resources/style_box.cpp20
-rw-r--r--scene/resources/style_box.h1
-rw-r--r--scene/resources/surface_tool.cpp1
-rw-r--r--scene/resources/surface_tool.h1
-rw-r--r--scene/resources/texture.cpp487
-rw-r--r--scene/resources/texture.h142
-rw-r--r--scene/resources/theme.cpp1
-rw-r--r--scene/resources/theme.h1
-rw-r--r--scene/resources/tile_set.cpp13
-rw-r--r--scene/resources/tile_set.h7
-rw-r--r--scene/resources/video_stream.cpp1
-rw-r--r--scene/resources/video_stream.h1
-rw-r--r--scene/resources/world.cpp1
-rw-r--r--scene/resources/world.h1
-rw-r--r--scene/resources/world_2d.cpp1
-rw-r--r--scene/resources/world_2d.h1
-rw-r--r--scene/scene_string_names.cpp4
-rw-r--r--scene/scene_string_names.h4
382 files changed, 3729 insertions, 1188 deletions
diff --git a/scene/2d/animated_sprite.cpp b/scene/2d/animated_sprite.cpp
index f10bd2f303..eba638b0f5 100644
--- a/scene/2d/animated_sprite.cpp
+++ b/scene/2d/animated_sprite.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/2d/animated_sprite.h b/scene/2d/animated_sprite.h
index bc0e85b0ca..64794b0ca3 100644
--- a/scene/2d/animated_sprite.h
+++ b/scene/2d/animated_sprite.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/2d/area_2d.cpp b/scene/2d/area_2d.cpp
index 61e8ee16a2..8bce489624 100644
--- a/scene/2d/area_2d.cpp
+++ b/scene/2d/area_2d.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/2d/area_2d.h b/scene/2d/area_2d.h
index 2402ff763b..3efc1abbd4 100644
--- a/scene/2d/area_2d.h
+++ b/scene/2d/area_2d.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/2d/back_buffer_copy.cpp b/scene/2d/back_buffer_copy.cpp
index 5a79cee6d0..748a527ca0 100644
--- a/scene/2d/back_buffer_copy.cpp
+++ b/scene/2d/back_buffer_copy.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/2d/back_buffer_copy.h b/scene/2d/back_buffer_copy.h
index b4f83e7db1..4080f50696 100644
--- a/scene/2d/back_buffer_copy.h
+++ b/scene/2d/back_buffer_copy.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp
index f8388cdcc5..71f651b0a4 100644
--- a/scene/2d/camera_2d.cpp
+++ b/scene/2d/camera_2d.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/2d/camera_2d.h b/scene/2d/camera_2d.h
index 44cdb5cd99..686f40bedf 100644
--- a/scene/2d/camera_2d.h
+++ b/scene/2d/camera_2d.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp
index b52dd8d660..f699c8f0e8 100644
--- a/scene/2d/canvas_item.cpp
+++ b/scene/2d/canvas_item.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -37,124 +38,6 @@
#include "scene/scene_string_names.h"
#include "servers/visual_server.h"
-bool CanvasItemMaterial::_set(const StringName &p_name, const Variant &p_value) {
-
- if (p_name == SceneStringNames::get_singleton()->shader_shader) {
- set_shader(p_value);
- return true;
- } else {
-
- if (shader.is_valid()) {
-
- StringName pr = shader->remap_param(p_name);
- if (!pr) {
- String n = p_name;
- if (n.find("param/") == 0) { //backwards compatibility
- pr = n.substr(6, n.length());
- }
- }
- if (pr) {
- VisualServer::get_singleton()->material_set_param(_get_material(), pr, p_value);
- return true;
- }
- }
- }
-
- return false;
-}
-
-bool CanvasItemMaterial::_get(const StringName &p_name, Variant &r_ret) const {
-
- if (p_name == SceneStringNames::get_singleton()->shader_shader) {
-
- r_ret = get_shader();
- return true;
-
- } else {
-
- if (shader.is_valid()) {
-
- StringName pr = shader->remap_param(p_name);
- if (pr) {
- r_ret = VisualServer::get_singleton()->material_get_param(_get_material(), pr);
- return true;
- }
- }
- }
-
- return false;
-}
-
-void CanvasItemMaterial::_get_property_list(List<PropertyInfo> *p_list) const {
-
- p_list->push_back(PropertyInfo(Variant::OBJECT, "shader/shader", PROPERTY_HINT_RESOURCE_TYPE, "CanvasItemShader,CanvasItemShaderGraph"));
-
- if (!shader.is_null()) {
-
- shader->get_param_list(p_list);
- }
-}
-
-void CanvasItemMaterial::set_shader(const Ref<Shader> &p_shader) {
-
- ERR_FAIL_COND(p_shader.is_valid() && p_shader->get_mode() != Shader::MODE_CANVAS_ITEM);
-
- shader = p_shader;
-
- RID rid;
- if (shader.is_valid())
- rid = shader->get_rid();
-
- VS::get_singleton()->material_set_shader(_get_material(), rid);
- _change_notify(); //properties for shader exposed
- emit_changed();
-}
-
-Ref<Shader> CanvasItemMaterial::get_shader() const {
-
- return shader;
-}
-
-void CanvasItemMaterial::set_shader_param(const StringName &p_param, const Variant &p_value) {
-
- VS::get_singleton()->material_set_param(_get_material(), p_param, p_value);
-}
-
-Variant CanvasItemMaterial::get_shader_param(const StringName &p_param) const {
-
- return VS::get_singleton()->material_get_param(_get_material(), p_param);
-}
-
-void CanvasItemMaterial::_bind_methods() {
-
- ClassDB::bind_method(D_METHOD("set_shader", "shader:Shader"), &CanvasItemMaterial::set_shader);
- ClassDB::bind_method(D_METHOD("get_shader:Shader"), &CanvasItemMaterial::get_shader);
- ClassDB::bind_method(D_METHOD("set_shader_param", "param", "value"), &CanvasItemMaterial::set_shader_param);
- ClassDB::bind_method(D_METHOD("get_shader_param", "param"), &CanvasItemMaterial::get_shader_param);
-}
-
-void CanvasItemMaterial::get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const {
-
- String f = p_function.operator String();
- if ((f == "get_shader_param" || f == "set_shader_param") && p_idx == 0) {
-
- if (shader.is_valid()) {
- List<PropertyInfo> pl;
- shader->get_param_list(&pl);
- for (List<PropertyInfo>::Element *E = pl.front(); E; E = E->next()) {
- r_options->push_back("\"" + E->get().name.replace_first("shader_param/", "") + "\"");
- }
- }
- }
- Resource::get_argument_options(p_function, p_idx, r_options);
-}
-
-CanvasItemMaterial::CanvasItemMaterial() {
-}
-
-CanvasItemMaterial::~CanvasItemMaterial() {
-}
-
///////////////////////////////////////////////////////////////////
bool CanvasItem::is_visible_in_tree() const {
@@ -206,7 +89,7 @@ void CanvasItem::show() {
return;
_propagate_visibility_changed(true);
- _change_notify("visibility/visible");
+ _change_notify("visible");
}
void CanvasItem::hide() {
@@ -221,7 +104,7 @@ void CanvasItem::hide() {
return;
_propagate_visibility_changed(false);
- _change_notify("visibility/visible");
+ _change_notify("visible");
}
Variant CanvasItem::edit_get_state() const {
@@ -770,7 +653,7 @@ bool CanvasItem::is_draw_behind_parent_enabled() const {
return behind;
}
-void CanvasItem::set_material(const Ref<CanvasItemMaterial> &p_material) {
+void CanvasItem::set_material(const Ref<ShaderMaterial> &p_material) {
material = p_material;
RID rid;
@@ -791,7 +674,7 @@ bool CanvasItem::get_use_parent_material() const {
return use_parent_material;
}
-Ref<CanvasItemMaterial> CanvasItem::get_material() const {
+Ref<ShaderMaterial> CanvasItem::get_material() const {
return material;
}
@@ -800,9 +683,7 @@ Vector2 CanvasItem::make_canvas_pos_local(const Vector2 &screen_point) const {
ERR_FAIL_COND_V(!is_inside_tree(), screen_point);
- Transform2D local_matrix = (get_canvas_transform() *
- get_global_transform())
- .affine_inverse();
+ Transform2D local_matrix = (get_canvas_transform() * get_global_transform()).affine_inverse();
return local_matrix.xform(screen_point);
}
@@ -814,16 +695,16 @@ InputEvent CanvasItem::make_input_local(const InputEvent &p_event) const {
return p_event.xform_by((get_canvas_transform() * get_global_transform()).affine_inverse());
}
-Vector2 CanvasItem::get_global_mouse_pos() const {
+Vector2 CanvasItem::get_global_mouse_position() const {
ERR_FAIL_COND_V(!get_viewport(), Vector2());
- return get_canvas_transform().affine_inverse().xform(get_viewport()->get_mouse_pos());
+ return get_canvas_transform().affine_inverse().xform(get_viewport()->get_mouse_position());
}
Vector2 CanvasItem::get_local_mouse_pos() const {
ERR_FAIL_COND_V(!get_viewport(), Vector2());
- return get_global_transform().affine_inverse().xform(get_global_mouse_pos());
+ return get_global_transform().affine_inverse().xform(get_global_mouse_position());
}
void CanvasItem::_bind_methods() {
@@ -890,13 +771,13 @@ void CanvasItem::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_viewport_rect"), &CanvasItem::get_viewport_rect);
ClassDB::bind_method(D_METHOD("get_canvas_transform"), &CanvasItem::get_canvas_transform);
ClassDB::bind_method(D_METHOD("get_local_mouse_pos"), &CanvasItem::get_local_mouse_pos);
- ClassDB::bind_method(D_METHOD("get_global_mouse_pos"), &CanvasItem::get_global_mouse_pos);
+ ClassDB::bind_method(D_METHOD("get_global_mouse_position"), &CanvasItem::get_global_mouse_position);
ClassDB::bind_method(D_METHOD("get_canvas"), &CanvasItem::get_canvas);
ClassDB::bind_method(D_METHOD("get_world_2d"), &CanvasItem::get_world_2d);
//ClassDB::bind_method(D_METHOD("get_viewport"),&CanvasItem::get_viewport);
- ClassDB::bind_method(D_METHOD("set_material", "material:CanvasItemMaterial"), &CanvasItem::set_material);
- ClassDB::bind_method(D_METHOD("get_material:CanvasItemMaterial"), &CanvasItem::get_material);
+ ClassDB::bind_method(D_METHOD("set_material", "material:ShaderMaterial"), &CanvasItem::set_material);
+ ClassDB::bind_method(D_METHOD("get_material:ShaderMaterial"), &CanvasItem::get_material);
ClassDB::bind_method(D_METHOD("set_use_parent_material", "enable"), &CanvasItem::set_use_parent_material);
ClassDB::bind_method(D_METHOD("get_use_parent_material"), &CanvasItem::get_use_parent_material);
@@ -922,7 +803,7 @@ void CanvasItem::_bind_methods() {
ADD_PROPERTYNO(PropertyInfo(Variant::INT, "light_mask", PROPERTY_HINT_LAYERS_2D_RENDER), "set_light_mask", "get_light_mask");
ADD_GROUP("Material", "");
- ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "CanvasItemMaterial"), "set_material", "get_material");
+ ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "ShaderMaterial"), "set_material", "get_material");
ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "use_parent_material"), "set_use_parent_material", "get_use_parent_material");
//exporting these two things doesn't really make much sense i think
//ADD_PROPERTY( PropertyInfo(Variant::BOOL,"transform/toplevel"), "set_as_toplevel","is_set_as_toplevel") ;
diff --git a/scene/2d/canvas_item.h b/scene/2d/canvas_item.h
index a188ce495a..72fe5b93da 100644
--- a/scene/2d/canvas_item.h
+++ b/scene/2d/canvas_item.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -41,38 +42,6 @@ class Font;
class StyleBox;
-class CanvasItemMaterial : public Material {
-
- GDCLASS(CanvasItemMaterial, Material);
- Ref<Shader> shader;
-
-public:
- /*enum ShadingMode {
- SHADING_NORMAL,
- SHADING_UNSHADED,
- SHADING_ONLY_LIGHT,
- };*/
-
-protected:
- bool _set(const StringName &p_name, const Variant &p_value);
- bool _get(const StringName &p_name, Variant &r_ret) const;
- void _get_property_list(List<PropertyInfo> *p_list) const;
-
- static void _bind_methods();
-
- void get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const;
-
-public:
- void set_shader(const Ref<Shader> &p_shader);
- Ref<Shader> get_shader() const;
-
- void set_shader_param(const StringName &p_param, const Variant &p_value);
- Variant get_shader_param(const StringName &p_param) const;
-
- CanvasItemMaterial();
- ~CanvasItemMaterial();
-};
-
class CanvasItem : public Node {
GDCLASS(CanvasItem, Node);
@@ -114,7 +83,7 @@ private:
bool notify_local_transform;
bool notify_transform;
- Ref<CanvasItemMaterial> material;
+ Ref<ShaderMaterial> material;
mutable Transform2D global_transform;
mutable bool global_invalid;
@@ -234,8 +203,8 @@ public:
RID get_canvas() const;
Ref<World2D> get_world_2d() const;
- void set_material(const Ref<CanvasItemMaterial> &p_material);
- Ref<CanvasItemMaterial> get_material() const;
+ void set_material(const Ref<ShaderMaterial> &p_material);
+ Ref<ShaderMaterial> get_material() const;
void set_use_parent_material(bool p_use_parent_material);
bool get_use_parent_material() const;
@@ -243,7 +212,7 @@ public:
InputEvent make_input_local(const InputEvent &pevent) const;
Vector2 make_canvas_pos_local(const Vector2 &screen_point) const;
- Vector2 get_global_mouse_pos() const;
+ Vector2 get_global_mouse_position() const;
Vector2 get_local_mouse_pos() const;
void set_notify_local_transform(bool p_enable);
diff --git a/scene/2d/canvas_modulate.cpp b/scene/2d/canvas_modulate.cpp
index a0e3061c85..a132c5e18c 100644
--- a/scene/2d/canvas_modulate.cpp
+++ b/scene/2d/canvas_modulate.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/2d/canvas_modulate.h b/scene/2d/canvas_modulate.h
index 8e62b5ccb9..37d9d47ba5 100644
--- a/scene/2d/canvas_modulate.h
+++ b/scene/2d/canvas_modulate.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/2d/collision_object_2d.cpp b/scene/2d/collision_object_2d.cpp
index 1242599d46..afbdfec45e 100644
--- a/scene/2d/collision_object_2d.cpp
+++ b/scene/2d/collision_object_2d.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/2d/collision_object_2d.h b/scene/2d/collision_object_2d.h
index e6ea0f42d3..e3dc39feae 100644
--- a/scene/2d/collision_object_2d.h
+++ b/scene/2d/collision_object_2d.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/2d/collision_polygon_2d.cpp b/scene/2d/collision_polygon_2d.cpp
index abc044f10f..b54861a314 100644
--- a/scene/2d/collision_polygon_2d.cpp
+++ b/scene/2d/collision_polygon_2d.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/2d/collision_polygon_2d.h b/scene/2d/collision_polygon_2d.h
index f1f31a2854..b1a4a4822d 100644
--- a/scene/2d/collision_polygon_2d.h
+++ b/scene/2d/collision_polygon_2d.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/2d/collision_shape_2d.cpp b/scene/2d/collision_shape_2d.cpp
index 39e0017e92..1687a898db 100644
--- a/scene/2d/collision_shape_2d.cpp
+++ b/scene/2d/collision_shape_2d.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/2d/collision_shape_2d.h b/scene/2d/collision_shape_2d.h
index a3395cdc1e..3e63981010 100644
--- a/scene/2d/collision_shape_2d.h
+++ b/scene/2d/collision_shape_2d.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/2d/joints_2d.cpp b/scene/2d/joints_2d.cpp
index 96ef714f1b..1bb40a28b5 100644
--- a/scene/2d/joints_2d.cpp
+++ b/scene/2d/joints_2d.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/2d/joints_2d.h b/scene/2d/joints_2d.h
index c172620461..b52b0f4670 100644
--- a/scene/2d/joints_2d.h
+++ b/scene/2d/joints_2d.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/2d/light_2d.cpp b/scene/2d/light_2d.cpp
index 7cf98c8c09..34413074c1 100644
--- a/scene/2d/light_2d.cpp
+++ b/scene/2d/light_2d.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/2d/light_2d.h b/scene/2d/light_2d.h
index e9f0e069d4..9b09d54dd8 100644
--- a/scene/2d/light_2d.h
+++ b/scene/2d/light_2d.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/2d/light_occluder_2d.cpp b/scene/2d/light_occluder_2d.cpp
index 401bbcedb2..f1df2b0daf 100644
--- a/scene/2d/light_occluder_2d.cpp
+++ b/scene/2d/light_occluder_2d.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/2d/light_occluder_2d.h b/scene/2d/light_occluder_2d.h
index 26135334fc..30c30b1a47 100644
--- a/scene/2d/light_occluder_2d.h
+++ b/scene/2d/light_occluder_2d.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/2d/line_2d.cpp b/scene/2d/line_2d.cpp
index cd9b8e8cb9..c782968ea0 100644
--- a/scene/2d/line_2d.cpp
+++ b/scene/2d/line_2d.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/2d/line_2d.h b/scene/2d/line_2d.h
index 2cd71e9727..fee1cad942 100644
--- a/scene/2d/line_2d.h
+++ b/scene/2d/line_2d.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/2d/line_builder.cpp b/scene/2d/line_builder.cpp
index 0912f6cfe8..add476ae0f 100644
--- a/scene/2d/line_builder.cpp
+++ b/scene/2d/line_builder.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -515,7 +516,7 @@ void LineBuilder::strip_add_arc(Vector2 center, float angle_delta, Orientation o
void LineBuilder::new_arc(Vector2 center, Vector2 vbegin, float angle_delta, Color color, Rect2 uv_rect) {
// Make a standalone arc that doesn't use existing vertices,
- // with undistorted UVs from withing a square section
+ // with undistorted UVs from within a square section
float radius = vbegin.length();
float angle_step = Math_PI / static_cast<float>(round_precision);
diff --git a/scene/2d/line_builder.h b/scene/2d/line_builder.h
index 43fd281d99..eed9cac0aa 100644
--- a/scene/2d/line_builder.h
+++ b/scene/2d/line_builder.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/2d/navigation2d.cpp b/scene/2d/navigation2d.cpp
index f0280a2f81..bfe5a359f7 100644
--- a/scene/2d/navigation2d.cpp
+++ b/scene/2d/navigation2d.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/2d/navigation2d.h b/scene/2d/navigation2d.h
index afa565518d..e5d71f48c3 100644
--- a/scene/2d/navigation2d.h
+++ b/scene/2d/navigation2d.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/2d/navigation_polygon.cpp b/scene/2d/navigation_polygon.cpp
index 570bd00a5b..aec6d7108b 100644
--- a/scene/2d/navigation_polygon.cpp
+++ b/scene/2d/navigation_polygon.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/2d/navigation_polygon.h b/scene/2d/navigation_polygon.h
index 6bc3b903c7..f6e6ed210a 100644
--- a/scene/2d/navigation_polygon.h
+++ b/scene/2d/navigation_polygon.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/2d/node_2d.cpp b/scene/2d/node_2d.cpp
index 1ba6ec46cf..ec286b1d54 100644
--- a/scene/2d/node_2d.cpp
+++ b/scene/2d/node_2d.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -63,9 +64,10 @@ void Node2D::edit_set_state(const Variant &p_state) {
angle = state[1];
_scale = state[2];
_update_transform();
- _change_notify("transform/rot");
- _change_notify("transform/scale");
- _change_notify("transform/pos");
+ _change_notify("rotation");
+ _change_notify("rotation_deg");
+ _change_notify("scale");
+ _change_notify("position");
}
void Node2D::edit_set_rect(const Rect2 &p_edit_rect) {
@@ -95,15 +97,16 @@ void Node2D::edit_set_rect(const Rect2 &p_edit_rect) {
_scale *= new_scale;
_update_transform();
- _change_notify("transform/scale");
- _change_notify("transform/pos");
+ _change_notify("scale");
+ _change_notify("position");
}
void Node2D::edit_rotate(float p_rot) {
angle += p_rot;
_update_transform();
- _change_notify("transform/rot");
+ _change_notify("rotation");
+ _change_notify("rotation_deg");
}
void Node2D::_update_xform_values() {
@@ -134,7 +137,7 @@ void Node2D::set_position(const Point2 &p_pos) {
((Node2D *)this)->_update_xform_values();
pos = p_pos;
_update_transform();
- _change_notify("transform/pos");
+ _change_notify("position");
}
void Node2D::set_rotation(float p_radians) {
@@ -143,7 +146,8 @@ void Node2D::set_rotation(float p_radians) {
((Node2D *)this)->_update_xform_values();
angle = p_radians;
_update_transform();
- _change_notify("transform/rot");
+ _change_notify("rotation");
+ _change_notify("rotation_deg");
}
void Node2D::set_rotation_in_degrees(float p_degrees) {
@@ -169,7 +173,7 @@ void Node2D::set_scale(const Size2 &p_scale) {
if (_scale.y == 0)
_scale.y = CMP_EPSILON;
_update_transform();
- _change_notify("transform/scale");
+ _change_notify("scale");
}
Point2 Node2D::get_position() const {
@@ -349,6 +353,7 @@ void Node2D::set_z(int p_z) {
ERR_FAIL_COND(p_z > VS::CANVAS_ITEM_Z_MAX);
z = p_z;
VS::get_singleton()->canvas_item_set_z(get_canvas_item(), z);
+ _change_notify("z");
}
void Node2D::set_z_as_relative(bool p_enabled) {
diff --git a/scene/2d/node_2d.h b/scene/2d/node_2d.h
index b9c6894333..65331a4d58 100644
--- a/scene/2d/node_2d.h
+++ b/scene/2d/node_2d.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/2d/parallax_background.cpp b/scene/2d/parallax_background.cpp
index 17bc26aa7f..433ab5ff8d 100644
--- a/scene/2d/parallax_background.cpp
+++ b/scene/2d/parallax_background.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/2d/parallax_background.h b/scene/2d/parallax_background.h
index 5914c21c95..99d8dd3811 100644
--- a/scene/2d/parallax_background.h
+++ b/scene/2d/parallax_background.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/2d/parallax_layer.cpp b/scene/2d/parallax_layer.cpp
index 2387234607..0e83b9aaae 100644
--- a/scene/2d/parallax_layer.cpp
+++ b/scene/2d/parallax_layer.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/2d/parallax_layer.h b/scene/2d/parallax_layer.h
index 01293e85ac..85e70b0a51 100644
--- a/scene/2d/parallax_layer.h
+++ b/scene/2d/parallax_layer.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/2d/particles_2d.cpp b/scene/2d/particles_2d.cpp
index c9d5bebe56..b91d9b835c 100644
--- a/scene/2d/particles_2d.cpp
+++ b/scene/2d/particles_2d.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -570,13 +571,13 @@ void Particles2D::_notification(int p_what) {
src_rect.pos.x = size.x * (frame % h_frames);
src_rect.pos.y = size.y * (frame / h_frames);
}
-
+ Rect2 dst_rect(Point2(), size);
if (flip_h)
- src_rect.size.x = -src_rect.size.x;
+ dst_rect.size.x = -dst_rect.size.x;
if (flip_v)
- src_rect.size.y = -src_rect.size.y;
+ dst_rect.size.y = -dst_rect.size.y;
- texture->draw_rect_region(ci, Rect2(Point2(), size), src_rect, color);
+ texture->draw_rect_region(ci, dst_rect, src_rect, color);
//VisualServer::get_singleton()->canvas_item_add_texture_rect(ci,r,texrid,false,color);
} else {
VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(), size), color);
@@ -1045,7 +1046,7 @@ void Particles2D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "config/amount", PROPERTY_HINT_EXP_RANGE, "1,1024"), "set_amount", "get_amount");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "config/lifetime", PROPERTY_HINT_EXP_RANGE, "0.1,3600,0.1"), "set_lifetime", "get_lifetime");
ADD_PROPERTYNO(PropertyInfo(Variant::REAL, "config/time_scale", PROPERTY_HINT_EXP_RANGE, "0.01,128,0.01"), "set_time_scale", "get_time_scale");
- ADD_PROPERTYNZ(PropertyInfo(Variant::REAL, "config/preprocess", PROPERTY_HINT_EXP_RANGE, "0.1,3600,0.1"), "set_pre_process_time", "get_pre_process_time");
+ ADD_PROPERTYNZ(PropertyInfo(Variant::REAL, "config/preprocess", PROPERTY_HINT_EXP_RANGE, "0,3600,0.1"), "set_pre_process_time", "get_pre_process_time");
ADD_PROPERTYNZ(PropertyInfo(Variant::REAL, "config/emit_timeout", PROPERTY_HINT_RANGE, "0,3600,0.1"), "set_emit_timeout", "get_emit_timeout");
ADD_PROPERTYNO(PropertyInfo(Variant::BOOL, "config/emitting"), "set_emitting", "is_emitting");
ADD_PROPERTY(PropertyInfo(Variant::INT, "config/process_mode", PROPERTY_HINT_ENUM, "Fixed,Idle"), "set_process_mode", "get_process_mode");
diff --git a/scene/2d/particles_2d.h b/scene/2d/particles_2d.h
index 0cf4063cef..4b87a26195 100644
--- a/scene/2d/particles_2d.h
+++ b/scene/2d/particles_2d.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/2d/path_2d.cpp b/scene/2d/path_2d.cpp
index 9e8be7fa1a..0b486bd821 100644
--- a/scene/2d/path_2d.cpp
+++ b/scene/2d/path_2d.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/2d/path_2d.h b/scene/2d/path_2d.h
index 7357b6810e..b2dae17735 100644
--- a/scene/2d/path_2d.h
+++ b/scene/2d/path_2d.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/2d/path_texture.cpp b/scene/2d/path_texture.cpp
index 60efccec3d..e06c79dabd 100644
--- a/scene/2d/path_texture.cpp
+++ b/scene/2d/path_texture.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/2d/path_texture.h b/scene/2d/path_texture.h
index 8d5adc49c8..163e914e4a 100644
--- a/scene/2d/path_texture.h
+++ b/scene/2d/path_texture.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp
index 88845a7290..f752cbf6b6 100644
--- a/scene/2d/physics_body_2d.cpp
+++ b/scene/2d/physics_body_2d.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -1168,7 +1169,7 @@ Vector2 KinematicBody2D::move(const Vector2 &p_motion) {
#endif
}
-Vector2 KinematicBody2D::move_and_slide(const Vector2 &p_linear_velocity, const Vector2 &p_floor_direction, float p_slope_stop_min_velocity, int p_max_bounces) {
+Vector2 KinematicBody2D::move_and_slide(const Vector2 &p_linear_velocity, const Vector2 &p_floor_direction, float p_slope_stop_min_velocity, int p_max_bounces, float p_floor_max_angle) {
Vector2 motion = (move_and_slide_floor_velocity + p_linear_velocity) * get_fixed_process_delta_time();
Vector2 lv = p_linear_velocity;
@@ -1189,7 +1190,7 @@ Vector2 KinematicBody2D::move_and_slide(const Vector2 &p_linear_velocity, const
//all is a wall
move_and_slide_on_wall = true;
} else {
- if (get_collision_normal().dot(p_floor_direction) > Math::cos(Math::deg2rad((float)45))) { //floor
+ if (get_collision_normal().dot(p_floor_direction) >= Math::cos(p_floor_max_angle)) { //floor
move_and_slide_on_floor = true;
move_and_slide_floor_velocity = get_collider_velocity();
@@ -1198,15 +1199,16 @@ Vector2 KinematicBody2D::move_and_slide(const Vector2 &p_linear_velocity, const
revert_motion();
return Vector2();
}
- } else if (get_collision_normal().dot(p_floor_direction) < Math::cos(Math::deg2rad((float)45))) { //ceiling
+ } else if (get_collision_normal().dot(-p_floor_direction) <= Math::cos(p_floor_max_angle)) { //ceiling
move_and_slide_on_ceiling = true;
} else {
move_and_slide_on_wall = true;
}
}
- motion = get_collision_normal().slide(motion);
- lv = get_collision_normal().slide(lv);
+ Vector2 n = get_collision_normal();
+ motion = motion.slide(n);
+ lv = lv.slide(n);
Variant collider = _get_collider();
if (collider.get_type() != Variant::NIL) {
move_and_slide_colliders.push_back(collider);
@@ -1307,7 +1309,7 @@ void KinematicBody2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("move", "rel_vec"), &KinematicBody2D::move);
ClassDB::bind_method(D_METHOD("move_to", "position"), &KinematicBody2D::move_to);
- ClassDB::bind_method(D_METHOD("move_and_slide", "linear_velocity", "floor_normal", "slope_stop_min_velocity", "max_bounces"), &KinematicBody2D::move_and_slide, DEFVAL(Vector2(0, 0)), DEFVAL(5), DEFVAL(4));
+ ClassDB::bind_method(D_METHOD("move_and_slide", "linear_velocity", "floor_normal", "slope_stop_min_velocity", "max_bounces", "floor_max_angle"), &KinematicBody2D::move_and_slide, DEFVAL(Vector2(0, 0)), DEFVAL(5), DEFVAL(4), DEFVAL(Math::deg2rad((float)45)));
ClassDB::bind_method(D_METHOD("test_move", "from", "rel_vec"), &KinematicBody2D::test_move);
ClassDB::bind_method(D_METHOD("get_travel"), &KinematicBody2D::get_travel);
diff --git a/scene/2d/physics_body_2d.h b/scene/2d/physics_body_2d.h
index e51b512302..f706111e7e 100644
--- a/scene/2d/physics_body_2d.h
+++ b/scene/2d/physics_body_2d.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -314,7 +315,7 @@ public:
void set_collision_margin(float p_margin);
float get_collision_margin() const;
- Vector2 move_and_slide(const Vector2 &p_linear_velocity, const Vector2 &p_floor_direction = Vector2(0, 0), float p_slope_stop_min_velocity = 5, int p_max_bounces = 4);
+ Vector2 move_and_slide(const Vector2 &p_linear_velocity, const Vector2 &p_floor_direction = Vector2(0, 0), float p_slope_stop_min_velocity = 5, int p_max_bounces = 4, float p_floor_max_angle = Math::deg2rad((float)45));
bool is_move_and_slide_on_floor() const;
bool is_move_and_slide_on_wall() const;
bool is_move_and_slide_on_ceiling() const;
diff --git a/scene/2d/polygon_2d.cpp b/scene/2d/polygon_2d.cpp
index 1d54fd1538..cb3e67f895 100644
--- a/scene/2d/polygon_2d.cpp
+++ b/scene/2d/polygon_2d.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/2d/polygon_2d.h b/scene/2d/polygon_2d.h
index 50968f3de4..f2cc9452b9 100644
--- a/scene/2d/polygon_2d.h
+++ b/scene/2d/polygon_2d.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/2d/position_2d.cpp b/scene/2d/position_2d.cpp
index 39fc6352e9..74ad9c17e2 100644
--- a/scene/2d/position_2d.cpp
+++ b/scene/2d/position_2d.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/2d/position_2d.h b/scene/2d/position_2d.h
index a9ead3d87f..67ff2c610d 100644
--- a/scene/2d/position_2d.h
+++ b/scene/2d/position_2d.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/2d/ray_cast_2d.cpp b/scene/2d/ray_cast_2d.cpp
index 83a0717acf..792861cbf3 100644
--- a/scene/2d/ray_cast_2d.cpp
+++ b/scene/2d/ray_cast_2d.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/2d/ray_cast_2d.h b/scene/2d/ray_cast_2d.h
index 6a59ef963b..cfecfa2585 100644
--- a/scene/2d/ray_cast_2d.h
+++ b/scene/2d/ray_cast_2d.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/2d/remote_transform_2d.cpp b/scene/2d/remote_transform_2d.cpp
index 210f64ae23..3cb9ebb5b5 100644
--- a/scene/2d/remote_transform_2d.cpp
+++ b/scene/2d/remote_transform_2d.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/2d/remote_transform_2d.h b/scene/2d/remote_transform_2d.h
index aa1b214314..375efabf2f 100644
--- a/scene/2d/remote_transform_2d.h
+++ b/scene/2d/remote_transform_2d.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/2d/screen_button.cpp b/scene/2d/screen_button.cpp
index db822ed306..7712108488 100644
--- a/scene/2d/screen_button.cpp
+++ b/scene/2d/screen_button.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -65,12 +66,14 @@ Ref<BitMap> TouchScreenButton::get_bitmask() const {
void TouchScreenButton::set_shape(const Ref<Shape2D> &p_shape) {
+ if (shape.is_valid())
+ shape->disconnect("changed", this, "update");
+
shape = p_shape;
- if (!is_inside_tree())
- return;
- if (!get_tree()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint())
- return;
+ if (shape.is_valid())
+ shape->connect("changed", this, "update");
+
update();
}
@@ -82,11 +85,17 @@ Ref<Shape2D> TouchScreenButton::get_shape() const {
void TouchScreenButton::set_shape_centered(bool p_shape_centered) {
shape_centered = p_shape_centered;
+ update();
+}
- if (!is_inside_tree())
- return;
- if (!get_tree()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint())
- return;
+bool TouchScreenButton::is_shape_visible() const {
+
+ return shape_visible;
+}
+
+void TouchScreenButton::set_shape_visible(bool p_shape_visible) {
+
+ shape_visible = p_shape_visible;
update();
}
@@ -118,6 +127,8 @@ void TouchScreenButton::_notification(int p_what) {
draw_texture(texture, Point2());
}
+ if (!shape_visible)
+ return;
if (!get_tree()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint())
return;
if (shape.is_valid()) {
@@ -375,6 +386,9 @@ void TouchScreenButton::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_shape_centered", "bool"), &TouchScreenButton::set_shape_centered);
ClassDB::bind_method(D_METHOD("is_shape_centered"), &TouchScreenButton::is_shape_centered);
+ ClassDB::bind_method(D_METHOD("set_shape_visible", "bool"), &TouchScreenButton::set_shape_visible);
+ ClassDB::bind_method(D_METHOD("is_shape_visible"), &TouchScreenButton::is_shape_visible);
+
ClassDB::bind_method(D_METHOD("set_action", "action"), &TouchScreenButton::set_action);
ClassDB::bind_method(D_METHOD("get_action"), &TouchScreenButton::get_action);
@@ -393,6 +407,7 @@ void TouchScreenButton::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "bitmask", PROPERTY_HINT_RESOURCE_TYPE, "BitMap"), "set_bitmask", "get_bitmask");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "shape", PROPERTY_HINT_RESOURCE_TYPE, "Shape2D"), "set_shape", "get_shape");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "shape_centered"), "set_shape_centered", "is_shape_centered");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "shape_visible"), "set_shape_visible", "is_shape_visible");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "passby_press"), "set_passby_press", "is_passby_press_enabled");
ADD_PROPERTY(PropertyInfo(Variant::STRING, "action"), "set_action", "get_action");
ADD_PROPERTY(PropertyInfo(Variant::INT, "visibility_mode", PROPERTY_HINT_ENUM, "Always,TouchScreen Only"), "set_visibility_mode", "get_visibility_mode");
@@ -408,6 +423,7 @@ TouchScreenButton::TouchScreenButton() {
passby_press = false;
visibility = VISIBILITY_ALWAYS;
shape_centered = true;
+ shape_visible = true;
unit_rect = Ref<RectangleShape2D>(memnew(RectangleShape2D));
unit_rect->set_extents(Vector2(0.5, 0.5));
}
diff --git a/scene/2d/screen_button.h b/scene/2d/screen_button.h
index 201d908bf6..0cfaf681dd 100644
--- a/scene/2d/screen_button.h
+++ b/scene/2d/screen_button.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -50,6 +51,7 @@ private:
Ref<BitMap> bitmask;
Ref<Shape2D> shape;
bool shape_centered;
+ bool shape_visible;
Ref<RectangleShape2D> unit_rect;
@@ -85,6 +87,9 @@ public:
void set_shape_centered(bool p_shape_centered);
bool is_shape_centered() const;
+ void set_shape_visible(bool p_shape_visible);
+ bool is_shape_visible() const;
+
void set_action(const String &p_action);
String get_action() const;
diff --git a/scene/2d/sprite.cpp b/scene/2d/sprite.cpp
index 41ea6a39e5..1735bf3b91 100644
--- a/scene/2d/sprite.cpp
+++ b/scene/2d/sprite.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/2d/sprite.h b/scene/2d/sprite.h
index c4bc800647..86ef335d42 100644
--- a/scene/2d/sprite.h
+++ b/scene/2d/sprite.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp
index 02b41fbd0c..080276eb25 100644
--- a/scene/2d/tile_map.cpp
+++ b/scene/2d/tile_map.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -304,7 +305,7 @@ void TileMap::_update_dirty_quadrants() {
VS::get_singleton()->free(E->get().id);
}
q.occluder_instances.clear();
- Ref<CanvasItemMaterial> prev_material;
+ Ref<ShaderMaterial> prev_material;
RID prev_canvas_item;
RID prev_debug_canvas_item;
@@ -324,7 +325,7 @@ void TileMap::_update_dirty_quadrants() {
if (!tex.is_valid())
continue;
- Ref<CanvasItemMaterial> mat = tile_set->tile_get_material(c.id);
+ Ref<ShaderMaterial> mat = tile_set->tile_get_material(c.id);
RID canvas_item;
RID debug_canvas_item;
@@ -876,6 +877,26 @@ void TileMap::set_collision_mask(uint32_t p_mask) {
}
}
+void TileMap::set_collision_layer_bit(int p_bit, bool p_value) {
+
+ uint32_t layer = get_collision_layer();
+ if (p_value)
+ layer |= 1 << p_bit;
+ else
+ layer &= ~(1 << p_bit);
+ set_collision_layer(layer);
+}
+
+void TileMap::set_collision_mask_bit(int p_bit, bool p_value) {
+
+ uint32_t mask = get_collision_mask();
+ if (p_value)
+ mask |= 1 << p_bit;
+ else
+ mask &= ~(1 << p_bit);
+ set_collision_mask(mask);
+}
+
bool TileMap::get_collision_use_kinematic() const {
return use_kinematic;
@@ -927,6 +948,16 @@ uint32_t TileMap::get_collision_mask() const {
return collision_mask;
}
+bool TileMap::get_collision_layer_bit(int p_bit) const {
+
+ return get_collision_layer() & (1 << p_bit);
+}
+
+bool TileMap::get_collision_mask_bit(int p_bit) const {
+
+ return get_collision_mask() & (1 << p_bit);
+}
+
void TileMap::set_mode(Mode p_mode) {
_clear_quadrants();
@@ -1196,12 +1227,18 @@ void TileMap::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_collision_use_kinematic", "use_kinematic"), &TileMap::set_collision_use_kinematic);
ClassDB::bind_method(D_METHOD("get_collision_use_kinematic"), &TileMap::get_collision_use_kinematic);
- ClassDB::bind_method(D_METHOD("set_collision_layer", "mask"), &TileMap::set_collision_layer);
+ ClassDB::bind_method(D_METHOD("set_collision_layer", "layer"), &TileMap::set_collision_layer);
ClassDB::bind_method(D_METHOD("get_collision_layer"), &TileMap::get_collision_layer);
ClassDB::bind_method(D_METHOD("set_collision_mask", "mask"), &TileMap::set_collision_mask);
ClassDB::bind_method(D_METHOD("get_collision_mask"), &TileMap::get_collision_mask);
+ ClassDB::bind_method(D_METHOD("set_collision_layer_bit", "bit", "value"), &TileMap::set_collision_layer_bit);
+ ClassDB::bind_method(D_METHOD("get_collision_layer_bit", "bit"), &TileMap::get_collision_layer_bit);
+
+ ClassDB::bind_method(D_METHOD("set_collision_mask_bit", "bit", "value"), &TileMap::set_collision_mask_bit);
+ ClassDB::bind_method(D_METHOD("get_collision_mask_bit", "bit"), &TileMap::get_collision_mask_bit);
+
ClassDB::bind_method(D_METHOD("set_collision_friction", "value"), &TileMap::set_collision_friction);
ClassDB::bind_method(D_METHOD("get_collision_friction"), &TileMap::get_collision_friction);
diff --git a/scene/2d/tile_map.h b/scene/2d/tile_map.h
index f52adcd510..3468854a61 100644
--- a/scene/2d/tile_map.h
+++ b/scene/2d/tile_map.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -232,6 +233,12 @@ public:
void set_collision_mask(uint32_t p_mask);
uint32_t get_collision_mask() const;
+ void set_collision_layer_bit(int p_bit, bool p_value);
+ bool get_collision_layer_bit(int p_bit) const;
+
+ void set_collision_mask_bit(int p_bit, bool p_value);
+ bool get_collision_mask_bit(int p_bit) const;
+
void set_collision_use_kinematic(bool p_use_kinematic);
bool get_collision_use_kinematic() const;
diff --git a/scene/2d/visibility_notifier_2d.cpp b/scene/2d/visibility_notifier_2d.cpp
index f20a995d5f..a37c74cb07 100644
--- a/scene/2d/visibility_notifier_2d.cpp
+++ b/scene/2d/visibility_notifier_2d.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/2d/visibility_notifier_2d.h b/scene/2d/visibility_notifier_2d.h
index aa49497404..38da69faef 100644
--- a/scene/2d/visibility_notifier_2d.h
+++ b/scene/2d/visibility_notifier_2d.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/2d/y_sort.cpp b/scene/2d/y_sort.cpp
index 760139287c..f258b7e2e0 100644
--- a/scene/2d/y_sort.cpp
+++ b/scene/2d/y_sort.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/2d/y_sort.h b/scene/2d/y_sort.h
index c919788498..3564cfc151 100644
--- a/scene/2d/y_sort.h
+++ b/scene/2d/y_sort.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/area.cpp b/scene/3d/area.cpp
index c42ca2f3f0..8dae078e5b 100644
--- a/scene/3d/area.cpp
+++ b/scene/3d/area.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/area.h b/scene/3d/area.h
index a50f101ec1..64bbae9236 100644
--- a/scene/3d/area.h
+++ b/scene/3d/area.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/baked_light_instance.cpp b/scene/3d/baked_light_instance.cpp
index ac424475ea..ffa7597113 100644
--- a/scene/3d/baked_light_instance.cpp
+++ b/scene/3d/baked_light_instance.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -250,7 +251,7 @@ Vector<Color> BakedLight::_get_bake_texture(Image &p_image, const Color &p_color
BakedLight::MaterialCache BakedLight::_get_material_cache(Ref<Material> p_material) {
//this way of obtaining materials is inaccurate and also does not support some compressed formats very well
- Ref<FixedSpatialMaterial> mat = p_material;
+ Ref<SpatialMaterial> mat = p_material;
Ref<Material> material = mat; //hack for now
@@ -262,7 +263,7 @@ BakedLight::MaterialCache BakedLight::_get_material_cache(Ref<Material> p_materi
if (mat.is_valid()) {
- Ref<ImageTexture> albedo_tex = mat->get_texture(FixedSpatialMaterial::TEXTURE_ALBEDO);
+ Ref<ImageTexture> albedo_tex = mat->get_texture(SpatialMaterial::TEXTURE_ALBEDO);
Image img_albedo;
if (albedo_tex.is_valid()) {
@@ -272,7 +273,7 @@ BakedLight::MaterialCache BakedLight::_get_material_cache(Ref<Material> p_materi
mc.albedo = _get_bake_texture(img_albedo, mat->get_albedo());
- Ref<ImageTexture> emission_tex = mat->get_texture(FixedSpatialMaterial::TEXTURE_EMISSION);
+ Ref<ImageTexture> emission_tex = mat->get_texture(SpatialMaterial::TEXTURE_EMISSION);
Color emission_col = mat->get_emission();
emission_col.r *= mat->get_emission_energy();
@@ -1591,11 +1592,11 @@ void BakedLight::create_debug_mesh(DebugMode p_mode) {
}
{
- Ref<FixedSpatialMaterial> fsm;
+ Ref<SpatialMaterial> fsm;
fsm.instance();
- fsm->set_flag(FixedSpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true);
- fsm->set_flag(FixedSpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
- fsm->set_flag(FixedSpatialMaterial::FLAG_UNSHADED, true);
+ fsm->set_flag(SpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true);
+ fsm->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
+ fsm->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
fsm->set_albedo(Color(1, 1, 1, 1));
mesh->surface_set_material(0, fsm);
diff --git a/scene/3d/baked_light_instance.h b/scene/3d/baked_light_instance.h
index 2180f8b175..63a5fa7255 100644
--- a/scene/3d/baked_light_instance.h
+++ b/scene/3d/baked_light_instance.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/body_shape.cpp b/scene/3d/body_shape.cpp
index 8403806570..68f166c5b9 100644
--- a/scene/3d/body_shape.cpp
+++ b/scene/3d/body_shape.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/body_shape.h b/scene/3d/body_shape.h
index 137a6cd9fc..f4392dda62 100644
--- a/scene/3d/body_shape.h
+++ b/scene/3d/body_shape.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/bone_attachment.cpp b/scene/3d/bone_attachment.cpp
index d8cb2dfdac..b55b788b54 100644
--- a/scene/3d/bone_attachment.cpp
+++ b/scene/3d/bone_attachment.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/bone_attachment.h b/scene/3d/bone_attachment.h
index 194d6b4f94..65908d98a8 100644
--- a/scene/3d/bone_attachment.h
+++ b/scene/3d/bone_attachment.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/camera.cpp b/scene/3d/camera.cpp
index 540edd8a2a..d648ff078c 100644
--- a/scene/3d/camera.cpp
+++ b/scene/3d/camera.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/camera.h b/scene/3d/camera.h
index 3c31b6beeb..472cfaa008 100644
--- a/scene/3d/camera.h
+++ b/scene/3d/camera.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/character_camera.cpp b/scene/3d/character_camera.cpp
index edd97eaa6d..065e21fccd 100644
--- a/scene/3d/character_camera.cpp
+++ b/scene/3d/character_camera.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/character_camera.h b/scene/3d/character_camera.h
index 464fa5c235..c3a1c70d5e 100644
--- a/scene/3d/character_camera.h
+++ b/scene/3d/character_camera.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/collision_object.cpp b/scene/3d/collision_object.cpp
index c3e19c4b81..4dc01975b8 100644
--- a/scene/3d/collision_object.cpp
+++ b/scene/3d/collision_object.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/collision_object.h b/scene/3d/collision_object.h
index 9b124cf277..abe0b804bf 100644
--- a/scene/3d/collision_object.h
+++ b/scene/3d/collision_object.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/collision_polygon.cpp b/scene/3d/collision_polygon.cpp
index 12dab067d0..a9a693f370 100644
--- a/scene/3d/collision_polygon.cpp
+++ b/scene/3d/collision_polygon.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/collision_polygon.h b/scene/3d/collision_polygon.h
index fee146a87e..d45b4738ae 100644
--- a/scene/3d/collision_polygon.h
+++ b/scene/3d/collision_polygon.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/gi_probe.cpp b/scene/3d/gi_probe.cpp
index cb1292a9d1..7370e1330c 100644
--- a/scene/3d/gi_probe.cpp
+++ b/scene/3d/gi_probe.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -919,7 +920,7 @@ Vector<Color> GIProbe::_get_bake_texture(Image &p_image, const Color &p_color) {
GIProbe::Baker::MaterialCache GIProbe::_get_material_cache(Ref<Material> p_material, Baker *p_baker) {
//this way of obtaining materials is inaccurate and also does not support some compressed formats very well
- Ref<FixedSpatialMaterial> mat = p_material;
+ Ref<SpatialMaterial> mat = p_material;
Ref<Material> material = mat; //hack for now
@@ -931,7 +932,7 @@ GIProbe::Baker::MaterialCache GIProbe::_get_material_cache(Ref<Material> p_mater
if (mat.is_valid()) {
- Ref<Texture> albedo_tex = mat->get_texture(FixedSpatialMaterial::TEXTURE_ALBEDO);
+ Ref<Texture> albedo_tex = mat->get_texture(SpatialMaterial::TEXTURE_ALBEDO);
Image img_albedo;
if (albedo_tex.is_valid()) {
@@ -942,7 +943,7 @@ GIProbe::Baker::MaterialCache GIProbe::_get_material_cache(Ref<Material> p_mater
mc.albedo = _get_bake_texture(img_albedo, mat->get_albedo());
- Ref<ImageTexture> emission_tex = mat->get_texture(FixedSpatialMaterial::TEXTURE_EMISSION);
+ Ref<ImageTexture> emission_tex = mat->get_texture(SpatialMaterial::TEXTURE_EMISSION);
Color emission_col = mat->get_emission();
emission_col.r *= mat->get_emission_energy();
@@ -1365,11 +1366,11 @@ void GIProbe::_create_debug_mesh(Baker *p_baker) {
}
{
- Ref<FixedSpatialMaterial> fsm;
+ Ref<SpatialMaterial> fsm;
fsm.instance();
- fsm->set_flag(FixedSpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true);
- fsm->set_flag(FixedSpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
- fsm->set_flag(FixedSpatialMaterial::FLAG_UNSHADED, true);
+ fsm->set_flag(SpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true);
+ fsm->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
+ fsm->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
fsm->set_albedo(Color(1, 1, 1, 1));
mesh->surface_set_material(0, fsm);
diff --git a/scene/3d/gi_probe.h b/scene/3d/gi_probe.h
index 675b41cef9..ae89a6f068 100644
--- a/scene/3d/gi_probe.h
+++ b/scene/3d/gi_probe.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/immediate_geometry.cpp b/scene/3d/immediate_geometry.cpp
index adcc167223..8c1ad1d052 100644
--- a/scene/3d/immediate_geometry.cpp
+++ b/scene/3d/immediate_geometry.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/immediate_geometry.h b/scene/3d/immediate_geometry.h
index 6e0123992c..2eb4bf1e6b 100644
--- a/scene/3d/immediate_geometry.h
+++ b/scene/3d/immediate_geometry.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/interpolated_camera.cpp b/scene/3d/interpolated_camera.cpp
index 9723a686c5..3855244787 100644
--- a/scene/3d/interpolated_camera.cpp
+++ b/scene/3d/interpolated_camera.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/interpolated_camera.h b/scene/3d/interpolated_camera.h
index ebadf39946..c302c32fc9 100644
--- a/scene/3d/interpolated_camera.h
+++ b/scene/3d/interpolated_camera.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp
index 7d01230517..bb14ad5108 100644
--- a/scene/3d/light.cpp
+++ b/scene/3d/light.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/light.h b/scene/3d/light.h
index fd50f0fcc4..ed8758b09b 100644
--- a/scene/3d/light.h
+++ b/scene/3d/light.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/listener.cpp b/scene/3d/listener.cpp
index fc9326b571..148afbffa2 100644
--- a/scene/3d/listener.cpp
+++ b/scene/3d/listener.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/listener.h b/scene/3d/listener.h
index 4fb2aea072..b66fc7fc38 100644
--- a/scene/3d/listener.h
+++ b/scene/3d/listener.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/mesh_instance.cpp b/scene/3d/mesh_instance.cpp
index b61232dbfd..5b5bce342d 100644
--- a/scene/3d/mesh_instance.cpp
+++ b/scene/3d/mesh_instance.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/mesh_instance.h b/scene/3d/mesh_instance.h
index 543f407ca1..c11c52b76d 100644
--- a/scene/3d/mesh_instance.h
+++ b/scene/3d/mesh_instance.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/multimesh_instance.cpp b/scene/3d/multimesh_instance.cpp
index 18a747a5b9..b51953f27c 100644
--- a/scene/3d/multimesh_instance.cpp
+++ b/scene/3d/multimesh_instance.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/multimesh_instance.h b/scene/3d/multimesh_instance.h
index 4a0edb563c..7e14d567ac 100644
--- a/scene/3d/multimesh_instance.h
+++ b/scene/3d/multimesh_instance.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/navigation.cpp b/scene/3d/navigation.cpp
index 093d217cb0..de6b242bfe 100644
--- a/scene/3d/navigation.cpp
+++ b/scene/3d/navigation.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/navigation.h b/scene/3d/navigation.h
index 6222d2bad3..53e0b6399a 100644
--- a/scene/3d/navigation.h
+++ b/scene/3d/navigation.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/navigation_mesh.cpp b/scene/3d/navigation_mesh.cpp
index 1059a9b979..13fd852fe7 100644
--- a/scene/3d/navigation_mesh.cpp
+++ b/scene/3d/navigation_mesh.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/navigation_mesh.h b/scene/3d/navigation_mesh.h
index fda8923788..c8f6d936aa 100644
--- a/scene/3d/navigation_mesh.h
+++ b/scene/3d/navigation_mesh.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/particles.cpp b/scene/3d/particles.cpp
index ea61253ac7..038ca33a41 100644
--- a/scene/3d/particles.cpp
+++ b/scene/3d/particles.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -30,532 +31,1422 @@
#include "scene/resources/surface_tool.h"
#include "servers/visual_server.h"
-#if 0
-/*
-static const char* _var_names[Particles::VAR_MAX]={
- "vars/lifetime",
- "vars/spread",
- "vars/gravity",
- "vars/linear_vel",
- "vars/angular_vel",
- "vars/linear_accel",
- "vars/radial_accel",
- "vars/tan_accel",
- "vars/initial_size",
- "vars/final_size",
- "vars/initial_angle",
- "vars/height",
- "vars/height_speed_scale",
-};
-*/
-static const char* _rand_names[Particles::VAR_MAX]={
- "rand/lifetime",
- "rand/spread",
- "rand/gravity",
- "rand/linear_vel",
- "rand/angular_vel",
- "rand/linear_accel",
- "rand/radial_accel",
- "rand/tan_accel",
- "rand/damping",
- "rand/initial_size",
- "rand/final_size",
- "rand/initial_angle",
- "rand/height",
- "rand/height_speed_scale",
-};
-
-static const Particles::Variable _var_indices[Particles::VAR_MAX]={
- Particles::VAR_LIFETIME,
- Particles::VAR_SPREAD,
- Particles::VAR_GRAVITY,
- Particles::VAR_LINEAR_VELOCITY,
- Particles::VAR_ANGULAR_VELOCITY,
- Particles::VAR_LINEAR_ACCELERATION,
- Particles::VAR_DRAG,
- Particles::VAR_TANGENTIAL_ACCELERATION,
- Particles::VAR_DAMPING,
- Particles::VAR_INITIAL_SIZE,
- Particles::VAR_FINAL_SIZE,
- Particles::VAR_INITIAL_ANGLE,
- Particles::VAR_HEIGHT,
- Particles::VAR_HEIGHT_SPEED_SCALE,
-};
-
-
-
-AABB Particles::get_aabb() const {
-
- return AABB( Vector3(-1,-1,-1), Vector3(2, 2, 2 ) );
+Rect3 Particles::get_aabb() const {
+
+ return Rect3();
}
PoolVector<Face3> Particles::get_faces(uint32_t p_usage_flags) const {
return PoolVector<Face3>();
}
+void Particles::set_emitting(bool p_emitting) {
+
+ emitting = p_emitting;
+ VS::get_singleton()->particles_set_emitting(particles, emitting);
+}
void Particles::set_amount(int p_amount) {
- ERR_FAIL_INDEX(p_amount,1024);
- amount=p_amount;
- VisualServer::get_singleton()->particles_set_amount(particles,p_amount);
+ amount = p_amount;
+ VS::get_singleton()->particles_set_amount(particles, amount);
}
-int Particles::get_amount() const {
+void Particles::set_lifetime(float p_lifetime) {
- return amount;
+ lifetime = p_lifetime;
+ VS::get_singleton()->particles_set_lifetime(particles, lifetime);
}
+void Particles::set_pre_process_time(float p_time) {
-void Particles::set_emitting(bool p_emitting) {
+ pre_process_time = p_time;
+ VS::get_singleton()->particles_set_pre_process_time(particles, pre_process_time);
+}
+void Particles::set_explosiveness_ratio(float p_ratio) {
+
+ explosiveness_ratio = p_ratio;
+ VS::get_singleton()->particles_set_explosiveness_ratio(particles, explosiveness_ratio);
+}
+void Particles::set_randomness_ratio(float p_ratio) {
- emitting=p_emitting;
- VisualServer::get_singleton()->particles_set_emitting(particles,p_emitting);
+ randomness_ratio = p_ratio;
+ VS::get_singleton()->particles_set_randomness_ratio(particles, randomness_ratio);
+}
+void Particles::set_visibility_aabb(const Rect3 &p_aabb) {
- setup_timer();
+ visibility_aabb = p_aabb;
+ VS::get_singleton()->particles_set_custom_aabb(particles, visibility_aabb);
+ update_gizmo();
+ _change_notify("visibility_aabb");
}
+void Particles::set_use_local_coordinates(bool p_enable) {
+
+ local_coords = p_enable;
+ VS::get_singleton()->particles_set_use_local_coordinates(particles, local_coords);
+}
+void Particles::set_process_material(const Ref<Material> &p_material) {
+
+ process_material = p_material;
+ RID material_rid;
+ if (process_material.is_valid())
+ material_rid = process_material->get_rid();
+ VS::get_singleton()->particles_set_process_material(particles, material_rid);
+
+ update_configuration_warning();
+}
+
+void Particles::set_speed_scale(float p_scale) {
+
+ speed_scale = p_scale;
+ VS::get_singleton()->particles_set_speed_scale(particles, p_scale);
+}
+
bool Particles::is_emitting() const {
return emitting;
}
+int Particles::get_amount() const {
+
+ return amount;
+}
+float Particles::get_lifetime() const {
+
+ return lifetime;
+}
+float Particles::get_pre_process_time() const {
-void Particles::set_visibility_aabb(const AABB& p_aabb) {
+ return pre_process_time;
+}
+float Particles::get_explosiveness_ratio() const {
- visibility_aabb=p_aabb;
- VisualServer::get_singleton()->particles_set_visibility_aabb(particles,p_aabb);
- update_gizmo();
+ return explosiveness_ratio;
+}
+float Particles::get_randomness_ratio() const {
+ return randomness_ratio;
}
-AABB Particles::get_visibility_aabb() const {
+Rect3 Particles::get_visibility_aabb() const {
return visibility_aabb;
}
+bool Particles::get_use_local_coordinates() const {
+
+ return local_coords;
+}
+Ref<Material> Particles::get_process_material() const {
+ return process_material;
+}
-void Particles::set_emission_points(const PoolVector<Vector3>& p_points) {
+float Particles::get_speed_scale() const {
- using_points = p_points.size();
- VisualServer::get_singleton()->particles_set_emission_points(particles,p_points);
+ return speed_scale;
}
-PoolVector<Vector3> Particles::get_emission_points() const {
+void Particles::set_draw_order(DrawOrder p_order) {
- if (!using_points)
- return PoolVector<Vector3>();
+ draw_order = p_order;
+ VS::get_singleton()->particles_set_draw_order(particles, VS::ParticlesDrawOrder(p_order));
+}
- return VisualServer::get_singleton()->particles_get_emission_points(particles);
+Particles::DrawOrder Particles::get_draw_order() const {
+ return draw_order;
}
-void Particles::set_emission_half_extents(const Vector3& p_half_extents) {
+void Particles::set_draw_passes(int p_count) {
- emission_half_extents=p_half_extents;
- VisualServer::get_singleton()->particles_set_emission_half_extents(particles,p_half_extents);
+ ERR_FAIL_COND(p_count < 1);
+ draw_passes.resize(p_count);
+ VS::get_singleton()->particles_set_draw_passes(particles, p_count);
+ _change_notify();
+}
+int Particles::get_draw_passes() const {
+ return draw_passes.size();
}
-Vector3 Particles::get_emission_half_extents() const {
+void Particles::set_draw_pass_mesh(int p_pass, const Ref<Mesh> &p_mesh) {
- return emission_half_extents;
+ ERR_FAIL_INDEX(p_pass, draw_passes.size());
+
+ draw_passes[p_pass] = p_mesh;
+
+ RID mesh_rid;
+ if (p_mesh.is_valid())
+ mesh_rid = p_mesh->get_rid();
+
+ VS::get_singleton()->particles_set_draw_pass_mesh(particles, p_pass, mesh_rid);
+
+ update_configuration_warning();
}
-void Particles::set_emission_base_velocity(const Vector3& p_base_velocity) {
+Ref<Mesh> Particles::get_draw_pass_mesh(int p_pass) const {
- emission_base_velocity=p_base_velocity;
- VisualServer::get_singleton()->particles_set_emission_base_velocity(particles,p_base_velocity);
+ ERR_FAIL_INDEX_V(p_pass, draw_passes.size(), Ref<Mesh>());
+ return draw_passes[p_pass];
}
-Vector3 Particles::get_emission_base_velocity() const {
+void Particles::set_fixed_fps(int p_count) {
+ fixed_fps = p_count;
+ VS::get_singleton()->particles_set_fixed_fps(particles, p_count);
+}
- return emission_base_velocity;
+int Particles::get_fixed_fps() const {
+ return fixed_fps;
}
-void Particles::set_gravity_normal(const Vector3& p_normal) {
+void Particles::set_fractional_delta(bool p_enable) {
+ fractional_delta = p_enable;
+ VS::get_singleton()->particles_set_fractional_delta(particles, p_enable);
+}
- gravity_normal=p_normal;
- VisualServer::get_singleton()->particles_set_gravity_normal(particles,p_normal);
+bool Particles::get_fractional_delta() const {
+ return fractional_delta;
}
-Vector3 Particles::get_gravity_normal() const {
+String Particles::get_configuration_warning() const {
- return gravity_normal;
+ String warnings;
+ bool meshes_found = false;
+
+ for (int i = 0; i < draw_passes.size(); i++) {
+ if (draw_passes[i].is_valid()) {
+ meshes_found = true;
+ break;
+ }
+ }
+
+ if (!meshes_found) {
+ warnings += "- " + TTR("Nothing is visible because meshes have not been assigned to draw passes.");
+ }
+
+ if (process_material.is_null()) {
+ if (warnings != String())
+ warnings += "\n";
+ warnings += "- " + TTR("A material to process the particles is not assigned, so no behavior is imprinted.");
+ }
+
+ return warnings;
+}
+
+Rect3 Particles::capture_aabb() const {
+
+ return VS::get_singleton()->particles_get_current_aabb(particles);
}
-void Particles::set_variable(Variable p_variable,float p_value) {
+void Particles::_validate_property(PropertyInfo &property) const {
- ERR_FAIL_INDEX(p_variable,VAR_MAX);
- var[p_variable]=p_value;
- VisualServer::get_singleton()->particles_set_variable(particles,(VS::ParticleVariable)p_variable,p_value);
- if (p_variable==VAR_SPREAD)
- update_gizmo();
+ if (property.name.begins_with("draw_pass_")) {
+ int index = property.name.get_slicec('_', 2).to_int() - 1;
+ if (index >= draw_passes.size()) {
+ property.usage = 0;
+ return;
+ }
+ }
}
-float Particles::get_variable(Variable p_variable) const {
+void Particles::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("set_emitting", "emitting"), &Particles::set_emitting);
+ ClassDB::bind_method(D_METHOD("set_amount", "amount"), &Particles::set_amount);
+ ClassDB::bind_method(D_METHOD("set_lifetime", "secs"), &Particles::set_lifetime);
+ ClassDB::bind_method(D_METHOD("set_pre_process_time", "secs"), &Particles::set_pre_process_time);
+ ClassDB::bind_method(D_METHOD("set_explosiveness_ratio", "ratio"), &Particles::set_explosiveness_ratio);
+ ClassDB::bind_method(D_METHOD("set_randomness_ratio", "ratio"), &Particles::set_randomness_ratio);
+ ClassDB::bind_method(D_METHOD("set_visibility_aabb", "aabb"), &Particles::set_visibility_aabb);
+ ClassDB::bind_method(D_METHOD("set_use_local_coordinates", "enable"), &Particles::set_use_local_coordinates);
+ ClassDB::bind_method(D_METHOD("set_fixed_fps", "fps"), &Particles::set_fixed_fps);
+ ClassDB::bind_method(D_METHOD("set_fractional_delta", "enable"), &Particles::set_fractional_delta);
+ ClassDB::bind_method(D_METHOD("set_process_material", "material:Material"), &Particles::set_process_material);
+ ClassDB::bind_method(D_METHOD("set_speed_scale", "scale"), &Particles::set_speed_scale);
+
+ ClassDB::bind_method(D_METHOD("is_emitting"), &Particles::is_emitting);
+ ClassDB::bind_method(D_METHOD("get_amount"), &Particles::get_amount);
+ ClassDB::bind_method(D_METHOD("get_lifetime"), &Particles::get_lifetime);
+ ClassDB::bind_method(D_METHOD("get_pre_process_time"), &Particles::get_pre_process_time);
+ ClassDB::bind_method(D_METHOD("get_explosiveness_ratio"), &Particles::get_explosiveness_ratio);
+ ClassDB::bind_method(D_METHOD("get_randomness_ratio"), &Particles::get_randomness_ratio);
+ ClassDB::bind_method(D_METHOD("get_visibility_aabb"), &Particles::get_visibility_aabb);
+ ClassDB::bind_method(D_METHOD("get_use_local_coordinates"), &Particles::get_use_local_coordinates);
+ ClassDB::bind_method(D_METHOD("get_fixed_fps"), &Particles::get_fixed_fps);
+ ClassDB::bind_method(D_METHOD("get_fractional_delta"), &Particles::get_fractional_delta);
+ ClassDB::bind_method(D_METHOD("get_process_material:Material"), &Particles::get_process_material);
+ ClassDB::bind_method(D_METHOD("get_speed_scale"), &Particles::get_speed_scale);
+
+ ClassDB::bind_method(D_METHOD("set_draw_order", "order"), &Particles::set_draw_order);
+
+ ClassDB::bind_method(D_METHOD("get_draw_order"), &Particles::get_draw_order);
+
+ ClassDB::bind_method(D_METHOD("set_draw_passes", "passes"), &Particles::set_draw_passes);
+ ClassDB::bind_method(D_METHOD("set_draw_pass_mesh", "pass", "mesh:Mesh"), &Particles::set_draw_pass_mesh);
+
+ ClassDB::bind_method(D_METHOD("get_draw_passes"), &Particles::get_draw_passes);
+ ClassDB::bind_method(D_METHOD("get_draw_pass_mesh:Mesh", "pass"), &Particles::get_draw_pass_mesh);
+
+ ClassDB::bind_method(D_METHOD("capture_aabb"), &Particles::capture_aabb);
+
+ ADD_GROUP("Parameters", "");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "emitting"), "set_emitting", "is_emitting");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "amount", PROPERTY_HINT_RANGE, "1,100000,1"), "set_amount", "get_amount");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "lifetime", PROPERTY_HINT_RANGE, "0.01,600.0,0.01"), "set_lifetime", "get_lifetime");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "preprocess", PROPERTY_HINT_RANGE, "0.00,600.0,0.01"), "set_pre_process_time", "get_pre_process_time");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "speed_scale", PROPERTY_HINT_RANGE, "0.01,64,0.01"), "set_speed_scale", "get_speed_scale");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "explosiveness", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_explosiveness_ratio", "get_explosiveness_ratio");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "randomness", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_randomness_ratio", "get_randomness_ratio");
+ ADD_PROPERTY(PropertyInfo(Variant::RECT3, "visibility_aabb"), "set_visibility_aabb", "get_visibility_aabb");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "local_coords"), "set_use_local_coordinates", "get_use_local_coordinates");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "fixed_fps", PROPERTY_HINT_RANGE, "0,1000,1"), "set_fixed_fps", "get_fixed_fps");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "fract_delta"), "set_fractional_delta", "get_fractional_delta");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "draw_order", PROPERTY_HINT_ENUM, "Index,Lifetime,View Depth"), "set_draw_order", "get_draw_order");
+ ADD_GROUP("Process Material", "");
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "process_material", PROPERTY_HINT_RESOURCE_TYPE, "ParticlesMaterial,ShaderMaterial"), "set_process_material", "get_process_material");
+ ADD_GROUP("Draw Passes", "draw_");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "draw_passes", PROPERTY_HINT_RANGE, "0," + itos(MAX_DRAW_PASSES) + ",1"), "set_draw_passes", "get_draw_passes");
+ for (int i = 0; i < MAX_DRAW_PASSES; i++) {
+
+ 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_CONSTANT(MAX_DRAW_PASSES);
+}
+
+Particles::Particles() {
+
+ particles = VS::get_singleton()->particles_create();
+ set_base(particles);
+ set_emitting(true);
+ set_amount(8);
+ set_lifetime(1);
+ set_fixed_fps(0);
+ set_fractional_delta(true);
+ set_pre_process_time(0);
+ set_explosiveness_ratio(0);
+ set_randomness_ratio(0);
+ set_visibility_aabb(Rect3(Vector3(-4, -4, -4), Vector3(8, 8, 8)));
+ set_use_local_coordinates(true);
+ set_draw_passes(1);
+ set_draw_order(DRAW_ORDER_INDEX);
+ set_speed_scale(1);
+}
+
+Particles::~Particles() {
+
+ VS::get_singleton()->free(particles);
+}
+
+//////////////////////////////////////
+
+Mutex *ParticlesMaterial::material_mutex = NULL;
+SelfList<ParticlesMaterial>::List ParticlesMaterial::dirty_materials;
+Map<ParticlesMaterial::MaterialKey, ParticlesMaterial::ShaderData> ParticlesMaterial::shader_map;
+ParticlesMaterial::ShaderNames *ParticlesMaterial::shader_names = NULL;
+
+void ParticlesMaterial::init_shaders() {
+
+#ifndef NO_THREADS
+ material_mutex = Mutex::create();
+#endif
+
+ shader_names = memnew(ShaderNames);
+
+ shader_names->spread = "spread";
+ shader_names->flatness = "flatness";
+ shader_names->initial_linear_velocity = "initial_linear_velocity";
+ shader_names->initial_angle = "initial_angle";
+ shader_names->angular_velocity = "angular_velocity";
+ shader_names->orbit_velocity = "orbit_velocity";
+ shader_names->linear_accel = "linear_accel";
+ shader_names->radial_accel = "radial_accel";
+ shader_names->tangent_accel = "tangent_accel";
+ shader_names->damping = "damping";
+ shader_names->scale = "scale";
+ shader_names->hue_variation = "hue_variation";
+ shader_names->anim_speed = "anim_speed";
+ shader_names->anim_offset = "anim_offset";
+
+ shader_names->initial_linear_velocity = "initial_linear_velocity_random";
+ shader_names->initial_angle_random = "initial_angle_random";
+ shader_names->angular_velocity_random = "angular_velocity_random";
+ shader_names->orbit_velocity_random = "orbit_velocity_random";
+ shader_names->linear_accel_random = "linear_accel_random";
+ shader_names->radial_accel_random = "radial_accel_random";
+ shader_names->tangent_accel_random = "tangent_accel_random";
+ shader_names->damping_random = "damping_random";
+ shader_names->scale_random = "scale_random";
+ shader_names->hue_variation_random = "hue_variation_random";
+ shader_names->anim_speed_random = "anim_speed_random";
+ shader_names->anim_offset_random = "anim_offset_random";
+
+ shader_names->angle_texture = "angle_texture";
+ shader_names->angular_velocity_texture = "angular_velocity_texture";
+ shader_names->orbit_velocity_texture = "orbit_velocity_texture";
+ shader_names->linear_accel_texture = "linear_accel_texture";
+ shader_names->radial_accel_texture = "radial_accel_texture";
+ shader_names->tangent_accel_texture = "tangent_accel_texture";
+ shader_names->damping_texture = "damping_texture";
+ shader_names->scale_texture = "scale_texture";
+ shader_names->hue_variation_texture = "hue_variation_texture";
+ shader_names->anim_speed_texture = "anim_speed_texture";
+ shader_names->anim_offset_texture = "anim_offset_texture";
+
+ shader_names->color = "color_value";
+ shader_names->color_ramp = "color_ramp";
+
+ shader_names->emission_sphere_radius = "emission_sphere_radius";
+ shader_names->emission_box_extents = "emission_box_extents";
+ shader_names->emission_texture_point_count = "emission_texture_point_count";
+ shader_names->emission_texture_points = "emission_texture_points";
+ shader_names->emission_texture_normal = "emission_texture_normal";
+
+ shader_names->trail_divisor = "trail_divisor";
+ shader_names->trail_size_modifier = "trail_size_modifier";
+ shader_names->trail_color_modifier = "trail_color_modifier";
+
+ shader_names->gravity = "gravity";
+}
+
+void ParticlesMaterial::finish_shaders() {
+
+#ifndef NO_THREADS
+ memdelete(material_mutex);
+#endif
+
+ memdelete(shader_names);
+}
+
+void ParticlesMaterial::_update_shader() {
+
+ print_line("updating shader");
+
+ dirty_materials.remove(&element);
+
+ MaterialKey mk = _compute_key();
+ if (mk.key == current_key.key)
+ return; //no update required in the end
+
+ if (shader_map.has(current_key)) {
+ shader_map[current_key].users--;
+ if (shader_map[current_key].users == 0) {
+ //deallocate shader, as it's no longer in use
+ VS::get_singleton()->free(shader_map[current_key].shader);
+ shader_map.erase(current_key);
+ }
+ }
+
+ current_key = mk;
+
+ if (shader_map.has(mk)) {
+
+ VS::get_singleton()->material_set_shader(_get_material(), shader_map[mk].shader);
+ shader_map[mk].users++;
+ return;
+ }
+
+ //must create a shader!
+
+ String code = "shader_type particles;\n";
+
+ code += "uniform float spread;\n";
+ code += "uniform float flatness;\n";
+ code += "uniform float initial_linear_velocity;\n";
+ code += "uniform float initial_angle;\n";
+ code += "uniform float angular_velocity;\n";
+ code += "uniform float orbit_velocity;\n";
+ code += "uniform float linear_accel;\n";
+ code += "uniform float radial_accel;\n";
+ code += "uniform float tangent_accel;\n";
+ code += "uniform float damping;\n";
+ code += "uniform float scale;\n";
+ code += "uniform float hue_variation;\n";
+ code += "uniform float anim_speed;\n";
+ code += "uniform float anim_offset;\n";
+
+ code += "uniform float initial_linear_velocity_random;\n";
+ code += "uniform float initial_angle_random;\n";
+ code += "uniform float angular_velocity_random;\n";
+ code += "uniform float orbit_velocity_random;\n";
+ code += "uniform float linear_accel_random;\n";
+ code += "uniform float radial_accel_random;\n";
+ code += "uniform float tangent_accel_random;\n";
+ code += "uniform float damping_random;\n";
+ code += "uniform float scale_random;\n";
+ code += "uniform float hue_variation_random;\n";
+ code += "uniform float anim_speed_random;\n";
+ code += "uniform float anim_offset_random;\n";
+
+ code += "uniform vec4 color_value : hint_color;\n";
+
+ code += "uniform int trail_divisor;\n";
+
+ code += "uniform vec3 gravity;\n";
+
+ if (color_ramp.is_valid())
+ code += "uniform sampler2D color_ramp;\n";
+
+ if (tex_parameters[PARAM_INITIAL_LINEAR_VELOCITY].is_valid())
+ code += "uniform sampler2D linear_velocity_texture;\n";
+ if (tex_parameters[PARAM_ORBIT_VELOCITY].is_valid())
+ code += "uniform sampler2D orbit_velocity_texture;\n";
+ if (tex_parameters[PARAM_ANGULAR_VELOCITY].is_valid())
+ code += "uniform sampler2D angular_velocity_texture;\n";
+ if (tex_parameters[PARAM_LINEAR_ACCEL].is_valid())
+ code += "uniform sampler2D linear_accel_texture;\n";
+ if (tex_parameters[PARAM_RADIAL_ACCEL].is_valid())
+ code += "uniform sampler2D radial_accel_texture;\n";
+ if (tex_parameters[PARAM_TANGENTIAL_ACCEL].is_valid())
+ code += "uniform sampler2D tangent_accel_texture;\n";
+ if (tex_parameters[PARAM_DAMPING].is_valid())
+ code += "uniform sampler2D damping_texture;\n";
+ if (tex_parameters[PARAM_ANGLE].is_valid())
+ code += "uniform sampler2D angle_texture;\n";
+ if (tex_parameters[PARAM_SCALE].is_valid())
+ code += "uniform sampler2D scale_texture;\n";
+ if (tex_parameters[PARAM_HUE_VARIATION].is_valid())
+ code += "uniform sampler2D hue_variation_texture;\n";
+ if (tex_parameters[PARAM_ANIM_SPEED].is_valid())
+ code += "uniform sampler2D anim_speed_texture;\n";
+ if (tex_parameters[PARAM_ANIM_OFFSET].is_valid())
+ code += "uniform sampler2D anim_offset_texture;\n";
+
+ switch (emission_shape) {
+ case EMISSION_SHAPE_POINT: {
+ //do none
+ } break;
+ case EMISSION_SHAPE_SPHERE: {
+ code += "uniform float emission_sphere_radius;\n";
+ } break;
+ case EMISSION_SHAPE_BOX: {
+ code += "uniform vec3 emission_box_extents;\n";
+ } break;
+ case EMISSION_SHAPE_DIRECTED_POINTS: {
+ code += "uniform sampler2D emission_texture_normal : hint_black;\n";
+ } //fallthrough
+ case EMISSION_SHAPE_POINTS: {
+ code += "uniform sampler2D emission_texture_points : hint_black;\n";
+ code += "uniform int emission_texture_point_count;\n";
+ } break;
+ }
- ERR_FAIL_INDEX_V(p_variable,VAR_MAX,-1);
- return var[p_variable];
+ if (trail_size_modifier.is_valid()) {
+ code += "uniform sampler2D trail_size_modifier;\n";
+ }
+
+ if (trail_color_modifier.is_valid()) {
+ code += "uniform sampler2D trail_color_modifier;\n";
+ }
+ //need a random function
+ code += "\n\n";
+ code += "float rand_from_seed(inout uint seed) {\n";
+ code += " int k;\n";
+ code += " int s = int(seed);\n";
+ code += " if (s == 0)\n";
+ code += " s = 305420679;\n";
+ code += " k = s / 127773;\n";
+ code += " s = 16807 * (s - k * 127773) - 2836 * k;\n";
+ code += " if (s < 0)\n";
+ code += " s += 2147483647;\n";
+ code += " seed = uint(s);\n";
+ code += " return float(seed % uint(65536))/65535.0;\n";
+ code += "}\n";
+ //improve seed quality
+ code += "uint hash(uint x) {\n";
+ code += " x = ((x >> uint(16)) ^ x) * uint(73244475);\n";
+ code += " x = ((x >> uint(16)) ^ x) * uint(73244475);\n";
+ code += " x = (x >> uint(16)) ^ x;\n";
+ code += " return x;\n";
+ code += "}\n";
+ code += "void vertex() {\n\n";
+ code += "\n";
+
+ code += " uint base_number=NUMBER/uint(trail_divisor);\n";
+ code += " uint alt_seed=hash(base_number+uint(1));\n";
+ code += " float angle_rand=rand_from_seed(alt_seed);\n";
+ code += " float scale_rand=rand_from_seed(alt_seed);\n";
+ code += " float hue_rot_rand=rand_from_seed(alt_seed);\n";
+ code += " float anim_offset_rand=rand_from_seed(alt_seed);\n";
+ code += "\n";
+ code += "\n";
+ code += "\n";
+ code += "\n";
+ code += " if (RESTART) {\n";
+
+ if (tex_parameters[PARAM_INITIAL_LINEAR_VELOCITY].is_valid())
+ code += " float tex_linear_velocity = textureLod(linear_velocity_texture,vec2(0.0,0.0),0.0).r;\n";
+ else
+ code += " float tex_linear_velocity = 0.0;\n";
+
+ if (tex_parameters[PARAM_ANGLE].is_valid())
+ code += " float tex_angle = textureLod(angle_texture,vec2(0.0,0.0),0.0).r;\n";
+ else
+ code += " float tex_angle = 0.0;\n";
+
+ if (tex_parameters[PARAM_ANIM_OFFSET].is_valid())
+ code += " float tex_anim_offset = textureLod(anim_offset_texture,vec2(0.0,0.0),0.0).r;\n";
+ else
+ code += " float tex_anim_offset = 0.0;\n";
+
+ code += " float angle1 = rand_from_seed(alt_seed)*spread*3.1416;\n";
+ code += " float angle2 = rand_from_seed(alt_seed)*20.0*3.1416; // make it more random like\n";
+ code += " vec3 rot_xz=vec3( sin(angle1), 0.0, cos(angle1) );\n";
+ code += " vec3 rot = vec3( cos(angle2)*rot_xz.x,sin(angle2)*rot_xz.x, rot_xz.z);\n";
+ code += " VELOCITY=(rot*initial_linear_velocity+rot*initial_linear_velocity_random*rand_from_seed(alt_seed));\n";
+ code += " float base_angle=(initial_angle+tex_angle)*mix(1.0,angle_rand,initial_angle_random);\n";
+ code += " CUSTOM.x=base_angle*3.1416/180.0;\n"; //angle
+ code += " CUSTOM.y=0.0;\n"; //phase
+ code += " CUSTOM.z=(anim_offset+tex_anim_offset)*mix(1.0,anim_offset_rand,anim_offset_random);\n"; //animation offset (0-1)
+ switch (emission_shape) {
+ case EMISSION_SHAPE_POINT: {
+ //do none
+ } break;
+ case EMISSION_SHAPE_SPHERE: {
+ code += " TRANSFORM[3].xyz = normalize(vec3(rand_from_seed(alt_seed) * 2.0 - 1.0, rand_from_seed(alt_seed) * 2.0-1.0, rand_from_seed(alt_seed) * 2.0-1.0 ))*emission_sphere_radius;\n";
+ } break;
+ case EMISSION_SHAPE_BOX: {
+ code += " TRANSFORM[3].xyz = vec3(rand_from_seed(alt_seed) * 2.0 - 1.0, rand_from_seed(alt_seed) * 2.0-1.0, rand_from_seed(alt_seed) * 2.0-1.0)*emission_box_extents;\n";
+ } break;
+ case EMISSION_SHAPE_POINTS:
+ case EMISSION_SHAPE_DIRECTED_POINTS: {
+ code += " int point = min(emission_texture_point_count-1,int(rand_from_seed(alt_seed) * float(emission_texture_point_count)));\n";
+ code += " ivec2 tex_size = textureSize( emission_texture_points, 0 );\n";
+ code += " ivec2 tex_ofs = ivec2( point % tex_size.x, point / tex_size.x );\n";
+ code += " TRANSFORM[3].xyz = texelFetch(emission_texture_points, tex_ofs,0).xyz;\n";
+ if (emission_shape == EMISSION_SHAPE_DIRECTED_POINTS) {
+ code += " vec3 normal = texelFetch(emission_texture_normal, tex_ofs,0).xyz;\n";
+ code += " vec3 v0 = abs(normal.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(0, 1.0, 0.0);\n";
+ code += " vec3 tangent = normalize(cross(v0, normal));\n";
+ code += " vec3 bitangent = normalize(cross(tangent, normal));\n";
+ code += " VELOCITY = mat3(tangent,bitangent,normal) * VELOCITY;\n";
+ }
+ } break;
+ }
+ code += " VELOCITY = (EMISSION_TRANSFORM * vec4(VELOCITY,0.0)).xyz;\n";
+ code += " TRANSFORM = EMISSION_TRANSFORM * TRANSFORM;\n";
+
+ code += " } else {\n";
+
+ code += " CUSTOM.y+=DELTA/LIFETIME;\n";
+ if (tex_parameters[PARAM_INITIAL_LINEAR_VELOCITY].is_valid())
+ code += " float tex_linear_velocity = textureLod(linear_velocity_texture,vec2(CUSTOM.y,0.0),0.0).r;\n";
+ else
+ code += " float tex_linear_velocity = 0.0;\n";
+
+ if (tex_parameters[PARAM_ORBIT_VELOCITY].is_valid())
+ code += " float tex_orbit_velocity = textureLod(orbit_velocity_texture,vec2(CUSTOM.y,0.0),0.0).r;\n";
+ else
+ code += " float tex_orbit_velocity = 0.0;\n";
+
+ if (tex_parameters[PARAM_ANGULAR_VELOCITY].is_valid())
+ code += " float tex_angular_velocity = textureLod(angular_velocity_texture,vec2(CUSTOM.y,0.0),0.0).r;\n";
+ else
+ code += " float tex_angular_velocity = 0.0;\n";
+
+ if (tex_parameters[PARAM_LINEAR_ACCEL].is_valid())
+ code += " float tex_linear_accel = textureLod(linear_accel_texture,vec2(CUSTOM.y,0.0),0.0).r;\n";
+ else
+ code += " float tex_linear_accel = 0.0;\n";
+
+ if (tex_parameters[PARAM_RADIAL_ACCEL].is_valid())
+ code += " float tex_radial_accel = textureLod(radial_accel_texture,vec2(CUSTOM.y,0.0),0.0).r;\n";
+ else
+ code += " float tex_radial_accel = 0.0;\n";
+
+ if (tex_parameters[PARAM_TANGENTIAL_ACCEL].is_valid())
+ code += " float tex_tangent_accel = textureLod(tangent_accel_texture,vec2(CUSTOM.y,0.0),0.0).r;\n";
+ else
+ code += " float tex_tangent_accel = 0.0;\n";
+
+ if (tex_parameters[PARAM_DAMPING].is_valid())
+ code += " float tex_damping = textureLod(damping_texture,vec2(CUSTOM.y,0.0),0.0).r;\n";
+ else
+ code += " float tex_damping = 0.0;\n";
+
+ if (tex_parameters[PARAM_ANGLE].is_valid())
+ code += " float tex_angle = textureLod(angle_texture,vec2(CUSTOM.y,0.0),0.0).r;\n";
+ else
+ code += " float tex_angle = 0.0;\n";
+
+ if (tex_parameters[PARAM_ANIM_SPEED].is_valid())
+ code += " float tex_anim_speed = textureLod(anim_speed_texture,vec2(CUSTOM.y,0.0),0.0).r;\n";
+ else
+ code += " float tex_anim_speed = 0.0;\n";
+
+ if (tex_parameters[PARAM_ANIM_OFFSET].is_valid())
+ code += " float tex_anim_offset = textureLod(anim_offset_texture,vec2(CUSTOM.y,0.0),0.0).r;\n";
+ else
+ code += " float tex_anim_offset = 0.0;\n";
+
+ code += " vec3 force = gravity; \n";
+ code += " vec3 pos = TRANSFORM[3].xyz; \n";
+ code += " //apply linear acceleration\n";
+ code += " force+=normalize(VELOCITY) * (linear_accel+tex_linear_accel)*mix(1.0,rand_from_seed(alt_seed),linear_accel_random);\n";
+ code += " //apply radial acceleration\n";
+ code += " vec3 org = vec3(0.0);\n";
+ code += " // if (!p_system->local_coordinates)\n";
+ code += " //org=p_transform.origin;\n";
+ code += " force+=normalize(pos-org) * (radial_accel+tex_radial_accel)*mix(1.0,rand_from_seed(alt_seed),radial_accel_random);\n";
+ code += " //apply tangential acceleration;\n";
+ code += " force+=normalize(cross(normalize(pos-org),normalize(gravity))) * ((tangent_accel+tex_tangent_accel)*mix(1.0,rand_from_seed(alt_seed),radial_accel_random));\n";
+ code += " //apply attractor forces\n";
+ code += " VELOCITY+=force * DELTA;\n";
+ if (tex_parameters[PARAM_INITIAL_LINEAR_VELOCITY].is_valid())
+ code += " VELOCITY=normalize(VELOCITY)*tex_linear_velocity;\n";
+ code += " if (damping+tex_damping>0.0) {\n";
+ code += " \n";
+ code += " float v = length(VELOCITY);\n";
+ code += " float damp = (damping+tex_damping)*mix(1.0,rand_from_seed(alt_seed),damping_random);\n";
+ code += " v -= damp * DELTA;\n";
+ code += " if (v<0.0) {\n";
+ code += " VELOCITY=vec3(0.0);\n";
+ code += " } else {\n";
+ code += " VELOCITY=normalize(VELOCITY) * v;\n";
+ code += " }\n";
+ code += " }\n";
+ code += " float base_angle=(initial_angle+tex_angle)*mix(1.0,angle_rand,initial_angle_random)*3.1416/180.0;\n";
+ code += " CUSTOM.x=((base_angle+tex_angle)+CUSTOM.y*LIFETIME*(angular_velocity+tex_angular_velocity)*mix(1.0,rand_from_seed(alt_seed)*2.0-1.0,angular_velocity_random))*3.1416/180.0;\n"; //angle
+ code += " CUSTOM.z=(anim_offset+tex_anim_offset)*mix(1.0,anim_offset_rand,anim_offset_random)+CUSTOM.y*LIFETIME*(anim_speed+tex_anim_speed)*mix(1.0,rand_from_seed(alt_seed),anim_speed_random);\n"; //angle
+ code += " }\n";
+ //apply color
+ //apply hue rotation
+ if (tex_parameters[PARAM_SCALE].is_valid())
+ code += " float tex_scale = textureLod(scale_texture,vec2(CUSTOM.y,0.0),0.0).r;\n";
+ else
+ code += " float tex_scale = 1.0;\n";
+
+ if (tex_parameters[PARAM_HUE_VARIATION].is_valid())
+ code += " float tex_hue_variation = textureLod(hue_variation_texture,vec2(CUSTOM.y,0.0),0.0).r;\n";
+ else
+ code += " float tex_hue_variation = 0.0;\n";
+
+ code += " float hue_rot_angle = (hue_variation+tex_hue_variation)*3.1416*2.0*mix(1.0,hue_rot_rand*2.0-1.0,hue_variation_random);\n";
+ code += " float hue_rot_c = cos(hue_rot_angle);\n";
+ code += " float hue_rot_s = sin(hue_rot_angle);\n";
+ code += " mat4 hue_rot_mat = mat4( vec4(0.299, 0.587, 0.114, 0.0),\n";
+ code += " vec4(0.299, 0.587, 0.114, 0.0),\n";
+ code += " vec4(0.299, 0.587, 0.114, 0.0),\n";
+ code += " vec4(0.000, 0.000, 0.000, 1.0)) +\n";
+ code += " \n";
+ code += " mat4( vec4(0.701, -0.587, -0.114, 0.0),\n";
+ code += " vec4(-0.299, 0.413, -0.114, 0.0),\n";
+ code += " vec4(-0.300, -0.588, 0.886, 0.0),\n";
+ code += " vec4(0.000, 0.000, 0.000, 0.0)) * hue_rot_c +\n";
+ code += "\n";
+ code += " mat4( vec4(0.168, 0.330, -0.497, 0.0),\n";
+ code += " vec4(-0.328, 0.035, 0.292, 0.0),\n";
+ code += " vec4(1.250, -1.050, -0.203, 0.0),\n";
+ code += " vec4(0.000, 0.000, 0.000, 0.0)) * hue_rot_s;\n";
+ if (color_ramp.is_valid()) {
+ code += " COLOR = textureLod(color_ramp,vec2(CUSTOM.y,0.0),0.0) * hue_rot_mat;\n";
+ } else {
+ code += " COLOR = color_value * hue_rot_mat;\n";
+ }
+ if (trail_color_modifier.is_valid()) {
+ code += "if (trail_divisor>1) { COLOR*=textureLod(trail_color_modifier,vec2(float(int(NUMBER)%trail_divisor)/float(trail_divisor-1),0.0),0.0); }\n";
+ }
+ code += "\n";
+ //orient particle Y towards velocity
+ if (flags[FLAG_ALIGN_Y_TO_VELOCITY]) {
+ code += " if (length(VELOCITY)>0.0) {TRANSFORM[1].xyz=normalize(VELOCITY);} else {TRANSFORM[1].xyz=normalize(TRANSFORM[1].xyz);}\n";
+ code += " if (TRANSFORM[1].xyz==normalize(TRANSFORM[0].xyz)) {\n";
+ code += "\tTRANSFORM[0].xyz=normalize(cross(normalize(TRANSFORM[1].xyz),normalize(TRANSFORM[2].xyz)));\n";
+ code += "\tTRANSFORM[2].xyz=normalize(cross(normalize(TRANSFORM[0].xyz),normalize(TRANSFORM[1].xyz)));\n";
+ code += " } else {\n";
+ code += "\tTRANSFORM[2].xyz=normalize(cross(normalize(TRANSFORM[0].xyz),normalize(TRANSFORM[1].xyz)));\n";
+ code += "\tTRANSFORM[0].xyz=normalize(cross(normalize(TRANSFORM[1].xyz),normalize(TRANSFORM[2].xyz)));\n";
+ code += " }\n";
+ } else {
+ code += "\tTRANSFORM[0].xyz=normalize(TRANSFORM[0].xyz);\n";
+ code += "\tTRANSFORM[1].xyz=normalize(TRANSFORM[1].xyz);\n";
+ code += "\tTRANSFORM[2].xyz=normalize(TRANSFORM[2].xyz);\n";
+ }
+ //turn particle by rotation in Y
+ if (flags[FLAG_ROTATE_Y]) {
+ code += "\tTRANSFORM = TRANSFORM * mat4( vec4(cos(CUSTOM.x),0.0,-sin(CUSTOM.x),0.0), vec4(0.0,1.0,0.0,0.0),vec4(sin(CUSTOM.x),0.0,cos(CUSTOM.x),0.0),vec4(0.0,0.0,0.0,1.0));\n";
+ }
+ //scale by scale
+ code += " float base_scale=mix(scale*tex_scale,1.0,scale_random*scale_rand);\n";
+ if (trail_size_modifier.is_valid()) {
+ code += "if (trail_divisor>1) { base_scale*=textureLod(trail_size_modifier,vec2(float(int(NUMBER)%trail_divisor)/float(trail_divisor-1),0.0),0.0).r; } \n";
+ }
+
+ code += " TRANSFORM[0].xyz*=base_scale;\n";
+ code += " TRANSFORM[1].xyz*=base_scale;\n";
+ code += " TRANSFORM[2].xyz*=base_scale;\n";
+ code += "}\n";
+ code += "\n";
+
+ ShaderData shader_data;
+ shader_data.shader = VS::get_singleton()->shader_create();
+ shader_data.users = 1;
+
+ VS::get_singleton()->shader_set_code(shader_data.shader, code);
+
+ shader_map[mk] = shader_data;
+
+ VS::get_singleton()->material_set_shader(_get_material(), shader_data.shader);
}
-void Particles::set_randomness(Variable p_variable,float p_randomness) {
+void ParticlesMaterial::flush_changes() {
+
+ if (material_mutex)
+ material_mutex->lock();
- ERR_FAIL_INDEX(p_variable,VAR_MAX);
- var_random[p_variable]=p_randomness;
- VisualServer::get_singleton()->particles_set_randomness(particles,(VS::ParticleVariable)p_variable,p_randomness);
+ while (dirty_materials.first()) {
+
+ dirty_materials.first()->self()->_update_shader();
+ }
+ if (material_mutex)
+ material_mutex->unlock();
}
-float Particles::get_randomness(Variable p_variable) const {
- ERR_FAIL_INDEX_V(p_variable,VAR_MAX,-1);
- return var_random[p_variable];
+void ParticlesMaterial::_queue_shader_change() {
+ if (material_mutex)
+ material_mutex->lock();
+
+ print_line("queuing change");
+ if (!element.in_list()) {
+ print_line("not in list, adding");
+ dirty_materials.add(&element);
+ }
+
+ if (material_mutex)
+ material_mutex->unlock();
}
-void Particles::set_color_phase_pos(int p_phase, float p_pos) {
+bool ParticlesMaterial::_is_shader_dirty() const {
+
+ bool dirty = false;
+
+ if (material_mutex)
+ material_mutex->lock();
+
+ dirty = element.in_list();
- ERR_FAIL_INDEX(p_phase,VS::MAX_PARTICLE_COLOR_PHASES);
- color_phase[p_phase].pos=p_pos;
- VisualServer::get_singleton()->particles_set_color_phase_pos(particles,p_phase,p_pos);
+ if (material_mutex)
+ material_mutex->unlock();
+ return dirty;
}
-float Particles::get_color_phase_pos(int p_phase) const {
- ERR_FAIL_INDEX_V(p_phase,VS::MAX_PARTICLE_COLOR_PHASES,-1);
- return color_phase[p_phase].pos;
+void ParticlesMaterial::set_spread(float p_spread) {
+
+ spread = p_spread;
+ VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->spread, p_spread);
}
-void Particles::set_color_phase_color(int p_phase, const Color& p_color) {
+float ParticlesMaterial::get_spread() const {
+
+ return spread;
+}
- ERR_FAIL_INDEX(p_phase,VS::MAX_PARTICLE_COLOR_PHASES);
- color_phase[p_phase].color=p_color;
- VisualServer::get_singleton()->particles_set_color_phase_color(particles,p_phase,p_color);
+void ParticlesMaterial::set_flatness(float p_flatness) {
+ flatness = p_flatness;
+ VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->flatness, p_flatness);
}
-Color Particles::get_color_phase_color(int p_phase) const {
+float ParticlesMaterial::get_flatness() const {
- ERR_FAIL_INDEX_V(p_phase,VS::MAX_PARTICLE_COLOR_PHASES,Color());
- return color_phase[p_phase].color;
+ return flatness;
+}
+void ParticlesMaterial::set_param(Parameter p_param, float p_value) {
+
+ ERR_FAIL_INDEX(p_param, PARAM_MAX);
+
+ parameters[p_param] = p_value;
+
+ switch (p_param) {
+ case PARAM_INITIAL_LINEAR_VELOCITY: {
+ VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->initial_linear_velocity, p_value);
+ } break;
+ case PARAM_ANGULAR_VELOCITY: {
+ VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->angular_velocity, p_value);
+ } break;
+ case PARAM_ORBIT_VELOCITY: {
+ VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->orbit_velocity, p_value);
+ } break;
+ case PARAM_LINEAR_ACCEL: {
+ VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->linear_accel, p_value);
+ } break;
+ case PARAM_RADIAL_ACCEL: {
+ VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->radial_accel, p_value);
+ } break;
+ case PARAM_TANGENTIAL_ACCEL: {
+ VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->tangent_accel, p_value);
+ } break;
+ case PARAM_DAMPING: {
+ VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->damping, p_value);
+ } break;
+ case PARAM_ANGLE: {
+ VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->initial_angle, p_value);
+ } break;
+ case PARAM_SCALE: {
+ VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->scale, p_value);
+ } break;
+ case PARAM_HUE_VARIATION: {
+ VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->hue_variation, p_value);
+ } break;
+ case PARAM_ANIM_SPEED: {
+ VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->anim_speed, p_value);
+ } break;
+ case PARAM_ANIM_OFFSET: {
+ VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->anim_offset, p_value);
+ } break;
+ case PARAM_MAX: {
+ };
+ }
}
+float ParticlesMaterial::get_param(Parameter p_param) const {
-void Particles::set_material(const Ref<Material>& p_material) {
+ ERR_FAIL_INDEX_V(p_param, PARAM_MAX, 0);
- material=p_material;
- if(material.is_null()) {
- VisualServer::get_singleton()->particles_set_material(particles,RID());
- } else {
- VisualServer::get_singleton()->particles_set_material(particles,material->get_rid());
+ return parameters[p_param];
+}
+
+void ParticlesMaterial::set_param_randomness(Parameter p_param, float p_value) {
+
+ ERR_FAIL_INDEX(p_param, PARAM_MAX);
+
+ randomness[p_param] = p_value;
+
+ switch (p_param) {
+ case PARAM_INITIAL_LINEAR_VELOCITY: {
+ VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->initial_linear_velocity_random, p_value);
+ } break;
+ case PARAM_ANGULAR_VELOCITY: {
+ VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->angular_velocity_random, p_value);
+ } break;
+ case PARAM_ORBIT_VELOCITY: {
+ VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->orbit_velocity_random, p_value);
+ } break;
+ case PARAM_LINEAR_ACCEL: {
+ VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->linear_accel_random, p_value);
+ } break;
+ case PARAM_RADIAL_ACCEL: {
+ VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->radial_accel_random, p_value);
+ } break;
+ case PARAM_TANGENTIAL_ACCEL: {
+ VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->tangent_accel_random, p_value);
+ } break;
+ case PARAM_DAMPING: {
+ VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->damping_random, p_value);
+ } break;
+ case PARAM_ANGLE: {
+ VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->initial_angle_random, p_value);
+ } break;
+ case PARAM_SCALE: {
+ VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->scale_random, p_value);
+ } break;
+ case PARAM_HUE_VARIATION: {
+ VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->hue_variation_random, p_value);
+ } break;
+ case PARAM_ANIM_SPEED: {
+ VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->anim_speed_random, p_value);
+ } break;
+ case PARAM_ANIM_OFFSET: {
+ VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->anim_offset_random, p_value);
+ } break;
+ case PARAM_MAX: {
+ };
}
+}
+float ParticlesMaterial::get_param_randomness(Parameter p_param) const {
+ ERR_FAIL_INDEX_V(p_param, PARAM_MAX, 0);
+
+ return randomness[p_param];
}
-void Particles::setup_timer() {
+static void _adjust_curve_range(const Ref<Texture> &p_texture, float p_min, float p_max) {
- if (emitting && emit_timeout > 0) {
+ Ref<CurveTexture> curve = p_texture;
+ if (!curve.is_valid())
+ return;
- timer->set_wait_time(emit_timeout);
- timer->start();
- timer->set_one_shot(true);
- };
-};
+ if (curve->get_max() == 1.0) {
+ curve->set_max(p_max);
+ }
+ if (curve->get_min() == 0.0) {
+ curve->set_min(p_min);
+ }
+}
-void Particles::set_emit_timeout(float p_timeout) {
+void ParticlesMaterial::set_param_texture(Parameter p_param, const Ref<Texture> &p_texture) {
+
+ ERR_FAIL_INDEX(p_param, PARAM_MAX);
+
+ tex_parameters[p_param] = p_texture;
+
+ switch (p_param) {
+ case PARAM_INITIAL_LINEAR_VELOCITY: {
+ //do none for this one
+ } break;
+ case PARAM_ANGULAR_VELOCITY: {
+ VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->angular_velocity_texture, p_texture);
+ _adjust_curve_range(p_texture, -360, 360);
+ } break;
+ case PARAM_ORBIT_VELOCITY: {
+ VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->orbit_velocity_texture, p_texture);
+ _adjust_curve_range(p_texture, -500, 500);
+ } break;
+ case PARAM_LINEAR_ACCEL: {
+ VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->linear_accel_texture, p_texture);
+ _adjust_curve_range(p_texture, -200, 200);
+ } break;
+ case PARAM_RADIAL_ACCEL: {
+ VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->radial_accel_texture, p_texture);
+ _adjust_curve_range(p_texture, -200, 200);
+ } break;
+ case PARAM_TANGENTIAL_ACCEL: {
+ VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->tangent_accel_texture, p_texture);
+ _adjust_curve_range(p_texture, -200, 200);
+ } break;
+ case PARAM_DAMPING: {
+ VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->damping_texture, p_texture);
+ _adjust_curve_range(p_texture, 0, 100);
+ } break;
+ case PARAM_ANGLE: {
+ VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->angle_texture, p_texture);
+ _adjust_curve_range(p_texture, -360, 360);
+ } break;
+ case PARAM_SCALE: {
+ VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->scale_texture, p_texture);
+
+ Ref<CurveTexture> curve = p_texture;
+ if (curve.is_valid()) {
+ if (curve->get_min() == 0 && curve->get_max() == 1) {
+
+ curve->set_max(32);
+ PoolVector<Vector2> points;
+ points.push_back(Vector2(0, 1));
+ points.push_back(Vector2(1, 1));
+ curve->set_points(points);
+ }
+ }
- emit_timeout = p_timeout;
- setup_timer();
-};
+ } break;
+ case PARAM_HUE_VARIATION: {
+ VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->hue_variation_texture, p_texture);
+ _adjust_curve_range(p_texture, -1, 1);
+ } break;
+ case PARAM_ANIM_SPEED: {
+ VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->anim_speed_texture, p_texture);
+ _adjust_curve_range(p_texture, 0, 200);
+ } break;
+ case PARAM_ANIM_OFFSET: {
+ VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->anim_offset_texture, p_texture);
+ } break;
+ case PARAM_MAX: {
+ };
+ }
-float Particles::get_emit_timeout() const {
+ _queue_shader_change();
+}
+Ref<Texture> ParticlesMaterial::get_param_texture(Parameter p_param) const {
- return emit_timeout;
-};
+ ERR_FAIL_INDEX_V(p_param, PARAM_MAX, Ref<Texture>());
+ return tex_parameters[p_param];
+}
-Ref<Material> Particles::get_material() const {
+void ParticlesMaterial::set_color(const Color &p_color) {
- return material;
+ VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->color, p_color);
+ color = p_color;
}
-void Particles::set_height_from_velocity(bool p_enable) {
+Color ParticlesMaterial::get_color() const {
- height_from_velocity=p_enable;
- VisualServer::get_singleton()->particles_set_height_from_velocity(particles,height_from_velocity);
+ return color;
}
-bool Particles::has_height_from_velocity() const {
+void ParticlesMaterial::set_color_ramp(const Ref<Texture> &p_texture) {
- return height_from_velocity;
+ color_ramp = p_texture;
+ VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->color_ramp, p_texture);
+ _queue_shader_change();
+ _change_notify();
}
-void Particles::set_color_phases(int p_phases) {
+Ref<Texture> ParticlesMaterial::get_color_ramp() const {
- color_phase_count=p_phases;
- VisualServer::get_singleton()->particles_set_color_phases(particles,p_phases);
+ return color_ramp;
}
-int Particles::get_color_phases() const{
+void ParticlesMaterial::set_flag(Flags p_flag, bool p_enable) {
+ ERR_FAIL_INDEX(p_flag, FLAG_MAX);
+ flags[p_flag] = p_enable;
+ _queue_shader_change();
+}
- return color_phase_count;
+bool ParticlesMaterial::get_flag(Flags p_flag) const {
+ ERR_FAIL_INDEX_V(p_flag, FLAG_MAX, false);
+ return flags[p_flag];
}
-bool Particles::_can_gizmo_scale() const {
+void ParticlesMaterial::set_emission_shape(EmissionShape p_shape) {
- return false;
+ emission_shape = p_shape;
+ _change_notify();
+ _queue_shader_change();
}
-void Particles::set_use_local_coordinates(bool p_use) {
+void ParticlesMaterial::set_emission_sphere_radius(float p_radius) {
- local_coordinates=p_use;
- VisualServer::get_singleton()->particles_set_use_local_coordinates(particles,local_coordinates);
+ emission_sphere_radius = p_radius;
+ VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->emission_sphere_radius, p_radius);
}
-bool Particles::is_using_local_coordinates() const{
+void ParticlesMaterial::set_emission_box_extents(Vector3 p_extents) {
- return local_coordinates;
+ emission_box_extents = p_extents;
+ VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->emission_box_extents, p_extents);
}
+void ParticlesMaterial::set_emission_point_texture(const Ref<Texture> &p_points) {
-RES Particles::_get_gizmo_geometry() const {
+ emission_point_texture = p_points;
+ RID texture;
+ if (p_points.is_valid())
+ texture = p_points->get_rid();
+ VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->emission_texture_points, texture);
+}
- Ref<SurfaceTool> surface_tool( memnew( SurfaceTool ));
+void ParticlesMaterial::set_emission_normal_texture(const Ref<Texture> &p_normals) {
- Ref<FixedSpatialMaterial> mat( memnew( FixedSpatialMaterial ));
+ emission_normal_texture = p_normals;
+ RID texture;
+ if (p_normals.is_valid())
+ texture = p_normals->get_rid();
+ VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->emission_texture_normal, texture);
+}
- mat->set_parameter( FixedSpatialMaterial::PARAM_DIFFUSE,Color(0.0,0.6,0.7,0.2) );
- mat->set_parameter( FixedSpatialMaterial::PARAM_EMISSION,Color(0.5,0.7,0.8) );
- mat->set_blend_mode( Material::BLEND_MODE_ADD );
- mat->set_flag(Material::FLAG_DOUBLE_SIDED,true);
- //mat->set_hint(Material::HINT_NO_DEPTH_DRAW,true);
+void ParticlesMaterial::set_emission_point_count(int p_count) {
+ emission_point_count = p_count;
+ VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->emission_texture_point_count, p_count);
+}
- surface_tool->begin(Mesh::PRIMITIVE_TRIANGLES);
- surface_tool->set_material(mat);
+ParticlesMaterial::EmissionShape ParticlesMaterial::get_emission_shape() const {
- int sides=16;
- int sections=24;
+ return emission_shape;
+}
- //float len=1;
- float deg=Math::deg2rad(var[VAR_SPREAD]*180);
- if (deg==180)
- deg=179.5;
+float ParticlesMaterial::get_emission_sphere_radius() const {
- Vector3 to=Vector3(0,0,-1);
+ return emission_sphere_radius;
+}
+Vector3 ParticlesMaterial::get_emission_box_extents() const {
- for(int j=0;j<sections;j++) {
+ return emission_box_extents;
+}
+Ref<Texture> ParticlesMaterial::get_emission_point_texture() const {
- Vector3 p1=Matrix3(Vector3(1,0,0),deg*j/sections).xform(to);
- Vector3 p2=Matrix3(Vector3(1,0,0),deg*(j+1)/sections).xform(to);
+ return emission_point_texture;
+}
+Ref<Texture> ParticlesMaterial::get_emission_normal_texture() const {
- for(int i=0;i<sides;i++) {
+ return emission_normal_texture;
+}
- Vector3 p1r = Matrix3(Vector3(0,0,1),Math_PI*2*float(i)/sides).xform(p1);
- Vector3 p1s = Matrix3(Vector3(0,0,1),Math_PI*2*float(i+1)/sides).xform(p1);
- Vector3 p2s = Matrix3(Vector3(0,0,1),Math_PI*2*float(i+1)/sides).xform(p2);
- Vector3 p2r = Matrix3(Vector3(0,0,1),Math_PI*2*float(i)/sides).xform(p2);
+int ParticlesMaterial::get_emission_point_count() const {
- surface_tool->add_normal(p1r.normalized());
- surface_tool->add_vertex(p1r);
- surface_tool->add_normal(p1s.normalized());
- surface_tool->add_vertex(p1s);
- surface_tool->add_normal(p2s.normalized());
- surface_tool->add_vertex(p2s);
+ return emission_point_count;
+}
- surface_tool->add_normal(p1r.normalized());
- surface_tool->add_vertex(p1r);
- surface_tool->add_normal(p2s.normalized());
- surface_tool->add_vertex(p2s);
- surface_tool->add_normal(p2r.normalized());
- surface_tool->add_vertex(p2r);
+void ParticlesMaterial::set_trail_divisor(int p_divisor) {
- if (j==sections-1) {
+ VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->trail_divisor, p_divisor);
+ trail_divisor = p_divisor;
+ _change_notify();
+}
- surface_tool->add_normal(p2r.normalized());
- surface_tool->add_vertex(p2r);
- surface_tool->add_normal(p2s.normalized());
- surface_tool->add_vertex(p2s);
- surface_tool->add_normal(Vector3(0,0,1));
- surface_tool->add_vertex(Vector3());
- }
+int ParticlesMaterial::get_trail_divisor() const {
+
+ return trail_divisor;
+}
+
+void ParticlesMaterial::set_trail_size_modifier(const Ref<CurveTexture> &p_trail_size_modifier) {
+
+ trail_size_modifier = p_trail_size_modifier;
+
+ Ref<CurveTexture> curve = trail_size_modifier;
+ if (curve.is_valid()) {
+ if (curve->get_min() == 0 && curve->get_max() == 1) {
+
+ curve->set_max(32);
+ PoolVector<Vector2> points;
+ points.push_back(Vector2(0, 1));
+ points.push_back(Vector2(1, 1));
+ curve->set_points(points);
}
}
+ RID texture;
+ if (p_trail_size_modifier.is_valid())
+ texture = p_trail_size_modifier->get_rid();
+ VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->trail_size_modifier, texture);
+ _queue_shader_change();
+}
- Ref<Mesh> mesh = surface_tool->commit();
+Ref<CurveTexture> ParticlesMaterial::get_trail_size_modifier() const {
- Ref<FixedSpatialMaterial> mat_aabb( memnew( FixedSpatialMaterial ));
+ return trail_size_modifier;
+}
- mat_aabb->set_parameter( FixedSpatialMaterial::PARAM_DIFFUSE,Color(0.8,0.8,0.9,0.7) );
- mat_aabb->set_line_width(3);
- mat_aabb->set_flag( Material::FLAG_UNSHADED, true );
+void ParticlesMaterial::set_trail_color_modifier(const Ref<GradientTexture> &p_trail_color_modifier) {
- surface_tool->begin(Mesh::PRIMITIVE_LINES);
- surface_tool->set_material(mat_aabb);
+ trail_color_modifier = p_trail_color_modifier;
+ RID texture;
+ if (p_trail_color_modifier.is_valid())
+ texture = p_trail_color_modifier->get_rid();
+ VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->trail_color_modifier, texture);
+ _queue_shader_change();
+}
- for(int i=0;i<12;i++) {
+Ref<GradientTexture> ParticlesMaterial::get_trail_color_modifier() const {
+
+ return trail_color_modifier;
+}
- Vector3 f,t;
- visibility_aabb.get_edge(i,f,t);
- surface_tool->add_vertex(f);
- surface_tool->add_vertex(t);
+void ParticlesMaterial::set_gravity(const Vector3 &p_gravity) {
+
+ gravity = p_gravity;
+ Vector3 gset = gravity;
+ if (gset == Vector3()) {
+ gset = Vector3(0, -0.000001, 0); //as gravity is used as upvector in some calculations
}
+ VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->gravity, gset);
+}
- return surface_tool->commit(mesh);
+Vector3 ParticlesMaterial::get_gravity() const {
+ return gravity;
}
+void ParticlesMaterial::_validate_property(PropertyInfo &property) const {
-void Particles::_bind_methods() {
+ if (property.name == "color" && color_ramp.is_valid()) {
+ property.usage = 0;
+ }
- ClassDB::bind_method(D_METHOD("set_amount","amount"),&Particles::set_amount);
- ClassDB::bind_method(D_METHOD("get_amount"),&Particles::get_amount);
- ClassDB::bind_method(D_METHOD("set_emitting","enabled"),&Particles::set_emitting);
- ClassDB::bind_method(D_METHOD("is_emitting"),&Particles::is_emitting);
- ClassDB::bind_method(D_METHOD("set_visibility_aabb","aabb"),&Particles::set_visibility_aabb);
- ClassDB::bind_method(D_METHOD("get_visibility_aabb"),&Particles::get_visibility_aabb);
- ClassDB::bind_method(D_METHOD("set_emission_half_extents","half_extents"),&Particles::set_emission_half_extents);
- ClassDB::bind_method(D_METHOD("get_emission_half_extents"),&Particles::get_emission_half_extents);
- ClassDB::bind_method(D_METHOD("set_emission_base_velocity","base_velocity"),&Particles::set_emission_base_velocity);
- ClassDB::bind_method(D_METHOD("get_emission_base_velocity"),&Particles::get_emission_base_velocity);
- ClassDB::bind_method(D_METHOD("set_emission_points","points"),&Particles::set_emission_points);
- ClassDB::bind_method(D_METHOD("get_emission_points"),&Particles::get_emission_points);
- ClassDB::bind_method(D_METHOD("set_gravity_normal","normal"),&Particles::set_gravity_normal);
- ClassDB::bind_method(D_METHOD("get_gravity_normal"),&Particles::get_gravity_normal);
- ClassDB::bind_method(D_METHOD("set_variable","variable","value"),&Particles::set_variable);
- ClassDB::bind_method(D_METHOD("get_variable","variable"),&Particles::get_variable);
- ClassDB::bind_method(D_METHOD("set_randomness","variable","randomness"),&Particles::set_randomness);
- ClassDB::bind_method(D_METHOD("get_randomness","variable"),&Particles::get_randomness);
- ClassDB::bind_method(D_METHOD("set_color_phase_pos","phase","pos"),&Particles::set_color_phase_pos);
- ClassDB::bind_method(D_METHOD("get_color_phase_pos","phase"),&Particles::get_color_phase_pos);
- ClassDB::bind_method(D_METHOD("set_color_phase_color","phase","color"),&Particles::set_color_phase_color);
- ClassDB::bind_method(D_METHOD("get_color_phase_color","phase"),&Particles::get_color_phase_color);
- ClassDB::bind_method(D_METHOD("set_material","material:Material"),&Particles::set_material);
- ClassDB::bind_method(D_METHOD("get_material:Material"),&Particles::get_material);
- ClassDB::bind_method(D_METHOD("set_emit_timeout","timeout"),&Particles::set_emit_timeout);
- ClassDB::bind_method(D_METHOD("get_emit_timeout"),&Particles::get_emit_timeout);
- ClassDB::bind_method(D_METHOD("set_height_from_velocity","enable"),&Particles::set_height_from_velocity);
- ClassDB::bind_method(D_METHOD("has_height_from_velocity"),&Particles::has_height_from_velocity);
- ClassDB::bind_method(D_METHOD("set_use_local_coordinates","enable"),&Particles::set_use_local_coordinates);
- ClassDB::bind_method(D_METHOD("is_using_local_coordinates"),&Particles::is_using_local_coordinates);
-
- ClassDB::bind_method(D_METHOD("set_color_phases","count"),&Particles::set_color_phases);
- ClassDB::bind_method(D_METHOD("get_color_phases"),&Particles::get_color_phases);
-
- ADD_PROPERTY( PropertyInfo( Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "Material" ), "set_material", "get_material") ;
-
- ADD_PROPERTY( PropertyInfo( Variant::INT, "amount", PROPERTY_HINT_RANGE, "1,1024,1" ), "set_amount", "get_amount") ;
- ADD_PROPERTY( PropertyInfo( Variant::BOOL, "emitting" ), "set_emitting", "is_emitting") ;
- ADD_PROPERTY( PropertyInfo( Variant::_AABB, "visibility" ), "set_visibility_aabb", "get_visibility_aabb") ;
- ADD_PROPERTY( PropertyInfo( Variant::VECTOR3, "emission_extents" ), "set_emission_half_extents", "get_emission_half_extents") ;
- ADD_PROPERTY( PropertyInfo( Variant::VECTOR3, "emission_base_velocity" ), "set_emission_base_velocity", "get_emission_base_velocity") ;
- ADD_PROPERTY( PropertyInfo( Variant::VECTOR3_ARRAY, "emission_points" ), "set_emission_points", "get_emission_points") ;
- ADD_PROPERTY( PropertyInfo( Variant::VECTOR3, "gravity_normal" ), "set_gravity_normal", "get_gravity_normal") ;
- ADD_PROPERTY( PropertyInfo( Variant::BOOL, "local_coords" ), "set_use_local_coordinates", "is_using_local_coordinates") ;
- ADD_PROPERTY( PropertyInfo( Variant::REAL, "emit_timeout",PROPERTY_HINT_RANGE,"0,256,0.01"), "set_emit_timeout", "get_emit_timeout") ;
-
-
- ADD_PROPERTYI( PropertyInfo( Variant::REAL, "vars/lifetime", PROPERTY_HINT_RANGE,"0.1,60,0.01"), "set_variable", "get_variable", VAR_LIFETIME );
- ADD_PROPERTYI( PropertyInfo( Variant::REAL, "vars/spread", PROPERTY_HINT_RANGE,"0,1,0.01"), "set_variable", "get_variable", VAR_SPREAD );
- ADD_PROPERTYI( PropertyInfo( Variant::REAL, "vars/gravity", PROPERTY_HINT_RANGE,"-48,48,0.01"), "set_variable", "get_variable", VAR_GRAVITY );
- ADD_PROPERTYI( PropertyInfo( Variant::REAL, "vars/linear_vel", PROPERTY_HINT_RANGE,"-100,100,0.01"), "set_variable", "get_variable", VAR_LINEAR_VELOCITY );
- ADD_PROPERTYI( PropertyInfo( Variant::REAL, "vars/angular_vel", PROPERTY_HINT_RANGE,"-100,100,0.01"), "set_variable", "get_variable", VAR_ANGULAR_VELOCITY );
- ADD_PROPERTYI( PropertyInfo( Variant::REAL, "vars/linear_accel", PROPERTY_HINT_RANGE,"-100,100,0.01"), "set_variable", "get_variable", VAR_LINEAR_ACCELERATION );
- ADD_PROPERTYI( PropertyInfo( Variant::REAL, "vars/radial_accel", PROPERTY_HINT_RANGE,"-100,100,0.01"), "set_variable", "get_variable", VAR_DRAG );
- ADD_PROPERTYI( PropertyInfo( Variant::REAL, "vars/tan_accel", PROPERTY_HINT_RANGE,"-100,100,0.01"), "set_variable", "get_variable", VAR_TANGENTIAL_ACCELERATION );
- ADD_PROPERTYI( PropertyInfo( Variant::REAL, "vars/damping", PROPERTY_HINT_RANGE,"0,128,0.01"), "set_variable", "get_variable", VAR_DAMPING );
- ADD_PROPERTYI( PropertyInfo( Variant::REAL, "vars/initial_size", PROPERTY_HINT_RANGE,"0,100,0.01"), "set_variable", "get_variable", VAR_INITIAL_SIZE );
- ADD_PROPERTYI( PropertyInfo( Variant::REAL, "vars/final_size", PROPERTY_HINT_RANGE,"0,100,0.01"), "set_variable", "get_variable", VAR_FINAL_SIZE );
- ADD_PROPERTYI( PropertyInfo( Variant::REAL, "vars/initial_angle",PROPERTY_HINT_RANGE,"0,1,0.01"), "set_variable", "get_variable", VAR_INITIAL_ANGLE );
- ADD_PROPERTY( PropertyInfo( Variant::BOOL, "vars/height_from_velocity"), "set_height_from_velocity", "has_height_from_velocity") ;
- ADD_PROPERTYI( PropertyInfo( Variant::REAL, "vars/height",PROPERTY_HINT_RANGE,"0,4096,0.01"), "set_variable", "get_variable", VAR_HEIGHT);
- ADD_PROPERTYI( PropertyInfo( Variant::REAL, "vars/height_speed_scale",PROPERTY_HINT_RANGE,"0,4096,0.01"), "set_variable", "get_variable", VAR_HEIGHT_SPEED_SCALE );
-
- for(int i=0;i<VAR_MAX;i++)
- ADD_PROPERTYI( PropertyInfo( Variant::REAL, _rand_names[i], PROPERTY_HINT_RANGE,"-16.0,16.0,0.01"),"set_randomness", "get_randomness",_var_indices[i] );
-
-
- ADD_PROPERTY( PropertyInfo( Variant::INT, "color_phases/count",PROPERTY_HINT_RANGE,"0,4,1"), "set_color_phases", "get_color_phases");
-
- for(int i=0;i<VS::MAX_PARTICLE_COLOR_PHASES;i++) {
- String phase="phase_"+itos(i)+"/";
- ADD_PROPERTYI( PropertyInfo( Variant::REAL, phase+"pos", PROPERTY_HINT_RANGE,"0,1,0.01"),"set_color_phase_pos","get_color_phase_pos",i );
- ADD_PROPERTYI( PropertyInfo( Variant::COLOR, phase+"color"),"set_color_phase_color","get_color_phase_color",i );
- }
-
- BIND_CONSTANT( VAR_LIFETIME );
- BIND_CONSTANT( VAR_SPREAD );
- BIND_CONSTANT( VAR_GRAVITY );
- BIND_CONSTANT( VAR_LINEAR_VELOCITY );
- BIND_CONSTANT( VAR_ANGULAR_VELOCITY );
- BIND_CONSTANT( VAR_LINEAR_ACCELERATION );
- BIND_CONSTANT( VAR_DRAG );
- BIND_CONSTANT( VAR_TANGENTIAL_ACCELERATION );
- BIND_CONSTANT( VAR_INITIAL_SIZE );
- BIND_CONSTANT( VAR_FINAL_SIZE );
- BIND_CONSTANT( VAR_INITIAL_ANGLE );
- BIND_CONSTANT( VAR_HEIGHT );
- BIND_CONSTANT( VAR_HEIGHT_SPEED_SCALE );
- BIND_CONSTANT( VAR_MAX );
+ if (property.name == "emission_sphere_radius" && emission_shape != EMISSION_SHAPE_SPHERE) {
+ property.usage = 0;
+ }
-}
+ if (property.name == "emission_box_extents" && emission_shape != EMISSION_SHAPE_BOX) {
+ property.usage = 0;
+ }
-Particles::Particles() {
+ if (property.name == "emission_point_texture" && (emission_shape != EMISSION_SHAPE_POINTS && emission_shape != EMISSION_SHAPE_DIRECTED_POINTS)) {
+ property.usage = 0;
+ }
- particles = VisualServer::get_singleton()->particles_create();
- timer = memnew(Timer);
- add_child(timer);
- emit_timeout = 0;
+ if (property.name == "emission_normal_texture" && emission_shape != EMISSION_SHAPE_DIRECTED_POINTS) {
+ property.usage = 0;
+ }
- set_amount(64);
- set_emitting(true);
- set_visibility_aabb(AABB( Vector3(-4,-4,-4), Vector3(8,8,8) ) );
-
- for (int i=0;i<VAR_MAX;i++) {
- set_randomness((Variable)i,0.0);
- }
-
- set_variable( VAR_LIFETIME, 5.0);
- set_variable( VAR_SPREAD, 0.2);
- set_variable( VAR_GRAVITY, 9.8);
- set_variable( VAR_LINEAR_VELOCITY, 0.2);
- set_variable( VAR_ANGULAR_VELOCITY, 0.0);
- set_variable( VAR_LINEAR_ACCELERATION, 0.0);
- set_variable( VAR_DRAG, 0.0);
- set_variable( VAR_TANGENTIAL_ACCELERATION, 0.0);
- set_variable( VAR_DAMPING, 0.0);
- set_variable( VAR_INITIAL_SIZE, 1.0);
- set_variable( VAR_FINAL_SIZE, 1.0);
- set_variable( VAR_INITIAL_ANGLE, 0.0);
- set_variable( VAR_HEIGHT, 1.0);
- set_variable( VAR_HEIGHT_SPEED_SCALE, 0.0);
-
- color_phase_count=0;
-
- set_color_phase_pos(0,0.0);
- set_color_phase_pos(1,1.0);
- set_color_phase_pos(2,1.0);
- set_color_phase_pos(3,1.0);
-
- set_color_phase_color(0,Color(1,1,1));
- set_color_phase_color(1,Color(0,0,0));
- set_color_phase_color(2,Color(0,0,0));
- set_color_phase_color(3,Color(0,0,0));
-
- set_gravity_normal(Vector3(0,-1.0,0));
- set_emission_half_extents(Vector3(0.1,0.1,0.1));
-
- height_from_velocity=false;
-
- Vector<Variant> pars;
- pars.push_back(false);
- timer->connect("timeout", this, "set_emitting", pars);
- set_base(particles);
- local_coordinates=false;
+ if (property.name == "emission_point_count" && (emission_shape != EMISSION_SHAPE_POINTS && emission_shape != EMISSION_SHAPE_DIRECTED_POINTS)) {
+ property.usage = 0;
+ }
}
+void ParticlesMaterial::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("set_spread", "degrees"), &ParticlesMaterial::set_spread);
+ ClassDB::bind_method(D_METHOD("get_spread"), &ParticlesMaterial::get_spread);
+
+ ClassDB::bind_method(D_METHOD("set_flatness", "amount"), &ParticlesMaterial::set_flatness);
+ ClassDB::bind_method(D_METHOD("get_flatness"), &ParticlesMaterial::get_flatness);
+
+ ClassDB::bind_method(D_METHOD("set_param", "param", "value"), &ParticlesMaterial::set_param);
+ ClassDB::bind_method(D_METHOD("get_param", "param"), &ParticlesMaterial::get_param);
+
+ ClassDB::bind_method(D_METHOD("set_param_randomness", "param", "randomness"), &ParticlesMaterial::set_param_randomness);
+ ClassDB::bind_method(D_METHOD("get_param_randomness", "param"), &ParticlesMaterial::get_param_randomness);
+
+ ClassDB::bind_method(D_METHOD("set_param_texture", "param", "texture"), &ParticlesMaterial::set_param_texture);
+ ClassDB::bind_method(D_METHOD("get_param_texture", "param"), &ParticlesMaterial::get_param_texture);
+
+ ClassDB::bind_method(D_METHOD("set_color", "color"), &ParticlesMaterial::set_color);
+ ClassDB::bind_method(D_METHOD("get_color"), &ParticlesMaterial::get_color);
+
+ ClassDB::bind_method(D_METHOD("set_color_ramp", "ramp:Texture"), &ParticlesMaterial::set_color_ramp);
+ ClassDB::bind_method(D_METHOD("get_color_ramp:Texture"), &ParticlesMaterial::get_color_ramp);
+
+ ClassDB::bind_method(D_METHOD("set_flag", "flag", "enable"), &ParticlesMaterial::set_flag);
+ ClassDB::bind_method(D_METHOD("get_flag", "flag"), &ParticlesMaterial::get_flag);
+
+ ClassDB::bind_method(D_METHOD("set_emission_shape", "shape"), &ParticlesMaterial::set_emission_shape);
+ ClassDB::bind_method(D_METHOD("get_emission_shape"), &ParticlesMaterial::get_emission_shape);
+
+ ClassDB::bind_method(D_METHOD("set_emission_sphere_radius", "radius"), &ParticlesMaterial::set_emission_sphere_radius);
+ ClassDB::bind_method(D_METHOD("get_emission_sphere_radius"), &ParticlesMaterial::get_emission_sphere_radius);
+
+ ClassDB::bind_method(D_METHOD("set_emission_box_extents", "extents"), &ParticlesMaterial::set_emission_box_extents);
+ ClassDB::bind_method(D_METHOD("get_emission_box_extents"), &ParticlesMaterial::get_emission_box_extents);
+
+ ClassDB::bind_method(D_METHOD("set_emission_point_texture", "texture:Texture"), &ParticlesMaterial::set_emission_point_texture);
+ ClassDB::bind_method(D_METHOD("get_emission_point_texture:Texture"), &ParticlesMaterial::get_emission_point_texture);
+
+ ClassDB::bind_method(D_METHOD("set_emission_normal_texture", "texture:Texture"), &ParticlesMaterial::set_emission_normal_texture);
+ ClassDB::bind_method(D_METHOD("get_emission_normal_texture:Texture"), &ParticlesMaterial::get_emission_normal_texture);
+
+ ClassDB::bind_method(D_METHOD("set_emission_point_count", "point_count"), &ParticlesMaterial::set_emission_point_count);
+ ClassDB::bind_method(D_METHOD("get_emission_point_count"), &ParticlesMaterial::get_emission_point_count);
+
+ ClassDB::bind_method(D_METHOD("set_trail_divisor", "divisor"), &ParticlesMaterial::set_trail_divisor);
+ ClassDB::bind_method(D_METHOD("get_trail_divisor"), &ParticlesMaterial::get_trail_divisor);
+
+ ClassDB::bind_method(D_METHOD("set_trail_size_modifier", "texture:CurveTexture"), &ParticlesMaterial::set_trail_size_modifier);
+ ClassDB::bind_method(D_METHOD("get_trail_size_modifier:CurveTexture"), &ParticlesMaterial::get_trail_size_modifier);
+
+ ClassDB::bind_method(D_METHOD("set_trail_color_modifier", "texture:GradientTexture"), &ParticlesMaterial::set_trail_color_modifier);
+ ClassDB::bind_method(D_METHOD("get_trail_color_modifier:GradientTexture"), &ParticlesMaterial::get_trail_color_modifier);
+
+ ClassDB::bind_method(D_METHOD("get_gravity"), &ParticlesMaterial::get_gravity);
+ ClassDB::bind_method(D_METHOD("set_gravity", "accel_vec"), &ParticlesMaterial::set_gravity);
+
+ ADD_GROUP("Trail", "trail_");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "trail_divisor", PROPERTY_HINT_RANGE, "1,1000000,1"), "set_trail_divisor", "get_trail_divisor");
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "trail_size_modifier", PROPERTY_HINT_RESOURCE_TYPE, "CurveTexture"), "set_trail_size_modifier", "get_trail_size_modifier");
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "trail_color_modifier", PROPERTY_HINT_RESOURCE_TYPE, "GradientTexture"), "set_trail_color_modifier", "get_trail_color_modifier");
+ ADD_GROUP("Emission Shape", "emission_");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "emission_shape", PROPERTY_HINT_ENUM, "Point,Sphere,Box,Points,Directed Points"), "set_emission_shape", "get_emission_shape");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "emission_sphere_radius", PROPERTY_HINT_RANGE, "0.01,128,0.01"), "set_emission_sphere_radius", "get_emission_sphere_radius");
+ ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "emission_box_extents"), "set_emission_box_extents", "get_emission_box_extents");
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "emission_point_texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), "set_emission_point_texture", "get_emission_point_texture");
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "emission_normal_texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), "set_emission_normal_texture", "get_emission_normal_texture");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "emission_point_count", PROPERTY_HINT_RANGE, "0,1000000,1"), "set_emission_point_count", "get_emission_point_count");
+ ADD_GROUP("Flags", "flag_");
+ ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "flag_align_y"), "set_flag", "get_flag", FLAG_ALIGN_Y_TO_VELOCITY);
+ ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "flag_rotate_y"), "set_flag", "get_flag", FLAG_ROTATE_Y);
+ ADD_GROUP("Spread", "");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "spread", PROPERTY_HINT_RANGE, "0,180,0.01"), "set_spread", "get_spread");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "flatness", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_flatness", "get_flatness");
+ ADD_GROUP("Gravity", "");
+ ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "gravity"), "set_gravity", "get_gravity");
+ ADD_GROUP("Initial Velocity", "initial_");
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "initial_velocity", PROPERTY_HINT_RANGE, "0,1000,0.01"), "set_param", "get_param", PARAM_INITIAL_LINEAR_VELOCITY);
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "initial_velocity_random", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param_randomness", "get_param_randomness", PARAM_INITIAL_LINEAR_VELOCITY);
+ ADD_GROUP("Angular Velocity", "angular_");
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "angular_velocity", PROPERTY_HINT_RANGE, "-360,360,0.01"), "set_param", "get_param", PARAM_ANGULAR_VELOCITY);
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "angular_velocity_random", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param_randomness", "get_param_randomness", PARAM_ANGULAR_VELOCITY);
+ ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "angular_velocity_curve", PROPERTY_HINT_RESOURCE_TYPE, "CurveTexture"), "set_param_texture", "get_param_texture", PARAM_ANGULAR_VELOCITY);
+ ADD_GROUP("Orbit Velocity", "orbit_");
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "orbit_velocity", PROPERTY_HINT_RANGE, "-1000,1000,0.01"), "set_param", "get_param", PARAM_ORBIT_VELOCITY);
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "orbit_velocity_random", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param_randomness", "get_param_randomness", PARAM_ORBIT_VELOCITY);
+ ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "orbit_velocity_curve", PROPERTY_HINT_RESOURCE_TYPE, "CurveTexture"), "set_param_texture", "get_param_texture", PARAM_ORBIT_VELOCITY);
+ ADD_GROUP("Linear Accel", "linear_");
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "linear_accel", PROPERTY_HINT_RANGE, "-100,100,0.01"), "set_param", "get_param", PARAM_LINEAR_ACCEL);
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "linear_accel_random", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param_randomness", "get_param_randomness", PARAM_LINEAR_ACCEL);
+ ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "linear_accel_curve", PROPERTY_HINT_RESOURCE_TYPE, "CurveTexture"), "set_param_texture", "get_param_texture", PARAM_LINEAR_ACCEL);
+ ADD_GROUP("Radial Accel", "radial_");
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "radial_accel", PROPERTY_HINT_RANGE, "-100,100,0.01"), "set_param", "get_param", PARAM_RADIAL_ACCEL);
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "radial_accel_random", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param_randomness", "get_param_randomness", PARAM_RADIAL_ACCEL);
+ ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "radial_accel_curve", PROPERTY_HINT_RESOURCE_TYPE, "CurveTexture"), "set_param_texture", "get_param_texture", PARAM_RADIAL_ACCEL);
+ ADD_GROUP("Tangential Accel", "tangential_");
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "tangential_accel", PROPERTY_HINT_RANGE, "-100,100,0.01"), "set_param", "get_param", PARAM_TANGENTIAL_ACCEL);
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "tangential_accel_random", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param_randomness", "get_param_randomness", PARAM_TANGENTIAL_ACCEL);
+ ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "tangential_accel_curve", PROPERTY_HINT_RESOURCE_TYPE, "CurveTexture"), "set_param_texture", "get_param_texture", PARAM_TANGENTIAL_ACCEL);
+ ADD_GROUP("Damping", "");
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "damping", PROPERTY_HINT_RANGE, "0,100,0.01"), "set_param", "get_param", PARAM_DAMPING);
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "damping_random", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param_randomness", "get_param_randomness", PARAM_DAMPING);
+ ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "damping_curve", PROPERTY_HINT_RESOURCE_TYPE, "CurveTexture"), "set_param_texture", "get_param_texture", PARAM_DAMPING);
+ ADD_GROUP("Angle", "");
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "angle", PROPERTY_HINT_RANGE, "-720,720,0.1"), "set_param", "get_param", PARAM_ANGLE);
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "angle_random", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param_randomness", "get_param_randomness", PARAM_ANGLE);
+ ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "angle_curve", PROPERTY_HINT_RESOURCE_TYPE, "CurveTexture"), "set_param_texture", "get_param_texture", PARAM_ANGLE);
+ ADD_GROUP("Scale", "");
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "scale", PROPERTY_HINT_RANGE, "0,1000,0.01"), "set_param", "get_param", PARAM_SCALE);
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "scale_random", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param_randomness", "get_param_randomness", PARAM_SCALE);
+ ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "scale_curve", PROPERTY_HINT_RESOURCE_TYPE, "CurveTexture"), "set_param_texture", "get_param_texture", PARAM_SCALE);
+ ADD_GROUP("Color", "");
+ ADD_PROPERTY(PropertyInfo(Variant::COLOR, "color"), "set_color", "get_color");
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "color_ramp", PROPERTY_HINT_RESOURCE_TYPE, "GradientTexture"), "set_color_ramp", "get_color_ramp");
+
+ ADD_GROUP("Hue Variation", "hue_");
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "hue_variation", PROPERTY_HINT_RANGE, "-1,1,0.1"), "set_param", "get_param", PARAM_HUE_VARIATION);
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "hue_variation_random", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param_randomness", "get_param_randomness", PARAM_HUE_VARIATION);
+ ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "hue_variation_curve", PROPERTY_HINT_RESOURCE_TYPE, "CurveTexture"), "set_param_texture", "get_param_texture", PARAM_HUE_VARIATION);
+ ADD_GROUP("Animation", "anim_");
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "anim_speed", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param", "get_param", PARAM_ANIM_SPEED);
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "anim_speed_random", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param_randomness", "get_param_randomness", PARAM_ANIM_SPEED);
+ ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "anim_speed_curve", PROPERTY_HINT_RESOURCE_TYPE, "CurveTexture"), "set_param_texture", "get_param_texture", PARAM_ANIM_SPEED);
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "anim_offset", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param", "get_param", PARAM_ANIM_OFFSET);
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "anim_offset_random", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param_randomness", "get_param_randomness", PARAM_ANIM_OFFSET);
+ ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "anim_offset_curve", PROPERTY_HINT_RESOURCE_TYPE, "CurveTexture"), "set_param_texture", "get_param_texture", PARAM_ANIM_OFFSET);
+
+ 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);
+}
-Particles::~Particles() {
+ParticlesMaterial::ParticlesMaterial()
+ : element(this) {
+
+ set_spread(45);
+ set_flatness(0);
+ set_param(PARAM_INITIAL_LINEAR_VELOCITY, 1);
+ set_param(PARAM_ORBIT_VELOCITY, 0);
+ set_param(PARAM_LINEAR_ACCEL, 0);
+ set_param(PARAM_RADIAL_ACCEL, 0);
+ set_param(PARAM_TANGENTIAL_ACCEL, 0);
+ set_param(PARAM_DAMPING, 0);
+ set_param(PARAM_ANGLE, 0);
+ set_param(PARAM_SCALE, 1);
+ set_param(PARAM_HUE_VARIATION, 0);
+ set_param(PARAM_ANIM_SPEED, 0);
+ set_param(PARAM_ANIM_OFFSET, 0);
+ set_emission_shape(EMISSION_SHAPE_POINT);
+ set_emission_sphere_radius(1);
+ set_emission_box_extents(Vector3(1, 1, 1));
+ set_trail_divisor(1);
+ set_gravity(Vector3(0, -9.8, 0));
+ emission_point_count = 1;
+
+ for (int i = 0; i < PARAM_MAX; i++) {
+ set_param_randomness(Parameter(i), 0);
+ }
- VisualServer::get_singleton()->free(particles);
+ for (int i = 0; i < FLAG_MAX; i++) {
+ flags[i] = false;
+ }
+
+ set_color(Color(1, 1, 1, 1));
+
+ current_key.key = 0;
+ current_key.invalid_key = 1;
+
+ _queue_shader_change();
}
-#endif
+ParticlesMaterial::~ParticlesMaterial() {
+}
diff --git a/scene/3d/particles.h b/scene/3d/particles.h
index 6cb1caad3a..63ebd7ed7b 100644
--- a/scene/3d/particles.h
+++ b/scene/3d/particles.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -37,130 +38,346 @@
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
-#if 0
+
class Particles : public GeometryInstance {
+private:
+ GDCLASS(Particles, GeometryInstance);
+
public:
+ enum DrawOrder {
+ DRAW_ORDER_INDEX,
+ DRAW_ORDER_LIFETIME,
+ DRAW_ORDER_VIEW_DEPTH,
+ };
- enum Variable {
- VAR_LIFETIME=VS::PARTICLE_LIFETIME,
- VAR_SPREAD=VS::PARTICLE_SPREAD,
- VAR_GRAVITY=VS::PARTICLE_GRAVITY,
- VAR_LINEAR_VELOCITY=VS::PARTICLE_LINEAR_VELOCITY,
- VAR_ANGULAR_VELOCITY=VS::PARTICLE_ANGULAR_VELOCITY,
- VAR_LINEAR_ACCELERATION=VS::PARTICLE_LINEAR_ACCELERATION,
- VAR_DRAG=VS::PARTICLE_RADIAL_ACCELERATION,
- VAR_TANGENTIAL_ACCELERATION=VS::PARTICLE_TANGENTIAL_ACCELERATION,
- VAR_DAMPING=VS::PARTICLE_DAMPING,
- VAR_INITIAL_SIZE=VS::PARTICLE_INITIAL_SIZE,
- VAR_FINAL_SIZE=VS::PARTICLE_FINAL_SIZE,
- VAR_INITIAL_ANGLE=VS::PARTICLE_INITIAL_ANGLE,
- VAR_HEIGHT=VS::PARTICLE_HEIGHT,
- VAR_HEIGHT_SPEED_SCALE=VS::PARTICLE_HEIGHT_SPEED_SCALE,
- VAR_MAX=VS::PARTICLE_VAR_MAX
+ enum {
+ MAX_DRAW_PASSES = 4
};
private:
- GDCLASS( Particles, GeometryInstance );
-
RID particles;
- int amount;
bool emitting;
- float emit_timeout;
- AABB visibility_aabb;
- Vector3 gravity_normal;
- Vector3 emission_half_extents;
- bool using_points;
- float var[VAR_MAX];
- float var_random[VAR_MAX];
- bool height_from_velocity;
- Vector3 emission_base_velocity;
- bool local_coordinates;
-
- struct ColorPhase {
-
- Color color;
- float pos;
- };
-
- virtual bool _can_gizmo_scale() const;
- virtual RES _get_gizmo_geometry() const;
-
- int color_phase_count;
+ int amount;
+ float lifetime;
+ float pre_process_time;
+ float explosiveness_ratio;
+ float randomness_ratio;
+ float speed_scale;
+ Rect3 visibility_aabb;
+ bool local_coords;
+ int fixed_fps;
+ bool fractional_delta;
- ColorPhase color_phase[4];
+ Ref<Material> process_material;
- Ref<Material> material;
+ DrawOrder draw_order;
- Timer* timer;
- void setup_timer();
+ Vector<Ref<Mesh> > draw_passes;
protected:
-
static void _bind_methods();
+ virtual void _validate_property(PropertyInfo &property) const;
public:
-
-
- AABB get_aabb() const;
+ Rect3 get_aabb() const;
PoolVector<Face3> get_faces(uint32_t p_usage_flags) const;
+ void set_emitting(bool p_emitting);
void set_amount(int p_amount);
- int get_amount() const;
+ void set_lifetime(float p_lifetime);
+ void set_pre_process_time(float p_time);
+ void set_explosiveness_ratio(float p_ratio);
+ void set_randomness_ratio(float p_ratio);
+ void set_visibility_aabb(const Rect3 &p_aabb);
+ void set_use_local_coordinates(bool p_enable);
+ void set_process_material(const Ref<Material> &p_material);
+ void set_speed_scale(float p_scale);
- void set_emitting(bool p_emitting);
bool is_emitting() const;
+ int get_amount() const;
+ float get_lifetime() const;
+ float get_pre_process_time() const;
+ float get_explosiveness_ratio() const;
+ float get_randomness_ratio() const;
+ Rect3 get_visibility_aabb() const;
+ bool get_use_local_coordinates() const;
+ Ref<Material> get_process_material() const;
+ float get_speed_scale() const;
- void set_visibility_aabb(const AABB& p_aabb);
- AABB get_visibility_aabb() const;
+ void set_fixed_fps(int p_count);
+ int get_fixed_fps() const;
- void set_emission_half_extents(const Vector3& p_half_extents);
- Vector3 get_emission_half_extents() const;
+ void set_fractional_delta(bool p_enable);
+ bool get_fractional_delta() const;
- void set_emission_base_velocity(const Vector3& p_base_velocity);
- Vector3 get_emission_base_velocity() const;
+ void set_draw_order(DrawOrder p_order);
+ DrawOrder get_draw_order() const;
- void set_emission_points(const PoolVector<Vector3>& p_points);
- PoolVector<Vector3> get_emission_points() const;
+ void set_draw_passes(int p_count);
+ int get_draw_passes() const;
- void set_gravity_normal(const Vector3& p_normal);
- Vector3 get_gravity_normal() const;
+ void set_draw_pass_mesh(int p_pass, const Ref<Mesh> &p_mesh);
+ Ref<Mesh> get_draw_pass_mesh(int p_pass) const;
- void set_variable(Variable p_variable,float p_value);
- float get_variable(Variable p_variable) const;
+ virtual String get_configuration_warning() const;
- void set_randomness(Variable p_variable,float p_randomness);
- float get_randomness(Variable p_variable) const;
+ Rect3 capture_aabb() const;
+ Particles();
+ ~Particles();
+};
- void set_color_phases(int p_phases);
- int get_color_phases() const;
+VARIANT_ENUM_CAST(Particles::DrawOrder)
- void set_color_phase_pos(int p_phase, float p_pos);
- float get_color_phase_pos(int p_phase) const;
+class ParticlesMaterial : public Material {
- void set_color_phase_color(int p_phase, const Color& p_color);
- Color get_color_phase_color(int p_phase) const;
+ GDCLASS(ParticlesMaterial, Material)
- void set_height_from_velocity(bool p_enable);
- bool has_height_from_velocity() const;
+public:
+ enum Parameter {
+
+ PARAM_INITIAL_LINEAR_VELOCITY,
+ PARAM_ANGULAR_VELOCITY,
+ PARAM_ORBIT_VELOCITY,
+ PARAM_LINEAR_ACCEL,
+ PARAM_RADIAL_ACCEL,
+ PARAM_TANGENTIAL_ACCEL,
+ PARAM_DAMPING,
+ PARAM_ANGLE,
+ PARAM_SCALE,
+ PARAM_HUE_VARIATION,
+ PARAM_ANIM_SPEED,
+ PARAM_ANIM_OFFSET,
+ PARAM_MAX
+ };
- void set_material(const Ref<Material>& p_material);
- Ref<Material> get_material() const;
+ enum Flags {
+ FLAG_ALIGN_Y_TO_VELOCITY,
+ FLAG_ROTATE_Y,
+ FLAG_MAX
+ };
- void set_emit_timeout(float p_timeout);
- float get_emit_timeout() const;
+ enum EmissionShape {
+ EMISSION_SHAPE_POINT,
+ EMISSION_SHAPE_SPHERE,
+ EMISSION_SHAPE_BOX,
+ EMISSION_SHAPE_POINTS,
+ EMISSION_SHAPE_DIRECTED_POINTS,
+ };
- void set_use_local_coordinates(bool p_use);
- bool is_using_local_coordinates() const;
+private:
+ union MaterialKey {
+
+ struct {
+ uint32_t texture_mask : 16;
+ uint32_t texture_color : 1;
+ uint32_t flags : 2;
+ uint32_t emission_shape : 2;
+ uint32_t trail_size_texture : 1;
+ uint32_t trail_color_texture : 1;
+ uint32_t invalid_key : 1;
+ };
+
+ uint32_t key;
+
+ bool operator<(const MaterialKey &p_key) const {
+ return key < p_key.key;
+ }
+ };
- void start_emitting(float p_time);
+ struct ShaderData {
+ RID shader;
+ int users;
+ };
+ static Map<MaterialKey, ShaderData> shader_map;
+
+ MaterialKey current_key;
+
+ _FORCE_INLINE_ MaterialKey _compute_key() const {
+
+ MaterialKey mk;
+ mk.key = 0;
+ for (int i = 0; i < PARAM_MAX; i++) {
+ if (tex_parameters[i].is_valid()) {
+ mk.texture_mask |= (1 << i);
+ }
+ }
+ for (int i = 0; i < FLAG_MAX; i++) {
+ if (flags[i]) {
+ mk.flags |= (1 << i);
+ }
+ }
+
+ mk.texture_color = color_ramp.is_valid() ? 1 : 0;
+ mk.emission_shape = emission_shape;
+ mk.trail_color_texture = trail_color_modifier.is_valid() ? 1 : 0;
+ mk.trail_size_texture = trail_size_modifier.is_valid() ? 1 : 0;
+
+ return mk;
+ }
+
+ static Mutex *material_mutex;
+ static SelfList<ParticlesMaterial>::List dirty_materials;
+
+ struct ShaderNames {
+ StringName spread;
+ StringName flatness;
+ StringName initial_linear_velocity;
+ StringName initial_angle;
+ StringName angular_velocity;
+ StringName orbit_velocity;
+ StringName linear_accel;
+ StringName radial_accel;
+ StringName tangent_accel;
+ StringName damping;
+ StringName scale;
+ StringName hue_variation;
+ StringName anim_speed;
+ StringName anim_offset;
+
+ StringName initial_linear_velocity_random;
+ StringName initial_angle_random;
+ StringName angular_velocity_random;
+ StringName orbit_velocity_random;
+ StringName linear_accel_random;
+ StringName radial_accel_random;
+ StringName tangent_accel_random;
+ StringName damping_random;
+ StringName scale_random;
+ StringName hue_variation_random;
+ StringName anim_speed_random;
+ StringName anim_offset_random;
+
+ StringName angle_texture;
+ StringName angular_velocity_texture;
+ StringName orbit_velocity_texture;
+ StringName linear_accel_texture;
+ StringName radial_accel_texture;
+ StringName tangent_accel_texture;
+ StringName damping_texture;
+ StringName scale_texture;
+ StringName hue_variation_texture;
+ StringName anim_speed_texture;
+ StringName anim_offset_texture;
+
+ StringName color;
+ StringName color_ramp;
+
+ StringName emission_sphere_radius;
+ StringName emission_box_extents;
+ StringName emission_texture_point_count;
+ StringName emission_texture_points;
+ StringName emission_texture_normal;
+
+ StringName trail_divisor;
+ StringName trail_size_modifier;
+ StringName trail_color_modifier;
+
+ StringName gravity;
+ };
- Particles();
- ~Particles();
+ static ShaderNames *shader_names;
+
+ SelfList<ParticlesMaterial> element;
+ void _update_shader();
+ _FORCE_INLINE_ void _queue_shader_change();
+ _FORCE_INLINE_ bool _is_shader_dirty() const;
+
+ float spread;
+ float flatness;
+
+ float parameters[PARAM_MAX];
+ float randomness[PARAM_MAX];
+
+ Ref<Texture> tex_parameters[PARAM_MAX];
+ Color color;
+ Ref<Texture> color_ramp;
+
+ bool flags[FLAG_MAX];
+
+ EmissionShape emission_shape;
+ float emission_sphere_radius;
+ Vector3 emission_box_extents;
+ Ref<Texture> emission_point_texture;
+ Ref<Texture> emission_normal_texture;
+ int emission_point_count;
+
+ int trail_divisor;
+
+ Ref<CurveTexture> trail_size_modifier;
+ Ref<GradientTexture> trail_color_modifier;
+
+ Vector3 gravity;
+
+ //do not save emission points here
+
+protected:
+ static void _bind_methods();
+ virtual void _validate_property(PropertyInfo &property) const;
+
+public:
+ void set_spread(float p_spread);
+ float get_spread() const;
+
+ void set_flatness(float p_flatness);
+ float get_flatness() const;
+
+ void set_param(Parameter p_param, float p_value);
+ float get_param(Parameter p_param) const;
+
+ void set_param_randomness(Parameter p_param, float p_value);
+ float get_param_randomness(Parameter p_param) const;
+
+ void set_param_texture(Parameter p_param, const Ref<Texture> &p_texture);
+ Ref<Texture> get_param_texture(Parameter p_param) const;
+
+ void set_color(const Color &p_color);
+ Color get_color() const;
+
+ void set_color_ramp(const Ref<Texture> &p_texture);
+ Ref<Texture> get_color_ramp() const;
+
+ void set_flag(Flags p_flag, bool p_enable);
+ bool get_flag(Flags p_flag) const;
+
+ void set_emission_shape(EmissionShape p_shape);
+ void set_emission_sphere_radius(float p_radius);
+ void set_emission_box_extents(Vector3 p_extents);
+ void set_emission_point_texture(const Ref<Texture> &p_points);
+ void set_emission_normal_texture(const Ref<Texture> &p_normals);
+ void set_emission_point_count(int p_count);
+
+ EmissionShape get_emission_shape() const;
+ float get_emission_sphere_radius() const;
+ Vector3 get_emission_box_extents() const;
+ Ref<Texture> get_emission_point_texture() const;
+ Ref<Texture> get_emission_normal_texture() const;
+ int get_emission_point_count() const;
+
+ void set_trail_divisor(int p_divisor);
+ int get_trail_divisor() const;
+
+ void set_trail_size_modifier(const Ref<CurveTexture> &p_trail_size_modifier);
+ Ref<CurveTexture> get_trail_size_modifier() const;
+
+ void set_trail_color_modifier(const Ref<GradientTexture> &p_trail_color_modifier);
+ Ref<GradientTexture> get_trail_color_modifier() const;
+
+ void set_gravity(const Vector3 &p_gravity);
+ Vector3 get_gravity() const;
+
+ static void init_shaders();
+ static void finish_shaders();
+ static void flush_changes();
+
+ ParticlesMaterial();
+ ~ParticlesMaterial();
};
-VARIANT_ENUM_CAST( Particles::Variable );
-#endif
+VARIANT_ENUM_CAST(ParticlesMaterial::Parameter)
+VARIANT_ENUM_CAST(ParticlesMaterial::Flags)
+VARIANT_ENUM_CAST(ParticlesMaterial::EmissionShape)
+
#endif
diff --git a/scene/3d/path.cpp b/scene/3d/path.cpp
index 457e9e5552..d535c545a8 100644
--- a/scene/3d/path.cpp
+++ b/scene/3d/path.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/path.h b/scene/3d/path.h
index 94227799ed..eeae0668a7 100644
--- a/scene/3d/path.h
+++ b/scene/3d/path.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp
index 78a00e4a7f..94f34d6fb3 100644
--- a/scene/3d/physics_body.cpp
+++ b/scene/3d/physics_body.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/physics_body.h b/scene/3d/physics_body.h
index 1cef946836..c62f6be13f 100644
--- a/scene/3d/physics_body.h
+++ b/scene/3d/physics_body.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/physics_joint.cpp b/scene/3d/physics_joint.cpp
index 8c20b003f8..3fb5c828c2 100644
--- a/scene/3d/physics_joint.cpp
+++ b/scene/3d/physics_joint.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/physics_joint.h b/scene/3d/physics_joint.h
index 90d86d652d..2b221e25f2 100644
--- a/scene/3d/physics_joint.h
+++ b/scene/3d/physics_joint.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/portal.cpp b/scene/3d/portal.cpp
index 391a74ec45..64a9dc14ab 100644
--- a/scene/3d/portal.cpp
+++ b/scene/3d/portal.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/portal.h b/scene/3d/portal.h
index 018708308f..7c25e4904b 100644
--- a/scene/3d/portal.h
+++ b/scene/3d/portal.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/position_3d.cpp b/scene/3d/position_3d.cpp
index ee09ed93a7..4e66ef13c0 100644
--- a/scene/3d/position_3d.cpp
+++ b/scene/3d/position_3d.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/position_3d.h b/scene/3d/position_3d.h
index dae94dfbaf..0adde19342 100644
--- a/scene/3d/position_3d.h
+++ b/scene/3d/position_3d.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/proximity_group.cpp b/scene/3d/proximity_group.cpp
index f1225b6901..5441904d81 100644
--- a/scene/3d/proximity_group.cpp
+++ b/scene/3d/proximity_group.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/proximity_group.h b/scene/3d/proximity_group.h
index f40ffe2ffe..fec3add41f 100644
--- a/scene/3d/proximity_group.h
+++ b/scene/3d/proximity_group.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/quad.cpp b/scene/3d/quad.cpp
index e32320681c..c3d83ad50d 100644
--- a/scene/3d/quad.cpp
+++ b/scene/3d/quad.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/quad.h b/scene/3d/quad.h
index 607d7238ed..bb6c1219ad 100644
--- a/scene/3d/quad.h
+++ b/scene/3d/quad.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/ray_cast.cpp b/scene/3d/ray_cast.cpp
index d5fba089e8..d3b4577c42 100644
--- a/scene/3d/ray_cast.cpp
+++ b/scene/3d/ray_cast.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/ray_cast.h b/scene/3d/ray_cast.h
index d1a284aee4..63a53d724f 100644
--- a/scene/3d/ray_cast.h
+++ b/scene/3d/ray_cast.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/reflection_probe.cpp b/scene/3d/reflection_probe.cpp
index 90dbd51272..845245b090 100644
--- a/scene/3d/reflection_probe.cpp
+++ b/scene/3d/reflection_probe.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/reflection_probe.h b/scene/3d/reflection_probe.h
index a2e4a18d68..d2a5facb5f 100644
--- a/scene/3d/reflection_probe.h
+++ b/scene/3d/reflection_probe.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/remote_transform.cpp b/scene/3d/remote_transform.cpp
index 202206dd02..b36f444bea 100644
--- a/scene/3d/remote_transform.cpp
+++ b/scene/3d/remote_transform.cpp
@@ -7,6 +7,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/remote_transform.h b/scene/3d/remote_transform.h
index fdfd959a96..9fa3011185 100644
--- a/scene/3d/remote_transform.h
+++ b/scene/3d/remote_transform.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/room_instance.cpp b/scene/3d/room_instance.cpp
index 3b6ae32d16..85713cf43a 100644
--- a/scene/3d/room_instance.cpp
+++ b/scene/3d/room_instance.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/room_instance.h b/scene/3d/room_instance.h
index 68be5eecf2..4176da92e8 100644
--- a/scene/3d/room_instance.h
+++ b/scene/3d/room_instance.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/scenario_fx.cpp b/scene/3d/scenario_fx.cpp
index 92ee608f73..874c21546d 100644
--- a/scene/3d/scenario_fx.cpp
+++ b/scene/3d/scenario_fx.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/scenario_fx.h b/scene/3d/scenario_fx.h
index bbdffdc131..b2a4bc5472 100644
--- a/scene/3d/scenario_fx.h
+++ b/scene/3d/scenario_fx.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/skeleton.cpp b/scene/3d/skeleton.cpp
index 3a5453c8ef..d498947a41 100644
--- a/scene/3d/skeleton.cpp
+++ b/scene/3d/skeleton.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/skeleton.h b/scene/3d/skeleton.h
index 7074289724..dc0adbb337 100644
--- a/scene/3d/skeleton.h
+++ b/scene/3d/skeleton.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/spatial.cpp b/scene/3d/spatial.cpp
index 1125a7a4d2..3debbf02c3 100644
--- a/scene/3d/spatial.cpp
+++ b/scene/3d/spatial.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -220,9 +221,10 @@ void Spatial::set_transform(const Transform &p_transform) {
data.local_transform = p_transform;
data.dirty |= DIRTY_VECTORS;
- _change_notify("transform/translation");
- _change_notify("transform/rotation");
- _change_notify("transform/scale");
+ _change_notify("translation");
+ _change_notify("rotation");
+ _change_notify("rotation_deg");
+ _change_notify("scale");
_propagate_transform_changed(this);
if (data.notify_local_transform) {
notification(NOTIFICATION_LOCAL_TRANSFORM_CHANGED);
@@ -510,22 +512,11 @@ Ref<World> Spatial::get_world() const {
return data.viewport->find_world();
}
-#ifdef TOOLS_ENABLED
-void Spatial::set_import_transform(const Transform &p_transform) {
- data.import_transform = p_transform;
-}
-
-Transform Spatial::get_import_transform() const {
-
- return data.import_transform;
-}
-#endif
-
void Spatial::_propagate_visibility_changed() {
notification(NOTIFICATION_VISIBILITY_CHANGED);
emit_signal(SceneStringNames::get_singleton()->visibility_changed);
- _change_notify("visibility/visible");
+ _change_notify("visible");
#ifdef TOOLS_ENABLED
if (data.gizmo.is_valid())
_update_gizmo();
@@ -728,9 +719,6 @@ void Spatial::_bind_methods() {
#ifdef TOOLS_ENABLED
ClassDB::bind_method(D_METHOD("_update_gizmo"), &Spatial::_update_gizmo);
- ClassDB::bind_method(D_METHOD("_set_import_transform"), &Spatial::set_import_transform);
- ClassDB::bind_method(D_METHOD("_get_import_transform"), &Spatial::get_import_transform);
- ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM, "_import_transform", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_import_transform", "_get_import_transform");
#endif
ClassDB::bind_method(D_METHOD("update_gizmo"), &Spatial::update_gizmo);
diff --git a/scene/3d/spatial.h b/scene/3d/spatial.h
index e5817883dd..764950aa8e 100644
--- a/scene/3d/spatial.h
+++ b/scene/3d/spatial.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -94,7 +95,6 @@ class Spatial : public Node {
Ref<SpatialGizmo> gizmo;
bool gizmo_disabled;
bool gizmo_dirty;
- Transform import_transform;
#endif
} data;
@@ -188,11 +188,6 @@ public:
void hide();
bool is_visible_in_tree() const;
-#ifdef TOOLS_ENABLED
- void set_import_transform(const Transform &p_transform);
- Transform get_import_transform() const;
-#endif
-
Spatial();
~Spatial();
};
diff --git a/scene/3d/spatial_indexer.cpp b/scene/3d/spatial_indexer.cpp
index cddbf9a4e8..7090c974a3 100644
--- a/scene/3d/spatial_indexer.cpp
+++ b/scene/3d/spatial_indexer.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/spatial_indexer.h b/scene/3d/spatial_indexer.h
index 94c579ba23..c8bdf8950d 100644
--- a/scene/3d/spatial_indexer.h
+++ b/scene/3d/spatial_indexer.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp
index 062e3943b9..e97b22f9e0 100644
--- a/scene/3d/sprite_3d.cpp
+++ b/scene/3d/sprite_3d.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/sprite_3d.h b/scene/3d/sprite_3d.h
index d1de4e1b88..625b37c32e 100644
--- a/scene/3d/sprite_3d.h
+++ b/scene/3d/sprite_3d.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/test_cube.cpp b/scene/3d/test_cube.cpp
index bab1d1e1c8..af09bef7a7 100644
--- a/scene/3d/test_cube.cpp
+++ b/scene/3d/test_cube.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/test_cube.h b/scene/3d/test_cube.h
index d03bea7b68..db2bef67fe 100644
--- a/scene/3d/test_cube.h
+++ b/scene/3d/test_cube.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/vehicle_body.cpp b/scene/3d/vehicle_body.cpp
index 4a647fe682..38e1ba1cd5 100644
--- a/scene/3d/vehicle_body.cpp
+++ b/scene/3d/vehicle_body.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/vehicle_body.h b/scene/3d/vehicle_body.h
index 55b521cfa6..cdb2ebc0be 100644
--- a/scene/3d/vehicle_body.h
+++ b/scene/3d/vehicle_body.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/visibility_notifier.cpp b/scene/3d/visibility_notifier.cpp
index 909ac002b0..5e6561adb7 100644
--- a/scene/3d/visibility_notifier.cpp
+++ b/scene/3d/visibility_notifier.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/visibility_notifier.h b/scene/3d/visibility_notifier.h
index 09c1175bf1..316b2c3575 100644
--- a/scene/3d/visibility_notifier.h
+++ b/scene/3d/visibility_notifier.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/3d/visual_instance.cpp b/scene/3d/visual_instance.cpp
index 852881abd4..104fa0f70f 100644
--- a/scene/3d/visual_instance.cpp
+++ b/scene/3d/visual_instance.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -318,9 +319,6 @@ void GeometryInstance::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material_override", PROPERTY_HINT_RESOURCE_TYPE, "Material"), "set_material_override", "get_material_override");
ADD_PROPERTY(PropertyInfo(Variant::INT, "cast_shadow", PROPERTY_HINT_ENUM, "Off,On,Double-Sided,Shadows Only"), "set_cast_shadows_setting", "get_cast_shadows_setting");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "extra_cull_margin", PROPERTY_HINT_RANGE, "0,16384,0"), "set_extra_cull_margin", "get_extra_cull_margin");
- ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "use_as_billboard"), "set_flag", "get_flag", FLAG_BILLBOARD);
- ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "use_as_y_billboard"), "set_flag", "get_flag", FLAG_BILLBOARD_FIX_Y);
- ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "use_depth_scale"), "set_flag", "get_flag", FLAG_DEPH_SCALE);
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "visible_in_all_rooms"), "set_flag", "get_flag", FLAG_VISIBLE_IN_ALL_ROOMS);
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "use_in_baked_light"), "set_flag", "get_flag", FLAG_USE_BAKED_LIGHT);
@@ -333,9 +331,6 @@ void GeometryInstance::_bind_methods() {
//ADD_SIGNAL( MethodInfo("visibility_changed"));
BIND_CONSTANT(FLAG_CAST_SHADOW);
- BIND_CONSTANT(FLAG_BILLBOARD);
- BIND_CONSTANT(FLAG_BILLBOARD_FIX_Y);
- BIND_CONSTANT(FLAG_DEPH_SCALE);
BIND_CONSTANT(FLAG_VISIBLE_IN_ALL_ROOMS);
BIND_CONSTANT(FLAG_MAX);
diff --git a/scene/3d/visual_instance.h b/scene/3d/visual_instance.h
index 9f1cba923f..9318198e54 100644
--- a/scene/3d/visual_instance.h
+++ b/scene/3d/visual_instance.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -84,9 +85,6 @@ class GeometryInstance : public VisualInstance {
public:
enum Flags {
FLAG_CAST_SHADOW = VS::INSTANCE_FLAG_CAST_SHADOW,
- FLAG_BILLBOARD = VS::INSTANCE_FLAG_BILLBOARD,
- FLAG_BILLBOARD_FIX_Y = VS::INSTANCE_FLAG_BILLBOARD_FIX_Y,
- FLAG_DEPH_SCALE = VS::INSTANCE_FLAG_DEPH_SCALE,
FLAG_VISIBLE_IN_ALL_ROOMS = VS::INSTANCE_FLAG_VISIBLE_IN_ALL_ROOMS,
FLAG_USE_BAKED_LIGHT = VS::INSTANCE_FLAG_USE_BAKED_LIGHT,
FLAG_MAX = VS::INSTANCE_FLAG_MAX,
diff --git a/scene/animation/animation_cache.cpp b/scene/animation/animation_cache.cpp
index 93fbde519e..31fee0e347 100644
--- a/scene/animation/animation_cache.cpp
+++ b/scene/animation/animation_cache.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/animation/animation_cache.h b/scene/animation/animation_cache.h
index 1668c62519..6687098d00 100644
--- a/scene/animation/animation_cache.h
+++ b/scene/animation/animation_cache.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp
index dc9aa1758a..c4ea42d461 100644
--- a/scene/animation/animation_player.cpp
+++ b/scene/animation/animation_player.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -610,7 +611,7 @@ void AnimationPlayer::_animation_update_transforms() {
case SP_NONE: pa->object->set(pa->prop,pa->value_accum); break; //you are not speshul
- case SP_NODE2D_POS: static_cast<Node2D*>(pa->object)->set_pos(pa->value_accum); break;
+ case SP_NODE2D_POS: static_cast<Node2D*>(pa->object)->set_position(pa->value_accum); break;
case SP_NODE2D_ROT: static_cast<Node2D*>(pa->object)->set_rot(Math::deg2rad(pa->value_accum)); break;
case SP_NODE2D_SCALE: static_cast<Node2D*>(pa->object)->set_scale(pa->value_accum); break;
}*/
diff --git a/scene/animation/animation_player.h b/scene/animation/animation_player.h
index b5679d62f1..96fc70a3ad 100644
--- a/scene/animation/animation_player.h
+++ b/scene/animation/animation_player.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/animation/animation_tree_player.cpp b/scene/animation/animation_tree_player.cpp
index 6f4279526a..7c2684ba47 100644
--- a/scene/animation/animation_tree_player.cpp
+++ b/scene/animation/animation_tree_player.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/animation/animation_tree_player.h b/scene/animation/animation_tree_player.h
index 35fce9b15d..062b4e1eeb 100644
--- a/scene/animation/animation_tree_player.h
+++ b/scene/animation/animation_tree_player.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp
index c455d20b14..2a6ffb5628 100644
--- a/scene/animation/tween.cpp
+++ b/scene/animation/tween.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -610,6 +611,7 @@ void Tween::_tween_process(float p_delta) {
_apply_tween_value(data, result);
if (data.finish) {
+ _apply_tween_value(data, data.final_val);
emit_signal("tween_completed", object, data.key);
// not repeat mode, remove completed action
if (!repeat)
diff --git a/scene/animation/tween.h b/scene/animation/tween.h
index 84f866f43e..f89f3bdc44 100644
--- a/scene/animation/tween.h
+++ b/scene/animation/tween.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/animation/tween_interpolaters.cpp b/scene/animation/tween_interpolaters.cpp
index ef55b63edd..434f4df3e1 100644
--- a/scene/animation/tween_interpolaters.cpp
+++ b/scene/animation/tween_interpolaters.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/audio/audio_player.cpp b/scene/audio/audio_player.cpp
index 1ee31a94d8..a320a30e8a 100644
--- a/scene/audio/audio_player.cpp
+++ b/scene/audio/audio_player.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/audio/audio_player.h b/scene/audio/audio_player.h
index 0d78626189..5a8a8494e1 100644
--- a/scene/audio/audio_player.h
+++ b/scene/audio/audio_player.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp
index eceee8e317..ee4f8736d7 100644
--- a/scene/gui/base_button.cpp
+++ b/scene/gui/base_button.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/base_button.h b/scene/gui/base_button.h
index e382df61c9..62b6633bfc 100644
--- a/scene/gui/base_button.h
+++ b/scene/gui/base_button.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/box_container.cpp b/scene/gui/box_container.cpp
index 7c1487c42f..e7f4a274d5 100644
--- a/scene/gui/box_container.cpp
+++ b/scene/gui/box_container.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -98,7 +99,7 @@ void BoxContainer::_resort() {
elements exist */
bool has_stretched = false;
- while (stretch_ratio_total > 0) { // first of all, dont even be here if no stretchable objects exist
+ while (stretch_ratio_total > 0) { // first of all, don't even be here if no stretchable objects exist
has_stretched = true;
bool refit_successful = true; //assume refit-test will go well
diff --git a/scene/gui/box_container.h b/scene/gui/box_container.h
index 04b074896b..d544ff79d1 100644
--- a/scene/gui/box_container.h
+++ b/scene/gui/box_container.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/button.cpp b/scene/gui/button.cpp
index 23915c51a8..6fcc878e11 100644
--- a/scene/gui/button.cpp
+++ b/scene/gui/button.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/button.h b/scene/gui/button.h
index 38605bd3ef..499e44c0e1 100644
--- a/scene/gui/button.h
+++ b/scene/gui/button.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/button_array.cpp b/scene/gui/button_array.cpp
index c1cb9ad855..eccf3ea64a 100644
--- a/scene/gui/button_array.cpp
+++ b/scene/gui/button_array.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/button_array.h b/scene/gui/button_array.h
index dac130e79a..f2f7bea9c6 100644
--- a/scene/gui/button_array.h
+++ b/scene/gui/button_array.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/button_group.cpp b/scene/gui/button_group.cpp
index 21c1559b8f..75fe438448 100644
--- a/scene/gui/button_group.cpp
+++ b/scene/gui/button_group.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/button_group.h b/scene/gui/button_group.h
index 38acd06984..93c3aaaeb3 100644
--- a/scene/gui/button_group.h
+++ b/scene/gui/button_group.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/center_container.cpp b/scene/gui/center_container.cpp
index 9cee8c0cc1..bdc811870d 100644
--- a/scene/gui/center_container.cpp
+++ b/scene/gui/center_container.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/center_container.h b/scene/gui/center_container.h
index c2deb823f1..30b526e893 100644
--- a/scene/gui/center_container.h
+++ b/scene/gui/center_container.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/check_box.cpp b/scene/gui/check_box.cpp
index c7e2f4e7f9..b61d516599 100644
--- a/scene/gui/check_box.cpp
+++ b/scene/gui/check_box.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/check_box.h b/scene/gui/check_box.h
index 9b682de177..ec8e097bae 100644
--- a/scene/gui/check_box.h
+++ b/scene/gui/check_box.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/check_button.cpp b/scene/gui/check_button.cpp
index 6b24e0889a..1c3d4df308 100644
--- a/scene/gui/check_button.cpp
+++ b/scene/gui/check_button.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/check_button.h b/scene/gui/check_button.h
index adf210a1e1..8634858cfe 100644
--- a/scene/gui/check_button.h
+++ b/scene/gui/check_button.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp
index 0f982167bf..adb5e2f0b6 100644
--- a/scene/gui/color_picker.cpp
+++ b/scene/gui/color_picker.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -590,7 +591,7 @@ void ColorPickerButton::_color_changed(const Color &p_color) {
void ColorPickerButton::pressed() {
Size2 ms = Size2(300, picker->get_combined_minimum_size().height + 10);
- popup->set_pos(get_global_pos() - Size2(0, ms.height));
+ popup->set_position(get_global_position() - Size2(0, ms.height));
popup->set_size(ms);
popup->popup();
picker->set_focus_on_line_edit();
diff --git a/scene/gui/color_picker.h b/scene/gui/color_picker.h
index bd1abeecbe..bce1ae07f7 100644
--- a/scene/gui/color_picker.h
+++ b/scene/gui/color_picker.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/color_ramp_edit.cpp b/scene/gui/color_ramp_edit.cpp
index 131638bb70..c6f73fe6e6 100644
--- a/scene/gui/color_ramp_edit.cpp
+++ b/scene/gui/color_ramp_edit.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -61,7 +62,7 @@ void ColorRampEdit::_show_color_picker() {
return;
Size2 ms = Size2(350, picker->get_combined_minimum_size().height + 10);
picker->set_pick_color(points[grabbed].color);
- popup->set_pos(get_global_pos() - Vector2(ms.width - get_size().width, ms.height));
+ popup->set_position(get_global_position() - Vector2(ms.width - get_size().width, ms.height));
popup->set_size(ms);
popup->popup();
}
diff --git a/scene/gui/color_ramp_edit.h b/scene/gui/color_ramp_edit.h
index bb12064ddf..38176d2e77 100644
--- a/scene/gui/color_ramp_edit.h
+++ b/scene/gui/color_ramp_edit.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/color_rect.cpp b/scene/gui/color_rect.cpp
index 7febecc0b9..0641302b1c 100644
--- a/scene/gui/color_rect.cpp
+++ b/scene/gui/color_rect.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/color_rect.h b/scene/gui/color_rect.h
index c6d0164ac9..65da3d9a7c 100644
--- a/scene/gui/color_rect.h
+++ b/scene/gui/color_rect.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/container.cpp b/scene/gui/container.cpp
index 811b41863c..c428d524a4 100644
--- a/scene/gui/container.cpp
+++ b/scene/gui/container.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -106,7 +107,7 @@ void Container::fit_child_in_rect(Control *p_child, const Rect2 &p_rect) {
for (int i = 0; i < 4; i++)
p_child->set_anchor(Margin(i), ANCHOR_BEGIN);
- p_child->set_pos(r.pos);
+ p_child->set_position(r.pos);
p_child->set_size(r.size);
p_child->set_rotation(0);
p_child->set_scale(Vector2(1, 1));
diff --git a/scene/gui/container.h b/scene/gui/container.h
index 78f647f59d..bff24c6d55 100644
--- a/scene/gui/container.h
+++ b/scene/gui/container.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index a8e364a4cd..e62a993651 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -57,7 +58,7 @@ void Control::edit_set_state(const Variant &p_state) {
Dictionary s = p_state;
Rect2 state = s["rect"];
- set_pos(state.pos);
+ set_position(state.pos);
set_size(state.size);
set_rotation(s["rot"]);
set_scale(s["scale"]);
@@ -95,13 +96,13 @@ void Control::edit_set_rect(const Rect2 &p_edit_rect) {
postxf.set_rotation_and_scale(data.rotation, data.scale);
Vector2 new_pos = postxf.xform(p_edit_rect.pos);
- Vector2 pos = get_pos() + new_pos;
+ Vector2 pos = get_position() + new_pos;
Rect2 new_rect = get_rect();
new_rect.pos = pos.snapped(Vector2(1, 1));
new_rect.size = p_edit_rect.size.snapped(Vector2(1, 1));
- set_pos(new_rect.pos);
+ set_position(new_rect.pos);
set_size(new_rect.size);
}
@@ -352,7 +353,7 @@ void Control::remove_child_notify(Node *p_child) {
void Control::_update_canvas_item_transform() {
- Transform2D xform = Transform2D(data.rotation, get_pos());
+ Transform2D xform = Transform2D(data.rotation, get_position());
xform.scale_basis(data.scale);
VisualServer::get_singleton()->canvas_item_set_transform(get_canvas_item(), xform);
}
@@ -485,7 +486,7 @@ void Control::_notification(int p_notification) {
} break;
case NOTIFICATION_MOVED_IN_PARENT: {
// some parents need to know the order of the childrens to draw (like TabContainer)
- // update if necesary
+ // update if necessary
if (data.parent)
data.parent->update();
update();
@@ -1347,12 +1348,12 @@ Control::AnchorType Control::get_anchor(Margin p_margin) const {
void Control::_change_notify_margins() {
// this avoids sending the whole object data again on a change
- _change_notify("margin/left");
- _change_notify("margin/top");
- _change_notify("margin/right");
- _change_notify("margin/bottom");
- _change_notify("rect/pos");
- _change_notify("rect/size");
+ _change_notify("margin_left");
+ _change_notify("margin_top");
+ _change_notify("margin_right");
+ _change_notify("margin_bottom");
+ _change_notify("rect_pos");
+ _change_notify("rect_size");
}
void Control::set_margin(Margin p_margin, float p_value) {
@@ -1389,12 +1390,12 @@ Size2 Control::get_end() const {
return Size2(data.margin[2], data.margin[3]);
}
-Point2 Control::get_global_pos() const {
+Point2 Control::get_global_position() const {
return get_global_transform().get_origin();
}
-void Control::set_global_pos(const Point2 &p_point) {
+void Control::set_global_position(const Point2 &p_point) {
Transform2D inv;
@@ -1403,10 +1404,10 @@ void Control::set_global_pos(const Point2 &p_point) {
inv = data.parent_canvas_item->get_global_transform().affine_inverse();
}
- set_pos(inv.xform(p_point));
+ set_position(inv.xform(p_point));
}
-void Control::set_pos(const Size2 &p_point) {
+void Control::set_position(const Size2 &p_point) {
float pw = _get_parent_range(0);
float ph = _get_parent_range(1);
@@ -1458,7 +1459,7 @@ void Control::set_size(const Size2 &p_size) {
_size_changed();
}
-Size2 Control::get_pos() const {
+Size2 Control::get_position() const {
return data.pos_cache;
}
@@ -1470,7 +1471,7 @@ Size2 Control::get_size() const {
Rect2 Control::get_global_rect() const {
- return Rect2(get_global_pos(), get_size());
+ return Rect2(get_global_position(), get_size());
}
Rect2 Control::get_window_rect() const {
@@ -1482,7 +1483,7 @@ Rect2 Control::get_window_rect() const {
Rect2 Control::get_rect() const {
- return Rect2(get_pos(), get_size());
+ return Rect2(get_position(), get_size());
}
Rect2 Control::get_item_rect() const {
@@ -1885,7 +1886,7 @@ Control::CursorShape Control::get_cursor_shape(const Point2 &p_pos) const {
Transform2D Control::get_transform() const {
- Transform2D xform = Transform2D(data.rotation, get_pos());
+ Transform2D xform = Transform2D(data.rotation, get_position());
xform.scale_basis(data.scale);
return xform;
}
@@ -2158,7 +2159,7 @@ void Control::set_rotation(float p_radians) {
data.rotation = p_radians;
update();
_notify_transform();
- _change_notify("rect/rotation");
+ _change_notify("rect_rotation");
}
float Control::get_rotation() const {
@@ -2314,10 +2315,10 @@ void Control::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_anchor_and_margin", "margin", "anchor_mode", "offset"), &Control::set_anchor_and_margin);
ClassDB::bind_method(D_METHOD("set_begin", "pos"), &Control::set_begin);
ClassDB::bind_method(D_METHOD("set_end", "pos"), &Control::set_end);
- ClassDB::bind_method(D_METHOD("set_pos", "pos"), &Control::set_pos);
+ ClassDB::bind_method(D_METHOD("set_position", "pos"), &Control::set_position);
ClassDB::bind_method(D_METHOD("set_size", "size"), &Control::set_size);
ClassDB::bind_method(D_METHOD("set_custom_minimum_size", "size"), &Control::set_custom_minimum_size);
- ClassDB::bind_method(D_METHOD("set_global_pos", "pos"), &Control::set_global_pos);
+ ClassDB::bind_method(D_METHOD("set_global_position", "pos"), &Control::set_global_position);
ClassDB::bind_method(D_METHOD("set_rotation", "radians"), &Control::set_rotation);
ClassDB::bind_method(D_METHOD("set_rotation_deg", "degrees"), &Control::set_rotation_deg);
// TODO: Obsolete this method (old name) properly (GH-4397)
@@ -2326,7 +2327,7 @@ void Control::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_margin", "margin"), &Control::get_margin);
ClassDB::bind_method(D_METHOD("get_begin"), &Control::get_begin);
ClassDB::bind_method(D_METHOD("get_end"), &Control::get_end);
- ClassDB::bind_method(D_METHOD("get_pos"), &Control::get_pos);
+ ClassDB::bind_method(D_METHOD("get_position"), &Control::get_position);
ClassDB::bind_method(D_METHOD("get_size"), &Control::get_size);
ClassDB::bind_method(D_METHOD("get_rotation"), &Control::get_rotation);
ClassDB::bind_method(D_METHOD("get_rotation_deg"), &Control::get_rotation_deg);
@@ -2335,7 +2336,7 @@ void Control::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_scale"), &Control::get_scale);
ClassDB::bind_method(D_METHOD("get_custom_minimum_size"), &Control::get_custom_minimum_size);
ClassDB::bind_method(D_METHOD("get_parent_area_size"), &Control::get_size);
- ClassDB::bind_method(D_METHOD("get_global_pos"), &Control::get_global_pos);
+ ClassDB::bind_method(D_METHOD("get_global_position"), &Control::get_global_position);
ClassDB::bind_method(D_METHOD("get_rect"), &Control::get_rect);
ClassDB::bind_method(D_METHOD("get_global_rect"), &Control::get_global_rect);
ClassDB::bind_method(D_METHOD("set_area_as_parent_rect", "margin"), &Control::set_area_as_parent_rect, DEFVAL(0));
@@ -2437,7 +2438,7 @@ void Control::_bind_methods() {
ADD_PROPERTYINZ(PropertyInfo(Variant::INT, "margin_bottom", PROPERTY_HINT_RANGE, "-4096,4096"), "set_margin", "get_margin", MARGIN_BOTTOM);
ADD_GROUP("Rect", "rect_");
- ADD_PROPERTYNZ(PropertyInfo(Variant::VECTOR2, "rect_pos", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "set_pos", "get_pos");
+ ADD_PROPERTYNZ(PropertyInfo(Variant::VECTOR2, "rect_position", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "set_position", "get_position");
ADD_PROPERTYNZ(PropertyInfo(Variant::VECTOR2, "rect_size", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "set_size", "get_size");
ADD_PROPERTYNZ(PropertyInfo(Variant::VECTOR2, "rect_min_size"), "set_custom_minimum_size", "get_custom_minimum_size");
ADD_PROPERTYNZ(PropertyInfo(Variant::REAL, "rect_rotation", PROPERTY_HINT_RANGE, "-1080,1080,0.01"), "set_rotation_deg", "get_rotation_deg");
diff --git a/scene/gui/control.h b/scene/gui/control.h
index a18567123b..5834d1550a 100644
--- a/scene/gui/control.h
+++ b/scene/gui/control.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -276,12 +277,12 @@ public:
Point2 get_begin() const;
Point2 get_end() const;
- void set_pos(const Point2 &p_point);
+ void set_position(const Point2 &p_point);
void set_size(const Size2 &p_size);
- void set_global_pos(const Point2 &p_point);
+ void set_global_position(const Point2 &p_point);
- Point2 get_pos() const;
- Point2 get_global_pos() const;
+ Point2 get_position() const;
+ Point2 get_global_position() const;
Size2 get_size() const;
Rect2 get_rect() const;
Rect2 get_global_rect() const;
diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp
index a58e62f061..835775e13b 100644
--- a/scene/gui/dialogs.cpp
+++ b/scene/gui/dialogs.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -35,6 +36,8 @@
#include "editor/editor_node.h"
#endif
+// WindowDialog
+
void WindowDialog::_post_popup() {
drag_type = DRAG_NONE; // just in case
@@ -42,23 +45,23 @@ void WindowDialog::_post_popup() {
void WindowDialog::_fix_size() {
- // Perhaps this should be called when the viewport resizes aswell or windows go out of bounds...
+ // Perhaps this should be called when the viewport resizes as well or windows go out of bounds...
// Ensure the whole window is visible.
- Point2i pos = get_global_pos();
+ Point2i pos = get_global_position();
Size2i size = get_size();
Size2i viewport_size = get_viewport_rect().size;
// Windows require additional padding to keep the window chrome visible.
- Ref<StyleBox> panel = get_stylebox("panel", "WindowDialog");
- float top = panel->get_margin(MARGIN_TOP);
- float left = panel->get_margin(MARGIN_LEFT);
- float bottom = panel->get_margin(MARGIN_BOTTOM);
- float right = panel->get_margin(MARGIN_RIGHT);
+ Ref<StyleBoxTexture> panel = get_stylebox("panel", "WindowDialog");
+ float top = panel->get_expand_margin_size(MARGIN_TOP);
+ float left = panel->get_expand_margin_size(MARGIN_LEFT);
+ float bottom = panel->get_expand_margin_size(MARGIN_BOTTOM);
+ float right = panel->get_expand_margin_size(MARGIN_RIGHT);
pos.x = MAX(left, MIN(pos.x, viewport_size.x - size.x - right));
pos.y = MAX(top, MIN(pos.y, viewport_size.y - size.y - bottom));
- set_global_pos(pos);
+ set_global_position(pos);
// Also resize the window to fit if a resize should be possible at all.
if (resizable) {
@@ -73,9 +76,9 @@ bool WindowDialog::has_point(const Point2 &p_point) const {
Rect2 r(Point2(), get_size());
// Enlarge upwards for title bar.
- int titlebar_height = get_constant("titlebar_height", "WindowDialog");
- r.pos.y -= titlebar_height;
- r.size.y += titlebar_height;
+ int title_height = get_constant("title_height", "WindowDialog");
+ r.pos.y -= title_height;
+ r.size.y += title_height;
// Inflate by the resizable border thickness.
if (resizable) {
@@ -97,8 +100,8 @@ void WindowDialog::_gui_input(const InputEvent &p_event) {
// Begin a possible dragging operation.
drag_type = _drag_hit_test(Point2(p_event.mouse_button.x, p_event.mouse_button.y));
if (drag_type != DRAG_NONE)
- drag_offset = get_global_mouse_pos() - get_pos();
- drag_offset_far = get_pos() + get_size() - get_global_mouse_pos();
+ drag_offset = get_global_mouse_position() - get_position();
+ drag_offset_far = get_position() + get_size() - get_global_mouse_position();
} else if (drag_type != DRAG_NONE && !p_event.mouse_button.pressed) {
// End a dragging operation.
drag_type = DRAG_NONE;
@@ -135,7 +138,7 @@ void WindowDialog::_gui_input(const InputEvent &p_event) {
set_default_cursor_shape(cursor);
} else {
// Update while in a dragging operation.
- Point2 global_pos = get_global_mouse_pos();
+ Point2 global_pos = get_global_mouse_position();
global_pos.y = MAX(global_pos.y, 0); // Ensure title bar stays visible.
Rect2 rect = get_rect();
@@ -163,7 +166,7 @@ void WindowDialog::_gui_input(const InputEvent &p_event) {
}
set_size(rect.size);
- set_pos(rect.pos);
+ set_position(rect.pos);
}
}
}
@@ -172,19 +175,21 @@ void WindowDialog::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_DRAW: {
-
RID canvas = get_canvas_item();
- Size2 size = get_size();
+ // Draw the background.
Ref<StyleBox> panel = get_stylebox("panel", "WindowDialog");
- panel->draw(canvas, Rect2(Point2(), size));
+ Size2 size = get_size();
+ panel->draw(canvas, Rect2(0, 0, size.x, size.y));
- int title_height = get_constant("title_height", "WindowDialog");
+ // Draw the title bar text.
+ Ref<Font> title_font = get_font("title_font", "WindowDialog");
Color title_color = get_color("title_color", "WindowDialog");
- Ref<Font> font = get_font("title_font", "WindowDialog");
- int ofs = (size.width - font->get_string_size(title).width) / 2;
- draw_string(font, Point2(ofs, -title_height + font->get_ascent()), title, title_color, size.width - panel->get_minimum_size().width);
-
+ int title_height = get_constant("title_height", "WindowDialog");
+ int font_height = title_font->get_height() - title_font->get_descent() * 2;
+ int x = (size.x - title_font->get_string_size(title).x) / 2;
+ int y = (-title_height + font_height) / 2;
+ title_font->draw(canvas, Point2(x, y), title, title_color, size.x - panel->get_minimum_size().x);
} break;
case NOTIFICATION_THEME_CHANGED:
@@ -226,12 +231,12 @@ int WindowDialog::_drag_hit_test(const Point2 &pos) const {
int drag_type = DRAG_NONE;
if (resizable) {
- int titlebar_height = get_constant("titlebar_height", "WindowDialog");
+ int title_height = get_constant("title_height", "WindowDialog");
int scaleborder_size = get_constant("scaleborder_size", "WindowDialog");
Rect2 rect = get_rect();
- if (pos.y < (-titlebar_height + scaleborder_size))
+ if (pos.y < (-title_height + scaleborder_size))
drag_type = DRAG_RESIZE_TOP;
else if (pos.y >= (rect.size.height - scaleborder_size))
drag_type = DRAG_RESIZE_BOTTOM;
@@ -305,6 +310,8 @@ WindowDialog::WindowDialog() {
WindowDialog::~WindowDialog() {
}
+// PopupDialog
+
void PopupDialog::_notification(int p_what) {
if (p_what == NOTIFICATION_DRAW) {
@@ -404,14 +411,14 @@ void AcceptDialog::_update_child_rects() {
if (c == hbc || c == label || c == get_close_button() || c->is_set_as_toplevel())
continue;
- c->set_pos(cpos);
+ c->set_position(cpos);
c->set_size(csize);
}
cpos.y += csize.y + margin;
csize.y = hminsize.y;
- hbc->set_pos(cpos);
+ hbc->set_position(cpos);
hbc->set_size(csize);
}
@@ -542,6 +549,8 @@ AcceptDialog::AcceptDialog() {
AcceptDialog::~AcceptDialog() {
}
+// ConfirmationDialog
+
void ConfirmationDialog::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_cancel:Button"), &ConfirmationDialog::get_cancel);
diff --git a/scene/gui/dialogs.h b/scene/gui/dialogs.h
index a729a8f907..2365df3d79 100644
--- a/scene/gui/dialogs.h
+++ b/scene/gui/dialogs.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp
index d4643b399d..2f1af318e9 100644
--- a/scene/gui/file_dialog.cpp
+++ b/scene/gui/file_dialog.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/file_dialog.h b/scene/gui/file_dialog.h
index 397b0feba2..2afd0227c6 100644
--- a/scene/gui/file_dialog.h
+++ b/scene/gui/file_dialog.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp
index 6a3b5e713c..0c092a4e17 100644
--- a/scene/gui/graph_edit.cpp
+++ b/scene/gui/graph_edit.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -139,13 +140,13 @@ void GraphEdit::_update_scroll_offset() {
Point2 pos = gn->get_offset() * zoom;
pos -= Point2(h_scroll->get_value(), v_scroll->get_value());
- gn->set_pos(pos);
+ gn->set_position(pos);
if (gn->get_scale() != Vector2(zoom, zoom)) {
gn->set_scale(Vector2(zoom, zoom));
}
}
- connections_layer->set_pos(-Point2(h_scroll->get_value(), v_scroll->get_value()));
+ connections_layer->set_position(-Point2(h_scroll->get_value(), v_scroll->get_value()));
set_block_minimum_size_adjust(false);
awaiting_scroll_offset_update = false;
}
@@ -349,14 +350,14 @@ bool GraphEdit::_filter_input(const Point2 &p_point) {
for (int j = 0; j < gn->get_connection_output_count(); j++) {
- Vector2 pos = gn->get_connection_output_pos(j) + gn->get_pos();
+ Vector2 pos = gn->get_connection_output_pos(j) + gn->get_position();
if (pos.distance_to(p_point) < grab_r)
return true;
}
for (int j = 0; j < gn->get_connection_input_count(); j++) {
- Vector2 pos = gn->get_connection_input_pos(j) + gn->get_pos();
+ Vector2 pos = gn->get_connection_input_pos(j) + gn->get_position();
if (pos.distance_to(p_point) < grab_r) {
return true;
}
@@ -382,7 +383,7 @@ void GraphEdit::_top_layer_input(const InputEvent &p_ev) {
for (int j = 0; j < gn->get_connection_output_count(); j++) {
- Vector2 pos = gn->get_connection_output_pos(j) + gn->get_pos();
+ Vector2 pos = gn->get_connection_output_pos(j) + gn->get_position();
if (pos.distance_to(mpos) < grab_r) {
if (valid_left_disconnect_types.has(gn->get_connection_output_type(j))) {
@@ -429,7 +430,7 @@ void GraphEdit::_top_layer_input(const InputEvent &p_ev) {
for (int j = 0; j < gn->get_connection_input_count(); j++) {
- Vector2 pos = gn->get_connection_input_pos(j) + gn->get_pos();
+ Vector2 pos = gn->get_connection_input_pos(j) + gn->get_position();
if (pos.distance_to(mpos) < grab_r) {
@@ -496,7 +497,7 @@ void GraphEdit::_top_layer_input(const InputEvent &p_ev) {
if (!connecting_out) {
for (int j = 0; j < gn->get_connection_output_count(); j++) {
- Vector2 pos = gn->get_connection_output_pos(j) + gn->get_pos();
+ Vector2 pos = gn->get_connection_output_pos(j) + gn->get_position();
int type = gn->get_connection_output_type(j);
if ((type == connecting_type || valid_connection_types.has(ConnType(type, connecting_type))) && pos.distance_to(mpos) < grab_r) {
@@ -511,7 +512,7 @@ void GraphEdit::_top_layer_input(const InputEvent &p_ev) {
for (int j = 0; j < gn->get_connection_input_count(); j++) {
- Vector2 pos = gn->get_connection_input_pos(j) + gn->get_pos();
+ Vector2 pos = gn->get_connection_input_pos(j) + gn->get_position();
int type = gn->get_connection_input_type(j);
if ((type == connecting_type || valid_connection_types.has(ConnType(type, connecting_type))) && pos.distance_to(mpos) < grab_r) {
connecting_target = true;
@@ -703,7 +704,7 @@ void GraphEdit::_top_layer_draw() {
pos = from->get_connection_output_pos(connecting_index);
else
pos = from->get_connection_input_pos(connecting_index);
- pos += from->get_pos();
+ pos += from->get_position();
Vector2 topos;
topos = connecting_to;
@@ -1228,7 +1229,7 @@ GraphEdit::GraphEdit() {
HBoxContainer *zoom_hb = memnew(HBoxContainer);
top_layer->add_child(zoom_hb);
- zoom_hb->set_pos(Vector2(10, 10));
+ zoom_hb->set_position(Vector2(10, 10));
zoom_minus = memnew(ToolButton);
zoom_hb->add_child(zoom_minus);
diff --git a/scene/gui/graph_edit.h b/scene/gui/graph_edit.h
index 5166f82310..ff3867a059 100644
--- a/scene/gui/graph_edit.h
+++ b/scene/gui/graph_edit.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/graph_node.cpp b/scene/gui/graph_node.cpp
index afbb0bbad7..f7bb866f6f 100644
--- a/scene/gui/graph_node.cpp
+++ b/scene/gui/graph_node.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/graph_node.h b/scene/gui/graph_node.h
index bab78dedb9..e98d0b3d07 100644
--- a/scene/gui/graph_node.h
+++ b/scene/gui/graph_node.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/grid_container.cpp b/scene/gui/grid_container.cpp
index aae11255ed..06a58d69b2 100644
--- a/scene/gui/grid_container.cpp
+++ b/scene/gui/grid_container.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/grid_container.h b/scene/gui/grid_container.h
index 61dda4e223..aaa6a295ff 100644
--- a/scene/gui/grid_container.h
+++ b/scene/gui/grid_container.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/input_action.cpp b/scene/gui/input_action.cpp
index 9576bb07e4..5b03338286 100644
--- a/scene/gui/input_action.cpp
+++ b/scene/gui/input_action.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/input_action.h b/scene/gui/input_action.h
index a0f5cf2c11..c33490ae1d 100644
--- a/scene/gui/input_action.h
+++ b/scene/gui/input_action.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp
index 1db748a6b1..c2d5775b64 100644
--- a/scene/gui/item_list.cpp
+++ b/scene/gui/item_list.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/item_list.h b/scene/gui/item_list.h
index 5de58cfde8..4b896de77c 100644
--- a/scene/gui/item_list.h
+++ b/scene/gui/item_list.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp
index 0dec69d9b3..f3a279bada 100644
--- a/scene/gui/label.cpp
+++ b/scene/gui/label.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/label.h b/scene/gui/label.h
index 769e4b2256..dce68f4422 100644
--- a/scene/gui/label.h
+++ b/scene/gui/label.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index 20725194cf..9abf9649c0 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -50,7 +51,7 @@ void LineEdit::_gui_input(InputEvent p_event) {
const InputEventMouseButton &b = p_event.mouse_button;
if (b.pressed && b.button_index == BUTTON_RIGHT) {
- menu->set_pos(get_global_transform().xform(get_local_mouse_pos()));
+ menu->set_position(get_global_transform().xform(get_local_mouse_pos()));
menu->set_size(Vector2(1, 1));
menu->popup();
grab_focus();
diff --git a/scene/gui/line_edit.h b/scene/gui/line_edit.h
index 0746547115..a969095947 100644
--- a/scene/gui/line_edit.h
+++ b/scene/gui/line_edit.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/link_button.cpp b/scene/gui/link_button.cpp
index 17e549c902..9cb67b75e2 100644
--- a/scene/gui/link_button.cpp
+++ b/scene/gui/link_button.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/link_button.h b/scene/gui/link_button.h
index 97c2bfc3c8..98a3dc66f6 100644
--- a/scene/gui/link_button.h
+++ b/scene/gui/link_button.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/margin_container.cpp b/scene/gui/margin_container.cpp
index b7824e9037..2bc9db529b 100644
--- a/scene/gui/margin_container.cpp
+++ b/scene/gui/margin_container.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/margin_container.h b/scene/gui/margin_container.h
index 9f0829a34d..1cdb3a36cc 100644
--- a/scene/gui/margin_container.h
+++ b/scene/gui/margin_container.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/menu_button.cpp b/scene/gui/menu_button.cpp
index f2e2c9b255..cf468f2257 100644
--- a/scene/gui/menu_button.cpp
+++ b/scene/gui/menu_button.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -49,10 +50,10 @@ void MenuButton::pressed() {
emit_signal("about_to_show");
Size2 size = get_size();
- Point2 gp = get_global_pos();
- popup->set_global_pos(gp + Size2(0, size.height));
+ Point2 gp = get_global_position();
+ popup->set_global_position(gp + Size2(0, size.height));
popup->set_size(Size2(size.width, 0));
- popup->set_parent_rect(Rect2(Point2(gp - popup->get_global_pos()), get_size()));
+ popup->set_parent_rect(Rect2(Point2(gp - popup->get_global_position()), get_size()));
popup->popup();
popup->call_deferred("grab_click_focus");
popup->set_invalidate_click_until_motion();
diff --git a/scene/gui/menu_button.h b/scene/gui/menu_button.h
index 4acb62cf37..e07627c07c 100644
--- a/scene/gui/menu_button.h
+++ b/scene/gui/menu_button.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/option_button.cpp b/scene/gui/option_button.cpp
index 43f68d92ab..0806d35d48 100644
--- a/scene/gui/option_button.cpp
+++ b/scene/gui/option_button.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -86,7 +87,7 @@ void OptionButton::_selected(int p_which) {
void OptionButton::pressed() {
Size2 size = get_size();
- popup->set_global_pos(get_global_pos() + Size2(0, size.height));
+ popup->set_global_position(get_global_position() + Size2(0, size.height));
popup->set_size(Size2(size.width, 0));
popup->popup();
diff --git a/scene/gui/option_button.h b/scene/gui/option_button.h
index 55a98cb50c..887d199c90 100644
--- a/scene/gui/option_button.h
+++ b/scene/gui/option_button.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/panel.cpp b/scene/gui/panel.cpp
index 536f0baf73..f3c6142f9e 100644
--- a/scene/gui/panel.cpp
+++ b/scene/gui/panel.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/panel.h b/scene/gui/panel.h
index 3d2c0a3e98..eac8f2d4e8 100644
--- a/scene/gui/panel.h
+++ b/scene/gui/panel.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/panel_container.cpp b/scene/gui/panel_container.cpp
index 9dc7a6b32e..86874f7cfd 100644
--- a/scene/gui/panel_container.cpp
+++ b/scene/gui/panel_container.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/panel_container.h b/scene/gui/panel_container.h
index 13ed1c935c..f8f1fb6494 100644
--- a/scene/gui/panel_container.h
+++ b/scene/gui/panel_container.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/patch_9_rect.cpp b/scene/gui/patch_9_rect.cpp
index d0bd45e435..0c2b94d700 100644
--- a/scene/gui/patch_9_rect.cpp
+++ b/scene/gui/patch_9_rect.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -37,27 +38,13 @@ void NinePatchRect::_notification(int p_what) {
if (texture.is_null())
return;
- Size2 s = get_size();
+ Rect2 rect = Rect2(Point2(), get_size());
+ Rect2 src_rect = region_rect;
+
+ texture->get_rect_region(rect, src_rect, rect, src_rect);
+
RID ci = get_canvas_item();
- VS::get_singleton()->canvas_item_add_nine_patch(ci, Rect2(Point2(), s), region_rect, texture->get_rid(), Vector2(margin[MARGIN_LEFT], margin[MARGIN_TOP]), Vector2(margin[MARGIN_RIGHT], margin[MARGIN_BOTTOM]), VS::NINE_PATCH_STRETCH, VS::NINE_PATCH_STRETCH, draw_center);
- //draw_texture_rect(texture,Rect2(Point2(),s),false,modulate);
-
- /*
- Vector<Point2> points;
- points.resize(4);
- points[0]=Point2(0,0);
- points[1]=Point2(s.x,0);
- points[2]=Point2(s.x,s.y);
- points[3]=Point2(0,s.y);
- Vector<Point2> uvs;
- uvs.resize(4);
- uvs[0]=Point2(0,0);
- uvs[1]=Point2(1,0);
- uvs[2]=Point2(1,1);
- uvs[3]=Point2(0,1);
-
- VisualServer::get_singleton()->canvas_item_add_primitive(ci,points,Vector<Color>(),uvs,texture->get_rid());
-*/
+ VS::get_singleton()->canvas_item_add_nine_patch(ci, rect, src_rect, texture->get_rid(), Vector2(margin[MARGIN_LEFT], margin[MARGIN_TOP]), Vector2(margin[MARGIN_RIGHT], margin[MARGIN_BOTTOM]), VS::NINE_PATCH_STRETCH, VS::NINE_PATCH_STRETCH, draw_center);
}
}
@@ -116,16 +103,16 @@ void NinePatchRect::set_patch_margin(Margin p_margin, int p_size) {
minimum_size_changed();
switch (p_margin) {
case MARGIN_LEFT:
- _change_notify("patch_margin/left");
+ _change_notify("patch_margin_left");
break;
case MARGIN_TOP:
- _change_notify("patch_margin/top");
+ _change_notify("patch_margin_top");
break;
case MARGIN_RIGHT:
- _change_notify("patch_margin/right");
+ _change_notify("patch_margin_right");
break;
case MARGIN_BOTTOM:
- _change_notify("patch_margin/bottom");
+ _change_notify("patch_margin_bottom");
break;
}
}
diff --git a/scene/gui/patch_9_rect.h b/scene/gui/patch_9_rect.h
index 09663e62f6..ba978f2f81 100644
--- a/scene/gui/patch_9_rect.h
+++ b/scene/gui/patch_9_rect.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/popup.cpp b/scene/gui/popup.cpp
index 52ad37e9ab..7d0b91a366 100644
--- a/scene/gui/popup.cpp
+++ b/scene/gui/popup.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -57,12 +58,12 @@ void Popup::_notification(int p_what) {
void Popup::_fix_size() {
#if 0
- Point2 pos = get_pos();
+ Point2 pos = get_position();
Size2 size = get_size();
Point2 window_size = window==this ? get_parent_area_size() :window->get_size();
#else
- Point2 pos = get_global_pos();
+ Point2 pos = get_global_position();
Size2 size = get_size();
Point2 window_size = get_viewport_rect().size;
@@ -78,10 +79,10 @@ void Popup::_fix_size() {
pos.y = 0;
#if 0
if (pos!=get_pos())
- set_pos(pos);
+ set_position(pos);
#else
- if (pos != get_pos())
- set_global_pos(pos);
+ if (pos != get_position())
+ set_global_position(pos);
#endif
}
@@ -170,7 +171,7 @@ void Popup::popup_centered(const Size2 &p_size) {
rect.size = p_size == Size2() ? get_size() : p_size;
rect.pos = ((window_size - rect.size) / 2.0).floor();
- set_pos(rect.pos);
+ set_position(rect.pos);
set_size(rect.size);
show_modal(exclusive);
@@ -193,7 +194,7 @@ void Popup::popup_centered_ratio(float p_screen_ratio) {
Point2 window_size = get_viewport_rect().size;
rect.size = (window_size * p_screen_ratio).floor();
rect.pos = ((window_size - rect.size) / 2.0).floor();
- set_pos(rect.pos);
+ set_position(rect.pos);
set_size(rect.size);
show_modal(exclusive);
@@ -215,7 +216,7 @@ void Popup::popup(const Rect2 &bounds) {
// Fit the popup into the optionally provided bounds.
if (!bounds.has_no_area()) {
- set_pos(bounds.pos);
+ set_position(bounds.pos);
set_size(bounds.size);
}
_fix_size();
diff --git a/scene/gui/popup.h b/scene/gui/popup.h
index d80daaad10..950aa65fa4 100644
--- a/scene/gui/popup.h
+++ b/scene/gui/popup.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp
index a2a670fa1f..6ac6eac655 100644
--- a/scene/gui/popup_menu.cpp
+++ b/scene/gui/popup_menu.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -168,7 +169,7 @@ void PopupMenu::_activate_submenu(int over) {
if (pm->is_visible_in_tree())
return; //already visible!
- Point2 p = get_global_pos();
+ Point2 p = get_global_position();
Rect2 pr(p, get_size());
Ref<StyleBox> style = get_stylebox("panel");
@@ -178,13 +179,13 @@ void PopupMenu::_activate_submenu(int over) {
if (pos.x + size.width > get_viewport_rect().size.width)
pos.x = p.x - size.width;
- pm->set_pos(pos);
+ pm->set_position(pos);
pm->popup();
PopupMenu *pum = pm->cast_to<PopupMenu>();
if (pum) {
- pr.pos -= pum->get_global_pos();
+ pr.pos -= pum->get_global_position();
pum->clear_autohide_areas();
pum->add_autohide_area(Rect2(pr.pos.x, pr.pos.y, pr.size.x, items[over]._ofs_cache));
if (over < items.size() - 1) {
@@ -265,15 +266,15 @@ void PopupMenu::_gui_input(const InputEvent &p_event) {
case BUTTON_WHEEL_DOWN: {
- if (get_global_pos().y + get_size().y > get_viewport_rect().size.y) {
+ if (get_global_position().y + get_size().y > get_viewport_rect().size.y) {
int vseparation = get_constant("vseparation");
Ref<Font> font = get_font("font");
- Point2 pos = get_pos();
+ Point2 pos = get_position();
int s = (vseparation + font->get_height()) * 3;
pos.y -= s;
- set_pos(pos);
+ set_position(pos);
//update hover
InputEvent ie;
@@ -285,15 +286,15 @@ void PopupMenu::_gui_input(const InputEvent &p_event) {
} break;
case BUTTON_WHEEL_UP: {
- if (get_global_pos().y < 0) {
+ if (get_global_position().y < 0) {
int vseparation = get_constant("vseparation");
Ref<Font> font = get_font("font");
- Point2 pos = get_pos();
+ Point2 pos = get_position();
int s = (vseparation + font->get_height()) * 3;
pos.y += s;
- set_pos(pos);
+ set_position(pos);
//update hover
InputEvent ie;
diff --git a/scene/gui/popup_menu.h b/scene/gui/popup_menu.h
index 186d40f6d3..de809f29d3 100644
--- a/scene/gui/popup_menu.h
+++ b/scene/gui/popup_menu.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/progress_bar.cpp b/scene/gui/progress_bar.cpp
index 86dea6cd96..13d368d253 100644
--- a/scene/gui/progress_bar.cpp
+++ b/scene/gui/progress_bar.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/progress_bar.h b/scene/gui/progress_bar.h
index b5820d1682..1121a78aab 100644
--- a/scene/gui/progress_bar.h
+++ b/scene/gui/progress_bar.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/range.cpp b/scene/gui/range.cpp
index f15f3a6078..7158592bb1 100644
--- a/scene/gui/range.cpp
+++ b/scene/gui/range.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -33,7 +34,7 @@ void Range::_value_changed_notify() {
_value_changed(shared->val);
emit_signal("value_changed", shared->val);
update();
- _change_notify("range/value");
+ _change_notify("value");
}
void Range::Shared::emit_value_changed() {
@@ -87,26 +88,26 @@ void Range::set_min(double p_min) {
shared->min = p_min;
set_value(shared->val);
- shared->emit_changed("range/min");
+ shared->emit_changed("min");
}
void Range::set_max(double p_max) {
shared->max = p_max;
set_value(shared->val);
- shared->emit_changed("range/max");
+ shared->emit_changed("max");
}
void Range::set_step(double p_step) {
shared->step = p_step;
- shared->emit_changed("range/step");
+ shared->emit_changed("step");
}
void Range::set_page(double p_page) {
shared->page = p_page;
set_value(shared->val);
- shared->emit_changed("range/page");
+ shared->emit_changed("page");
}
double Range::get_value() const {
diff --git a/scene/gui/range.h b/scene/gui/range.h
index 105bd08a4f..fdcbbb09ee 100644
--- a/scene/gui/range.h
+++ b/scene/gui/range.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/reference_rect.cpp b/scene/gui/reference_rect.cpp
index cc38b896d9..400ff299a9 100644
--- a/scene/gui/reference_rect.cpp
+++ b/scene/gui/reference_rect.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/reference_rect.h b/scene/gui/reference_rect.h
index b64f479829..b118425eb6 100644
--- a/scene/gui/reference_rect.h
+++ b/scene/gui/reference_rect.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp
index 322d9dee20..e5a17298e4 100644
--- a/scene/gui/rich_text_label.cpp
+++ b/scene/gui/rich_text_label.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -125,7 +126,7 @@ void RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int
if (cfont.is_null())
cfont = p_base_font;
- //line height should be the font height for the first time, this ensures that an empty line will never have zero height and succesive newlines are displayed
+ //line height should be the font height for the first time, this ensures that an empty line will never have zero height and successive newlines are displayed
int line_height = cfont->get_height();
Variant meta;
diff --git a/scene/gui/rich_text_label.h b/scene/gui/rich_text_label.h
index a5f23d0ba9..05d98b3ee8 100644
--- a/scene/gui/rich_text_label.h
+++ b/scene/gui/rich_text_label.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/scroll_bar.cpp b/scene/gui/scroll_bar.cpp
index 37f7b46e22..6475371eb9 100644
--- a/scene/gui/scroll_bar.cpp
+++ b/scene/gui/scroll_bar.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -705,7 +706,7 @@ void ScrollBar::mouse_motion(const Point2& p_pos, const Point2& p_rel, int b.but
if (value_ofs>(get_max()-get_page()))
value_ofs=get_max()-get_page();
if (get_val()==value_ofs)
- return; //dont bother if the value is the same
+ return; //don't bother if the value is the same
set_val( value_ofs );
diff --git a/scene/gui/scroll_bar.h b/scene/gui/scroll_bar.h
index 5227fa45ac..9f035b4901 100644
--- a/scene/gui/scroll_bar.h
+++ b/scene/gui/scroll_bar.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/scroll_container.cpp b/scene/gui/scroll_container.cpp
index c543b783b9..9146fa9393 100644
--- a/scene/gui/scroll_container.cpp
+++ b/scene/gui/scroll_container.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/scroll_container.h b/scene/gui/scroll_container.h
index 07b127843a..bbc6d829ef 100644
--- a/scene/gui/scroll_container.h
+++ b/scene/gui/scroll_container.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/separator.cpp b/scene/gui/separator.cpp
index e256b8f928..3b00ab4605 100644
--- a/scene/gui/separator.cpp
+++ b/scene/gui/separator.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/separator.h b/scene/gui/separator.h
index 7913531748..9a5fe2ac66 100644
--- a/scene/gui/separator.h
+++ b/scene/gui/separator.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/slider.cpp b/scene/gui/slider.cpp
index 365d450ed6..d2a2ff7966 100644
--- a/scene/gui/slider.cpp
+++ b/scene/gui/slider.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/slider.h b/scene/gui/slider.h
index f649a4d150..61ad76e31e 100644
--- a/scene/gui/slider.h
+++ b/scene/gui/slider.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/spin_box.cpp b/scene/gui/spin_box.cpp
index 3f21093fb7..049adc6fb4 100644
--- a/scene/gui/spin_box.cpp
+++ b/scene/gui/spin_box.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/spin_box.h b/scene/gui/spin_box.h
index eba58402fa..338ae875f0 100644
--- a/scene/gui/spin_box.h
+++ b/scene/gui/spin_box.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/split_container.cpp b/scene/gui/split_container.cpp
index 5b6f17e0f7..df24fa84d8 100644
--- a/scene/gui/split_container.cpp
+++ b/scene/gui/split_container.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -185,7 +186,7 @@ void SplitContainer::_resort() {
}
update();
- _change_notify("split/offset");
+ _change_notify("split_offset");
}
Size2 SplitContainer::get_minimum_size() const {
diff --git a/scene/gui/split_container.h b/scene/gui/split_container.h
index 8db6bfa658..12722c9f95 100644
--- a/scene/gui/split_container.h
+++ b/scene/gui/split_container.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp
index 89769937d4..0c7a58dc16 100644
--- a/scene/gui/tab_container.cpp
+++ b/scene/gui/tab_container.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -78,11 +79,11 @@ void TabContainer::_gui_input(const InputEvent &p_event) {
if (popup && pos.x > size.width - menu->get_width()) {
emit_signal("pre_popup_pressed");
- Vector2 popup_pos = get_global_pos();
+ Vector2 popup_pos = get_global_position();
popup_pos.x += size.width - popup->get_size().width;
popup_pos.y += menu->get_height();
- popup->set_global_pos(popup_pos);
+ popup->set_global_position(popup_pos);
popup->popup();
return;
}
diff --git a/scene/gui/tab_container.h b/scene/gui/tab_container.h
index 2594611844..87a99c82b8 100644
--- a/scene/gui/tab_container.h
+++ b/scene/gui/tab_container.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/tabs.cpp b/scene/gui/tabs.cpp
index 3197553876..fb27f3b017 100644
--- a/scene/gui/tabs.cpp
+++ b/scene/gui/tabs.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/tabs.h b/scene/gui/tabs.h
index 39811f13c2..2392327206 100644
--- a/scene/gui/tabs.h
+++ b/scene/gui/tabs.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 3b7ad910d6..3c8545bd75 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -100,15 +101,15 @@ void TextEdit::Text::set_font(const Ref<Font> &p_font) {
font = p_font;
}
-void TextEdit::Text::set_tab_size(int p_tab_size) {
+void TextEdit::Text::set_indent_size(int p_indent_size) {
- tab_size = p_tab_size;
+ indent_size = p_indent_size;
}
void TextEdit::Text::_update_line_cache(int p_line) const {
int w = 0;
- int tab_w = font->get_char_size(' ').width * tab_size;
+ int tab_w = font->get_char_size(' ').width * indent_size;
int len = text[p_line].data.length();
const CharType *str = text[p_line].data.c_str();
@@ -359,7 +360,7 @@ void TextEdit::_click_selection_held() {
if (Input::get_singleton()->is_mouse_button_pressed(BUTTON_LEFT) && selection.selecting_mode != Selection::MODE_NONE) {
- Point2 mp = Input::get_singleton()->get_mouse_pos() - get_global_pos();
+ Point2 mp = Input::get_singleton()->get_mouse_position() - get_global_position();
int row, col;
_get_mouse_pos(Point2i(mp.x, mp.y), row, col);
@@ -455,7 +456,7 @@ void TextEdit::_notification(int p_what) {
int visible_rows = get_visible_rows();
- int tab_w = cache.font->get_char_size(' ').width * tab_size;
+ int tab_w = cache.font->get_char_size(' ').width * indent_size;
Color color = cache.font_color;
int in_region = -1;
@@ -812,8 +813,8 @@ void TextEdit::_notification(int p_what) {
keyword_color = *col;
}
- if (select_identifiers_enabled && hilighted_word != String()) {
- if (hilighted_word == range) {
+ if (select_identifiers_enabled && highlighted_word != String()) {
+ if (highlighted_word == range) {
underlined = true;
}
}
@@ -1304,7 +1305,38 @@ void TextEdit::backspace_at_cursor() {
_is_pair_left_symbol(text[cursor.line][cursor.column - 1])) {
_consume_backspace_for_pair_symbol(prev_line, prev_column);
} else {
- _remove_text(prev_line, prev_column, cursor.line, cursor.column);
+ // handle space indentation
+ if (cursor.column - indent_size >= 0 && indent_using_spaces) {
+
+ // if there is enough spaces to count as a tab
+ bool unindent = true;
+ for (int i = 1; i <= indent_size; i++) {
+ if (text[cursor.line][cursor.column - i] != ' ') {
+ unindent = false;
+ break;
+ }
+ }
+
+ // and it is before the first character
+ int i = 0;
+ while (i < cursor.column && i < text[cursor.line].length()) {
+ if (text[cursor.line][i] != ' ' && text[cursor.line][i] != '\t') {
+ unindent = false;
+ break;
+ }
+ i++;
+ }
+
+ // then we can remove it as a single character.
+ if (unindent) {
+ _remove_text(cursor.line, cursor.column - indent_size, cursor.line, cursor.column);
+ prev_column = cursor.column - indent_size;
+ } else {
+ _remove_text(prev_line, prev_column, cursor.line, cursor.column);
+ }
+ } else {
+ _remove_text(prev_line, prev_column, cursor.line, cursor.column);
+ }
}
cursor_set_line(prev_line);
@@ -1327,7 +1359,11 @@ void TextEdit::indent_selection_right() {
for (int i = start_line; i <= end_line; i++) {
String line_text = get_line(i);
- line_text = '\t' + line_text;
+ if (indent_using_spaces) {
+ line_text = space_indent + line_text;
+ } else {
+ line_text = '\t' + line_text;
+ }
set_line(i, line_text);
}
@@ -1358,8 +1394,8 @@ void TextEdit::indent_selection_left() {
if (line_text.begins_with("\t")) {
line_text = line_text.substr(1, line_text.length());
set_line(i, line_text);
- } else if (line_text.begins_with(" ")) {
- line_text = line_text.substr(4, line_text.length());
+ } else if (line_text.begins_with(space_indent)) {
+ line_text = line_text.substr(indent_size, line_text.length());
set_line(i, line_text);
}
}
@@ -1463,9 +1499,9 @@ void TextEdit::_gui_input(const InputEvent &p_gui_input) {
int row, col;
_get_mouse_pos(Point2i(mb.x, mb.y), row, col);
- if (mb.mod.command && hilighted_word != String()) {
+ if (mb.mod.command && highlighted_word != String()) {
- emit_signal("symbol_lookup", hilighted_word, row, col);
+ emit_signal("symbol_lookup", highlighted_word, row, col);
return;
}
@@ -1585,7 +1621,7 @@ void TextEdit::_gui_input(const InputEvent &p_gui_input) {
if (mb.button_index == BUTTON_RIGHT && context_menu_enabled) {
- menu->set_pos(get_global_transform().xform(get_local_mouse_pos()));
+ menu->set_position(get_global_transform().xform(get_local_mouse_pos()));
menu->set_size(Vector2(1, 1));
menu->popup();
grab_focus();
@@ -1608,13 +1644,13 @@ void TextEdit::_gui_input(const InputEvent &p_gui_input) {
if (mm.mod.command && mm.button_mask == 0) {
String new_word = get_word_at_pos(Vector2(mm.x, mm.y));
- if (new_word != hilighted_word) {
- hilighted_word = new_word;
+ if (new_word != highlighted_word) {
+ highlighted_word = new_word;
update();
}
} else {
- if (hilighted_word != String()) {
- hilighted_word = String();
+ if (highlighted_word != String()) {
+ highlighted_word = String();
update();
}
}
@@ -1655,11 +1691,11 @@ void TextEdit::_gui_input(const InputEvent &p_gui_input) {
if (k.pressed) {
- hilighted_word = get_word_at_pos(get_local_mouse_pos());
+ highlighted_word = get_word_at_pos(get_local_mouse_pos());
update();
} else {
- hilighted_word = String();
+ highlighted_word = String();
update();
}
}
@@ -1930,17 +1966,39 @@ void TextEdit::_gui_input(const InputEvent &p_gui_input) {
String ins = "\n";
//keep indentation
+ int space_count = 0;
for (int i = 0; i < text[cursor.line].length(); i++) {
- if (text[cursor.line][i] == '\t')
- ins += "\t";
- else
+ if (text[cursor.line][i] == '\t') {
+ if (indent_using_spaces) {
+ ins += space_indent;
+ } else {
+ ins += "\t";
+ }
+ space_count = 0;
+ } else if (text[cursor.line][i] == ' ') {
+ space_count++;
+
+ if (space_count == indent_size) {
+ if (indent_using_spaces) {
+ ins += space_indent;
+ } else {
+ ins += "\t";
+ }
+ space_count = 0;
+ }
+ } else {
break;
+ }
}
if (auto_indent) {
// indent once again if previous line will end with ':'
// (i.e. colon precedes current cursor position)
if (cursor.column > 0 && text[cursor.line][cursor.column - 1] == ':') {
- ins += "\t";
+ if (indent_using_spaces) {
+ ins += space_indent;
+ } else {
+ ins += "\t";
+ }
}
}
@@ -1986,15 +2044,36 @@ void TextEdit::_gui_input(const InputEvent &p_gui_input) {
} else {
if (k.mod.shift) {
+ //simple unindent
int cc = cursor.column;
- if (cc > 0 && cc <= text[cursor.line].length() && text[cursor.line][cursor.column - 1] == '\t') {
- //simple unindent
+ if (cc > 0 && cc <= text[cursor.line].length()) {
+ if (text[cursor.line][cursor.column - 1] == '\t') {
+ backspace_at_cursor();
+ } else {
+ if (cursor.column - indent_size >= 0) {
+
+ bool unindent = true;
+ for (int i = 1; i <= indent_size; i++) {
+ if (text[cursor.line][cursor.column - i] != ' ') {
+ unindent = false;
+ break;
+ }
+ }
- backspace_at_cursor();
+ if (unindent) {
+ _remove_text(cursor.line, cursor.column - indent_size, cursor.line, cursor.column);
+ cursor_set_column(cursor.column - indent_size);
+ }
+ }
+ }
}
} else {
//simple indent
- _insert_text_at_cursor("\t");
+ if (indent_using_spaces) {
+ _insert_text_at_cursor(space_indent);
+ } else {
+ _insert_text_at_cursor("\t");
+ }
}
}
@@ -3102,7 +3181,7 @@ int TextEdit::get_char_pos_for(int p_px, String p_str) const {
int px = 0;
int c = 0;
- int tab_w = cache.font->get_char_size(' ').width * tab_size;
+ int tab_w = cache.font->get_char_size(' ').width * indent_size;
while (c < p_str.length()) {
@@ -3134,7 +3213,7 @@ int TextEdit::get_column_x_offset(int p_char, String p_str) {
int px = 0;
- int tab_w = cache.font->get_char_size(' ').width * tab_size;
+ int tab_w = cache.font->get_char_size(' ').width * indent_size;
for (int i = 0; i < p_char; i++) {
@@ -3174,7 +3253,7 @@ void TextEdit::insert_text_at_cursor(const String &p_text) {
}
Control::CursorShape TextEdit::get_cursor_shape(const Point2 &p_pos) const {
- if (hilighted_word != String())
+ if (highlighted_word != String())
return CURSOR_POINTING_HAND;
int gutter = cache.style_normal->get_margin(MARGIN_LEFT) + cache.line_number_w + cache.breakpoint_gutter_width;
@@ -3951,10 +4030,24 @@ void TextEdit::_push_current_op() {
current_op.chain_forward = false;
}
-void TextEdit::set_tab_size(const int p_size) {
+void TextEdit::set_indent_using_spaces(const bool p_use_spaces) {
+ indent_using_spaces = p_use_spaces;
+}
+
+bool TextEdit::is_indent_using_spaces() const {
+ return indent_using_spaces;
+}
+
+void TextEdit::set_indent_size(const int p_size) {
ERR_FAIL_COND(p_size <= 0);
- tab_size = p_size;
- text.set_tab_size(p_size);
+ indent_size = p_size;
+ text.set_indent_size(p_size);
+
+ space_indent = "";
+ for (int i = 0; i < p_size; i++) {
+ space_indent += " ";
+ }
+
update();
}
@@ -4447,8 +4540,8 @@ void TextEdit::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_text"), &TextEdit::get_text);
ClassDB::bind_method(D_METHOD("get_line", "line"), &TextEdit::get_line);
- ClassDB::bind_method(D_METHOD("cursor_set_column", "column", "adjust_viewport"), &TextEdit::cursor_set_column, DEFVAL(false));
- ClassDB::bind_method(D_METHOD("cursor_set_line", "line", "adjust_viewport"), &TextEdit::cursor_set_line, DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("cursor_set_column", "column", "adjust_viewport"), &TextEdit::cursor_set_column, DEFVAL(true));
+ ClassDB::bind_method(D_METHOD("cursor_set_line", "line", "adjust_viewport"), &TextEdit::cursor_set_line, DEFVAL(true));
ClassDB::bind_method(D_METHOD("cursor_get_column"), &TextEdit::cursor_get_column);
ClassDB::bind_method(D_METHOD("cursor_get_line"), &TextEdit::cursor_get_line);
@@ -4541,8 +4634,8 @@ TextEdit::TextEdit() {
cache.breakpoint_gutter_width = 0;
breakpoint_gutter_width = 0;
- tab_size = 4;
- text.set_tab_size(tab_size);
+ indent_size = 4;
+ text.set_indent_size(indent_size);
text.clear();
//text.insert(1,"Mongolia..");
//text.insert(2,"PAIS GENEROSO!!");
@@ -4630,6 +4723,8 @@ TextEdit::TextEdit() {
auto_brace_completion_enabled = false;
brace_matching_enabled = false;
highlight_all_occurrences = false;
+ indent_using_spaces = false;
+ space_indent = " ";
auto_indent = false;
insert_mode = false;
window_has_focus = true;
diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h
index e38d484b0d..905ea46bd7 100644
--- a/scene/gui/text_edit.h
+++ b/scene/gui/text_edit.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -140,12 +141,12 @@ class TextEdit : public Control {
const Vector<ColorRegion> *color_regions;
mutable Vector<Line> text;
Ref<Font> font;
- int tab_size;
+ int indent_size;
void _update_line_cache(int p_line) const;
public:
- void set_tab_size(int p_tab_size);
+ void set_indent_size(int p_indent_size);
void set_font(const Ref<Font> &p_font);
void set_color_regions(const Vector<ColorRegion> *p_regions) { color_regions = p_regions; }
int get_line_width(int p_line) const;
@@ -162,7 +163,7 @@ class TextEdit : public Control {
void clear();
void clear_caches();
_FORCE_INLINE_ const String &operator[](int p_line) const { return text[p_line].data; }
- Text() { tab_size = 4; }
+ Text() { indent_size = 4; }
};
struct TextOperation {
@@ -220,7 +221,9 @@ class TextEdit : public Control {
int max_chars;
bool readonly;
bool syntax_coloring;
- int tab_size;
+ bool indent_using_spaces;
+ int indent_size;
+ String space_indent;
Timer *caret_blink_timer;
bool caret_blink_enabled;
@@ -252,7 +255,7 @@ class TextEdit : public Control {
bool raised_from_completion;
- String hilighted_word;
+ String highlighted_word;
uint64_t last_dblclk;
@@ -460,7 +463,9 @@ public:
void redo();
void clear_undo_history();
- void set_tab_size(const int p_size);
+ void set_indent_using_spaces(const bool p_use_spaces);
+ bool is_indent_using_spaces() const;
+ void set_indent_size(const int p_size);
void set_draw_tabs(bool p_draw);
bool is_drawing_tabs() const;
diff --git a/scene/gui/texture_button.cpp b/scene/gui/texture_button.cpp
index 54f09cbf68..33d9b76b70 100644
--- a/scene/gui/texture_button.cpp
+++ b/scene/gui/texture_button.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/texture_button.h b/scene/gui/texture_button.h
index fc5079dbf9..9c31912a32 100644
--- a/scene/gui/texture_button.h
+++ b/scene/gui/texture_button.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/texture_progress.cpp b/scene/gui/texture_progress.cpp
index 914d17d2dc..081c7ddb73 100644
--- a/scene/gui/texture_progress.cpp
+++ b/scene/gui/texture_progress.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/texture_progress.h b/scene/gui/texture_progress.h
index 0d9b5e6b1a..c0c2779cf9 100644
--- a/scene/gui/texture_progress.h
+++ b/scene/gui/texture_progress.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/texture_rect.cpp b/scene/gui/texture_rect.cpp
index ea35ee8b52..92a3db6a74 100644
--- a/scene/gui/texture_rect.cpp
+++ b/scene/gui/texture_rect.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/texture_rect.h b/scene/gui/texture_rect.h
index 2cc6b97b13..dcc6c3f9bd 100644
--- a/scene/gui/texture_rect.h
+++ b/scene/gui/texture_rect.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/tool_button.cpp b/scene/gui/tool_button.cpp
index 817b506f10..5fc4b6ecf8 100644
--- a/scene/gui/tool_button.cpp
+++ b/scene/gui/tool_button.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/tool_button.h b/scene/gui/tool_button.h
index 02d2bfaef1..d243b5559f 100644
--- a/scene/gui/tool_button.h
+++ b/scene/gui/tool_button.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index d63ef41239..bc7b7485d8 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -1040,7 +1041,7 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2
cache.selected->draw(ci, r);
}
if (text_editor->is_visible_in_tree()) {
- text_editor->set_pos(get_global_pos() + r.pos);
+ text_editor->set_position(get_global_position() + r.pos);
}
}
@@ -1502,7 +1503,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool
cache.click_id = c.buttons[j].id;
cache.click_item = p_item;
cache.click_column = col;
- cache.click_pos = get_global_mouse_pos() - get_global_pos();
+ cache.click_pos = get_global_mouse_position() - get_global_position();
update();
//emit_signal("button_pressed");
return -1;
@@ -1626,7 +1627,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool
}
popup_menu->set_size(Size2(col_width, 0));
- popup_menu->set_pos(get_global_pos() + Point2i(col_ofs, _get_title_button_height() + y_ofs + item_h) - cache.offset);
+ popup_menu->set_position(get_global_position() + Point2i(col_ofs, _get_title_button_height() + y_ofs + item_h) - cache.offset);
popup_menu->popup();
popup_edited_item = p_item;
popup_edited_item_col = col;
@@ -1692,7 +1693,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool
case TreeItem::CELL_MODE_CUSTOM: {
edited_item = p_item;
edited_col = col;
- custom_popup_rect = Rect2i(get_global_pos() + Point2i(col_ofs, _get_title_button_height() + y_ofs + item_h - cache.offset.y), Size2(get_column_width(col), item_h));
+ custom_popup_rect = Rect2i(get_global_position() + Point2i(col_ofs, _get_title_button_height() + y_ofs + item_h - cache.offset.y), Size2(get_column_width(col), item_h));
emit_signal("custom_popup_edited", ((bool)(x >= (col_width - item_h / 2))));
bring_up_editor = false;
@@ -1709,7 +1710,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool
popup_edited_item = p_item;
popup_edited_item_col = col;
- pressing_item_rect = Rect2(get_global_pos() + Point2i(col_ofs, _get_title_button_height() + y_ofs) - cache.offset, Size2(col_width, item_h));
+ pressing_item_rect = Rect2(get_global_position() + Point2i(col_ofs, _get_title_button_height() + y_ofs) - cache.offset, Size2(col_width, item_h));
pressing_for_editor_text = editor_text;
pressing_for_editor = true;
@@ -2378,7 +2379,7 @@ bool Tree::edit_selected() {
edited_item = s;
edited_col = col;
- custom_popup_rect = Rect2i(get_global_pos() + rect.pos, rect.size);
+ custom_popup_rect = Rect2i(get_global_position() + rect.pos, rect.size);
emit_signal("custom_popup_edited", false);
item_edited(col, s);
@@ -2393,7 +2394,7 @@ bool Tree::edit_selected() {
}
popup_menu->set_size(Size2(rect.size.width, 0));
- popup_menu->set_pos(get_global_pos() + rect.pos + Point2i(0, rect.size.height));
+ popup_menu->set_position(get_global_position() + rect.pos + Point2i(0, rect.size.height));
popup_menu->popup();
popup_edited_item = s;
popup_edited_item_col = col;
@@ -2401,8 +2402,8 @@ bool Tree::edit_selected() {
} else if (c.mode == TreeItem::CELL_MODE_STRING || c.mode == TreeItem::CELL_MODE_RANGE || c.mode == TreeItem::CELL_MODE_RANGE_EXPRESSION) {
- Point2i textedpos = get_global_pos() + rect.pos;
- text_editor->set_pos(textedpos);
+ Point2i textedpos = get_global_position() + rect.pos;
+ text_editor->set_position(textedpos);
text_editor->set_size(rect.size);
text_editor->clear();
text_editor->set_text(c.mode == TreeItem::CELL_MODE_STRING ? c.text : String::num(c.val, Math::step_decimals(c.step)));
@@ -2410,7 +2411,7 @@ bool Tree::edit_selected() {
if (c.mode == TreeItem::CELL_MODE_RANGE || c.mode == TreeItem::CELL_MODE_RANGE_EXPRESSION) {
- value_editor->set_pos(textedpos + Point2i(0, text_editor->get_size().height));
+ value_editor->set_position(textedpos + Point2i(0, text_editor->get_size().height));
value_editor->set_size(Size2(rect.size.width, 1));
value_editor->show_modal();
updating_value_editor = true;
@@ -2528,7 +2529,7 @@ void Tree::_notification(int p_what) {
if (p_what == NOTIFICATION_DRAG_BEGIN) {
single_select_defer = NULL;
- if (cache.scroll_speed > 0 && get_rect().has_point(get_viewport()->get_mouse_pos() - get_global_pos())) {
+ if (cache.scroll_speed > 0 && get_rect().has_point(get_viewport()->get_mouse_position() - get_global_position())) {
scrolling = true;
set_fixed_process(true);
}
@@ -2576,7 +2577,7 @@ void Tree::_notification(int p_what) {
}
if (scrolling) {
- Point2 point = get_viewport()->get_mouse_pos() - get_global_pos();
+ Point2 point = get_viewport()->get_mouse_position() - get_global_position();
if (point.x < cache.scroll_border) {
point.x -= cache.scroll_border;
} else if (point.x > get_size().width - cache.scroll_border) {
@@ -2912,7 +2913,7 @@ int Tree::get_column_width(int p_column) const {
if (expand_area < expanding_total)
return columns[p_column].min_width;
- ERR_FAIL_COND_V(expanding_columns == 0, -1); // shouldnt happen
+ ERR_FAIL_COND_V(expanding_columns == 0, -1); // shouldn't happen
return expand_area * columns[p_column].min_width / expanding_total;
}
diff --git a/scene/gui/tree.h b/scene/gui/tree.h
index 68d4453156..3830c3e8ca 100644
--- a/scene/gui/tree.h
+++ b/scene/gui/tree.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/video_player.cpp b/scene/gui/video_player.cpp
index 433cc546a6..e1a149d801 100644
--- a/scene/gui/video_player.cpp
+++ b/scene/gui/video_player.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/video_player.h b/scene/gui/video_player.h
index 4f2894cdc2..c3a839c514 100644
--- a/scene/gui/video_player.h
+++ b/scene/gui/video_player.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/viewport_container.cpp b/scene/gui/viewport_container.cpp
index 93789d945d..dbc2699867 100644
--- a/scene/gui/viewport_container.cpp
+++ b/scene/gui/viewport_container.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/gui/viewport_container.h b/scene/gui/viewport_container.h
index 96b352b1cc..27eb6ec81b 100644
--- a/scene/gui/viewport_container.h
+++ b/scene/gui/viewport_container.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/io/resource_format_image.cpp b/scene/io/resource_format_image.cpp
index 6a550a847d..6c0a6128d2 100644
--- a/scene/io/resource_format_image.cpp
+++ b/scene/io/resource_format_image.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/io/resource_format_image.h b/scene/io/resource_format_image.h
index 0638e97787..2cf6315f17 100644
--- a/scene/io/resource_format_image.h
+++ b/scene/io/resource_format_image.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/io/resource_format_wav.cpp b/scene/io/resource_format_wav.cpp
index 1e14d01f4e..dabbb79de3 100644
--- a/scene/io/resource_format_wav.cpp
+++ b/scene/io/resource_format_wav.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -97,7 +98,7 @@ RES ResourceFormatLoaderWAV::load(const String &p_path, const String& p_original
/* chunk size */
uint32_t chunksize=file->get_32();
- uint32_t file_pos=file->get_pos(); //save file pos, so we can skip to next chunk safely
+ uint32_t file_pos=file->get_position(); //save file pos, so we can skip to next chunk safely
if (file->eof_reached()) {
@@ -136,7 +137,7 @@ RES ResourceFormatLoaderWAV::load(const String &p_path, const String& p_original
break;
}
- /* Dont need anything else, continue */
+ /* Don't need anything else, continue */
format_found=true;
}
diff --git a/scene/io/resource_format_wav.h b/scene/io/resource_format_wav.h
index fd274625f9..9105689670 100644
--- a/scene/io/resource_format_wav.h
+++ b/scene/io/resource_format_wav.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/main/canvas_layer.cpp b/scene/main/canvas_layer.cpp
index 1fecb6fd9a..150aee99ba 100644
--- a/scene/main/canvas_layer.cpp
+++ b/scene/main/canvas_layer.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/main/canvas_layer.h b/scene/main/canvas_layer.h
index 26d21e3a0f..1be6f8be24 100644
--- a/scene/main/canvas_layer.h
+++ b/scene/main/canvas_layer.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/main/http_request.cpp b/scene/main/http_request.cpp
index 38ee03ab47..a9b2dba186 100644
--- a/scene/main/http_request.cpp
+++ b/scene/main/http_request.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -28,6 +29,8 @@
/*************************************************************************/
#include "http_request.h"
+#include "version.h"
+
void HTTPRequest::_redirect_request(const String &p_new_url) {
}
diff --git a/scene/main/http_request.h b/scene/main/http_request.h
index 2b2d7f9a38..6099d4e9bf 100644
--- a/scene/main/http_request.h
+++ b/scene/main/http_request.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/main/instance_placeholder.cpp b/scene/main/instance_placeholder.cpp
index 469a5e9441..8668020b2c 100644
--- a/scene/main/instance_placeholder.cpp
+++ b/scene/main/instance_placeholder.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/main/instance_placeholder.h b/scene/main/instance_placeholder.h
index 7900e35b00..ec4520e1c8 100644
--- a/scene/main/instance_placeholder.h
+++ b/scene/main/instance_placeholder.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index c13ed232a7..cfee5066b4 100755
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -2063,10 +2064,14 @@ void Node::set_editable_instance(Node *p_node, bool p_editable) {
ERR_FAIL_NULL(p_node);
ERR_FAIL_COND(!is_a_parent_of(p_node));
NodePath p = get_path_to(p_node);
- if (!p_editable)
+ if (!p_editable) {
data.editable_instances.erase(p);
- else
+ // Avoid this flag being needlessly saved;
+ // also give more visual feedback if editable children is reenabled
+ set_display_folded(false);
+ } else {
data.editable_instances[p] = true;
+ }
}
bool Node::is_editable_instance(Node *p_node) const {
@@ -2914,6 +2919,7 @@ void Node::_bind_methods() {
BIND_CONSTANT(DUPLICATE_SIGNALS);
BIND_CONSTANT(DUPLICATE_GROUPS);
BIND_CONSTANT(DUPLICATE_SCRIPTS);
+ BIND_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 714a58bd82..4a41fb82ab 100644
--- a/scene/main/node.h
+++ b/scene/main/node.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/main/resource_preloader.cpp b/scene/main/resource_preloader.cpp
index c08a6bcd5b..ae323ba021 100644
--- a/scene/main/resource_preloader.cpp
+++ b/scene/main/resource_preloader.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/main/resource_preloader.h b/scene/main/resource_preloader.h
index 5fba70c1c0..a54781dc81 100644
--- a/scene/main/resource_preloader.h
+++ b/scene/main/resource_preloader.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/main/scene_main_loop.cpp b/scene/main/scene_main_loop.cpp
index e766d1c149..be28479f39 100644
--- a/scene/main/scene_main_loop.cpp
+++ b/scene/main/scene_main_loop.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -374,6 +375,10 @@ void SceneTree::input_text(const String &p_text) {
root_lock--;
}
+bool SceneTree::is_input_handled() {
+ return input_handled;
+}
+
void SceneTree::input_event(const InputEvent &p_event) {
if (is_editor_hint() && (p_event.type == InputEvent::JOYPAD_MOTION || p_event.type == InputEvent::JOYPAD_BUTTON))
@@ -573,7 +578,7 @@ bool SceneTree::idle(float p_time) {
}
_flush_ugc();
- _flush_transform_notifications(); //transforms after world update, to avoid unnecesary enter/exit notifications
+ _flush_transform_notifications(); //transforms after world update, to avoid unnecessary enter/exit notifications
call_group_flags(GROUP_CALL_REALTIME, "_viewports", "update_worlds");
root_lock--;
@@ -678,24 +683,24 @@ void SceneTree::set_quit_on_go_back(bool p_enable) {
quit_on_go_back = 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 {
-#ifdef TOOLS_ENABLED
+
return editor_hint && edited_scene_root && edited_scene_root->is_a_parent_of(p_node);
-#else
- return false;
-#endif
}
bool SceneTree::is_editor_hint() const {
return editor_hint;
}
+#endif
+#ifdef DEBUG_ENABLED
void SceneTree::set_debug_collisions_hint(bool p_enabled) {
debug_collisions_hint = p_enabled;
@@ -715,6 +720,7 @@ bool SceneTree::is_debugging_navigation_hint() const {
return debug_navigation_hint;
}
+#endif
void SceneTree::set_debug_collisions_color(const Color &p_color) {
@@ -761,12 +767,12 @@ Ref<Material> SceneTree::get_debug_navigation_material() {
if (navigation_material.is_valid())
return navigation_material;
- Ref<FixedSpatialMaterial> line_material = Ref<FixedSpatialMaterial>(memnew(FixedSpatialMaterial));
+ Ref<SpatialMaterial> line_material = Ref<SpatialMaterial>(memnew(SpatialMaterial));
/* line_material->set_flag(Material::FLAG_UNSHADED, true);
line_material->set_line_width(3.0);
- line_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA, true);
- line_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_COLOR_ARRAY, true);
- line_material->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,get_debug_navigation_color());*/
+ line_material->set_fixed_flag(SpatialMaterial::FLAG_USE_ALPHA, true);
+ line_material->set_fixed_flag(SpatialMaterial::FLAG_USE_COLOR_ARRAY, true);
+ line_material->set_parameter(SpatialMaterial::PARAM_DIFFUSE,get_debug_navigation_color());*/
navigation_material = line_material;
@@ -778,12 +784,12 @@ Ref<Material> SceneTree::get_debug_navigation_disabled_material() {
if (navigation_disabled_material.is_valid())
return navigation_disabled_material;
- Ref<FixedSpatialMaterial> line_material = Ref<FixedSpatialMaterial>(memnew(FixedSpatialMaterial));
+ Ref<SpatialMaterial> line_material = Ref<SpatialMaterial>(memnew(SpatialMaterial));
/* line_material->set_flag(Material::FLAG_UNSHADED, true);
line_material->set_line_width(3.0);
- line_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA, true);
- line_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_COLOR_ARRAY, true);
- line_material->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,get_debug_navigation_disabled_color());*/
+ line_material->set_fixed_flag(SpatialMaterial::FLAG_USE_ALPHA, true);
+ line_material->set_fixed_flag(SpatialMaterial::FLAG_USE_COLOR_ARRAY, true);
+ line_material->set_parameter(SpatialMaterial::PARAM_DIFFUSE,get_debug_navigation_disabled_color());*/
navigation_disabled_material = line_material;
@@ -794,12 +800,12 @@ Ref<Material> SceneTree::get_debug_collision_material() {
if (collision_material.is_valid())
return collision_material;
- Ref<FixedSpatialMaterial> line_material = Ref<FixedSpatialMaterial>(memnew(FixedSpatialMaterial));
+ Ref<SpatialMaterial> line_material = Ref<SpatialMaterial>(memnew(SpatialMaterial));
/*line_material->set_flag(Material::FLAG_UNSHADED, true);
line_material->set_line_width(3.0);
- line_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA, true);
- line_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_COLOR_ARRAY, true);
- line_material->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,get_debug_collisions_color());*/
+ line_material->set_fixed_flag(SpatialMaterial::FLAG_USE_ALPHA, true);
+ line_material->set_fixed_flag(SpatialMaterial::FLAG_USE_COLOR_ARRAY, true);
+ line_material->set_parameter(SpatialMaterial::PARAM_DIFFUSE,get_debug_collisions_color());*/
collision_material = line_material;
@@ -813,11 +819,11 @@ Ref<Mesh> SceneTree::get_debug_contact_mesh() {
debug_contact_mesh = Ref<Mesh>(memnew(Mesh));
- Ref<FixedSpatialMaterial> mat = memnew(FixedSpatialMaterial);
+ Ref<SpatialMaterial> mat = memnew(SpatialMaterial);
/*mat->set_flag(Material::FLAG_UNSHADED,true);
mat->set_flag(Material::FLAG_DOUBLE_SIDED,true);
- mat->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA,true);
- mat->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,get_debug_collision_contact_color());*/
+ mat->set_fixed_flag(SpatialMaterial::FLAG_USE_ALPHA,true);
+ mat->set_parameter(SpatialMaterial::PARAM_DIFFUSE,get_debug_collision_contact_color());*/
Vector3 diamond[6] = {
Vector3(-1, 0, 0),
@@ -2153,6 +2159,7 @@ void SceneTree::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_pause", "enable"), &SceneTree::set_pause);
ClassDB::bind_method(D_METHOD("is_paused"), &SceneTree::is_paused);
ClassDB::bind_method(D_METHOD("set_input_as_handled"), &SceneTree::set_input_as_handled);
+ ClassDB::bind_method(D_METHOD("is_input_handled"), &SceneTree::is_input_handled);
ClassDB::bind_method(D_METHOD("create_timer:SceneTreeTimer", "time_sec", "pause_mode_process"), &SceneTree::create_timer, DEFVAL(true));
@@ -2260,9 +2267,13 @@ SceneTree::SceneTree() {
singleton = this;
_quit = false;
initialized = false;
+#ifdef TOOLS_ENABLED
editor_hint = false;
+#endif
+#ifdef DEBUG_ENABLED
debug_collisions_hint = false;
debug_navigation_hint = false;
+#endif
debug_collisions_color = GLOBAL_DEF("debug/collision/shape_color", Color(0.0, 0.6, 0.7, 0.5));
debug_collision_contact_color = GLOBAL_DEF("debug/collision/contact_color", Color(1.0, 0.2, 0.1, 0.8));
debug_navigation_color = GLOBAL_DEF("debug/navigation/geometry_color", Color(0.1, 1.0, 0.7, 0.4));
@@ -2306,7 +2317,7 @@ SceneTree::SceneTree() {
stretch_aspect = STRETCH_ASPECT_IGNORE;
last_screen_size = Size2(OS::get_singleton()->get_video_mode().width, OS::get_singleton()->get_video_mode().height);
- root->set_size(last_screen_size);
+ _update_root_rect();
if (ScriptDebugger::get_singleton()) {
ScriptDebugger::get_singleton()->set_request_scene_tree_message_func(_debugger_request_tree, this);
diff --git a/scene/main/scene_main_loop.h b/scene/main/scene_main_loop.h
index fadf77e30f..52d5f5c88c 100644
--- a/scene/main/scene_main_loop.h
+++ b/scene/main/scene_main_loop.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -108,9 +109,13 @@ 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;
+#endif
bool pause;
int root_lock;
@@ -350,13 +355,21 @@ public:
void quit();
void set_input_as_handled();
+ bool is_input_handled();
_FORCE_INLINE_ float get_fixed_process_time() const { return fixed_process_time; }
_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_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
void set_pause(bool p_enabled);
bool is_paused() const;
@@ -364,11 +377,19 @@ public:
void set_camera(const RID &p_camera);
RID get_camera() const;
+#ifdef DEBUG_ENABLED
void set_debug_collisions_hint(bool p_enabled);
bool is_debugging_collisions_hint() const;
void set_debug_navigation_hint(bool p_enabled);
bool is_debugging_navigation_hint() const;
+#else
+ void set_debug_collisions_hint(bool p_enabled) {}
+ bool is_debugging_collisions_hint() const { return false; }
+
+ void set_debug_navigation_hint(bool p_enabled) {}
+ bool is_debugging_navigation_hint() const { return false; }
+#endif
void set_debug_collisions_color(const Color &p_color);
Color get_debug_collisions_color() const;
diff --git a/scene/main/timer.cpp b/scene/main/timer.cpp
index 5df30e5080..a61d1100e6 100644..100755
--- a/scene/main/timer.cpp
+++ b/scene/main/timer.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -50,8 +51,7 @@ void Timer::_notification(int p_what) {
if (time_left < 0) {
if (!one_shot)
- //time_left=wait_time+time_left;
- time_left = wait_time;
+ time_left += wait_time;
else
stop();
@@ -66,8 +66,7 @@ void Timer::_notification(int p_what) {
if (time_left < 0) {
if (!one_shot)
- //time_left = wait_time + time_left;
- time_left = wait_time;
+ time_left += wait_time;
else
stop();
emit_signal("timeout");
@@ -116,16 +115,20 @@ void Timer::stop() {
autostart = false;
}
-void Timer::set_active(bool p_active) {
- if (active == p_active)
+void Timer::set_paused(bool p_paused) {
+ if (paused == p_paused)
return;
- active = p_active;
+ paused = p_paused;
_set_process(processing);
}
-bool Timer::is_active() const {
- return active;
+bool Timer::is_paused() const {
+ return paused;
+}
+
+bool Timer::is_stopped() const {
+ return get_time_left() <= 0;
}
float Timer::get_time_left() const {
@@ -162,8 +165,8 @@ Timer::TimerProcessMode Timer::get_timer_process_mode() const {
void Timer::_set_process(bool p_process, bool p_force) {
switch (timer_process_mode) {
- case TIMER_PROCESS_FIXED: set_fixed_process_internal(p_process && active); break;
- case TIMER_PROCESS_IDLE: set_process_internal(p_process && active); break;
+ case TIMER_PROCESS_FIXED: set_fixed_process_internal(p_process && !paused); break;
+ case TIMER_PROCESS_IDLE: set_process_internal(p_process && !paused); break;
}
processing = p_process;
}
@@ -182,8 +185,10 @@ void Timer::_bind_methods() {
ClassDB::bind_method(D_METHOD("start"), &Timer::start);
ClassDB::bind_method(D_METHOD("stop"), &Timer::stop);
- ClassDB::bind_method(D_METHOD("set_active", "active"), &Timer::set_active);
- ClassDB::bind_method(D_METHOD("is_active"), &Timer::is_active);
+ ClassDB::bind_method(D_METHOD("set_paused", "paused"), &Timer::set_paused);
+ ClassDB::bind_method(D_METHOD("is_paused"), &Timer::is_paused);
+
+ ClassDB::bind_method(D_METHOD("is_stopped"), &Timer::is_stopped);
ClassDB::bind_method(D_METHOD("get_time_left"), &Timer::get_time_left);
@@ -208,5 +213,5 @@ Timer::Timer() {
one_shot = false;
time_left = -1;
processing = false;
- active = true;
+ paused = false;
}
diff --git a/scene/main/timer.h b/scene/main/timer.h
index 756b779717..dd4711ec37 100644..100755
--- a/scene/main/timer.h
+++ b/scene/main/timer.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -39,7 +40,7 @@ class Timer : public Node {
bool one_shot;
bool autostart;
bool processing;
- bool active;
+ bool paused;
double time_left;
@@ -64,8 +65,11 @@ public:
void start();
void stop();
- void set_active(bool p_active);
- bool is_active() const;
+
+ void set_paused(bool p_paused);
+ bool is_paused() const;
+
+ bool is_stopped() const;
float get_time_left() const;
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 23f8189167..406640275c 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -1401,7 +1402,7 @@ void Viewport::_vp_input(const InputEvent &p_ev) {
return;
#ifdef TOOLS_ENABLED
- if (get_tree()->is_editor_hint() && get_tree()->get_edited_scene_root()->is_a_parent_of(this)) {
+ if (get_tree()->is_editor_hint() && get_tree()->get_edited_scene_root() && get_tree()->get_edited_scene_root()->is_a_parent_of(this)) {
return;
}
#endif
@@ -1422,7 +1423,7 @@ void Viewport::_vp_unhandled_input(const InputEvent &p_ev) {
if (disable_input)
return;
#ifdef TOOLS_ENABLED
- if (get_tree()->is_editor_hint() && get_tree()->get_edited_scene_root()->is_a_parent_of(this)) {
+ if (get_tree()->is_editor_hint() && get_tree()->get_edited_scene_root() && get_tree()->get_edited_scene_root()->is_a_parent_of(this)) {
return;
}
#endif
@@ -1443,9 +1444,9 @@ void Viewport::_vp_unhandled_input(const InputEvent &p_ev) {
unhandled_input(ev);
}
-Vector2 Viewport::get_mouse_pos() const {
+Vector2 Viewport::get_mouse_position() const {
- return (get_final_transform().affine_inverse() * _get_input_pre_xform()).xform(Input::get_singleton()->get_mouse_pos() - _get_window_offset());
+ return (get_final_transform().affine_inverse() * _get_input_pre_xform()).xform(Input::get_singleton()->get_mouse_position() - _get_window_offset());
}
void Viewport::warp_mouse(const Vector2 &p_pos) {
@@ -1537,7 +1538,7 @@ void Viewport::_gui_show_tooltip() {
else if (r.pos.y < 0)
r.pos.y = 0;
- gui.tooltip_popup->set_global_pos(r.pos);
+ gui.tooltip_popup->set_global_position(r.pos);
gui.tooltip_popup->set_size(r.size);
gui.tooltip_popup->raise();
@@ -1639,7 +1640,7 @@ Control *Viewport::_gui_find_control_at_pos(CanvasItem *p_node, const Point2 &p_
Control *c = p_node->cast_to<Control>();
if (c) {
- //print_line("at "+String(c->get_path())+" POS "+c->get_pos()+" bt "+p_xform);
+ //print_line("at "+String(c->get_path())+" POS "+c->get_position()+" bt "+p_xform);
}
//subwindows first!!
@@ -1992,7 +1993,7 @@ void Viewport::_gui_input_event(InputEvent p_event) {
gui.mouse_over = over;
if (gui.drag_preview) {
- gui.drag_preview->set_pos(mpos);
+ gui.drag_preview->set_position(mpos);
}
if (!over) {
@@ -2236,7 +2237,7 @@ void Viewport::_gui_set_drag_preview(Control *p_base, Control *p_control) {
memdelete(gui.drag_preview);
}
p_control->set_as_toplevel(true);
- p_control->set_pos(gui.last_mouse_pos);
+ p_control->set_position(gui.last_mouse_pos);
p_base->get_root_parent_control()->add_child(p_control); //add as child of viewport
p_control->raise();
if (gui.drag_preview) {
@@ -2648,7 +2649,7 @@ void Viewport::_bind_methods() {
ClassDB::bind_method(D_METHOD("is_audio_listener_2d", "enable"), &Viewport::is_audio_listener_2d);
ClassDB::bind_method(D_METHOD("set_attach_to_screen_rect", "rect"), &Viewport::set_attach_to_screen_rect);
- ClassDB::bind_method(D_METHOD("get_mouse_pos"), &Viewport::get_mouse_pos);
+ ClassDB::bind_method(D_METHOD("get_mouse_position"), &Viewport::get_mouse_position);
ClassDB::bind_method(D_METHOD("warp_mouse", "to_pos"), &Viewport::warp_mouse);
ClassDB::bind_method(D_METHOD("gui_has_modal_stack"), &Viewport::gui_has_modal_stack);
diff --git a/scene/main/viewport.h b/scene/main/viewport.h
index 3fc781c62c..d784fc8ee9 100644
--- a/scene/main/viewport.h
+++ b/scene/main/viewport.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -399,7 +400,7 @@ public:
void set_attach_to_screen_rect(const Rect2 &p_rect);
Rect2 get_attach_to_screen_rect() const;
- Vector2 get_mouse_pos() const;
+ Vector2 get_mouse_position() const;
void warp_mouse(const Vector2 &p_pos);
void set_physics_object_picking(bool p_enable);
diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp
index 06dae328f4..513aa8153d 100644
--- a/scene/register_scene_types.cpp
+++ b/scene/register_scene_types.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -423,7 +424,7 @@ void register_scene_types() {
ClassDB::register_class<GIProbeData>();
ClassDB::register_class<AnimationTreePlayer>();
ClassDB::register_class<Portal>();
- //ClassDB::register_type<Particles>();
+ ClassDB::register_class<Particles>();
ClassDB::register_class<Position3D>();
ClassDB::register_class<Quad>();
ClassDB::register_class<NavigationMeshInstance>();
@@ -471,7 +472,8 @@ void register_scene_types() {
ClassDB::register_class<MeshLibrary>();
AcceptDialog::set_swap_ok_cancel(GLOBAL_DEF("gui/common/swap_ok_cancel", bool(OS::get_singleton()->get_swap_ok_cancel())));
- ClassDB::register_class<CanvasItemMaterial>();
+ ClassDB::register_class<Shader>();
+ ClassDB::register_class<ShaderMaterial>();
ClassDB::register_virtual_class<CanvasItem>();
ClassDB::register_class<Node2D>();
ClassDB::register_class<Particles2D>();
@@ -519,21 +521,22 @@ void register_scene_types() {
/* REGISTER RESOURCES */
ClassDB::register_virtual_class<Shader>();
- //ClassDB::register_virtual_type<ShaderGraph>();
- ClassDB::register_class<CanvasItemShader>();
-//ClassDB::register_type<CanvasItemShaderGraph>();
#ifndef _3D_DISABLED
ClassDB::register_class<Mesh>();
+ ClassDB::register_class<QuadMesh>();
ClassDB::register_virtual_class<Material>();
- ClassDB::register_class<FixedSpatialMaterial>();
- SceneTree::add_idle_callback(FixedSpatialMaterial::flush_changes);
- FixedSpatialMaterial::init_shaders();
+ ClassDB::register_class<SpatialMaterial>();
+ ClassDB::add_compatibility_class("FixedSpatialMaterial", "SpatialMaterial");
+ SceneTree::add_idle_callback(SpatialMaterial::flush_changes);
+ SpatialMaterial::init_shaders();
+
+ ClassDB::register_class<ParticlesMaterial>();
+ SceneTree::add_idle_callback(ParticlesMaterial::flush_changes);
+ ParticlesMaterial::init_shaders();
+
//ClassDB::register_type<ShaderMaterial>();
ClassDB::register_class<RoomBounds>();
- //ClassDB::register_type<MaterialShaderGraph>();
- ClassDB::register_class<SpatialShader>();
- ClassDB::register_class<ParticlesShader>();
ClassDB::register_class<MultiMesh>();
ClassDB::register_class<MeshLibrary>();
@@ -564,6 +567,8 @@ void register_scene_types() {
ClassDB::register_class<ImageTexture>();
ClassDB::register_class<AtlasTexture>();
ClassDB::register_class<LargeTexture>();
+ ClassDB::register_class<CurveTexture>();
+ ClassDB::register_class<GradientTexture>();
ClassDB::register_class<CubeMap>();
ClassDB::register_class<Animation>();
ClassDB::register_virtual_class<Font>();
@@ -651,6 +656,7 @@ void unregister_scene_types() {
memdelete(resource_loader_text);
}
- FixedSpatialMaterial::finish_shaders();
+ SpatialMaterial::finish_shaders();
+ ParticlesMaterial::finish_shaders();
SceneStringNames::free();
}
diff --git a/scene/register_scene_types.h b/scene/register_scene_types.h
index 090254c5f7..dee0af9063 100644
--- a/scene/register_scene_types.h
+++ b/scene/register_scene_types.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp
index 4fddd55e20..cebec379e6 100644
--- a/scene/resources/animation.cpp
+++ b/scene/resources/animation.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/animation.h b/scene/resources/animation.h
index 57ab8b282f..ef5befac65 100644
--- a/scene/resources/animation.h
+++ b/scene/resources/animation.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/audio_stream_resampled.cpp b/scene/resources/audio_stream_resampled.cpp
index 1c0c725ef9..213ac4400b 100644
--- a/scene/resources/audio_stream_resampled.cpp
+++ b/scene/resources/audio_stream_resampled.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/audio_stream_resampled.h b/scene/resources/audio_stream_resampled.h
index 7ceb6cef84..53fa3bd0b9 100644
--- a/scene/resources/audio_stream_resampled.h
+++ b/scene/resources/audio_stream_resampled.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/audio_stream_sample.cpp b/scene/resources/audio_stream_sample.cpp
index b419f4b6be..4f2ab18637 100644
--- a/scene/resources/audio_stream_sample.cpp
+++ b/scene/resources/audio_stream_sample.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -289,7 +290,7 @@ void AudioStreamPlaybackSample::mix(AudioFrame *p_buffer, float p_rate_scale, in
offset = loop_end_fp - (loop_begin_fp - offset);
}
} else {
- /* check for sample not reaching begining */
+ /* check for sample not reaching beginning */
if (offset < 0) {
active = false;
diff --git a/scene/resources/audio_stream_sample.h b/scene/resources/audio_stream_sample.h
index d5d1ae79c0..84d450e3f2 100644
--- a/scene/resources/audio_stream_sample.h
+++ b/scene/resources/audio_stream_sample.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/baked_light.cpp b/scene/resources/baked_light.cpp
index 7fa930fd58..1d896e640a 100644
--- a/scene/resources/baked_light.cpp
+++ b/scene/resources/baked_light.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/baked_light.h b/scene/resources/baked_light.h
index 7dee40b34e..8d25c9caa2 100644
--- a/scene/resources/baked_light.h
+++ b/scene/resources/baked_light.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/bit_mask.cpp b/scene/resources/bit_mask.cpp
index 277acad905..b8a9ea3361 100644
--- a/scene/resources/bit_mask.cpp
+++ b/scene/resources/bit_mask.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/bit_mask.h b/scene/resources/bit_mask.h
index 3cee2279b8..78da6ce0d8 100644
--- a/scene/resources/bit_mask.h
+++ b/scene/resources/bit_mask.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/bounds.cpp b/scene/resources/bounds.cpp
index 974ff76cd0..b088426013 100644
--- a/scene/resources/bounds.cpp
+++ b/scene/resources/bounds.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/bounds.h b/scene/resources/bounds.h
index 62e1b8e0ef..8c0d1dcf6e 100644
--- a/scene/resources/bounds.h
+++ b/scene/resources/bounds.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/box_shape.cpp b/scene/resources/box_shape.cpp
index 1e9991d7dc..fedfc71313 100644
--- a/scene/resources/box_shape.cpp
+++ b/scene/resources/box_shape.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/box_shape.h b/scene/resources/box_shape.h
index 2bab6d9b8a..fdf1e98020 100644
--- a/scene/resources/box_shape.h
+++ b/scene/resources/box_shape.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/canvas.cpp b/scene/resources/canvas.cpp
index dd0375b765..b6a909f3fa 100644
--- a/scene/resources/canvas.cpp
+++ b/scene/resources/canvas.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/canvas.h b/scene/resources/canvas.h
index 1d3775c30c..331a997914 100644
--- a/scene/resources/canvas.h
+++ b/scene/resources/canvas.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/capsule_shape.cpp b/scene/resources/capsule_shape.cpp
index 1aa3fee0ca..1fcc9da5b6 100644
--- a/scene/resources/capsule_shape.cpp
+++ b/scene/resources/capsule_shape.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/capsule_shape.h b/scene/resources/capsule_shape.h
index ecffdd8ce7..2864e7e23f 100644
--- a/scene/resources/capsule_shape.h
+++ b/scene/resources/capsule_shape.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/capsule_shape_2d.cpp b/scene/resources/capsule_shape_2d.cpp
index d24640e43d..3f41526bcb 100644
--- a/scene/resources/capsule_shape_2d.cpp
+++ b/scene/resources/capsule_shape_2d.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/capsule_shape_2d.h b/scene/resources/capsule_shape_2d.h
index 05d819c1d5..93e7d846a4 100644
--- a/scene/resources/capsule_shape_2d.h
+++ b/scene/resources/capsule_shape_2d.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/circle_shape_2d.cpp b/scene/resources/circle_shape_2d.cpp
index 2271a3ad93..4512e1c4a9 100644
--- a/scene/resources/circle_shape_2d.cpp
+++ b/scene/resources/circle_shape_2d.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/circle_shape_2d.h b/scene/resources/circle_shape_2d.h
index 11fdc51f09..a4a4601e66 100644
--- a/scene/resources/circle_shape_2d.h
+++ b/scene/resources/circle_shape_2d.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/color_ramp.cpp b/scene/resources/color_ramp.cpp
index 2c20ad527b..3c58a76998 100644
--- a/scene/resources/color_ramp.cpp
+++ b/scene/resources/color_ramp.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/color_ramp.h b/scene/resources/color_ramp.h
index 78c88c3270..e231e9fc52 100644
--- a/scene/resources/color_ramp.h
+++ b/scene/resources/color_ramp.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/concave_polygon_shape.cpp b/scene/resources/concave_polygon_shape.cpp
index 0031580153..47cc49c631 100644
--- a/scene/resources/concave_polygon_shape.cpp
+++ b/scene/resources/concave_polygon_shape.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/concave_polygon_shape.h b/scene/resources/concave_polygon_shape.h
index f048a4d151..a8f9d50674 100644
--- a/scene/resources/concave_polygon_shape.h
+++ b/scene/resources/concave_polygon_shape.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/concave_polygon_shape_2d.cpp b/scene/resources/concave_polygon_shape_2d.cpp
index 04a69d9c8e..653540a663 100644
--- a/scene/resources/concave_polygon_shape_2d.cpp
+++ b/scene/resources/concave_polygon_shape_2d.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/concave_polygon_shape_2d.h b/scene/resources/concave_polygon_shape_2d.h
index 23c602980c..d4c102e0d6 100644
--- a/scene/resources/concave_polygon_shape_2d.h
+++ b/scene/resources/concave_polygon_shape_2d.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/convex_polygon_shape.cpp b/scene/resources/convex_polygon_shape.cpp
index 350c4c2d86..10e92b43ae 100644
--- a/scene/resources/convex_polygon_shape.cpp
+++ b/scene/resources/convex_polygon_shape.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/convex_polygon_shape.h b/scene/resources/convex_polygon_shape.h
index 6701c41f0f..4340b0ef7c 100644
--- a/scene/resources/convex_polygon_shape.h
+++ b/scene/resources/convex_polygon_shape.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/convex_polygon_shape_2d.cpp b/scene/resources/convex_polygon_shape_2d.cpp
index 311614b7c1..fcbf66c8cd 100644
--- a/scene/resources/convex_polygon_shape_2d.cpp
+++ b/scene/resources/convex_polygon_shape_2d.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/convex_polygon_shape_2d.h b/scene/resources/convex_polygon_shape_2d.h
index edb302ba5e..ba4a5ae8aa 100644
--- a/scene/resources/convex_polygon_shape_2d.h
+++ b/scene/resources/convex_polygon_shape_2d.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/curve.cpp b/scene/resources/curve.cpp
index f85220ac23..10c12c9411 100644
--- a/scene/resources/curve.cpp
+++ b/scene/resources/curve.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/curve.h b/scene/resources/curve.h
index 2a8fab7f4c..17c0ac9f5e 100644
--- a/scene/resources/curve.h
+++ b/scene/resources/curve.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -135,7 +136,7 @@ public:
float get_baked_length() const;
Vector2 interpolate_baked(float p_offset, bool p_cubic = false) const;
- PoolVector2Array get_baked_points() const; //useful for going thru
+ PoolVector2Array get_baked_points() const; //useful for going through
PoolVector2Array tesselate(int p_max_stages = 5, float p_tolerance = 4) const; //useful for display
@@ -203,8 +204,8 @@ public:
float get_baked_length() const;
Vector3 interpolate_baked(float p_offset, bool p_cubic = false) const;
float interpolate_baked_tilt(float p_offset) const;
- PoolVector3Array get_baked_points() const; //useful for going thru
- PoolRealArray get_baked_tilts() const; //useful for going thru
+ PoolVector3Array get_baked_points() const; //useful for going through
+ PoolRealArray get_baked_tilts() const; //useful for going through
PoolVector3Array tesselate(int p_max_stages = 5, float p_tolerance = 4) const; //useful for display
diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp
index 60490d70ca..3a824a56a3 100644
--- a/scene/resources/default_theme/default_theme.cpp
+++ b/scene/resources/default_theme/default_theme.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -120,7 +121,7 @@ static Ref<Texture> make_icon(T p_src) {
}
static Ref<Shader> make_shader(const char *vertex_code, const char *fragment_code, const char *lighting_code) {
- Ref<Shader> shader = (memnew(Shader(Shader::MODE_CANVAS_ITEM)));
+ Ref<Shader> shader = (memnew(Shader()));
//shader->set_code(vertex_code, fragment_code, lighting_code);
return shader;
@@ -283,16 +284,10 @@ void fill_default_theme(Ref<Theme> &t, const Ref<Font> &default_font, const Ref<
// ToolButton
- Ref<StyleBox> tb_empty = memnew(StyleBoxEmpty);
- tb_empty->set_default_margin(MARGIN_LEFT, 6 * scale);
- tb_empty->set_default_margin(MARGIN_RIGHT, 6 * scale);
- tb_empty->set_default_margin(MARGIN_TOP, 4 * scale);
- tb_empty->set_default_margin(MARGIN_BOTTOM, 4 * scale);
-
- t->set_stylebox("normal", "ToolButton", tb_empty);
- t->set_stylebox("pressed", "ToolButton", make_stylebox(button_pressed_png, 4, 4, 4, 4));
- t->set_stylebox("hover", "ToolButton", make_stylebox(button_normal_png, 4, 4, 4, 4));
- t->set_stylebox("disabled", "ToolButton", make_empty_stylebox(4, 4, 4, 4));
+ t->set_stylebox("normal", "ToolButton", make_empty_stylebox(6, 4, 6, 4));
+ t->set_stylebox("pressed", "ToolButton", make_stylebox(button_pressed_png, 4, 4, 4, 4, 6, 4, 6, 4));
+ t->set_stylebox("hover", "ToolButton", make_stylebox(button_normal_png, 4, 4, 4, 4, 6, 4, 6, 4));
+ t->set_stylebox("disabled", "ToolButton", make_empty_stylebox(6, 4, 6, 4));
t->set_stylebox("focus", "ToolButton", focus);
t->set_font("font", "ToolButton", default_font);
@@ -537,14 +532,12 @@ void fill_default_theme(Ref<Theme> &t, const Ref<Font> &default_font, const Ref<
// WindowDialog
- Ref<StyleBoxTexture> style_pp_win = sb_expand(make_stylebox(popup_window_png, 10, 26, 10, 8), 8, 24, 8, 6);
- t->set_stylebox("panel", "WindowDialog", style_pp_win);
- t->set_constant("titlebar_height", "WindowDialog", 20 * scale);
- t->set_constant("scaleborder_size", "WindowDialog", 4);
+ t->set_stylebox("panel", "WindowDialog", sb_expand(make_stylebox(popup_window_png, 10, 26, 10, 8), 8, 24, 8, 6));
+ t->set_constant("scaleborder_size", "WindowDialog", 4 * scale);
t->set_font("title_font", "WindowDialog", large_font);
t->set_color("title_color", "WindowDialog", Color(0, 0, 0));
- t->set_constant("title_height", "WindowDialog", 18 * scale);
+ t->set_constant("title_height", "WindowDialog", 20 * scale);
t->set_icon("close", "WindowDialog", make_icon(close_png));
t->set_icon("close_hilite", "WindowDialog", make_icon(close_hl_png));
diff --git a/scene/resources/default_theme/default_theme.h b/scene/resources/default_theme/default_theme.h
index fc557e4270..6fd57b6f22 100644
--- a/scene/resources/default_theme/default_theme.h
+++ b/scene/resources/default_theme/default_theme.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/default_theme/make_header.py b/scene/resources/default_theme/make_header.py
index 68c9e92527..03c2c9be4a 100755
--- a/scene/resources/default_theme/make_header.py
+++ b/scene/resources/default_theme/make_header.py
@@ -8,7 +8,7 @@ import string
f = open("theme_data.h", "wb")
-f.write("// THIS FILE HAS BEEN AUTOGENERATED, DONT EDIT!!\n")
+f.write("// THIS FILE HAS BEEN AUTOGENERATED, DON'T EDIT!!\n")
f.write("\n\n")
diff --git a/scene/resources/dynamic_font.cpp b/scene/resources/dynamic_font.cpp
index 08ebb954b2..6a5c4b97fc 100644
--- a/scene/resources/dynamic_font.cpp
+++ b/scene/resources/dynamic_font.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -29,6 +30,7 @@
#ifdef FREETYPE_ENABLED
#include "dynamic_font.h"
#include "os/file_access.h"
+#include "os/os.h"
bool DynamicFontData::CacheID::operator<(CacheID right) const {
@@ -98,6 +100,7 @@ DynamicFontData::~DynamicFontData() {
}
////////////////////
+HashMap<String, Vector<uint8_t> > DynamicFontAtSize::_fontdata;
Error DynamicFontAtSize::_load() {
@@ -106,7 +109,29 @@ Error DynamicFontAtSize::_load() {
ERR_EXPLAIN(TTR("Error initializing FreeType."));
ERR_FAIL_COND_V(error != 0, ERR_CANT_CREATE);
- if (font->font_path != String()) {
+ // FT_OPEN_STREAM is extremely slow only on Android.
+ if (OS::get_singleton()->get_name() == "Android" && font->font_mem == NULL && font->font_path != String()) {
+ // cache font only once for each font->font_path
+ if (_fontdata.has(font->font_path)) {
+
+ font->set_font_ptr(_fontdata[font->font_path].ptr(), _fontdata[font->font_path].size());
+
+ } else {
+
+ FileAccess *f = FileAccess::open(font->font_path, FileAccess::READ);
+ ERR_FAIL_COND_V(!f, ERR_CANT_OPEN);
+
+ size_t len = f->get_len();
+ _fontdata[font->font_path] = Vector<uint8_t>();
+ Vector<uint8_t> &fontdata = _fontdata[font->font_path];
+ fontdata.resize(len);
+ f->get_buffer(fontdata.ptr(), len);
+ font->set_font_ptr(fontdata.ptr(), len);
+ f->close();
+ }
+ }
+
+ if (font->font_mem == NULL && font->font_path != String()) {
FileAccess *f = FileAccess::open(font->font_path, FileAccess::READ);
ERR_FAIL_COND_V(!f, ERR_CANT_OPEN);
diff --git a/scene/resources/dynamic_font.h b/scene/resources/dynamic_font.h
index 9502943909..7c94def5aa 100644
--- a/scene/resources/dynamic_font.h
+++ b/scene/resources/dynamic_font.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -141,6 +142,7 @@ class DynamicFontAtSize : public Reference {
Ref<DynamicFontData> font;
DynamicFontData::CacheID id;
+ static HashMap<String, Vector<uint8_t> > _fontdata;
Error _load();
protected:
diff --git a/scene/resources/dynamic_font_stb.cpp b/scene/resources/dynamic_font_stb.cpp
index 7b62ccc369..0a784c6496 100644
--- a/scene/resources/dynamic_font_stb.cpp
+++ b/scene/resources/dynamic_font_stb.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/dynamic_font_stb.h b/scene/resources/dynamic_font_stb.h
index 0c17e3a8b3..3862607ab5 100644
--- a/scene/resources/dynamic_font_stb.h
+++ b/scene/resources/dynamic_font_stb.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp
index b134d8052b..96871cc944 100644
--- a/scene/resources/environment.cpp
+++ b/scene/resources/environment.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/environment.h b/scene/resources/environment.h
index 3ac311f4a3..9014a9f5c2 100644
--- a/scene/resources/environment.h
+++ b/scene/resources/environment.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp
index 9f30474a26..692dc47677 100644
--- a/scene/resources/font.cpp
+++ b/scene/resources/font.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/font.h b/scene/resources/font.h
index 332017684d..20978acccd 100644
--- a/scene/resources/font.h
+++ b/scene/resources/font.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/gibberish_stream.cpp b/scene/resources/gibberish_stream.cpp
index fdc5bf01e8..e2994f1419 100644
--- a/scene/resources/gibberish_stream.cpp
+++ b/scene/resources/gibberish_stream.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/gibberish_stream.h b/scene/resources/gibberish_stream.h
index 257a1faebf..ebe61382eb 100644
--- a/scene/resources/gibberish_stream.h
+++ b/scene/resources/gibberish_stream.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp
index 410f4962fa..48299d566c 100644
--- a/scene/resources/material.cpp
+++ b/scene/resources/material.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -44,14 +45,132 @@ Material::~Material() {
VisualServer::get_singleton()->free(material);
}
+///////////////////////////////////
+
+bool ShaderMaterial::_set(const StringName &p_name, const Variant &p_value) {
+
+ if (p_name == SceneStringNames::get_singleton()->shader_shader) {
+ set_shader(p_value);
+ return true;
+ } else {
+
+ if (shader.is_valid()) {
+
+ StringName pr = shader->remap_param(p_name);
+ if (!pr) {
+ String n = p_name;
+ if (n.find("param/") == 0) { //backwards compatibility
+ pr = n.substr(6, n.length());
+ }
+ }
+ if (pr) {
+ VisualServer::get_singleton()->material_set_param(_get_material(), pr, p_value);
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+bool ShaderMaterial::_get(const StringName &p_name, Variant &r_ret) const {
+
+ if (p_name == SceneStringNames::get_singleton()->shader_shader) {
+
+ r_ret = get_shader();
+ return true;
+
+ } else {
+
+ if (shader.is_valid()) {
+
+ StringName pr = shader->remap_param(p_name);
+ if (pr) {
+ r_ret = VisualServer::get_singleton()->material_get_param(_get_material(), pr);
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+void ShaderMaterial::_get_property_list(List<PropertyInfo> *p_list) const {
+
+ p_list->push_back(PropertyInfo(Variant::OBJECT, "shader/shader", PROPERTY_HINT_RESOURCE_TYPE, "Shader,ShaderGraph"));
+
+ if (!shader.is_null()) {
+
+ shader->get_param_list(p_list);
+ }
+}
+
+void ShaderMaterial::set_shader(const Ref<Shader> &p_shader) {
+
+ shader = p_shader;
+
+ RID rid;
+ if (shader.is_valid())
+ rid = shader->get_rid();
+
+ VS::get_singleton()->material_set_shader(_get_material(), rid);
+ _change_notify(); //properties for shader exposed
+ emit_changed();
+}
+
+Ref<Shader> ShaderMaterial::get_shader() const {
+
+ return shader;
+}
+
+void ShaderMaterial::set_shader_param(const StringName &p_param, const Variant &p_value) {
+
+ VS::get_singleton()->material_set_param(_get_material(), p_param, p_value);
+}
+
+Variant ShaderMaterial::get_shader_param(const StringName &p_param) const {
+
+ return VS::get_singleton()->material_get_param(_get_material(), p_param);
+}
+
+void ShaderMaterial::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("set_shader", "shader:Shader"), &ShaderMaterial::set_shader);
+ ClassDB::bind_method(D_METHOD("get_shader:Shader"), &ShaderMaterial::get_shader);
+ ClassDB::bind_method(D_METHOD("set_shader_param", "param", "value"), &ShaderMaterial::set_shader_param);
+ ClassDB::bind_method(D_METHOD("get_shader_param", "param"), &ShaderMaterial::get_shader_param);
+}
+
+void ShaderMaterial::get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const {
+
+ String f = p_function.operator String();
+ if ((f == "get_shader_param" || f == "set_shader_param") && p_idx == 0) {
+
+ if (shader.is_valid()) {
+ List<PropertyInfo> pl;
+ shader->get_param_list(&pl);
+ for (List<PropertyInfo>::Element *E = pl.front(); E; E = E->next()) {
+ r_options->push_back("\"" + E->get().name.replace_first("shader_param/", "") + "\"");
+ }
+ }
+ }
+ Resource::get_argument_options(p_function, p_idx, r_options);
+}
+
+ShaderMaterial::ShaderMaterial() {
+}
+
+ShaderMaterial::~ShaderMaterial() {
+}
+
/////////////////////////////////
-Mutex *FixedSpatialMaterial::material_mutex = NULL;
-SelfList<FixedSpatialMaterial>::List FixedSpatialMaterial::dirty_materials;
-Map<FixedSpatialMaterial::MaterialKey, FixedSpatialMaterial::ShaderData> FixedSpatialMaterial::shader_map;
-FixedSpatialMaterial::ShaderNames *FixedSpatialMaterial::shader_names = NULL;
+Mutex *SpatialMaterial::material_mutex = NULL;
+SelfList<SpatialMaterial>::List SpatialMaterial::dirty_materials;
+Map<SpatialMaterial::MaterialKey, SpatialMaterial::ShaderData> SpatialMaterial::shader_map;
+SpatialMaterial::ShaderNames *SpatialMaterial::shader_names = NULL;
-void FixedSpatialMaterial::init_shaders() {
+void SpatialMaterial::init_shaders() {
#ifndef NO_THREADS
material_mutex = Mutex::create();
@@ -81,6 +200,10 @@ void FixedSpatialMaterial::init_shaders() {
shader_names->uv2_scale = "uv2_scale";
shader_names->uv2_offset = "uv2_offset";
+ shader_names->particle_h_frames = "particle_h_frames";
+ shader_names->particle_v_frames = "particle_v_frames";
+ shader_names->particles_anim_loop = "particles_anim_loop";
+
shader_names->texture_names[TEXTURE_ALBEDO] = "texture_albedo";
shader_names->texture_names[TEXTURE_SPECULAR] = "texture_specular";
shader_names->texture_names[TEXTURE_EMISSION] = "texture_emission";
@@ -98,7 +221,7 @@ void FixedSpatialMaterial::init_shaders() {
shader_names->texture_names[TEXTURE_DETAIL_NORMAL] = "texture_detail_normal";
}
-void FixedSpatialMaterial::finish_shaders() {
+void SpatialMaterial::finish_shaders() {
#ifndef NO_THREADS
memdelete(material_mutex);
@@ -107,7 +230,7 @@ void FixedSpatialMaterial::finish_shaders() {
memdelete(shader_names);
}
-void FixedSpatialMaterial::_update_shader() {
+void SpatialMaterial::_update_shader() {
dirty_materials.remove(&element);
@@ -135,7 +258,7 @@ void FixedSpatialMaterial::_update_shader() {
//must create a shader!
- String code = "render_mode ";
+ String code = "shader_type spatial;\nrender_mode ";
switch (blend_mode) {
case BLEND_MODE_MIX: code += "blend_mix"; break;
case BLEND_MODE_ADD: code += "blend_add"; break;
@@ -180,6 +303,11 @@ void FixedSpatialMaterial::_update_shader() {
code += "uniform vec2 uv1_offset;\n";
code += "uniform vec2 uv2_scale;\n";
code += "uniform vec2 uv2_offset;\n";
+ if (billboard_mode == BILLBOARD_PARTICLES) {
+ code += "uniform int particles_anim_h_frames;\n";
+ code += "uniform int particles_anim_v_frames;\n";
+ code += "uniform bool particles_anim_loop;\n";
+ }
if (features[FEATURE_EMISSION]) {
@@ -235,6 +363,58 @@ void FixedSpatialMaterial::_update_shader() {
code += "\tPOINT_SIZE=point_size;\n";
}
code += "\tUV=UV*uv1_scale+uv1_offset;\n";
+
+ switch (billboard_mode) {
+ case BILLBOARD_DISABLED: {
+
+ } break;
+ case BILLBOARD_ENABLED: {
+
+ code += "\tMODELVIEW_MATRIX = INV_CAMERA_MATRIX * mat4(CAMERA_MATRIX[0],CAMERA_MATRIX[1],CAMERA_MATRIX[2],WORLD_MATRIX[3]);\n";
+ } break;
+ case BILLBOARD_FIXED_Y: {
+ code += "\tMODELVIEW_MATRIX = INV_CAMERA_MATRIX * mat4(CAMERA_MATRIX[0],WORLD_MATRIX[1],vec4(normalize(cross(CAMERA_MATRIX[0].xyz,WORLD_MATRIX[1].xyz)),0.0),WORLD_MATRIX[3]);\n";
+ } break;
+ case BILLBOARD_PARTICLES: {
+
+ //make billboard
+ code += "\tmat4 mat_world = mat4(normalize(CAMERA_MATRIX[0])*length(WORLD_MATRIX[0]),normalize(CAMERA_MATRIX[1])*length(WORLD_MATRIX[0]),normalize(CAMERA_MATRIX[2])*length(WORLD_MATRIX[2]),WORLD_MATRIX[3]);\n";
+ //rotate by rotation
+ code += "\tmat_world = mat_world * mat4( vec4(cos(INSTANCE_CUSTOM.x),-sin(INSTANCE_CUSTOM.x),0.0,0.0), vec4(sin(INSTANCE_CUSTOM.x),cos(INSTANCE_CUSTOM.x),0.0,0.0),vec4(0.0,0.0,1.0,0.0),vec4(0.0,0.0,0.0,1.0));\n";
+ //set modelview
+ code += "\tMODELVIEW_MATRIX = INV_CAMERA_MATRIX * mat_world;\n";
+
+ //handle animation
+ code += "\tint particle_total_frames = particles_anim_h_frames * particles_anim_v_frames;\n";
+ code += "\tint particle_frame = int(INSTANCE_CUSTOM.y * float(particle_total_frames));\n";
+ code += "\tif (particles_anim_loop) particle_frame=clamp(particle_frame,0,particle_total_frames-1); else particle_frame=abs(particle_frame)%particle_total_frames;\n";
+ //code += "\tUV /= vec2(float(particles_anim_h_frames),float(particles_anim_v_frames));\n";
+ //code += "\tUV+= UV * vec2(float(particle_frame % particles_anim_h_frames),float(particle_frame / particles_anim_v_frames));\n";
+ //handle rotation
+ // code += "\tmat4 rotation = mat4("
+
+ } break;
+ }
+
+ if (flags[FLAG_FIXED_SIZE]) {
+
+ code += "\tif (PROJECTION_MATRIX[3][3] != 0.0) {\n";
+ //orthogonal matrix, try to do about the same
+ //with viewport size
+ code += "\t\tfloat h = abs(1.0 / (2.0 * PROJECTION_MATRIX[1][1]));\n";
+ code += "\t\tfloat sc = (h * 2.0); //consistent with Y-fov\n";
+ code += "\t\tMODELVIEW_MATRIX[0]*=sc;\n";
+ code += "\t\tMODELVIEW_MATRIX[1]*=sc;\n";
+ code += "\t\tMODELVIEW_MATRIX[2]*=sc;\n";
+ code += "\t} else {\n";
+ //just scale by depth
+ code += "\t\tfloat sc = -(MODELVIEW_MATRIX)[3].z;\n";
+ code += "\t\tMODELVIEW_MATRIX[0]*=sc;\n";
+ code += "\t\tMODELVIEW_MATRIX[1]*=sc;\n";
+ code += "\t\tMODELVIEW_MATRIX[2]*=sc;\n";
+ code += "\t}\n";
+ }
+
if (detail_uv == DETAIL_UV_2) {
code += "\tUV2=UV2*uv2_scale+uv2_offset;\n";
}
@@ -336,7 +516,7 @@ void FixedSpatialMaterial::_update_shader() {
code += "}\n";
ShaderData shader_data;
- shader_data.shader = VS::get_singleton()->shader_create(VS::SHADER_SPATIAL);
+ shader_data.shader = VS::get_singleton()->shader_create();
shader_data.users = 1;
VS::get_singleton()->shader_set_code(shader_data.shader, code);
@@ -346,7 +526,7 @@ void FixedSpatialMaterial::_update_shader() {
VS::get_singleton()->material_set_shader(_get_material(), shader_data.shader);
}
-void FixedSpatialMaterial::flush_changes() {
+void SpatialMaterial::flush_changes() {
if (material_mutex)
material_mutex->lock();
@@ -360,7 +540,7 @@ void FixedSpatialMaterial::flush_changes() {
material_mutex->unlock();
}
-void FixedSpatialMaterial::_queue_shader_change() {
+void SpatialMaterial::_queue_shader_change() {
if (material_mutex)
material_mutex->lock();
@@ -373,7 +553,7 @@ void FixedSpatialMaterial::_queue_shader_change() {
material_mutex->unlock();
}
-bool FixedSpatialMaterial::_is_shader_dirty() const {
+bool SpatialMaterial::_is_shader_dirty() const {
bool dirty = false;
@@ -387,187 +567,187 @@ bool FixedSpatialMaterial::_is_shader_dirty() const {
return dirty;
}
-void FixedSpatialMaterial::set_albedo(const Color &p_albedo) {
+void SpatialMaterial::set_albedo(const Color &p_albedo) {
albedo = p_albedo;
VS::get_singleton()->material_set_param(_get_material(), shader_names->albedo, p_albedo);
}
-Color FixedSpatialMaterial::get_albedo() const {
+Color SpatialMaterial::get_albedo() const {
return albedo;
}
-void FixedSpatialMaterial::set_specular_mode(SpecularMode p_mode) {
+void SpatialMaterial::set_specular_mode(SpecularMode p_mode) {
specular_mode = p_mode;
_change_notify();
_queue_shader_change();
}
-FixedSpatialMaterial::SpecularMode FixedSpatialMaterial::get_specular_mode() const {
+SpatialMaterial::SpecularMode SpatialMaterial::get_specular_mode() const {
return specular_mode;
}
-void FixedSpatialMaterial::set_specular(const Color &p_specular) {
+void SpatialMaterial::set_specular(const Color &p_specular) {
specular = p_specular;
VS::get_singleton()->material_set_param(_get_material(), shader_names->specular, p_specular);
}
-Color FixedSpatialMaterial::get_specular() const {
+Color SpatialMaterial::get_specular() const {
return specular;
}
-void FixedSpatialMaterial::set_roughness(float p_roughness) {
+void SpatialMaterial::set_roughness(float p_roughness) {
roughness = p_roughness;
VS::get_singleton()->material_set_param(_get_material(), shader_names->roughness, p_roughness);
}
-float FixedSpatialMaterial::get_roughness() const {
+float SpatialMaterial::get_roughness() const {
return roughness;
}
-void FixedSpatialMaterial::set_metalness(float p_metalness) {
+void SpatialMaterial::set_metalness(float p_metalness) {
metalness = p_metalness;
VS::get_singleton()->material_set_param(_get_material(), shader_names->metalness, p_metalness);
}
-float FixedSpatialMaterial::get_metalness() const {
+float SpatialMaterial::get_metalness() const {
return metalness;
}
-void FixedSpatialMaterial::set_emission(const Color &p_emission) {
+void SpatialMaterial::set_emission(const Color &p_emission) {
emission = p_emission;
VS::get_singleton()->material_set_param(_get_material(), shader_names->emission, p_emission);
}
-Color FixedSpatialMaterial::get_emission() const {
+Color SpatialMaterial::get_emission() const {
return emission;
}
-void FixedSpatialMaterial::set_emission_energy(float p_emission_energy) {
+void SpatialMaterial::set_emission_energy(float p_emission_energy) {
emission_energy = p_emission_energy;
VS::get_singleton()->material_set_param(_get_material(), shader_names->emission_energy, p_emission_energy);
}
-float FixedSpatialMaterial::get_emission_energy() const {
+float SpatialMaterial::get_emission_energy() const {
return emission_energy;
}
-void FixedSpatialMaterial::set_normal_scale(float p_normal_scale) {
+void SpatialMaterial::set_normal_scale(float p_normal_scale) {
normal_scale = p_normal_scale;
VS::get_singleton()->material_set_param(_get_material(), shader_names->normal_scale, p_normal_scale);
}
-float FixedSpatialMaterial::get_normal_scale() const {
+float SpatialMaterial::get_normal_scale() const {
return normal_scale;
}
-void FixedSpatialMaterial::set_rim(float p_rim) {
+void SpatialMaterial::set_rim(float p_rim) {
rim = p_rim;
VS::get_singleton()->material_set_param(_get_material(), shader_names->rim, p_rim);
}
-float FixedSpatialMaterial::get_rim() const {
+float SpatialMaterial::get_rim() const {
return rim;
}
-void FixedSpatialMaterial::set_rim_tint(float p_rim_tint) {
+void SpatialMaterial::set_rim_tint(float p_rim_tint) {
rim_tint = p_rim_tint;
VS::get_singleton()->material_set_param(_get_material(), shader_names->rim_tint, p_rim_tint);
}
-float FixedSpatialMaterial::get_rim_tint() const {
+float SpatialMaterial::get_rim_tint() const {
return rim_tint;
}
-void FixedSpatialMaterial::set_clearcoat(float p_clearcoat) {
+void SpatialMaterial::set_clearcoat(float p_clearcoat) {
clearcoat = p_clearcoat;
VS::get_singleton()->material_set_param(_get_material(), shader_names->clearcoat, p_clearcoat);
}
-float FixedSpatialMaterial::get_clearcoat() const {
+float SpatialMaterial::get_clearcoat() const {
return clearcoat;
}
-void FixedSpatialMaterial::set_clearcoat_gloss(float p_clearcoat_gloss) {
+void SpatialMaterial::set_clearcoat_gloss(float p_clearcoat_gloss) {
clearcoat_gloss = p_clearcoat_gloss;
VS::get_singleton()->material_set_param(_get_material(), shader_names->clearcoat_gloss, p_clearcoat_gloss);
}
-float FixedSpatialMaterial::get_clearcoat_gloss() const {
+float SpatialMaterial::get_clearcoat_gloss() const {
return clearcoat_gloss;
}
-void FixedSpatialMaterial::set_anisotropy(float p_anisotropy) {
+void SpatialMaterial::set_anisotropy(float p_anisotropy) {
anisotropy = p_anisotropy;
VS::get_singleton()->material_set_param(_get_material(), shader_names->anisotropy, p_anisotropy);
}
-float FixedSpatialMaterial::get_anisotropy() const {
+float SpatialMaterial::get_anisotropy() const {
return anisotropy;
}
-void FixedSpatialMaterial::set_height_scale(float p_height_scale) {
+void SpatialMaterial::set_height_scale(float p_height_scale) {
height_scale = p_height_scale;
VS::get_singleton()->material_set_param(_get_material(), shader_names->height_scale, p_height_scale);
}
-float FixedSpatialMaterial::get_height_scale() const {
+float SpatialMaterial::get_height_scale() const {
return height_scale;
}
-void FixedSpatialMaterial::set_subsurface_scattering_strength(float p_subsurface_scattering_strength) {
+void SpatialMaterial::set_subsurface_scattering_strength(float p_subsurface_scattering_strength) {
subsurface_scattering_strength = p_subsurface_scattering_strength;
VS::get_singleton()->material_set_param(_get_material(), shader_names->subsurface_scattering_strength, subsurface_scattering_strength);
}
-float FixedSpatialMaterial::get_subsurface_scattering_strength() const {
+float SpatialMaterial::get_subsurface_scattering_strength() const {
return subsurface_scattering_strength;
}
-void FixedSpatialMaterial::set_refraction(float p_refraction) {
+void SpatialMaterial::set_refraction(float p_refraction) {
refraction = p_refraction;
VS::get_singleton()->material_set_param(_get_material(), shader_names->refraction, refraction);
}
-float FixedSpatialMaterial::get_refraction() const {
+float SpatialMaterial::get_refraction() const {
return refraction;
}
-void FixedSpatialMaterial::set_refraction_roughness(float p_refraction_roughness) {
+void SpatialMaterial::set_refraction_roughness(float p_refraction_roughness) {
refraction_roughness = p_refraction_roughness;
VS::get_singleton()->material_set_param(_get_material(), shader_names->refraction_roughness, refraction_roughness);
}
-float FixedSpatialMaterial::get_refraction_roughness() const {
+float SpatialMaterial::get_refraction_roughness() const {
return refraction_roughness;
}
-void FixedSpatialMaterial::set_detail_uv(DetailUV p_detail_uv) {
+void SpatialMaterial::set_detail_uv(DetailUV p_detail_uv) {
if (detail_uv == p_detail_uv)
return;
@@ -575,12 +755,12 @@ void FixedSpatialMaterial::set_detail_uv(DetailUV p_detail_uv) {
detail_uv = p_detail_uv;
_queue_shader_change();
}
-FixedSpatialMaterial::DetailUV FixedSpatialMaterial::get_detail_uv() const {
+SpatialMaterial::DetailUV SpatialMaterial::get_detail_uv() const {
return detail_uv;
}
-void FixedSpatialMaterial::set_blend_mode(BlendMode p_mode) {
+void SpatialMaterial::set_blend_mode(BlendMode p_mode) {
if (blend_mode == p_mode)
return;
@@ -588,22 +768,22 @@ void FixedSpatialMaterial::set_blend_mode(BlendMode p_mode) {
blend_mode = p_mode;
_queue_shader_change();
}
-FixedSpatialMaterial::BlendMode FixedSpatialMaterial::get_blend_mode() const {
+SpatialMaterial::BlendMode SpatialMaterial::get_blend_mode() const {
return blend_mode;
}
-void FixedSpatialMaterial::set_detail_blend_mode(BlendMode p_mode) {
+void SpatialMaterial::set_detail_blend_mode(BlendMode p_mode) {
detail_blend_mode = p_mode;
_queue_shader_change();
}
-FixedSpatialMaterial::BlendMode FixedSpatialMaterial::get_detail_blend_mode() const {
+SpatialMaterial::BlendMode SpatialMaterial::get_detail_blend_mode() const {
return detail_blend_mode;
}
-void FixedSpatialMaterial::set_depth_draw_mode(DepthDrawMode p_mode) {
+void SpatialMaterial::set_depth_draw_mode(DepthDrawMode p_mode) {
if (depth_draw_mode == p_mode)
return;
@@ -611,12 +791,12 @@ void FixedSpatialMaterial::set_depth_draw_mode(DepthDrawMode p_mode) {
depth_draw_mode = p_mode;
_queue_shader_change();
}
-FixedSpatialMaterial::DepthDrawMode FixedSpatialMaterial::get_depth_draw_mode() const {
+SpatialMaterial::DepthDrawMode SpatialMaterial::get_depth_draw_mode() const {
return depth_draw_mode;
}
-void FixedSpatialMaterial::set_cull_mode(CullMode p_mode) {
+void SpatialMaterial::set_cull_mode(CullMode p_mode) {
if (cull_mode == p_mode)
return;
@@ -624,12 +804,12 @@ void FixedSpatialMaterial::set_cull_mode(CullMode p_mode) {
cull_mode = p_mode;
_queue_shader_change();
}
-FixedSpatialMaterial::CullMode FixedSpatialMaterial::get_cull_mode() const {
+SpatialMaterial::CullMode SpatialMaterial::get_cull_mode() const {
return cull_mode;
}
-void FixedSpatialMaterial::set_diffuse_mode(DiffuseMode p_mode) {
+void SpatialMaterial::set_diffuse_mode(DiffuseMode p_mode) {
if (diffuse_mode == p_mode)
return;
@@ -637,12 +817,12 @@ void FixedSpatialMaterial::set_diffuse_mode(DiffuseMode p_mode) {
diffuse_mode = p_mode;
_queue_shader_change();
}
-FixedSpatialMaterial::DiffuseMode FixedSpatialMaterial::get_diffuse_mode() const {
+SpatialMaterial::DiffuseMode SpatialMaterial::get_diffuse_mode() const {
return diffuse_mode;
}
-void FixedSpatialMaterial::set_flag(Flags p_flag, bool p_enabled) {
+void SpatialMaterial::set_flag(Flags p_flag, bool p_enabled) {
ERR_FAIL_INDEX(p_flag, FLAG_MAX);
@@ -653,13 +833,13 @@ void FixedSpatialMaterial::set_flag(Flags p_flag, bool p_enabled) {
_queue_shader_change();
}
-bool FixedSpatialMaterial::get_flag(Flags p_flag) const {
+bool SpatialMaterial::get_flag(Flags p_flag) const {
ERR_FAIL_INDEX_V(p_flag, FLAG_MAX, false);
return flags[p_flag];
}
-void FixedSpatialMaterial::set_feature(Feature p_feature, bool p_enabled) {
+void SpatialMaterial::set_feature(Feature p_feature, bool p_enabled) {
ERR_FAIL_INDEX(p_feature, FEATURE_MAX);
if (features[p_feature] == p_enabled)
@@ -670,13 +850,13 @@ void FixedSpatialMaterial::set_feature(Feature p_feature, bool p_enabled) {
_queue_shader_change();
}
-bool FixedSpatialMaterial::get_feature(Feature p_feature) const {
+bool SpatialMaterial::get_feature(Feature p_feature) const {
ERR_FAIL_INDEX_V(p_feature, FEATURE_MAX, false);
return features[p_feature];
}
-void FixedSpatialMaterial::set_texture(TextureParam p_param, const Ref<Texture> &p_texture) {
+void SpatialMaterial::set_texture(TextureParam p_param, const Ref<Texture> &p_texture) {
ERR_FAIL_INDEX(p_param, TEXTURE_MAX);
textures[p_param] = p_texture;
@@ -684,19 +864,19 @@ void FixedSpatialMaterial::set_texture(TextureParam p_param, const Ref<Texture>
VS::get_singleton()->material_set_param(_get_material(), shader_names->texture_names[p_param], rid);
}
-Ref<Texture> FixedSpatialMaterial::get_texture(TextureParam p_param) const {
+Ref<Texture> SpatialMaterial::get_texture(TextureParam p_param) const {
ERR_FAIL_INDEX_V(p_param, TEXTURE_MAX, Ref<Texture>());
return textures[p_param];
}
-void FixedSpatialMaterial::_validate_feature(const String &text, Feature feature, PropertyInfo &property) const {
+void SpatialMaterial::_validate_feature(const String &text, Feature feature, PropertyInfo &property) const {
if (property.name.begins_with(text) && property.name != text + "_enabled" && !features[feature]) {
property.usage = 0;
}
}
-void FixedSpatialMaterial::_validate_property(PropertyInfo &property) const {
+void SpatialMaterial::_validate_property(PropertyInfo &property) const {
_validate_feature("normal", FEATURE_NORMAL_MAPPING, property);
_validate_feature("emission", FEATURE_EMISSION, property);
_validate_feature("rim", FEATURE_RIM, property);
@@ -714,187 +894,253 @@ void FixedSpatialMaterial::_validate_property(PropertyInfo &property) const {
if (property.name == "specular/metalness" && specular_mode == SPECULAR_MODE_SPECULAR) {
property.usage = 0;
}
+
+ if (property.name.begins_with("particles_anim_") && billboard_mode != BILLBOARD_PARTICLES) {
+ property.usage = 0;
+ }
}
-void FixedSpatialMaterial::set_line_width(float p_line_width) {
+void SpatialMaterial::set_line_width(float p_line_width) {
line_width = p_line_width;
VS::get_singleton()->material_set_line_width(_get_material(), line_width);
}
-float FixedSpatialMaterial::get_line_width() const {
+float SpatialMaterial::get_line_width() const {
return line_width;
}
-void FixedSpatialMaterial::set_point_size(float p_point_size) {
+void SpatialMaterial::set_point_size(float p_point_size) {
point_size = p_point_size;
VS::get_singleton()->material_set_param(_get_material(), shader_names->point_size, p_point_size);
}
-float FixedSpatialMaterial::get_point_size() const {
+float SpatialMaterial::get_point_size() const {
return point_size;
}
-void FixedSpatialMaterial::set_uv1_scale(const Vector2 &p_scale) {
+void SpatialMaterial::set_uv1_scale(const Vector2 &p_scale) {
uv1_scale = p_scale;
VS::get_singleton()->material_set_param(_get_material(), shader_names->uv1_scale, p_scale);
}
-Vector2 FixedSpatialMaterial::get_uv1_scale() const {
+Vector2 SpatialMaterial::get_uv1_scale() const {
return uv1_scale;
}
-void FixedSpatialMaterial::set_uv1_offset(const Vector2 &p_offset) {
+void SpatialMaterial::set_uv1_offset(const Vector2 &p_offset) {
uv1_offset = p_offset;
VS::get_singleton()->material_set_param(_get_material(), shader_names->uv1_offset, p_offset);
}
-Vector2 FixedSpatialMaterial::get_uv1_offset() const {
+Vector2 SpatialMaterial::get_uv1_offset() const {
return uv1_offset;
}
-void FixedSpatialMaterial::set_uv2_scale(const Vector2 &p_scale) {
+void SpatialMaterial::set_uv2_scale(const Vector2 &p_scale) {
uv2_scale = p_scale;
VS::get_singleton()->material_set_param(_get_material(), shader_names->uv2_scale, p_scale);
}
-Vector2 FixedSpatialMaterial::get_uv2_scale() const {
+Vector2 SpatialMaterial::get_uv2_scale() const {
return uv2_scale;
}
-void FixedSpatialMaterial::set_uv2_offset(const Vector2 &p_offset) {
+void SpatialMaterial::set_uv2_offset(const Vector2 &p_offset) {
uv2_offset = p_offset;
VS::get_singleton()->material_set_param(_get_material(), shader_names->uv2_offset, p_offset);
}
-Vector2 FixedSpatialMaterial::get_uv2_offset() const {
+Vector2 SpatialMaterial::get_uv2_offset() const {
return uv2_offset;
}
-void FixedSpatialMaterial::_bind_methods() {
+void SpatialMaterial::set_billboard_mode(BillboardMode p_mode) {
+
+ billboard_mode = p_mode;
+ _queue_shader_change();
+ _change_notify();
+}
+
+SpatialMaterial::BillboardMode SpatialMaterial::get_billboard_mode() const {
+
+ return billboard_mode;
+}
+
+void SpatialMaterial::set_particles_anim_h_frames(int p_frames) {
+
+ particles_anim_h_frames = p_frames;
+ VS::get_singleton()->material_set_param(_get_material(), shader_names->particle_h_frames, p_frames);
+}
+
+int SpatialMaterial::get_particles_anim_h_frames() const {
+
+ return particles_anim_h_frames;
+}
+void SpatialMaterial::set_particles_anim_v_frames(int p_frames) {
+
+ particles_anim_v_frames = p_frames;
+ VS::get_singleton()->material_set_param(_get_material(), shader_names->particle_v_frames, p_frames);
+}
+
+int SpatialMaterial::get_particles_anim_v_frames() const {
- ClassDB::bind_method(D_METHOD("set_albedo", "albedo"), &FixedSpatialMaterial::set_albedo);
- ClassDB::bind_method(D_METHOD("get_albedo"), &FixedSpatialMaterial::get_albedo);
+ return particles_anim_v_frames;
+}
- ClassDB::bind_method(D_METHOD("set_specular_mode", "specular_mode"), &FixedSpatialMaterial::set_specular_mode);
- ClassDB::bind_method(D_METHOD("get_specular_mode"), &FixedSpatialMaterial::get_specular_mode);
+void SpatialMaterial::set_particles_anim_loop(int p_frames) {
- ClassDB::bind_method(D_METHOD("set_specular", "specular"), &FixedSpatialMaterial::set_specular);
- ClassDB::bind_method(D_METHOD("get_specular"), &FixedSpatialMaterial::get_specular);
+ particles_anim_loop = p_frames;
+ VS::get_singleton()->material_set_param(_get_material(), shader_names->particles_anim_loop, p_frames);
+}
- ClassDB::bind_method(D_METHOD("set_metalness", "metalness"), &FixedSpatialMaterial::set_metalness);
- ClassDB::bind_method(D_METHOD("get_metalness"), &FixedSpatialMaterial::get_metalness);
+int SpatialMaterial::get_particles_anim_loop() const {
- ClassDB::bind_method(D_METHOD("set_roughness", "roughness"), &FixedSpatialMaterial::set_roughness);
- ClassDB::bind_method(D_METHOD("get_roughness"), &FixedSpatialMaterial::get_roughness);
+ return particles_anim_loop;
+}
- ClassDB::bind_method(D_METHOD("set_emission", "emission"), &FixedSpatialMaterial::set_emission);
- ClassDB::bind_method(D_METHOD("get_emission"), &FixedSpatialMaterial::get_emission);
+void SpatialMaterial::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_emission_energy", "emission_energy"), &FixedSpatialMaterial::set_emission_energy);
- ClassDB::bind_method(D_METHOD("get_emission_energy"), &FixedSpatialMaterial::get_emission_energy);
+ ClassDB::bind_method(D_METHOD("set_albedo", "albedo"), &SpatialMaterial::set_albedo);
+ ClassDB::bind_method(D_METHOD("get_albedo"), &SpatialMaterial::get_albedo);
- ClassDB::bind_method(D_METHOD("set_normal_scale", "normal_scale"), &FixedSpatialMaterial::set_normal_scale);
- ClassDB::bind_method(D_METHOD("get_normal_scale"), &FixedSpatialMaterial::get_normal_scale);
+ ClassDB::bind_method(D_METHOD("set_specular_mode", "specular_mode"), &SpatialMaterial::set_specular_mode);
+ ClassDB::bind_method(D_METHOD("get_specular_mode"), &SpatialMaterial::get_specular_mode);
- ClassDB::bind_method(D_METHOD("set_rim", "rim"), &FixedSpatialMaterial::set_rim);
- ClassDB::bind_method(D_METHOD("get_rim"), &FixedSpatialMaterial::get_rim);
+ ClassDB::bind_method(D_METHOD("set_specular", "specular"), &SpatialMaterial::set_specular);
+ ClassDB::bind_method(D_METHOD("get_specular"), &SpatialMaterial::get_specular);
- ClassDB::bind_method(D_METHOD("set_rim_tint", "rim_tint"), &FixedSpatialMaterial::set_rim_tint);
- ClassDB::bind_method(D_METHOD("get_rim_tint"), &FixedSpatialMaterial::get_rim_tint);
+ ClassDB::bind_method(D_METHOD("set_metalness", "metalness"), &SpatialMaterial::set_metalness);
+ ClassDB::bind_method(D_METHOD("get_metalness"), &SpatialMaterial::get_metalness);
- ClassDB::bind_method(D_METHOD("set_clearcoat", "clearcoat"), &FixedSpatialMaterial::set_clearcoat);
- ClassDB::bind_method(D_METHOD("get_clearcoat"), &FixedSpatialMaterial::get_clearcoat);
+ ClassDB::bind_method(D_METHOD("set_roughness", "roughness"), &SpatialMaterial::set_roughness);
+ ClassDB::bind_method(D_METHOD("get_roughness"), &SpatialMaterial::get_roughness);
- ClassDB::bind_method(D_METHOD("set_clearcoat_gloss", "clearcoat_gloss"), &FixedSpatialMaterial::set_clearcoat_gloss);
- ClassDB::bind_method(D_METHOD("get_clearcoat_gloss"), &FixedSpatialMaterial::get_clearcoat_gloss);
+ ClassDB::bind_method(D_METHOD("set_emission", "emission"), &SpatialMaterial::set_emission);
+ ClassDB::bind_method(D_METHOD("get_emission"), &SpatialMaterial::get_emission);
- ClassDB::bind_method(D_METHOD("set_anisotropy", "anisotropy"), &FixedSpatialMaterial::set_anisotropy);
- ClassDB::bind_method(D_METHOD("get_anisotropy"), &FixedSpatialMaterial::get_anisotropy);
+ ClassDB::bind_method(D_METHOD("set_emission_energy", "emission_energy"), &SpatialMaterial::set_emission_energy);
+ ClassDB::bind_method(D_METHOD("get_emission_energy"), &SpatialMaterial::get_emission_energy);
- ClassDB::bind_method(D_METHOD("set_height_scale", "height_scale"), &FixedSpatialMaterial::set_height_scale);
- ClassDB::bind_method(D_METHOD("get_height_scale"), &FixedSpatialMaterial::get_height_scale);
+ ClassDB::bind_method(D_METHOD("set_normal_scale", "normal_scale"), &SpatialMaterial::set_normal_scale);
+ ClassDB::bind_method(D_METHOD("get_normal_scale"), &SpatialMaterial::get_normal_scale);
- ClassDB::bind_method(D_METHOD("set_subsurface_scattering_strength", "strength"), &FixedSpatialMaterial::set_subsurface_scattering_strength);
- ClassDB::bind_method(D_METHOD("get_subsurface_scattering_strength"), &FixedSpatialMaterial::get_subsurface_scattering_strength);
+ ClassDB::bind_method(D_METHOD("set_rim", "rim"), &SpatialMaterial::set_rim);
+ ClassDB::bind_method(D_METHOD("get_rim"), &SpatialMaterial::get_rim);
- ClassDB::bind_method(D_METHOD("set_refraction", "refraction"), &FixedSpatialMaterial::set_refraction);
- ClassDB::bind_method(D_METHOD("get_refraction"), &FixedSpatialMaterial::get_refraction);
+ ClassDB::bind_method(D_METHOD("set_rim_tint", "rim_tint"), &SpatialMaterial::set_rim_tint);
+ ClassDB::bind_method(D_METHOD("get_rim_tint"), &SpatialMaterial::get_rim_tint);
- ClassDB::bind_method(D_METHOD("set_refraction_roughness", "refraction_roughness"), &FixedSpatialMaterial::set_refraction_roughness);
- ClassDB::bind_method(D_METHOD("get_refraction_roughness"), &FixedSpatialMaterial::get_refraction_roughness);
+ ClassDB::bind_method(D_METHOD("set_clearcoat", "clearcoat"), &SpatialMaterial::set_clearcoat);
+ ClassDB::bind_method(D_METHOD("get_clearcoat"), &SpatialMaterial::get_clearcoat);
- ClassDB::bind_method(D_METHOD("set_line_width", "line_width"), &FixedSpatialMaterial::set_line_width);
- ClassDB::bind_method(D_METHOD("get_line_width"), &FixedSpatialMaterial::get_line_width);
+ ClassDB::bind_method(D_METHOD("set_clearcoat_gloss", "clearcoat_gloss"), &SpatialMaterial::set_clearcoat_gloss);
+ ClassDB::bind_method(D_METHOD("get_clearcoat_gloss"), &SpatialMaterial::get_clearcoat_gloss);
- ClassDB::bind_method(D_METHOD("set_point_size", "point_size"), &FixedSpatialMaterial::set_point_size);
- ClassDB::bind_method(D_METHOD("get_point_size"), &FixedSpatialMaterial::get_point_size);
+ ClassDB::bind_method(D_METHOD("set_anisotropy", "anisotropy"), &SpatialMaterial::set_anisotropy);
+ ClassDB::bind_method(D_METHOD("get_anisotropy"), &SpatialMaterial::get_anisotropy);
- ClassDB::bind_method(D_METHOD("set_detail_uv", "detail_uv"), &FixedSpatialMaterial::set_detail_uv);
- ClassDB::bind_method(D_METHOD("get_detail_uv"), &FixedSpatialMaterial::get_detail_uv);
+ ClassDB::bind_method(D_METHOD("set_height_scale", "height_scale"), &SpatialMaterial::set_height_scale);
+ ClassDB::bind_method(D_METHOD("get_height_scale"), &SpatialMaterial::get_height_scale);
- ClassDB::bind_method(D_METHOD("set_blend_mode", "blend_mode"), &FixedSpatialMaterial::set_blend_mode);
- ClassDB::bind_method(D_METHOD("get_blend_mode"), &FixedSpatialMaterial::get_blend_mode);
+ ClassDB::bind_method(D_METHOD("set_subsurface_scattering_strength", "strength"), &SpatialMaterial::set_subsurface_scattering_strength);
+ ClassDB::bind_method(D_METHOD("get_subsurface_scattering_strength"), &SpatialMaterial::get_subsurface_scattering_strength);
- ClassDB::bind_method(D_METHOD("set_depth_draw_mode", "depth_draw_mode"), &FixedSpatialMaterial::set_depth_draw_mode);
- ClassDB::bind_method(D_METHOD("get_depth_draw_mode"), &FixedSpatialMaterial::get_depth_draw_mode);
+ ClassDB::bind_method(D_METHOD("set_refraction", "refraction"), &SpatialMaterial::set_refraction);
+ ClassDB::bind_method(D_METHOD("get_refraction"), &SpatialMaterial::get_refraction);
- ClassDB::bind_method(D_METHOD("set_cull_mode", "cull_mode"), &FixedSpatialMaterial::set_cull_mode);
- ClassDB::bind_method(D_METHOD("get_cull_mode"), &FixedSpatialMaterial::get_cull_mode);
+ ClassDB::bind_method(D_METHOD("set_refraction_roughness", "refraction_roughness"), &SpatialMaterial::set_refraction_roughness);
+ ClassDB::bind_method(D_METHOD("get_refraction_roughness"), &SpatialMaterial::get_refraction_roughness);
- ClassDB::bind_method(D_METHOD("set_diffuse_mode", "diffuse_mode"), &FixedSpatialMaterial::set_diffuse_mode);
- ClassDB::bind_method(D_METHOD("get_diffuse_mode"), &FixedSpatialMaterial::get_diffuse_mode);
+ ClassDB::bind_method(D_METHOD("set_line_width", "line_width"), &SpatialMaterial::set_line_width);
+ ClassDB::bind_method(D_METHOD("get_line_width"), &SpatialMaterial::get_line_width);
- ClassDB::bind_method(D_METHOD("set_flag", "flag", "enable"), &FixedSpatialMaterial::set_flag);
- ClassDB::bind_method(D_METHOD("get_flag"), &FixedSpatialMaterial::get_flag);
+ ClassDB::bind_method(D_METHOD("set_point_size", "point_size"), &SpatialMaterial::set_point_size);
+ ClassDB::bind_method(D_METHOD("get_point_size"), &SpatialMaterial::get_point_size);
- ClassDB::bind_method(D_METHOD("set_feature", "feature", "enable"), &FixedSpatialMaterial::set_feature);
- ClassDB::bind_method(D_METHOD("get_feature", "feature"), &FixedSpatialMaterial::get_feature);
+ ClassDB::bind_method(D_METHOD("set_detail_uv", "detail_uv"), &SpatialMaterial::set_detail_uv);
+ ClassDB::bind_method(D_METHOD("get_detail_uv"), &SpatialMaterial::get_detail_uv);
- ClassDB::bind_method(D_METHOD("set_texture", "param:Texture", "texture"), &FixedSpatialMaterial::set_texture);
- ClassDB::bind_method(D_METHOD("get_texture:Texture", "param:Texture"), &FixedSpatialMaterial::get_texture);
+ ClassDB::bind_method(D_METHOD("set_blend_mode", "blend_mode"), &SpatialMaterial::set_blend_mode);
+ ClassDB::bind_method(D_METHOD("get_blend_mode"), &SpatialMaterial::get_blend_mode);
- ClassDB::bind_method(D_METHOD("set_detail_blend_mode", "detail_blend_mode"), &FixedSpatialMaterial::set_detail_blend_mode);
- ClassDB::bind_method(D_METHOD("get_detail_blend_mode"), &FixedSpatialMaterial::get_detail_blend_mode);
+ ClassDB::bind_method(D_METHOD("set_depth_draw_mode", "depth_draw_mode"), &SpatialMaterial::set_depth_draw_mode);
+ ClassDB::bind_method(D_METHOD("get_depth_draw_mode"), &SpatialMaterial::get_depth_draw_mode);
- ClassDB::bind_method(D_METHOD("set_uv1_scale", "scale"), &FixedSpatialMaterial::set_uv1_scale);
- ClassDB::bind_method(D_METHOD("get_uv1_scale"), &FixedSpatialMaterial::get_uv1_scale);
+ ClassDB::bind_method(D_METHOD("set_cull_mode", "cull_mode"), &SpatialMaterial::set_cull_mode);
+ ClassDB::bind_method(D_METHOD("get_cull_mode"), &SpatialMaterial::get_cull_mode);
- ClassDB::bind_method(D_METHOD("set_uv1_offset", "offset"), &FixedSpatialMaterial::set_uv1_offset);
- ClassDB::bind_method(D_METHOD("get_uv1_offset"), &FixedSpatialMaterial::get_uv1_offset);
+ ClassDB::bind_method(D_METHOD("set_diffuse_mode", "diffuse_mode"), &SpatialMaterial::set_diffuse_mode);
+ ClassDB::bind_method(D_METHOD("get_diffuse_mode"), &SpatialMaterial::get_diffuse_mode);
- ClassDB::bind_method(D_METHOD("set_uv2_scale", "scale"), &FixedSpatialMaterial::set_uv2_scale);
- ClassDB::bind_method(D_METHOD("get_uv2_scale"), &FixedSpatialMaterial::get_uv2_scale);
+ ClassDB::bind_method(D_METHOD("set_flag", "flag", "enable"), &SpatialMaterial::set_flag);
+ ClassDB::bind_method(D_METHOD("get_flag"), &SpatialMaterial::get_flag);
- ClassDB::bind_method(D_METHOD("set_uv2_offset", "offset"), &FixedSpatialMaterial::set_uv2_offset);
- ClassDB::bind_method(D_METHOD("get_uv2_offset"), &FixedSpatialMaterial::get_uv2_offset);
+ ClassDB::bind_method(D_METHOD("set_feature", "feature", "enable"), &SpatialMaterial::set_feature);
+ ClassDB::bind_method(D_METHOD("get_feature", "feature"), &SpatialMaterial::get_feature);
+
+ ClassDB::bind_method(D_METHOD("set_texture", "param:Texture", "texture"), &SpatialMaterial::set_texture);
+ ClassDB::bind_method(D_METHOD("get_texture:Texture", "param:Texture"), &SpatialMaterial::get_texture);
+
+ ClassDB::bind_method(D_METHOD("set_detail_blend_mode", "detail_blend_mode"), &SpatialMaterial::set_detail_blend_mode);
+ ClassDB::bind_method(D_METHOD("get_detail_blend_mode"), &SpatialMaterial::get_detail_blend_mode);
+
+ ClassDB::bind_method(D_METHOD("set_uv1_scale", "scale"), &SpatialMaterial::set_uv1_scale);
+ ClassDB::bind_method(D_METHOD("get_uv1_scale"), &SpatialMaterial::get_uv1_scale);
+
+ ClassDB::bind_method(D_METHOD("set_uv1_offset", "offset"), &SpatialMaterial::set_uv1_offset);
+ ClassDB::bind_method(D_METHOD("get_uv1_offset"), &SpatialMaterial::get_uv1_offset);
+
+ ClassDB::bind_method(D_METHOD("set_uv2_scale", "scale"), &SpatialMaterial::set_uv2_scale);
+ ClassDB::bind_method(D_METHOD("get_uv2_scale"), &SpatialMaterial::get_uv2_scale);
+
+ ClassDB::bind_method(D_METHOD("set_uv2_offset", "offset"), &SpatialMaterial::set_uv2_offset);
+ ClassDB::bind_method(D_METHOD("get_uv2_offset"), &SpatialMaterial::get_uv2_offset);
+
+ ClassDB::bind_method(D_METHOD("set_billboard_mode", "mode"), &SpatialMaterial::set_billboard_mode);
+ ClassDB::bind_method(D_METHOD("get_billboard_mode"), &SpatialMaterial::get_billboard_mode);
+
+ ClassDB::bind_method(D_METHOD("set_particles_anim_h_frames", "frames"), &SpatialMaterial::set_particles_anim_h_frames);
+ ClassDB::bind_method(D_METHOD("get_particles_anim_h_frames"), &SpatialMaterial::get_particles_anim_h_frames);
+
+ ClassDB::bind_method(D_METHOD("set_particles_anim_v_frames", "frames"), &SpatialMaterial::set_particles_anim_v_frames);
+ ClassDB::bind_method(D_METHOD("get_particles_anim_v_frames"), &SpatialMaterial::get_particles_anim_v_frames);
+
+ ClassDB::bind_method(D_METHOD("set_particles_anim_loop", "frames"), &SpatialMaterial::set_particles_anim_loop);
+ ClassDB::bind_method(D_METHOD("get_particles_anim_loop"), &SpatialMaterial::get_particles_anim_loop);
ADD_GROUP("Flags", "flags_");
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "flags_transparent"), "set_feature", "get_feature", FEATURE_TRANSPARENT);
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "flags_unshaded"), "set_flag", "get_flag", FLAG_UNSHADED);
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "flags_on_top"), "set_flag", "get_flag", FLAG_ONTOP);
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "flags_use_point_size"), "set_flag", "get_flag", FLAG_USE_POINT_SIZE);
+ ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "flags_fixed_size"), "set_flag", "get_flag", FLAG_FIXED_SIZE);
ADD_GROUP("Vertex Color", "vertex_color");
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "vertex_color_use_as_albedo"), "set_flag", "get_flag", FLAG_ALBEDO_FROM_VERTEX_COLOR);
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "vertex_color_is_srgb"), "set_flag", "get_flag", FLAG_SRGB_VERTEX_COLOR);
ADD_GROUP("Parameters", "params_");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "params_diffuse_mode", PROPERTY_HINT_ENUM, "Labert,Lambert Wrap,Oren Nayar,Burley"), "set_diffuse_mode", "get_diffuse_mode");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "params_diffuse_mode", PROPERTY_HINT_ENUM, "Lambert,Lambert Wrap,Oren Nayar,Burley"), "set_diffuse_mode", "get_diffuse_mode");
ADD_PROPERTY(PropertyInfo(Variant::INT, "params_blend_mode", PROPERTY_HINT_ENUM, "Mix,Add,Sub,Mul"), "set_blend_mode", "get_blend_mode");
ADD_PROPERTY(PropertyInfo(Variant::INT, "params_cull_mode", PROPERTY_HINT_ENUM, "Back,Front,Disabled"), "set_cull_mode", "get_cull_mode");
ADD_PROPERTY(PropertyInfo(Variant::INT, "params_depth_draw_mode", PROPERTY_HINT_ENUM, "Opaque Only,Always,Never,Opaque Pre-Pass"), "set_depth_draw_mode", "get_depth_draw_mode");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "params_line_width", PROPERTY_HINT_RANGE, "0.1,128,0.1"), "set_line_width", "get_line_width");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "params_point_size", PROPERTY_HINT_RANGE, "0.1,128,0.1"), "set_point_size", "get_point_size");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "params_billboard_mode", PROPERTY_HINT_ENUM, "Disabled,Enabled,Y-Billboard,Particle Billboard"), "set_billboard_mode", "get_billboard_mode");
+ ADD_GROUP("Particles Anim", "particles_anim_");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "particles_anim_h_frames", PROPERTY_HINT_RANGE, "1,128,1"), "set_particles_anim_h_frames", "get_particles_anim_h_frames");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "particles_anim_v_frames", PROPERTY_HINT_RANGE, "1,128,1"), "set_particles_anim_v_frames", "get_particles_anim_v_frames");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "particles_anim_loop"), "set_particles_anim_loop", "get_particles_anim_loop");
ADD_GROUP("Albedo", "albedo_");
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "albedo_color"), "set_albedo", "get_albedo");
@@ -913,7 +1159,7 @@ void FixedSpatialMaterial::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::REAL, "emission_energy", PROPERTY_HINT_RANGE, "0,16,0.01"), "set_emission_energy", "get_emission_energy");
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "emission_texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), "set_texture", "get_texture", TEXTURE_EMISSION);
- ADD_GROUP("NormapMap", "normal_");
+ ADD_GROUP("NormalMap", "normal_");
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "normal_enabled"), "set_feature", "get_feature", FEATURE_NORMAL_MAPPING);
ADD_PROPERTY(PropertyInfo(Variant::REAL, "normal_scale", PROPERTY_HINT_RANGE, "-16,16,0.01"), "set_normal_scale", "get_normal_scale");
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "normal_texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), "set_texture", "get_texture", TEXTURE_NORMAL);
@@ -1023,6 +1269,7 @@ void FixedSpatialMaterial::_bind_methods() {
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_MAX);
BIND_CONSTANT(DIFFUSE_LAMBERT);
@@ -1032,9 +1279,14 @@ void FixedSpatialMaterial::_bind_methods() {
BIND_CONSTANT(SPECULAR_MODE_METALLIC);
BIND_CONSTANT(SPECULAR_MODE_SPECULAR);
+
+ BIND_CONSTANT(BILLBOARD_DISABLED);
+ BIND_CONSTANT(BILLBOARD_ENABLED);
+ BIND_CONSTANT(BILLBOARD_FIXED_Y);
+ BIND_CONSTANT(BILLBOARD_PARTICLES);
}
-FixedSpatialMaterial::FixedSpatialMaterial()
+SpatialMaterial::SpatialMaterial()
: element(this) {
//initialize to right values
@@ -1061,6 +1313,10 @@ FixedSpatialMaterial::FixedSpatialMaterial()
set_uv1_scale(Vector2(1, 1));
set_uv2_offset(Vector2(0, 0));
set_uv2_scale(Vector2(1, 1));
+ set_billboard_mode(BILLBOARD_DISABLED);
+ set_particles_anim_h_frames(1);
+ set_particles_anim_v_frames(1);
+ set_particles_anim_loop(false);
detail_uv = DETAIL_UV_1;
blend_mode = BLEND_MODE_MIX;
@@ -1081,7 +1337,7 @@ FixedSpatialMaterial::FixedSpatialMaterial()
_queue_shader_change();
}
-FixedSpatialMaterial::~FixedSpatialMaterial() {
+SpatialMaterial::~SpatialMaterial() {
if (material_mutex)
material_mutex->lock();
diff --git a/scene/resources/material.h b/scene/resources/material.h
index a8288153c3..408815d756 100644
--- a/scene/resources/material.h
+++ b/scene/resources/material.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -56,9 +57,34 @@ public:
virtual ~Material();
};
-class FixedSpatialMaterial : public Material {
+class ShaderMaterial : public Material {
- GDCLASS(FixedSpatialMaterial, Material)
+ GDCLASS(ShaderMaterial, Material);
+ Ref<Shader> shader;
+
+protected:
+ bool _set(const StringName &p_name, const Variant &p_value);
+ bool _get(const StringName &p_name, Variant &r_ret) const;
+ void _get_property_list(List<PropertyInfo> *p_list) const;
+
+ static void _bind_methods();
+
+ void get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const;
+
+public:
+ void set_shader(const Ref<Shader> &p_shader);
+ Ref<Shader> get_shader() const;
+
+ void set_shader_param(const StringName &p_param, const Variant &p_value);
+ Variant get_shader_param(const StringName &p_param) const;
+
+ ShaderMaterial();
+ ~ShaderMaterial();
+};
+
+class SpatialMaterial : public Material {
+
+ GDCLASS(SpatialMaterial, Material)
public:
enum TextureParam {
@@ -128,6 +154,7 @@ public:
FLAG_ALBEDO_FROM_VERTEX_COLOR,
FLAG_SRGB_VERTEX_COLOR,
FLAG_USE_POINT_SIZE,
+ FLAG_FIXED_SIZE,
FLAG_MAX
};
@@ -143,20 +170,28 @@ public:
SPECULAR_MODE_SPECULAR,
};
+ enum BillboardMode {
+ BILLBOARD_DISABLED,
+ BILLBOARD_ENABLED,
+ BILLBOARD_FIXED_Y,
+ BILLBOARD_PARTICLES,
+ };
+
private:
union MaterialKey {
struct {
- uint32_t feature_mask : 14;
+ uint32_t feature_mask : 11;
uint32_t detail_uv : 1;
uint32_t blend_mode : 2;
uint32_t depth_draw_mode : 2;
uint32_t cull_mode : 2;
- uint32_t flags : 5;
+ uint32_t flags : 6;
uint32_t detail_blend_mode : 2;
uint32_t diffuse_mode : 2;
uint32_t invalid_key : 1;
uint32_t specular_mode : 1;
+ uint32_t billboard_mode : 2;
};
uint32_t key;
@@ -196,6 +231,7 @@ private:
mk.detail_blend_mode = detail_blend_mode;
mk.diffuse_mode = diffuse_mode;
mk.specular_mode = specular_mode;
+ mk.billboard_mode = billboard_mode;
return mk;
}
@@ -222,14 +258,17 @@ private:
StringName uv1_offset;
StringName uv2_scale;
StringName uv2_offset;
+ StringName particle_h_frames;
+ StringName particle_v_frames;
+ StringName particles_anim_loop;
StringName texture_names[TEXTURE_MAX];
};
static Mutex *material_mutex;
- static SelfList<FixedSpatialMaterial>::List dirty_materials;
+ static SelfList<SpatialMaterial>::List dirty_materials;
static ShaderNames *shader_names;
- SelfList<FixedSpatialMaterial> element;
+ SelfList<SpatialMaterial> element;
void _update_shader();
_FORCE_INLINE_ void _queue_shader_change();
@@ -253,6 +292,9 @@ private:
float refraction_roughness;
float line_width;
float point_size;
+ int particles_anim_h_frames;
+ int particles_anim_v_frames;
+ bool particles_anim_loop;
Vector2 uv1_scale;
Vector2 uv1_offset;
@@ -269,6 +311,7 @@ private:
bool flags[FLAG_MAX];
DiffuseMode diffuse_mode;
SpecularMode specular_mode;
+ BillboardMode billboard_mode;
bool features[FEATURE_MAX];
@@ -377,23 +420,35 @@ public:
void set_uv2_offset(const Vector2 &p_offset);
Vector2 get_uv2_offset() const;
+ void set_billboard_mode(BillboardMode p_mode);
+ BillboardMode get_billboard_mode() const;
+
+ void set_particles_anim_h_frames(int p_frames);
+ int get_particles_anim_h_frames() const;
+ void set_particles_anim_v_frames(int p_frames);
+ int get_particles_anim_v_frames() const;
+
+ void set_particles_anim_loop(int p_frames);
+ int get_particles_anim_loop() const;
+
static void init_shaders();
static void finish_shaders();
static void flush_changes();
- FixedSpatialMaterial();
- virtual ~FixedSpatialMaterial();
+ SpatialMaterial();
+ virtual ~SpatialMaterial();
};
-VARIANT_ENUM_CAST(FixedSpatialMaterial::TextureParam)
-VARIANT_ENUM_CAST(FixedSpatialMaterial::DetailUV)
-VARIANT_ENUM_CAST(FixedSpatialMaterial::Feature)
-VARIANT_ENUM_CAST(FixedSpatialMaterial::BlendMode)
-VARIANT_ENUM_CAST(FixedSpatialMaterial::DepthDrawMode)
-VARIANT_ENUM_CAST(FixedSpatialMaterial::CullMode)
-VARIANT_ENUM_CAST(FixedSpatialMaterial::Flags)
-VARIANT_ENUM_CAST(FixedSpatialMaterial::DiffuseMode)
-VARIANT_ENUM_CAST(FixedSpatialMaterial::SpecularMode)
+VARIANT_ENUM_CAST(SpatialMaterial::TextureParam)
+VARIANT_ENUM_CAST(SpatialMaterial::DetailUV)
+VARIANT_ENUM_CAST(SpatialMaterial::Feature)
+VARIANT_ENUM_CAST(SpatialMaterial::BlendMode)
+VARIANT_ENUM_CAST(SpatialMaterial::DepthDrawMode)
+VARIANT_ENUM_CAST(SpatialMaterial::CullMode)
+VARIANT_ENUM_CAST(SpatialMaterial::Flags)
+VARIANT_ENUM_CAST(SpatialMaterial::DiffuseMode)
+VARIANT_ENUM_CAST(SpatialMaterial::SpecularMode)
+VARIANT_ENUM_CAST(SpatialMaterial::BillboardMode)
//////////////////////
diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp
index f951cf1620..ab3e143e60 100644
--- a/scene/resources/mesh.cpp
+++ b/scene/resources/mesh.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -192,6 +193,9 @@ bool Mesh::_set(const StringName &p_name, const Variant &p_value) {
bool Mesh::_get(const StringName &p_name, Variant &r_ret) const {
+ if (_is_generated())
+ return false;
+
String sname = p_name;
if (p_name == "blend_shape/names") {
@@ -268,6 +272,9 @@ bool Mesh::_get(const StringName &p_name, Variant &r_ret) const {
void Mesh::_get_property_list(List<PropertyInfo> *p_list) const {
+ if (_is_generated())
+ return;
+
if (blend_shapes.size()) {
p_list->push_back(PropertyInfo(Variant::POOL_STRING_ARRAY, "blend_shape/names", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR));
p_list->push_back(PropertyInfo(Variant::INT, "blend_shape/mode", PROPERTY_HINT_ENUM, "Normalized,Relative"));
@@ -1025,3 +1032,71 @@ Mesh::~Mesh() {
VisualServer::get_singleton()->free(mesh);
}
+
+////////////////////////
+
+void QuadMesh::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("set_material", "material:Material"), &QuadMesh::set_material);
+ ClassDB::bind_method(D_METHOD("get_material:Material"), &QuadMesh::get_material);
+
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "Material"), "set_material", "get_material");
+}
+
+void QuadMesh::set_material(const Ref<Material> &p_material) {
+
+ surface_set_material(0, p_material);
+}
+
+Ref<Material> QuadMesh::get_material() const {
+
+ return surface_get_material(0);
+}
+
+QuadMesh::QuadMesh() {
+
+ PoolVector<Vector3> faces;
+ PoolVector<Vector3> normals;
+ PoolVector<float> tangents;
+ PoolVector<Vector2> uvs;
+
+ faces.resize(4);
+ normals.resize(4);
+ tangents.resize(4 * 4);
+ uvs.resize(4);
+
+ for (int i = 0; i < 4; i++) {
+
+ static const Vector3 quad_faces[4] = {
+ Vector3(-1, -1, 0),
+ Vector3(-1, 1, 0),
+ Vector3(1, 1, 0),
+ Vector3(1, -1, 0),
+ };
+
+ faces.set(i, quad_faces[i]);
+ normals.set(i, Vector3(0, 0, 1));
+ tangents.set(i * 4 + 0, 1.0);
+ tangents.set(i * 4 + 1, 0.0);
+ tangents.set(i * 4 + 2, 0.0);
+ tangents.set(i * 4 + 3, 1.0);
+
+ static const Vector2 quad_uv[4] = {
+ Vector2(0, 1),
+ Vector2(0, 0),
+ Vector2(1, 0),
+ Vector2(1, 1),
+ };
+
+ uvs.set(i, quad_uv[i]);
+ }
+
+ Array arr;
+ arr.resize(ARRAY_MAX);
+ arr[ARRAY_VERTEX] = faces;
+ arr[ARRAY_NORMAL] = normals;
+ arr[ARRAY_TANGENT] = tangents;
+ arr[ARRAY_TEX_UV] = uvs;
+
+ add_surface_from_arrays(PRIMITIVE_TRIANGLE_FAN, arr);
+}
diff --git a/scene/resources/mesh.h b/scene/resources/mesh.h
index 8b1936ed06..e441b4924a 100644
--- a/scene/resources/mesh.h
+++ b/scene/resources/mesh.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -128,6 +129,8 @@ private:
void _recompute_aabb();
protected:
+ virtual bool _is_generated() const { return false; }
+
bool _set(const StringName &p_name, const Variant &p_value);
bool _get(const StringName &p_name, Variant &r_ret) const;
void _get_property_list(List<PropertyInfo> *p_list) const;
@@ -189,6 +192,20 @@ public:
~Mesh();
};
+class QuadMesh : public Mesh {
+
+ GDCLASS(QuadMesh, Mesh)
+
+protected:
+ virtual bool _is_generated() const { return true; }
+ static void _bind_methods();
+
+public:
+ void set_material(const Ref<Material> &p_material);
+ Ref<Material> get_material() const;
+ QuadMesh();
+};
+
VARIANT_ENUM_CAST(Mesh::ArrayType);
VARIANT_ENUM_CAST(Mesh::PrimitiveType);
VARIANT_ENUM_CAST(Mesh::BlendShapeMode);
diff --git a/scene/resources/mesh_data_tool.cpp b/scene/resources/mesh_data_tool.cpp
index fcc1f80d25..b6b47bf443 100644
--- a/scene/resources/mesh_data_tool.cpp
+++ b/scene/resources/mesh_data_tool.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/mesh_data_tool.h b/scene/resources/mesh_data_tool.h
index 14318a9f82..f6797d3e5e 100644
--- a/scene/resources/mesh_data_tool.h
+++ b/scene/resources/mesh_data_tool.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/mesh_library.cpp b/scene/resources/mesh_library.cpp
index 92ca921f25..22e5659e72 100644
--- a/scene/resources/mesh_library.cpp
+++ b/scene/resources/mesh_library.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/mesh_library.h b/scene/resources/mesh_library.h
index 5f4a695c56..a381f54a19 100644
--- a/scene/resources/mesh_library.h
+++ b/scene/resources/mesh_library.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/multimesh.cpp b/scene/resources/multimesh.cpp
index 6202109cd1..d32f221fd9 100644
--- a/scene/resources/multimesh.cpp
+++ b/scene/resources/multimesh.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/multimesh.h b/scene/resources/multimesh.h
index 1ecf76142a..4a00685b9f 100644
--- a/scene/resources/multimesh.h
+++ b/scene/resources/multimesh.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp
index 76c6543a2f..50fbb6a162 100644
--- a/scene/resources/packed_scene.cpp
+++ b/scene/resources/packed_scene.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -533,7 +534,7 @@ Error SceneState::_parse_node(Node *p_owner, Node *p_node, int p_parent_idx, Map
if (E->get().usage & PROPERTY_USAGE_NO_INSTANCE_STATE || E->get().name == "__meta__") {
//property has requested that no instance state is saved, sorry
- //also, meta won't be overriden or saved
+ //also, meta won't be overridden or saved
continue;
}
@@ -1774,7 +1775,7 @@ void PackedScene::set_path(const String &p_path, bool p_take_over) {
void PackedScene::_bind_methods() {
ClassDB::bind_method(D_METHOD("pack", "path:Node"), &PackedScene::pack);
- ClassDB::bind_method(D_METHOD("instance:Node", "edit_state"), &PackedScene::instance, DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("instance:Node", "edit_state"), &PackedScene::instance, DEFVAL(GEN_EDIT_STATE_DISABLED));
ClassDB::bind_method(D_METHOD("can_instance"), &PackedScene::can_instance);
ClassDB::bind_method(D_METHOD("_set_bundled_scene"), &PackedScene::_set_bundled_scene);
ClassDB::bind_method(D_METHOD("_get_bundled_scene"), &PackedScene::_get_bundled_scene);
diff --git a/scene/resources/packed_scene.h b/scene/resources/packed_scene.h
index fe451884f5..2f18f5c263 100644
--- a/scene/resources/packed_scene.h
+++ b/scene/resources/packed_scene.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/plane_shape.cpp b/scene/resources/plane_shape.cpp
index e3535b1a63..d3ad454afc 100644
--- a/scene/resources/plane_shape.cpp
+++ b/scene/resources/plane_shape.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/plane_shape.h b/scene/resources/plane_shape.h
index 899aad7e01..2ed297a97e 100644
--- a/scene/resources/plane_shape.h
+++ b/scene/resources/plane_shape.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/polygon_path_finder.cpp b/scene/resources/polygon_path_finder.cpp
index 44ef828d02..472031366f 100644
--- a/scene/resources/polygon_path_finder.cpp
+++ b/scene/resources/polygon_path_finder.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/polygon_path_finder.h b/scene/resources/polygon_path_finder.h
index cd2fea87d4..2d2fb1678e 100644
--- a/scene/resources/polygon_path_finder.h
+++ b/scene/resources/polygon_path_finder.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/ray_shape.cpp b/scene/resources/ray_shape.cpp
index 8187b8b3f1..3abb2a4fa1 100644
--- a/scene/resources/ray_shape.cpp
+++ b/scene/resources/ray_shape.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/ray_shape.h b/scene/resources/ray_shape.h
index f8dbf89e04..5a17e9414e 100644
--- a/scene/resources/ray_shape.h
+++ b/scene/resources/ray_shape.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/rectangle_shape_2d.cpp b/scene/resources/rectangle_shape_2d.cpp
index 06b5ac0316..bd9ec8cbc4 100644
--- a/scene/resources/rectangle_shape_2d.cpp
+++ b/scene/resources/rectangle_shape_2d.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/rectangle_shape_2d.h b/scene/resources/rectangle_shape_2d.h
index 8de2f7580e..23db58ba07 100644
--- a/scene/resources/rectangle_shape_2d.h
+++ b/scene/resources/rectangle_shape_2d.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/room.cpp b/scene/resources/room.cpp
index 9ec8914e2f..c89b7c72c7 100644
--- a/scene/resources/room.cpp
+++ b/scene/resources/room.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/room.h b/scene/resources/room.h
index c7db4b13d9..1bcdec5eb0 100644
--- a/scene/resources/room.h
+++ b/scene/resources/room.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/scene_format_text.cpp b/scene/resources/scene_format_text.cpp
index 7162c9fc18..f62fa93e04 100644
--- a/scene/resources/scene_format_text.cpp
+++ b/scene/resources/scene_format_text.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/scene_format_text.h b/scene/resources/scene_format_text.h
index 99e7de6232..a7e78d62fe 100644
--- a/scene/resources/scene_format_text.h
+++ b/scene/resources/scene_format_text.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/segment_shape_2d.cpp b/scene/resources/segment_shape_2d.cpp
index 7a1114f895..145374ff05 100644
--- a/scene/resources/segment_shape_2d.cpp
+++ b/scene/resources/segment_shape_2d.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/segment_shape_2d.h b/scene/resources/segment_shape_2d.h
index e58ce6be60..22fc1ab6e3 100644
--- a/scene/resources/segment_shape_2d.h
+++ b/scene/resources/segment_shape_2d.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/shader.cpp b/scene/resources/shader.cpp
index fd058a4a6f..fafe68188b 100644
--- a/scene/resources/shader.cpp
+++ b/scene/resources/shader.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -29,6 +30,7 @@
#include "shader.h"
#include "os/file_access.h"
#include "scene/scene_string_names.h"
+#include "servers/visual/shader_language.h"
#include "servers/visual_server.h"
#include "texture.h"
@@ -39,6 +41,18 @@ Shader::Mode Shader::get_mode() const {
void Shader::set_code(const String &p_code) {
+ String type = ShaderLanguage::get_shader_type(p_code);
+
+ print_line("mode: " + type);
+
+ if (type == "canvas_item") {
+ mode = MODE_CANVAS_ITEM;
+ } else if (type == "particles") {
+ mode = MODE_PARTICLES;
+ } else {
+ mode = MODE_SPATIAL;
+ }
+
VisualServer::get_singleton()->shader_set_code(shader, p_code);
params_cache_dirty = true;
emit_signal(SceneStringNames::get_singleton()->changed);
@@ -128,10 +142,10 @@ void Shader::_bind_methods() {
BIND_CONSTANT(MODE_PARTICLES);
}
-Shader::Shader(Mode p_mode) {
+Shader::Shader() {
- mode = p_mode;
- shader = VisualServer::get_singleton()->shader_create(VS::ShaderMode(p_mode));
+ mode = MODE_SPATIAL;
+ shader = VisualServer::get_singleton()->shader_create();
params_cache_dirty = true;
}
diff --git a/scene/resources/shader.h b/scene/resources/shader.h
index b7fa349dfe..0e8e48d82e 100644
--- a/scene/resources/shader.h
+++ b/scene/resources/shader.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -54,7 +55,7 @@ private:
// hack the name of performance
// shaders keep a list of ShaderMaterial -> VisualServer name translations, to make
- // convertion fast and save memory.
+ // conversion fast and save memory.
mutable bool params_cache_dirty;
mutable Map<StringName, StringName> params_cache; //map a shader param to a material param..
Map<StringName, Ref<Texture> > default_textures;
@@ -88,37 +89,10 @@ public:
virtual RID get_rid() const;
- Shader(Mode p_mode);
+ Shader();
~Shader();
};
VARIANT_ENUM_CAST(Shader::Mode);
-class SpatialShader : public Shader {
-
- GDCLASS(SpatialShader, Shader);
-
-public:
- SpatialShader()
- : Shader(MODE_SPATIAL){};
-};
-
-class CanvasItemShader : public Shader {
-
- GDCLASS(CanvasItemShader, Shader);
-
-public:
- CanvasItemShader()
- : Shader(MODE_CANVAS_ITEM){};
-};
-
-class ParticlesShader : public Shader {
-
- GDCLASS(ParticlesShader, Shader);
-
-public:
- ParticlesShader()
- : Shader(MODE_PARTICLES){};
-};
-
#endif // SHADER_H
diff --git a/scene/resources/shader_graph.cpp b/scene/resources/shader_graph.cpp
index 28b8490cb4..61dc9185a0 100644
--- a/scene/resources/shader_graph.cpp
+++ b/scene/resources/shader_graph.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/shader_graph.h b/scene/resources/shader_graph.h
index 190d76fce6..b9ec294eb8 100644
--- a/scene/resources/shader_graph.h
+++ b/scene/resources/shader_graph.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/shape.cpp b/scene/resources/shape.cpp
index c666ff0cd3..b449932b17 100644
--- a/scene/resources/shape.cpp
+++ b/scene/resources/shape.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/shape.h b/scene/resources/shape.h
index 8a8ecf1228..01b8db650e 100644
--- a/scene/resources/shape.h
+++ b/scene/resources/shape.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/shape_2d.cpp b/scene/resources/shape_2d.cpp
index 497110c6f9..f1a00336fa 100644
--- a/scene/resources/shape_2d.cpp
+++ b/scene/resources/shape_2d.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/shape_2d.h b/scene/resources/shape_2d.h
index afae74c385..a752b8dbe2 100644
--- a/scene/resources/shape_2d.h
+++ b/scene/resources/shape_2d.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/shape_line_2d.cpp b/scene/resources/shape_line_2d.cpp
index 777dbead52..89c1cea252 100644
--- a/scene/resources/shape_line_2d.cpp
+++ b/scene/resources/shape_line_2d.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/shape_line_2d.h b/scene/resources/shape_line_2d.h
index cd62504d81..3e59bbc687 100644
--- a/scene/resources/shape_line_2d.h
+++ b/scene/resources/shape_line_2d.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/sky_box.cpp b/scene/resources/sky_box.cpp
index cb3b1cf60d..241675569f 100644
--- a/scene/resources/sky_box.cpp
+++ b/scene/resources/sky_box.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/sky_box.h b/scene/resources/sky_box.h
index 23ba077df3..f748ac1e2d 100644
--- a/scene/resources/sky_box.h
+++ b/scene/resources/sky_box.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/space_2d.cpp b/scene/resources/space_2d.cpp
index d0a18b98bd..2a618bb868 100644
--- a/scene/resources/space_2d.cpp
+++ b/scene/resources/space_2d.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/space_2d.h b/scene/resources/space_2d.h
index b6c2607b13..3e08612d99 100644
--- a/scene/resources/space_2d.h
+++ b/scene/resources/space_2d.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/sphere_shape.cpp b/scene/resources/sphere_shape.cpp
index c242e748a4..960554562f 100644
--- a/scene/resources/sphere_shape.cpp
+++ b/scene/resources/sphere_shape.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/sphere_shape.h b/scene/resources/sphere_shape.h
index 576c59ee7d..a3b5d2424b 100644
--- a/scene/resources/sphere_shape.h
+++ b/scene/resources/sphere_shape.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/style_box.cpp b/scene/resources/style_box.cpp
index 7a503207bc..13529c8572 100644
--- a/scene/resources/style_box.cpp
+++ b/scene/resources/style_box.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -103,9 +104,11 @@ void StyleBoxTexture::set_texture(RES p_texture) {
if (texture == p_texture)
return;
texture = p_texture;
+ region_rect = Rect2(Point2(), texture->get_size());
emit_signal("texture_changed");
emit_changed();
}
+
RES StyleBoxTexture::get_texture() const {
return texture;
@@ -130,12 +133,17 @@ void StyleBoxTexture::draw(RID p_canvas_item, const Rect2 &p_rect) const {
if (texture.is_null())
return;
- Rect2 r = p_rect;
- r.pos.x -= expand_margin[MARGIN_LEFT];
- r.pos.y -= expand_margin[MARGIN_TOP];
- r.size.x += expand_margin[MARGIN_LEFT] + expand_margin[MARGIN_RIGHT];
- r.size.y += expand_margin[MARGIN_TOP] + expand_margin[MARGIN_BOTTOM];
- VisualServer::get_singleton()->canvas_item_add_nine_patch(p_canvas_item, r, region_rect, texture->get_rid(), Vector2(margin[MARGIN_LEFT], margin[MARGIN_TOP]), Vector2(margin[MARGIN_RIGHT], margin[MARGIN_BOTTOM]), VS::NINE_PATCH_STRETCH, VS::NINE_PATCH_STRETCH, draw_center, modulate);
+ Rect2 rect = p_rect;
+ Rect2 src_rect = region_rect;
+
+ texture->get_rect_region(rect, src_rect, rect, src_rect);
+
+ rect.pos.x -= expand_margin[MARGIN_LEFT];
+ rect.pos.y -= expand_margin[MARGIN_TOP];
+ rect.size.x += expand_margin[MARGIN_LEFT] + expand_margin[MARGIN_RIGHT];
+ rect.size.y += expand_margin[MARGIN_TOP] + expand_margin[MARGIN_BOTTOM];
+
+ VisualServer::get_singleton()->canvas_item_add_nine_patch(p_canvas_item, rect, src_rect, texture->get_rid(), Vector2(margin[MARGIN_LEFT], margin[MARGIN_TOP]), Vector2(margin[MARGIN_RIGHT], margin[MARGIN_BOTTOM]), VS::NINE_PATCH_STRETCH, VS::NINE_PATCH_STRETCH, draw_center, modulate);
}
void StyleBoxTexture::set_draw_center(bool p_draw) {
diff --git a/scene/resources/style_box.h b/scene/resources/style_box.h
index f0107ed71f..e14a536879 100644
--- a/scene/resources/style_box.h
+++ b/scene/resources/style_box.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/surface_tool.cpp b/scene/resources/surface_tool.cpp
index 7564735cf2..4c36d79a7a 100644
--- a/scene/resources/surface_tool.cpp
+++ b/scene/resources/surface_tool.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/surface_tool.h b/scene/resources/surface_tool.h
index 542c21e7b8..6e52db218d 100644
--- a/scene/resources/surface_tool.h
+++ b/scene/resources/surface_tool.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp
index f979c5c758..f0ac30a76e 100644
--- a/scene/resources/texture.cpp
+++ b/scene/resources/texture.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -458,25 +459,27 @@ Error StreamTexture::_load_data(const String &p_path, int &tw, int &th, int &fla
flags = f->get_32(); //texture flags!
uint32_t df = f->get_32(); //data format
+ /*
print_line("width: " + itos(tw));
print_line("height: " + itos(th));
print_line("flags: " + itos(flags));
print_line("df: " + itos(df));
+ */
if (request_3d_callback && df & FORMAT_BIT_DETECT_3D) {
- print_line("request detect 3D at " + p_path);
+ //print_line("request detect 3D at " + p_path);
VS::get_singleton()->texture_set_detect_3d_callback(texture, _requested_3d, this);
} else {
- print_line("not requesting detect 3D at " + p_path);
+ //print_line("not requesting detect 3D at " + p_path);
VS::get_singleton()->texture_set_detect_3d_callback(texture, NULL, NULL);
}
if (request_srgb_callback && df & FORMAT_BIT_DETECT_SRGB) {
- print_line("request detect srgb at " + p_path);
+ //print_line("request detect srgb at " + p_path);
VS::get_singleton()->texture_set_detect_srgb_callback(texture, _requested_srgb, this);
} else {
+ //print_line("not requesting detect srgb at " + p_path);
VS::get_singleton()->texture_set_detect_srgb_callback(texture, NULL, NULL);
- print_line("not requesting detect srgb at " + p_path);
}
if (!(df & FORMAT_BIT_STREAM)) {
@@ -492,7 +495,7 @@ Error StreamTexture::_load_data(const String &p_path, int &tw, int &th, int &fla
uint32_t mipmaps = f->get_32();
uint32_t size = f->get_32();
- print_line("mipmaps: " + itos(mipmaps));
+ //print_line("mipmaps: " + itos(mipmaps));
while (mipmaps > 1 && p_size_limit > 0 && (sw > p_size_limit || sh > p_size_limit)) {
@@ -538,7 +541,7 @@ Error StreamTexture::_load_data(const String &p_path, int &tw, int &th, int &fla
mipmap_images.push_back(img);
}
- print_line("mipmap read total: " + itos(mipmap_images.size()));
+ //print_line("mipmap read total: " + itos(mipmap_images.size()));
memdelete(f); //no longer needed
@@ -625,7 +628,7 @@ Error StreamTexture::_load_data(const String &p_path, int &tw, int &th, int &fla
{
PoolVector<uint8_t>::Write w = img_data.write();
int bytes = f->get_buffer(w.ptr(), total_size - ofs);
- print_line("requested read: " + itos(total_size - ofs) + " but got: " + itos(bytes));
+ //print_line("requested read: " + itos(total_size - ofs) + " but got: " + itos(bytes));
memdelete(f);
@@ -918,7 +921,7 @@ void AtlasTexture::draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile
}
void AtlasTexture::draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate, bool p_transpose) const {
- //this might not necesarily work well if using a rect, needs to be fixed properly
+ //this might not necessarily work well if using a rect, needs to be fixed properly
Rect2 rc = region;
if (!atlas.is_valid())
@@ -1367,3 +1370,471 @@ CubeMap::~CubeMap() {
BIND_CONSTANT( CUBEMAP_FRONT );
BIND_CONSTANT( CUBEMAP_BACK );
*/
+///////////////////////////
+
+void CurveTexture::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("set_max", "max"), &CurveTexture::set_max);
+ ClassDB::bind_method(D_METHOD("get_max"), &CurveTexture::get_max);
+
+ ClassDB::bind_method(D_METHOD("set_min", "min"), &CurveTexture::set_min);
+ ClassDB::bind_method(D_METHOD("get_min"), &CurveTexture::get_min);
+
+ ClassDB::bind_method(D_METHOD("set_width", "width"), &CurveTexture::set_width);
+
+ ClassDB::bind_method(D_METHOD("set_points", "points"), &CurveTexture::set_points);
+ ClassDB::bind_method(D_METHOD("get_points"), &CurveTexture::get_points);
+
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "min", PROPERTY_HINT_RANGE, "-1024,1024"), "set_min", "get_min");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "max", PROPERTY_HINT_RANGE, "-1024,1024"), "set_max", "get_max");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "width", PROPERTY_HINT_RANGE, "32,4096"), "set_width", "get_width");
+ ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR2_ARRAY, "points"), "set_points", "get_points");
+}
+void CurveTexture::set_max(float p_max) {
+
+ max = p_max;
+ emit_changed();
+}
+float CurveTexture::get_max() const {
+
+ return max;
+}
+
+void CurveTexture::set_min(float p_min) {
+
+ min = p_min;
+ emit_changed();
+}
+float CurveTexture::get_min() const {
+
+ return min;
+}
+void CurveTexture::set_width(int p_width) {
+
+ ERR_FAIL_COND(p_width < 32 || p_width > 4096);
+ width = p_width;
+ if (points.size())
+ set_points(points);
+}
+int CurveTexture::get_width() const {
+
+ return width;
+}
+
+static void _plot_curve(const Vector2 &p_a, const Vector2 &p_b, const Vector2 &p_c, const Vector2 &p_d, float *p_heights, bool *p_useds, int p_width, float p_min, float p_max) {
+
+ float geometry[4][4];
+ float tmp1[4][4];
+ float tmp2[4][4];
+ float deltas[4][4];
+ double x, dx, dx2, dx3;
+ double y, dy, dy2, dy3;
+ double d, d2, d3;
+ int lastx;
+ int newx;
+ float lasty;
+ float newy;
+ int ntimes;
+ int i, j;
+
+ int xmax = p_width;
+
+ /* construct the geometry matrix from the segment */
+ for (i = 0; i < 4; i++) {
+ geometry[i][2] = 0;
+ geometry[i][3] = 0;
+ }
+
+ geometry[0][0] = (p_a[0] * xmax);
+ geometry[1][0] = (p_b[0] * xmax);
+ geometry[2][0] = (p_c[0] * xmax);
+ geometry[3][0] = (p_d[0] * xmax);
+
+ geometry[0][1] = (p_a[1]);
+ geometry[1][1] = (p_b[1]);
+ geometry[2][1] = (p_c[1]);
+ geometry[3][1] = (p_d[1]);
+
+ /* subdivide the curve ntimes (1000) times */
+ ntimes = 4 * xmax;
+ /* ntimes can be adjusted to give a finer or coarser curve */
+ d = 1.0 / ntimes;
+ d2 = d * d;
+ d3 = d * d * d;
+
+ /* construct a temporary matrix for determining the forward differencing deltas */
+ tmp2[0][0] = 0;
+ tmp2[0][1] = 0;
+ tmp2[0][2] = 0;
+ tmp2[0][3] = 1;
+ tmp2[1][0] = d3;
+ tmp2[1][1] = d2;
+ tmp2[1][2] = d;
+ tmp2[1][3] = 0;
+ tmp2[2][0] = 6 * d3;
+ tmp2[2][1] = 2 * d2;
+ tmp2[2][2] = 0;
+ tmp2[2][3] = 0;
+ tmp2[3][0] = 6 * d3;
+ tmp2[3][1] = 0;
+ tmp2[3][2] = 0;
+ tmp2[3][3] = 0;
+
+ /* compose the basis and geometry matrices */
+
+ static const float CR_basis[4][4] = {
+ { -0.5, 1.5, -1.5, 0.5 },
+ { 1.0, -2.5, 2.0, -0.5 },
+ { -0.5, 0.0, 0.5, 0.0 },
+ { 0.0, 1.0, 0.0, 0.0 },
+ };
+
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 4; j++) {
+ tmp1[i][j] = (CR_basis[i][0] * geometry[0][j] +
+ CR_basis[i][1] * geometry[1][j] +
+ CR_basis[i][2] * geometry[2][j] +
+ CR_basis[i][3] * geometry[3][j]);
+ }
+ }
+ /* compose the above results to get the deltas matrix */
+
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 4; j++) {
+ deltas[i][j] = (tmp2[i][0] * tmp1[0][j] +
+ tmp2[i][1] * tmp1[1][j] +
+ tmp2[i][2] * tmp1[2][j] +
+ tmp2[i][3] * tmp1[3][j]);
+ }
+ }
+
+ /* extract the x deltas */
+ x = deltas[0][0];
+ dx = deltas[1][0];
+ dx2 = deltas[2][0];
+ dx3 = deltas[3][0];
+
+ /* extract the y deltas */
+ y = deltas[0][1];
+ dy = deltas[1][1];
+ dy2 = deltas[2][1];
+ dy3 = deltas[3][1];
+
+ lastx = CLAMP(x, 0, xmax);
+ lasty = y;
+
+ p_heights[lastx] = lasty;
+ p_useds[lastx] = true;
+
+ /* loop over the curve */
+ for (i = 0; i < ntimes; i++) {
+ /* increment the x values */
+ x += dx;
+ dx += dx2;
+ dx2 += dx3;
+
+ /* increment the y values */
+ y += dy;
+ dy += dy2;
+ dy2 += dy3;
+
+ newx = CLAMP((Math::round(x)), 0, xmax);
+ newy = CLAMP(y, p_min, p_max);
+
+ /* if this point is different than the last one...then draw it */
+ if ((lastx != newx) || (lasty != newy)) {
+ p_useds[newx] = true;
+ p_heights[newx] = newy;
+ }
+
+ lastx = newx;
+ lasty = newy;
+ }
+}
+
+void CurveTexture::set_points(const PoolVector<Vector2> &p_points) {
+
+ points = p_points;
+
+ PoolVector<uint8_t> data;
+ PoolVector<bool> used;
+ data.resize(width * sizeof(float));
+ used.resize(width);
+ {
+ PoolVector<uint8_t>::Write wd8 = data.write();
+ float *wd = (float *)wd8.ptr();
+ PoolVector<bool>::Write wu = used.write();
+ int pc = p_points.size();
+ PoolVector<Vector2>::Read pr = p_points.read();
+
+ for (int i = 0; i < width; i++) {
+ wd[i] = 0.0;
+ wu[i] = false;
+ }
+
+ Vector2 prev = Vector2(0, 0);
+ Vector2 prev2 = Vector2(0, 0);
+
+ for (int i = -1; i < pc; i++) {
+
+ Vector2 next;
+ Vector2 next2;
+ if (i + 1 >= pc) {
+ next = Vector2(1, 0);
+ } else {
+ next = Vector2(pr[i + 1].x, pr[i + 1].y);
+ }
+
+ if (i + 2 >= pc) {
+ next2 = Vector2(1, 0);
+ } else {
+ next2 = Vector2(pr[i + 2].x, pr[i + 2].y);
+ }
+
+ /*if (i==-1 && prev.offset==next.offset) {
+ prev=next;
+ continue;
+ }*/
+
+ _plot_curve(prev2, prev, next, next2, wd, wu.ptr(), width, min, max);
+
+ prev2 = prev;
+ prev = next;
+ }
+ }
+
+ Image image(width, 1, false, Image::FORMAT_RF, data);
+
+ VS::get_singleton()->texture_allocate(texture, width, 1, Image::FORMAT_RF, VS::TEXTURE_FLAG_FILTER);
+ VS::get_singleton()->texture_set_data(texture, image);
+
+ emit_changed();
+}
+
+PoolVector<Vector2> CurveTexture::get_points() const {
+
+ return points;
+}
+
+RID CurveTexture::get_rid() const {
+
+ return texture;
+}
+
+CurveTexture::CurveTexture() {
+
+ max = 1;
+ min = 0;
+ width = 2048;
+ texture = VS::get_singleton()->texture_create();
+}
+CurveTexture::~CurveTexture() {
+ VS::get_singleton()->free(texture);
+}
+//////////////////
+
+//setter and getter names for property serialization
+#define COLOR_RAMP_GET_OFFSETS "get_offsets"
+#define COLOR_RAMP_GET_COLORS "get_colors"
+#define COLOR_RAMP_SET_OFFSETS "set_offsets"
+#define COLOR_RAMP_SET_COLORS "set_colors"
+
+GradientTexture::GradientTexture() {
+ //Set initial color ramp transition from black to white
+ points.resize(2);
+ points[0].color = Color(0, 0, 0, 1);
+ points[0].offset = 0;
+ points[1].color = Color(1, 1, 1, 1);
+ points[1].offset = 1;
+ is_sorted = true;
+ update_pending = false;
+ width = 2048;
+
+ texture = VS::get_singleton()->texture_create();
+ _queue_update();
+}
+
+GradientTexture::~GradientTexture() {
+ VS::get_singleton()->free(texture);
+}
+
+void GradientTexture::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("add_point", "offset", "color"), &GradientTexture::add_point);
+ ClassDB::bind_method(D_METHOD("remove_point", "offset", "color"), &GradientTexture::remove_point);
+
+ ClassDB::bind_method(D_METHOD("set_offset", "point", "offset"), &GradientTexture::set_offset);
+ ClassDB::bind_method(D_METHOD("get_offset", "point"), &GradientTexture::get_offset);
+
+ ClassDB::bind_method(D_METHOD("set_color", "point", "color"), &GradientTexture::set_color);
+ ClassDB::bind_method(D_METHOD("get_color", "point"), &GradientTexture::get_color);
+
+ ClassDB::bind_method(D_METHOD("set_width", "width"), &GradientTexture::set_width);
+
+ ClassDB::bind_method(D_METHOD("interpolate", "offset"), &GradientTexture::get_color_at_offset);
+
+ ClassDB::bind_method(D_METHOD("get_point_count"), &GradientTexture::get_points_count);
+
+ ClassDB::bind_method(D_METHOD("_update"), &GradientTexture::_update);
+
+ ClassDB::bind_method(D_METHOD(COLOR_RAMP_SET_OFFSETS, "offsets"), &GradientTexture::set_offsets);
+ ClassDB::bind_method(D_METHOD(COLOR_RAMP_GET_OFFSETS), &GradientTexture::get_offsets);
+
+ ClassDB::bind_method(D_METHOD(COLOR_RAMP_SET_COLORS, "colors"), &GradientTexture::set_colors);
+ ClassDB::bind_method(D_METHOD(COLOR_RAMP_GET_COLORS), &GradientTexture::get_colors);
+
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "width"), "set_width", "get_width");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "offsets"), COLOR_RAMP_SET_OFFSETS, COLOR_RAMP_GET_OFFSETS);
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "colors"), COLOR_RAMP_SET_COLORS, COLOR_RAMP_GET_COLORS);
+}
+
+void GradientTexture::_queue_update() {
+
+ if (update_pending)
+ return;
+
+ call_deferred("_update");
+}
+
+void GradientTexture::_update() {
+
+ update_pending = false;
+
+ PoolVector<uint8_t> data;
+ data.resize(width * 4);
+ {
+ PoolVector<uint8_t>::Write wd8 = data.write();
+ for (int i = 0; i < width; i++) {
+ float ofs = float(i) / (width - 1);
+
+ Color color = get_color_at_offset(ofs);
+ wd8[i * 4 + 0] = uint8_t(CLAMP(color.r * 255.0, 0, 255));
+ wd8[i * 4 + 1] = uint8_t(CLAMP(color.g * 255.0, 0, 255));
+ wd8[i * 4 + 2] = uint8_t(CLAMP(color.b * 255.0, 0, 255));
+ wd8[i * 4 + 3] = uint8_t(CLAMP(color.a * 255.0, 0, 255));
+ }
+ }
+
+ Image image(width, 1, false, Image::FORMAT_RGBA8, data);
+
+ VS::get_singleton()->texture_allocate(texture, width, 1, Image::FORMAT_RGBA8, VS::TEXTURE_FLAG_FILTER);
+ VS::get_singleton()->texture_set_data(texture, image);
+
+ emit_changed();
+}
+
+void GradientTexture::set_width(int p_width) {
+
+ width = p_width;
+ _queue_update();
+}
+int GradientTexture::get_width() const {
+
+ return width;
+}
+
+Vector<float> GradientTexture::get_offsets() const {
+ Vector<float> offsets;
+ offsets.resize(points.size());
+ for (int i = 0; i < points.size(); i++) {
+ offsets[i] = points[i].offset;
+ }
+ return offsets;
+}
+
+Vector<Color> GradientTexture::get_colors() const {
+ Vector<Color> colors;
+ colors.resize(points.size());
+ for (int i = 0; i < points.size(); i++) {
+ colors[i] = points[i].color;
+ }
+ return colors;
+}
+
+void GradientTexture::set_offsets(const Vector<float> &p_offsets) {
+ points.resize(p_offsets.size());
+ for (int i = 0; i < points.size(); i++) {
+ points[i].offset = p_offsets[i];
+ }
+ is_sorted = false;
+ emit_changed();
+ _queue_update();
+}
+
+void GradientTexture::set_colors(const Vector<Color> &p_colors) {
+ if (points.size() < p_colors.size())
+ is_sorted = false;
+ points.resize(p_colors.size());
+ for (int i = 0; i < points.size(); i++) {
+ points[i].color = p_colors[i];
+ }
+ emit_changed();
+ _queue_update();
+}
+
+Vector<GradientTexture::Point> &GradientTexture::get_points() {
+ return points;
+}
+
+void GradientTexture::add_point(float p_offset, const Color &p_color) {
+
+ Point p;
+ p.offset = p_offset;
+ p.color = p_color;
+ is_sorted = false;
+ points.push_back(p);
+
+ emit_changed();
+ _queue_update();
+}
+
+void GradientTexture::remove_point(int p_index) {
+
+ ERR_FAIL_INDEX(p_index, points.size());
+ ERR_FAIL_COND(points.size() <= 2);
+ points.remove(p_index);
+ emit_changed();
+ _queue_update();
+}
+
+void GradientTexture::set_points(Vector<GradientTexture::Point> &p_points) {
+ points = p_points;
+ is_sorted = false;
+ emit_changed();
+ _queue_update();
+}
+
+void GradientTexture::set_offset(int pos, const float offset) {
+ if (points.size() <= pos)
+ points.resize(pos + 1);
+ points[pos].offset = offset;
+ is_sorted = false;
+ emit_changed();
+ _queue_update();
+}
+
+float GradientTexture::get_offset(int pos) const {
+ if (points.size() > pos)
+ return points[pos].offset;
+ return 0; //TODO: Maybe throw some error instead?
+}
+
+void GradientTexture::set_color(int pos, const Color &color) {
+ if (points.size() <= pos) {
+ points.resize(pos + 1);
+ is_sorted = false;
+ }
+ points[pos].color = color;
+ emit_changed();
+ _queue_update();
+}
+
+Color GradientTexture::get_color(int pos) const {
+ if (points.size() > pos)
+ return points[pos].color;
+ return Color(0, 0, 0, 1); //TODO: Maybe throw some error instead?
+}
+
+int GradientTexture::get_points_count() const {
+ return points.size();
+}
diff --git a/scene/resources/texture.h b/scene/resources/texture.h
index 0092fee836..a6ea163813 100644
--- a/scene/resources/texture.h
+++ b/scene/resources/texture.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -394,6 +395,44 @@ VARIANT_ENUM_CAST(CubeMap::Flags);
VARIANT_ENUM_CAST(CubeMap::Side);
VARIANT_ENUM_CAST(CubeMap::Storage);
+class CurveTexture : public Texture {
+
+ GDCLASS(CurveTexture, Texture);
+ RES_BASE_EXTENSION("cvtex");
+
+private:
+ RID texture;
+ PoolVector<Vector2> points;
+ float min, max;
+ int width;
+
+protected:
+ static void _bind_methods();
+
+public:
+ void set_max(float p_max);
+ float get_max() const;
+
+ void set_min(float p_min);
+ float get_min() const;
+
+ void set_width(int p_width);
+ int get_width() const;
+
+ void set_points(const PoolVector<Vector2> &p_points);
+ PoolVector<Vector2> get_points() const;
+
+ virtual RID get_rid() const;
+
+ virtual int get_height() const { return 1; }
+ virtual bool has_alpha() const { return false; }
+
+ virtual void set_flags(uint32_t p_flags) {}
+ virtual uint32_t get_flags() const { return FLAG_FILTER; }
+
+ CurveTexture();
+ ~CurveTexture();
+};
/*
enum CubeMapSide {
@@ -408,4 +447,107 @@ VARIANT_ENUM_CAST(CubeMap::Storage);
*/
//VARIANT_ENUM_CAST( Texture::CubeMapSide );
+class GradientTexture : public Texture {
+ GDCLASS(GradientTexture, Texture);
+
+public:
+ struct Point {
+
+ float offset;
+ Color color;
+ bool operator<(const Point &p_ponit) const {
+ return offset < p_ponit.offset;
+ }
+ };
+
+private:
+ Vector<Point> points;
+ bool is_sorted;
+ bool update_pending;
+ RID texture;
+ int width;
+
+ void _queue_update();
+ void _update();
+
+protected:
+ static void _bind_methods();
+
+public:
+ void add_point(float p_offset, const Color &p_color);
+ void remove_point(int p_index);
+
+ void set_points(Vector<Point> &points);
+ Vector<Point> &get_points();
+
+ void set_offset(int pos, const float offset);
+ float get_offset(int pos) const;
+
+ void set_color(int pos, const Color &color);
+ Color get_color(int pos) const;
+
+ void set_offsets(const Vector<float> &offsets);
+ Vector<float> get_offsets() const;
+
+ void set_colors(const Vector<Color> &colors);
+ Vector<Color> get_colors() const;
+
+ void set_width(int p_width);
+ int get_width() const;
+
+ virtual RID get_rid() const { return texture; }
+ virtual int get_height() const { return 1; }
+ virtual bool has_alpha() const { return true; }
+
+ virtual void set_flags(uint32_t p_flags) {}
+ virtual uint32_t get_flags() const { return FLAG_FILTER; }
+
+ _FORCE_INLINE_ Color get_color_at_offset(float p_offset) {
+
+ if (points.empty())
+ return Color(0, 0, 0, 1);
+
+ if (!is_sorted) {
+ points.sort();
+ is_sorted = true;
+ }
+
+ //binary search
+ int low = 0;
+ int high = points.size() - 1;
+ int middle;
+
+ while (low <= high) {
+ middle = (low + high) / 2;
+ Point &point = points[middle];
+ if (point.offset > p_offset) {
+ high = middle - 1; //search low end of array
+ } else if (point.offset < p_offset) {
+ low = middle + 1; //search high end of array
+ } else {
+ return point.color;
+ }
+ }
+
+ //return interpolated value
+ if (points[middle].offset > p_offset) {
+ middle--;
+ }
+ int first = middle;
+ int second = middle + 1;
+ if (second >= points.size())
+ return points[points.size() - 1].color;
+ if (first < 0)
+ return points[0].color;
+ Point &pointFirst = points[first];
+ Point &pointSecond = points[second];
+ return pointFirst.color.linear_interpolate(pointSecond.color, (p_offset - pointFirst.offset) / (pointSecond.offset - pointFirst.offset));
+ }
+
+ int get_points_count() const;
+
+ GradientTexture();
+ virtual ~GradientTexture();
+};
+
#endif
diff --git a/scene/resources/theme.cpp b/scene/resources/theme.cpp
index c1ef3e8c1f..faf9f31b43 100644
--- a/scene/resources/theme.cpp
+++ b/scene/resources/theme.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/theme.h b/scene/resources/theme.h
index 4de6fd78ca..1a5cfcf4b2 100644
--- a/scene/resources/theme.h
+++ b/scene/resources/theme.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp
index 3e128379ae..76bb1daf94 100644
--- a/scene/resources/tile_set.cpp
+++ b/scene/resources/tile_set.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -125,7 +126,7 @@ void TileSet::_get_property_list(List<PropertyInfo> *p_list) const {
p_list->push_back(PropertyInfo(Variant::STRING, pre + "name"));
p_list->push_back(PropertyInfo(Variant::OBJECT, pre + "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture"));
p_list->push_back(PropertyInfo(Variant::VECTOR2, pre + "tex_offset"));
- p_list->push_back(PropertyInfo(Variant::OBJECT, pre + "material", PROPERTY_HINT_RESOURCE_TYPE, "CanvasItemMaterial"));
+ p_list->push_back(PropertyInfo(Variant::OBJECT, pre + "material", PROPERTY_HINT_RESOURCE_TYPE, "ShaderMaterial"));
p_list->push_back(PropertyInfo(Variant::COLOR, pre + "modulate"));
p_list->push_back(PropertyInfo(Variant::RECT2, pre + "region"));
p_list->push_back(PropertyInfo(Variant::VECTOR2, pre + "occluder_offset"));
@@ -159,16 +160,16 @@ Ref<Texture> TileSet::tile_get_texture(int p_id) const {
return tile_map[p_id].texture;
}
-void TileSet::tile_set_material(int p_id, const Ref<CanvasItemMaterial> &p_material) {
+void TileSet::tile_set_material(int p_id, const Ref<ShaderMaterial> &p_material) {
ERR_FAIL_COND(!tile_map.has(p_id));
tile_map[p_id].material = p_material;
emit_changed();
}
-Ref<CanvasItemMaterial> TileSet::tile_get_material(int p_id) const {
+Ref<ShaderMaterial> TileSet::tile_get_material(int p_id) const {
- ERR_FAIL_COND_V(!tile_map.has(p_id), Ref<CanvasItemMaterial>());
+ ERR_FAIL_COND_V(!tile_map.has(p_id), Ref<ShaderMaterial>());
return tile_map[p_id].material;
}
@@ -403,8 +404,8 @@ void TileSet::_bind_methods() {
ClassDB::bind_method(D_METHOD("tile_get_name", "id"), &TileSet::tile_get_name);
ClassDB::bind_method(D_METHOD("tile_set_texture", "id", "texture:Texture"), &TileSet::tile_set_texture);
ClassDB::bind_method(D_METHOD("tile_get_texture:Texture", "id"), &TileSet::tile_get_texture);
- ClassDB::bind_method(D_METHOD("tile_set_material", "id", "material:CanvasItemMaterial"), &TileSet::tile_set_material);
- ClassDB::bind_method(D_METHOD("tile_get_material:CanvasItemMaterial", "id"), &TileSet::tile_get_material);
+ ClassDB::bind_method(D_METHOD("tile_set_material", "id", "material:ShaderMaterial"), &TileSet::tile_set_material);
+ ClassDB::bind_method(D_METHOD("tile_get_material:ShaderMaterial", "id"), &TileSet::tile_get_material);
ClassDB::bind_method(D_METHOD("tile_set_texture_offset", "id", "texture_offset"), &TileSet::tile_set_texture_offset);
ClassDB::bind_method(D_METHOD("tile_get_texture_offset", "id"), &TileSet::tile_get_texture_offset);
ClassDB::bind_method(D_METHOD("tile_set_shape_offset", "id", "shape_offset"), &TileSet::tile_set_shape_offset);
diff --git a/scene/resources/tile_set.h b/scene/resources/tile_set.h
index 53f68d00a5..448444d34a 100644
--- a/scene/resources/tile_set.h
+++ b/scene/resources/tile_set.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -51,7 +52,7 @@ class TileSet : public Resource {
Ref<OccluderPolygon2D> occluder;
Vector2 navigation_polygon_offset;
Ref<NavigationPolygon> navigation_polygon;
- Ref<CanvasItemMaterial> material;
+ Ref<ShaderMaterial> material;
Color modulate;
// Default modulate for back-compat
@@ -92,8 +93,8 @@ public:
void tile_set_shape(int p_id, const Ref<Shape2D> &p_shape);
Ref<Shape2D> tile_get_shape(int p_id) const;
- void tile_set_material(int p_id, const Ref<CanvasItemMaterial> &p_material);
- Ref<CanvasItemMaterial> tile_get_material(int p_id) const;
+ void tile_set_material(int p_id, const Ref<ShaderMaterial> &p_material);
+ Ref<ShaderMaterial> tile_get_material(int p_id) const;
void tile_set_modulate(int p_id, const Color &p_color);
Color tile_get_modulate(int p_id) const;
diff --git a/scene/resources/video_stream.cpp b/scene/resources/video_stream.cpp
index 47c40e4e6b..1b0e34b8db 100644
--- a/scene/resources/video_stream.cpp
+++ b/scene/resources/video_stream.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/video_stream.h b/scene/resources/video_stream.h
index 7c1bd94c8b..544973f581 100644
--- a/scene/resources/video_stream.h
+++ b/scene/resources/video_stream.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/world.cpp b/scene/resources/world.cpp
index dc62c2ab3e..eab7cf6098 100644
--- a/scene/resources/world.cpp
+++ b/scene/resources/world.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/world.h b/scene/resources/world.h
index a597633ca1..f2c85f31f6 100644
--- a/scene/resources/world.h
+++ b/scene/resources/world.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/world_2d.cpp b/scene/resources/world_2d.cpp
index cb346199c9..db72ccd03c 100644
--- a/scene/resources/world_2d.cpp
+++ b/scene/resources/world_2d.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/resources/world_2d.h b/scene/resources/world_2d.h
index 2bb5eb1526..2b6e7e7383 100644
--- a/scene/resources/world_2d.h
+++ b/scene/resources/world_2d.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/scene/scene_string_names.cpp b/scene/scene_string_names.cpp
index f0a33e0d3b..c6277dbbb8 100644
--- a/scene/scene_string_names.cpp
+++ b/scene/scene_string_names.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -32,6 +33,9 @@ SceneStringNames *SceneStringNames::singleton = NULL;
SceneStringNames::SceneStringNames() {
+ _estimate_cost = StaticCString::create("_estimate_cost");
+ _compute_cost = StaticCString::create("_compute_cost");
+
resized = StaticCString::create("resized");
dot = StaticCString::create(".");
doubledot = StaticCString::create("..");
diff --git a/scene/scene_string_names.h b/scene/scene_string_names.h
index 8900bbe1d9..3e4c80d4f7 100644
--- a/scene/scene_string_names.h
+++ b/scene/scene_string_names.h
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -49,6 +50,9 @@ class SceneStringNames {
public:
_FORCE_INLINE_ static SceneStringNames *get_singleton() { return singleton; }
+ StringName _estimate_cost;
+ StringName _compute_cost;
+
StringName resized;
StringName dot;
StringName doubledot;