MCPcopy Create free account
hub / github.com/WarmUpTill/SceneSwitcher / Transform

Method Transform

plugins/base/macro-action-scene-transform.cpp:206–264  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

204/* ------------------------------------------------------------------------- */
205
206void MacroActionSceneTransform::Transform(obs_scene_item *item)
207{
208 if (!item) {
209 return;
210 }
211
212 switch (_action) {
213 case Action::RESET:
214 obs_sceneitem_defer_update_begin(item);
215 reset(item);
216 obs_sceneitem_defer_update_end(item);
217
218 break;
219 case Action::ROTATE:
220 rotate(item, _rotation);
221 break;
222 case Action::FLIP_HORIZONTAL: {
223 vec2 scale;
224 vec2_set(&scale, -1.0f, 1.0f);
225 flip(item, scale);
226 break;
227 }
228 case Action::FLIP_VERTICAL: {
229 vec2 scale;
230 vec2_set(&scale, 1.0f, -1.0f);
231 flip(item, scale);
232 break;
233 }
234 case Action::FIT_TO_SCREEN:
235 centerAlign(item, OBS_BOUNDS_SCALE_INNER);
236 break;
237 case Action::STRETCH_TO_SCREEN:
238 centerAlign(item, OBS_BOUNDS_STRETCH);
239 break;
240 case Action::CENTER_TO_SCREEN:
241 center(item, CenterType::SCREEN);
242 break;
243 case Action::CENTER_VERTICALLY:
244 center(item, CenterType::VERTICAL);
245 break;
246 case Action::CENTER_HORIZONTALLY:
247 center(item, CenterType::HORIZONTAL);
248 break;
249 case Action::MANUAL_TRANSFORM:
250 ApplySettings(_transformString); // Resolves variables
251 obs_sceneitem_defer_update_begin(item);
252#if (LIBOBS_API_VER >= MAKE_SEMANTIC_VERSION(30, 1, 0))
253 obs_sceneitem_set_info2(item, &_info);
254#else
255 obs_sceneitem_set_info(item, &_info);
256#endif
257 obs_sceneitem_set_crop(item, &_crop);
258 obs_sceneitem_defer_update_end(item);
259 break;
260 case Action::SINGLE_TRANSFORM_SETTING:
261 SetTransformSetting(item, _settingSelection,
262 _singleSettingsValue);
263 }

Callers

nothing calls this directly

Calls 6

resetFunction · 0.85
rotateFunction · 0.85
flipFunction · 0.85
centerAlignFunction · 0.85
centerFunction · 0.85
SetTransformSettingFunction · 0.85

Tested by

no test coverage detected