Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-05-06 19:15:33 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-05-06 19:15:33 +0400
commitc93d7a193ab450f89664a70e0204c14531be4877 (patch)
tree7263e2b9b83922d766f59f3f7531157c0f71be35 /source/blender/blenkernel/intern/gpencil.c
parent53b221960acaa63cc50bd8095d0ea11f9de539e1 (diff)
style cleanup: BKE_*.c files which deal with library functions
Diffstat (limited to 'source/blender/blenkernel/intern/gpencil.c')
-rw-r--r--source/blender/blenkernel/intern/gpencil.c140
1 files changed, 70 insertions, 70 deletions
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index da3acce9228..6ec19018ab5 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -62,8 +62,8 @@ void free_gpencil_strokes(bGPDframe *gpf)
if (gpf == NULL) return;
/* free strokes */
- for (gps= gpf->strokes.first; gps; gps= gpsn) {
- gpsn= gps->next;
+ for (gps = gpf->strokes.first; gps; gps = gpsn) {
+ gpsn = gps->next;
/* free stroke memory arrays, then stroke itself */
if (gps->points) MEM_freeN(gps->points);
@@ -80,8 +80,8 @@ void free_gpencil_frames(bGPDlayer *gpl)
if (gpl == NULL) return;
/* free frames */
- for (gpf= gpl->frames.first; gpf; gpf= gpfn) {
- gpfn= gpf->next;
+ for (gpf = gpl->frames.first; gpf; gpf = gpfn) {
+ gpfn = gpf->next;
/* free strokes and their associated memory */
free_gpencil_strokes(gpf);
@@ -98,8 +98,8 @@ void free_gpencil_layers(ListBase *list)
if (list == NULL) return;
/* delete layers*/
- for (gpl= list->first; gpl; gpl= gpln) {
- gpln= gpl->next;
+ for (gpl = list->first; gpl; gpl = gpln) {
+ gpln = gpl->next;
/* free layers and their data */
free_gpencil_frames(gpl);
@@ -117,32 +117,32 @@ void BKE_gpencil_free(bGPdata *gpd)
/* -------- Container Creation ---------- */
/* add a new gp-frame to the given layer */
-bGPDframe *gpencil_frame_addnew (bGPDlayer *gpl, int cframe)
+bGPDframe *gpencil_frame_addnew(bGPDlayer *gpl, int cframe)
{
bGPDframe *gpf, *gf;
- short state=0;
+ short state = 0;
/* error checking */
if ((gpl == NULL) || (cframe <= 0))
return NULL;
/* allocate memory for this frame */
- gpf= MEM_callocN(sizeof(bGPDframe), "bGPDframe");
- gpf->framenum= cframe;
+ gpf = MEM_callocN(sizeof(bGPDframe), "bGPDframe");
+ gpf->framenum = cframe;
/* find appropriate place to add frame */
if (gpl->frames.first) {
- for (gf= gpl->frames.first; gf; gf= gf->next) {
+ for (gf = gpl->frames.first; gf; gf = gf->next) {
/* check if frame matches one that is supposed to be added */
if (gf->framenum == cframe) {
- state= -1;
+ state = -1;
break;
}
/* if current frame has already exceeded the frame to add, add before */
if (gf->framenum > cframe) {
BLI_insertlinkbefore(&gpl->frames, gf, gpf);
- state= 1;
+ state = 1;
break;
}
}
@@ -163,7 +163,7 @@ bGPDframe *gpencil_frame_addnew (bGPDlayer *gpl, int cframe)
}
/* add a new gp-layer and make it the active layer */
-bGPDlayer *gpencil_layer_addnew (bGPdata *gpd)
+bGPDlayer *gpencil_layer_addnew(bGPdata *gpd)
{
bGPDlayer *gpl;
@@ -172,13 +172,13 @@ bGPDlayer *gpencil_layer_addnew (bGPdata *gpd)
return NULL;
/* allocate memory for frame and add to end of list */
- gpl= MEM_callocN(sizeof(bGPDlayer), "bGPDlayer");
+ gpl = MEM_callocN(sizeof(bGPDlayer), "bGPDlayer");
/* add to datablock */
BLI_addtail(&gpd->layers, gpl);
/* set basic settings */
- gpl->color[3]= 0.9f;
+ gpl->color[3] = 0.9f;
gpl->thickness = 3;
/* auto-name */
@@ -193,15 +193,15 @@ bGPDlayer *gpencil_layer_addnew (bGPdata *gpd)
}
/* add a new gp-datablock */
-bGPdata *gpencil_data_addnew (const char name[])
+bGPdata *gpencil_data_addnew(const char name[])
{
bGPdata *gpd;
/* allocate memory for a new block */
- gpd= BKE_libblock_alloc(&G.main->gpencil, ID_GD, name);
+ gpd = BKE_libblock_alloc(&G.main->gpencil, ID_GD, name);
/* initial settings */
- gpd->flag = (GP_DATA_DISPINFO|GP_DATA_EXPAND);
+ gpd->flag = (GP_DATA_DISPINFO | GP_DATA_EXPAND);
/* for now, stick to view is also enabled by default
* since this is more useful...
@@ -214,7 +214,7 @@ bGPdata *gpencil_data_addnew (const char name[])
/* -------- Data Duplication ---------- */
/* make a copy of a given gpencil frame */
-bGPDframe *gpencil_frame_duplicate (bGPDframe *src)
+bGPDframe *gpencil_frame_duplicate(bGPDframe *src)
{
bGPDstroke *gps, *gpsd;
bGPDframe *dst;
@@ -224,15 +224,15 @@ bGPDframe *gpencil_frame_duplicate (bGPDframe *src)
return NULL;
/* make a copy of the source frame */
- dst= MEM_dupallocN(src);
- dst->prev= dst->next= NULL;
+ dst = MEM_dupallocN(src);
+ dst->prev = dst->next = NULL;
/* copy strokes */
- dst->strokes.first = dst->strokes.last= NULL;
- for (gps= src->strokes.first; gps; gps= gps->next) {
+ dst->strokes.first = dst->strokes.last = NULL;
+ for (gps = src->strokes.first; gps; gps = gps->next) {
/* make copy of source stroke, then adjust pointer to points too */
- gpsd= MEM_dupallocN(gps);
- gpsd->points= MEM_dupallocN(gps->points);
+ gpsd = MEM_dupallocN(gps);
+ gpsd->points = MEM_dupallocN(gps->points);
BLI_addtail(&dst->strokes, gpsd);
}
@@ -242,7 +242,7 @@ bGPDframe *gpencil_frame_duplicate (bGPDframe *src)
}
/* make a copy of a given gpencil layer */
-bGPDlayer *gpencil_layer_duplicate (bGPDlayer *src)
+bGPDlayer *gpencil_layer_duplicate(bGPDlayer *src)
{
bGPDframe *gpf, *gpfd;
bGPDlayer *dst;
@@ -252,19 +252,19 @@ bGPDlayer *gpencil_layer_duplicate (bGPDlayer *src)
return NULL;
/* make a copy of source layer */
- dst= MEM_dupallocN(src);
- dst->prev= dst->next= NULL;
+ dst = MEM_dupallocN(src);
+ dst->prev = dst->next = NULL;
/* copy frames */
- dst->frames.first= dst->frames.last= NULL;
- for (gpf= src->frames.first; gpf; gpf= gpf->next) {
+ dst->frames.first = dst->frames.last = NULL;
+ for (gpf = src->frames.first; gpf; gpf = gpf->next) {
/* make a copy of source frame */
- gpfd= gpencil_frame_duplicate(gpf);
+ gpfd = gpencil_frame_duplicate(gpf);
BLI_addtail(&dst->frames, gpfd);
/* if source frame was the current layer's 'active' frame, reassign that too */
if (gpf == dst->actframe)
- dst->actframe= gpfd;
+ dst->actframe = gpfd;
}
/* return new layer */
@@ -272,7 +272,7 @@ bGPDlayer *gpencil_layer_duplicate (bGPDlayer *src)
}
/* make a copy of a given gpencil datablock */
-bGPdata *gpencil_data_duplicate (bGPdata *src)
+bGPdata *gpencil_data_duplicate(bGPdata *src)
{
bGPDlayer *gpl, *gpld;
bGPdata *dst;
@@ -282,13 +282,13 @@ bGPdata *gpencil_data_duplicate (bGPdata *src)
return NULL;
/* make a copy of the base-data */
- dst= MEM_dupallocN(src);
+ dst = MEM_dupallocN(src);
/* copy layers */
- dst->layers.first= dst->layers.last= NULL;
- for (gpl= src->layers.first; gpl; gpl= gpl->next) {
+ dst->layers.first = dst->layers.last = NULL;
+ for (gpl = src->layers.first; gpl; gpl = gpl->next) {
/* make a copy of source layer and its data */
- gpld= gpencil_layer_duplicate(gpl);
+ gpld = gpencil_layer_duplicate(gpl);
BLI_addtail(&dst->layers, gpld);
}
@@ -301,7 +301,7 @@ bGPdata *gpencil_data_duplicate (bGPdata *src)
/* delete the last stroke of the given frame */
void gpencil_frame_delete_laststroke(bGPDlayer *gpl, bGPDframe *gpf)
{
- bGPDstroke *gps= (gpf) ? gpf->strokes.last : NULL;
+ bGPDstroke *gps = (gpf) ? gpf->strokes.last : NULL;
int cfra = (gpf) ? gpf->framenum : 0; /* assume that the current frame was not locked */
/* error checking */
@@ -325,7 +325,7 @@ void gpencil_frame_delete_laststroke(bGPDlayer *gpl, bGPDframe *gpf)
* - this sets the layer's actframe var (if allowed to)
* - extension beyond range (if first gp-frame is after all frame in interest and cannot add)
*/
-bGPDframe *gpencil_layer_getframe (bGPDlayer *gpl, int cframe, short addnew)
+bGPDframe *gpencil_layer_getframe(bGPDlayer *gpl, int cframe, short addnew)
{
bGPDframe *gpf = NULL;
short found = 0;
@@ -336,12 +336,12 @@ bGPDframe *gpencil_layer_getframe (bGPDlayer *gpl, int cframe, short addnew)
/* check if there is already an active frame */
if (gpl->actframe) {
- gpf= gpl->actframe;
+ gpf = gpl->actframe;
/* do not allow any changes to layer's active frame if layer is locked from changes
* or if the layer has been set to stay on the current frame
*/
- if (gpl->flag & (GP_LAYER_LOCKED|GP_LAYER_FRAMELOCK))
+ if (gpl->flag & (GP_LAYER_LOCKED | GP_LAYER_FRAMELOCK))
return gpf;
/* do not allow any changes to actframe if frame has painting tag attached to it */
if (gpf->flag & GP_FRAME_PAINT)
@@ -349,13 +349,13 @@ bGPDframe *gpencil_layer_getframe (bGPDlayer *gpl, int cframe, short addnew)
/* try to find matching frame */
if (gpf->framenum < cframe) {
- for (; gpf; gpf= gpf->next) {
+ for (; gpf; gpf = gpf->next) {
if (gpf->framenum == cframe) {
- found= 1;
+ found = 1;
break;
}
else if ((gpf->next) && (gpf->next->framenum > cframe)) {
- found= 1;
+ found = 1;
break;
}
}
@@ -363,19 +363,19 @@ bGPDframe *gpencil_layer_getframe (bGPDlayer *gpl, int cframe, short addnew)
/* set the appropriate frame */
if (addnew) {
if ((found) && (gpf->framenum == cframe))
- gpl->actframe= gpf;
+ gpl->actframe = gpf;
else
- gpl->actframe= gpencil_frame_addnew(gpl, cframe);
+ gpl->actframe = gpencil_frame_addnew(gpl, cframe);
}
else if (found)
- gpl->actframe= gpf;
+ gpl->actframe = gpf;
else
- gpl->actframe= gpl->frames.last;
+ gpl->actframe = gpl->frames.last;
}
else {
- for (; gpf; gpf= gpf->prev) {
+ for (; gpf; gpf = gpf->prev) {
if (gpf->framenum <= cframe) {
- found= 1;
+ found = 1;
break;
}
}
@@ -383,35 +383,35 @@ bGPDframe *gpencil_layer_getframe (bGPDlayer *gpl, int cframe, short addnew)
/* set the appropriate frame */
if (addnew) {
if ((found) && (gpf->framenum == cframe))
- gpl->actframe= gpf;
+ gpl->actframe = gpf;
else
- gpl->actframe= gpencil_frame_addnew(gpl, cframe);
+ gpl->actframe = gpencil_frame_addnew(gpl, cframe);
}
else if (found)
- gpl->actframe= gpf;
+ gpl->actframe = gpf;
else
- gpl->actframe= gpl->frames.first;
+ gpl->actframe = gpl->frames.first;
}
}
else if (gpl->frames.first) {
/* check which of the ends to start checking from */
- const int first= ((bGPDframe *)(gpl->frames.first))->framenum;
- const int last= ((bGPDframe *)(gpl->frames.last))->framenum;
+ const int first = ((bGPDframe *)(gpl->frames.first))->framenum;
+ const int last = ((bGPDframe *)(gpl->frames.last))->framenum;
- if (abs(cframe-first) > abs(cframe-last)) {
+ if (abs(cframe - first) > abs(cframe - last)) {
/* find gp-frame which is less than or equal to cframe */
- for (gpf= gpl->frames.last; gpf; gpf= gpf->prev) {
+ for (gpf = gpl->frames.last; gpf; gpf = gpf->prev) {
if (gpf->framenum <= cframe) {
- found= 1;
+ found = 1;
break;
}
}
}
else {
/* find gp-frame which is less than or equal to cframe */
- for (gpf= gpl->frames.first; gpf; gpf= gpf->next) {
+ for (gpf = gpl->frames.first; gpf; gpf = gpf->next) {
if (gpf->framenum <= cframe) {
- found= 1;
+ found = 1;
break;
}
}
@@ -420,12 +420,12 @@ bGPDframe *gpencil_layer_getframe (bGPDlayer *gpl, int cframe, short addnew)
/* set the appropriate frame */
if (addnew) {
if ((found) && (gpf->framenum == cframe))
- gpl->actframe= gpf;
+ gpl->actframe = gpf;
else
- gpl->actframe= gpencil_frame_addnew(gpl, cframe);
+ gpl->actframe = gpencil_frame_addnew(gpl, cframe);
}
else if (found)
- gpl->actframe= gpf;
+ gpl->actframe = gpf;
else {
/* unresolved errogenous situation! */
printf("Error: cannot find appropriate gp-frame\n");
@@ -435,7 +435,7 @@ bGPDframe *gpencil_layer_getframe (bGPDlayer *gpl, int cframe, short addnew)
else {
/* currently no frames (add if allowed to) */
if (addnew)
- gpl->actframe= gpencil_frame_addnew(gpl, cframe);
+ gpl->actframe = gpencil_frame_addnew(gpl, cframe);
else {
/* don't do anything... this may be when no frames yet! */
/* gpl->actframe should still be NULL */
@@ -460,7 +460,7 @@ void gpencil_layer_delframe(bGPDlayer *gpl, bGPDframe *gpf)
}
/* get the active gp-layer for editing */
-bGPDlayer *gpencil_layer_getactive (bGPdata *gpd)
+bGPDlayer *gpencil_layer_getactive(bGPdata *gpd)
{
bGPDlayer *gpl;
@@ -469,7 +469,7 @@ bGPDlayer *gpencil_layer_getactive (bGPdata *gpd)
return NULL;
/* loop over layers until found (assume only one active) */
- for (gpl=gpd->layers.first; gpl; gpl=gpl->next) {
+ for (gpl = gpd->layers.first; gpl; gpl = gpl->next) {
if (gpl->flag & GP_LAYER_ACTIVE)
return gpl;
}
@@ -488,7 +488,7 @@ void gpencil_layer_setactive(bGPdata *gpd, bGPDlayer *active)
return;
/* loop over layers deactivating all */
- for (gpl=gpd->layers.first; gpl; gpl=gpl->next)
+ for (gpl = gpd->layers.first; gpl; gpl = gpl->next)
gpl->flag &= ~GP_LAYER_ACTIVE;
/* set as active one */
@@ -498,7 +498,7 @@ void gpencil_layer_setactive(bGPdata *gpd, bGPDlayer *active)
/* delete the active gp-layer */
void gpencil_layer_delactive(bGPdata *gpd)
{
- bGPDlayer *gpl= gpencil_layer_getactive(gpd);
+ bGPDlayer *gpl = gpencil_layer_getactive(gpd);
/* error checking */
if (ELEM(NULL, gpd, gpl))