This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| shader_type spatial; | |
| uniform float pattern_scale = 20; | |
| uniform sampler2D pattern_texture : source_color; | |
| uniform float cutoff: hint_range(0.0, 1.0) = 0.5; | |
| uniform float band_width: hint_range(0.0, 2.0) = 1.0; | |
| // Optionel, pour le screen_uv local | |
| varying flat vec4 NODE_POSITION_CLIP; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extends Node | |
| ## User Interface Manager | |
| ## Add as an autoload | |
| ## | |
| ## Handle switching between gamepad and M+K | |
| ## Automatically gives focus to a hovered button | |
| signal gamepad_changed(enabled: bool) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @tool | |
| extends EditorScenePostImport | |
| ## Import script example | |
| ## | |
| ## GENERAL | |
| ## + Removes the empty root node (if any) | |
| ## | |
| ## COLLISIONS: | |
| ## + Append '-static' to the node name to mark it as a static body |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## Returns the first child node of a given class. | |
| ## If deep_search is true, search the whole tree below this node. | |
| static func find_child_with_class(root: Node, type: Variant, deep_search: bool = false) -> Node: | |
| if not is_instance_valid(root): | |
| return null | |
| if is_instance_of(root, type): | |
| return root | |
| var candidates: Array[Node] = root.get_children() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extends Node | |
| ## Automatically plays a sound on button click and hover | |
| ## Make it an autoload to work. | |
| # Sound files | |
| # Replace the path with your own | |
| const BUTTON_CLICK := preload("res://ui/sfx/click_soft.ogg") | |
| const BUTTON_FOCUS := preload("res://ui/sfx/bong_001.ogg") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class_name SerializableRefCounted | |
| extends RefCounted | |
| ## Saves all user defined variables inside a dictionary | |
| ## Member variables from the built in class will not be included | |
| func serialize() -> Dictionary: | |
| var data := {} | |
| for property in get_property_list(): | |
| var p_name: String = property.name | |
| if property.usage != PROPERTY_USAGE_SCRIPT_VARIABLE: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class_name LibraryPlayer3D | |
| extends AudioStreamPlayer3D | |
| ## Randomly play different sounds | |
| @export var audio_streams: Array[AudioStream] = [] | |
| @export var volume_range := Vector2(-3, 3) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| shader_type spatial; | |
| render_mode skip_vertex_transform; | |
| uniform vec4 albedo : source_color = vec4(1.0); | |
| uniform sampler2D texture_albedo : source_color,filter_linear_mipmap,repeat_enable; | |
| uniform sampler2D texture_normal : hint_roughness_normal,filter_linear_mipmap,repeat_enable; | |
| uniform float normal_scale : hint_range(-16,16) = 1.0; | |
| uniform sampler2D texture_heightmap : hint_default_black,filter_linear_mipmap,repeat_enable; | |
| uniform float heightmap_scale = 1.0; | |
| uniform int heightmap_min_layers: hint_range(0, 128, 1) = 8; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func format_value(value: float) -> String: | |
| var result := "" | |
| var negative := value < 0.0 | |
| value = abs(value) | |
| if _last_value > 1000.0: | |
| var scale = ["K", "M", "G", "T", "P", "E"] | |
| var v = _last_value | |
| var index = -1 | |
| while v > 1000.0 and index < (scale.size() - 1): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class_name MeshUtils | |
| static func auto_smooth(mesh: Mesh, threshold_degrees := 30.0) -> Mesh: | |
| var result := ArrayMesh.new() | |
| var threshold := deg_to_rad(threshold_degrees) | |
| var sanitized_mesh := merge_duplicate_vertices(mesh) | |
| # Auto smooth each surfaces. |
NewerOlder