[API] Is there a way to return a list of nodes from a imported scene using open maya?

71 views
Skip to first unread message

I73

unread,
Sep 20, 2017, 2:38:40 PM9/20/17
to Python Programming for Autodesk Maya
This is not really a python it's a C++ question but Open maya can work here, since there is no 'C++ programming for Autodesk Maya' google group. 

Python 'cmds.file(file, i = True) returns a list of nodes, but looking through the API there is no such function to return that list.

The tool opens a original file (Gets the mesh from the file 'Mesh1') then imports a scene (and I take the mesh from that scene 'Mesh2'), because I have no reference to the 2 mesh nodes (I can't get by name since all them will be different) I can't select the imported mesh node unless I can access the imported node array and return it from that array.

Looking for a way to get these mesh nodes, I can achieve this by namespace but, when I go to save the scene will the namespace still be appended to the exported scene?

Thanks guys, just let me know if this is not following group rules. 

Justin Israel

unread,
Sep 20, 2017, 3:41:44 PM9/20/17
to Python Programming for Autodesk Maya

C++ topics are fine, regardless of the title of the group. We tend to chat about anything related to VFX development, but commonly it is Maya development.

I think your two options through the C++ api are to either

1) save the current list of node, do the import, and then get the difference between the current previous nodes

2) do the import through MGlobal::executeCommand and get the nodes from the command apis high level import

Justin


--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/2fdfb2ac-c4a9-41ea-a55a-16078084b47a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Nicolas Combecave

unread,
Sep 20, 2017, 3:45:46 PM9/20/17
to python_in...@googlegroups.com
Did not test, but there is this flag you can pass to the command:
file -import -returnNewNodes

The doc says it will return the nodes added to the scene...


- Nicolas


2017-09-20 21:41 GMT+02:00 Justin Israel <justin...@gmail.com>:

C++ topics are fine, regardless of the title of the group. We tend to chat about anything related to VFX development, but commonly it is Maya development.

I think your two options through the C++ api are to either

1) save the current list of node, do the import, and then get the difference between the current previous nodes

2) do the import through MGlobal::executeCommand and get the nodes from the command apis high level import

Justin

On Thu, Sep 21, 2017, 6:38 AM I73 <wesley....@iugome.com> wrote:
This is not really a python it's a C++ question but Open maya can work here, since there is no 'C++ programming for Autodesk Maya' google group. 

Python 'cmds.file(file, i = True) returns a list of nodes, but looking through the API there is no such function to return that list.

The tool opens a original file (Gets the mesh from the file 'Mesh1') then imports a scene (and I take the mesh from that scene 'Mesh2'), because I have no reference to the 2 mesh nodes (I can't get by name since all them will be different) I can't select the imported mesh node unless I can access the imported node array and return it from that array.

Looking for a way to get these mesh nodes, I can achieve this by namespace but, when I go to save the scene will the namespace still be appended to the exported scene?

Thanks guys, just let me know if this is not following group rules. 

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA2tAyozOuiSm1s4nKMYc_A946Ee-DwbLmCaziNx0W4Sjg%40mail.gmail.com.

Wesley Keeling

unread,
Sep 20, 2017, 3:50:16 PM9/20/17
to python_in...@googlegroups.com
Currently my work around is importing with a name space. I was thinking of comparing but there is just too many nodes. 

2) do the import through MGlobal::executeCommand and get the nodes from the command apis high level import

Do you have a suggestion on how to do this? I did not know I could return anything other than a MStatus or a MString from executePythonCommandStringResult()

On Wed, Sep 20, 2017 at 12:41 PM, Justin Israel <justin...@gmail.com> wrote:

C++ topics are fine, regardless of the title of the group. We tend to chat about anything related to VFX development, but commonly it is Maya development.

I think your two options through the C++ api are to either

1) save the current list of node, do the import, and then get the difference between the current previous nodes

2) do the import through MGlobal::executeCommand and get the nodes from the command apis high level import

Justin


