Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
尘离序散
obs-studio
提交
2b50263d
O
obs-studio
项目概览
尘离序散
/
obs-studio
与 Fork 源项目一致
从无法访问的项目Fork
通知
30
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
obs-studio
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2b50263d
编写于
12月 12, 2019
作者:
C
Clayton Groeneveld
提交者:
Jim
10月 15, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
UI, libobs: Add ability to copy/paste single filter
上级
8a674137
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
74 addition
and
0 deletion
+74
-0
UI/window-basic-filters.cpp
UI/window-basic-filters.cpp
+38
-0
UI/window-basic-filters.hpp
UI/window-basic-filters.hpp
+3
-0
UI/window-basic-main.cpp
UI/window-basic-main.cpp
+1
-0
UI/window-basic-main.hpp
UI/window-basic-main.hpp
+2
-0
libobs/obs-source.c
libobs/obs-source.c
+28
-0
libobs/obs.h
libobs/obs.h
+2
-0
未找到文件。
UI/window-basic-filters.cpp
浏览文件 @
2b50263d
...
...
@@ -741,8 +741,25 @@ void OBSBasicFilters::CustomContextMenu(const QPoint &pos, bool async)
popup
.
addSeparator
();
popup
.
addAction
(
QTStr
(
"Rename"
),
this
,
renameSlot
);
popup
.
addAction
(
QTStr
(
"Remove"
),
this
,
removeSlot
);
popup
.
addSeparator
();
QAction
*
copyAction
=
new
QAction
(
QTStr
(
"Copy"
));
connect
(
copyAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
CopyFilter
()));
copyAction
->
setShortcut
(
QKeySequence
(
Qt
::
CTRL
+
Qt
::
Key_C
));
ui
->
effectWidget
->
addAction
(
copyAction
);
ui
->
asyncWidget
->
addAction
(
copyAction
);
popup
.
addAction
(
copyAction
);
}
QAction
*
pasteAction
=
new
QAction
(
QTStr
(
"Paste"
));
pasteAction
->
setEnabled
(
main
->
copyFilter
);
connect
(
pasteAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
PasteFilter
()));
pasteAction
->
setShortcut
(
QKeySequence
(
Qt
::
CTRL
+
Qt
::
Key_V
));
ui
->
effectWidget
->
addAction
(
pasteAction
);
ui
->
asyncWidget
->
addAction
(
pasteAction
);
popup
.
addAction
(
pasteAction
);
popup
.
exec
(
QCursor
::
pos
());
}
...
...
@@ -864,3 +881,24 @@ void OBSBasicFilters::ResetFilters()
view
->
RefreshProperties
();
}
void
OBSBasicFilters
::
CopyFilter
()
{
OBSSource
filter
=
nullptr
;
if
(
isAsync
)
filter
=
GetFilter
(
ui
->
asyncFilters
->
currentRow
(),
true
);
else
filter
=
GetFilter
(
ui
->
effectFilters
->
currentRow
(),
false
);
main
->
copyFilter
=
OBSGetWeakRef
(
filter
);
}
void
OBSBasicFilters
::
PasteFilter
()
{
OBSSource
filter
=
OBSGetStrongRef
(
main
->
copyFilter
);
if
(
!
filter
)
return
;
obs_source_copy_single_filter
(
source
,
filter
);
}
UI/window-basic-filters.hpp
浏览文件 @
2b50263d
...
...
@@ -111,6 +111,9 @@ private slots:
void
EffectFilterNameEdited
(
QWidget
*
editor
,
QAbstractItemDelegate
::
EndEditHint
endHint
);
void
CopyFilter
();
void
PasteFilter
();
public:
OBSBasicFilters
(
QWidget
*
parent
,
OBSSource
source_
);
~
OBSBasicFilters
();
...
...
UI/window-basic-main.cpp
浏览文件 @
2b50263d
...
...
@@ -1112,6 +1112,7 @@ retryScene:
copyStrings
.
clear
();
copyFiltersString
=
nullptr
;
copyFilter
=
nullptr
;
LogScenes
();
...
...
UI/window-basic-main.hpp
浏览文件 @
2b50263d
...
...
@@ -840,6 +840,8 @@ public:
QIcon
GetGroupIcon
()
const
;
QIcon
GetSceneIcon
()
const
;
OBSWeakSource
copyFilter
=
nullptr
;
protected:
virtual
void
closeEvent
(
QCloseEvent
*
event
)
override
;
virtual
void
changeEvent
(
QEvent
*
event
)
override
;
...
...
libobs/obs-source.c
浏览文件 @
2b50263d
...
...
@@ -31,6 +31,8 @@
#include "obs.h"
#include "obs-internal.h"
static
bool
filter_compatible
(
obs_source_t
*
source
,
obs_source_t
*
filter
);
static
inline
bool
data_valid
(
const
struct
obs_source
*
source
,
const
char
*
f
)
{
return
obs_source_valid
(
source
,
f
)
&&
source
->
context
.
data
;
...
...
@@ -493,6 +495,32 @@ void obs_source_copy_filters(obs_source_t *dst, obs_source_t *src)
duplicate_filters
(
dst
,
src
,
dst
->
context
.
private
);
}
static
void
duplicate_filter
(
obs_source_t
*
dst
,
obs_source_t
*
filter
)
{
if
(
!
filter_compatible
(
dst
,
filter
))
return
;
char
*
new_name
=
get_new_filter_name
(
dst
,
filter
->
context
.
name
);
bool
enabled
=
obs_source_enabled
(
filter
);
obs_source_t
*
dst_filter
=
obs_source_duplicate
(
filter
,
new_name
,
true
);
obs_source_set_enabled
(
dst_filter
,
enabled
);
bfree
(
new_name
);
obs_source_filter_add
(
dst
,
dst_filter
);
obs_source_release
(
dst_filter
);
}
void
obs_source_copy_single_filter
(
obs_source_t
*
dst
,
obs_source_t
*
filter
)
{
if
(
!
obs_source_valid
(
dst
,
"obs_source_copy_single_filter"
))
return
;
if
(
!
obs_source_valid
(
filter
,
"obs_source_copy_single_filter"
))
return
;
duplicate_filter
(
dst
,
filter
);
}
obs_source_t
*
obs_source_duplicate
(
obs_source_t
*
source
,
const
char
*
new_name
,
bool
create_private
)
{
...
...
libobs/obs.h
浏览文件 @
2b50263d
...
...
@@ -1085,6 +1085,8 @@ EXPORT obs_source_t *obs_source_get_filter_by_name(obs_source_t *source,
const
char
*
name
);
EXPORT
void
obs_source_copy_filters
(
obs_source_t
*
dst
,
obs_source_t
*
src
);
EXPORT
void
obs_source_copy_single_filter
(
obs_source_t
*
dst
,
obs_source_t
*
filter
);
EXPORT
bool
obs_source_enabled
(
const
obs_source_t
*
source
);
EXPORT
void
obs_source_set_enabled
(
obs_source_t
*
source
,
bool
enabled
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录