本文整理汇总了C++中ModifierTypeInfo::requiredDataMask方法的典型用法代码示例。如果您正苦于以下问题:C++ ModifierTypeInfo::requiredDataMask方法的具体用法?C++ ModifierTypeInfo::requiredDataMask怎么用?C++ ModifierTypeInfo::requiredDataMask使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModifierTypeInfo
的用法示例。
在下文中一共展示了ModifierTypeInfo::requiredDataMask方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
CDMaskLink *modifiers_calcDataMasks(struct Scene *scene, Object *ob, ModifierData *md,
CustomDataMask dataMask, int required_mode,
ModifierData *previewmd, CustomDataMask previewmask)
{
CDMaskLink *dataMasks = NULL;
CDMaskLink *curr, *prev;
/* build a list of modifier data requirements in reverse order */
for (; md; md = md->next) {
ModifierTypeInfo *mti = modifierType_getInfo(md->type);
curr = MEM_callocN(sizeof(CDMaskLink), "CDMaskLink");
if (modifier_isEnabled(scene, md, required_mode)) {
if (mti->requiredDataMask)
curr->mask = mti->requiredDataMask(ob, md);
if (previewmd == md) {
curr->mask |= previewmask;
}
}
/* prepend new datamask */
curr->next = dataMasks;
dataMasks = curr;
}
/* build the list of required data masks - each mask in the list must
* include all elements of the masks that follow it
*
* note the list is currently in reverse order, so "masks that follow it"
* actually means "masks that precede it" at the moment
*/
for (curr = dataMasks, prev = NULL; curr; prev = curr, curr = curr->next) {
if (prev) {
CustomDataMask prev_mask = prev->mask;
CustomDataMask curr_mask = curr->mask;
curr->mask = curr_mask | prev_mask;
}
else {
CustomDataMask curr_mask = curr->mask;
curr->mask = curr_mask | dataMask;
}
}
/* reverse the list so it's in the correct order */
BLI_linklist_reverse((LinkNode **)&dataMasks);
return dataMasks;
}
示例2:
LinkNode *modifiers_calcDataMasks(struct Scene *scene, Object *ob, ModifierData *md, CustomDataMask dataMask, int required_mode)
{
LinkNode *dataMasks = NULL;
LinkNode *curr, *prev;
/* build a list of modifier data requirements in reverse order */
for(; md; md = md->next) {
ModifierTypeInfo *mti = modifierType_getInfo(md->type);
CustomDataMask mask = 0;
if(modifier_isEnabled(scene, md, required_mode))
if(mti->requiredDataMask)
mask = mti->requiredDataMask(ob, md);
BLI_linklist_prepend(&dataMasks, SET_INT_IN_POINTER(mask));
}
/* build the list of required data masks - each mask in the list must
* include all elements of the masks that follow it
*
* note the list is currently in reverse order, so "masks that follow it"
* actually means "masks that precede it" at the moment
*/
for(curr = dataMasks, prev = NULL; curr; prev = curr, curr = curr->next) {
if(prev) {
CustomDataMask prev_mask = (CustomDataMask)GET_INT_FROM_POINTER(prev->link);
CustomDataMask curr_mask = (CustomDataMask)GET_INT_FROM_POINTER(curr->link);
curr->link = SET_INT_IN_POINTER(curr_mask | prev_mask);
} else {
CustomDataMask curr_mask = (CustomDataMask)GET_INT_FROM_POINTER(curr->link);
curr->link = SET_INT_IN_POINTER(curr_mask | dataMask);
}
}
/* reverse the list so it's in the correct order */
BLI_linklist_reverse(&dataMasks);
return dataMasks;
}