On Thu, Sep 21, 2017, 6:38 AM I73 <wesley....@iugome.com> wrote:
This is not really a python it's a C++ question but Open maya can work here, since there is no 'C++ programming for Autodesk Maya' google group. 

Python 'cmds.file(file, i = True) returns a list of nodes, but looking through the API there is no such function to return that list.

The tool opens a original file (Gets the mesh from the file 'Mesh1') then imports a scene (and I take the mesh from that scene 'Mesh2'), because I have no reference to the 2 mesh nodes (I can't get by name since all them will be different) I can't select the imported mesh node unless I can access the imported node array and return it from that array.

Looking for a way to get these mesh nodes, I can achieve this by namespace but, when I go to save the scene will the namespace still be appended to the exported scene?

Thanks guys, just let me know if this is not following group rules. 

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.

--
You received this message because you are subscribed to a topic in the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/python_inside_maya/pOpAv-UAW0M/unsubscribe.
To unsubscribe from this group and all its topics, send an email to python_inside_maya+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA2tAyozOuiSm1s4nKMYc_A946Ee-DwbLmCaziNx0W4Sjg%40mail.gmail.com.

Justin Israel

unread,
Sep 20, 2017, 4:00:04 PM9/20/17
to python_in...@googlegroups.com


On Thu, Sep 21, 2017, 7:50 AM Wesley Keeling <wesley....@iugome.com> wrote:
Currently my work around is importing with a name space. I was thinking of comparing but there is just too many nodes. 

2) do the import through MGlobal::executeCommand and get the nodes from the command apis high level import

Do you have a suggestion on how to do this? I did not know I could return anything other than a MStatus or a MString from executePythonCommandStringResult()

executeCommand (and the python variant) have a ton of overloads for different return types. MStringArray is one of them




On Wed, Sep 20, 2017 at 12:41 PM, Justin Israel <justin...@gmail.com> wrote:

C++ topics are fine, regardless of the title of the group. We tend to chat about anything related to VFX development, but commonly it is Maya development.

I think your two options through the C++ api are to either

1) save the current list of node, do the import, and then get the difference between the current previous nodes

2) do the import through MGlobal::executeCommand and get the nodes from the command apis high level import

Justin


On Thu, Sep 21, 2017, 6:38 AM I73 <wesley....@iugome.com> wrote:
This is not really a python it's a C++ question but Open maya can work here, since there is no 'C++ programming for Autodesk Maya' google group. 

Python 'cmds.file(file, i = True) returns a list of nodes, but looking through the API there is no such function to return that list.

The tool opens a original file (Gets the mesh from the file 'Mesh1') then imports a scene (and I take the mesh from that scene 'Mesh2'), because I have no reference to the 2 mesh nodes (I can't get by name since all them will be different) I can't select the imported mesh node unless I can access the imported node array and return it from that array.

Looking for a way to get these mesh nodes, I can achieve this by namespace but, when I go to save the scene will the namespace still be appended to the exported scene?

Thanks guys, just let me know if this is not following group rules. 

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.

--
You received this message because you are subscribed to a topic in the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/python_inside_maya/pOpAv-UAW0M/unsubscribe.
To unsubscribe from this group and all its topics, send an email to python_inside_m...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAAD4CW5BVjsCc%2BnUaYHD%2B2mYxWQ5kKayZ%3DaOd8yoUU%3DJQ38DPw%40mail.gmail.com.

Nicolas Combecave

unread,
Sep 20, 2017, 4:27:59 PM9/20/17
to python_in...@googlegroups.com
Mmmm I just misread the very first mail, where you specify you need to do it with the api..

Sorry for the noise.

2017-09-20 21:59 GMT+02:00 Justin Israel <justin...@gmail.com>:


On Thu, Sep 21, 2017, 7:50 AM Wesley Keeling <wesley....@iugome.com> wrote:
Currently my work around is importing with a name space. I was thinking of comparing but there is just too many nodes. 

2) do the import through MGlobal::executeCommand and get the nodes from the command apis high level import

Do you have a suggestion on how to do this? I did not know I could return anything other than a MStatus or a MString from executePythonCommandStringResult()

