Changeset View
Standalone View
source/blender/depsgraph/intern/depsgraph_type.h
| Show First 20 Lines • Show All 64 Lines • ▼ Show 20 Lines | enum eUpdateSource { | ||||
| /* Update caused by user directly or indirectly influencing the node. */ | /* Update caused by user directly or indirectly influencing the node. */ | ||||
| DEG_UPDATE_SOURCE_USER_EDIT = (1 << 1), | DEG_UPDATE_SOURCE_USER_EDIT = (1 << 1), | ||||
| /* Update is happening as a special response for the relations update. */ | /* Update is happening as a special response for the relations update. */ | ||||
| DEG_UPDATE_SOURCE_RELATIONS = (1 << 2), | DEG_UPDATE_SOURCE_RELATIONS = (1 << 2), | ||||
| /* Update is happening due to visibility change. */ | /* Update is happening due to visibility change. */ | ||||
| DEG_UPDATE_SOURCE_VISIBILITY = (1 << 3), | DEG_UPDATE_SOURCE_VISIBILITY = (1 << 3), | ||||
| }; | }; | ||||
| /* Is it the right place for it? Thing is, it is needed in both intern/node and intern/builder... | |||||
sergey: Probably ok for now. But maybe consider adding `depsgraph_customdata.h` and… | |||||
mont29AuthorUnsubmitted Done Inline ActionsNot sure what should go into depsgraph_customdata_impl.h… Wouldn’t we rather need a depsgraph_customdata.cc ? mont29: Not sure what should go into `depsgraph_customdata_impl.h`… Wouldn’t we rather need a… | |||||
| * Also added the 'DEG_' prefix to avoid confusion with the DNA struct, | |||||
| * though it feels stupid since we are already in the DEG namespace... | |||||
| */ | |||||
| struct DEG_CustomData_MeshMasks { | |||||
sergeyUnsubmitted Done Inline ActionsDon't mix snake style with camel case. sergey: Don't mix snake style with camel case.
Types are to start with capital and be camel case. | |||||
| uint64_t vert_mask; | |||||
| uint64_t edge_mask; | |||||
| uint64_t face_mask; | |||||
| uint64_t loop_mask; | |||||
| uint64_t poly_mask; | |||||
sergeyUnsubmitted Not Done Inline ActionsUse CustomData_MeshMasks. sergey: Use `CustomData_MeshMasks`. | |||||
mont29AuthorUnsubmitted Done Inline ActionsDon’t understand that one? That would make something like CustomData_MeshMasks masks;, and then would have to access the masks with customdata_masks.masks.vmask? Also implies that we include DNA_customdata_types.h here... Or did you mean 'Use CustomDataMask' (from BKE_customdata.h's typedef uint64_t CustomDataMask;)? mont29: Don’t understand that one? That would make something like `CustomData_MeshMasks masks;`, and… | |||||
sergeyUnsubmitted Done Inline ActionsAdd default constructor, which initializes masks to 0. sergey: Add default constructor, which initializes masks to 0.
Also, probably worth adding constructor… | |||||
| DEG_CustomData_MeshMasks& operator|=(const DEG_CustomData_MeshMasks& a) | |||||
| { | |||||
| vert_mask |= a.vert_mask; | |||||
| edge_mask |= a.edge_mask; | |||||
| face_mask |= a.face_mask; | |||||
| loop_mask |= a.loop_mask; | |||||
| poly_mask |= a.poly_mask; | |||||
Done Inline ActionsMark as explicit. Also not sure why implementation of this specific constructor is in .cc file. sergey: Mark as `explicit`.
Also not sure why implementation of this specific constructor is in `.cc`… | |||||
Done Inline Actions
Yes, did not want to have to include DNA_customdata_types.h in that header mont29: > Also not sure why implementation of this specific constructor is in .cc file.
> Feels weird… | |||||
| return *this; | |||||
| } | |||||
| DEG_CustomData_MeshMasks operator|(const DEG_CustomData_MeshMasks& a) const | |||||
sergeyUnsubmitted Done Inline Actionsa -> other. sergey: `a` -> `other`. | |||||
| { | |||||
| return DEG_CustomData_MeshMasks { | |||||
sergeyUnsubmitted Done Inline ActionsI would do it as DEGCustomDataMeshMasks result; result.vert_mask = this.vert_mask | other.vert_mask; ... Might be looking more verbose, but is way less fragile. sergey: I would do it as
DEGCustomDataMeshMasks result;
result.vert_mask = this.vert_mask | other. | |||||
| vert_mask | a.vert_mask, | |||||
| edge_mask | a.edge_mask, | |||||
| face_mask | a.face_mask, | |||||
| loop_mask | a.loop_mask, | |||||
| poly_mask | a.poly_mask}; | |||||
| } | |||||
| bool operator!=(const DEG_CustomData_MeshMasks& a) const | |||||
sergeyUnsubmitted Done Inline Actionsbool operator==(const DEG_CustomData_MeshMasks& other) const with all the equality and then sergey: `bool operator==(const DEG_CustomData_MeshMasks& other) const` with all the equality and then… | |||||
| { | |||||
| return !(vert_mask == a.vert_mask && | |||||
| edge_mask == a.edge_mask && | |||||
| face_mask == a.face_mask && | |||||
| loop_mask == a.loop_mask && | |||||
| poly_mask == a.poly_mask); | |||||
| } | |||||
| static DEG_CustomData_MeshMasks MaskVert(const uint64_t vert_mask) | |||||
| { | |||||
| return DEG_CustomData_MeshMasks {vert_mask, 0, 0, 0, 0}; | |||||
sergeyUnsubmitted Done Inline ActionsDEGCustomDataMeshMasks result; sergey: DEGCustomDataMeshMasks result;
result.vert_mask = vert_mask;
return result; | |||||
| } | |||||
| static DEG_CustomData_MeshMasks MaskEdge(const uint64_t edge_mask) | |||||
| { | |||||
| return DEG_CustomData_MeshMasks {0, edge_mask, 0, 0, 0}; | |||||
| } | |||||
| static DEG_CustomData_MeshMasks MaskFace(const uint64_t face_mask) | |||||
| { | |||||
| return DEG_CustomData_MeshMasks {0, 0, face_mask, 0, 0}; | |||||
| } | |||||
| static DEG_CustomData_MeshMasks MaskLoop(const uint64_t loop_mask) | |||||
| { | |||||
| return DEG_CustomData_MeshMasks {0, 0, 0, loop_mask, 0}; | |||||
| } | |||||
| static DEG_CustomData_MeshMasks MaskPoly(const uint64_t poly_mask) | |||||
| { | |||||
| return DEG_CustomData_MeshMasks {0, 0, 0, 0, poly_mask}; | |||||
| } | |||||
| }; | |||||
| } // namespace DEG | } // namespace DEG | ||||
Probably ok for now. But maybe consider adding depsgraph_customdata.h and depsgraph_customdata_impl.h.