Changeset View
Changeset View
Standalone View
Standalone View
source/blender/modifiers/intern/MOD_screw.c
| Show All 25 Lines | |||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| #include "BLI_alloca.h" | #include "BLI_alloca.h" | ||||
| #include "BLI_math.h" | #include "BLI_math.h" | ||||
| #include "BLT_translation.h" | #include "BLT_translation.h" | ||||
| #include "DNA_defaults.h" | |||||
| #include "DNA_mesh_types.h" | #include "DNA_mesh_types.h" | ||||
| #include "DNA_meshdata_types.h" | #include "DNA_meshdata_types.h" | ||||
| #include "DNA_object_types.h" | #include "DNA_object_types.h" | ||||
| #include "DNA_screen_types.h" | #include "DNA_screen_types.h" | ||||
| #include "BKE_context.h" | #include "BKE_context.h" | ||||
| #include "BKE_lib_query.h" | #include "BKE_lib_query.h" | ||||
| #include "BKE_mesh.h" | #include "BKE_mesh.h" | ||||
| #include "BKE_screen.h" | #include "BKE_screen.h" | ||||
| #include "UI_interface.h" | #include "UI_interface.h" | ||||
| #include "UI_resources.h" | #include "UI_resources.h" | ||||
| #include "RNA_access.h" | #include "RNA_access.h" | ||||
| #include "DEG_depsgraph_build.h" | #include "DEG_depsgraph_build.h" | ||||
| #include "DEG_depsgraph_query.h" | #include "DEG_depsgraph_query.h" | ||||
| #include "MEM_guardedalloc.h" | #include "MEM_guardedalloc.h" | ||||
| #include "MOD_modifiertypes.h" | #include "MOD_modifiertypes.h" | ||||
| #include "MOD_ui_common.h" | #include "MOD_ui_common.h" | ||||
| static void initData(ModifierData *md) | |||||
| { | |||||
| ScrewModifierData *ltmd = (ScrewModifierData *)md; | |||||
| BLI_assert(MEMCMP_STRUCT_AFTER_IS_ZERO(ltmd, modifier)); | |||||
| MEMCPY_STRUCT_AFTER(ltmd, DNA_struct_default_get(ScrewModifierData), modifier); | |||||
| } | |||||
| #include "BLI_strict_flags.h" | #include "BLI_strict_flags.h" | ||||
| /* used for gathering edge connectivity */ | /* used for gathering edge connectivity */ | ||||
| typedef struct ScrewVertConnect { | typedef struct ScrewVertConnect { | ||||
| float dist; /* distance from the center axis */ | float dist; /* distance from the center axis */ | ||||
| float co[3]; /* location relative to the transformed axis */ | float co[3]; /* location relative to the transformed axis */ | ||||
| float no[3]; /* calc normal of the vertex */ | float no[3]; /* calc normal of the vertex */ | ||||
| uint v[2]; /* 2 verts on either side of this one */ | uint v[2]; /* 2 verts on either side of this one */ | ||||
| ▲ Show 20 Lines • Show All 107 Lines • ▼ Show 20 Lines | result = BKE_mesh_merge_verts(result, | ||||
| full_doubles_map, | full_doubles_map, | ||||
| (int)(tot_doubles * (step_tot - 1)), | (int)(tot_doubles * (step_tot - 1)), | ||||
| MESH_MERGE_VERTS_DUMP_IF_MAPPED); | MESH_MERGE_VERTS_DUMP_IF_MAPPED); | ||||
| MEM_freeN(full_doubles_map); | MEM_freeN(full_doubles_map); | ||||
| } | } | ||||
| return result; | return result; | ||||
| } | } | ||||
| static void initData(ModifierData *md) | |||||
| { | |||||
| ScrewModifierData *ltmd = (ScrewModifierData *)md; | |||||
| ltmd->ob_axis = NULL; | |||||
| ltmd->angle = (float)(M_PI * 2.0); | |||||
| ltmd->axis = 2; | |||||
| ltmd->flag = MOD_SCREW_SMOOTH_SHADING; | |||||
| ltmd->steps = 16; | |||||
| ltmd->render_steps = 16; | |||||
| ltmd->iter = 1; | |||||
| ltmd->merge_dist = 0.01f; | |||||
| } | |||||
| static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *meshData) | static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *meshData) | ||||
| { | { | ||||
| Mesh *mesh = meshData; | Mesh *mesh = meshData; | ||||
| Mesh *result; | Mesh *result; | ||||
| ScrewModifierData *ltmd = (ScrewModifierData *)md; | ScrewModifierData *ltmd = (ScrewModifierData *)md; | ||||
| const bool use_render_params = (ctx->flag & MOD_APPLY_RENDER) != 0; | const bool use_render_params = (ctx->flag & MOD_APPLY_RENDER) != 0; | ||||
| int *origindex; | int *origindex; | ||||
| ▲ Show 20 Lines • Show All 1,080 Lines • Show Last 20 Lines | |||||