Skip to content

Commit

Permalink
fix stubs for DagModifier and reformat docstings.
Browse files Browse the repository at this point in the history
  • Loading branch information
Muream committed Jun 14, 2021
1 parent 669fc7f commit 3b4ccd4
Showing 1 changed file with 36 additions and 30 deletions.
66 changes: 36 additions & 30 deletions src/MDagModifier.inl
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
#define _doc_DagModifier_createNode \
"Adds an operation to the modifier to create a DAG node of the\n"\
"specified type.\n"\
"\n"\
"If a parent DAG node is provided the new node will be parented\n"\
"under it.\n"\
"If no parent is provided and the new DAG node is a transform type then\n"\
"it will be parented under the world.\n"\
"In both of these cases the method returns the new DAG node.\n"\
"\n"\
"If no parent is provided and the new DAG node is not a transform type\n"\
"then a transform node will be created and the child parented under that.\n"\
"The new transform will be parented under the world and it is\n"\
"the transform node which will be returned by the method, not the child.\n"\
"\n"\
"None of the newly created nodes will be added to the DAG until\n"\
"the modifier's doIt() method is called.\n"\

#define _doc_DagModifier_reparentNode \
"Adds an operation to the modifier to reparent a DAG node under\n"\
"a specified parent.\n"\
"\n"\
"If no parent is provided then the DAG node will be reparented under\n"\
"the world, so long as it is a transform type.\n"\
"If it is not a transform type then the doIt() will raise a RuntimeError."


#include "MDGModifier.inl"

py::class_<MDagModifier, MDGModifier>(m, "DagModifier")
Expand Down Expand Up @@ -30,18 +57,9 @@ py::class_<MDagModifier, MDGModifier>(m, "DagModifier")
CHECK_STATUS(status)

return result;
},
R"pbdoc(Adds an operation to the modifier to create a DAG node of the specified type.
If a parent DAG node is provided the new node will be parented under it.
If no parent is provided and the new DAG node is a transform type then it will be parented under the world.
In both of these cases, the method returns the new DAG node.
If no parent is provided and the new DAG node is not a transform type
then a transform node will be created and the child parented under that.
The new transform will be parented under the world \
and it is the transform node which will be returned by the method, not the child.
None of the newly created nodes will be added to the DAG until the modifier's doIt() method is called.)pbdoc")
}, py::arg("type"),
py::arg_v("parent", MObject::kNullObj, "Object.kNullObj"),
_doc_DagModifier_createNode)

.def("createNode", [](MDagModifier & self, MTypeId typeId, MObject parent = MObject::kNullObj) -> MObject {
if (!parent.isNull())
Expand Down Expand Up @@ -71,19 +89,9 @@ None of the newly created nodes will be added to the DAG until the modifier's do
CHECK_STATUS(status)

return result;
},
R"pbdoc(Adds an operation to the modifier to create a DAG node of the specified type.
If a parent DAG node is provided the new node will be parented under it.
If no parent is provided and the new DAG node is a transform type then it will be parented under the world.
In both of these cases the method returns the new DAG node.
If no parent is provided and the new DAG node is not a transform type
then a transform node will be created and the child parented under that.
The new transform will be parented under the world \
and it is the transform node which will be returned by the method, not the child.
None of the newly created nodes will be added to the DAG until the modifier's doIt() method is called.)pbdoc")
}, py::arg("typeId"),
py::arg_v("parent", MObject::kNullObj, "Object.kNullObj"),
_doc_DagModifier_createNode)

.def("reparentNode", [](MDagModifier & self, MObject node, MObject newParent = MObject::kNullObj) {
validate::is_not_null(node, "Cannot reparent a null object.");
Expand Down Expand Up @@ -140,8 +148,6 @@ None of the newly created nodes will be added to the DAG until the modifier's do
MStatus status = self.reparentNode(node, newParent);

CHECK_STATUS(status)
},
R"pbdoc(Adds an operation to the modifier to reparent a DAG node under a specified parent.
If no parent is provided then the DAG node will be reparented under the world, so long as it is a transform type.
If it is not a transform type then the doIt() will raise a RuntimeError.)pbdoc");
}, py::arg("node"),
py::arg_v("newParent", MObject::kNullObj, "Object.kNullObj"),
_doc_DagModifier_reparentNode);

0 comments on commit 3b4ccd4

Please sign in to comment.