Changeset View
Changeset View
Standalone View
Standalone View
source/blender/modifiers/intern/MOD_wave.c
| Context not available. | |||||
| MEMCPY_STRUCT_AFTER(wmd, DNA_struct_default_get(WaveModifierData), modifier); | MEMCPY_STRUCT_AFTER(wmd, DNA_struct_default_get(WaveModifierData), modifier); | ||||
| } | } | ||||
| static bool dependsOnTime(ModifierData *UNUSED(md)) | static bool dependsOnTime(ModifierData *md) | ||||
| { | { | ||||
| return true; | /* if locked, wave doesn't depend on time */ | ||||
| WaveModifierData *wmd = (WaveModifierData *)md; | |||||
| return (wmd->flag & MOD_WAVE_LOCK) == 0; | |||||
mont29: Style: spaces around operators. | |||||
Done Inline ActionsPrefer C comments, also again spaces... mont29: Prefer C comments, also again spaces... | |||||
| } | } | ||||
| static void foreachIDLink(ModifierData *md, Object *ob, IDWalkFunc walk, void *userData) | static void foreachIDLink(ModifierData *md, Object *ob, IDWalkFunc walk, void *userData) | ||||
| Context not available. | |||||
| MVert *mvert = NULL; | MVert *mvert = NULL; | ||||
| MDeformVert *dvert; | MDeformVert *dvert; | ||||
| int defgrp_index; | int defgrp_index; | ||||
| float ctime = DEG_get_ctime(ctx->depsgraph); | float ctime = (wmd->flag & MOD_WAVE_LOCK) ? 0.0f : DEG_get_ctime(ctx->depsgraph); | ||||
Done Inline ActionsAgain, spaces around operators... mont29: Again, spaces around operators... | |||||
| float minfac = (float)(1.0 / exp(wmd->width * wmd->narrow * wmd->width * wmd->narrow)); | float minfac = (float)(1.0 / exp(wmd->width * wmd->narrow * wmd->width * wmd->narrow)); | ||||
| float lifefac = wmd->height; | float lifefac = wmd->height; | ||||
| float(*tex_co)[3] = NULL; | float(*tex_co)[3] = NULL; | ||||
| Context not available. | |||||
| CLAMP(falloff_fac, 0.0f, 1.0f); | CLAMP(falloff_fac, 0.0f, 1.0f); | ||||
| } | } | ||||
| /* GAUSSIAN */ | |||||
| if ((falloff_fac != 0.0f) && (amplit > -wmd->width) && (amplit < wmd->width)) { | if ((falloff_fac != 0.0f) && (amplit > -wmd->width) && (amplit < wmd->width)) { | ||||
| amplit = amplit * wmd->narrow; | switch (wmd->waveshape) { | ||||
| amplit = (float)(1.0f / expf(amplit * amplit) - minfac); | case MOD_WAVE_SHAPE_SINE: | ||||
Done Inline ActionsNot really useful, the enums already have explicit names. mont29: Not really useful, the enums already have explicit names. | |||||
| amplit = cosf(0.5f * M_PI * amplit / wmd->width); | |||||
| amplit = amplit * amplit; | |||||
| break; | |||||
| case MOD_WAVE_SHAPE_GAUSSIAN: | |||||
| amplit = amplit * wmd->narrow; | |||||
| amplit = (float)(1.0f / expf(amplit * amplit) - minfac); | |||||
| break; | |||||
| default: | |||||
Done Inline ActionsPlease follow our codestyle, those should be indented further, not less. mont29: Please follow our codestyle, those should be indented further, not less. | |||||
Done Inline ActionsUse explicit value, much easier to detect then when we add another enum value and forget to handle it somewhere. mont29: Use explicit value, much easier to detect then when we add another enum value and forget to… | |||||
| return; /* No shape? */ | |||||
| } | |||||
| /*apply texture*/ | /*apply texture*/ | ||||
| if (tex_co) { | if (tex_co) { | ||||
| Context not available. | |||||
| uiLayoutSetPropSep(layout, true); | uiLayoutSetPropSep(layout, true); | ||||
| row = uiLayoutRow(layout, false); | |||||
| uiItemR(row, ptr, "wave_shape", UI_ITEM_R_EXPAND, NULL, ICON_NONE); | |||||
| uiItemR(layout, ptr, "lock_anim", 0, NULL, ICON_NONE); | |||||
| row = uiLayoutRowWithHeading(layout, true, IFACE_("Motion")); | row = uiLayoutRowWithHeading(layout, true, IFACE_("Motion")); | ||||
| uiItemR(row, ptr, "use_x", UI_ITEM_R_TOGGLE | UI_ITEM_R_FORCE_BLANK_DECORATE, NULL, ICON_NONE); | uiItemR(row, ptr, "use_x", UI_ITEM_R_TOGGLE | UI_ITEM_R_FORCE_BLANK_DECORATE, NULL, ICON_NONE); | ||||
| uiItemR(row, ptr, "use_y", UI_ITEM_R_TOGGLE | UI_ITEM_R_FORCE_BLANK_DECORATE, NULL, ICON_NONE); | uiItemR(row, ptr, "use_y", UI_ITEM_R_TOGGLE | UI_ITEM_R_FORCE_BLANK_DECORATE, NULL, ICON_NONE); | ||||
| Context not available. | |||||
Style: spaces around operators.