Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/object/object_modifier.c
| Show First 20 Lines • Show All 1,116 Lines • ▼ Show 20 Lines | void OBJECT_OT_modifier_move_down(wmOperatorType *ot) | ||||
| edit_modifier_properties(ot); | edit_modifier_properties(ot); | ||||
| } | } | ||||
| /************************ apply modifier operator *********************/ | /************************ apply modifier operator *********************/ | ||||
| static int modifier_apply_exec(bContext *C, wmOperator *op) | static int modifier_apply_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| Main *bmain = CTX_data_main(C); | Main *bmain = CTX_data_main(C); | ||||
| Depsgraph *depsgraph = CTX_data_depsgraph(C); | Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| Object *ob = ED_object_active_context(C); | Object *ob = ED_object_active_context(C); | ||||
| ModifierData *md = edit_modifier_property_get(op, ob, 0); | ModifierData *md = edit_modifier_property_get(op, ob, 0); | ||||
| int apply_as = RNA_enum_get(op->ptr, "apply_as"); | int apply_as = RNA_enum_get(op->ptr, "apply_as"); | ||||
| if (!md || !ED_object_modifier_apply(bmain, op->reports, depsgraph, scene, ob, md, apply_as)) { | if (!md || !ED_object_modifier_apply(bmain, op->reports, depsgraph, scene, ob, md, apply_as)) { | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 47 Lines • ▼ Show 20 Lines | void OBJECT_OT_modifier_apply(wmOperatorType *ot) | ||||
| edit_modifier_properties(ot); | edit_modifier_properties(ot); | ||||
| } | } | ||||
| /************************ convert modifier operator *********************/ | /************************ convert modifier operator *********************/ | ||||
| static int modifier_convert_exec(bContext *C, wmOperator *op) | static int modifier_convert_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| Main *bmain = CTX_data_main(C); | Main *bmain = CTX_data_main(C); | ||||
| Depsgraph *depsgraph = CTX_data_depsgraph(C); | Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| ViewLayer *view_layer = CTX_data_view_layer(C); | ViewLayer *view_layer = CTX_data_view_layer(C); | ||||
| Object *ob = ED_object_active_context(C); | Object *ob = ED_object_active_context(C); | ||||
| ModifierData *md = edit_modifier_property_get(op, ob, 0); | ModifierData *md = edit_modifier_property_get(op, ob, 0); | ||||
| if (!md || | if (!md || | ||||
| !ED_object_modifier_convert(op->reports, bmain, depsgraph, scene, view_layer, ob, md)) { | !ED_object_modifier_convert(op->reports, bmain, depsgraph, scene, view_layer, ob, md)) { | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| ▲ Show 20 Lines • Show All 180 Lines • ▼ Show 20 Lines | void OBJECT_OT_multires_subdivide(wmOperatorType *ot) | ||||
| ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL; | ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL; | ||||
| edit_modifier_properties(ot); | edit_modifier_properties(ot); | ||||
| } | } | ||||
| /****************** multires reshape operator *********************/ | /****************** multires reshape operator *********************/ | ||||
| static int multires_reshape_exec(bContext *C, wmOperator *op) | static int multires_reshape_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| Depsgraph *depsgraph = CTX_data_depsgraph(C); | Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); | ||||
| Object *ob = ED_object_active_context(C), *secondob = NULL; | Object *ob = ED_object_active_context(C), *secondob = NULL; | ||||
| MultiresModifierData *mmd = (MultiresModifierData *)edit_modifier_property_get( | MultiresModifierData *mmd = (MultiresModifierData *)edit_modifier_property_get( | ||||
| op, ob, eModifierType_Multires); | op, ob, eModifierType_Multires); | ||||
| if (!mmd) { | if (!mmd) { | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 527 Lines • ▼ Show 20 Lines | static Object *modifier_skin_armature_create(Depsgraph *depsgraph, | ||||
| ED_armature_edit_free(arm); | ED_armature_edit_free(arm); | ||||
| return arm_ob; | return arm_ob; | ||||
| } | } | ||||
| static int skin_armature_create_exec(bContext *C, wmOperator *op) | static int skin_armature_create_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| Main *bmain = CTX_data_main(C); | Main *bmain = CTX_data_main(C); | ||||
| Depsgraph *depsgraph = CTX_data_depsgraph(C); | Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| Object *ob = CTX_data_active_object(C), *arm_ob; | Object *ob = CTX_data_active_object(C), *arm_ob; | ||||
| Mesh *me = ob->data; | Mesh *me = ob->data; | ||||
| ModifierData *skin_md; | ModifierData *skin_md; | ||||
| ArmatureModifierData *arm_md; | ArmatureModifierData *arm_md; | ||||
| if (!CustomData_has_layer(&me->vdata, CD_MVERT_SKIN)) { | if (!CustomData_has_layer(&me->vdata, CD_MVERT_SKIN)) { | ||||
| BKE_reportf(op->reports, RPT_WARNING, "Mesh '%s' has no skin vertex data", me->id.name + 2); | BKE_reportf(op->reports, RPT_WARNING, "Mesh '%s' has no skin vertex data", me->id.name + 2); | ||||
| ▲ Show 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | |||||
| static bool correctivesmooth_poll(bContext *C) | static bool correctivesmooth_poll(bContext *C) | ||||
| { | { | ||||
| return edit_modifier_poll_generic(C, &RNA_CorrectiveSmoothModifier, 0); | return edit_modifier_poll_generic(C, &RNA_CorrectiveSmoothModifier, 0); | ||||
| } | } | ||||
| static int correctivesmooth_bind_exec(bContext *C, wmOperator *op) | static int correctivesmooth_bind_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| Depsgraph *depsgraph = CTX_data_depsgraph(C); | Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| Object *ob = ED_object_active_context(C); | Object *ob = ED_object_active_context(C); | ||||
| CorrectiveSmoothModifierData *csmd = (CorrectiveSmoothModifierData *)edit_modifier_property_get( | CorrectiveSmoothModifierData *csmd = (CorrectiveSmoothModifierData *)edit_modifier_property_get( | ||||
| op, ob, eModifierType_CorrectiveSmooth); | op, ob, eModifierType_CorrectiveSmooth); | ||||
| bool is_bind; | bool is_bind; | ||||
| if (!csmd) { | if (!csmd) { | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| ▲ Show 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | |||||
| static bool meshdeform_poll(bContext *C) | static bool meshdeform_poll(bContext *C) | ||||
| { | { | ||||
| return edit_modifier_poll_generic(C, &RNA_MeshDeformModifier, 0); | return edit_modifier_poll_generic(C, &RNA_MeshDeformModifier, 0); | ||||
| } | } | ||||
| static int meshdeform_bind_exec(bContext *C, wmOperator *op) | static int meshdeform_bind_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| Depsgraph *depsgraph = CTX_data_depsgraph(C); | Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); | ||||
| Object *ob = ED_object_active_context(C); | Object *ob = ED_object_active_context(C); | ||||
| MeshDeformModifierData *mmd = (MeshDeformModifierData *)edit_modifier_property_get( | MeshDeformModifierData *mmd = (MeshDeformModifierData *)edit_modifier_property_get( | ||||
| op, ob, eModifierType_MeshDeform); | op, ob, eModifierType_MeshDeform); | ||||
| if (mmd == NULL) { | if (mmd == NULL) { | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 181 Lines • ▼ Show 20 Lines | static void oceanbake_endjob(void *customdata) | ||||
| Object *ob = oj->owner; | Object *ob = oj->owner; | ||||
| DEG_id_tag_update(&ob->id, ID_RECALC_COPY_ON_WRITE); | DEG_id_tag_update(&ob->id, ID_RECALC_COPY_ON_WRITE); | ||||
| } | } | ||||
| static int ocean_bake_exec(bContext *C, wmOperator *op) | static int ocean_bake_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| Main *bmain = CTX_data_main(C); | Main *bmain = CTX_data_main(C); | ||||
| Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); | |||||
| Object *ob = ED_object_active_context(C); | Object *ob = ED_object_active_context(C); | ||||
| OceanModifierData *omd = (OceanModifierData *)edit_modifier_property_get( | OceanModifierData *omd = (OceanModifierData *)edit_modifier_property_get( | ||||
| op, ob, eModifierType_Ocean); | op, ob, eModifierType_Ocean); | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| OceanCache *och; | OceanCache *och; | ||||
| struct Ocean *ocean; | struct Ocean *ocean; | ||||
| int f, cfra, i = 0; | int f, cfra, i = 0; | ||||
| const bool free = RNA_boolean_get(op->ptr, "free"); | const bool free = RNA_boolean_get(op->ptr, "free"); | ||||
| Show All 25 Lines | static int ocean_bake_exec(bContext *C, wmOperator *op) | ||||
| och->time = MEM_mallocN(och->duration * sizeof(float), "foam bake time"); | och->time = MEM_mallocN(och->duration * sizeof(float), "foam bake time"); | ||||
| cfra = scene->r.cfra; | cfra = scene->r.cfra; | ||||
| /* precalculate time variable before baking */ | /* precalculate time variable before baking */ | ||||
| for (f = omd->bakestart; f <= omd->bakeend; f++) { | for (f = omd->bakestart; f <= omd->bakeend; f++) { | ||||
| /* For now only simple animation of time value is supported, nothing else. | /* For now only simple animation of time value is supported, nothing else. | ||||
| * No drivers or other modifier parameters. */ | * No drivers or other modifier parameters. */ | ||||
| BKE_animsys_evaluate_animdata( | BKE_animsys_evaluate_animdata(depsgraph, scene, (ID *)ob, ob->adt, f, ADT_RECALC_ANIM); | ||||
| CTX_data_depsgraph(C), scene, (ID *)ob, ob->adt, f, ADT_RECALC_ANIM); | |||||
| och->time[i] = omd->time; | och->time[i] = omd->time; | ||||
| i++; | i++; | ||||
| } | } | ||||
| /* make a copy of ocean to use for baking - threadsafety */ | /* make a copy of ocean to use for baking - threadsafety */ | ||||
| ocean = BKE_ocean_add(); | ocean = BKE_ocean_add(); | ||||
| BKE_ocean_init_from_modifier(ocean, omd); | BKE_ocean_init_from_modifier(ocean, omd); | ||||
| ▲ Show 20 Lines • Show All 68 Lines • ▼ Show 20 Lines | |||||
| static bool laplaciandeform_poll(bContext *C) | static bool laplaciandeform_poll(bContext *C) | ||||
| { | { | ||||
| return edit_modifier_poll_generic(C, &RNA_LaplacianDeformModifier, 0); | return edit_modifier_poll_generic(C, &RNA_LaplacianDeformModifier, 0); | ||||
| } | } | ||||
| static int laplaciandeform_bind_exec(bContext *C, wmOperator *op) | static int laplaciandeform_bind_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| Object *ob = ED_object_active_context(C); | Object *ob = ED_object_active_context(C); | ||||
| Depsgraph *depsgraph = CTX_data_depsgraph(C); | Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); | ||||
| LaplacianDeformModifierData *lmd = (LaplacianDeformModifierData *)edit_modifier_property_get( | LaplacianDeformModifierData *lmd = (LaplacianDeformModifierData *)edit_modifier_property_get( | ||||
| op, ob, eModifierType_LaplacianDeform); | op, ob, eModifierType_LaplacianDeform); | ||||
| if (lmd == NULL) { | if (lmd == NULL) { | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| if (lmd->flag & MOD_LAPLACIANDEFORM_BIND) { | if (lmd->flag & MOD_LAPLACIANDEFORM_BIND) { | ||||
| ▲ Show 20 Lines • Show All 58 Lines • ▼ Show 20 Lines | |||||
| static bool surfacedeform_bind_poll(bContext *C) | static bool surfacedeform_bind_poll(bContext *C) | ||||
| { | { | ||||
| return edit_modifier_poll_generic(C, &RNA_SurfaceDeformModifier, 0); | return edit_modifier_poll_generic(C, &RNA_SurfaceDeformModifier, 0); | ||||
| } | } | ||||
| static int surfacedeform_bind_exec(bContext *C, wmOperator *op) | static int surfacedeform_bind_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| Object *ob = ED_object_active_context(C); | Object *ob = ED_object_active_context(C); | ||||
| Depsgraph *depsgraph = CTX_data_depsgraph(C); | Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); | ||||
| SurfaceDeformModifierData *smd = (SurfaceDeformModifierData *)edit_modifier_property_get( | SurfaceDeformModifierData *smd = (SurfaceDeformModifierData *)edit_modifier_property_get( | ||||
| op, ob, eModifierType_SurfaceDeform); | op, ob, eModifierType_SurfaceDeform); | ||||
| if (smd == NULL) { | if (smd == NULL) { | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| if (smd->flags & MOD_SDEF_BIND) { | if (smd->flags & MOD_SDEF_BIND) { | ||||
| ▲ Show 20 Lines • Show All 45 Lines • Show Last 20 Lines | |||||