-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Blender 2.8 Compatibility #35
Conversation
Changes files to compatibility with 2.80 API
Blender 2.8 compat
@luketimothyjones help appreciated on the random segfaults - is this an issue you are having? I'm on max which could also be a factor |
Will give it a test in a bit. Need to get Blender 2.8 installed. |
@friggog Blender 2.8 on Win10 x64 is crashing with EXCEPTION_ACCESS_VIOLATION on generation. We've experienced this issue before, it happens when trying to access objects in |
testing this with final released blender 2.8 works perfect! the only problem i had was to enable convert to mesh after generation exportet gltf/glb file looks good on https://gltf-viewer.donmccurdy.com/ |
@friggog Run through this for a full list of 2.8 gotcha's |
While in pursuit of the cause of crashing, I noticed a weird behavior with the logging of stem creation:
The repeat logging of "0 stems made" is not something that I've seen before and is a little worrisome. |
Thanks @luketimothyjones that link is super helpful - could take a while to find where the issue actually is though :( Might be a while again before I can have a crack at it, but at least we're making progress! |
Did a bit of investigation and it seems to be crashing in the secondary thread. Forcing the branch generation to run on the main thread prevents the crash, so it seems like it is a threading issue with the branch generation (perhaps due to the insane recursion going on). As the blender docs recommend, the One fix is to just execute on the main thread, though this isn't ideal - @luketimothyjones I'd welcome you to have a go at further debugging based on my findings as you implemented the original threading stuff ;) PS |
I'll take a look at the threading implementation when I have some free time, though I can make no guarantees as to when that will be. From the very beginning I labeled it as "hacky" due to Blender's lack of thread safety, so that may be finally catching up with us haha. I've played with the alternatives to FINISHED in the past and I don't remember what the issues I ran into were, but if I recall correctly there's a reason I went with FINISHED. There are undoubtedly several things that are broken / unstable at present, but given the attention to threading that the 2.8 "gotchas" article gave (that was not present in 2.7's), I have a feeling that there were some changes to the underlying C that have thrown a wrench in some of the hacky things we've been doing. |
So I've done some testing and have made a few interesting observations. The crashes are 100% the fault of threading because we are 100% doing things that are not supported by Blender. According to the gotcha's page linked above, threads MUST terminate before a script ends execution (eg, the main operator returns FINISHED), otherwise it "may seem to work for a while but end up causing random crashes or errors in Blender’s own drawing code," which pretty accurately describes the behavior we're seeing. By changing With that said, there is some good news. The other unsupported use of threading that we're doing seems to work fine haha. The separate thread that handles console logging (causing a drastic increase in generation speed) does not cause crashes; I assume this is because it is using an inherently thread-safe data structure (threading.Queue) for data transfer, and because it does not use any Blender functionality. In conclusion, our luck appears to have run out on (ab)using threads in the 2.8 version, and we will likely need to go back to seizing up the Blender GUI in order to not cause memory violation crashes. Fortunately, generation progress can be seen in the console, and somehow the leaf generation percentage complete cursor periodically works. If we cannot find a work-around, the only solution is to await proper thread-safety from the Blender API, which may never come (given the difficulty in doing so that I've seen alluded to by Blender Foundation programmers.) |
So I spent the majority of yesterday playing around with various work-arounds including but not limited to reworking the entire threading system, switching entirely to modal operators, ensuring Python-side references got held as long as possible, and had zero luck. I cannot find a way to work around the memory access violations. Unfortunately, as per my previous comment, I think we're out of luck. |
…ding-fixes Remove primary execution thread in Blender 2.8
Intending to merge 2.8 to master and leave 2.79 compatible version on secondary branch (blender-279)
TODO:
See #18 for discussion