Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/gpencil.c
| Show All 28 Lines | |||||
| #include <stdio.h> | #include <stdio.h> | ||||
| #include <string.h> | #include <string.h> | ||||
| #include <stdlib.h> | #include <stdlib.h> | ||||
| #include <stddef.h> | #include <stddef.h> | ||||
| #include <math.h> | #include <math.h> | ||||
| #include "CLG_log.h" | |||||
| #include "MEM_guardedalloc.h" | #include "MEM_guardedalloc.h" | ||||
| #include "BLI_blenlib.h" | #include "BLI_blenlib.h" | ||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| #include "BLI_math_vector.h" | #include "BLI_math_vector.h" | ||||
| #include "BLI_string_utils.h" | #include "BLI_string_utils.h" | ||||
| #include "BLT_translation.h" | #include "BLT_translation.h" | ||||
| Show All 14 Lines | |||||
| #include "BKE_icons.h" | #include "BKE_icons.h" | ||||
| #include "BKE_library.h" | #include "BKE_library.h" | ||||
| #include "BKE_main.h" | #include "BKE_main.h" | ||||
| #include "BKE_object.h" | #include "BKE_object.h" | ||||
| #include "BKE_material.h" | #include "BKE_material.h" | ||||
| #include "DEG_depsgraph.h" | #include "DEG_depsgraph.h" | ||||
| static CLG_LogRef LOG = {"bke.gpencil"}; | |||||
| /* ************************************************** */ | /* ************************************************** */ | ||||
| /* Draw Engine */ | /* Draw Engine */ | ||||
| void(*BKE_gpencil_batch_cache_dirty_tag_cb)(bGPdata *gpd) = NULL; | void(*BKE_gpencil_batch_cache_dirty_tag_cb)(bGPdata *gpd) = NULL; | ||||
| void(*BKE_gpencil_batch_cache_free_cb)(bGPdata *gpd) = NULL; | void(*BKE_gpencil_batch_cache_free_cb)(bGPdata *gpd) = NULL; | ||||
| void BKE_gpencil_batch_cache_dirty_tag(bGPdata *gpd) | void BKE_gpencil_batch_cache_dirty_tag(bGPdata *gpd) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 182 Lines • ▼ Show 20 Lines | for (gf = gpl->frames.first; gf; gf = gf->next) { | ||||
| state = 1; | state = 1; | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| /* check whether frame was added successfully */ | /* check whether frame was added successfully */ | ||||
| if (state == -1) { | if (state == -1) { | ||||
| printf("Error: Frame (%d) existed already for this layer. Using existing frame\n", cframe); | CLOG_ERROR(&LOG, "Frame (%d) existed already for this layer. Using existing frame", cframe); | ||||
| /* free the newly created one, and use the old one instead */ | /* free the newly created one, and use the old one instead */ | ||||
| MEM_freeN(gpf); | MEM_freeN(gpf); | ||||
| /* return existing frame instead... */ | /* return existing frame instead... */ | ||||
| BLI_assert(gf != NULL); | BLI_assert(gf != NULL); | ||||
| gpf = gf; | gpf = gf; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 608 Lines • ▼ Show 20 Lines | if (addnew) { | ||||
| gpl->actframe = gpf; | gpl->actframe = gpf; | ||||
| else | else | ||||
| gpl->actframe = BKE_gpencil_frame_addnew(gpl, cframe); | gpl->actframe = BKE_gpencil_frame_addnew(gpl, cframe); | ||||
| } | } | ||||
| else if (found) | else if (found) | ||||
| gpl->actframe = gpf; | gpl->actframe = gpf; | ||||
| else { | else { | ||||
| /* unresolved errogenous situation! */ | /* unresolved errogenous situation! */ | ||||
| printf("Error: cannot find appropriate gp-frame\n"); | CLOG_STR_ERROR(&LOG, "cannot find appropriate gp-frame"); | ||||
| /* gpl->actframe should still be NULL */ | /* gpl->actframe should still be NULL */ | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| /* currently no frames (add if allowed to) */ | /* currently no frames (add if allowed to) */ | ||||
| if (addnew) | if (addnew) | ||||
| gpl->actframe = BKE_gpencil_frame_addnew(gpl, cframe); | gpl->actframe = BKE_gpencil_frame_addnew(gpl, cframe); | ||||
| else { | else { | ||||
| ▲ Show 20 Lines • Show All 805 Lines • Show Last 20 Lines | |||||