0

How can I construct an MObject with Maya API having access to only the existing object name in the scene?

Yasin
  • 609
  • 1
  • 10
  • 22

2 Answers2

2

It was easy actually!

MSelectionList selection; selection.add(MString(objName)); selection.getDependNode(0, object);

Yasin
  • 609
  • 1
  • 10
  • 22
1

It's a bit more idiomatic to use MGlobal.getSelectionListByName() which does the same thing.

theodox
  • 12,028
  • 3
  • 23
  • 36