Skip to content

Commit

Permalink
Expose CameraFeed setters
Browse files Browse the repository at this point in the history
  • Loading branch information
j20001970 committed Sep 27, 2024
1 parent 506d6e4 commit 1d2d402
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 7 deletions.
28 changes: 28 additions & 0 deletions doc/classes/CameraFeed.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,20 @@
Returns the position of camera on the device.
</description>
</method>
<method name="set_RGB_img">
<return type="void" />
<param index="0" name="rgb_img" type="Image" />
<description>
Sets RGB image for this feed.
</description>
</method>
<method name="set_YCbCr_img">
<return type="void" />
<param index="0" name="ycbcr_img" type="Image" />
<description>
Sets YCbCr image for this feed.
</description>
</method>
<method name="set_format">
<return type="bool" />
<param index="0" name="index" type="int" />
Expand All @@ -45,6 +59,20 @@
[code]copy[/code] will result in FEED_YCBCR
</description>
</method>
<method name="set_name">
<return type="void" />
<param index="0" name="name" type="String" />
<description>
Sets the camera's name.
</description>
</method>
<method name="set_position">
<return type="void" />
<param index="0" name="position" type="int" enum="CameraFeed.FeedPosition" />
<description>
Sets the position of this camera.
</description>
</method>
</methods>
<members>
<member name="feed_is_active" type="bool" setter="set_active" getter="is_active" default="false">
Expand Down
11 changes: 4 additions & 7 deletions servers/camera/camera_feed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,26 +33,23 @@
#include "servers/rendering_server.h"

void CameraFeed::_bind_methods() {
// The setters prefixed with _ are only exposed so we can have feeds through GDExtension!
// They should not be called by the end user.

ClassDB::bind_method(D_METHOD("get_id"), &CameraFeed::get_id);

ClassDB::bind_method(D_METHOD("is_active"), &CameraFeed::is_active);
ClassDB::bind_method(D_METHOD("set_active", "active"), &CameraFeed::set_active);

ClassDB::bind_method(D_METHOD("get_name"), &CameraFeed::get_name);
ClassDB::bind_method(D_METHOD("_set_name", "name"), &CameraFeed::set_name);
ClassDB::bind_method(D_METHOD("set_name", "name"), &CameraFeed::set_name);

ClassDB::bind_method(D_METHOD("get_position"), &CameraFeed::get_position);
ClassDB::bind_method(D_METHOD("_set_position", "position"), &CameraFeed::set_position);
ClassDB::bind_method(D_METHOD("set_position", "position"), &CameraFeed::set_position);

// Note, for transform some feeds may override what the user sets (such as ARKit)
ClassDB::bind_method(D_METHOD("get_transform"), &CameraFeed::get_transform);
ClassDB::bind_method(D_METHOD("set_transform", "transform"), &CameraFeed::set_transform);

ClassDB::bind_method(D_METHOD("_set_RGB_img", "rgb_img"), &CameraFeed::set_RGB_img);
ClassDB::bind_method(D_METHOD("_set_YCbCr_img", "ycbcr_img"), &CameraFeed::set_YCbCr_img);
ClassDB::bind_method(D_METHOD("set_RGB_img", "rgb_img"), &CameraFeed::set_RGB_img);
ClassDB::bind_method(D_METHOD("set_YCbCr_img", "ycbcr_img"), &CameraFeed::set_YCbCr_img);

ClassDB::bind_method(D_METHOD("get_datatype"), &CameraFeed::get_datatype);

Expand Down

0 comments on commit 1d2d402

Please sign in to comment.