Alexey Vanzhula Posted December 3, 2013 Author Share Posted December 3, 2013 Yes, you right. Quote Link to comment Share on other sites More sharing options...
Alexey Vanzhula Posted December 3, 2013 Author Share Posted December 3, 2013 So if at least one viewport show: 1. get window with ID=0 -> main window 2. get window with ID=1 -> viewport window it is good But if all viewports in currect desktop are hidden and opened at least one floating window - we get wrong viewport window (with ID=1) So, i need something like isFloatingWindow() Quote Link to comment Share on other sites More sharing options...
Alexey Vanzhula Posted December 3, 2013 Author Share Posted December 3, 2013 (edited) Other question: Is it possible to add callback for change window size? I dont find solution Edited December 3, 2013 by Alexey Vanzhula Quote Link to comment Share on other sites More sharing options...
Guest mantragora Posted December 3, 2013 Share Posted December 3, 2013 (edited) if all viewports in currect desktop are hidden and opened at least one floating window - we get wrong viewport window (with ID=1) So, i need something like isFloatingWindow() Look at enum RE_WindowType: http://www.sidefx.com/docs/hdk13.0/_r_e___types_8h_source.html cout << currentWindow->getWindowType() << endl; Main Window will return 0, that means RE_WINDOW_MAIN. Viewport will return 6, that means RE_WINDOW_CHILD. And it return 6 even if we tear of pane. Other windows (tooltips, parameter etc) return other values. I don't know is there any other window that return 6 beside another viewport. Edited December 3, 2013 by mantragora Quote Link to comment Share on other sites More sharing options...
Alexey Vanzhula Posted December 3, 2013 Author Share Posted December 3, 2013 I have a problem. When i change viewport size it gives me wrong x and y components ( w and h change normally ) look at this video: http://youtu.be/Xq8sCFyiUTQ Quote Link to comment Share on other sites More sharing options...
Guest mantragora Posted December 3, 2013 Share Posted December 3, 2013 (edited) Drag&drop your node to python shell and call on it cook(), so you should get something like this: hou.node('yournode').cook(force=True) Now try to change viewport size, then execute the same line in pythonshell and press button on your node. Does it help? Edited December 3, 2013 by mantragora Quote Link to comment Share on other sites More sharing options...
Alexey Vanzhula Posted December 3, 2013 Author Share Posted December 3, 2013 It does not help Quote Link to comment Share on other sites More sharing options...
Guest mantragora Posted December 3, 2013 Share Posted December 3, 2013 Than you are doing something wrong. If I don't recook the node I also get incorrect reading if I rescale viewport. But when I added to my button callback cook() it updates values correctly. Quote Link to comment Share on other sites More sharing options...
Guest mantragora Posted December 3, 2013 Share Posted December 3, 2013 You got some code in your button callback field? add after your callback cook(), so it look like this: yourcallback(), hou.pwd().cook(True) Does it help? Quote Link to comment Share on other sites More sharing options...
Alexey Vanzhula Posted December 3, 2013 Author Share Posted December 3, 2013 (edited) It is very funny: http://youtu.be/qL224l037RI As you can see if i simple press mouse button on size-border after drag it (and before next update callback) - it updates normally. Any ideas... Edited December 3, 2013 by Alexey Vanzhula Quote Link to comment Share on other sites More sharing options...
Alexey Vanzhula Posted December 3, 2013 Author Share Posted December 3, 2013 You got some code in your button callback field? add after your callback cook(), so it look like this: yourcallback(), hou.pwd().cook(True) Does it help? Yes i added cook before and after callback - nothing changed Quote Link to comment Share on other sites More sharing options...
Guest mantragora Posted December 3, 2013 Share Posted December 3, 2013 I don't know. Can't say anything without testing this myself. It may be only Linux thing. Quote Link to comment Share on other sites More sharing options...
Alexey Vanzhula Posted December 3, 2013 Author Share Posted December 3, 2013 (edited) this is my quick test (button callback) code import inlinecppdef alignMayaViewport( node ): mymodule = inlinecpp.createLibrary( name='test', acquire_hom_lock=False, includes= ''' #include <RE/RE_Render.h>" #include <RE/RE_window.h>" ''', structs=[("IntArray", "*i")], function_sources=[ """ IntArray test() { RE_Render* render = RE_Render::getMainRender(); RE_WindowList* winList = render->getWindowList(); int winCount = winList->getNumWindows(); int i=0; while (i < winCount) { RE_Window* win = winList->getWindow(i); if ( win->getWindowType() == 6 ) { int ints[] = {win->getX(), win->getY(), win->getW(), win->getH()}; std::vector<int> vec (ints, ints + sizeof(ints) / sizeof(int) ); return vec; } i++; } int ints[] = {0, 0, 0, 0}; std::vector<int> vec (ints, ints + sizeof(ints) / sizeof(int) ); return vec; } """]) l = mymodule.test() # print l[0], l[1], l[2], l[3] # exec_ send cmd to Maya via commandPort exec_( 'ui.qMayawindow.move({0},{1}); ui.qMayawindow.resize({2},{3})'.format(l[0],l[1],l[2],l[3]), node )[/CODE] Edited December 3, 2013 by Alexey Vanzhula Quote Link to comment Share on other sites More sharing options...
Guest mantragora Posted December 3, 2013 Share Posted December 3, 2013 If you print values, do you always get correct ones? On Windows it looks like it updates them correctly. Quote Link to comment Share on other sites More sharing options...
Alexey Vanzhula Posted December 3, 2013 Author Share Posted December 3, 2013 No. But If i click on border before update it return valid values. I also think that it is linux problem. I tried a few window mangers - same result. Quote Link to comment Share on other sites More sharing options...
Alexey Vanzhula Posted December 3, 2013 Author Share Posted December 3, 2013 Can you show your test code? Quote Link to comment Share on other sites More sharing options...
Guest mantragora Posted December 3, 2013 Share Posted December 3, 2013 I took yours and added just button with callback to my node and also moved inlinecpp module outside of you function. I'm just calling it inside and printing values. This is all I can check since I don't have Maya. Quote Link to comment Share on other sites More sharing options...
Guest mantragora Posted December 3, 2013 Share Posted December 3, 2013 (edited) The only moment I get incorrect corner position is when I tearOff viewport pane. Then it always prints position as [12,119]. Beside this situation it updates OK. ACTUALLY, It is correct if I tear off pane too BUT I just realized that viewport corner is counted from its parent corner. So if your viewport is inside your MainWindow and you move your MainWindow, to get correct corner position for the whole screen you need to take into account both positions. If you tearoff viewport to separate window it always shows position as [12,119] because it doesn't change it's position like it is when you change pane size inside main window. In this situation the only changing value is the position of parent window that keeps the viewport. Edited December 3, 2013 by mantragora Quote Link to comment Share on other sites More sharing options...
Alexey Vanzhula Posted December 3, 2013 Author Share Posted December 3, 2013 (edited) Most likely it is not possible with HDK, but nevertheless... I need to emulate click on any pane border (border that change size of pane). And in general: how to emulate mouse click? I see HDK documentation and think that it is possible but i still the layman in these questions ) Edited December 4, 2013 by Alexey Vanzhula Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.