Replace mjs_setActivePlugins with mjs_activatePlugin.
PiperOrigin-RevId: 680613007 Change-Id: Ic03e0dc42a1f5f083e313672bc6e3ccebadc58b3
This commit is contained in:
committed by
Copybara-Service
parent
cf13413c0b
commit
6832df3091
@@ -29,6 +29,7 @@
|
||||
#include <string_view>
|
||||
#include <thread>
|
||||
#include <unordered_map>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <mujoco/mjdata.h>
|
||||
@@ -4450,6 +4451,23 @@ bool mjCModel::CopyBack(const mjModel* m) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void mjCModel::ActivatePlugin(const mjpPlugin* plugin, int slot) {
|
||||
bool already_declared = false;
|
||||
for (const auto& [existing_plugin, existing_slot] : active_plugins_) {
|
||||
if (plugin == existing_plugin) {
|
||||
already_declared = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!already_declared) {
|
||||
active_plugins_.emplace_back(std::make_pair(plugin, slot));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void mjCModel::ResolvePlugin(mjCBase* obj, const std::string& plugin_name,
|
||||
const std::string& plugin_instance_name, mjCPlugin** plugin_instance) {
|
||||
// if plugin_name is specified, check if it is in the list of active plugins
|
||||
|
||||
Reference in New Issue
Block a user