-
-
Notifications
You must be signed in to change notification settings - Fork 21k
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
Conversation
@@ -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. |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found where it was removed: 9e08742#diff-bb1ece4037c24373754d0e6cc6e238abae9103eb0de29effe6cf50b041554077L518-L523
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
1b7eb2c
to
bb031d8
Compare
There was a problem hiding this 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
// 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" |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
4155528
to
9b54a7f
Compare
d2c14fc
to
a17f96c
Compare
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. |
Rebased. The only thing left is |
There was a problem hiding this 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.
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>
ok. done |
Thanks! |
Includes:
@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.