Wow Justin. Thanks for showing us that example. It's great reference. Do you cover that in your cmiVFX tutorial too?
Panupat C. On Mon, Nov 21, 2011 at 10:07 AM, Justin Israel <[email protected]> wrote: > Hah, ya I had a feeling. > Now that I am home, I was able to write out an example: > https://gist.github.com/1381489 > Its more complicated because you have to use sip and the MQtUtil function to > translate between maya node paths, and QObjects/QWidgets > Here is what the script is doing: > 1. Create the layout in PyQt > 2. Unwrap it from python into a pointer using sip > 3. use the pointer to get the full maya node path > 4. set it as the UI parent > Then you create the model panel using the commands module > 1. Get a pointer to the underlying widget of the model panel > 2. wrap that into a python QObject using sip > 3. Add that new object into your layout. > I also added a repaint in the show() method for the QDialog because maya > likes to really lag in repainting its interface sometimes, so you wouldnt > see the camera redrawn until you interacted with it otherwise. > Let me know if any of that example is unclear. Maybe there is a better way > to do this, but this way works fine. > -- justin > > > On Nov 20, 2011, at 6:18 PM, 张宇 wrote: > > Thanks for your reply Justin, I am using pyqt not just the qtDesigner, how > to do that with pyqt? > > Http://zhangyu.me > > 在 2011-11-21,4:38,Justin Israel <[email protected]> 写道: > > Hey there, > > You didn't specify if you were actually using PyQt or not. I'm going to > assume you want to just use Qt Designer, > > and then be able to add your modelPanel to the window. There really isnt > much different from creating this purely in the maya ui commands. > > win = cmds.loadUI(f="windowTest.ui") > > cmds.setParent(win) > > cmds.paneLayout() > > m = cmds.modelPanel() > > cmds.modelPanel(m, e=True, cam="myCamera") > > cmds.showWindow( win ) > > cmds.refresh(f=True) > > In my "windowTest.ui" file, I simply created a dialog with nothing in it. > And I have a camera in my scene called "myCamera" > > Sometimes the new maya ui kinda lags in refreshing itself, so you would have > to interact with the new dialog sometimes to > > get the camera to redraw. > > Are you trying to do this via PyQt? That would have a few more steps since > you need to translate between maya node paths and actual Qt widgets. > > -- justin > > > > On Nov 20, 2011, at 9:08 AM, 宇 wrote: > > I want to embed a maya's modelPanel to a Qt's Layout, but i don't know > > how? > > I just know you can create a window and layouts in QtDesigner and > > create the buttons or other controls with coding by PyQt. > > But if i want to create a modelPanel with my own camera embed to the > > widow created by qt, how? > > My english is not good, if you know what i mean, please give me an > > answer . > > -- > > view archives: http://groups.google.com/group/python_inside_maya > > change your subscription settings: > http://groups.google.com/group/python_inside_maya/subscribe > > -- > > view archives: http://groups.google.com/group/python_inside_maya > > change your subscription settings: > http://groups.google.com/group/python_inside_maya/subscribe > > -- > view archives: http://groups.google.com/group/python_inside_maya > change your subscription settings: > http://groups.google.com/group/python_inside_maya/subscribe > > -- > view archives: http://groups.google.com/group/python_inside_maya > change your subscription settings: > http://groups.google.com/group/python_inside_maya/subscribe > -- view archives: http://groups.google.com/group/python_inside_maya change your subscription settings: http://groups.google.com/group/python_inside_maya/subscribe
