Skip to content

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

Merged
merged 5 commits into from
Jun 11, 2025
Merged

Add AE interaction utility class #2866

merged 5 commits into from
Jun 11, 2025

Conversation

jinwuwu001
Copy link
Collaborator

@jinwuwu001 jinwuwu001 commented Jun 10, 2025

1、添加AE工具类
2、添加平台工具类

@codecov-commenter
Copy link

codecov-commenter commented Jun 10, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.26%. Comparing base (472f40b) to head (1cbbfd3).
Report is 1 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@@ -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;
Copy link
Collaborator

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));
Copy link
Collaborator

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);
Copy link
Collaborator

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)

std::shared_ptr<AEGP_SuiteHandler> AEHelper::Suites = nullptr;

void AEHelper::SetSuitesAndPluginID(SPBasicSuite* basicSuite, AEGP_PluginID id) {
Suites = std::make_unique<AEGP_SuiteHandler>(basicSuite);
Copy link
Collaborator

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);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ItemSuite6用有意义的变量命名吧


namespace exporter {

class AEHelper {
Copy link
Collaborator

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();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

类中只有静态成员函数,考虑直接定义成全局函数即可,可以用namespace进行作用域的隔离

A_Err err = A_Err_NONE;
A_Err err2 = A_Err_NONE;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

err2没有地方使用?

@shlzxjp shlzxjp merged commit b4801c9 into main Jun 11, 2025
8 checks passed
@shlzxjp shlzxjp deleted the exporter-aeutils branch June 11, 2025 03:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants