diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2010-10-19 00:40:43 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2010-10-19 00:40:43 +0400 |
commit | 894daa01be1ba5b2f128b1e779d9a38c4c4e7700 (patch) | |
tree | e03309f3c35c2108fe8ac817336106b23e2301c2 /source/blender/editors | |
parent | 90b69a13a7f7b829c2eb314d1fd1efd56fd0a487 (diff) | |
parent | bf09c851a97aba67b19a5fc85a91d874e28d1df1 (diff) |
Merged changes in the trunk up to revision 32565.
Diffstat (limited to 'source/blender/editors')
218 files changed, 3491 insertions, 2610 deletions
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index dbd13e9188f..a471879540c 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -90,7 +90,7 @@ /* Draw Backdrop ---------------------------------- */ /* get backdrop color for top-level widgets (Scene and Object only) */ -static void acf_generic_root_color(bAnimContext *ac, bAnimListElem *ale, float *color) +static void acf_generic_root_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float *color) { /* darker blue for top-level widgets */ UI_GetThemeColor3fv(TH_DOPESHEET_CHANNELOB, color); @@ -116,7 +116,7 @@ static void acf_generic_root_backdrop(bAnimContext *ac, bAnimListElem *ale, floa /* get backdrop color for data expanders under top-level Scene/Object */ -static void acf_generic_dataexpand_color(bAnimContext *ac, bAnimListElem *ale, float *color) +static void acf_generic_dataexpand_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float *color) { /* lighter color than top-level widget */ UI_GetThemeColor3fv(TH_DOPESHEET_CHANNELSUBOB, color); @@ -203,11 +203,11 @@ static void acf_generic_channel_backdrop(bAnimContext *ac, bAnimListElem *ale, f /* Indention + Offset ------------------------------------------- */ /* indention level is always the value in the name */ -static short acf_generic_indention_0(bAnimContext *ac, bAnimListElem *ale) +static short acf_generic_indention_0(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale)) { return 0; } -static short acf_generic_indention_1(bAnimContext *ac, bAnimListElem *ale) +static short acf_generic_indention_1(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale)) { return 1; } @@ -219,7 +219,7 @@ static short acf_generic_indention_2(bAnimContext *ac, bAnimListElem *ale) #endif /* indention which varies with the grouping status */ -static short acf_generic_indention_flexible(bAnimContext *ac, bAnimListElem *ale) +static short acf_generic_indention_flexible(bAnimContext *UNUSED(ac), bAnimListElem *ale) { short indent= 0; @@ -353,7 +353,7 @@ static void *acf_generic_dsexpand_setting_ptr(bAnimListElem *ale, int setting, s } /* check if some setting exists for this object-based data-expander (datablock only) */ -static short acf_generic_dataexpand_setting_valid(bAnimContext *ac, bAnimListElem *ale, int setting) +static short acf_generic_dataexpand_setting_valid(bAnimContext *ac, bAnimListElem *UNUSED(ale), int setting) { switch (setting) { /* expand is always supported */ @@ -376,7 +376,7 @@ static short acf_generic_dataexpand_setting_valid(bAnimContext *ac, bAnimListEle /* Animation Summary ----------------------------------- */ /* get backdrop color for summary widget */ -static void acf_summary_color(bAnimContext *ac, bAnimListElem *ale, float *color) +static void acf_summary_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float *color) { // FIXME: hardcoded color - same as the 'action' line in NLA // reddish color @@ -405,27 +405,27 @@ static void acf_summary_backdrop(bAnimContext *ac, bAnimListElem *ale, float ymi } /* name for summary entries */ -static void acf_summary_name(bAnimListElem *ale, char *name) +static void acf_summary_name(bAnimListElem *UNUSED(ale), char *name) { if (name) strcpy(name, "DopeSheet Summary"); } // TODO: this is really a temp icon I think -static int acf_summary_icon(bAnimListElem *ale) +static int acf_summary_icon(bAnimListElem *UNUSED(ale)) { return ICON_BORDERMOVE; } /* check if some setting exists for this channel */ -static short acf_summary_setting_valid(bAnimContext *ac, bAnimListElem *ale, int setting) +static short acf_summary_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), int setting) { /* only expanded is supported, as it is used for hiding all stuff which the summary covers */ return (setting == ACHANNEL_SETTING_EXPAND); } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_summary_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_summary_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { if (setting == ACHANNEL_SETTING_EXPAND) { /* expanded */ @@ -482,13 +482,13 @@ static bAnimChannelType ACF_SUMMARY = /* Scene ------------------------------------------- */ // TODO: just get this from RNA? -static int acf_scene_icon(bAnimListElem *ale) +static int acf_scene_icon(bAnimListElem *UNUSED(ale)) { return ICON_SCENE_DATA; } /* check if some setting exists for this channel */ -static short acf_scene_setting_valid(bAnimContext *ac, bAnimListElem *ale, int setting) +static short acf_scene_setting_valid(bAnimContext *ac, bAnimListElem *UNUSED(ale), int setting) { switch (setting) { /* muted only in NLA */ @@ -510,7 +510,7 @@ static short acf_scene_setting_valid(bAnimContext *ac, bAnimListElem *ale, int s } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_scene_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_scene_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -653,7 +653,7 @@ static short acf_object_setting_valid(bAnimContext *ac, bAnimListElem *ale, int } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_object_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_object_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -727,7 +727,7 @@ static bAnimChannelType ACF_OBJECT = /* Group ------------------------------------------- */ /* get backdrop color for group widget */ -static void acf_group_color(bAnimContext *ac, bAnimListElem *ale, float *color) +static void acf_group_color(bAnimContext *UNUSED(ac), bAnimListElem *ale, float *color) { /* highlight only for action group channels */ if (ale->flag & AGRP_ACTIVE) @@ -765,7 +765,7 @@ static void acf_group_name(bAnimListElem *ale, char *name) } /* check if some setting exists for this channel */ -static short acf_group_setting_valid(bAnimContext *ac, bAnimListElem *ale, int setting) +static short acf_group_setting_valid(bAnimContext *ac, bAnimListElem *UNUSED(ale), int setting) { /* for now, all settings are supported, though some are only conditionally */ switch (setting) { @@ -815,7 +815,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 setting, short *type) +static void *acf_group_setting_ptr(bAnimListElem *ale, int UNUSED(setting), short *type) { bActionGroup *agrp= (bActionGroup *)ale->data; @@ -876,7 +876,7 @@ static short acf_fcurve_setting_valid(bAnimContext *ac, bAnimListElem *ale, int } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_fcurve_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_fcurve_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -901,7 +901,7 @@ static int acf_fcurve_setting_flag(bAnimContext *ac, int setting, short *neg) } /* get pointer to the setting */ -static void *acf_fcurve_setting_ptr(bAnimListElem *ale, int setting, short *type) +static void *acf_fcurve_setting_ptr(bAnimListElem *ale, int UNUSED(setting), short *type) { FCurve *fcu= (FCurve *)ale->data; @@ -930,13 +930,13 @@ static bAnimChannelType ACF_FCURVE = /* Object Action Expander ------------------------------------------- */ // TODO: just get this from RNA? -static int acf_fillactd_icon(bAnimListElem *ale) +static int acf_fillactd_icon(bAnimListElem *UNUSED(ale)) { return ICON_ACTION; } /* check if some setting exists for this channel */ -static short acf_fillactd_setting_valid(bAnimContext *ac, bAnimListElem *ale, int setting) +static short acf_fillactd_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), int setting) { switch (setting) { /* only select and expand supported */ @@ -950,7 +950,7 @@ static short acf_fillactd_setting_valid(bAnimContext *ac, bAnimListElem *ale, in } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_fillactd_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_fillactd_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -1014,19 +1014,19 @@ static bAnimChannelType ACF_FILLACTD = /* Drivers Expander ------------------------------------------- */ // TODO: just get this from RNA? -static int acf_filldrivers_icon(bAnimListElem *ale) +static int acf_filldrivers_icon(bAnimListElem *UNUSED(ale)) { return ICON_ANIM_DATA; } -static void acf_filldrivers_name(bAnimListElem *ale, char *name) +static void acf_filldrivers_name(bAnimListElem *UNUSED(ale), char *name) { strcpy(name, "Drivers"); } /* check if some setting exists for this channel */ // TODO: this could be made more generic -static short acf_filldrivers_setting_valid(bAnimContext *ac, bAnimListElem *ale, int setting) +static short acf_filldrivers_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), int setting) { switch (setting) { /* only expand supported */ @@ -1039,7 +1039,7 @@ static short acf_filldrivers_setting_valid(bAnimContext *ac, bAnimListElem *ale, } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_filldrivers_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_filldrivers_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -1092,18 +1092,18 @@ static bAnimChannelType ACF_FILLDRIVERS = /* Materials Expander ------------------------------------------- */ // TODO: just get this from RNA? -static int acf_fillmatd_icon(bAnimListElem *ale) +static int acf_fillmatd_icon(bAnimListElem *UNUSED(ale)) { return ICON_MATERIAL_DATA; } -static void acf_fillmatd_name(bAnimListElem *ale, char *name) +static void acf_fillmatd_name(bAnimListElem *UNUSED(ale), char *name) { strcpy(name, "Materials"); } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_fillmatd_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_fillmatd_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -1138,18 +1138,18 @@ static bAnimChannelType ACF_FILLMATD= /* Particles Expander ------------------------------------------- */ // TODO: just get this from RNA? -static int acf_fillpartd_icon(bAnimListElem *ale) +static int acf_fillpartd_icon(bAnimListElem *UNUSED(ale)) { return ICON_PARTICLE_DATA; } -static void acf_fillpartd_name(bAnimListElem *ale, char *name) +static void acf_fillpartd_name(bAnimListElem *UNUSED(ale), char *name) { strcpy(name, "Particles"); } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_fillpartd_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_fillpartd_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -1206,12 +1206,12 @@ static short acf_filltexd_offset(bAnimContext *ac, bAnimListElem *ale) } // TODO: just get this from RNA? -static int acf_filltexd_icon(bAnimListElem *ale) +static int acf_filltexd_icon(bAnimListElem *UNUSED(ale)) { return ICON_TEXTURE_DATA; } -static void acf_filltexd_name(bAnimListElem *ale, char *name) +static void acf_filltexd_name(bAnimListElem *UNUSED(ale), char *name) { strcpy(name, "Textures"); } @@ -1254,7 +1254,7 @@ static void *acf_filltexd_setting_ptr(bAnimListElem *ale, int setting, short *ty } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_filltexd_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_filltexd_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -1290,19 +1290,19 @@ static bAnimChannelType ACF_FILLTEXD= /* Material Expander ------------------------------------------- */ // TODO: just get this from RNA? -static int acf_dsmat_icon(bAnimListElem *ale) +static int acf_dsmat_icon(bAnimListElem *UNUSED(ale)) { return ICON_MATERIAL_DATA; } /* offset for material expanders */ -static short acf_dsmat_offset(bAnimContext *ac, bAnimListElem *ale) +static short acf_dsmat_offset(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale)) { return 21; } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_dsmat_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_dsmat_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -1372,13 +1372,13 @@ static bAnimChannelType ACF_DSMAT= /* Lamp Expander ------------------------------------------- */ // TODO: just get this from RNA? -static int acf_dslam_icon(bAnimListElem *ale) +static int acf_dslam_icon(bAnimListElem *UNUSED(ale)) { return ICON_LAMP_DATA; } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_dslam_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_dslam_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -1448,13 +1448,13 @@ static bAnimChannelType ACF_DSLAM= /* Texture Expander ------------------------------------------- */ // TODO: just get this from RNA? -static int acf_dstex_icon(bAnimListElem *ale) +static int acf_dstex_icon(bAnimListElem *UNUSED(ale)) { return ICON_TEXTURE_DATA; } /* offset for texture expanders */ -static short acf_dstex_offset(bAnimContext *ac, bAnimListElem *ale) +static short acf_dstex_offset(bAnimContext *UNUSED(ac), bAnimListElem *ale) { short offset = 21; @@ -1473,7 +1473,7 @@ static short acf_dstex_offset(bAnimContext *ac, bAnimListElem *ale) } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_dstex_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_dstex_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -1543,13 +1543,13 @@ static bAnimChannelType ACF_DSTEX= /* Camera Expander ------------------------------------------- */ // TODO: just get this from RNA? -static int acf_dscam_icon(bAnimListElem *ale) +static int acf_dscam_icon(bAnimListElem *UNUSED(ale)) { return ICON_CAMERA_DATA; } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_dscam_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_dscam_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -1635,7 +1635,7 @@ static int acf_dscur_icon(bAnimListElem *ale) } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_dscur_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_dscur_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -1705,13 +1705,13 @@ static bAnimChannelType ACF_DSCUR= /* Shape Key Expander ------------------------------------------- */ // TODO: just get this from RNA? -static int acf_dsskey_icon(bAnimListElem *ale) +static int acf_dsskey_icon(bAnimListElem *UNUSED(ale)) { return ICON_SHAPEKEY_DATA; } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_dsskey_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_dsskey_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -1781,13 +1781,13 @@ static bAnimChannelType ACF_DSSKEY= /* World Expander ------------------------------------------- */ // TODO: just get this from RNA? -static int acf_dswor_icon(bAnimListElem *ale) +static int acf_dswor_icon(bAnimListElem *UNUSED(ale)) { return ICON_WORLD_DATA; } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_dswor_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_dswor_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -1857,13 +1857,13 @@ static bAnimChannelType ACF_DSWOR= /* Particle Expander ------------------------------------------- */ // TODO: just get this from RNA? -static int acf_dspart_icon(bAnimListElem *ale) +static int acf_dspart_icon(bAnimListElem *UNUSED(ale)) { return ICON_PARTICLE_DATA; } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_dspart_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_dspart_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -1933,13 +1933,13 @@ static bAnimChannelType ACF_DSPART= /* MetaBall Expander ------------------------------------------- */ // TODO: just get this from RNA? -static int acf_dsmball_icon(bAnimListElem *ale) +static int acf_dsmball_icon(bAnimListElem *UNUSED(ale)) { return ICON_META_DATA; } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_dsmball_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_dsmball_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -2009,13 +2009,13 @@ static bAnimChannelType ACF_DSMBALL= /* Armature Expander ------------------------------------------- */ // TODO: just get this from RNA? -static int acf_dsarm_icon(bAnimListElem *ale) +static int acf_dsarm_icon(bAnimListElem *UNUSED(ale)) { return ICON_ARMATURE_DATA; } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_dsarm_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_dsarm_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -2085,13 +2085,13 @@ static bAnimChannelType ACF_DSARM= /* NodeTree Expander ------------------------------------------- */ // TODO: just get this from RNA? -static int acf_dsntree_icon(bAnimListElem *ale) +static int acf_dsntree_icon(bAnimListElem *UNUSED(ale)) { return ICON_NODETREE; } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_dsntree_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_dsntree_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -2237,13 +2237,13 @@ static bAnimChannelType ACF_DSLINESTYLE= /* Mesh Expander ------------------------------------------- */ // TODO: just get this from RNA? -static int acf_dsmesh_icon(bAnimListElem *ale) +static int acf_dsmesh_icon(bAnimListElem *UNUSED(ale)) { return ICON_MESH_DATA; } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_dsmesh_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_dsmesh_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -2328,7 +2328,7 @@ static void acf_shapekey_name(bAnimListElem *ale, char *name) } /* check if some setting exists for this channel */ -static short acf_shapekey_setting_valid(bAnimContext *ac, bAnimListElem *ale, int setting) +static short acf_shapekey_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), int setting) { switch (setting) { case ACHANNEL_SETTING_SELECT: /* selected */ @@ -2343,7 +2343,7 @@ static short acf_shapekey_setting_valid(bAnimContext *ac, bAnimListElem *ale, in } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_shapekey_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_shapekey_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -2929,7 +2929,7 @@ 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 *poin, void *poin2) +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); } diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index a40beeaa0f8..9464f6b2768 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -924,7 +924,7 @@ void ANIM_OT_channels_move_bottom (wmOperatorType *ot) /* ******************** Delete Channel Operator *********************** */ -static int animchannels_delete_exec(bContext *C, wmOperator *op) +static int animchannels_delete_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; ListBase anim_data = {NULL, NULL}; @@ -1025,7 +1025,7 @@ void ANIM_OT_channels_delete (wmOperatorType *ot) /* ******************** Set Channel Visibility Operator *********************** */ /* NOTE: this operator is only valid in the Graph Editor channels region */ -static int animchannels_visibility_set_exec(bContext *C, wmOperator *op) +static int animchannels_visibility_set_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; ListBase anim_data = {NULL, NULL}; @@ -1103,7 +1103,7 @@ void ANIM_OT_channels_visibility_set (wmOperatorType *ot) /* ******************** Toggle Channel Visibility Operator *********************** */ /* NOTE: this operator is only valid in the Graph Editor channels region */ -static int animchannels_visibility_toggle_exec(bContext *C, wmOperator *op) +static int animchannels_visibility_toggle_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; ListBase anim_data = {NULL, NULL}; @@ -1630,7 +1630,7 @@ void ANIM_OT_channels_select_border(wmOperatorType *ot) /* ******************** Mouse-Click Operator *********************** */ /* Handle selection changes due to clicking on channels. Settings will get caught by UI code... */ -static int mouse_anim_channels (bAnimContext *ac, float x, int channel_index, short selectmode) +static int mouse_anim_channels (bAnimContext *ac, float UNUSED(x), int channel_index, short selectmode) { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; diff --git a/source/blender/editors/animation/anim_deps.c b/source/blender/editors/animation/anim_deps.c index 5312e97c604..ed23e72b328 100644 --- a/source/blender/editors/animation/anim_deps.c +++ b/source/blender/editors/animation/anim_deps.c @@ -96,7 +96,7 @@ void ANIM_list_elem_update(Scene *scene, bAnimListElem *ale) /* tags the given ID block for refreshes (if applicable) due to * Animation Editor editing */ -void ANIM_id_update(Scene *scene, ID *id) +void ANIM_id_update(Scene *UNUSED(scene), ID *id) { if (id) { AnimData *adt= BKE_animdata_from_id(id); @@ -121,7 +121,7 @@ void ANIM_id_update(Scene *scene, ID *id) */ /* perform syncing updates for Action Groups */ -static void animchan_sync_group (bAnimContext *ac, bAnimListElem *ale) +static void animchan_sync_group (bAnimContext *UNUSED(ac), bAnimListElem *ale) { bActionGroup *agrp= (bActionGroup *)ale->data; ID *owner_id= ale->id; @@ -154,7 +154,7 @@ static void animchan_sync_group (bAnimContext *ac, bAnimListElem *ale) } /* perform syncing updates for F-Curves */ -static void animchan_sync_fcurve (bAnimContext *ac, bAnimListElem *ale) +static void animchan_sync_fcurve (bAnimContext *UNUSED(ac), bAnimListElem *ale) { FCurve *fcu= (FCurve *)ale->data; ID *owner_id= ale->id; diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c index b564780f6c0..373ad5472ab 100644 --- a/source/blender/editors/animation/anim_draw.c +++ b/source/blender/editors/animation/anim_draw.c @@ -256,7 +256,7 @@ void ANIM_draw_cfra (const bContext *C, View2D *v2d, short flag) /* Draw current frame number in a little box */ if (flag & DRAWCFRA_SHOW_NUMBOX) { - UI_view2d_view_orthoSpecial(C, v2d, 1); + UI_view2d_view_orthoSpecial(CTX_wm_region(C), v2d, 1); draw_cfra_number(scene, v2d, vec[0], (flag & DRAWCFRA_UNIT_SECONDS)); } } diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index c768020a0ff..4647d2a5a2e 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -92,7 +92,7 @@ /* Get shapekey data being edited (for Action Editor -> ShapeKey mode) */ /* Note: there's a similar function in key.c (ob_get_key) */ -Key *actedit_get_shapekeys (bAnimContext *ac, SpaceAction *saction) +static Key *actedit_get_shapekeys (bAnimContext *ac) { Scene *scene= ac->scene; Object *ob; @@ -154,7 +154,7 @@ static short actedit_get_context (bAnimContext *ac, SpaceAction *saction) case SACTCONT_SHAPEKEY: /* 'ShapeKey Editor' */ ac->datatype= ANIMCONT_SHAPEKEY; - ac->data= actedit_get_shapekeys(ac, saction); + ac->data= actedit_get_shapekeys(ac); ac->mode= saction->mode; return 1; @@ -1079,7 +1079,7 @@ static int animdata_filter_action (bAnimContext *ac, ListBase *anim_data, bDopeS * - for normal filtering (i.e. for editing), we only need the NLA-tracks but they can be in 'normal' evaluation * order, i.e. first to last. Otherwise, some tools may get screwed up. */ -static int animdata_filter_nla (bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, AnimData *adt, int filter_mode, void *owner, short ownertype, ID *owner_id) +static int animdata_filter_nla (bAnimContext *UNUSED(ac), ListBase *anim_data, bDopeSheet *UNUSED(ads), AnimData *adt, int filter_mode, void *owner, short ownertype, ID *owner_id) { bAnimListElem *ale; NlaTrack *nlt; diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index 5c4d231fd3a..055ee1c3392 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -336,7 +336,7 @@ void draw_markers_time(const bContext *C, int flag) /* ************************** add markers *************************** */ /* add TimeMarker at curent frame */ -static int ed_marker_add(bContext *C, wmOperator *op) +static int ed_marker_add(bContext *C, wmOperator *UNUSED(op)) { ListBase *markers= context_get_markers(C); TimeMarker *marker; @@ -489,7 +489,7 @@ static int ed_marker_move_invoke(bContext *C, wmOperator *op, wmEvent *evt) } /* note, init has to be called succesfully */ -static void ed_marker_move_apply(bContext *C, wmOperator *op) +static void ed_marker_move_apply(wmOperator *op) { MarkerMove *mm= op->customdata; TimeMarker *marker; @@ -508,7 +508,7 @@ static void ed_marker_move_apply(bContext *C, wmOperator *op) static void ed_marker_move_cancel(bContext *C, wmOperator *op) { RNA_int_set(op->ptr, "frames", 0); - ed_marker_move_apply(C, op); + ed_marker_move_apply(op); ed_marker_move_exit(C, op); WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL); @@ -565,7 +565,7 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt) offs= (int)fac; RNA_int_set(op->ptr, "frames", offs); - ed_marker_move_apply(C, op); + ed_marker_move_apply(op); /* cruft below is for header print */ for (a=0, marker= mm->markers->first; marker; marker= marker->next) { @@ -632,7 +632,7 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt) outputNumInput(&mm->num, str_tx); RNA_int_set(op->ptr, "frames", vec[0]); - ed_marker_move_apply(C, op); + ed_marker_move_apply(op); // ed_marker_header_update(C, op, str, (int)vec[0]); // strcat(str, str_tx); sprintf(str, "Marker offset %s", str_tx); @@ -649,7 +649,7 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt) static int ed_marker_move_exec(bContext *C, wmOperator *op) { if(ed_marker_move_init(C, op)) { - ed_marker_move_apply(C, op); + ed_marker_move_apply(op); ed_marker_move_exit(C, op); return OPERATOR_FINISHED; } @@ -697,7 +697,7 @@ callbacks: /* duplicate selected TimeMarkers */ -static void ed_marker_duplicate_apply(bContext *C, wmOperator *op) +static void ed_marker_duplicate_apply(bContext *C) { ListBase *markers= context_get_markers(C); TimeMarker *marker, *newmarker; @@ -731,7 +731,7 @@ static void ed_marker_duplicate_apply(bContext *C, wmOperator *op) static int ed_marker_duplicate_exec(bContext *C, wmOperator *op) { - ed_marker_duplicate_apply(C, op); + ed_marker_duplicate_apply(C); ed_marker_move_exec(C, op); /* assumes frs delta set */ return OPERATOR_FINISHED; @@ -740,7 +740,7 @@ static int ed_marker_duplicate_exec(bContext *C, wmOperator *op) static int ed_marker_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *evt) { - ed_marker_duplicate_apply(C, op); + ed_marker_duplicate_apply(C); return ed_marker_move_invoke(C, op, evt); } @@ -1033,7 +1033,7 @@ static void MARKER_OT_select_all(wmOperatorType *ot) /* ******************************* remove marker ***************** */ /* remove selected TimeMarkers */ -static int ed_marker_delete_exec(bContext *C, wmOperator *op) +static int ed_marker_delete_exec(bContext *C, wmOperator *UNUSED(op)) { ListBase *markers= context_get_markers(C); TimeMarker *marker, *nmarker; @@ -1130,7 +1130,7 @@ static void MARKER_OT_make_links_scene(wmOperatorType *ot) /* ******************************* camera bind marker ***************** */ /* remove selected TimeMarkers */ -static int ed_marker_camera_bind_exec(bContext *C, wmOperator *op) +static int ed_marker_camera_bind_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); ListBase *markers= context_get_markers(C); diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c index 9b9c9435518..a80ea3e12bf 100644 --- a/source/blender/editors/animation/anim_ops.c +++ b/source/blender/editors/animation/anim_ops.c @@ -233,7 +233,7 @@ void ANIM_OT_previewrange_set(wmOperatorType *ot) /* ****************** clear preview range operator ****************************/ -static int previewrange_clear_exec(bContext *C, wmOperator *op) +static int previewrange_clear_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); ScrArea *curarea= CTX_wm_area(C); @@ -269,7 +269,7 @@ void ANIM_OT_previewrange_clear(wmOperatorType *ot) /* ****************** time display toggle operator ****************************/ -static int toggle_time_exec(bContext *C, wmOperator *op) +static int toggle_time_exec(bContext *C, wmOperator *UNUSED(op)) { ScrArea *curarea= CTX_wm_area(C); diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c index 898d7db89fc..6ace48dd301 100644 --- a/source/blender/editors/animation/drivers.c +++ b/source/blender/editors/animation/drivers.c @@ -115,7 +115,7 @@ FCurve *verify_driver_fcurve (ID *id, const char rna_path[], const int array_ind /* Main Driver Management API calls: * Add a new driver for the specified property on the given ID block */ -short ANIM_add_driver (ID *id, const char rna_path[], int array_index, short flag, int type) +short ANIM_add_driver (ID *id, const char rna_path[], int array_index, short UNUSED(flag), int type) { PointerRNA id_ptr, ptr; PropertyRNA *prop; @@ -193,7 +193,7 @@ short ANIM_add_driver (ID *id, const char rna_path[], int array_index, short fla /* Main Driver Management API calls: * Remove the driver for the specified property on the given ID block (if available) */ -short ANIM_remove_driver (struct ID *id, const char rna_path[], int array_index, short flag) +short ANIM_remove_driver (struct ID *id, const char rna_path[], int array_index, short UNUSED(flag)) { AnimData *adt; FCurve *fcu; @@ -262,7 +262,7 @@ short ANIM_driver_can_paste (void) /* Main Driver Management API calls: * Make a copy of the driver for the specified property on the given ID block */ -short ANIM_copy_driver (ID *id, const char rna_path[], int array_index, short flag) +short ANIM_copy_driver (ID *id, const char rna_path[], int array_index, short UNUSED(flag)) { PointerRNA id_ptr, ptr; PropertyRNA *prop; @@ -307,7 +307,7 @@ short ANIM_copy_driver (ID *id, const char rna_path[], int array_index, short fl * Add a new driver for the specified property on the given ID block or replace an existing one * with the driver + driver-curve data from the buffer */ -short ANIM_paste_driver (ID *id, const char rna_path[], int array_index, short flag) +short ANIM_paste_driver (ID *id, const char rna_path[], int array_index, short UNUSED(flag)) { PointerRNA id_ptr, ptr; PropertyRNA *prop; @@ -472,7 +472,7 @@ void ANIM_OT_driver_button_remove (wmOperatorType *ot) /* Copy Driver Button Operator ------------------------ */ -static int copy_driver_button_exec (bContext *C, wmOperator *op) +static int copy_driver_button_exec (bContext *C, wmOperator *UNUSED(op)) { PointerRNA ptr; PropertyRNA *prop= NULL; @@ -518,7 +518,7 @@ void ANIM_OT_copy_driver_button (wmOperatorType *ot) /* Paste Driver Button Operator ------------------------ */ -static int paste_driver_button_exec (bContext *C, wmOperator *op) +static int paste_driver_button_exec (bContext *C, wmOperator *UNUSED(op)) { PointerRNA ptr; PropertyRNA *prop= NULL; diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c index 35e6cb66d45..2b8d0f35b9a 100644 --- a/source/blender/editors/animation/fmodifier_ui.c +++ b/source/blender/editors/animation/fmodifier_ui.c @@ -74,7 +74,7 @@ } /* callback to verify modifier data */ -static void validate_fmodifier_cb (bContext *C, void *fcm_v, void *dummy) +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); @@ -215,7 +215,7 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s /* --------------- */ /* draw settings for generator modifier */ -static void draw_modifier__fn_generator(uiLayout *layout, ID *id, FModifier *fcm, short width) +static void draw_modifier__fn_generator(uiLayout *layout, ID *id, FModifier *fcm, short UNUSED(width)) { uiLayout *col; PointerRNA ptr; @@ -238,7 +238,7 @@ static void draw_modifier__fn_generator(uiLayout *layout, ID *id, FModifier *fcm /* --------------- */ /* draw settings for cycles modifier */ -static void draw_modifier__cycles(uiLayout *layout, ID *id, FModifier *fcm, short width) +static void draw_modifier__cycles(uiLayout *layout, ID *id, FModifier *fcm, short UNUSED(width)) { uiLayout *split, *col; PointerRNA ptr; @@ -267,7 +267,7 @@ static void draw_modifier__cycles(uiLayout *layout, ID *id, FModifier *fcm, shor /* --------------- */ /* draw settings for noise modifier */ -static void draw_modifier__noise(uiLayout *layout, ID *id, FModifier *fcm, short width) +static void draw_modifier__noise(uiLayout *layout, ID *id, FModifier *fcm, short UNUSED(width)) { uiLayout *split, *col; PointerRNA ptr; @@ -374,7 +374,7 @@ 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 *dummy) +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; @@ -426,7 +426,7 @@ static void fmod_envelope_addpoint_cb (bContext *C, void *fcm_dv, void *dummy) /* callback to remove envelope data point */ // TODO: should we have a separate file for things like this? -static void fmod_envelope_deletepoint_cb (bContext *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; FCM_EnvelopeData *fedn; @@ -454,7 +454,7 @@ static void fmod_envelope_deletepoint_cb (bContext *C, void *fcm_dv, void *ind_v } /* draw settings for envelope modifier */ -static void draw_modifier__envelope(uiLayout *layout, ID *id, FModifier *fcm, short width) +static void draw_modifier__envelope(uiLayout *layout, ID *id, FModifier *fcm, short UNUSED(width)) { FMod_Envelope *env= (FMod_Envelope *)fcm->data; FCM_EnvelopeData *fed; @@ -509,7 +509,7 @@ static void draw_modifier__envelope(uiLayout *layout, ID *id, FModifier *fcm, sh /* --------------- */ /* draw settings for limits modifier */ -static void draw_modifier__limits(uiLayout *layout, ID *id, FModifier *fcm, short width) +static void draw_modifier__limits(uiLayout *layout, ID *id, FModifier *fcm, short UNUSED(width)) { uiLayout *split, *col, *row; PointerRNA ptr; @@ -557,7 +557,7 @@ static void draw_modifier__limits(uiLayout *layout, ID *id, FModifier *fcm, shor /* --------------- */ /* draw settings for stepped interpolation modifier */ -static void draw_modifier__stepped(uiLayout *layout, ID *id, FModifier *fcm, short width) +static void draw_modifier__stepped(uiLayout *layout, ID *id, FModifier *fcm, short UNUSED(width)) { uiLayout *col, *subcol; PointerRNA ptr; diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c index 545b8462d4c..0a20ff931bc 100644 --- a/source/blender/editors/animation/keyframes_draw.c +++ b/source/blender/editors/animation/keyframes_draw.c @@ -656,7 +656,7 @@ void draw_gpl_channel(View2D *v2d, bDopeSheet *ads, bGPDlayer *gpl, float ypos) BLI_dlrbTree_init(&keys); - gpl_to_keylist(ads, gpl, &keys, NULL); + gpl_to_keylist(ads, gpl, &keys); BLI_dlrbTree_linkedlist_sync(&keys); @@ -916,7 +916,7 @@ void action_to_keylist(AnimData *adt, bAction *act, DLRBT_Tree *keys, DLRBT_Tree } -void gpl_to_keylist(bDopeSheet *ads, bGPDlayer *gpl, DLRBT_Tree *keys, DLRBT_Tree *blocks) +void gpl_to_keylist(bDopeSheet *UNUSED(ads), bGPDlayer *gpl, DLRBT_Tree *keys) { bGPDframe *gpf; ActKeyColumn *ak; diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c index 03bb8da529f..a1c02f922f2 100644 --- a/source/blender/editors/animation/keyframes_edit.c +++ b/source/blender/editors/animation/keyframes_edit.c @@ -388,7 +388,7 @@ static short scene_keyframes_loop(KeyframeEditData *ked, Scene *sce, KeyframeEdi } /* This function is used to loop over the keyframe data in a DopeSheet summary */ -static short summary_keyframes_loop(KeyframeEditData *ked, bAnimContext *ac, KeyframeEditFunc key_ok, KeyframeEditFunc key_cb, FcuEditFunc fcu_cb, int filterflag) +static short summary_keyframes_loop(KeyframeEditData *ked, bAnimContext *ac, KeyframeEditFunc key_ok, KeyframeEditFunc key_cb, FcuEditFunc fcu_cb, int UNUSED(filterflag)) { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; @@ -560,7 +560,7 @@ static short ok_bezier_framerange(KeyframeEditData *ked, BezTriple *bezt) return ok; } -static short ok_bezier_selected(KeyframeEditData *ked, BezTriple *bezt) +static short ok_bezier_selected(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { /* this macro checks all beztriple handles for selection... * only one of the verts has to be selected for this to be ok... @@ -696,7 +696,7 @@ void bezt_remap_times(KeyframeEditData *ked, BezTriple *bezt) /* Transform */ /* snaps the keyframe to the nearest frame */ -static short snap_bezier_nearest(KeyframeEditData *ked, BezTriple *bezt) +static short snap_bezier_nearest(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { if (bezt->f2 & SELECT) bezt->vec[1][0]= (float)(floor(bezt->vec[1][0]+0.5)); @@ -732,7 +732,7 @@ static short snap_bezier_nearmarker(KeyframeEditData *ked, BezTriple *bezt) } /* make the handles have the same value as the key */ -static short snap_bezier_horizontal(KeyframeEditData *ked, BezTriple *bezt) +static short snap_bezier_horizontal(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { if (bezt->f2 & SELECT) { bezt->vec[0][1]= bezt->vec[2][1]= bezt->vec[1][1]; @@ -787,7 +787,7 @@ static short mirror_bezier_cframe(KeyframeEditData *ked, BezTriple *bezt) return 0; } -static short mirror_bezier_yaxis(KeyframeEditData *ked, BezTriple *bezt) +static short mirror_bezier_yaxis(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { float diff; @@ -799,7 +799,7 @@ static short mirror_bezier_yaxis(KeyframeEditData *ked, BezTriple *bezt) return 0; } -static short mirror_bezier_xaxis(KeyframeEditData *ked, BezTriple *bezt) +static short mirror_bezier_xaxis(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { float diff; @@ -860,7 +860,7 @@ KeyframeEditFunc ANIM_editkeyframes_mirror(short type) /* Settings */ /* Sets the selected bezier handles to type 'auto' */ -static short set_bezier_auto(KeyframeEditData *ked, BezTriple *bezt) +static short set_bezier_auto(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { if((bezt->f1 & SELECT) || (bezt->f3 & SELECT)) { if (bezt->f1 & SELECT) bezt->h1= HD_AUTO; /* the secret code for auto */ @@ -878,7 +878,7 @@ static short set_bezier_auto(KeyframeEditData *ked, BezTriple *bezt) } /* Sets the selected bezier handles to type 'vector' */ -static short set_bezier_vector(KeyframeEditData *ked, BezTriple *bezt) +static short set_bezier_vector(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { if ((bezt->f1 & SELECT) || (bezt->f3 & SELECT)) { if (bezt->f1 & SELECT) bezt->h1= HD_VECT; @@ -898,7 +898,7 @@ static short set_bezier_vector(KeyframeEditData *ked, BezTriple *bezt) /* Queries if the handle should be set to 'free' or 'align' */ // NOTE: this was used for the 'toggle free/align' option // currently this isn't used, but may be restored later -static short bezier_isfree(KeyframeEditData *ked, BezTriple *bezt) +static short bezier_isfree(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { if ((bezt->f1 & SELECT) && (bezt->h1)) return 1; if ((bezt->f3 & SELECT) && (bezt->h2)) return 1; @@ -906,7 +906,7 @@ static short bezier_isfree(KeyframeEditData *ked, BezTriple *bezt) } /* Sets selected bezier handles to type 'align' */ -static short set_bezier_align(KeyframeEditData *ked, BezTriple *bezt) +static short set_bezier_align(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { if (bezt->f1 & SELECT) bezt->h1= HD_ALIGN; if (bezt->f3 & SELECT) bezt->h2= HD_ALIGN; @@ -914,7 +914,7 @@ static short set_bezier_align(KeyframeEditData *ked, BezTriple *bezt) } /* Sets selected bezier handles to type 'free' */ -static short set_bezier_free(KeyframeEditData *ked, BezTriple *bezt) +static short set_bezier_free(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { if (bezt->f1 & SELECT) bezt->h1= HD_FREE; if (bezt->f3 & SELECT) bezt->h2= HD_FREE; @@ -944,21 +944,21 @@ KeyframeEditFunc ANIM_editkeyframes_handles(short code) /* ------- */ -static short set_bezt_constant(KeyframeEditData *ked, BezTriple *bezt) +static short set_bezt_constant(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { if (bezt->f2 & SELECT) bezt->ipo= BEZT_IPO_CONST; return 0; } -static short set_bezt_linear(KeyframeEditData *ked, BezTriple *bezt) +static short set_bezt_linear(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { if (bezt->f2 & SELECT) bezt->ipo= BEZT_IPO_LIN; return 0; } -static short set_bezt_bezier(KeyframeEditData *ked, BezTriple *bezt) +static short set_bezt_bezier(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { if (bezt->f2 & SELECT) bezt->ipo= BEZT_IPO_BEZ; @@ -981,21 +981,21 @@ KeyframeEditFunc ANIM_editkeyframes_ipo(short code) /* ------- */ -static short set_keytype_keyframe(KeyframeEditData *ked, BezTriple *bezt) +static short set_keytype_keyframe(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { if (bezt->f2 & SELECT) BEZKEYTYPE(bezt)= BEZT_KEYTYPE_KEYFRAME; return 0; } -static short set_keytype_breakdown(KeyframeEditData *ked, BezTriple *bezt) +static short set_keytype_breakdown(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { if (bezt->f2 & SELECT) BEZKEYTYPE(bezt)= BEZT_KEYTYPE_BREAKDOWN; return 0; } -static short set_keytype_extreme(KeyframeEditData *ked, BezTriple *bezt) +static short set_keytype_extreme(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { if (bezt->f2 & SELECT) BEZKEYTYPE(bezt)= BEZT_KEYTYPE_EXTREME; @@ -1057,7 +1057,7 @@ static short select_bezier_subtract(KeyframeEditData *ked, BezTriple *bezt) return 0; } -static short select_bezier_invert(KeyframeEditData *ked, BezTriple *bezt) +static short select_bezier_invert(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { /* Invert the selection for the whole bezier triple */ bezt->f2 ^= SELECT; diff --git a/source/blender/editors/animation/keyframes_general.c b/source/blender/editors/animation/keyframes_general.c index befcc0a71cb..68e38d04620 100644 --- a/source/blender/editors/animation/keyframes_general.c +++ b/source/blender/editors/animation/keyframes_general.c @@ -486,7 +486,7 @@ void free_anim_copybuf (void) /* ------------------- */ /* This function adds data to the keyframes copy/paste buffer, freeing existing data first */ -short copy_animedit_keys (bAnimContext *ac, ListBase *anim_data) +short copy_animedit_keys (bAnimContext *UNUSED(ac), ListBase *anim_data) { bAnimListElem *ale; diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index e92065eea91..ddd692d26ea 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -917,7 +917,7 @@ short insert_keyframe (ID *id, bAction *act, const char group[], const char rna_ * The flag argument is used for special settings that alter the behaviour of * the keyframe deletion. These include the quick refresh options. */ -short delete_keyframe (ID *id, bAction *act, const char group[], const char rna_path[], int array_index, float cfra, short flag) +short delete_keyframe (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); PointerRNA id_ptr, ptr; @@ -1146,7 +1146,7 @@ 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 *event) +static int insert_key_menu_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Scene *scene= CTX_data_scene(C); diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c index 77e0c84d2f3..57617651823 100644 --- a/source/blender/editors/animation/keyingsets.c +++ b/source/blender/editors/animation/keyingsets.c @@ -107,7 +107,7 @@ static int keyingset_poll_activePath_edit (bContext *C) /* Add a Default (Empty) Keying Set ------------------------- */ -static int add_default_keyingset_exec (bContext *C, wmOperator *op) +static int add_default_keyingset_exec (bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); short flag=0, keyingflag=0; @@ -464,7 +464,7 @@ void ANIM_OT_keyingset_button_remove (wmOperatorType *ot) /* Change Active KeyingSet Operator ------------------------ */ /* This operator checks if a menu should be shown for choosing the KeyingSet to make the active one */ -static int keyingset_active_menu_invoke (bContext *C, wmOperator *op, wmEvent *event) +static int keyingset_active_menu_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { /* call the menu, which will call this operator again, hence the cancelled */ ANIM_keying_sets_menu_setup(C, op->type->name, "ANIM_OT_keying_set_active_set"); @@ -558,7 +558,7 @@ KeyingSet *ANIM_builtin_keyingset_get_named (KeyingSet *prevKS, const char name[ /* --------------- */ /* Add the given KeyingSetInfo to the list of type infos, and create an appropriate builtin set too */ -void ANIM_keyingset_info_register (const bContext *C, KeyingSetInfo *ksi) +void ANIM_keyingset_info_register (KeyingSetInfo *ksi) { KeyingSet *ks; diff --git a/source/blender/editors/armature/armature_intern.h b/source/blender/editors/armature/armature_intern.h index 2d28d3cb9e5..acbfec125e0 100644 --- a/source/blender/editors/armature/armature_intern.h +++ b/source/blender/editors/armature/armature_intern.h @@ -51,9 +51,7 @@ void ARMATURE_OT_align(struct wmOperatorType *ot); void ARMATURE_OT_calculate_roll(struct wmOperatorType *ot); void ARMATURE_OT_switch_direction(struct wmOperatorType *ot); -void ARMATURE_OT_subdivs(struct wmOperatorType *ot); -void ARMATURE_OT_subdivide_simple(struct wmOperatorType *ot); -void ARMATURE_OT_subdivide_multi(struct wmOperatorType *ot); +void ARMATURE_OT_subdivide(struct wmOperatorType *ot); void ARMATURE_OT_parent_set(struct wmOperatorType *ot); void ARMATURE_OT_parent_clear(struct wmOperatorType *ot); diff --git a/source/blender/editors/armature/armature_ops.c b/source/blender/editors/armature/armature_ops.c index 78b0b2e5e0d..ff4accfd066 100644 --- a/source/blender/editors/armature/armature_ops.c +++ b/source/blender/editors/armature/armature_ops.c @@ -57,9 +57,7 @@ void ED_operatortypes_armature(void) WM_operatortype_append(ARMATURE_OT_align); WM_operatortype_append(ARMATURE_OT_calculate_roll); WM_operatortype_append(ARMATURE_OT_switch_direction); - WM_operatortype_append(ARMATURE_OT_subdivs); - WM_operatortype_append(ARMATURE_OT_subdivide_simple); - WM_operatortype_append(ARMATURE_OT_subdivide_multi); + WM_operatortype_append(ARMATURE_OT_subdivide); WM_operatortype_append(ARMATURE_OT_parent_set); WM_operatortype_append(ARMATURE_OT_parent_clear); diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index 26a89c4de02..c8c0a4e6980 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -655,7 +655,7 @@ void POSE_OT_armature_apply (wmOperatorType *ot) /* set the current pose as the restpose */ -static int pose_visual_transform_apply_exec (bContext *C, wmOperator *op) +static int pose_visual_transform_apply_exec (bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); // must be active object, not edit-object @@ -817,7 +817,7 @@ static void joined_armature_fix_links(Object *tarArm, Object *srcArm, bPoseChann } /* join armature exec is exported for use in object->join objects operator... */ -int join_armature_exec(bContext *C, wmOperator *op) +int join_armature_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); @@ -1075,7 +1075,7 @@ static void separated_armature_fix_links(Object *origArm, Object *newArm) * sel: remove selected bones from the armature, otherwise the unselected bones are removed * (ob is not in editmode) */ -static void separate_armature_bones (Scene *scene, Object *ob, short sel) +static void separate_armature_bones(Object *ob, short sel) { bArmature *arm= (bArmature *)ob->data; bPoseChannel *pchan, *pchann; @@ -1127,7 +1127,7 @@ static void separate_armature_bones (Scene *scene, Object *ob, short sel) } /* separate selected bones into their armature */ -static int separate_armature_exec (bContext *C, wmOperator *op) +static int separate_armature_exec (bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); @@ -1176,8 +1176,8 @@ static int separate_armature_exec (bContext *C, wmOperator *op) /* 3) remove bones that shouldn't still be around on both armatures */ - separate_armature_bones(scene, oldob, 1); - separate_armature_bones(scene, newob, 0); + separate_armature_bones(oldob, 1); + separate_armature_bones(newob, 0); /* 4) fix links before depsgraph flushes */ // err... or after? @@ -1787,7 +1787,7 @@ EditBone *ED_armature_bone_get_mirrored(ListBase *edbo, EditBone *ebo) /* previously delete_armature */ /* only editmode! */ -static int armature_delete_selected_exec(bContext *C, wmOperator *op) +static int armature_delete_selected_exec(bContext *C, wmOperator *UNUSED(op)) { bArmature *arm; EditBone *curBone, *next; @@ -2087,7 +2087,7 @@ float ED_rollBoneToVector(EditBone *bone, float new_up_axis[3]) /* Set roll value for given bone -> Z-Axis Point up (original method) */ -static void auto_align_ebone_zaxisup(Scene *scene, View3D *v3d, EditBone *ebone) +static void auto_align_ebone_zaxisup(Scene *UNUSED(scene), View3D *UNUSED(v3d), EditBone *ebone) { float delta[3], curmat[3][3]; float xaxis[3]={1.0f, 0.0f, 0.0f}, yaxis[3], zaxis[3]={0.0f, 0.0f, 1.0f}; @@ -2377,7 +2377,7 @@ void add_primitive_bone(Scene *scene, View3D *v3d, RegionView3D *rv3d) /* previously addvert_armature */ /* the ctrl-click method */ -static int armature_click_extrude_exec(bContext *C, wmOperator *op) +static int armature_click_extrude_exec(bContext *C, wmOperator *UNUSED(op)) { View3D *v3d; bArmature *arm; @@ -2691,7 +2691,7 @@ EditBone *duplicateEditBone(EditBone *curBone, char *name, ListBase *editbones, } /* previously adduplicate_armature */ -static int armature_duplicate_selected_exec(bContext *C, wmOperator *op) +static int armature_duplicate_selected_exec(bContext *C, wmOperator *UNUSED(op)) { bArmature *arm; EditBone *eBone = NULL; @@ -3262,7 +3262,7 @@ void ARMATURE_OT_merge (wmOperatorType *ot) /* ************** END Add/Remove stuff in editmode ************ */ /* *************** Tools in editmode *********** */ -static int armature_hide_exec(bContext *C, wmOperator *op) +static int armature_hide_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); bArmature *arm= obedit->data; @@ -3302,7 +3302,7 @@ void ARMATURE_OT_hide(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int armature_reveal_exec(bContext *C, wmOperator *op) +static int armature_reveal_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); bArmature *arm= obedit->data; @@ -3632,10 +3632,7 @@ static int armature_subdivide_exec(bContext *C, wmOperator *op) int numcuts, i; /* there may not be a number_cuts property defined (for 'simple' subdivide) */ - if (RNA_property_is_set(op->ptr, "number_cuts")) - numcuts= RNA_int_get(op->ptr, "number_cuts"); - else - numcuts= 1; + numcuts= RNA_int_get(op->ptr, "number_cuts"); /* loop over all editable bones */ // XXX the old code did this in reverse order though! @@ -3690,26 +3687,11 @@ static int armature_subdivide_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } - -void ARMATURE_OT_subdivide_simple(wmOperatorType *ot) -{ - /* identifiers */ - ot->name= "Subdivide Simple"; - ot->idname= "ARMATURE_OT_subdivide_simple"; - - /* api callbacks */ - ot->exec = armature_subdivide_exec; - ot->poll = ED_operator_editarmature; - - /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; -} - -void ARMATURE_OT_subdivide_multi(wmOperatorType *ot) +void ARMATURE_OT_subdivide(wmOperatorType *ot) { /* identifiers */ ot->name= "Subdivide Multi"; - ot->idname= "ARMATURE_OT_subdivide_multi"; + ot->idname= "ARMATURE_OT_subdivide"; /* api callbacks */ ot->exec = armature_subdivide_exec; @@ -3719,65 +3701,7 @@ void ARMATURE_OT_subdivide_multi(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; /* Properties */ - RNA_def_int(ot->srna, "number_cuts", 2, 1, INT_MAX, "Number of Cuts", "", 1, 10); -} - - - -static int armature_subdivs_invoke(bContext *C, wmOperator *op, wmEvent *event) -{ - uiPopupMenu *pup; - uiLayout *layout; - - pup= uiPupMenuBegin(C, "Subdivision Type", 0); - layout= uiPupMenuLayout(pup); - uiItemsEnumO(layout, "ARMATURE_OT_subdivs", "type"); - uiPupMenuEnd(C, pup); - - return OPERATOR_CANCELLED; -} - -static int armature_subdivs_exec(bContext *C, wmOperator *op) -{ - switch (RNA_int_get(op->ptr, "type")) - { - case 0: /* simple */ - RNA_int_set(op->ptr, "number_cuts", 1); - armature_subdivide_exec(C, op); - break; - case 1: /* multi */ - armature_subdivide_exec(C, op); - break; - } - - return OPERATOR_FINISHED; -} - -void ARMATURE_OT_subdivs(wmOperatorType *ot) -{ - static EnumPropertyItem type_items[]= { - {0, "SIMPLE", 0, "Simple", ""}, - {1, "MULTI", 0, "Multi", ""}, - {0, NULL, 0, NULL, NULL}}; - - /* identifiers */ - ot->name= "subdivs"; - ot->idname= "ARMATURE_OT_subdivs"; - - /* api callbacks */ - ot->invoke= armature_subdivs_invoke; - ot->exec= armature_subdivs_exec; - - ot->poll= ED_operator_editarmature; - - /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; - - /* props */ - RNA_def_enum(ot->srna, "type", type_items, 0, "Type", ""); - - /* this is temp, the ops are different, but they are called from subdivs, so all the possible props should be here as well*/ - RNA_def_int(ot->srna, "number_cuts", 2, 1, INT_MAX, "Number of Cuts", "", 1, 10); + RNA_def_int(ot->srna, "number_cuts", 1, 1, INT_MAX, "Number of Cuts", "", 1, 10); } /* ----------- */ @@ -3788,7 +3712,7 @@ void ARMATURE_OT_subdivs(wmOperatorType *ot) * this to be done easily. */ -static int armature_switch_direction_exec(bContext *C, wmOperator *op) +static int armature_switch_direction_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_edit_object(C); bArmature *arm= (bArmature *)ob->data; @@ -4009,7 +3933,7 @@ static int armature_parent_set_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int armature_parent_set_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int armature_parent_set_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event)) { EditBone *actbone = CTX_data_active_bone(C); uiPopupMenu *pup= uiPupMenuBegin(C, "Make Parent ", 0); @@ -4106,7 +4030,7 @@ void ARMATURE_OT_parent_clear(wmOperatorType *ot) /* **************** Selections ******************/ -static int armature_select_inverse_exec(bContext *C, wmOperator *op) +static int armature_select_inverse_exec(bContext *C, wmOperator *UNUSED(op)) { /* Set the flags */ CTX_DATA_BEGIN(C, EditBone *, ebone, visible_bones) { @@ -4552,7 +4476,7 @@ void ED_pose_deselectall (Object *ob, int test) arm->act_bone= NULL; } -static int bone_skinnable(Object *ob, Bone *bone, void *datap) +static int bone_skinnable_cb(Object *ob, Bone *bone, void *datap) { /* Bones that are deforming * are regarded to be "skinnable" and are eligible for @@ -4601,7 +4525,7 @@ static int bone_skinnable(Object *ob, Bone *bone, void *datap) return 0; } -static int ED_vgroup_add_unique_bone(Object *ob, Bone *bone, void *data) +static int vgroup_add_unique_bone_cb(Object *ob, Bone *bone, void *UNUSED(ptr)) { /* This group creates a vertex group to ob that has the * same name as bone (provided the bone is skinnable). @@ -4616,7 +4540,7 @@ static int ED_vgroup_add_unique_bone(Object *ob, Bone *bone, void *data) return 0; } -static int dgroup_skinnable(Object *ob, Bone *bone, void *datap) +static int dgroup_skinnable_cb(Object *ob, Bone *bone, void *datap) { /* Bones that are deforming * are regarded to be "skinnable" and are eligible for @@ -4672,7 +4596,7 @@ static int dgroup_skinnable(Object *ob, Bone *bone, void *datap) return 0; } -static void add_vgroups__mapFunc(void *userData, int index, float *co, float *no_f, short *no_s) +static void add_vgroups__mapFunc(void *userData, int index, float *co, float *UNUSED(no_f), short *UNUSED(no_s)) { /* DerivedMesh mapFunc for getting final coords in weight paint mode */ @@ -4723,7 +4647,7 @@ static void envelope_bone_weighting(Object *ob, Mesh *mesh, float (*verts)[3], i } } -void add_verts_to_dgroups(Scene *scene, Object *ob, Object *par, int heat, int mirror) +void add_verts_to_dgroups(ReportList *reports, Scene *scene, Object *ob, Object *par, int heat, int mirror) { /* This functions implements the automatic computation of vertex group * weights, either through envelopes or using a heat equilibrium. @@ -4755,7 +4679,7 @@ void add_verts_to_dgroups(Scene *scene, Object *ob, Object *par, int heat, int m looper_data.list= NULL; /* count the number of skinnable bones */ - numbones = bone_looper(ob, arm->bonebase.first, &looper_data, bone_skinnable); + numbones = bone_looper(ob, arm->bonebase.first, &looper_data, bone_skinnable_cb); if (numbones == 0) return; @@ -4764,7 +4688,7 @@ void add_verts_to_dgroups(Scene *scene, Object *ob, Object *par, int heat, int m * and fill it with all of the skinnable bones */ bonelist = MEM_callocN(numbones*sizeof(Bone *), "bonelist"); looper_data.list= bonelist; - bone_looper(ob, arm->bonebase.first, &looper_data, bone_skinnable); + bone_looper(ob, arm->bonebase.first, &looper_data, bone_skinnable_cb); /* create an array of pointers to the deform groups that * coorespond to the skinnable bones (creating them @@ -4773,7 +4697,7 @@ void add_verts_to_dgroups(Scene *scene, Object *ob, Object *par, int heat, int m dgroupflip = MEM_callocN(numbones*sizeof(bDeformGroup *), "dgroupflip"); looper_data.list= dgrouplist; - bone_looper(ob, arm->bonebase.first, &looper_data, dgroup_skinnable); + bone_looper(ob, arm->bonebase.first, &looper_data, dgroup_skinnable_cb); /* create an array of root and tip positions transformed into * global coords */ @@ -4870,14 +4794,22 @@ void add_verts_to_dgroups(Scene *scene, Object *ob, Object *par, int heat, int m /* compute the weights based on gathered vertices and bones */ if (heat) { + const char *error= NULL; heat_bone_weighting(ob, mesh, verts, numbones, dgrouplist, dgroupflip, - root, tip, selected); + root, tip, selected, &error); + + if(error) { + BKE_report(reports, RPT_WARNING, error); + } } else { envelope_bone_weighting(ob, mesh, verts, numbones, bonelist, dgrouplist, dgroupflip, root, tip, selected, mat4_to_scale(par->obmat)); } - + + /* only generated in some cases but can call anyway */ + mesh_octree_table(ob, NULL, NULL, 'e'); + /* free the memory allocated */ MEM_freeN(bonelist); MEM_freeN(dgrouplist); @@ -4888,7 +4820,7 @@ void add_verts_to_dgroups(Scene *scene, Object *ob, Object *par, int heat, int m MEM_freeN(verts); } -void create_vgroups_from_armature(Scene *scene, Object *ob, Object *par, int mode, int mirror) +void create_vgroups_from_armature(ReportList *reports, Scene *scene, Object *ob, Object *par, int mode, int mirror) { /* Lets try to create some vertex groups * based on the bones of the parent armature. @@ -4899,7 +4831,7 @@ void create_vgroups_from_armature(Scene *scene, Object *ob, Object *par, int mod /* Traverse the bone list, trying to create empty vertex * groups cooresponding to the bone. */ - bone_looper(ob, arm->bonebase.first, NULL, ED_vgroup_add_unique_bone); + bone_looper(ob, arm->bonebase.first, NULL, vgroup_add_unique_bone_cb); if (ob->type == OB_MESH) ED_vgroup_data_create(ob->data); @@ -4909,12 +4841,12 @@ void create_vgroups_from_armature(Scene *scene, Object *ob, Object *par, int mod * that are populated with the vertices for which the * bone is closest. */ - add_verts_to_dgroups(scene, ob, par, (mode == ARM_GROUPS_AUTO), mirror); + add_verts_to_dgroups(reports, scene, ob, par, (mode == ARM_GROUPS_AUTO), mirror); } } /* ************* Clear Pose *****************************/ -static int pose_clear_scale_exec(bContext *C, wmOperator *op) +static int pose_clear_scale_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); @@ -4956,7 +4888,7 @@ static int pose_clear_scale_exec(bContext *C, wmOperator *op) /* now recalculate paths */ if ((ob->pose->avs.path_bakeflag & MOTIONPATH_BAKE_HAS_PATHS)) - ED_pose_recalculate_paths(C, scene, ob); + ED_pose_recalculate_paths(scene, ob); } DAG_id_flush_update(&ob->id, OB_RECALC_DATA); @@ -4982,7 +4914,7 @@ void POSE_OT_scale_clear(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int pose_clear_loc_exec(bContext *C, wmOperator *op) +static int pose_clear_loc_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); @@ -5025,7 +4957,7 @@ static int pose_clear_loc_exec(bContext *C, wmOperator *op) /* now recalculate paths */ if ((ob->pose->avs.path_bakeflag & MOTIONPATH_BAKE_HAS_PATHS)) - ED_pose_recalculate_paths(C, scene, ob); + ED_pose_recalculate_paths(scene, ob); } DAG_id_flush_update(&ob->id, OB_RECALC_DATA); @@ -5051,7 +4983,7 @@ void POSE_OT_loc_clear(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int pose_clear_rot_exec(bContext *C, wmOperator *op) +static int pose_clear_rot_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); @@ -5178,7 +5110,7 @@ static int pose_clear_rot_exec(bContext *C, wmOperator *op) /* now recalculate paths */ if ((ob->pose->avs.path_bakeflag & MOTIONPATH_BAKE_HAS_PATHS)) - ED_pose_recalculate_paths(C, scene, ob); + ED_pose_recalculate_paths(scene, ob); } DAG_id_flush_update(&ob->id, OB_RECALC_DATA); @@ -5207,7 +5139,7 @@ void POSE_OT_rot_clear(wmOperatorType *ot) /* ***************** selections ********************** */ -static int pose_select_inverse_exec(bContext *C, wmOperator *op) +static int pose_select_inverse_exec(bContext *C, wmOperator *UNUSED(op)) { /* Set the flags */ @@ -5304,7 +5236,7 @@ void POSE_OT_select_all(wmOperatorType *ot) WM_operator_properties_select_all(ot); } -static int pose_select_parent_exec(bContext *C, wmOperator *op) +static int pose_select_parent_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); bPoseChannel *pchan,*parent; @@ -5348,7 +5280,7 @@ void POSE_OT_select_parent(wmOperatorType *ot) /* ************* hide/unhide pose bones ******************* */ -static int hide_selected_pose_bone(Object *ob, Bone *bone, void *ptr) +static int hide_selected_pose_bone_cb(Object *ob, Bone *bone, void *UNUSED(ptr)) { bArmature *arm= ob->data; @@ -5363,7 +5295,7 @@ static int hide_selected_pose_bone(Object *ob, Bone *bone, void *ptr) return 0; } -static int hide_unselected_pose_bone(Object *ob, Bone *bone, void *ptr) +static int hide_unselected_pose_bone_cb(Object *ob, Bone *bone, void *UNUSED(ptr)) { bArmature *arm= ob->data; @@ -5385,11 +5317,9 @@ static int pose_hide_exec(bContext *C, wmOperator *op) bArmature *arm= ob->data; if(RNA_boolean_get(op->ptr, "unselected")) - bone_looper(ob, arm->bonebase.first, NULL, - hide_unselected_pose_bone); + bone_looper(ob, arm->bonebase.first, NULL, hide_unselected_pose_bone_cb); else - bone_looper(ob, arm->bonebase.first, NULL, - hide_selected_pose_bone); + bone_looper(ob, arm->bonebase.first, NULL, hide_selected_pose_bone_cb); /* note, notifier might evolve */ WM_event_add_notifier(C, NC_OBJECT|ND_BONE_SELECT, ob); @@ -5414,7 +5344,7 @@ void POSE_OT_hide(wmOperatorType *ot) RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", ""); } -static int show_pose_bone(Object *ob, Bone *bone, void *ptr) +static int show_pose_bone_cb(Object *ob, Bone *bone, void *UNUSED(ptr)) { bArmature *arm= ob->data; @@ -5429,12 +5359,12 @@ static int show_pose_bone(Object *ob, Bone *bone, void *ptr) } /* active object is armature in posemode, poll checked */ -static int pose_reveal_exec(bContext *C, wmOperator *op) +static int pose_reveal_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); bArmature *arm= ob->data; - bone_looper(ob, arm->bonebase.first, NULL, show_pose_bone); + bone_looper(ob, arm->bonebase.first, NULL, show_pose_bone_cb); /* note, notifier might evolve */ WM_event_add_notifier(C, NC_OBJECT|ND_BONE_SELECT, ob); @@ -5626,7 +5556,7 @@ void ED_armature_bone_rename(bArmature *arm, char *oldnamep, char *newnamep) } -static int armature_flip_names_exec (bContext *C, wmOperator *op) +static int armature_flip_names_exec (bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_edit_object(C); bArmature *arm; diff --git a/source/blender/editors/armature/editarmature_generate.c b/source/blender/editors/armature/editarmature_generate.c index 1c9024f6f91..6eda622ead8 100644 --- a/source/blender/editors/armature/editarmature_generate.c +++ b/source/blender/editors/armature/editarmature_generate.c @@ -46,7 +46,7 @@ #include "armature_intern.h" #include "BIF_generate.h" -void setBoneRollFromNormal(EditBone *bone, float *no, float invmat[][4], float tmat[][3]) +void setBoneRollFromNormal(EditBone *bone, float *no, float UNUSED(invmat[][4]), float tmat[][3]) { if (no != NULL && !is_zero_v3(no)) { @@ -118,7 +118,7 @@ float calcArcCorrelation(BArcIterator *iter, int start, int end, float v0[3], fl } } -int nextFixedSubdivision(ToolSettings *toolsettings, BArcIterator *iter, int start, int end, float head[3], float p[3]) +int nextFixedSubdivision(ToolSettings *toolsettings, BArcIterator *iter, int start, int end, float UNUSED(head[3]), float p[3]) { static float stroke_length = 0; static float current_length; @@ -277,7 +277,7 @@ int nextLengthSubdivision(ToolSettings *toolsettings, BArcIterator *iter, int st return -1; } -EditBone * subdivideArcBy(ToolSettings *toolsettings, bArmature *arm, ListBase *editbones, BArcIterator *iter, float invmat[][4], float tmat[][3], NextSubdivisionFunc next_subdividion) +EditBone * subdivideArcBy(ToolSettings *toolsettings, bArmature *arm, ListBase *UNUSED(editbones), BArcIterator *iter, float invmat[][4], float tmat[][3], NextSubdivisionFunc next_subdividion) { EditBone *lastBone = NULL; EditBone *child = NULL; diff --git a/source/blender/editors/armature/editarmature_retarget.c b/source/blender/editors/armature/editarmature_retarget.c index 637c6076314..e80f1494d8c 100644 --- a/source/blender/editors/armature/editarmature_retarget.c +++ b/source/blender/editors/armature/editarmature_retarget.c @@ -374,7 +374,7 @@ static RigNode *newRigNodeHead(RigGraph *rg, RigArc *arc, float p[3]) return node; } -static void addRigNodeHead(RigGraph *rg, RigArc *arc, RigNode *node) +static void addRigNodeHead(RigGraph *UNUSED(rg), RigArc *arc, RigNode *node) { node->degree++; @@ -1784,7 +1784,7 @@ static void repositionTailControl(RigGraph *rigg, RigControl *ctrl) finalizeControl(rigg, ctrl, 1); /* resize will be recalculated anyway so we don't need it */ } -static void repositionControl(RigGraph *rigg, RigControl *ctrl, float head[3], float tail[3], float qrot[4], float resize) +static void repositionControl(RigGraph *rigg, RigControl *ctrl, float head[3], float UNUSED(tail[3]), float qrot[4], float resize) { float parent_offset[3], tail_offset[3]; @@ -2051,7 +2051,7 @@ static float calcCostLengthDistance(BArcIterator *iter, float **vec_cache, RigEd } #endif -static float calcCostAngleLengthDistance(BArcIterator *iter, float **vec_cache, RigEdge *edge, float *vec0, float *vec1, float *vec2, int i1, int i2, float angle_weight, float length_weight, float distance_weight) +static float calcCostAngleLengthDistance(BArcIterator *iter, float **UNUSED(vec_cache), RigEdge *edge, float *vec0, float *vec1, float *vec2, int i1, int i2, float angle_weight, float length_weight, float distance_weight) { float vec_second[3], vec_first[3]; float length2; diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c index 241301b8ee1..93bddb3834b 100644 --- a/source/blender/editors/armature/editarmature_sketch.c +++ b/source/blender/editors/armature/editarmature_sketch.c @@ -184,7 +184,7 @@ void BIF_makeListTemplates(const bContext *C) } } -char *BIF_listTemplates(const bContext *C) +char *BIF_listTemplates(const bContext *UNUSED(C)) { GHashIterator ghi; char menu_header[] = "Template%t|None%x0|"; @@ -309,7 +309,7 @@ char * BIF_nameBoneTemplate(const bContext *C) return RIG_nameBone(rg, 0, index); } -void BIF_freeTemplates(bContext *C) +void BIF_freeTemplates(bContext *UNUSED(C)) { if (TEMPLATES_MENU != NULL) { @@ -1029,7 +1029,7 @@ void sk_projectDrawPoint(bContext *C, float vec[3], SK_Stroke *stk, SK_DrawData sub_v3_v3v3(vec, fp, dvec); } -int sk_getStrokeDrawPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, SK_Stroke *stk, SK_DrawData *dd) +int sk_getStrokeDrawPoint(bContext *C, SK_Point *pt, SK_Sketch *UNUSED(sketch), SK_Stroke *stk, SK_DrawData *dd) { pt->type = dd->type; pt->mode = PT_PROJECT; @@ -1773,7 +1773,7 @@ int sk_getSegments(SK_Stroke *segments, SK_Stroke *gesture) return segments->nb_points - 1; } -int sk_detectCutGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) +int sk_detectCutGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED(sketch)) { if (gest->nb_segments == 1 && gest->nb_intersections == 1) { @@ -1783,7 +1783,7 @@ int sk_detectCutGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) return 0; } -void sk_applyCutGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) +void sk_applyCutGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED(sketch)) { SK_Intersection *isect; @@ -1800,7 +1800,7 @@ void sk_applyCutGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) } } -int sk_detectTrimGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) +int sk_detectTrimGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED(sketch)) { if (gest->nb_segments == 2 && gest->nb_intersections == 1 && gest->nb_self_intersections == 0) { @@ -1821,7 +1821,7 @@ int sk_detectTrimGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) return 0; } -void sk_applyTrimGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) +void sk_applyTrimGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED(sketch)) { SK_Intersection *isect; float trim_dir[3]; @@ -1856,7 +1856,7 @@ void sk_applyTrimGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) } } -int sk_detectCommandGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) +int sk_detectCommandGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED(sketch)) { if (gest->nb_segments > 2 && gest->nb_intersections == 2 && gest->nb_self_intersections == 1) { @@ -1883,7 +1883,7 @@ int sk_detectCommandGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) return 0; } -void sk_applyCommandGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) +void sk_applyCommandGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED(sketch)) { SK_Intersection *isect; int command = 1; @@ -1918,7 +1918,7 @@ void sk_applyCommandGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) } } -int sk_detectDeleteGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) +int sk_detectDeleteGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED(sketch)) { if (gest->nb_segments == 2 && gest->nb_intersections == 2) { @@ -1939,7 +1939,7 @@ int sk_detectDeleteGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) return 0; } -void sk_applyDeleteGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) +void sk_applyDeleteGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *sketch) { SK_Intersection *isect; @@ -1955,7 +1955,7 @@ void sk_applyDeleteGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) } } -int sk_detectMergeGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) +int sk_detectMergeGesture(bContext *C, SK_Gesture *gest, SK_Sketch *UNUSED(sketch)) { ARegion *ar = CTX_wm_region(C); if (gest->nb_segments > 2 && gest->nb_intersections == 2) @@ -2003,7 +2003,7 @@ int sk_detectMergeGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) return 0; } -void sk_applyMergeGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) +void sk_applyMergeGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED(sketch)) { SK_Intersection *isect; @@ -2034,7 +2034,7 @@ void sk_applyMergeGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) } } -int sk_detectReverseGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) +int sk_detectReverseGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED(sketch)) { if (gest->nb_segments > 2 && gest->nb_intersections == 2 && gest->nb_self_intersections == 0) { @@ -2076,7 +2076,7 @@ int sk_detectReverseGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) return 0; } -void sk_applyReverseGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) +void sk_applyReverseGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED(sketch)) { SK_Intersection *isect; @@ -2093,7 +2093,7 @@ void sk_applyReverseGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) } } -int sk_detectConvertGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) +int sk_detectConvertGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED(sketch)) { if (gest->nb_segments == 3 && gest->nb_self_intersections == 1) { @@ -2102,7 +2102,7 @@ int sk_detectConvertGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) return 0; } -void sk_applyConvertGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) +void sk_applyConvertGesture(bContext *C, SK_Gesture *UNUSED(gest), SK_Sketch *sketch) { sk_convert(C, sketch); } @@ -2215,7 +2215,7 @@ void sk_queueRedrawSketch(SK_Sketch *sketch) } } -void sk_drawSketch(Scene *scene, View3D *v3d, SK_Sketch *sketch, int with_names) +void sk_drawSketch(Scene *scene, View3D *UNUSED(v3d), SK_Sketch *sketch, int with_names) { ToolSettings *ts= scene->toolsettings; SK_Stroke *stk; @@ -2452,7 +2452,7 @@ void BDR_drawSketch(const bContext *C) } } -static int sketch_delete(bContext *C, wmOperator *op, wmEvent *event) +static int sketch_delete(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event)) { SK_Sketch *sketch = contextSketch(C, 0); if (sketch) @@ -2558,7 +2558,7 @@ SK_Sketch* viewcontextSketch(ViewContext *vc, int create) return sketch; } -static int sketch_convert(bContext *C, wmOperator *op, wmEvent *event) +static int sketch_convert(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event)) { SK_Sketch *sketch = contextSketch(C, 0); if (sketch != NULL) @@ -2569,7 +2569,7 @@ static int sketch_convert(bContext *C, wmOperator *op, wmEvent *event) return OPERATOR_FINISHED; } -static int sketch_cancel(bContext *C, wmOperator *op, wmEvent *event) +static int sketch_cancel(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event)) { SK_Sketch *sketch = contextSketch(C, 0); if (sketch != NULL) @@ -2581,7 +2581,7 @@ static int sketch_cancel(bContext *C, wmOperator *op, wmEvent *event) return OPERATOR_PASS_THROUGH; } -static int sketch_finish(bContext *C, wmOperator *op, wmEvent *event) +static int sketch_finish(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event)) { SK_Sketch *sketch = contextSketch(C, 0); if (sketch != NULL) @@ -2595,7 +2595,7 @@ static int sketch_finish(bContext *C, wmOperator *op, wmEvent *event) return OPERATOR_PASS_THROUGH; } -static int sketch_select(bContext *C, wmOperator *op, wmEvent *event) +static int sketch_select(bContext *C, wmOperator *UNUSED(op), wmEvent *event) { SK_Sketch *sketch = contextSketch(C, 0); if (sketch) diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c index 84b02b4796a..f193defc129 100644 --- a/source/blender/editors/armature/meshlaplacian.c +++ b/source/blender/editors/armature/meshlaplacian.c @@ -61,8 +61,8 @@ /* ************* XXX *************** */ -static void waitcursor(int val) {} -static void progress_bar(int dummy_val, const char *dummy) {} +static void waitcursor(int UNUSED(val)) {} +static void progress_bar(int UNUSED(dummy_val), const char *UNUSED(dummy)) {} static void start_progress_bar() {} static void end_progress_bar() {} static void error(char *str) { printf("error: %s\n", str); } @@ -362,7 +362,7 @@ void laplacian_begin_solve(LaplacianSystem *sys, int index) } } -void laplacian_add_right_hand_side(LaplacianSystem *sys, int v, float value) +void laplacian_add_right_hand_side(LaplacianSystem *UNUSED(sys), int v, float value) { nlRightHandSideAdd(0, v, value); } @@ -398,7 +398,7 @@ typedef struct BVHCallbackUserData { LaplacianSystem *sys; } BVHCallbackUserData; -static void bvh_callback(void *userdata, int index, const BVHTreeRay *ray, BVHTreeRayHit *hit) +static void bvh_callback(void *userdata, int index, const BVHTreeRay *UNUSED(ray), BVHTreeRayHit *hit) { BVHCallbackUserData *data = (struct BVHCallbackUserData*)userdata; MFace *mf = data->sys->heat.mface + index; @@ -642,13 +642,15 @@ static float heat_limit_weight(float weight) return weight; } -void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource, bDeformGroup **dgrouplist, bDeformGroup **dgroupflip, float (*root)[3], float (*tip)[3], int *selected) +void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource, bDeformGroup **dgrouplist, bDeformGroup **dgroupflip, float (*root)[3], float (*tip)[3], int *selected, const char **err_str) { LaplacianSystem *sys; MFace *mface; float solution, weight; int *vertsflipped = NULL, *mask= NULL; int a, totface, j, bbone, firstsegment, lastsegment, thrownerror = 0; + + *err_str= NULL; /* count triangles and create mask */ if(me->editflag & ME_EDIT_PAINT_MASK) @@ -760,8 +762,7 @@ void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource, } } else if(!thrownerror) { - error("Bone Heat Weighting:" - " failed to find solution for one or more bones"); + *err_str= "Bone Heat Weighting: failed to find solution for one or more bones"; thrownerror= 1; break; } @@ -1400,7 +1401,7 @@ static void meshdeform_bind_floodfill(MeshDeformBind *mdb) MEM_freeN(stack); } -static float meshdeform_boundary_phi(MeshDeformBind *mdb, MDefBoundIsect *isect, int cagevert) +static float meshdeform_boundary_phi(MeshDeformBind *UNUSED(mdb), MDefBoundIsect *isect, int cagevert) { int a; @@ -1411,7 +1412,7 @@ static float meshdeform_boundary_phi(MeshDeformBind *mdb, MDefBoundIsect *isect, return 0.0f; } -static float meshdeform_interp_w(MeshDeformBind *mdb, float *gridvec, float *vec, int cagevert) +static float meshdeform_interp_w(MeshDeformBind *mdb, float *gridvec, float *UNUSED(vec), int UNUSED(cagevert)) { float dvec[3], ivec[3], wx, wy, wz, result=0.0f; float weight, totweight= 0.0f; @@ -1562,7 +1563,7 @@ static void meshdeform_matrix_add_semibound_phi(MeshDeformBind *mdb, int x, int } } -static void meshdeform_matrix_add_exterior_phi(MeshDeformBind *mdb, int x, int y, int z, int cagevert) +static void meshdeform_matrix_add_exterior_phi(MeshDeformBind *mdb, int x, int y, int z, int UNUSED(cagevert)) { float phi, totweight; int i, a, acenter; @@ -1711,7 +1712,7 @@ static void meshdeform_matrix_solve(MeshDeformBind *mdb) nlDeleteContext(context); } -static void harmonic_coordinates_bind(Scene *scene, MeshDeformModifierData *mmd, MeshDeformBind *mdb) +static void harmonic_coordinates_bind(Scene *UNUSED(scene), MeshDeformModifierData *mmd, MeshDeformBind *mdb) { MDefBindInfluence *inf; MDefInfluence *mdinf; diff --git a/source/blender/editors/armature/meshlaplacian.h b/source/blender/editors/armature/meshlaplacian.h index 640eb33c945..cba43043e8d 100644 --- a/source/blender/editors/armature/meshlaplacian.h +++ b/source/blender/editors/armature/meshlaplacian.h @@ -66,7 +66,7 @@ float laplacian_system_get_solution(int v); void heat_bone_weighting(struct Object *ob, struct Mesh *me, float (*verts)[3], int numbones, struct bDeformGroup **dgrouplist, struct bDeformGroup **dgroupflip, float (*root)[3], float (*tip)[3], - int *selected); + int *selected, const char **error); #ifdef RIGID_DEFORM /* As-Rigid-As-Possible Deformation */ diff --git a/source/blender/editors/armature/poseSlide.c b/source/blender/editors/armature/poseSlide.c index 482d97811a3..7b2ec9891f4 100644 --- a/source/blender/editors/armature/poseSlide.c +++ b/source/blender/editors/armature/poseSlide.c @@ -157,7 +157,7 @@ static int pose_slide_init (bContext *C, wmOperator *op, short mode) } /* exiting the operator - free data */ -static void pose_slide_exit (bContext *C, wmOperator *op) +static void pose_slide_exit(wmOperator *op) { tPoseSlideOp *pso= op->customdata; @@ -376,7 +376,7 @@ static void pose_slide_apply_quat (tPoseSlideOp *pso, tPChanFCurveLink *pfl) } /* apply() - perform the pose sliding based on weighting various poses */ -static void pose_slide_apply (bContext *C, wmOperator *op, tPoseSlideOp *pso) +static void pose_slide_apply(bContext *C, tPoseSlideOp *pso) { tPChanFCurveLink *pfl; @@ -434,7 +434,7 @@ static void pose_slide_autoKeyframe (bContext *C, tPoseSlideOp *pso) } /* reset changes made to current pose */ -static void pose_slide_reset (bContext *C, tPoseSlideOp *pso) +static void pose_slide_reset (tPoseSlideOp *pso) { /* wrapper around the generic call, so that custom stuff can be added later */ poseAnim_mapping_reset(&pso->pfLinks); @@ -501,7 +501,7 @@ static int pose_slide_invoke_common (bContext *C, wmOperator *op, tPoseSlideOp * /* initial apply for operator... */ // TODO: need to calculate percentage for initial round too... - pose_slide_apply(C, op, pso); + pose_slide_apply(C, pso); /* depsgraph updates + redraws */ pose_slide_refresh(C, pso); @@ -528,7 +528,7 @@ static int pose_slide_modal (bContext *C, wmOperator *op, wmEvent *evt) /* insert keyframes as required... */ pose_slide_autoKeyframe(C, pso); - pose_slide_exit(C, op); + pose_slide_exit(op); /* done! */ return OPERATOR_FINISHED; @@ -541,13 +541,13 @@ static int pose_slide_modal (bContext *C, wmOperator *op, wmEvent *evt) WM_cursor_restore(win); /* reset transforms back to original state */ - pose_slide_reset(C, pso); + pose_slide_reset(pso); /* depsgraph updates + redraws */ pose_slide_refresh(C, pso); /* clean up temp data */ - pose_slide_exit(C, op); + pose_slide_exit(op); /* cancelled! */ return OPERATOR_CANCELLED; @@ -562,10 +562,10 @@ static int pose_slide_modal (bContext *C, wmOperator *op, wmEvent *evt) RNA_float_set(op->ptr, "percentage", pso->percentage); /* reset transforms (to avoid accumulation errors) */ - pose_slide_reset(C, pso); + pose_slide_reset(pso); /* apply... */ - pose_slide_apply(C, op, pso); + pose_slide_apply(C, pso); } break; @@ -579,10 +579,10 @@ static int pose_slide_modal (bContext *C, wmOperator *op, wmEvent *evt) } /* common code for cancel() */ -static int pose_slide_cancel (bContext *C, wmOperator *op) +static int pose_slide_cancel (bContext *UNUSED(C), wmOperator *op) { /* cleanup and done */ - pose_slide_exit(C, op); + pose_slide_exit(op); return OPERATOR_CANCELLED; } @@ -590,13 +590,13 @@ static int pose_slide_cancel (bContext *C, wmOperator *op) static int pose_slide_exec_common (bContext *C, wmOperator *op, tPoseSlideOp *pso) { /* settings should have been set up ok for applying, so just apply! */ - pose_slide_apply(C, op, pso); + pose_slide_apply(C, pso); /* insert keyframes if needed */ pose_slide_autoKeyframe(C, pso); /* cleanup and done */ - pose_slide_exit(C, op); + pose_slide_exit(op); return OPERATOR_FINISHED; } @@ -612,13 +612,13 @@ static void pose_slide_opdef_properties (wmOperatorType *ot) /* ------------------------------------ */ /* invoke() - for 'push' mode */ -static int pose_slide_push_invoke (bContext *C, wmOperator *op, wmEvent *evt) +static int pose_slide_push_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED(evt)) { tPoseSlideOp *pso; /* initialise data */ if (pose_slide_init(C, op, POSESLIDE_PUSH) == 0) { - pose_slide_exit(C, op); + pose_slide_exit(op); return OPERATOR_CANCELLED; } else @@ -635,7 +635,7 @@ static int pose_slide_push_exec (bContext *C, wmOperator *op) /* initialise data (from RNA-props) */ if (pose_slide_init(C, op, POSESLIDE_PUSH) == 0) { - pose_slide_exit(C, op); + pose_slide_exit(op); return OPERATOR_CANCELLED; } else @@ -669,13 +669,13 @@ void POSE_OT_push (wmOperatorType *ot) /* ........................ */ /* invoke() - for 'relax' mode */ -static int pose_slide_relax_invoke (bContext *C, wmOperator *op, wmEvent *evt) +static int pose_slide_relax_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED(evt)) { tPoseSlideOp *pso; /* initialise data */ if (pose_slide_init(C, op, POSESLIDE_RELAX) == 0) { - pose_slide_exit(C, op); + pose_slide_exit(op); return OPERATOR_CANCELLED; } else @@ -692,7 +692,7 @@ static int pose_slide_relax_exec (bContext *C, wmOperator *op) /* initialise data (from RNA-props) */ if (pose_slide_init(C, op, POSESLIDE_RELAX) == 0) { - pose_slide_exit(C, op); + pose_slide_exit(op); return OPERATOR_CANCELLED; } else @@ -726,13 +726,13 @@ void POSE_OT_relax (wmOperatorType *ot) /* ........................ */ /* invoke() - for 'breakdown' mode */ -static int pose_slide_breakdown_invoke (bContext *C, wmOperator *op, wmEvent *evt) +static int pose_slide_breakdown_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED(evt)) { tPoseSlideOp *pso; /* initialise data */ if (pose_slide_init(C, op, POSESLIDE_BREAKDOWN) == 0) { - pose_slide_exit(C, op); + pose_slide_exit(op); return OPERATOR_CANCELLED; } else @@ -749,7 +749,7 @@ static int pose_slide_breakdown_exec (bContext *C, wmOperator *op) /* initialise data (from RNA-props) */ if (pose_slide_init(C, op, POSESLIDE_BREAKDOWN) == 0) { - pose_slide_exit(C, op); + pose_slide_exit(op); return OPERATOR_CANCELLED; } else diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c index 9292c92294b..a595396b15d 100644 --- a/source/blender/editors/armature/poselib.c +++ b/source/blender/editors/armature/poselib.c @@ -268,7 +268,7 @@ static KeyingSet *poselib_ks_locrotscale = NULL; /* the only keyingset we'll ne /* ----- */ -static void poselib_add_menu_invoke__replacemenu (bContext *C, uiLayout *layout, void *arg) +static void poselib_add_menu_invoke__replacemenu (bContext *C, uiLayout *layout, void *UNUSED(arg)) { Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); bAction *act= ob->poselib; @@ -290,7 +290,7 @@ static void poselib_add_menu_invoke__replacemenu (bContext *C, uiLayout *layout, } } -static int poselib_add_menu_invoke (bContext *C, wmOperator *op, wmEvent *evt) +static int poselib_add_menu_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED(evt)) { Scene *scene= CTX_data_scene(C); Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); @@ -402,7 +402,7 @@ void POSELIB_OT_pose_add (wmOperatorType *ot) /* ----- */ -static EnumPropertyItem *poselib_stored_pose_itemf(bContext *C, PointerRNA *ptr, int *free) +static EnumPropertyItem *poselib_stored_pose_itemf(bContext *C, PointerRNA *UNUSED(ptr), int *free) { Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); bAction *act= (ob) ? ob->poselib : NULL; @@ -1034,7 +1034,7 @@ static void poselib_preview_handle_search (tPoseLib_PreviewData *pld, unsigned s } /* handle events for poselib_preview_poses */ -static int poselib_preview_handle_event (bContext *C, wmOperator *op, wmEvent *event) +static int poselib_preview_handle_event (bContext *UNUSED(C), wmOperator *op, wmEvent *event) { tPoseLib_PreviewData *pld= op->customdata; int ret = OPERATOR_RUNNING_MODAL; @@ -1411,7 +1411,7 @@ static int poselib_preview_modal (bContext *C, wmOperator *op, wmEvent *event) } /* Modal Operator init */ -static int poselib_preview_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int poselib_preview_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { tPoseLib_PreviewData *pld; diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c index 4aff2f1e915..ecb34609b2d 100644 --- a/source/blender/editors/armature/poseobject.c +++ b/source/blender/editors/armature/poseobject.c @@ -71,9 +71,9 @@ #include "armature_intern.h" /* ************* XXX *************** */ -static int pupmenu(const char *dummy) {return 0;} -static void error(const char *dummy) {}; -static void BIF_undo_push(const char *dummy) {} +static int pupmenu(const char *UNUSED(dummy)) {return 0;} +static void error(const char *UNUSED(dummy)) {}; +static void BIF_undo_push(const char *UNUSED(dummy)) {} /* ************* XXX *************** */ @@ -226,7 +226,7 @@ int ED_pose_channel_in_IK_chain(Object *ob, bPoseChannel *pchan) * * To be called from various tools that do incremental updates */ -void ED_pose_recalculate_paths(bContext *C, Scene *scene, Object *ob) +void ED_pose_recalculate_paths(Scene *scene, Object *ob) { ListBase targets = {NULL, NULL}; @@ -242,7 +242,7 @@ void ED_pose_recalculate_paths(bContext *C, Scene *scene, Object *ob) /* For the object with pose/action: create path curves for selected bones * This recalculates the WHOLE path within the pchan->pathsf and pchan->pathef range */ -static int pose_calculate_paths_exec (bContext *C, wmOperator *op) +static int pose_calculate_paths_exec (bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); Scene *scene= CTX_data_scene(C); @@ -267,7 +267,7 @@ static int pose_calculate_paths_exec (bContext *C, wmOperator *op) /* calculate the bones that now have motionpaths... */ // TODO: only make for the selected bones? - ED_pose_recalculate_paths(C, scene, ob); + ED_pose_recalculate_paths(scene, ob); /* notifiers for updates */ WM_event_add_notifier(C, NC_OBJECT|ND_POSE, ob); @@ -319,7 +319,7 @@ void ED_pose_clear_paths(Object *ob) } /* operator callback for this */ -static int pose_clear_paths_exec (bContext *C, wmOperator *op) +static int pose_clear_paths_exec (bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); Object *ob; @@ -360,7 +360,7 @@ void POSE_OT_paths_clear (wmOperatorType *ot) /* ******************* Select Constraint Target Operator ************* */ -static int pose_select_constraint_target_exec(bContext *C, wmOperator *op) +static int pose_select_constraint_target_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); bArmature *arm= ob->data; @@ -1100,7 +1100,7 @@ void POSE_OT_paste (wmOperatorType *ot) /* ********************************************** */ -static int pose_group_add_exec (bContext *C, wmOperator *op) +static int pose_group_add_exec (bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); Object *ob; @@ -1140,7 +1140,7 @@ void POSE_OT_group_add (wmOperatorType *ot) } -static int pose_group_remove_exec (bContext *C, wmOperator *op) +static int pose_group_remove_exec (bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); Object *ob; @@ -1182,7 +1182,7 @@ void POSE_OT_group_remove (wmOperatorType *ot) /* ------------ */ /* invoke callback which presents a list of bone-groups for the user to choose from */ -static int pose_groups_menu_invoke (bContext *C, wmOperator *op, wmEvent *evt) +static int pose_groups_menu_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED(evt)) { ScrArea *sa= CTX_wm_area(C); Object *ob; @@ -1300,7 +1300,7 @@ void POSE_OT_group_assign (wmOperatorType *ot) } -static int pose_group_unassign_exec (bContext *C, wmOperator *op) +static int pose_group_unassign_exec (bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); Object *ob; @@ -1375,7 +1375,7 @@ static void pose_group_select(bContext *C, Object *ob, int select) CTX_DATA_END; } -static int pose_group_select_exec (bContext *C, wmOperator *op) +static int pose_group_select_exec (bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); Object *ob; @@ -1413,7 +1413,7 @@ void POSE_OT_group_select (wmOperatorType *ot) ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; } -static int pose_group_deselect_exec (bContext *C, wmOperator *op) +static int pose_group_deselect_exec (bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); Object *ob; @@ -1453,7 +1453,7 @@ void POSE_OT_group_deselect (wmOperatorType *ot) /* ********************************************** */ -static int pose_flip_names_exec (bContext *C, wmOperator *op) +static int pose_flip_names_exec (bContext *C, wmOperator *UNUSED(op)) { Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); bArmature *arm; @@ -1827,7 +1827,7 @@ void ARMATURE_OT_bone_layers (wmOperatorType *ot) /* ********************************************** */ -static int pose_flip_quats_exec (bContext *C, wmOperator *op) +static int pose_flip_quats_exec (bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); @@ -1895,9 +1895,9 @@ void POSE_OT_quaternions_flip (wmOperatorType *ot) /* ********************************************** */ /* context: active channel */ +#if 0 void pose_special_editmenu(Scene *scene) { -#if 0 Object *obedit= scene->obedit; // XXX context Object *ob= OBACT; short nr; @@ -1920,7 +1920,7 @@ void pose_special_editmenu(Scene *scene) pose_clear_paths(ob); } else if(nr==5) { - pose_clear_user_transforms(scene, ob); + pose_clear_user_transforms(ob); } else if(nr==6) { pose_relax(); @@ -1928,11 +1928,11 @@ void pose_special_editmenu(Scene *scene) else if(ELEM3(nr, 7, 8, 9)) { pose_autoside_names(nr-7); } -#endif } + /* Restore selected pose-bones to 'action'-defined pose */ -void pose_clear_user_transforms(Scene *scene, Object *ob) +static void pose_clear_user_transforms(Object *ob) { bArmature *arm= ob->data; bPoseChannel *pchan; @@ -1964,3 +1964,4 @@ void pose_clear_user_transforms(Scene *scene, Object *ob) BIF_undo_push("Clear User Transform"); } +#endif diff --git a/source/blender/editors/armature/reeb.c b/source/blender/editors/armature/reeb.c index 9602d80575a..5af1658a83f 100644 --- a/source/blender/editors/armature/reeb.c +++ b/source/blender/editors/armature/reeb.c @@ -442,7 +442,7 @@ void flipArc(ReebArc *arc) } #ifdef DEBUG_REEB_NODE -void NodeDegreeDecrement(ReebGraph *rg, ReebNode *node) +void NodeDegreeDecrement(ReebGraph *UNUSED(rg), ReebNode *node) { node->degree--; @@ -452,7 +452,7 @@ void NodeDegreeDecrement(ReebGraph *rg, ReebNode *node) // } } -void NodeDegreeIncrement(ReebGraph *rg, ReebNode *node) +void NodeDegreeIncrement(ReebGraph *UNUSED(rg), ReebNode *node) { // if (node->degree == 0) // { @@ -523,7 +523,7 @@ void verifyNodeDegree(ReebGraph *rg) #endif } -void verifyBucketsArc(ReebGraph *rg, ReebArc *arc) +void verifyBucketsArc(ReebGraph *UNUSED(rg), ReebArc *arc) { ReebNode *head = (ReebNode*)arc->head; ReebNode *tail = (ReebNode*)arc->tail; @@ -1692,7 +1692,7 @@ int filterInternalExternalReebGraph(ReebGraph *rg, float threshold_internal, flo return value; } -int filterCyclesReebGraph(ReebGraph *rg, float distance_threshold) +int filterCyclesReebGraph(ReebGraph *rg, float UNUSED(distance_threshold)) { ReebArc *arc1, *arc2; ReebArc *next2; @@ -1723,7 +1723,7 @@ int filterCyclesReebGraph(ReebGraph *rg, float distance_threshold) return filtered; } -int filterSmartReebGraph(ReebGraph *rg, float threshold) +int filterSmartReebGraph(ReebGraph *UNUSED(rg), float UNUSED(threshold)) { int value = 0; #if 0 //XXX @@ -2180,7 +2180,7 @@ void addFacetoArc(ReebArc *arc, EditFace *efa) BLI_ghash_insert(arc->faces, efa, efa); } -void mergeArcFaces(ReebGraph *rg, ReebArc *aDst, ReebArc *aSrc) +void mergeArcFaces(ReebGraph *UNUSED(rg), ReebArc *aDst, ReebArc *aSrc) { GHashIterator ghi; diff --git a/source/blender/editors/curve/curve_ops.c b/source/blender/editors/curve/curve_ops.c index 4558827c619..80582c7f1b0 100644 --- a/source/blender/editors/curve/curve_ops.c +++ b/source/blender/editors/curve/curve_ops.c @@ -194,6 +194,7 @@ void ED_keymap_curve(wmKeyConfig *keyconf) keymap->poll= ED_operator_editsurfcurve; WM_keymap_add_menu(keymap, "INFO_MT_edit_curve_add", AKEY, KM_PRESS, KM_SHIFT, 0); + WM_keymap_add_menu(keymap, "INFO_MT_curve_handle_type_set", VKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "CURVE_OT_vertex_add", LEFTMOUSE, KM_CLICK, KM_CTRL, 0); WM_keymap_add_item(keymap, "CURVE_OT_select_all", AKEY, KM_PRESS, 0, 0); @@ -214,9 +215,6 @@ void ED_keymap_curve(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "CURVE_OT_tilt_clear", TKEY, KM_PRESS, KM_ALT, 0); WM_keymap_add_item(keymap, "TRANSFORM_OT_tilt", TKEY, KM_PRESS, KM_CTRL, 0); RNA_enum_set(WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, KM_ALT, 0)->ptr, "mode", TFM_CURVE_SHRINKFATTEN); - RNA_enum_set(WM_keymap_add_item(keymap, "CURVE_OT_handle_type_set", HKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "type", 1); - RNA_enum_set(WM_keymap_add_item(keymap, "CURVE_OT_handle_type_set", HKEY, KM_PRESS, 0, 0)->ptr, "type", 3); - RNA_enum_set(WM_keymap_add_item(keymap, "CURVE_OT_handle_type_set", VKEY, KM_PRESS, 0, 0)->ptr, "type", 2); WM_keymap_add_item(keymap, "CURVE_OT_reveal", HKEY, KM_PRESS, KM_ALT, 0); WM_keymap_add_item(keymap, "CURVE_OT_hide", HKEY, KM_PRESS, KM_ALT|KM_CTRL, 0); diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 4c869d25869..97379cc110c 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -1343,7 +1343,7 @@ static void weightflagNurb(ListBase *editnurb, short flag, float w) } } -static int deleteflagNurb(bContext *C, wmOperator *op, int flag) +static int deleteflagNurb(bContext *C, wmOperator *UNUSED(op), int flag) { Object *obedit= CTX_data_edit_object(C); Curve *cu= obedit->data; @@ -1765,7 +1765,7 @@ static void adduplicateflagNurb(Object *obedit, short flag) /**************** switch direction operator ***************/ -static int switch_direction_exec(bContext *C, wmOperator *op) +static int switch_direction_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); Curve *cu= (Curve*)obedit->data; @@ -1902,7 +1902,7 @@ void CURVE_OT_radius_set(wmOperatorType *ot) /********************* smooth operator ********************/ -static int smooth_exec(bContext *C, wmOperator *op) +static int smooth_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); ListBase *editnurb= curve_get_editcurve(obedit); @@ -1974,7 +1974,7 @@ void CURVE_OT_smooth(wmOperatorType *ot) /**************** smooth curve radius operator *************/ /* TODO, make smoothing distance based */ -static int smooth_radius_exec(bContext *C, wmOperator *op) +static int smooth_radius_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); ListBase *editnurb= curve_get_editcurve(obedit); @@ -2265,7 +2265,7 @@ void selectend_nurb(Object *obedit, short selfirst, short doswap, short selstatu } } -static int de_select_first_exec(bContext *C, wmOperator *op) +static int de_select_first_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); @@ -2289,7 +2289,7 @@ void CURVE_OT_de_select_first(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int de_select_last_exec(bContext *C, wmOperator *op) +static int de_select_last_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); @@ -2470,7 +2470,7 @@ void CURVE_OT_hide(wmOperatorType *ot) /********************** reveal operator *********************/ -static int reveal_exec(bContext *C, wmOperator *op) +static int reveal_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); ListBase *editnurb= curve_get_editcurve(obedit); @@ -2527,7 +2527,7 @@ void CURVE_OT_reveal(wmOperatorType *ot) /********************** select invert operator *********************/ -static int select_inverse_exec(bContext *C, wmOperator *op) +static int select_inverse_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); Curve *cu= obedit->data; @@ -4071,7 +4071,7 @@ static int spin_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int spin_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int spin_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Scene *scene = CTX_data_scene(C); View3D *v3d = CTX_wm_view3d(C); @@ -4271,7 +4271,7 @@ void CURVE_OT_vertex_add(wmOperatorType *ot) /***************** extrude operator **********************/ -static int extrude_exec(bContext *C, wmOperator *op) +static int extrude_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); Curve *cu= obedit->data; @@ -4296,7 +4296,7 @@ static int extrude_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int extrude_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int extrude_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if(extrude_exec(C, op) == OPERATOR_FINISHED) { RNA_int_set(op->ptr, "mode", TFM_TRANSLATION); @@ -4406,7 +4406,7 @@ static int toggle_cyclic_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int toggle_cyclic_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int toggle_cyclic_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Object *obedit= CTX_data_edit_object(C); ListBase *editnurb= curve_get_editcurve(obedit); @@ -4531,7 +4531,7 @@ void CURVE_OT_select_linked(wmOperatorType *ot) /***************** select row operator **********************/ -static int select_row_exec(bContext *C, wmOperator *op) +static int select_row_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); Curve *cu= obedit->data; @@ -4606,7 +4606,7 @@ void CURVE_OT_select_row(wmOperatorType *ot) /***************** select next operator **********************/ -static int select_next_exec(bContext *C, wmOperator *op) +static int select_next_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); ListBase *editnurb= curve_get_editcurve(obedit); @@ -4633,7 +4633,7 @@ void CURVE_OT_select_next(wmOperatorType *ot) /***************** select previous operator **********************/ -static int select_previous_exec(bContext *C, wmOperator *op) +static int select_previous_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); ListBase *editnurb= curve_get_editcurve(obedit); @@ -4660,7 +4660,7 @@ void CURVE_OT_select_previous(wmOperatorType *ot) /***************** select more operator **********************/ -static int select_more_exec(bContext *C, wmOperator *op) +static int select_more_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); ListBase *editnurb= curve_get_editcurve(obedit); @@ -4748,7 +4748,7 @@ void CURVE_OT_select_more(wmOperatorType *ot) /******************** select less operator *****************/ /* basic method: deselect if control point doesn't have all neighbours selected */ -static int select_less_exec(bContext *C, wmOperator *op) +static int select_less_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); ListBase *editnurb= curve_get_editcurve(obedit); @@ -5099,7 +5099,7 @@ void CURVE_OT_select_nth(wmOperatorType *ot) /********************** add duplicate operator *********************/ -static int duplicate_exec(bContext *C, wmOperator *op) +static int duplicate_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); @@ -5109,7 +5109,7 @@ static int duplicate_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int duplicate_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int duplicate_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { duplicate_exec(C, op); @@ -5432,7 +5432,7 @@ static int delete_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int delete_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int delete_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Object *obedit= CTX_data_edit_object(C); uiPopupMenu *pup; @@ -5534,7 +5534,7 @@ void CURVE_OT_shade_flat(wmOperatorType *ot) /************** join operator, to be used externally? ****************/ -int join_curve_exec(bContext *C, wmOperator *op) +int join_curve_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); @@ -5620,6 +5620,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newname) Nurb *nu = NULL; BezTriple *bezt; BPoint *bp; + Curve *cu= (Curve*)obedit->data; float vec[3]; float fac, grid; int a, b, cutype, stype; @@ -5641,13 +5642,13 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newname) if (stype!=CU_PRIM_TUBE && stype!=CU_PRIM_DONUT) { nu = (Nurb*)MEM_callocN(sizeof(Nurb), "addNurbprim"); nu->type= cutype; - nu->resolu= 4; - nu->resolv= 4; + nu->resolu= cu->resolu; + nu->resolv= cu->resolv; } switch(stype) { case CU_PRIM_CURVE: /* curve */ - nu->resolu= 12; /* set as 4 above */ + nu->resolu= cu->resolu; if(newname) { rename_id((ID *)obedit, "Curve"); rename_id((ID *)obedit->data, "Curve"); @@ -5724,7 +5725,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newname) nu->pntsv= 1; nu->orderu= 5; nu->flagu= CU_NURB_ENDPOINT; /* endpoint */ - nu->resolu= 8; + nu->resolu= cu->resolu; nu->bp= callocstructN(BPoint, 5, "addNurbprim3"); bp= nu->bp; @@ -5753,7 +5754,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newname) break; case CU_PRIM_CIRCLE: /* circle */ - nu->resolu= 12; /* set as 4 above */ + nu->resolu= cu->resolu; if(newname) { rename_id((ID *)obedit, "CurveCircle"); rename_id((ID *)obedit->data, "CurveCircle"); @@ -5870,7 +5871,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newname) } nu= add_nurbs_primitive(C, mat, CU_NURBS|CU_PRIM_CIRCLE, 0); /* circle */ - nu->resolu= 4; + nu->resolu= cu->resolu; nu->flag= CU_SMOOTH; BLI_addtail(editnurb, nu); /* temporal for extrude and translate */ vec[0]=vec[1]= 0.0; @@ -5913,8 +5914,8 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newname) nu->pntsu= 5; nu->pntsv= 1; nu->orderu= 3; - nu->resolu= 4; - nu->resolv= 4; + nu->resolu= cu->resolu; + nu->resolv= cu->resolv; nu->flag= CU_SMOOTH; nu->bp= callocstructN(BPoint, 5, "addNurbprim6"); nu->flagu= 0; @@ -5962,8 +5963,8 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newname) xzproj= 1; nu= add_nurbs_primitive(C, mat, CU_NURBS|CU_PRIM_CIRCLE, 0); /* circle */ xzproj= 0; - nu->resolu= 4; - nu->resolv= 4; + nu->resolu= cu->resolu; + nu->resolv= cu->resolv; nu->flag= CU_SMOOTH; BLI_addtail(editnurb, nu); /* temporal for spin */ @@ -6308,7 +6309,7 @@ void SURFACE_OT_primitive_nurbs_surface_torus_add(wmOperatorType *ot) /***************** clear tilt operator ********************/ -static int clear_tilt_exec(bContext *C, wmOperator *op) +static int clear_tilt_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); Curve *cu= obedit->data; diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c index ae79c0b0053..44a664b5f30 100644 --- a/source/blender/editors/curve/editfont.c +++ b/source/blender/editors/curve/editfont.c @@ -271,7 +271,7 @@ static void text_update_edited(bContext *C, Scene *scene, Object *obedit, int re /********************** insert lorem operator *********************/ -static int insert_lorem_exec(bContext *C, wmOperator *op) +static int insert_lorem_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); char *p, *p2; @@ -383,7 +383,7 @@ static int paste_file_exec(bContext *C, wmOperator *op) return retval; } -static int paste_file_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int paste_file_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if(RNA_property_is_set(op->ptr, "filepath")) return paste_file_exec(C, op); @@ -414,7 +414,7 @@ void FONT_OT_file_paste(wmOperatorType *ot) /******************* paste buffer operator ********************/ -static int paste_buffer_exec(bContext *C, wmOperator *op) +static int paste_buffer_exec(bContext *C, wmOperator *UNUSED(op)) { char *filename; @@ -714,7 +714,7 @@ static void copy_selection(Object *obedit) } } -static int copy_text_exec(bContext *C, wmOperator *op) +static int copy_text_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); @@ -737,7 +737,7 @@ void FONT_OT_text_copy(wmOperatorType *ot) /******************* cut text operator ********************/ -static int cut_text_exec(bContext *C, wmOperator *op) +static int cut_text_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); @@ -1367,7 +1367,7 @@ static int textbox_poll(bContext *C) return 1; } -static int textbox_add_exec(bContext *C, wmOperator *op) +static int textbox_add_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_active_object(C); Curve *cu= obedit->data; @@ -1585,7 +1585,7 @@ void FONT_OT_case_set(wmOperatorType *ot) /********************** toggle case operator *********************/ -static int toggle_case_exec(bContext *C, wmOperator *op) +static int toggle_case_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); Curve *cu= obedit->data; @@ -1633,7 +1633,7 @@ static void open_init(bContext *C, wmOperator *op) uiIDContextProperty(C, &pprop->ptr, &pprop->prop); } -static int open_cancel(bContext *C, wmOperator *op) +static int open_cancel(bContext *UNUSED(C), wmOperator *op) { MEM_freeN(op->customdata); op->customdata= NULL; @@ -1686,7 +1686,7 @@ static int open_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int open_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Object *ob = CTX_data_active_object(C); Curve *cu; diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c index e6a1f58096a..e19f774412b 100644 --- a/source/blender/editors/gpencil/drawgpencil.c +++ b/source/blender/editors/gpencil/drawgpencil.c @@ -199,7 +199,7 @@ static void gp_draw_stroke_point (bGPDspoint *points, short thickness, short sfl } /* draw a given stroke in 3d (i.e. in 3d-space), using simple ogl lines */ -static void gp_draw_stroke_3d (bGPDspoint *points, int totpoints, short thickness, short dflag, short sflag, short debug, int winx, int winy) +static void gp_draw_stroke_3d (bGPDspoint *points, int totpoints, short thickness, short debug) { bGPDspoint *pt; float oldpressure = 0.0f; @@ -501,7 +501,7 @@ static void gp_draw_strokes (bGPDframe *gpf, int offsx, int offsy, int winx, int if (gps->totpoints == 1) gp_draw_stroke_point(gps->points, lthick, gps->flag, offsx, offsy, winx, winy); else if (dflag & GP_DRAWDATA_ONLY3D) - gp_draw_stroke_3d(gps->points, gps->totpoints, lthick, dflag, gps->flag, debug, winx, winy); + gp_draw_stroke_3d(gps->points, gps->totpoints, lthick, debug); else if (gps->totpoints > 1) gp_draw_stroke(gps->points, gps->totpoints, lthick, dflag, gps->flag, debug, offsx, offsy, winx, winy); } diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index 083a90efb25..75156571cf4 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -662,7 +662,7 @@ static short gp_stroke_eraser_splitdel (bGPDframe *gpf, bGPDstroke *gps, int i) } /* eraser tool - check if part of stroke occurs within last segment drawn by eraser */ -static short gp_stroke_eraser_strokeinside (int mval[], int mvalo[], short rad, short x0, short y0, short x1, short y1) +static short gp_stroke_eraser_strokeinside (int mval[], int UNUSED(mvalo[]), short rad, short x0, short y0, short x1, short y1) { /* simple within-radius check for now */ if (edge_inside_circle(mval[0], mval[1], rad, x0, y0, x1, y1)) @@ -1250,7 +1250,7 @@ static int gpencil_draw_cancel (bContext *C, wmOperator *op) /* ------------------------------- */ /* create a new stroke point at the point indicated by the painting context */ -static void gpencil_draw_apply (bContext *C, wmOperator *op, tGPsdata *p) +static void gpencil_draw_apply (wmOperator *op, tGPsdata *p) { /* handle drawing/erasing -> test for erasing first */ if (p->paintmode == GP_PAINTMODE_ERASER) { @@ -1294,7 +1294,7 @@ static void gpencil_draw_apply (bContext *C, wmOperator *op, tGPsdata *p) } /* handle draw event */ -static void gpencil_draw_apply_event (bContext *C, wmOperator *op, wmEvent *event) +static void gpencil_draw_apply_event (wmOperator *op, wmEvent *event) { tGPsdata *p= op->customdata; ARegion *ar= p->ar; @@ -1343,7 +1343,7 @@ static void gpencil_draw_apply_event (bContext *C, wmOperator *op, wmEvent *even RNA_float_set(&itemptr, "pressure", p->pressure); /* apply the current latest drawing point */ - gpencil_draw_apply(C, op, p); + gpencil_draw_apply(op, p); /* force refresh */ ED_region_tag_redraw(p->ar); /* just active area for now, since doing whole screen is too slow */ @@ -1394,7 +1394,7 @@ static int gpencil_draw_exec (bContext *C, wmOperator *op) } /* apply this data as necessary now (as per usual) */ - gpencil_draw_apply(C, op, p); + gpencil_draw_apply(op, p); } RNA_END; @@ -1456,7 +1456,7 @@ static int gpencil_draw_invoke (bContext *C, wmOperator *op, wmEvent *event) p->status= GP_STATUS_PAINTING; /* handle the initial drawing - i.e. for just doing a simple dot */ - gpencil_draw_apply_event(C, op, event); + gpencil_draw_apply_event(op, event); } else { /* toolbar invoked - don't start drawing yet... */ @@ -1516,7 +1516,7 @@ static int gpencil_draw_modal (bContext *C, wmOperator *op, wmEvent *event) if (p->status == GP_STATUS_PAINTING) { /* handle drawing event */ //printf("\t\tGP - add point\n"); - gpencil_draw_apply_event(C, op, event); + gpencil_draw_apply_event(op, event); /* finish painting operation if anything went wrong just now */ if (p->status == GP_STATUS_ERROR) { diff --git a/source/blender/editors/include/ED_armature.h b/source/blender/editors/include/ED_armature.h index 809b86d65f3..32fe10783a7 100644 --- a/source/blender/editors/include/ED_armature.h +++ b/source/blender/editors/include/ED_armature.h @@ -42,6 +42,7 @@ struct ListBase; struct MeshDeformModifierData; struct Object; struct RegionView3D; +struct ReportList; struct Scene; struct SK_Sketch; struct View3D; @@ -132,7 +133,7 @@ void ED_armature_apply_transform(struct Object *ob, float mat[4][4]); #define ARM_GROUPS_ENVELOPE 2 #define ARM_GROUPS_AUTO 3 -void create_vgroups_from_armature(struct Scene *scene, struct Object *ob, struct Object *par, int mode, int mirror); +void create_vgroups_from_armature(struct ReportList *reports, struct Scene *scene, struct Object *ob, struct Object *par, int mode, int mirror); void auto_align_armature(struct Scene *scene, struct View3D *v3d, short mode); void unique_editbone_name(struct ListBase *ebones, char *name, EditBone *bone); /* if bone is already in list, pass it as param to ignore it */ @@ -146,7 +147,7 @@ void ED_armature_exit_posemode(struct bContext *C, struct Base *base); void ED_armature_enter_posemode(struct bContext *C, struct Base *base); int ED_pose_channel_in_IK_chain(struct Object *ob, struct bPoseChannel *pchan); void ED_pose_deselectall(struct Object *ob, int test); -void ED_pose_recalculate_paths(struct bContext *C, struct Scene *scene, struct Object *ob); +void ED_pose_recalculate_paths(struct Scene *scene, struct Object *ob); /* sketch */ diff --git a/source/blender/editors/include/ED_keyframes_draw.h b/source/blender/editors/include/ED_keyframes_draw.h index 78a645d6b50..ec74ea6123b 100644 --- a/source/blender/editors/include/ED_keyframes_draw.h +++ b/source/blender/editors/include/ED_keyframes_draw.h @@ -136,7 +136,7 @@ void scene_to_keylist(struct bDopeSheet *ads, struct Scene *sce, struct DLRBT_Tr void summary_to_keylist(struct bAnimContext *ac, struct DLRBT_Tree *keys, struct DLRBT_Tree *blocks); /* Grease Pencil Layer */ // XXX not restored -void gpl_to_keylist(struct bDopeSheet *ads, struct bGPDlayer *gpl, struct DLRBT_Tree *keys, struct DLRBT_Tree *blocks); +void gpl_to_keylist(struct bDopeSheet *ads, struct bGPDlayer *gpl, struct DLRBT_Tree *keys); /* ActKeyColumn API ---------------- */ /* Comparator callback used for ActKeyColumns and cframe float-value pointer */ diff --git a/source/blender/editors/include/ED_keyframing.h b/source/blender/editors/include/ED_keyframing.h index b3aac489852..2650005a489 100644 --- a/source/blender/editors/include/ED_keyframing.h +++ b/source/blender/editors/include/ED_keyframing.h @@ -183,7 +183,7 @@ struct KeyingSet *ANIM_builtin_keyingset_get_named(struct KeyingSet *prevKS, con KeyingSetInfo *ANIM_keyingset_info_find_named(const char name[]); /* for RNA type registrations... */ -void ANIM_keyingset_info_register(const struct bContext *C, KeyingSetInfo *ksi); +void ANIM_keyingset_info_register(KeyingSetInfo *ksi); void ANIM_keyingset_info_unregister(const struct bContext *C, KeyingSetInfo *ksi); /* cleanup on exit */ diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h index c4477ee5a8e..22779fbba0b 100644 --- a/source/blender/editors/include/ED_mesh.h +++ b/source/blender/editors/include/ED_mesh.h @@ -159,6 +159,8 @@ void EM_solidify(struct EditMesh *em, float dist); int EM_deselect_nth(struct EditMesh *em, int nth); +void EM_project_snap_verts(struct bContext *C, struct ARegion *ar, struct Object *obedit, struct EditMesh *em); + /* editmesh_mods.c */ extern unsigned int em_vertoffs, em_solidoffs, em_wireoffs; @@ -223,7 +225,7 @@ void ED_mesh_calc_normals(struct Mesh *me); void ED_mesh_material_link(struct Mesh *me, struct Material *ma); void ED_mesh_update(struct Mesh *mesh, struct bContext *C, int calc_edges); -int ED_mesh_uv_texture_add(struct bContext *C, struct Scene *scene, struct Object *ob, struct Mesh *me, const char *name, int active_set); +int ED_mesh_uv_texture_add(struct bContext *C, struct Mesh *me, const char *name, int active_set); int ED_mesh_uv_texture_remove(struct bContext *C, struct Object *ob, struct Mesh *me); int ED_mesh_color_add(struct bContext *C, struct Scene *scene, struct Object *ob, struct Mesh *me, const char *name, int active_set); int ED_mesh_color_remove(struct bContext *C, struct Object *ob, struct Mesh *me); diff --git a/source/blender/editors/include/ED_node.h b/source/blender/editors/include/ED_node.h index 6e42b772bef..d287066828f 100644 --- a/source/blender/editors/include/ED_node.h +++ b/source/blender/editors/include/ED_node.h @@ -40,7 +40,7 @@ void ED_init_node_butfuncs(void); /* node_draw.c */ void ED_node_changed_update(struct ID *id, struct bNode *node); -void ED_node_generic_update(struct Main *bmain, struct Scene *scene, struct bNodeTree *ntree, struct bNode *node); +void ED_node_generic_update(struct Main *bmain, struct bNodeTree *ntree, struct bNode *node); /* node_edit.c */ void ED_node_shader_default(struct Material *ma); diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h index 64e72a5e2fa..63af7c5abd3 100644 --- a/source/blender/editors/include/ED_object.h +++ b/source/blender/editors/include/ED_object.h @@ -109,7 +109,7 @@ int object_is_libdata(struct Object *ob); int object_data_is_libdata(struct Object *ob); /* object motion paths */ -void ED_objects_clear_paths(struct bContext *C, struct Scene *scene); +void ED_objects_clear_paths(struct bContext *C); void ED_objects_recalculate_paths(struct bContext *C, struct Scene *scene); /* constraints */ diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h index 7059e607218..62243a0e53e 100644 --- a/source/blender/editors/include/ED_screen.h +++ b/source/blender/editors/include/ED_screen.h @@ -69,7 +69,7 @@ void ED_spacetypes_keymap(struct wmKeyConfig *keyconf); int ED_area_header_switchbutton(const struct bContext *C, struct uiBlock *block, int yco); int ED_area_header_standardbuttons(const struct bContext *C, struct uiBlock *block, int yco); void ED_area_overdraw(struct bContext *C); -void ED_area_overdraw_flush(struct bContext *C, struct ScrArea *sa, struct ARegion *ar); +void ED_area_overdraw_flush(struct ScrArea *sa, struct ARegion *ar); /* areas */ diff --git a/source/blender/editors/include/ED_screen_types.h b/source/blender/editors/include/ED_screen_types.h index c5abd5465d7..18d6a1a48cc 100644 --- a/source/blender/editors/include/ED_screen_types.h +++ b/source/blender/editors/include/ED_screen_types.h @@ -38,6 +38,7 @@ typedef struct ScreenAnimData { short refresh; short flag; /* flags for playback */ int sfra; /* frame that playback was started from */ + int nextfra; /* next frame to go to (when ANIMPLAY_FLAG_USE_NEXT_FRAME is set) */ } ScreenAnimData; /* for animplayer */ @@ -50,6 +51,8 @@ enum { ANIMPLAY_FLAG_SYNC = (1<<2), /* don't drop frames (and ignore SCE_FRAME_DROP flag) */ ANIMPLAY_FLAG_NO_SYNC = (1<<3), + /* use nextfra at next timer update */ + ANIMPLAY_FLAG_USE_NEXT_FRAME, }; /* ----------------------------------------------------- */ diff --git a/source/blender/editors/include/ED_types.h b/source/blender/editors/include/ED_types.h index 96a5d5857fa..1887a97e635 100644 --- a/source/blender/editors/include/ED_types.h +++ b/source/blender/editors/include/ED_types.h @@ -35,11 +35,6 @@ #define SELECT 1 #define ACTIVE 2 -/* nonstandard define, sometimes in math.h */ -#ifndef MAXFLOAT -#define MAXFLOAT ((float)3.40282347e+38) -#endif - /* buttons */ #define XIC 20 #define YIC 20 diff --git a/source/blender/editors/include/ED_uvedit.h b/source/blender/editors/include/ED_uvedit.h index 1710a8439d1..737d124b494 100644 --- a/source/blender/editors/include/ED_uvedit.h +++ b/source/blender/editors/include/ED_uvedit.h @@ -41,7 +41,6 @@ void ED_operatortypes_uvedit(void); void ED_keymap_uvedit(struct wmKeyConfig *keyconf); void ED_uvedit_assign_image(struct Scene *scene, struct Object *obedit, struct Image *ima, struct Image *previma); -void ED_uvedit_set_tile(struct bContext *C, struct Scene *scene, struct Object *obedit, struct Image *ima, int curtile, int dotile); int ED_uvedit_minmax(struct Scene *scene, struct Image *ima, struct Object *obedit, float *min, float *max); int ED_uvedit_test_silent(struct Object *obedit); diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 4689153c9f5..2a1527b670d 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -492,7 +492,7 @@ uiBut *uiDefSearchBut(uiBlock *block, void *arg, int retval, int icon, int maxle void uiBlockPickerButtons(struct uiBlock *block, float *col, float *hsv, float *old, char *hexcol, char mode, short retval); uiBut *uiDefAutoButR(uiBlock *block, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, char *name, int icon, int x1, int y1, int x2, int y2); -void uiDefAutoButsRNA(const struct bContext *C, uiLayout *layout, struct PointerRNA *ptr, int columns); +void uiDefAutoButsRNA(uiLayout *layout, struct PointerRNA *ptr, int columns); /* Links * @@ -680,17 +680,17 @@ void uiTemplateIDBrowse(uiLayout *layout, struct bContext *C, struct PointerRNA char *newop, char *openop, char *unlinkop); void uiTemplateIDPreview(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, char *propname, char *newop, char *openop, char *unlinkop, int rows, int cols); -void uiTemplateAnyID(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, char *propname, +void uiTemplateAnyID(uiLayout *layout, struct PointerRNA *ptr, char *propname, char *proptypename, char *text); -void uiTemplatePathBuilder(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, char *propname, +void uiTemplatePathBuilder(uiLayout *layout, struct PointerRNA *ptr, char *propname, struct PointerRNA *root_ptr, char *text); uiLayout *uiTemplateModifier(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr); uiLayout *uiTemplateConstraint(uiLayout *layout, struct PointerRNA *ptr); void uiTemplatePreview(uiLayout *layout, struct ID *id, struct ID *parent, struct MTex *slot); void uiTemplateColorRamp(uiLayout *layout, struct PointerRNA *ptr, char *propname, int expand); -void uiTemplateHistogram(uiLayout *layout, struct PointerRNA *ptr, char *propname, int expand); -void uiTemplateWaveform(uiLayout *layout, struct PointerRNA *ptr, char *propname, int expand); -void uiTemplateVectorscope(uiLayout *layout, struct PointerRNA *ptr, char *propname, int expand); +void uiTemplateHistogram(uiLayout *layout, struct PointerRNA *ptr, char *propname); +void uiTemplateWaveform(uiLayout *layout, struct PointerRNA *ptr, char *propname); +void uiTemplateVectorscope(uiLayout *layout, struct PointerRNA *ptr, char *propname); void uiTemplateCurveMapping(uiLayout *layout, struct PointerRNA *ptr, char *propname, int type, int levels, int brush); void uiTemplateColorWheel(uiLayout *layout, struct PointerRNA *ptr, char *propname, int value_slider, int lock, int lock_luminosity, int cubic); void uiTemplateLayers(uiLayout *layout, struct PointerRNA *ptr, char *propname, diff --git a/source/blender/editors/include/UI_view2d.h b/source/blender/editors/include/UI_view2d.h index bf4a3de9cc6..9afa7dd012a 100644 --- a/source/blender/editors/include/UI_view2d.h +++ b/source/blender/editors/include/UI_view2d.h @@ -156,14 +156,14 @@ void UI_view2d_totRect_set_resize(struct View2D *v2d, int width, int height, int int UI_view2d_tab_set(struct View2D *v2d, int tab); /* view matrix operations */ -void UI_view2d_view_ortho(const struct bContext *C, struct View2D *v2d); -void UI_view2d_view_orthoSpecial(const struct bContext *C, struct View2D *v2d, short xaxis); +void UI_view2d_view_ortho(struct View2D *v2d); +void UI_view2d_view_orthoSpecial(struct ARegion *ar, struct View2D *v2d, short xaxis); void UI_view2d_view_restore(const struct bContext *C); /* grid drawing */ -View2DGrid *UI_view2d_grid_calc(const struct bContext *C, struct View2D *v2d, short xunits, short xclamp, short yunits, short yclamp, int winx, int winy); -void UI_view2d_grid_draw(const struct bContext *C, struct View2D *v2d, View2DGrid *grid, int flag); -void UI_view2d_constant_grid_draw(const struct bContext *C, struct View2D *v2d); +View2DGrid *UI_view2d_grid_calc(struct Scene *scene, struct View2D *v2d, short xunits, short xclamp, short yunits, short yclamp, int winx, int winy); +void UI_view2d_grid_draw(struct View2D *v2d, View2DGrid *grid, int flag); +void UI_view2d_constant_grid_draw(struct View2D *v2d); void UI_view2d_grid_size(View2DGrid *grid, float *r_dx, float *r_dy); void UI_view2d_grid_free(View2DGrid *grid); diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index f4866237f46..f65b10eaaea 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -67,7 +67,7 @@ #define MENU_SEP_HEIGHT 6 /* - * a full doc with API notes can be found in bf-blender/blender/doc/interface_API.txt + * a full doc with API notes can be found in bf-blender/trunk/blender/doc/guides/interface_API.txt * * uiBlahBlah() external function * ui_blah_blah() internal function @@ -441,7 +441,7 @@ void uiCenteredBoundsBlock(uiBlock *block, int addval) /* link line drawing is not part of buttons or theme.. so we stick with it here */ -static void ui_draw_linkline(uiBut *but, uiLinkLine *line) +static void ui_draw_linkline(uiLinkLine *line) { rcti rect; @@ -470,7 +470,7 @@ static void ui_draw_links(uiBlock *block) if(but->type==LINK && but->link) { line= but->link->lines.first; while(line) { - ui_draw_linkline(but, line); + ui_draw_linkline(line); line= line->next; } } @@ -748,7 +748,7 @@ void uiDrawBlock(const bContext *C, uiBlock *block) if(block->flag & UI_BLOCK_LOOP) ui_draw_menu_back(&style, block, &rect); else if(block->panel) - ui_draw_aligned_panel(ar, &style, block, &rect); + ui_draw_aligned_panel(&style, block, &rect); /* widgets */ for(but= block->buttons.first; but; but= but->next) { @@ -835,7 +835,7 @@ static void ui_is_but_sel(uiBut *but) /* XXX 2.50 no links supported yet */ -static int uibut_contains_pt(uiBut *but, short *mval) +static int uibut_contains_pt(uiBut *UNUSED(but), short *UNUSED(mval)) { return 0; @@ -1093,12 +1093,12 @@ static void ui_do_active_linklines(uiBlock *block, short *mval) if(line==act) { if((line->flag & UI_SELECT)==0) { line->flag |= UI_SELECT; - ui_draw_linkline(but, line); + ui_draw_linkline(line); } } else if(line->flag & UI_SELECT) { line->flag &= ~UI_SELECT; - ui_draw_linkline(but, line); + ui_draw_linkline(line); } line= line->next; } @@ -2136,11 +2136,6 @@ void ui_check_but(uiBut *but) case HSVCUBE: case HSVCIRCLE: - { - float rgb[3]; - ui_get_but_vectorf(but, rgb); - rgb_to_hsv(rgb[0], rgb[1], rgb[2], but->hsv, but->hsv+1, but->hsv+2); - } break; default: strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR); @@ -2187,7 +2182,7 @@ int ui_but_can_align(uiBut *but) return !ELEM3(but->type, LABEL, OPTION, OPTIONN); } -static void ui_block_do_align_but(uiBlock *block, uiBut *first, int nr) +static void ui_block_do_align_but(uiBut *first, int nr) { uiBut *prev, *but=NULL, *next; int flag= 0, cols=0, rows=0; @@ -2321,7 +2316,7 @@ void ui_block_do_align(uiBlock *block) for(but=block->buttons.first; but;) { if(but->alignnr) { nr= but->alignnr; - ui_block_do_align_but(block, but, nr); + ui_block_do_align_but(but, nr); /* skip with same number */ for(; but && but->alignnr == nr; but=but->next); diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index cf6970dc59f..81b04fea062 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -460,7 +460,7 @@ void uiEmboss(float x1, float y1, float x2, float y2, int sel) /* ************** SPECIAL BUTTON DRAWING FUNCTIONS ************* */ -void ui_draw_but_IMAGE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect) +void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *UNUSED(but), uiWidgetColors *UNUSED(wcol), rcti *rect) { extern char datatoc_splash_png[]; extern int datatoc_splash_png_size; @@ -564,7 +564,7 @@ static void ui_draw_but_CHARTAB(uiBut *but) int err; strcpy(tmpStr, G.selfont->name); - BLI_path_abs(tmpStr, G.sce); + BLI_path_abs(tmpStr, G.main->name); err = FTF_SetFont((unsigned char *)tmpStr, 0, 14.0); } } @@ -747,7 +747,7 @@ void histogram_draw_one(float r, float g, float b, float alpha, float x, float y glDisable(GL_LINE_SMOOTH); } -void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *recti) +void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *recti) { Histogram *hist = (Histogram *)but->poin; int res = hist->x_resolution; @@ -800,7 +800,7 @@ void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti * draw_scope_end(&rect, scissor); } -void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *recti) +void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *recti) { Scopes *scopes = (Scopes *)but->poin; rctf rect; @@ -1023,7 +1023,7 @@ void vectorscope_draw_target(float centerx, float centery, float diam, float r, glEnd(); } -void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *recti) +void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *recti) { Scopes *scopes = (Scopes *)but->poin; rctf rect; @@ -1105,7 +1105,7 @@ void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti glDisable(GL_BLEND); } -void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *wcol, rcti *rect) +void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *rect) { ColorBand *coba; CBData *cbd; @@ -1404,7 +1404,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect if (but->a1 != -1) { if (but->a1 == UI_GRAD_H) { rcti grid; - float col[3]; + float col[3]= {0.0f, 0.0f, 0.0f}; /* dummy arg */ grid.xmin = rect->xmin + zoomx*(-offsx); grid.xmax = rect->xmax + zoomx*(-offsx); diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 6d8c368db3f..ab8fda85ff2 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -429,7 +429,7 @@ static void ui_apply_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data data->applied= 1; } -static void ui_apply_but_TOG(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data) +static void ui_apply_but_TOG(bContext *C, uiBut *but, uiHandleButtonData *data) { double value; int w, lvalue, push; @@ -896,7 +896,7 @@ static void ui_apply_button(bContext *C, uiBlock *block, uiBut *but, uiHandleBut case BUT_TOGDUAL: case OPTION: case OPTIONN: - ui_apply_but_TOG(C, block, but, data); + ui_apply_but_TOG(C, but, data); break; case ROW: case LISTROW: @@ -2830,17 +2830,18 @@ static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, wm } else if(but->type==COL) { if( ELEM(event->type, WHEELDOWNMOUSE, WHEELUPMOUSE) && event->alt) { + float *hsv= ui_block_hsv_get(but->block); float col[3]; ui_get_but_vectorf(but, col); - rgb_to_hsv(col[0], col[1], col[2], but->hsv, but->hsv+1, but->hsv+2); + rgb_to_hsv_compat(col[0], col[1], col[2], hsv, hsv+1, hsv+2); if(event->type==WHEELDOWNMOUSE) - but->hsv[2]= CLAMPIS(but->hsv[2]-0.05f, 0.0f, 1.0f); + hsv[2]= CLAMPIS(hsv[2]-0.05f, 0.0f, 1.0f); else - but->hsv[2]= CLAMPIS(but->hsv[2]+0.05f, 0.0f, 1.0f); + hsv[2]= CLAMPIS(hsv[2]+0.05f, 0.0f, 1.0f); - hsv_to_rgb(but->hsv[0], but->hsv[1], but->hsv[2], data->vec, data->vec+1, data->vec+2); + hsv_to_rgb(hsv[0], hsv[1], hsv[2], data->vec, data->vec+1, data->vec+2); ui_set_but_vectorf(but, data->vec); button_activate_state(C, but, BUTTON_STATE_EXIT); @@ -2970,7 +2971,8 @@ static int ui_do_but_NORMAL(bContext *C, uiBlock *block, uiBut *but, uiHandleBut static int ui_numedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, int mx, int my) { - float rgb[3], hsv[3]; + float rgb[3]; + float *hsv= ui_block_hsv_get(but->block); float x, y; int changed= 1; int color_profile = but->block->color_profile; @@ -2979,10 +2981,11 @@ static int ui_numedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, int mx, if (RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA) color_profile = BLI_PR_NONE; } - + ui_get_but_vectorf(but, rgb); - rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); - + + rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); + /* relative position within box */ x= ((float)mx-but->x1)/(but->x2-but->x1); y= ((float)my-but->y1)/(but->y2-but->y1); @@ -3059,21 +3062,22 @@ static int ui_do_but_HSVCUBE(bContext *C, uiBlock *block, uiBut *but, uiHandleBu } else if (event->type == ZEROKEY && event->val == KM_PRESS) { if (but->a1==9){ - float rgb[3], hsv[3], def_hsv[3]; - float *def; int len; /* reset only value */ len= RNA_property_array_length(&but->rnapoin, but->rnaprop); if (len >= 3) { + float rgb[3], def_hsv[3]; + float *def; + float *hsv= ui_block_hsv_get(but->block); def= MEM_callocN(sizeof(float)*len, "reset_defaults - float"); RNA_property_float_get_default_array(&but->rnapoin, but->rnaprop, def); rgb_to_hsv(def[0], def[1], def[2], def_hsv, def_hsv+1, def_hsv+2); ui_get_but_vectorf(but, rgb); - rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); + rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); hsv_to_rgb(hsv[0], hsv[1], def_hsv[2], rgb, rgb+1, rgb+2); ui_set_but_vectorf(but, rgb); @@ -3111,13 +3115,15 @@ static int ui_numedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data, int mx { rcti rect; int changed= 1; - float rgb[3], hsv[3]; + float rgb[3]; + float hsv[3]; rect.xmin= but->x1; rect.xmax= but->x2; rect.ymin= but->y1; rect.ymax= but->y2; ui_get_but_vectorf(but, rgb); - rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); + copy_v3_v3(hsv, ui_block_hsv_get(but->block)); + rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); /* exception, when using color wheel in 'locked' value state: * allow choosing a hue for black values, by giving a tiny increment */ @@ -3176,21 +3182,22 @@ static int ui_do_but_HSVCIRCLE(bContext *C, uiBlock *block, uiBut *but, uiHandle return WM_UI_HANDLER_BREAK; } else if (event->type == ZEROKEY && event->val == KM_PRESS) { - float rgb[3], hsv[3], def_hsv[3]; - float *def; int len; /* reset only saturation */ len= RNA_property_array_length(&but->rnapoin, but->rnaprop); if (len >= 3) { + float rgb[3], def_hsv[3]; + float *def; + float *hsv= ui_block_hsv_get(but->block); def= MEM_callocN(sizeof(float)*len, "reset_defaults - float"); RNA_property_float_get_default_array(&but->rnapoin, but->rnaprop, def); rgb_to_hsv(def[0], def[1], def[2], def_hsv, def_hsv+1, def_hsv+2); ui_get_but_vectorf(but, rgb); - rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); + rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); hsv_to_rgb(hsv[0], def_hsv[1], hsv[2], rgb, rgb+1, rgb+2); ui_set_but_vectorf(but, rgb); @@ -3210,12 +3217,14 @@ static int ui_do_but_HSVCIRCLE(bContext *C, uiBlock *block, uiBut *but, uiHandle } /* XXX hardcoded keymap check.... */ else if(event->type == WHEELDOWNMOUSE) { - but->hsv[2]= CLAMPIS(but->hsv[2]-0.05f, 0.0f, 1.0f); + float *hsv= ui_block_hsv_get(but->block); + hsv[2]= CLAMPIS(hsv[2]-0.05f, 0.0f, 1.0f); ui_set_but_hsv(but); // converts to rgb ui_numedit_apply(C, block, but, data); } else if(event->type == WHEELUPMOUSE) { - but->hsv[2]= CLAMPIS(but->hsv[2]+0.05f, 0.0f, 1.0f); + float *hsv= ui_block_hsv_get(but->block); + hsv[2]= CLAMPIS(hsv[2]+0.05f, 0.0f, 1.0f); ui_set_but_hsv(but); // converts to rgb ui_numedit_apply(C, block, but, data); } @@ -3558,7 +3567,7 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt return WM_UI_HANDLER_CONTINUE; } -static int in_scope_resize_zone(uiBut *but, int x, int y) +static int in_scope_resize_zone(uiBut *but, int UNUSED(x), int y) { // bottom corner return (x > but->x2 - SCOPE_RESIZE_PAD) && (y < but->y1 + SCOPE_RESIZE_PAD); return (y < but->y1 + SCOPE_RESIZE_PAD); @@ -3797,7 +3806,7 @@ static int ui_do_but_VECTORSCOPE(bContext *C, uiBlock *block, uiBut *but, uiHand } #ifdef INTERNATIONAL -static int ui_do_but_CHARTAB(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, wmEvent *event) +static int ui_do_but_CHARTAB(bContext *UNUSED(C), uiBlock *UNUSED(block), uiBut *UNUSED(but), uiHandleButtonData *UNUSED(data), wmEvent *UNUSED(event)) { /* XXX 2.50 bad global and state access */ #if 0 @@ -3935,18 +3944,19 @@ static int ui_do_but_LINK(bContext *C, uiBut *but, uiHandleButtonData *data, wmE return WM_UI_HANDLER_CONTINUE; } -static void but_shortcut_name_func(bContext *C, void *arg1, int event) +static void but_shortcut_name_func(bContext *C, void *arg1, int UNUSED(event)) { uiBut *but = (uiBut *)arg1; - - char buf[512], *butstr, *cpoin; - + if (but->optype) { + char buf[512], *butstr, *cpoin; + IDProperty *prop= (but->opptr)? but->opptr->data: NULL; /* complex code to change name of button */ if(WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, buf, sizeof(buf))) { - + wmKeyMap *km= NULL; + butstr= MEM_mallocN(strlen(but->str)+strlen(buf)+2, "menu_block_set_keymaps"); // XXX but->str changed... should not, remove the hotkey from it @@ -3962,6 +3972,11 @@ static void but_shortcut_name_func(bContext *C, void *arg1, int event) MEM_freeN(butstr); ui_check_but(but); + + /* set the keymap editable else the key wont save */ + WM_key_event_operator_id(C, but->optype->idname, but->opcontext, prop, 1, &km); + WM_keymap_copy_to_user(km); + } else { /* shortcut was removed */ cpoin= strchr(but->str, '|'); @@ -4024,7 +4039,7 @@ static uiBlock *menu_add_shortcut(bContext *C, ARegion *ar, void *arg) uiBlockSetHandleFunc(block, but_shortcut_name_func, but); uiBlockSetFlag(block, UI_BLOCK_RET_1); uiBlockSetDirection(block, UI_CENTER); - + layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, 200, 20, style); uiItemR(layout, &ptr, "type", UI_ITEM_R_FULL_EVENT|UI_ITEM_R_IMMEDIATE, "", 0); @@ -4035,14 +4050,14 @@ static uiBlock *menu_add_shortcut(bContext *C, ARegion *ar, void *arg) return block; } -static void popup_change_shortcut_func(bContext *C, void *arg1, void *arg2) +static void popup_change_shortcut_func(bContext *C, void *arg1, void *UNUSED(arg2)) { uiBut *but = (uiBut *)arg1; button_timers_tooltip_remove(C, but); uiPupBlock(C, menu_change_shortcut, but); } -static void remove_shortcut_func(bContext *C, void *arg1, void *arg2) +static void remove_shortcut_func(bContext *C, void *arg1, void *UNUSED(arg2)) { uiBut *but = (uiBut *)arg1; wmKeyMap *km; @@ -4056,7 +4071,7 @@ static void remove_shortcut_func(bContext *C, void *arg1, void *arg2) but_shortcut_name_func(C, but, 0); } -static void popup_add_shortcut_func(bContext *C, void *arg1, void *arg2) +static void popup_add_shortcut_func(bContext *C, void *arg1, void *UNUSED(arg2)) { uiBut *but = (uiBut *)arg1; button_timers_tooltip_remove(C, but); @@ -4266,7 +4281,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event) if(but->flag & UI_BUT_DISABLED) return WM_UI_HANDLER_CONTINUE; - if(data->state == BUTTON_STATE_HIGHLIGHT) { + if(data->state == BUTTON_STATE_HIGHLIGHT && event->prevval != KM_PRESS) { /* check prevval because of modal operators [#24016] */ /* handle copy-paste */ if(ELEM(event->type, CKEY, VKEY) && event->val==KM_PRESS && (event->ctrl || event->oskey)) { ui_but_copy_paste(C, but, data, (event->type == CKEY)? 'c': 'v'); @@ -4564,7 +4579,7 @@ static int ui_mouse_inside_button(ARegion *ar, uiBut *but, int x, int y) return 1; } -static uiBut *ui_but_find_mouse_over(wmWindow *win, ARegion *ar, int x, int y) +static uiBut *ui_but_find_mouse_over(ARegion *ar, int x, int y) { uiBlock *block; uiBut *but, *butover= NULL; @@ -4596,7 +4611,7 @@ static uiBut *ui_but_find_mouse_over(wmWindow *win, ARegion *ar, int x, int y) return butover; } -static uiBut *ui_list_find_mouse_over(wmWindow *win, ARegion *ar, int x, int y) +static uiBut *ui_list_find_mouse_over(ARegion *ar, int x, int y) { uiBlock *block; uiBut *but; @@ -5017,11 +5032,10 @@ static uiBut *uit_but_find_open_event(ARegion *ar, wmEvent *event) static int ui_handle_button_over(bContext *C, wmEvent *event, ARegion *ar) { - wmWindow *win= CTX_wm_window(C); uiBut *but; if(event->type == MOUSEMOVE) { - but= ui_but_find_mouse_over(win, ar, event->x, event->y); + but= ui_but_find_mouse_over(ar, event->x, event->y); if(but) button_activate_init(C, ar, but, BUTTON_ACTIVATE_OVER); } @@ -5099,7 +5113,7 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but) data->cancel= 1; button_activate_state(C, but, BUTTON_STATE_EXIT); } - else if(ui_but_find_mouse_over(data->window, ar, event->x, event->y) != but) { + else if(ui_but_find_mouse_over(ar, event->x, event->y) != but) { data->cancel= 1; button_activate_state(C, but, BUTTON_STATE_EXIT); } @@ -5197,7 +5211,7 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but) else if(data->state == BUTTON_STATE_MENU_OPEN) { switch(event->type) { case MOUSEMOVE: { - uiBut *bt= ui_but_find_mouse_over(data->window, ar, event->x, event->y); + uiBut *bt= ui_but_find_mouse_over(ar, event->x, event->y); if(bt && bt->active != data) { if(but->type != COL) /* exception */ @@ -5232,8 +5246,7 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but) static int ui_handle_list_event(bContext *C, wmEvent *event, ARegion *ar) { - wmWindow *win= CTX_wm_window(C); - uiBut *but= ui_list_find_mouse_over(win, ar, event->x, event->y); + uiBut *but= ui_list_find_mouse_over(ar, event->x, event->y); int retval= WM_UI_HANDLER_CONTINUE; int value, min, max; @@ -5420,7 +5433,7 @@ static int ui_mouse_motion_towards_check(uiBlock *block, uiPopupBlockHandle *men return menu->dotowards; } -int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle *menu, int topmenu) +int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle *menu, int UNUSED(topmenu)) { ARegion *ar; uiBlock *block; @@ -5526,16 +5539,20 @@ int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle *menu, ((ELEM(event->type, UPARROWKEY, WHEELUPMOUSE)) && (block->direction & UI_RIGHT)) || ((ELEM(event->type, DOWNARROWKEY, WHEELDOWNMOUSE)) && (block->direction & UI_TOP)) ) { - if(ui_but_first(block)->type & BUT) + if((bt= ui_but_first(block)) && (bt->type & BUT)) { bt= ui_but_last(block); - else - bt= ui_but_first(block); + } + else { + /* keep ui_but_first() */ + } } else { - if(ui_but_first(block)->type & BUT) - bt= ui_but_first(block); - else + if((bt= ui_but_first(block)) && (bt->type & BUT)) { + /* keep ui_but_first() */ + } + else { bt= ui_but_last(block); + } } if(bt) @@ -5780,7 +5797,7 @@ static int ui_handle_menus_recursive(bContext *C, wmEvent *event, uiPopupBlockHa /* *************** UI event handlers **************** */ -static int ui_handler_region(bContext *C, wmEvent *event, void *userdata) +static int ui_handler_region(bContext *C, wmEvent *event, void *UNUSED(userdata)) { ARegion *ar; uiBut *but; @@ -5818,7 +5835,7 @@ static int ui_handler_region(bContext *C, wmEvent *event, void *userdata) return retval; } -static void ui_handler_remove_region(bContext *C, void *userdata) +static void ui_handler_remove_region(bContext *C, void *UNUSED(userdata)) { bScreen *sc; ARegion *ar; @@ -5838,7 +5855,7 @@ static void ui_handler_remove_region(bContext *C, void *userdata) ui_apply_but_funcs_after(C); } -static int ui_handler_region_menu(bContext *C, wmEvent *event, void *userdata) +static int ui_handler_region_menu(bContext *C, wmEvent *event, void *UNUSED(userdata)) { ARegion *ar; uiBut *but; diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 3fa53b73015..0ade3e6199f 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -28,6 +28,7 @@ #include <math.h> #include <stdlib.h> #include <string.h> +#include <assert.h> #ifndef WIN32 #include <unistd.h> @@ -331,7 +332,7 @@ static void vicon_editmode_hlt_draw(int x, int y, int w, int h, float alpha) viconutil_draw_points(pts, 3, 1); } -static void vicon_editmode_dehlt_draw(int x, int y, int w, int h, float alpha) +static void vicon_editmode_dehlt_draw(int x, int y, int w, int h, float UNUSED(alpha)) { GLint pts[3][2]; @@ -346,7 +347,7 @@ static void vicon_editmode_dehlt_draw(int x, int y, int w, int h, float alpha) viconutil_draw_points(pts, 3, 1); } -static void vicon_disclosure_tri_right_draw(int x, int y, int w, int h, float alpha) +static void vicon_disclosure_tri_right_draw(int x, int y, int w, int UNUSED(h), float alpha) { GLint pts[3][2]; int cx = x+w/2; @@ -371,7 +372,7 @@ static void vicon_disclosure_tri_right_draw(int x, int y, int w, int h, float al viconutil_draw_lineloop_smooth(pts, 3); } -static void vicon_small_tri_right_draw(int x, int y, int w, int h, float alpha) +static void vicon_small_tri_right_draw(int x, int y, int w, int UNUSED(h), float alpha) { GLint pts[3][2]; int cx = x+w/2-4; @@ -393,7 +394,7 @@ static void vicon_small_tri_right_draw(int x, int y, int w, int h, float alpha) glShadeModel(GL_FLAT); } -static void vicon_disclosure_tri_down_draw(int x, int y, int w, int h, float alpha) +static void vicon_disclosure_tri_down_draw(int x, int y, int w, int UNUSED(h), float alpha) { GLint pts[3][2]; int cx = x+w/2; @@ -418,7 +419,7 @@ static void vicon_disclosure_tri_down_draw(int x, int y, int w, int h, float alp viconutil_draw_lineloop_smooth(pts, 3); } -static void vicon_move_up_draw(int x, int y, int w, int h, float alpha) +static void vicon_move_up_draw(int x, int y, int w, int h, float UNUSED(alpha)) { int d=-2; @@ -436,7 +437,7 @@ static void vicon_move_up_draw(int x, int y, int w, int h, float alpha) glDisable(GL_LINE_SMOOTH); } -static void vicon_move_down_draw(int x, int y, int w, int h, float alpha) +static void vicon_move_down_draw(int x, int y, int w, int h, float UNUSED(alpha)) { int d=2; @@ -843,8 +844,17 @@ static void icon_set_image(bContext *C, ID *id, PreviewImage* prv_img, int miple prv_img->w[miplevel], prv_img->h[miplevel]); } -static void icon_draw_rect(float x, float y, int w, int h, float aspect, int rw, int rh, unsigned int *rect, float alpha, float *rgb) +static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect), int rw, int rh, unsigned int *rect, float alpha, float *rgb, short is_preview) { + ImBuf *ima= NULL; + + /* sanity check */ + if(w<=0 || h<=0 || w>2000 || h>2000) { + printf("icon_draw_rect: icons are %i x %i pixels?\n", w, h); + assert(!"invalid icon size"); + return; + } + /* modulate color */ if(alpha != 1.0f) glPixelTransferf(GL_ALPHA_SCALE, alpha); @@ -854,35 +864,27 @@ static void icon_draw_rect(float x, float y, int w, int h, float aspect, int rw, glPixelTransferf(GL_GREEN_SCALE, rgb[1]); glPixelTransferf(GL_BLUE_SCALE, rgb[2]); } - - /* draw */ - if((w<1 || h<1)) { - // XXX - TODO 2.5 verify whether this case can happen - if (G.f & G_DEBUG) - printf("what the heck! - icons are %i x %i pixels?\n", w, h); - } - /* rect contains image in 'rendersize', we only scale if needed */ - else if(rw!=w && rh!=h) { - if(w>2000 || h>2000) { /* something has gone wrong! */ - if (G.f & G_DEBUG) - printf("insane icon size w=%d h=%d\n",w,h); - } - else { - ImBuf *ima; - /* first allocate imbuf for scaling and copy preview into it */ - ima = IMB_allocImBuf(rw, rh, 32, IB_rect, 0); - memcpy(ima->rect, rect, rw*rh*sizeof(unsigned int)); - - /* scale it */ - IMB_scaleImBuf(ima, w, h); - glaDrawPixelsSafe(x, y, w, h, w, GL_RGBA, GL_UNSIGNED_BYTE, ima->rect); - - IMB_freeImBuf(ima); - } + /* rect contains image in 'rendersize', we only scale if needed */ + if(rw!=w && rh!=h) { + /* first allocate imbuf for scaling and copy preview into it */ + ima = IMB_allocImBuf(rw, rh, 32, IB_rect); + memcpy(ima->rect, rect, rw*rh*sizeof(unsigned int)); + IMB_scaleImBuf(ima, w, h); /* scale it */ + rect= ima->rect; } - else + + /* draw */ + if(is_preview) { glaDrawPixelsSafe(x, y, w, h, w, GL_RGBA, GL_UNSIGNED_BYTE, rect); + } + else { + glRasterPos2f(x, y); + glDrawPixels(w, h, GL_RGBA, GL_UNSIGNED_BYTE, rect); + } + + if(ima) + IMB_freeImBuf(ima); /* restore color */ if(alpha != 0.0f) @@ -895,7 +897,7 @@ static void icon_draw_rect(float x, float y, int w, int h, float aspect, int rw, } } -static void icon_draw_texture(float x, float y, float w, float h, int ix, int iy, int iw, int ih, float alpha, float *rgb) +static void icon_draw_texture(float x, float y, float w, float h, int ix, int iy, int UNUSED(iw), int ih, float alpha, float *rgb) { float x1, x2, y1, y2; @@ -938,7 +940,7 @@ static int preview_size(int miplevel) return 0; } -static void icon_draw_size(float x, float y, int icon_id, float aspect, float alpha, float *rgb, int miplevel, int draw_size, int nocreate) +static void icon_draw_size(float x, float y, int icon_id, float aspect, float alpha, float *rgb, int miplevel, int draw_size, int UNUSED(nocreate), int is_preview) { Icon *icon = NULL; DrawInfo *di = NULL; @@ -981,7 +983,7 @@ static void icon_draw_size(float x, float y, int icon_id, float aspect, float al if(!iimg->rect) return; /* something has gone wrong! */ - icon_draw_rect(x, y, w, h, aspect, iimg->w, iimg->h, iimg->rect, alpha, rgb); + icon_draw_rect(x, y, w, h, aspect, iimg->w, iimg->h, iimg->rect, alpha, rgb, is_preview); } else if(di->type == ICON_TYPE_PREVIEW) { PreviewImage* pi = BKE_previewimg_get((ID*)icon->obj); @@ -992,7 +994,7 @@ static void icon_draw_size(float x, float y, int icon_id, float aspect, float al /* preview images use premul alpha ... */ glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - icon_draw_rect(x, y, w, h, aspect, pi->w[miplevel], pi->h[miplevel], pi->rect[miplevel], 1.0f, NULL); + icon_draw_rect(x, y, w, h, aspect, pi->w[miplevel], pi->h[miplevel], pi->rect[miplevel], 1.0f, NULL, is_preview); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); } } @@ -1082,7 +1084,7 @@ int ui_id_icon_get(bContext *C, ID *id, int preview) static void icon_draw_mipmap(float x, float y, int icon_id, float aspect, float alpha, int miplevel, int nocreate) { int draw_size = preview_size(miplevel); - icon_draw_size(x, y, icon_id, aspect, alpha, NULL, miplevel, draw_size, nocreate); + icon_draw_size(x, y, icon_id, aspect, alpha, NULL, miplevel, draw_size, nocreate, FALSE); } void UI_icon_draw_aspect(float x, float y, int icon_id, float aspect, float alpha) @@ -1093,7 +1095,7 @@ void UI_icon_draw_aspect(float x, float y, int icon_id, float aspect, float alph void UI_icon_draw_aspect_color(float x, float y, int icon_id, float aspect, float *rgb) { int draw_size = preview_size(PREVIEW_MIPMAP_ZERO); - icon_draw_size(x, y, icon_id, aspect, 1.0f, rgb, PREVIEW_MIPMAP_ZERO, draw_size, 0); + icon_draw_size(x, y, icon_id, aspect, 1.0f, rgb, PREVIEW_MIPMAP_ZERO, draw_size, FALSE, FALSE); } void UI_icon_draw(float x, float y, int icon_id) @@ -1103,7 +1105,7 @@ void UI_icon_draw(float x, float y, int icon_id) void UI_icon_draw_size(float x, float y, int size, int icon_id, float alpha) { - icon_draw_size(x, y, icon_id, 1.0f, alpha, NULL, 0, size, 1); + icon_draw_size(x, y, icon_id, 1.0f, alpha, NULL, PREVIEW_MIPMAP_ZERO, size, TRUE, FALSE); } void UI_icon_draw_preview(float x, float y, int icon_id) @@ -1118,6 +1120,6 @@ void UI_icon_draw_preview_aspect(float x, float y, int icon_id, float aspect) void UI_icon_draw_preview_aspect_size(float x, float y, int icon_id, float aspect, int size) { - icon_draw_size(x, y, icon_id, aspect, 1.0f, NULL, PREVIEW_MIPMAP_LARGE, size, 0); + icon_draw_size(x, y, icon_id, aspect, 1.0f, NULL, PREVIEW_MIPMAP_LARGE, size, FALSE, TRUE); } diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index eb28df54b13..7a0f69fc838 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -171,8 +171,9 @@ struct uiBut { char *poin; float hardmin, hardmax, softmin, softmax; - float a1, a2, hsv[3]; // hsv is temp memory for hsv buttons + float a1, a2; float aspect; + char col[4]; uiButHandleFunc func; void *func_arg1; @@ -302,15 +303,16 @@ struct uiBlock { short auto_open; double auto_open_last; - char active; // to keep blocks while drawing and free them afterwards - char tooltipdisabled; // to avoid tooltip after click - short lock; char *lockstr; + + char lock; + char active; // to keep blocks while drawing and free them afterwards + char tooltipdisabled; // to avoid tooltip after click + char endblock; // uiEndBlock done? float xofs, yofs; // offset to parent button int dobounds, mx, my; // for doing delayed int bounds, minbounds; // for doing delayed - int endblock; // uiEndBlock done? rctf safety; // pulldowns, to detect outside, can differ per case how it is created ListBase saferct; // uiSafetyRct list @@ -319,9 +321,10 @@ struct uiBlock { int puphash; // popup menu hash for memory - int color_profile; // color profile for correcting linear colors for display - void *evil_C; // XXX hack for dynamic operator enums + + float _hsv[3]; // XXX, only access via ui_block_hsv_get() + char color_profile; // color profile for correcting linear colors for display }; typedef struct uiSafetyRct { @@ -408,6 +411,8 @@ void ui_tooltip_free(struct bContext *C, struct ARegion *ar); uiBut *ui_popup_menu_memory(uiBlock *block, uiBut *but); +float *ui_block_hsv_get(uiBlock *block); + /* searchbox for string button */ ARegion *ui_searchbox_create(struct bContext *C, struct ARegion *butregion, uiBut *but); int ui_searchbox_inside(struct ARegion *ar, int x, int y); @@ -436,12 +441,12 @@ void autocomplete_end(struct AutoComplete *autocpl, char *autoname); /* interface_panel.c */ extern int ui_handler_panel_region(struct bContext *C, struct wmEvent *event); -extern void ui_draw_aligned_panel(struct ARegion *ar, struct uiStyle *style, uiBlock *block, rcti *rect); +extern void ui_draw_aligned_panel(struct uiStyle *style, uiBlock *block, rcti *rect); /* interface_draw.c */ extern void ui_dropshadow(rctf *rct, float radius, float aspect, int select); -void ui_draw_gradient(rcti *rect, float *rgb, int type, float alpha); +void ui_draw_gradient(rcti *rect, float *hsv, int type, float alpha); void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, rcti *rect); void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, rcti *rect); diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 45b38a8c9a9..f729124e405 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -434,7 +434,7 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, char *name, int icon uiBlockSetCurLayout(block, layout); } -static void ui_item_enum_expand(uiLayout *layout, uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, char *uiname, int x, int y, int w, int h, int icon_only) +static void ui_item_enum_expand(uiLayout *layout, uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, char *uiname, int h, int icon_only) { uiBut *but; EnumPropertyItem *item; @@ -472,7 +472,7 @@ static void ui_item_enum_expand(uiLayout *layout, uiBlock *block, PointerRNA *pt } /* callback for keymap item change button */ -static void ui_keymap_but_cb(bContext *C, void *but_v, void *key_v) +static void ui_keymap_but_cb(bContext *UNUSED(C), void *but_v, void *UNUSED(key_v)) { uiBut *but= but_v; @@ -956,7 +956,7 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index } /* expanded enum */ else if(type == PROP_ENUM && (expand || RNA_property_flag(prop) & PROP_ENUM_FLAG)) - ui_item_enum_expand(layout, block, ptr, prop, name, 0, 0, w, h, icon_only); + ui_item_enum_expand(layout, block, ptr, prop, name, h, icon_only); /* property with separate label */ else if(type == PROP_ENUM || type == PROP_STRING || type == PROP_POINTER) { but= ui_item_with_label(layout, block, name, icon, ptr, prop, index, 0, 0, w, h, flag); @@ -1026,7 +1026,7 @@ void uiItemEnumR_string(uiLayout *layout, struct PointerRNA *ptr, char *propname for(a=0; item[a].identifier; a++) { if(item[a].value == ivalue) { - uiItemFullR(layout, ptr, prop, RNA_ENUM_VALUE, ivalue, 0, (char*)item[a].name, item[a].icon); + uiItemFullR(layout, ptr, prop, RNA_ENUM_VALUE, ivalue, 0, name ? name : (char*)item[a].name, icon ? icon : item[a].icon); break; } } @@ -1324,7 +1324,7 @@ static void ui_item_menu(uiLayout *layout, char *name, int icon, uiMenuCreateFun } } -void uiItemM(uiLayout *layout, bContext *C, char *menuname, char *name, int icon) +void uiItemM(uiLayout *layout, bContext *UNUSED(C), char *menuname, char *name, int icon) { MenuType *mt; @@ -1434,7 +1434,7 @@ typedef struct MenuItemLevel { PointerRNA rnapoin; } MenuItemLevel; -static void menu_item_enum_opname_menu(bContext *C, uiLayout *layout, void *arg) +static void menu_item_enum_opname_menu(bContext *UNUSED(C), uiLayout *layout, void *arg) { MenuItemLevel *lvl= (MenuItemLevel*)(((uiBut*)arg)->func_argN); @@ -1465,7 +1465,7 @@ void uiItemMenuEnumO(uiLayout *layout, char *opname, char *propname, char *name, ui_item_menu(layout, name, icon, menu_item_enum_opname_menu, NULL, lvl); } -static void menu_item_enum_rna_menu(bContext *C, uiLayout *layout, void *arg) +static void menu_item_enum_rna_menu(bContext *UNUSED(C), uiLayout *layout, void *arg) { MenuItemLevel *lvl= (MenuItemLevel*)(((uiBut*)arg)->func_argN); @@ -1674,7 +1674,7 @@ static void ui_litem_layout_column(uiLayout *litem) } /* root layout */ -static void ui_litem_estimate_root(uiLayout *litem) +static void ui_litem_estimate_root(uiLayout *UNUSED(litem)) { /* nothing to do */ } diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index bcde54f473a..10458a763e6 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -134,7 +134,7 @@ static int eyedropper_modal(bContext *C, wmOperator *op, wmEvent *event) } /* Modal Operator init */ -static int eyedropper_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int eyedropper_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { /* init */ if (eyedropper_init(C, op)) { @@ -195,7 +195,7 @@ void UI_OT_eyedropper(wmOperatorType *ot) /* Reset Default Theme ------------------------ */ -static int reset_default_theme_exec(bContext *C, wmOperator *op) +static int reset_default_theme_exec(bContext *C, wmOperator *UNUSED(op)) { ui_theme_init_default(); WM_event_add_notifier(C, NC_WINDOW, NULL); @@ -219,7 +219,7 @@ void UI_OT_reset_default_theme(wmOperatorType *ot) /* Copy Data Path Operator ------------------------ */ -static int copy_data_path_button_exec(bContext *C, wmOperator *op) +static int copy_data_path_button_exec(bContext *C, wmOperator *UNUSED(op)) { PointerRNA ptr; PropertyRNA *prop; diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 9d22f3c5212..d6cb8161916 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -25,7 +25,7 @@ * ***** END GPL LICENSE BLOCK ***** */ -/* a full doc with API notes can be found in bf-blender/blender/doc/interface_API.txt */ +/* a full doc with API notes can be found in bf-blender/trunk/blender/doc/guides/interface_API.txt */ #include <math.h> #include <stdlib.h> @@ -316,7 +316,7 @@ void uiPanelPush(uiBlock *block) glTranslatef((float)block->panel->ofsx, (float)block->panel->ofsy, 0.0); } -void uiPanelPop(uiBlock *block) +void uiPanelPop(uiBlock *UNUSED(block)) { glPopMatrix(); } @@ -425,7 +425,7 @@ static void ui_draw_panel_dragwidget(rctf *rect) } -static void ui_draw_aligned_panel_header(ARegion *ar, uiStyle *style, uiBlock *block, rcti *rect, char dir) +static void ui_draw_aligned_panel_header(uiStyle *style, uiBlock *block, rcti *rect, char dir) { Panel *panel= block->panel; rcti hrect; @@ -468,7 +468,7 @@ static void rectf_scale(rctf *rect, float scale) } /* panel integrated in buttonswindow, tool/property lists etc */ -void ui_draw_aligned_panel(ARegion *ar, uiStyle *style, uiBlock *block, rcti *rect) +void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect) { Panel *panel= block->panel; rcti headrect; @@ -499,7 +499,7 @@ void ui_draw_aligned_panel(ARegion *ar, uiStyle *style, uiBlock *block, rcti *re /* horizontal title */ if(!(panel->flag & PNL_CLOSEDX)) { - ui_draw_aligned_panel_header(ar, style, block, &headrect, 'h'); + ui_draw_aligned_panel_header(style, block, &headrect, 'h'); /* itemrect smaller */ itemrect.xmax= headrect.xmax - 5.0f/block->aspect; @@ -518,7 +518,7 @@ void ui_draw_aligned_panel(ARegion *ar, uiStyle *style, uiBlock *block, rcti *re } else if(panel->flag & PNL_CLOSEDX) { /* draw vertical title */ - ui_draw_aligned_panel_header(ar, style, block, &headrect, 'v'); + ui_draw_aligned_panel_header(style, block, &headrect, 'v'); } /* an open panel */ else { @@ -772,7 +772,7 @@ static void ui_do_animate(const bContext *C, Panel *panel) } } -void uiBeginPanels(const bContext *C, ARegion *ar) +void uiBeginPanels(const bContext *UNUSED(C), ARegion *ar) { Panel *pa; diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index a0f852239c4..5f8d604817a 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -306,7 +306,7 @@ typedef struct uiTooltipData { int toth, spaceh, lineh; } uiTooltipData; -static void ui_tooltip_region_draw(const bContext *C, ARegion *ar) +static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *ar) { uiTooltipData *data= ar->regiondata; rcti bbox= data->bbox; @@ -328,7 +328,7 @@ static void ui_tooltip_region_draw(const bContext *C, ARegion *ar) } } -static void ui_tooltip_region_free(ARegion *ar) +static void ui_tooltip_region_free_cb(ARegion *ar) { uiTooltipData *data; @@ -455,8 +455,8 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) ar= ui_add_temporary_region(CTX_wm_screen(C)); memset(&type, 0, sizeof(ARegionType)); - type.draw= ui_tooltip_region_draw; - type.free= ui_tooltip_region_free; + type.draw= ui_tooltip_region_draw_cb; + type.free= ui_tooltip_region_free_cb; ar->type= &type; /* set font, get bb */ @@ -832,7 +832,7 @@ void ui_searchbox_autocomplete(bContext *C, ARegion *ar, uiBut *but, char *str) } } -static void ui_searchbox_region_draw(const bContext *C, ARegion *ar) +static void ui_searchbox_region_draw_cb(const bContext *UNUSED(C), ARegion *ar) { uiSearchboxData *data= ar->regiondata; @@ -840,7 +840,7 @@ static void ui_searchbox_region_draw(const bContext *C, ARegion *ar) wmOrtho2(-0.01f, ar->winx-0.01f, -0.01f, ar->winy-0.01f); if(!data->noback) - ui_draw_search_back(U.uistyles.first, NULL, &data->bbox); + ui_draw_search_back(NULL, NULL, &data->bbox); /* style not used yet */ /* draw text */ if(data->items.totitem) { @@ -899,7 +899,7 @@ static void ui_searchbox_region_draw(const bContext *C, ARegion *ar) } } -static void ui_searchbox_region_free(ARegion *ar) +static void ui_searchbox_region_free_cb(ARegion *ar) { uiSearchboxData *data= ar->regiondata; int a; @@ -931,8 +931,8 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but) ar= ui_add_temporary_region(CTX_wm_screen(C)); memset(&type, 0, sizeof(ARegionType)); - type.draw= ui_searchbox_region_draw; - type.free= ui_searchbox_region_free; + type.draw= ui_searchbox_region_draw_cb; + type.free= ui_searchbox_region_free_cb; ar->type= &type; /* create searchbox data */ @@ -1418,7 +1418,7 @@ void ui_popup_block_free(bContext *C, uiPopupBlockHandle *handle) /***************************** Menu Button ***************************/ -static void ui_block_func_MENUSTR(bContext *C, uiLayout *layout, void *arg_str) +static void ui_block_func_MENUSTR(bContext *UNUSED(C), uiLayout *layout, void *arg_str) { uiBlock *block= uiLayoutGetBlock(layout); uiPopupBlockHandle *handle= block->handle; @@ -1500,7 +1500,7 @@ static void ui_block_func_MENUSTR(bContext *C, uiLayout *layout, void *arg_str) menudata_free(md); } -void ui_block_func_ICONROW(bContext *C, uiLayout *layout, void *arg_but) +void ui_block_func_ICONROW(bContext *UNUSED(C), uiLayout *layout, void *arg_but) { uiBlock *block= uiLayoutGetBlock(layout); uiPopupBlockHandle *handle= block->handle; @@ -1514,7 +1514,7 @@ void ui_block_func_ICONROW(bContext *C, uiLayout *layout, void *arg_but) &handle->retvalue, (float)a, 0.0, 0, 0, ""); } -void ui_block_func_ICONTEXTROW(bContext *C, uiLayout *layout, void *arg_but) +void ui_block_func_ICONTEXTROW(bContext *UNUSED(C), uiLayout *layout, void *arg_but) { uiBlock *block= uiLayoutGetBlock(layout); uiPopupBlockHandle *handle= block->handle; @@ -1571,27 +1571,22 @@ static void ui_warp_pointer(short x, short y) void ui_set_but_hsv(uiBut *but) { float col[3]; + float *hsv= ui_block_hsv_get(but->block); - hsv_to_rgb(but->hsv[0], but->hsv[1], but->hsv[2], col, col+1, col+2); + hsv_to_rgb(hsv[0], hsv[1], hsv[2], col, col+1, col+2); ui_set_but_vectorf(but, col); } /* also used by small picker, be careful with name checks below... */ -void ui_update_block_buts_rgb(uiBlock *block, float *rgb, float *rhsv) +void ui_update_block_buts_rgb(uiBlock *block, float *rgb) { uiBut *bt; - float hsv[3]; + float *hsv= ui_block_hsv_get(block); /* this is to keep the H and S value when V is equal to zero * and we are working in HSV mode, of course! */ - if (rhsv) { - hsv[0]= rhsv[0]; - hsv[1]= rhsv[1]; - hsv[2]= rhsv[2]; - } - else - rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); + rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); // this updates button strings, is hackish... but button pointers are on stack of caller function for(bt= block->buttons.first; bt; bt= bt->next) { @@ -1647,7 +1642,7 @@ void ui_update_block_buts_rgb(uiBlock *block, float *rgb, float *rhsv) } } -static void do_picker_rna_cb(bContext *C, void *bt1, void *unused) +static void do_picker_rna_cb(bContext *UNUSED(C), void *bt1, void *UNUSED(arg)) { uiBut *but= (uiBut *)bt1; uiPopupBlockHandle *popup= but->block->handle; @@ -1657,29 +1652,29 @@ static void do_picker_rna_cb(bContext *C, void *bt1, void *unused) if (prop) { RNA_property_float_get_array(&ptr, prop, rgb); - ui_update_block_buts_rgb(but->block, rgb, NULL); + ui_update_block_buts_rgb(but->block, rgb); } if(popup) popup->menuretval= UI_RETURN_UPDATE; } -static void do_hsv_rna_cb(bContext *C, void *bt1, void *hsv_arg) +static void do_hsv_rna_cb(bContext *UNUSED(C), void *bt1, void *UNUSED(arg)) { uiBut *but= (uiBut *)bt1; uiPopupBlockHandle *popup= but->block->handle; - float *hsv = (float *)hsv_arg; float rgb[3]; + float *hsv= ui_block_hsv_get(but->block); hsv_to_rgb(hsv[0], hsv[1], hsv[2], rgb, rgb+1, rgb+2); - ui_update_block_buts_rgb(but->block, rgb, hsv); + ui_update_block_buts_rgb(but->block, rgb); if(popup) popup->menuretval= UI_RETURN_UPDATE; } -static void do_hex_rna_cb(bContext *C, void *bt1, void *hexcl) +static void do_hex_rna_cb(bContext *UNUSED(C), void *bt1, void *hexcl) { uiBut *but= (uiBut *)bt1; uiPopupBlockHandle *popup= but->block->handle; @@ -1694,13 +1689,13 @@ static void do_hex_rna_cb(bContext *C, void *bt1, void *hexcl) srgb_to_linearrgb_v3_v3(rgb, rgb); } - ui_update_block_buts_rgb(but->block, rgb, NULL); + ui_update_block_buts_rgb(but->block, rgb); if(popup) popup->menuretval= UI_RETURN_UPDATE; } -static void close_popup_cb(bContext *C, void *bt1, void *arg) +static void close_popup_cb(bContext *UNUSED(C), void *bt1, void *UNUSED(arg)) { uiBut *but= (uiBut *)bt1; uiPopupBlockHandle *popup= but->block->handle; @@ -1740,7 +1735,7 @@ static void picker_new_hide_reveal(uiBlock *block, short colormode) } } -static void do_picker_new_mode_cb(bContext *C, void *bt1, void *colv) +static void do_picker_new_mode_cb(bContext *UNUSED(C), void *bt1, void *UNUSED(arg)) { uiBut *bt= bt1; short colormode= ui_get_but_val(bt); @@ -1794,11 +1789,13 @@ static void uiBlockPicker(uiBlock *block, float *rgb, PointerRNA *ptr, PropertyR uiBut *bt; int width, butwidth; static char tip[50]; - static float hsv[3]; static char hexcol[128]; float rgb_gamma[3]; float min, max, step, precision; const char *propname = RNA_property_identifier(prop); + float *hsv= ui_block_hsv_get(block); + + ui_block_hsv_get(block); width= PICKER_TOTAL_W; butwidth = width - UI_UNIT_X - 10; @@ -1818,7 +1815,6 @@ static void uiBlockPicker(uiBlock *block, float *rgb, PointerRNA *ptr, PropertyR RNA_property_float_ui_range(ptr, prop, &min, &max, &step, &precision); RNA_property_float_get_array(ptr, prop, rgb); - rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); switch (U.color_picker_type) { case USER_CP_CIRCLE: @@ -1838,11 +1834,11 @@ static void uiBlockPicker(uiBlock *block, float *rgb, PointerRNA *ptr, PropertyR /* mode */ uiBlockBeginAlign(block); bt= uiDefButS(block, ROW, 0, "RGB", 0, -30, width/3, UI_UNIT_Y, &colormode, 0.0, 0.0, 0, 0, ""); - uiButSetFunc(bt, do_picker_new_mode_cb, bt, rgb); + uiButSetFunc(bt, do_picker_new_mode_cb, bt, NULL); bt= uiDefButS(block, ROW, 0, "HSV", width/3, -30, width/3, UI_UNIT_Y, &colormode, 0.0, 1.0, 0, 0, ""); - uiButSetFunc(bt, do_picker_new_mode_cb, bt, hsv); + uiButSetFunc(bt, do_picker_new_mode_cb, bt, NULL); bt= uiDefButS(block, ROW, 0, "Hex", 2*width/3, -30, width/3, UI_UNIT_Y, &colormode, 0.0, 2.0, 0, 0, ""); - uiButSetFunc(bt, do_picker_new_mode_cb, bt, hexcol); + uiButSetFunc(bt, do_picker_new_mode_cb, bt, NULL); uiBlockEndAlign(block); bt= uiDefIconButO(block, BUT, "UI_OT_eyedropper", WM_OP_INVOKE_DEFAULT, ICON_EYEDROPPER, butwidth+10, -60, UI_UNIT_X, UI_UNIT_Y, NULL); @@ -1878,19 +1874,19 @@ static void uiBlockPicker(uiBlock *block, float *rgb, PointerRNA *ptr, PropertyR rgb[3]= 1.0f; } - rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); - sprintf(hexcol, "%02X%02X%02X", FTOCHAR(rgb_gamma[0]), FTOCHAR(rgb_gamma[1]), FTOCHAR(rgb_gamma[2])); bt= uiDefBut(block, TEX, 0, "Hex: ", 0, -60, butwidth, UI_UNIT_Y, hexcol, 0, 8, 0, 0, "Hex triplet for color (#RRGGBB)"); uiButSetFunc(bt, do_hex_rna_cb, bt, hexcol); uiDefBut(block, LABEL, 0, "(Gamma Corrected)", 0, -80, butwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); + rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); + picker_new_hide_reveal(block, colormode); } -static int ui_picker_small_wheel(const bContext *C, uiBlock *block, wmEvent *event) +static int ui_picker_small_wheel_cb(const bContext *UNUSED(C), uiBlock *block, wmEvent *event) { float add= 0.0f; @@ -1906,16 +1902,17 @@ static int ui_picker_small_wheel(const bContext *C, uiBlock *block, wmEvent *eve if(but->type==HSVCUBE && but->active==NULL) { uiPopupBlockHandle *popup= block->handle; float col[3]; + float *hsv= ui_block_hsv_get(block); ui_get_but_vectorf(but, col); - rgb_to_hsv(col[0], col[1], col[2], but->hsv, but->hsv+1, but->hsv+2); - but->hsv[2]= CLAMPIS(but->hsv[2]+add, 0.0f, 1.0f); - hsv_to_rgb(but->hsv[0], but->hsv[1], but->hsv[2], col, col+1, col+2); + rgb_to_hsv_compat(col[0], col[1], col[2], hsv, hsv+1, hsv+2); + hsv[2]= CLAMPIS(hsv[2]+add, 0.0f, 1.0f); + hsv_to_rgb(hsv[0], hsv[1], hsv[2], col, col+1, col+2); ui_set_but_vectorf(but, col); - ui_update_block_buts_rgb(block, col, NULL); + ui_update_block_buts_rgb(block, col); if(popup) popup->menuretval= UI_RETURN_UPDATE; @@ -1942,12 +1939,13 @@ uiBlock *ui_block_func_COL(bContext *C, uiPopupBlockHandle *handle, void *arg_bu uiBlockSetFlag(block, UI_BLOCK_MOVEMOUSE_QUIT); VECCOPY(handle->retvec, but->editvec); - + uiBlockPicker(block, handle->retvec, &but->rnapoin, but->rnaprop); + block->flag= UI_BLOCK_LOOP|UI_BLOCK_REDRAW|UI_BLOCK_KEEP_OPEN; uiBoundsBlock(block, 10); - block->block_event_func= ui_picker_small_wheel; + block->block_event_func= ui_picker_small_wheel_cb; /* and lets go */ block->direction= UI_TOP; @@ -2438,3 +2436,7 @@ void uiPupBlockClose(bContext *C, uiBlock *block) } } +float *ui_block_hsv_get(uiBlock *block) +{ + return block->_hsv; +} diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 390c576fe94..e4837920c3e 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -491,7 +491,7 @@ void uiTemplateIDPreview(uiLayout *layout, bContext *C, PointerRNA *ptr, char *p * - propname: property identifier for property that ID-pointer gets stored to * - proptypename: property identifier for property used to determine the type of ID-pointer that can be used */ -void uiTemplateAnyID(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propname, char *proptypename, char *text) +void uiTemplateAnyID(uiLayout *layout, PointerRNA *ptr, char *propname, char *proptypename, char *text) { PropertyRNA *propID, *propType; uiLayout *row; @@ -536,7 +536,7 @@ void uiTemplateAnyID(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propn * - propname: property identifier for property that path gets stored to * - root_ptr: struct that path gets built from */ -void uiTemplatePathBuilder(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propname, PointerRNA *root_ptr, char *text) +void uiTemplatePathBuilder(uiLayout *layout, PointerRNA *ptr, char *propname, PointerRNA *UNUSED(root_ptr), char *text) { PropertyRNA *propPath; uiLayout *row; @@ -817,7 +817,7 @@ uiLayout *uiTemplateModifier(uiLayout *layout, bContext *C, PointerRNA *ptr) #define REMAKEIPO 8 #define B_DIFF 9 -void do_constraint_panels(bContext *C, void *arg, int event) +void do_constraint_panels(bContext *C, void *UNUSED(arg), int event) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); @@ -853,7 +853,7 @@ void do_constraint_panels(bContext *C, void *arg, int event) // XXX allqueue(REDRAWBUTSEDIT, 0); } -static void constraint_active_func(bContext *C, void *ob_v, void *con_v) +static void constraint_active_func(bContext *UNUSED(C), void *ob_v, void *con_v) { ED_object_constraint_set_active(ob_v, con_v); } @@ -1142,7 +1142,7 @@ typedef struct RNAUpdateCb { PropertyRNA *prop; } RNAUpdateCb; -static void rna_update_cb(bContext *C, void *arg_cb, void *arg_unused) +static void rna_update_cb(bContext *C, void *arg_cb, void *UNUSED(arg)) { RNAUpdateCb *cb= (RNAUpdateCb*)arg_cb; @@ -1319,7 +1319,7 @@ void uiTemplateColorRamp(uiLayout *layout, PointerRNA *ptr, char *propname, int /********************* Histogram Template ************************/ -void uiTemplateHistogram(uiLayout *layout, PointerRNA *ptr, char *propname, int expand) +void uiTemplateHistogram(uiLayout *layout, PointerRNA *ptr, char *propname) { PropertyRNA *prop= RNA_struct_find_property(ptr, propname); PointerRNA cptr; @@ -1358,7 +1358,7 @@ void uiTemplateHistogram(uiLayout *layout, PointerRNA *ptr, char *propname, int /********************* Waveform Template ************************/ -void uiTemplateWaveform(uiLayout *layout, PointerRNA *ptr, char *propname, int expand) +void uiTemplateWaveform(uiLayout *layout, PointerRNA *ptr, char *propname) { PropertyRNA *prop= RNA_struct_find_property(ptr, propname); PointerRNA cptr; @@ -1394,7 +1394,7 @@ void uiTemplateWaveform(uiLayout *layout, PointerRNA *ptr, char *propname, int e /********************* Vectorscope Template ************************/ -void uiTemplateVectorscope(uiLayout *layout, PointerRNA *ptr, char *propname, int expand) +void uiTemplateVectorscope(uiLayout *layout, PointerRNA *ptr, char *propname) { PropertyRNA *prop= RNA_struct_find_property(ptr, propname); PointerRNA cptr; @@ -1432,7 +1432,7 @@ void uiTemplateVectorscope(uiLayout *layout, PointerRNA *ptr, char *propname, in /********************* CurveMapping Template ************************/ -static void curvemap_buttons_zoom_in(bContext *C, void *cumap_v, void *unused) +static void curvemap_buttons_zoom_in(bContext *C, void *cumap_v, void *UNUSED(arg)) { CurveMapping *cumap = cumap_v; float d; @@ -1450,7 +1450,7 @@ static void curvemap_buttons_zoom_in(bContext *C, void *cumap_v, void *unused) ED_region_tag_redraw(CTX_wm_region(C)); } -static void curvemap_buttons_zoom_out(bContext *C, void *cumap_v, void *unused) +static void curvemap_buttons_zoom_out(bContext *C, void *cumap_v, void *UNUSED(unused)) { CurveMapping *cumap = cumap_v; float d, d1; @@ -1487,7 +1487,7 @@ static void curvemap_buttons_zoom_out(bContext *C, void *cumap_v, void *unused) ED_region_tag_redraw(CTX_wm_region(C)); } -static void curvemap_buttons_setclip(bContext *C, void *cumap_v, void *unused) +static void curvemap_buttons_setclip(bContext *UNUSED(C), void *cumap_v, void *UNUSED(arg)) { CurveMapping *cumap = cumap_v; @@ -1607,7 +1607,7 @@ static uiBlock *curvemap_brush_tools_func(bContext *C, struct ARegion *ar, void return block; } -static void curvemap_buttons_redraw(bContext *C, void *arg1, void *arg2) +static void curvemap_buttons_redraw(bContext *C, void *UNUSED(arg1), void *UNUSED(arg2)) { ED_region_tag_redraw(CTX_wm_region(C)); } @@ -2200,7 +2200,7 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propna /************************* Operator Search Template **************************/ -static void operator_call_cb(bContext *C, void *arg1, void *arg2) +static void operator_call_cb(bContext *C, void *UNUSED(arg1), void *arg2) { wmOperatorType *ot= arg2; @@ -2208,7 +2208,7 @@ static void operator_call_cb(bContext *C, void *arg1, void *arg2) WM_operator_name_call(C, ot->idname, WM_OP_INVOKE_DEFAULT, NULL); } -static void operator_search_cb(const bContext *C, void *arg, char *str, uiSearchItems *items) +static void operator_search_cb(const bContext *C, void *UNUSED(arg), char *str, uiSearchItems *items) { wmOperatorType *ot = WM_operatortype_first(); @@ -2255,7 +2255,7 @@ void uiTemplateOperatorSearch(uiLayout *layout) #define B_STOPANIM 3 #define B_STOPCOMPO 4 -static void do_running_jobs(bContext *C, void *arg, int event) +static void do_running_jobs(bContext *C, void *UNUSED(arg), int event) { switch(event) { case B_STOPRENDER: @@ -2327,7 +2327,6 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C) uiBut *but; uiStyle *style= U.uistyles.first; int width; - float hsv[3]; /* if the report display has timed out, don't show */ if (!reports->reporttimer) return; @@ -2338,8 +2337,6 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C) abs = uiLayoutAbsolute(layout, 0); block= uiLayoutGetBlock(abs); - - rgb_to_hsv(rti->col[0], rti->col[1], rti->col[2], hsv+0, hsv+1, hsv+2); width = BLF_width(style->widget.uifont_id, report->message); width = MIN2(rti->widthfac*width, width); @@ -2348,11 +2345,16 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C) /* make a box around the report to make it stand out */ uiBlockBeginAlign(block); but= uiDefBut(block, ROUNDBOX, 0, "", 0, 0, UI_UNIT_X+10, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, ""); - copy_v3_v3(but->hsv, hsv); /* set the report's bg colour in but->hsv - ROUNDBOX feature */ - + /* set the report's bg colour in but->col - ROUNDBOX feature */ + but->col[0]= FTOCHAR(rti->col[0]); + but->col[1]= FTOCHAR(rti->col[1]); + but->col[2]= FTOCHAR(rti->col[2]); + but->col[3]= 255; + but= uiDefBut(block, ROUNDBOX, 0, "", UI_UNIT_X+10, 0, UI_UNIT_X+width, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, ""); - but->hsv[0] = but->hsv[1] = 0.0; /* set a greyscale bg colour in but->hsv - ROUNDBOX feature */ - but->hsv[2] = rti->greyscale; + but->col[0]= but->col[1]= but->col[2]= FTOCHAR(rti->greyscale); + but->col[3]= 255; + uiBlockEndAlign(block); diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c index 37278340275..6d8aa89afb0 100644 --- a/source/blender/editors/interface/interface_utils.c +++ b/source/blender/editors/interface/interface_utils.c @@ -131,7 +131,7 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind return but; } -void uiDefAutoButsRNA(const bContext *C, uiLayout *layout, PointerRNA *ptr, int columns) +void uiDefAutoButsRNA(uiLayout *layout, PointerRNA *ptr, int columns) { uiLayout *split, *col; int flag; diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 134ab70e4ca..ed7284bf264 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -27,6 +27,7 @@ #include <math.h> #include <stdlib.h> #include <string.h> +#include <assert.h> #include "DNA_screen_types.h" @@ -744,7 +745,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol) #define PREVIEW_PAD 4 -static void widget_draw_preview(BIFIconID icon, float aspect, float alpha, rcti *rect) +static void widget_draw_preview(BIFIconID icon, float aspect, float UNUSED(alpha), rcti *rect) { int w, h, x, y, size; @@ -1492,7 +1493,7 @@ static void widget_state_label(uiWidgetType *wt, int state) } -static void widget_state_nothing(uiWidgetType *wt, int state) +static void widget_state_nothing(uiWidgetType *wt, int UNUSED(state)) { wt->wcol= *(wt->wcol_theme); } @@ -1646,7 +1647,7 @@ void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect) /* gouraud triangle fan */ float radstep, ang= 0.0f; float centx, centy, radius; - float rgb[3], hsv[3], hsvo[3], col[3], colcent[3]; + float rgb[3], hsvo[3], hsv[3], col[3], colcent[3]; int a, tot= 32; int color_profile = but->block->color_profile; @@ -1664,7 +1665,8 @@ void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect) /* color */ ui_get_but_vectorf(but, rgb); - rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); + copy_v3_v3(hsv, ui_block_hsv_get(but->block)); + rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); copy_v3_v3(hsvo, hsv); /* exception: if 'lock' is set @@ -1724,16 +1726,14 @@ void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect) /* ************ custom buttons, old stuff ************** */ /* draws in resolution of 20x4 colors */ -void ui_draw_gradient(rcti *rect, float *rgb, int type, float alpha) +void ui_draw_gradient(rcti *rect, float *hsv, int type, float alpha) { int a; - float h, s, v; + float h= hsv[0], s= hsv[1], v= hsv[0]; float dx, dy, sx1, sx2, sy; float col0[4][3]; // left half, rect bottom to top float col1[4][3]; // right half, rect bottom to top - - rgb_to_hsv(rgb[0], rgb[1], rgb[2], &h, &s, &v); - + /* draw series of gouraud rects */ glShadeModel(GL_SMOOTH); @@ -1774,6 +1774,12 @@ void ui_draw_gradient(rcti *rect, float *rgb, int type, float alpha) VECCOPY(col1[1], col1[2]); VECCOPY(col1[3], col1[2]); break; + default: + assert(!"invalid 'type' argument"); + hsv_to_rgb(1.0, 1.0, 1.0, &col1[2][0], &col1[2][1], &col1[2][2]); + VECCOPY(col1[0], col1[2]); + VECCOPY(col1[1], col1[2]); + VECCOPY(col1[3], col1[2]); } /* old below */ @@ -1858,11 +1864,21 @@ static void ui_draw_but_HSVCUBE(uiBut *but, rcti *rect) { float rgb[3], h,s,v; float x=0.0f, y=0.0f; + float *hsv= ui_block_hsv_get(but->block); + float hsvn[3]; + + h= hsv[0]; + s= hsv[1]; + v= hsv[2]; ui_get_but_vectorf(but, rgb); - rgb_to_hsv(rgb[0], rgb[1], rgb[2], &h, &s, &v); + rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], &h, &s, &v); + + hsvn[0]= h; + hsvn[1]= s; + hsvn[2]= v; - ui_draw_gradient(rect, rgb, but->a1, 1.f); + ui_draw_gradient(rect, hsvn, but->a1, 1.f); switch((int)but->a1) { case UI_GRAD_SV: @@ -1940,7 +1956,7 @@ static void ui_draw_but_HSV_v(uiBut *but, rcti *rect) /* ************ separator, for menus etc ***************** */ -static void ui_draw_separator(uiBut *but, rcti *rect, uiWidgetColors *wcol) +static void ui_draw_separator(rcti *rect, uiWidgetColors *wcol) { int y = rect->ymin + (rect->ymax - rect->ymin)/2 - 1; unsigned char col[4]; @@ -2112,7 +2128,7 @@ void uiWidgetScrollDraw(uiWidgetColors *wcol, rcti *rect, rcti *slider, int stat } } -static void widget_scroll(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign) +static void widget_scroll(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int UNUSED(roundboxalign)) { rcti rect1; double value; @@ -2173,7 +2189,7 @@ static void widget_scroll(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat uiWidgetScrollDraw(wcol, rect, &rect1, state); } -static void widget_progressbar(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign) +static void widget_progressbar(uiBut *but, uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int UNUSED(roundboxalign)) { rcti rect_prog = *rect, rect_bar = *rect; float value = but->a1; @@ -2199,7 +2215,7 @@ static void widget_progressbar(uiBut *but, uiWidgetColors *wcol, rcti *rect, int rect->xmin -= 6; } -static void widget_link(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign) +static void widget_link(uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *rect, int UNUSED(state), int UNUSED(roundboxalign)) { if(but->flag & UI_SELECT) { @@ -2353,7 +2369,7 @@ static void widget_textbut(uiWidgetColors *wcol, rcti *rect, int state, int roun } -static void widget_menubut(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign) +static void widget_menubut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign) { uiWidgetBase wtb; @@ -2371,7 +2387,7 @@ static void widget_menubut(uiWidgetColors *wcol, rcti *rect, int state, int roun rect->xmax -= (rect->ymax-rect->ymin); } -static void widget_menuiconbut(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign) +static void widget_menuiconbut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign) { uiWidgetBase wtb; @@ -2384,7 +2400,7 @@ static void widget_menuiconbut(uiWidgetColors *wcol, rcti *rect, int state, int widgetbase_draw(&wtb, wcol); } -static void widget_pulldownbut(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign) +static void widget_pulldownbut(uiWidgetColors *wcol, rcti *rect, int state, int UNUSED(roundboxalign)) { if(state & UI_ACTIVE) { uiWidgetBase wtb; @@ -2399,7 +2415,7 @@ static void widget_pulldownbut(uiWidgetColors *wcol, rcti *rect, int state, int } } -static void widget_menu_itembut(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign) +static void widget_menu_itembut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int UNUSED(roundboxalign)) { uiWidgetBase wtb; @@ -2412,7 +2428,7 @@ static void widget_menu_itembut(uiWidgetColors *wcol, rcti *rect, int state, int widgetbase_draw(&wtb, wcol); } -static void widget_list_itembut(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign) +static void widget_list_itembut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int UNUSED(roundboxalign)) { uiWidgetBase wtb; @@ -2425,7 +2441,7 @@ static void widget_list_itembut(uiWidgetColors *wcol, rcti *rect, int state, int widgetbase_draw(&wtb, wcol); } -static void widget_optionbut(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign) +static void widget_optionbut(uiWidgetColors *wcol, rcti *rect, int state, int UNUSED(roundboxalign)) { uiWidgetBase wtb; rcti recttemp= *rect; @@ -2458,7 +2474,7 @@ static void widget_optionbut(uiWidgetColors *wcol, rcti *rect, int state, int ro } -static void widget_radiobut(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign) +static void widget_radiobut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign) { uiWidgetBase wtb; @@ -2471,7 +2487,7 @@ static void widget_radiobut(uiWidgetColors *wcol, rcti *rect, int state, int rou } -static void widget_box(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign) +static void widget_box(uiBut *but, uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign) { uiWidgetBase wtb; char old_col[3]; @@ -2481,12 +2497,10 @@ static void widget_box(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, VECCOPY(old_col, wcol->inner); /* abuse but->hsv - if it's non-zero, use this colour as the box's background */ - if ((but->hsv[0] != 0.0) || (but->hsv[1] != 0.0) || (but->hsv[2] != 0.0)) { - float rgb[3]; - hsv_to_rgb(but->hsv[0], but->hsv[1], but->hsv[2], rgb+0, rgb+1, rgb+2); - wcol->inner[0] = rgb[0] * 255; - wcol->inner[1] = rgb[1] * 255; - wcol->inner[2] = rgb[2] * 255; + if (but->col[3]) { + wcol->inner[0] = but->col[0]; + wcol->inner[1] = but->col[1]; + wcol->inner[2] = but->col[2]; } /* half rounded */ @@ -2501,7 +2515,7 @@ static void widget_box(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, VECCOPY(wcol->inner, old_col); } -static void widget_but(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign) +static void widget_but(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign) { uiWidgetBase wtb; @@ -2514,7 +2528,7 @@ static void widget_but(uiWidgetColors *wcol, rcti *rect, int state, int roundbox } -static void widget_roundbut(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign) +static void widget_roundbut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign) { uiWidgetBase wtb; float rad= 5.0f; //0.5f*(rect->ymax - rect->ymin); @@ -2779,7 +2793,7 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct widget_draw_text_icon(&style->widgetlabel, &tui->wcol_menu_back, but, rect); break; case SEPR: - ui_draw_separator(but, rect, &tui->wcol_menu_item); + ui_draw_separator(rect, &tui->wcol_menu_item); break; default: @@ -2965,7 +2979,7 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct } } -void ui_draw_menu_back(uiStyle *style, uiBlock *block, rcti *rect) +void ui_draw_menu_back(uiStyle *UNUSED(style), uiBlock *block, rcti *rect) { uiWidgetType *wt= widget_type(UI_WTYPE_MENU_BACK); @@ -2977,7 +2991,7 @@ void ui_draw_menu_back(uiStyle *style, uiBlock *block, rcti *rect) } -void ui_draw_search_back(uiStyle *style, uiBlock *block, rcti *rect) +void ui_draw_search_back(uiStyle *UNUSED(style), uiBlock *block, rcti *rect) { uiWidgetType *wt= widget_type(UI_WTYPE_BOX); diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index 14ec7c6d0d6..a17d578fc06 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -967,7 +967,7 @@ static void view2d_map_cur_using_mask(View2D *v2d, rctf *curmasked) } /* Set view matrices to use 'cur' rect as viewing frame for View2D drawing */ -void UI_view2d_view_ortho(const bContext *C, View2D *v2d) +void UI_view2d_view_ortho(View2D *v2d) { rctf curmasked; float xofs, yofs; @@ -997,9 +997,8 @@ void UI_view2d_view_ortho(const bContext *C, View2D *v2d) /* Set view matrices to only use one axis of 'cur' only * - xaxis = if non-zero, only use cur x-axis, otherwise use cur-yaxis (mostly this will be used for x) */ -void UI_view2d_view_orthoSpecial(const bContext *C, View2D *v2d, short xaxis) +void UI_view2d_view_orthoSpecial(ARegion *ar, View2D *v2d, short xaxis) { - ARegion *ar= CTX_wm_region(C); rctf curmasked; float xofs, yofs; @@ -1098,12 +1097,12 @@ static void step_to_grid(float *step, int *power, int unit) * * - xunits,yunits = V2D_UNIT_* grid steps in seconds or frames * - xclamp,yclamp = V2D_CLAMP_* only show whole-number intervals - * - winx = width of region we're drawing to + * - winx = width of region we're drawing to, note: not used but keeping for completeness. * - winy = height of region we're drawing into */ -View2DGrid *UI_view2d_grid_calc(const bContext *C, View2D *v2d, short xunits, short xclamp, short yunits, short yclamp, int winx, int winy) +View2DGrid *UI_view2d_grid_calc(Scene *scene, View2D *v2d, short xunits, short xclamp, short yunits, short yclamp, int UNUSED(winx), int winy) { - Scene *scene= CTX_data_scene(C); + View2DGrid *grid; float space, pixels, seconddiv; int secondgrid; @@ -1174,7 +1173,7 @@ View2DGrid *UI_view2d_grid_calc(const bContext *C, View2D *v2d, short xunits, sh } /* Draw gridlines in the given 2d-region */ -void UI_view2d_grid_draw(const bContext *C, View2D *v2d, View2DGrid *grid, int flag) +void UI_view2d_grid_draw(View2D *v2d, View2DGrid *grid, int flag) { float vec1[2], vec2[2]; int a, step; @@ -1283,7 +1282,7 @@ void UI_view2d_grid_draw(const bContext *C, View2D *v2d, View2DGrid *grid, int f } /* Draw a constant grid in given 2d-region */ -void UI_view2d_constant_grid_draw(const bContext *C, View2D *v2d) +void UI_view2d_constant_grid_draw(View2D *v2d) { float start, step= 25.0f; @@ -1481,7 +1480,7 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, short scrollers->yclamp= yclamp; scrollers->yunits= yunits; - scrollers->grid= UI_view2d_grid_calc(C, v2d, xunits, xclamp, yunits, yclamp, (hor.xmax - hor.xmin), (vert.ymax - vert.ymin)); + scrollers->grid= UI_view2d_grid_calc(CTX_data_scene(C), v2d, xunits, xclamp, yunits, yclamp, (hor.xmax - hor.xmin), (vert.ymax - vert.ymin)); } /* return scrollers */ @@ -1489,7 +1488,7 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, short } /* Print scale marking along a time scrollbar */ -static void scroll_printstr(View2DScrollers *scrollers, Scene *scene, float x, float y, float val, int power, short unit, char dir) +static void scroll_printstr(Scene *scene, float x, float y, float val, int power, short unit, char dir) { int len; char str[32]; @@ -1614,16 +1613,16 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v switch (vs->xunits) { case V2D_UNIT_FRAMES: /* frames (as whole numbers)*/ - scroll_printstr(vs, scene, fac, h, val, grid->powerx, V2D_UNIT_FRAMES, 'h'); + scroll_printstr(scene, fac, h, val, grid->powerx, V2D_UNIT_FRAMES, 'h'); break; case V2D_UNIT_FRAMESCALE: /* frames (not always as whole numbers) */ - scroll_printstr(vs, scene, fac, h, val, grid->powerx, V2D_UNIT_FRAMESCALE, 'h'); + scroll_printstr(scene, fac, h, val, grid->powerx, V2D_UNIT_FRAMESCALE, 'h'); break; case V2D_UNIT_SECONDS: /* seconds */ fac2= val/(float)FPS; - scroll_printstr(vs, scene, fac, h, fac2, grid->powerx, V2D_UNIT_SECONDS, 'h'); + scroll_printstr(scene, fac, h, fac2, grid->powerx, V2D_UNIT_SECONDS, 'h'); break; case V2D_UNIT_SECONDSSEQ: /* seconds with special calculations (only used for sequencer only) */ @@ -1634,13 +1633,13 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v time= (float)floor(fac2); fac2= fac2-time; - scroll_printstr(vs, scene, fac, h, time+(float)FPS*fac2/100.0f, grid->powerx, V2D_UNIT_SECONDSSEQ, 'h'); + scroll_printstr(scene, fac, h, time+(float)FPS*fac2/100.0f, grid->powerx, V2D_UNIT_SECONDSSEQ, 'h'); } break; case V2D_UNIT_DEGREES: /* Graph Editor for rotation Drivers */ /* HACK: although we're drawing horizontal, we make this draw as 'vertical', just to get degree signs */ - scroll_printstr(vs, scene, fac, h, val, grid->powerx, V2D_UNIT_DEGREES, 'v'); + scroll_printstr(scene, fac, h, val, grid->powerx, V2D_UNIT_DEGREES, 'v'); break; } } @@ -1719,7 +1718,7 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v if(fac < vert.ymin+10) continue; - scroll_printstr(vs, scene, (float)(vert.xmax)-2.0f, fac, val, grid->powery, vs->yunits, 'v'); + scroll_printstr(scene, (float)(vert.xmax)-2.0f, fac, val, grid->powery, vs->yunits, 'v'); } BLF_disable_default(BLF_ROTATION); diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index e10f0f20938..48523ec1a5a 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -119,7 +119,7 @@ static int view_pan_init(bContext *C, wmOperator *op) } /* apply transform to view (i.e. adjust 'cur' rect) */ -static void view_pan_apply(bContext *C, wmOperator *op) +static void view_pan_apply(wmOperator *op) { v2dViewPanData *vpd= op->customdata; View2D *v2d= vpd->v2d; @@ -156,7 +156,7 @@ static void view_pan_apply(bContext *C, wmOperator *op) } /* cleanup temp customdata */ -static void view_pan_exit(bContext *C, wmOperator *op) +static void view_pan_exit(wmOperator *op) { if (op->customdata) { MEM_freeN(op->customdata); @@ -172,8 +172,8 @@ static int view_pan_exec(bContext *C, wmOperator *op) if (!view_pan_init(C, op)) return OPERATOR_CANCELLED; - view_pan_apply(C, op); - view_pan_exit(C, op); + view_pan_apply(op); + view_pan_exit(op); return OPERATOR_FINISHED; } @@ -199,8 +199,8 @@ static int view_pan_invoke(bContext *C, wmOperator *op, wmEvent *event) RNA_int_set(op->ptr, "deltax", event->prevx - event->x); RNA_int_set(op->ptr, "deltay", event->prevy - event->y); - view_pan_apply(C, op); - view_pan_exit(C, op); + view_pan_apply(op); + view_pan_exit(op); return OPERATOR_FINISHED; } @@ -236,7 +236,7 @@ static int view_pan_modal(bContext *C, wmOperator *op, wmEvent *event) vpd->lastx= event->x; vpd->lasty= event->y; - view_pan_apply(C, op); + view_pan_apply(op); } break; @@ -247,7 +247,7 @@ static int view_pan_modal(bContext *C, wmOperator *op, wmEvent *event) RNA_int_set(op->ptr, "deltax", (vpd->startx - vpd->lastx)); RNA_int_set(op->ptr, "deltay", (vpd->starty - vpd->lasty)); - view_pan_exit(C, op); + view_pan_exit(op); WM_cursor_restore(CTX_wm_window(C)); WM_operator_name_call(C, "VIEW2D_OT_zoom", WM_OP_INVOKE_DEFAULT, NULL); @@ -260,7 +260,7 @@ static int view_pan_modal(bContext *C, wmOperator *op, wmEvent *event) RNA_int_set(op->ptr, "deltax", (vpd->startx - vpd->lastx)); RNA_int_set(op->ptr, "deltay", (vpd->starty - vpd->lasty)); - view_pan_exit(C, op); + view_pan_exit(op); WM_cursor_restore(CTX_wm_window(C)); return OPERATOR_FINISHED; @@ -271,9 +271,9 @@ static int view_pan_modal(bContext *C, wmOperator *op, wmEvent *event) return OPERATOR_RUNNING_MODAL; } -static int view_pan_cancel(bContext *C, wmOperator *op) +static int view_pan_cancel(bContext *UNUSED(C), wmOperator *op) { - view_pan_exit(C, op); + view_pan_exit(op); return OPERATOR_CANCELLED; } @@ -312,7 +312,7 @@ static int view_scrollright_exec(bContext *C, wmOperator *op) /* also, check if can pan in horizontal axis */ vpd= op->customdata; if (vpd->v2d->keepofs & V2D_LOCKOFS_X) { - view_pan_exit(C, op); + view_pan_exit(op); return OPERATOR_PASS_THROUGH; } @@ -321,8 +321,8 @@ static int view_scrollright_exec(bContext *C, wmOperator *op) RNA_int_set(op->ptr, "deltay", 0); /* apply movement, then we're done */ - view_pan_apply(C, op); - view_pan_exit(C, op); + view_pan_apply(op); + view_pan_exit(op); return OPERATOR_FINISHED; } @@ -356,7 +356,7 @@ static int view_scrollleft_exec(bContext *C, wmOperator *op) /* also, check if can pan in horizontal axis */ vpd= op->customdata; if (vpd->v2d->keepofs & V2D_LOCKOFS_X) { - view_pan_exit(C, op); + view_pan_exit(op); return OPERATOR_PASS_THROUGH; } @@ -365,8 +365,8 @@ static int view_scrollleft_exec(bContext *C, wmOperator *op) RNA_int_set(op->ptr, "deltay", 0); /* apply movement, then we're done */ - view_pan_apply(C, op); - view_pan_exit(C, op); + view_pan_apply(op); + view_pan_exit(op); return OPERATOR_FINISHED; } @@ -399,7 +399,7 @@ static int view_scrolldown_exec(bContext *C, wmOperator *op) /* also, check if can pan in vertical axis */ vpd= op->customdata; if (vpd->v2d->keepofs & V2D_LOCKOFS_Y) { - view_pan_exit(C, op); + view_pan_exit(op); return OPERATOR_PASS_THROUGH; } @@ -408,8 +408,8 @@ static int view_scrolldown_exec(bContext *C, wmOperator *op) RNA_int_set(op->ptr, "deltay", -40); /* apply movement, then we're done */ - view_pan_apply(C, op); - view_pan_exit(C, op); + view_pan_apply(op); + view_pan_exit(op); return OPERATOR_FINISHED; } @@ -443,7 +443,7 @@ static int view_scrollup_exec(bContext *C, wmOperator *op) /* also, check if can pan in vertical axis */ vpd= op->customdata; if (vpd->v2d->keepofs & V2D_LOCKOFS_Y) { - view_pan_exit(C, op); + view_pan_exit(op); return OPERATOR_PASS_THROUGH; } @@ -452,8 +452,8 @@ static int view_scrollup_exec(bContext *C, wmOperator *op) RNA_int_set(op->ptr, "deltay", 40); /* apply movement, then we're done */ - view_pan_apply(C, op); - view_pan_exit(C, op); + view_pan_apply(op); + view_pan_exit(op); return OPERATOR_FINISHED; } @@ -632,7 +632,7 @@ static void view_zoomstep_apply(bContext *C, wmOperator *op) /* --------------- Individual Operators ------------------- */ /* cleanup temp customdata */ -static void view_zoomstep_exit(bContext *C, wmOperator *op) +static void view_zoomstep_exit(wmOperator *op) { if (op->customdata) { MEM_freeN(op->customdata); @@ -654,7 +654,7 @@ static int view_zoomin_exec(bContext *C, wmOperator *op) /* apply movement, then we're done */ view_zoomstep_apply(C, op); - view_zoomstep_exit(C, op); + view_zoomstep_exit(op); return OPERATOR_FINISHED; } @@ -711,7 +711,7 @@ static int view_zoomout_exec(bContext *C, wmOperator *op) /* apply movement, then we're done */ view_zoomstep_apply(C, op); - view_zoomstep_exit(C, op); + view_zoomstep_exit(op); return OPERATOR_FINISHED; } @@ -823,7 +823,7 @@ static void view_zoomdrag_apply(bContext *C, wmOperator *op) } /* cleanup temp customdata */ -static void view_zoomdrag_exit(bContext *C, wmOperator *op) +static void view_zoomdrag_exit(wmOperator *op) { if (op->customdata) { MEM_freeN(op->customdata); @@ -838,7 +838,7 @@ static int view_zoomdrag_exec(bContext *C, wmOperator *op) return OPERATOR_PASS_THROUGH; view_zoomdrag_apply(C, op); - view_zoomdrag_exit(C, op); + view_zoomdrag_exit(op); return OPERATOR_FINISHED; } @@ -873,7 +873,7 @@ static int view_zoomdrag_invoke(bContext *C, wmOperator *op, wmEvent *event) RNA_float_set(op->ptr, "deltay", dy); view_zoomdrag_apply(C, op); - view_zoomdrag_exit(C, op); + view_zoomdrag_exit(op); return OPERATOR_FINISHED; } @@ -985,7 +985,7 @@ static int view_zoomdrag_modal(bContext *C, wmOperator *op, wmEvent *event) RNA_float_set(op->ptr, "deltay", 0); /* free customdata */ - view_zoomdrag_exit(C, op); + view_zoomdrag_exit(op); WM_cursor_restore(CTX_wm_window(C)); return OPERATOR_FINISHED; @@ -1512,7 +1512,7 @@ void VIEW2D_OT_scroller_activate(wmOperatorType *ot) /* ********************************************************* */ /* RESET */ -static int reset_exec(bContext *C, wmOperator *op) +static int reset_exec(bContext *C, wmOperator *UNUSED(op)) { uiStyle *style= U.uistyles.first; ARegion *ar= CTX_wm_region(C); diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c index fc92598591a..e33e24a75ce 100644 --- a/source/blender/editors/mesh/editface.c +++ b/source/blender/editors/mesh/editface.c @@ -68,7 +68,7 @@ #include "mesh_intern.h" /* ***************** XXX **************** */ -static int pupmenu(const char *dummy) {return 0;} +static int pupmenu(const char *UNUSED(dummy)) {return 0;} /* ***************** XXX **************** */ @@ -343,7 +343,7 @@ void select_linked_tfaces_with_seams(int mode, Mesh *me, unsigned int index) // object_tface_flags_changed(OBACT, 0); } -void select_linked_tfaces(bContext *C, Object *ob, short mval[2], int mode) +void select_linked_tfaces(bContext *UNUSED(C), Object *ob, short UNUSED(mval[2]), int mode) { Mesh *me; unsigned int index=0; @@ -464,7 +464,7 @@ int minmax_tface(Object *ob, float *min, float *max) #define ME_SEAM_DONE 2 /* reuse this flag */ -static float edgetag_cut_cost(EditMesh *em, int e1, int e2, int vert) +static float edgetag_cut_cost(int e1, int e2, int vert) { EditVert *v = EM_get_vert_for_index(vert); EditEdge *eed1 = EM_get_edge_for_index(e1), *eed2 = EM_get_edge_for_index(e2); @@ -483,7 +483,7 @@ static float edgetag_cut_cost(EditMesh *em, int e1, int e2, int vert) return cost; } -static void edgetag_add_adjacent(EditMesh *em, Heap *heap, int mednum, int vertnum, int *nedges, int *edges, int *prevedge, float *cost) +static void edgetag_add_adjacent(Heap *heap, int mednum, int vertnum, int *nedges, int *edges, int *prevedge, float *cost) { int startadj, endadj = nedges[vertnum+1]; @@ -495,7 +495,7 @@ static void edgetag_add_adjacent(EditMesh *em, Heap *heap, int mednum, int vertn if (eedadj->f2 & ME_SEAM_DONE) continue; - newcost = cost[mednum] + edgetag_cut_cost(em, mednum, adjnum, vertnum); + newcost = cost[mednum] + edgetag_cut_cost(mednum, adjnum, vertnum); if (cost[adjnum] > newcost) { cost[adjnum] = newcost; @@ -621,8 +621,8 @@ int edgetag_shortest_path(Scene *scene, EditMesh *em, EditEdge *source, EditEdge eed->f2 |= ME_SEAM_DONE; - edgetag_add_adjacent(em, heap, mednum, eed->v1->tmp.l, nedges, edges, prevedge, cost); - edgetag_add_adjacent(em, heap, mednum, eed->v2->tmp.l, nedges, edges, prevedge, cost); + edgetag_add_adjacent(heap, mednum, eed->v1->tmp.l, nedges, edges, prevedge, cost); + edgetag_add_adjacent(heap, mednum, eed->v2->tmp.l, nedges, edges, prevedge, cost); } @@ -819,7 +819,7 @@ void face_borderselect(struct bContext *C, Object *ob, rcti *rect, int select, i view3d_validate_backbuf(&vc); - ibuf = IMB_allocImBuf(sx,sy,32,IB_rect,0); + ibuf = IMB_allocImBuf(sx,sy,32,IB_rect); rt = ibuf->rect; glReadPixels(rect->xmin+vc.ar->winrct.xmin, rect->ymin+vc.ar->winrct.ymin, sx, sy, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect); if(ENDIAN_ORDER==B_ENDIAN) IMB_convert_rgba_to_abgr(ibuf); diff --git a/source/blender/editors/mesh/editmesh.c b/source/blender/editors/mesh/editmesh.c index ff2fad3f551..80df034552d 100644 --- a/source/blender/editors/mesh/editmesh.c +++ b/source/blender/editors/mesh/editmesh.c @@ -78,8 +78,8 @@ editmesh.c: */ /* XXX */ -static void BIF_undo_push(const char *dummy) {} -static void error(const char *dummy) {} +static void BIF_undo_push(const char *UNUSED(arg)) {} +static void error(const char *UNUSED(arg)) {} /* ***************** HASH ********************* */ @@ -91,7 +91,7 @@ static void error(const char *dummy) {} /* ************ ADD / REMOVE / FIND ****************** */ -static void *calloc_em(EditMesh *em, size_t size, size_t nr) +static void *calloc_em(EditMesh *UNUSED(em), size_t size, size_t nr) { return calloc(size, nr); } @@ -447,19 +447,19 @@ int editface_containsEdge(EditFace *efa, EditEdge *eed) /* ************************ stuct EditMesh manipulation ***************************** */ /* fake callocs for fastmalloc below */ -static void *calloc_fastvert(EditMesh *em, size_t size, size_t nr) +static void *calloc_fastvert(EditMesh *em, size_t UNUSED(size), size_t UNUSED(nr)) { EditVert *eve= em->curvert++; eve->fast= 1; return eve; } -static void *calloc_fastedge(EditMesh *em, size_t size, size_t nr) +static void *calloc_fastedge(EditMesh *em, size_t UNUSED(size), size_t UNUSED(nr)) { EditEdge *eed= em->curedge++; eed->fast= 1; return eed; } -static void *calloc_fastface(EditMesh *em, size_t size, size_t nr) +static void *calloc_fastface(EditMesh *em, size_t UNUSED(size), size_t UNUSED(nr)) { EditFace *efa= em->curface++; efa->fast= 1; diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c index 7dac8a465fa..89991015419 100644 --- a/source/blender/editors/mesh/editmesh_add.c +++ b/source/blender/editors/mesh/editmesh_add.c @@ -110,57 +110,95 @@ static short icoface[20][3] = { static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event) { ViewContext vc; - EditVert *eve, *v1; + EditVert *eve; float min[3], max[3]; int done= 0; - + short use_proj; +printf("%d\n", event->val); em_setup_viewcontext(C, &vc); + + use_proj= (vc.scene->toolsettings->snap_flag & SCE_SNAP) && (vc.scene->toolsettings->snap_mode==SCE_SNAP_MODE_FACE); + + invert_m4_m4(vc.obedit->imat, vc.obedit->obmat); INIT_MINMAX(min, max); - for(v1= vc.em->verts.first;v1; v1=v1->next) { - if(v1->f & SELECT) { - DO_MINMAX(v1->co, min, max); + for(eve= vc.em->verts.first; eve; eve= eve->next) { + if(eve->f & SELECT) { + DO_MINMAX(eve->co, min, max); done= 1; } } /* call extrude? */ if(done) { + short rot_src= RNA_boolean_get(op->ptr, "rotate_source"); EditEdge *eed; float vec[3], cent[3], mat[3][3]; float nor[3]= {0.0, 0.0, 0.0}; - /* check for edges that are half selected, use for rotation */ + /* 2D normal calc */ + float mval_f[2]= {(float)event->mval[0], (float)event->mval[1]}; + done= 0; + + /* calculate the normal for selected edges */ for(eed= vc.em->edges.first; eed; eed= eed->next) { - if( (eed->v1->f & SELECT)+(eed->v2->f & SELECT) == SELECT ) { - if(eed->v1->f & SELECT) sub_v3_v3v3(vec, eed->v1->co, eed->v2->co); - else sub_v3_v3v3(vec, eed->v2->co, eed->v1->co); - add_v3_v3(nor, vec); + if(eed->f & SELECT) { + float co1[3], co2[3]; + mul_v3_m4v3(co1, vc.obedit->obmat, eed->v1->co); + mul_v3_m4v3(co2, vc.obedit->obmat, eed->v2->co); + project_float_noclip(vc.ar, co1, co1); + project_float_noclip(vc.ar, co2, co2); + + /* 2D rotate by 90d while adding. + * (x, y) = (y, -x) + * + * accumulate the screenspace normal in 2D, + * with screenspace edge length weighting the result. */ + if(line_point_side_v2(co1, co2, mval_f) >= 0.0f) { + nor[0] += (co1[1] - co2[1]); + nor[1] += -(co1[0] - co2[0]); + } + else { + nor[0] += (co2[1] - co1[1]); + nor[1] += -(co2[0] - co1[0]); + } done= 1; } } - if(done) normalize_v3(nor); + + if(done) { + float view_vec[3], cross[3]; + + /* convert the 2D nomal into 3D */ + mul_mat3_m4_v3(vc.rv3d->viewinv, nor); /* worldspace */ + mul_mat3_m4_v3(vc.obedit->imat, nor); /* local space */ + + /* correct the normal to be aligned on the view plane */ + copy_v3_v3(view_vec, vc.rv3d->viewinv[2]); + mul_mat3_m4_v3(vc.obedit->imat, view_vec); + cross_v3_v3v3(cross, nor, view_vec); + cross_v3_v3v3(nor, view_vec, cross); + normalize_v3(nor); + } /* center */ - add_v3_v3v3(cent, min, max); - mul_v3_fl(cent, 0.5f); - VECCOPY(min, cent); + mid_v3_v3v3(cent, min, max); + copy_v3_v3(min, cent); mul_m4_v3(vc.obedit->obmat, min); // view space view3d_get_view_aligned_coordinate(&vc, min, event->mval); - invert_m4_m4(vc.obedit->imat, vc.obedit->obmat); mul_m4_v3(vc.obedit->imat, min); // back in object space - sub_v3_v3v3(min, min, cent); + sub_v3_v3(min, cent); /* calculate rotation */ unit_m3(mat); if(done) { float dot; - VECCOPY(vec, min); + copy_v3_v3(vec, min); normalize_v3(vec); dot= INPR(vec, nor); @@ -170,16 +208,26 @@ static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event) cross_v3_v3v3(cross, nor, vec); normalize_v3(cross); dot= 0.5f*saacos(dot); + + /* halve the rotation if its applied twice */ + if(rot_src) dot *= 0.5f; + si= (float)sin(dot); q1[0]= (float)cos(dot); q1[1]= cross[0]*si; q1[2]= cross[1]*si; - q1[3]= cross[2]*si; - + q1[3]= cross[2]*si; quat_to_mat3( mat,q1); } } + if(rot_src) { + rotateflag(vc.em, SELECT, cent, mat); + /* also project the source, for retopo workflow */ + if(use_proj) + EM_project_snap_verts(C, vc.ar, vc.obedit, vc.em); + } + extrudeflag(vc.obedit, vc.em, SELECT, nor, 0); rotateflag(vc.em, SELECT, cent, mat); translateflag(vc.em, SELECT, min); @@ -190,7 +238,7 @@ static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event) float mat[3][3],imat[3][3]; float *curs= give_cursor(vc.scene, vc.v3d); - VECCOPY(min, curs); + copy_v3_v3(min, curs); view3d_get_view_aligned_coordinate(&vc, min, event->mval); eve= addvertlist(vc.em, 0, NULL); @@ -198,14 +246,16 @@ static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event) copy_m3_m4(mat, vc.obedit->obmat); invert_m3_m3(imat, mat); - VECCOPY(eve->co, min); + copy_v3_v3(eve->co, min); mul_m3_v3(imat, eve->co); sub_v3_v3v3(eve->co, eve->co, vc.obedit->obmat[3]); eve->f= SELECT; } - - //retopo_do_all(); + + if(use_proj) + EM_project_snap_verts(C, vc.ar, vc.obedit, vc.em); + WM_event_add_notifier(C, NC_GEOM|ND_DATA, vc.obedit->data); DAG_id_flush_update(vc.obedit->data, OB_RECALC_DATA); @@ -225,6 +275,8 @@ void MESH_OT_dupli_extrude_cursor(wmOperatorType *ot) /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + + RNA_def_boolean(ot->srna, "rotate_source", 1, "Rotate Source", "Rotate initial selection giving better shape"); } @@ -997,15 +1049,13 @@ static void make_prim(Object *obedit, int type, float mat[4][4], int tot, int se /* one segment first: the X axis */ phi = (2*dia)/(float)(tot-1); phid = (2*dia)/(float)(seg-1); - for(a=0;a<tot;a++) { + for(a=tot-1;a>=0;a--) { vec[0] = (phi*a) - dia; vec[1]= - dia; vec[2]= 0.0f; eve= addvertlist(em, vec, NULL); eve->f= 1+2+4; - if (a) { - addedgelist(em, eve->prev, eve, NULL); - } + addedgelist(em, eve->prev, eve, NULL); } /* extrude and translate */ vec[0]= vec[2]= 0.0; @@ -1657,7 +1707,7 @@ void MESH_OT_primitive_ico_sphere_add(wmOperatorType *ot) /****************** add duplicate operator ***************/ -static int mesh_duplicate_exec(bContext *C, wmOperator *op) +static int mesh_duplicate_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh(ob->data); @@ -1672,7 +1722,7 @@ static int mesh_duplicate_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int mesh_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int mesh_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { WM_cursor_wait(1); mesh_duplicate_exec(C, op); diff --git a/source/blender/editors/mesh/editmesh_lib.c b/source/blender/editors/mesh/editmesh_lib.c index d34cca0d358..b632cb2a842 100644 --- a/source/blender/editors/mesh/editmesh_lib.c +++ b/source/blender/editors/mesh/editmesh_lib.c @@ -58,6 +58,7 @@ editmesh_lib: generic (no UI, no menus) operations/evaluators for editmesh data #include "ED_mesh.h" #include "ED_screen.h" #include "ED_view3d.h" +#include "ED_transform.h" #include "mesh_intern.h" @@ -214,7 +215,7 @@ static int EM_check_selection(EditMesh *em, void *data) return 0; } -void EM_remove_selection(EditMesh *em, void *data, int type) +void EM_remove_selection(EditMesh *em, void *data, int UNUSED(type)) { EditSelection *ese; for(ese=em->selected.first; ese; ese = ese->next){ @@ -1050,7 +1051,7 @@ static void set_edge_directions_f2(EditMesh *em, int val) /* individual face extrude */ /* will use vertex normals for extrusion directions, so *nor is unaffected */ -short extrudeflag_face_indiv(EditMesh *em, short flag, float *nor) +short extrudeflag_face_indiv(EditMesh *em, short UNUSED(flag), float *UNUSED(nor)) { EditVert *eve, *v1, *v2, *v3, *v4; EditEdge *eed; @@ -1204,7 +1205,7 @@ short extrudeflag_edges_indiv(EditMesh *em, short flag, float *nor) } /* extrudes individual vertices */ -short extrudeflag_verts_indiv(EditMesh *em, short flag, float *nor) +short extrudeflag_verts_indiv(EditMesh *em, short flag, float *UNUSED(nor)) { EditVert *eve; @@ -1230,7 +1231,7 @@ short extrudeflag_verts_indiv(EditMesh *em, short flag, float *nor) /* this is actually a recode of extrudeflag(), using proper edge/face select */ /* hurms, doesnt use 'flag' yet, but its not called by primitive making stuff anyway */ -static short extrudeflag_edge(Object *obedit, EditMesh *em, short flag, float *nor, int all) +static short extrudeflag_edge(Object *obedit, EditMesh *em, short UNUSED(flag), float *nor, int all) { /* all select edges/faces: extrude */ /* old select is cleared, in new ones it is set */ @@ -2765,3 +2766,18 @@ int EM_deselect_nth(EditMesh *em, int nth) return 0; } +void EM_project_snap_verts(bContext *C, ARegion *ar, Object *obedit, EditMesh *em) +{ + EditVert *eve; + for(eve= em->verts.first;eve; eve=eve->next) { + if(eve->f & SELECT) { + float mval[2], vec[3], no_dummy[3]; + int dist_dummy; + mul_v3_m4v3(vec, obedit->obmat, eve->co); + project_float_noclip(ar, vec, mval); + if(snapObjectsContext(C, mval, &dist_dummy, vec, no_dummy, SNAP_NOT_OBEDIT)) { + mul_v3_m4v3(eve->co, obedit->imat, vec); + } + } + } +} diff --git a/source/blender/editors/mesh/editmesh_loop.c b/source/blender/editors/mesh/editmesh_loop.c index 682fbca5072..7595e0d2fe1 100644 --- a/source/blender/editors/mesh/editmesh_loop.c +++ b/source/blender/editors/mesh/editmesh_loop.c @@ -69,9 +69,9 @@ editmesh_loop: tools with own drawing subloops, select, knife, subdiv #include "mesh_intern.h" /* **** XXX ******** */ -static void BIF_undo_push(const char *dummy) {} +static void BIF_undo_push(const char *UNUSED(arg)) {} static void BIF_undo() {} -static void error(const char *dummy) {} +static void error(const char *UNUSED(arg)) {} static int qtest() {return 0;} /* **** XXX ******** */ diff --git a/source/blender/editors/mesh/editmesh_mods.c b/source/blender/editors/mesh/editmesh_mods.c index 164e8980b83..ab01a773020 100644 --- a/source/blender/editors/mesh/editmesh_mods.c +++ b/source/blender/editors/mesh/editmesh_mods.c @@ -83,8 +83,8 @@ editmesh_mods.c, UI level access, no geometry changes #include "BLO_sys_types.h" // for intptr_t support /* XXX */ -static void waitcursor(int val) {} -static int pupmenu(const char *dummy) {return 0;} +static void waitcursor(int UNUSED(val)) {} +static int pupmenu(const char *UNUSED(arg)) {return 0;} /* ****************************** MIRROR **************** */ @@ -475,7 +475,7 @@ static float labda_PdistVL2Dfl( float *v1, float *v2, float *v3) } /* note; uses v3d, so needs active 3d window */ -static void findnearestedge__doClosest(void *userData, EditEdge *eed, int x0, int y0, int x1, int y1, int index) +static void findnearestedge__doClosest(void *userData, EditEdge *eed, int x0, int y0, int x1, int y1, int UNUSED(index)) { struct { ViewContext vc; float mval[2]; int dist; EditEdge *closest; } *data = userData; float v1[2], v2[2]; @@ -544,7 +544,7 @@ EditEdge *findnearestedge(ViewContext *vc, int *dist) } } -static void findnearestface__getDistance(void *userData, EditFace *efa, int x, int y, int index) +static void findnearestface__getDistance(void *userData, EditFace *efa, int x, int y, int UNUSED(index)) { struct { short mval[2]; int dist; EditFace *toFace; } *data = userData; @@ -1252,7 +1252,7 @@ static int select_similar_exec(bContext *C, wmOperator *op) return similar_face_select_exec(C, op); } -static EnumPropertyItem *select_similar_type_itemf(bContext *C, PointerRNA *ptr, int *free) +static EnumPropertyItem *select_similar_type_itemf(bContext *C, PointerRNA *UNUSED(ptr), int *free) { Object *obedit= CTX_data_edit_object(C); EnumPropertyItem *item= NULL; @@ -2207,7 +2207,7 @@ static void mouse_mesh_shortest_path(bContext *C, short mval[2]) } -static int mesh_shortest_path_select_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int mesh_shortest_path_select_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event) { view3d_operator_needs_opengl(C); @@ -2618,7 +2618,7 @@ static int select_linked_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int select_linked_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int select_linked_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { linked_limit_default(C, op); return select_linked_exec(C, op); @@ -2815,7 +2815,7 @@ void EM_reveal_mesh(EditMesh *em) // DAG_id_flush_update(obedit->data, OB_RECALC_DATA); } -static int reveal_mesh_exec(bContext *C, wmOperator *op) +static int reveal_mesh_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data)); @@ -3360,7 +3360,7 @@ void EM_select_swap(EditMesh *em) /* exported for UV */ } -static int select_inverse_mesh_exec(bContext *C, wmOperator *op) +static int select_inverse_mesh_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data)); @@ -3493,7 +3493,7 @@ void EM_select_more(EditMesh *em) } } -static int select_more(bContext *C, wmOperator *op) +static int select_more(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data)) ; @@ -3584,7 +3584,7 @@ void EM_select_less(EditMesh *em) } } -static int select_less(bContext *C, wmOperator *op) +static int select_less(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data)); @@ -4490,7 +4490,7 @@ void flipface(EditMesh *em, EditFace *efa) } -static int flip_normals(bContext *C, wmOperator *op) +static int flip_normals(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data)); diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index eadf0ca120f..66090f14fff 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -80,7 +80,7 @@ editmesh_tool.c: UI called tools for editmesh, geometry changes here, otherwise #include "mesh_intern.h" /* XXX */ -static void waitcursor(int val) {} +static void waitcursor(int UNUSED(val)) {} #define add_numbut(a, b, c, d, e, f, g) {} /* XXX */ @@ -511,7 +511,7 @@ void MESH_OT_remove_doubles(wmOperatorType *ot) // XXX is this needed? /* called from buttons */ -static void xsortvert_flag__doSetX(void *userData, EditVert *eve, int x, int y, int index) +static void xsortvert_flag__doSetX(void *userData, EditVert *UNUSED(eve), int x, int UNUSED(y), int index) { xvertsort *sortblock = userData; @@ -616,7 +616,7 @@ void hashvert_flag(EditMesh *em, int flag) } /* generic extern called extruder */ -void extrude_mesh(Scene *scene, Object *obedit, EditMesh *em, wmOperator *op, short type) +static void extrude_mesh(Object *obedit, EditMesh *em, wmOperator *op, short type) { float nor[3]= {0.0, 0.0, 0.0}; short transmode= 0; @@ -664,13 +664,12 @@ void extrude_mesh(Scene *scene, Object *obedit, EditMesh *em, wmOperator *op, sh } // XXX should be a menu item -static int mesh_extrude_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int mesh_extrude_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { - Scene *scene= CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); - extrude_mesh(scene, obedit, em, op, RNA_int_get(op->ptr, "type")); + extrude_mesh(obedit, em, op, RNA_int_get(op->ptr, "type")); BKE_mesh_end_editmesh(obedit->data, em); @@ -683,11 +682,10 @@ static int mesh_extrude_invoke(bContext *C, wmOperator *op, wmEvent *event) /* extrude without transform */ static int mesh_extrude_exec(bContext *C, wmOperator *op) { - Scene *scene= CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh(obedit->data); - extrude_mesh(scene, obedit, em, op, RNA_int_get(op->ptr, "type")); + extrude_mesh(obedit, em, op, RNA_int_get(op->ptr, "type")); DAG_id_flush_update(obedit->data, OB_RECALC_DATA); WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); @@ -704,7 +702,7 @@ EnumPropertyItem extrude_items[] = { {0, NULL, 0, NULL, NULL}}; -static EnumPropertyItem *extrude_itemf(bContext *C, PointerRNA *ptr, int *free) +static EnumPropertyItem *extrude_itemf(bContext *C, PointerRNA *UNUSED(ptr), int *free) { EnumPropertyItem *item= NULL; Object *obedit= CTX_data_edit_object(C); @@ -796,7 +794,7 @@ void MESH_OT_extrude(wmOperatorType *ot) ot->prop= prop; } -static int split_mesh(bContext *C, wmOperator *op) +static int split_mesh(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); @@ -1000,7 +998,7 @@ static int spin_mesh_exec(bContext *C, wmOperator *op) } /* get center and axis, in global coords */ -static int spin_mesh_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int spin_mesh_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Scene *scene = CTX_data_scene(C); View3D *v3d = CTX_wm_view3d(C); @@ -1108,7 +1106,7 @@ static int screw_mesh_exec(bContext *C, wmOperator *op) } /* get center and axis, in global coords */ -static int screw_mesh_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int screw_mesh_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Scene *scene = CTX_data_scene(C); View3D *v3d = CTX_wm_view3d(C); @@ -1189,7 +1187,7 @@ static void erase_vertices(EditMesh *em, ListBase *l) } } -void delete_mesh(Object *obedit, EditMesh *em, wmOperator *op, int event) +static void delete_mesh(EditMesh *em, wmOperator *op, int event) { EditFace *efa, *nextvl; EditVert *eve,*nextve; @@ -1347,7 +1345,7 @@ static int delete_mesh_exec(bContext *C, wmOperator *op) if(type==6) return WM_operator_name_call(C, "MESH_OT_delete_edgeloop", WM_OP_EXEC_DEFAULT, NULL); - delete_mesh(obedit, em, op, type); + delete_mesh(em, op, type); DAG_id_flush_update(obedit->data, OB_RECALC_DATA); WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); @@ -4703,7 +4701,7 @@ useless: } #endif // END OF XXX -int EdgeLoopDelete(EditMesh *em, wmOperator *op) +int EdgeLoopDelete(EditMesh *UNUSED(em), wmOperator *UNUSED(op)) { #if 0 //XXX won't work with new edgeslide @@ -5185,7 +5183,7 @@ static int blend_from_shape_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static EnumPropertyItem *shape_itemf(bContext *C, PointerRNA *ptr, int *free) +static EnumPropertyItem *shape_itemf(bContext *C, PointerRNA *UNUSED(ptr), int *free) { Object *obedit= CTX_data_edit_object(C); Mesh *me= (obedit) ? obedit->data : NULL; @@ -5884,7 +5882,7 @@ static EnumPropertyItem merge_type_items[]= { {5, "COLLAPSE", 0, "Collapse", ""}, {0, NULL, 0, NULL, NULL}}; -static EnumPropertyItem *merge_type_itemf(bContext *C, PointerRNA *ptr, int *free) +static EnumPropertyItem *merge_type_itemf(bContext *C, PointerRNA *UNUSED(ptr), int *free) { Object *obedit= CTX_data_edit_object(C); EnumPropertyItem *item= NULL; @@ -6144,7 +6142,7 @@ void MESH_OT_select_vertex_path(wmOperatorType *ot) /********************** Region/Loop Operators *************************/ -static int region_to_loop(bContext *C, wmOperator *op) +static int region_to_loop(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); @@ -6325,7 +6323,7 @@ static int loop_bisect(EditMesh *em, Collection *edgecollection){ else return(2); } -static int loop_to_region(bContext *C, wmOperator *op) +static int loop_to_region(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); @@ -7003,7 +7001,7 @@ static void fill_mesh(EditMesh *em) } } - if(BLI_edgefill(0, em->mat_nr)) { + if(BLI_edgefill(em->mat_nr)) { efa= fillfacebase.first; while(efa) { /* normals default pointing up */ @@ -7022,7 +7020,7 @@ static void fill_mesh(EditMesh *em) } -static int fill_mesh_exec(bContext *C, wmOperator *op) +static int fill_mesh_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); @@ -7053,7 +7051,7 @@ void MESH_OT_fill(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int beautify_fill_exec(bContext *C, wmOperator *op) +static int beautify_fill_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); @@ -7263,7 +7261,7 @@ void MESH_OT_sort_faces(wmOperatorType *ot) /********************** Quad/Tri Operators *************************/ -static int quads_convert_to_tris_exec(bContext *C, wmOperator *op) +static int quads_convert_to_tris_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); @@ -7292,7 +7290,7 @@ void MESH_OT_quads_convert_to_tris(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int tris_convert_to_quads_exec(bContext *C, wmOperator *op) +static int tris_convert_to_quads_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); @@ -7321,7 +7319,7 @@ void MESH_OT_tris_convert_to_quads(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int edge_flip_exec(bContext *C, wmOperator *op) +static int edge_flip_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); @@ -7366,7 +7364,7 @@ static void mesh_set_smooth_faces(EditMesh *em, short smooth) } } -static int mesh_faces_shade_smooth_exec(bContext *C, wmOperator *op) +static int mesh_faces_shade_smooth_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); @@ -7396,7 +7394,7 @@ void MESH_OT_faces_shade_smooth(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int mesh_faces_shade_flat_exec(bContext *C, wmOperator *op) +static int mesh_faces_shade_flat_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); diff --git a/source/blender/editors/mesh/loopcut.c b/source/blender/editors/mesh/loopcut.c index 13538a6f218..ac65a3c21d3 100644 --- a/source/blender/editors/mesh/loopcut.c +++ b/source/blender/editors/mesh/loopcut.c @@ -94,7 +94,7 @@ typedef struct tringselOpData { } tringselOpData; /* modal loop selection drawing callback */ -static void ringsel_draw(const bContext *C, ARegion *ar, void *arg) +static void ringsel_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void *arg) { int i; tringselOpData *lcd = arg; @@ -248,7 +248,7 @@ static void edgering_sel(tringselOpData *lcd, int previewlines, int select) lcd->totedge = tot; } -static void ringsel_find_edge(tringselOpData *lcd, const bContext *C, ARegion *ar, int cuts) +static void ringsel_find_edge(tringselOpData *lcd, int cuts) { if (lcd->eed) { edgering_sel(lcd, cuts, 0); @@ -293,7 +293,7 @@ static void ringsel_finish(bContext *C, wmOperator *op) } /* called when modal loop selection is done... */ -static void ringsel_exit (bContext *C, wmOperator *op) +static void ringsel_exit(wmOperator *op) { tringselOpData *lcd= op->customdata; @@ -332,10 +332,10 @@ static int ringsel_init (bContext *C, wmOperator *op, int do_cut) return 1; } -static int ringcut_cancel (bContext *C, wmOperator *op) +static int ringcut_cancel (bContext *UNUSED(C), wmOperator *op) { /* this is just a wrapper around exit() */ - ringsel_exit(C, op); + ringsel_exit(op); return OPERATOR_CANCELLED; } @@ -353,7 +353,7 @@ static int ringsel_invoke (bContext *C, wmOperator *op, wmEvent *evt) lcd = op->customdata; if (lcd->em->selectmode == SCE_SELECT_FACE) { - ringsel_exit(C, op); + ringsel_exit(op); WM_operator_name_call(C, "MESH_OT_loop_select", WM_OP_INVOKE_REGION_WIN, NULL); return OPERATOR_CANCELLED; } @@ -363,15 +363,15 @@ static int ringsel_invoke (bContext *C, wmOperator *op, wmEvent *evt) edge = findnearestedge(&lcd->vc, &dist); if(!edge) { - ringsel_exit(C, op); + ringsel_exit(op); return OPERATOR_CANCELLED; } lcd->eed = edge; - ringsel_find_edge(lcd, C, lcd->ar, 1); + ringsel_find_edge(lcd, 1); ringsel_finish(C, op); - ringsel_exit(C, op); + ringsel_exit(op); return OPERATOR_FINISHED; } @@ -397,7 +397,7 @@ static int ringcut_invoke (bContext *C, wmOperator *op, wmEvent *evt) edge = findnearestedge(&lcd->vc, &dist); if (edge != lcd->eed) { lcd->eed = edge; - ringsel_find_edge(lcd, C, lcd->ar, 1); + ringsel_find_edge(lcd, 1); } return OPERATOR_RUNNING_MODAL; @@ -418,7 +418,7 @@ static int ringcut_modal (bContext *C, wmOperator *op, wmEvent *event) ED_region_tag_redraw(lcd->ar); ringsel_finish(C, op); - ringsel_exit(C, op); + ringsel_exit(op); return OPERATOR_FINISHED; } @@ -441,7 +441,7 @@ static int ringcut_modal (bContext *C, wmOperator *op, wmEvent *event) if (event->val == KM_PRESS) { cuts++; RNA_int_set(op->ptr, "number_cuts",cuts); - ringsel_find_edge(lcd, C, lcd->ar, cuts); + ringsel_find_edge(lcd, cuts); ED_region_tag_redraw(lcd->ar); } @@ -451,7 +451,7 @@ static int ringcut_modal (bContext *C, wmOperator *op, wmEvent *event) if (event->val == KM_PRESS) { cuts=MAX2(cuts-1,1); RNA_int_set(op->ptr,"number_cuts",cuts); - ringsel_find_edge(lcd, C, lcd->ar,cuts); + ringsel_find_edge(lcd, cuts); ED_region_tag_redraw(lcd->ar); } @@ -466,7 +466,7 @@ static int ringcut_modal (bContext *C, wmOperator *op, wmEvent *event) if (edge != lcd->eed) { lcd->eed = edge; - ringsel_find_edge(lcd, C, lcd->ar, cuts); + ringsel_find_edge(lcd, cuts); } ED_region_tag_redraw(lcd->ar); diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c index d1c6ff4c4ae..080151a8dca 100644 --- a/source/blender/editors/mesh/mesh_data.c +++ b/source/blender/editors/mesh/mesh_data.c @@ -157,7 +157,7 @@ static void delete_customdata_layer(bContext *C, Object *ob, CustomDataLayer *la } } -int ED_mesh_uv_texture_add(bContext *C, Scene *scene, Object *ob, Mesh *me, const char *name, int active_set) +int ED_mesh_uv_texture_add(bContext *C, Mesh *me, const char *name, int active_set) { EditMesh *em; int layernum; @@ -286,13 +286,12 @@ static int layers_poll(bContext *C) return (ob && !ob->id.lib && ob->type==OB_MESH && data && !data->lib); } -static int uv_texture_add_exec(bContext *C, wmOperator *op) +static int uv_texture_add_exec(bContext *C, wmOperator *UNUSED(op)) { - Scene *scene= CTX_data_scene(C); Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; Mesh *me= ob->data; - if(!ED_mesh_uv_texture_add(C, scene, ob, me, NULL, TRUE)) + if(!ED_mesh_uv_texture_add(C, me, NULL, TRUE)) return OPERATOR_CANCELLED; return OPERATOR_FINISHED; @@ -334,8 +333,7 @@ static int drop_named_image_invoke(bContext *C, wmOperator *op, wmEvent *event) char path[FILE_MAX]; RNA_string_get(op->ptr, "filepath", path); - ima= BKE_add_image_file(path, - scene ? scene->r.cfra : 1); + ima= BKE_add_image_file(path); } else { RNA_string_get(op->ptr, "name", name); @@ -392,7 +390,7 @@ void MESH_OT_drop_named_image(wmOperatorType *ot) RNA_def_string(ot->srna, "filepath", "Path", FILE_MAX, "Filepath", "Path to image file"); } -static int uv_texture_remove_exec(bContext *C, wmOperator *op) +static int uv_texture_remove_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; Mesh *me= ob->data; @@ -420,7 +418,7 @@ void MESH_OT_uv_texture_remove(wmOperatorType *ot) /*********************** vertex color operators ************************/ -static int vertex_color_add_exec(bContext *C, wmOperator *op) +static int vertex_color_add_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; @@ -447,7 +445,7 @@ void MESH_OT_vertex_color_add(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int vertex_color_remove_exec(bContext *C, wmOperator *op) +static int vertex_color_remove_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; Mesh *me= ob->data; @@ -475,7 +473,7 @@ void MESH_OT_vertex_color_remove(wmOperatorType *ot) /*********************** sticky operators ************************/ -static int sticky_add_exec(bContext *C, wmOperator *op) +static int sticky_add_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); View3D *v3d= CTX_wm_view3d(C); @@ -508,7 +506,7 @@ void MESH_OT_sticky_add(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int sticky_remove_exec(bContext *C, wmOperator *op) +static int sticky_remove_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; Mesh *me= ob->data; diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c index fa055a385f3..2ff7095cfea 100644 --- a/source/blender/editors/mesh/mesh_ops.c +++ b/source/blender/editors/mesh/mesh_ops.c @@ -262,7 +262,7 @@ void ED_keymap_mesh(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "MESH_OT_normals_make_consistent", NKEY, KM_PRESS, KM_CTRL, 0); RNA_boolean_set(WM_keymap_add_item(keymap, "MESH_OT_normals_make_consistent", NKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0)->ptr, "inside", 1); - WM_keymap_add_item(keymap, "view3d.edit_mesh_extrude_move_normal", EKEY, KM_PRESS, 0, 0); + WM_keymap_add_item(keymap, "VIEW3D_OT_edit_mesh_extrude_move_normal", EKEY, KM_PRESS, 0, 0); /* python operator */ WM_keymap_add_item(keymap, "VIEW3D_OT_edit_mesh_extrude_individual_move", EKEY, KM_PRESS, KM_SHIFT, 0); WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_mesh_extrude", EKEY, KM_PRESS, KM_ALT, 0); @@ -292,7 +292,8 @@ void ED_keymap_mesh(wmKeyConfig *keyconf) /* use KM_CLICK because same key is used for tweaks */ WM_keymap_add_item(keymap, "MESH_OT_dupli_extrude_cursor", ACTIONMOUSE, KM_CLICK, KM_CTRL, 0); - + RNA_boolean_set(WM_keymap_add_item(keymap, "MESH_OT_dupli_extrude_cursor", ACTIONMOUSE, KM_CLICK, KM_SHIFT|KM_CTRL, 0)->ptr, "rotate_source", 0); + WM_keymap_add_item(keymap, "MESH_OT_delete", XKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "MESH_OT_delete", DELKEY, KM_PRESS, 0, 0); diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c index e8c787b168f..d8b34311e76 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -84,7 +84,7 @@ /* join selected meshes into the active mesh, context sensitive return 0 if no join is made (error) and 1 of the join is done */ -int join_mesh_exec(bContext *C, wmOperator *op) +int join_mesh_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); @@ -1104,14 +1104,14 @@ static EditVert *editmesh_get_x_mirror_vert_topo(Object *ob, struct EditMesh *em if(poinval != -1) return (EditVert *)(poinval); return NULL; -} +} EditVert *editmesh_get_x_mirror_vert(Object *ob, struct EditMesh *em, EditVert *eve, float *co, int index) { if (((Mesh *)ob->data)->editflag & ME_EDIT_MIRROR_TOPO) { return editmesh_get_x_mirror_vert_topo(ob, em, eve, index); } else { - return editmesh_get_x_mirror_vert_spacial(ob, em, eve->co); + return editmesh_get_x_mirror_vert_spacial(ob, em, co); } } diff --git a/source/blender/editors/metaball/mball_edit.c b/source/blender/editors/metaball/mball_edit.c index 80cea4eea1c..ec727d7d82b 100644 --- a/source/blender/editors/metaball/mball_edit.c +++ b/source/blender/editors/metaball/mball_edit.c @@ -84,12 +84,12 @@ void make_editMball(Object *obedit) /* This function is called, when MetaBall Object switched from * edit mode to object mode. List od MetaElements is copied * from object->data->edit_elems to object->data->elems. */ -void load_editMball(Object *obedit) +void load_editMball(Object *UNUSED(obedit)) { } /* Add metaelem primitive to metaball object (which is in edit mode) */ -MetaElem *add_metaball_primitive(bContext *C, float mat[4][4], int type, int newname) +MetaElem *add_metaball_primitive(bContext *C, float mat[4][4], int type, int UNUSED(newname)) { Object *obedit= CTX_data_edit_object(C); MetaBall *mball = (MetaBall*)obedit->data; @@ -177,7 +177,7 @@ void MBALL_OT_select_all(wmOperatorType *ot) /***************************** Select inverse operator *****************************/ /* Invert metaball selection */ -static int select_inverse_metaelems_exec(bContext *C, wmOperator *op) +static int select_inverse_metaelems_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); MetaBall *mb = (MetaBall*)obedit->data; @@ -266,7 +266,7 @@ void MBALL_OT_select_random_metaelems(struct wmOperatorType *ot) /***************************** Duplicate operator *****************************/ /* Duplicate selected MetaElements */ -static int duplicate_metaelems_exec(bContext *C, wmOperator *op) +static int duplicate_metaelems_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); MetaBall *mb = (MetaBall*)obedit->data; @@ -290,7 +290,7 @@ static int duplicate_metaelems_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int duplicate_metaelems_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int duplicate_metaelems_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { int retv= duplicate_metaelems_exec(C, op); @@ -325,7 +325,7 @@ void MBALL_OT_duplicate_metaelems(wmOperatorType *ot) /***************************** Delete operator *****************************/ /* Delete all selected MetaElems (not MetaBall) */ -static int delete_metaelems_exec(bContext *C, wmOperator *op) +static int delete_metaelems_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); MetaBall *mb= (MetaBall*)obedit->data; @@ -420,7 +420,7 @@ void MBALL_OT_hide_metaelems(wmOperatorType *ot) /***************************** Unhide operator *****************************/ /* Unhide all edited MetaElems */ -static int reveal_metaelems_exec(bContext *C, wmOperator *op) +static int reveal_metaelems_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); MetaBall *mb= (MetaBall*)obedit->data; diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 3ae1941035d..56af4ce1b1c 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -161,11 +161,6 @@ float ED_object_new_primitive_matrix(bContext *C, Object *obedit, float *loc, fl /********************* Add Object Operator ********************/ -void add_object_draw(Scene *scene, View3D *v3d, int type) /* for toolbox or menus, only non-editmode stuff */ -{ - /* keep here to get things compile, remove later */ -} - void ED_object_add_generic_props(wmOperatorType *ot, int do_editmode) { PropertyRNA *prop; @@ -218,7 +213,7 @@ static void object_add_generic_invoke_options(bContext *C, wmOperator *op) } } -int ED_object_add_generic_invoke(bContext *C, wmOperator *op, wmEvent *event) +int ED_object_add_generic_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { object_add_generic_invoke_options(C, op); return op->type->exec(C, op); @@ -363,11 +358,6 @@ static EnumPropertyItem field_type_items[] = { {PFIELD_DRAG, "DRAG", ICON_FORCE_DRAG, "Drag", ""}, {0, NULL, 0, NULL, NULL}}; -void add_effector_draw(Scene *scene, View3D *v3d, int type) /* for toolbox or menus, only non-editmode stuff */ -{ - /* keep here to get things compile, remove later */ -} - /* for effector add primitive operators */ static Object *effector_add_type(bContext *C, wmOperator *op, int type) { @@ -537,7 +527,7 @@ static int object_metaball_add_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int object_metaball_add_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int object_metaball_add_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Object *obedit= CTX_data_edit_object(C); uiPopupMenu *pup; @@ -805,7 +795,7 @@ void ED_base_object_free_and_unlink(Main *bmain, Scene *scene, Base *base) MEM_freeN(base); } -static int object_delete_exec(bContext *C, wmOperator *op) +static int object_delete_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); @@ -817,6 +807,10 @@ static int object_delete_exec(bContext *C, wmOperator *op) CTX_DATA_BEGIN(C, Base*, base, selected_bases) { if(base->object->type==OB_LAMP) islamp= 1; + + /* deselect object -- it could be used in other scenes */ + base->object->flag &= ~SELECT; + /* remove from current scene only */ ED_base_object_free_and_unlink(bmain, scene, base); } @@ -851,7 +845,7 @@ void OBJECT_OT_delete(wmOperatorType *ot) /**************************** Copy Utilities ******************************/ -static void copy_object__forwardModifierLinks(void *userData, Object *ob, +static void copy_object__forwardModifierLinks(void *UNUSED(userData), Object *UNUSED(ob), ID **idpoin) { /* this is copied from ID_NEW; it might be better to have a macro */ @@ -1001,7 +995,7 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base) base->object->transflag &= ~OB_DUPLI; } -static int object_duplicates_make_real_exec(bContext *C, wmOperator *op) +static int object_duplicates_make_real_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c index f81e73faf73..0c28d4a608b 100644 --- a/source/blender/editors/object/object_bake.c +++ b/source/blender/editors/object/object_bake.c @@ -69,7 +69,7 @@ /* ****************** render BAKING ********************** */ /* threaded break test */ -static int thread_break(void *unused) +static int thread_break(void *UNUSED(arg)) { return G.afbreek; } @@ -241,7 +241,7 @@ static void bake_freejob(void *bkv) } /* catch esc */ -static int objects_bake_render_modal(bContext *C, wmOperator *op, wmEvent *event) +static int objects_bake_render_modal(bContext *C, wmOperator *UNUSED(op), wmEvent *event) { /* no running blender, remove handler and pass through */ if(0==WM_jobs_test(CTX_wm_manager(C), CTX_data_scene(C))) @@ -256,7 +256,7 @@ static int objects_bake_render_modal(bContext *C, wmOperator *op, wmEvent *event return OPERATOR_PASS_THROUGH; } -static int objects_bake_render_invoke(bContext *C, wmOperator *op, wmEvent *_event) +static int objects_bake_render_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(_event)) { Scene *scene= CTX_data_scene(C); diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index fd3c8b165c0..02c88d4149b 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -511,7 +511,7 @@ static int edit_constraint_invoke_properties(bContext *C, wmOperator *op) return 0; } -static bConstraint *edit_constraint_property_get(bContext *C, wmOperator *op, Object *ob, int type) +static bConstraint *edit_constraint_property_get(wmOperator *op, Object *ob, int type) { char constraint_name[32]; int owner = RNA_enum_get(op->ptr, "owner"); @@ -547,7 +547,7 @@ static bConstraint *edit_constraint_property_get(bContext *C, wmOperator *op, Ob static int stretchto_reset_exec (bContext *C, wmOperator *op) { Object *ob = ED_object_active_context(C); - bConstraint *con = edit_constraint_property_get(C, op, ob, CONSTRAINT_TYPE_STRETCHTO); + bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_STRETCHTO); bStretchToConstraint *data= (con) ? (bStretchToConstraint *)con->data : NULL; /* despite 3 layers of checks, we may still not be able to find a constraint */ @@ -562,7 +562,7 @@ static int stretchto_reset_exec (bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int stretchto_reset_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int stretchto_reset_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_constraint_invoke_properties(C, op)) return stretchto_reset_exec(C, op); @@ -590,7 +590,7 @@ void CONSTRAINT_OT_stretchto_reset (wmOperatorType *ot) static int limitdistance_reset_exec (bContext *C, wmOperator *op) { Object *ob = ED_object_active_context(C); - bConstraint *con = edit_constraint_property_get(C, op, ob, CONSTRAINT_TYPE_DISTLIMIT); + bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_DISTLIMIT); bDistLimitConstraint *data= (con) ? (bDistLimitConstraint *)con->data : NULL; /* despite 3 layers of checks, we may still not be able to find a constraint */ @@ -605,7 +605,7 @@ static int limitdistance_reset_exec (bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int limitdistance_reset_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int limitdistance_reset_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_constraint_invoke_properties(C, op)) return limitdistance_reset_exec(C, op); @@ -636,7 +636,7 @@ static int childof_set_inverse_exec (bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); Object *ob = ED_object_active_context(C); - bConstraint *con = edit_constraint_property_get(C, op, ob, CONSTRAINT_TYPE_CHILDOF); + bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_CHILDOF); bChildOfConstraint *data= (con) ? (bChildOfConstraint *)con->data : NULL; bPoseChannel *pchan= NULL; @@ -692,7 +692,7 @@ static int childof_set_inverse_exec (bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int childof_set_inverse_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int childof_set_inverse_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_constraint_invoke_properties(C, op)) return childof_set_inverse_exec(C, op); @@ -720,7 +720,7 @@ void CONSTRAINT_OT_childof_set_inverse (wmOperatorType *ot) static int childof_clear_inverse_exec (bContext *C, wmOperator *op) { Object *ob = ED_object_active_context(C); - bConstraint *con = edit_constraint_property_get(C, op, ob, CONSTRAINT_TYPE_CHILDOF); + bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_CHILDOF); bChildOfConstraint *data= (con) ? (bChildOfConstraint *)con->data : NULL; /* simply clear the matrix */ @@ -731,7 +731,7 @@ static int childof_clear_inverse_exec (bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int childof_clear_inverse_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int childof_clear_inverse_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_constraint_invoke_properties(C, op)) return childof_clear_inverse_exec(C, op); @@ -794,7 +794,7 @@ static int constraint_poll(bContext *C) return (ptr.id.data && ptr.data); } -static int constraint_delete_exec (bContext *C, wmOperator *op) +static int constraint_delete_exec (bContext *C, wmOperator *UNUSED(op)) { PointerRNA ptr= CTX_data_pointer_get_type(C, "constraint", &RNA_Constraint); Object *ob= ptr.id.data; @@ -837,7 +837,7 @@ void CONSTRAINT_OT_delete (wmOperatorType *ot) static int constraint_move_down_exec (bContext *C, wmOperator *op) { Object *ob = ED_object_active_context(C); - bConstraint *con = edit_constraint_property_get(C, op, ob, 0); + bConstraint *con = edit_constraint_property_get(op, ob, 0); if (con && con->next) { ListBase *conlist= get_constraint_lb(ob, con, NULL); @@ -855,7 +855,7 @@ static int constraint_move_down_exec (bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } -static int constraint_move_down_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int constraint_move_down_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_constraint_invoke_properties(C, op)) return constraint_move_down_exec(C, op); @@ -885,7 +885,7 @@ void CONSTRAINT_OT_move_down (wmOperatorType *ot) static int constraint_move_up_exec (bContext *C, wmOperator *op) { Object *ob = ED_object_active_context(C); - bConstraint *con = edit_constraint_property_get(C, op, ob, 0); + bConstraint *con = edit_constraint_property_get(op, ob, 0); if (con && con->prev) { ListBase *conlist= get_constraint_lb(ob, con, NULL); @@ -903,7 +903,7 @@ static int constraint_move_up_exec (bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } -static int constraint_move_up_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int constraint_move_up_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_constraint_invoke_properties(C, op)) return constraint_move_up_exec(C, op); @@ -932,7 +932,7 @@ void CONSTRAINT_OT_move_up (wmOperatorType *ot) /************************ remove constraint operators *********************/ -static int pose_constraints_clear_exec(bContext *C, wmOperator *op) +static int pose_constraints_clear_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); @@ -969,7 +969,7 @@ void POSE_OT_constraints_clear(wmOperatorType *ot) } -static int object_constraints_clear_exec(bContext *C, wmOperator *op) +static int object_constraints_clear_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); @@ -1047,7 +1047,7 @@ void POSE_OT_constraints_copy(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int object_constraint_copy_exec(bContext *C, wmOperator *op) +static int object_constraint_copy_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); Scene *scene = CTX_data_scene(C); @@ -1466,7 +1466,7 @@ void POSE_OT_constraint_add_with_targets(wmOperatorType *ot) // TODO: should these be here, or back in editors/armature/poseobject.c again? /* present menu with options + validation for targets to use */ -static int pose_ik_add_invoke(bContext *C, wmOperator *op, wmEvent *evt) +static int pose_ik_add_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(evt)) { Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); bPoseChannel *pchan= get_active_posechannel(ob); @@ -1550,7 +1550,7 @@ void POSE_OT_ik_add(wmOperatorType *ot) /* ------------------ */ /* remove IK constraints from selected bones */ -static int pose_ik_clear_exec(bContext *C, wmOperator *op) +static int pose_ik_clear_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index b7f05a2e332..32e49ce3f71 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -97,9 +97,9 @@ #include "object_intern.h" // own include /* ************* XXX **************** */ -static void error(const char *dummy) {} -static void waitcursor(int val) {} -static int pupmenu(const char *msg) {return 0;} +static void error(const char *UNUSED(arg)) {} +static void waitcursor(int UNUSED(val)) {} +static int pupmenu(const char *UNUSED(msg)) {return 0;} /* port over here */ static bContext *C; @@ -120,7 +120,7 @@ Object *ED_object_active_context(bContext *C) /* ********* clear/set restrict view *********/ -static int object_hide_view_clear_exec(bContext *C, wmOperator *op) +static int object_hide_view_clear_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); ScrArea *sa= CTX_wm_area(C); @@ -219,7 +219,7 @@ void OBJECT_OT_hide_view_set(wmOperatorType *ot) } /* 99% same as above except no need for scene refreshing (TODO, update render preview) */ -static int object_hide_render_clear_exec(bContext *C, wmOperator *op) +static int object_hide_render_clear_exec(bContext *C, wmOperator *UNUSED(op)) { short changed= 0; @@ -433,7 +433,7 @@ void ED_object_enter_editmode(bContext *C, int flag) if(ob->type==OB_MESH) { Mesh *me= ob->data; - if(me->pv) mesh_pmv_off(ob, me); + if(me->pv) mesh_pmv_off(me); ok= 1; scene->obedit= ob; // context sees this @@ -506,7 +506,7 @@ void ED_object_enter_editmode(bContext *C, int flag) if(flag & EM_WAITCURSOR) waitcursor(0); } -static int editmode_toggle_exec(bContext *C, wmOperator *op) +static int editmode_toggle_exec(bContext *C, wmOperator *UNUSED(op)) { if(!CTX_data_edit_object(C)) ED_object_enter_editmode(C, EM_WAITCURSOR); @@ -549,7 +549,7 @@ void OBJECT_OT_editmode_toggle(wmOperatorType *ot) /* *************************** */ -static int posemode_exec(bContext *C, wmOperator *op) +static int posemode_exec(bContext *C, wmOperator *UNUSED(op)) { Base *base= CTX_data_active_base(C); @@ -1525,7 +1525,7 @@ void ED_objects_recalculate_paths(bContext *C, Scene *scene) /* For the object with pose/action: create path curves for selected bones * This recalculates the WHOLE path within the pchan->pathsf and pchan->pathef range */ -static int object_calculate_paths_exec (bContext *C, wmOperator *op) +static int object_calculate_paths_exec (bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); @@ -1565,7 +1565,7 @@ void OBJECT_OT_paths_calculate (wmOperatorType *ot) /* --------- */ /* for the object with pose/action: clear path curves for selected bones only */ -void ED_objects_clear_paths(bContext *C, Scene *scene) +void ED_objects_clear_paths(bContext *C) { /* loop over objects in scene */ CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) @@ -1580,12 +1580,10 @@ void ED_objects_clear_paths(bContext *C, Scene *scene) } /* operator callback for this */ -static int object_clear_paths_exec (bContext *C, wmOperator *op) -{ - Scene *scene= CTX_data_scene(C); - +static int object_clear_paths_exec (bContext *C, wmOperator *UNUSED(op)) +{ /* use the backend function for this */ - ED_objects_clear_paths(C, scene); + ED_objects_clear_paths(C); /* notifiers for updates */ WM_event_add_notifier(C, NC_OBJECT|ND_POSE, NULL); @@ -1838,7 +1836,7 @@ void rand_timeoffs(Scene *scene, View3D *v3d) } -static EnumPropertyItem *object_mode_set_itemsf(bContext *C, PointerRNA *ptr, int *free) +static EnumPropertyItem *object_mode_set_itemsf(bContext *C, PointerRNA *UNUSED(ptr), int *free) { EnumPropertyItem *input = object_mode_items; EnumPropertyItem *item= NULL; @@ -1890,7 +1888,7 @@ static const char *object_mode_op_string(int mode) /* checks the mode to be set is compatible with the object * should be made into a generic function */ -static int object_mode_set_compat(bContext *C, wmOperator *op, Object *ob) +static int object_mode_set_compat(bContext *UNUSED(C), wmOperator *op, Object *ob) { ObjectMode mode = RNA_enum_get(op->ptr, "mode"); @@ -1999,7 +1997,7 @@ void ED_object_toggle_modes(bContext *C, int mode) /************************ Game Properties ***********************/ -static int game_property_new(bContext *C, wmOperator *op) +static int game_property_new(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_active_object(C); bProperty *prop; @@ -2082,7 +2080,7 @@ static EnumPropertyItem game_properties_copy_operations[] ={ static EnumPropertyItem gameprops_items[]= { {0, NULL, 0, NULL, NULL}}; -static EnumPropertyItem *gameprops_itemf(bContext *C, PointerRNA *ptr, int *free) +static EnumPropertyItem *gameprops_itemf(bContext *C, PointerRNA *UNUSED(ptr), int *free) { Object *ob= ED_object_active_context(C); EnumPropertyItem tmp = {0, "", 0, "", ""}; @@ -2164,7 +2162,7 @@ void OBJECT_OT_game_property_copy(wmOperatorType *ot) ot->prop=prop; } -static int game_property_clear_exec(bContext *C, wmOperator *op) +static int game_property_clear_exec(bContext *C, wmOperator *UNUSED(op)) { CTX_DATA_BEGIN(C, Object*, ob_iter, selected_editable_objects) { free_properties(&ob_iter->prop); @@ -2190,7 +2188,7 @@ void OBJECT_OT_game_property_clear(wmOperatorType *ot) /************************ Copy Logic Bricks ***********************/ -static int logicbricks_copy_exec(bContext *C, wmOperator *op) +static int logicbricks_copy_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob=ED_object_active_context(C); diff --git a/source/blender/editors/object/object_group.c b/source/blender/editors/object/object_group.c index f000485466f..99e27d8a286 100644 --- a/source/blender/editors/object/object_group.c +++ b/source/blender/editors/object/object_group.c @@ -149,7 +149,7 @@ void GROUP_OT_objects_remove_active(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int group_objects_remove_exec(bContext *C, wmOperator *op) +static int group_objects_remove_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); @@ -224,7 +224,7 @@ void GROUP_OT_create(wmOperatorType *ot) /****************** properties window operators *********************/ -static int group_add_exec(bContext *C, wmOperator *op) +static int group_add_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; @@ -293,7 +293,7 @@ void OBJECT_OT_group_link(wmOperatorType *ot) ot->prop= prop; } -static int group_remove_exec(bContext *C, wmOperator *op) +static int group_remove_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c index 75e22d5356f..3c3e7f1df76 100644 --- a/source/blender/editors/object/object_hook.c +++ b/source/blender/editors/object/object_hook.c @@ -504,7 +504,7 @@ void OBJECT_OT_hook_add_selobj(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int object_add_hook_newob_exec(bContext *C, wmOperator *op) +static int object_add_hook_newob_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); @@ -557,7 +557,7 @@ static int object_hook_remove_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static EnumPropertyItem *hook_mod_itemf(bContext *C, PointerRNA *ptr, int *free) +static EnumPropertyItem *hook_mod_itemf(bContext *C, PointerRNA *UNUSED(ptr), int *free) { Object *ob = CTX_data_edit_object(C); EnumPropertyItem tmp = {0, "", 0, "", ""}; diff --git a/source/blender/editors/object/object_lattice.c b/source/blender/editors/object/object_lattice.c index 9f82a1209cf..708aa38d3ea 100644 --- a/source/blender/editors/object/object_lattice.c +++ b/source/blender/editors/object/object_lattice.c @@ -259,7 +259,7 @@ int make_regular_poll(bContext *C) return (ob && ob->type==OB_LATTICE); } -int make_regular_exec(bContext *C, wmOperator *op) +int make_regular_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_edit_object(C); Lattice *lt; diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index aac5129c6a9..c273b375a06 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -250,7 +250,7 @@ int ED_object_modifier_move_down(ReportList *reports, Object *ob, ModifierData * return 1; } -int ED_object_modifier_convert(ReportList *reports, Main *bmain, Scene *scene, Object *ob, ModifierData *md) +int ED_object_modifier_convert(ReportList *UNUSED(reports), Main *bmain, Scene *scene, Object *ob, ModifierData *md) { Object *obn; ParticleSystem *psys; @@ -365,7 +365,7 @@ static int modifier_apply_shape(ReportList *reports, Scene *scene, Object *ob, M BKE_report(reports, RPT_ERROR, "Only deforming modifiers can be applied to Shapes"); return 0; } - mesh_pmv_off(ob, me); + mesh_pmv_off(me); dm = mesh_create_derived_for_modifier(scene, ob, md); if (!dm) { @@ -413,7 +413,7 @@ static int modifier_apply_obdata(ReportList *reports, Scene *scene, Object *ob, return 0; } - mesh_pmv_off(ob, me); + mesh_pmv_off(me); /* Multires: ensure that recent sculpting is applied */ if(md->type == eModifierType_Multires) @@ -511,7 +511,7 @@ int ED_object_modifier_apply(ReportList *reports, Scene *scene, Object *ob, Modi return 1; } -int ED_object_modifier_copy(ReportList *reports, Object *ob, ModifierData *md) +int ED_object_modifier_copy(ReportList *UNUSED(reports), Object *ob, ModifierData *md) { ModifierData *nmd; @@ -540,7 +540,7 @@ static int modifier_add_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static EnumPropertyItem *modifier_add_itemf(bContext *C, PointerRNA *ptr, int *free) +static EnumPropertyItem *modifier_add_itemf(bContext *C, PointerRNA *UNUSED(ptr), int *free) { Object *ob= ED_object_active_context(C); EnumPropertyItem *item= NULL, *md_item; @@ -636,7 +636,7 @@ static int edit_modifier_invoke_properties(bContext *C, wmOperator *op) return 0; } -static ModifierData *edit_modifier_property_get(bContext *C, wmOperator *op, Object *ob, int type) +static ModifierData *edit_modifier_property_get(wmOperator *op, Object *ob, int type) { char modifier_name[32]; ModifierData *md; @@ -657,7 +657,7 @@ static int modifier_remove_exec(bContext *C, wmOperator *op) Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Object *ob = ED_object_active_context(C); - ModifierData *md = edit_modifier_property_get(C, op, ob, 0); + ModifierData *md = edit_modifier_property_get(op, ob, 0); if(!ob || !md || !ED_object_modifier_remove(op->reports, bmain, scene, ob, md)) return OPERATOR_CANCELLED; @@ -667,7 +667,7 @@ static int modifier_remove_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int modifier_remove_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int modifier_remove_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_modifier_invoke_properties(C, op)) return modifier_remove_exec(C, op); @@ -695,7 +695,7 @@ void OBJECT_OT_modifier_remove(wmOperatorType *ot) static int modifier_move_up_exec(bContext *C, wmOperator *op) { Object *ob = ED_object_active_context(C); - ModifierData *md = edit_modifier_property_get(C, op, ob, 0); + ModifierData *md = edit_modifier_property_get(op, ob, 0); if(!ob || !md || !ED_object_modifier_move_up(op->reports, ob, md)) return OPERATOR_CANCELLED; @@ -706,7 +706,7 @@ static int modifier_move_up_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int modifier_move_up_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int modifier_move_up_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_modifier_invoke_properties(C, op)) return modifier_move_up_exec(C, op); @@ -734,7 +734,7 @@ void OBJECT_OT_modifier_move_up(wmOperatorType *ot) static int modifier_move_down_exec(bContext *C, wmOperator *op) { Object *ob = ED_object_active_context(C); - ModifierData *md = edit_modifier_property_get(C, op, ob, 0); + ModifierData *md = edit_modifier_property_get(op, ob, 0); if(!ob || !md || !ED_object_modifier_move_down(op->reports, ob, md)) return OPERATOR_CANCELLED; @@ -745,7 +745,7 @@ static int modifier_move_down_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int modifier_move_down_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int modifier_move_down_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_modifier_invoke_properties(C, op)) return modifier_move_down_exec(C, op); @@ -774,7 +774,7 @@ static int modifier_apply_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); Object *ob = ED_object_active_context(C); - ModifierData *md = edit_modifier_property_get(C, op, ob, 0); + ModifierData *md = edit_modifier_property_get(op, ob, 0); int apply_as= RNA_enum_get(op->ptr, "apply_as"); if(!ob || !md || !ED_object_modifier_apply(op->reports, scene, ob, md, apply_as)) { @@ -787,7 +787,7 @@ static int modifier_apply_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int modifier_apply_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int modifier_apply_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_modifier_invoke_properties(C, op)) return modifier_apply_exec(C, op); @@ -824,7 +824,7 @@ static int modifier_convert_exec(bContext *C, wmOperator *op) Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Object *ob = ED_object_active_context(C); - ModifierData *md = edit_modifier_property_get(C, op, ob, 0); + ModifierData *md = edit_modifier_property_get(op, ob, 0); if(!ob || !md || !ED_object_modifier_convert(op->reports, bmain, scene, ob, md)) return OPERATOR_CANCELLED; @@ -835,7 +835,7 @@ static int modifier_convert_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int modifier_convert_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int modifier_convert_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_modifier_invoke_properties(C, op)) return modifier_convert_exec(C, op); @@ -863,7 +863,7 @@ void OBJECT_OT_modifier_convert(wmOperatorType *ot) static int modifier_copy_exec(bContext *C, wmOperator *op) { Object *ob = ED_object_active_context(C); - ModifierData *md = edit_modifier_property_get(C, op, ob, 0); + ModifierData *md = edit_modifier_property_get(op, ob, 0); if(!ob || !md || !ED_object_modifier_copy(op->reports, ob, md)) return OPERATOR_CANCELLED; @@ -874,7 +874,7 @@ static int modifier_copy_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int modifier_copy_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int modifier_copy_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_modifier_invoke_properties(C, op)) return modifier_copy_exec(C, op); @@ -907,7 +907,7 @@ static int multires_poll(bContext *C) static int multires_higher_levels_delete_exec(bContext *C, wmOperator *op) { Object *ob = ED_object_active_context(C); - MultiresModifierData *mmd = (MultiresModifierData *)edit_modifier_property_get(C, op, ob, eModifierType_Multires); + MultiresModifierData *mmd = (MultiresModifierData *)edit_modifier_property_get(op, ob, eModifierType_Multires); if (!mmd) return OPERATOR_CANCELLED; @@ -919,7 +919,7 @@ static int multires_higher_levels_delete_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int multires_higher_levels_delete_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int multires_higher_levels_delete_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_modifier_invoke_properties(C, op)) return multires_higher_levels_delete_exec(C, op); @@ -946,7 +946,7 @@ void OBJECT_OT_multires_higher_levels_delete(wmOperatorType *ot) static int multires_subdivide_exec(bContext *C, wmOperator *op) { Object *ob = ED_object_active_context(C); - MultiresModifierData *mmd = (MultiresModifierData *)edit_modifier_property_get(C, op, ob, eModifierType_Multires); + MultiresModifierData *mmd = (MultiresModifierData *)edit_modifier_property_get(op, ob, eModifierType_Multires); if (!mmd) return OPERATOR_CANCELLED; @@ -959,7 +959,7 @@ static int multires_subdivide_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int multires_subdivide_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int multires_subdivide_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_modifier_invoke_properties(C, op)) return multires_subdivide_exec(C, op); @@ -988,7 +988,7 @@ static int multires_reshape_exec(bContext *C, wmOperator *op) { Object *ob= ED_object_active_context(C), *secondob= NULL; Scene *scene= CTX_data_scene(C); - MultiresModifierData *mmd = (MultiresModifierData *)edit_modifier_property_get(C, op, ob, eModifierType_Multires); + MultiresModifierData *mmd = (MultiresModifierData *)edit_modifier_property_get(op, ob, eModifierType_Multires); if (!mmd) return OPERATOR_CANCELLED; @@ -1017,7 +1017,7 @@ static int multires_reshape_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int multires_reshape_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int multires_reshape_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_modifier_invoke_properties(C, op)) return multires_reshape_exec(C, op); @@ -1058,7 +1058,7 @@ static int multires_external_save_exec(bContext *C, wmOperator *op) RNA_string_get(op->ptr, "filepath", path); if(relative) - BLI_path_rel(path, G.sce); + BLI_path_rel(path, G.main->name); CustomData_external_add(&me->fdata, &me->id, CD_MDISPS, me->totface, path); CustomData_external_write(&me->fdata, &me->id, CD_MASK_MESH, me->totface, 0); @@ -1066,7 +1066,7 @@ static int multires_external_save_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int multires_external_save_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int multires_external_save_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Object *ob = ED_object_active_context(C); MultiresModifierData *mmd; @@ -1076,7 +1076,7 @@ static int multires_external_save_invoke(bContext *C, wmOperator *op, wmEvent *e if (!edit_modifier_invoke_properties(C, op)) return OPERATOR_CANCELLED; - mmd = (MultiresModifierData *)edit_modifier_property_get(C, op, ob, eModifierType_Multires); + mmd = (MultiresModifierData *)edit_modifier_property_get(op, ob, eModifierType_Multires); if (!mmd) return OPERATOR_CANCELLED; @@ -1120,7 +1120,7 @@ void OBJECT_OT_multires_external_save(wmOperatorType *ot) /****************** multires pack operator *********************/ -static int multires_external_pack_exec(bContext *C, wmOperator *op) +static int multires_external_pack_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob = ED_object_active_context(C); Mesh *me= ob->data; @@ -1158,7 +1158,7 @@ static int meshdeform_bind_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); Object *ob = ED_object_active_context(C); - MeshDeformModifierData *mmd = (MeshDeformModifierData *)edit_modifier_property_get(C, op, ob, eModifierType_MeshDeform); + MeshDeformModifierData *mmd = (MeshDeformModifierData *)edit_modifier_property_get(op, ob, eModifierType_MeshDeform); if (!mmd) return OPERATOR_CANCELLED; @@ -1210,7 +1210,7 @@ static int meshdeform_bind_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int meshdeform_bind_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int meshdeform_bind_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_modifier_invoke_properties(C, op)) return meshdeform_bind_exec(C, op); @@ -1245,7 +1245,7 @@ static int explode_poll(bContext *C) static int explode_refresh_exec(bContext *C, wmOperator *op) { Object *ob = ED_object_active_context(C); - ExplodeModifierData *emd = (ExplodeModifierData *)edit_modifier_property_get(C, op, ob, eModifierType_Explode); + ExplodeModifierData *emd = (ExplodeModifierData *)edit_modifier_property_get(op, ob, eModifierType_Explode); if (!emd) return OPERATOR_CANCELLED; @@ -1258,7 +1258,7 @@ static int explode_refresh_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int explode_refresh_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int explode_refresh_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_modifier_invoke_properties(C, op)) return explode_refresh_exec(C, op); diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c index 6e9e8eeb5e5..221d1211930 100644 --- a/source/blender/editors/object/object_ops.c +++ b/source/blender/editors/object/object_ops.c @@ -378,7 +378,7 @@ void ED_keymap_object(wmKeyConfig *keyconf) ED_object_generic_keymap(keyconf, keymap, 2); } -void ED_object_generic_keymap(struct wmKeyConfig *keyconf, struct wmKeyMap *keymap, int do_pet) +void ED_object_generic_keymap(struct wmKeyConfig *UNUSED(keyconf), struct wmKeyMap *keymap, int do_pet) { wmKeyMapItem *kmi; diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 11175958fba..14f88c6d99e 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -353,7 +353,7 @@ static int make_proxy_exec (bContext *C, wmOperator *op) } /* Generic itemf's for operators that take library args */ -static EnumPropertyItem *proxy_group_object_itemf(bContext *C, PointerRNA *ptr, int *free) +static EnumPropertyItem *proxy_group_object_itemf(bContext *C, PointerRNA *UNUSED(ptr), int *free) { EnumPropertyItem *item= NULL, item_tmp; int totitem= 0; @@ -641,11 +641,11 @@ static int parent_set_exec(bContext *C, wmOperator *op) } else if(pararm && ob->type==OB_MESH && par->type == OB_ARMATURE) { if(partype == PAR_ARMATURE_NAME) - create_vgroups_from_armature(scene, ob, par, ARM_GROUPS_NAME, 0); + create_vgroups_from_armature(op->reports, scene, ob, par, ARM_GROUPS_NAME, 0); else if(partype == PAR_ARMATURE_ENVELOPE) - create_vgroups_from_armature(scene, ob, par, ARM_GROUPS_ENVELOPE, 0); + create_vgroups_from_armature(op->reports, scene, ob, par, ARM_GROUPS_ENVELOPE, 0); else if(partype == PAR_ARMATURE_AUTO) - create_vgroups_from_armature(scene, ob, par, ARM_GROUPS_AUTO, 0); + create_vgroups_from_armature(op->reports, scene, ob, par, ARM_GROUPS_AUTO, 0); /* get corrected inverse */ ob->partype= PAROBJECT; @@ -672,7 +672,7 @@ static int parent_set_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int parent_set_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int parent_set_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event)) { Object *ob= CTX_data_active_object(C); uiPopupMenu *pup= uiPupMenuBegin(C, "Set Parent To", 0); @@ -779,7 +779,7 @@ void OBJECT_OT_parent_no_inverse_set(wmOperatorType *ot) /************************ Clear Slow Parent Operator *********************/ -static int object_slow_parent_clear_exec(bContext *C, wmOperator *op) +static int object_slow_parent_clear_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); @@ -821,7 +821,7 @@ void OBJECT_OT_slow_parent_clear(wmOperatorType *ot) /********************** Make Slow Parent Operator *********************/ -static int object_slow_parent_set_exec(bContext *C, wmOperator *op) +static int object_slow_parent_set_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); @@ -1140,7 +1140,7 @@ void OBJECT_OT_move_to_layer(wmOperatorType *ot) /************************** Link to Scene Operator *****************************/ -void link_to_scene(Main *bmain, unsigned short nr) +void link_to_scene(Main *UNUSED(bmain), unsigned short UNUSED(nr)) { #if 0 Scene *sce= (Scene*) BLI_findlink(&bmain->scene, G.curscreen->scenenr-1); @@ -1344,7 +1344,7 @@ void OBJECT_OT_make_links_data(wmOperatorType *ot) /**************************** Make Single User ********************************/ -static void single_object_users__forwardModifierLinks(void *userData, Object *ob, Object **obpoin) +static void single_object_users__forwardModifierLinks(void *UNUSED(userData), Object *UNUSED(ob), Object **obpoin) { ID_NEW(*obpoin); } @@ -1538,7 +1538,7 @@ void single_obdata_users(Main *bmain, Scene *scene, int flag) } } -void single_ipo_users(Scene *scene, int flag) +void single_ipo_users(Scene *UNUSED(scene), int UNUSED(flag)) { #if 0 // XXX old animation system Object *ob; diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c index 20346ab080e..a3c65851d3a 100644 --- a/source/blender/editors/object/object_select.c +++ b/source/blender/editors/object/object_select.c @@ -679,7 +679,7 @@ void OBJECT_OT_select_by_layer(wmOperatorType *ot) /************************** Select Inverse *************************/ -static int object_select_inverse_exec(bContext *C, wmOperator *op) +static int object_select_inverse_exec(bContext *C, wmOperator *UNUSED(op)) { CTX_DATA_BEGIN(C, Base*, base, visible_bases) { if (base->flag & SELECT) diff --git a/source/blender/editors/object/object_shapekey.c b/source/blender/editors/object/object_shapekey.c index 7b1ab933e28..0aefb09ee9e 100644 --- a/source/blender/editors/object/object_shapekey.c +++ b/source/blender/editors/object/object_shapekey.c @@ -53,6 +53,7 @@ #include "BKE_library.h" #include "BKE_main.h" #include "BKE_object.h" +#include "BKE_curve.h" #include "BLO_sys_types.h" // for intptr_t support @@ -100,8 +101,25 @@ static int ED_object_shape_key_remove(bContext *C, Object *ob) BLI_remlink(&key->block, kb); key->totkey--; - if(key->refkey== kb) + if(key->refkey== kb) { key->refkey= key->block.first; + + if(key->refkey) { + /* apply new basis key on original data */ + switch(ob->type) { + case OB_MESH: + key_to_mesh(key->refkey, ob->data); + break; + case OB_CURVE: + case OB_SURF: + key_to_curve(key->refkey, ob->data, BKE_curve_nurbs(ob->data)); + break; + case OB_LATTICE: + key_to_latt(key->refkey, ob->data); + break; + } + } + } if(kb->data) MEM_freeN(kb->data); MEM_freeN(kb); @@ -143,7 +161,7 @@ static int ED_object_shape_key_remove(bContext *C, Object *ob) return 1; } -static int ED_object_shape_key_mirror(bContext *C, Scene *scene, Object *ob) +static int object_shape_key_mirror(bContext *C, Object *ob) { KeyBlock *kb; Key *key; @@ -249,7 +267,7 @@ void OBJECT_OT_shape_key_add(wmOperatorType *ot) RNA_def_boolean(ot->srna, "from_mix", 1, "From Mix", "Create the new shape key from the existing mix of keys."); } -static int shape_key_remove_exec(bContext *C, wmOperator *op) +static int shape_key_remove_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; @@ -274,7 +292,7 @@ void OBJECT_OT_shape_key_remove(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int shape_key_clear_exec(bContext *C, wmOperator *op) +static int shape_key_clear_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; Key *key= ob_get_key(ob); @@ -307,12 +325,11 @@ void OBJECT_OT_shape_key_clear(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int shape_key_mirror_exec(bContext *C, wmOperator *op) +static int shape_key_mirror_exec(bContext *C, wmOperator *UNUSED(op)) { - Scene *scene= CTX_data_scene(C); Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; - if(!ED_object_shape_key_mirror(C, scene, ob)) + if(!object_shape_key_mirror(C, ob)) return OPERATOR_CANCELLED; return OPERATOR_FINISHED; diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index d4644847a5c..66c5ab4ec4b 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -64,7 +64,7 @@ /*************************** Clear Transformation ****************************/ -static int object_location_clear_exec(bContext *C, wmOperator *op) +static int object_location_clear_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); @@ -125,7 +125,7 @@ void OBJECT_OT_location_clear(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int object_rotation_clear_exec(bContext *C, wmOperator *op) +static int object_rotation_clear_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); @@ -270,7 +270,7 @@ void OBJECT_OT_rotation_clear(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int object_scale_clear_exec(bContext *C, wmOperator *op) +static int object_scale_clear_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); @@ -336,7 +336,7 @@ void OBJECT_OT_scale_clear(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int object_origin_clear_exec(bContext *C, wmOperator *op) +static int object_origin_clear_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); float *v1, *v3, mat[3][3]; @@ -457,8 +457,18 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo object_to_mat3(ob, rsmat); else if(apply_scale) object_scale_to_mat3(ob, rsmat); - else if(apply_rot) + else if(apply_rot) { + float tmat[3][3], timat[3][3]; + + /* simple rotation matrix */ object_rot_to_mat3(ob, rsmat); + + /* correct for scale, note mul_m3_m3m3 has swapped args! */ + object_scale_to_mat3(ob, tmat); + invert_m3_m3(timat, tmat); + mul_m3_m3m3(rsmat, timat, rsmat); + mul_m3_m3m3(rsmat, rsmat, tmat); + } else unit_m3(rsmat); @@ -557,7 +567,7 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo return OPERATOR_FINISHED; } -static int visual_transform_apply_exec(bContext *C, wmOperator *op) +static int visual_transform_apply_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); int change = 0; diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index 76af8feda82..015fab05828 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -1438,7 +1438,7 @@ static int vertex_group_poll_edit(bContext *C) return vgroup_object_in_edit_mode(ob); } -static int vertex_group_add_exec(bContext *C, wmOperator *op) +static int vertex_group_add_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; @@ -1561,7 +1561,7 @@ void OBJECT_OT_vertex_group_remove_from(wmOperatorType *ot) RNA_def_boolean(ot->srna, "all", 0, "All", "Remove from all vertex groups."); } -static int vertex_group_select_exec(bContext *C, wmOperator *op) +static int vertex_group_select_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_edit_object(C); @@ -1588,7 +1588,7 @@ void OBJECT_OT_vertex_group_select(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int vertex_group_deselect_exec(bContext *C, wmOperator *op) +static int vertex_group_deselect_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_edit_object(C); @@ -1612,7 +1612,7 @@ void OBJECT_OT_vertex_group_deselect(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int vertex_group_copy_exec(bContext *C, wmOperator *op) +static int vertex_group_copy_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; @@ -1671,7 +1671,7 @@ void OBJECT_OT_vertex_group_levels(wmOperatorType *ot) RNA_def_float(ot->srna, "gain", 1.f, 0.f, FLT_MAX, "Gain", "Value to multiply weights by.", 0.0f, 10.f); } -static int vertex_group_normalize_exec(bContext *C, wmOperator *op) +static int vertex_group_normalize_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; @@ -1760,7 +1760,7 @@ void OBJECT_OT_vertex_group_invert(wmOperatorType *ot) } -static int vertex_group_blend_exec(bContext *C, wmOperator *op) +static int vertex_group_blend_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; @@ -1860,7 +1860,7 @@ void OBJECT_OT_vertex_group_mirror(wmOperatorType *ot) } -static int vertex_group_copy_to_linked_exec(bContext *C, wmOperator *op) +static int vertex_group_copy_to_linked_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; @@ -1901,7 +1901,7 @@ void OBJECT_OT_vertex_group_copy_to_linked(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int vertex_group_copy_to_selected_exec(bContext *C, wmOperator *op) +static int vertex_group_copy_to_selected_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obact= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; @@ -1947,7 +1947,7 @@ static int set_active_group_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static EnumPropertyItem *vgroup_itemf(bContext *C, PointerRNA *ptr, int *free) +static EnumPropertyItem *vgroup_itemf(bContext *C, PointerRNA *UNUSED(ptr), int *free) { Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; EnumPropertyItem tmp = {0, "", 0, "", ""}; diff --git a/source/blender/editors/physics/particle_boids.c b/source/blender/editors/physics/particle_boids.c index a18890881a8..0ba76bbe34c 100644 --- a/source/blender/editors/physics/particle_boids.c +++ b/source/blender/editors/physics/particle_boids.c @@ -98,7 +98,7 @@ void BOID_OT_rule_add(wmOperatorType *ot) ot->prop= RNA_def_enum(ot->srna, "type", boidrule_type_items, 0, "Type", ""); } -static int rule_del_exec(bContext *C, wmOperator *op) +static int rule_del_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); @@ -149,7 +149,7 @@ void BOID_OT_rule_del(wmOperatorType *ot) } /************************ move up/down boid rule operators *********************/ -static int rule_move_up_exec(bContext *C, wmOperator *op) +static int rule_move_up_exec(bContext *C, wmOperator *UNUSED(op)) { PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); ParticleSystem *psys= ptr.data; @@ -187,7 +187,7 @@ void BOID_OT_rule_move_up(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int rule_move_down_exec(bContext *C, wmOperator *op) +static int rule_move_down_exec(bContext *C, wmOperator *UNUSED(op)) { PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); ParticleSystem *psys= ptr.data; @@ -227,7 +227,7 @@ void BOID_OT_rule_move_down(wmOperatorType *ot) /************************ add/del boid state operators *********************/ -static int state_add_exec(bContext *C, wmOperator *op) +static int state_add_exec(bContext *C, wmOperator *UNUSED(op)) { PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); ParticleSystem *psys= ptr.data; @@ -266,7 +266,7 @@ void BOID_OT_state_add(wmOperatorType *ot) /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int state_del_exec(bContext *C, wmOperator *op) +static int state_del_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); @@ -322,7 +322,7 @@ void BOID_OT_state_del(wmOperatorType *ot) } /************************ move up/down boid state operators *********************/ -static int state_move_up_exec(bContext *C, wmOperator *op) +static int state_move_up_exec(bContext *C, wmOperator *UNUSED(op)) { PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); ParticleSystem *psys= ptr.data; @@ -359,7 +359,7 @@ void BOID_OT_state_move_up(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int state_move_down_exec(bContext *C, wmOperator *op) +static int state_move_down_exec(bContext *C, wmOperator *UNUSED(op)) { PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); ParticleSystem *psys= ptr.data; diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index 132533fc123..57867fdc441 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -1125,7 +1125,7 @@ static void update_world_cos(Object *ob, PTCacheEdit *edit) } } } -static void update_velocities(Object *ob, PTCacheEdit *edit) +static void update_velocities(PTCacheEdit *edit) { /*TODO: get frs_sec properly */ float vec1[3], vec2[3], frs_sec, dfra; @@ -1208,7 +1208,7 @@ void PE_update_object(Scene *scene, Object *ob, int useflag) if(edit->psys) update_world_cos(ob, edit); if(pset->flag & PE_AUTO_VELOCITY) - update_velocities(ob, edit); + update_velocities(edit); PE_hide_keys_time(scene, edit, CFRA); /* regenerate path caches */ @@ -1243,7 +1243,7 @@ static void select_key(PEData *data, int point_index, int key_index) point->flag |= PEP_EDIT_RECALC; } -static void select_keys(PEData *data, int point_index, int key_index) +static void select_keys(PEData *data, int point_index, int UNUSED(key_index)) { PTCacheEdit *edit = data->edit; PTCacheEditPoint *point = edit->points + point_index; @@ -1387,7 +1387,7 @@ static void select_root(PEData *data, int point_index) data->edit->points[point_index].flag |= PEP_EDIT_RECALC; /* redraw selection only */ } -static int select_roots_exec(bContext *C, wmOperator *op) +static int select_roots_exec(bContext *C, wmOperator *UNUSED(op)) { PEData data; @@ -1427,7 +1427,7 @@ static void select_tip(PEData *data, int point_index) point->flag |= PEP_EDIT_RECALC; /* redraw selection only */ } -static int select_tips_exec(bContext *C, wmOperator *op) +static int select_tips_exec(bContext *C, wmOperator *UNUSED(op)) { PEData data; @@ -1690,7 +1690,7 @@ void PARTICLE_OT_hide(wmOperatorType *ot) /*************************** reveal operator **************************/ -static int reveal_exec(bContext *C, wmOperator *op) +static int reveal_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_active_object(C); Scene *scene= CTX_data_scene(C); @@ -1758,7 +1758,7 @@ static void select_less_keys(PEData *data, int point_index) } } -static int select_less_exec(bContext *C, wmOperator *op) +static int select_less_exec(bContext *C, wmOperator *UNUSED(op)) { PEData data; @@ -1819,7 +1819,7 @@ static void select_more_keys(PEData *data, int point_index) } } -static int select_more_exec(bContext *C, wmOperator *op) +static int select_more_exec(bContext *C, wmOperator *UNUSED(op)) { PEData data; @@ -1846,7 +1846,7 @@ void PARTICLE_OT_select_more(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int select_inverse_exec(bContext *C, wmOperator *op) +static int select_inverse_exec(bContext *C, wmOperator *UNUSED(op)) { PEData data; PTCacheEdit *edit; @@ -2022,7 +2022,7 @@ static void rekey_particle_to_time(Scene *scene, Object *ob, int pa_index, float /************************* utilities **************************/ -static int remove_tagged_particles(Scene *scene, Object *ob, ParticleSystem *psys, int mirror) +static int remove_tagged_particles(Object *ob, ParticleSystem *psys, int mirror) { PTCacheEdit *edit = psys->edit; ParticleData *pa, *npa=0, *new_pars=0; @@ -2092,7 +2092,7 @@ static int remove_tagged_particles(Scene *scene, Object *ob, ParticleSystem *psy return removed; } -static void remove_tagged_keys(Scene *scene, Object *ob, ParticleSystem *psys) +static void remove_tagged_keys(Object *ob, ParticleSystem *psys) { PTCacheEdit *edit= psys->edit; ParticleData *pa; @@ -2123,7 +2123,7 @@ static void remove_tagged_keys(Scene *scene, Object *ob, ParticleSystem *psys) if(new_totkey < 2) point->flag |= PEP_TAG; } - remove_tagged_particles(scene, ob, psys, pe_x_mirror(ob)); + remove_tagged_particles(ob, psys, pe_x_mirror(ob)); LOOP_POINTS { pa = psys->particles + p; @@ -2260,7 +2260,7 @@ static void subdivide_particle(PEData *data, int pa_index) pa->flag &= ~PARS_REKEY; } -static int subdivide_exec(bContext *C, wmOperator *op) +static int subdivide_exec(bContext *C, wmOperator *UNUSED(op)) { PEData data; @@ -2347,7 +2347,7 @@ static int remove_doubles_exec(bContext *C, wmOperator *op) BLI_kdtree_free(tree); /* remove tagged particles - don't do mirror here! */ - remove_tagged_particles(scene, ob, psys, 0); + remove_tagged_particles(ob, psys, 0); totremoved += removed; } while(removed); @@ -2430,7 +2430,7 @@ void PARTICLE_OT_weight_set(wmOperatorType *ot) /************************ cursor drawing *******************************/ -static void brush_drawcursor(bContext *C, int x, int y, void *customdata) +static void brush_drawcursor(bContext *C, int x, int y, void *UNUSED(customdata)) { ParticleEditSettings *pset= PE_settings(CTX_data_scene(C)); ParticleBrushData *brush; @@ -2574,12 +2574,12 @@ static int delete_exec(bContext *C, wmOperator *op) if(type == DEL_KEY) { foreach_selected_key(&data, set_delete_particle_key); - remove_tagged_keys(data.scene, data.ob, data.edit->psys); + remove_tagged_keys(data.ob, data.edit->psys); recalc_lengths(data.edit); } else if(type == DEL_PARTICLE) { foreach_selected_point(&data, set_delete_particle); - remove_tagged_particles(data.scene, data.ob, data.edit->psys, pe_x_mirror(data.ob)); + remove_tagged_particles(data.ob, data.edit->psys, pe_x_mirror(data.ob)); recalc_lengths(data.edit); } @@ -2734,7 +2734,7 @@ static void PE_mirror_x(Scene *scene, Object *ob, int tagged) MEM_freeN(mirrorfaces); } -static int mirror_exec(bContext *C, wmOperator *op) +static int mirror_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Object *ob= CTX_data_active_object(C); @@ -2765,7 +2765,7 @@ void PARTICLE_OT_mirror(wmOperatorType *ot) /************************* brush edit callbacks ********************/ -static void brush_comb(PEData *data, float mat[][4], float imat[][4], int point_index, int key_index, PTCacheEditKey *key) +static void brush_comb(PEData *data, float UNUSED(mat[][4]), float imat[][4], int point_index, int key_index, PTCacheEditKey *key) { ParticleEditSettings *pset= PE_settings(data->scene); float cvec[3], fac; @@ -3034,7 +3034,7 @@ static void brush_puff(PEData *data, int point_index) } -static void brush_weight(PEData *data, float mat[][4], float imat[][4], int point_index, int key_index, PTCacheEditKey *key) +static void brush_weight(PEData *data, float UNUSED(mat[][4]), float UNUSED(imat[][4]), int point_index, int key_index, PTCacheEditKey *UNUSED(key)) { /* roots have full weight allways */ if(key_index) { @@ -3048,7 +3048,7 @@ static void brush_weight(PEData *data, float mat[][4], float imat[][4], int poin } } -static void brush_smooth_get(PEData *data, float mat[][4], float imat[][4], int point_index, int key_index, PTCacheEditKey *key) +static void brush_smooth_get(PEData *data, float mat[][4], float UNUSED(imat[][4]), int UNUSED(point_index), int key_index, PTCacheEditKey *key) { if(key_index) { float dvec[3]; @@ -3060,7 +3060,7 @@ static void brush_smooth_get(PEData *data, float mat[][4], float imat[][4], int } } -static void brush_smooth_do(PEData *data, float mat[][4], float imat[][4], int point_index, int key_index, PTCacheEditKey *key) +static void brush_smooth_do(PEData *data, float UNUSED(mat[][4]), float imat[][4], int point_index, int key_index, PTCacheEditKey *key) { float vec[3], dvec[3]; @@ -3401,7 +3401,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr) else foreach_point(&data, brush_cut); - removed= remove_tagged_particles(scene, ob, edit->psys, pe_x_mirror(ob)); + removed= remove_tagged_particles(ob, edit->psys, pe_x_mirror(ob)); if(pset->flag & PE_KEEP_LENGTHS) recalc_lengths(edit); } @@ -3538,7 +3538,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr) pset->flag |= lock_root; } -static void brush_edit_exit(bContext *C, wmOperator *op) +static void brush_edit_exit(wmOperator *op) { BrushEdit *bedit= op->customdata; @@ -3555,7 +3555,7 @@ static int brush_edit_exec(bContext *C, wmOperator *op) } RNA_END; - brush_edit_exit(C, op); + brush_edit_exit(op); return OPERATOR_FINISHED; } @@ -3597,7 +3597,7 @@ static int brush_edit_modal(bContext *C, wmOperator *op, wmEvent *event) case LEFTMOUSE: case MIDDLEMOUSE: case RIGHTMOUSE: // XXX hardcoded - brush_edit_exit(C, op); + brush_edit_exit(op); return OPERATOR_FINISHED; case MOUSEMOVE: brush_edit_apply_event(C, op, event); @@ -3607,9 +3607,9 @@ static int brush_edit_modal(bContext *C, wmOperator *op, wmEvent *event) return OPERATOR_RUNNING_MODAL; } -static int brush_edit_cancel(bContext *C, wmOperator *op) +static int brush_edit_cancel(bContext *UNUSED(C), wmOperator *op) { - brush_edit_exit(C, op); + brush_edit_exit(op); return OPERATOR_CANCELLED; } @@ -4084,7 +4084,7 @@ static int particle_edit_toggle_poll(bContext *C) return (ob->particlesystem.first || modifiers_findByType(ob, eModifierType_Cloth) || modifiers_findByType(ob, eModifierType_Softbody)); } -static int particle_edit_toggle_exec(bContext *C, wmOperator *op) +static int particle_edit_toggle_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Object *ob= CTX_data_active_object(C); @@ -4130,7 +4130,7 @@ void PARTICLE_OT_particle_edit_toggle(wmOperatorType *ot) /************************ set editable operator ************************/ -static int clear_edited_exec(bContext *C, wmOperator *op) +static int clear_edited_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_active_object(C); ParticleSystem *psys = psys_get_current(ob); diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c index e364a881601..428d8ce6b82 100644 --- a/source/blender/editors/physics/particle_object.c +++ b/source/blender/editors/physics/particle_object.c @@ -60,7 +60,7 @@ /********************** particle system slot operators *********************/ -static int particle_system_add_exec(bContext *C, wmOperator *op) +static int particle_system_add_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; Scene *scene = CTX_data_scene(C); @@ -91,7 +91,7 @@ void OBJECT_OT_particle_system_add(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int particle_system_remove_exec(bContext *C, wmOperator *op) +static int particle_system_remove_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; Scene *scene = CTX_data_scene(C); @@ -138,7 +138,7 @@ static int psys_poll(bContext *C) return (ptr.data != NULL); } -static int new_particle_settings_exec(bContext *C, wmOperator *op) +static int new_particle_settings_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene = CTX_data_scene(C); Main *bmain= CTX_data_main(C); @@ -191,7 +191,7 @@ void PARTICLE_OT_new(wmOperatorType *ot) /********************** keyed particle target operators *********************/ -static int new_particle_target_exec(bContext *C, wmOperator *op) +static int new_particle_target_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); @@ -237,7 +237,7 @@ void PARTICLE_OT_new_target(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int remove_particle_target_exec(bContext *C, wmOperator *op) +static int remove_particle_target_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); @@ -288,7 +288,7 @@ void PARTICLE_OT_target_remove(wmOperatorType *ot) /************************ move up particle target operator *********************/ -static int target_move_up_exec(bContext *C, wmOperator *op) +static int target_move_up_exec(bContext *C, wmOperator *UNUSED(op)) { PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); ParticleSystem *psys= ptr.data; @@ -327,7 +327,7 @@ void PARTICLE_OT_target_move_up(wmOperatorType *ot) /************************ move down particle target operator *********************/ -static int target_move_down_exec(bContext *C, wmOperator *op) +static int target_move_down_exec(bContext *C, wmOperator *UNUSED(op)) { PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); ParticleSystem *psys= ptr.data; @@ -365,7 +365,7 @@ void PARTICLE_OT_target_move_down(wmOperatorType *ot) /************************ move up particle dupliweight operator *********************/ -static int dupliob_move_up_exec(bContext *C, wmOperator *op) +static int dupliob_move_up_exec(bContext *C, wmOperator *UNUSED(op)) { PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); ParticleSystem *psys= ptr.data; @@ -403,7 +403,7 @@ void PARTICLE_OT_dupliob_move_up(wmOperatorType *ot) /********************** particle dupliweight operators *********************/ -static int copy_particle_dupliob_exec(bContext *C, wmOperator *op) +static int copy_particle_dupliob_exec(bContext *C, wmOperator *UNUSED(op)) { PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); ParticleSystem *psys= ptr.data; @@ -442,7 +442,7 @@ void PARTICLE_OT_dupliob_copy(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int remove_particle_dupliob_exec(bContext *C, wmOperator *op) +static int remove_particle_dupliob_exec(bContext *C, wmOperator *UNUSED(op)) { PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); ParticleSystem *psys= ptr.data; @@ -487,7 +487,7 @@ void PARTICLE_OT_dupliob_remove(wmOperatorType *ot) /************************ move down particle dupliweight operator *********************/ -static int dupliob_move_down_exec(bContext *C, wmOperator *op) +static int dupliob_move_down_exec(bContext *C, wmOperator *UNUSED(op)) { PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); ParticleSystem *psys= ptr.data; diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c index f411f92d395..b1c373e7a91 100644 --- a/source/blender/editors/physics/physics_fluid.c +++ b/source/blender/editors/physics/physics_fluid.c @@ -342,7 +342,7 @@ static void free_all_fluidobject_channels(ListBase *fobjects) } } -static void fluid_init_all_channels(bContext *C, Object *fsDomain, FluidsimSettings *domainSettings, FluidAnimChannels *channels, ListBase *fobjects) +static void fluid_init_all_channels(bContext *C, Object *UNUSED(fsDomain), FluidsimSettings *domainSettings, FluidAnimChannels *channels, ListBase *fobjects) { Scene *scene = CTX_data_scene(C); Base *base; @@ -639,7 +639,7 @@ static int fluid_init_filepaths(Object *fsDomain, char *targetDir, char *targetF // prepare names... strncpy(targetDir, domainSettings->surfdataPath, FILE_MAXDIR); strncpy(newSurfdataPath, domainSettings->surfdataPath, FILE_MAXDIR); - BLI_path_abs(targetDir, G.sce); // fixed #frame-no + BLI_path_abs(targetDir, G.main->name); // fixed #frame-no strcpy(targetFile, targetDir); strcat(targetFile, suffixConfig); @@ -663,7 +663,7 @@ static int fluid_init_filepaths(Object *fsDomain, char *targetDir, char *targetF char blendFile[FILE_MAXDIR+FILE_MAXFILE]; // invalid dir, reset to current/previous - strcpy(blendDir, G.sce); + strcpy(blendDir, G.main->name); BLI_splitdirstring(blendDir, blendFile); if(strlen(blendFile)>6){ int len = strlen(blendFile); @@ -694,7 +694,7 @@ static int fluid_init_filepaths(Object *fsDomain, char *targetDir, char *targetF if(selection<1) return 0; // 0 from menu, or -1 aborted strcpy(targetDir, newSurfdataPath); strncpy(domainSettings->surfdataPath, newSurfdataPath, FILE_MAXDIR); - BLI_path_abs(targetDir, G.sce); // fixed #frame-no + BLI_path_abs(targetDir, G.main->name); // fixed #frame-no } #endif return outStringsChanged; @@ -720,7 +720,7 @@ static void fluidbake_free(void *customdata) } /* called by fluidbake, only to check job 'stop' value */ -static int fluidbake_breakjob(void *customdata) +static int fluidbake_breakjob(void *UNUSED(customdata)) { //FluidBakeJob *fb= (FluidBakeJob *)customdata; //return *(fb->stop); @@ -1047,7 +1047,7 @@ int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain) return 1; } -void fluidsimFreeBake(Object *ob) +void fluidsimFreeBake(Object *UNUSED(ob)) { /* not implemented yet */ } @@ -1056,27 +1056,27 @@ void fluidsimFreeBake(Object *ob) /* compile dummy functions for disabled fluid sim */ -FluidsimSettings *fluidsimSettingsNew(Object *srcob) +FluidsimSettings *fluidsimSettingsNew(Object *UNUSED(srcob)) { return NULL; } -void fluidsimSettingsFree(FluidsimSettings *fss) +void fluidsimSettingsFree(FluidsimSettings *UNUSED(fss)) { } -FluidsimSettings* fluidsimSettingsCopy(FluidsimSettings *fss) +FluidsimSettings* fluidsimSettingsCopy(FluidsimSettings *UNUSED(fss)) { return NULL; } /* only compile dummy functions */ -int fluidsimBake(bContext *C, ReportList *reports, Object *ob) +int fluidsimBake(bContext *UNUSED(C), ReportList *UNUSED(reports), Object *UNUSED(ob)) { return 0; } -void fluidsimFreeBake(Object *ob) +void fluidsimFreeBake(Object *UNUSED(ob)) { } diff --git a/source/blender/editors/physics/physics_pointcache.c b/source/blender/editors/physics/physics_pointcache.c index 35f86a49aa7..9e39862cf5d 100644 --- a/source/blender/editors/physics/physics_pointcache.c +++ b/source/blender/editors/physics/physics_pointcache.c @@ -56,7 +56,7 @@ #include "physics_intern.h" -static int cache_break_test(void *cbd) { +static int cache_break_test(void *UNUSED(cbd)) { return G.afbreek==1; } static int ptcache_bake_all_poll(bContext *C) @@ -75,13 +75,13 @@ static int ptcache_poll(bContext *C) return (ptr.data && ptr.id.data); } -void bake_console_progress(void *arg, int nr) +void bake_console_progress(void *UNUSED(arg), int nr) { printf("\rbake: %3i%%", nr); fflush(stdout); } -void bake_console_progress_end(void *arg) +void bake_console_progress_end(void *UNUSED(arg)) { printf("\n"); } @@ -120,7 +120,7 @@ static int ptcache_bake_all_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int ptcache_free_bake_all_exec(bContext *C, wmOperator *op) +static int ptcache_free_bake_all_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Base *base; @@ -221,7 +221,7 @@ static int ptcache_bake_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int ptcache_free_bake_exec(bContext *C, wmOperator *op) +static int ptcache_free_bake_exec(bContext *C, wmOperator *UNUSED(op)) { PointerRNA ptr= CTX_data_pointer_get_type(C, "point_cache", &RNA_PointCache); PointCache *cache= ptr.data; @@ -241,7 +241,7 @@ static int ptcache_free_bake_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int ptcache_bake_from_cache_exec(bContext *C, wmOperator *op) +static int ptcache_bake_from_cache_exec(bContext *C, wmOperator *UNUSED(op)) { PointerRNA ptr= CTX_data_pointer_get_type(C, "point_cache", &RNA_PointCache); PointCache *cache= ptr.data; @@ -295,7 +295,7 @@ void PTCACHE_OT_bake_from_cache(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int ptcache_add_new_exec(bContext *C, wmOperator *op) +static int ptcache_add_new_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene = CTX_data_scene(C); PointerRNA ptr= CTX_data_pointer_get_type(C, "point_cache", &RNA_PointCache); @@ -320,7 +320,7 @@ static int ptcache_add_new_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int ptcache_remove_exec(bContext *C, wmOperator *op) +static int ptcache_remove_exec(bContext *C, wmOperator *UNUSED(op)) { PointerRNA ptr= CTX_data_pointer_get_type(C, "point_cache", &RNA_PointCache); Scene *scene= CTX_data_scene(C); diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c index 083202e5a03..7f34e6fa333 100644 --- a/source/blender/editors/render/render_internal.c +++ b/source/blender/editors/render/render_internal.c @@ -596,7 +596,7 @@ static int render_breakjob(void *rjv) } /* catch esc */ -static int screen_render_modal(bContext *C, wmOperator *op, wmEvent *event) +static int screen_render_modal(bContext *C, wmOperator *UNUSED(op), wmEvent *event) { /* no running blender, remove handler and pass through */ if(0==WM_jobs_test(CTX_wm_manager(C), CTX_data_scene(C))) { @@ -763,7 +763,7 @@ void RENDER_OT_render(wmOperatorType *ot) /* *********************** cancel render viewer *************** */ -static int render_view_cancel_exec(bContext *C, wmOperator *unused) +static int render_view_cancel_exec(bContext *C, wmOperator *UNUSED(unused)) { wmWindow *win= CTX_wm_window(C); ScrArea *sa= CTX_wm_area(C); @@ -810,7 +810,7 @@ void RENDER_OT_view_cancel(struct wmOperatorType *ot) /* *********************** show render viewer *************** */ -static int render_view_show_invoke(bContext *C, wmOperator *unused, wmEvent *event) +static int render_view_show_invoke(bContext *C, wmOperator *UNUSED(unused), wmEvent *event) { ScrArea *sa= find_area_showing_r_result(C); diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c index 71bee8c5b08..0e8587e4642 100644 --- a/source/blender/editors/render/render_preview.c +++ b/source/blender/editors/render/render_preview.c @@ -111,7 +111,7 @@ ImBuf* get_brush_icon(Brush *brush) // first use the path directly to try and load the file BLI_strncpy(path, brush->icon_filepath, sizeof(brush->icon_filepath)); - BLI_path_abs(path, G.sce); + BLI_path_abs(path, G.main->name); brush->icon_imbuf= IMB_loadiffname(path, flags); @@ -121,7 +121,7 @@ ImBuf* get_brush_icon(Brush *brush) path[0]= 0; - BLI_make_file_string(G.sce, path, folder, brush->icon_filepath); + BLI_make_file_string(G.main->name, path, folder, brush->icon_filepath); if (path[0]) brush->icon_imbuf= IMB_loadiffname(path, flags); @@ -190,7 +190,7 @@ void draw_tex_crop(Tex *tex) } /* temporal abuse; if id_code is -1 it only does texture.... solve! */ -void BIF_preview_changed(short id_code) +void BIF_preview_changed(short UNUSED(id_code)) { #if 0 ScrArea *sa; @@ -571,7 +571,7 @@ void ED_preview_draw(const bContext *C, void *idp, void *parentp, void *slotp, r /* ******************************** Icon Preview **************************** */ -void ED_preview_icon_draw(const bContext *C, void *idp, void *arg1, void *arg2, rcti *rect) +void ED_preview_icon_draw(const bContext *UNUSED(C), void *UNUSED(idp), void *UNUSED(arg1), void *UNUSED(arg2), rcti *UNUSED(rect)) { } @@ -603,7 +603,7 @@ void view3d_previewrender_progress(RenderResult *rr, volatile rcti *renrect) } -void BIF_view3d_previewrender_signal(ScrArea *sa, short signal) +void BIF_view3d_previewrender_signal(ScrArea *UNUSED(sa), short UNUSED(signal)) { #if 0 View3D *v3d= sa->spacedata.first; @@ -625,7 +625,7 @@ void BIF_view3d_previewrender_signal(ScrArea *sa, short signal) #endif } -void BIF_view3d_previewrender_free(View3D *v3d) +void BIF_view3d_previewrender_free(View3D *UNUSED(v3d)) { #if 0 if(v3d->ri) { @@ -683,7 +683,7 @@ static int view3d_previewrender_get_rects(ScrArea *sa, rctf *viewplane, RenderIn } /* called before a panel gets moved/scaled, makes sure we can see through */ -void BIF_view3d_previewrender_clear(ScrArea *sa) +void BIF_view3d_previewrender_clear(ScrArea *UNUSED(sa)) { #if 0 View3D *v3d= sa->spacedata.first; @@ -844,7 +844,7 @@ void BIF_view3d_previewrender(Main *bmain, Scene *scene, ScrArea *sa) } /* in panel space! */ -static void view3d_previewdraw_rect(ScrArea *sa, uiBlock *block, RenderInfo *ri) +static void view3d_previewdraw_rect(ScrArea *UNUSED(sa), uiBlock *UNUSED(block), RenderInfo *ri) { // rctf dispf; @@ -887,7 +887,7 @@ void BIF_view3d_previewdraw(struct ScrArea *sa, struct uiBlock *block) /* **************************** new shader preview system ****************** */ /* inside thread, called by renderer, sets job update value */ -static void shader_preview_draw(void *spv, RenderResult *rr, volatile struct rcti *rect) +static void shader_preview_draw(void *spv, RenderResult *UNUSED(rr), volatile struct rcti *UNUSED(rect)) { ShaderPreview *sp= spv; @@ -903,7 +903,7 @@ static int shader_preview_break(void *spv) } /* outside thread, called before redraw notifiers, it moves finished preview over */ -static void shader_preview_updatejob(void *spv) +static void shader_preview_updatejob(void *UNUSED(spv)) { // ShaderPreview *sp= spv; @@ -1141,7 +1141,7 @@ static void icon_preview_startjob(void *customdata, short *stop, short *do_updat /* use same function for icon & shader, so the job manager does not run two of them at the same time. */ -static void common_preview_startjob(void *customdata, short *stop, short *do_update, float *progress) +static void common_preview_startjob(void *customdata, short *stop, short *do_update, float *UNUSED(progress)) { ShaderPreview *sp= customdata; diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index af09ddd8858..e56d8fc1124 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -120,7 +120,7 @@ static int nodes_use_tex(bNodeTree *ntree, Tex *tex) return 0; } -static void material_changed(Main *bmain, Material *ma) +static void material_changed(Main *UNUSED(bmain), Material *ma) { /* icons */ BKE_icon_changed(BKE_icon_getid(&ma->id)); @@ -212,7 +212,7 @@ static void image_changed(Main *bmain, Image *ima) texture_changed(bmain, tex); } -static void scene_changed(Main *bmain, Scene *sce) +static void scene_changed(Main *bmain, Scene *UNUSED(scene)) { Object *ob; Material *ma; @@ -258,7 +258,7 @@ void ED_render_id_flush_update(Main *bmain, ID *id) /********************** material slot operators *********************/ -static int material_slot_add_exec(bContext *C, wmOperator *op) +static int material_slot_add_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; @@ -293,6 +293,12 @@ static int material_slot_remove_exec(bContext *C, wmOperator *op) if(!ob) return OPERATOR_CANCELLED; + /* Removing material slots in edit mode screws things up, see bug #21822.*/ + if(ob == CTX_data_edit_object(C)) { + BKE_report(op->reports, RPT_ERROR, "Unable to remove material slot in edit mode."); + return OPERATOR_CANCELLED; + } + object_remove_material_slot(ob); WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob); WM_event_add_notifier(C, NC_OBJECT|ND_OB_SHADING, ob); @@ -314,7 +320,7 @@ void OBJECT_OT_material_slot_remove(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int material_slot_assign_exec(bContext *C, wmOperator *op) +static int material_slot_assign_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; @@ -438,7 +444,7 @@ static int material_slot_de_select(bContext *C, int select) return OPERATOR_FINISHED; } -static int material_slot_select_exec(bContext *C, wmOperator *op) +static int material_slot_select_exec(bContext *C, wmOperator *UNUSED(op)) { return material_slot_de_select(C, 1); } @@ -457,7 +463,7 @@ void OBJECT_OT_material_slot_select(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int material_slot_deselect_exec(bContext *C, wmOperator *op) +static int material_slot_deselect_exec(bContext *C, wmOperator *UNUSED(op)) { return material_slot_de_select(C, 0); } @@ -477,7 +483,7 @@ void OBJECT_OT_material_slot_deselect(wmOperatorType *ot) } -static int material_slot_copy_exec(bContext *C, wmOperator *op) +static int material_slot_copy_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; Material ***matar; @@ -518,7 +524,7 @@ void OBJECT_OT_material_slot_copy(wmOperatorType *ot) /********************** new material operator *********************/ -static int new_material_exec(bContext *C, wmOperator *op) +static int new_material_exec(bContext *C, wmOperator *UNUSED(op)) { Material *ma= CTX_data_pointer_get_type(C, "material", &RNA_Material).data; PointerRNA ptr, idptr; @@ -564,7 +570,7 @@ void MATERIAL_OT_new(wmOperatorType *ot) /********************** new texture operator *********************/ -static int new_texture_exec(bContext *C, wmOperator *op) +static int new_texture_exec(bContext *C, wmOperator *UNUSED(op)) { Tex *tex= CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data; PointerRNA ptr, idptr; @@ -610,7 +616,7 @@ void TEXTURE_OT_new(wmOperatorType *ot) /********************** new world operator *********************/ -static int new_world_exec(bContext *C, wmOperator *op) +static int new_world_exec(bContext *C, wmOperator *UNUSED(op)) { World *wo= CTX_data_pointer_get_type(C, "world", &RNA_World).data; PointerRNA ptr, idptr; @@ -656,7 +662,7 @@ void WORLD_OT_new(wmOperatorType *ot) /********************** render layer operators *********************/ -static int render_layer_add_exec(bContext *C, wmOperator *op) +static int render_layer_add_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); @@ -682,7 +688,7 @@ void SCENE_OT_render_layer_add(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int render_layer_remove_exec(bContext *C, wmOperator *op) +static int render_layer_remove_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); SceneRenderLayer *rl; @@ -1321,7 +1327,7 @@ static int save_envmap(wmOperator *op, Scene *scene, EnvMap *env, char *str, int dx= env->cube[1]->x; if (env->type == ENV_CUBE) { - ibuf = IMB_allocImBuf(3*dx, 2*dx, 24, IB_rectfloat, 0); + ibuf = IMB_allocImBuf(3*dx, 2*dx, 24, IB_rectfloat); IMB_rectcpy(ibuf, env->cube[0], 0, 0, 0, 0, dx, dx); IMB_rectcpy(ibuf, env->cube[1], dx, 0, 0, 0, dx, dx); @@ -1331,7 +1337,7 @@ static int save_envmap(wmOperator *op, Scene *scene, EnvMap *env, char *str, int IMB_rectcpy(ibuf, env->cube[5], 2*dx, dx, 0, 0, dx, dx); } else if (env->type == ENV_PLANE) { - ibuf = IMB_allocImBuf(dx, dx, 24, IB_rectfloat, 0); + ibuf = IMB_allocImBuf(dx, dx, 24, IB_rectfloat); IMB_rectcpy(ibuf, env->cube[1], 0, 0, 0, 0, dx, dx); } @@ -1339,7 +1345,7 @@ static int save_envmap(wmOperator *op, Scene *scene, EnvMap *env, char *str, int ibuf->profile = IB_PROFILE_LINEAR_RGB; /* to save, we first get absolute path */ - BLI_path_abs(str, G.sce); + BLI_path_abs(str, G.main->name); if (BKE_write_ibuf(scene, ibuf, str, imtype, scene->r.subimtype, scene->r.quality)) { retval = OPERATOR_FINISHED; @@ -1350,7 +1356,7 @@ static int save_envmap(wmOperator *op, Scene *scene, EnvMap *env, char *str, int } /* in case we were saving with relative paths, change back again */ if(relative) - BLI_path_rel(str, G.sce); + BLI_path_rel(str, G.main->name); IMB_freeImBuf(ibuf); ibuf = NULL; @@ -1383,7 +1389,7 @@ static int envmap_save_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int envmap_save_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int envmap_save_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { //Scene *scene= CTX_data_scene(C); @@ -1395,7 +1401,7 @@ static int envmap_save_invoke(bContext *C, wmOperator *op, wmEvent *event) //RNA_enum_set(op->ptr, "file_type", scene->r.imtype); - RNA_string_set(op->ptr, "filepath", G.sce); + RNA_string_set(op->ptr, "filepath", G.main->name); WM_event_add_fileselect(C, op); return OPERATOR_RUNNING_MODAL; @@ -1435,7 +1441,7 @@ void TEXTURE_OT_envmap_save(wmOperatorType *ot) WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH); } -static int envmap_clear_exec(bContext *C, wmOperator *op) +static int envmap_clear_exec(bContext *C, wmOperator *UNUSED(op)) { Tex *tex= CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data; @@ -1475,7 +1481,7 @@ void TEXTURE_OT_envmap_clear(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int envmap_clear_all_exec(bContext *C, wmOperator *op) +static int envmap_clear_all_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain = CTX_data_main(C); Tex *tex; @@ -1507,7 +1513,7 @@ void TEXTURE_OT_envmap_clear_all(wmOperatorType *ot) /********************** material operators *********************/ /* material copy/paste */ -static int copy_material_exec(bContext *C, wmOperator *op) +static int copy_material_exec(bContext *C, wmOperator *UNUSED(op)) { Material *ma= CTX_data_pointer_get_type(C, "material", &RNA_Material).data; @@ -1535,7 +1541,7 @@ void MATERIAL_OT_copy(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int paste_material_exec(bContext *C, wmOperator *op) +static int paste_material_exec(bContext *C, wmOperator *UNUSED(op)) { Material *ma= CTX_data_pointer_get_type(C, "material", &RNA_Material).data; @@ -1635,7 +1641,7 @@ void paste_mtex_copybuf(ID *id) } -static int copy_mtex_exec(bContext *C, wmOperator *op) +static int copy_mtex_exec(bContext *C, wmOperator *UNUSED(op)) { ID *id= CTX_data_pointer_get_type(C, "texture_slot", &RNA_TextureSlot).id.data; @@ -1674,7 +1680,7 @@ void TEXTURE_OT_slot_copy(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int paste_mtex_exec(bContext *C, wmOperator *op) +static int paste_mtex_exec(bContext *C, wmOperator *UNUSED(op)) { ID *id= CTX_data_pointer_get_type(C, "texture_slot", &RNA_TextureSlot).id.data; diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 7f5485ae8b6..ae1388fb7f2 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -144,7 +144,7 @@ void ED_area_do_refresh(bContext *C, ScrArea *sa) /* based on screen region draw tags, set draw tags in azones, and future region tabs etc */ /* only exported for WM */ -void ED_area_overdraw_flush(bContext *C, ScrArea *sa, ARegion *ar) +void ED_area_overdraw_flush(ScrArea *sa, ARegion *ar) { AZone *az; @@ -187,7 +187,7 @@ static void area_draw_azone(short x1, short y1, short x2, short y2) } -static void region_draw_azone(ScrArea *sa, AZone *az) +static void region_draw_azone(AZone *az) { GLUquadricObj *qobj = NULL; short midx = az->x1 + (az->x2 - az->x1)/2; @@ -247,7 +247,7 @@ void ED_area_overdraw(bContext *C) if(az->type==AZONE_AREA) { area_draw_azone(az->x1, az->y1, az->x2, az->y2); } else if(az->type==AZONE_REGION) { - region_draw_azone(sa, az); + region_draw_azone(az); } az->do_draw= 0; @@ -817,7 +817,7 @@ static void area_calc_totrct(ScrArea *sa, int sizex, int sizey) /* used for area initialize below */ -static void region_subwindow(wmWindowManager *wm, wmWindow *win, ARegion *ar) +static void region_subwindow(wmWindow *win, ARegion *ar) { if(ar->flag & (RGN_FLAG_HIDDEN|RGN_FLAG_TOO_SMALL)) { if(ar->swinid) @@ -908,7 +908,7 @@ void ED_area_initialize(wmWindowManager *wm, wmWindow *win, ScrArea *sa) /* region windows, default and own handlers */ for(ar= sa->regionbase.first; ar; ar= ar->next) { - region_subwindow(wm, win, ar); + region_subwindow(win, ar); if(ar->swinid) { /* default region handlers */ @@ -931,7 +931,7 @@ void ED_region_init(bContext *C, ARegion *ar) // ARegionType *at= ar->type; /* refresh can be called before window opened */ - region_subwindow(CTX_wm_manager(C), CTX_wm_window(C), ar); + region_subwindow(CTX_wm_window(C), ar); ar->winx= ar->winrct.xmax - ar->winrct.xmin + 1; ar->winy= ar->winrct.ymax - ar->winrct.ymin + 1; @@ -1156,7 +1156,7 @@ static char *editortype_pup(void) ); } -static void spacefunc(struct bContext *C, void *arg1, void *arg2) +static void spacefunc(struct bContext *C, void *UNUSED(arg1), void *UNUSED(arg2)) { ED_area_newspace(C, CTX_wm_area(C), CTX_wm_area(C)->butspacetype); ED_area_tag_redraw(CTX_wm_area(C)); @@ -1244,7 +1244,7 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, char *contex uiBeginPanels(C, ar); /* set view2d view matrix for scrolling (without scrollers) */ - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); for(pt= ar->type->paneltypes.first; pt; pt= pt->next) { /* verify context */ @@ -1365,7 +1365,7 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, char *contex UI_view2d_totRect_set(v2d, x+V2D_SCROLL_WIDTH, y+V2D_SCROLL_HEIGHT); /* set the view */ - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); /* this does the actual drawing! */ uiEndPanels(C, ar); @@ -1414,7 +1414,7 @@ void ED_region_header(const bContext *C, ARegion *ar) glClear(GL_COLOR_BUFFER_BIT); /* set view2d view matrix for scrolling (without scrollers) */ - UI_view2d_view_ortho(C, &ar->v2d); + UI_view2d_view_ortho(&ar->v2d); xco= maxco= 8; yco= HEADERY-3; diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c index 06da91c3e37..a6c4c77e468 100644 --- a/source/blender/editors/screen/glutil.c +++ b/source/blender/editors/screen/glutil.c @@ -527,7 +527,8 @@ void glaDrawPixelsTex(float x, float y, int img_w, int img_h, int format, void * glaDrawPixelsTexScaled(x, y, img_w, img_h, format, rect, 1.0f, 1.0f); } -void glaDrawPixelsSafe_to32(float fx, float fy, int img_w, int img_h, int row_w, float *rectf, int gamma_correct) +/* row_w is unused but kept for completeness */ +void glaDrawPixelsSafe_to32(float fx, float fy, int img_w, int img_h, int UNUSED(row_w), float *rectf, int gamma_correct) { unsigned char *rect32; diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index 32e82571609..9d178a57465 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -309,7 +309,7 @@ static void screen_delarea(bContext *C, bScreen *sc, ScrArea *sa) /* return 0: no split possible */ /* else return (integer) screencoordinate split point */ -static short testsplitpoint(wmWindow *win, ScrArea *sa, char dir, float fac) +static short testsplitpoint(ScrArea *sa, char dir, float fac) { short x, y; @@ -345,7 +345,7 @@ static short testsplitpoint(wmWindow *win, ScrArea *sa, char dir, float fac) } } -ScrArea *area_split(wmWindow *win, bScreen *sc, ScrArea *sa, char dir, float fac) +ScrArea *area_split(bScreen *sc, ScrArea *sa, char dir, float fac) { ScrArea *newa=NULL; ScrVert *sv1, *sv2; @@ -353,7 +353,7 @@ ScrArea *area_split(wmWindow *win, bScreen *sc, ScrArea *sa, char dir, float fac if(sa==NULL) return NULL; - split= testsplitpoint(win, sa, dir, fac); + split= testsplitpoint(sa, dir, fac); if(split==0) return NULL; if(dir=='h') { @@ -484,7 +484,7 @@ static void screen_copy(bScreen *to, bScreen *from) /* with sa as center, sb is located at: 0=W, 1=N, 2=E, 3=S */ /* -1 = not valid check */ /* used with join operator */ -int area_getorientation(bScreen *screen, ScrArea *sa, ScrArea *sb) +int area_getorientation(ScrArea *sa, ScrArea *sb) { ScrVert *sav1, *sav2, *sav3, *sav4; ScrVert *sbv1, *sbv2, *sbv3, *sbv4; @@ -523,7 +523,7 @@ int screen_area_join(bContext *C, bScreen* scr, ScrArea *sa1, ScrArea *sa2) { int dir; - dir = area_getorientation(scr, sa1, sa2); + dir = area_getorientation(sa1, sa2); /*printf("dir is : %i \n", dir);*/ if (dir < 0) @@ -861,7 +861,7 @@ static void scrarea_draw_shape_dark(ScrArea *sa, char dir) } /* draw screen area ligher with arrow shape ("eraser" of previous dark shape) */ -static void scrarea_draw_shape_light(ScrArea *sa, char dir) +static void scrarea_draw_shape_light(ScrArea *sa, char UNUSED(dir)) { glBlendFunc(GL_DST_COLOR, GL_SRC_ALPHA); glEnable(GL_BLEND); @@ -993,7 +993,7 @@ void ED_screen_draw(wmWindow *win) /* blended join arrow */ if (sa1 && sa2) { - dir = area_getorientation(win->screen, sa1, sa2); + dir = area_getorientation(sa1, sa2); if (dir >= 0) { switch(dir) { case 0: /* W */ @@ -1613,7 +1613,7 @@ ScrArea *ED_screen_full_toggle(bContext *C, wmWindow *win, ScrArea *sa) oldscreen->animtimer= NULL; /* returns the top small area */ - newa= area_split(win, sc, (ScrArea *)sc->areabase.first, 'h', 0.99f); + newa= area_split(sc, (ScrArea *)sc->areabase.first, 'h', 0.99f); ED_area_newspace(C, newa, SPACE_INFO); /* use random area when we have no active one, e.g. when the @@ -1739,7 +1739,7 @@ void ED_screen_animation_timer_update(bScreen *screen, int redraws, int refresh) } /* results in fully updated anim system */ -void ED_update_for_newframe(const bContext *C, int mute) +void ED_update_for_newframe(const bContext *C, int UNUSED(mute)) { Main *bmain= CTX_data_main(C); bScreen *screen= CTX_wm_screen(C); diff --git a/source/blender/editors/screen/screen_intern.h b/source/blender/editors/screen/screen_intern.h index 79789b1876e..b20daf9a0c8 100644 --- a/source/blender/editors/screen/screen_intern.h +++ b/source/blender/editors/screen/screen_intern.h @@ -37,9 +37,9 @@ void area_copy_data (ScrArea *sa1, ScrArea *sa2, int swap_space); /* screen_edit.c */ ScrEdge *screen_findedge(bScreen *sc, ScrVert *v1, ScrVert *v2); -ScrArea *area_split(wmWindow *win, bScreen *sc, ScrArea *sa, char dir, float fac); +ScrArea *area_split(bScreen *sc, ScrArea *sa, char dir, float fac); int screen_area_join(bContext *C, bScreen* scr, ScrArea *sa1, ScrArea *sa2); -int area_getorientation(bScreen *screen, ScrArea *sa, ScrArea *sb); +int area_getorientation(ScrArea *sa, ScrArea *sb); void select_connected_scredge(bScreen *sc, ScrEdge *edge); void removenotused_scrverts(bScreen *sc); diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 613c8bc0178..5a6acd24c5f 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -262,11 +262,16 @@ int ED_operator_editarmature(bContext *C) int ED_operator_posemode(bContext *C) { Object *obact= CTX_data_active_object(C); - Object *obedit= CTX_data_edit_object(C); - - if ((obact != obedit) && ED_object_pose_armature(obact)) - return 1; - + + if ((obact != CTX_data_edit_object(C))) { + Object *obpose; + if((obpose= ED_object_pose_armature(obact))) { + if((obact == obpose) || (obact->mode & OB_MODE_WEIGHT_PAINT)) { + return 1; + } + } + } + return 0; } @@ -438,7 +443,7 @@ AZone *is_in_area_actionzone(ScrArea *sa, int x, int y) } -static void actionzone_exit(bContext *C, wmOperator *op) +static void actionzone_exit(wmOperator *op) { if(op->customdata) MEM_freeN(op->customdata); @@ -484,7 +489,7 @@ static int actionzone_invoke(bContext *C, wmOperator *op, wmEvent *event) /* region azone directly reacts on mouse clicks */ if(sad->az->type==AZONE_REGION) { actionzone_apply(C, op, AZONE_REGION); - actionzone_exit(C, op); + actionzone_exit(op); return OPERATOR_FINISHED; } else { @@ -524,16 +529,16 @@ static int actionzone_modal(bContext *C, wmOperator *op, wmEvent *event) sad->sa2= screen_areahascursor(CTX_wm_screen(C), event->x, event->y); /* apply sends event */ actionzone_apply(C, op, sad->az->type); - actionzone_exit(C, op); + actionzone_exit(op); return OPERATOR_FINISHED; } break; case ESCKEY: - actionzone_exit(C, op); + actionzone_exit(op); return OPERATOR_CANCELLED; case LEFTMOUSE: - actionzone_exit(C, op); + actionzone_exit(op); return OPERATOR_CANCELLED; } @@ -584,7 +589,7 @@ typedef struct sAreaSwapData { ScrArea *sa1, *sa2; } sAreaSwapData; -static int area_swap_init(bContext *C, wmOperator *op, wmEvent *event) +static int area_swap_init(wmOperator *op, wmEvent *event) { sAreaSwapData *sd= NULL; sActionzoneData *sad= event->customdata; @@ -618,7 +623,7 @@ static int area_swap_cancel(bContext *C, wmOperator *op) static int area_swap_invoke(bContext *C, wmOperator *op, wmEvent *event) { - if(!area_swap_init(C, op, event)) + if(!area_swap_init(op, event)) return OPERATOR_PASS_THROUGH; /* add modal handler */ @@ -704,7 +709,7 @@ static int area_dupli_invoke(bContext *C, wmOperator *op, wmEvent *event) /* poll() checks area context, but we don't accept full-area windows */ if(sc->full != SCREENNORMAL) { if(event->type==EVT_ACTIONZONE_AREA) - actionzone_exit(C, op); + actionzone_exit(op); return OPERATOR_CANCELLED; } @@ -726,7 +731,7 @@ static int area_dupli_invoke(bContext *C, wmOperator *op, wmEvent *event) WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL); if(event->type==EVT_ACTIONZONE_AREA) - actionzone_exit(C, op); + actionzone_exit(op); return OPERATOR_FINISHED; } @@ -1120,7 +1125,7 @@ static int area_split_apply(bContext *C, wmOperator *op) fac= RNA_float_get(op->ptr, "factor"); dir= RNA_enum_get(op->ptr, "direction"); - sd->narea= area_split(CTX_wm_window(C), sc, sd->sarea, dir, fac); + sd->narea= area_split(sc, sd->sarea, dir, fac); if(sd->narea) { ScrVert *sv; @@ -1553,15 +1558,32 @@ static void SCREEN_OT_frame_offset(wmOperatorType *ot) static int frame_jump_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); - - if (RNA_boolean_get(op->ptr, "end")) - CFRA= PEFRA; - else - CFRA= PSFRA; - - sound_seek_scene(C); + wmTimer *animtimer= CTX_wm_screen(C)->animtimer; - WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene); + /* 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 + * simulations aren't reset properly). + */ + if(animtimer) { + ScreenAnimData *sad = animtimer->customdata; + + sad->flag |= ANIMPLAY_FLAG_USE_NEXT_FRAME; + + if (RNA_boolean_get(op->ptr, "end")) + sad->nextfra= PEFRA; + else + sad->nextfra= PSFRA; + } + else { + if (RNA_boolean_get(op->ptr, "end")) + CFRA= PEFRA; + else + CFRA= PSFRA; + + sound_seek_scene(C); + + WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene); + } return OPERATOR_FINISHED; } @@ -1719,7 +1741,7 @@ static void SCREEN_OT_screen_set(wmOperatorType *ot) /* function to be called outside UI context, or for redo */ -static int screen_full_area_exec(bContext *C, wmOperator *op) +static int screen_full_area_exec(bContext *C, wmOperator *UNUSED(op)) { ED_screen_full_toggle(C, CTX_wm_window(C), CTX_wm_area(C)); return OPERATOR_FINISHED; @@ -1926,7 +1948,7 @@ static int area_join_modal(bContext *C, wmOperator *op, wmEvent *event) if (sa) { if (jd->sa1 != sa) { - dir = area_getorientation(sc, jd->sa1, sa); + dir = area_getorientation(jd->sa1, sa); if (dir >= 0) { if (jd->sa2) jd->sa2->flag &= ~AREA_FLAG_DRAWJOINTO; jd->sa2 = sa; @@ -1937,7 +1959,7 @@ static int area_join_modal(bContext *C, wmOperator *op, wmEvent *event) we check if area has common border with the one marked for removal in this case we can swap areas. */ - dir = area_getorientation(sc, sa, jd->sa2); + dir = area_getorientation(sa, jd->sa2); if (dir >= 0) { if (jd->sa1) jd->sa1->flag &= ~AREA_FLAG_DRAWJOINFROM; if (jd->sa2) jd->sa2->flag &= ~AREA_FLAG_DRAWJOINTO; @@ -1963,13 +1985,13 @@ static int area_join_modal(bContext *C, wmOperator *op, wmEvent *event) jd->sa2 = sa; if (jd->sa1) jd->sa1->flag |= AREA_FLAG_DRAWJOINFROM; if (jd->sa2) jd->sa2->flag |= AREA_FLAG_DRAWJOINTO; - dir = area_getorientation(sc, jd->sa1, jd->sa2); + dir = area_getorientation(jd->sa1, jd->sa2); if (dir < 0) { printf("oops, didn't expect that!\n"); } } else { - dir = area_getorientation(sc, jd->sa1, sa); + dir = area_getorientation(jd->sa1, sa); if (dir >= 0) { if (jd->sa2) jd->sa2->flag &= ~AREA_FLAG_DRAWJOINTO; jd->sa2 = sa; @@ -2026,7 +2048,7 @@ static void SCREEN_OT_area_join(wmOperatorType *ot) /* ************** repeat last operator ***************************** */ -static int repeat_last_exec(bContext *C, wmOperator *op) +static int repeat_last_exec(bContext *C, wmOperator *UNUSED(op)) { wmOperator *lastop= CTX_wm_manager(C)->operators.last; @@ -2050,7 +2072,7 @@ static void SCREEN_OT_repeat_last(wmOperatorType *ot) } -static int repeat_history_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int repeat_history_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { wmWindowManager *wm= CTX_wm_manager(C); wmOperator *lastop; @@ -2107,7 +2129,7 @@ static void SCREEN_OT_repeat_history(wmOperatorType *ot) /* ********************** redo operator ***************************** */ -static int redo_last_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int redo_last_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event)) { wmWindowManager *wm= CTX_wm_manager(C); wmOperator *lastop; @@ -2235,7 +2257,7 @@ static void SCREEN_OT_region_quadview(wmOperatorType *ot) /* ************** region flip operator ***************************** */ /* flip a region alignment */ -static int region_flip_exec(bContext *C, wmOperator *op) +static int region_flip_exec(bContext *C, wmOperator *UNUSED(op)) { ARegion *ar= CTX_wm_region(C); @@ -2273,7 +2295,7 @@ static void SCREEN_OT_region_flip(wmOperatorType *ot) /* ************** header flip operator ***************************** */ /* flip a header region alignment */ -static int header_flip_exec(bContext *C, wmOperator *op) +static int header_flip_exec(bContext *C, wmOperator *UNUSED(op)) { ARegion *ar= CTX_wm_region(C); @@ -2327,7 +2349,7 @@ static void SCREEN_OT_header_flip(wmOperatorType *ot) /* ************** header tools operator ***************************** */ -static int header_toolbox_invoke(bContext *C, wmOperator *op, wmEvent *event) +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); @@ -2441,7 +2463,7 @@ static int match_region_with_redraws(int spacetype, int regiontype, int redraws) return 0; } -static int screen_animation_step(bContext *C, wmOperator *op, wmEvent *event) +static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), wmEvent *event) { bScreen *screen= CTX_wm_screen(C); @@ -2513,6 +2535,13 @@ static int screen_animation_step(bContext *C, wmOperator *op, wmEvent *event) } } } + + /* next frame overriden by user action (pressed jump to first/last frame) */ + if(sad->flag & ANIMPLAY_FLAG_USE_NEXT_FRAME) { + scene->r.cfra = sad->nextfra; + sad->flag &= ~ANIMPLAY_FLAG_USE_NEXT_FRAME; + sad->flag |= ANIMPLAY_FLAG_JUMPED; + } if (sad->flag & ANIMPLAY_FLAG_JUMPED) sound_seek_scene(C); @@ -2643,7 +2672,7 @@ static void SCREEN_OT_animation_play(wmOperatorType *ot) RNA_def_boolean(ot->srna, "sync", 0, "Sync", "Drop frames to maintain framerate"); } -static int screen_animation_cancel_exec(bContext *C, wmOperator *op) +static int screen_animation_cancel_exec(bContext *C, wmOperator *UNUSED(op)) { bScreen *screen= CTX_wm_screen(C); @@ -2771,7 +2800,7 @@ static void SCREEN_OT_back_to_previous(struct wmOperatorType *ot) /* *********** show user pref window ****** */ -static int userpref_show_invoke(bContext *C, wmOperator *unused, wmEvent *event) +static int userpref_show_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event) { ScrArea *sa; rcti rect; @@ -2810,7 +2839,7 @@ static void SCREEN_OT_userpref_show(struct wmOperatorType *ot) /********************* new screen operator *********************/ -static int screen_new_exec(bContext *C, wmOperator *op) +static int screen_new_exec(bContext *C, wmOperator *UNUSED(op)) { wmWindow *win= CTX_wm_window(C); bScreen *sc= CTX_wm_screen(C); @@ -2837,7 +2866,7 @@ void SCREEN_OT_new(wmOperatorType *ot) /********************* delete screen operator *********************/ -static int screen_delete_exec(bContext *C, wmOperator *op) +static int screen_delete_exec(bContext *C, wmOperator *UNUSED(op)) { bScreen *sc= CTX_wm_screen(C); @@ -2868,7 +2897,7 @@ static int scene_new_exec(bContext *C, wmOperator *op) Main *bmain= CTX_data_main(C); int type= RNA_enum_get(op->ptr, "type"); - newscene= copy_scene(bmain, scene, type); + newscene= copy_scene(scene, type); /* these can't be handled in blenkernel curently, so do them here */ if(type == SCE_COPY_LINK_DATA) @@ -2908,7 +2937,7 @@ void SCENE_OT_new(wmOperatorType *ot) /********************* delete scene operator *********************/ -static int scene_delete_exec(bContext *C, wmOperator *op) +static int scene_delete_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c index 56efa0a5a83..082c9f2f721 100644 --- a/source/blender/editors/screen/screendump.c +++ b/source/blender/editors/screen/screendump.c @@ -42,6 +42,7 @@ #include "BKE_context.h" #include "BKE_global.h" +#include "BKE_main.h" #include "BKE_image.h" #include "BKE_report.h" #include "BKE_writeavi.h" @@ -77,14 +78,14 @@ static int screenshot_exec(bContext *C, wmOperator *op) RNA_string_get(op->ptr, "filepath", path); strcpy(G.ima, path); - BLI_path_abs(path, G.sce); + BLI_path_abs(path, G.main->name); /* BKE_add_image_extension() checks for if extension was already set */ if(scene->r.scemode & R_EXTENSION) if(strlen(path)<FILE_MAXDIR+FILE_MAXFILE-5) BKE_add_image_extension(path, scene->r.imtype); - ibuf= IMB_allocImBuf(scd->dumpsx, scd->dumpsy, 24, 0, 0); + ibuf= IMB_allocImBuf(scd->dumpsx, scd->dumpsy, 24, 0); ibuf->rect= scd->dumprect; BKE_write_ibuf(scene, ibuf, path, scene->r.imtype, scene->r.subimtype, scene->r.quality); @@ -132,7 +133,7 @@ static unsigned int *screenshot(bContext *C, int *dumpsx, int *dumpsy, int fscre } -static int screenshot_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int screenshot_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { unsigned int *dumprect; int dumpsx, dumpsy; @@ -214,7 +215,7 @@ static void screenshot_updatejob(void *sjv) /* only this runs inside thread */ -static void screenshot_startjob(void *sjv, short *stop, short *do_update, float *progress) +static void screenshot_startjob(void *sjv, short *stop, short *do_update, float *UNUSED(progress)) { ScreenshotJob *sj= sjv; RenderData rd= sj->scene->r; @@ -251,7 +252,7 @@ static void screenshot_startjob(void *sjv, short *stop, short *do_update, float break; } else { - ImBuf *ibuf= IMB_allocImBuf(sj->dumpsx, sj->dumpsy, rd.planes, 0, 0); + ImBuf *ibuf= IMB_allocImBuf(sj->dumpsx, sj->dumpsy, rd.planes, 0); char name[FILE_MAXDIR+FILE_MAXFILE]; int ok; diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 6e921b57d9d..71754c3589a 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -383,7 +383,7 @@ static void *image_undo_push_tile(Image *ima, ImBuf *ibuf, ImBuf **tmpibuf, int return tile->rect; if (*tmpibuf==NULL) - *tmpibuf = IMB_allocImBuf(IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, 32, IB_rectfloat|IB_rect, 0); + *tmpibuf = IMB_allocImBuf(IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, 32, IB_rectfloat|IB_rect); tile= MEM_callocN(sizeof(UndoImageTile), "UndoImageTile"); strcpy(tile->idname, ima->id.name); @@ -410,7 +410,7 @@ static void image_undo_restore(bContext *C, ListBase *lb) UndoImageTile *tile; tmpibuf= IMB_allocImBuf(IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, 32, - IB_rectfloat|IB_rect, 0); + IB_rectfloat|IB_rect); for(tile=lb->first; tile; tile=tile->next) { /* find image based on name, pointer becomes invalid with global undo */ @@ -473,8 +473,6 @@ static int project_bucket_offset_safe(const ProjPaintState *ps, const float proj } } -#define SIDE_OF_LINE(pa, pb, pp) ((pa[0]-pp[0])*(pb[1]-pp[1]))-((pb[0]-pp[0])*(pa[1]-pp[1])) - /* still use 2D X,Y space but this works for verts transformed by a perspective matrix, using their 4th component as a weight */ static void barycentric_weights_v2_persp(float v1[4], float v2[4], float v3[4], float co[2], float w[3]) { @@ -1689,7 +1687,7 @@ static float Vec2Lenf_nosqrt_other(const float *v1, const float v2_1, const floa /* note, use a squared value so we can use Vec2Lenf_nosqrt * be sure that you have done a bounds check first or this may fail */ /* only give bucket_bounds as an arg because we need it elsewhere */ -static int project_bucket_isect_circle(const int bucket_x, const int bucket_y, const float cent[2], const float radius_squared, rctf *bucket_bounds) +static int project_bucket_isect_circle(const float cent[2], const float radius_squared, rctf *bucket_bounds) { /* Would normally to a simple intersection test, however we know the bounds of these 2 already intersect @@ -1852,7 +1850,7 @@ static void project_bucket_clip_face( { int inside_bucket_flag = 0; int inside_face_flag = 0; - const int flip = ((SIDE_OF_LINE(v1coSS, v2coSS, v3coSS) > 0.0f) != (SIDE_OF_LINE(uv1co, uv2co, uv3co) > 0.0f)); + const int flip = ((line_point_side_v2(v1coSS, v2coSS, v3coSS) > 0.0f) != (line_point_side_v2(uv1co, uv2co, uv3co) > 0.0f)); float bucket_bounds_ss[4][2]; @@ -2134,15 +2132,15 @@ if __name__ == '__main__': /* checks if pt is inside a convex 2D polyline, the polyline must be ordered rotating clockwise - * otherwise it would have to test for mixed (SIDE_OF_LINE > 0.0f) cases */ + * otherwise it would have to test for mixed (line_point_side_v2 > 0.0f) cases */ int IsectPoly2Df(const float pt[2], float uv[][2], const int tot) { int i; - if (SIDE_OF_LINE(uv[tot-1], uv[0], pt) < 0.0f) + if (line_point_side_v2(uv[tot-1], uv[0], pt) < 0.0f) return 0; for (i=1; i<tot; i++) { - if (SIDE_OF_LINE(uv[i-1], uv[i], pt) < 0.0f) + if (line_point_side_v2(uv[i-1], uv[i], pt) < 0.0f) return 0; } @@ -2152,10 +2150,10 @@ int IsectPoly2Df(const float pt[2], float uv[][2], const int tot) static int IsectPoly2Df_twoside(const float pt[2], float uv[][2], const int tot) { int i; - int side = (SIDE_OF_LINE(uv[tot-1], uv[0], pt) > 0.0f); + int side = (line_point_side_v2(uv[tot-1], uv[0], pt) > 0.0f); for (i=1; i<tot; i++) { - if ((SIDE_OF_LINE(uv[i-1], uv[i], pt) > 0.0f) != side) + if ((line_point_side_v2(uv[i-1], uv[i], pt) > 0.0f) != side) return 0; } @@ -2652,7 +2650,7 @@ static void project_bucket_init(const ProjPaintState *ps, const int thread_index * calculated when it might not be needed later, (at the moment at least) * obviously it shouldn't have bugs though */ -static int project_bucket_face_isect(ProjPaintState *ps, float min[2], float max[2], int bucket_x, int bucket_y, int bucket_index, const MFace *mf) +static int project_bucket_face_isect(ProjPaintState *ps, int bucket_x, int bucket_y, const MFace *mf) { /* TODO - replace this with a tricker method that uses sideofline for all screenCoords's edges against the closest bucket corner */ rctf bucket_bounds; @@ -2712,11 +2710,11 @@ static int project_bucket_face_isect(ProjPaintState *ps, float min[2], float max /* Add faces to the bucket but dont initialize its pixels * TODO - when painting occluded, sort the faces on their min-Z and only add faces that faces that are not occluded */ -static void project_paint_delayed_face_init(ProjPaintState *ps, const MFace *mf, const MTFace *tf, const int face_index) +static void project_paint_delayed_face_init(ProjPaintState *ps, const MFace *mf, const int face_index) { float min[2], max[2], *vCoSS; int bucketMin[2], bucketMax[2]; /* for ps->bucketRect indexing */ - int fidx, bucket_x, bucket_y, bucket_index; + int fidx, bucket_x, bucket_y; int has_x_isect = -1, has_isect = 0; /* for early loop exit */ MemArena *arena = ps->arena_mt[0]; /* just use the first thread arena since threading has not started yet */ @@ -2733,10 +2731,8 @@ static void project_paint_delayed_face_init(ProjPaintState *ps, const MFace *mf, for (bucket_y = bucketMin[1]; bucket_y < bucketMax[1]; bucket_y++) { has_x_isect = 0; for (bucket_x = bucketMin[0]; bucket_x < bucketMax[0]; bucket_x++) { - - bucket_index = bucket_x + (bucket_y * ps->buckets_x); - - if (project_bucket_face_isect(ps, min, max, bucket_x, bucket_y, bucket_index, mf)) { + if (project_bucket_face_isect(ps, bucket_x, bucket_y, mf)) { + int bucket_index= bucket_x + (bucket_y * ps->buckets_x); BLI_linklist_prepend_arena( &ps->bucketFaces[ bucket_index ], SET_INT_IN_POINTER(face_index), /* cast to a pointer to shut up the compiler */ @@ -3194,7 +3190,7 @@ static void project_paint_begin(ProjPaintState *ps) } } else { - if (SIDE_OF_LINE(v1coSS, v2coSS, v3coSS) < 0.0f) { + if (line_point_side_v2(v1coSS, v2coSS, v3coSS) < 0.0f) { continue; } @@ -3217,7 +3213,7 @@ static void project_paint_begin(ProjPaintState *ps) if (image_index != -1) { /* Initialize the faces screen pixels */ /* Add this to a list to initialize later */ - project_paint_delayed_face_init(ps, mf, tf, face_index); + project_paint_delayed_face_init(ps, mf, face_index); } } } @@ -3500,7 +3496,7 @@ static int project_bucket_iter_next(ProjPaintState *ps, int *bucket_index, rctf project_bucket_bounds(ps, ps->context_bucket_x, ps->context_bucket_y, bucket_bounds); if ( (ps->source != PROJ_SRC_VIEW) || - project_bucket_isect_circle(ps->context_bucket_x, ps->context_bucket_y, mval, (float)(diameter*diameter), bucket_bounds) + project_bucket_isect_circle(mval, (float)(diameter*diameter), bucket_bounds) ) { *bucket_index = ps->context_bucket_x + (ps->context_bucket_y * ps->buckets_x); ps->context_bucket_x++; @@ -3569,7 +3565,7 @@ static void blend_color_mix_accum(unsigned char *cp, const unsigned char *cp1, c cp[3]= alpha > 255 ? 255 : alpha; } -static void do_projectpaint_clone(ProjPaintState *ps, ProjPixel *projPixel, float *rgba, float alpha, float mask) +static void do_projectpaint_clone(ProjPaintState *ps, ProjPixel *projPixel, float alpha, float mask) { if (ps->is_airbrush==0 && mask < 1.0f) { projPixel->newColor.uint = IMB_blend_color(projPixel->newColor.uint, ((ProjPixelClone*)projPixel)->clonepx.uint, (int)(alpha*255), ps->blend); @@ -3580,7 +3576,7 @@ static void do_projectpaint_clone(ProjPaintState *ps, ProjPixel *projPixel, floa } } -static void do_projectpaint_clone_f(ProjPaintState *ps, ProjPixel *projPixel, float *rgba, float alpha, float mask) +static void do_projectpaint_clone_f(ProjPaintState *ps, ProjPixel *projPixel, float alpha, float mask) { if (ps->is_airbrush==0 && mask < 1.0f) { IMB_blend_color_float(projPixel->newColor.f, projPixel->newColor.f, ((ProjPixelClone *)projPixel)->clonepx.f, alpha, ps->blend); @@ -3597,7 +3593,7 @@ static void do_projectpaint_clone_f(ProjPaintState *ps, ProjPixel *projPixel, fl * accumulation of color greater then 'projPixel->mask' however in the case of smear its not * really that important to be correct as it is with clone and painting */ -static void do_projectpaint_smear(ProjPaintState *ps, ProjPixel *projPixel, float *rgba, float alpha, float mask, MemArena *smearArena, LinkNode **smearPixels, float co[2]) +static void do_projectpaint_smear(ProjPaintState *ps, ProjPixel *projPixel, float alpha, float mask, MemArena *smearArena, LinkNode **smearPixels, float co[2]) { unsigned char rgba_ub[4]; @@ -3608,7 +3604,7 @@ static void do_projectpaint_smear(ProjPaintState *ps, ProjPixel *projPixel, floa BLI_linklist_prepend_arena(smearPixels, (void *)projPixel, smearArena); } -static void do_projectpaint_smear_f(ProjPaintState *ps, ProjPixel *projPixel, float *rgba, float alpha, float mask, MemArena *smearArena, LinkNode **smearPixels_f, float co[2]) +static void do_projectpaint_smear_f(ProjPaintState *ps, ProjPixel *projPixel, float alpha, float mask, MemArena *smearArena, LinkNode **smearPixels_f, float co[2]) { unsigned char rgba_ub[4]; unsigned char rgba_smear[4]; @@ -3757,6 +3753,7 @@ static void *do_projectpaint_thread(void *ph_v) if (falloff > 0.0f) { if (ps->is_texbrush) { + /* note, for clone and smear, we only use the alpha, could be a special function */ brush_sample_tex(ps->brush, projPixel->projCoSS, rgba, thread_index); alpha = rgba[3]; } else { @@ -3808,20 +3805,20 @@ static void *do_projectpaint_thread(void *ph_v) case PAINT_TOOL_CLONE: if (is_floatbuf) { if (((ProjPixelClone *)projPixel)->clonepx.f[3]) { - do_projectpaint_clone_f(ps, projPixel, rgba, alpha, mask); + do_projectpaint_clone_f(ps, projPixel, alpha, mask); /* rgba isnt used for cloning, only alpha */ } } else { if (((ProjPixelClone*)projPixel)->clonepx.ch[3]) { - do_projectpaint_clone(ps, projPixel, rgba, alpha, mask); + do_projectpaint_clone(ps, projPixel, alpha, mask); /* rgba isnt used for cloning, only alpha */ } } break; case PAINT_TOOL_SMEAR: sub_v2_v2v2(co, projPixel->projCoSS, pos_ofs); - if (is_floatbuf) do_projectpaint_smear_f(ps, projPixel, rgba, alpha, mask, smearArena, &smearPixels_f, co); - else do_projectpaint_smear(ps, projPixel, rgba, alpha, mask, smearArena, &smearPixels, co); + if (is_floatbuf) do_projectpaint_smear_f(ps, projPixel, alpha, mask, smearArena, &smearPixels_f, co); + else do_projectpaint_smear(ps, projPixel, alpha, mask, smearArena, &smearPixels, co); break; default: if (is_floatbuf) do_projectpaint_draw_f(ps, projPixel, rgba, alpha, mask); @@ -3861,7 +3858,7 @@ static void *do_projectpaint_thread(void *ph_v) return NULL; } -static int project_paint_op(void *state, ImBuf *ibufb, float *lastpos, float *pos) +static int project_paint_op(void *state, ImBuf *UNUSED(ibufb), float *lastpos, float *pos) { /* First unpack args from the struct */ ProjPaintState *ps = (ProjPaintState *)state; @@ -3928,7 +3925,7 @@ static int project_paint_op(void *state, ImBuf *ibufb, float *lastpos, float *po } -static int project_paint_sub_stroke(ProjPaintState *ps, BrushPainter *painter, int *prevmval_i, int *mval_i, double time, float pressure) +static int project_paint_sub_stroke(ProjPaintState *ps, BrushPainter *painter, int *UNUSED(prevmval_i), int *mval_i, double time, float pressure) { /* Use mouse coords as floats for projection painting */ @@ -4194,7 +4191,7 @@ static ImBuf *imapaint_lift_clone(ImBuf *ibuf, ImBuf *ibufb, int *pos) /* note: allocImbuf returns zero'd memory, so regions outside image will have zero alpha, and hence not be blended onto the image */ int w=ibufb->x, h=ibufb->y, destx=0, desty=0, srcx=pos[0], srcy=pos[1]; - ImBuf *clonebuf= IMB_allocImBuf(w, h, ibufb->depth, ibufb->flags, 0); + ImBuf *clonebuf= IMB_allocImBuf(w, h, ibufb->depth, ibufb->flags); IMB_rectclip(clonebuf, ibuf, &destx, &desty, &srcx, &srcy, &w, &h); IMB_rectblend(clonebuf, ibuf, destx, desty, srcx, srcy, w, h, @@ -4387,7 +4384,7 @@ static int imapaint_paint_stroke(ViewContext *vc, ImagePaintState *s, BrushPaint ibuf= BKE_image_get_ibuf(newimage, s->sima? &s->sima->iuser: NULL); if(ibuf && ibuf->rect) - imapaint_pick_uv(s->scene, s->ob, s->me, newfaceindex, mval, newuv); + imapaint_pick_uv(s->scene, s->ob, newfaceindex, mval, newuv); else { newimage = NULL; newuv[0] = newuv[1] = 0.0f; @@ -4398,8 +4395,8 @@ static int imapaint_paint_stroke(ViewContext *vc, ImagePaintState *s, BrushPaint /* see if stroke is broken, and if so finish painting in old position */ if (s->image) { - imapaint_pick_uv(s->scene, s->ob, s->me, s->faceindex, mval, fwuv); - imapaint_pick_uv(s->scene, s->ob, s->me, newfaceindex, prevmval, bkuv); + imapaint_pick_uv(s->scene, s->ob, s->faceindex, mval, fwuv); + imapaint_pick_uv(s->scene, s->ob, newfaceindex, prevmval, bkuv); if (newimage == s->image) breakstroke= texpaint_break_stroke(s->uv, fwuv, bkuv, newuv); @@ -4410,7 +4407,7 @@ static int imapaint_paint_stroke(ViewContext *vc, ImagePaintState *s, BrushPaint fwuv[0]= fwuv[1]= 0.0f; if (breakstroke) { - imapaint_pick_uv(s->scene, s->ob, s->me, s->faceindex, mval, fwuv); + imapaint_pick_uv(s->scene, s->ob, s->faceindex, mval, fwuv); redraw |= imapaint_paint_sub_stroke(s, painter, s->image, texpaint, fwuv, time, 1, pressure); imapaint_clear_partial_redraw(); @@ -4923,7 +4920,7 @@ static int get_imapaint_zoom(bContext *C, float *zoomx, float *zoomy) /************************ cursor drawing *******************************/ -static void brush_drawcursor(bContext *C, int x, int y, void *customdata) +static void brush_drawcursor(bContext *C, int x, int y, void *UNUSED(customdata)) { Brush *brush= image_paint_brush(C); Paint *paint= paint_get_active(CTX_data_scene(C)); @@ -4989,10 +4986,10 @@ static int paint_radial_control_exec(bContext *C, wmOperator *op) Brush *brush = paint_brush(&CTX_data_scene(C)->toolsettings->imapaint.paint); float zoom; int ret; - char str[256]; + char str[64]; get_imapaint_zoom(C, &zoom, &zoom); ret = brush_radial_control_exec(op, brush, 1.0f / zoom); - WM_radial_control_string(op, str, 256); + WM_radial_control_string(op, str, sizeof(str)); WM_event_add_notifier(C, NC_BRUSH|NA_EDITED, brush); @@ -5087,7 +5084,7 @@ static int grab_clone_modal(bContext *C, wmOperator *op, wmEvent *event) return OPERATOR_RUNNING_MODAL; } -static int grab_clone_cancel(bContext *C, wmOperator *op) +static int grab_clone_cancel(bContext *UNUSED(C), wmOperator *op) { MEM_freeN(op->customdata); return OPERATOR_CANCELLED; @@ -5336,8 +5333,8 @@ static int texture_paint_radial_control_exec(bContext *C, wmOperator *op) { Brush *brush = paint_brush(&CTX_data_scene(C)->toolsettings->imapaint.paint); int ret = brush_radial_control_exec(op, brush, 1); - char str[256]; - WM_radial_control_string(op, str, 256); + char str[64]; + WM_radial_control_string(op, str, sizeof(str)); WM_event_add_notifier(C, NC_BRUSH|NA_EDITED, brush); diff --git a/source/blender/editors/sculpt_paint/paint_intern.h b/source/blender/editors/sculpt_paint/paint_intern.h index 3ed314095ef..6232a8f2de1 100644 --- a/source/blender/editors/sculpt_paint/paint_intern.h +++ b/source/blender/editors/sculpt_paint/paint_intern.h @@ -99,7 +99,7 @@ void PAINT_OT_image_from_view(struct wmOperatorType *ot); /* paint_utils.c */ int imapaint_pick_face(struct ViewContext *vc, struct Mesh *me, int *mval, unsigned int *index); -void imapaint_pick_uv(struct Scene *scene, struct Object *ob, struct Mesh *mesh, unsigned int faceindex, int *xy, float *uv); +void imapaint_pick_uv(struct Scene *scene, struct Object *ob, unsigned int faceindex, int *xy, float *uv); void paint_sample_color(struct Scene *scene, struct ARegion *ar, int x, int y); void BRUSH_OT_curve_preset(struct wmOperatorType *ot); diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c index b5cadb9c484..2e0338b370e 100644 --- a/source/blender/editors/sculpt_paint/paint_ops.c +++ b/source/blender/editors/sculpt_paint/paint_ops.c @@ -42,7 +42,7 @@ //#include <stdio.h> /* Brush operators */ -static int brush_add_exec(bContext *C, wmOperator *op) +static int brush_add_exec(bContext *C, wmOperator *UNUSED(op)) { /*int type = RNA_enum_get(op->ptr, "type");*/ Paint *paint = paint_get_active(CTX_data_scene(C)); @@ -129,7 +129,7 @@ void BRUSH_OT_scale_size(wmOperatorType *ot) RNA_def_float(ot->srna, "scalar", 1, 0, 2, "Scalar", "Factor to scale brush size by", 0, 2); } -static int vertex_color_set_exec(bContext *C, wmOperator *op) +static int vertex_color_set_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene = CTX_data_scene(C); Object *obact = CTX_data_active_object(C); @@ -154,7 +154,7 @@ void PAINT_OT_vertex_color_set(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int brush_reset_exec(bContext *C, wmOperator *op) +static int brush_reset_exec(bContext *C, wmOperator *UNUSED(op)) { Paint *paint = paint_get_active(CTX_data_scene(C)); struct Brush *brush = paint_brush(paint); @@ -290,7 +290,7 @@ static void ed_keymap_paint_brush_switch(wmKeyMap *keymap, const char *path) RNA_int_set(kmi->ptr, "value", 19); } -static void ed_keymap_paint_brush_size(wmKeyMap *keymap, const char *path) +static void ed_keymap_paint_brush_size(wmKeyMap *keymap, const char *UNUSED(path)) { wmKeyMapItem *kmi; diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index 6d58731d79c..ea99844bfac 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -253,7 +253,7 @@ static void make_snap(Snapshot* snap, Brush* brush, ViewContext* vc) snap->winy = vc->ar->winy; } -int load_tex(Sculpt *sd, Brush* br, ViewContext* vc) +static int load_tex(Sculpt *sd, Brush* br, ViewContext* vc) { static GLuint overlay_texture = 0; static int init = 0; @@ -268,8 +268,12 @@ int load_tex(Sculpt *sd, Brush* br, ViewContext* vc) int j; int refresh; +#ifndef _OPENMP + (void)sd; /* quied unused warning */ +#endif + if (br->mtex.brush_map_mode == MTEX_MAP_MODE_TILED && !br->mtex.tex) return 0; - + refresh = !overlay_texture || (br->mtex.tex && diff --git a/source/blender/editors/sculpt_paint/paint_undo.c b/source/blender/editors/sculpt_paint/paint_undo.c index c2f82b8e2e0..643e2cd6915 100644 --- a/source/blender/editors/sculpt_paint/paint_undo.c +++ b/source/blender/editors/sculpt_paint/paint_undo.c @@ -31,6 +31,7 @@ #include "BLI_listbase.h" +#include "BKE_utildefines.h" #include "BKE_context.h" #include "BKE_global.h" @@ -62,13 +63,13 @@ static UndoStack MeshUndoStack = {UNDO_PAINT_MESH, {NULL, NULL}, NULL}; /* Generic */ -static void undo_restore(bContext *C, UndoStack *stack, UndoElem *uel) +static void undo_restore(bContext *C, UndoStack *UNUSED(stack), UndoElem *uel) { if(uel && uel->restore) uel->restore(C, &uel->elems); } -static void undo_elem_free(UndoStack *stack, UndoElem *uel) +static void undo_elem_free(UndoStack *UNUSED(stack), UndoElem *uel) { if(uel && uel->free) { uel->free(&uel->elems); diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c index 0098b8ca12c..e3a486a0fee 100644 --- a/source/blender/editors/sculpt_paint/paint_utils.c +++ b/source/blender/editors/sculpt_paint/paint_utils.c @@ -88,7 +88,7 @@ static void imapaint_tri_weights(Object *ob, float *v1, float *v2, float *v3, fl } /* compute uv coordinates of mouse in face */ -void imapaint_pick_uv(Scene *scene, Object *ob, Mesh *mesh, unsigned int faceindex, int *xy, float *uv) +void imapaint_pick_uv(Scene *scene, Object *ob, unsigned int faceindex, int *xy, float *uv) { DerivedMesh *dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH); int *index = dm->getFaceDataArray(dm, CD_ORIGINDEX); @@ -233,7 +233,7 @@ void BRUSH_OT_curve_preset(wmOperatorType *ot) /* face-select ops */ -static int paint_select_linked_exec(bContext *C, wmOperator *op) +static int paint_select_linked_exec(bContext *C, wmOperator *UNUSED(op)) { select_linked_tfaces(C, CTX_data_active_object(C), NULL, 2); ED_region_tag_redraw(CTX_wm_region(C)); diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 399ba535e57..3c25d861d2f 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -852,7 +852,7 @@ static void wpaint_blend(VPaint *wp, MDeformWeight *dw, MDeformWeight *uw, float /* else */ /* sets wp->weight to the closest weight value to vertex */ /* note: we cant sample frontbuf, weight colors are interpolated too unpredictable */ -void sample_wpaint(Scene *scene, ARegion *ar, View3D *v3d, int mode) +void sample_wpaint(Scene *scene, ARegion *ar, View3D *UNUSED(v3d), int mode) { ViewContext vc; ToolSettings *ts= scene->toolsettings; @@ -1061,7 +1061,7 @@ static void do_weight_paint_vertex(VPaint *wp, Object *ob, int index, /* *************** set wpaint operator ****************** */ -static int set_wpaint(bContext *C, wmOperator *op) /* toggle */ +static int set_wpaint(bContext *C, wmOperator *UNUSED(op)) /* toggle */ { Object *ob= CTX_data_active_object(C); Scene *scene= CTX_data_scene(C); @@ -1256,7 +1256,7 @@ struct WPaintData { char *vgroup_validmap; /*stores if vgroups tie to deforming bones or not*/ }; -static char *wpaint_make_validmap(Mesh *me, Object *ob) +static char *wpaint_make_validmap(Object *ob) { bDeformGroup *dg; ModifierData *md; @@ -1314,7 +1314,7 @@ static char *wpaint_make_validmap(Mesh *me, Object *ob) return validmap; } -static int wpaint_stroke_test_start(bContext *C, wmOperator *op, wmEvent *event) +static int wpaint_stroke_test_start(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Scene *scene= CTX_data_scene(C); struct PaintStroke *stroke = op->customdata; @@ -1344,7 +1344,7 @@ static int wpaint_stroke_test_start(bContext *C, wmOperator *op, wmEvent *event) vgroups affect deform bones*/ wpd->auto_normalize = ts->auto_normalize; if (wpd->auto_normalize) - wpd->vgroup_validmap = wpaint_make_validmap(me, ob); + wpd->vgroup_validmap = wpaint_make_validmap(ob); // if(qual & LR_CTRLKEY) { // sample_wpaint(scene, ar, v3d, 0); @@ -1663,7 +1663,7 @@ void PAINT_OT_weight_paint(wmOperatorType *ot) RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", ""); } -static int weight_paint_set_exec(bContext *C, wmOperator *op) +static int weight_paint_set_exec(bContext *C, wmOperator *UNUSED(op)) { struct Scene *scene= CTX_data_scene(C); Object *obact = CTX_data_active_object(C); @@ -1780,7 +1780,7 @@ typedef struct VPaintData { float vpimat[3][3]; } VPaintData; -static int vpaint_stroke_test_start(bContext *C, struct wmOperator *op, wmEvent *event) +static int vpaint_stroke_test_start(bContext *C, struct wmOperator *op, wmEvent *UNUSED(event)) { ToolSettings *ts= CTX_data_tool_settings(C); struct PaintStroke *stroke = op->customdata; @@ -1817,7 +1817,7 @@ static int vpaint_stroke_test_start(bContext *C, struct wmOperator *op, wmEvent return 1; } -static void vpaint_paint_face(VPaint *vp, VPaintData *vpd, Object *ob, int index, float mval[2], float pressure, int flip) +static void vpaint_paint_face(VPaint *vp, VPaintData *vpd, Object *ob, int index, float mval[2], float pressure, int UNUSED(flip)) { ViewContext *vc = &vpd->vc; Brush *brush = paint_brush(&vp->paint); @@ -1971,7 +1971,7 @@ static int weight_from_bones_exec(bContext *C, wmOperator *op) Mesh *me= ob->data; int type= RNA_enum_get(op->ptr, "type"); - create_vgroups_from_armature(scene, ob, armob, type, (me->editflag & ME_EDIT_MIRROR_X)); + create_vgroups_from_armature(op->reports, scene, ob, armob, type, (me->editflag & ME_EDIT_MIRROR_X)); DAG_id_flush_update(&me->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_GEOM|ND_DATA, me); diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 2e192a08ca5..505e37d95f6 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -867,6 +867,8 @@ static void calc_area_normal(Sculpt *sd, SculptSession *ss, float an[3], PBVHNod float out_flip[3] = {0.0f, 0.0f, 0.0f}; + (void)sd; /* unused w/o openmp */ + zero_v3(an); #pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP) @@ -1667,6 +1669,8 @@ static void calc_flatten_center(Sculpt *sd, SculptSession *ss, PBVHNode **nodes, float count = 0; + (void)sd; /* unused w/o openmp */ + zero_v3(fc); #pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP) @@ -1721,6 +1725,8 @@ static void calc_area_normal_and_flatten_center(Sculpt *sd, SculptSession *ss, P // fc float count = 0; + (void)sd; /* unused w/o openmp */ + // an zero_v3(an); @@ -2534,8 +2540,10 @@ static void sculpt_combine_proxies(Sculpt *sd, SculptSession *ss) /* Flip all the editdata across the axis/axes specified by symm. Used to calculate multiple modifications to the mesh when symmetry is enabled. */ -static void calc_brushdata_symm(Sculpt *sd, StrokeCache *cache, const char symm, const char axis, const float angle, const float feather) +static void calc_brushdata_symm(Sculpt *sd, StrokeCache *cache, const char symm, const char axis, const float angle, const float UNUSED(feather)) { + (void)sd; /* unused */ + flip_coord(cache->location, cache->true_location, symm); flip_coord(cache->grab_delta_symmetry, cache->grab_delta, symm); flip_coord(cache->view_normal, cache->true_view_normal, symm); diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c index fe1fe3266bc..18f35502f8b 100644 --- a/source/blender/editors/sound/sound_ops.c +++ b/source/blender/editors/sound/sound_ops.c @@ -280,7 +280,7 @@ static int unpack_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int unpack_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int unpack_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Editing* ed = CTX_data_scene(C)->ed; bSound* sound; diff --git a/source/blender/editors/space_action/action_draw.c b/source/blender/editors/space_action/action_draw.c index d2067790b2f..ce9a96af38c 100644 --- a/source/blender/editors/space_action/action_draw.c +++ b/source/blender/editors/space_action/action_draw.c @@ -63,7 +63,7 @@ /* Channel List */ /* left hand part */ -void draw_channel_names(bContext *C, bAnimContext *ac, SpaceAction *saction, ARegion *ar) +void draw_channel_names(bContext *C, bAnimContext *ac, ARegion *ar) { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; @@ -90,8 +90,8 @@ void draw_channel_names(bContext *C, bAnimContext *ac, SpaceAction *saction, ARe */ v2d->tot.ymin= (float)(-height); } - /* need to do a view-sync here, so that the keys area doesn't jump around */ - UI_view2d_sync(NULL, ac->sa, v2d, V2D_VIEWSYNC_AREA_VERTICAL); + /* need to do a view-sync here, so that the keys area doesn't jump around (it must copy this) */ + UI_view2d_sync(NULL, ac->sa, v2d, V2D_LOCK_COPY); /* loop through channels, and set up drawing depending on their type */ { /* first pass: just the standard GL-drawing for backdrop + text */ diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c index 916b0032f17..b0704e76138 100644 --- a/source/blender/editors/space_action/action_edit.c +++ b/source/blender/editors/space_action/action_edit.c @@ -70,7 +70,7 @@ /* ******************** New Action Operator *********************** */ -static int act_new_exec(bContext *C, wmOperator *op) +static int act_new_exec(bContext *C, wmOperator *UNUSED(op)) { bAction *action; PointerRNA ptr, idptr; @@ -173,7 +173,7 @@ static void get_keyframe_extents (bAnimContext *ac, float *min, float *max) /* ****************** Automatic Preview-Range Operator ****************** */ -static int actkeys_previewrange_exec(bContext *C, wmOperator *op) +static int actkeys_previewrange_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; Scene *scene; @@ -217,7 +217,7 @@ void ACTION_OT_previewrange_set (wmOperatorType *ot) /* ****************** View-All Operator ****************** */ -static int actkeys_viewall_exec(bContext *C, wmOperator *op) +static int actkeys_viewall_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; View2D *v2d; @@ -521,7 +521,7 @@ static void duplicate_action_keys (bAnimContext *ac) /* ------------------- */ -static int actkeys_duplicate_exec(bContext *C, wmOperator *op) +static int actkeys_duplicate_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -541,7 +541,7 @@ static int actkeys_duplicate_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; // xxx - start transform } -static int actkeys_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int actkeys_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { actkeys_duplicate_exec(C, op); @@ -608,7 +608,7 @@ static void delete_action_keys (bAnimContext *ac) /* ------------------- */ -static int actkeys_delete_exec(bContext *C, wmOperator *op) +static int actkeys_delete_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -734,7 +734,7 @@ static void sample_action_keys (bAnimContext *ac) /* ------------------- */ -static int actkeys_sample_exec(bContext *C, wmOperator *op) +static int actkeys_sample_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -791,7 +791,7 @@ static void setexpo_action_keys(bAnimContext *ac, short mode) int filter; /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_SEL | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* loop through setting mode per F-Curve */ @@ -1096,7 +1096,7 @@ void ACTION_OT_keyframe_type (wmOperatorType *ot) /* ***************** Jump to Selected Frames Operator *********************** */ /* snap current-frame indicator to 'average time' of selected keyframe */ -static int actkeys_framejump_exec(bContext *C, wmOperator *op) +static int actkeys_framejump_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; ListBase anim_data= {NULL, NULL}; diff --git a/source/blender/editors/space_action/action_intern.h b/source/blender/editors/space_action/action_intern.h index b02e95ac138..cc363b76479 100644 --- a/source/blender/editors/space_action/action_intern.h +++ b/source/blender/editors/space_action/action_intern.h @@ -41,7 +41,7 @@ struct bAnimListElem; /* ***************************************** */ /* action_draw.c */ -void draw_channel_names(struct bContext *C, struct bAnimContext *ac, struct SpaceAction *saction, struct ARegion *ar); +void draw_channel_names(struct bContext *C, struct bAnimContext *ac, struct ARegion *ar); void draw_channel_strips(struct bAnimContext *ac, struct SpaceAction *saction, struct ARegion *ar); struct ActKeysInc *init_aki_data(struct bAnimContext *ac, struct bAnimListElem *ale); diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c index b2c47194384..11b6123dbbb 100644 --- a/source/blender/editors/space_action/action_select.c +++ b/source/blender/editors/space_action/action_select.c @@ -551,7 +551,7 @@ void ACTION_OT_select_column (wmOperatorType *ot) /* ******************** Select Linked Operator *********************** */ -static int actkeys_select_linked_exec (bContext *C, wmOperator *op) +static int actkeys_select_linked_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -650,7 +650,7 @@ static void select_moreless_action_keys (bAnimContext *ac, short mode) /* ----------------- */ -static int actkeys_select_more_exec (bContext *C, wmOperator *op) +static int actkeys_select_more_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -684,7 +684,7 @@ void ACTION_OT_select_more (wmOperatorType *ot) /* ----------------- */ -static int actkeys_select_less_exec (bContext *C, wmOperator *op) +static int actkeys_select_less_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -990,7 +990,7 @@ static void mouse_action_keys (bAnimContext *ac, int mval[2], short select_mode, } else if (ale->type == ANIMTYPE_GPLAYER) { struct bGPDlayer *gpl= (struct bGPDlayer *)ale->data; - gpl_to_keylist(ads, gpl, &anim_keys, NULL); + gpl_to_keylist(ads, gpl, &anim_keys); } /* loop through keyframes, finding one that was within the range clicked on */ diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c index 7b96618d923..bb3b40fbf9b 100644 --- a/source/blender/editors/space_action/space_action.c +++ b/source/blender/editors/space_action/space_action.c @@ -101,16 +101,17 @@ static SpaceLink *action_new(const bContext *C) ar->v2d.cur = ar->v2d.tot; ar->v2d.min[0]= 0.0f; - ar->v2d.min[1]= 0.0f; + ar->v2d.min[1]= 0.0f; ar->v2d.max[0]= MAXFRAMEF; - ar->v2d.max[1]= FLT_MAX; + ar->v2d.max[1]= FLT_MAX; ar->v2d.minzoom= 0.01f; ar->v2d.maxzoom= 50; ar->v2d.scroll = (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL); ar->v2d.scroll |= (V2D_SCROLL_RIGHT); ar->v2d.keepzoom= V2D_LOCKZOOM_Y; + ar->v2d.keepofs= V2D_KEEPOFS_Y; ar->v2d.align= V2D_ALIGN_NO_POS_Y; ar->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL; @@ -118,7 +119,7 @@ static SpaceLink *action_new(const bContext *C) } /* not spacelink itself */ -static void action_free(SpaceLink *sl) +static void action_free(SpaceLink *UNUSED(sl)) { // SpaceAction *saction= (SpaceAction*) sl; @@ -126,7 +127,7 @@ static void action_free(SpaceLink *sl) /* spacetype; init callback */ -static void action_init(struct wmWindowManager *wm, ScrArea *sa) +static void action_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa) { SpaceAction *saction = sa->spacedata.first; saction->flag |= SACTION_TEMP_NEEDCHANSYNC; @@ -169,12 +170,12 @@ static void action_main_area_draw(const bContext *C, ARegion *ar) UI_ThemeClearColor(TH_BACK); glClear(GL_COLOR_BUFFER_BIT); - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); /* time grid */ unit= (saction->flag & SACTION_DRAWTIME)? V2D_UNIT_SECONDS : V2D_UNIT_FRAMES; - grid= UI_view2d_grid_calc(C, v2d, unit, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY, ar->winx, ar->winy); - UI_view2d_grid_draw(C, v2d, grid, V2D_GRIDLINES_ALL); + grid= UI_view2d_grid_calc(CTX_data_scene(C), v2d, unit, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY, ar->winx, ar->winy); + UI_view2d_grid_draw(v2d, grid, V2D_GRIDLINES_ALL); UI_view2d_grid_free(grid); /* data */ @@ -188,11 +189,11 @@ static void action_main_area_draw(const bContext *C, ARegion *ar) ANIM_draw_cfra(C, v2d, flag); /* markers */ - UI_view2d_view_orthoSpecial(C, v2d, 1); + UI_view2d_view_orthoSpecial(ar, v2d, 1); draw_markers_time(C, 0); /* preview range */ - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); ANIM_draw_previewrange(C, v2d); /* reset view matrix */ @@ -219,7 +220,6 @@ static void action_channel_area_init(wmWindowManager *wm, ARegion *ar) static void action_channel_area_draw(const bContext *C, ARegion *ar) { /* draw entirely, view changes should be handled here */ - SpaceAction *saction= CTX_wm_space_action(C); bAnimContext ac; View2D *v2d= &ar->v2d; View2DScrollers *scrollers; @@ -228,11 +228,11 @@ static void action_channel_area_draw(const bContext *C, ARegion *ar) UI_ThemeClearColor(TH_BACK); glClear(GL_COLOR_BUFFER_BIT); - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); /* data */ if (ANIM_animdata_get_context(C, &ac)) { - draw_channel_names((bContext *)C, &ac, saction, ar); + draw_channel_names((bContext *)C, &ac, ar); } /* reset view matrix */ @@ -246,7 +246,7 @@ static void action_channel_area_draw(const bContext *C, ARegion *ar) /* add handlers, stuff you only do once or on area/region changes */ -static void action_header_area_init(wmWindowManager *wm, ARegion *ar) +static void action_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar) { ED_region_header_init(ar); } @@ -417,7 +417,7 @@ static void action_header_area_listener(ARegion *ar, wmNotifier *wmn) static void action_refresh(const bContext *C, ScrArea *sa) { - SpaceAction *saction= CTX_wm_space_action(C); + SpaceAction *saction= (SpaceAction *)sa->spacedata.first; /* update the state of the animchannels in response to changes from the data they represent * NOTE: the temp flag is used to indicate when this needs to be done, and will be cleared once handled diff --git a/source/blender/editors/space_api/spacetypes.c b/source/blender/editors/space_api/spacetypes.c index 2140c59da67..0d0d3713723 100644 --- a/source/blender/editors/space_api/spacetypes.c +++ b/source/blender/editors/space_api/spacetypes.c @@ -30,6 +30,7 @@ #include "DNA_object_types.h" #include "DNA_windowmanager_types.h" +#include "BKE_utildefines.h" #include "BKE_context.h" #include "BKE_screen.h" @@ -224,19 +225,19 @@ void ED_region_draw_cb_draw(const bContext *C, ARegion *ar, int type) /* ********************* space template *********************** */ /* allocate and init some vars */ -static SpaceLink *xxx_new(const bContext *C) +static SpaceLink *xxx_new(const bContext *UNUSED(C)) { return NULL; } /* not spacelink itself */ -static void xxx_free(SpaceLink *sl) +static void xxx_free(SpaceLink *UNUSED(sl)) { } /* spacetype; init callback for usage, should be redoable */ -static void xxx_init(wmWindowManager *wm, ScrArea *sa) +static void xxx_init(wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa)) { /* link area to SpaceXXX struct */ @@ -246,7 +247,7 @@ static void xxx_init(wmWindowManager *wm, ScrArea *sa) /* add types to regions */ } -static SpaceLink *xxx_duplicate(SpaceLink *sl) +static SpaceLink *xxx_duplicate(SpaceLink *UNUSED(sl)) { return NULL; @@ -257,7 +258,7 @@ static void xxx_operatortypes(void) /* register operator types for this space */ } -static void xxx_keymap(wmKeyConfig *keyconf) +static void xxx_keymap(wmKeyConfig *UNUSED(keyconf)) { /* add default items to keymap */ } diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index 343237dee5e..2d16bb6bc81 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -323,7 +323,7 @@ static int buttons_context_path_particle(ButsContextPath *path) return 0; } -static int buttons_context_path_brush(const bContext *C, ButsContextPath *path) +static int buttons_context_path_brush(ButsContextPath *path) { Scene *scene; Brush *br= NULL; @@ -352,7 +352,7 @@ static int buttons_context_path_brush(const bContext *C, ButsContextPath *path) return 0; } -static int buttons_context_path_texture(const bContext *C, ButsContextPath *path) +static int buttons_context_path_texture(ButsContextPath *path) { Material *ma; Lamp *la; @@ -367,7 +367,7 @@ static int buttons_context_path_texture(const bContext *C, ButsContextPath *path return 1; } /* try brush */ - if((path->flag & SB_BRUSH_TEX) && buttons_context_path_brush(C, path)) { + if((path->flag & SB_BRUSH_TEX) && buttons_context_path_brush(path)) { br= path->ptr[path->len-1].data; if(br) { @@ -416,7 +416,7 @@ static int buttons_context_path_texture(const bContext *C, ButsContextPath *path } /* try brushes again in case of no material, lamp, etc */ path->len = orig_len; - if(buttons_context_path_brush(C, path)) { + if(buttons_context_path_brush(path)) { br= path->ptr[path->len-1].data; if(br) { @@ -485,7 +485,7 @@ static int buttons_context_path(const bContext *C, ButsContextPath *path, int ma found= buttons_context_path_material(path); break; case BCONTEXT_TEXTURE: - found= buttons_context_path_texture(C, path); + found= buttons_context_path_texture(path); break; case BCONTEXT_BONE: found= buttons_context_path_bone(path); @@ -515,7 +515,7 @@ static int buttons_shading_context(const bContext *C, int mainb) return 0; } -static int buttons_shading_new_context(const bContext *C, int flag, int mainb) +static int buttons_shading_new_context(const bContext *C, int flag) { Object *ob= CTX_data_active_object(C); @@ -568,7 +568,7 @@ void buttons_context_compute(const bContext *C, SpaceButs *sbuts) if((flag & (1 << sbuts->mainb)) == 0) { if(sbuts->flag & SB_SHADING_CONTEXT) { /* try to keep showing shading related buttons */ - sbuts->mainb= buttons_shading_new_context(C, flag, sbuts->mainb); + sbuts->mainb= buttons_shading_new_context(C, flag); } else if(flag & BCONTEXT_OBJECT) { sbuts->mainb= BCONTEXT_OBJECT; @@ -821,7 +821,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r /************************* Drawing the Path ************************/ -static void pin_cb(bContext *C, void *arg1, void *arg2) +static void pin_cb(bContext *C, void *UNUSED(arg1), void *UNUSED(arg2)) { SpaceButs *sbuts= CTX_wm_space_buts(C); diff --git a/source/blender/editors/space_buttons/buttons_header.c b/source/blender/editors/space_buttons/buttons_header.c index ab756b638fa..9071d9f27d9 100644 --- a/source/blender/editors/space_buttons/buttons_header.c +++ b/source/blender/editors/space_buttons/buttons_header.c @@ -33,6 +33,7 @@ #include "BLI_blenlib.h" +#include "BKE_utildefines.h" #include "BKE_context.h" #include "ED_screen.h" @@ -50,7 +51,7 @@ #define B_CONTEXT_SWITCH 101 #define B_BUTSPREVIEW 102 -static void do_buttons_buttons(bContext *C, void *arg, int event) +static void do_buttons_buttons(bContext *C, void *UNUSED(arg), int event) { SpaceButs *sbuts= CTX_wm_space_buts(C); diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c index c1803dde805..e72446366fe 100644 --- a/source/blender/editors/space_buttons/buttons_ops.c +++ b/source/blender/editors/space_buttons/buttons_ops.c @@ -39,6 +39,7 @@ #include "BKE_context.h" #include "BKE_global.h" +#include "BKE_main.h" #include "WM_api.h" #include "WM_types.h" @@ -53,7 +54,7 @@ /********************** toolbox operator *********************/ -static int toolbox_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int toolbox_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event)) { bScreen *sc= CTX_wm_screen(C); SpaceButs *sbuts= CTX_wm_space_buts(C); @@ -104,7 +105,7 @@ static int file_browse_exec(bContext *C, wmOperator *op) /* add slash for directories, important for some properties */ if(RNA_property_subtype(fbo->prop) == PROP_DIRPATH) { id = fbo->ptr.id.data; - base = (id && id->lib)? id->lib->filepath: G.sce; + base = (id && id->lib)? id->lib->filepath: G.main->name; BLI_strncpy(path, str, FILE_MAX); BLI_path_abs(path, base); @@ -123,7 +124,7 @@ static int file_browse_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int file_browse_cancel(bContext *C, wmOperator *op) +static int file_browse_cancel(bContext *UNUSED(C), wmOperator *op) { MEM_freeN(op->customdata); op->customdata= NULL; diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index fcd66c43321..44138119f7a 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -55,7 +55,7 @@ /* ******************** default callbacks for buttons space ***************** */ -static SpaceLink *buttons_new(const bContext *C) +static SpaceLink *buttons_new(const bContext *UNUSED(C)) { ARegion *ar; SpaceButs *sbuts; @@ -103,7 +103,7 @@ static void buttons_free(SpaceLink *sl) } /* spacetype; init callback */ -static void buttons_init(struct wmWindowManager *wm, ScrArea *sa) +static void buttons_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa) { SpaceButs *sbuts= sa->spacedata.first; @@ -191,7 +191,7 @@ void buttons_keymap(struct wmKeyConfig *keyconf) } /* add handlers, stuff you only do once or on area/region changes */ -static void buttons_header_area_init(wmWindowManager *wm, ARegion *ar) +static void buttons_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar) { UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_HEADER, ar->winx, ar->winy); } @@ -203,7 +203,7 @@ static void buttons_header_area_draw(const bContext *C, ARegion *ar) glClear(GL_COLOR_BUFFER_BIT); /* set view2d view matrix for scrolling (without scrollers) */ - UI_view2d_view_ortho(C, &ar->v2d); + UI_view2d_view_ortho(&ar->v2d); buttons_header_buttons(C, ar); diff --git a/source/blender/editors/space_console/console_draw.c b/source/blender/editors/space_console/console_draw.c index d5ffb34b3a2..edbb539e836 100644 --- a/source/blender/editors/space_console/console_draw.c +++ b/source/blender/editors/space_console/console_draw.c @@ -133,7 +133,7 @@ typedef struct ConsoleDrawContext { int draw; } ConsoleDrawContext; -static void console_draw_sel(int sel[2], int xy[2], int str_len_draw, int cwidth, int console_width, int lheight) +static void console_draw_sel(int sel[2], int xy[2], int str_len_draw, int cwidth, int lheight) { if(sel[0] <= str_len_draw && sel[1] >= 0) { int sta = MAX2(sel[0], 0); @@ -222,7 +222,7 @@ static int console_draw_string(ConsoleDrawContext *cdc, char *str, int str_len, if(cdc->sel[0] != cdc->sel[1]) { STEP_SEL(-initial_offset); // glColor4ub(255, 0, 0, 96); // debug - console_draw_sel(cdc->sel, cdc->xy, str_len % cdc->console_width, cdc->cwidth, cdc->console_width, cdc->lheight); + console_draw_sel(cdc->sel, cdc->xy, str_len % cdc->console_width, cdc->cwidth, cdc->lheight); STEP_SEL(cdc->console_width); glColor3ubv(fg); } @@ -240,7 +240,7 @@ static int console_draw_string(ConsoleDrawContext *cdc, char *str, int str_len, if(cdc->sel[0] != cdc->sel[1]) { // glColor4ub(0, 255, 0, 96); // debug - console_draw_sel(cdc->sel, cdc->xy, cdc->console_width, cdc->cwidth, cdc->console_width, cdc->lheight); + console_draw_sel(cdc->sel, cdc->xy, cdc->console_width, cdc->cwidth, cdc->lheight); STEP_SEL(cdc->console_width); glColor3ubv(fg); } @@ -272,7 +272,7 @@ static int console_draw_string(ConsoleDrawContext *cdc, char *str, int str_len, if(cdc->sel[0] != cdc->sel[1]) { int isel[2]= {str_len - cdc->sel[1], str_len - cdc->sel[0]}; // glColor4ub(255, 255, 0, 96); // debug - console_draw_sel(isel, cdc->xy, str_len, cdc->cwidth, cdc->console_width, cdc->lheight); + console_draw_sel(isel, cdc->xy, str_len, cdc->cwidth, cdc->lheight); STEP_SEL(-(str_len + 1)); } diff --git a/source/blender/editors/space_console/console_intern.h b/source/blender/editors/space_console/console_intern.h index 0e2c35bcf83..1a48dd408bd 100644 --- a/source/blender/editors/space_console/console_intern.h +++ b/source/blender/editors/space_console/console_intern.h @@ -47,8 +47,8 @@ void console_scrollback_prompt_end(struct SpaceConsole *sc, ConsoleLine *cl_dumm /* console_ops.c */ void console_history_free(SpaceConsole *sc, ConsoleLine *cl); void console_scrollback_free(SpaceConsole *sc, ConsoleLine *cl); -ConsoleLine *console_history_add_str(const struct bContext *C, char *str, int own); -ConsoleLine *console_scrollback_add_str(const struct bContext *C, char *str, int own); +ConsoleLine *console_history_add_str(struct SpaceConsole *sc, char *str, int own); +ConsoleLine *console_scrollback_add_str(struct SpaceConsole *sc, char *str, int own); ConsoleLine *console_history_verify(const struct bContext *C); diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c index 4e50b589bc6..2b419b0a833 100644 --- a/source/blender/editors/space_console/console_ops.c +++ b/source/blender/editors/space_console/console_ops.c @@ -194,7 +194,7 @@ static ConsoleLine *console_scrollback_add(const bContext *C, ConsoleLine *from) } #endif -static ConsoleLine *console_lb_add_str__internal(ListBase *lb, const bContext *C, char *str, int own) +static ConsoleLine *console_lb_add_str__internal(ListBase *lb, char *str, int own) { ConsoleLine *ci= MEM_callocN(sizeof(ConsoleLine), "ConsoleLine Add"); if(own) ci->line= str; @@ -205,14 +205,13 @@ static ConsoleLine *console_lb_add_str__internal(ListBase *lb, const bContext *C BLI_addtail(lb, ci); return ci; } -ConsoleLine *console_history_add_str(const bContext *C, char *str, int own) +ConsoleLine *console_history_add_str(SpaceConsole *sc, char *str, int own) { - return console_lb_add_str__internal(&CTX_wm_space_console(C)->history, C, str, own); + return console_lb_add_str__internal(&sc->history, str, own); } -ConsoleLine *console_scrollback_add_str(const bContext *C, char *str, int own) +ConsoleLine *console_scrollback_add_str(SpaceConsole *sc, char *str, int own) { - SpaceConsole *sc= CTX_wm_space_console(C); - ConsoleLine *ci= console_lb_add_str__internal(&sc->scrollback, C, str, own); + ConsoleLine *ci= console_lb_add_str__internal(&sc->scrollback, str, own); console_select_offset(sc, ci->len + 1); return ci; } @@ -406,9 +405,8 @@ static int insert_invoke(bContext *C, wmOperator *op, wmEvent *event) // if(!RNA_property_is_set(op->ptr, "text")) { /* always set from keymap XXX */ if(!RNA_string_length(op->ptr, "text")) { char str[2] = {event->ascii, '\0'}; - /* if alt/ctrl/super are pressed pass through */ - if(event->alt || event->ctrl || event->oskey) + if(event->ctrl || event->oskey) return OPERATOR_PASS_THROUGH; RNA_string_set(op->ptr, "text", str); @@ -628,7 +626,7 @@ static int history_append_exec(bContext *C, wmOperator *op) } } - ci= console_history_add_str(C, str, 1); /* own the string */ + ci= console_history_add_str(sc, str, 1); /* own the string */ console_select_offset(sc, ci->len - prev_len); console_line_cursor_set(ci, cursor); @@ -664,7 +662,7 @@ static int scrollback_append_exec(bContext *C, wmOperator *op) char *str= RNA_string_get_alloc(op->ptr, "text", NULL, 0); /* own this text in the new line, dont free */ int type= RNA_enum_get(op->ptr, "type"); - ci= console_scrollback_add_str(C, str, 1); /* own the string */ + ci= console_scrollback_add_str(sc, str, 1); /* own the string */ ci->type= type; console_scrollback_limit(sc); @@ -699,7 +697,7 @@ void CONSOLE_OT_scrollback_append(wmOperatorType *ot) } -static int copy_exec(bContext *C, wmOperator *op) +static int copy_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceConsole *sc= CTX_wm_space_console(C); int buf_len; @@ -780,7 +778,7 @@ void CONSOLE_OT_copy(wmOperatorType *ot) /* properties */ } -static int paste_exec(bContext *C, wmOperator *op) +static int paste_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceConsole *sc= CTX_wm_space_console(C); ConsoleLine *ci= console_history_verify(C); @@ -835,7 +833,8 @@ typedef struct SetConsoleCursor { int sel_init; } SetConsoleCursor; -static void set_cursor_to_pos(SpaceConsole *sc, ARegion *ar, SetConsoleCursor *scu, int mval[2], int sel) +// TODO, cursor placement without selection +static void set_cursor_to_pos(SpaceConsole *sc, ARegion *ar, SetConsoleCursor *scu, int mval[2], int UNUSED(sel)) { int pos; pos= console_char_pick(sc, ar, NULL, mval); @@ -870,7 +869,7 @@ static void console_modal_select_apply(bContext *C, wmOperator *op, wmEvent *eve ED_area_tag_redraw(CTX_wm_area(C)); } -static void set_cursor_exit(bContext *C, wmOperator *op) +static void set_cursor_exit(bContext *UNUSED(C), wmOperator *op) { // SpaceConsole *sc= CTX_wm_space_console(C); SetConsoleCursor *scu= op->customdata; diff --git a/source/blender/editors/space_console/console_report.c b/source/blender/editors/space_console/console_report.c index 51bffa5b981..6483177a045 100644 --- a/source/blender/editors/space_console/console_report.c +++ b/source/blender/editors/space_console/console_report.c @@ -72,7 +72,7 @@ static int console_report_poll(bContext *C) return 1; } -static int report_replay_exec(bContext *C, wmOperator *op) +static int report_replay_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceConsole *sc= CTX_wm_space_console(C); ReportList *reports= CTX_wm_reports(C); @@ -83,7 +83,7 @@ static int report_replay_exec(bContext *C, wmOperator *op) for(report=reports->list.last; report; report=report->prev) { if((report->type & report_mask) && (report->type & RPT_OPERATOR_ALL) && (report->flag & SELECT)) { - console_history_add_str(C, report->message, 0); + console_history_add_str(sc, report->message, 0); WM_operator_name_call(C, "CONSOLE_OT_execute", WM_OP_EXEC_DEFAULT, NULL); ED_area_tag_redraw(CTX_wm_area(C)); @@ -165,7 +165,7 @@ void CONSOLE_OT_select_pick(wmOperatorType *ot) -static int report_select_all_toggle_exec(bContext *C, wmOperator *op) +static int report_select_all_toggle_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceConsole *sc= CTX_wm_space_console(C); ReportList *reports= CTX_wm_reports(C); @@ -314,7 +314,7 @@ void CONSOLE_OT_select_border(wmOperatorType *ot) -static int report_delete_exec(bContext *C, wmOperator *op) +static int report_delete_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceConsole *sc= CTX_wm_space_console(C); ReportList *reports= CTX_wm_reports(C); @@ -359,7 +359,7 @@ void CONSOLE_OT_report_delete(wmOperatorType *ot) } -static int report_copy_exec(bContext *C, wmOperator *op) +static int report_copy_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceConsole *sc= CTX_wm_space_console(C); ReportList *reports= CTX_wm_reports(C); diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c index c30897bbb87..70263788b13 100644 --- a/source/blender/editors/space_console/space_console.c +++ b/source/blender/editors/space_console/space_console.c @@ -67,7 +67,7 @@ static void console_update_rect(const bContext *C, ARegion *ar) /* ******************** default callbacks for console space ***************** */ -static SpaceLink *console_new(const bContext *C) +static SpaceLink *console_new(const bContext *UNUSED(C)) { ARegion *ar; SpaceConsole *sconsole; @@ -121,7 +121,7 @@ static void console_free(SpaceLink *sl) /* spacetype; init callback */ -static void console_init(struct wmWindowManager *wm, ScrArea *sa) +static void console_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa)) { } @@ -162,7 +162,7 @@ static void console_main_area_init(wmWindowManager *wm, ARegion *ar) /* ************* dropboxes ************* */ -static int id_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) +static int id_drop_poll(bContext *C, wmDrag *drag, wmEvent *UNUSED(event)) { SpaceConsole *sc= CTX_wm_space_console(C); if(sc->type==CONSOLE_TYPE_PYTHON) @@ -182,7 +182,7 @@ static void id_drop_copy(wmDrag *drag, wmDropBox *drop) RNA_string_set(drop->ptr, "text", text); } -static int path_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) +static int path_drop_poll(bContext *C, wmDrag *drag, wmEvent *UNUSED(event)) { SpaceConsole *sc= CTX_wm_space_console(C); if(sc->type==CONSOLE_TYPE_PYTHON) @@ -227,7 +227,7 @@ static void console_main_area_draw(const bContext *C, ARegion *ar) console_update_rect(C, ar); /* worlks best with no view2d matrix set */ - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); /* data... */ @@ -361,7 +361,7 @@ void console_keymap(struct wmKeyConfig *keyconf) /****************** header region ******************/ /* add handlers, stuff you only do once or on area/region changes */ -static void console_header_area_init(wmWindowManager *wm, ARegion *ar) +static void console_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar) { ED_region_header_init(ar); } diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index 0f627bda3dc..65415d382ec 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -40,6 +40,7 @@ #include "BKE_context.h" #include "BKE_global.h" +#include "BKE_main.h" #include "BLF_api.h" @@ -79,7 +80,7 @@ enum { } eFile_ButEvents; -static void do_file_buttons(bContext *C, void *arg, int event) +static void do_file_buttons(bContext *C, void *UNUSED(arg), int event) { switch(event) { case B_FS_FILENAME: @@ -433,7 +434,7 @@ static void file_draw_preview(uiBlock *block, struct direntry *file, int sx, int } } -static void renamebutton_cb(bContext *C, void *arg1, char *oldname) +static void renamebutton_cb(bContext *C, void *UNUSED(arg1), char *oldname) { char newname[FILE_MAX+12]; char orgname[FILE_MAX+12]; @@ -445,9 +446,9 @@ static void renamebutton_cb(bContext *C, void *arg1, char *oldname) struct direntry *file = (struct direntry *)arg1; #endif - BLI_make_file_string(G.sce, orgname, sfile->params->dir, oldname); + BLI_make_file_string(G.main->name, orgname, sfile->params->dir, oldname); BLI_strncpy(filename, sfile->params->renameedit, sizeof(filename)); - BLI_make_file_string(G.sce, newname, sfile->params->dir, filename); + BLI_make_file_string(G.main->name, newname, sfile->params->dir, filename); if( strcmp(orgname, newname) != 0 ) { if (!BLI_exists(newname)) { diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index e9764a2d36a..1af8e9d14be 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -30,6 +30,7 @@ #include "BKE_screen.h" #include "BKE_global.h" #include "BKE_report.h" +#include "BKE_main.h" #include "BLI_blenlib.h" #include "BLI_storage_types.h" @@ -190,7 +191,7 @@ static FileSelect file_select(bContext* C, const rcti* rect, short selecting, sh /* avoids /../../ */ BLI_parent_dir(params->dir); } else { - BLI_cleanup_dir(G.sce, params->dir); + BLI_cleanup_dir(G.main->name, params->dir); strcat(params->dir, file->relname); BLI_add_slash(params->dir); } @@ -304,7 +305,7 @@ void FILE_OT_select(wmOperatorType *ot) RNA_def_boolean(ot->srna, "fill", 0, "Fill", "Select everything beginning with the last selection."); } -static int file_select_all_exec(bContext *C, wmOperator *op) +static int file_select_all_exec(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); SpaceFile *sfile= CTX_wm_space_file(C); @@ -361,7 +362,7 @@ static int bookmark_select_exec(bContext *C, wmOperator *op) RNA_string_get(op->ptr, "dir", entry); BLI_strncpy(params->dir, entry, sizeof(params->dir)); - BLI_cleanup_dir(G.sce, params->dir); + BLI_cleanup_dir(G.main->name, params->dir); file_change_dir(C, 1); WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL); @@ -384,7 +385,7 @@ void FILE_OT_select_bookmark(wmOperatorType *ot) RNA_def_string(ot->srna, "dir", "", 256, "Dir", ""); } -static int bookmark_add_exec(bContext *C, wmOperator *op) +static int bookmark_add_exec(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); SpaceFile *sfile= CTX_wm_space_file(C); @@ -479,7 +480,7 @@ int file_hilight_set(SpaceFile *sfile, ARegion *ar, int mx, int my) return (params->active_file != origfile); } -static int file_highlight_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int file_highlight_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event) { ARegion *ar= CTX_wm_region(C); SpaceFile *sfile= CTX_wm_space_file(C); @@ -504,7 +505,7 @@ void FILE_OT_highlight(struct wmOperatorType *ot) ot->poll= ED_operator_file_active; } -int file_cancel_exec(bContext *C, wmOperator *unused) +int file_cancel_exec(bContext *C, wmOperator *UNUSED(unused)) { SpaceFile *sfile= CTX_wm_space_file(C); wmOperator *op = sfile->op; @@ -544,7 +545,7 @@ void file_sfile_to_operator(wmOperator *op, SpaceFile *sfile, char *filepath) BLI_join_dirfile(filepath, sfile->params->dir, sfile->params->file); if(RNA_struct_find_property(op->ptr, "relative_path")) { if(RNA_boolean_get(op->ptr, "relative_path")) { - BLI_path_rel(filepath, G.sce); + BLI_path_rel(filepath, G.main->name); } } @@ -613,7 +614,7 @@ void file_operator_to_sfile(SpaceFile *sfile, wmOperator *op) /* XXX, files and dirs updates missing, not really so important though */ } -void file_draw_check_cb(bContext *C, void *dummy1, void *dummy2) +void file_draw_check_cb(bContext *C, void *UNUSED(arg1), void *UNUSED(arg2)) { SpaceFile *sfile= CTX_wm_space_file(C); wmOperator *op= sfile->op; @@ -680,7 +681,7 @@ int file_exec(bContext *C, wmOperator *exec_op) file_sfile_to_operator(op, sfile, filepath); fsmenu_insert_entry(fsmenu_get(), FS_CATEGORY_RECENT, sfile->params->dir,0, 1); - BLI_make_file_string(G.sce, filepath, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_BOOKMARK_FILE); + BLI_make_file_string(G.main->name, filepath, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_BOOKMARK_FILE); fsmenu_write_file(fsmenu_get(), filepath); WM_event_fileselect_event(C, op, EVT_FILESELECT_EXEC); @@ -704,14 +705,14 @@ void FILE_OT_execute(struct wmOperatorType *ot) } -int file_parent_exec(bContext *C, wmOperator *unused) +int file_parent_exec(bContext *C, wmOperator *UNUSED(unused)) { SpaceFile *sfile= CTX_wm_space_file(C); if(sfile->params) { if (BLI_has_parent(sfile->params->dir)) { BLI_parent_dir(sfile->params->dir); - BLI_cleanup_dir(G.sce, sfile->params->dir); + BLI_cleanup_dir(G.main->name, sfile->params->dir); file_change_dir(C, 0); WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL); } @@ -735,7 +736,7 @@ void FILE_OT_parent(struct wmOperatorType *ot) } -int file_refresh_exec(bContext *C, wmOperator *unused) +int file_refresh_exec(bContext *C, wmOperator *UNUSED(unused)) { SpaceFile *sfile= CTX_wm_space_file(C); @@ -759,7 +760,7 @@ void FILE_OT_previous(struct wmOperatorType *ot) ot->poll= ED_operator_file_active; /* <- important, handler is on window level */ } -int file_previous_exec(bContext *C, wmOperator *unused) +int file_previous_exec(bContext *C, wmOperator *UNUSED(unused)) { SpaceFile *sfile= CTX_wm_space_file(C); @@ -790,7 +791,7 @@ void FILE_OT_next(struct wmOperatorType *ot) ot->poll= ED_operator_file_active; /* <- important, handler is on window level */ } -int file_next_exec(bContext *C, wmOperator *unused) +int file_next_exec(bContext *C, wmOperator *UNUSED(unused)) { SpaceFile *sfile= CTX_wm_space_file(C); if(sfile->params) { @@ -812,7 +813,7 @@ int file_next_exec(bContext *C, wmOperator *unused) /* only meant for timer usage */ -static int file_smoothscroll_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int file_smoothscroll_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event) { ScrArea *sa = CTX_wm_area(C); SpaceFile *sfile= CTX_wm_space_file(C); @@ -995,7 +996,7 @@ void FILE_OT_directory_new(struct wmOperatorType *ot) ot->poll= ED_operator_file_active; /* <- important, handler is on window level */ } -int file_directory_exec(bContext *C, wmOperator *unused) +int file_directory_exec(bContext *C, wmOperator *UNUSED(unused)) { SpaceFile *sfile= CTX_wm_space_file(C); @@ -1010,7 +1011,7 @@ int file_directory_exec(bContext *C, wmOperator *unused) if (sfile->params->dir[0] == '\0') get_default_root(sfile->params->dir); #endif - BLI_cleanup_dir(G.sce, sfile->params->dir); + BLI_cleanup_dir(G.main->name, sfile->params->dir); BLI_add_slash(sfile->params->dir); file_change_dir(C, 1); @@ -1021,7 +1022,7 @@ int file_directory_exec(bContext *C, wmOperator *unused) return OPERATOR_FINISHED; } -int file_filename_exec(bContext *C, wmOperator *unused) +int file_filename_exec(bContext *C, wmOperator *UNUSED(unused)) { SpaceFile *sfile= CTX_wm_space_file(C); @@ -1049,7 +1050,7 @@ void FILE_OT_refresh(struct wmOperatorType *ot) ot->poll= ED_operator_file_active; /* <- important, handler is on window level */ } -int file_hidedot_exec(bContext *C, wmOperator *unused) +int file_hidedot_exec(bContext *C, wmOperator *UNUSED(unused)) { SpaceFile *sfile= CTX_wm_space_file(C); @@ -1102,7 +1103,7 @@ struct ARegion *file_buttons_region(struct ScrArea *sa) return arnew; } -int file_bookmark_toggle_exec(bContext *C, wmOperator *unused) +int file_bookmark_toggle_exec(bContext *C, wmOperator *UNUSED(unused)) { ScrArea *sa= CTX_wm_area(C); ARegion *ar= file_buttons_region(sa); @@ -1158,7 +1159,7 @@ void FILE_OT_filenum(struct wmOperatorType *ot) RNA_def_int(ot->srna, "increment", 1, 0, 100, "Increment", "", 0,100); } -int file_rename_exec(bContext *C, wmOperator *op) +int file_rename_exec(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C); @@ -1232,7 +1233,7 @@ int file_delete_poll(bContext *C) return poll; } -int file_delete_exec(bContext *C, wmOperator *op) +int file_delete_exec(bContext *C, wmOperator *UNUSED(op)) { char str[FILE_MAX]; SpaceFile *sfile= CTX_wm_space_file(C); @@ -1240,7 +1241,7 @@ int file_delete_exec(bContext *C, wmOperator *op) file = filelist_file(sfile->files, sfile->params->active_file); - BLI_make_file_string(G.sce, str, sfile->params->dir, file->relname); + BLI_make_file_string(G.main->name, str, sfile->params->dir, file->relname); BLI_delete(str, 0, 0); ED_fileselect_clear(C, sfile); WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL); diff --git a/source/blender/editors/space_file/file_panels.c b/source/blender/editors/space_file/file_panels.c index 33d740e18a6..9096b9eed27 100644 --- a/source/blender/editors/space_file/file_panels.c +++ b/source/blender/editors/space_file/file_panels.c @@ -49,7 +49,7 @@ #include <string.h> -static void file_panel_cb(bContext *C, void *arg_entry, void *arg_unused) +static void file_panel_cb(bContext *C, void *arg_entry, void *UNUSED(arg_v)) { PointerRNA ptr; char *entry= (char*)arg_entry; @@ -151,7 +151,7 @@ static void file_panel_recent(const bContext *C, Panel *pa) } -static int file_panel_operator_poll(const bContext *C, PanelType *pt) +static int file_panel_operator_poll(const bContext *C, PanelType *UNUSED(pt)) { SpaceFile *sfile= CTX_wm_space_file(C); return (sfile && sfile->op); diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index eba0df9f963..43d5d54805d 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -295,7 +295,7 @@ static int is_hidden_file(const char* filename, short hide_dot) return is_hidden; } -static int is_filtered_file(struct direntry* file, const char* dir, unsigned int filter, short hide_dot) +static int is_filtered_file(struct direntry* file, const char* UNUSED(dir), unsigned int filter, short hide_dot) { int is_filtered=0; if (filter) { @@ -324,7 +324,7 @@ static int is_filtered_lib(struct direntry* file, const char* dir, unsigned int return is_filtered; } -static int is_filtered_main(struct direntry* file, const char* dir, unsigned int filter, short hide_dot) +static int is_filtered_main(struct direntry* file, const char* UNUSED(dir), unsigned int UNUSED(filter), short hide_dot) { return !is_hidden_file(file->relname, hide_dot); } @@ -371,7 +371,7 @@ void filelist_init_icons() for (x=0; x<SPECIAL_IMG_COLS; x++) { int tile = SPECIAL_IMG_COLS*y + x; if (tile < SPECIAL_IMG_MAX) { - ibuf = IMB_allocImBuf(SPECIAL_IMG_SIZE, SPECIAL_IMG_SIZE, 32, IB_rect, 0); + ibuf = IMB_allocImBuf(SPECIAL_IMG_SIZE, SPECIAL_IMG_SIZE, 32, IB_rect); for (k=0; k<SPECIAL_IMG_SIZE; k++) { memcpy(&ibuf->rect[k*SPECIAL_IMG_SIZE], &bbuf->rect[(k+y*SPECIAL_IMG_SIZE)*SPECIAL_IMG_SIZE*SPECIAL_IMG_COLS+x*SPECIAL_IMG_SIZE], SPECIAL_IMG_SIZE*sizeof(int)); } @@ -730,7 +730,7 @@ static void filelist_read_dir(struct FileList* filelist) BLI_getwdN(wdir); - BLI_cleanup_dir(G.sce, filelist->dir); + BLI_cleanup_dir(G.main->name, filelist->dir); filelist->numfiles = BLI_getdir(filelist->dir, &(filelist->filelist)); if(!chdir(wdir)) {} /* fix warning about not checking return value */ @@ -747,7 +747,7 @@ static void filelist_read_main(struct FileList* filelist) static void filelist_read_library(struct FileList* filelist) { if (!filelist) return; - BLI_cleanup_dir(G.sce, filelist->dir); + BLI_cleanup_dir(G.main->name, filelist->dir); filelist_from_library(filelist); if(!filelist->libfiledata) { int num; @@ -912,7 +912,7 @@ void filelist_from_library(struct FileList* filelist) return; } - BLI_strncpy(filename, G.sce, sizeof(filename)); // G.sce = last file loaded, for UI + BLI_strncpy(filename, G.main->name, sizeof(filename)); /* there we go */ /* for the time being only read filedata when libfiledata==0 */ @@ -965,7 +965,7 @@ void filelist_from_library(struct FileList* filelist) /* first allocate imbuf for copying preview into it */ if (w > 0 && h > 0 && rect) { - ima = IMB_allocImBuf(w, h, 32, IB_rect, 0); + ima = IMB_allocImBuf(w, h, 32, IB_rect); memcpy(ima->rect, rect, w*h*sizeof(unsigned int)); filelist->filelist[i + 1].image = ima; filelist->filelist[i + 1].flags = IMAGEFILE; @@ -979,7 +979,7 @@ void filelist_from_library(struct FileList* filelist) filelist_sort(filelist, FILE_SORT_ALPHA); - BLI_strncpy(G.sce, filename, sizeof(filename)); // prevent G.sce to change + BLI_strncpy(G.main->name, filename, sizeof(filename)); // prevent G.main->name to change filelist->filter = 0; filelist_filter(filelist); @@ -1145,7 +1145,7 @@ static void thumbnail_joblist_free(ThumbnailJob *tj) BLI_freelistN(&tj->loadimages); } -static void thumbnails_startjob(void *tjv, short *stop, short *do_update, float *progress) +static void thumbnails_startjob(void *tjv, short *stop, short *do_update, float *UNUSED(progress)) { ThumbnailJob *tj= tjv; FileImage* limg = tj->loadimages.first; diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c index 7192870bcc8..8ad3ef08e85 100644 --- a/source/blender/editors/space_file/filesel.c +++ b/source/blender/editors/space_file/filesel.c @@ -64,6 +64,7 @@ #include "BKE_context.h" #include "BKE_global.h" +#include "BKE_main.h" #include "BLF_api.h" @@ -104,7 +105,7 @@ short ED_fileselect_set_params(SpaceFile *sfile) if (!sfile->params) { sfile->params= MEM_callocN(sizeof(FileSelectParams), "fileselparams"); /* set path to most recently opened .blend */ - BLI_split_dirfile(G.sce, sfile->params->dir, sfile->params->file); + BLI_split_dirfile(G.main->name, sfile->params->dir, sfile->params->file); sfile->params->filter_glob[0] = '\0'; } @@ -142,8 +143,8 @@ short ED_fileselect_set_params(SpaceFile *sfile) } if(params->dir[0]) { - BLI_cleanup_dir(G.sce, params->dir); - BLI_path_abs(params->dir, G.sce); + BLI_cleanup_dir(G.main->name, params->dir); + BLI_path_abs(params->dir, G.main->name); } params->filter = 0; @@ -463,7 +464,7 @@ int file_select_match(struct SpaceFile *sfile, const char *pattern) return match; } -void autocomplete_directory(struct bContext *C, char *str, void *arg_v) +void autocomplete_directory(struct bContext *C, char *str, void *UNUSED(arg_v)) { SpaceFile *sfile= CTX_wm_space_file(C); @@ -510,7 +511,7 @@ void autocomplete_directory(struct bContext *C, char *str, void *arg_v) } } -void autocomplete_file(struct bContext *C, char *str, void *arg_v) +void autocomplete_file(struct bContext *C, char *str, void *UNUSED(arg_v)) { SpaceFile *sfile= CTX_wm_space_file(C); diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c index 0cd721964bd..92244165dc1 100644 --- a/source/blender/editors/space_file/space_file.c +++ b/source/blender/editors/space_file/space_file.c @@ -66,7 +66,7 @@ /* ******************** default callbacks for file space ***************** */ -static SpaceLink *file_new(const bContext *C) +static SpaceLink *file_new(const bContext *UNUSED(C)) { ARegion *ar; SpaceFile *sfile; @@ -143,7 +143,7 @@ static void file_free(SpaceLink *sl) /* spacetype; init callback, area size changes, screen set, etc */ -static void file_init(struct wmWindowManager *wm, ScrArea *sa) +static void file_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa) { SpaceFile *sfile= (SpaceFile*)sa->spacedata.first; //printf("file_init\n"); @@ -178,7 +178,7 @@ static SpaceLink *file_duplicate(SpaceLink *sl) return (SpaceLink *)sfilen; } -static void file_refresh(const bContext *C, ScrArea *sa) +static void file_refresh(const bContext *C, ScrArea *UNUSED(sa)) { SpaceFile *sfile= CTX_wm_space_file(C); FileSelectParams *params = ED_fileselect_get_params(sfile); @@ -335,7 +335,7 @@ static void file_main_area_draw(const bContext *C, ARegion *ar) file_calc_previews(C, ar); /* set view */ - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); /* on first read, find active file */ if (params->active_file == -1) { @@ -457,7 +457,7 @@ static void file_channel_area_draw(const bContext *C, ARegion *ar) ED_region_panels(C, ar, 1, NULL, -1); } -static void file_channel_area_listener(ARegion *ar, wmNotifier *wmn) +static void file_channel_area_listener(ARegion *UNUSED(ar), wmNotifier *wmn) { /* context changes */ switch(wmn->category) { @@ -505,7 +505,7 @@ static void file_ui_area_draw(const bContext *C, ARegion *ar) glClear(GL_COLOR_BUFFER_BIT); /* set view2d view matrix for scrolling (without scrollers) */ - UI_view2d_view_ortho(C, &ar->v2d); + UI_view2d_view_ortho(&ar->v2d); file_draw_buttons(C, ar); diff --git a/source/blender/editors/space_file/writeimage.c b/source/blender/editors/space_file/writeimage.c index b69bfdc0231..750cf98727a 100644 --- a/source/blender/editors/space_file/writeimage.c +++ b/source/blender/editors/space_file/writeimage.c @@ -41,6 +41,7 @@ #include "BKE_context.h" #include "BKE_global.h" +#include "BKE_main.h" #include "BKE_image.h" #include "RE_pipeline.h" @@ -48,10 +49,10 @@ #include "file_intern.h" /* XXX */ -static void error(const char *dummy) {} -static void waitcursor(int val) {} -static void activate_fileselect(int d1, char *d2, char *d3, void *d4) {} -static int saveover(const char *dummy) {return 0;} +static void error(const char *UNUSED(dummy)) {} +static void waitcursor(int UNUSED(val)) {} +static void activate_fileselect(int UNUSED(d1), char *UNUSED(d2), char *UNUSED(d3), void *UNUSED(d4)) {} +static int saveover(const char *UNUSED(dummy)) {return 0;} /* XXX */ @@ -75,7 +76,7 @@ static void save_rendered_image_cb_real(char *name, int confirm) BKE_add_image_extension(name, scene->r.imtype); strcpy(str, name); - BLI_path_abs(str, G.sce); + BLI_path_abs(str, G.main->name); if (confirm) overwrite = saveover(str); @@ -99,7 +100,7 @@ static void save_rendered_image_cb_real(char *name, int confirm) waitcursor(1); /* from screen.c */ - ibuf= IMB_allocImBuf(rres.rectx, rres.recty, scene->r.planes, 0, 0); + ibuf= IMB_allocImBuf(rres.rectx, rres.recty, scene->r.planes, 0); ibuf->rect= (unsigned int *)rres.rect32; ibuf->rect_float= rres.rectf; ibuf->zbuf_float= rres.rectz; @@ -218,7 +219,7 @@ void BIF_save_rendered_image_fs(Scene *scene) char dir[FILE_MAXDIR * 2], str[FILE_MAXFILE * 2]; if(G.ima[0]==0) { - strcpy(dir, G.sce); + strcpy(dir, G.main->name); BLI_splitdirstring(dir, str); strcpy(G.ima, dir); } diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c index f4567255b91..dd3672b656a 100644 --- a/source/blender/editors/space_graph/graph_buttons.c +++ b/source/blender/editors/space_graph/graph_buttons.c @@ -76,7 +76,7 @@ /* -------------- */ -static void do_graph_region_buttons(bContext *C, void *arg, int event) +static void do_graph_region_buttons(bContext *UNUSED(C), void *UNUSED(arg), int event) { //Scene *scene= CTX_data_scene(C); @@ -116,7 +116,7 @@ static int graph_panel_context(const bContext *C, bAnimListElem **ale, FCurve ** return 1; } -static int graph_panel_poll(const bContext *C, PanelType *pt) +static int graph_panel_poll(const bContext *C, PanelType *UNUSED(pt)) { return graph_panel_context(C, NULL, NULL); } @@ -288,7 +288,7 @@ static void graph_panel_key_properties(const bContext *C, Panel *pa) #define B_IPO_DEPCHANGE 10 -static void do_graph_region_driver_buttons(bContext *C, void *arg, int event) +static void do_graph_region_driver_buttons(bContext *C, void *UNUSED(arg), int event) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); @@ -310,7 +310,7 @@ static void do_graph_region_driver_buttons(bContext *C, void *arg, int event) } /* callback to remove the active driver */ -static void driver_remove_cb (bContext *C, void *ale_v, void *dummy_v) +static void driver_remove_cb (bContext *UNUSED(C), void *ale_v, void *UNUSED(arg)) { bAnimListElem *ale= (bAnimListElem *)ale_v; ID *id= ale->id; @@ -325,7 +325,7 @@ static void driver_remove_cb (bContext *C, void *ale_v, void *dummy_v) } /* callback to add a target variable to the active driver */ -static void driver_add_var_cb (bContext *C, void *driver_v, void *dummy_v) +static void driver_add_var_cb (bContext *UNUSED(C), void *driver_v, void *UNUSED(arg)) { ChannelDriver *driver= (ChannelDriver *)driver_v; @@ -334,7 +334,7 @@ static void driver_add_var_cb (bContext *C, void *driver_v, void *dummy_v) } /* callback to remove target variable from active driver */ -static void driver_delete_var_cb (bContext *C, void *driver_v, void *dvar_v) +static void driver_delete_var_cb (bContext *UNUSED(C), void *driver_v, void *dvar_v) { ChannelDriver *driver= (ChannelDriver *)driver_v; DriverVar *dvar= (DriverVar *)dvar_v; @@ -344,7 +344,7 @@ static void driver_delete_var_cb (bContext *C, void *driver_v, void *dvar_v) } /* callback to reset the driver's flags */ -static void driver_update_flags_cb (bContext *C, void *fcu_v, void *dummy_v) +static void driver_update_flags_cb (bContext *UNUSED(C), void *fcu_v, void *UNUSED(arg)) { FCurve *fcu= (FCurve *)fcu_v; ChannelDriver *driver= fcu->driver; @@ -355,7 +355,7 @@ static void driver_update_flags_cb (bContext *C, void *fcu_v, void *dummy_v) } /* drivers panel poll */ -static int graph_panel_drivers_poll(const bContext *C, PanelType *pt) +static int graph_panel_drivers_poll(const bContext *C, PanelType *UNUSED(pt)) { SpaceIpo *sipo= CTX_wm_space_graph(C); @@ -365,9 +365,8 @@ static int graph_panel_drivers_poll(const bContext *C, PanelType *pt) return graph_panel_context(C, NULL, NULL); } - /* settings for 'single property' driver variable type */ -static void graph_panel_driverVar__singleProp(const bContext *C, uiLayout *layout, ID *id, DriverVar *dvar) +static void graph_panel_driverVar__singleProp(uiLayout *layout, ID *id, DriverVar *dvar) { DriverTarget *dtar= &dvar->targets[0]; PointerRNA dtar_ptr; @@ -379,7 +378,7 @@ static void graph_panel_driverVar__singleProp(const bContext *C, uiLayout *layou /* Target ID */ row= uiLayoutRow(layout, 0); - uiTemplateAnyID(row, (bContext *)C, &dtar_ptr, "id", "id_type", "Prop:"); + uiTemplateAnyID(row, &dtar_ptr, "id", "id_type", "Prop:"); /* Target Property */ // TODO: make this less technical... @@ -392,12 +391,12 @@ static void graph_panel_driverVar__singleProp(const bContext *C, uiLayout *layou col= uiLayoutColumn(layout, 1); block= uiLayoutGetBlock(col); /* rna path */ - uiTemplatePathBuilder(col, (bContext *)C, &dtar_ptr, "data_path", &root_ptr, "Path"); + uiTemplatePathBuilder(col, &dtar_ptr, "data_path", &root_ptr, "Path"); } } /* settings for 'rotation difference' driver variable type */ -static void graph_panel_driverVar__rotDiff(const bContext *C, uiLayout *layout, ID *id, DriverVar *dvar) +static void graph_panel_driverVar__rotDiff(uiLayout *layout, ID *id, DriverVar *dvar) { DriverTarget *dtar= &dvar->targets[0]; DriverTarget *dtar2= &dvar->targets[1]; @@ -412,7 +411,7 @@ static void graph_panel_driverVar__rotDiff(const bContext *C, uiLayout *layout, /* Bone 1 */ col= uiLayoutColumn(layout, 1); - uiTemplateAnyID(col, (bContext *)C, &dtar_ptr, "id", "id_type", "Bone 1:"); + uiTemplateAnyID(col, &dtar_ptr, "id", "id_type", "Bone 1:"); if (dtar->id && ob1->pose) { PointerRNA tar_ptr; @@ -422,7 +421,7 @@ static void graph_panel_driverVar__rotDiff(const bContext *C, uiLayout *layout, } col= uiLayoutColumn(layout, 1); - uiTemplateAnyID(col, (bContext *)C, &dtar2_ptr, "id", "id_type", "Bone 2:"); + uiTemplateAnyID(col, &dtar2_ptr, "id", "id_type", "Bone 2:"); if (dtar2->id && ob2->pose) { PointerRNA tar_ptr; @@ -433,7 +432,7 @@ static void graph_panel_driverVar__rotDiff(const bContext *C, uiLayout *layout, } /* settings for 'location difference' driver variable type */ -static void graph_panel_driverVar__locDiff(const bContext *C, uiLayout *layout, ID *id, DriverVar *dvar) +static void graph_panel_driverVar__locDiff(uiLayout *layout, ID *id, DriverVar *dvar) { DriverTarget *dtar= &dvar->targets[0]; DriverTarget *dtar2= &dvar->targets[1]; @@ -448,7 +447,7 @@ static void graph_panel_driverVar__locDiff(const bContext *C, uiLayout *layout, /* Bone 1 */ col= uiLayoutColumn(layout, 1); - uiTemplateAnyID(col, (bContext *)C, &dtar_ptr, "id", "id_type", "Ob/Bone 1:"); + uiTemplateAnyID(col, &dtar_ptr, "id", "id_type", "Ob/Bone 1:"); if (dtar->id && ob1->pose) { PointerRNA tar_ptr; @@ -460,7 +459,7 @@ static void graph_panel_driverVar__locDiff(const bContext *C, uiLayout *layout, uiItemR(col, &dtar_ptr, "use_local_space_transform", 0, NULL, 0); col= uiLayoutColumn(layout, 1); - uiTemplateAnyID(col, (bContext *)C, &dtar2_ptr, "id", "id_type", "Ob/Bone 2:"); + uiTemplateAnyID(col, &dtar2_ptr, "id", "id_type", "Ob/Bone 2:"); if (dtar2->id && ob2->pose) { PointerRNA tar_ptr; @@ -473,7 +472,7 @@ static void graph_panel_driverVar__locDiff(const bContext *C, uiLayout *layout, } /* settings for 'transform channel' driver variable type */ -static void graph_panel_driverVar__transChan(const bContext *C, uiLayout *layout, ID *id, DriverVar *dvar) +static void graph_panel_driverVar__transChan(uiLayout *layout, ID *id, DriverVar *dvar) { DriverTarget *dtar= &dvar->targets[0]; Object *ob = (Object *)dtar->id; @@ -485,7 +484,7 @@ static void graph_panel_driverVar__transChan(const bContext *C, uiLayout *layout /* properties */ col= uiLayoutColumn(layout, 1); - uiTemplateAnyID(col, (bContext *)C, &dtar_ptr, "id", "id_type", "Ob/Bone:"); + uiTemplateAnyID(col, &dtar_ptr, "id", "id_type", "Ob/Bone:"); if (dtar->id && ob->pose) { PointerRNA tar_ptr; @@ -606,16 +605,16 @@ static void graph_panel_drivers(const bContext *C, Panel *pa) /* controls to draw depends on the type of variable */ switch (dvar->type) { case DVAR_TYPE_SINGLE_PROP: /* single property */ - graph_panel_driverVar__singleProp(C, box, ale->id, dvar); + graph_panel_driverVar__singleProp(box, ale->id, dvar); break; case DVAR_TYPE_ROT_DIFF: /* rotational difference */ - graph_panel_driverVar__rotDiff(C, box, ale->id, dvar); + graph_panel_driverVar__rotDiff(box, ale->id, dvar); break; case DVAR_TYPE_LOC_DIFF: /* location difference */ - graph_panel_driverVar__locDiff(C, box, ale->id, dvar); + graph_panel_driverVar__locDiff(box, ale->id, dvar); break; case DVAR_TYPE_TRANSFORM_CHAN: /* transform channel */ - graph_panel_driverVar__transChan(C, box, ale->id, dvar); + graph_panel_driverVar__transChan(box, ale->id, dvar); break; } @@ -642,7 +641,7 @@ static void graph_panel_drivers(const bContext *C, Panel *pa) #define B_FMODIFIER_REDRAW 20 -static void do_graph_region_modifier_buttons(bContext *C, void *arg, int event) +static void do_graph_region_modifier_buttons(bContext *C, void *UNUSED(arg), int event) { switch (event) { case B_REDR: @@ -733,7 +732,7 @@ void graph_buttons_register(ARegionType *art) BLI_addtail(&art->paneltypes, pt); } -static int graph_properties(bContext *C, wmOperator *op) +static int graph_properties(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); ARegion *ar= graph_has_buttons_region(sa); diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index f780a6c31ee..01a8ba4797c 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -87,7 +87,7 @@ /* Envelope -------------- */ // TODO: draw a shaded poly showing the region of influence too!!! -static void draw_fcurve_modifier_controls_envelope (FCurve *fcu, FModifier *fcm, View2D *v2d) +static void draw_fcurve_modifier_controls_envelope (FModifier *fcm, View2D *v2d) { FMod_Envelope *env= (FMod_Envelope *)fcm->data; FCM_EnvelopeData *fed; @@ -137,7 +137,7 @@ static void draw_fcurve_modifier_controls_envelope (FCurve *fcu, FModifier *fcm, /* Points ---------------- */ /* helper func - draw keyframe vertices only for an F-Curve */ -static void draw_fcurve_vertices_keyframes (bAnimContext *ac, FCurve *fcu, View2D *v2d, short edit, short sel) +static void draw_fcurve_vertices_keyframes (FCurve *fcu, View2D *v2d, short edit, short sel) { BezTriple *bezt= fcu->bezt; const float fac= 0.05f * (v2d->cur.xmax - v2d->cur.xmin); @@ -209,7 +209,7 @@ static void draw_fcurve_handle_control (float x, float y, float xscale, float ys } /* helper func - draw handle vertices only for an F-Curve (if it is not protected) */ -static void draw_fcurve_vertices_handles (bAnimContext *ac, SpaceIpo *sipo, FCurve *fcu, View2D *v2d, short sel) +static void draw_fcurve_vertices_handles (FCurve *fcu, View2D *v2d, short sel, short sel_handle_only) { BezTriple *bezt= fcu->bezt; BezTriple *prevbezt = NULL; @@ -237,7 +237,7 @@ static void draw_fcurve_vertices_handles (bAnimContext *ac, SpaceIpo *sipo, FCur * Also, need to take into account whether the keyframe was selected * if a Graph Editor option to only show handles of selected keys is on. */ - if ( !(sipo->flag & SIPO_SELVHANDLESONLY) || BEZSELECTED(bezt) ) { + if ( !sel_handle_only || BEZSELECTED(bezt) ) { if ( (!prevbezt && (bezt->ipo==BEZT_IPO_BEZ)) || (prevbezt && (prevbezt->ipo==BEZT_IPO_BEZ)) ) { if ((bezt->f1 & SELECT) == sel)/* && v2d->cur.xmin < bezt->vec[0][0] < v2d->cur.xmax)*/ draw_fcurve_handle_control(bezt->vec[0][0], bezt->vec[0][1], xscale, yscale, hsize); @@ -255,7 +255,7 @@ static void draw_fcurve_vertices_handles (bAnimContext *ac, SpaceIpo *sipo, FCur } /* helper func - set color to draw F-Curve data with */ -static void set_fcurve_vertex_color (SpaceIpo *sipo, FCurve *fcu, short sel) +static void set_fcurve_vertex_color (FCurve *fcu, short sel) { /* Fade the 'intensity' of the vertices based on the selection of the curves too */ int alphaOffset= (int)((drawFCurveFade(fcu) - 1.0f) * 255); @@ -274,7 +274,7 @@ static void set_fcurve_vertex_color (SpaceIpo *sipo, FCurve *fcu, short sel) } -static void draw_fcurve_vertices (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, FCurve *fcu, int do_handles) +static void draw_fcurve_vertices (ARegion *ar, FCurve *fcu, short do_handles, short sel_handle_only) { View2D *v2d= &ar->v2d; @@ -290,19 +290,19 @@ static void draw_fcurve_vertices (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, /* draw the two handles first (if they're shown, the curve doesn't have just a single keyframe, and the curve is being edited) */ if (do_handles) { - set_fcurve_vertex_color(sipo, fcu, 0); - draw_fcurve_vertices_handles(ac, sipo, fcu, v2d, 0); + set_fcurve_vertex_color(fcu, 0); + draw_fcurve_vertices_handles(fcu, v2d, 0, sel_handle_only); - set_fcurve_vertex_color(sipo, fcu, 1); - draw_fcurve_vertices_handles(ac, sipo, fcu, v2d, 1); + set_fcurve_vertex_color(fcu, 1); + draw_fcurve_vertices_handles(fcu, v2d, 1, sel_handle_only); } /* draw keyframes over the handles */ - set_fcurve_vertex_color(sipo, fcu, 0); - draw_fcurve_vertices_keyframes(ac, fcu, v2d, !(fcu->flag & FCURVE_PROTECTED), 0); + set_fcurve_vertex_color(fcu, 0); + draw_fcurve_vertices_keyframes(fcu, v2d, !(fcu->flag & FCURVE_PROTECTED), 0); - set_fcurve_vertex_color(sipo, fcu, 1); - draw_fcurve_vertices_keyframes(ac, fcu, v2d, !(fcu->flag & FCURVE_PROTECTED), 1); + set_fcurve_vertex_color(fcu, 1); + draw_fcurve_vertices_keyframes(fcu, v2d, !(fcu->flag & FCURVE_PROTECTED), 1); glPointSize(1.0f); } @@ -329,7 +329,7 @@ static int draw_fcurve_handles_check(SpaceIpo *sipo, FCurve *fcu) /* draw lines for F-Curve handles only (this is only done in EditMode) * note: draw_fcurve_handles_check must be checked before running this. */ -static void draw_fcurve_handles (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, FCurve *fcu) +static void draw_fcurve_handles (SpaceIpo *sipo, FCurve *fcu) { int sel, b; @@ -455,7 +455,7 @@ static void draw_fcurve_sample_control (float x, float y, float xscale, float ys } /* helper func - draw keyframe vertices only for an F-Curve */ -static void draw_fcurve_samples (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, FCurve *fcu) +static void draw_fcurve_samples (ARegion *ar, FCurve *fcu) { FPoint *first, *last; float hsize, xscale, yscale; @@ -489,7 +489,7 @@ static void draw_fcurve_samples (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, /* Curve ---------------- */ /* helper func - just draw the F-Curve by sampling the visible region (for drawing curves with modifiers) */ -static void draw_fcurve_curve (bAnimContext *ac, ID *id, FCurve *fcu, SpaceIpo *sipo, View2D *v2d, View2DGrid *grid) +static void draw_fcurve_curve (bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d, View2DGrid *grid) { ChannelDriver *driver; float samplefreq, ctime; @@ -627,7 +627,7 @@ static void draw_fcurve_curve_samples (bAnimContext *ac, ID *id, FCurve *fcu, Vi } /* helper func - draw one repeat of an F-Curve */ -static void draw_fcurve_curve_bezts (bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d, View2DGrid *grid) +static void draw_fcurve_curve_bezts (bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d) { BezTriple *prevbezt= fcu->bezt; BezTriple *bezt= prevbezt+1; @@ -784,7 +784,7 @@ static void draw_fcurve_curve_bezts (bAnimContext *ac, ID *id, FCurve *fcu, View /* Draw the 'ghost' F-Curves (i.e. snapshots of the curve) * NOTE: unit mapping has already been applied to the values, so do not try and apply again */ -void graph_draw_ghost_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGrid *grid) +void graph_draw_ghost_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar) { FCurve *fcu; @@ -878,12 +878,12 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGri /* draw a curve affected by modifiers or only allowed to have integer values * by sampling it at various small-intervals over the visible region */ - draw_fcurve_curve(ac, ale->id, fcu, sipo, &ar->v2d, grid); + draw_fcurve_curve(ac, ale->id, fcu, &ar->v2d, grid); } else if ( ((fcu->bezt) || (fcu->fpt)) && (fcu->totvert) ) { /* just draw curve based on defined data (i.e. no modifiers) */ if (fcu->bezt) - draw_fcurve_curve_bezts(ac, ale->id, fcu, &ar->v2d, grid); + draw_fcurve_curve_bezts(ac, ale->id, fcu, &ar->v2d); else if (fcu->fpt) draw_fcurve_curve_samples(ac, ale->id, fcu, &ar->v2d); } @@ -904,7 +904,7 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGri if ((fcu->flag & FCURVE_ACTIVE) && (fcm)) { switch (fcm->type) { case FMODIFIER_TYPE_ENVELOPE: /* envelope */ - draw_fcurve_modifier_controls_envelope(fcu, fcm, &ar->v2d); + draw_fcurve_modifier_controls_envelope(fcm, &ar->v2d); break; } } @@ -919,15 +919,15 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGri if (do_handles) { /* only draw handles/vertices on keyframes */ glEnable(GL_BLEND); - draw_fcurve_handles(ac, sipo, ar, fcu); + draw_fcurve_handles(sipo, fcu); glDisable(GL_BLEND); } - draw_fcurve_vertices(ac, sipo, ar, fcu, do_handles); + draw_fcurve_vertices(ar, fcu, do_handles, sipo->flag&SIPO_SELVHANDLESONLY); } else { /* samples: only draw two indicators at either end as indicators */ - draw_fcurve_samples(ac, sipo, ar, fcu); + draw_fcurve_samples(ar, fcu); } /* unapply unit mapping */ @@ -948,7 +948,7 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGri /* Channel List */ /* left hand part */ -void graph_draw_channel_names(bContext *C, bAnimContext *ac, SpaceIpo *sipo, ARegion *ar) +void graph_draw_channel_names(bContext *C, bAnimContext *ac, ARegion *ar) { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index 5c692ba1112..e1d1e4194d5 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -140,7 +140,7 @@ void get_graph_keyframe_extents (bAnimContext *ac, float *xmin, float *xmax, flo /* ****************** Automatic Preview-Range Operator ****************** */ -static int graphkeys_previewrange_exec(bContext *C, wmOperator *op) +static int graphkeys_previewrange_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; Scene *scene; @@ -183,7 +183,7 @@ void GRAPH_OT_previewrange_set (wmOperatorType *ot) /* ****************** View-All Operator ****************** */ -static int graphkeys_viewall_exec(bContext *C, wmOperator *op) +static int graphkeys_viewall_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; View2D *v2d; @@ -305,7 +305,7 @@ static void create_ghost_curves (bAnimContext *ac, int start, int end) /* ------------------- */ -static int graphkeys_create_ghostcurves_exec(bContext *C, wmOperator *op) +static int graphkeys_create_ghostcurves_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; View2D *v2d; @@ -349,7 +349,7 @@ void GRAPH_OT_ghost_curves_create (wmOperatorType *ot) /* ******************** Clear Ghost-Curves Operator *********************** */ /* This operator clears the 'ghost curves' for the active Graph Editor */ -static int graphkeys_clear_ghostcurves_exec(bContext *C, wmOperator *op) +static int graphkeys_clear_ghostcurves_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; SpaceIpo *sipo; @@ -719,7 +719,7 @@ static void duplicate_graph_keys (bAnimContext *ac) /* ------------------- */ -static int graphkeys_duplicate_exec(bContext *C, wmOperator *op) +static int graphkeys_duplicate_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -739,7 +739,7 @@ static int graphkeys_duplicate_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int graphkeys_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int graphkeys_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { graphkeys_duplicate_exec(C, op); @@ -799,7 +799,7 @@ static void delete_graph_keys (bAnimContext *ac) /* ------------------- */ -static int graphkeys_delete_exec(bContext *C, wmOperator *op) +static int graphkeys_delete_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -935,7 +935,7 @@ static void bake_graph_curves (bAnimContext *ac, int start, int end) /* ------------------- */ -static int graphkeys_bake_exec(bContext *C, wmOperator *op) +static int graphkeys_bake_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; Scene *scene= NULL; @@ -1001,7 +1001,7 @@ typedef struct tSoundBakeInfo { /* Sampling callback used to determine the value from the sound to * save in the F-Curve at the specified frame */ -static float fcurve_samplingcb_sound (FCurve *fcu, void *data, float evaltime) +static float fcurve_samplingcb_sound (FCurve *UNUSED(fcu), void *data, float evaltime) { tSoundBakeInfo *sbi= (tSoundBakeInfo *)data; @@ -1149,7 +1149,7 @@ static void sample_graph_keys (bAnimContext *ac) /* ------------------- */ -static int graphkeys_sample_exec(bContext *C, wmOperator *op) +static int graphkeys_sample_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -1205,7 +1205,7 @@ static void setexpo_graph_keys(bAnimContext *ac, short mode) int filter; /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* loop through setting mode per F-Curve */ @@ -1530,7 +1530,7 @@ void GRAPH_OT_euler_filter (wmOperatorType *ot) /* ***************** Jump to Selected Frames Operator *********************** */ /* snap current-frame indicator to 'average time' of selected keyframe */ -static int graphkeys_framejump_exec(bContext *C, wmOperator *op) +static int graphkeys_framejump_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; ListBase anim_data= {NULL, NULL}; @@ -1835,7 +1835,7 @@ void GRAPH_OT_mirror (wmOperatorType *ot) /* ******************** Smooth Keyframes Operator *********************** */ -static int graphkeys_smooth_exec(bContext *C, wmOperator *op) +static int graphkeys_smooth_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; ListBase anim_data = {NULL, NULL}; @@ -1890,7 +1890,7 @@ void GRAPH_OT_smooth (wmOperatorType *ot) /* ******************** Add F-Modifier Operator *********************** */ /* present a special customised popup menu for this, with some filtering */ -static int graph_fmodifier_add_invoke (bContext *C, wmOperator *op, wmEvent *event) +static int graph_fmodifier_add_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { uiPopupMenu *pup; uiLayout *layout; diff --git a/source/blender/editors/space_graph/graph_intern.h b/source/blender/editors/space_graph/graph_intern.h index a637ed15fcd..560dabbb634 100644 --- a/source/blender/editors/space_graph/graph_intern.h +++ b/source/blender/editors/space_graph/graph_intern.h @@ -48,10 +48,10 @@ struct ARegion *graph_has_buttons_region(struct ScrArea *sa); /* ***************************************** */ /* graph_draw.c */ -void graph_draw_channel_names(struct bContext *C, struct bAnimContext *ac, struct SpaceIpo *sipo, struct ARegion *ar); +void graph_draw_channel_names(struct bContext *C, struct bAnimContext *ac, struct ARegion *ar); void graph_draw_curves(struct bAnimContext *ac, struct SpaceIpo *sipo, struct ARegion *ar, struct View2DGrid *grid, short sel); -void graph_draw_ghost_curves(struct bAnimContext *ac, struct SpaceIpo *sipo, struct ARegion *ar, struct View2DGrid *grid); +void graph_draw_ghost_curves(struct bAnimContext *ac, struct SpaceIpo *sipo, struct ARegion *ar); /* ***************************************** */ /* graph_header.c */ diff --git a/source/blender/editors/space_graph/graph_ops.c b/source/blender/editors/space_graph/graph_ops.c index 0069e6e0675..b4ca1b8c901 100644 --- a/source/blender/editors/space_graph/graph_ops.c +++ b/source/blender/editors/space_graph/graph_ops.c @@ -181,7 +181,7 @@ void GRAPH_OT_cursor_set(wmOperatorType *ot) /* Toggle Handles ----------------------------------------------------------------- */ -static int view_toggle_handles_exec (bContext *C, wmOperator *op) +static int view_toggle_handles_exec (bContext *C, wmOperator *UNUSED(op)) { SpaceIpo *sipo= CTX_wm_space_graph(C); ARegion *ar= CTX_wm_region(C); diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c index cdc8166f2d6..0aa0a87dbac 100644 --- a/source/blender/editors/space_graph/graph_select.c +++ b/source/blender/editors/space_graph/graph_select.c @@ -539,7 +539,7 @@ void GRAPH_OT_select_column (wmOperatorType *ot) /* ******************** Select Linked Operator *********************** */ -static int graphkeys_select_linked_exec (bContext *C, wmOperator *op) +static int graphkeys_select_linked_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -638,7 +638,7 @@ static void select_moreless_graph_keys (bAnimContext *ac, short mode) /* ----------------- */ -static int graphkeys_select_more_exec (bContext *C, wmOperator *op) +static int graphkeys_select_more_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -672,7 +672,7 @@ void GRAPH_OT_select_more (wmOperatorType *ot) /* ----------------- */ -static int graphkeys_select_less_exec (bContext *C, wmOperator *op) +static int graphkeys_select_less_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -886,7 +886,7 @@ static void get_nearest_fcurve_verts_list (bAnimContext *ac, int mval[2], ListBa } /* helper for find_nearest_fcurve_vert() - get the best match to use */ -static tNearestVertInfo *get_best_nearest_fcurve_vert (bAnimContext *ac, ListBase *matches) +static tNearestVertInfo *get_best_nearest_fcurve_vert (ListBase *matches) { tNearestVertInfo *nvi = NULL; short found = 0; @@ -941,7 +941,7 @@ static tNearestVertInfo *find_nearest_fcurve_vert (bAnimContext *ac, int mval[2] get_nearest_fcurve_verts_list(ac, mval, &matches); /* step 2: find the best vert */ - nvi= get_best_nearest_fcurve_vert(ac, &matches); + nvi= get_best_nearest_fcurve_vert(&matches); BLI_freelistN(&matches); diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c index ca372d74da6..ff2d233ccdb 100644 --- a/source/blender/editors/space_graph/space_graph.c +++ b/source/blender/editors/space_graph/space_graph.c @@ -175,7 +175,7 @@ static void graph_free(SpaceLink *sl) /* spacetype; init callback */ -static void graph_init(struct wmWindowManager *wm, ScrArea *sa) +static void graph_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa) { SpaceIpo *sipo= (SpaceIpo *)sa->spacedata.first; @@ -229,17 +229,17 @@ static void graph_main_area_draw(const bContext *C, ARegion *ar) glClearColor(col[0], col[1], col[2], 0.0); glClear(GL_COLOR_BUFFER_BIT); - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); /* grid */ unitx= (sipo->flag & SIPO_DRAWTIME)? V2D_UNIT_SECONDS : V2D_UNIT_FRAMESCALE; - grid= UI_view2d_grid_calc(C, v2d, unitx, V2D_GRID_NOCLAMP, unity, V2D_GRID_NOCLAMP, ar->winx, ar->winy); - UI_view2d_grid_draw(C, v2d, grid, V2D_GRIDLINES_ALL); + grid= UI_view2d_grid_calc(CTX_data_scene(C), v2d, unitx, V2D_GRID_NOCLAMP, unity, V2D_GRID_NOCLAMP, ar->winx, ar->winy); + UI_view2d_grid_draw(v2d, grid, V2D_GRIDLINES_ALL); /* draw data */ if (ANIM_animdata_get_context(C, &ac)) { /* draw ghost curves */ - graph_draw_ghost_curves(&ac, sipo, ar, grid); + graph_draw_ghost_curves(&ac, sipo, ar); /* draw curves twice - unselected, then selected, so that the are fewer occlusion problems */ graph_draw_curves(&ac, sipo, ar, grid, 0); @@ -282,11 +282,11 @@ static void graph_main_area_draw(const bContext *C, ARegion *ar) ANIM_draw_cfra(C, v2d, flag); /* markers */ - UI_view2d_view_orthoSpecial(C, v2d, 1); + UI_view2d_view_orthoSpecial(ar, v2d, 1); draw_markers_time(C, 0); /* preview range */ - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); ANIM_draw_previewrange(C, v2d); /* reset view matrix */ @@ -314,7 +314,6 @@ static void graph_channel_area_init(wmWindowManager *wm, ARegion *ar) static void graph_channel_area_draw(const bContext *C, ARegion *ar) { - SpaceIpo *sipo= CTX_wm_space_graph(C); bAnimContext ac; View2D *v2d= &ar->v2d; View2DScrollers *scrollers; @@ -325,11 +324,11 @@ static void graph_channel_area_draw(const bContext *C, ARegion *ar) glClearColor(col[0], col[1], col[2], 0.0); glClear(GL_COLOR_BUFFER_BIT); - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); /* draw channels */ if (ANIM_animdata_get_context(C, &ac)) { - graph_draw_channel_names((bContext*)C, &ac, sipo, ar); + graph_draw_channel_names((bContext*)C, &ac, ar); } /* reset view matrix */ @@ -342,7 +341,7 @@ static void graph_channel_area_draw(const bContext *C, ARegion *ar) } /* add handlers, stuff you only do once or on area/region changes */ -static void graph_header_area_init(wmWindowManager *wm, ARegion *ar) +static void graph_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar) { ED_region_header_init(ar); } diff --git a/source/blender/editors/space_image/CMakeLists.txt b/source/blender/editors/space_image/CMakeLists.txt index d47f5a9820e..750c4b324d6 100644 --- a/source/blender/editors/space_image/CMakeLists.txt +++ b/source/blender/editors/space_image/CMakeLists.txt @@ -41,6 +41,10 @@ IF(WITH_IMAGE_TIFF) ADD_DEFINITIONS(-DWITH_TIFF) ENDIF(WITH_IMAGE_TIFF) +IF(WITH_IMAGE_CINEON) + ADD_DEFINITIONS(-DWITH_CINEON) +ENDIF(WITH_IMAGE_CINEON) + IF(WITH_LCMS) SET(INC ${INC} ${LCMS_INCLUDE_DIR}) ADD_DEFINITIONS(-DWITH_LCMS) diff --git a/source/blender/editors/space_image/SConscript b/source/blender/editors/space_image/SConscript index c7c31352185..15a7aeb828f 100644 --- a/source/blender/editors/space_image/SConscript +++ b/source/blender/editors/space_image/SConscript @@ -16,6 +16,8 @@ if env['WITH_BF_OPENEXR']: defs.append('WITH_OPENEXR') if env['WITH_BF_TIFF']: defs.append('WITH_TIFF') +if env['WITH_BF_CINEON']: + defs.append('WITH_CINEON') if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): incs += ' ' + env['BF_PTHREADS_INC'] diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c index 840d4943c56..bbc8925a152 100644 --- a/source/blender/editors/space_image/image_buttons.c +++ b/source/blender/editors/space_image/image_buttons.c @@ -97,7 +97,7 @@ static void image_editvertex_buts(const bContext *C, uiBlock *block); -static void do_image_panel_events(bContext *C, void *arg, int event) +static void do_image_panel_events(bContext *C, void *UNUSED(arg), int event) { SpaceImage *sima= CTX_wm_space_image(C); @@ -300,7 +300,7 @@ static void image_editvertex_buts(const bContext *C, uiBlock *block) /* is used for both read and write... */ -static int image_panel_poll(const bContext *C, PanelType *pt) +static int image_panel_poll(const bContext *C, PanelType *UNUSED(pt)) { SpaceImage *sima= CTX_wm_space_image(C); ImBuf *ibuf; @@ -493,7 +493,8 @@ static char *slot_menu() return str; } -static char *layer_menu(RenderResult *rr, short *curlay) +/* TODO, curlay should be removed? */ +static char *layer_menu(RenderResult *rr, short *UNUSED(curlay)) { RenderLayer *rl; int len= 64 + 32*BLI_countlist(&rr->layers); @@ -739,7 +740,7 @@ typedef struct RNAUpdateCb { ImageUser *iuser; } RNAUpdateCb; -static void rna_update_cb(bContext *C, void *arg_cb, void *arg_unused) +static void rna_update_cb(bContext *C, void *arg_cb, void *UNUSED(arg)) { RNAUpdateCb *cb= (RNAUpdateCb*)arg_cb; @@ -951,7 +952,7 @@ void uiTemplateImageLayers(uiLayout *layout, bContext *C, Image *ima, ImageUser } } -static int image_panel_uv_poll(const bContext *C, PanelType *pt) +static int image_panel_uv_poll(const bContext *C, PanelType *UNUSED(pt)) { Object *obedit= CTX_data_edit_object(C); return ED_uvedit_test(obedit); @@ -996,7 +997,7 @@ void image_buttons_register(ARegionType *art) BLI_addtail(&art->paneltypes, pt); } -static int image_properties(bContext *C, wmOperator *op) +static int image_properties(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); ARegion *ar= image_has_buttons_region(sa); @@ -1019,7 +1020,7 @@ void IMAGE_OT_properties(wmOperatorType *ot) ot->flag= 0; } -static int image_scopes(bContext *C, wmOperator *op) +static int image_scopes(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); ARegion *ar= image_has_scope_region(sa); diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index f29d1bc033f..48524d2728f 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -70,7 +70,7 @@ #define HEADER_HEIGHT 18 -static void image_verify_buffer_float(SpaceImage *sima, Image *ima, ImBuf *ibuf, int color_manage) +static void image_verify_buffer_float(Image *ima, ImBuf *ibuf, int color_manage) { /* detect if we need to redo the curve map. ibuf->rect is zero for compositor and render results after change @@ -367,7 +367,7 @@ static void draw_image_buffer(SpaceImage *sima, ARegion *ar, Scene *scene, Image } #ifdef WITH_LCMS else if(sima->flag & SI_COLOR_CORRECTION) { - image_verify_buffer_float(sima, ima, ibuf, color_manage); + image_verify_buffer_float(ima, ibuf, color_manage); if(sima_draw_colorcorrected_pixels(x, y, ibuf)==0) { unsigned char col1[3]= {100, 0, 100}, col2[3]= {160, 0, 160}; /* pink says 'warning' in blender land */ @@ -387,7 +387,7 @@ static void draw_image_buffer(SpaceImage *sima, ARegion *ar, Scene *scene, Image /* we don't draw floats buffers directly but * convert them, and optionally apply curves */ - image_verify_buffer_float(sima, ima, ibuf, color_manage); + image_verify_buffer_float(ima, ibuf, color_manage); if(ibuf->rect) glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect); @@ -440,7 +440,7 @@ static void draw_image_buffer_tiled(SpaceImage *sima, ARegion *ar, Scene *scene, sima->curtile = ima->xrep*ima->yrep - 1; /* create char buffer from float if needed */ - image_verify_buffer_float(sima, ima, ibuf, color_manage); + image_verify_buffer_float(ima, ibuf, color_manage); /* retrieve part of image buffer */ dx= ibuf->x/ima->xrep; @@ -579,7 +579,7 @@ static unsigned char *get_alpha_clone_image(Scene *scene, int *width, int *heigh return rect; } -static void draw_image_paint_helpers(SpaceImage *sima, ARegion *ar, Scene *scene, float zoomx, float zoomy) +static void draw_image_paint_helpers(ARegion *ar, Scene *scene, float zoomx, float zoomy) { Brush *brush; int x, y, w, h; @@ -658,7 +658,7 @@ void draw_image_main(SpaceImage *sima, ARegion *ar, Scene *scene) draw_image_buffer(sima, ar, scene, ima, ibuf, 0.0f, 0.0f, zoomx, zoomy); /* paint helpers */ - draw_image_paint_helpers(sima, ar, scene, zoomx, zoomy); + draw_image_paint_helpers(ar, scene, zoomx, zoomy); /* XXX integrate this code */ diff --git a/source/blender/editors/space_image/image_header.c b/source/blender/editors/space_image/image_header.c index 7ecb2565e72..498b3b80bd5 100644 --- a/source/blender/editors/space_image/image_header.c +++ b/source/blender/editors/space_image/image_header.c @@ -53,7 +53,7 @@ /********************** toolbox operator *********************/ -static int toolbox_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int toolbox_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event)) { SpaceImage *sima= CTX_wm_space_image(C); Object *obedit= CTX_data_edit_object(C); diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 0bcc2439756..429ba64ed0f 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -133,7 +133,7 @@ static int space_image_file_exists_poll(bContext *C) ibuf= ED_space_image_acquire_buffer(sima, &lock); if(ibuf) { BLI_strncpy(name, ibuf->name, FILE_MAX); - BLI_path_abs(name, G.sce); + BLI_path_abs(name, G.main->name); poll= (BLI_exists(name) && BLI_is_writable(name)); } ED_space_image_release_buffer(sima, lock); @@ -432,7 +432,7 @@ void IMAGE_OT_view_zoom(wmOperatorType *ot) * Default behavior is to reset the position of the image and set the zoom to 1 * If the image will not fit within the window rectangle, the zoom is adjusted */ -static int view_all_exec(bContext *C, wmOperator *op) +static int view_all_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceImage *sima; ARegion *ar; @@ -486,7 +486,7 @@ void IMAGE_OT_view_all(wmOperatorType *ot) /********************** view selected operator *********************/ -static int view_selected_exec(bContext *C, wmOperator *op) +static int view_selected_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceImage *sima; ARegion *ar; @@ -543,7 +543,7 @@ void IMAGE_OT_view_selected(wmOperatorType *ot) /********************** view zoom in/out operator *********************/ -static int view_zoom_in_exec(bContext *C, wmOperator *op) +static int view_zoom_in_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceImage *sima= CTX_wm_space_image(C); ARegion *ar= CTX_wm_region(C); @@ -566,7 +566,7 @@ void IMAGE_OT_view_zoom_in(wmOperatorType *ot) ot->poll= space_image_main_area_poll; } -static int view_zoom_out_exec(bContext *C, wmOperator *op) +static int view_zoom_out_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceImage *sima= CTX_wm_space_image(C); ARegion *ar= CTX_wm_region(C); @@ -679,7 +679,7 @@ static void open_init(bContext *C, wmOperator *op) uiIDContextProperty(C, &pprop->ptr, &pprop->prop); } -static int open_cancel(bContext *C, wmOperator *op) +static int open_cancel(bContext *UNUSED(C), wmOperator *op) { MEM_freeN(op->customdata); op->customdata= NULL; @@ -701,7 +701,7 @@ static int open_exec(bContext *C, wmOperator *op) errno= 0; - ima= BKE_add_image_file(str, scene ? scene->r.cfra : 1); + ima= BKE_add_image_file(str); if(!ima) { if(op->customdata) MEM_freeN(op->customdata); @@ -736,7 +736,7 @@ static int open_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int open_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { SpaceImage *sima= CTX_wm_space_image(C); char *path=U.textudir; @@ -806,7 +806,7 @@ static int replace_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int replace_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int replace_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { SpaceImage *sima= CTX_wm_space_image(C); @@ -856,7 +856,7 @@ static void save_image_doit(bContext *C, SpaceImage *sima, Scene *scene, wmOpera int relative= (RNA_struct_find_property(op->ptr, "relative_path") && RNA_boolean_get(op->ptr, "relative_path")); int save_copy= (RNA_struct_find_property(op->ptr, "copy") && RNA_boolean_get(op->ptr, "copy")); - BLI_path_abs(path, G.sce); + BLI_path_abs(path, G.main->name); if(scene->r.scemode & R_EXTENSION) { BKE_add_image_extension(path, sima->imtypenr); @@ -876,7 +876,7 @@ static void save_image_doit(bContext *C, SpaceImage *sima, Scene *scene, wmOpera RE_WriteRenderResult(rr, path, scene->r.quality); if(relative) - BLI_path_rel(path, G.sce); /* only after saving */ + BLI_path_rel(path, G.main->name); /* only after saving */ if(!save_copy) { if(do_newpath) { @@ -896,7 +896,7 @@ static void save_image_doit(bContext *C, SpaceImage *sima, Scene *scene, wmOpera else if (BKE_write_ibuf(scene, ibuf, path, sima->imtypenr, scene->r.subimtype, scene->r.quality)) { if(relative) - BLI_path_rel(path, G.sce); /* only after saving */ + BLI_path_rel(path, G.main->name); /* only after saving */ if(!save_copy) { if(do_newpath) { @@ -961,7 +961,7 @@ static int save_as_exec(bContext *C, wmOperator *op) } -static int save_as_check(bContext *C, wmOperator *op) +static int save_as_check(bContext *UNUSED(C), wmOperator *op) { char filepath[FILE_MAX]; RNA_string_get(op->ptr, "filepath", filepath); @@ -972,7 +972,7 @@ static int save_as_check(bContext *C, wmOperator *op) return FALSE; } -static int save_as_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int save_as_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { SpaceImage *sima= CTX_wm_space_image(C); Image *ima = ED_space_image(sima); @@ -1071,7 +1071,7 @@ static int save_exec(bContext *C, wmOperator *op) if(name[0]==0) BLI_strncpy(name, G.ima, FILE_MAX); else - BLI_path_abs(name, G.sce); + BLI_path_abs(name, G.main->name); if(BLI_exists(name) && BLI_is_writable(name)) { rr= BKE_image_acquire_renderresult(scene, ima); @@ -1157,7 +1157,7 @@ static int save_sequence_exec(bContext *C, wmOperator *op) char name[FILE_MAX]; BLI_strncpy(name, ibuf->name, sizeof(name)); - BLI_path_abs(name, G.sce); + BLI_path_abs(name, G.main->name); if(0 == IMB_saveiff(ibuf, name, IB_rect | IB_zbuf | IB_zbuffloat)) { BKE_reportf(op->reports, RPT_ERROR, "Could not write image %s.", name); @@ -1188,7 +1188,7 @@ void IMAGE_OT_save_sequence(wmOperatorType *ot) /******************** reload image operator ********************/ -static int reload_exec(bContext *C, wmOperator *op) +static int reload_exec(bContext *C, wmOperator *UNUSED(op)) { Image *ima= CTX_data_edit_image(C); SpaceImage *sima= CTX_wm_space_image(C); @@ -1347,7 +1347,7 @@ static int pack_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int pack_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int pack_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Image *ima= CTX_data_edit_image(C); ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL); @@ -1507,7 +1507,7 @@ static int unpack_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int unpack_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int unpack_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Image *ima= CTX_data_edit_image(C); @@ -1570,7 +1570,7 @@ typedef struct ImageSampleInfo { int draw; } ImageSampleInfo; -static void sample_draw(const bContext *C, ARegion *ar, void *arg_info) +static void sample_draw(const bContext *UNUSED(C), ARegion *ar, void *arg_info) { ImageSampleInfo *info= arg_info; @@ -1985,7 +1985,7 @@ static int record_composite_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int record_composite_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int record_composite_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { RecordCompositeData *rcd= op->customdata; @@ -2052,7 +2052,7 @@ static int cycle_render_slot_poll(bContext *C) return (ima && ima->type == IMA_TYPE_R_RESULT); } -static int cycle_render_slot_exec(bContext *C, wmOperator *op) +static int cycle_render_slot_exec(bContext *C, wmOperator *UNUSED(op)) { Image *ima= CTX_data_edit_image(C); int a, slot, cur= ima->render_slot; diff --git a/source/blender/editors/space_image/image_render.c b/source/blender/editors/space_image/image_render.c index be9d60a5adb..5fa0a2de202 100644 --- a/source/blender/editors/space_image/image_render.c +++ b/source/blender/editors/space_image/image_render.c @@ -149,7 +149,7 @@ void imagewindow_toggle_render(bContext *C) } /* NOTE: called while render, so no malloc allowed! */ -static void imagewindow_renderinfo_cb(void *handle, RenderStats *rs) +static void imagewindow_renderinfo_cb(void *UNUSED(handle), RenderStats *UNUSED(rs)) { if(image_area) { // XXX BIF_make_render_text(rs); diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index 66e27993532..d77d153a324 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -369,7 +369,7 @@ ARegion *image_has_scope_region(ScrArea *sa) /* ******************** default callbacks for image space ***************** */ -static SpaceLink *image_new(const bContext *C) +static SpaceLink *image_new(const bContext *UNUSED(C)) { ARegion *ar; SpaceImage *simage; @@ -429,7 +429,7 @@ static void image_free(SpaceLink *sl) /* spacetype; init callback, add handlers */ -static void image_init(struct wmWindowManager *wm, ScrArea *sa) +static void image_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa) { ListBase *lb= WM_dropboxmap_find("Image", SPACE_IMAGE, 0); @@ -485,6 +485,7 @@ void image_operatortypes(void) void image_keymap(struct wmKeyConfig *keyconf) { wmKeyMap *keymap= WM_keymap_find(keyconf, "Image Generic", SPACE_IMAGE, 0); + wmKeyMapItem *kmi; WM_keymap_add_item(keymap, "IMAGE_OT_new", NKEY, KM_PRESS, KM_ALT, 0); WM_keymap_add_item(keymap, "IMAGE_OT_open", OKEY, KM_PRESS, KM_ALT, 0); @@ -524,10 +525,15 @@ void image_keymap(struct wmKeyConfig *keyconf) RNA_enum_set(WM_keymap_add_item(keymap, "IMAGE_OT_curves_point_set", ACTIONMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "point", 1); WM_keymap_add_item(keymap, "IMAGE_OT_toolbox", SPACEKEY, KM_PRESS, 0, 0); + + /* toggle editmode is handy to have while UV unwrapping */ + kmi= WM_keymap_add_item(keymap, "OBJECT_OT_mode_set", TABKEY, KM_PRESS, 0, 0); + RNA_enum_set(kmi->ptr, "mode", OB_MODE_EDIT); + RNA_boolean_set(kmi->ptr, "toggle", 1); } /* dropboxes */ -static int image_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) +static int image_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event)) { if(drag->type==WM_DRAG_PATH) if(ELEM3(drag->icon, 0, ICON_FILE_IMAGE, ICON_FILE_BLANK)) /* rule might not work? */ @@ -551,7 +557,7 @@ static void image_dropboxes(void) -static void image_refresh(const bContext *C, ScrArea *sa) +static void image_refresh(const bContext *C, ScrArea *UNUSED(sa)) { SpaceImage *sima= CTX_wm_space_image(C); Object *obedit= CTX_data_edit_object(C); @@ -762,7 +768,7 @@ static void image_main_area_draw(const bContext *C, ARegion *ar) draw_image_main(sima, ar, scene); /* and uvs in 0.0-1.0 space */ - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); draw_uvedit_main(sima, ar, scene, obedit); ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW); @@ -878,7 +884,7 @@ static void image_scope_area_listener(ARegion *ar, wmNotifier *wmn) /************************* header region **************************/ /* add handlers, stuff you only do once or on area/region changes */ -static void image_header_area_init(wmWindowManager *wm, ARegion *ar) +static void image_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar) { ED_region_header_init(ar); } diff --git a/source/blender/editors/space_info/info_ops.c b/source/blender/editors/space_info/info_ops.c index 51767d3e006..aeb32cda6bd 100644 --- a/source/blender/editors/space_info/info_ops.c +++ b/source/blender/editors/space_info/info_ops.c @@ -73,7 +73,7 @@ static int pack_all_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int pack_all_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int pack_all_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Main *bmain= CTX_data_main(C); Image *ima; @@ -133,7 +133,7 @@ static int unpack_all_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int unpack_all_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int unpack_all_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Main *bmain= CTX_data_main(C); uiPopupMenu *pup; @@ -184,14 +184,14 @@ void FILE_OT_unpack_all(wmOperatorType *ot) /********************* make paths relative operator *********************/ -static int make_paths_relative_exec(bContext *C, wmOperator *op) +static int make_paths_relative_exec(bContext *UNUSED(C), wmOperator *op) { if(!G.relbase_valid) { BKE_report(op->reports, RPT_WARNING, "Can't set relative paths with an unsaved blend file."); return OPERATOR_CANCELLED; } - makeFilesRelative(G.sce, op->reports); + makeFilesRelative(G.main->name, op->reports); return OPERATOR_FINISHED; } @@ -211,14 +211,14 @@ void FILE_OT_make_paths_relative(wmOperatorType *ot) /********************* make paths absolute operator *********************/ -static int make_paths_absolute_exec(bContext *C, wmOperator *op) +static int make_paths_absolute_exec(bContext *UNUSED(C), wmOperator *op) { if(!G.relbase_valid) { BKE_report(op->reports, RPT_WARNING, "Can't set absolute paths with an unsaved blend file."); return OPERATOR_CANCELLED; } - makeFilesAbsolute(G.sce, op->reports); + makeFilesAbsolute(G.main->name, op->reports); return OPERATOR_FINISHED; } @@ -237,14 +237,14 @@ void FILE_OT_make_paths_absolute(wmOperatorType *ot) /********************* report missing files operator *********************/ -static int report_missing_files_exec(bContext *C, wmOperator *op) +static int report_missing_files_exec(bContext *UNUSED(C), wmOperator *op) { char txtname[24]; /* text block name */ txtname[0] = '\0'; /* run the missing file check */ - checkMissingFiles(G.sce, op->reports); + checkMissingFiles(G.main->name, op->reports); return OPERATOR_FINISHED; } @@ -264,18 +264,18 @@ void FILE_OT_report_missing_files(wmOperatorType *ot) /********************* find missing files operator *********************/ -static int find_missing_files_exec(bContext *C, wmOperator *op) +static int find_missing_files_exec(bContext *UNUSED(C), wmOperator *op) { char *path; path= RNA_string_get_alloc(op->ptr, "filepath", NULL, 0); - findMissingFiles(path, G.sce); + findMissingFiles(path, G.main->name); MEM_freeN(path); return OPERATOR_FINISHED; } -static int find_missing_files_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int find_missing_files_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { /* XXX file open button text "Find Missing Files" */ WM_event_add_fileselect(C, op); @@ -313,7 +313,7 @@ void FILE_OT_find_missing_files(wmOperatorType *ot) #define ERROR_TIMEOUT 10.0 #define ERROR_COLOR_TIMEOUT 6.0 #define COLLAPSE_TIMEOUT 0.2 -static int update_reports_display_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int update_reports_display_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event) { wmWindowManager *wm= CTX_wm_manager(C); ReportList *reports= CTX_wm_reports(C); diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c index b47c8e8d189..5173621d9c1 100644 --- a/source/blender/editors/space_info/space_info.c +++ b/source/blender/editors/space_info/space_info.c @@ -55,7 +55,7 @@ /* ******************** default callbacks for info space ***************** */ -static SpaceLink *info_new(const bContext *C) +static SpaceLink *info_new(const bContext *UNUSED(C)) { ARegion *ar; SpaceInfo *sinfo; @@ -80,7 +80,7 @@ static SpaceLink *info_new(const bContext *C) } /* not spacelink itself */ -static void info_free(SpaceLink *sl) +static void info_free(SpaceLink *UNUSED(sl)) { // SpaceInfo *sinfo= (SpaceInfo*) sl; @@ -88,7 +88,7 @@ static void info_free(SpaceLink *sl) /* spacetype; init callback */ -static void info_init(struct wmWindowManager *wm, ScrArea *sa) +static void info_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa)) { } @@ -105,11 +105,11 @@ static SpaceLink *info_duplicate(SpaceLink *sl) /* add handlers, stuff you only do once or on area/region changes */ -static void info_main_area_init(wmWindowManager *wm, ARegion *ar) +static void info_main_area_init(wmWindowManager *UNUSED(wm), ARegion *UNUSED(ar)) { } -static void info_main_area_draw(const bContext *C, ARegion *ar) +static void info_main_area_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar)) { /* clear and setup matrix */ @@ -137,7 +137,7 @@ void info_keymap(struct wmKeyConfig *keyconf) } /* add handlers, stuff you only do once or on area/region changes */ -static void info_header_area_init(wmWindowManager *wm, ARegion *ar) +static void info_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar) { ED_region_header_init(ar); } @@ -147,7 +147,7 @@ static void info_header_area_draw(const bContext *C, ARegion *ar) ED_region_header(C, ar); } -static void info_main_area_listener(ARegion *ar, wmNotifier *wmn) +static void info_main_area_listener(ARegion *UNUSED(ar), wmNotifier *UNUSED(wmn)) { /* context changes */ } @@ -179,7 +179,7 @@ static void info_header_listener(ARegion *ar, wmNotifier *wmn) } -static void recent_files_menu(const bContext *C, Menu *menu) +static void recent_files_menu_draw(const bContext *UNUSED(C), Menu *menu) { struct RecentFile *recent; uiLayout *layout= menu->layout; @@ -200,7 +200,7 @@ void recent_files_menu_register() mt= MEM_callocN(sizeof(MenuType), "spacetype info menu recent files"); strcpy(mt->idname, "INFO_MT_file_open_recent"); strcpy(mt->label, "Open Recent..."); - mt->draw= recent_files_menu; + mt->draw= recent_files_menu_draw; WM_menutype_add(mt); } diff --git a/source/blender/editors/space_logic/logic_buttons.c b/source/blender/editors/space_logic/logic_buttons.c index d8dfd8cb52d..e41627ad0a4 100644 --- a/source/blender/editors/space_logic/logic_buttons.c +++ b/source/blender/editors/space_logic/logic_buttons.c @@ -83,7 +83,7 @@ static void logic_panel_view_properties(const bContext *C, Panel *pa) } #endif -void logic_buttons_register(ARegionType *art) +void logic_buttons_register(ARegionType *UNUSED(art)) { #if 0 PanelType *pt; @@ -103,7 +103,7 @@ void logic_buttons_register(ARegionType *art) } -static int logic_properties(bContext *C, wmOperator *op) +static int logic_properties(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); ARegion *ar= logic_has_buttons_region(sa); diff --git a/source/blender/editors/space_logic/logic_ops.c b/source/blender/editors/space_logic/logic_ops.c index 4641fd2ce61..5c498a59884 100644 --- a/source/blender/editors/space_logic/logic_ops.c +++ b/source/blender/editors/space_logic/logic_ops.c @@ -238,7 +238,7 @@ static int sensor_remove_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } - static int sensor_remove_invoke(bContext *C, wmOperator *op, wmEvent *event) + static int sensor_remove_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_sensor_invoke_properties(C, op)) return sensor_remove_exec(C, op); @@ -341,7 +341,7 @@ static int controller_remove_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } - static int controller_remove_invoke(bContext *C, wmOperator *op, wmEvent *event) + static int controller_remove_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_controller_invoke_properties(C, op)) return controller_remove_exec(C, op); @@ -455,7 +455,7 @@ static int actuator_remove_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int actuator_remove_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int actuator_remove_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_actuator_invoke_properties(C, op)) return actuator_remove_exec(C, op); @@ -562,7 +562,7 @@ static int sensor_move_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int sensor_move_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int sensor_move_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_sensor_invoke_properties(C, op)) { return sensor_move_exec(C, op); @@ -607,7 +607,7 @@ static int controller_move_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int controller_move_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int controller_move_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_controller_invoke_properties(C, op)) { return controller_move_exec(C, op); @@ -652,7 +652,7 @@ static int actuator_move_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int actuator_move_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int actuator_move_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_actuator_invoke_properties(C, op)) { return actuator_move_exec(C, op); diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c index 148bcf1459f..c8d6e960132 100644 --- a/source/blender/editors/space_logic/logic_window.c +++ b/source/blender/editors/space_logic/logic_window.c @@ -182,7 +182,7 @@ void make_unique_prop_names(bContext *C, char *str) MEM_freeN(names); } -static void make_unique_prop_names_cb(bContext *C, void *strv, void *redraw_view3d_flagv) +static void make_unique_prop_names_cb(bContext *C, void *strv, void *UNUSED(redraw_view3d_flagv)) { char *str= strv; // int redraw_view3d_flag= GET_INT_FROM_POINTER(redraw_view3d_flagv); @@ -354,7 +354,7 @@ static void old_sca_move_actuator(bContext *C, void *datav, void *move_up) } } -void do_logic_buts(bContext *C, void *arg, int event) +void do_logic_buts(bContext *C, void *UNUSED(arg), int event) { Main *bmain= CTX_data_main(C); bSensor *sens; @@ -964,7 +964,7 @@ static void set_col_sensor(int type, int medium) } -static void verify_logicbutton_func(bContext *C, void *data1, void *data2) +static void verify_logicbutton_func(bContext *UNUSED(C), void *data1, void *data2) { bSensor *sens= (bSensor*)data1; @@ -1017,7 +1017,7 @@ static void test_scenepoin_but(struct bContext *C, char *name, ID **idpp) id_us_plus(*idpp); } -static void test_keyboard_event(struct bContext *C, void *arg_ks, void *arg_unused) +static void test_keyboard_event(struct bContext *UNUSED(C), void *arg_ks, void *UNUSED(arg)) { bKeyboardSensor *ks= (bKeyboardSensor*)arg_ks; @@ -1116,7 +1116,7 @@ static void check_armature_sensor(bContext *C, void *arg1_but, void *arg2_sens) check_armature_bone_constraint(ob, sens->posechannel, sens->constraint); } -static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short xco, short yco, short width,char* objectname) +static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short xco, short yco, short width) { bNearSensor *ns = NULL; bTouchSensor *ts = NULL; @@ -1734,7 +1734,7 @@ static void set_col_actuator(int item, int medium) } -static void change_object_actuator(bContext *C, void *act, void *arg) +static void change_object_actuator(bContext *UNUSED(C), void *act, void *UNUSED(arg)) { bObjectActuator *oa = act; @@ -1758,7 +1758,7 @@ static void change_object_actuator(bContext *C, void *act, void *arg) } } -static void change_ipo_actuator(bContext *C, void *arg1_but, void *arg2_ia) +static void change_ipo_actuator(bContext *UNUSED(C), void *arg1_but, void *arg2_ia) { bIpoActuator *ia = arg2_ia; uiBut *but = arg1_but; @@ -1770,7 +1770,7 @@ static void change_ipo_actuator(bContext *C, void *arg1_but, void *arg2_ia) but->retval = B_REDR; } -void update_object_actuator_PID(bContext *C, void *act, void *arg) +void update_object_actuator_PID(bContext *UNUSED(C), void *act, void *UNUSED(arg)) { bObjectActuator *oa = act; oa->forcerot[0] = 60.0f*oa->forcerot[1]; @@ -2920,7 +2920,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo return yco-4; } -static void do_sensor_menu(bContext *C, void *arg, int event) +static void do_sensor_menu(bContext *C, void *UNUSED(arg), int event) { SpaceLogic *slogic= CTX_wm_space_logic(C); ID **idar; @@ -2949,7 +2949,7 @@ static void do_sensor_menu(bContext *C, void *arg, int event) if(idar) MEM_freeN(idar); } -static uiBlock *sensor_menu(bContext *C, ARegion *ar, void *arg_unused) +static uiBlock *sensor_menu(bContext *C, ARegion *ar, void *UNUSED(arg)) { uiBlock *block; int yco=0; @@ -2969,7 +2969,7 @@ static uiBlock *sensor_menu(bContext *C, ARegion *ar, void *arg_unused) return block; } -static void do_controller_menu(bContext *C, void *arg, int event) +static void do_controller_menu(bContext *C, void *UNUSED(arg), int event) { SpaceLogic *slogic= CTX_wm_space_logic(C); ID **idar; @@ -2998,7 +2998,7 @@ static void do_controller_menu(bContext *C, void *arg, int event) if(idar) MEM_freeN(idar); } -static uiBlock *controller_menu(bContext *C, ARegion *ar, void *arg_unused) +static uiBlock *controller_menu(bContext *C, ARegion *ar, void *UNUSED(arg)) { uiBlock *block; int yco=0; @@ -3018,7 +3018,7 @@ static uiBlock *controller_menu(bContext *C, ARegion *ar, void *arg_unused) return block; } -static void do_actuator_menu(bContext *C, void *arg, int event) +static void do_actuator_menu(bContext *C, void *UNUSED(arg), int event) { SpaceLogic *slogic= CTX_wm_space_logic(C); ID **idar; @@ -3047,7 +3047,7 @@ static void do_actuator_menu(bContext *C, void *arg, int event) if(idar) MEM_freeN(idar); } -static uiBlock *actuator_menu(bContext *C, ARegion *ar, void *arg_unused) +static uiBlock *actuator_menu(bContext *C, ARegion *ar, void *UNUSED(arg)) { uiBlock *block; int xco=0; @@ -3069,7 +3069,7 @@ static uiBlock *actuator_menu(bContext *C, ARegion *ar, void *arg_unused) -static void check_controller_state_mask(bContext *C, void *arg1_but, void *arg2_mask) +static void check_controller_state_mask(bContext *UNUSED(C), void *arg1_but, void *arg2_mask) { unsigned int *cont_mask = arg2_mask; uiBut *but = arg1_but; @@ -3122,7 +3122,7 @@ static uiBlock *controller_state_mask_menu(bContext *C, ARegion *ar, void *arg_c return block; } -static void do_object_state_menu(bContext *C, void *arg, int event) +static void do_object_state_menu(bContext *UNUSED(C), void *arg, int event) { Object *ob = arg; @@ -3579,7 +3579,7 @@ static void draw_controller_python(uiLayout *layout, PointerRNA *ptr) } } -static void draw_controller_state(uiLayout *layout, PointerRNA *ptr) +static void draw_controller_state(uiLayout *UNUSED(layout), PointerRNA *UNUSED(ptr)) { } @@ -4955,7 +4955,7 @@ void logic_buttons(bContext *C, ARegion *ar) uiButSetFunc(but, make_unique_prop_names_cb, sens->name, (void*) 0); sens->otype= sens->type; - yco= draw_sensorbuttons(ob, sens, block, xco, yco, width,ob->id.name); + yco= draw_sensorbuttons(ob, sens, block, xco, yco, width); if(yco-6 < ycoo) ycoo= (yco+ycoo-20)/2; } else { diff --git a/source/blender/editors/space_logic/space_logic.c b/source/blender/editors/space_logic/space_logic.c index 01af324334b..9a3cac02c50 100644 --- a/source/blender/editors/space_logic/space_logic.c +++ b/source/blender/editors/space_logic/space_logic.c @@ -82,7 +82,7 @@ ARegion *logic_has_buttons_region(ScrArea *sa) /* ******************** default callbacks for image space ***************** */ -static SpaceLink *logic_new(const bContext *C) +static SpaceLink *logic_new(const bContext *UNUSED(C)) { ARegion *ar; SpaceLogic *slogic; @@ -145,7 +145,7 @@ static SpaceLink *logic_new(const bContext *C) } /* not spacelink itself */ -static void logic_free(SpaceLink *sl) +static void logic_free(SpaceLink *UNUSED(sl)) { // Spacelogic *slogic= (SpaceLogic*) sl; @@ -156,7 +156,7 @@ static void logic_free(SpaceLink *sl) /* spacetype; init callback */ -static void logic_init(struct wmWindowManager *wm, ScrArea *sa) +static void logic_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa)) { } @@ -183,7 +183,7 @@ void logic_keymap(struct wmKeyConfig *keyconf) WM_keymap_add_menu(keymap, "LOGIC_MT_logicbricks_add", AKEY, KM_PRESS, KM_SHIFT, 0); } -static void logic_refresh(const bContext *C, ScrArea *sa) +static void logic_refresh(const bContext *UNUSED(C), ScrArea *UNUSED(sa)) { // SpaceLogic *slogic= CTX_wm_space_logic(C); // Object *obedit= CTX_data_edit_object(C); @@ -217,11 +217,9 @@ static void logic_listener(ARegion *ar, wmNotifier *wmn) } } -static int logic_context(const bContext *C, const char *member, bContextDataResult *result) +static int logic_context(const bContext *UNUSED(C), const char *UNUSED(member), bContextDataResult *UNUSED(result)) { // SpaceLogic *slogic= CTX_wm_space_logic(C); - - return 0; } @@ -251,7 +249,7 @@ static void logic_main_area_draw(const bContext *C, ARegion *ar) UI_ThemeClearColor(TH_BACK); glClear(GL_COLOR_BUFFER_BIT); - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); logic_buttons((bContext *)C, ar); @@ -287,7 +285,7 @@ static void logic_buttons_area_draw(const bContext *C, ARegion *ar) /************************* header region **************************/ /* add handlers, stuff you only do once or on area/region changes */ -static void logic_header_area_init(wmWindowManager *wm, ARegion *ar) +static void logic_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar) { ED_region_header_init(ar); } diff --git a/source/blender/editors/space_nla/nla_buttons.c b/source/blender/editors/space_nla/nla_buttons.c index 2b394405155..72a970f83e5 100644 --- a/source/blender/editors/space_nla/nla_buttons.c +++ b/source/blender/editors/space_nla/nla_buttons.c @@ -66,7 +66,7 @@ /* -------------- */ -static void do_nla_region_buttons(bContext *C, void *arg, int event) +static void do_nla_region_buttons(bContext *C, void *UNUSED(arg), int event) { //Scene *scene= CTX_data_scene(C); @@ -173,25 +173,25 @@ static int nla_panel_poll(const bContext *C, PanelType *pt) } #endif -static int nla_animdata_panel_poll(const bContext *C, PanelType *pt) +static int nla_animdata_panel_poll(const bContext *C, PanelType *UNUSED(pt)) { PointerRNA ptr; return (nla_panel_context(C, &ptr, NULL, NULL) && (ptr.data != NULL)); } -static int nla_track_panel_poll(const bContext *C, PanelType *pt) +static int nla_track_panel_poll(const bContext *C, PanelType *UNUSED(pt)) { PointerRNA ptr; return (nla_panel_context(C, NULL, &ptr, NULL) && (ptr.data != NULL)); } -static int nla_strip_panel_poll(const bContext *C, PanelType *pt) +static int nla_strip_panel_poll(const bContext *C, PanelType *UNUSED(pt)) { PointerRNA ptr; return (nla_panel_context(C, NULL, NULL, &ptr) && (ptr.data != NULL)); } -static int nla_strip_actclip_panel_poll(const bContext *C, PanelType *pt) +static int nla_strip_actclip_panel_poll(const bContext *C, PanelType *UNUSED(pt)) { PointerRNA ptr; NlaStrip *strip; @@ -478,7 +478,7 @@ void nla_buttons_register(ARegionType *art) BLI_addtail(&art->paneltypes, pt); } -static int nla_properties(bContext *C, wmOperator *op) +static int nla_properties(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); ARegion *ar= nla_has_buttons_region(sa); diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c index d60551dac2e..ca2e3e6b6d5 100644 --- a/source/blender/editors/space_nla/nla_channels.c +++ b/source/blender/editors/space_nla/nla_channels.c @@ -434,7 +434,7 @@ void NLA_OT_tracks_add (wmOperatorType *ot) /* ******************** Delete Tracks Operator ***************************** */ /* Delete selected NLA Tracks */ -static int nlaedit_delete_tracks_exec (bContext *C, wmOperator *op) +static int nlaedit_delete_tracks_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c index ef9c46c8042..98550b7e452 100644 --- a/source/blender/editors/space_nla/nla_draw.c +++ b/source/blender/editors/space_nla/nla_draw.c @@ -219,7 +219,7 @@ static void nla_strip_get_color_inside (AnimData *adt, NlaStrip *strip, float co } /* helper call for drawing influence/time control curves for a given NLA-strip */ -static void nla_draw_strip_curves (NlaStrip *strip, View2D *v2d, float yminc, float ymaxc) +static void nla_draw_strip_curves (NlaStrip *strip, float yminc, float ymaxc) { const float yheight = ymaxc - yminc; @@ -280,7 +280,7 @@ static void nla_draw_strip_curves (NlaStrip *strip, View2D *v2d, float yminc, fl } /* main call for drawing a single NLA-strip */ -static void nla_draw_strip (SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStrip *strip, View2D *v2d, float yminc, float ymaxc) +static void nla_draw_strip (SpaceNla *snla, AnimData *adt, NlaTrack *UNUSED(nlt), NlaStrip *strip, View2D *v2d, float yminc, float ymaxc) { float color[3]; @@ -351,7 +351,7 @@ static void nla_draw_strip (SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStr * - only if user hasn't hidden them... */ if ((snla->flag & SNLA_NOSTRIPCURVES) == 0) - nla_draw_strip_curves(strip, v2d, yminc, ymaxc); + nla_draw_strip_curves(strip, yminc, ymaxc); /* draw strip outline * - color used here is to indicate active vs non-active @@ -414,7 +414,7 @@ static void nla_draw_strip (SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStr } /* add the relevant text to the cache of text-strings to draw in pixelspace */ -static void nla_draw_strip_text (NlaTrack *nlt, NlaStrip *strip, int index, View2D *v2d, float yminc, float ymaxc) +static void nla_draw_strip_text (NlaTrack *UNUSED(nlt), NlaStrip *strip, int UNUSED(index), View2D *v2d, float yminc, float ymaxc) { char str[256], dir[3]; rctf rect; @@ -477,8 +477,6 @@ void draw_nla_main_data (bAnimContext *ac, SpaceNla *snla, ARegion *ar) * (NOTE: this is ok here, the configuration is pretty straightforward) */ v2d->tot.ymin= (float)(-height); - /* need to do a view-sync here, so that the strips area doesn't jump around */ - UI_view2d_sync(NULL, ac->sa, v2d, V2D_VIEWSYNC_AREA_VERTICAL); /* loop through channels, and set up drawing depending on their type */ y= (float)(-NLACHANNEL_HEIGHT); @@ -812,7 +810,7 @@ static void draw_nla_channel_list_gl (bAnimContext *ac, ListBase *anim_data, Vie } } -void draw_nla_channel_list (bContext *C, bAnimContext *ac, SpaceNla *snla, ARegion *ar) +void draw_nla_channel_list (bContext *C, bAnimContext *ac, ARegion *ar) { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; @@ -837,6 +835,8 @@ void draw_nla_channel_list (bContext *C, bAnimContext *ac, SpaceNla *snla, ARegi * (NOTE: this is ok here, the configuration is pretty straightforward) */ v2d->tot.ymin= (float)(-height); + /* need to do a view-sync here, so that the keys area doesn't jump around (it must copy this) */ + UI_view2d_sync(NULL, ac->sa, v2d, V2D_LOCK_COPY); /* draw channels */ { /* first pass: backdrops + oldstyle drawing */ diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c index 247987cda9f..e13a229fdd1 100644 --- a/source/blender/editors/space_nla/nla_edit.c +++ b/source/blender/editors/space_nla/nla_edit.c @@ -457,7 +457,7 @@ void NLA_OT_transition_add (wmOperatorType *ot) /* Add new meta-strips incorporating the selected strips */ /* add the specified action as new strip */ -static int nlaedit_add_meta_exec (bContext *C, wmOperator *op) +static int nlaedit_add_meta_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -518,7 +518,7 @@ void NLA_OT_meta_add (wmOperatorType *ot) /* ******************** Remove Meta-Strip Operator ***************************** */ /* Separate out the strips held by the selected meta-strips */ -static int nlaedit_remove_meta_exec (bContext *C, wmOperator *op) +static int nlaedit_remove_meta_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -572,7 +572,7 @@ void NLA_OT_meta_remove (wmOperatorType *ot) * the originals were housed in. */ -static int nlaedit_duplicate_exec (bContext *C, wmOperator *op) +static int nlaedit_duplicate_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -645,7 +645,7 @@ static int nlaedit_duplicate_exec (bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } -static int nlaedit_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int nlaedit_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { nlaedit_duplicate_exec(C, op); @@ -677,7 +677,7 @@ void NLA_OT_duplicate (wmOperatorType *ot) /* ******************** Delete Strips Operator ***************************** */ /* Deletes the selected NLA-Strips */ -static int nlaedit_delete_exec (bContext *C, wmOperator *op) +static int nlaedit_delete_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -810,7 +810,7 @@ static void nlaedit_split_strip_actclip (AnimData *adt, NlaTrack *nlt, NlaStrip } /* split a given Meta strip */ -static void nlaedit_split_strip_meta (AnimData *adt, NlaTrack *nlt, NlaStrip *strip) +static void nlaedit_split_strip_meta (NlaTrack *nlt, NlaStrip *strip) { /* simply ungroup it for now... */ BKE_nlastrips_clear_metastrip(&nlt->strips, strip); @@ -818,7 +818,7 @@ static void nlaedit_split_strip_meta (AnimData *adt, NlaTrack *nlt, NlaStrip *st /* ----- */ -static int nlaedit_split_exec (bContext *C, wmOperator *op) +static int nlaedit_split_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -852,7 +852,7 @@ static int nlaedit_split_exec (bContext *C, wmOperator *op) break; case NLASTRIP_TYPE_META: /* meta-strips need special handling */ - nlaedit_split_strip_meta(adt, nlt, strip); + nlaedit_split_strip_meta(nlt, strip); break; default: /* for things like Transitions, do not split! */ @@ -893,7 +893,7 @@ void NLA_OT_split (wmOperatorType *ot) /* ******************** Bake Strips Operator ***************************** */ /* Bakes the NLA Strips for the active AnimData blocks */ -static int nlaedit_bake_exec (bContext *C, wmOperator *op) +static int nlaedit_bake_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -949,7 +949,7 @@ void NLA_OT_bake (wmOperatorType *ot) /* ******************** Toggle Muting Operator ************************** */ /* Toggles whether strips are muted or not */ -static int nlaedit_toggle_mute_exec (bContext *C, wmOperator *op) +static int nlaedit_toggle_mute_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -1008,7 +1008,7 @@ void NLA_OT_mute_toggle (wmOperatorType *ot) /* ******************** Move Strips Up Operator ************************** */ /* Tries to move the selected strips into the track above if possible. */ -static int nlaedit_move_up_exec (bContext *C, wmOperator *op) +static int nlaedit_move_up_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -1082,7 +1082,7 @@ void NLA_OT_move_up (wmOperatorType *ot) /* ******************** Move Strips Down Operator ************************** */ /* Tries to move the selected strips into the track above if possible. */ -static int nlaedit_move_down_exec (bContext *C, wmOperator *op) +static int nlaedit_move_down_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -1250,7 +1250,7 @@ static short bezt_apply_nlamapping (KeyframeEditData *ked, BezTriple *bezt) return 0; } -static int nlaedit_apply_scale_exec (bContext *C, wmOperator *op) +static int nlaedit_apply_scale_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -1333,7 +1333,7 @@ void NLA_OT_apply_scale (wmOperatorType *ot) /* ******************** Clear Scale Operator ***************************** */ /* Reset the scaling of the selected strips to 1.0f */ -static int nlaedit_clear_scale_exec (bContext *C, wmOperator *op) +static int nlaedit_clear_scale_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -1544,7 +1544,7 @@ void NLA_OT_snap (wmOperatorType *ot) /* ******************** Add F-Modifier Operator *********************** */ /* present a special customised popup menu for this, with some filtering */ -static int nla_fmodifier_add_invoke (bContext *C, wmOperator *op, wmEvent *event) +static int nla_fmodifier_add_invoke (bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event)) { uiPopupMenu *pup; uiLayout *layout; diff --git a/source/blender/editors/space_nla/nla_intern.h b/source/blender/editors/space_nla/nla_intern.h index 7570969158b..6906a151936 100644 --- a/source/blender/editors/space_nla/nla_intern.h +++ b/source/blender/editors/space_nla/nla_intern.h @@ -45,7 +45,7 @@ void NLA_OT_properties(wmOperatorType *ot); /* nla_draw.c */ void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *ar); -void draw_nla_channel_list(bContext *C, bAnimContext *ac, SpaceNla *snla, ARegion *ar); +void draw_nla_channel_list(bContext *C, bAnimContext *ac, ARegion *ar); /* **************************************** */ /* nla_header.c */ diff --git a/source/blender/editors/space_nla/nla_ops.c b/source/blender/editors/space_nla/nla_ops.c index 85a169f2bb0..13380cd17f7 100644 --- a/source/blender/editors/space_nla/nla_ops.c +++ b/source/blender/editors/space_nla/nla_ops.c @@ -156,7 +156,7 @@ void nla_operatortypes(void) /* ************************** registration - keymaps **********************************/ -static void nla_keymap_channels (wmKeyConfig *keyconf, wmKeyMap *keymap) +static void nla_keymap_channels(wmKeyMap *keymap) { /* NLA-specific (different to standard channels keymap) -------------------------- */ /* selection */ @@ -287,7 +287,7 @@ void nla_keymap(wmKeyConfig *keyconf) * However, those operations which involve clicking on channels and/or the placement of them in the view are implemented here instead */ keymap= WM_keymap_find(keyconf, "NLA Channels", SPACE_NLA, 0); - nla_keymap_channels(keyconf, keymap); + nla_keymap_channels(keymap); /* data */ keymap= WM_keymap_find(keyconf, "NLA Editor", SPACE_NLA, 0); diff --git a/source/blender/editors/space_nla/space_nla.c b/source/blender/editors/space_nla/space_nla.c index 92c5ef6c410..25c53687597 100644 --- a/source/blender/editors/space_nla/space_nla.c +++ b/source/blender/editors/space_nla/space_nla.c @@ -148,16 +148,17 @@ static SpaceLink *nla_new(const bContext *C) ar->v2d.cur = ar->v2d.tot; ar->v2d.min[0]= 0.0f; - ar->v2d.min[1]= 0.0f; + ar->v2d.min[1]= 0.0f; ar->v2d.max[0]= MAXFRAMEF; - ar->v2d.max[1]= 10000.0f; + ar->v2d.max[1]= 10000.0f; ar->v2d.minzoom= 0.01f; ar->v2d.maxzoom= 50; ar->v2d.scroll = (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL); ar->v2d.scroll |= (V2D_SCROLL_RIGHT); ar->v2d.keepzoom= V2D_LOCKZOOM_Y; + ar->v2d.keepofs= V2D_KEEPOFS_Y; ar->v2d.align= V2D_ALIGN_NO_POS_Y; ar->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL; @@ -177,7 +178,7 @@ static void nla_free(SpaceLink *sl) /* spacetype; init callback */ -static void nla_init(struct wmWindowManager *wm, ScrArea *sa) +static void nla_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa) { SpaceNla *snla= (SpaceNla *)sa->spacedata.first; @@ -218,7 +219,6 @@ static void nla_channel_area_init(wmWindowManager *wm, ARegion *ar) /* draw entirely, view changes should be handled here */ static void nla_channel_area_draw(const bContext *C, ARegion *ar) { - SpaceNla *snla= CTX_wm_space_nla(C); bAnimContext ac; View2D *v2d= &ar->v2d; View2DScrollers *scrollers; @@ -227,11 +227,11 @@ static void nla_channel_area_draw(const bContext *C, ARegion *ar) UI_ThemeClearColor(TH_BACK); glClear(GL_COLOR_BUFFER_BIT); - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); /* data */ if (ANIM_animdata_get_context(C, &ac)) { - draw_nla_channel_list((bContext *)C, &ac, snla, ar); + draw_nla_channel_list((bContext *)C, &ac, ar); } /* reset view matrix */ @@ -272,12 +272,12 @@ static void nla_main_area_draw(const bContext *C, ARegion *ar) UI_ThemeClearColor(TH_BACK); glClear(GL_COLOR_BUFFER_BIT); - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); /* time grid */ unit= (snla->flag & SNLA_DRAWTIME)? V2D_UNIT_SECONDS : V2D_UNIT_FRAMES; - grid= UI_view2d_grid_calc(C, v2d, unit, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY, ar->winx, ar->winy); - UI_view2d_grid_draw(C, v2d, grid, V2D_GRIDLINES_ALL); + grid= UI_view2d_grid_calc(CTX_data_scene(C), v2d, unit, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY, ar->winx, ar->winy); + UI_view2d_grid_draw(v2d, grid, V2D_GRIDLINES_ALL); UI_view2d_grid_free(grid); /* data */ @@ -289,7 +289,7 @@ static void nla_main_area_draw(const bContext *C, ARegion *ar) UI_view2d_text_cache_draw(ar); } - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); /* current frame */ if (snla->flag & SNLA_DRAWTIME) flag |= DRAWCFRA_UNIT_SECONDS; @@ -297,11 +297,11 @@ static void nla_main_area_draw(const bContext *C, ARegion *ar) ANIM_draw_cfra(C, v2d, flag); /* markers */ - UI_view2d_view_orthoSpecial(C, v2d, 1); + UI_view2d_view_orthoSpecial(ar, v2d, 1); draw_markers_time(C, 0); /* preview range */ - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); ANIM_draw_previewrange(C, v2d); /* reset view matrix */ @@ -315,7 +315,7 @@ static void nla_main_area_draw(const bContext *C, ARegion *ar) /* add handlers, stuff you only do once or on area/region changes */ -static void nla_header_area_init(wmWindowManager *wm, ARegion *ar) +static void nla_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar) { ED_region_header_init(ar); } diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index 5e0926da216..78ae82c57b0 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -77,7 +77,7 @@ void node_buts_group(uiLayout *layout, bContext *C, PointerRNA *ptr) uiTemplateIDBrowse(layout, C, ptr, "node_tree", NULL, NULL, ""); } -static void node_buts_value(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_buts_value(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { PointerRNA sockptr; PropertyRNA *prop; @@ -89,7 +89,7 @@ static void node_buts_value(uiLayout *layout, bContext *C, PointerRNA *ptr) uiItemR(layout, &sockptr, "default_value", 0, "", 0); } -static void node_buts_rgb(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_buts_rgb(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; PointerRNA sockptr; @@ -104,7 +104,7 @@ static void node_buts_rgb(uiLayout *layout, bContext *C, PointerRNA *ptr) uiItemR(col, &sockptr, "default_value", 0, "", 0); } -static void node_buts_mix_rgb(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_buts_mix_rgb(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *row; @@ -116,7 +116,7 @@ static void node_buts_mix_rgb(uiLayout *layout, bContext *C, PointerRNA *ptr) uiItemR(row, ptr, "use_alpha", 0, "", ICON_IMAGE_RGB_ALPHA); } -static void node_buts_time(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_buts_time(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *row; #if 0 @@ -138,12 +138,12 @@ static void node_buts_time(uiLayout *layout, bContext *C, PointerRNA *ptr) uiItemR(row, ptr, "frame_end", 0, "End", 0); } -static void node_buts_colorramp(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_buts_colorramp(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiTemplateColorRamp(layout, ptr, "color_ramp", 0); } -static void node_buts_curvevec(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_buts_curvevec(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiTemplateCurveMapping(layout, ptr, "mapping", 'v', 0, 0); } @@ -154,7 +154,7 @@ void node_curvemap_sample(float *col) _sample_col= col; } -static void node_buts_curvecol(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_buts_curvecol(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { bNode *node= ptr->data; CurveMapping *cumap= node->storage; @@ -169,7 +169,7 @@ static void node_buts_curvecol(uiLayout *layout, bContext *C, PointerRNA *ptr) uiTemplateCurveMapping(layout, ptr, "mapping", 'c', 0, 0); } -static void node_buts_normal(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_buts_normal(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiBlock *block= uiLayoutAbsoluteBlock(layout); bNode *node= ptr->data; @@ -212,7 +212,7 @@ static void node_browse_tex_cb(bContext *C, void *ntree_v, void *node_v) node->menunr= 0; } #endif -static void node_dynamic_update_cb(bContext *C, void *ntree_v, void *node_v) +static void node_dynamic_update_cb(bContext *C, void *UNUSED(ntree_v), void *node_v) { Main *bmain= CTX_data_main(C); Material *ma; @@ -244,7 +244,7 @@ static void node_dynamic_update_cb(bContext *C, void *ntree_v, void *node_v) // XXX BIF_preview_changed(ID_MA); } -static void node_buts_texture(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_buts_texture(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { bNode *node= ptr->data; @@ -263,7 +263,7 @@ static void node_buts_texture(uiLayout *layout, bContext *C, PointerRNA *ptr) } } -static void node_buts_math(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_buts_math(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiItemR(layout, ptr, "operation", 0, "", 0); } @@ -312,7 +312,7 @@ static void node_shader_buts_material(uiLayout *layout, bContext *C, PointerRNA uiItemR(col, ptr, "invert_normal", 0, NULL, 0); } -static void node_shader_buts_mapping(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_shader_buts_mapping(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *row; @@ -338,7 +338,7 @@ static void node_shader_buts_mapping(uiLayout *layout, bContext *C, PointerRNA * } -static void node_shader_buts_vect_math(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_shader_buts_vect_math(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiItemR(layout, ptr, "operation", 0, "", 0); } @@ -524,7 +524,7 @@ static void node_composit_buts_renderlayers(uiLayout *layout, bContext *C, Point } -static void node_composit_buts_blur(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_blur(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; @@ -548,7 +548,7 @@ static void node_composit_buts_blur(uiLayout *layout, bContext *C, PointerRNA *p } } -static void node_composit_buts_dblur(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_dblur(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; @@ -572,7 +572,7 @@ static void node_composit_buts_dblur(uiLayout *layout, bContext *C, PointerRNA * uiItemR(layout, ptr, "zoom", 0, NULL, 0); } -static void node_composit_buts_bilateralblur(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_bilateralblur(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; @@ -582,7 +582,7 @@ static void node_composit_buts_bilateralblur(uiLayout *layout, bContext *C, Poin uiItemR(col, ptr, "sigma_space", 0, NULL, 0); } -static void node_composit_buts_defocus(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_defocus(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *sub, *col; @@ -614,7 +614,7 @@ static void node_composit_buts_defocus(uiLayout *layout, bContext *C, PointerRNA } /* qdn: glare node */ -static void node_composit_buts_glare(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_glare(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiItemR(layout, ptr, "glare_type", 0, "", 0); uiItemR(layout, ptr, "quality", 0, "", 0); @@ -644,7 +644,7 @@ static void node_composit_buts_glare(uiLayout *layout, bContext *C, PointerRNA * } } -static void node_composit_buts_tonemap(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_tonemap(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; @@ -663,7 +663,7 @@ static void node_composit_buts_tonemap(uiLayout *layout, bContext *C, PointerRNA } } -static void node_composit_buts_lensdist(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_lensdist(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; @@ -676,7 +676,7 @@ static void node_composit_buts_lensdist(uiLayout *layout, bContext *C, PointerRN uiItemR(col, ptr, "use_fit", 0, NULL, 0); } -static void node_composit_buts_vecblur(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_vecblur(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; @@ -692,17 +692,17 @@ static void node_composit_buts_vecblur(uiLayout *layout, bContext *C, PointerRNA uiItemR(layout, ptr, "use_curved", 0, NULL, 0); } -static void node_composit_buts_filter(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_filter(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiItemR(layout, ptr, "filter_type", 0, "", 0); } -static void node_composit_buts_flip(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_flip(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiItemR(layout, ptr, "axis", 0, "", 0); } -static void node_composit_buts_crop(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_crop(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; @@ -723,7 +723,7 @@ static void node_composit_buts_crop(uiLayout *layout, bContext *C, PointerRNA *p } } -static void node_composit_buts_splitviewer(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_splitviewer(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *row, *col; @@ -733,7 +733,7 @@ static void node_composit_buts_splitviewer(uiLayout *layout, bContext *C, Pointe uiItemR(col, ptr, "factor", 0, NULL, 0); } -static void node_composit_buts_map_value(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_map_value(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *sub, *col; @@ -754,7 +754,7 @@ static void node_composit_buts_map_value(uiLayout *layout, bContext *C, PointerR uiItemR(sub, ptr, "max", 0, "", 0); } -static void node_composit_buts_alphaover(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_alphaover(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; @@ -763,7 +763,7 @@ static void node_composit_buts_alphaover(uiLayout *layout, bContext *C, PointerR uiItemR(col, ptr, "premul", 0, NULL, 0); } -static void node_composit_buts_hue_sat(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_hue_sat(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; @@ -773,12 +773,12 @@ static void node_composit_buts_hue_sat(uiLayout *layout, bContext *C, PointerRNA uiItemR(col, ptr, "color_value", UI_ITEM_R_SLIDER, NULL, 0); } -static void node_composit_buts_dilateerode(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_dilateerode(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiItemR(layout, ptr, "distance", 0, NULL, 0); } -static void node_composit_buts_diff_matte(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_diff_matte(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; @@ -787,7 +787,7 @@ static void node_composit_buts_diff_matte(uiLayout *layout, bContext *C, Pointer uiItemR(col, ptr, "falloff", UI_ITEM_R_SLIDER, NULL, 0); } -static void node_composit_buts_distance_matte(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_distance_matte(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; @@ -796,7 +796,7 @@ static void node_composit_buts_distance_matte(uiLayout *layout, bContext *C, Poi uiItemR(col, ptr, "falloff", UI_ITEM_R_SLIDER, NULL, 0); } -static void node_composit_buts_color_spill(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_color_spill(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *row, *col; @@ -822,7 +822,7 @@ static void node_composit_buts_color_spill(uiLayout *layout, bContext *C, Pointe } } -static void node_composit_buts_chroma_matte(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_chroma_matte(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; @@ -836,7 +836,7 @@ static void node_composit_buts_chroma_matte(uiLayout *layout, bContext *C, Point /*uiItemR(col, ptr, "shadow_adjust", UI_ITEM_R_SLIDER, NULL, 0); Removed for now*/ } -static void node_composit_buts_color_matte(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_color_matte(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; @@ -846,7 +846,7 @@ static void node_composit_buts_color_matte(uiLayout *layout, bContext *C, Pointe uiItemR(col, ptr, "color_value", UI_ITEM_R_SLIDER, NULL, 0); } -static void node_composit_buts_channel_matte(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_channel_matte(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col, *row; @@ -872,7 +872,7 @@ static void node_composit_buts_channel_matte(uiLayout *layout, bContext *C, Poin uiItemR(col, ptr, "limit_min", UI_ITEM_R_SLIDER, NULL, 0); } -static void node_composit_buts_luma_matte(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_luma_matte(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; @@ -881,17 +881,17 @@ static void node_composit_buts_luma_matte(uiLayout *layout, bContext *C, Pointer uiItemR(col, ptr, "limit_min", UI_ITEM_R_SLIDER, NULL, 0); } -static void node_composit_buts_map_uv(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_map_uv(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiItemR(layout, ptr, "alpha", 0, NULL, 0); } -static void node_composit_buts_id_mask(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_id_mask(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiItemR(layout, ptr, "index", 0, NULL, 0); } -static void node_composit_buts_file_output(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_file_output(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col, *row; @@ -916,17 +916,17 @@ static void node_composit_buts_file_output(uiLayout *layout, bContext *C, Pointe uiItemR(row, ptr, "frame_end", 0, "End", 0); } -static void node_composit_buts_scale(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_scale(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiItemR(layout, ptr, "space", 0, "", 0); } -static void node_composit_buts_rotate(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_rotate(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiItemR(layout, ptr, "filter_type", 0, "", 0); } -static void node_composit_buts_invert(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_invert(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; @@ -935,17 +935,17 @@ static void node_composit_buts_invert(uiLayout *layout, bContext *C, PointerRNA uiItemR(col, ptr, "invert_alpha", 0, NULL, 0); } -static void node_composit_buts_premulkey(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_premulkey(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiItemR(layout, ptr, "mapping", 0, "", 0); } -static void node_composit_buts_view_levels(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_view_levels(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiItemR(layout, ptr, "channel", UI_ITEM_R_EXPAND, NULL, 0); } -static void node_composit_buts_colorbalance(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_colorbalance(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *split, *col, *row; @@ -990,7 +990,7 @@ static void node_composit_buts_colorbalance(uiLayout *layout, bContext *C, Point } -static void node_composit_buts_huecorrect(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_huecorrect(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiTemplateCurveMapping(layout, ptr, "mapping", 'h', 0, 0); } @@ -1143,7 +1143,7 @@ static void node_composit_set_butfunc(bNodeType *ntype) /* ****************** BUTTON CALLBACKS FOR TEXTURE NODES ***************** */ -static void node_texture_buts_bricks(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_texture_buts_bricks(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; @@ -1156,7 +1156,7 @@ static void node_texture_buts_bricks(uiLayout *layout, bContext *C, PointerRNA * uiItemR(col, ptr, "squash_frequency", 0, "Frequency", 0); } -static void node_texture_buts_proc(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_texture_buts_proc(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { PointerRNA tex_ptr; bNode *node= ptr->data; @@ -1215,7 +1215,7 @@ static void node_texture_buts_image(uiLayout *layout, bContext *C, PointerRNA *p uiTemplateID(layout, C, ptr, "image", NULL, "IMAGE_OT_open", NULL); } -static void node_texture_buts_output(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_texture_buts_output(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiItemR(layout, ptr, "filepath", 0, "", 0); } diff --git a/source/blender/editors/space_node/node_buttons.c b/source/blender/editors/space_node/node_buttons.c index 11319d817c7..954018bfd4f 100644 --- a/source/blender/editors/space_node/node_buttons.c +++ b/source/blender/editors/space_node/node_buttons.c @@ -63,7 +63,7 @@ #define B_NOP 1 #define B_REDR 2 -static void do_node_region_buttons(bContext *C, void *arg, int event) +static void do_node_region_buttons(bContext *C, void *UNUSED(arg), int event) { //SpaceNode *snode= CTX_wm_space_node(C); @@ -75,7 +75,7 @@ static void do_node_region_buttons(bContext *C, void *arg, int event) } /* poll callback for active node */ -static int active_node_poll(const bContext *C, PanelType *pt) +static int active_node_poll(const bContext *C, PanelType *UNUSED(pt)) { SpaceNode *snode= CTX_wm_space_node(C); @@ -135,7 +135,7 @@ void node_buttons_register(ARegionType *art) BLI_addtail(&art->paneltypes, pt); } -static int node_properties(bContext *C, wmOperator *op) +static int node_properties(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); ARegion *ar= node_has_buttons_region(sa); diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index dfc63e032d9..a81d6e3b0ce 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -111,7 +111,7 @@ static int has_nodetree(bNodeTree *ntree, bNodeTree *lookup) return 0; } -void ED_node_generic_update(Main *bmain, Scene *scene, bNodeTree *ntree, bNode *node) +void ED_node_generic_update(Main *bmain, bNodeTree *ntree, bNode *node) { Material *ma; Tex *tex; @@ -309,7 +309,7 @@ static void node_update(const bContext *C, bNodeTree *ntree, bNode *node) } /* based on settings in node, sets drawing rect info. each redraw! */ -static void node_update_hidden(const bContext *C, bNode *node) +static void node_update_hidden(bNode *node) { bNodeSocket *nsock; float rad, drad, hiddenrad= HIDDEN_RAD; @@ -392,7 +392,7 @@ static void node_update_group(const bContext *C, bNodeTree *ntree, bNode *gnode) node->locy+= gnode->locy; if(node->flag & NODE_HIDDEN) - node_update_hidden(C, node); + node_update_hidden(node); else node_update(C, ntree, node); node->locx-= gnode->locx; @@ -483,7 +483,7 @@ static void node_draw_mute_line(View2D *v2d, SpaceNode *snode, bNode *node) /* nice AA filled circle */ /* this might have some more generic use */ -static void circle_draw(float x, float y, float size, int type, int col[3]) +static void circle_draw(float x, float y, float size, int col[3]) { /* 16 values of sin function */ static float si[16] = { @@ -538,11 +538,11 @@ static void socket_circle_draw(bNodeSocket *sock, float size) else { col[0]= 100; col[1]= 200; col[2]= 100; } - - circle_draw(sock->locx, sock->locy, size, sock->type, col); + + circle_draw(sock->locx, sock->locy, size, col); } -static void node_sync_cb(bContext *C, void *snode_v, void *node_v) +static void node_sync_cb(bContext *UNUSED(C), void *snode_v, void *node_v) { SpaceNode *snode= snode_v; @@ -1066,7 +1066,7 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d) UI_ThemeClearColor(TH_BACK); glClear(GL_COLOR_BUFFER_BIT); - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); //uiFreeBlocksWin(&sa->uiblocks, sa->win); @@ -1078,7 +1078,7 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d) snode->aspect= (v2d->cur.xmax - v2d->cur.xmin)/((float)ar->winx); // XXX snode->curfont= uiSetCurFont_ext(snode->aspect); - UI_view2d_constant_grid_draw(C, v2d); + UI_view2d_constant_grid_draw(v2d); /* backdrop */ draw_nodespace_back_pix(ar, snode, color_manage); @@ -1103,7 +1103,7 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d) if(node->flag & NODE_GROUP_EDIT) node_update_group(C, snode->nodetree, node); else if(node->flag & NODE_HIDDEN) - node_update_hidden(C, node); + node_update_hidden(node); else node_update(C, snode->nodetree, node); } diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index 968391f271e..b8bfed2b75e 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -98,7 +98,7 @@ static int compo_breakjob(void *cjv) } /* called by compo, wmJob sends notifier */ -static void compo_redrawjob(void *cjv, char *str) +static void compo_redrawjob(void *cjv, char *UNUSED(str)) { CompoJob *cj= cjv; @@ -541,7 +541,7 @@ void snode_make_group_editable(SpaceNode *snode, bNode *gnode) ntreeSolveOrder(snode->nodetree); } -static int node_group_edit_exec(bContext *C, wmOperator *op) +static int node_group_edit_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceNode *snode = CTX_wm_space_node(C); bNode *gnode; @@ -556,7 +556,7 @@ static int node_group_edit_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int node_group_edit_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int node_group_edit_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { SpaceNode *snode = CTX_wm_space_node(C); bNode *gnode; @@ -1100,7 +1100,7 @@ static void node_link_viewer(SpaceNode *snode, bNode *tonode) } -static int node_active_link_viewer(bContext *C, wmOperator *op) +static int node_active_link_viewer(bContext *C, wmOperator *UNUSED(op)) { SpaceNode *snode= CTX_wm_space_node(C); bNode *node; @@ -1472,12 +1472,21 @@ bNode *node_add_node(SpaceNode *snode, Scene *scene, int type, float locx, float /* ****************** Duplicate *********************** */ -static int node_duplicate_exec(bContext *C, wmOperator *op) +static int node_duplicate_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceNode *snode= CTX_wm_space_node(C); + bNode *node; ED_preview_kill_jobs(C); + /* simple id user adjustment, node internal functions dont touch this + * but operators and readfile.c do. */ + for(node= snode->edittree->nodes.first; node; node= node->next) { + if(node->flag & SELECT) { + id_us_plus(node->id); + } + } + ntreeCopyTree(snode->edittree, 1); /* 1 == internally selected nodes */ ntreeSolveOrder(snode->edittree); @@ -1851,7 +1860,7 @@ void NODE_OT_links_cut(wmOperatorType *ot) // XXX some code needing updating to operators... /* goes over all scenes, reads render layers */ -static int node_read_renderlayers_exec(bContext *C, wmOperator *op) +static int node_read_renderlayers_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); SpaceNode *snode= CTX_wm_space_node(C); @@ -1893,7 +1902,7 @@ void NODE_OT_read_renderlayers(wmOperatorType *ot) ot->flag= 0; } -static int node_read_fullsamplelayers_exec(bContext *C, wmOperator *op) +static int node_read_fullsamplelayers_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceNode *snode= CTX_wm_space_node(C); Scene *curscene= CTX_data_scene(C); @@ -2015,7 +2024,7 @@ static void node_flag_toggle_exec(SpaceNode *snode, int toggle_flag) } } -static int node_hide_exec(bContext *C, wmOperator *op) +static int node_hide_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceNode *snode= CTX_wm_space_node(C); @@ -2045,7 +2054,7 @@ void NODE_OT_hide_toggle(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int node_preview_exec(bContext *C, wmOperator *op) +static int node_preview_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceNode *snode= CTX_wm_space_node(C); @@ -2077,7 +2086,7 @@ void NODE_OT_preview_toggle(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int node_socket_toggle_exec(bContext *C, wmOperator *op) +static int node_socket_toggle_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceNode *snode= CTX_wm_space_node(C); bNode *node; @@ -2128,7 +2137,7 @@ void NODE_OT_hide_socket_toggle(wmOperatorType *ot) /* ****************** Mute operator *********************** */ -static int node_mute_exec(bContext *C, wmOperator *op) +static int node_mute_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceNode *snode= CTX_wm_space_node(C); bNode *node; @@ -2170,7 +2179,7 @@ void NODE_OT_mute_toggle(wmOperatorType *ot) /* ****************** Delete operator ******************* */ -static int node_delete_exec(bContext *C, wmOperator *op) +static int node_delete_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceNode *snode= CTX_wm_space_node(C); bNode *node, *next; @@ -2211,7 +2220,7 @@ void NODE_OT_delete(wmOperatorType *ot) /* ****************** Show Cyclic Dependencies Operator ******************* */ -static int node_show_cycles_exec(bContext *C, wmOperator *op) +static int node_show_cycles_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceNode *snode= CTX_wm_space_node(C); @@ -2255,7 +2264,7 @@ static int node_add_file_exec(bContext *C, wmOperator *op) errno= 0; - ima= BKE_add_image_file(path, scene ? scene->r.cfra : 1); + ima= BKE_add_image_file(path); if(!ima) { BKE_reportf(op->reports, RPT_ERROR, "Can't read: \"%s\", %s.", path, errno ? strerror(errno) : "Unsupported image format"); diff --git a/source/blender/editors/space_node/node_header.c b/source/blender/editors/space_node/node_header.c index 0711ef66497..64e4bc4cbc8 100644 --- a/source/blender/editors/space_node/node_header.c +++ b/source/blender/editors/space_node/node_header.c @@ -55,7 +55,7 @@ /* ************************ add menu *********************** */ -static void do_node_add(bContext *C, void *arg, int event) +static void do_node_add(bContext *C, void *UNUSED(arg), int event) { SpaceNode *snode= CTX_wm_space_node(C); bNode *node; @@ -202,7 +202,7 @@ static void node_menu_add(const bContext *C, Menu *menu) } } -void node_menus_register(ARegionType *art) +void node_menus_register(void) { MenuType *mt; diff --git a/source/blender/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h index 77fda0627e7..cba491deb01 100644 --- a/source/blender/editors/space_node/node_intern.h +++ b/source/blender/editors/space_node/node_intern.h @@ -41,7 +41,7 @@ ARegion *node_has_buttons_region(ScrArea *sa); /* node_header.c */ void node_header_buttons(const bContext *C, ARegion *ar); -void node_menus_register(struct ARegionType *art); +void node_menus_register(void); /* node_draw.c */ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d); diff --git a/source/blender/editors/space_node/node_select.c b/source/blender/editors/space_node/node_select.c index ec08cdf07ac..402e1b2d1cd 100644 --- a/source/blender/editors/space_node/node_select.c +++ b/source/blender/editors/space_node/node_select.c @@ -241,7 +241,7 @@ void NODE_OT_select_border(wmOperatorType *ot) /* ****** Select/Deselect All ****** */ -static int node_select_all_exec(bContext *C, wmOperator *op) +static int node_select_all_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceNode *snode = CTX_wm_space_node(C); bNode *first = snode->edittree->nodes.first; @@ -282,7 +282,7 @@ void NODE_OT_select_all(wmOperatorType *ot) /* ****** Select Linked To ****** */ -static int node_select_linked_to_exec(bContext *C, wmOperator *op) +static int node_select_linked_to_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceNode *snode = CTX_wm_space_node(C); bNodeLink *link; @@ -322,7 +322,7 @@ void NODE_OT_select_linked_to(wmOperatorType *ot) /* ****** Select Linked From ****** */ -static int node_select_linked_from_exec(bContext *C, wmOperator *op) +static int node_select_linked_from_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceNode *snode = CTX_wm_space_node(C); bNodeLink *link; @@ -362,7 +362,7 @@ void NODE_OT_select_linked_from(wmOperatorType *ot) /* ****** Select Same Type ****** */ -static int node_select_same_type_exec(bContext *C, wmOperator *op) +static int node_select_same_type_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceNode *snode = CTX_wm_space_node(C); @@ -388,7 +388,7 @@ void NODE_OT_select_same_type(wmOperatorType *ot) /* ****** Select The Next/Prev Node Of The Same Type ****** */ -static int node_select_same_type_next_exec(bContext *C, wmOperator *op) +static int node_select_same_type_next_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceNode *snode = CTX_wm_space_node(C); @@ -412,7 +412,7 @@ void NODE_OT_select_same_type_next(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; } -static int node_select_same_type_prev_exec(bContext *C, wmOperator *op) +static int node_select_same_type_prev_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceNode *snode = CTX_wm_space_node(C); diff --git a/source/blender/editors/space_node/node_state.c b/source/blender/editors/space_node/node_state.c index b4f09f960d6..48801d4369d 100644 --- a/source/blender/editors/space_node/node_state.c +++ b/source/blender/editors/space_node/node_state.c @@ -140,7 +140,7 @@ static int do_header_node(SpaceNode *snode, bNode *node, float mx, float my) return 0; } -static int do_header_hidden_node(SpaceNode *snode, bNode *node, float mx, float my) +static int do_header_hidden_node(bNode *node, float mx, float my) { rctf totr= node->totr; @@ -164,7 +164,7 @@ static int node_toggle_visibility(SpaceNode *snode, ARegion *ar, short *mval) for(next_node(snode->edittree); (node=next_node(NULL));) { if(node->flag & NODE_HIDDEN) { - if(do_header_hidden_node(snode, node, mx, my)) { + if(do_header_hidden_node(node, mx, my)) { ED_region_tag_redraw(ar); return 1; } @@ -227,7 +227,7 @@ void NODE_OT_visibility_toggle(wmOperatorType *ot) /* **************** View All Operator ************** */ -static void snode_home(ScrArea *sa, ARegion *ar, SpaceNode* snode) +static void snode_home(ScrArea *UNUSED(sa), ARegion *ar, SpaceNode* snode) { bNode *node; rctf *cur, *tot; @@ -278,7 +278,7 @@ static void snode_home(ScrArea *sa, ARegion *ar, SpaceNode* snode) UI_view2d_curRect_validate(&ar->v2d); } -static int node_view_all_exec(bContext *C, wmOperator *op) +static int node_view_all_exec(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); ARegion *ar= CTX_wm_region(C); diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c index c94fcb52e38..d38e2af734b 100644 --- a/source/blender/editors/space_node/space_node.c +++ b/source/blender/editors/space_node/space_node.c @@ -89,7 +89,7 @@ ARegion *node_has_buttons_region(ScrArea *sa) /* ******************** default callbacks for node space ***************** */ -static SpaceLink *node_new(const bContext *C) +static SpaceLink *node_new(const bContext *UNUSED(C)) { ARegion *ar; SpaceNode *snode; @@ -145,14 +145,14 @@ static SpaceLink *node_new(const bContext *C) } /* not spacelink itself */ -static void node_free(SpaceLink *sl) +static void node_free(SpaceLink *UNUSED(sl)) { } /* spacetype; init callback */ -static void node_init(struct wmWindowManager *wm, ScrArea *sa) +static void node_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa)) { } @@ -306,7 +306,7 @@ static void node_main_area_draw(const bContext *C, ARegion *ar) /* ************* dropboxes ************* */ -static int node_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) +static int node_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event)) { if(drag->type==WM_DRAG_ID) { ID *id= (ID *)drag->poin; @@ -345,7 +345,7 @@ static void node_dropboxes(void) /* add handlers, stuff you only do once or on area/region changes */ -static void node_header_area_init(wmWindowManager *wm, ARegion *ar) +static void node_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar) { ED_region_header_init(ar); } @@ -452,7 +452,7 @@ void ED_spacetype_node(void) BLI_addhead(&st->regiontypes, art); - node_menus_register(art); + node_menus_register(); /* regions: listview/buttons */ art= MEM_callocN(sizeof(ARegionType), "spacetype node region"); diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c index d80291e199b..60431f0e36d 100644 --- a/source/blender/editors/space_outliner/outliner.c +++ b/source/blender/editors/space_outliner/outliner.c @@ -120,7 +120,7 @@ /* ************* XXX **************** */ -static void error(const char *dummy, ...) {} +static void error(const char *UNUSED(arg), ...) {} /* ********************************** */ @@ -1556,7 +1556,7 @@ static void outliner_set_flag(SpaceOops *soops, ListBase *lb, short flag, short /* same check needed for both object operation and restrict column button func * return 0 when in edit mode (cannot restrict view or select) * otherwise return 1 */ -static int common_restrict_check(bContext *C, Scene *scene, Object *ob) +static int common_restrict_check(bContext *C, Object *ob) { /* Don't allow hide an object in edit mode, * check the bug #22153 and #21609, #23977 @@ -1575,13 +1575,13 @@ static int common_restrict_check(bContext *C, Scene *scene, Object *ob) return 1; } -void object_toggle_visibility_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem) +void object_toggle_visibility_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem) { Base *base= (Base *)te->directdata; Object *ob = (Object *)tselem->id; /* add check for edit mode */ - if(!common_restrict_check(C, scene, ob)) return; + if(!common_restrict_check(C, ob)) return; if(base || (base= object_in_scene(ob, scene))) { if((base->object->restrictflag ^= OB_RESTRICT_VIEW)) { @@ -1590,7 +1590,7 @@ void object_toggle_visibility_cb(bContext *C, Scene *scene, TreeElement *te, Tre } } -static int outliner_toggle_visibility_exec(bContext *C, wmOperator *op) +static int outliner_toggle_visibility_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceOops *soops= CTX_wm_space_outliner(C); Scene *scene= CTX_data_scene(C); @@ -1620,7 +1620,7 @@ void OUTLINER_OT_visibility_toggle(wmOperatorType *ot) /* --- */ -static void object_toggle_selectability_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem) +static void object_toggle_selectability_cb(bContext *UNUSED(C), Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem) { Base *base= (Base *)te->directdata; @@ -1630,7 +1630,7 @@ static void object_toggle_selectability_cb(bContext *C, Scene *scene, TreeElemen } } -static int outliner_toggle_selectability_exec(bContext *C, wmOperator *op) +static int outliner_toggle_selectability_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceOops *soops= CTX_wm_space_outliner(C); Scene *scene= CTX_data_scene(C); @@ -1658,7 +1658,7 @@ void OUTLINER_OT_selectability_toggle(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -void object_toggle_renderability_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem) +void object_toggle_renderability_cb(bContext *UNUSED(C), Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem) { Base *base= (Base *)te->directdata; @@ -1668,7 +1668,7 @@ void object_toggle_renderability_cb(bContext *C, Scene *scene, TreeElement *te, } } -static int outliner_toggle_renderability_exec(bContext *C, wmOperator *op) +static int outliner_toggle_renderability_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceOops *soops= CTX_wm_space_outliner(C); Scene *scene= CTX_data_scene(C); @@ -1697,7 +1697,7 @@ void OUTLINER_OT_renderability_toggle(wmOperatorType *ot) /* --- */ -static int outliner_toggle_expanded_exec(bContext *C, wmOperator *op) +static int outliner_toggle_expanded_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceOops *soops= CTX_wm_space_outliner(C); ARegion *ar= CTX_wm_region(C); @@ -1728,7 +1728,7 @@ void OUTLINER_OT_expanded_toggle(wmOperatorType *ot) /* --- */ -static int outliner_toggle_selected_exec(bContext *C, wmOperator *op) +static int outliner_toggle_selected_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceOops *soops= CTX_wm_space_outliner(C); ARegion *ar= CTX_wm_region(C); @@ -1820,6 +1820,8 @@ void OUTLINER_OT_show_one_level(wmOperatorType *ot) RNA_def_boolean(ot->srna, "open", 1, "Open", "Expand all entries one level deep."); } +/* This is not used anywhere at the moment */ +#if 0 /* return 1 when levels were opened */ static int outliner_open_back(SpaceOops *soops, TreeElement *te) { @@ -1836,8 +1838,6 @@ static int outliner_open_back(SpaceOops *soops, TreeElement *te) return retval; } -/* This is not used anywhere at the moment */ -#if 0 static void outliner_open_reveal(SpaceOops *soops, ListBase *lb, TreeElement *teFind, int *found) { TreeElement *te; @@ -1863,7 +1863,7 @@ static void outliner_open_reveal(SpaceOops *soops, ListBase *lb, TreeElement *te #endif // XXX just use View2D ops for this? -void outliner_page_up_down(Scene *scene, ARegion *ar, SpaceOops *soops, int up) +void outliner_page_up_down(Scene *UNUSED(scene), ARegion *ar, SpaceOops *soops, int up) { int dy= ar->v2d.mask.ymax-ar->v2d.mask.ymin; @@ -2056,7 +2056,7 @@ static int tree_element_active_texture(bContext *C, Scene *scene, SpaceOops *soo } -static int tree_element_active_lamp(bContext *C, Scene *scene, SpaceOops *soops, TreeElement *te, int set) +static int tree_element_active_lamp(bContext *UNUSED(C), Scene *scene, SpaceOops *soops, TreeElement *te, int set) { Object *ob; @@ -2204,7 +2204,7 @@ static int tree_element_active_bone(bContext *C, Scene *scene, TreeElement *te, /* ebones only draw in editmode armature */ -static int tree_element_active_ebone(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tselem, int set) +static int tree_element_active_ebone(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tselem), int set) { EditBone *ebone= te->directdata; @@ -2229,7 +2229,7 @@ static int tree_element_active_ebone(bContext *C, Scene *scene, TreeElement *te, return 0; } -static int tree_element_active_modifier(bContext *C, TreeElement *te, TreeStoreElem *tselem, int set) +static int tree_element_active_modifier(bContext *C, TreeElement *UNUSED(te), TreeStoreElem *tselem, int set) { if(set) { Object *ob= (Object *)tselem->id; @@ -2242,7 +2242,7 @@ static int tree_element_active_modifier(bContext *C, TreeElement *te, TreeStoreE return 0; } -static int tree_element_active_psys(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tselem, int set) +static int tree_element_active_psys(bContext *C, Scene *UNUSED(scene), TreeElement *UNUSED(te), TreeStoreElem *tselem, int set) { if(set) { Object *ob= (Object *)tselem->id; @@ -2255,7 +2255,7 @@ static int tree_element_active_psys(bContext *C, Scene *scene, TreeElement *te, return 0; } -static int tree_element_active_constraint(bContext *C, TreeElement *te, TreeStoreElem *tselem, int set) +static int tree_element_active_constraint(bContext *C, TreeElement *UNUSED(te), TreeStoreElem *tselem, int set) { if(set) { Object *ob= (Object *)tselem->id; @@ -2267,7 +2267,7 @@ static int tree_element_active_constraint(bContext *C, TreeElement *te, TreeStor return 0; } -static int tree_element_active_text(bContext *C, Scene *scene, SpaceOops *soops, TreeElement *te, int set) +static int tree_element_active_text(bContext *UNUSED(C), Scene *UNUSED(scene), SpaceOops *UNUSED(soops), TreeElement *UNUSED(te), int UNUSED(set)) { // XXX removed return 0; @@ -2292,7 +2292,7 @@ static int tree_element_active(bContext *C, Scene *scene, SpaceOops *soops, Tree return 0; } -static int tree_element_active_pose(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tselem, int set) +static int tree_element_active_pose(bContext *C, Scene *scene, TreeElement *UNUSED(te), TreeStoreElem *tselem, int set) { Object *ob= (Object *)tselem->id; Base *base= object_in_scene(ob, scene); @@ -2312,7 +2312,7 @@ static int tree_element_active_pose(bContext *C, Scene *scene, TreeElement *te, return 0; } -static int tree_element_active_sequence(bContext *C, TreeElement *te, TreeStoreElem *tselem, int set) +static int tree_element_active_sequence(TreeElement *te, TreeStoreElem *UNUSED(tselem), int set) { Sequence *seq= (Sequence*) te->directdata; @@ -2326,7 +2326,7 @@ static int tree_element_active_sequence(bContext *C, TreeElement *te, TreeStoreE return(0); } -static int tree_element_active_sequence_dup(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tselem, int set) +static int tree_element_active_sequence_dup(Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tselem), int set) { Sequence *seq, *p; Editing *ed= seq_give_editing(scene, FALSE); @@ -2353,7 +2353,7 @@ static int tree_element_active_sequence_dup(bContext *C, Scene *scene, TreeEleme return(0); } -static int tree_element_active_keymap_item(bContext *C, TreeElement *te, TreeStoreElem *tselem, int set) +static int tree_element_active_keymap_item(bContext *UNUSED(C), TreeElement *te, TreeStoreElem *UNUSED(tselem), int set) { wmKeyMapItem *kmi= te->directdata; @@ -2398,9 +2398,9 @@ static int tree_element_type_active(bContext *C, Scene *scene, SpaceOops *soops, case TSE_POSEGRP: return tree_element_active_posegroup(C, scene, te, tselem, set); case TSE_SEQUENCE: - return tree_element_active_sequence(C, te, tselem, set); + return tree_element_active_sequence(te, tselem, set); case TSE_SEQUENCE_DUP: - return tree_element_active_sequence_dup(C, scene, te, tselem, set); + return tree_element_active_sequence_dup(scene, te, tselem, set); case TSE_KEYMAP_ITEM: return tree_element_active_keymap_item(C, te, tselem, set); @@ -2660,7 +2660,7 @@ static int do_outliner_item_rename(bContext *C, ARegion *ar, SpaceOops *soops, T return 0; } -static int outliner_item_rename(bContext *C, wmOperator *op, wmEvent *event) +static int outliner_item_rename(bContext *C, wmOperator *UNUSED(op), wmEvent *event) { ARegion *ar= CTX_wm_region(C); SpaceOops *soops= CTX_wm_space_outliner(C); @@ -2687,39 +2687,6 @@ void OUTLINER_OT_item_rename(wmOperatorType *ot) ot->poll= ED_operator_outliner_active; } - - -/* recursive helper for function below */ -static void outliner_set_coordinates_element(SpaceOops *soops, TreeElement *te, int startx, int *starty) -{ - TreeStoreElem *tselem= TREESTORE(te); - - /* store coord and continue, we need coordinates for elements outside view too */ - te->xs= (float)startx; - te->ys= (float)(*starty); - *starty-= OL_H; - - if((tselem->flag & TSE_CLOSED)==0) { - TreeElement *ten; - for(ten= te->subtree.first; ten; ten= ten->next) { - outliner_set_coordinates_element(soops, ten, startx+OL_X, starty); - } - } - -} - -/* to retrieve coordinates with redrawing the entire tree */ -static void outliner_set_coordinates(ARegion *ar, SpaceOops *soops) -{ - TreeElement *te; - int starty= (int)(ar->v2d.tot.ymax)-OL_H; - int startx= 0; - - for(te= soops->tree.first; te; te= te->next) { - outliner_set_coordinates_element(soops, te, startx, &starty); - } -} - static TreeElement *outliner_find_id(SpaceOops *soops, ListBase *lb, ID *id) { TreeElement *te, *tes; @@ -2739,7 +2706,7 @@ static TreeElement *outliner_find_id(SpaceOops *soops, ListBase *lb, ID *id) return NULL; } -static int outliner_show_active_exec(bContext *C, wmOperator *op) +static int outliner_show_active_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceOops *so= CTX_wm_space_outliner(C); Scene *scene= CTX_data_scene(C); @@ -2789,6 +2756,66 @@ void OUTLINER_OT_show_active(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } +/* tse is not in the treestore, we use its contents to find a match */ +static TreeElement *outliner_find_tse(SpaceOops *soops, TreeStoreElem *tse) +{ + TreeStore *ts= soops->treestore; + TreeStoreElem *tselem; + int a; + + if(tse->id==NULL) return NULL; + + /* check if 'tse' is in treestore */ + tselem= ts->data; + for(a=0; a<ts->usedelem; a++, tselem++) { + if((tse->type==0 && tselem->type==0) || (tselem->type==tse->type && tselem->nr==tse->nr)) { + if(tselem->id==tse->id) { + break; + } + } + } + if(tselem) + return outliner_find_tree_element(&soops->tree, a); + + return NULL; +} + + +/* Called to find an item based on name. + */ +#if 0 + +/* recursive helper for function below */ +static void outliner_set_coordinates_element(SpaceOops *soops, TreeElement *te, int startx, int *starty) +{ + TreeStoreElem *tselem= TREESTORE(te); + + /* store coord and continue, we need coordinates for elements outside view too */ + te->xs= (float)startx; + te->ys= (float)(*starty); + *starty-= OL_H; + + if((tselem->flag & TSE_CLOSED)==0) { + TreeElement *ten; + for(ten= te->subtree.first; ten; ten= ten->next) { + outliner_set_coordinates_element(soops, ten, startx+OL_X, starty); + } + } + +} + +/* to retrieve coordinates with redrawing the entire tree */ +static void outliner_set_coordinates(ARegion *ar, SpaceOops *soops) +{ + TreeElement *te; + int starty= (int)(ar->v2d.tot.ymax)-OL_H; + int startx= 0; + + for(te= soops->tree.first; te; te= te->next) { + outliner_set_coordinates_element(soops, te, startx, &starty); + } +} + /* find next element that has this name */ static TreeElement *outliner_find_named(SpaceOops *soops, ListBase *lb, char *name, int flags, TreeElement *prev, int *prevFound) { @@ -2818,34 +2845,7 @@ static TreeElement *outliner_find_named(SpaceOops *soops, ListBase *lb, char *na return NULL; } -/* tse is not in the treestore, we use its contents to find a match */ -static TreeElement *outliner_find_tse(SpaceOops *soops, TreeStoreElem *tse) -{ - TreeStore *ts= soops->treestore; - TreeStoreElem *tselem; - int a; - - if(tse->id==NULL) return NULL; - - /* check if 'tse' is in treestore */ - tselem= ts->data; - for(a=0; a<ts->usedelem; a++, tselem++) { - if((tse->type==0 && tselem->type==0) || (tselem->type==tse->type && tselem->nr==tse->nr)) { - if(tselem->id==tse->id) { - break; - } - } - } - if(tselem) - return outliner_find_tree_element(&soops->tree, a); - - return NULL; -} - - -/* Called to find an item based on name. - */ -void outliner_find_panel(Scene *scene, ARegion *ar, SpaceOops *soops, int again, int flags) +static void outliner_find_panel(Scene *UNUSED(scene), ARegion *ar, SpaceOops *soops, int again, int flags) { TreeElement *te= NULL; TreeElement *last_find; @@ -2917,6 +2917,7 @@ void outliner_find_panel(Scene *scene, ARegion *ar, SpaceOops *soops, int again, error("Not found: %s", name); } } +#endif /* helper function for tree_element_shwo_hierarchy() - recursively checks whether subtrees have any objects*/ static int subtree_has_objects(SpaceOops *soops, ListBase *lb) @@ -2959,7 +2960,7 @@ static void tree_element_show_hierarchy(Scene *scene, SpaceOops *soops, ListBase } /* show entire object level hierarchy */ -static int outliner_show_hierarchy_exec(bContext *C, wmOperator *op) +static int outliner_show_hierarchy_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceOops *soops= CTX_wm_space_outliner(C); ARegion *ar= CTX_wm_region(C); @@ -3077,7 +3078,7 @@ static void set_operation_types(SpaceOops *soops, ListBase *lb, } } -static void unlink_material_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem) +static void unlink_material_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *UNUSED(tselem)) { Material **matar=NULL; int a, totcol=0; @@ -3111,7 +3112,7 @@ static void unlink_material_cb(bContext *C, Scene *scene, TreeElement *te, TreeS } } -static void unlink_texture_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem) +static void unlink_texture_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *UNUSED(tselem)) { MTex **mtex= NULL; int a; @@ -3140,7 +3141,7 @@ static void unlink_texture_cb(bContext *C, Scene *scene, TreeElement *te, TreeSt } } -static void unlink_group_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem) +static void unlink_group_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeElement *UNUSED(te), TreeStoreElem *tsep, TreeStoreElem *tselem) { Group *group= (Group *)tselem->id; @@ -3177,7 +3178,7 @@ static void outliner_do_libdata_operation(bContext *C, Scene *scene, SpaceOops * /* */ -static void object_select_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem) +static void object_select_cb(bContext *UNUSED(C), Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem) { Base *base= (Base *)te->directdata; @@ -3188,7 +3189,7 @@ static void object_select_cb(bContext *C, Scene *scene, TreeElement *te, TreeSto } } -static void object_deselect_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem) +static void object_deselect_cb(bContext *UNUSED(C), Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem) { Base *base= (Base *)te->directdata; @@ -3199,7 +3200,7 @@ static void object_deselect_cb(bContext *C, Scene *scene, TreeElement *te, TreeS } } -static void object_delete_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem) +static void object_delete_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem) { Base *base= (Base *)te->directdata; @@ -3217,7 +3218,7 @@ static void object_delete_cb(bContext *C, Scene *scene, TreeElement *te, TreeSto } -static void id_local_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem) +static void id_local_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeElement *UNUSED(te), TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem) { if(tselem->id->lib && (tselem->id->flag & LIB_EXTERN)) { tselem->id->lib= NULL; @@ -3226,7 +3227,7 @@ static void id_local_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreEle } } -static void group_linkobs2scene_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem) +static void group_linkobs2scene_cb(bContext *UNUSED(C), Scene *scene, TreeElement *UNUSED(te), TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem) { Group *group= (Group *)tselem->id; GroupObject *gob; @@ -3279,7 +3280,7 @@ static void outliner_do_object_operation(bContext *C, Scene *scene_act, SpaceOop /* ******************************************** */ -static void pchan_cb(int event, TreeElement *te, TreeStoreElem *tselem) +static void pchan_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem)) { bPoseChannel *pchan= (bPoseChannel *)te->directdata; @@ -3295,7 +3296,7 @@ static void pchan_cb(int event, TreeElement *te, TreeStoreElem *tselem) pchan->bone->flag &= ~BONE_HIDDEN_P; } -static void bone_cb(int event, TreeElement *te, TreeStoreElem *tselem) +static void bone_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem)) { Bone *bone= (Bone *)te->directdata; @@ -3311,7 +3312,7 @@ static void bone_cb(int event, TreeElement *te, TreeStoreElem *tselem) bone->flag &= ~BONE_HIDDEN_P; } -static void ebone_cb(int event, TreeElement *te, TreeStoreElem *tselem) +static void ebone_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem)) { EditBone *ebone= (EditBone *)te->directdata; @@ -3327,7 +3328,7 @@ static void ebone_cb(int event, TreeElement *te, TreeStoreElem *tselem) ebone->flag &= ~BONE_HIDDEN_A; } -static void sequence_cb(int event, TreeElement *te, TreeStoreElem *tselem) +static void sequence_cb(int event, TreeElement *UNUSED(te), TreeStoreElem *UNUSED(tselem)) { // Sequence *seq= (Sequence*) te->directdata; if(event==1) { @@ -3354,7 +3355,7 @@ static void outliner_do_data_operation(SpaceOops *soops, int type, int event, Li } } -void outliner_del(bContext *C, Scene *scene, ARegion *ar, SpaceOops *soops) +void outliner_del(bContext *C, Scene *scene, ARegion *UNUSED(ar), SpaceOops *soops) { if(soops->outlinevis==SO_SEQUENCE) @@ -3714,7 +3715,7 @@ static int do_outliner_operation_event(bContext *C, Scene *scene, ARegion *ar, S } -static int outliner_operation(bContext *C, wmOperator *op, wmEvent *event) +static int outliner_operation(bContext *C, wmOperator *UNUSED(op), wmEvent *event) { Scene *scene= CTX_data_scene(C); ARegion *ar= CTX_wm_region(C); @@ -3764,7 +3765,7 @@ static int ed_operator_outliner_datablocks_active(bContext *C) * this function does not do that yet */ static void tree_element_to_path(SpaceOops *soops, TreeElement *te, TreeStoreElem *tselem, - ID **id, char **path, int *array_index, short *flag, short *groupmode) + ID **id, char **path, int *array_index, short *flag, short *UNUSED(groupmode)) { ListBase hierarchy = {NULL, NULL}; LinkData *ld; @@ -3980,7 +3981,7 @@ static void do_outliner_drivers_editop(SpaceOops *soops, ListBase *tree, short m /* Add Operator ---------------------------------- */ -static int outliner_drivers_addsel_exec(bContext *C, wmOperator *op) +static int outliner_drivers_addsel_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceOops *soutliner= CTX_wm_space_outliner(C); @@ -4015,7 +4016,7 @@ void OUTLINER_OT_drivers_add_selected(wmOperatorType *ot) /* Remove Operator ---------------------------------- */ -static int outliner_drivers_deletesel_exec(bContext *C, wmOperator *op) +static int outliner_drivers_deletesel_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceOops *soutliner= CTX_wm_space_outliner(C); @@ -4190,7 +4191,7 @@ void OUTLINER_OT_keyingset_add_selected(wmOperatorType *ot) /* Remove Operator ---------------------------------- */ -static int outliner_keyingset_removeitems_exec(bContext *C, wmOperator *op) +static int outliner_keyingset_removeitems_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceOops *soutliner= CTX_wm_space_outliner(C); Scene *scene= CTX_data_scene(C); @@ -4811,7 +4812,7 @@ static void outliner_draw_tree(bContext *C, uiBlock *block, Scene *scene, ARegio } -static void outliner_back(ARegion *ar, SpaceOops *soops) +static void outliner_back(ARegion *ar) { int ystart; @@ -4825,7 +4826,7 @@ static void outliner_back(ARegion *ar, SpaceOops *soops) } } -static void outliner_draw_restrictcols(ARegion *ar, SpaceOops *soops) +static void outliner_draw_restrictcols(ARegion *ar) { int ystart; @@ -4868,7 +4869,7 @@ static void restrictbutton_view_cb(bContext *C, void *poin, void *poin2) Scene *scene = (Scene *)poin; Object *ob = (Object *)poin2; - if(!common_restrict_check(C, scene, ob)) return; + if(!common_restrict_check(C, ob)) return; /* deselect objects that are invisible */ if (ob->restrictflag & OB_RESTRICT_VIEW) { @@ -4885,7 +4886,7 @@ static void restrictbutton_sel_cb(bContext *C, void *poin, void *poin2) Scene *scene = (Scene *)poin; Object *ob = (Object *)poin2; - if(!common_restrict_check(C, scene, ob)) return; + if(!common_restrict_check(C, ob)) return; /* if select restriction has just been turned on */ if (ob->restrictflag & OB_RESTRICT_SELECT) { @@ -4897,17 +4898,17 @@ static void restrictbutton_sel_cb(bContext *C, void *poin, void *poin2) } -static void restrictbutton_rend_cb(bContext *C, void *poin, void *poin2) +static void restrictbutton_rend_cb(bContext *C, void *poin, void *UNUSED(poin2)) { WM_event_add_notifier(C, NC_SCENE|ND_OB_RENDER, poin); } -static void restrictbutton_r_lay_cb(bContext *C, void *poin, void *poin2) +static void restrictbutton_r_lay_cb(bContext *C, void *poin, void *UNUSED(poin2)) { WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, poin); } -static void restrictbutton_modifier_cb(bContext *C, void *poin, void *poin2) +static void restrictbutton_modifier_cb(bContext *C, void *UNUSED(poin), void *poin2) { Object *ob = (Object *)poin2; @@ -4916,7 +4917,7 @@ static void restrictbutton_modifier_cb(bContext *C, void *poin, void *poin2) WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob); } -static void restrictbutton_bone_cb(bContext *C, void *poin, void *poin2) +static void restrictbutton_bone_cb(bContext *C, void *UNUSED(poin), void *poin2) { Bone *bone= (Bone *)poin2; if(bone && (bone->flag & BONE_HIDDEN_P)) @@ -4924,7 +4925,7 @@ static void restrictbutton_bone_cb(bContext *C, void *poin, void *poin2) WM_event_add_notifier(C, NC_OBJECT|ND_POSE, NULL); } -static void restrictbutton_ebone_cb(bContext *C, void *poin, void *poin2) +static void restrictbutton_ebone_cb(bContext *C, void *UNUSED(poin), void *poin2) { EditBone *ebone= (EditBone *)poin2; if(ebone && (ebone->flag & BONE_HIDDEN_A)) @@ -4956,7 +4957,7 @@ static int group_select_flag(Group *gr) return 0; } -static void restrictbutton_gr_restrict_flag(bContext *C, void *poin, void *poin2, int flag) +static void restrictbutton_gr_restrict_flag(void *poin, void *poin2, int flag) { Scene *scene = (Scene *)poin; GroupObject *gob; @@ -4984,17 +4985,17 @@ static void restrictbutton_gr_restrict_flag(bContext *C, void *poin, void *poin2 static void restrictbutton_gr_restrict_view(bContext *C, void *poin, void *poin2) { - restrictbutton_gr_restrict_flag(C, poin, poin2, OB_RESTRICT_VIEW); + restrictbutton_gr_restrict_flag(poin, poin2, OB_RESTRICT_VIEW); WM_event_add_notifier(C, NC_GROUP, NULL); } static void restrictbutton_gr_restrict_select(bContext *C, void *poin, void *poin2) { - restrictbutton_gr_restrict_flag(C, poin, poin2, OB_RESTRICT_SELECT); + restrictbutton_gr_restrict_flag(poin, poin2, OB_RESTRICT_SELECT); WM_event_add_notifier(C, NC_GROUP, NULL); } static void restrictbutton_gr_restrict_render(bContext *C, void *poin, void *poin2) { - restrictbutton_gr_restrict_flag(C, poin, poin2, OB_RESTRICT_RENDER); + restrictbutton_gr_restrict_flag(poin, poin2, OB_RESTRICT_RENDER); WM_event_add_notifier(C, NC_GROUP, NULL); } @@ -5029,7 +5030,7 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname) if (te->idcode == ID_LI) { char expanded[FILE_MAXDIR + FILE_MAXFILE]; BLI_strncpy(expanded, ((Library *)tselem->id)->name, FILE_MAXDIR + FILE_MAXFILE); - BLI_path_abs(expanded, G.sce); + BLI_path_abs(expanded, G.main->name); if (!BLI_exists(expanded)) { error("This path does not exist, correct this before saving"); } @@ -5240,7 +5241,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar } } -static void outliner_draw_rnacols(ARegion *ar, SpaceOops *soops, int sizex) +static void outliner_draw_rnacols(ARegion *ar, int sizex) { View2D *v2d= &ar->v2d; @@ -5292,7 +5293,7 @@ static void outliner_draw_rnabuts(uiBlock *block, Scene *scene, ARegion *ar, Spa } } -static void operator_call_cb(struct bContext *C, void *arg_kmi, void *arg2) +static void operator_call_cb(struct bContext *UNUSED(C), void *arg_kmi, void *arg2) { wmOperatorType *ot= arg2; wmKeyMapItem *kmi= arg_kmi; @@ -5301,7 +5302,7 @@ static void operator_call_cb(struct bContext *C, void *arg_kmi, void *arg2) BLI_strncpy(kmi->idname, ot->idname, OP_MAX_TYPENAME); } -static void operator_search_cb(const struct bContext *C, void *arg_kmi, char *str, uiSearchItems *items) +static void operator_search_cb(const struct bContext *UNUSED(C), void *UNUSED(arg_kmi), char *str, uiSearchItems *items) { wmOperatorType *ot = WM_operatortype_first(); @@ -5452,7 +5453,7 @@ static char *keymap_tweak_dir_menu(void) } -static void keymap_type_cb(bContext *C, void *kmi_v, void *unused_v) +static void keymap_type_cb(bContext *C, void *kmi_v, void *UNUSED(arg_v)) { wmKeyMapItem *kmi= kmi_v; short maptype= keymap_menu_type(kmi->type); @@ -5654,16 +5655,16 @@ void draw_outliner(const bContext *C) UI_view2d_totRect_set(v2d, sizex, sizey); /* set matrix for 2d-view controls */ - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); /* draw outliner stuff (background, hierachy lines and names) */ - outliner_back(ar, soops); + outliner_back(ar); block= uiBeginBlock(C, ar, "outliner buttons", UI_EMBOSS); outliner_draw_tree((bContext *)C, block, scene, ar, soops); if(ELEM(soops->outlinevis, SO_DATABLOCKS, SO_USERDEF)) { /* draw rna buttons */ - outliner_draw_rnacols(ar, soops, sizex_rna); + outliner_draw_rnacols(ar, sizex_rna); outliner_draw_rnabuts(block, scene, ar, soops, sizex_rna, &soops->tree); } else if(soops->outlinevis == SO_KEYMAP) { @@ -5671,7 +5672,7 @@ void draw_outliner(const bContext *C) } else if (!(soops->flag & SO_HIDE_RESTRICTCOLS)) { /* draw restriction columns */ - outliner_draw_restrictcols(ar, soops); + outliner_draw_restrictcols(ar); outliner_draw_restrictbuts(block, scene, ar, soops, &soops->tree); } diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c index f0f9ac945ef..f31910d8289 100644 --- a/source/blender/editors/space_outliner/space_outliner.c +++ b/source/blender/editors/space_outliner/space_outliner.c @@ -84,11 +84,11 @@ static void outliner_main_area_draw(const bContext *C, ARegion *ar) } -static void outliner_main_area_free(ARegion *ar) +static void outliner_main_area_free(ARegion *UNUSED(ar)) { + } - static void outliner_main_area_listener(ARegion *ar, wmNotifier *wmn) { /* context changes */ @@ -104,6 +104,7 @@ static void outliner_main_area_listener(ARegion *ar, wmNotifier *wmn) case ND_FRAME: case ND_RENDER_OPTIONS: case ND_LAYER: + case ND_WORLD: ED_region_tag_redraw(ar); break; } @@ -162,6 +163,14 @@ static void outliner_main_area_listener(ARegion *ar, wmNotifier *wmn) case NC_TEXTURE: ED_region_tag_redraw(ar); break; + case NC_GEOM: + switch(wmn->data) { + case ND_DATA: + /* needed for vertex groups only, no special notifier atm so use NC_GEOM|ND_DATA */ + ED_region_tag_redraw(ar); + break; + } + break; } } @@ -170,7 +179,7 @@ static void outliner_main_area_listener(ARegion *ar, wmNotifier *wmn) /* ************************ header outliner area region *********************** */ /* add handlers, stuff you only do once or on area/region changes */ -static void outliner_header_area_init(wmWindowManager *wm, ARegion *ar) +static void outliner_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar) { ED_region_header_init(ar); } @@ -180,7 +189,7 @@ static void outliner_header_area_draw(const bContext *C, ARegion *ar) ED_region_header(C, ar); } -static void outliner_header_area_free(ARegion *ar) +static void outliner_header_area_free(ARegion *UNUSED(ar)) { } @@ -201,7 +210,7 @@ static void outliner_header_area_listener(ARegion *ar, wmNotifier *wmn) /* ******************** default callbacks for outliner space ***************** */ -static SpaceLink *outliner_new(const bContext *C) +static SpaceLink *outliner_new(const bContext *UNUSED(C)) { ARegion *ar; SpaceOops *soutliner; @@ -245,7 +254,7 @@ static void outliner_free(SpaceLink *sl) } /* spacetype; init callback */ -static void outliner_init(wmWindowManager *wm, ScrArea *sa) +static void outliner_init(wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa)) { } diff --git a/source/blender/editors/space_script/script_edit.c b/source/blender/editors/space_script/script_edit.c index 610fecaa543..7e3b14ca04a 100644 --- a/source/blender/editors/space_script/script_edit.c +++ b/source/blender/editors/space_script/script_edit.c @@ -80,7 +80,7 @@ void SCRIPT_OT_python_file_run(wmOperatorType *ot) } -static int script_reload_exec(bContext *C, wmOperator *op) +static int script_reload_exec(bContext *C, wmOperator *UNUSED(op)) { #ifndef DISABLE_PYTHON /* TODO, this crashes on netrender and keying sets, need to look into why diff --git a/source/blender/editors/space_script/script_header.c b/source/blender/editors/space_script/script_header.c index 6e65d458451..1159139eff5 100644 --- a/source/blender/editors/space_script/script_header.c +++ b/source/blender/editors/space_script/script_header.c @@ -32,7 +32,7 @@ #include "BLI_blenlib.h" - +#include "BKE_utildefines.h" #include "BKE_context.h" #include "ED_screen.h" @@ -50,12 +50,12 @@ /* ************************ header area region *********************** */ -static void do_viewmenu(bContext *C, void *arg, int event) +static void do_viewmenu(bContext *UNUSED(C), void *UNUSED(arg), int UNUSED(event)) { } -static uiBlock *dummy_viewmenu(bContext *C, ARegion *ar, void *arg_unused) +static uiBlock *dummy_viewmenu(bContext *C, ARegion *ar, void *UNUSED(arg)) { ScrArea *curarea= CTX_wm_area(C); uiBlock *block; @@ -81,7 +81,7 @@ static uiBlock *dummy_viewmenu(bContext *C, ARegion *ar, void *arg_unused) return block; } -static void do_script_buttons(bContext *C, void *arg, int event) +static void do_script_buttons(bContext *UNUSED(C), void *UNUSED(arg), int event) { switch(event) { } diff --git a/source/blender/editors/space_script/space_script.c b/source/blender/editors/space_script/space_script.c index f93ddc6efbe..66f630bb5b3 100644 --- a/source/blender/editors/space_script/space_script.c +++ b/source/blender/editors/space_script/space_script.c @@ -61,7 +61,7 @@ /* ******************** default callbacks for script space ***************** */ -static SpaceLink *script_new(const bContext *C) +static SpaceLink *script_new(const bContext *UNUSED(C)) { ARegion *ar; SpaceScript *sscript; @@ -107,7 +107,7 @@ static void script_free(SpaceLink *sl) /* spacetype; init callback */ -static void script_init(struct wmWindowManager *wm, ScrArea *sa) +static void script_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa)) { } @@ -145,7 +145,7 @@ static void script_main_area_draw(const bContext *C, ARegion *ar) UI_ThemeClearColor(TH_BACK); glClear(GL_COLOR_BUFFER_BIT); - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); /* data... */ // BPY_run_python_script(C, "/root/blender-svn/blender25/test.py", NULL); @@ -164,7 +164,7 @@ static void script_main_area_draw(const bContext *C, ARegion *ar) } /* add handlers, stuff you only do once or on area/region changes */ -static void script_header_area_init(wmWindowManager *wm, ARegion *ar) +static void script_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar) { ED_region_header_init(ar); } @@ -174,7 +174,7 @@ static void script_header_area_draw(const bContext *C, ARegion *ar) ED_region_header(C, ar); } -static void script_main_area_listener(ARegion *ar, wmNotifier *wmn) +static void script_main_area_listener(ARegion *UNUSED(ar), wmNotifier *UNUSED(wmn)) { /* context changes */ // XXX - Todo, need the ScriptSpace accessible to get the python script to run. diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index b9db18f7850..5f0693dc43c 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -101,7 +101,7 @@ static void sequencer_generic_invoke_path__internal(bContext *C, wmOperator *op, if(last_seq && last_seq->strip && SEQ_HAS_PATH(last_seq)) { char path[sizeof(last_seq->strip->dir)]; BLI_strncpy(path, last_seq->strip->dir, sizeof(path)); - BLI_path_abs(path, G.sce); + BLI_path_abs(path, G.main->name); RNA_string_set(op->ptr, identifier, path); } } @@ -152,7 +152,7 @@ static void seq_load_operator_info(SeqLoadInfo *seq_load, wmOperator *op) } if((is_file != -1) && relative) - BLI_path_rel(seq_load->path, G.sce); + BLI_path_rel(seq_load->path, G.main->name); if (RNA_struct_find_property(op->ptr, "frame_end")) { diff --git a/source/blender/editors/space_sequencer/sequencer_buttons.c b/source/blender/editors/space_sequencer/sequencer_buttons.c index 4394e334614..aa0686bc9bb 100644 --- a/source/blender/editors/space_sequencer/sequencer_buttons.c +++ b/source/blender/editors/space_sequencer/sequencer_buttons.c @@ -47,13 +47,13 @@ #include "sequencer_intern.h" -static void do_sequencer_panel_events(bContext *C, void *arg, int event) +static void do_sequencer_panel_events(bContext *UNUSED(C), void *UNUSED(arg), int UNUSED(event)) { } -static void sequencer_panel_view_properties(const bContext *C, Panel *pa) +static void sequencer_panel_view_properties(const bContext *UNUSED(C), Panel *pa) { uiBlock *block; @@ -63,7 +63,7 @@ static void sequencer_panel_view_properties(const bContext *C, Panel *pa) } -static void sequencer_panel_properties(const bContext *C, Panel *pa) +static void sequencer_panel_properties(const bContext *UNUSED(C), Panel *pa) { uiBlock *block; @@ -92,7 +92,7 @@ void sequencer_buttons_register(ARegionType *art) /* **************** operator to open/close properties view ************* */ -static int sequencer_properties(bContext *C, wmOperator *op) +static int sequencer_properties(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); ARegion *ar= sequencer_has_buttons_region(sa); diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 7c6fd83c6aa..c4ae658ce37 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -357,7 +357,7 @@ static void draw_seq_handle(View2D *v2d, Sequence *seq, float pixelx, short dire } } -static void draw_seq_extensions(Scene *scene, ARegion *ar, SpaceSeq *sseq, Sequence *seq) +static void draw_seq_extensions(Scene *scene, ARegion *ar, Sequence *seq) { float x1, x2, y1, y2, pixely, a; char col[3], blendcol[3]; @@ -586,7 +586,7 @@ Draw a sequence strip, bounds check already made ARegion is currently only used to get the windows width in pixels so wave file sample drawing precision is zoom adjusted */ -static void draw_seq_strip(Scene *scene, ARegion *ar, SpaceSeq *sseq, Sequence *seq, int outline_tint, float pixelx) +static void draw_seq_strip(Scene *scene, ARegion *ar, Sequence *seq, int outline_tint, float pixelx) { View2D *v2d= &ar->v2d; float x1, x2, y1, y2; @@ -616,7 +616,7 @@ static void draw_seq_strip(Scene *scene, ARegion *ar, SpaceSeq *sseq, Sequence * /* draw additional info and controls */ if (!is_single_image) - draw_seq_extensions(scene, ar, sseq, seq); + draw_seq_extensions(scene, ar, seq); draw_seq_handle(v2d, seq, pixelx, SEQ_LEFTHANDLE); draw_seq_handle(v2d, seq, pixelx, SEQ_RIGHTHANDLE); @@ -772,7 +772,7 @@ void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq } /* setting up the view - actual drawing starts here */ - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); last_texid= glaGetOneInteger(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D); @@ -866,7 +866,7 @@ void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq UI_view2d_view_restore(C); } -void drawprefetchseqspace(Scene *scene, ARegion *ar, SpaceSeq *sseq) +void drawprefetchseqspace(Scene *scene, ARegion *UNUSED(ar), SpaceSeq *sseq) { int rectx, recty; int render_size = sseq->render_size; @@ -936,7 +936,6 @@ static void draw_seq_backdrop(View2D *v2d) static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *ar) { Scene *scene= CTX_data_scene(C); - SpaceSeq *sseq= CTX_wm_space_seq(C); View2D *v2d= &ar->v2d; Sequence *last_seq = seq_active_get(scene); int sel = 0, j; @@ -958,7 +957,7 @@ static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *ar) else if (seq->machine > v2d->cur.ymax) continue; /* strip passed all tests unscathed... so draw it now */ - draw_seq_strip(scene, ar, sseq, seq, outline_tint, pixelx); + draw_seq_strip(scene, ar, seq, outline_tint, pixelx); } /* draw selected next time round */ @@ -967,14 +966,11 @@ static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *ar) /* draw the last selected last (i.e. 'active' in other parts of Blender), removes some overlapping error */ if (last_seq) - draw_seq_strip(scene, ar, sseq, last_seq, 120, pixelx); + draw_seq_strip(scene, ar, last_seq, 120, pixelx); } -static void seq_draw_sfra_efra(const bContext *C, SpaceSeq *sseq, ARegion *ar) -{ - View2D *v2d= UI_view2d_fromcontext(C); - Scene *scene= CTX_data_scene(C); - +static void seq_draw_sfra_efra(Scene *scene, View2D *v2d) +{ glEnable(GL_BLEND); /* draw darkened area outside of active timeline @@ -1016,7 +1012,7 @@ void draw_timeline_seq(const bContext *C, ARegion *ar) glClearColor(col[0], col[1], col[2], 0.0); glClear(GL_COLOR_BUFFER_BIT); - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); /* calculate extents of sequencer strips/data @@ -1029,9 +1025,9 @@ void draw_timeline_seq(const bContext *C, ARegion *ar) draw_seq_backdrop(v2d); /* regular grid-pattern over the rest of the view (i.e. frame grid lines) */ - UI_view2d_constant_grid_draw(C, v2d); + UI_view2d_constant_grid_draw(v2d); - seq_draw_sfra_efra(C, sseq, ar); + seq_draw_sfra_efra(scene, v2d); /* sequence strips (if there is data available to be drawn) */ if (ed) { @@ -1043,17 +1039,17 @@ void draw_timeline_seq(const bContext *C, ARegion *ar) } /* current frame */ - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); if ((sseq->flag & SEQ_DRAWFRAMES)==0) flag |= DRAWCFRA_UNIT_SECONDS; if ((sseq->flag & SEQ_NO_DRAW_CFRANUM)==0) flag |= DRAWCFRA_SHOW_NUMBOX; ANIM_draw_cfra(C, v2d, flag); /* markers */ - UI_view2d_view_orthoSpecial(C, v2d, 1); + UI_view2d_view_orthoSpecial(ar, v2d, 1); draw_markers_time(C, DRAW_MARKERS_LINES); /* preview range */ - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); ANIM_draw_previewrange(C, v2d); /* overlap playhead */ diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index d96b8a27c99..35f27953633 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -69,11 +69,11 @@ /* own include */ #include "sequencer_intern.h" -static void error(const char *dummy) {} -static void waitcursor(int val) {} -static void activate_fileselect(int d1, char *d2, char *d3, void *d4) {} -static int pupmenu(const char *dummy) {return 0;} -static int okee(const char *dummy) {return 0;} +static void error(const char *UNUSED(dummy)) {} +static void waitcursor(int UNUSED(val)) {} +static void activate_fileselect(int UNUSED(d1), char *UNUSED(d2), char *UNUSED(d3), void *UNUSED(d4)) {} +static int pupmenu(const char *UNUSED(dummy)) {return 0;} +static int okee(const char *UNUSED(dummy)) {return 0;} /* XXX */ @@ -468,7 +468,7 @@ static void reload_sound_strip(Scene *scene, char *name) } #endif -static void reload_image_strip(Scene *scene, char *name) +static void reload_image_strip(Scene *scene, char *UNUSED(name)) { Editing *ed= seq_give_editing(scene, FALSE); Sequence *seq=NULL, *seqact; @@ -735,7 +735,7 @@ static void recurs_del_seq_flag(Scene *scene, ListBase *lb, short flag, short de } -static Sequence *cut_seq_hard(Main *bmain, Scene *scene, Sequence * seq, int cutframe) +static Sequence *cut_seq_hard(Scene *scene, Sequence * seq, int cutframe) { TransSeq ts; Sequence *seqn = 0; @@ -782,7 +782,7 @@ static Sequence *cut_seq_hard(Main *bmain, Scene *scene, Sequence * seq, int cut } } - reload_sequence_new_file(bmain, scene, seq, FALSE); + reload_sequence_new_file(scene, seq, FALSE); calc_sequence(scene, seq); new_tstripdata(seq); @@ -822,14 +822,14 @@ static Sequence *cut_seq_hard(Main *bmain, Scene *scene, Sequence * seq, int cut seqn->startstill = 0; } - reload_sequence_new_file(bmain, scene, seqn, FALSE); + reload_sequence_new_file(scene, seqn, FALSE); calc_sequence(scene, seqn); new_tstripdata(seqn); } return seqn; } -static Sequence *cut_seq_soft(Main *bmain, Scene *scene, Sequence * seq, int cutframe) +static Sequence *cut_seq_soft(Scene *scene, Sequence * seq, int cutframe) { TransSeq ts; Sequence *seqn = 0; @@ -919,8 +919,8 @@ static Sequence *cut_seq_soft(Main *bmain, Scene *scene, Sequence * seq, int cut /* like duplicate, but only duplicate and cut overlapping strips, * strips to the left of the cutframe are ignored and strips to the right are moved into the new list */ -static int cut_seq_list(Main *bmain, Scene *scene, ListBase *old, ListBase *new, int cutframe, - Sequence * (*cut_seq)(Main *, Scene *, Sequence *, int)) +static int cut_seq_list(Scene *scene, ListBase *old, ListBase *new, int cutframe, + Sequence * (*cut_seq)(Scene *, Sequence *, int)) { int did_something = FALSE; Sequence *seq, *seq_next; @@ -934,7 +934,7 @@ static int cut_seq_list(Main *bmain, Scene *scene, ListBase *old, ListBase *new, if(seq->flag & SELECT) { if(cutframe > seq->startdisp && cutframe < seq->enddisp) { - Sequence * seqn = cut_seq(bmain, scene, seq, cutframe); + Sequence * seqn = cut_seq(scene, seq, cutframe); if (seqn) { BLI_addtail(new, seqn); } @@ -992,7 +992,7 @@ void touch_seq_files(Scene *scene) if(seq->flag & SELECT) { if(seq->type==SEQ_MOVIE) { if(seq->strip && seq->strip->stripdata) { - BLI_make_file_string(G.sce, str, seq->strip->dir, seq->strip->stripdata->name); + BLI_make_file_string(G.main->name, str, seq->strip->dir, seq->strip->stripdata->name); BLI_touch(seq->name); } } @@ -1004,7 +1004,8 @@ void touch_seq_files(Scene *scene) waitcursor(0); } -void set_filter_seq(Main *bmain, Scene *scene) +/* +static void set_filter_seq(Scene *scene) { Sequence *seq; Editing *ed= seq_give_editing(scene, FALSE); @@ -1018,15 +1019,15 @@ void set_filter_seq(Main *bmain, Scene *scene) if(seq->flag & SELECT) { if(seq->type==SEQ_MOVIE) { seq->flag |= SEQ_FILTERY; - reload_sequence_new_file(bmain, scene, seq, FALSE); + reload_sequence_new_file(scene, seq, FALSE); calc_sequence(scene, seq); } } } SEQ_END - } +*/ void seq_remap_paths(Scene *scene) { @@ -1185,7 +1186,7 @@ static int sequencer_snap_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int sequencer_snap_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int sequencer_snap_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Scene *scene = CTX_data_scene(C); @@ -1310,7 +1311,7 @@ void SEQUENCER_OT_unmute(struct wmOperatorType *ot) /* lock operator */ -static int sequencer_lock_exec(bContext *C, wmOperator *op) +static int sequencer_lock_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Editing *ed= seq_give_editing(scene, FALSE); @@ -1343,7 +1344,7 @@ void SEQUENCER_OT_lock(struct wmOperatorType *ot) } /* unlock operator */ -static int sequencer_unlock_exec(bContext *C, wmOperator *op) +static int sequencer_unlock_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Editing *ed= seq_give_editing(scene, FALSE); @@ -1376,7 +1377,7 @@ void SEQUENCER_OT_unlock(struct wmOperatorType *ot) } /* reload operator */ -static int sequencer_reload_exec(bContext *C, wmOperator *op) +static int sequencer_reload_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Editing *ed= seq_give_editing(scene, FALSE); @@ -1409,7 +1410,7 @@ void SEQUENCER_OT_reload(struct wmOperatorType *ot) } /* reload operator */ -static int sequencer_refresh_all_exec(bContext *C, wmOperator *op) +static int sequencer_refresh_all_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Editing *ed= seq_give_editing(scene, FALSE); @@ -1506,7 +1507,6 @@ static EnumPropertyItem prop_cut_types[] = { static int sequencer_cut_exec(bContext *C, wmOperator *op) { - Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Editing *ed= seq_give_editing(scene, FALSE); int cut_side, cut_hard, cut_frame; @@ -1521,11 +1521,9 @@ static int sequencer_cut_exec(bContext *C, wmOperator *op) newlist.first= newlist.last= NULL; if (cut_hard==SEQ_CUT_HARD) { - changed = cut_seq_list(bmain, scene, - ed->seqbasep, &newlist, cut_frame, cut_seq_hard); + changed = cut_seq_list(scene, ed->seqbasep, &newlist, cut_frame, cut_seq_hard); } else { - changed = cut_seq_list(bmain, scene, - ed->seqbasep, &newlist, cut_frame, cut_seq_soft); + changed = cut_seq_list(scene, ed->seqbasep, &newlist, cut_frame, cut_seq_soft); } if (newlist.first) { /* got new strips ? */ @@ -1609,7 +1607,7 @@ static int apply_unique_name_cb(Sequence *seq, void *arg_pt) } -static int sequencer_add_duplicate_exec(bContext *C, wmOperator *op) +static int sequencer_add_duplicate_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Editing *ed= seq_give_editing(scene, FALSE); @@ -1636,7 +1634,7 @@ static int sequencer_add_duplicate_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } -static int sequencer_add_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int sequencer_add_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { sequencer_add_duplicate_exec(C, op); @@ -1666,7 +1664,7 @@ void SEQUENCER_OT_duplicate(wmOperatorType *ot) } /* delete operator */ -static int sequencer_delete_exec(bContext *C, wmOperator *op) +static int sequencer_delete_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Editing *ed= seq_give_editing(scene, FALSE); @@ -1840,7 +1838,7 @@ void SEQUENCER_OT_images_separate(wmOperatorType *ot) /* META Operators */ /* separate_meta_toggle operator */ -static int sequencer_meta_toggle_exec(bContext *C, wmOperator *op) +static int sequencer_meta_toggle_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Editing *ed= seq_give_editing(scene, FALSE); @@ -1985,7 +1983,7 @@ static int seq_depends_on_meta(Sequence *seq, Sequence *seqm) } /* separate_meta_make operator */ -static int sequencer_meta_separate_exec(bContext *C, wmOperator *op) +static int sequencer_meta_separate_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Editing *ed= seq_give_editing(scene, FALSE); @@ -2046,7 +2044,7 @@ void SEQUENCER_OT_meta_separate(wmOperatorType *ot) } /* view_all operator */ -static int sequencer_view_all_exec(bContext *C, wmOperator *op) +static int sequencer_view_all_exec(bContext *C, wmOperator *UNUSED(op)) { //Scene *scene= CTX_data_scene(C); bScreen *sc= CTX_wm_screen(C); @@ -2078,7 +2076,7 @@ void SEQUENCER_OT_view_all(wmOperatorType *ot) } /* view_all operator */ -static int sequencer_view_all_preview_exec(bContext *C, wmOperator *op) +static int sequencer_view_all_preview_exec(bContext *C, wmOperator *UNUSED(op)) { bScreen *sc= CTX_wm_screen(C); ScrArea *area= CTX_wm_area(C); @@ -2189,7 +2187,7 @@ static EnumPropertyItem view_type_items[] = { #endif /* view_all operator */ -static int sequencer_view_toggle_exec(bContext *C, wmOperator *op) +static int sequencer_view_toggle_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceSeq *sseq= (SpaceSeq *)CTX_wm_space_data(C); @@ -2218,7 +2216,7 @@ void SEQUENCER_OT_view_toggle(wmOperatorType *ot) /* view_selected operator */ -static int sequencer_view_selected_exec(bContext *C, wmOperator *op) +static int sequencer_view_selected_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); View2D *v2d= UI_view2d_fromcontext(C); @@ -2354,7 +2352,7 @@ static int next_prev_edit_internal(Scene *scene, int side) } /* move frame to next edit point operator */ -static int sequencer_next_edit_exec(bContext *C, wmOperator *op) +static int sequencer_next_edit_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); @@ -2384,7 +2382,7 @@ void SEQUENCER_OT_next_edit(wmOperatorType *ot) } /* move frame to previous edit point operator */ -static int sequencer_previous_edit_exec(bContext *C, wmOperator *op) +static int sequencer_previous_edit_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); @@ -2518,7 +2516,7 @@ void SEQUENCER_OT_swap(wmOperatorType *ot) RNA_def_enum(ot->srna, "side", prop_side_lr_types, SEQ_SIDE_RIGHT, "Side", "Side of the strip to swap"); } -static int sequencer_rendersize_exec(bContext *C, wmOperator *op) +static int sequencer_rendersize_exec(bContext *C, wmOperator *UNUSED(op)) { int retval = OPERATOR_CANCELLED; Scene *scene= CTX_data_scene(C); @@ -2638,7 +2636,7 @@ static void seq_offset(Scene *scene, Sequence *seq, int ofs) calc_sequence_disp(scene, seq); } -static int sequencer_paste_exec(bContext *C, wmOperator *op) +static int sequencer_paste_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Editing *ed= seq_give_editing(scene, TRUE); /* create if needed */ diff --git a/source/blender/editors/space_sequencer/sequencer_scopes.c b/source/blender/editors/space_sequencer/sequencer_scopes.c index d9d027823bc..f5c8388bf67 100644 --- a/source/blender/editors/space_sequencer/sequencer_scopes.c +++ b/source/blender/editors/space_sequencer/sequencer_scopes.c @@ -143,7 +143,7 @@ static void wform_put_grid(unsigned char * tgt, int w, int h) static struct ImBuf *make_waveform_view_from_ibuf_byte(struct ImBuf * ibuf) { - struct ImBuf * rval = IMB_allocImBuf(ibuf->x + 3, 515, 32, IB_rect, 0); + struct ImBuf * rval = IMB_allocImBuf(ibuf->x + 3, 515, 32, IB_rect); int x,y; unsigned char* src = (unsigned char*) ibuf->rect; unsigned char* tgt = (unsigned char*) rval->rect; @@ -189,7 +189,7 @@ static struct ImBuf *make_waveform_view_from_ibuf_byte(struct ImBuf * ibuf) static struct ImBuf *make_waveform_view_from_ibuf_float(struct ImBuf * ibuf) { - struct ImBuf * rval = IMB_allocImBuf(ibuf->x + 3, 515, 32, IB_rect, 0); + struct ImBuf * rval = IMB_allocImBuf(ibuf->x + 3, 515, 32, IB_rect); int x,y; float* src = ibuf->rect_float; unsigned char* tgt = (unsigned char*) rval->rect; @@ -249,7 +249,7 @@ struct ImBuf *make_waveform_view_from_ibuf(struct ImBuf * ibuf) static struct ImBuf *make_sep_waveform_view_from_ibuf_byte(struct ImBuf * ibuf) { struct ImBuf * rval = IMB_allocImBuf( - ibuf->x + 3, 515, 32, IB_rect, 0); + ibuf->x + 3, 515, 32, IB_rect); int x,y; unsigned char* src = (unsigned char*) ibuf->rect; unsigned char* tgt = (unsigned char*) rval->rect; @@ -299,7 +299,7 @@ static struct ImBuf *make_sep_waveform_view_from_ibuf_float( struct ImBuf * ibuf) { struct ImBuf * rval = IMB_allocImBuf( - ibuf->x + 3, 515, 32, IB_rect, 0); + ibuf->x + 3, 515, 32, IB_rect); int x,y; float* src = ibuf->rect_float; unsigned char* tgt = (unsigned char*) rval->rect; @@ -422,7 +422,7 @@ static void draw_zebra_float(struct ImBuf * src,struct ImBuf * ibuf,float perc) struct ImBuf * make_zebra_view_from_ibuf(struct ImBuf * src, float perc) { - struct ImBuf * ibuf = IMB_allocImBuf(src->x, src->y, 32, IB_rect, 0); + struct ImBuf * ibuf = IMB_allocImBuf(src->x, src->y, 32, IB_rect); if (src->rect_float) { draw_zebra_float(src, ibuf, perc); @@ -463,7 +463,7 @@ static void draw_histogram_bar(struct ImBuf * ibuf, int x,float val, int col) static struct ImBuf *make_histogram_view_from_ibuf_byte( struct ImBuf * ibuf) { - struct ImBuf * rval = IMB_allocImBuf(515, 128, 32, IB_rect, 0); + struct ImBuf * rval = IMB_allocImBuf(515, 128, 32, IB_rect); int n,c,x,y; unsigned char* src = (unsigned char*) ibuf->rect; @@ -517,7 +517,7 @@ static int get_bin_float(float f) static struct ImBuf *make_histogram_view_from_ibuf_float( struct ImBuf * ibuf) { - struct ImBuf * rval = IMB_allocImBuf(515, 128, 32, IB_rect, 0); + struct ImBuf * rval = IMB_allocImBuf(515, 128, 32, IB_rect); int n,c,x,y; float* src = ibuf->rect_float; @@ -596,7 +596,7 @@ static void vectorscope_put_cross(unsigned char r, unsigned char g, static struct ImBuf *make_vectorscope_view_from_ibuf_byte(struct ImBuf * ibuf) { - struct ImBuf * rval = IMB_allocImBuf(515, 515, 32, IB_rect, 0); + struct ImBuf * rval = IMB_allocImBuf(515, 515, 32, IB_rect); int x,y; char* src = (char*) ibuf->rect; char* tgt = (char*) rval->rect; @@ -643,7 +643,7 @@ static struct ImBuf *make_vectorscope_view_from_ibuf_byte(struct ImBuf * ibuf) static struct ImBuf *make_vectorscope_view_from_ibuf_float(struct ImBuf * ibuf) { - struct ImBuf * rval = IMB_allocImBuf(515, 515, 32, IB_rect, 0); + struct ImBuf * rval = IMB_allocImBuf(515, 515, 32, IB_rect); int x,y; float* src = ibuf->rect_float; char* tgt = (char*) rval->rect; diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c index a61e05517d9..720aa098ff6 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.c +++ b/source/blender/editors/space_sequencer/sequencer_select.c @@ -58,7 +58,7 @@ /* own include */ #include "sequencer_intern.h" -static void *find_nearest_marker(int d1, int d2) {return NULL;} +static void *find_nearest_marker(int UNUSED(d1), int UNUSED(d2)) {return NULL;} void select_surrounding_handles(Scene *scene, Sequence *test) /* XXX BRING BACK */ { @@ -209,7 +209,7 @@ void select_neighbor_from_last(Scene *scene, int lr) /* (de)select operator */ -static int sequencer_deselect_exec(bContext *C, wmOperator *op) +static int sequencer_deselect_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Editing *ed= seq_give_editing(scene, FALSE); @@ -255,7 +255,7 @@ void SEQUENCER_OT_select_all_toggle(struct wmOperatorType *ot) /* (de)select operator */ -static int sequencer_select_inverse_exec(bContext *C, wmOperator *op) +static int sequencer_select_inverse_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Editing *ed= seq_give_editing(scene, FALSE); @@ -582,7 +582,7 @@ static int select_more_less_seq__internal(Scene *scene, int sel, int linked) { /* select more operator */ -static int sequencer_select_more_exec(bContext *C, wmOperator *op) +static int sequencer_select_more_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); @@ -613,7 +613,7 @@ void SEQUENCER_OT_select_more(wmOperatorType *ot) /* select less operator */ -static int sequencer_select_less_exec(bContext *C, wmOperator *op) +static int sequencer_select_less_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); @@ -700,7 +700,7 @@ void SEQUENCER_OT_select_linked_pick(wmOperatorType *ot) /* select linked operator */ -static int sequencer_select_linked_exec(bContext *C, wmOperator *op) +static int sequencer_select_linked_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); int selected; diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c index a4b7a17ec13..84daf04e4aa 100644 --- a/source/blender/editors/space_sequencer/space_sequencer.c +++ b/source/blender/editors/space_sequencer/space_sequencer.c @@ -236,7 +236,7 @@ static SpaceLink *sequencer_new(const bContext *C) } /* not spacelink itself */ -static void sequencer_free(SpaceLink *sl) +static void sequencer_free(SpaceLink *UNUSED(sl)) { // SpaceSeq *sseq= (SpaceSequencer*) sl; @@ -246,7 +246,7 @@ static void sequencer_free(SpaceLink *sl) /* spacetype; init callback */ -static void sequencer_init(struct wmWindowManager *wm, ScrArea *sa) +static void sequencer_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa)) { } @@ -296,7 +296,7 @@ static void sequencer_main_area_draw(const bContext *C, ARegion *ar) /* ************* dropboxes ************* */ -static int image_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) +static int image_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event)) { if(drag->type==WM_DRAG_PATH) if(ELEM(drag->icon, ICON_FILE_IMAGE, ICON_FILE_BLANK)) /* rule might not work? */ @@ -304,7 +304,7 @@ static int image_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) return 0; } -static int movie_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) +static int movie_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event)) { if(drag->type==WM_DRAG_PATH) if(ELEM3(drag->icon, 0, ICON_FILE_MOVIE, ICON_FILE_BLANK)) /* rule might not work? */ @@ -312,7 +312,7 @@ static int movie_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) return 0; } -static int sound_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) +static int sound_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event)) { if(drag->type==WM_DRAG_PATH) if(ELEM(drag->icon, ICON_FILE_SOUND, ICON_FILE_BLANK)) /* rule might not work? */ @@ -352,7 +352,7 @@ static void sequencer_dropboxes(void) /* ************* end drop *********** */ /* add handlers, stuff you only do once or on area/region changes */ -static void sequencer_header_area_init(wmWindowManager *wm, ARegion *ar) +static void sequencer_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar) { ED_region_header_init(ar); } diff --git a/source/blender/editors/space_sound/sound_header.c b/source/blender/editors/space_sound/sound_header.c index fbf6d8c85c9..c857d33bcab 100644 --- a/source/blender/editors/space_sound/sound_header.c +++ b/source/blender/editors/space_sound/sound_header.c @@ -34,6 +34,7 @@ #include "BLI_blenlib.h" +#include "BKE_utildefines.h" #include "BKE_context.h" #include "ED_screen.h" @@ -53,12 +54,12 @@ /* ************************ header area region *********************** */ -static void do_viewmenu(bContext *C, void *arg, int event) +static void do_viewmenu(bContext *UNUSED(C), void *UNUSED(arg), int UNUSED(event)) { } -static uiBlock *dummy_viewmenu(bContext *C, ARegion *ar, void *arg_unused) +static uiBlock *dummy_viewmenu(bContext *C, ARegion *ar, void *UNUSED(arg)) { ScrArea *curarea= CTX_wm_area(C); uiBlock *block; @@ -84,7 +85,7 @@ static uiBlock *dummy_viewmenu(bContext *C, ARegion *ar, void *arg_unused) return block; } -static void do_sound_buttons(bContext *C, void *arg, int event) +static void do_sound_buttons(bContext *UNUSED(C), void *UNUSED(arg), int event) { switch(event) { } diff --git a/source/blender/editors/space_sound/space_sound.c b/source/blender/editors/space_sound/space_sound.c index 905e1d6cdd9..99b24479967 100644 --- a/source/blender/editors/space_sound/space_sound.c +++ b/source/blender/editors/space_sound/space_sound.c @@ -55,7 +55,7 @@ /* ******************** default callbacks for sound space ***************** */ -static SpaceLink *sound_new(const bContext *C) +static SpaceLink *sound_new(const bContext *UNUSED(C)) { ARegion *ar; SpaceSound *ssound; @@ -106,7 +106,7 @@ static SpaceLink *sound_new(const bContext *C) } /* not spacelink itself */ -static void sound_free(SpaceLink *sl) +static void sound_free(SpaceLink *UNUSED(sl)) { // SpaceSound *ssound= (SpaceSound*) sl; @@ -115,7 +115,7 @@ static void sound_free(SpaceLink *sl) /* spacetype; init callback */ -static void sound_init(struct wmWindowManager *wm, ScrArea *sa) +static void sound_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa)) { } @@ -153,7 +153,7 @@ static void sound_main_area_draw(const bContext *C, ARegion *ar) UI_ThemeClearColor(TH_BACK); glClear(GL_COLOR_BUFFER_BIT); - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); /* data... */ @@ -169,13 +169,13 @@ void sound_operatortypes(void) } -void sound_keymap(struct wmKeyConfig *keyconf) +void sound_keymap(struct wmKeyConfig *UNUSED(keyconf)) { } /* add handlers, stuff you only do once or on area/region changes */ -static void sound_header_area_init(wmWindowManager *wm, ARegion *ar) +static void sound_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar) { UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_HEADER, ar->winx, ar->winy); } @@ -194,7 +194,7 @@ static void sound_header_area_draw(const bContext *C, ARegion *ar) glClear(GL_COLOR_BUFFER_BIT); /* set view2d view matrix for scrolling (without scrollers) */ - UI_view2d_view_ortho(C, &ar->v2d); + UI_view2d_view_ortho(&ar->v2d); sound_header_buttons(C, ar); @@ -202,7 +202,7 @@ static void sound_header_area_draw(const bContext *C, ARegion *ar) UI_view2d_view_restore(C); } -static void sound_main_area_listener(ARegion *ar, wmNotifier *wmn) +static void sound_main_area_listener(ARegion *UNUSED(ar), wmNotifier *UNUSED(wmn)) { /* context changes */ } diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c index 7f7a07f8cf7..06346bc89ed 100644 --- a/source/blender/editors/space_text/space_text.c +++ b/source/blender/editors/space_text/space_text.c @@ -59,7 +59,7 @@ /* ******************** default callbacks for text space ***************** */ -static SpaceLink *text_new(const bContext *C) +static SpaceLink *text_new(const bContext *UNUSED(C)) { ARegion *ar; SpaceText *stext; @@ -92,11 +92,12 @@ static void text_free(SpaceLink *sl) SpaceText *stext= (SpaceText*) sl; stext->text= NULL; + text_free_caches(stext); } /* spacetype; init callback */ -static void text_init(struct wmWindowManager *wm, ScrArea *sa) +static void text_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa)) { } @@ -104,9 +105,11 @@ static void text_init(struct wmWindowManager *wm, ScrArea *sa) static SpaceLink *text_duplicate(SpaceLink *sl) { SpaceText *stextn= MEM_dupallocN(sl); - + /* clear or remove stuff from old */ - + + stextn->drawcache= NULL; /* space need it's own cache */ + return (SpaceLink *)stextn; } @@ -132,8 +135,11 @@ static void text_listener(ScrArea *sa, wmNotifier *wmn) switch(wmn->action) { case NA_EDITED: - if(st->text) + if(st->text) { + text_drawcache_tag_update(st, 1); text_update_edited(st->text); + } + ED_area_tag_redraw(sa); /* no break -- fall down to tag redraw */ case NA_ADDED: @@ -378,7 +384,7 @@ static void text_main_area_draw(const bContext *C, ARegion *ar) UI_ThemeClearColor(TH_BACK); glClear(GL_COLOR_BUFFER_BIT); - // UI_view2d_view_ortho(C, v2d); + // UI_view2d_view_ortho(v2d); /* data... */ draw_text_main(st, ar); @@ -389,7 +395,7 @@ static void text_main_area_draw(const bContext *C, ARegion *ar) /* scrollers? */ } -static void text_cursor(wmWindow *win, ScrArea *sa, ARegion *ar) +static void text_cursor(wmWindow *win, ScrArea *UNUSED(sa), ARegion *UNUSED(ar)) { WM_cursor_set(win, BC_TEXTEDITCURSOR); } @@ -398,7 +404,7 @@ static void text_cursor(wmWindow *win, ScrArea *sa, ARegion *ar) /* ************* dropboxes ************* */ -static int text_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) +static int text_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event)) { if(drag->type==WM_DRAG_PATH) if(ELEM(drag->icon, 0, ICON_FILE_BLANK)) /* rule might not work? */ @@ -427,7 +433,7 @@ static void text_dropboxes(void) /****************** header region ******************/ /* add handlers, stuff you only do once or on area/region changes */ -static void text_header_area_init(wmWindowManager *wm, ARegion *ar) +static void text_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar) { ED_region_header_init(ar); } diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index be2d993dab5..024eef9092a 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -10,7 +10,6 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License @@ -68,11 +67,11 @@ static void text_font_begin(SpaceText *st) BLF_size(mono, st->lheight, 72); } -static void text_font_end(SpaceText *st) +static void text_font_end(SpaceText *UNUSED(st)) { } -static int text_font_draw(SpaceText *st, int x, int y, char *str) +static int text_font_draw(SpaceText *UNUSED(st), int x, int y, char *str) { BLF_position(mono, x, y, 0); BLF_draw(mono, str); @@ -93,7 +92,7 @@ static int text_font_draw_character(SpaceText *st, int x, int y, char c) return st->cwidth; } -int text_font_width(SpaceText *st, char *str) +int text_font_width(SpaceText *UNUSED(st), char *str) { return BLF_width(mono, str); } @@ -521,9 +520,22 @@ void wrap_offset(SpaceText *st, ARegion *ar, TextLine *linein, int cursin, int * linep= text->lines.first; i= st->top; while(i>0 && linep) { - if(linep == linein) return; /* Line before top */ - linep= linep->next; - i--; + int lines= text_get_visible_lines(st, ar, linep->line); + + /* Line before top */ + if(linep == linein) { + if(lines <= i) + /* no visible part of line */ + return; + } + + if (i-lines<0) { + break; + } else { + linep= linep->next; + (*offl)+= lines-1; + i-= lines; + } } max= wrap_width(st, ar); @@ -548,10 +560,18 @@ void wrap_offset(SpaceText *st, ARegion *ar, TextLine *linein, int cursin, int * while(chars--) { if(i-start>=max) { - if(chop && linep==linein && i >= cursin) + if(chop && linep==linein && i >= cursin) { + if (i==cursin) { + (*offl)++; + *offc -= end-start; + } + return; + } + (*offl)++; *offc -= end-start; + start= end; end += max; chop= 1; @@ -570,7 +590,66 @@ void wrap_offset(SpaceText *st, ARegion *ar, TextLine *linein, int cursin, int * } } -static int get_char_pos(SpaceText *st, char *line, int cur) +void wrap_offset_in_line(SpaceText *st, ARegion *ar, TextLine *linein, int cursin, int *offl, int *offc) +{ + int i, j, start, end, chars, max, chop; + char ch; + + *offl= *offc= 0; + + if(!st->text) return; + if(!st->wordwrap) return; + + max= wrap_width(st, ar); + + start= 0; + end= max; + chop= 1; + chars= 0; + *offc= 0; + + for(i=0, j=0; linein->line[j]!='\0'; j++) { + + /* Mimic replacement of tabs */ + ch= linein->line[j]; + if(ch=='\t') { + chars= st->tabnumber-i%st->tabnumber; + if(i<cursin) cursin += chars-1; + ch= ' '; + } + else + chars= 1; + + while(chars--) { + if(i-start>=max) { + if(chop && i >= cursin) { + if (i==cursin) { + (*offl)++; + *offc -= end-start; + } + + return; + } + + (*offl)++; + *offc -= end-start; + + start= end; + end += max; + chop= 1; + } + else if(ch==' ' || ch=='-') { + end = i+1; + chop= 0; + if(i >= cursin) + return; + } + i++; + } + } +} + +int text_get_char_pos(SpaceText *st, char *line, int cur) { int a=0, i; @@ -583,7 +662,7 @@ static int get_char_pos(SpaceText *st, char *line, int cur) return a; } -static int text_draw_wrapped(SpaceText *st, char *str, int x, int y, int w, char *format) +static int text_draw_wrapped(SpaceText *st, char *str, int x, int y, int w, char *format, int skip) { FlattenString fs; int basex, i, a, len, start, end, max, lines; @@ -599,6 +678,14 @@ static int text_draw_wrapped(SpaceText *st, char *str, int x, int y, int w, char end= max; for(i=0; i<len; i++) { if(i-start >= max) { + /* skip hidden part of line */ + if(skip) { + skip--; + start= end; + end += max; + continue; + } + /* Draw the visible portion of text on the overshot line */ for(a=start; a<end; a++) { if(st->showsyntax && format) format_draw_color(format[a]); @@ -609,6 +696,8 @@ static int text_draw_wrapped(SpaceText *st, char *str, int x, int y, int w, char lines++; start= end; end += max; + + if(y<=0) break; } else if(str[i]==' ' || str[i]=='-') { end = i+1; @@ -616,7 +705,7 @@ static int text_draw_wrapped(SpaceText *st, char *str, int x, int y, int w, char } /* Draw the remaining text */ - for(a=start; a<len; a++) { + for(a=start; a<len && y > 0; a++) { if(st->showsyntax && format) format_draw_color(format[a]); @@ -631,7 +720,7 @@ static int text_draw_wrapped(SpaceText *st, char *str, int x, int y, int w, char static int text_draw(SpaceText *st, char *str, int cshift, int maxwidth, int draw, int x, int y, char *format) { FlattenString fs; - int r=0, w= 0; + int r=0, w= 0, amount; int *acc; char *in; @@ -647,18 +736,26 @@ static int text_draw(SpaceText *st, char *str, int cshift, int maxwidth, int dra if(draw) { if(st->showsyntax && format) { - int amount, a; + int a; format = format+cshift; amount = strlen(in); + if(maxwidth) + amount= MIN2(amount, maxwidth); for(a = 0; a < amount; a++) { format_draw_color(format[a]); x += text_font_draw_character(st, x, y, in[a]); } } - else + else { + amount = strlen(in); + if(maxwidth) + amount= MIN2(amount, maxwidth); + + in[amount]= 0; text_font_draw(st, x, y, in); + } } else { while(w-- && *acc++ < maxwidth) @@ -675,18 +772,307 @@ static int text_draw(SpaceText *st, char *str, int cshift, int maxwidth, int dra return r+TXT_OFFSET; } +/************************ cache utilities *****************************/ + +typedef struct DrawCache { + int *line_height; + int total_lines, nlines; + + /* this is needed to check cache relevance */ + int winx, wordwrap, showlinenrs, tabnumber; + short lheight; + char cwidth; + char text_id[MAX_ID_NAME]; + + /* for partial lines recalculation */ + short update_flag; + int valid_head, valid_tail; /* amount of unchanged lines */ +} DrawCache; + +static void text_drawcache_init(SpaceText *st) +{ + DrawCache *drawcache= MEM_callocN(sizeof (DrawCache), "text draw cache"); + + drawcache->winx= -1; + drawcache->nlines= BLI_countlist(&st->text->lines); + drawcache->text_id[0]= '\0'; + + st->drawcache= drawcache; +} + +static void text_update_drawcache(SpaceText *st, ARegion *ar) +{ + DrawCache *drawcache; + int full_update= 0, nlines= 0; + Text *txt= st->text; + + if(!st->drawcache) text_drawcache_init(st); + + text_update_character_width(st); + + drawcache= (DrawCache *)st->drawcache; + nlines= drawcache->nlines; + + /* check if full cache update is needed */ + full_update|= drawcache->winx != ar->winx; /* area was resized */ + full_update|= drawcache->wordwrap != st->wordwrap; /* word-wrapping option was toggled */ + full_update|= drawcache->showlinenrs != st->showlinenrs; /* word-wrapping option was toggled */ + full_update|= drawcache->tabnumber != st->tabnumber; /* word-wrapping option was toggled */ + full_update|= drawcache->lheight != st->lheight; /* word-wrapping option was toggled */ + full_update|= drawcache->cwidth != st->cwidth; /* word-wrapping option was toggled */ + full_update|= strncmp(drawcache->text_id, txt->id.name, MAX_ID_NAME); /* text datablock was changed */ + + if(st->wordwrap) { + /* update line heights */ + if(full_update || !drawcache->line_height) { + drawcache->valid_head = 0; + drawcache->valid_tail = 0; + drawcache->update_flag = 1; + } + + if(drawcache->update_flag) { + TextLine *line= st->text->lines.first; + int lineno= 0, size, lines_count; + int *fp= drawcache->line_height, *new_tail, *old_tail; + + nlines= BLI_countlist(&txt->lines); + size= sizeof(int)*nlines; + + if(fp) fp= MEM_reallocN(fp, size); + else fp= MEM_callocN(size, "text drawcache line_height"); + + drawcache->valid_tail= drawcache->valid_head= 0; + old_tail= fp + drawcache->nlines - drawcache->valid_tail; + new_tail= fp + nlines - drawcache->valid_tail; + memmove(new_tail, old_tail, drawcache->valid_tail); + + drawcache->total_lines= 0; + + if(st->showlinenrs) + st->linenrs_tot= (int)floor(log10((float)nlines)) + 1; + + while(line) { + if(drawcache->valid_head) { /* we're inside valid head lines */ + lines_count= fp[lineno]; + drawcache->valid_head--; + } else if (lineno > new_tail - fp) { /* we-re inside valid tail lines */ + lines_count= fp[lineno]; + } else { + lines_count= text_get_visible_lines(st, ar, line->line); + } + + fp[lineno]= lines_count; + + line= line->next; + lineno++; + drawcache->total_lines+= lines_count; + } + + drawcache->line_height= fp; + } + } else { + if(drawcache->line_height) { + MEM_freeN(drawcache->line_height); + drawcache->line_height= NULL; + } + + if(full_update || drawcache->update_flag) { + nlines= BLI_countlist(&txt->lines); + + if(st->showlinenrs) + st->linenrs_tot= (int)floor(log10((float)nlines)) + 1; + } + + drawcache->total_lines= nlines; + } + + drawcache->nlines= nlines; + + /* store settings */ + drawcache->winx = ar->winx; + drawcache->wordwrap = st->wordwrap; + drawcache->lheight = st->lheight; + drawcache->cwidth = st->cwidth; + drawcache->showlinenrs = st->showlinenrs; + drawcache->tabnumber = st->tabnumber; + + strncpy(drawcache->text_id, txt->id.name, MAX_ID_NAME); + + /* clear update flag */ + drawcache->update_flag = 0; + drawcache->valid_head = 0; + drawcache->valid_tail = 0; +} + +void text_drawcache_tag_update(SpaceText *st, int full) +{ + DrawCache *drawcache= (DrawCache *)st->drawcache; + + if(drawcache) { + Text *txt= st->text; + + if(drawcache->update_flag) { + /* happens when tagging update from space listener */ + /* should do nothing to prevent locally tagged cache be fully recalculated */ + return; + } + + if(!full) { + int sellno= BLI_findindex(&txt->lines, txt->sell); + int curlno= BLI_findindex(&txt->lines, txt->curl); + + if(curlno < sellno) { + drawcache->valid_head= curlno; + drawcache->valid_tail= drawcache->nlines - sellno - 1; + } else { + drawcache->valid_head= sellno; + drawcache->valid_tail= drawcache->nlines - curlno - 1; + } + + /* quick cache recalculation is also used in delete operator, + which could merge lines which are adjusent to current selection lines + expand recalculate area to this lines */ + if(drawcache->valid_head>0) drawcache->valid_head--; + if(drawcache->valid_tail>0) drawcache->valid_tail--; + } else { + drawcache->valid_head= 0; + drawcache->valid_tail= 0; + } + + drawcache->update_flag= 1; + } +} + +void text_free_caches(SpaceText *st) +{ + DrawCache *drawcache= (DrawCache *)st->drawcache; + + if(drawcache) { + if(drawcache->line_height) + MEM_freeN(drawcache->line_height); + + MEM_freeN(drawcache); + } +} + +/************************ word-wrap utilities *****************************/ + +/* cache should be updated in caller */ +int text_get_visible_lines_no(SpaceText *st, int lineno) +{ + DrawCache *drawcache= (DrawCache *)st->drawcache; + + return drawcache->line_height[lineno]; +} + +int text_get_visible_lines(SpaceText *st, ARegion *ar, char *str) +{ + int i, j, start, end, max, lines, chars; + char ch; + + max= wrap_width(st, ar); + lines= 1; + start= 0; + end= max; + for(i= 0, j= 0; str[j] != '\0'; j++) { + /* Mimic replacement of tabs */ + ch= str[j]; + if(ch=='\t') { + chars= st->tabnumber-i%st->tabnumber; + ch= ' '; + } + else chars= 1; + + while(chars--) { + if(i-start >= max) { + lines++; + start= end; + end += max; + } + else if(ch==' ' || ch=='-') { + end= i+1; + } + + i++; + } + } + + return lines; +} + +int text_get_span_wrap(SpaceText *st, ARegion *ar, TextLine *from, TextLine *to) +{ + if(st->wordwrap) { + int ret=0; + TextLine *tmp= from; + + /* Look forwards */ + while (tmp) { + if (tmp == to) return ret; + ret+= text_get_visible_lines(st, ar, tmp->line); + tmp= tmp->next; + } + + return ret; + } else return txt_get_span(from, to); +} + +int text_get_total_lines(SpaceText *st, ARegion *ar) +{ + DrawCache *drawcache; + + text_update_drawcache(st, ar); + drawcache= (DrawCache *)st->drawcache; + + return drawcache->total_lines; +} + +/* Move pointer to first visible line (top) */ +static TextLine *first_visible_line(SpaceText *st, ARegion *ar, int *wrap_top) +{ + Text *text= st->text; + TextLine* pline= text->lines.first; + int i= st->top, lineno= 0; + DrawCache *drawcache; + + text_update_drawcache(st, ar); + drawcache= (DrawCache *)st->drawcache; + + if(wrap_top) *wrap_top= 0; + + if(st->wordwrap) { + while(i>0 && pline) { + int lines= text_get_visible_lines_no(st, lineno); + + if (i-lines<0) { + if(wrap_top) *wrap_top= i; + break; + } else { + pline= pline->next; + i-= lines; + lineno++; + } + } + } else { + for(i=st->top, pline= text->lines.first; pline->next && i>0; i--) + pline= pline->next; + } + + return pline; +} + /************************ draw scrollbar *****************************/ static void calc_text_rcts(SpaceText *st, ARegion *ar, rcti *scroll) { - int lhlstart, lhlend, ltexth; + int lhlstart, lhlend, ltexth, sell_off, curl_off; short barheight, barstart, hlstart, hlend, blank_lines; short pix_available, pix_top_margin, pix_bottom_margin, pix_bardiff; pix_top_margin = 8; pix_bottom_margin = 4; pix_available = ar->winy - pix_top_margin - pix_bottom_margin; - ltexth= txt_get_span(st->text->lines.first, st->text->lines.last); + ltexth= text_get_total_lines(st, ar); blank_lines = st->viewlines / 2; /* nicer code: use scroll rect for entire bar */ @@ -722,10 +1108,10 @@ static void calc_text_rcts(SpaceText *st, ARegion *ar, rcti *scroll) st->pix_per_line= (pix_available > 0)? (float) ltexth/pix_available: 0; if(st->pix_per_line<.1) st->pix_per_line=.1f; - lhlstart = MIN2(txt_get_span(st->text->lines.first, st->text->curl), - txt_get_span(st->text->lines.first, st->text->sell)); - lhlend = MAX2(txt_get_span(st->text->lines.first, st->text->curl), - txt_get_span(st->text->lines.first, st->text->sell)); + curl_off= text_get_span_wrap(st, ar, st->text->lines.first, st->text->curl); + sell_off= text_get_span_wrap(st, ar, st->text->lines.first, st->text->sell); + lhlstart = MIN2(curl_off, sell_off); + lhlend = MAX2(curl_off, sell_off); if(ltexth > 0) { hlstart = (lhlstart * pix_available)/ltexth; @@ -787,7 +1173,7 @@ static void calc_text_rcts(SpaceText *st, ARegion *ar, rcti *scroll) CLAMP(st->txtscroll.ymax, pix_bottom_margin, ar->winy - pix_top_margin); } -static void draw_textscroll(SpaceText *st, ARegion *ar, rcti *scroll) +static void draw_textscroll(SpaceText *st, rcti *scroll) { bTheme *btheme= U.themes.first; uiWidgetColors wcol= btheme->tui.wcol_scroll; @@ -811,78 +1197,80 @@ static void draw_markers(SpaceText *st, ARegion *ar) { Text *text= st->text; TextMarker *marker, *next; - TextLine *top, *bottom, *line; - int offl, offc, i, cy, x1, x2, y1, y2, x, y; + TextLine *top, *line; + int offl, offc, i, x1, x2, y1, y2, x, y; + int topi, topy; + + /* Move pointer to first visible line (top) */ + top= first_visible_line(st, ar, NULL); + topi= BLI_findindex(&text->lines, top); - for(i=st->top, top= text->lines.first; top->next && i>0; i--) - top= top->next; + topy= txt_get_span(text->lines.first, top); - for(i=st->viewlines-1, bottom=top; bottom->next && i>0; i--) - bottom= bottom->next; - for(marker= text->markers.first; marker; marker= next) { next= marker->next; - for(cy= 0, line= top; line; cy++, line= line->next) { - if(cy+st->top==marker->lineno) { - /* Remove broken markers */ - if(marker->end>line->len || marker->start>marker->end) { - BLI_freelinkN(&text->markers, marker); - break; - } + /* invisible line (before top) */ + if(marker->lineno<topi) continue; - wrap_offset(st, ar, line, marker->start, &offl, &offc); - x1= get_char_pos(st, line->line, marker->start) - st->left + offc; - y1= cy + offl; - wrap_offset(st, ar, line, marker->end, &offl, &offc); - x2= get_char_pos(st, line->line, marker->end) - st->left + offc; - y2= cy + offl; - - glColor3ub(marker->color[0], marker->color[1], marker->color[2]); - x= st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET; - y= ar->winy-3; - - if(y1==y2) { - y -= y1*st->lheight; - glBegin(GL_LINE_LOOP); - glVertex2i(x+x2*st->cwidth+1, y); - glVertex2i(x+x1*st->cwidth-2, y); - glVertex2i(x+x1*st->cwidth-2, y-st->lheight); - glVertex2i(x+x2*st->cwidth+1, y-st->lheight); - glEnd(); - } - else { - y -= y1*st->lheight; - glBegin(GL_LINE_STRIP); - glVertex2i(ar->winx, y); - glVertex2i(x+x1*st->cwidth-2, y); - glVertex2i(x+x1*st->cwidth-2, y-st->lheight); - glVertex2i(ar->winx, y-st->lheight); - glEnd(); - y-=st->lheight; - - for(i=y1+1; i<y2; i++) { - glBegin(GL_LINES); - glVertex2i(x, y); - glVertex2i(ar->winx, y); - glVertex2i(x, y-st->lheight); - glVertex2i(ar->winx, y-st->lheight); - glEnd(); - y-=st->lheight; - } + line= BLI_findlink(&text->lines, marker->lineno); - glBegin(GL_LINE_STRIP); - glVertex2i(x, y); - glVertex2i(x+x2*st->cwidth+1, y); - glVertex2i(x+x2*st->cwidth+1, y-st->lheight); - glVertex2i(x, y-st->lheight); - glEnd(); - } + /* Remove broken markers */ + if(marker->end>line->len || marker->start>marker->end) { + BLI_freelinkN(&text->markers, marker); + continue; + } - break; + wrap_offset(st, ar, line, marker->start, &offl, &offc); + y1 = txt_get_span(top, line) - st->top + offl + topy; + x1 = text_get_char_pos(st, line->line, marker->start) - st->left + offc; + + wrap_offset(st, ar, line, marker->end, &offl, &offc); + y2 = txt_get_span(top, line) - st->top + offl + topy; + x2 = text_get_char_pos(st, line->line, marker->end) - st->left + offc; + + /* invisible part of line (before top, after last visible line) */ + if(y2 < 0 || y1 > st->top+st->viewlines) continue; + + glColor3ub(marker->color[0], marker->color[1], marker->color[2]); + x= st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET; + y= ar->winy-3; + + if(y1==y2) { + y -= y1*st->lheight; + glBegin(GL_LINE_LOOP); + glVertex2i(x+x2*st->cwidth+1, y); + glVertex2i(x+x1*st->cwidth-2, y); + glVertex2i(x+x1*st->cwidth-2, y-st->lheight); + glVertex2i(x+x2*st->cwidth+1, y-st->lheight); + glEnd(); + } + else { + y -= y1*st->lheight; + glBegin(GL_LINE_STRIP); + glVertex2i(ar->winx, y); + glVertex2i(x+x1*st->cwidth-2, y); + glVertex2i(x+x1*st->cwidth-2, y-st->lheight); + glVertex2i(ar->winx, y-st->lheight); + glEnd(); + y-=st->lheight; + + for(i=y1+1; i<y2; i++) { + glBegin(GL_LINES); + glVertex2i(x, y); + glVertex2i(ar->winx, y); + glVertex2i(x, y-st->lheight); + glVertex2i(ar->winx, y-st->lheight); + glEnd(); + y-=st->lheight; } - if(line==bottom) break; + glBegin(GL_LINE_STRIP); + glVertex2i(x, y); + glVertex2i(x+x2*st->cwidth+1, y); + glVertex2i(x+x2*st->cwidth+1, y-st->lheight); + glVertex2i(x, y-st->lheight); + glEnd(); } } } @@ -1058,16 +1446,16 @@ static void draw_cursor(SpaceText *st, ARegion *ar) Text *text= st->text; int vcurl, vcurc, vsell, vselc, hidden=0; int offl, offc, x, y, w, i; - + /* Draw the selection */ if(text->curl!=text->sell || text->curc!=text->selc) { /* Convert all to view space character coordinates */ wrap_offset(st, ar, text->curl, text->curc, &offl, &offc); vcurl = txt_get_span(text->lines.first, text->curl) - st->top + offl; - vcurc = get_char_pos(st, text->curl->line, text->curc) - st->left + offc; + vcurc = text_get_char_pos(st, text->curl->line, text->curc) - st->left + offc; wrap_offset(st, ar, text->sell, text->selc, &offl, &offc); vsell = txt_get_span(text->lines.first, text->sell) - st->top + offl; - vselc = get_char_pos(st, text->sell->line, text->selc) - st->left + offc; + vselc = text_get_char_pos(st, text->sell->line, text->selc) - st->left + offc; if(vcurc<0) vcurc=0; if(vselc<0) vselc=0, hidden=1; @@ -1106,7 +1494,7 @@ static void draw_cursor(SpaceText *st, ARegion *ar) else { wrap_offset(st, ar, text->sell, text->selc, &offl, &offc); vsell = txt_get_span(text->lines.first, text->sell) - st->top + offl; - vselc = get_char_pos(st, text->sell->line, text->selc) - st->left + offc; + vselc = text_get_char_pos(st, text->sell->line, text->selc) - st->left + offc; if(vselc<0) { vselc= 0; @@ -1115,17 +1503,30 @@ static void draw_cursor(SpaceText *st, ARegion *ar) } if(st->line_hlight) { - y= ar->winy-2 - vsell*st->lheight; - if(!(y<0 || y > ar->winy)) { /* check we need to draw */ - int x1= st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET; - int x2= x1 + ar->winx; - y= ar->winy-2 - vsell*st->lheight; - + int x1, x2, y1, y2; + + if(st->wordwrap) { + int visible_lines = text_get_visible_lines(st, ar, text->sell->line); + int offl, offc; + + wrap_offset_in_line(st, ar, text->sell, text->selc, &offl, &offc); + + y1= ar->winy-2 - (vsell-offl)*st->lheight; + y2= y1-st->lheight*visible_lines+1; + } else { + y1= ar->winy-2 - vsell*st->lheight; + y2= y1-st->lheight+1; + } + + if(!(y1<0 || y2 > ar->winy)) { /* check we need to draw */ + x1= st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET; + x2= x1 + ar->winx; + glColor4ub(255, 255, 255, 32); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); - glRecti(x1-4, y, x2, y-st->lheight+1); + glRecti(x1-4, y1, x2, y2); glDisable(GL_BLEND); } } @@ -1138,8 +1539,10 @@ static void draw_cursor(SpaceText *st, ARegion *ar) if(st->overwrite) { char ch= text->sell->line[text->selc]; - if(!ch) ch= ' '; + w= st->cwidth; + if(ch=='\t') w*= st->tabnumber-(vselc+st->left)%st->tabnumber; + UI_ThemeColor(TH_HILITE); glRecti(x, y-st->lheight-1, x+w, y-st->lheight+1); } @@ -1243,7 +1646,7 @@ static void draw_brackets(SpaceText *st, ARegion *ar) /* draw opening bracket */ ch= startl->line[startc]; wrap_offset(st, ar, startl, startc, &offl, &offc); - viewc= get_char_pos(st, startl->line, startc) - st->left + offc; + viewc= text_get_char_pos(st, startl->line, startc) - st->left + offc; if(viewc >= 0){ viewl= txt_get_span(text->lines.first, startl) - st->top + offl; @@ -1255,7 +1658,7 @@ static void draw_brackets(SpaceText *st, ARegion *ar) /* draw closing bracket */ ch= endl->line[endc]; wrap_offset(st, ar, endl, endc, &offl, &offc); - viewc= get_char_pos(st, endl->line, endc) - st->left + offc; + viewc= text_get_char_pos(st, endl->line, endc) - st->left + offc; if(viewc >= 0) { viewl= txt_get_span(text->lines.first, endl) - st->top + offl; @@ -1273,12 +1676,15 @@ void draw_text_main(SpaceText *st, ARegion *ar) TextLine *tmp; rcti scroll; char linenr[12]; - int i, x, y, winx, linecount= 0; + int i, x, y, winx, linecount= 0, lineno= 0; + int wraplinecount= 0, wrap_skip= 0; /* if no text, nothing to do */ if(!text) return; + text_update_drawcache(st, ar); + /* make sure all the positional pointers exist */ if(!text->curl || !text->sell || !text->lines.first || !text->lines.last) txt_clean_text(text); @@ -1291,12 +1697,28 @@ void draw_text_main(SpaceText *st, ARegion *ar) /* update syntax formatting if needed */ tmp= text->lines.first; + lineno= 0; for(i= 0; i<st->top && tmp; i++) { if(st->showsyntax && !tmp->format) txt_format_line(st, tmp, 0); - tmp= tmp->next; - linecount++; + if(st->wordwrap) { + int lines= text_get_visible_lines_no(st, lineno); + + if (wraplinecount+lines>st->top) { + wrap_skip= st->top-wraplinecount; + break; + } else { + wraplinecount+= lines; + tmp= tmp->next; + linecount++; + } + } else { + tmp= tmp->next; + linecount++; + } + + lineno++; } text_font_begin(st); @@ -1305,7 +1727,6 @@ void draw_text_main(SpaceText *st, ARegion *ar) /* draw line numbers background */ if(st->showlinenrs) { - st->linenrs_tot = (int)floor(log10((float)(linecount + st->viewlines))) + 1; x= TXT_OFFSET + TEXTXLOC; UI_ThemeColor(TH_GRID); @@ -1328,7 +1749,7 @@ void draw_text_main(SpaceText *st, ARegion *ar) if(st->showsyntax && !tmp->format) txt_format_line(st, tmp, 0); - if(st->showlinenrs) { + if(st->showlinenrs && !wrap_skip) { /* draw line number */ if(tmp == text->curl) UI_ThemeColor(TH_HILITE); @@ -1344,21 +1765,23 @@ void draw_text_main(SpaceText *st, ARegion *ar) if(st->wordwrap) { /* draw word wrapped text */ - int lines = text_draw_wrapped(st, tmp->line, x, y, winx-x, tmp->format); + int lines = text_draw_wrapped(st, tmp->line, x, y, winx-x, tmp->format, wrap_skip); y -= lines*st->lheight; } else { /* draw unwrapped text */ - text_draw(st, tmp->line, st->left, 0, 1, x, y, tmp->format); + text_draw(st, tmp->line, st->left, ar->winx/st->cwidth, 1, x, y, tmp->format); y -= st->lheight; } + + wrap_skip= 0; } /* draw other stuff */ draw_brackets(st, ar); draw_markers(st, ar); glTranslatef(0.375f, 0.375f, 0.0f); /* XXX scroll requires exact pixel space */ - draw_textscroll(st, ar, &scroll); + draw_textscroll(st, &scroll); draw_documentation(st, ar); draw_suggestion_list(st, ar); @@ -1398,6 +1821,12 @@ void text_update_cursor_moved(bContext *C) text_update_character_width(st); i= txt_get_span(text->lines.first, text->sell); + if(st->wordwrap) { + int offl, offc; + wrap_offset(st, CTX_wm_region(C), text->sell, text->selc, &offl, &offc); + i+= offl; + } + if(st->top+st->viewlines <= i || st->top > i) st->top= i - st->viewlines/2; diff --git a/source/blender/editors/space_text/text_header.c b/source/blender/editors/space_text/text_header.c index 672940cf3cb..464e144515f 100644 --- a/source/blender/editors/space_text/text_header.c +++ b/source/blender/editors/space_text/text_header.c @@ -101,7 +101,7 @@ static int properties_poll(bContext *C) return (CTX_wm_space_text(C) != NULL); } -static int properties_exec(bContext *C, wmOperator *op) +static int properties_exec(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); ARegion *ar= text_has_properties_region(sa); diff --git a/source/blender/editors/space_text/text_intern.h b/source/blender/editors/space_text/text_intern.h index a93f30ac62a..c229e685aba 100644 --- a/source/blender/editors/space_text/text_intern.h +++ b/source/blender/editors/space_text/text_intern.h @@ -53,7 +53,7 @@ int text_check_whitespace(char ch); int text_font_width_character(struct SpaceText *st); int text_font_width(struct SpaceText *st, char *str); -void text_update_line_edited(struct Text *text, struct TextLine *line); +void text_update_line_edited(struct TextLine *line); void text_update_edited(struct Text *text); void text_update_character_width(struct SpaceText *st); void text_update_cursor_moved(struct bContext *C); @@ -90,12 +90,20 @@ void flatten_string_free(FlattenString *fs); int wrap_width(struct SpaceText *st, struct ARegion *ar); void wrap_offset(struct SpaceText *st, struct ARegion *ar, struct TextLine *linein, int cursin, int *offl, int *offc); +void wrap_offset_in_line(struct SpaceText *st, struct ARegion *ar, struct TextLine *linep, int cursin, int *offl, int *offc); +int text_get_char_pos(struct SpaceText *st, char *line, int cur); + +void text_drawcache_tag_update(struct SpaceText *st, int full); +void text_free_caches(struct SpaceText *st); int text_file_modified(struct Text *text); int text_do_suggest_select(struct SpaceText *st, struct ARegion *ar); void text_pop_suggest_list(); +int text_get_visible_lines(struct SpaceText *st, struct ARegion *ar, char *str); +int text_get_span_wrap(struct SpaceText *st, struct ARegion *ar, struct TextLine *from, struct TextLine *to); +int text_get_total_lines(struct SpaceText *st, struct ARegion *ar); /* text_ops.c */ enum { LINE_BEGIN, LINE_END, FILE_TOP, FILE_BOTTOM, PREV_CHAR, NEXT_CHAR, diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index e3bf390dba8..8d4f3f87f66 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -66,7 +66,7 @@ /************************ poll ***************************/ -static int text_new_poll(bContext *C) +static int text_new_poll(bContext *UNUSED(C)) { return 1; } @@ -125,7 +125,7 @@ static int text_region_edit_poll(bContext *C) /********************** updates *********************/ -void text_update_line_edited(Text *text, TextLine *line) +void text_update_line_edited(TextLine *line) { if(!line) return; @@ -142,12 +142,12 @@ void text_update_edited(Text *text) TextLine *line; for(line=text->lines.first; line; line=line->next) - text_update_line_edited(text, line); + text_update_line_edited(line); } /******************* new operator *********************/ -static int new_exec(bContext *C, wmOperator *op) +static int new_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceText *st= CTX_wm_space_text(C); Text *text; @@ -173,6 +173,7 @@ static int new_exec(bContext *C, wmOperator *op) st->top= 0; } + text_drawcache_tag_update(st, 1); WM_event_add_notifier(C, NC_TEXT|NA_ADDED, text); return OPERATOR_FINISHED; @@ -203,7 +204,7 @@ static void open_init(bContext *C, wmOperator *op) uiIDContextProperty(C, &pprop->ptr, &pprop->prop); } -static int open_cancel(bContext *C, wmOperator *op) +static int open_cancel(bContext *UNUSED(C), wmOperator *op) { MEM_freeN(op->customdata); return OPERATOR_CANCELLED; @@ -220,7 +221,7 @@ static int open_exec(bContext *C, wmOperator *op) RNA_string_get(op->ptr, "filepath", str); - text= add_text(str, G.sce); + text= add_text(str, G.main->name); if(!text) { if(op->customdata) MEM_freeN(op->customdata); @@ -254,6 +255,7 @@ static int open_exec(bContext *C, wmOperator *op) text->name = NULL; } + text_drawcache_tag_update(st, 1); WM_event_add_notifier(C, NC_TEXT|NA_ADDED, text); MEM_freeN(op->customdata); @@ -261,10 +263,10 @@ static int open_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int open_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Text *text= CTX_data_edit_text(C); - char *path= (text && text->name)? text->name: G.sce; + char *path= (text && text->name)? text->name: G.main->name; if(RNA_property_is_set(op->ptr, "filepath")) return open_exec(C, op); @@ -315,6 +317,7 @@ static int reload_exec(bContext *C, wmOperator *op) text_update_edited(text); text_update_cursor_moved(C); + text_drawcache_tag_update(CTX_wm_space_text(C), 1); WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text); return OPERATOR_FINISHED; @@ -335,7 +338,7 @@ void TEXT_OT_reload(wmOperatorType *ot) /******************* delete operator *********************/ -static int unlink_exec(bContext *C, wmOperator *op) +static int unlink_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); SpaceText *st= CTX_wm_space_text(C); @@ -357,6 +360,8 @@ static int unlink_exec(bContext *C, wmOperator *op) unlink_text(bmain, text); free_libblock(&bmain->text, text); + + text_drawcache_tag_update(st, 1); WM_event_add_notifier(C, NC_TEXT|NA_REMOVED, NULL); return OPERATOR_FINISHED; @@ -380,7 +385,7 @@ void TEXT_OT_unlink(wmOperatorType *ot) /******************* make internal operator *********************/ -static int make_internal_exec(bContext *C, wmOperator *op) +static int make_internal_exec(bContext *C, wmOperator *UNUSED(op)) { Text *text= CTX_data_edit_text(C); @@ -433,7 +438,7 @@ static void txt_write_file(Text *text, ReportList *reports) char file[FILE_MAXDIR+FILE_MAXFILE]; BLI_strncpy(file, text->name, FILE_MAXDIR+FILE_MAXFILE); - BLI_path_abs(file, G.sce); + BLI_path_abs(file, G.main->name); fp= fopen(file, "w"); if(fp==NULL) { @@ -506,7 +511,7 @@ static int save_as_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int save_as_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int save_as_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Text *text= CTX_data_edit_text(C); char *str; @@ -519,7 +524,7 @@ static int save_as_invoke(bContext *C, wmOperator *op, wmEvent *event) else if(text->flags & TXT_ISMEM) str= text->id.name+2; else - str= G.sce; + str= G.main->name; RNA_string_set(op->ptr, "filepath", str); WM_event_add_fileselect(C, op); @@ -588,7 +593,7 @@ void TEXT_OT_run_script(wmOperatorType *ot) /******************* refresh pyconstraints operator *********************/ -static int refresh_pyconstraints_exec(bContext *C, wmOperator *op) +static int refresh_pyconstraints_exec(bContext *UNUSED(C), wmOperator *UNUSED(op)) { #ifndef DISABLE_PYTHON #if 0 @@ -738,6 +743,8 @@ static int paste_exec(bContext *C, wmOperator *op) if(!buf) return OPERATOR_CANCELLED; + text_drawcache_tag_update(CTX_wm_space_text(C), 0); + txt_insert_buf(text, buf); text_update_edited(text); @@ -782,7 +789,7 @@ static void txt_copy_clipboard(Text *text) } } -static int copy_exec(bContext *C, wmOperator *op) +static int copy_exec(bContext *C, wmOperator *UNUSED(op)) { Text *text= CTX_data_edit_text(C); @@ -809,6 +816,8 @@ static int cut_exec(bContext *C, wmOperator *op) { Text *text= CTX_data_edit_text(C); + text_drawcache_tag_update(CTX_wm_space_text(C), 0); + txt_copy_clipboard(text); txt_delete_selected(text); @@ -836,10 +845,12 @@ void TEXT_OT_cut(wmOperatorType *ot) /******************* indent operator *********************/ -static int indent_exec(bContext *C, wmOperator *op) +static int indent_exec(bContext *C, wmOperator *UNUSED(op)) { Text *text= CTX_data_edit_text(C); + text_drawcache_tag_update(CTX_wm_space_text(C), 0); + if(txt_has_sel(text)) { txt_order_cursors(text); indent(text); @@ -869,11 +880,13 @@ void TEXT_OT_indent(wmOperatorType *ot) /******************* unindent operator *********************/ -static int unindent_exec(bContext *C, wmOperator *op) +static int unindent_exec(bContext *C, wmOperator *UNUSED(op)) { Text *text= CTX_data_edit_text(C); if(txt_has_sel(text)) { + text_drawcache_tag_update(CTX_wm_space_text(C), 0); + txt_order_cursors(text); unindent(text); @@ -902,13 +915,15 @@ void TEXT_OT_unindent(wmOperatorType *ot) /******************* line break operator *********************/ -static int line_break_exec(bContext *C, wmOperator *op) +static int line_break_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceText *st= CTX_wm_space_text(C); Text *text= CTX_data_edit_text(C); int a, curts; int space = (text->flags & TXT_TABSTOSPACES) ? st->tabnumber : 1; + text_drawcache_tag_update(st, 0); + // double check tabs/spaces before splitting the line curts= setcurr_tab_spaces(text, space); txt_split_curline(text); @@ -923,8 +938,8 @@ static int line_break_exec(bContext *C, wmOperator *op) if(text->curl) { if(text->curl->prev) - text_update_line_edited(text, text->curl->prev); - text_update_line_edited(text, text->curl); + text_update_line_edited(text->curl->prev); + text_update_line_edited(text->curl); } text_update_cursor_moved(C); @@ -947,11 +962,13 @@ void TEXT_OT_line_break(wmOperatorType *ot) /******************* comment operator *********************/ -static int comment_exec(bContext *C, wmOperator *op) +static int comment_exec(bContext *C, wmOperator *UNUSED(op)) { Text *text= CTX_data_edit_text(C); if(txt_has_sel(text)) { + text_drawcache_tag_update(CTX_wm_space_text(C), 0); + txt_order_cursors(text); comment(text); text_update_edited(text); @@ -978,11 +995,13 @@ void TEXT_OT_comment(wmOperatorType *ot) /******************* uncomment operator *********************/ -static int uncomment_exec(bContext *C, wmOperator *op) +static int uncomment_exec(bContext *C, wmOperator *UNUSED(op)) { Text *text= CTX_data_edit_text(C); if(txt_has_sel(text)) { + text_drawcache_tag_update(CTX_wm_space_text(C), 0); + txt_order_cursors(text); uncomment(text); text_update_edited(text); @@ -1130,6 +1149,7 @@ static int convert_whitespace_exec(bContext *C, wmOperator *op) text_update_edited(text); text_update_cursor_moved(C); + text_drawcache_tag_update(st, 1); WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text); return OPERATOR_FINISHED; @@ -1152,7 +1172,7 @@ void TEXT_OT_convert_whitespace(wmOperatorType *ot) /******************* select all operator *********************/ -static int select_all_exec(bContext *C, wmOperator *op) +static int select_all_exec(bContext *C, wmOperator *UNUSED(op)) { Text *text= CTX_data_edit_text(C); @@ -1178,7 +1198,7 @@ void TEXT_OT_select_all(wmOperatorType *ot) /******************* select line operator *********************/ -static int select_line_exec(bContext *C, wmOperator *op) +static int select_line_exec(bContext *C, wmOperator *UNUSED(op)) { Text *text= CTX_data_edit_text(C); @@ -1204,7 +1224,7 @@ void TEXT_OT_select_line(wmOperatorType *ot) /******************* previous marker operator *********************/ -static int previous_marker_exec(bContext *C, wmOperator *op) +static int previous_marker_exec(bContext *C, wmOperator *UNUSED(op)) { Text *text= CTX_data_edit_text(C); TextMarker *mrk; @@ -1240,7 +1260,7 @@ void TEXT_OT_previous_marker(wmOperatorType *ot) /******************* next marker operator *********************/ -static int next_marker_exec(bContext *C, wmOperator *op) +static int next_marker_exec(bContext *C, wmOperator *UNUSED(op)) { Text *text= CTX_data_edit_text(C); TextMarker *mrk; @@ -1276,7 +1296,7 @@ void TEXT_OT_next_marker(wmOperatorType *ot) /******************* clear all markers operator *********************/ -static int clear_all_markers_exec(bContext *C, wmOperator *op) +static int clear_all_markers_exec(bContext *C, wmOperator *UNUSED(op)) { Text *text= CTX_data_edit_text(C); @@ -1317,146 +1337,360 @@ static EnumPropertyItem move_type_items[]= { {NEXT_PAGE, "NEXT_PAGE", 0, "Next Page", ""}, {0, NULL, 0, NULL, NULL}}; +/* get cursor position in line by relative wrapped line and column positions */ +static int text_get_cursor_rel(SpaceText* st, ARegion *ar, TextLine *linein, int rell, int relc) +{ + int i, j, start, end, chars, max, chop, curs, loop, endj, found, selc; + char ch; + + max= wrap_width(st, ar); + + selc= start= chars= endj= curs= found= 0; + end= max; + chop= loop= 1; + + for(i=0, j=0; loop; j++) { + /* Mimic replacement of tabs */ + ch= linein->line[j]; + if(ch=='\t') { + chars= st->tabnumber-i%st->tabnumber; + ch= ' '; + } + else chars= 1; + + while(chars--) { + if(rell==0 && i-start==relc) { + /* current position could be wrapped to next line */ + /* this should be checked when end of current line would be reached */ + selc= j; + found= 1; + } + else if(i-end==relc) { + curs= j; + } + if(i-start>=max) { + if(found) { + /* exact cursor position was found, check if it's */ + /* still on needed line (hasn't been wrapped) */ + if(selc>endj && !chop) selc= endj; + loop= 0; + break; + } + + if(chop) endj= j; + + start= end; + end += max; + chop= 1; + rell--; + + if(rell==0 && i-start>=relc) { + selc= curs; + loop= 0; + break; + } + } + else if (ch=='\0') { + if(!found) selc= linein->len; + loop= 0; + break; + } + else if(ch==' ' || ch=='-') { + if(found) { + loop= 0; + break; + } + + if(rell==0 && i-start>=relc) { + selc= curs; + loop= 0; + break; + } + end= i+1; + endj= j; + chop= 0; + } + i++; + } + } + + return selc; +} + +static int cursor_skip_find_line(SpaceText* st, ARegion *ar, + int lines, TextLine **linep, int *charp, int *rell, int *relc) +{ + int offl, offc, visible_lines; + + wrap_offset_in_line(st, ar, *linep, *charp, &offl, &offc); + *relc= text_get_char_pos(st, (*linep)->line, *charp) + offc; + *rell= lines; + + /* handle current line */ + if(lines>0) { + visible_lines= text_get_visible_lines(st, ar, (*linep)->line); + + if(*rell-visible_lines+offl>=0) { + if(!(*linep)->next) { + if(offl < visible_lines-1) { + *rell= visible_lines-1; + return 1; + } + + *charp= (*linep)->len; + return 0; + } + + *rell-= visible_lines-offl; + *linep=(*linep)->next; + } else { + *rell+= offl; + return 1; + } + } else { + if(*rell+offl<=0) { + if(!(*linep)->prev) { + if(offl) { + *rell= 0; + return 1; + } + + *charp= 0; + return 0; + } + + *rell+= offl; + *linep=(*linep)->prev; + } else { + *rell+= offl; + return 1; + } + } + + /* skip lines and find destination line and offsets */ + while(*linep) { + visible_lines= text_get_visible_lines(st, ar, (*linep)->line); + + if(lines<0) { /* moving top */ + if(*rell+visible_lines >= 0) { + *rell+= visible_lines; + break; + } + + if(!(*linep)->prev) { + *rell= 0; + break; + } + + *rell+= visible_lines; + *linep=(*linep)->prev; + } else { /* moving bottom */ + if(*rell-visible_lines < 0) break; + + if(!(*linep)->next) { + *rell= visible_lines-1; + break; + } + + *rell-= visible_lines; + *linep=(*linep)->next; + } + } + + return 1; +} + static void wrap_move_bol(SpaceText *st, ARegion *ar, short sel) { Text *text= st->text; - int offl, offc, lin; + TextLine **linep; + int *charp; + int oldl, oldc, i, j, max, start, end, chars, endj, chop, loop; + char ch; text_update_character_width(st); - lin= txt_get_span(text->lines.first, text->sell); - wrap_offset(st, ar, text->sell, text->selc, &offl, &offc); + if (sel) linep= &text->sell, charp= &text->selc; + else linep= &text->curl, charp= &text->curc; - if (sel) { - txt_undo_add_toop(text, UNDO_STO, lin, text->selc, lin, -offc); - text->selc= -offc; - } else { - txt_undo_add_toop(text, UNDO_CTO, lin, text->curc, lin, -offc); - text->curc= -offc; - txt_pop_sel(text); + oldc= *charp; + oldl= txt_get_span(text->lines.first, *linep); + + max= wrap_width(st, ar); + + start= chars= endj= 0; + end= max; + chop= loop= 1; + *charp= 0; + + for(i=0, j=0; loop; j++) { + /* Mimic replacement of tabs */ + ch= (*linep)->line[j]; + if(ch=='\t') { + chars= st->tabnumber-i%st->tabnumber; + ch= ' '; + } + else chars= 1; + + while(chars--) { + if(i-start>=max) { + *charp= endj; + + if(j>=oldc) { + loop= 0; + break; + } + + if(chop) endj= j; + + start= end; + end += max; + chop= 0; + } + else if(ch==' ' || ch=='-' || ch=='\0') { + if(j>=oldc) { + loop= 0; + break; + } + + end= i+1; + endj= j+1; + chop= 0; + } + i++; + } } + + if (!sel) txt_pop_sel(text); + txt_undo_add_toop(text, sel?UNDO_STO:UNDO_CTO, oldl, oldc, oldl, *charp); } static void wrap_move_eol(SpaceText *st, ARegion *ar, short sel) { Text *text= st->text; - int offl, offc, lin, startl, c; + TextLine **linep; + int *charp; + int oldl, oldc, i, j, max, start, end, chars, endj, chop, loop; + char ch; text_update_character_width(st); - lin= txt_get_span(text->lines.first, text->sell); - wrap_offset(st, ar, text->sell, text->selc, &offl, &offc); - startl= offl; - c= text->selc; - while (offl==startl && text->sell->line[c]!='\0') { - c++; - wrap_offset(st, ar, text->sell, c, &offl, &offc); - } if (offl!=startl) c--; - - if (sel) { - txt_undo_add_toop(text, UNDO_STO, lin, text->selc, lin, c); - text->selc= c; - } else { - txt_undo_add_toop(text, UNDO_CTO, lin, text->curc, lin, c); - text->curc= c; - txt_pop_sel(text); + if (sel) linep= &text->sell, charp= &text->selc; + else linep= &text->curl, charp= &text->curc; + + oldc= *charp; + oldl= txt_get_span(text->lines.first, *linep); + + max= wrap_width(st, ar); + + start= chars= endj= 0; + end= max; + chop= loop= 1; + *charp= 0; + + for(i=0, j=0; loop; j++) { + /* Mimic replacement of tabs */ + ch= (*linep)->line[j]; + if(ch=='\t') { + chars= st->tabnumber-i%st->tabnumber; + ch= ' '; + } + else chars= 1; + + while(chars--) { + if(i-start>=max) { + if(endj>=oldc) { + *charp= endj; + loop= 0; + break; + } + + if(chop) endj= j; + + start= end; + end += max; + chop= 0; + } else if(ch=='\0') { + *charp= (*linep)->len; + loop= 0; + break; + } else if(ch==' ' || ch=='-') { + end= i+1; + endj= j; + chop= 0; + } + i++; + } } + + if (!sel) txt_pop_sel(text); + txt_undo_add_toop(text, sel?UNDO_STO:UNDO_CTO, oldl, oldc, oldl, *charp); } static void wrap_move_up(SpaceText *st, ARegion *ar, short sel) { Text *text= st->text; - int offl, offl_1, offc, fromline, toline, c, target; + TextLine **linep; + int *charp; + int oldl, oldc, offl, offc, col, newl; text_update_character_width(st); - wrap_offset(st, ar, text->sell, 0, &offl_1, &offc); - wrap_offset(st, ar, text->sell, text->selc, &offl, &offc); - fromline= toline= txt_get_span(text->lines.first, text->sell); - target= text->selc + offc; + if (sel) linep= &text->sell, charp= &text->selc; + else linep= &text->curl, charp= &text->curc; - if (offl==offl_1) { - if (!text->sell->prev) { - txt_move_bol(text, sel); - return; - } - toline--; - c= text->sell->prev->len; /* End of prev. line */ - wrap_offset(st, ar, text->sell->prev, c, &offl, &offc); - c= -offc+target; + /* store previous position */ + oldc= *charp; + newl= oldl= txt_get_span(text->lines.first, *linep); + + wrap_offset_in_line(st, ar, *linep, *charp, &offl, &offc); + col= text_get_char_pos(st, (*linep)->line, *charp) + offc; + if(offl) { + *charp= text_get_cursor_rel(st, ar, *linep, offl-1, col); } else { - c= -offc-1; /* End of prev. line */ - wrap_offset(st, ar, text->sell, c, &offl, &offc); - c= -offc+target; - } - if (c<0) c=0; - - if (sel) { - txt_undo_add_toop(text, UNDO_STO, fromline, text->selc, toline, c); - if (toline<fromline) text->sell= text->sell->prev; - if(text->sell) { - if (c>text->sell->len) c= text->sell->len; - text->selc= c; - } - } - else if(text->curl) { - txt_undo_add_toop(text, UNDO_CTO, fromline, text->curc, toline, c); - if (toline<fromline) text->curl= text->curl->prev; - if(text->curl) { - if (c>text->curl->len) c= text->curl->len; - text->curc= c; - txt_pop_sel(text); - } + if((*linep)->prev) { + int visible_lines; + + *linep= (*linep)->prev; + visible_lines= text_get_visible_lines(st, ar, (*linep)->line); + *charp= text_get_cursor_rel(st, ar, *linep, visible_lines-1, col); + } else *charp= 0; } + + if (!sel) txt_pop_sel(text); + txt_undo_add_toop(text, sel?UNDO_STO:UNDO_CTO, oldl, oldc, newl, *charp); } static void wrap_move_down(SpaceText *st, ARegion *ar, short sel) { Text *text= st->text; - int offl, startoff, offc, fromline, toline, c, target; + TextLine **linep; + int *charp; + int oldl, oldc, offl, offc, col, newl, visible_lines; text_update_character_width(st); - wrap_offset(st, ar, text->sell, text->selc, &offl, &offc); - fromline= toline= txt_get_span(text->lines.first, text->sell); - target= text->selc + offc; - startoff= offl; - c= text->selc; - while (offl==startoff && text->sell->line[c]!='\0') { - c++; - wrap_offset(st, ar, text->sell, c, &offl, &offc); - } + if (sel) linep= &text->sell, charp= &text->selc; + else linep= &text->curl, charp= &text->curc; - if (text->sell->line[c]=='\0') { - if (!text->sell->next) { - txt_move_eol(text, sel); - return; - } - toline++; - c= target; + /* store previous position */ + oldc= *charp; + newl= oldl= txt_get_span(text->lines.first, *linep); + + wrap_offset_in_line(st, ar, *linep, *charp, &offl, &offc); + col= text_get_char_pos(st, (*linep)->line, *charp) + offc; + visible_lines= text_get_visible_lines(st, ar, (*linep)->line); + if(offl<visible_lines-1) { + *charp= text_get_cursor_rel(st, ar, *linep, offl+1, col); } else { - c += target; - if (c > text->sell->len) c= text->sell->len; - } - if (c<0) c=0; - - if (sel) { - txt_undo_add_toop(text, UNDO_STO, fromline, text->selc, toline, c); - if (toline>fromline) text->sell= text->sell->next; - if(text->sell) { - if (c>text->sell->len) c= text->sell->len; - text->selc= c; - } - } - else if(text->curl) { - txt_undo_add_toop(text, UNDO_CTO, fromline, text->curc, toline, c); - if (toline>fromline) text->curl= text->curl->next; - if(text->curl) { - if (c > text->curl->len) c= text->curl->len; - text->curc= c; - txt_pop_sel(text); - } + if((*linep)->next) { + *linep= (*linep)->next; + *charp= text_get_cursor_rel(st, ar, *linep, 0, col); + } else *charp= (*linep)->len; } + + if (!sel) txt_pop_sel(text); + txt_undo_add_toop(text, sel?UNDO_STO:UNDO_CTO, oldl, oldc, newl, *charp); } /* Moves the cursor vertically by the specified number of lines. @@ -1465,7 +1699,7 @@ static void wrap_move_down(SpaceText *st, ARegion *ar, short sel) This is to replace screen_skip for PageUp/Down operations. */ -static void cursor_skip(Text *text, int lines, int sel) +static void cursor_skip(SpaceText* st, ARegion *ar, Text *text, int lines, int sel) { TextLine **linep; int oldl, oldc, *charp; @@ -1475,13 +1709,21 @@ static void cursor_skip(Text *text, int lines, int sel) oldl= txt_get_span(text->lines.first, *linep); oldc= *charp; - while (lines>0 && (*linep)->next) { - *linep= (*linep)->next; - lines--; - } - while (lines<0 && (*linep)->prev) { - *linep= (*linep)->prev; - lines++; + if(st && ar && st->wordwrap) { + int rell, relc; + + /* find line and offsets inside it needed to set cursor position */ + if(cursor_skip_find_line(st, ar, lines, linep, charp, &rell, &relc)) + *charp= text_get_cursor_rel (st, ar, *linep, rell, relc); + } else { + while (lines>0 && (*linep)->next) { + *linep= (*linep)->next; + lines--; + } + while (lines<0 && (*linep)->prev) { + *linep= (*linep)->prev; + lines++; + } } if (*charp > (*linep)->len) *charp= (*linep)->len; @@ -1546,18 +1788,18 @@ static int move_cursor(bContext *C, int type, int select) break; case PREV_PAGE: - if(st) cursor_skip(text, -st->viewlines, select); - else cursor_skip(text, -10, select); + if(st) cursor_skip(st, ar, st->text, -st->viewlines, select); + else cursor_skip(NULL, NULL, text, -10, select); break; case NEXT_PAGE: - if(st) cursor_skip(text, st->viewlines, select); - else cursor_skip(text, 10, select); + if(st) cursor_skip(st, ar, st->text, st->viewlines, select); + else cursor_skip(NULL, NULL, text, 10, select); break; } text_update_cursor_moved(C); - WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text); + WM_event_add_notifier(C, NC_TEXT|ND_CURSOR, text); return OPERATOR_FINISHED; } @@ -1629,7 +1871,7 @@ static int jump_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int jump_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int jump_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { return WM_operator_props_dialog_popup(C,op,200,100); @@ -1665,6 +1907,8 @@ static int delete_exec(bContext *C, wmOperator *op) Text *text= CTX_data_edit_text(C); int type= RNA_enum_get(op->ptr, "type"); + text_drawcache_tag_update(CTX_wm_space_text(C), 0); + if(type == DEL_PREV_WORD) txt_backspace_word(text); else if(type == DEL_PREV_CHAR) @@ -1674,7 +1918,7 @@ static int delete_exec(bContext *C, wmOperator *op) else if(type == DEL_NEXT_CHAR) txt_delete_char(text); - text_update_line_edited(text, text->curl); + text_update_line_edited(text->curl); text_update_cursor_moved(C); WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text); @@ -1703,7 +1947,7 @@ void TEXT_OT_delete(wmOperatorType *ot) /******************* toggle overwrite operator **********************/ -static int toggle_overwrite_exec(bContext *C, wmOperator *op) +static int toggle_overwrite_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceText *st= CTX_wm_space_text(C); @@ -1729,13 +1973,13 @@ void TEXT_OT_overwrite_toggle(wmOperatorType *ot) /******************* scroll operator **********************/ /* Moves the view vertically by the specified number of lines */ -static void screen_skip(SpaceText *st, int lines) +static void screen_skip(SpaceText *st, ARegion *ar, int lines) { int last; - st->top += lines; + st->top += lines; - last= txt_get_span(st->text->lines.first, st->text->lines.last); + last= text_get_total_lines(st, ar); last= last - (st->viewlines/2); if(st->top>last) st->top= last; @@ -1756,12 +2000,14 @@ typedef struct TextScroll { static int scroll_exec(bContext *C, wmOperator *op) { SpaceText *st= CTX_wm_space_text(C); + ARegion *ar= CTX_wm_region(C); + int lines= RNA_int_get(op->ptr, "lines"); if(lines == 0) return OPERATOR_CANCELLED; - screen_skip(st, lines*U.wheellinescroll); + screen_skip(st, ar, lines*U.wheellinescroll); ED_area_tag_redraw(CTX_wm_area(C)); @@ -1771,6 +2017,7 @@ static int scroll_exec(bContext *C, wmOperator *op) static void scroll_apply(bContext *C, wmOperator *op, wmEvent *event) { SpaceText *st= CTX_wm_space_text(C); + ARegion *ar= CTX_wm_region(C); TextScroll *tsc= op->customdata; short *mval= event->mval; @@ -1792,7 +2039,7 @@ static void scroll_apply(bContext *C, wmOperator *op, wmEvent *event) tsc->delta[1]= (tsc->hold[1]-mval[1])*st->pix_per_line; if(tsc->delta[0] || tsc->delta[1]) { - screen_skip(st, tsc->delta[1]); + screen_skip(st, ar, tsc->delta[1]); tsc->lines += tsc->delta[1]; @@ -1969,7 +2216,7 @@ static void set_cursor_to_pos(SpaceText *st, ARegion *ar, int x, int y, int sel) Text *text= st->text; TextLine **linep; int *charp; - int w; + int w, tabs; text_update_character_width(st); @@ -1987,16 +2234,28 @@ static void set_cursor_to_pos(SpaceText *st, ARegion *ar, int x, int y, int sel) x = (x/st->cwidth) + st->left; if(st->wordwrap) { - int i, j, endj, curs, max, chop, start, end, chars, loop; + int i, j, endj, curs, max, chop, start, end, chars, loop, found; char ch; /* Point to first visible line */ *linep= text->lines.first; - for(i=0; i<st->top && (*linep)->next; i++) *linep= (*linep)->next; + i= st->top; + while(i>0 && *linep) { + int lines= text_get_visible_lines(st, ar, (*linep)->line); + + if (i-lines<0) { + y+= i; + break; + } else { + *linep= (*linep)->next; + i-= lines; + } + } max= wrap_width(st, ar); loop= 1; + found= 0; while(loop && *linep) { start= 0; end= max; @@ -2004,12 +2263,14 @@ static void set_cursor_to_pos(SpaceText *st, ARegion *ar, int x, int y, int sel) chars= 0; curs= 0; endj= 0; + tabs= 0; for(i=0, j=0; loop; j++) { /* Mimic replacement of tabs */ ch= (*linep)->line[j]; if(ch=='\t') { chars= st->tabnumber-i%st->tabnumber; + tabs+= chars-1; ch= ' '; } else @@ -2021,22 +2282,34 @@ static void set_cursor_to_pos(SpaceText *st, ARegion *ar, int x, int y, int sel) *charp= endj; loop= 0; break; - /* Exactly at the cursor, done */ + /* Exactly at the cursor */ } else if(y==0 && i-start==x) { + /* current position could be wrapped to next line */ + /* this should be checked when end of current line would be reached */ *charp= curs= j; - loop= 0; - break; + found= 1; /* Prepare curs for next wrap */ } else if(i-end==x) { curs= j; } if(i-start>=max) { + if(found) { + /* exact cursor position was found, check if it's */ + /* still on needed line (hasn't been wrapped) */ + if(*charp>endj && !chop) (*charp)= endj; + loop= 0; + break; + } + if(chop) endj= j; - y--; start= end; end += max; + + if(start-tabs<(*linep)->len) + y--; + chop= 1; if(y==0 && i-start>=x) { *charp= curs; @@ -2045,6 +2318,11 @@ static void set_cursor_to_pos(SpaceText *st, ARegion *ar, int x, int y, int sel) } } else if(ch==' ' || ch=='-' || ch=='\0') { + if(found) { + loop= 0; + break; + } + if(y==0 && i-start>=x) { *charp= curs; loop= 0; @@ -2102,7 +2380,7 @@ static void set_cursor_apply(bContext *C, wmOperator *op, wmEvent *event) if(event->mval[1]<0 || event->mval[1]>ar->winy) { int d= (scu->old[1]-event->mval[1])*st->pix_per_line; - if(d) screen_skip(st, d); + if(d) screen_skip(st, ar, d); set_cursor_to_pos(st, ar, event->mval[0], event->mval[1]<0?0:ar->winy, 1); @@ -2234,7 +2512,7 @@ void TEXT_OT_cursor_set(wmOperatorType *ot) /******************* line number operator **********************/ -static int line_number_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int line_number_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event) { SpaceText *st= CTX_wm_space_text(C); Text *text= CTX_data_edit_text(C); @@ -2290,6 +2568,8 @@ static int insert_exec(bContext *C, wmOperator *op) char *str; int done = 0, i; + text_drawcache_tag_update(st, 0); + str= RNA_string_get_alloc(op->ptr, "text", NULL, 0); if(st && st->overwrite) { @@ -2307,7 +2587,7 @@ static int insert_exec(bContext *C, wmOperator *op) if(!done) return OPERATOR_CANCELLED; - text_update_line_edited(text, text->curl); + text_update_line_edited(text->curl); text_update_cursor_moved(C); WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text); @@ -2322,9 +2602,8 @@ static int insert_invoke(bContext *C, wmOperator *op, wmEvent *event) // if(!RNA_property_is_set(op->ptr, "text")) { /* always set from keymap XXX */ if(!RNA_string_length(op->ptr, "text")) { char str[2] = {event->ascii, '\0'}; - /* if alt/ctrl/super are pressed pass through */ - if(event->alt || event->ctrl || event->oskey) + if(event->ctrl || event->oskey) return OPERATOR_PASS_THROUGH; RNA_string_set(op->ptr, "text", str); @@ -2397,6 +2676,7 @@ static int find_and_replace(bContext *C, wmOperator *op, short mode) } text_update_cursor_moved(C); WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text); + text_drawcache_tag_update(CTX_wm_space_text(C), 1); } else if(mode==TEXT_MARK_ALL) { char color[4]; @@ -2530,7 +2810,7 @@ void TEXT_OT_find_set_selected(wmOperatorType *ot) /******************* replace set selected *********************/ -static int replace_set_selected_exec(bContext *C, wmOperator *op) +static int replace_set_selected_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceText *st= CTX_wm_space_text(C); Text *text= CTX_data_edit_text(C); @@ -2580,7 +2860,7 @@ int text_file_modified(Text *text) return 0; BLI_strncpy(file, text->name, FILE_MAXDIR+FILE_MAXFILE); - BLI_path_abs(file, G.sce); + BLI_path_abs(file, G.main->name); if(!BLI_exists(file)) return 2; @@ -2608,7 +2888,7 @@ static void text_ignore_modified(Text *text) if(!text || !text->name) return; BLI_strncpy(file, text->name, FILE_MAXDIR+FILE_MAXFILE); - BLI_path_abs(file, G.sce); + BLI_path_abs(file, G.main->name); if(!BLI_exists(file)) return; @@ -2640,7 +2920,7 @@ static int resolve_conflict_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } -static int resolve_conflict_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int resolve_conflict_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Text *text= CTX_data_edit_text(C); uiPopupMenu *pup; @@ -2742,6 +3022,7 @@ void ED_text_undo_step(bContext *C, int step) text_update_edited(text); text_update_cursor_moved(C); + text_drawcache_tag_update(CTX_wm_space_text(C), 1); WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text); } diff --git a/source/blender/editors/space_text/text_python.c b/source/blender/editors/space_text/text_python.c index 9be554924c9..6e64bef4c85 100644 --- a/source/blender/editors/space_text/text_python.c +++ b/source/blender/editors/space_text/text_python.c @@ -204,7 +204,7 @@ short do_texttools(SpaceText *st, char ascii, unsigned short evnt, short val) if(tools & TOOL_SUGG_LIST) { if((ascii != '_' && ascii != '*' && ispunct(ascii)) || text_check_whitespace(ascii)) { confirm_suggestion(st->text, 0); - text_update_line_edited(st->text, st->text->curl); + text_update_line_edited(st->text->curl); } else if((st->overwrite && txt_replace_char(st->text, ascii)) || txt_add_char(st->text, ascii)) { get_suggest_prefix(st->text, 0); @@ -230,7 +230,7 @@ short do_texttools(SpaceText *st, char ascii, unsigned short evnt, short val) case MIDDLEMOUSE: if(text_do_suggest_select(st, ar)) { confirm_suggestion(st->text, 0); - text_update_line_edited(st->text, st->text->curl); + text_update_line_edited(st->text->curl); swallow= 1; } else { @@ -248,7 +248,7 @@ short do_texttools(SpaceText *st, char ascii, unsigned short evnt, short val) case RETKEY: if(tools & TOOL_SUGG_LIST) { confirm_suggestion(st->text, 0); - text_update_line_edited(st->text, st->text->curl); + text_update_line_edited(st->text->curl); swallow= 1; draw= 1; } @@ -430,11 +430,11 @@ short do_textmarkers(SpaceText *st, char ascii, unsigned short evnt, short val) if(s!=c) txt_move_to(text, mrk->lineno, mrk->start+s, 1); if(st->overwrite) { if(txt_replace_char(text, ascii)) - text_update_line_edited(st->text, st->text->curl); + text_update_line_edited(st->text->curl); } else { if(txt_add_char(text, ascii)) { - text_update_line_edited(st->text, st->text->curl); + text_update_line_edited(st->text->curl); } } @@ -459,7 +459,7 @@ short do_textmarkers(SpaceText *st, char ascii, unsigned short evnt, short val) txt_move_to(text, mrk->lineno, mrk->start+c, 0); if(s!=c) txt_move_to(text, mrk->lineno, mrk->start+s, 1); txt_backspace_char(text); - text_update_line_edited(st->text, st->text->curl); + text_update_line_edited(st->text->curl); if(mrk==marker || mrk==nxt) break; mrk= nxt; } @@ -479,7 +479,7 @@ short do_textmarkers(SpaceText *st, char ascii, unsigned short evnt, short val) txt_move_to(text, mrk->lineno, mrk->start+c, 0); if(s!=c) txt_move_to(text, mrk->lineno, mrk->start+s, 1); txt_delete_char(text); - text_update_line_edited(st->text, st->text->curl); + text_update_line_edited(st->text->curl); if(mrk==marker || mrk==nxt) break; mrk= nxt; } diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c index 0d3b0514122..a03baa2fa72 100644 --- a/source/blender/editors/space_time/space_time.c +++ b/source/blender/editors/space_time/space_time.c @@ -61,11 +61,8 @@ /* ************************ main time area region *********************** */ -static void time_draw_sfra_efra(const bContext *C, SpaceTime *stime, ARegion *ar) -{ - View2D *v2d= UI_view2d_fromcontext(C); - Scene *scene= CTX_data_scene(C); - +static void time_draw_sfra_efra(Scene *scene, View2D *v2d) +{ /* draw darkened area outside of active timeline * frame range used is preview range or scene range */ UI_ThemeColorShade(TH_BACK, -25); @@ -86,7 +83,7 @@ static void time_draw_sfra_efra(const bContext *C, SpaceTime *stime, ARegion *ar #define CACHE_DRAW_HEIGHT 3.0f -static void time_draw_cache(const bContext *C, SpaceTime *stime, ARegion *ar) +static void time_draw_cache(SpaceTime *stime) { SpaceTimeCache *stc; float yoffs=0.f; @@ -162,7 +159,7 @@ static void time_cache_free(SpaceTime *stime) BLI_freelistN(&stime->caches); } -static void time_cache_refresh(const bContext *C, SpaceTime *stime, ARegion *ar) +static void time_cache_refresh(const bContext *C, SpaceTime *stime) { Object *ob = CTX_data_active_object(C); PTCacheID *pid; @@ -389,7 +386,7 @@ static void time_refresh(const bContext *C, ScrArea *sa) /* find the main timeline region and refresh cache display*/ for (ar= sa->regionbase.first; ar; ar= ar->next) { if (ar->regiontype==RGN_TYPE_WINDOW) { - time_cache_refresh(C, stime, ar); + time_cache_refresh(C, stime); break; } } @@ -457,6 +454,7 @@ static void time_main_area_init(wmWindowManager *wm, ARegion *ar) static void time_main_area_draw(const bContext *C, ARegion *ar) { /* draw entirely, view changes should be handled here */ + Scene *scene= CTX_data_scene(C); SpaceTime *stime= CTX_wm_space_time(C); View2D *v2d= &ar->v2d; View2DGrid *grid; @@ -467,15 +465,15 @@ static void time_main_area_draw(const bContext *C, ARegion *ar) UI_ThemeClearColor(TH_BACK); glClear(GL_COLOR_BUFFER_BIT); - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); /* start and end frame */ - time_draw_sfra_efra(C, stime, ar); + time_draw_sfra_efra(scene, v2d); /* grid */ unit= (stime->flag & TIME_DRAWFRAMES)? V2D_UNIT_FRAMES: V2D_UNIT_SECONDS; - grid= UI_view2d_grid_calc(C, v2d, unit, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY, ar->winx, ar->winy); - UI_view2d_grid_draw(C, v2d, grid, (V2D_VERTICAL_LINES|V2D_VERTICAL_AXIS)); + grid= UI_view2d_grid_calc(scene, v2d, unit, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY, ar->winx, ar->winy); + UI_view2d_grid_draw(v2d, grid, (V2D_VERTICAL_LINES|V2D_VERTICAL_AXIS)); UI_view2d_grid_free(grid); /* keyframes */ @@ -488,11 +486,11 @@ static void time_main_area_draw(const bContext *C, ARegion *ar) ANIM_draw_cfra(C, v2d, flag); /* markers */ - UI_view2d_view_orthoSpecial(C, v2d, 1); + UI_view2d_view_orthoSpecial(ar, v2d, 1); draw_markers_time(C, 0); /* caches */ - time_draw_cache(C, stime, ar); + time_draw_cache(stime); /* reset view matrix */ UI_view2d_view_restore(C); @@ -533,7 +531,7 @@ static void time_main_area_listener(ARegion *ar, wmNotifier *wmn) /* ************************ header time area region *********************** */ /* add handlers, stuff you only do once or on area/region changes */ -static void time_header_area_init(wmWindowManager *wm, ARegion *ar) +static void time_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar) { ED_region_header_init(ar); } @@ -632,7 +630,7 @@ static void time_free(SpaceLink *sl) /* spacetype; init callback in ED_area_initialize() */ /* init is called to (re)initialize an existing editor (file read, screen changes) */ /* validate spacedata, add own area level handlers */ -static void time_init(wmWindowManager *wm, ScrArea *sa) +static void time_init(wmWindowManager *UNUSED(wm), ScrArea *sa) { SpaceTime *stime= (SpaceTime *)sa->spacedata.first; diff --git a/source/blender/editors/space_time/time_ops.c b/source/blender/editors/space_time/time_ops.c index fb80d54d5e6..edb3da5a06e 100644 --- a/source/blender/editors/space_time/time_ops.c +++ b/source/blender/editors/space_time/time_ops.c @@ -46,7 +46,7 @@ /* ****************** Start/End Frame Operators *******************************/ -static int time_set_sfra_exec (bContext *C, wmOperator *op) +static int time_set_sfra_exec (bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); int frame= CFRA; @@ -86,7 +86,7 @@ void TIME_OT_start_frame_set (wmOperatorType *ot) } -static int time_set_efra_exec (bContext *C, wmOperator *op) +static int time_set_efra_exec (bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); int frame= CFRA; @@ -127,7 +127,7 @@ void TIME_OT_end_frame_set (wmOperatorType *ot) /* ************************ View All Operator *******************************/ -static int time_view_all_exec (bContext *C, wmOperator *op) +static int time_view_all_exec (bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); ARegion *ar= CTX_wm_region(C); diff --git a/source/blender/editors/space_userpref/space_userpref.c b/source/blender/editors/space_userpref/space_userpref.c index 8eea83a1083..a59c03ad17d 100644 --- a/source/blender/editors/space_userpref/space_userpref.c +++ b/source/blender/editors/space_userpref/space_userpref.c @@ -47,7 +47,7 @@ /* ******************** default callbacks for userpref space ***************** */ -static SpaceLink *userpref_new(const bContext *C) +static SpaceLink *userpref_new(const bContext *UNUSED(C)) { ARegion *ar; SpaceUserPref *spref; @@ -72,7 +72,7 @@ static SpaceLink *userpref_new(const bContext *C) } /* not spacelink itself */ -static void userpref_free(SpaceLink *sl) +static void userpref_free(SpaceLink *UNUSED(sl)) { // SpaceUserPref *spref= (SpaceUserPref*) sl; @@ -80,7 +80,7 @@ static void userpref_free(SpaceLink *sl) /* spacetype; init callback */ -static void userpref_init(struct wmWindowManager *wm, ScrArea *sa) +static void userpref_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa)) { } @@ -111,13 +111,13 @@ void userpref_operatortypes(void) { } -void userpref_keymap(struct wmKeyConfig *keyconf) +void userpref_keymap(struct wmKeyConfig *UNUSED(keyconf)) { } /* add handlers, stuff you only do once or on area/region changes */ -static void userpref_header_area_init(wmWindowManager *wm, ARegion *ar) +static void userpref_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar) { ED_region_header_init(ar); } @@ -127,19 +127,20 @@ static void userpref_header_area_draw(const bContext *C, ARegion *ar) ED_region_header(C, ar); } -static void userpref_main_area_listener(ARegion *ar, wmNotifier *wmn) +static void userpref_main_area_listener(ARegion *UNUSED(ar), wmNotifier *UNUSED(wmn)) { /* context changes */ } -static void userpref_header_listener(ARegion *ar, wmNotifier *wmn) +static void userpref_header_listener(ARegion *UNUSED(ar), wmNotifier *UNUSED(wmn)) { /* context changes */ +#if 0 switch(wmn->category) { default: break; } - +#endif } /* only called once, from space/spacetypes.c */ diff --git a/source/blender/editors/space_view3d/drawanimviz.c b/source/blender/editors/space_view3d/drawanimviz.c index fb271556a9c..4cce166b36b 100644 --- a/source/blender/editors/space_view3d/drawanimviz.c +++ b/source/blender/editors/space_view3d/drawanimviz.c @@ -64,7 +64,7 @@ // - include support for editing the path verts /* Set up drawing environment for drawing motion paths */ -void draw_motion_paths_init(Scene *scene, View3D *v3d, ARegion *ar) +void draw_motion_paths_init(View3D *v3d, ARegion *ar) { RegionView3D *rv3d= ar->regiondata; @@ -79,7 +79,7 @@ void draw_motion_paths_init(Scene *scene, View3D *v3d, ARegion *ar) * i.e. draw_motion_paths_init() has been called */ // FIXME: the text is still drawn in the wrong space - it includes the current transforms of the object still... -void draw_motion_path_instance(Scene *scene, View3D *v3d, ARegion *ar, +void draw_motion_path_instance(Scene *scene, Object *ob, bPoseChannel *pchan, bAnimVizSettings *avs, bMotionPath *mpath) { //RegionView3D *rv3d= ar->regiondata; @@ -283,7 +283,7 @@ void draw_motion_path_instance(Scene *scene, View3D *v3d, ARegion *ar, } /* Clean up drawing environment after drawing motion paths */ -void draw_motion_paths_cleanup(Scene *scene, View3D *v3d, ARegion *ar) +void draw_motion_paths_cleanup(View3D *v3d) { if (v3d->zbuf) glEnable(GL_DEPTH_TEST); glPopMatrix(); diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index c6aa4656191..6cbfc2cffe4 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -140,7 +140,7 @@ static void cp_shade_color3ub (char cp[], int offset) } /* This function sets the gl-color for coloring a certain bone (based on bcolor) */ -static short set_pchan_glColor (short colCode, int armflag, int boneflag, int constflag) +static short set_pchan_glColor (short colCode, int boneflag, int constflag) { switch (colCode) { case PCHAN_COLOR_NORMAL: @@ -551,7 +551,7 @@ static void draw_bone_points(int dt, int armflag, unsigned int boneflag, int id) } else { if (armflag & ARM_POSEMODE) - set_pchan_glColor(PCHAN_COLOR_SOLID, armflag, boneflag, 0); + set_pchan_glColor(PCHAN_COLOR_SOLID, boneflag, 0); else UI_ThemeColor(TH_BONE_SOLID); } @@ -574,7 +574,7 @@ static void draw_bone_points(int dt, int armflag, unsigned int boneflag, int id) } else { if (armflag & ARM_POSEMODE) - set_pchan_glColor(PCHAN_COLOR_SOLID, armflag, boneflag, 0); + set_pchan_glColor(PCHAN_COLOR_SOLID, boneflag, 0); else UI_ThemeColor(TH_BONE_SOLID); } @@ -616,7 +616,7 @@ static float co[16] ={ /* smat, imat = mat & imat to draw screenaligned */ -static void draw_sphere_bone_dist(float smat[][4], float imat[][4], int boneflag, bPoseChannel *pchan, EditBone *ebone) +static void draw_sphere_bone_dist(float smat[][4], float imat[][4], bPoseChannel *pchan, EditBone *ebone) { float head, tail, length, dist; float *headvec, *tailvec, dirvec[3]; @@ -782,7 +782,7 @@ static void draw_sphere_bone_wire(float smat[][4], float imat[][4], int armflag, else UI_ThemeColor(TH_VERTEX); } else if (armflag & ARM_POSEMODE) - set_pchan_glColor(PCHAN_COLOR_NORMAL, armflag, boneflag, constflag); + set_pchan_glColor(PCHAN_COLOR_NORMAL, boneflag, constflag); /* Draw root point if we are not connected */ if ((boneflag & BONE_CONNECTED)==0) { @@ -903,7 +903,7 @@ static void draw_sphere_bone(int dt, int armflag, int boneflag, int constflag, u else UI_ThemeColorShade(TH_BONE_SOLID, -30); } else if (armflag & ARM_POSEMODE) - set_pchan_glColor(PCHAN_COLOR_SPHEREBONE_END, armflag, boneflag, constflag); + set_pchan_glColor(PCHAN_COLOR_SPHEREBONE_END, boneflag, constflag); else if (dt==OB_SOLID) UI_ThemeColorShade(TH_BONE_SOLID, -30); @@ -933,7 +933,7 @@ static void draw_sphere_bone(int dt, int armflag, int boneflag, int constflag, u else UI_ThemeColor(TH_BONE_SOLID); } else if (armflag & ARM_POSEMODE) - set_pchan_glColor(PCHAN_COLOR_SPHEREBONE_BASE, armflag, boneflag, constflag); + set_pchan_glColor(PCHAN_COLOR_SPHEREBONE_BASE, boneflag, constflag); else if (dt == OB_SOLID) UI_ThemeColor(TH_BONE_SOLID); @@ -1003,7 +1003,7 @@ static void draw_line_bone(int armflag, int boneflag, int constflag, unsigned in if (armflag & (ARM_EDITMODE|ARM_POSEMODE)) { glLineWidth(4.0f); if (armflag & ARM_POSEMODE) - set_pchan_glColor(PCHAN_COLOR_NORMAL, armflag, boneflag, constflag); + set_pchan_glColor(PCHAN_COLOR_NORMAL, boneflag, constflag); else if (armflag & ARM_EDITMODE) { UI_ThemeColor(TH_WIRE); } @@ -1048,7 +1048,7 @@ static void draw_line_bone(int armflag, int boneflag, int constflag, unsigned in glLoadName(id & 0xFFFF); /* object tag, for bordersel optim */ if (armflag & ARM_POSEMODE) - set_pchan_glColor(PCHAN_COLOR_LINEBONE, armflag, boneflag, constflag); + set_pchan_glColor(PCHAN_COLOR_LINEBONE, boneflag, constflag); } glLineWidth(2.0); @@ -1147,9 +1147,9 @@ static void draw_b_bone(int dt, int armflag, int boneflag, int constflag, unsign /* colors for modes */ if (armflag & ARM_POSEMODE) { if (dt <= OB_WIRE) - set_pchan_glColor(PCHAN_COLOR_NORMAL, armflag, boneflag, constflag); + set_pchan_glColor(PCHAN_COLOR_NORMAL, boneflag, constflag); else - set_pchan_glColor(PCHAN_COLOR_SOLID, armflag, boneflag, constflag); + set_pchan_glColor(PCHAN_COLOR_SOLID, boneflag, constflag); } else if (armflag & ARM_EDITMODE) { if (dt==OB_WIRE) { @@ -1171,7 +1171,7 @@ static void draw_b_bone(int dt, int armflag, int boneflag, int constflag, unsign glEnable(GL_LIGHTING); if (armflag & ARM_POSEMODE) - set_pchan_glColor(PCHAN_COLOR_SOLID, armflag, boneflag, constflag); + set_pchan_glColor(PCHAN_COLOR_SOLID, boneflag, constflag); else UI_ThemeColor(TH_BONE_SOLID); @@ -1186,7 +1186,7 @@ static void draw_b_bone(int dt, int armflag, int boneflag, int constflag, unsign if (armflag & ARM_POSEMODE) { if (constflag) { /* set constraint colors */ - if (set_pchan_glColor(PCHAN_COLOR_CONSTS, armflag, boneflag, constflag)) { + if (set_pchan_glColor(PCHAN_COLOR_CONSTS, boneflag, constflag)) { glEnable(GL_BLEND); draw_b_bone_boxes(OB_SOLID, pchan, xwidth, length, zwidth); @@ -1195,7 +1195,7 @@ static void draw_b_bone(int dt, int armflag, int boneflag, int constflag, unsign } /* restore colors */ - set_pchan_glColor(PCHAN_COLOR_NORMAL, armflag, boneflag, constflag); + set_pchan_glColor(PCHAN_COLOR_NORMAL, boneflag, constflag); } } @@ -1221,9 +1221,9 @@ static void draw_bone(int dt, int armflag, int boneflag, int constflag, unsigned /* colors for posemode */ if (armflag & ARM_POSEMODE) { if (dt <= OB_WIRE) - set_pchan_glColor(PCHAN_COLOR_NORMAL, armflag, boneflag, constflag); + set_pchan_glColor(PCHAN_COLOR_NORMAL, boneflag, constflag); else - set_pchan_glColor(PCHAN_COLOR_SOLID, armflag, boneflag, constflag); + set_pchan_glColor(PCHAN_COLOR_SOLID, boneflag, constflag); } @@ -1245,7 +1245,7 @@ static void draw_bone(int dt, int armflag, int boneflag, int constflag, unsigned else if (armflag & ARM_POSEMODE) { if (constflag) { /* draw constraint colors */ - if (set_pchan_glColor(PCHAN_COLOR_CONSTS, armflag, boneflag, constflag)) { + if (set_pchan_glColor(PCHAN_COLOR_CONSTS, boneflag, constflag)) { glEnable(GL_BLEND); draw_bone_solid_octahedral(); @@ -1254,7 +1254,7 @@ static void draw_bone(int dt, int armflag, int boneflag, int constflag, unsigned } /* restore colors */ - set_pchan_glColor(PCHAN_COLOR_NORMAL, armflag, boneflag, constflag); + set_pchan_glColor(PCHAN_COLOR_NORMAL, boneflag, constflag); } } draw_bone_octahedral(); @@ -1262,7 +1262,7 @@ static void draw_bone(int dt, int armflag, int boneflag, int constflag, unsigned else { /* solid */ if (armflag & ARM_POSEMODE) - set_pchan_glColor(PCHAN_COLOR_SOLID, armflag, boneflag, constflag); + set_pchan_glColor(PCHAN_COLOR_SOLID, boneflag, constflag); else UI_ThemeColor(TH_BONE_SOLID); draw_bone_solid_octahedral(); @@ -1283,7 +1283,7 @@ static void draw_custom_bone(Scene *scene, View3D *v3d, RegionView3D *rv3d, Obje /* colors for posemode */ if (armflag & ARM_POSEMODE) { - set_pchan_glColor(PCHAN_COLOR_NORMAL, armflag, boneflag, 0); + set_pchan_glColor(PCHAN_COLOR_NORMAL, boneflag, 0); } if (id != -1) { @@ -1565,7 +1565,7 @@ static void bone_matrix_translate_y(float mat[][4], float y) } /* assumes object is Armature with pose */ -static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt) +static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, short ghost) { RegionView3D *rv3d= ar->regiondata; Object *ob= base->object; @@ -1602,7 +1602,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, if (bone && !(bone->flag & (BONE_HIDDEN_P|BONE_NO_DEFORM|BONE_HIDDEN_PG))) { if (bone->flag & (BONE_SELECTED)) { if (bone->layer & arm->layer) - draw_sphere_bone_dist(smat, imat, bone->flag, pchan, NULL); + draw_sphere_bone_dist(smat, imat, pchan, NULL); } } } @@ -1706,9 +1706,11 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, } /* prepare colors */ - if (arm->flag & ARM_POSEMODE) + if(ghost) { + /* 13 October 2009, Disabled this to make ghosting show the right colors (Aligorith) */ + } + else if (arm->flag & ARM_POSEMODE) set_pchan_colorset(ob, pchan); -#if 0 // XXX - 13 October 2009, Disabled this to make ghosting show the right colors (Aligorith) else { if ((scene->basact)==base) { if (base->flag & (SELECT+BA_WAS_SEL)) UI_ThemeColor(TH_ACTIVE); @@ -1719,7 +1721,6 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, else UI_ThemeColor(TH_WIRE); } } -#endif /* catch exception for bone with hidden parent */ flag= bone->flag; @@ -1901,7 +1902,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, bone_matrix_translate_y(bmat, pchan->bone->length); glMultMatrixf(bmat); - drawaxes(pchan->bone->length*0.25f, 0, OB_ARROWS); + drawaxes(pchan->bone->length*0.25f, OB_ARROWS); glPopMatrix(); } @@ -1957,7 +1958,7 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, int dt) if (eBone->layer & arm->layer) { if ((eBone->flag & (BONE_HIDDEN_A|BONE_NO_DEFORM))==0) { if (eBone->flag & (BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL)) - draw_sphere_bone_dist(smat, imat, eBone->flag, NULL, eBone); + draw_sphere_bone_dist(smat, imat, NULL, eBone); } } } @@ -2094,7 +2095,7 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, int dt) bone_matrix_translate_y(bmat, eBone->length); glMultMatrixf(bmat); - drawaxes(eBone->length*0.25f, 0, OB_ARROWS); + drawaxes(eBone->length*0.25f, OB_ARROWS); glPopMatrix(); } @@ -2122,16 +2123,16 @@ static void draw_pose_paths(Scene *scene, View3D *v3d, ARegion *ar, Object *ob) bPoseChannel *pchan; /* setup drawing environment for paths */ - draw_motion_paths_init(scene, v3d, ar); + draw_motion_paths_init(v3d, ar); /* draw paths where they exist and they releated bone is visible */ for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) { if ((pchan->bone->layer & arm->layer) && (pchan->mpath)) - draw_motion_path_instance(scene, v3d, ar, ob, pchan, avs, pchan->mpath); + draw_motion_path_instance(scene, ob, pchan, avs, pchan->mpath); } /* cleanup after drawing */ - draw_motion_paths_cleanup(scene, v3d, ar); + draw_motion_paths_cleanup(v3d); } @@ -2211,7 +2212,7 @@ static void draw_ghost_poses_range(Scene *scene, View3D *v3d, ARegion *ar, Base BKE_animsys_evaluate_animdata(&ob->id, adt, (float)CFRA, ADT_RECALC_ALL); where_is_pose(scene, ob); - draw_pose_bones(scene, v3d, ar, base, OB_WIRE); + draw_pose_bones(scene, v3d, ar, base, OB_WIRE, TRUE); } glDisable(GL_BLEND); if (v3d->zbuf) glEnable(GL_DEPTH_TEST); @@ -2290,7 +2291,7 @@ static void draw_ghost_poses_keys(Scene *scene, View3D *v3d, ARegion *ar, Base * BKE_animsys_evaluate_animdata(&ob->id, adt, (float)CFRA, ADT_RECALC_ALL); where_is_pose(scene, ob); - draw_pose_bones(scene, v3d, ar, base, OB_WIRE); + draw_pose_bones(scene, v3d, ar, base, OB_WIRE, TRUE); } glDisable(GL_BLEND); if (v3d->zbuf) glEnable(GL_DEPTH_TEST); @@ -2360,7 +2361,7 @@ static void draw_ghost_poses(Scene *scene, View3D *v3d, ARegion *ar, Base *base) if (CFRA != cfrao) { BKE_animsys_evaluate_animdata(&ob->id, adt, (float)CFRA, ADT_RECALC_ALL); where_is_pose(scene, ob); - draw_pose_bones(scene, v3d, ar, base, OB_WIRE); + draw_pose_bones(scene, v3d, ar, base, OB_WIRE, TRUE); } } @@ -2375,7 +2376,7 @@ static void draw_ghost_poses(Scene *scene, View3D *v3d, ARegion *ar, Base *base) if (CFRA != cfrao) { BKE_animsys_evaluate_animdata(&ob->id, adt, (float)CFRA, ADT_RECALC_ALL); where_is_pose(scene, ob); - draw_pose_bones(scene, v3d, ar, base, OB_WIRE); + draw_pose_bones(scene, v3d, ar, base, OB_WIRE, TRUE); } } } @@ -2409,7 +2410,7 @@ int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, in /* we use color for solid lighting */ glColorMaterial(GL_FRONT_AND_BACK, GL_SPECULAR); glEnable(GL_COLOR_MATERIAL); - glColor3ub(0,0,0); // clear spec + glColor3ub(255,0,255); // clear spec glDisable(GL_COLOR_MATERIAL); glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE); @@ -2458,7 +2459,7 @@ int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, in } } } - draw_pose_bones(scene, v3d, ar, base, dt); + draw_pose_bones(scene, v3d, ar, base, dt, FALSE); arm->flag &= ~ARM_POSEMODE; if(ob->mode & OB_MODE_POSE) diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c index cf511a8ad9b..0df2888f4a0 100644 --- a/source/blender/editors/space_view3d/drawmesh.c +++ b/source/blender/editors/space_view3d/drawmesh.c @@ -192,7 +192,7 @@ static int draw_tfaces3D__drawFaceOpts(void *userData, int index) return 0; } -static void draw_tfaces3D(RegionView3D *rv3d, Object *ob, Mesh *me, DerivedMesh *dm) +static void draw_tfaces3D(RegionView3D *rv3d, Mesh *me, DerivedMesh *dm) { struct { Mesh *me; EdgeHash *eh; } data; @@ -671,7 +671,7 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *o /* draw edges and selected faces over textured mesh */ if(!(ob == scene->obedit) && faceselect) - draw_tfaces3D(rv3d, ob, me, dm); + draw_tfaces3D(rv3d, me, dm); /* reset from negative scale correction */ glFrontFace(GL_CCW); diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index d28813f7522..e7a69642e9f 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -398,8 +398,7 @@ static void draw_xyz_wire(float *c, float size, int axis) } -/* flag is same as for draw_object */ -void drawaxes(float size, int flag, char drawtype) +void drawaxes(float size, char drawtype) { int axis; float v1[3]= {0.0, 0.0, 0.0}; @@ -1212,7 +1211,7 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob /* a standing up pyramid with (0,0,0) as top */ Camera *cam; World *wrld; - float nobmat[4][4], vec[8][4], fac, facx, facy, depth, aspx, aspy, caspx, caspy; + float nobmat[4][4], vec[8][4], fac, facx, facy, depth, aspx, aspy, caspx, caspy, shx, shy; int i; cam= ob->data; @@ -1234,6 +1233,8 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob if(rv3d->persp>=2 && cam->type==CAM_ORTHO && ob==v3d->camera) { facx= 0.5*cam->ortho_scale*caspx; facy= 0.5*cam->ortho_scale*caspy; + shx= cam->shiftx * cam->ortho_scale; + shy= cam->shifty * cam->ortho_scale; depth= -cam->clipsta-0.1; } else { @@ -1243,13 +1244,15 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob depth= - fac*cam->lens/16.0; facx= fac*caspx; facy= fac*caspy; + shx= cam->shiftx*fac*2; + shy= cam->shifty*fac*2; } vec[0][0]= 0.0; vec[0][1]= 0.0; vec[0][2]= 0.001; /* GLBUG: for picking at iris Entry (well thats old!) */ - vec[1][0]= facx; vec[1][1]= facy; vec[1][2]= depth; - vec[2][0]= facx; vec[2][1]= -facy; vec[2][2]= depth; - vec[3][0]= -facx; vec[3][1]= -facy; vec[3][2]= depth; - vec[4][0]= -facx; vec[4][1]= facy; vec[4][2]= depth; + vec[1][0]= shx + facx; vec[1][1]= shy + facy; vec[1][2]= depth; + vec[2][0]= shx + facx; vec[2][1]= shy - facy; vec[2][2]= depth; + vec[3][0]= shx - facx; vec[3][1]= shy - facy; vec[3][2]= depth; + vec[4][0]= shx - facx; vec[4][1]= shy + facy; vec[4][2]= depth; glBegin(GL_LINE_LOOP); glVertex3fv(vec[1]); @@ -1282,16 +1285,16 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob if (i==0) glBegin(GL_LINE_LOOP); else if (i==1 && (ob == v3d->camera)) glBegin(GL_TRIANGLES); else break; - - vec[0][0]= -0.7 * cam->drawsize; - vec[0][1]= cam->drawsize * (caspy + 0.1); + + vec[0][0]= shx + (-0.7 * cam->drawsize); + vec[0][1]= shy + (cam->drawsize * (caspy + 0.1)); glVertex3fv(vec[0]); /* left */ - vec[0][0] *= -1.0; + vec[0][0]= shx + (0.7 * cam->drawsize); glVertex3fv(vec[0]); /* right */ - vec[0][0]= 0.0; - vec[0][1]= 1.1 * cam->drawsize * (caspy + 0.7); + vec[0][0]= shx; + vec[0][1]= shy + (1.1 * cam->drawsize * (caspy + 0.7)); glVertex3fv(vec[0]); /* top */ glEnd(); @@ -1463,7 +1466,7 @@ static void drawlattice(Scene *scene, View3D *v3d, Object *ob) * if not, ED_view3d_init_mats_rv3d() can be used for selection tools * but would not give correct results with dupli's for eg. which dont * use the object matrix in the useual way */ -static void mesh_foreachScreenVert__mapFunc(void *userData, int index, float *co, float *no_f, short *no_s) +static void mesh_foreachScreenVert__mapFunc(void *userData, int index, float *co, float *UNUSED(no_f), short *UNUSED(no_s)) { struct { void (*func)(void *userData, EditVert *eve, int x, int y, int index); void *userData; ViewContext vc; int clipVerts; } *data = userData; EditVert *eve = EM_get_vert_for_index(index); @@ -1547,7 +1550,7 @@ void mesh_foreachScreenEdge(ViewContext *vc, void (*func)(void *userData, EditEd dm->release(dm); } -static void mesh_foreachScreenFace__mapFunc(void *userData, int index, float *cent, float *no) +static void mesh_foreachScreenFace__mapFunc(void *userData, int index, float *cent, float *UNUSED(no)) { struct { void (*func)(void *userData, EditFace *efa, int x, int y, int index); void *userData; ViewContext vc; } *data = userData; EditFace *efa = EM_get_face_for_index(index); @@ -1658,7 +1661,7 @@ static void draw_dm_face_normals(Scene *scene, DerivedMesh *dm) glEnd(); } -static void draw_dm_face_centers__mapFunc(void *userData, int index, float *cent, float *no) +static void draw_dm_face_centers__mapFunc(void *userData, int index, float *cent, float *UNUSED(no)) { EditFace *efa = EM_get_face_for_index(index); int sel = *((int*) userData); @@ -1702,7 +1705,7 @@ static void draw_dm_vert_normals(Scene *scene, DerivedMesh *dm) } /* Draw verts with color set based on selection */ -static void draw_dm_verts__mapFunc(void *userData, int index, float *co, float *no_f, short *no_s) +static void draw_dm_verts__mapFunc(void *userData, int index, float *co, float *UNUSED(no_f), short *UNUSED(no_s)) { struct { int sel; EditVert *eve_act; } * data = userData; EditVert *eve = EM_get_vert_for_index(index); @@ -1779,7 +1782,7 @@ static void draw_dm_edges_sel(DerivedMesh *dm, unsigned char *baseCol, unsigned } /* Draw edges */ -static int draw_dm_edges__setDrawOptions(void *userData, int index) +static int draw_dm_edges__setDrawOptions(void *UNUSED(userData), int index) { return EM_get_edge_for_index(index)->h==0; } @@ -1789,7 +1792,7 @@ static void draw_dm_edges(DerivedMesh *dm) } /* Draw edges with color interpolated based on selection */ -static int draw_dm_edges_sel_interp__setDrawOptions(void *userData, int index) +static int draw_dm_edges_sel_interp__setDrawOptions(void *UNUSED(userData), int index) { return EM_get_edge_for_index(index)->h==0; } @@ -1814,7 +1817,7 @@ static void draw_dm_edges_sel_interp(DerivedMesh *dm, unsigned char *baseCol, un } /* Draw only seam edges */ -static int draw_dm_edges_seams__setDrawOptions(void *userData, int index) +static int draw_dm_edges_seams__setDrawOptions(void *UNUSED(userData), int index) { EditEdge *eed = EM_get_edge_for_index(index); @@ -1826,7 +1829,7 @@ static void draw_dm_edges_seams(DerivedMesh *dm) } /* Draw only sharp edges */ -static int draw_dm_edges_sharp__setDrawOptions(void *userData, int index) +static int draw_dm_edges_sharp__setDrawOptions(void *UNUSED(userData), int index) { EditEdge *eed = EM_get_edge_for_index(index); @@ -1840,7 +1843,7 @@ static void draw_dm_edges_sharp(DerivedMesh *dm) /* Draw faces with color set based on selection * return 2 for the active face so it renders with stipple enabled */ -static int draw_dm_faces_sel__setDrawOptions(void *userData, int index, int *drawSmooth_r) +static int draw_dm_faces_sel__setDrawOptions(void *userData, int index, int *UNUSED(drawSmooth_r)) { struct { unsigned char *cols[3]; EditFace *efa_act; } * data = userData; EditFace *efa = EM_get_face_for_index(index); @@ -1872,7 +1875,7 @@ static void draw_dm_faces_sel(DerivedMesh *dm, unsigned char *baseCol, unsigned dm->drawMappedFaces(dm, draw_dm_faces_sel__setDrawOptions, &data, 0, GPU_enable_material); } -static int draw_dm_creases__setDrawOptions(void *userData, int index) +static int draw_dm_creases__setDrawOptions(void *UNUSED(userData), int index) { EditEdge *eed = EM_get_edge_for_index(index); @@ -1890,7 +1893,7 @@ static void draw_dm_creases(DerivedMesh *dm) glLineWidth(1.0); } -static int draw_dm_bweights__setDrawOptions(void *userData, int index) +static int draw_dm_bweights__setDrawOptions(void *UNUSED(userData), int index) { EditEdge *eed = EM_get_edge_for_index(index); @@ -1901,7 +1904,7 @@ static int draw_dm_bweights__setDrawOptions(void *userData, int index) return 0; } } -static void draw_dm_bweights__mapFunc(void *userData, int index, float *co, float *no_f, short *no_s) +static void draw_dm_bweights__mapFunc(void *UNUSED(userData), int index, float *co, float *UNUSED(no_f), short *UNUSED(no_s)) { EditVert *eve = EM_get_vert_for_index(index); @@ -1936,7 +1939,7 @@ static void draw_dm_bweights(Scene *scene, DerivedMesh *dm) /* EditMesh drawing routines*/ -static void draw_em_fancy_verts(Scene *scene, View3D *v3d, Object *obedit, EditMesh *em, DerivedMesh *cageDM, EditVert *eve_act) +static void draw_em_fancy_verts(Scene *scene, View3D *v3d, Object *obedit, DerivedMesh *cageDM, EditVert *eve_act) { ToolSettings *ts= scene->toolsettings; int sel; @@ -2227,7 +2230,7 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, E } } -static int draw_em_fancy__setFaceOpts(void *userData, int index, int *drawSmooth_r) +static int draw_em_fancy__setFaceOpts(void *UNUSED(userData), int index, int *UNUSED(drawSmooth_r)) { EditFace *efa = EM_get_face_for_index(index); @@ -2239,7 +2242,7 @@ static int draw_em_fancy__setFaceOpts(void *userData, int index, int *drawSmooth return 0; } -static int draw_em_fancy__setGLSLFaceOpts(void *userData, int index) +static int draw_em_fancy__setGLSLFaceOpts(void *UNUSED(userData), int index) { EditFace *efa = EM_get_face_for_index(index); @@ -2385,7 +2388,7 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object if(em) { // XXX retopo_matrix_update(v3d); - draw_em_fancy_verts(scene, v3d, ob, em, cageDM, eve_act); + draw_em_fancy_verts(scene, v3d, ob, cageDM, eve_act); if(me->drawflag & ME_DRAWNORMALS) { UI_ThemeColor(TH_NORMAL); @@ -2435,7 +2438,7 @@ static void draw_mesh_object_outline(View3D *v3d, Object *ob, DerivedMesh *dm) } } -static int wpaint__setSolidDrawOptions(void *userData, int index, int *drawSmooth_r) +static int wpaint__setSolidDrawOptions(void *UNUSED(userData), int UNUSED(index), int *drawSmooth_r) { *drawSmooth_r = 1; return 1; @@ -2520,24 +2523,25 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D * rather then the shading, this is also forced in wire view */ GPU_enable_material(0, NULL); dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, me->mface, 1, GPU_enable_material); - + bglPolygonOffset(rv3d->dist, 1.0); glDepthMask(0); // disable write in zbuffer, selected edge wires show better glEnable(GL_BLEND); - glColor4ub(196, 196, 196, 196); + glColor4ub(255, 255, 255, 96); glEnable(GL_LINE_STIPPLE); - glLineStipple(1, 0x8888); + glLineStipple(1, 0xAAAA); - dm->drawEdges(dm, 1, 0); + dm->drawEdges(dm, 1, 1); bglPolygonOffset(rv3d->dist, 0.0); glDepthMask(1); glDisable(GL_LINE_STIPPLE); GPU_disable_material(); - - + + /* since we already draw wire as wp guide, dont draw over the top */ + draw_wire= 0; } else { Paint *p; @@ -4029,7 +4033,7 @@ static void draw_update_ptcache_edit(Scene *scene, Object *ob, PTCacheEdit *edit psys_cache_edit_paths(scene, ob, edit, CFRA); } -static void draw_ptcache_edit(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob, PTCacheEdit *edit, int dt) +static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit) { ParticleCacheKey **cache, *path, *pkey; PTCacheEditPoint *point; @@ -4823,9 +4827,9 @@ static void draw_empty_cone (float size) } /* draw points on curve speed handles */ +#if 0 // XXX old animation system stuff static void curve_draw_speed(Scene *scene, Object *ob) { -#if 0 // XXX old animation system stuff Curve *cu= ob->data; IpoCurve *icu; BezTriple *bezt; @@ -4851,8 +4855,8 @@ static void curve_draw_speed(Scene *scene, Object *ob) glPointSize(1.0); bglEnd(); -#endif // XXX old animation system stuff } +#endif // XXX old animation system stuff static void draw_textcurs(float textcurs[][2]) @@ -5648,13 +5652,13 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) bAnimVizSettings *avs= &ob->avs; /* setup drawing environment for paths */ - draw_motion_paths_init(scene, v3d, ar); + draw_motion_paths_init(v3d, ar); /* draw motion path for object */ - draw_motion_path_instance(scene, v3d, ar, ob, NULL, avs, ob->mpath); + draw_motion_path_instance(scene, ob, NULL, avs, ob->mpath); /* cleanup after drawing */ - draw_motion_paths_cleanup(scene, v3d, ar); + draw_motion_paths_cleanup(v3d); } /* multiply view with object matrix. @@ -5878,9 +5882,9 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) } else if(boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) { empty_object= drawDispList(scene, v3d, rv3d, base, dt); - - if(cu->path) - curve_draw_speed(scene, ob); + +//XXX old animsys if(cu->path) +// curve_draw_speed(scene, ob); } break; case OB_MBALL: @@ -5899,7 +5903,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) } case OB_EMPTY: if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) - drawaxes(ob->empty_drawsize, flag, ob->empty_drawtype); + drawaxes(ob->empty_drawsize, ob->empty_drawtype); break; case OB_LAMP: if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) { @@ -5925,7 +5929,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) break; default: if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) { - drawaxes(1.0, flag, OB_ARROWS); + drawaxes(1.0, OB_ARROWS); } } @@ -5997,7 +6001,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) PTCacheEdit *edit = PE_create_current(scene, ob); if(edit) { glLoadMatrixf(rv3d->viewmat); - draw_ptcache_edit(scene, v3d, rv3d, ob, edit, dt); + draw_ptcache_edit(scene, v3d, edit); glMultMatrixf(ob->obmat); } } @@ -6051,7 +6055,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) // #if 0 smd->domain->tex = NULL; GPU_create_smoke(smd, 0); - draw_volume(scene, ar, v3d, base, smd->domain->tex, smd->domain->p0, smd->domain->p1, smd->domain->res, smd->domain->dx, smd->domain->tex_shadow); + draw_volume(ar, smd->domain->tex, smd->domain->p0, smd->domain->p1, smd->domain->res, smd->domain->dx, smd->domain->tex_shadow); GPU_free_smoke(smd); // #endif #if 0 @@ -6102,7 +6106,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) { smd->domain->tex = NULL; GPU_create_smoke(smd, 1); - draw_volume(scene, ar, v3d, base, smd->domain->tex, smd->domain->p0, smd->domain->p1, smd->domain->res_wt, smd->domain->dx_wt, smd->domain->tex_shadow); + draw_volume(ar, smd->domain->tex, smd->domain->p0, smd->domain->p1, smd->domain->res_wt, smd->domain->dx_wt, smd->domain->tex_shadow); GPU_free_smoke(smd); } } @@ -6125,7 +6129,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) if(dtx && (G.f & G_RENDER_OGL)==0) { if(dtx & OB_AXIS) { - drawaxes(1.0f, flag, OB_ARROWS); + drawaxes(1.0f, OB_ARROWS); } if(dtx & OB_BOUNDBOX) { if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) @@ -6265,7 +6269,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) /* ***************** BACKBUF SEL (BBS) ********* */ -static void bbs_mesh_verts__mapFunc(void *userData, int index, float *co, float *no_f, short *no_s) +static void bbs_mesh_verts__mapFunc(void *userData, int index, float *co, float *UNUSED(no_f), short *UNUSED(no_s)) { int offset = (intptr_t) userData; EditVert *eve = EM_get_vert_for_index(index); @@ -6301,7 +6305,7 @@ static void bbs_mesh_wire(DerivedMesh *dm, int offset) dm->drawMappedEdges(dm, bbs_mesh_wire__setDrawOptions, (void*)(intptr_t) offset); } -static int bbs_mesh_solid__setSolidDrawOptions(void *userData, int index, int *drawSmooth_r) +static int bbs_mesh_solid__setSolidDrawOptions(void *userData, int index, int *UNUSED(drawSmooth_r)) { if (EM_get_face_for_index(index)->h==0) { if (userData) { @@ -6313,7 +6317,7 @@ static int bbs_mesh_solid__setSolidDrawOptions(void *userData, int index, int *d } } -static void bbs_mesh_solid__drawCenter(void *userData, int index, float *cent, float *no) +static void bbs_mesh_solid__drawCenter(void *UNUSED(userData), int index, float *cent, float *UNUSED(no)) { EditFace *efa = EM_get_face_for_index(index); @@ -6345,13 +6349,13 @@ static void bbs_mesh_solid_EM(Scene *scene, View3D *v3d, Object *ob, DerivedMesh } } -static int bbs_mesh_solid__setDrawOpts(void *userData, int index, int *drawSmooth_r) +static int bbs_mesh_solid__setDrawOpts(void *UNUSED(userData), int index, int *UNUSED(drawSmooth_r)) { WM_set_framebuffer_index_color(index+1); return 1; } -static int bbs_mesh_solid_hide__setDrawOpts(void *userData, int index, int *drawSmooth_r) +static int bbs_mesh_solid_hide__setDrawOpts(void *userData, int index, int *UNUSED(drawSmooth_r)) { Mesh *me = userData; @@ -6498,7 +6502,7 @@ void draw_object_instance(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object draw_object_mesh_instance(scene, v3d, rv3d, ob, dt, outline); break; case OB_EMPTY: - drawaxes(ob->empty_drawsize, 0, ob->empty_drawtype); + drawaxes(ob->empty_drawsize, ob->empty_drawtype); break; } } diff --git a/source/blender/editors/space_view3d/drawvolume.c b/source/blender/editors/space_view3d/drawvolume.c index 678920f8173..611cf68d81c 100644 --- a/source/blender/editors/space_view3d/drawvolume.c +++ b/source/blender/editors/space_view3d/drawvolume.c @@ -175,7 +175,7 @@ static int larger_pow2(int n) return n*2; } -void draw_volume(Scene *scene, ARegion *ar, View3D *v3d, Base *base, GPUTexture *tex, float *min, float *max, int res[3], float dx, GPUTexture *tex_shadow) +void draw_volume(ARegion *ar, GPUTexture *tex, float *min, float *max, int res[3], float dx, GPUTexture *tex_shadow) { RegionView3D *rv3d= ar->regiondata; diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index 8a215834c38..6261ca52564 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -274,7 +274,7 @@ static void view3d_free(SpaceLink *sl) /* spacetype; init callback */ -static void view3d_init(struct wmWindowManager *wm, ScrArea *sa) +static void view3d_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa)) { } @@ -387,7 +387,7 @@ static void view3d_main_area_init(wmWindowManager *wm, ARegion *ar) } -static int view3d_ob_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) +static int view3d_ob_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event)) { if(drag->type==WM_DRAG_ID) { ID *id= (ID *)drag->poin; @@ -397,7 +397,7 @@ static int view3d_ob_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) return 0; } -static int view3d_mat_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) +static int view3d_mat_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event)) { if(drag->type==WM_DRAG_ID) { ID *id= (ID *)drag->poin; @@ -407,7 +407,7 @@ static int view3d_mat_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) return 0; } -static int view3d_ima_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) +static int view3d_ima_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event)) { if(drag->type==WM_DRAG_ID) { ID *id= (ID *)drag->poin; @@ -548,22 +548,36 @@ static void view3d_recalc_used_layers(ARegion *ar, wmNotifier *wmn, Scene *scene base= base->next; } - sa= win->screen->areabase.first; - while(sa) { - if(sa->spacetype == SPACE_VIEW3D) - if(BLI_findindex(&sa->regionbase, ar) >= 0) { + for(sa= win->screen->areabase.first; sa; sa= sa->next) { + if(sa->spacetype == SPACE_VIEW3D) { + if(BLI_findindex(&sa->regionbase, ar) != -1) { View3D *v3d= sa->spacedata.first; v3d->lay_used= lay_used; break; } + } + } +} - sa= sa->next; +static View3D *view3d_from_wmn(ARegion *ar, wmNotifier *wmn) +{ + wmWindow *win= wmn->wm->winactive; + ScrArea *sa; + + for(sa= win->screen->areabase.first; sa; sa= sa->next) { + if(sa->spacetype == SPACE_VIEW3D) + if(BLI_findindex(&sa->regionbase, ar) != -1) { + return (View3D *)sa->spacedata.first; + } } + + return NULL; } static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn) { bScreen *sc; + View3D *v3d; /* context changes */ switch(wmn->category) { @@ -600,6 +614,11 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn) case ND_MODE: ED_region_tag_redraw(ar); break; + case ND_WORLD: + v3d= view3d_from_wmn(ar, wmn); + if(v3d->flag2 & V3D_RENDER_OVERRIDE) + ED_region_tag_redraw(ar); + break; } if (wmn->action == NA_EDITED) ED_region_tag_redraw(ar); @@ -650,7 +669,9 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn) case NC_WORLD: switch(wmn->data) { case ND_WORLD_DRAW: - ED_region_tag_redraw(ar); + v3d= view3d_from_wmn(ar, wmn); + if(v3d->flag2 & V3D_RENDER_OVERRIDE) + ED_region_tag_redraw(ar); break; } break; @@ -705,7 +726,7 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn) } /* concept is to retrieve cursor type context-less */ -static void view3d_main_area_cursor(wmWindow *win, ScrArea *sa, ARegion *ar) +static void view3d_main_area_cursor(wmWindow *win, ScrArea *UNUSED(sa), ARegion *UNUSED(ar)) { Scene *scene= win->screen->scene; diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index a0167c87d87..450b3725bdb 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -128,7 +128,7 @@ typedef struct { /* is used for both read and write... */ -static void v3d_editvertex_buts(const bContext *C, uiLayout *layout, View3D *v3d, Object *ob, float lim) +static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float lim) { uiBlock *block= (layout)? uiLayoutAbsoluteBlock(layout): NULL; MDeformVert *dvert=NULL; @@ -643,7 +643,7 @@ static void vgroup_normalize_active(Object *ob) } -static void do_view3d_vgroup_buttons(bContext *C, void *arg, int event) +static void do_view3d_vgroup_buttons(bContext *C, void *UNUSED(arg), int event) { Scene *scene= CTX_data_scene(C); Object *ob= OBACT; @@ -670,7 +670,7 @@ static void do_view3d_vgroup_buttons(bContext *C, void *arg, int event) WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob->data); } -int view3d_panel_vgroup_poll(const bContext *C, PanelType *pt) +int view3d_panel_vgroup_poll(const bContext *C, PanelType *UNUSED(pt)) { Scene *scene= CTX_data_scene(C); Object *ob= OBACT; @@ -794,7 +794,7 @@ static void v3d_transform_butsR(uiLayout *layout, PointerRNA *ptr) } } -static void v3d_posearmature_buts(uiLayout *layout, View3D *v3d, Object *ob, float lim) +static void v3d_posearmature_buts(uiLayout *layout, Object *ob) { // uiBlock *block= uiLayoutGetBlock(layout); // bArmature *arm; @@ -896,7 +896,7 @@ void validate_editbonebutton_cb(bContext *C, void *bonev, void *namev) WM_event_add_notifier(C, NC_OBJECT|ND_BONE_SELECT, CTX_data_edit_object(C)); // XXX fix } -static void v3d_editarmature_buts(uiLayout *layout, View3D *v3d, Object *ob, float lim) +static void v3d_editarmature_buts(uiLayout *layout, Object *ob) { // uiBlock *block= uiLayoutGetBlock(layout); bArmature *arm= ob->data; @@ -930,7 +930,7 @@ static void v3d_editarmature_buts(uiLayout *layout, View3D *v3d, Object *ob, flo uiItemR(col, &eboneptr, "roll", 0, "Roll", 0); } -static void v3d_editmetaball_buts(uiLayout *layout, Object *ob, float lim) +static void v3d_editmetaball_buts(uiLayout *layout, Object *ob) { PointerRNA mbptr, ptr; MetaBall *mball= ob->data; @@ -989,7 +989,7 @@ static int test_parent_loop(Object *par, Object *ob) return test_parent_loop(par->parent, ob); } -static void do_view3d_region_buttons(bContext *C, void *arg, int event) +static void do_view3d_region_buttons(bContext *C, void *UNUSED(index), int event) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); @@ -1012,7 +1012,7 @@ static void do_view3d_region_buttons(bContext *C, void *arg, int event) case B_OBJECTPANELMEDIAN: if(ob) { - v3d_editvertex_buts(C, NULL, v3d, ob, 1.0); + v3d_editvertex_buts(NULL, v3d, ob, 1.0); DAG_id_flush_update(&ob->id, OB_RECALC_DATA); } break; @@ -1152,12 +1152,12 @@ static void do_view3d_region_buttons(bContext *C, void *arg, int event) WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, ob); } -void removeTransformOrientation_func(bContext *C, void *target, void *unused) +void removeTransformOrientation_func(bContext *C, void *target, void *UNUSED(arg)) { BIF_removeTransformOrientation(C, (TransformOrientation *) target); } -void selectTransformOrientation_func(bContext *C, void *target, void *unused) +void selectTransformOrientation_func(bContext *C, void *target, void *UNUSED(arg)) { BIF_selectTransformOrientation(C, (TransformOrientation *) target); } @@ -1203,12 +1203,12 @@ static void view3d_panel_object(const bContext *C, Panel *pa) RNA_id_pointer_create(&ob->id, &obptr); if(ob==obedit) { - if(ob->type==OB_ARMATURE) v3d_editarmature_buts(col, v3d, ob, lim); - if(ob->type==OB_MBALL) v3d_editmetaball_buts(col, ob, lim); - else v3d_editvertex_buts(C, col, v3d, ob, lim); + if(ob->type==OB_ARMATURE) v3d_editarmature_buts(col, ob); + if(ob->type==OB_MBALL) v3d_editmetaball_buts(col, ob); + else v3d_editvertex_buts(col, v3d, ob, lim); } else if(ob->mode & OB_MODE_POSE) { - v3d_posearmature_buts(col, v3d, ob, lim); + v3d_posearmature_buts(col, ob); } else { @@ -1421,7 +1421,7 @@ static void view3d_panel_operator_redo(const bContext *C, Panel *pa) } RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr); - uiDefAutoButsRNA(C, pa->layout, &ptr, 2); + uiDefAutoButsRNA(pa->layout, &ptr, 2); } #endif // XXX not used @@ -1451,7 +1451,7 @@ void view3d_buttons_register(ARegionType *art) // XXX view3d_panel_preview(C, ar, 0); } -static int view3d_properties(bContext *C, wmOperator *op) +static int view3d_properties(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); ARegion *ar= view3d_has_buttons_region(sa); diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 24f71b8b1df..67c2a4f1c56 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -1140,7 +1140,7 @@ ImBuf *view3d_read_backbuf(ViewContext *vc, short xmin, short ymin, short xmax, if(ymax >= vc->ar->winy) ymaxc= vc->ar->winy-1; else ymaxc= ymax; if(yminc > ymaxc) return NULL; - ibuf= IMB_allocImBuf((xmaxc-xminc+1), (ymaxc-yminc+1), 32, IB_rect,0); + ibuf= IMB_allocImBuf((xmaxc-xminc+1), (ymaxc-yminc+1), 32, IB_rect); view3d_validate_backbuf(vc); @@ -1160,7 +1160,7 @@ ImBuf *view3d_read_backbuf(ViewContext *vc, short xmin, short ymin, short xmax, if(xminc==xmin && xmaxc==xmax && yminc==ymin && ymaxc==ymax) return ibuf; - ibuf1= IMB_allocImBuf( (xmax-xmin+1),(ymax-ymin+1),32,IB_rect,0); + ibuf1= IMB_allocImBuf( (xmax-xmin+1),(ymax-ymin+1),32,IB_rect); rd= ibuf->rect; dr= ibuf1->rect; @@ -1589,7 +1589,7 @@ static void draw_dupli_objects(Scene *scene, ARegion *ar, View3D *v3d, Base *bas } -void view3d_update_depths(ARegion *ar, View3D *v3d) +void view3d_update_depths(ARegion *ar) { RegionView3D *rv3d= ar->regiondata; @@ -2092,7 +2092,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar, in } /* read in pixels & stamp */ - ibuf= IMB_allocImBuf(sizex, sizey, 32, flag, 0); + ibuf= IMB_allocImBuf(sizex, sizey, 32, flag); if(ibuf->rect_float) glReadPixels(0, 0, sizex, sizey, GL_RGBA, GL_FLOAT, ibuf->rect_float); @@ -2354,7 +2354,7 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar) // retopo= retopo_mesh_check() || retopo_curve_check(); sculptparticle= (obact && obact->mode & (OB_MODE_PARTICLE_EDIT)) && !scene->obedit; if(retopo) - view3d_update_depths(ar, v3d); + view3d_update_depths(ar); /* draw selected and editmode */ for(base= scene->base.first; base; base= base->next) { @@ -2365,7 +2365,7 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar) } if(!retopo && sculptparticle && !(obact && (obact->dtx & OB_DRAWXRAY))) { - view3d_update_depths(ar, v3d); + view3d_update_depths(ar); } // REEB_draw(); @@ -2378,7 +2378,7 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar) ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW); if(!retopo && sculptparticle && (obact && (OBACT->dtx & OB_DRAWXRAY))) { - view3d_update_depths(ar, v3d); + view3d_update_depths(ar); } if(rv3d->rflag & RV3D_CLIPPING) diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 9f1b55ee2ce..dc75efcc5ca 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -1374,7 +1374,7 @@ void VIEW3D_OT_view_all(wmOperatorType *ot) } -static int viewselected_exec(bContext *C, wmOperator *op) /* like a localview without local!, was centerview() in 2.4x */ +static int viewselected_exec(bContext *C, wmOperator *UNUSED(op)) /* like a localview without local!, was centerview() in 2.4x */ { ARegion *ar= CTX_wm_region(C); View3D *v3d = CTX_wm_view3d(C); @@ -1514,7 +1514,7 @@ void VIEW3D_OT_view_selected(wmOperatorType *ot) ot->flag= 0; } -static int viewcenter_cursor_exec(bContext *C, wmOperator *op) +static int viewcenter_cursor_exec(bContext *C, wmOperator *UNUSED(op)) { View3D *v3d = CTX_wm_view3d(C); RegionView3D *rv3d= CTX_wm_region_view3d(C); @@ -1548,7 +1548,7 @@ void VIEW3D_OT_view_center_cursor(wmOperatorType *ot) ot->flag= 0; } -static int view3d_center_camera_exec(bContext *C, wmOperator *op) /* was view3d_home() in 2.4x */ +static int view3d_center_camera_exec(bContext *C, wmOperator *UNUSED(op)) /* was view3d_home() in 2.4x */ { RegionView3D *rv3d= CTX_wm_region_view3d(C); @@ -1691,7 +1691,7 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op) rv3d->depths->damaged = 1; } - view3d_update_depths(ar, v3d); + view3d_update_depths(ar); /* Constrain rect to depth bounds */ if (rect.xmin < 0) rect.xmin = 0; @@ -2151,7 +2151,7 @@ void VIEW3D_OT_view_pan(wmOperatorType *ot) RNA_def_enum(ot->srna, "type", prop_view_pan_items, 0, "Pan", "Direction of View Pan"); } -static int viewpersportho_exec(bContext *C, wmOperator *op) +static int viewpersportho_exec(bContext *C, wmOperator *UNUSED(op)) { ARegion *ar= CTX_wm_region(C); RegionView3D *rv3d= CTX_wm_region_view3d(C); @@ -2200,16 +2200,15 @@ static BGpic *add_background_image(bContext *C) return bgpic; } -static int add_background_image_exec(bContext *C, wmOperator *op) +static int add_background_image_exec(bContext *C, wmOperator *UNUSED(op)) { add_background_image(C); return OPERATOR_FINISHED; } -static int add_background_image_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int add_background_image_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { - Scene *scene= CTX_data_scene(C); View3D *v3d= CTX_wm_view3d(C); Image *ima= NULL; BGpic *bgpic; @@ -2220,7 +2219,7 @@ static int add_background_image_invoke(bContext *C, wmOperator *op, wmEvent *eve char path[FILE_MAX]; RNA_string_get(op->ptr, "filepath", path); - ima= BKE_add_image_file(path, scene ? scene->r.cfra : 1); + ima= BKE_add_image_file(path); } else if(RNA_property_is_set(op->ptr, "name")) { RNA_string_get(op->ptr, "name", name); @@ -2410,7 +2409,7 @@ void VIEW3D_OT_clip_border(wmOperatorType *ot) /* ***************** 3d cursor cursor op ******************* */ /* mx my in region coords */ -static int set_3dcursor_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int set_3dcursor_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event) { Scene *scene= CTX_data_scene(C); ARegion *ar= CTX_wm_region(C); @@ -2535,7 +2534,7 @@ void VIEW3D_OT_manipulator(wmOperatorType *ot) Transform_Properties(ot, P_CONSTRAINT); } -static int enable_manipulator_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int enable_manipulator_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { View3D *v3d = CTX_wm_view3d(C); @@ -2644,7 +2643,7 @@ int view_autodist(Scene *scene, ARegion *ar, View3D *v3d, short *mval, float mou rv3d->depths->damaged = 1; } - view3d_update_depths(ar, v3d); + view3d_update_depths(ar); depth_close= view_autodist_depth_margin(ar, mval, 4); @@ -2688,7 +2687,7 @@ int view_autodist_init(Scene *scene, ARegion *ar, View3D *v3d, int mode) //, flo rv3d->depths->damaged = 1; } - view3d_update_depths(ar, v3d); + view3d_update_depths(ar); return 1; } @@ -2785,7 +2784,7 @@ void filterNDOFvalues(float *sbval) int dz_flag = 0; float m_dist; -void viewmoveNDOFfly(ARegion *ar, View3D *v3d, int mode) +void viewmoveNDOFfly(ARegion *ar, View3D *v3d, int UNUSED(mode)) { RegionView3D *rv3d= ar->regiondata; int i; @@ -2914,7 +2913,7 @@ void viewmoveNDOFfly(ARegion *ar, View3D *v3d, int mode) // XXX BIF_view3d_previewrender_signal(ar, PR_DBASE|PR_DISPRECT); } -void viewmoveNDOF(Scene *scene, ARegion *ar, View3D *v3d, int mode) +void viewmoveNDOF(Scene *scene, ARegion *ar, View3D *v3d, int UNUSED(mode)) { RegionView3D *rv3d= ar->regiondata; float fval[7]; diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c index d7ab8034286..5ca8843b658 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -304,7 +304,7 @@ static char *view3d_modeselect_pup(Scene *scene) } -static void do_view3d_header_buttons(bContext *C, void *arg, int event) +static void do_view3d_header_buttons(bContext *C, void *UNUSED(arg), int event) { wmWindow *win= CTX_wm_window(C); ToolSettings *ts= CTX_data_tool_settings(C); diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index 4065b159ccf..9d1f5a77a3f 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -93,11 +93,11 @@ void VIEW3D_OT_drawtype(struct wmOperatorType *ot); void view3d_boxview_copy(ScrArea *sa, ARegion *ar); /* drawanim.c */ -void draw_motion_paths_init(Scene *scene, View3D *v3d, struct ARegion *ar); -void draw_motion_path_instance(Scene *scene, View3D *v3d, struct ARegion *ar, +void draw_motion_paths_init(View3D *v3d, struct ARegion *ar); +void draw_motion_path_instance(Scene *scene, struct Object *ob, struct bPoseChannel *pchan, struct bAnimVizSettings *avs, struct bMotionPath *mpath); -void draw_motion_paths_cleanup(Scene *scene, View3D *v3d, struct ARegion *ar); +void draw_motion_paths_cleanup(View3D *v3d); @@ -106,7 +106,7 @@ void draw_object(Scene *scene, struct ARegion *ar, View3D *v3d, Base *base, int int draw_glsl_material(Scene *scene, struct Object *ob, View3D *v3d, int dt); void draw_object_instance(Scene *scene, View3D *v3d, RegionView3D *rv3d, struct Object *ob, int dt, int outline); void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, struct Object *ob); -void drawaxes(float size, int flag, char drawtype); +void drawaxes(float size, char drawtype); void view3d_cached_text_draw_begin(void); void view3d_cached_text_draw_add(float x, float y, float z, char *str, short xoffs, short flag); @@ -130,7 +130,7 @@ void add_view3d_after(ListBase *lb, Base *base, int flag); void circf(float x, float y, float rad); void circ(float x, float y, float rad); -void view3d_update_depths(struct ARegion *ar, View3D *v3d); +void view3d_update_depths(struct ARegion *ar); /* view3d_select.c */ void VIEW3D_OT_select(struct wmOperatorType *ot); @@ -189,7 +189,7 @@ ARegion *view3d_has_buttons_region(ScrArea *sa); ARegion *view3d_has_tools_region(ScrArea *sa); /* draw_volume.c */ -void draw_volume(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, struct Base *base, struct GPUTexture *tex, float *min, float *max, int res[3], float dx, struct GPUTexture *tex_shadow); +void draw_volume(struct ARegion *ar, struct GPUTexture *tex, float *min, float *max, int res[3], float dx, struct GPUTexture *tex_shadow); #endif /* ED_VIEW3D_INTERN_H */ diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index 7e6e8e0e6af..e3212e8a3d1 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -189,9 +189,9 @@ void EM_backbuf_checkAndSelectTFaces(Mesh *me, int select) } } +#if 0 void arrows_move_cursor(unsigned short event) { -#if 0 short mval[2]; getmouseco_sc(mval); @@ -205,8 +205,8 @@ void arrows_move_cursor(unsigned short event) } else if(event==RIGHTARROWKEY) { warp_pointer(mval[0]+1, mval[1]); } -#endif } +#endif /* *********************** GESTURE AND LASSO ******************* */ @@ -404,7 +404,7 @@ void lasso_select_boundbox(rcti *rect, short mcords[][2], short moves) } } -static void do_lasso_select_mesh__doSelectVert(void *userData, EditVert *eve, int x, int y, int index) +static void do_lasso_select_mesh__doSelectVert(void *userData, EditVert *eve, int x, int y, int UNUSED(index)) { struct { ViewContext vc; rcti *rect; short (*mcords)[2], moves, select, pass, done; } *data = userData; @@ -431,7 +431,7 @@ static void do_lasso_select_mesh__doSelectEdge(void *userData, EditEdge *eed, in } } } -static void do_lasso_select_mesh__doSelectFace(void *userData, EditFace *efa, int x, int y, int index) +static void do_lasso_select_mesh__doSelectFace(void *userData, EditFace *efa, int x, int y, int UNUSED(index)) { struct { ViewContext vc; rcti *rect; short (*mcords)[2], moves, select, pass, done; } *data = userData; @@ -560,7 +560,7 @@ static void do_lasso_select_mesh_uv(short mcords[][2], short moves, short select } #endif -static void do_lasso_select_curve__doSelect(void *userData, Nurb *nu, BPoint *bp, BezTriple *bezt, int beztindex, int x, int y) +static void do_lasso_select_curve__doSelect(void *userData, Nurb *UNUSED(nu), BPoint *bp, BezTriple *bezt, int beztindex, int x, int y) { struct { ViewContext *vc; short (*mcords)[2]; short moves; short select; } *data = userData; Object *obedit= data->vc->obedit; @@ -1291,7 +1291,7 @@ int edge_inside_circle(short centx, short centy, short rad, short x1, short y1, return 0; } -static void do_nurbs_box_select__doSelect(void *userData, Nurb *nu, BPoint *bp, BezTriple *bezt, int beztindex, int x, int y) +static void do_nurbs_box_select__doSelect(void *userData, Nurb *UNUSED(nu), BPoint *bp, BezTriple *bezt, int beztindex, int x, int y) { struct { ViewContext *vc; rcti *rect; int select; } *data = userData; Object *obedit= data->vc->obedit; @@ -1359,7 +1359,7 @@ static void do_lattice_box_select(ViewContext *vc, rcti *rect, int select, int e lattice_foreachScreenVert(vc, do_lattice_box_select__doSelect, &data); } -static void do_mesh_box_select__doSelectVert(void *userData, EditVert *eve, int x, int y, int index) +static void do_mesh_box_select__doSelectVert(void *userData, EditVert *eve, int x, int y, int UNUSED(index)) { struct { ViewContext vc; rcti *rect; short select, pass, done; } *data = userData; @@ -1384,7 +1384,7 @@ static void do_mesh_box_select__doSelectEdge(void *userData, EditEdge *eed, int } } } -static void do_mesh_box_select__doSelectFace(void *userData, EditFace *efa, int x, int y, int index) +static void do_mesh_box_select__doSelectFace(void *userData, EditFace *efa, int x, int y, int UNUSED(index)) { struct { ViewContext vc; rcti *rect; short select, pass, done; } *data = userData; @@ -1800,7 +1800,7 @@ void VIEW3D_OT_select(wmOperatorType *ot) /* -------------------- circle select --------------------------------------------- */ -static void mesh_circle_doSelectVert(void *userData, EditVert *eve, int x, int y, int index) +static void mesh_circle_doSelectVert(void *userData, EditVert *eve, int x, int y, int UNUSED(index)) { struct {ViewContext *vc; short select, mval[2]; float radius; } *data = userData; int mx = x - data->mval[0], my = y - data->mval[1]; @@ -1810,7 +1810,7 @@ static void mesh_circle_doSelectVert(void *userData, EditVert *eve, int x, int y eve->f = data->select?(eve->f|1):(eve->f&~1); } } -static void mesh_circle_doSelectEdge(void *userData, EditEdge *eed, int x0, int y0, int x1, int y1, int index) +static void mesh_circle_doSelectEdge(void *userData, EditEdge *eed, int x0, int y0, int x1, int y1, int UNUSED(index)) { struct {ViewContext *vc; short select, mval[2]; float radius; } *data = userData; @@ -1818,7 +1818,7 @@ static void mesh_circle_doSelectEdge(void *userData, EditEdge *eed, int x0, int EM_select_edge(eed, data->select); } } -static void mesh_circle_doSelectFace(void *userData, EditFace *efa, int x, int y, int index) +static void mesh_circle_doSelectFace(void *userData, EditFace *efa, int x, int y, int UNUSED(index)) { struct {ViewContext *vc; short select, mval[2]; float radius; } *data = userData; int mx = x - data->mval[0], my = y - data->mval[1]; @@ -1892,7 +1892,7 @@ static void paint_facesel_circle_select(ViewContext *vc, int selecting, short *m } -static void nurbscurve_circle_doSelect(void *userData, Nurb *nu, BPoint *bp, BezTriple *bezt, int beztindex, int x, int y) +static void nurbscurve_circle_doSelect(void *userData, Nurb *UNUSED(nu), BPoint *bp, BezTriple *bezt, int beztindex, int x, int y) { struct {ViewContext *vc; short select, mval[2]; float radius; } *data = userData; int mx = x - data->mval[0], my = y - data->mval[1]; diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c index 7f5f7665028..d6778070931 100644 --- a/source/blender/editors/space_view3d/view3d_snap.c +++ b/source/blender/editors/space_view3d/view3d_snap.c @@ -82,7 +82,7 @@ static TransVert *transvmain=NULL; static int tottrans= 0; /* copied from editobject.c, now uses (almost) proper depgraph */ -static void special_transvert_update(Scene *scene, Object *obedit) +static void special_transvert_update(Object *obedit) { if(obedit) { @@ -443,7 +443,7 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode) /* *********************** operators ******************** */ -static int snap_sel_to_grid(bContext *C, wmOperator *op) +static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op)) { extern float originmat[3][3]; /* XXX object.c */ Main *bmain= CTX_data_main(C); @@ -481,7 +481,7 @@ static int snap_sel_to_grid(bContext *C, wmOperator *op) VECCOPY(tv->loc, vec); } - special_transvert_update(scene, obedit); + special_transvert_update(obedit); MEM_freeN(transvmain); transvmain= NULL; @@ -577,7 +577,7 @@ void VIEW3D_OT_snap_selected_to_grid(wmOperatorType *ot) /* *************************************************** */ -static int snap_sel_to_curs(bContext *C, wmOperator *op) +static int snap_sel_to_curs(bContext *C, wmOperator *UNUSED(op)) { extern float originmat[3][3]; /* XXX object.c */ Main *bmain= CTX_data_main(C); @@ -602,15 +602,12 @@ static int snap_sel_to_curs(bContext *C, wmOperator *op) tv= transvmain; for(a=0; a<tottrans; a++, tv++) { - vec[0]= curs[0]-obedit->obmat[3][0]; - vec[1]= curs[1]-obedit->obmat[3][1]; - vec[2]= curs[2]-obedit->obmat[3][2]; - + sub_v3_v3v3(vec, curs, obedit->obmat[3]); mul_m3_v3(imat, vec); - VECCOPY(tv->loc, vec); + copy_v3_v3(tv->loc, vec); } - special_transvert_update(scene, obedit); + special_transvert_update(obedit); MEM_freeN(transvmain); transvmain= NULL; @@ -703,7 +700,7 @@ void VIEW3D_OT_snap_selected_to_cursor(wmOperatorType *ot) /* *************************************************** */ -static int snap_curs_to_grid(bContext *C, wmOperator *op) +static int snap_curs_to_grid(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); RegionView3D *rv3d= CTX_wm_region_data(C); @@ -740,7 +737,7 @@ void VIEW3D_OT_snap_cursor_to_grid(wmOperatorType *ot) /* **************************************************** */ -static int snap_curs_to_sel(bContext *C, wmOperator *op) +static int snap_curs_to_sel(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); Scene *scene= CTX_data_scene(C); @@ -847,7 +844,7 @@ void VIEW3D_OT_snap_cursor_to_selected(wmOperatorType *ot) /* ********************************************** */ -static int snap_curs_to_active(bContext *C, wmOperator *op) +static int snap_curs_to_active(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); Object *obact= CTX_data_active_object(C); @@ -898,7 +895,7 @@ void VIEW3D_OT_snap_cursor_to_active(wmOperatorType *ot) /* **************************************************** */ /*New Code - Snap Cursor to Center -*/ -static int snap_curs_to_center(bContext *C, wmOperator *op) +static int snap_curs_to_center(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); View3D *v3d= CTX_wm_view3d(C); diff --git a/source/blender/editors/space_view3d/view3d_toolbar.c b/source/blender/editors/space_view3d/view3d_toolbar.c index 6e2624cb60b..16896f75915 100644 --- a/source/blender/editors/space_view3d/view3d_toolbar.c +++ b/source/blender/editors/space_view3d/view3d_toolbar.c @@ -65,7 +65,7 @@ /* op->invoke */ -static void redo_cb(bContext *C, void *arg_op, void *arg2) +static void redo_cb(bContext *C, void *arg_op, void *UNUSED(arg2)) { wmOperator *lastop= arg_op; @@ -114,7 +114,7 @@ static void view3d_panel_operator_redo_buts(const bContext *C, Panel *pa, wmOper op->layout= NULL; } else - uiDefAutoButsRNA(C, pa->layout, &ptr, 1); + uiDefAutoButsRNA(pa->layout, &ptr, 1); } static void view3d_panel_operator_redo_header(const bContext *C, Panel *pa) @@ -177,7 +177,7 @@ static void operator_call_cb(struct bContext *C, void *arg_listbase, void *arg2) } -static void operator_search_cb(const struct bContext *C, void *arg, char *str, uiSearchItems *items) +static void operator_search_cb(const struct bContext *C, void *UNUSED(arg), char *str, uiSearchItems *items) { wmOperatorType *ot = WM_operatortype_first(); @@ -280,7 +280,7 @@ void view3d_tool_props_register(ARegionType *art) /* ********** operator to open/close toolshelf region */ -static int view3d_toolshelf(bContext *C, wmOperator *op) +static int view3d_toolshelf(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); ARegion *ar= view3d_has_tools_region(sa); diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 860f9f461c4..8b3d99e355d 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -296,7 +296,7 @@ void smooth_view(bContext *C, Object *oldcamera, Object *camera, float *ofs, flo } /* only meant for timer usage */ -static int view3d_smoothview_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int view3d_smoothview_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event) { View3D *v3d = CTX_wm_view3d(C); RegionView3D *rv3d= CTX_wm_region_view3d(C); @@ -380,7 +380,7 @@ void VIEW3D_OT_smoothview(wmOperatorType *ot) /* ****************** change view operators ****************** */ -static void setcameratoview3d(View3D *v3d, RegionView3D *rv3d, Object *ob) +static void setcameratoview3d(RegionView3D *rv3d, Object *ob) { float dvec[3]; float mat3[3][3]; @@ -399,7 +399,7 @@ static void setcameratoview3d(View3D *v3d, RegionView3D *rv3d, Object *ob) } -static int view3d_setcameratoview_exec(bContext *C, wmOperator *op) +static int view3d_setcameratoview_exec(bContext *C, wmOperator *UNUSED(op)) { View3D *v3d = CTX_wm_view3d(C); RegionView3D *rv3d= CTX_wm_region_view3d(C); @@ -408,7 +408,7 @@ static int view3d_setcameratoview_exec(bContext *C, wmOperator *op) rv3d->lview= rv3d->view; rv3d->lpersp= rv3d->persp; - setcameratoview3d(v3d, rv3d, v3d->camera); + setcameratoview3d(rv3d, v3d->camera); rv3d->persp = RV3D_CAMOB; WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, v3d->camera); @@ -444,7 +444,7 @@ void VIEW3D_OT_setcameratoview(wmOperatorType *ot) } -static int view3d_setobjectascamera_exec(bContext *C, wmOperator *op) +static int view3d_setobjectascamera_exec(bContext *C, wmOperator *UNUSED(op)) { View3D *v3d = CTX_wm_view3d(C); RegionView3D *rv3d= CTX_wm_region_view3d(C); @@ -1600,7 +1600,7 @@ static void endlocalview(Scene *scene, ScrArea *sa) } } -static int localview_exec(bContext *C, wmOperator *unused) +static int localview_exec(bContext *C, wmOperator *UNUSED(unused)) { View3D *v3d= CTX_wm_view3d(C); @@ -1667,6 +1667,7 @@ static void RestoreState(bContext *C) win->queue= queue_back; GPU_state_init(); + GPU_set_tpage(NULL, 0); glPopAttrib(); } @@ -1779,6 +1780,8 @@ static int game_engine_exec(bContext *C, wmOperator *op) RegionView3D *rv3d; rcti cam_frame; + (void)op; /* unused */ + // bad context switch .. if(!ED_view3d_context_activate(C)) return OPERATOR_CANCELLED; @@ -1827,6 +1830,7 @@ static int game_engine_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; #else + (void)C; /* unused */ BKE_report(op->reports, RPT_ERROR, "Game engine is disabled in this build."); return OPERATOR_CANCELLED; #endif @@ -1985,7 +1989,7 @@ typedef struct FlyInfo { } FlyInfo; -static void drawFlyPixel(const struct bContext *C, struct ARegion *ar, void *arg) +static void drawFlyPixel(const struct bContext *UNUSED(C), struct ARegion *UNUSED(ar), void *arg) { FlyInfo *fly = arg; diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index cc0916a8893..ec8121739c4 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -384,7 +384,7 @@ void BIF_selectOrientation() { #endif } -static void view_editmove(unsigned short event) +static void view_editmove(unsigned short UNUSED(event)) { #if 0 // TRANSFORM_FIX_ME int refresh = 0; @@ -481,6 +481,8 @@ static void view_editmove(unsigned short event) * */ #define TFM_MODAL_PROPSIZE_UP 20 #define TFM_MODAL_PROPSIZE_DOWN 21 +#define TFM_MODAL_AUTOIK_LEN_INC 22 +#define TFM_MODAL_AUTOIK_LEN_DEC 23 /* called in transform_ops.c, on each regeneration of keymaps */ wmKeyMap* transform_modal_keymap(wmKeyConfig *keyconf) @@ -507,6 +509,8 @@ wmKeyMap* transform_modal_keymap(wmKeyConfig *keyconf) {NUM_MODAL_INCREMENT_DOWN, "INCREMENT_DOWN", 0, "Numinput Increment Down", ""}, {TFM_MODAL_PROPSIZE_UP, "PROPORTIONAL_SIZE_UP", 0, "Increase Proportional Influence", ""}, {TFM_MODAL_PROPSIZE_DOWN, "PROPORTIONAL_SIZE_DOWN", 0, "Decrease Poportional Influence", ""}, + {TFM_MODAL_AUTOIK_LEN_INC, "AUTOIK_CHAIN_LEN_UP", 0, "Increase Max AutoIK Chain Length", ""}, + {TFM_MODAL_AUTOIK_LEN_DEC, "AUTOIK_CHAIN_LEN_DOWN", 0, "Decrease Max AutoIK Chain Length", ""}, {0, NULL, 0, NULL, NULL}}; wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "Transform Modal Map"); @@ -541,7 +545,12 @@ wmKeyMap* transform_modal_keymap(wmKeyConfig *keyconf) WM_modalkeymap_add_item(keymap, PAGEDOWNKEY, KM_PRESS, 0, 0, TFM_MODAL_PROPSIZE_DOWN); WM_modalkeymap_add_item(keymap, WHEELDOWNMOUSE, KM_PRESS, 0, 0, TFM_MODAL_PROPSIZE_UP); WM_modalkeymap_add_item(keymap, WHEELUPMOUSE, KM_PRESS, 0, 0, TFM_MODAL_PROPSIZE_DOWN); - + + WM_modalkeymap_add_item(keymap, PAGEUPKEY, KM_PRESS, KM_SHIFT, 0, TFM_MODAL_AUTOIK_LEN_INC); + WM_modalkeymap_add_item(keymap, PAGEDOWNKEY, KM_PRESS, KM_SHIFT, 0, TFM_MODAL_AUTOIK_LEN_DEC); + WM_modalkeymap_add_item(keymap, WHEELDOWNMOUSE, KM_PRESS, KM_SHIFT, 0, TFM_MODAL_AUTOIK_LEN_INC); + WM_modalkeymap_add_item(keymap, WHEELUPMOUSE, KM_PRESS, KM_SHIFT, 0, TFM_MODAL_AUTOIK_LEN_DEC); + return keymap; } @@ -732,6 +741,16 @@ int transformEvent(TransInfo *t, wmEvent *event) } t->redraw |= TREDRAW_HARD; break; + case TFM_MODAL_AUTOIK_LEN_INC: + if (t->flag & T_AUTOIK) + transform_autoik_update(t, 1); + t->redraw |= TREDRAW_HARD; + break; + case TFM_MODAL_AUTOIK_LEN_DEC: + if (t->flag & T_AUTOIK) + transform_autoik_update(t, -1); + t->redraw |= TREDRAW_HARD; + break; default: handled = 0; break; @@ -1198,7 +1217,7 @@ static void drawArc(float size, float angle_start, float angle_end, int segments glEnd(); } -static void drawHelpline(bContext *C, int x, int y, void *customdata) +static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata) { TransInfo *t = (TransInfo*)customdata; @@ -1330,16 +1349,16 @@ static void drawHelpline(bContext *C, int x, int y, void *customdata) } } -void drawTransformView(const struct bContext *C, struct ARegion *ar, void *arg) +void drawTransformView(const struct bContext *C, struct ARegion *UNUSED(ar), void *arg) { TransInfo *t = arg; - drawConstraint(C, t); + drawConstraint(t); drawPropCircle(C, t); drawSnapping(C, t); } -void drawTransformPixel(const struct bContext *C, struct ARegion *ar, void *arg) +void drawTransformPixel(const struct bContext *UNUSED(C), struct ARegion *UNUSED(ar), void *UNUSED(arg)) { // TransInfo *t = arg; // @@ -1723,7 +1742,7 @@ void transformApply(const bContext *C, TransInfo *t) } } -void drawTransformApply(const struct bContext *C, struct ARegion *ar, void *arg) +void drawTransformApply(const struct bContext *C, struct ARegion *UNUSED(ar), void *arg) { TransInfo *t = arg; @@ -1896,7 +1915,7 @@ static void protectedQuaternionBits(short protectflag, float *quat, float *oldqu /* ******************* TRANSFORM LIMITS ********************** */ -static void constraintTransLim(TransInfo *t, TransData *td) +static void constraintTransLim(TransInfo *UNUSED(t), TransData *td) { if (td->con) { bConstraintTypeInfo *cti= get_constraint_typeinfo(CONSTRAINT_TYPE_LOCLIMIT); @@ -1991,7 +2010,7 @@ static void constraintob_from_transdata(bConstraintOb *cob, TransData *td) } } -static void constraintRotLim(TransInfo *t, TransData *td) +static void constraintRotLim(TransInfo *UNUSED(t), TransData *td) { if (td->con) { bConstraintTypeInfo *cti= get_constraint_typeinfo(CONSTRAINT_TYPE_ROTLIMIT); @@ -2211,7 +2230,7 @@ int handleEventWarp(TransInfo *t, wmEvent *event) return status; } -int Warp(TransInfo *t, short mval[2]) +int Warp(TransInfo *t, short UNUSED(mval[2])) { TransData *td = t->data; float vec[3], circumfac, dist, phi0, co, si, *curs, cursor[3], gcursor[3]; @@ -2309,7 +2328,7 @@ int Warp(TransInfo *t, short mval[2]) /* ************************** SHEAR *************************** */ -void postInputShear(TransInfo *t, float values[3]) +void postInputShear(TransInfo *UNUSED(t), float values[3]) { mul_v3_fl(values, 0.05f); } @@ -2359,7 +2378,7 @@ int handleEventShear(TransInfo *t, wmEvent *event) } -int Shear(TransInfo *t, short mval[2]) +int Shear(TransInfo *t, short UNUSED(mval[2])) { TransData *td = t->data; float vec[3]; @@ -2723,7 +2742,7 @@ void initToSphere(TransInfo *t) t->val /= (float)t->total; } -int ToSphere(TransInfo *t, short mval[2]) +int ToSphere(TransInfo *t, short UNUSED(mval[2])) { float vec[3]; float ratio, radius; @@ -3058,7 +3077,7 @@ static void applyRotation(TransInfo *t, float angle, float axis[3]) } } -int Rotation(TransInfo *t, short mval[2]) +int Rotation(TransInfo *t, short UNUSED(mval[2])) { char str[64]; @@ -3172,7 +3191,7 @@ static void applyTrackball(TransInfo *t, float axis1[3], float axis2[3], float a } } -int Trackball(TransInfo *t, short mval[2]) +int Trackball(TransInfo *t, short UNUSED(mval[2])) { char str[128]; float axis1[3], axis2[3]; @@ -3391,7 +3410,7 @@ static void applyTranslation(TransInfo *t, float vec[3]) { } /* uses t->vec to store actual translation in */ -int Translation(TransInfo *t, short mval[2]) +int Translation(TransInfo *t, short UNUSED(mval[2])) { char str[250]; @@ -3457,7 +3476,7 @@ void initShrinkFatten(TransInfo *t) -int ShrinkFatten(TransInfo *t, short mval[2]) +int ShrinkFatten(TransInfo *t, short UNUSED(mval[2])) { float vec[3]; float distance; @@ -3532,7 +3551,7 @@ void initTilt(TransInfo *t) -int Tilt(TransInfo *t, short mval[2]) +int Tilt(TransInfo *t, short UNUSED(mval[2])) { TransData *td = t->data; int i; @@ -3604,7 +3623,7 @@ void initCurveShrinkFatten(TransInfo *t) t->flag |= T_NO_CONSTRAINT; } -int CurveShrinkFatten(TransInfo *t, short mval[2]) +int CurveShrinkFatten(TransInfo *t, short UNUSED(mval[2])) { TransData *td = t->data; float ratio; @@ -3672,7 +3691,7 @@ void initPushPull(TransInfo *t) } -int PushPull(TransInfo *t, short mval[2]) +int PushPull(TransInfo *t, short UNUSED(mval[2])) { float vec[3], axis[3]; float distance; @@ -3805,7 +3824,7 @@ int handleEventBevel(TransInfo *t, wmEvent *event) return 0; } -int Bevel(TransInfo *t, short mval[2]) +int Bevel(TransInfo *t, short UNUSED(mval[2])) { float distance,d; int i; @@ -3873,7 +3892,7 @@ void initBevelWeight(TransInfo *t) t->flag |= T_NO_CONSTRAINT|T_NO_PROJECT; } -int BevelWeight(TransInfo *t, short mval[2]) +int BevelWeight(TransInfo *t, short UNUSED(mval[2])) { TransData *td = t->data; float weight; @@ -3946,7 +3965,7 @@ void initCrease(TransInfo *t) t->flag |= T_NO_CONSTRAINT|T_NO_PROJECT; } -int Crease(TransInfo *t, short mval[2]) +int Crease(TransInfo *t, short UNUSED(mval[2])) { TransData *td = t->data; float crease; @@ -4140,7 +4159,7 @@ void initBoneEnvelope(TransInfo *t) t->flag |= T_NO_CONSTRAINT|T_NO_PROJECT; } -int BoneEnvelope(TransInfo *t, short mval[2]) +int BoneEnvelope(TransInfo *t, short UNUSED(mval[2])) { TransData *td = t->data; float ratio; @@ -4846,7 +4865,7 @@ int doEdgeSlide(TransInfo *t, float perc) return 1; } -int EdgeSlide(TransInfo *t, short mval[2]) +int EdgeSlide(TransInfo *t, short UNUSED(mval[2])) { char str[50]; float final; @@ -4905,7 +4924,7 @@ void initBoneRoll(TransInfo *t) t->flag |= T_NO_CONSTRAINT|T_NO_PROJECT; } -int BoneRoll(TransInfo *t, short mval[2]) +int BoneRoll(TransInfo *t, short UNUSED(mval[2])) { TransData *td = t->data; int i; @@ -5041,7 +5060,7 @@ void initMirror(TransInfo *t) } } -int Mirror(TransInfo *t, short mval[2]) +int Mirror(TransInfo *t, short UNUSED(mval[2])) { TransData *td; float size[3], mat[3][3]; @@ -5118,7 +5137,7 @@ void initAlign(TransInfo *t) initMouseInputMode(t, &t->mouse, INPUT_NONE); } -int Align(TransInfo *t, short mval[2]) +int Align(TransInfo *t, short UNUSED(mval[2])) { TransData *td = t->data; float center[3]; @@ -5221,7 +5240,7 @@ static void applySeqSlide(TransInfo *t, float val[2]) { } } -int SeqSlide(TransInfo *t, short mval[2]) +int SeqSlide(TransInfo *t, short UNUSED(mval[2])) { char str[200]; @@ -5449,7 +5468,7 @@ static void headerTimeTranslate(TransInfo *t, char *str) sprintf(str, "DeltaX: %s", &tvec[0]); } -static void applyTimeTranslate(TransInfo *t, float sval) +static void applyTimeTranslate(TransInfo *t, float UNUSED(sval)) { TransData *td = t->data; TransData2D *td2d = t->data2d; @@ -5751,7 +5770,7 @@ static void applyTimeScale(TransInfo *t) { } } -int TimeScale(TransInfo *t, short mval[2]) +int TimeScale(TransInfo *t, short UNUSED(mval[2])) { char str[200]; @@ -5772,7 +5791,7 @@ int TimeScale(TransInfo *t, short mval[2]) /* ************************************ */ -void BIF_TransformSetUndo(char *str) +void BIF_TransformSetUndo(char *UNUSED(str)) { // TRANSFORM_FIX_ME //Trans.undostr= str; diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h index 6cfe78a979d..bb6ffe9155f 100644 --- a/source/blender/editors/transform/transform.h +++ b/source/blender/editors/transform/transform.h @@ -571,7 +571,7 @@ void autokeyframe_pose_cb_func(struct bContext *C, struct Scene *scene, struct V /*********************** Constraints *****************************/ -void drawConstraint(const struct bContext *C, TransInfo *t); +void drawConstraint(TransInfo *t); void getConstraintMatrix(TransInfo *t); void setConstraint(TransInfo *t, float space[3][3], int mode, const char text[]); diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c index 1e6916f0a86..b15c5b07758 100644 --- a/source/blender/editors/transform/transform_constraints.c +++ b/source/blender/editors/transform/transform_constraints.c @@ -593,7 +593,7 @@ void setUserConstraint(TransInfo *t, short orientation, int mode, const char fte /*----------------- DRAWING CONSTRAINTS -------------------*/ -void drawConstraint(const struct bContext *C, TransInfo *t) +void drawConstraint(TransInfo *t) { TransCon *tc = &(t->con); diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 01404603b86..d723f77f537 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -232,7 +232,7 @@ static void set_prop_dist(TransInfo *t, short with_dist) /* ********************* texture space ********* */ -static void createTransTexspace(bContext *C, TransInfo *t) +static void createTransTexspace(TransInfo *t) { Scene *scene = t->scene; TransData *td; @@ -277,7 +277,7 @@ static void createTransTexspace(bContext *C, TransInfo *t) /* ********************* edge (for crease) ***** */ -static void createTransEdge(bContext *C, TransInfo *t) { +static void createTransEdge(TransInfo *t) { EditMesh *em = ((Mesh *)t->obedit->data)->edit_mesh; TransData *td = NULL; EditEdge *eed; @@ -446,16 +446,21 @@ static short apply_targetless_ik(Object *ob) /* apply and decompose, doesn't work for constraints or non-uniform scale well */ { float rmat3[3][3], qrmat[3][3], imat[3][3], smat[3][3]; - + copy_m3_m4(rmat3, rmat); /* rotation */ - if (parchan->rotmode > 0) - mat3_to_eulO( parchan->eul, parchan->rotmode,rmat3); + /* [#22409] is partially caused by this, as slight numeric error introduced during + * the solving process leads to locked-axis values changing. However, we cannot modify + * the values here, or else there are huge discreptancies between IK-solver (interactive) + * and applied poses. + */ + if (parchan->rotmode > 0) + mat3_to_eulO(parchan->eul, parchan->rotmode,rmat3); else if (parchan->rotmode == ROT_MODE_AXISANGLE) - mat3_to_axis_angle( parchan->rotAxis, &pchan->rotAngle,rmat3); + mat3_to_axis_angle(parchan->rotAxis, &parchan->rotAngle,rmat3); else - mat3_to_quat( parchan->quat,rmat3); + mat3_to_quat(parchan->quat,rmat3); /* for size, remove rotation */ /* causes problems with some constraints (so apply only if needed) */ @@ -840,9 +845,9 @@ static short pose_grab_with_ik_add(bPoseChannel *pchan) data->flag |= CONSTRAINT_IK_TEMP|CONSTRAINT_IK_AUTO; VECCOPY(data->grabtarget, pchan->pose_tail); data->rootbone= 1; - - /* we include only a connected chain */ - while ((pchan) && (pchan->bone->flag & BONE_CONNECTED)) { + + /* we only include bones that are part of a continual connected chain */ + while (pchan) { /* here, we set ik-settings for bone from pchan->protectflag */ if (pchan->protectflag & OB_LOCK_ROTX) pchan->ikflag |= BONE_IK_NO_XDOF_TEMP; if (pchan->protectflag & OB_LOCK_ROTY) pchan->ikflag |= BONE_IK_NO_YDOF_TEMP; @@ -850,7 +855,12 @@ static short pose_grab_with_ik_add(bPoseChannel *pchan) /* now we count this pchan as being included */ data->rootbone++; - pchan= pchan->parent; + + /* continue to parent, but only if we're connected to it */ + if (pchan->bone->flag & BONE_CONNECTED) + pchan = pchan->parent; + else + pchan = NULL; } /* make a copy of maximum chain-length */ @@ -930,7 +940,7 @@ static short pose_grab_with_ik(Object *ob) /* only called with pose mode active object now */ -static void createTransPose(bContext *C, TransInfo *t, Object *ob) +static void createTransPose(TransInfo *t, Object *ob) { bArmature *arm; bPoseChannel *pchan; @@ -995,7 +1005,7 @@ static void createTransPose(bContext *C, TransInfo *t, Object *ob) /* ********************* armature ************** */ -static void createTransArmatureVerts(bContext *C, TransInfo *t) +static void createTransArmatureVerts(TransInfo *t) { EditBone *ebo; bArmature *arm= t->obedit->data; @@ -1195,7 +1205,7 @@ static void createTransArmatureVerts(bContext *C, TransInfo *t) /* ********************* meta elements ********* */ -static void createTransMBallVerts(bContext *C, TransInfo *t) +static void createTransMBallVerts(TransInfo *t) { MetaBall *mb = (MetaBall*)t->obedit->data; MetaElem *ml; @@ -1530,7 +1540,7 @@ static void createTransCurveVerts(bContext *C, TransInfo *t) /* ********************* lattice *************** */ -static void createTransLatticeVerts(bContext *C, TransInfo *t) +static void createTransLatticeVerts(TransInfo *t) { Lattice *latt = ((Lattice*)t->obedit->data)->editlatt->latt; TransData *td = NULL; @@ -1896,7 +1906,7 @@ static void VertsToTransData(TransInfo *t, TransData *td, EditMesh *em, EditVert /* *********************** CrazySpace correction. Now without doing subsurf optimal ****************** */ -static void make_vertexcos__mapFunc(void *userData, int index, float *co, float *no_f, short *no_s) +static void make_vertexcos__mapFunc(void *userData, int index, float *co, float *UNUSED(no_f), short *UNUSED(no_s)) { float *vec = userData; @@ -2145,7 +2155,7 @@ static void createTransEditVerts(bContext *C, TransInfo *t) /* detect CrazySpace [tm] */ if(propmode==0) { if(modifiers_getCageIndex(t->scene, t->obedit, NULL, 1)>=0) { - if(modifiers_isCorrectableDeformed(t->scene, t->obedit)) { + if(modifiers_isCorrectableDeformed(t->obedit)) { /* check if we can use deform matrices for modifier from the start up to stack, they are more accurate than quats */ totleft= editmesh_get_first_deform_matrices(t->scene, t->obedit, em, &defmats, &defcos); @@ -2274,11 +2284,10 @@ void flushTransNodes(TransInfo *t) } /* *** SEQUENCE EDITOR *** */ -#define XXX_DURIAN_ANIM_TX_HACK void flushTransSeq(TransInfo *t) { ListBase *seqbasep= seq_give_editing(t->scene, FALSE)->seqbasep; /* Editing null check already done */ - int a, new_frame; + int a, new_frame, old_start; TransData *td= NULL; TransData2D *td2d= NULL; TransDataSeq *tdsq= NULL; @@ -2295,16 +2304,11 @@ void flushTransSeq(TransInfo *t) for(a=0, td= t->data, td2d= t->data2d; a<t->total; a++, td++, td2d++) { tdsq= (TransDataSeq *)td->extra; seq= tdsq->seq; + old_start = seq->start; new_frame= (int)floor(td2d->loc[0] + 0.5f); switch (tdsq->sel_flag) { case SELECT: -#ifdef XXX_DURIAN_ANIM_TX_HACK - if (seq != seq_prev) { - int ofs = (new_frame - tdsq->start_offset) - seq->start; // breaks for single strips - color/image - seq_offset_animdata(t->scene, seq, ofs); - } -#endif if (seq->type != SEQ_META && (seq->depth != 0 || seq_tx_test(seq))) /* for meta's, their children move */ seq->start= new_frame - tdsq->start_offset; @@ -2335,6 +2339,9 @@ void flushTransSeq(TransInfo *t) else { calc_sequence_disp(t->scene, seq); } + + if(tdsq->sel_flag == SELECT) + seq_offset_animdata(t->scene, seq, seq->start - old_start); } seq_prev= seq; } @@ -3841,6 +3848,7 @@ static short constraints_list_needinv(TransInfo *t, ListBase *list) * seq->depth must be set before running this function so we know if the strips * are root level or not */ +#define XXX_DURIAN_ANIM_TX_HACK static void SeqTransInfo(TransInfo *t, Sequence *seq, int *recursive, int *count, int *flag) { @@ -3978,7 +3986,7 @@ static int SeqTransCount(TransInfo *t, ListBase *seqbase, int depth) } -static TransData *SeqToTransData(TransInfo *t, TransData *td, TransData2D *td2d, TransDataSeq *tdsq, Sequence *seq, int flag, int sel_flag) +static TransData *SeqToTransData(TransData *td, TransData2D *td2d, TransDataSeq *tdsq, Sequence *seq, int flag, int sel_flag) { int start_left; @@ -4063,16 +4071,16 @@ static int SeqToTransData_Recursive(TransInfo *t, ListBase *seqbase, TransData * if (flag & SELECT) { if (flag & (SEQ_LEFTSEL|SEQ_RIGHTSEL)) { if (flag & SEQ_LEFTSEL) { - SeqToTransData(t, td++, td2d++, tdsq++, seq, flag, SEQ_LEFTSEL); + SeqToTransData(td++, td2d++, tdsq++, seq, flag, SEQ_LEFTSEL); tot++; } if (flag & SEQ_RIGHTSEL) { - SeqToTransData(t, td++, td2d++, tdsq++, seq, flag, SEQ_RIGHTSEL); + SeqToTransData(td++, td2d++, tdsq++, seq, flag, SEQ_RIGHTSEL); tot++; } } else { - SeqToTransData(t, td++, td2d++, tdsq++, seq, flag, SELECT); + SeqToTransData(td++, td2d++, tdsq++, seq, flag, SELECT); tot++; } } @@ -4232,7 +4240,7 @@ static void createTransSeqData(bContext *C, TransInfo *t) /* transcribe given object into TransData for Transforming */ -static void ObjectToTransData(bContext *C, TransInfo *t, TransData *td, Object *ob) +static void ObjectToTransData(TransInfo *t, TransData *td, Object *ob) { Scene *scene = t->scene; float obmtx[3][3]; @@ -4342,7 +4350,7 @@ static void ObjectToTransData(bContext *C, TransInfo *t, TransData *td, Object * /* sets flags in Bases to define whether they take part in transform */ /* it deselects Bases, so we have to call the clear function always after */ -static void set_trans_object_base_flags(bContext *C, TransInfo *t) +static void set_trans_object_base_flags(TransInfo *t) { Scene *scene = t->scene; View3D *v3d = t->view; @@ -4720,7 +4728,7 @@ void autokeyframe_pose_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *o */ if (C && (ob->pose->avs.path_bakeflag & MOTIONPATH_BAKE_HAS_PATHS)) { //ED_pose_clear_paths(C, ob); // XXX for now, don't need to clear - ED_pose_recalculate_paths(C, scene, ob); + ED_pose_recalculate_paths(scene, ob); } } else { @@ -5091,7 +5099,7 @@ static void createTransObject(bContext *C, TransInfo *t) TransDataExtension *tx; int propmode = t->flag & T_PROP_EDIT; - set_trans_object_base_flags(C, t); + set_trans_object_base_flags(t); /* count */ t->total= CTX_DATA_COUNT(C, selected_objects); @@ -5130,7 +5138,7 @@ static void createTransObject(bContext *C, TransInfo *t) td->flag |= TD_SKIP; } - ObjectToTransData(C, t, td, ob); + ObjectToTransData(t, td, ob); td->val = NULL; td++; tx++; @@ -5153,7 +5161,7 @@ static void createTransObject(bContext *C, TransInfo *t) td->ext = tx; td->rotOrder= ob->rotmode; - ObjectToTransData(C, t, td, ob); + ObjectToTransData(t, td, ob); td->val = NULL; td++; tx++; @@ -5210,12 +5218,12 @@ void createTransData(bContext *C, TransInfo *t) if (t->options & CTX_TEXTURE) { t->flag |= T_TEXTURE; - createTransTexspace(C, t); + createTransTexspace(t); } else if (t->options & CTX_EDGE) { t->ext = NULL; t->flag |= T_EDIT; - createTransEdge(C, t); + createTransEdge(t); if(t->data && t->flag & T_PROP_EDIT) { sort_trans_data(t); // makes selected become first in array set_prop_dist(t, 1); @@ -5277,14 +5285,14 @@ void createTransData(bContext *C, TransInfo *t) createTransCurveVerts(C, t); } else if (t->obedit->type==OB_LATTICE) { - createTransLatticeVerts(C, t); + createTransLatticeVerts(t); } else if (t->obedit->type==OB_MBALL) { - createTransMBallVerts(C, t); + createTransMBallVerts(t); } else if (t->obedit->type==OB_ARMATURE) { t->flag &= ~T_PROP_EDIT; - createTransArmatureVerts(C, t); + createTransArmatureVerts(t); } else { printf("edit type not implemented!\n"); @@ -5315,22 +5323,22 @@ void createTransData(bContext *C, TransInfo *t) else if (ob && (ob->mode & OB_MODE_POSE)) { // XXX this is currently limited to active armature only... // XXX active-layer checking isn't done as that should probably be checked through context instead - createTransPose(C, t, ob); + createTransPose(t, ob); } else if (ob && (ob->mode & OB_MODE_WEIGHT_PAINT)) { - /* exception, we look for the one selected armature */ - CTX_DATA_BEGIN(C, Object*, ob_armature, selected_objects) - { - if(ob_armature->type==OB_ARMATURE) - { - if((ob_armature->mode & OB_MODE_POSE) && ob_armature == modifiers_isDeformedByArmature(ob)) - { - createTransPose(C, t, ob_armature); - break; + /* important that ob_armature can be set even when its not selected [#23412] + * lines below just check is also visible */ + Object *ob_armature= modifiers_isDeformedByArmature(ob); + if(ob_armature && ob_armature->mode & OB_MODE_POSE) { + Base *base_arm= object_in_scene(ob_armature, t->scene); + if(base_arm) { + View3D *v3d = t->view; + if(BASE_VISIBLE(v3d, base_arm)) { + createTransPose(t, ob_armature); } } + } - CTX_DATA_END; } else if (ob && (ob->mode & OB_MODE_PARTICLE_EDIT) && PE_start_edit(PE_get_current(scene, ob))) { diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c index 54a86b3dca1..ce0888b6a30 100644 --- a/source/blender/editors/transform/transform_input.c +++ b/source/blender/editors/transform/transform_input.c @@ -55,7 +55,7 @@ void InputVector(TransInfo *t, MouseInput *mi, short mval[2], float output[3]) } -void InputSpring(TransInfo *t, MouseInput *mi, short mval[2], float output[3]) +void InputSpring(TransInfo *UNUSED(t), MouseInput *mi, short mval[2], float output[3]) { float ratio, precise_ratio, dx, dy; if(mi->precision) @@ -93,7 +93,7 @@ void InputSpringFlip(TransInfo *t, MouseInput *mi, short mval[2], float output[3 } } -void InputTrackBall(TransInfo *t, MouseInput *mi, short mval[2], float output[3]) +void InputTrackBall(TransInfo *UNUSED(t), MouseInput *mi, short mval[2], float output[3]) { if(mi->precision) @@ -162,7 +162,7 @@ void InputVerticalAbsolute(TransInfo *t, MouseInput *mi, short mval[2], float ou output[0] = dot_v3v3(t->viewinv[1], vec) * 2.0f; } -void setCustomPoints(TransInfo *t, MouseInput *mi, short start[2], short end[2]) +void setCustomPoints(TransInfo *UNUSED(t), MouseInput *mi, short start[2], short end[2]) { short *data; @@ -178,7 +178,7 @@ void setCustomPoints(TransInfo *t, MouseInput *mi, short start[2], short end[2]) data[3] = end[1]; } -void InputCustomRatio(TransInfo *t, MouseInput *mi, short mval[2], float output[3]) +void InputCustomRatio(TransInfo *UNUSED(t), MouseInput *mi, short mval[2], float output[3]) { float length; float distance; @@ -211,7 +211,7 @@ void InputCustomRatio(TransInfo *t, MouseInput *mi, short mval[2], float output[ } } -void InputAngle(TransInfo *t, MouseInput *mi, short mval[2], float output[3]) +void InputAngle(TransInfo *UNUSED(t), MouseInput *mi, short mval[2], float output[3]) { double dx2 = mval[0] - mi->center[0]; double dy2 = mval[1] - mi->center[1]; @@ -272,7 +272,7 @@ void InputAngle(TransInfo *t, MouseInput *mi, short mval[2], float output[3]) output[0] = *angle; } -void initMouseInput(TransInfo *t, MouseInput *mi, int center[2], short mval[2]) +void initMouseInput(TransInfo *UNUSED(t), MouseInput *mi, int center[2], short mval[2]) { mi->factor = 0; mi->precision = 0; diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c index 51698c27b37..030ad190dc3 100644 --- a/source/blender/editors/transform/transform_manipulator.c +++ b/source/blender/editors/transform/transform_manipulator.c @@ -101,16 +101,6 @@ #define MAN_GHOST 1 #define MAN_MOVECOL 2 - -static int is_mat4_flipped(float mat[][4]) -{ - float vec[3]; - - cross_v3_v3v3(vec, mat[0], mat[1]); - if( dot_v3v3(vec, mat[2]) < 0.0 ) return 1; - return 0; -} - /* transform widget center calc helper for below */ static void calc_tw_center(Scene *scene, float *co) { @@ -753,7 +743,7 @@ static void preOrthoFront(int ortho, float twmat[][4], int axis) orthogonalize_m4(omat, axis); glPushMatrix(); glMultMatrixf(omat); - glFrontFace( is_mat4_flipped(omat)?GL_CW:GL_CCW); + glFrontFace(is_negative_m4(omat) ? GL_CW:GL_CCW); } } @@ -850,12 +840,12 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving, // XXX mul_m4_m3m4(matt, t->mat, rv3d->twmat); if (ortho) { glMultMatrixf(matt); - glFrontFace( is_mat4_flipped(matt)?GL_CW:GL_CCW); + glFrontFace(is_negative_m4(matt) ? GL_CW:GL_CCW); } } else { if (ortho) { - glFrontFace( is_mat4_flipped(rv3d->twmat)?GL_CW:GL_CCW); + glFrontFace(is_negative_m4(rv3d->twmat) ? GL_CW:GL_CCW); glMultMatrixf(rv3d->twmat); } } @@ -1116,11 +1106,11 @@ static void draw_manipulator_scale(View3D *v3d, RegionView3D *rv3d, int moving, copy_m4_m4(matt, rv3d->twmat); // to copy the parts outside of [3][3] // XXX mul_m4_m3m4(matt, t->mat, rv3d->twmat); glMultMatrixf(matt); - glFrontFace( is_mat4_flipped(matt)?GL_CW:GL_CCW); + glFrontFace(is_negative_m4(matt) ? GL_CW:GL_CCW); } else { glMultMatrixf(rv3d->twmat); - glFrontFace( is_mat4_flipped(rv3d->twmat)?GL_CW:GL_CCW); + glFrontFace(is_negative_m4(rv3d->twmat) ? GL_CW:GL_CCW); } /* axis */ @@ -1197,7 +1187,7 @@ static void draw_cylinder(GLUquadricObj *qobj, float len, float width) } -static void draw_manipulator_translate(View3D *v3d, RegionView3D *rv3d, int moving, int drawflags, int combo, int colcode) +static void draw_manipulator_translate(View3D *v3d, RegionView3D *rv3d, int UNUSED(moving), int drawflags, int combo, int colcode) { GLUquadricObj *qobj; float cylen= 0.01f*(float)U.tw_handlesize; @@ -1327,7 +1317,7 @@ static void draw_manipulator_rotate_cyl(View3D *v3d, RegionView3D *rv3d, int mov glMultMatrixf(rv3d->twmat); } - glFrontFace( is_mat4_flipped(rv3d->twmat)?GL_CW:GL_CCW); + glFrontFace(is_negative_m4(rv3d->twmat) ? GL_CW:GL_CCW); /* axis */ if( (G.f & G_PICKSEL)==0 ) { diff --git a/source/blender/editors/transform/transform_ndofinput.c b/source/blender/editors/transform/transform_ndofinput.c index 3e47484c54c..1ff16dd5f5f 100644 --- a/source/blender/editors/transform/transform_ndofinput.c +++ b/source/blender/editors/transform/transform_ndofinput.c @@ -65,7 +65,7 @@ static void resetNDofInput(NDofInput *n) } -int handleNDofInput(NDofInput *n, wmEvent *event) +int handleNDofInput(NDofInput *UNUSED(n), wmEvent *UNUSED(event)) { int retval = 0; // TRANSFORM_FIX_ME diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c index 95e167053ec..381612bf1ef 100644 --- a/source/blender/editors/transform/transform_ops.c +++ b/source/blender/editors/transform/transform_ops.c @@ -145,7 +145,7 @@ static int select_orientation_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int select_orientation_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int select_orientation_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event)) { uiPopupMenu *pup; uiLayout *layout; @@ -179,7 +179,7 @@ void TRANSFORM_OT_select_orientation(struct wmOperatorType *ot) } -static int delete_orientation_exec(bContext *C, wmOperator *op) +static int delete_orientation_exec(bContext *C, wmOperator *UNUSED(op)) { View3D *v3d = CTX_wm_view3d(C); int selected_index = (v3d->twmode - V3D_MANIP_CUSTOM); @@ -192,7 +192,7 @@ static int delete_orientation_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int delete_orientation_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int delete_orientation_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { return delete_orientation_exec(C, op); } @@ -243,7 +243,7 @@ static int create_orientation_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int create_orientation_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int create_orientation_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { return create_orientation_exec(C, op); } diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index 508dde31010..16519bdf647 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -141,7 +141,7 @@ void BIF_createTransformOrientation(bContext *C, ReportList *reports, char *name } } -TransformOrientation *createObjectSpace(bContext *C, ReportList *reports, char *name, int overwrite) { +TransformOrientation *createObjectSpace(bContext *C, ReportList *UNUSED(reports), char *name, int overwrite) { Base *base = CTX_data_active_base(C); Object *ob; float mat[3][3]; diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index 09c04168a71..adaaf7c9de6 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -210,7 +210,7 @@ void drawSnapping(const struct bContext *C, TransInfo *t) } } -int handleSnapping(TransInfo *t, wmEvent *event) +int handleSnapping(TransInfo *UNUSED(t), wmEvent *UNUSED(event)) { int status = 0; @@ -596,7 +596,7 @@ void ApplySnapResize(TransInfo *t, float vec[3]) /********************** DISTANCE **************************/ -float TranslationBetween(TransInfo *t, float p1[3], float p2[3]) +float TranslationBetween(TransInfo *UNUSED(t), float p1[3], float p2[3]) { return len_v3v3(p1, p2); } @@ -680,12 +680,12 @@ float ResizeBetween(TransInfo *t, float p1[3], float p2[3]) /********************** CALC **************************/ -void CalcSnapGrid(TransInfo *t, float *vec) +void CalcSnapGrid(TransInfo *t, float *UNUSED(vec)) { snapGridAction(t, t->tsnap.snapPoint, BIG_GEARS); } -void CalcSnapGeometry(TransInfo *t, float *vec) +void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec)) { if (t->spacetype == SPACE_VIEW3D) { @@ -1194,7 +1194,7 @@ int snapVertex(ARegion *ar, float vco[3], short vno[3], float mval[2], float ray return retval; } -int snapArmature(short snap_mode, ARegion *ar, Object *ob, bArmature *arm, float obmat[][4], float ray_start[3], float ray_normal[3], float mval[2], float *loc, float *no, int *dist, float *depth) +int snapArmature(short snap_mode, ARegion *ar, Object *ob, bArmature *arm, float obmat[][4], float ray_start[3], float ray_normal[3], float mval[2], float *loc, float *UNUSED(no), int *dist, float *depth) { float imat[4][4]; float ray_start_local[3], ray_normal_local[3]; @@ -1587,7 +1587,7 @@ int snapObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, float mv base= FIRSTBASE; for ( base = FIRSTBASE; base != NULL; base = base->next ) { - if ( BASE_SELECTABLE(v3d, base) && (base->flag & (BA_HAS_RECALC_OB|BA_HAS_RECALC_DATA)) == 0 && ((mode == SNAP_NOT_SELECTED && (base->flag & (SELECT|BA_WAS_SEL)) == 0) || (ELEM(mode, SNAP_ALL, SNAP_NOT_OBEDIT) && base != BASACT)) ) { + if ( BASE_VISIBLE(v3d, base) && (base->flag & (BA_HAS_RECALC_OB|BA_HAS_RECALC_DATA)) == 0 && ((mode == SNAP_NOT_SELECTED && (base->flag & (SELECT|BA_WAS_SEL)) == 0) || (ELEM(mode, SNAP_ALL, SNAP_NOT_OBEDIT) && base != BASACT)) ) { Object *ob = base->object; if (ob->transflag & OB_DUPLI) @@ -1682,7 +1682,7 @@ void addDepthPeel(ListBase *depth_peels, float depth, float p[3], float no[3], O peel->flag = 0; } -int peelDerivedMesh(Object *ob, DerivedMesh *dm, float obmat[][4], float ray_start[3], float ray_normal[3], float mval[2], ListBase *depth_peels) +int peelDerivedMesh(Object *ob, DerivedMesh *dm, float obmat[][4], float ray_start[3], float ray_normal[3], float UNUSED(mval[2]), ListBase *depth_peels) { int retval = 0; int totvert = dm->getNumVerts(dm); diff --git a/source/blender/editors/util/editmode_undo.c b/source/blender/editors/util/editmode_undo.c index 290c8a64881..debb8cedd07 100644 --- a/source/blender/editors/util/editmode_undo.c +++ b/source/blender/editors/util/editmode_undo.c @@ -37,6 +37,7 @@ #include "DNA_object_types.h" #include "DNA_screen_types.h" +#include "BKE_utildefines.h" #include "BKE_context.h" #include "BKE_depsgraph.h" #include "BKE_global.h" @@ -74,7 +75,7 @@ void undo_editmode_menu(void) // history menu /* ********************************************************************* */ /* ****** XXX ***** */ -void error(const char *dummy) {} +void error(const char *UNUSED(arg)) {} /* ****** XXX ***** */ @@ -341,7 +342,7 @@ void undo_editmode_menu(bContext *C) if(event>0) undo_number(C, event); } -static void do_editmode_undohistorymenu(bContext *C, void *arg, int event) +static void do_editmode_undohistorymenu(bContext *C, void *UNUSED(arg), int event) { Object *obedit= CTX_data_edit_object(C); @@ -351,7 +352,7 @@ static void do_editmode_undohistorymenu(bContext *C, void *arg, int event) } -uiBlock *editmode_undohistorymenu(bContext *C, ARegion *ar, void *arg_unused) +uiBlock *editmode_undohistorymenu(bContext *C, ARegion *ar, void *UNUSED(arg)) { uiBlock *block; UndoElem *uel; diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c index e5128ea784a..a4f661e9511 100644 --- a/source/blender/editors/util/undo.c +++ b/source/blender/editors/util/undo.c @@ -196,14 +196,14 @@ void ED_undo_pop_op(bContext *C, wmOperator *op) ed_undo_step(C, 0, op->type->name); } -static int ed_undo_exec(bContext *C, wmOperator *op) +static int ed_undo_exec(bContext *C, wmOperator *UNUSED(op)) { /* "last operator" should disappear, later we can tie ths with undo stack nicer */ WM_operator_stack_clear(C); return ed_undo_step(C, 1, NULL); } -static int ed_redo_exec(bContext *C, wmOperator *op) +static int ed_redo_exec(bContext *C, wmOperator *UNUSED(op)) { return ed_undo_step(C, -1, NULL); } diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c index f1f2dd8548a..5169b096d09 100644 --- a/source/blender/editors/uvedit/uvedit_draw.c +++ b/source/blender/editors/uvedit/uvedit_draw.c @@ -113,7 +113,7 @@ static int draw_uvs_face_check(Scene *scene) return (ts->uv_selectmode == UV_SELECT_FACE); } -static void draw_uvs_shadow(SpaceImage *sima, Object *obedit) +static void draw_uvs_shadow(Object *obedit) { EditMesh *em; EditFace *efa; @@ -374,7 +374,7 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, EditMesh *em, MTFac } } -static void draw_uvs_other(SpaceImage *sima, Scene *scene, Object *obedit, MTFace *activetf) +static void draw_uvs_other(Scene *scene, Object *obedit, MTFace *activetf) { Base *base; Image *curimage; @@ -440,7 +440,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit) /* draw other uvs */ if(sima->flag & SI_DRAW_OTHER) - draw_uvs_other(sima, scene, obedit, activetf); + draw_uvs_other(scene, obedit, activetf); /* 1. draw shadow mesh */ @@ -838,7 +838,7 @@ void draw_uvedit_main(SpaceImage *sima, ARegion *ar, Scene *scene, Object *obedi if(show_uvedit || show_uvshadow) { if(show_uvshadow) - draw_uvs_shadow(sima, obedit); + draw_uvs_shadow(obedit); else draw_uvs(sima, scene, obedit); diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index 5c4564f1946..d311733e945 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -141,7 +141,7 @@ void ED_uvedit_assign_image(Scene *scene, Object *obedit, Image *ima, Image *pre /* dotile - 1, set the tile flag (from the space image) * 2, set the tile index for the faces. */ -void ED_uvedit_set_tile(bContext *C, Scene *scene, Object *obedit, Image *ima, int curtile) +static int uvedit_set_tile(Object *obedit, Image *ima, int curtile) { EditMesh *em; EditFace *efa; @@ -149,11 +149,14 @@ void ED_uvedit_set_tile(bContext *C, Scene *scene, Object *obedit, Image *ima, i /* verify if we have something to do */ if(!ima || !ED_uvedit_test(obedit)) - return; - + return 0; + + if((ima->tpageflag & IMA_TILES) == 0) + return 0; + /* skip assigning these procedural images... */ if(ima->type==IMA_TYPE_R_RESULT || ima->type==IMA_TYPE_COMPOSITE) - return; + return 0; em= BKE_mesh_get_editmesh((Mesh*)obedit->data); @@ -165,8 +168,9 @@ void ED_uvedit_set_tile(bContext *C, Scene *scene, Object *obedit, Image *ima, i } DAG_id_flush_update(obedit->data, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); BKE_mesh_end_editmesh(obedit->data, em); + + return 1; } /*********************** space conversion *********************/ @@ -845,7 +849,8 @@ static void select_linked(Scene *scene, Image *ima, EditMesh *em, float limit[2] tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE); if(uvedit_face_visible(scene, ima, efa, tf)) { - if(tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4)) { + const char select_flag= efa->v4 ? (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4) : (TF_SEL1|TF_SEL2|TF_SEL3); + if(tf->flag & select_flag) { stack[stacksize]= a; stacksize++; flag[a]= 1; @@ -909,12 +914,9 @@ static void select_linked(Scene *scene, Image *ima, EditMesh *em, float limit[2] else { for(a=0, efa= em->faces.first; efa; efa= efa->next, a++) { if(flag[a]) { + const char select_flag= efa->v4 ? (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4) : (TF_SEL1|TF_SEL2|TF_SEL3); tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE); - if(efa->v4) { - if((tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4))) - break; - } - else if(tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3)) + if((tf->flag & select_flag)) break; } } @@ -1052,7 +1054,7 @@ void UV_OT_align(wmOperatorType *ot) /* ******************** weld operator **************** */ -static int weld_exec(bContext *C, wmOperator *op) +static int weld_exec(bContext *C, wmOperator *UNUSED(op)) { weld_align_uv(C, 'w'); @@ -1264,7 +1266,7 @@ void UV_OT_stitch(wmOperatorType *ot) /* ******************** (de)select all operator **************** */ -static int select_inverse_exec(bContext *C, wmOperator *op) +static int select_inverse_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene; ToolSettings *ts; @@ -1355,10 +1357,11 @@ static int select_all_exec(bContext *C, wmOperator *op) if (action == SEL_TOGGLE) { action = SEL_SELECT; for(efa= em->faces.first; efa; efa= efa->next) { + const char select_flag= efa->v4 ? (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4) : (TF_SEL1|TF_SEL2|TF_SEL3); tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE); if(uvedit_face_visible(scene, ima, efa, tf)) { - if(tf->flag & (TF_SEL1+TF_SEL2+TF_SEL3+TF_SEL4)) { + if(tf->flag & select_flag) { action = SEL_DESELECT; break; } @@ -1370,12 +1373,7 @@ static int select_all_exec(bContext *C, wmOperator *op) tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE); if(uvedit_face_visible(scene, ima, efa, tf)) { - char select_flag; - - if(efa->v4) - select_flag = (TF_SEL1+TF_SEL2+TF_SEL3+TF_SEL4); - else - select_flag = (TF_SEL1+TF_SEL2+TF_SEL3); + const char select_flag= efa->v4 ? (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4) : (TF_SEL1|TF_SEL2|TF_SEL3); switch (action) { case SEL_SELECT: @@ -1937,14 +1935,10 @@ static int unlink_selection_exec(bContext *C, wmOperator *op) tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE); if(uvedit_face_visible(scene, ima, efa, tf)) { - if(efa->v4) { - if(~tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4)) - tf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4); - } - else { - if(~tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3)) - tf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3); - } + const char select_flag= efa->v4 ? (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4) : (TF_SEL1|TF_SEL2|TF_SEL3); + if(~tf->flag & select_flag) + tf->flag &= ~select_flag; + } } @@ -2260,7 +2254,7 @@ void UV_OT_select_border(wmOperatorType *ot) /* ******************** circle select operator **************** */ -static void select_uv_inside_ellipse(SpaceImage *sima, Scene *scene, int select, EditFace *efa, MTFace *tface, int index, float *offset, float *ell, int select_index) +static void select_uv_inside_ellipse(Scene *scene, int select, EditFace *efa, MTFace *tface, int index, float *offset, float *ell, int select_index) { /* normalized ellipse: ell[0] = scaleX, ell[1] = scaleY */ float x, y, r2, *uv; @@ -2309,11 +2303,11 @@ int circle_select_exec(bContext *C, wmOperator *op) /* do selection */ for(efa= em->faces.first; efa; efa= efa->next) { tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE); - select_uv_inside_ellipse(sima, scene, select, efa, tface, 0, offset, ellipse, 0); - select_uv_inside_ellipse(sima, scene, select, efa, tface, 1, offset, ellipse, 1); - select_uv_inside_ellipse(sima, scene, select, efa, tface, 2, offset, ellipse, 2); + select_uv_inside_ellipse(scene, select, efa, tface, 0, offset, ellipse, 0); + select_uv_inside_ellipse(scene, select, efa, tface, 1, offset, ellipse, 1); + select_uv_inside_ellipse(scene, select, efa, tface, 2, offset, ellipse, 2); if(efa->v4) - select_uv_inside_ellipse(sima, scene, select, efa, tface, 3, offset, ellipse, 3); + select_uv_inside_ellipse(scene, select, efa, tface, 3, offset, ellipse, 3); } if(select) EM_select_flush(em); @@ -2714,7 +2708,7 @@ void UV_OT_pin(wmOperatorType *ot) /******************* select pinned operator ***************/ -static int select_pinned_exec(bContext *C, wmOperator *op) +static int select_pinned_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); @@ -2800,11 +2794,9 @@ static int hide_exec(bContext *C, wmOperator *op) tf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4); } else if(em->selectmode == SCE_SELECT_FACE) { - if((tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3))==0) { - if(!efa->v4) - EM_select_face(efa, 0); - else if(!(tf->flag & TF_SEL4)) - EM_select_face(efa, 0); + const char select_flag= efa->v4 ? (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4) : (TF_SEL1|TF_SEL2|TF_SEL3); + if((tf->flag & select_flag)==0) { + EM_select_face(efa, 0); tf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4); } } @@ -2845,9 +2837,8 @@ static int hide_exec(bContext *C, wmOperator *op) tf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4); } else if(em->selectmode == SCE_SELECT_FACE) { - if(tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3)) - EM_select_face(efa, 0); - else if(efa->v4 && tf->flag & TF_SEL4) + const char select_flag= efa->v4 ? (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4) : (TF_SEL1|TF_SEL2|TF_SEL3); + if(tf->flag & select_flag) EM_select_face(efa, 0); tf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4); @@ -2902,7 +2893,7 @@ void UV_OT_hide(wmOperatorType *ot) /****************** reveal operator ******************/ -static int reveal_exec(bContext *C, wmOperator *op) +static int reveal_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceImage *sima= CTX_wm_space_image(C); ToolSettings *ts= CTX_data_tool_settings(C); @@ -3086,16 +3077,18 @@ static int set_tile_exec(bContext *C, wmOperator *op) { Image *ima= CTX_data_edit_image(C); int tile[2]; - - if(!ima || !(ima->tpageflag & IMA_TILES)) - return OPERATOR_CANCELLED; + Object *obedit= CTX_data_edit_object(C); RNA_int_get_array(op->ptr, "tile", tile); - ED_uvedit_set_tile(C, CTX_data_scene(C), CTX_data_edit_object(C), ima, tile[0] + ima->xrep*tile[1]); - WM_event_add_notifier(C, NC_SPACE|ND_SPACE_IMAGE, NULL); + if(uvedit_set_tile(obedit, ima, tile[0] + ima->xrep*tile[1])) { + WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); + WM_event_add_notifier(C, NC_SPACE|ND_SPACE_IMAGE, NULL); - return OPERATOR_FINISHED; + return OPERATOR_FINISHED; + } + + return OPERATOR_CANCELLED; } static int set_tile_invoke(bContext *C, wmOperator *op, wmEvent *event) diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index 20c9fa5877b..e5e46d407c9 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -330,7 +330,7 @@ static int minimize_stretch_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int minimize_stretch_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int minimize_stretch_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { MinStretch *ms; @@ -425,7 +425,7 @@ void UV_OT_minimize_stretch(wmOperatorType *ot) /* ******************** Pack Islands operator **************** */ -static int pack_islands_exec(bContext *C, wmOperator *op) +static int pack_islands_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); @@ -458,7 +458,7 @@ void UV_OT_pack_islands(wmOperatorType *ot) /* ******************** Average Islands Scale operator **************** */ -static int average_islands_scale_exec(bContext *C, wmOperator *op) +static int average_islands_scale_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); @@ -975,7 +975,7 @@ void UV_OT_from_view(wmOperatorType *ot) /********************** Reset operator ********************/ -static int reset_exec(bContext *C, wmOperator *op) +static int reset_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); |