executeCommand (and the python variant) have a ton of overloads for different return types. MStringArray is one of them


On Wed, Sep 20, 2017 at 12:41 PM, Justin Israel <justin...@gmail.com> wrote:

C++ topics are fine, regardless of the title of the group. We tend to chat about anything related to VFX development, but commonly it is Maya development.

I think your two options through the C++ api are to either

1) save the current list of node, do the import, and then get the difference between the current previous nodes

2) do the import through MGlobal::executeCommand and get the nodes from the command apis high level import

Justin


On Thu, Sep 21, 2017, 6:38 AM I73 <wesley....@iugome.com> wrote:
This is not really a python it's a C++ question but Open maya can work here, since there is no 'C++ programming for Autodesk Maya' google group. 

Python 'cmds.file(file, i = True) returns a list of nodes, but looking through the API there is no such function to return that list.

The tool opens a original file (Gets the mesh from the file 'Mesh1') then imports a scene (and I take the mesh from that scene 'Mesh2'), because I have no reference to the 2 mesh nodes (I can't get by name since all them will be different) I can't select the imported mesh node unless I can access the imported node array and return it from that array.

Looking for a way to get these mesh nodes, I can achieve this by namespace but, when I go to save the scene will the namespace still be appended to the exported scene?

Thanks guys, just let me know if this is not following group rules. 

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.

--
You received this message because you are subscribed to a topic in the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/python_inside_maya/pOpAv-UAW0M/unsubscribe.
To unsubscribe from this group and all its topics, send an email to python_inside_maya+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA0OMdD3KL6dFtMcfV%2BXdMPy_5%2Bic4PtgOk%2B3xvn1untJg%40mail.gmail.com.

Wesley Keeling

unread,
Sep 20, 2017, 4:47:19 PM9/20/17
to python_in...@googlegroups.com
You are correct, for some reason I missed the ref params :/

On Wed, Sep 20, 2017 at 12:59 PM, Justin Israel <justin...@gmail.com> wrote:


On Thu, Sep 21, 2017, 7:50 AM Wesley Keeling <wesley....@iugome.com> wrote:
Currently my work around is importing with a name space. I was thinking of comparing but there is just too many nodes. 

2) do the import through MGlobal::executeCommand and get the nodes from the command apis high level import

Do you have a suggestion on how to do this? I did not know I could return anything other than a MStatus or a MString from executePythonCommandStringResult()

executeCommand (and the python variant) have a ton of overloads for different return types. MStringArray is one of them




On Wed, Sep 20, 2017 at 12:41 PM, Justin Israel <justin...@gmail.com> wrote:

C++ topics are fine, regardless of the title of the group. We tend to chat about anything related to VFX development, but commonly it is Maya development.

I think your two options through the C++ api are to either

1) save the current list of node, do the import, and then get the difference between the current previous nodes

2) do the import through MGlobal::executeCommand and get the nodes from the command apis high level import

Justin


On Thu, Sep 21, 2017, 6:38 AM I73 <wesley....@iugome.com> wrote:
This is not really a python it's a C++ question but Open maya can work here, since there is no 'C++ programming for Autodesk Maya' google group. 

Python 'cmds.file(file, i = True) returns a list of nodes, but looking through the API there is no such function to return that list.

The tool opens a original file (Gets the mesh from the file 'Mesh1') then imports a scene (and I take the mesh from that scene 'Mesh2'), because I have no reference to the 2 mesh nodes (I can't get by name since all them will be different) I can't select the imported mesh node unless I can access the imported node array and return it from that array.

Looking for a way to get these mesh nodes, I can achieve this by namespace but, when I go to save the scene will the namespace still be appended to the exported scene?

Thanks guys, just let me know if this is not following group rules. 

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.

--
You received this message because you are subscribed to a topic in the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/python_inside_maya/pOpAv-UAW0M/unsubscribe.
To unsubscribe from this group and all its topics, send an email to python_inside_maya+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.

--
You received this message because you are subscribed to a topic in the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/python_inside_maya/pOpAv-UAW0M/unsubscribe.
Reply all
Reply to author
Forward
0 new messages