Also includes some minor refactoring: use guard clauses instead of nested conditionals.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D4238
Free the BVH tree immediately along with the mesh, otherwise we might access
invalid mesh data.
Differential Revision: https://developer.blender.org/D4201
After rename is done we need to make sure all copies of
corresponding datablocks are updated in all dependency
graphs: otherwise bone will have a new name, but animation
will still be using an old one.
The issue was caused by intermediate DerivedMesh being created with
scene's Simplify settings taken into account. This is what happens
when one area makes implicit decisions based on whether passed Scene
pointer is not NULL.
Made it so ignoring simplification serttings is an explicit flag,
which makes it easier to follow what's going on.
This is actually a workaround for the crash in OpenSubdiv.
Topology refiner will have a crash when special conditions
are met:
- Refiner is configured to use infinitely sharp patches.
- Refinement happens for the level 1 (which we call Quality 1 on
Blender side).
- Mesh has non-quad faces.
The workaround is to force refinement to happen to level 2 (or
quality 2 on Blender side) when those conditions are met.
Later on with the next OpenSubdiv update we can remove this
workaround, since there was work done on OpenSubdiv side to
deal better with such configurations.
The modifier will now be somewhat slower, but this will be
compensated with upcoming topology cache enabled by default.
The workaround is done when initializing settings, so the
comparison of topology refiner settings is happening without
any extra workarounds there.
Add 'G_draw' for all draw manager globals,
avoids adding extern to each file.
Connection between `ts` and `globals_ubo` wasn't obvious,
now called `G_draw.block` & `G_draw.block_ubo`.
While verbose, this is a more flexible way to construct shaders.
Libs & defines can be optionally included for each shader type
which was previously done with inline string creation.