0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-20 21:13:04 +02:00
obs-studio/obs/window-basic-transform.hpp
jp9000 452e0695f4 UI: Add scene editing
So, scene editing was interesting (and by interesting I mean
excruciating).  I almost implemented 'manipulator' visuals (ala 3dsmax
for example), and used 3 modes for controlling position/rotation/size,
but in a 2D editing, it felt clunky, so I defaulted back to simply
click-and-drag for movement, and then took a similar though slightly
different looking approach for handling scaling and reszing.

I also added a number of menu item helpers related to positioning,
scaling, rotating, flipping, and resetting the transform back to
default.

There is also a new 'transform' dialog (accessible via menu) which will
allow you to manually edit every single transform variable of a scene
item directly if desired.

If a scene item does not have bounds active, pulling on the sides of a
source will cause it to resize it via base scale rather than by the
bounding box system (if the source resizes that scale will apply).  If
bounds are active, it will modify the bounding box only instead.

How a source scales when a bounding box is active depends on the type of
bounds being used.  You can set it to scale to the inner bounds, the
outer bounds, scale to bounds width only, scale to bounds height only,
and a setting to stretch to bounds (which forces a source to always draw
at the bounding box size rather than be affected by its internal size).
You can also set it to be used as a 'maximum' size, so that the source
doesn't necessarily get scaled unless it extends beyond the bounds.

Like in OBS1, objects will snap to the edges unless the control key is
pressed.  However, this will now happen even if the object is rotated or
oriented in any strange way.  Snapping will also occur when stretching
or changing the bounding box size.
2014-06-15 20:33:13 -07:00

48 lines
1.1 KiB
C++

#pragma once
#include <obs.hpp>
#include <memory>
#include "ui_OBSBasicTransform.h"
class OBSBasic;
class OBSBasicTransform : public QDialog {
Q_OBJECT
private:
std::unique_ptr<Ui::OBSBasicTransform> ui;
OBSBasic *main;
OBSSceneItem item;
OBSSignal channelChangedSignal;
OBSSignal transformSignal;
OBSSignal removeSignal;
OBSSignal selectSignal;
OBSSignal deselectSignal;
bool ignoreTransformSignal = false;
bool ignoreItemChange = false;
void HookWidget(QWidget *widget, const char *signal, const char *slot);
void SetScene(OBSScene scene);
void SetItem(OBSSceneItem newItem);
static void OBSChannelChanged(void *param, calldata_t data);
static void OBSSceneItemTransform(void *param, calldata_t data);
static void OBSSceneItemRemoved(void *param, calldata_t data);
static void OBSSceneItemSelect(void *param, calldata_t data);
static void OBSSceneItemDeselect(void *param, calldata_t data);
private slots:
void RefreshControls();
void SetItemQt(OBSSceneItem newItem);
void OnBoundsType(int index);
void OnControlChanged();
public:
OBSBasicTransform(OBSBasic *parent);
};