panel = cmds.getPanel(withFocus=True)cmds.modelEditor(panel, edit=True, imagePlane=True)
--
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/46a4a173-e0a2-41a0-bcac-038118ce7c2b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I use python line (lower left )to test that code and when it works I know it will once viewport is active. When you use script editor it is used as active panel.tomas
st 5. 6. 2019 o 1:06 kiteh <kite...@gmail.com> napísal(a):
What is the best way to check if the current panel is a viewport type?--i am trying to set the 'Image Plane' option (under Show > Image Planes) and currently I am doing it as follows:
panel = cmds.getPanel(withFocus=True)cmds.modelEditor(panel, edit=True, imagePlane=True)
with the assumption that the current panel is a 'valid' viewport.But this will fails, eg. if I am running the above code in my scriptEditor as that is my current focus panel.
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.
Hi Tomas,I totally get what you mean.But say, if I have make my commands into a shelf icon command..And if my last panel, which could be the Outliner or the Attribute Editor, the mostly used panels (viewports too of course) and I hit on that shelf icon command that I did, it will also error out.As such, I asked this question..
On Tuesday, June 4, 2019 at 11:52:00 PM UTC-7, tomas mikulak wrote:
I use python line (lower left )to test that code and when it works I know it will once viewport is active. When you use script editor it is used as active panel.tomas
st 5. 6. 2019 o 1:06 kiteh <kite...@gmail.com> napísal(a):
What is the best way to check if the current panel is a viewport type?--i am trying to set the 'Image Plane' option (under Show > Image Planes) and currently I am doing it as follows:
panel = cmds.getPanel(withFocus=True)cmds.modelEditor(panel, edit=True, imagePlane=True)
with the assumption that the current panel is a 'valid' viewport.But this will fails, eg. if I am running the above code in my scriptEditor as that is my current focus panel.
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/46a4a173-e0a2-41a0-bcac-038118ce7c2b%40googlegroups.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/726fa1b7-fb2b-4e0b-aa6a-70e49a91d5eb%40googlegroups.com.
model_panels = [] focus_panel = cmds.getPanel(withFocus=True) # Check if current panel is a modelPanel if cmds.objectTypeUI(focus_panel) == "modelEditor": cmds.modelEditor(focus_panel, edit=True, imagePlane=True) else: for panel in cmds.lsUI(editors=True): if "modelPanel" in panel: model_panels.append(panel)
for model_panel in model_panels: if cmds.modelEditor(model_panel, query=True, activeView=True): try: cmds.modelEditor(model_panel, edit=True, imagePlane=True) except Exception as e: pass
--
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/365fea6f-4a0a-4ad8-831b-dd80bb545243%40googlegroups.com.