mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-07-14 23:34:08 +00:00
libobs: Add function to set scene item position
Allows setting a specific position for scene items rather than just up/down/top/bottom
This commit is contained in:
parent
f4704cf4a8
commit
e270192a61
|
@ -781,6 +781,38 @@ void obs_sceneitem_set_order(obs_sceneitem_t *item,
|
|||
obs_scene_release(scene);
|
||||
}
|
||||
|
||||
void obs_sceneitem_set_order_position(obs_sceneitem_t *item,
|
||||
int position)
|
||||
{
|
||||
if (!item) return;
|
||||
|
||||
struct obs_scene *scene = item->parent;
|
||||
struct obs_scene_item *next;
|
||||
|
||||
obs_scene_addref(scene);
|
||||
pthread_mutex_lock(&scene->mutex);
|
||||
|
||||
detach_sceneitem(item);
|
||||
next = scene->first_item;
|
||||
|
||||
if (position == 0) {
|
||||
attach_sceneitem(scene, item, NULL);
|
||||
} else {
|
||||
for (int i = position; i > 1; --i) {
|
||||
if (next->next == NULL)
|
||||
break;
|
||||
next = next->next;
|
||||
}
|
||||
|
||||
attach_sceneitem(scene, item, next);
|
||||
}
|
||||
|
||||
signal_reorder(item);
|
||||
|
||||
pthread_mutex_unlock(&scene->mutex);
|
||||
obs_scene_release(scene);
|
||||
}
|
||||
|
||||
void obs_sceneitem_set_bounds_type(obs_sceneitem_t *item,
|
||||
enum obs_bounds_type type)
|
||||
{
|
||||
|
|
|
@ -948,7 +948,8 @@ EXPORT void obs_sceneitem_set_alignment(obs_sceneitem_t *item,
|
|||
uint32_t alignment);
|
||||
EXPORT void obs_sceneitem_set_order(obs_sceneitem_t *item,
|
||||
enum obs_order_movement movement);
|
||||
|
||||
EXPORT void obs_sceneitem_set_order_position(obs_sceneitem_t *item,
|
||||
int position);
|
||||
EXPORT void obs_sceneitem_set_bounds_type(obs_sceneitem_t *item,
|
||||
enum obs_bounds_type type);
|
||||
EXPORT void obs_sceneitem_set_bounds_alignment(obs_sceneitem_t *item,
|
||||
|
|
Loading…
Reference in a new issue