You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Automatically activate camera monitoring when using CameraTexture.
This commit is contained in:
@@ -142,7 +142,12 @@ bool CameraTexture::get_camera_active() const {
|
||||
}
|
||||
}
|
||||
|
||||
CameraTexture::CameraTexture() {}
|
||||
CameraTexture::CameraTexture() {
|
||||
// Note: When any CameraTexture is created, we need to automatically activate monitoring
|
||||
// of camera feeds. This may incur a small lag spike, so it may be preferable to
|
||||
// enable it manually before creating the camera texture.
|
||||
CameraServer::get_singleton()->set_monitoring_feeds(true);
|
||||
}
|
||||
|
||||
CameraTexture::~CameraTexture() {
|
||||
if (_texture.is_valid()) {
|
||||
|
||||
@@ -42,6 +42,7 @@ void CameraServer::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_monitoring_feeds", "is_monitoring_feeds"), &CameraServer::set_monitoring_feeds);
|
||||
ClassDB::bind_method(D_METHOD("is_monitoring_feeds"), &CameraServer::is_monitoring_feeds);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "monitoring_feeds"), "set_monitoring_feeds", "is_monitoring_feeds");
|
||||
ADD_PROPERTY_DEFAULT("monitoring_feeds", false);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_feed", "index"), &CameraServer::get_feed);
|
||||
ClassDB::bind_method(D_METHOD("get_feed_count"), &CameraServer::get_feed_count);
|
||||
|
||||
Reference in New Issue
Block a user