Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/gpencil_modifier.c
| Show First 20 Lines • Show All 676 Lines • ▼ Show 20 Lines | if (gpl->parent != NULL) { | ||||
| break; | break; | ||||
| } | } | ||||
| if ((!is_zero_v3(gpl->location)) || (!is_zero_v3(gpl->rotation)) || (!is_one_v3(gpl->scale))) { | if ((!is_zero_v3(gpl->location)) || (!is_zero_v3(gpl->rotation)) || (!is_one_v3(gpl->scale))) { | ||||
| do_transform = true; | do_transform = true; | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| const bool is_multiedit = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd_eval); | DEG_debug_print_eval(depsgraph, __func__, gpd_eval->id.name, gpd_eval); | ||||
| const bool is_curve_edit = (bool)GPENCIL_CURVE_EDIT_SESSIONS_ON(gpd_eval); | |||||
| /* Delete any previously created runtime copy. */ | |||||
| if (ob->runtime.gpd_eval != NULL) { | |||||
| /* Make sure to clear the pointer in case the runtime eval data points to the same data block. | |||||
| * This can happen when the gpencil data block was not tagged for a depsgraph update after last | |||||
| * call to this function. */ | |||||
| if (gpd_eval == ob->runtime.gpd_eval) { | |||||
| gpd_eval = NULL; | |||||
| } | |||||
| BKE_gpencil_eval_delete(ob->runtime.gpd_eval); | |||||
| ob->runtime.gpd_eval = NULL; | |||||
| ob->data = gpd_eval; | |||||
| } | |||||
| const bool is_multiedit = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd_orig); | |||||
| const bool is_curve_edit = (bool)GPENCIL_CURVE_EDIT_SESSIONS_ON(gpd_orig); | |||||
| const bool do_modifiers = (bool)((!is_multiedit) && (!is_curve_edit) && | const bool do_modifiers = (bool)((!is_multiedit) && (!is_curve_edit) && | ||||
| (ob->greasepencil_modifiers.first != NULL) && | (ob_orig->greasepencil_modifiers.first != NULL) && | ||||
| (!GPENCIL_SIMPLIFY_MODIF(scene))); | (!GPENCIL_SIMPLIFY_MODIF(scene))); | ||||
| if ((!do_modifiers) && (!do_parent) && (!do_transform)) { | if ((!do_modifiers) && (!do_parent) && (!do_transform)) { | ||||
| BLI_assert(ob->data != NULL); | |||||
| return; | return; | ||||
| } | } | ||||
| DEG_debug_print_eval(depsgraph, __func__, gpd_eval->id.name, gpd_eval); | |||||
| /* If only one user, don't need a new copy, just update data of the frame. */ | /* If only one user, don't need a new copy, just update data of the frame. */ | ||||
| if (gpd_orig->id.us == 1) { | if (gpd_orig->id.us == 1) { | ||||
| ob->runtime.gpd_eval = NULL; | BLI_assert(ob->data != NULL); | ||||
| gpencil_copy_activeframe_to_eval(depsgraph, scene, ob, ob_orig->data, gpd_eval); | gpencil_copy_activeframe_to_eval(depsgraph, scene, ob, ob_orig->data, gpd_eval); | ||||
| return; | return; | ||||
| } | } | ||||
| /* Copy full Datablock to evaluated version. */ | /* Copy full datablock to evaluated version. */ | ||||
| ob->runtime.gpd_orig = gpd_orig; | ob->runtime.gpd_eval = gpencil_copy_for_eval(gpd_orig); | ||||
| if (ob->runtime.gpd_eval != NULL) { | /* Overwrite ob->data with gpd_eval here. */ | ||||
| BKE_gpencil_eval_delete(ob->runtime.gpd_eval); | |||||
| ob->runtime.gpd_eval = NULL; | |||||
| ob->data = ob->runtime.gpd_orig; | |||||
| } | |||||
| ob->runtime.gpd_eval = gpencil_copy_for_eval(ob->runtime.gpd_orig); | |||||
| gpencil_assign_object_eval(ob); | gpencil_assign_object_eval(ob); | ||||
| BKE_gpencil_update_orig_pointers(ob_orig, ob); | BKE_gpencil_update_orig_pointers(ob_orig, ob); | ||||
| } | } | ||||
| void BKE_gpencil_modifiers_calc(Depsgraph *depsgraph, Scene *scene, Object *ob) | void BKE_gpencil_modifiers_calc(Depsgraph *depsgraph, Scene *scene, Object *ob) | ||||
| { | { | ||||
| bGPdata *gpd = (bGPdata *)ob->data; | bGPdata *gpd = (bGPdata *)ob->data; | ||||
| const bool is_edit = GPENCIL_ANY_EDIT_MODE(gpd); | const bool is_edit = GPENCIL_ANY_EDIT_MODE(gpd); | ||||
| ▲ Show 20 Lines • Show All 231 Lines • Show Last 20 Lines | |||||