Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: Port Code Examples to C# (R, S, T, U) #43929

Merged
merged 1 commit into from
Mar 5, 2021

Conversation

HaSa1002
Copy link
Contributor

Includes:

  • RenderingServer
  • RichTextEffect
  • SceneTree
  • SceneTreeTimer
  • ScriptCreateDialog
  • SpinBox
  • Sprite2D
  • StreamPeer
  • String
  • SurfaceTool
  • TextEdit
  • TileMap
  • Tree
  • Tween
  • UDPServer
  • UndoRedo

@aaronfranke There is a ton of API incompatiblities in String. It is very late here, so there might be workarounds. I assume there are the usal errors. I bet CI won't pass first time 😆

There is also a code example in RenderingServer which seems to call a non existent method.

@@ -2699,11 +2699,21 @@
<description>
Copies the viewport to a region of the screen specified by [code]rect[/code]. If [method viewport_set_render_direct_to_screen] is [code]true[/code], then the viewport does not use a framebuffer and the contents of the viewport are rendered directly to screen. However, note that the root viewport is drawn last, therefore it will draw over the screen. Accordingly, you must set the root viewport to an area that does not cover the area that you have attached this viewport to.
For example, you can set the root viewport to not render at all with the following code:
[codeblock]
FIXME: The method seems to be non-existent.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this method doesn't exist. It exists in 3.2 though. Was it renamed, or removed? @akien-mga

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

@HaSa1002 HaSa1002 Nov 29, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels like the whole description is not up to date since the window split. Maybe I can dig up some infos how it is done now or if it is even valid today.

Copy link
Contributor Author

@HaSa1002 HaSa1002 Nov 29, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I almost wasted 1,5 hours into that. I feel like this is not supported anymore. There has to be a reason it was removed from viewport. I guess the RenderingServerViewport was not updated with this change. (It even is guarded as VisualServer). I tried

func _ready():
	RenderingServer.viewport_attach_to_screen(get_viewport_rid(), Rect2(0,0,600,600))

as indirectly suggested in this description and it does not work. I guess this is the reason, why it was removed in the linked commit. Someone with a deeper understanding of the RenderingServer might be required to update the docs at this point.

doc/classes/RichTextEffect.xml Outdated Show resolved Hide resolved
doc/classes/ScriptCreateDialog.xml Outdated Show resolved Hide resolved
doc/classes/Sprite2D.xml Outdated Show resolved Hide resolved
doc/classes/TextEdit.xml Outdated Show resolved Hide resolved
doc/classes/TextEdit.xml Outdated Show resolved Hide resolved
doc/classes/TileMap.xml Outdated Show resolved Hide resolved
doc/classes/Tree.xml Show resolved Hide resolved
Copy link
Contributor Author

@HaSa1002 HaSa1002 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finished my second review pass. There are a few things I am unsure about.

doc/classes/String.xml Outdated Show resolved Hide resolved
doc/classes/String.xml Outdated Show resolved Hide resolved
doc/classes/String.xml Outdated Show resolved Hide resolved
Comment on lines 723 to 680
// There is no Rsplit...
//var someString = "One,Two,Three,Four";
//var someArray = someString.Rsplit(",", true, 1);
//GD.Print(someArray.Length); // Prints 2
//GD.Print(someArray[0]); // Prints "Four"
//GD.Print(someArray[1]); // Prints "Three,Two,One"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a built in way?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This option seems really weird, so I checked what the existing usages in core are. It's used for rsplit twice in visual_script_property_selector.cpp:474 and thirdparty/enet/godot.cpp:315, and for split thrice in http_request.cpp:107, wsl_client.cpp:116, and wsl_server.cpp:59. All of these usages are about detecting suffixes/prefixes (like http:), since p_maxsplit is 1. There are zero usages where p_maxsplit is a value other than 0 or 1 (except in test_string.h).

I'm wondering if this option should be removed for 4.0 and the usages should be replaced with a more local solution. The same logic can be accomplished with find/rfind and a substring with left/right. @akien-mga @reduz

doc/classes/String.xml Outdated Show resolved Hide resolved
doc/classes/UDPServer.xml Outdated Show resolved Hide resolved
doc/classes/UDPServer.xml Outdated Show resolved Hide resolved
doc/classes/UDPServer.xml Outdated Show resolved Hide resolved
doc/classes/UDPServer.xml Outdated Show resolved Hide resolved
@HaSa1002
Copy link
Contributor Author

Fixed the things #43978 implements. I don't know what to the with the thing in the rendering server and what to do with the split/rsplit stuff.

@HaSa1002
Copy link
Contributor Author

HaSa1002 commented Mar 5, 2021

Rebased. The only thing left is rsplit where I don't know what to do with.

doc/classes/UndoRedo.xml Outdated Show resolved Hide resolved
doc/classes/UDPServer.xml Outdated Show resolved Hide resolved
doc/classes/RenderingServer.xml Outdated Show resolved Hide resolved
Copy link
Member

@aaronfranke aaronfranke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rsplit thing and Viewport attach to screen are a bit weird but that can wait, they might need core changes, and there isn't much of a reason to hold back the rest of these documentation changes. Aside from that, I don't see any further problems with this.

@HaSa1002
Copy link
Contributor Author

HaSa1002 commented Mar 5, 2021

Should I remove them and only leave the fixme in the the viewport?

 * RenderingServer
 * RichTextEffect
 * SceneTree
 * SceneTreeTimer
 * ScriptCreateDialog
 * SpinBox
 * Sprite2D
 * StreamPeer
 * String
 * SurfaceTool
 * TextEdit
 * TileMap
 * Tree
 * Tween
 * UDPServer
 * UndoRedo

Co-authored-by: Aaron Franke <arnfranke@yahoo.com>
@HaSa1002
Copy link
Contributor Author

HaSa1002 commented Mar 5, 2021

ok. done

@akien-mga akien-mga merged commit aaeb07d into godotengine:master Mar 5, 2021
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants