diff --git a/docs/en_us/1.1-QuickStarted.md b/docs/en_us/1.1-QuickStarted.md index b9af069b4..97eb779ea 100644 --- a/docs/en_us/1.1-QuickStarted.md +++ b/docs/en_us/1.1-QuickStarted.md @@ -74,7 +74,7 @@ class MyAction(CustomAction): # Perform click action context.controller.post_click(100, 10).wait() # Override the next tasks to execute - context.override_next(task_name, ["TaskA", "TaskB"]) + context.override_next(node_name, ["TaskA", "TaskB"]) ``` ### Write Your Own Code diff --git "a/docs/zh_cn/1.1-\345\277\253\351\200\237\345\274\200\345\247\213.md" "b/docs/zh_cn/1.1-\345\277\253\351\200\237\345\274\200\345\247\213.md" index e3d7609f2..4ac8aa4d5 100644 --- "a/docs/zh_cn/1.1-\345\277\253\351\200\237\345\274\200\345\247\213.md" +++ "b/docs/zh_cn/1.1-\345\277\253\351\200\237\345\274\200\345\247\213.md" @@ -74,7 +74,7 @@ class MyAction(CustomAction): # 进行点击 context.controller.post_click(100, 10).wait() # 重写接下来要执行的任务 - context.override_next(task_name, ["TaskA", "TaskB"]) + context.override_next(node_name, ["TaskA", "TaskB"]) ``` ### 自行编写代码 diff --git a/source/MaaFramework/Resource/PipelineResMgr.cpp b/source/MaaFramework/Resource/PipelineResMgr.cpp index 416f1e5ff..58214298e 100644 --- a/source/MaaFramework/Resource/PipelineResMgr.cpp +++ b/source/MaaFramework/Resource/PipelineResMgr.cpp @@ -178,7 +178,7 @@ bool PipelineResMgr::check_next_list(const PipelineData::NextList& next_list, co { for (const auto& next : next_list) { if (!data_map.contains(next)) { - LogError << "Invalid next task name" << VAR(next); + LogError << "Invalid next node name" << VAR(next); return false; } } diff --git a/source/MaaFramework/Task/Component/CustomAction.cpp b/source/MaaFramework/Task/Component/CustomAction.cpp index 8ab3f4adf..ebdef51ec 100644 --- a/source/MaaFramework/Task/Component/CustomAction.cpp +++ b/source/MaaFramework/Task/Component/CustomAction.cpp @@ -6,17 +6,17 @@ MAA_TASK_NS_BEGIN bool CustomAction::run( Context& context, - std::string task_name, + std::string node_name, MAA_RES_NS::CustomActionSession session, const MAA_RES_NS::Action::CustomParam& param, MaaRecoId reco_id, const cv::Rect& rect) { - LogFunc << VAR(context.task_id()) << VAR(task_name) << VAR_VOIDP(session.action) << VAR_VOIDP(session.trans_arg) + LogFunc << VAR(context.task_id()) << VAR(node_name) << VAR_VOIDP(session.action) << VAR_VOIDP(session.trans_arg) << VAR(param.custom_param) << VAR(reco_id) << VAR(rect); if (!session.action) { - LogError << "Action is null" << VAR(task_name) << VAR(param.name); + LogError << "Action is null" << VAR(node_name) << VAR(param.name); return false; } @@ -26,14 +26,14 @@ bool CustomAction::run( bool ret = session.action( &context, context.task_id(), - task_name.c_str(), + node_name.c_str(), param.name.c_str(), custom_param_string.c_str(), reco_id, &crect, session.trans_arg); - LogDebug << VAR(task_name) << VAR_VOIDP(session.action) << VAR(session.trans_arg) << VAR(ret); + LogDebug << VAR(node_name) << VAR_VOIDP(session.action) << VAR(session.trans_arg) << VAR(ret); return ret; } diff --git a/source/MaaFramework/Task/Component/CustomAction.h b/source/MaaFramework/Task/Component/CustomAction.h index e60fa1b88..bf3e93dac 100644 --- a/source/MaaFramework/Task/Component/CustomAction.h +++ b/source/MaaFramework/Task/Component/CustomAction.h @@ -14,7 +14,7 @@ class CustomAction public: static bool run(Context& context, - std::string task_name, + std::string node_name, MAA_RES_NS::CustomActionSession session, const MAA_RES_NS::Action::CustomParam& param, MaaRecoId reco_id, diff --git a/source/MaaFramework/Task/Component/Recognizer.cpp b/source/MaaFramework/Task/Component/Recognizer.cpp index 0c5af3846..3e73568a2 100644 --- a/source/MaaFramework/Task/Component/Recognizer.cpp +++ b/source/MaaFramework/Task/Component/Recognizer.cpp @@ -301,7 +301,7 @@ RecoResult Recognizer::nn_detect(const MAA_VISION_NS::NeuralNetworkDetectorParam RecoResult Recognizer::custom_recognize(const MAA_VISION_NS::CustomRecognitionParam& param, const std::string& name) { using namespace MAA_VISION_NS; - std::ignore = name; // task name + std::ignore = name; // node name if (!tasker_) { LogError << "tasker_ is null"; @@ -366,7 +366,7 @@ cv::Rect Recognizer::get_roi(const MAA_VISION_NS::Target roi) return cv::Rect { raw.x + roi.offset.x, raw.y + roi.offset.y, raw.width + roi.offset.width, raw.height + roi.offset.height }; } -void Recognizer::save_draws(const std::string& task_name, const RecoResult& result) const +void Recognizer::save_draws(const std::string& node_name, const RecoResult& result) const { const auto& option = GlobalOptionMgr::get_instance(); @@ -377,20 +377,20 @@ void Recognizer::save_draws(const std::string& task_name, const RecoResult& resu auto dir = option.log_dir() / "vision"; for (const auto& draw : result.draws) { - std::string filename = std::format("{}_{}_{}.png", task_name, result.reco_id, format_now_for_filename()); + std::string filename = std::format("{}_{}_{}.png", node_name, result.reco_id, format_now_for_filename()); auto filepath = dir / path(filename); imwrite(filepath, draw); LogDebug << "save draw to" << filepath; } } -void Recognizer::show_hit_draw(const cv::Rect& box, const std::string& task_name, MaaRecoId uid) const +void Recognizer::show_hit_draw(const cv::Rect& box, const std::string& node_name, MaaRecoId uid) const { if (!GlobalOptionMgr::get_instance().show_hit_draw()) { return; } - const std::string kWinName = std::format("Hit: {} {}", task_name, uid); + const std::string kWinName = std::format("Hit: {} {}", node_name, uid); cv::Mat draw = image_.clone(); diff --git a/source/MaaFramework/Task/Component/Recognizer.h b/source/MaaFramework/Task/Component/Recognizer.h index d59c840f2..51535357f 100644 --- a/source/MaaFramework/Task/Component/Recognizer.h +++ b/source/MaaFramework/Task/Component/Recognizer.h @@ -34,8 +34,8 @@ class Recognizer RecoResult custom_recognize(const MAA_VISION_NS::CustomRecognitionParam& param, const std::string& name); cv::Rect get_roi(const MAA_VISION_NS::Target roi); - void save_draws(const std::string& task_name, const RecoResult& result) const; - void show_hit_draw(const cv::Rect& box, const std::string& task_name, MaaRecoId uid) const; + void save_draws(const std::string& node_name, const RecoResult& result) const; + void show_hit_draw(const cv::Rect& box, const std::string& node_name, MaaRecoId uid) const; private: bool debug_mode() const; diff --git a/source/MaaFramework/Task/Context.cpp b/source/MaaFramework/Task/Context.cpp index 8c89da57a..3d797642d 100644 --- a/source/MaaFramework/Task/Context.cpp +++ b/source/MaaFramework/Task/Context.cpp @@ -175,11 +175,11 @@ Tasker* Context::tasker() const return tasker_; } -std::optional Context::get_pipeline_data(const std::string& task_name) +std::optional Context::get_pipeline_data(const std::string& node_name) { - auto override_it = pipeline_override_.find(task_name); + auto override_it = pipeline_override_.find(node_name); if (override_it != pipeline_override_.end()) { - LogDebug << "found in override" << VAR(task_name); + LogDebug << "found in override" << VAR(node_name); return override_it->second; } @@ -194,12 +194,12 @@ std::optional Context::get_pipeline_data(const std::strin } auto& raw_data_map = resource->pipeline_res().get_pipeline_data_map(); - auto raw_it = raw_data_map.find(task_name); + auto raw_it = raw_data_map.find(node_name); if (raw_it != raw_data_map.end()) { return raw_it->second; } - LogWarn << "task not found" << VAR(task_name); + LogWarn << "task not found" << VAR(node_name); return std::nullopt; } diff --git a/source/MaaFramework/Task/Context.h b/source/MaaFramework/Task/Context.h index e4d9f0278..e1123dbbf 100644 --- a/source/MaaFramework/Task/Context.h +++ b/source/MaaFramework/Task/Context.h @@ -49,7 +49,7 @@ class Context virtual Tasker* tasker() const override; public: - std::optional get_pipeline_data(const std::string& task_name); + std::optional get_pipeline_data(const std::string& node_name); private: bool check_pipeline() const; diff --git a/source/binding/NodeJS/release/maa-node/src/maa.d.ts b/source/binding/NodeJS/release/maa-node/src/maa.d.ts index 1adbcfa61..83a00b4f7 100644 --- a/source/binding/NodeJS/release/maa-node/src/maa.d.ts +++ b/source/binding/NodeJS/release/maa-node/src/maa.d.ts @@ -280,7 +280,7 @@ export declare function tasker_get_task_detail( ): [entry: string, node_ids: NodeId[], status: Status] | null export declare function tasker_get_latest_node( handle: TaskerHandle, - task_name: string + node_name: string ): NodeId | null // config.cpp