Bläddra i källkod

Fix some recent errors and styling (#3375)

Michael Alexsander 5 år sedan
förälder
incheckning
58ff2e036a

+ 11 - 1
getting_started/step_by_step/signals.rst

@@ -79,8 +79,9 @@ Click "Connect" and you'll see that the function has been created in the script:
 
     extends Node2D
 
+
     func _on_Timer_timeout():
-        pass # replace with function body
+        pass # Replace with function body.
 
  .. code-tab:: csharp
 
@@ -100,6 +101,7 @@ the signal is received. Let's make the Sprite blink:
 
     extends Node2D
 
+
     func _on_Timer_timeout():
         # Note: the `$` operator is a shorthand for `get_node()`,
         # so `$Sprite` is equivalent to `get_node("Sprite")`.
@@ -141,9 +143,11 @@ Here is the code for our Timer connection:
 
     extends Node2D
 
+
     func _ready():
         $Timer.connect("timeout", self, "_on_Timer_timeout")
 
+
     func _on_Timer_timeout():
         $Sprite.visible = !$Sprite.visible
 
@@ -174,6 +178,7 @@ You can also declare your own custom signals in Godot:
 
     extends Node2D
 
+
     signal my_signal
 
  .. code-tab:: csharp
@@ -194,8 +199,10 @@ To emit a signal via code, use the ``emit_signal`` function:
 
     extends Node2D
 
+
     signal my_signal
 
+
     func _ready():
         emit_signal("my_signal")
 
@@ -220,6 +227,7 @@ argument names between parentheses:
 
     extends Node
 
+
     signal my_signal(value, other_value)
 
  .. code-tab:: csharp
@@ -244,8 +252,10 @@ To pass values, add them as the second argument to the ``emit_signal`` function:
 
     extends Node
 
+
     signal my_signal(value, other_value)
 
+
     func _ready():
         emit_signal("my_signal", true, 42)
 

+ 25 - 21
tutorials/plugins/editor/making_main_screen_plugins.rst

@@ -31,28 +31,29 @@ Add five extra methods such that the script looks like this:
     tool
     extends EditorPlugin
 
+
     func _enter_tree():
-       pass
+        pass
 
 
     func _exit_tree():
-       pass
+        pass
 
 
     func has_main_screen():
-       return true
+        return true
 
 
     func make_visible(visible):
-       pass
+        pass
 
 
     func get_plugin_name():
-       return "Main Screen Plugin"
+        return "Main Screen Plugin"
 
 
     func get_plugin_icon():
-       return get_editor_interface().get_base_control().get_icon("Node", "EditorIcons")
+        return get_editor_interface().get_base_control().get_icon("Node", "EditorIcons")
 
 The important part in this script is the ``has_main_screen()`` function,
 which is overloaded so it returns ``true``. This function is automatically
@@ -79,11 +80,12 @@ Add a script to the button like this:
     tool
     extends Button
 
+
     func _on_PrintHello_pressed():
-       print("Hello from the main screen plugin!")
+        print("Hello from the main screen plugin!")
 
 Then connect the "pressed" signal to itself. If you need help with signals,
-see the :ref:`Signals <doc_getting_started_step_by_step_signals>` article.
+see the :ref:`doc_signals` article.
 
 We are done with the main screen panel. Save the scene as ``main_panel.tscn``.
 
@@ -99,39 +101,41 @@ Here is the full plugin script:
     tool
     extends EditorPlugin
 
+
     const MainPanel = preload("res://addons/main_screen/main_panel.tscn")
 
     var main_panel_instance
 
+
     func _enter_tree():
-       main_panel_instance = MainPanel.instance()
-       # Add the main panel to the editor's main viewport.
-       get_editor_interface().get_editor_viewport().add_child(main_panel_instance)
-       # Hide the main panel. Very much required.
-       make_visible(false)
+        main_panel_instance = MainPanel.instance()
+        # Add the main panel to the editor's main viewport.
+        get_editor_interface().get_editor_viewport().add_child(main_panel_instance)
+        # Hide the main panel. Very much required.
+        make_visible(false)
 
 
     func _exit_tree():
-       if main_panel_instance:
-          main_panel_instance.queue_free()
+        if main_panel_instance:
+            main_panel_instance.queue_free()
 
 
     func has_main_screen():
-       return true
+        return true
 
 
     func make_visible(visible):
-       if main_panel_instance:
-          main_panel_instance.visible = visible
+        if main_panel_instance:
+            main_panel_instance.visible = visible
 
 
     func get_plugin_name():
-       return "Main Screen Plugin"
+        return "Main Screen Plugin"
 
 
     func get_plugin_icon():
-       # Must return some kind of Texture for the icon.
-       return get_editor_interface().get_base_control().get_icon("Node", "EditorIcons")
+        # Must return some kind of Texture for the icon.
+        return get_editor_interface().get_base_control().get_icon("Node", "EditorIcons")
 
 A couple of specific lines were added. ``MainPanel`` is a constant that holds
 a reference to the scene, and we instance it into `main_panel_instance`.

+ 1 - 3
tutorials/shading/godot_shader_language_style_guide.rst

@@ -269,8 +269,6 @@ distinguishing numbers greater than 1 from those lower than 1.
         ALBEDO.rgb = vec3(5., .1, .2);
     }
 
-.. _naming_conventions:
-
 Accessing vector members
 ------------------------
 
@@ -283,7 +281,7 @@ understand what the underlying data represents.
 
 .. code-block:: glsl
 
-    COLOR.rgb = vec3(5., .1, .2);
+    COLOR.rgb = vec3(5.0, 0.1, 0.2);
 
 **Bad**: