Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/displist.c
| Show First 20 Lines • Show All 851 Lines • ▼ Show 20 Lines | static void curve_calc_modifiers_pre( | ||||
| Depsgraph *depsgraph, Scene *scene, Object *ob, ListBase *nurb, const bool for_render) | Depsgraph *depsgraph, Scene *scene, Object *ob, ListBase *nurb, const bool for_render) | ||||
| { | { | ||||
| VirtualModifierData virtualModifierData; | VirtualModifierData virtualModifierData; | ||||
| ModifierData *md = modifiers_getVirtualModifierList(ob, &virtualModifierData); | ModifierData *md = modifiers_getVirtualModifierList(ob, &virtualModifierData); | ||||
| ModifierData *pretessellatePoint; | ModifierData *pretessellatePoint; | ||||
| Curve *cu = ob->data; | Curve *cu = ob->data; | ||||
| int numElems = 0, numVerts = 0; | int numElems = 0, numVerts = 0; | ||||
| const bool editmode = (!for_render && (cu->editnurb || cu->editfont)); | const bool editmode = (!for_render && (cu->editnurb || cu->editfont)); | ||||
| ModifierApplyFlag app_flag = 0; | ModifierApplyFlag apply_flag = 0; | ||||
| float(*deformedVerts)[3] = NULL; | float(*deformedVerts)[3] = NULL; | ||||
| float *keyVerts = NULL; | float *keyVerts = NULL; | ||||
| int required_mode; | int required_mode; | ||||
| modifiers_clearErrors(ob); | modifiers_clearErrors(ob); | ||||
| if (editmode) { | if (editmode) { | ||||
| app_flag |= MOD_APPLY_USECACHE; | apply_flag |= MOD_APPLY_USECACHE; | ||||
| } | } | ||||
| if (for_render) { | if (for_render) { | ||||
| app_flag |= MOD_APPLY_RENDER; | apply_flag |= MOD_APPLY_RENDER; | ||||
| required_mode = eModifierMode_Render; | required_mode = eModifierMode_Render; | ||||
| } | } | ||||
| else { | else { | ||||
| required_mode = eModifierMode_Realtime; | required_mode = eModifierMode_Realtime; | ||||
| } | } | ||||
| const ModifierEvalContext mectx = {depsgraph, ob, app_flag}; | const ModifierEvalContext mectx = {depsgraph, ob, apply_flag}; | ||||
| pretessellatePoint = curve_get_tessellate_point(scene, ob, for_render, editmode); | pretessellatePoint = curve_get_tessellate_point(scene, ob, for_render, editmode); | ||||
| if (editmode) { | if (editmode) { | ||||
| required_mode |= eModifierMode_Editmode; | required_mode |= eModifierMode_Editmode; | ||||
| } | } | ||||
| if (!editmode) { | if (!editmode) { | ||||
| ▲ Show 20 Lines • Show All 93 Lines • ▼ Show 20 Lines | static void curve_calc_modifiers_post(Depsgraph *depsgraph, | ||||
| ModifierData *md = modifiers_getVirtualModifierList(ob, &virtualModifierData); | ModifierData *md = modifiers_getVirtualModifierList(ob, &virtualModifierData); | ||||
| ModifierData *pretessellatePoint; | ModifierData *pretessellatePoint; | ||||
| Curve *cu = ob->data; | Curve *cu = ob->data; | ||||
| int required_mode = 0, totvert = 0; | int required_mode = 0, totvert = 0; | ||||
| const bool editmode = (!for_render && (cu->editnurb || cu->editfont)); | const bool editmode = (!for_render && (cu->editnurb || cu->editfont)); | ||||
| Mesh *modified = NULL, *mesh_applied; | Mesh *modified = NULL, *mesh_applied; | ||||
| float(*vertCos)[3] = NULL; | float(*vertCos)[3] = NULL; | ||||
| int useCache = !for_render; | int useCache = !for_render; | ||||
| ModifierApplyFlag app_flag = 0; | ModifierApplyFlag apply_flag = 0; | ||||
| if (for_render) { | if (for_render) { | ||||
| app_flag |= MOD_APPLY_RENDER; | apply_flag |= MOD_APPLY_RENDER; | ||||
| required_mode = eModifierMode_Render; | required_mode = eModifierMode_Render; | ||||
| } | } | ||||
| else { | else { | ||||
| required_mode = eModifierMode_Realtime; | required_mode = eModifierMode_Realtime; | ||||
| } | } | ||||
| const ModifierEvalContext mectx_deform = { | const ModifierEvalContext mectx_deform = { | ||||
| depsgraph, ob, editmode ? app_flag | MOD_APPLY_USECACHE : app_flag}; | depsgraph, ob, editmode ? apply_flag | MOD_APPLY_USECACHE : apply_flag}; | ||||
| const ModifierEvalContext mectx_apply = { | const ModifierEvalContext mectx_apply = { | ||||
| depsgraph, ob, useCache ? app_flag | MOD_APPLY_USECACHE : app_flag}; | depsgraph, ob, useCache ? apply_flag | MOD_APPLY_USECACHE : apply_flag}; | ||||
| pretessellatePoint = curve_get_tessellate_point(scene, ob, for_render, editmode); | pretessellatePoint = curve_get_tessellate_point(scene, ob, for_render, editmode); | ||||
| if (editmode) { | if (editmode) { | ||||
| required_mode |= eModifierMode_Editmode; | required_mode |= eModifierMode_Editmode; | ||||
| } | } | ||||
| if (pretessellatePoint) { | if (pretessellatePoint) { | ||||
| ▲ Show 20 Lines • Show All 80 Lines • ▼ Show 20 Lines | else { | ||||
| /* Vertex coordinates were applied to necessary data, could free it */ | /* Vertex coordinates were applied to necessary data, could free it */ | ||||
| MEM_freeN(vertCos); | MEM_freeN(vertCos); | ||||
| vertCos = NULL; | vertCos = NULL; | ||||
| } | } | ||||
| if (need_normal) { | if (need_normal) { | ||||
| BKE_mesh_ensure_normals(modified); | BKE_mesh_ensure_normals(modified); | ||||
| } | } | ||||
| mesh_applied = mti->applyModifier(md, &mectx_apply, modified); | mesh_applied = mti->modifyMesh(md, &mectx_apply, modified); | ||||
| if (mesh_applied) { | if (mesh_applied) { | ||||
| /* Modifier returned a new derived mesh */ | /* Modifier returned a new derived mesh */ | ||||
| if (modified && modified != mesh_applied) { /* Modifier */ | if (modified && modified != mesh_applied) { /* Modifier */ | ||||
| BKE_id_free(NULL, modified); | BKE_id_free(NULL, modified); | ||||
| } | } | ||||
| modified = mesh_applied; | modified = mesh_applied; | ||||
| ▲ Show 20 Lines • Show All 771 Lines • Show Last 20 Lines | |||||