Replace name attribute with setters and getters in the C API of mjSpec.
PiperOrigin-RevId: 778816015 Change-Id: Ieffb7a5bce37e887ff009f9a02d2434435e79ca1
This commit is contained in:
committed by
Copybara-Service
parent
1c5d47c94b
commit
594e17074a
@@ -747,6 +747,7 @@ void mjCDef::NameSpace(const mjCModel* m) {
|
||||
|
||||
void mjCDef::CopyWithoutChildren(const mjCDef& other) {
|
||||
name = other.name;
|
||||
elemtype = other.elemtype;
|
||||
parent = nullptr;
|
||||
child.clear();
|
||||
joint_ = other.joint_;
|
||||
@@ -780,7 +781,6 @@ void mjCDef::PointToLocal() {
|
||||
tendon_.PointToLocal();
|
||||
actuator_.PointToLocal();
|
||||
spec.element = static_cast<mjsElement*>(this);
|
||||
spec.name = &name;
|
||||
spec.joint = &joint_.spec;
|
||||
spec.geom = &geom_.spec;
|
||||
spec.site = &site_.spec;
|
||||
@@ -1261,7 +1261,6 @@ void mjCBody::ResetId() {
|
||||
|
||||
void mjCBody::PointToLocal() {
|
||||
spec.element = static_cast<mjsElement*>(this);
|
||||
spec.name = &name;
|
||||
spec.childclass = &classname;
|
||||
spec.userdata = &spec_userdata_;
|
||||
spec.plugin.plugin_name = &plugin_name;
|
||||
@@ -2310,7 +2309,6 @@ bool mjCFrame::IsAncestor(const mjCFrame* child) const {
|
||||
|
||||
void mjCFrame::PointToLocal() {
|
||||
spec.element = static_cast<mjsElement*>(this);
|
||||
spec.name = &name;
|
||||
spec.childclass = &classname;
|
||||
spec.info = &info;
|
||||
}
|
||||
@@ -2461,7 +2459,6 @@ mjtNum* mjCJoint::qvel(const std::string& state_name) {
|
||||
|
||||
void mjCJoint::PointToLocal() {
|
||||
spec.element = static_cast<mjsElement*>(this);
|
||||
spec.name = &name;
|
||||
spec.userdata = &spec_userdata_;
|
||||
spec.info = &info;
|
||||
userdata = nullptr;
|
||||
@@ -2659,7 +2656,6 @@ mjCGeom& mjCGeom::operator=(const mjCGeom& other) {
|
||||
// to be called after any default copy constructor
|
||||
void mjCGeom::PointToLocal(void) {
|
||||
spec.element = static_cast<mjsElement*>(this);
|
||||
spec.name = &name;
|
||||
spec.info = &info;
|
||||
spec.userdata = &spec_userdata_;
|
||||
spec.material = &spec_material_;
|
||||
@@ -3481,7 +3477,6 @@ mjCSite& mjCSite::operator=(const mjCSite& other) {
|
||||
|
||||
void mjCSite::PointToLocal() {
|
||||
spec.element = static_cast<mjsElement*>(this);
|
||||
spec.name = &name;
|
||||
spec.info = &info;
|
||||
spec.material = &spec_material_;
|
||||
spec.userdata = &spec_userdata_;
|
||||
@@ -3642,7 +3637,6 @@ mjCCamera& mjCCamera::operator=(const mjCCamera& other) {
|
||||
|
||||
void mjCCamera::PointToLocal() {
|
||||
spec.element = static_cast<mjsElement*>(this);
|
||||
spec.name = &name;
|
||||
spec.userdata = &spec_userdata_;
|
||||
spec.targetbody = &spec_targetbody_;
|
||||
spec.info = &info;
|
||||
@@ -3800,7 +3794,6 @@ mjCLight& mjCLight::operator=(const mjCLight& other) {
|
||||
|
||||
void mjCLight::PointToLocal() {
|
||||
spec.element = static_cast<mjsElement*>(this);
|
||||
spec.name = &name;
|
||||
spec.targetbody = &spec_targetbody_;
|
||||
spec.texture = &spec_texture_;
|
||||
spec.info = &info;
|
||||
@@ -3920,7 +3913,6 @@ mjCHField& mjCHField::operator=(const mjCHField& other) {
|
||||
|
||||
void mjCHField::PointToLocal() {
|
||||
spec.element = static_cast<mjsElement*>(this);
|
||||
spec.name = &name;
|
||||
spec.file = &spec_file_;
|
||||
spec.content_type = &spec_content_type_;
|
||||
spec.userdata = &spec_userdata_;
|
||||
@@ -4185,7 +4177,6 @@ mjCTexture& mjCTexture::operator=(const mjCTexture& other) {
|
||||
|
||||
void mjCTexture::PointToLocal() {
|
||||
spec.element = static_cast<mjsElement*>(this);
|
||||
spec.name = &name;
|
||||
spec.file = &spec_file_;
|
||||
spec.data = &data_;
|
||||
spec.content_type = &spec_content_type_;
|
||||
@@ -5054,7 +5045,6 @@ mjCMaterial& mjCMaterial::operator=(const mjCMaterial& other) {
|
||||
|
||||
void mjCMaterial::PointToLocal() {
|
||||
spec.element = static_cast<mjsElement*>(this);
|
||||
spec.name = &name;
|
||||
spec.textures = &spec_textures_;
|
||||
spec.info = &info;
|
||||
textures = nullptr;
|
||||
@@ -5144,7 +5134,6 @@ mjCPair& mjCPair::operator=(const mjCPair& other) {
|
||||
|
||||
void mjCPair::PointToLocal() {
|
||||
spec.element = static_cast<mjsElement*>(this);
|
||||
spec.name = &name;
|
||||
spec.geomname1 = &spec_geomname1_;
|
||||
spec.geomname2 = &spec_geomname2_;
|
||||
geomname1 = nullptr;
|
||||
@@ -5367,7 +5356,6 @@ mjCBodyPair& mjCBodyPair::operator=(const mjCBodyPair& other) {
|
||||
|
||||
void mjCBodyPair::PointToLocal() {
|
||||
spec.element = static_cast<mjsElement*>(this);
|
||||
spec.name = &name;
|
||||
spec.bodyname1 = &spec_bodyname1_;
|
||||
spec.bodyname2 = &spec_bodyname2_;
|
||||
spec.info = &info;
|
||||
@@ -5502,7 +5490,6 @@ mjCEquality& mjCEquality::operator=(const mjCEquality& other) {
|
||||
|
||||
void mjCEquality::PointToLocal() {
|
||||
spec.element = static_cast<mjsElement*>(this);
|
||||
spec.name = &name;
|
||||
spec.name1 = &spec_name1_;
|
||||
spec.name2 = &spec_name2_;
|
||||
spec.info = &info;
|
||||
@@ -5679,7 +5666,6 @@ bool mjCTendon::is_actfrclimited() const {
|
||||
|
||||
void mjCTendon::PointToLocal() {
|
||||
spec.element = static_cast<mjsElement*>(this);
|
||||
spec.name = &name;
|
||||
spec.material = &spec_material_;
|
||||
spec.userdata = &spec_userdata_;
|
||||
spec.info = &info;
|
||||
@@ -6225,7 +6211,6 @@ mjtNum& mjCActuator::ctrl(const std::string& state_name) {
|
||||
|
||||
void mjCActuator::PointToLocal() {
|
||||
spec.element = static_cast<mjsElement*>(this);
|
||||
spec.name = &name;
|
||||
spec.userdata = &spec_userdata_;
|
||||
spec.target = &spec_target_;
|
||||
spec.refsite = &spec_refsite_;
|
||||
@@ -6563,7 +6548,6 @@ mjCSensor& mjCSensor::operator=(const mjCSensor& other) {
|
||||
|
||||
void mjCSensor::PointToLocal() {
|
||||
spec.element = static_cast<mjsElement*>(this);
|
||||
spec.name = &name;
|
||||
spec.userdata = &spec_userdata_;
|
||||
spec.objname = &spec_objname_;
|
||||
spec.refname = &spec_refname_;
|
||||
@@ -7103,7 +7087,6 @@ mjCNumeric& mjCNumeric::operator=(const mjCNumeric& other) {
|
||||
|
||||
void mjCNumeric::PointToLocal() {
|
||||
spec.element = static_cast<mjsElement*>(this);
|
||||
spec.name = &name;
|
||||
spec.data = &spec_data_;
|
||||
spec.info = &info;
|
||||
data = nullptr;
|
||||
@@ -7193,7 +7176,6 @@ mjCText& mjCText::operator=(const mjCText& other) {
|
||||
|
||||
void mjCText::PointToLocal() {
|
||||
spec.element = static_cast<mjsElement*>(this);
|
||||
spec.name = &name;
|
||||
spec.data = &spec_data_;
|
||||
spec.info = &info;
|
||||
data = nullptr;
|
||||
@@ -7274,7 +7256,6 @@ mjCTuple& mjCTuple::operator=(const mjCTuple& other) {
|
||||
|
||||
void mjCTuple::PointToLocal() {
|
||||
spec.element = static_cast<mjsElement*>(this);
|
||||
spec.name = &name;
|
||||
spec.objtype = (mjIntVec*)&spec_objtype_;
|
||||
spec.objname = &spec_objname_;
|
||||
spec.objprm = &spec_objprm_;
|
||||
@@ -7410,7 +7391,6 @@ mjCKey& mjCKey::operator=(const mjCKey& other) {
|
||||
|
||||
void mjCKey::PointToLocal() {
|
||||
spec.element = static_cast<mjsElement*>(this);
|
||||
spec.name = &name;
|
||||
spec.qpos = &spec_qpos_;
|
||||
spec.qvel = &spec_qvel_;
|
||||
spec.act = &spec_act_;
|
||||
@@ -7556,7 +7536,6 @@ mjCPlugin::mjCPlugin(mjCModel* _model) {
|
||||
mjs_defaultPlugin(&spec);
|
||||
elemtype = mjOBJ_PLUGIN;
|
||||
spec.plugin_name = &plugin_name;
|
||||
spec.name = &name;
|
||||
spec.info = &info;
|
||||
|
||||
PointToLocal();
|
||||
|
||||
Reference in New Issue
Block a user