Thanks for sharing this Lidia!
I had a closer look and found that you might not need shiboken2 nor the API
to accomplish this.
from PySide2 import QtWidgetsimport maya.cmds as cmds
window = QtWidgets.QWidget()
window.resize(500,500)
qtLayout = QtWidgets.QVBoxLayout(window)
qtLayout.setObjectName('viewportLayout')
cmds.setParent('viewportLayout')
cmds.modelPanel("embeddedModelPanel#", cam='persp')
window.show()
On 17 March 2017 at 15:57, Lidia Martinez <[email protected]> wrote:
>
> Hi folks,
>
> I published an article about embedding Maya's UI into PySide2 for Maya2017.
>
> http://blog.virtualmethodstudio.com/2017/03/embed-maya-native-ui-
> objects-in-pyside2/
>
> And again after the first fix I included, I had some errors running this
> code in a particular case. Maya was telling me '|' or '||' didn't exist.
>
> As you can see on the EDIT section (which is the second edit of the
> article), I wrote an explanation on how to fix this using
> setObjectName('layout') on the window and layout which generates a better
> UI path: window|layout|... instead of ||, and seems like Maya likes it
> better (I guess why).
>
> But then I found out I could even avoid getting the full name that just
> using setParent('layout') would work without errors instead of using a
> path.
>
>
>
> I wanted to understand why this is working, even when I use the same
> object name with different windows. There's no name clash in Qt, and
> magically Maya's UI understands setParent anyway...
>
> Any idea why this is happening?
>
>
>
> --
> Lidia
>
> --
> 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 [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/python_inside_maya/CAAB1%3D8wqJ%3DBqpP06zQCtYqieqtYiOy62V90AcE
> ps_bXD4WejXg%40mail.gmail.com
> <https://groups.google.com/d/msgid/python_inside_maya/CAAB1%3D8wqJ%3DBqpP06zQCtYqieqtYiOy62V90AcEps_bXD4WejXg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
*Marcus Ottosson*
[email protected]
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOD2NeYiLExwsU5VfhCFDjjDGuOAjLSs_4yn0N-kFsqMPA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.