About using a script to take screenshots automatically
The logic of my script is as follows.I am using PiXYZStudio. I edited a script to traverse the node tree of the imported model and save the screenshots of each part in turn, but I encountered some problems.
Logic of the script
path = r"G:/task/screenshots/"
occurrence = 304116
core.setProperty(occurrence,"Visible","False")
view.showHidden(True)
view.fit([occurrence])
filePath = path + "0601-test1.png"
view.takeScreenshot(filePath, -1)
core.setProperty(occurrence,"Visible","True")
occurrence = 304117
core.setProperty(occurrence,"Visible","False")
view.fit([occurrence])
filePath = path + "0601-test2.png"
view.takeScreenshot(filePath, -1)
core.setProperty(occurrence,"Visible","True")
First, I make the node that needs to be showed become "hidden", and then switch the display mode of the scene so that the hidden part is displayed and the part that is not hidden is not displayed. At this time, I take a screenshot. Finally, I change the attributes of the node back to normal(not hidden), and then operate the next node.
1. My problems
However, the problem is that the screenshot obtained in this way always has nothing, or it is always the whole model, rather than the appearance of the node i need.
2. Other
When I execute my scripts separately, I first select a part of the code to execute, so that the nodes become hidden and the scene switches the display mode. I see that only the node i need is left in the scene. At this time, I select the rest of the code to execute and use the screenshot function. When the script is executed separately, my screenshot results are correct.
3. Hope any help please
I would like to ask what may have caused this. Is it the view rendering of the software, the synchronous execution of the program, or what other possibilities? It may be a stupid problem, but I can't solve it now. I hope to get help.Thanks so much.
[1]: /storage/temp/197023-result2.png
[2]: /storage/temp/197022-correctresult.png
Your answer

Follow this Question
Related Questions
iphone capture screen and send to server 2 Answers
Unity3d Texture2D.ReadPixels problem when convert to sprite. 0 Answers
Update image at runtime? 0 Answers
ReadPixels returns empty texture 0 Answers
gameview capture in realtime 1 Answer