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-08 15:48:19 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-05-08 15:48:19 +0400
commitd7bc2c7f0639d808095d600b534a879daec7b8d7 (patch)
tree33d62c63b6286ad7daf83d6a746ebc390c800185
parent17c48e711edd5815361b2e1e643841a3098a4224 (diff)
style cleanup: misc editor changes.
-rw-r--r--source/blender/editors/animation/anim_channels_defines.c1320
-rw-r--r--source/blender/editors/animation/fmodifier_ui.c348
-rw-r--r--source/blender/editors/animation/keyframing.c510
-rw-r--r--source/blender/editors/curve/editfont.c889
-rw-r--r--source/blender/editors/screen/screen_ops.c1086
-rw-r--r--source/blender/editors/space_script/script_edit.c4
-rw-r--r--source/blender/editors/space_script/script_ops.c2
-rw-r--r--source/blender/editors/space_script/space_script.c60
-rw-r--r--source/blender/editors/space_sequencer/sequencer_intern.h8
-rw-r--r--source/blender/editors/space_sequencer/sequencer_select.c2
-rw-r--r--source/blender/imbuf/intern/rectop.c298
11 files changed, 2264 insertions, 2263 deletions
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c
index b62222317bd..2e683d4d57b 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -79,10 +79,10 @@
// XXX constant defines to be moved elsewhere?
/* extra padding for lengths (to go under scrollers) */
-#define EXTRA_SCROLL_PAD 100.0f
+#define EXTRA_SCROLL_PAD 100.0f
/* size of indent steps */
-#define INDENT_STEP_SIZE 7
+#define INDENT_STEP_SIZE 7
#define ANIM_CHAN_NAME_SIZE 256
@@ -107,10 +107,10 @@ static void acf_generic_root_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUS
/* backdrop for top-level widgets (Scene and Object only) */
static void acf_generic_root_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc)
{
- bAnimChannelType *acf= ANIM_channel_get_typeinfo(ale);
- View2D *v2d= &ac->ar->v2d;
- short expanded= ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_EXPAND) != 0;
- short offset= (acf->get_offset) ? acf->get_offset(ac, ale) : 0;
+ bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
+ View2D *v2d = &ac->ar->v2d;
+ short expanded = ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_EXPAND) != 0;
+ short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0;
float color[3];
/* set backdrop drawing color */
@@ -119,7 +119,7 @@ static void acf_generic_root_backdrop(bAnimContext *ac, bAnimListElem *ale, floa
/* rounded corners on LHS only - top only when expanded, but bottom too when collapsed */
uiSetRoundBox(expanded ? UI_CNR_TOP_LEFT : (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT));
- uiDrawBox(GL_POLYGON, offset, yminc, v2d->cur.xmax+EXTRA_SCROLL_PAD, ymaxc, 8);
+ uiDrawBox(GL_POLYGON, offset, yminc, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc, 8);
}
@@ -133,9 +133,9 @@ static void acf_generic_dataexpand_color(bAnimContext *UNUSED(ac), bAnimListElem
/* backdrop for data expanders under top-level Scene/Object */
static void acf_generic_dataexpand_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc)
{
- bAnimChannelType *acf= ANIM_channel_get_typeinfo(ale);
- View2D *v2d= &ac->ar->v2d;
- short offset= (acf->get_offset) ? acf->get_offset(ac, ale) : 0;
+ bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
+ View2D *v2d = &ac->ar->v2d;
+ short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0;
float color[3];
/* set backdrop drawing color */
@@ -143,24 +143,24 @@ static void acf_generic_dataexpand_backdrop(bAnimContext *ac, bAnimListElem *ale
glColor3fv(color);
/* no rounded corner - just rectangular box */
- glRectf(offset, yminc, v2d->cur.xmax+EXTRA_SCROLL_PAD, ymaxc);
+ glRectf(offset, yminc, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc);
}
/* get backdrop color for generic channels */
static void acf_generic_channel_color(bAnimContext *ac, bAnimListElem *ale, float r_color[3])
{
- bAnimChannelType *acf= ANIM_channel_get_typeinfo(ale);
+ bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
SpaceAction *saction = NULL;
bActionGroup *grp = NULL;
- short indent= (acf->get_indent_level) ? acf->get_indent_level(ac, ale) : 0;
+ short indent = (acf->get_indent_level) ? acf->get_indent_level(ac, ale) : 0;
/* get context info needed... */
if ((ac->sl) && (ac->spacetype == SPACE_ACTION))
- saction= (SpaceAction *)ac->sl;
+ saction = (SpaceAction *)ac->sl;
if (ale->type == ANIMTYPE_FCURVE) {
- FCurve *fcu= (FCurve *)ale->data;
- grp= fcu->grp;
+ FCurve *fcu = (FCurve *)ale->data;
+ grp = fcu->grp;
}
/* set color for normal channels
@@ -168,7 +168,7 @@ static void acf_generic_channel_color(bAnimContext *ac, bAnimListElem *ale, floa
* - only use group colors if allowed to, and if actually feasible
*/
if ( (saction && !(saction->flag & SACTION_NODRAWGCOLORS)) &&
- ((grp) && (grp->customCol)) )
+ ((grp) && (grp->customCol)) )
{
unsigned char cp[3];
@@ -187,7 +187,7 @@ static void acf_generic_channel_color(bAnimContext *ac, bAnimListElem *ale, floa
}
else {
// FIXME: what happens when the indention is 1 greater than what it should be (due to grouping)?
- int colOfs= 20 - 20*indent;
+ int colOfs = 20 - 20 * indent;
UI_GetThemeColorShade3fv(TH_HEADER, colOfs, r_color);
}
}
@@ -195,9 +195,9 @@ static void acf_generic_channel_color(bAnimContext *ac, bAnimListElem *ale, floa
/* backdrop for generic channels */
static void acf_generic_channel_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc)
{
- bAnimChannelType *acf= ANIM_channel_get_typeinfo(ale);
- View2D *v2d= &ac->ar->v2d;
- short offset= (acf->get_offset) ? acf->get_offset(ac, ale) : 0;
+ bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
+ View2D *v2d = &ac->ar->v2d;
+ short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0;
float color[3];
/* set backdrop drawing color */
@@ -205,7 +205,7 @@ static void acf_generic_channel_backdrop(bAnimContext *ac, bAnimListElem *ale, f
glColor3fv(color);
/* no rounded corners - just rectangular box */
- glRectf(offset, yminc, v2d->cur.xmax+EXTRA_SCROLL_PAD, ymaxc);
+ glRectf(offset, yminc, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc);
}
/* Indention + Offset ------------------------------------------- */
@@ -229,11 +229,11 @@ static short acf_generic_indention_2(bAnimContext *ac, bAnimListElem *ale)
/* indention which varies with the grouping status */
static short acf_generic_indention_flexible(bAnimContext *UNUSED(ac), bAnimListElem *ale)
{
- short indent= 0;
+ short indent = 0;
/* grouped F-Curves need extra level of indention */
if (ale->type == ANIMTYPE_FCURVE) {
- FCurve *fcu= (FCurve *)ale->data;
+ FCurve *fcu = (FCurve *)ale->data;
// TODO: we need some way of specifying that the indention color should be one less...
if (fcu->grp)
@@ -247,7 +247,7 @@ static short acf_generic_indention_flexible(bAnimContext *UNUSED(ac), bAnimListE
/* basic offset for channels derived from indention */
static short acf_generic_basic_offset(bAnimContext *ac, bAnimListElem *ale)
{
- bAnimChannelType *acf= ANIM_channel_get_typeinfo(ale);
+ bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
if (acf && acf->get_indent_level)
return acf->get_indent_level(ac, ale) * INDENT_STEP_SIZE;
@@ -272,7 +272,7 @@ static short acf_nodetree_rootType_offset(bNodeTree *ntree)
case NTREE_TEXTURE:
/* 2 additional levels */
- return INDENT_STEP_SIZE*2;
+ return INDENT_STEP_SIZE * 2;
}
}
@@ -283,7 +283,7 @@ static short acf_nodetree_rootType_offset(bNodeTree *ntree)
/* offset for groups + grouped entities */
static short acf_generic_group_offset(bAnimContext *ac, bAnimListElem *ale)
{
- short offset= acf_generic_basic_offset(ac, ale);
+ short offset = acf_generic_basic_offset(ac, ale);
if (ale->id) {
/* texture animdata */
@@ -300,7 +300,7 @@ static short acf_generic_group_offset(bAnimContext *ac, bAnimListElem *ale)
/* nodetree animdata */
if (GS(ale->id->name) == ID_NT) {
- offset += acf_nodetree_rootType_offset((bNodeTree*)ale->id);
+ offset += acf_nodetree_rootType_offset((bNodeTree *)ale->id);
}
}
@@ -313,11 +313,11 @@ static short acf_generic_group_offset(bAnimContext *ac, bAnimListElem *ale)
/* name for ID block entries */
static void acf_generic_idblock_name(bAnimListElem *ale, char *name)
{
- ID *id= (ID *)ale->data; /* data pointed to should be an ID block */
+ ID *id = (ID *)ale->data; /* data pointed to should be an ID block */
/* just copy the name... */
if (id && name)
- BLI_strncpy(name, id->name+2, ANIM_CHAN_NAME_SIZE);
+ BLI_strncpy(name, id->name + 2, ANIM_CHAN_NAME_SIZE);
}
/* name property for ID block entries */
@@ -377,7 +377,7 @@ static short acf_generic_dataexpand_setting_valid(bAnimContext *ac, bAnimListEle
static void acf_summary_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float r_color[3])
{
// FIXME: hardcoded color - same as the 'action' line in NLA
- // reddish color
+ // reddish color
r_color[0] = 0.8f;
r_color[1] = 0.2f;
r_color[2] = 0.0f;
@@ -386,8 +386,8 @@ static void acf_summary_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(al
/* backdrop for summary widget */
static void acf_summary_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc)
{
- bAnimChannelType *acf= ANIM_channel_get_typeinfo(ale);
- View2D *v2d= &ac->ar->v2d;
+ bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
+ View2D *v2d = &ac->ar->v2d;
float color[3];
/* set backdrop drawing color */
@@ -399,7 +399,7 @@ static void acf_summary_backdrop(bAnimContext *ac, bAnimListElem *ale, float ymi
* - special hack: make the top a bit higher, since we are first...
*/
uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT);
- uiDrawBox(GL_POLYGON, 0, yminc-2, v2d->cur.xmax+EXTRA_SCROLL_PAD, ymaxc, 8);
+ uiDrawBox(GL_POLYGON, 0, yminc - 2, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc, 8);
}
/* name for summary entries */
@@ -427,12 +427,12 @@ static int acf_summary_setting_flag(bAnimContext *UNUSED(ac), int setting, short
{
if (setting == ACHANNEL_SETTING_EXPAND) {
/* expanded */
- *neg= 1;
+ *neg = 1;
return ADS_FLAG_SUMMARY_COLLAPSED;
}
else {
/* unsupported */
- *neg= 0;
+ *neg = 0;
return 0;
}
}
@@ -440,21 +440,21 @@ static int acf_summary_setting_flag(bAnimContext *UNUSED(ac), int setting, short
/* get pointer to the setting */
static void *acf_summary_setting_ptr(bAnimListElem *ale, int setting, short *type)
{
- bAnimContext *ac= (bAnimContext *)ale->data;
+ bAnimContext *ac = (bAnimContext *)ale->data;
/* if data is valid, return pointer to active dopesheet's relevant flag
* - this is restricted to DopeSheet/Action Editor only
*/
if ((ac->sl) && (ac->spacetype == SPACE_ACTION) && (setting == ACHANNEL_SETTING_EXPAND)) {
- SpaceAction *saction= (SpaceAction *)ac->sl;
- bDopeSheet *ads= &saction->ads;
+ SpaceAction *saction = (SpaceAction *)ac->sl;
+ bDopeSheet *ads = &saction->ads;
/* return pointer to DopeSheet's flag */
return GET_ACF_FLAG_PTR(ads->flag, type);
}
else {
/* can't return anything useful - unsupported */
- *type= 0;
+ *type = 0;
return NULL;
}
}
@@ -462,20 +462,20 @@ static void *acf_summary_setting_ptr(bAnimListElem *ale, int setting, short *typ
/* all animation summary (DopeSheet only) type define */
static bAnimChannelType ACF_SUMMARY =
{
- "Summary", /* type name */
+ "Summary", /* type name */
- acf_summary_color, /* backdrop color */
- acf_summary_backdrop, /* backdrop */
- acf_generic_indention_0, /* indent level */
- NULL, /* offset */
-
- acf_summary_name, /* name */
- NULL, /* name prop */
- acf_summary_icon, /* icon */
-
- acf_summary_setting_valid, /* has setting */
- acf_summary_setting_flag, /* flag for setting */
- acf_summary_setting_ptr /* pointer for setting */
+ acf_summary_color, /* backdrop color */
+ acf_summary_backdrop, /* backdrop */
+ acf_generic_indention_0, /* indent level */
+ NULL, /* offset */
+
+ acf_summary_name, /* name */
+ NULL, /* name prop */
+ acf_summary_icon, /* icon */
+
+ acf_summary_setting_valid, /* has setting */
+ acf_summary_setting_flag, /* flag for setting */
+ acf_summary_setting_ptr /* pointer for setting */
};
/* Scene ------------------------------------------- */
@@ -512,21 +512,21 @@ static short acf_scene_setting_valid(bAnimContext *ac, bAnimListElem *UNUSED(ale
static int acf_scene_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg)
{
/* clear extra return data first */
- *neg= 0;
+ *neg = 0;
switch (setting) {
case ACHANNEL_SETTING_SELECT: /* selected */
return SCE_DS_SELECTED;
case ACHANNEL_SETTING_EXPAND: /* expanded */
- *neg= 1;
+ *neg = 1;
return SCE_DS_COLLAPSED;
case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
return ADT_NLA_EVAL_OFF;
case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
- *neg= 1;
+ *neg = 1;
return ADT_CURVES_NOT_VISIBLE;
default: /* unsupported */
@@ -537,10 +537,10 @@ static int acf_scene_setting_flag(bAnimContext *UNUSED(ac), int setting, short *
/* get pointer to the setting */
static void *acf_scene_setting_ptr(bAnimListElem *ale, int setting, short *type)
{
- Scene *scene= (Scene *)ale->data;
+ Scene *scene = (Scene *)ale->data;
/* clear extra return data first */
- *type= 0;
+ *type = 0;
switch (setting) {
case ACHANNEL_SETTING_SELECT: /* selected */
@@ -564,28 +564,28 @@ static void *acf_scene_setting_ptr(bAnimListElem *ale, int setting, short *type)
/* scene type define */
static bAnimChannelType ACF_SCENE =
{
- "Scene", /* type name */
+ "Scene", /* type name */
- acf_generic_root_color, /* backdrop color */
- acf_generic_root_backdrop, /* backdrop */
- acf_generic_indention_0, /* indent level */
- NULL, /* offset */
-
- acf_generic_idblock_name, /* name */
- acf_generic_idblock_nameprop, /* name prop */
- acf_scene_icon, /* icon */
-
- acf_scene_setting_valid, /* has setting */
- acf_scene_setting_flag, /* flag for setting */
- acf_scene_setting_ptr /* pointer for setting */
+ acf_generic_root_color, /* backdrop color */
+ acf_generic_root_backdrop, /* backdrop */
+ acf_generic_indention_0, /* indent level */
+ NULL, /* offset */
+
+ acf_generic_idblock_name, /* name */
+ acf_generic_idblock_nameprop, /* name prop */
+ acf_scene_icon, /* icon */
+
+ acf_scene_setting_valid, /* has setting */
+ acf_scene_setting_flag, /* flag for setting */
+ acf_scene_setting_ptr /* pointer for setting */
};
/* Object ------------------------------------------- */
static int acf_object_icon(bAnimListElem *ale)
{
- Base *base= (Base *)ale->data;
- Object *ob= base->object;
+ Base *base = (Base *)ale->data;
+ Object *ob = base->object;
/* icon depends on object-type */
@@ -621,19 +621,19 @@ static int acf_object_icon(bAnimListElem *ale)
/* name for object */
static void acf_object_name(bAnimListElem *ale, char *name)
{
- Base *base= (Base *)ale->data;
- Object *ob= base->object;
+ Base *base = (Base *)ale->data;
+ Object *ob = base->object;
/* just copy the name... */
if (ob && name)
- BLI_strncpy(name, ob->id.name+2, ANIM_CHAN_NAME_SIZE);
+ BLI_strncpy(name, ob->id.name + 2, ANIM_CHAN_NAME_SIZE);
}
/* check if some setting exists for this channel */
static short acf_object_setting_valid(bAnimContext *ac, bAnimListElem *ale, int setting)
{
- Base *base= (Base *)ale->data;
- Object *ob= base->object;
+ Base *base = (Base *)ale->data;
+ Object *ob = base->object;
switch (setting) {
/* muted only in NLA */
@@ -658,21 +658,21 @@ static short acf_object_setting_valid(bAnimContext *ac, bAnimListElem *ale, int
static int acf_object_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg)
{
/* clear extra return data first */
- *neg= 0;
+ *neg = 0;
switch (setting) {
case ACHANNEL_SETTING_SELECT: /* selected */
return SELECT;
case ACHANNEL_SETTING_EXPAND: /* expanded */
- *neg= 1;
+ *neg = 1;
return OB_ADS_COLLAPSED;
case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
return ADT_NLA_EVAL_OFF;
case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
- *neg= 1;
+ *neg = 1;
return ADT_CURVES_NOT_VISIBLE;
default: /* unsupported */
@@ -683,11 +683,11 @@ static int acf_object_setting_flag(bAnimContext *UNUSED(ac), int setting, short
/* get pointer to the setting */
static void *acf_object_setting_ptr(bAnimListElem *ale, int setting, short *type)
{
- Base *base= (Base *)ale->data;
- Object *ob= base->object;
+ Base *base = (Base *)ale->data;
+ Object *ob = base->object;
/* clear extra return data first */
- *type= 0;
+ *type = 0;
switch (setting) {
case ACHANNEL_SETTING_SELECT: /* selected */
@@ -711,20 +711,20 @@ static void *acf_object_setting_ptr(bAnimListElem *ale, int setting, short *type
/* object type define */
static bAnimChannelType ACF_OBJECT =
{
- "Object", /* type name */
+ "Object", /* type name */
- acf_generic_root_color, /* backdrop color */
- acf_generic_root_backdrop, /* backdrop */
- acf_generic_indention_0, /* indent level */
- NULL, /* offset */
-
- acf_object_name, /* name */
- acf_generic_idblock_nameprop, /* name prop */
- acf_object_icon, /* icon */
-
- acf_object_setting_valid, /* has setting */
- acf_object_setting_flag, /* flag for setting */
- acf_object_setting_ptr /* pointer for setting */
+ acf_generic_root_color, /* backdrop color */
+ acf_generic_root_backdrop, /* backdrop */
+ acf_generic_indention_0, /* indent level */
+ NULL, /* offset */
+
+ acf_object_name, /* name */
+ acf_generic_idblock_nameprop, /* name prop */
+ acf_object_icon, /* icon */
+
+ acf_object_setting_valid, /* has setting */
+ acf_object_setting_flag, /* flag for setting */
+ acf_object_setting_ptr /* pointer for setting */
};
/* Group ------------------------------------------- */
@@ -742,10 +742,10 @@ static void acf_group_color(bAnimContext *UNUSED(ac), bAnimListElem *ale, float
/* backdrop for group widget */
static void acf_group_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc)
{
- bAnimChannelType *acf= ANIM_channel_get_typeinfo(ale);
- View2D *v2d= &ac->ar->v2d;
- short expanded= ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_EXPAND) != 0;
- short offset= (acf->get_offset) ? acf->get_offset(ac, ale) : 0;
+ bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
+ View2D *v2d = &ac->ar->v2d;
+ short expanded = ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_EXPAND) != 0;
+ short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0;
float color[3];
/* set backdrop drawing color */
@@ -754,13 +754,13 @@ static void acf_group_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc
/* rounded corners on LHS only - top only when expanded, but bottom too when collapsed */
uiSetRoundBox(expanded ? UI_CNR_TOP_LEFT : (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT));
- uiDrawBox(GL_POLYGON, offset, yminc, v2d->cur.xmax+EXTRA_SCROLL_PAD, ymaxc, 8);
+ uiDrawBox(GL_POLYGON, offset, yminc, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc, 8);
}
/* name for group entries */
static void acf_group_name(bAnimListElem *ale, char *name)
{
- bActionGroup *agrp= (bActionGroup *)ale->data;
+ bActionGroup *agrp = (bActionGroup *)ale->data;
/* just copy the name... */
if (agrp && name)
@@ -782,7 +782,7 @@ static short acf_group_setting_valid(bAnimContext *ac, bAnimListElem *UNUSED(ale
/* for now, all settings are supported, though some are only conditionally */
switch (setting) {
case ACHANNEL_SETTING_VISIBLE: /* Only available in Graph Editor */
- return (ac->spacetype==SPACE_IPO);
+ return (ac->spacetype == SPACE_IPO);
default: /* always supported */
return 1;
@@ -793,7 +793,7 @@ static short acf_group_setting_valid(bAnimContext *ac, bAnimListElem *UNUSED(ale
static int acf_group_setting_flag(bAnimContext *ac, int setting, short *neg)
{
/* clear extra return data first */
- *neg= 0;
+ *neg = 0;
switch (setting) {
case ACHANNEL_SETTING_SELECT: /* selected */
@@ -806,8 +806,8 @@ static int acf_group_setting_flag(bAnimContext *ac, int setting, short *neg)
* proved to be a hazard for workflows...
*/
return (ac->spacetype == SPACE_IPO) ?
- AGRP_EXPANDED_G : /* Graph Editor case */
- AGRP_EXPANDED; /* DopeSheet and elsewhere */
+ AGRP_EXPANDED_G : /* Graph Editor case */
+ AGRP_EXPANDED; /* DopeSheet and elsewhere */
}
case ACHANNEL_SETTING_MUTE: /* muted */
@@ -818,7 +818,7 @@ static int acf_group_setting_flag(bAnimContext *ac, int setting, short *neg)
return AGRP_PROTECTED;
case ACHANNEL_SETTING_VISIBLE: /* visiblity - graph editor */
- *neg= 1;
+ *neg = 1;
return AGRP_NOTVISIBLE;
}
@@ -829,7 +829,7 @@ static int acf_group_setting_flag(bAnimContext *ac, int setting, short *neg)
/* get pointer to the setting */
static void *acf_group_setting_ptr(bAnimListElem *ale, int UNUSED(setting), short *type)
{
- bActionGroup *agrp= (bActionGroup *)ale->data;
+ bActionGroup *agrp = (bActionGroup *)ale->data;
/* all flags are just in agrp->flag for now... */
return GET_ACF_FLAG_PTR(agrp->flag, type);
@@ -838,20 +838,20 @@ static void *acf_group_setting_ptr(bAnimListElem *ale, int UNUSED(setting), shor
/* group type define */
static bAnimChannelType ACF_GROUP =
{
- "Group", /* type name */
+ "Group", /* type name */
- acf_group_color, /* backdrop color */
- acf_group_backdrop, /* backdrop */
- acf_generic_indention_0, /* indent level */
- acf_generic_group_offset, /* offset */
-
- acf_group_name, /* name */
- acf_group_name_prop, /* name prop */
- NULL, /* icon */
-
- acf_group_setting_valid, /* has setting */
- acf_group_setting_flag, /* flag for setting */
- acf_group_setting_ptr /* pointer for setting */
+ acf_group_color, /* backdrop color */
+ acf_group_backdrop, /* backdrop */
+ acf_generic_indention_0, /* indent level */
+ acf_generic_group_offset, /* offset */
+
+ acf_group_name, /* name */
+ acf_group_name_prop, /* name prop */
+ NULL, /* icon */
+
+ acf_group_setting_valid, /* has setting */
+ acf_group_setting_flag, /* flag for setting */
+ acf_group_setting_ptr /* pointer for setting */
};
/* F-Curve ------------------------------------------- */
@@ -865,7 +865,7 @@ static void acf_fcurve_name(bAnimListElem *ale, char *name)
/* check if some setting exists for this channel */
static short acf_fcurve_setting_valid(bAnimContext *ac, bAnimListElem *ale, int setting)
{
- FCurve *fcu= (FCurve *)ale->data;
+ FCurve *fcu = (FCurve *)ale->data;
switch (setting) {
/* unsupported */
@@ -877,10 +877,10 @@ static short acf_fcurve_setting_valid(bAnimContext *ac, bAnimListElem *ale, int
if (fcu->bezt)
return 1;
else
- return 0; // NOTE: in this special case, we need to draw ICON_ZOOMOUT
+ return 0; // NOTE: in this special case, we need to draw ICON_ZOOMOUT
case ACHANNEL_SETTING_VISIBLE: /* Only available in Graph Editor */
- return (ac->spacetype==SPACE_IPO);
+ return (ac->spacetype == SPACE_IPO);
/* always available */
default:
@@ -892,7 +892,7 @@ static short acf_fcurve_setting_valid(bAnimContext *ac, bAnimListElem *ale, int
static int acf_fcurve_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg)
{
/* clear extra return data first */
- *neg= 0;
+ *neg = 0;
switch (setting) {
case ACHANNEL_SETTING_SELECT: /* selected */
@@ -916,7 +916,7 @@ static int acf_fcurve_setting_flag(bAnimContext *UNUSED(ac), int setting, short
/* get pointer to the setting */
static void *acf_fcurve_setting_ptr(bAnimListElem *ale, int UNUSED(setting), short *type)
{
- FCurve *fcu= (FCurve *)ale->data;
+ FCurve *fcu = (FCurve *)ale->data;
/* all flags are just in agrp->flag for now... */
return GET_ACF_FLAG_PTR(fcu->flag, type);
@@ -925,20 +925,20 @@ static void *acf_fcurve_setting_ptr(bAnimListElem *ale, int UNUSED(setting), sho
/* fcurve type define */
static bAnimChannelType ACF_FCURVE =
{
- "F-Curve", /* type name */
+ "F-Curve", /* type name */
- acf_generic_channel_color, /* backdrop color */
- acf_generic_channel_backdrop, /* backdrop */
- acf_generic_indention_flexible, /* indent level */ // xxx rename this to f-curves only?
- acf_generic_group_offset, /* offset */
-
- acf_fcurve_name, /* name */
- NULL, /* name prop */
- NULL, /* icon */
-
- acf_fcurve_setting_valid, /* has setting */
- acf_fcurve_setting_flag, /* flag for setting */
- acf_fcurve_setting_ptr /* pointer for setting */
+ acf_generic_channel_color, /* backdrop color */
+ acf_generic_channel_backdrop, /* backdrop */
+ acf_generic_indention_flexible, /* indent level */ // xxx rename this to f-curves only?
+ acf_generic_group_offset, /* offset */
+
+ acf_fcurve_name, /* name */
+ NULL, /* name prop */
+ NULL, /* icon */
+
+ acf_fcurve_setting_valid, /* has setting */
+ acf_fcurve_setting_flag, /* flag for setting */
+ acf_fcurve_setting_ptr /* pointer for setting */
};
/* Object Action Expander ------------------------------------------- */
@@ -967,14 +967,14 @@ static short acf_fillactd_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem
static int acf_fillactd_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg)
{
/* clear extra return data first */
- *neg= 0;
+ *neg = 0;
switch (setting) {
case ACHANNEL_SETTING_SELECT: /* selected */
return ADT_UI_SELECTED;
case ACHANNEL_SETTING_EXPAND: /* expanded */
- *neg= 1;
+ *neg = 1;
return ACT_COLLAPSED;
default: /* unsupported */
@@ -985,11 +985,11 @@ static int acf_fillactd_setting_flag(bAnimContext *UNUSED(ac), int setting, shor
/* get pointer to the setting */
static void *acf_fillactd_setting_ptr(bAnimListElem *ale, int setting, short *type)
{
- bAction *act= (bAction *)ale->data;
- AnimData *adt= ale->adt;
+ bAction *act = (bAction *)ale->data;
+ AnimData *adt = ale->adt;
/* clear extra return data first */
- *type= 0;
+ *type = 0;
switch (setting) {
case ACHANNEL_SETTING_SELECT: /* selected */
@@ -1010,20 +1010,20 @@ static void *acf_fillactd_setting_ptr(bAnimListElem *ale, int setting, short *ty
/* object action expander type define */
static bAnimChannelType ACF_FILLACTD =
{
- "Ob-Action Filler", /* type name */
+ "Ob-Action Filler", /* type name */
- acf_generic_dataexpand_color, /* backdrop color */
- acf_generic_dataexpand_backdrop,/* backdrop */
- acf_generic_indention_1, /* indent level */
- acf_generic_basic_offset, /* offset */
-
- acf_generic_idblock_name, /* name */
- acf_generic_idfill_nameprop, /* name prop */
- acf_fillactd_icon, /* icon */
-
- acf_fillactd_setting_valid, /* has setting */
- acf_fillactd_setting_flag, /* flag for setting */
- acf_fillactd_setting_ptr /* pointer for setting */
+ acf_generic_dataexpand_color, /* backdrop color */
+ acf_generic_dataexpand_backdrop, /* backdrop */
+ acf_generic_indention_1, /* indent level */
+ acf_generic_basic_offset, /* offset */
+
+ acf_generic_idblock_name, /* name */
+ acf_generic_idfill_nameprop, /* name prop */
+ acf_fillactd_icon, /* icon */
+
+ acf_fillactd_setting_valid, /* has setting */
+ acf_fillactd_setting_flag, /* flag for setting */
+ acf_fillactd_setting_ptr /* pointer for setting */
};
/* Drivers Expander ------------------------------------------- */
@@ -1057,11 +1057,11 @@ static short acf_filldrivers_setting_valid(bAnimContext *UNUSED(ac), bAnimListEl
static int acf_filldrivers_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg)
{
/* clear extra return data first */
- *neg= 0;
+ *neg = 0;
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
- *neg= 1;
+ *neg = 1;
return ADT_DRIVERS_COLLAPSED;
default: /* unsupported */
@@ -1072,10 +1072,10 @@ static int acf_filldrivers_setting_flag(bAnimContext *UNUSED(ac), int setting, s
/* get pointer to the setting */
static void *acf_filldrivers_setting_ptr(bAnimListElem *ale, int setting, short *type)
{
- AnimData *adt= (AnimData *)ale->data;
+ AnimData *adt = (AnimData *)ale->data;
/* clear extra return data first */
- *type= 0;
+ *type = 0;
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
@@ -1089,20 +1089,20 @@ static void *acf_filldrivers_setting_ptr(bAnimListElem *ale, int setting, short
/* drivers expander type define */
static bAnimChannelType ACF_FILLDRIVERS =
{
- "Drivers Filler", /* type name */
+ "Drivers Filler", /* type name */
- acf_generic_dataexpand_color, /* backdrop color */
- acf_generic_dataexpand_backdrop,/* backdrop */
- acf_generic_indention_1, /* indent level */
- acf_generic_basic_offset, /* offset */
-
- acf_filldrivers_name, /* name */
- NULL, /* name prop */
- acf_filldrivers_icon, /* icon */
-
- acf_filldrivers_setting_valid, /* has setting */
- acf_filldrivers_setting_flag, /* flag for setting */
- acf_filldrivers_setting_ptr /* pointer for setting */
+ acf_generic_dataexpand_color, /* backdrop color */
+ acf_generic_dataexpand_backdrop, /* backdrop */
+ acf_generic_indention_1, /* indent level */
+ acf_generic_basic_offset, /* offset */
+
+ acf_filldrivers_name, /* name */
+ NULL, /* name prop */
+ acf_filldrivers_icon, /* icon */
+
+ acf_filldrivers_setting_valid, /* has setting */
+ acf_filldrivers_setting_flag, /* flag for setting */
+ acf_filldrivers_setting_ptr /* pointer for setting */
};
@@ -1118,7 +1118,7 @@ static int acf_dsmat_icon(bAnimListElem *UNUSED(ale))
static int acf_dsmat_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg)
{
/* clear extra return data first */
- *neg= 0;
+ *neg = 0;
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
@@ -1128,7 +1128,7 @@ static int acf_dsmat_setting_flag(bAnimContext *UNUSED(ac), int setting, short *
return ADT_NLA_EVAL_OFF;
case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
- *neg= 1;
+ *neg = 1;
return ADT_CURVES_NOT_VISIBLE;
case ACHANNEL_SETTING_SELECT: /* selected */
@@ -1142,10 +1142,10 @@ static int acf_dsmat_setting_flag(bAnimContext *UNUSED(ac), int setting, short *
/* get pointer to the setting */
static void *acf_dsmat_setting_ptr(bAnimListElem *ale, int setting, short *type)
{
- Material *ma= (Material *)ale->data;
+ Material *ma = (Material *)ale->data;
/* clear extra return data first */
- *type= 0;
+ *type = 0;
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
@@ -1165,22 +1165,22 @@ static void *acf_dsmat_setting_ptr(bAnimListElem *ale, int setting, short *type)
}
/* material expander type define */
-static bAnimChannelType ACF_DSMAT=
+static bAnimChannelType ACF_DSMAT =
{
- "Material Data Expander", /* type name */
+ "Material Data Expander", /* type name */
- acf_generic_dataexpand_color, /* backdrop color */
- acf_generic_dataexpand_backdrop,/* backdrop */
- acf_generic_indention_1, /* indent level */
- acf_generic_basic_offset, /* offset */
-
- acf_generic_idblock_name, /* name */
- acf_generic_idblock_nameprop, /* name prop */
- acf_dsmat_icon, /* icon */
-
- acf_generic_dataexpand_setting_valid, /* has setting */
- acf_dsmat_setting_flag, /* flag for setting */
- acf_dsmat_setting_ptr /* pointer for setting */
+ acf_generic_dataexpand_color, /* backdrop color */
+ acf_generic_dataexpand_backdrop, /* backdrop */
+ acf_generic_indention_1, /* indent level */
+ acf_generic_basic_offset, /* offset */
+
+ acf_generic_idblock_name, /* name */
+ acf_generic_idblock_nameprop, /* name prop */
+ acf_dsmat_icon, /* icon */
+
+ acf_generic_dataexpand_setting_valid, /* has setting */
+ acf_dsmat_setting_flag, /* flag for setting */
+ acf_dsmat_setting_ptr /* pointer for setting */
};
/* Lamp Expander ------------------------------------------- */
@@ -1195,7 +1195,7 @@ static int acf_dslam_icon(bAnimListElem *UNUSED(ale))
static int acf_dslam_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg)
{
/* clear extra return data first */
- *neg= 0;
+ *neg = 0;
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
@@ -1205,7 +1205,7 @@ static int acf_dslam_setting_flag(bAnimContext *UNUSED(ac), int setting, short *
return ADT_NLA_EVAL_OFF;
case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
- *neg= 1;
+ *neg = 1;
return ADT_CURVES_NOT_VISIBLE;
case ACHANNEL_SETTING_SELECT: /* selected */
@@ -1219,10 +1219,10 @@ static int acf_dslam_setting_flag(bAnimContext *UNUSED(ac), int setting, short *
/* get pointer to the setting */
static void *acf_dslam_setting_ptr(bAnimListElem *ale, int setting, short *type)
{
- Lamp *la= (Lamp *)ale->data;
+ Lamp *la = (Lamp *)ale->data;
/* clear extra return data first */
- *type= 0;
+ *type = 0;
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
@@ -1242,22 +1242,22 @@ static void *acf_dslam_setting_ptr(bAnimListElem *ale, int setting, short *type)
}
/* lamp expander type define */
-static bAnimChannelType ACF_DSLAM=
+static bAnimChannelType ACF_DSLAM =
{
- "Lamp Expander", /* type name */
+ "Lamp Expander", /* type name */
- acf_generic_dataexpand_color, /* backdrop color */
- acf_generic_dataexpand_backdrop,/* backdrop */
- acf_generic_indention_1, /* indent level */
- acf_generic_basic_offset, /* offset */
-
- acf_generic_idblock_name, /* name */
- acf_generic_idblock_nameprop, /* name prop */
- acf_dslam_icon, /* icon */
-
- acf_generic_dataexpand_setting_valid, /* has setting */
- acf_dslam_setting_flag, /* flag for setting */
- acf_dslam_setting_ptr /* pointer for setting */
+ acf_generic_dataexpand_color, /* backdrop color */
+ acf_generic_dataexpand_backdrop, /* backdrop */
+ acf_generic_indention_1, /* indent level */
+ acf_generic_basic_offset, /* offset */
+
+ acf_generic_idblock_name, /* name */
+ acf_generic_idblock_nameprop, /* name prop */
+ acf_dslam_icon, /* icon */
+
+ acf_generic_dataexpand_setting_valid, /* has setting */
+ acf_dslam_setting_flag, /* flag for setting */
+ acf_dslam_setting_ptr /* pointer for setting */
};
/* Texture Expander ------------------------------------------- */
@@ -1279,7 +1279,7 @@ static short acf_dstex_offset(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(al
static int acf_dstex_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg)
{
/* clear extra return data first */
- *neg= 0;
+ *neg = 0;
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
@@ -1289,7 +1289,7 @@ static int acf_dstex_setting_flag(bAnimContext *UNUSED(ac), int setting, short *
return ADT_NLA_EVAL_OFF;
case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
- *neg= 1;
+ *neg = 1;
return ADT_CURVES_NOT_VISIBLE;
case ACHANNEL_SETTING_SELECT: /* selected */
@@ -1303,10 +1303,10 @@ static int acf_dstex_setting_flag(bAnimContext *UNUSED(ac), int setting, short *
/* get pointer to the setting */
static void *acf_dstex_setting_ptr(bAnimListElem *ale, int setting, short *type)
{
- Tex *tex= (Tex *)ale->data;
+ Tex *tex = (Tex *)ale->data;
/* clear extra return data first */
- *type= 0;
+ *type = 0;
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
@@ -1326,22 +1326,22 @@ static void *acf_dstex_setting_ptr(bAnimListElem *ale, int setting, short *type)
}
/* texture expander type define */
-static bAnimChannelType ACF_DSTEX=
+static bAnimChannelType ACF_DSTEX =
{
- "Texture Data Expander", /* type name */
+ "Texture Data Expander", /* type name */
- acf_generic_dataexpand_color, /* backdrop color */
- acf_generic_dataexpand_backdrop,/* backdrop */
- acf_generic_indention_1, /* indent level */
- acf_dstex_offset, /* offset */
-
- acf_generic_idblock_name, /* name */
- acf_generic_idfill_nameprop, /* name prop */
- acf_dstex_icon, /* icon */
-
- acf_generic_dataexpand_setting_valid, /* has setting */
- acf_dstex_setting_flag, /* flag for setting */
- acf_dstex_setting_ptr /* pointer for setting */
+ acf_generic_dataexpand_color, /* backdrop color */
+ acf_generic_dataexpand_backdrop, /* backdrop */
+ acf_generic_indention_1, /* indent level */
+ acf_dstex_offset, /* offset */
+
+ acf_generic_idblock_name, /* name */
+ acf_generic_idfill_nameprop, /* name prop */
+ acf_dstex_icon, /* icon */
+
+ acf_generic_dataexpand_setting_valid, /* has setting */
+ acf_dstex_setting_flag, /* flag for setting */
+ acf_dstex_setting_ptr /* pointer for setting */
};
/* Camera Expander ------------------------------------------- */
@@ -1356,7 +1356,7 @@ static int acf_dscam_icon(bAnimListElem *UNUSED(ale))
static int acf_dscam_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg)
{
/* clear extra return data first */
- *neg= 0;
+ *neg = 0;
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
@@ -1366,7 +1366,7 @@ static int acf_dscam_setting_flag(bAnimContext *UNUSED(ac), int setting, short *
return ADT_NLA_EVAL_OFF;
case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
- *neg= 1;
+ *neg = 1;
return ADT_CURVES_NOT_VISIBLE;
case ACHANNEL_SETTING_SELECT: /* selected */
@@ -1380,10 +1380,10 @@ static int acf_dscam_setting_flag(bAnimContext *UNUSED(ac), int setting, short *
/* get pointer to the setting */
static void *acf_dscam_setting_ptr(bAnimListElem *ale, int setting, short *type)
{
- Camera *ca= (Camera *)ale->data;
+ Camera *ca = (Camera *)ale->data;
/* clear extra return data first */
- *type= 0;
+ *type = 0;
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
@@ -1403,22 +1403,22 @@ static void *acf_dscam_setting_ptr(bAnimListElem *ale, int setting, short *type)
}
/* camera expander type define */
-static bAnimChannelType ACF_DSCAM=
+static bAnimChannelType ACF_DSCAM =
{
- "Camera Expander", /* type name */
+ "Camera Expander", /* type name */
- acf_generic_dataexpand_color, /* backdrop color */
- acf_generic_dataexpand_backdrop,/* backdrop */
- acf_generic_indention_1, /* indent level */
- acf_generic_basic_offset, /* offset */
-
- acf_generic_idblock_name, /* name */
- acf_generic_idfill_nameprop, /* name prop */
- acf_dscam_icon, /* icon */
-
- acf_generic_dataexpand_setting_valid, /* has setting */
- acf_dscam_setting_flag, /* flag for setting */
- acf_dscam_setting_ptr /* pointer for setting */
+ acf_generic_dataexpand_color, /* backdrop color */
+ acf_generic_dataexpand_backdrop, /* backdrop */
+ acf_generic_indention_1, /* indent level */
+ acf_generic_basic_offset, /* offset */
+
+ acf_generic_idblock_name, /* name */
+ acf_generic_idfill_nameprop, /* name prop */
+ acf_dscam_icon, /* icon */
+
+ acf_generic_dataexpand_setting_valid, /* has setting */
+ acf_dscam_setting_flag, /* flag for setting */
+ acf_dscam_setting_ptr /* pointer for setting */
};
/* Curve Expander ------------------------------------------- */
@@ -1426,8 +1426,8 @@ static bAnimChannelType ACF_DSCAM=
// TODO: just get this from RNA?
static int acf_dscur_icon(bAnimListElem *ale)
{
- Curve *cu= (Curve *)ale->data;
- short obtype= BKE_curve_type_get(cu);
+ Curve *cu = (Curve *)ale->data;
+ short obtype = BKE_curve_type_get(cu);
switch (obtype) {
case OB_FONT:
@@ -1443,7 +1443,7 @@ static int acf_dscur_icon(bAnimListElem *ale)
static int acf_dscur_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg)
{
/* clear extra return data first */
- *neg= 0;
+ *neg = 0;
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
@@ -1453,7 +1453,7 @@ static int acf_dscur_setting_flag(bAnimContext *UNUSED(ac), int setting, short *
return ADT_NLA_EVAL_OFF;
case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
- *neg= 1;
+ *neg = 1;
return ADT_CURVES_NOT_VISIBLE;
case ACHANNEL_SETTING_SELECT: /* selected */
@@ -1467,10 +1467,10 @@ static int acf_dscur_setting_flag(bAnimContext *UNUSED(ac), int setting, short *
/* get pointer to the setting */
static void *acf_dscur_setting_ptr(bAnimListElem *ale, int setting, short *type)
{
- Curve *cu= (Curve *)ale->data;
+ Curve *cu = (Curve *)ale->data;
/* clear extra return data first */
- *type= 0;
+ *type = 0;
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
@@ -1490,22 +1490,22 @@ static void *acf_dscur_setting_ptr(bAnimListElem *ale, int setting, short *type)
}
/* curve expander type define */
-static bAnimChannelType ACF_DSCUR=
+static bAnimChannelType ACF_DSCUR =
{
- "Curve Expander", /* type name */
+ "Curve Expander", /* type name */
- acf_generic_dataexpand_color, /* backdrop color */
- acf_generic_dataexpand_backdrop,/* backdrop */
- acf_generic_indention_1, /* indent level */
- acf_generic_basic_offset, /* offset */
-
- acf_generic_idblock_name, /* name */
- acf_generic_idblock_nameprop, /* name prop */
- acf_dscur_icon, /* icon */
-
- acf_generic_dataexpand_setting_valid, /* has setting */
- acf_dscur_setting_flag, /* flag for setting */
- acf_dscur_setting_ptr /* pointer for setting */
+ acf_generic_dataexpand_color, /* backdrop color */
+ acf_generic_dataexpand_backdrop, /* backdrop */
+ acf_generic_indention_1, /* indent level */
+ acf_generic_basic_offset, /* offset */
+
+ acf_generic_idblock_name, /* name */
+ acf_generic_idblock_nameprop, /* name prop */
+ acf_dscur_icon, /* icon */
+
+ acf_generic_dataexpand_setting_valid, /* has setting */
+ acf_dscur_setting_flag, /* flag for setting */
+ acf_dscur_setting_ptr /* pointer for setting */
};
/* Shape Key Expander ------------------------------------------- */
@@ -1520,7 +1520,7 @@ static int acf_dsskey_icon(bAnimListElem *UNUSED(ale))
static int acf_dsskey_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg)
{
/* clear extra return data first */
- *neg= 0;
+ *neg = 0;
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
@@ -1530,7 +1530,7 @@ static int acf_dsskey_setting_flag(bAnimContext *UNUSED(ac), int setting, short
return ADT_NLA_EVAL_OFF;
case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
- *neg= 1;
+ *neg = 1;
return ADT_CURVES_NOT_VISIBLE;
case ACHANNEL_SETTING_SELECT: /* selected */
@@ -1544,10 +1544,10 @@ static int acf_dsskey_setting_flag(bAnimContext *UNUSED(ac), int setting, short
/* get pointer to the setting */
static void *acf_dsskey_setting_ptr(bAnimListElem *ale, int setting, short *type)
{
- Key *key= (Key *)ale->data;
+ Key *key = (Key *)ale->data;
/* clear extra return data first */
- *type= 0;
+ *type = 0;
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
@@ -1567,22 +1567,22 @@ static void *acf_dsskey_setting_ptr(bAnimListElem *ale, int setting, short *type
}
/* shapekey expander type define */
-static bAnimChannelType ACF_DSSKEY=
+static bAnimChannelType ACF_DSSKEY =
{
- "Shape Key Expander", /* type name */
+ "Shape Key Expander", /* type name */
- acf_generic_dataexpand_color, /* backdrop color */
- acf_generic_dataexpand_backdrop,/* backdrop */
- acf_generic_indention_1, /* indent level */
- acf_generic_basic_offset, /* offset */
-
- acf_generic_idblock_name, /* name */
- acf_generic_idblock_nameprop, /* name prop */
- acf_dsskey_icon, /* icon */
-
- acf_generic_dataexpand_setting_valid, /* has setting */
- acf_dsskey_setting_flag, /* flag for setting */
- acf_dsskey_setting_ptr /* pointer for setting */
+ acf_generic_dataexpand_color, /* backdrop color */
+ acf_generic_dataexpand_backdrop, /* backdrop */
+ acf_generic_indention_1, /* indent level */
+ acf_generic_basic_offset, /* offset */
+
+ acf_generic_idblock_name, /* name */
+ acf_generic_idblock_nameprop, /* name prop */
+ acf_dsskey_icon, /* icon */
+
+ acf_generic_dataexpand_setting_valid, /* has setting */
+ acf_dsskey_setting_flag, /* flag for setting */
+ acf_dsskey_setting_ptr /* pointer for setting */
};
/* World Expander ------------------------------------------- */
@@ -1597,7 +1597,7 @@ static int acf_dswor_icon(bAnimListElem *UNUSED(ale))
static int acf_dswor_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg)
{
/* clear extra return data first */
- *neg= 0;
+ *neg = 0;
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
@@ -1607,7 +1607,7 @@ static int acf_dswor_setting_flag(bAnimContext *UNUSED(ac), int setting, short *
return ADT_NLA_EVAL_OFF;
case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
- *neg= 1;
+ *neg = 1;
return ADT_CURVES_NOT_VISIBLE;
case ACHANNEL_SETTING_SELECT: /* selected */
@@ -1621,10 +1621,10 @@ static int acf_dswor_setting_flag(bAnimContext *UNUSED(ac), int setting, short *
/* get pointer to the setting */
static void *acf_dswor_setting_ptr(bAnimListElem *ale, int setting, short *type)
{
- World *wo= (World *)ale->data;
+ World *wo = (World *)ale->data;
/* clear extra return data first */
- *type= 0;
+ *type = 0;
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
@@ -1644,22 +1644,22 @@ static void *acf_dswor_setting_ptr(bAnimListElem *ale, int setting, short *type)
}
/* world expander type define */
-static bAnimChannelType ACF_DSWOR=
+static bAnimChannelType ACF_DSWOR =
{
- "World Expander", /* type name */
+ "World Expander", /* type name */
- acf_generic_dataexpand_color, /* backdrop color */
- acf_generic_dataexpand_backdrop,/* backdrop */
- acf_generic_indention_1, /* indent level */
- acf_generic_basic_offset, /* offset */
-
- acf_generic_idblock_name, /* name */
- acf_generic_idfill_nameprop, /* name prop */
- acf_dswor_icon, /* icon */
-
- acf_generic_dataexpand_setting_valid, /* has setting */
- acf_dswor_setting_flag, /* flag for setting */
- acf_dswor_setting_ptr /* pointer for setting */
+ acf_generic_dataexpand_color, /* backdrop color */
+ acf_generic_dataexpand_backdrop, /* backdrop */
+ acf_generic_indention_1, /* indent level */
+ acf_generic_basic_offset, /* offset */
+
+ acf_generic_idblock_name, /* name */
+ acf_generic_idfill_nameprop, /* name prop */
+ acf_dswor_icon, /* icon */
+
+ acf_generic_dataexpand_setting_valid, /* has setting */
+ acf_dswor_setting_flag, /* flag for setting */
+ acf_dswor_setting_ptr /* pointer for setting */
};
/* Particle Expander ------------------------------------------- */
@@ -1674,7 +1674,7 @@ static int acf_dspart_icon(bAnimListElem *UNUSED(ale))
static int acf_dspart_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg)
{
/* clear extra return data first */
- *neg= 0;
+ *neg = 0;
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
@@ -1684,7 +1684,7 @@ static int acf_dspart_setting_flag(bAnimContext *UNUSED(ac), int setting, short
return ADT_NLA_EVAL_OFF;
case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
- *neg= 1;
+ *neg = 1;
return ADT_CURVES_NOT_VISIBLE;
case ACHANNEL_SETTING_SELECT: /* selected */
@@ -1698,10 +1698,10 @@ static int acf_dspart_setting_flag(bAnimContext *UNUSED(ac), int setting, short
/* get pointer to the setting */
static void *acf_dspart_setting_ptr(bAnimListElem *ale, int setting, short *type)
{
- ParticleSettings *part= (ParticleSettings *)ale->data;
+ ParticleSettings *part = (ParticleSettings *)ale->data;
/* clear extra return data first */
- *type= 0;
+ *type = 0;
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
@@ -1721,22 +1721,22 @@ static void *acf_dspart_setting_ptr(bAnimListElem *ale, int setting, short *type
}
/* particle expander type define */
-static bAnimChannelType ACF_DSPART=
+static bAnimChannelType ACF_DSPART =
{
- "Particle Data Expander", /* type name */
+ "Particle Data Expander", /* type name */
- acf_generic_dataexpand_color, /* backdrop color */
- acf_generic_dataexpand_backdrop,/* backdrop */
- acf_generic_indention_1, /* indent level */
- acf_generic_basic_offset, /* offset */
-
- acf_generic_idblock_name, /* name */
- acf_generic_idblock_nameprop, /* name prop */
- acf_dspart_icon, /* icon */
-
- acf_generic_dataexpand_setting_valid, /* has setting */
- acf_dspart_setting_flag, /* flag for setting */
- acf_dspart_setting_ptr /* pointer for setting */
+ acf_generic_dataexpand_color, /* backdrop color */
+ acf_generic_dataexpand_backdrop, /* backdrop */
+ acf_generic_indention_1, /* indent level */
+ acf_generic_basic_offset, /* offset */
+
+ acf_generic_idblock_name, /* name */
+ acf_generic_idblock_nameprop, /* name prop */
+ acf_dspart_icon, /* icon */
+
+ acf_generic_dataexpand_setting_valid, /* has setting */
+ acf_dspart_setting_flag, /* flag for setting */
+ acf_dspart_setting_ptr /* pointer for setting */
};
/* MetaBall Expander ------------------------------------------- */
@@ -1751,7 +1751,7 @@ static int acf_dsmball_icon(bAnimListElem *UNUSED(ale))
static int acf_dsmball_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg)
{
/* clear extra return data first */
- *neg= 0;
+ *neg = 0;
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
@@ -1761,7 +1761,7 @@ static int acf_dsmball_setting_flag(bAnimContext *UNUSED(ac), int setting, short
return ADT_NLA_EVAL_OFF;
case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
- *neg= 1;
+ *neg = 1;
return ADT_CURVES_NOT_VISIBLE;
case ACHANNEL_SETTING_SELECT: /* selected */
@@ -1775,10 +1775,10 @@ static int acf_dsmball_setting_flag(bAnimContext *UNUSED(ac), int setting, short
/* get pointer to the setting */
static void *acf_dsmball_setting_ptr(bAnimListElem *ale, int setting, short *type)
{
- MetaBall *mb= (MetaBall *)ale->data;
+ MetaBall *mb = (MetaBall *)ale->data;
/* clear extra return data first */
- *type= 0;
+ *type = 0;
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
@@ -1798,22 +1798,22 @@ static void *acf_dsmball_setting_ptr(bAnimListElem *ale, int setting, short *typ
}
/* metaball expander type define */
-static bAnimChannelType ACF_DSMBALL=
+static bAnimChannelType ACF_DSMBALL =
{
- "Metaball Expander", /* type name */
+ "Metaball Expander", /* type name */
- acf_generic_dataexpand_color, /* backdrop color */
- acf_generic_dataexpand_backdrop,/* backdrop */
- acf_generic_indention_1, /* indent level */
- acf_generic_basic_offset, /* offset */
-
- acf_generic_idblock_name, /* name */
- acf_generic_idblock_nameprop, /* name prop */
- acf_dsmball_icon, /* icon */
-
- acf_generic_dataexpand_setting_valid, /* has setting */
- acf_dsmball_setting_flag, /* flag for setting */
- acf_dsmball_setting_ptr /* pointer for setting */
+ acf_generic_dataexpand_color, /* backdrop color */
+ acf_generic_dataexpand_backdrop, /* backdrop */
+ acf_generic_indention_1, /* indent level */
+ acf_generic_basic_offset, /* offset */
+
+ acf_generic_idblock_name, /* name */
+ acf_generic_idblock_nameprop, /* name prop */
+ acf_dsmball_icon, /* icon */
+
+ acf_generic_dataexpand_setting_valid, /* has setting */
+ acf_dsmball_setting_flag, /* flag for setting */
+ acf_dsmball_setting_ptr /* pointer for setting */
};
/* Armature Expander ------------------------------------------- */
@@ -1828,7 +1828,7 @@ static int acf_dsarm_icon(bAnimListElem *UNUSED(ale))
static int acf_dsarm_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg)
{
/* clear extra return data first */
- *neg= 0;
+ *neg = 0;
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
@@ -1838,7 +1838,7 @@ static int acf_dsarm_setting_flag(bAnimContext *UNUSED(ac), int setting, short *
return ADT_NLA_EVAL_OFF;
case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
- *neg= 1;
+ *neg = 1;
return ADT_CURVES_NOT_VISIBLE;
case ACHANNEL_SETTING_SELECT: /* selected */
@@ -1852,10 +1852,10 @@ static int acf_dsarm_setting_flag(bAnimContext *UNUSED(ac), int setting, short *
/* get pointer to the setting */
static void *acf_dsarm_setting_ptr(bAnimListElem *ale, int setting, short *type)
{
- bArmature *arm= (bArmature *)ale->data;
+ bArmature *arm = (bArmature *)ale->data;
/* clear extra return data first */
- *type= 0;
+ *type = 0;
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
@@ -1875,22 +1875,22 @@ static void *acf_dsarm_setting_ptr(bAnimListElem *ale, int setting, short *type)
}
/* metaball expander type define */
-static bAnimChannelType ACF_DSARM=
+static bAnimChannelType ACF_DSARM =
{
- "Armature Expander", /* type name */
-
- acf_generic_dataexpand_color, /* backdrop color */
- acf_generic_dataexpand_backdrop,/* backdrop */
- acf_generic_indention_1, /* indent level */
- acf_generic_basic_offset, /* offset */
+ "Armature Expander", /* type name */
- acf_generic_idblock_name, /* name */
- acf_generic_idblock_nameprop, /* name prop */
- acf_dsarm_icon, /* icon */
-
- acf_generic_dataexpand_setting_valid, /* has setting */
- acf_dsarm_setting_flag, /* flag for setting */
- acf_dsarm_setting_ptr /* pointer for setting */
+ acf_generic_dataexpand_color, /* backdrop color */
+ acf_generic_dataexpand_backdrop, /* backdrop */
+ acf_generic_indention_1, /* indent level */
+ acf_generic_basic_offset, /* offset */
+
+ acf_generic_idblock_name, /* name */
+ acf_generic_idblock_nameprop, /* name prop */
+ acf_dsarm_icon, /* icon */
+
+ acf_generic_dataexpand_setting_valid, /* has setting */
+ acf_dsarm_setting_flag, /* flag for setting */
+ acf_dsarm_setting_ptr /* pointer for setting */
};
/* NodeTree Expander ------------------------------------------- */
@@ -1905,7 +1905,7 @@ static int acf_dsntree_icon(bAnimListElem *UNUSED(ale))
static short acf_dsntree_offset(bAnimContext *ac, bAnimListElem *ale)
{
bNodeTree *ntree = (bNodeTree *)ale->data;
- short offset= acf_generic_basic_offset(ac, ale);
+ short offset = acf_generic_basic_offset(ac, ale);
offset += acf_nodetree_rootType_offset(ntree);
@@ -1916,7 +1916,7 @@ static short acf_dsntree_offset(bAnimContext *ac, bAnimListElem *ale)
static int acf_dsntree_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg)
{
/* clear extra return data first */
- *neg= 0;
+ *neg = 0;
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
@@ -1926,7 +1926,7 @@ static int acf_dsntree_setting_flag(bAnimContext *UNUSED(ac), int setting, short
return ADT_NLA_EVAL_OFF;
case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
- *neg= 1;
+ *neg = 1;
return ADT_CURVES_NOT_VISIBLE;
case ACHANNEL_SETTING_SELECT: /* selected */
@@ -1940,10 +1940,10 @@ static int acf_dsntree_setting_flag(bAnimContext *UNUSED(ac), int setting, short
/* get pointer to the setting */
static void *acf_dsntree_setting_ptr(bAnimListElem *ale, int setting, short *type)
{
- bNodeTree *ntree= (bNodeTree *)ale->data;
+ bNodeTree *ntree = (bNodeTree *)ale->data;
/* clear extra return data first */
- *type= 0;
+ *type = 0;
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
@@ -1954,8 +1954,8 @@ static void *acf_dsntree_setting_ptr(bAnimListElem *ale, int setting, short *typ
case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
if (ntree->adt)
return GET_ACF_FLAG_PTR(ntree->adt->flag, type);
- else
- return NULL;
+ else
+ return NULL;
default: /* unsupported */
return NULL;
@@ -1963,22 +1963,22 @@ static void *acf_dsntree_setting_ptr(bAnimListElem *ale, int setting, short *typ
}
/* node tree expander type define */
-static bAnimChannelType ACF_DSNTREE=
+static bAnimChannelType ACF_DSNTREE =
{
- "Node Tree Expander", /* type name */
+ "Node Tree Expander", /* type name */
- acf_generic_dataexpand_color, /* backdrop color */
- acf_generic_dataexpand_backdrop,/* backdrop */
- acf_generic_indention_1, /* indent level */
- acf_dsntree_offset, /* offset */
-
- acf_generic_idblock_name, /* name */
- acf_generic_idblock_nameprop, /* name prop */
- acf_dsntree_icon, /* icon */
-
- acf_generic_dataexpand_setting_valid, /* has setting */
- acf_dsntree_setting_flag, /* flag for setting */
- acf_dsntree_setting_ptr /* pointer for setting */
+ acf_generic_dataexpand_color, /* backdrop color */
+ acf_generic_dataexpand_backdrop, /* backdrop */
+ acf_generic_indention_1, /* indent level */
+ acf_dsntree_offset, /* offset */
+
+ acf_generic_idblock_name, /* name */
+ acf_generic_idblock_nameprop, /* name prop */
+ acf_dsntree_icon, /* icon */
+
+ acf_generic_dataexpand_setting_valid, /* has setting */
+ acf_dsntree_setting_flag, /* flag for setting */
+ acf_dsntree_setting_ptr /* pointer for setting */
};
/* Mesh Expander ------------------------------------------- */
@@ -1993,7 +1993,7 @@ static int acf_dsmesh_icon(bAnimListElem *UNUSED(ale))
static int acf_dsmesh_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg)
{
/* clear extra return data first */
- *neg= 0;
+ *neg = 0;
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
@@ -2003,7 +2003,7 @@ static int acf_dsmesh_setting_flag(bAnimContext *UNUSED(ac), int setting, short
return ADT_NLA_EVAL_OFF;
case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
- *neg= 1;
+ *neg = 1;
return ADT_CURVES_NOT_VISIBLE;
case ACHANNEL_SETTING_SELECT: /* selected */
@@ -2017,10 +2017,10 @@ static int acf_dsmesh_setting_flag(bAnimContext *UNUSED(ac), int setting, short
/* get pointer to the setting */
static void *acf_dsmesh_setting_ptr(bAnimListElem *ale, int setting, short *type)
{
- Mesh *me= (Mesh *)ale->data;
+ Mesh *me = (Mesh *)ale->data;
/* clear extra return data first */
- *type= 0;
+ *type = 0;
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
@@ -2031,8 +2031,8 @@ static void *acf_dsmesh_setting_ptr(bAnimListElem *ale, int setting, short *type
case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
if (me->adt)
return GET_ACF_FLAG_PTR(me->adt->flag, type);
- else
- return NULL;
+ else
+ return NULL;
default: /* unsupported */
return NULL;
@@ -2040,22 +2040,22 @@ static void *acf_dsmesh_setting_ptr(bAnimListElem *ale, int setting, short *type
}
/* node tree expander type define */
-static bAnimChannelType ACF_DSMESH=
+static bAnimChannelType ACF_DSMESH =
{
- "Mesh Expander", /* type name */
-
- acf_generic_dataexpand_color, /* backdrop color */
- acf_generic_dataexpand_backdrop,/* backdrop */
- acf_generic_indention_1, /* indent level */ // XXX this only works for compositing
- acf_generic_basic_offset, /* offset */
-
- acf_generic_idblock_name, /* name */
- acf_generic_idblock_nameprop, /* name prop */
- acf_dsmesh_icon, /* icon */
+ "Mesh Expander", /* type name */
- acf_generic_dataexpand_setting_valid, /* has setting */
- acf_dsmesh_setting_flag, /* flag for setting */
- acf_dsmesh_setting_ptr /* pointer for setting */
+ acf_generic_dataexpand_color, /* backdrop color */
+ acf_generic_dataexpand_backdrop, /* backdrop */
+ acf_generic_indention_1, /* indent level */ // XXX this only works for compositing
+ acf_generic_basic_offset, /* offset */
+
+ acf_generic_idblock_name, /* name */
+ acf_generic_idblock_nameprop, /* name prop */
+ acf_dsmesh_icon, /* icon */
+
+ acf_generic_dataexpand_setting_valid, /* has setting */
+ acf_dsmesh_setting_flag, /* flag for setting */
+ acf_dsmesh_setting_ptr /* pointer for setting */
};
/* Lattice Expander ------------------------------------------- */
@@ -2070,7 +2070,7 @@ static int acf_dslat_icon(bAnimListElem *UNUSED(ale))
static int acf_dslat_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg)
{
/* clear extra return data first */
- *neg= 0;
+ *neg = 0;
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
@@ -2080,7 +2080,7 @@ static int acf_dslat_setting_flag(bAnimContext *UNUSED(ac), int setting, short *
return ADT_NLA_EVAL_OFF;
case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
- *neg= 1;
+ *neg = 1;
return ADT_CURVES_NOT_VISIBLE;
case ACHANNEL_SETTING_SELECT: /* selected */
@@ -2094,10 +2094,10 @@ static int acf_dslat_setting_flag(bAnimContext *UNUSED(ac), int setting, short *
/* get pointer to the setting */
static void *acf_dslat_setting_ptr(bAnimListElem *ale, int setting, short *type)
{
- Lattice *lt= (Lattice *)ale->data;
+ Lattice *lt = (Lattice *)ale->data;
/* clear extra return data first */
- *type= 0;
+ *type = 0;
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
@@ -2108,8 +2108,8 @@ static void *acf_dslat_setting_ptr(bAnimListElem *ale, int setting, short *type)
case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
if (lt->adt)
return GET_ACF_FLAG_PTR(lt->adt->flag, type);
- else
- return NULL;
+ else
+ return NULL;
default: /* unsupported */
return NULL;
@@ -2117,22 +2117,22 @@ static void *acf_dslat_setting_ptr(bAnimListElem *ale, int setting, short *type)
}
/* node tree expander type define */
-static bAnimChannelType ACF_DSLAT=
+static bAnimChannelType ACF_DSLAT =
{
- "Lattice Expander", /* type name */
+ "Lattice Expander", /* type name */
- acf_generic_dataexpand_color, /* backdrop color */
- acf_generic_dataexpand_backdrop,/* backdrop */
- acf_generic_indention_1, /* indent level */ // XXX this only works for compositing
- acf_generic_basic_offset, /* offset */
-
- acf_generic_idblock_name, /* name */
- acf_generic_idblock_nameprop, /* name prop */
- acf_dslat_icon, /* icon */
-
- acf_generic_dataexpand_setting_valid, /* has setting */
- acf_dslat_setting_flag, /* flag for setting */
- acf_dslat_setting_ptr /* pointer for setting */
+ acf_generic_dataexpand_color, /* backdrop color */
+ acf_generic_dataexpand_backdrop, /* backdrop */
+ acf_generic_indention_1, /* indent level */ // XXX this only works for compositing
+ acf_generic_basic_offset, /* offset */
+
+ acf_generic_idblock_name, /* name */
+ acf_generic_idblock_nameprop, /* name prop */
+ acf_dslat_icon, /* icon */
+
+ acf_generic_dataexpand_setting_valid, /* has setting */
+ acf_dslat_setting_flag, /* flag for setting */
+ acf_dslat_setting_ptr /* pointer for setting */
};
/* Speaker Expander ------------------------------------------- */
@@ -2147,7 +2147,7 @@ static int acf_dsspk_icon(bAnimListElem *UNUSED(ale))
static int acf_dsspk_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg)
{
/* clear extra return data first */
- *neg= 0;
+ *neg = 0;
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
@@ -2157,7 +2157,7 @@ static int acf_dsspk_setting_flag(bAnimContext *UNUSED(ac), int setting, short *
return ADT_NLA_EVAL_OFF;
case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
- *neg= 1;
+ *neg = 1;
return ADT_CURVES_NOT_VISIBLE;
case ACHANNEL_SETTING_SELECT: /* selected */
@@ -2171,10 +2171,10 @@ static int acf_dsspk_setting_flag(bAnimContext *UNUSED(ac), int setting, short *
/* get pointer to the setting */
static void *acf_dsspk_setting_ptr(bAnimListElem *ale, int setting, short *type)
{
- Speaker *spk= (Speaker *)ale->data;
+ Speaker *spk = (Speaker *)ale->data;
/* clear extra return data first */
- *type= 0;
+ *type = 0;
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
@@ -2194,22 +2194,22 @@ static void *acf_dsspk_setting_ptr(bAnimListElem *ale, int setting, short *type)
}
/* speaker expander type define */
-static bAnimChannelType ACF_DSSPK=
+static bAnimChannelType ACF_DSSPK =
{
- "Speaker Expander", /* type name */
+ "Speaker Expander", /* type name */
- acf_generic_dataexpand_color, /* backdrop color */
- acf_generic_dataexpand_backdrop,/* backdrop */
- acf_generic_indention_1, /* indent level */
- acf_generic_basic_offset, /* offset */
-
- acf_generic_idblock_name, /* name */
- acf_generic_idblock_nameprop, /* name prop */
- acf_dsspk_icon, /* icon */
-
- acf_generic_dataexpand_setting_valid, /* has setting */
- acf_dsspk_setting_flag, /* flag for setting */
- acf_dsspk_setting_ptr /* pointer for setting */
+ acf_generic_dataexpand_color, /* backdrop color */
+ acf_generic_dataexpand_backdrop, /* backdrop */
+ acf_generic_indention_1, /* indent level */
+ acf_generic_basic_offset, /* offset */
+
+ acf_generic_idblock_name, /* name */
+ acf_generic_idblock_nameprop, /* name prop */
+ acf_dsspk_icon, /* icon */
+
+ acf_generic_dataexpand_setting_valid, /* has setting */
+ acf_dsspk_setting_flag, /* flag for setting */
+ acf_dsspk_setting_ptr /* pointer for setting */
};
/* ShapeKey Entry ------------------------------------------- */
@@ -2217,7 +2217,7 @@ static bAnimChannelType ACF_DSSPK=
/* name for ShapeKey */
static void acf_shapekey_name(bAnimListElem *ale, char *name)
{
- KeyBlock *kb= (KeyBlock *)ale->data;
+ KeyBlock *kb = (KeyBlock *)ale->data;
/* just copy the name... */
if (kb && name) {
@@ -2232,7 +2232,7 @@ static void acf_shapekey_name(bAnimListElem *ale, char *name)
/* name property for ShapeKey entries */
static short acf_shapekey_nameprop(bAnimListElem *ale, PointerRNA *ptr, PropertyRNA **prop)
{
- KeyBlock *kb= (KeyBlock *)ale->data;
+ KeyBlock *kb = (KeyBlock *)ale->data;
/* if the KeyBlock had a name, use it, otherwise use the index */
if (kb && kb->name[0]) {
@@ -2264,7 +2264,7 @@ static short acf_shapekey_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem
static int acf_shapekey_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg)
{
/* clear extra return data first */
- *neg= 0;
+ *neg = 0;
switch (setting) {
case ACHANNEL_SETTING_MUTE: /* mute */
@@ -2284,10 +2284,10 @@ static int acf_shapekey_setting_flag(bAnimContext *UNUSED(ac), int setting, shor
/* get pointer to the setting */
static void *acf_shapekey_setting_ptr(bAnimListElem *ale, int setting, short *type)
{
- KeyBlock *kb= (KeyBlock *)ale->data;
+ KeyBlock *kb = (KeyBlock *)ale->data;
/* clear extra return data first */
- *type= 0;
+ *type = 0;
switch (setting) {
case ACHANNEL_SETTING_SELECT: /* selected */
@@ -2301,22 +2301,22 @@ static void *acf_shapekey_setting_ptr(bAnimListElem *ale, int setting, short *ty
}
/* shapekey expander type define */
-static bAnimChannelType ACF_SHAPEKEY=
+static bAnimChannelType ACF_SHAPEKEY =
{
- "Shape Key", /* type name */
+ "Shape Key", /* type name */
- acf_generic_channel_color, /* backdrop color */
- acf_generic_channel_backdrop, /* backdrop */
- acf_generic_indention_0, /* indent level */
- acf_generic_basic_offset, /* offset */
-
- acf_shapekey_name, /* name */
- acf_shapekey_nameprop, /* name prop */
- NULL, /* icon */
-
- acf_shapekey_setting_valid, /* has setting */
- acf_shapekey_setting_flag, /* flag for setting */
- acf_shapekey_setting_ptr /* pointer for setting */
+ acf_generic_channel_color, /* backdrop color */
+ acf_generic_channel_backdrop, /* backdrop */
+ acf_generic_indention_0, /* indent level */
+ acf_generic_basic_offset, /* offset */
+
+ acf_shapekey_name, /* name */
+ acf_shapekey_nameprop, /* name prop */
+ NULL, /* icon */
+
+ acf_shapekey_setting_valid, /* has setting */
+ acf_shapekey_setting_flag, /* flag for setting */
+ acf_shapekey_setting_ptr /* pointer for setting */
};
/* GPencil Datablock ------------------------------------------- */
@@ -2352,7 +2352,7 @@ static short acf_gpd_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUS
static int acf_gpd_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg)
{
/* clear extra return data first */
- *neg= 0;
+ *neg = 0;
switch (setting) {
case ACHANNEL_SETTING_SELECT: /* selected */
@@ -2369,7 +2369,7 @@ static int acf_gpd_setting_flag(bAnimContext *UNUSED(ac), int setting, short *ne
/* get pointer to the setting */
static void *acf_gpd_setting_ptr(bAnimListElem *ale, int UNUSED(setting), short *type)
{
- bGPdata *gpd= (bGPdata *)ale->data;
+ bGPdata *gpd = (bGPdata *)ale->data;
/* all flags are just in gpd->flag for now... */
return GET_ACF_FLAG_PTR(gpd->flag, type);
@@ -2378,20 +2378,20 @@ static void *acf_gpd_setting_ptr(bAnimListElem *ale, int UNUSED(setting), short
/* gpencil datablock type define */
static bAnimChannelType ACF_GPD =
{
- "GPencil Datablock", /* type name */
-
- acf_gpd_color, /* backdrop color */
- acf_group_backdrop, /* backdrop */
- acf_generic_indention_0, /* indent level */
- acf_generic_group_offset, /* offset */
+ "GPencil Datablock", /* type name */
- acf_generic_idblock_name, /* name */
- acf_generic_idfill_nameprop, /* name prop */
- acf_gpd_icon, /* icon */
-
- acf_gpd_setting_valid, /* has setting */
- acf_gpd_setting_flag, /* flag for setting */
- acf_gpd_setting_ptr /* pointer for setting */
+ acf_gpd_color, /* backdrop color */
+ acf_group_backdrop, /* backdrop */
+ acf_generic_indention_0, /* indent level */
+ acf_generic_group_offset, /* offset */
+
+ acf_generic_idblock_name, /* name */
+ acf_generic_idfill_nameprop, /* name prop */
+ acf_gpd_icon, /* icon */
+
+ acf_gpd_setting_valid, /* has setting */
+ acf_gpd_setting_flag, /* flag for setting */
+ acf_gpd_setting_ptr /* pointer for setting */
};
/* GPencil Layer ------------------------------------------- */
@@ -2437,7 +2437,7 @@ static short acf_gpl_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUS
static int acf_gpl_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg)
{
/* clear extra return data first */
- *neg= 0;
+ *neg = 0;
switch (setting) {
case ACHANNEL_SETTING_SELECT: /* selected */
@@ -2458,7 +2458,7 @@ static int acf_gpl_setting_flag(bAnimContext *UNUSED(ac), int setting, short *ne
/* get pointer to the setting */
static void *acf_gpl_setting_ptr(bAnimListElem *ale, int UNUSED(setting), short *type)
{
- bGPDlayer *gpl= (bGPDlayer *)ale->data;
+ bGPDlayer *gpl = (bGPDlayer *)ale->data;
/* all flags are just in agrp->flag for now... */
return GET_ACF_FLAG_PTR(gpl->flag, type);
@@ -2467,20 +2467,20 @@ static void *acf_gpl_setting_ptr(bAnimListElem *ale, int UNUSED(setting), short
/* grease pencil layer type define */
static bAnimChannelType ACF_GPL =
{
- "GPencil Layer", /* type name */
-
- acf_generic_channel_color, /* backdrop color */
- acf_generic_channel_backdrop, /* backdrop */
- acf_generic_indention_flexible, /* indent level */
- acf_generic_group_offset, /* offset */
-
- acf_gpl_name, /* name */
- acf_gpl_name_prop, /* name prop */
- NULL, /* icon */
+ "GPencil Layer", /* type name */
- acf_gpl_setting_valid, /* has setting */
- acf_gpl_setting_flag, /* flag for setting */
- acf_gpl_setting_ptr /* pointer for setting */
+ acf_generic_channel_color, /* backdrop color */
+ acf_generic_channel_backdrop, /* backdrop */
+ acf_generic_indention_flexible, /* indent level */
+ acf_generic_group_offset, /* offset */
+
+ acf_gpl_name, /* name */
+ acf_gpl_name_prop, /* name prop */
+ NULL, /* icon */
+
+ acf_gpl_setting_valid, /* has setting */
+ acf_gpl_setting_flag, /* flag for setting */
+ acf_gpl_setting_ptr /* pointer for setting */
};
/* *********************************************** */
@@ -2488,60 +2488,60 @@ static bAnimChannelType ACF_GPL =
/* These globals only ever get directly accessed in this file */
static bAnimChannelType *animchannelTypeInfo[ANIMTYPE_NUM_TYPES];
-static short ACF_INIT= 1; /* when non-zero, the list needs to be updated */
+static short ACF_INIT = 1; /* when non-zero, the list needs to be updated */
/* Initialize type info definitions */
-static void ANIM_init_channel_typeinfo_data (void)
+static void ANIM_init_channel_typeinfo_data(void)
{
- int type= 0;
+ int type = 0;
/* start initializing if necessary... */
if (ACF_INIT) {
- ACF_INIT= 0;
-
- animchannelTypeInfo[type++]= NULL; /* None */
- animchannelTypeInfo[type++]= NULL; /* AnimData */
- animchannelTypeInfo[type++]= NULL; /* Special */
-
- animchannelTypeInfo[type++]= &ACF_SUMMARY; /* Motion Summary */
-
- animchannelTypeInfo[type++]= &ACF_SCENE; /* Scene */
- animchannelTypeInfo[type++]= &ACF_OBJECT; /* Object */
- animchannelTypeInfo[type++]= &ACF_GROUP; /* Group */
- animchannelTypeInfo[type++]= &ACF_FCURVE; /* F-Curve */
-
- animchannelTypeInfo[type++]= &ACF_FILLACTD; /* Object Action Expander */
- animchannelTypeInfo[type++]= &ACF_FILLDRIVERS; /* Drivers Expander */
-
- animchannelTypeInfo[type++]= &ACF_DSMAT; /* Material Channel */
- animchannelTypeInfo[type++]= &ACF_DSLAM; /* Lamp Channel */
- animchannelTypeInfo[type++]= &ACF_DSCAM; /* Camera Channel */
- animchannelTypeInfo[type++]= &ACF_DSCUR; /* Curve Channel */
- animchannelTypeInfo[type++]= &ACF_DSSKEY; /* ShapeKey Channel */
- animchannelTypeInfo[type++]= &ACF_DSWOR; /* World Channel */
- animchannelTypeInfo[type++]= &ACF_DSNTREE; /* NodeTree Channel */
- animchannelTypeInfo[type++]= &ACF_DSPART; /* Particle Channel */
- animchannelTypeInfo[type++]= &ACF_DSMBALL; /* MetaBall Channel */
- animchannelTypeInfo[type++]= &ACF_DSARM; /* Armature Channel */
- animchannelTypeInfo[type++]= &ACF_DSMESH; /* Mesh Channel */
- animchannelTypeInfo[type++]= &ACF_DSTEX; /* Texture Channel */
- animchannelTypeInfo[type++]= &ACF_DSLAT; /* Lattice Channel */
- animchannelTypeInfo[type++]= &ACF_DSSPK; /* Speaker Channel */
-
- animchannelTypeInfo[type++]= &ACF_SHAPEKEY; /* ShapeKey */
-
- animchannelTypeInfo[type++]= &ACF_GPD; /* Grease Pencil Datablock */
- animchannelTypeInfo[type++]= &ACF_GPL; /* Grease Pencil Layer */
-
- // TODO: these types still need to be implemented!!!
- // probably need a few extra flags for these special cases...
- animchannelTypeInfo[type++]= NULL; /* NLA Track */
- animchannelTypeInfo[type++]= NULL; /* NLA Action */
+ ACF_INIT = 0;
+
+ animchannelTypeInfo[type++] = NULL; /* None */
+ animchannelTypeInfo[type++] = NULL; /* AnimData */
+ animchannelTypeInfo[type++] = NULL; /* Special */
+
+ animchannelTypeInfo[type++] = &ACF_SUMMARY; /* Motion Summary */
+
+ animchannelTypeInfo[type++] = &ACF_SCENE; /* Scene */
+ animchannelTypeInfo[type++] = &ACF_OBJECT; /* Object */
+ animchannelTypeInfo[type++] = &ACF_GROUP; /* Group */
+ animchannelTypeInfo[type++] = &ACF_FCURVE; /* F-Curve */
+
+ animchannelTypeInfo[type++] = &ACF_FILLACTD; /* Object Action Expander */
+ animchannelTypeInfo[type++] = &ACF_FILLDRIVERS; /* Drivers Expander */
+
+ animchannelTypeInfo[type++] = &ACF_DSMAT; /* Material Channel */
+ animchannelTypeInfo[type++] = &ACF_DSLAM; /* Lamp Channel */
+ animchannelTypeInfo[type++] = &ACF_DSCAM; /* Camera Channel */
+ animchannelTypeInfo[type++] = &ACF_DSCUR; /* Curve Channel */
+ animchannelTypeInfo[type++] = &ACF_DSSKEY; /* ShapeKey Channel */
+ animchannelTypeInfo[type++] = &ACF_DSWOR; /* World Channel */
+ animchannelTypeInfo[type++] = &ACF_DSNTREE; /* NodeTree Channel */
+ animchannelTypeInfo[type++] = &ACF_DSPART; /* Particle Channel */
+ animchannelTypeInfo[type++] = &ACF_DSMBALL; /* MetaBall Channel */
+ animchannelTypeInfo[type++] = &ACF_DSARM; /* Armature Channel */
+ animchannelTypeInfo[type++] = &ACF_DSMESH; /* Mesh Channel */
+ animchannelTypeInfo[type++] = &ACF_DSTEX; /* Texture Channel */
+ animchannelTypeInfo[type++] = &ACF_DSLAT; /* Lattice Channel */
+ animchannelTypeInfo[type++] = &ACF_DSSPK; /* Speaker Channel */
+
+ animchannelTypeInfo[type++] = &ACF_SHAPEKEY; /* ShapeKey */
+
+ animchannelTypeInfo[type++] = &ACF_GPD; /* Grease Pencil Datablock */
+ animchannelTypeInfo[type++] = &ACF_GPL; /* Grease Pencil Layer */
+
+ // TODO: these types still need to be implemented!!!
+ // probably need a few extra flags for these special cases...
+ animchannelTypeInfo[type++] = NULL; /* NLA Track */
+ animchannelTypeInfo[type++] = NULL; /* NLA Action */
}
}
/* Get type info from given channel type */
-bAnimChannelType *ANIM_channel_get_typeinfo (bAnimListElem *ale)
+bAnimChannelType *ANIM_channel_get_typeinfo(bAnimListElem *ale)
{
/* santiy checks */
if (ale == NULL)
@@ -2562,7 +2562,7 @@ bAnimChannelType *ANIM_channel_get_typeinfo (bAnimListElem *ale)
/* Print debug info string for the given channel */
void ANIM_channel_debug_print_info(bAnimListElem *ale, short indent_level)
{
- bAnimChannelType *acf= ANIM_channel_get_typeinfo(ale);
+ bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
/* print indents */
for (; indent_level > 0; indent_level--)
@@ -2594,7 +2594,7 @@ void ANIM_channel_debug_print_info(bAnimListElem *ale, short indent_level)
*/
short ANIM_channel_setting_get(bAnimContext *ac, bAnimListElem *ale, int setting)
{
- bAnimChannelType *acf= ANIM_channel_get_typeinfo(ale);
+ bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
/* 1) check that the setting exists for the current context */
if ((acf) && (!acf->has_setting || acf->has_setting(ac, ale, setting))) {
@@ -2603,44 +2603,44 @@ short ANIM_channel_setting_get(bAnimContext *ac, bAnimListElem *ale, int setting
int flag;
void *ptr;
- flag= acf->setting_flag(ac, setting, &negflag);
- ptr= acf->setting_ptr(ale, setting, &ptrsize);
+ flag = acf->setting_flag(ac, setting, &negflag);
+ ptr = acf->setting_ptr(ale, setting, &ptrsize);
/* check if flag is enabled */
if (ptr && flag) {
switch (ptrsize) {
- case sizeof(int): /* integer pointer for setting */
+ case sizeof(int): /* integer pointer for setting */
{
- int *val= (int *)ptr;
+ int *val = (int *)ptr;
if (negflag)
return ((*val) & flag) == 0;
else
return ((*val) & flag) != 0;
}
- break;
+ break;
- case sizeof(short): /* short pointer for setting */
+ case sizeof(short): /* short pointer for setting */
{
- short *val= (short *)ptr;
+ short *val = (short *)ptr;
if (negflag)
return ((*val) & flag) == 0;
else
return ((*val) & flag) != 0;
}
- break;
+ break;
- case sizeof(char): /* char pointer for setting */
+ case sizeof(char): /* char pointer for setting */
{
- char *val= (char *)ptr;
+ char *val = (char *)ptr;
if (negflag)
return ((*val) & flag) == 0;
else
return ((*val) & flag) != 0;
}
- break;
+ break;
}
}
}
@@ -2652,17 +2652,17 @@ short ANIM_channel_setting_get(bAnimContext *ac, bAnimListElem *ale, int setting
/* quick macro for use in ANIM_channel_setting_set - set flag for setting according the mode given */
#define ACF_SETTING_SET(sval, sflag, smode) \
- {\
- if (negflag) {\
- if (smode == ACHANNEL_SETFLAG_INVERT) (sval) ^= (sflag); \
+ { \
+ if (negflag) { \
+ if (smode == ACHANNEL_SETFLAG_INVERT) (sval) ^= (sflag); \
else if (smode == ACHANNEL_SETFLAG_ADD) (sval) &= ~(sflag); \
- else (sval) |= (sflag); \
+ else (sval) |= (sflag); \
} \
- else {\
- if (smode == ACHANNEL_SETFLAG_INVERT) (sval) ^= (sflag); \
+ else { \
+ if (smode == ACHANNEL_SETFLAG_INVERT) (sval) ^= (sflag); \
else if (smode == ACHANNEL_SETFLAG_ADD) (sval) |= (sflag); \
- else (sval) &= ~(sflag); \
- }\
+ else (sval) &= ~(sflag); \
+ } \
}
/* Change value of some setting for a channel
@@ -2671,7 +2671,7 @@ short ANIM_channel_setting_get(bAnimContext *ac, bAnimListElem *ale, int setting
*/
void ANIM_channel_setting_set(bAnimContext *ac, bAnimListElem *ale, int setting, short mode)
{
- bAnimChannelType *acf= ANIM_channel_get_typeinfo(ale);
+ bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
/* 1) check that the setting exists for the current context */
if ((acf) && (!acf->has_setting || acf->has_setting(ac, ale, setting))) {
@@ -2680,32 +2680,32 @@ void ANIM_channel_setting_set(bAnimContext *ac, bAnimListElem *ale, int setting,
int flag;
void *ptr;
- flag= acf->setting_flag(ac, setting, &negflag);
- ptr= acf->setting_ptr(ale, setting, &ptrsize);
+ flag = acf->setting_flag(ac, setting, &negflag);
+ ptr = acf->setting_ptr(ale, setting, &ptrsize);
/* check if flag is enabled */
if (ptr && flag) {
switch (ptrsize) {
- case sizeof(int): /* integer pointer for setting */
+ case sizeof(int): /* integer pointer for setting */
{
- int *val= (int *)ptr;
+ int *val = (int *)ptr;
ACF_SETTING_SET(*val, flag, mode);
}
- break;
+ break;
- case sizeof(short): /* short pointer for setting */
+ case sizeof(short): /* short pointer for setting */
{
- short *val= (short *)ptr;
+ short *val = (short *)ptr;
ACF_SETTING_SET(*val, flag, mode);
}
- break;
+ break;
- case sizeof(char): /* char pointer for setting */
+ case sizeof(char): /* char pointer for setting */
{
- char *val= (char *)ptr;
+ char *val = (char *)ptr;
ACF_SETTING_SET(*val, flag, mode);
}
- break;
+ break;
}
}
}
@@ -2714,9 +2714,9 @@ void ANIM_channel_setting_set(bAnimContext *ac, bAnimListElem *ale, int setting,
/* --------------------------- */
// XXX hardcoded size of icons
-#define ICON_WIDTH 17
+#define ICON_WIDTH 17
// XXX hardcoded width of sliders
-#define SLIDER_WIDTH 80
+#define SLIDER_WIDTH 80
// XXX hardcoded width of rename textboxes
#define RENAME_TEXT_WIDTH 100
@@ -2724,8 +2724,8 @@ void ANIM_channel_setting_set(bAnimContext *ac, bAnimListElem *ale, int setting,
// TODO: make this use UI controls for the buttons
void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc)
{
- bAnimChannelType *acf= ANIM_channel_get_typeinfo(ale);
- View2D *v2d= &ac->ar->v2d;
+ bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
+ View2D *v2d = &ac->ar->v2d;
short selected, offset;
float y, ymid, ytext;
@@ -2735,23 +2735,23 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float
/* get initial offset */
if (acf->get_offset)
- offset= acf->get_offset(ac, ale);
+ offset = acf->get_offset(ac, ale);
else
- offset= 0;
+ offset = 0;
/* calculate appropriate y-coordinates for icon buttons
* 7 is hardcoded factor for half-height of icons
*/
- y= (ymaxc - yminc)/2 + yminc;
- ymid= y - 7;
+ y = (ymaxc - yminc) / 2 + yminc;
+ ymid = y - 7;
/* y-coordinates for text is only 4 down from middle */
- ytext= y - 4;
+ ytext = y - 4;
/* check if channel is selected */
if (acf->has_setting(ac, ale, ACHANNEL_SETTING_SELECT))
- selected= ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_SELECT);
+ selected = ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_SELECT);
else
- selected= 0;
+ selected = 0;
/* set blending again, as may not be set in previous step */
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@@ -2784,7 +2784,7 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float
if ((ac->spacetype == SPACE_IPO) && acf->has_setting(ac, ale, ACHANNEL_SETTING_VISIBLE)) {
/* for F-Curves, draw color-preview of curve behind checkbox */
if (ale->type == ANIMTYPE_FCURVE) {
- FCurve *fcu= (FCurve *)ale->data;
+ FCurve *fcu = (FCurve *)ale->data;
/* F-Curve channels need to have a special 'color code' box drawn, which is colored with whatever
* color the curve has stored
@@ -2792,10 +2792,10 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float
glColor3fv(fcu->color);
/* just a solid color rect
- * hardcoded 17 pixels width is slightly wider than icon width, so that
+ * hardcoded 17 pixels width is slightly wider than icon width, so that
* there's a slight border around it
*/
- glRectf(offset, yminc, offset+17, ymaxc);
+ glRectf(offset, yminc, offset + 17, ymaxc);
}
/* icon is drawn as widget now... */
@@ -2830,8 +2830,8 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float
// FIXME: replace hardcoded color here, and check on extents!
glColor3f(1.0f, 0.0f, 0.0f);
glLineWidth(2.0);
- fdrawline((float)(offset), yminc,
- (float)(v2d->cur.xmax), yminc);
+ fdrawline((float)(offset), yminc,
+ (float)(v2d->cur.xmax), yminc);
glLineWidth(1.0);
}
}
@@ -2855,21 +2855,21 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float
switch (ac->spacetype) {
case SPACE_ACTION:
{
- SpaceAction *saction= (SpaceAction *)ac->sl;
- draw_sliders= (saction->flag & SACTION_SLIDERS);
+ SpaceAction *saction = (SpaceAction *)ac->sl;
+ draw_sliders = (saction->flag & SACTION_SLIDERS);
}
- break;
+ break;
case SPACE_IPO:
{
- SpaceIpo *sipo= (SpaceIpo *)ac->sl;
- draw_sliders= (sipo->flag & SIPO_SLIDERS);
+ SpaceIpo *sipo = (SpaceIpo *)ac->sl;
+ draw_sliders = (sipo->flag & SIPO_SLIDERS);
}
- break;
+ break;
}
}
/* check if there's enough space for the toggles if the sliders are drawn too */
- if ( !(draw_sliders) || ((v2d->mask.xmax-v2d->mask.xmin) > ACHANNEL_BUTTON_WIDTH/2) ) {
+ if (!(draw_sliders) || ((v2d->mask.xmax - v2d->mask.xmin) > ACHANNEL_BUTTON_WIDTH / 2) ) {
/* protect... */
if (acf->has_setting(ac, ale, ACHANNEL_SETTING_PROTECT))
offset += ICON_WIDTH;
@@ -2893,7 +2893,7 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float
* - starts from the point where the first toggle/slider starts,
* - ends past the space that might be reserved for a scroller
*/
- glRectf(v2d->cur.xmax-(float)offset, yminc, v2d->cur.xmax+EXTRA_SCROLL_PAD, ymaxc);
+ glRectf(v2d->cur.xmax - (float)offset, yminc, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc);
}
}
@@ -2902,13 +2902,13 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float
/* callback for (normal) widget settings - send notifiers */
static void achannel_setting_widget_cb(bContext *C, void *UNUSED(arg1), void *UNUSED(arg2))
{
- WM_event_add_notifier(C, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
}
/* callback for widget settings that need flushing */
static void achannel_setting_flush_widget_cb(bContext *C, void *ale_npoin, void *setting_wrap)
{
- bAnimListElem *ale_setting= (bAnimListElem *)ale_npoin;
+ bAnimListElem *ale_setting = (bAnimListElem *)ale_npoin;
bAnimContext ac;
ListBase anim_data = {NULL, NULL};
int filter;
@@ -2916,7 +2916,7 @@ static void achannel_setting_flush_widget_cb(bContext *C, void *ale_npoin, void
short on = 0;
/* send notifiers before doing anything else... */
- WM_event_add_notifier(C, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
/* verify animation context */
if (ANIM_animdata_get_context(C, &ac) == 0)
@@ -2925,7 +2925,7 @@ static void achannel_setting_flush_widget_cb(bContext *C, void *ale_npoin, void
/* verify that we have a channel to operate on, and that it has all we need */
if (ale_setting) {
/* check if the setting is on... */
- on= ANIM_channel_setting_get(&ac, ale_setting, setting);
+ on = ANIM_channel_setting_get(&ac, ale_setting, setting);
/* on == -1 means setting not found... */
if (on == -1)
@@ -2935,7 +2935,7 @@ static void achannel_setting_flush_widget_cb(bContext *C, void *ale_npoin, void
return;
/* get all channels that can possibly be chosen - but ignore hierarchy */
- filter= ANIMFILTER_DATA_VISIBLE|ANIMFILTER_LIST_CHANNELS;
+ filter = ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_CHANNELS;
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
/* call API method to flush the setting */
@@ -2955,25 +2955,25 @@ static void achannel_setting_rename_done_cb(bContext *C, void *ads_poin, void *U
/* send notifiers */
// XXX: right notifier?
- WM_event_add_notifier(C, NC_ANIMATION|ND_ANIMCHAN|NA_RENAME, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_RENAME, NULL);
}
/* callback for widget sliders - insert keyframes */
static void achannel_setting_slider_cb(bContext *C, void *id_poin, void *fcu_poin)
{
- ID *id= (ID *)id_poin;
- FCurve *fcu= (FCurve *)fcu_poin;
+ ID *id = (ID *)id_poin;
+ FCurve *fcu = (FCurve *)fcu_poin;
ReportList *reports = CTX_wm_reports(C);
- Scene *scene= CTX_data_scene(C);
+ Scene *scene = CTX_data_scene(C);
PointerRNA id_ptr, ptr;
PropertyRNA *prop;
- short flag=0, done=0;
+ short flag = 0, done = 0;
float cfra;
/* get current frame */
// NOTE: this will do for now...
- cfra= (float)CFRA;
+ cfra = (float)CFRA;
/* get flags for keyframing */
flag = ANIM_get_keyframing_flags(scene, 1);
@@ -2988,30 +2988,30 @@ static void achannel_setting_slider_cb(bContext *C, void *id_poin, void *fcu_poi
flag |= INSERTKEY_REPLACE;
/* insert a keyframe for this F-Curve */
- done= insert_keyframe_direct(reports, ptr, prop, fcu, cfra, flag);
+ done = insert_keyframe_direct(reports, ptr, prop, fcu, cfra, flag);
if (done)
- WM_event_add_notifier(C, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
}
}
/* callback for shapekey widget sliders - insert keyframes */
static void achannel_setting_slider_shapekey_cb(bContext *C, void *key_poin, void *kb_poin)
{
- Key *key= (Key *)key_poin;
- KeyBlock *kb= (KeyBlock *)kb_poin;
- char *rna_path= key_get_curValue_rnaPath(key, kb);
+ Key *key = (Key *)key_poin;
+ KeyBlock *kb = (KeyBlock *)kb_poin;
+ char *rna_path = key_get_curValue_rnaPath(key, kb);
ReportList *reports = CTX_wm_reports(C);
- Scene *scene= CTX_data_scene(C);
+ Scene *scene = CTX_data_scene(C);
PointerRNA id_ptr, ptr;
PropertyRNA *prop;
- short flag=0, done=0;
+ short flag = 0, done = 0;
float cfra;
/* get current frame */
// NOTE: this will do for now...
- cfra= (float)CFRA;
+ cfra = (float)CFRA;
/* get flags for keyframing */
flag = ANIM_get_keyframing_flags(scene, 1);
@@ -3023,18 +3023,18 @@ static void achannel_setting_slider_shapekey_cb(bContext *C, void *key_poin, voi
if (RNA_path_resolve(&id_ptr, rna_path, &ptr, &prop)) {
/* find or create new F-Curve */
// XXX is the group name for this ok?
- bAction *act= verify_adt_action((ID *)key, 1);
- FCurve *fcu= verify_fcurve(act, NULL, rna_path, 0, 1);
+ bAction *act = verify_adt_action((ID *)key, 1);
+ FCurve *fcu = verify_fcurve(act, NULL, rna_path, 0, 1);
/* set the special 'replace' flag if on a keyframe */
if (fcurve_frame_has_keyframe(fcu, cfra, 0))
flag |= INSERTKEY_REPLACE;
/* insert a keyframe for this F-Curve */
- done= insert_keyframe_direct(reports, ptr, prop, fcu, cfra, flag);
+ done = insert_keyframe_direct(reports, ptr, prop, fcu, cfra, flag);
if (done)
- WM_event_add_notifier(C, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
}
/* free the path */
@@ -3053,32 +3053,32 @@ static void draw_setting_widget(bAnimContext *ac, bAnimListElem *ale, bAnimChann
uiBut *but = NULL;
/* get the flag and the pointer to that flag */
- flag= acf->setting_flag(ac, setting, &negflag);
- ptr= acf->setting_ptr(ale, setting, &ptrsize);
+ flag = acf->setting_flag(ac, setting, &negflag);
+ ptr = acf->setting_ptr(ale, setting, &ptrsize);
/* enabled= ANIM_channel_setting_get(ac, ale, setting); */ /* UNUSED */
/* get the base icon for the setting */
switch (setting) {
- case ACHANNEL_SETTING_VISIBLE: /* visibility eyes */
+ case ACHANNEL_SETTING_VISIBLE: /* visibility eyes */
//icon= ((enabled)? ICON_VISIBLE_IPO_ON : ICON_VISIBLE_IPO_OFF);
- icon= ICON_VISIBLE_IPO_OFF;
+ icon = ICON_VISIBLE_IPO_OFF;
if (ale->type == ANIMTYPE_FCURVE)
- tooltip= "Channel is visible in Graph Editor for editing";
+ tooltip = "Channel is visible in Graph Editor for editing";
else
- tooltip= "Channel(s) are visible in Graph Editor for editing";
+ tooltip = "Channel(s) are visible in Graph Editor for editing";
break;
case ACHANNEL_SETTING_EXPAND: /* expanded triangle */
//icon= ((enabled)? ICON_TRIA_DOWN : ICON_TRIA_RIGHT);
- icon= ICON_TRIA_RIGHT;
- tooltip= "Make channels grouped under this channel visible";
+ icon = ICON_TRIA_RIGHT;
+ tooltip = "Make channels grouped under this channel visible";
break;
case ACHANNEL_SETTING_SOLO: /* NLA Tracks only */
//icon= ((enabled)? ICON_LAYER_ACTIVE : ICON_LAYER_USED);
- icon= ICON_LAYER_USED;
- tooltip= "NLA Track is the only one evaluated for the AnimData block it belongs to";
+ icon = ICON_LAYER_USED;
+ tooltip = "NLA Track is the only one evaluated for the AnimData block it belongs to";
break;
/* --- */
@@ -3086,48 +3086,48 @@ static void draw_setting_widget(bAnimContext *ac, bAnimListElem *ale, bAnimChann
case ACHANNEL_SETTING_PROTECT: /* protected lock */
// TODO: what about when there's no protect needed?
//icon= ((enabled)? ICON_LOCKED : ICON_UNLOCKED);
- icon= ICON_UNLOCKED;
- tooltip= "Editability of keyframes for this channel";
+ icon = ICON_UNLOCKED;
+ tooltip = "Editability of keyframes for this channel";
break;
case ACHANNEL_SETTING_MUTE: /* muted speaker */
//icon= ((enabled)? ICON_MUTE_IPO_ON : ICON_MUTE_IPO_OFF);
- icon= ICON_MUTE_IPO_OFF;
+ icon = ICON_MUTE_IPO_OFF;
if (ale->type == ALE_FCURVE)
- tooltip= "Does F-Curve contribute to result";
+ tooltip = "Does F-Curve contribute to result";
else
- tooltip= "Do channels contribute to result";
+ tooltip = "Do channels contribute to result";
break;
default:
- tooltip= NULL;
- icon= 0;
+ tooltip = NULL;
+ icon = 0;
break;
}
/* type of button */
if (negflag)
- butType= ICONTOGN;
+ butType = ICONTOGN;
else
- butType= ICONTOG;
+ butType = ICONTOG;
/* draw button for setting */
if (ptr && flag) {
switch (ptrsize) {
- case sizeof(int): /* integer pointer for setting */
+ case sizeof(int): /* integer pointer for setting */
but = uiDefIconButBitI(block, butType, flag, 0, icon,
- xpos, ypos, ICON_WIDTH, ICON_WIDTH, ptr, 0, 0, 0, 0, tooltip);
+ xpos, ypos, ICON_WIDTH, ICON_WIDTH, ptr, 0, 0, 0, 0, tooltip);
break;
- case sizeof(short): /* short pointer for setting */
+ case sizeof(short): /* short pointer for setting */
but = uiDefIconButBitS(block, butType, flag, 0, icon,
- xpos, ypos, ICON_WIDTH, ICON_WIDTH, ptr, 0, 0, 0, 0, tooltip);
+ xpos, ypos, ICON_WIDTH, ICON_WIDTH, ptr, 0, 0, 0, 0, tooltip);
break;
- case sizeof(char): /* char pointer for setting */
+ case sizeof(char): /* char pointer for setting */
but = uiDefIconButBitC(block, butType, flag, 0, icon,
- xpos, ypos, ICON_WIDTH, ICON_WIDTH, ptr, 0, 0, 0, 0, tooltip);
+ xpos, ypos, ICON_WIDTH, ICON_WIDTH, ptr, 0, 0, 0, 0, tooltip);
break;
}
@@ -3153,9 +3153,9 @@ static void draw_setting_widget(bAnimContext *ac, bAnimListElem *ale, bAnimChann
/* Draw UI widgets the given channel */
void ANIM_channel_draw_widgets(bContext *C, bAnimContext *ac, bAnimListElem *ale, uiBlock *block, float yminc, float ymaxc, size_t channel_index)
{
- bAnimChannelType *acf= ANIM_channel_get_typeinfo(ale);
- View2D *v2d= &ac->ar->v2d;
- float y, ymid/*, ytext*/;
+ bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
+ View2D *v2d = &ac->ar->v2d;
+ float y, ymid /*, ytext*/;
short offset;
/* sanity checks - don't draw anything */
@@ -3164,15 +3164,15 @@ void ANIM_channel_draw_widgets(bContext *C, bAnimContext *ac, bAnimListElem *ale
/* get initial offset */
if (acf->get_offset)
- offset= acf->get_offset(ac, ale);
+ offset = acf->get_offset(ac, ale);
else
- offset= 0;
+ offset = 0;
/* calculate appropriate y-coordinates for icon buttons
* 7 is hardcoded factor for half-height of icons
*/
- y= (ymaxc - yminc)/2 + yminc;
- ymid= y - 7;
+ y = (ymaxc - yminc) / 2 + yminc;
+ ymid = y - 7;
/* y-coordinates for text is only 4 down from middle */
/* ytext= y - 4; */
@@ -3213,7 +3213,7 @@ void ANIM_channel_draw_widgets(bContext *C, bAnimContext *ac, bAnimListElem *ale
float channel_height = ymaxc - yminc;
/* if rename index matches, add widget for this */
- if (ac->ads->renameIndex == channel_index+1) {
+ if (ac->ads->renameIndex == channel_index + 1) {
PointerRNA ptr;
PropertyRNA *prop;
@@ -3223,7 +3223,7 @@ void ANIM_channel_draw_widgets(bContext *C, bAnimContext *ac, bAnimListElem *ale
uiBlockSetEmboss(block, UI_EMBOSS);
- but = uiDefButR(block, TEX, 1, "", offset+3, yminc, RENAME_TEXT_WIDTH, channel_height,
+ but = uiDefButR(block, TEX, 1, "", offset + 3, yminc, RENAME_TEXT_WIDTH, channel_height,
&ptr, RNA_property_identifier(prop), -1, 0, 0, -1, -1, NULL);
uiButSetFunc(but, achannel_setting_rename_done_cb, ac->ads, NULL);
uiButActiveOnly(C, block, but);
@@ -3247,30 +3247,30 @@ void ANIM_channel_draw_widgets(bContext *C, bAnimContext *ac, bAnimListElem *ale
switch (ac->spacetype) {
case SPACE_ACTION:
{
- SpaceAction *saction= (SpaceAction *)ac->sl;
- draw_sliders= (saction->flag & SACTION_SLIDERS);
+ SpaceAction *saction = (SpaceAction *)ac->sl;
+ draw_sliders = (saction->flag & SACTION_SLIDERS);
}
- break;
+ break;
case SPACE_IPO:
{
- SpaceIpo *sipo= (SpaceIpo *)ac->sl;
- draw_sliders= (sipo->flag & SIPO_SLIDERS);
+ SpaceIpo *sipo = (SpaceIpo *)ac->sl;
+ draw_sliders = (sipo->flag & SIPO_SLIDERS);
}
- break;
+ break;
}
}
/* check if there's enough space for the toggles if the sliders are drawn too */
- if ( !(draw_sliders) || ((v2d->mask.xmax-v2d->mask.xmin) > ACHANNEL_BUTTON_WIDTH/2) ) {
+ if (!(draw_sliders) || ((v2d->mask.xmax - v2d->mask.xmin) > ACHANNEL_BUTTON_WIDTH / 2) ) {
/* protect... */
if (acf->has_setting(ac, ale, ACHANNEL_SETTING_PROTECT)) {
offset += ICON_WIDTH;
- draw_setting_widget(ac, ale, acf, block, (int)v2d->cur.xmax-offset, ymid, ACHANNEL_SETTING_PROTECT);
+ draw_setting_widget(ac, ale, acf, block, (int)v2d->cur.xmax - offset, ymid, ACHANNEL_SETTING_PROTECT);
}
/* mute... */
if (acf->has_setting(ac, ale, ACHANNEL_SETTING_MUTE)) {
offset += ICON_WIDTH;
- draw_setting_widget(ac, ale, acf, block, (int)v2d->cur.xmax-offset, ymid, ACHANNEL_SETTING_MUTE);
+ draw_setting_widget(ac, ale, acf, block, (int)v2d->cur.xmax - offset, ymid, ACHANNEL_SETTING_MUTE);
}
}
@@ -3299,17 +3299,17 @@ void ANIM_channel_draw_widgets(bContext *C, bAnimContext *ac, bAnimListElem *ale
/* get destination info */
if (ale->type == ANIMTYPE_FCURVE) {
- FCurve *fcu= (FCurve *)ale->data;
+ FCurve *fcu = (FCurve *)ale->data;
- rna_path= fcu->rna_path;
- array_index= fcu->array_index;
+ rna_path = fcu->rna_path;
+ array_index = fcu->array_index;
}
else if (ale->type == ANIMTYPE_SHAPEKEY) {
- KeyBlock *kb= (KeyBlock *)ale->data;
- Key *key= (Key *)ale->id;
+ KeyBlock *kb = (KeyBlock *)ale->data;
+ Key *key = (Key *)ale->id;
- rna_path= key_get_curValue_rnaPath(key, kb);
- free_path= 1;
+ rna_path = key_get_curValue_rnaPath(key, kb);
+ free_path = 1;
}
/* only if RNA-Path found */
@@ -3322,7 +3322,7 @@ void ANIM_channel_draw_widgets(bContext *C, bAnimContext *ac, bAnimListElem *ale
uiBut *but;
/* create the slider button, and assign relevant callback to ensure keyframes are inserted... */
- but = uiDefAutoButR(block, &ptr, prop, array_index, "", ICON_NONE, (int)v2d->cur.xmax-offset, ymid, SLIDER_WIDTH, (int)ymaxc-yminc);
+ but = uiDefAutoButR(block, &ptr, prop, array_index, "", ICON_NONE, (int)v2d->cur.xmax - offset, ymid, SLIDER_WIDTH, (int)ymaxc - yminc);
/* assign keyframing function according to slider type */
if (ale->type == ANIMTYPE_SHAPEKEY)
diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c
index 9b46729b489..24cae5d8652 100644
--- a/source/blender/editors/animation/fmodifier_ui.c
+++ b/source/blender/editors/animation/fmodifier_ui.c
@@ -69,23 +69,23 @@
// XXX! --------------------------------
/* temporary definition for limits of float number buttons (FLT_MAX tends to infinity with old system) */
-#define UI_FLT_MAX 10000.0f
+#define UI_FLT_MAX 10000.0f
-#define B_REDR 1
-#define B_FMODIFIER_REDRAW 20
+#define B_REDR 1
+#define B_FMODIFIER_REDRAW 20
/* macro for use here to draw background box and set height */
// XXX for now, roundbox has it's callback func set to NULL to not intercept events
#define DRAW_BACKDROP(height) \
{ \
- uiDefBut(block, ROUNDBOX, B_REDR, "", -3, yco-height, width+3, height-1, NULL, 5.0, 0.0, 12.0, (float)rb_col, ""); \
+ uiDefBut(block, ROUNDBOX, B_REDR, "", -3, yco - height, width + 3, height - 1, NULL, 5.0, 0.0, 12.0, (float)rb_col, ""); \
}
/* callback to verify modifier data */
-static void validate_fmodifier_cb (bContext *UNUSED(C), void *fcm_v, void *UNUSED(arg))
+static void validate_fmodifier_cb(bContext *UNUSED(C), void *fcm_v, void *UNUSED(arg))
{
- FModifier *fcm= (FModifier *)fcm_v;
- FModifierTypeInfo *fmi= fmodifier_get_typeinfo(fcm);
+ FModifier *fcm = (FModifier *)fcm_v;
+ FModifierTypeInfo *fmi = fmodifier_get_typeinfo(fcm);
/* call the verify callback on the modifier if applicable */
if (fmi && fmi->verify_data)
@@ -93,10 +93,10 @@ static void validate_fmodifier_cb (bContext *UNUSED(C), void *fcm_v, void *UNUSE
}
/* callback to remove the given modifier */
-static void delete_fmodifier_cb (bContext *C, void *fmods_v, void *fcm_v)
+static void delete_fmodifier_cb(bContext *C, void *fmods_v, void *fcm_v)
{
ListBase *modifiers = (ListBase *)fmods_v;
- FModifier *fcm= (FModifier *)fcm_v;
+ FModifier *fcm = (FModifier *)fcm_v;
/* remove the given F-Modifier from the active modifier-stack */
remove_fmodifier(modifiers, fcm);
@@ -105,7 +105,7 @@ static void delete_fmodifier_cb (bContext *C, void *fmods_v, void *fcm_v)
/* send notifiers */
// XXX for now, this is the only way to get updates in all the right places... but would be nice to have a special one in this case
- WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
}
/* --------------- */
@@ -113,7 +113,7 @@ static void delete_fmodifier_cb (bContext *C, void *fmods_v, void *fcm_v)
/* draw settings for generator modifier */
static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, short width)
{
- FMod_Generator *data= (FMod_Generator *)fcm->data;
+ FMod_Generator *data = (FMod_Generator *)fcm->data;
uiLayout /* *col, */ /* UNUSED */ *row;
uiBlock *block;
uiBut *but;
@@ -124,12 +124,12 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s
/* basic settings (backdrop + mode selector + some padding) */
/* col= uiLayoutColumn(layout, 1); */ /* UNUSED */
- block= uiLayoutGetBlock(layout);
+ block = uiLayoutGetBlock(layout);
uiBlockBeginAlign(block);
- but = uiDefButR(block, MENU, B_FMODIFIER_REDRAW, NULL, 0, 0, width-30, UI_UNIT_Y, &ptr, "mode", -1, 0, 0, -1, -1, NULL);
- uiButSetFunc(but, validate_fmodifier_cb, fcm, NULL);
+ but = uiDefButR(block, MENU, B_FMODIFIER_REDRAW, NULL, 0, 0, width - 30, UI_UNIT_Y, &ptr, "mode", -1, 0, 0, -1, -1, NULL);
+ uiButSetFunc(but, validate_fmodifier_cb, fcm, NULL);
- uiDefButR(block, TOG, B_FMODIFIER_REDRAW, NULL, 0, 0, width-30, UI_UNIT_Y, &ptr, "use_additive", -1, 0, 0, -1, -1, NULL);
+ uiDefButR(block, TOG, B_FMODIFIER_REDRAW, NULL, 0, 0, width - 30, UI_UNIT_Y, &ptr, "use_additive", -1, 0, 0, -1, -1, NULL);
uiBlockEndAlign(block);
/* now add settings for individual modes */
@@ -141,20 +141,20 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s
unsigned int i;
/* draw polynomial order selector */
- row= uiLayoutRow(layout, 0);
- block= uiLayoutGetBlock(row);
- but = uiDefButI(block, NUM, B_FMODIFIER_REDRAW, IFACE_("Poly Order:"), 10, 0, width-30, 19,
- &data->poly_order, 1, 100, 0, 0,
- TIP_("'Order' of the Polynomial (for a polynomial with n terms, 'order' is n-1)"));
- uiButSetFunc(but, validate_fmodifier_cb, fcm, NULL);
+ row = uiLayoutRow(layout, 0);
+ block = uiLayoutGetBlock(row);
+ but = uiDefButI(block, NUM, B_FMODIFIER_REDRAW, IFACE_("Poly Order:"), 10, 0, width - 30, 19,
+ &data->poly_order, 1, 100, 0, 0,
+ TIP_("'Order' of the Polynomial (for a polynomial with n terms, 'order' is n-1)"));
+ uiButSetFunc(but, validate_fmodifier_cb, fcm, NULL);
/* draw controls for each coefficient and a + sign at end of row */
- row= uiLayoutRow(layout, 1);
- block= uiLayoutGetBlock(row);
+ row = uiLayoutRow(layout, 1);
+ block = uiLayoutGetBlock(row);
- cp= data->coefficients;
- for (i=0; (i < data->arraysize) && (cp); i++, cp++) {
+ cp = data->coefficients;
+ for (i = 0; (i < data->arraysize) && (cp); i++, cp++) {
/* To align with first line */
if (i)
uiDefBut(block, LABEL, 1, " ", 0, 0, 50, 20, NULL, 0.0, 0.0, 0, 0, "");
@@ -173,12 +173,12 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s
sprintf(xval, "x^%u", i);
uiDefBut(block, LABEL, 1, xval, 0, 0, 50, 20, NULL, 0.0, 0.0, 0, 0, TIP_("Power of x"));
- if ( (i != (data->arraysize - 1)) || ((i==0) && data->arraysize==2) ) {
+ if ( (i != (data->arraysize - 1)) || ((i == 0) && data->arraysize == 2) ) {
uiDefBut(block, LABEL, 1, "+", 0, 0, 30, 20, NULL, 0.0, 0.0, 0, 0, "");
/* next coefficient on a new row */
- row= uiLayoutRow(layout, 1);
- block= uiLayoutGetBlock(row);
+ row = uiLayoutRow(layout, 1);
+ block = uiLayoutGetBlock(row);
}
else {
/* For alignement in UI! */
@@ -194,20 +194,20 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s
unsigned int i;
/* draw polynomial order selector */
- row= uiLayoutRow(layout, 0);
- block= uiLayoutGetBlock(row);
- but = uiDefButI(block, NUM, B_FMODIFIER_REDRAW, IFACE_("Poly Order:"), 0, 0, width-30, 19,
- &data->poly_order, 1, 100, 0, 0,
- TIP_("'Order' of the Polynomial (for a polynomial with n terms, 'order' is n-1)"));
- uiButSetFunc(but, validate_fmodifier_cb, fcm, NULL);
+ row = uiLayoutRow(layout, 0);
+ block = uiLayoutGetBlock(row);
+ but = uiDefButI(block, NUM, B_FMODIFIER_REDRAW, IFACE_("Poly Order:"), 0, 0, width - 30, 19,
+ &data->poly_order, 1, 100, 0, 0,
+ TIP_("'Order' of the Polynomial (for a polynomial with n terms, 'order' is n-1)"));
+ uiButSetFunc(but, validate_fmodifier_cb, fcm, NULL);
/* draw controls for each pair of coefficients */
- row= uiLayoutRow(layout, 1);
- block= uiLayoutGetBlock(row);
+ row = uiLayoutRow(layout, 1);
+ block = uiLayoutGetBlock(row);
- cp= data->coefficients;
- for (i=0; (i < data->poly_order) && (cp); i++, cp+=2) {
+ cp = data->coefficients;
+ for (i = 0; (i < data->poly_order) && (cp); i++, cp += 2) {
/* To align with first line */
if (i)
uiDefBut(block, LABEL, 1, " ", 0, 0, 50, 20, NULL, 0.0, 0.0, 0, 0, "");
@@ -222,22 +222,22 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s
uiDefBut(block, LABEL, 1, "x +", 0, 0, 40, 20, NULL, 0.0, 0.0, 0, 0, "");
- uiDefButF(block, NUM, B_FMODIFIER_REDRAW, "", 0, 0, 100, 20, cp+1, -UI_FLT_MAX, UI_FLT_MAX,
+ uiDefButF(block, NUM, B_FMODIFIER_REDRAW, "", 0, 0, 100, 20, cp + 1, -UI_FLT_MAX, UI_FLT_MAX,
10, 3, TIP_("Second coefficient"));
/* closing bracket and '+' sign */
- if ( (i != (data->poly_order - 1)) || ((i==0) && data->poly_order==2) ) {
+ if ( (i != (data->poly_order - 1)) || ((i == 0) && data->poly_order == 2) ) {
uiDefBut(block, LABEL, 1, ") +", 0, 0, 30, 20, NULL, 0.0, 0.0, 0, 0, "");
/* set up new row for the next pair of coefficients*/
- row= uiLayoutRow(layout, 1);
- block= uiLayoutGetBlock(row);
+ row = uiLayoutRow(layout, 1);
+ block = uiLayoutGetBlock(row);
}
else
uiDefBut(block, LABEL, 1, ")", 0, 0, 20, 20, NULL, 0.0, 0.0, 0, 0, "");
}
}
- break;
+ break;
}
}
@@ -253,15 +253,15 @@ static void draw_modifier__fn_generator(uiLayout *layout, ID *id, FModifier *fcm
RNA_pointer_create(id, &RNA_FModifierFunctionGenerator, fcm, &ptr);
/* add the settings */
- col= uiLayoutColumn(layout, 1);
- uiItemR(col, &ptr, "function_type", 0, "", ICON_NONE);
- uiItemR(col, &ptr, "use_additive", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
-
- col= uiLayoutColumn(layout, 0); // no grouping for now
- uiItemR(col, &ptr, "amplitude", 0, NULL, ICON_NONE);
- uiItemR(col, &ptr, "phase_multiplier", 0, NULL, ICON_NONE);
- uiItemR(col, &ptr, "phase_offset", 0, NULL, ICON_NONE);
- uiItemR(col, &ptr, "value_offset", 0, NULL, ICON_NONE);
+ col = uiLayoutColumn(layout, 1);
+ uiItemR(col, &ptr, "function_type", 0, "", ICON_NONE);
+ uiItemR(col, &ptr, "use_additive", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
+
+ col = uiLayoutColumn(layout, 0); // no grouping for now
+ uiItemR(col, &ptr, "amplitude", 0, NULL, ICON_NONE);
+ uiItemR(col, &ptr, "phase_multiplier", 0, NULL, ICON_NONE);
+ uiItemR(col, &ptr, "phase_offset", 0, NULL, ICON_NONE);
+ uiItemR(col, &ptr, "value_offset", 0, NULL, ICON_NONE);
}
/* --------------- */
@@ -278,19 +278,19 @@ static void draw_modifier__cycles(uiLayout *layout, ID *id, FModifier *fcm, shor
/* split into 2 columns
* NOTE: the mode comboboxes shouldn't get labels, otherwise there isn't enough room
*/
- split= uiLayoutSplit(layout, 0.5f, 0);
+ split = uiLayoutSplit(layout, 0.5f, 0);
/* before range */
- col= uiLayoutColumn(split, 1);
- uiItemL(col, IFACE_("Before:"), ICON_NONE);
- uiItemR(col, &ptr, "mode_before", 0, "", ICON_NONE);
- uiItemR(col, &ptr, "cycles_before", 0, NULL, ICON_NONE);
+ col = uiLayoutColumn(split, 1);
+ uiItemL(col, IFACE_("Before:"), ICON_NONE);
+ uiItemR(col, &ptr, "mode_before", 0, "", ICON_NONE);
+ uiItemR(col, &ptr, "cycles_before", 0, NULL, ICON_NONE);
/* after range */
- col= uiLayoutColumn(split, 1);
- uiItemL(col, IFACE_("After:"), ICON_NONE);
- uiItemR(col, &ptr, "mode_after", 0, "", ICON_NONE);
- uiItemR(col, &ptr, "cycles_after", 0, NULL, ICON_NONE);
+ col = uiLayoutColumn(split, 1);
+ uiItemL(col, IFACE_("After:"), ICON_NONE);
+ uiItemR(col, &ptr, "mode_after", 0, "", ICON_NONE);
+ uiItemR(col, &ptr, "cycles_after", 0, NULL, ICON_NONE);
}
/* --------------- */
@@ -308,33 +308,33 @@ static void draw_modifier__noise(uiLayout *layout, ID *id, FModifier *fcm, short
uiItemR(layout, &ptr, "blend_type", 0, NULL, ICON_NONE);
/* split into 2 columns */
- split= uiLayoutSplit(layout, 0.5f, 0);
+ split = uiLayoutSplit(layout, 0.5f, 0);
/* col 1 */
- col= uiLayoutColumn(split, 0);
- uiItemR(col, &ptr, "scale", 0, NULL, ICON_NONE);
- uiItemR(col, &ptr, "strength", 0, NULL, ICON_NONE);
+ col = uiLayoutColumn(split, 0);
+ uiItemR(col, &ptr, "scale", 0, NULL, ICON_NONE);
+ uiItemR(col, &ptr, "strength", 0, NULL, ICON_NONE);
/* col 2 */
- col= uiLayoutColumn(split, 0);
- uiItemR(col, &ptr, "phase", 0, NULL, ICON_NONE);
- uiItemR(col, &ptr, "depth", 0, NULL, ICON_NONE);
+ col = uiLayoutColumn(split, 0);
+ uiItemR(col, &ptr, "phase", 0, NULL, ICON_NONE);
+ uiItemR(col, &ptr, "depth", 0, NULL, ICON_NONE);
}
/* --------------- */
-#define BINARYSEARCH_FRAMEEQ_THRESH 0.0001f
+#define BINARYSEARCH_FRAMEEQ_THRESH 0.0001f
/* Binary search algorithm for finding where to insert Envelope Data Point.
* Returns the index to insert at (data already at that index will be offset if replace is 0)
*/
-static int binarysearch_fcm_envelopedata_index (FCM_EnvelopeData array[], float frame, int arraylen, short *exists)
+static int binarysearch_fcm_envelopedata_index(FCM_EnvelopeData array[], float frame, int arraylen, short *exists)
{
- int start=0, end=arraylen;
- int loopbreaker= 0, maxloop= arraylen * 2;
+ int start = 0, end = arraylen;
+ int loopbreaker = 0, maxloop = arraylen * 2;
/* initialize exists-flag first */
- *exists= 0;
+ *exists = 0;
/* sneaky optimisations (don't go through searching process if...):
* - keyframe to be added is to be added out of current bounds
@@ -349,7 +349,7 @@ static int binarysearch_fcm_envelopedata_index (FCM_EnvelopeData array[], float
float framenum;
/* 'First' Point (when only one point, this case is used) */
- framenum= array[0].time;
+ framenum = array[0].time;
if (IS_EQT(frame, framenum, BINARYSEARCH_FRAMEEQ_THRESH)) {
*exists = 1;
return 0;
@@ -358,9 +358,9 @@ static int binarysearch_fcm_envelopedata_index (FCM_EnvelopeData array[], float
return 0;
/* 'Last' Point */
- framenum= array[(arraylen-1)].time;
+ framenum = array[(arraylen - 1)].time;
if (IS_EQT(frame, framenum, BINARYSEARCH_FRAMEEQ_THRESH)) {
- *exists= 1;
+ *exists = 1;
return (arraylen - 1);
}
else if (frame > framenum)
@@ -369,12 +369,12 @@ static int binarysearch_fcm_envelopedata_index (FCM_EnvelopeData array[], float
/* most of the time, this loop is just to find where to put it
- * - 'loopbreaker' is just here to prevent infinite loops
+ * - 'loopbreaker' is just here to prevent infinite loops
*/
- for (loopbreaker=0; (start <= end) && (loopbreaker < maxloop); loopbreaker++) {
+ for (loopbreaker = 0; (start <= end) && (loopbreaker < maxloop); loopbreaker++) {
/* compute and get midpoint */
- int mid = start + ((end - start) / 2); /* we calculate the midpoint this way to avoid int overflows... */
- float midfra= array[mid].time;
+ int mid = start + ((end - start) / 2); /* we calculate the midpoint this way to avoid int overflows... */
+ float midfra = array[mid].time;
/* check if exactly equal to midpoint */
if (IS_EQT(frame, midfra, BINARYSEARCH_FRAMEEQ_THRESH)) {
@@ -384,13 +384,13 @@ static int binarysearch_fcm_envelopedata_index (FCM_EnvelopeData array[], float
/* repeat in upper/lower half */
if (frame > midfra)
- start= mid + 1;
+ start = mid + 1;
else if (frame < midfra)
- end= mid - 1;
+ end = mid - 1;
}
/* print error if loop-limit exceeded */
- if (loopbreaker == (maxloop-1)) {
+ if (loopbreaker == (maxloop - 1)) {
printf("Error: binarysearch_fcm_envelopedata_index() was taking too long\n");
// include debug info
@@ -403,91 +403,91 @@ static int binarysearch_fcm_envelopedata_index (FCM_EnvelopeData array[], float
/* callback to add new envelope data point */
// TODO: should we have a separate file for things like this?
-static void fmod_envelope_addpoint_cb (bContext *C, void *fcm_dv, void *UNUSED(arg))
+static void fmod_envelope_addpoint_cb(bContext *C, void *fcm_dv, void *UNUSED(arg))
{
- Scene *scene= CTX_data_scene(C);
- FMod_Envelope *env= (FMod_Envelope *)fcm_dv;
+ Scene *scene = CTX_data_scene(C);
+ FMod_Envelope *env = (FMod_Envelope *)fcm_dv;
FCM_EnvelopeData *fedn;
FCM_EnvelopeData fed;
/* init template data */
- fed.min= -1.0f;
- fed.max= 1.0f;
- fed.time= (float)scene->r.cfra; // XXX make this int for ease of use?
- fed.f1= fed.f2= 0;
+ fed.min = -1.0f;
+ fed.max = 1.0f;
+ fed.time = (float)scene->r.cfra; // XXX make this int for ease of use?
+ fed.f1 = fed.f2 = 0;
/* check that no data exists for the current frame... */
if (env->data) {
short exists = -1;
- int i= binarysearch_fcm_envelopedata_index(env->data, (float)(scene->r.cfra), env->totvert, &exists);
+ int i = binarysearch_fcm_envelopedata_index(env->data, (float)(scene->r.cfra), env->totvert, &exists);
/* binarysearch_...() will set exists by default to 0, so if it is non-zero, that means that the point exists already */
if (exists)
return;
/* add new */
- fedn= MEM_callocN((env->totvert+1)*sizeof(FCM_EnvelopeData), "FCM_EnvelopeData");
+ fedn = MEM_callocN((env->totvert + 1) * sizeof(FCM_EnvelopeData), "FCM_EnvelopeData");
/* add the points that should occur before the point to be pasted */
if (i > 0)
- memcpy(fedn, env->data, i*sizeof(FCM_EnvelopeData));
+ memcpy(fedn, env->data, i * sizeof(FCM_EnvelopeData));
/* add point to paste at index i */
- *(fedn + i)= fed;
+ *(fedn + i) = fed;
/* add the points that occur after the point to be pasted */
if (i < env->totvert)
- memcpy(fedn+i+1, env->data+i, (env->totvert-i)*sizeof(FCM_EnvelopeData));
+ memcpy(fedn + i + 1, env->data + i, (env->totvert - i) * sizeof(FCM_EnvelopeData));
/* replace (+ free) old with new */
MEM_freeN(env->data);
- env->data= fedn;
+ env->data = fedn;
env->totvert++;
}
else {
- env->data= MEM_callocN(sizeof(FCM_EnvelopeData), "FCM_EnvelopeData");
- *(env->data)= fed;
+ env->data = MEM_callocN(sizeof(FCM_EnvelopeData), "FCM_EnvelopeData");
+ *(env->data) = fed;
- env->totvert= 1;
+ env->totvert = 1;
}
}
/* callback to remove envelope data point */
// TODO: should we have a separate file for things like this?
-static void fmod_envelope_deletepoint_cb (bContext *UNUSED(C), void *fcm_dv, void *ind_v)
+static void fmod_envelope_deletepoint_cb(bContext *UNUSED(C), void *fcm_dv, void *ind_v)
{
- FMod_Envelope *env= (FMod_Envelope *)fcm_dv;
+ FMod_Envelope *env = (FMod_Envelope *)fcm_dv;
FCM_EnvelopeData *fedn;
- int index= GET_INT_FROM_POINTER(ind_v);
+ int index = GET_INT_FROM_POINTER(ind_v);
/* check that no data exists for the current frame... */
if (env->totvert > 1) {
/* allocate a new smaller array */
- fedn= MEM_callocN(sizeof(FCM_EnvelopeData)*(env->totvert-1), "FCM_EnvelopeData");
+ fedn = MEM_callocN(sizeof(FCM_EnvelopeData) * (env->totvert - 1), "FCM_EnvelopeData");
- memcpy(fedn, env->data, sizeof(FCM_EnvelopeData)*(index));
- memcpy(fedn + index, env->data + (index + 1), sizeof(FCM_EnvelopeData)*((env->totvert - index)-1));
+ memcpy(fedn, env->data, sizeof(FCM_EnvelopeData) * (index));
+ memcpy(fedn + index, env->data + (index + 1), sizeof(FCM_EnvelopeData) * ((env->totvert - index) - 1));
/* free old array, and set the new */
MEM_freeN(env->data);
- env->data= fedn;
+ env->data = fedn;
env->totvert--;
}
else {
/* just free array, since the only vert was deleted */
if (env->data) {
MEM_freeN(env->data);
- env->data= NULL;
+ env->data = NULL;
}
- env->totvert= 0;
+ env->totvert = 0;
}
}
/* draw settings for envelope modifier */
static void draw_modifier__envelope(uiLayout *layout, ID *id, FModifier *fcm, short UNUSED(width))
{
- FMod_Envelope *env= (FMod_Envelope *)fcm->data;
+ FMod_Envelope *env = (FMod_Envelope *)fcm->data;
FCM_EnvelopeData *fed;
uiLayout *col, *row;
uiBlock *block;
@@ -499,45 +499,45 @@ static void draw_modifier__envelope(uiLayout *layout, ID *id, FModifier *fcm, sh
RNA_pointer_create(id, &RNA_FModifierEnvelope, fcm, &ptr);
/* general settings */
- col= uiLayoutColumn(layout, 1);
- uiItemL(col, IFACE_("Envelope:"), ICON_NONE);
- uiItemR(col, &ptr, "reference_value", 0, NULL, ICON_NONE);
-
- row= uiLayoutRow(col, 1);
- uiItemR(row, &ptr, "default_min", 0, IFACE_("Min"), ICON_NONE);
- uiItemR(row, &ptr, "default_max", 0, IFACE_("Max"), ICON_NONE);
+ col = uiLayoutColumn(layout, 1);
+ uiItemL(col, IFACE_("Envelope:"), ICON_NONE);
+ uiItemR(col, &ptr, "reference_value", 0, NULL, ICON_NONE);
+
+ row = uiLayoutRow(col, 1);
+ uiItemR(row, &ptr, "default_min", 0, IFACE_("Min"), ICON_NONE);
+ uiItemR(row, &ptr, "default_max", 0, IFACE_("Max"), ICON_NONE);
/* control points header */
// TODO: move this control-point control stuff to using the new special widgets for lists
// the current way is far too cramped
- row= uiLayoutRow(layout, 0);
- block= uiLayoutGetBlock(row);
+ row = uiLayoutRow(layout, 0);
+ block = uiLayoutGetBlock(row);
- uiDefBut(block, LABEL, 1, IFACE_("Control Points:"), 0, 0, 150, 20, NULL, 0.0, 0.0, 0, 0, "");
+ uiDefBut(block, LABEL, 1, IFACE_("Control Points:"), 0, 0, 150, 20, NULL, 0.0, 0.0, 0, 0, "");
- but = uiDefBut(block, BUT, B_FMODIFIER_REDRAW, IFACE_("Add Point"), 0, 0, 150, 19,
- NULL, 0, 0, 0, 0, TIP_("Add a new control-point to the envelope on the current frame"));
- uiButSetFunc(but, fmod_envelope_addpoint_cb, env, NULL);
+ but = uiDefBut(block, BUT, B_FMODIFIER_REDRAW, IFACE_("Add Point"), 0, 0, 150, 19,
+ NULL, 0, 0, 0, 0, TIP_("Add a new control-point to the envelope on the current frame"));
+ uiButSetFunc(but, fmod_envelope_addpoint_cb, env, NULL);
/* control points list */
- for (i=0, fed=env->data; i < env->totvert; i++, fed++) {
+ for (i = 0, fed = env->data; i < env->totvert; i++, fed++) {
/* get a new row to operate on */
- row= uiLayoutRow(layout, 1);
- block= uiLayoutGetBlock(row);
+ row = uiLayoutRow(layout, 1);
+ block = uiLayoutGetBlock(row);
uiBlockBeginAlign(block);
- but=uiDefButF(block, NUM, B_FMODIFIER_REDRAW, IFACE_("Fra:"), 0, 0, 90, 20,
- &fed->time, -MAXFRAMEF, MAXFRAMEF, 10, 1, TIP_("Frame that envelope point occurs"));
- uiButSetFunc(but, validate_fmodifier_cb, fcm, NULL);
-
- uiDefButF(block, NUM, B_FMODIFIER_REDRAW, IFACE_("Min:"), 0, 0, 100, 20,
- &fed->min, -UI_FLT_MAX, UI_FLT_MAX, 10, 2, TIP_("Minimum bound of envelope at this point"));
- uiDefButF(block, NUM, B_FMODIFIER_REDRAW, IFACE_("Max:"), 0, 0, 100, 20,
- &fed->max, -UI_FLT_MAX, UI_FLT_MAX, 10, 2, TIP_("Maximum bound of envelope at this point"));
+ but = uiDefButF(block, NUM, B_FMODIFIER_REDRAW, IFACE_("Fra:"), 0, 0, 90, 20,
+ &fed->time, -MAXFRAMEF, MAXFRAMEF, 10, 1, TIP_("Frame that envelope point occurs"));
+ uiButSetFunc(but, validate_fmodifier_cb, fcm, NULL);
- but = uiDefIconBut(block, BUT, B_FMODIFIER_REDRAW, ICON_X, 0, 0, 18, 20,
- NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Delete envelope control point"));
- uiButSetFunc(but, fmod_envelope_deletepoint_cb, env, SET_INT_IN_POINTER(i));
+ uiDefButF(block, NUM, B_FMODIFIER_REDRAW, IFACE_("Min:"), 0, 0, 100, 20,
+ &fed->min, -UI_FLT_MAX, UI_FLT_MAX, 10, 2, TIP_("Minimum bound of envelope at this point"));
+ uiDefButF(block, NUM, B_FMODIFIER_REDRAW, IFACE_("Max:"), 0, 0, 100, 20,
+ &fed->max, -UI_FLT_MAX, UI_FLT_MAX, 10, 2, TIP_("Maximum bound of envelope at this point"));
+
+ but = uiDefIconBut(block, BUT, B_FMODIFIER_REDRAW, ICON_X, 0, 0, 18, 20,
+ NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Delete envelope control point"));
+ uiButSetFunc(but, fmod_envelope_deletepoint_cb, env, SET_INT_IN_POINTER(i));
uiBlockBeginAlign(block);
}
}
@@ -558,17 +558,17 @@ static void draw_modifier__limits(uiLayout *layout, ID *id, FModifier *fcm, shor
/* row= uiLayoutRow(layout, 0); */ /* UNUSED */
/* split into 2 columns */
- split= uiLayoutSplit(layout, 0.5f, 0);
+ split = uiLayoutSplit(layout, 0.5f, 0);
/* x-minimum */
- col= uiLayoutColumn(split, 1);
- uiItemR(col, &ptr, "use_min_x", 0, NULL, ICON_NONE);
- uiItemR(col, &ptr, "min_x", 0, NULL, ICON_NONE);
+ col = uiLayoutColumn(split, 1);
+ uiItemR(col, &ptr, "use_min_x", 0, NULL, ICON_NONE);
+ uiItemR(col, &ptr, "min_x", 0, NULL, ICON_NONE);
/* y-minimum*/
- col= uiLayoutColumn(split, 1);
- uiItemR(col, &ptr, "use_min_y", 0, NULL, ICON_NONE);
- uiItemR(col, &ptr, "min_y", 0, NULL, ICON_NONE);
+ col = uiLayoutColumn(split, 1);
+ uiItemR(col, &ptr, "use_min_y", 0, NULL, ICON_NONE);
+ uiItemR(col, &ptr, "min_y", 0, NULL, ICON_NONE);
}
/* row 2: maximum */
@@ -576,17 +576,17 @@ static void draw_modifier__limits(uiLayout *layout, ID *id, FModifier *fcm, shor
/* row= uiLayoutRow(layout, 0); */ /* UNUSED */
/* split into 2 columns */
- split= uiLayoutSplit(layout, 0.5f, 0);
+ split = uiLayoutSplit(layout, 0.5f, 0);
/* x-minimum */
- col= uiLayoutColumn(split, 1);
- uiItemR(col, &ptr, "use_max_x", 0, NULL, ICON_NONE);
- uiItemR(col, &ptr, "max_x", 0, NULL, ICON_NONE);
+ col = uiLayoutColumn(split, 1);
+ uiItemR(col, &ptr, "use_max_x", 0, NULL, ICON_NONE);
+ uiItemR(col, &ptr, "max_x", 0, NULL, ICON_NONE);
/* y-minimum*/
- col= uiLayoutColumn(split, 1);
- uiItemR(col, &ptr, "use_max_y", 0, NULL, ICON_NONE);
- uiItemR(col, &ptr, "max_y", 0, NULL, ICON_NONE);
+ col = uiLayoutColumn(split, 1);
+ uiItemR(col, &ptr, "use_max_y", 0, NULL, ICON_NONE);
+ uiItemR(col, &ptr, "max_y", 0, NULL, ICON_NONE);
}
}
@@ -602,36 +602,36 @@ static void draw_modifier__stepped(uiLayout *layout, ID *id, FModifier *fcm, sho
RNA_pointer_create(id, &RNA_FModifierStepped, fcm, &ptr);
/* block 1: "stepping" settings */
- col= uiLayoutColumn(layout, 0);
- uiItemR(col, &ptr, "frame_step", 0, NULL, ICON_NONE);
- uiItemR(col, &ptr, "frame_offset", 0, NULL, ICON_NONE);
+ col = uiLayoutColumn(layout, 0);
+ uiItemR(col, &ptr, "frame_step", 0, NULL, ICON_NONE);
+ uiItemR(col, &ptr, "frame_offset", 0, NULL, ICON_NONE);
/* block 2: start range settings */
- col= uiLayoutColumn(layout, 1);
- uiItemR(col, &ptr, "use_frame_start", 0, NULL, ICON_NONE);
+ col = uiLayoutColumn(layout, 1);
+ uiItemR(col, &ptr, "use_frame_start", 0, NULL, ICON_NONE);
- sub = uiLayoutColumn(col, 1);
- uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_frame_start"));
- uiItemR(sub, &ptr, "frame_start", 0, NULL, ICON_NONE);
+ sub = uiLayoutColumn(col, 1);
+ uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_frame_start"));
+ uiItemR(sub, &ptr, "frame_start", 0, NULL, ICON_NONE);
/* block 3: end range settings */
- col= uiLayoutColumn(layout, 1);
- uiItemR(col, &ptr, "use_frame_end", 0, NULL, ICON_NONE);
+ col = uiLayoutColumn(layout, 1);
+ uiItemR(col, &ptr, "use_frame_end", 0, NULL, ICON_NONE);
- sub = uiLayoutColumn(col, 1);
- uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_frame_end"));
- uiItemR(sub, &ptr, "frame_end", 0, NULL, ICON_NONE);
+ sub = uiLayoutColumn(col, 1);
+ uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_frame_end"));
+ uiItemR(sub, &ptr, "frame_end", 0, NULL, ICON_NONE);
}
/* --------------- */
void ANIM_uiTemplate_fmodifier_draw(uiLayout *layout, ID *id, ListBase *modifiers, FModifier *fcm)
{
- FModifierTypeInfo *fmi= fmodifier_get_typeinfo(fcm);
+ FModifierTypeInfo *fmi = fmodifier_get_typeinfo(fcm);
uiLayout *box, *row, *sub, *col;
uiBlock *block;
uiBut *but;
- short width= 314;
+ short width = 314;
PointerRNA ptr;
/* init the RNA-pointer */
@@ -640,13 +640,13 @@ void ANIM_uiTemplate_fmodifier_draw(uiLayout *layout, ID *id, ListBase *modifier
/* draw header */
{
/* get layout-row + UI-block for this */
- box= uiLayoutBox(layout);
+ box = uiLayoutBox(layout);
- row= uiLayoutRow(box, 0);
- block= uiLayoutGetBlock(row); // err...
+ row = uiLayoutRow(box, 0);
+ block = uiLayoutGetBlock(row); // err...
/* left-align -------------------------------------------- */
- sub= uiLayoutRow(row, 1);
+ sub = uiLayoutRow(row, 1);
uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT);
uiBlockSetEmboss(block, UI_EMBOSSN);
@@ -664,7 +664,7 @@ void ANIM_uiTemplate_fmodifier_draw(uiLayout *layout, ID *id, ListBase *modifier
uiItemL(sub, "<Unknown Modifier>", ICON_NONE);
/* right-align ------------------------------------------- */
- sub= uiLayoutRow(row, 1);
+ sub = uiLayoutRow(row, 1);
uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_RIGHT);
@@ -675,7 +675,7 @@ void ANIM_uiTemplate_fmodifier_draw(uiLayout *layout, ID *id, ListBase *modifier
/* delete button */
but = uiDefIconBut(block, BUT, B_REDR, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y,
- NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Delete F-Curve Modifier"));
+ NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Delete F-Curve Modifier"));
uiButSetFunc(but, delete_fmodifier_cb, modifiers, fcm);
uiBlockSetEmboss(block, UI_EMBOSS);
@@ -684,7 +684,7 @@ void ANIM_uiTemplate_fmodifier_draw(uiLayout *layout, ID *id, ListBase *modifier
/* when modifier is expanded, draw settings */
if (fcm->flag & FMODIFIER_FLAG_EXPANDED) {
/* set up the flexible-box layout which acts as the backdrop for the modifier settings */
- box= uiLayoutBox(layout);
+ box = uiLayoutBox(layout);
/* draw settings for individual modifiers */
switch (fcm->type) {
@@ -729,7 +729,7 @@ void ANIM_uiTemplate_fmodifier_draw(uiLayout *layout, ID *id, ListBase *modifier
col = uiLayoutColumn(box, 1);
/* top row: use restricted range */
- row= uiLayoutRow(col, 1);
+ row = uiLayoutRow(col, 1);
uiItemR(row, &ptr, "use_restricted_range", 0, NULL, ICON_NONE);
if (fcm->flag & FMODIFIER_FLAG_RANGERESTRICT) {
@@ -822,7 +822,7 @@ short ANIM_fmodifiers_paste_from_buf(ListBase *modifiers, short replace)
free_fmodifiers(modifiers);
/* now copy over all the modifiers in the buffer to the end of the list */
- for (fcm= fmodifier_copypaste_buf.first; fcm; fcm= fcm->next) {
+ for (fcm = fmodifier_copypaste_buf.first; fcm; fcm = fcm->next) {
/* make a copy of it */
FModifier *fcmN = copy_fmodifier(fcm);
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c
index bcd0feb36cf..ec75ad1d07a 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -121,14 +121,14 @@ short ANIM_get_keyframing_flags(Scene *scene, short incl_mode)
/* Get (or add relevant data to be able to do so) the Active Action for the given
* Animation Data block, given an ID block where the Animation Data should reside.
*/
-bAction *verify_adt_action (ID *id, short add)
+bAction *verify_adt_action(ID *id, short add)
{
AnimData *adt;
/* init animdata if none available yet */
- adt= BKE_animdata_from_id(id);
+ adt = BKE_animdata_from_id(id);
if ((adt == NULL) && (add))
- adt= BKE_id_add_animdata(id);
+ adt = BKE_id_add_animdata(id);
if (adt == NULL) {
/* if still none (as not allowed to add, or ID doesn't have animdata for some reason) */
printf("ERROR: Couldn't add AnimData (ID = %s)\n", (id) ? (id->name) : "<None>");
@@ -138,9 +138,9 @@ bAction *verify_adt_action (ID *id, short add)
/* init action if none available yet */
// TODO: need some wizardry to handle NLA stuff correct
if ((adt->action == NULL) && (add)) {
- char actname[sizeof(id->name)-2];
- BLI_snprintf(actname, sizeof(actname), "%sAction", id->name+2);
- adt->action= add_empty_action(actname);
+ char actname[sizeof(id->name) - 2];
+ BLI_snprintf(actname, sizeof(actname), "%sAction", id->name + 2);
+ adt->action = add_empty_action(actname);
}
/* return the action */
@@ -150,7 +150,7 @@ bAction *verify_adt_action (ID *id, short add)
/* Get (or add relevant data to be able to do so) F-Curve from the Active Action,
* for the given Animation Data block. This assumes that all the destinations are valid.
*/
-FCurve *verify_fcurve (bAction *act, const char group[], const char rna_path[], const int array_index, short add)
+FCurve *verify_fcurve(bAction *act, const char group[], const char rna_path[], const int array_index, short add)
{
bActionGroup *grp;
FCurve *fcu;
@@ -164,30 +164,30 @@ FCurve *verify_fcurve (bAction *act, const char group[], const char rna_path[],
* TODO: add auto-grouping support? how this works will need to be resolved
*/
if (act)
- fcu= list_find_fcurve(&act->curves, rna_path, array_index);
+ fcu = list_find_fcurve(&act->curves, rna_path, array_index);
else
- fcu= NULL;
+ fcu = NULL;
if ((fcu == NULL) && (add)) {
/* use default settings to make a F-Curve */
- fcu= MEM_callocN(sizeof(FCurve), "FCurve");
+ fcu = MEM_callocN(sizeof(FCurve), "FCurve");
- fcu->flag = (FCURVE_VISIBLE|FCURVE_SELECTED);
- if (act->curves.first==NULL)
- fcu->flag |= FCURVE_ACTIVE; /* first one added active */
+ fcu->flag = (FCURVE_VISIBLE | FCURVE_SELECTED);
+ if (act->curves.first == NULL)
+ fcu->flag |= FCURVE_ACTIVE; /* first one added active */
/* store path - make copy, and store that */
- fcu->rna_path= BLI_strdupn(rna_path, strlen(rna_path));
- fcu->array_index= array_index;
+ fcu->rna_path = BLI_strdupn(rna_path, strlen(rna_path));
+ fcu->array_index = array_index;
/* if a group name has been provided, try to add or find a group, then add F-Curve to it */
if (group) {
/* try to find group */
- grp= BKE_action_group_find_name(act, group);
+ grp = BKE_action_group_find_name(act, group);
/* no matching groups, so add one */
if (grp == NULL)
- grp= action_groups_add_new(act, group);
+ grp = action_groups_add_new(act, group);
/* add F-Curve to group */
action_groups_add_channel(act, grp, fcu);
@@ -212,11 +212,11 @@ FCurve *verify_fcurve (bAction *act, const char group[], const char rna_path[],
* suitable place in chronological order.
*
* NOTE: any recalculate of the F-Curve that needs to be done will need to
- * be done by the caller.
+ * be done by the caller.
*/
int insert_bezt_fcurve(FCurve *fcu, BezTriple *bezt, short flag)
{
- int i= 0;
+ int i = 0;
/* are there already keyframes? */
if (fcu->bezt) {
@@ -228,17 +228,17 @@ int insert_bezt_fcurve(FCurve *fcu, BezTriple *bezt, short flag)
/* sanity check: 'i' may in rare cases exceed arraylen */
if ((i >= 0) && (i < fcu->totvert)) {
/* just change the values when replacing, so as to not overwrite handles */
- BezTriple *dst= (fcu->bezt + i);
- float dy= bezt->vec[1][1] - dst->vec[1][1];
+ BezTriple *dst = (fcu->bezt + i);
+ float dy = bezt->vec[1][1] - dst->vec[1][1];
/* just apply delta value change to the handle values */
dst->vec[0][1] += dy;
dst->vec[1][1] += dy;
dst->vec[2][1] += dy;
- dst->f1= bezt->f1;
- dst->f2= bezt->f2;
- dst->f3= bezt->f3;
+ dst->f1 = bezt->f1;
+ dst->f2 = bezt->f2;
+ dst->f3 = bezt->f3;
// TODO: perform some other operations?
}
@@ -246,22 +246,22 @@ int insert_bezt_fcurve(FCurve *fcu, BezTriple *bezt, short flag)
/* keyframing modes allow to not replace keyframe */
else if ((flag & INSERTKEY_REPLACE) == 0) {
/* insert new - if we're not restricted to replacing keyframes only */
- BezTriple *newb= MEM_callocN((fcu->totvert+1)*sizeof(BezTriple), "beztriple");
+ BezTriple *newb = MEM_callocN((fcu->totvert + 1) * sizeof(BezTriple), "beztriple");
/* add the beztriples that should occur before the beztriple to be pasted (originally in fcu) */
if (i > 0)
- memcpy(newb, fcu->bezt, i*sizeof(BezTriple));
+ memcpy(newb, fcu->bezt, i * sizeof(BezTriple));
/* add beztriple to paste at index i */
- *(newb + i)= *bezt;
+ *(newb + i) = *bezt;
/* add the beztriples that occur after the beztriple to be pasted (originally in fcu) */
if (i < fcu->totvert)
- memcpy(newb+i+1, fcu->bezt+i, (fcu->totvert-i)*sizeof(BezTriple));
+ memcpy(newb + i + 1, fcu->bezt + i, (fcu->totvert - i) * sizeof(BezTriple));
/* replace (+ free) old with new, only if necessary to do so */
MEM_freeN(fcu->bezt);
- fcu->bezt= newb;
+ fcu->bezt = newb;
fcu->totvert++;
}
@@ -272,11 +272,11 @@ int insert_bezt_fcurve(FCurve *fcu, BezTriple *bezt, short flag)
* // NOTE: maybe we may want to allow this later when doing samples -> bezt conversions,
* // but for now, having both is asking for trouble
*/
- else if ((flag & INSERTKEY_REPLACE)==0 && (fcu->fpt==NULL)) {
+ else if ((flag & INSERTKEY_REPLACE) == 0 && (fcu->fpt == NULL)) {
/* create new keyframes array */
- fcu->bezt= MEM_callocN(sizeof(BezTriple), "beztriple");
- *(fcu->bezt)= *bezt;
- fcu->totvert= 1;
+ fcu->bezt = MEM_callocN(sizeof(BezTriple), "beztriple");
+ *(fcu->bezt) = *bezt;
+ fcu->totvert = 1;
}
/* cannot add anything */
else {
@@ -297,25 +297,25 @@ int insert_bezt_fcurve(FCurve *fcu, BezTriple *bezt, short flag)
*/
int insert_vert_fcurve(FCurve *fcu, float x, float y, short flag)
{
- BezTriple beztr= {{{0}}};
+ BezTriple beztr = {{{0}}};
unsigned int oldTot = fcu->totvert;
int a;
/* set all three points, for nicer start position
* NOTE: +/- 1 on vec.x for left and right handles is so that 'free' handles work ok...
*/
- beztr.vec[0][0]= x-1.0f;
- beztr.vec[0][1]= y;
- beztr.vec[1][0]= x;
- beztr.vec[1][1]= y;
- beztr.vec[2][0]= x+1.0f;
- beztr.vec[2][1]= y;
- beztr.f1= beztr.f2= beztr.f3= SELECT;
- beztr.h1= beztr.h2= U.keyhandles_new; /* use default handle type here */
+ beztr.vec[0][0] = x - 1.0f;
+ beztr.vec[0][1] = y;
+ beztr.vec[1][0] = x;
+ beztr.vec[1][1] = y;
+ beztr.vec[2][0] = x + 1.0f;
+ beztr.vec[2][1] = y;
+ beztr.f1 = beztr.f2 = beztr.f3 = SELECT;
+ beztr.h1 = beztr.h2 = U.keyhandles_new; /* use default handle type here */
//BEZKEYTYPE(&beztr)= scene->keytype; /* default keyframe type */
/* use default interpolation mode, with exceptions for int/discrete values */
- beztr.ipo= U.ipo_new;
+ beztr.ipo = U.ipo_new;
if (fcu->flag & FCURVE_DISCRETE_VALUES)
beztr.ipo = BEZT_IPO_CONST;
@@ -323,7 +323,7 @@ int insert_vert_fcurve(FCurve *fcu, float x, float y, short flag)
beztr.ipo = BEZT_IPO_LIN;
/* add temp beztriple to keyframes */
- a= insert_bezt_fcurve(fcu, &beztr, flag);
+ a = insert_bezt_fcurve(fcu, &beztr, flag);
/* what if 'a' is a negative index?
* for now, just exit to prevent any segfaults
@@ -338,18 +338,18 @@ int insert_vert_fcurve(FCurve *fcu, float x, float y, short flag)
calchandles_fcurve(fcu);
/* set handletype and interpolation */
- if ((fcu->totvert > 2) && (flag & INSERTKEY_REPLACE)==0) {
- BezTriple *bezt= (fcu->bezt + a);
+ if ((fcu->totvert > 2) && (flag & INSERTKEY_REPLACE) == 0) {
+ BezTriple *bezt = (fcu->bezt + a);
/* set interpolation from previous (if available), but only if we didn't just replace some keyframe
- * - replacement is indicated by no-change in number of verts
+ * - replacement is indicated by no-change in number of verts
* - when replacing, the user may have specified some interpolation that should be kept
*/
if (fcu->totvert > oldTot) {
if (a > 0)
- bezt->ipo= (bezt-1)->ipo;
- else if (a < fcu->totvert-1)
- bezt->ipo= (bezt+1)->ipo;
+ bezt->ipo = (bezt - 1)->ipo;
+ else if (a < fcu->totvert - 1)
+ bezt->ipo = (bezt + 1)->ipo;
}
/* don't recalculate handles if fast is set
@@ -379,33 +379,33 @@ enum {
* 2. Keyframe to be added on frame where two keyframes are already situated
* 3. Keyframe lies at point that intersects the linear line between two keyframes
*/
-static short new_key_needed (FCurve *fcu, float cFrame, float nValue)
+static short new_key_needed(FCurve *fcu, float cFrame, float nValue)
{
- BezTriple *bezt=NULL, *prev=NULL;
+ BezTriple *bezt = NULL, *prev = NULL;
int totCount, i;
float valA = 0.0f, valB = 0.0f;
/* safety checking */
if (fcu == NULL) return KEYNEEDED_JUSTADD;
- totCount= fcu->totvert;
+ totCount = fcu->totvert;
if (totCount == 0) return KEYNEEDED_JUSTADD;
/* loop through checking if any are the same */
- bezt= fcu->bezt;
- for (i=0; i<totCount; i++) {
- float prevPosi=0.0f, prevVal=0.0f;
- float beztPosi=0.0f, beztVal=0.0f;
+ bezt = fcu->bezt;
+ for (i = 0; i < totCount; i++) {
+ float prevPosi = 0.0f, prevVal = 0.0f;
+ float beztPosi = 0.0f, beztVal = 0.0f;
/* get current time+value */
- beztPosi= bezt->vec[1][0];
- beztVal= bezt->vec[1][1];
+ beztPosi = bezt->vec[1][0];
+ beztVal = bezt->vec[1][1];
if (prev) {
/* there is a keyframe before the one currently being examined */
/* get previous time+value */
- prevPosi= prev->vec[1][0];
- prevVal= prev->vec[1][1];
+ prevPosi = prev->vec[1][0];
+ prevVal = prev->vec[1][1];
/* keyframe to be added at point where there are already two similar points? */
if (IS_EQF(prevPosi, cFrame) && IS_EQF(beztPosi, cFrame) && IS_EQF(beztPosi, prevPosi)) {
@@ -422,7 +422,7 @@ static short new_key_needed (FCurve *fcu, float cFrame, float nValue)
float realVal;
/* get real value of curve at that point */
- realVal= evaluate_fcurve(fcu, cFrame);
+ realVal = evaluate_fcurve(fcu, cFrame);
/* compare whether it's the same as proposed */
if (IS_EQF(realVal, nValue))
@@ -448,13 +448,13 @@ static short new_key_needed (FCurve *fcu, float cFrame, float nValue)
/* just add a keyframe if there's only one keyframe
* and the new one occurs before the existing one does.
*/
- if ((cFrame < beztPosi) && (totCount==1))
+ if ((cFrame < beztPosi) && (totCount == 1))
return KEYNEEDED_JUSTADD;
}
/* continue. frame to do not yet passed (or other conditions not met) */
- if (i < (totCount-1)) {
- prev= bezt;
+ if (i < (totCount - 1)) {
+ prev = bezt;
bezt++;
}
else
@@ -468,13 +468,13 @@ static short new_key_needed (FCurve *fcu, float cFrame, float nValue)
* -> Otherwise, a keyframe is just added. 1.0 is added so that fake-2nd-to-last
* keyframe is not equal to last keyframe.
*/
- bezt= (fcu->bezt + (fcu->totvert - 1));
- valA= bezt->vec[1][1];
+ bezt = (fcu->bezt + (fcu->totvert - 1));
+ valA = bezt->vec[1][1];
if (prev)
- valB= prev->vec[1][1];
+ valB = prev->vec[1][1];
else
- valB= bezt->vec[1][1] + 1.0f;
+ valB = bezt->vec[1][1] + 1.0f;
if (IS_EQF(valA, nValue) && IS_EQF(valA, valB))
return KEYNEEDED_DELPREV;
@@ -485,31 +485,31 @@ static short new_key_needed (FCurve *fcu, float cFrame, float nValue)
/* ------------------ RNA Data-Access Functions ------------------ */
/* Try to read value using RNA-properties obtained already */
-static float setting_get_rna_value (PointerRNA *ptr, PropertyRNA *prop, int index)
+static float setting_get_rna_value(PointerRNA *ptr, PropertyRNA *prop, int index)
{
- float value= 0.0f;
+ float value = 0.0f;
switch (RNA_property_type(prop)) {
case PROP_BOOLEAN:
if (RNA_property_array_length(ptr, prop))
- value= (float)RNA_property_boolean_get_index(ptr, prop, index);
+ value = (float)RNA_property_boolean_get_index(ptr, prop, index);
else
- value= (float)RNA_property_boolean_get(ptr, prop);
+ value = (float)RNA_property_boolean_get(ptr, prop);
break;
case PROP_INT:
if (RNA_property_array_length(ptr, prop))
- value= (float)RNA_property_int_get_index(ptr, prop, index);
+ value = (float)RNA_property_int_get_index(ptr, prop, index);
else
- value= (float)RNA_property_int_get(ptr, prop);
+ value = (float)RNA_property_int_get(ptr, prop);
break;
case PROP_FLOAT:
if (RNA_property_array_length(ptr, prop))
- value= RNA_property_float_get_index(ptr, prop, index);
+ value = RNA_property_float_get_index(ptr, prop, index);
else
- value= RNA_property_float_get(ptr, prop);
+ value = RNA_property_float_get(ptr, prop);
break;
case PROP_ENUM:
- value= (float)RNA_property_enum_get(ptr, prop);
+ value = (float)RNA_property_enum_get(ptr, prop);
break;
default:
break;
@@ -534,12 +534,12 @@ enum {
* blocktypes, when using "standard" keying but 'Visual Keying' option in Auto-Keying
* settings is on.
*/
-static short visualkey_can_use (PointerRNA *ptr, PropertyRNA *prop)
+static short visualkey_can_use(PointerRNA *ptr, PropertyRNA *prop)
{
- bConstraint *con= NULL;
- short searchtype= VISUALKEY_NONE;
+ bConstraint *con = NULL;
+ short searchtype = VISUALKEY_NONE;
short has_parent = FALSE;
- const char *identifier= NULL;
+ const char *identifier = NULL;
/* validate data */
// TODO: this check is probably not needed, but it won't hurt
@@ -547,25 +547,25 @@ static short visualkey_can_use (PointerRNA *ptr, PropertyRNA *prop)
return 0;
/* get first constraint and determine type of keyframe constraints to check for
- * - constraints can be on either Objects or PoseChannels, so we only check if the
+ * - constraints can be on either Objects or PoseChannels, so we only check if the
* ptr->type is RNA_Object or RNA_PoseBone, which are the RNA wrapping-info for
* those structs, allowing us to identify the owner of the data
*/
if (ptr->type == &RNA_Object) {
/* Object */
- Object *ob= (Object *)ptr->data;
+ Object *ob = (Object *)ptr->data;
- con= ob->constraints.first;
- identifier= RNA_property_identifier(prop);
- has_parent= (ob->parent != NULL);
+ con = ob->constraints.first;
+ identifier = RNA_property_identifier(prop);
+ has_parent = (ob->parent != NULL);
}
else if (ptr->type == &RNA_PoseBone) {
/* Pose Channel */
- bPoseChannel *pchan= (bPoseChannel *)ptr->data;
+ bPoseChannel *pchan = (bPoseChannel *)ptr->data;
- con= pchan->constraints.first;
- identifier= RNA_property_identifier(prop);
- has_parent= (pchan->parent != NULL);
+ con = pchan->constraints.first;
+ identifier = RNA_property_identifier(prop);
+ has_parent = (pchan->parent != NULL);
}
/* check if any data to search using */
@@ -578,10 +578,10 @@ static short visualkey_can_use (PointerRNA *ptr, PropertyRNA *prop)
return 0;
}
else if (strstr(identifier, "location")) {
- searchtype= VISUALKEY_LOC;
+ searchtype = VISUALKEY_LOC;
}
else if (strstr(identifier, "rotation")) {
- searchtype= VISUALKEY_ROT;
+ searchtype = VISUALKEY_ROT;
}
else {
printf("%s failed: identifier - '%s'\n", __func__, identifier);
@@ -596,7 +596,7 @@ static short visualkey_can_use (PointerRNA *ptr, PropertyRNA *prop)
return 1;
/* constraints */
- for (; con; con= con->next) {
+ for (; con; con = con->next) {
/* only consider constraint if it is not disabled, and has influence */
if (con->flag & CONSTRAINT_DISABLE) continue;
if (con->enforce == 0.0f) continue;
@@ -616,28 +616,28 @@ static short visualkey_can_use (PointerRNA *ptr, PropertyRNA *prop)
/* single-transform constraits */
case CONSTRAINT_TYPE_TRACKTO:
- if (searchtype==VISUALKEY_ROT) return 1;
+ if (searchtype == VISUALKEY_ROT) return 1;
break;
case CONSTRAINT_TYPE_ROTLIMIT:
- if (searchtype==VISUALKEY_ROT) return 1;
+ if (searchtype == VISUALKEY_ROT) return 1;
break;
case CONSTRAINT_TYPE_LOCLIMIT:
- if (searchtype==VISUALKEY_LOC) return 1;
+ if (searchtype == VISUALKEY_LOC) return 1;
break;
case CONSTRAINT_TYPE_ROTLIKE:
- if (searchtype==VISUALKEY_ROT) return 1;
+ if (searchtype == VISUALKEY_ROT) return 1;
break;
case CONSTRAINT_TYPE_DISTLIMIT:
- if (searchtype==VISUALKEY_LOC) return 1;
+ if (searchtype == VISUALKEY_LOC) return 1;
break;
case CONSTRAINT_TYPE_LOCLIKE:
- if (searchtype==VISUALKEY_LOC) return 1;
+ if (searchtype == VISUALKEY_LOC) return 1;
break;
case CONSTRAINT_TYPE_LOCKTRACK:
- if (searchtype==VISUALKEY_ROT) return 1;
+ if (searchtype == VISUALKEY_ROT) return 1;
break;
case CONSTRAINT_TYPE_MINMAX:
- if (searchtype==VISUALKEY_LOC) return 1;
+ if (searchtype == VISUALKEY_LOC) return 1;
break;
default:
@@ -654,18 +654,18 @@ static short visualkey_can_use (PointerRNA *ptr, PropertyRNA *prop)
* In the event that it is not possible to perform visual keying, try to fall-back
* to using the default method. Assumes that all data it has been passed is valid.
*/
-static float visualkey_get_value (PointerRNA *ptr, PropertyRNA *prop, int array_index)
+static float visualkey_get_value(PointerRNA *ptr, PropertyRNA *prop, int array_index)
{
- const char *identifier= RNA_property_identifier(prop);
+ const char *identifier = RNA_property_identifier(prop);
/* handle for Objects or PoseChannels only
- * - constraints can be on either Objects or PoseChannels, so we only check if the
+ * - constraints can be on either Objects or PoseChannels, so we only check if the
* ptr->type is RNA_Object or RNA_PoseBone, which are the RNA wrapping-info for
- * those structs, allowing us to identify the owner of the data
+ * those structs, allowing us to identify the owner of the data
* - assume that array_index will be sane
*/
if (ptr->type == &RNA_Object) {
- Object *ob= (Object *)ptr->data;
+ Object *ob = (Object *)ptr->data;
/* only Location or Rotation keyframes are supported now */
if (strstr(identifier, "location")) {
@@ -699,7 +699,7 @@ static float visualkey_get_value (PointerRNA *ptr, PropertyRNA *prop, int array_
}
else if (ptr->type == &RNA_PoseBone) {
Object *ob = (Object *)ptr->id.data; /* we assume that this is always set, and is an object */
- bPoseChannel *pchan= (bPoseChannel *)ptr->data;
+ bPoseChannel *pchan = (bPoseChannel *)ptr->data;
float tmat[4][4];
/* Although it is not strictly required for this particular space conversion,
@@ -752,7 +752,7 @@ static float visualkey_get_value (PointerRNA *ptr, PropertyRNA *prop, int array_
/* ------------------------- Insert Key API ------------------------- */
/* Secondary Keyframing API call:
- * Use this when validation of necessary animation data is not necessary, since an RNA-pointer to the necessary
+ * Use this when validation of necessary animation data is not necessary, since an RNA-pointer to the necessary
* data being keyframed, and a pointer to the F-Curve to use have both been provided.
*
* The flag argument is used for special settings that alter the behavior of
@@ -761,7 +761,7 @@ static float visualkey_get_value (PointerRNA *ptr, PropertyRNA *prop, int array_
*/
short insert_keyframe_direct(ReportList *reports, PointerRNA ptr, PropertyRNA *prop, FCurve *fcu, float cfra, short flag)
{
- float curval= 0.0f;
+ float curval = 0.0f;
/* no F-Curve to add keyframe to? */
if (fcu == NULL) {
@@ -771,13 +771,13 @@ short insert_keyframe_direct(ReportList *reports, PointerRNA ptr, PropertyRNA *p
/* F-Curve not editable? */
if (fcurve_is_keyframable(fcu) == 0) {
BKE_reportf(reports, RPT_ERROR,
- "F-Curve with path = '%s' [%d] cannot be keyframed. Ensure that it is not locked or sampled. Also, try removing F-Modifiers",
- fcu->rna_path, fcu->array_index);
+ "F-Curve with path = '%s' [%d] cannot be keyframed. Ensure that it is not locked or sampled. Also, try removing F-Modifiers",
+ fcu->rna_path, fcu->array_index);
return 0;
}
/* if no property given yet, try to validate from F-Curve info */
- if ((ptr.id.data == NULL) && (ptr.data==NULL)) {
+ if ((ptr.id.data == NULL) && (ptr.data == NULL)) {
BKE_report(reports, RPT_ERROR, "No RNA-pointer available to retrieve values for keyframing from");
return 0;
}
@@ -787,21 +787,21 @@ short insert_keyframe_direct(ReportList *reports, PointerRNA ptr, PropertyRNA *p
/* try to get property we should be affecting */
if ((RNA_path_resolve(&ptr, fcu->rna_path, &tmp_ptr, &prop) == 0) || (prop == NULL)) {
/* property not found... */
- const char *idname= (ptr.id.data) ? ((ID *)ptr.id.data)->name : "<No ID-Pointer>";
+ const char *idname = (ptr.id.data) ? ((ID *)ptr.id.data)->name : "<No ID-Pointer>";
BKE_reportf(reports, RPT_ERROR,
- "Could not insert keyframe, as RNA Path is invalid for the given ID (ID = %s, Path = %s)",
- idname, fcu->rna_path);
+ "Could not insert keyframe, as RNA Path is invalid for the given ID (ID = %s, Path = %s)",
+ idname, fcu->rna_path);
return 0;
}
else {
/* property found, so overwrite 'ptr' to make later code easier */
- ptr= tmp_ptr;
+ ptr = tmp_ptr;
}
}
/* set additional flags for the F-Curve (i.e. only integer values) */
- fcu->flag &= ~(FCURVE_INT_VALUES|FCURVE_DISCRETE_VALUES);
+ fcu->flag &= ~(FCURVE_INT_VALUES | FCURVE_DISCRETE_VALUES);
switch (RNA_property_type(prop)) {
case PROP_FLOAT:
/* do nothing */
@@ -815,23 +815,23 @@ short insert_keyframe_direct(ReportList *reports, PointerRNA ptr, PropertyRNA *p
* values at all) interpolation between all points
* - however, we must also ensure that evaluated values are only integers still
*/
- fcu->flag |= (FCURVE_DISCRETE_VALUES|FCURVE_INT_VALUES);
+ fcu->flag |= (FCURVE_DISCRETE_VALUES | FCURVE_INT_VALUES);
break;
}
/* obtain value to give keyframe */
if ( (flag & INSERTKEY_MATRIX) &&
- (visualkey_can_use(&ptr, prop)) )
+ (visualkey_can_use(&ptr, prop)) )
{
/* visual-keying is only available for object and pchan datablocks, as
* it works by keyframing using a value extracted from the final matrix
* instead of using the kt system to extract a value.
*/
- curval= visualkey_get_value(&ptr, prop, fcu->array_index);
+ curval = visualkey_get_value(&ptr, prop, fcu->array_index);
}
else {
/* read value from system */
- curval= setting_get_rna_value(&ptr, prop, fcu->array_index);
+ curval = setting_get_rna_value(&ptr, prop, fcu->array_index);
}
/* only insert keyframes where they are needed */
@@ -839,7 +839,7 @@ short insert_keyframe_direct(ReportList *reports, PointerRNA ptr, PropertyRNA *p
short insert_mode;
/* check whether this curve really needs a new keyframe */
- insert_mode= new_key_needed(fcu, cfra, curval);
+ insert_mode = new_key_needed(fcu, cfra, curval);
/* insert new keyframe at current frame */
if (insert_mode)
@@ -848,7 +848,7 @@ short insert_keyframe_direct(ReportList *reports, PointerRNA ptr, PropertyRNA *p
/* delete keyframe immediately before/after newly added */
switch (insert_mode) {
case KEYNEEDED_DELPREV:
- delete_fcurve_key(fcu, fcu->totvert-2, 1);
+ delete_fcurve_key(fcu, fcu->totvert - 2, 1);
break;
case KEYNEEDED_DELNEXT:
delete_fcurve_key(fcu, 1, 1);
@@ -885,8 +885,8 @@ short insert_keyframe(ReportList *reports, ID *id, bAction *act, const char grou
PointerRNA id_ptr, ptr;
PropertyRNA *prop = NULL;
FCurve *fcu;
- int array_index_max= array_index+1;
- int ret= 0;
+ int array_index_max = array_index + 1;
+ int ret = 0;
/* validate pointer first - exit if failure */
if (id == NULL) {
@@ -897,33 +897,33 @@ short insert_keyframe(ReportList *reports, ID *id, bAction *act, const char grou
RNA_id_pointer_create(id, &id_ptr);
if ((RNA_path_resolve(&id_ptr, rna_path, &ptr, &prop) == 0) || (prop == NULL)) {
BKE_reportf(reports, RPT_ERROR,
- "Could not insert keyframe, as RNA Path is invalid for the given ID (ID = %s, Path = %s)",
- (id)? id->name : "<Missing ID-Block>", rna_path);
+ "Could not insert keyframe, as RNA Path is invalid for the given ID (ID = %s, Path = %s)",
+ (id) ? id->name : "<Missing ID-Block>", rna_path);
return 0;
}
/* if no action is provided, keyframe to the default one attached to this ID-block */
if (act == NULL) {
- AnimData *adt= BKE_animdata_from_id(id);
+ AnimData *adt = BKE_animdata_from_id(id);
/* get action to add F-Curve+keyframe to */
- act= verify_adt_action(id, 1);
+ act = verify_adt_action(id, 1);
if (act == NULL) {
BKE_reportf(reports, RPT_ERROR,
- "Could not insert keyframe, as this type does not support animation data (ID = %s, Path = %s)",
- id->name, rna_path);
+ "Could not insert keyframe, as this type does not support animation data (ID = %s, Path = %s)",
+ id->name, rna_path);
return 0;
}
/* apply NLA-mapping to frame to use (if applicable) */
- cfra= BKE_nla_tweakedit_remap(adt, cfra, NLATIME_CONVERT_UNMAP);
+ cfra = BKE_nla_tweakedit_remap(adt, cfra, NLATIME_CONVERT_UNMAP);
}
/* key entire array convenience method */
if (array_index == -1) {
- array_index= 0;
- array_index_max= RNA_property_array_length(&ptr, prop);
+ array_index = 0;
+ array_index_max = RNA_property_array_length(&ptr, prop);
/* for single properties, increase max_index so that the property itself gets included,
* but don't do this for standard arrays since that can cause corruption issues
@@ -939,7 +939,7 @@ short insert_keyframe(ReportList *reports, ID *id, bAction *act, const char grou
* - if we're replacing keyframes only, DO NOT create new F-Curves if they do not exist yet
* but still try to get the F-Curve if it exists...
*/
- fcu= verify_fcurve(act, group, rna_path, array_index, (flag & INSERTKEY_REPLACE)==0);
+ fcu = verify_fcurve(act, group, rna_path, array_index, (flag & INSERTKEY_REPLACE) == 0);
/* we may not have a F-Curve when we're replacing only... */
if (fcu) {
@@ -949,7 +949,7 @@ short insert_keyframe(ReportList *reports, ID *id, bAction *act, const char grou
* is determined by the array index for the F-Curve
*/
if (ELEM5(RNA_property_subtype(prop), PROP_TRANSLATION, PROP_XYZ, PROP_EULER, PROP_COLOR, PROP_COORDS)) {
- fcu->color_mode= FCURVE_COLOR_AUTO_RGB;
+ fcu->color_mode = FCURVE_COLOR_AUTO_RGB;
}
}
@@ -973,11 +973,11 @@ short insert_keyframe(ReportList *reports, ID *id, bAction *act, const char grou
*/
short delete_keyframe(ReportList *reports, ID *id, bAction *act, const char group[], const char rna_path[], int array_index, float cfra, short UNUSED(flag))
{
- AnimData *adt= BKE_animdata_from_id(id);
+ AnimData *adt = BKE_animdata_from_id(id);
PointerRNA id_ptr, ptr;
PropertyRNA *prop;
- int array_index_max= array_index+1;
- int ret= 0;
+ int array_index_max = array_index + 1;
+ int ret = 0;
/* sanity checks */
if (ELEM(NULL, id, adt)) {
@@ -994,17 +994,17 @@ short delete_keyframe(ReportList *reports, ID *id, bAction *act, const char grou
/* get F-Curve
* Note: here is one of the places where we don't want new Action + F-Curve added!
- * so 'add' var must be 0
+ * so 'add' var must be 0
*/
if (act == NULL) {
/* if no action is provided, use the default one attached to this ID-block
- * - if it doesn't exist, then we're out of options...
+ * - if it doesn't exist, then we're out of options...
*/
if (adt->action) {
- act= adt->action;
+ act = adt->action;
/* apply NLA-mapping to frame to use (if applicable) */
- cfra= BKE_nla_tweakedit_remap(adt, cfra, NLATIME_CONVERT_UNMAP);
+ cfra = BKE_nla_tweakedit_remap(adt, cfra, NLATIME_CONVERT_UNMAP);
}
else {
BKE_reportf(reports, RPT_ERROR, "No Action to delete keyframes from for ID = %s\n", id->name);
@@ -1014,8 +1014,8 @@ short delete_keyframe(ReportList *reports, ID *id, bAction *act, const char grou
/* key entire array convenience method */
if (array_index == -1) {
- array_index= 0;
- array_index_max= RNA_property_array_length(&ptr, prop);
+ array_index = 0;
+ array_index_max = RNA_property_array_length(&ptr, prop);
/* for single properties, increase max_index so that the property itself gets included,
* but don't do this for standard arrays since that can cause corruption issues
@@ -1027,7 +1027,7 @@ short delete_keyframe(ReportList *reports, ID *id, bAction *act, const char grou
/* will only loop once unless the array index was -1 */
for (; array_index < array_index_max; array_index++) {
- FCurve *fcu= verify_fcurve(act, group, rna_path, array_index, 0);
+ FCurve *fcu = verify_fcurve(act, group, rna_path, array_index, 0);
short found = -1;
int i;
@@ -1075,9 +1075,9 @@ enum {
*/
static int modify_key_op_poll(bContext *C)
{
- ScrArea *sa= CTX_wm_area(C);
- Scene *scene= CTX_data_scene(C);
- SpaceOops *so= CTX_wm_space_outliner(C);
+ ScrArea *sa = CTX_wm_area(C);
+ Scene *scene = CTX_data_scene(C);
+ SpaceOops *so = CTX_wm_space_outliner(C);
/* if no area or active scene */
if (ELEM(NULL, sa, scene))
@@ -1099,13 +1099,13 @@ static int modify_key_op_poll(bContext *C)
/* Insert Key Operator ------------------------ */
-static int insert_key_exec (bContext *C, wmOperator *op)
+static int insert_key_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
- KeyingSet *ks= NULL;
- int type= RNA_enum_get(op->ptr, "type");
- float cfra= (float)CFRA; // XXX for now, don't bother about all the yucky offset crap
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+ KeyingSet *ks = NULL;
+ int type = RNA_enum_get(op->ptr, "type");
+ float cfra = (float)CFRA; // XXX for now, don't bother about all the yucky offset crap
short success;
/* type is the Keying Set the user specified to use when calling the operator:
@@ -1114,11 +1114,11 @@ static int insert_key_exec (bContext *C, wmOperator *op)
* - type < 0: use a builtin Keying Set
*/
if (type == 0)
- type= scene->active_keyingset;
+ type = scene->active_keyingset;
if (type > 0)
- ks= BLI_findlink(&scene->keyingsets, type-1);
+ ks = BLI_findlink(&scene->keyingsets, type - 1);
else
- ks= BLI_findlink(&builtin_keyingsets, -type-1);
+ ks = BLI_findlink(&builtin_keyingsets, -type - 1);
/* report failures */
if (ks == NULL) {
@@ -1127,7 +1127,7 @@ static int insert_key_exec (bContext *C, wmOperator *op)
}
/* try to insert keyframes for the channels specified by KeyingSet */
- success= ANIM_apply_keyingset(C, NULL, NULL, ks, MODIFYKEY_MODE_INSERT, cfra);
+ success = ANIM_apply_keyingset(C, NULL, NULL, ks, MODIFYKEY_MODE_INSERT, cfra);
if (G.debug & G_DEBUG)
BKE_reportf(op->reports, RPT_INFO, "KeyingSet '%s' - Successfully added %d Keyframes\n", ks->name, success);
@@ -1142,7 +1142,7 @@ static int insert_key_exec (bContext *C, wmOperator *op)
BKE_reportf(op->reports, RPT_INFO, "Successfully added %d Keyframes for KeyingSet '%s'", success, ks->name);
/* send notifiers that keyframes have been changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
}
else
BKE_report(op->reports, RPT_WARNING, "Keying Set failed to insert any keyframes");
@@ -1167,10 +1167,10 @@ void ANIM_OT_keyframe_insert(wmOperatorType *ot)
ot->poll = modify_key_op_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* keyingset to use (dynamic enum) */
- prop= RNA_def_enum(ot->srna, "type", DummyRNA_DEFAULT_items, 0, "Keying Set", "The Keying Set to use");
+ prop = RNA_def_enum(ot->srna, "type", DummyRNA_DEFAULT_items, 0, "Keying Set", "The Keying Set to use");
RNA_def_enum_funcs(prop, ANIM_keying_sets_enum_itemf);
RNA_def_property_flag(prop, PROP_HIDDEN);
ot->prop = prop;
@@ -1178,8 +1178,8 @@ void ANIM_OT_keyframe_insert(wmOperatorType *ot)
/* confirm whether a keyframe was added by showing a popup
* - by default, this is enabled, since this operator is assumed to be called independently
*/
- prop= RNA_def_boolean(ot->srna, "confirm_success", 1, "Confirm Successful Insert",
- "Show a popup when the keyframes get successfully added");
+ prop = RNA_def_boolean(ot->srna, "confirm_success", 1, "Confirm Successful Insert",
+ "Show a popup when the keyframes get successfully added");
RNA_def_property_flag(prop, PROP_HIDDEN);
}
@@ -1188,9 +1188,9 @@ void ANIM_OT_keyframe_insert(wmOperatorType *ot)
* then calls the menu if necessary before
*/
-static int insert_key_menu_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED(event))
+static int insert_key_menu_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
- Scene *scene= CTX_data_scene(C);
+ Scene *scene = CTX_data_scene(C);
/* if prompting or no active Keying Set, show the menu */
if ((scene->active_keyingset == 0) || RNA_boolean_get(op->ptr, "always_prompt")) {
@@ -1229,10 +1229,10 @@ void ANIM_OT_keyframe_insert_menu(wmOperatorType *ot)
ot->poll = ED_operator_areaactive;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* keyingset to use (dynamic enum) */
- prop= RNA_def_enum(ot->srna, "type", DummyRNA_DEFAULT_items, 0, "Keying Set", "The Keying Set to use");
+ prop = RNA_def_enum(ot->srna, "type", DummyRNA_DEFAULT_items, 0, "Keying Set", "The Keying Set to use");
RNA_def_enum_funcs(prop, ANIM_keying_sets_enum_itemf);
RNA_def_property_flag(prop, PROP_HIDDEN);
ot->prop = prop;
@@ -1241,27 +1241,27 @@ void ANIM_OT_keyframe_insert_menu(wmOperatorType *ot)
* - by default, this is disabled so that if a menu is shown, this doesn't come up too
*/
// XXX should this just be always on?
- prop= RNA_def_boolean(ot->srna, "confirm_success", 0, "Confirm Successful Insert",
- "Show a popup when the keyframes get successfully added");
+ prop = RNA_def_boolean(ot->srna, "confirm_success", 0, "Confirm Successful Insert",
+ "Show a popup when the keyframes get successfully added");
RNA_def_property_flag(prop, PROP_HIDDEN);
/* whether the menu should always be shown
* - by default, the menu should only be shown when there is no active Keying Set (2.5 behavior),
* although in some cases it might be useful to always shown (pre 2.5 behavior)
*/
- prop= RNA_def_boolean(ot->srna, "always_prompt", 0, "Always Show Menu", "");
+ prop = RNA_def_boolean(ot->srna, "always_prompt", 0, "Always Show Menu", "");
RNA_def_property_flag(prop, PROP_HIDDEN);
}
/* Delete Key Operator ------------------------ */
-static int delete_key_exec (bContext *C, wmOperator *op)
+static int delete_key_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
- KeyingSet *ks= NULL;
- int type= RNA_enum_get(op->ptr, "type");
- float cfra= (float)CFRA; // XXX for now, don't bother about all the yucky offset crap
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+ KeyingSet *ks = NULL;
+ int type = RNA_enum_get(op->ptr, "type");
+ float cfra = (float)CFRA; // XXX for now, don't bother about all the yucky offset crap
short success;
/* type is the Keying Set the user specified to use when calling the operator:
@@ -1270,11 +1270,11 @@ static int delete_key_exec (bContext *C, wmOperator *op)
* - type < 0: use a builtin Keying Set
*/
if (type == 0)
- type= scene->active_keyingset;
+ type = scene->active_keyingset;
if (type > 0)
- ks= BLI_findlink(&scene->keyingsets, type-1);
+ ks = BLI_findlink(&scene->keyingsets, type - 1);
else
- ks= BLI_findlink(&builtin_keyingsets, -type-1);
+ ks = BLI_findlink(&builtin_keyingsets, -type - 1);
/* report failure */
if (ks == NULL) {
@@ -1283,7 +1283,7 @@ static int delete_key_exec (bContext *C, wmOperator *op)
}
/* try to delete keyframes for the channels specified by KeyingSet */
- success= ANIM_apply_keyingset(C, NULL, NULL, ks, MODIFYKEY_MODE_DELETE, cfra);
+ success = ANIM_apply_keyingset(C, NULL, NULL, ks, MODIFYKEY_MODE_DELETE, cfra);
if (G.debug & G_DEBUG)
printf("KeyingSet '%s' - Successfully removed %d Keyframes\n", ks->name, success);
@@ -1298,7 +1298,7 @@ static int delete_key_exec (bContext *C, wmOperator *op)
BKE_reportf(op->reports, RPT_INFO, "Successfully removed %d Keyframes for KeyingSet '%s'", success, ks->name);
/* send notifiers that keyframes have been changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
}
else
BKE_report(op->reports, RPT_WARNING, "Keying Set failed to remove any keyframes");
@@ -1323,10 +1323,10 @@ void ANIM_OT_keyframe_delete(wmOperatorType *ot)
ot->poll = modify_key_op_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* keyingset to use (dynamic enum) */
- prop= RNA_def_enum(ot->srna, "type", DummyRNA_DEFAULT_items, 0, "Keying Set", "The Keying Set to use");
+ prop = RNA_def_enum(ot->srna, "type", DummyRNA_DEFAULT_items, 0, "Keying Set", "The Keying Set to use");
RNA_def_enum_funcs(prop, ANIM_keying_sets_enum_itemf);
RNA_def_property_flag(prop, PROP_HIDDEN);
ot->prop = prop;
@@ -1346,31 +1346,31 @@ void ANIM_OT_keyframe_delete(wmOperatorType *ot)
* -- Joshua Leung, Jan 2009
*/
-static int delete_key_v3d_exec (bContext *C, wmOperator *op)
+static int delete_key_v3d_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
- float cfra= (float)CFRA; // XXX for now, don't bother about all the yucky offset crap
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+ float cfra = (float)CFRA; // XXX for now, don't bother about all the yucky offset crap
// XXX more comprehensive tests will be needed
- CTX_DATA_BEGIN (C, Object*, ob, selected_objects)
+ CTX_DATA_BEGIN(C, Object *, ob, selected_objects)
{
- ID *id= (ID *)ob;
+ ID *id = (ID *)ob;
FCurve *fcu, *fcn;
- short success= 0;
+ short success = 0;
/* loop through all curves in animdata and delete keys on this frame */
if ((ob->adt) && (ob->adt->action)) {
- AnimData *adt= ob->adt;
- bAction *act= adt->action;
+ AnimData *adt = ob->adt;
+ bAction *act = adt->action;
- for (fcu= act->curves.first; fcu; fcu= fcn) {
- fcn= fcu->next;
- success+= delete_keyframe(op->reports, id, NULL, NULL, fcu->rna_path, fcu->array_index, cfra, 0);
+ for (fcu = act->curves.first; fcu; fcu = fcn) {
+ fcn = fcu->next;
+ success += delete_keyframe(op->reports, id, NULL, NULL, fcu->rna_path, fcu->array_index, cfra, 0);
}
}
- BKE_reportf(op->reports, RPT_INFO, "Ob '%s' - Successfully had %d keyframes removed", id->name+2, success);
+ BKE_reportf(op->reports, RPT_INFO, "Ob '%s' - Successfully had %d keyframes removed", id->name + 2, success);
ob->recalc |= OB_RECALC_OB;
}
@@ -1379,7 +1379,7 @@ static int delete_key_v3d_exec (bContext *C, wmOperator *op)
/* send updates */
DAG_ids_flush_update(bmain, 0);
- WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, NULL);
+ WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, NULL);
return OPERATOR_FINISHED;
}
@@ -1398,22 +1398,22 @@ void ANIM_OT_keyframe_delete_v3d(wmOperatorType *ot)
ot->poll = ED_operator_areaactive;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* Insert Key Button Operator ------------------------ */
-static int insert_key_button_exec (bContext *C, wmOperator *op)
+static int insert_key_button_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
- PointerRNA ptr= {{NULL}};
- PropertyRNA *prop= NULL;
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+ PointerRNA ptr = {{NULL}};
+ PropertyRNA *prop = NULL;
char *path;
- float cfra= (float)CFRA; // XXX for now, don't bother about all the yucky offset crap
- short success= 0;
- int a, index, length, all= RNA_boolean_get(op->ptr, "all");
+ float cfra = (float)CFRA; // XXX for now, don't bother about all the yucky offset crap
+ short success = 0;
+ int a, index, length, all = RNA_boolean_get(op->ptr, "all");
short flag = 0;
/* flags for inserting keyframes */
@@ -1423,29 +1423,29 @@ static int insert_key_button_exec (bContext *C, wmOperator *op)
uiContextActiveProperty(C, &ptr, &prop, &index);
if ((ptr.id.data && ptr.data && prop) && RNA_property_animateable(&ptr, prop)) {
- path= RNA_path_from_ID_to_property(&ptr, prop);
+ path = RNA_path_from_ID_to_property(&ptr, prop);
if (path) {
if (all) {
- length= RNA_property_array_length(&ptr, prop);
+ length = RNA_property_array_length(&ptr, prop);
- if (length) index= 0;
- else length= 1;
+ if (length) index = 0;
+ else length = 1;
}
else
- length= 1;
+ length = 1;
- for (a=0; a<length; a++)
- success+= insert_keyframe(op->reports, ptr.id.data, NULL, NULL, path, index+a, cfra, flag);
+ for (a = 0; a < length; a++)
+ success += insert_keyframe(op->reports, ptr.id.data, NULL, NULL, path, index + a, cfra, flag);
MEM_freeN(path);
}
else if (ptr.type == &RNA_NlaStrip) {
/* handle special vars for NLA-strips */
- NlaStrip *strip= (NlaStrip *)ptr.data;
- FCurve *fcu= list_find_fcurve(&strip->fcurves, RNA_property_identifier(prop), flag);
+ NlaStrip *strip = (NlaStrip *)ptr.data;
+ FCurve *fcu = list_find_fcurve(&strip->fcurves, RNA_property_identifier(prop), flag);
- success+= insert_keyframe_direct(op->reports, ptr, prop, fcu, cfra, 0);
+ success += insert_keyframe_direct(op->reports, ptr, prop, fcu, cfra, 0);
}
else {
if (G.debug & G_DEBUG)
@@ -1468,10 +1468,10 @@ static int insert_key_button_exec (bContext *C, wmOperator *op)
DAG_ids_flush_update(bmain, 0);
/* send notifiers that keyframes have been changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
}
- return (success)? OPERATOR_FINISHED: OPERATOR_CANCELLED;
+ return (success) ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
}
void ANIM_OT_keyframe_insert_button(wmOperatorType *ot)
@@ -1494,35 +1494,35 @@ void ANIM_OT_keyframe_insert_button(wmOperatorType *ot)
/* Delete Key Button Operator ------------------------ */
-static int delete_key_button_exec (bContext *C, wmOperator *op)
+static int delete_key_button_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
- PointerRNA ptr= {{NULL}};
- PropertyRNA *prop= NULL;
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+ PointerRNA ptr = {{NULL}};
+ PropertyRNA *prop = NULL;
char *path;
- float cfra= (float)CFRA; // XXX for now, don't bother about all the yucky offset crap
- short success= 0;
- int a, index, length, all= RNA_boolean_get(op->ptr, "all");
+ float cfra = (float)CFRA; // XXX for now, don't bother about all the yucky offset crap
+ short success = 0;
+ int a, index, length, all = RNA_boolean_get(op->ptr, "all");
/* try to insert keyframe using property retrieved from UI */
uiContextActiveProperty(C, &ptr, &prop, &index);
if (ptr.id.data && ptr.data && prop) {
- path= RNA_path_from_ID_to_property(&ptr, prop);
+ path = RNA_path_from_ID_to_property(&ptr, prop);
if (path) {
if (all) {
- length= RNA_property_array_length(&ptr, prop);
+ length = RNA_property_array_length(&ptr, prop);
- if (length) index= 0;
- else length= 1;
+ if (length) index = 0;
+ else length = 1;
}
else
- length= 1;
+ length = 1;
- for (a=0; a<length; a++)
- success+= delete_keyframe(op->reports, ptr.id.data, NULL, NULL, path, index+a, cfra, 0);
+ for (a = 0; a < length; a++)
+ success += delete_keyframe(op->reports, ptr.id.data, NULL, NULL, path, index + a, cfra, 0);
MEM_freeN(path);
}
@@ -1541,10 +1541,10 @@ static int delete_key_button_exec (bContext *C, wmOperator *op)
DAG_ids_flush_update(bmain, 0);
/* send notifiers that keyframes have been changed */
- WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
}
- return (success)? OPERATOR_FINISHED: OPERATOR_CANCELLED;
+ return (success) ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
}
void ANIM_OT_keyframe_delete_button(wmOperatorType *ot)
@@ -1570,7 +1570,7 @@ void ANIM_OT_keyframe_delete_button(wmOperatorType *ot)
int autokeyframe_cfra_can_key(Scene *scene, ID *id)
{
- float cfra= (float)CFRA; // XXX for now, this will do
+ float cfra = (float)CFRA; // XXX for now, this will do
/* only filter if auto-key mode requires this */
if (IS_AUTOKEY_ON(scene) == 0)
@@ -1580,7 +1580,7 @@ int autokeyframe_cfra_can_key(Scene *scene, ID *id)
/* can insert anytime we like... */
return 1;
}
- else /* REPLACE */ {
+ else { /* REPLACE */
/* for whole block - only key if there's a keyframe on that frame already
* this is a valid assumption when we're blocking + tweaking
*/
@@ -1601,12 +1601,12 @@ short fcurve_frame_has_keyframe(FCurve *fcu, float frame, short filter)
return 0;
/* we either include all regardless of muting, or only non-muted */
- if ((filter & ANIMFILTER_KEYS_MUTED) || (fcu->flag & FCURVE_MUTED)==0) {
+ if ((filter & ANIMFILTER_KEYS_MUTED) || (fcu->flag & FCURVE_MUTED) == 0) {
short replace = -1;
int i = binarysearch_bezt_index(fcu->bezt, frame, fcu->totvert, &replace);
/* binarysearch_bezt_index will set replace to be 0 or 1
- * - obviously, 1 represents a match
+ * - obviously, 1 represents a match
*/
if (replace) {
/* sanity check: 'i' may in rare cases exceed arraylen */
@@ -1621,7 +1621,7 @@ short fcurve_frame_has_keyframe(FCurve *fcu, float frame, short filter)
/* Checks whether an Action has a keyframe for a given frame
* Since we're only concerned whether a keyframe exists, we can simply loop until a match is found...
*/
-static short action_frame_has_keyframe (bAction *act, float frame, short filter)
+static short action_frame_has_keyframe(bAction *act, float frame, short filter)
{
FCurve *fcu;
@@ -1636,7 +1636,7 @@ static short action_frame_has_keyframe (bAction *act, float frame, short filter)
/* loop over F-Curves, using binary-search to try to find matches
* - this assumes that keyframes are only beztriples
*/
- for (fcu= act->curves.first; fcu; fcu= fcu->next) {
+ for (fcu = act->curves.first; fcu; fcu = fcu->next) {
/* only check if there are keyframes (currently only of type BezTriple) */
if (fcu->bezt && fcu->totvert) {
if (fcurve_frame_has_keyframe(fcu, frame, filter))
@@ -1649,7 +1649,7 @@ static short action_frame_has_keyframe (bAction *act, float frame, short filter)
}
/* Checks whether an Object has a keyframe for a given frame */
-static short object_frame_has_keyframe (Object *ob, float frame, short filter)
+static short object_frame_has_keyframe(Object *ob, float frame, short filter)
{
/* error checking */
if (ob == NULL)
@@ -1662,26 +1662,26 @@ static short object_frame_has_keyframe (Object *ob, float frame, short filter)
}
/* try shapekey keyframes (if available, and allowed by filter) */
- if ( !(filter & ANIMFILTER_KEYS_LOCAL) && !(filter & ANIMFILTER_KEYS_NOSKEY) ) {
- Key *key= ob_get_key(ob);
+ if (!(filter & ANIMFILTER_KEYS_LOCAL) && !(filter & ANIMFILTER_KEYS_NOSKEY) ) {
+ Key *key = ob_get_key(ob);
/* shapekeys can have keyframes ('Relative Shape Keys')
* or depend on time (old 'Absolute Shape Keys')
*/
- /* 1. test for relative (with keyframes) */
+ /* 1. test for relative (with keyframes) */
if (id_frame_has_keyframe((ID *)key, frame, filter))
return 1;
- /* 2. test for time */
+ /* 2. test for time */
// TODO... yet to be implemented (this feature may evolve before then anyway)
}
/* try materials */
- if ( !(filter & ANIMFILTER_KEYS_LOCAL) && !(filter & ANIMFILTER_KEYS_NOMAT) ) {
+ if (!(filter & ANIMFILTER_KEYS_LOCAL) && !(filter & ANIMFILTER_KEYS_NOMAT) ) {
/* if only active, then we can skip a lot of looping */
if (filter & ANIMFILTER_KEYS_ACTIVE) {
- Material *ma= give_current_material(ob, (ob->actcol + 1));
+ Material *ma = give_current_material(ob, (ob->actcol + 1));
/* we only retrieve the active material... */
if (id_frame_has_keyframe((ID *)ma, frame, filter))
@@ -1691,8 +1691,8 @@ static short object_frame_has_keyframe (Object *ob, float frame, short filter)
int a;
/* loop over materials */
- for (a=0; a<ob->totcol; a++) {
- Material *ma= give_current_material(ob, a+1);
+ for (a = 0; a < ob->totcol; a++) {
+ Material *ma = give_current_material(ob, a + 1);
if (id_frame_has_keyframe((ID *)ma, frame, filter))
return 1;
@@ -1723,15 +1723,15 @@ short id_frame_has_keyframe(ID *id, float frame, short filter)
// XXX TODO... for now, just use 'normal' behavior
// break;
- default: /* 'normal type' */
+ default: /* 'normal type' */
{
- AnimData *adt= BKE_animdata_from_id(id);
+ AnimData *adt = BKE_animdata_from_id(id);
/* only check keyframes in active action */
if (adt)
return action_frame_has_keyframe(adt->action, frame, filter);
}
- break;
+ break;
}
diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c
index 05dc2d1c04e..83f6b1d1824 100644
--- a/source/blender/editors/curve/editfont.c
+++ b/source/blender/editors/curve/editfont.c
@@ -74,135 +74,135 @@
#include "curve_intern.h"
-#define MAXTEXT 32766
+#define MAXTEXT 32766
/************************* utilities ******************************/
static char findaccent(char char1, unsigned int code)
{
- char new= 0;
-
- if (char1=='a') {
- if (code=='`') new= 224;
- else if (code==39) new= 225;
- else if (code=='^') new= 226;
- else if (code=='~') new= 227;
- else if (code=='"') new= 228;
- else if (code=='o') new= 229;
- else if (code=='e') new= 230;
- else if (code=='-') new= 170;
+ char new = 0;
+
+ if (char1 == 'a') {
+ if (code == '`') new = 224;
+ else if (code == 39) new = 225;
+ else if (code == '^') new = 226;
+ else if (code == '~') new = 227;
+ else if (code == '"') new = 228;
+ else if (code == 'o') new = 229;
+ else if (code == 'e') new = 230;
+ else if (code == '-') new = 170;
}
- else if (char1=='c') {
- if (code==',') new= 231;
- if (code=='|') new= 162;
+ else if (char1 == 'c') {
+ if (code == ',') new = 231;
+ if (code == '|') new = 162;
}
- else if (char1=='e') {
- if (code=='`') new= 232;
- else if (code==39) new= 233;
- else if (code=='^') new= 234;
- else if (code=='"') new= 235;
+ else if (char1 == 'e') {
+ if (code == '`') new = 232;
+ else if (code == 39) new = 233;
+ else if (code == '^') new = 234;
+ else if (code == '"') new = 235;
}
- else if (char1=='i') {
- if (code=='`') new= 236;
- else if (code==39) new= 237;
- else if (code=='^') new= 238;
- else if (code=='"') new= 239;
+ else if (char1 == 'i') {
+ if (code == '`') new = 236;
+ else if (code == 39) new = 237;
+ else if (code == '^') new = 238;
+ else if (code == '"') new = 239;
}
- else if (char1=='n') {
- if (code=='~') new= 241;
+ else if (char1 == 'n') {
+ if (code == '~') new = 241;
}
- else if (char1=='o') {
- if (code=='`') new= 242;
- else if (code==39) new= 243;
- else if (code=='^') new= 244;
- else if (code=='~') new= 245;
- else if (code=='"') new= 246;
- else if (code=='/') new= 248;
- else if (code=='-') new= 186;
- else if (code=='e') new= 143;
+ else if (char1 == 'o') {
+ if (code == '`') new = 242;
+ else if (code == 39) new = 243;
+ else if (code == '^') new = 244;
+ else if (code == '~') new = 245;
+ else if (code == '"') new = 246;
+ else if (code == '/') new = 248;
+ else if (code == '-') new = 186;
+ else if (code == 'e') new = 143;
}
- else if (char1=='s') {
- if (code=='s') new= 167;
+ else if (char1 == 's') {
+ if (code == 's') new = 167;
}
- else if (char1=='u') {
- if (code=='`') new= 249;
- else if (code==39) new= 250;
- else if (code=='^') new= 251;
- else if (code=='"') new= 252;
+ else if (char1 == 'u') {
+ if (code == '`') new = 249;
+ else if (code == 39) new = 250;
+ else if (code == '^') new = 251;
+ else if (code == '"') new = 252;
}
- else if (char1=='y') {
- if (code==39) new= 253;
- else if (code=='"') new= 255;
+ else if (char1 == 'y') {
+ if (code == 39) new = 253;
+ else if (code == '"') new = 255;
}
- else if (char1=='A') {
- if (code=='`') new= 192;
- else if (code==39) new= 193;
- else if (code=='^') new= 194;
- else if (code=='~') new= 195;
- else if (code=='"') new= 196;
- else if (code=='o') new= 197;
- else if (code=='e') new= 198;
+ else if (char1 == 'A') {
+ if (code == '`') new = 192;
+ else if (code == 39) new = 193;
+ else if (code == '^') new = 194;
+ else if (code == '~') new = 195;
+ else if (code == '"') new = 196;
+ else if (code == 'o') new = 197;
+ else if (code == 'e') new = 198;
}
- else if (char1=='C') {
- if (code==',') new= 199;
+ else if (char1 == 'C') {
+ if (code == ',') new = 199;
}
- else if (char1=='E') {
- if (code=='`') new= 200;
- else if (code==39) new= 201;
- else if (code=='^') new= 202;
- else if (code=='"') new= 203;
+ else if (char1 == 'E') {
+ if (code == '`') new = 200;
+ else if (code == 39) new = 201;
+ else if (code == '^') new = 202;
+ else if (code == '"') new = 203;
}
- else if (char1=='I') {
- if (code=='`') new= 204;
- else if (code==39) new= 205;
- else if (code=='^') new= 206;
- else if (code=='"') new= 207;
+ else if (char1 == 'I') {
+ if (code == '`') new = 204;
+ else if (code == 39) new = 205;
+ else if (code == '^') new = 206;
+ else if (code == '"') new = 207;
}
- else if (char1=='N') {
- if (code=='~') new= 209;
+ else if (char1 == 'N') {
+ if (code == '~') new = 209;
}
- else if (char1=='O') {
- if (code=='`') new= 210;
- else if (code==39) new= 211;
- else if (code=='^') new= 212;
- else if (code=='~') new= 213;
- else if (code=='"') new= 214;
- else if (code=='/') new= 216;
- else if (code=='e') new= 141;
+ else if (char1 == 'O') {
+ if (code == '`') new = 210;
+ else if (code == 39) new = 211;
+ else if (code == '^') new = 212;
+ else if (code == '~') new = 213;
+ else if (code == '"') new = 214;
+ else if (code == '/') new = 216;
+ else if (code == 'e') new = 141;
}
- else if (char1=='U') {
- if (code=='`') new= 217;
- else if (code==39) new= 218;
- else if (code=='^') new= 219;
- else if (code=='"') new= 220;
+ else if (char1 == 'U') {
+ if (code == '`') new = 217;
+ else if (code == 39) new = 218;
+ else if (code == '^') new = 219;
+ else if (code == '"') new = 220;
}
- else if (char1=='Y') {
- if (code==39) new= 221;
+ else if (char1 == 'Y') {
+ if (code == 39) new = 221;
}
- else if (char1=='1') {
- if (code=='4') new= 188;
- if (code=='2') new= 189;
+ else if (char1 == '1') {
+ if (code == '4') new = 188;
+ if (code == '2') new = 189;
}
- else if (char1=='3') {
- if (code=='4') new= 190;
+ else if (char1 == '3') {
+ if (code == '4') new = 190;
}
- else if (char1==':') {
- if (code=='-') new= 247;
+ else if (char1 == ':') {
+ if (code == '-') new = 247;
}
- else if (char1=='-') {
- if (code==':') new= 247;
- if (code=='|') new= 135;
- if (code=='+') new= 177;
+ else if (char1 == '-') {
+ if (code == ':') new = 247;
+ if (code == '|') new = 135;
+ if (code == '+') new = 177;
}
- else if (char1=='|') {
- if (code=='-') new= 135;
- if (code=='=') new= 136;
+ else if (char1 == '|') {
+ if (code == '-') new = 135;
+ if (code == '=') new = 136;
}
- else if (char1=='=') {
- if (code=='|') new= 136;
+ else if (char1 == '=') {
+ if (code == '|') new = 136;
}
- else if (char1=='+') {
- if (code=='-') new= 177;
+ else if (char1 == '+') {
+ if (code == '-') new = 177;
}
if (new) return new;
@@ -212,7 +212,7 @@ static char findaccent(char char1, unsigned int code)
static void update_string(Curve *cu)
{
- EditFont *ef= cu->editfont;
+ EditFont *ef = cu->editfont;
int len;
// Free the old curve string
@@ -230,22 +230,22 @@ static void update_string(Curve *cu)
static int insert_into_textbuf(Object *obedit, uintptr_t c)
{
- Curve *cu= obedit->data;
+ Curve *cu = obedit->data;
- if (cu->len<MAXTEXT-1) {
- EditFont *ef= cu->editfont;
+ if (cu->len < MAXTEXT - 1) {
+ EditFont *ef = cu->editfont;
int x;
- for (x= cu->len; x>cu->pos; x--) ef->textbuf[x]= ef->textbuf[x-1];
- for (x= cu->len; x>cu->pos; x--) ef->textbufinfo[x]= ef->textbufinfo[x-1];
- ef->textbuf[cu->pos]= c;
+ for (x = cu->len; x > cu->pos; x--) ef->textbuf[x] = ef->textbuf[x - 1];
+ for (x = cu->len; x > cu->pos; x--) ef->textbufinfo[x] = ef->textbufinfo[x - 1];
+ ef->textbuf[cu->pos] = c;
ef->textbufinfo[cu->pos] = cu->curinfo;
ef->textbufinfo[cu->pos].kern = 0;
ef->textbufinfo[cu->pos].mat_nr = obedit->actcol;
cu->pos++;
cu->len++;
- ef->textbuf[cu->len]='\0';
+ ef->textbuf[cu->len] = '\0';
update_string(cu);
@@ -257,18 +257,18 @@ static int insert_into_textbuf(Object *obedit, uintptr_t c)
static void text_update_edited(bContext *C, Scene *scene, Object *obedit, int recalc, int mode)
{
- struct Main *bmain= CTX_data_main(C);
- Curve *cu= obedit->data;
- EditFont *ef= cu->editfont;
- cu->curinfo = ef->textbufinfo[cu->pos?cu->pos-1:0];
+ struct Main *bmain = CTX_data_main(C);
+ Curve *cu = obedit->data;
+ EditFont *ef = cu->editfont;
+ cu->curinfo = ef->textbufinfo[cu->pos ? cu->pos - 1 : 0];
if (obedit->totcol > 0) {
- obedit->actcol= ef->textbufinfo[cu->pos?cu->pos-1:0].mat_nr;
+ obedit->actcol = ef->textbufinfo[cu->pos ? cu->pos - 1 : 0].mat_nr;
/* since this array is calloc'd, it can be 0 even though we try ensure
* (mat_nr > 0) almost everywhere */
if (obedit->actcol < 1) {
- obedit->actcol= 1;
+ obedit->actcol = 1;
}
}
@@ -279,41 +279,41 @@ static void text_update_edited(bContext *C, Scene *scene, Object *obedit, int re
if (recalc)
DAG_id_tag_update(obedit->data, 0);
- WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+ WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
}
/********************** insert lorem operator *********************/
static int insert_lorem_exec(bContext *C, wmOperator *UNUSED(op))
{
- Object *obedit= CTX_data_edit_object(C);
+ Object *obedit = CTX_data_edit_object(C);
const char *p, *p2;
int i;
static const char *lastlorem;
if (lastlorem)
- p= lastlorem;
+ p = lastlorem;
else
- p= ED_lorem;
+ p = ED_lorem;
- i= rand()/(RAND_MAX/6)+4;
+ i = rand() / (RAND_MAX / 6) + 4;
- for (p2=p; *p2 && i; p2++) {
+ for (p2 = p; *p2 && i; p2++) {
insert_into_textbuf(obedit, *p2);
- if (*p2=='.')
+ if (*p2 == '.')
i--;
}
- lastlorem = p2+1;
- if (strlen(lastlorem)<5)
+ lastlorem = p2 + 1;
+ if (strlen(lastlorem) < 5)
lastlorem = ED_lorem;
insert_into_textbuf(obedit, '\n');
insert_into_textbuf(obedit, '\n');
DAG_id_tag_update(obedit->data, 0);
- WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+ WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
return OPERATOR_FINISHED;
}
@@ -330,7 +330,7 @@ void FONT_OT_insert_lorem(wmOperatorType *ot)
ot->poll = ED_operator_editfont;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/******************* paste file operator ********************/
@@ -340,15 +340,15 @@ void FONT_OT_insert_lorem(wmOperatorType *ot)
static int paste_file(bContext *C, ReportList *reports, const char *filename)
{
- Scene *scene= CTX_data_scene(C);
- Object *obedit= CTX_data_edit_object(C);
- Curve *cu= obedit->data;
- EditFont *ef= cu->editfont;
+ Scene *scene = CTX_data_scene(C);
+ Object *obedit = CTX_data_edit_object(C);
+ Curve *cu = obedit->data;
+ EditFont *ef = cu->editfont;
FILE *fp;
int filelen;
char *strp;
- fp= BLI_fopen(filename, "r");
+ fp = BLI_fopen(filename, "r");
if (!fp) {
if (reports)
@@ -360,22 +360,22 @@ static int paste_file(bContext *C, ReportList *reports, const char *filename)
filelen = ftell(fp);
fseek(fp, 0L, SEEK_SET);
- strp= MEM_callocN(filelen+4, "tempstr");
+ strp = MEM_callocN(filelen + 4, "tempstr");
// fread() instead of read(), because windows read() converts text
// to DOS \r\n linebreaks, causing double linebreaks in the 3d text
filelen = fread(strp, 1, filelen, fp);
fclose(fp);
- strp[filelen]= 0;
+ strp[filelen] = 0;
- if (cu->len+filelen<MAXTEXT) {
+ if (cu->len + filelen < MAXTEXT) {
int tmplen;
- wchar_t *mem = MEM_callocN((sizeof(wchar_t)*filelen)+(4*sizeof(wchar_t)), "temporary");
+ wchar_t *mem = MEM_callocN((sizeof(wchar_t) * filelen) + (4 * sizeof(wchar_t)), "temporary");
tmplen = BLI_strncpy_wchar_from_utf8(mem, strp, filelen + 1);
wcscat(ef->textbuf, mem);
MEM_freeN(mem);
cu->len += tmplen;
- cu->pos= cu->len;
+ cu->pos = cu->len;
}
MEM_freeN(strp);
@@ -389,8 +389,8 @@ static int paste_file_exec(bContext *C, wmOperator *op)
char *path;
int retval;
- path= RNA_string_get_alloc(op->ptr, "filepath", NULL, 0);
- retval= paste_file(C, op->reports, path);
+ path = RNA_string_get_alloc(op->ptr, "filepath", NULL, 0);
+ retval = paste_file(C, op->reports, path);
MEM_freeN(path);
return retval;
@@ -419,17 +419,17 @@ void FONT_OT_file_paste(wmOperatorType *ot)
ot->poll = ED_operator_editfont;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
- WM_operator_properties_filesel(ot, FOLDERFILE|TEXTFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
+ WM_operator_properties_filesel(ot, FOLDERFILE | TEXTFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
}
/******************* text to object operator ********************/
static void txt_add_object(bContext *C, TextLine *firstline, int totline, float offset[3])
{
- Scene *scene= CTX_data_scene(C);
+ Scene *scene = CTX_data_scene(C);
Curve *cu;
Object *obedit;
Base *base;
@@ -437,8 +437,8 @@ static void txt_add_object(bContext *C, TextLine *firstline, int totline, float
int nchars = 0, a;
float rot[3] = {0.f, 0.f, 0.f};
- obedit= BKE_object_add(scene, OB_FONT);
- base= scene->basact;
+ obedit = BKE_object_add(scene, OB_FONT);
+ base = scene->basact;
ED_object_base_init_transform(C, base, NULL, rot); /* seems to assume view align ? TODO - look into this, could be an operator option */
@@ -448,49 +448,49 @@ static void txt_add_object(bContext *C, TextLine *firstline, int totline, float
obedit->loc[1] += offset[1];
obedit->loc[2] += offset[2];
- cu= obedit->data;
- cu->vfont= BKE_vfont_builtin_get();
+ cu = obedit->data;
+ cu->vfont = BKE_vfont_builtin_get();
cu->vfont->id.us++;
- for (tmp=firstline, a=0; cu->len<MAXTEXT && a<totline; tmp=tmp->next, a++)
+ for (tmp = firstline, a = 0; cu->len < MAXTEXT && a < totline; tmp = tmp->next, a++)
nchars += strlen(tmp->line) + 1;
if (cu->str) MEM_freeN(cu->str);
if (cu->strinfo) MEM_freeN(cu->strinfo);
- cu->str= MEM_callocN(nchars+4, "str");
- cu->strinfo= MEM_callocN((nchars+4)*sizeof(CharInfo), "strinfo");
+ cu->str = MEM_callocN(nchars + 4, "str");
+ cu->strinfo = MEM_callocN((nchars + 4) * sizeof(CharInfo), "strinfo");
- cu->str[0]= '\0';
- cu->len= 0;
- cu->pos= 0;
+ cu->str[0] = '\0';
+ cu->len = 0;
+ cu->pos = 0;
- for (tmp=firstline, a=0; cu->len<MAXTEXT && a<totline; tmp=tmp->next, a++) {
+ for (tmp = firstline, a = 0; cu->len < MAXTEXT && a < totline; tmp = tmp->next, a++) {
strcat(cu->str, tmp->line);
- cu->len+= strlen(tmp->line);
+ cu->len += strlen(tmp->line);
if (tmp->next) {
strcat(cu->str, "\n");
cu->len++;
}
- cu->pos= cu->len;
+ cu->pos = cu->len;
}
- WM_event_add_notifier(C, NC_OBJECT|NA_ADDED, obedit);
+ WM_event_add_notifier(C, NC_OBJECT | NA_ADDED, obedit);
}
void ED_text_to_object(bContext *C, Text *text, int split_lines)
{
- RegionView3D *rv3d= CTX_wm_region_view3d(C);
+ RegionView3D *rv3d = CTX_wm_region_view3d(C);
TextLine *line;
float offset[3];
- int linenum= 0;
+ int linenum = 0;
if (!text || !text->lines.first) return;
if (split_lines) {
- for (line=text->lines.first; line; line=line->next) {
+ for (line = text->lines.first; line; line = line->next) {
/* skip lines with no text, but still make space for them */
if (line->line[0] == '\0') {
linenum++;
@@ -511,9 +511,9 @@ void ED_text_to_object(bContext *C, Text *text, int split_lines)
}
}
else {
- offset[0]= 0.0f;
- offset[1]= 0.0f;
- offset[2]= 0.0f;
+ offset[0] = 0.0f;
+ offset[1] = 0.0f;
+ offset[2] = 0.0f;
txt_add_object(C, text->lines.first, BLI_countlist(&text->lines), offset);
}
@@ -523,8 +523,8 @@ void ED_text_to_object(bContext *C, Text *text, int split_lines)
static short next_word(Curve *cu)
{
short s;
- for (s=cu->pos; ((cu->str[s]) && (cu->str[s] != ' ') && (cu->str[s] != '\n') &&
- (cu->str[s] != 1) && (cu->str[s] != '\r'));
+ for (s = cu->pos; ((cu->str[s]) && (cu->str[s] != ' ') && (cu->str[s] != '\n') &&
+ (cu->str[s] != 1) && (cu->str[s] != '\r'));
s++)
{
/* pass */
@@ -537,7 +537,7 @@ static short prev_word(Curve *cu)
{
short s;
- if (cu->pos==0) return(0);
+ if (cu->pos == 0) return(0);
for (s = cu->pos - 2; ((cu->str[s]) && (cu->str[s] != ' ') && (cu->str[s] != '\n') &&
(cu->str[s] != 1) && (cu->str[s] != '\r'));
s--)
@@ -548,10 +548,10 @@ static short prev_word(Curve *cu)
return cu->str[s] ? (s + 1) : s;
}
-static int kill_selection(Object *obedit, int ins) /* 1 == new character */
+static int kill_selection(Object *obedit, int ins) /* 1 == new character */
{
- Curve *cu= obedit->data;
- EditFont *ef= cu->editfont;
+ Curve *cu = obedit->data;
+ EditFont *ef = cu->editfont;
int selend, selstart, direction;
int offset = 0;
int getfrom;
@@ -560,17 +560,17 @@ static int kill_selection(Object *obedit, int ins) /* 1 == new character */
if (direction) {
int size;
if (ins) offset = 1;
- if (cu->pos >= selstart) cu->pos = selstart+offset;
+ if (cu->pos >= selstart) cu->pos = selstart + offset;
if ((direction == -1) && ins) {
selstart++;
selend++;
}
- getfrom = selend+offset;
- if (ins==0) getfrom++;
- size = (cu->len * sizeof(wchar_t)) - (selstart * sizeof(wchar_t)) + (offset*sizeof(wchar_t));
- memmove(ef->textbuf+selstart, ef->textbuf+getfrom, size);
- memmove(ef->textbufinfo+selstart, ef->textbufinfo+getfrom, ((cu->len-selstart)+offset)*sizeof(CharInfo));
- cu->len -= (selend-selstart)+offset;
+ getfrom = selend + offset;
+ if (ins == 0) getfrom++;
+ size = (cu->len * sizeof(wchar_t)) - (selstart * sizeof(wchar_t)) + (offset * sizeof(wchar_t));
+ memmove(ef->textbuf + selstart, ef->textbuf + getfrom, size);
+ memmove(ef->textbufinfo + selstart, ef->textbufinfo + getfrom, ((cu->len - selstart) + offset) * sizeof(CharInfo));
+ cu->len -= (selend - selstart) + offset;
cu->selstart = cu->selend = 0;
}
@@ -579,24 +579,25 @@ static int kill_selection(Object *obedit, int ins) /* 1 == new character */
/******************* set style operator ********************/
-static EnumPropertyItem style_items[]= {
+static EnumPropertyItem style_items[] = {
{CU_CHINFO_BOLD, "BOLD", 0, "Bold", ""},
{CU_CHINFO_ITALIC, "ITALIC", 0, "Italic", ""},
{CU_CHINFO_UNDERLINE, "UNDERLINE", 0, "Underline", ""},
{CU_CHINFO_SMALLCAPS, "SMALL_CAPS", 0, "Small Caps", ""},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL}
+};
static int set_style(bContext *C, const int style, const int clear)
{
- Object *obedit= CTX_data_edit_object(C);
- Curve *cu= obedit->data;
- EditFont *ef= cu->editfont;
+ Object *obedit = CTX_data_edit_object(C);
+ Curve *cu = obedit->data;
+ EditFont *ef = cu->editfont;
int i, selstart, selend;
if (!BKE_vfont_select_get(obedit, &selstart, &selend))
return OPERATOR_CANCELLED;
- for (i=selstart; i<=selend; i++) {
+ for (i = selstart; i <= selend; i++) {
if (clear)
ef->textbufinfo[i].flag &= ~style;
else
@@ -604,15 +605,15 @@ static int set_style(bContext *C, const int style, const int clear)
}
DAG_id_tag_update(obedit->data, 0);
- WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+ WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
return OPERATOR_FINISHED;
}
static int set_style_exec(bContext *C, wmOperator *op)
{
- const int style= RNA_enum_get(op->ptr, "style");
- const int clear= RNA_boolean_get(op->ptr, "clear");
+ const int style = RNA_enum_get(op->ptr, "style");
+ const int clear = RNA_boolean_get(op->ptr, "clear");
return set_style(C, style, clear);
}
@@ -629,7 +630,7 @@ void FONT_OT_style_set(wmOperatorType *ot)
ot->poll = ED_operator_editfont;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
RNA_def_enum(ot->srna, "style", style_items, CU_CHINFO_BOLD, "Style", "Style to set selection to");
@@ -640,17 +641,17 @@ void FONT_OT_style_set(wmOperatorType *ot)
static int toggle_style_exec(bContext *C, wmOperator *op)
{
- Object *obedit= CTX_data_edit_object(C);
- Curve *cu= obedit->data;
+ Object *obedit = CTX_data_edit_object(C);
+ Curve *cu = obedit->data;
int style, clear, selstart, selend;
if (!BKE_vfont_select_get(obedit, &selstart, &selend))
return OPERATOR_CANCELLED;
- style= RNA_enum_get(op->ptr, "style");
+ style = RNA_enum_get(op->ptr, "style");
cu->curinfo.flag ^= style;
- clear= (cu->curinfo.flag & style) == 0;
+ clear = (cu->curinfo.flag & style) == 0;
return set_style(C, style, clear);
}
@@ -667,7 +668,7 @@ void FONT_OT_style_toggle(wmOperatorType *ot)
ot->poll = ED_operator_editfont;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
RNA_def_enum(ot->srna, "style", style_items, CU_CHINFO_BOLD, "Style", "Style to set selection to");
@@ -680,18 +681,18 @@ static void copy_selection(Object *obedit)
int selstart, selend;
if (BKE_vfont_select_get(obedit, &selstart, &selend)) {
- Curve *cu= obedit->data;
- EditFont *ef= cu->editfont;
+ Curve *cu = obedit->data;
+ EditFont *ef = cu->editfont;
- memcpy(ef->copybuf, ef->textbuf+selstart, ((selend-selstart)+1)*sizeof(wchar_t));
- ef->copybuf[(selend-selstart)+1]=0;
- memcpy(ef->copybufinfo, ef->textbufinfo+selstart, ((selend-selstart)+1)*sizeof(CharInfo));
+ memcpy(ef->copybuf, ef->textbuf + selstart, ((selend - selstart) + 1) * sizeof(wchar_t));
+ ef->copybuf[(selend - selstart) + 1] = 0;
+ memcpy(ef->copybufinfo, ef->textbufinfo + selstart, ((selend - selstart) + 1) * sizeof(CharInfo));
}
}
static int copy_text_exec(bContext *C, wmOperator *UNUSED(op))
{
- Object *obedit= CTX_data_edit_object(C);
+ Object *obedit = CTX_data_edit_object(C);
copy_selection(obedit);
@@ -714,8 +715,8 @@ void FONT_OT_text_copy(wmOperatorType *ot)
static int cut_text_exec(bContext *C, wmOperator *UNUSED(op))
{
- Scene *scene= CTX_data_scene(C);
- Object *obedit= CTX_data_edit_object(C);
+ Scene *scene = CTX_data_scene(C);
+ Object *obedit = CTX_data_edit_object(C);
int selstart, selend;
if (!BKE_vfont_select_get(obedit, &selstart, &selend))
@@ -741,26 +742,26 @@ void FONT_OT_text_cut(wmOperatorType *ot)
ot->poll = ED_operator_editfont;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/******************* paste text operator ********************/
static int paste_selection(Object *obedit, ReportList *reports)
{
- Curve *cu= obedit->data;
- EditFont *ef= cu->editfont;
- int len= wcslen(ef->copybuf);
+ Curve *cu = obedit->data;
+ EditFont *ef = cu->editfont;
+ int len = wcslen(ef->copybuf);
// Verify that the copy buffer => [copy buffer len] + cu->len < MAXTEXT
if (cu->len + len <= MAXTEXT) {
if (len) {
- int size = (cu->len * sizeof(wchar_t)) - (cu->pos*sizeof(wchar_t)) + sizeof(wchar_t);
- memmove(ef->textbuf+cu->pos+len, ef->textbuf+cu->pos, size);
- memcpy(ef->textbuf+cu->pos, ef->copybuf, len * sizeof(wchar_t));
+ int size = (cu->len * sizeof(wchar_t)) - (cu->pos * sizeof(wchar_t)) + sizeof(wchar_t);
+ memmove(ef->textbuf + cu->pos + len, ef->textbuf + cu->pos, size);
+ memcpy(ef->textbuf + cu->pos, ef->copybuf, len * sizeof(wchar_t));
- memmove(ef->textbufinfo+cu->pos+len, ef->textbufinfo+cu->pos, (cu->len-cu->pos+1)*sizeof(CharInfo));
- memcpy(ef->textbufinfo+cu->pos, ef->copybufinfo, len*sizeof(CharInfo));
+ memmove(ef->textbufinfo + cu->pos + len, ef->textbufinfo + cu->pos, (cu->len - cu->pos + 1) * sizeof(CharInfo));
+ memcpy(ef->textbufinfo + cu->pos, ef->copybufinfo, len * sizeof(CharInfo));
cu->len += len;
cu->pos += len;
@@ -776,8 +777,8 @@ static int paste_selection(Object *obedit, ReportList *reports)
static int paste_text_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
- Object *obedit= CTX_data_edit_object(C);
+ Scene *scene = CTX_data_scene(C);
+ Object *obedit = CTX_data_edit_object(C);
if (!paste_selection(obedit, op->reports))
return OPERATOR_CANCELLED;
@@ -799,12 +800,12 @@ void FONT_OT_text_paste(wmOperatorType *ot)
ot->poll = ED_operator_editfont;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/************************ move operator ************************/
-static EnumPropertyItem move_type_items[]= {
+static EnumPropertyItem move_type_items[] = {
{LINE_BEGIN, "LINE_BEGIN", 0, "Line Begin", ""},
{LINE_END, "LINE_END", 0, "Line End", ""},
{PREV_CHAR, "PREVIOUS_CHARACTER", 0, "Previous Character", ""},
@@ -819,77 +820,77 @@ static EnumPropertyItem move_type_items[]= {
static int move_cursor(bContext *C, int type, int select)
{
- Scene *scene= CTX_data_scene(C);
- Object *obedit= CTX_data_edit_object(C);
- Curve *cu= obedit->data;
- EditFont *ef= cu->editfont;
- int cursmove= -1;
+ Scene *scene = CTX_data_scene(C);
+ Object *obedit = CTX_data_edit_object(C);
+ Curve *cu = obedit->data;
+ EditFont *ef = cu->editfont;
+ int cursmove = -1;
switch (type) {
case LINE_BEGIN:
- if ((select) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
- while (cu->pos>0) {
- if (ef->textbuf[cu->pos-1]=='\n') break;
- if (ef->textbufinfo[cu->pos-1].flag & CU_CHINFO_WRAP) break;
+ if ((select) && (cu->selstart == 0)) cu->selstart = cu->selend = cu->pos + 1;
+ while (cu->pos > 0) {
+ if (ef->textbuf[cu->pos - 1] == '\n') break;
+ if (ef->textbufinfo[cu->pos - 1].flag & CU_CHINFO_WRAP) break;
cu->pos--;
}
- cursmove=FO_CURS;
+ cursmove = FO_CURS;
break;
case LINE_END:
- if ((select) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
- while (cu->pos<cu->len) {
- if (ef->textbuf[cu->pos]==0) break;
- if (ef->textbuf[cu->pos]=='\n') break;
- if (ef->textbufinfo[cu->pos].flag & CU_CHINFO_WRAP ) break;
+ if ((select) && (cu->selstart == 0)) cu->selstart = cu->selend = cu->pos + 1;
+ while (cu->pos < cu->len) {
+ if (ef->textbuf[cu->pos] == 0) break;
+ if (ef->textbuf[cu->pos] == '\n') break;
+ if (ef->textbufinfo[cu->pos].flag & CU_CHINFO_WRAP) break;
cu->pos++;
}
- cursmove=FO_CURS;
+ cursmove = FO_CURS;
break;
case PREV_WORD:
- if ((select) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
- cu->pos= prev_word(cu);
- cursmove= FO_CURS;
+ if ((select) && (cu->selstart == 0)) cu->selstart = cu->selend = cu->pos + 1;
+ cu->pos = prev_word(cu);
+ cursmove = FO_CURS;
break;
case NEXT_WORD:
- if ((select) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
- cu->pos= next_word(cu);
- cursmove= FO_CURS;
+ if ((select) && (cu->selstart == 0)) cu->selstart = cu->selend = cu->pos + 1;
+ cu->pos = next_word(cu);
+ cursmove = FO_CURS;
break;
case PREV_CHAR:
- if ((select) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
+ if ((select) && (cu->selstart == 0)) cu->selstart = cu->selend = cu->pos + 1;
cu->pos--;
- cursmove=FO_CURS;
+ cursmove = FO_CURS;
break;
case NEXT_CHAR:
- if ((select) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
+ if ((select) && (cu->selstart == 0)) cu->selstart = cu->selend = cu->pos + 1;
cu->pos++;
- cursmove= FO_CURS;
+ cursmove = FO_CURS;
break;
case PREV_LINE:
- if ((select) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
- cursmove=FO_CURSUP;
+ if ((select) && (cu->selstart == 0)) cu->selstart = cu->selend = cu->pos + 1;
+ cursmove = FO_CURSUP;
break;
case NEXT_LINE:
- if ((select) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
- cursmove= FO_CURSDOWN;
+ if ((select) && (cu->selstart == 0)) cu->selstart = cu->selend = cu->pos + 1;
+ cursmove = FO_CURSDOWN;
break;
case PREV_PAGE:
- if ((select) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
- cursmove=FO_PAGEUP;
+ if ((select) && (cu->selstart == 0)) cu->selstart = cu->selend = cu->pos + 1;
+ cursmove = FO_PAGEUP;
break;
case NEXT_PAGE:
- if ((select) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
- cursmove=FO_PAGEDOWN;
+ if ((select) && (cu->selstart == 0)) cu->selstart = cu->selend = cu->pos + 1;
+ cursmove = FO_PAGEDOWN;
break;
}
@@ -898,16 +899,16 @@ static int move_cursor(bContext *C, int type, int select)
if (select == 0) {
if (cu->selstart) {
- struct Main *bmain= CTX_data_main(C);
+ struct Main *bmain = CTX_data_main(C);
cu->selstart = cu->selend = 0;
update_string(cu);
BKE_vfont_to_curve(bmain, scene, obedit, FO_SELCHANGE);
}
}
- if (cu->pos>cu->len) cu->pos= cu->len;
- else if (cu->pos>=MAXTEXT) cu->pos= MAXTEXT;
- else if (cu->pos<0) cu->pos= 0;
+ if (cu->pos > cu->len) cu->pos = cu->len;
+ else if (cu->pos >= MAXTEXT) cu->pos = MAXTEXT;
+ else if (cu->pos < 0) cu->pos = 0;
text_update_edited(C, scene, obedit, select, cursmove);
@@ -919,7 +920,7 @@ static int move_cursor(bContext *C, int type, int select)
static int move_exec(bContext *C, wmOperator *op)
{
- int type= RNA_enum_get(op->ptr, "type");
+ int type = RNA_enum_get(op->ptr, "type");
return move_cursor(C, type, 0);
}
@@ -936,7 +937,7 @@ void FONT_OT_move(wmOperatorType *ot)
ot->poll = ED_operator_editfont;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
RNA_def_enum(ot->srna, "type", move_type_items, LINE_BEGIN, "Type", "Where to move cursor to");
@@ -946,7 +947,7 @@ void FONT_OT_move(wmOperatorType *ot)
static int move_select_exec(bContext *C, wmOperator *op)
{
- int type= RNA_enum_get(op->ptr, "type");
+ int type = RNA_enum_get(op->ptr, "type");
return move_cursor(C, type, 1);
}
@@ -963,7 +964,7 @@ void FONT_OT_move_select(wmOperatorType *ot)
ot->poll = ED_operator_editfont;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
RNA_def_enum(ot->srna, "type", move_type_items, LINE_BEGIN, "Type", "Where to move cursor to, to make a selection");
@@ -973,20 +974,20 @@ void FONT_OT_move_select(wmOperatorType *ot)
static int change_spacing_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
- Object *obedit= CTX_data_edit_object(C);
- Curve *cu= obedit->data;
- EditFont *ef= cu->editfont;
- int kern, delta= RNA_int_get(op->ptr, "delta");
+ Scene *scene = CTX_data_scene(C);
+ Object *obedit = CTX_data_edit_object(C);
+ Curve *cu = obedit->data;
+ EditFont *ef = cu->editfont;
+ int kern, delta = RNA_int_get(op->ptr, "delta");
- kern = ef->textbufinfo[cu->pos-1].kern;
+ kern = ef->textbufinfo[cu->pos - 1].kern;
kern += delta;
CLAMP(kern, -20, 20);
- if (ef->textbufinfo[cu->pos-1].kern == kern)
+ if (ef->textbufinfo[cu->pos - 1].kern == kern)
return OPERATOR_CANCELLED;
- ef->textbufinfo[cu->pos-1].kern = kern;
+ ef->textbufinfo[cu->pos - 1].kern = kern;
text_update_edited(C, scene, obedit, 1, FO_EDIT);
@@ -1005,7 +1006,7 @@ void FONT_OT_change_spacing(wmOperatorType *ot)
ot->poll = ED_operator_editfont;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
RNA_def_int(ot->srna, "delta", 1, -20, 20, "Delta", "Amount to decrease or increase character spacing with", -20, 20);
@@ -1015,23 +1016,23 @@ void FONT_OT_change_spacing(wmOperatorType *ot)
static int change_character_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
- Object *obedit= CTX_data_edit_object(C);
- Curve *cu= obedit->data;
- EditFont *ef= cu->editfont;
- int character, delta= RNA_int_get(op->ptr, "delta");
+ Scene *scene = CTX_data_scene(C);
+ Object *obedit = CTX_data_edit_object(C);
+ Curve *cu = obedit->data;
+ EditFont *ef = cu->editfont;
+ int character, delta = RNA_int_get(op->ptr, "delta");
if (cu->pos <= 0)
return OPERATOR_CANCELLED;
- character= ef->textbuf[cu->pos - 1];
+ character = ef->textbuf[cu->pos - 1];
character += delta;
CLAMP(character, 0, 255);
if (character == ef->textbuf[cu->pos - 1])
return OPERATOR_CANCELLED;
- ef->textbuf[cu->pos - 1]= character;
+ ef->textbuf[cu->pos - 1] = character;
text_update_edited(C, scene, obedit, 1, FO_EDIT);
@@ -1050,7 +1051,7 @@ void FONT_OT_change_character(wmOperatorType *ot)
ot->poll = ED_operator_editfont;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
RNA_def_int(ot->srna, "delta", 1, -255, 255, "Delta", "Number to increase or decrease character code with", -255, 255);
@@ -1060,15 +1061,15 @@ void FONT_OT_change_character(wmOperatorType *ot)
static int line_break_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
- Object *obedit= CTX_data_edit_object(C);
- Curve *cu= obedit->data;
- EditFont *ef= cu->editfont;
- const int ctrl= RNA_boolean_get(op->ptr, "ctrl");
+ Scene *scene = CTX_data_scene(C);
+ Object *obedit = CTX_data_edit_object(C);
+ Curve *cu = obedit->data;
+ EditFont *ef = cu->editfont;
+ const int ctrl = RNA_boolean_get(op->ptr, "ctrl");
if (ctrl) {
insert_into_textbuf(obedit, 1);
- if (ef->textbuf[cu->pos]!='\n')
+ if (ef->textbuf[cu->pos] != '\n')
insert_into_textbuf(obedit, '\n');
}
else
@@ -1093,7 +1094,7 @@ void FONT_OT_line_break(wmOperatorType *ot)
ot->poll = ED_operator_editfont;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
RNA_def_boolean(ot->srna, "ctrl", 0, "Ctrl", ""); // XXX what is this?
@@ -1101,7 +1102,7 @@ void FONT_OT_line_break(wmOperatorType *ot)
/******************* delete operator **********************/
-static EnumPropertyItem delete_type_items[]= {
+static EnumPropertyItem delete_type_items[] = {
{DEL_ALL, "ALL", 0, "All", ""},
{DEL_NEXT_CHAR, "NEXT_CHARACTER", 0, "Next Character", ""},
{DEL_PREV_CHAR, "PREVIOUS_CHARACTER", 0, "Previous Character", ""},
@@ -1112,55 +1113,55 @@ static EnumPropertyItem delete_type_items[]= {
static int delete_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
- Object *obedit= CTX_data_edit_object(C);
- Curve *cu= obedit->data;
- EditFont *ef= cu->editfont;
- int x, selstart, selend, type= RNA_enum_get(op->ptr, "type");
+ Scene *scene = CTX_data_scene(C);
+ Object *obedit = CTX_data_edit_object(C);
+ Curve *cu = obedit->data;
+ EditFont *ef = cu->editfont;
+ int x, selstart, selend, type = RNA_enum_get(op->ptr, "type");
if (cu->len == 0)
return OPERATOR_CANCELLED;
if (BKE_vfont_select_get(obedit, &selstart, &selend)) {
- if (type == DEL_NEXT_SEL) type= DEL_SELECTION;
- else if (type == DEL_PREV_SEL) type= DEL_SELECTION;
+ if (type == DEL_NEXT_SEL) type = DEL_SELECTION;
+ else if (type == DEL_PREV_SEL) type = DEL_SELECTION;
}
else {
- if (type == DEL_NEXT_SEL) type= DEL_NEXT_CHAR;
- else if (type == DEL_PREV_SEL) type= DEL_PREV_CHAR;
+ if (type == DEL_NEXT_SEL) type = DEL_NEXT_CHAR;
+ else if (type == DEL_PREV_SEL) type = DEL_PREV_CHAR;
}
switch (type) {
case DEL_ALL:
cu->len = cu->pos = 0;
- ef->textbuf[0]= 0;
+ ef->textbuf[0] = 0;
break;
case DEL_SELECTION:
if (!kill_selection(obedit, 0))
return OPERATOR_CANCELLED;
break;
case DEL_PREV_CHAR:
- if (cu->pos<=0)
+ if (cu->pos <= 0)
return OPERATOR_CANCELLED;
- for (x=cu->pos;x<=cu->len;x++)
- ef->textbuf[x-1]= ef->textbuf[x];
- for (x=cu->pos;x<=cu->len;x++)
- ef->textbufinfo[x-1]= ef->textbufinfo[x];
+ for (x = cu->pos; x <= cu->len; x++)
+ ef->textbuf[x - 1] = ef->textbuf[x];
+ for (x = cu->pos; x <= cu->len; x++)
+ ef->textbufinfo[x - 1] = ef->textbufinfo[x];
cu->pos--;
- ef->textbuf[--cu->len]='\0';
+ ef->textbuf[--cu->len] = '\0';
break;
case DEL_NEXT_CHAR:
- if (cu->pos>=cu->len)
+ if (cu->pos >= cu->len)
return OPERATOR_CANCELLED;
- for (x=cu->pos;x<cu->len;x++)
- ef->textbuf[x]= ef->textbuf[x+1];
- for (x=cu->pos;x<cu->len;x++)
- ef->textbufinfo[x]= ef->textbufinfo[x+1];
+ for (x = cu->pos; x < cu->len; x++)
+ ef->textbuf[x] = ef->textbuf[x + 1];
+ for (x = cu->pos; x < cu->len; x++)
+ ef->textbufinfo[x] = ef->textbufinfo[x + 1];
- ef->textbuf[--cu->len]='\0';
+ ef->textbuf[--cu->len] = '\0';
break;
default:
return OPERATOR_CANCELLED;
@@ -1183,7 +1184,7 @@ void FONT_OT_delete(wmOperatorType *ot)
ot->poll = ED_operator_editfont;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
RNA_def_enum(ot->srna, "type", delete_type_items, DEL_ALL, "Type", "Which part of the text to delete");
@@ -1193,8 +1194,8 @@ void FONT_OT_delete(wmOperatorType *ot)
static int insert_text_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
- Object *obedit= CTX_data_edit_object(C);
+ Scene *scene = CTX_data_scene(C);
+ Object *obedit = CTX_data_edit_object(C);
char *inserted_utf8;
wchar_t *inserted_text;
int a, len;
@@ -1202,13 +1203,13 @@ static int insert_text_exec(bContext *C, wmOperator *op)
if (!RNA_struct_property_is_set(op->ptr, "text"))
return OPERATOR_CANCELLED;
- inserted_utf8= RNA_string_get_alloc(op->ptr, "text", NULL, 0);
- len= BLI_strlen_utf8(inserted_utf8);
+ inserted_utf8 = RNA_string_get_alloc(op->ptr, "text", NULL, 0);
+ len = BLI_strlen_utf8(inserted_utf8);
- inserted_text= MEM_callocN(sizeof(wchar_t)*(len+1), "FONT_insert_text");
- BLI_strncpy_wchar_from_utf8(inserted_text, inserted_utf8, len+1);
+ inserted_text = MEM_callocN(sizeof(wchar_t) * (len + 1), "FONT_insert_text");
+ BLI_strncpy_wchar_from_utf8(inserted_text, inserted_utf8, len + 1);
- for (a=0; a<len; a++)
+ for (a = 0; a < len; a++)
insert_into_textbuf(obedit, inserted_text[a]);
MEM_freeN(inserted_text);
@@ -1222,81 +1223,81 @@ static int insert_text_exec(bContext *C, wmOperator *op)
static int insert_text_invoke(bContext *C, wmOperator *op, wmEvent *evt)
{
- Scene *scene= CTX_data_scene(C);
- Object *obedit= CTX_data_edit_object(C);
- Curve *cu= obedit->data;
- EditFont *ef= cu->editfont;
- static int accentcode= 0;
+ Scene *scene = CTX_data_scene(C);
+ Object *obedit = CTX_data_edit_object(C);
+ Curve *cu = obedit->data;
+ EditFont *ef = cu->editfont;
+ static int accentcode = 0;
uintptr_t ascii = evt->ascii;
- int alt= evt->alt, shift= evt->shift, ctrl= evt->ctrl;
- int event= evt->type, val= evt->val;
- wchar_t inserted_text[2]= {0};
+ int alt = evt->alt, shift = evt->shift, ctrl = evt->ctrl;
+ int event = evt->type, val = evt->val;
+ wchar_t inserted_text[2] = {0};
if (RNA_struct_property_is_set(op->ptr, "text"))
return insert_text_exec(C, op);
if (RNA_struct_property_is_set(op->ptr, "accent")) {
- if (cu->len!=0 && cu->pos>0)
- accentcode= 1;
+ if (cu->len != 0 && cu->pos > 0)
+ accentcode = 1;
return OPERATOR_FINISHED;
}
/* tab should exit editmode, but we allow it to be typed using modifier keys */
- if (event==TABKEY) {
- if ((alt||ctrl||shift) == 0)
+ if (event == TABKEY) {
+ if ((alt || ctrl || shift) == 0)
return OPERATOR_PASS_THROUGH;
else
- ascii= 9;
+ ascii = 9;
}
- else if (event==BACKSPACEKEY)
- ascii= 0;
+ else if (event == BACKSPACEKEY)
+ ascii = 0;
if (val && (ascii || evt->utf8_buf[0])) {
/* handle case like TAB (== 9) */
if ( (ascii > 31 && ascii < 254 && ascii != 127) ||
- (ascii==13) ||
- (ascii==10) ||
- (ascii==8) ||
- (evt->utf8_buf[0]))
+ (ascii == 13) ||
+ (ascii == 10) ||
+ (ascii == 8) ||
+ (evt->utf8_buf[0]))
{
if (evt->utf8_buf[0]) {
BLI_strncpy_wchar_from_utf8(inserted_text, evt->utf8_buf, 1);
- ascii= inserted_text[0];
+ ascii = inserted_text[0];
insert_into_textbuf(obedit, ascii);
- accentcode= 0;
+ accentcode = 0;
}
else if (accentcode) {
- if (cu->pos>0) {
- inserted_text[0]= findaccent(ef->textbuf[cu->pos-1], ascii);
- ef->textbuf[cu->pos-1]= inserted_text[0];
+ if (cu->pos > 0) {
+ inserted_text[0] = findaccent(ef->textbuf[cu->pos - 1], ascii);
+ ef->textbuf[cu->pos - 1] = inserted_text[0];
}
- accentcode= 0;
+ accentcode = 0;
}
- else if (cu->len<MAXTEXT-1) {
+ else if (cu->len < MAXTEXT - 1) {
if (alt) {
/* might become obsolete, apple has default values for this, other OS's too? */
- if (ascii=='t') ascii= 137;
- else if (ascii=='c') ascii= 169;
- else if (ascii=='f') ascii= 164;
- else if (ascii=='g') ascii= 176;
- else if (ascii=='l') ascii= 163;
- else if (ascii=='r') ascii= 174;
- else if (ascii=='s') ascii= 223;
- else if (ascii=='y') ascii= 165;
- else if (ascii=='.') ascii= 138;
- else if (ascii=='1') ascii= 185;
- else if (ascii=='2') ascii= 178;
- else if (ascii=='3') ascii= 179;
- else if (ascii=='%') ascii= 139;
- else if (ascii=='?') ascii= 191;
- else if (ascii=='!') ascii= 161;
- else if (ascii=='x') ascii= 215;
- else if (ascii=='>') ascii= 187;
- else if (ascii=='<') ascii= 171;
+ if (ascii == 't') ascii = 137;
+ else if (ascii == 'c') ascii = 169;
+ else if (ascii == 'f') ascii = 164;
+ else if (ascii == 'g') ascii = 176;
+ else if (ascii == 'l') ascii = 163;
+ else if (ascii == 'r') ascii = 174;
+ else if (ascii == 's') ascii = 223;
+ else if (ascii == 'y') ascii = 165;
+ else if (ascii == '.') ascii = 138;
+ else if (ascii == '1') ascii = 185;
+ else if (ascii == '2') ascii = 178;
+ else if (ascii == '3') ascii = 179;
+ else if (ascii == '%') ascii = 139;
+ else if (ascii == '?') ascii = 191;
+ else if (ascii == '!') ascii = 161;
+ else if (ascii == 'x') ascii = 215;
+ else if (ascii == '>') ascii = 187;
+ else if (ascii == '<') ascii = 171;
}
- inserted_text[0]= ascii;
+ inserted_text[0] = ascii;
insert_into_textbuf(obedit, ascii);
}
@@ -1304,14 +1305,14 @@ static int insert_text_invoke(bContext *C, wmOperator *op, wmEvent *evt)
text_update_edited(C, scene, obedit, 1, FO_EDIT);
}
else {
- inserted_text[0]= ascii;
+ inserted_text[0] = ascii;
insert_into_textbuf(obedit, ascii);
text_update_edited(C, scene, obedit, 1, FO_EDIT);
}
}
else if (val && event == BACKSPACEKEY) {
- if (alt && cu->len!=0 && cu->pos>0)
- accentcode= 1;
+ if (alt && cu->len != 0 && cu->pos > 0)
+ accentcode = 1;
return OPERATOR_PASS_THROUGH;
}
@@ -1327,7 +1328,7 @@ static int insert_text_invoke(bContext *C, wmOperator *op, wmEvent *evt)
}
/* reset property? */
- accentcode= 0;
+ accentcode = 0;
return OPERATOR_FINISHED;
}
@@ -1345,7 +1346,7 @@ void FONT_OT_text_insert(wmOperatorType *ot)
ot->poll = ED_operator_editfont;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
RNA_def_string(ot->srna, "text", "", 0, "Text", "Text to insert at the cursor position");
@@ -1356,18 +1357,18 @@ void FONT_OT_text_insert(wmOperatorType *ot)
/*********************** textbox add operator *************************/
static int textbox_add_exec(bContext *C, wmOperator *UNUSED(op))
{
- Object *obedit= CTX_data_active_object(C);
- Curve *cu= obedit->data;
+ Object *obedit = CTX_data_active_object(C);
+ Curve *cu = obedit->data;
int i;
if (cu->totbox < 256) {
- for (i = cu->totbox; i>cu->actbox; i--) cu->tb[i]= cu->tb[i-1];
- cu->tb[cu->actbox]= cu->tb[cu->actbox-1];
+ for (i = cu->totbox; i > cu->actbox; i--) cu->tb[i] = cu->tb[i - 1];
+ cu->tb[cu->actbox] = cu->tb[cu->actbox - 1];
cu->actbox++;
cu->totbox++;
}
- WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+ WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
return OPERATOR_FINISHED;
}
@@ -1383,7 +1384,7 @@ void FONT_OT_textbox_add(wmOperatorType *ot)
ot->poll = ED_operator_object_active_editable_font;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
@@ -1396,20 +1397,20 @@ void FONT_OT_textbox_add(wmOperatorType *ot)
static int textbox_remove_exec(bContext *C, wmOperator *op)
{
- Object *obedit= CTX_data_active_object(C);
- Curve *cu= obedit->data;
+ Object *obedit = CTX_data_active_object(C);
+ Curve *cu = obedit->data;
int i;
int index = RNA_int_get(op->ptr, "index");
if (cu->totbox > 1) {
- for (i = index; i < cu->totbox; i++) cu->tb[i]= cu->tb[i+1];
+ for (i = index; i < cu->totbox; i++) cu->tb[i] = cu->tb[i + 1];
cu->totbox--;
if (cu->actbox >= index)
cu->actbox--;
}
- WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+ WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
return OPERATOR_FINISHED;
}
@@ -1426,7 +1427,7 @@ void FONT_OT_textbox_remove(wmOperatorType *ot)
ot->poll = ED_operator_object_active_editable_font;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_int(ot->srna, "index", 0, 0, INT_MAX, "Index", "The current text box", 0, INT_MAX);
}
@@ -1437,33 +1438,33 @@ void FONT_OT_textbox_remove(wmOperatorType *ot)
void make_editText(Object *obedit)
{
- Curve *cu= obedit->data;
- EditFont *ef= cu->editfont;
+ Curve *cu = obedit->data;
+ EditFont *ef = cu->editfont;
- if (ef==NULL) {
- ef= cu->editfont= MEM_callocN(sizeof(EditFont), "editfont");
+ if (ef == NULL) {
+ ef = cu->editfont = MEM_callocN(sizeof(EditFont), "editfont");
- ef->textbuf= MEM_callocN((MAXTEXT+4)*sizeof(wchar_t), "texteditbuf");
- ef->textbufinfo= MEM_callocN((MAXTEXT+4)*sizeof(CharInfo), "texteditbufinfo");
- ef->copybuf= MEM_callocN((MAXTEXT+4)*sizeof(wchar_t), "texteditcopybuf");
- ef->copybufinfo= MEM_callocN((MAXTEXT+4)*sizeof(CharInfo), "texteditcopybufinfo");
- ef->oldstr= MEM_callocN((MAXTEXT+4)*sizeof(wchar_t), "oldstrbuf");
- ef->oldstrinfo= MEM_callocN((MAXTEXT+4)*sizeof(CharInfo), "oldstrbuf");
+ ef->textbuf = MEM_callocN((MAXTEXT + 4) * sizeof(wchar_t), "texteditbuf");
+ ef->textbufinfo = MEM_callocN((MAXTEXT + 4) * sizeof(CharInfo), "texteditbufinfo");
+ ef->copybuf = MEM_callocN((MAXTEXT + 4) * sizeof(wchar_t), "texteditcopybuf");
+ ef->copybufinfo = MEM_callocN((MAXTEXT + 4) * sizeof(CharInfo), "texteditcopybufinfo");
+ ef->oldstr = MEM_callocN((MAXTEXT + 4) * sizeof(wchar_t), "oldstrbuf");
+ ef->oldstrinfo = MEM_callocN((MAXTEXT + 4) * sizeof(CharInfo), "oldstrbuf");
}
// Convert the original text to wchar_t
- BLI_strncpy_wchar_from_utf8(ef->textbuf, cu->str, MAXTEXT+4); /* length is bogus */
+ BLI_strncpy_wchar_from_utf8(ef->textbuf, cu->str, MAXTEXT + 4); /* length is bogus */
wcscpy(ef->oldstr, ef->textbuf);
- cu->len= wcslen(ef->textbuf);
+ cu->len = wcslen(ef->textbuf);
- memcpy(ef->textbufinfo, cu->strinfo, (cu->len)*sizeof(CharInfo));
- memcpy(ef->oldstrinfo, cu->strinfo, (cu->len)*sizeof(CharInfo));
+ memcpy(ef->textbufinfo, cu->strinfo, (cu->len) * sizeof(CharInfo));
+ memcpy(ef->oldstrinfo, cu->strinfo, (cu->len) * sizeof(CharInfo));
- if (cu->pos>cu->len) cu->pos= cu->len;
+ if (cu->pos > cu->len) cu->pos = cu->len;
if (cu->pos)
- cu->curinfo = ef->textbufinfo[cu->pos-1];
+ cu->curinfo = ef->textbufinfo[cu->pos - 1];
else
cu->curinfo = ef->textbufinfo[0];
@@ -1473,28 +1474,28 @@ void make_editText(Object *obedit)
void load_editText(Object *obedit)
{
- Curve *cu= obedit->data;
- EditFont *ef= cu->editfont;
+ Curve *cu = obedit->data;
+ EditFont *ef = cu->editfont;
MEM_freeN(ef->oldstr);
- ef->oldstr= NULL;
+ ef->oldstr = NULL;
MEM_freeN(ef->oldstrinfo);
- ef->oldstrinfo= NULL;
+ ef->oldstrinfo = NULL;
update_string(cu);
if (cu->strinfo)
MEM_freeN(cu->strinfo);
- cu->strinfo= MEM_callocN((cu->len+4)*sizeof(CharInfo), "texteditinfo");
- memcpy(cu->strinfo, ef->textbufinfo, (cu->len)*sizeof(CharInfo));
+ cu->strinfo = MEM_callocN((cu->len + 4) * sizeof(CharInfo), "texteditinfo");
+ memcpy(cu->strinfo, ef->textbufinfo, (cu->len) * sizeof(CharInfo));
- cu->len= strlen(cu->str);
+ cu->len = strlen(cu->str);
/* this memory system is weak... */
if (cu->selboxes) {
MEM_freeN(cu->selboxes);
- cu->selboxes= NULL;
+ cu->selboxes = NULL;
}
}
@@ -1505,35 +1506,35 @@ void free_editText(Object *obedit)
/********************** set case operator *********************/
-static EnumPropertyItem case_items[]= {
+static EnumPropertyItem case_items[] = {
{CASE_LOWER, "LOWER", 0, "Lower", ""},
{CASE_UPPER, "UPPER", 0, "Upper", ""},
{0, NULL, 0, NULL, NULL}};
static int set_case(bContext *C, int ccase)
{
- Scene *scene= CTX_data_scene(C);
- Object *obedit= CTX_data_edit_object(C);
- Curve *cu= obedit->data;
- EditFont *ef= cu->editfont;
+ Scene *scene = CTX_data_scene(C);
+ Object *obedit = CTX_data_edit_object(C);
+ Curve *cu = obedit->data;
+ EditFont *ef = cu->editfont;
wchar_t *str;
int len;
- len= wcslen(ef->textbuf);
- str= ef->textbuf;
+ len = wcslen(ef->textbuf);
+ str = ef->textbuf;
while (len) {
- if (*str>='a' && *str<='z')
- *str-= 32;
+ if (*str >= 'a' && *str <= 'z')
+ *str -= 32;
len--;
str++;
}
if (ccase == CASE_LOWER) {
- len= wcslen(ef->textbuf);
- str= ef->textbuf;
+ len = wcslen(ef->textbuf);
+ str = ef->textbuf;
while (len) {
- if (*str>='A' && *str<='Z') {
- *str+= 32;
+ if (*str >= 'A' && *str <= 'Z') {
+ *str += 32;
}
len--;
str++;
@@ -1562,7 +1563,7 @@ void FONT_OT_case_set(wmOperatorType *ot)
ot->poll = ED_operator_editfont;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
RNA_def_enum(ot->srna, "case", case_items, CASE_LOWER, "Case", "Lower or upper case");
@@ -1572,17 +1573,17 @@ void FONT_OT_case_set(wmOperatorType *ot)
static int toggle_case_exec(bContext *C, wmOperator *UNUSED(op))
{
- Object *obedit= CTX_data_edit_object(C);
- Curve *cu= obedit->data;
- EditFont *ef= cu->editfont;
+ Object *obedit = CTX_data_edit_object(C);
+ Curve *cu = obedit->data;
+ EditFont *ef = cu->editfont;
wchar_t *str;
- int len, ccase= CASE_UPPER;
+ int len, ccase = CASE_UPPER;
- len= wcslen(ef->textbuf);
- str= ef->textbuf;
+ len = wcslen(ef->textbuf);
+ str = ef->textbuf;
while (len) {
- if (*str>='a' && *str<='z') {
- ccase= CASE_LOWER;
+ if (*str >= 'a' && *str <= 'z') {
+ ccase = CASE_LOWER;
break;
}
@@ -1605,7 +1606,7 @@ void FONT_OT_case_toggle(wmOperatorType *ot)
ot->poll = ED_operator_editfont;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* **************** Open Font ************** */
@@ -1614,27 +1615,27 @@ static void font_ui_template_init(bContext *C, wmOperator *op)
{
PropertyPointerRNA *pprop;
- op->customdata= pprop= MEM_callocN(sizeof(PropertyPointerRNA), "OpenPropertyPointerRNA");
+ op->customdata = pprop = MEM_callocN(sizeof(PropertyPointerRNA), "OpenPropertyPointerRNA");
uiIDContextProperty(C, &pprop->ptr, &pprop->prop);
}
static int font_open_cancel(bContext *UNUSED(C), wmOperator *op)
{
MEM_freeN(op->customdata);
- op->customdata= NULL;
+ op->customdata = NULL;
return OPERATOR_CANCELLED;
}
static int font_open_exec(bContext *C, wmOperator *op)
{
- struct Main *bmain= CTX_data_main(C);
+ struct Main *bmain = CTX_data_main(C);
VFont *font;
PropertyPointerRNA *pprop;
PointerRNA idptr;
char filepath[FILE_MAX];
RNA_string_get(op->ptr, "filepath", filepath);
- font= BKE_vfont_load(bmain, filepath);
+ font = BKE_vfont_load(bmain, filepath);
if (!font) {
if (op->customdata) MEM_freeN(op->customdata);
@@ -1645,7 +1646,7 @@ static int font_open_exec(bContext *C, wmOperator *op)
font_ui_template_init(C, op);
/* hook into UI */
- pprop= op->customdata;
+ pprop = op->customdata;
if (pprop->prop) {
/* when creating new ID blocks, use is already 1, but RNA
@@ -1664,7 +1665,7 @@ static int font_open_exec(bContext *C, wmOperator *op)
static int open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
- VFont *font=NULL;
+ VFont *font = NULL;
char *path;
PointerRNA idptr;
@@ -1673,14 +1674,14 @@ static int open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
font_ui_template_init(C, op);
/* hook into UI */
- pprop= op->customdata;
+ pprop = op->customdata;
if (pprop->prop) {
- idptr= RNA_property_pointer_get((PointerRNA *)pprop, pprop->prop);
- font= idptr.id.data;
+ idptr = RNA_property_pointer_get((PointerRNA *)pprop, pprop->prop);
+ font = idptr.id.data;
}
- path = (font && strcmp(font->name, FO_BUILTIN_NAME) != 0)? font->name: U.fontdir;
+ path = (font && strcmp(font->name, FO_BUILTIN_NAME) != 0) ? font->name : U.fontdir;
if (RNA_struct_property_is_set(op->ptr, "filepath"))
return font_open_exec(C, op);
@@ -1704,10 +1705,10 @@ void FONT_OT_open(wmOperatorType *ot)
ot->cancel = font_open_cancel;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
- WM_operator_properties_filesel(ot, FOLDERFILE|FTFONTFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
+ WM_operator_properties_filesel(ot, FOLDERFILE | FTFONTFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
}
/******************* delete operator *********************/
@@ -1721,7 +1722,7 @@ static int font_unlink_exec(bContext *C, wmOperator *op)
uiIDContextProperty(C, &pprop.ptr, &pprop.prop);
- if (pprop.prop==NULL) {
+ if (pprop.prop == NULL) {
BKE_report(op->reports, RPT_ERROR, "Incorrect context for running font unlink");
return OPERATOR_CANCELLED;
}
@@ -1751,15 +1752,15 @@ void FONT_OT_unlink(wmOperatorType *ot)
static void undoFont_to_editFont(void *strv, void *ecu, void *UNUSED(obdata))
{
- Curve *cu= (Curve *)ecu;
- EditFont *ef= cu->editfont;
- char *str= strv;
+ Curve *cu = (Curve *)ecu;
+ EditFont *ef = cu->editfont;
+ char *str = strv;
- cu->pos= *((short *)str);
- cu->len= *((short *)(str+2));
+ cu->pos = *((short *)str);
+ cu->len = *((short *)(str + 2));
- memcpy(ef->textbuf, str+4, (cu->len+1)*sizeof(wchar_t));
- memcpy(ef->textbufinfo, str+4 + (cu->len+1)*sizeof(wchar_t), cu->len*sizeof(CharInfo));
+ memcpy(ef->textbuf, str + 4, (cu->len + 1) * sizeof(wchar_t));
+ memcpy(ef->textbufinfo, str + 4 + (cu->len + 1) * sizeof(wchar_t), cu->len * sizeof(CharInfo));
cu->selstart = cu->selend = 0;
@@ -1768,19 +1769,19 @@ static void undoFont_to_editFont(void *strv, void *ecu, void *UNUSED(obdata))
static void *editFont_to_undoFont(void *ecu, void *UNUSED(obdata))
{
- Curve *cu= (Curve *)ecu;
- EditFont *ef= cu->editfont;
+ Curve *cu = (Curve *)ecu;
+ EditFont *ef = cu->editfont;
char *str;
// The undo buffer includes [MAXTEXT+6]=actual string and [MAXTEXT+4]*sizeof(CharInfo)=charinfo
- str= MEM_callocN((MAXTEXT+6)*sizeof(wchar_t) + (MAXTEXT+4)*sizeof(CharInfo), "string undo");
+ str = MEM_callocN((MAXTEXT + 6) * sizeof(wchar_t) + (MAXTEXT + 4) * sizeof(CharInfo), "string undo");
// Copy the string and string information
- memcpy(str+4, ef->textbuf, (cu->len+1)*sizeof(wchar_t));
- memcpy(str+4 + (cu->len+1)*sizeof(wchar_t), ef->textbufinfo, cu->len*sizeof(CharInfo));
+ memcpy(str + 4, ef->textbuf, (cu->len + 1) * sizeof(wchar_t));
+ memcpy(str + 4 + (cu->len + 1) * sizeof(wchar_t), ef->textbufinfo, cu->len * sizeof(CharInfo));
- *((short *)str)= cu->pos;
- *((short *)(str+2))= cu->len;
+ *((short *)str) = cu->pos;
+ *((short *)(str + 2)) = cu->len;
return str;
}
@@ -1792,8 +1793,8 @@ static void free_undoFont(void *strv)
static void *get_undoFont(bContext *C)
{
- Object *obedit= CTX_data_edit_object(C);
- if (obedit && obedit->type==OB_FONT) {
+ Object *obedit = CTX_data_edit_object(C);
+ if (obedit && obedit->type == OB_FONT) {
return obedit->data;
}
return NULL;
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index bb534d2b916..52e1f90606f 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -78,35 +78,35 @@
#include "wm_window.h"
-#include "screen_intern.h" /* own module include */
+#include "screen_intern.h" /* own module include */
-#define KM_MODAL_CANCEL 1
-#define KM_MODAL_APPLY 2
-#define KM_MODAL_STEP10 3
-#define KM_MODAL_STEP10_OFF 4
+#define KM_MODAL_CANCEL 1
+#define KM_MODAL_APPLY 2
+#define KM_MODAL_STEP10 3
+#define KM_MODAL_STEP10_OFF 4
/* ************** Exported Poll tests ********************** */
int ED_operator_regionactive(bContext *C)
{
- if (CTX_wm_window(C)==NULL) return 0;
- if (CTX_wm_screen(C)==NULL) return 0;
- if (CTX_wm_region(C)==NULL) return 0;
+ if (CTX_wm_window(C) == NULL) return 0;
+ if (CTX_wm_screen(C) == NULL) return 0;
+ if (CTX_wm_region(C) == NULL) return 0;
return 1;
}
int ED_operator_areaactive(bContext *C)
{
- if (CTX_wm_window(C)==NULL) return 0;
- if (CTX_wm_screen(C)==NULL) return 0;
- if (CTX_wm_area(C)==NULL) return 0;
+ if (CTX_wm_window(C) == NULL) return 0;
+ if (CTX_wm_screen(C) == NULL) return 0;
+ if (CTX_wm_area(C) == NULL) return 0;
return 1;
}
int ED_operator_screenactive(bContext *C)
{
- if (CTX_wm_window(C)==NULL) return 0;
- if (CTX_wm_screen(C)==NULL) return 0;
+ if (CTX_wm_window(C) == NULL) return 0;
+ if (CTX_wm_screen(C) == NULL) return 0;
return 1;
}
@@ -114,8 +114,8 @@ int ED_operator_screenactive(bContext *C)
static int ED_operator_screenactive_norender(bContext *C)
{
if (G.rendering) return 0;
- if (CTX_wm_window(C)==NULL) return 0;
- if (CTX_wm_screen(C)==NULL) return 0;
+ if (CTX_wm_window(C) == NULL) return 0;
+ if (CTX_wm_screen(C) == NULL) return 0;
return 1;
}
@@ -134,28 +134,28 @@ static int screen_active_editable(bContext *C)
/* when mouse is over area-edge */
int ED_operator_screen_mainwinactive(bContext *C)
{
- if (CTX_wm_window(C)==NULL) return 0;
- if (CTX_wm_screen(C)==NULL) return 0;
- if (CTX_wm_screen(C)->subwinactive!=CTX_wm_screen(C)->mainwin) return 0;
+ if (CTX_wm_window(C) == NULL) return 0;
+ if (CTX_wm_screen(C) == NULL) return 0;
+ if (CTX_wm_screen(C)->subwinactive != CTX_wm_screen(C)->mainwin) return 0;
return 1;
}
int ED_operator_scene_editable(bContext *C)
{
- Scene *scene= CTX_data_scene(C);
- if (scene && scene->id.lib==NULL)
+ Scene *scene = CTX_data_scene(C);
+ if (scene && scene->id.lib == NULL)
return 1;
return 0;
}
int ED_operator_objectmode(bContext *C)
{
- Scene *scene= CTX_data_scene(C);
- Object *obact= CTX_data_active_object(C);
+ Scene *scene = CTX_data_scene(C);
+ Object *obact = CTX_data_active_object(C);
- if (scene==NULL || scene->id.lib)
+ if (scene == NULL || scene->id.lib)
return 0;
- if ( CTX_data_edit_object(C) )
+ if (CTX_data_edit_object(C) )
return 0;
/* add a check for ob->mode too? */
@@ -169,7 +169,7 @@ int ED_operator_objectmode(bContext *C)
static int ed_spacetype_test(bContext *C, int type)
{
if (ED_operator_areaactive(C)) {
- SpaceLink *sl= (SpaceLink *)CTX_wm_space_data(C);
+ SpaceLink *sl = (SpaceLink *)CTX_wm_space_data(C);
return sl && (sl->spacetype == type);
}
return 0;
@@ -193,7 +193,7 @@ int ED_operator_region_view3d_active(bContext *C)
int ED_operator_animview_active(bContext *C)
{
if (ED_operator_areaactive(C)) {
- SpaceLink *sl= (SpaceLink *)CTX_wm_space_data(C);
+ SpaceLink *sl = (SpaceLink *)CTX_wm_space_data(C);
if (sl && (ELEM5(sl->spacetype, SPACE_SEQ, SPACE_ACTION, SPACE_NLA, SPACE_IPO, SPACE_TIME)))
return TRUE;
}
@@ -216,7 +216,7 @@ int ED_operator_outliner_active_no_editobject(bContext *C)
{
if (ed_spacetype_test(C, SPACE_OUTLINER)) {
Object *ob = ED_object_active_context(C);
- Object *obedit= CTX_data_edit_object(C);
+ Object *obedit = CTX_data_edit_object(C);
if (ob && ob == obedit)
return 0;
else
@@ -242,7 +242,7 @@ int ED_operator_buttons_active(bContext *C)
int ED_operator_node_active(bContext *C)
{
- SpaceNode *snode= CTX_wm_space_node(C);
+ SpaceNode *snode = CTX_wm_space_node(C);
if (snode && snode->edittree)
return 1;
@@ -313,8 +313,8 @@ int ED_operator_object_active_editable_font(bContext *C)
int ED_operator_editmesh(bContext *C)
{
- Object *obedit= CTX_data_edit_object(C);
- if (obedit && obedit->type==OB_MESH)
+ Object *obedit = CTX_data_edit_object(C);
+ if (obedit && obedit->type == OB_MESH)
return NULL != BMEdit_FromObject(obedit);
return 0;
}
@@ -335,19 +335,19 @@ int ED_operator_editmesh_region_view3d(bContext *C)
int ED_operator_editarmature(bContext *C)
{
- Object *obedit= CTX_data_edit_object(C);
- if (obedit && obedit->type==OB_ARMATURE)
+ Object *obedit = CTX_data_edit_object(C);
+ if (obedit && obedit->type == OB_ARMATURE)
return NULL != ((bArmature *)obedit->data)->edbo;
return 0;
}
int ED_operator_posemode(bContext *C)
{
- Object *obact= CTX_data_active_object(C);
+ Object *obact = CTX_data_active_object(C);
if (obact && !(obact->mode & OB_MODE_EDIT)) {
Object *obpose;
- if ((obpose= BKE_object_pose_armature_get(obact))) {
+ if ((obpose = BKE_object_pose_armature_get(obact))) {
if ((obact == obpose) || (obact->mode & OB_MODE_WEIGHT_PAINT)) {
return 1;
}
@@ -360,8 +360,8 @@ int ED_operator_posemode(bContext *C)
/* wrapper for ED_space_image_show_uvedit */
int ED_operator_uvedit(bContext *C)
{
- SpaceImage *sima= CTX_wm_space_image(C);
- Object *obedit= CTX_data_edit_object(C);
+ SpaceImage *sima = CTX_wm_space_image(C);
+ Object *obedit = CTX_data_edit_object(C);
return ED_space_image_show_uvedit(sima, obedit);
}
@@ -383,7 +383,7 @@ int ED_operator_uvmap(bContext *C)
int ED_operator_editsurfcurve(bContext *C)
{
- Object *obedit= CTX_data_edit_object(C);
+ Object *obedit = CTX_data_edit_object(C);
if (obedit && ELEM(obedit->type, OB_CURVE, OB_SURF))
return NULL != ((Curve *)obedit->data)->editnurb;
return 0;
@@ -400,51 +400,51 @@ int ED_operator_editsurfcurve_region_view3d(bContext *C)
int ED_operator_editcurve(bContext *C)
{
- Object *obedit= CTX_data_edit_object(C);
- if (obedit && obedit->type==OB_CURVE)
+ Object *obedit = CTX_data_edit_object(C);
+ if (obedit && obedit->type == OB_CURVE)
return NULL != ((Curve *)obedit->data)->editnurb;
return 0;
}
int ED_operator_editcurve_3d(bContext *C)
{
- Object *obedit= CTX_data_edit_object(C);
- if (obedit && obedit->type==OB_CURVE) {
- Curve *cu= (Curve *)obedit->data;
+ Object *obedit = CTX_data_edit_object(C);
+ if (obedit && obedit->type == OB_CURVE) {
+ Curve *cu = (Curve *)obedit->data;
- return (cu->flag&CU_3D) && (NULL != cu->editnurb);
+ return (cu->flag & CU_3D) && (NULL != cu->editnurb);
}
return 0;
}
int ED_operator_editsurf(bContext *C)
{
- Object *obedit= CTX_data_edit_object(C);
- if (obedit && obedit->type==OB_SURF)
+ Object *obedit = CTX_data_edit_object(C);
+ if (obedit && obedit->type == OB_SURF)
return NULL != ((Curve *)obedit->data)->editnurb;
return 0;
}
int ED_operator_editfont(bContext *C)
{
- Object *obedit= CTX_data_edit_object(C);
- if (obedit && obedit->type==OB_FONT)
+ Object *obedit = CTX_data_edit_object(C);
+ if (obedit && obedit->type == OB_FONT)
return NULL != ((Curve *)obedit->data)->editfont;
return 0;
}
int ED_operator_editlattice(bContext *C)
{
- Object *obedit= CTX_data_edit_object(C);
- if (obedit && obedit->type==OB_LATTICE)
+ Object *obedit = CTX_data_edit_object(C);
+ if (obedit && obedit->type == OB_LATTICE)
return NULL != ((Lattice *)obedit->data)->editlatt;
return 0;
}
int ED_operator_editmball(bContext *C)
{
- Object *obedit= CTX_data_edit_object(C);
- if (obedit && obedit->type==OB_MBALL)
+ Object *obedit = CTX_data_edit_object(C);
+ if (obedit && obedit->type == OB_MBALL)
return NULL != ((MetaBall *)obedit->data)->editelems;
return 0;
}
@@ -482,11 +482,11 @@ typedef struct sActionzoneData {
/* used by other operators too */
static ScrArea *screen_areahascursor(bScreen *scr, int x, int y)
{
- ScrArea *sa= NULL;
- sa= scr->areabase.first;
+ ScrArea *sa = NULL;
+ sa = scr->areabase.first;
while (sa) {
if (BLI_in_rcti(&sa->totrct, x, y)) break;
- sa= sa->next;
+ sa = sa->next;
}
return sa;
@@ -495,15 +495,15 @@ static ScrArea *screen_areahascursor(bScreen *scr, int x, int y)
/* quick poll to save operators to be created and handled */
static int actionzone_area_poll(bContext *C)
{
- wmWindow *win= CTX_wm_window(C);
- ScrArea *sa= CTX_wm_area(C);
+ wmWindow *win = CTX_wm_window(C);
+ ScrArea *sa = CTX_wm_area(C);
if (sa && win) {
AZone *az;
- int x= win->eventstate->x;
- int y= win->eventstate->y;
+ int x = win->eventstate->x;
+ int y = win->eventstate->y;
- for (az= sa->actionzones.first; az; az= az->next)
+ for (az = sa->actionzones.first; az; az = az->next)
if (BLI_in_rcti(&az->rect, x, y))
return 1;
}
@@ -512,15 +512,15 @@ static int actionzone_area_poll(bContext *C)
AZone *is_in_area_actionzone(ScrArea *sa, int x, int y)
{
- AZone *az= NULL;
+ AZone *az = NULL;
- for (az= sa->actionzones.first; az; az= az->next) {
+ for (az = sa->actionzones.first; az; az = az->next) {
if (BLI_in_rcti(&az->rect, x, y)) {
if (az->type == AZONE_AREA) {
/* no triangle intersect but a hotspot circle based on corner */
- int radius= (x-az->x1)*(x-az->x1) + (y-az->y1)*(y-az->y1);
+ int radius = (x - az->x1) * (x - az->x1) + (y - az->y1) * (y - az->y1);
- if (radius <= AZONESPOT*AZONESPOT)
+ if (radius <= AZONESPOT * AZONESPOT)
break;
}
else if (az->type == AZONE_REGION) {
@@ -537,47 +537,47 @@ static void actionzone_exit(wmOperator *op)
{
if (op->customdata)
MEM_freeN(op->customdata);
- op->customdata= NULL;
+ op->customdata = NULL;
}
/* send EVT_ACTIONZONE event */
static void actionzone_apply(bContext *C, wmOperator *op, int type)
{
wmEvent event;
- wmWindow *win= CTX_wm_window(C);
- sActionzoneData *sad= op->customdata;
+ wmWindow *win = CTX_wm_window(C);
+ sActionzoneData *sad = op->customdata;
- sad->modifier= RNA_int_get(op->ptr, "modifier");
+ sad->modifier = RNA_int_get(op->ptr, "modifier");
- event= *(win->eventstate); /* XXX huh huh? make api call */
- if (type==AZONE_AREA)
- event.type= EVT_ACTIONZONE_AREA;
+ event = *(win->eventstate); /* XXX huh huh? make api call */
+ if (type == AZONE_AREA)
+ event.type = EVT_ACTIONZONE_AREA;
else
- event.type= EVT_ACTIONZONE_REGION;
- event.customdata= op->customdata;
- event.customdatafree= TRUE;
- op->customdata= NULL;
+ event.type = EVT_ACTIONZONE_REGION;
+ event.customdata = op->customdata;
+ event.customdatafree = TRUE;
+ op->customdata = NULL;
wm_event_add(win, &event);
}
static int actionzone_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- AZone *az= is_in_area_actionzone(CTX_wm_area(C), event->x, event->y);
+ AZone *az = is_in_area_actionzone(CTX_wm_area(C), event->x, event->y);
sActionzoneData *sad;
/* quick escape */
- if (az==NULL)
+ if (az == NULL)
return OPERATOR_PASS_THROUGH;
/* ok we do the actionzone */
- sad= op->customdata= MEM_callocN(sizeof(sActionzoneData), "sActionzoneData");
- sad->sa1= CTX_wm_area(C);
- sad->az= az;
- sad->x= event->x; sad->y= event->y;
+ sad = op->customdata = MEM_callocN(sizeof(sActionzoneData), "sActionzoneData");
+ sad->sa1 = CTX_wm_area(C);
+ sad->az = az;
+ sad->x = event->x; sad->y = event->y;
/* region azone directly reacts on mouse clicks */
- if (sad->az->type==AZONE_REGION) {
+ if (sad->az->type == AZONE_REGION) {
actionzone_apply(C, op, AZONE_REGION);
actionzone_exit(op);
return OPERATOR_FINISHED;
@@ -593,30 +593,30 @@ static int actionzone_invoke(bContext *C, wmOperator *op, wmEvent *event)
static int actionzone_modal(bContext *C, wmOperator *op, wmEvent *event)
{
- sActionzoneData *sad= op->customdata;
+ sActionzoneData *sad = op->customdata;
int deltax, deltay;
- int mindelta= sad->az->type==AZONE_REGION?1:12;
+ int mindelta = sad->az->type == AZONE_REGION ? 1 : 12;
switch (event->type) {
case MOUSEMOVE:
/* calculate gesture direction */
- deltax= (event->x - sad->x);
- deltay= (event->y - sad->y);
+ deltax = (event->x - sad->x);
+ deltay = (event->y - sad->y);
if (deltay > ABS(deltax))
- sad->gesture_dir= 'n';
+ sad->gesture_dir = 'n';
else if (deltax > ABS(deltay))
- sad->gesture_dir= 'e';
+ sad->gesture_dir = 'e';
else if (deltay < -ABS(deltax))
- sad->gesture_dir= 's';
+ sad->gesture_dir = 's';
else
- sad->gesture_dir= 'w';
+ sad->gesture_dir = 'w';
/* gesture is large enough? */
if (ABS(deltax) > mindelta || ABS(deltay) > mindelta) {
/* second area, for join */
- sad->sa2= screen_areahascursor(CTX_wm_screen(C), event->x, event->y);
+ sad->sa2 = screen_areahascursor(CTX_wm_screen(C), event->x, event->y);
/* apply sends event */
actionzone_apply(C, op, sad->az->type);
actionzone_exit(op);
@@ -688,16 +688,16 @@ typedef struct sAreaSwapData {
static int area_swap_init(wmOperator *op, wmEvent *event)
{
- sAreaSwapData *sd= NULL;
- sActionzoneData *sad= event->customdata;
+ sAreaSwapData *sd = NULL;
+ sActionzoneData *sad = event->customdata;
- if (sad==NULL || sad->sa1==NULL)
+ if (sad == NULL || sad->sa1 == NULL)
return 0;
- sd= MEM_callocN(sizeof(sAreaSwapData), "sAreaSwapData");
- sd->sa1= sad->sa1;
- sd->sa2= sad->sa2;
- op->customdata= sd;
+ sd = MEM_callocN(sizeof(sAreaSwapData), "sAreaSwapData");
+ sd->sa1 = sad->sa1;
+ sd->sa2 = sad->sa2;
+ op->customdata = sd;
return 1;
}
@@ -708,7 +708,7 @@ static void area_swap_exit(bContext *C, wmOperator *op)
WM_cursor_restore(CTX_wm_window(C));
if (op->customdata)
MEM_freeN(op->customdata);
- op->customdata= NULL;
+ op->customdata = NULL;
}
static int area_swap_cancel(bContext *C, wmOperator *op)
@@ -733,15 +733,15 @@ static int area_swap_invoke(bContext *C, wmOperator *op, wmEvent *event)
static int area_swap_modal(bContext *C, wmOperator *op, wmEvent *event)
{
- sActionzoneData *sad= op->customdata;
+ sActionzoneData *sad = op->customdata;
switch (event->type) {
case MOUSEMOVE:
/* second area, for join */
- sad->sa2= screen_areahascursor(CTX_wm_screen(C), event->x, event->y);
+ sad->sa2 = screen_areahascursor(CTX_wm_screen(C), event->x, event->y);
break;
case LEFTMOUSE: /* release LMB */
- if (event->val==KM_RELEASE) {
+ if (event->val == KM_RELEASE) {
if (!sad->sa2 || sad->sa1 == sad->sa2) {
return area_swap_cancel(C, op);
@@ -754,7 +754,7 @@ static int area_swap_modal(bContext *C, wmOperator *op, wmEvent *event)
area_swap_exit(C, op);
- WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL);
return OPERATOR_FINISHED;
}
@@ -790,35 +790,35 @@ static int area_dupli_invoke(bContext *C, wmOperator *op, wmEvent *event)
ScrArea *sa;
rcti rect;
- win= CTX_wm_window(C);
- sc= CTX_wm_screen(C);
- sa= CTX_wm_area(C);
+ win = CTX_wm_window(C);
+ sc = CTX_wm_screen(C);
+ sa = CTX_wm_area(C);
/* XXX hrmf! */
- if (event->type==EVT_ACTIONZONE_AREA) {
- sActionzoneData *sad= event->customdata;
+ if (event->type == EVT_ACTIONZONE_AREA) {
+ sActionzoneData *sad = event->customdata;
- if (sad==NULL)
+ if (sad == NULL)
return OPERATOR_PASS_THROUGH;
- sa= sad->sa1;
+ sa = sad->sa1;
}
/* poll() checks area context, but we don't accept full-area windows */
if (sc->full != SCREENNORMAL) {
- if (event->type==EVT_ACTIONZONE_AREA)
+ if (event->type == EVT_ACTIONZONE_AREA)
actionzone_exit(op);
return OPERATOR_CANCELLED;
}
/* adds window to WM */
- rect= sa->totrct;
+ rect = sa->totrct;
BLI_translate_rcti(&rect, win->posx, win->posy);
- newwin= WM_window_open(C, &rect);
+ newwin = WM_window_open(C, &rect);
/* allocs new screen and adds to newly created window, using window size */
- newsc= ED_screen_add(newwin, CTX_data_scene(C), sc->id.name+2);
- newwin->screen= newsc;
+ newsc = ED_screen_add(newwin, CTX_data_scene(C), sc->id.name + 2);
+ newwin->screen = newsc;
/* copy area to new screen */
area_copy_data((ScrArea *)newsc->areabase.first, sa, 0);
@@ -826,9 +826,9 @@ static int area_dupli_invoke(bContext *C, wmOperator *op, wmEvent *event)
ED_area_tag_redraw((ScrArea *)newsc->areabase.first);
/* screen, areas init */
- WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL);
- if (event->type==EVT_ACTIONZONE_AREA)
+ if (event->type == EVT_ACTIONZONE_AREA)
actionzone_exit(op);
return OPERATOR_FINISHED;
@@ -848,7 +848,7 @@ static void SCREEN_OT_area_dupli(wmOperatorType *ot)
/* ************** move area edge operator *********************************** */
/* operator state vars used:
- * x, y mouse coord near edge
+ * x, y mouse coord near edge
* delta movement of edge
*
* functions:
@@ -884,56 +884,56 @@ typedef struct sAreaMoveData {
static void area_move_set_limits(bScreen *sc, int dir, int *bigger, int *smaller)
{
ScrArea *sa;
- int areaminy= ED_area_headersize()+1;
+ int areaminy = ED_area_headersize() + 1;
/* we check all areas and test for free space with MINSIZE */
- *bigger= *smaller= 100000;
+ *bigger = *smaller = 100000;
- for (sa= sc->areabase.first; sa; sa= sa->next) {
- if (dir=='h') {
- int y1= sa->v2->vec.y - sa->v1->vec.y-areaminy;
+ for (sa = sc->areabase.first; sa; sa = sa->next) {
+ if (dir == 'h') {
+ int y1 = sa->v2->vec.y - sa->v1->vec.y - areaminy;
/* if top or down edge selected, test height */
if (sa->v1->flag && sa->v4->flag)
- *bigger= MIN2(*bigger, y1);
+ *bigger = MIN2(*bigger, y1);
else if (sa->v2->flag && sa->v3->flag)
- *smaller= MIN2(*smaller, y1);
+ *smaller = MIN2(*smaller, y1);
}
else {
- int x1= sa->v4->vec.x - sa->v1->vec.x-AREAMINX;
+ int x1 = sa->v4->vec.x - sa->v1->vec.x - AREAMINX;
/* if left or right edge selected, test width */
if (sa->v1->flag && sa->v2->flag)
- *bigger= MIN2(*bigger, x1);
+ *bigger = MIN2(*bigger, x1);
else if (sa->v3->flag && sa->v4->flag)
- *smaller= MIN2(*smaller, x1);
+ *smaller = MIN2(*smaller, x1);
}
}
}
/* validate selection inside screen, set variables OK */
/* return 0: init failed */
-static int area_move_init (bContext *C, wmOperator *op)
+static int area_move_init(bContext *C, wmOperator *op)
{
- bScreen *sc= CTX_wm_screen(C);
+ bScreen *sc = CTX_wm_screen(C);
ScrEdge *actedge;
sAreaMoveData *md;
int x, y;
/* required properties */
- x= RNA_int_get(op->ptr, "x");
- y= RNA_int_get(op->ptr, "y");
+ x = RNA_int_get(op->ptr, "x");
+ y = RNA_int_get(op->ptr, "y");
/* setup */
- actedge= screen_find_active_scredge(sc, x, y);
- if (actedge==NULL) return 0;
+ actedge = screen_find_active_scredge(sc, x, y);
+ if (actedge == NULL) return 0;
- md= MEM_callocN(sizeof(sAreaMoveData), "sAreaMoveData");
- op->customdata= md;
+ md = MEM_callocN(sizeof(sAreaMoveData), "sAreaMoveData");
+ op->customdata = md;
- md->dir= scredge_is_horizontal(actedge)?'h':'v';
- if (md->dir=='h') md->origval= actedge->v1->vec.y;
- else md->origval= actedge->v1->vec.x;
+ md->dir = scredge_is_horizontal(actedge) ? 'h' : 'v';
+ if (md->dir == 'h') md->origval = actedge->v1->vec.y;
+ else md->origval = actedge->v1->vec.x;
select_connected_scredge(sc, actedge);
/* now all vertices with 'flag==1' are the ones that can be moved. */
@@ -946,48 +946,48 @@ static int area_move_init (bContext *C, wmOperator *op)
/* moves selected screen edge amount of delta, used by split & move */
static void area_move_apply_do(bContext *C, int origval, int delta, int dir, int bigger, int smaller)
{
- wmWindow *win= CTX_wm_window(C);
- bScreen *sc= CTX_wm_screen(C);
+ wmWindow *win = CTX_wm_window(C);
+ bScreen *sc = CTX_wm_screen(C);
ScrVert *v1;
ScrArea *sa;
- int areaminy= ED_area_headersize()+1;
+ int areaminy = ED_area_headersize() + 1;
- delta= CLAMPIS(delta, -smaller, bigger);
+ delta = CLAMPIS(delta, -smaller, bigger);
- for (v1= sc->vertbase.first; v1; v1= v1->next) {
+ for (v1 = sc->vertbase.first; v1; v1 = v1->next) {
if (v1->flag) {
/* that way a nice AREAGRID */
- if ((dir=='v') && v1->vec.x>0 && v1->vec.x<win->sizex-1) {
- v1->vec.x= origval + delta;
- if (delta != bigger && delta != -smaller) v1->vec.x-= (v1->vec.x % AREAGRID);
+ if ((dir == 'v') && v1->vec.x > 0 && v1->vec.x < win->sizex - 1) {
+ v1->vec.x = origval + delta;
+ if (delta != bigger && delta != -smaller) v1->vec.x -= (v1->vec.x % AREAGRID);
}
- if ((dir=='h') && v1->vec.y>0 && v1->vec.y<win->sizey-1) {
- v1->vec.y= origval + delta;
+ if ((dir == 'h') && v1->vec.y > 0 && v1->vec.y < win->sizey - 1) {
+ v1->vec.y = origval + delta;
- v1->vec.y+= AREAGRID-1;
- v1->vec.y-= (v1->vec.y % AREAGRID);
+ v1->vec.y += AREAGRID - 1;
+ v1->vec.y -= (v1->vec.y % AREAGRID);
/* prevent too small top header */
- if (v1->vec.y > win->sizey-areaminy)
- v1->vec.y= win->sizey-areaminy;
+ if (v1->vec.y > win->sizey - areaminy)
+ v1->vec.y = win->sizey - areaminy;
}
}
}
- for (sa= sc->areabase.first; sa; sa= sa->next) {
+ for (sa = sc->areabase.first; sa; sa = sa->next) {
if (sa->v1->flag || sa->v2->flag || sa->v3->flag || sa->v4->flag)
ED_area_tag_redraw(sa);
}
- WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL); /* redraw everything */
+ WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL); /* redraw everything */
}
static void area_move_apply(bContext *C, wmOperator *op)
{
- sAreaMoveData *md= op->customdata;
+ sAreaMoveData *md = op->customdata;
int delta;
- delta= RNA_int_get(op->ptr, "delta");
+ delta = RNA_int_get(op->ptr, "delta");
area_move_apply_do(C, md->origval, delta, md->dir, md->bigger, md->smaller);
}
@@ -995,7 +995,7 @@ static void area_move_exit(bContext *C, wmOperator *op)
{
if (op->customdata)
MEM_freeN(op->customdata);
- op->customdata= NULL;
+ op->customdata = NULL;
/* this makes sure aligned edges will result in aligned grabbing */
removedouble_scrverts(CTX_wm_screen(C));
@@ -1041,18 +1041,18 @@ static int area_move_cancel(bContext *C, wmOperator *op)
/* modal callback for while moving edges */
static int area_move_modal(bContext *C, wmOperator *op, wmEvent *event)
{
- sAreaMoveData *md= op->customdata;
+ sAreaMoveData *md = op->customdata;
int delta, x, y;
/* execute the events */
switch (event->type) {
case MOUSEMOVE:
- x= RNA_int_get(op->ptr, "x");
- y= RNA_int_get(op->ptr, "y");
+ x = RNA_int_get(op->ptr, "x");
+ y = RNA_int_get(op->ptr, "y");
- delta= (md->dir == 'v')? event->x - x: event->y - y;
- if (md->step) delta= delta - (delta % md->step);
+ delta = (md->dir == 'v') ? event->x - x : event->y - y;
+ if (md->step) delta = delta - (delta % md->step);
RNA_int_set(op->ptr, "delta", delta);
area_move_apply(C, op);
@@ -1069,10 +1069,10 @@ static int area_move_modal(bContext *C, wmOperator *op, wmEvent *event)
return area_move_cancel(C, op);
case KM_MODAL_STEP10:
- md->step= 10;
+ md->step = 10;
break;
case KM_MODAL_STEP10_OFF:
- md->step= 0;
+ md->step = 0;
break;
}
}
@@ -1109,7 +1109,7 @@ static void SCREEN_OT_area_move(wmOperatorType *ot)
* dir direction 'v' or 'h'
*
* operator customdata:
- * area pointer to (active) area
+ * area pointer to (active) area
* x, y last used mouse pos
* (more, see below)
*
@@ -1137,21 +1137,21 @@ static void SCREEN_OT_area_move(wmOperatorType *ot)
* call exit() or cancel() and remove handler
*/
-#define SPLIT_STARTED 1
-#define SPLIT_PROGRESS 2
+#define SPLIT_STARTED 1
+#define SPLIT_PROGRESS 2
typedef struct sAreaSplitData {
- int x, y; /* last used mouse position */
-
- int origval; /* for move areas */
- int bigger, smaller; /* constraints for moving new edge */
- int delta; /* delta move edge */
- int origmin, origsize; /* to calculate fac, for property storage */
- int previewmode; /* draw previewline, then split */
+ int x, y; /* last used mouse position */
- ScrEdge *nedge; /* new edge */
- ScrArea *sarea; /* start area */
- ScrArea *narea; /* new area */
+ int origval; /* for move areas */
+ int bigger, smaller; /* constraints for moving new edge */
+ int delta; /* delta move edge */
+ int origmin, origsize; /* to calculate fac, for property storage */
+ int previewmode; /* draw previewline, then split */
+
+ ScrEdge *nedge; /* new edge */
+ ScrArea *sarea; /* start area */
+ ScrArea *narea; /* new area */
} sAreaSplitData;
@@ -1161,15 +1161,15 @@ static int area_split_menu_init(bContext *C, wmOperator *op)
sAreaSplitData *sd;
/* custom data */
- sd= (sAreaSplitData*)MEM_callocN(sizeof (sAreaSplitData), "op_area_split");
- op->customdata= sd;
+ sd = (sAreaSplitData *)MEM_callocN(sizeof (sAreaSplitData), "op_area_split");
+ op->customdata = sd;
- sd->sarea= CTX_wm_area(C);
+ sd->sarea = CTX_wm_area(C);
if (sd->sarea) {
- int dir= RNA_enum_get(op->ptr, "direction");
+ int dir = RNA_enum_get(op->ptr, "direction");
- if (dir=='h')
+ if (dir == 'h')
sd->sarea->flag |= AREA_FLAG_DRAWSPLIT_H;
else
sd->sarea->flag |= AREA_FLAG_DRAWSPLIT_V;
@@ -1180,28 +1180,28 @@ static int area_split_menu_init(bContext *C, wmOperator *op)
/* generic init, no UI stuff here, assumes active area */
static int area_split_init(bContext *C, wmOperator *op)
{
- ScrArea *sa= CTX_wm_area(C);
+ ScrArea *sa = CTX_wm_area(C);
sAreaSplitData *sd;
- int areaminy= ED_area_headersize()+1;
+ int areaminy = ED_area_headersize() + 1;
int dir;
/* required context */
- if (sa==NULL) return 0;
+ if (sa == NULL) return 0;
/* required properties */
- dir= RNA_enum_get(op->ptr, "direction");
+ dir = RNA_enum_get(op->ptr, "direction");
/* minimal size */
- if (dir=='v' && sa->winx < 2*AREAMINX) return 0;
- if (dir=='h' && sa->winy < 2*areaminy) return 0;
+ if (dir == 'v' && sa->winx < 2 * AREAMINX) return 0;
+ if (dir == 'h' && sa->winy < 2 * areaminy) return 0;
/* custom data */
- sd= (sAreaSplitData*)MEM_callocN(sizeof (sAreaSplitData), "op_area_split");
- op->customdata= sd;
+ sd = (sAreaSplitData *)MEM_callocN(sizeof (sAreaSplitData), "op_area_split");
+ op->customdata = sd;
- sd->sarea= sa;
- sd->origsize= dir=='v' ? sa->winx:sa->winy;
- sd->origmin = dir=='v' ? sa->totrct.xmin:sa->totrct.ymin;
+ sd->sarea = sa;
+ sd->origsize = dir == 'v' ? sa->winx : sa->winy;
+ sd->origmin = dir == 'v' ? sa->totrct.xmin : sa->totrct.ymin;
return 1;
}
@@ -1210,25 +1210,25 @@ static int area_split_init(bContext *C, wmOperator *op)
/* used with split operator */
static ScrEdge *area_findsharededge(bScreen *screen, ScrArea *sa, ScrArea *sb)
{
- ScrVert *sav1= sa->v1;
- ScrVert *sav2= sa->v2;
- ScrVert *sav3= sa->v3;
- ScrVert *sav4= sa->v4;
- ScrVert *sbv1= sb->v1;
- ScrVert *sbv2= sb->v2;
- ScrVert *sbv3= sb->v3;
- ScrVert *sbv4= sb->v4;
+ ScrVert *sav1 = sa->v1;
+ ScrVert *sav2 = sa->v2;
+ ScrVert *sav3 = sa->v3;
+ ScrVert *sav4 = sa->v4;
+ ScrVert *sbv1 = sb->v1;
+ ScrVert *sbv2 = sb->v2;
+ ScrVert *sbv3 = sb->v3;
+ ScrVert *sbv4 = sb->v4;
- if (sav1==sbv4 && sav2==sbv3) { /* sa to right of sb = W */
+ if (sav1 == sbv4 && sav2 == sbv3) { /* sa to right of sb = W */
return screen_findedge(screen, sav1, sav2);
}
- else if (sav2==sbv1 && sav3==sbv4) { /* sa to bottom of sb = N */
+ else if (sav2 == sbv1 && sav3 == sbv4) { /* sa to bottom of sb = N */
return screen_findedge(screen, sav2, sav3);
}
- else if (sav3==sbv2 && sav4==sbv1) { /* sa to left of sb = E */
+ else if (sav3 == sbv2 && sav4 == sbv1) { /* sa to left of sb = E */
return screen_findedge(screen, sav3, sav4);
}
- else if (sav1==sbv2 && sav4==sbv3) { /* sa on top of sb = S*/
+ else if (sav1 == sbv2 && sav4 == sbv3) { /* sa on top of sb = S*/
return screen_findedge(screen, sav1, sav4);
}
@@ -1239,35 +1239,35 @@ static ScrEdge *area_findsharededge(bScreen *screen, ScrArea *sa, ScrArea *sb)
/* do the split, return success */
static int area_split_apply(bContext *C, wmOperator *op)
{
- bScreen *sc= CTX_wm_screen(C);
- sAreaSplitData *sd= (sAreaSplitData *)op->customdata;
+ bScreen *sc = CTX_wm_screen(C);
+ sAreaSplitData *sd = (sAreaSplitData *)op->customdata;
float fac;
int dir;
- fac= RNA_float_get(op->ptr, "factor");
- dir= RNA_enum_get(op->ptr, "direction");
+ fac = RNA_float_get(op->ptr, "factor");
+ dir = RNA_enum_get(op->ptr, "direction");
- sd->narea= area_split(sc, sd->sarea, dir, fac, 0); /* 0 = no merge */
+ sd->narea = area_split(sc, sd->sarea, dir, fac, 0); /* 0 = no merge */
if (sd->narea) {
ScrVert *sv;
- sd->nedge= area_findsharededge(sc, sd->sarea, sd->narea);
+ sd->nedge = area_findsharededge(sc, sd->sarea, sd->narea);
/* select newly created edge, prepare for moving edge */
- for (sv= sc->vertbase.first; sv; sv= sv->next)
+ for (sv = sc->vertbase.first; sv; sv = sv->next)
sv->flag = 0;
- sd->nedge->v1->flag= 1;
- sd->nedge->v2->flag= 1;
+ sd->nedge->v1->flag = 1;
+ sd->nedge->v2->flag = 1;
- if (dir=='h') sd->origval= sd->nedge->v1->vec.y;
- else sd->origval= sd->nedge->v1->vec.x;
+ if (dir == 'h') sd->origval = sd->nedge->v1->vec.y;
+ else sd->origval = sd->nedge->v1->vec.x;
ED_area_tag_redraw(sd->sarea);
ED_area_tag_redraw(sd->narea);
- WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL);
return 1;
}
@@ -1278,19 +1278,19 @@ static int area_split_apply(bContext *C, wmOperator *op)
static void area_split_exit(bContext *C, wmOperator *op)
{
if (op->customdata) {
- sAreaSplitData *sd= (sAreaSplitData *)op->customdata;
+ sAreaSplitData *sd = (sAreaSplitData *)op->customdata;
if (sd->sarea) ED_area_tag_redraw(sd->sarea);
if (sd->narea) ED_area_tag_redraw(sd->narea);
if (sd->sarea)
- sd->sarea->flag &= ~(AREA_FLAG_DRAWSPLIT_H|AREA_FLAG_DRAWSPLIT_V);
+ sd->sarea->flag &= ~(AREA_FLAG_DRAWSPLIT_H | AREA_FLAG_DRAWSPLIT_V);
MEM_freeN(op->customdata);
op->customdata = NULL;
}
WM_cursor_restore(CTX_wm_window(C));
- WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL);
/* this makes sure aligned edges will result in aligned grabbing */
removedouble_scrverts(CTX_wm_screen(C));
@@ -1308,28 +1308,28 @@ static int area_split_invoke(bContext *C, wmOperator *op, wmEvent *event)
if (CTX_wm_screen(C)->full != SCREENNORMAL)
return OPERATOR_CANCELLED;
- if (event->type==EVT_ACTIONZONE_AREA) {
- sActionzoneData *sad= event->customdata;
+ if (event->type == EVT_ACTIONZONE_AREA) {
+ sActionzoneData *sad = event->customdata;
- if (sad->modifier>0) {
+ if (sad->modifier > 0) {
return OPERATOR_PASS_THROUGH;
}
/* verify *sad itself */
- if (sad==NULL || sad->sa1==NULL || sad->az==NULL)
+ if (sad == NULL || sad->sa1 == NULL || sad->az == NULL)
return OPERATOR_PASS_THROUGH;
/* is this our *sad? if areas not equal it should be passed on */
- if (CTX_wm_area(C)!=sad->sa1 || sad->sa1!=sad->sa2)
+ if (CTX_wm_area(C) != sad->sa1 || sad->sa1 != sad->sa2)
return OPERATOR_PASS_THROUGH;
/* prepare operator state vars */
- if (sad->gesture_dir=='n' || sad->gesture_dir=='s') {
- dir= 'h';
+ if (sad->gesture_dir == 'n' || sad->gesture_dir == 's') {
+ dir = 'h';
RNA_float_set(op->ptr, "factor", ((float)(event->x - sad->sa1->v1->vec.x)) / (float)sad->sa1->winx);
}
else {
- dir= 'v';
+ dir = 'v';
RNA_float_set(op->ptr, "factor", ((float)(event->y - sad->sa1->v1->vec.y)) / (float)sad->sa1->winy);
}
RNA_enum_set(op->ptr, "direction", dir);
@@ -1345,20 +1345,20 @@ static int area_split_invoke(bContext *C, wmOperator *op, wmEvent *event)
/* retrieve initial mouse coord, so we can find the active edge */
if (RNA_struct_property_is_set(op->ptr, "mouse_x"))
- x= RNA_int_get(op->ptr, "mouse_x");
+ x = RNA_int_get(op->ptr, "mouse_x");
else
- x= event->x;
+ x = event->x;
if (RNA_struct_property_is_set(op->ptr, "mouse_y"))
- y= RNA_int_get(op->ptr, "mouse_y");
+ y = RNA_int_get(op->ptr, "mouse_y");
else
- y= event->x;
+ y = event->x;
- actedge= screen_find_active_scredge(CTX_wm_screen(C), x, y);
- if (actedge==NULL)
+ actedge = screen_find_active_scredge(CTX_wm_screen(C), x, y);
+ if (actedge == NULL)
return OPERATOR_CANCELLED;
- dir= scredge_is_horizontal(actedge)?'v':'h';
+ dir = scredge_is_horizontal(actedge) ? 'v' : 'h';
RNA_enum_set(op->ptr, "direction", dir);
@@ -1368,12 +1368,12 @@ static int area_split_invoke(bContext *C, wmOperator *op, wmEvent *event)
}
- sd= (sAreaSplitData *)op->customdata;
+ sd = (sAreaSplitData *)op->customdata;
- sd->x= event->x;
- sd->y= event->y;
+ sd->x = event->x;
+ sd->y = event->y;
- if (event->type==EVT_ACTIONZONE_AREA) {
+ if (event->type == EVT_ACTIONZONE_AREA) {
/* do the split */
if (area_split_apply(C, op)) {
@@ -1386,7 +1386,7 @@ static int area_split_invoke(bContext *C, wmOperator *op, wmEvent *event)
}
}
else {
- sd->previewmode= 1;
+ sd->previewmode = 1;
/* add temp handler for edge move or cancel */
WM_event_add_modal_handler(C, op);
@@ -1413,7 +1413,7 @@ static int area_split_exec(bContext *C, wmOperator *op)
static int area_split_cancel(bContext *C, wmOperator *op)
{
- sAreaSplitData *sd= (sAreaSplitData *)op->customdata;
+ sAreaSplitData *sd = (sAreaSplitData *)op->customdata;
if (sd->previewmode) {
}
@@ -1433,44 +1433,44 @@ static int area_split_cancel(bContext *C, wmOperator *op)
static int area_split_modal(bContext *C, wmOperator *op, wmEvent *event)
{
- sAreaSplitData *sd= (sAreaSplitData *)op->customdata;
+ sAreaSplitData *sd = (sAreaSplitData *)op->customdata;
float fac;
int dir;
/* execute the events */
switch (event->type) {
case MOUSEMOVE:
- dir= RNA_enum_get(op->ptr, "direction");
+ dir = RNA_enum_get(op->ptr, "direction");
- sd->delta= (dir == 'v')? event->x - sd->origval: event->y - sd->origval;
- if (sd->previewmode==0)
+ sd->delta = (dir == 'v') ? event->x - sd->origval : event->y - sd->origval;
+ if (sd->previewmode == 0)
area_move_apply_do(C, sd->origval, sd->delta, dir, sd->bigger, sd->smaller);
else {
if (sd->sarea) {
- sd->sarea->flag &= ~(AREA_FLAG_DRAWSPLIT_H|AREA_FLAG_DRAWSPLIT_V);
+ sd->sarea->flag &= ~(AREA_FLAG_DRAWSPLIT_H | AREA_FLAG_DRAWSPLIT_V);
ED_area_tag_redraw(sd->sarea);
}
- sd->sarea= screen_areahascursor(CTX_wm_screen(C), event->x, event->y); /* area context not set */
+ sd->sarea = screen_areahascursor(CTX_wm_screen(C), event->x, event->y); /* area context not set */
if (sd->sarea) {
ED_area_tag_redraw(sd->sarea);
- if (dir=='v') {
- sd->origsize= sd->sarea->winx;
- sd->origmin= sd->sarea->totrct.xmin;
+ if (dir == 'v') {
+ sd->origsize = sd->sarea->winx;
+ sd->origmin = sd->sarea->totrct.xmin;
sd->sarea->flag |= AREA_FLAG_DRAWSPLIT_V;
}
else {
- sd->origsize= sd->sarea->winy;
- sd->origmin= sd->sarea->totrct.ymin;
+ sd->origsize = sd->sarea->winy;
+ sd->origmin = sd->sarea->totrct.ymin;
sd->sarea->flag |= AREA_FLAG_DRAWSPLIT_H;
}
}
- CTX_wm_window(C)->screen->do_draw= 1;
+ CTX_wm_window(C)->screen->do_draw = 1;
}
- fac= (dir == 'v') ? event->x-sd->origmin : event->y-sd->origmin;
+ fac = (dir == 'v') ? event->x - sd->origmin : event->y - sd->origmin;
RNA_float_set(op->ptr, "factor", fac / (float)sd->origsize);
break;
@@ -1482,7 +1482,7 @@ static int area_split_modal(bContext *C, wmOperator *op, wmEvent *event)
return OPERATOR_FINISHED;
}
else {
- if (event->val==KM_RELEASE) { /* mouse up */
+ if (event->val == KM_RELEASE) { /* mouse up */
area_split_exit(C, op);
return OPERATOR_FINISHED;
}
@@ -1491,17 +1491,17 @@ static int area_split_modal(bContext *C, wmOperator *op, wmEvent *event)
case MIDDLEMOUSE:
case TABKEY:
- if (sd->previewmode==0) {
+ if (sd->previewmode == 0) {
}
else {
dir = RNA_enum_get(op->ptr, "direction");
- if (event->val==KM_PRESS) {
+ if (event->val == KM_PRESS) {
if (sd->sarea) {
- sd->sarea->flag &= ~(AREA_FLAG_DRAWSPLIT_H|AREA_FLAG_DRAWSPLIT_V);
+ sd->sarea->flag &= ~(AREA_FLAG_DRAWSPLIT_H | AREA_FLAG_DRAWSPLIT_V);
ED_area_tag_redraw(sd->sarea);
- if (dir=='v') {
+ if (dir == 'v') {
RNA_enum_set(op->ptr, "direction", 'h');
sd->sarea->flag |= AREA_FLAG_DRAWSPLIT_H;
@@ -1528,9 +1528,10 @@ static int area_split_modal(bContext *C, wmOperator *op, wmEvent *event)
}
static EnumPropertyItem prop_direction_items[] = {
-{'h', "HORIZONTAL", 0, "Horizontal", ""},
-{'v', "VERTICAL", 0, "Vertical", ""},
-{0, NULL, 0, NULL, NULL}};
+ {'h', "HORIZONTAL", 0, "Horizontal", ""},
+ {'v', "VERTICAL", 0, "Vertical", ""},
+ {0, NULL, 0, NULL, NULL}
+};
static void SCREEN_OT_area_split(wmOperatorType *ot)
{
@@ -1574,16 +1575,16 @@ static int area_max_regionsize(ScrArea *sa, ARegion *scalear, AZEdge edge)
ARegion *ar;
int dist;
- if (edge==AE_RIGHT_TO_TOPLEFT || edge==AE_LEFT_TO_TOPRIGHT) {
+ if (edge == AE_RIGHT_TO_TOPLEFT || edge == AE_LEFT_TO_TOPRIGHT) {
dist = sa->totrct.xmax - sa->totrct.xmin;
}
- else { /* AE_BOTTOM_TO_TOPLEFT, AE_TOP_TO_BOTTOMRIGHT */
+ else { /* AE_BOTTOM_TO_TOPLEFT, AE_TOP_TO_BOTTOMRIGHT */
dist = sa->totrct.ymax - sa->totrct.ymin;
}
/* subtractwidth of regions on opposite side
* prevents dragging regions into other opposite regions */
- for (ar=sa->regionbase.first; ar; ar=ar->next) {
+ for (ar = sa->regionbase.first; ar; ar = ar->next) {
if (ar == scalear)
continue;
@@ -1609,10 +1610,10 @@ static int area_max_regionsize(ScrArea *sa, ARegion *scalear, AZEdge edge)
static int region_scale_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- sActionzoneData *sad= event->customdata;
+ sActionzoneData *sad = event->customdata;
AZone *az;
- if (event->type!=EVT_ACTIONZONE_REGION) {
+ if (event->type != EVT_ACTIONZONE_REGION) {
BKE_report(op->reports, RPT_ERROR, "Can only scale region size from an action zone");
return OPERATOR_CANCELLED;
}
@@ -1620,31 +1621,31 @@ static int region_scale_invoke(bContext *C, wmOperator *op, wmEvent *event)
az = sad->az;
if (az->ar) {
- RegionMoveData *rmd= MEM_callocN(sizeof(RegionMoveData), "RegionMoveData");
+ RegionMoveData *rmd = MEM_callocN(sizeof(RegionMoveData), "RegionMoveData");
int maxsize;
- op->customdata= rmd;
+ op->customdata = rmd;
rmd->az = az;
- rmd->ar= az->ar;
+ rmd->ar = az->ar;
rmd->sa = sad->sa1;
- rmd->edge= az->edge;
- rmd->origx= event->x;
- rmd->origy= event->y;
+ rmd->edge = az->edge;
+ rmd->origx = event->x;
+ rmd->origy = event->y;
rmd->maxsize = area_max_regionsize(rmd->sa, rmd->ar, rmd->edge);
/* if not set we do now, otherwise it uses type */
- if (rmd->ar->sizex==0)
- rmd->ar->sizex= rmd->ar->type->prefsizex;
- if (rmd->ar->sizey==0)
- rmd->ar->sizey= rmd->ar->type->prefsizey;
+ if (rmd->ar->sizex == 0)
+ rmd->ar->sizex = rmd->ar->type->prefsizex;
+ if (rmd->ar->sizey == 0)
+ rmd->ar->sizey = rmd->ar->type->prefsizey;
/* now copy to regionmovedata */
- if (rmd->edge==AE_LEFT_TO_TOPRIGHT || rmd->edge==AE_RIGHT_TO_TOPLEFT) {
- rmd->origval= rmd->ar->sizex;
+ if (rmd->edge == AE_LEFT_TO_TOPRIGHT || rmd->edge == AE_RIGHT_TO_TOPLEFT) {
+ rmd->origval = rmd->ar->sizex;
}
else {
- rmd->origval= rmd->ar->sizey;
+ rmd->origval = rmd->ar->sizey;
}
/* limit headers to standard height for now */
@@ -1666,16 +1667,16 @@ static int region_scale_invoke(bContext *C, wmOperator *op, wmEvent *event)
static int region_scale_get_maxsize(RegionMoveData *rmd)
{
- int maxsize= 0;
+ int maxsize = 0;
- if (rmd->edge==AE_LEFT_TO_TOPRIGHT || rmd->edge==AE_RIGHT_TO_TOPLEFT) {
+ if (rmd->edge == AE_LEFT_TO_TOPRIGHT || rmd->edge == AE_RIGHT_TO_TOPLEFT) {
return rmd->sa->winx - UI_UNIT_X;
}
if (rmd->ar->regiontype == RGN_TYPE_TOOL_PROPS) {
/* this calculation seems overly verbose
* can someone explain why this method is necessary? - campbell */
- maxsize = rmd->maxsize - ((rmd->sa->headertype==HEADERTOP)?UI_UNIT_Y*2:UI_UNIT_Y) - (UI_UNIT_Y/4);
+ maxsize = rmd->maxsize - ((rmd->sa->headertype == HEADERTOP) ? UI_UNIT_Y * 2 : UI_UNIT_Y) - (UI_UNIT_Y / 4);
}
return maxsize;
@@ -1683,19 +1684,19 @@ static int region_scale_get_maxsize(RegionMoveData *rmd)
static void region_scale_validate_size(RegionMoveData *rmd)
{
- if ((rmd->ar->flag & RGN_FLAG_HIDDEN)==0) {
- short *size, maxsize= -1;
+ if ((rmd->ar->flag & RGN_FLAG_HIDDEN) == 0) {
+ short *size, maxsize = -1;
- if (rmd->edge==AE_LEFT_TO_TOPRIGHT || rmd->edge==AE_RIGHT_TO_TOPLEFT)
- size= &rmd->ar->sizex;
+ if (rmd->edge == AE_LEFT_TO_TOPRIGHT || rmd->edge == AE_RIGHT_TO_TOPLEFT)
+ size = &rmd->ar->sizex;
else
- size= &rmd->ar->sizey;
+ size = &rmd->ar->sizey;
- maxsize= region_scale_get_maxsize(rmd);
+ maxsize = region_scale_get_maxsize(rmd);
if (*size > maxsize && maxsize > 0)
- *size= maxsize;
+ *size = maxsize;
}
}
@@ -1707,22 +1708,22 @@ static void region_scale_toggle_hidden(bContext *C, RegionMoveData *rmd)
static int region_scale_modal(bContext *C, wmOperator *op, wmEvent *event)
{
- RegionMoveData *rmd= op->customdata;
+ RegionMoveData *rmd = op->customdata;
int delta;
/* execute the events */
switch (event->type) {
case MOUSEMOVE:
- if (rmd->edge==AE_LEFT_TO_TOPRIGHT || rmd->edge==AE_RIGHT_TO_TOPLEFT) {
- delta= event->x - rmd->origx;
- if (rmd->edge==AE_LEFT_TO_TOPRIGHT) delta= -delta;
+ if (rmd->edge == AE_LEFT_TO_TOPRIGHT || rmd->edge == AE_RIGHT_TO_TOPLEFT) {
+ delta = event->x - rmd->origx;
+ if (rmd->edge == AE_LEFT_TO_TOPRIGHT) delta = -delta;
- rmd->ar->sizex= rmd->origval + delta;
+ rmd->ar->sizex = rmd->origval + delta;
CLAMP(rmd->ar->sizex, 0, rmd->maxsize);
if (rmd->ar->sizex < UI_UNIT_X) {
- rmd->ar->sizex= rmd->origval;
+ rmd->ar->sizex = rmd->origval;
if (!(rmd->ar->flag & RGN_FLAG_HIDDEN))
region_scale_toggle_hidden(C, rmd);
}
@@ -1730,33 +1731,33 @@ static int region_scale_modal(bContext *C, wmOperator *op, wmEvent *event)
region_scale_toggle_hidden(C, rmd);
}
else {
- int maxsize= region_scale_get_maxsize(rmd);
- delta= event->y - rmd->origy;
- if (rmd->edge==AE_BOTTOM_TO_TOPLEFT) delta= -delta;
+ int maxsize = region_scale_get_maxsize(rmd);
+ delta = event->y - rmd->origy;
+ if (rmd->edge == AE_BOTTOM_TO_TOPLEFT) delta = -delta;
- rmd->ar->sizey= rmd->origval + delta;
+ rmd->ar->sizey = rmd->origval + delta;
CLAMP(rmd->ar->sizey, 0, rmd->maxsize);
/* note, 'UI_UNIT_Y/4' means you need to drag the header almost
* all the way down for it to become hidden, this is done
* otherwise its too easy to do this by accident */
- if (rmd->ar->sizey < UI_UNIT_Y/4) {
- rmd->ar->sizey= rmd->origval;
+ if (rmd->ar->sizey < UI_UNIT_Y / 4) {
+ rmd->ar->sizey = rmd->origval;
if (!(rmd->ar->flag & RGN_FLAG_HIDDEN))
region_scale_toggle_hidden(C, rmd);
}
else if (maxsize > 0 && (rmd->ar->sizey > maxsize))
- rmd->ar->sizey= maxsize;
+ rmd->ar->sizey = maxsize;
else if (rmd->ar->flag & RGN_FLAG_HIDDEN)
region_scale_toggle_hidden(C, rmd);
}
ED_area_tag_redraw(rmd->sa);
- WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL);
break;
case LEFTMOUSE:
- if (event->val==KM_RELEASE) {
+ if (event->val == KM_RELEASE) {
if (ABS(event->x - rmd->origx) < 2 && ABS(event->y - rmd->origy) < 2) {
if (rmd->ar->flag & RGN_FLAG_HIDDEN) {
@@ -1767,7 +1768,7 @@ static int region_scale_modal(bContext *C, wmOperator *op, wmEvent *event)
}
ED_area_tag_redraw(rmd->sa);
- WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL);
}
MEM_freeN(op->customdata);
op->customdata = NULL;
@@ -1813,8 +1814,8 @@ static void SCREEN_OT_region_scale(wmOperatorType *ot)
/* function to be called outside UI context, or for redo */
static int frame_offset_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
int delta;
delta = RNA_int_get(op->ptr, "delta");
@@ -1825,7 +1826,7 @@ static int frame_offset_exec(bContext *C, wmOperator *op)
sound_seek_scene(bmain, scene);
- WM_event_add_notifier(C, NC_SCENE|ND_FRAME, CTX_data_scene(C));
+ WM_event_add_notifier(C, NC_SCENE | ND_FRAME, CTX_data_scene(C));
return OPERATOR_FINISHED;
}
@@ -1849,9 +1850,9 @@ static void SCREEN_OT_frame_offset(wmOperatorType *ot)
/* function to be called outside UI context, or for redo */
static int frame_jump_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
- wmTimer *animtimer= CTX_wm_screen(C)->animtimer;
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+ wmTimer *animtimer = CTX_wm_screen(C)->animtimer;
/* Don't change CFRA directly if animtimer is running as this can cause
* first/last frame not to be actually shown (bad since for example physics
@@ -1863,19 +1864,19 @@ static int frame_jump_exec(bContext *C, wmOperator *op)
sad->flag |= ANIMPLAY_FLAG_USE_NEXT_FRAME;
if (RNA_boolean_get(op->ptr, "end"))
- sad->nextfra= PEFRA;
+ sad->nextfra = PEFRA;
else
- sad->nextfra= PSFRA;
+ sad->nextfra = PSFRA;
}
else {
if (RNA_boolean_get(op->ptr, "end"))
- CFRA= PEFRA;
+ CFRA = PEFRA;
else
- CFRA= PSFRA;
+ CFRA = PSFRA;
sound_seek_scene(bmain, scene);
- WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
+ WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
}
return OPERATOR_FINISHED;
@@ -1902,21 +1903,21 @@ static void SCREEN_OT_frame_jump(wmOperatorType *ot)
/* function to be called outside UI context, or for redo */
static int keyframe_jump_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
- Object *ob= CTX_data_active_object(C);
- bDopeSheet ads= {NULL};
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+ Object *ob = CTX_data_active_object(C);
+ bDopeSheet ads = {NULL};
DLRBT_Tree keys;
ActKeyColumn *ak;
float cfra;
- short next= RNA_boolean_get(op->ptr, "next");
+ short next = RNA_boolean_get(op->ptr, "next");
short done = 0;
/* sanity checks */
if (scene == NULL)
return OPERATOR_CANCELLED;
- cfra= (float)(CFRA);
+ cfra = (float)(CFRA);
/* init binarytree-list for getting keyframes */
BLI_dlrbTree_init(&keys);
@@ -1933,14 +1934,14 @@ static int keyframe_jump_exec(bContext *C, wmOperator *op)
/* find matching keyframe in the right direction */
do {
if (next)
- ak= (ActKeyColumn *)BLI_dlrbTree_search_next(&keys, compare_ak_cfraPtr, &cfra);
+ ak = (ActKeyColumn *)BLI_dlrbTree_search_next(&keys, compare_ak_cfraPtr, &cfra);
else
- ak= (ActKeyColumn *)BLI_dlrbTree_search_prev(&keys, compare_ak_cfraPtr, &cfra);
+ ak = (ActKeyColumn *)BLI_dlrbTree_search_prev(&keys, compare_ak_cfraPtr, &cfra);
if (ak) {
if (CFRA != (int)ak->cfra) {
/* this changes the frame, so set the frame and we're done */
- CFRA= (int)ak->cfra;
+ CFRA = (int)ak->cfra;
done = 1;
}
else {
@@ -1959,7 +1960,7 @@ static int keyframe_jump_exec(bContext *C, wmOperator *op)
sound_seek_scene(bmain, scene);
- WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
+ WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
return OPERATOR_FINISHED;
}
@@ -1985,35 +1986,35 @@ static void SCREEN_OT_keyframe_jump(wmOperatorType *ot)
/* function to be called outside UI context, or for redo */
static int screen_set_exec(bContext *C, wmOperator *op)
{
- bScreen *screen= CTX_wm_screen(C);
- bScreen *screen_prev= screen;
+ bScreen *screen = CTX_wm_screen(C);
+ bScreen *screen_prev = screen;
- ScrArea *sa= CTX_wm_area(C);
- int tot= BLI_countlist(&CTX_data_main(C)->screen);
- int delta= RNA_int_get(op->ptr, "delta");
+ ScrArea *sa = CTX_wm_area(C);
+ int tot = BLI_countlist(&CTX_data_main(C)->screen);
+ int delta = RNA_int_get(op->ptr, "delta");
/* temp screens are for userpref or render display */
if (screen->temp)
return OPERATOR_CANCELLED;
- if (delta==1) {
+ if (delta == 1) {
while (tot--) {
- screen= screen->id.next;
- if (screen==NULL) screen= CTX_data_main(C)->screen.first;
- if (screen->winid==0 && screen->full==0 && screen != screen_prev)
+ screen = screen->id.next;
+ if (screen == NULL) screen = CTX_data_main(C)->screen.first;
+ if (screen->winid == 0 && screen->full == 0 && screen != screen_prev)
break;
}
}
- else if (delta== -1) {
+ else if (delta == -1) {
while (tot--) {
- screen= screen->id.prev;
- if (screen==NULL) screen= CTX_data_main(C)->screen.last;
- if (screen->winid==0 && screen->full==0 && screen != screen_prev)
+ screen = screen->id.prev;
+ if (screen == NULL) screen = CTX_data_main(C)->screen.last;
+ if (screen->winid == 0 && screen->full == 0 && screen != screen_prev)
break;
}
}
else {
- screen= NULL;
+ screen = NULL;
}
if (screen && screen_prev != screen) {
@@ -2048,15 +2049,15 @@ static void SCREEN_OT_screen_set(wmOperatorType *ot)
static int screen_full_area_exec(bContext *C, wmOperator *UNUSED(op))
{
bScreen *screen = CTX_wm_screen(C);
- ScrArea *sa=NULL;
+ ScrArea *sa = NULL;
/* search current screen for 'fullscreen' areas */
/* prevents restoring info header, when mouse is over it */
- for (sa=screen->areabase.first; sa; sa=sa->next) {
+ for (sa = screen->areabase.first; sa; sa = sa->next) {
if (sa->full) break;
}
- if (sa==NULL) sa= CTX_wm_area(C);
+ if (sa == NULL) sa = CTX_wm_area(C);
ED_screen_full_toggle(C, CTX_wm_window(C), sa);
return OPERATOR_FINISHED;
@@ -2105,11 +2106,10 @@ static void SCREEN_OT_screen_full_area(wmOperatorType *ot)
* call exit() and remove handler when LMB confirm
*/
-typedef struct sAreaJoinData
-{
- ScrArea *sa1; /* first area to be considered */
- ScrArea *sa2; /* second area to be considered */
- ScrArea *scr; /* designed for removal */
+typedef struct sAreaJoinData {
+ ScrArea *sa1; /* first area to be considered */
+ ScrArea *sa2; /* second area to be considered */
+ ScrArea *scr; /* designed for removal */
} sAreaJoinData;
@@ -2120,40 +2120,40 @@ typedef struct sAreaJoinData
static int area_join_init(bContext *C, wmOperator *op)
{
ScrArea *sa1, *sa2;
- sAreaJoinData* jd= NULL;
+ sAreaJoinData *jd = NULL;
int x1, y1;
int x2, y2;
- int shared= 0;
+ int shared = 0;
/* required properties, make negative to get return 0 if not set by caller */
- x1= RNA_int_get(op->ptr, "min_x");
- y1= RNA_int_get(op->ptr, "min_y");
- x2= RNA_int_get(op->ptr, "max_x");
- y2= RNA_int_get(op->ptr, "max_y");
+ x1 = RNA_int_get(op->ptr, "min_x");
+ y1 = RNA_int_get(op->ptr, "min_y");
+ x2 = RNA_int_get(op->ptr, "max_x");
+ y2 = RNA_int_get(op->ptr, "max_y");
sa1 = screen_areahascursor(CTX_wm_screen(C), x1, y1);
sa2 = screen_areahascursor(CTX_wm_screen(C), x2, y2);
- if (sa1==NULL || sa2==NULL || sa1==sa2)
+ if (sa1 == NULL || sa2 == NULL || sa1 == sa2)
return 0;
/* do areas share an edge? */
- if (sa1->v1==sa2->v1 || sa1->v1==sa2->v2 || sa1->v1==sa2->v3 || sa1->v1==sa2->v4) shared++;
- if (sa1->v2==sa2->v1 || sa1->v2==sa2->v2 || sa1->v2==sa2->v3 || sa1->v2==sa2->v4) shared++;
- if (sa1->v3==sa2->v1 || sa1->v3==sa2->v2 || sa1->v3==sa2->v3 || sa1->v3==sa2->v4) shared++;
- if (sa1->v4==sa2->v1 || sa1->v4==sa2->v2 || sa1->v4==sa2->v3 || sa1->v4==sa2->v4) shared++;
- if (shared!=2) {
+ if (sa1->v1 == sa2->v1 || sa1->v1 == sa2->v2 || sa1->v1 == sa2->v3 || sa1->v1 == sa2->v4) shared++;
+ if (sa1->v2 == sa2->v1 || sa1->v2 == sa2->v2 || sa1->v2 == sa2->v3 || sa1->v2 == sa2->v4) shared++;
+ if (sa1->v3 == sa2->v1 || sa1->v3 == sa2->v2 || sa1->v3 == sa2->v3 || sa1->v3 == sa2->v4) shared++;
+ if (sa1->v4 == sa2->v1 || sa1->v4 == sa2->v2 || sa1->v4 == sa2->v3 || sa1->v4 == sa2->v4) shared++;
+ if (shared != 2) {
printf("areas don't share edge\n");
return 0;
}
- jd = (sAreaJoinData*)MEM_callocN(sizeof (sAreaJoinData), "op_area_join");
+ jd = (sAreaJoinData *)MEM_callocN(sizeof (sAreaJoinData), "op_area_join");
jd->sa1 = sa1;
jd->sa1->flag |= AREA_FLAG_DRAWJOINFROM;
jd->sa2 = sa2;
jd->sa2->flag |= AREA_FLAG_DRAWJOINTO;
- op->customdata= jd;
+ op->customdata = jd;
return 1;
}
@@ -2204,19 +2204,19 @@ static int area_join_exec(bContext *C, wmOperator *op)
static int area_join_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- if (event->type==EVT_ACTIONZONE_AREA) {
- sActionzoneData *sad= event->customdata;
+ if (event->type == EVT_ACTIONZONE_AREA) {
+ sActionzoneData *sad = event->customdata;
- if (sad->modifier>0) {
+ if (sad->modifier > 0) {
return OPERATOR_PASS_THROUGH;
}
/* verify *sad itself */
- if (sad==NULL || sad->sa1==NULL || sad->sa2==NULL)
+ if (sad == NULL || sad->sa1 == NULL || sad->sa2 == NULL)
return OPERATOR_PASS_THROUGH;
/* is this our *sad? if areas equal it should be passed on */
- if (sad->sa1==sad->sa2)
+ if (sad->sa1 == sad->sa2)
return OPERATOR_PASS_THROUGH;
/* prepare operator state vars */
@@ -2259,7 +2259,7 @@ static int area_join_cancel(bContext *C, wmOperator *op)
/* modal callback while selecting area (space) that will be removed */
static int area_join_modal(bContext *C, wmOperator *op, wmEvent *event)
{
- bScreen *sc= CTX_wm_screen(C);
+ bScreen *sc = CTX_wm_screen(C);
sAreaJoinData *jd = (sAreaJoinData *)op->customdata;
/* execute the events */
@@ -2301,7 +2301,7 @@ static int area_join_modal(bContext *C, wmOperator *op, wmEvent *event)
}
else {
/* we are back in the area previously selected for keeping
- * we swap the areas if possible to allow user to choose */
+ * we swap the areas if possible to allow user to choose */
if (jd->sa2 != NULL) {
if (jd->sa1) jd->sa1->flag &= ~AREA_FLAG_DRAWJOINFROM;
if (jd->sa2) jd->sa2->flag &= ~AREA_FLAG_DRAWJOINTO;
@@ -2326,14 +2326,14 @@ static int area_join_modal(bContext *C, wmOperator *op, wmEvent *event)
}
}
}
- break;
+ break;
case LEFTMOUSE:
- if (event->val==KM_RELEASE) {
+ if (event->val == KM_RELEASE) {
ED_area_tag_redraw(jd->sa1);
ED_area_tag_redraw(jd->sa2);
area_join_apply(C, op);
- WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL);
area_join_exit(C, op);
return OPERATOR_FINISHED;
}
@@ -2362,7 +2362,7 @@ static void SCREEN_OT_area_join(wmOperatorType *ot)
ot->poll = screen_active_editable;
ot->cancel = area_join_cancel;
- ot->flag = OPTYPE_BLOCKING|OPTYPE_INTERNAL;
+ ot->flag = OPTYPE_BLOCKING | OPTYPE_INTERNAL;
/* rna */
RNA_def_int(ot->srna, "min_x", -100, INT_MIN, INT_MAX, "X 1", "", INT_MIN, INT_MAX);
@@ -2378,20 +2378,20 @@ static int screen_area_options_invoke(bContext *C, wmOperator *op, wmEvent *even
uiPopupMenu *pup;
uiLayout *layout;
PointerRNA ptr1, ptr2;
- ScrEdge *actedge= screen_find_active_scredge(CTX_wm_screen(C), event->x, event->y);
+ ScrEdge *actedge = screen_find_active_scredge(CTX_wm_screen(C), event->x, event->y);
- if (actedge==NULL) return OPERATOR_CANCELLED;
+ if (actedge == NULL) return OPERATOR_CANCELLED;
- pup= uiPupMenuBegin(C, op->type->name, ICON_NONE);
- layout= uiPupMenuLayout(pup);
+ pup = uiPupMenuBegin(C, op->type->name, ICON_NONE);
+ layout = uiPupMenuLayout(pup);
WM_operator_properties_create(&ptr1, "SCREEN_OT_area_join");
/* mouse cursor on edge, '4' can fail on wide edges... */
- RNA_int_set(&ptr1, "min_x", event->x+4);
- RNA_int_set(&ptr1, "min_y", event->y+4);
- RNA_int_set(&ptr1, "max_x", event->x-4);
- RNA_int_set(&ptr1, "max_y", event->y-4);
+ RNA_int_set(&ptr1, "min_x", event->x + 4);
+ RNA_int_set(&ptr1, "min_y", event->y + 4);
+ RNA_int_set(&ptr1, "max_x", event->x - 4);
+ RNA_int_set(&ptr1, "max_y", event->y - 4);
WM_operator_properties_create(&ptr2, "SCREEN_OT_area_split");
@@ -2426,18 +2426,18 @@ static void SCREEN_OT_area_options(wmOperatorType *ot)
static int spacedata_cleanup(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
+ Main *bmain = CTX_data_main(C);
bScreen *screen;
ScrArea *sa;
- int tot= 0;
+ int tot = 0;
- for (screen= bmain->screen.first; screen; screen= screen->id.next) {
- for (sa= screen->areabase.first; sa; sa= sa->next) {
+ for (screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (sa = screen->areabase.first; sa; sa = sa->next) {
if (sa->spacedata.first != sa->spacedata.last) {
- SpaceLink *sl= sa->spacedata.first;
+ SpaceLink *sl = sa->spacedata.first;
BLI_remlink(&sa->spacedata, sl);
- tot+= BLI_countlist(&sa->spacedata);
+ tot += BLI_countlist(&sa->spacedata);
BKE_spacedata_freelist(&sa->spacedata);
BLI_addtail(&sa->spacedata, sl);
}
@@ -2465,7 +2465,7 @@ static void SCREEN_OT_spacedata_cleanup(wmOperatorType *ot)
static int repeat_last_exec(bContext *C, wmOperator *UNUSED(op))
{
- wmOperator *lastop= CTX_wm_manager(C)->operators.last;
+ wmOperator *lastop = CTX_wm_manager(C)->operators.last;
if (lastop)
WM_operator_repeat(C, lastop);
@@ -2489,20 +2489,20 @@ static void SCREEN_OT_repeat_last(wmOperatorType *ot)
static int repeat_history_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
- wmWindowManager *wm= CTX_wm_manager(C);
+ wmWindowManager *wm = CTX_wm_manager(C);
wmOperator *lastop;
uiPopupMenu *pup;
uiLayout *layout;
int items, i;
- items= BLI_countlist(&wm->operators);
- if (items==0)
+ items = BLI_countlist(&wm->operators);
+ if (items == 0)
return OPERATOR_CANCELLED;
- pup= uiPupMenuBegin(C, op->type->name, ICON_NONE);
- layout= uiPupMenuLayout(pup);
+ pup = uiPupMenuBegin(C, op->type->name, ICON_NONE);
+ layout = uiPupMenuLayout(pup);
- for (i=items-1, lastop= wm->operators.last; lastop; lastop= lastop->prev, i--)
+ for (i = items - 1, lastop = wm->operators.last; lastop; lastop = lastop->prev, i--)
uiItemIntO(layout, lastop->type->name, ICON_NONE, op->type->idname, "index", i);
uiPupMenuEnd(C, pup);
@@ -2512,9 +2512,9 @@ static int repeat_history_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(ev
static int repeat_history_exec(bContext *C, wmOperator *op)
{
- wmWindowManager *wm= CTX_wm_manager(C);
+ wmWindowManager *wm = CTX_wm_manager(C);
- op= BLI_findlink(&wm->operators, RNA_int_get(op->ptr, "index"));
+ op = BLI_findlink(&wm->operators, RNA_int_get(op->ptr, "index"));
if (op) {
/* let's put it as last operator in list */
BLI_remlink(&wm->operators, op);
@@ -2546,7 +2546,7 @@ static void SCREEN_OT_repeat_history(wmOperatorType *ot)
static int redo_last_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event))
{
- wmOperator *lastop= WM_operator_last_redo(C);
+ wmOperator *lastop = WM_operator_last_redo(C);
if (lastop)
WM_operator_redo_popup(C, lastop);
@@ -2572,27 +2572,27 @@ static void SCREEN_OT_redo_last(wmOperatorType *ot)
/* insert a region in the area region list */
static int region_quadview_exec(bContext *C, wmOperator *op)
{
- ARegion *ar= CTX_wm_region(C);
+ ARegion *ar = CTX_wm_region(C);
/* some rules... */
- if (ar->regiontype!=RGN_TYPE_WINDOW)
+ if (ar->regiontype != RGN_TYPE_WINDOW)
BKE_report(op->reports, RPT_ERROR, "Only window region can be 4-splitted");
- else if (ar->alignment==RGN_ALIGN_QSPLIT) {
- ScrArea *sa= CTX_wm_area(C);
+ else if (ar->alignment == RGN_ALIGN_QSPLIT) {
+ ScrArea *sa = CTX_wm_area(C);
ARegion *arn;
/* keep current region */
- ar->alignment= 0;
+ ar->alignment = 0;
- if (sa->spacetype==SPACE_VIEW3D) {
- RegionView3D *rv3d= ar->regiondata;
- rv3d->viewlock= 0;
+ if (sa->spacetype == SPACE_VIEW3D) {
+ RegionView3D *rv3d = ar->regiondata;
+ rv3d->viewlock = 0;
rv3d->rflag &= ~RV3D_CLIPPING;
}
- for (ar= sa->regionbase.first; ar; ar= arn) {
- arn= ar->next;
- if (ar->alignment==RGN_ALIGN_QSPLIT) {
+ for (ar = sa->regionbase.first; ar; ar = arn) {
+ arn = ar->next;
+ if (ar->alignment == RGN_ALIGN_QSPLIT) {
ED_region_exit(C, ar);
BKE_area_region_free(sa->type, ar);
BLI_remlink(&sa->regionbase, ar);
@@ -2600,24 +2600,24 @@ static int region_quadview_exec(bContext *C, wmOperator *op)
}
}
ED_area_tag_redraw(sa);
- WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL);
}
else if (ar->next)
BKE_report(op->reports, RPT_ERROR, "Only last region can be 4-splitted");
else {
- ScrArea *sa= CTX_wm_area(C);
+ ScrArea *sa = CTX_wm_area(C);
ARegion *newar;
int count;
- ar->alignment= RGN_ALIGN_QSPLIT;
+ ar->alignment = RGN_ALIGN_QSPLIT;
- for (count=0; count<3; count++) {
- newar= BKE_area_region_copy(sa->type, ar);
+ for (count = 0; count < 3; count++) {
+ newar = BKE_area_region_copy(sa->type, ar);
BLI_addtail(&sa->regionbase, newar);
}
/* lock views and set them */
- if (sa->spacetype==SPACE_VIEW3D) {
+ if (sa->spacetype == SPACE_VIEW3D) {
/* run ED_view3d_lock() so the correct 'rv3d->viewquat' is set,
* otherwise when restoring rv3d->localvd the 'viewquat' won't
* match the 'view', set on entering localview See: [#26315],
@@ -2626,31 +2626,31 @@ static int region_quadview_exec(bContext *C, wmOperator *op)
* localview with a 4-split would assign these view locks */
RegionView3D *rv3d;
- rv3d= ar->regiondata;
- rv3d->viewlock= RV3D_LOCKED; rv3d->view= RV3D_VIEW_FRONT; rv3d->persp= RV3D_ORTHO;
+ rv3d = ar->regiondata;
+ rv3d->viewlock = RV3D_LOCKED; rv3d->view = RV3D_VIEW_FRONT; rv3d->persp = RV3D_ORTHO;
ED_view3d_lock(rv3d);
- if (rv3d->localvd) { rv3d->localvd->view = rv3d->view; rv3d->localvd->persp = rv3d->persp; copy_qt_qt(rv3d->localvd->viewquat, rv3d->viewquat);}
+ if (rv3d->localvd) { rv3d->localvd->view = rv3d->view; rv3d->localvd->persp = rv3d->persp; copy_qt_qt(rv3d->localvd->viewquat, rv3d->viewquat); }
- ar= ar->next;
- rv3d= ar->regiondata;
- rv3d->viewlock= RV3D_LOCKED; rv3d->view= RV3D_VIEW_TOP; rv3d->persp= RV3D_ORTHO;
+ ar = ar->next;
+ rv3d = ar->regiondata;
+ rv3d->viewlock = RV3D_LOCKED; rv3d->view = RV3D_VIEW_TOP; rv3d->persp = RV3D_ORTHO;
ED_view3d_lock(rv3d);
- if (rv3d->localvd) { rv3d->localvd->view = rv3d->view; rv3d->localvd->persp = rv3d->persp; copy_qt_qt(rv3d->localvd->viewquat, rv3d->viewquat);}
+ if (rv3d->localvd) { rv3d->localvd->view = rv3d->view; rv3d->localvd->persp = rv3d->persp; copy_qt_qt(rv3d->localvd->viewquat, rv3d->viewquat); }
- ar= ar->next;
- rv3d= ar->regiondata;
- rv3d->viewlock= RV3D_LOCKED; rv3d->view= RV3D_VIEW_RIGHT; rv3d->persp= RV3D_ORTHO;
+ ar = ar->next;
+ rv3d = ar->regiondata;
+ rv3d->viewlock = RV3D_LOCKED; rv3d->view = RV3D_VIEW_RIGHT; rv3d->persp = RV3D_ORTHO;
ED_view3d_lock(rv3d);
- if (rv3d->localvd) { rv3d->localvd->view = rv3d->view; rv3d->localvd->persp = rv3d->persp; copy_qt_qt(rv3d->localvd->viewquat, rv3d->viewquat);}
+ if (rv3d->localvd) { rv3d->localvd->view = rv3d->view; rv3d->localvd->persp = rv3d->persp; copy_qt_qt(rv3d->localvd->viewquat, rv3d->viewquat); }
- ar= ar->next;
- rv3d= ar->regiondata;
- rv3d->view= RV3D_VIEW_CAMERA; rv3d->persp= RV3D_CAMOB;
+ ar = ar->next;
+ rv3d = ar->regiondata;
+ rv3d->view = RV3D_VIEW_CAMERA; rv3d->persp = RV3D_CAMOB;
ED_view3d_lock(rv3d);
- if (rv3d->localvd) {rv3d->localvd->view = rv3d->view; rv3d->localvd->persp = rv3d->persp; copy_qt_qt(rv3d->localvd->viewquat, rv3d->viewquat);}
+ if (rv3d->localvd) {rv3d->localvd->view = rv3d->view; rv3d->localvd->persp = rv3d->persp; copy_qt_qt(rv3d->localvd->viewquat, rv3d->viewquat); }
}
ED_area_tag_redraw(sa);
- WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL);
}
@@ -2678,22 +2678,22 @@ static void SCREEN_OT_region_quadview(wmOperatorType *ot)
/* flip a region alignment */
static int region_flip_exec(bContext *C, wmOperator *UNUSED(op))
{
- ARegion *ar= CTX_wm_region(C);
+ ARegion *ar = CTX_wm_region(C);
if (!ar)
return OPERATOR_CANCELLED;
- if (ar->alignment==RGN_ALIGN_TOP)
- ar->alignment= RGN_ALIGN_BOTTOM;
- else if (ar->alignment==RGN_ALIGN_BOTTOM)
- ar->alignment= RGN_ALIGN_TOP;
- else if (ar->alignment==RGN_ALIGN_LEFT)
- ar->alignment= RGN_ALIGN_RIGHT;
- else if (ar->alignment==RGN_ALIGN_RIGHT)
- ar->alignment= RGN_ALIGN_LEFT;
+ if (ar->alignment == RGN_ALIGN_TOP)
+ ar->alignment = RGN_ALIGN_BOTTOM;
+ else if (ar->alignment == RGN_ALIGN_BOTTOM)
+ ar->alignment = RGN_ALIGN_TOP;
+ else if (ar->alignment == RGN_ALIGN_LEFT)
+ ar->alignment = RGN_ALIGN_RIGHT;
+ else if (ar->alignment == RGN_ALIGN_RIGHT)
+ ar->alignment = RGN_ALIGN_LEFT;
ED_area_tag_redraw(CTX_wm_area(C));
- WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL);
return OPERATOR_FINISHED;
}
@@ -2717,14 +2717,14 @@ static void SCREEN_OT_region_flip(wmOperatorType *ot)
/* flip a header region alignment */
static int header_flip_exec(bContext *C, wmOperator *UNUSED(op))
{
- ARegion *ar= CTX_wm_region(C);
+ ARegion *ar = CTX_wm_region(C);
/* find the header region
* - try context first, but upon failing, search all regions in area...
*/
if ((ar == NULL) || (ar->regiontype != RGN_TYPE_HEADER)) {
- ScrArea *sa= CTX_wm_area(C);
- ar= BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
+ ScrArea *sa = CTX_wm_area(C);
+ ar = BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
/* don't do anything if no region */
if (ar == NULL)
@@ -2732,18 +2732,18 @@ static int header_flip_exec(bContext *C, wmOperator *UNUSED(op))
}
/* copied from SCREEN_OT_region_flip */
- if (ar->alignment==RGN_ALIGN_TOP)
- ar->alignment= RGN_ALIGN_BOTTOM;
- else if (ar->alignment==RGN_ALIGN_BOTTOM)
- ar->alignment= RGN_ALIGN_TOP;
- else if (ar->alignment==RGN_ALIGN_LEFT)
- ar->alignment= RGN_ALIGN_RIGHT;
- else if (ar->alignment==RGN_ALIGN_RIGHT)
- ar->alignment= RGN_ALIGN_LEFT;
+ if (ar->alignment == RGN_ALIGN_TOP)
+ ar->alignment = RGN_ALIGN_BOTTOM;
+ else if (ar->alignment == RGN_ALIGN_BOTTOM)
+ ar->alignment = RGN_ALIGN_TOP;
+ else if (ar->alignment == RGN_ALIGN_LEFT)
+ ar->alignment = RGN_ALIGN_RIGHT;
+ else if (ar->alignment == RGN_ALIGN_RIGHT)
+ ar->alignment = RGN_ALIGN_LEFT;
ED_area_tag_redraw(CTX_wm_area(C));
- WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL);
return OPERATOR_FINISHED;
}
@@ -2767,13 +2767,13 @@ static void SCREEN_OT_header_flip(wmOperatorType *ot)
static int header_toolbox_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event))
{
- ScrArea *sa= CTX_wm_area(C);
- ARegion *ar= CTX_wm_region(C);
+ ScrArea *sa = CTX_wm_area(C);
+ ARegion *ar = CTX_wm_region(C);
uiPopupMenu *pup;
uiLayout *layout;
- pup= uiPupMenuBegin(C, "Header", ICON_NONE);
- layout= uiPupMenuLayout(pup);
+ pup = uiPupMenuBegin(C, "Header", ICON_NONE);
+ layout = uiPupMenuLayout(pup);
// XXX SCREEN_OT_region_flip doesn't work - gets wrong context for active region, so added custom operator
if (ar->alignment == RGN_ALIGN_TOP)
@@ -2823,7 +2823,7 @@ static int match_area_with_refresh(int spacetype, int refresh)
static int match_region_with_redraws(int spacetype, int regiontype, int redraws)
{
- if (regiontype==RGN_TYPE_WINDOW) {
+ if (regiontype == RGN_TYPE_WINDOW) {
switch (spacetype) {
case SPACE_VIEW3D:
@@ -2838,7 +2838,7 @@ static int match_region_with_redraws(int spacetype, int regiontype, int redraws)
break;
case SPACE_TIME:
/* if only 1 window or 3d windows, we do timeline too */
- if (redraws & (TIME_ALL_ANIM_WIN|TIME_REGION|TIME_ALL_3D_WIN))
+ if (redraws & (TIME_ALL_ANIM_WIN | TIME_REGION | TIME_ALL_3D_WIN))
return 1;
break;
case SPACE_BUTS:
@@ -2846,7 +2846,7 @@ static int match_region_with_redraws(int spacetype, int regiontype, int redraws)
return 1;
break;
case SPACE_SEQ:
- if (redraws & (TIME_SEQ|TIME_ALL_ANIM_WIN))
+ if (redraws & (TIME_SEQ | TIME_ALL_ANIM_WIN))
return 1;
break;
case SPACE_NODE:
@@ -2864,8 +2864,8 @@ static int match_region_with_redraws(int spacetype, int regiontype, int redraws)
}
}
- else if (regiontype==RGN_TYPE_UI) {
- if (spacetype==SPACE_CLIP) {
+ else if (regiontype == RGN_TYPE_UI) {
+ if (spacetype == SPACE_CLIP) {
/* Track Preview button is on Properties Editor in SpaceClip,
* and it's very common case when users want it be refreshing
* during playback, so asking people to enable special option
@@ -2877,14 +2877,14 @@ static int match_region_with_redraws(int spacetype, int regiontype, int redraws)
if (redraws & TIME_ALL_BUTS_WIN)
return 1;
}
- else if (regiontype==RGN_TYPE_HEADER) {
- if (spacetype==SPACE_TIME)
+ else if (regiontype == RGN_TYPE_HEADER) {
+ if (spacetype == SPACE_TIME)
return 1;
}
- else if (regiontype==RGN_TYPE_PREVIEW) {
+ else if (regiontype == RGN_TYPE_PREVIEW) {
switch (spacetype) {
case SPACE_SEQ:
- if (redraws & (TIME_SEQ|TIME_ALL_ANIM_WIN))
+ if (redraws & (TIME_SEQ | TIME_ALL_ANIM_WIN))
return 1;
break;
case SPACE_CLIP:
@@ -2896,21 +2896,21 @@ static int match_region_with_redraws(int spacetype, int regiontype, int redraws)
static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
{
- bScreen *screen= CTX_wm_screen(C);
+ bScreen *screen = CTX_wm_screen(C);
- if (screen->animtimer && screen->animtimer==event->customdata) {
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
- wmTimer *wt= screen->animtimer;
- ScreenAnimData *sad= wt->customdata;
+ if (screen->animtimer && screen->animtimer == event->customdata) {
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+ wmTimer *wt = screen->animtimer;
+ ScreenAnimData *sad = wt->customdata;
ScrArea *sa;
int sync;
float time;
/* sync, don't sync, or follow scene setting */
- if (sad->flag & ANIMPLAY_FLAG_SYNC) sync= 1;
- else if (sad->flag & ANIMPLAY_FLAG_NO_SYNC) sync= 0;
- else sync= (scene->flag & SCE_FRAME_DROP);
+ if (sad->flag & ANIMPLAY_FLAG_SYNC) sync = 1;
+ else if (sad->flag & ANIMPLAY_FLAG_NO_SYNC) sync = 0;
+ else sync = (scene->flag & SCE_FRAME_DROP);
if ((scene->audio.flag & AUDIO_SYNC) &&
(sad->flag & ANIMPLAY_FLAG_REVERSE) == FALSE &&
@@ -2945,13 +2945,13 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), wmEvent *e
/* jump back to end? */
if (PRVRANGEON) {
if (scene->r.cfra < scene->r.psfra) {
- scene->r.cfra= scene->r.pefra;
+ scene->r.cfra = scene->r.pefra;
sad->flag |= ANIMPLAY_FLAG_JUMPED;
}
}
else {
if (scene->r.cfra < scene->r.sfra) {
- scene->r.cfra= scene->r.efra;
+ scene->r.cfra = scene->r.efra;
sad->flag |= ANIMPLAY_FLAG_JUMPED;
}
}
@@ -2960,13 +2960,13 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), wmEvent *e
/* jump back to start? */
if (PRVRANGEON) {
if (scene->r.cfra > scene->r.pefra) {
- scene->r.cfra= scene->r.psfra;
+ scene->r.cfra = scene->r.psfra;
sad->flag |= ANIMPLAY_FLAG_JUMPED;
}
}
else {
if (scene->r.cfra > scene->r.efra) {
- scene->r.cfra= scene->r.sfra;
+ scene->r.cfra = scene->r.sfra;
sad->flag |= ANIMPLAY_FLAG_JUMPED;
}
}
@@ -2985,14 +2985,14 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), wmEvent *e
/* since we follow drawflags, we can't send notifier but tag regions ourselves */
ED_update_for_newframe(CTX_data_main(C), scene, screen, 1);
- for (sa= screen->areabase.first; sa; sa= sa->next) {
+ for (sa = screen->areabase.first; sa; sa = sa->next) {
ARegion *ar;
- for (ar= sa->regionbase.first; ar; ar= ar->next) {
- if (ar==sad->ar)
+ for (ar = sa->regionbase.first; ar; ar = ar->next) {
+ if (ar == sad->ar)
ED_region_tag_redraw(ar);
else
- if (match_region_with_redraws(sa->spacetype, ar->regiontype, sad->redraws))
- ED_region_tag_redraw(ar);
+ if (match_region_with_redraws(sa->spacetype, ar->regiontype, sad->redraws))
+ ED_region_tag_redraw(ar);
}
if (match_area_with_refresh(sa->spacetype, sad->refresh))
@@ -3009,7 +3009,7 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), wmEvent *e
* since the frames-per-second value may have been changed
*/
// TODO: this may make evaluation a bit slower if the value doesn't change... any way to avoid this?
- wt->timestep= (1.0/FPS);
+ wt->timestep = (1.0 / FPS);
return OPERATOR_FINISHED;
}
@@ -3035,7 +3035,7 @@ static void SCREEN_OT_animation_step(wmOperatorType *ot)
/* toggle operator */
int ED_screen_animation_play(bContext *C, int sync, int mode)
{
- bScreen *screen= CTX_wm_screen(C);
+ bScreen *screen = CTX_wm_screen(C);
Scene *scene = CTX_data_scene(C);
if (screen->animtimer) {
@@ -3044,7 +3044,7 @@ int ED_screen_animation_play(bContext *C, int sync, int mode)
sound_stop_scene(scene);
}
else {
- int refresh= SPACE_TIME; /* these settings are currently only available from a menu in the TimeLine */
+ int refresh = SPACE_TIME; /* these settings are currently only available from a menu in the TimeLine */
if (mode == 1) // XXX only play audio forwards!?
sound_play_scene(scene);
@@ -3052,10 +3052,10 @@ int ED_screen_animation_play(bContext *C, int sync, int mode)
ED_screen_animation_timer(C, screen->redraws_flag, refresh, sync, mode);
if (screen->animtimer) {
- wmTimer *wt= screen->animtimer;
- ScreenAnimData *sad= wt->customdata;
+ wmTimer *wt = screen->animtimer;
+ ScreenAnimData *sad = wt->customdata;
- sad->ar= CTX_wm_region(C);
+ sad->ar = CTX_wm_region(C);
}
}
@@ -3064,11 +3064,11 @@ int ED_screen_animation_play(bContext *C, int sync, int mode)
static int screen_animation_play_exec(bContext *C, wmOperator *op)
{
- int mode= (RNA_boolean_get(op->ptr, "reverse")) ? -1 : 1;
- int sync= -1;
+ int mode = (RNA_boolean_get(op->ptr, "reverse")) ? -1 : 1;
+ int sync = -1;
if (RNA_struct_property_is_set(op->ptr, "sync"))
- sync= (RNA_boolean_get(op->ptr, "sync"));
+ sync = (RNA_boolean_get(op->ptr, "sync"));
return ED_screen_animation_play(C, sync, mode);
}
@@ -3095,19 +3095,19 @@ static void SCREEN_OT_animation_play(wmOperatorType *ot)
static int screen_animation_cancel_exec(bContext *C, wmOperator *op)
{
- bScreen *screen= CTX_wm_screen(C);
+ bScreen *screen = CTX_wm_screen(C);
if (screen->animtimer) {
if (RNA_boolean_get(op->ptr, "restore_frame")) {
- ScreenAnimData *sad= screen->animtimer->customdata;
- Scene *scene= CTX_data_scene(C);
+ ScreenAnimData *sad = screen->animtimer->customdata;
+ Scene *scene = CTX_data_scene(C);
/* reset current frame before stopping, and just send a notifier to deal with the rest
* (since playback still needs to be stopped)
*/
- scene->r.cfra= sad->sfra;
+ scene->r.cfra = sad->sfra;
- WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
+ WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
}
/* call the other "toggling" operator to clean up now */
@@ -3155,11 +3155,11 @@ static void SCREEN_OT_animation_cancel(wmOperatorType *ot)
#if 0
static int border_select_do(bContext *C, wmOperator *op)
{
- int event_type= RNA_int_get(op->ptr, "event_type");
+ int event_type = RNA_int_get(op->ptr, "event_type");
- if (event_type==LEFTMOUSE)
+ if (event_type == LEFTMOUSE)
printf("border select do select\n");
- else if (event_type==RIGHTMOUSE)
+ else if (event_type == RIGHTMOUSE)
printf("border select deselect\n");
else
printf("border select do something\n");
@@ -3197,10 +3197,10 @@ static void SCREEN_OT_border_select(wmOperatorType *ot)
static int fullscreen_back_exec(bContext *C, wmOperator *op)
{
bScreen *screen = CTX_wm_screen(C);
- ScrArea *sa=NULL;
+ ScrArea *sa = NULL;
/* search current screen for 'fullscreen' areas */
- for (sa=screen->areabase.first; sa; sa=sa->next) {
+ for (sa = screen->areabase.first; sa; sa = sa->next) {
if (sa->full) break;
}
if (!sa) {
@@ -3232,12 +3232,12 @@ static int userpref_show_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *ev
rcti rect;
int sizex, sizey;
- sizex= 800;
- sizey= 480;
+ sizex = 800;
+ sizey = 480;
/* some magic to calculate postition */
- rect.xmin = event->x + CTX_wm_window(C)->posx - sizex/2;
- rect.ymin = event->y + CTX_wm_window(C)->posy - sizey/2;
+ rect.xmin = event->x + CTX_wm_window(C)->posx - sizex / 2;
+ rect.ymin = event->y + CTX_wm_window(C)->posy - sizey / 2;
rect.xmax = rect.xmin + sizex;
rect.ymax = rect.ymin + sizey;
@@ -3264,11 +3264,11 @@ static void SCREEN_OT_userpref_show(struct wmOperatorType *ot)
static int screen_new_exec(bContext *C, wmOperator *UNUSED(op))
{
- wmWindow *win= CTX_wm_window(C);
- bScreen *sc= CTX_wm_screen(C);
+ wmWindow *win = CTX_wm_window(C);
+ bScreen *sc = CTX_wm_screen(C);
- sc= ED_screen_duplicate(win, sc);
- WM_event_add_notifier(C, NC_SCREEN|ND_SCREENBROWSE, sc);
+ sc = ED_screen_duplicate(win, sc);
+ WM_event_add_notifier(C, NC_SCREEN | ND_SCREENBROWSE, sc);
return OPERATOR_FINISHED;
}
@@ -3285,16 +3285,16 @@ static void SCREEN_OT_new(wmOperatorType *ot)
ot->poll = WM_operator_winactive;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/********************* delete screen operator *********************/
static int screen_delete_exec(bContext *C, wmOperator *UNUSED(op))
{
- bScreen *sc= CTX_wm_screen(C);
+ bScreen *sc = CTX_wm_screen(C);
- WM_event_add_notifier(C, NC_SCREEN|ND_SCREENDELETE, sc);
+ WM_event_add_notifier(C, NC_SCREEN | ND_SCREENDELETE, sc);
return OPERATOR_FINISHED;
}
@@ -3310,22 +3310,22 @@ static void SCREEN_OT_delete(wmOperatorType *ot)
ot->exec = screen_delete_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/********************* new scene operator *********************/
static int scene_new_exec(bContext *C, wmOperator *op)
{
- Scene *newscene, *scene= CTX_data_scene(C);
- Main *bmain= CTX_data_main(C);
- int type= RNA_enum_get(op->ptr, "type");
+ Scene *newscene, *scene = CTX_data_scene(C);
+ Main *bmain = CTX_data_main(C);
+ int type = RNA_enum_get(op->ptr, "type");
if (type == SCE_COPY_NEW) {
- newscene= BKE_scene_add("Scene");
+ newscene = BKE_scene_add("Scene");
}
else { /* different kinds of copying */
- newscene= BKE_scene_copy(scene, type);
+ newscene = BKE_scene_copy(scene, type);
/* these can't be handled in blenkernel curently, so do them here */
if (type == SCE_COPY_LINK_DATA) {
@@ -3338,14 +3338,14 @@ static int scene_new_exec(bContext *C, wmOperator *op)
ED_screen_set_scene(C, CTX_wm_screen(C), newscene);
- WM_event_add_notifier(C, NC_SCENE|ND_SCENEBROWSE, newscene);
+ WM_event_add_notifier(C, NC_SCENE | ND_SCENEBROWSE, newscene);
return OPERATOR_FINISHED;
}
static void SCENE_OT_new(wmOperatorType *ot)
{
- static EnumPropertyItem type_items[]= {
+ static EnumPropertyItem type_items[] = {
{SCE_COPY_NEW, "NEW", 0, "New", "Add new scene"},
{SCE_COPY_EMPTY, "EMPTY", 0, "Copy Settings", "Make a copy without any objects"},
{SCE_COPY_LINK_OB, "LINK_OBJECTS", 0, "Link Objects", "Link to the objects from the current scene"},
@@ -3363,7 +3363,7 @@ static void SCENE_OT_new(wmOperatorType *ot)
ot->invoke = WM_menu_invoke;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
ot->prop = RNA_def_enum(ot->srna, "type", type_items, 0, "Type", "");
@@ -3373,14 +3373,14 @@ static void SCENE_OT_new(wmOperatorType *ot)
static int scene_delete_exec(bContext *C, wmOperator *UNUSED(op))
{
- Scene *scene= CTX_data_scene(C);
+ Scene *scene = CTX_data_scene(C);
ED_screen_delete_scene(C, scene);
if (G.debug & G_DEBUG)
printf("scene delete %p\n", scene);
- WM_event_add_notifier(C, NC_SCENE|NA_REMOVED, scene);
+ WM_event_add_notifier(C, NC_SCENE | NA_REMOVED, scene);
return OPERATOR_FINISHED;
}
@@ -3396,7 +3396,7 @@ static void SCENE_OT_delete(wmOperatorType *ot)
ot->exec = scene_delete_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* **************** Assigning operatortypes to global list, adding handlers **************** */
@@ -3465,7 +3465,7 @@ static void keymap_modal_set(wmKeyConfig *keyconf)
wmKeyMap *keymap;
/* Standard Modal keymap ------------------------------------------------ */
- keymap= WM_modalkeymap_add(keyconf, "Standard Modal Map", modal_items);
+ keymap = WM_modalkeymap_add(keyconf, "Standard Modal Map", modal_items);
WM_modalkeymap_add_item(keymap, ESCKEY, KM_PRESS, KM_ANY, 0, KM_MODAL_CANCEL);
WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_ANY, KM_ANY, 0, KM_MODAL_APPLY);
@@ -3481,8 +3481,8 @@ static void keymap_modal_set(wmKeyConfig *keyconf)
static int open_file_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event))
{
- if (drag->type==WM_DRAG_PATH) {
- if (drag->icon==ICON_FILE_BLEND)
+ if (drag->type == WM_DRAG_PATH) {
+ if (drag->icon == ICON_FILE_BLEND)
return 1;
}
return 0;
@@ -3492,7 +3492,7 @@ static void open_file_drop_copy(wmDrag *drag, wmDropBox *drop)
{
/* copy drag path to properties */
RNA_string_set(drop->ptr, "filepath", drag->path);
- drop->opcontext= WM_OP_EXEC_DEFAULT;
+ drop->opcontext = WM_OP_EXEC_DEFAULT;
}
@@ -3543,7 +3543,7 @@ void ED_keymap_screen(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "SCREEN_OT_screencast", F3KEY, KM_PRESS, KM_ALT, 0);
/* tests */
- WM_keymap_add_item(keymap, "SCREEN_OT_region_quadview", QKEY, KM_PRESS, KM_CTRL|KM_ALT, 0);
+ WM_keymap_add_item(keymap, "SCREEN_OT_region_quadview", QKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
WM_keymap_verify_item(keymap, "SCREEN_OT_repeat_history", F3KEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "SCREEN_OT_repeat_last", RKEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_verify_item(keymap, "SCREEN_OT_region_flip", F5KEY, KM_PRESS, 0, 0);
@@ -3558,12 +3558,12 @@ void ED_keymap_screen(wmKeyConfig *keyconf)
/* undo */
#ifdef __APPLE__
WM_keymap_add_item(keymap, "ED_OT_undo", ZKEY, KM_PRESS, KM_OSKEY, 0);
- WM_keymap_add_item(keymap, "ED_OT_redo", ZKEY, KM_PRESS, KM_SHIFT|KM_OSKEY, 0);
- WM_keymap_add_item(keymap, "ED_OT_undo_history", ZKEY, KM_PRESS, KM_ALT|KM_OSKEY, 0);
+ WM_keymap_add_item(keymap, "ED_OT_redo", ZKEY, KM_PRESS, KM_SHIFT | KM_OSKEY, 0);
+ WM_keymap_add_item(keymap, "ED_OT_undo_history", ZKEY, KM_PRESS, KM_ALT | KM_OSKEY, 0);
#endif
WM_keymap_add_item(keymap, "ED_OT_undo", ZKEY, KM_PRESS, KM_CTRL, 0);
- WM_keymap_add_item(keymap, "ED_OT_redo", ZKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
- WM_keymap_add_item(keymap, "ED_OT_undo_history", ZKEY, KM_PRESS, KM_ALT|KM_CTRL, 0);
+ WM_keymap_add_item(keymap, "ED_OT_redo", ZKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0);
+ WM_keymap_add_item(keymap, "ED_OT_undo_history", ZKEY, KM_PRESS, KM_ALT | KM_CTRL, 0);
/* render */
@@ -3578,7 +3578,7 @@ void ED_keymap_screen(wmKeyConfig *keyconf)
#ifdef __APPLE__
WM_keymap_add_item(keymap, "SCREEN_OT_userpref_show", COMMAKEY, KM_PRESS, KM_OSKEY, 0);
#endif
- WM_keymap_add_item(keymap, "SCREEN_OT_userpref_show", UKEY, KM_PRESS, KM_CTRL|KM_ALT, 0);
+ WM_keymap_add_item(keymap, "SCREEN_OT_userpref_show", UKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
/* Anim Playback ------------------------------------------------ */
@@ -3593,8 +3593,8 @@ void ED_keymap_screen(wmKeyConfig *keyconf)
RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_offset", WHEELDOWNMOUSE, KM_PRESS, KM_ALT, 0)->ptr, "delta", 1);
RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_offset", WHEELUPMOUSE, KM_PRESS, KM_ALT, 0)->ptr, "delta", -1);
- RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", UPARROWKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0)->ptr, "end", TRUE);
- RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", DOWNARROWKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0)->ptr, "end", FALSE);
+ RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", UPARROWKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0)->ptr, "end", TRUE);
+ RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", DOWNARROWKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0)->ptr, "end", FALSE);
RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", RIGHTARROWKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "end", TRUE);
RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", LEFTARROWKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "end", FALSE);
@@ -3612,7 +3612,7 @@ void ED_keymap_screen(wmKeyConfig *keyconf)
/* play (forward and backwards) */
WM_keymap_add_item(keymap, "SCREEN_OT_animation_play", AKEY, KM_PRESS, KM_ALT, 0);
- RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_animation_play", AKEY, KM_PRESS, KM_ALT|KM_SHIFT, 0)->ptr, "reverse", TRUE);
+ RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_animation_play", AKEY, KM_PRESS, KM_ALT | KM_SHIFT, 0)->ptr, "reverse", TRUE);
WM_keymap_add_item(keymap, "SCREEN_OT_animation_cancel", ESCKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "SCREEN_OT_animation_play", MEDIAPLAY, KM_PRESS, 0, 0);
@@ -3622,17 +3622,17 @@ void ED_keymap_screen(wmKeyConfig *keyconf)
#if 0 // XXX: disabled for restoring later... bad implementation
keymap = WM_keymap_find(keyconf, "Frames", 0, 0);
kmi = WM_keymap_add_item(keymap, "SCREEN_OT_animation_play", RIGHTARROWKEY, KM_PRESS, KM_ALT, 0);
- RNA_boolean_set(kmi->ptr, "cycle_speed", TRUE);
+ RNA_boolean_set(kmi->ptr, "cycle_speed", TRUE);
kmi = WM_keymap_add_item(keymap, "SCREEN_OT_animation_play", LEFTARROWKEY, KM_PRESS, KM_ALT, 0);
- RNA_boolean_set(kmi->ptr, "reverse", TRUE);
- RNA_boolean_set(kmi->ptr, "cycle_speed", TRUE);
+ RNA_boolean_set(kmi->ptr, "reverse", TRUE);
+ RNA_boolean_set(kmi->ptr, "cycle_speed", TRUE);
WM_keymap_add_item(keymap, "SCREEN_OT_animation_play", DOWNARROWKEY, KM_PRESS, KM_ALT, 0);
#endif
/* dropbox for entire window */
- lb= WM_dropboxmap_find("Window", 0, 0);
+ lb = WM_dropboxmap_find("Window", 0, 0);
WM_dropbox_add(lb, "WM_OT_open_mainfile", open_file_drop_poll, open_file_drop_copy);
keymap_modal_set(keyconf);
diff --git a/source/blender/editors/space_script/script_edit.c b/source/blender/editors/space_script/script_edit.c
index 4ff0c7ba5b3..4e6783e1862 100644
--- a/source/blender/editors/space_script/script_edit.c
+++ b/source/blender/editors/space_script/script_edit.c
@@ -46,7 +46,7 @@
#include "ED_screen.h"
-#include "script_intern.h" // own include
+#include "script_intern.h" // own include
#ifdef WITH_PYTHON
#include "BPY_extern.h" /* BPY_script_exec */
@@ -58,7 +58,7 @@ static int run_pyfile_exec(bContext *C, wmOperator *op)
RNA_string_get(op->ptr, "filepath", path);
#ifdef WITH_PYTHON
if (BPY_filepath_exec(C, path, op->reports)) {
- ARegion *ar= CTX_wm_region(C);
+ ARegion *ar = CTX_wm_region(C);
ED_region_tag_redraw(ar);
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/space_script/script_ops.c b/source/blender/editors/space_script/script_ops.c
index 0c99d9b34c4..57a1112a832 100644
--- a/source/blender/editors/space_script/script_ops.c
+++ b/source/blender/editors/space_script/script_ops.c
@@ -63,6 +63,6 @@ void script_keymap(wmKeyConfig *keyconf)
wmKeyMap *keymap = WM_keymap_find(keyconf, "Script", SPACE_SCRIPT, 0);
/* TODO - this is just while we have no way to load a text datablock */
- RNA_string_set(WM_keymap_add_item(keymap, "SCRIPT_OT_python_file_run", PKEY, KM_PRESS, KM_CTRL|KM_SHIFT|KM_ALT, 0)->ptr, "filepath", "test.py");
+ RNA_string_set(WM_keymap_add_item(keymap, "SCRIPT_OT_python_file_run", PKEY, KM_PRESS, KM_CTRL | KM_SHIFT | KM_ALT, 0)->ptr, "filepath", "test.py");
}
diff --git a/source/blender/editors/space_script/space_script.c b/source/blender/editors/space_script/space_script.c
index bad9a01fbcf..1fbd6f08b34 100644
--- a/source/blender/editors/space_script/space_script.c
+++ b/source/blender/editors/space_script/space_script.c
@@ -57,7 +57,7 @@
#include "BPY_extern.h"
#endif
-#include "script_intern.h" // own include
+#include "script_intern.h" // own include
//static script_run_python(char *funcname, )
@@ -70,22 +70,22 @@ static SpaceLink *script_new(const bContext *UNUSED(C))
ARegion *ar;
SpaceScript *sscript;
- sscript= MEM_callocN(sizeof(SpaceScript), "initscript");
- sscript->spacetype= SPACE_SCRIPT;
+ sscript = MEM_callocN(sizeof(SpaceScript), "initscript");
+ sscript->spacetype = SPACE_SCRIPT;
/* header */
- ar= MEM_callocN(sizeof(ARegion), "header for script");
+ ar = MEM_callocN(sizeof(ARegion), "header for script");
BLI_addtail(&sscript->regionbase, ar);
- ar->regiontype= RGN_TYPE_HEADER;
- ar->alignment= RGN_ALIGN_BOTTOM;
+ ar->regiontype = RGN_TYPE_HEADER;
+ ar->alignment = RGN_ALIGN_BOTTOM;
/* main area */
- ar= MEM_callocN(sizeof(ARegion), "main area for script");
+ ar = MEM_callocN(sizeof(ARegion), "main area for script");
BLI_addtail(&sscript->regionbase, ar);
- ar->regiontype= RGN_TYPE_WINDOW;
+ ar->regiontype = RGN_TYPE_WINDOW;
/* channel list region XXX */
@@ -96,7 +96,7 @@ static SpaceLink *script_new(const bContext *UNUSED(C))
/* not spacelink itself */
static void script_free(SpaceLink *sl)
{
- SpaceScript *sscript= (SpaceScript*) sl;
+ SpaceScript *sscript = (SpaceScript *) sl;
#ifdef WITH_PYTHON
/*free buttons references*/
@@ -118,7 +118,7 @@ static void script_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa))
static SpaceLink *script_duplicate(SpaceLink *sl)
{
- SpaceScript *sscriptn= MEM_dupallocN(sl);
+ SpaceScript *sscriptn = MEM_dupallocN(sl);
/* clear or remove stuff from old */
@@ -142,8 +142,8 @@ static void script_main_area_init(wmWindowManager *wm, ARegion *ar)
static void script_main_area_draw(const bContext *C, ARegion *ar)
{
/* draw entirely, view changes should be handled here */
- SpaceScript *sscript= (SpaceScript*)CTX_wm_space_data(C);
- View2D *v2d= &ar->v2d;
+ SpaceScript *sscript = (SpaceScript *)CTX_wm_space_data(C);
+ View2D *v2d = &ar->v2d;
/* clear and setup matrix */
UI_ThemeClearColor(TH_BACK);
@@ -189,37 +189,37 @@ static void script_main_area_listener(ARegion *UNUSED(ar), wmNotifier *UNUSED(wm
/* only called once, from space/spacetypes.c */
void ED_spacetype_script(void)
{
- SpaceType *st= MEM_callocN(sizeof(SpaceType), "spacetype script");
+ SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype script");
ARegionType *art;
- st->spaceid= SPACE_SCRIPT;
+ st->spaceid = SPACE_SCRIPT;
strncpy(st->name, "Script", BKE_ST_MAXNAME);
- st->new= script_new;
- st->free= script_free;
- st->init= script_init;
- st->duplicate= script_duplicate;
- st->operatortypes= script_operatortypes;
- st->keymap= script_keymap;
+ st->new = script_new;
+ st->free = script_free;
+ st->init = script_init;
+ st->duplicate = script_duplicate;
+ st->operatortypes = script_operatortypes;
+ st->keymap = script_keymap;
/* regions: main window */
- art= MEM_callocN(sizeof(ARegionType), "spacetype script region");
+ art = MEM_callocN(sizeof(ARegionType), "spacetype script region");
art->regionid = RGN_TYPE_WINDOW;
- art->init= script_main_area_init;
- art->draw= script_main_area_draw;
- art->listener= script_main_area_listener;
- art->keymapflag= ED_KEYMAP_VIEW2D| ED_KEYMAP_UI|ED_KEYMAP_FRAMES; // XXX need to further test this ED_KEYMAP_UI is needed for button interaction
+ art->init = script_main_area_init;
+ art->draw = script_main_area_draw;
+ art->listener = script_main_area_listener;
+ art->keymapflag = ED_KEYMAP_VIEW2D | ED_KEYMAP_UI | ED_KEYMAP_FRAMES; // XXX need to further test this ED_KEYMAP_UI is needed for button interaction
BLI_addhead(&st->regiontypes, art);
/* regions: header */
- art= MEM_callocN(sizeof(ARegionType), "spacetype script region");
+ art = MEM_callocN(sizeof(ARegionType), "spacetype script region");
art->regionid = RGN_TYPE_HEADER;
- art->prefsizey= HEADERY;
- art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_HEADER;
+ art->prefsizey = HEADERY;
+ art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_HEADER;
- art->init= script_header_area_init;
- art->draw= script_header_area_draw;
+ art->init = script_header_area_init;
+ art->draw = script_header_area_draw;
BLI_addhead(&st->regiontypes, art);
diff --git a/source/blender/editors/space_sequencer/sequencer_intern.h b/source/blender/editors/space_sequencer/sequencer_intern.h
index e63a3052d26..fd536524c11 100644
--- a/source/blender/editors/space_sequencer/sequencer_intern.h
+++ b/source/blender/editors/space_sequencer/sequencer_intern.h
@@ -145,18 +145,18 @@ void SEQUENCER_OT_effect_strip_add(struct wmOperatorType *ot);
/* RNA enums, just to be more readable */
enum {
- SEQ_SIDE_NONE=0,
+ SEQ_SIDE_NONE = 0,
SEQ_SIDE_LEFT,
SEQ_SIDE_RIGHT,
- SEQ_SIDE_BOTH,
+ SEQ_SIDE_BOTH
};
enum {
SEQ_CUT_SOFT,
- SEQ_CUT_HARD,
+ SEQ_CUT_HARD
};
enum {
SEQ_SELECTED,
- SEQ_UNSELECTED,
+ SEQ_UNSELECTED
};
/* defines used internally */
diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c
index 677bab37163..be48b161737 100644
--- a/source/blender/editors/space_sequencer/sequencer_select.c
+++ b/source/blender/editors/space_sequencer/sequencer_select.c
@@ -1094,7 +1094,7 @@ static short select_grouped_effect_link(Editing *ed, Sequence *actseq)
SEQP_BEGIN (ed, seq)
{
- seq->tmp= NULL;
+ seq->tmp = NULL;
}
SEQ_END;
diff --git a/source/blender/imbuf/intern/rectop.c b/source/blender/imbuf/intern/rectop.c
index 9f025803c2e..2d765c7d6a1 100644
--- a/source/blender/imbuf/intern/rectop.c
+++ b/source/blender/imbuf/intern/rectop.c
@@ -49,55 +49,55 @@ static void blend_color_mix(char *cp, char *cp1, char *cp2, int fac)
/* this and other blending modes previously used >>8 instead of /255. both
* are not equivalent (>>8 is /256), and the former results in rounding
* errors that can turn colors black fast after repeated blending */
- int mfac= 255-fac;
+ int mfac = 255 - fac;
- cp[0]= (mfac*cp1[0]+fac*cp2[0])/255;
- cp[1]= (mfac*cp1[1]+fac*cp2[1])/255;
- cp[2]= (mfac*cp1[2]+fac*cp2[2])/255;
+ cp[0] = (mfac * cp1[0] + fac * cp2[0]) / 255;
+ cp[1] = (mfac * cp1[1] + fac * cp2[1]) / 255;
+ cp[2] = (mfac * cp1[2] + fac * cp2[2]) / 255;
}
static void blend_color_add(char *cp, char *cp1, char *cp2, int fac)
{
int temp;
- temp= cp1[0] + ((fac*cp2[0])/255);
- if (temp>254) cp[0]= 255; else cp[0]= temp;
- temp= cp1[1] + ((fac*cp2[1])/255);
- if (temp>254) cp[1]= 255; else cp[1]= temp;
- temp= cp1[2] + ((fac*cp2[2])/255);
- if (temp>254) cp[2]= 255; else cp[2]= temp;
+ temp = cp1[0] + ((fac * cp2[0]) / 255);
+ if (temp > 254) cp[0] = 255; else cp[0] = temp;
+ temp = cp1[1] + ((fac * cp2[1]) / 255);
+ if (temp > 254) cp[1] = 255; else cp[1] = temp;
+ temp = cp1[2] + ((fac * cp2[2]) / 255);
+ if (temp > 254) cp[2] = 255; else cp[2] = temp;
}
static void blend_color_sub(char *cp, char *cp1, char *cp2, int fac)
{
int temp;
- temp= cp1[0] - ((fac*cp2[0])/255);
- if (temp<0) cp[0]= 0; else cp[0]= temp;
- temp= cp1[1] - ((fac*cp2[1])/255);
- if (temp<0) cp[1]= 0; else cp[1]= temp;
- temp= cp1[2] - ((fac*cp2[2])/255);
- if (temp<0) cp[2]= 0; else cp[2]= temp;
+ temp = cp1[0] - ((fac * cp2[0]) / 255);
+ if (temp < 0) cp[0] = 0; else cp[0] = temp;
+ temp = cp1[1] - ((fac * cp2[1]) / 255);
+ if (temp < 0) cp[1] = 0; else cp[1] = temp;
+ temp = cp1[2] - ((fac * cp2[2]) / 255);
+ if (temp < 0) cp[2] = 0; else cp[2] = temp;
}
static void blend_color_mul(char *cp, char *cp1, char *cp2, int fac)
{
- int mfac= 255-fac;
+ int mfac = 255 - fac;
/* first mul, then blend the fac */
- cp[0]= (mfac*cp1[0] + fac*((cp1[0]*cp2[0])/255))/255;
- cp[1]= (mfac*cp1[1] + fac*((cp1[1]*cp2[1])/255))/255;
- cp[2]= (mfac*cp1[2] + fac*((cp1[2]*cp2[2])/255))/255;
+ cp[0] = (mfac * cp1[0] + fac * ((cp1[0] * cp2[0]) / 255)) / 255;
+ cp[1] = (mfac * cp1[1] + fac * ((cp1[1] * cp2[1]) / 255)) / 255;
+ cp[2] = (mfac * cp1[2] + fac * ((cp1[2] * cp2[2]) / 255)) / 255;
}
static void blend_color_lighten(char *cp, char *cp1, char *cp2, int fac)
{
/* See if are lighter, if so mix, else don't do anything.
* if the paint col is darker then the original, then ignore */
- if (cp1[0]+cp1[1]+cp1[2] > cp2[0]+cp2[1]+cp2[2]) {
- cp[0]= cp1[0];
- cp[1]= cp1[1];
- cp[2]= cp1[2];
+ if (cp1[0] + cp1[1] + cp1[2] > cp2[0] + cp2[1] + cp2[2]) {
+ cp[0] = cp1[0];
+ cp[1] = cp1[1];
+ cp[2] = cp1[2];
}
else
blend_color_mix(cp, cp1, cp2, fac);
@@ -107,10 +107,10 @@ static void blend_color_darken(char *cp, char *cp1, char *cp2, int fac)
{
/* See if were darker, if so mix, else don't do anything.
* if the paint col is brighter then the original, then ignore */
- if (cp1[0]+cp1[1]+cp1[2] < cp2[0]+cp2[1]+cp2[2]) {
- cp[0]= cp1[0];
- cp[1]= cp1[1];
- cp[2]= cp1[2];
+ if (cp1[0] + cp1[1] + cp1[2] < cp2[0] + cp2[1] + cp2[2]) {
+ cp[0] = cp1[0];
+ cp[1] = cp1[1];
+ cp[2] = cp1[2];
}
else
blend_color_mix(cp, cp1, cp2, fac);
@@ -122,12 +122,12 @@ unsigned int IMB_blend_color(unsigned int src1, unsigned int src2, int fac, IMB_
int temp;
char *cp, *cp1, *cp2;
- if (fac==0)
+ if (fac == 0)
return src1;
- cp = (char*)&dst;
- cp1 = (char*)&src1;
- cp2 = (char*)&src2;
+ cp = (char *)&dst;
+ cp1 = (char *)&src1;
+ cp2 = (char *)&src2;
switch (mode) {
case IMB_BLEND_MIX:
@@ -143,18 +143,18 @@ unsigned int IMB_blend_color(unsigned int src1, unsigned int src2, int fac, IMB_
case IMB_BLEND_DARKEN:
blend_color_darken(cp, cp1, cp2, fac); break;
default:
- cp[0]= cp1[0];
- cp[1]= cp1[1];
- cp[2]= cp1[2];
+ cp[0] = cp1[0];
+ cp[1] = cp1[1];
+ cp[2] = cp1[2];
}
if (mode == IMB_BLEND_ERASE_ALPHA) {
- temp= (cp1[3] - fac*cp2[3]/255);
- cp[3]= (temp < 0)? 0: temp;
+ temp = (cp1[3] - fac * cp2[3] / 255);
+ cp[3] = (temp < 0) ? 0 : temp;
}
else { /* this does ADD_ALPHA also */
- temp= (cp1[3] + fac*cp2[3]/255);
- cp[3]= (temp > 255)? 255: temp;
+ temp = (cp1[3] + fac * cp2[3] / 255);
+ cp[3] = (temp > 255) ? 255 : temp;
}
return dst;
@@ -162,51 +162,51 @@ unsigned int IMB_blend_color(unsigned int src1, unsigned int src2, int fac, IMB_
static void blend_color_mix_float(float *cp, float *cp1, float *cp2, float fac)
{
- float mfac= 1.0f-fac;
- cp[0]= mfac*cp1[0] + fac*cp2[0];
- cp[1]= mfac*cp1[1] + fac*cp2[1];
- cp[2]= mfac*cp1[2] + fac*cp2[2];
+ float mfac = 1.0f - fac;
+ cp[0] = mfac * cp1[0] + fac * cp2[0];
+ cp[1] = mfac * cp1[1] + fac * cp2[1];
+ cp[2] = mfac * cp1[2] + fac * cp2[2];
}
static void blend_color_add_float(float *cp, float *cp1, float *cp2, float fac)
{
- cp[0] = cp1[0] + fac*cp2[0];
- cp[1] = cp1[1] + fac*cp2[1];
- cp[2] = cp1[2] + fac*cp2[2];
+ cp[0] = cp1[0] + fac * cp2[0];
+ cp[1] = cp1[1] + fac * cp2[1];
+ cp[2] = cp1[2] + fac * cp2[2];
- if (cp[0] > 1.0f) cp[0]= 1.0f;
- if (cp[1] > 1.0f) cp[1]= 1.0f;
- if (cp[2] > 1.0f) cp[2]= 1.0f;
+ if (cp[0] > 1.0f) cp[0] = 1.0f;
+ if (cp[1] > 1.0f) cp[1] = 1.0f;
+ if (cp[2] > 1.0f) cp[2] = 1.0f;
}
static void blend_color_sub_float(float *cp, float *cp1, float *cp2, float fac)
{
- cp[0] = cp1[0] - fac*cp2[0];
- cp[1] = cp1[1] - fac*cp2[1];
- cp[2] = cp1[2] - fac*cp2[2];
+ cp[0] = cp1[0] - fac * cp2[0];
+ cp[1] = cp1[1] - fac * cp2[1];
+ cp[2] = cp1[2] - fac * cp2[2];
- if (cp[0] < 0.0f) cp[0]= 0.0f;
- if (cp[1] < 0.0f) cp[1]= 0.0f;
- if (cp[2] < 0.0f) cp[2]= 0.0f;
+ if (cp[0] < 0.0f) cp[0] = 0.0f;
+ if (cp[1] < 0.0f) cp[1] = 0.0f;
+ if (cp[2] < 0.0f) cp[2] = 0.0f;
}
static void blend_color_mul_float(float *cp, float *cp1, float *cp2, float fac)
{
- float mfac= 1.0f-fac;
+ float mfac = 1.0f - fac;
- cp[0]= mfac*cp1[0] + fac*(cp1[0]*cp2[0]);
- cp[1]= mfac*cp1[1] + fac*(cp1[1]*cp2[1]);
- cp[2]= mfac*cp1[2] + fac*(cp1[2]*cp2[2]);
+ cp[0] = mfac * cp1[0] + fac * (cp1[0] * cp2[0]);
+ cp[1] = mfac * cp1[1] + fac * (cp1[1] * cp2[1]);
+ cp[2] = mfac * cp1[2] + fac * (cp1[2] * cp2[2]);
}
static void blend_color_lighten_float(float *cp, float *cp1, float *cp2, float fac)
{
/* See if are lighter, if so mix, else don't do anything.
* if the pafloat col is darker then the original, then ignore */
- if (cp1[0]+cp1[1]+cp1[2] > cp2[0]+cp2[1]+cp2[2]) {
- cp[0]= cp1[0];
- cp[1]= cp1[1];
- cp[2]= cp1[2];
+ if (cp1[0] + cp1[1] + cp1[2] > cp2[0] + cp2[1] + cp2[2]) {
+ cp[0] = cp1[0];
+ cp[1] = cp1[1];
+ cp[2] = cp1[2];
}
else
blend_color_mix_float(cp, cp1, cp2, fac);
@@ -216,10 +216,10 @@ static void blend_color_darken_float(float *cp, float *cp1, float *cp2, float fa
{
/* See if were darker, if so mix, else don't do anything.
* if the pafloat col is brighter then the original, then ignore */
- if (cp1[0]+cp1[1]+cp1[2] < cp2[0]+cp2[1]+cp2[2]) {
- cp[0]= cp1[0];
- cp[1]= cp1[1];
- cp[2]= cp1[2];
+ if (cp1[0] + cp1[1] + cp1[2] < cp2[0] + cp2[1] + cp2[2]) {
+ cp[0] = cp1[0];
+ cp[1] = cp1[1];
+ cp[2] = cp1[2];
}
else
blend_color_mix_float(cp, cp1, cp2, fac);
@@ -227,11 +227,11 @@ static void blend_color_darken_float(float *cp, float *cp1, float *cp2, float fa
void IMB_blend_color_float(float *dst, float *src1, float *src2, float fac, IMB_BlendMode mode)
{
- if (fac==0) {
- dst[0]= src1[0];
- dst[1]= src1[1];
- dst[2]= src1[2];
- dst[3]= src1[3];
+ if (fac == 0) {
+ dst[0] = src1[0];
+ dst[1] = src1[1];
+ dst[2] = src1[2];
+ dst[3] = src1[3];
return;
}
@@ -249,17 +249,17 @@ void IMB_blend_color_float(float *dst, float *src1, float *src2, float fac, IMB_
case IMB_BLEND_DARKEN:
blend_color_darken_float(dst, src1, src2, fac); break;
default:
- dst[0]= src1[0];
- dst[1]= src1[1];
- dst[2]= src1[2];
+ dst[0] = src1[0];
+ dst[1] = src1[1];
+ dst[2] = src1[2];
}
if (mode == IMB_BLEND_ERASE_ALPHA) {
- dst[3]= (src1[3] - fac*src2[3]);
+ dst[3] = (src1[3] - fac * src2[3]);
if (dst[3] < 0.0f) dst[3] = 0.0f;
}
else { /* this does ADD_ALPHA also */
- dst[3]= (src1[3] + fac*src2[3]);
+ dst[3] = (src1[3] + fac * src2[3]);
if (dst[3] > 1.0f) dst[3] = 1.0f;
}
}
@@ -267,7 +267,7 @@ void IMB_blend_color_float(float *dst, float *src1, float *src2, float fac, IMB_
/* clipping */
void IMB_rectclip(struct ImBuf *dbuf, struct ImBuf *sbuf, int *destx,
- int *desty, int *srcx, int *srcy, int *width, int *height)
+ int *desty, int *srcx, int *srcy, int *width, int *height)
{
int tmp;
@@ -315,14 +315,14 @@ void IMB_rectclip(struct ImBuf *dbuf, struct ImBuf *sbuf, int *destx,
/* copy and blend */
void IMB_rectcpy(struct ImBuf *dbuf, struct ImBuf *sbuf, int destx,
- int desty, int srcx, int srcy, int width, int height)
+ int desty, int srcx, int srcy, int width, int height)
{
IMB_rectblend(dbuf, sbuf, destx, desty, srcx, srcy, width, height,
- IMB_BLEND_COPY);
+ IMB_BLEND_COPY);
}
void IMB_rectblend(struct ImBuf *dbuf, struct ImBuf *sbuf, int destx,
- int desty, int srcx, int srcy, int width, int height, IMB_BlendMode mode)
+ int desty, int srcx, int srcy, int width, int height, IMB_BlendMode mode)
{
unsigned int *drect = NULL, *srect = NULL, *dr, *sr;
float *drectf = NULL, *srectf = NULL, *drf, *srf;
@@ -333,20 +333,20 @@ void IMB_rectblend(struct ImBuf *dbuf, struct ImBuf *sbuf, int destx,
IMB_rectclip(dbuf, sbuf, &destx, &desty, &srcx, &srcy, &width, &height);
if (width == 0 || height == 0) return;
- if (sbuf && sbuf->channels!=4) return;
- if (dbuf->channels!=4) return;
+ if (sbuf && sbuf->channels != 4) return;
+ if (dbuf->channels != 4) return;
do_char = (sbuf && sbuf->rect && dbuf->rect);
do_float = (sbuf && sbuf->rect_float && dbuf->rect_float);
if (do_char) drect = dbuf->rect + desty * dbuf->x + destx;
- if (do_float) drectf = dbuf->rect_float + (desty * dbuf->x + destx)*4;
+ if (do_float) drectf = dbuf->rect_float + (desty * dbuf->x + destx) * 4;
destskip = dbuf->x;
if (sbuf) {
if (do_char) srect = sbuf->rect + srcy * sbuf->x + srcx;
- if (do_float) srectf = sbuf->rect_float + (srcy * sbuf->x + srcx)*4;
+ if (do_float) srectf = sbuf->rect_float + (srcy * sbuf->x + srcx) * 4;
srcskip = sbuf->x;
}
else {
@@ -357,7 +357,7 @@ void IMB_rectblend(struct ImBuf *dbuf, struct ImBuf *sbuf, int destx,
if (mode == IMB_BLEND_COPY) {
/* copy */
- for (;height > 0; height--) {
+ for (; height > 0; height--) {
if (do_char) {
memcpy(drect, srect, width * sizeof(int));
drect += destskip;
@@ -366,21 +366,21 @@ void IMB_rectblend(struct ImBuf *dbuf, struct ImBuf *sbuf, int destx,
if (do_float) {
memcpy(drectf, srectf, width * sizeof(float) * 4);
- drectf += destskip*4;
- srectf += srcskip*4;
+ drectf += destskip * 4;
+ srectf += srcskip * 4;
}
}
}
else if (mode == IMB_BLEND_COPY_RGB) {
/* copy rgb only */
- for (;height > 0; height--) {
+ for (; height > 0; height--) {
if (do_char) {
dr = drect;
sr = srect;
- for (x=width; x > 0; x--, dr++, sr++) {
- ((char*)dr)[0]= ((char*)sr)[0];
- ((char*)dr)[1]= ((char*)sr)[1];
- ((char*)dr)[2]= ((char*)sr)[2];
+ for (x = width; x > 0; x--, dr++, sr++) {
+ ((char *)dr)[0] = ((char *)sr)[0];
+ ((char *)dr)[1] = ((char *)sr)[1];
+ ((char *)dr)[2] = ((char *)sr)[2];
}
drect += destskip;
srect += srcskip;
@@ -389,24 +389,24 @@ void IMB_rectblend(struct ImBuf *dbuf, struct ImBuf *sbuf, int destx,
if (do_float) {
drf = drectf;
srf = srectf;
- for (x=width; x > 0; x--, drf+=4, srf+=4) {
- drf[0]= srf[0];
- drf[1]= srf[1];
- drf[2]= srf[2];
+ for (x = width; x > 0; x--, drf += 4, srf += 4) {
+ drf[0] = srf[0];
+ drf[1] = srf[1];
+ drf[2] = srf[2];
}
- drectf += destskip*4;
- srectf += srcskip*4;
+ drectf += destskip * 4;
+ srectf += srcskip * 4;
}
}
}
else if (mode == IMB_BLEND_COPY_ALPHA) {
/* copy alpha only */
- for (;height > 0; height--) {
+ for (; height > 0; height--) {
if (do_char) {
dr = drect;
sr = srect;
- for (x=width; x > 0; x--, dr++, sr++)
- ((char*)dr)[3]= ((char*)sr)[3];
+ for (x = width; x > 0; x--, dr++, sr++)
+ ((char *)dr)[3] = ((char *)sr)[3];
drect += destskip;
srect += srcskip;
}
@@ -414,21 +414,21 @@ void IMB_rectblend(struct ImBuf *dbuf, struct ImBuf *sbuf, int destx,
if (do_float) {
drf = drectf;
srf = srectf;
- for (x=width; x > 0; x--, drf+=4, srf+=4)
- drf[3]= srf[3];
- drectf += destskip*4;
- srectf += srcskip*4;
+ for (x = width; x > 0; x--, drf += 4, srf += 4)
+ drf[3] = srf[3];
+ drectf += destskip * 4;
+ srectf += srcskip * 4;
}
}
}
else {
/* blend */
- for (;height > 0; height--) {
+ for (; height > 0; height--) {
if (do_char) {
dr = drect;
sr = srect;
- for (x=width; x > 0; x--, dr++, sr++)
- *dr = IMB_blend_color(*dr, *sr, ((char*)sr)[3], mode);
+ for (x = width; x > 0; x--, dr++, sr++)
+ *dr = IMB_blend_color(*dr, *sr, ((char *)sr)[3], mode);
drect += destskip;
srect += srcskip;
@@ -437,11 +437,11 @@ void IMB_rectblend(struct ImBuf *dbuf, struct ImBuf *sbuf, int destx,
if (do_float) {
drf = drectf;
srf = srectf;
- for (x=width; x > 0; x--, drf+=4, srf+=4)
+ for (x = width; x > 0; x--, drf += 4, srf += 4)
IMB_blend_color_float(drf, drf, srf, srf[3], mode);
- drectf += destskip*4;
- srectf += srcskip*4;
+ drectf += destskip * 4;
+ srectf += srcskip * 4;
}
}
}
@@ -457,21 +457,21 @@ void IMB_rectfill(struct ImBuf *drect, const float col[4])
unsigned int *rrect = drect->rect;
char ccol[4];
- ccol[0]= (int)(col[0]*255);
- ccol[1]= (int)(col[1]*255);
- ccol[2]= (int)(col[2]*255);
- ccol[3]= (int)(col[3]*255);
+ ccol[0] = (int)(col[0] * 255);
+ ccol[1] = (int)(col[1] * 255);
+ ccol[2] = (int)(col[2] * 255);
+ ccol[3] = (int)(col[3] * 255);
num = drect->x * drect->y;
- for (;num > 0; num--)
- *rrect++ = *((unsigned int*)ccol);
+ for (; num > 0; num--)
+ *rrect++ = *((unsigned int *)ccol);
}
if (drect->rect_float) {
float *rrectf = drect->rect_float;
num = drect->x * drect->y;
- for (;num > 0; num--) {
+ for (; num > 0; num--) {
*rrectf++ = col[0];
*rrectf++ = col[1];
*rrectf++ = col[2];
@@ -487,7 +487,7 @@ void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height,
float a; /* alpha */
float ai; /* alpha inverted */
float aich; /* alpha, inverted, ai/255.0 - Convert char to float at the same time */
- if ((!rect && !rectf) || (!col) || col[3]==0.0f)
+ if ((!rect && !rectf) || (!col) || col[3] == 0.0f)
return;
/* sanity checks for coords */
@@ -496,20 +496,20 @@ void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height,
CLAMP(y1, 0, height);
CLAMP(y2, 0, height);
- if (x1>x2) SWAP(int, x1, x2);
- if (y1>y2) SWAP(int, y1, y2);
- if (x1==x2 || y1==y2) return;
+ if (x1 > x2) SWAP(int, x1, x2);
+ if (y1 > y2) SWAP(int, y1, y2);
+ if (x1 == x2 || y1 == y2) return;
a = col[3];
- ai = 1-a;
- aich = ai/255.0f;
+ ai = 1 - a;
+ aich = ai / 255.0f;
if (rect) {
unsigned char *pixel;
- unsigned char chr=0, chg=0, chb=0;
- float fr=0, fg=0, fb=0;
+ unsigned char chr = 0, chg = 0, chb = 0;
+ float fr = 0, fg = 0, fb = 0;
- const int alphaint= FTOCHAR(a);
+ const int alphaint = FTOCHAR(a);
if (a == 1.0f) {
chr = FTOCHAR(col[0]);
@@ -517,14 +517,14 @@ void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height,
chb = FTOCHAR(col[2]);
}
else {
- fr = col[0]*a;
- fg = col[1]*a;
- fb = col[2]*a;
+ fr = col[0] * a;
+ fg = col[1] * a;
+ fb = col[2] * a;
}
- for (j = 0; j < y2-y1; j++) {
- for (i = 0; i < x2-x1; i++) {
+ for (j = 0; j < y2 - y1; j++) {
+ for (i = 0; i < x2 - x1; i++) {
pixel = rect + 4 * (((y1 + j) * width) + (x1 + i));
- if (pixel >= rect && pixel < rect+ (4 * (width * height))) {
+ if (pixel >= rect && pixel < rect + (4 * (width * height))) {
if (a == 1.0f) {
pixel[0] = chr;
pixel[1] = chg;
@@ -533,10 +533,10 @@ void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height,
}
else {
int alphatest;
- pixel[0] = (char)((fr + ((float)pixel[0]*aich))*255.0f);
- pixel[1] = (char)((fg + ((float)pixel[1]*aich))*255.0f);
- pixel[2] = (char)((fb + ((float)pixel[2]*aich))*255.0f);
- pixel[3] = (char)((alphatest= ((int)pixel[3] + alphaint)) < 255 ? alphatest : 255);
+ pixel[0] = (char)((fr + ((float)pixel[0] * aich)) * 255.0f);
+ pixel[1] = (char)((fg + ((float)pixel[1] * aich)) * 255.0f);
+ pixel[2] = (char)((fb + ((float)pixel[2] * aich)) * 255.0f);
+ pixel[3] = (char)((alphatest = ((int)pixel[3] + alphaint)) < 255 ? alphatest : 255);
}
}
}
@@ -545,8 +545,8 @@ void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height,
if (rectf) {
float *pixel;
- for (j = 0; j < y2-y1; j++) {
- for (i = 0; i < x2-x1; i++) {
+ for (j = 0; j < y2 - y1; j++) {
+ for (i = 0; i < x2 - x1; i++) {
pixel = rectf + 4 * (((y1 + j) * width) + (x1 + i));
if (a == 1.0f) {
pixel[0] = col[0];
@@ -556,10 +556,10 @@ void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height,
}
else {
float alphatest;
- pixel[0] = (col[0]*a) + (pixel[0]*ai);
- pixel[1] = (col[1]*a) + (pixel[1]*ai);
- pixel[2] = (col[2]*a) + (pixel[2]*ai);
- pixel[3] = (alphatest= (pixel[3] + a)) < 1.0f ? alphatest : 1.0f;
+ pixel[0] = (col[0] * a) + (pixel[0] * ai);
+ pixel[1] = (col[1] * a) + (pixel[1] * ai);
+ pixel[2] = (col[2] * a) + (pixel[2] * ai);
+ pixel[3] = (alphatest = (pixel[3] + a)) < 1.0f ? alphatest : 1.0f;
}
}
}
@@ -577,12 +577,12 @@ void IMB_rectfill_alpha(ImBuf *ibuf, const float value)
{
int i;
if (ibuf->rect_float) {
- float *fbuf= ibuf->rect_float + 3;
- for (i = ibuf->x * ibuf->y; i > 0; i--, fbuf+= 4) { *fbuf = value; }
+ float *fbuf = ibuf->rect_float + 3;
+ for (i = ibuf->x * ibuf->y; i > 0; i--, fbuf += 4) { *fbuf = value; }
}
else {
- const unsigned char cvalue= value * 255;
- unsigned char *cbuf= ((unsigned char *)ibuf->rect) + 3;
- for (i = ibuf->x * ibuf->y; i > 0; i--, cbuf+= 4) { *cbuf = cvalue; }
+ const unsigned char cvalue = value * 255;
+ unsigned char *cbuf = ((unsigned char *)ibuf->rect) + 3;
+ for (i = ibuf->x * ibuf->y; i > 0; i--, cbuf += 4) { *cbuf = cvalue; }
}
}