Blender Git Commit Log
Git Commits -> Revision ed50095
Revision ed50095 by Ish Bosamiya (soc-2021-adaptive-cloth) July 1, 2021, 13:04 (GMT) |
adaptive_cloth: MeshIO: read DNA Mesh The conversion was easy enough but the test case for this is extremely difficult. Creating `Mesh` is not possible without initializing `idtype` using `BKE_idtype_init()` (there should actually be a check for this, at least in debug mode). Converting this `Mesh` to `BMesh` is simple without any hassles. Using the `BMesh`, create a cube. Now turns out that is also simple if `BMO_op_callf()` is known about. The previous approach was to create a copy of the code in `bmo_primitive.c` and use that. This also leads to problems because without the `BMOperator` functions pre-applied on the `BMesh`, `BMO_face_flag_enable()` crashes without any proper indication of what could have caused the error. Simplest way to fix is to just remove that flag check. Then found out about `BMO_op_callf()`, this really needs documentation since it has variadic arguments and is magically calling the required operator (printf style). Now that we have the cube in the `BMesh`, converting it back to `Mesh` is another massive problem. There are many functions that can do this `BM_mesh_bm_to_me()` and `BKE_mesh_from_bmesh_eval_nomain()` are most appropriate. These functions write the CustomData blocks to `Mesh` but before doing do, set the `mvert->co` and such. For some reason, `BMesh` has not updated the blocks so `mvert->co` just has (0.0, 0.0, 0.0). After spending multiple hours on this, found one way to fix this, copy the `BMesh` which then initializes the blocks in the new `BMesh` and this can be used in `BM_mesh_bm_to_me()` to get the `Mesh` that is needed. |
Commit Details:
Full Hash: ed500956c389ef515bac5b3833d605da7d0fb53f
Parent Commit: 95d9b58
Lines Changed: +151, -1