tag:blogger.com,1999:blog-6525999360602726666.post4212558004485017290..comments2023-07-13T04:17:55.388-04:00Comments on Tech Animator Dump: MotionBuilder Python & Window FocusingRandallHhttp://www.blogger.com/profile/14282159002574790673noreply@blogger.comBlogger11125tag:blogger.com,1999:blog-6525999360602726666.post-51469184044300336722011-12-07T09:58:33.937-05:002011-12-07T09:58:33.937-05:00Thank you all for help.
My script running :)
I...Thank you all for help. <br /><br />My script running :) <br /><br />I used OnUIIdle event, like Sune suggested. This event gives me about 20 refreshes per second. MoBu UI "live" all the time. It is great :D <br /><br />Error what I had, was from environment variable for Python.Linkanoreply@blogger.comtag:blogger.com,1999:blog-6525999360602726666.post-13950234236195716822011-11-14T07:32:55.601-05:002011-11-14T07:32:55.601-05:00I'm on 2011 and I don't get these errors. ...I'm on 2011 and I don't get these errors. <br /><br />I know this might be obvious, but do you think there is a chance that you or someone changed something in the script by mistake? Might be worth reverting to the original one, if you have not already.Sunehttp://www.sunekempf.com/blognoreply@blogger.comtag:blogger.com,1999:blog-6525999360602726666.post-21579407572339031032011-11-12T18:18:34.593-05:002011-11-12T18:18:34.593-05:00Sorry, maybe my question has obvious answer, but h...Sorry, maybe my question has obvious answer, but how can I run example: “FBSystemEvents.py”?<br /><br />When I’m trying to run it from Python Editor I’m getting an error: <br /><br />line 50, in Register<br />sys.OnConnectionNotify.Add(OnConnectionNotify)<br />AttributeError: 'NoneType' object has no attribute 'Add'<br /><br />I’m working with MB 2011.<br />Please, give me some hint.Linkanoreply@blogger.comtag:blogger.com,1999:blog-6525999360602726666.post-2273970445199900742011-11-08T10:57:26.249-05:002011-11-08T10:57:26.249-05:00Great, do let us know how that works out!
Cheers ...Great, do let us know how that works out!<br /><br />Cheers :-)Sunehttp://www.sunekempf.com/blognoreply@blogger.comtag:blogger.com,1999:blog-6525999360602726666.post-42739925056205712172011-11-08T07:56:42.134-05:002011-11-08T07:56:42.134-05:00Thank you very much for answers.
Sune, yours appr...Thank you very much for answers. <br />Sune, yours approach with UiIdle event is what I need. My script will be modifying objects on scene based on data collected from the serial port. This data will be put into serial port by external device. Script will be used for scene preparation (setup camera position and angle, move some objects, rotate and scale them on the scene), and if performance will be enough then additionally also for simple motion capture. That's why would be great if UI will be "live".<br /><br />I will look into suggested samples. I will write my result.<br /><br />Thank you.Linkanoreply@blogger.comtag:blogger.com,1999:blog-6525999360602726666.post-25028600063617533732011-11-07T11:36:56.548-05:002011-11-07T11:36:56.548-05:00Hi Linka,
I you are dead set on having your viewp...Hi Linka,<br /><br />I you are dead set on having your viewport update and if you are doing something fairly repetitive on every frame (like animation export or maybe a custom plot method), you can attach calls to your code to the UiIdle event. I've constructed code the will cycle between doing 2-3 different things every iteration and it's not too hairy.<br /><br />That said, this is a bit of a different way of constructing a "script" and might be slightly complicated, depending on where you are at<br /><br />To get a head start you should have a look at FBSystemEvents.py in the Python samples, as well as "impexpsample" in the Open Reality SDK (C++) section.<br /><br />Doing it this way will let you see every update, but your interface will also be "live", so you can actually navigate the viewport, delete objects while the thing is running..<br /><br />All this said, I have no idea if there is an easy way of doing what you want. Or if all you really need is a progress bar :-)<br /><br />Cheers,<br />SuneSunehttp://www.sunekempf.com/blognoreply@blogger.comtag:blogger.com,1999:blog-6525999360602726666.post-73525581866535157322011-11-07T10:45:03.351-05:002011-11-07T10:45:03.351-05:00Sune, I wish I could say there is a working soluti...Sune, I wish I could say there is a working solution to realtime updating but unfortunately there does not seem to be. I will point you to two area forum posts that seem to state that fact. If Kevin has found any additional information that states otherwise I'm sure we'd both be happy to hear it.<br /><br />http://area.autodesk.com/forum/autodesk-motionbuilder/python/how-to-update-the-timeline-cursor-position-realtime-when-running-a-script/<br /><br />http://area.autodesk.com/forum/Autodesk-MotionBuilder/python/iterating-through-per-frame-functions-without-stepforward/RandallHhttps://www.blogger.com/profile/14282159002574790673noreply@blogger.comtag:blogger.com,1999:blog-6525999360602726666.post-5182774195288543642011-11-05T09:30:12.002-04:002011-11-05T09:30:12.002-04:00Hello, I’m new in Python and MoBu, can someone hel...Hello, I’m new in Python and MoBu, can someone help me? I have simple script:<br /><br />from pyfbsdk import *<br />from time import sleep<br /><br />def FindObject(name):<br /> cl = FBComponentList()<br /> FBFindObjectsByName( name, cl, True, False ) <br /> return cl[0]<br /><br />pCube = FindObject("Cube")<br /><br />pCube.Rotation = FBVector3d(0, 0, 10)<br />FBSystem().Scene.Evaluate()<br />sleep(1)<br /><br />pCube.Rotation = FBVector3d(0, 0, 20)<br />FBSystem().Scene.Evaluate()<br />sleep(1)<br /><br />pCube.Rotation = FBVector3d(0, 0, 30)<br /><br />What I have to do to see real-time rotation in viewport? This is very important to me, to have real-time refresh of view. Currently refreshing is done only on end of script execution. Please don’t write that this script is written poorly, this is only example. Thank you very much for any ideas.Linkanoreply@blogger.comtag:blogger.com,1999:blog-6525999360602726666.post-67189875178145302282011-11-03T04:53:01.666-04:002011-11-03T04:53:01.666-04:00Thanks guys for posting this - Just what the docto...Thanks guys for posting this - Just what the doctor ordered!Sunehttp://www.sunekempf.com/blognoreply@blogger.comtag:blogger.com,1999:blog-6525999360602726666.post-87153732367257482372011-10-17T12:50:50.314-04:002011-10-17T12:50:50.314-04:00Fantastic! It works almost as good as my hack! :)
...Fantastic! It works almost as good as my hack! :)<br /><br />Thanks for stopping by and pointing me in the right direction. I couldn't find this anywhere.RandallHhttps://www.blogger.com/profile/14282159002574790673noreply@blogger.comtag:blogger.com,1999:blog-6525999360602726666.post-88226588445147220112011-10-17T10:17:55.288-04:002011-10-17T10:17:55.288-04:00Posted this back on twitter, but though maybe peop...Posted this back on twitter, but though maybe people who read your blog might be interested as well: You can also add a line into the application.txt file: <br />Timing] <br />NoFastIdleOnDeactivate = No <br /><br />This will make the UI update (at least the viewer) without being in focus.<br /><br />- KevinAnonymousnoreply@blogger.com