Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
godot
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
godot
Commits
03879a56
Unverified
Commit
03879a56
authored
Jun 14, 2020
by
Ev1lbl0w
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose disable_render_loop property to GDScript
parent
79947dfe
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
1 deletion
+23
-1
RenderingServer.xml
doc/classes/RenderingServer.xml
+5
-0
main.cpp
main/main.cpp
+2
-1
rendering_server.cpp
servers/rendering_server.cpp
+12
-0
rendering_server.h
servers/rendering_server.h
+4
-0
No files found.
doc/classes/RenderingServer.xml
View file @
03879a56
...
...
@@ -17,6 +17,11 @@
<tutorials>
<link>
https://docs.godotengine.org/en/latest/tutorials/optimization/using_servers.html
</link>
</tutorials>
<members>
<member
name=
"render_loop_enabled"
type=
"bool"
setter=
"set_render_loop_enabled"
getter=
"is_render_loop_enabled"
default=
"true"
>
If [code]false[/code], disables rendering completely, but the engine logic is still being processed. You can call [method force_draw] to draw a frame even with rendering disabled.
</member>
</members>
<methods>
<method
name=
"black_bars_set_images"
>
<return
type=
"void"
>
...
...
main/main.cpp
View file @
03879a56
...
...
@@ -1312,6 +1312,7 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
}
rendering_server
->
init
();
rendering_server
->
set_render_loop_enabled
(
!
disable_render_loop
);
OS
::
get_singleton
()
->
initialize_joypads
();
...
...
@@ -2203,7 +2204,7 @@ bool Main::iteration() {
RenderingServer
::
get_singleton
()
->
sync
();
//sync if still drawing from previous frames.
if
(
DisplayServer
::
get_singleton
()
->
can_any_window_draw
()
&&
!
disable_render_loop
)
{
if
(
DisplayServer
::
get_singleton
()
->
can_any_window_draw
()
&&
RenderingServer
::
get_singleton
()
->
is_render_loop_enabled
()
)
{
if
((
!
force_redraw_requested
)
&&
OS
::
get_singleton
()
->
is_in_low_processor_usage_mode
())
{
if
(
RenderingServer
::
get_singleton
()
->
has_changed
())
{
RenderingServer
::
get_singleton
()
->
draw
(
true
,
scaled_step
);
// flush visual commands
...
...
servers/rendering_server.cpp
View file @
03879a56
...
...
@@ -1895,6 +1895,10 @@ void RenderingServer::_bind_methods() {
ClassDB
::
bind_method
(
D_METHOD
(
"has_os_feature"
,
"feature"
),
&
RenderingServer
::
has_os_feature
);
ClassDB
::
bind_method
(
D_METHOD
(
"set_debug_generate_wireframes"
,
"generate"
),
&
RenderingServer
::
set_debug_generate_wireframes
);
ClassDB
::
bind_method
(
D_METHOD
(
"is_render_loop_enabled"
),
&
RenderingServer
::
is_render_loop_enabled
);
ClassDB
::
bind_method
(
D_METHOD
(
"set_render_loop_enabled"
,
"enabled"
),
&
RenderingServer
::
set_render_loop_enabled
);
ADD_PROPERTY
(
PropertyInfo
(
Variant
::
BOOL
,
"render_loop_enabled"
),
"set_render_loop_enabled"
,
"is_render_loop_enabled"
);
BIND_CONSTANT
(
NO_INDEX_ARRAY
);
BIND_CONSTANT
(
ARRAY_WEIGHTS_SIZE
);
BIND_CONSTANT
(
CANVAS_ITEM_Z_MIN
);
...
...
@@ -2286,6 +2290,14 @@ RID RenderingServer::instance_create2(RID p_base, RID p_scenario) {
return
instance
;
}
bool
RenderingServer
::
is_render_loop_enabled
()
const
{
return
render_loop_enabled
;
}
void
RenderingServer
::
set_render_loop_enabled
(
bool
p_enabled
)
{
render_loop_enabled
=
p_enabled
;
}
RenderingServer
::
RenderingServer
()
{
//ERR_FAIL_COND(singleton);
singleton
=
this
;
...
...
servers/rendering_server.h
View file @
03879a56
...
...
@@ -47,6 +47,7 @@ class RenderingServer : public Object {
static
RenderingServer
*
singleton
;
int
mm_policy
;
bool
render_loop_enabled
=
true
;
void
_camera_set_orthogonal
(
RID
p_camera
,
float
p_size
,
float
p_z_near
,
float
p_z_far
);
void
_canvas_item_add_style_box
(
RID
p_item
,
const
Rect2
&
p_rect
,
const
Rect2
&
p_source
,
RID
p_texture
,
const
Vector
<
float
>
&
p_margins
,
const
Color
&
p_modulate
=
Color
(
1
,
1
,
1
));
...
...
@@ -1229,6 +1230,9 @@ public:
virtual
bool
is_low_end
()
const
=
0
;
bool
is_render_loop_enabled
()
const
;
void
set_render_loop_enabled
(
bool
p_enabled
);
RenderingServer
();
virtual
~
RenderingServer
();
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment