Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/gpencil/editaction_gpencil.c
| Show First 20 Lines • Show All 606 Lines • ▼ Show 20 Lines | |||||
| static short mirror_gpf_marker(bGPDframe *gpf, Scene *scene) | static short mirror_gpf_marker(bGPDframe *gpf, Scene *scene) | ||||
| { | { | ||||
| static TimeMarker *marker; | static TimeMarker *marker; | ||||
| static short initialized = 0; | static short initialized = 0; | ||||
| int diff; | int diff; | ||||
| /* In order for this mirror function to work without | /* In order for this mirror function to work without | ||||
| * any extra arguments being added, we use the case | * any extra arguments being added, we use the case | ||||
| * of bezt==NULL to denote that we should find the | * of gpf==NULL to denote that we should find the | ||||
| * marker to mirror over. The static pointer is safe | * marker to mirror over. The static pointer is safe | ||||
| * to use this way, as it will be set to null after | * to use this way, as it will be set to null after | ||||
| * each cycle in which this is called. | * each cycle in which this is called. | ||||
| */ | */ | ||||
| if (gpf) { | if (gpf) { | ||||
antoniov: As you are changing the code, maybe change this line to `(gpf != NULL)`makes code esay to read… | |||||
| /* mirroring time */ | /* mirroring time */ | ||||
| if ((gpf->flag & GP_FRAME_SELECT) && (marker)) { | if ((gpf->flag & GP_FRAME_SELECT) && (marker)) { | ||||
| diff = (marker->frame - gpf->framenum); | diff = (marker->frame - gpf->framenum); | ||||
| gpf->framenum = (marker->frame + diff); | gpf->framenum = (marker->frame + diff); | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| /* initialization time */ | /* initialization time */ | ||||
| Show All 24 Lines | case MIRROR_KEYS_CURFRAME: /* mirror over current frame */ | ||||
| break; | break; | ||||
| case MIRROR_KEYS_YAXIS: /* mirror over frame 0 */ | case MIRROR_KEYS_YAXIS: /* mirror over frame 0 */ | ||||
| ED_gplayer_frames_looper(gpl, scene, mirror_gpf_yaxis); | ED_gplayer_frames_looper(gpl, scene, mirror_gpf_yaxis); | ||||
| break; | break; | ||||
| case MIRROR_KEYS_XAXIS: /* mirror over value 0 */ | case MIRROR_KEYS_XAXIS: /* mirror over value 0 */ | ||||
| ED_gplayer_frames_looper(gpl, scene, mirror_gpf_xaxis); | ED_gplayer_frames_looper(gpl, scene, mirror_gpf_xaxis); | ||||
| break; | break; | ||||
| case MIRROR_KEYS_MARKER: /* mirror over marker */ | case MIRROR_KEYS_MARKER: /* mirror over marker */ | ||||
| mirror_gpf_marker(NULL, NULL); | mirror_gpf_marker(NULL, scene); | ||||
| ED_gplayer_frames_looper(gpl, scene, mirror_gpf_marker); | ED_gplayer_frames_looper(gpl, scene, mirror_gpf_marker); | ||||
| mirror_gpf_marker(NULL, NULL); | mirror_gpf_marker(NULL, scene); | ||||
| break; | break; | ||||
| default: /* just in case */ | default: /* just in case */ | ||||
| ED_gplayer_frames_looper(gpl, scene, mirror_gpf_yaxis); | ED_gplayer_frames_looper(gpl, scene, mirror_gpf_yaxis); | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| /* ***************************************** */ | /* ***************************************** */ | ||||
As you are changing the code, maybe change this line to (gpf != NULL)makes code esay to read and follow style guide.