提交 07813e2b 编写于 作者: J jp9000

UI: Allow resetting transform of group sub-items

上级 a69f7265
......@@ -5509,36 +5509,38 @@ void OBSBasic::on_actionPasteTransform_triggered()
obs_scene_enum_items(GetCurrentScene(), func, nullptr);
}
void OBSBasic::on_actionResetTransform_triggered()
static bool reset_tr(obs_scene_t *scene, obs_sceneitem_t *item, void *param)
{
auto func = [] (obs_scene_t *scene, obs_sceneitem_t *item, void *param)
{
if (!obs_sceneitem_selected(item))
return true;
if (obs_sceneitem_is_group(item))
obs_sceneitem_group_enum_items(item, reset_tr, nullptr);
if (!obs_sceneitem_selected(item))
return true;
obs_sceneitem_defer_update_begin(item);
obs_sceneitem_defer_update_begin(item);
obs_transform_info info;
vec2_set(&info.pos, 0.0f, 0.0f);
vec2_set(&info.scale, 1.0f, 1.0f);
info.rot = 0.0f;
info.alignment = OBS_ALIGN_TOP | OBS_ALIGN_LEFT;
info.bounds_type = OBS_BOUNDS_NONE;
info.bounds_alignment = OBS_ALIGN_CENTER;
vec2_set(&info.bounds, 0.0f, 0.0f);
obs_sceneitem_set_info(item, &info);
obs_transform_info info;
vec2_set(&info.pos, 0.0f, 0.0f);
vec2_set(&info.scale, 1.0f, 1.0f);
info.rot = 0.0f;
info.alignment = OBS_ALIGN_TOP | OBS_ALIGN_LEFT;
info.bounds_type = OBS_BOUNDS_NONE;
info.bounds_alignment = OBS_ALIGN_CENTER;
vec2_set(&info.bounds, 0.0f, 0.0f);
obs_sceneitem_set_info(item, &info);
obs_sceneitem_crop crop = {};
obs_sceneitem_set_crop(item, &crop);
obs_sceneitem_crop crop = {};
obs_sceneitem_set_crop(item, &crop);
obs_sceneitem_defer_update_end(item);
obs_sceneitem_defer_update_end(item);
UNUSED_PARAMETER(scene);
UNUSED_PARAMETER(param);
return true;
};
UNUSED_PARAMETER(scene);
UNUSED_PARAMETER(param);
return true;
}
obs_scene_enum_items(GetCurrentScene(), func, nullptr);
void OBSBasic::on_actionResetTransform_triggered()
{
obs_scene_enum_items(GetCurrentScene(), reset_tr, nullptr);
}
static void GetItemBox(obs_sceneitem_t *item, vec3 &tl, vec3 &br)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册