-
Notifications
You must be signed in to change notification settings - Fork 479
Add AE interaction utility class #2866
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2866 +/- ##
==========================================
+ Coverage 77.25% 77.26% +0.01%
==========================================
Files 419 419
Lines 22307 22307
Branches 6420 6420
==========================================
+ Hits 17233 17236 +3
+ Misses 3795 3792 -3
Partials 1279 1279 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
exporter/src/aecommand/AECommand.cpp
Outdated
@@ -28,8 +30,23 @@ AEGP_Command AECommand::PAGPreviewCMD = 0L; | |||
A_Err AECommand::OnUpdateMenu(AEGP_GlobalRefcon /*globalRefcon*/, | |||
AEGP_UpdateMenuRefcon /*menuRefcon*/, | |||
AEGP_WindowType /*windowType*/) { | |||
A_Err err = A_Err_NONE, err2 = A_Err_NONE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
拆成两行写,不要写到一行
"PAG Config...", AEGP_Menu_PREFS, | ||
AEGP_MENU_INSERT_AT_BOTTOM)); | ||
ERR(suites.RegisterSuite5()->AEGP_RegisterCommandHook( | ||
ERR(suites->CommandSuite1()->AEGP_GetUniqueCommand(&exporter::AECommand::PAGConfigCMD)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这些CommandSuiteN,比较多的情况下,最好使用具体的有意义的变量命名。
|
||
void CreateFolder(const std::string& path) { | ||
if (!fs::exists(path)) { | ||
fs::create_directories(path); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1、需要考虑下父级目录是否存在,需要递归创建下
2、create_directories需要进行异常处理,可以使用如下代码进行异常处理:
std::error_code errorCode;
std::filesystem::create_directories(path, errorCode)
exporter/src/utils/AEHelper.cpp
Outdated
std::shared_ptr<AEGP_SuiteHandler> AEHelper::Suites = nullptr; | ||
|
||
void AEHelper::SetSuitesAndPluginID(SPBasicSuite* basicSuite, AEGP_PluginID id) { | ||
Suites = std::make_unique<AEGP_SuiteHandler>(basicSuite); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suites定义为std::shared_ptr,这里需要使用std::make_shared创建
AEGP_ItemH AEHelper::GetActiveCompositionItem() { | ||
const auto& suites = GetSuites(); | ||
AEGP_ItemH activeItemH = nullptr; | ||
suites->ItemSuite6()->AEGP_GetActiveItem(&activeItemH); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ItemSuite6用有意义的变量命名吧
exporter/src/utils/AEHelper.h
Outdated
|
||
namespace exporter { | ||
|
||
class AEHelper { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AEHelper类中全部都是静态成员函数,将class AEHelper该我namespace AEHelper更合适一些
|
||
class AEResourceManager { | ||
public: | ||
static bool HasCompositionResource(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
类中只有静态成员函数,考虑直接定义成全局函数即可,可以用namespace进行作用域的隔离
c4523a2
to
fb76b5e
Compare
fb76b5e
to
1cbbfd3
Compare
A_Err err = A_Err_NONE; | ||
A_Err err2 = A_Err_NONE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
err2没有地方使用?
1、添加AE工具类
2、添加平台工具类